@dooboostore/simple-boot-http-server-ssr 1.0.13 → 1.0.15
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/README.MD +131 -2
- package/dist/cjs/SimpleBootHttpSSRFactory.js.map +1 -1
- package/dist/cjs/SimpleBootHttpSSRServer.js +1 -0
- package/dist/cjs/SimpleBootHttpSSRServer.js.map +2 -2
- package/dist/cjs/bundle-entry.js +0 -2
- package/dist/cjs/bundle-entry.js.map +2 -2
- package/dist/cjs/decorators/LoadAroundBefore.js +2 -2
- package/dist/cjs/decorators/LoadAroundBefore.js.map +2 -2
- package/dist/cjs/filters/SSRDomParserFilter.js +151 -0
- package/dist/cjs/filters/SSRDomParserFilter.js.map +7 -0
- package/dist/cjs/filters/SSRFilter.js +10 -14
- package/dist/cjs/filters/SSRFilter.js.map +2 -2
- package/dist/cjs/filters/SSRLinkDomDomFilter.js +10 -14
- package/dist/cjs/filters/SSRLinkDomDomFilter.js.map +2 -2
- package/dist/cjs/filters/SSRSimpleWebComponentFilter.js +93 -0
- package/dist/cjs/filters/SSRSimpleWebComponentFilter.js.map +7 -0
- package/dist/cjs/filters/SSRWorker.js +2 -2
- package/dist/cjs/filters/SSRWorker.js.map +2 -2
- package/dist/cjs/filters/index.js +2 -2
- package/dist/cjs/filters/index.js.map +2 -2
- package/dist/cjs/index.js +18 -8
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/initializers/DomParserInitializer.js +82 -0
- package/dist/cjs/initializers/DomParserInitializer.js.map +7 -0
- package/dist/cjs/proxy/SSRDomParserFilterDataHydrationProxy.js +92 -0
- package/dist/cjs/proxy/SSRDomParserFilterDataHydrationProxy.js.map +7 -0
- package/dist/cjs/proxy/index.js +2 -8
- package/dist/cjs/proxy/index.js.map +2 -2
- package/dist/esm/SimpleBootHttpSSRFactory.js.map +1 -1
- package/dist/esm/SimpleBootHttpSSRServer.js +1 -0
- package/dist/esm/SimpleBootHttpSSRServer.js.map +2 -2
- package/dist/esm/bundle-entry.js +0 -1
- package/dist/esm/bundle-entry.js.map +2 -2
- package/dist/esm/decorators/LoadAroundBefore.js +1 -1
- package/dist/esm/decorators/LoadAroundBefore.js.map +1 -1
- package/dist/esm/filters/SSRDomParserFilter.js +128 -0
- package/dist/esm/filters/SSRDomParserFilter.js.map +7 -0
- package/dist/esm/filters/SSRFilter.js +7 -11
- package/dist/esm/filters/SSRFilter.js.map +2 -2
- package/dist/esm/filters/SSRLinkDomDomFilter.js +7 -11
- package/dist/esm/filters/SSRLinkDomDomFilter.js.map +2 -2
- package/dist/esm/filters/SSRSimpleWebComponentFilter.js +70 -0
- package/dist/esm/filters/SSRSimpleWebComponentFilter.js.map +7 -0
- package/dist/esm/filters/SSRWorker.js +1 -1
- package/dist/esm/filters/SSRWorker.js.map +2 -2
- package/dist/esm/filters/index.js +1 -1
- package/dist/esm/filters/index.js.map +1 -1
- package/dist/esm/index.js +7 -4
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/initializers/DomParserInitializer.js +49 -0
- package/dist/esm/initializers/DomParserInitializer.js.map +7 -0
- package/dist/esm/proxy/SSRDomParserFilterDataHydrationProxy.js +69 -0
- package/dist/esm/proxy/SSRDomParserFilterDataHydrationProxy.js.map +7 -0
- package/dist/esm/proxy/index.js +1 -4
- package/dist/esm/proxy/index.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server-ssr.esm.js +21225 -8576
- package/dist/esm-bundle/dooboostore-simple-boot-http-server-ssr.esm.js.map +4 -4
- package/dist/types/SimpleBootHttpSSRFactory.d.ts +1 -1
- package/dist/types/SimpleBootHttpSSRFactory.d.ts.map +1 -1
- package/dist/types/SimpleBootHttpSSRServer.d.ts +3 -2
- package/dist/types/SimpleBootHttpSSRServer.d.ts.map +1 -1
- package/dist/types/bundle-entry.d.ts +0 -1
- package/dist/types/bundle-entry.d.ts.map +1 -1
- package/dist/types/filters/SSRDomParserFilter.d.ts +51 -0
- package/dist/types/filters/SSRDomParserFilter.d.ts.map +1 -0
- package/dist/types/filters/SSRFilter.d.ts +1 -1
- package/dist/types/filters/SSRFilter.d.ts.map +1 -1
- package/dist/types/filters/SSRLinkDomDomFilter.d.ts +1 -1
- package/dist/types/filters/SSRLinkDomDomFilter.d.ts.map +1 -1
- package/dist/types/filters/SSRSimpleWebComponentFilter.d.ts +37 -0
- package/dist/types/filters/SSRSimpleWebComponentFilter.d.ts.map +1 -0
- package/dist/types/filters/SSRWorker.d.ts +1 -1
- package/dist/types/filters/SSRWorker.d.ts.map +1 -1
- package/dist/types/filters/index.d.ts +1 -1
- package/dist/types/filters/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/initializers/DomParserInitializer.d.ts +13 -0
- package/dist/types/initializers/DomParserInitializer.d.ts.map +1 -0
- package/dist/types/proxy/SSRDomParserFilterDataHydrationProxy.d.ts +7 -0
- package/dist/types/proxy/SSRDomParserFilterDataHydrationProxy.d.ts.map +1 -0
- package/dist/types/proxy/index.d.ts +1 -4
- package/dist/types/proxy/index.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server-ssr.umd.js +22093 -9448
- package/dist/umd-bundle/dooboostore-simple-boot-http-server-ssr.umd.js.map +4 -4
- package/package.json +15 -8
- package/src/SimpleBootHttpSSRFactory.ts +1 -1
- package/src/SimpleBootHttpSSRServer.ts +5 -3
- package/src/bundle-entry.ts +0 -1
- package/src/decorators/LoadAroundBefore.ts +1 -1
- package/src/filters/SSRDomParserFilter.ts +220 -0
- package/src/filters/SSRFilter.ts +7 -12
- package/src/filters/SSRLinkDomDomFilter.ts +7 -12
- package/src/filters/SSRSimpleWebComponentFilter.ts +103 -0
- package/src/filters/SSRWorker.ts +1 -2
- package/src/filters/index.ts +1 -1
- package/src/index.ts +7 -9
- package/src/initializers/DomParserInitializer.ts +77 -0
- package/src/proxy/SSRDomParserFilterDataHydrationProxy.ts +63 -0
- package/src/proxy/index.ts +1 -4
- package/tsconfig.json +3 -1
- package/dist/cjs/codes/HttpHeaders.js +0 -41
- package/dist/cjs/codes/HttpHeaders.js.map +0 -7
- package/dist/cjs/codes/Mimes.js +0 -33
- package/dist/cjs/codes/Mimes.js.map +0 -7
- package/dist/cjs/codes/index.js +0 -24
- package/dist/cjs/codes/index.js.map +0 -7
- package/dist/cjs/filters/IntentSchemeFilter.js +0 -92
- package/dist/cjs/filters/IntentSchemeFilter.js.map +0 -7
- package/dist/cjs/proxy/IntentSchemeFrontProxy.js +0 -87
- package/dist/cjs/proxy/IntentSchemeFrontProxy.js.map +0 -7
- package/dist/cjs/proxy/IntentSchemeServerProxy.js +0 -67
- package/dist/cjs/proxy/IntentSchemeServerProxy.js.map +0 -7
- package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js +0 -126
- package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js.map +0 -7
- package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js +0 -110
- package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js.map +0 -7
- package/dist/esm/codes/HttpHeaders.js +0 -17
- package/dist/esm/codes/HttpHeaders.js.map +0 -7
- package/dist/esm/codes/Mimes.js +0 -10
- package/dist/esm/codes/Mimes.js.map +0 -7
- package/dist/esm/codes/index.js +0 -3
- package/dist/esm/codes/index.js.map +0 -7
- package/dist/esm/filters/IntentSchemeFilter.js +0 -69
- package/dist/esm/filters/IntentSchemeFilter.js.map +0 -7
- package/dist/esm/proxy/IntentSchemeFrontProxy.js +0 -64
- package/dist/esm/proxy/IntentSchemeFrontProxy.js.map +0 -7
- package/dist/esm/proxy/IntentSchemeServerProxy.js +0 -44
- package/dist/esm/proxy/IntentSchemeServerProxy.js.map +0 -7
- package/dist/esm/proxy/SymbolIntentApiServiceProxy.js +0 -103
- package/dist/esm/proxy/SymbolIntentApiServiceProxy.js.map +0 -7
- package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js +0 -87
- package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js.map +0 -7
- package/dist/types/codes/HttpHeaders.d.ts +0 -45
- package/dist/types/codes/HttpHeaders.d.ts.map +0 -1
- package/dist/types/codes/Mimes.d.ts +0 -31
- package/dist/types/codes/Mimes.d.ts.map +0 -1
- package/dist/types/codes/index.d.ts +0 -3
- package/dist/types/codes/index.d.ts.map +0 -1
- package/dist/types/filters/IntentSchemeFilter.d.ts +0 -20
- package/dist/types/filters/IntentSchemeFilter.d.ts.map +0 -1
- package/dist/types/proxy/IntentSchemeFrontProxy.d.ts +0 -4
- package/dist/types/proxy/IntentSchemeFrontProxy.d.ts.map +0 -1
- package/dist/types/proxy/IntentSchemeServerProxy.d.ts +0 -4
- package/dist/types/proxy/IntentSchemeServerProxy.d.ts.map +0 -1
- package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts +0 -16
- package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts.map +0 -1
- package/dist/types/proxy/SymbolIntentApiServiceProxyBase.d.ts +0 -13
- package/dist/types/proxy/SymbolIntentApiServiceProxyBase.d.ts.map +0 -1
- package/src/codes/HttpHeaders.ts +0 -17
- package/src/codes/Mimes.ts +0 -6
- package/src/codes/index.ts +0 -2
- package/src/filters/IntentSchemeFilter.ts +0 -66
- package/src/node_modules/.bin/acorn +0 -17
- package/src/node_modules/.bin/browserslist +0 -17
- package/src/node_modules/.bin/eslint +0 -17
- package/src/node_modules/.bin/jest +0 -17
- package/src/node_modules/.bin/ts-jest +0 -17
- package/src/node_modules/.bin/ts-node +0 -17
- package/src/node_modules/.bin/ts-node-cwd +0 -17
- package/src/node_modules/.bin/ts-node-esm +0 -17
- package/src/node_modules/.bin/ts-node-script +0 -17
- package/src/node_modules/.bin/ts-node-transpile-only +0 -17
- package/src/node_modules/.bin/ts-script +0 -17
- package/src/node_modules/.bin/tsc +0 -17
- package/src/node_modules/.bin/tsserver +0 -17
- package/src/proxy/IntentSchemeFrontProxy.ts +0 -67
- package/src/proxy/IntentSchemeServerProxy.ts +0 -35
- package/src/proxy/SymbolIntentApiServiceProxy.ts +0 -131
- package/src/proxy/SymbolIntentApiServiceProxyBase.ts +0 -97
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { RandomUtils } from "@dooboostore/core";
|
|
1
2
|
import { JsdomInitializer } from "../initializers/JsdomInitializer.js";
|
|
2
|
-
import { RandomUtils } from "@dooboostore/core/random/RandomUtils";
|
|
3
3
|
class SSRWorker {
|
|
4
4
|
constructor(factory, otherInstanceSim) {
|
|
5
5
|
this.factory = factory;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/filters/SSRWorker.ts"],
|
|
4
|
-
"sourcesContent": ["import { ConstructorType } from '@dooboostore/core
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { ConstructorType, RandomUtils } from '@dooboostore/core';\nimport {FactoryAndParams} from './SSRFilter';\nimport {JsdomInitializer} from '../initializers/JsdomInitializer';\nimport JSDOM from 'jsdom';\nimport {SimpleBootFront} from '@dooboostore/simple-boot-front/SimpleBootFront';\n\nexport class SSRWorker {\n public welcomUrl = 'http://localhost'\n private simpleBootFront?: SimpleBootFront;\n\n constructor(public factory: FactoryAndParams, public otherInstanceSim?: Map<ConstructorType<any>, any>) {\n\n }\n\n async run() {\n this.simpleBootFront = await this.makeFront();\n }\n\n async makeJsdom() {\n const jsdom = await new JsdomInitializer(this.factory.frontDistPath, this.factory.frontDistIndexFileName || 'index.html', {url: this.welcomUrl}).run();\n return jsdom;\n }\n\n async makeFront(jsdom?: JSDOM.JSDOM) {\n if (!jsdom) {\n jsdom = await this.makeJsdom();\n }\n const name = RandomUtils.uuid();\n // const jsdom = await this.makeJsdom();\n const window = jsdom.window as unknown as Window & typeof globalThis;\n (window as any).ssrUse = false;\n const option = this.factory.factorySimFrontOption(window);\n // option.name = name;\n const simpleBootFront = await this.factory.factory.create(option, this.factory.using, this.factory.domExcludes);\n simpleBootFront.run(this.otherInstanceSim);\n (simpleBootFront as any).jsdom = jsdom;\n return simpleBootFront;\n }\n\n\n async getHtml(url: string) {\n if (this.simpleBootFront && (this.simpleBootFront.option.window as any).ssrUse) {\n\n } else if (this.simpleBootFront) {\n (this.simpleBootFront.option.window as any).ssrUse = true;\n delete (this.simpleBootFront.option.window as any).server_side_data;\n\n // run\n await this.simpleBootFront.goRouting(url);\n let html = this.simpleBootFront.option.window.document.documentElement.outerHTML;\n\n const serverSideData = (this.simpleBootFront.option.window as any).server_side_data;\n if (serverSideData) {\n const data = Object.entries(serverSideData).map(([k, v]) => {\n if (typeof v === 'string') {\n return `window.server_side_data.${k} = ${v}`;\n } else {\n return `window.server_side_data.${k} = ${JSON.stringify(v)}`;\n }\n }).join(';');\n if (data) {\n html = html.replace('</head>', `<script> window.server_side_data={}; ${data}; </script></head>`);\n }\n }\n\n this.makeFront().then(it => {\n this.simpleBootFront = it;\n });\n return html;\n } {\n\n }\n\n }\n}"],
|
|
5
|
+
"mappings": "AAAA,SAA0B,mBAAmB;AAE7C,SAAQ,wBAAuB;AAIxB,MAAM,UAAU;AAAA,EAInB,YAAmB,SAAkC,kBAAmD;AAArF;AAAkC;AAHrD,SAAO,YAAY;AAAA,EAKnB;AAAA,EAEA,MAAM,MAAM;AACR,SAAK,kBAAkB,MAAM,KAAK,UAAU;AAAA,EAChD;AAAA,EAEA,MAAM,YAAY;AACd,UAAM,QAAQ,MAAM,IAAI,iBAAiB,KAAK,QAAQ,eAAe,KAAK,QAAQ,0BAA0B,cAAc,EAAC,KAAK,KAAK,UAAS,CAAC,EAAE,IAAI;AACrJ,WAAO;AAAA,EACX;AAAA,EAEA,MAAM,UAAU,OAAqB;AACjC,QAAI,CAAC,OAAO;AACR,cAAQ,MAAM,KAAK,UAAU;AAAA,IACjC;AACA,UAAM,OAAO,YAAY,KAAK;AAE9B,UAAM,SAAS,MAAM;AACrB,IAAC,OAAe,SAAS;AACzB,UAAM,SAAS,KAAK,QAAQ,sBAAsB,MAAM;AAExD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
|
+
"sourcesContent": ["export * from '@dooboostore/simple-boot-http-server/filters/IntentSchemeFilter';\nexport * from './SSRFilter';\nexport * from './SSRWorker';"],
|
|
5
5
|
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export * from "./decorators/index.js";
|
|
2
|
+
export * from "./filters/index.js";
|
|
3
|
+
export * from "./initializers/index.js";
|
|
4
|
+
export * from "./option/index.js";
|
|
5
|
+
export * from "./proxy/index.js";
|
|
6
|
+
export * from "./SimpleBootHttpSSRFactory.js";
|
|
7
|
+
export * from "./SimpleBootHttpSSRServer.js";
|
|
5
8
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export * from './decorators';\nexport * from './filters';\nexport * from './initializers';\nexport * from './option';\nexport * from './proxy';\nexport * from './SimpleBootHttpSSRFactory';\nexport * from './SimpleBootHttpSSRServer';"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { DomParser } from "@dooboostore/dom-parser";
|
|
4
|
+
class DomParserInitializer {
|
|
5
|
+
constructor(frontDistPath, frontDistIndexFileName, reconfigureSettings) {
|
|
6
|
+
this.frontDistPath = frontDistPath;
|
|
7
|
+
this.frontDistIndexFileName = frontDistIndexFileName;
|
|
8
|
+
this.reconfigureSettings = reconfigureSettings;
|
|
9
|
+
}
|
|
10
|
+
static loadFile(distPath, filePath) {
|
|
11
|
+
return fs.readFileSync(path.join(distPath, filePath), "utf8");
|
|
12
|
+
}
|
|
13
|
+
async run() {
|
|
14
|
+
const pathStr = path.join(this.frontDistPath, this.frontDistIndexFileName);
|
|
15
|
+
const html = fs.readFileSync(pathStr, "utf8");
|
|
16
|
+
this.domParser = new DomParser(html, { href: this.reconfigureSettings?.url });
|
|
17
|
+
const w = this.domParser.window;
|
|
18
|
+
w.location ??= { href: "about:blank" };
|
|
19
|
+
if (this.reconfigureSettings?.url) {
|
|
20
|
+
w.location.href = this.reconfigureSettings.url;
|
|
21
|
+
}
|
|
22
|
+
global.Event = w.Event;
|
|
23
|
+
global.PopStateEvent = w.Event;
|
|
24
|
+
global.IntersectionObserver = w.IntersectionObserver;
|
|
25
|
+
global.NodeFilter = w.NodeFilter;
|
|
26
|
+
global.Node = w.Node;
|
|
27
|
+
global.DocumentFragment = w.DocumentFragment;
|
|
28
|
+
global.HTMLElement = w.HTMLElement;
|
|
29
|
+
global.HTMLMetaElement = w.HTMLMetaElement;
|
|
30
|
+
global.Element = w.Element;
|
|
31
|
+
global.HTMLCanvasElement = w.HTMLCanvasElement;
|
|
32
|
+
global.HTMLCanvasElement.prototype.getContext = () => {
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
global.CanvasRenderingContext2D = w.CanvasRenderingContext2D;
|
|
36
|
+
global.CanvasPattern = w.CanvasPattern;
|
|
37
|
+
global.CanvasGradient = w.CanvasGradient;
|
|
38
|
+
global.Path2D = w.Path2D;
|
|
39
|
+
global.ImageData = w.ImageData;
|
|
40
|
+
return w;
|
|
41
|
+
}
|
|
42
|
+
destroy() {
|
|
43
|
+
this.domParser?.destroy();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
DomParserInitializer
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=DomParserInitializer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/initializers/DomParserInitializer.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'fs';\nimport path from 'path';\nimport { DomParser } from '@dooboostore/dom-parser';\n\nexport class DomParserInitializer {\n private domParser: DomParser;\n constructor(\n private frontDistPath: string,\n private frontDistIndexFileName: string,\n private reconfigureSettings?: {url: string}\n ) {}\n\n public static loadFile(distPath: string, filePath: string): string {\n return fs.readFileSync(path.join(distPath, filePath), 'utf8');\n }\n\n async run(): Promise<Window> {\n // const indexHTML = fs.readFileSync(path.join(this.frontDistPath, 'index.html'), 'utf8');\n // const indexHTML = JsdomInitializer.loadFile(this.frontDistPath, this.frontDistIndexFileName);\n const pathStr = path.join(this.frontDistPath, this.frontDistIndexFileName);\n\n const html = fs.readFileSync(pathStr,'utf8');\n\n this.domParser = new DomParser(html, {href: this.reconfigureSettings?.url});\n const w = this.domParser.window as unknown as Window & typeof globalThis;\n\n // @ts-ignore\n w.location ??= { href: 'about:blank'};\n if(this.reconfigureSettings?.url){\n // console.log('--',w,w.location);\n // @ts-ignore\n w.location.href = this.reconfigureSettings.url;\n }\n // console.log('!!!!!!!!!!!', html, w.document);\n // @ts-ignore\n // global.document = w.document;\n // @ts-ignore\n // global.window = w as unknown as Window & typeof globalThis;\n // @ts-ignore\n // global.window.requestAnimationFrame = () => {};\n // global.window.scrollTo = () => {};\n // @ts-ignore\n // global.history = w.history;\n global.Event = w.Event;\n // @ts-ignore\n global.PopStateEvent = w.Event;\n global.IntersectionObserver = w.IntersectionObserver;\n // @ts-ignore\n // global.Error = ErrorBase;\n // @ts-ignore\n // global.navigator = w.navigator;\n global.NodeFilter = w.NodeFilter;\n global.Node = w.Node;\n global.DocumentFragment = w.DocumentFragment;\n global.HTMLElement = w.HTMLElement;\n global.HTMLMetaElement = w.HTMLMetaElement;\n global.Element = w.Element;\n global.HTMLCanvasElement = w.HTMLCanvasElement;\n global.HTMLCanvasElement.prototype.getContext = () => {\n return null;\n };\n global.CanvasRenderingContext2D = w.CanvasRenderingContext2D;\n global.CanvasPattern = w.CanvasPattern;\n global.CanvasGradient = w.CanvasGradient;\n global.Path2D = w.Path2D;\n global.ImageData = w.ImageData;\n // console.log('cvvvvvvvvvvvvvv', w.Node.DOCUMENT_FRAGMENT_NODE);\n return w;\n }\n\n destroy(): void {\n this.domParser?.destroy();\n }\n\n}\n//\n// export default new JsdomInitializer();\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAEnB,MAAM,qBAAqB;AAAA,EAEhC,YACU,eACA,wBACA,qBACR;AAHQ;AACA;AACA;AAAA,EACP;AAAA,EAEH,OAAc,SAAS,UAAkB,UAA0B;AACjE,WAAO,GAAG,aAAa,KAAK,KAAK,UAAU,QAAQ,GAAG,MAAM;AAAA,EAC9D;AAAA,EAEA,MAAM,MAAuB;AAG3B,UAAM,UAAU,KAAK,KAAK,KAAK,eAAe,KAAK,sBAAsB;AAEzE,UAAM,OAAO,GAAG,aAAa,SAAQ,MAAM;AAE3C,SAAK,YAAY,IAAI,UAAU,MAAM,EAAC,MAAM,KAAK,qBAAqB,IAAG,CAAC;AAC1E,UAAM,IAAI,KAAK,UAAU;AAGzB,MAAE,aAAa,EAAE,MAAM,cAAa;AACpC,QAAG,KAAK,qBAAqB,KAAI;AAG/B,QAAE,SAAS,OAAO,KAAK,oBAAoB;AAAA,IAC7C;AAWA,WAAO,QAAQ,EAAE;AAEjB,WAAO,gBAAgB,EAAE;AACzB,WAAO,uBAAuB,EAAE;AAKhC,WAAO,aAAa,EAAE;AACtB,WAAO,OAAO,EAAE;AAChB,WAAO,mBAAmB,EAAE;AAC5B,WAAO,cAAc,EAAE;AACvB,WAAO,kBAAkB,EAAE;AAC3B,WAAO,UAAU,EAAE;AACnB,WAAO,oBAAoB,EAAE;AAC7B,WAAO,kBAAkB,UAAU,aAAa,MAAM;AACpD,aAAO;AAAA,IACT;AACA,WAAO,2BAA2B,EAAE;AACpC,WAAO,gBAAgB,EAAE;AACzB,WAAO,iBAAiB,EAAE;AAC1B,WAAO,SAAS,EAAE;AAClB,WAAO,YAAY,EAAE;AAErB,WAAO;AAAA,EACT;AAAA,EAEA,UAAgB;AACd,SAAK,WAAW,QAAQ;AAAA,EAC1B;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __decorate = function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = function(k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = function(paramIndex, decorator) {
|
|
11
|
+
return function(target, key) {
|
|
12
|
+
decorator(target, key, paramIndex);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
var _a;
|
|
16
|
+
import { Sim, getSim } from "@dooboostore/simple-boot";
|
|
17
|
+
import { SimpleBootFront } from "@dooboostore/simple-boot-front";
|
|
18
|
+
import { ValidUtils } from "@dooboostore/core-web";
|
|
19
|
+
import { Inject } from "@dooboostore/simple-boot";
|
|
20
|
+
let SSRDomParserFilterDataHydrationProxy = class SSRDomParserFilterDataHydrationProxy2 {
|
|
21
|
+
constructor(simpleBootFront) {
|
|
22
|
+
this.simpleBootFront = simpleBootFront;
|
|
23
|
+
}
|
|
24
|
+
get(target, prop, receiver) {
|
|
25
|
+
const value = Reflect.get(target, prop, receiver);
|
|
26
|
+
let current = target;
|
|
27
|
+
let simConfig = getSim(current);
|
|
28
|
+
if (typeof value === "function" && simConfig?.symbol) {
|
|
29
|
+
const methodName = String(prop);
|
|
30
|
+
const symbolStr = simConfig.symbol.toString();
|
|
31
|
+
return (...args) => {
|
|
32
|
+
const pureArgs = args.filter((it) => typeof it !== "function");
|
|
33
|
+
const key = `${symbolStr}.${methodName}(${JSON.stringify(pureArgs)})`;
|
|
34
|
+
if (ValidUtils.isBrowser()) {
|
|
35
|
+
const hydratedData = this.simpleBootFront.cutDataHydration(key);
|
|
36
|
+
if (hydratedData !== void 0) {
|
|
37
|
+
return Promise.resolve(hydratedData);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const result = Reflect.apply(value, target, args);
|
|
41
|
+
if (!ValidUtils.isBrowser()) {
|
|
42
|
+
const saveData = (data) => {
|
|
43
|
+
this.simpleBootFront.saveDataHydration(key, data);
|
|
44
|
+
};
|
|
45
|
+
if (result instanceof Promise) {
|
|
46
|
+
return result.then((data) => {
|
|
47
|
+
saveData(data);
|
|
48
|
+
return data;
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
saveData(result);
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
SSRDomParserFilterDataHydrationProxy = __decorate([
|
|
62
|
+
Sim,
|
|
63
|
+
__param(0, Inject({ type: SimpleBootFront })),
|
|
64
|
+
__metadata("design:paramtypes", [typeof (_a = typeof SimpleBootFront !== "undefined" && SimpleBootFront) === "function" ? _a : Object])
|
|
65
|
+
], SSRDomParserFilterDataHydrationProxy);
|
|
66
|
+
export {
|
|
67
|
+
SSRDomParserFilterDataHydrationProxy
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=SSRDomParserFilterDataHydrationProxy.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/proxy/SSRDomParserFilterDataHydrationProxy.ts"],
|
|
4
|
+
"sourcesContent": ["import { Sim, getSim } from '@dooboostore/simple-boot';\nimport { SimpleBootFront } from '@dooboostore/simple-boot-front';\nimport { ValidUtils } from '@dooboostore/core-web';\nimport { Inject } from '@dooboostore/simple-boot';\n\n@Sim\nexport class SSRDomParserFilterDataHydrationProxy implements ProxyHandler<any> {\n constructor(@Inject({ type: SimpleBootFront }) private simpleBootFront: SimpleBootFront) {}\n\n get(target: any, prop: string | symbol, receiver: any): any {\n const value = Reflect.get(target, prop, receiver);\n let current: any = target;\n let simConfig = getSim(current);\n // console.log('SSRDomParserFilterDataHydrationProxy*****', simConfig);\n // while (!simConfig && current && typeof current === 'object') {\n // const origin = current._SimpleBoot_origin ?? current._domRender_origin ?? current._DomRender_origin ?? current.__target__;\n // if (origin && origin !== current) {\n // current = origin;\n // simConfig = getSim(current);\n // } else {\n // break;\n // }\n // }\n\n if (typeof value === 'function' && simConfig?.symbol) {\n const methodName = String(prop);\n const symbolStr = simConfig.symbol.toString();\n\n return (...args: any[]) => {\n const pureArgs = args.filter(it => typeof it !== 'function');\n const key = `${symbolStr}.${methodName}(${JSON.stringify(pureArgs)})`;\n\n if (ValidUtils.isBrowser()) {\n const hydratedData = this.simpleBootFront.cutDataHydration(key);\n if (hydratedData !== undefined) {\n return Promise.resolve(hydratedData);\n }\n }\n\n const result = Reflect.apply(value, target, args);\n\n if (!ValidUtils.isBrowser()) {\n const saveData = (data: any) => {\n this.simpleBootFront.saveDataHydration(key, data);\n };\n\n if (result instanceof Promise) {\n return result.then(data => {\n saveData(data);\n return data;\n });\n } else {\n saveData(result);\n return result;\n }\n }\n\n return result;\n };\n }\n return value;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA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",
|
|
6
|
+
"names": ["SSRDomParserFilterDataHydrationProxy"]
|
|
7
|
+
}
|
package/dist/esm/proxy/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./IntentSchemeServerProxy.js";
|
|
3
|
-
export * from "./SymbolIntentApiServiceProxy.js";
|
|
4
|
-
export * from "./SymbolIntentApiServiceProxyBase.js";
|
|
1
|
+
export * from "./SSRDomParserFilterDataHydrationProxy.js";
|
|
5
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/proxy/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './
|
|
5
|
-
"mappings": "AAAA,cAAc;
|
|
4
|
+
"sourcesContent": ["export * from './SSRDomParserFilterDataHydrationProxy';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|