@modern-js/runtime 2.42.1 → 2.42.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ssr/serverRender/renderToString/buildHtml.js +12 -8
- package/dist/cjs/ssr/serverRender/renderToString/entry.js +1 -1
- package/dist/esm/ssr/serverRender/renderToString/buildHtml.js +13 -8
- package/dist/esm/ssr/serverRender/renderToString/entry.js +2 -2
- package/dist/esm-node/ssr/serverRender/renderToString/buildHtml.js +12 -8
- package/dist/esm-node/ssr/serverRender/renderToString/entry.js +1 -1
- package/package.json +10 -10
|
@@ -25,24 +25,28 @@ __export(buildHtml_exports, {
|
|
|
25
25
|
createReplaceSSRDataScript: () => createReplaceSSRDataScript
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(buildHtml_exports);
|
|
28
|
+
function unsafeReplace(source, searchValue, replaceValue) {
|
|
29
|
+
const [s1, s2] = source.split(searchValue);
|
|
30
|
+
return s1 + replaceValue + s2;
|
|
31
|
+
}
|
|
28
32
|
function buildHtml(template, callbacks) {
|
|
29
33
|
return callbacks.reduce((tmp, cb) => cb(tmp), template);
|
|
30
34
|
}
|
|
31
35
|
function createReplaceHtml(html) {
|
|
32
|
-
const
|
|
33
|
-
return (template) => template
|
|
36
|
+
const HTML_REMARK = "<!--<?- html ?>-->";
|
|
37
|
+
return (template) => unsafeReplace(template, HTML_REMARK, html);
|
|
34
38
|
}
|
|
35
39
|
function createReplaceSSRDataScript(data) {
|
|
36
|
-
const
|
|
37
|
-
return (template) => template
|
|
40
|
+
const SSR_DATA_REMARK = "<!--<?- SSRDataScript ?>-->";
|
|
41
|
+
return (template) => unsafeReplace(template, SSR_DATA_REMARK, data);
|
|
38
42
|
}
|
|
39
43
|
function createReplaceChunkJs(js) {
|
|
40
|
-
const
|
|
41
|
-
return (template) => template
|
|
44
|
+
const CHUNK_JS_REMARK = "<!--<?- chunksMap.js ?>-->";
|
|
45
|
+
return (template) => unsafeReplace(template, CHUNK_JS_REMARK, js);
|
|
42
46
|
}
|
|
43
47
|
function createReplaceChunkCss(css) {
|
|
44
|
-
const CHUNK_CSS_REG =
|
|
45
|
-
return (template) => template
|
|
48
|
+
const CHUNK_CSS_REG = "<!--<?- chunksMap.css ?>-->";
|
|
49
|
+
return (template) => unsafeReplace(template, CHUNK_CSS_REG, css);
|
|
46
50
|
}
|
|
47
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
52
|
0 && (module.exports = {
|
|
@@ -97,8 +97,8 @@ Entry = class Entry2 {
|
|
|
97
97
|
const html = (0, import_buildHtml.buildHtml)(this.template, [
|
|
98
98
|
(0, import_buildHtml.createReplaceChunkCss)(this.result.chunksMap.css),
|
|
99
99
|
(0, import_buildHtml.createReplaceChunkJs)(this.result.chunksMap.js),
|
|
100
|
-
(0, import_buildHtml.createReplaceHtml)(this.result.html || ""),
|
|
101
100
|
(0, import_buildHtml.createReplaceSSRDataScript)(ssrDataScripts),
|
|
101
|
+
(0, import_buildHtml.createReplaceHtml)(this.result.html || ""),
|
|
102
102
|
...this.htmlModifiers
|
|
103
103
|
]);
|
|
104
104
|
const helmetData = import_react_helmet.default.renderStatic();
|
|
@@ -1,30 +1,35 @@
|
|
|
1
|
+
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
2
|
+
function unsafeReplace(source, searchValue, replaceValue) {
|
|
3
|
+
var _source_split = _sliced_to_array(source.split(searchValue), 2), s1 = _source_split[0], s2 = _source_split[1];
|
|
4
|
+
return s1 + replaceValue + s2;
|
|
5
|
+
}
|
|
1
6
|
function buildHtml(template, callbacks) {
|
|
2
7
|
return callbacks.reduce(function(tmp, cb) {
|
|
3
8
|
return cb(tmp);
|
|
4
9
|
}, template);
|
|
5
10
|
}
|
|
6
11
|
function createReplaceHtml(html) {
|
|
7
|
-
var
|
|
12
|
+
var HTML_REMARK = "<!--<?- html ?>-->";
|
|
8
13
|
return function(template) {
|
|
9
|
-
return template
|
|
14
|
+
return unsafeReplace(template, HTML_REMARK, html);
|
|
10
15
|
};
|
|
11
16
|
}
|
|
12
17
|
function createReplaceSSRDataScript(data) {
|
|
13
|
-
var
|
|
18
|
+
var SSR_DATA_REMARK = "<!--<?- SSRDataScript ?>-->";
|
|
14
19
|
return function(template) {
|
|
15
|
-
return template
|
|
20
|
+
return unsafeReplace(template, SSR_DATA_REMARK, data);
|
|
16
21
|
};
|
|
17
22
|
}
|
|
18
23
|
function createReplaceChunkJs(js) {
|
|
19
|
-
var
|
|
24
|
+
var CHUNK_JS_REMARK = "<!--<?- chunksMap.js ?>-->";
|
|
20
25
|
return function(template) {
|
|
21
|
-
return template
|
|
26
|
+
return unsafeReplace(template, CHUNK_JS_REMARK, js);
|
|
22
27
|
};
|
|
23
28
|
}
|
|
24
29
|
function createReplaceChunkCss(css) {
|
|
25
|
-
var CHUNK_CSS_REG =
|
|
30
|
+
var CHUNK_CSS_REG = "<!--<?- chunksMap.css ?>-->";
|
|
26
31
|
return function(template) {
|
|
27
|
-
return template
|
|
32
|
+
return unsafeReplace(template, CHUNK_CSS_REG, css);
|
|
28
33
|
};
|
|
29
34
|
}
|
|
30
35
|
export {
|
|
@@ -135,8 +135,8 @@ Entry = /* @__PURE__ */ function() {
|
|
|
135
135
|
html = buildHtml(_this.template, [
|
|
136
136
|
createReplaceChunkCss(_this.result.chunksMap.css),
|
|
137
137
|
createReplaceChunkJs(_this.result.chunksMap.js),
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
createReplaceSSRDataScript(ssrDataScripts),
|
|
139
|
+
createReplaceHtml(_this.result.html || "")
|
|
140
140
|
].concat(_to_consumable_array(_this.htmlModifiers)));
|
|
141
141
|
helmetData = ReactHelmet.renderStatic();
|
|
142
142
|
return [
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
+
function unsafeReplace(source, searchValue, replaceValue) {
|
|
2
|
+
const [s1, s2] = source.split(searchValue);
|
|
3
|
+
return s1 + replaceValue + s2;
|
|
4
|
+
}
|
|
1
5
|
function buildHtml(template, callbacks) {
|
|
2
6
|
return callbacks.reduce((tmp, cb) => cb(tmp), template);
|
|
3
7
|
}
|
|
4
8
|
function createReplaceHtml(html) {
|
|
5
|
-
const
|
|
6
|
-
return (template) => template
|
|
9
|
+
const HTML_REMARK = "<!--<?- html ?>-->";
|
|
10
|
+
return (template) => unsafeReplace(template, HTML_REMARK, html);
|
|
7
11
|
}
|
|
8
12
|
function createReplaceSSRDataScript(data) {
|
|
9
|
-
const
|
|
10
|
-
return (template) => template
|
|
13
|
+
const SSR_DATA_REMARK = "<!--<?- SSRDataScript ?>-->";
|
|
14
|
+
return (template) => unsafeReplace(template, SSR_DATA_REMARK, data);
|
|
11
15
|
}
|
|
12
16
|
function createReplaceChunkJs(js) {
|
|
13
|
-
const
|
|
14
|
-
return (template) => template
|
|
17
|
+
const CHUNK_JS_REMARK = "<!--<?- chunksMap.js ?>-->";
|
|
18
|
+
return (template) => unsafeReplace(template, CHUNK_JS_REMARK, js);
|
|
15
19
|
}
|
|
16
20
|
function createReplaceChunkCss(css) {
|
|
17
|
-
const CHUNK_CSS_REG =
|
|
18
|
-
return (template) => template
|
|
21
|
+
const CHUNK_CSS_REG = "<!--<?- chunksMap.css ?>-->";
|
|
22
|
+
return (template) => unsafeReplace(template, CHUNK_CSS_REG, css);
|
|
19
23
|
}
|
|
20
24
|
export {
|
|
21
25
|
buildHtml,
|
|
@@ -64,8 +64,8 @@ Entry = class Entry2 {
|
|
|
64
64
|
const html = buildHtml(this.template, [
|
|
65
65
|
createReplaceChunkCss(this.result.chunksMap.css),
|
|
66
66
|
createReplaceChunkJs(this.result.chunksMap.js),
|
|
67
|
-
createReplaceHtml(this.result.html || ""),
|
|
68
67
|
createReplaceSSRDataScript(ssrDataScripts),
|
|
68
|
+
createReplaceHtml(this.result.html || ""),
|
|
69
69
|
...this.htmlModifiers
|
|
70
70
|
]);
|
|
71
71
|
const helmetData = ReactHelmet.renderStatic();
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.42.
|
|
18
|
+
"version": "2.42.2",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -171,10 +171,10 @@
|
|
|
171
171
|
"react-side-effect": "^2.1.1",
|
|
172
172
|
"styled-components": "^5.3.1",
|
|
173
173
|
"@swc/helpers": "0.5.3",
|
|
174
|
-
"@modern-js/
|
|
175
|
-
"@modern-js/
|
|
176
|
-
"@modern-js/
|
|
177
|
-
"@modern-js/utils": "2.42.
|
|
174
|
+
"@modern-js/types": "2.42.2",
|
|
175
|
+
"@modern-js/plugin": "2.42.2",
|
|
176
|
+
"@modern-js/runtime-utils": "2.42.2",
|
|
177
|
+
"@modern-js/utils": "2.42.2"
|
|
178
178
|
},
|
|
179
179
|
"peerDependencies": {
|
|
180
180
|
"react": ">=17",
|
|
@@ -195,11 +195,11 @@
|
|
|
195
195
|
"ts-jest": "^29.1.0",
|
|
196
196
|
"typescript": "^5",
|
|
197
197
|
"webpack": "^5.88.1",
|
|
198
|
-
"@modern-js/
|
|
199
|
-
"@modern-js/
|
|
200
|
-
"@scripts/build": "2.42.
|
|
201
|
-
"@
|
|
202
|
-
"@
|
|
198
|
+
"@modern-js/core": "2.42.2",
|
|
199
|
+
"@modern-js/app-tools": "2.42.2",
|
|
200
|
+
"@scripts/build": "2.42.2",
|
|
201
|
+
"@scripts/jest-config": "2.42.2",
|
|
202
|
+
"@modern-js/server-core": "2.42.2"
|
|
203
203
|
},
|
|
204
204
|
"sideEffects": false,
|
|
205
205
|
"publishConfig": {
|