weapp-tailwindcss 4.12.0-alpha.2 → 4.12.0-alpha.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.
@@ -414,18 +414,21 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
414
414
  var PATCH_INFO_FILENAME = "tailwindcss-target.json";
415
415
  var PATCH_INFO_CACHE_RELATIVE_PATH = _path2.default.join("node_modules", ".cache", "weapp-tailwindcss", PATCH_INFO_FILENAME);
416
416
  var PATCH_INFO_LEGACY_RELATIVE_PATH = _path2.default.join(".tw-patch", PATCH_INFO_FILENAME);
417
+ function toDisplayPath(value) {
418
+ return _path2.default.normalize(value).replace(/\\/g, "/");
419
+ }
417
420
  function formatRelativeToBase(targetPath, baseDir) {
418
421
  if (!baseDir) {
419
- return _path2.default.normalize(targetPath);
422
+ return toDisplayPath(targetPath);
420
423
  }
421
424
  const relative = _path2.default.relative(baseDir, targetPath);
422
425
  if (!relative || relative === ".") {
423
426
  return ".";
424
427
  }
425
428
  if (relative.startsWith("..")) {
426
- return _path2.default.normalize(targetPath);
429
+ return toDisplayPath(targetPath);
427
430
  }
428
- return _path2.default.join(".", relative);
431
+ return toDisplayPath(_path2.default.join(".", relative));
429
432
  }
430
433
  function resolveRecordLocation(baseDir) {
431
434
  const normalizedBase = _path2.default.normalize(baseDir);
@@ -466,7 +469,7 @@ function getRecordFileCandidates(baseDir) {
466
469
  // package.json
467
470
  var package_default = {
468
471
  name: "weapp-tailwindcss",
469
- version: "4.12.0-alpha.2",
472
+ version: "4.12.0-alpha.3",
470
473
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
471
474
  author: "ice breaker <1324318532@qq.com>",
472
475
  license: "MIT",
@@ -2067,6 +2070,7 @@ function walkEvalExpression(path5, options, updater, handler) {
2067
2070
  for (const q of n.quasis) {
2068
2071
  const stub = {
2069
2072
  node: q,
2073
+ isStringLiteral: () => false,
2070
2074
  isTemplateElement: () => true
2071
2075
  };
2072
2076
  handleEvalTemplateElement(stub, templateHandlerOptions, updater, handler);
@@ -3851,10 +3855,11 @@ function getCompilerContext(opts) {
3851
3855
  }
3852
3856
 
3853
3857
  // src/js/precheck.ts
3858
+
3854
3859
  var FAST_JS_TRANSFORM_HINT_RE = /className\b|class\s*=|classList\.|\b(?:twMerge|clsx|classnames|cn|cva)\b|\[["'`]class["'`]\]|text-\[|bg-\[|\b(?:[whpm]|px|py|mx|my|rounded|flex|grid|gap)-/;
3855
3860
  var DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
3856
3861
  function shouldSkipJsTransform(rawSource, options) {
3857
- if (process.env.WEAPP_TW_DISABLE_JS_PRECHECK === "1") {
3862
+ if (_process2.default.env.WEAPP_TW_DISABLE_JS_PRECHECK === "1") {
3858
3863
  return false;
3859
3864
  }
3860
3865
  if (!rawSource) {
@@ -8,7 +8,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
8
8
 
9
9
 
10
10
 
11
- var _chunkYVRX3F6Sjs = require('./chunk-YVRX3F6S.js');
11
+ var _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
12
12
 
13
13
  // src/bundlers/gulp/index.ts
14
14
  var _buffer = require('buffer');
@@ -16,12 +16,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
16
16
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
17
17
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
18
18
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
19
- var debug = _chunkYVRX3F6Sjs.createDebug.call(void 0, );
19
+ var debug = _chunkOSWTWMAKjs.createDebug.call(void 0, );
20
20
  var Transform = _stream2.default.Transform;
21
21
  function createPlugins(options = {}) {
22
- const opts = _chunkYVRX3F6Sjs.getCompilerContext.call(void 0, options);
22
+ const opts = _chunkOSWTWMAKjs.getCompilerContext.call(void 0, options);
23
23
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
24
- const patchRecorderState = _chunkYVRX3F6Sjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
24
+ const patchRecorderState = _chunkOSWTWMAKjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
25
25
  source: "runtime",
26
26
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
27
27
  });
@@ -39,13 +39,13 @@ function createPlugins(options = {}) {
39
39
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
40
40
  let runtimeSetInitialized = false;
41
41
  async function refreshRuntimeState(force) {
42
- await _chunkYVRX3F6Sjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
42
+ await _chunkOSWTWMAKjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
43
43
  }
44
44
  async function refreshRuntimeSet(force = false) {
45
45
  if (!force && runtimeSetInitialized) {
46
46
  return runtimeSet;
47
47
  }
48
- runtimeSet = await _chunkYVRX3F6Sjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
48
+ runtimeSet = await _chunkOSWTWMAKjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
49
49
  forceRefresh: force,
50
50
  forceCollect: force,
51
51
  clearCache: force,
@@ -226,7 +226,7 @@ function createPlugins(options = {}) {
226
226
  async transform() {
227
227
  await runtimeState.patchPromise;
228
228
  const currentSource = _nullishCoalesce(_optionalChain([file, 'access', _2 => _2.contents, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]), () => ( rawSource));
229
- if (_chunkYVRX3F6Sjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
229
+ if (_chunkOSWTWMAKjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
230
230
  return { result: currentSource };
231
231
  }
232
232
  const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
@@ -6,7 +6,8 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkGMKSBLNYjs = require('./chunk-GMKSBLNY.js');
9
+
10
+ var _chunkL3O54VR6js = require('./chunk-L3O54VR6.js');
10
11
 
11
12
 
12
13
  var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
@@ -27,7 +28,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
27
28
 
28
29
 
29
30
 
30
- var _chunkYVRX3F6Sjs = require('./chunk-YVRX3F6S.js');
31
+ var _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
31
32
 
32
33
 
33
34
 
@@ -92,7 +93,7 @@ function isRuntimeCandidate(candidate, runtimeSet) {
92
93
  if (!runtimeSet || runtimeSet.size === 0) {
93
94
  return false;
94
95
  }
95
- return runtimeSet.has(candidate) || runtimeSet.has(_chunkYVRX3F6Sjs.replaceWxml.call(void 0, candidate));
96
+ return runtimeSet.has(candidate) || runtimeSet.has(_chunkOSWTWMAKjs.replaceWxml.call(void 0, candidate));
96
97
  }
97
98
  function shouldEnableComponentLocalStyle(id) {
98
99
  return COMPONENT_RE.test(id);
@@ -112,7 +113,7 @@ var UniAppXComponentLocalStyleCollector = class {
112
113
  const alias = createAlias(this.fileId, utility, this.aliasByUtility.size);
113
114
  this.aliasByUtility.set(utility, alias);
114
115
  this.aliasByLookup.set(utility, alias);
115
- this.aliasByLookup.set(_chunkYVRX3F6Sjs.replaceWxml.call(void 0, utility), alias);
116
+ this.aliasByLookup.set(_chunkOSWTWMAKjs.replaceWxml.call(void 0, utility), alias);
116
117
  return alias;
117
118
  }
118
119
  rewriteLiteral(literal, shouldInclude) {
@@ -135,15 +136,15 @@ var UniAppXComponentLocalStyleCollector = class {
135
136
  collectRuntimeClasses(rawSource, options = {}) {
136
137
  const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
137
138
  try {
138
- const ast = _chunkYVRX3F6Sjs.babelParse.call(void 0, wrapped, {
139
+ const ast = _chunkOSWTWMAKjs.babelParse.call(void 0, wrapped, {
139
140
  plugins: ["typescript"],
140
141
  sourceType: options.wrapExpression ? "module" : "unambiguous"
141
142
  });
142
- const analysis = _chunkYVRX3F6Sjs.analyzeSource.call(void 0, ast, {}, void 0, false);
143
+ const analysis = _chunkOSWTWMAKjs.analyzeSource.call(void 0, ast, {}, void 0, false);
143
144
  for (const path7 of analysis.targetPaths) {
144
145
  const { literal, allowDoubleQuotes } = extractLiteralValue(path7);
145
146
  const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
146
- const classContext = options.wrapExpression || _chunkYVRX3F6Sjs.isClassContextLiteralPath.call(void 0, path7);
147
+ const classContext = options.wrapExpression || _chunkOSWTWMAKjs.isClassContextLiteralPath.call(void 0, path7);
147
148
  for (const candidate of candidates) {
148
149
  if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) {
149
150
  continue;
@@ -162,15 +163,15 @@ var UniAppXComponentLocalStyleCollector = class {
162
163
  }
163
164
  const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
164
165
  try {
165
- const ast = _chunkYVRX3F6Sjs.babelParse.call(void 0, wrapped, {
166
+ const ast = _chunkOSWTWMAKjs.babelParse.call(void 0, wrapped, {
166
167
  plugins: ["typescript"],
167
168
  sourceType: options.wrapExpression ? "module" : "unambiguous"
168
169
  });
169
- const analysis = _chunkYVRX3F6Sjs.analyzeSource.call(void 0, ast, {}, void 0, false);
170
+ const analysis = _chunkOSWTWMAKjs.analyzeSource.call(void 0, ast, {}, void 0, false);
170
171
  if (analysis.targetPaths.length === 0) {
171
172
  return rawSource;
172
173
  }
173
- const updater = new (0, _chunkYVRX3F6Sjs.JsTokenUpdater)();
174
+ const updater = new (0, _chunkOSWTWMAKjs.JsTokenUpdater)();
174
175
  for (const path7 of analysis.targetPaths) {
175
176
  const { literal, allowDoubleQuotes, offset } = extractLiteralValue(path7);
176
177
  const candidates = _extractors.splitCode.call(void 0, literal, allowDoubleQuotes);
@@ -251,7 +252,7 @@ function updateStaticAttribute(ms, prop, content = _optionalChain([prop, 'access
251
252
  const start = prop.value.loc.start.offset + 1;
252
253
  const end = prop.value.loc.end.offset - 1;
253
254
  if (start < end) {
254
- ms.update(start, end, _chunkYVRX3F6Sjs.replaceWxml.call(void 0, _nullishCoalesce(content, () => ( ""))));
255
+ ms.update(start, end, _chunkOSWTWMAKjs.replaceWxml.call(void 0, _nullishCoalesce(content, () => ( ""))));
255
256
  }
256
257
  }
257
258
  function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = _optionalChain([prop, 'access', _3 => _3.value, 'optionalAccess', _4 => _4.content])) {
@@ -273,7 +274,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet, expression =
273
274
  if (start >= end) {
274
275
  return;
275
276
  }
276
- const generated = _chunkYVRX3F6Sjs.generateCode.call(void 0, expression, {
277
+ const generated = _chunkOSWTWMAKjs.generateCode.call(void 0, expression, {
277
278
  jsHandler,
278
279
  runtimeSet,
279
280
  wrapExpression: true
@@ -292,7 +293,7 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
292
293
  collector.collectRuntimeClasses(expression, {
293
294
  wrapExpression: true
294
295
  });
295
- const generated = _chunkYVRX3F6Sjs.generateCode.call(void 0, expression, {
296
+ const generated = _chunkOSWTWMAKjs.generateCode.call(void 0, expression, {
296
297
  jsHandler,
297
298
  runtimeSet,
298
299
  wrapExpression: true
@@ -322,7 +323,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
322
323
  return;
323
324
  }
324
325
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
325
- const matchCustomAttribute = _chunkYVRX3F6Sjs.createAttributeMatcher.call(void 0, customAttributesEntities);
326
+ const matchCustomAttribute = _chunkOSWTWMAKjs.createAttributeMatcher.call(void 0, customAttributesEntities);
326
327
  const ms = new (0, _magicstring2.default)(code);
327
328
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
328
329
  const localStyleCollector = options.enableComponentLocalStyle && shouldEnableComponentLocalStyle(id) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
@@ -692,7 +693,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
692
693
  runtimeSet,
693
694
  applyLinkedResults: applyLinkedResults2
694
695
  } = options;
695
- const absoluteFile = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, file, outDir);
696
+ const absoluteFile = _chunkL3O54VR6js.toAbsoluteOutputPath.call(void 0, file, outDir);
696
697
  const rawSource = originalSource.source.toString();
697
698
  const rawHashSource = options.hashSalt ? `${rawSource}
698
699
  /*${options.hashSalt}*/` : rawSource;
@@ -764,19 +765,24 @@ function isJavaScriptEntry(entry) {
764
765
  return entry.fileName.endsWith(".js");
765
766
  }
766
767
  function createBundleModuleGraphOptions(outputDir, entries) {
768
+ const normalizedEntries = /* @__PURE__ */ new Map();
769
+ for (const [id, entry] of entries) {
770
+ normalizedEntries.set(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id), entry);
771
+ }
772
+ const getEntry = (id) => _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id))));
767
773
  return {
768
774
  resolve(specifier, importer) {
769
- return _chunkGMKSBLNYjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
775
+ return _chunkL3O54VR6js.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
770
776
  },
771
777
  load(id) {
772
- const entry = entries.get(id);
778
+ const entry = getEntry(id);
773
779
  if (!entry) {
774
780
  return void 0;
775
781
  }
776
782
  return readOutputEntry(entry);
777
783
  },
778
784
  filter(id) {
779
- return entries.has(id);
785
+ return Boolean(getEntry(id));
780
786
  }
781
787
  };
782
788
  }
@@ -784,8 +790,12 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
784
790
  if (!linked) {
785
791
  return;
786
792
  }
793
+ const normalizedEntries = /* @__PURE__ */ new Map();
794
+ for (const [entryId, entry] of entries) {
795
+ normalizedEntries.set(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, entryId), entry);
796
+ }
787
797
  for (const [id, { code }] of Object.entries(linked)) {
788
- const entry = entries.get(id);
798
+ const entry = _nullishCoalesce(entries.get(id), () => ( normalizedEntries.get(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id))));
789
799
  if (!entry) {
790
800
  continue;
791
801
  }
@@ -840,14 +850,14 @@ function createHtmlRuntimeAffectingSignature(source) {
840
850
  }
841
851
  function createJsRuntimeAffectingSignature(source) {
842
852
  try {
843
- const ast = _chunkYVRX3F6Sjs.babelParse.call(void 0, source, {
853
+ const ast = _chunkOSWTWMAKjs.babelParse.call(void 0, source, {
844
854
  cache: true,
845
855
  cacheKey: "vite-runtime-affecting:unambiguous",
846
856
  plugins: ["jsx", "typescript"],
847
857
  sourceType: "unambiguous"
848
858
  });
849
859
  const parts = [];
850
- _chunkYVRX3F6Sjs.traverse.call(void 0, ast, {
860
+ _chunkOSWTWMAKjs.traverse.call(void 0, ast, {
851
861
  noScope: true,
852
862
  StringLiteral(path7) {
853
863
  parts.push(`s:${path7.node.value}`);
@@ -939,7 +949,7 @@ function collectJsEntries(fileName, output, outDir, store) {
939
949
  if (!isJavaScriptEntry(entry)) {
940
950
  return;
941
951
  }
942
- const absolute = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
952
+ const absolute = _chunkL3O54VR6js.toAbsoluteOutputPath.call(void 0, fileName, outDir);
943
953
  store.set(absolute, entry);
944
954
  }
945
955
  function markProcessFile(type, file, processFiles) {
@@ -1265,6 +1275,11 @@ function createGenerateBundleHook(context) {
1265
1275
  );
1266
1276
  }
1267
1277
  const jsEntries = snapshot.jsEntries;
1278
+ const normalizedJsEntries = /* @__PURE__ */ new Map();
1279
+ for (const [id, entry] of jsEntries) {
1280
+ normalizedJsEntries.set(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id), entry);
1281
+ }
1282
+ const getJsEntry = (id) => _nullishCoalesce(jsEntries.get(id), () => ( normalizedJsEntries.get(_chunkL3O54VR6js.normalizeOutputPathKey.call(void 0, id))));
1268
1283
  const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
1269
1284
  const runtimeStart = performance.now();
1270
1285
  const runtime = useBundleRuntimeClassSet ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv) : await context.ensureRuntimeClassSet(forceRuntimeRefreshByEnv);
@@ -1468,7 +1483,7 @@ function createGenerateBundleHook(context) {
1468
1483
  debug3("js cache replay miss, fallback transform: %s", file);
1469
1484
  }
1470
1485
  const handlerOptions = createHandlerOptions(absoluteFile);
1471
- if (!disableJsPrecheck && _chunkYVRX3F6Sjs.shouldSkipJsTransform.call(void 0, rawSource, handlerOptions)) {
1486
+ if (!disableJsPrecheck && _chunkOSWTWMAKjs.shouldSkipJsTransform.call(void 0, rawSource, handlerOptions)) {
1472
1487
  metrics.js.elapsed += measureElapsed(start);
1473
1488
  metrics.js.transformed++;
1474
1489
  return {
@@ -1482,7 +1497,7 @@ function createGenerateBundleHook(context) {
1482
1497
  debug3("js handle: %s", file);
1483
1498
  if (linked) {
1484
1499
  for (const id of Object.keys(linked)) {
1485
- const linkedEntry = jsEntries.get(id);
1500
+ const linkedEntry = getJsEntry(id);
1486
1501
  if (linkedEntry && linkedSet) {
1487
1502
  linkedSet.add(linkedEntry.fileName);
1488
1503
  }
@@ -1504,7 +1519,7 @@ function createGenerateBundleHook(context) {
1504
1519
  const wrappedApplyLinkedUpdates = (linked) => {
1505
1520
  if (linked) {
1506
1521
  for (const id of Object.keys(linked)) {
1507
- const linkedEntry = jsEntries.get(id);
1522
+ const linkedEntry = getJsEntry(id);
1508
1523
  if (linkedEntry && linkedSet) {
1509
1524
  linkedSet.add(linkedEntry.fileName);
1510
1525
  }
@@ -1554,7 +1569,7 @@ function createGenerateBundleHook(context) {
1554
1569
  sourceType: "unambiguous"
1555
1570
  }
1556
1571
  });
1557
- if (!disableJsPrecheck && _chunkYVRX3F6Sjs.shouldSkipJsTransform.call(void 0, currentSource, precheckOptions)) {
1572
+ if (!disableJsPrecheck && _chunkOSWTWMAKjs.shouldSkipJsTransform.call(void 0, currentSource, precheckOptions)) {
1558
1573
  metrics.js.elapsed += measureElapsed(start);
1559
1574
  metrics.js.transformed++;
1560
1575
  return;
@@ -1565,7 +1580,7 @@ function createGenerateBundleHook(context) {
1565
1580
  });
1566
1581
  }
1567
1582
  }
1568
- _chunkGMKSBLNYjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
1583
+ _chunkL3O54VR6js.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
1569
1584
  await Promise.all(tasks);
1570
1585
  for (const apply of pendingLinkedUpdates) {
1571
1586
  apply();
@@ -1607,7 +1622,7 @@ var _module = require('module');
1607
1622
 
1608
1623
 
1609
1624
  var _tailwindcsspatch = require('tailwindcss-patch');
1610
- var debug = _chunkYVRX3F6Sjs.createDebug.call(void 0, "[vite:runtime-set] ");
1625
+ var debug = _chunkOSWTWMAKjs.createDebug.call(void 0, "[vite:runtime-set] ");
1611
1626
  var require2 = _module.createRequire.call(void 0, _chunkONLKZIRQjs.importMetaUrl);
1612
1627
  var EXTENSION_DOT_PREFIX_RE = /^\./;
1613
1628
  var VALIDATION_FILE_NAME = "runtime-candidates.html";
@@ -2075,12 +2090,12 @@ function createRewriteCssImportsPlugins(options) {
2075
2090
  const resolveAppType = () => _nullishCoalesce(_optionalChain([getAppType, 'optionalCall', _68 => _68()]), () => ( appType));
2076
2091
  return [
2077
2092
  {
2078
- name: `${_chunkYVRX3F6Sjs.vitePluginName}:rewrite-css-imports`,
2093
+ name: `${_chunkOSWTWMAKjs.vitePluginName}:rewrite-css-imports`,
2079
2094
  enforce: "pre",
2080
2095
  resolveId: {
2081
2096
  order: "pre",
2082
2097
  handler(id, importer) {
2083
- const replacement = _chunkGMKSBLNYjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
2098
+ const replacement = _chunkL3O54VR6js.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
2084
2099
  join: joinPosixPath,
2085
2100
  appType: resolveAppType()
2086
2101
  });
@@ -2099,7 +2114,7 @@ function createRewriteCssImportsPlugins(options) {
2099
2114
  if (!isCSSRequest(id)) {
2100
2115
  return null;
2101
2116
  }
2102
- const rewritten = _chunkGMKSBLNYjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
2117
+ const rewritten = _chunkL3O54VR6js.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
2103
2118
  join: joinPosixPath,
2104
2119
  appType: resolveAppType()
2105
2120
  });
@@ -2117,8 +2132,8 @@ function createRewriteCssImportsPlugins(options) {
2117
2132
  }
2118
2133
 
2119
2134
  // src/bundlers/vite/index.ts
2120
- var debug2 = _chunkYVRX3F6Sjs.createDebug.call(void 0, );
2121
- var weappTailwindcssPackageDir = _chunkGMKSBLNYjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
2135
+ var debug2 = _chunkOSWTWMAKjs.createDebug.call(void 0, );
2136
+ var weappTailwindcssPackageDir = _chunkL3O54VR6js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
2122
2137
  var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
2123
2138
  var PACKAGE_JSON_FILE2 = "package.json";
2124
2139
  function getPostcssPluginName(plugin) {
@@ -2157,7 +2172,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2157
2172
  const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
2158
2173
  const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
2159
2174
  const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
2160
- const opts = _chunkYVRX3F6Sjs.getCompilerContext.call(void 0, options);
2175
+ const opts = _chunkOSWTWMAKjs.getCompilerContext.call(void 0, options);
2161
2176
  const {
2162
2177
  disabled,
2163
2178
  customAttributes,
@@ -2171,7 +2186,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2171
2186
  disabledDefaultTemplateHandler
2172
2187
  } = opts;
2173
2188
  const uniAppXEnabled = _chunkNIS74SI6js.isUniAppXEnabled.call(void 0, uniAppX);
2174
- const disabledOptions = _chunkGMKSBLNYjs.resolveDisabledOptions.call(void 0, disabled);
2189
+ const disabledOptions = _chunkL3O54VR6js.resolveDisabledOptions.call(void 0, disabled);
2175
2190
  const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
2176
2191
  const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
2177
2192
  const rewritePlugins = createRewriteCssImportsPlugins({
@@ -2182,8 +2197,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2182
2197
  if (disabledOptions.plugin) {
2183
2198
  return rewritePlugins.length ? rewritePlugins : void 0;
2184
2199
  }
2185
- const customAttributesEntities = _chunkYVRX3F6Sjs.toCustomAttributesEntities.call(void 0, customAttributes);
2186
- const patchRecorderState = _chunkYVRX3F6Sjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
2200
+ const customAttributesEntities = _chunkOSWTWMAKjs.toCustomAttributesEntities.call(void 0, customAttributes);
2201
+ const patchRecorderState = _chunkOSWTWMAKjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
2187
2202
  source: "runtime",
2188
2203
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
2189
2204
  });
@@ -2222,7 +2237,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2222
2237
  async function refreshRuntimeState(force) {
2223
2238
  const invalidation = resolveRuntimeRefreshOptions();
2224
2239
  const shouldRefresh = force || invalidation.changed;
2225
- const refreshed = await _chunkYVRX3F6Sjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
2240
+ const refreshed = await _chunkOSWTWMAKjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
2226
2241
  force: shouldRefresh,
2227
2242
  clearCache: force || invalidation.changed
2228
2243
  });
@@ -2243,7 +2258,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2243
2258
  }
2244
2259
  if (forceRuntimeRefresh || !runtimeSetPromise) {
2245
2260
  const invalidation = resolveRuntimeRefreshOptions();
2246
- const task2 = _chunkYVRX3F6Sjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
2261
+ const task2 = _chunkOSWTWMAKjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
2247
2262
  force: forceRuntimeRefresh || invalidation.changed,
2248
2263
  skipRefresh: forceRuntimeRefresh,
2249
2264
  clearCache: forceRuntimeRefresh || invalidation.changed
@@ -2285,7 +2300,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2285
2300
  if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) {
2286
2301
  return runtimeSet;
2287
2302
  }
2288
- const task = _chunkYVRX3F6Sjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
2303
+ const task = _chunkOSWTWMAKjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
2289
2304
  force: forceRuntimeRefresh || invalidation.changed || forceCollectBySource,
2290
2305
  skipRefresh: forceRuntimeRefresh,
2291
2306
  clearCache: forceRuntimeRefresh || invalidation.changed
@@ -2320,7 +2335,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2320
2335
  const plugins = [
2321
2336
  ...rewritePlugins,
2322
2337
  {
2323
- name: `${_chunkYVRX3F6Sjs.vitePluginName}:post`,
2338
+ name: `${_chunkOSWTWMAKjs.vitePluginName}:post`,
2324
2339
  enforce: "post",
2325
2340
  async configResolved(config) {
2326
2341
  resolvedConfig = config;
@@ -1,9 +1,9 @@
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 _chunkGMKSBLNYjs = require('./chunk-GMKSBLNY.js');
3
+ var _chunkL3O54VR6js = require('./chunk-L3O54VR6.js');
4
4
 
5
5
 
6
- var _chunkYVRX3F6Sjs = require('./chunk-YVRX3F6S.js');
6
+ var _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -145,7 +145,7 @@ function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
145
145
  if (!CSS_EXT_RE2.test(normalizedIssuer)) {
146
146
  return;
147
147
  }
148
- const resolved = _chunkGMKSBLNYjs.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
148
+ const resolved = _chunkL3O54VR6js.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
149
149
  if (!resolved) {
150
150
  return;
151
151
  }
@@ -155,8 +155,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
155
155
  if (!options.enabled) {
156
156
  return;
157
157
  }
158
- compiler.hooks.normalModuleFactory.tap(_chunkYVRX3F6Sjs.pluginName, (factory) => {
159
- factory.hooks.beforeResolve.tap(_chunkYVRX3F6Sjs.pluginName, (data) => {
158
+ compiler.hooks.normalModuleFactory.tap(_chunkOSWTWMAKjs.pluginName, (factory) => {
159
+ factory.hooks.beforeResolve.tap(_chunkOSWTWMAKjs.pluginName, (data) => {
160
160
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
161
161
  });
162
162
  });
@@ -8,7 +8,7 @@ import {
8
8
  refreshTailwindRuntimeState,
9
9
  setupPatchRecorder,
10
10
  shouldSkipJsTransform
11
- } from "./chunk-LWEVOVRD.mjs";
11
+ } from "./chunk-J6FIO3RO.mjs";
12
12
 
13
13
  // src/bundlers/gulp/index.ts
14
14
  import { Buffer } from "buffer";
package/dist/cli.js CHANGED
@@ -156,18 +156,21 @@ function findNearestPackageRoot(startDir) {
156
156
  var PATCH_INFO_FILENAME = "tailwindcss-target.json";
157
157
  var PATCH_INFO_CACHE_RELATIVE_PATH = import_node_path3.default.join("node_modules", ".cache", "weapp-tailwindcss", PATCH_INFO_FILENAME);
158
158
  var PATCH_INFO_LEGACY_RELATIVE_PATH = import_node_path3.default.join(".tw-patch", PATCH_INFO_FILENAME);
159
+ function toDisplayPath(value) {
160
+ return import_node_path3.default.normalize(value).replace(/\\/g, "/");
161
+ }
159
162
  function formatRelativeToBase(targetPath, baseDir) {
160
163
  if (!baseDir) {
161
- return import_node_path3.default.normalize(targetPath);
164
+ return toDisplayPath(targetPath);
162
165
  }
163
166
  const relative = import_node_path3.default.relative(baseDir, targetPath);
164
167
  if (!relative || relative === ".") {
165
168
  return ".";
166
169
  }
167
170
  if (relative.startsWith("..")) {
168
- return import_node_path3.default.normalize(targetPath);
171
+ return toDisplayPath(targetPath);
169
172
  }
170
- return import_node_path3.default.join(".", relative);
173
+ return toDisplayPath(import_node_path3.default.join(".", relative));
171
174
  }
172
175
  function resolveRecordLocation(baseDir) {
173
176
  const normalizedBase = import_node_path3.default.normalize(baseDir);
@@ -208,7 +211,7 @@ var import_logger2 = require("@weapp-tailwindcss/logger");
208
211
  // package.json
209
212
  var package_default = {
210
213
  name: "weapp-tailwindcss",
211
- version: "4.12.0-alpha.2",
214
+ version: "4.12.0-alpha.3",
212
215
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
213
216
  author: "ice breaker <1324318532@qq.com>",
214
217
  license: "MIT",
@@ -1547,6 +1550,7 @@ function walkEvalExpression(path22, options, updater, handler) {
1547
1550
  for (const q of n.quasis) {
1548
1551
  const stub = {
1549
1552
  node: q,
1553
+ isStringLiteral: () => false,
1550
1554
  isTemplateElement: () => true
1551
1555
  };
1552
1556
  handleEvalTemplateElement(stub, templateHandlerOptions, updater, handler);
package/dist/cli.mjs CHANGED
@@ -132,18 +132,21 @@ function findNearestPackageRoot(startDir) {
132
132
  var PATCH_INFO_FILENAME = "tailwindcss-target.json";
133
133
  var PATCH_INFO_CACHE_RELATIVE_PATH = path3.join("node_modules", ".cache", "weapp-tailwindcss", PATCH_INFO_FILENAME);
134
134
  var PATCH_INFO_LEGACY_RELATIVE_PATH = path3.join(".tw-patch", PATCH_INFO_FILENAME);
135
+ function toDisplayPath(value) {
136
+ return path3.normalize(value).replace(/\\/g, "/");
137
+ }
135
138
  function formatRelativeToBase(targetPath, baseDir) {
136
139
  if (!baseDir) {
137
- return path3.normalize(targetPath);
140
+ return toDisplayPath(targetPath);
138
141
  }
139
142
  const relative = path3.relative(baseDir, targetPath);
140
143
  if (!relative || relative === ".") {
141
144
  return ".";
142
145
  }
143
146
  if (relative.startsWith("..")) {
144
- return path3.normalize(targetPath);
147
+ return toDisplayPath(targetPath);
145
148
  }
146
- return path3.join(".", relative);
149
+ return toDisplayPath(path3.join(".", relative));
147
150
  }
148
151
  function resolveRecordLocation(baseDir) {
149
152
  const normalizedBase = path3.normalize(baseDir);
@@ -184,7 +187,7 @@ import { logger as logger2 } from "@weapp-tailwindcss/logger";
184
187
  // package.json
185
188
  var package_default = {
186
189
  name: "weapp-tailwindcss",
187
- version: "4.12.0-alpha.2",
190
+ version: "4.12.0-alpha.3",
188
191
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
189
192
  author: "ice breaker <1324318532@qq.com>",
190
193
  license: "MIT",
@@ -1523,6 +1526,7 @@ function walkEvalExpression(path22, options, updater, handler) {
1523
1526
  for (const q of n.quasis) {
1524
1527
  const stub = {
1525
1528
  node: q,
1529
+ isStringLiteral: () => false,
1526
1530
  isTemplateElement: () => true
1527
1531
  };
1528
1532
  handleEvalTemplateElement(stub, templateHandlerOptions, updater, handler);
package/dist/core.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkYVRX3F6Sjs = require('./chunk-YVRX3F6S.js');
6
+ var _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
7
7
  require('./chunk-NIS74SI6.js');
8
8
  require('./chunk-A5PB4KZT.js');
9
9
  require('./chunk-DYLQ6UOI.js');
@@ -25,9 +25,9 @@ function resolveTransformWxssOptions(options) {
25
25
  return _shared.defuOverrideArray.call(void 0, options, DEFAULT_MAIN_CHUNK_STYLE_OPTIONS);
26
26
  }
27
27
  function createContext(options = {}) {
28
- const opts = _chunkYVRX3F6Sjs.getCompilerContext.call(void 0, options);
28
+ const opts = _chunkOSWTWMAKjs.getCompilerContext.call(void 0, options);
29
29
  const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
30
- const patchRecorderState = _chunkYVRX3F6Sjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
30
+ const patchRecorderState = _chunkOSWTWMAKjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
31
31
  source: "runtime",
32
32
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
33
33
  });
@@ -144,7 +144,7 @@ function createContext(options = {}) {
144
144
  async function transformWxss(rawCss, options2) {
145
145
  await runtimeState.patchPromise;
146
146
  const result = await styleHandler(rawCss, resolveTransformWxssOptions(options2));
147
- runtimeSet = await _chunkYVRX3F6Sjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
147
+ runtimeSet = await _chunkOSWTWMAKjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
148
148
  forceRefresh: true,
149
149
  forceCollect: true
150
150
  });
@@ -155,12 +155,12 @@ function createContext(options = {}) {
155
155
  if (_optionalChain([options2, 'optionalAccess', _ => _.runtimeSet])) {
156
156
  runtimeSet = options2.runtimeSet;
157
157
  } else if (runtimeSet.size === 0) {
158
- runtimeSet = await _chunkYVRX3F6Sjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
158
+ runtimeSet = await _chunkOSWTWMAKjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
159
159
  forceCollect: true
160
160
  });
161
161
  }
162
162
  const resolvedOptions = resolveTransformJsOptions(options2);
163
- if (_chunkYVRX3F6Sjs.shouldSkipJsTransform.call(void 0, rawJs, resolvedOptions)) {
163
+ if (_chunkOSWTWMAKjs.shouldSkipJsTransform.call(void 0, rawJs, resolvedOptions)) {
164
164
  return { code: rawJs };
165
165
  }
166
166
  return await jsHandler(rawJs, runtimeSet, resolvedOptions);
@@ -168,7 +168,7 @@ function createContext(options = {}) {
168
168
  async function transformWxml(rawWxml, options2) {
169
169
  await runtimeState.patchPromise;
170
170
  if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
171
- runtimeSet = await _chunkYVRX3F6Sjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
171
+ runtimeSet = await _chunkOSWTWMAKjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
172
172
  forceCollect: true
173
173
  });
174
174
  }
package/dist/core.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  getCompilerContext,
4
4
  setupPatchRecorder,
5
5
  shouldSkipJsTransform
6
- } from "./chunk-LWEVOVRD.mjs";
6
+ } from "./chunk-J6FIO3RO.mjs";
7
7
  import "./chunk-AYJ4HLWZ.mjs";
8
8
  import "./chunk-XAKAD2CR.mjs";
9
9
  import "./chunk-OOHJLO5M.mjs";
package/dist/gulp.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSRAG3FSTjs = require('./chunk-SRAG3FST.js');
3
+ var _chunkP2X2S444js = require('./chunk-P2X2S444.js');
4
4
  require('./chunk-OF6MFURR.js');
5
- require('./chunk-YVRX3F6S.js');
5
+ require('./chunk-OSWTWMAK.js');
6
6
  require('./chunk-NIS74SI6.js');
7
7
  require('./chunk-A5PB4KZT.js');
8
8
  require('./chunk-DYLQ6UOI.js');
@@ -10,4 +10,4 @@ require('./chunk-ONLKZIRQ.js');
10
10
 
11
11
 
12
12
 
13
- exports.createPlugins = _chunkSRAG3FSTjs.createPlugins; exports.weappTailwindcss = _chunkSRAG3FSTjs.createPlugins;
13
+ exports.createPlugins = _chunkP2X2S444js.createPlugins; exports.weappTailwindcss = _chunkP2X2S444js.createPlugins;