@modern-js/uni-builder 2.63.3 → 2.63.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.
@@ -2,7 +2,7 @@ import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
2
2
  import type { CreateBuilderCommonOptions, UniBuilderConfig } from '../types';
3
3
  /** Determine if a file path is a CSS module when disableCssModuleExtension is enabled. */
4
4
  export declare const isLooseCssModules: (path: string) => boolean;
5
- export declare function parseCommonConfig(uniBuilderConfig: UniBuilderConfig, options: CreateBuilderCommonOptions): Promise<{
5
+ export declare function parseCommonConfig(uniBuilderConfig: UniBuilderConfig, options?: CreateBuilderCommonOptions): Promise<{
6
6
  rsbuildConfig: RsbuildConfig;
7
7
  rsbuildPlugins: RsbuildPlugin[];
8
8
  }>;
@@ -80,7 +80,7 @@ const isUseCssSourceMap = (disableSourceMap = {}) => {
80
80
  async function parseCommonConfig(uniBuilderConfig, options) {
81
81
  var _uniBuilderConfig_output, _uniBuilderConfig_tools;
82
82
  var _rsbuildConfig_tools, _output, _output_distPath, _output1, _extraConfig, _html, _extraConfig1;
83
- const { frameworkConfigPath } = options;
83
+ const frameworkConfigPath = options === null || options === void 0 ? void 0 : options.frameworkConfigPath;
84
84
  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;
85
85
  const rsbuildConfig = {
86
86
  plugins,
@@ -1,5 +1,6 @@
1
1
  import type { RsbuildPlugin } from '@rsbuild/core';
2
2
  import type { ToolsAutoprefixerConfig } from '../../types';
3
- export declare const pluginPostcss: ({ autoprefixer, }: {
4
- autoprefixer?: ToolsAutoprefixerConfig | undefined;
5
- }) => RsbuildPlugin;
3
+ export interface PluginPostcssOptions {
4
+ autoprefixer?: ToolsAutoprefixerConfig;
5
+ }
6
+ export declare const pluginPostcss: (options?: PluginPostcssOptions) => RsbuildPlugin;
@@ -23,12 +23,13 @@ __export(postcss_exports, {
23
23
  module.exports = __toCommonJS(postcss_exports);
24
24
  var import_utils = require("@modern-js/utils");
25
25
  var import_getCssSupport = require("../getCssSupport");
26
- const pluginPostcss = ({ autoprefixer }) => ({
26
+ const pluginPostcss = (options = {}) => ({
27
27
  name: "uni-builder:postcss-plugins",
28
28
  pre: [
29
29
  "uni-builder:environment-defaults-plugin"
30
30
  ],
31
31
  setup(api) {
32
+ const { autoprefixer } = options;
32
33
  api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig }) => {
33
34
  var _config_output;
34
35
  if (config.output.target !== "web") {
@@ -37,6 +38,23 @@ const pluginPostcss = ({ autoprefixer }) => ({
37
38
  const cssSupport = (0, import_getCssSupport.getCssSupport)(config.output.overrideBrowserslist);
38
39
  const enableExtractCSS = !((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.injectStyles);
39
40
  const enableCssMinify = !enableExtractCSS && import_utils.isProd;
41
+ const cssnanoOptions = {
42
+ preset: [
43
+ "default",
44
+ {
45
+ // merge longhand will break safe-area-inset-top, so disable it
46
+ // https://github.com/cssnano/cssnano/issues/803
47
+ // https://github.com/cssnano/cssnano/issues/967
48
+ mergeLonghand: false,
49
+ /**
50
+ * normalizeUrl will transform relative url from `./assets/img.svg` to `assets/img.svg`.
51
+ * It may break the behavior of webpack resolver while using style-loader.
52
+ * So disable it while `output.injectStyles = true` or `output.disableCssExtract = true`.
53
+ */
54
+ normalizeUrl: false
55
+ }
56
+ ]
57
+ };
40
58
  const plugins = [
41
59
  require("postcss-flexbugs-fixes"),
42
60
  !cssSupport.customProperties && require("postcss-custom-properties"),
@@ -45,17 +63,7 @@ const pluginPostcss = ({ autoprefixer }) => ({
45
63
  !cssSupport.fontVariant && require("postcss-font-variant"),
46
64
  !cssSupport.mediaMinmax && require("postcss-media-minmax"),
47
65
  require("postcss-nesting"),
48
- enableCssMinify ? require("cssnano")({
49
- preset: [
50
- "default",
51
- {
52
- // merge longhand will break safe-area-inset-top, so disable it
53
- // https://github.com/cssnano/cssnano/issues/803
54
- // https://github.com/cssnano/cssnano/issues/967
55
- mergeLonghand: false
56
- }
57
- ]
58
- }) : false,
66
+ enableCssMinify ? require("cssnano")(cssnanoOptions) : false,
59
67
  // The last insert autoprefixer
60
68
  require("autoprefixer")((0, import_utils.applyOptionsChain)({
61
69
  flexbox: "no-2009",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/uni-builder",
3
- "version": "2.63.3",
3
+ "version": "2.63.5",
4
4
  "description": "Unified builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "@babel/preset-react": "^7.22.15",
27
27
  "@babel/types": "^7.26.0",
28
28
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
29
- "@rsbuild/core": "1.1.10",
29
+ "@rsbuild/core": "1.1.13",
30
30
  "@rsbuild/plugin-assets-retry": "1.0.7",
31
31
  "@rsbuild/plugin-babel": "1.0.3",
32
32
  "@rsbuild/plugin-check-syntax": "1.2.0",
@@ -40,7 +40,7 @@
40
40
  "@rsbuild/plugin-styled-components": "1.1.0",
41
41
  "@rsbuild/plugin-svgr": "1.0.6",
42
42
  "@rsbuild/plugin-toml": "1.0.1",
43
- "@rsbuild/plugin-type-check": "1.1.0",
43
+ "@rsbuild/plugin-type-check": "1.2.0",
44
44
  "@rsbuild/plugin-typed-css-modules": "1.0.2",
45
45
  "@rsbuild/plugin-yaml": "1.0.2",
46
46
  "@rsbuild/webpack": "1.1.6",
@@ -66,14 +66,14 @@
66
66
  "postcss-nesting": "12.1.5",
67
67
  "postcss-page-break": "3.0.4",
68
68
  "react-refresh": "^0.14.0",
69
- "rspack-manifest-plugin": "5.0.2",
69
+ "rspack-manifest-plugin": "5.0.3",
70
70
  "terser-webpack-plugin": "5.3.11",
71
71
  "ts-deepmerge": "7.0.2",
72
72
  "ts-loader": "9.4.4",
73
73
  "webpack": "^5.97.1",
74
74
  "webpack-subresource-integrity": "5.1.0",
75
- "@modern-js/babel-preset": "2.63.3",
76
- "@modern-js/utils": "2.63.3"
75
+ "@modern-js/babel-preset": "2.63.5",
76
+ "@modern-js/utils": "2.63.5"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@rsbuild/plugin-webpack-swc": "1.0.9",
@@ -83,8 +83,8 @@
83
83
  "react-dom": "^18.3.1",
84
84
  "terser": "^5.31.1",
85
85
  "typescript": "^5.3.0",
86
- "@scripts/build": "2.63.3",
87
- "@scripts/vitest-config": "2.63.3"
86
+ "@scripts/build": "2.63.5",
87
+ "@scripts/vitest-config": "2.63.5"
88
88
  },
89
89
  "publishConfig": {
90
90
  "access": "public",