@dooboostore/simple-boot-http-server-ssr 1.0.14 → 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.
Files changed (157) hide show
  1. package/README.MD +131 -0
  2. package/dist/cjs/SimpleBootHttpSSRFactory.js.map +1 -1
  3. package/dist/cjs/SimpleBootHttpSSRServer.js +1 -0
  4. package/dist/cjs/SimpleBootHttpSSRServer.js.map +2 -2
  5. package/dist/cjs/bundle-entry.js +0 -2
  6. package/dist/cjs/bundle-entry.js.map +2 -2
  7. package/dist/cjs/decorators/LoadAroundBefore.js +2 -2
  8. package/dist/cjs/decorators/LoadAroundBefore.js.map +2 -2
  9. package/dist/cjs/filters/SSRDomParserFilter.js +54 -89
  10. package/dist/cjs/filters/SSRDomParserFilter.js.map +2 -2
  11. package/dist/cjs/filters/SSRFilter.js +10 -14
  12. package/dist/cjs/filters/SSRFilter.js.map +2 -2
  13. package/dist/cjs/filters/SSRLinkDomDomFilter.js +10 -14
  14. package/dist/cjs/filters/SSRLinkDomDomFilter.js.map +2 -2
  15. package/dist/cjs/filters/SSRSimpleWebComponentFilter.js +93 -0
  16. package/dist/cjs/filters/SSRSimpleWebComponentFilter.js.map +7 -0
  17. package/dist/cjs/filters/SSRWorker.js +2 -2
  18. package/dist/cjs/filters/SSRWorker.js.map +2 -2
  19. package/dist/cjs/filters/index.js +2 -2
  20. package/dist/cjs/filters/index.js.map +2 -2
  21. package/dist/cjs/index.js +18 -8
  22. package/dist/cjs/index.js.map +2 -2
  23. package/dist/cjs/initializers/DomParserInitializer.js +5 -2
  24. package/dist/cjs/initializers/DomParserInitializer.js.map +2 -2
  25. package/dist/cjs/proxy/SSRDomParserFilterDataHydrationProxy.js +92 -0
  26. package/dist/cjs/proxy/SSRDomParserFilterDataHydrationProxy.js.map +7 -0
  27. package/dist/cjs/proxy/index.js +2 -8
  28. package/dist/cjs/proxy/index.js.map +2 -2
  29. package/dist/esm/SimpleBootHttpSSRFactory.js.map +1 -1
  30. package/dist/esm/SimpleBootHttpSSRServer.js +1 -0
  31. package/dist/esm/SimpleBootHttpSSRServer.js.map +2 -2
  32. package/dist/esm/bundle-entry.js +0 -1
  33. package/dist/esm/bundle-entry.js.map +2 -2
  34. package/dist/esm/decorators/LoadAroundBefore.js +1 -1
  35. package/dist/esm/decorators/LoadAroundBefore.js.map +1 -1
  36. package/dist/esm/filters/SSRDomParserFilter.js +52 -87
  37. package/dist/esm/filters/SSRDomParserFilter.js.map +2 -2
  38. package/dist/esm/filters/SSRFilter.js +7 -11
  39. package/dist/esm/filters/SSRFilter.js.map +2 -2
  40. package/dist/esm/filters/SSRLinkDomDomFilter.js +7 -11
  41. package/dist/esm/filters/SSRLinkDomDomFilter.js.map +2 -2
  42. package/dist/esm/filters/SSRSimpleWebComponentFilter.js +70 -0
  43. package/dist/esm/filters/SSRSimpleWebComponentFilter.js.map +7 -0
  44. package/dist/esm/filters/SSRWorker.js +1 -1
  45. package/dist/esm/filters/SSRWorker.js.map +2 -2
  46. package/dist/esm/filters/index.js +1 -1
  47. package/dist/esm/filters/index.js.map +1 -1
  48. package/dist/esm/index.js +7 -4
  49. package/dist/esm/index.js.map +2 -2
  50. package/dist/esm/initializers/DomParserInitializer.js +6 -3
  51. package/dist/esm/initializers/DomParserInitializer.js.map +2 -2
  52. package/dist/esm/proxy/SSRDomParserFilterDataHydrationProxy.js +69 -0
  53. package/dist/esm/proxy/SSRDomParserFilterDataHydrationProxy.js.map +7 -0
  54. package/dist/esm/proxy/index.js +1 -4
  55. package/dist/esm/proxy/index.js.map +2 -2
  56. package/dist/esm-bundle/dooboostore-simple-boot-http-server-ssr.esm.js +20723 -8294
  57. package/dist/esm-bundle/dooboostore-simple-boot-http-server-ssr.esm.js.map +4 -4
  58. package/dist/types/SimpleBootHttpSSRFactory.d.ts +1 -1
  59. package/dist/types/SimpleBootHttpSSRFactory.d.ts.map +1 -1
  60. package/dist/types/SimpleBootHttpSSRServer.d.ts +3 -2
  61. package/dist/types/SimpleBootHttpSSRServer.d.ts.map +1 -1
  62. package/dist/types/bundle-entry.d.ts +0 -1
  63. package/dist/types/bundle-entry.d.ts.map +1 -1
  64. package/dist/types/filters/SSRDomParserFilter.d.ts +10 -16
  65. package/dist/types/filters/SSRDomParserFilter.d.ts.map +1 -1
  66. package/dist/types/filters/SSRFilter.d.ts +1 -1
  67. package/dist/types/filters/SSRFilter.d.ts.map +1 -1
  68. package/dist/types/filters/SSRLinkDomDomFilter.d.ts +1 -1
  69. package/dist/types/filters/SSRLinkDomDomFilter.d.ts.map +1 -1
  70. package/dist/types/filters/SSRSimpleWebComponentFilter.d.ts +37 -0
  71. package/dist/types/filters/SSRSimpleWebComponentFilter.d.ts.map +1 -0
  72. package/dist/types/filters/SSRWorker.d.ts +1 -1
  73. package/dist/types/filters/SSRWorker.d.ts.map +1 -1
  74. package/dist/types/filters/index.d.ts +1 -1
  75. package/dist/types/filters/index.d.ts.map +1 -1
  76. package/dist/types/index.d.ts +7 -2
  77. package/dist/types/index.d.ts.map +1 -1
  78. package/dist/types/initializers/DomParserInitializer.d.ts +2 -0
  79. package/dist/types/initializers/DomParserInitializer.d.ts.map +1 -1
  80. package/dist/types/proxy/SSRDomParserFilterDataHydrationProxy.d.ts +7 -0
  81. package/dist/types/proxy/SSRDomParserFilterDataHydrationProxy.d.ts.map +1 -0
  82. package/dist/types/proxy/index.d.ts +1 -4
  83. package/dist/types/proxy/index.d.ts.map +1 -1
  84. package/dist/umd-bundle/dooboostore-simple-boot-http-server-ssr.umd.js +20726 -8301
  85. package/dist/umd-bundle/dooboostore-simple-boot-http-server-ssr.umd.js.map +4 -4
  86. package/package.json +16 -10
  87. package/src/SimpleBootHttpSSRFactory.ts +1 -1
  88. package/src/SimpleBootHttpSSRServer.ts +5 -3
  89. package/src/bundle-entry.ts +0 -1
  90. package/src/decorators/LoadAroundBefore.ts +1 -1
  91. package/src/filters/SSRDomParserFilter.ts +111 -124
  92. package/src/filters/SSRFilter.ts +7 -12
  93. package/src/filters/SSRLinkDomDomFilter.ts +7 -12
  94. package/src/filters/SSRSimpleWebComponentFilter.ts +103 -0
  95. package/src/filters/SSRWorker.ts +1 -2
  96. package/src/filters/index.ts +1 -1
  97. package/src/index.ts +7 -9
  98. package/src/initializers/DomParserInitializer.ts +9 -2
  99. package/src/proxy/SSRDomParserFilterDataHydrationProxy.ts +63 -0
  100. package/src/proxy/index.ts +1 -4
  101. package/tsconfig.json +1 -0
  102. package/dist/cjs/codes/HttpHeaders.js +0 -41
  103. package/dist/cjs/codes/HttpHeaders.js.map +0 -7
  104. package/dist/cjs/codes/Mimes.js +0 -33
  105. package/dist/cjs/codes/Mimes.js.map +0 -7
  106. package/dist/cjs/codes/index.js +0 -24
  107. package/dist/cjs/codes/index.js.map +0 -7
  108. package/dist/cjs/filters/IntentSchemeFilter.js +0 -92
  109. package/dist/cjs/filters/IntentSchemeFilter.js.map +0 -7
  110. package/dist/cjs/proxy/IntentSchemeFrontProxy.js +0 -87
  111. package/dist/cjs/proxy/IntentSchemeFrontProxy.js.map +0 -7
  112. package/dist/cjs/proxy/IntentSchemeServerProxy.js +0 -67
  113. package/dist/cjs/proxy/IntentSchemeServerProxy.js.map +0 -7
  114. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js +0 -138
  115. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js.map +0 -7
  116. package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js +0 -35
  117. package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js.map +0 -7
  118. package/dist/esm/codes/HttpHeaders.js +0 -17
  119. package/dist/esm/codes/HttpHeaders.js.map +0 -7
  120. package/dist/esm/codes/Mimes.js +0 -10
  121. package/dist/esm/codes/Mimes.js.map +0 -7
  122. package/dist/esm/codes/index.js +0 -3
  123. package/dist/esm/codes/index.js.map +0 -7
  124. package/dist/esm/filters/IntentSchemeFilter.js +0 -69
  125. package/dist/esm/filters/IntentSchemeFilter.js.map +0 -7
  126. package/dist/esm/proxy/IntentSchemeFrontProxy.js +0 -64
  127. package/dist/esm/proxy/IntentSchemeFrontProxy.js.map +0 -7
  128. package/dist/esm/proxy/IntentSchemeServerProxy.js +0 -44
  129. package/dist/esm/proxy/IntentSchemeServerProxy.js.map +0 -7
  130. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js +0 -115
  131. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js.map +0 -7
  132. package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js +0 -12
  133. package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js.map +0 -7
  134. package/dist/types/codes/HttpHeaders.d.ts +0 -45
  135. package/dist/types/codes/HttpHeaders.d.ts.map +0 -1
  136. package/dist/types/codes/Mimes.d.ts +0 -31
  137. package/dist/types/codes/Mimes.d.ts.map +0 -1
  138. package/dist/types/codes/index.d.ts +0 -3
  139. package/dist/types/codes/index.d.ts.map +0 -1
  140. package/dist/types/filters/IntentSchemeFilter.d.ts +0 -20
  141. package/dist/types/filters/IntentSchemeFilter.d.ts.map +0 -1
  142. package/dist/types/proxy/IntentSchemeFrontProxy.d.ts +0 -4
  143. package/dist/types/proxy/IntentSchemeFrontProxy.d.ts.map +0 -1
  144. package/dist/types/proxy/IntentSchemeServerProxy.d.ts +0 -4
  145. package/dist/types/proxy/IntentSchemeServerProxy.d.ts.map +0 -1
  146. package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts +0 -18
  147. package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts.map +0 -1
  148. package/dist/types/proxy/SymbolIntentApiServiceProxyBase.d.ts +0 -5
  149. package/dist/types/proxy/SymbolIntentApiServiceProxyBase.d.ts.map +0 -1
  150. package/src/codes/HttpHeaders.ts +0 -17
  151. package/src/codes/Mimes.ts +0 -6
  152. package/src/codes/index.ts +0 -2
  153. package/src/filters/IntentSchemeFilter.ts +0 -69
  154. package/src/proxy/IntentSchemeFrontProxy.ts +0 -67
  155. package/src/proxy/IntentSchemeServerProxy.ts +0 -35
  156. package/src/proxy/SymbolIntentApiServiceProxy.ts +0 -115
  157. package/src/proxy/SymbolIntentApiServiceProxyBase.ts +0 -19
@@ -0,0 +1,92 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var SSRDomParserFilterDataHydrationProxy_exports = {};
19
+ __export(SSRDomParserFilterDataHydrationProxy_exports, {
20
+ SSRDomParserFilterDataHydrationProxy: () => SSRDomParserFilterDataHydrationProxy
21
+ });
22
+ module.exports = __toCommonJS(SSRDomParserFilterDataHydrationProxy_exports);
23
+ var import_simple_boot = require("@dooboostore/simple-boot");
24
+ var import_simple_boot_front = require("@dooboostore/simple-boot-front");
25
+ var import_core_web = require("@dooboostore/core-web");
26
+ var import_simple_boot2 = require("@dooboostore/simple-boot");
27
+ var __decorate = function(decorators, target, key, desc) {
28
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30
+ 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;
31
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
32
+ };
33
+ var __metadata = function(k, v) {
34
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35
+ };
36
+ var __param = function(paramIndex, decorator) {
37
+ return function(target, key) {
38
+ decorator(target, key, paramIndex);
39
+ };
40
+ };
41
+ var _a;
42
+ let SSRDomParserFilterDataHydrationProxy = class SSRDomParserFilterDataHydrationProxy2 {
43
+ constructor(simpleBootFront) {
44
+ this.simpleBootFront = simpleBootFront;
45
+ }
46
+ get(target, prop, receiver) {
47
+ const value = Reflect.get(target, prop, receiver);
48
+ let current = target;
49
+ let simConfig = (0, import_simple_boot.getSim)(current);
50
+ if (typeof value === "function" && simConfig?.symbol) {
51
+ const methodName = String(prop);
52
+ const symbolStr = simConfig.symbol.toString();
53
+ return (...args) => {
54
+ const pureArgs = args.filter((it) => typeof it !== "function");
55
+ const key = `${symbolStr}.${methodName}(${JSON.stringify(pureArgs)})`;
56
+ if (import_core_web.ValidUtils.isBrowser()) {
57
+ const hydratedData = this.simpleBootFront.cutDataHydration(key);
58
+ if (hydratedData !== void 0) {
59
+ return Promise.resolve(hydratedData);
60
+ }
61
+ }
62
+ const result = Reflect.apply(value, target, args);
63
+ if (!import_core_web.ValidUtils.isBrowser()) {
64
+ const saveData = (data) => {
65
+ this.simpleBootFront.saveDataHydration(key, data);
66
+ };
67
+ if (result instanceof Promise) {
68
+ return result.then((data) => {
69
+ saveData(data);
70
+ return data;
71
+ });
72
+ } else {
73
+ saveData(result);
74
+ return result;
75
+ }
76
+ }
77
+ return result;
78
+ };
79
+ }
80
+ return value;
81
+ }
82
+ };
83
+ SSRDomParserFilterDataHydrationProxy = __decorate([
84
+ import_simple_boot.Sim,
85
+ __param(0, (0, import_simple_boot2.Inject)({ type: import_simple_boot_front.SimpleBootFront })),
86
+ __metadata("design:paramtypes", [typeof (_a = typeof import_simple_boot_front.SimpleBootFront !== "undefined" && import_simple_boot_front.SimpleBootFront) === "function" ? _a : Object])
87
+ ], SSRDomParserFilterDataHydrationProxy);
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ SSRDomParserFilterDataHydrationProxy
91
+ });
92
+ //# 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 }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uDAA0B,6CAAe,eAAf,8CAAe,aAAA,KAAA,MAAA,CAAA;GAD5E,oCAAoC;",
6
+ "names": ["import_simple_boot", "SSRDomParserFilterDataHydrationProxy"]
7
+ }
@@ -14,15 +14,9 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
15
  var proxy_exports = {};
16
16
  module.exports = __toCommonJS(proxy_exports);
17
- __reExport(proxy_exports, require("./IntentSchemeFrontProxy"), module.exports);
18
- __reExport(proxy_exports, require("./IntentSchemeServerProxy"), module.exports);
19
- __reExport(proxy_exports, require("./SymbolIntentApiServiceProxy"), module.exports);
20
- __reExport(proxy_exports, require("./SymbolIntentApiServiceProxyBase"), module.exports);
17
+ __reExport(proxy_exports, require("./SSRDomParserFilterDataHydrationProxy"), module.exports);
21
18
  // Annotate the CommonJS export names for ESM import in node:
22
19
  0 && (module.exports = {
23
- ...require("./IntentSchemeFrontProxy"),
24
- ...require("./IntentSchemeServerProxy"),
25
- ...require("./SymbolIntentApiServiceProxy"),
26
- ...require("./SymbolIntentApiServiceProxyBase")
20
+ ...require("./SSRDomParserFilterDataHydrationProxy")
27
21
  });
28
22
  //# 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 './IntentSchemeFrontProxy';\nexport * from './IntentSchemeServerProxy';\nexport * from './SymbolIntentApiServiceProxy';\nexport * from './SymbolIntentApiServiceProxyBase';"],
5
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,qCAAd;AACA,0BAAc,sCADd;AAEA,0BAAc,0CAFd;AAGA,0BAAc,8CAHd;",
4
+ "sourcesContent": ["export * from './SSRDomParserFilterDataHydrationProxy';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,mDAAd;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SimpleBootHttpSSRFactory.ts"],
4
- "sourcesContent": ["import { SimpleBootFront } from '@dooboostore/simple-boot-front/SimpleBootFront';\nimport { ConstructorType } from '@dooboostore/core/types';\nimport { SimFrontOption } from '@dooboostore/simple-boot-front/option/SimFrontOption';\nexport abstract class SimpleBootHttpSSRFactory {\n public abstract factory(simFrontOption: SimFrontOption, using: (ConstructorType<any> | Function)[], domExcludes: ConstructorType<any>[]): Promise<SimpleBootFront> ;\n\n public async create(simFrontOption: SimFrontOption, using: (ConstructorType<any> | Function)[] = [], domExcludes: ConstructorType<any>[] = []): Promise<SimpleBootFront> {\n const front = await this.factory(simFrontOption, using, domExcludes);\n return front;\n }\n}\n"],
4
+ "sourcesContent": ["import { SimpleBootFront } from '@dooboostore/simple-boot-front/SimpleBootFront';\nimport { ConstructorType } from '@dooboostore/core';\nimport { SimFrontOption } from '@dooboostore/simple-boot-front/option/SimFrontOption';\nexport abstract class SimpleBootHttpSSRFactory {\n public abstract factory(simFrontOption: SimFrontOption, using: (ConstructorType<any> | Function)[], domExcludes: ConstructorType<any>[]): Promise<SimpleBootFront> ;\n\n public async create(simFrontOption: SimFrontOption, using: (ConstructorType<any> | Function)[] = [], domExcludes: ConstructorType<any>[] = []): Promise<SimpleBootFront> {\n const front = await this.factory(simFrontOption, using, domExcludes);\n return front;\n }\n}\n"],
5
5
  "mappings": "AAGO,MAAe,yBAAyB;AAAA,EAG3C,MAAa,OAAO,gBAAgC,QAA6C,CAAC,GAAG,cAAsC,CAAC,GAA6B;AACrK,UAAM,QAAQ,MAAM,KAAK,QAAQ,gBAAgB,OAAO,WAAW;AACnE,WAAO;AAAA,EACX;AACJ;",
6
6
  "names": []
7
7
  }
@@ -5,6 +5,7 @@ class SimpleBootHttpSSRServer extends SimpleBootHttpServer {
5
5
  }
6
6
  run(otherInstanceSim) {
7
7
  const oi = /* @__PURE__ */ new Map();
8
+ oi.set(SimpleBootHttpSSRServer, this);
8
9
  otherInstanceSim?.forEach((value, key) => oi.set(key, value));
9
10
  return super.run(oi);
10
11
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SimpleBootHttpSSRServer.ts"],
4
- "sourcesContent": ["import { SimpleBootHttpServer } from '@dooboostore/simple-boot-http-server/SimpleBootHttpServer';\n// import { SimstanceManager } from '@dooboostore/simple-boot/simstance/SimstanceManager';\nimport { HttpSSRServerOption } from './option/HttpSSRServerOption';\nimport { ConstructorType } from '@dooboostore/core/types';\n\nexport class SimpleBootHttpSSRServer extends SimpleBootHttpServer {\n constructor(option?: HttpSSRServerOption) {\n super(option)\n }\n\n run(otherInstanceSim?: Map<ConstructorType<any>, any>) {\n const oi = new Map<ConstructorType<any>, any>()\n otherInstanceSim?.forEach((value, key) => oi.set(key, value));\n return super.run(oi);\n }\n\n // TODO: \uB098\uC911\uC5D0 \uBB50\uB77C\uB3C4..\n stop(){\n\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,4BAA4B;AAK9B,MAAM,gCAAgC,qBAAqB;AAAA,EAChE,YAAY,QAA8B;AACxC,UAAM,MAAM;AAAA,EACd;AAAA,EAEA,IAAI,kBAAmD;AACrD,UAAM,KAAK,oBAAI,IAA+B;AAC9C,sBAAkB,QAAQ,CAAC,OAAO,QAAQ,GAAG,IAAI,KAAK,KAAK,CAAC;AAC5D,WAAO,MAAM,IAAI,EAAE;AAAA,EACrB;AAAA;AAAA,EAGA,OAAM;AAAA,EAEN;AACF;",
4
+ "sourcesContent": ["import { SimpleBootHttpServer } from '@dooboostore/simple-boot-http-server/SimpleBootHttpServer';\n// import { SimstanceManager } from '@dooboostore/simple-boot/simstance/SimstanceManager';\nimport { HttpSSRServerOption } from './option/HttpSSRServerOption';\nimport { ConstructorType } from '@dooboostore/core';\nimport {SimConfig} from \"@dooboostore/simple-boot/decorators/SimDecorator\";\n\nexport class SimpleBootHttpSSRServer extends SimpleBootHttpServer {\n constructor(option?: HttpSSRServerOption) {\n super(option)\n }\n\n run(otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | Symbol, any>) {\n const oi = new Map<ConstructorType<any> | Function | SimConfig | Symbol, any>();\n oi.set(SimpleBootHttpSSRServer, this);\n otherInstanceSim?.forEach((value, key) => oi.set(key, value));\n return super.run(oi);\n }\n\n // TODO: \uB098\uC911\uC5D0 \uBB50\uB77C\uB3C4..\n stop(){\n\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,4BAA4B;AAM9B,MAAM,gCAAgC,qBAAqB;AAAA,EAChE,YAAY,QAA8B;AACxC,UAAM,MAAM;AAAA,EACd;AAAA,EAEA,IAAI,kBAAmF;AACrF,UAAM,KAAK,oBAAI,IAA+D;AAC9E,OAAG,IAAI,yBAAyB,IAAI;AACpC,sBAAkB,QAAQ,CAAC,OAAO,QAAQ,GAAG,IAAI,KAAK,KAAK,CAAC;AAC5D,WAAO,MAAM,IAAI,EAAE;AAAA,EACrB;AAAA;AAAA,EAGA,OAAM;AAAA,EAEN;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,3 @@
1
- export * from "./codes/index.js";
2
1
  export * from "./decorators/index.js";
3
2
  export * from "./filters/index.js";
4
3
  export * from "./initializers/index.js";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/bundle-entry.ts"],
4
- "sourcesContent": ["export * from './codes';\nexport * 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;AACd,cAAc;",
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
  }
@@ -1,6 +1,6 @@
1
1
  import { getSim } from "@dooboostore/simple-boot/decorators/SimDecorator";
2
2
  import { AroundForceReturn } from "@dooboostore/simple-boot/decorators/aop/AOPDecorator";
3
- import { ReflectUtils } from "@dooboostore/core/reflect/ReflectUtils";
3
+ import { ReflectUtils } from "@dooboostore/core";
4
4
  const LoadAroundBefore = (obj, propertyKey, args) => {
5
5
  const simstanceManager = obj._SimpleBoot_simstanceManager;
6
6
  const simOption = obj._SimpleBoot_simOption;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/LoadAroundBefore.ts"],
4
- "sourcesContent": ["import { getSim } from '@dooboostore/simple-boot/decorators/SimDecorator';\nimport { AroundForceReturn } from '@dooboostore/simple-boot/decorators/aop/AOPDecorator';\nimport { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\n\nexport const LoadAroundBefore = (obj: any, propertyKey: string, args: any[]) => {\n const simstanceManager = obj._SimpleBoot_simstanceManager;\n const simOption = obj._SimpleBoot_simOption;\n const config = getSim(obj);\n if (simstanceManager && simOption && config?.scheme) {\n const key = config.scheme + '_' + propertyKey;\n const type = ReflectUtils.getReturnType(obj, propertyKey);\n const isHas = (key in (simOption.window.server_side_data ?? {}))\n if (isHas) {\n const data = simOption.window.server_side_data?.[key];\n delete simOption.window.server_side_data?.[key];\n let rdata;\n if (type === Promise) {\n rdata = Promise.resolve(data);\n } else {\n rdata = data;\n }\n throw new AroundForceReturn(rdata);\n } else {\n return args;\n }\n }\n return args;\n}\n"],
4
+ "sourcesContent": ["import { getSim } from '@dooboostore/simple-boot/decorators/SimDecorator';\nimport { AroundForceReturn } from '@dooboostore/simple-boot/decorators/aop/AOPDecorator';\nimport { ReflectUtils } from '@dooboostore/core';\n\nexport const LoadAroundBefore = (obj: any, propertyKey: string, args: any[]) => {\n const simstanceManager = obj._SimpleBoot_simstanceManager;\n const simOption = obj._SimpleBoot_simOption;\n const config = getSim(obj);\n if (simstanceManager && simOption && config?.scheme) {\n const key = config.scheme + '_' + propertyKey;\n const type = ReflectUtils.getReturnType(obj, propertyKey);\n const isHas = (key in (simOption.window.server_side_data ?? {}))\n if (isHas) {\n const data = simOption.window.server_side_data?.[key];\n delete simOption.window.server_side_data?.[key];\n let rdata;\n if (type === Promise) {\n rdata = Promise.resolve(data);\n } else {\n rdata = data;\n }\n throw new AroundForceReturn(rdata);\n } else {\n return args;\n }\n }\n return args;\n}\n"],
5
5
  "mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAEtB,MAAM,mBAAmB,CAAC,KAAU,aAAqB,SAAgB;AAC5E,QAAM,mBAAmB,IAAI;AAC7B,QAAM,YAAY,IAAI;AACtB,QAAM,SAAS,OAAO,GAAG;AACzB,MAAI,oBAAoB,aAAa,QAAQ,QAAQ;AACjD,UAAM,MAAM,OAAO,SAAS,MAAM;AAClC,UAAM,OAAO,aAAa,cAAc,KAAK,WAAW;AACxD,UAAM,QAAS,QAAQ,UAAU,OAAO,oBAAoB,CAAC;AAC7D,QAAI,OAAO;AACP,YAAM,OAAO,UAAU,OAAO,mBAAmB,GAAG;AACpD,aAAO,UAAU,OAAO,mBAAmB,GAAG;AAC9C,UAAI;AACJ,UAAI,SAAS,SAAS;AAClB,gBAAQ,QAAQ,QAAQ,IAAI;AAAA,MAChC,OAAO;AACH,gBAAQ;AAAA,MACZ;AACA,YAAM,IAAI,kBAAkB,KAAK;AAAA,IACrC,OAAO;AACH,aAAO;AAAA,IACX;AAAA,EACJ;AACA,SAAO;AACX;",
6
6
  "names": []
7
7
  }
@@ -1,118 +1,96 @@
1
+ import { RequestResponse } from "@dooboostore/simple-boot-http-server/models/RequestResponse";
1
2
  import { HttpHeaders } from "@dooboostore/simple-boot-http-server/codes/HttpHeaders";
3
+ import { RandomUtils, MessageOperator, MessageInternal } from "@dooboostore/core";
2
4
  import { Mimes } from "@dooboostore/simple-boot-http-server/codes/Mimes";
3
5
  import { HttpStatus } from "@dooboostore/simple-boot-http-server/codes/HttpStatus";
4
- import { AsyncBlockingQueue } from "@dooboostore/core/queues/AsyncBlockingQueue";
5
- import { RandomUtils } from "@dooboostore/core/random/RandomUtils";
6
6
  import { NotFoundError } from "@dooboostore/simple-boot-http-server/errors/NotFoundError";
7
- import { DomRenderProxy } from "@dooboostore/dom-render/DomRenderProxy";
8
- import { filter } from "@dooboostore/core/message/operators/filter";
9
- import { first } from "@dooboostore/core/message/operators/first";
10
- import { firstValueFrom } from "@dooboostore/core/message/internal/firstValueFrom";
11
- import { Promises } from "@dooboostore/core/promise/Promises";
7
+ import { DomRenderProxy } from "@dooboostore/dom-render";
12
8
  import { DomParserInitializer } from "../initializers/DomParserInitializer.js";
13
9
  class SSRDomParserFilter {
10
+ // private poolGeneration = 0;
11
+ // private intervalId?: NodeJS.Timeout;
14
12
  constructor(config, otherInstanceSim) {
15
13
  this.config = config;
16
14
  this.otherInstanceSim = otherInstanceSim;
17
- this.simpleBootFrontPool = [];
18
- this.simpleBootFrontQueue = new AsyncBlockingQueue();
15
+ // private simpleBootFrontPool: SimpleBootFront[] = [];
16
+ // private simpleBootFrontQueue = new AsyncBlockingQueue<SimpleBootFront>();
19
17
  // private indexHTML: string;
20
18
  this.welcomUrl = "http://localhost";
21
- this.poolGeneration = 0;
22
19
  config.frontDistIndexFileName = config.frontDistIndexFileName || "index.html";
23
20
  }
24
21
  async onInit(app) {
25
- for (let i = 0; i < this.config.poolOption.min; i++) {
26
- await this.pushQueue();
27
- }
28
- if (this.config.poolOption.clearIntervalTime && this.config.poolOption.clearIntervalTime > 0) {
29
- this.intervalId = setInterval(() => {
30
- this.poolGeneration++;
31
- }, this.config.poolOption.clearIntervalTime);
32
- }
33
22
  }
34
23
  async onDestroy() {
35
- if (this.intervalId) {
36
- clearInterval(this.intervalId);
37
- }
38
- this.simpleBootFrontPool.forEach((front) => {
39
- front.jsdom?.window.close();
40
- });
41
- this.simpleBootFrontPool = [];
42
24
  }
43
- async makePage() {
44
- let windowPromise = await new DomParserInitializer(
45
- this.config.frontDistPath,
46
- this.config.frontDistIndexFileName || "index.html",
47
- { url: this.welcomUrl }
48
- ).run();
49
- return windowPromise;
25
+ async makePage(url = this.welcomUrl) {
26
+ const domParserInitializer = new DomParserInitializer(this.config.frontDistPath, this.config.frontDistIndexFileName || "index.html", { url });
27
+ const window = await domParserInitializer.run();
28
+ return { window, domParserInitializer };
50
29
  }
51
- async makeFront(window) {
30
+ async makeFront(window, otherInstanceSim) {
52
31
  const name = RandomUtils.uuid();
53
32
  window.ssrUse = false;
54
33
  const option = this.config.factorySimFrontOption(DomRenderProxy.final(window));
55
- const simpleBootFront = await this.config.factory.create(option, this.config.using, this.config.domExcludes);
56
- simpleBootFront.run(this.otherInstanceSim);
57
- simpleBootFront.generation = this.poolGeneration;
34
+ const domExcludes = [RequestResponse, ...this.config.domExcludes || []];
35
+ const simpleBootFront = await this.config.factory.create(option, this.config.using, domExcludes);
36
+ otherInstanceSim ??= /* @__PURE__ */ new Map();
37
+ this.otherInstanceSim?.forEach((v, k) => otherInstanceSim.set(k, v));
38
+ simpleBootFront.run(otherInstanceSim);
58
39
  return simpleBootFront;
59
40
  }
60
- enqueueFrontApp(simpleBootFront) {
61
- this.simpleBootFrontPool.push(simpleBootFront);
62
- this.simpleBootFrontQueue.enqueue(simpleBootFront);
63
- }
64
- async pushQueue() {
65
- if (this.simpleBootFrontPool.length < this.config.poolOption.max) {
66
- this.enqueueFrontApp(await this.makeFront(await this.makePage()));
67
- }
68
- }
41
+ // enqueueFrontApp(simpleBootFront: SimpleBootFront) {
42
+ // // this.simpleBootFrontPool.set(simpleBootFront.option.name!, simpleBootFront);
43
+ // this.simpleBootFrontPool.push(simpleBootFront);
44
+ // this.simpleBootFrontQueue.enqueue(simpleBootFront);
45
+ // }
46
+ //
47
+ // async pushQueue() {
48
+ // if (this.simpleBootFrontPool.length < this.config.poolOption.max) {
49
+ // this.enqueueFrontApp(await this.makeFront(await this.makePage()));
50
+ // }
51
+ // }
69
52
  async proceedBefore({ rr, app }) {
70
53
  if (this.config.ssrExcludeFilter?.(rr)) {
71
54
  return false;
72
55
  }
73
56
  if (rr.reqHasAcceptHeader(Mimes.TextHtml) || rr.reqHasAcceptHeader(Mimes.All)) {
74
- if (this.simpleBootFrontQueue.isEmpty()) {
75
- await this.pushQueue();
76
- }
77
- const simpleBootFront = await this.simpleBootFrontQueue.dequeue();
57
+ const url = rr.reqUrlObj({ host: "localhost" });
58
+ const targetUrl = url.toString() ?? this.welcomUrl;
59
+ const { window, domParserInitializer } = await this.makePage(targetUrl);
60
+ const otherSim = /* @__PURE__ */ new Map();
61
+ otherSim.set(RequestResponse, rr);
62
+ const simpleBootFront = await this.makeFront(window, otherSim);
78
63
  try {
79
64
  simpleBootFront.option.window.ssrUse = true;
80
- delete simpleBootFront.option.window.server_side_data;
81
- const url = rr.reqUrlObj({ host: "localhost" });
82
65
  if (this.config.simpleBootFront?.notFoundError) {
83
- const intent = await simpleBootFront.getIntent(url.pathname);
66
+ const intent = await simpleBootFront.routingRouterModule(url.pathname);
84
67
  if (intent.module === void 0 && !intent.getRouterPathData(rr.reqUrlPathName)) {
85
68
  throw new NotFoundError({ message: `Not Found: ${rr.reqUrlPathName}` });
86
69
  }
87
70
  }
88
- const targetUrl = url.toString();
89
- await simpleBootFront.goRouting(targetUrl);
90
- await Promises.sleep(0);
91
- const data = await firstValueFrom(
92
- simpleBootFront.routingSubjectObservable.pipe(
93
- filter(
94
- (it) => it.triggerPoint === "end" && typeof it.routerModule.intent.uri === "string" && targetUrl.endsWith(it.routerModule.intent.uri)
95
- ),
71
+ const data = await MessageInternal.firstValueFrom(
72
+ simpleBootFront.routingObservable.pipe(
73
+ MessageOperator.filter((it) => {
74
+ const sw = it.triggerPoint === "end" && typeof it.routerModule.intent.uri === "string" && targetUrl.endsWith(it.routerModule.intent.uri);
75
+ return sw;
76
+ }),
96
77
  // delay(1000),
97
- first()
78
+ MessageOperator.first()
98
79
  )
99
80
  );
100
- await Promises.sleep(0);
81
+ simpleBootFront.writeDataHydration();
82
+ simpleBootFront.clearDataHydration();
101
83
  const html = this.makeHTML(simpleBootFront);
102
84
  await this.writeOkHtmlAndEnd({ rr }, html);
103
85
  } finally {
104
- simpleBootFront.option.window.ssrUse = false;
105
- delete simpleBootFront.option.window.server_side_data;
106
- if (simpleBootFront.generation < this.poolGeneration) {
107
- const jsdom = simpleBootFront.jsdom;
108
- jsdom?.window.close();
109
- const index = this.simpleBootFrontPool.indexOf(simpleBootFront);
110
- if (index > -1) {
111
- this.simpleBootFrontPool.splice(index, 1);
112
- }
113
- this.pushQueue();
114
- } else {
115
- this.simpleBootFrontQueue.enqueue(simpleBootFront);
86
+ try {
87
+ simpleBootFront.option.window.ssrUse = false;
88
+ window.close();
89
+ simpleBootFront.onDestroy();
90
+ simpleBootFront.option.window?.close?.();
91
+ domParserInitializer.destroy();
92
+ } catch (e) {
93
+ console.log("eeeeee", e);
116
94
  }
117
95
  }
118
96
  return false;
@@ -133,19 +111,6 @@ class SSRDomParserFilter {
133
111
  html = "<!DOCTYPE html>" + html;
134
112
  }
135
113
  html = html.replace(/\$\{[\s\S]*?\}\$/g, "");
136
- const serverSideData = simpleBootFront.option.window.server_side_data;
137
- if (serverSideData) {
138
- const data = Object.entries(serverSideData).map(([k, v]) => {
139
- if (typeof v === "string") {
140
- return `window.server_side_data.${k} = ${v}`;
141
- } else {
142
- return `window.server_side_data.${k} = ${JSON.stringify(v)}`;
143
- }
144
- }).join(";");
145
- if (data) {
146
- html = html.replace("</head>", `<script> window.server_side_data={}; ${data}; </script></head>`);
147
- }
148
- }
149
114
  return html;
150
115
  }
151
116
  async writeOkHtmlAndEnd({ rr, status = HttpStatus.Ok }, html) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/filters/SSRDomParserFilter.ts"],
4
- "sourcesContent": ["import { RequestResponse } from '@dooboostore/simple-boot-http-server/models/RequestResponse';\nimport { HttpHeaders } from '@dooboostore/simple-boot-http-server/codes/HttpHeaders';\nimport { SimpleBootHttpSSRFactory } from '../SimpleBootHttpSSRFactory';\nimport { ConstructorType } from '@dooboostore/core/types';\nimport { Filter } from '@dooboostore/simple-boot-http-server/filters/Filter';\nimport { Mimes } from '@dooboostore/simple-boot-http-server/codes/Mimes';\nimport { HttpStatus } from '@dooboostore/simple-boot-http-server/codes/HttpStatus';\nimport { SimpleBootHttpServer } from '@dooboostore/simple-boot-http-server/SimpleBootHttpServer';\nimport { SimFrontOption } from '@dooboostore/simple-boot-front/option/SimFrontOption';\nimport { SimpleBootFront } from '@dooboostore/simple-boot-front/SimpleBootFront';\nimport { AsyncBlockingQueue } from '@dooboostore/core/queues/AsyncBlockingQueue';\nimport { RandomUtils } from '@dooboostore/core/random/RandomUtils';\nimport * as JSDOM from 'jsdom';\nimport { NotFoundError } from '@dooboostore/simple-boot-http-server/errors/NotFoundError';\nimport { DomRenderProxy } from '@dooboostore/dom-render/DomRenderProxy';\nimport { filter } from '@dooboostore/core/message/operators/filter';\nimport { first } from '@dooboostore/core/message/operators/first';\nimport { delay } from '@dooboostore/core/message/operators/delay';\nimport { firstValueFrom } from '@dooboostore/core/message/internal/firstValueFrom';\nimport { parseHTML } from 'linkedom';\nimport {Promises} from '@dooboostore/core/promise/Promises';\nimport { DomParserInitializer } from '../initializers/DomParserInitializer';\n\nexport type FactoryAndParams = {\n frontDistPath: string;\n frontDistIndexFileName?: string;\n factorySimFrontOption: (window: any) => SimFrontOption;\n factory: SimpleBootHttpSSRFactory;\n poolOption: {\n max: number;\n min: number;\n clearIntervalTime?: number;\n };\n using: ConstructorType<any>[];\n domExcludes?: ConstructorType<any>[];\n ssrExcludeFilter?: (rr: RequestResponse) => boolean;\n simpleBootFront?: {\n notFoundError?: boolean;\n };\n};\n\nexport class SSRDomParserFilter implements Filter {\n private simpleBootFrontPool: SimpleBootFront[] = [];\n private simpleBootFrontQueue = new AsyncBlockingQueue<SimpleBootFront>();\n // private indexHTML: string;\n private welcomUrl = 'http://localhost';\n private poolGeneration = 0;\n private intervalId?: NodeJS.Timeout;\n\n constructor(\n public config: FactoryAndParams,\n public otherInstanceSim?: Map<ConstructorType<any>, any>\n ) {\n config.frontDistIndexFileName = config.frontDistIndexFileName || 'index.html';\n // this.indexHTML = JsdomInitializer.loadFile(this.config.frontDistPath, config.frontDistIndexFileName);\n }\n\n async onInit(app: SimpleBootHttpServer) {\n for (let i = 0; i < this.config.poolOption.min; i++) {\n await this.pushQueue();\n }\n\n if (this.config.poolOption.clearIntervalTime && this.config.poolOption.clearIntervalTime > 0) {\n this.intervalId = setInterval(() => {\n this.poolGeneration++;\n }, this.config.poolOption.clearIntervalTime);\n }\n }\n\n async onDestroy() {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n }\n // this.simpleBootFrontQueue.clear();\n this.simpleBootFrontPool.forEach(front => {\n (front as any).jsdom?.window.close();\n });\n this.simpleBootFrontPool = [];\n }\n\n async makePage() {\n let windowPromise = await new DomParserInitializer(\n this.config.frontDistPath,\n this.config.frontDistIndexFileName || 'index.html',\n { url: this.welcomUrl }\n ).run();\n return windowPromise;\n // const jsdom = await new JsdomInitializer(\n // this.config.frontDistPath,\n // this.config.frontDistIndexFileName || 'index.html',\n // { url: this.welcomUrl }\n // ).run();\n // return jsdom;\n }\n\n async makeFront(window: Window) {\n const name = RandomUtils.uuid();\n (window as any).ssrUse = false;\n const option = this.config.factorySimFrontOption(DomRenderProxy.final(window));\n const simpleBootFront = await this.config.factory.create(option, this.config.using, this.config.domExcludes);\n simpleBootFront.run(this.otherInstanceSim);\n (simpleBootFront as any).generation = this.poolGeneration;\n return simpleBootFront;\n }\n\n enqueueFrontApp(simpleBootFront: SimpleBootFront) {\n // this.simpleBootFrontPool.set(simpleBootFront.option.name!, simpleBootFront);\n this.simpleBootFrontPool.push(simpleBootFront);\n this.simpleBootFrontQueue.enqueue(simpleBootFront);\n }\n async pushQueue() {\n if (this.simpleBootFrontPool.length < this.config.poolOption.max) {\n this.enqueueFrontApp(await this.makeFront(await this.makePage()));\n }\n }\n\n async proceedBefore({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n if (this.config.ssrExcludeFilter?.(rr)) {\n return false;\n }\n if (rr.reqHasAcceptHeader(Mimes.TextHtml) || rr.reqHasAcceptHeader(Mimes.All)) {\n if (this.simpleBootFrontQueue.isEmpty()) {\n await this.pushQueue();\n }\n const simpleBootFront = await this.simpleBootFrontQueue.dequeue();\n try {\n (simpleBootFront.option.window as any).ssrUse = true;\n delete (simpleBootFront.option.window as any).server_side_data;\n const url = rr.reqUrlObj({ host: 'localhost' });\n if (this.config.simpleBootFront?.notFoundError) {\n // intent router check first\n const intent = await simpleBootFront.getIntent(url.pathname);\n // route\uB97C \uBABB\uCC3E\uC740\uC0C1\uD0DC\uC5D0\uC11C router path\uAE4C\uC9C0 \uC548\uB9DE\uC73C\uBA74 404 \uCC98\uB9AC\uD55C\uB2E4. route\uB791 router\uB791 \uB2E4\uB974\uB2C8\uAE50 \uD5DB\uAC08\uB9AC\uC9C0\uB9D0\uB3C4\uB85D\n if (intent.module === undefined && !intent.getRouterPathData(rr.reqUrlPathName)) {\n throw new NotFoundError({ message: `Not Found: ${rr.reqUrlPathName}` });\n }\n }\n\n // runRouting!!\n const targetUrl = url.toString();\n // console.log('runRoutingrunRouting', targetUrl);\n await simpleBootFront.goRouting(targetUrl);\n await Promises.sleep(0); // <--\uC911\uC694: \uC774\uAC70 \uB123\uC5B4\uC57C\uC9C0 \uB450\uBC88\uBD88\uB7EC\uC9C0\uB294\uAC8C \uC5C6\uC5B4\uC9C0\uB294\uB4EF? \uBB50\uC9C0 event loop \uBCC0\uACBD\uB41C\uAC74\uAC00?\n\n // console.log('runRout22222ingrunRouting', targetUrl);\n\n // simpleBootFront.routingSubjectObservable.subscribe(it=>{\n // console.log('zzzzzzzzzzzzzzzzzzz', it);\n // if (it.triggerPoint==='end') {\n // console.log('zzz@@', it.routerModule.intent);\n // }\n // })\n\n const data = await firstValueFrom(\n simpleBootFront.routingSubjectObservable.pipe(\n filter(\n (it) =>\n it.triggerPoint === 'end' &&\n typeof it.routerModule.intent.uri === 'string' &&\n targetUrl.endsWith(it.routerModule.intent.uri)\n ),\n // delay(1000),\n first()\n )\n );\n // console.log('???????done');\n await Promises.sleep(0)\n const html = this.makeHTML(simpleBootFront);\n // console.log('---------',html);\n await this.writeOkHtmlAndEnd({ rr }, html);\n } finally {\n (simpleBootFront.option.window as any).ssrUse = false;\n delete (simpleBootFront.option.window as any).server_side_data;\n if ((simpleBootFront as any).generation < this.poolGeneration) {\n // Stale instance, destroy it\n const jsdom = (simpleBootFront as any).jsdom as JSDOM.JSDOM | undefined;\n jsdom?.window.close();\n const index = this.simpleBootFrontPool.indexOf(simpleBootFront);\n if (index > -1) {\n this.simpleBootFrontPool.splice(index, 1);\n }\n this.pushQueue();\n } else {\n // Current instance, return to queue\n this.simpleBootFrontQueue.enqueue(simpleBootFront);\n }\n }\n return false;\n } else {\n return true;\n }\n }\n\n makeHTML(simpleBootFront: SimpleBootFront) {\n (simpleBootFront.option.window as any).document.querySelectorAll('*').forEach((el:HTMLElement )=> {\n Array.from(el.attributes).forEach(attr => {\n if (/^dr-/.test(attr.name) || /^domstyle/.test(attr.name) || /this-path/.test(attr.name)) {\n el.removeAttribute(attr.name);\n }\n });\n });\n let html = simpleBootFront.option.window.document.documentElement.outerHTML;\n if (!/^<!DOCTYPE html>/i.test(html)) {\n html = '<!DOCTYPE html>' + html;\n }\n html = html.replace(/\\$\\{[\\s\\S]*?\\}\\$/g, '');\n const serverSideData = (simpleBootFront.option.window as any).server_side_data;\n if (serverSideData) {\n const data = Object.entries(serverSideData)\n .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 })\n .join(';');\n if (data) {\n html = html.replace('</head>', `<script> window.server_side_data={}; ${data}; </script></head>`);\n }\n }\n return html;\n }\n async writeOkHtmlAndEnd({ rr, status = HttpStatus.Ok }: { rr: RequestResponse; status?: HttpStatus }, html: string) {\n rr.resStatusCode(status);\n rr.resSetHeader(HttpHeaders.ContentType, Mimes.TextHtml);\n await rr.resEnd(html);\n }\n\n async proceedAfter({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n return true;\n }\n}\n"],
5
- "mappings": "AACA,SAAS,mBAAmB;AAI5B,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAI3B,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,aAAa;AAEtB,SAAS,sBAAsB;AAE/B,SAAQ,gBAAe;AACvB,SAAS,4BAA4B;AAoB9B,MAAM,mBAAqC;AAAA,EAQhD,YACS,QACA,kBACP;AAFO;AACA;AATT,SAAQ,sBAAyC,CAAC;AAClD,SAAQ,uBAAuB,IAAI,mBAAoC;AAEvE;AAAA,SAAQ,YAAY;AACpB,SAAQ,iBAAiB;AAOvB,WAAO,yBAAyB,OAAO,0BAA0B;AAAA,EAEnE;AAAA,EAEA,MAAM,OAAO,KAA2B;AACtC,aAAS,IAAI,GAAG,IAAI,KAAK,OAAO,WAAW,KAAK,KAAK;AACnD,YAAM,KAAK,UAAU;AAAA,IACvB;AAEA,QAAI,KAAK,OAAO,WAAW,qBAAqB,KAAK,OAAO,WAAW,oBAAoB,GAAG;AAC5F,WAAK,aAAa,YAAY,MAAM;AAClC,aAAK;AAAA,MACP,GAAG,KAAK,OAAO,WAAW,iBAAiB;AAAA,IAC7C;AAAA,EACF;AAAA,EAEA,MAAM,YAAY;AAChB,QAAI,KAAK,YAAY;AACnB,oBAAc,KAAK,UAAU;AAAA,IAC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AAAA,EACtB;AAAA,EAEA,MAAM,aAAa,EAAE,IAAI,IAAI,GAAkF;AAC7G,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import { RequestResponse } from '@dooboostore/simple-boot-http-server/models/RequestResponse';\nimport { HttpHeaders } from '@dooboostore/simple-boot-http-server/codes/HttpHeaders';\nimport { SimpleBootHttpSSRFactory } from '../SimpleBootHttpSSRFactory';\nimport { ConstructorType, AsyncBlockingQueue, RandomUtils, MessageOperator, MessageInternal, Promises } from '@dooboostore/core';\nimport { Filter } from '@dooboostore/simple-boot-http-server/filters/Filter';\nimport { Mimes } from '@dooboostore/simple-boot-http-server/codes/Mimes';\nimport { HttpStatus } from '@dooboostore/simple-boot-http-server/codes/HttpStatus';\nimport { SimpleBootHttpServer } from '@dooboostore/simple-boot-http-server/SimpleBootHttpServer';\nimport { SimFrontOption } from '@dooboostore/simple-boot-front/option/SimFrontOption';\nimport { SimpleBootFront } from '@dooboostore/simple-boot-front/SimpleBootFront';\nimport * as JSDOM from 'jsdom';\nimport { NotFoundError } from '@dooboostore/simple-boot-http-server/errors/NotFoundError';\nimport { DomRenderProxy } from '@dooboostore/dom-render';\nimport { parseHTML } from 'linkedom';\nimport { DomParserInitializer } from '../initializers/DomParserInitializer';\nimport { JsdomInitializer } from '../initializers';\nimport { SimConfig } from '@dooboostore/simple-boot/decorators/SimDecorator';\n\nexport type FactoryAndParams = {\n frontDistPath: string;\n frontDistIndexFileName?: string;\n factorySimFrontOption: (window: any) => SimFrontOption;\n factory: SimpleBootHttpSSRFactory;\n // poolOption: {\n // max: number;\n // min: number;\n // clearIntervalTime?: number;\n // };\n using: ConstructorType<any>[];\n domExcludes?: ConstructorType<any>[];\n ssrExcludeFilter?: (rr: RequestResponse) => boolean;\n simpleBootFront?: {\n notFoundError?: boolean;\n };\n};\n\nexport class SSRDomParserFilter implements Filter {\n // private simpleBootFrontPool: SimpleBootFront[] = [];\n // private simpleBootFrontQueue = new AsyncBlockingQueue<SimpleBootFront>();\n // private indexHTML: string;\n private welcomUrl = 'http://localhost';\n // private poolGeneration = 0;\n // private intervalId?: NodeJS.Timeout;\n\n constructor(\n public config: FactoryAndParams,\n public otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | Symbol, any>\n ) {\n config.frontDistIndexFileName = config.frontDistIndexFileName || 'index.html';\n // this.indexHTML = JsdomInitializer.loadFile(this.config.frontDistPath, config.frontDistIndexFileName);\n }\n\n async onInit(app: SimpleBootHttpServer) {\n // for (let i = 0; i < this.config.poolOption.min; i++) {\n // await this.pushQueue();\n // }\n // if (this.config.poolOption.clearIntervalTime && this.config.poolOption.clearIntervalTime > 0) {\n // this.intervalId = setInterval(() => {\n // this.poolGeneration++;\n // }, this.config.poolOption.clearIntervalTime);\n // }\n }\n\n async onDestroy() {\n // if (this.intervalId) {\n // clearInterval(this.intervalId);\n // }\n // // this.simpleBootFrontQueue.clear();\n // this.simpleBootFrontPool.forEach(front => {\n // // JSDOM\uB3C4 \uC815\uB9AC (\uD558\uC704 \uD638\uD658\uC131)\n // (front as any).jsdom?.window.close();\n // // Window close - \uC774\uAC83\uB9CC\uC73C\uB85C WindowBase.close()\uAC00 \uD638\uCD9C\uB418\uC5B4 \uBA54\uBAA8\uB9AC \uC815\uB9AC\uB428\n // (front.option.window as any)?.close?.();\n // });\n // this.simpleBootFrontPool = [];\n }\n\n async makePage(url = this.welcomUrl) {\n const domParserInitializer = new DomParserInitializer(this.config.frontDistPath, this.config.frontDistIndexFileName || 'index.html', { url: url });\n const window = await domParserInitializer.run();\n // window.document.querySelector('#app').setAttribute(('vvv'),'zzz')\n // console.log('vvv', window.document.querySelector('#app'))\n // console.log('------', window.document.documentElement.outerHTML);\n return { window, domParserInitializer };\n // const jsdom = await new JsdomInitializer(\n // this.config.frontDistPath,\n // this.config.frontDistIndexFileName || 'index.html',\n // { url: this.welcomUrl }\n // ).run();\n // return { window: jsdom.window as any, domParserInitializer: {destroy: () => {jsdom.window.close()}} };\n // return jsdom;\n }\n\n async makeFront(window: Window, otherInstanceSim?: Map<Function | ConstructorType<any> | SimConfig | Symbol, any>) {\n const name = RandomUtils.uuid();\n (window as any).ssrUse = false;\n const option = this.config.factorySimFrontOption(DomRenderProxy.final(window));\n const domExcludes = [RequestResponse, ...(this.config.domExcludes || [])];\n const simpleBootFront = await this.config.factory.create(option, this.config.using, domExcludes);\n otherInstanceSim ??= new Map<Function | ConstructorType<any> | SimConfig | Symbol, any>();\n this.otherInstanceSim?.forEach((v, k) => otherInstanceSim!.set(k, v));\n\n simpleBootFront.run(otherInstanceSim);\n // (simpleBootFront as any).generation = this.poolGeneration;\n return simpleBootFront;\n }\n\n // enqueueFrontApp(simpleBootFront: SimpleBootFront) {\n // // this.simpleBootFrontPool.set(simpleBootFront.option.name!, simpleBootFront);\n // this.simpleBootFrontPool.push(simpleBootFront);\n // this.simpleBootFrontQueue.enqueue(simpleBootFront);\n // }\n //\n // async pushQueue() {\n // if (this.simpleBootFrontPool.length < this.config.poolOption.max) {\n // this.enqueueFrontApp(await this.makeFront(await this.makePage()));\n // }\n // }\n\n async proceedBefore({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n if (this.config.ssrExcludeFilter?.(rr)) {\n return false;\n }\n if (rr.reqHasAcceptHeader(Mimes.TextHtml) || rr.reqHasAcceptHeader(Mimes.All)) {\n // if (this.simpleBootFrontQueue.isEmpty()) {\n // await this.pushQueue();\n // }\n // const simpleBootFront = await this.simpleBootFrontQueue.dequeue();\n const url = rr.reqUrlObj({ host: 'localhost' });\n const targetUrl = url.toString() ?? this.welcomUrl;\n const { window, domParserInitializer } = await this.makePage(targetUrl);\n const otherSim = new Map<Function | ConstructorType<any> | SimConfig | Symbol, any>();\n otherSim.set(RequestResponse, rr);\n const simpleBootFront = await this.makeFront(window, otherSim);\n try {\n (simpleBootFront.option.window as any).ssrUse = true;\n // console.log(simpleBootFront.routing)\n if (this.config.simpleBootFront?.notFoundError) {\n // intent router check first\n const intent = await simpleBootFront.routingRouterModule(url.pathname);\n // route\uB97C \uBABB\uCC3E\uC740\uC0C1\uD0DC\uC5D0\uC11C router path\uAE4C\uC9C0 \uC548\uB9DE\uC73C\uBA74 404 \uCC98\uB9AC\uD55C\uB2E4. route\uB791 router\uB791 \uB2E4\uB974\uB2C8\uAE50 \uD5DB\uAC08\uB9AC\uC9C0\uB9D0\uB3C4\uB85D\n if (intent.module === undefined && !intent.getRouterPathData(rr.reqUrlPathName)) {\n throw new NotFoundError({ message: `Not Found: ${rr.reqUrlPathName}` });\n }\n }\n\n const data = await MessageInternal.firstValueFrom(\n simpleBootFront.routingObservable.pipe(\n MessageOperator.filter(it => {\n\n const sw = it.triggerPoint === 'end' && typeof it.routerModule.intent.uri === 'string' && targetUrl.endsWith(it.routerModule.intent.uri);\n return sw;\n }),\n // delay(1000),\n MessageOperator.first()\n )\n );\n\n // [\uC544\uD0A4\uD14D\uD2B8\uB2D8\uC758 \uC815\uC11D] \uD558\uC774\uB4DC\uB808\uC774\uC158 \uB370\uC774\uD130\uB97C \uAC00\uC0C1 \uC708\uB3C4\uC6B0\uC758 body\uC5D0 script \uD0DC\uADF8\uB85C \uBC15\uC81C\n // @ts-ignore: writeDataHydration is part of the \uC815\uC11D\n simpleBootFront.writeDataHydration();\n simpleBootFront.clearDataHydration();\n\n const html = this.makeHTML(simpleBootFront);\n await this.writeOkHtmlAndEnd({ rr }, html);\n } finally {\n try {\n (simpleBootFront.option.window as any).ssrUse = false;\n window.close();\n simpleBootFront.onDestroy();\n\n // window.close()\uB9CC \uD638\uCD9C\uD558\uBA74 WindowBase.close()\uAC00 \uC2E4\uD589\uB418\uC5B4 \uBA54\uBAA8\uB9AC \uC815\uB9AC\uB428\n (simpleBootFront.option.window as any)?.close?.();\n domParserInitializer.destroy();\n } catch (e) {\n console.log('eeeeee', e);\n }\n\n // const index = this.simpleBootPool.indexOf(simpleBootFront);\n // if (index > -1) {\n // this.simpleBootPool.splice(index, 1);\n // }\n // this.pushQueue();\n }\n return false;\n } else {\n return true;\n }\n }\n\n makeHTML(simpleBootFront: SimpleBootFront) {\n (simpleBootFront.option.window as any).document.querySelectorAll('*').forEach((el: HTMLElement) => {\n Array.from(el.attributes).forEach(attr => {\n if (/^dr-/.test(attr.name) || /^domstyle/.test(attr.name) || /this-path/.test(attr.name)) {\n el.removeAttribute(attr.name);\n }\n });\n });\n let html = simpleBootFront.option.window.document.documentElement.outerHTML;\n if (!/^<!DOCTYPE html>/i.test(html)) {\n html = '<!DOCTYPE html>' + html;\n }\n html = html.replace(/\\$\\{[\\s\\S]*?\\}\\$/g, '');\n\n // [\uC544\uD0A4\uD14D\uD2B8\uB2D8\uC758 \uC815\uC11D]\n // body\uC5D0 \uC9C1\uC811 append\uB41C script tag\uAC00 outerHTML\uC5D0 \uC774\uBBF8 \uD3EC\uD568\uB418\uC5B4 \uC788\uC73C\uBBC0\uB85C \uCD94\uAC00 \uC870\uC791\uC740 \uBD88\uD544\uC694\uD569\uB2C8\uB2E4.\n\n return html;\n }\n\n async writeOkHtmlAndEnd({ rr, status = HttpStatus.Ok }: { rr: RequestResponse; status?: HttpStatus }, html: string) {\n rr.resStatusCode(status);\n rr.resSetHeader(HttpHeaders.ContentType, Mimes.TextHtml);\n await rr.resEnd(html);\n }\n\n async proceedAfter({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n return true;\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAE5B,SAA8C,aAAa,iBAAiB,uBAAiC;AAE7G,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAK3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAE/B,SAAS,4BAA4B;AAsB9B,MAAM,mBAAqC;AAAA;AAAA;AAAA,EAQhD,YACS,QACA,kBACP;AAFO;AACA;AANT;AAAA;AAAA;AAAA,SAAQ,YAAY;AAQlB,WAAO,yBAAyB,OAAO,0BAA0B;AAAA,EAEnE;AAAA,EAEA,M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,YAAM,KAAK,GAAG,UAAU,EAAE,QAAQ,UAAQ;AACxC,YAAI,OAAO,KAAK,KAAK,IAAI,KAAK,YAAY,KAAK,KAAK,IAAI,KAAK,YAAY,KAAK,KAAK,IAAI,GAAG;AACxF,aAAG,gBAAgB,KAAK,IAAI;AAAA,QAC9B;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AACD,QAAI,OAAO,gBAAgB,OAAO,OAAO,SAAS,gBAAgB;AAClE,QAAI,CAAC,oBAAoB,KAAK,IAAI,GAAG;AACnC,aAAO,oBAAoB;AAAA,IAC7B;AACA,WAAO,KAAK,QAAQ,qBAAqB,EAAE;AAK3C,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,kBAAkB,EAAE,IAAI,SAAS,WAAW,GAAG,GAAiD,MAAc;AAClH,OAAG,cAAc,MAAM;AACvB,OAAG,aAAa,YAAY,aAAa,MAAM,QAAQ;AACvD,UAAM,GAAG,OAAO,IAAI;AAAA,EACtB;AAAA,EAEA,MAAM,aAAa,EAAE,IAAI,IAAI,GAAkF;AAC7G,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,14 +1,10 @@
1
1
  import { HttpHeaders } from "@dooboostore/simple-boot-http-server/codes/HttpHeaders";
2
+ import { AsyncBlockingQueue, RandomUtils, MessageOperator, MessageInternal } from "@dooboostore/core";
2
3
  import { JsdomInitializer } from "../initializers/JsdomInitializer.js";
3
4
  import { Mimes } from "@dooboostore/simple-boot-http-server/codes/Mimes";
4
5
  import { HttpStatus } from "@dooboostore/simple-boot-http-server/codes/HttpStatus";
5
- import { AsyncBlockingQueue } from "@dooboostore/core/queues/AsyncBlockingQueue";
6
- import { RandomUtils } from "@dooboostore/core/random/RandomUtils";
7
6
  import { NotFoundError } from "@dooboostore/simple-boot-http-server/errors/NotFoundError";
8
- import { DomRenderProxy } from "@dooboostore/dom-render/DomRenderProxy";
9
- import { filter } from "@dooboostore/core/message/operators/filter";
10
- import { first } from "@dooboostore/core/message/operators/first";
11
- import { firstValueFrom } from "@dooboostore/core/message/internal/firstValueFrom";
7
+ import { DomRenderProxy } from "@dooboostore/dom-render";
12
8
  class SSRFilter {
13
9
  constructor(config, otherInstanceSim) {
14
10
  this.config = config;
@@ -93,7 +89,7 @@ class SSRFilter {
93
89
  delete simpleBootFront.option.window.server_side_data;
94
90
  const url = rr.reqUrlObj({ host: "localhost" });
95
91
  if (this.config.simpleBootFront?.notFoundError) {
96
- const intent = await simpleBootFront.getIntent(url.pathname);
92
+ const intent = await simpleBootFront.routingRouterModule(url.pathname);
97
93
  if (intent.module === void 0 && !intent.getRouterPathData(rr.reqUrlPathName)) {
98
94
  throw new NotFoundError({ message: `Not Found: ${rr.reqUrlPathName}` });
99
95
  }
@@ -101,15 +97,15 @@ class SSRFilter {
101
97
  const targetUrl = url.toString();
102
98
  await simpleBootFront.goRouting(targetUrl);
103
99
  await new Promise((r) => setTimeout(r, 0));
104
- const data = await firstValueFrom(
100
+ const data = await MessageInternal.firstValueFrom(
105
101
  // @ts-ignore
106
- simpleBootFront.routingSubjectObservable.pipe(
102
+ simpleBootFront.routingObservable.pipe(
107
103
  // @ts-ignore
108
- filter(
104
+ MessageOperator.filter(
109
105
  (it) => it.triggerPoint === "end" && typeof it.routerModule.intent.uri === "string" && targetUrl.endsWith(it.routerModule.intent.uri)
110
106
  ),
111
107
  // delay(1000),
112
- first()
108
+ MessageOperator.first()
113
109
  )
114
110
  );
115
111
  const html = this.makeHTML(simpleBootFront);