@modern-js/runtime 3.4.0 → 3.5.0
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.
|
@@ -340,12 +340,13 @@ const documentPlugin = ()=>({
|
|
|
340
340
|
processedHtml = processCommentPlaceholders(processedHtml);
|
|
341
341
|
return `<!DOCTYPE html>${processedHtml}`.replace(external_constants_js_namespaceObject.DOCUMENT_META_PLACEHOLDER, ()=>metas).replace(external_constants_js_namespaceObject.DOCUMENT_SSR_PLACEHOLDER, ()=>external_constants_js_namespaceObject.HTML_SEPARATOR).replace(external_constants_js_namespaceObject.DOCUMENT_SCRIPTS_PLACEHOLDER, ()=>scripts).replace(external_constants_js_namespaceObject.DOCUMENT_LINKS_PLACEHOLDER, ()=>links).replace(external_constants_js_namespaceObject.DOCUMENT_CHUNKSMAP_PLACEHOLDER, ()=>external_constants_js_namespaceObject.PLACEHOLDER_REPLACER_MAP[external_constants_js_namespaceObject.DOCUMENT_CHUNKSMAP_PLACEHOLDER]).replace(external_constants_js_namespaceObject.DOCUMENT_SSRDATASCRIPT_PLACEHOLDER, ()=>external_constants_js_namespaceObject.PLACEHOLDER_REPLACER_MAP[external_constants_js_namespaceObject.DOCUMENT_SSRDATASCRIPT_PLACEHOLDER]).replace(external_constants_js_namespaceObject.DOCUMENT_TITLE_PLACEHOLDER, ()=>titles);
|
|
342
342
|
};
|
|
343
|
-
const documentEntry = (entryName
|
|
343
|
+
const documentEntry = (entryName)=>{
|
|
344
344
|
const { entrypoints, internalDirectory, appDirectory } = api.getAppContext();
|
|
345
345
|
const documentFilePath = getDocumentByEntryName(entrypoints, entryName, appDirectory);
|
|
346
346
|
if (!documentFilePath) return null;
|
|
347
347
|
return async (templateData)=>{
|
|
348
348
|
const config = api.getNormalizedConfig();
|
|
349
|
+
const { compilation: _compilation, htmlPlugin, rspackConfig: _rspackConfig, ...templateParameters } = templateData;
|
|
349
350
|
const documentParams = getDocParams({
|
|
350
351
|
config: config,
|
|
351
352
|
entryName,
|
|
@@ -363,7 +364,6 @@ const documentPlugin = ()=>({
|
|
|
363
364
|
debug("entry %s's document jsx rendered html: %o", entryName, html);
|
|
364
365
|
const { partialsByEntrypoint } = api.getAppContext();
|
|
365
366
|
html = processPartials(html, entryName, partialsByEntrypoint || {});
|
|
366
|
-
const htmlPlugin = templateData.htmlPlugin || templateData.htmlWebpackPlugin || templateData.htmlRspackPlugin;
|
|
367
367
|
if (!htmlPlugin) throw new Error('Failed to get HTML plugin tags from template parameters.');
|
|
368
368
|
const { scripts, links, metas, titles } = extractHtmlTags(htmlPlugin, templateParameters);
|
|
369
369
|
return processPlaceholders(html, config, scripts, links, metas, titles);
|
|
@@ -375,10 +375,7 @@ const documentPlugin = ()=>({
|
|
|
375
375
|
return {
|
|
376
376
|
tools: {
|
|
377
377
|
htmlPlugin: (options, entry)=>{
|
|
378
|
-
const
|
|
379
|
-
...options?.templateParameters
|
|
380
|
-
};
|
|
381
|
-
const templateContent = documentEntry(entry.entryName, hackParameters);
|
|
378
|
+
const templateContent = documentEntry(entry.entryName);
|
|
382
379
|
const documentHtmlOptions = templateContent ? {
|
|
383
380
|
templateContent,
|
|
384
381
|
inject: false
|
|
@@ -295,12 +295,13 @@ const documentPlugin = ()=>({
|
|
|
295
295
|
processedHtml = processCommentPlaceholders(processedHtml);
|
|
296
296
|
return `<!DOCTYPE html>${processedHtml}`.replace(DOCUMENT_META_PLACEHOLDER, ()=>metas).replace(DOCUMENT_SSR_PLACEHOLDER, ()=>HTML_SEPARATOR).replace(DOCUMENT_SCRIPTS_PLACEHOLDER, ()=>scripts).replace(DOCUMENT_LINKS_PLACEHOLDER, ()=>links).replace(DOCUMENT_CHUNKSMAP_PLACEHOLDER, ()=>PLACEHOLDER_REPLACER_MAP[DOCUMENT_CHUNKSMAP_PLACEHOLDER]).replace(DOCUMENT_SSRDATASCRIPT_PLACEHOLDER, ()=>PLACEHOLDER_REPLACER_MAP[DOCUMENT_SSRDATASCRIPT_PLACEHOLDER]).replace(DOCUMENT_TITLE_PLACEHOLDER, ()=>titles);
|
|
297
297
|
};
|
|
298
|
-
const documentEntry = (entryName
|
|
298
|
+
const documentEntry = (entryName)=>{
|
|
299
299
|
const { entrypoints, internalDirectory, appDirectory } = api.getAppContext();
|
|
300
300
|
const documentFilePath = getDocumentByEntryName(entrypoints, entryName, appDirectory);
|
|
301
301
|
if (!documentFilePath) return null;
|
|
302
302
|
return async (templateData)=>{
|
|
303
303
|
const config = api.getNormalizedConfig();
|
|
304
|
+
const { compilation: _compilation, htmlPlugin, rspackConfig: _rspackConfig, ...templateParameters } = templateData;
|
|
304
305
|
const documentParams = getDocParams({
|
|
305
306
|
config: config,
|
|
306
307
|
entryName,
|
|
@@ -318,7 +319,6 @@ const documentPlugin = ()=>({
|
|
|
318
319
|
debug("entry %s's document jsx rendered html: %o", entryName, html);
|
|
319
320
|
const { partialsByEntrypoint } = api.getAppContext();
|
|
320
321
|
html = processPartials(html, entryName, partialsByEntrypoint || {});
|
|
321
|
-
const htmlPlugin = templateData.htmlPlugin || templateData.htmlWebpackPlugin || templateData.htmlRspackPlugin;
|
|
322
322
|
if (!htmlPlugin) throw new Error('Failed to get HTML plugin tags from template parameters.');
|
|
323
323
|
const { scripts, links, metas, titles } = extractHtmlTags(htmlPlugin, templateParameters);
|
|
324
324
|
return processPlaceholders(html, config, scripts, links, metas, titles);
|
|
@@ -330,10 +330,7 @@ const documentPlugin = ()=>({
|
|
|
330
330
|
return {
|
|
331
331
|
tools: {
|
|
332
332
|
htmlPlugin: (options, entry)=>{
|
|
333
|
-
const
|
|
334
|
-
...options?.templateParameters
|
|
335
|
-
};
|
|
336
|
-
const templateContent = documentEntry(entry.entryName, hackParameters);
|
|
333
|
+
const templateContent = documentEntry(entry.entryName);
|
|
337
334
|
const documentHtmlOptions = templateContent ? {
|
|
338
335
|
templateContent,
|
|
339
336
|
inject: false
|
|
@@ -297,12 +297,13 @@ const documentPlugin = ()=>({
|
|
|
297
297
|
processedHtml = processCommentPlaceholders(processedHtml);
|
|
298
298
|
return `<!DOCTYPE html>${processedHtml}`.replace(DOCUMENT_META_PLACEHOLDER, ()=>metas).replace(DOCUMENT_SSR_PLACEHOLDER, ()=>HTML_SEPARATOR).replace(DOCUMENT_SCRIPTS_PLACEHOLDER, ()=>scripts).replace(DOCUMENT_LINKS_PLACEHOLDER, ()=>links).replace(DOCUMENT_CHUNKSMAP_PLACEHOLDER, ()=>PLACEHOLDER_REPLACER_MAP[DOCUMENT_CHUNKSMAP_PLACEHOLDER]).replace(DOCUMENT_SSRDATASCRIPT_PLACEHOLDER, ()=>PLACEHOLDER_REPLACER_MAP[DOCUMENT_SSRDATASCRIPT_PLACEHOLDER]).replace(DOCUMENT_TITLE_PLACEHOLDER, ()=>titles);
|
|
299
299
|
};
|
|
300
|
-
const documentEntry = (entryName
|
|
300
|
+
const documentEntry = (entryName)=>{
|
|
301
301
|
const { entrypoints, internalDirectory, appDirectory } = api.getAppContext();
|
|
302
302
|
const documentFilePath = getDocumentByEntryName(entrypoints, entryName, appDirectory);
|
|
303
303
|
if (!documentFilePath) return null;
|
|
304
304
|
return async (templateData)=>{
|
|
305
305
|
const config = api.getNormalizedConfig();
|
|
306
|
+
const { compilation: _compilation, htmlPlugin, rspackConfig: _rspackConfig, ...templateParameters } = templateData;
|
|
306
307
|
const documentParams = getDocParams({
|
|
307
308
|
config: config,
|
|
308
309
|
entryName,
|
|
@@ -320,7 +321,6 @@ const documentPlugin = ()=>({
|
|
|
320
321
|
debug("entry %s's document jsx rendered html: %o", entryName, html);
|
|
321
322
|
const { partialsByEntrypoint } = api.getAppContext();
|
|
322
323
|
html = processPartials(html, entryName, partialsByEntrypoint || {});
|
|
323
|
-
const htmlPlugin = templateData.htmlPlugin || templateData.htmlWebpackPlugin || templateData.htmlRspackPlugin;
|
|
324
324
|
if (!htmlPlugin) throw new Error('Failed to get HTML plugin tags from template parameters.');
|
|
325
325
|
const { scripts, links, metas, titles } = extractHtmlTags(htmlPlugin, templateParameters);
|
|
326
326
|
return processPlaceholders(html, config, scripts, links, metas, titles);
|
|
@@ -332,10 +332,7 @@ const documentPlugin = ()=>({
|
|
|
332
332
|
return {
|
|
333
333
|
tools: {
|
|
334
334
|
htmlPlugin: (options, entry)=>{
|
|
335
|
-
const
|
|
336
|
-
...options?.templateParameters
|
|
337
|
-
};
|
|
338
|
-
const templateContent = documentEntry(entry.entryName, hackParameters);
|
|
335
|
+
const templateContent = documentEntry(entry.entryName);
|
|
339
336
|
const documentHtmlOptions = templateContent ? {
|
|
340
337
|
templateContent,
|
|
341
338
|
inject: false
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.
|
|
18
|
+
"version": "3.5.0",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
@@ -215,12 +215,12 @@
|
|
|
215
215
|
"isbot": "3.8.0",
|
|
216
216
|
"react-helmet": "^6.1.0",
|
|
217
217
|
"react-is": "^18.3.1",
|
|
218
|
-
"@modern-js/plugin": "3.
|
|
219
|
-
"@modern-js/plugin-data-loader": "3.
|
|
220
|
-
"@modern-js/
|
|
221
|
-
"@modern-js/
|
|
222
|
-
"@modern-js/types": "3.
|
|
223
|
-
"@modern-js/utils": "3.
|
|
218
|
+
"@modern-js/plugin": "3.5.0",
|
|
219
|
+
"@modern-js/plugin-data-loader": "3.5.0",
|
|
220
|
+
"@modern-js/render": "3.5.0",
|
|
221
|
+
"@modern-js/runtime-utils": "3.5.0",
|
|
222
|
+
"@modern-js/types": "3.5.0",
|
|
223
|
+
"@modern-js/utils": "3.5.0"
|
|
224
224
|
},
|
|
225
225
|
"peerDependencies": {
|
|
226
226
|
"react": ">=17.0.2",
|
|
@@ -228,8 +228,8 @@
|
|
|
228
228
|
},
|
|
229
229
|
"devDependencies": {
|
|
230
230
|
"@remix-run/web-fetch": "^4.1.3",
|
|
231
|
-
"@rsbuild/core": "2.0
|
|
232
|
-
"@rslib/core": "0.
|
|
231
|
+
"@rsbuild/core": "2.1.0",
|
|
232
|
+
"@rslib/core": "0.23.0",
|
|
233
233
|
"@testing-library/dom": "^10.4.1",
|
|
234
234
|
"@testing-library/react": "^16.3.2",
|
|
235
235
|
"@types/cookie": "0.6.0",
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
"react-dom": "^19.2.7",
|
|
241
241
|
"ts-node": "^10.9.2",
|
|
242
242
|
"typescript": "^5",
|
|
243
|
-
"@modern-js/app-tools": "3.
|
|
243
|
+
"@modern-js/app-tools": "3.5.0",
|
|
244
244
|
"@modern-js/rslib": "2.68.10",
|
|
245
245
|
"@scripts/rstest-config": "2.66.0"
|
|
246
246
|
},
|