@rsbuild/plugin-stylus 1.2.1 → 2.0.0-alpha.3
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 +7 -9
- package/dist/index.js +7 -9
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -36,19 +36,17 @@ const external_reduce_configs_namespaceObject = require("reduce-configs"), src_r
|
|
|
36
36
|
},
|
|
37
37
|
config: options,
|
|
38
38
|
mergeFn: external_deepmerge_default()
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
chain.module.rule(CHAIN_ID.RULE.STYLUS_RAW).test(test).type('asset/source').resourceQuery(cssRawRule.get('resourceQuery'));
|
|
43
|
-
}
|
|
39
|
+
}), cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS), rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).dependency(cssRule.get('dependency')).resolve.preferRelative(!0).end(), cssInlineRule = cssRule.oneOfs.get(CHAIN_ID.ONE_OF.CSS_INLINE), cssRawRule = cssRule.oneOfs.get(CHAIN_ID.ONE_OF.CSS_RAW), stylusInlineRule = rule.oneOf(CHAIN_ID.ONE_OF.STYLUS_INLINE).type("javascript/auto").resourceQuery(cssInlineRule.get('resourceQuery'));
|
|
40
|
+
rule.oneOf(CHAIN_ID.ONE_OF.STYLUS_RAW).type('asset/source').resourceQuery(cssRawRule.get('resourceQuery'));
|
|
41
|
+
let stylusMainRule = rule.oneOf(CHAIN_ID.ONE_OF.STYLUS_MAIN).type("javascript/auto");
|
|
44
42
|
(callback = (rule, type)=>{
|
|
45
|
-
let
|
|
46
|
-
for (let id of (rule.dependency(cssRule.get('dependency')), rule.sideEffects(
|
|
47
|
-
let loader =
|
|
43
|
+
let cssBranchRule = 'main' === type ? cssRule.oneOfs.get(CHAIN_ID.ONE_OF.CSS_MAIN) : cssInlineRule;
|
|
44
|
+
for (let id of (rule.dependency(cssRule.get('dependency')), rule.sideEffects(cssBranchRule.get('sideEffects')), rule.resourceQuery(cssBranchRule.get('resourceQuery')), Object.keys(cssBranchRule.uses.entries()))){
|
|
45
|
+
let loader = cssBranchRule.uses.get(id), options = loader.get('options') ?? {}, clonedOptions = external_deepmerge_default()({}, options);
|
|
48
46
|
id === CHAIN_ID.USE.CSS && (clonedOptions.importLoaders += 1), rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
49
47
|
}
|
|
50
48
|
rule.use(CHAIN_ID.USE.STYLUS).loader(src_require.resolve('stylus-loader')).options(mergedOptions);
|
|
51
|
-
})(
|
|
49
|
+
})(stylusMainRule, 'main'), callback(stylusInlineRule, 'inline');
|
|
52
50
|
});
|
|
53
51
|
}
|
|
54
52
|
});
|
package/dist/index.js
CHANGED
|
@@ -12,19 +12,17 @@ let src_require = createRequire(import.meta.url), PLUGIN_STYLUS_NAME = 'rsbuild:
|
|
|
12
12
|
},
|
|
13
13
|
config: options,
|
|
14
14
|
mergeFn: deepmerge
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
chain.module.rule(CHAIN_ID.RULE.STYLUS_RAW).test(test).type('asset/source').resourceQuery(cssRawRule.get('resourceQuery'));
|
|
19
|
-
}
|
|
15
|
+
}), cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS), rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).dependency(cssRule.get('dependency')).resolve.preferRelative(!0).end(), cssInlineRule = cssRule.oneOfs.get(CHAIN_ID.ONE_OF.CSS_INLINE), cssRawRule = cssRule.oneOfs.get(CHAIN_ID.ONE_OF.CSS_RAW), stylusInlineRule = rule.oneOf(CHAIN_ID.ONE_OF.STYLUS_INLINE).type("javascript/auto").resourceQuery(cssInlineRule.get('resourceQuery'));
|
|
16
|
+
rule.oneOf(CHAIN_ID.ONE_OF.STYLUS_RAW).type('asset/source').resourceQuery(cssRawRule.get('resourceQuery'));
|
|
17
|
+
let stylusMainRule = rule.oneOf(CHAIN_ID.ONE_OF.STYLUS_MAIN).type("javascript/auto");
|
|
20
18
|
(callback = (rule, type)=>{
|
|
21
|
-
let
|
|
22
|
-
for (let id of (rule.dependency(cssRule.get('dependency')), rule.sideEffects(
|
|
23
|
-
let loader =
|
|
19
|
+
let cssBranchRule = 'main' === type ? cssRule.oneOfs.get(CHAIN_ID.ONE_OF.CSS_MAIN) : cssInlineRule;
|
|
20
|
+
for (let id of (rule.dependency(cssRule.get('dependency')), rule.sideEffects(cssBranchRule.get('sideEffects')), rule.resourceQuery(cssBranchRule.get('resourceQuery')), Object.keys(cssBranchRule.uses.entries()))){
|
|
21
|
+
let loader = cssBranchRule.uses.get(id), clonedOptions = deepmerge({}, loader.get('options') ?? {});
|
|
24
22
|
id === CHAIN_ID.USE.CSS && (clonedOptions.importLoaders += 1), rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
25
23
|
}
|
|
26
24
|
rule.use(CHAIN_ID.USE.STYLUS).loader(src_require.resolve('stylus-loader')).options(mergedOptions);
|
|
27
|
-
})(
|
|
25
|
+
})(stylusMainRule, 'main'), callback(stylusInlineRule, 'inline');
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
28
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-stylus",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"description": "Stylus plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"repository": {
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"stylus-loader": "8.1.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@rslib/core": "0.19.
|
|
33
|
-
"@types/node": "^24.10.
|
|
32
|
+
"@rslib/core": "0.19.3",
|
|
33
|
+
"@types/node": "^24.10.9",
|
|
34
34
|
"typescript": "^5.9.3",
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
35
|
+
"@scripts/test-helper": "1.0.1",
|
|
36
|
+
"@rsbuild/core": "2.0.0-alpha.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@rsbuild/core": "^
|
|
39
|
+
"@rsbuild/core": "^2.0.0-0"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public",
|