@rsbuild/webpack 0.1.4 → 0.1.6

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 (58) hide show
  1. package/README.md +26 -3
  2. package/dist/core/createContext.d.ts +2 -2
  3. package/dist/core/createContext.js +2 -4
  4. package/dist/core/initConfigs.js +0 -1
  5. package/dist/core/initPlugins.d.ts +2 -2
  6. package/dist/core/initPlugins.js +3 -4
  7. package/dist/core/inspectConfig.d.ts +2 -1
  8. package/dist/index.d.ts +1 -3
  9. package/dist/index.js +0 -3
  10. package/dist/plugins/basic.d.ts +1 -1
  11. package/dist/plugins/copy.d.ts +1 -1
  12. package/dist/plugins/css.d.ts +1 -2
  13. package/dist/plugins/hmr.d.ts +1 -1
  14. package/dist/plugins/less.d.ts +1 -2
  15. package/dist/plugins/minimize.d.ts +1 -1
  16. package/dist/plugins/minimize.js +1 -5
  17. package/dist/plugins/output.d.ts +1 -1
  18. package/dist/plugins/progress.d.ts +1 -1
  19. package/dist/plugins/resolve.d.ts +1 -1
  20. package/dist/plugins/resolve.js +1 -1
  21. package/dist/plugins/sass.d.ts +1 -1
  22. package/dist/provider.d.ts +2 -4
  23. package/dist/provider.js +2 -9
  24. package/dist/shared/plugin.d.ts +1 -2
  25. package/dist/shared/plugin.js +2 -3
  26. package/dist/{types/context.d.ts → types.d.ts} +7 -5
  27. package/dist/{types/thirdParty/css.js → types.js} +2 -2
  28. package/package.json +7 -9
  29. package/compiled/babel-plugin-lodash/index.d.ts +0 -1
  30. package/compiled/babel-plugin-lodash/index.js +0 -1
  31. package/compiled/babel-plugin-lodash/license +0 -44
  32. package/compiled/babel-plugin-lodash/package.json +0 -1
  33. package/compiled/babel-plugin-transform-react-remove-prop-types/index.d.ts +0 -1
  34. package/compiled/babel-plugin-transform-react-remove-prop-types/index.js +0 -1
  35. package/compiled/babel-plugin-transform-react-remove-prop-types/license +0 -22
  36. package/compiled/babel-plugin-transform-react-remove-prop-types/package.json +0 -1
  37. package/dist/config/defaults.d.ts +0 -3
  38. package/dist/config/defaults.js +0 -47
  39. package/dist/config/normalize.d.ts +0 -7
  40. package/dist/config/normalize.js +0 -33
  41. package/dist/core/initHooks.d.ts +0 -20
  42. package/dist/core/initHooks.js +0 -46
  43. package/dist/plugins/babel.d.ts +0 -2
  44. package/dist/plugins/babel.js +0 -157
  45. package/dist/plugins/react.d.ts +0 -2
  46. package/dist/plugins/react.js +0 -103
  47. package/dist/types/config/index.d.ts +0 -26
  48. package/dist/types/config/index.js +0 -22
  49. package/dist/types/config/tools.d.ts +0 -42
  50. package/dist/types/config/tools.js +0 -16
  51. package/dist/types/context.js +0 -16
  52. package/dist/types/index.d.ts +0 -4
  53. package/dist/types/index.js +0 -28
  54. package/dist/types/plugin.d.ts +0 -5
  55. package/dist/types/plugin.js +0 -16
  56. package/dist/types/thirdParty/css.d.ts +0 -7
  57. package/dist/types/thirdParty/index.d.ts +0 -6
  58. package/dist/types/thirdParty/index.js +0 -16
@@ -1,33 +0,0 @@
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 normalize_exports = {};
20
- __export(normalize_exports, {
21
- normalizeConfig: () => normalizeConfig
22
- });
23
- module.exports = __toCommonJS(normalize_exports);
24
- var import_shared = require("@rsbuild/shared");
25
- var import_defaults = require("./defaults");
26
- const normalizeConfig = (config) => (0, import_shared.mergeRsbuildConfig)(
27
- (0, import_defaults.createDefaultConfig)(),
28
- config
29
- );
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- normalizeConfig
33
- });
@@ -1,20 +0,0 @@
1
- import { OnExitFn, OnAfterBuildFn, OnBeforeBuildFn, OnDevCompileDoneFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, ModifyRsbuildConfigFn, OnAfterStartDevServerFn, OnBeforeStartDevServerFn, OnAfterStartProdServerFn, OnBeforeStartProdServerFn, OnAfterCreateCompilerFn, OnBeforeCreateCompilerFn } from '@rsbuild/shared';
2
- import type { ModifyBundlerChainFn } from '@rsbuild/shared';
3
- import type { WebpackConfig, RsbuildConfig } from '../types';
4
- export declare function initHooks(): {
5
- onExitHook: import("@rsbuild/shared").AsyncHook<OnExitFn>;
6
- onAfterBuildHook: import("@rsbuild/shared").AsyncHook<OnAfterBuildFn>;
7
- onBeforeBuildHook: import("@rsbuild/shared").AsyncHook<OnBeforeBuildFn<WebpackConfig>>;
8
- onDevCompileDoneHook: import("@rsbuild/shared").AsyncHook<OnDevCompileDoneFn>;
9
- modifyWebpackChainHook: import("@rsbuild/shared").AsyncHook<ModifyWebpackChainFn>;
10
- modifyWebpackConfigHook: import("@rsbuild/shared").AsyncHook<ModifyWebpackConfigFn>;
11
- modifyRsbuildConfigHook: import("@rsbuild/shared").AsyncHook<ModifyRsbuildConfigFn<RsbuildConfig>>;
12
- onAfterCreateCompilerHook: import("@rsbuild/shared").AsyncHook<OnAfterCreateCompilerFn>;
13
- onBeforeCreateCompilerHook: import("@rsbuild/shared").AsyncHook<OnBeforeCreateCompilerFn<WebpackConfig>>;
14
- onAfterStartDevServerHook: import("@rsbuild/shared").AsyncHook<OnAfterStartDevServerFn>;
15
- onBeforeStartDevServerHook: import("@rsbuild/shared").AsyncHook<OnBeforeStartDevServerFn>;
16
- onAfterStartProdServerHook: import("@rsbuild/shared").AsyncHook<OnAfterStartProdServerFn>;
17
- onBeforeStartProdServerHook: import("@rsbuild/shared").AsyncHook<OnBeforeStartProdServerFn>;
18
- modifyBundlerChainHook: import("@rsbuild/shared").AsyncHook<ModifyBundlerChainFn>;
19
- };
20
- export type Hooks = ReturnType<typeof initHooks>;
@@ -1,46 +0,0 @@
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 initHooks_exports = {};
20
- __export(initHooks_exports, {
21
- initHooks: () => initHooks
22
- });
23
- module.exports = __toCommonJS(initHooks_exports);
24
- var import_shared = require("@rsbuild/shared");
25
- function initHooks() {
26
- return {
27
- onExitHook: (0, import_shared.createAsyncHook)(),
28
- onAfterBuildHook: (0, import_shared.createAsyncHook)(),
29
- onBeforeBuildHook: (0, import_shared.createAsyncHook)(),
30
- onDevCompileDoneHook: (0, import_shared.createAsyncHook)(),
31
- modifyWebpackChainHook: (0, import_shared.createAsyncHook)(),
32
- modifyWebpackConfigHook: (0, import_shared.createAsyncHook)(),
33
- modifyRsbuildConfigHook: (0, import_shared.createAsyncHook)(),
34
- onAfterCreateCompilerHook: (0, import_shared.createAsyncHook)(),
35
- onBeforeCreateCompilerHook: (0, import_shared.createAsyncHook)(),
36
- onAfterStartDevServerHook: (0, import_shared.createAsyncHook)(),
37
- onBeforeStartDevServerHook: (0, import_shared.createAsyncHook)(),
38
- onAfterStartProdServerHook: (0, import_shared.createAsyncHook)(),
39
- onBeforeStartProdServerHook: (0, import_shared.createAsyncHook)(),
40
- modifyBundlerChainHook: (0, import_shared.createAsyncHook)()
41
- };
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- initHooks
46
- });
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '../types';
2
- export declare const pluginBabel: () => RsbuildPlugin;
@@ -1,157 +0,0 @@
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 babel_exports = {};
30
- __export(babel_exports, {
31
- pluginBabel: () => pluginBabel
32
- });
33
- module.exports = __toCommonJS(babel_exports);
34
- var import_lodash = __toESM(require("lodash"));
35
- var import_web = require("@rsbuild/babel-preset/web");
36
- var import_node = require("@rsbuild/babel-preset/node");
37
- var import_shared = require("@rsbuild/shared");
38
- var import_plugin_babel = require("@rsbuild/plugin-babel");
39
- var import_shared2 = require("../shared");
40
- const pluginBabel = () => ({
41
- name: "rsbuild-webpack:babel",
42
- setup(api) {
43
- api.modifyBundlerChain(
44
- async (chain, { CHAIN_ID, target, isProd, isServer, isServiceWorker }) => {
45
- const config = api.getNormalizedConfig();
46
- const browserslist = await (0, import_shared.getBrowserslistWithDefault)(
47
- api.context.rootPath,
48
- config,
49
- target
50
- );
51
- const getBabelOptions = (config2) => {
52
- const includes2 = [];
53
- const excludes2 = [];
54
- const babelUtils = {
55
- addIncludes(items) {
56
- if (Array.isArray(items)) {
57
- includes2.push(...items);
58
- } else {
59
- includes2.push(items);
60
- }
61
- },
62
- addExcludes(items) {
63
- if (Array.isArray(items)) {
64
- excludes2.push(...items);
65
- } else {
66
- excludes2.push(items);
67
- }
68
- }
69
- };
70
- const decoratorConfig = {
71
- version: config2.output.enableLatestDecorators ? "2018-09" : "legacy"
72
- };
73
- const baseBabelConfig = isServer || isServiceWorker ? (0, import_node.getBabelConfigForNode)({
74
- pluginDecorators: decoratorConfig
75
- }) : (0, import_web.getBabelConfigForWeb)({
76
- presetEnv: {
77
- targets: browserslist,
78
- useBuiltIns: (0, import_plugin_babel.getUseBuiltIns)(config2)
79
- },
80
- pluginDecorators: decoratorConfig
81
- });
82
- applyPluginImport(baseBabelConfig, config2.source.transformImport);
83
- applyPluginLodash(
84
- baseBabelConfig,
85
- config2.performance.transformLodash
86
- );
87
- const babelConfig = (0, import_shared.mergeChainedOptions)({
88
- defaults: baseBabelConfig,
89
- options: config2.tools.babel,
90
- utils: {
91
- ...(0, import_plugin_babel.getBabelUtils)(baseBabelConfig),
92
- ...babelUtils
93
- }
94
- });
95
- const finalOptions = {
96
- babelrc: false,
97
- configFile: false,
98
- compact: isProd,
99
- ...babelConfig
100
- };
101
- if (config2.output.charset === "utf8") {
102
- finalOptions.generatorOpts = {
103
- jsescOption: { minimal: true }
104
- };
105
- }
106
- return {
107
- babelOptions: finalOptions,
108
- includes: includes2,
109
- excludes: excludes2
110
- };
111
- };
112
- const { babelOptions, includes, excludes } = getBabelOptions(config);
113
- const rule = chain.module.rule(CHAIN_ID.RULE.JS);
114
- (0, import_shared.applyScriptCondition)({
115
- rule,
116
- config,
117
- context: api.context,
118
- includes,
119
- excludes
120
- });
121
- rule.test(import_shared.SCRIPT_REGEX).use(CHAIN_ID.USE.BABEL).loader(require.resolve("babel-loader")).options(babelOptions);
122
- chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
123
- or: ["text/javascript", "application/javascript"]
124
- }).use(CHAIN_ID.USE.BABEL).loader(require.resolve("babel-loader")).options(import_lodash.default.cloneDeep(babelOptions));
125
- (0, import_shared.addCoreJsEntry)({ chain, config, isServer, isServiceWorker });
126
- }
127
- );
128
- }
129
- });
130
- function applyPluginLodash(config, transformLodash) {
131
- if (transformLodash) {
132
- config.plugins?.push([(0, import_shared2.getCompiledPath)("babel-plugin-lodash"), {}]);
133
- }
134
- }
135
- function applyPluginImport(config, pluginImport) {
136
- if (pluginImport !== false && pluginImport) {
137
- for (const item of pluginImport) {
138
- const name = item.libraryName;
139
- const option = {
140
- ...item
141
- };
142
- if (option.camelToDashComponentName !== void 0 || option.camel2DashComponentName !== void 0) {
143
- option.camel2DashComponentName = option.camel2DashComponentName ?? option.camelToDashComponentName;
144
- delete option.camelToDashComponentName;
145
- }
146
- config.plugins?.push([
147
- require.resolve("babel-plugin-import"),
148
- option,
149
- name
150
- ]);
151
- }
152
- }
153
- }
154
- // Annotate the CommonJS export names for ESM import in node:
155
- 0 && (module.exports = {
156
- pluginBabel
157
- });
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '../types';
2
- export declare const pluginReactWebpack: () => RsbuildPlugin;
@@ -1,103 +0,0 @@
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 react_exports = {};
30
- __export(react_exports, {
31
- pluginReactWebpack: () => pluginReactWebpack
32
- });
33
- module.exports = __toCommonJS(react_exports);
34
- var import_plugin_react = require("@rsbuild/plugin-react");
35
- var import_shared = require("@rsbuild/shared");
36
- const pluginReactWebpack = () => ({
37
- name: "rsbuild-webpack:react",
38
- pre: ["rsbuild-webpack:babel"],
39
- setup(api) {
40
- api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {
41
- const isNewJsx = await (0, import_plugin_react.isBeyondReact17)(api.context.rootPath);
42
- const babelConfig = {
43
- tools: {
44
- babel(_, { addPresets, addPlugins }) {
45
- const presetReactOptions = {
46
- development: !(0, import_shared.isProd)(),
47
- // Will use the native built-in instead of trying to polyfill
48
- useBuiltIns: true,
49
- useSpread: false,
50
- runtime: isNewJsx ? "automatic" : "classic"
51
- };
52
- addPresets([
53
- [require.resolve("@babel/preset-react"), presetReactOptions]
54
- ]);
55
- if ((0, import_shared.isProd)()) {
56
- addPlugins([
57
- [
58
- require.resolve("babel-plugin-transform-react-remove-prop-types"),
59
- { removeImport: true }
60
- ]
61
- ]);
62
- }
63
- }
64
- }
65
- };
66
- return mergeRsbuildConfig(babelConfig, config);
67
- });
68
- api.modifyBundlerChain(async (chain, utils) => {
69
- const config = api.getNormalizedConfig();
70
- if (!(0, import_shared.isUsingHMR)(config, utils)) {
71
- return;
72
- }
73
- const { CHAIN_ID } = utils;
74
- const { default: ReactFastRefreshPlugin } = await Promise.resolve().then(() => __toESM(require("@pmmmwh/react-refresh-webpack-plugin")));
75
- [CHAIN_ID.RULE.TS, CHAIN_ID.RULE.JS].forEach((ruleId) => {
76
- if (!chain.module.rules.get(ruleId)) {
77
- return;
78
- }
79
- const rule = chain.module.rule(ruleId);
80
- if (!rule.uses.get(CHAIN_ID.USE.BABEL)) {
81
- return;
82
- }
83
- rule.use(CHAIN_ID.USE.BABEL).tap((options) => ({
84
- ...options,
85
- plugins: [
86
- ...options.plugins || [],
87
- [require.resolve("react-refresh/babel"), { skipEnvCheck: true }]
88
- ]
89
- }));
90
- });
91
- chain.plugin(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH).use(ReactFastRefreshPlugin, [
92
- {
93
- overlay: false,
94
- exclude: [/node_modules/]
95
- }
96
- ]);
97
- });
98
- }
99
- });
100
- // Annotate the CommonJS export names for ESM import in node:
101
- 0 && (module.exports = {
102
- pluginReactWebpack
103
- });
@@ -1,26 +0,0 @@
1
- import type { DeepReadonly } from '@rsbuild/shared';
2
- import type { NormalizedToolsConfig, ToolsConfig } from './tools';
3
- import type { DevConfig, ServerConfig, HtmlConfig, SourceConfig, OutputConfig, SecurityConfig, PerformanceConfig, NormalizedDevConfig, NormalizedServerConfig, NormalizedHtmlConfig, NormalizedSourceConfig, NormalizedOutputConfig, NormalizedSecurityConfig, NormalizedPerformanceConfig } from '@rsbuild/shared';
4
- export type { DevConfig, HtmlConfig, SourceConfig, OutputConfig, SecurityConfig, PerformanceConfig, NormalizedDevConfig, NormalizedHtmlConfig, NormalizedSourceConfig, NormalizedOutputConfig, NormalizedSecurityConfig, NormalizedPerformanceConfig };
5
- export * from './tools';
6
- /** The Rsbuild config when using Webpack as the bundler */
7
- export interface RsbuildConfig {
8
- dev?: DevConfig;
9
- server?: ServerConfig;
10
- html?: HtmlConfig;
11
- tools?: ToolsConfig;
12
- source?: SourceConfig;
13
- output?: OutputConfig;
14
- security?: SecurityConfig;
15
- performance?: PerformanceConfig;
16
- }
17
- export type NormalizedConfig = DeepReadonly<{
18
- dev: NormalizedDevConfig;
19
- server: NormalizedServerConfig;
20
- html: NormalizedHtmlConfig;
21
- tools: NormalizedToolsConfig;
22
- source: NormalizedSourceConfig;
23
- output: NormalizedOutputConfig;
24
- security: NormalizedSecurityConfig;
25
- performance: NormalizedPerformanceConfig;
26
- }>;
@@ -1,22 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var config_exports = {};
17
- module.exports = __toCommonJS(config_exports);
18
- __reExport(config_exports, require("./tools"), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require("./tools")
22
- });
@@ -1,42 +0,0 @@
1
- import type { ArrayOrNot, ChainedConfig, TerserPluginOptions, ToolsConfig as BaseToolsConfig, ChainedConfigWithUtils, ModifyWebpackChainUtils, ModifyWebpackConfigUtils } from '@rsbuild/shared';
2
- import type { BabelTransformOptions, BabelConfigUtils } from '@rsbuild/plugin-babel';
3
- import type { PluginCssMinimizerOptions } from '@rsbuild/plugin-css-minimizer';
4
- import type { WebpackChain, WebpackConfig, CSSExtractOptions } from '../thirdParty';
5
- import type { NormalizedCSSExtractOptions } from '../thirdParty/css';
6
- export type ToolsTerserConfig = ChainedConfig<TerserPluginOptions>;
7
- export type ToolsCssExtractConfig = CSSExtractOptions | ((options: CSSExtractOptions) => CSSExtractOptions | void);
8
- export type ToolsWebpackConfig = ChainedConfigWithUtils<WebpackConfig, ModifyWebpackConfigUtils>;
9
- export type ToolsWebpackChainConfig = ArrayOrNot<(chain: WebpackChain, utils: ModifyWebpackChainUtils) => void>;
10
- export type ToolsBabelConfig = ChainedConfigWithUtils<BabelTransformOptions, BabelConfigUtils>;
11
- export interface ToolsConfig extends BaseToolsConfig {
12
- /**
13
- * Modify the options of [babel-loader](https://github.com/babel/babel-loader)
14
- * When `tools.babel`'s type is Function,the default babel config will be passed in as the first parameter, the config object can be modified directly, or a value can be returned as the final result.
15
- * When `tools.babel`'s type is `Object`, the config will be shallow merged with default config by `Object.assign`.
16
- * Note that `Object.assign` is a shallow copy and will completely overwrite the built-in `presets` or `plugins` array, please use it with caution.
17
- */
18
- babel?: ToolsBabelConfig;
19
- /**
20
- * Modify the options of [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin).
21
- */
22
- terser?: ToolsTerserConfig;
23
- /**
24
- * Modify the options of [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin).
25
- */
26
- cssExtract?: CSSExtractOptions;
27
- /**
28
- * Configure [webpack](https://webpack.js.org/).
29
- */
30
- webpack?: ToolsWebpackConfig;
31
- /**
32
- * Configure webpack by [webpack-chain](https://github.com/neutrinojs/webpack-chain).
33
- */
34
- webpackChain?: ToolsWebpackChainConfig;
35
- /**
36
- * Modify the options of [css-minimizer-webpack-plugin](https://github.com/webpack-contrib/css-minimizer-webpack-plugin).
37
- */
38
- minifyCss?: PluginCssMinimizerOptions['pluginOptions'];
39
- }
40
- export interface NormalizedToolsConfig extends ToolsConfig {
41
- cssExtract: NormalizedCSSExtractOptions;
42
- }
@@ -1,16 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var tools_exports = {};
16
- module.exports = __toCommonJS(tools_exports);
@@ -1,16 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var context_exports = {};
16
- module.exports = __toCommonJS(context_exports);
@@ -1,4 +0,0 @@
1
- export * from './config';
2
- export * from './plugin';
3
- export * from './context';
4
- export * from './thirdParty';
@@ -1,28 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var types_exports = {};
17
- module.exports = __toCommonJS(types_exports);
18
- __reExport(types_exports, require("./config"), module.exports);
19
- __reExport(types_exports, require("./plugin"), module.exports);
20
- __reExport(types_exports, require("./context"), module.exports);
21
- __reExport(types_exports, require("./thirdParty"), module.exports);
22
- // Annotate the CommonJS export names for ESM import in node:
23
- 0 && (module.exports = {
24
- ...require("./config"),
25
- ...require("./plugin"),
26
- ...require("./context"),
27
- ...require("./thirdParty")
28
- });
@@ -1,5 +0,0 @@
1
- import type { DefaultRsbuildPluginAPI, RsbuildPlugin as BaseRsbuildPlugin } from '@rsbuild/shared';
2
- import type { RsbuildConfig, NormalizedConfig } from './config';
3
- import type { WebpackConfig } from './thirdParty';
4
- export interface RsbuildPluginAPI extends DefaultRsbuildPluginAPI<RsbuildConfig, NormalizedConfig, WebpackConfig> {}
5
- export type RsbuildPlugin = BaseRsbuildPlugin<RsbuildPluginAPI>;
@@ -1,16 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var plugin_exports = {};
16
- module.exports = __toCommonJS(plugin_exports);
@@ -1,7 +0,0 @@
1
- import type { PluginOptions as MiniCSSExtractPluginOptions, LoaderOptions as MiniCSSExtractLoaderOptions } from 'mini-css-extract-plugin';
2
- export { MiniCSSExtractPluginOptions, MiniCSSExtractLoaderOptions };
3
- export interface CSSExtractOptions {
4
- pluginOptions?: MiniCSSExtractPluginOptions;
5
- loaderOptions?: MiniCSSExtractLoaderOptions;
6
- }
7
- export type NormalizedCSSExtractOptions = Required<CSSExtractOptions>;
@@ -1,6 +0,0 @@
1
- import type { WebpackChain } from '@rsbuild/shared';
2
- import type webpack from 'webpack';
3
- import type { Configuration as WebpackConfig } from 'webpack';
4
- export type { Options as HTMLPluginOptions } from 'html-webpack-plugin';
5
- export type { webpack, WebpackChain, WebpackConfig };
6
- export type { CSSExtractOptions, MiniCSSExtractPluginOptions, MiniCSSExtractLoaderOptions } from './css';
@@ -1,16 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var thirdParty_exports = {};
16
- module.exports = __toCommonJS(thirdParty_exports);