@knapsack/renderer-webpack-base 4.69.14--canary.4821.246c5f4.0 → 4.69.15--canary.4433.ca0920f.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # v4.69.14 (Fri Sep 27 2024)
2
+
3
+ #### 🏠 Internal
4
+
5
+ - spec docs uses collapse instead of accordion [#4862](https://github.com/knapsack-labs/app-monorepo/pull/4862) ([@GormanDesign](https://github.com/GormanDesign))
6
+
7
+ #### Authors: 1
8
+
9
+ - Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
10
+
11
+ ---
12
+
13
+ # v4.69.13 (Thu Sep 26 2024)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - update design src user flow to be async [#4739](https://github.com/knapsack-labs/app-monorepo/pull/4739) ([@mabry1985](https://github.com/mabry1985))
18
+ - Merge branch 'latest' into feature/ksp-5512-create-add-design-src-file-async-mutation ([@mabry1985](https://github.com/mabry1985))
19
+
20
+ #### 🏠 Internal
21
+
22
+ - improve Renderer clients [#4770](https://github.com/knapsack-labs/app-monorepo/pull/4770) ([@EvanLovely](https://github.com/EvanLovely))
23
+ - refactors user flow for updating design src files [#4769](https://github.com/knapsack-labs/app-monorepo/pull/4769) ([@mabry1985](https://github.com/mabry1985))
24
+
25
+ #### Authors: 2
26
+
27
+ - Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
28
+ - Josh Mabry ([@mabry1985](https://github.com/mabry1985))
29
+
30
+ ---
31
+
1
32
  # v4.69.12 (Thu Sep 26 2024)
2
33
 
3
34
  #### 🐛 Bug Fix
@@ -1,3 +1,3 @@
1
1
  export * from './renderer-webpack-client.mjs';
2
- export type { KsJsImportInfo, RendererMetaBase } from '../types.js';
2
+ export type { KsJsImport, 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,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,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,20 +1,78 @@
1
- import type { KsJsImportInfo, RendererMetaBase, KsRendererClientUtils } from '../types.js';
2
- export declare function getKsRendererClientUtils<ExportedComponentType, RendererMetaType extends RendererMetaBase,
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,
3
68
  /**
4
69
  * Any extra properties or methods placed on the window.knapsack object by the renderer in a `<script>` tag
5
70
  */
6
- RendererMethods extends Record<string, unknown>>({ rendererMetaScriptTagId, assertImport, assertExtraImport, }: {
71
+ RendererMethods extends Record<string, unknown>>({ rendererMetaScriptTagId }: {
7
72
  rendererMetaScriptTagId: string;
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>;
73
+ }): KsRendererClientGlobal<ExportedComponentType, RendererMetaType, RendererMethods>;
17
74
  export declare function showUiToastMsg({ msg }: {
18
75
  msg: string;
19
76
  }): void;
77
+ export {};
20
78
  //# 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":"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"}
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,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,CAAC,CAAC;IACH,cAAc,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QACjD,IAAI,EAAE,MAAM,CAAC;QACb,8BAA8B;QAC9B,KAAK,EAAE,qBAAqB,CAAC;KAC9B,CAAC,CAAC;IACH,aAAa,EAAE,CAAC,GAAG,EAAE;QACnB,QAAQ,EAAE,yBAAyB,EAAE,CAAC;QACtC,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC7B,KAAK,OAAO,CAAC;QACZ,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,CAAC;KAC7C,CAAC,CAAC;CACJ;AAeD,wBAAgB,yBAAyB,CACvC,qBAAqB,EACrB,gBAAgB,SAAS,gBAAgB;AACzC;;GAEG;AACH,eAAe,SAAS,MAAM,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"}
@@ -4,57 +4,19 @@ 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
- 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
- }
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);
55
17
  }
56
- }
57
- export function getKsRendererClientUtils({ rendererMetaScriptTagId, assertImport, assertExtraImport, }) {
18
+ };
19
+ export function getKsRendererClientGlobal({ rendererMetaScriptTagId }) {
58
20
  if (!isObject(window?.knapsack)) {
59
21
  throw new Error(`Could not find "window.knapsack"`);
60
22
  }
@@ -64,58 +26,118 @@ export function getKsRendererClientUtils({ rendererMetaScriptTagId, assertImport
64
26
  }
65
27
  const meta = getJsonFromScriptTag(ksRendererClientMetaId);
66
28
  const rendererMeta = getJsonFromScriptTag(rendererMetaScriptTagId);
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}"`);
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);
74
33
  }
75
- const mod = await getModule();
76
- if (!mod) {
77
- throw new Error(`No module contents found for "${path}"`);
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);
78
39
  }
79
- importInfos.forEach((importInfo) => {
80
- addImportToAllImports({
81
- importInfo,
82
- mod,
83
- allImports: neededImports,
84
- assertImport,
85
- });
86
- });
87
- }));
88
- return neededImports;
40
+ if (imp.type === 'extra' && opt.type === 'extra') {
41
+ return opt.name === imp.importInfo.name;
42
+ }
43
+ return false;
44
+ });
89
45
  };
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}"`);
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
+ };
96
86
  }
97
- const mod = await getModule();
98
- if (!mod) {
99
- throw new Error(`No module found for "${importInfo.path}"`);
87
+ default: {
88
+ throw new Error(`Unknown import type`);
100
89
  }
101
- addImportToAllImports({
102
- importInfo,
103
- mod,
104
- allImports: theExtraImports,
105
- assertImport: assertExtraImport,
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,
106
99
  });
107
- }));
108
- return theExtraImports;
100
+ }
101
+ return getImport({
102
+ type: 'pattern-template',
103
+ patternId,
104
+ templateId,
105
+ });
109
106
  };
107
+ const getExtraImport = async ({ name, }) => getImport({ type: 'extra', name });
110
108
  const knapsack = {
109
+ typeName: 'KsRendererClientGlobal',
111
110
  importedModules,
112
111
  meta,
113
112
  rendererMeta,
114
113
  rendererMethods,
115
- getNeededImports,
116
- getExtraImports,
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
+ },
117
140
  };
118
- window.knapsack = knapsack;
119
141
  return knapsack;
120
142
  }
121
143
  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;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,IAAI,EAAE,GAAG,UAAU,CAAC;YAC5B,MAAM,SA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I,EAAE,4BAA4B;QAClC,GAAG;QACH,YAAY,EAAE,MAAM;KACS,EAC/B,GAAG,CACJ,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './renderer-webpack-base';
2
2
  export * from './types';
3
- export * from './utils';
4
3
  //# 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;AACxB,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"}
package/dist/index.js CHANGED
@@ -16,5 +16,4 @@ 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);
20
19
  //# 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;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,0CAAwB"}
@@ -1,28 +1,49 @@
1
1
  import { RendererId } from '@knapsack/types';
2
- import { CliLifecycle, RendererBase, type Renderable } from '@knapsack/app/renderers';
2
+ import { RendererBase, type Renderable } from '@knapsack/app/renderers';
3
3
  import { Configuration as WebpackConfig } from 'webpack';
4
- import { KsJsImportInfo, KsJsImportMap } from './types';
5
- export declare abstract class RendererWebpackBase extends RendererBase implements CliLifecycle {
4
+ import { KsJsImport } from './types';
5
+ export declare abstract class RendererWebpackBase extends RendererBase {
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, language, webpackConfig, extraScripts, codeSrcs, }: {
12
+ constructor({ id, extension, language, webpackConfig, extraScripts, }: {
13
13
  id: RendererId;
14
+ extension: string;
14
15
  language: string;
15
16
  webpackConfig?: WebpackConfig;
16
17
  extraScripts?: string[];
17
- codeSrcs: string[];
18
18
  });
19
- setConfig(opt: Parameters<RendererBase['setConfig']>[0]): ReturnType<RendererBase['setConfig']>;
20
- hydrate(_opt: Parameters<CliLifecycle['hydrate']>[0]): ReturnType<CliLifecycle['hydrate']>;
21
- addUniqueValueToImportMap({ importMap, path: originalPath, alias, }: {
22
- importMap: KsJsImportMap;
23
- path: string;
24
- alias: string;
25
- }): Promise<KsJsImportInfo>;
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;
26
47
  get webpackVersion(): {
27
48
  majorVersion: number;
28
49
  isWebpack4: boolean;
@@ -30,29 +51,43 @@ export declare abstract class RendererWebpackBase extends RendererBase implement
30
51
  version: string;
31
52
  };
32
53
  createWebpackConfig(): WebpackConfig;
54
+ private prepWebpack;
33
55
  /**
34
56
  * Every asset file path needed in `<script>` tags
35
57
  */
36
58
  getWebpackAssetPaths(): string[];
37
- static createHtmlTagsForAssetPaths({ assets, scriptTagsAreAsync, }: {
59
+ createHtmlTagsForAssetPaths({ assets, scriptTagsAreAsync, }: {
38
60
  assets: string[];
39
61
  scriptTagsAreAsync: boolean;
40
62
  }): string;
41
- build: CliLifecycle['build'];
63
+ build(): Promise<void>;
42
64
  /** Starts a webpack watch, returns an object with a `.close()` method for shutting down */
43
65
  private startWebpackWatch;
44
- watch(): Promise<void>;
66
+ watch(_opt: Parameters<RendererBase['watch']>[0]): Promise<void>;
45
67
  onChange(): void;
46
- abstract getUsageAndImports(_opt: Parameters<Renderable['render']>[0] & {
47
- importMap: KsJsImportMap;
48
- }): Promise<{
68
+ abstract getUsageAndImports(_opt: Parameters<Renderable['render']>[0]): Promise<{
49
69
  usage: string;
50
- importMap: KsJsImportMap;
70
+ imports: KsJsImport[];
51
71
  }>;
52
72
  getUsage: Renderable['getUsage'];
53
- static createJsImportCodeBlock({ importMap, }: {
54
- importMap: KsJsImportMap;
55
- }): string;
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
+ };
56
91
  }
57
- export type Renderer = Renderable & RendererWebpackBase & CliLifecycle;
92
+ export type Renderer = Renderable & RendererWebpackBase;
58
93
  //# sourceMappingURL=renderer-webpack-base.d.ts.map
@@ -1 +1 @@
1
- {"version":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