@knapsack/renderer-react 4.69.10--canary.4778.7061c3b.0 → 4.69.10--canary.4745.042d9e2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +0 -18
- package/dist/demo-wrapper.d.mts +4 -1
- package/dist/demo-wrapper.d.ts +4 -1
- package/dist/demo-wrapper.js.map +1 -1
- package/dist/demo-wrapper.mjs.map +1 -1
- package/dist/index.d.mts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +135 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +138 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -19
- package/dist/client/init.d.mts +0 -2
- package/dist/client/init.d.ts +0 -2
- package/dist/client/init.js +0 -82
- package/dist/client/init.js.map +0 -1
- package/dist/client/init.mjs +0 -90
- package/dist/client/init.mjs.map +0 -1
- package/dist/types-D2eCZXsg.d.mts +0 -13
- package/dist/types-D2eCZXsg.d.ts +0 -13
package/dist/client/init.mjs
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
3
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
4
|
-
var __esm = (fn, res) => function __init() {
|
5
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
6
|
-
};
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
9
|
-
};
|
10
|
-
|
11
|
-
// ../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.5__@swc+core@1.3.57_@swc+helpers_qewjfurrjspcqzwdqcz2r3oykm/node_modules/tsup/assets/esm_shims.js
|
12
|
-
var init_esm_shims = __esm({
|
13
|
-
"../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.5__@swc+core@1.3.57_@swc+helpers_qewjfurrjspcqzwdqcz2r3oykm/node_modules/tsup/assets/esm_shims.js"() {
|
14
|
-
}
|
15
|
-
});
|
16
|
-
|
17
|
-
// src/types.ts
|
18
|
-
var rendererMetaScriptTagId;
|
19
|
-
var init_types = __esm({
|
20
|
-
"src/types.ts"() {
|
21
|
-
init_esm_shims();
|
22
|
-
rendererMetaScriptTagId = "ks-react-meta";
|
23
|
-
}
|
24
|
-
});
|
25
|
-
|
26
|
-
// src/client/ks-utils.ts
|
27
|
-
import { getKsRendererClientGlobal } from "@knapsack/renderer-webpack-base/client";
|
28
|
-
var allAvailableImports, getAllImports, getExtraImport, getImport, getImports, getPatternImport, importedModules, meta, rendererMeta, rendererMethods;
|
29
|
-
var init_ks_utils = __esm({
|
30
|
-
"src/client/ks-utils.ts"() {
|
31
|
-
init_esm_shims();
|
32
|
-
init_types();
|
33
|
-
({
|
34
|
-
allAvailableImports,
|
35
|
-
getAllImports,
|
36
|
-
getExtraImport,
|
37
|
-
getImport,
|
38
|
-
getImports,
|
39
|
-
getPatternImport,
|
40
|
-
importedModules,
|
41
|
-
meta,
|
42
|
-
rendererMeta,
|
43
|
-
rendererMethods
|
44
|
-
} = getKsRendererClientGlobal({
|
45
|
-
rendererMetaScriptTagId
|
46
|
-
}));
|
47
|
-
}
|
48
|
-
});
|
49
|
-
|
50
|
-
// src/client/init.tsx
|
51
|
-
import React from "react";
|
52
|
-
import ReactDOM from "react-dom/client";
|
53
|
-
import { jsx } from "react/jsx-runtime";
|
54
|
-
var require_init = __commonJS({
|
55
|
-
"src/client/init.tsx"() {
|
56
|
-
init_esm_shims();
|
57
|
-
init_ks_utils();
|
58
|
-
async function init() {
|
59
|
-
const { imports, disableReactStrictMode, demoWrapperProps } = rendererMeta;
|
60
|
-
const all = await getAllImports({
|
61
|
-
patterns: imports.filter((i) => i.type !== "extra"),
|
62
|
-
extras: imports.filter((i) => i.type === "extra").map(({ importInfo }) => ({ name: importInfo.name }))
|
63
|
-
});
|
64
|
-
const root = document.getElementById("render-root");
|
65
|
-
if (!root) {
|
66
|
-
throw new Error("No root element found");
|
67
|
-
}
|
68
|
-
const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;
|
69
|
-
const DemoApp = rendererMethods.getDemoApp(demoComponents);
|
70
|
-
const app = /* @__PURE__ */ jsx(ErrorCatcher, { children: /* @__PURE__ */ jsx(DemoWrapper, { ...demoWrapperProps, children: /* @__PURE__ */ jsx(DemoApp, {}) }) });
|
71
|
-
ReactDOM.createRoot(root).render(
|
72
|
-
disableReactStrictMode ? app : /* @__PURE__ */ jsx(React.StrictMode, { children: app })
|
73
|
-
);
|
74
|
-
}
|
75
|
-
__name(init, "init");
|
76
|
-
try {
|
77
|
-
init();
|
78
|
-
} catch (e) {
|
79
|
-
console.error(e);
|
80
|
-
const errorElement = document.createElement("div");
|
81
|
-
errorElement.innerHTML = `
|
82
|
-
<h1>Error</h1>
|
83
|
-
<p>${e.message}</p>
|
84
|
-
`;
|
85
|
-
document.body.appendChild(errorElement);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
});
|
89
|
-
export default require_init();
|
90
|
-
//# sourceMappingURL=init.mjs.map
|
package/dist/client/init.mjs.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.5__@swc+core@1.3.57_@swc+helpers_qewjfurrjspcqzwdqcz2r3oykm/node_modules/tsup/assets/esm_shims.js","../../src/types.ts","../../src/client/ks-utils.ts","../../src/client/init.tsx"],"sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type {\n KsJsImport,\n KsJsImportInfo,\n} from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n imports: KsJsImport[];\n moduleImports: {\n [path: string]: KsJsImportInfo[];\n };\n disableReactStrictMode: boolean;\n demo: Demo;\n patternId: string;\n templateId: string;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n};\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n","import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nexport const {\n allAvailableImports,\n getAllImports,\n getExtraImport,\n getImport,\n getImports,\n getPatternImport,\n importedModules,\n meta,\n rendererMeta,\n rendererMethods,\n} = getKsRendererClientGlobal<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n});\n","/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { rendererMeta, rendererMethods, getAllImports } from './ks-utils';\n\nasync function init() {\n const { imports, disableReactStrictMode, demoWrapperProps } = rendererMeta;\n const all = await getAllImports({\n patterns: imports.filter((i) => i.type !== 'extra'),\n extras: imports\n .filter((i) => i.type === 'extra')\n .map(({ importInfo }) => ({ name: importInfo.name })),\n });\n\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;\n const DemoApp = rendererMethods.getDemoApp(demoComponents);\n const app = (\n <ErrorCatcher>\n <DemoWrapper {...demoWrapperProps}>\n <DemoApp />\n </DemoWrapper>\n </ErrorCatcher>\n );\n\n ReactDOM.createRoot(root).render(\n disableReactStrictMode ? app : <React.StrictMode>{app}</React.StrictMode>,\n );\n}\n\ntry {\n init();\n} catch (e) {\n console.error(e);\n // create html element with error message\n const errorElement = document.createElement('div');\n errorElement.innerHTML = `\n <h1>Error</h1>\n <p>${e.message}</p>\n `;\n document.body.appendChild(errorElement);\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAkCa;AAlCb;AAAA;AAAA;AAkCO,IAAM,0BAA0B;AAAA;AAAA;;;AClCvC,SAAS,iCAAiC;AAA1C,IASE,qBACA,eACA,gBACA,WACA,YACA,kBACA,iBACA,MACA,cACA;AAlBF;AAAA;AAAA;AACA;AAOO,KAAM;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,0BAAmE;AAAA,MACrE;AAAA,IACF,CAAC;AAAA;AAAA;;;ACpBD,OAAO,WAAW;AAClB,OAAO,cAAc;AAqBb;AAvBR;AAAA;AAAA;AAGA;AAEA,mBAAe,OAAO;AACpB,YAAM,EAAE,SAAS,wBAAwB,iBAAiB,IAAI;AAC9D,YAAM,MAAM,MAAM,cAAc;AAAA,QAC9B,UAAU,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AAAA,QAClD,QAAQ,QACL,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,EAChC,IAAI,CAAC,EAAE,WAAW,OAAO,EAAE,MAAM,WAAW,KAAK,EAAE;AAAA,MACxD,CAAC;AAED,YAAM,OAAO,SAAS,eAAe,aAAa;AAClD,UAAI,CAAC,MAAM;AACT,cAAM,IAAI,MAAM,uBAAuB;AAAA,MACzC;AACA,YAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI;AACzD,YAAM,UAAU,gBAAgB,WAAW,cAAc;AACzD,YAAM,MACJ,oBAAC,gBACC,8BAAC,eAAa,GAAG,kBACf,8BAAC,WAAQ,GACX,GACF;AAGF,eAAS,WAAW,IAAI,EAAE;AAAA,QACxB,yBAAyB,MAAM,oBAAC,MAAM,YAAN,EAAkB,eAAI;AAAA,MACxD;AAAA,IACF;AA1Be;AA4Bf,QAAI;AACF,WAAK;AAAA,IACP,SAAS,GAAG;AACV,cAAQ,MAAM,CAAC;AAEf,YAAM,eAAe,SAAS,cAAc,KAAK;AACjD,mBAAa,YAAY;AAAA;AAAA,SAElB,EAAE,OAAO;AAAA;AAEhB,eAAS,KAAK,YAAY,YAAY;AAAA,IACxC;AAAA;AAAA;","names":[]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { Except } from '@knapsack/types';
|
2
|
-
import { KnapsackRenderParams } from '@knapsack/app/types';
|
3
|
-
|
4
|
-
type DemoWrapperProps = {
|
5
|
-
children: React.ReactNode;
|
6
|
-
patternsUsed: {
|
7
|
-
patternId: string;
|
8
|
-
templateId: string;
|
9
|
-
demoId?: string;
|
10
|
-
}[];
|
11
|
-
} & Except<KnapsackRenderParams, 'patternManifest'>;
|
12
|
-
|
13
|
-
export type { DemoWrapperProps as D };
|
package/dist/types-D2eCZXsg.d.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import { Except } from '@knapsack/types';
|
2
|
-
import { KnapsackRenderParams } from '@knapsack/app/types';
|
3
|
-
|
4
|
-
type DemoWrapperProps = {
|
5
|
-
children: React.ReactNode;
|
6
|
-
patternsUsed: {
|
7
|
-
patternId: string;
|
8
|
-
templateId: string;
|
9
|
-
demoId?: string;
|
10
|
-
}[];
|
11
|
-
} & Except<KnapsackRenderParams, 'patternManifest'>;
|
12
|
-
|
13
|
-
export type { DemoWrapperProps as D };
|