@rsbuild/plugin-stylus 1.0.1 → 1.0.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 +91 -66
- package/{dist-types → dist}/index.d.ts +1 -0
- package/dist/index.js +34 -48
- package/package.json +10 -10
- package/dist-types/package.json +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,71 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
// The require scope
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
/************************************************************************/ // webpack/runtime/compat_get_default_export
|
|
5
|
+
(()=>{
|
|
6
|
+
// getDefaultExport function for compatibility with non-harmony modules
|
|
7
|
+
__webpack_require__.n = function(module1) {
|
|
8
|
+
var getter = module1 && module1.__esModule ? function() {
|
|
9
|
+
return module1['default'];
|
|
10
|
+
} : function() {
|
|
11
|
+
return module1;
|
|
12
|
+
};
|
|
13
|
+
__webpack_require__.d(getter, {
|
|
14
|
+
a: getter
|
|
15
|
+
});
|
|
16
|
+
return getter;
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
// webpack/runtime/define_property_getters
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
22
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: definition[key]
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
// webpack/runtime/has_own_property
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.o = function(obj, prop) {
|
|
31
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
// webpack/runtime/make_namespace_object
|
|
35
|
+
(()=>{
|
|
36
|
+
// define __esModule on exports
|
|
37
|
+
__webpack_require__.r = function(exports1) {
|
|
38
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
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
|
|
35
53
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
const external_node_module_namespaceObject = require("node:module");
|
|
55
|
+
const external_deepmerge_namespaceObject = require("deepmerge");
|
|
56
|
+
var external_deepmerge_default = /*#__PURE__*/ __webpack_require__.n(external_deepmerge_namespaceObject);
|
|
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)=>({
|
|
63
|
+
name: PLUGIN_STYLUS_NAME,
|
|
64
|
+
setup (api) {
|
|
65
|
+
api.modifyBundlerChain(async (chain, param)=>{
|
|
66
|
+
let { CHAIN_ID, environment } = param;
|
|
67
|
+
const { config } = environment;
|
|
68
|
+
const mergedOptions = (0, external_reduce_configs_namespaceObject.reduceConfigs)({
|
|
69
|
+
initial: {
|
|
70
|
+
sourceMap: config.output.sourceMap.css
|
|
71
|
+
},
|
|
72
|
+
config: options,
|
|
73
|
+
mergeFn: external_deepmerge_default()
|
|
74
|
+
});
|
|
75
|
+
const rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({
|
|
76
|
+
sideEffects: true
|
|
77
|
+
}).resolve.preferRelative(true).end();
|
|
78
|
+
const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
|
|
79
|
+
// Copy the builtin CSS rules
|
|
80
|
+
for (const id of Object.keys(cssRule.uses.entries())){
|
|
81
|
+
const loader = cssRule.uses.get(id);
|
|
82
|
+
const options = loader.get('options') ?? {};
|
|
83
|
+
const clonedOptions = external_deepmerge_default()({}, options);
|
|
84
|
+
if (id === CHAIN_ID.USE.CSS) // add stylus-loader
|
|
85
|
+
clonedOptions.importLoaders += 1;
|
|
86
|
+
rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
87
|
+
}
|
|
88
|
+
rule.use(CHAIN_ID.USE.STYLUS).loader(src_require.resolve('stylus-loader')).options(mergedOptions);
|
|
89
|
+
});
|
|
60
90
|
}
|
|
61
|
-
rule.use(id).loader(loader.get("loader")).options(clonedOptions);
|
|
62
|
-
}
|
|
63
|
-
rule.use(CHAIN_ID.USE.STYLUS).loader(require.resolve("stylus-loader")).options(mergedOptions);
|
|
64
91
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
PLUGIN_STYLUS_NAME,
|
|
70
|
-
pluginStylus
|
|
92
|
+
var __webpack_export_target__ = exports;
|
|
93
|
+
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|
|
94
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
95
|
+
value: true
|
|
71
96
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,50 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
for (const id of Object.keys(cssRule.uses.entries())) {
|
|
35
|
-
const loader = cssRule.uses.get(id);
|
|
36
|
-
const options2 = loader.get("options") ?? {};
|
|
37
|
-
const clonedOptions = deepmerge({}, options2);
|
|
38
|
-
if (id === CHAIN_ID.USE.CSS) {
|
|
39
|
-
clonedOptions.importLoaders += 1;
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_deepmerge__ from "deepmerge";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_reduce_configs__ from "reduce-configs";
|
|
4
|
+
const src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module__.createRequire)(import.meta.url);
|
|
5
|
+
const PLUGIN_STYLUS_NAME = 'rsbuild:stylus';
|
|
6
|
+
const pluginStylus = (options)=>({
|
|
7
|
+
name: PLUGIN_STYLUS_NAME,
|
|
8
|
+
setup (api) {
|
|
9
|
+
api.modifyBundlerChain(async (chain, param)=>{
|
|
10
|
+
let { CHAIN_ID, environment } = param;
|
|
11
|
+
const { config } = environment;
|
|
12
|
+
const mergedOptions = (0, __WEBPACK_EXTERNAL_MODULE_reduce_configs__.reduceConfigs)({
|
|
13
|
+
initial: {
|
|
14
|
+
sourceMap: config.output.sourceMap.css
|
|
15
|
+
},
|
|
16
|
+
config: options,
|
|
17
|
+
mergeFn: __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"]
|
|
18
|
+
});
|
|
19
|
+
const rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({
|
|
20
|
+
sideEffects: true
|
|
21
|
+
}).resolve.preferRelative(true).end();
|
|
22
|
+
const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
|
|
23
|
+
// Copy the builtin CSS rules
|
|
24
|
+
for (const id of Object.keys(cssRule.uses.entries())){
|
|
25
|
+
const loader = cssRule.uses.get(id);
|
|
26
|
+
const options = loader.get('options') ?? {};
|
|
27
|
+
const clonedOptions = (0, __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"])({}, options);
|
|
28
|
+
if (id === CHAIN_ID.USE.CSS) // add stylus-loader
|
|
29
|
+
clonedOptions.importLoaders += 1;
|
|
30
|
+
rule.use(id).loader(loader.get('loader')).options(clonedOptions);
|
|
31
|
+
}
|
|
32
|
+
rule.use(CHAIN_ID.USE.STYLUS).loader(src_require.resolve('stylus-loader')).options(mergedOptions);
|
|
33
|
+
});
|
|
40
34
|
}
|
|
41
|
-
rule.use(id).loader(loader.get("loader")).options(clonedOptions);
|
|
42
|
-
}
|
|
43
|
-
rule.use(CHAIN_ID.USE.STYLUS).loader(__require.resolve("stylus-loader")).options(mergedOptions);
|
|
44
35
|
});
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
export {
|
|
48
|
-
PLUGIN_STYLUS_NAME,
|
|
49
|
-
pluginStylus
|
|
50
|
-
};
|
|
36
|
+
export { PLUGIN_STYLUS_NAME, pluginStylus };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-stylus",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Stylus plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
-
"types": "./dist
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
16
|
"import": "./dist/index.js",
|
|
17
17
|
"require": "./dist/index.cjs"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"main": "./dist/index.cjs",
|
|
21
|
-
"types": "./dist
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
22
|
"files": [
|
|
23
|
-
"dist"
|
|
24
|
-
"dist-types"
|
|
23
|
+
"dist"
|
|
25
24
|
],
|
|
26
25
|
"dependencies": {
|
|
27
26
|
"deepmerge": "^4.3.1",
|
|
28
27
|
"reduce-configs": "^1.0.0",
|
|
29
28
|
"stylus": "0.63.0",
|
|
30
|
-
"stylus-loader": "8.1.
|
|
29
|
+
"stylus-loader": "8.1.1"
|
|
31
30
|
},
|
|
32
31
|
"devDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
32
|
+
"@types/node": "18.x",
|
|
33
|
+
"typescript": "^5.6.3",
|
|
34
|
+
"@rsbuild/core": "1.0.14",
|
|
35
35
|
"@scripts/test-helper": "1.0.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"registry": "https://registry.npmjs.org/"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "
|
|
47
|
-
"dev": "
|
|
46
|
+
"build": "rslib build",
|
|
47
|
+
"dev": "rslib build --watch"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/dist-types/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"//":"This file is for making TypeScript work with moduleResolution node16+.","version":"1.0.0"}
|