@rsbuild/plugin-stylus 0.7.0-beta.7 → 0.7.0-beta.8
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 +28 -27
- package/dist/index.d.ts +4 -4
- package/dist/index.js +28 -31
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -30,39 +30,40 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
PLUGIN_STYLUS_NAME: () => PLUGIN_STYLUS_NAME,
|
|
33
34
|
pluginStylus: () => pluginStylus
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
var import_core = require("@rsbuild/core");
|
|
37
37
|
var import_shared = require("@rsbuild/shared");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
api.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
mergeFn: import_shared.deepmerge
|
|
51
|
-
});
|
|
52
|
-
const rule = chain.module.rule(utils.CHAIN_ID.RULE.STYLUS).test(STYLUS_REGEX);
|
|
53
|
-
await import_core.__internalHelper.applyCSSRule({
|
|
54
|
-
rule,
|
|
55
|
-
config,
|
|
56
|
-
context: api.context,
|
|
57
|
-
utils,
|
|
58
|
-
importLoaders: 2
|
|
59
|
-
});
|
|
60
|
-
rule.use(utils.CHAIN_ID.USE.STYLUS).loader(require.resolve("stylus-loader")).options(mergedOptions);
|
|
38
|
+
var PLUGIN_STYLUS_NAME = "rsbuild:stylus";
|
|
39
|
+
var pluginStylus = (options) => ({
|
|
40
|
+
name: PLUGIN_STYLUS_NAME,
|
|
41
|
+
setup(api) {
|
|
42
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
|
|
43
|
+
const config = api.getNormalizedConfig();
|
|
44
|
+
const mergedOptions = (0, import_shared.mergeChainedOptions)({
|
|
45
|
+
defaults: {
|
|
46
|
+
sourceMap: config.output.sourceMap.css
|
|
47
|
+
},
|
|
48
|
+
options,
|
|
49
|
+
mergeFn: import_shared.deepmerge
|
|
61
50
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
const rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({ sideEffects: true }).resolve.preferRelative(true).end();
|
|
52
|
+
const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
|
|
53
|
+
for (const id of Object.keys(cssRule.uses.entries())) {
|
|
54
|
+
const loader = cssRule.uses.get(id);
|
|
55
|
+
const options2 = (0, import_shared.cloneDeep)(loader.get("options"));
|
|
56
|
+
if (id === CHAIN_ID.USE.CSS) {
|
|
57
|
+
options2.importLoaders = 2;
|
|
58
|
+
}
|
|
59
|
+
rule.use(id).loader(loader.get("loader")).options(options2);
|
|
60
|
+
}
|
|
61
|
+
rule.use(CHAIN_ID.USE.STYLUS).loader(require.resolve("stylus-loader")).options(mergedOptions);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
66
|
0 && (module.exports = {
|
|
67
|
+
PLUGIN_STYLUS_NAME,
|
|
67
68
|
pluginStylus
|
|
68
69
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
|
|
3
|
+
declare const PLUGIN_STYLUS_NAME = "rsbuild:stylus";
|
|
3
4
|
type StylusOptions = {
|
|
4
5
|
use?: string[];
|
|
5
6
|
include?: string;
|
|
@@ -8,7 +9,7 @@ type StylusOptions = {
|
|
|
8
9
|
lineNumbers?: boolean;
|
|
9
10
|
hoistAtrules?: boolean;
|
|
10
11
|
};
|
|
11
|
-
type
|
|
12
|
+
type PluginStylusOptions = {
|
|
12
13
|
/**
|
|
13
14
|
* Options passed to Stylus.
|
|
14
15
|
*/
|
|
@@ -18,7 +19,6 @@ type StylusLoaderOptions = {
|
|
|
18
19
|
*/
|
|
19
20
|
sourceMap?: boolean;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
declare function pluginStylus(options?: PluginStylusOptions): RsbuildPlugin;
|
|
22
|
+
declare const pluginStylus: (options?: PluginStylusOptions) => RsbuildPlugin;
|
|
23
23
|
|
|
24
|
-
export { type PluginStylusOptions, pluginStylus };
|
|
24
|
+
export { PLUGIN_STYLUS_NAME, type PluginStylusOptions, pluginStylus };
|
package/dist/index.js
CHANGED
|
@@ -14,38 +14,35 @@ import { fileURLToPath } from "url";
|
|
|
14
14
|
import path from "path";
|
|
15
15
|
|
|
16
16
|
// src/index.ts
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
defaults: {
|
|
31
|
-
sourceMap: config.output.sourceMap.css
|
|
32
|
-
},
|
|
33
|
-
options,
|
|
34
|
-
mergeFn: deepmerge
|
|
35
|
-
});
|
|
36
|
-
const rule = chain.module.rule(utils.CHAIN_ID.RULE.STYLUS).test(STYLUS_REGEX);
|
|
37
|
-
await __internalHelper.applyCSSRule({
|
|
38
|
-
rule,
|
|
39
|
-
config,
|
|
40
|
-
context: api.context,
|
|
41
|
-
utils,
|
|
42
|
-
importLoaders: 2
|
|
43
|
-
});
|
|
44
|
-
rule.use(utils.CHAIN_ID.USE.STYLUS).loader(__require.resolve("stylus-loader")).options(mergedOptions);
|
|
17
|
+
import { cloneDeep, deepmerge, mergeChainedOptions } from "@rsbuild/shared";
|
|
18
|
+
var PLUGIN_STYLUS_NAME = "rsbuild:stylus";
|
|
19
|
+
var pluginStylus = (options) => ({
|
|
20
|
+
name: PLUGIN_STYLUS_NAME,
|
|
21
|
+
setup(api) {
|
|
22
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
|
|
23
|
+
const config = api.getNormalizedConfig();
|
|
24
|
+
const mergedOptions = mergeChainedOptions({
|
|
25
|
+
defaults: {
|
|
26
|
+
sourceMap: config.output.sourceMap.css
|
|
27
|
+
},
|
|
28
|
+
options,
|
|
29
|
+
mergeFn: deepmerge
|
|
45
30
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
const rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({ sideEffects: true }).resolve.preferRelative(true).end();
|
|
32
|
+
const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
|
|
33
|
+
for (const id of Object.keys(cssRule.uses.entries())) {
|
|
34
|
+
const loader = cssRule.uses.get(id);
|
|
35
|
+
const options2 = cloneDeep(loader.get("options"));
|
|
36
|
+
if (id === CHAIN_ID.USE.CSS) {
|
|
37
|
+
options2.importLoaders = 2;
|
|
38
|
+
}
|
|
39
|
+
rule.use(id).loader(loader.get("loader")).options(options2);
|
|
40
|
+
}
|
|
41
|
+
rule.use(CHAIN_ID.USE.STYLUS).loader(__require.resolve("stylus-loader")).options(mergedOptions);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
49
45
|
export {
|
|
46
|
+
PLUGIN_STYLUS_NAME,
|
|
50
47
|
pluginStylus
|
|
51
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-stylus",
|
|
3
|
-
"version": "0.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.8",
|
|
4
4
|
"description": "Stylus plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"stylus": "0.63.0",
|
|
27
27
|
"stylus-loader": "8.1.0",
|
|
28
|
-
"@rsbuild/shared": "0.7.0-beta.
|
|
28
|
+
"@rsbuild/shared": "0.7.0-beta.8"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"typescript": "^5.4.2",
|
|
32
|
-
"@rsbuild/core": "0.7.0-beta.
|
|
33
|
-
"@scripts/test-helper": "0.7.0-beta.
|
|
32
|
+
"@rsbuild/core": "0.7.0-beta.8",
|
|
33
|
+
"@scripts/test-helper": "0.7.0-beta.8"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@rsbuild/core": "^0.7.0-beta.
|
|
36
|
+
"@rsbuild/core": "^0.7.0-beta.8"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public",
|