unplugin-stylex 0.0.2 → 0.2.4

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.
Files changed (54) hide show
  1. package/.eslintrc.json +4 -6
  2. package/.github/renovate.json +27 -0
  3. package/.github/workflows/release.yml +13 -0
  4. package/.github/workflows/typos.yml +15 -0
  5. package/README.md +9 -7
  6. package/dist/chunk-6F4PWJZI.js +0 -0
  7. package/dist/chunk-7MXMBS5H.js +190 -0
  8. package/dist/chunk-NVMQARFA.cjs +190 -0
  9. package/dist/chunk-ZBPRDZS4.cjs +1 -0
  10. package/dist/esbuild.cjs +4 -2
  11. package/dist/esbuild.d.cts +10 -5
  12. package/dist/esbuild.d.ts +10 -5
  13. package/dist/esbuild.js +4 -2
  14. package/dist/index.cjs +3 -2
  15. package/dist/index.d.cts +4 -5
  16. package/dist/index.d.ts +4 -5
  17. package/dist/index.js +2 -1
  18. package/dist/rollup.cjs +1 -1
  19. package/dist/rollup.d.cts +12 -1
  20. package/dist/rollup.d.ts +12 -1
  21. package/dist/rollup.js +1 -1
  22. package/dist/rspack.cjs +4 -2
  23. package/dist/rspack.d.cts +11 -5
  24. package/dist/rspack.d.ts +11 -5
  25. package/dist/rspack.js +4 -2
  26. package/dist/types.cjs +1 -1
  27. package/dist/types.d.cts +7 -7
  28. package/dist/types.d.ts +7 -7
  29. package/dist/types.js +1 -0
  30. package/dist/vite.cjs +4 -2
  31. package/dist/vite.d.cts +10 -5
  32. package/dist/vite.d.ts +10 -5
  33. package/dist/vite.js +4 -2
  34. package/dist/webpack.cjs +1 -1
  35. package/dist/webpack.d.cts +12 -1
  36. package/dist/webpack.d.ts +12 -1
  37. package/dist/webpack.js +1 -1
  38. package/jsr.json +20 -0
  39. package/package.json +8 -3
  40. package/src/core/build.ts +9 -0
  41. package/src/core/{utils.ts → options.ts} +9 -9
  42. package/src/core/plugins.ts +12 -0
  43. package/src/core/transformer.ts +31 -48
  44. package/src/esbuild.ts +27 -2
  45. package/src/index.ts +64 -24
  46. package/src/rollup.ts +12 -2
  47. package/src/rspack.ts +27 -2
  48. package/src/types.ts +8 -7
  49. package/src/vite.ts +26 -2
  50. package/src/webpack.ts +12 -2
  51. package/typos.toml +10 -0
  52. package/vitest.config.ts +2 -2
  53. package/dist/chunk-D3OQCQYP.cjs +0 -152
  54. package/dist/chunk-XQ5JPTTJ.js +0 -152
package/dist/rollup.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  // src/rollup.ts
6
6
  var rollup_default = (options) => {
7
7
  if (isDevelopment || (options == null ? void 0 : options.dev)) {
8
- throw new Error(`If you want to use this plugin through rollup, please use "@stylexjs/rollup-plugin" instead`);
8
+ throw new Error('If you want to use this plugin through rollup, please use "@stylexjs/rollup-plugin" instead');
9
9
  }
10
10
  };
11
11
  export {
package/dist/rspack.cjs CHANGED
@@ -1,11 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkD3OQCQYPcjs = require('./chunk-D3OQCQYP.cjs');
3
+ var _chunkNVMQARFAcjs = require('./chunk-NVMQARFA.cjs');
4
+ require('./chunk-ZBPRDZS4.cjs');
4
5
  require('./chunk-N4Z3Z2PU.cjs');
5
6
 
6
7
  // src/rspack.ts
7
8
  var _unplugin = require('unplugin');
8
- var rspack_default = _unplugin.createRspackPlugin.call(void 0, _chunkD3OQCQYPcjs.unpluginFactory);
9
+ var rspackPlugin = _unplugin.createRspackPlugin.call(void 0, _chunkNVMQARFAcjs.unpluginFactory);
10
+ var rspack_default = rspackPlugin;
9
11
 
10
12
 
11
13
  exports.default = rspack_default;
package/dist/rspack.d.cts CHANGED
@@ -1,7 +1,13 @@
1
- import * as unplugin from 'unplugin';
2
- import { UnpluginStylexOptions } from './types.cjs';
3
- import '@rollup/pluginutils';
1
+ import { RspackPluginInstance } from 'unplugin';
2
+ import { UnpluginStylexInstance } from './types.cjs';
4
3
 
5
- declare const _default: (options?: UnpluginStylexOptions) => unplugin.RspackPluginInstance;
4
+ /**
5
+ * This entry file is for Rspac plugin.
6
+ *
7
+ * @module
8
+ */
6
9
 
7
- export { _default as default };
10
+ type RspackPluginType = UnpluginStylexInstance<RspackPluginInstance | RspackPluginInstance[]>;
11
+ declare const rspackPlugin: RspackPluginType;
12
+
13
+ export { rspackPlugin as default };
package/dist/rspack.d.ts CHANGED
@@ -1,7 +1,13 @@
1
- import * as unplugin from 'unplugin';
2
- import { UnpluginStylexOptions } from './types.js';
3
- import '@rollup/pluginutils';
1
+ import { RspackPluginInstance } from 'unplugin';
2
+ import { UnpluginStylexInstance } from './types.js';
4
3
 
5
- declare const _default: (options?: UnpluginStylexOptions) => unplugin.RspackPluginInstance;
4
+ /**
5
+ * This entry file is for Rspac plugin.
6
+ *
7
+ * @module
8
+ */
6
9
 
7
- export { _default as default };
10
+ type RspackPluginType = UnpluginStylexInstance<RspackPluginInstance | RspackPluginInstance[]>;
11
+ declare const rspackPlugin: RspackPluginType;
12
+
13
+ export { rspackPlugin as default };
package/dist/rspack.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-XQ5JPTTJ.js";
3
+ } from "./chunk-7MXMBS5H.js";
4
+ import "./chunk-6F4PWJZI.js";
4
5
  import "./chunk-36ARBXVP.js";
5
6
 
6
7
  // src/rspack.ts
7
8
  import { createRspackPlugin } from "unplugin";
8
- var rspack_default = createRspackPlugin(unpluginFactory);
9
+ var rspackPlugin = createRspackPlugin(unpluginFactory);
10
+ var rspack_default = rspackPlugin;
9
11
  export {
10
12
  rspack_default as default
11
13
  };
package/dist/types.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";require('./chunk-ZBPRDZS4.cjs');
package/dist/types.d.cts CHANGED
@@ -1,5 +1,3 @@
1
- import { FilterPattern } from '@rollup/pluginutils';
2
-
3
1
  type BabelConfig = {
4
2
  plugins: unknown[];
5
3
  presets: unknown[];
@@ -11,17 +9,19 @@ type StylexOptions = {
11
9
  classNamePrefix?: string;
12
10
  useCSSLayers?: boolean;
13
11
  unstable_moduleResolution?: {
14
- type: "commonjs" | "haste";
12
+ type: 'commonjs' | 'haste';
15
13
  rootDir: string;
16
14
  };
17
15
  babelConfig?: BabelConfig;
16
+ runtimeInjection: boolean;
17
+ aliases?: string[];
18
18
  };
19
19
  type UnpluginStylexOptions = {
20
+ compiler?: string;
20
21
  dev?: boolean;
21
- include?: FilterPattern;
22
- exclude?: FilterPattern;
23
- enforce?: "post" | "pre";
22
+ enforce?: 'post' | 'pre';
24
23
  stylex?: StylexOptions;
25
24
  };
25
+ type UnpluginStylexInstance<T> = (options?: UnpluginStylexOptions) => T;
26
26
 
27
- export type { BabelConfig, UnpluginStylexOptions };
27
+ export type { BabelConfig, StylexOptions, UnpluginStylexInstance, UnpluginStylexOptions };
package/dist/types.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { FilterPattern } from '@rollup/pluginutils';
2
-
3
1
  type BabelConfig = {
4
2
  plugins: unknown[];
5
3
  presets: unknown[];
@@ -11,17 +9,19 @@ type StylexOptions = {
11
9
  classNamePrefix?: string;
12
10
  useCSSLayers?: boolean;
13
11
  unstable_moduleResolution?: {
14
- type: "commonjs" | "haste";
12
+ type: 'commonjs' | 'haste';
15
13
  rootDir: string;
16
14
  };
17
15
  babelConfig?: BabelConfig;
16
+ runtimeInjection: boolean;
17
+ aliases?: string[];
18
18
  };
19
19
  type UnpluginStylexOptions = {
20
+ compiler?: string;
20
21
  dev?: boolean;
21
- include?: FilterPattern;
22
- exclude?: FilterPattern;
23
- enforce?: "post" | "pre";
22
+ enforce?: 'post' | 'pre';
24
23
  stylex?: StylexOptions;
25
24
  };
25
+ type UnpluginStylexInstance<T> = (options?: UnpluginStylexOptions) => T;
26
26
 
27
- export type { BabelConfig, UnpluginStylexOptions };
27
+ export type { BabelConfig, StylexOptions, UnpluginStylexInstance, UnpluginStylexOptions };
package/dist/types.js CHANGED
@@ -0,0 +1 @@
1
+ import "./chunk-6F4PWJZI.js";
package/dist/vite.cjs CHANGED
@@ -1,11 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkD3OQCQYPcjs = require('./chunk-D3OQCQYP.cjs');
3
+ var _chunkNVMQARFAcjs = require('./chunk-NVMQARFA.cjs');
4
+ require('./chunk-ZBPRDZS4.cjs');
4
5
  require('./chunk-N4Z3Z2PU.cjs');
5
6
 
6
7
  // src/vite.ts
7
8
  var _unplugin = require('unplugin');
8
- var vite_default = _unplugin.createVitePlugin.call(void 0, _chunkD3OQCQYPcjs.unpluginFactory);
9
+ var vitePlugin = _unplugin.createVitePlugin.call(void 0, _chunkNVMQARFAcjs.unpluginFactory);
10
+ var vite_default = vitePlugin;
9
11
 
10
12
 
11
13
  exports.default = vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,7 +1,12 @@
1
- import * as vite from 'vite';
2
- import { UnpluginStylexOptions } from './types.cjs';
3
- import '@rollup/pluginutils';
1
+ import { VitePlugin } from 'unplugin';
2
+ import { UnpluginStylexInstance } from './types.cjs';
4
3
 
5
- declare const _default: (options?: UnpluginStylexOptions) => vite.Plugin<any> | vite.Plugin<any>[];
4
+ /**
5
+ * This entry file is for Vite plugin.
6
+ *
7
+ * @module
8
+ */
6
9
 
7
- export { _default as default };
10
+ declare const vitePlugin: UnpluginStylexInstance<VitePlugin | VitePlugin[]>;
11
+
12
+ export { vitePlugin as default };
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,12 @@
1
- import * as vite from 'vite';
2
- import { UnpluginStylexOptions } from './types.js';
3
- import '@rollup/pluginutils';
1
+ import { VitePlugin } from 'unplugin';
2
+ import { UnpluginStylexInstance } from './types.js';
4
3
 
5
- declare const _default: (options?: UnpluginStylexOptions) => vite.Plugin<any> | vite.Plugin<any>[];
4
+ /**
5
+ * This entry file is for Vite plugin.
6
+ *
7
+ * @module
8
+ */
6
9
 
7
- export { _default as default };
10
+ declare const vitePlugin: UnpluginStylexInstance<VitePlugin | VitePlugin[]>;
11
+
12
+ export { vitePlugin as default };
package/dist/vite.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-XQ5JPTTJ.js";
3
+ } from "./chunk-7MXMBS5H.js";
4
+ import "./chunk-6F4PWJZI.js";
4
5
  import "./chunk-36ARBXVP.js";
5
6
 
6
7
  // src/vite.ts
7
8
  import { createVitePlugin } from "unplugin";
8
- var vite_default = createVitePlugin(unpluginFactory);
9
+ var vitePlugin = createVitePlugin(unpluginFactory);
10
+ var vite_default = vitePlugin;
9
11
  export {
10
12
  vite_default as default
11
13
  };
package/dist/webpack.cjs CHANGED
@@ -5,7 +5,7 @@ var _chunkN4Z3Z2PUcjs = require('./chunk-N4Z3Z2PU.cjs');
5
5
  // src/webpack.ts
6
6
  var webpack_default = (options) => {
7
7
  if (_chunkN4Z3Z2PUcjs.isDevelopment || (options == null ? void 0 : options.dev)) {
8
- throw new Error(`If you want to use this plugin through webpack, please use "@stylexjs/webpack-plugin" instead`);
8
+ throw new Error('If you want to use this plugin through webpack, please use "@stylexjs/webpack-plugin" instead');
9
9
  }
10
10
  };
11
11
 
@@ -1,3 +1,14 @@
1
- declare const _default: (options?: any) => void;
1
+ import { UnpluginStylexOptions } from './types.cjs';
2
+
3
+ /**
4
+ * This entry file is for Webpack plugin.
5
+ *
6
+ * @module
7
+ */
8
+
9
+ /**
10
+ * Note: Current, please use @stylexjs/webpack-plugin
11
+ */
12
+ declare const _default: (options?: UnpluginStylexOptions) => void;
2
13
 
3
14
  export { _default as default };
package/dist/webpack.d.ts CHANGED
@@ -1,3 +1,14 @@
1
- declare const _default: (options?: any) => void;
1
+ import { UnpluginStylexOptions } from './types.js';
2
+
3
+ /**
4
+ * This entry file is for Webpack plugin.
5
+ *
6
+ * @module
7
+ */
8
+
9
+ /**
10
+ * Note: Current, please use @stylexjs/webpack-plugin
11
+ */
12
+ declare const _default: (options?: UnpluginStylexOptions) => void;
2
13
 
3
14
  export { _default as default };
package/dist/webpack.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  // src/webpack.ts
6
6
  var webpack_default = (options) => {
7
7
  if (isDevelopment || (options == null ? void 0 : options.dev)) {
8
- throw new Error(`If you want to use this plugin through webpack, please use "@stylexjs/webpack-plugin" instead`);
8
+ throw new Error('If you want to use this plugin through webpack, please use "@stylexjs/webpack-plugin" instead');
9
9
  }
10
10
  };
11
11
  export {
package/jsr.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@eryue0220/unplugin-stylex",
3
+ "version": "0.2.4",
4
+ "exports": {
5
+ "./index": "./src/index.ts",
6
+ "./esbuild": "./src/esbuild.ts",
7
+ "./rollup": "./src/rollup.ts",
8
+ "./rspack": "./src/rspack.ts",
9
+ "./vite": "./src/vite.ts",
10
+ "./webpack": "./src/webpack.ts"
11
+ },
12
+ "exclude": [
13
+ ".eslintrc.json",
14
+ ".eslintignore",
15
+ "test",
16
+ "examples",
17
+ "pnpm-lock.yaml",
18
+ "pnpm-workspace.yaml"
19
+ ]
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-stylex",
3
- "version": "0.0.2",
3
+ "version": "0.2.4",
4
4
  "packageManager": "pnpm@8.11.0",
5
5
  "description": "Unplugin for stylex",
6
6
  "repository": "https://github.com/eryue0220/unplugin-stylex",
@@ -59,20 +59,25 @@
59
59
  "engines": {
60
60
  "node": ">=16.14.0"
61
61
  },
62
+ "peerDependencies": {
63
+ "@stylexjs/stylex": "^0.5.1"
64
+ },
62
65
  "dependencies": {
63
66
  "@babel/core": "^7.23.6",
64
67
  "@babel/plugin-syntax-flow": "^7.23.3",
65
68
  "@babel/plugin-syntax-jsx": "^7.23.3",
66
69
  "@babel/plugin-syntax-typescript": "^7.23.3",
67
70
  "@rollup/pluginutils": "^5.1.0",
68
- "@stylexjs/babel-plugin": "^0.3.0",
69
- "unplugin": "^1.5.1"
71
+ "@stylexjs/babel-plugin": "^0.5.1",
72
+ "unplugin": "^1.7.1"
70
73
  },
71
74
  "devDependencies": {
75
+ "@stylistic/eslint-plugin-ts": "^1.6.2",
72
76
  "@types/node": "^20.10.5",
73
77
  "@typescript-eslint/eslint-plugin": "^6.16.0",
74
78
  "@typescript-eslint/parser": "^6.16.0",
75
79
  "@vitest/coverage-v8": "^1.1.1",
80
+ "babel-plugin-syntax-hermes-parser": "^0.19.1",
76
81
  "eslint": "^8.56.0",
77
82
  "tsup": "^8.0.1",
78
83
  "typescript": "^5.3.3",
@@ -0,0 +1,9 @@
1
+ import stylex from '@stylexjs/babel-plugin'
2
+ import type { Rule } from '@stylexjs/babel-plugin'
3
+
4
+ export function buildStylexRules(stylexRules: { [key: string]: Rule[] }, useCSSLayers: boolean): string {
5
+ const rules = Object.values(stylexRules).flat()
6
+ if (rules.length === 0) return ''
7
+
8
+ return stylex.processStylexRules(rules, useCSSLayers)
9
+ }
@@ -1,19 +1,18 @@
1
- import type { UnpluginStylexOptions } from '@/types'
1
+ import type { StylexOptions, UnpluginStylexOptions } from '@/types'
2
2
  import { isDevelopment } from './constants'
3
3
 
4
- export function getOptions(options: UnpluginStylexOptions = ({} as UnpluginStylexOptions)) {
5
- const stylex = options.stylex || {}
4
+ export function getOptions(options: UnpluginStylexOptions) {
5
+ const stylex = options.stylex || ({} as StylexOptions)
6
+ const isDev = options.dev || isDevelopment
6
7
 
7
8
  return {
8
9
  ...options,
9
- dev: options.dev || isDevelopment,
10
- include: options.include || [/\.[jt]sx?$/],
11
- exclude: options.exclude || [/node_modules/, /\.git/],
12
- enforce: options.enforce || 'pre',
10
+ dev: options.dev || isDev,
13
11
  stylex: {
14
- ...stylex,
15
12
  filename: stylex.filename || 'stylex.css',
16
- stylexImports: stylex.stylexImports || ['stylex', '@stylexjs/stylex'],
13
+ stylexImports: stylex.stylexImports || ['@stylexjs/stylex'],
14
+ runtimeInjection: stylex.runtimeInjection ?? isDev,
15
+ aliases: stylex.aliases,
17
16
  useCSSLayers: stylex.useCSSLayers || false,
18
17
  unstable_moduleResolution: stylex.unstable_moduleResolution || { type: 'commonJS', rootDir: process.cwd() },
19
18
  babelConfig: {
@@ -21,6 +20,7 @@ export function getOptions(options: UnpluginStylexOptions = ({} as UnpluginStyle
21
20
  plugins: (stylex.babelConfig || {}).plugins || [],
22
21
  presets: (stylex.babelConfig || {}).presets || [],
23
22
  },
23
+ ...stylex,
24
24
  },
25
25
  }
26
26
  }
@@ -0,0 +1,12 @@
1
+ import typescriptSyntaxPlugin from '@babel/plugin-syntax-typescript'
2
+ import flowSyntaxPlugin from '@babel/plugin-syntax-flow'
3
+
4
+ export function getSyntaxPlugins(extname: string) {
5
+ const TSPlugin = extname === '.tsx'
6
+ ? [[typescriptSyntaxPlugin, { isTSX: true }]]
7
+ : [typescriptSyntaxPlugin]
8
+
9
+ return ['.js', '.jsx'].includes(extname)
10
+ ? [flowSyntaxPlugin]
11
+ : TSPlugin
12
+ }
@@ -1,61 +1,44 @@
1
- import * as fs from 'fs/promises'
2
- import * as path from 'path'
3
-
1
+ import { extname as pathExtname } from 'node:path'
4
2
  import { transformAsync } from '@babel/core'
5
- import flowSyntaxPlugin from '@babel/plugin-syntax-flow'
6
3
  import jsxSyntaxPlugin from '@babel/plugin-syntax-jsx'
7
- import typescriptSyntaxPlugin from '@babel/plugin-syntax-typescript'
8
4
  import stylexBabelPlugin from '@stylexjs/babel-plugin'
9
5
 
6
+ import { getSyntaxPlugins } from './plugins'
7
+
10
8
  export async function transformer(context) {
11
- const { id, source, options } = context
9
+ const { id, inputCode, options } = context
12
10
  const stylex = options.stylex
13
- const extname = path.extname(id)
11
+ const extname = pathExtname(id)
14
12
  const stylexRules = {}
15
-
16
- if (stylex.stylexImports?.some?.((importName) => source.includes(importName))) {
17
- const originSource = stylex.babelConfig.babelrc
18
- ? await fs.readFile(id, 'utf-8')
19
- : source
20
-
21
- const { code, map, metadata } = await transformAsync(
22
- originSource,
23
- {
24
- babelrc: stylex.babelConfig.babelrc,
25
- filename: id,
26
- plugins: [
27
- ...(stylex.babelConfig.plugins || []),
28
- extname === '.ts'
29
- ? typescriptSyntaxPlugin
30
- : extname === '.tsx'
31
- ? [typescriptSyntaxPlugin, { isTSX: true }]
32
- : flowSyntaxPlugin,
33
-
34
- jsxSyntaxPlugin,
35
- [
36
- stylexBabelPlugin,
37
- {
38
- dev: options.dev,
39
- unstable_moduleResolution: stylex.unstable_moduleResolution,
40
- importSources: stylex.stylexImports,
41
- ...stylex,
42
- }
43
- ],
44
- ],
45
- presets: stylex.babelConfig.presets,
46
- }
47
- )
48
-
49
- if (metadata.stylex && metadata.stylex.length > 0) {
50
- stylexRules[id] = metadata.stylex
13
+ const stylexBabelPluginOptions = {
14
+ dev: options.dev,
15
+ importSources: stylex.stylexImports,
16
+ ...stylex,
17
+ }
18
+ const plugins = [
19
+ ...(stylex.babelConfig?.plugins || []),
20
+ ...getSyntaxPlugins(extname),
21
+ jsxSyntaxPlugin,
22
+ stylexBabelPlugin.withOptions(stylexBabelPluginOptions),
23
+ ]
24
+
25
+ const { code, map, metadata } = await transformAsync(
26
+ inputCode,
27
+ {
28
+ babelrc: stylex.babelConfig?.babelrc,
29
+ filename: id,
30
+ presets: stylex.babelConfig?.presets,
31
+ plugins,
51
32
  }
33
+ )
52
34
 
53
- if (!stylex.babelConfig.babelrc) {
54
- return { code, map, stylexRules }
55
- }
35
+ if (metadata.stylex && metadata.stylex.length > 0) {
36
+ stylexRules[id] = metadata.stylex
37
+ }
56
38
 
57
- return { code, stylexRules }
39
+ if (!stylex.babelConfig?.babelrc) {
40
+ return { code, map, stylexRules }
58
41
  }
59
42
 
60
- return { code: source }
43
+ return { code, stylexRules }
61
44
  }
package/src/esbuild.ts CHANGED
@@ -1,4 +1,29 @@
1
+ /**
2
+ * This entry file is for esbuild plugin. Requires esbuild >= 0.15
3
+ *
4
+ * @module
5
+ */
6
+
1
7
  import { createEsbuildPlugin } from 'unplugin'
2
- import { unpluginFactory } from '.'
8
+ import type { EsbuildPlugin } from 'unplugin'
9
+ import { unpluginFactory } from './index'
10
+ import type { UnpluginStylexInstance } from './types'
11
+
12
+ const esbuildPlugin: UnpluginStylexInstance<EsbuildPlugin | EsbuildPlugin[]> = createEsbuildPlugin(unpluginFactory)
13
+
3
14
 
4
- export default createEsbuildPlugin(unpluginFactory)
15
+ /**
16
+ * Esbuild plugin
17
+ *
18
+ * @example
19
+ *
20
+ * import { build } from 'esbuild'
21
+ * import stylexPlugin from 'unplugin-stylex/esbuild'
22
+ *
23
+ * export default {
24
+ * plugins: [
25
+ * stylexPlugin(),
26
+ * ],
27
+ * }
28
+ */
29
+ export default esbuildPlugin