@komaci/esm-generator 240.1.3
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.
- package/build/__tests__/compile-generated-module-fixtures.spec.d.ts +2 -0
- package/build/__tests__/compile-generated-module-fixtures.spec.js +45 -0
- package/build/__tests__/fixtures-combined-files/exclude-comps-unused-import-prop/actual.d.ts +5 -0
- package/build/__tests__/fixtures-combined-files/exclude-comps-unused-import-prop/actual.js +28 -0
- package/build/__tests__/fixtures-combined-files/exclude-partial-classProps-indirect-importRef-getter/actual.d.ts +28 -0
- package/build/__tests__/fixtures-combined-files/exclude-partial-classProps-indirect-importRef-getter/actual.js +144 -0
- package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-one/actual.d.ts +8 -0
- package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-one/actual.js +35 -0
- package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-two/actual.d.ts +9 -0
- package/build/__tests__/fixtures-combined-files/exclude-total-unused-import-getter-from-two/actual.js +39 -0
- package/build/__tests__/fixtures-combined-files/exclude-wire-unused-import-prop/actual.d.ts +6 -0
- package/build/__tests__/fixtures-combined-files/exclude-wire-unused-import-prop/actual.js +34 -0
- package/build/__tests__/fixtures-combined-files/image-type/actual.d.ts +12 -0
- package/build/__tests__/fixtures-combined-files/image-type/actual.js +41 -0
- package/build/__tests__/fixtures-combined-files/include-all-indirect-importRef-getter-complex/actual.d.ts +13 -0
- package/build/__tests__/fixtures-combined-files/include-all-indirect-importRef-getter-complex/actual.js +75 -0
- package/build/__tests__/fixtures-combined-files/include-class-prop-indirect-importRef-getter/actual.d.ts +17 -0
- package/build/__tests__/fixtures-combined-files/include-class-prop-indirect-importRef-getter/actual.js +99 -0
- package/build/__tests__/fixtures-combined-files/include-comps-used-import-prop/actual.d.ts +5 -0
- package/build/__tests__/fixtures-combined-files/include-comps-used-import-prop/actual.js +28 -0
- package/build/__tests__/fixtures-combined-files/include-template-strings/actual.d.ts +9 -0
- package/build/__tests__/fixtures-combined-files/include-template-strings/actual.js +41 -0
- package/build/__tests__/fixtures-combined-files/include-used-import-getter/actual.d.ts +8 -0
- package/build/__tests__/fixtures-combined-files/include-used-import-getter/actual.js +38 -0
- package/build/__tests__/fixtures-combined-files/include-wire-used-import-prop/actual.d.ts +6 -0
- package/build/__tests__/fixtures-combined-files/include-wire-used-import-prop/actual.js +34 -0
- package/build/__tests__/fixtures-combined-files/unsupported-wire-from-supported-namespace/actual.d.ts +5 -0
- package/build/__tests__/fixtures-combined-files/unsupported-wire-from-supported-namespace/actual.js +19 -0
- package/build/__tests__/fixtures-script-files/class-extends-multiple-with-separate-imports/actual.d.ts +8 -0
- package/build/__tests__/fixtures-script-files/class-extends-multiple-with-separate-imports/actual.js +17 -0
- package/build/__tests__/fixtures-script-files/class-extends-separate-imports/actual.d.ts +4 -0
- package/build/__tests__/fixtures-script-files/class-extends-separate-imports/actual.js +13 -0
- package/build/__tests__/fixtures-script-files/class-extends-separate-imports-alias/actual.d.ts +4 -0
- package/build/__tests__/fixtures-script-files/class-extends-separate-imports-alias/actual.js +10 -0
- package/build/__tests__/fixtures-script-files/class-props/actual.d.ts +25 -0
- package/build/__tests__/fixtures-script-files/class-props/actual.js +92 -0
- package/build/__tests__/fixtures-script-files/empty-class/actual.d.ts +3 -0
- package/build/__tests__/fixtures-script-files/empty-class/actual.js +7 -0
- package/build/__tests__/fixtures-script-files/empty-doc/actual.d.ts +1 -0
- package/build/__tests__/fixtures-script-files/empty-doc/actual.js +2 -0
- package/build/__tests__/fixtures-script-files/empty-wire/actual.d.ts +4 -0
- package/build/__tests__/fixtures-script-files/empty-wire/actual.js +16 -0
- package/build/__tests__/fixtures-script-files/exclude-wire-unused-import-prop/actual.d.ts +6 -0
- package/build/__tests__/fixtures-script-files/exclude-wire-unused-import-prop/actual.js +34 -0
- package/build/__tests__/fixtures-script-files/exports/actual.d.ts +21 -0
- package/build/__tests__/fixtures-script-files/exports/actual.js +63 -0
- package/build/__tests__/fixtures-script-files/imports/actual.d.ts +10 -0
- package/build/__tests__/fixtures-script-files/imports/actual.js +76 -0
- package/build/__tests__/fixtures-script-files/imports-namespaced/actual.d.ts +9 -0
- package/build/__tests__/fixtures-script-files/imports-namespaced/actual.js +59 -0
- package/build/__tests__/fixtures-script-files/include-wire-unused-import-prop/actual.d.ts +6 -0
- package/build/__tests__/fixtures-script-files/include-wire-unused-import-prop/actual.js +34 -0
- package/build/__tests__/fixtures-script-files/inheritance-imports-default/actual.d.ts +3 -0
- package/build/__tests__/fixtures-script-files/inheritance-imports-default/actual.js +10 -0
- package/build/__tests__/fixtures-script-files/inheritance-imports-local/actual.d.ts +8 -0
- package/build/__tests__/fixtures-script-files/inheritance-imports-local/actual.js +24 -0
- package/build/__tests__/fixtures-script-files/inheritance-imports-named/actual.d.ts +4 -0
- package/build/__tests__/fixtures-script-files/inheritance-imports-named/actual.js +17 -0
- package/build/__tests__/fixtures-script-files/inheritance-parent-unresolved/actual.d.ts +4 -0
- package/build/__tests__/fixtures-script-files/inheritance-parent-unresolved/actual.js +17 -0
- package/build/__tests__/fixtures-script-files/unsupported-wire-from-supported-namespace/actual.d.ts +5 -0
- package/build/__tests__/fixtures-script-files/unsupported-wire-from-supported-namespace/actual.js +19 -0
- package/build/__tests__/fixtures-script-files/wire-basic/actual.d.ts +7 -0
- package/build/__tests__/fixtures-script-files/wire-basic/actual.js +30 -0
- package/build/__tests__/fixtures-script-files/wire-functions/actual.d.ts +12 -0
- package/build/__tests__/fixtures-script-files/wire-functions/actual.js +46 -0
- package/build/__tests__/fixtures-script-files/wire-imports/actual.d.ts +10 -0
- package/build/__tests__/fixtures-script-files/wire-imports/actual.js +59 -0
- package/build/__tests__/fixtures-source-code/badImportRef.d.ts +4 -0
- package/build/__tests__/fixtures-source-code/badImportRef.js +21 -0
- package/build/__tests__/fixtures-source-code/generalMockSourceCode.d.ts +5 -0
- package/build/__tests__/fixtures-source-code/generalMockSourceCode.js +93 -0
- package/build/__tests__/general-komaci-docs/assorted-template-strings/source.d.ts +9 -0
- package/build/__tests__/general-komaci-docs/assorted-template-strings/source.js +41 -0
- package/build/__tests__/general-komaci-docs/getters-and-compositions-collisions/source.d.ts +6 -0
- package/build/__tests__/general-komaci-docs/getters-and-compositions-collisions/source.js +31 -0
- package/build/__tests__/general-komaci-docs/import-types/source.d.ts +18 -0
- package/build/__tests__/general-komaci-docs/import-types/source.js +104 -0
- package/build/__tests__/general-komaci-docs/import-types/validationStuff.d.ts +18 -0
- package/build/__tests__/general-komaci-docs/import-types/validationStuff.js +63 -0
- package/build/__tests__/general-komaci-docs/template-component/source.d.ts +8 -0
- package/build/__tests__/general-komaci-docs/template-component/source.js +34 -0
- package/build/__tests__/index.spec.d.ts +2 -0
- package/build/__tests__/index.spec.js +124 -0
- package/build/__tests__/komaci-ast-unit.spec.d.ts +2 -0
- package/build/__tests__/komaci-ast-unit.spec.js +628 -0
- package/build/__tests__/komaci-bundle-module.fixtures.spec.d.ts +2 -0
- package/build/__tests__/komaci-bundle-module.fixtures.spec.js +75 -0
- package/build/__tests__/komaci-script-module.fixtures.spec.d.ts +2 -0
- package/build/__tests__/komaci-script-module.fixtures.spec.js +66 -0
- package/build/__tests__/komaci-template-module.fixtures.spec.d.ts +2 -0
- package/build/__tests__/komaci-template-module.fixtures.spec.js +56 -0
- package/build/__tests__/modGenScript.spec.d.ts +2 -0
- package/build/__tests__/modGenScript.spec.js +110 -0
- package/build/__tests__/modGenTemplate.spec.d.ts +2 -0
- package/build/__tests__/modGenTemplate.spec.js +196 -0
- package/build/__tests__/shared.spec.d.ts +2 -0
- package/build/__tests__/shared.spec.js +62 -0
- package/build/__tests__/templateStrings.spec.d.ts +2 -0
- package/build/__tests__/templateStrings.spec.js +130 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +130 -0
- package/build/modGenScript.d.ts +38 -0
- package/build/modGenScript.js +1027 -0
- package/build/modGenTemplate.d.ts +37 -0
- package/build/modGenTemplate.js +402 -0
- package/build/shared.d.ts +170 -0
- package/build/shared.js +588 -0
- package/build/types.d.ts +132 -0
- package/build/types.js +14 -0
- package/package.json +40 -0
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { KomaciDocument } from '@komaci/types';
|
|
3
|
+
import { AstContext } from '@komaci/common-shared';
|
|
4
|
+
export declare type GeneratorInput = {
|
|
5
|
+
moduleInfo: ModuleFileInfo | ModuleBundleInfo;
|
|
6
|
+
options?: GeneratorOptions;
|
|
7
|
+
srcFileMap?: {
|
|
8
|
+
[filename: string]: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare type ModuleInfo = {
|
|
12
|
+
type: string;
|
|
13
|
+
name: string;
|
|
14
|
+
namespace: string;
|
|
15
|
+
};
|
|
16
|
+
export declare type ModuleFileInfo = ModuleInfo & {
|
|
17
|
+
type: 'file';
|
|
18
|
+
fileName: string;
|
|
19
|
+
komaciDoc: KomaciDocument;
|
|
20
|
+
};
|
|
21
|
+
export declare type ModuleBundleInfo = ModuleInfo & {
|
|
22
|
+
type: 'bundle';
|
|
23
|
+
files: {
|
|
24
|
+
[fileName: string]: KomaciDocument;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare type GeneratorOptions = {
|
|
28
|
+
removeUnlinkedNodes?: boolean;
|
|
29
|
+
inlineRelativeImports?: boolean;
|
|
30
|
+
targetModule?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare type GeneratorState = {
|
|
33
|
+
inlineTemplateDoc?: KomaciDocument;
|
|
34
|
+
input: GeneratorInput;
|
|
35
|
+
adgImportSuffix: number;
|
|
36
|
+
importAliasSuffix: number;
|
|
37
|
+
scriptGenState: {
|
|
38
|
+
importRefsMap: {
|
|
39
|
+
[refId: string]: ImportInfo;
|
|
40
|
+
};
|
|
41
|
+
importMetadata?: AstContext['importDeclarations'];
|
|
42
|
+
importInfosForWireAdapter: Set<ImportInfo>;
|
|
43
|
+
requiredFactoryFunctions: Set<t.Identifier>;
|
|
44
|
+
primingAdapterImportDeclarations: t.ImportDeclaration[];
|
|
45
|
+
ast?: t.File;
|
|
46
|
+
};
|
|
47
|
+
templateGenState: {
|
|
48
|
+
importRefsMap: {
|
|
49
|
+
[refId: string]: ImportInfo;
|
|
50
|
+
};
|
|
51
|
+
requiredFactoryFunctions: Set<t.Identifier>;
|
|
52
|
+
refProps: Set<string>;
|
|
53
|
+
};
|
|
54
|
+
iterationContext: string[];
|
|
55
|
+
defaultCompImported: boolean;
|
|
56
|
+
adgNameMap: {
|
|
57
|
+
[index: string]: string;
|
|
58
|
+
};
|
|
59
|
+
isDefaultExportFound: boolean;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Information about an import composed when adding imports to the resolvable module.
|
|
63
|
+
* All information here is uplifted directly from Komaci Document state.
|
|
64
|
+
*
|
|
65
|
+
* NOTE: some of these imports are **INVALID** meaning they come from an unsupported namespace.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export declare type ImportInfo = {
|
|
69
|
+
/** locally generated identifier (i0, i1, etc) represented as the babel identifier obj. if import is bad localName is UNRESOLVED */
|
|
70
|
+
localName: t.Identifier;
|
|
71
|
+
/**
|
|
72
|
+
* component id for if this import maps to a component used in a template
|
|
73
|
+
* this is only managed as part of processTemplateImports
|
|
74
|
+
*/
|
|
75
|
+
componentId?: string;
|
|
76
|
+
/** import path for this import */
|
|
77
|
+
resourceName: string;
|
|
78
|
+
exportName: string | undefined;
|
|
79
|
+
/** enum indicating how the import's export is being used. ex: { wireadapter, getter, wireconfig, initialvalue, composedadg } */
|
|
80
|
+
importUsages: Set<ImportUsageState>;
|
|
81
|
+
/**
|
|
82
|
+
* t.ImportSpecifiers for import.
|
|
83
|
+
* ex: `import { wire1 as i1, wire2 as i2} from "my/resourceName"`.
|
|
84
|
+
* `wire1 as i1` and `wire2 as i2` are the import's specifiers.
|
|
85
|
+
*/
|
|
86
|
+
importSpecifier: t.ImportSpecifier | t.ImportDefaultSpecifier | t.ImportNamespaceSpecifier;
|
|
87
|
+
/** newly formed import statement for resolvable module */
|
|
88
|
+
importDeclaration: t.ImportDeclaration | undefined;
|
|
89
|
+
primingAdapterImportNames?: PrimingAdapterImportNames;
|
|
90
|
+
};
|
|
91
|
+
export declare type ImportRefPropUsed = {
|
|
92
|
+
importRef: string;
|
|
93
|
+
propUsed: boolean;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Names of local imports for Priming Adapters
|
|
97
|
+
*/
|
|
98
|
+
export declare type PrimingAdapterImportNames = {
|
|
99
|
+
primingAdapterDef: PrimingAdapterDefinition;
|
|
100
|
+
adapter: t.Identifier;
|
|
101
|
+
batchAdapter?: t.Identifier;
|
|
102
|
+
reducer?: t.Identifier;
|
|
103
|
+
};
|
|
104
|
+
export declare enum ImportUsageState {
|
|
105
|
+
wireadapter = "wireadapter",
|
|
106
|
+
getter = "getter",
|
|
107
|
+
wireconfig = "wireconfig",
|
|
108
|
+
initialvalue = "initialvalue",
|
|
109
|
+
composedadg = "composedadg",
|
|
110
|
+
parentadg = "parentadg"
|
|
111
|
+
}
|
|
112
|
+
export declare type ImportBinding = {
|
|
113
|
+
importPath: string;
|
|
114
|
+
identifier: string;
|
|
115
|
+
};
|
|
116
|
+
export declare type PrimingAdapterDefinition = {
|
|
117
|
+
prime: ImportBinding;
|
|
118
|
+
batch?: {
|
|
119
|
+
prime: ImportBinding;
|
|
120
|
+
reducer: ImportBinding;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
export declare type GetPrimingAdapter = {
|
|
124
|
+
(importPath: string, identifier: string): PrimingAdapterDefinition | null;
|
|
125
|
+
};
|
|
126
|
+
export declare type WireAdaptersMapping = {
|
|
127
|
+
[importPath: string]: {
|
|
128
|
+
[identifier: string]: PrimingAdapterDefinition;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=types.d.ts.map
|
package/build/types.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImportUsageState = void 0;
|
|
4
|
+
// enum representing the different states of the way an Import is used
|
|
5
|
+
var ImportUsageState;
|
|
6
|
+
(function (ImportUsageState) {
|
|
7
|
+
ImportUsageState["wireadapter"] = "wireadapter";
|
|
8
|
+
ImportUsageState["getter"] = "getter";
|
|
9
|
+
ImportUsageState["wireconfig"] = "wireconfig";
|
|
10
|
+
ImportUsageState["initialvalue"] = "initialvalue";
|
|
11
|
+
ImportUsageState["composedadg"] = "composedadg";
|
|
12
|
+
ImportUsageState["parentadg"] = "parentadg";
|
|
13
|
+
})(ImportUsageState = exports.ImportUsageState || (exports.ImportUsageState = {}));
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@komaci/esm-generator",
|
|
3
|
+
"version": "240.1.3",
|
|
4
|
+
"description": "Komaci generator for ADG ES modules",
|
|
5
|
+
"homepage": "https://komaci.dev/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/salesforce/komaci.git",
|
|
9
|
+
"directory": "packages/@komaci/esm-generator"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/salesforce/komaci/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"type": "commonjs",
|
|
19
|
+
"types": "build/index.d.ts",
|
|
20
|
+
"main": "build/index.js",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -b"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"build/**/*.js",
|
|
26
|
+
"build/**/*.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@babel/core": "^7.9.0",
|
|
30
|
+
"@babel/generator": "^7.9.0",
|
|
31
|
+
"@komaci/common-shared": "240.1.3",
|
|
32
|
+
"@komaci/static-analyzer": "240.1.3",
|
|
33
|
+
"o11y": "^240.7.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@babel/types": "^7.9.0",
|
|
37
|
+
"@komaci/types": "240.1.3",
|
|
38
|
+
"@lwc-platform/sfdc-lwc-compiler": "^2.18.0-240.2"
|
|
39
|
+
}
|
|
40
|
+
}
|