@modern-js/uni-builder 2.69.6 → 2.69.7
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.
|
@@ -45,6 +45,7 @@ const CSS_RULE_NAMES = [
|
|
|
45
45
|
"scss",
|
|
46
46
|
"sass"
|
|
47
47
|
];
|
|
48
|
+
const createVirtualModule = (content) => `data:text/javascript,${encodeURIComponent(content)}`;
|
|
48
49
|
const checkReactVersionAtLeast19 = async (appDir) => {
|
|
49
50
|
const packageJsonPath = import_node_path.default.resolve(appDir, "package.json");
|
|
50
51
|
const packageJson = await import_fs_extra.default.readJSON(packageJsonPath);
|
|
@@ -154,6 +155,12 @@ const rsbuildRscPlugin = ({ appDir, isRspack = true, rscClientRuntimePath, rscSe
|
|
|
154
155
|
chain.dependencies([
|
|
155
156
|
"server"
|
|
156
157
|
]);
|
|
158
|
+
const entries = chain.entryPoints.entries();
|
|
159
|
+
for (const entryName of Object.keys(entries)) {
|
|
160
|
+
const entryPoint = chain.entry(entryName);
|
|
161
|
+
const code = `window.__MODERN_JS_ENTRY_NAME="${entryName}";`;
|
|
162
|
+
entryPoint.add(createVirtualModule(code));
|
|
163
|
+
}
|
|
157
164
|
addRscClientLoader();
|
|
158
165
|
addRscClientPlugin();
|
|
159
166
|
}
|
|
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(rsc_client_plugin_exports);
|
|
|
24
24
|
var import_common = require("../common");
|
|
25
25
|
class RscClientPlugin {
|
|
26
26
|
apply(compiler) {
|
|
27
|
-
const { AsyncDependenciesBlock,
|
|
27
|
+
const { AsyncDependenciesBlock, WebpackError, dependencies: { ModuleDependency, NullDependency }, sources: { RawSource } } = compiler.webpack;
|
|
28
28
|
const ssrManifest = {
|
|
29
29
|
moduleMap: {},
|
|
30
30
|
moduleLoading: null,
|
|
@@ -86,22 +86,6 @@ class RscClientPlugin {
|
|
|
86
86
|
compiler.hooks.compilation.tap(RscClientPlugin.name, (compilation, { normalModuleFactory }) => {
|
|
87
87
|
compilation.dependencyFactories.set(ClientReferenceDependency, normalModuleFactory);
|
|
88
88
|
compilation.dependencyTemplates.set(ClientReferenceDependency, new NullDependency.Template());
|
|
89
|
-
class EntryNameRuntimeModule extends compiler.webpack.RuntimeModule {
|
|
90
|
-
generate() {
|
|
91
|
-
return `window.__MODERN_JS_ENTRY_NAME="${this.entryName}";`;
|
|
92
|
-
}
|
|
93
|
-
constructor(entryName) {
|
|
94
|
-
super("entry-name", 10);
|
|
95
|
-
this.entryName = entryName;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.ensureChunk).tap(RscClientPlugin.name, (chunk, set) => {
|
|
99
|
-
Array.from(compilation.entrypoints.entries()).forEach(([entryName, entrypoint]) => {
|
|
100
|
-
if (entrypoint.chunks.includes(chunk)) {
|
|
101
|
-
compilation.addRuntimeModule(chunk, new EntryNameRuntimeModule(entryName));
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
89
|
});
|
|
106
90
|
compiler.hooks.thisCompilation.tap(RscClientPlugin.name, (compilation, { normalModuleFactory }) => {
|
|
107
91
|
this.styles = import_common.sharedData.get("styles");
|
|
@@ -120,8 +104,8 @@ class RscClientPlugin {
|
|
|
120
104
|
normalModuleFactory.hooks.parser.for(`javascript/dynamic`).tap(`HarmonyModulesPlugin`, onNormalModuleFactoryParser);
|
|
121
105
|
normalModuleFactory.hooks.parser.for(`javascript/esm`).tap(`HarmonyModulesPlugin`, onNormalModuleFactoryParser);
|
|
122
106
|
compilation.hooks.additionalTreeRuntimeRequirements.tap(RscClientPlugin.name, (_chunk, runtimeRequirements) => {
|
|
123
|
-
runtimeRequirements.add(RuntimeGlobals.ensureChunk);
|
|
124
|
-
runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport);
|
|
107
|
+
runtimeRequirements.add(compiler.webpack.RuntimeGlobals.ensureChunk);
|
|
108
|
+
runtimeRequirements.add(compiler.webpack.RuntimeGlobals.compatGetDefaultExport);
|
|
125
109
|
});
|
|
126
110
|
compilation.hooks.processAssets.tap(RscClientPlugin.name, () => {
|
|
127
111
|
const clientManifest = {};
|
|
@@ -38,7 +38,7 @@ const hasExtension = (filePath) => {
|
|
|
38
38
|
};
|
|
39
39
|
class RspackRscClientPlugin {
|
|
40
40
|
apply(compiler) {
|
|
41
|
-
const { EntryPlugin, RuntimeGlobals,
|
|
41
|
+
const { EntryPlugin, RuntimeGlobals, WebpackError, sources: { RawSource } } = compiler.webpack;
|
|
42
42
|
const ssrManifest = {
|
|
43
43
|
moduleMap: {},
|
|
44
44
|
moduleLoading: null,
|
|
@@ -122,24 +122,6 @@ class RspackRscClientPlugin {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
|
-
compiler.hooks.compilation.tap(RspackRscClientPlugin.name, (compilation, { normalModuleFactory }) => {
|
|
126
|
-
class EntryNameRuntimeModule extends RuntimeModule {
|
|
127
|
-
generate() {
|
|
128
|
-
return `window.__MODERN_JS_ENTRY_NAME="${this.entryName}";`;
|
|
129
|
-
}
|
|
130
|
-
constructor(entryName) {
|
|
131
|
-
super("entry-name", 10);
|
|
132
|
-
this.entryName = entryName;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.ensureChunk).tap(RspackRscClientPlugin.name, (chunk, set) => {
|
|
136
|
-
Array.from(compilation.entrypoints.entries()).forEach(([entryName, entrypoint]) => {
|
|
137
|
-
if (entrypoint.chunks.includes(chunk)) {
|
|
138
|
-
compilation.addRuntimeModule(chunk, new EntryNameRuntimeModule(entryName));
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
125
|
compiler.hooks.thisCompilation.tap(RspackRscClientPlugin.name, (compilation, { normalModuleFactory }) => {
|
|
144
126
|
this.styles = import_common.sharedData.get("styles");
|
|
145
127
|
this.clientReferencesMap = import_common.sharedData.get("clientReferencesMap");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/uni-builder",
|
|
3
|
-
"version": "2.69.
|
|
3
|
+
"version": "2.69.7",
|
|
4
4
|
"description": "Unified builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@babel/preset-react": "^7.22.15",
|
|
41
41
|
"@babel/types": "^7.26.0",
|
|
42
42
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.16",
|
|
43
|
-
"@rsbuild/core": "1.
|
|
43
|
+
"@rsbuild/core": "1.7.1",
|
|
44
44
|
"@rsbuild/plugin-assets-retry": "1.5.0",
|
|
45
45
|
"@rsbuild/plugin-babel": "1.0.6",
|
|
46
46
|
"@rsbuild/plugin-check-syntax": "1.6.0",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"@rsbuild/plugin-rem": "1.0.4",
|
|
52
52
|
"@rsbuild/plugin-sass": "1.4.0",
|
|
53
53
|
"@rsbuild/plugin-source-build": "1.0.3",
|
|
54
|
-
"@rsbuild/plugin-styled-components": "1.
|
|
54
|
+
"@rsbuild/plugin-styled-components": "1.6.0",
|
|
55
55
|
"@rsbuild/plugin-svgr": "1.2.3",
|
|
56
56
|
"@rsbuild/plugin-toml": "1.1.1",
|
|
57
57
|
"@rsbuild/plugin-type-check": "1.3.2",
|
|
58
58
|
"@rsbuild/plugin-typed-css-modules": "1.2.0",
|
|
59
59
|
"@rsbuild/plugin-yaml": "1.0.3",
|
|
60
60
|
"@rsbuild/webpack": "1.6.1",
|
|
61
|
-
"@swc/core": "1.
|
|
61
|
+
"@swc/core": "1.15.8",
|
|
62
62
|
"@swc/helpers": "^0.5.17",
|
|
63
63
|
"autoprefixer": "10.4.21",
|
|
64
64
|
"babel-loader": "9.2.1",
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
"ts-loader": "9.4.4",
|
|
91
91
|
"webpack": "^5.103.0",
|
|
92
92
|
"webpack-subresource-integrity": "5.1.0",
|
|
93
|
-
"@modern-js/babel-preset": "2.69.
|
|
94
|
-
"@modern-js/flight-server-transform-plugin": "2.69.
|
|
95
|
-
"@modern-js/utils": "2.69.
|
|
93
|
+
"@modern-js/babel-preset": "2.69.7",
|
|
94
|
+
"@modern-js/flight-server-transform-plugin": "2.69.7",
|
|
95
|
+
"@modern-js/utils": "2.69.7"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@rsbuild/plugin-webpack-swc": "1.1.2",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"react-dom": "^18.2.0",
|
|
104
104
|
"terser": "^5.31.1",
|
|
105
105
|
"typescript": "^5.3.0",
|
|
106
|
-
"@modern-js/types": "2.69.
|
|
107
|
-
"@scripts/
|
|
108
|
-
"@scripts/
|
|
106
|
+
"@modern-js/types": "2.69.7",
|
|
107
|
+
"@scripts/build": "2.66.0",
|
|
108
|
+
"@scripts/vitest-config": "2.66.0"
|
|
109
109
|
},
|
|
110
110
|
"publishConfig": {
|
|
111
111
|
"access": "public",
|