unplugin-stylex 0.5.3 → 0.5.5
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/CHANGELOG.md +12 -0
- package/dist/chunk-NQYXBBLC.cjs +434 -0
- package/dist/chunk-QPFVWZ5B.js +434 -0
- package/dist/esbuild.cjs +2 -2
- package/dist/esbuild.js +1 -1
- package/dist/farm.cjs +2 -2
- package/dist/farm.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rolldown.cjs +2 -2
- package/dist/rolldown.js +1 -1
- package/dist/rollup.cjs +2 -2
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +1 -1
- package/dist/vite.cjs +2 -2
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +2 -2
- package/dist/webpack.js +1 -1
- package/jsr.json +14 -2
- package/package.json +17 -17
- package/dist/chunk-3YYDUMQW.cjs +0 -196
- package/dist/chunk-MOKLFQZU.js +0 -196
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
import * as path2 from "node:path";
|
|
10
|
+
import { createUnplugin } from "unplugin";
|
|
11
|
+
|
|
12
|
+
// src/core/build.ts
|
|
13
|
+
import stylex from "@stylexjs/babel-plugin";
|
|
14
|
+
function buildStylexRules(stylexRules, useCSSLayers) {
|
|
15
|
+
const rules = Object.values(stylexRules).flat();
|
|
16
|
+
if (rules.length === 0) return "";
|
|
17
|
+
return stylex.processStylexRules(rules, useCSSLayers);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/utils/constants.ts
|
|
21
|
+
var PLUGIN_NAME = "unplugin-stylex";
|
|
22
|
+
var isDevelopment = process.env.NODE_ENV !== "production" || process.env.BABEL_ENV !== "production";
|
|
23
|
+
var EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".mts", ".cts"];
|
|
24
|
+
|
|
25
|
+
// src/utils/get-aliases.ts
|
|
26
|
+
import fs from "node:fs";
|
|
27
|
+
import path from "node:path";
|
|
28
|
+
function makePathAbsolute(value) {
|
|
29
|
+
return path.isAbsolute(value) ? value : path.resolve(process.cwd(), value);
|
|
30
|
+
}
|
|
31
|
+
function isTSProject() {
|
|
32
|
+
const tsConfigPath = path.resolve(process.cwd(), "tsconfig.json");
|
|
33
|
+
return fs.existsSync(tsConfigPath);
|
|
34
|
+
}
|
|
35
|
+
function getAliasesFromTSConfig() {
|
|
36
|
+
var _a;
|
|
37
|
+
if (!isTSProject()) {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const tsConfigPath = path.resolve(process.cwd(), "tsconfig.json");
|
|
42
|
+
const tsConfigContent = fs.readFileSync(tsConfigPath, "utf8");
|
|
43
|
+
const tsConfig = JSON.parse(tsConfigContent);
|
|
44
|
+
const paths = ((_a = tsConfig == null ? void 0 : tsConfig.compilerOptions) == null ? void 0 : _a.paths) || {};
|
|
45
|
+
const aliases = Object.entries(paths).reduce(
|
|
46
|
+
(acc, [key, value]) => {
|
|
47
|
+
acc[key] = Array.isArray(value) ? value.map(makePathAbsolute) : makePathAbsolute(value);
|
|
48
|
+
return acc;
|
|
49
|
+
},
|
|
50
|
+
{}
|
|
51
|
+
);
|
|
52
|
+
return Object.keys(aliases).length > 0 ? aliases : void 0;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function getAliasesFromViteConfig() {
|
|
58
|
+
var _a;
|
|
59
|
+
const configFiles = EXTENSIONS.map((ext) => `vite.config${ext}`);
|
|
60
|
+
const configPath = configFiles.find((file) => fs.existsSync(path.resolve(process.cwd(), file)));
|
|
61
|
+
if (!configPath) {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const configModule = __require(path.resolve(process.cwd(), configPath));
|
|
66
|
+
const config = typeof configModule === "function" ? configModule() : configModule.default || configModule;
|
|
67
|
+
const aliases = ((_a = config == null ? void 0 : config.resolve) == null ? void 0 : _a.alias) || {};
|
|
68
|
+
return Object.entries(aliases).reduce(
|
|
69
|
+
(acc, [key, value]) => {
|
|
70
|
+
acc[key] = makePathAbsolute(value);
|
|
71
|
+
return acc;
|
|
72
|
+
},
|
|
73
|
+
{}
|
|
74
|
+
);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function getAliasesFromWebpackConfig() {
|
|
80
|
+
var _a;
|
|
81
|
+
const configFiles = EXTENSIONS.map((ext) => `webpack.config${ext}`);
|
|
82
|
+
const configPath = configFiles.find((file) => fs.existsSync(path.resolve(process.cwd(), file)));
|
|
83
|
+
if (!configPath) {
|
|
84
|
+
return {};
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const configContent = fs.readFileSync(path.resolve(process.cwd(), configPath), "utf8");
|
|
88
|
+
const config = JSON.parse(configContent);
|
|
89
|
+
const aliases = ((_a = config == null ? void 0 : config.resolve) == null ? void 0 : _a.alias) || {};
|
|
90
|
+
return Object.entries(aliases).reduce(
|
|
91
|
+
(acc, [key, value]) => {
|
|
92
|
+
acc[key] = makePathAbsolute(value);
|
|
93
|
+
return acc;
|
|
94
|
+
},
|
|
95
|
+
{}
|
|
96
|
+
);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return {};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function getAliasesFromRollupConfig() {
|
|
102
|
+
var _a, _b;
|
|
103
|
+
const configFiles = EXTENSIONS.map((ext) => `rollup.config${ext}`);
|
|
104
|
+
const configPath = configFiles.find((file) => fs.existsSync(path.resolve(process.cwd(), file)));
|
|
105
|
+
if (!configPath) {
|
|
106
|
+
return {};
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const configModule = __require(path.resolve(process.cwd(), configPath));
|
|
110
|
+
const config = typeof configModule === "function" ? configModule() : configModule.default || configModule;
|
|
111
|
+
const aliasPlugin = (_a = config == null ? void 0 : config.plugins) == null ? void 0 : _a.find((plugin) => {
|
|
112
|
+
if (typeof plugin === "object" && plugin !== null) {
|
|
113
|
+
return plugin.name === "@rollup/plugin-alias";
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
});
|
|
117
|
+
if (!aliasPlugin) {
|
|
118
|
+
return {};
|
|
119
|
+
}
|
|
120
|
+
const aliases = ((_b = aliasPlugin == null ? void 0 : aliasPlugin.options) == null ? void 0 : _b.entries) || {};
|
|
121
|
+
return Object.entries(aliases).reduce(
|
|
122
|
+
(acc, [key, value]) => {
|
|
123
|
+
acc[key] = makePathAbsolute(value);
|
|
124
|
+
return acc;
|
|
125
|
+
},
|
|
126
|
+
{}
|
|
127
|
+
);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
return {};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function getAliasesFromRolldownConfig() {
|
|
133
|
+
var _a;
|
|
134
|
+
const configFiles = EXTENSIONS.map((ext) => `vite.config${ext}`);
|
|
135
|
+
const configPath = configFiles.find((file) => fs.existsSync(path.resolve(process.cwd(), file)));
|
|
136
|
+
if (!configPath) {
|
|
137
|
+
return {};
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const configModule = __require(path.resolve(process.cwd(), configPath));
|
|
141
|
+
const config = typeof configModule === "function" ? configModule() : configModule.default || configModule;
|
|
142
|
+
const aliases = ((_a = config == null ? void 0 : config.resolve) == null ? void 0 : _a.alias) || {};
|
|
143
|
+
return Object.entries(aliases).reduce(
|
|
144
|
+
(acc, [key, value]) => {
|
|
145
|
+
acc[key] = makePathAbsolute(value);
|
|
146
|
+
return acc;
|
|
147
|
+
},
|
|
148
|
+
{}
|
|
149
|
+
);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function getAliasesFromEsbuildConfig() {
|
|
155
|
+
return {};
|
|
156
|
+
}
|
|
157
|
+
function getAliasesFromRspackConfig() {
|
|
158
|
+
var _a;
|
|
159
|
+
const configFiles = EXTENSIONS.map((ext) => `rspack.config${ext}`);
|
|
160
|
+
const configPath = configFiles.find((file) => fs.existsSync(path.resolve(process.cwd(), file)));
|
|
161
|
+
if (!configPath) {
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
const configContent = fs.readFileSync(path.resolve(process.cwd(), configPath), "utf8");
|
|
166
|
+
const config = JSON.parse(configContent);
|
|
167
|
+
const aliases = ((_a = config == null ? void 0 : config.resolve) == null ? void 0 : _a.alias) || {};
|
|
168
|
+
return Object.entries(aliases).reduce(
|
|
169
|
+
(acc, [key, value]) => {
|
|
170
|
+
acc[key] = makePathAbsolute(value);
|
|
171
|
+
return acc;
|
|
172
|
+
},
|
|
173
|
+
{}
|
|
174
|
+
);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
return {};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function getAliasesFromFarmConfig() {
|
|
180
|
+
var _a;
|
|
181
|
+
const configFiles = EXTENSIONS.map((ext) => `farm.config${ext}`);
|
|
182
|
+
const configPath = configFiles.find((file) => fs.existsSync(path.resolve(process.cwd(), file)));
|
|
183
|
+
if (!configPath) {
|
|
184
|
+
return {};
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const configModule = __require(path.resolve(process.cwd(), configPath));
|
|
188
|
+
const config = typeof configModule === "function" ? configModule() : configModule.default || configModule;
|
|
189
|
+
const aliases = ((_a = config == null ? void 0 : config.resolve) == null ? void 0 : _a.alias) || {};
|
|
190
|
+
return Object.entries(aliases).reduce(
|
|
191
|
+
(acc, [key, value]) => {
|
|
192
|
+
acc[key] = makePathAbsolute(value);
|
|
193
|
+
return acc;
|
|
194
|
+
},
|
|
195
|
+
{}
|
|
196
|
+
);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
return {};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function getAliases(framework) {
|
|
202
|
+
const tsAliases = getAliasesFromTSConfig();
|
|
203
|
+
if (framework === "vite") {
|
|
204
|
+
const viteAliases = getAliasesFromViteConfig();
|
|
205
|
+
return {
|
|
206
|
+
...tsAliases,
|
|
207
|
+
...viteAliases
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (framework === "webpack") {
|
|
211
|
+
const webpackAliases = getAliasesFromWebpackConfig();
|
|
212
|
+
return {
|
|
213
|
+
...tsAliases,
|
|
214
|
+
...webpackAliases
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (framework === "rollup") {
|
|
218
|
+
const rollupAliases = getAliasesFromRollupConfig();
|
|
219
|
+
return {
|
|
220
|
+
...tsAliases,
|
|
221
|
+
...rollupAliases
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
if (framework === "rolldown") {
|
|
225
|
+
const rolldownAliases = getAliasesFromRolldownConfig();
|
|
226
|
+
return {
|
|
227
|
+
...tsAliases,
|
|
228
|
+
...rolldownAliases
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
if (framework === "esbuild") {
|
|
232
|
+
const esbuildAliases = getAliasesFromEsbuildConfig();
|
|
233
|
+
return {
|
|
234
|
+
...tsAliases,
|
|
235
|
+
...esbuildAliases
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
if (framework === "rspack") {
|
|
239
|
+
const rspackAliases = getAliasesFromRspackConfig();
|
|
240
|
+
return {
|
|
241
|
+
...tsAliases,
|
|
242
|
+
...rspackAliases
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
if (framework === "farm") {
|
|
246
|
+
const farmAliases = getAliasesFromFarmConfig();
|
|
247
|
+
return {
|
|
248
|
+
...tsAliases,
|
|
249
|
+
...farmAliases
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/core/options.ts
|
|
255
|
+
function getOptions(options) {
|
|
256
|
+
var _a, _b, _c;
|
|
257
|
+
const projectAliases = getAliases(options.framework);
|
|
258
|
+
const stylex2 = options.stylex || {};
|
|
259
|
+
const isDev = options.dev || isDevelopment;
|
|
260
|
+
return {
|
|
261
|
+
...options,
|
|
262
|
+
dev: isDev,
|
|
263
|
+
// .js, .jsx, .mjs, .cjs, .ts, .tsx, .mts, .cts
|
|
264
|
+
validExts: options.validExts ?? /\.[mc]?[jt]sx?$/,
|
|
265
|
+
stylex: {
|
|
266
|
+
filename: stylex2.filename || "stylex.css",
|
|
267
|
+
stylexImports: stylex2.stylexImports || ["@stylexjs/stylex"],
|
|
268
|
+
runtimeInjection: stylex2.runtimeInjection ?? isDev,
|
|
269
|
+
aliases: stylex2.aliases ?? projectAliases ?? {},
|
|
270
|
+
useCSSLayers: stylex2.useCSSLayers || false,
|
|
271
|
+
unstable_moduleResolution: stylex2.unstable_moduleResolution || { type: "commonJS", rootDir: process.cwd() },
|
|
272
|
+
babelConfig: {
|
|
273
|
+
babelrc: ((_a = stylex2.babelConfig) == null ? void 0 : _a.babelrc) ?? false,
|
|
274
|
+
plugins: ((_b = stylex2.babelConfig) == null ? void 0 : _b.plugins) ?? [],
|
|
275
|
+
presets: ((_c = stylex2.babelConfig) == null ? void 0 : _c.presets) ?? []
|
|
276
|
+
},
|
|
277
|
+
...stylex2
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// src/core/transformer.ts
|
|
283
|
+
import { extname as pathExtname } from "node:path";
|
|
284
|
+
import { transformAsync } from "@babel/core";
|
|
285
|
+
import jsxSyntaxPlugin from "@babel/plugin-syntax-jsx";
|
|
286
|
+
import stylexBabelPlugin from "@stylexjs/babel-plugin";
|
|
287
|
+
|
|
288
|
+
// src/core/plugins.ts
|
|
289
|
+
import flowSyntaxPlugin from "@babel/plugin-syntax-flow";
|
|
290
|
+
import typescriptSyntaxPlugin from "@babel/plugin-syntax-typescript";
|
|
291
|
+
function getSyntaxPlugins(extname2) {
|
|
292
|
+
const TSPlugin = extname2 === ".tsx" ? [[typescriptSyntaxPlugin, { isTSX: true }]] : [typescriptSyntaxPlugin];
|
|
293
|
+
return [".js", ".jsx"].includes(extname2) ? [flowSyntaxPlugin] : TSPlugin;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/core/transformer.ts
|
|
297
|
+
async function transformer(context) {
|
|
298
|
+
var _a, _b, _c, _d;
|
|
299
|
+
const { id, inputCode, options } = context;
|
|
300
|
+
const stylex2 = options.stylex;
|
|
301
|
+
const extname2 = pathExtname(id);
|
|
302
|
+
const stylexRules = {};
|
|
303
|
+
const stylexBabelPluginOptions = {
|
|
304
|
+
dev: options.dev,
|
|
305
|
+
importSources: stylex2.stylexImports,
|
|
306
|
+
...stylex2
|
|
307
|
+
};
|
|
308
|
+
const plugins = [
|
|
309
|
+
...((_a = stylex2.babelConfig) == null ? void 0 : _a.plugins) || [],
|
|
310
|
+
...getSyntaxPlugins(extname2),
|
|
311
|
+
jsxSyntaxPlugin,
|
|
312
|
+
stylexBabelPlugin.withOptions(stylexBabelPluginOptions)
|
|
313
|
+
];
|
|
314
|
+
const { code, map, metadata } = await transformAsync(inputCode, {
|
|
315
|
+
babelrc: (_b = stylex2.babelConfig) == null ? void 0 : _b.babelrc,
|
|
316
|
+
filename: id,
|
|
317
|
+
presets: (_c = stylex2.babelConfig) == null ? void 0 : _c.presets,
|
|
318
|
+
plugins
|
|
319
|
+
});
|
|
320
|
+
if (metadata.stylex && metadata.stylex.length > 0) {
|
|
321
|
+
stylexRules[id] = metadata.stylex;
|
|
322
|
+
}
|
|
323
|
+
if (!((_d = stylex2.babelConfig) == null ? void 0 : _d.babelrc)) {
|
|
324
|
+
return {
|
|
325
|
+
code,
|
|
326
|
+
// compatible for farm, null will occur an error
|
|
327
|
+
map: map || void 0,
|
|
328
|
+
stylexRules
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
return { code, stylexRules };
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// src/index.ts
|
|
335
|
+
var unpluginFactory = (rawOptions, meta) => {
|
|
336
|
+
const options = getOptions({ ...rawOptions || {}, framework: meta.framework });
|
|
337
|
+
const stylexRules = {};
|
|
338
|
+
let viteConfig = null;
|
|
339
|
+
return {
|
|
340
|
+
name: PLUGIN_NAME,
|
|
341
|
+
transformInclude(id) {
|
|
342
|
+
const validExts = options.validExts;
|
|
343
|
+
const extname2 = path2.extname(id);
|
|
344
|
+
const questionMarkIndex = extname2.indexOf("?");
|
|
345
|
+
const validExtName = questionMarkIndex > -1 ? extname2.slice(0, questionMarkIndex) : extname2;
|
|
346
|
+
return validExts instanceof RegExp ? validExts.test(validExtName) : validExts.includes(validExtName);
|
|
347
|
+
},
|
|
348
|
+
async transform(code, id) {
|
|
349
|
+
var _a;
|
|
350
|
+
const dir = path2.dirname(id);
|
|
351
|
+
const basename2 = path2.basename(id);
|
|
352
|
+
const file = path2.join(dir, basename2.includes("?") ? basename2.split("?")[0] : basename2);
|
|
353
|
+
if (!options.stylex.stylexImports.some((importName) => code.includes(importName))) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const context = {
|
|
357
|
+
id: file,
|
|
358
|
+
inputCode: code,
|
|
359
|
+
pluginContext: this,
|
|
360
|
+
options
|
|
361
|
+
};
|
|
362
|
+
try {
|
|
363
|
+
const result = await transformer(context);
|
|
364
|
+
if ((_a = result.stylexRules) == null ? void 0 : _a[id]) {
|
|
365
|
+
stylexRules[id] = result.stylexRules[id];
|
|
366
|
+
}
|
|
367
|
+
return result;
|
|
368
|
+
} catch (error) {
|
|
369
|
+
console.error("transform::error::", error);
|
|
370
|
+
this.error(error);
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
buildEnd() {
|
|
374
|
+
const fileName = options.stylex.filename;
|
|
375
|
+
const collectedCSS = buildStylexRules(stylexRules, options.stylex.useCSSLayers);
|
|
376
|
+
if (!collectedCSS) return;
|
|
377
|
+
this.emitFile({
|
|
378
|
+
fileName,
|
|
379
|
+
source: collectedCSS,
|
|
380
|
+
type: "asset"
|
|
381
|
+
});
|
|
382
|
+
},
|
|
383
|
+
vite: {
|
|
384
|
+
config(config) {
|
|
385
|
+
viteConfig = {
|
|
386
|
+
build: config.build,
|
|
387
|
+
base: config.base
|
|
388
|
+
};
|
|
389
|
+
},
|
|
390
|
+
configResolved(config) {
|
|
391
|
+
config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
|
|
392
|
+
config.optimizeDeps.exclude.push("@stylexjs/open-props");
|
|
393
|
+
},
|
|
394
|
+
buildEnd() {
|
|
395
|
+
var _a;
|
|
396
|
+
const fileName = `${((_a = viteConfig == null ? void 0 : viteConfig.build) == null ? void 0 : _a.assetsDir) ?? "assets"}/${options.stylex.filename}`;
|
|
397
|
+
const collectedCSS = buildStylexRules(stylexRules, options.stylex.useCSSLayers);
|
|
398
|
+
if (!collectedCSS) return;
|
|
399
|
+
this.emitFile({
|
|
400
|
+
fileName,
|
|
401
|
+
source: collectedCSS,
|
|
402
|
+
type: "asset"
|
|
403
|
+
});
|
|
404
|
+
},
|
|
405
|
+
transformIndexHtml(html, ctx) {
|
|
406
|
+
var _a, _b;
|
|
407
|
+
const fileName = `${((_a = viteConfig == null ? void 0 : viteConfig.build) == null ? void 0 : _a.assetsDir) ?? "assets"}/${options.stylex.filename}`;
|
|
408
|
+
const css = (_b = ctx.bundle) == null ? void 0 : _b[fileName];
|
|
409
|
+
if (!css) {
|
|
410
|
+
return html;
|
|
411
|
+
}
|
|
412
|
+
const publicPath = path2.posix.join((viteConfig == null ? void 0 : viteConfig.base) ?? "/", fileName.replace(/\\/g, "/"));
|
|
413
|
+
return [
|
|
414
|
+
{
|
|
415
|
+
tag: "link",
|
|
416
|
+
attrs: {
|
|
417
|
+
rel: "stylesheet",
|
|
418
|
+
href: publicPath
|
|
419
|
+
},
|
|
420
|
+
injectTo: "head"
|
|
421
|
+
}
|
|
422
|
+
];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
var unplugin = createUnplugin(unpluginFactory);
|
|
428
|
+
var index_default = unplugin;
|
|
429
|
+
|
|
430
|
+
export {
|
|
431
|
+
unpluginFactory,
|
|
432
|
+
unplugin,
|
|
433
|
+
index_default
|
|
434
|
+
};
|
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 _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
4
4
|
require('./chunk-ZBPRDZS4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/esbuild.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var esbuildPlugin = _unplugin.createEsbuildPlugin.call(void 0,
|
|
8
|
+
var esbuildPlugin = _unplugin.createEsbuildPlugin.call(void 0, _chunkNQYXBBLCcjs.unpluginFactory);
|
|
9
9
|
var esbuild_default = esbuildPlugin;
|
|
10
10
|
|
|
11
11
|
|
package/dist/esbuild.js
CHANGED
package/dist/farm.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
4
4
|
require('./chunk-ZBPRDZS4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/farm.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var farmPlugin = _unplugin.createFarmPlugin.call(void 0,
|
|
8
|
+
var farmPlugin = _unplugin.createFarmPlugin.call(void 0, _chunkNQYXBBLCcjs.unpluginFactory);
|
|
9
9
|
var farm_default = farmPlugin;
|
|
10
10
|
|
|
11
11
|
|
package/dist/farm.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
6
6
|
require('./chunk-ZBPRDZS4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.default =
|
|
11
|
+
exports.default = _chunkNQYXBBLCcjs.index_default; exports.unplugin = _chunkNQYXBBLCcjs.unplugin; exports.unpluginFactory = _chunkNQYXBBLCcjs.unpluginFactory;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/rolldown.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
4
4
|
require('./chunk-ZBPRDZS4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/rolldown.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var rolldownPlugin = _unplugin.createRolldownPlugin.call(void 0,
|
|
8
|
+
var rolldownPlugin = _unplugin.createRolldownPlugin.call(void 0, _chunkNQYXBBLCcjs.unpluginFactory);
|
|
9
9
|
var rolldown_default = rolldownPlugin;
|
|
10
10
|
|
|
11
11
|
|
package/dist/rolldown.js
CHANGED
package/dist/rollup.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
4
4
|
require('./chunk-ZBPRDZS4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/rollup.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var rollupPlugin = _unplugin.createRollupPlugin.call(void 0,
|
|
8
|
+
var rollupPlugin = _unplugin.createRollupPlugin.call(void 0, _chunkNQYXBBLCcjs.unpluginFactory);
|
|
9
9
|
var rollup_default = rollupPlugin;
|
|
10
10
|
|
|
11
11
|
|
package/dist/rollup.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 _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
4
4
|
require('./chunk-ZBPRDZS4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/rspack.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var rspackPlugin = _unplugin.createRspackPlugin.call(void 0,
|
|
8
|
+
var rspackPlugin = _unplugin.createRspackPlugin.call(void 0, _chunkNQYXBBLCcjs.unpluginFactory);
|
|
9
9
|
var rspack_default = rspackPlugin;
|
|
10
10
|
|
|
11
11
|
|
package/dist/rspack.js
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 _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
4
4
|
require('./chunk-ZBPRDZS4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/vite.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var vitePlugin = _unplugin.createVitePlugin.call(void 0,
|
|
8
|
+
var vitePlugin = _unplugin.createVitePlugin.call(void 0, _chunkNQYXBBLCcjs.unpluginFactory);
|
|
9
9
|
var vite_default = vitePlugin;
|
|
10
10
|
|
|
11
11
|
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNQYXBBLCcjs = require('./chunk-NQYXBBLC.cjs');
|
|
4
4
|
require('./chunk-ZBPRDZS4.cjs');
|
|
5
5
|
|
|
6
6
|
// src/webpack.ts
|
|
7
7
|
var _unplugin = require('unplugin');
|
|
8
|
-
var webpackPlugin = _unplugin.createWebpackPlugin.call(void 0,
|
|
8
|
+
var webpackPlugin = _unplugin.createWebpackPlugin.call(void 0, _chunkNQYXBBLCcjs.unpluginFactory);
|
|
9
9
|
var webpack_default = webpackPlugin;
|
|
10
10
|
|
|
11
11
|
|
package/dist/webpack.js
CHANGED
package/jsr.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eryue0220/unplugin-stylex",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./index": "./src/index.ts",
|
|
6
6
|
"./esbuild": "./src/esbuild.ts",
|
|
@@ -11,5 +11,17 @@
|
|
|
11
11
|
"./vite": "./src/vite.ts",
|
|
12
12
|
"./webpack": "./src/webpack.ts"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"imports": {
|
|
15
|
+
"@/types": "./src/types.ts",
|
|
16
|
+
"@/utils": "./src/utils/index.ts",
|
|
17
|
+
"@/utils/*": "./src/utils/*"
|
|
18
|
+
},
|
|
19
|
+
"exclude": [
|
|
20
|
+
".eslintrc.json",
|
|
21
|
+
".eslintignore",
|
|
22
|
+
"test",
|
|
23
|
+
"examples",
|
|
24
|
+
"pnpm-lock.yaml",
|
|
25
|
+
"pnpm-workspace.yaml"
|
|
26
|
+
]
|
|
15
27
|
}
|