@bleedingdev/modern-js-runtime 3.9.0-ultramodern.20 → 3.9.0-ultramodern.22

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.
@@ -40,6 +40,7 @@ __webpack_require__.d(__webpack_exports__, {
40
40
  default: ()=>cli,
41
41
  documentPlugin: ()=>documentPlugin,
42
42
  getDocumentByEntryName: ()=>getDocumentByEntryName,
43
+ getDocumentTempEntry: ()=>getDocumentTempEntry,
43
44
  processScriptPlaceholders: ()=>processScriptPlaceholders
44
45
  });
45
46
  const utils_namespaceObject = require("@modern-js/utils");
@@ -170,6 +171,7 @@ g.__MODERN_DOC_RENDERERS__[${JSON.stringify(_entryName)}] = render;
170
171
 
171
172
  export default { render: render };`;
172
173
  };
174
+ const getDocumentTempEntry = (internalDirectory, compilerName, entryName)=>external_path_default().join(internalDirectory, CONSTANTS.DOCUMENT_OUTPUT_DIR, compilerName ?? '', `${CONSTANTS.TEMP_ENTRY_PREFIX}${entryName}.js`);
173
175
  const processChildCompilation = async (entryName, docPath, compilation, compiler, appDirectory, internalDirectory)=>new Promise((resolve, reject)=>{
174
176
  const outFile = external_path_default().posix.join(CONSTANTS.DOCUMENT_OUTPUT_DIR, `${CONSTANTS.HTML_OUTPUT_PREFIX}${entryName}${CONSTANTS.HTML_OUTPUT_SUFFIX}`);
175
177
  const child = compilation.createChildCompiler(`${CONSTANTS.CHILD_COMPILER_PREFIX}${entryName}`, {
@@ -180,8 +182,7 @@ const processChildCompilation = async (entryName, docPath, compilation, compiler
180
182
  }, []);
181
183
  configureChildCompiler(child, compiler, appDirectory);
182
184
  applyExternalsPlugin(child, compiler);
183
- const entryDir = external_path_default().join(internalDirectory, CONSTANTS.DOCUMENT_OUTPUT_DIR);
184
- const tempEntry = external_path_default().join(entryDir, `${CONSTANTS.TEMP_ENTRY_PREFIX}${entryName}.js`);
185
+ const tempEntry = getDocumentTempEntry(internalDirectory, compiler.name, entryName);
185
186
  const finalize = ()=>{
186
187
  try {
187
188
  const EntryPlugin = compiler.rspack?.EntryPlugin;
@@ -248,6 +249,7 @@ const documentPlugin = ()=>({
248
249
  const tasks = [];
249
250
  for (const ep of entrypoints || []){
250
251
  const entryName = ep.entryName;
252
+ if (!this.htmlEntryNames.has(entryName)) continue;
251
253
  const docPath = getDocumentByEntryName(entrypoints, entryName, appDirectory);
252
254
  if (docPath) {
253
255
  compilation.fileDependencies?.add?.(docPath);
@@ -264,14 +266,19 @@ const documentPlugin = ()=>({
264
266
  }
265
267
  });
266
268
  }
267
- constructor(){
269
+ constructor(htmlEntryNames){
270
+ this.htmlEntryNames = htmlEntryNames;
268
271
  this.name = 'ModernJsDocumentChildCompilerPlugin';
269
272
  }
270
273
  }
271
274
  api.config(()=>({
272
275
  tools: {
273
- bundlerChain: (chain)=>{
274
- chain.plugin('modernjs-document-child-compiler').use(ModernJsDocumentChildCompilerPlugin, []);
276
+ bundlerChain: (chain, { environment })=>{
277
+ const htmlEntryNames = new Set(Object.keys(environment.htmlPaths));
278
+ if (0 === htmlEntryNames.size) return;
279
+ chain.plugin('modernjs-document-child-compiler').use(ModernJsDocumentChildCompilerPlugin, [
280
+ htmlEntryNames
281
+ ]);
275
282
  }
276
283
  }
277
284
  }));
@@ -394,11 +401,13 @@ const cli = documentPlugin;
394
401
  exports["default"] = __webpack_exports__["default"];
395
402
  exports.documentPlugin = __webpack_exports__.documentPlugin;
396
403
  exports.getDocumentByEntryName = __webpack_exports__.getDocumentByEntryName;
404
+ exports.getDocumentTempEntry = __webpack_exports__.getDocumentTempEntry;
397
405
  exports.processScriptPlaceholders = __webpack_exports__.processScriptPlaceholders;
398
406
  for(var __rspack_i in __webpack_exports__)if (-1 === [
399
407
  "default",
400
408
  "documentPlugin",
401
409
  "getDocumentByEntryName",
410
+ "getDocumentTempEntry",
402
411
  "processScriptPlaceholders"
403
412
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
404
413
  Object.defineProperty(exports, '__esModule', {
@@ -124,6 +124,7 @@ g.__MODERN_DOC_RENDERERS__[${JSON.stringify(_entryName)}] = render;
124
124
 
125
125
  export default { render: render };`;
126
126
  };
127
+ const getDocumentTempEntry = (internalDirectory, compilerName, entryName)=>path.join(internalDirectory, CONSTANTS.DOCUMENT_OUTPUT_DIR, compilerName ?? '', `${CONSTANTS.TEMP_ENTRY_PREFIX}${entryName}.js`);
127
128
  const processChildCompilation = async (entryName, docPath, compilation, compiler, appDirectory, internalDirectory)=>new Promise((resolve, reject)=>{
128
129
  const outFile = path.posix.join(CONSTANTS.DOCUMENT_OUTPUT_DIR, `${CONSTANTS.HTML_OUTPUT_PREFIX}${entryName}${CONSTANTS.HTML_OUTPUT_SUFFIX}`);
129
130
  const child = compilation.createChildCompiler(`${CONSTANTS.CHILD_COMPILER_PREFIX}${entryName}`, {
@@ -134,8 +135,7 @@ const processChildCompilation = async (entryName, docPath, compilation, compiler
134
135
  }, []);
135
136
  configureChildCompiler(child, compiler, appDirectory);
136
137
  applyExternalsPlugin(child, compiler);
137
- const entryDir = path.join(internalDirectory, CONSTANTS.DOCUMENT_OUTPUT_DIR);
138
- const tempEntry = path.join(entryDir, `${CONSTANTS.TEMP_ENTRY_PREFIX}${entryName}.js`);
138
+ const tempEntry = getDocumentTempEntry(internalDirectory, compiler.name, entryName);
139
139
  const finalize = ()=>{
140
140
  try {
141
141
  const EntryPlugin = compiler.rspack?.EntryPlugin;
@@ -202,6 +202,7 @@ const documentPlugin = ()=>({
202
202
  const tasks = [];
203
203
  for (const ep of entrypoints || []){
204
204
  const entryName = ep.entryName;
205
+ if (!this.htmlEntryNames.has(entryName)) continue;
205
206
  const docPath = getDocumentByEntryName(entrypoints, entryName, appDirectory);
206
207
  if (docPath) {
207
208
  compilation.fileDependencies?.add?.(docPath);
@@ -218,14 +219,19 @@ const documentPlugin = ()=>({
218
219
  }
219
220
  });
220
221
  }
221
- constructor(){
222
+ constructor(htmlEntryNames){
223
+ this.htmlEntryNames = htmlEntryNames;
222
224
  this.name = 'ModernJsDocumentChildCompilerPlugin';
223
225
  }
224
226
  }
225
227
  api.config(()=>({
226
228
  tools: {
227
- bundlerChain: (chain)=>{
228
- chain.plugin('modernjs-document-child-compiler').use(ModernJsDocumentChildCompilerPlugin, []);
229
+ bundlerChain: (chain, { environment })=>{
230
+ const htmlEntryNames = new Set(Object.keys(environment.htmlPaths));
231
+ if (0 === htmlEntryNames.size) return;
232
+ chain.plugin('modernjs-document-child-compiler').use(ModernJsDocumentChildCompilerPlugin, [
233
+ htmlEntryNames
234
+ ]);
229
235
  }
230
236
  }
231
237
  }));
@@ -346,4 +352,4 @@ const documentPlugin = ()=>({
346
352
  });
347
353
  const cli = documentPlugin;
348
354
  export default cli;
349
- export { documentPlugin, getDocumentByEntryName, processScriptPlaceholders };
355
+ export { documentPlugin, getDocumentByEntryName, getDocumentTempEntry, processScriptPlaceholders };
@@ -126,6 +126,7 @@ g.__MODERN_DOC_RENDERERS__[${JSON.stringify(_entryName)}] = render;
126
126
 
127
127
  export default { render: render };`;
128
128
  };
129
+ const getDocumentTempEntry = (internalDirectory, compilerName, entryName)=>path.join(internalDirectory, CONSTANTS.DOCUMENT_OUTPUT_DIR, compilerName ?? '', `${CONSTANTS.TEMP_ENTRY_PREFIX}${entryName}.js`);
129
130
  const processChildCompilation = async (entryName, docPath, compilation, compiler, appDirectory, internalDirectory)=>new Promise((resolve, reject)=>{
130
131
  const outFile = path.posix.join(CONSTANTS.DOCUMENT_OUTPUT_DIR, `${CONSTANTS.HTML_OUTPUT_PREFIX}${entryName}${CONSTANTS.HTML_OUTPUT_SUFFIX}`);
131
132
  const child = compilation.createChildCompiler(`${CONSTANTS.CHILD_COMPILER_PREFIX}${entryName}`, {
@@ -136,8 +137,7 @@ const processChildCompilation = async (entryName, docPath, compilation, compiler
136
137
  }, []);
137
138
  configureChildCompiler(child, compiler, appDirectory);
138
139
  applyExternalsPlugin(child, compiler);
139
- const entryDir = path.join(internalDirectory, CONSTANTS.DOCUMENT_OUTPUT_DIR);
140
- const tempEntry = path.join(entryDir, `${CONSTANTS.TEMP_ENTRY_PREFIX}${entryName}.js`);
140
+ const tempEntry = getDocumentTempEntry(internalDirectory, compiler.name, entryName);
141
141
  const finalize = ()=>{
142
142
  try {
143
143
  const EntryPlugin = compiler.rspack?.EntryPlugin;
@@ -204,6 +204,7 @@ const documentPlugin = ()=>({
204
204
  const tasks = [];
205
205
  for (const ep of entrypoints || []){
206
206
  const entryName = ep.entryName;
207
+ if (!this.htmlEntryNames.has(entryName)) continue;
207
208
  const docPath = getDocumentByEntryName(entrypoints, entryName, appDirectory);
208
209
  if (docPath) {
209
210
  compilation.fileDependencies?.add?.(docPath);
@@ -220,14 +221,19 @@ const documentPlugin = ()=>({
220
221
  }
221
222
  });
222
223
  }
223
- constructor(){
224
+ constructor(htmlEntryNames){
225
+ this.htmlEntryNames = htmlEntryNames;
224
226
  this.name = 'ModernJsDocumentChildCompilerPlugin';
225
227
  }
226
228
  }
227
229
  api.config(()=>({
228
230
  tools: {
229
- bundlerChain: (chain)=>{
230
- chain.plugin('modernjs-document-child-compiler').use(ModernJsDocumentChildCompilerPlugin, []);
231
+ bundlerChain: (chain, { environment })=>{
232
+ const htmlEntryNames = new Set(Object.keys(environment.htmlPaths));
233
+ if (0 === htmlEntryNames.size) return;
234
+ chain.plugin('modernjs-document-child-compiler').use(ModernJsDocumentChildCompilerPlugin, [
235
+ htmlEntryNames
236
+ ]);
231
237
  }
232
238
  }
233
239
  }));
@@ -348,4 +354,4 @@ const documentPlugin = ()=>({
348
354
  });
349
355
  const cli = documentPlugin;
350
356
  export default cli;
351
- export { documentPlugin, getDocumentByEntryName, processScriptPlaceholders };
357
+ export { documentPlugin, getDocumentByEntryName, getDocumentTempEntry, processScriptPlaceholders };
@@ -2,5 +2,6 @@ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
2
  import type { Entrypoint } from '@modern-js/types/cli';
3
3
  export declare const processScriptPlaceholders: (html: string, nonce?: string) => string;
4
4
  export declare const getDocumentByEntryName: (entrypoints: Entrypoint[], entryName: string, fallbackDir?: string) => string | undefined;
5
+ export declare const getDocumentTempEntry: (internalDirectory: string, compilerName: string | undefined, entryName: string) => string;
5
6
  export declare const documentPlugin: () => CliPlugin<AppTools>;
6
7
  export default documentPlugin;
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.9.0-ultramodern.20",
20
+ "version": "3.9.0-ultramodern.22",
21
21
  "engines": {
22
22
  "node": ">=20"
23
23
  },
@@ -217,14 +217,14 @@
217
217
  "dependencies": {
218
218
  "@loadable/component": "5.16.7",
219
219
  "@loadable/server": "5.16.7",
220
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.20",
221
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.20",
222
- "@modern-js/render": "npm:@bleedingdev/modern-js-render@3.9.0-ultramodern.20",
223
- "@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.20",
224
- "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.20",
225
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.20",
226
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.20",
227
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.20",
220
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.22",
221
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.22",
222
+ "@modern-js/render": "npm:@bleedingdev/modern-js-render@3.9.0-ultramodern.22",
223
+ "@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.22",
224
+ "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.22",
225
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.22",
226
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.22",
227
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.22",
228
228
  "@swc/core": "1.16.2",
229
229
  "@swc/helpers": "^0.5.23",
230
230
  "@swc/plugin-loadable-components": "^13.0.0",
@@ -245,9 +245,9 @@
245
245
  "react-dom": "^19.2.8"
246
246
  },
247
247
  "devDependencies": {
248
- "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.20",
248
+ "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.22",
249
249
  "@remix-run/web-fetch": "^4.4.2",
250
- "@rsbuild/core": "2.2.9",
250
+ "@rsbuild/core": "2.2.10",
251
251
  "@rslib/core": "1.0.2",
252
252
  "@scripts/rstest-config": "2.66.0",
253
253
  "@testing-library/dom": "^10.4.2",