tailwindcss-injector 0.1.6-alpha.2 → 0.1.6-alpha.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.
package/dist/postcss.cjs CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
31
31
  var init_cjs_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -126,8 +126,8 @@ var require_set_value = __commonJS({
126
126
  return value;
127
127
  };
128
128
  var splitString = (input, options = {}) => {
129
- const sep = options.separator || ".";
130
- const preserve = sep === "/" ? false : options.preservePaths;
129
+ const sep2 = options.separator || ".";
130
+ const preserve = sep2 === "/" ? false : options.preservePaths;
131
131
  if (typeof input === "string" && preserve !== false && /\//.test(input)) {
132
132
  return [input];
133
133
  }
@@ -147,7 +147,7 @@ var require_set_value = __commonJS({
147
147
  part += input[++i];
148
148
  continue;
149
149
  }
150
- if (value === sep) {
150
+ if (value === sep2) {
151
151
  push(part);
152
152
  part = "";
153
153
  continue;
@@ -181,9 +181,9 @@ var require_set_value = __commonJS({
181
181
  }
182
182
  return obj;
183
183
  };
184
- var setValue = (target, path3, value, options) => {
185
- if (!path3 || !isObject(target)) return target;
186
- const keys = split(path3, options);
184
+ var setValue = (target, path2, value, options) => {
185
+ if (!path2 || !isObject(target)) return target;
186
+ const keys = split(path2, options);
187
187
  let obj = target;
188
188
  for (let i = 0; i < keys.length; i++) {
189
189
  const key = keys[i];
@@ -227,20 +227,443 @@ var _process = require('process'); var _process2 = _interopRequireDefault(_proce
227
227
  // src/utils.ts
228
228
  init_cjs_shims();
229
229
  var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
230
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
231
230
  var _shared = require('@weapp-tailwindcss/shared');
231
+
232
+ // ../../node_modules/.pnpm/pathe@2.0.2/node_modules/pathe/dist/index.mjs
233
+ init_cjs_shims();
234
+
235
+ // ../../node_modules/.pnpm/pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.mjs
236
+ init_cjs_shims();
237
+ var _lazyMatch = () => {
238
+ var __lib__ = (() => {
239
+ var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
240
+ for (var n in e) m(r, n, { get: e[n], enumerable: true });
241
+ }, H = (r, e, n, t) => {
242
+ if (typeof e == "object" || typeof e == "function") for (let a of G(e)) !T.call(r, a) && a !== n && m(r, a, { get: () => e[a], enumerable: !(t = V(e, a)) || t.enumerable });
243
+ return r;
244
+ }, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
245
+ q(w, { zeptomatch: () => re });
246
+ var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
247
+ const e = /* @__PURE__ */ new Map();
248
+ return (n) => {
249
+ const t = e.get(n);
250
+ if (t) return t;
251
+ const a = r(n);
252
+ return e.set(n, a), a;
253
+ };
254
+ }, rr = (r, e, n = {}) => {
255
+ const t = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
256
+ if (v(e)(t) && t.index === r.length) return t.output;
257
+ throw new Error(`Failed to parse at index ${t.indexMax}`);
258
+ }, i = (r, e) => A(r) ? er(r, e) : b(r) ? tr(r, e) : nr(r, e), er = (r, e) => {
259
+ const n = {};
260
+ for (const t of r) {
261
+ if (t.length !== 1) throw new Error(`Invalid character: "${t}"`);
262
+ const a = t.charCodeAt(0);
263
+ n[a] = true;
264
+ }
265
+ return (t) => {
266
+ const a = t.index, o = t.input;
267
+ for (; t.index < o.length && o.charCodeAt(t.index) in n; ) t.index += 1;
268
+ const u = t.index;
269
+ if (u > a) {
270
+ if (!h(e) && !t.options.silent) {
271
+ const s = t.input.slice(a, u), c = d(e) ? e(s, o, String(a)) : e;
272
+ h(c) || t.output.push(c);
273
+ }
274
+ t.indexMax = Math.max(t.indexMax, t.index);
275
+ }
276
+ return true;
277
+ };
278
+ }, nr = (r, e) => {
279
+ const n = r.source, t = r.flags.replace(/y|$/, "y"), a = new RegExp(n, t);
280
+ return g((o) => {
281
+ a.lastIndex = o.index;
282
+ const u = a.exec(o.input);
283
+ if (u) {
284
+ if (!h(e) && !o.options.silent) {
285
+ const s = d(e) ? e(...u, o.input, String(o.index)) : e;
286
+ h(s) || o.output.push(s);
287
+ }
288
+ return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
289
+ } else return false;
290
+ });
291
+ }, tr = (r, e) => (n) => {
292
+ if (n.input.startsWith(r, n.index)) {
293
+ if (!h(e) && !n.options.silent) {
294
+ const a = d(e) ? e(r, n.input, String(n.index)) : e;
295
+ h(a) || n.output.push(a);
296
+ }
297
+ return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
298
+ } else return false;
299
+ }, C = (r, e, n, t) => {
300
+ const a = v(r);
301
+ return g(_(M((o) => {
302
+ let u = 0;
303
+ for (; u < n; ) {
304
+ const s = o.index;
305
+ if (!a(o) || (u += 1, o.index === s)) break;
306
+ }
307
+ return u >= e;
308
+ })));
309
+ }, ar = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
310
+ const n = r.map(v);
311
+ return g(_(M((t) => {
312
+ for (let a = 0, o = n.length; a < o; a++) if (!n[a](t)) return false;
313
+ return true;
314
+ })));
315
+ }, l = (r, e) => {
316
+ const n = r.map(v);
317
+ return g(_((t) => {
318
+ for (let a = 0, o = n.length; a < o; a++) if (n[a](t)) return true;
319
+ return false;
320
+ }));
321
+ }, M = (r, e = false) => {
322
+ const n = v(r);
323
+ return (t) => {
324
+ const a = t.index, o = t.output.length, u = n(t);
325
+ return (!u || e) && (t.index = a, t.output.length !== o && (t.output.length = o)), u;
326
+ };
327
+ }, _ = (r, e) => {
328
+ const n = v(r);
329
+ return n;
330
+ }, g = /* @__PURE__ */ (() => {
331
+ let r = 0;
332
+ return (e) => {
333
+ const n = v(e), t = r += 1;
334
+ return (a) => {
335
+ var o;
336
+ if (a.options.memoization === false) return n(a);
337
+ const u = a.index, s = (o = a.cache)[t] || (o[t] = /* @__PURE__ */ new Map()), c = s.get(u);
338
+ if (c === false) return false;
339
+ if (W(c)) return a.index = c, true;
340
+ if (c) return a.index = c.index, _optionalChain([c, 'access', _2 => _2.output, 'optionalAccess', _3 => _3.length]) && a.output.push(...c.output), true;
341
+ {
342
+ const Z = a.output.length;
343
+ if (n(a)) {
344
+ const D = a.index, U = a.output.length;
345
+ if (U > Z) {
346
+ const ee = a.output.slice(Z, U);
347
+ s.set(u, { index: D, output: ee });
348
+ } else s.set(u, D);
349
+ return true;
350
+ } else return s.set(u, false), false;
351
+ }
352
+ };
353
+ };
354
+ })(), E = (r) => {
355
+ let e;
356
+ return (n) => (e || (e = v(r())), e(n));
357
+ }, v = Y((r) => {
358
+ if (d(r)) return Q(r) ? E(r) : r;
359
+ if (b(r) || X(r)) return i(r);
360
+ if (A(r)) return x(r);
361
+ if (K(r)) return l(Object.values(r));
362
+ throw new Error("Invalid rule");
363
+ }), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
364
+ let e = "";
365
+ for (; r > 0; ) {
366
+ const n = (r - 1) % 26;
367
+ e = P[n] + e, r = Math.floor((r - 1) / 26);
368
+ }
369
+ return e;
370
+ }, z = (r) => {
371
+ let e = 0;
372
+ for (let n = 0, t = r.length; n < t; n++) e = e * 26 + P.indexOf(r[n]) + 1;
373
+ return e;
374
+ }, S = (r, e) => {
375
+ if (e < r) return S(e, r);
376
+ const n = [];
377
+ for (; r <= e; ) n.push(r++);
378
+ return n;
379
+ }, or = (r, e, n) => S(r, e).map((t) => String(t).padStart(n, "0")), O = (r, e) => S(z(r), z(e)).map(ir), p = (r) => r, R = (r) => ur((e) => rr(e, r, { memoization: false }).join("")), ur = (r) => {
380
+ const e = {};
381
+ return (n) => _nullishCoalesce(e[n], () => ( (e[n] = r(n))));
382
+ }, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, t) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${t.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), hr = i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i(/^(!!)+/, ""), fr = l([hr, dr]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([Sr, yr]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, ar(Ar), f(Er), wr]), Pr = i("{", "(?:"), zr = i("}", ")"), Or = i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), Rr = i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => O(e, n).join("|")), jr = i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => O(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([Or, Rr, jr]), I = x([Pr, Nr, zr]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), Zr = E(() => F), Dr = l([j, N, k, B, I, Zr, y, Fr, Ir, Lr]), F = x([kr, f(Dr), Br]), Ur = f(l([sr, cr, lr, fr, j, N, k, B, I, F, y, pr, vr])), Vr = Ur, Gr = R(Vr), L = Gr, Tr = i(/\\./, p), qr = i(/./, p), Hr = i(/\*\*\*+/, "*"), Jr = i(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = R(Kr), Yr = Xr, $ = (r, e) => {
383
+ const n = Array.isArray(r) ? r : [r];
384
+ if (!n.length) return false;
385
+ const t = n.map($.compile), a = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, a ? "/" : "");
386
+ return t.some((s) => s.test(o));
387
+ };
388
+ $.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
389
+ var re = $;
390
+ return J(w);
391
+ })();
392
+ return __lib__.default || __lib__;
393
+ };
394
+ var _match;
395
+ var zeptomatch = (path2, pattern) => {
396
+ if (!_match) {
397
+ _match = _lazyMatch();
398
+ _lazyMatch = null;
399
+ }
400
+ return _match(path2, pattern);
401
+ };
402
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
403
+ function normalizeWindowsPath(input = "") {
404
+ if (!input) {
405
+ return input;
406
+ }
407
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
408
+ }
409
+ var _UNC_REGEX = /^[/\\]{2}/;
410
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
411
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
412
+ var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
413
+ var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
414
+ var _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
415
+ var sep = "/";
416
+ var normalize = function(path2) {
417
+ if (path2.length === 0) {
418
+ return ".";
419
+ }
420
+ path2 = normalizeWindowsPath(path2);
421
+ const isUNCPath = path2.match(_UNC_REGEX);
422
+ const isPathAbsolute = isAbsolute(path2);
423
+ const trailingSeparator = path2[path2.length - 1] === "/";
424
+ path2 = normalizeString(path2, !isPathAbsolute);
425
+ if (path2.length === 0) {
426
+ if (isPathAbsolute) {
427
+ return "/";
428
+ }
429
+ return trailingSeparator ? "./" : ".";
430
+ }
431
+ if (trailingSeparator) {
432
+ path2 += "/";
433
+ }
434
+ if (_DRIVE_LETTER_RE.test(path2)) {
435
+ path2 += "/";
436
+ }
437
+ if (isUNCPath) {
438
+ if (!isPathAbsolute) {
439
+ return `//./${path2}`;
440
+ }
441
+ return `//${path2}`;
442
+ }
443
+ return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
444
+ };
445
+ var join = function(...segments) {
446
+ let path2 = "";
447
+ for (const seg of segments) {
448
+ if (!seg) {
449
+ continue;
450
+ }
451
+ if (path2.length > 0) {
452
+ const pathTrailing = path2[path2.length - 1] === "/";
453
+ const segLeading = seg[0] === "/";
454
+ const both = pathTrailing && segLeading;
455
+ if (both) {
456
+ path2 += seg.slice(1);
457
+ } else {
458
+ path2 += pathTrailing || segLeading ? seg : `/${seg}`;
459
+ }
460
+ } else {
461
+ path2 += seg;
462
+ }
463
+ }
464
+ return normalize(path2);
465
+ };
466
+ function cwd() {
467
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
468
+ return process.cwd().replace(/\\/g, "/");
469
+ }
470
+ return "/";
471
+ }
472
+ var resolve = function(...arguments_) {
473
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
474
+ let resolvedPath = "";
475
+ let resolvedAbsolute = false;
476
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
477
+ const path2 = index >= 0 ? arguments_[index] : cwd();
478
+ if (!path2 || path2.length === 0) {
479
+ continue;
480
+ }
481
+ resolvedPath = `${path2}/${resolvedPath}`;
482
+ resolvedAbsolute = isAbsolute(path2);
483
+ }
484
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
485
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
486
+ return `/${resolvedPath}`;
487
+ }
488
+ return resolvedPath.length > 0 ? resolvedPath : ".";
489
+ };
490
+ function normalizeString(path2, allowAboveRoot) {
491
+ let res = "";
492
+ let lastSegmentLength = 0;
493
+ let lastSlash = -1;
494
+ let dots = 0;
495
+ let char = null;
496
+ for (let index = 0; index <= path2.length; ++index) {
497
+ if (index < path2.length) {
498
+ char = path2[index];
499
+ } else if (char === "/") {
500
+ break;
501
+ } else {
502
+ char = "/";
503
+ }
504
+ if (char === "/") {
505
+ if (lastSlash === index - 1 || dots === 1) ;
506
+ else if (dots === 2) {
507
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
508
+ if (res.length > 2) {
509
+ const lastSlashIndex = res.lastIndexOf("/");
510
+ if (lastSlashIndex === -1) {
511
+ res = "";
512
+ lastSegmentLength = 0;
513
+ } else {
514
+ res = res.slice(0, lastSlashIndex);
515
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
516
+ }
517
+ lastSlash = index;
518
+ dots = 0;
519
+ continue;
520
+ } else if (res.length > 0) {
521
+ res = "";
522
+ lastSegmentLength = 0;
523
+ lastSlash = index;
524
+ dots = 0;
525
+ continue;
526
+ }
527
+ }
528
+ if (allowAboveRoot) {
529
+ res += res.length > 0 ? "/.." : "..";
530
+ lastSegmentLength = 2;
531
+ }
532
+ } else {
533
+ if (res.length > 0) {
534
+ res += `/${path2.slice(lastSlash + 1, index)}`;
535
+ } else {
536
+ res = path2.slice(lastSlash + 1, index);
537
+ }
538
+ lastSegmentLength = index - lastSlash - 1;
539
+ }
540
+ lastSlash = index;
541
+ dots = 0;
542
+ } else if (char === "." && dots !== -1) {
543
+ ++dots;
544
+ } else {
545
+ dots = -1;
546
+ }
547
+ }
548
+ return res;
549
+ }
550
+ var isAbsolute = function(p) {
551
+ return _IS_ABSOLUTE_RE.test(p);
552
+ };
553
+ var toNamespacedPath = function(p) {
554
+ return normalizeWindowsPath(p);
555
+ };
556
+ var extname = function(p) {
557
+ if (p === "..") return "";
558
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
559
+ return match && match[1] || "";
560
+ };
561
+ var relative = function(from, to) {
562
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
563
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
564
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
565
+ return _to.join("/");
566
+ }
567
+ const _fromCopy = [..._from];
568
+ for (const segment of _fromCopy) {
569
+ if (_to[0] !== segment) {
570
+ break;
571
+ }
572
+ _from.shift();
573
+ _to.shift();
574
+ }
575
+ return [..._from.map(() => ".."), ..._to].join("/");
576
+ };
577
+ var dirname = function(p) {
578
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
579
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
580
+ segments[0] += "/";
581
+ }
582
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
583
+ };
584
+ var format = function(p) {
585
+ const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
586
+ const segments = [p.root, p.dir, _nullishCoalesce(p.base, () => ( (_nullishCoalesce(p.name, () => ( ""))) + ext))].filter(
587
+ Boolean
588
+ );
589
+ return normalizeWindowsPath(
590
+ p.root ? resolve(...segments) : segments.join("/")
591
+ );
592
+ };
593
+ var basename = function(p, extension) {
594
+ const segments = normalizeWindowsPath(p).split("/");
595
+ let lastSegment = "";
596
+ for (let i = segments.length - 1; i >= 0; i--) {
597
+ const val = segments[i];
598
+ if (val) {
599
+ lastSegment = val;
600
+ break;
601
+ }
602
+ }
603
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
604
+ };
605
+ var parse = function(p) {
606
+ const root = _optionalChain([_PATH_ROOT_RE, 'access', _4 => _4.exec, 'call', _5 => _5(p), 'optionalAccess', _6 => _6[0], 'optionalAccess', _7 => _7.replace, 'call', _8 => _8(/\\/g, "/")]) || "";
607
+ const base = basename(p);
608
+ const extension = extname(base);
609
+ return {
610
+ root,
611
+ dir: dirname(p),
612
+ base,
613
+ ext: extension,
614
+ name: base.slice(0, base.length - extension.length)
615
+ };
616
+ };
617
+ var matchesGlob = (path2, pattern) => {
618
+ return zeptomatch(pattern, normalize(path2));
619
+ };
620
+ var _path = {
621
+ __proto__: null,
622
+ basename,
623
+ dirname,
624
+ extname,
625
+ format,
626
+ isAbsolute,
627
+ join,
628
+ matchesGlob,
629
+ normalize,
630
+ normalizeString,
631
+ parse,
632
+ relative,
633
+ resolve,
634
+ sep,
635
+ toNamespacedPath
636
+ };
637
+
638
+ // ../../node_modules/.pnpm/pathe@2.0.2/node_modules/pathe/dist/index.mjs
639
+ var delimiter = /* @__PURE__ */ (() => _optionalChain([globalThis, 'access', _9 => _9.process, 'optionalAccess', _10 => _10.platform]) === "win32" ? ";" : ":")();
640
+ var _platforms = { posix: void 0, win32: void 0 };
641
+ var mix = (del = delimiter) => {
642
+ return new Proxy(_path, {
643
+ get(_, prop) {
644
+ if (prop === "delimiter") return del;
645
+ if (prop === "posix") return posix;
646
+ if (prop === "win32") return win32;
647
+ return _platforms[prop] || _path[prop];
648
+ }
649
+ });
650
+ };
651
+ var posix = /* @__PURE__ */ mix(":");
652
+ var win32 = /* @__PURE__ */ mix(";");
653
+
654
+ // src/utils.ts
232
655
  function removeFileExtension(filePath) {
233
656
  if (!filePath) {
234
657
  return "";
235
658
  }
236
- let baseName = _path2.default.basename(filePath);
237
- let ext = _path2.default.extname(baseName);
659
+ let baseName = posix.basename(filePath);
660
+ let ext = posix.extname(baseName);
238
661
  while (ext) {
239
662
  baseName = baseName.slice(0, -ext.length);
240
- ext = _path2.default.extname(baseName);
663
+ ext = posix.extname(baseName);
241
664
  }
242
- const dir = _path2.default.dirname(filePath);
243
- return _path2.default.join(dir, baseName);
665
+ const dir = posix.dirname(filePath);
666
+ return posix.join(dir, baseName);
244
667
  }
245
668
  function md5(input) {
246
669
  const hash = _crypto2.default.createHash("md5");
@@ -272,7 +695,7 @@ var postcssPlugin = "postcss-tailwindcss-injector";
272
695
 
273
696
  // src/wxml.ts
274
697
  init_cjs_shims();
275
-
698
+ var _path2 = require('path'); var _path3 = _interopRequireDefault(_path2);
276
699
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
277
700
  var _htmlparser2 = require('htmlparser2');
278
701
  var _magicstring = require('magic-string'); var _magicstring2 = _interopRequireDefault(_magicstring);
@@ -337,7 +760,7 @@ function processWxml(wxml) {
337
760
  }
338
761
  async function getDep(filepath, set2) {
339
762
  if (await _fsextra2.default.exists(filepath)) {
340
- const dirname = _path2.default.dirname(filepath);
763
+ const dirname2 = _path3.default.dirname(filepath);
341
764
  set2.add(filepath);
342
765
  const wxml = await _fsextra2.default.readFile(filepath, "utf8");
343
766
  const hash = md5(wxml);
@@ -353,7 +776,7 @@ async function getDep(filepath, set2) {
353
776
  deps = cacheDeps;
354
777
  }
355
778
  for (const { value } of deps) {
356
- const p = _path2.default.resolve(dirname, value);
779
+ const p = _path3.default.resolve(dirname2, value);
357
780
  if (!set2.has(p)) {
358
781
  await getDep(p, set2);
359
782
  }
@@ -368,7 +791,7 @@ async function getDepFiles(file) {
368
791
 
369
792
  // src/postcss.ts
370
793
  var creator = (options) => {
371
- const { config, filter, directiveParams, cwd, extensions, insertAfterAtRulesNames, insertAfterComments } = getConfig(options);
794
+ const { config, filter, directiveParams, cwd: cwd2, extensions, insertAfterAtRulesNames, insertAfterComments } = getConfig(options);
372
795
  const extensionsGlob = `{${extensions.join(",")}}`;
373
796
  return {
374
797
  postcssPlugin,
@@ -376,7 +799,7 @@ var creator = (options) => {
376
799
  {
377
800
  postcssPlugin: `${postcssPlugin}:post`,
378
801
  async Once(root, helpers) {
379
- if (filter(_optionalChain([root, 'access', _ => _.source, 'optionalAccess', _2 => _2.input]))) {
802
+ if (filter(_optionalChain([root, 'access', _11 => _11.source, 'optionalAccess', _12 => _12.input]))) {
380
803
  const atruleLastIndex = root.nodes.findLastIndex((x) => x.type === "atrule" && insertAfterAtRulesNames.includes(x.name));
381
804
  const commentLastIndex = root.nodes.findLastIndex((x) => x.type === "comment" && _shared.regExpTest.call(void 0, insertAfterComments, x.text));
382
805
  const lastIndex = Math.max(atruleLastIndex, commentLastIndex);
@@ -391,11 +814,11 @@ var creator = (options) => {
391
814
  }
392
815
  }
393
816
  }
394
- const cfg = typeof config === "function" ? config(_optionalChain([root, 'access', _3 => _3.source, 'optionalAccess', _4 => _4.input])) : config;
817
+ const cfg = typeof config === "function" ? config(_optionalChain([root, 'access', _13 => _13.source, 'optionalAccess', _14 => _14.input])) : config;
395
818
  let tailwindcssConfig;
396
819
  if (typeof cfg === "string") {
397
820
  tailwindcssConfig = await _tailwindcssconfig.loadConfig.call(void 0, {
398
- cwd,
821
+ cwd: cwd2,
399
822
  config: cfg
400
823
  });
401
824
  } else {
@@ -403,12 +826,12 @@ var creator = (options) => {
403
826
  content: []
404
827
  }));
405
828
  }
406
- if (tailwindcssConfig && _optionalChain([root, 'access', _5 => _5.source, 'optionalAccess', _6 => _6.input]) && root.source.input.file) {
407
- const basename = removeFileExtension(root.source.input.file);
829
+ if (tailwindcssConfig && _optionalChain([root, 'access', _15 => _15.source, 'optionalAccess', _16 => _16.input]) && root.source.input.file) {
830
+ const basename2 = removeFileExtension(root.source.input.file);
408
831
  (0, import_set_value.default)(tailwindcssConfig, "content", [
409
- `${basename}.${extensionsGlob}`
832
+ `${basename2}.${extensionsGlob}`
410
833
  ]);
411
- const deps = await getDepFiles(`${basename}.wxml`);
834
+ const deps = await getDepFiles(`${basename2}.wxml`);
412
835
  for (const dep of deps) {
413
836
  if (Array.isArray(tailwindcssConfig.content)) {
414
837
  tailwindcssConfig.content.push(`${removeFileExtension(dep)}.${extensionsGlob}`);
package/dist/postcss.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.1_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -126,8 +126,8 @@ var require_set_value = __commonJS({
126
126
  return value;
127
127
  };
128
128
  var splitString = (input, options = {}) => {
129
- const sep = options.separator || ".";
130
- const preserve = sep === "/" ? false : options.preservePaths;
129
+ const sep2 = options.separator || ".";
130
+ const preserve = sep2 === "/" ? false : options.preservePaths;
131
131
  if (typeof input === "string" && preserve !== false && /\//.test(input)) {
132
132
  return [input];
133
133
  }
@@ -147,7 +147,7 @@ var require_set_value = __commonJS({
147
147
  part += input[++i];
148
148
  continue;
149
149
  }
150
- if (value === sep) {
150
+ if (value === sep2) {
151
151
  push(part);
152
152
  part = "";
153
153
  continue;
@@ -181,9 +181,9 @@ var require_set_value = __commonJS({
181
181
  }
182
182
  return obj;
183
183
  };
184
- var setValue = (target, path3, value, options) => {
185
- if (!path3 || !isObject(target)) return target;
186
- const keys = split(path3, options);
184
+ var setValue = (target, path2, value, options) => {
185
+ if (!path2 || !isObject(target)) return target;
186
+ const keys = split(path2, options);
187
187
  let obj = target;
188
188
  for (let i = 0; i < keys.length; i++) {
189
189
  const key = keys[i];
@@ -222,25 +222,448 @@ import { loadConfig } from "tailwindcss-config";
222
222
 
223
223
  // src/config.ts
224
224
  init_esm_shims();
225
- import process from "node:process";
225
+ import process2 from "node:process";
226
226
 
227
227
  // src/utils.ts
228
228
  init_esm_shims();
229
229
  import crypto from "node:crypto";
230
- import path from "node:path";
231
230
  import { defu, defuOverrideArray, isRegexp, regExpTest } from "@weapp-tailwindcss/shared";
231
+
232
+ // ../../node_modules/.pnpm/pathe@2.0.2/node_modules/pathe/dist/index.mjs
233
+ init_esm_shims();
234
+
235
+ // ../../node_modules/.pnpm/pathe@2.0.2/node_modules/pathe/dist/shared/pathe.UZ-hd4nF.mjs
236
+ init_esm_shims();
237
+ var _lazyMatch = () => {
238
+ var __lib__ = (() => {
239
+ var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
240
+ for (var n in e) m(r, n, { get: e[n], enumerable: true });
241
+ }, H = (r, e, n, t) => {
242
+ if (typeof e == "object" || typeof e == "function") for (let a of G(e)) !T.call(r, a) && a !== n && m(r, a, { get: () => e[a], enumerable: !(t = V(e, a)) || t.enumerable });
243
+ return r;
244
+ }, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
245
+ q(w, { zeptomatch: () => re });
246
+ var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
247
+ const e = /* @__PURE__ */ new Map();
248
+ return (n) => {
249
+ const t = e.get(n);
250
+ if (t) return t;
251
+ const a = r(n);
252
+ return e.set(n, a), a;
253
+ };
254
+ }, rr = (r, e, n = {}) => {
255
+ const t = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
256
+ if (v(e)(t) && t.index === r.length) return t.output;
257
+ throw new Error(`Failed to parse at index ${t.indexMax}`);
258
+ }, i = (r, e) => A(r) ? er(r, e) : b(r) ? tr(r, e) : nr(r, e), er = (r, e) => {
259
+ const n = {};
260
+ for (const t of r) {
261
+ if (t.length !== 1) throw new Error(`Invalid character: "${t}"`);
262
+ const a = t.charCodeAt(0);
263
+ n[a] = true;
264
+ }
265
+ return (t) => {
266
+ const a = t.index, o = t.input;
267
+ for (; t.index < o.length && o.charCodeAt(t.index) in n; ) t.index += 1;
268
+ const u = t.index;
269
+ if (u > a) {
270
+ if (!h(e) && !t.options.silent) {
271
+ const s = t.input.slice(a, u), c = d(e) ? e(s, o, String(a)) : e;
272
+ h(c) || t.output.push(c);
273
+ }
274
+ t.indexMax = Math.max(t.indexMax, t.index);
275
+ }
276
+ return true;
277
+ };
278
+ }, nr = (r, e) => {
279
+ const n = r.source, t = r.flags.replace(/y|$/, "y"), a = new RegExp(n, t);
280
+ return g((o) => {
281
+ a.lastIndex = o.index;
282
+ const u = a.exec(o.input);
283
+ if (u) {
284
+ if (!h(e) && !o.options.silent) {
285
+ const s = d(e) ? e(...u, o.input, String(o.index)) : e;
286
+ h(s) || o.output.push(s);
287
+ }
288
+ return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
289
+ } else return false;
290
+ });
291
+ }, tr = (r, e) => (n) => {
292
+ if (n.input.startsWith(r, n.index)) {
293
+ if (!h(e) && !n.options.silent) {
294
+ const a = d(e) ? e(r, n.input, String(n.index)) : e;
295
+ h(a) || n.output.push(a);
296
+ }
297
+ return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
298
+ } else return false;
299
+ }, C = (r, e, n, t) => {
300
+ const a = v(r);
301
+ return g(_(M((o) => {
302
+ let u = 0;
303
+ for (; u < n; ) {
304
+ const s = o.index;
305
+ if (!a(o) || (u += 1, o.index === s)) break;
306
+ }
307
+ return u >= e;
308
+ })));
309
+ }, ar = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
310
+ const n = r.map(v);
311
+ return g(_(M((t) => {
312
+ for (let a = 0, o = n.length; a < o; a++) if (!n[a](t)) return false;
313
+ return true;
314
+ })));
315
+ }, l = (r, e) => {
316
+ const n = r.map(v);
317
+ return g(_((t) => {
318
+ for (let a = 0, o = n.length; a < o; a++) if (n[a](t)) return true;
319
+ return false;
320
+ }));
321
+ }, M = (r, e = false) => {
322
+ const n = v(r);
323
+ return (t) => {
324
+ const a = t.index, o = t.output.length, u = n(t);
325
+ return (!u || e) && (t.index = a, t.output.length !== o && (t.output.length = o)), u;
326
+ };
327
+ }, _ = (r, e) => {
328
+ const n = v(r);
329
+ return n;
330
+ }, g = /* @__PURE__ */ (() => {
331
+ let r = 0;
332
+ return (e) => {
333
+ const n = v(e), t = r += 1;
334
+ return (a) => {
335
+ var o;
336
+ if (a.options.memoization === false) return n(a);
337
+ const u = a.index, s = (o = a.cache)[t] || (o[t] = /* @__PURE__ */ new Map()), c = s.get(u);
338
+ if (c === false) return false;
339
+ if (W(c)) return a.index = c, true;
340
+ if (c) return a.index = c.index, c.output?.length && a.output.push(...c.output), true;
341
+ {
342
+ const Z = a.output.length;
343
+ if (n(a)) {
344
+ const D = a.index, U = a.output.length;
345
+ if (U > Z) {
346
+ const ee = a.output.slice(Z, U);
347
+ s.set(u, { index: D, output: ee });
348
+ } else s.set(u, D);
349
+ return true;
350
+ } else return s.set(u, false), false;
351
+ }
352
+ };
353
+ };
354
+ })(), E = (r) => {
355
+ let e;
356
+ return (n) => (e || (e = v(r())), e(n));
357
+ }, v = Y((r) => {
358
+ if (d(r)) return Q(r) ? E(r) : r;
359
+ if (b(r) || X(r)) return i(r);
360
+ if (A(r)) return x(r);
361
+ if (K(r)) return l(Object.values(r));
362
+ throw new Error("Invalid rule");
363
+ }), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
364
+ let e = "";
365
+ for (; r > 0; ) {
366
+ const n = (r - 1) % 26;
367
+ e = P[n] + e, r = Math.floor((r - 1) / 26);
368
+ }
369
+ return e;
370
+ }, z = (r) => {
371
+ let e = 0;
372
+ for (let n = 0, t = r.length; n < t; n++) e = e * 26 + P.indexOf(r[n]) + 1;
373
+ return e;
374
+ }, S = (r, e) => {
375
+ if (e < r) return S(e, r);
376
+ const n = [];
377
+ for (; r <= e; ) n.push(r++);
378
+ return n;
379
+ }, or = (r, e, n) => S(r, e).map((t) => String(t).padStart(n, "0")), O = (r, e) => S(z(r), z(e)).map(ir), p = (r) => r, R = (r) => ur((e) => rr(e, r, { memoization: false }).join("")), ur = (r) => {
380
+ const e = {};
381
+ return (n) => e[n] ?? (e[n] = r(n));
382
+ }, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, t) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${t.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), hr = i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i(/^(!!)+/, ""), fr = l([hr, dr]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([Sr, yr]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, ar(Ar), f(Er), wr]), Pr = i("{", "(?:"), zr = i("}", ")"), Or = i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), Rr = i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => O(e, n).join("|")), jr = i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => O(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([Or, Rr, jr]), I = x([Pr, Nr, zr]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), Zr = E(() => F), Dr = l([j, N, k, B, I, Zr, y, Fr, Ir, Lr]), F = x([kr, f(Dr), Br]), Ur = f(l([sr, cr, lr, fr, j, N, k, B, I, F, y, pr, vr])), Vr = Ur, Gr = R(Vr), L = Gr, Tr = i(/\\./, p), qr = i(/./, p), Hr = i(/\*\*\*+/, "*"), Jr = i(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = R(Kr), Yr = Xr, $ = (r, e) => {
383
+ const n = Array.isArray(r) ? r : [r];
384
+ if (!n.length) return false;
385
+ const t = n.map($.compile), a = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, a ? "/" : "");
386
+ return t.some((s) => s.test(o));
387
+ };
388
+ $.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
389
+ var re = $;
390
+ return J(w);
391
+ })();
392
+ return __lib__.default || __lib__;
393
+ };
394
+ var _match;
395
+ var zeptomatch = (path2, pattern) => {
396
+ if (!_match) {
397
+ _match = _lazyMatch();
398
+ _lazyMatch = null;
399
+ }
400
+ return _match(path2, pattern);
401
+ };
402
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
403
+ function normalizeWindowsPath(input = "") {
404
+ if (!input) {
405
+ return input;
406
+ }
407
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
408
+ }
409
+ var _UNC_REGEX = /^[/\\]{2}/;
410
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
411
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
412
+ var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
413
+ var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
414
+ var _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
415
+ var sep = "/";
416
+ var normalize = function(path2) {
417
+ if (path2.length === 0) {
418
+ return ".";
419
+ }
420
+ path2 = normalizeWindowsPath(path2);
421
+ const isUNCPath = path2.match(_UNC_REGEX);
422
+ const isPathAbsolute = isAbsolute(path2);
423
+ const trailingSeparator = path2[path2.length - 1] === "/";
424
+ path2 = normalizeString(path2, !isPathAbsolute);
425
+ if (path2.length === 0) {
426
+ if (isPathAbsolute) {
427
+ return "/";
428
+ }
429
+ return trailingSeparator ? "./" : ".";
430
+ }
431
+ if (trailingSeparator) {
432
+ path2 += "/";
433
+ }
434
+ if (_DRIVE_LETTER_RE.test(path2)) {
435
+ path2 += "/";
436
+ }
437
+ if (isUNCPath) {
438
+ if (!isPathAbsolute) {
439
+ return `//./${path2}`;
440
+ }
441
+ return `//${path2}`;
442
+ }
443
+ return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
444
+ };
445
+ var join = function(...segments) {
446
+ let path2 = "";
447
+ for (const seg of segments) {
448
+ if (!seg) {
449
+ continue;
450
+ }
451
+ if (path2.length > 0) {
452
+ const pathTrailing = path2[path2.length - 1] === "/";
453
+ const segLeading = seg[0] === "/";
454
+ const both = pathTrailing && segLeading;
455
+ if (both) {
456
+ path2 += seg.slice(1);
457
+ } else {
458
+ path2 += pathTrailing || segLeading ? seg : `/${seg}`;
459
+ }
460
+ } else {
461
+ path2 += seg;
462
+ }
463
+ }
464
+ return normalize(path2);
465
+ };
466
+ function cwd() {
467
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
468
+ return process.cwd().replace(/\\/g, "/");
469
+ }
470
+ return "/";
471
+ }
472
+ var resolve = function(...arguments_) {
473
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
474
+ let resolvedPath = "";
475
+ let resolvedAbsolute = false;
476
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
477
+ const path2 = index >= 0 ? arguments_[index] : cwd();
478
+ if (!path2 || path2.length === 0) {
479
+ continue;
480
+ }
481
+ resolvedPath = `${path2}/${resolvedPath}`;
482
+ resolvedAbsolute = isAbsolute(path2);
483
+ }
484
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
485
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
486
+ return `/${resolvedPath}`;
487
+ }
488
+ return resolvedPath.length > 0 ? resolvedPath : ".";
489
+ };
490
+ function normalizeString(path2, allowAboveRoot) {
491
+ let res = "";
492
+ let lastSegmentLength = 0;
493
+ let lastSlash = -1;
494
+ let dots = 0;
495
+ let char = null;
496
+ for (let index = 0; index <= path2.length; ++index) {
497
+ if (index < path2.length) {
498
+ char = path2[index];
499
+ } else if (char === "/") {
500
+ break;
501
+ } else {
502
+ char = "/";
503
+ }
504
+ if (char === "/") {
505
+ if (lastSlash === index - 1 || dots === 1) ;
506
+ else if (dots === 2) {
507
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
508
+ if (res.length > 2) {
509
+ const lastSlashIndex = res.lastIndexOf("/");
510
+ if (lastSlashIndex === -1) {
511
+ res = "";
512
+ lastSegmentLength = 0;
513
+ } else {
514
+ res = res.slice(0, lastSlashIndex);
515
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
516
+ }
517
+ lastSlash = index;
518
+ dots = 0;
519
+ continue;
520
+ } else if (res.length > 0) {
521
+ res = "";
522
+ lastSegmentLength = 0;
523
+ lastSlash = index;
524
+ dots = 0;
525
+ continue;
526
+ }
527
+ }
528
+ if (allowAboveRoot) {
529
+ res += res.length > 0 ? "/.." : "..";
530
+ lastSegmentLength = 2;
531
+ }
532
+ } else {
533
+ if (res.length > 0) {
534
+ res += `/${path2.slice(lastSlash + 1, index)}`;
535
+ } else {
536
+ res = path2.slice(lastSlash + 1, index);
537
+ }
538
+ lastSegmentLength = index - lastSlash - 1;
539
+ }
540
+ lastSlash = index;
541
+ dots = 0;
542
+ } else if (char === "." && dots !== -1) {
543
+ ++dots;
544
+ } else {
545
+ dots = -1;
546
+ }
547
+ }
548
+ return res;
549
+ }
550
+ var isAbsolute = function(p) {
551
+ return _IS_ABSOLUTE_RE.test(p);
552
+ };
553
+ var toNamespacedPath = function(p) {
554
+ return normalizeWindowsPath(p);
555
+ };
556
+ var extname = function(p) {
557
+ if (p === "..") return "";
558
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
559
+ return match && match[1] || "";
560
+ };
561
+ var relative = function(from, to) {
562
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
563
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
564
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
565
+ return _to.join("/");
566
+ }
567
+ const _fromCopy = [..._from];
568
+ for (const segment of _fromCopy) {
569
+ if (_to[0] !== segment) {
570
+ break;
571
+ }
572
+ _from.shift();
573
+ _to.shift();
574
+ }
575
+ return [..._from.map(() => ".."), ..._to].join("/");
576
+ };
577
+ var dirname = function(p) {
578
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
579
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
580
+ segments[0] += "/";
581
+ }
582
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
583
+ };
584
+ var format = function(p) {
585
+ const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
586
+ const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
587
+ Boolean
588
+ );
589
+ return normalizeWindowsPath(
590
+ p.root ? resolve(...segments) : segments.join("/")
591
+ );
592
+ };
593
+ var basename = function(p, extension) {
594
+ const segments = normalizeWindowsPath(p).split("/");
595
+ let lastSegment = "";
596
+ for (let i = segments.length - 1; i >= 0; i--) {
597
+ const val = segments[i];
598
+ if (val) {
599
+ lastSegment = val;
600
+ break;
601
+ }
602
+ }
603
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
604
+ };
605
+ var parse = function(p) {
606
+ const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
607
+ const base = basename(p);
608
+ const extension = extname(base);
609
+ return {
610
+ root,
611
+ dir: dirname(p),
612
+ base,
613
+ ext: extension,
614
+ name: base.slice(0, base.length - extension.length)
615
+ };
616
+ };
617
+ var matchesGlob = (path2, pattern) => {
618
+ return zeptomatch(pattern, normalize(path2));
619
+ };
620
+ var _path = {
621
+ __proto__: null,
622
+ basename,
623
+ dirname,
624
+ extname,
625
+ format,
626
+ isAbsolute,
627
+ join,
628
+ matchesGlob,
629
+ normalize,
630
+ normalizeString,
631
+ parse,
632
+ relative,
633
+ resolve,
634
+ sep,
635
+ toNamespacedPath
636
+ };
637
+
638
+ // ../../node_modules/.pnpm/pathe@2.0.2/node_modules/pathe/dist/index.mjs
639
+ var delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
640
+ var _platforms = { posix: void 0, win32: void 0 };
641
+ var mix = (del = delimiter) => {
642
+ return new Proxy(_path, {
643
+ get(_, prop) {
644
+ if (prop === "delimiter") return del;
645
+ if (prop === "posix") return posix;
646
+ if (prop === "win32") return win32;
647
+ return _platforms[prop] || _path[prop];
648
+ }
649
+ });
650
+ };
651
+ var posix = /* @__PURE__ */ mix(":");
652
+ var win32 = /* @__PURE__ */ mix(";");
653
+
654
+ // src/utils.ts
232
655
  function removeFileExtension(filePath) {
233
656
  if (!filePath) {
234
657
  return "";
235
658
  }
236
- let baseName = path.basename(filePath);
237
- let ext = path.extname(baseName);
659
+ let baseName = posix.basename(filePath);
660
+ let ext = posix.extname(baseName);
238
661
  while (ext) {
239
662
  baseName = baseName.slice(0, -ext.length);
240
- ext = path.extname(baseName);
663
+ ext = posix.extname(baseName);
241
664
  }
242
- const dir = path.dirname(filePath);
243
- return path.join(dir, baseName);
665
+ const dir = posix.dirname(filePath);
666
+ return posix.join(dir, baseName);
244
667
  }
245
668
  function md5(input) {
246
669
  const hash = crypto.createHash("md5");
@@ -255,7 +678,7 @@ function getDefaultConfig() {
255
678
  config: void 0,
256
679
  // 倒叙插入
257
680
  directiveParams: ["utilities", "components"],
258
- cwd: process.cwd(),
681
+ cwd: process2.cwd(),
259
682
  extensions: ["wxml", "js", "ts"],
260
683
  // @import and @use (scss)
261
684
  insertAfterAtRulesNames: ["import", "use"],
@@ -272,7 +695,7 @@ var postcssPlugin = "postcss-tailwindcss-injector";
272
695
 
273
696
  // src/wxml.ts
274
697
  init_esm_shims();
275
- import path2 from "node:path";
698
+ import path from "node:path";
276
699
  import fs from "fs-extra";
277
700
  import { Parser } from "htmlparser2";
278
701
  import MagicString from "magic-string";
@@ -337,7 +760,7 @@ function processWxml(wxml) {
337
760
  }
338
761
  async function getDep(filepath, set2) {
339
762
  if (await fs.exists(filepath)) {
340
- const dirname = path2.dirname(filepath);
763
+ const dirname2 = path.dirname(filepath);
341
764
  set2.add(filepath);
342
765
  const wxml = await fs.readFile(filepath, "utf8");
343
766
  const hash = md5(wxml);
@@ -353,7 +776,7 @@ async function getDep(filepath, set2) {
353
776
  deps = cacheDeps;
354
777
  }
355
778
  for (const { value } of deps) {
356
- const p = path2.resolve(dirname, value);
779
+ const p = path.resolve(dirname2, value);
357
780
  if (!set2.has(p)) {
358
781
  await getDep(p, set2);
359
782
  }
@@ -368,7 +791,7 @@ async function getDepFiles(file) {
368
791
 
369
792
  // src/postcss.ts
370
793
  var creator = (options) => {
371
- const { config, filter, directiveParams, cwd, extensions, insertAfterAtRulesNames, insertAfterComments } = getConfig(options);
794
+ const { config, filter, directiveParams, cwd: cwd2, extensions, insertAfterAtRulesNames, insertAfterComments } = getConfig(options);
372
795
  const extensionsGlob = `{${extensions.join(",")}}`;
373
796
  return {
374
797
  postcssPlugin,
@@ -395,7 +818,7 @@ var creator = (options) => {
395
818
  let tailwindcssConfig;
396
819
  if (typeof cfg === "string") {
397
820
  tailwindcssConfig = await loadConfig({
398
- cwd,
821
+ cwd: cwd2,
399
822
  config: cfg
400
823
  });
401
824
  } else {
@@ -404,11 +827,11 @@ var creator = (options) => {
404
827
  };
405
828
  }
406
829
  if (tailwindcssConfig && root.source?.input && root.source.input.file) {
407
- const basename = removeFileExtension(root.source.input.file);
830
+ const basename2 = removeFileExtension(root.source.input.file);
408
831
  (0, import_set_value.default)(tailwindcssConfig, "content", [
409
- `${basename}.${extensionsGlob}`
832
+ `${basename2}.${extensionsGlob}`
410
833
  ]);
411
- const deps = await getDepFiles(`${basename}.wxml`);
834
+ const deps = await getDepFiles(`${basename2}.wxml`);
412
835
  for (const dep of deps) {
413
836
  if (Array.isArray(tailwindcssConfig.content)) {
414
837
  tailwindcssConfig.content.push(`${removeFileExtension(dep)}.${extensionsGlob}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tailwindcss-injector",
3
3
  "type": "module",
4
- "version": "0.1.6-alpha.2",
4
+ "version": "0.1.6-alpha.4",
5
5
  "description": "tsup(esbuild) build package template",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -36,8 +36,8 @@
36
36
  "magic-string": "^0.30.17",
37
37
  "postcss": "^8.5.1",
38
38
  "tailwindcss": "^3.4.17",
39
- "@weapp-tailwindcss/shared": "1.0.0-alpha.2",
40
- "tailwindcss-config": "0.0.0"
39
+ "tailwindcss-config": "0.0.0",
40
+ "@weapp-tailwindcss/shared": "1.0.0-alpha.4"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "tsup --watch --sourcemap",