babel-plugin-wallace 0.0.5 → 0.0.7

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 (61) hide show
  1. package/dist/ast-helpers.d.ts +1 -1
  2. package/dist/ast-helpers.js +2 -10
  3. package/dist/ast-helpers.js.map +1 -1
  4. package/dist/{builders/consolidation.d.ts → consolidation/ComponentDefinitionData.d.ts} +8 -9
  5. package/dist/consolidation/ComponentDefinitionData.js +79 -0
  6. package/dist/consolidation/ComponentDefinitionData.js.map +1 -0
  7. package/dist/consolidation/consolidateComponent.d.ts +6 -0
  8. package/dist/consolidation/consolidateComponent.js +41 -0
  9. package/dist/consolidation/consolidateComponent.js.map +1 -0
  10. package/dist/consolidation/index.d.ts +2 -0
  11. package/dist/consolidation/index.js +8 -0
  12. package/dist/consolidation/index.js.map +1 -0
  13. package/dist/consolidation/processNodes.d.ts +3 -0
  14. package/dist/consolidation/processNodes.js +219 -0
  15. package/dist/consolidation/processNodes.js.map +1 -0
  16. package/dist/{builders → consolidation}/types.d.ts +8 -2
  17. package/dist/{builders → consolidation}/types.js.map +1 -1
  18. package/dist/consolidation/utils.d.ts +21 -0
  19. package/dist/consolidation/utils.js +91 -0
  20. package/dist/consolidation/utils.js.map +1 -0
  21. package/dist/consolidation/visibility.d.ts +2 -0
  22. package/dist/consolidation/visibility.js +22 -0
  23. package/dist/consolidation/visibility.js.map +1 -0
  24. package/dist/constants.d.ts +3 -3
  25. package/dist/constants.js +3 -3
  26. package/dist/constants.js.map +1 -1
  27. package/dist/contexts/handlers.js +3 -3
  28. package/dist/contexts/handlers.js.map +1 -1
  29. package/dist/directives.js +121 -5
  30. package/dist/directives.js.map +1 -1
  31. package/dist/errors.d.ts +5 -3
  32. package/dist/errors.js +5 -3
  33. package/dist/errors.js.map +1 -1
  34. package/dist/models/component.js +4 -2
  35. package/dist/models/component.js.map +1 -1
  36. package/dist/models/index.d.ts +2 -2
  37. package/dist/models/index.js.map +1 -1
  38. package/dist/models/node.d.ts +32 -3
  39. package/dist/models/node.js +43 -107
  40. package/dist/models/node.js.map +1 -1
  41. package/dist/utils.d.ts +1 -0
  42. package/dist/utils.js +8 -1
  43. package/dist/utils.js.map +1 -1
  44. package/dist/visitors/attribute.js +6 -1
  45. package/dist/visitors/attribute.js.map +1 -1
  46. package/dist/{builders → writers}/define-component.d.ts +1 -1
  47. package/dist/{builders → writers}/define-component.js +31 -27
  48. package/dist/writers/define-component.js.map +1 -0
  49. package/dist/writers/index.d.ts +1 -0
  50. package/dist/{builders → writers}/index.js +1 -1
  51. package/dist/writers/index.js.map +1 -0
  52. package/package.json +4 -3
  53. package/dist/builders/consolidation.js +0 -321
  54. package/dist/builders/consolidation.js.map +0 -1
  55. package/dist/builders/define-component.js.map +0 -1
  56. package/dist/builders/index.d.ts +0 -2
  57. package/dist/builders/index.js.map +0 -1
  58. package/dist/builders/visibility.d.ts +0 -5
  59. package/dist/builders/visibility.js +0 -43
  60. package/dist/builders/visibility.js.map +0 -1
  61. /package/dist/{builders → consolidation}/types.js +0 -0
@@ -7,4 +7,4 @@ export declare function getJSXElementName(path: NodePath<JSXElement>): string |
7
7
  /**
8
8
  * An Expression can be one of dozens of types, most of which are not usable.
9
9
  */
10
- export declare function getPlaceholderExpression(path: NodePath, expression: Expression | JSXEmptyExpression): Expression;
10
+ export declare function getPlaceholderExpression(path: NodePath, expression: Expression | JSXEmptyExpression): Expression | undefined;
@@ -31,22 +31,14 @@ function getJSXElementName(path) {
31
31
  * An Expression can be one of dozens of types, most of which are not usable.
32
32
  */
33
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
34
  if (t.isJSXEmptyExpression(expression)) {
43
- (0, errors_1.error)(path, errors_1.ERROR_MESSAGES.PLACEHOLDER_MAY_NOT_BE_EMPTY);
35
+ // This is really to handle comments
36
+ return undefined;
44
37
  }
45
38
  else if (t.isObjectExpression(expression)) {
46
39
  // The code is copied, so the object would be created afresh each time.
47
40
  (0, errors_1.error)(path, errors_1.ERROR_MESSAGES.PLACEHOLDER_MAY_NOT_BE_LITERAL_OBJECT);
48
41
  }
49
- //error(path, ERROR_MESSAGES.INVALID_PLACEHOLDER_EXPRESSION);
50
42
  return expression;
51
43
  }
52
44
  //# sourceMappingURL=ast-helpers.js.map
@@ -1 +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,CAAC,EAAE,CAAC;QAC1C,OAAO,kBAAkB,CAAC,IAAI,CAAC;IACjC,CAAC;SAAM,IAAI,CAAC,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACrD,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC;QAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,CAAC,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACvD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,kBAAkB,CAAC;QAChD,IAAI,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,IAAA,cA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BAAkB,CAAC;QAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,CAAC,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACvD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,kBAAkB,CAAC;QAChD,IAAI,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,IAAA,cAAK,EAAC,IAAI,EAAE,uBAAc,CAAC,2BAA2B,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,KAAK,CAAC,wBAAwB,kBAAkB,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,wBAAwB,CACtC,IAAc,EACd,UAA2C;IAE3C,IAAI,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACvC,oCAAoC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,uEAAuE;QACvE,IAAA,cAAK,EAAC,IAAI,EAAE,uBAAc,CAAC,qCAAqC,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,UAAwB,CAAC;AAClC,CAAC"}
@@ -2,12 +2,15 @@ import type { Expression, CallExpression, FunctionExpression, Identifier } from
2
2
  import { Component } from "../models";
3
3
  import { IMPORTABLES } from "../constants";
4
4
  import { ComponentWatch, NodeAddress } from "./types";
5
+ /**
6
+ * An object with all the consolidated data for writing.
7
+ */
5
8
  export declare class ComponentDefinitionData {
6
9
  #private;
7
10
  component: Component;
8
11
  html: string;
9
12
  watches: Array<ComponentWatch>;
10
- stash: {
13
+ dynamicElements: {
11
14
  [key: string]: CallExpression;
12
15
  };
13
16
  baseComponent: Expression | undefined;
@@ -16,15 +19,11 @@ export declare class ComponentDefinitionData {
16
19
  };
17
20
  collectedRefs: Array<string>;
18
21
  constructor(component: Component);
19
- saveElementToStash(address: NodeAddress): string;
20
- saveNestedClassToStash(address: NodeAddress, componentCls: Expression): string;
22
+ saveDynamicElement(address: NodeAddress): string;
23
+ saveNestedAsDynamicElement(address: NodeAddress, componentCls: Expression): string;
21
24
  addLookup(expression: Expression): string;
22
25
  getFunctionIdentifier(name: IMPORTABLES): Identifier;
23
26
  getLookupCallBackParams(): Array<Identifier>;
24
- wrapStashCall(key: string, functionName: IMPORTABLES, remainingArgs: Expression[]): void;
25
- getNextMiscObjectKey(): number;
27
+ wrapDynamicElementCall(key: string, functionName: IMPORTABLES, remainingArgs: Expression[]): void;
28
+ getNextmiscStashKey(): number;
26
29
  }
27
- /**
28
- * Deals with shielding, setting ref keys and such.
29
- */
30
- export declare function consolidateComponent(component: Component): ComponentDefinitionData;
@@ -0,0 +1,79 @@
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_dynamicElementKey, _ComponentDefinitionData_miscStashKey, _ComponentDefinitionData_lookupKeys;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ComponentDefinitionData = void 0;
16
+ const types_1 = require("@babel/types");
17
+ const utils_1 = require("./utils");
18
+ /**
19
+ * An object with all the consolidated data for writing.
20
+ */
21
+ class ComponentDefinitionData {
22
+ constructor(component) {
23
+ this.watches = [];
24
+ this.dynamicElements = {};
25
+ this.lookups = {};
26
+ this.collectedRefs = [];
27
+ _ComponentDefinitionData_dynamicElementKey.set(this, 0);
28
+ _ComponentDefinitionData_miscStashKey.set(this, 0);
29
+ _ComponentDefinitionData_lookupKeys.set(this, []);
30
+ this.component = component;
31
+ this.baseComponent = component.baseComponent;
32
+ }
33
+ saveDynamicElement(address) {
34
+ var _a;
35
+ __classPrivateFieldSet(this, _ComponentDefinitionData_dynamicElementKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f"), _a++, _a), "f");
36
+ const key = String(__classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f"));
37
+ this.dynamicElements[key] = (0, utils_1.buildFindElementCall)(this.component.module, address);
38
+ return key;
39
+ }
40
+ saveNestedAsDynamicElement(address, componentCls) {
41
+ var _a;
42
+ __classPrivateFieldSet(this, _ComponentDefinitionData_dynamicElementKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f"), _a++, _a), "f");
43
+ const key = String(__classPrivateFieldGet(this, _ComponentDefinitionData_dynamicElementKey, "f"));
44
+ this.dynamicElements[key] = (0, utils_1.buildNestedClassCall)(this.component.module, address, componentCls);
45
+ return key;
46
+ }
47
+ addLookup(expression) {
48
+ const hashExpression = (expr) => {
49
+ const copy = JSON.parse(JSON.stringify(expr));
50
+ (0, utils_1.removeKeys)(copy, ["start", "end", "loc"]);
51
+ return JSON.stringify(copy);
52
+ };
53
+ const hash = hashExpression(expression);
54
+ if (__classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").indexOf(hash) === -1) {
55
+ __classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").push(hash);
56
+ }
57
+ const key = String(__classPrivateFieldGet(this, _ComponentDefinitionData_lookupKeys, "f").indexOf(hash));
58
+ this.lookups[key] = (0, types_1.functionExpression)(null, this.getLookupCallBackParams(), (0, types_1.blockStatement)([(0, types_1.returnStatement)(expression)]));
59
+ return key;
60
+ }
61
+ getFunctionIdentifier(name) {
62
+ this.component.module.requireImport(name);
63
+ return (0, types_1.identifier)(name);
64
+ }
65
+ getLookupCallBackParams() {
66
+ return [this.component.propsIdentifier, this.component.componentIdentifier];
67
+ }
68
+ wrapDynamicElementCall(key, functionName, remainingArgs) {
69
+ this.dynamicElements[key] = (0, types_1.callExpression)(this.getFunctionIdentifier(functionName), [this.dynamicElements[key], ...remainingArgs]);
70
+ }
71
+ getNextmiscStashKey() {
72
+ var _a;
73
+ __classPrivateFieldSet(this, _ComponentDefinitionData_miscStashKey, (_a = __classPrivateFieldGet(this, _ComponentDefinitionData_miscStashKey, "f"), _a++, _a), "f");
74
+ return __classPrivateFieldGet(this, _ComponentDefinitionData_miscStashKey, "f") - 1;
75
+ }
76
+ }
77
+ exports.ComponentDefinitionData = ComponentDefinitionData;
78
+ _ComponentDefinitionData_dynamicElementKey = new WeakMap(), _ComponentDefinitionData_miscStashKey = new WeakMap(), _ComponentDefinitionData_lookupKeys = new WeakMap();
79
+ //# sourceMappingURL=ComponentDefinitionData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentDefinitionData.js","sourceRoot":"","sources":["../../src/consolidation/ComponentDefinitionData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,wCAMsB;AAItB,mCAIiB;AAEjB;;GAEG;AACH,MAAa,uBAAuB;IAWlC,YAAY,SAAoB;QARhC,YAAO,GAA0B,EAAE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,MAAA,CAAC;QACrB,OAAO,uBAAA,IAAI,6CAAc,GAAG,CAAC,CAAC;IAChC,CAAC;CACF;AAzED,0DAyEC"}
@@ -0,0 +1,6 @@
1
+ import { Component } from "../models";
2
+ import { ComponentDefinitionData } from "./ComponentDefinitionData";
3
+ /**
4
+ * Deals with visibility toggles, setting ref keys and such.
5
+ */
6
+ export declare function consolidateComponent(component: Component): ComponentDefinitionData;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.consolidateComponent = consolidateComponent;
4
+ const models_1 = require("../models");
5
+ const visibility_1 = require("./visibility");
6
+ const ComponentDefinitionData_1 = require("./ComponentDefinitionData");
7
+ const processNodes_1 = require("./processNodes");
8
+ const utils_1 = require("./utils");
9
+ /**
10
+ * If a node contains only a JSXExpression, then rather than make a span, we set
11
+ * textContent on that node.
12
+ */
13
+ function hoistTextNodes(component) {
14
+ const nodesToDelete = [];
15
+ component.extractedNodes.forEach((node) => {
16
+ if (node instanceof models_1.DynamicTextNode) {
17
+ if ((0, utils_1.getSiblings)(node, component.extractedNodes).length === 0) {
18
+ const parent = node.parent;
19
+ parent.watches.push(...node.watches);
20
+ nodesToDelete.push(node);
21
+ node.element.remove();
22
+ }
23
+ }
24
+ });
25
+ nodesToDelete.forEach((node) => {
26
+ component.extractedNodes.splice(component.extractedNodes.indexOf(node), 1);
27
+ });
28
+ }
29
+ /**
30
+ * Deals with visibility toggles, setting ref keys and such.
31
+ */
32
+ function consolidateComponent(component) {
33
+ const componentDefinition = new ComponentDefinitionData_1.ComponentDefinitionData(component);
34
+ hoistTextNodes(component);
35
+ (0, processNodes_1.processNodes)(component, componentDefinition);
36
+ (0, visibility_1.processeVisibilityToggles)(componentDefinition.watches);
37
+ // This must be done after all the processing, as DOM may have changed.
38
+ componentDefinition.html = component.rootElement.outerHTML;
39
+ return componentDefinition;
40
+ }
41
+ //# sourceMappingURL=consolidateComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consolidateComponent.js","sourceRoot":"","sources":["../../src/consolidation/consolidateComponent.ts"],"names":[],"mappings":";;AA8BA,oDAUC;AAxCD,sCAAuD;AACvD,6CAAyD;AACzD,uEAAoE;AACpE,iDAA8C;AAC9C,mCAAsC;AAEtC;;;GAGG;AACH,SAAS,cAAc,CAAC,SAAoB;IAC1C,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,IAAI,IAAI,YAAY,wBAAe,EAAE,CAAC;YACpC,IAAI,IAAA,mBAAW,EAAC,IAAI,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC3B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;gBACrC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7B,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,SAAoB;IAEpB,MAAM,mBAAmB,GAAG,IAAI,iDAAuB,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,SAAS,CAAC,CAAC;IAC1B,IAAA,2BAAY,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAC7C,IAAA,sCAAyB,EAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACvD,uEAAuE;IACvE,mBAAmB,CAAC,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC;IAC3D,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ComponentDefinitionData } from "./ComponentDefinitionData";
2
+ export { consolidateComponent } from "./consolidateComponent";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.consolidateComponent = exports.ComponentDefinitionData = void 0;
4
+ var ComponentDefinitionData_1 = require("./ComponentDefinitionData");
5
+ Object.defineProperty(exports, "ComponentDefinitionData", { enumerable: true, get: function () { return ComponentDefinitionData_1.ComponentDefinitionData; } });
6
+ var consolidateComponent_1 = require("./consolidateComponent");
7
+ Object.defineProperty(exports, "consolidateComponent", { enumerable: true, get: function () { return consolidateComponent_1.consolidateComponent; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consolidation/index.ts"],"names":[],"mappings":";;;AAAA,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { Component } from "../models";
2
+ import { ComponentDefinitionData } from "./ComponentDefinitionData";
3
+ export declare function processNodes(component: Component, componentDefinition: ComponentDefinitionData): void;
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processNodes = processNodes;
4
+ const types_1 = require("@babel/types");
5
+ const t = require("@babel/types");
6
+ const utils_1 = require("../utils");
7
+ const errors_1 = require("../errors");
8
+ const constants_1 = require("../constants");
9
+ const utils_2 = require("./utils");
10
+ function addBindInstruction(node) {
11
+ if (node.tagName.toLowerCase() == "input") {
12
+ // @ts-ignore
13
+ const inputType = node.element.type.toLowerCase();
14
+ const attribute = inputType === "checkbox" ? "checked" : "value";
15
+ node.bindInstructions.forEach(({ eventName, expression }) => {
16
+ node.watchAttribute(attribute, expression);
17
+ const callback = t.assignmentExpression("=", expression, t.memberExpression(t.identifier(constants_1.EVENT_CALLBACK_VARIABLES.element), t.identifier(attribute)));
18
+ node.addEventListener(eventName, callback);
19
+ });
20
+ }
21
+ else {
22
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.BIND_ONLY_ALLOWED_ON_INPUT);
23
+ }
24
+ }
25
+ function ensureToggleTargetsHaveTriggers(node) {
26
+ node.toggleTargets.forEach((target) => {
27
+ const match = node.toggleTriggers.find((trigger) => trigger.name == target.name);
28
+ if (!match) {
29
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.TOGGLE_TARGETS_WITHOUT_TOGGLE_TRIGGERS);
30
+ }
31
+ });
32
+ }
33
+ function extractCssClasses(value) {
34
+ if (typeof value == "string") {
35
+ return value
36
+ .trim()
37
+ .split(" ")
38
+ .map((v) => t.stringLiteral(v));
39
+ }
40
+ else {
41
+ return [t.spreadElement(value)];
42
+ }
43
+ }
44
+ // Notes: toggles are implemented as add/remove because:
45
+ // a) they allow multiple classes
46
+ // b) it's less brittle around truthiness
47
+ function addToggleCallbackStatement(componentDefinition, node, addCallbackStatement) {
48
+ node.toggleTriggers.forEach((trigger) => {
49
+ const target = node.toggleTargets.find((target) => target.name == trigger.name);
50
+ const classesToToggle = target
51
+ ? extractCssClasses(target.value)
52
+ : [t.stringLiteral(trigger.name)];
53
+ const toBoolExpression = trigger.expression;
54
+ const lookupKey = componentDefinition.addLookup(toBoolExpression);
55
+ const getCallback = (method) => (0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.memberExpression)((0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element), (0, types_1.identifier)("classList")), (0, types_1.identifier)(method)), classesToToggle);
56
+ addCallbackStatement(lookupKey, [
57
+ t.ifStatement(t.identifier(constants_1.WATCH_CALLBACK_PARAMS.newValue), (0, types_1.blockStatement)([(0, types_1.expressionStatement)(getCallback("add"))]), (0, types_1.blockStatement)([(0, types_1.expressionStatement)(getCallback("remove"))])),
58
+ ]);
59
+ });
60
+ }
61
+ // TODO: break this up.
62
+ function processNodes(component, componentDefinition) {
63
+ component.extractedNodes.forEach((node) => {
64
+ if (node.isRepeatedNode) {
65
+ // The watch should already have been added to the parent node, which is already
66
+ // processed. All we do here is run some extra checks.
67
+ const siblings = (0, utils_2.getSiblings)(node, component.extractedNodes);
68
+ if (siblings.length > 0) {
69
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.REPEAT_DIRECTIVE_WITH_SIBLINGS);
70
+ }
71
+ const children = (0, utils_2.getChildren)(node, component.extractedNodes);
72
+ if (children.length > 0) {
73
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.REPEAT_DIRECTIVE_WITH_CHILDREN);
74
+ }
75
+ return;
76
+ }
77
+ const stubName = node.getStub();
78
+ const stubComponentName = stubName
79
+ ? t.memberExpression(t.identifier(constants_1.COMPONENT_BUILD_PARAMS.component), t.identifier(stubName))
80
+ : undefined;
81
+ const visibilityToggle = node.getVisibilityToggle();
82
+ const ref = node.getRef();
83
+ const repeatInstruction = node.getRepeatInstruction();
84
+ const createWatch = node.watches.length > 0 ||
85
+ node.bindInstructions.length > 0 ||
86
+ node.toggleTriggers.length > 0 ||
87
+ visibilityToggle ||
88
+ node.isNestedClass ||
89
+ stubName ||
90
+ repeatInstruction;
91
+ // TODO: should ref really save the element?
92
+ const shouldSaveElement = createWatch ||
93
+ ref ||
94
+ node.eventListeners.length > 0 ||
95
+ node.hasConditionalChildren;
96
+ ensureToggleTargetsHaveTriggers(node);
97
+ if (shouldSaveElement) {
98
+ const nestedComponentCls = node.isNestedClass
99
+ ? t.identifier(node.tagName)
100
+ : stubComponentName;
101
+ node.elementKey = nestedComponentCls
102
+ ? componentDefinition.saveNestedAsDynamicElement(node.address, nestedComponentCls)
103
+ : componentDefinition.saveDynamicElement(node.address);
104
+ if (node.bindInstructions.length) {
105
+ addBindInstruction(node);
106
+ }
107
+ if (node.hasConditionalChildren) {
108
+ node.detacherStashKey = componentDefinition.getNextmiscStashKey();
109
+ componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.stashMisc, [
110
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component),
111
+ t.objectExpression([]),
112
+ ]);
113
+ }
114
+ if (createWatch) {
115
+ const _callbacks = {};
116
+ const addCallbackStatement = (key, statements) => {
117
+ if (!_callbacks.hasOwnProperty(key)) {
118
+ _callbacks[key] = [];
119
+ }
120
+ _callbacks[key].push(...statements);
121
+ };
122
+ const componentWatch = {
123
+ elementKey: node.elementKey,
124
+ callbacks: {},
125
+ address: node.address,
126
+ };
127
+ componentDefinition.watches.push(componentWatch);
128
+ node.watches.forEach((watch) => {
129
+ const lookupKey = componentDefinition.addLookup(watch.expression);
130
+ addCallbackStatement(lookupKey, (0, utils_1.codeToNode)(watch.callback));
131
+ });
132
+ if (node.isNestedClass) {
133
+ const props = node.getProps();
134
+ const args = props ? [props] : [];
135
+ addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
136
+ (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)("render")), args)),
137
+ ]);
138
+ }
139
+ if (node.toggleTriggers.length) {
140
+ addToggleCallbackStatement(componentDefinition, node, addCallbackStatement);
141
+ }
142
+ // Need to be careful with WATCH_CALLBACK_PARAMS
143
+ if (stubName) {
144
+ addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
145
+ (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)("render")), [component.propsIdentifier])),
146
+ ]);
147
+ }
148
+ if (visibilityToggle) {
149
+ const shieldLookupKey = componentDefinition.addLookup(visibilityToggle.expression);
150
+ componentWatch.shieldInfo = {
151
+ skipCount: 0, // gets set later once we've processed all the nodes.
152
+ key: shieldLookupKey,
153
+ reverse: visibilityToggle.reverse,
154
+ };
155
+ if (visibilityToggle.detach) {
156
+ if (node.parent.detacherStashKey === undefined) {
157
+ throw new Error("Parent node was not given a stash key");
158
+ }
159
+ componentWatch.shieldInfo.detacher = {
160
+ index: node.address[node.address.length - 1],
161
+ stashKey: node.parent.detacherStashKey,
162
+ parentKey: node.parent.elementKey,
163
+ };
164
+ }
165
+ }
166
+ if (repeatInstruction) {
167
+ componentDefinition.component.module.requireImport(constants_1.IMPORTABLES.getSequentialPool);
168
+ const poolInstance = repeatInstruction.poolExpression ||
169
+ (0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.getSequentialPool), [
170
+ (0, types_1.identifier)(repeatInstruction.componentCls),
171
+ ]);
172
+ // TODO: couple the stash index with the call to save - if possible?
173
+ // Or make it an object and pass the key when saving.
174
+ const miscStashKey = componentDefinition.getNextmiscStashKey();
175
+ componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.stashMisc, [(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component), poolInstance]);
176
+ addCallbackStatement(constants_1.SPECIAL_SYMBOLS.alwaysUpdate, [
177
+ (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)(miscStashKey), true), (0, types_1.identifier)(constants_1.SPECIAL_SYMBOLS.patch)), [
178
+ (0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element),
179
+ repeatInstruction.expression,
180
+ component.componentIdentifier,
181
+ ])),
182
+ ]);
183
+ }
184
+ for (const key in _callbacks) {
185
+ const args = key === constants_1.SPECIAL_SYMBOLS.alwaysUpdate
186
+ ? [
187
+ (0, types_1.identifier)(constants_1.WATCH_CALLBACK_PARAMS.element),
188
+ component.propsIdentifier,
189
+ component.componentIdentifier,
190
+ ]
191
+ : (0, utils_2.buildWatchCallbackParams)();
192
+ componentWatch.callbacks[key] = (0, types_1.functionExpression)(null, args, (0, types_1.blockStatement)(_callbacks[key]));
193
+ }
194
+ }
195
+ if (ref) {
196
+ if (componentDefinition.collectedRefs.includes(ref)) {
197
+ (0, errors_1.error)(node.path, errors_1.ERROR_MESSAGES.REFS_MUST_BE_UNIQUE_WITHIN_EACH_COMPONENT);
198
+ }
199
+ componentDefinition.collectedRefs.push(ref);
200
+ componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.saveRef, [(0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component), (0, types_1.stringLiteral)(ref)]);
201
+ }
202
+ // Note that some things will already have been renamed, but here we are renaming
203
+ // specifically inside the buildComponent scope.
204
+ const eventVariableMapping = {
205
+ [component.componentIdentifier.name]: constants_1.COMPONENT_BUILD_PARAMS.component,
206
+ [component.propsIdentifier.name]: `${constants_1.COMPONENT_BUILD_PARAMS.component}.props`,
207
+ [constants_1.EVENT_CALLBACK_VARIABLES.element]: `${constants_1.EVENT_CALLBACK_VARIABLES.event}.target`,
208
+ };
209
+ node.eventListeners.forEach((listener) => {
210
+ const updatedExpression = (0, utils_2.renameVariablesInExpression)(listener.callback, eventVariableMapping);
211
+ componentDefinition.wrapDynamicElementCall(node.elementKey, constants_1.IMPORTABLES.onEvent, [
212
+ (0, types_1.stringLiteral)(listener.eventName),
213
+ (0, types_1.functionExpression)(null, [(0, types_1.identifier)(constants_1.EVENT_CALLBACK_VARIABLES.event)], (0, types_1.blockStatement)([(0, types_1.expressionStatement)(updatedExpression)])),
214
+ ]);
215
+ });
216
+ }
217
+ });
218
+ }
219
+ //# sourceMappingURL=processNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processNodes.js","sourceRoot":"","sources":["../../src/consolidation/processNodes.ts"],"names":[],"mappings":";;AAoHA,oCAiQC;AApXD,wCASsB;AACtB,k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AAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,kCAAsB,CAAC,SAAS;gBACtE,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,EAC9B,GAAG,kCAAsB,CAAC,SAAS,QAAQ;gBAC7C,CAAC,oCAAwB,CAAC,OAAO,CAAC,EAAE,GAAG,oCAAwB,CAAC,KAAK,SAAS;aAC/E,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACvC,MAAM,iBAAiB,GAAG,IAAA,mCAA2B,EACnD,QAAQ,CAAC,QAAQ,EACjB,oBAAoB,CACrB,CAAC;gBAEF,mBAAmB,CAAC,sBAAsB,CACxC,IAAI,CAAC,UAAU,EACf,uBAAW,CAAC,OAAO,EACnB;oBACE,IAAA,qBAAa,EAAC,QAAQ,CAAC,SAAS,CAAC;oBACjC,IAAA,0BAAkB,EAChB,IAAI,EACJ,CAAC,IAAA,kBAAU,EAAC,oCAAwB,CAAC,KAAK,CAAC,CAAC,EAC5C,IAAA,sBAAc,EAAC,CAAC,IAAA,2BAAmB,EAAC,iBAAiB,CAAC,CAAC,CAAC,CACzD;iBACF,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,12 +1,18 @@
1
1
  import type { FunctionExpression } from "@babel/types";
2
2
  export type NodeAddress = Array<number>;
3
+ export interface Detacher {
4
+ index: number;
5
+ stashKey: number;
6
+ parentKey: string;
7
+ }
3
8
  export interface ShieldInfo {
4
9
  key: string;
5
10
  reverse: boolean;
6
- count: number;
11
+ skipCount: number;
12
+ detacher?: Detacher;
7
13
  }
8
14
  export interface ComponentWatch {
9
- stashRef: string;
15
+ elementKey: string;
10
16
  shieldInfo?: ShieldInfo | undefined;
11
17
  callbacks: {
12
18
  [key: string]: FunctionExpression;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/builders/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/consolidation/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import type { ArrayExpression, Expression, CallExpression } from "@babel/types";
2
+ import { ExtractedNode, Module } from "../models";
3
+ import { NodeAddress } from "./types";
4
+ export declare function getSiblings(node: ExtractedNode, allNodes: Array<ExtractedNode>): ExtractedNode[];
5
+ export declare function getChildren(node: ExtractedNode, allNodes: Array<ExtractedNode>): ExtractedNode[];
6
+ export declare function buildAddressArray(address: NodeAddress): ArrayExpression;
7
+ export declare function buildFindElementCall(module: Module, address: NodeAddress): CallExpression;
8
+ export declare function buildNestedClassCall(module: Module, address: NodeAddress, componentCls: Expression): CallExpression;
9
+ export declare function removeKeys(obj: Object, keys: Array<string>): void;
10
+ /**
11
+ * Use this to rename variables when there is no scope.
12
+ * It came from chatGTP.
13
+ */
14
+ export declare function renameVariablesInExpression(originalExpression: Expression, variableMapping: {
15
+ [key: string]: string;
16
+ }): Expression;
17
+ /**
18
+ * No user code gets copied into the watch callback functions, so we can hardcode params
19
+ * as they won't clash with anything.
20
+ */
21
+ export declare function buildWatchCallbackParams(): import("@babel/types").Identifier[];
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSiblings = getSiblings;
4
+ exports.getChildren = getChildren;
5
+ exports.buildAddressArray = buildAddressArray;
6
+ exports.buildFindElementCall = buildFindElementCall;
7
+ exports.buildNestedClassCall = buildNestedClassCall;
8
+ exports.removeKeys = removeKeys;
9
+ exports.renameVariablesInExpression = renameVariablesInExpression;
10
+ exports.buildWatchCallbackParams = buildWatchCallbackParams;
11
+ const types_1 = require("@babel/types");
12
+ const constants_1 = require("../constants");
13
+ function getSiblings(node, allNodes) {
14
+ return allNodes.filter((n) => n.parent === node.parent && n !== node);
15
+ }
16
+ function getChildren(node, allNodes) {
17
+ return allNodes.filter((n) => n.parent === node);
18
+ }
19
+ function buildAddressArray(address) {
20
+ return (0, types_1.arrayExpression)(address.map((i) => (0, types_1.numericLiteral)(i)));
21
+ }
22
+ function buildFindElementCall(module, address) {
23
+ module.requireImport(constants_1.IMPORTABLES.findElement);
24
+ return (0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.findElement), [
25
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.rootElement),
26
+ buildAddressArray(address),
27
+ ]);
28
+ }
29
+ function buildNestedClassCall(module, address, componentCls) {
30
+ module.requireImport(constants_1.IMPORTABLES.nestComponent);
31
+ return (0, types_1.callExpression)((0, types_1.identifier)(constants_1.IMPORTABLES.nestComponent), [
32
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.rootElement),
33
+ buildAddressArray(address),
34
+ componentCls,
35
+ (0, types_1.identifier)(constants_1.COMPONENT_BUILD_PARAMS.component),
36
+ ]);
37
+ }
38
+ function removeKeys(obj, keys) {
39
+ for (const prop in obj) {
40
+ if (keys.includes(prop))
41
+ delete obj[prop];
42
+ else if (typeof obj[prop] === "object")
43
+ removeKeys(obj[prop], keys);
44
+ }
45
+ }
46
+ /**
47
+ * Use this to rename variables when there is no scope.
48
+ * It came from chatGTP.
49
+ */
50
+ function renameVariablesInExpression(originalExpression, variableMapping) {
51
+ // Clone the original expression to avoid modifying it
52
+ const clonedExpression = (0, types_1.cloneNode)(originalExpression);
53
+ // Function to replace identifiers based on the mapping
54
+ function replaceIdentifiers(node) {
55
+ if ((0, types_1.isIdentifier)(node) && variableMapping[node.name]) {
56
+ return (0, types_1.identifier)(variableMapping[node.name]);
57
+ }
58
+ return node;
59
+ }
60
+ // Recursive function to traverse and update the AST
61
+ function traverseAndReplace(node) {
62
+ // If the node is an array (e.g., arguments), handle each element
63
+ if (Array.isArray(node)) {
64
+ return node.map(traverseAndReplace);
65
+ }
66
+ // Replace identifiers if applicable
67
+ const newNode = replaceIdentifiers(node);
68
+ // Recursively handle child nodes
69
+ for (const key of Object.keys(newNode)) {
70
+ if (newNode[key] && typeof newNode[key] === "object") {
71
+ newNode[key] = traverseAndReplace(newNode[key]);
72
+ }
73
+ }
74
+ return newNode;
75
+ }
76
+ return traverseAndReplace(clonedExpression);
77
+ }
78
+ /**
79
+ * No user code gets copied into the watch callback functions, so we can hardcode params
80
+ * as they won't clash with anything.
81
+ */
82
+ function buildWatchCallbackParams() {
83
+ return [
84
+ constants_1.WATCH_CALLBACK_PARAMS.newValue,
85
+ constants_1.WATCH_CALLBACK_PARAMS.oldValue,
86
+ constants_1.WATCH_CALLBACK_PARAMS.element,
87
+ constants_1.WATCH_CALLBACK_PARAMS.props,
88
+ constants_1.WATCH_CALLBACK_PARAMS.component,
89
+ ].map((letter) => (0, types_1.identifier)(letter));
90
+ }
91
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/consolidation/utils.ts"],"names":[],"mappings":";;AAiBA,kCAKC;AAED,kCAKC;AAED,8CAEC;AAED,oDASC;AAED,oDAYC;AAED,gCAKC;AAMD,kEAmCC;AAMD,4DAQC;AAvHD,wCAOsB;AAEtB,4CAIsB;AAGtB,SAAgB,WAAW,CACzB,IAAmB,EACnB,QAA8B;IAE9B,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,SAAgB,WAAW,CACzB,IAAmB,EACnB,QAA8B;IAE9B,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,SAAgB,iBAAiB,CAAC,OAAoB;IACpD,OAAO,IAAA,uBAAe,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,sBAAc,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atch } from "./types";
2
+ export declare function processeVisibilityToggles(watches: Array<ComponentWatch>): void;