weapp-tailwindcss 5.0.0-next.32 → 5.0.0-next.35

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 (45) hide show
  1. package/dist/{bundle-state-C4ib5xPG.js → bundle-state-8w8DM8Lw.js} +1 -1
  2. package/dist/{bundle-state-BIsgsoNW.mjs → bundle-state-Bsr05EFW.mjs} +1 -1
  3. package/dist/bundlers/shared/cache.d.ts +3 -1
  4. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
  5. package/dist/bundlers/vite/generate-bundle.d.ts +1 -0
  6. package/dist/bundlers/vite/runtime-class-set.d.ts +1 -0
  7. package/dist/cli.js +9 -10
  8. package/dist/cli.mjs +10 -11
  9. package/dist/core.js +1 -1
  10. package/dist/core.mjs +1 -1
  11. package/dist/{generator-BEXaaUzP.js → generator-BtpQoQEH.js} +1 -1
  12. package/dist/{generator-CpsHA4Wd.mjs → generator-CmLpVJgw.mjs} +1 -1
  13. package/dist/generator.js +2 -2
  14. package/dist/generator.mjs +2 -2
  15. package/dist/gulp.js +5 -5
  16. package/dist/gulp.mjs +5 -5
  17. package/dist/{incremental-runtime-class-set-D2fsgk5t.mjs → incremental-runtime-class-set-W61zZU00.mjs} +72 -10
  18. package/dist/{incremental-runtime-class-set-CLP1Qv8F.js → incremental-runtime-class-set-vqTU-eph.js} +77 -9
  19. package/dist/index.js +4 -4
  20. package/dist/index.mjs +4 -4
  21. package/dist/js/replacement-cache.d.ts +5 -0
  22. package/dist/{postcss-BvkdIZr8.mjs → postcss-DGprmeke.mjs} +2 -2
  23. package/dist/{postcss-DN7IQzYb.js → postcss-DSvNrY0J.js} +2 -2
  24. package/dist/postcss.js +1 -1
  25. package/dist/postcss.mjs +1 -1
  26. package/dist/{precheck-CQeqnfo5.js → precheck-Bp-V1T_Q.js} +12 -12
  27. package/dist/{precheck-nITnYBDn.mjs → precheck-nPDKYr8V.mjs} +13 -13
  28. package/dist/presets.js +2 -2
  29. package/dist/presets.mjs +2 -2
  30. package/dist/{source-candidates-7Q-kTOSb.js → source-candidates-BjB4wSga.js} +1 -1
  31. package/dist/{source-candidates-_x8bq0Mz.mjs → source-candidates-l12JBkKU.mjs} +1 -1
  32. package/dist/{tailwindcss-udhXxMX9.mjs → tailwindcss-D6zEhnyE.mjs} +1 -1
  33. package/dist/{tailwindcss-Cl7hUlYV.js → tailwindcss-bNXguXhC.js} +1 -1
  34. package/dist/{v3-engine-C_KeUQG3.mjs → v3-engine-BYcGCWUY.mjs} +33 -0
  35. package/dist/{v3-engine-DwY4Fixu.js → v3-engine-KDOfD-6F.js} +33 -0
  36. package/dist/{vite-BAHjBu8j.mjs → vite-C8SUICPv.mjs} +103 -42
  37. package/dist/{vite-CYkkJZ3Q.js → vite-CMzi0wR2.js} +103 -42
  38. package/dist/vite.js +1 -1
  39. package/dist/vite.mjs +1 -1
  40. package/dist/weapp-tw-css-import-rewrite-loader.js +33 -1
  41. package/dist/{webpack-CPwDaKy3.js → webpack-2v1sQKyZ.js} +65 -29
  42. package/dist/{webpack-xxmiRxcy.mjs → webpack-pdpdIv_X.mjs} +65 -29
  43. package/dist/webpack.js +1 -1
  44. package/dist/webpack.mjs +1 -1
  45. package/package.json +6 -6
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-C5U5_Hdc.js");
2
- const require_precheck = require("./precheck-CQeqnfo5.js");
2
+ const require_precheck = require("./precheck-Bp-V1T_Q.js");
3
3
  let node_module = require("node:module");
4
4
  let node_process = require("node:process");
5
5
  node_process = require_chunk.__toESM(node_process);
@@ -1,4 +1,4 @@
1
- import { g as traverse, h as babelParse, o as Parser } from "./precheck-nITnYBDn.mjs";
1
+ import { g as traverse, h as babelParse, o as Parser } from "./precheck-nPDKYr8V.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import process from "node:process";
4
4
  import path from "node:path";
@@ -6,7 +6,9 @@ export interface ProcessCachedTaskOptions<TValue extends CacheValue> {
6
6
  rawSource?: string | undefined;
7
7
  hash?: string | undefined;
8
8
  readCache?: (() => TValue | undefined) | undefined;
9
- applyResult: (value: TValue) => void | Promise<void>;
9
+ applyResult: (value: TValue, meta: {
10
+ cacheHit: boolean;
11
+ }) => void | Promise<void>;
10
12
  transform: () => Promise<{
11
13
  result: TValue;
12
14
  cacheValue?: CacheValue | undefined;
@@ -1,2 +1,2 @@
1
- export declare function collectUnescapedDynamicCandidates(source: string): string[];
1
+ export declare function collectUnescapedDynamicCandidates(source: string, allowedCandidates?: Set<string>): string[];
2
2
  export declare function collectLegacyContainerCompatCandidates(sourceCandidates: Set<string>, candidates: Set<string>): Set<string>;
@@ -14,6 +14,7 @@ interface GenerateBundleContext {
14
14
  ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
15
15
  allowBaselineOnlyInitialSync?: boolean | undefined;
16
16
  baseClassSet?: Set<string> | undefined;
17
+ transformOnly?: boolean | undefined;
17
18
  }) => Promise<Set<string>>;
18
19
  debug: (format: string, ...args: unknown[]) => void;
19
20
  getResolvedConfig: () => ResolvedConfig | undefined;
@@ -20,6 +20,7 @@ export declare function createViteRuntimeClassSet(options: CreateViteRuntimeClas
20
20
  ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
21
21
  allowBaselineOnlyInitialSync?: boolean | undefined;
22
22
  baseClassSet?: Set<string> | undefined;
23
+ transformOnly?: boolean | undefined;
23
24
  }) => Promise<Set<string>>;
24
25
  };
25
26
  export {};
package/dist/cli.js CHANGED
@@ -49,7 +49,6 @@ let _babel_parser = require("@babel/parser");
49
49
  let magic_string = require("magic-string");
50
50
  magic_string = __toESM(magic_string);
51
51
  let _ast_core_escape = require("@ast-core/escape");
52
- let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
53
52
  require("@babel/types");
54
53
  //#region src/js/babel/cache-options.ts
55
54
  const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
@@ -1007,12 +1006,9 @@ function isClassContextLiteralPath(path) {
1007
1006
  return false;
1008
1007
  }
1009
1008
  //#endregion
1010
- //#region src/js/handlers.ts
1011
- const debug$1 = createDebug("[js:handlers] ");
1009
+ //#region src/js/replacement-cache.ts
1012
1010
  const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
1013
1011
  const defaultReplacementCache = /* @__PURE__ */ new Map();
1014
- const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
1015
- const IGNORE_MARKER = "ignore";
1016
1012
  function getReplacementCacheStore(escapeMap) {
1017
1013
  if (!escapeMap) return defaultReplacementCache;
1018
1014
  let store = replacementCacheByEscapeMap.get(escapeMap);
@@ -1030,6 +1026,11 @@ function getReplacement(candidate, escapeMap, store = getReplacementCacheStore(e
1030
1026
  }
1031
1027
  return cached;
1032
1028
  }
1029
+ //#endregion
1030
+ //#region src/js/handlers.ts
1031
+ const debug$1 = createDebug("[js:handlers] ");
1032
+ const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
1033
+ const IGNORE_MARKER = "ignore";
1033
1034
  function hasIgnoreComment(node) {
1034
1035
  const { leadingComments } = node;
1035
1036
  if (!Array.isArray(leadingComments) || leadingComments.length === 0) return false;
@@ -1039,8 +1040,7 @@ function hasIgnoreComment(node) {
1039
1040
  }
1040
1041
  return false;
1041
1042
  }
1042
- function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1043
- const allowDoubleQuotes = arbitraryValues?.allowDoubleQuotes;
1043
+ function extractLiteralValue(path, { unescapeUnicode }) {
1044
1044
  const { node } = path;
1045
1045
  let offset = 0;
1046
1046
  let original;
@@ -1052,7 +1052,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1052
1052
  let literal = original;
1053
1053
  if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
1054
1054
  return {
1055
- allowDoubleQuotes,
1056
1055
  literal,
1057
1056
  offset,
1058
1057
  original
@@ -1106,8 +1105,8 @@ function replaceHandleValue(path, options) {
1106
1105
  const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
1107
1106
  if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
1108
1107
  if (hasIgnoreComment(path.node)) return;
1109
- const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path, options);
1110
- const candidates = (0, _weapp_tailwindcss_shared_extractors.splitCode)(literal, allowDoubleQuotes);
1108
+ const { literal, original, offset } = extractLiteralValue(path, options);
1109
+ const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
1111
1110
  if (candidates.length === 0) return;
1112
1111
  const debugEnabled = debug$1.enabled;
1113
1112
  const classContext = options.wrapExpression || isClassContextLiteralPath(path);
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import process from "node:process";
3
3
  import semver from "semver";
4
- import { createTailwindcssPatchCli } from "tailwindcss-patch";
4
+ import { createTailwindcssPatchCli, splitCandidateTokens } from "tailwindcss-patch";
5
5
  import path from "node:path";
6
6
  import { access, mkdir, writeFile } from "node:fs/promises";
7
7
  import { logger } from "@weapp-tailwindcss/logger";
@@ -20,7 +20,6 @@ import _babelTraverse from "@babel/traverse";
20
20
  import { parse } from "@babel/parser";
21
21
  import MagicString from "magic-string";
22
22
  import { jsStringEscape } from "@ast-core/escape";
23
- import { splitCode } from "@weapp-tailwindcss/shared/extractors";
24
23
  import "@babel/types";
25
24
  //#region src/js/babel/cache-options.ts
26
25
  const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
@@ -978,12 +977,9 @@ function isClassContextLiteralPath(path) {
978
977
  return false;
979
978
  }
980
979
  //#endregion
981
- //#region src/js/handlers.ts
982
- const debug = createDebug("[js:handlers] ");
980
+ //#region src/js/replacement-cache.ts
983
981
  const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
984
982
  const defaultReplacementCache = /* @__PURE__ */ new Map();
985
- const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
986
- const IGNORE_MARKER = "ignore";
987
983
  function getReplacementCacheStore(escapeMap) {
988
984
  if (!escapeMap) return defaultReplacementCache;
989
985
  let store = replacementCacheByEscapeMap.get(escapeMap);
@@ -1001,6 +997,11 @@ function getReplacement(candidate, escapeMap, store = getReplacementCacheStore(e
1001
997
  }
1002
998
  return cached;
1003
999
  }
1000
+ //#endregion
1001
+ //#region src/js/handlers.ts
1002
+ const debug = createDebug("[js:handlers] ");
1003
+ const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
1004
+ const IGNORE_MARKER = "ignore";
1004
1005
  function hasIgnoreComment(node) {
1005
1006
  const { leadingComments } = node;
1006
1007
  if (!Array.isArray(leadingComments) || leadingComments.length === 0) return false;
@@ -1010,8 +1011,7 @@ function hasIgnoreComment(node) {
1010
1011
  }
1011
1012
  return false;
1012
1013
  }
1013
- function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1014
- const allowDoubleQuotes = arbitraryValues?.allowDoubleQuotes;
1014
+ function extractLiteralValue(path, { unescapeUnicode }) {
1015
1015
  const { node } = path;
1016
1016
  let offset = 0;
1017
1017
  let original;
@@ -1023,7 +1023,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1023
1023
  let literal = original;
1024
1024
  if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
1025
1025
  return {
1026
- allowDoubleQuotes,
1027
1026
  literal,
1028
1027
  offset,
1029
1028
  original
@@ -1077,8 +1076,8 @@ function replaceHandleValue(path, options) {
1077
1076
  const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
1078
1077
  if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
1079
1078
  if (hasIgnoreComment(path.node)) return;
1080
- const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path, options);
1081
- const candidates = splitCode(literal, allowDoubleQuotes);
1079
+ const { literal, original, offset } = extractLiteralValue(path, options);
1080
+ const candidates = splitCandidateTokens(literal);
1082
1081
  if (candidates.length === 0) return;
1083
1082
  const debugEnabled = debug.enabled;
1084
1083
  const classContext = options.wrapExpression || isClassContextLiteralPath(path);
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_precheck = require("./precheck-CQeqnfo5.js");
2
+ const require_precheck = require("./precheck-Bp-V1T_Q.js");
3
3
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
4
4
  //#region src/core.ts
5
5
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
package/dist/core.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-nITnYBDn.mjs";
1
+ import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-nPDKYr8V.mjs";
2
2
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
3
3
  //#region src/core.ts
4
4
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-C5U5_Hdc.js");
2
- const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
2
+ const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
3
3
  let node_process = require("node:process");
4
4
  node_process = require_chunk.__toESM(node_process);
5
5
  //#region src/generator/options.ts
@@ -1,4 +1,4 @@
1
- import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-C_KeUQG3.mjs";
1
+ import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-BYcGCWUY.mjs";
2
2
  import process from "node:process";
3
3
  //#region src/generator/options.ts
4
4
  const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
package/dist/generator.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
3
- const require_generator = require("./generator-BEXaaUzP.js");
2
+ const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
3
+ const require_generator = require("./generator-BtpQoQEH.js");
4
4
  let tailwindcss_patch = require("tailwindcss-patch");
5
5
  exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
6
6
  exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
@@ -1,3 +1,3 @@
1
- import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-C_KeUQG3.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-CpsHA4Wd.mjs";
1
+ import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-BYcGCWUY.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-CmLpVJgw.mjs";
3
3
  export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
package/dist/gulp.js CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-C5U5_Hdc.js");
3
- const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
4
- const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CLP1Qv8F.js");
5
- const require_precheck = require("./precheck-CQeqnfo5.js");
6
- const require_tailwindcss = require("./tailwindcss-Cl7hUlYV.js");
7
- const require_source_candidates = require("./source-candidates-7Q-kTOSb.js");
3
+ const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
4
+ const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-vqTU-eph.js");
5
+ const require_precheck = require("./precheck-Bp-V1T_Q.js");
6
+ const require_tailwindcss = require("./tailwindcss-bNXguXhC.js");
7
+ const require_source_candidates = require("./source-candidates-BjB4wSga.js");
8
8
  let node_fs = require("node:fs");
9
9
  node_fs = require_chunk.__toESM(node_fs);
10
10
  let node_process = require("node:process");
package/dist/gulp.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-nITnYBDn.mjs";
2
- import { B as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-C_KeUQG3.mjs";
3
- import { c as hasTailwindRootDirectives, i as generateCssByGenerator, r as emitHmrTiming, s as processCachedTask, t as createBundleRuntimeClassSetManager, u as normalizeTailwindSourceForGenerator } from "./incremental-runtime-class-set-D2fsgk5t.mjs";
4
- import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-udhXxMX9.mjs";
5
- import { t as createSourceCandidateCollector } from "./source-candidates-_x8bq0Mz.mjs";
1
+ import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-nPDKYr8V.mjs";
2
+ import { B as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-BYcGCWUY.mjs";
3
+ import { c as hasTailwindRootDirectives, i as generateCssByGenerator, r as emitHmrTiming, s as processCachedTask, t as createBundleRuntimeClassSetManager, u as normalizeTailwindSourceForGenerator } from "./incremental-runtime-class-set-W61zZU00.mjs";
4
+ import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-D6zEhnyE.mjs";
5
+ import { t as createSourceCandidateCollector } from "./source-candidates-l12JBkKU.mjs";
6
6
  import fs from "node:fs";
7
7
  import process from "node:process";
8
8
  import path from "node:path";
@@ -1,6 +1,6 @@
1
- import { m as replaceWxml, r as resolveStyleOptionsFromContext } from "./precheck-nITnYBDn.mjs";
2
- import { B as createDebug, D as loadTailwindV4DesignSystem, E as filterUnsupportedMiniProgramTailwindV4Candidates, R as resolveTailwindV4CssSourceBase, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, q as omitUndefined, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-C_KeUQG3.mjs";
3
- import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-CpsHA4Wd.mjs";
1
+ import { m as replaceWxml, r as resolveStyleOptionsFromContext } from "./precheck-nPDKYr8V.mjs";
2
+ import { B as createDebug, D as loadTailwindV4DesignSystem, E as filterUnsupportedMiniProgramTailwindV4Candidates, R as resolveTailwindV4CssSourceBase, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, q as omitUndefined, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-BYcGCWUY.mjs";
3
+ import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-CmLpVJgw.mjs";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import postcss from "postcss";
6
6
  import process from "node:process";
@@ -478,12 +478,12 @@ async function processCachedTask({ cache, cacheKey, hashKey = cacheKey, rawSourc
478
478
  resolveCache: readCache,
479
479
  async onCacheHit(value) {
480
480
  cacheHit = true;
481
- await applyResult(value);
481
+ await applyResult(value, { cacheHit: true });
482
482
  onCacheHit?.();
483
483
  },
484
484
  transform
485
485
  });
486
- if (!cacheHit) await applyResult(result);
486
+ if (!cacheHit) await applyResult(result, { cacheHit: false });
487
487
  }
488
488
  //#endregion
489
489
  //#region src/bundlers/shared/generator-css/legacy-selectors.ts
@@ -2091,6 +2091,63 @@ function createNonSourceBaseClassSet(baseClassSet, candidateCountByClass) {
2091
2091
  for (const candidate of candidateCountByClass.keys()) nextBaseClassSet.delete(candidate);
2092
2092
  return nextBaseClassSet;
2093
2093
  }
2094
+ function isHighConfidenceV3Candidate(candidate) {
2095
+ return candidate.includes("[") || candidate.includes(":") || candidate.includes("/");
2096
+ }
2097
+ function isRawCandidateInClassContext(source, start, extension) {
2098
+ if (typeof start !== "number" || start <= 0) return false;
2099
+ const before = source.slice(Math.max(0, start - 200), start);
2100
+ if (extension === "html") return /\bclass\s*=\s*["'][^"']*$/i.test(before);
2101
+ return /\bclass(?:Name)?\s*[:=]\s*["'][^"']*$/i.test(before) || /\.classList\.(?:add|remove|toggle|contains)\([^)]*$/i.test(before);
2102
+ }
2103
+ function resolveQuotedLiteralRange(source, start) {
2104
+ if (typeof start !== "number" || start <= 0) return;
2105
+ let quote;
2106
+ let literalStart = -1;
2107
+ for (let index = start - 1; index >= 0; index--) {
2108
+ const char = source[index];
2109
+ if (char !== "\"" && char !== "'" && char !== "`") continue;
2110
+ quote = char;
2111
+ literalStart = index;
2112
+ break;
2113
+ }
2114
+ if (!quote) return;
2115
+ let escaped = false;
2116
+ for (let index = literalStart + 1; index < source.length; index++) {
2117
+ const char = source[index];
2118
+ if (escaped) {
2119
+ escaped = false;
2120
+ continue;
2121
+ }
2122
+ if (char === "\\") {
2123
+ escaped = true;
2124
+ continue;
2125
+ }
2126
+ if (char === quote) {
2127
+ if (start < index) return {
2128
+ start: literalStart,
2129
+ end: index
2130
+ };
2131
+ return;
2132
+ }
2133
+ }
2134
+ }
2135
+ function createHighConfidenceLiteralRanges(source, matches) {
2136
+ const ranges = [];
2137
+ for (const match of matches) {
2138
+ const candidate = match?.rawCandidate;
2139
+ if (typeof candidate !== "string" || !isHighConfidenceV3Candidate(candidate)) continue;
2140
+ const range = resolveQuotedLiteralRange(source, match.start);
2141
+ if (range) ranges.push(range);
2142
+ }
2143
+ return ranges;
2144
+ }
2145
+ function isRawCandidateInRanges(start, ranges) {
2146
+ return typeof start === "number" && ranges.some((range) => start > range.start && start < range.end);
2147
+ }
2148
+ function isRawCandidateAllowedForV3(source, candidate, start, extension, knownSourceCandidates, highConfidenceLiteralRanges = []) {
2149
+ return isHighConfidenceV3Candidate(candidate) || knownSourceCandidates?.has(candidate) === true || isRawCandidateInClassContext(source, start, extension) || isRawCandidateInRanges(start, highConfidenceLiteralRanges);
2150
+ }
2094
2151
  function createBundleRuntimeClassSetManager(options = {}) {
2095
2152
  const customExtractCandidates = options.extractCandidates;
2096
2153
  const extractCandidates = customExtractCandidates ?? extractValidCandidates;
@@ -2149,12 +2206,17 @@ function createBundleRuntimeClassSetManager(options = {}) {
2149
2206
  const validCandidates = new Set(await extractCandidates(createExtractOptions(context, source)));
2150
2207
  for (const candidate of unknownCandidates) candidateValidityCache.set(candidate, validCandidates.has(candidate));
2151
2208
  }
2152
- async function extractEntryRawCandidates(entry) {
2153
- const matches = await extractRawCandidates(entry.source, resolveEntryExtension(entry));
2209
+ async function extractEntryRawCandidates(entry, patcher, knownSourceCandidates) {
2210
+ const extension = resolveEntryExtension(entry);
2211
+ const matches = await extractRawCandidates(entry.source, extension);
2212
+ const highConfidenceLiteralRanges = patcher.majorVersion === 3 && !customExtractCandidates ? createHighConfidenceLiteralRanges(entry.source, matches) : [];
2154
2213
  const candidates = /* @__PURE__ */ new Set();
2155
2214
  for (const match of matches) {
2156
2215
  const candidate = match?.rawCandidate;
2157
- if (typeof candidate === "string" && candidate.length > 0) candidates.add(candidate);
2216
+ if (typeof candidate === "string" && candidate.length > 0) {
2217
+ if (patcher.majorVersion === 3 && !customExtractCandidates && !isRawCandidateAllowedForV3(entry.source, candidate, match.start, extension, knownSourceCandidates, highConfidenceLiteralRanges)) continue;
2218
+ candidates.add(candidate);
2219
+ }
2158
2220
  }
2159
2221
  return candidates;
2160
2222
  }
@@ -2187,7 +2249,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
2187
2249
  await Promise.all(changedRuntimeFiles.map(async (file) => {
2188
2250
  const entry = runtimeEntriesByFile.get(file);
2189
2251
  if (!entry) return;
2190
- const candidates = await extractEntryRawCandidates(entry);
2252
+ const candidates = await extractEntryRawCandidates(entry, patcher, nextBaseClassSet);
2191
2253
  rawCandidatesByFile.set(file, candidates);
2192
2254
  for (const candidate of candidates) if (!candidateValidityCache.has(candidate)) unknownCandidates.add(candidate);
2193
2255
  }));
@@ -2221,4 +2283,4 @@ function createBundleRuntimeClassSetManager(options = {}) {
2221
2283
  };
2222
2284
  }
2223
2285
  //#endregion
2224
- export { validateCandidatesByGenerator as a, hasTailwindRootDirectives as c, hasTailwindGeneratedCssMarkers as d, generateCssByGenerator as i, hasTailwindSourceDirectives as l, createHmrTimingRecorder as n, mergeMarkedUserLayerComponentsCss as o, emitHmrTiming as r, processCachedTask as s, createBundleRuntimeClassSetManager as t, normalizeTailwindSourceForGenerator as u };
2286
+ export { validateCandidatesByGenerator as a, hasTailwindRootDirectives as c, removeTailwindSourceDirectives as d, hasTailwindGeneratedCssMarkers as f, generateCssByGenerator as i, hasTailwindSourceDirectives as l, createHmrTimingRecorder as n, mergeMarkedUserLayerComponentsCss as o, emitHmrTiming as r, processCachedTask as s, createBundleRuntimeClassSetManager as t, normalizeTailwindSourceForGenerator as u };
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-C5U5_Hdc.js");
2
- const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
3
- const require_generator = require("./generator-BEXaaUzP.js");
4
- const require_precheck = require("./precheck-CQeqnfo5.js");
2
+ const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
3
+ const require_generator = require("./generator-BtpQoQEH.js");
4
+ const require_precheck = require("./precheck-Bp-V1T_Q.js");
5
5
  let node_fs = require("node:fs");
6
6
  let postcss = require("postcss");
7
7
  postcss = require_chunk.__toESM(postcss);
@@ -482,12 +482,12 @@ async function processCachedTask({ cache, cacheKey, hashKey = cacheKey, rawSourc
482
482
  resolveCache: readCache,
483
483
  async onCacheHit(value) {
484
484
  cacheHit = true;
485
- await applyResult(value);
485
+ await applyResult(value, { cacheHit: true });
486
486
  onCacheHit?.();
487
487
  },
488
488
  transform
489
489
  });
490
- if (!cacheHit) await applyResult(result);
490
+ if (!cacheHit) await applyResult(result, { cacheHit: false });
491
491
  }
492
492
  //#endregion
493
493
  //#region src/bundlers/shared/generator-css/legacy-selectors.ts
@@ -2095,6 +2095,63 @@ function createNonSourceBaseClassSet(baseClassSet, candidateCountByClass) {
2095
2095
  for (const candidate of candidateCountByClass.keys()) nextBaseClassSet.delete(candidate);
2096
2096
  return nextBaseClassSet;
2097
2097
  }
2098
+ function isHighConfidenceV3Candidate(candidate) {
2099
+ return candidate.includes("[") || candidate.includes(":") || candidate.includes("/");
2100
+ }
2101
+ function isRawCandidateInClassContext(source, start, extension) {
2102
+ if (typeof start !== "number" || start <= 0) return false;
2103
+ const before = source.slice(Math.max(0, start - 200), start);
2104
+ if (extension === "html") return /\bclass\s*=\s*["'][^"']*$/i.test(before);
2105
+ return /\bclass(?:Name)?\s*[:=]\s*["'][^"']*$/i.test(before) || /\.classList\.(?:add|remove|toggle|contains)\([^)]*$/i.test(before);
2106
+ }
2107
+ function resolveQuotedLiteralRange(source, start) {
2108
+ if (typeof start !== "number" || start <= 0) return;
2109
+ let quote;
2110
+ let literalStart = -1;
2111
+ for (let index = start - 1; index >= 0; index--) {
2112
+ const char = source[index];
2113
+ if (char !== "\"" && char !== "'" && char !== "`") continue;
2114
+ quote = char;
2115
+ literalStart = index;
2116
+ break;
2117
+ }
2118
+ if (!quote) return;
2119
+ let escaped = false;
2120
+ for (let index = literalStart + 1; index < source.length; index++) {
2121
+ const char = source[index];
2122
+ if (escaped) {
2123
+ escaped = false;
2124
+ continue;
2125
+ }
2126
+ if (char === "\\") {
2127
+ escaped = true;
2128
+ continue;
2129
+ }
2130
+ if (char === quote) {
2131
+ if (start < index) return {
2132
+ start: literalStart,
2133
+ end: index
2134
+ };
2135
+ return;
2136
+ }
2137
+ }
2138
+ }
2139
+ function createHighConfidenceLiteralRanges(source, matches) {
2140
+ const ranges = [];
2141
+ for (const match of matches) {
2142
+ const candidate = match?.rawCandidate;
2143
+ if (typeof candidate !== "string" || !isHighConfidenceV3Candidate(candidate)) continue;
2144
+ const range = resolveQuotedLiteralRange(source, match.start);
2145
+ if (range) ranges.push(range);
2146
+ }
2147
+ return ranges;
2148
+ }
2149
+ function isRawCandidateInRanges(start, ranges) {
2150
+ return typeof start === "number" && ranges.some((range) => start > range.start && start < range.end);
2151
+ }
2152
+ function isRawCandidateAllowedForV3(source, candidate, start, extension, knownSourceCandidates, highConfidenceLiteralRanges = []) {
2153
+ return isHighConfidenceV3Candidate(candidate) || knownSourceCandidates?.has(candidate) === true || isRawCandidateInClassContext(source, start, extension) || isRawCandidateInRanges(start, highConfidenceLiteralRanges);
2154
+ }
2098
2155
  function createBundleRuntimeClassSetManager(options = {}) {
2099
2156
  const customExtractCandidates = options.extractCandidates;
2100
2157
  const extractCandidates = customExtractCandidates ?? tailwindcss_patch.extractValidCandidates;
@@ -2153,12 +2210,17 @@ function createBundleRuntimeClassSetManager(options = {}) {
2153
2210
  const validCandidates = new Set(await extractCandidates(createExtractOptions(context, source)));
2154
2211
  for (const candidate of unknownCandidates) candidateValidityCache.set(candidate, validCandidates.has(candidate));
2155
2212
  }
2156
- async function extractEntryRawCandidates(entry) {
2157
- const matches = await extractRawCandidates(entry.source, resolveEntryExtension(entry));
2213
+ async function extractEntryRawCandidates(entry, patcher, knownSourceCandidates) {
2214
+ const extension = resolveEntryExtension(entry);
2215
+ const matches = await extractRawCandidates(entry.source, extension);
2216
+ const highConfidenceLiteralRanges = patcher.majorVersion === 3 && !customExtractCandidates ? createHighConfidenceLiteralRanges(entry.source, matches) : [];
2158
2217
  const candidates = /* @__PURE__ */ new Set();
2159
2218
  for (const match of matches) {
2160
2219
  const candidate = match?.rawCandidate;
2161
- if (typeof candidate === "string" && candidate.length > 0) candidates.add(candidate);
2220
+ if (typeof candidate === "string" && candidate.length > 0) {
2221
+ if (patcher.majorVersion === 3 && !customExtractCandidates && !isRawCandidateAllowedForV3(entry.source, candidate, match.start, extension, knownSourceCandidates, highConfidenceLiteralRanges)) continue;
2222
+ candidates.add(candidate);
2223
+ }
2162
2224
  }
2163
2225
  return candidates;
2164
2226
  }
@@ -2191,7 +2253,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
2191
2253
  await Promise.all(changedRuntimeFiles.map(async (file) => {
2192
2254
  const entry = runtimeEntriesByFile.get(file);
2193
2255
  if (!entry) return;
2194
- const candidates = await extractEntryRawCandidates(entry);
2256
+ const candidates = await extractEntryRawCandidates(entry, patcher, nextBaseClassSet);
2195
2257
  rawCandidatesByFile.set(file, candidates);
2196
2258
  for (const candidate of candidates) if (!candidateValidityCache.has(candidate)) unknownCandidates.add(candidate);
2197
2259
  }));
@@ -2285,6 +2347,12 @@ Object.defineProperty(exports, "processCachedTask", {
2285
2347
  return processCachedTask;
2286
2348
  }
2287
2349
  });
2350
+ Object.defineProperty(exports, "removeTailwindSourceDirectives", {
2351
+ enumerable: true,
2352
+ get: function() {
2353
+ return removeTailwindSourceDirectives;
2354
+ }
2355
+ });
2288
2356
  Object.defineProperty(exports, "validateCandidatesByGenerator", {
2289
2357
  enumerable: true,
2290
2358
  get: function() {
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_generator = require("./generator-BEXaaUzP.js");
2
+ const require_generator = require("./generator-BtpQoQEH.js");
3
3
  const require_gulp = require("./gulp.js");
4
- const require_postcss = require("./postcss-DN7IQzYb.js");
5
- const require_vite = require("./vite-CYkkJZ3Q.js");
6
- const require_webpack = require("./webpack-CPwDaKy3.js");
4
+ const require_postcss = require("./postcss-DSvNrY0J.js");
5
+ const require_vite = require("./vite-CMzi0wR2.js");
6
+ const require_webpack = require("./webpack-2v1sQKyZ.js");
7
7
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
8
8
  exports.WeappTailwindcss = require_vite.WeappTailwindcss;
9
9
  exports.createPlugins = require_gulp.createPlugins;
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { t as createWeappTailwindcssGenerator } from "./generator-CpsHA4Wd.mjs";
1
+ import { t as createWeappTailwindcssGenerator } from "./generator-CmLpVJgw.mjs";
2
2
  import { WeappTailwindcss as createPlugins } from "./gulp.mjs";
3
- import { t as weappTailwindcssPostcssPlugin } from "./postcss-BvkdIZr8.mjs";
4
- import { t as WeappTailwindcss } from "./vite-BAHjBu8j.mjs";
5
- import { n as weappTailwindcssPackageDir } from "./webpack-xxmiRxcy.mjs";
3
+ import { t as weappTailwindcssPostcssPlugin } from "./postcss-DGprmeke.mjs";
4
+ import { t as WeappTailwindcss } from "./vite-C8SUICPv.mjs";
5
+ import { n as weappTailwindcssPackageDir } from "./webpack-pdpdIv_X.mjs";
6
6
  import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
7
7
  export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
@@ -0,0 +1,5 @@
1
+ import type { IJsHandlerOptions } from '../types';
2
+ type EscapeMap = NonNullable<IJsHandlerOptions['escapeMap']>;
3
+ export declare function getReplacementCacheStore(escapeMap?: EscapeMap): Map<string, string>;
4
+ export declare function getReplacement(candidate: string, escapeMap: EscapeMap | undefined, store?: Map<string, string>): string;
5
+ export {};
@@ -1,5 +1,5 @@
1
- import { A as collectCssInlineSourceCandidates, F as parseConfigParam, H as readInstalledPackageMajorVersion, I as resolveCssSourceEntries, M as expandTailwindSourceEntries, O as DEFAULT_SOURCE_SCAN_EXTENSIONS, P as normalizeLegacyContentEntries, j as createSourceScanPattern, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-C_KeUQG3.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-CpsHA4Wd.mjs";
1
+ import { A as collectCssInlineSourceCandidates, F as parseConfigParam, H as readInstalledPackageMajorVersion, I as resolveCssSourceEntries, M as expandTailwindSourceEntries, O as DEFAULT_SOURCE_SCAN_EXTENSIONS, P as normalizeLegacyContentEntries, j as createSourceScanPattern, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-BYcGCWUY.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-CmLpVJgw.mjs";
3
3
  import postcss from "postcss";
4
4
  import process from "node:process";
5
5
  import path from "node:path";
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-C5U5_Hdc.js");
2
- const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
3
- const require_generator = require("./generator-BEXaaUzP.js");
2
+ const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
3
+ const require_generator = require("./generator-BtpQoQEH.js");
4
4
  let postcss = require("postcss");
5
5
  postcss = require_chunk.__toESM(postcss);
6
6
  let node_process = require("node:process");
package/dist/postcss.js CHANGED
@@ -2,6 +2,6 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_postcss = require("./postcss-DN7IQzYb.js");
5
+ const require_postcss = require("./postcss-DSvNrY0J.js");
6
6
  exports.default = require_postcss.weappTailwindcssPostcssPlugin;
7
7
  exports.weappTailwindcssPostcssPlugin = require_postcss.weappTailwindcssPostcssPlugin;
package/dist/postcss.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as weappTailwindcssPostcssPlugin } from "./postcss-BvkdIZr8.mjs";
1
+ import { t as weappTailwindcssPostcssPlugin } from "./postcss-DGprmeke.mjs";
2
2
  export { weappTailwindcssPostcssPlugin as default, weappTailwindcssPostcssPlugin };