babel-plugin-wallace 0.0.2 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/ast-helpers.d.ts +10 -0
  3. package/dist/ast-helpers.js +52 -0
  4. package/dist/ast-helpers.js.map +1 -0
  5. package/dist/babel-types.d.ts +4 -0
  6. package/dist/babel-types.js +3 -0
  7. package/dist/babel-types.js.map +1 -0
  8. package/dist/builders/consolidation.d.ts +30 -0
  9. package/dist/builders/consolidation.js +321 -0
  10. package/dist/builders/consolidation.js.map +1 -0
  11. package/dist/builders/define-component.d.ts +7 -0
  12. package/dist/builders/define-component.js +101 -0
  13. package/dist/builders/define-component.js.map +1 -0
  14. package/dist/builders/index.d.ts +2 -0
  15. package/dist/builders/index.js +7 -0
  16. package/dist/builders/index.js.map +1 -0
  17. package/dist/builders/types.d.ts +15 -0
  18. package/dist/builders/types.js +3 -0
  19. package/dist/builders/types.js.map +1 -0
  20. package/dist/builders/visibility.d.ts +5 -0
  21. package/dist/builders/visibility.js +43 -0
  22. package/dist/builders/visibility.js.map +1 -0
  23. package/dist/config.d.ts +14 -0
  24. package/dist/config.js +47 -0
  25. package/dist/config.js.map +1 -0
  26. package/dist/constants.d.ts +31 -0
  27. package/dist/constants.js +40 -0
  28. package/dist/constants.js.map +1 -0
  29. package/dist/contexts/handlers.d.ts +18 -0
  30. package/dist/contexts/handlers.js +152 -0
  31. package/dist/contexts/handlers.js.map +1 -0
  32. package/dist/contexts/index.d.ts +2 -0
  33. package/dist/contexts/index.js +6 -0
  34. package/dist/contexts/index.js.map +1 -0
  35. package/dist/contexts/parameters.d.ts +8 -0
  36. package/dist/contexts/parameters.js +114 -0
  37. package/dist/contexts/parameters.js.map +1 -0
  38. package/dist/directives.d.ts +8 -0
  39. package/dist/directives.js +94 -0
  40. package/dist/directives.js.map +1 -0
  41. package/dist/errors.d.ts +32 -0
  42. package/dist/errors.js +45 -0
  43. package/dist/errors.js.map +1 -0
  44. package/dist/helpers.d.ts +4 -0
  45. package/dist/helpers.js +35 -0
  46. package/dist/helpers.js.map +1 -0
  47. package/dist/index.d.ts +10 -0
  48. package/dist/index.js +34 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/models/component.d.ts +25 -0
  51. package/dist/models/component.js +114 -0
  52. package/dist/models/component.js.map +1 -0
  53. package/dist/models/directive.d.ts +13 -0
  54. package/dist/models/directive.js +8 -0
  55. package/dist/models/directive.js.map +1 -0
  56. package/dist/models/index.d.ts +5 -0
  57. package/dist/models/index.js +15 -0
  58. package/dist/models/index.js.map +1 -0
  59. package/dist/models/module.d.ts +12 -0
  60. package/dist/models/module.js +40 -0
  61. package/dist/models/module.js.map +1 -0
  62. package/dist/models/node.d.ts +82 -0
  63. package/dist/models/node.js +306 -0
  64. package/dist/models/node.js.map +1 -0
  65. package/dist/utils.d.ts +12 -0
  66. package/dist/utils.js +59 -0
  67. package/dist/utils.js.map +1 -0
  68. package/dist/visitors/attribute.d.ts +10 -0
  69. package/dist/visitors/attribute.js +82 -0
  70. package/dist/visitors/attribute.js.map +1 -0
  71. package/dist/visitors/jsx.d.ts +13 -0
  72. package/dist/visitors/jsx.js +61 -0
  73. package/dist/visitors/jsx.js.map +1 -0
  74. package/dist/visitors/program.d.ts +12 -0
  75. package/dist/visitors/program.js +26 -0
  76. package/dist/visitors/program.js.map +1 -0
  77. package/package.json +19 -10
  78. package/README.md +0 -3
  79. package/lib/_config/directives.js +0 -356
  80. package/lib/_config/index.js +0 -2
  81. package/lib/_config/loader.js +0 -43
  82. package/lib/_config/parse_directives.js +0 -63
  83. package/lib/config.js +0 -263
  84. package/lib/convert.js +0 -27
  85. package/lib/definitions/constants.js +0 -73
  86. package/lib/definitions/node_data.js +0 -183
  87. package/lib/definitions/watcher.js +0 -26
  88. package/lib/generate/code_generator.js +0 -333
  89. package/lib/generate/statement_builders.js +0 -130
  90. package/lib/help-system/browser-code.js +0 -50
  91. package/lib/help-system/entry.js +0 -92
  92. package/lib/help-system/error-display.js +0 -20
  93. package/lib/help-system/styles.css +0 -25
  94. package/lib/import-checker.js +0 -35
  95. package/lib/index.js +0 -47
  96. package/lib/jsx/component_dom.js +0 -40
  97. package/lib/jsx/contexts.js +0 -121
  98. package/lib/jsx/extract.js +0 -214
  99. package/lib/jsx/parse.js +0 -98
  100. package/lib/parse/component_templates.js +0 -44
  101. package/lib/parse/inline_directives.js +0 -318
  102. package/lib/parse/parse_node.js +0 -73
  103. package/lib/polyfills.js +0 -10
  104. package/lib/utils/babel.js +0 -100
  105. package/lib/utils/dom.js +0 -174
  106. package/lib/utils/misc.js +0 -152
  107. package/lib_old/handlers.js +0 -52
  108. package/lib_old/index.js +0 -145
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Andrew Buchan
3
+ Copyright (c) 2025 Andrew Buchan
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,10 @@
1
+ import type { NodePath } from "@babel/core";
2
+ import type { Expression, JSXElement, JSXEmptyExpression } from "@babel/types";
3
+ export declare function getJSXElementName(path: NodePath<JSXElement>): string | {
4
+ name: string;
5
+ namespace: string;
6
+ };
7
+ /**
8
+ * An Expression can be one of dozens of types, most of which are not usable.
9
+ */
10
+ export declare function getPlaceholderExpression(path: NodePath, expression: Expression | JSXEmptyExpression): Expression;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getJSXElementName = getJSXElementName;
4
+ exports.getPlaceholderExpression = getPlaceholderExpression;
5
+ const t = require("@babel/types");
6
+ const errors_1 = require("./errors");
7
+ function getJSXElementName(path) {
8
+ const openingElementName = path.node.openingElement.name;
9
+ if (t.isJSXIdentifier(openingElementName)) {
10
+ return openingElementName.name;
11
+ }
12
+ else if (t.isJSXNamespacedName(openingElementName)) {
13
+ const { namespace, name } = openingElementName;
14
+ return { namespace: namespace.name, name: name.name };
15
+ }
16
+ else if (t.isJSXMemberExpression(openingElementName)) {
17
+ const { object, property } = openingElementName;
18
+ if (t.isJSXIdentifier(object)) {
19
+ return { namespace: object.name, name: property.name };
20
+ }
21
+ else {
22
+ (0, errors_1.error)(path, errors_1.ERROR_MESSAGES.ARROW_FUNCTION_NOT_ASSIGNED);
23
+ }
24
+ }
25
+ else {
26
+ console.debug(path.node);
27
+ throw Error(`Can't read name from ${openingElementName}`);
28
+ }
29
+ }
30
+ /**
31
+ * An Expression can be one of dozens of types, most of which are not usable.
32
+ */
33
+ function getPlaceholderExpression(path, expression) {
34
+ // if (
35
+ // // TODO: I probably need to expand this...
36
+ // t.isIdentifier(expression) ||
37
+ // t.isMemberExpression(expression) ||
38
+ // t.isCallExpression(expression)
39
+ // ) {
40
+ // return expression;
41
+ // } else
42
+ if (t.isJSXEmptyExpression(expression)) {
43
+ (0, errors_1.error)(path, errors_1.ERROR_MESSAGES.PLACEHOLDER_MAY_NOT_BE_EMPTY);
44
+ }
45
+ else if (t.isObjectExpression(expression)) {
46
+ // The code is copied, so the object would be created afresh each time.
47
+ (0, errors_1.error)(path, errors_1.ERROR_MESSAGES.PLACEHOLDER_MAY_NOT_BE_LITERAL_OBJECT);
48
+ }
49
+ //error(path, ERROR_MESSAGES.INVALID_PLACEHOLDER_EXPRESSION);
50
+ return expression;
51
+ }
52
+ //# sourceMappingURL=ast-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-helpers.js","sourceRoot":"","sources":["../src/ast-helpers.ts"],"names":[],"mappings":";;AAKA,8CAoBC;AAKD,4DAoBC;AAlDD,kCAAkC;AAGlC,qCAAiD;AAEjD,SAAgB,iBAAiB,CAC/B,IAA0B;IAE1B,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;IACzD,IAAI,CAAC,CAAC,eAAe,CAAC,kBAAkB,C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AC;QAC5C,uEAAuE;QACvE,IAAA,cAAK,EAAC,IAAI,EAAE,uBAAc,CAAC,qCAAqC,CAAC,CAAC;IACpE,CAAC;IACD,6DAA6D;IAC7D,OAAO,UAAwB,CAAC;AAClC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type * as BabelCoreNamespace from "@babel/core";
2
+ import type * as BabelTypesNamespace from "@babel/types";
3
+ export type Babel = typeof BabelCoreNamespace;
4
+ export type BabelTypes = typeof BabelTypesNamespace;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=babel-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-types.js","sourceRoot":"","sources":["../src/babel-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import type { Expression, CallExpression, FunctionExpression, Identifier } from "@babel/types";
2
+ import { Component } from "../models";
3
+ import { IMPORTABLES } from "../constants";
4
+ import { ComponentWatch, NodeAddress } from "./types";
5
+ export declare class ComponentDefinitionData {
6
+ #private;
7
+ component: Component;
8
+ html: string;
9
+ watches: Array<ComponentWatch>;
10
+ stash: {
11
+ [key: string]: CallExpression;
12
+ };
13
+ baseComponent: Expression | undefined;
14
+ lookups: {
15
+ [key: string]: FunctionExpression;
16
+ };
17
+ collectedRefs: Array<string>;
18
+ constructor(component: Component);
19
+ saveElementToStash(address: NodeAddress): string;
20
+ saveNestedClassToStash(address: NodeAddress, componentCls: Expression): string;
21
+ addLookup(expression: Expression): string;
22
+ getFunctionIdentifier(name: IMPORTABLES): Identifier;
23
+ getLookupCallBackParams(): Array<Identifier>;
24
+ wrapStashCall(key: string, functionName: IMPORTABLES, remainingArgs: Expression[]): void;
25
+ getNextMiscObjectKey(): number;
26
+ }
27
+ /**
28
+ * Deals with shielding, setting ref keys and such.
29
+ */
30
+ export declare function consolidateComponent(component: Component): ComponentDefinitionData;
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var _ComponentDefinitionData_stashKey, _ComponentDefinitionData_miscObjectKey, _ComponentDefinitionData_lookupKeys;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ComponentDefinitionData = void 0;
16
+ exports.consolidateComponent = consolidateComponent;
17
+ const types_1 = require("@babel/types");
18
+ const t = require("@babel/types");
19
+ const utils_1 = require("../utils");
20
+ const models_1 = require("../models");
21
+ const errors_1 = require("../errors");
22
+ const constants_1 = require("../constants");
23
+ const visibility_1 = require("./visibility");
24
+ function buildAddressArray(address) {
25
+ return (0, types_1.arrayExpression)(address.map((i) => (0, types_1.numericLiteral)(i)));
26
+ }
27
+ function buildFindElementCall(module, address) {
28
+ module.requireImport(constants_1.IMPORTABLES.findElement);
29
+ return (0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.findElement), [
30
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.rootElement),
31
+ buildAddressArray(address),
32
+ ]);
33
+ }
34
+ function buildNestedClassCall(module, address, componentCls) {
35
+ module.requireImport(constants_1.IMPORTABLES.nestComponent);
36
+ return (0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.nestComponent), [
37
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.rootElement),
38
+ buildAddressArray(address),
39
+ componentCls,
40
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component),
41
+ ]);
42
+ }
43
+ function removeKeys(obj, keys) {
44
+ for (const prop in obj) {
45
+ if (keys.includes(prop))
46
+ delete obj[prop];
47
+ else if (typeof obj[prop] === "object")
48
+ removeKeys(obj[prop], keys);
49
+ }
50
+ }
51
+ class ComponentDefinitionData {
52
+ constructor(component) {
53
+ this.watches = [];
54
+ this.stash = {};
55
+ this.lookups = {};
56
+ this.collectedRefs = [];
57
+ _ComponentDefinitionData_stashKey.set(this, 0);
58
+ _ComponentDefinitionData_miscObjectKey.set(this, 0);
59
+ _ComponentDefinitionData_lookupKeys.set(this, []);
60
+ this.component = component;
61
+ this.baseComponent = component.baseComponent;
62
+ }
63
+ saveElementToStash(address) {
64
+ var _a;
65
+ __classPrivateFieldSet(this, _ComponentDefinitionData_stashKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_stashKey, "f"), _a++, _a), "f");
66
+ const key = String(__classPrivateFieldGet(this, _ComponentDefinitionData_stashKey, "f"));
67
+ this.stash[key] = buildFindElementCall(this.component.module, address);
68
+ return key;
69
+ }
70
+ saveNestedClassToStash(address, componentCls) {
71
+ var _a;
72
+ __classPrivateFieldSet(this, _ComponentDefinitionData_stashKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_stashKey, "f"), _a++, _a), "f");
73
+ const key = String(__classPrivateFieldGet(this, _ComponentDefinitionData_stashKey, "f"));
74
+ this.stash[key] = buildNestedClassCall(this.component.module, address, componentCls);
75
+ return key;
76
+ }
77
+ addLookup(expression) {
78
+ const hashExpression = (expr) => {
79
+ const copy = JSON.parse(JSON.stringify(expr));
80
+ removeKeys(copy, ["start", "end", "loc"]);
81
+ return JSON.stringify(copy);
82
+ };
83
+ const hash = hashExpression(expression);
84
+ if (__classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").indexOf(hash) === -1) {
85
+ __classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").push(hash);
86
+ }
87
+ const key = String(__classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").indexOf(hash));
88
+ this.lookups[key] = (0, types_1.functionExpression)(null, this.getLookupCallBackParams(), (0, types_1.blockStatement)([(0, types_1.returnStatement)(expression)]));
89
+ return key;
90
+ }
91
+ getFunctionIdentifier(name) {
92
+ this.component.module.requireImport(name);
93
+ return (0, types_1.identifier)(name);
94
+ }
95
+ getLookupCallBackParams() {
96
+ return [this.component.propsIdentifier, this.component.componentIdentifier];
97
+ }
98
+ wrapStashCall(key, functionName, remainingArgs) {
99
+ this.stash[key] = (0, types_1.callExpression)(this.getFunctionIdentifier(functionName), [
100
+ this.stash[key],
101
+ ...remainingArgs,
102
+ ]);
103
+ }
104
+ getNextMiscObjectKey() {
105
+ var _a;
106
+ __classPrivateFieldSet(this, _ComponentDefinitionData_miscObjectKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_miscObjectKey, "f"), _a++, _a), "f");
107
+ return __classPrivateFieldGet(this, _ComponentDefinitionData_miscObjectKey, "f") - 1;
108
+ }
109
+ }
110
+ exports.ComponentDefinitionData = ComponentDefinitionData;
111
+ _ComponentDefinitionData_stashKey = new WeakMap(), _ComponentDefinitionData_miscObjectKey = new WeakMap(), _ComponentDefinitionData_lookupKeys = new WeakMap();
112
+ /**
113
+ * No user code gets copied into the watch callback functions, so we can hardcode params
114
+ * as they won't clash with anything.
115
+ */
116
+ function buildWatchCallbackParams() {
117
+ return [
118
+ constants_1.WATCH_CALLBACK_PARAMS.newValue,
119
+ constants_1.WATCH_CALLBACK_PARAMS.oldValue,
120
+ constants_1.WATCH_CALLBACK_PARAMS.element,
121
+ constants_1.WATCH_CALLBACK_PARAMS.props,
122
+ constants_1.WATCH_CALLBACK_PARAMS.component,
123
+ ].map((letter) => (0, types_1.identifier)(letter));
124
+ }
125
+ /**
126
+ * Use this to rename variables when there is no scope.
127
+ * It came from chatGTP.
128
+ */
129
+ function renameVariablesInExpression(originalExpression, variableMapping) {
130
+ // Clone the original expression to avoid modifying it
131
+ const clonedExpression = (0, types_1.cloneNode)(originalExpression);
132
+ // Function to replace identifiers based on the mapping
133
+ function replaceIdentifiers(node) {
134
+ if ((0, types_1.isIdentifier)(node) && variableMapping[node.name]) {
135
+ return (0, types_1.identifier)(variableMapping[node.name]);
136
+ }
137
+ return node;
138
+ }
139
+ // Recursive function to traverse and update the AST
140
+ function traverseAndReplace(node) {
141
+ // If the node is an array (e.g., arguments), handle each element
142
+ if (Array.isArray(node)) {
143
+ return node.map(traverseAndReplace);
144
+ }
145
+ // Replace identifiers if applicable
146
+ const newNode = replaceIdentifiers(node);
147
+ // Recursively handle child nodes
148
+ for (const key of Object.keys(newNode)) {
149
+ if (newNode[key] && typeof newNode[key] === "object") {
150
+ newNode[key] = traverseAndReplace(newNode[key]);
151
+ }
152
+ }
153
+ return newNode;
154
+ }
155
+ return traverseAndReplace(clonedExpression);
156
+ }
157
+ function getSiblings(node, allNodes) {
158
+ return allNodes.filter((n) => n.parent === node.parent && n !== node);
159
+ }
160
+ function getChildren(node, allNodes) {
161
+ return allNodes.filter((n) => n.parent === node);
162
+ }
163
+ function processNodes(component, componentDefinition) {
164
+ component.extractedNodes.forEach((node) => {
165
+ if (node.isRepeatedNode) {
166
+ // The watch should already have been added to the parent node, which is already
167
+ // processed. All we do here is run some extra checks.
168
+ const siblings = getSiblings(node, component.extractedNodes);
169
+ if (siblings.length > 0) {
170
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.REPEAT_DIRECTIVE_WITH_SIBLINGS);
171
+ }
172
+ const children = getChildren(node, component.extractedNodes);
173
+ if (children.length > 0) {
174
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.REPEAT_DIRECTIVE_WITH_CHILDREN);
175
+ }
176
+ return;
177
+ }
178
+ const stubName = node.getStub();
179
+ const stubComponentName = stubName
180
+ ? t.memberExpression(t.identifier(constants_1.COMPONENT_BUILD_PARAMS.component), t.identifier(stubName))
181
+ : undefined;
182
+ const shieldInfo = node.getShieldInfo();
183
+ const ref = node.getRef();
184
+ const repeatInstruction = node.getRepeatInstruction();
185
+ const createWatch = node.watches.length > 0 ||
186
+ shieldInfo ||
187
+ node.isNestedClass ||
188
+ stubName ||
189
+ repeatInstruction;
190
+ const shouldStash = createWatch || ref || node.eventListeners.length > 0;
191
+ if (shouldStash) {
192
+ const nestedComponentCls = node.isNestedClass
193
+ ? t.identifier(node.tagName)
194
+ : stubComponentName;
195
+ const stashRef = nestedComponentCls
196
+ ? componentDefinition.saveNestedClassToStash(node.address, nestedComponentCls)
197
+ : componentDefinition.saveElementToStash(node.address);
198
+ if (createWatch) {
199
+ const _callbacks = {};
200
+ const addCallbackStatement = (key, statements) => {
201
+ if (!_callbacks.hasOwnProperty(key)) {
202
+ _callbacks[key] = [];
203
+ }
204
+ _callbacks[key].push(...statements);
205
+ };
206
+ const componentWatch = {
207
+ stashRef,
208
+ callbacks: {},
209
+ address: node.address,
210
+ };
211
+ componentDefinition.watches.push(componentWatch);
212
+ node.watches.forEach((watch) => {
213
+ const lookupKey = componentDefinition.addLookup(watch.expression);
214
+ addCallbackStatement(lookupKey, (0, utils_1.codeToNode)(watch.callback));
215
+ });
216
+ if (node.isNestedClass) {
217
+ const props = node.getProps();
218
+ const method = props ? "setProps" : "update";
219
+ const args = props ? [props] : [];
220
+ addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
221
+ (0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element), (0, types_1.identifier)(method)), args)),
222
+ ]);
223
+ }
224
+ // Need to be careful with WATCH_CALLBACK_PARAMS because
225
+ if (stubName) {
226
+ addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
227
+ (0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element), (0, types_1.identifier)("setProps")), [component.propsIdentifier])),
228
+ ]);
229
+ }
230
+ if (shieldInfo) {
231
+ const shieldLookupKey = componentDefinition.addLookup(shieldInfo.expression);
232
+ componentWatch.shieldInfo = {
233
+ count: 0,
234
+ key: shieldLookupKey,
235
+ reverse: shieldInfo.reverse,
236
+ };
237
+ }
238
+ if (repeatInstruction) {
239
+ const miscObjectKey = componentDefinition.getNextMiscObjectKey();
240
+ componentDefinition.component.module.requireImport(constants_1.IMPORTABLES.getSequentialPool);
241
+ const poolInstance = repeatInstruction.poolExpression ||
242
+ (0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.getSequentialPool), [
243
+ (0, types_1.identifier)(repeatInstruction.componentCls),
244
+ ]);
245
+ componentDefinition.wrapStashCall(stashRef, constants_1.IMPORTABLES.saveMiscObject, [(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component), poolInstance]);
246
+ // pool.patch(element, items, component);
247
+ addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
248
+ (0, types_1.expressionStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.memberExpression)((0, types_1.memberExpression)(component.componentIdentifier, (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.objectStash)), (0, types_1.numericLiteral)(miscObjectKey), true), (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.patch)), [
249
+ (0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element),
250
+ repeatInstruction.expression,
251
+ component.componentIdentifier,
252
+ ])),
253
+ ]);
254
+ }
255
+ for (const key in _callbacks) {
256
+ const args = key === constants_1.SPECIAL_SYMBOLS.alwaysUpdate
257
+ ? [
258
+ (0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element),
259
+ component.propsIdentifier,
260
+ component.componentIdentifier,
261
+ ]
262
+ : buildWatchCallbackParams();
263
+ componentWatch.callbacks[key] = (0, types_1.functionExpression)(null, args, (0, types_1.blockStatement)(_callbacks[key]));
264
+ }
265
+ }
266
+ if (ref) {
267
+ if (componentDefinition.collectedRefs.includes(ref)) {
268
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.REFS_MUST_BE_UNIQUE_WITHIN_EACH_COMPONENT);
269
+ }
270
+ componentDefinition.collectedRefs.push(ref);
271
+ componentDefinition.wrapStashCall(stashRef, constants_1.IMPORTABLES.saveRef, [
272
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component),
273
+ (0, types_1.stringLiteral)(ref),
274
+ ]);
275
+ }
276
+ // Note that some things will already have been renamed, but here we are renaming
277
+ // specifically inside the buildComponent scope.
278
+ const eventVariableMapping = {
279
+ [component.componentIdentifier.name]: constants_1.COMPONENT_BUILD_PARAMS.component,
280
+ [component.propsIdentifier.name]: `${constants_1.COMPONENT_BUILD_PARAMS.component}.props`,
281
+ [constants_1.EVENT_CALLBACK_VARIABLES.element]: `${constants_1.EVENT_CALLBACK_VARIABLES.event}.target`,
282
+ };
283
+ node.eventListeners.forEach((listener) => {
284
+ const updatedExpression = renameVariablesInExpression(listener.callback, eventVariableMapping);
285
+ componentDefinition.wrapStashCall(stashRef, constants_1.IMPORTABLES.onEvent, [
286
+ (0, types_1.stringLiteral)(listener.eventName),
287
+ (0, types_1.functionExpression)(null, [(0, types_1.identifier)(constants_1.EVENT_CALLBACK_VARIABLES.event)], (0, types_1.blockStatement)([(0, types_1.expressionStatement)(updatedExpression)])),
288
+ ]);
289
+ });
290
+ }
291
+ });
292
+ }
293
+ function hoistTextNodes(component) {
294
+ const nodesToDelete = [];
295
+ component.extractedNodes.forEach((node) => {
296
+ if (node instanceof models_1.DynamicTextNode) {
297
+ if (getSiblings(node, component.extractedNodes).length === 0) {
298
+ const parent = node.parent;
299
+ parent.watches.push(...node.watches);
300
+ nodesToDelete.push(node);
301
+ node.element.remove();
302
+ }
303
+ }
304
+ });
305
+ nodesToDelete.forEach((node) => {
306
+ component.extractedNodes.splice(component.extractedNodes.indexOf(node), 1);
307
+ });
308
+ }
309
+ /**
310
+ * Deals with shielding, setting ref keys and such.
311
+ */
312
+ function consolidateComponent(component) {
313
+ const componentDefinition = new ComponentDefinitionData(component);
314
+ hoistTextNodes(component);
315
+ processNodes(component, componentDefinition);
316
+ (0, visibility_1.processShields)(componentDefinition.watches);
317
+ // This must be done after all the processing, as DOM may have changed.
318
+ componentDefinition.html = component.rootElement.outerHTML;
319
+ return componentDefinition;
320
+ }
321
+ //# sourceMappingURL=consolidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consolidation.js","sourceRoot":"","sources":["../../src/builders/consolidation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqbA,oDAUC;AAvbD,wCAasB;AACtB,kCAAkC;AAClC,oCAAsC;AACtC,sCAA8E;AAC9E,sCAAkD;AAClD,4CAMsB;AAEtB,6CAA8C;AAE9C,SAAS,iBAAiB,CAAC,OAAoB;IAC7C,OAAO,IAAA,uBAAe,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,sBAAc,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAc,EACd,OAAoB;IAEpB,MAAM,CAAC,aAAa,CAAC,uBAAW,CAAC,WAAW,CAAC,CAAC;IAC9C,OAAO,IAAA,sBAAc,EAAC,IAAA,kBAAU,EAAC,uBAAW,CAAC,WAAW,CAAC,EAAE;QACzD,IAAA,kBAAU,EAAC,kCAAsB,CAAC,WAAW,CAAC;QAC9C,iBAAiB,CAAC,OAAO,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAc,EACd,OAAoB,EACpB,YAAwB;IAExB,MAAM,CAAC,aAAa,CAAC,uBAAW,CAAC,aAAa,CAAC,CAAC;IAChD,OAAO,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AAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC5C,uEAAuE;IACvE,mBAAmB,CAAC,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC;IAC3D,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { CallExpression } from "@babel/types";
2
+ import { Component } from "../models";
3
+ export declare function buildDefineComponentCall(component: Component): CallExpression;
4
+ /**
5
+ * Used for classes.
6
+ */
7
+ export declare function buildExtendComponentCall(component: Component): CallExpression;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildDefineComponentCall = buildDefineComponentCall;
4
+ exports.buildExtendComponentCall = buildExtendComponentCall;
5
+ const t = require("@babel/types");
6
+ const types_1 = require("@babel/types");
7
+ const utils_1 = require("../utils");
8
+ const consolidation_1 = require("./consolidation");
9
+ const constants_1 = require("../constants");
10
+ // component base to inherit from. Using 0 as false.
11
+ function buildComponentBaseArg(componentDefinition) {
12
+ return componentDefinition.baseComponent || t.numericLiteral(0);
13
+ }
14
+ function buildTemplateArg(componentDefinition) {
15
+ return t.stringLiteral((0, utils_1.escapeSingleQuotes)((0, utils_1.stripHtml)(componentDefinition.html)));
16
+ }
17
+ function buildObjectExpression(object, fn) {
18
+ const properties = [];
19
+ for (const [key, value] of Object.entries(object)) {
20
+ properties.push({
21
+ type: "ObjectProperty",
22
+ key: (0, types_1.identifier)(key),
23
+ value: fn(value),
24
+ computed: false,
25
+ shorthand: false,
26
+ });
27
+ }
28
+ return (0, types_1.objectExpression)(properties);
29
+ }
30
+ function buildWatchesArg(componentDefinition) {
31
+ const watchDeclarations = componentDefinition.watches.map((watch) => {
32
+ var _a, _b;
33
+ const callbacks = [];
34
+ for (const [key, fnExpr] of Object.entries(watch.callbacks)) {
35
+ callbacks.push({
36
+ type: "ObjectProperty",
37
+ key: t.identifier(key),
38
+ value: fnExpr,
39
+ computed: false,
40
+ shorthand: false,
41
+ });
42
+ }
43
+ return t.arrayExpression([
44
+ t.stringLiteral(watch.stashRef),
45
+ watch.shieldInfo
46
+ ? t.stringLiteral(watch.shieldInfo.key)
47
+ : t.numericLiteral(0),
48
+ t.numericLiteral(((_a = watch.shieldInfo) === null || _a === void 0 ? void 0 : _a.reverse) ? 1 : 0),
49
+ t.numericLiteral(((_b = watch.shieldInfo) === null || _b === void 0 ? void 0 : _b.count) || 0),
50
+ t.objectExpression(callbacks),
51
+ ]);
52
+ });
53
+ return t.arrayExpression([...watchDeclarations]);
54
+ }
55
+ function buildLookupsArg(componentDefinition) {
56
+ return buildObjectExpression(componentDefinition.lookups, (fnExpx) => fnExpx);
57
+ }
58
+ /**
59
+ *
60
+ component._e = {
61
+ 1: findElement(rootElement, [0]),
62
+ 2: findElement(rootElement, [1, 1]),
63
+ };
64
+ */
65
+ function buildComponentBuildFunction(componentDefinition) {
66
+ const stashValueObject = buildObjectExpression(componentDefinition.stash, (stashEntry) => stashEntry);
67
+ const stashAssignment = t.assignmentExpression("=", t.memberExpression(t.identifier("component"), t.identifier("_e")), stashValueObject);
68
+ const statements = [t.expressionStatement(stashAssignment)];
69
+ return t.functionExpression(null, [
70
+ t.identifier(constants_1.COMPONENT_BUILD_PARAMS.component),
71
+ t.identifier(constants_1.COMPONENT_BUILD_PARAMS.rootElement),
72
+ ], t.blockStatement(statements));
73
+ }
74
+ function buildProtoExtrasCall(component) {
75
+ return t.objectExpression([]);
76
+ }
77
+ function buildDefineComponentCall(component) {
78
+ const componentDefinition = (0, consolidation_1.consolidateComponent)(component);
79
+ return t.callExpression(t.identifier("defineComponent"), [
80
+ buildTemplateArg(componentDefinition),
81
+ buildWatchesArg(componentDefinition),
82
+ buildLookupsArg(componentDefinition),
83
+ buildComponentBuildFunction(componentDefinition),
84
+ buildComponentBaseArg(componentDefinition),
85
+ buildProtoExtrasCall(componentDefinition),
86
+ ]);
87
+ }
88
+ /**
89
+ * Used for classes.
90
+ */
91
+ function buildExtendComponentCall(component) {
92
+ const componentDefinition = (0, consolidation_1.consolidateComponent)(component);
93
+ return t.callExpression(t.identifier("extendComponent"), [
94
+ t.memberExpression(t.identifier(component.name), t.identifier("prototype")),
95
+ buildTemplateArg(componentDefinition),
96
+ buildWatchesArg(componentDefinition),
97
+ buildLookupsArg(componentDefinition),
98
+ buildComponentBuildFunction(componentDefinition),
99
+ ]);
100
+ }
101
+ //# sourceMappingURL=define-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-component.js","sourceRoot":"","sources":["../../src/builders/define-component.ts"],"names":[],"mappings":";;AAuHA,4DAUC;AAKD,4DASC;AA/ID,kCAAkC;AAWlC,wCAA4D;AAC5D,oCAAyD;AACzD,mDAAgF;AAChF,4CAAsD;AAEtD,oDAAoD;AACpD,SAAS,qBAAqB,CAC5B,mBAA4C;IAE5C,OAAO,mBAAmB,CAAC,aAAa,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,gBAAgB,CACvB,mBAA4C;IAE5C,OAAO,CAAC,CAAC,aAAa,CACpB,IAAA,0BAAkB,EAAC,IAAA,iBAAS,EAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CACxD,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAC5B,MAA8B,EAC9B,EAAmB;IAEnB,MAAM,UAAU,GAA0B,EAAE,CAAC;IAE7C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,UAAU,CAAC,IAAI,CAAC;YACd,IAAI,EAAE,gBAAgB;YACtB,GAAG,EAAE,IAAA,kBAAU,EAAC,GAAG,CAAC;YACpB,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC;YAChB,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAA,wBAAgB,EAAC,UAAU,CAAC,CAAC;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C;KAC1C,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,wBAAwB,CAAC,SAAoB;IAC3D,MAAM,mBAAmB,GAAG,IAAA,oCAAoB,EAAC,SAAS,CAAC,CAAC;IAC5D,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;QACvD,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3E,gBAAgB,CAAC,mBAAmB,CAAC;QACrC,eAAe,CAAC,mBAAmB,CAAC;QACpC,eAAe,CAAC,mBAAmB,CAAC;QACpC,2BAA2B,CAAC,mBAAmB,CAAC;KACjD,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { buildDefineComponentCall, buildExtendComponentCall } from "./define-component";
2
+ export { buildDefineComponentCall, buildExtendComponentCall };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildExtendComponentCall = exports.buildDefineComponentCall = void 0;
4
+ const define_component_1 = require("./define-component");
5
+ Object.defineProperty(exports, "buildDefineComponentCall", { enumerable: true, get: function () { return define_component_1.buildDefineComponentCall; } });
6
+ Object.defineProperty(exports, "buildExtendComponentCall", { enumerable: true, get: function () { return define_component_1.buildExtendComponentCall; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builders/index.ts"],"names":[],"mappings":";;;AAAA,yDAG4B;AACnB,yGAHP,2CAAwB,OAGO;AAAE,yGAFjC,2CAAwB,OAEiC"}
@@ -0,0 +1,15 @@
1
+ import type { FunctionExpression } from "@babel/types";
2
+ export type NodeAddress = Array<number>;
3
+ export interface ShieldInfo {
4
+ key: string;
5
+ reverse: boolean;
6
+ count: number;
7
+ }
8
+ export interface ComponentWatch {
9
+ stashRef: string;
10
+ shieldInfo?: ShieldInfo | undefined;
11
+ callbacks: {
12
+ [key: string]: FunctionExpression;
13
+ };
14
+ address: NodeAddress;
15
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/builders/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ComponentWatch } from "./types";
2
+ /**
3
+ * Must be done after processing watches as we need to know how many watches to skip.
4
+ */
5
+ export declare function processShields(watches: Array<ComponentWatch>): void;