@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.17 → 3.9.0-ultramodern.19
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/builder/shared/lazyCompilation.js +23 -0
- package/dist/cjs/plugins/deploy/platforms/netlify.js +2 -1
- package/dist/cjs/plugins/deploy/platforms/node.js +3 -5
- package/dist/cjs/plugins/deploy/platforms/vercel.js +2 -1
- package/dist/cjs/plugins/deploy/utils/index.js +14 -12
- package/dist/cjs/plugins/initialize/index.js +3 -1
- package/dist/cjs/plugins/serverBuild.js +0 -2
- package/dist/cjs/utils/loadPlugins.js +1 -7
- package/dist/esm/builder/shared/lazyCompilation.mjs +11 -1
- package/dist/esm/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm/plugins/deploy/platforms/node.mjs +3 -5
- package/dist/esm/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm/plugins/deploy/utils/index.mjs +15 -13
- package/dist/esm/plugins/initialize/index.mjs +3 -1
- package/dist/esm/plugins/serverBuild.mjs +0 -2
- package/dist/esm/utils/loadPlugins.mjs +2 -8
- package/dist/esm-node/builder/shared/lazyCompilation.mjs +11 -1
- package/dist/esm-node/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +3 -5
- package/dist/esm-node/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm-node/plugins/deploy/utils/index.mjs +15 -14
- package/dist/esm-node/plugins/initialize/index.mjs +3 -1
- package/dist/esm-node/plugins/serverBuild.mjs +0 -2
- package/dist/esm-node/utils/loadPlugins.mjs +2 -8
- package/dist/types/builder/shared/lazyCompilation.d.ts +12 -0
- package/dist/types/plugins/deploy/utils/index.d.ts +1 -1
- package/docs/configure/app/bff/effect.md +1 -8
- package/docs/configure/app/source/react-compiler.md +2 -0
- package/docs/guides/get-started/ultramodern.md +1 -3
- package/docs/llms.txt +1 -1
- package/docs/plugin/server-plugins/api.md +1 -0
- package/package.json +23 -13
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
3
12
|
(()=>{
|
|
4
13
|
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
14
|
var define = (defs, kind)=>{
|
|
@@ -29,11 +38,14 @@ var __webpack_exports__ = {};
|
|
|
29
38
|
__webpack_require__.r(__webpack_exports__);
|
|
30
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
40
|
aggregateEagerRouteComponentFiles: ()=>aggregateEagerRouteComponentFiles,
|
|
41
|
+
buildDefaultLazyCompilationTest: ()=>buildDefaultLazyCompilationTest,
|
|
32
42
|
buildSSRLazyCompilationTest: ()=>buildSSRLazyCompilationTest,
|
|
33
43
|
collectRouteComponentFiles: ()=>utils_namespaceObject.collectRouteComponentFiles,
|
|
34
44
|
normalizeModulePath: ()=>utils_namespaceObject.normalizeModulePath,
|
|
35
45
|
planSSRLazyCompilation: ()=>planSSRLazyCompilation
|
|
36
46
|
});
|
|
47
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
48
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
37
49
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
38
50
|
function aggregateEagerRouteComponentFiles(byEntry) {
|
|
39
51
|
const files = new Set();
|
|
@@ -56,6 +68,15 @@ function buildSSRLazyCompilationTest(eagerRouteFiles, userTest) {
|
|
|
56
68
|
return userTestFn(m);
|
|
57
69
|
};
|
|
58
70
|
}
|
|
71
|
+
function buildDefaultLazyCompilationTest(internalDirectory) {
|
|
72
|
+
let internalDir;
|
|
73
|
+
return (m)=>{
|
|
74
|
+
if (!('resource' in m) || 'string' != typeof m.resource) return true;
|
|
75
|
+
internalDir ??= (0, utils_namespaceObject.normalizeModulePath)(internalDirectory);
|
|
76
|
+
const file = m.resource.split('?')[0].split(external_node_path_default().sep).join('/');
|
|
77
|
+
return !('index.jsx' === external_node_path_default().posix.basename(file) && file.startsWith(`${internalDir}/`));
|
|
78
|
+
};
|
|
79
|
+
}
|
|
59
80
|
function planSSRLazyCompilation(current, info) {
|
|
60
81
|
if (!current) return {
|
|
61
82
|
apply: false
|
|
@@ -78,12 +99,14 @@ function planSSRLazyCompilation(current, info) {
|
|
|
78
99
|
};
|
|
79
100
|
}
|
|
80
101
|
exports.aggregateEagerRouteComponentFiles = __webpack_exports__.aggregateEagerRouteComponentFiles;
|
|
102
|
+
exports.buildDefaultLazyCompilationTest = __webpack_exports__.buildDefaultLazyCompilationTest;
|
|
81
103
|
exports.buildSSRLazyCompilationTest = __webpack_exports__.buildSSRLazyCompilationTest;
|
|
82
104
|
exports.collectRouteComponentFiles = __webpack_exports__.collectRouteComponentFiles;
|
|
83
105
|
exports.normalizeModulePath = __webpack_exports__.normalizeModulePath;
|
|
84
106
|
exports.planSSRLazyCompilation = __webpack_exports__.planSSRLazyCompilation;
|
|
85
107
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
86
108
|
"aggregateEagerRouteComponentFiles",
|
|
109
|
+
"buildDefaultLazyCompilationTest",
|
|
87
110
|
"buildSSRLazyCompilationTest",
|
|
88
111
|
"collectRouteComponentFiles",
|
|
89
112
|
"normalizeModulePath",
|
|
@@ -41,6 +41,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
41
41
|
});
|
|
42
42
|
const external_node_path_namespaceObject = require("node:path");
|
|
43
43
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
44
|
+
const trace_files_namespaceObject = require("@modern-js/app-tools-extensions/deploy-output/trace-files");
|
|
44
45
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
45
46
|
const external_ndepe_namespaceObject = require("ndepe");
|
|
46
47
|
const routes_js_namespaceObject = require("../../../utils/routes.js");
|
|
@@ -113,8 +114,8 @@ const createNetlifyPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
113
114
|
if (!needModernServer) return;
|
|
114
115
|
const entry = isEsmProject ? await (0, index_js_namespaceObject.resolveESMDependency)('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
115
116
|
const netlifyEntry = isEsmProject ? await (0, index_js_namespaceObject.resolveESMDependency)('@modern-js/prod-server/netlify') : require.resolve('@modern-js/prod-server/netlify');
|
|
116
|
-
if (!entry || !netlifyEntry) throw new Error('Cannot find @modern-js/prod-server');
|
|
117
117
|
await (0, external_ndepe_namespaceObject.nodeDepEmit)({
|
|
118
|
+
traceFiles: trace_files_namespaceObject.traceDeployFiles,
|
|
118
119
|
appDir: appDirectory,
|
|
119
120
|
sourceDir: funcsDirectory,
|
|
120
121
|
includeEntries: [
|
|
@@ -42,6 +42,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
42
42
|
const external_node_module_namespaceObject = require("node:module");
|
|
43
43
|
const external_node_path_namespaceObject = require("node:path");
|
|
44
44
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
45
|
+
const trace_files_namespaceObject = require("@modern-js/app-tools-extensions/deploy-output/trace-files");
|
|
45
46
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
46
47
|
const external_ndepe_namespaceObject = require("ndepe");
|
|
47
48
|
const index_js_namespaceObject = require("../utils/index.js");
|
|
@@ -77,17 +78,14 @@ const createNodePreset = ({ appContext, modernConfig })=>{
|
|
|
77
78
|
async end () {
|
|
78
79
|
const filter = (filePath)=>!filePath.startsWith(staticDirectory) && !filePath.endsWith('.map');
|
|
79
80
|
const entry = isEsmProject ? await (0, index_js_namespaceObject.resolveESMDependency)('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
80
|
-
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
81
81
|
const requireFromApp = (0, external_node_module_namespaceObject.createRequire)(external_node_path_default().join(appDirectory, 'package.json'));
|
|
82
82
|
const pluginEntries = new Set();
|
|
83
83
|
for (const plugin of serverPlugins)for (const specifier of plugin.includeEntries ?? []){
|
|
84
84
|
pluginEntries.add(requireFromApp.resolve(specifier));
|
|
85
|
-
if (
|
|
86
|
-
const importEntry = await (0, index_js_namespaceObject.resolveESMDependency)(specifier, appDirectory);
|
|
87
|
-
if (!importEntry) throw new Error(`Cannot resolve Node import entry for server plugin ${specifier}`);
|
|
88
|
-
pluginEntries.add(importEntry);
|
|
85
|
+
if (isEsmProject) pluginEntries.add(await (0, index_js_namespaceObject.resolveESMDependency)(specifier, appDirectory));
|
|
89
86
|
}
|
|
90
87
|
await (0, external_ndepe_namespaceObject.nodeDepEmit)({
|
|
88
|
+
traceFiles: trace_files_namespaceObject.traceDeployFiles,
|
|
91
89
|
appDir: appDirectory,
|
|
92
90
|
sourceDir: outputDirectory,
|
|
93
91
|
includeEntries: [
|
|
@@ -41,6 +41,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
41
41
|
});
|
|
42
42
|
const external_node_path_namespaceObject = require("node:path");
|
|
43
43
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
44
|
+
const trace_files_namespaceObject = require("@modern-js/app-tools-extensions/deploy-output/trace-files");
|
|
44
45
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
45
46
|
const external_ndepe_namespaceObject = require("ndepe");
|
|
46
47
|
const routes_js_namespaceObject = require("../../../utils/routes.js");
|
|
@@ -133,8 +134,8 @@ const createVercelPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
133
134
|
async end () {
|
|
134
135
|
if (!needModernServer) return;
|
|
135
136
|
const entry = isEsmProject ? await (0, index_js_namespaceObject.resolveESMDependency)('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
136
|
-
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
137
137
|
await (0, external_ndepe_namespaceObject.nodeDepEmit)({
|
|
138
|
+
traceFiles: trace_files_namespaceObject.traceDeployFiles,
|
|
138
139
|
appDir: appDirectory,
|
|
139
140
|
sourceDir: funcsDirectory,
|
|
140
141
|
includeEntries: [
|
|
@@ -43,9 +43,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
43
43
|
readTemplate: ()=>readTemplate,
|
|
44
44
|
resolveESMDependency: ()=>resolveESMDependency
|
|
45
45
|
});
|
|
46
|
-
const external_node_module_namespaceObject = require("node:module");
|
|
47
46
|
const external_node_url_namespaceObject = require("node:url");
|
|
48
47
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
48
|
+
const external_import_meta_resolve_namespaceObject = require("import-meta-resolve");
|
|
49
49
|
const external_path_namespaceObject = require("path");
|
|
50
50
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
51
51
|
const normalizePath = (filePath)=>filePath.replace(/\\/g, '/');
|
|
@@ -72,19 +72,21 @@ const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
|
72
72
|
};
|
|
73
73
|
const getTemplatePath = (file)=>external_path_default().join(__dirname, '../platforms/templates', file);
|
|
74
74
|
const readTemplate = async (file)=>(await utils_namespaceObject.fs.readFile(getTemplatePath(file))).toString();
|
|
75
|
+
const DEPLOY_CONDITIONS = [
|
|
76
|
+
'node',
|
|
77
|
+
'import',
|
|
78
|
+
'module',
|
|
79
|
+
'default'
|
|
80
|
+
];
|
|
75
81
|
const resolveESMDependency = async (entry, fromDirectory)=>{
|
|
76
|
-
const
|
|
77
|
-
'node',
|
|
78
|
-
'import',
|
|
79
|
-
'module',
|
|
80
|
-
'default'
|
|
81
|
-
]);
|
|
82
|
+
const base = fromDirectory ? (0, external_node_url_namespaceObject.pathToFileURL)(external_path_default().join(fromDirectory, 'package.json')) : (0, external_node_url_namespaceObject.pathToFileURL)(`${__dirname}/`);
|
|
82
83
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
return normalizePath((0, external_node_url_namespaceObject.fileURLToPath)((0, external_import_meta_resolve_namespaceObject.moduleResolve)(entry, base, new Set(DEPLOY_CONDITIONS), false)));
|
|
85
|
+
} catch (cause) {
|
|
86
|
+
throw new Error(`Cannot resolve "${entry}" with conditions [${DEPLOY_CONDITIONS.join(', ')}] from ${base.href}: ${cause.message}`, {
|
|
87
|
+
cause
|
|
88
|
+
});
|
|
89
|
+
}
|
|
88
90
|
};
|
|
89
91
|
exports.getProjectUsage = __webpack_exports__.getProjectUsage;
|
|
90
92
|
exports.getTemplatePath = __webpack_exports__.getTemplatePath;
|
|
@@ -31,6 +31,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
31
31
|
default: ()=>initialize
|
|
32
32
|
});
|
|
33
33
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
34
|
+
const lazyCompilation_js_namespaceObject = require("../../builder/shared/lazyCompilation.js");
|
|
34
35
|
const index_js_namespaceObject = require("../../config/index.js");
|
|
35
36
|
const initialize = ()=>({
|
|
36
37
|
name: '@modern-js/plugin-initialize',
|
|
@@ -49,7 +50,8 @@ const initialize = ()=>({
|
|
|
49
50
|
...defaultConfig.dev,
|
|
50
51
|
lazyCompilation: {
|
|
51
52
|
imports: true,
|
|
52
|
-
entries: false
|
|
53
|
+
entries: false,
|
|
54
|
+
test: (0, lazyCompilation_js_namespaceObject.buildDefaultLazyCompilationTest)(appContext.internalDirectory)
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
return defaultConfig;
|
|
@@ -72,10 +72,8 @@ const serverBuild = ()=>({
|
|
|
72
72
|
sourceDirs.push(serverDir);
|
|
73
73
|
if (external_fs_default().existsSync(sharedDir)) sourceDirs.push(sharedDir);
|
|
74
74
|
}
|
|
75
|
-
const { server } = modernConfig;
|
|
76
75
|
const { alias } = modernConfig.source;
|
|
77
76
|
if (sourceDirs.length > 0) await (0, server_utils_namespaceObject.compile)(appDirectory, {
|
|
78
|
-
server,
|
|
79
77
|
alias
|
|
80
78
|
}, {
|
|
81
79
|
sourceDirs,
|
|
@@ -34,7 +34,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
34
34
|
});
|
|
35
35
|
const node_namespaceObject = require("@modern-js/server-core/node");
|
|
36
36
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
37
|
-
const external_node_url_namespaceObject = require("node:url");
|
|
38
37
|
const debug = (0, utils_namespaceObject.createDebugger)('load-plugins');
|
|
39
38
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
40
39
|
const hooks = api.getHooks();
|
|
@@ -56,12 +55,7 @@ const resolveCliPlugin = async (p, appDirectory)=>{
|
|
|
56
55
|
const pkg = 'string' == typeof p ? p : p[0];
|
|
57
56
|
const pluginOptions = 'string' == typeof p ? void 0 : p[1];
|
|
58
57
|
const path = (0, utils_namespaceObject.tryResolve)(pkg, appDirectory);
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
module = await (0, utils_namespaceObject.compatibleRequire)(path);
|
|
62
|
-
} catch (e) {
|
|
63
|
-
({ default: module } = await (0, utils_namespaceObject.dynamicImport)((0, external_node_url_namespaceObject.pathToFileURL)(path).href));
|
|
64
|
-
}
|
|
58
|
+
const module = await (0, utils_namespaceObject.compatibleRequire)(path);
|
|
65
59
|
if ('function' == typeof module) {
|
|
66
60
|
const result = module(pluginOptions);
|
|
67
61
|
return result;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import node_path from "node:path";
|
|
1
2
|
import { collectRouteComponentFiles, normalizeModulePath } from "@modern-js/utils";
|
|
2
3
|
function aggregateEagerRouteComponentFiles(byEntry) {
|
|
3
4
|
const files = new Set();
|
|
@@ -20,6 +21,15 @@ function buildSSRLazyCompilationTest(eagerRouteFiles, userTest) {
|
|
|
20
21
|
return userTestFn(m);
|
|
21
22
|
};
|
|
22
23
|
}
|
|
24
|
+
function buildDefaultLazyCompilationTest(internalDirectory) {
|
|
25
|
+
let internalDir;
|
|
26
|
+
return (m)=>{
|
|
27
|
+
if (!('resource' in m) || 'string' != typeof m.resource) return true;
|
|
28
|
+
internalDir ??= normalizeModulePath(internalDirectory);
|
|
29
|
+
const file = m.resource.split('?')[0].split(node_path.sep).join('/');
|
|
30
|
+
return !('index.jsx' === node_path.posix.basename(file) && file.startsWith(`${internalDir}/`));
|
|
31
|
+
};
|
|
32
|
+
}
|
|
23
33
|
function planSSRLazyCompilation(current, info) {
|
|
24
34
|
if (!current) return {
|
|
25
35
|
apply: false
|
|
@@ -41,4 +51,4 @@ function planSSRLazyCompilation(current, info) {
|
|
|
41
51
|
}
|
|
42
52
|
};
|
|
43
53
|
}
|
|
44
|
-
export { aggregateEagerRouteComponentFiles, buildSSRLazyCompilationTest, collectRouteComponentFiles, normalizeModulePath, planSSRLazyCompilation };
|
|
54
|
+
export { aggregateEagerRouteComponentFiles, buildDefaultLazyCompilationTest, buildSSRLazyCompilationTest, collectRouteComponentFiles, normalizeModulePath, planSSRLazyCompilation };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
2
3
|
import { fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
3
4
|
import { nodeDepEmit } from "ndepe";
|
|
4
5
|
import { isMainEntry } from "../../../utils/routes.mjs";
|
|
@@ -71,8 +72,8 @@ const createNetlifyPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
71
72
|
if (!needModernServer) return;
|
|
72
73
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
73
74
|
const netlifyEntry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server/netlify') : require.resolve('@modern-js/prod-server/netlify');
|
|
74
|
-
if (!entry || !netlifyEntry) throw new Error('Cannot find @modern-js/prod-server');
|
|
75
75
|
await nodeDepEmit({
|
|
76
|
+
traceFiles: traceDeployFiles,
|
|
76
77
|
appDir: appDirectory,
|
|
77
78
|
sourceDir: funcsDirectory,
|
|
78
79
|
includeEntries: [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import node_path from "node:path";
|
|
3
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
3
4
|
import { chalk, fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
4
5
|
import { nodeDepEmit } from "ndepe";
|
|
5
6
|
import { readTemplate, resolveESMDependency } from "../utils/index.mjs";
|
|
@@ -35,17 +36,14 @@ const createNodePreset = ({ appContext, modernConfig })=>{
|
|
|
35
36
|
async end () {
|
|
36
37
|
const filter = (filePath)=>!filePath.startsWith(staticDirectory) && !filePath.endsWith('.map');
|
|
37
38
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
38
|
-
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
39
39
|
const requireFromApp = createRequire(node_path.join(appDirectory, 'package.json'));
|
|
40
40
|
const pluginEntries = new Set();
|
|
41
41
|
for (const plugin of serverPlugins)for (const specifier of plugin.includeEntries ?? []){
|
|
42
42
|
pluginEntries.add(requireFromApp.resolve(specifier));
|
|
43
|
-
if (
|
|
44
|
-
const importEntry = await resolveESMDependency(specifier, appDirectory);
|
|
45
|
-
if (!importEntry) throw new Error(`Cannot resolve Node import entry for server plugin ${specifier}`);
|
|
46
|
-
pluginEntries.add(importEntry);
|
|
43
|
+
if (isEsmProject) pluginEntries.add(await resolveESMDependency(specifier, appDirectory));
|
|
47
44
|
}
|
|
48
45
|
await nodeDepEmit({
|
|
46
|
+
traceFiles: traceDeployFiles,
|
|
49
47
|
appDir: appDirectory,
|
|
50
48
|
sourceDir: outputDirectory,
|
|
51
49
|
includeEntries: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
2
3
|
import { fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
3
4
|
import { nodeDepEmit } from "ndepe";
|
|
4
5
|
import { isMainEntry } from "../../../utils/routes.mjs";
|
|
@@ -91,8 +92,8 @@ const createVercelPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
91
92
|
async end () {
|
|
92
93
|
if (!needModernServer) return;
|
|
93
94
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
94
|
-
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
95
95
|
await nodeDepEmit({
|
|
96
|
+
traceFiles: traceDeployFiles,
|
|
96
97
|
appDir: appDirectory,
|
|
97
98
|
sourceDir: funcsDirectory,
|
|
98
99
|
includeEntries: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
-
import { ROUTE_SPEC_FILE, SERVER_DIR,
|
|
2
|
+
import { ROUTE_SPEC_FILE, SERVER_DIR, fs, getMeta } from "@modern-js/utils";
|
|
3
|
+
import { moduleResolve } from "import-meta-resolve";
|
|
4
4
|
import path from "path";
|
|
5
5
|
const normalizePath = (filePath)=>filePath.replace(/\\/g, '/');
|
|
6
6
|
const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
@@ -26,18 +26,20 @@ const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
|
26
26
|
};
|
|
27
27
|
const getTemplatePath = (file)=>path.join(__dirname, '../platforms/templates', file);
|
|
28
28
|
const readTemplate = async (file)=>(await fs.readFile(getTemplatePath(file))).toString();
|
|
29
|
+
const DEPLOY_CONDITIONS = [
|
|
30
|
+
'node',
|
|
31
|
+
'import',
|
|
32
|
+
'module',
|
|
33
|
+
'default'
|
|
34
|
+
];
|
|
29
35
|
const resolveESMDependency = async (entry, fromDirectory)=>{
|
|
30
|
-
const
|
|
31
|
-
'node',
|
|
32
|
-
'import',
|
|
33
|
-
'module',
|
|
34
|
-
'default'
|
|
35
|
-
]);
|
|
36
|
+
const base = fromDirectory ? pathToFileURL(path.join(fromDirectory, 'package.json')) : pathToFileURL(`${__dirname}/`);
|
|
36
37
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
return normalizePath(fileURLToPath(moduleResolve(entry, base, new Set(DEPLOY_CONDITIONS), false)));
|
|
39
|
+
} catch (cause) {
|
|
40
|
+
throw new Error(`Cannot resolve "${entry}" with conditions [${DEPLOY_CONDITIONS.join(', ')}] from ${base.href}: ${cause.message}`, {
|
|
41
|
+
cause
|
|
42
|
+
});
|
|
43
|
+
}
|
|
42
44
|
};
|
|
43
45
|
export { getProjectUsage, getTemplatePath, normalizePath, readTemplate, resolveESMDependency };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
|
2
|
+
import { buildDefaultLazyCompilationTest } from "../../builder/shared/lazyCompilation.mjs";
|
|
2
3
|
import { createDefaultConfig, isLazyCompilationSafeByDefault } from "../../config/index.mjs";
|
|
3
4
|
const initialize = ()=>({
|
|
4
5
|
name: '@modern-js/plugin-initialize',
|
|
@@ -17,7 +18,8 @@ const initialize = ()=>({
|
|
|
17
18
|
...defaultConfig.dev,
|
|
18
19
|
lazyCompilation: {
|
|
19
20
|
imports: true,
|
|
20
|
-
entries: false
|
|
21
|
+
entries: false,
|
|
22
|
+
test: buildDefaultLazyCompilationTest(appContext.internalDirectory)
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
return defaultConfig;
|
|
@@ -29,10 +29,8 @@ const serverBuild = ()=>({
|
|
|
29
29
|
sourceDirs.push(serverDir);
|
|
30
30
|
if (fs.existsSync(sharedDir)) sourceDirs.push(sharedDir);
|
|
31
31
|
}
|
|
32
|
-
const { server } = modernConfig;
|
|
33
32
|
const { alias } = modernConfig.source;
|
|
34
33
|
if (sourceDirs.length > 0) await compile(appDirectory, {
|
|
35
|
-
server,
|
|
36
34
|
alias
|
|
37
35
|
}, {
|
|
38
36
|
sourceDirs,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { loadServerPlugins } from "@modern-js/server-core/node";
|
|
2
|
-
import { compatibleRequire, createDebugger,
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
2
|
+
import { compatibleRequire, createDebugger, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
4
3
|
const debug = createDebugger('load-plugins');
|
|
5
4
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
6
5
|
const hooks = api.getHooks();
|
|
@@ -22,12 +21,7 @@ const resolveCliPlugin = async (p, appDirectory)=>{
|
|
|
22
21
|
const pkg = 'string' == typeof p ? p : p[0];
|
|
23
22
|
const pluginOptions = 'string' == typeof p ? void 0 : p[1];
|
|
24
23
|
const path = tryResolve(pkg, appDirectory);
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
module = await compatibleRequire(path);
|
|
28
|
-
} catch (e) {
|
|
29
|
-
({ default: module } = await dynamicImport(pathToFileURL(path).href));
|
|
30
|
-
}
|
|
24
|
+
const module = await compatibleRequire(path);
|
|
31
25
|
if ('function' == typeof module) {
|
|
32
26
|
const result = module(pluginOptions);
|
|
33
27
|
return result;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import node_path from "node:path";
|
|
2
3
|
import { collectRouteComponentFiles, normalizeModulePath } from "@modern-js/utils";
|
|
3
4
|
function aggregateEagerRouteComponentFiles(byEntry) {
|
|
4
5
|
const files = new Set();
|
|
@@ -21,6 +22,15 @@ function buildSSRLazyCompilationTest(eagerRouteFiles, userTest) {
|
|
|
21
22
|
return userTestFn(m);
|
|
22
23
|
};
|
|
23
24
|
}
|
|
25
|
+
function buildDefaultLazyCompilationTest(internalDirectory) {
|
|
26
|
+
let internalDir;
|
|
27
|
+
return (m)=>{
|
|
28
|
+
if (!('resource' in m) || 'string' != typeof m.resource) return true;
|
|
29
|
+
internalDir ??= normalizeModulePath(internalDirectory);
|
|
30
|
+
const file = m.resource.split('?')[0].split(node_path.sep).join('/');
|
|
31
|
+
return !('index.jsx' === node_path.posix.basename(file) && file.startsWith(`${internalDir}/`));
|
|
32
|
+
};
|
|
33
|
+
}
|
|
24
34
|
function planSSRLazyCompilation(current, info) {
|
|
25
35
|
if (!current) return {
|
|
26
36
|
apply: false
|
|
@@ -42,4 +52,4 @@ function planSSRLazyCompilation(current, info) {
|
|
|
42
52
|
}
|
|
43
53
|
};
|
|
44
54
|
}
|
|
45
|
-
export { aggregateEagerRouteComponentFiles, buildSSRLazyCompilationTest, collectRouteComponentFiles, normalizeModulePath, planSSRLazyCompilation };
|
|
55
|
+
export { aggregateEagerRouteComponentFiles, buildDefaultLazyCompilationTest, buildSSRLazyCompilationTest, collectRouteComponentFiles, normalizeModulePath, planSSRLazyCompilation };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
3
|
import node_path from "node:path";
|
|
4
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
4
5
|
import { fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
5
6
|
import { nodeDepEmit } from "ndepe";
|
|
6
7
|
import { isMainEntry } from "../../../utils/routes.mjs";
|
|
@@ -73,8 +74,8 @@ const createNetlifyPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
73
74
|
if (!needModernServer) return;
|
|
74
75
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
75
76
|
const netlifyEntry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server/netlify') : require.resolve('@modern-js/prod-server/netlify');
|
|
76
|
-
if (!entry || !netlifyEntry) throw new Error('Cannot find @modern-js/prod-server');
|
|
77
77
|
await nodeDepEmit({
|
|
78
|
+
traceFiles: traceDeployFiles,
|
|
78
79
|
appDir: appDirectory,
|
|
79
80
|
sourceDir: funcsDirectory,
|
|
80
81
|
includeEntries: [
|
|
@@ -2,6 +2,7 @@ import __rslib_shim_module__ from "node:module";
|
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import node_path from "node:path";
|
|
5
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
5
6
|
import { chalk, fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
6
7
|
import { nodeDepEmit } from "ndepe";
|
|
7
8
|
import { readTemplate, resolveESMDependency } from "../utils/index.mjs";
|
|
@@ -37,17 +38,14 @@ const createNodePreset = ({ appContext, modernConfig })=>{
|
|
|
37
38
|
async end () {
|
|
38
39
|
const filter = (filePath)=>!filePath.startsWith(staticDirectory) && !filePath.endsWith('.map');
|
|
39
40
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
40
|
-
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
41
41
|
const requireFromApp = createRequire(node_path.join(appDirectory, 'package.json'));
|
|
42
42
|
const pluginEntries = new Set();
|
|
43
43
|
for (const plugin of serverPlugins)for (const specifier of plugin.includeEntries ?? []){
|
|
44
44
|
pluginEntries.add(requireFromApp.resolve(specifier));
|
|
45
|
-
if (
|
|
46
|
-
const importEntry = await resolveESMDependency(specifier, appDirectory);
|
|
47
|
-
if (!importEntry) throw new Error(`Cannot resolve Node import entry for server plugin ${specifier}`);
|
|
48
|
-
pluginEntries.add(importEntry);
|
|
45
|
+
if (isEsmProject) pluginEntries.add(await resolveESMDependency(specifier, appDirectory));
|
|
49
46
|
}
|
|
50
47
|
await nodeDepEmit({
|
|
48
|
+
traceFiles: traceDeployFiles,
|
|
51
49
|
appDir: appDirectory,
|
|
52
50
|
sourceDir: outputDirectory,
|
|
53
51
|
includeEntries: [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
3
|
import node_path from "node:path";
|
|
4
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
4
5
|
import { fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
5
6
|
import { nodeDepEmit } from "ndepe";
|
|
6
7
|
import { isMainEntry } from "../../../utils/routes.mjs";
|
|
@@ -93,8 +94,8 @@ const createVercelPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
93
94
|
async end () {
|
|
94
95
|
if (!needModernServer) return;
|
|
95
96
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
96
|
-
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
97
97
|
await nodeDepEmit({
|
|
98
|
+
traceFiles: traceDeployFiles,
|
|
98
99
|
appDir: appDirectory,
|
|
99
100
|
sourceDir: funcsDirectory,
|
|
100
101
|
includeEntries: [
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
-
import { ROUTE_SPEC_FILE, SERVER_DIR,
|
|
3
|
+
import { ROUTE_SPEC_FILE, SERVER_DIR, fs, getMeta } from "@modern-js/utils";
|
|
4
|
+
import { moduleResolve } from "import-meta-resolve";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
7
7
|
import { dirname as __rspack_dirname } from "node:path";
|
|
8
8
|
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
9
|
-
var __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
|
|
10
9
|
const normalizePath = (filePath)=>filePath.replace(/\\/g, '/');
|
|
11
10
|
const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
12
11
|
const routeJSON = path.join(distDirectory, ROUTE_SPEC_FILE);
|
|
@@ -31,18 +30,20 @@ const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
|
31
30
|
};
|
|
32
31
|
const getTemplatePath = (file)=>path.join(__rspack_import_meta_dirname__, '../platforms/templates', file);
|
|
33
32
|
const readTemplate = async (file)=>(await fs.readFile(getTemplatePath(file))).toString();
|
|
33
|
+
const DEPLOY_CONDITIONS = [
|
|
34
|
+
'node',
|
|
35
|
+
'import',
|
|
36
|
+
'module',
|
|
37
|
+
'default'
|
|
38
|
+
];
|
|
34
39
|
const resolveESMDependency = async (entry, fromDirectory)=>{
|
|
35
|
-
const
|
|
36
|
-
'node',
|
|
37
|
-
'import',
|
|
38
|
-
'module',
|
|
39
|
-
'default'
|
|
40
|
-
]);
|
|
40
|
+
const base = fromDirectory ? pathToFileURL(path.join(fromDirectory, 'package.json')) : pathToFileURL(`${__rspack_import_meta_dirname__}/`);
|
|
41
41
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
return normalizePath(fileURLToPath(moduleResolve(entry, base, new Set(DEPLOY_CONDITIONS), false)));
|
|
43
|
+
} catch (cause) {
|
|
44
|
+
throw new Error(`Cannot resolve "${entry}" with conditions [${DEPLOY_CONDITIONS.join(', ')}] from ${base.href}: ${cause.message}`, {
|
|
45
|
+
cause
|
|
46
|
+
});
|
|
47
|
+
}
|
|
47
48
|
};
|
|
48
49
|
export { getProjectUsage, getTemplatePath, normalizePath, readTemplate, resolveESMDependency };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
|
3
|
+
import { buildDefaultLazyCompilationTest } from "../../builder/shared/lazyCompilation.mjs";
|
|
3
4
|
import { createDefaultConfig, isLazyCompilationSafeByDefault } from "../../config/index.mjs";
|
|
4
5
|
const initialize = ()=>({
|
|
5
6
|
name: '@modern-js/plugin-initialize',
|
|
@@ -18,7 +19,8 @@ const initialize = ()=>({
|
|
|
18
19
|
...defaultConfig.dev,
|
|
19
20
|
lazyCompilation: {
|
|
20
21
|
imports: true,
|
|
21
|
-
entries: false
|
|
22
|
+
entries: false,
|
|
23
|
+
test: buildDefaultLazyCompilationTest(appContext.internalDirectory)
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
26
|
return defaultConfig;
|
|
@@ -30,10 +30,8 @@ const serverBuild = ()=>({
|
|
|
30
30
|
sourceDirs.push(serverDir);
|
|
31
31
|
if (fs.existsSync(sharedDir)) sourceDirs.push(sharedDir);
|
|
32
32
|
}
|
|
33
|
-
const { server } = modernConfig;
|
|
34
33
|
const { alias } = modernConfig.source;
|
|
35
34
|
if (sourceDirs.length > 0) await compile(appDirectory, {
|
|
36
|
-
server,
|
|
37
35
|
alias
|
|
38
36
|
}, {
|
|
39
37
|
sourceDirs,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { loadServerPlugins } from "@modern-js/server-core/node";
|
|
3
|
-
import { compatibleRequire, createDebugger,
|
|
4
|
-
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { compatibleRequire, createDebugger, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
5
4
|
const debug = createDebugger('load-plugins');
|
|
6
5
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
7
6
|
const hooks = api.getHooks();
|
|
@@ -23,12 +22,7 @@ const resolveCliPlugin = async (p, appDirectory)=>{
|
|
|
23
22
|
const pkg = 'string' == typeof p ? p : p[0];
|
|
24
23
|
const pluginOptions = 'string' == typeof p ? void 0 : p[1];
|
|
25
24
|
const path = tryResolve(pkg, appDirectory);
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
module = await compatibleRequire(path);
|
|
29
|
-
} catch (e) {
|
|
30
|
-
({ default: module } = await dynamicImport(pathToFileURL(path).href));
|
|
31
|
-
}
|
|
25
|
+
const module = await compatibleRequire(path);
|
|
32
26
|
if ('function' == typeof module) {
|
|
33
27
|
const result = module(pluginOptions);
|
|
34
28
|
return result;
|
|
@@ -26,6 +26,18 @@ export declare function aggregateEagerRouteComponentFiles(byEntry: EagerRouteCom
|
|
|
26
26
|
* (defaulting to lazy when the user did not provide one).
|
|
27
27
|
*/
|
|
28
28
|
export declare function buildSSRLazyCompilationTest(eagerRouteFiles: Set<string>, userTest?: LazyCompilationTest): LazyCompilationTestFn;
|
|
29
|
+
/**
|
|
30
|
+
* Build the default dev `lazyCompilation.test`: every dynamically imported
|
|
31
|
+
* module is lazy except the generated entry module
|
|
32
|
+
* `<internalDirectory>/<entry>/index.jsx` (`<entry>` may be nested). With
|
|
33
|
+
* `source.enableAsyncEntry` the build entry is `bootstrap.jsx`, whose only
|
|
34
|
+
* statement is `import('./index')`; that import is the async entry boundary
|
|
35
|
+
* Module Federation needs to initialize shared scopes, not a code-split point.
|
|
36
|
+
* A lazy boundary rebuilds the whole entry on the first page load
|
|
37
|
+
* (`building .modern-js/<entry>/index.jsx`) and starts an extra HMR cycle.
|
|
38
|
+
* Typed `object` so it is assignable to Rspack's `(module: Module) => boolean`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildDefaultLazyCompilationTest(internalDirectory: string): (m: object) => boolean;
|
|
29
41
|
export type SSRLazyPlan = {
|
|
30
42
|
apply: false;
|
|
31
43
|
unresolvedByEntry?: Map<string, string[]>;
|
|
@@ -13,4 +13,4 @@ export declare const getProjectUsage: (appDirectory: string, distDirectory: stri
|
|
|
13
13
|
};
|
|
14
14
|
export declare const getTemplatePath: (file: string) => string;
|
|
15
15
|
export declare const readTemplate: (file: string) => Promise<string>;
|
|
16
|
-
export declare const resolveESMDependency: (entry: string, fromDirectory?: string) => Promise<string
|
|
16
|
+
export declare const resolveESMDependency: (entry: string, fromDirectory?: string) => Promise<string>;
|
|
@@ -227,10 +227,6 @@ through `pnpm-workspace.yaml` overrides. For the current UltraModern cohort,
|
|
|
227
227
|
generated apps use:
|
|
228
228
|
|
|
229
229
|
```yaml
|
|
230
|
-
trustPolicyExclude:
|
|
231
|
-
- 'effect@4.0.0-rc.117'
|
|
232
|
-
- '@effect/opentelemetry@4.0.0-rc.117'
|
|
233
|
-
|
|
234
230
|
overrides:
|
|
235
231
|
'@effect/opentelemetry': 4.0.0-rc.117
|
|
236
232
|
'@effect/vitest': 4.0.0-rc.117
|
|
@@ -242,10 +238,7 @@ Effect prerelease can fail while building layers or HTTP middleware because runt
|
|
|
242
238
|
services come from different package instances. The strict 24-hour release-age
|
|
243
239
|
gate applies to installed packages; the current cohort has no Effect age
|
|
244
240
|
exemption, and override-only `@effect/vitest` is not an installed approval
|
|
245
|
-
target.
|
|
246
|
-
its exact `effect` and `@effect/opentelemetry` exceptions cover their
|
|
247
|
-
trusted-publisher to provenance metadata transition and are not release-age
|
|
248
|
-
approvals.
|
|
241
|
+
target.
|
|
249
242
|
|
|
250
243
|
## Contract tests
|
|
251
244
|
|
|
@@ -9,6 +9,8 @@ Whether to enable [React Compiler](https://react.dev/learn/react-compiler). Reac
|
|
|
9
9
|
|
|
10
10
|
Modern.js implements this capability based on the Rust-based React Compiler built into Rspack's `builtin:swc-loader` (equivalent to setting SWC's `jsc.transform.reactCompiler`), reusing Rspack's built-in SWC transform chain without introducing Babel.
|
|
11
11
|
|
|
12
|
+
The compiler only runs for browser environments (`output.target: 'web'`). Server environments (`node`, the `web-worker` SSR worker and BFF code) render once per request and gain nothing from memoization, so they are never compiled.
|
|
13
|
+
|
|
12
14
|
:::tip
|
|
13
15
|
This option is disabled by default. It must be enabled explicitly for any React version, including React 19.
|
|
14
16
|
:::
|
|
@@ -67,9 +67,7 @@ and `@effect/vitest@4.0.0-rc.117`. Do not add app-local direct Effect
|
|
|
67
67
|
versions that disagree with those overrides. The strict 24-hour release-age
|
|
68
68
|
gate applies to installed packages; this cohort carries no Effect age
|
|
69
69
|
exemption, and override-only `@effect/vitest` is not an installed approval
|
|
70
|
-
target.
|
|
71
|
-
and `@effect/opentelemetry` cover their trusted-publisher to provenance
|
|
72
|
-
metadata transition; they are not release-age approvals.
|
|
70
|
+
target.
|
|
73
71
|
|
|
74
72
|
### Current generated dependency baseline
|
|
75
73
|
|
package/docs/llms.txt
CHANGED
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
- [include](/configure/app/source/include.md): Type: RuleSetCondition[]Default value: source.include is used to specify additional JavaScript files that need to be compiled. By default, the following files will be compiled: TypeScript and JSX files in any directory, with file extensions matching .ts, .tsx, .jsx, .mts, .cts.JavaScript files not in the node_modules directory, with file extensions matching .js, .mjs, .cjs.
|
|
157
157
|
- [mainEntryName](/configure/app/source/main-entry-name.md): Type: stringDefault: 'index' This option is used to configure the main entry name of Modern.js. By default, the default main entry name of Modern.js is index. When using a single entry or the entry name is the same as the name field in package.json, the corresponding entry will be used as the main entry. This configuration can be used to modify the name of the main entry. For example, change the main entry name to main: After building, the corresponding HTML output path will be changed to dist/html/index/index.html.
|
|
158
158
|
- [preEntry](/configure/app/source/pre-entry.md): Type: string | string[]Default: [] Add a script before the entry file of each page. This script will be executed before the page code. It can be used to execute global logics, such as injecting polyfills, setting global styles, etc.
|
|
159
|
-
- [reactCompiler](/configure/app/source/react-compiler.md): Type: boolean | ReactCompilerOptionsDefault: undefined (disabled) Whether to enable React Compiler. React Compiler is a build-time tool that optimizes re-rendering performance of React applications through automatic memoization. Modern.js implements this capability based on the Rust-based React Compiler built into Rspack's builtin:swc-loader (equivalent to setting SWC's jsc.transform.reactCompiler), reusing Rspack's built-in SWC transform chain without introducing Babel.
|
|
159
|
+
- [reactCompiler](/configure/app/source/react-compiler.md): Type: boolean | ReactCompilerOptionsDefault: undefined (disabled) Whether to enable React Compiler. React Compiler is a build-time tool that optimizes re-rendering performance of React applications through automatic memoization. Modern.js implements this capability based on the Rust-based React Compiler built into Rspack's builtin:swc-loader (equivalent to setting SWC's jsc.transform.reactCompiler), reusing Rspack's built-in SWC transform chain without introducing Babel. The compiler only runs for browser environments (output.target: 'web'). Server environments (node, the web-worker SSR worker and BFF code) render once per request and gain nothing from memoization, so they are never compiled.
|
|
160
160
|
- [transformImport](/configure/app/source/transform-import.md): Transform the import path, which can be used to modularly import the subpath of third-party packages. The functionality is similar to babel-plugin-import。 Type: Default: undefined
|
|
161
161
|
- [aliasStrategy](/configure/app/resolve/alias-strategy.md): Type: 'prefer-tsconfig' | 'prefer-alias'Default: 'prefer-tsconfig' Set the strategy for path alias resolution, to control the priority relationship between the paths option in tsconfig.json and the resolve.alias option of Rsbuild.
|
|
162
162
|
- [alias](/configure/app/resolve/alias.md): Type: string[] Create aliases for module paths to simplify import paths or redirect module references.
|
|
@@ -191,6 +191,7 @@ Adds additional logic when the server resets.
|
|
|
191
191
|
- `'file-change'`: File change event
|
|
192
192
|
- `event.payload`: When `type` is `'file-change'`, contains an array of file change information.
|
|
193
193
|
- **Execution Phase:** When files change or repack is needed.
|
|
194
|
+
- **Repack Order:** On `'repack'` the dev server awaits the handlers in registration order before it purges the previous server bundle from the require cache. A rejecting handler skips the handlers after it. New requests wait until the handlers settle; requests already running keep the modules they loaded. A repack handler must not await a request to the dev server, because that request waits for the handler.
|
|
194
195
|
- **Example:**
|
|
195
196
|
|
|
196
197
|
```typescript
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.9.0-ultramodern.
|
|
20
|
+
"version": "3.9.0-ultramodern.19",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"main": "./dist/cjs/index.js",
|
|
23
23
|
"exports": {
|
|
@@ -127,18 +127,18 @@
|
|
|
127
127
|
"@babel/traverse": "^8.0.6",
|
|
128
128
|
"@babel/types": "^8.0.6",
|
|
129
129
|
"@loadable/component": "5.16.7",
|
|
130
|
-
"@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.
|
|
131
|
-
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.
|
|
132
|
-
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.
|
|
133
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.
|
|
134
|
-
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.
|
|
135
|
-
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.
|
|
136
|
-
"@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.
|
|
137
|
-
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.
|
|
138
|
-
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.
|
|
139
|
-
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.
|
|
140
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
141
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
130
|
+
"@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.19",
|
|
131
|
+
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.19",
|
|
132
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.19",
|
|
133
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.19",
|
|
134
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.19",
|
|
135
|
+
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.19",
|
|
136
|
+
"@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.19",
|
|
137
|
+
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.19",
|
|
138
|
+
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.19",
|
|
139
|
+
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.19",
|
|
140
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.19",
|
|
141
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.19",
|
|
142
142
|
"@rsbuild/core": "2.2.9",
|
|
143
143
|
"@swc/core": "1.16.2",
|
|
144
144
|
"@swc/helpers": "^0.5.23",
|
|
@@ -158,8 +158,18 @@
|
|
|
158
158
|
"@types/babel__traverse": "7.28.0",
|
|
159
159
|
"@types/node": "^26.6.2",
|
|
160
160
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
161
|
+
"react": "^19.3.0",
|
|
162
|
+
"react-dom": "^19.3.0",
|
|
161
163
|
"typescript": "^7.0.2"
|
|
162
164
|
},
|
|
165
|
+
"peerDependencies": {
|
|
166
|
+
"react": "^19.2.8"
|
|
167
|
+
},
|
|
168
|
+
"peerDependenciesMeta": {
|
|
169
|
+
"react": {
|
|
170
|
+
"optional": true
|
|
171
|
+
}
|
|
172
|
+
},
|
|
163
173
|
"sideEffects": false,
|
|
164
174
|
"publishConfig": {
|
|
165
175
|
"access": "public"
|