@komaci/esm-generator 264.5.0 → 266.3.0

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 (130) hide show
  1. package/build/genericAstGeneration.js +80 -34
  2. package/package.json +1 -1
  3. package/build/__tests__/adgAstGeneration.spec.d.ts +0 -2
  4. package/build/__tests__/adgAstGeneration.spec.js +0 -447
  5. package/build/__tests__/compile-generated-module-fixtures.spec.d.ts +0 -2
  6. package/build/__tests__/compile-generated-module-fixtures.spec.js +0 -49
  7. package/build/__tests__/compilerConfigs.d.ts +0 -24
  8. package/build/__tests__/compilerConfigs.js +0 -126
  9. package/build/__tests__/compositionAstGeneration.spec.d.ts +0 -2
  10. package/build/__tests__/compositionAstGeneration.spec.js +0 -676
  11. package/build/__tests__/fixtures-combined-files/exclude-comps-unused-import-prop/actual.d.ts +0 -6
  12. package/build/__tests__/fixtures-combined-files/exclude-comps-unused-import-prop/actual.js +0 -28
  13. package/build/__tests__/fixtures-combined-files/exclude-partial-classProps-indirect-importRef-getter/actual.d.ts +0 -29
  14. package/build/__tests__/fixtures-combined-files/exclude-partial-classProps-indirect-importRef-getter/actual.js +0 -148
  15. package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-one/actual.d.ts +0 -9
  16. package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-one/actual.js +0 -35
  17. package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-two/actual.d.ts +0 -10
  18. package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-two/actual.js +0 -39
  19. package/build/__tests__/fixtures-combined-files/exclude-wire-unused-import-prop/actual.d.ts +0 -7
  20. package/build/__tests__/fixtures-combined-files/exclude-wire-unused-import-prop/actual.js +0 -34
  21. package/build/__tests__/fixtures-combined-files/image-type/actual.d.ts +0 -13
  22. package/build/__tests__/fixtures-combined-files/image-type/actual.js +0 -41
  23. package/build/__tests__/fixtures-combined-files/include-all-indirect-importRef-getter-complex/actual.d.ts +0 -14
  24. package/build/__tests__/fixtures-combined-files/include-all-indirect-importRef-getter-complex/actual.js +0 -79
  25. package/build/__tests__/fixtures-combined-files/include-class-prop-indirect-importRef-getter/actual.d.ts +0 -18
  26. package/build/__tests__/fixtures-combined-files/include-class-prop-indirect-importRef-getter/actual.js +0 -103
  27. package/build/__tests__/fixtures-combined-files/include-comps-used-import-prop/actual.d.ts +0 -6
  28. package/build/__tests__/fixtures-combined-files/include-comps-used-import-prop/actual.js +0 -28
  29. package/build/__tests__/fixtures-combined-files/include-salesforce-resourceUrl-imports/actual.d.ts +0 -6
  30. package/build/__tests__/fixtures-combined-files/include-salesforce-resourceUrl-imports/actual.js +0 -16
  31. package/build/__tests__/fixtures-combined-files/include-salesforce-resourceUrl-nonAnalyzable-imports/actual.d.ts +0 -4
  32. package/build/__tests__/fixtures-combined-files/include-salesforce-resourceUrl-nonAnalyzable-imports/actual.js +0 -18
  33. package/build/__tests__/fixtures-combined-files/include-template-strings/actual.d.ts +0 -10
  34. package/build/__tests__/fixtures-combined-files/include-template-strings/actual.js +0 -41
  35. package/build/__tests__/fixtures-combined-files/include-used-import-getter/actual.d.ts +0 -9
  36. package/build/__tests__/fixtures-combined-files/include-used-import-getter/actual.js +0 -38
  37. package/build/__tests__/fixtures-combined-files/include-wire-used-import-prop/actual.d.ts +0 -7
  38. package/build/__tests__/fixtures-combined-files/include-wire-used-import-prop/actual.js +0 -34
  39. package/build/__tests__/fixtures-combined-files/only-named-export-with-template/actual.d.ts +0 -1
  40. package/build/__tests__/fixtures-combined-files/only-named-export-with-template/actual.js +0 -2
  41. package/build/__tests__/fixtures-combined-files/unsupported-wire-from-supported-namespace/actual.d.ts +0 -6
  42. package/build/__tests__/fixtures-combined-files/unsupported-wire-from-supported-namespace/actual.js +0 -19
  43. package/build/__tests__/fixtures-combined-files-multiple-templates/invalid-renderFunc-no-valid-imports/c/component/component.d.ts +0 -5
  44. package/build/__tests__/fixtures-combined-files-multiple-templates/invalid-renderFunc-no-valid-imports/c/component/component.js +0 -14
  45. package/build/__tests__/fixtures-combined-files-multiple-templates/valid-render-function-complex/lightning/component/component.d.ts +0 -6
  46. package/build/__tests__/fixtures-combined-files-multiple-templates/valid-render-function-complex/lightning/component/component.js +0 -31
  47. package/build/__tests__/fixtures-combined-files-multiple-templates/valid-render-function-simple/lightning/component/component.d.ts +0 -6
  48. package/build/__tests__/fixtures-combined-files-multiple-templates/valid-render-function-simple/lightning/component/component.js +0 -27
  49. package/build/__tests__/fixtures-gql/multipleGqlQueries/c/component/component.d.ts +0 -15
  50. package/build/__tests__/fixtures-gql/multipleGqlQueries/c/component/component.js +0 -104
  51. package/build/__tests__/fixtures-script-files/class-extends-multiple-with-separate-imports/actual.d.ts +0 -8
  52. package/build/__tests__/fixtures-script-files/class-extends-multiple-with-separate-imports/actual.js +0 -17
  53. package/build/__tests__/fixtures-script-files/class-extends-separate-imports/actual.d.ts +0 -4
  54. package/build/__tests__/fixtures-script-files/class-extends-separate-imports/actual.js +0 -13
  55. package/build/__tests__/fixtures-script-files/class-extends-separate-imports-alias/actual.d.ts +0 -4
  56. package/build/__tests__/fixtures-script-files/class-extends-separate-imports-alias/actual.js +0 -10
  57. package/build/__tests__/fixtures-script-files/class-props/actual.d.ts +0 -30
  58. package/build/__tests__/fixtures-script-files/class-props/actual.js +0 -103
  59. package/build/__tests__/fixtures-script-files/empty-class/actual.d.ts +0 -4
  60. package/build/__tests__/fixtures-script-files/empty-class/actual.js +0 -7
  61. package/build/__tests__/fixtures-script-files/empty-doc/actual.d.ts +0 -1
  62. package/build/__tests__/fixtures-script-files/empty-doc/actual.js +0 -2
  63. package/build/__tests__/fixtures-script-files/empty-wire/actual.d.ts +0 -5
  64. package/build/__tests__/fixtures-script-files/empty-wire/actual.js +0 -16
  65. package/build/__tests__/fixtures-script-files/exclude-wire-unused-import-prop/actual.d.ts +0 -7
  66. package/build/__tests__/fixtures-script-files/exclude-wire-unused-import-prop/actual.js +0 -34
  67. package/build/__tests__/fixtures-script-files/exports/actual.d.ts +0 -22
  68. package/build/__tests__/fixtures-script-files/exports/actual.js +0 -63
  69. package/build/__tests__/fixtures-script-files/imports/actual.d.ts +0 -11
  70. package/build/__tests__/fixtures-script-files/imports/actual.js +0 -80
  71. package/build/__tests__/fixtures-script-files/imports-namespaced/actual.d.ts +0 -10
  72. package/build/__tests__/fixtures-script-files/imports-namespaced/actual.js +0 -63
  73. package/build/__tests__/fixtures-script-files/include-wire-unused-import-prop/actual.d.ts +0 -7
  74. package/build/__tests__/fixtures-script-files/include-wire-unused-import-prop/actual.js +0 -34
  75. package/build/__tests__/fixtures-script-files/inheritance-imports-default/actual.d.ts +0 -3
  76. package/build/__tests__/fixtures-script-files/inheritance-imports-default/actual.js +0 -10
  77. package/build/__tests__/fixtures-script-files/inheritance-imports-local/actual.d.ts +0 -9
  78. package/build/__tests__/fixtures-script-files/inheritance-imports-local/actual.js +0 -24
  79. package/build/__tests__/fixtures-script-files/inheritance-imports-named/actual.d.ts +0 -4
  80. package/build/__tests__/fixtures-script-files/inheritance-imports-named/actual.js +0 -17
  81. package/build/__tests__/fixtures-script-files/inheritance-parent-unresolved/actual.d.ts +0 -4
  82. package/build/__tests__/fixtures-script-files/inheritance-parent-unresolved/actual.js +0 -17
  83. package/build/__tests__/fixtures-script-files/unsupported-wire-from-supported-namespace/actual.d.ts +0 -6
  84. package/build/__tests__/fixtures-script-files/unsupported-wire-from-supported-namespace/actual.js +0 -19
  85. package/build/__tests__/fixtures-script-files/wire-basic/actual.d.ts +0 -8
  86. package/build/__tests__/fixtures-script-files/wire-basic/actual.js +0 -30
  87. package/build/__tests__/fixtures-script-files/wire-functions/actual.d.ts +0 -13
  88. package/build/__tests__/fixtures-script-files/wire-functions/actual.js +0 -46
  89. package/build/__tests__/fixtures-script-files/wire-imports/actual.d.ts +0 -11
  90. package/build/__tests__/fixtures-script-files/wire-imports/actual.js +0 -63
  91. package/build/__tests__/fixtures-source-code/badImportRef.d.ts +0 -4
  92. package/build/__tests__/fixtures-source-code/badImportRef.js +0 -31
  93. package/build/__tests__/fixtures-source-code/generalMockSourceCode.d.ts +0 -8
  94. package/build/__tests__/fixtures-source-code/generalMockSourceCode.js +0 -127
  95. package/build/__tests__/fixtures-source-code/gqlMockSource.d.ts +0 -3
  96. package/build/__tests__/fixtures-source-code/gqlMockSource.js +0 -95
  97. package/build/__tests__/functionAstGeneration.spec.d.ts +0 -2
  98. package/build/__tests__/functionAstGeneration.spec.js +0 -727
  99. package/build/__tests__/general-komaci-docs/assorted-template-strings/source.d.ts +0 -10
  100. package/build/__tests__/general-komaci-docs/assorted-template-strings/source.js +0 -41
  101. package/build/__tests__/general-komaci-docs/getters-and-compositions-collisions/source.d.ts +0 -7
  102. package/build/__tests__/general-komaci-docs/getters-and-compositions-collisions/source.js +0 -31
  103. package/build/__tests__/general-komaci-docs/import-types/source.d.ts +0 -18
  104. package/build/__tests__/general-komaci-docs/import-types/source.js +0 -108
  105. package/build/__tests__/general-komaci-docs/import-types/validationStuff.d.ts +0 -18
  106. package/build/__tests__/general-komaci-docs/import-types/validationStuff.js +0 -63
  107. package/build/__tests__/general-komaci-docs/template-component/source.d.ts +0 -8
  108. package/build/__tests__/general-komaci-docs/template-component/source.js +0 -34
  109. package/build/__tests__/generated-module/compile-graphql-with-scoped-import.spec.d.ts +0 -2
  110. package/build/__tests__/generated-module/compile-graphql-with-scoped-import.spec.js +0 -20
  111. package/build/__tests__/generated-module/lightning/component/component.d.ts +0 -18
  112. package/build/__tests__/generated-module/lightning/component/component.js +0 -168
  113. package/build/__tests__/genericAstGeneration.spec.d.ts +0 -2
  114. package/build/__tests__/genericAstGeneration.spec.js +0 -1052
  115. package/build/__tests__/index.spec.d.ts +0 -2
  116. package/build/__tests__/index.spec.js +0 -393
  117. package/build/__tests__/komaci-ast-unit.spec.d.ts +0 -2
  118. package/build/__tests__/komaci-ast-unit.spec.js +0 -422
  119. package/build/__tests__/komaci-bundle-module.fixtures.spec.d.ts +0 -2
  120. package/build/__tests__/komaci-bundle-module.fixtures.spec.js +0 -76
  121. package/build/__tests__/komaci-bundle-multiple-templates-module.fixtures.spec.d.ts +0 -2
  122. package/build/__tests__/komaci-bundle-multiple-templates-module.fixtures.spec.js +0 -117
  123. package/build/__tests__/komaci-gql.fixtures.spec.d.ts +0 -2
  124. package/build/__tests__/komaci-gql.fixtures.spec.js +0 -51
  125. package/build/__tests__/komaci-script-module.fixtures.spec.d.ts +0 -2
  126. package/build/__tests__/komaci-script-module.fixtures.spec.js +0 -70
  127. package/build/__tests__/komaci-template-module.fixtures.spec.d.ts +0 -2
  128. package/build/__tests__/komaci-template-module.fixtures.spec.js +0 -57
  129. package/build/__tests__/readAndParseBundle.d.ts +0 -22
  130. package/build/__tests__/readAndParseBundle.js +0 -80
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- const lwc_1 = require("lwc");
36
- const ContactController_getContactList_1 = __importDefault(require("@salesforce/apex/ContactController.getContactList"));
37
- const ContactController_findContacts_1 = __importDefault(require("@salesforce/apex/ContactController.findContacts"));
38
- const adapter = __importStar(require("my/adapter"));
39
- const adapter_1 = require("my/adapter");
40
- const adapter_2 = __importDefault(require("my/adapter"));
41
- class ScriptTestClass extends lwc_1.LightningElement {
42
- constructor() {
43
- super(...arguments);
44
- this.searchKey = '';
45
- }
46
- }
47
- __decorate([
48
- (0, lwc_1.wire)(ContactController_getContactList_1.default)
49
- ], ScriptTestClass.prototype, "wiredApex1", void 0);
50
- __decorate([
51
- (0, lwc_1.wire)(adapter)
52
- ], ScriptTestClass.prototype, "wiredNamespacedImport", void 0);
53
- __decorate([
54
- (0, lwc_1.wire)(adapter_1.adapter)
55
- ], ScriptTestClass.prototype, "wiredAliasName", void 0);
56
- __decorate([
57
- (0, lwc_1.wire)(adapter_2.default)
58
- ], ScriptTestClass.prototype, "wireAliasDefault", void 0);
59
- __decorate([
60
- (0, lwc_1.wire)(ContactController_findContacts_1.default, { searchKey: '$searchKey' })
61
- ], ScriptTestClass.prototype, "wiredApex2", void 0);
62
- exports.default = ScriptTestClass;
63
- //# sourceMappingURL=actual.js.map
@@ -1,4 +0,0 @@
1
- export declare const sourceClass = "import test from 'force/shared'; // good import\nimport bad from 'invalid/import';\n\nexport default class Component {\n get testing() {\n return `A string that references ${test}`;\n }\n\n get badProp() {\n return `altho we reference ${test} we also reference ${bad}`;\n }\n\n get thing() {\n const thing = { test123: { test: 'abc'}} //should not be altered by the import existing\n return thing?.test123?.test; //should not be altered by the import existing\n }\n \n get stringThing() {\n const test = \"hi\";\n return test;\n }\n}";
2
- export declare const expectedGoodHoist = "function g0(props) {\n return `A string that references ${i0}`;\n}";
3
- export declare const expectedGoodHoistAst: import("@babel/parser").ParseResult<import("@babel/types").File>;
4
- //# sourceMappingURL=badImportRef.d.ts.map
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expectedGoodHoistAst = exports.expectedGoodHoist = exports.sourceClass = void 0;
4
- const parser_1 = require("@babel/parser");
5
- exports.sourceClass = `import test from 'force/shared'; // good import
6
- import bad from 'invalid/import';
7
-
8
- export default class Component {
9
- get testing() {
10
- return \`A string that references \${test}\`;
11
- }
12
-
13
- get badProp() {
14
- return \`altho we reference \${test} we also reference \${bad}\`;
15
- }
16
-
17
- get thing() {
18
- const thing = { test123: { test: 'abc'}} //should not be altered by the import existing
19
- return thing?.test123?.test; //should not be altered by the import existing
20
- }
21
-
22
- get stringThing() {
23
- const test = "hi";
24
- return test;
25
- }
26
- }`;
27
- exports.expectedGoodHoist = `function g0(props) {
28
- return \`A string that references \${i0}\`;
29
- }`;
30
- exports.expectedGoodHoistAst = (0, parser_1.parse)(exports.expectedGoodHoist);
31
- //# sourceMappingURL=badImportRef.js.map
@@ -1,8 +0,0 @@
1
- export declare const mockOneBadGetter = "import { LightningElement, wire, api } from 'lwc';\nimport { getRecord } from 'lightning/uiRecordApi';\nimport findContacts from '@salesforce/apex/ContactController.findContacts';\n\nexport default class Example extends LightningElement {\n @api\n recordId;\n\n get searchKey() {\n const recordName = this.record?.data?.Fields?.name;\n this.blah = \"asdf\"; //invalid\n if(recordName) {\n return '%' + recordName + '%';\n }\n return 'Default Search Key';\n }\n\n get perfectlyGood() {\n const recordName = this.record?.data?.Fields?.name;\n if(recordName) {\n return '%' + recordName + '%';\n }\n return 'Default Search Key';\n }\n\n @wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })\n record = {};\n\n @wire(findContacts, { searchKey: '$searchKey', filter: '$perfectlyGood' })\n contacts;\n}";
2
- export declare const mockOnlyBadGetter = "import { LightningElement, wire, api } from 'lwc';\nimport { getRecord } from 'lightning/uiRecordApi';\nimport findContacts from '@salesforce/apex/ContactController.findContacts';\n\nexport default class Example extends LightningElement {\n @api\n recordId;\n\n get searchKey() {\n const recordName = this.record?.data?.Fields?.name;\n this.blah = \"asdf\"; //invalid\n if(recordName) {\n return '%' + recordName + '%';\n }\n return 'Default Search Key';\n }\n\n @wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })\n record = {};\n\n @wire(findContacts, { searchKey: '$searchKey' })\n contacts;\n}";
3
- export declare const oneGoodMockWithGetterImportUse = "import { LightningElement, wire, api } from 'lwc';\nimport { getRecord } from 'lightning/uiRecordApi';\nimport findContacts from '@salesforce/apex/ContactController.findContacts';\nimport Foo from 'force/shared';\nimport { Bar } from 'force/shared';\n\nexport default class Example extends LightningElement {\n @api\n recordId;\n\n get searchKey() {\n const recordName = this.record?.data?.Fields?.name;\n this.blah = \"asdf\"; //invalid\n if(recordName) {\n return '%' + recordName + '%';\n }\n return 'Default Search Key';\n }\n\n get perfectlyGood() {\n const recordName = this.record?.data?.Fields?.name;\n return Foo;\n }\n\n get perfectlyGood2() {\n return Bar;\n }\n\n @wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })\n record = {};\n\n @wire(findContacts, { searchKey: '$searchKey', filter: '$perfectlyGood', split: '$perfectlyGood2' })\n contacts;\n}";
4
- export declare const emptyProgram = "";
5
- export declare const mockSrcCode_Pass_Valid_Render_Conditional = "import { LightningElement, api } from 'lwc';\nimport templateOne from './templateOne.html';\nimport templateTwo from './templateTwo.html';\n\nexport default class MiscMultipleTemplates extends LightningElement {\n @api templateOne = true;\n\n render() {\n return this.templateOne ? templateOne : templateTwo;\n }\n}";
6
- export declare const mockSrcCode_Pass_Valid_Render_DefaultTemplate = "import { LightningElement, api } from 'lwc';\nimport defaultTemplate from './komaciAction.html';\n\nexport default class KomaciAction extends LightningElement {\n \n render() {\n return defaultTemplate;\n }\n}";
7
- export declare const mockSrcCode_Pass_Valid_Render_MultipleReturns = "import { LightningElement, api } from 'lwc';\nimport templateOne from './templateOne.html';\nimport defaultTemplate from './komaciAction.html';\n\nexport default class KomaciAction extends LightningElement {\n @api showTemplateOne = true;\n\n render() {\n if(this.templateOne){\n return templateOne; \n }\n return defaultTemplate\n }\n}";
8
- //# sourceMappingURL=generalMockSourceCode.d.ts.map
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockSrcCode_Pass_Valid_Render_MultipleReturns = exports.mockSrcCode_Pass_Valid_Render_DefaultTemplate = exports.mockSrcCode_Pass_Valid_Render_Conditional = exports.emptyProgram = exports.oneGoodMockWithGetterImportUse = exports.mockOnlyBadGetter = exports.mockOneBadGetter = void 0;
4
- exports.mockOneBadGetter = `import { LightningElement, wire, api } from 'lwc';
5
- import { getRecord } from 'lightning/uiRecordApi';
6
- import findContacts from '@salesforce/apex/ContactController.findContacts';
7
-
8
- export default class Example extends LightningElement {
9
- @api
10
- recordId;
11
-
12
- get searchKey() {
13
- const recordName = this.record?.data?.Fields?.name;
14
- this.blah = "asdf"; //invalid
15
- if(recordName) {
16
- return '%' + recordName + '%';
17
- }
18
- return 'Default Search Key';
19
- }
20
-
21
- get perfectlyGood() {
22
- const recordName = this.record?.data?.Fields?.name;
23
- if(recordName) {
24
- return '%' + recordName + '%';
25
- }
26
- return 'Default Search Key';
27
- }
28
-
29
- @wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })
30
- record = {};
31
-
32
- @wire(findContacts, { searchKey: '$searchKey', filter: '$perfectlyGood' })
33
- contacts;
34
- }`;
35
- exports.mockOnlyBadGetter = `import { LightningElement, wire, api } from 'lwc';
36
- import { getRecord } from 'lightning/uiRecordApi';
37
- import findContacts from '@salesforce/apex/ContactController.findContacts';
38
-
39
- export default class Example extends LightningElement {
40
- @api
41
- recordId;
42
-
43
- get searchKey() {
44
- const recordName = this.record?.data?.Fields?.name;
45
- this.blah = "asdf"; //invalid
46
- if(recordName) {
47
- return '%' + recordName + '%';
48
- }
49
- return 'Default Search Key';
50
- }
51
-
52
- @wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })
53
- record = {};
54
-
55
- @wire(findContacts, { searchKey: '$searchKey' })
56
- contacts;
57
- }`;
58
- exports.oneGoodMockWithGetterImportUse = `import { LightningElement, wire, api } from 'lwc';
59
- import { getRecord } from 'lightning/uiRecordApi';
60
- import findContacts from '@salesforce/apex/ContactController.findContacts';
61
- import Foo from 'force/shared';
62
- import { Bar } from 'force/shared';
63
-
64
- export default class Example extends LightningElement {
65
- @api
66
- recordId;
67
-
68
- get searchKey() {
69
- const recordName = this.record?.data?.Fields?.name;
70
- this.blah = "asdf"; //invalid
71
- if(recordName) {
72
- return '%' + recordName + '%';
73
- }
74
- return 'Default Search Key';
75
- }
76
-
77
- get perfectlyGood() {
78
- const recordName = this.record?.data?.Fields?.name;
79
- return Foo;
80
- }
81
-
82
- get perfectlyGood2() {
83
- return Bar;
84
- }
85
-
86
- @wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })
87
- record = {};
88
-
89
- @wire(findContacts, { searchKey: '$searchKey', filter: '$perfectlyGood', split: '$perfectlyGood2' })
90
- contacts;
91
- }`;
92
- exports.emptyProgram = ``;
93
- exports.mockSrcCode_Pass_Valid_Render_Conditional = `import { LightningElement, api } from 'lwc';
94
- import templateOne from './templateOne.html';
95
- import templateTwo from './templateTwo.html';
96
-
97
- export default class MiscMultipleTemplates extends LightningElement {
98
- @api templateOne = true;
99
-
100
- render() {
101
- return this.templateOne ? templateOne : templateTwo;
102
- }
103
- }`;
104
- exports.mockSrcCode_Pass_Valid_Render_DefaultTemplate = `import { LightningElement, api } from 'lwc';
105
- import defaultTemplate from './komaciAction.html';
106
-
107
- export default class KomaciAction extends LightningElement {
108
-
109
- render() {
110
- return defaultTemplate;
111
- }
112
- }`;
113
- exports.mockSrcCode_Pass_Valid_Render_MultipleReturns = `import { LightningElement, api } from 'lwc';
114
- import templateOne from './templateOne.html';
115
- import defaultTemplate from './komaciAction.html';
116
-
117
- export default class KomaciAction extends LightningElement {
118
- @api showTemplateOne = true;
119
-
120
- render() {
121
- if(this.templateOne){
122
- return templateOne;
123
- }
124
- return defaultTemplate
125
- }
126
- }`;
127
- //# sourceMappingURL=generalMockSourceCode.js.map
@@ -1,3 +0,0 @@
1
- export declare const mockGqlQueries = "import { api, wire, LightningElement } from 'lwc';\nimport { gql, unstable_graphql } from 'lightning/uiGraphQLApi'; \n \nexport default class KomaciAction extends LightningElement {\n @api recordId;\n\n temp = \"temp\"; \n\n accountQuery = gql`\n query accountById($id: ID) {\n uiapi {\n query {\n Account(where: { Id: { eq: $id } }) @category(name: \"recordQuery\") {\n edges {\n node {\n Name @category(name: \"StringValue\") {\n value\n displayValue\n }\n }\n }\n }\n }\n }\n }\n `;\n\n contactQuery = gql`\n query accountById($id: ID) {\n uiapi {\n query {\n Contact(where: { Id: { eq: $id } }) @category(name: ${this.temp}) {\n edges {\n node {\n Name @category(name: \"StringValue\") {\n value\n displayValue\n }\n }\n }\n }\n }\n }\n }\n`;\n\nget gqlFromGetter(){\n return gql`\n query accountById($id: ID) {\n uiapi {\n query {\n Contact(where: { Id: { eq: $id } }) @category(name: \"recordQuery\") {\n edges {\n node {\n Name @category(name: \"StringValue\") {\n value\n displayValue\n }\n }\n }\n }\n }\n }\n }\n`;\n}\n\n get variables() {\n return {\n id: this.recordId,\n };\n }\n\n @wire(unstable_graphql, {\n query: '$accountQuery',\n variables: '$variables',\n })\n graphqlRecord;\n\n @wire(unstable_graphql, {\n query: '$contactQuery',\n variables: '$variables',\n })\n graphqlContactRecord;\n} \n";
2
- export declare const expectedGetterWithGql = "\nfunction g0(props) {\nreturn gql0;\n}\n";
3
- //# sourceMappingURL=gqlMockSource.d.ts.map
@@ -1,95 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expectedGetterWithGql = exports.mockGqlQueries = void 0;
4
- exports.mockGqlQueries = `import { api, wire, LightningElement } from 'lwc';
5
- import { gql, unstable_graphql } from 'lightning/uiGraphQLApi';
6
-
7
- export default class KomaciAction extends LightningElement {
8
- @api recordId;
9
-
10
- temp = "temp";
11
-
12
- accountQuery = gql\`
13
- query accountById($id: ID) {
14
- uiapi {
15
- query {
16
- Account(where: { Id: { eq: $id } }) @category(name: "recordQuery") {
17
- edges {
18
- node {
19
- Name @category(name: "StringValue") {
20
- value
21
- displayValue
22
- }
23
- }
24
- }
25
- }
26
- }
27
- }
28
- }
29
- \`;
30
-
31
- contactQuery = gql\`
32
- query accountById($id: ID) {
33
- uiapi {
34
- query {
35
- Contact(where: { Id: { eq: $id } }) @category(name: \${this.temp}) {
36
- edges {
37
- node {
38
- Name @category(name: "StringValue") {
39
- value
40
- displayValue
41
- }
42
- }
43
- }
44
- }
45
- }
46
- }
47
- }
48
- \`;
49
-
50
- get gqlFromGetter(){
51
- return gql\`
52
- query accountById($id: ID) {
53
- uiapi {
54
- query {
55
- Contact(where: { Id: { eq: $id } }) @category(name: "recordQuery") {
56
- edges {
57
- node {
58
- Name @category(name: "StringValue") {
59
- value
60
- displayValue
61
- }
62
- }
63
- }
64
- }
65
- }
66
- }
67
- }
68
- \`;
69
- }
70
-
71
- get variables() {
72
- return {
73
- id: this.recordId,
74
- };
75
- }
76
-
77
- @wire(unstable_graphql, {
78
- query: '$accountQuery',
79
- variables: '$variables',
80
- })
81
- graphqlRecord;
82
-
83
- @wire(unstable_graphql, {
84
- query: '$contactQuery',
85
- variables: '$variables',
86
- })
87
- graphqlContactRecord;
88
- }
89
- `;
90
- exports.expectedGetterWithGql = `
91
- function g0(props) {
92
- return gql0;
93
- }
94
- `;
95
- //# sourceMappingURL=gqlMockSource.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=functionAstGeneration.spec.d.ts.map