@rsbuild/webpack 0.6.14 → 0.7.0-beta.0

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 (55) hide show
  1. package/dist/index.cjs +2675 -0
  2. package/dist/index.js +2748 -11
  3. package/package.json +12 -14
  4. package/compiled/ansi-escapes/index.d.ts +0 -248
  5. package/compiled/ansi-escapes/index.js +0 -1
  6. package/compiled/ansi-escapes/license +0 -9
  7. package/compiled/ansi-escapes/package.json +0 -1
  8. package/compiled/ansi-escapes/type-fest/index.d.ts +0 -2
  9. package/compiled/cli-truncate/index.d.ts +0 -96
  10. package/compiled/cli-truncate/index.js +0 -1
  11. package/compiled/cli-truncate/license +0 -9
  12. package/compiled/cli-truncate/package.json +0 -1
  13. package/compiled/copy-webpack-plugin/index.d.ts +0 -1
  14. package/compiled/copy-webpack-plugin/index.js +0 -22
  15. package/compiled/copy-webpack-plugin/license +0 -20
  16. package/compiled/copy-webpack-plugin/package.json +0 -1
  17. package/compiled/patch-console/build/index.d.ts +0 -4
  18. package/compiled/patch-console/index.js +0 -1
  19. package/compiled/patch-console/package.json +0 -1
  20. package/compiled/schema-utils3/index.d.ts +0 -1
  21. package/compiled/schema-utils3/index.js +0 -3
  22. package/compiled/schema-utils3/license +0 -20
  23. package/compiled/schema-utils3/package.json +0 -1
  24. package/compiled/tapable/index.js +0 -1
  25. package/compiled/tapable/license +0 -21
  26. package/compiled/tapable/package.json +0 -1
  27. package/compiled/tapable/tapable.d.ts +0 -116
  28. package/dist/build.js +0 -90
  29. package/dist/createCompiler.js +0 -96
  30. package/dist/initConfigs.js +0 -65
  31. package/dist/inspectConfig.js +0 -85
  32. package/dist/plugins/copy.js +0 -68
  33. package/dist/plugins/css.d.ts +0 -9
  34. package/dist/plugins/css.js +0 -109
  35. package/dist/plugins/less.d.ts +0 -5
  36. package/dist/plugins/less.js +0 -66
  37. package/dist/plugins/output.d.ts +0 -2
  38. package/dist/plugins/output.js +0 -66
  39. package/dist/plugins/progress.js +0 -57
  40. package/dist/plugins/resolve.js +0 -83
  41. package/dist/plugins/sass.d.ts +0 -2
  42. package/dist/plugins/sass.js +0 -76
  43. package/dist/progress/ProgressPlugin.js +0 -110
  44. package/dist/progress/helpers/bar.js +0 -142
  45. package/dist/progress/helpers/bus.js +0 -109
  46. package/dist/progress/helpers/index.js +0 -28
  47. package/dist/progress/helpers/log.js +0 -62
  48. package/dist/progress/helpers/nonTty.js +0 -56
  49. package/dist/progress/helpers/percentage.js +0 -52
  50. package/dist/progress/helpers/type.js +0 -16
  51. package/dist/progress/helpers/utils.js +0 -30
  52. package/dist/provider.js +0 -159
  53. package/dist/shared.js +0 -47
  54. package/dist/types.js +0 -16
  55. package/dist/webpackConfig.js +0 -165
@@ -1,109 +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 css_exports = {};
20
- __export(css_exports, {
21
- applyBaseCSSRule: () => applyBaseCSSRule,
22
- pluginCss: () => pluginCss
23
- });
24
- module.exports = __toCommonJS(css_exports);
25
- var import_shared = require("@rsbuild/shared");
26
- async function applyBaseCSSRule({
27
- rule,
28
- config,
29
- context,
30
- utils: { target, isProd, isServer, CHAIN_ID, isWebWorker },
31
- importLoaders = 1
32
- }) {
33
- const browserslist = await (0, import_shared.getBrowserslistWithDefault)(
34
- context.rootPath,
35
- config,
36
- target
37
- );
38
- const enableExtractCSS = (0, import_shared.isUseCssExtract)(config, target);
39
- const enableCSSModuleTS = Boolean(config.output.enableCssModuleTSDeclaration);
40
- const localIdentName = (0, import_shared.getCssModuleLocalIdentName)(config, isProd);
41
- const cssLoaderOptions = (0, import_shared.getCssLoaderOptions)({
42
- config,
43
- importLoaders,
44
- isServer,
45
- isWebWorker,
46
- localIdentName
47
- });
48
- if (!isServer && !isWebWorker) {
49
- if (enableExtractCSS) {
50
- const extraCSSOptions = typeof config.tools.cssExtract === "object" ? config.tools.cssExtract : {
51
- loaderOptions: {},
52
- pluginOptions: {}
53
- };
54
- rule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(require("mini-css-extract-plugin").loader).options(extraCSSOptions.loaderOptions).end();
55
- } else {
56
- const styleLoaderOptions = (0, import_shared.mergeChainedOptions)({
57
- defaults: {},
58
- options: config.tools.styleLoader
59
- });
60
- rule.use(CHAIN_ID.USE.STYLE).loader((0, import_shared.getSharedPkgCompiledPath)("style-loader")).options(styleLoaderOptions).end();
61
- }
62
- if (enableCSSModuleTS && cssLoaderOptions.modules) {
63
- rule.use(CHAIN_ID.USE.CSS_MODULES_TS).loader(
64
- (0, import_shared.resolvePackage)(
65
- "@rsbuild/shared/css-modules-typescript-loader",
66
- __dirname
67
- )
68
- ).options({
69
- modules: cssLoaderOptions.modules
70
- }).end();
71
- }
72
- } else {
73
- rule.use(CHAIN_ID.USE.IGNORE_CSS).loader((0, import_shared.resolvePackage)("@rsbuild/shared/ignore-css-loader", __dirname)).end();
74
- }
75
- rule.use(CHAIN_ID.USE.CSS).loader((0, import_shared.getSharedPkgCompiledPath)("css-loader")).options(cssLoaderOptions).end();
76
- if (!isServer && !isWebWorker) {
77
- const postcssLoaderOptions = await (0, import_shared.getPostcssLoaderOptions)({
78
- browserslist,
79
- config,
80
- root: context.rootPath
81
- });
82
- rule.use(CHAIN_ID.USE.POSTCSS).loader((0, import_shared.getSharedPkgCompiledPath)("postcss-loader")).options(postcssLoaderOptions).end();
83
- }
84
- rule.merge({ sideEffects: true });
85
- rule.resolve.preferRelative(true);
86
- }
87
- const pluginCss = () => {
88
- return {
89
- name: "rsbuild-webpack:css",
90
- setup(api) {
91
- api.modifyBundlerChain(async (chain, utils) => {
92
- const rule = chain.module.rule(utils.CHAIN_ID.RULE.CSS);
93
- const config = api.getNormalizedConfig();
94
- rule.test(import_shared.CSS_REGEX);
95
- await applyBaseCSSRule({
96
- rule,
97
- utils,
98
- config,
99
- context: api.context
100
- });
101
- });
102
- }
103
- };
104
- };
105
- // Annotate the CommonJS export names for ESM import in node:
106
- 0 && (module.exports = {
107
- applyBaseCSSRule,
108
- pluginCss
109
- });
@@ -1,5 +0,0 @@
1
- import { type FileFilterUtil, type RsbuildPlugin } from '@rsbuild/shared';
2
- export type LessLoaderUtils = {
3
- addExcludes: FileFilterUtil;
4
- };
5
- export declare function pluginLess(): RsbuildPlugin;
@@ -1,66 +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 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: "rsbuild-webpack: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 } = (0, import_shared.getLessLoaderOptions)(
43
- config.tools.less,
44
- config.output.sourceMap.css,
45
- api.context.rootPath
46
- );
47
- const rule = chain.module.rule(utils.CHAIN_ID.RULE.LESS).test(import_shared.LESS_REGEX);
48
- for (const item of excludes) {
49
- rule.exclude.add(item);
50
- }
51
- await applyBaseCSSRule({
52
- rule,
53
- utils,
54
- config,
55
- context: api.context,
56
- importLoaders: 2
57
- });
58
- rule.use(utils.CHAIN_ID.USE.LESS).loader((0, import_shared.getSharedPkgCompiledPath)("less-loader")).options(options);
59
- });
60
- }
61
- };
62
- }
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- pluginLess
66
- });
@@ -1,2 +0,0 @@
1
- import { type RsbuildPlugin } from '@rsbuild/shared';
2
- export declare const pluginOutput: () => RsbuildPlugin;
@@ -1,66 +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 output_exports = {};
30
- __export(output_exports, {
31
- pluginOutput: () => pluginOutput
32
- });
33
- module.exports = __toCommonJS(output_exports);
34
- var import_node_path = require("node:path");
35
- var import_shared = require("@rsbuild/shared");
36
- const pluginOutput = () => ({
37
- name: "rsbuild-webpack:output",
38
- setup(api) {
39
- (0, import_shared.applyOutputPlugin)(api);
40
- api.modifyBundlerChain(async (chain, { isProd, target, CHAIN_ID }) => {
41
- const config = api.getNormalizedConfig();
42
- if ((0, import_shared.isUseCssExtract)(config, target)) {
43
- const { default: MiniCssExtractPlugin } = await Promise.resolve().then(() => __toESM(require("mini-css-extract-plugin")));
44
- const extractPluginOptions = (0, import_shared.mergeChainedOptions)({
45
- defaults: {},
46
- options: config.tools.cssExtract?.pluginOptions
47
- });
48
- const cssPath = (0, import_shared.getDistPath)(config, "css");
49
- const cssAsyncPath = (0, import_shared.getDistPath)(config, "cssAsync");
50
- const cssFilename = (0, import_shared.getFilename)(config, "css", isProd);
51
- chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(MiniCssExtractPlugin, [
52
- {
53
- filename: import_node_path.posix.join(cssPath, cssFilename),
54
- chunkFilename: import_node_path.posix.join(cssAsyncPath, 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
- });
@@ -1,57 +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 progress_exports = {};
30
- __export(progress_exports, {
31
- pluginProgress: () => pluginProgress
32
- });
33
- module.exports = __toCommonJS(progress_exports);
34
- var import_shared = require("@rsbuild/shared");
35
- const pluginProgress = () => ({
36
- name: "rsbuild-webpack:progress",
37
- setup(api) {
38
- api.modifyBundlerChain(async (chain, { target, CHAIN_ID }) => {
39
- const config = api.getNormalizedConfig();
40
- const options = config.dev.progressBar ?? true;
41
- if (!options) {
42
- return;
43
- }
44
- const { ProgressPlugin } = await Promise.resolve().then(() => __toESM(require("../progress/ProgressPlugin")));
45
- chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
46
- {
47
- id: import_shared.TARGET_ID_MAP[target],
48
- ...options === true ? {} : options
49
- }
50
- ]);
51
- });
52
- }
53
- });
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- pluginProgress
57
- });
@@ -1,83 +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 resolve_exports = {};
30
- __export(resolve_exports, {
31
- pluginResolve: () => pluginResolve
32
- });
33
- module.exports = __toCommonJS(resolve_exports);
34
- var import_shared = require("@rsbuild/shared");
35
- async function applyTsConfigPathsPlugin({
36
- chain,
37
- CHAIN_ID,
38
- mainFields,
39
- extensions,
40
- configFile
41
- }) {
42
- const { TsconfigPathsPlugin } = await Promise.resolve().then(() => __toESM(require("tsconfig-paths-webpack-plugin")));
43
- chain.resolve.plugin(CHAIN_ID.RESOLVE_PLUGIN.TS_CONFIG_PATHS).use(TsconfigPathsPlugin, [
44
- {
45
- configFile,
46
- extensions,
47
- // https://github.com/dividab/tsconfig-paths-webpack-plugin/pull/106
48
- mainFields
49
- }
50
- ]);
51
- }
52
- const getMainFields = (chain, target) => {
53
- const mainFields = chain.resolve.mainFields.values();
54
- if (mainFields.length) {
55
- return mainFields;
56
- }
57
- if ((0, import_shared.isWebTarget)(target)) {
58
- return ["browser", "module", "main"];
59
- }
60
- return ["module", "main"];
61
- };
62
- const pluginResolve = () => ({
63
- name: "rsbuild-webpack:resolve",
64
- setup(api) {
65
- (0, import_shared.applyResolvePlugin)(api);
66
- api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {
67
- const config = api.getNormalizedConfig();
68
- if (api.context.tsconfigPath && config.source.aliasStrategy === "prefer-tsconfig") {
69
- await applyTsConfigPathsPlugin({
70
- chain,
71
- CHAIN_ID,
72
- configFile: api.context.tsconfigPath,
73
- mainFields: getMainFields(chain, target),
74
- extensions: chain.resolve.extensions.values()
75
- });
76
- }
77
- });
78
- }
79
- });
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- pluginResolve
83
- });
@@ -1,2 +0,0 @@
1
- import { type RsbuildPlugin } from '@rsbuild/shared';
2
- export declare function pluginSass(): RsbuildPlugin;
@@ -1,76 +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 sass_exports = {};
30
- __export(sass_exports, {
31
- pluginSass: () => pluginSass
32
- });
33
- module.exports = __toCommonJS(sass_exports);
34
- var import_shared = require("@rsbuild/shared");
35
- function pluginSass() {
36
- return {
37
- name: "rsbuild-webpack:sass",
38
- setup(api) {
39
- api.onAfterCreateCompiler(({ compiler }) => {
40
- (0, import_shared.patchCompilerGlobalLocation)(compiler);
41
- });
42
- api.modifyBundlerChain(async (chain, utils) => {
43
- const config = api.getNormalizedConfig();
44
- const { applyBaseCSSRule } = await Promise.resolve().then(() => __toESM(require("./css")));
45
- const { options, excludes } = (0, import_shared.getSassLoaderOptions)(
46
- config.tools.sass,
47
- // source-maps required for loaders preceding resolve-url-loader
48
- true
49
- );
50
- const rule = chain.module.rule(utils.CHAIN_ID.RULE.SASS).test(import_shared.SASS_REGEX);
51
- for (const item of excludes) {
52
- rule.exclude.add(item);
53
- }
54
- await applyBaseCSSRule({
55
- rule,
56
- utils,
57
- config,
58
- context: api.context,
59
- // postcss-loader, resolve-url-loader, sass-loader
60
- importLoaders: 3
61
- });
62
- rule.use(utils.CHAIN_ID.USE.RESOLVE_URL).loader((0, import_shared.getSharedPkgCompiledPath)("resolve-url-loader")).options({
63
- join: await (0, import_shared.getResolveUrlJoinFn)(),
64
- // 'resolve-url-loader' relies on 'adjust-sourcemap-loader',
65
- // it has performance regression issues in some scenarios,
66
- // so we need to disable the sourceMap option.
67
- sourceMap: false
68
- }).end().use(utils.CHAIN_ID.USE.SASS).loader((0, import_shared.getSharedPkgCompiledPath)("sass-loader")).options(options);
69
- });
70
- }
71
- };
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- pluginSass
76
- });
@@ -1,110 +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 __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var __publicField = (obj, key, value) => {
31
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
- return value;
33
- };
34
- var ProgressPlugin_exports = {};
35
- __export(ProgressPlugin_exports, {
36
- ProgressPlugin: () => ProgressPlugin
37
- });
38
- module.exports = __toCommonJS(ProgressPlugin_exports);
39
- var import_shared = require("@rsbuild/shared");
40
- var import_webpack = __toESM(require("webpack"));
41
- var import_helpers = require("./helpers");
42
- var import_nonTty = require("./helpers/nonTty");
43
- class ProgressPlugin extends import_webpack.default.ProgressPlugin {
44
- constructor(options) {
45
- const { id = "Rsbuild" } = options;
46
- const nonTTYLogger = (0, import_nonTty.createNonTTYLogger)();
47
- const friendlyPercentage = (0, import_helpers.createFriendlyPercentage)();
48
- super({
49
- activeModules: false,
50
- entries: true,
51
- modules: true,
52
- modulesCount: 5e3,
53
- profile: false,
54
- dependencies: true,
55
- dependenciesCount: 1e4,
56
- percentBy: null,
57
- handler: (originalPercentage, message) => {
58
- const percentage = friendlyPercentage(originalPercentage);
59
- const done = percentage === 1;
60
- if (process.stdout.isTTY) {
61
- import_helpers.bus.update({
62
- id,
63
- current: percentage * 100,
64
- message,
65
- done,
66
- hasErrors: this.hasCompileErrors
67
- });
68
- import_helpers.bus.render();
69
- } else {
70
- nonTTYLogger.log({
71
- id,
72
- done,
73
- current: percentage * 100,
74
- hasErrors: this.hasCompileErrors,
75
- compileTime: this.compileTime
76
- });
77
- }
78
- }
79
- });
80
- __publicField(this, "name", "ProgressPlugin");
81
- __publicField(this, "id");
82
- __publicField(this, "hasCompileErrors", false);
83
- __publicField(this, "compileTime", null);
84
- this.id = id;
85
- }
86
- apply(compiler) {
87
- super.apply(compiler);
88
- let startTime = null;
89
- compiler.hooks.compile.tap(this.name, () => {
90
- this.compileTime = null;
91
- startTime = process.hrtime();
92
- });
93
- compiler.hooks.done.tap(this.name, (stat) => {
94
- if (startTime) {
95
- this.hasCompileErrors = stat.hasErrors();
96
- const hrtime = process.hrtime(startTime);
97
- const seconds = hrtime[0] + hrtime[1] / 1e9;
98
- this.compileTime = (0, import_shared.prettyTime)(seconds);
99
- startTime = null;
100
- if (!this.hasCompileErrors) {
101
- import_shared.logger.ready(`${this.id} compiled in ${this.compileTime}`);
102
- }
103
- }
104
- });
105
- }
106
- }
107
- // Annotate the CommonJS export names for ESM import in node:
108
- 0 && (module.exports = {
109
- ProgressPlugin
110
- });