@rsbuild/plugin-stylus 1.0.5 → 1.0.6
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 +38 -75
- package/dist/index.d.ts +6 -1
- package/dist/index.js +9 -19
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -1,88 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// The require scope
|
|
3
2
|
var __webpack_require__ = {};
|
|
4
|
-
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return module1['default'];
|
|
10
|
-
} : function() {
|
|
11
|
-
return module1;
|
|
12
|
-
};
|
|
13
|
-
__webpack_require__.d(getter, {
|
|
14
|
-
a: getter
|
|
15
|
-
});
|
|
16
|
-
return getter;
|
|
3
|
+
__webpack_require__.n = function(module1) {
|
|
4
|
+
var getter = module1 && module1.__esModule ? function() {
|
|
5
|
+
return module1.default;
|
|
6
|
+
} : function() {
|
|
7
|
+
return module1;
|
|
17
8
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
value: 'Module'
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
42
|
-
value: true
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
/************************************************************************/ var __webpack_exports__ = {};
|
|
47
|
-
// ESM COMPAT FLAG
|
|
48
|
-
__webpack_require__.r(__webpack_exports__);
|
|
49
|
-
// EXPORTS
|
|
50
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
51
|
-
PLUGIN_STYLUS_NAME: ()=>/* binding */ PLUGIN_STYLUS_NAME,
|
|
52
|
-
pluginStylus: ()=>/* binding */ pluginStylus
|
|
9
|
+
return __webpack_require__.d(getter, {
|
|
10
|
+
a: getter
|
|
11
|
+
}), getter;
|
|
12
|
+
}, __webpack_require__.d = function(exports1, definition) {
|
|
13
|
+
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
14
|
+
enumerable: !0,
|
|
15
|
+
get: definition[key]
|
|
16
|
+
});
|
|
17
|
+
}, __webpack_require__.o = function(obj, prop) {
|
|
18
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
19
|
+
}, __webpack_require__.r = function(exports1) {
|
|
20
|
+
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
}), Object.defineProperty(exports1, '__esModule', {
|
|
23
|
+
value: !0
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __webpack_exports__ = {};
|
|
27
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
PLUGIN_STYLUS_NAME: ()=>PLUGIN_STYLUS_NAME,
|
|
29
|
+
pluginStylus: ()=>pluginStylus
|
|
53
30
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const external_reduce_configs_namespaceObject = require("reduce-configs");
|
|
58
|
-
const src_require = (0, external_node_module_namespaceObject.createRequire)(/*#__PURE__*/ function() {
|
|
59
|
-
return 'undefined' == typeof document ? new (module.require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
60
|
-
}());
|
|
61
|
-
const PLUGIN_STYLUS_NAME = 'rsbuild:stylus';
|
|
62
|
-
const pluginStylus = (options)=>({
|
|
31
|
+
let external_node_module_namespaceObject = require("node:module"), external_deepmerge_namespaceObject = require("deepmerge");
|
|
32
|
+
var external_deepmerge_default = __webpack_require__.n(external_deepmerge_namespaceObject);
|
|
33
|
+
let external_reduce_configs_namespaceObject = require("reduce-configs"), src_require = (0, external_node_module_namespaceObject.createRequire)('undefined' == typeof document ? new (module.require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href), PLUGIN_STYLUS_NAME = 'rsbuild:stylus', pluginStylus = (options)=>({
|
|
63
34
|
name: PLUGIN_STYLUS_NAME,
|
|
64
35
|
setup (api) {
|
|
65
36
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
66
|
-
|
|
67
|
-
const mergedOptions = (0, external_reduce_configs_namespaceObject.reduceConfigs)({
|
|
37
|
+
let { config } = environment, mergedOptions = (0, external_reduce_configs_namespaceObject.reduceConfigs)({
|
|
68
38
|
initial: {
|
|
69
39
|
sourceMap: config.output.sourceMap.css
|
|
70
40
|
},
|
|
71
41
|
config: options,
|
|
72
42
|
mergeFn: external_deepmerge_default()
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
for (const id of Object.keys(cssRule.uses.entries())){
|
|
80
|
-
const loader = cssRule.uses.get(id);
|
|
81
|
-
const options = loader.get('options') ?? {};
|
|
82
|
-
const clonedOptions = external_deepmerge_default()({}, options);
|
|
83
|
-
if (id === CHAIN_ID.USE.CSS) // add stylus-loader
|
|
84
|
-
clonedOptions.importLoaders += 1;
|
|
85
|
-
rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
43
|
+
}), rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({
|
|
44
|
+
sideEffects: !0
|
|
45
|
+
}).resolve.preferRelative(!0).end(), cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
|
|
46
|
+
for (let id of Object.keys(cssRule.uses.entries())){
|
|
47
|
+
let loader = cssRule.uses.get(id), options = loader.get('options') ?? {}, clonedOptions = external_deepmerge_default()({}, options);
|
|
48
|
+
id === CHAIN_ID.USE.CSS && (clonedOptions.importLoaders += 1), rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
86
49
|
}
|
|
87
50
|
rule.use(CHAIN_ID.USE.STYLUS).loader(src_require.resolve('stylus-loader')).options(mergedOptions);
|
|
88
51
|
});
|
|
@@ -90,6 +53,6 @@ const pluginStylus = (options)=>({
|
|
|
90
53
|
});
|
|
91
54
|
var __webpack_export_target__ = exports;
|
|
92
55
|
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|
|
93
|
-
|
|
94
|
-
value:
|
|
56
|
+
__webpack_exports__.__esModule && Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
57
|
+
value: !0
|
|
95
58
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,12 @@ type StylusOptions = {
|
|
|
4
4
|
use?: string[];
|
|
5
5
|
define?: [string, any, boolean?];
|
|
6
6
|
include?: string[];
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Import the specified Stylus files/paths, can not be relative path.
|
|
9
|
+
* @example import: ["nib", path.join(__dirname, "src/styl/mixins")],
|
|
10
|
+
* @default []
|
|
11
|
+
*/
|
|
12
|
+
import?: string[];
|
|
8
13
|
resolveURL?: boolean;
|
|
9
14
|
lineNumbers?: boolean;
|
|
10
15
|
hoistAtrules?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_deepmerge__ from "deepmerge";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_reduce_configs__ from "reduce-configs";
|
|
4
|
-
|
|
5
|
-
const PLUGIN_STYLUS_NAME = 'rsbuild:stylus';
|
|
6
|
-
const pluginStylus = (options)=>({
|
|
4
|
+
let src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module__.createRequire)(import.meta.url), PLUGIN_STYLUS_NAME = 'rsbuild:stylus', pluginStylus = (options)=>({
|
|
7
5
|
name: PLUGIN_STYLUS_NAME,
|
|
8
6
|
setup (api) {
|
|
9
7
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
10
|
-
|
|
11
|
-
const mergedOptions = (0, __WEBPACK_EXTERNAL_MODULE_reduce_configs__.reduceConfigs)({
|
|
8
|
+
let { config } = environment, mergedOptions = (0, __WEBPACK_EXTERNAL_MODULE_reduce_configs__.reduceConfigs)({
|
|
12
9
|
initial: {
|
|
13
10
|
sourceMap: config.output.sourceMap.css
|
|
14
11
|
},
|
|
15
12
|
config: options,
|
|
16
|
-
mergeFn: __WEBPACK_EXTERNAL_MODULE_deepmerge__
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
for (const id of Object.keys(cssRule.uses.entries())){
|
|
24
|
-
const loader = cssRule.uses.get(id);
|
|
25
|
-
const options = loader.get('options') ?? {};
|
|
26
|
-
const clonedOptions = (0, __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"])({}, options);
|
|
27
|
-
if (id === CHAIN_ID.USE.CSS) // add stylus-loader
|
|
28
|
-
clonedOptions.importLoaders += 1;
|
|
29
|
-
rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
13
|
+
mergeFn: __WEBPACK_EXTERNAL_MODULE_deepmerge__.default
|
|
14
|
+
}), rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({
|
|
15
|
+
sideEffects: !0
|
|
16
|
+
}).resolve.preferRelative(!0).end(), cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
|
|
17
|
+
for (let id of Object.keys(cssRule.uses.entries())){
|
|
18
|
+
let loader = cssRule.uses.get(id), options = loader.get('options') ?? {}, clonedOptions = (0, __WEBPACK_EXTERNAL_MODULE_deepmerge__.default)({}, options);
|
|
19
|
+
id === CHAIN_ID.USE.CSS && (clonedOptions.importLoaders += 1), rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
30
20
|
}
|
|
31
21
|
rule.use(CHAIN_ID.USE.STYLUS).loader(src_require.resolve('stylus-loader')).options(mergedOptions);
|
|
32
22
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-stylus",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Stylus plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
"stylus-loader": "8.1.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@
|
|
32
|
+
"@rslib/core": "0.0.18",
|
|
33
|
+
"@types/node": "^22.9.0",
|
|
33
34
|
"typescript": "^5.6.3",
|
|
34
|
-
"@rsbuild/core": "1.
|
|
35
|
+
"@rsbuild/core": "1.1.2",
|
|
35
36
|
"@scripts/test-helper": "1.0.1"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|