@knapsack/renderer-webpack-base 4.69.12--canary.4820.6d71796.0 → 4.69.12--canary.4821.8709676.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  export * from './renderer-webpack-client.mjs';
2
- export type { KsJsImport, KsJsImportInfo, RendererMetaBase } from '../types.js';
2
+ export type { KsJsImportInfo, RendererMetaBase } from '../types.js';
3
3
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/client/index.mts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/client/index.mts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,78 +1,20 @@
1
- import { KsRendererClientMeta } from '@knapsack/types';
2
- import { RendererMetaBase } from '../types.js';
3
- type ImportedModules<ExportedComponentType> = {
4
- [id: string]: () => Promise<EsModuleObject<ExportedComponentType>>;
5
- };
6
- /** The result of `import`-ing a module */
7
- type EsModuleObject<ExportedType = unknown> = {
8
- default?: ExportedType;
9
- [key: string]: ExportedType;
10
- };
11
- type GetKsJsImportParam = {
12
- type: 'pattern-template';
13
- patternId: string;
14
- templateId: string;
15
- } | {
16
- type: 'pattern-template-demo';
17
- patternId: string;
18
- templateId: string;
19
- demoId: string;
20
- } | {
21
- type: 'extra';
22
- name: string;
23
- };
24
- type GetKsJsImportPatternParam = {
25
- patternId: string;
26
- templateId: string;
27
- demoId?: string;
28
- };
29
- /**
30
- * This is `window.knapsack` inside the renderer client: the iframe container for renderer components
31
- */
32
- export interface KsRendererClientGlobal<ExportedComponentType = unknown, RendererMetaType extends RendererMetaBase = RendererMetaBase, RendererMethods extends Record<string, unknown> = Record<string, unknown>> {
33
- typeName: 'KsRendererClientGlobal';
34
- importedModules: ImportedModules<ExportedComponentType>;
35
- rendererMeta: RendererMetaType;
36
- rendererMethods: RendererMethods;
37
- meta: KsRendererClientMeta;
38
- getImport: (opt: GetKsJsImportParam) => Promise<{
39
- name: string;
40
- /** Most likely a component */
41
- value: ExportedComponentType;
42
- }>;
43
- getImports: (imports: GetKsJsImportParam[]) => Promise<{
44
- [importName: string]: ExportedComponentType;
45
- }>;
46
- getPatternImport: (opt: GetKsJsImportPatternParam) => Promise<{
47
- name: string;
48
- /** Most likely a component */
49
- value: ExportedComponentType;
50
- }>;
51
- getExtraImport: (opt: {
52
- name: string;
53
- }) => Promise<{
54
- name: string;
55
- /** Most likely a component */
56
- value: ExportedComponentType;
57
- }>;
58
- getAllImports: (opt: {
59
- patterns: GetKsJsImportPatternParam[];
60
- extras?: {
61
- name: string;
62
- }[];
63
- }) => Promise<{
64
- [importName: string]: ExportedComponentType;
65
- }>;
66
- }
67
- export declare function getKsRendererClientGlobal<ExportedComponentType, RendererMetaType extends RendererMetaBase,
1
+ import type { KsJsImportInfo, RendererMetaBase, KsRendererClientUtils } from '../types.js';
2
+ export declare function getKsRendererClientUtils<ExportedComponentType, RendererMetaType extends RendererMetaBase,
68
3
  /**
69
4
  * Any extra properties or methods placed on the window.knapsack object by the renderer in a `<script>` tag
70
5
  */
71
- RendererMethods extends Record<string, unknown>>({ rendererMetaScriptTagId }: {
6
+ RendererMethods extends Record<string, unknown>>({ rendererMetaScriptTagId, assertImport, assertExtraImport, }: {
72
7
  rendererMetaScriptTagId: string;
73
- }): KsRendererClientGlobal<ExportedComponentType, RendererMetaType, RendererMethods>;
8
+ assertImport?: (opt: {
9
+ imp: unknown;
10
+ importInfo: KsJsImportInfo;
11
+ }) => void;
12
+ assertExtraImport?: (opt: {
13
+ imp: unknown;
14
+ importInfo: KsJsImportInfo;
15
+ }) => void;
16
+ }): KsRendererClientUtils<ExportedComponentType, RendererMetaType, RendererMethods>;
74
17
  export declare function showUiToastMsg({ msg }: {
75
18
  msg: string;
76
19
  }): void;
77
- export {};
78
20
  //# sourceMappingURL=renderer-webpack-client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer-webpack-client.d.mts","sourceRoot":"","sources":["../../src/client/renderer-webpack-client.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAGrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAc,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAW3D,KAAK,eAAe,CAAC,qBAAqB,IAAI;IAC5C,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC;CACpE,CAAC;AAEF,0CAA0C;AAC1C,KAAK,cAAc,CAAC,YAAY,GAAG,OAAO,IAAI;IAC5C,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B,CAAC;AAEF,KAAK,kBAAkB,GACnB;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,GACD;IACE,IAAI,EAAE,uBAAuB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB,CACrC,qBAAqB,GAAG,OAAO,EAC/B,gBAAgB,SAAS,gBAAgB,GAAG,gBAAgB,EAC5D,eAAe,SAAS,MAAM,CAAC,MAAM,E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AM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/C,EAAE,uBAAuB,EAAE,EAAE;IAAE,uBAAuB,EAAE,MAAM,CAAA;CAAE,GAyJ7C,sBAAsB,CACvC,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,CAChB,CACF;AAED,wBAAgB,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,QAYtD"}
1
+ {"version":3,"file":"renderer-webpack-client.d.mts","sourceRoot":"","sources":["../../src/client/renderer-webpack-client.mts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EAGtB,MAAM,aAAa,CAAC;AAmFrB,wBAAgB,wBAAwB,CACtC,qBAAqB,EACrB,gBAAgB,SAAS,gBAAgB;AACzC;;GAEG;AACH,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/C,EACA,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,GAClB,EAAE;IACD,uBAAuB,EAAE,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,cAAc,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3E,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE;QACxB,GAAG,EAAE,OAAO,CAAC;QACb,UAAU,EAAE,cAAc,CAAC;KAC5B,KAAK,IAAI,CAAC;CACZ,GAsFoB,qBAAqB,CACtC,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,CAChB,CACF;AAED,wBAAgB,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,QAYtD"}
@@ -4,19 +4,57 @@ const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'u
4
4
  if (!isBrowser) {
5
5
  throw new Error('Cannot get KsRendererClientGlobal in a non-browser environment');
6
6
  }
7
- const createErrorName = (opt) => {
8
- switch (opt.type) {
9
- case 'extra':
10
- return `Extra "${opt.name}"`;
11
- case 'pattern-template':
12
- return `pattern "${opt.patternId}", template "${opt.templateId}"`;
13
- case 'pattern-template-demo':
14
- return `pattern "${opt.patternId}", template "${opt.templateId}", demo "${opt.demoId}"`;
15
- default:
16
- return JSON.stringify(opt);
7
+ function addImportToAllImports({ importInfo, mod, allImports, assertImport, }) {
8
+ const addImport = ({ component, name, }) => {
9
+ if (allImports[name]) {
10
+ throw new Error(`Duplicate import name: "${name}"`);
11
+ }
12
+ if (typeof component !== 'function') {
13
+ throw new Error(`Import "${name}" is not a component, its "typeof" should be "function" but is "${typeof component}"`);
14
+ }
15
+ assertImport?.({ imp: component, importInfo });
16
+ // should this get checked for correct type?
17
+ allImports[name] = component;
18
+ };
19
+ switch (importInfo.type) {
20
+ case 'named': {
21
+ const { name } = importInfo;
22
+ const component = mod[name];
23
+ if (!component) {
24
+ throw new Error(`No named export, ${name}, found for "${importInfo.path}"`);
25
+ }
26
+ addImport({ component, name });
27
+ break;
28
+ }
29
+ case 'default': {
30
+ const { name } = importInfo;
31
+ if (mod.default) {
32
+ addImport({ component: mod.default, name });
33
+ }
34
+ else if (typeof mod === 'function') {
35
+ addImport({ component: mod, name });
36
+ }
37
+ else {
38
+ throw new Error(`No default export found for "${importInfo.path}"`);
39
+ }
40
+ break;
41
+ }
42
+ case 'renamed': {
43
+ const { name, originalName } = importInfo;
44
+ const item = mod[originalName];
45
+ if (!item) {
46
+ throw new Error(`No renamed export, ${originalName}, found for "${importInfo.path}"`);
47
+ }
48
+ addImport({ component: item, name });
49
+ break;
50
+ }
51
+ default: {
52
+ const _exhaustiveCheck = importInfo;
53
+ throw new Error(`Unknown import type: "${JSON.stringify(importInfo)}"`);
54
+ }
17
55
  }
18
- };
19
- export function getKsRendererClientGlobal({ rendererMetaScriptTagId }) {
56
+ }
57
+ export function getKsRendererClientUtils({ rendererMetaScriptTagId, assertImport, assertExtraImport, }) {
20
58
  if (!isObject(window?.knapsack)) {
21
59
  throw new Error(`Could not find "window.knapsack"`);
22
60
  }
@@ -26,118 +64,58 @@ export function getKsRendererClientGlobal({ rendererMetaScriptTagId }) {
26
64
  }
27
65
  const meta = getJsonFromScriptTag(ksRendererClientMetaId);
28
66
  const rendererMeta = getJsonFromScriptTag(rendererMetaScriptTagId);
29
- const findImport = (opt) => {
30
- return rendererMeta.neededImports.find((imp) => {
31
- if (imp.type === 'pattern-template' && opt.type === 'pattern-template') {
32
- return (opt.patternId === imp.patternId && opt.templateId === imp.templateId);
33
- }
34
- if (imp.type === 'pattern-template-demo' &&
35
- opt.type === 'pattern-template-demo') {
36
- return (opt.patternId === imp.patternId &&
37
- opt.templateId === imp.templateId &&
38
- opt.demoId === imp.demoId);
67
+ const { neededImportsByPath, extraImports } = rendererMeta;
68
+ const getNeededImports = async () => {
69
+ const neededImports = {};
70
+ await Promise.all(Object.entries(neededImportsByPath).map(async ([path, importInfos]) => {
71
+ const getModule = importedModules[path];
72
+ if (!getModule) {
73
+ throw new Error(`No "${path}" module found for "${path}"`);
39
74
  }
40
- if (imp.type === 'extra' && opt.type === 'extra') {
41
- return opt.name === imp.importInfo.name;
75
+ const mod = await getModule();
76
+ if (!mod) {
77
+ throw new Error(`No module contents found for "${path}"`);
42
78
  }
43
- return false;
44
- });
79
+ importInfos.forEach((importInfo) => {
80
+ addImportToAllImports({
81
+ importInfo,
82
+ mod,
83
+ allImports: neededImports,
84
+ assertImport,
85
+ });
86
+ });
87
+ }));
88
+ return neededImports;
45
89
  };
46
- const getImport = async (opt) => {
47
- const theImport = findImport(opt);
48
- if (!theImport) {
49
- throw new Error(`No import found for ${createErrorName(opt)}`);
50
- }
51
- const { importInfo } = theImport;
52
- const getModule = importedModules[importInfo.path];
53
- if (!getModule) {
54
- throw new Error(`No "${importInfo.path}" module found for ${JSON.stringify(opt)}`);
55
- }
56
- const mod = await getModule();
57
- if (!mod) {
58
- throw new Error(`No module found for ${JSON.stringify(opt)}`);
59
- }
60
- switch (importInfo.type) {
61
- case 'all':
62
- return {
63
- value: mod,
64
- name: importInfo.name,
65
- };
66
- case 'default': {
67
- const item = mod.default;
68
- if (!item) {
69
- throw new Error(`No default export found for ${JSON.stringify(opt)}`);
70
- }
71
- return {
72
- value: item,
73
- name: importInfo.name,
74
- };
75
- }
76
- case 'named': {
77
- const { name } = importInfo;
78
- const item = mod[name];
79
- if (!item) {
80
- throw new Error(`No named export, ${name}, found for ${JSON.stringify(opt)}`);
81
- }
82
- return {
83
- value: item,
84
- name,
85
- };
90
+ const getExtraImports = async () => {
91
+ const theExtraImports = {};
92
+ await Promise.all(Object.entries(extraImports).map(async ([name, importInfo]) => {
93
+ const getModule = importedModules[importInfo.path];
94
+ if (!getModule) {
95
+ throw new Error(`No "${importInfo.path}" module found for "${name}"`);
86
96
  }
87
- default: {
88
- throw new Error(`Unknown import type`);
97
+ const mod = await getModule();
98
+ if (!mod) {
99
+ throw new Error(`No module found for "${importInfo.path}"`);
89
100
  }
90
- }
91
- };
92
- const getPatternImport = async ({ patternId, templateId, demoId, }) => {
93
- if (demoId) {
94
- return getImport({
95
- type: 'pattern-template-demo',
96
- patternId,
97
- templateId,
98
- demoId,
101
+ addImportToAllImports({
102
+ importInfo,
103
+ mod,
104
+ allImports: theExtraImports,
105
+ assertImport: assertExtraImport,
99
106
  });
100
- }
101
- return getImport({
102
- type: 'pattern-template',
103
- patternId,
104
- templateId,
105
- });
107
+ }));
108
+ return theExtraImports;
106
109
  };
107
- const getExtraImport = async ({ name, }) => getImport({ type: 'extra', name });
108
110
  const knapsack = {
109
- typeName: 'KsRendererClientGlobal',
110
111
  importedModules,
111
112
  meta,
112
113
  rendererMeta,
113
114
  rendererMethods,
114
- getImport,
115
- getPatternImport,
116
- getExtraImport,
117
- getAllImports: async ({ patterns, extras = [] }) => {
118
- const imported = await Promise.all([
119
- ...patterns.map(getPatternImport),
120
- ...extras.map(getExtraImport),
121
- ]);
122
- return imported.reduce((cur, { name, value }) => {
123
- if (cur[name]) {
124
- throw new Error(`Duplicate import name: ${name}`);
125
- }
126
- cur[name] = value;
127
- return cur;
128
- }, {});
129
- },
130
- getImports: async (importsToGet) => {
131
- const imported = await Promise.all(importsToGet.map(getImport));
132
- return imported.reduce((cur, { name, value }) => {
133
- if (cur[name]) {
134
- throw new Error(`Duplicate import name: ${name}`);
135
- }
136
- cur[name] = value;
137
- return cur;
138
- }, {});
139
- },
115
+ getNeededImports,
116
+ getExtraImports,
140
117
  };
118
+ window.knapsack = knapsack;
141
119
  return knapsack;
142
120
  }
143
121
  export function showUiToastMsg({ msg }) {
@@ -1 +1 @@
1
- {"version":3,"file":"renderer-webpack-client.mjs","sourceRoot":"","sources":["../../src/client/renderer-webpack-client.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,sBAAsB,GAEvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAE1E,IAAI,CAAC,SAAS,EAAE,CAAC;IACf,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;AACJ,CAAC;AA0ED,MAAM,eAAe,GAAG,CAAC,GAAuB,EAAU,EAAE;IAC1D,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,UAAU,GAAG,CAAC,IAAI,GAAG,CAAC;QAC/B,KAAK,kBAAkB;YACrB,OAAO,YAAY,GAAG,CAAC,SAAS,gBAAgB,GAAG,CAAC,UAAU,GAAG,CAAC;QACpE,KAAK,uBAAuB;YAC1B,OAAO,YAAY,GAAG,CAAC,SAAS,gBAAgB,GAAG,CAAC,UAAU,YAAY,GAAG,CAAC,MAAM,GAAG,CAAC;QAC1F;YACE,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC,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AE,OAAO;IAC7B,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;QACE,gGAAgG;QAChG,IAAI,EAAE,4BAA4B;QAClC,GAAG;QACH,YAAY,EAAE,MAAM;KACS,EAC/B,GAAG,CACJ,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"renderer-webpack-client.mjs","sourceRoot":"","sources":["../../src/client/renderer-webpack-client.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,sBAAsB,GAEvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AASnD,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAE1E,IAAI,CAAC,SAAS,EAAE,CAAC;IACf,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAwB,EACpD,UAAU,EACV,GAAG,EACH,UAAU,EACV,YAAY,GAMb;IACC,MAAM,SAAS,GAAG,CAAC,EACjB,SAAS,EACT,IAAI,GAIL,EAAE,EAAE;QACH,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,GAAG,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,mEAAmE,OAAO,SAAS,GAAG,CACtG,CAAC;QACJ,CAAC;QACD,YAAY,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;QAC/C,4CAA4C;QAC5C,UAAU,CAAC,IAAI,CAAC,GAAG,SAAkC,CAAC;IACxD,CAAC,CAAC;IAEF,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;QACxB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,EAAE,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IAEpC,OAAO,QAIN,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAE,GAAG,EAAmB;IACrD,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;IACjD,IAAI,CAAC,eAAe;QAAE,OAAO;IAC7B,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;QACE,gGAAgG;QAChG,IAAI,EAAE,4BAA4B;QAClC,GAAG;QACH,YAAY,EAAE,MAAM;KACS,EAC/B,GAAG,CACJ,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './renderer-webpack-base';
2
2
  export * from './types';
3
+ export * from './utils';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./renderer-webpack-base"), exports);
18
18
  __exportStar(require("./types"), exports);
19
+ __exportStar(require("./utils"), exports);
19
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,0CAAwB;AACxB,0CAAwB"}
@@ -1,49 +1,28 @@
1
1
  import { RendererId } from '@knapsack/types';
2
- import { RendererBase, type Renderable } from '@knapsack/app/renderers';
2
+ import { CliLifecycle, RendererBase, type Renderable } from '@knapsack/app/renderers';
3
3
  import { Configuration as WebpackConfig } from 'webpack';
4
- import { KsJsImport } from './types';
5
- export declare abstract class RendererWebpackBase extends RendererBase {
4
+ import { KsJsImportInfo, KsJsImportMap } from './types';
5
+ export declare abstract class RendererWebpackBase extends RendererBase implements CliLifecycle {
6
6
  #private;
7
7
  private webpack;
8
8
  private webpackConfig;
9
9
  private webpackCompiler;
10
10
  private extraScripts;
11
11
  private entryFilePath;
12
- constructor({ id, extension, language, webpackConfig, extraScripts, }: {
12
+ constructor({ id, language, webpackConfig, extraScripts, codeSrcs, }: {
13
13
  id: RendererId;
14
- extension: string;
15
14
  language: string;
16
15
  webpackConfig?: WebpackConfig;
17
16
  extraScripts?: string[];
17
+ codeSrcs: string[];
18
18
  });
19
- init(opt: Parameters<RendererBase['init']>[0]): Promise<void>;
20
- hydrate(opt: Parameters<RendererBase['hydrate']>[0]): Promise<void>;
21
- /**
22
- * @see {getJsImport} for types "pattern-template" and "pattern-template-demo"
23
- * @see {getJsImportExtra} for type "extra"
24
- */
25
- getJsImports(): KsJsImport[];
26
- /**
27
- * @see {getJsImports} for all
28
- * @see {getJsImportExtra} for type "extra"
29
- */
30
- getJsImport({ patternId, templateId, demoId, }: {
31
- patternId: string;
32
- templateId: string;
33
- demoId?: string;
34
- }): Exclude<KsJsImport, {
35
- type: 'extra';
36
- }>;
37
- /**
38
- * @see {getJsImports} for all
39
- * @see {getJsImport} for types "pattern-template" and "pattern-template-demo"
40
- */
41
- getJsImportExtra({ name, }: {
42
- name: string;
43
- }): Extract<KsJsImport, {
44
- type: 'extra';
45
- }>;
46
- private writeKsEntryFile;
19
+ setConfig: RendererBase['setConfig'];
20
+ hydrate: CliLifecycle['hydrate'];
21
+ addUniqueValueToImportMap({ importMap, path: originalPath, alias, }: {
22
+ importMap: KsJsImportMap;
23
+ path: string;
24
+ alias: string;
25
+ }): Promise<KsJsImportInfo>;
47
26
  get webpackVersion(): {
48
27
  majorVersion: number;
49
28
  isWebpack4: boolean;
@@ -51,43 +30,29 @@ export declare abstract class RendererWebpackBase extends RendererBase {
51
30
  version: string;
52
31
  };
53
32
  createWebpackConfig(): WebpackConfig;
54
- private prepWebpack;
55
33
  /**
56
34
  * Every asset file path needed in `<script>` tags
57
35
  */
58
36
  getWebpackAssetPaths(): string[];
59
- createHtmlTagsForAssetPaths({ assets, scriptTagsAreAsync, }: {
37
+ static createHtmlTagsForAssetPaths({ assets, scriptTagsAreAsync, }: {
60
38
  assets: string[];
61
39
  scriptTagsAreAsync: boolean;
62
40
  }): string;
63
- build(): Promise<void>;
41
+ build: CliLifecycle['build'];
64
42
  /** Starts a webpack watch, returns an object with a `.close()` method for shutting down */
65
43
  private startWebpackWatch;
66
- watch(_opt: Parameters<RendererBase['watch']>[0]): Promise<void>;
44
+ watch(): Promise<void>;
67
45
  onChange(): void;
68
- abstract getUsageAndImports(_opt: Parameters<Renderable['render']>[0]): Promise<{
46
+ abstract getUsageAndImports(_opt: Parameters<Renderable['render']>[0] & {
47
+ importMap: KsJsImportMap;
48
+ }): Promise<{
69
49
  usage: string;
70
- imports: KsJsImport[];
50
+ importMap: KsJsImportMap;
71
51
  }>;
72
52
  getUsage: Renderable['getUsage'];
73
- makeKsJsImportsUnique({ imports }: {
74
- imports: KsJsImport[];
75
- }): {
76
- imports: KsJsImport[];
77
- nameCollisions: string[];
78
- /** all declared vars */
79
- declaredVars: string[];
80
- isDeclaredVarsUnique: boolean;
81
- };
82
- createJsImportCodeBlock({ imports: nonUniqueImports, }: {
83
- imports: KsJsImport[];
84
- }): {
85
- code: string;
86
- /** all declared vars */
87
- declaredVars: string[];
88
- isDeclaredVarsUnique: boolean;
89
- nameCollisions: string[];
90
- };
53
+ static createJsImportCodeBlock({ importMap, }: {
54
+ importMap: KsJsImportMap;
55
+ }): string;
91
56
  }
92
- export type Renderer = Renderable & RendererWebpackBase;
57
+ export type Renderer = Renderable & RendererWebpackBase & CliLifecycle;
93
58
  //# sourceMappingURL=renderer-webpack-base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer-webpack-base.d.ts","sourceRoot":"","sources":["../src/renderer-webpack-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAgBxE,OAAgB,EAEd,aAAa,IAAI,aAAa,EAG/B,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA8BrC,8BAAsB,mBAAoB,SAAQ,YAAY;;IAC5D,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,eAAe,CAAkB;IAGzC,OAAO,CAAC,YAAY,CAAW;IAC/B,OAAO,CAAC,aAAa,CAAS;gBAIlB,EACV,EAAE,EACF,SAAS,EACT,QAAQ,EACR,aAAkB,EAClB,YAAiB,GAClB,EAAE;QACD,EAAE,EAAE,UAAU,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;KACzB;IAoBc,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB7D,OAAO,CACpB,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1C,OAAO,CAAC,IAAI,CAAC;IAehB;;;OAGG;IACH,YAAY,IAAI,UAAU,EAAE;IAkE5B;;;OAGG;IACH,WAAW,CAAC,EACV,SAAS,EACT,UAAU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Get = (this && this.__classPrivateFieldGet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _RendererWebpackBase_webpackAssetsPaths, _RendererWebpackBase_webpackAssetsPathsFilePath, _RendererWebpackBase_entryString;
16
+ var _RendererWebpackBase_instances, _RendererWebpackBase_webpackAssetsPaths, _RendererWebpackBase_webpackAssetsPathsFilePath, _RendererWebpackBase_entryString, _RendererWebpackBase_writeKsEntryFile, _RendererWebpackBase_prepWebpack;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.RendererWebpackBase = void 0;
19
19
  const app_1 = require("@knapsack/app");
@@ -46,18 +46,69 @@ function normalizeAliases(aliases) {
46
46
  }));
47
47
  }
48
48
  class RendererWebpackBase extends renderers_1.RendererBase {
49
- constructor({ id, extension, language, webpackConfig = {}, extraScripts = [], }) {
49
+ constructor({ id, language, webpackConfig = {}, extraScripts = [], codeSrcs, }) {
50
50
  super({
51
51
  id,
52
- extension,
53
52
  language,
53
+ codeSrcs,
54
54
  });
55
+ _RendererWebpackBase_instances.add(this);
55
56
  _RendererWebpackBase_webpackAssetsPaths.set(this, void 0);
56
57
  _RendererWebpackBase_webpackAssetsPathsFilePath.set(this, void 0);
57
58
  /** Last written value of `getEntryString` - used for preventing file writes */
58
59
  _RendererWebpackBase_entryString.set(this, void 0);
60
+ this.setConfig = (opt) => {
61
+ super.setConfig(opt);
62
+ this.publicPath = `/${(0, path_1.relative)(this.cacheDir, this.outputDir)}/`;
63
+ __classPrivateFieldSet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, (0, path_1.join)(this.outputDir, 'webpack-asset-paths.json'), "f");
64
+ this.entryFilePath = (0, path_1.join)(this.outputDir, 'ks-pattern-import-global-setup.js');
65
+ };
66
+ this.hydrate = async () => {
67
+ try {
68
+ __classPrivateFieldSet(this, _RendererWebpackBase_webpackAssetsPaths, await (0, file_utils_1.readJSON)(__classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, "f")), "f");
69
+ }
70
+ catch (e) {
71
+ throw new Error(`It looks like 'knapsack build' was not ran before 'knapsack serve' - not able to find ${__classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, "f")}`);
72
+ }
73
+ };
74
+ this.build = async () => {
75
+ app_1.log.info('Building with Webpack...', null, this.logPrefix);
76
+ return new Promise((resolve, reject) => {
77
+ __classPrivateFieldGet(this, _RendererWebpackBase_instances, "m", _RendererWebpackBase_prepWebpack).call(this);
78
+ this.webpackCompiler.run(async (err, stats) => {
79
+ if (err) {
80
+ console.log();
81
+ console.error(err);
82
+ console.log();
83
+ app_1.log.error(`An error occured while building your components with Webpack. Please review above messages`, null, this.logPrefix);
84
+ reject();
85
+ return;
86
+ }
87
+ if (stats?.hasErrors?.()) {
88
+ console.log();
89
+ console.error(stats.toString());
90
+ console.log();
91
+ app_1.log.error(`An error occured while building your components with Webpack. Please review above messages`, null, this.logPrefix);
92
+ reject();
93
+ return;
94
+ }
95
+ /**
96
+ * Writing out this info to a file so that the `hydrate` step can read it and get it back in-memory
97
+ */
98
+ await (0, file_utils_1.writeJSON)({
99
+ path: __classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, "f"),
100
+ contents: __classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPaths, "f"),
101
+ });
102
+ app_1.log.info('Webpack built', null, this.logPrefix);
103
+ resolve();
104
+ });
105
+ });
106
+ };
59
107
  this.getUsage = async (opt) => {
60
- const { usage } = await this.getUsageAndImports(opt);
108
+ const { usage } = await this.getUsageAndImports({
109
+ ...opt,
110
+ importMap: new Map(),
111
+ });
61
112
  return usage;
62
113
  };
63
114
  this.webpack = webpack_1.default;
@@ -73,147 +124,76 @@ class RendererWebpackBase extends renderers_1.RendererBase {
73
124
  this.extraScripts = extraScripts;
74
125
  __classPrivateFieldSet(this, _RendererWebpackBase_entryString, '', "f");
75
126
  }
76
- async init(opt) {
77
- await super.init(opt);
78
- app_1.log.info(`Using WebPack v${this.webpackVersion.majorVersion}`, null, this.id);
79
- this.publicPath = `/${(0, path_1.relative)(this.cacheDir, this.outputDir)}/`;
80
- __classPrivateFieldSet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, (0, path_1.join)(this.outputDir, 'webpack-asset-paths.json'), "f");
81
- this.entryFilePath = (0, path_1.join)(this.outputDir, 'ks-pattern-import-global-setup.js');
82
- }
83
- async hydrate(opt) {
84
- await super.hydrate(opt);
85
- try {
86
- __classPrivateFieldSet(this, _RendererWebpackBase_webpackAssetsPaths, await (0, file_utils_1.readJSON)(__classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, "f")), "f");
127
+ async addUniqueValueToImportMap({ importMap, path: originalPath, alias, }) {
128
+ const { type, absolutePath } = await this.resolvePath(originalPath);
129
+ const path = type === 'package' ? originalPath : absolutePath;
130
+ const isDefaultExport = !alias || alias === 'default';
131
+ let preChangedName = alias;
132
+ if (isDefaultExport) {
133
+ preChangedName = (0, path_1.parse)(path).name;
87
134
  }
88
- catch (e) {
89
- throw new Error(`It looks like 'knapsack build' was not ran before 'knapsack serve' - not able to find ${__classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, "f")}`);
135
+ let name = this.changeCase(preChangedName);
136
+ const prior = importMap.get(name);
137
+ if (prior && prior.path === path) {
138
+ switch (prior.type) {
139
+ case 'default': {
140
+ if (isDefaultExport)
141
+ return prior;
142
+ break;
143
+ }
144
+ case 'named': {
145
+ if (prior.name === name)
146
+ return prior;
147
+ break;
148
+ }
149
+ case 'renamed': {
150
+ if (prior.originalName === alias)
151
+ return prior;
152
+ break;
153
+ }
154
+ default: {
155
+ throw new Error(`Unknown import type: ${JSON.stringify(prior)}`);
156
+ }
157
+ }
90
158
  }
91
- }
92
- /**
93
- * @see {getJsImport} for types "pattern-template" and "pattern-template-demo"
94
- * @see {getJsImportExtra} for type "extra"
95
- */
96
- getJsImports() {
97
- const { allTemplates, allTemplateDemos } = this.getMyTemplates();
98
- return [
99
- ...allTemplates.map(({ patternId, templateId, alias, path }) => {
100
- const { type, absolutePath, originalPath } = this.patterns.getTemplatePath({
101
- patternId,
102
- templateId,
103
- });
104
- const hasSingleTemplate = allTemplates.filter((t) => t.patternId === patternId).length === 1;
105
- const importPath = type === 'package' ? originalPath : absolutePath;
106
- return {
107
- type: 'pattern-template',
108
- patternId,
109
- templateId,
110
- importInfo: alias
111
- ? {
112
- type: 'named',
113
- name: alias,
114
- path: importPath,
115
- }
116
- : {
117
- type: 'default',
118
- path: importPath,
119
- name: this.changeCase(hasSingleTemplate
120
- ? patternId
121
- : `${patternId}-${templateId}`),
122
- },
123
- };
124
- }),
125
- ...allTemplateDemos.map(({ patternId, templateId, demoId, alias, path }) => {
126
- const { type, absolutePath, originalPath } = this.patterns.getTemplatePath({
127
- patternId,
128
- templateId,
129
- demoId,
159
+ const isUniqueName = !importMap.has(name);
160
+ if (isUniqueName) {
161
+ if (isDefaultExport) {
162
+ // unique & default import
163
+ importMap.set(name, {
164
+ type: 'default',
165
+ name,
166
+ path,
130
167
  });
131
- const importPath = type === 'package' ? originalPath : absolutePath;
132
- return {
133
- type: 'pattern-template-demo',
134
- patternId,
135
- templateId,
136
- demoId,
137
- importInfo: alias
138
- ? {
139
- type: 'named',
140
- name: alias,
141
- path: importPath,
142
- }
143
- : {
144
- type: 'default',
145
- path: importPath,
146
- name: this.changeCase(`${patternId}-${templateId}-${demoId}`),
147
- },
148
- };
149
- }),
150
- ];
151
- }
152
- /**
153
- * @see {getJsImports} for all
154
- * @see {getJsImportExtra} for type "extra"
155
- */
156
- getJsImport({ patternId, templateId, demoId, }) {
157
- const result = this.getJsImports()
158
- .filter((imp) => {
159
- return demoId
160
- ? imp.type === 'pattern-template-demo'
161
- : imp.type === 'pattern-template';
162
- })
163
- .find((imp) => {
164
- switch (imp.type) {
165
- case 'extra':
166
- return false;
167
- case 'pattern-template':
168
- return imp.patternId === patternId && imp.templateId === templateId;
169
- case 'pattern-template-demo':
170
- return (imp.patternId === patternId &&
171
- imp.templateId === templateId &&
172
- imp.demoId === demoId);
173
- default:
174
- return (0, utils_1.expectNever)(imp);
168
+ return importMap.get(name);
175
169
  }
176
- });
177
- if (!result) {
178
- throw new Error(`Could not find import for patternId: ${patternId} templateId: ${templateId} demoId: ${demoId}`);
179
- }
180
- if (result.type === 'extra') {
181
- throw new Error('getJsImport: type "extra" not expected');
182
- }
183
- return result;
184
- }
185
- /**
186
- * @see {getJsImports} for all
187
- * @see {getJsImport} for types "pattern-template" and "pattern-template-demo"
188
- */
189
- getJsImportExtra({ name, }) {
190
- const result = this.getJsImports().find((imp) => {
191
- if (imp.type !== 'extra')
192
- return false;
193
- return imp.importInfo.name === name;
194
- });
195
- if (!result) {
196
- throw new Error(`Could not find import for name: ${name}`);
197
- }
198
- if (result.type !== 'extra') {
199
- throw new Error('getJsImportExtra: type "extra" expected');
170
+ // unique & named import
171
+ importMap.set(name, {
172
+ type: 'named',
173
+ name,
174
+ path,
175
+ });
176
+ return importMap.get(name);
200
177
  }
201
- return result;
202
- }
203
- writeKsEntryFile() {
204
- if (!this.entryFilePath) {
205
- throw new Error('Cannot write entry file because entryFilePath is not set');
178
+ // name is not unique so let's make it unique
179
+ name = this.changeCase(`${name} ${(0, utils_1.makeShortId)()}`);
180
+ if (isDefaultExport) {
181
+ // not unique & default import
182
+ importMap.set(name, {
183
+ type: 'default',
184
+ name, // ok since `name` has been made unique
185
+ path,
186
+ });
187
+ return importMap.get(name);
206
188
  }
207
- const imports = this.getJsImports();
208
- const contents = (0, create_js_import_entry_1.getEntryString)(new Set(imports.map((imp) => imp.importInfo.path)));
209
- if (contents === __classPrivateFieldGet(this, _RendererWebpackBase_entryString, "f"))
210
- return;
211
- __classPrivateFieldSet(this, _RendererWebpackBase_entryString, contents, "f");
212
- (0, file_utils_1.writeFormattedFileSync)({
213
- contents,
214
- path: this.entryFilePath,
189
+ // non-unique named import, so we do `import { originalName as name } from path`
190
+ importMap.set(name, {
191
+ type: 'renamed',
192
+ name,
193
+ path,
194
+ originalName: alias,
215
195
  });
216
- app_1.log.verbose(`Wrote entry file to ${this.entryFilePath}`, null, this.id);
196
+ return importMap.get(name);
217
197
  }
218
198
  get webpackVersion() {
219
199
  const majorVersion = parseInt(this.webpack.version.split('.')[0], 10);
@@ -307,20 +287,13 @@ class RendererWebpackBase extends renderers_1.RendererBase {
307
287
  };
308
288
  return newWebpackConfig;
309
289
  }
310
- prepWebpack() {
311
- this.writeKsEntryFile();
312
- const webpackConfig = this.createWebpackConfig();
313
- app_1.log.verbose(`Webpack Config module.rules`, webpackConfig.module.rules, this.logPrefix);
314
- // should this look for an already running webpack instance to possibly shut it down first? would only be from watch
315
- this.webpackCompiler = this.webpack(webpackConfig);
316
- }
317
290
  /**
318
291
  * Every asset file path needed in `<script>` tags
319
292
  */
320
293
  getWebpackAssetPaths() {
321
294
  return __classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPaths, "f")?.[wpEntryMainId] || [];
322
295
  }
323
- createHtmlTagsForAssetPaths({ assets, scriptTagsAreAsync, }) {
296
+ static createHtmlTagsForAssetPaths({ assets, scriptTagsAreAsync, }) {
324
297
  return assets
325
298
  .filter((asset) => !asset.endsWith('.map')) // exclude source maps
326
299
  .map((asset) => {
@@ -336,39 +309,6 @@ class RendererWebpackBase extends renderers_1.RendererBase {
336
309
  })
337
310
  .join('\n');
338
311
  }
339
- build() {
340
- app_1.log.info('Building with Webpack...', null, this.logPrefix);
341
- return new Promise((resolve, reject) => {
342
- this.prepWebpack();
343
- this.webpackCompiler.run(async (err, stats) => {
344
- if (err) {
345
- console.log();
346
- console.error(err);
347
- console.log();
348
- app_1.log.error(`An error occured while building your components with Webpack. Please review above messages`, null, this.logPrefix);
349
- reject();
350
- return;
351
- }
352
- if (stats?.hasErrors?.()) {
353
- console.log();
354
- console.error(stats.toString());
355
- console.log();
356
- app_1.log.error(`An error occured while building your components with Webpack. Please review above messages`, null, this.logPrefix);
357
- reject();
358
- return;
359
- }
360
- /**
361
- * Writing out this info to a file so that the `hydrate` step can read it and get it back in-memory
362
- */
363
- await (0, file_utils_1.writeJSON)({
364
- path: __classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPathsFilePath, "f"),
365
- contents: __classPrivateFieldGet(this, _RendererWebpackBase_webpackAssetsPaths, "f"),
366
- });
367
- app_1.log.info('Webpack built', null, this.logPrefix);
368
- resolve();
369
- });
370
- });
371
- }
372
312
  /** Starts a webpack watch, returns an object with a `.close()` method for shutting down */
373
313
  startWebpackWatch() {
374
314
  if (!this.webpackCompiler) {
@@ -401,47 +341,20 @@ class RendererWebpackBase extends renderers_1.RendererBase {
401
341
  }, 0);
402
342
  });
403
343
  }
404
- async watch(_opt) {
344
+ async watch() {
405
345
  // we don't call `await super.watch(opt);` b/c webpack is watching our source files for us
406
- this.prepWebpack();
407
- app_1.knapsackEvents.onPatternsDataReady(({ patterns: allPatterns }) => {
408
- this.writeKsEntryFile();
346
+ __classPrivateFieldGet(this, _RendererWebpackBase_instances, "m", _RendererWebpackBase_prepWebpack).call(this);
347
+ app_1.knapsackEvents.onPatternsDataReady(() => {
348
+ __classPrivateFieldGet(this, _RendererWebpackBase_instances, "m", _RendererWebpackBase_writeKsEntryFile).call(this);
409
349
  });
410
350
  this.startWebpackWatch();
411
351
  }
412
- // eslint-disable-next-line class-methods-use-this
413
352
  onChange() {
414
353
  // overwriting so we can call event after webpack compiles
415
354
  }
416
- makeKsJsImportsUnique({ imports }) {
417
- const results = imports.reduce((cur, imp) => {
418
- const prevImport = cur.imports.find(({ importInfo: { name, path } }) => {
419
- if (name === imp.importInfo.name && path === imp.importInfo.path) {
420
- return true;
421
- }
422
- return false;
423
- });
424
- if (!prevImport) {
425
- cur.declaredVars.push(imp.importInfo.name);
426
- cur.imports.push(imp);
427
- }
428
- return cur;
429
- }, {
430
- imports: [],
431
- declaredVars: [],
432
- });
433
- return {
434
- ...results,
435
- isDeclaredVarsUnique: (0, utils_1.isArrayOfStringsUnique)(results.declaredVars),
436
- nameCollisions: (0, utils_1.getNonUniqueStringsFromArray)(results.declaredVars),
437
- };
438
- }
439
- createJsImportCodeBlock({ imports: nonUniqueImports, }) {
440
- const { imports } = this.makeKsJsImportsUnique({
441
- imports: nonUniqueImports,
442
- });
355
+ static createJsImportCodeBlock({ importMap, }) {
443
356
  const declaredVars = [];
444
- const impMap = (0, utils_1.groupBy)(imports, (imp) => imp.importInfo.path);
357
+ const impMap = (0, utils_1.groupBy)([...importMap.values()], (imp) => imp.path);
445
358
  const importLines = Object.entries(impMap)
446
359
  .sort(([a], [b]) => {
447
360
  // sorting relative imports at bottom
@@ -457,46 +370,60 @@ class RendererWebpackBase extends renderers_1.RendererBase {
457
370
  const importPath = (0, path_1.isAbsolute)(path)
458
371
  ? `./${(0, path_1.relative)(process.cwd(), path)}`
459
372
  : path;
460
- const { alls, defaults, names } = imps.reduce((cur, imp) => {
461
- declaredVars.push(imp.importInfo.name);
462
- switch (imp.importInfo.type) {
463
- case 'all':
464
- cur.alls.push(imp.importInfo.name);
373
+ const { renames, defaults, names } = imps.reduce((cur, imp) => {
374
+ declaredVars.push(imp.name);
375
+ switch (imp.type) {
376
+ case 'renamed':
377
+ cur.renames.push({
378
+ name: imp.name,
379
+ originalName: imp.originalName,
380
+ });
465
381
  break;
466
382
  case 'default':
467
- cur.defaults.push(imp.importInfo.name);
383
+ cur.defaults.push(imp.name);
468
384
  break;
469
385
  case 'named':
470
- cur.names.push(imp.importInfo.name);
386
+ cur.names.push(imp.name);
471
387
  break;
472
388
  default: {
473
- (0, utils_1.expectNever)(imp.importInfo);
389
+ const _exhaustiveCheck = imp;
474
390
  }
475
391
  }
476
392
  return cur;
477
393
  }, {
478
394
  names: [],
479
395
  defaults: [],
480
- alls: [],
396
+ renames: [],
481
397
  });
482
398
  return [
483
- ...alls.map((name) => `import * as ${name} from '${importPath}';`),
399
+ ...renames.map(({ name, originalName }) => `import { ${originalName} as ${name} } from '${importPath}';`),
484
400
  ...defaults.map((name) => `import ${name} from '${importPath}';`),
485
401
  names.length > 0 &&
486
402
  `import { ${names.join(',')} } from '${importPath}';`,
487
403
  ].filter(Boolean);
488
404
  });
489
- return {
490
- code: (0, file_utils_1.formatCodeSync)({
491
- contents: [...new Set(importLines)].join('\n'),
492
- path: 'fake-file.js',
493
- }),
494
- declaredVars,
495
- isDeclaredVarsUnique: (0, utils_1.isArrayOfStringsUnique)(declaredVars),
496
- nameCollisions: (0, utils_1.getNonUniqueStringsFromArray)(declaredVars),
497
- };
405
+ return [...new Set(importLines)].join('\n');
498
406
  }
499
407
  }
500
408
  exports.RendererWebpackBase = RendererWebpackBase;
501
- _RendererWebpackBase_webpackAssetsPaths = new WeakMap(), _RendererWebpackBase_webpackAssetsPathsFilePath = new WeakMap(), _RendererWebpackBase_entryString = new WeakMap();
409
+ _RendererWebpackBase_webpackAssetsPaths = new WeakMap(), _RendererWebpackBase_webpackAssetsPathsFilePath = new WeakMap(), _RendererWebpackBase_entryString = new WeakMap(), _RendererWebpackBase_instances = new WeakSet(), _RendererWebpackBase_writeKsEntryFile = function _RendererWebpackBase_writeKsEntryFile() {
410
+ if (!this.entryFilePath) {
411
+ throw new Error('Cannot write entry file because entryFilePath is not set');
412
+ }
413
+ const contents = (0, create_js_import_entry_1.getEntryString)(this.getCodeSrcs());
414
+ if (contents === __classPrivateFieldGet(this, _RendererWebpackBase_entryString, "f"))
415
+ return;
416
+ __classPrivateFieldSet(this, _RendererWebpackBase_entryString, contents, "f");
417
+ (0, file_utils_1.writeFormattedFileSync)({
418
+ contents,
419
+ path: this.entryFilePath,
420
+ });
421
+ app_1.log.verbose(`Wrote entry file to ${this.entryFilePath}`, null, this.id);
422
+ }, _RendererWebpackBase_prepWebpack = function _RendererWebpackBase_prepWebpack() {
423
+ __classPrivateFieldGet(this, _RendererWebpackBase_instances, "m", _RendererWebpackBase_writeKsEntryFile).call(this);
424
+ const webpackConfig = this.createWebpackConfig();
425
+ app_1.log.verbose(`Webpack Config module.rules`, webpackConfig.module.rules, this.logPrefix);
426
+ // should this look for an already running webpack instance to possibly shut it down first? would only be from watch
427
+ this.webpackCompiler = this.webpack(webpackConfig);
428
+ };
502
429
  //# sourceMappingURL=renderer-webpack-base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer-webpack-base.js","sourceRoot":"","sources":["../src/renderer-webpack-base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,uCAAoD;AACpD,uDAAwE;AACxE,qDAM8B;AAC9B,2CAKyB;AACzB,yEAAyE;AACzE,+BAAkD;AAClD,sDAKiB;AACjB,qEAAkF;AAClF,qEAA0D;AAG1D;;;GAGG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC;AAI7B,SAAS,gBAAgB,CACvB,OAA0C;IAE1C,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACtC,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,WAAW,CACvB,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAC;QACtB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,aAAa,IAAI,sEAAsE,KAAK,EAAE,CAC/F,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAsB,mBAAoB,SAAQ,wBAAY;IAW5D,YAAY,E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AAA,uCAAc,EAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACpD,IAAI,QAAQ,KAAK,uBAAA,IAAI,wCAAa;QAAE,OAAO;IAC3C,uBAAA,IAAI,oCAAgB,QAAQ,MAAA,CAAC;IAC7B,IAAA,mCAAsB,EAAC;QACrB,QAAQ;QACR,IAAI,EAAE,IAAI,CAAC,aAAa;KACzB,CAAC,CAAC;IACH,SAAG,CAAC,OAAO,CAAC,uBAAuB,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1E,CAAC;IA2GC,uBAAA,IAAI,6EAAkB,MAAtB,IAAI,CAAoB,CAAC;IACzB,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACjD,SAAG,CAAC,OAAO,CACT,6BAA6B,EAC7B,aAAa,CAAC,MAAM,CAAC,KAAK,EAC1B,IAAI,CAAC,SAAS,CACf,CAAC;IACF,oHAAoH;IACpH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACrD,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,8 +1,39 @@
1
+ import type { KsRendererClientMeta } from '@knapsack/types';
2
+ export type ImportedModules<ExportedComponentType> = {
3
+ [id: string]: () => Promise<EsModuleObject<ExportedComponentType>>;
4
+ };
5
+ /** The result of `import`-ing a module */
6
+ export type EsModuleObject<ExportedType = unknown> = {
7
+ default?: ExportedType;
8
+ [key: string]: ExportedType;
9
+ };
10
+ /**
11
+ * This is `window.knapsack` inside the renderer client: the iframe container for renderer components
12
+ */
13
+ export interface KsRendererClientUtils<ExportedComponentType = unknown, RendererMetaType extends RendererMetaBase = RendererMetaBase, RendererMethods extends Record<string, unknown> = Record<string, unknown>> {
14
+ importedModules: ImportedModules<ExportedComponentType>;
15
+ rendererMeta: RendererMetaType;
16
+ rendererMethods: RendererMethods;
17
+ getNeededImports: () => Promise<Record<string, ExportedComponentType>>;
18
+ getExtraImports: () => Promise<Record<keyof RendererMetaType['extraImports'], ExportedComponentType>>;
19
+ meta: KsRendererClientMeta;
20
+ }
21
+ /**
22
+ * Keys are the `name`s of the imports
23
+ * This ensures that the names are unique since these become vars
24
+ */
25
+ export type KsJsImportMap = Map<string, KsJsImportInfo>;
1
26
  /**
2
27
  * The shared requirements for the `rendererMeta` object that gets put in `<script>` tags in the client.
3
28
  */
4
- export type RendererMetaBase = {
5
- neededImports: KsJsImport[];
29
+ export type RendererMetaBase<ExtraImportsNames extends string = string> = {
30
+ neededImportsByPath: Record<string, KsJsImportInfo[]>;
31
+ /**
32
+ * Use `getExtraImports()` to get these extra imports
33
+ */
34
+ extraImports?: {
35
+ [Name in ExtraImportsNames]: KsJsImportInfo<Name>;
36
+ };
6
37
  };
7
38
  /**
8
39
  * Information about JS imports that can describe how to import a module in these ways:
@@ -12,35 +43,22 @@ export type RendererMetaBase = {
12
43
  *
13
44
  * Used in Webpack-based renderers
14
45
  */
15
- export type KsJsImportInfo = {
46
+ export type KsJsImportInfo<Name extends string = string> = {
16
47
  type: 'default';
17
48
  /** import name from 'path'; */
18
- name: string;
49
+ name: Name;
19
50
  path: string;
20
51
  } | {
21
52
  type: 'named';
22
53
  path: string;
23
54
  /** import { name } from 'path'; */
24
- name: string;
55
+ name: Name;
25
56
  } | {
26
- type: 'all';
57
+ type: 'renamed';
27
58
  path: string;
28
- /** import * as name from 'path'; */
29
- name: string;
30
- };
31
- export type KsJsImport = {
32
- type: 'pattern-template';
33
- patternId: string;
34
- templateId: string;
35
- importInfo: KsJsImportInfo;
36
- } | {
37
- type: 'pattern-template-demo';
38
- patternId: string;
39
- templateId: string;
40
- demoId: string;
41
- importInfo: KsJsImportInfo;
42
- } | {
43
- type: 'extra';
44
- importInfo: KsJsImportInfo;
59
+ /** import { originalName as name } from 'path'; */
60
+ name: Name;
61
+ /** import { originalName as name } from 'path'; */
62
+ originalName: string;
45
63
  };
46
64
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,UAAU,EAAE,CAAC;CAC7B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,MAAM,UAAU,GAClB;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,cAAc,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,uBAAuB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,cAAc,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,cAAc,CAAC;CAC5B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,MAAM,eAAe,CAAC,qBAAqB,IAAI;IACnD,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC;CACpE,CAA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IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,IAAI,EAAE,IAAI,CAAC;CACZ,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,IAAI,CAAC;IACX,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { KsJsImportMap, RendererMetaBase } from './types';
2
+ export declare function convertImportMapToNeededImportsByPath(importMap: KsJsImportMap): RendererMetaBase['neededImportsByPath'];
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,qCAAqC,CACnD,SAAS,EAAE,aAAa,GACvB,gBAAgB,CAAC,qBAAqB,CAAC,CAEzC"}
package/dist/utils.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertImportMapToNeededImportsByPath = convertImportMapToNeededImportsByPath;
4
+ const utils_1 = require("@knapsack/utils");
5
+ function convertImportMapToNeededImportsByPath(importMap) {
6
+ return (0, utils_1.groupBy)([...importMap.values()], (imp) => imp.path);
7
+ }
8
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAGA,sFAIC;AAPD,2CAA0C;AAG1C,SAAgB,qCAAqC,CACnD,SAAwB;IAExB,OAAO,IAAA,eAAO,EAAC,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knapsack/renderer-webpack-base",
3
3
  "description": "",
4
- "version": "4.69.12--canary.4820.6d71796.0",
4
+ "version": "4.69.12--canary.4821.8709676.0",
5
5
  "type": "commonjs",
6
6
  "exports": {
7
7
  ".": {
@@ -23,20 +23,20 @@
23
23
  "test": "time ava"
24
24
  },
25
25
  "dependencies": {
26
- "@knapsack/app": "4.69.12--canary.4820.6d71796.0",
27
- "@knapsack/babel-config-starter": "4.69.12--canary.4820.6d71796.0",
28
- "@knapsack/file-utils": "4.69.12--canary.4820.6d71796.0",
29
- "@knapsack/types": "4.69.12--canary.4820.6d71796.0",
30
- "@knapsack/utils": "4.69.12--canary.4820.6d71796.0",
26
+ "@knapsack/app": "4.69.12--canary.4821.8709676.0",
27
+ "@knapsack/babel-config-starter": "4.69.12--canary.4821.8709676.0",
28
+ "@knapsack/file-utils": "4.69.12--canary.4821.8709676.0",
29
+ "@knapsack/types": "4.69.12--canary.4821.8709676.0",
30
+ "@knapsack/utils": "4.69.12--canary.4821.8709676.0",
31
31
  "babel-loader": "^9.2.1",
32
32
  "webpack": "^5.94.0",
33
33
  "webpack-manifest-plugin": "^4.1.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@knapsack/eslint-config-starter": "4.69.12--canary.4820.6d71796.0",
37
- "@knapsack/prettier-config": "4.69.12--canary.4820.6d71796.0",
38
- "@knapsack/test-ava": "4.69.12--canary.4820.6d71796.0",
39
- "@knapsack/typescript-config-starter": "4.69.12--canary.4820.6d71796.0",
36
+ "@knapsack/eslint-config-starter": "4.69.12--canary.4821.8709676.0",
37
+ "@knapsack/prettier-config": "4.69.12--canary.4821.8709676.0",
38
+ "@knapsack/test-ava": "4.69.12--canary.4821.8709676.0",
39
+ "@knapsack/typescript-config-starter": "4.69.12--canary.4821.8709676.0",
40
40
  "@types/estree": "^1.0.6",
41
41
  "@types/node": "^20.16.5",
42
42
  "@types/webpack": "^5.28.5",
@@ -54,5 +54,5 @@
54
54
  "directory": "apps/client/libs/renderer-webpack-base",
55
55
  "type": "git"
56
56
  },
57
- "gitHead": "6d71796353d923002ede27ea7ad9a18ce1959df1"
57
+ "gitHead": "8709676f3545d2ea5c97f981cc964e92035585f0"
58
58
  }