@rsbuild/plugin-stylus 0.2.11 → 0.2.12

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.
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ function pluginStylus(options) {
38
38
  return {
39
39
  name: "rsbuild:stylus",
40
40
  setup(api) {
41
- const { bundlerType } = api.context;
41
+ const STYLUS_REGEX = /\.styl(us)?$/;
42
42
  api.modifyBundlerChain(async (chain, utils) => {
43
43
  const config = api.getNormalizedConfig();
44
44
  const mergedOptions = (0, import_shared.mergeChainedOptions)({
@@ -48,7 +48,8 @@ function pluginStylus(options) {
48
48
  options,
49
49
  mergeFn: import_shared.deepmerge
50
50
  });
51
- const rule = chain.module.rule(utils.CHAIN_ID.RULE.STYLUS).test(import_shared.STYLUS_REGEX);
51
+ const rule = chain.module.rule(utils.CHAIN_ID.RULE.STYLUS).test(STYLUS_REGEX);
52
+ const { bundlerType } = api.context;
52
53
  const { applyBaseCSSRule } = await (bundlerType === "webpack" ? import("@rsbuild/webpack/plugin-css") : import("@rsbuild/core/provider"));
53
54
  await applyBaseCSSRule({
54
55
  rule,
@@ -59,11 +60,11 @@ function pluginStylus(options) {
59
60
  });
60
61
  rule.use(utils.CHAIN_ID.USE.STYLUS).loader(require.resolve("stylus-loader")).options(mergedOptions);
61
62
  });
62
- bundlerType === "rspack" && api.modifyRspackConfig(async (rspackConfig) => {
63
+ api.modifyRspackConfig(async (rspackConfig) => {
63
64
  const { applyCSSModuleRule } = await import("@rsbuild/core/provider");
64
65
  const config = api.getNormalizedConfig();
65
66
  const rules = rspackConfig.module?.rules;
66
- applyCSSModuleRule(rules, import_shared.STYLUS_REGEX, config);
67
+ applyCSSModuleRule(rules, STYLUS_REGEX, config);
67
68
  });
68
69
  }
69
70
  };
package/dist/index.mjs CHANGED
@@ -15,12 +15,12 @@ import { createRequire } from "module";
15
15
  global.require = createRequire(import.meta.url);
16
16
 
17
17
  // src/index.ts
18
- import { deepmerge, STYLUS_REGEX, mergeChainedOptions } from "@rsbuild/shared";
18
+ import { deepmerge, mergeChainedOptions } from "@rsbuild/shared";
19
19
  function pluginStylus(options) {
20
20
  return {
21
21
  name: "rsbuild:stylus",
22
22
  setup(api) {
23
- const { bundlerType } = api.context;
23
+ const STYLUS_REGEX = /\.styl(us)?$/;
24
24
  api.modifyBundlerChain(async (chain, utils) => {
25
25
  const config = api.getNormalizedConfig();
26
26
  const mergedOptions = mergeChainedOptions({
@@ -31,6 +31,7 @@ function pluginStylus(options) {
31
31
  mergeFn: deepmerge
32
32
  });
33
33
  const rule = chain.module.rule(utils.CHAIN_ID.RULE.STYLUS).test(STYLUS_REGEX);
34
+ const { bundlerType } = api.context;
34
35
  const { applyBaseCSSRule } = await (bundlerType === "webpack" ? import("@rsbuild/webpack/plugin-css") : import("@rsbuild/core/provider"));
35
36
  await applyBaseCSSRule({
36
37
  rule,
@@ -41,7 +42,7 @@ function pluginStylus(options) {
41
42
  });
42
43
  rule.use(utils.CHAIN_ID.USE.STYLUS).loader(__require.resolve("stylus-loader")).options(mergedOptions);
43
44
  });
44
- bundlerType === "rspack" && api.modifyRspackConfig(async (rspackConfig) => {
45
+ api.modifyRspackConfig(async (rspackConfig) => {
45
46
  const { applyCSSModuleRule } = await import("@rsbuild/core/provider");
46
47
  const config = api.getNormalizedConfig();
47
48
  const rules = rspackConfig.module?.rules;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-stylus",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Stylus plugin for Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -25,14 +25,14 @@
25
25
  "dependencies": {
26
26
  "stylus": "0.59.0",
27
27
  "stylus-loader": "7.1.0",
28
- "@rsbuild/shared": "0.2.11"
28
+ "@rsbuild/shared": "0.2.12"
29
29
  },
30
30
  "devDependencies": {
31
31
  "typescript": "^5.3.0",
32
32
  "webpack": "^5.89.0",
33
- "@rsbuild/core": "0.2.11",
34
- "@rsbuild/webpack": "0.2.11",
35
- "@rsbuild/test-helper": "0.2.11"
33
+ "@rsbuild/test-helper": "0.2.12",
34
+ "@rsbuild/webpack": "0.2.12",
35
+ "@rsbuild/core": "0.2.12"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@rsbuild/core": "0.x"