unplugin-stylex 0.0.1 → 0.0.2
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/.eslintignore +4 -0
- package/.eslintrc.json +12 -1
- package/.github/actions/setup-and-cache/action.yml +18 -0
- package/.github/workflows/ci.yml +43 -0
- package/.github/workflows/release.yml +26 -0
- package/dist/{chunk-5FLQNHMU.cjs → chunk-D3OQCQYP.cjs} +26 -5
- package/dist/{chunk-R3ITJTXO.js → chunk-XQ5JPTTJ.js} +25 -4
- package/dist/esbuild.cjs +2 -2
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.d.cts +5 -1
- package/dist/rspack.d.ts +5 -1
- package/dist/rspack.js +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/vite.cjs +2 -2
- package/dist/vite.d.cts +5 -1
- package/dist/vite.d.ts +5 -1
- package/dist/vite.js +1 -1
- package/package.json +9 -2
- package/src/core/transformer.ts +1 -1
- package/src/core/utils.ts +1 -1
- package/src/index.ts +24 -3
- package/src/rspack.ts +1 -1
- package/src/types.ts +2 -2
- package/src/vite.ts +1 -1
- package/tsconfig.json +5 -0
- package/vitest.config.ts +13 -0
package/.eslintignore
ADDED
package/.eslintrc.json
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
+
"env": {
|
|
3
|
+
"node": true
|
|
4
|
+
},
|
|
5
|
+
"extends": [
|
|
6
|
+
"eslint:recommended",
|
|
7
|
+
"plugin:@typescript-eslint/recommended"
|
|
8
|
+
],
|
|
9
|
+
"parser": "@typescript-eslint/parser",
|
|
10
|
+
"plugins": ["@typescript-eslint"],
|
|
11
|
+
"root": true,
|
|
2
12
|
"rules": {
|
|
3
|
-
"semi":
|
|
13
|
+
"semi": "off",
|
|
14
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
4
15
|
}
|
|
5
16
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Setup and Cache
|
|
2
|
+
description: Setup for node, pnpm and cache for browser testing binaries
|
|
3
|
+
inputs:
|
|
4
|
+
node-version:
|
|
5
|
+
required: false
|
|
6
|
+
description: Node version for setup-node
|
|
7
|
+
default: 20.x
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
using: composite
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: install pnpm
|
|
14
|
+
uses: pnpm/action-setup@v2
|
|
15
|
+
- name: Set node version to ${{ inputs.node-version }}
|
|
16
|
+
uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: ${{ inputs.node-version }}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
lint:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: ./.github/actions/setup-and-cache
|
|
17
|
+
|
|
18
|
+
- name: Install
|
|
19
|
+
run: pnpm i
|
|
20
|
+
|
|
21
|
+
- name: Lint
|
|
22
|
+
run: pnpm run check
|
|
23
|
+
|
|
24
|
+
test:
|
|
25
|
+
runs-on: ${{ matrix.os }}
|
|
26
|
+
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
30
|
+
node: [16, 18, 20]
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
|
|
35
|
+
- uses: ./.github/actions/setup-and-cache
|
|
36
|
+
with:
|
|
37
|
+
node-version: ${{ matrix.node }}
|
|
38
|
+
|
|
39
|
+
- name: Install
|
|
40
|
+
run: pnpm i
|
|
41
|
+
|
|
42
|
+
- name: Unit Test
|
|
43
|
+
run: pnpm run test
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: write
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags:
|
|
9
|
+
- 'v*'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- name: Set node
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: lts/*
|
|
23
|
+
|
|
24
|
+
- run: npx changelogithub
|
|
25
|
+
env:
|
|
26
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var _chunkN4Z3Z2PUcjs = require('./chunk-N4Z3Z2PU.cjs');
|
|
@@ -41,11 +41,12 @@ var _pluginsyntaxjsx = require('@babel/plugin-syntax-jsx'); var _pluginsyntaxjsx
|
|
|
41
41
|
var _pluginsyntaxtypescript = require('@babel/plugin-syntax-typescript'); var _pluginsyntaxtypescript2 = _interopRequireDefault(_pluginsyntaxtypescript);
|
|
42
42
|
|
|
43
43
|
async function transformer(context) {
|
|
44
|
+
var _a, _b;
|
|
44
45
|
const { id, source, options } = context;
|
|
45
46
|
const stylex = options.stylex;
|
|
46
47
|
const extname2 = path.extname(id);
|
|
47
48
|
const stylexRules = {};
|
|
48
|
-
if (stylex.stylexImports.some((importName) => source.includes(importName))) {
|
|
49
|
+
if ((_b = (_a = stylex.stylexImports) == null ? void 0 : _a.some) == null ? void 0 : _b.call(_a, (importName) => source.includes(importName))) {
|
|
49
50
|
const originSource = stylex.babelConfig.babelrc ? await fs.readFile(id, "utf-8") : source;
|
|
50
51
|
const { code, map, metadata } = await _core.transformAsync.call(void 0,
|
|
51
52
|
originSource,
|
|
@@ -81,10 +82,11 @@ async function transformer(context) {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
// src/index.ts
|
|
84
|
-
var unpluginFactory = (rawOptions = {}
|
|
85
|
+
var unpluginFactory = (rawOptions = {}) => {
|
|
85
86
|
const options = getOptions(rawOptions);
|
|
86
87
|
const filter = _pluginutils.createFilter.call(void 0, options.include, options.exclude);
|
|
87
88
|
const stylexRules = {};
|
|
89
|
+
let viteBuildConfig = null;
|
|
88
90
|
return {
|
|
89
91
|
name: _chunkN4Z3Z2PUcjs.PLUGIN_NAME,
|
|
90
92
|
enforce: options.enforce,
|
|
@@ -110,10 +112,29 @@ var unpluginFactory = (rawOptions = {}, meta) => {
|
|
|
110
112
|
},
|
|
111
113
|
buildEnd() {
|
|
112
114
|
const rules = Object.values(stylexRules).flat();
|
|
113
|
-
if (rules.length
|
|
115
|
+
if (rules.length === 0)
|
|
116
|
+
return;
|
|
117
|
+
const collectedCSS = _babelplugin2.default.processStylexRules(rules, options.stylex.useCSSLayers);
|
|
118
|
+
const fileName = options.stylex.filename;
|
|
119
|
+
this.emitFile({
|
|
120
|
+
fileName,
|
|
121
|
+
source: collectedCSS,
|
|
122
|
+
type: "asset"
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
vite: {
|
|
126
|
+
config(config) {
|
|
127
|
+
viteBuildConfig = config.build;
|
|
128
|
+
},
|
|
129
|
+
buildEnd() {
|
|
130
|
+
var _a;
|
|
131
|
+
const rules = Object.values(stylexRules).flat();
|
|
132
|
+
if (!viteBuildConfig || rules.length === 0)
|
|
133
|
+
return;
|
|
114
134
|
const collectedCSS = _babelplugin2.default.processStylexRules(rules, options.stylex.useCSSLayers);
|
|
135
|
+
const fileName = `${_nullishCoalesce(((_a = viteBuildConfig.build) == null ? void 0 : _a.assetsDir), () => ( "assets"))}/${options.stylex.filename}`;
|
|
115
136
|
this.emitFile({
|
|
116
|
-
fileName
|
|
137
|
+
fileName,
|
|
117
138
|
source: collectedCSS,
|
|
118
139
|
type: "asset"
|
|
119
140
|
});
|
|
@@ -41,11 +41,12 @@ import jsxSyntaxPlugin from "@babel/plugin-syntax-jsx";
|
|
|
41
41
|
import typescriptSyntaxPlugin from "@babel/plugin-syntax-typescript";
|
|
42
42
|
import stylexBabelPlugin from "@stylexjs/babel-plugin";
|
|
43
43
|
async function transformer(context) {
|
|
44
|
+
var _a, _b;
|
|
44
45
|
const { id, source, options } = context;
|
|
45
46
|
const stylex = options.stylex;
|
|
46
47
|
const extname2 = path.extname(id);
|
|
47
48
|
const stylexRules = {};
|
|
48
|
-
if (stylex.stylexImports.some((importName) => source.includes(importName))) {
|
|
49
|
+
if ((_b = (_a = stylex.stylexImports) == null ? void 0 : _a.some) == null ? void 0 : _b.call(_a, (importName) => source.includes(importName))) {
|
|
49
50
|
const originSource = stylex.babelConfig.babelrc ? await fs.readFile(id, "utf-8") : source;
|
|
50
51
|
const { code, map, metadata } = await transformAsync(
|
|
51
52
|
originSource,
|
|
@@ -81,10 +82,11 @@ async function transformer(context) {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
// src/index.ts
|
|
84
|
-
var unpluginFactory = (rawOptions = {}
|
|
85
|
+
var unpluginFactory = (rawOptions = {}) => {
|
|
85
86
|
const options = getOptions(rawOptions);
|
|
86
87
|
const filter = createFilter(options.include, options.exclude);
|
|
87
88
|
const stylexRules = {};
|
|
89
|
+
let viteBuildConfig = null;
|
|
88
90
|
return {
|
|
89
91
|
name: PLUGIN_NAME,
|
|
90
92
|
enforce: options.enforce,
|
|
@@ -110,10 +112,29 @@ var unpluginFactory = (rawOptions = {}, meta) => {
|
|
|
110
112
|
},
|
|
111
113
|
buildEnd() {
|
|
112
114
|
const rules = Object.values(stylexRules).flat();
|
|
113
|
-
if (rules.length
|
|
115
|
+
if (rules.length === 0)
|
|
116
|
+
return;
|
|
117
|
+
const collectedCSS = stylexBabelPlugin2.processStylexRules(rules, options.stylex.useCSSLayers);
|
|
118
|
+
const fileName = options.stylex.filename;
|
|
119
|
+
this.emitFile({
|
|
120
|
+
fileName,
|
|
121
|
+
source: collectedCSS,
|
|
122
|
+
type: "asset"
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
vite: {
|
|
126
|
+
config(config) {
|
|
127
|
+
viteBuildConfig = config.build;
|
|
128
|
+
},
|
|
129
|
+
buildEnd() {
|
|
130
|
+
var _a;
|
|
131
|
+
const rules = Object.values(stylexRules).flat();
|
|
132
|
+
if (!viteBuildConfig || rules.length === 0)
|
|
133
|
+
return;
|
|
114
134
|
const collectedCSS = stylexBabelPlugin2.processStylexRules(rules, options.stylex.useCSSLayers);
|
|
135
|
+
const fileName = `${((_a = viteBuildConfig.build) == null ? void 0 : _a.assetsDir) ?? "assets"}/${options.stylex.filename}`;
|
|
115
136
|
this.emitFile({
|
|
116
|
-
fileName
|
|
137
|
+
fileName,
|
|
117
138
|
source: collectedCSS,
|
|
118
139
|
type: "asset"
|
|
119
140
|
});
|
package/dist/esbuild.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkD3OQCQYPcjs = require('./chunk-D3OQCQYP.cjs');
|
|
4
4
|
require('./chunk-N4Z3Z2PU.cjs');
|
|
5
5
|
|
|
6
6
|
// src/esbuild.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var esbuild_default = _unplugin.createEsbuildPlugin.call(void 0,
|
|
8
|
+
var esbuild_default = _unplugin.createEsbuildPlugin.call(void 0, _chunkD3OQCQYPcjs.unpluginFactory);
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
exports.default = esbuild_default;
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkD3OQCQYPcjs = require('./chunk-D3OQCQYP.cjs');
|
|
6
6
|
require('./chunk-N4Z3Z2PU.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.default =
|
|
11
|
+
exports.default = _chunkD3OQCQYPcjs.src_default; exports.unplugin = _chunkD3OQCQYPcjs.unplugin; exports.unpluginFactory = _chunkD3OQCQYPcjs.unpluginFactory;
|
package/dist/index.js
CHANGED
package/dist/rspack.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkD3OQCQYPcjs = require('./chunk-D3OQCQYP.cjs');
|
|
4
4
|
require('./chunk-N4Z3Z2PU.cjs');
|
|
5
5
|
|
|
6
6
|
// src/rspack.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var rspack_default = _unplugin.createRspackPlugin.call(void 0,
|
|
8
|
+
var rspack_default = _unplugin.createRspackPlugin.call(void 0, _chunkD3OQCQYPcjs.unpluginFactory);
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
exports.default = rspack_default;
|
package/dist/rspack.d.cts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginStylexOptions } from './types.cjs';
|
|
3
|
+
import '@rollup/pluginutils';
|
|
4
|
+
|
|
5
|
+
declare const _default: (options?: UnpluginStylexOptions) => unplugin.RspackPluginInstance;
|
|
2
6
|
|
|
3
7
|
export { _default as default };
|
package/dist/rspack.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginStylexOptions } from './types.js';
|
|
3
|
+
import '@rollup/pluginutils';
|
|
4
|
+
|
|
5
|
+
declare const _default: (options?: UnpluginStylexOptions) => unplugin.RspackPluginInstance;
|
|
2
6
|
|
|
3
7
|
export { _default as default };
|
package/dist/rspack.js
CHANGED
package/dist/types.d.cts
CHANGED
package/dist/types.d.ts
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkD3OQCQYPcjs = require('./chunk-D3OQCQYP.cjs');
|
|
4
4
|
require('./chunk-N4Z3Z2PU.cjs');
|
|
5
5
|
|
|
6
6
|
// src/vite.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var vite_default = _unplugin.createVitePlugin.call(void 0,
|
|
8
|
+
var vite_default = _unplugin.createVitePlugin.call(void 0, _chunkD3OQCQYPcjs.unpluginFactory);
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
exports.default = vite_default;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
import { UnpluginStylexOptions } from './types.cjs';
|
|
3
|
+
import '@rollup/pluginutils';
|
|
4
|
+
|
|
5
|
+
declare const _default: (options?: UnpluginStylexOptions) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
2
6
|
|
|
3
7
|
export { _default as default };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
import { UnpluginStylexOptions } from './types.js';
|
|
3
|
+
import '@rollup/pluginutils';
|
|
4
|
+
|
|
5
|
+
declare const _default: (options?: UnpluginStylexOptions) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
2
6
|
|
|
3
7
|
export { _default as default };
|
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-stylex",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"packageManager": "pnpm@8.11.0",
|
|
5
5
|
"description": "Unplugin for stylex",
|
|
6
6
|
"repository": "https://github.com/eryue0220/unplugin-stylex",
|
|
@@ -51,7 +51,10 @@
|
|
|
51
51
|
"build": "tsup src/*.ts --format cjs,esm --dts --splitting --clean",
|
|
52
52
|
"test": "vitest",
|
|
53
53
|
"test:update": "vitest -u",
|
|
54
|
-
"test:
|
|
54
|
+
"test:cov": "vitest --coverage",
|
|
55
|
+
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
|
|
56
|
+
"check": "pnpm run lint && pnpm run typecheck",
|
|
57
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
55
58
|
},
|
|
56
59
|
"engines": {
|
|
57
60
|
"node": ">=16.14.0"
|
|
@@ -67,6 +70,10 @@
|
|
|
67
70
|
},
|
|
68
71
|
"devDependencies": {
|
|
69
72
|
"@types/node": "^20.10.5",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
|
74
|
+
"@typescript-eslint/parser": "^6.16.0",
|
|
75
|
+
"@vitest/coverage-v8": "^1.1.1",
|
|
76
|
+
"eslint": "^8.56.0",
|
|
70
77
|
"tsup": "^8.0.1",
|
|
71
78
|
"typescript": "^5.3.3",
|
|
72
79
|
"vite": "^5.0.10",
|
package/src/core/transformer.ts
CHANGED
|
@@ -13,7 +13,7 @@ export async function transformer(context) {
|
|
|
13
13
|
const extname = path.extname(id)
|
|
14
14
|
const stylexRules = {}
|
|
15
15
|
|
|
16
|
-
if (stylex.stylexImports
|
|
16
|
+
if (stylex.stylexImports?.some?.((importName) => source.includes(importName))) {
|
|
17
17
|
const originSource = stylex.babelConfig.babelrc
|
|
18
18
|
? await fs.readFile(id, 'utf-8')
|
|
19
19
|
: source
|
package/src/core/utils.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,10 +8,11 @@ import { getOptions } from './core/utils'
|
|
|
8
8
|
import { transformer } from './core/transformer'
|
|
9
9
|
import type { UnpluginStylexOptions } from './types'
|
|
10
10
|
|
|
11
|
-
export const unpluginFactory: UnpluginFactory<UnpluginStylexOptions | undefined> = (rawOptions = {}
|
|
11
|
+
export const unpluginFactory: UnpluginFactory<UnpluginStylexOptions | undefined> = (rawOptions = {}) => {
|
|
12
12
|
const options = getOptions(rawOptions)
|
|
13
13
|
const filter = createFilter(options.include, options.exclude)
|
|
14
14
|
const stylexRules = {}
|
|
15
|
+
let viteBuildConfig = null
|
|
15
16
|
|
|
16
17
|
return {
|
|
17
18
|
name: PLUGIN_NAME,
|
|
@@ -44,10 +45,30 @@ export const unpluginFactory: UnpluginFactory<UnpluginStylexOptions | undefined>
|
|
|
44
45
|
|
|
45
46
|
buildEnd() {
|
|
46
47
|
const rules = Object.values(stylexRules).flat()
|
|
47
|
-
if (rules.length
|
|
48
|
+
if (rules.length === 0) return
|
|
49
|
+
|
|
50
|
+
const collectedCSS = (stylexBabelPlugin as any).processStylexRules(rules, options.stylex.useCSSLayers)
|
|
51
|
+
const fileName = options.stylex.filename
|
|
52
|
+
|
|
53
|
+
this.emitFile({
|
|
54
|
+
fileName,
|
|
55
|
+
source: collectedCSS,
|
|
56
|
+
type: 'asset',
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
vite: {
|
|
60
|
+
config(config) {
|
|
61
|
+
viteBuildConfig = config.build;
|
|
62
|
+
},
|
|
63
|
+
buildEnd() {
|
|
64
|
+
const rules = Object.values(stylexRules).flat()
|
|
65
|
+
if (!viteBuildConfig || rules.length === 0) return
|
|
66
|
+
|
|
48
67
|
const collectedCSS = (stylexBabelPlugin as any).processStylexRules(rules, options.stylex.useCSSLayers)
|
|
68
|
+
const fileName = `${viteBuildConfig.build?.assetsDir ?? 'assets'}/${options.stylex.filename}`
|
|
69
|
+
|
|
49
70
|
this.emitFile({
|
|
50
|
-
fileName
|
|
71
|
+
fileName,
|
|
51
72
|
source: collectedCSS,
|
|
52
73
|
type: 'asset',
|
|
53
74
|
})
|
package/src/rspack.ts
CHANGED
package/src/types.ts
CHANGED
package/src/vite.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -8,11 +8,16 @@
|
|
|
8
8
|
"lib": ["ESNext"],
|
|
9
9
|
"moduleResolution": "Node",
|
|
10
10
|
"preserveSymlinks": true,
|
|
11
|
+
"module": "esnext",
|
|
12
|
+
"skipLibCheck": true,
|
|
11
13
|
"paths": {
|
|
12
14
|
"@/*": ["./src/*"]
|
|
13
15
|
}
|
|
14
16
|
},
|
|
15
17
|
"include": [
|
|
16
18
|
"src"
|
|
19
|
+
],
|
|
20
|
+
"exclude": [
|
|
21
|
+
"node_modules"
|
|
17
22
|
]
|
|
18
23
|
}
|