@rsbuild/webpack 0.0.0-next-20231103091827

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.
Files changed (158) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/compiled/ansi-escapes/index.d.ts +248 -0
  4. package/compiled/ansi-escapes/index.js +1 -0
  5. package/compiled/ansi-escapes/license +9 -0
  6. package/compiled/ansi-escapes/package.json +1 -0
  7. package/compiled/ansi-escapes/type-fest/index.d.ts +2 -0
  8. package/compiled/babel-plugin-lodash/index.d.ts +1 -0
  9. package/compiled/babel-plugin-lodash/index.js +1 -0
  10. package/compiled/babel-plugin-lodash/license +44 -0
  11. package/compiled/babel-plugin-lodash/package.json +1 -0
  12. package/compiled/babel-plugin-transform-react-remove-prop-types/index.d.ts +1 -0
  13. package/compiled/babel-plugin-transform-react-remove-prop-types/index.js +1 -0
  14. package/compiled/babel-plugin-transform-react-remove-prop-types/license +22 -0
  15. package/compiled/babel-plugin-transform-react-remove-prop-types/package.json +1 -0
  16. package/compiled/cli-truncate/index.d.ts +96 -0
  17. package/compiled/cli-truncate/index.js +1 -0
  18. package/compiled/cli-truncate/license +9 -0
  19. package/compiled/cli-truncate/package.json +1 -0
  20. package/compiled/copy-webpack-plugin/index.d.ts +1 -0
  21. package/compiled/copy-webpack-plugin/index.js +22 -0
  22. package/compiled/copy-webpack-plugin/license +20 -0
  23. package/compiled/copy-webpack-plugin/package.json +1 -0
  24. package/compiled/patch-console/build/index.d.ts +4 -0
  25. package/compiled/patch-console/index.js +1 -0
  26. package/compiled/patch-console/package.json +1 -0
  27. package/compiled/schema-utils3/index.d.ts +1 -0
  28. package/compiled/schema-utils3/index.js +3 -0
  29. package/compiled/schema-utils3/license +20 -0
  30. package/compiled/schema-utils3/package.json +1 -0
  31. package/compiled/tapable/index.js +1 -0
  32. package/compiled/tapable/license +21 -0
  33. package/compiled/tapable/package.json +1 -0
  34. package/compiled/tapable/tapable.d.ts +116 -0
  35. package/compiled/webpack-manifest-plugin/index.js +1 -0
  36. package/compiled/webpack-manifest-plugin/license +21 -0
  37. package/compiled/webpack-manifest-plugin/package.json +1 -0
  38. package/compiled/webpack-manifest-plugin/types/helpers.d.ts +23 -0
  39. package/compiled/webpack-manifest-plugin/types/hooks.d.ts +24 -0
  40. package/compiled/webpack-manifest-plugin/types/index.d.ts +30 -0
  41. package/compiled/webpack-sources/index.d.ts +1 -0
  42. package/compiled/webpack-sources/index.js +1 -0
  43. package/compiled/webpack-sources/license +21 -0
  44. package/compiled/webpack-sources/package.json +1 -0
  45. package/dist/config/defaults.d.ts +3 -0
  46. package/dist/config/defaults.js +52 -0
  47. package/dist/config/normalize.d.ts +7 -0
  48. package/dist/config/normalize.js +33 -0
  49. package/dist/core/build.d.ts +20 -0
  50. package/dist/core/build.js +80 -0
  51. package/dist/core/createCompiler.d.ts +8 -0
  52. package/dist/core/createCompiler.js +68 -0
  53. package/dist/core/createContext.d.ts +13 -0
  54. package/dist/core/createContext.js +56 -0
  55. package/dist/core/devMiddleware.d.ts +5 -0
  56. package/dist/core/devMiddleware.js +73 -0
  57. package/dist/core/initConfigs.d.ts +14 -0
  58. package/dist/core/initConfigs.js +76 -0
  59. package/dist/core/initHooks.d.ts +19 -0
  60. package/dist/core/initHooks.js +44 -0
  61. package/dist/core/initPlugins.d.ts +9 -0
  62. package/dist/core/initPlugins.js +83 -0
  63. package/dist/core/inspectConfig.d.ts +20 -0
  64. package/dist/core/inspectConfig.js +81 -0
  65. package/dist/core/startDevServer.d.ts +5 -0
  66. package/dist/core/startDevServer.js +75 -0
  67. package/dist/core/webpackConfig.d.ts +9 -0
  68. package/dist/core/webpackConfig.js +164 -0
  69. package/dist/exports/webpack.d.ts +2 -0
  70. package/dist/exports/webpack.js +35 -0
  71. package/dist/index.d.ts +6 -0
  72. package/dist/index.js +34 -0
  73. package/dist/plugins/babel.d.ts +3 -0
  74. package/dist/plugins/babel.js +171 -0
  75. package/dist/plugins/basic.d.ts +5 -0
  76. package/dist/plugins/basic.js +60 -0
  77. package/dist/plugins/copy.d.ts +2 -0
  78. package/dist/plugins/copy.js +69 -0
  79. package/dist/plugins/css.d.ts +23 -0
  80. package/dist/plugins/css.js +123 -0
  81. package/dist/plugins/fallback.d.ts +2 -0
  82. package/dist/plugins/fallback.js +51 -0
  83. package/dist/plugins/hmr.d.ts +2 -0
  84. package/dist/plugins/hmr.js +41 -0
  85. package/dist/plugins/lazyCompilation.d.ts +2 -0
  86. package/dist/plugins/lazyCompilation.js +43 -0
  87. package/dist/plugins/less.d.ts +6 -0
  88. package/dist/plugins/less.js +65 -0
  89. package/dist/plugins/manifest.d.ts +2 -0
  90. package/dist/plugins/manifest.js +58 -0
  91. package/dist/plugins/minimize.d.ts +2 -0
  92. package/dist/plugins/minimize.js +64 -0
  93. package/dist/plugins/moduleScopes.d.ts +5 -0
  94. package/dist/plugins/moduleScopes.js +85 -0
  95. package/dist/plugins/output.d.ts +2 -0
  96. package/dist/plugins/output.js +66 -0
  97. package/dist/plugins/progress.d.ts +2 -0
  98. package/dist/plugins/progress.js +57 -0
  99. package/dist/plugins/react.d.ts +2 -0
  100. package/dist/plugins/react.js +96 -0
  101. package/dist/plugins/resolve.d.ts +2 -0
  102. package/dist/plugins/resolve.js +88 -0
  103. package/dist/plugins/sass.d.ts +2 -0
  104. package/dist/plugins/sass.js +76 -0
  105. package/dist/plugins/sri.d.ts +2 -0
  106. package/dist/plugins/sri.js +43 -0
  107. package/dist/plugins/tsLoader.d.ts +2 -0
  108. package/dist/plugins/tsLoader.js +103 -0
  109. package/dist/provider.d.ts +9 -0
  110. package/dist/provider.js +104 -0
  111. package/dist/shared/fs.d.ts +1 -0
  112. package/dist/shared/fs.js +38 -0
  113. package/dist/shared/index.d.ts +1 -0
  114. package/dist/shared/index.js +22 -0
  115. package/dist/shared/plugin.d.ts +5 -0
  116. package/dist/shared/plugin.js +111 -0
  117. package/dist/types/config/index.d.ts +30 -0
  118. package/dist/types/config/index.js +26 -0
  119. package/dist/types/config/security.d.ts +9 -0
  120. package/dist/types/config/security.js +16 -0
  121. package/dist/types/config/source.d.ts +26 -0
  122. package/dist/types/config/source.js +16 -0
  123. package/dist/types/config/tools.d.ts +52 -0
  124. package/dist/types/config/tools.js +16 -0
  125. package/dist/types/context.d.ts +17 -0
  126. package/dist/types/context.js +16 -0
  127. package/dist/types/hooks.d.ts +24 -0
  128. package/dist/types/hooks.js +16 -0
  129. package/dist/types/index.d.ts +5 -0
  130. package/dist/types/index.js +30 -0
  131. package/dist/types/plugin.d.ts +10 -0
  132. package/dist/types/plugin.js +16 -0
  133. package/dist/types/thirdParty/css.d.ts +7 -0
  134. package/dist/types/thirdParty/css.js +16 -0
  135. package/dist/types/thirdParty/index.d.ts +9 -0
  136. package/dist/types/thirdParty/index.js +16 -0
  137. package/dist/webpackPlugins/ModuleScopePlugin.d.ts +16 -0
  138. package/dist/webpackPlugins/ModuleScopePlugin.js +111 -0
  139. package/dist/webpackPlugins/ProgressPlugin/ProgressPlugin.d.ts +13 -0
  140. package/dist/webpackPlugins/ProgressPlugin/ProgressPlugin.js +102 -0
  141. package/dist/webpackPlugins/ProgressPlugin/helpers/bar.d.ts +5 -0
  142. package/dist/webpackPlugins/ProgressPlugin/helpers/bar.js +143 -0
  143. package/dist/webpackPlugins/ProgressPlugin/helpers/bus.d.ts +17 -0
  144. package/dist/webpackPlugins/ProgressPlugin/helpers/bus.js +105 -0
  145. package/dist/webpackPlugins/ProgressPlugin/helpers/index.d.ts +4 -0
  146. package/dist/webpackPlugins/ProgressPlugin/helpers/index.js +28 -0
  147. package/dist/webpackPlugins/ProgressPlugin/helpers/log.d.ts +8 -0
  148. package/dist/webpackPlugins/ProgressPlugin/helpers/log.js +62 -0
  149. package/dist/webpackPlugins/ProgressPlugin/helpers/nonTty.d.ts +15 -0
  150. package/dist/webpackPlugins/ProgressPlugin/helpers/nonTty.js +56 -0
  151. package/dist/webpackPlugins/ProgressPlugin/helpers/percentage.d.ts +7 -0
  152. package/dist/webpackPlugins/ProgressPlugin/helpers/percentage.js +52 -0
  153. package/dist/webpackPlugins/ProgressPlugin/helpers/type.d.ts +25 -0
  154. package/dist/webpackPlugins/ProgressPlugin/helpers/type.js +16 -0
  155. package/dist/webpackPlugins/ProgressPlugin/helpers/utils.d.ts +1 -0
  156. package/dist/webpackPlugins/ProgressPlugin/helpers/utils.js +30 -0
  157. package/package.json +88 -0
  158. package/static/ModuleFilenameHelpers.js +2 -0
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var css_exports = {};
30
+ __export(css_exports, {
31
+ applyBaseCSSRule: () => applyBaseCSSRule,
32
+ pluginCss: () => pluginCss
33
+ });
34
+ module.exports = __toCommonJS(css_exports);
35
+ var import_shared = require("@rsbuild/shared");
36
+ async function applyBaseCSSRule({
37
+ rule,
38
+ config,
39
+ context,
40
+ utils: { target, isProd, isServer, CHAIN_ID, isWebWorker, getCompiledPath },
41
+ importLoaders = 1
42
+ }) {
43
+ const browserslist = await (0, import_shared.getBrowserslistWithDefault)(
44
+ context.rootPath,
45
+ config,
46
+ target
47
+ );
48
+ const enableExtractCSS = (0, import_shared.isUseCssExtract)(config, target);
49
+ const enableCssMinify = !enableExtractCSS && isProd;
50
+ const enableSourceMap = (0, import_shared.isUseCssSourceMap)(config);
51
+ const enableCSSModuleTS = Boolean(config.output.enableCssModuleTSDeclaration);
52
+ const extraCSSOptions = typeof config.tools.cssExtract === "object" ? config.tools.cssExtract : {
53
+ loaderOptions: {},
54
+ pluginOptions: {}
55
+ };
56
+ const styleLoaderOptions = (0, import_shared.mergeChainedOptions)(
57
+ {},
58
+ config.tools.styleLoader
59
+ );
60
+ const localIdentName = (0, import_shared.getCssModuleLocalIdentName)(config, isProd);
61
+ const cssLoaderOptions = await (0, import_shared.getCssLoaderOptions)({
62
+ config,
63
+ enableSourceMap,
64
+ importLoaders,
65
+ isServer,
66
+ isWebWorker,
67
+ localIdentName
68
+ });
69
+ if (!isServer && !isWebWorker) {
70
+ if (enableExtractCSS) {
71
+ rule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(require("mini-css-extract-plugin").loader).options(extraCSSOptions.loaderOptions).end();
72
+ } else {
73
+ rule.use(CHAIN_ID.USE.STYLE).loader(require.resolve("style-loader")).options(styleLoaderOptions).end();
74
+ }
75
+ if (enableCSSModuleTS && cssLoaderOptions.modules) {
76
+ rule.use(CHAIN_ID.USE.CSS_MODULES_TS).loader(
77
+ (0, import_shared.resolvePackage)(
78
+ "@rsbuild/shared/css-modules-typescript-loader",
79
+ __dirname
80
+ )
81
+ ).options({
82
+ modules: cssLoaderOptions.modules
83
+ }).end();
84
+ }
85
+ } else {
86
+ rule.use(CHAIN_ID.USE.IGNORE_CSS).loader((0, import_shared.resolvePackage)("@rsbuild/shared/ignore-css-loader", __dirname)).end();
87
+ }
88
+ rule.use(CHAIN_ID.USE.CSS).loader(getCompiledPath("css-loader")).options(cssLoaderOptions).end();
89
+ if (!isServer && !isWebWorker) {
90
+ const postcssLoaderOptions = await (0, import_shared.getPostcssConfig)({
91
+ enableSourceMap,
92
+ browserslist,
93
+ config,
94
+ enableCssMinify
95
+ });
96
+ rule.use(CHAIN_ID.USE.POSTCSS).loader(getCompiledPath("postcss-loader")).options(postcssLoaderOptions).end();
97
+ }
98
+ rule.merge({ sideEffects: true });
99
+ rule.resolve.preferRelative(true);
100
+ }
101
+ const pluginCss = () => {
102
+ return {
103
+ name: "plugin-css",
104
+ setup(api) {
105
+ api.modifyBundlerChain(async (chain, utils) => {
106
+ const rule = chain.module.rule(utils.CHAIN_ID.RULE.CSS);
107
+ const config = api.getNormalizedConfig();
108
+ rule.test(import_shared.CSS_REGEX);
109
+ await applyBaseCSSRule({
110
+ rule,
111
+ utils,
112
+ config,
113
+ context: api.context
114
+ });
115
+ });
116
+ }
117
+ };
118
+ };
119
+ // Annotate the CommonJS export names for ESM import in node:
120
+ 0 && (module.exports = {
121
+ applyBaseCSSRule,
122
+ pluginCss
123
+ });
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginFallback: () => RsbuildPlugin;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var fallback_exports = {};
20
+ __export(fallback_exports, {
21
+ pluginFallback: () => pluginFallback
22
+ });
23
+ module.exports = __toCommonJS(fallback_exports);
24
+ var import_path = require("path");
25
+ var import_shared = require("@rsbuild/shared");
26
+ const pluginFallback = () => ({
27
+ name: "plugin-fallback",
28
+ setup(api) {
29
+ api.modifyWebpackChain((chain, { isProd }) => {
30
+ const rsbuildConfig = api.getNormalizedConfig();
31
+ if (rsbuildConfig.output.enableAssetFallback) {
32
+ const distDir = (0, import_shared.getDistPath)(rsbuildConfig.output, "media");
33
+ const filename = (0, import_shared.getFilename)(rsbuildConfig.output, "media", isProd);
34
+ chain.output.merge({
35
+ assetModuleFilename: (0, import_path.join)(distDir, filename)
36
+ });
37
+ }
38
+ });
39
+ api.modifyWebpackConfig((config) => {
40
+ const rsbuildConfig = api.getNormalizedConfig();
41
+ if (!rsbuildConfig.output.enableAssetFallback || !config.module) {
42
+ return;
43
+ }
44
+ config.module.rules = (0, import_shared.resourceRuleFallback)(config.module.rules);
45
+ });
46
+ }
47
+ });
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ pluginFallback
51
+ });
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginHMR: () => RsbuildPlugin;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var hmr_exports = {};
20
+ __export(hmr_exports, {
21
+ pluginHMR: () => pluginHMR
22
+ });
23
+ module.exports = __toCommonJS(hmr_exports);
24
+ var import_shared = require("@rsbuild/shared");
25
+ const pluginHMR = () => ({
26
+ name: "plugin-hmr",
27
+ setup(api) {
28
+ api.modifyWebpackChain((chain, utils) => {
29
+ const config = api.getNormalizedConfig();
30
+ if (!(0, import_shared.isUsingHMR)(config, utils)) {
31
+ return;
32
+ }
33
+ const { webpack, CHAIN_ID } = utils;
34
+ chain.plugin(CHAIN_ID.PLUGIN.HMR).use(webpack.HotModuleReplacementPlugin);
35
+ });
36
+ }
37
+ });
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ pluginHMR
41
+ });
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginLazyCompilation: () => RsbuildPlugin;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var lazyCompilation_exports = {};
20
+ __export(lazyCompilation_exports, {
21
+ pluginLazyCompilation: () => pluginLazyCompilation
22
+ });
23
+ module.exports = __toCommonJS(lazyCompilation_exports);
24
+ const pluginLazyCompilation = () => ({
25
+ name: "plugin-lazy-compilation",
26
+ setup(api) {
27
+ api.modifyWebpackChain((chain, { isProd, isServer, isWebWorker }) => {
28
+ const config = api.getNormalizedConfig();
29
+ if (isProd || isServer || isWebWorker || !config.experiments.lazyCompilation) {
30
+ return;
31
+ }
32
+ chain.optimization.splitChunks(false);
33
+ chain.experiments({
34
+ ...chain.get("experiments"),
35
+ lazyCompilation: config.experiments.lazyCompilation
36
+ });
37
+ });
38
+ }
39
+ });
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ pluginLazyCompilation
43
+ });
@@ -0,0 +1,6 @@
1
+ import { FileFilterUtil } from '@rsbuild/shared';
2
+ import type { RsbuildPlugin } from '../types';
3
+ export type LessLoaderUtils = {
4
+ addExcludes: FileFilterUtil;
5
+ };
6
+ export declare function pluginLess(): RsbuildPlugin;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var less_exports = {};
30
+ __export(less_exports, {
31
+ pluginLess: () => pluginLess
32
+ });
33
+ module.exports = __toCommonJS(less_exports);
34
+ var import_shared = require("@rsbuild/shared");
35
+ function pluginLess() {
36
+ return {
37
+ name: "plugin-less",
38
+ setup(api) {
39
+ api.modifyBundlerChain(async (chain, utils) => {
40
+ const config = api.getNormalizedConfig();
41
+ const { applyBaseCSSRule } = await Promise.resolve().then(() => __toESM(require("./css")));
42
+ const { options, excludes } = await (0, import_shared.getLessLoaderOptions)(
43
+ config.tools.less,
44
+ (0, import_shared.isUseCssSourceMap)(config)
45
+ );
46
+ const rule = chain.module.rule(utils.CHAIN_ID.RULE.LESS).test(import_shared.LESS_REGEX);
47
+ excludes.forEach((item) => {
48
+ rule.exclude.add(item);
49
+ });
50
+ await applyBaseCSSRule({
51
+ rule,
52
+ utils,
53
+ config,
54
+ context: api.context,
55
+ importLoaders: 2
56
+ });
57
+ rule.use(utils.CHAIN_ID.USE.LESS).loader(utils.getCompiledPath("less-loader")).options(options);
58
+ });
59
+ }
60
+ };
61
+ }
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ pluginLess
65
+ });
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginManifest: () => RsbuildPlugin;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var manifest_exports = {};
30
+ __export(manifest_exports, {
31
+ pluginManifest: () => pluginManifest
32
+ });
33
+ module.exports = __toCommonJS(manifest_exports);
34
+ var import_shared = require("@rsbuild/shared");
35
+ const pluginManifest = () => ({
36
+ name: "plugin-manifest",
37
+ setup(api) {
38
+ api.modifyWebpackChain(async (chain, { CHAIN_ID }) => {
39
+ const config = api.getNormalizedConfig();
40
+ if (!config.output.enableAssetManifest) {
41
+ return;
42
+ }
43
+ const { WebpackManifestPlugin } = await Promise.resolve().then(() => __toESM(require("../../compiled/webpack-manifest-plugin")));
44
+ const publicPath = chain.output.get("publicPath");
45
+ chain.plugin(CHAIN_ID.PLUGIN.MANIFEST).use(WebpackManifestPlugin, [
46
+ {
47
+ fileName: "asset-manifest.json",
48
+ publicPath,
49
+ generate: import_shared.generateManifest
50
+ }
51
+ ]);
52
+ });
53
+ }
54
+ });
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ pluginManifest
58
+ });
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginMinimize: () => RsbuildPlugin;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var minimize_exports = {};
30
+ __export(minimize_exports, {
31
+ pluginMinimize: () => pluginMinimize
32
+ });
33
+ module.exports = __toCommonJS(minimize_exports);
34
+ var import_shared = require("@rsbuild/shared");
35
+ var import_plugin_css_minimizer = require("@rsbuild/plugin-css-minimizer");
36
+ async function applyJSMinimizer(chain, config) {
37
+ const { default: TerserPlugin } = await Promise.resolve().then(() => __toESM(require("terser-webpack-plugin")));
38
+ const finalOptions = await (0, import_shared.getJSMinifyOptions)(config);
39
+ chain.optimization.minimizer(import_shared.CHAIN_ID.MINIMIZER.JS).use(TerserPlugin, [
40
+ // Due to terser-webpack-plugin has changed the type of class, which using a generic type in
41
+ // constructor, leading auto inference of parameters of plugin constructor is not possible, using any instead
42
+ finalOptions
43
+ ]).end();
44
+ }
45
+ const pluginMinimize = () => ({
46
+ name: "plugin-minimize",
47
+ setup(api) {
48
+ api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID: CHAIN_ID2 }) => {
49
+ const config = api.getNormalizedConfig();
50
+ const isMinimize = isProd && !config.output.disableMinimize;
51
+ chain.optimization.minimize(isMinimize);
52
+ if (isMinimize) {
53
+ await applyJSMinimizer(chain, config);
54
+ await (0, import_plugin_css_minimizer.applyCSSMinimizer)(chain, CHAIN_ID2, {
55
+ pluginOptions: config.tools.minifyCss
56
+ });
57
+ }
58
+ });
59
+ }
60
+ });
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ pluginMinimize
64
+ });
@@ -0,0 +1,5 @@
1
+ import { type ChainedConfig } from '@rsbuild/shared';
2
+ import type { RsbuildPlugin, ModuleScopes } from '../types';
3
+ export declare const isPrimitiveScope: (items: unknown[]) => items is (string | RegExp)[];
4
+ export declare const applyScopeChain: (defaults: ModuleScopes, options: ChainedConfig<ModuleScopes>) => ModuleScopes;
5
+ export declare const pluginModuleScopes: () => RsbuildPlugin;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var moduleScopes_exports = {};
30
+ __export(moduleScopes_exports, {
31
+ applyScopeChain: () => applyScopeChain,
32
+ isPrimitiveScope: () => isPrimitiveScope,
33
+ pluginModuleScopes: () => pluginModuleScopes
34
+ });
35
+ module.exports = __toCommonJS(moduleScopes_exports);
36
+ var import_path = __toESM(require("path"));
37
+ var import_shared = require("@rsbuild/shared");
38
+ const isPrimitiveScope = (items) => items.every(
39
+ (item) => typeof item === "string" || Object.prototype.toString.call(item) === "[object RegExp]"
40
+ );
41
+ const applyScopeChain = (defaults, options) => {
42
+ if (Array.isArray(options)) {
43
+ if (isPrimitiveScope(options)) {
44
+ return defaults.concat(options);
45
+ }
46
+ return options.reduce(applyScopeChain, defaults);
47
+ }
48
+ return options(defaults) || defaults;
49
+ };
50
+ const pluginModuleScopes = () => ({
51
+ name: "plugin-module-scopes",
52
+ setup(api) {
53
+ api.modifyWebpackChain(async (chain, { CHAIN_ID }) => {
54
+ const config = api.getNormalizedConfig();
55
+ const scopeOptions = config.source.moduleScopes;
56
+ if (!scopeOptions) {
57
+ return;
58
+ }
59
+ const { ModuleScopePlugin } = await Promise.resolve().then(() => __toESM(require("../webpackPlugins/ModuleScopePlugin")));
60
+ const scopes = applyScopeChain([], scopeOptions);
61
+ const rootPackageJson = import_path.default.resolve(
62
+ api.context.rootPath,
63
+ "./package.json"
64
+ );
65
+ const formattedScopes = scopes.map((scope) => {
66
+ if (typeof scope === "string") {
67
+ return (0, import_shared.ensureAbsolutePath)(api.context.rootPath, scope);
68
+ }
69
+ return scope;
70
+ });
71
+ chain.resolve.plugin(CHAIN_ID.RESOLVE_PLUGIN.MODULE_SCOPE).use(ModuleScopePlugin, [
72
+ {
73
+ scopes: formattedScopes,
74
+ allowedFiles: [rootPackageJson]
75
+ }
76
+ ]);
77
+ });
78
+ }
79
+ });
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ applyScopeChain,
83
+ isPrimitiveScope,
84
+ pluginModuleScopes
85
+ });
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginOutput: () => RsbuildPlugin;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var output_exports = {};
30
+ __export(output_exports, {
31
+ pluginOutput: () => pluginOutput
32
+ });
33
+ module.exports = __toCommonJS(output_exports);
34
+ var import_path = require("path");
35
+ var import_shared = require("@rsbuild/shared");
36
+ const pluginOutput = () => ({
37
+ name: "plugin-output",
38
+ setup(api) {
39
+ (0, import_shared.applyOutputPlugin)(api);
40
+ api.modifyWebpackChain(async (chain, { isProd, target, CHAIN_ID }) => {
41
+ var _a;
42
+ const config = api.getNormalizedConfig();
43
+ const cssPath = (0, import_shared.getDistPath)(config.output, "css");
44
+ if ((0, import_shared.isUseCssExtract)(config, target)) {
45
+ const { default: MiniCssExtractPlugin } = await Promise.resolve().then(() => __toESM(require("mini-css-extract-plugin")));
46
+ const extractPluginOptions = (0, import_shared.mergeChainedOptions)(
47
+ {},
48
+ ((_a = config.tools.cssExtract) == null ? void 0 : _a.pluginOptions) || {}
49
+ );
50
+ const cssFilename = (0, import_shared.getFilename)(config.output, "css", isProd);
51
+ chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(MiniCssExtractPlugin, [
52
+ {
53
+ filename: import_path.posix.join(cssPath, cssFilename),
54
+ chunkFilename: import_path.posix.join(cssPath, `async/${cssFilename}`),
55
+ ignoreOrder: true,
56
+ ...extractPluginOptions
57
+ }
58
+ ]);
59
+ }
60
+ });
61
+ }
62
+ });
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ pluginOutput
66
+ });
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginProgress: () => RsbuildPlugin;