weapp-tailwindcss 4.8.1 → 4.8.3

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 (43) hide show
  1. package/dist/{chunk-MYNTKRVT.js → chunk-26ZRX6OH.js} +33 -25
  2. package/dist/{chunk-KMCQEHJM.js → chunk-2ZEOKKVA.js} +159 -41
  3. package/dist/{chunk-YW5YW5D4.mjs → chunk-7KTLLGAG.mjs} +164 -46
  4. package/dist/{chunk-MSFAEBH6.mjs → chunk-E3GZQTOH.mjs} +17 -9
  5. package/dist/{chunk-U7OMIV3S.js → chunk-H34KPZQW.js} +2 -2
  6. package/dist/{chunk-YHZB3KHY.mjs → chunk-KSHK56CW.mjs} +1 -1
  7. package/dist/{chunk-QNGB574L.js → chunk-N2ZUYGKA.js} +6 -6
  8. package/dist/{chunk-3RXY3OXF.mjs → chunk-NLLCK6RM.mjs} +1 -1
  9. package/dist/{chunk-X7QD7NUX.js → chunk-PLV4QGF4.js} +76 -28
  10. package/dist/{chunk-BTPDRSHI.mjs → chunk-QGH4JZRW.mjs} +1 -1
  11. package/dist/{chunk-NQTLEEK5.js → chunk-UCA2DMVN.js} +5 -5
  12. package/dist/{chunk-XGRBCPBI.js → chunk-UJIUFWXE.js} +1 -1
  13. package/dist/{chunk-DHHTSM3K.mjs → chunk-UUVGNRUM.mjs} +1 -1
  14. package/dist/{chunk-5XFZ2DUB.js → chunk-W5Z3I3S2.js} +21 -21
  15. package/dist/{chunk-TTCMOWCO.mjs → chunk-WTOLVORM.mjs} +74 -26
  16. package/dist/cli.js +14 -14
  17. package/dist/cli.mjs +5 -5
  18. package/dist/core.js +9 -9
  19. package/dist/core.mjs +3 -3
  20. package/dist/css-macro/postcss.js +1 -1
  21. package/dist/css-macro/postcss.mjs +1 -1
  22. package/dist/css-macro.js +1 -1
  23. package/dist/css-macro.mjs +1 -1
  24. package/dist/defaults.js +1 -1
  25. package/dist/defaults.mjs +1 -1
  26. package/dist/gulp.js +5 -5
  27. package/dist/gulp.mjs +4 -4
  28. package/dist/index.js +9 -9
  29. package/dist/index.mjs +7 -7
  30. package/dist/postcss-html-transform.js +1 -1
  31. package/dist/postcss-html-transform.mjs +1 -1
  32. package/dist/presets.js +3 -3
  33. package/dist/presets.mjs +2 -2
  34. package/dist/types.js +1 -1
  35. package/dist/types.mjs +1 -1
  36. package/dist/vite.js +6 -6
  37. package/dist/vite.mjs +4 -4
  38. package/dist/weapp-tw-runtime-loader.js +66 -2
  39. package/dist/webpack.js +7 -7
  40. package/dist/webpack.mjs +5 -5
  41. package/dist/webpack4.js +34 -27
  42. package/dist/webpack4.mjs +17 -10
  43. package/package.json +1 -1
@@ -3,19 +3,87 @@ import {
3
3
  } from "./chunk-ZNKIYZRQ.mjs";
4
4
 
5
5
  // src/context/tailwindcss.ts
6
+ import { existsSync as existsSync3 } from "fs";
6
7
  import { createRequire as createRequire2 } from "module";
7
- import path2 from "path";
8
+ import path3 from "path";
8
9
  import process2 from "process";
9
10
  import { fileURLToPath as fileURLToPath2 } from "url";
10
11
  import { logger as logger2 } from "@weapp-tailwindcss/logger";
11
12
 
13
+ // src/context/workspace.ts
14
+ import { existsSync, readdirSync, readFileSync } from "fs";
15
+ import path from "path";
16
+ var IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
17
+ "node_modules",
18
+ ".git",
19
+ ".hg",
20
+ ".svn",
21
+ ".turbo",
22
+ ".output",
23
+ ".next",
24
+ "dist",
25
+ "build"
26
+ ]);
27
+ function findWorkspaceRoot(startDir) {
28
+ if (!startDir) {
29
+ return void 0;
30
+ }
31
+ let current = path.resolve(startDir);
32
+ while (true) {
33
+ const workspaceFile = path.join(current, "pnpm-workspace.yaml");
34
+ if (existsSync(workspaceFile)) {
35
+ return current;
36
+ }
37
+ const parent = path.dirname(current);
38
+ if (parent === current) {
39
+ return void 0;
40
+ }
41
+ current = parent;
42
+ }
43
+ }
44
+ function findWorkspacePackageDir(rootDir, packageName) {
45
+ const visited = /* @__PURE__ */ new Set();
46
+ const queue = [path.resolve(rootDir)];
47
+ while (queue.length > 0) {
48
+ const current = queue.shift();
49
+ const normalized = path.normalize(current);
50
+ if (visited.has(normalized)) {
51
+ continue;
52
+ }
53
+ visited.add(normalized);
54
+ try {
55
+ const pkgPath = path.join(normalized, "package.json");
56
+ if (existsSync(pkgPath)) {
57
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
58
+ if (pkg?.name === packageName) {
59
+ return normalized;
60
+ }
61
+ }
62
+ } catch {
63
+ }
64
+ let entries;
65
+ try {
66
+ entries = readdirSync(normalized, { withFileTypes: true });
67
+ } catch {
68
+ continue;
69
+ }
70
+ for (const entry of entries) {
71
+ if (!entry.isDirectory() || IGNORED_WORKSPACE_DIRS.has(entry.name) || entry.isSymbolicLink?.()) {
72
+ continue;
73
+ }
74
+ queue.push(path.join(normalized, entry.name));
75
+ }
76
+ }
77
+ return void 0;
78
+ }
79
+
12
80
  // src/tailwindcss/index.ts
13
81
  import { getPackageInfoSync } from "local-pkg";
14
82
 
15
83
  // src/tailwindcss/patcher.ts
16
- import { existsSync } from "fs";
84
+ import { existsSync as existsSync2 } from "fs";
17
85
  import { createRequire } from "module";
18
- import path from "path";
86
+ import path2 from "path";
19
87
  import process from "process";
20
88
  import { fileURLToPath } from "url";
21
89
  import { logger } from "@weapp-tailwindcss/logger";
@@ -33,7 +101,7 @@ function isPathSpecifier(specifier) {
33
101
  if (specifier.startsWith("file://")) {
34
102
  return true;
35
103
  }
36
- if (path.isAbsolute(specifier)) {
104
+ if (path2.isAbsolute(specifier)) {
37
105
  return true;
38
106
  }
39
107
  return GENERIC_RELATIVE_SPECIFIERS.some((prefix) => specifier.startsWith(`${prefix}/`) || specifier.startsWith(`${prefix}\\`));
@@ -103,13 +171,13 @@ function findNearestPackageRoot(startDir) {
103
171
  if (!startDir) {
104
172
  return void 0;
105
173
  }
106
- let current = path.resolve(startDir);
174
+ let current = path2.resolve(startDir);
107
175
  while (true) {
108
- const pkgPath = path.join(current, "package.json");
109
- if (existsSync(pkgPath)) {
176
+ const pkgPath = path2.join(current, "package.json");
177
+ if (existsSync2(pkgPath)) {
110
178
  return current;
111
179
  }
112
- const parent = path.dirname(current);
180
+ const parent = path2.dirname(current);
113
181
  if (parent === current) {
114
182
  return void 0;
115
183
  }
@@ -120,8 +188,8 @@ function appendNodeModules(paths, dir) {
120
188
  if (!dir) {
121
189
  return;
122
190
  }
123
- const nodeModulesDir = path.join(dir, "node_modules");
124
- if (existsSync(nodeModulesDir)) {
191
+ const nodeModulesDir = path2.join(dir, "node_modules");
192
+ if (existsSync2(nodeModulesDir)) {
125
193
  paths.add(nodeModulesDir);
126
194
  }
127
195
  }
@@ -136,8 +204,8 @@ var TAILWIND_CONFIG_FILES = [
136
204
  function findTailwindConfig(searchRoots) {
137
205
  for (const root of searchRoots) {
138
206
  for (const file of TAILWIND_CONFIG_FILES) {
139
- const candidate = path.resolve(root, file);
140
- if (existsSync(candidate)) {
207
+ const candidate = path2.resolve(root, file);
208
+ if (existsSync2(candidate)) {
141
209
  return candidate;
142
210
  }
143
211
  }
@@ -148,7 +216,7 @@ function createDefaultResolvePaths(basedir) {
148
216
  const paths = /* @__PURE__ */ new Set();
149
217
  let fallbackCandidates = [];
150
218
  if (basedir) {
151
- const resolvedBase = path.resolve(basedir);
219
+ const resolvedBase = path2.resolve(basedir);
152
220
  appendNodeModules(paths, resolvedBase);
153
221
  fallbackCandidates.push(resolvedBase);
154
222
  const packageRoot = findNearestPackageRoot(resolvedBase);
@@ -161,7 +229,7 @@ function createDefaultResolvePaths(basedir) {
161
229
  appendNodeModules(paths, cwd);
162
230
  try {
163
231
  const modulePath = fileURLToPath(import.meta.url);
164
- const candidate = existsSync(modulePath) && !path.extname(modulePath) ? modulePath : path.dirname(modulePath);
232
+ const candidate = existsSync2(modulePath) && !path2.extname(modulePath) ? modulePath : path2.dirname(modulePath);
165
233
  paths.add(candidate);
166
234
  } catch {
167
235
  paths.add(import.meta.url);
@@ -251,18 +319,18 @@ function normalizeTailwindcssPatcherOptions(options) {
251
319
  function createTailwindcssPatcher(options) {
252
320
  const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {};
253
321
  const cache = {};
254
- const normalizedBasedir = basedir ? path.resolve(basedir) : void 0;
322
+ const normalizedBasedir = basedir ? path2.resolve(basedir) : void 0;
255
323
  const cacheRoot = findNearestPackageRoot(normalizedBasedir) ?? normalizedBasedir ?? process.cwd();
256
324
  if (cacheDir) {
257
- if (path.isAbsolute(cacheDir)) {
325
+ if (path2.isAbsolute(cacheDir)) {
258
326
  cache.dir = cacheDir;
259
327
  } else if (normalizedBasedir) {
260
- cache.dir = path.resolve(normalizedBasedir, cacheDir);
328
+ cache.dir = path2.resolve(normalizedBasedir, cacheDir);
261
329
  } else {
262
- cache.dir = path.resolve(process.cwd(), cacheDir);
330
+ cache.dir = path2.resolve(process.cwd(), cacheDir);
263
331
  }
264
332
  } else {
265
- cache.dir = path.join(cacheRoot, "node_modules", ".cache", "tailwindcss-patch");
333
+ cache.dir = path2.join(cacheRoot, "node_modules", ".cache", "tailwindcss-patch");
266
334
  }
267
335
  if (normalizedBasedir) {
268
336
  cache.cwd = normalizedBasedir;
@@ -339,7 +407,7 @@ function createTailwindcssPatcher(options) {
339
407
  searchRoots.add(resolvedOptions.tailwind.cwd);
340
408
  }
341
409
  for (const resolvePath of resolvedOptions.tailwind.resolve?.paths ?? []) {
342
- const parentDir = path.dirname(resolvePath);
410
+ const parentDir = path2.dirname(resolvePath);
343
411
  searchRoots.add(parentDir);
344
412
  }
345
413
  const configPath = findTailwindConfig(searchRoots);
@@ -357,7 +425,7 @@ function createTailwindcssPatcher(options) {
357
425
  }
358
426
  }
359
427
  if (!resolvedOptions.tailwind.cwd && configPath) {
360
- resolvedOptions.tailwind.cwd = path.dirname(configPath);
428
+ resolvedOptions.tailwind.cwd = path2.dirname(configPath);
361
429
  }
362
430
  }
363
431
  try {
@@ -401,7 +469,7 @@ function isModernTailwindcssPatchOptions(options) {
401
469
  function pickEnvBasedir() {
402
470
  for (const key of ENV_BASEDIR_KEYS) {
403
471
  const value = process2.env[key];
404
- if (value && path2.isAbsolute(value)) {
472
+ if (value && path3.isAbsolute(value)) {
405
473
  return { key, value };
406
474
  }
407
475
  }
@@ -410,13 +478,13 @@ function pickEnvBasedir() {
410
478
  function pickPackageEnvBasedir() {
411
479
  const packageJsonPath = process2.env.npm_package_json;
412
480
  if (packageJsonPath) {
413
- const packageDir = path2.dirname(packageJsonPath);
414
- if (packageDir && path2.isAbsolute(packageDir)) {
481
+ const packageDir = path3.dirname(packageJsonPath);
482
+ if (packageDir && path3.isAbsolute(packageDir)) {
415
483
  return packageDir;
416
484
  }
417
485
  }
418
486
  const localPrefix = process2.env.npm_config_local_prefix;
419
- if (localPrefix && path2.isAbsolute(localPrefix)) {
487
+ if (localPrefix && path3.isAbsolute(localPrefix)) {
420
488
  return localPrefix;
421
489
  }
422
490
  return void 0;
@@ -445,22 +513,22 @@ function detectCallerBasedir() {
445
513
  }
446
514
  }
447
515
  const [candidate] = filePath.split(":");
448
- const resolvedPath = path2.isAbsolute(filePath) ? filePath : candidate;
449
- if (!path2.isAbsolute(resolvedPath)) {
516
+ const resolvedPath = path3.isAbsolute(filePath) ? filePath : candidate;
517
+ if (!path3.isAbsolute(resolvedPath)) {
450
518
  continue;
451
519
  }
452
520
  if (resolvedPath.includes("node_modules") && resolvedPath.includes("weapp-tailwindcss")) {
453
521
  continue;
454
522
  }
455
523
  try {
456
- return path2.dirname(resolvedPath);
524
+ return path3.dirname(resolvedPath);
457
525
  } catch {
458
526
  continue;
459
527
  }
460
528
  }
461
529
  return void 0;
462
530
  }
463
- function resolveTailwindcssBasedir(basedir) {
531
+ function resolveTailwindcssBasedir(basedir, fallback) {
464
532
  const envBasedirResult = pickEnvBasedir();
465
533
  const envBasedir = envBasedirResult?.value;
466
534
  const envBasedirKey = envBasedirResult?.key;
@@ -468,7 +536,7 @@ function resolveTailwindcssBasedir(basedir) {
468
536
  const packageEnvBasedir = pickPackageEnvBasedir();
469
537
  const shouldDetectCaller = !envBasedir || envBasedirIsGeneric;
470
538
  const callerBasedir = shouldDetectCaller ? detectCallerBasedir() : void 0;
471
- const anchor = envBasedir ?? packageEnvBasedir ?? callerBasedir ?? process2.cwd();
539
+ const anchor = envBasedir ?? packageEnvBasedir ?? fallback ?? callerBasedir ?? process2.cwd();
472
540
  if (process2.env.WEAPP_TW_DEBUG_STACK === "1") {
473
541
  logger2.debug("resolveTailwindcssBasedir anchor %O", {
474
542
  basedir,
@@ -476,6 +544,7 @@ function resolveTailwindcssBasedir(basedir) {
476
544
  envBasedirKey,
477
545
  envBasedirIsGeneric,
478
546
  packageEnvBasedir,
547
+ fallback,
479
548
  callerBasedir,
480
549
  npm_package_json: process2.env.npm_package_json,
481
550
  cwd: process2.cwd(),
@@ -483,43 +552,91 @@ function resolveTailwindcssBasedir(basedir) {
483
552
  });
484
553
  }
485
554
  if (basedir && basedir.trim().length > 0) {
486
- if (path2.isAbsolute(basedir)) {
487
- return path2.normalize(basedir);
555
+ if (path3.isAbsolute(basedir)) {
556
+ return path3.normalize(basedir);
488
557
  }
489
- return path2.resolve(anchor, basedir);
558
+ return path3.resolve(anchor, basedir);
490
559
  }
491
560
  if (envBasedir && !envBasedirIsGeneric) {
492
- return path2.normalize(envBasedir);
561
+ return path3.normalize(envBasedir);
562
+ }
563
+ if (fallback && fallback.trim().length > 0) {
564
+ const resolvedFallback = path3.isAbsolute(fallback) ? fallback : path3.resolve(anchor, fallback);
565
+ return path3.normalize(resolvedFallback);
493
566
  }
494
567
  if (packageEnvBasedir) {
495
- return path2.normalize(packageEnvBasedir);
568
+ return path3.normalize(packageEnvBasedir);
496
569
  }
497
570
  if (callerBasedir) {
498
- const normalizedCaller = path2.normalize(callerBasedir);
499
- const librarySegment = `${path2.sep}weapp-tailwindcss${path2.sep}`;
571
+ const normalizedCaller = path3.normalize(callerBasedir);
572
+ const librarySegment = `${path3.sep}weapp-tailwindcss${path3.sep}`;
500
573
  if (!normalizedCaller.includes(librarySegment)) {
501
574
  return normalizedCaller;
502
575
  }
503
576
  }
504
- if (envBasedir) {
505
- return path2.normalize(envBasedir);
506
- }
507
577
  const packageName = process2.env.PNPM_PACKAGE_NAME;
508
578
  if (packageName) {
509
579
  try {
510
- const anchorRequire = createRequire2(path2.join(anchor, "__resolve_tailwindcss_basedir__.cjs"));
580
+ const anchorRequire = createRequire2(path3.join(anchor, "__resolve_tailwindcss_basedir__.cjs"));
511
581
  const packageJsonPath = anchorRequire.resolve(`${packageName}/package.json`);
512
582
  if (process2.env.WEAPP_TW_DEBUG_STACK === "1") {
513
583
  logger2.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
514
584
  }
515
- return path2.normalize(path2.dirname(packageJsonPath));
585
+ return path3.normalize(path3.dirname(packageJsonPath));
516
586
  } catch {
517
587
  if (process2.env.WEAPP_TW_DEBUG_STACK === "1") {
518
588
  logger2.debug("failed to resolve package json for %s", packageName);
519
589
  }
590
+ const workspaceRoot = findWorkspaceRoot(anchor);
591
+ if (workspaceRoot) {
592
+ const packageDir = findWorkspacePackageDir(workspaceRoot, packageName);
593
+ if (packageDir) {
594
+ return packageDir;
595
+ }
596
+ }
597
+ }
598
+ }
599
+ if (envBasedir) {
600
+ return path3.normalize(envBasedir);
601
+ }
602
+ return path3.normalize(process2.cwd());
603
+ }
604
+ function findNearestPackageRootFromDir(startDir) {
605
+ if (!startDir) {
606
+ return void 0;
607
+ }
608
+ let current = path3.resolve(startDir);
609
+ while (true) {
610
+ const pkgPath = path3.join(current, "package.json");
611
+ if (existsSync3(pkgPath)) {
612
+ return current;
613
+ }
614
+ const parent = path3.dirname(current);
615
+ if (parent === current) {
616
+ return void 0;
617
+ }
618
+ current = parent;
619
+ }
620
+ }
621
+ function guessBasedirFromEntries(entries) {
622
+ if (!entries) {
623
+ return void 0;
624
+ }
625
+ for (const entry of entries) {
626
+ if (typeof entry !== "string") {
627
+ continue;
628
+ }
629
+ const trimmed = entry.trim();
630
+ if (!trimmed || !path3.isAbsolute(trimmed)) {
631
+ continue;
632
+ }
633
+ const entryDir = path3.dirname(trimmed);
634
+ const resolved = findNearestPackageRootFromDir(entryDir) ?? entryDir;
635
+ if (resolved) {
636
+ return resolved;
520
637
  }
521
638
  }
522
- return path2.normalize(process2.cwd());
639
+ return void 0;
523
640
  }
524
641
  function normalizeCssEntries(entries, anchor) {
525
642
  if (!entries || entries.length === 0) {
@@ -534,7 +651,7 @@ function normalizeCssEntries(entries, anchor) {
534
651
  if (trimmed.length === 0) {
535
652
  continue;
536
653
  }
537
- const resolved = path2.isAbsolute(trimmed) ? path2.normalize(trimmed) : path2.normalize(path2.resolve(anchor, trimmed));
654
+ const resolved = path3.isAbsolute(trimmed) ? path3.normalize(trimmed) : path3.normalize(path3.resolve(anchor, trimmed));
538
655
  normalized.add(resolved);
539
656
  }
540
657
  return normalized.size > 0 ? [...normalized] : void 0;
@@ -542,7 +659,7 @@ function normalizeCssEntries(entries, anchor) {
542
659
  function groupCssEntriesByBase(entries) {
543
660
  const groups = /* @__PURE__ */ new Map();
544
661
  for (const entry of entries) {
545
- const baseDir = path2.normalize(path2.dirname(entry));
662
+ const baseDir = path3.normalize(path3.dirname(entry));
546
663
  const bucket = groups.get(baseDir);
547
664
  if (bucket) {
548
665
  bucket.push(entry);
@@ -758,7 +875,8 @@ function createTailwindcssPatcherFromContext(ctx) {
758
875
  cssEntries: rawCssEntries,
759
876
  appType
760
877
  } = ctx;
761
- const resolvedTailwindcssBasedir = resolveTailwindcssBasedir(tailwindcssBasedir);
878
+ const absoluteCssEntryBasedir = guessBasedirFromEntries(rawCssEntries);
879
+ const resolvedTailwindcssBasedir = resolveTailwindcssBasedir(tailwindcssBasedir, absoluteCssEntryBasedir);
762
880
  ctx.tailwindcssBasedir = resolvedTailwindcssBasedir;
763
881
  logger2.debug("tailwindcss basedir resolved: %s", resolvedTailwindcssBasedir);
764
882
  const normalizedCssEntries = normalizeCssEntries(rawCssEntries, resolvedTailwindcssBasedir);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  applyTailwindcssCssImportRewrite,
3
3
  getCacheKey
4
- } from "./chunk-YHZB3KHY.mjs";
4
+ } from "./chunk-KSHK56CW.mjs";
5
5
  import {
6
6
  pushConcurrentTaskFactories,
7
7
  resolveOutputSpecifier,
@@ -18,13 +18,13 @@ import {
18
18
  getCompilerContext,
19
19
  pluginName,
20
20
  refreshTailwindRuntimeState
21
- } from "./chunk-TTCMOWCO.mjs";
21
+ } from "./chunk-WTOLVORM.mjs";
22
22
  import {
23
23
  getGroupedEntries
24
24
  } from "./chunk-ZNKIYZRQ.mjs";
25
25
  import {
26
26
  __dirname
27
- } from "./chunk-BTPDRSHI.mjs";
27
+ } from "./chunk-QGH4JZRW.mjs";
28
28
 
29
29
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
30
30
  import fs from "fs";
@@ -82,20 +82,28 @@ var UnifiedWebpackPluginV5 = class {
82
82
  onLoad();
83
83
  const loader = runtimeLoaderPath ?? path.resolve(__dirname, "./weapp-tw-runtime-loader.js");
84
84
  const isExisted = fs.existsSync(loader);
85
- const WeappTwRuntimeAopLoader = {
85
+ const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
86
+ pkgDir: weappTailwindcssPackageDir
87
+ } : void 0;
88
+ const runtimeLoaderOptions = {
89
+ getClassSet: getClassSetInLoader,
90
+ rewriteCssImports: runtimeLoaderRewriteOptions
91
+ };
92
+ const createRuntimeLoaderEntry = () => ({
86
93
  loader,
87
- options: {
88
- getClassSet: getClassSetInLoader
89
- },
94
+ options: runtimeLoaderOptions,
90
95
  ident: null,
91
96
  type: null
92
- };
97
+ });
93
98
  compiler.hooks.compilation.tap(pluginName, (compilation) => {
94
99
  NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (_loaderContext, module) => {
95
100
  if (isExisted) {
96
101
  const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
102
+ const runtimeLoaderEntry = createRuntimeLoaderEntry();
97
103
  if (idx > -1) {
98
- module.loaders.unshift(WeappTwRuntimeAopLoader);
104
+ module.loaders.splice(idx + 1, 0, runtimeLoaderEntry);
105
+ } else {
106
+ module.loaders.push(runtimeLoaderEntry);
99
107
  }
100
108
  }
101
109
  });
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkXGRBCPBIjs = require('./chunk-XGRBCPBI.js');
3
+ var _chunkUJIUFWXEjs = require('./chunk-UJIUFWXE.js');
4
4
 
5
5
  // src/utils/resolve-package.ts
6
6
  var _module = require('module');
7
7
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
8
- var require2 = _module.createRequire.call(void 0, _chunkXGRBCPBIjs.importMetaUrl);
8
+ var require2 = _module.createRequire.call(void 0, _chunkUJIUFWXEjs.importMetaUrl);
9
9
  function resolvePackageDir(name) {
10
10
  const pkgPath = require2.resolve(`${name}/package.json`);
11
11
  return _path2.default.dirname(pkgPath);
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JW7P34IH.mjs";
4
4
  import {
5
5
  pluginName
6
- } from "./chunk-TTCMOWCO.mjs";
6
+ } from "./chunk-WTOLVORM.mjs";
7
7
 
8
8
  // src/bundlers/webpack/shared/css-imports.ts
9
9
  var CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
@@ -7,7 +7,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkX7QD7NUXjs = require('./chunk-X7QD7NUX.js');
10
+ var _chunkPLV4QGF4js = require('./chunk-PLV4QGF4.js');
11
11
 
12
12
  // src/bundlers/gulp/index.ts
13
13
  var _buffer = require('buffer');
@@ -15,21 +15,21 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
15
15
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
16
16
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
17
17
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
18
- var debug = _chunkX7QD7NUXjs.createDebug.call(void 0, );
18
+ var debug = _chunkPLV4QGF4js.createDebug.call(void 0, );
19
19
  var Transform = _stream2.default.Transform;
20
20
  function createPlugins(options = {}) {
21
- const opts = _chunkX7QD7NUXjs.getCompilerContext.call(void 0, options);
21
+ const opts = _chunkPLV4QGF4js.getCompilerContext.call(void 0, options);
22
22
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
23
23
  let runtimeSet = /* @__PURE__ */ new Set();
24
24
  const runtimeState = {
25
25
  twPatcher: initialTwPatcher,
26
- patchPromise: _chunkX7QD7NUXjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
26
+ patchPromise: _chunkPLV4QGF4js.createTailwindPatchPromise.call(void 0, initialTwPatcher),
27
27
  refreshTailwindcssPatcher
28
28
  };
29
29
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
30
30
  let runtimeSetInitialized = false;
31
31
  async function refreshRuntimeState(force) {
32
- await _chunkX7QD7NUXjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
32
+ await _chunkPLV4QGF4js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
33
33
  }
34
34
  async function refreshRuntimeSet(force = false) {
35
35
  await refreshRuntimeState(force);
@@ -37,7 +37,7 @@ function createPlugins(options = {}) {
37
37
  if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
38
38
  return runtimeSet;
39
39
  }
40
- runtimeSet = await _chunkX7QD7NUXjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
40
+ runtimeSet = await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
41
41
  runtimeSetInitialized = true;
42
42
  return runtimeSet;
43
43
  }
@@ -7,7 +7,7 @@ import {
7
7
  createTailwindPatchPromise,
8
8
  getCompilerContext,
9
9
  refreshTailwindRuntimeState
10
- } from "./chunk-TTCMOWCO.mjs";
10
+ } from "./chunk-WTOLVORM.mjs";
11
11
 
12
12
  // src/bundlers/gulp/index.ts
13
13
  import { Buffer } from "buffer";