@rsbuild/plugin-stylus 1.0.2 → 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 CHANGED
@@ -1,71 +1,96 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- PLUGIN_STYLUS_NAME: () => PLUGIN_STYLUS_NAME,
34
- pluginStylus: () => pluginStylus
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
- module.exports = __toCommonJS(src_exports);
37
- var import_deepmerge = __toESM(require("deepmerge"));
38
- var import_reduce_configs = require("reduce-configs");
39
- var PLUGIN_STYLUS_NAME = "rsbuild:stylus";
40
- var pluginStylus = (options) => ({
41
- name: PLUGIN_STYLUS_NAME,
42
- setup(api) {
43
- api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
44
- const { config } = environment;
45
- const mergedOptions = (0, import_reduce_configs.reduceConfigs)({
46
- initial: {
47
- sourceMap: config.output.sourceMap.css
48
- },
49
- config: options,
50
- mergeFn: import_deepmerge.default
51
- });
52
- const rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({ sideEffects: true }).resolve.preferRelative(true).end();
53
- const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
54
- for (const id of Object.keys(cssRule.uses.entries())) {
55
- const loader = cssRule.uses.get(id);
56
- const options2 = loader.get("options") ?? {};
57
- const clonedOptions = (0, import_deepmerge.default)({}, options2);
58
- if (id === CHAIN_ID.USE.CSS) {
59
- clonedOptions.importLoaders += 1;
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
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
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 { createRequire } from 'module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined")
8
- return require.apply(this, arguments);
9
- throw Error('Dynamic require of "' + x + '" is not supported');
10
- });
11
-
12
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.59.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
13
- import path from "path";
14
- import { fileURLToPath } from "url";
15
-
16
- // src/index.ts
17
- import deepmerge from "deepmerge";
18
- import { reduceConfigs } from "reduce-configs";
19
- var PLUGIN_STYLUS_NAME = "rsbuild:stylus";
20
- var pluginStylus = (options) => ({
21
- name: PLUGIN_STYLUS_NAME,
22
- setup(api) {
23
- api.modifyBundlerChain(async (chain, { CHAIN_ID, environment }) => {
24
- const { config } = environment;
25
- const mergedOptions = reduceConfigs({
26
- initial: {
27
- sourceMap: config.output.sourceMap.css
28
- },
29
- config: options,
30
- mergeFn: deepmerge
31
- });
32
- const rule = chain.module.rule(CHAIN_ID.RULE.STYLUS).test(/\.styl(us)?$/).merge({ sideEffects: true }).resolve.preferRelative(true).end();
33
- const cssRule = chain.module.rules.get(CHAIN_ID.RULE.CSS);
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.2",
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-types/index.d.ts",
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-types/index.d.ts",
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.0"
29
+ "stylus-loader": "8.1.1"
31
30
  },
32
31
  "devDependencies": {
33
- "typescript": "^5.5.2",
34
- "@rsbuild/core": "1.0.2",
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": "modern build",
47
- "dev": "modern build --watch"
46
+ "build": "rslib build",
47
+ "dev": "rslib build --watch"
48
48
  }
49
49
  }
@@ -1 +0,0 @@
1
- {"//":"This file is for making TypeScript work with moduleResolution node16+.","version":"1.0.0"}
File without changes