@rsbuild/core 0.6.15 → 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 (87) hide show
  1. package/compiled/css-loader/api.js +85 -0
  2. package/compiled/css-loader/getUrl.js +26 -0
  3. package/compiled/css-loader/index.d.ts +1 -0
  4. package/compiled/css-loader/index.js +2187 -0
  5. package/compiled/css-loader/license +20 -0
  6. package/compiled/css-loader/noSourceMaps.js +5 -0
  7. package/compiled/css-loader/package.json +1 -0
  8. package/compiled/css-loader/sourceMaps.js +16 -0
  9. package/compiled/less-loader/index.d.ts +1 -0
  10. package/compiled/less-loader/index.js +414 -0
  11. package/compiled/less-loader/license +20 -0
  12. package/compiled/less-loader/package.json +1 -0
  13. package/compiled/postcss-load-config/292.index.js +2533 -0
  14. package/compiled/postcss-load-config/344.index.js +21 -0
  15. package/compiled/postcss-load-config/index.d.ts +1 -0
  16. package/compiled/postcss-load-config/index.js +1201 -0
  17. package/compiled/postcss-load-config/license +20 -0
  18. package/compiled/postcss-load-config/package.json +1 -0
  19. package/compiled/postcss-loader/index.d.ts +1 -0
  20. package/compiled/postcss-loader/index.js +200173 -0
  21. package/compiled/postcss-loader/license +20 -0
  22. package/compiled/postcss-loader/package.json +1 -0
  23. package/compiled/postcss-value-parser/index.d.ts +1 -0
  24. package/compiled/postcss-value-parser/index.js +624 -0
  25. package/compiled/postcss-value-parser/license +22 -0
  26. package/compiled/postcss-value-parser/package.json +1 -0
  27. package/compiled/resolve-url-loader/index.d.ts +1 -0
  28. package/compiled/resolve-url-loader/index.js +5719 -0
  29. package/compiled/resolve-url-loader/license +21 -0
  30. package/compiled/resolve-url-loader/package.json +1 -0
  31. package/compiled/style-loader/index.d.ts +1 -0
  32. package/compiled/style-loader/index.js +513 -0
  33. package/compiled/style-loader/license +20 -0
  34. package/compiled/style-loader/package.json +1 -0
  35. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  36. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  37. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  38. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  39. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  40. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  41. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  42. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  43. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  44. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  45. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  46. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  47. package/dist/cli/commands.js +1 -1
  48. package/dist/cli/prepare.js +1 -1
  49. package/dist/config.js +0 -1
  50. package/dist/createContext.js +1 -1
  51. package/dist/index.js +1 -1
  52. package/dist/internal.d.ts +2 -2
  53. package/dist/internal.js +8 -8
  54. package/dist/{htmlUtils.d.ts → pluginHelper.d.ts} +4 -1
  55. package/dist/pluginHelper.js +66 -0
  56. package/dist/plugins/css.d.ts +19 -0
  57. package/dist/plugins/css.js +257 -0
  58. package/dist/plugins/index.d.ts +4 -0
  59. package/dist/plugins/index.js +4 -0
  60. package/dist/{provider/plugins → plugins}/less.d.ts +1 -1
  61. package/dist/{provider/plugins → plugins}/less.js +45 -10
  62. package/dist/{provider/plugins → plugins}/output.d.ts +1 -1
  63. package/dist/{provider/plugins → plugins}/output.js +21 -14
  64. package/dist/plugins/performance.js +5 -11
  65. package/dist/plugins/resourceHints.js +17 -22
  66. package/dist/plugins/sass.d.ts +18 -0
  67. package/dist/{provider/plugins → plugins}/sass.js +83 -12
  68. package/dist/provider/plugins/swc.d.ts +0 -2
  69. package/dist/provider/plugins/swc.js +1 -3
  70. package/dist/provider/provider.js +4 -4
  71. package/dist/provider/rspackConfig.js +2 -2
  72. package/dist/rspack/HtmlAppIconPlugin.js +2 -2
  73. package/dist/rspack/HtmlBasicPlugin.js +2 -2
  74. package/dist/rspack/InlineChunkHtmlPlugin.js +2 -2
  75. package/dist/rspack/ignoreCssLoader.d.ts +2 -0
  76. package/dist/{htmlUtils.js → rspack/ignoreCssLoader.js} +10 -21
  77. package/dist/rspack/preload/HtmlPreloadOrPrefetchPlugin.js +3 -3
  78. package/package.json +12 -3
  79. package/dist/provider/css-modules-typescript-pre-loader/index.d.ts +0 -6
  80. package/dist/provider/css-modules-typescript-pre-loader/index.js +0 -84
  81. package/dist/provider/css-modules-typescript-pre-loader/postcssIcssExtractPlugin.d.ts +0 -11
  82. package/dist/provider/css-modules-typescript-pre-loader/postcssIcssExtractPlugin.js +0 -66
  83. package/dist/provider/plugins/css.d.ts +0 -17
  84. package/dist/provider/plugins/css.js +0 -202
  85. package/dist/provider/plugins/sass.d.ts +0 -2
  86. package/dist/rspack/RemoveCssSourcemapPlugin.d.ts +0 -6
  87. package/dist/rspack/RemoveCssSourcemapPlugin.js +0 -55
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var memo = {};
4
+
5
+ /* istanbul ignore next */
6
+ function getTarget(target) {
7
+ if (typeof memo[target] === "undefined") {
8
+ var styleTarget = document.querySelector(target);
9
+
10
+ // Special case to return head of iframe instead of iframe itself
11
+ if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
12
+ try {
13
+ // This will throw an exception if access to iframe is blocked
14
+ // due to cross-origin restrictions
15
+ styleTarget = styleTarget.contentDocument.head;
16
+ } catch (e) {
17
+ // istanbul ignore next
18
+ styleTarget = null;
19
+ }
20
+ }
21
+ memo[target] = styleTarget;
22
+ }
23
+ return memo[target];
24
+ }
25
+
26
+ /* istanbul ignore next */
27
+ function insertBySelector(insert, style) {
28
+ var target = getTarget(insert);
29
+ if (!target) {
30
+ throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
31
+ }
32
+ target.appendChild(style);
33
+ }
34
+ module.exports = insertBySelector;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ /* istanbul ignore next */
4
+ function insertStyleElement(options) {
5
+ var element = document.createElement("style");
6
+ options.setAttributes(element, options.attributes);
7
+ options.insert(element, options.options);
8
+ return element;
9
+ }
10
+ module.exports = insertStyleElement;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ function isEqualLocals(a, b, isNamedExport) {
4
+ if (!a && b || a && !b) {
5
+ return false;
6
+ }
7
+ var p;
8
+ for (p in a) {
9
+ if (isNamedExport && p === "default") {
10
+ // eslint-disable-next-line no-continue
11
+ continue;
12
+ }
13
+ if (a[p] !== b[p]) {
14
+ return false;
15
+ }
16
+ }
17
+ for (p in b) {
18
+ if (isNamedExport && p === "default") {
19
+ // eslint-disable-next-line no-continue
20
+ continue;
21
+ }
22
+ if (!a[p]) {
23
+ return false;
24
+ }
25
+ }
26
+ return true;
27
+ }
28
+ module.exports = isEqualLocals;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var memo;
4
+
5
+ /* istanbul ignore next */
6
+ function isOldIE() {
7
+ if (typeof memo === "undefined") {
8
+ // Test for IE <= 9 as proposed by Browserhacks
9
+ // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
10
+ // Tests for existence of standard globals is to allow style-loader
11
+ // to operate correctly into non-standard environments
12
+ // @see https://github.com/webpack-contrib/style-loader/issues/177
13
+ memo = Boolean(typeof window !== "undefined" && typeof document !== "undefined" && document.all && !window.atob);
14
+ }
15
+ return memo;
16
+ }
17
+ module.exports = isOldIE;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ /* istanbul ignore next */
4
+ function setAttributesWithoutAttributes(styleElement, attributes) {
5
+ var nonce = typeof __webpack_nonce__ !== "undefined" ? __webpack_nonce__ : null;
6
+ if (nonce) {
7
+ attributes.nonce = nonce;
8
+ }
9
+ Object.keys(attributes).forEach(function (key) {
10
+ styleElement.setAttribute(key, attributes[key]);
11
+ });
12
+ }
13
+ module.exports = setAttributesWithoutAttributes;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ /* istanbul ignore next */
4
+ function setAttributesWithoutAttributes(styleElement, attributes) {
5
+ Object.keys(attributes).forEach(function (key) {
6
+ styleElement.setAttribute(key, attributes[key]);
7
+ });
8
+ }
9
+ module.exports = setAttributesWithoutAttributes;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ /* istanbul ignore next */
4
+ function setAttributesWithoutAttributes(styleElement) {
5
+ var nonce = typeof __webpack_nonce__ !== "undefined" ? __webpack_nonce__ : null;
6
+ if (nonce) {
7
+ styleElement.setAttribute("nonce", nonce);
8
+ }
9
+ }
10
+ module.exports = setAttributesWithoutAttributes;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ /* istanbul ignore next */
4
+ var replaceText = function replaceText() {
5
+ var textStore = [];
6
+ return function replace(index, replacement) {
7
+ textStore[index] = replacement;
8
+ return textStore.filter(Boolean).join("\n");
9
+ };
10
+ }();
11
+
12
+ /* istanbul ignore next */
13
+ function apply(styleElement, index, remove, obj) {
14
+ var css;
15
+ if (remove) {
16
+ css = "";
17
+ } else {
18
+ css = "";
19
+ if (obj.supports) {
20
+ css += "@supports (".concat(obj.supports, ") {");
21
+ }
22
+ if (obj.media) {
23
+ css += "@media ".concat(obj.media, " {");
24
+ }
25
+ var needLayer = typeof obj.layer !== "undefined";
26
+ if (needLayer) {
27
+ css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
28
+ }
29
+ css += obj.css;
30
+ if (needLayer) {
31
+ css += "}";
32
+ }
33
+ if (obj.media) {
34
+ css += "}";
35
+ }
36
+ if (obj.supports) {
37
+ css += "}";
38
+ }
39
+ }
40
+
41
+ // For old IE
42
+ /* istanbul ignore if */
43
+ if (styleElement.styleSheet) {
44
+ styleElement.styleSheet.cssText = replaceText(index, css);
45
+ } else {
46
+ var cssNode = document.createTextNode(css);
47
+ var childNodes = styleElement.childNodes;
48
+ if (childNodes[index]) {
49
+ styleElement.removeChild(childNodes[index]);
50
+ }
51
+ if (childNodes.length) {
52
+ styleElement.insertBefore(cssNode, childNodes[index]);
53
+ } else {
54
+ styleElement.appendChild(cssNode);
55
+ }
56
+ }
57
+ }
58
+ var singletonData = {
59
+ singleton: null,
60
+ singletonCounter: 0
61
+ };
62
+
63
+ /* istanbul ignore next */
64
+ function domAPI(options) {
65
+ if (typeof document === "undefined") return {
66
+ update: function update() {},
67
+ remove: function remove() {}
68
+ };
69
+
70
+ // eslint-disable-next-line no-undef,no-use-before-define
71
+ var styleIndex = singletonData.singletonCounter++;
72
+ var styleElement =
73
+ // eslint-disable-next-line no-undef,no-use-before-define
74
+ singletonData.singleton || (
75
+ // eslint-disable-next-line no-undef,no-use-before-define
76
+ singletonData.singleton = options.insertStyleElement(options));
77
+ return {
78
+ update: function update(obj) {
79
+ apply(styleElement, styleIndex, false, obj);
80
+ },
81
+ remove: function remove(obj) {
82
+ apply(styleElement, styleIndex, true, obj);
83
+ }
84
+ };
85
+ }
86
+ module.exports = domAPI;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ /* istanbul ignore next */
4
+ function apply(styleElement, options, obj) {
5
+ var css = "";
6
+ if (obj.supports) {
7
+ css += "@supports (".concat(obj.supports, ") {");
8
+ }
9
+ if (obj.media) {
10
+ css += "@media ".concat(obj.media, " {");
11
+ }
12
+ var needLayer = typeof obj.layer !== "undefined";
13
+ if (needLayer) {
14
+ css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
15
+ }
16
+ css += obj.css;
17
+ if (needLayer) {
18
+ css += "}";
19
+ }
20
+ if (obj.media) {
21
+ css += "}";
22
+ }
23
+ if (obj.supports) {
24
+ css += "}";
25
+ }
26
+ var sourceMap = obj.sourceMap;
27
+ if (sourceMap && typeof btoa !== "undefined") {
28
+ css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
29
+ }
30
+
31
+ // For old IE
32
+ /* istanbul ignore if */
33
+ options.styleTagTransform(css, styleElement, options.options);
34
+ }
35
+ function removeStyleElement(styleElement) {
36
+ // istanbul ignore if
37
+ if (styleElement.parentNode === null) {
38
+ return false;
39
+ }
40
+ styleElement.parentNode.removeChild(styleElement);
41
+ }
42
+
43
+ /* istanbul ignore next */
44
+ function domAPI(options) {
45
+ if (typeof document === "undefined") {
46
+ return {
47
+ update: function update() {},
48
+ remove: function remove() {}
49
+ };
50
+ }
51
+ var styleElement = options.insertStyleElement(options);
52
+ return {
53
+ update: function update(obj) {
54
+ apply(styleElement, options, obj);
55
+ },
56
+ remove: function remove() {
57
+ removeStyleElement(styleElement);
58
+ }
59
+ };
60
+ }
61
+ module.exports = domAPI;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ /* istanbul ignore next */
4
+ function styleTagTransform(css, styleElement) {
5
+ if (styleElement.styleSheet) {
6
+ styleElement.styleSheet.cssText = css;
7
+ } else {
8
+ while (styleElement.firstChild) {
9
+ styleElement.removeChild(styleElement.firstChild);
10
+ }
11
+ styleElement.appendChild(document.createTextNode(css));
12
+ }
13
+ }
14
+ module.exports = styleTagTransform;
@@ -39,7 +39,7 @@ const applyServerOptions = (command) => {
39
39
  command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
40
40
  };
41
41
  function runCli() {
42
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.15");
42
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.7.0-beta.0");
43
43
  const devCommand = import_commander.program.command("dev");
44
44
  const buildCommand = import_commander.program.command("build");
45
45
  const previewCommand = import_commander.program.command("preview");
@@ -34,7 +34,7 @@ function prepareCli() {
34
34
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
35
35
  console.log();
36
36
  }
37
- import_rslog.logger.greet(` ${`Rsbuild v${"0.6.15"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.7.0-beta.0"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
package/dist/config.js CHANGED
@@ -136,7 +136,6 @@ const getDefaultOutputConfig = () => ({
136
136
  css: false
137
137
  },
138
138
  filenameHash: true,
139
- enableCssModuleTSDeclaration: false,
140
139
  inlineScripts: false,
141
140
  inlineStyles: false,
142
141
  cssModules: {
@@ -44,7 +44,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
44
44
  const context = {
45
45
  entry: (0, import_entry.getEntryObject)(config, "web"),
46
46
  targets: config.output?.targets || [],
47
- version: "0.6.15",
47
+ version: "0.7.0-beta.0",
48
48
  rootPath,
49
49
  distPath,
50
50
  cachePath,
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ var import_config = require("./config");
40
40
  var import_shared = require("@rsbuild/shared");
41
41
  var import_mergeConfig = require("./mergeConfig");
42
42
  var import_constants = require("./constants");
43
- const version = "0.6.15";
43
+ const version = "0.7.0-beta.0";
44
44
  // Annotate the CommonJS export names for ESM import in node:
45
45
  0 && (module.exports = {
46
46
  PLUGIN_CSS_NAME,
@@ -8,10 +8,10 @@ export { createContext, createPublicContext } from './createContext';
8
8
  export { initPlugins, createPluginManager } from './pluginManager';
9
9
  export { initHooks, type Hooks } from './initHooks';
10
10
  export { initRsbuildConfig } from './provider/initConfigs';
11
+ export { applyCSSRule } from './plugins/css';
11
12
  export { getPluginAPI } from './initPlugins';
12
- export { applyBaseCSSRule, applyCSSModuleRule } from './provider/plugins/css';
13
13
  export type { InternalContext } from './types';
14
- export { setHTMLPlugin, getHTMLPlugin } from './htmlUtils';
14
+ export { setHTMLPlugin, getHTMLPlugin, setCssExtractPlugin, } from './pluginHelper';
15
15
  export { formatStats, getStatsOptions } from './provider/shared';
16
16
  export { getChainUtils } from './provider/rspackConfig';
17
17
  export { applySwcDecoratorConfig } from './provider/plugins/swc';
package/dist/internal.js CHANGED
@@ -18,8 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var internal_exports = {};
20
20
  __export(internal_exports, {
21
- applyBaseCSSRule: () => import_css.applyBaseCSSRule,
22
- applyCSSModuleRule: () => import_css.applyCSSModuleRule,
21
+ applyCSSRule: () => import_css.applyCSSRule,
23
22
  applySwcDecoratorConfig: () => import_swc.applySwcDecoratorConfig,
24
23
  createContext: () => import_createContext.createContext,
25
24
  createDevServer: () => import_server.createDevServer,
@@ -28,7 +27,7 @@ __export(internal_exports, {
28
27
  formatStats: () => import_shared.formatStats,
29
28
  getChainUtils: () => import_rspackConfig.getChainUtils,
30
29
  getDevMiddleware: () => import_devMiddleware.getDevMiddleware,
31
- getHTMLPlugin: () => import_htmlUtils.getHTMLPlugin,
30
+ getHTMLPlugin: () => import_pluginHelper.getHTMLPlugin,
32
31
  getPluginAPI: () => import_initPlugins.getPluginAPI,
33
32
  getStatsOptions: () => import_shared.getStatsOptions,
34
33
  initHooks: () => import_initHooks.initHooks,
@@ -36,7 +35,8 @@ __export(internal_exports, {
36
35
  initRsbuildConfig: () => import_initConfigs.initRsbuildConfig,
37
36
  plugins: () => import_plugins.plugins,
38
37
  rspackProvider: () => import_provider.rspackProvider,
39
- setHTMLPlugin: () => import_htmlUtils.setHTMLPlugin,
38
+ setCssExtractPlugin: () => import_pluginHelper.setCssExtractPlugin,
39
+ setHTMLPlugin: () => import_pluginHelper.setHTMLPlugin,
40
40
  startProdServer: () => import_server.startProdServer
41
41
  });
42
42
  module.exports = __toCommonJS(internal_exports);
@@ -45,9 +45,9 @@ var import_createContext = require("./createContext");
45
45
  var import_pluginManager = require("./pluginManager");
46
46
  var import_initHooks = require("./initHooks");
47
47
  var import_initConfigs = require("./provider/initConfigs");
48
+ var import_css = require("./plugins/css");
48
49
  var import_initPlugins = require("./initPlugins");
49
- var import_css = require("./provider/plugins/css");
50
- var import_htmlUtils = require("./htmlUtils");
50
+ var import_pluginHelper = require("./pluginHelper");
51
51
  var import_shared = require("./provider/shared");
52
52
  var import_rspackConfig = require("./provider/rspackConfig");
53
53
  var import_swc = require("./provider/plugins/swc");
@@ -56,8 +56,7 @@ var import_server = require("./server");
56
56
  var import_plugins = require("./plugins");
57
57
  // Annotate the CommonJS export names for ESM import in node:
58
58
  0 && (module.exports = {
59
- applyBaseCSSRule,
60
- applyCSSModuleRule,
59
+ applyCSSRule,
61
60
  applySwcDecoratorConfig,
62
61
  createContext,
63
62
  createDevServer,
@@ -74,6 +73,7 @@ var import_plugins = require("./plugins");
74
73
  initRsbuildConfig,
75
74
  plugins,
76
75
  rspackProvider,
76
+ setCssExtractPlugin,
77
77
  setHTMLPlugin,
78
78
  startProdServer
79
79
  });
@@ -1,9 +1,12 @@
1
1
  /**
2
- * This file is used to provide/set a global html-plugin singleton
2
+ * This file is used to get/set the global instance for html-plugin and css-extract plugin.
3
3
  */
4
+ import rspack from '@rspack/core';
4
5
  import type HtmlWebpackPlugin from 'html-webpack-plugin';
5
6
  /**
6
7
  * This method is used to override the Rsbuild default html-plugin (html-rspack-plugin).
7
8
  */
8
9
  export declare const setHTMLPlugin: (plugin: typeof HtmlWebpackPlugin) => void;
9
10
  export declare const getHTMLPlugin: () => typeof HtmlWebpackPlugin;
11
+ export declare const setCssExtractPlugin: (plugin: unknown) => void;
12
+ export declare const getCssExtractPlugin: () => typeof rspack.CssExtractRspackPlugin;
@@ -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 pluginHelper_exports = {};
30
+ __export(pluginHelper_exports, {
31
+ getCssExtractPlugin: () => getCssExtractPlugin,
32
+ getHTMLPlugin: () => getHTMLPlugin,
33
+ setCssExtractPlugin: () => setCssExtractPlugin,
34
+ setHTMLPlugin: () => setHTMLPlugin
35
+ });
36
+ module.exports = __toCommonJS(pluginHelper_exports);
37
+ var import_core = __toESM(require("@rspack/core"));
38
+ let htmlPlugin;
39
+ const setHTMLPlugin = (plugin) => {
40
+ if (plugin) {
41
+ htmlPlugin = plugin;
42
+ }
43
+ };
44
+ const getHTMLPlugin = () => {
45
+ if (!htmlPlugin) {
46
+ htmlPlugin = require("html-webpack-plugin");
47
+ }
48
+ return htmlPlugin;
49
+ };
50
+ let cssExtractPlugin;
51
+ const setCssExtractPlugin = (plugin) => {
52
+ cssExtractPlugin = plugin;
53
+ };
54
+ const getCssExtractPlugin = () => {
55
+ if (cssExtractPlugin) {
56
+ return cssExtractPlugin;
57
+ }
58
+ return import_core.default.CssExtractRspackPlugin;
59
+ };
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ getCssExtractPlugin,
63
+ getHTMLPlugin,
64
+ setCssExtractPlugin,
65
+ setHTMLPlugin
66
+ });
@@ -0,0 +1,19 @@
1
+ import { type BundlerChainRule, type CSSLoaderOptions, type ModifyChainUtils, type RsbuildContext, type RsbuildTarget } from '@rsbuild/shared';
2
+ import type { AcceptedPlugin } from 'postcss';
3
+ import type { NormalizedConfig, RsbuildPlugin } from '../types';
4
+ export declare const enableNativeCss: (config: NormalizedConfig) => boolean;
5
+ export declare const isUseCssExtract: (config: NormalizedConfig, target: RsbuildTarget) => boolean;
6
+ export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
7
+ /**
8
+ * Apply autoprefixer to the postcss plugins
9
+ * Check if autoprefixer is already in the plugins, if not, add it
10
+ */
11
+ export declare const applyAutoprefixer: (plugins: unknown[], browserslist: string[], config: NormalizedConfig) => Promise<AcceptedPlugin[]>;
12
+ export declare function applyCSSRule({ rule, config, context, utils: { target, isProd, CHAIN_ID }, importLoaders, }: {
13
+ rule: BundlerChainRule;
14
+ config: NormalizedConfig;
15
+ context: RsbuildContext;
16
+ utils: ModifyChainUtils;
17
+ importLoaders?: number;
18
+ }): Promise<void>;
19
+ export declare const pluginCss: () => RsbuildPlugin;