@dooboostore/simple-boot-http-server-ssr 1.0.15 → 1.0.16

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 (83) hide show
  1. package/README.md +98 -0
  2. package/dist/cjs/SimpleBootHttpSSRServer.js.map +2 -2
  3. package/dist/cjs/bundle-entry.js +0 -2
  4. package/dist/cjs/bundle-entry.js.map +2 -2
  5. package/dist/cjs/filters/SSRDomParserFilter.js.map +2 -2
  6. package/dist/cjs/filters/{SSRLinkDomDomFilter.js → SSRLinkDomFilter.js} +7 -7
  7. package/dist/cjs/filters/SSRLinkDomFilter.js.map +7 -0
  8. package/dist/cjs/filters/SSRSimpleWebComponentDomParserFilter.js +81 -0
  9. package/dist/cjs/filters/SSRSimpleWebComponentDomParserFilter.js.map +7 -0
  10. package/dist/cjs/filters/SSRSimpleWebComponentFilter.js +158 -28
  11. package/dist/cjs/filters/SSRSimpleWebComponentFilter.js.map +2 -2
  12. package/dist/cjs/filters/index.js +9 -3
  13. package/dist/cjs/filters/index.js.map +2 -2
  14. package/dist/cjs/index.js +0 -2
  15. package/dist/cjs/index.js.map +2 -2
  16. package/dist/esm/SimpleBootHttpSSRServer.js.map +2 -2
  17. package/dist/esm/bundle-entry.js +0 -1
  18. package/dist/esm/bundle-entry.js.map +2 -2
  19. package/dist/esm/filters/SSRDomParserFilter.js.map +2 -2
  20. package/dist/esm/filters/{SSRLinkDomDomFilter.js → SSRLinkDomFilter.js} +3 -3
  21. package/dist/esm/filters/SSRLinkDomFilter.js.map +7 -0
  22. package/dist/esm/filters/SSRSimpleWebComponentDomParserFilter.js +58 -0
  23. package/dist/esm/filters/SSRSimpleWebComponentDomParserFilter.js.map +7 -0
  24. package/dist/esm/filters/SSRSimpleWebComponentFilter.js +148 -28
  25. package/dist/esm/filters/SSRSimpleWebComponentFilter.js.map +2 -2
  26. package/dist/esm/filters/index.js +4 -1
  27. package/dist/esm/filters/index.js.map +2 -2
  28. package/dist/esm/index.js +0 -1
  29. package/dist/esm/index.js.map +2 -2
  30. package/dist/esm-bundle/dooboostore-simple-boot-http-server-ssr.esm.js +54537 -21104
  31. package/dist/esm-bundle/dooboostore-simple-boot-http-server-ssr.esm.js.map +4 -4
  32. package/dist/types/SimpleBootHttpSSRServer.d.ts +1 -1
  33. package/dist/types/SimpleBootHttpSSRServer.d.ts.map +1 -1
  34. package/dist/types/bundle-entry.d.ts +0 -1
  35. package/dist/types/bundle-entry.d.ts.map +1 -1
  36. package/dist/types/filters/SSRDomParserFilter.d.ts +3 -3
  37. package/dist/types/filters/SSRDomParserFilter.d.ts.map +1 -1
  38. package/dist/types/filters/{SSRLinkDomDomFilter.d.ts → SSRLinkDomFilter.d.ts} +5 -5
  39. package/dist/types/filters/SSRLinkDomFilter.d.ts.map +1 -0
  40. package/dist/types/filters/SSRSimpleWebComponentDomParserFilter.d.ts +37 -0
  41. package/dist/types/filters/SSRSimpleWebComponentDomParserFilter.d.ts.map +1 -0
  42. package/dist/types/filters/SSRSimpleWebComponentFilter.d.ts +23 -3
  43. package/dist/types/filters/SSRSimpleWebComponentFilter.d.ts.map +1 -1
  44. package/dist/types/filters/index.d.ts +4 -1
  45. package/dist/types/filters/index.d.ts.map +1 -1
  46. package/dist/types/index.d.ts +0 -1
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/umd-bundle/dooboostore-simple-boot-http-server-ssr.umd.js +54592 -21160
  49. package/dist/umd-bundle/dooboostore-simple-boot-http-server-ssr.umd.js.map +4 -4
  50. package/package.json +17 -16
  51. package/src/SimpleBootHttpSSRServer.ts +2 -3
  52. package/src/bundle-entry.ts +0 -1
  53. package/src/filters/SSRDomParserFilter.ts +4 -4
  54. package/src/filters/{SSRLinkDomDomFilter.ts → SSRLinkDomFilter.ts} +3 -3
  55. package/src/filters/SSRSimpleWebComponentDomParserFilter.ts +106 -0
  56. package/src/filters/SSRSimpleWebComponentFilter.ts +242 -39
  57. package/src/filters/index.ts +5 -2
  58. package/src/index.ts +0 -1
  59. package/README.MD +0 -167
  60. package/dist/cjs/decorators/LoadAroundBefore.js +0 -54
  61. package/dist/cjs/decorators/LoadAroundBefore.js.map +0 -7
  62. package/dist/cjs/decorators/SaveAroundAfter.js +0 -53
  63. package/dist/cjs/decorators/SaveAroundAfter.js.map +0 -7
  64. package/dist/cjs/decorators/index.js +0 -24
  65. package/dist/cjs/decorators/index.js.map +0 -7
  66. package/dist/cjs/filters/SSRLinkDomDomFilter.js.map +0 -7
  67. package/dist/esm/decorators/LoadAroundBefore.js +0 -31
  68. package/dist/esm/decorators/LoadAroundBefore.js.map +0 -7
  69. package/dist/esm/decorators/SaveAroundAfter.js +0 -29
  70. package/dist/esm/decorators/SaveAroundAfter.js.map +0 -7
  71. package/dist/esm/decorators/index.js +0 -3
  72. package/dist/esm/decorators/index.js.map +0 -7
  73. package/dist/esm/filters/SSRLinkDomDomFilter.js.map +0 -7
  74. package/dist/types/decorators/LoadAroundBefore.d.ts +0 -2
  75. package/dist/types/decorators/LoadAroundBefore.d.ts.map +0 -1
  76. package/dist/types/decorators/SaveAroundAfter.d.ts +0 -3
  77. package/dist/types/decorators/SaveAroundAfter.d.ts.map +0 -1
  78. package/dist/types/decorators/index.d.ts +0 -3
  79. package/dist/types/decorators/index.d.ts.map +0 -1
  80. package/dist/types/filters/SSRLinkDomDomFilter.d.ts.map +0 -1
  81. package/src/decorators/LoadAroundBefore.ts +0 -28
  82. package/src/decorators/SaveAroundAfter.ts +0 -27
  83. package/src/decorators/index.ts +0 -2
package/README.MD DELETED
@@ -1,167 +0,0 @@
1
- # @dooboostore/simple-boot-http-server-ssr
2
-
3
- [![NPM version](https://img.shields.io/npm/v/@dooboostore/simple-boot-http-server-ssr.svg?style=flat-square)](https://www.npmjs.com/package/@dooboostore/simple-boot-http-server-ssr)
4
- [![Build and Test](https://github.com/dooboostore-develop/packages/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/dooboostore-develop/packages/actions/workflows/main.yaml)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
6
-
7
- **Full Documentation:** [https://dooboostore-develop.github.io/@dooboostore/simple-boot-http-server-ssr](https://dooboostore-develop.github.io/@dooboostore/simple-boot-http-server-ssr)
8
-
9
- A framework for building Server-Side Rendered (SSR) applications by seamlessly integrating `@dooboostore/simple-boot-front` and `@dooboostore/simple-boot-http-server`.
10
-
11
- ---
12
-
13
- ## Features
14
-
15
- - **Server-Side Rendering**: Renders your single-page application on the server for fast, SEO-friendly websites.
16
- - **JSDOM Integration**: Uses `jsdom` to create a virtual DOM environment on the server, allowing front-end code to run.
17
- - **Component Pooling**: Manages a pool of `SimpleBootFront` instances to handle concurrent SSR requests efficiently.
18
- - **Automatic Data Hydration**: Serializes data fetched on the server and hydrates it on the client to avoid redundant API calls.
19
- - **Unified Codebase**: Enables sharing of routing, services, and components between the server and the client.
20
- - **Intent-based Communication**: Provides a mechanism for client-server communication using custom HTTP headers.
21
- - **SimpleWebComponent Integration**: Seamless SSR support for `@dooboostore/simple-web-component` with automatic component registration and hydration.
22
-
23
- ## Quick Start
24
-
25
- ```bash
26
- npx @dooboostore/create-simple-boot-http-server-ssr my-ssr-app
27
- cd my-ssr-app
28
- npm start
29
- ```
30
-
31
- ---
32
-
33
- ## SimpleWebComponent SSR Integration
34
-
35
- This package enables seamless Server-Side Rendering (SSR) for `@dooboostore/simple-web-component` applications. Here's how it works:
36
-
37
- ### Backend Setup
38
-
39
- Configure the server with `SSRSimpleWebComponentFilter` to handle SWC component registration and rendering:
40
-
41
- ```typescript
42
- import { SimpleBootHttpSSRServer } from '@dooboostore/simple-boot-http-server-ssr/SimpleBootHttpSSRServer';
43
- import { HttpSSRServerOption } from '@dooboostore/simple-boot-http-server-ssr/option';
44
- import { SSRSimpleWebComponentFilter } from '@dooboostore/simple-boot-http-server-ssr/filters/SSRSimpleWebComponentFilter';
45
- import { ResourceFilter } from '@dooboostore/simple-boot-http-server/filters';
46
- import swcRegister from '@dooboostore/simple-web-component';
47
- import bootfactory from './bootfactory';
48
-
49
- const swcFilter = new SSRSimpleWebComponentFilter({
50
- frontDistPath: './dist-front-end',
51
- frontDistIndexFileName: 'index.html',
52
- registerComponents: async (window: any) => {
53
- // Register SWC components in the virtual DOM
54
- swcRegister(window);
55
- const urlPath = window.location.pathname;
56
- // Initialize your app with bootfactory
57
- bootfactory(window, urlPath);
58
- }
59
- });
60
-
61
- const server = new SimpleBootHttpSSRServer(
62
- new HttpSSRServerOption({
63
- listen: { port: 8080 },
64
- filters: [new ResourceFilter('./dist-front-end'), swcFilter]
65
- })
66
- );
67
-
68
- server.run();
69
- ```
70
-
71
- ### Universal Bootfactory Pattern
72
-
73
- Use a universal bootfactory that runs on both server and client, detecting the environment and choosing the appropriate connection mode:
74
-
75
- ```typescript
76
- // src/bootfactory.ts
77
- import register from '@dooboostore/simple-web-component';
78
- import { componentFactories } from './components';
79
- import { pageFactories } from './pages';
80
-
81
- export default (window: Window, urlPath?: string) => {
82
- // Register all SWC components
83
- register(window, [...componentFactories, ...pageFactories]);
84
-
85
- const appElement = window.document.querySelector('#app');
86
- if (appElement?.connect) {
87
- const isClientWindow = typeof window !== 'undefined' && window === globalThis.window;
88
-
89
- appElement.connect({
90
- rootRouter: RootRouter.SYMBOL,
91
- routeType: 'path',
92
- path: urlPath ?? '/',
93
- window,
94
- // Server renders with direct mode, client hydrates with swap mode
95
- connectMode: isClientWindow ? 'swap' : 'direct'
96
- });
97
- }
98
-
99
- return appElement;
100
- };
101
- ```
102
-
103
- ### Client Entry Point
104
-
105
- The client-side entry point simply calls the same bootfactory to hydrate the server-rendered markup:
106
-
107
- ```typescript
108
- // front-end/index.ts
109
- import bootfactory from './bootfactory';
110
- import { UrlUtils } from '@dooboostore/core/url';
111
-
112
- console.log('🚀 Hydrating with SwcApplication...');
113
- const w = window;
114
- bootfactory(w, UrlUtils.getUrlPath(w.location));
115
- ```
116
-
117
- ### How It Works
118
-
119
- 1. **Server Request**: Client sends GET request to `/user/123`
120
- 2. **Virtual DOM Rendering**: `SSRSimpleWebComponentFilter` creates a virtual DOM environment via JSDOM
121
- 3. **Component Registration**: Your `registerComponents` callback registers all SWC components
122
- 4. **Bootfactory Initialization**: Bootfactory connects the app to the root router in **direct mode**
123
- 5. **HTML Serialization**: The rendered virtual DOM is serialized to HTML and sent to the client
124
- 6. **Client Hydration**: Browser loads the JavaScript and calls bootfactory again in **swap mode**
125
- 7. **Zero FOUC**: User sees the fully rendered page immediately; JavaScript takes over seamlessly
126
-
127
- ### Key Benefits
128
-
129
- | Benefit | Description |
130
- |---------|-------------|
131
- | **SEO-Friendly** | Full HTML sent to search engines; all content indexable |
132
- | **Fast FCP** | No "loading..." spinner; page is immediately interactive |
133
- | **Preserved Tags** | Server-rendered DOM tags (data attributes, ARIA labels) remain intact |
134
- | **Code Sharing** | Same routing, services, and components on server and client |
135
- | **Zero FOUC** | Flash of Unstyled Content eliminated; page renders on server first |
136
- | **Progressive Enhancement** | Core content works without JavaScript |
137
-
138
- ---
139
-
140
- ## Learn More
141
-
142
- The detailed API documentation is available on our documentation website.
143
-
144
- ## Security Hardening
145
-
146
- Use the following baseline controls before deploying SSR applications to production:
147
-
148
- - Restrict trusted origins and set strict CORS policy.
149
- - Sanitize any user-derived values injected into HTML templates.
150
- - Set `Content-Security-Policy`, `X-Content-Type-Options`, and `X-Frame-Options` headers.
151
- - Validate and bound request payload size, query parameters, and header length.
152
- - Use secure cookies (`HttpOnly`, `Secure`, `SameSite`) for session-related data.
153
- - Add SSR timeout and concurrency limits to prevent resource exhaustion.
154
- - Keep dependency versions updated and run vulnerability scans in CI.
155
-
156
- ### Minimal Production Checklist
157
-
158
- - HTTPS enforced end-to-end.
159
- - Origin/cookie policy reviewed.
160
- - CSP configured and tested for hydration scripts.
161
- - Error responses avoid leaking stack traces.
162
- - Request logs redact secrets and personal data.
163
- - SSR pool size and queue limits tuned for expected traffic.
164
-
165
- ## License
166
-
167
- This package is licensed under the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,54 +0,0 @@
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 LoadAroundBefore_exports = {};
19
- __export(LoadAroundBefore_exports, {
20
- LoadAroundBefore: () => LoadAroundBefore
21
- });
22
- module.exports = __toCommonJS(LoadAroundBefore_exports);
23
- var import_SimDecorator = require("@dooboostore/simple-boot/decorators/SimDecorator");
24
- var import_AOPDecorator = require("@dooboostore/simple-boot/decorators/aop/AOPDecorator");
25
- var import_core = require("@dooboostore/core");
26
- const LoadAroundBefore = (obj, propertyKey, args) => {
27
- const simstanceManager = obj._SimpleBoot_simstanceManager;
28
- const simOption = obj._SimpleBoot_simOption;
29
- const config = (0, import_SimDecorator.getSim)(obj);
30
- if (simstanceManager && simOption && config?.scheme) {
31
- const key = config.scheme + "_" + propertyKey;
32
- const type = import_core.ReflectUtils.getReturnType(obj, propertyKey);
33
- const isHas = key in (simOption.window.server_side_data ?? {});
34
- if (isHas) {
35
- const data = simOption.window.server_side_data?.[key];
36
- delete simOption.window.server_side_data?.[key];
37
- let rdata;
38
- if (type === Promise) {
39
- rdata = Promise.resolve(data);
40
- } else {
41
- rdata = data;
42
- }
43
- throw new import_AOPDecorator.AroundForceReturn(rdata);
44
- } else {
45
- return args;
46
- }
47
- }
48
- return args;
49
- };
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- LoadAroundBefore
53
- });
54
- //# sourceMappingURL=LoadAroundBefore.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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';\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
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAuB;AACvB,0BAAkC;AAClC,kBAA6B;AAEtB,MAAM,mBAAmB,CAAC,KAAU,aAAqB,SAAgB;AAC5E,QAAM,mBAAmB,IAAI;AAC7B,QAAM,YAAY,IAAI;AACtB,QAAM,aAAS,4BAAO,GAAG;AACzB,MAAI,oBAAoB,aAAa,QAAQ,QAAQ;AACjD,UAAM,MAAM,OAAO,SAAS,MAAM;AAClC,UAAM,OAAO,yBAAa,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,sCAAkB,KAAK;AAAA,IACrC,OAAO;AACH,aAAO;AAAA,IACX;AAAA,EACJ;AACA,SAAO;AACX;",
6
- "names": []
7
- }
@@ -1,53 +0,0 @@
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 SaveAroundAfter_exports = {};
19
- __export(SaveAroundAfter_exports, {
20
- SaveAroundAfter: () => SaveAroundAfter,
21
- getStorage: () => getStorage
22
- });
23
- module.exports = __toCommonJS(SaveAroundAfter_exports);
24
- var import_SimDecorator = require("@dooboostore/simple-boot/decorators/SimDecorator");
25
- const SaveAroundAfter = (obj, propertyKey, args, beforeReturn) => {
26
- const simstanceManager = obj._SimpleBoot_simstanceManager;
27
- const simOption = obj._SimpleBoot_simOption;
28
- const config = (0, import_SimDecorator.getSim)(obj);
29
- if (simstanceManager && simOption && config?.scheme) {
30
- if (!simOption.window.server_side_data) {
31
- simOption.window.server_side_data = {};
32
- }
33
- const key = config.scheme + "_" + propertyKey;
34
- if (beforeReturn instanceof Promise) {
35
- beforeReturn.then((it) => {
36
- simOption.window.server_side_data[key] = JSON.stringify(it);
37
- return it;
38
- });
39
- } else {
40
- simOption.window.server_side_data[key] = JSON.stringify(beforeReturn);
41
- }
42
- }
43
- return beforeReturn;
44
- };
45
- const getStorage = (window) => {
46
- return window.aroundStorage;
47
- };
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- SaveAroundAfter,
51
- getStorage
52
- });
53
- //# sourceMappingURL=SaveAroundAfter.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/decorators/SaveAroundAfter.ts"],
4
- "sourcesContent": ["import { getSim } from '@dooboostore/simple-boot/decorators/SimDecorator';\n\nexport const SaveAroundAfter = (obj: any, propertyKey: string, args: any[], beforeReturn: 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 if (!simOption.window.server_side_data) {\n simOption.window.server_side_data = {};\n }\n const key = config.scheme+'_'+propertyKey;\n if (beforeReturn instanceof Promise) {\n beforeReturn.then((it) => {\n simOption.window.server_side_data[key] = JSON.stringify(it);\n return it;\n });\n } else {\n simOption.window.server_side_data[key] = JSON.stringify(beforeReturn);\n }\n }\n return beforeReturn;\n}\n\n\nexport const getStorage = (window: Window) => {\n return (window as any).aroundStorage;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAuB;AAEhB,MAAM,kBAAkB,CAAC,KAAU,aAAqB,MAAa,iBAAsB;AAC9F,QAAM,mBAAmB,IAAI;AAC7B,QAAM,YAAY,IAAI;AACtB,QAAM,aAAS,4BAAO,GAAG;AACzB,MAAI,oBAAoB,aAAa,QAAQ,QAAQ;AACjD,QAAI,CAAC,UAAU,OAAO,kBAAkB;AACpC,gBAAU,OAAO,mBAAmB,CAAC;AAAA,IACzC;AACA,UAAM,MAAM,OAAO,SAAO,MAAI;AAC9B,QAAI,wBAAwB,SAAS;AACjC,mBAAa,KAAK,CAAC,OAAO;AACtB,kBAAU,OAAO,iBAAiB,GAAG,IAAI,KAAK,UAAU,EAAE;AAC1D,eAAO;AAAA,MACX,CAAC;AAAA,IACL,OAAO;AACH,gBAAU,OAAO,iBAAiB,GAAG,IAAI,KAAK,UAAU,YAAY;AAAA,IACxE;AAAA,EACJ;AACA,SAAO;AACX;AAGO,MAAM,aAAa,CAAC,WAAmB;AAC1C,SAAQ,OAAe;AAC3B;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var decorators_exports = {};
16
- module.exports = __toCommonJS(decorators_exports);
17
- __reExport(decorators_exports, require("./LoadAroundBefore"), module.exports);
18
- __reExport(decorators_exports, require("./SaveAroundAfter"), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require("./LoadAroundBefore"),
22
- ...require("./SaveAroundAfter")
23
- });
24
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/decorators/index.ts"],
4
- "sourcesContent": ["export * from './LoadAroundBefore';\nexport * from './SaveAroundAfter';"],
5
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,+BAAd;AACA,+BAAc,8BADd;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/filters/SSRLinkDomDomFilter.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, AsyncBlockingQueue, RandomUtils, MessageOperator, MessageInternal } from '@dooboostore/core';\nimport { JsdomInitializer } from '../initializers/JsdomInitializer';\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 { LinkedomInitializer } from '../initializers/LinkedomInitializer';\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 SSRLinkDomDomFilter 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 return new LinkedomInitializer(\n this.config.frontDistPath,\n this.config.frontDistIndexFileName || 'index.html',\n { url: this.welcomUrl }\n ).run();\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.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 // runRouting!!\n const targetUrl = url.toString();\n await simpleBootFront.goRouting(targetUrl);\n await new Promise(r => setTimeout(r, 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\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 MessageInternal.firstValueFrom(\n // @ts-ignore\n simpleBootFront.routingObservable.pipe(\n // @ts-ignore\n MessageOperator.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 MessageOperator.first()\n )\n );\n // console.log('???????done');\n const html = this.makeHTML(simpleBootFront);\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 html = '<!DOCTYPE html>' + html;\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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA4B;AAE5B,kBAAmG;AAGnG,mBAAsB;AACtB,wBAA2B;AAK3B,2BAA8B;AAC9B,wBAA+B;AAE/B,iCAAoC;AAoB7B,MAAM,oBAAsC;AAAA,EAQjD,YACS,QACA,kBACP;AAFO;AACA;AATT,SAAQ,sBAAyC,CAAC;AAClD,SAAQ,uBAAuB,IAAI,+BAAoC;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/B;AAEA,SAAK,oBAAoB,QAAQ,WAAS;AACxC,MAAC,MAAc,OAAO,OAAO,MAAM;AAAA,IACrC,CAAC;AACD,SAAK,sBAAsB,CAAC;AAAA,EAC9B;AAAA,EAEA,MAAM,WAAW;AACf,WAAO,IAAI;AAAA,MACT,KAAK,OAAO;AAAA,MACZ,KAAK,OAAO,0BAA0B;AAAA,MACtC,EAAE,KAAK,KAAK,UAAU;AAAA,IACxB,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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,WAAO,oBAAoB;AAC3B,WAAO,KAAK,QAAQ,qBAAqB,EAAE;AAC3C,UAAM,iBAAkB,gBAAgB,OAAO,OAAe;AAC9D,QAAI,gBAAgB;AAClB,YAAM,OAAO,OAAO,QAAQ,cAAc,EACvC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM;AACf,YAAI,OAAO,MAAM,UAAU;AACzB,iBAAO,2BAA2B,CAAC,MAAM,CAAC;AAAA,QAC5C,OAAO;AACL,iBAAO,2BAA2B,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;AAAA,QAC5D;AAAA,MACF,CAAC,EACA,KAAK,GAAG;AACX,UAAI,MAAM;AACR,eAAO,KAAK,QAAQ,WAAW,wCAAwC,IAAI,oBAAoB;AAAA,MACjG;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EACA,MAAM,kBAAkB,EAAE,IAAI,SAAS,6BAAW,GAAG,GAAiD,MAAc;AAClH,OAAG,cAAc,MAAM;AACvB,OAAG,aAAa,+BAAY,aAAa,mBAAM,QAAQ;AACvD,UAAM,GAAG,OAAO,IAAI;AAAA,EACtB;AAAA,EAEA,MAAM,aAAa,EAAE,IAAI,IAAI,GAAkF;AAC7G,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,31 +0,0 @@
1
- import { getSim } from "@dooboostore/simple-boot/decorators/SimDecorator";
2
- import { AroundForceReturn } from "@dooboostore/simple-boot/decorators/aop/AOPDecorator";
3
- import { ReflectUtils } from "@dooboostore/core";
4
- const LoadAroundBefore = (obj, propertyKey, args) => {
5
- const simstanceManager = obj._SimpleBoot_simstanceManager;
6
- const simOption = obj._SimpleBoot_simOption;
7
- const config = getSim(obj);
8
- if (simstanceManager && simOption && config?.scheme) {
9
- const key = config.scheme + "_" + propertyKey;
10
- const type = ReflectUtils.getReturnType(obj, propertyKey);
11
- const isHas = key in (simOption.window.server_side_data ?? {});
12
- if (isHas) {
13
- const data = simOption.window.server_side_data?.[key];
14
- delete simOption.window.server_side_data?.[key];
15
- let rdata;
16
- if (type === Promise) {
17
- rdata = Promise.resolve(data);
18
- } else {
19
- rdata = data;
20
- }
21
- throw new AroundForceReturn(rdata);
22
- } else {
23
- return args;
24
- }
25
- }
26
- return args;
27
- };
28
- export {
29
- LoadAroundBefore
30
- };
31
- //# sourceMappingURL=LoadAroundBefore.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 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';\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
- "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
- "names": []
7
- }
@@ -1,29 +0,0 @@
1
- import { getSim } from "@dooboostore/simple-boot/decorators/SimDecorator";
2
- const SaveAroundAfter = (obj, propertyKey, args, beforeReturn) => {
3
- const simstanceManager = obj._SimpleBoot_simstanceManager;
4
- const simOption = obj._SimpleBoot_simOption;
5
- const config = getSim(obj);
6
- if (simstanceManager && simOption && config?.scheme) {
7
- if (!simOption.window.server_side_data) {
8
- simOption.window.server_side_data = {};
9
- }
10
- const key = config.scheme + "_" + propertyKey;
11
- if (beforeReturn instanceof Promise) {
12
- beforeReturn.then((it) => {
13
- simOption.window.server_side_data[key] = JSON.stringify(it);
14
- return it;
15
- });
16
- } else {
17
- simOption.window.server_side_data[key] = JSON.stringify(beforeReturn);
18
- }
19
- }
20
- return beforeReturn;
21
- };
22
- const getStorage = (window) => {
23
- return window.aroundStorage;
24
- };
25
- export {
26
- SaveAroundAfter,
27
- getStorage
28
- };
29
- //# sourceMappingURL=SaveAroundAfter.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/decorators/SaveAroundAfter.ts"],
4
- "sourcesContent": ["import { getSim } from '@dooboostore/simple-boot/decorators/SimDecorator';\n\nexport const SaveAroundAfter = (obj: any, propertyKey: string, args: any[], beforeReturn: 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 if (!simOption.window.server_side_data) {\n simOption.window.server_side_data = {};\n }\n const key = config.scheme+'_'+propertyKey;\n if (beforeReturn instanceof Promise) {\n beforeReturn.then((it) => {\n simOption.window.server_side_data[key] = JSON.stringify(it);\n return it;\n });\n } else {\n simOption.window.server_side_data[key] = JSON.stringify(beforeReturn);\n }\n }\n return beforeReturn;\n}\n\n\nexport const getStorage = (window: Window) => {\n return (window as any).aroundStorage;\n}\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AAEhB,MAAM,kBAAkB,CAAC,KAAU,aAAqB,MAAa,iBAAsB;AAC9F,QAAM,mBAAmB,IAAI;AAC7B,QAAM,YAAY,IAAI;AACtB,QAAM,SAAS,OAAO,GAAG;AACzB,MAAI,oBAAoB,aAAa,QAAQ,QAAQ;AACjD,QAAI,CAAC,UAAU,OAAO,kBAAkB;AACpC,gBAAU,OAAO,mBAAmB,CAAC;AAAA,IACzC;AACA,UAAM,MAAM,OAAO,SAAO,MAAI;AAC9B,QAAI,wBAAwB,SAAS;AACjC,mBAAa,KAAK,CAAC,OAAO;AACtB,kBAAU,OAAO,iBAAiB,GAAG,IAAI,KAAK,UAAU,EAAE;AAC1D,eAAO;AAAA,MACX,CAAC;AAAA,IACL,OAAO;AACH,gBAAU,OAAO,iBAAiB,GAAG,IAAI,KAAK,UAAU,YAAY;AAAA,IACxE;AAAA,EACJ;AACA,SAAO;AACX;AAGO,MAAM,aAAa,CAAC,WAAmB;AAC1C,SAAQ,OAAe;AAC3B;",
6
- "names": []
7
- }
@@ -1,3 +0,0 @@
1
- export * from "./LoadAroundBefore.js";
2
- export * from "./SaveAroundAfter.js";
3
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/decorators/index.ts"],
4
- "sourcesContent": ["export * from './LoadAroundBefore';\nexport * from './SaveAroundAfter';"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/filters/SSRLinkDomDomFilter.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, AsyncBlockingQueue, RandomUtils, MessageOperator, MessageInternal } from '@dooboostore/core';\nimport { JsdomInitializer } from '../initializers/JsdomInitializer';\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 { LinkedomInitializer } from '../initializers/LinkedomInitializer';\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 SSRLinkDomDomFilter 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 return new LinkedomInitializer(\n this.config.frontDistPath,\n this.config.frontDistIndexFileName || 'index.html',\n { url: this.welcomUrl }\n ).run();\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.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 // runRouting!!\n const targetUrl = url.toString();\n await simpleBootFront.goRouting(targetUrl);\n await new Promise(r => setTimeout(r, 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\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 MessageInternal.firstValueFrom(\n // @ts-ignore\n simpleBootFront.routingObservable.pipe(\n // @ts-ignore\n MessageOperator.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 MessageOperator.first()\n )\n );\n // console.log('???????done');\n const html = this.makeHTML(simpleBootFront);\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 html = '<!DOCTYPE html>' + html;\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;AAE5B,SAA0B,oBAAoB,aAAa,iBAAiB,uBAAuB;AAGnG,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAK3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAE/B,SAAS,2BAA2B;AAoB7B,MAAM,oBAAsC;AAAA,EAQjD,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/B;AAEA,SAAK,oBAAoB,QAAQ,WAAS;AACxC,MAAC,MAAc,OAAO,OAAO,MAAM;AAAA,IACrC,CAAC;AACD,SAAK,sBAAsB,CAAC;AAAA,EAC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any[];
2
- //# sourceMappingURL=LoadAroundBefore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoadAroundBefore.d.ts","sourceRoot":"","sources":["../../../src/decorators/LoadAroundBefore.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,GAAI,KAAK,GAAG,EAAE,aAAa,MAAM,EAAE,MAAM,GAAG,EAAE,UAuB1E,CAAA"}
@@ -1,3 +0,0 @@
1
- export declare const SaveAroundAfter: (obj: any, propertyKey: string, args: any[], beforeReturn: any) => any;
2
- export declare const getStorage: (window: Window) => any;
3
- //# sourceMappingURL=SaveAroundAfter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SaveAroundAfter.d.ts","sourceRoot":"","sources":["../../../src/decorators/SaveAroundAfter.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAI,KAAK,GAAG,EAAE,aAAa,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,cAAc,GAAG,QAmB5F,CAAA;AAGD,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,QAExC,CAAA"}
@@ -1,3 +0,0 @@
1
- export * from './LoadAroundBefore';
2
- export * from './SaveAroundAfter';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SSRLinkDomDomFilter.d.ts","sourceRoot":"","sources":["../../../src/filters/SSRLinkDomDomFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAC;AAE9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAqE,MAAM,mBAAmB,CAAC;AAEvH,OAAO,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC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,CAAC,GAAG,EAAE,oBAAoB;IAYhC,SAAS;IAWT,QAAQ;IAcR,SAAS,CAAC,MAAM,EAAE,MAAM;IAU9B,eAAe,CAAC,eAAe,EAAE,eAAe;IAK1C,SAAS;IAMT,aAAa,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;QAAE,EAAE,EAAE,eAAe,CAAC;QAAC,GAAG,EAAE,oBAAoB,CAAC;QAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE;IA2E9G,QAAQ,CAAC,eAAe,EAAE,eAAe;IA4BnC,iBAAiB,CAAC,EAAE,EAAE,EAAE,MAAsB,EAAE,EAAE;QAAE,EAAE,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,CAAA;KAAE,EAAE,IAAI,EAAE,MAAM;IAM5G,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;QAAE,EAAE,EAAE,eAAe,CAAC;QAAC,GAAG,EAAE,oBAAoB,CAAC;QAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE;CAG9G"}
@@ -1,28 +0,0 @@
1
- import { getSim } from '@dooboostore/simple-boot/decorators/SimDecorator';
2
- import { AroundForceReturn } from '@dooboostore/simple-boot/decorators/aop/AOPDecorator';
3
- import { ReflectUtils } from '@dooboostore/core';
4
-
5
- export const LoadAroundBefore = (obj: any, propertyKey: string, args: any[]) => {
6
- const simstanceManager = obj._SimpleBoot_simstanceManager;
7
- const simOption = obj._SimpleBoot_simOption;
8
- const config = getSim(obj);
9
- if (simstanceManager && simOption && config?.scheme) {
10
- const key = config.scheme + '_' + propertyKey;
11
- const type = ReflectUtils.getReturnType(obj, propertyKey);
12
- const isHas = (key in (simOption.window.server_side_data ?? {}))
13
- if (isHas) {
14
- const data = simOption.window.server_side_data?.[key];
15
- delete simOption.window.server_side_data?.[key];
16
- let rdata;
17
- if (type === Promise) {
18
- rdata = Promise.resolve(data);
19
- } else {
20
- rdata = data;
21
- }
22
- throw new AroundForceReturn(rdata);
23
- } else {
24
- return args;
25
- }
26
- }
27
- return args;
28
- }
@@ -1,27 +0,0 @@
1
- import { getSim } from '@dooboostore/simple-boot/decorators/SimDecorator';
2
-
3
- export const SaveAroundAfter = (obj: any, propertyKey: string, args: any[], beforeReturn: any) => {
4
- const simstanceManager = obj._SimpleBoot_simstanceManager;
5
- const simOption = obj._SimpleBoot_simOption;
6
- const config = getSim(obj);
7
- if (simstanceManager && simOption && config?.scheme) {
8
- if (!simOption.window.server_side_data) {
9
- simOption.window.server_side_data = {};
10
- }
11
- const key = config.scheme+'_'+propertyKey;
12
- if (beforeReturn instanceof Promise) {
13
- beforeReturn.then((it) => {
14
- simOption.window.server_side_data[key] = JSON.stringify(it);
15
- return it;
16
- });
17
- } else {
18
- simOption.window.server_side_data[key] = JSON.stringify(beforeReturn);
19
- }
20
- }
21
- return beforeReturn;
22
- }
23
-
24
-
25
- export const getStorage = (window: Window) => {
26
- return (window as any).aroundStorage;
27
- }
@@ -1,2 +0,0 @@
1
- export * from './LoadAroundBefore';
2
- export * from './SaveAroundAfter';