@rsbuild/webpack 0.1.5 → 0.1.7

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 (86) hide show
  1. package/README.md +26 -3
  2. package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bar.js +1 -1
  3. package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bus.js +2 -2
  4. package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/log.js +1 -1
  5. package/dist/core/createCompiler.d.ts +2 -1
  6. package/dist/core/createContext.d.ts +2 -2
  7. package/dist/core/createContext.js +4 -6
  8. package/dist/core/initConfigs.d.ts +2 -1
  9. package/dist/core/initConfigs.js +2 -3
  10. package/dist/core/inspectConfig.d.ts +2 -1
  11. package/dist/core/webpackConfig.d.ts +2 -1
  12. package/dist/index.d.ts +1 -4
  13. package/dist/index.js +0 -3
  14. package/dist/plugins/basic.d.ts +1 -1
  15. package/dist/plugins/copy.d.ts +1 -1
  16. package/dist/plugins/css.d.ts +1 -2
  17. package/dist/plugins/hmr.d.ts +1 -1
  18. package/dist/plugins/less.d.ts +1 -2
  19. package/dist/plugins/minimize.d.ts +1 -1
  20. package/dist/plugins/minimize.js +1 -5
  21. package/dist/plugins/output.d.ts +1 -1
  22. package/dist/plugins/progress.d.ts +1 -1
  23. package/dist/plugins/progress.js +1 -1
  24. package/dist/plugins/resolve.d.ts +1 -1
  25. package/dist/plugins/resolve.js +1 -1
  26. package/dist/plugins/sass.d.ts +1 -1
  27. package/dist/provider.d.ts +2 -4
  28. package/dist/provider.js +9 -17
  29. package/dist/shared.d.ts +3 -0
  30. package/dist/{shared/plugin.js → shared.js} +31 -19
  31. package/dist/types.d.ts +4 -0
  32. package/dist/{types/thirdParty/css.js → types.js} +2 -2
  33. package/package.json +4 -29
  34. package/compiled/babel-plugin-lodash/index.d.ts +0 -1
  35. package/compiled/babel-plugin-lodash/index.js +0 -1
  36. package/compiled/babel-plugin-lodash/license +0 -44
  37. package/compiled/babel-plugin-lodash/package.json +0 -1
  38. package/compiled/babel-plugin-transform-react-remove-prop-types/index.d.ts +0 -1
  39. package/compiled/babel-plugin-transform-react-remove-prop-types/index.js +0 -1
  40. package/compiled/babel-plugin-transform-react-remove-prop-types/license +0 -22
  41. package/compiled/babel-plugin-transform-react-remove-prop-types/package.json +0 -1
  42. package/dist/config/defaults.d.ts +0 -3
  43. package/dist/config/defaults.js +0 -47
  44. package/dist/config/normalize.d.ts +0 -7
  45. package/dist/config/normalize.js +0 -33
  46. package/dist/core/initHooks.d.ts +0 -20
  47. package/dist/core/initHooks.js +0 -46
  48. package/dist/core/initPlugins.d.ts +0 -9
  49. package/dist/core/initPlugins.js +0 -88
  50. package/dist/plugins/babel.d.ts +0 -2
  51. package/dist/plugins/babel.js +0 -157
  52. package/dist/plugins/react.d.ts +0 -2
  53. package/dist/plugins/react.js +0 -103
  54. package/dist/shared/fs.d.ts +0 -1
  55. package/dist/shared/fs.js +0 -48
  56. package/dist/shared/index.d.ts +0 -1
  57. package/dist/shared/index.js +0 -22
  58. package/dist/shared/plugin.d.ts +0 -3
  59. package/dist/types/config/index.d.ts +0 -26
  60. package/dist/types/config/index.js +0 -22
  61. package/dist/types/config/tools.d.ts +0 -42
  62. package/dist/types/config/tools.js +0 -16
  63. package/dist/types/context.d.ts +0 -17
  64. package/dist/types/context.js +0 -16
  65. package/dist/types/index.d.ts +0 -4
  66. package/dist/types/index.js +0 -28
  67. package/dist/types/plugin.d.ts +0 -5
  68. package/dist/types/plugin.js +0 -16
  69. package/dist/types/thirdParty/css.d.ts +0 -7
  70. package/dist/types/thirdParty/index.d.ts +0 -6
  71. package/dist/types/thirdParty/index.js +0 -16
  72. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/ProgressPlugin.d.ts +0 -0
  73. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/ProgressPlugin.js +0 -0
  74. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bar.d.ts +0 -0
  75. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/bus.d.ts +0 -0
  76. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/index.d.ts +0 -0
  77. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/index.js +0 -0
  78. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/log.d.ts +0 -0
  79. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/nonTty.d.ts +0 -0
  80. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/nonTty.js +0 -0
  81. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/percentage.d.ts +0 -0
  82. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/percentage.js +0 -0
  83. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/type.d.ts +0 -0
  84. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/type.js +0 -0
  85. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/utils.d.ts +0 -0
  86. /package/dist/{webpackPlugins/ProgressPlugin → ProgressPlugin}/helpers/utils.js +0 -0
package/dist/shared/fs.js DELETED
@@ -1,48 +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 fs_exports = {};
30
- __export(fs_exports, {
31
- getCompiledPath: () => getCompiledPath
32
- });
33
- module.exports = __toCommonJS(fs_exports);
34
- var import_fs = __toESM(require("fs"));
35
- var import_path = require("path");
36
- var import_shared = require("@rsbuild/shared");
37
- const getCompiledPath = (packageName) => {
38
- const providerCompilerPath = (0, import_path.join)(__dirname, "../../compiled", packageName);
39
- if (import_fs.default.existsSync(providerCompilerPath)) {
40
- return providerCompilerPath;
41
- } else {
42
- return (0, import_shared.getSharedPkgCompiledPath)(packageName);
43
- }
44
- };
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- getCompiledPath
48
- });
@@ -1 +0,0 @@
1
- export * from './fs';
@@ -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 shared_exports = {};
17
- module.exports = __toCommonJS(shared_exports);
18
- __reExport(shared_exports, require("./fs"), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require("./fs")
22
- });
@@ -1,3 +0,0 @@
1
- import { RsbuildPlugin } from '../types';
2
- import { Plugins } from '@rsbuild/shared';
3
- export declare const applyDefaultPlugins: (plugins: Plugins) => import("@rsbuild/shared").AwaitableGetter<RsbuildPlugin>;
@@ -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,17 +0,0 @@
1
- import type { Context as BaseContext } from '@rsbuild/shared';
2
- import type { Hooks } from '../core/initHooks';
3
- import type { RsbuildConfig, NormalizedConfig } from './config';
4
- import type { RsbuildPluginAPI } from './plugin';
5
- /** The inner context. */
6
- export type Context = BaseContext & {
7
- /** All hooks. */
8
- hooks: Readonly<Hooks>;
9
- /** Current Rsbuild config. */
10
- config: Readonly<RsbuildConfig>;
11
- /** The original Rsbuild config passed from the createRsbuild method. */
12
- originalConfig: Readonly<RsbuildConfig>;
13
- /** The normalized Rsbuild config. */
14
- normalizedConfig?: NormalizedConfig;
15
- /** The plugin API. */
16
- pluginAPI?: RsbuildPluginAPI;
17
- };
@@ -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);