@modern-js/uni-builder 2.60.3 → 2.60.5

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.
@@ -82,7 +82,7 @@ async function parseCommonConfig(uniBuilderConfig, options) {
82
82
  var _uniBuilderConfig_output, _uniBuilderConfig_tools;
83
83
  var _rsbuildConfig_tools, _output, _output_distPath, _output1, _extraConfig, _html, _extraConfig1;
84
84
  const { frameworkConfigPath } = options;
85
- const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { disableFilenameHash, enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, enableAssetManifest, disableSourceMap, convertToRem, disableMinimize, polyfill, dataUriLimit = 1e4, distPath = {}, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, tagsByEntries, appIcon, tags, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, transformImport, ...sourceConfig } = {}, dev, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {} } = uniBuilderConfig;
85
+ const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { disableFilenameHash, enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, enableAssetManifest, disableSourceMap, sourceMap, convertToRem, disableMinimize, polyfill, dataUriLimit = 1e4, distPath = {}, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, tagsByEntries, outputStructure, appIcon, tags, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, transformImport, ...sourceConfig } = {}, dev, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {} } = uniBuilderConfig;
86
86
  const rsbuildConfig = {
87
87
  plugins,
88
88
  output: {
@@ -158,7 +158,7 @@ async function parseCommonConfig(uniBuilderConfig, options) {
158
158
  }
159
159
  const extraConfig = {};
160
160
  (_extraConfig = extraConfig).html || (_extraConfig.html = {});
161
- extraConfig.html.outputStructure = disableHtmlFolder ? "flat" : "nested";
161
+ extraConfig.html.outputStructure = outputStructure !== null && outputStructure !== void 0 ? outputStructure : disableHtmlFolder ? "flat" : "nested";
162
162
  if (metaByEntries) {
163
163
  extraConfig.html.meta = ({ entryName }) => metaByEntries[entryName];
164
164
  }
@@ -235,7 +235,8 @@ async function parseCommonConfig(uniBuilderConfig, options) {
235
235
  (0, import_splitChunk.pluginSplitChunks)(),
236
236
  (0, import_globalVars.pluginGlobalVars)(globalVars),
237
237
  (0, import_devtools.pluginDevtool)({
238
- disableSourceMap
238
+ disableSourceMap,
239
+ sourceMap
239
240
  }),
240
241
  (0, import_emitRouteFile.pluginEmitRouteFile)(),
241
242
  (0, import_plugin_toml.pluginToml)(),
@@ -1,5 +1,6 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
1
+ import type { RsbuildPlugin, SourceMap } from '@rsbuild/core';
2
2
  import type { DisableSourceMapOption } from '../../types';
3
3
  export declare const pluginDevtool: (options: {
4
4
  disableSourceMap?: DisableSourceMapOption;
5
+ sourceMap?: SourceMap;
5
6
  }) => RsbuildPlugin;
@@ -21,20 +21,32 @@ __export(devtools_exports, {
21
21
  pluginDevtool: () => pluginDevtool
22
22
  });
23
23
  module.exports = __toCommonJS(devtools_exports);
24
+ var import_utils = require("@modern-js/utils");
24
25
  const isUseJsSourceMap = (disableSourceMap = {}) => {
25
- return typeof disableSourceMap === "boolean" ? !disableSourceMap : !disableSourceMap.js;
26
+ if (typeof disableSourceMap === "boolean") {
27
+ return !disableSourceMap;
28
+ }
29
+ return !disableSourceMap.js;
26
30
  };
27
31
  const pluginDevtool = (options) => ({
28
32
  name: "uni-builder:devtool",
29
33
  setup(api) {
34
+ var _options_sourceMap;
35
+ const devtoolJs = (_options_sourceMap = options.sourceMap) === null || _options_sourceMap === void 0 ? void 0 : _options_sourceMap.js;
36
+ if (devtoolJs) {
37
+ if (!isUseJsSourceMap(options.disableSourceMap)) {
38
+ import_utils.logger.warn("Detected that `output.sourceMap` and `output.disableSourceMap` are used together, use the value of `output.sourceMap`");
39
+ }
40
+ return;
41
+ }
30
42
  api.modifyBundlerChain((chain, { isProd, isServer }) => {
31
43
  if (!isUseJsSourceMap(options.disableSourceMap)) {
32
44
  chain.devtool(false);
33
- } else {
34
- const prodDevTool = isServer ? "source-map" : "hidden-source-map";
35
- const devtool = isProd ? prodDevTool : "cheap-module-source-map";
36
- chain.devtool(devtool);
45
+ return;
37
46
  }
47
+ const prodDevTool = isServer ? "source-map" : "hidden-source-map";
48
+ const devtool = isProd ? prodDevTool : "cheap-module-source-map";
49
+ chain.devtool(devtool);
38
50
  });
39
51
  }
40
52
  });
package/dist/types.d.ts CHANGED
@@ -238,6 +238,7 @@ export type UniBuilderExtraConfig = {
238
238
  disableSvgr?: boolean;
239
239
  /**
240
240
  * Whether to disable source map.
241
+ * @deprecated use `output.sourceMap` instead
241
242
  */
242
243
  disableSourceMap?: DisableSourceMapOption;
243
244
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/uni-builder",
3
- "version": "2.60.3",
3
+ "version": "2.60.5",
4
4
  "description": "Unified builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,7 +54,7 @@
54
54
  "cssnano": "6.0.1",
55
55
  "glob": "^9.3.5",
56
56
  "html-minifier-terser": "^7.2.0",
57
- "html-webpack-plugin": "5.5.3",
57
+ "html-webpack-plugin": "5.6.2",
58
58
  "lodash": "^4.17.21",
59
59
  "picocolors": "^1.0.1",
60
60
  "postcss": "^8.4.35",
@@ -66,25 +66,25 @@
66
66
  "postcss-nesting": "12.0.1",
67
67
  "postcss-page-break": "3.0.4",
68
68
  "react-refresh": "^0.14.0",
69
- "rspack-manifest-plugin": "5.0.0",
69
+ "rspack-manifest-plugin": "5.0.1",
70
70
  "terser-webpack-plugin": "5.3.10",
71
- "ts-deepmerge": "7.0.0",
71
+ "ts-deepmerge": "7.0.1",
72
72
  "ts-loader": "9.4.4",
73
73
  "webpack": "^5.95.0",
74
74
  "webpack-subresource-integrity": "5.1.0",
75
- "@modern-js/utils": "2.60.3",
76
- "@modern-js/babel-preset": "2.60.3"
75
+ "@modern-js/babel-preset": "2.60.5",
76
+ "@modern-js/utils": "2.60.5"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@rsbuild/plugin-webpack-swc": "~1.0.3",
80
80
  "@types/html-minifier-terser": "^7.0.2",
81
81
  "@types/lodash": "^4.14.202",
82
- "react": "^18.2.0",
83
- "react-dom": "^18.2.0",
82
+ "react": "^18.3.1",
83
+ "react-dom": "^18.3.1",
84
84
  "terser": "^5.31.1",
85
85
  "typescript": "^5.3.0",
86
- "@scripts/build": "2.60.3",
87
- "@scripts/vitest-config": "2.60.3"
86
+ "@scripts/build": "2.60.5",
87
+ "@scripts/vitest-config": "2.60.5"
88
88
  },
89
89
  "publishConfig": {
90
90
  "access": "public",