@stylexswc/webpack-plugin 0.17.0-rc.1 → 0.17.0-rc.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.d.ts CHANGED
@@ -3,6 +3,8 @@ import type { TransformedOptions } from '@stylexswc/rs-compiler';
3
3
  import type webpack from 'webpack';
4
4
  import type { Rule as StyleXRule } from '@stylexjs/babel-plugin';
5
5
  import type { CSSTransformer, StyleXPluginOption, StyleXWebpackLoaderOptions, CacheGroupOptions } from './types';
6
+ declare const stylexLoaderPath: string;
7
+ declare const stylexVirtualLoaderPath: string;
6
8
  export type RegisterStyleXRules = (_resourcePath: string, _stylexRules: StyleXRule[]) => void;
7
9
  export default class StyleXPlugin {
8
10
  stylexRules: Map<string, readonly StyleXRule[]>;
@@ -15,5 +17,6 @@ export default class StyleXPlugin {
15
17
  apply(compiler: webpack.Compiler): void;
16
18
  }
17
19
  export { VIRTUAL_CSS_PATTERN, STYLEX_CHUNK_NAME };
20
+ export { stylexLoaderPath as loader, stylexVirtualLoaderPath as virtualLoader };
18
21
  export type { StyleXPluginOption, CacheGroupOptions } from './types';
19
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,iBAAiB,EAEjB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAE1B,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAqBjB,MAAM,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,E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,qCAA4C;IACvD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,YAAY,EAAE,0BAA0B,CAAC;IACzC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,cAAc,CAAC;IAC7B,WAAW,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;gBACnC,EACV,aAA8C,EAC9C,YAAoB,EACpB,SAAc,EACd,UAAkB,EAClB,YAAgC,EAChC,UAAiB,EACjB,WAAqB,EACrB,UAAU,GACX,GAAE,kBAAuB;IAyB1B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ;CAuKjC;AAED,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;AAGlD,OAAO,EAAE,gBAAgB,IAAI,MAAM,EAAE,uBAAuB,IAAI,aAAa,EAAE,CAAC;AAEhF,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -3,15 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.STYLEX_CHUNK_NAME = exports.VIRTUAL_CSS_PATTERN = void 0;
6
+ exports.virtualLoader = exports.loader = exports.STYLEX_CHUNK_NAME = exports.VIRTUAL_CSS_PATTERN = void 0;
7
7
  const babel_plugin_1 = __importDefault(require("@stylexjs/babel-plugin"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const constants_1 = require("./constants");
10
10
  Object.defineProperty(exports, "STYLEX_CHUNK_NAME", { enumerable: true, get: function () { return constants_1.STYLEX_CHUNK_NAME; } });
11
11
  Object.defineProperty(exports, "VIRTUAL_CSS_PATTERN", { enumerable: true, get: function () { return constants_1.VIRTUAL_CSS_PATTERN; } });
12
12
  const rs_compiler_1 = require("@stylexswc/rs-compiler");
13
- const stylexLoaderPath = require.resolve('./stylex-loader');
14
- const stylexVirtualLoaderPath = require.resolve('./stylex-virtual-css-loader');
13
+ function resolveLoaderPath(loaderName) {
14
+ try {
15
+ return require.resolve(`./${loaderName}`);
16
+ }
17
+ catch (error) {
18
+ const isModuleNotFound = error instanceof Error && 'code' in error && error.code === 'MODULE_NOT_FOUND';
19
+ if (!isModuleNotFound) {
20
+ throw error;
21
+ }
22
+ // Loaders resolve as `.ts` only when the plugin runs from source (e.g. vitest);
23
+ // published dist builds always resolve above
24
+ return require.resolve(`./${loaderName}.ts`);
25
+ }
26
+ }
27
+ const stylexLoaderPath = resolveLoaderPath('stylex-loader');
28
+ exports.loader = stylexLoaderPath;
29
+ const stylexVirtualLoaderPath = resolveLoaderPath('stylex-virtual-css-loader');
30
+ exports.virtualLoader = stylexVirtualLoaderPath;
15
31
  const getStyleXRules = (stylexRules, transformedOptions) => {
16
32
  if (stylexRules.size === 0) {
17
33
  return null;
@@ -175,9 +191,14 @@ class StyleXPlugin {
175
191
  }
176
192
  }
177
193
  exports.default = StyleXPlugin;
178
- module.exports = StyleXPlugin;
179
- module.exports.default = StyleXPlugin;
180
- module.exports.loader = stylexLoaderPath;
181
- module.exports.virtualLoader = stylexVirtualLoaderPath;
182
- module.exports.VIRTUAL_CSS_PATTERN = constants_1.VIRTUAL_CSS_PATTERN;
183
- module.exports.STYLEX_CHUNK_NAME = constants_1.STYLEX_CHUNK_NAME;
194
+ // Skipped when `module.exports` is an ES module namespace (frozen, cannot be
195
+ // reassigned) — the ESM exports above provide the same surface there
196
+ if (typeof module !== 'undefined' &&
197
+ Object.prototype.toString.call(module.exports) !== '[object Module]') {
198
+ module.exports = StyleXPlugin;
199
+ module.exports.default = StyleXPlugin;
200
+ module.exports.loader = stylexLoaderPath;
201
+ module.exports.virtualLoader = stylexVirtualLoaderPath;
202
+ module.exports.VIRTUAL_CSS_PATTERN = constants_1.VIRTUAL_CSS_PATTERN;
203
+ module.exports.STYLEX_CHUNK_NAME = constants_1.STYLEX_CHUNK_NAME;
204
+ }
package/package.json CHANGED
@@ -1,17 +1,7 @@
1
1
  {
2
2
  "name": "@stylexswc/webpack-plugin",
3
3
  "description": "StyleX webpack plugin with NAPI-RS compiler",
4
- "version": "0.17.0-rc.1",
5
- "private": false,
6
- "license": "MIT",
7
- "sideEffects": false,
8
- "files": [
9
- "dist"
10
- ],
11
- "publishConfig": {
12
- "registry": "https://registry.npmjs.org/",
13
- "access": "public"
14
- },
4
+ "version": "0.17.0-rc.3",
15
5
  "config": {
16
6
  "scripty": {
17
7
  "path": "../../scripts/packages"
@@ -19,25 +9,36 @@
19
9
  },
20
10
  "dependencies": {
21
11
  "@stylexjs/babel-plugin": "^0.19.0",
22
- "@stylexswc/rs-compiler": "0.17.0-rc.1",
12
+ "@stylexswc/rs-compiler": "0.17.0-rc.3",
23
13
  "loader-utils": "^3.3.1"
24
14
  },
25
15
  "devDependencies": {
26
- "@stylexswc/eslint-config": "0.17.0-rc.1",
27
- "@stylexswc/typescript-config": "0.17.0-rc.1",
16
+ "@stylexswc/eslint-config": "0.17.0-rc.3",
17
+ "@stylexswc/typescript-config": "0.17.0-rc.3",
28
18
  "@types/loader-utils": "^3.0.0",
29
- "@types/node": "^25.9.1",
30
- "mini-css-extract-plugin": "^2.10.0",
31
- "webpack": "^5.107.2"
19
+ "@types/node": "^26.1.0",
20
+ "mini-css-extract-plugin": "^2.10.2",
21
+ "vitest": "^4.1.9",
22
+ "webpack": "^5.108.3"
32
23
  },
24
+ "files": [
25
+ "dist"
26
+ ],
33
27
  "keywords": [
34
28
  "stylex",
35
29
  "swc",
36
30
  "webpack",
37
31
  "webpack-plugin"
38
32
  ],
33
+ "license": "MIT",
39
34
  "main": "dist/index.js",
35
+ "private": false,
36
+ "publishConfig": {
37
+ "registry": "https://registry.npmjs.org/",
38
+ "access": "public"
39
+ },
40
40
  "repository": "https://github.com/Dwlad90/stylex-swc-plugin",
41
+ "sideEffects": false,
41
42
  "scripts": {
42
43
  "build": "scripty --ts",
43
44
  "check:artifacts": "scripty",
@@ -47,7 +48,7 @@
47
48
  "postbuild": "pnpm run check:artifacts",
48
49
  "precommit": "lint-staged",
49
50
  "prepush": "lint-prepush",
50
- "test": "echo \"Error: no test specified\" && exit 0",
51
+ "test": "vitest run",
51
52
  "typecheck": "scripty --ts"
52
53
  }
53
54
  }