@voidzero-dev/vite-plus-core 0.2.1 → 0.2.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.
Files changed (66) hide show
  1. package/LICENSE +175 -30
  2. package/dist/rolldown/cli.mjs +25 -14
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +15 -5
  6. package/dist/rolldown/experimental-index.mjs +23 -17
  7. package/dist/rolldown/filter-index.d.mts +1 -1
  8. package/dist/rolldown/index.d.mts +2 -2
  9. package/dist/rolldown/index.mjs +4 -4
  10. package/dist/rolldown/parallel-plugin-worker.mjs +5 -4
  11. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  12. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  13. package/dist/rolldown/parse-ast-index.mjs +1 -1
  14. package/dist/rolldown/plugins-index.d.mts +3 -3
  15. package/dist/rolldown/plugins-index.mjs +2 -2
  16. package/dist/rolldown/shared/{binding-DgGsNpT9.d.mts → binding-B1q9aYT-.d.mts} +65 -142
  17. package/dist/rolldown/shared/{binding-CfwqjDbP.mjs → binding-BmkJW3Wy.mjs} +39 -35
  18. package/dist/rolldown/shared/{bindingify-input-options--chmbDhw.mjs → bindingify-input-options-Cmm60vfj.mjs} +1330 -1331
  19. package/dist/rolldown/shared/{constructors-Bx1tSad6.d.mts → constructors-2i1T9YcF.d.mts} +3 -4
  20. package/dist/rolldown/shared/{constructors-DnT9y_13.mjs → constructors-CE6zZSUt.mjs} +2 -5
  21. package/dist/rolldown/shared/{define-config-ChOOV2QZ.d.mts → define-config-BBz954-q.d.mts} +2 -2
  22. package/dist/rolldown/shared/{error-C0TrL0_H.mjs → error-BlQ0-ek7.mjs} +1 -1
  23. package/dist/rolldown/shared/{load-config-BXgGQtnA.mjs → load-config-CVVMWSlg.mjs} +1 -1
  24. package/dist/rolldown/shared/{normalize-string-or-regex-DGbe3BlX.mjs → normalize-string-or-regex-BYkbbGqQ.mjs} +1 -1
  25. package/dist/rolldown/shared/{parse-26ORR8fZ.mjs → parse-Dphnedsw.mjs} +2 -2
  26. package/dist/rolldown/shared/{prompt-DV1XbtjC.mjs → prompt-Bgj-uEyc.mjs} +5 -5
  27. package/dist/rolldown/shared/{resolve-tsconfig-D3YLh9ff.mjs → resolve-tsconfig-CdIAR1Eb.mjs} +2 -2
  28. package/dist/rolldown/shared/{rolldown-DpXXI00f.mjs → rolldown-Bnp916iM.mjs} +1 -1
  29. package/dist/rolldown/shared/{rolldown-build-D8R4Zzfy.mjs → rolldown-build-Cs2iVJuw.mjs} +24 -56
  30. package/dist/rolldown/shared/{transform-C-XSNVrd.d.mts → transform-CEmFsvJW.d.mts} +1 -1
  31. package/dist/rolldown/shared/{watch-D5Zm0Vsz.mjs → watch-ECGr-_QS.mjs} +4 -4
  32. package/dist/rolldown/utils-index.d.mts +3 -3
  33. package/dist/rolldown/utils-index.mjs +6 -6
  34. package/dist/tsdown/{build-B_nvJe4A-BkmlHYK-.js → build-B_nvJe4A-CcOht0gr.js} +30 -96
  35. package/dist/tsdown/debug-DLdR-9XB-CDf7D82m.js +250 -0
  36. package/dist/tsdown/{detect-B97OSl92-B5bcx_Ya.js → detect-B97OSl92-kGHGL-qU.js} +1 -1
  37. package/dist/tsdown/{dist-4h5bgYzo.js → dist-580owkGv.js} +30 -25
  38. package/dist/tsdown/general-Cp4NiJNK-BYPTHEzb.js +97 -0
  39. package/dist/tsdown/index-types.d.ts +197 -7
  40. package/dist/tsdown/index.js +3 -3
  41. package/dist/tsdown/internal-CUXleGMS.js +3 -0
  42. package/dist/tsdown/{main-BMtwTklr.js → main-BlTcyuFi.js} +2 -341
  43. package/dist/tsdown/npm_entry_picomatch.cjs +4 -2
  44. package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +5 -1
  45. package/dist/tsdown/{resolver-DtsKFXi2-DQOmVgSY.js → resolver-DtsKFXi2-B8Z3WwZh.js} +1 -1
  46. package/dist/tsdown/run.js +4 -3
  47. package/dist/tsdown/src-njF8VL4a.js +622 -0
  48. package/dist/tsdown/target-CqeSqtms-ZU1Gv6-M.js +79 -0
  49. package/dist/tsdown/{tsc-15OYetCl.js → tsc-CsN85f7a.js} +3 -3
  50. package/dist/tsdown/{tsc-context-DfwSQt2q.js → tsc-context-CX_GXdyS.js} +2 -2
  51. package/dist/tsdown/tsdown-css.js +874 -0
  52. package/dist/tsdown/tsdown-exe.js +949 -0
  53. package/dist/vite/client/client.mjs +7 -9
  54. package/dist/vite/client.d.ts +3 -0
  55. package/dist/vite/node/chunks/build.js +27 -34
  56. package/dist/vite/node/chunks/dist.js +23 -23
  57. package/dist/vite/node/chunks/dist2.js +3 -3
  58. package/dist/vite/node/chunks/logger.js +4 -4
  59. package/dist/vite/node/chunks/node.js +12354 -11629
  60. package/dist/vite/node/chunks/postcss-import.js +10 -10
  61. package/dist/vite/node/cli.js +3 -3
  62. package/dist/vite/node/index.d.ts +139 -14
  63. package/dist/vite/node/index.js +1 -1
  64. package/dist/vite/node/module-runner.js +4 -4
  65. package/dist/vite/types/importGlob.d.ts +48 -6
  66. package/package.json +14 -20
@@ -0,0 +1,622 @@
1
+ import { d as __commonJSMin, p as __require } from "./general-Cp4NiJNK-BYPTHEzb.js";
2
+ //#region ../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js
3
+ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ const path = __require("path");
5
+ const fs = __require("fs");
6
+ const os = __require("os");
7
+ const url = __require("url");
8
+ const fsReadFileAsync = fs.promises.readFile;
9
+ /** @type {(name: string, sync: boolean) => string[]} */
10
+ function getDefaultSearchPlaces(name, sync) {
11
+ return [
12
+ "package.json",
13
+ `.${name}rc.json`,
14
+ `.${name}rc.js`,
15
+ `.${name}rc.cjs`,
16
+ ...sync ? [] : [`.${name}rc.mjs`],
17
+ `.config/${name}rc`,
18
+ `.config/${name}rc.json`,
19
+ `.config/${name}rc.js`,
20
+ `.config/${name}rc.cjs`,
21
+ ...sync ? [] : [`.config/${name}rc.mjs`],
22
+ `${name}.config.js`,
23
+ `${name}.config.cjs`,
24
+ ...sync ? [] : [`${name}.config.mjs`]
25
+ ];
26
+ }
27
+ /**
28
+ * @type {(p: string) => string}
29
+ *
30
+ * see #17
31
+ * On *nix, if cwd is not under homedir,
32
+ * the last path will be '', ('/build' -> '')
33
+ * but it should be '/' actually.
34
+ * And on Windows, this will never happen. ('C:\build' -> 'C:')
35
+ */
36
+ function parentDir(p) {
37
+ return path.dirname(p) || path.sep;
38
+ }
39
+ /** @type {import('./index').LoaderSync} */
40
+ const jsonLoader = (_, content) => JSON.parse(content);
41
+ const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
42
+ /** @type {import('./index').LoadersSync} */
43
+ const defaultLoadersSync = Object.freeze({
44
+ ".js": requireFunc,
45
+ ".json": requireFunc,
46
+ ".cjs": requireFunc,
47
+ noExt: jsonLoader
48
+ });
49
+ module.exports.defaultLoadersSync = defaultLoadersSync;
50
+ /** @type {import('./index').Loader} */
51
+ const dynamicImport = async (id) => {
52
+ try {
53
+ return (await import(
54
+ /* webpackIgnore: true */
55
+ url.pathToFileURL(id).href
56
+ )).default;
57
+ } catch (e) {
58
+ try {
59
+ return requireFunc(id);
60
+ } catch (requireE) {
61
+ if (requireE.code === "ERR_REQUIRE_ESM" || requireE instanceof SyntaxError && requireE.toString().includes("Cannot use import statement outside a module")) throw e;
62
+ throw requireE;
63
+ }
64
+ }
65
+ };
66
+ /** @type {import('./index').Loaders} */
67
+ const defaultLoaders = Object.freeze({
68
+ ".js": dynamicImport,
69
+ ".mjs": dynamicImport,
70
+ ".cjs": dynamicImport,
71
+ ".json": jsonLoader,
72
+ noExt: jsonLoader
73
+ });
74
+ module.exports.defaultLoaders = defaultLoaders;
75
+ /**
76
+ * @param {string} name
77
+ * @param {import('./index').Options | import('./index').OptionsSync} options
78
+ * @param {boolean} sync
79
+ * @returns {Required<import('./index').Options | import('./index').OptionsSync>}
80
+ */
81
+ function getOptions(name, options, sync) {
82
+ /** @type {Required<import('./index').Options>} */
83
+ const conf = {
84
+ stopDir: os.homedir(),
85
+ searchPlaces: getDefaultSearchPlaces(name, sync),
86
+ ignoreEmptySearchPlaces: true,
87
+ cache: true,
88
+ transform: (x) => x,
89
+ packageProp: [name],
90
+ ...options,
91
+ loaders: {
92
+ ...sync ? defaultLoadersSync : defaultLoaders,
93
+ ...options.loaders
94
+ }
95
+ };
96
+ conf.searchPlaces.forEach((place) => {
97
+ const key = path.extname(place) || "noExt";
98
+ const loader = conf.loaders[key];
99
+ if (!loader) throw new Error(`Missing loader for extension "${place}"`);
100
+ if (typeof loader !== "function") throw new Error(`Loader for extension "${place}" is not a function: Received ${typeof loader}.`);
101
+ });
102
+ return conf;
103
+ }
104
+ /** @type {(props: string | string[], obj: Record<string, any>) => unknown} */
105
+ function getPackageProp(props, obj) {
106
+ if (typeof props === "string" && props in obj) return obj[props];
107
+ return (Array.isArray(props) ? props : props.split(".")).reduce((acc, prop) => acc === void 0 ? acc : acc[prop], obj) || null;
108
+ }
109
+ /** @param {string} filepath */
110
+ function validateFilePath(filepath) {
111
+ if (!filepath) throw new Error("load must pass a non-empty string");
112
+ }
113
+ /** @type {(loader: import('./index').Loader, ext: string) => void} */
114
+ function validateLoader(loader, ext) {
115
+ if (!loader) throw new Error(`No loader specified for extension "${ext}"`);
116
+ if (typeof loader !== "function") throw new Error("loader is not a function");
117
+ }
118
+ /** @type {(enableCache: boolean) => <T>(c: Map<string, T>, filepath: string, res: T) => T} */
119
+ const makeEmplace = (enableCache) => (c, filepath, res) => {
120
+ if (enableCache) c.set(filepath, res);
121
+ return res;
122
+ };
123
+ /** @type {import('./index').lilconfig} */
124
+ module.exports.lilconfig = function lilconfig(name, options) {
125
+ const { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, cache } = getOptions(name, options ?? {}, false);
126
+ const searchCache = /* @__PURE__ */ new Map();
127
+ const loadCache = /* @__PURE__ */ new Map();
128
+ const emplace = makeEmplace(cache);
129
+ return {
130
+ async search(searchFrom = process.cwd()) {
131
+ /** @type {import('./index').LilconfigResult} */
132
+ const result = {
133
+ config: null,
134
+ filepath: ""
135
+ };
136
+ /** @type {Set<string>} */
137
+ const visited = /* @__PURE__ */ new Set();
138
+ let dir = searchFrom;
139
+ dirLoop: while (true) {
140
+ if (cache) {
141
+ const r = searchCache.get(dir);
142
+ if (r !== void 0) {
143
+ for (const p of visited) searchCache.set(p, r);
144
+ return r;
145
+ }
146
+ visited.add(dir);
147
+ }
148
+ for (const searchPlace of searchPlaces) {
149
+ const filepath = path.join(dir, searchPlace);
150
+ try {
151
+ await fs.promises.access(filepath);
152
+ } catch {
153
+ continue;
154
+ }
155
+ const content = String(await fsReadFileAsync(filepath));
156
+ const loaderKey = path.extname(searchPlace) || "noExt";
157
+ const loader = loaders[loaderKey];
158
+ if (searchPlace === "package.json") {
159
+ const pkg = await loader(filepath, content);
160
+ const maybeConfig = getPackageProp(packageProp, pkg);
161
+ if (maybeConfig != null) {
162
+ result.config = maybeConfig;
163
+ result.filepath = filepath;
164
+ break dirLoop;
165
+ }
166
+ continue;
167
+ }
168
+ const isEmpty = content.trim() === "";
169
+ if (isEmpty && ignoreEmptySearchPlaces) continue;
170
+ if (isEmpty) {
171
+ result.isEmpty = true;
172
+ result.config = void 0;
173
+ } else {
174
+ validateLoader(loader, loaderKey);
175
+ result.config = await loader(filepath, content);
176
+ }
177
+ result.filepath = filepath;
178
+ break dirLoop;
179
+ }
180
+ if (dir === stopDir || dir === parentDir(dir)) break dirLoop;
181
+ dir = parentDir(dir);
182
+ }
183
+ const transformed = result.filepath === "" && result.config === null ? transform(null) : transform(result);
184
+ if (cache) for (const p of visited) searchCache.set(p, transformed);
185
+ return transformed;
186
+ },
187
+ async load(filepath) {
188
+ validateFilePath(filepath);
189
+ const absPath = path.resolve(process.cwd(), filepath);
190
+ if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
191
+ const { base, ext } = path.parse(absPath);
192
+ const loaderKey = ext || "noExt";
193
+ const loader = loaders[loaderKey];
194
+ validateLoader(loader, loaderKey);
195
+ const content = String(await fsReadFileAsync(absPath));
196
+ if (base === "package.json") {
197
+ const pkg = await loader(absPath, content);
198
+ return emplace(loadCache, absPath, transform({
199
+ config: getPackageProp(packageProp, pkg),
200
+ filepath: absPath
201
+ }));
202
+ }
203
+ /** @type {import('./index').LilconfigResult} */
204
+ const result = {
205
+ config: null,
206
+ filepath: absPath
207
+ };
208
+ const isEmpty = content.trim() === "";
209
+ if (isEmpty && ignoreEmptySearchPlaces) return emplace(loadCache, absPath, transform({
210
+ config: void 0,
211
+ filepath: absPath,
212
+ isEmpty: true
213
+ }));
214
+ result.config = isEmpty ? void 0 : await loader(absPath, content);
215
+ return emplace(loadCache, absPath, transform(isEmpty ? {
216
+ ...result,
217
+ isEmpty,
218
+ config: void 0
219
+ } : result));
220
+ },
221
+ clearLoadCache() {
222
+ if (cache) loadCache.clear();
223
+ },
224
+ clearSearchCache() {
225
+ if (cache) searchCache.clear();
226
+ },
227
+ clearCaches() {
228
+ if (cache) {
229
+ loadCache.clear();
230
+ searchCache.clear();
231
+ }
232
+ }
233
+ };
234
+ };
235
+ /** @type {import('./index').lilconfigSync} */
236
+ module.exports.lilconfigSync = function lilconfigSync(name, options) {
237
+ const { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, cache } = getOptions(name, options ?? {}, true);
238
+ const searchCache = /* @__PURE__ */ new Map();
239
+ const loadCache = /* @__PURE__ */ new Map();
240
+ const emplace = makeEmplace(cache);
241
+ return {
242
+ search(searchFrom = process.cwd()) {
243
+ /** @type {import('./index').LilconfigResult} */
244
+ const result = {
245
+ config: null,
246
+ filepath: ""
247
+ };
248
+ /** @type {Set<string>} */
249
+ const visited = /* @__PURE__ */ new Set();
250
+ let dir = searchFrom;
251
+ dirLoop: while (true) {
252
+ if (cache) {
253
+ const r = searchCache.get(dir);
254
+ if (r !== void 0) {
255
+ for (const p of visited) searchCache.set(p, r);
256
+ return r;
257
+ }
258
+ visited.add(dir);
259
+ }
260
+ for (const searchPlace of searchPlaces) {
261
+ const filepath = path.join(dir, searchPlace);
262
+ try {
263
+ fs.accessSync(filepath);
264
+ } catch {
265
+ continue;
266
+ }
267
+ const loaderKey = path.extname(searchPlace) || "noExt";
268
+ const loader = loaders[loaderKey];
269
+ const content = String(fs.readFileSync(filepath));
270
+ if (searchPlace === "package.json") {
271
+ const pkg = loader(filepath, content);
272
+ const maybeConfig = getPackageProp(packageProp, pkg);
273
+ if (maybeConfig != null) {
274
+ result.config = maybeConfig;
275
+ result.filepath = filepath;
276
+ break dirLoop;
277
+ }
278
+ continue;
279
+ }
280
+ const isEmpty = content.trim() === "";
281
+ if (isEmpty && ignoreEmptySearchPlaces) continue;
282
+ if (isEmpty) {
283
+ result.isEmpty = true;
284
+ result.config = void 0;
285
+ } else {
286
+ validateLoader(loader, loaderKey);
287
+ result.config = loader(filepath, content);
288
+ }
289
+ result.filepath = filepath;
290
+ break dirLoop;
291
+ }
292
+ if (dir === stopDir || dir === parentDir(dir)) break dirLoop;
293
+ dir = parentDir(dir);
294
+ }
295
+ const transformed = result.filepath === "" && result.config === null ? transform(null) : transform(result);
296
+ if (cache) for (const p of visited) searchCache.set(p, transformed);
297
+ return transformed;
298
+ },
299
+ load(filepath) {
300
+ validateFilePath(filepath);
301
+ const absPath = path.resolve(process.cwd(), filepath);
302
+ if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
303
+ const { base, ext } = path.parse(absPath);
304
+ const loaderKey = ext || "noExt";
305
+ const loader = loaders[loaderKey];
306
+ validateLoader(loader, loaderKey);
307
+ const content = String(fs.readFileSync(absPath));
308
+ if (base === "package.json") {
309
+ const pkg = loader(absPath, content);
310
+ return transform({
311
+ config: getPackageProp(packageProp, pkg),
312
+ filepath: absPath
313
+ });
314
+ }
315
+ const result = {
316
+ config: null,
317
+ filepath: absPath
318
+ };
319
+ const isEmpty = content.trim() === "";
320
+ if (isEmpty && ignoreEmptySearchPlaces) return emplace(loadCache, absPath, transform({
321
+ filepath: absPath,
322
+ config: void 0,
323
+ isEmpty: true
324
+ }));
325
+ result.config = isEmpty ? void 0 : loader(absPath, content);
326
+ return emplace(loadCache, absPath, transform(isEmpty ? {
327
+ ...result,
328
+ isEmpty,
329
+ config: void 0
330
+ } : result));
331
+ },
332
+ clearLoadCache() {
333
+ if (cache) loadCache.clear();
334
+ },
335
+ clearSearchCache() {
336
+ if (cache) searchCache.clear();
337
+ },
338
+ clearCaches() {
339
+ if (cache) {
340
+ loadCache.clear();
341
+ searchCache.clear();
342
+ }
343
+ }
344
+ };
345
+ };
346
+ }));
347
+ //#endregion
348
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
349
+ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
350
+ const { createRequire } = __require("node:module");
351
+ const { pathToFileURL } = __require("node:url");
352
+ const TS_EXT_RE = /\.[mc]?ts$/;
353
+ let tsx;
354
+ let jiti;
355
+ let importError = [];
356
+ /**
357
+ * @param {string} name
358
+ * @param {string} rootFile
359
+ * @returns {Promise<any>}
360
+ */
361
+ async function req(name, rootFile = __filename) {
362
+ let url = createRequire(rootFile).resolve(name);
363
+ try {
364
+ return (await import(`${pathToFileURL(url)}?t=${Date.now()}`)).default;
365
+ } catch (err) {
366
+ if (!TS_EXT_RE.test(url))
367
+ /* c8 ignore start */
368
+ throw err;
369
+ }
370
+ if (tsx === void 0) try {
371
+ tsx = await import("tsx/cjs/api");
372
+ } catch (error) {
373
+ importError.push(error);
374
+ }
375
+ if (tsx) {
376
+ let loaded = tsx.require(name, rootFile);
377
+ return loaded && "__esModule" in loaded ? loaded.default : loaded;
378
+ }
379
+ if (jiti === void 0) try {
380
+ jiti = (await import("jiti")).default;
381
+ } catch (error) {
382
+ importError.push(error);
383
+ }
384
+ if (jiti) return jiti(rootFile, { interopDefault: true })(name);
385
+ throw new Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError.map((error) => error.message).join("\n")}`);
386
+ }
387
+ module.exports = req;
388
+ }));
389
+ //#endregion
390
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
391
+ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
392
+ const req = require_req();
393
+ /**
394
+ * Load Options
395
+ *
396
+ * @private
397
+ * @method options
398
+ *
399
+ * @param {Object} config PostCSS Config
400
+ *
401
+ * @return {Promise<Object>} options PostCSS Options
402
+ */
403
+ async function options(config, file) {
404
+ if (config.parser && typeof config.parser === "string") try {
405
+ config.parser = await req(config.parser, file);
406
+ } catch (err) {
407
+ throw new Error(`Loading PostCSS Parser failed: ${err.message}\n\n(@${file})`);
408
+ }
409
+ if (config.syntax && typeof config.syntax === "string") try {
410
+ config.syntax = await req(config.syntax, file);
411
+ } catch (err) {
412
+ throw new Error(`Loading PostCSS Syntax failed: ${err.message}\n\n(@${file})`);
413
+ }
414
+ if (config.stringifier && typeof config.stringifier === "string") try {
415
+ config.stringifier = await req(config.stringifier, file);
416
+ } catch (err) {
417
+ throw new Error(`Loading PostCSS Stringifier failed: ${err.message}\n\n(@${file})`);
418
+ }
419
+ return config;
420
+ }
421
+ module.exports = options;
422
+ }));
423
+ //#endregion
424
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
425
+ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
426
+ const req = require_req();
427
+ /**
428
+ * Plugin Loader
429
+ *
430
+ * @private
431
+ * @method load
432
+ *
433
+ * @param {String} plugin PostCSS Plugin Name
434
+ * @param {Object} options PostCSS Plugin Options
435
+ *
436
+ * @return {Promise<Function>} PostCSS Plugin
437
+ */
438
+ async function load(plugin, options, file) {
439
+ try {
440
+ if (options === null || options === void 0 || Object.keys(options).length === 0) return await req(plugin, file);
441
+ else return (await req(plugin, file))(options);
442
+ } catch (err) {
443
+ throw new Error(`Loading PostCSS Plugin failed: ${err.message}\n\n(@${file})`);
444
+ }
445
+ }
446
+ /**
447
+ * Load Plugins
448
+ *
449
+ * @private
450
+ * @method plugins
451
+ *
452
+ * @param {Object} config PostCSS Config Plugins
453
+ *
454
+ * @return {Promise<Array>} plugins PostCSS Plugins
455
+ */
456
+ async function plugins(config, file) {
457
+ let list = [];
458
+ if (Array.isArray(config.plugins)) list = config.plugins.filter(Boolean);
459
+ else {
460
+ list = Object.entries(config.plugins).filter(([, options]) => {
461
+ return options !== false;
462
+ }).map(([plugin, options]) => {
463
+ return load(plugin, options, file);
464
+ });
465
+ list = await Promise.all(list);
466
+ }
467
+ if (list.length && list.length > 0) list.forEach((plugin, i) => {
468
+ if (plugin.default) plugin = plugin.default;
469
+ if (plugin.postcss === true) plugin = plugin();
470
+ else if (plugin.postcss) plugin = plugin.postcss;
471
+ if (!(typeof plugin === "object" && Array.isArray(plugin.plugins) || typeof plugin === "object" && plugin.postcssPlugin || typeof plugin === "function")) throw new TypeError(`Invalid PostCSS Plugin found at: plugins[${i}]\n\n(@${file})`);
472
+ });
473
+ return list;
474
+ }
475
+ module.exports = plugins;
476
+ }));
477
+ //#endregion
478
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
479
+ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
480
+ const { resolve } = __require("node:path");
481
+ const config = require_src$1();
482
+ const loadOptions = require_options();
483
+ const loadPlugins = require_plugins();
484
+ const req = require_req();
485
+ const interopRequireDefault = (obj) => obj && obj.__esModule ? obj : { default: obj };
486
+ /**
487
+ * Process the result from cosmiconfig
488
+ *
489
+ * @param {Object} ctx Config Context
490
+ * @param {Object} result Cosmiconfig result
491
+ *
492
+ * @return {Promise<Object>} PostCSS Config
493
+ */
494
+ async function processResult(ctx, result) {
495
+ let file = result.filepath || "";
496
+ let projectConfig = interopRequireDefault(result.config).default || {};
497
+ if (typeof projectConfig === "function") projectConfig = projectConfig(ctx);
498
+ else projectConfig = Object.assign({}, projectConfig, ctx);
499
+ if (!projectConfig.plugins) projectConfig.plugins = [];
500
+ let res = {
501
+ file,
502
+ options: await loadOptions(projectConfig, file),
503
+ plugins: await loadPlugins(projectConfig, file)
504
+ };
505
+ delete projectConfig.plugins;
506
+ return res;
507
+ }
508
+ /**
509
+ * Builds the Config Context
510
+ *
511
+ * @param {Object} ctx Config Context
512
+ *
513
+ * @return {Object} Config Context
514
+ */
515
+ function createContext(ctx) {
516
+ /**
517
+ * @type {Object}
518
+ *
519
+ * @prop {String} cwd=process.cwd() Config search start location
520
+ * @prop {String} env=process.env.NODE_ENV Config Enviroment, will be set to `development` by `postcss-load-config` if `process.env.NODE_ENV` is `undefined`
521
+ */
522
+ ctx = Object.assign({
523
+ cwd: process.cwd(),
524
+ env: process.env.NODE_ENV
525
+ }, ctx);
526
+ if (!ctx.env) process.env.NODE_ENV = "development";
527
+ return ctx;
528
+ }
529
+ async function loader(filepath) {
530
+ return req(filepath);
531
+ }
532
+ let yaml;
533
+ async function yamlLoader(_, content) {
534
+ if (!yaml) try {
535
+ yaml = await import("yaml");
536
+ } catch (e) {
537
+ /* c8 ignore start */
538
+ throw new Error(`'yaml' is required for the YAML configuration files. Make sure it is installed\nError: ${e.message}`);
539
+ }
540
+ return yaml.parse(content);
541
+ }
542
+ /** @return {import('lilconfig').Options} */
543
+ const withLoaders = (options = {}) => {
544
+ let moduleName = "postcss";
545
+ return {
546
+ ...options,
547
+ loaders: {
548
+ ...options.loaders,
549
+ ".cjs": loader,
550
+ ".cts": loader,
551
+ ".js": loader,
552
+ ".mjs": loader,
553
+ ".mts": loader,
554
+ ".ts": loader,
555
+ ".yaml": yamlLoader,
556
+ ".yml": yamlLoader
557
+ },
558
+ searchPlaces: [
559
+ ...options.searchPlaces || [],
560
+ "package.json",
561
+ `.${moduleName}rc`,
562
+ `.${moduleName}rc.json`,
563
+ `.${moduleName}rc.yaml`,
564
+ `.${moduleName}rc.yml`,
565
+ `.${moduleName}rc.ts`,
566
+ `.${moduleName}rc.cts`,
567
+ `.${moduleName}rc.mts`,
568
+ `.${moduleName}rc.js`,
569
+ `.${moduleName}rc.cjs`,
570
+ `.${moduleName}rc.mjs`,
571
+ `${moduleName}.config.ts`,
572
+ `${moduleName}.config.cts`,
573
+ `${moduleName}.config.mts`,
574
+ `${moduleName}.config.js`,
575
+ `${moduleName}.config.cjs`,
576
+ `${moduleName}.config.mjs`
577
+ ]
578
+ };
579
+ };
580
+ /**
581
+ * Load Config
582
+ *
583
+ * @method rc
584
+ *
585
+ * @param {Object} ctx Config Context
586
+ * @param {String} path Config Path
587
+ * @param {Object} options Config Options
588
+ *
589
+ * @return {Promise} config PostCSS Config
590
+ */
591
+ function rc(ctx, path, options) {
592
+ /**
593
+ * @type {Object} The full Config Context
594
+ */
595
+ ctx = createContext(ctx);
596
+ /**
597
+ * @type {String} `process.cwd()`
598
+ */
599
+ path = path ? resolve(path) : process.cwd();
600
+ return config.lilconfig("postcss", withLoaders(options)).search(path).then((result) => {
601
+ if (!result) throw new Error(`No PostCSS Config found in: ${path}`);
602
+ return processResult(ctx, result);
603
+ });
604
+ }
605
+ /**
606
+ * Autoload Config for PostCSS
607
+ *
608
+ * @author Michael Ciniawsky @michael-ciniawsky <michael.ciniawsky@gmail.com>
609
+ * @license MIT
610
+ *
611
+ * @module postcss-load-config
612
+ * @version 2.1.0
613
+ *
614
+ * @requires comsiconfig
615
+ * @requires ./options
616
+ * @requires ./plugins
617
+ */
618
+ module.exports = rc;
619
+ }));
620
+ //#endregion
621
+ export default require_src();
622
+ export {};
@@ -0,0 +1,79 @@
1
+ import { s as resolveComma, u as toArray } from "./general-Cp4NiJNK-BYPTHEzb.js";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import { access, cp, rm, stat } from "node:fs/promises";
5
+ //#region ../../node_modules/.pnpm/tsdown@0.22.3_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.3_@tsdown+exe@0.22.3_@type_7ab537c68b19946c2da2ea6b389f768f/node_modules/tsdown/dist/fs-qxJxxoCE.mjs
6
+ function fsExists(path) {
7
+ return access(path).then(() => true, () => false);
8
+ }
9
+ function fsStat(path) {
10
+ return stat(path).catch(() => null);
11
+ }
12
+ function fsRemove(path) {
13
+ return rm(path, {
14
+ force: true,
15
+ recursive: true
16
+ }).catch(() => {});
17
+ }
18
+ function fsCopy(from, to) {
19
+ return cp(from, to, {
20
+ recursive: true,
21
+ force: true
22
+ });
23
+ }
24
+ function lowestCommonAncestor(...filepaths) {
25
+ if (filepaths.length === 0) return "";
26
+ if (filepaths.length === 1) return path.dirname(filepaths[0]);
27
+ filepaths = filepaths.map(path.normalize);
28
+ const [first, ...rest] = filepaths;
29
+ let ancestor = first.split(path.sep);
30
+ for (const filepath of rest) {
31
+ const directories = filepath.split(path.sep, ancestor.length);
32
+ let index = 0;
33
+ for (const directory of directories) if (directory === ancestor[index]) index += 1;
34
+ else {
35
+ ancestor = ancestor.slice(0, index);
36
+ break;
37
+ }
38
+ ancestor = ancestor.slice(0, index);
39
+ }
40
+ return ancestor.length <= 1 && ancestor[0] === "" ? path.sep + ancestor[0] : ancestor.join(path.sep);
41
+ }
42
+ function stripExtname(filePath) {
43
+ const ext = path.extname(filePath);
44
+ if (!ext.length) return filePath;
45
+ return filePath.slice(0, -ext.length);
46
+ }
47
+ const minVersion = createRequire(import.meta.url)("./npm_entry_semver_ranges_min-version.cjs");
48
+ const BASELINE_WIDELY_AVAILABLE_TARGET = [
49
+ "chrome111",
50
+ "edge111",
51
+ "firefox114",
52
+ "safari16.4",
53
+ "ios16.4"
54
+ ];
55
+ function expandBaselineTarget(targets) {
56
+ return targets.flatMap((t) => t === "baseline-widely-available" ? BASELINE_WIDELY_AVAILABLE_TARGET : t);
57
+ }
58
+ function resolveTarget(logger, target, color, pkg, nameLabel) {
59
+ if (target === false) return;
60
+ if (target == null) {
61
+ const pkgTarget = resolvePackageTarget(pkg);
62
+ if (pkgTarget) target = pkgTarget;
63
+ else return;
64
+ }
65
+ if (typeof target === "number") throw new TypeError(`Invalid target: ${target}`);
66
+ const targets = expandBaselineTarget(resolveComma(toArray(target)));
67
+ if (targets.length) logger.info(nameLabel, `target${targets.length > 1 ? "s" : ""}: ${color(targets.join(", "))}`);
68
+ return targets;
69
+ }
70
+ function resolvePackageTarget(pkg) {
71
+ const nodeVersion = pkg?.engines?.node;
72
+ if (!nodeVersion) return;
73
+ const nodeMinVersion = minVersion(nodeVersion);
74
+ if (!nodeMinVersion) return;
75
+ if (nodeMinVersion.version === "0.0.0") return;
76
+ return `node${nodeMinVersion.version}`;
77
+ }
78
+ //#endregion
79
+ export { fsRemove as a, stripExtname as c, fsExists as i, resolveTarget as n, fsStat as o, fsCopy as r, lowestCommonAncestor as s, expandBaselineTarget as t };
@@ -1,6 +1,6 @@
1
- import { a as createDebug } from "./main-BMtwTklr.js";
2
- import { l as RE_DTS, u as RE_DTS_MAP } from "./build-B_nvJe4A-BkmlHYK-.js";
3
- import { n as globalContext } from "./tsc-context-DfwSQt2q.js";
1
+ import { r as createDebug } from "./main-BlTcyuFi.js";
2
+ import { l as RE_DTS, u as RE_DTS_MAP } from "./build-B_nvJe4A-CcOht0gr.js";
3
+ import { n as globalContext } from "./tsc-context-CX_GXdyS.js";
4
4
  import { createRequire } from "node:module";
5
5
  import path from "node:path";
6
6
  import { pathToFileURL } from "node:url";