@modern-js/uni-builder 0.0.0-nightly-20240128170732 → 0.0.0-nightly-20240130170640
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.
|
@@ -93,16 +93,27 @@ async function getBrowserslistWithDefault(path, config, target) {
|
|
|
93
93
|
return DEFAULT_BROWSERSLIST[target];
|
|
94
94
|
}
|
|
95
95
|
async function parseCommonConfig(uniBuilderConfig, options) {
|
|
96
|
-
var
|
|
96
|
+
var _newDevServerConfig_devMiddleware, _uniBuilderConfig_security, _uniBuilderConfig_output, _uniBuilderConfig_tools;
|
|
97
97
|
var _output, _output_distPath, _output_distPath1, _output1, _extraConfig, _html, _extraConfig1;
|
|
98
98
|
const { cwd, frameworkConfigPath, entry, target } = options;
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
|
|
99
|
+
const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, disableSourceMap, convertToRem, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, ...sourceConfig } = {}, dev: { port, host, https, ...devConfig } = {}, tools: { devServer, tsChecker, minifyCss, ...toolsConfig } = {} } = uniBuilderConfig;
|
|
100
|
+
const rsbuildConfig = {
|
|
101
|
+
plugins,
|
|
102
|
+
output: outputConfig,
|
|
103
|
+
source: {
|
|
104
|
+
alias,
|
|
105
|
+
...sourceConfig
|
|
106
|
+
},
|
|
107
|
+
performance: performanceConfig,
|
|
108
|
+
html: htmlConfig,
|
|
109
|
+
tools: toolsConfig,
|
|
110
|
+
dev: devConfig
|
|
111
|
+
};
|
|
112
|
+
const { dev = {}, html = {}, output = {} } = rsbuildConfig;
|
|
113
|
+
if (cssModuleLocalIdentName) {
|
|
102
114
|
var _output2;
|
|
103
115
|
(_output2 = output).cssModules || (_output2.cssModules = {});
|
|
104
|
-
output.cssModules.localIdentName =
|
|
105
|
-
delete output.cssModuleLocalIdentName;
|
|
116
|
+
output.cssModules.localIdentName = cssModuleLocalIdentName;
|
|
106
117
|
}
|
|
107
118
|
var _distPath;
|
|
108
119
|
(_distPath = (_output = output).distPath) !== null && _distPath !== void 0 ? _distPath : _output.distPath = {};
|
|
@@ -112,22 +123,17 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
112
123
|
(_server = (_output_distPath1 = output.distPath).server) !== null && _server !== void 0 ? _server : _output_distPath1.server = "bundles";
|
|
113
124
|
var _polyfill;
|
|
114
125
|
(_polyfill = (_output1 = output).polyfill) !== null && _polyfill !== void 0 ? _polyfill : _output1.polyfill = "entry";
|
|
115
|
-
if (
|
|
126
|
+
if (disableCssModuleExtension) {
|
|
116
127
|
var _output3, _output_cssModules;
|
|
117
128
|
(_output3 = output).cssModules || (_output3.cssModules = {});
|
|
118
129
|
var _auto;
|
|
119
130
|
(_auto = (_output_cssModules = output.cssModules).auto) !== null && _auto !== void 0 ? _auto : _output_cssModules.auto = isLooseCssModules;
|
|
120
|
-
delete output.cssModuleLocalIdentName;
|
|
121
131
|
}
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
output.inlineScripts = (_uniBuilderConfig_output10 = uniBuilderConfig.output) === null || _uniBuilderConfig_output10 === void 0 ? void 0 : _uniBuilderConfig_output10.enableInlineScripts;
|
|
125
|
-
delete output.enableInlineScripts;
|
|
132
|
+
if (enableInlineScripts) {
|
|
133
|
+
output.inlineScripts = enableInlineScripts;
|
|
126
134
|
}
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
output.injectStyles = (_uniBuilderConfig_output11 = uniBuilderConfig.output) === null || _uniBuilderConfig_output11 === void 0 ? void 0 : _uniBuilderConfig_output11.disableCssExtract;
|
|
130
|
-
delete output.disableCssExtract;
|
|
135
|
+
if (disableCssExtract) {
|
|
136
|
+
output.injectStyles = disableCssExtract;
|
|
131
137
|
}
|
|
132
138
|
const targets = Array.isArray(target) ? target : [
|
|
133
139
|
target || "web"
|
|
@@ -138,40 +144,31 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
138
144
|
overrideBrowserslist[target2] = await getBrowserslistWithDefault(cwd, uniBuilderConfig, target2);
|
|
139
145
|
}
|
|
140
146
|
output.overrideBrowserslist = overrideBrowserslist;
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
output.inlineStyles = (_uniBuilderConfig_output12 = uniBuilderConfig.output) === null || _uniBuilderConfig_output12 === void 0 ? void 0 : _uniBuilderConfig_output12.enableInlineStyles;
|
|
144
|
-
delete output.enableInlineStyles;
|
|
147
|
+
if (enableInlineStyles) {
|
|
148
|
+
output.inlineStyles = enableInlineStyles;
|
|
145
149
|
}
|
|
146
150
|
const extraConfig = {};
|
|
147
151
|
(_extraConfig = extraConfig).html || (_extraConfig.html = {});
|
|
148
|
-
extraConfig.html.outputStructure =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
extraConfig.html.meta = ({ entryName }) => uniBuilderConfig.html.metaByEntries[entryName];
|
|
152
|
-
delete html.metaByEntries;
|
|
152
|
+
extraConfig.html.outputStructure = disableHtmlFolder ? "flat" : "nested";
|
|
153
|
+
if (metaByEntries) {
|
|
154
|
+
extraConfig.html.meta = ({ entryName }) => metaByEntries[entryName];
|
|
153
155
|
}
|
|
154
156
|
var _title;
|
|
155
157
|
(_title = (_html = html).title) !== null && _title !== void 0 ? _title : _html.title = "";
|
|
156
|
-
if (
|
|
157
|
-
extraConfig.html.title = ({ entryName }) =>
|
|
158
|
-
delete html.titleByEntries;
|
|
158
|
+
if (titleByEntries) {
|
|
159
|
+
extraConfig.html.title = ({ entryName }) => titleByEntries[entryName];
|
|
159
160
|
}
|
|
160
|
-
if (
|
|
161
|
-
extraConfig.html.favicon = ({ entryName }) =>
|
|
162
|
-
delete html.faviconByEntries;
|
|
161
|
+
if (faviconByEntries) {
|
|
162
|
+
extraConfig.html.favicon = ({ entryName }) => faviconByEntries[entryName];
|
|
163
163
|
}
|
|
164
|
-
if (
|
|
165
|
-
extraConfig.html.inject = ({ entryName }) =>
|
|
166
|
-
delete html.injectByEntries;
|
|
164
|
+
if (injectByEntries) {
|
|
165
|
+
extraConfig.html.inject = ({ entryName }) => injectByEntries[entryName];
|
|
167
166
|
}
|
|
168
|
-
if (
|
|
169
|
-
extraConfig.html.template = ({ entryName }) =>
|
|
170
|
-
delete html.templateByEntries;
|
|
167
|
+
if (templateByEntries) {
|
|
168
|
+
extraConfig.html.template = ({ entryName }) => templateByEntries[entryName];
|
|
171
169
|
}
|
|
172
|
-
if (
|
|
173
|
-
extraConfig.html.templateParameters = (_, { entryName }) =>
|
|
174
|
-
delete html.templateParametersByEntries;
|
|
170
|
+
if (templateParametersByEntries) {
|
|
171
|
+
extraConfig.html.templateParameters = (_, { entryName }) => templateParametersByEntries[entryName];
|
|
175
172
|
}
|
|
176
173
|
var _tools;
|
|
177
174
|
(_tools = (_extraConfig1 = extraConfig).tools) !== null && _tools !== void 0 ? _tools : _extraConfig1.tools = {};
|
|
@@ -192,7 +189,7 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
192
189
|
dev.progressBar = true;
|
|
193
190
|
}
|
|
194
191
|
var _dev_hmr;
|
|
195
|
-
const
|
|
192
|
+
const newDevServerConfig = (0, import_shared.mergeChainedOptions)({
|
|
196
193
|
defaults: {
|
|
197
194
|
devMiddleware: {
|
|
198
195
|
writeToDisk: (file) => !file.includes(".hot-update.")
|
|
@@ -203,25 +200,21 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
203
200
|
path: "/webpack-hmr"
|
|
204
201
|
}
|
|
205
202
|
},
|
|
206
|
-
options:
|
|
203
|
+
options: devServer,
|
|
207
204
|
mergeFn: import_shared.deepmerge
|
|
208
205
|
});
|
|
209
|
-
dev.writeToDisk = (
|
|
210
|
-
dev.hmr =
|
|
211
|
-
dev.client =
|
|
212
|
-
dev.liveReload =
|
|
206
|
+
dev.writeToDisk = (_newDevServerConfig_devMiddleware = newDevServerConfig.devMiddleware) === null || _newDevServerConfig_devMiddleware === void 0 ? void 0 : _newDevServerConfig_devMiddleware.writeToDisk;
|
|
207
|
+
dev.hmr = newDevServerConfig.hot;
|
|
208
|
+
dev.client = newDevServerConfig.client;
|
|
209
|
+
dev.liveReload = newDevServerConfig.liveReload;
|
|
213
210
|
const server = (0, import_shared.isProd)() ? {
|
|
214
211
|
publicDir: false
|
|
215
212
|
} : {
|
|
216
213
|
publicDir: false,
|
|
217
|
-
port
|
|
218
|
-
host
|
|
219
|
-
https:
|
|
214
|
+
port,
|
|
215
|
+
host,
|
|
216
|
+
https: https ? https : void 0
|
|
220
217
|
};
|
|
221
|
-
delete tools.devServer;
|
|
222
|
-
delete dev.https;
|
|
223
|
-
delete dev.port;
|
|
224
|
-
delete dev.host;
|
|
225
218
|
rsbuildConfig.server = removeUndefinedKey(server);
|
|
226
219
|
rsbuildConfig.dev = removeUndefinedKey(dev);
|
|
227
220
|
rsbuildConfig.html = html;
|
|
@@ -234,9 +227,9 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
234
227
|
}
|
|
235
228
|
const rsbuildPlugins = [
|
|
236
229
|
(0, import_splitChunk.pluginSplitChunks)(),
|
|
237
|
-
(0, import_globalVars.pluginGlobalVars)(
|
|
230
|
+
(0, import_globalVars.pluginGlobalVars)(globalVars),
|
|
238
231
|
(0, import_devtools.pluginDevtool)({
|
|
239
|
-
disableSourceMap
|
|
232
|
+
disableSourceMap
|
|
240
233
|
}),
|
|
241
234
|
(0, import_emitRouteFile.pluginEmitRouteFile)(),
|
|
242
235
|
(0, import_plugin_toml.pluginToml)(),
|
|
@@ -247,45 +240,36 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
247
240
|
const { pluginCheckSyntax } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-check-syntax")));
|
|
248
241
|
rsbuildPlugins.push(pluginCheckSyntax(typeof checkSyntaxOptions === "boolean" ? {} : checkSyntaxOptions));
|
|
249
242
|
}
|
|
250
|
-
if (!
|
|
251
|
-
var _uniBuilderConfig_tools2;
|
|
243
|
+
if (!disableTsChecker) {
|
|
252
244
|
const { pluginTypeCheck } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-type-check")));
|
|
253
245
|
rsbuildPlugins.push(pluginTypeCheck({
|
|
254
|
-
forkTsCheckerOptions:
|
|
246
|
+
forkTsCheckerOptions: tsChecker
|
|
255
247
|
}));
|
|
256
|
-
delete output.disableTsChecker;
|
|
257
|
-
delete tools.tsChecker;
|
|
258
248
|
}
|
|
259
|
-
if (
|
|
260
|
-
var _uniBuilderConfig_source3;
|
|
249
|
+
if (resolveMainFields) {
|
|
261
250
|
const { pluginMainFields } = await Promise.resolve().then(() => __toESM(require("./plugins/mainFields")));
|
|
262
|
-
rsbuildPlugins.push(pluginMainFields(
|
|
251
|
+
rsbuildPlugins.push(pluginMainFields(resolveMainFields));
|
|
263
252
|
}
|
|
264
|
-
if (
|
|
265
|
-
var _uniBuilderConfig_source4;
|
|
253
|
+
if (resolveExtensionPrefix) {
|
|
266
254
|
const { pluginExtensionPrefix } = await Promise.resolve().then(() => __toESM(require("./plugins/extensionPrefix")));
|
|
267
|
-
rsbuildPlugins.push(pluginExtensionPrefix(
|
|
255
|
+
rsbuildPlugins.push(pluginExtensionPrefix(resolveExtensionPrefix));
|
|
268
256
|
}
|
|
269
|
-
|
|
270
|
-
if (remOptions) {
|
|
257
|
+
if (convertToRem) {
|
|
271
258
|
const { pluginRem } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-rem")));
|
|
272
|
-
rsbuildPlugins.push(pluginRem(typeof
|
|
259
|
+
rsbuildPlugins.push(pluginRem(typeof convertToRem === "boolean" ? {} : convertToRem));
|
|
273
260
|
}
|
|
274
|
-
rsbuildPlugins.push((0, import_runtimeChunk.pluginRuntimeChunk)((
|
|
261
|
+
rsbuildPlugins.push((0, import_runtimeChunk.pluginRuntimeChunk)((_uniBuilderConfig_output = uniBuilderConfig.output) === null || _uniBuilderConfig_output === void 0 ? void 0 : _uniBuilderConfig_output.disableInlineRuntimeChunk));
|
|
275
262
|
const { sourceBuild } = uniBuilderConfig.experiments || {};
|
|
276
263
|
if (sourceBuild) {
|
|
277
264
|
const { pluginSourceBuild } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-source-build")));
|
|
278
265
|
rsbuildPlugins.push(pluginSourceBuild(sourceBuild === true ? {} : sourceBuild));
|
|
279
266
|
}
|
|
280
267
|
rsbuildPlugins.push((0, import_plugin_react.pluginReact)());
|
|
281
|
-
if (!
|
|
282
|
-
var _uniBuilderConfig_output13;
|
|
268
|
+
if (!disableSvgr) {
|
|
283
269
|
const { pluginSvgr } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-svgr")));
|
|
284
270
|
rsbuildPlugins.push(pluginSvgr({
|
|
285
|
-
svgDefaultExport:
|
|
271
|
+
svgDefaultExport: svgDefaultExport || "url"
|
|
286
272
|
}));
|
|
287
|
-
delete output.disableSvgr;
|
|
288
|
-
delete output.svgDefaultExport;
|
|
289
273
|
}
|
|
290
274
|
const pugOptions = (_uniBuilderConfig_tools = uniBuilderConfig.tools) === null || _uniBuilderConfig_tools === void 0 ? void 0 : _uniBuilderConfig_tools.pug;
|
|
291
275
|
if (pugOptions) {
|
|
@@ -294,12 +278,11 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
294
278
|
pugOptions
|
|
295
279
|
}));
|
|
296
280
|
}
|
|
297
|
-
if (
|
|
298
|
-
var _uniBuilderConfig_output14;
|
|
281
|
+
if (assetsRetry) {
|
|
299
282
|
const { pluginAssetsRetry } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-assets-retry")));
|
|
300
|
-
rsbuildPlugins.push(pluginAssetsRetry(
|
|
283
|
+
rsbuildPlugins.push(pluginAssetsRetry(assetsRetry));
|
|
301
284
|
}
|
|
302
|
-
if (
|
|
285
|
+
if (enableAssetFallback) {
|
|
303
286
|
const { pluginFallback } = await Promise.resolve().then(() => __toESM(require("./plugins/fallback")));
|
|
304
287
|
rsbuildPlugins.push(pluginFallback());
|
|
305
288
|
}
|
|
@@ -307,7 +290,7 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
307
290
|
rsbuildPlugins.push((0, import_frameworkConfig.pluginFrameworkConfig)(frameworkConfigPath));
|
|
308
291
|
}
|
|
309
292
|
rsbuildPlugins.push((0, import_plugin_css_minimizer.pluginCssMinimizer)({
|
|
310
|
-
pluginOptions:
|
|
293
|
+
pluginOptions: minifyCss
|
|
311
294
|
}));
|
|
312
295
|
targets.includes("web") && rsbuildPlugins.push((0, import_postcssLegacy.pluginPostcssLegacy)(overrideBrowserslist.web));
|
|
313
296
|
return {
|
|
@@ -31,9 +31,14 @@ __export(styledComponents_exports, {
|
|
|
31
31
|
pluginStyledComponents: () => pluginStyledComponents
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(styledComponents_exports);
|
|
34
|
+
var import_core = require("@rsbuild/core");
|
|
34
35
|
var import_shared = require("@rsbuild/shared");
|
|
35
36
|
const pluginStyledComponents = (userConfig = {}) => ({
|
|
36
37
|
name: "uni-builder:styled-components",
|
|
38
|
+
pre: [
|
|
39
|
+
import_core.PLUGIN_SWC_NAME,
|
|
40
|
+
"uni-builder:babel"
|
|
41
|
+
],
|
|
37
42
|
setup(api) {
|
|
38
43
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd }) => {
|
|
39
44
|
const isSSR = (0, import_shared.isServerTarget)(api.context.targets);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/uni-builder",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240130170640",
|
|
4
4
|
"description": "Unified builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"webpack": "^5.89.0",
|
|
65
65
|
"webpack-manifest-plugin": "5.0.0",
|
|
66
66
|
"webpack-subresource-integrity": "5.1.0",
|
|
67
|
-
"@modern-js/utils": "0.0.0-nightly-
|
|
68
|
-
"@modern-js/server": "0.0.0-nightly-
|
|
69
|
-
"@modern-js/prod-server": "0.0.0-nightly-
|
|
67
|
+
"@modern-js/utils": "0.0.0-nightly-20240130170640",
|
|
68
|
+
"@modern-js/server": "0.0.0-nightly-20240130170640",
|
|
69
|
+
"@modern-js/prod-server": "0.0.0-nightly-20240130170640"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@rsbuild/plugin-swc": "0.3.7",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"react": "^18.2.0",
|
|
75
75
|
"react-dom": "^18.2.0",
|
|
76
76
|
"typescript": "^5.3.0",
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
79
|
-
"@scripts/vitest-config": "0.0.0-nightly-
|
|
77
|
+
"@modern-js/builder-plugin-node-polyfill": "0.0.0-nightly-20240130170640",
|
|
78
|
+
"@scripts/build": "0.0.0-nightly-20240130170640",
|
|
79
|
+
"@scripts/vitest-config": "0.0.0-nightly-20240130170640"
|
|
80
80
|
},
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public",
|