@rsbuild/plugin-stylus 1.0.0-alpha.2 → 1.0.0-alpha.4

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.cjs CHANGED
@@ -34,7 +34,7 @@ __export(src_exports, {
34
34
  pluginStylus: () => pluginStylus
35
35
  });
36
36
  module.exports = __toCommonJS(src_exports);
37
- var import_shared = require("@rsbuild/shared");
37
+ var import_deepmerge = __toESM(require("deepmerge"));
38
38
  var import_reduce_configs = require("reduce-configs");
39
39
  var PLUGIN_STYLUS_NAME = "rsbuild:stylus";
40
40
  var pluginStylus = (options) => ({
@@ -47,17 +47,18 @@ var pluginStylus = (options) => ({
47
47
  sourceMap: config.output.sourceMap.css
48
48
  },
49
49
  config: options,
50
- mergeFn: import_shared.deepmerge
50
+ mergeFn: import_deepmerge.default
51
51
  });
52
52
  const rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({ sideEffects: true }).resolve.preferRelative(true).end();
53
53
  const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
54
54
  for (const id of Object.keys(cssRule.uses.entries())) {
55
55
  const loader = cssRule.uses.get(id);
56
- const options2 = (0, import_shared.cloneDeep)(loader.get("options"));
56
+ const options2 = loader.get("options") ?? {};
57
+ const clonedOptions = (0, import_deepmerge.default)({}, options2);
57
58
  if (id === CHAIN_ID.USE.CSS) {
58
- options2.importLoaders = 2;
59
+ clonedOptions.importLoaders = 2;
59
60
  }
60
- rule.use(id).loader(loader.get("loader")).options(options2);
61
+ rule.use(id).loader(loader.get("loader")).options(clonedOptions);
61
62
  }
62
63
  rule.use(CHAIN_ID.USE.STYLUS).loader(require.resolve("stylus-loader")).options(mergedOptions);
63
64
  });
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { fileURLToPath } from "url";
14
14
  import path from "path";
15
15
 
16
16
  // src/index.ts
17
- import { cloneDeep, deepmerge } from "@rsbuild/shared";
17
+ import deepmerge from "deepmerge";
18
18
  import { reduceConfigs } from "reduce-configs";
19
19
  var PLUGIN_STYLUS_NAME = "rsbuild:stylus";
20
20
  var pluginStylus = (options) => ({
@@ -33,11 +33,12 @@ var pluginStylus = (options) => ({
33
33
  const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
34
34
  for (const id of Object.keys(cssRule.uses.entries())) {
35
35
  const loader = cssRule.uses.get(id);
36
- const options2 = cloneDeep(loader.get("options"));
36
+ const options2 = loader.get("options") ?? {};
37
+ const clonedOptions = deepmerge({}, options2);
37
38
  if (id === CHAIN_ID.USE.CSS) {
38
- options2.importLoaders = 2;
39
+ clonedOptions.importLoaders = 2;
39
40
  }
40
- rule.use(id).loader(loader.get("loader")).options(options2);
41
+ rule.use(id).loader(loader.get("loader")).options(clonedOptions);
41
42
  }
42
43
  rule.use(CHAIN_ID.USE.STYLUS).loader(__require.resolve("stylus-loader")).options(mergedOptions);
43
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-stylus",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "Stylus plugin for Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -23,18 +23,18 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
+ "deepmerge": "^4.3.1",
26
27
  "reduce-configs": "^1.0.0",
27
28
  "stylus": "0.63.0",
28
- "stylus-loader": "8.1.0",
29
- "@rsbuild/shared": "1.0.0-alpha.2"
29
+ "stylus-loader": "8.1.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "typescript": "^5.5.2",
33
- "@scripts/test-helper": "1.0.0-alpha.2",
34
- "@rsbuild/core": "1.0.0-alpha.2"
33
+ "@rsbuild/core": "1.0.0-alpha.4",
34
+ "@scripts/test-helper": "1.0.0-alpha.4"
35
35
  },
36
36
  "peerDependencies": {
37
- "@rsbuild/core": "^1.0.0-alpha.2"
37
+ "@rsbuild/core": "^1.0.0-alpha.4"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",