weapp-tailwindcss 4.11.2 → 4.12.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/bin/weapp-tailwindcss.js +21 -1
- package/dist/{chunk-AV3XB6EQ.js → chunk-2A4NRLSY.js} +5 -5
- package/dist/{chunk-WJIRXC26.js → chunk-6JBFHYFM.js} +134 -128
- package/dist/{chunk-OMARW5NC.mjs → chunk-AYJ4HLWZ.mjs} +4 -2
- package/dist/{chunk-W3DXDWYC.mjs → chunk-CMNCGACY.mjs} +66 -60
- package/dist/{chunk-ZZ36BKM5.mjs → chunk-CQMHHQRN.mjs} +6 -2
- package/dist/{chunk-OYSABARD.js → chunk-E7I5TW5K.js} +3 -2
- package/dist/{chunk-7LKMJZD2.js → chunk-GMKSBLNY.js} +2 -2
- package/dist/{chunk-EFBQ4SQR.mjs → chunk-HL3US2OT.mjs} +1 -1
- package/dist/{chunk-AB2RGZQO.mjs → chunk-LWEVOVRD.mjs} +144 -76
- package/dist/{chunk-QK6VNNNL.js → chunk-NIS74SI6.js} +8 -6
- package/dist/{chunk-CRDOWYG4.js → chunk-ONLKZIRQ.js} +1 -1
- package/dist/{chunk-3QHYEMEW.js → chunk-PAAX4FDD.js} +45 -40
- package/dist/{chunk-JIERVBTX.mjs → chunk-SHDJA4GG.mjs} +1 -1
- package/dist/{chunk-SUKOZ6OG.js → chunk-SRAG3FST.js} +10 -6
- package/dist/{chunk-TT5WHNGS.js → chunk-YVRX3F6S.js} +149 -81
- package/dist/{chunk-2LH6PZH3.mjs → chunk-ZCH4YINE.mjs} +3 -2
- package/dist/{chunk-VGPAKLMZ.mjs → chunk-ZGIN2OAY.mjs} +12 -7
- package/dist/cli.js +2233 -158
- package/dist/cli.mjs +2238 -163
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +14 -9
- package/dist/core.mjs +10 -5
- package/dist/css-macro/postcss.js +4 -4
- package/dist/css-macro/postcss.mjs +2 -2
- package/dist/css-macro.js +5 -5
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +4 -4
- package/dist/{index-CoXntW_P.d.mts → index-BXrmQelt.d.mts} +29 -1
- package/dist/{index-CoXntW_P.d.ts → index-BXrmQelt.d.ts} +29 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.mjs +7 -7
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.d.mts +8 -1
- package/dist/presets.d.ts +8 -1
- package/dist/presets.js +7 -6
- package/dist/presets.mjs +3 -2
- package/dist/reset.d.mts +1 -31
- package/dist/reset.d.ts +3 -32
- package/dist/reset.js +3 -160
- package/dist/reset.mjs +3 -160
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +4 -4
- package/dist/weapp-tw-css-import-rewrite-loader.js +10 -5
- package/dist/weapp-tw-runtime-classset-loader.js +9 -4
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +65 -56
- package/dist/webpack4.mjs +35 -26
- package/package.json +12 -7
- package/scripts/postinstall.mjs +59 -0
|
@@ -7,8 +7,9 @@ import {
|
|
|
7
7
|
invalidateRuntimeClassSet,
|
|
8
8
|
isUniAppXEnabled,
|
|
9
9
|
logger,
|
|
10
|
+
resolveUniAppXOptions,
|
|
10
11
|
warnMissingCssEntries
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AYJ4HLWZ.mjs";
|
|
12
13
|
import {
|
|
13
14
|
getDefaultOptions
|
|
14
15
|
} from "./chunk-XAKAD2CR.mjs";
|
|
@@ -362,14 +363,14 @@ function initializeCache(cacheConfig) {
|
|
|
362
363
|
}
|
|
363
364
|
|
|
364
365
|
// src/tailwindcss/runtime-logs.ts
|
|
365
|
-
import
|
|
366
|
+
import process2 from "process";
|
|
366
367
|
import { logger as logger2, pc } from "@weapp-tailwindcss/logger";
|
|
367
368
|
var runtimeLogDedupeHolder = globalThis;
|
|
368
369
|
var runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
|
|
369
370
|
function createRuntimeLogKey(category, baseDir, rootPath, version) {
|
|
370
371
|
return JSON.stringify([
|
|
371
372
|
category,
|
|
372
|
-
baseDir ??
|
|
373
|
+
baseDir ?? process2.cwd(),
|
|
373
374
|
rootPath ?? "",
|
|
374
375
|
version ?? ""
|
|
375
376
|
]);
|
|
@@ -404,7 +405,7 @@ function logRuntimeTailwindcssVersion(baseDir, rootPath, version) {
|
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
// src/tailwindcss/targets.ts
|
|
407
|
-
import
|
|
408
|
+
import process5 from "process";
|
|
408
409
|
import { logger as logger4 } from "@weapp-tailwindcss/logger";
|
|
409
410
|
|
|
410
411
|
// src/tailwindcss/targets/paths.ts
|
|
@@ -459,13 +460,13 @@ function getRecordFileCandidates(baseDir) {
|
|
|
459
460
|
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
460
461
|
import { mkdir, writeFile } from "fs/promises";
|
|
461
462
|
import path2 from "path";
|
|
462
|
-
import
|
|
463
|
+
import process3 from "process";
|
|
463
464
|
import { logger as logger3 } from "@weapp-tailwindcss/logger";
|
|
464
465
|
|
|
465
466
|
// package.json
|
|
466
467
|
var package_default = {
|
|
467
468
|
name: "weapp-tailwindcss",
|
|
468
|
-
version: "4.
|
|
469
|
+
version: "4.12.0-alpha.2",
|
|
469
470
|
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!",
|
|
470
471
|
author: "ice breaker <1324318532@qq.com>",
|
|
471
472
|
license: "MIT",
|
|
@@ -615,13 +616,14 @@ var package_default = {
|
|
|
615
616
|
"dist",
|
|
616
617
|
"index.css",
|
|
617
618
|
"preflight.css",
|
|
619
|
+
"scripts/postinstall.mjs",
|
|
618
620
|
"theme.css",
|
|
619
621
|
"uni-app-x.css",
|
|
620
622
|
"utilities.css",
|
|
621
623
|
"with-layer.css"
|
|
622
624
|
],
|
|
623
625
|
engines: {
|
|
624
|
-
node: "^
|
|
626
|
+
node: "^20.19.0 || >=22.12.0"
|
|
625
627
|
},
|
|
626
628
|
scripts: {
|
|
627
629
|
dev: "tsup --watch --sourcemap",
|
|
@@ -630,7 +632,7 @@ var package_default = {
|
|
|
630
632
|
"build:cli": "cd plugins/cli && pnpm run build",
|
|
631
633
|
"build:css": "tsx scripts/build-css.ts",
|
|
632
634
|
"build:weapp-theme": "tsx scripts/build-weapp-theme.ts",
|
|
633
|
-
test: "
|
|
635
|
+
test: "pnpm run cli:patch && vitest run",
|
|
634
636
|
"test:dev": "vitest",
|
|
635
637
|
"test:ui": "vitest --ui",
|
|
636
638
|
bench: "vitest bench --config ./vitest.config.ts",
|
|
@@ -647,7 +649,7 @@ var package_default = {
|
|
|
647
649
|
release: "tsx scripts/release.ts",
|
|
648
650
|
lint: "eslint .",
|
|
649
651
|
"lint:fix": "eslint ./src --fix",
|
|
650
|
-
postinstall: "node
|
|
652
|
+
postinstall: "node scripts/postinstall.mjs",
|
|
651
653
|
"bench:vite-dev-hmr": "tsx scripts/vite-dev-hmr-bench.ts",
|
|
652
654
|
"test:watch-hmr": "node --import tsx scripts/watch-hmr-regression/index.ts"
|
|
653
655
|
},
|
|
@@ -667,6 +669,7 @@ var package_default = {
|
|
|
667
669
|
"@weapp-core/regex": "~1.0.1",
|
|
668
670
|
"@weapp-tailwindcss/logger": "workspace:*",
|
|
669
671
|
"@weapp-tailwindcss/postcss": "workspace:*",
|
|
672
|
+
"@weapp-tailwindcss/reset": "workspace:*",
|
|
670
673
|
"@weapp-tailwindcss/shared": "workspace:*",
|
|
671
674
|
cac: "6.7.14",
|
|
672
675
|
"comment-json": "^4.6.2",
|
|
@@ -681,6 +684,9 @@ var package_default = {
|
|
|
681
684
|
"tailwindcss-patch": "catalog:tailwindcssPatch",
|
|
682
685
|
"webpack-sources": "3.3.4",
|
|
683
686
|
yaml: "^2.8.3"
|
|
687
|
+
},
|
|
688
|
+
devDependencies: {
|
|
689
|
+
"fast-check": "^4.7.0"
|
|
684
690
|
}
|
|
685
691
|
};
|
|
686
692
|
|
|
@@ -703,7 +709,7 @@ function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
|
|
|
703
709
|
}
|
|
704
710
|
loggedInvalidPatchRecords.add(normalizedPath);
|
|
705
711
|
const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
|
|
706
|
-
const baseDisplay = formatRelativeToBase(path2.normalize(baseDir),
|
|
712
|
+
const baseDisplay = formatRelativeToBase(path2.normalize(baseDir), process3.cwd());
|
|
707
713
|
const reasonMessage = reason ? `\uFF1A${reason}` : "";
|
|
708
714
|
logger3.warn(
|
|
709
715
|
`\u68C0\u6D4B\u5230\u635F\u574F\u7684 Tailwind CSS \u76EE\u6807\u8BB0\u5F55 ${fileDisplay}${reasonMessage}\u3002\u8BF7\u5728 ${baseDisplay} \u91CD\u65B0\u6267\u884C "weapp-tw patch --record-target" \u6216\u5220\u9664\u8BE5\u6587\u4EF6\u540E\u518D\u8FD0\u884C\u3002`
|
|
@@ -762,7 +768,7 @@ async function saveCliPatchTargetRecord(baseDir, patcher, options) {
|
|
|
762
768
|
`, "utf8");
|
|
763
769
|
return recordPath;
|
|
764
770
|
} catch (error) {
|
|
765
|
-
const baseDisplay = formatRelativeToBase(normalizedBase,
|
|
771
|
+
const baseDisplay = formatRelativeToBase(normalizedBase, process3.cwd());
|
|
766
772
|
logger3.warn(
|
|
767
773
|
'\u81EA\u52A8\u66F4\u65B0 Tailwind CSS \u8865\u4E01\u8BB0\u5F55\u5931\u8D25\uFF0C\u8BF7\u5728 %s \u8FD0\u884C "weapp-tw patch --cwd %s"\u3002',
|
|
768
774
|
baseDisplay,
|
|
@@ -775,10 +781,10 @@ async function saveCliPatchTargetRecord(baseDir, patcher, options) {
|
|
|
775
781
|
|
|
776
782
|
// src/tailwindcss/targets/recorder.ts
|
|
777
783
|
import path3 from "path";
|
|
778
|
-
import
|
|
784
|
+
import process4 from "process";
|
|
779
785
|
function findPatchTargetRecord(baseDir) {
|
|
780
786
|
const visited = /* @__PURE__ */ new Set();
|
|
781
|
-
const fallback = baseDir ??
|
|
787
|
+
const fallback = baseDir ?? process4.cwd();
|
|
782
788
|
let current = path3.resolve(fallback);
|
|
783
789
|
while (!visited.has(current)) {
|
|
784
790
|
const record = readPatchTargetRecord(current);
|
|
@@ -861,7 +867,7 @@ function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
|
861
867
|
logger4.warn(
|
|
862
868
|
"%s \u672A\u627E\u5230 Tailwind CSS \u4F9D\u8D56\uFF0C\u8BF7\u68C0\u67E5\u5728 %s \u662F\u5426\u5DF2\u5B89\u88C5 tailwindcss",
|
|
863
869
|
label,
|
|
864
|
-
baseDir ??
|
|
870
|
+
baseDir ?? process5.cwd()
|
|
865
871
|
);
|
|
866
872
|
return;
|
|
867
873
|
}
|
|
@@ -877,7 +883,7 @@ function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
|
877
883
|
// src/context/compiler-context-cache.ts
|
|
878
884
|
import { Buffer } from "buffer";
|
|
879
885
|
import path4 from "path";
|
|
880
|
-
import
|
|
886
|
+
import process6 from "process";
|
|
881
887
|
import { logger as logger5 } from "@weapp-tailwindcss/logger";
|
|
882
888
|
var PAREN_CONTENT_RE = /\(([^)]+)\)/u;
|
|
883
889
|
var AT_LOCATION_RE = /at\s+(\S.*)$/u;
|
|
@@ -911,7 +917,7 @@ function shouldProbeCallerLocation(opts) {
|
|
|
911
917
|
if (hasExplicitOptionBasedir(opts)) {
|
|
912
918
|
return false;
|
|
913
919
|
}
|
|
914
|
-
return !(
|
|
920
|
+
return !(process6.env.WEAPP_TAILWINDCSS_BASEDIR || process6.env.WEAPP_TAILWINDCSS_BASE_DIR || process6.env.TAILWINDCSS_BASEDIR || process6.env.TAILWINDCSS_BASE_DIR);
|
|
915
921
|
}
|
|
916
922
|
function detectCallerLocation() {
|
|
917
923
|
const stack = new Error("compiler-context-cache stack probe").stack;
|
|
@@ -944,20 +950,20 @@ function getRuntimeCacheScope(opts) {
|
|
|
944
950
|
}
|
|
945
951
|
const runtimeScope = {
|
|
946
952
|
caller: void 0,
|
|
947
|
-
cwd:
|
|
948
|
-
init_cwd:
|
|
949
|
-
npm_config_local_prefix:
|
|
950
|
-
npm_package_json:
|
|
951
|
-
pnpm_package_name:
|
|
952
|
-
pwd:
|
|
953
|
-
tailwindcss_base_dir:
|
|
954
|
-
tailwindcss_basedir:
|
|
955
|
-
uni_app_input_dir:
|
|
956
|
-
uni_cli_root:
|
|
957
|
-
uni_input_dir:
|
|
958
|
-
uni_input_root:
|
|
959
|
-
weapp_tailwindcss_base_dir:
|
|
960
|
-
weapp_tailwindcss_basedir:
|
|
953
|
+
cwd: process6.cwd(),
|
|
954
|
+
init_cwd: process6.env.INIT_CWD,
|
|
955
|
+
npm_config_local_prefix: process6.env.npm_config_local_prefix,
|
|
956
|
+
npm_package_json: process6.env.npm_package_json,
|
|
957
|
+
pnpm_package_name: process6.env.PNPM_PACKAGE_NAME,
|
|
958
|
+
pwd: process6.env.PWD,
|
|
959
|
+
tailwindcss_base_dir: process6.env.TAILWINDCSS_BASE_DIR,
|
|
960
|
+
tailwindcss_basedir: process6.env.TAILWINDCSS_BASEDIR,
|
|
961
|
+
uni_app_input_dir: process6.env.UNI_APP_INPUT_DIR,
|
|
962
|
+
uni_cli_root: process6.env.UNI_CLI_ROOT,
|
|
963
|
+
uni_input_dir: process6.env.UNI_INPUT_DIR,
|
|
964
|
+
uni_input_root: process6.env.UNI_INPUT_ROOT,
|
|
965
|
+
weapp_tailwindcss_base_dir: process6.env.WEAPP_TAILWINDCSS_BASE_DIR,
|
|
966
|
+
weapp_tailwindcss_basedir: process6.env.WEAPP_TAILWINDCSS_BASEDIR
|
|
961
967
|
};
|
|
962
968
|
if (shouldProbeCallerLocation(opts)) {
|
|
963
969
|
runtimeScope.caller = detectCallerLocation();
|
|
@@ -1164,6 +1170,9 @@ function toCustomAttributesEntities(customAttributes) {
|
|
|
1164
1170
|
// src/context/handlers.ts
|
|
1165
1171
|
import { createStyleHandler } from "@weapp-tailwindcss/postcss";
|
|
1166
1172
|
|
|
1173
|
+
// src/js/index.ts
|
|
1174
|
+
import { LRUCache as LRUCache3 } from "lru-cache";
|
|
1175
|
+
|
|
1167
1176
|
// src/babel/index.ts
|
|
1168
1177
|
import _babelTraverse from "@babel/traverse";
|
|
1169
1178
|
import { parse, parseExpression } from "@babel/parser";
|
|
@@ -2802,6 +2811,7 @@ var EMPTY_IMPORT_DECLARATIONS = /* @__PURE__ */ new Set();
|
|
|
2802
2811
|
var EMPTY_EXPORT_DECLARATIONS = /* @__PURE__ */ new Set();
|
|
2803
2812
|
var EMPTY_REQUIRE_CALL_PATHS = [];
|
|
2804
2813
|
var ignoredTaggedTemplateMatcherCache = /* @__PURE__ */ new WeakMap();
|
|
2814
|
+
var defaultEvalHandler;
|
|
2805
2815
|
function getIgnoredTaggedTemplateMatcher(options) {
|
|
2806
2816
|
const cached = ignoredTaggedTemplateMatcherCache.get(options);
|
|
2807
2817
|
if (cached) {
|
|
@@ -2811,6 +2821,12 @@ function getIgnoredTaggedTemplateMatcher(options) {
|
|
|
2811
2821
|
ignoredTaggedTemplateMatcherCache.set(options, created);
|
|
2812
2822
|
return created;
|
|
2813
2823
|
}
|
|
2824
|
+
function getDefaultEvalHandler() {
|
|
2825
|
+
if (!defaultEvalHandler) {
|
|
2826
|
+
throw new Error("Default JS eval handler is not initialized.");
|
|
2827
|
+
}
|
|
2828
|
+
return defaultEvalHandler;
|
|
2829
|
+
}
|
|
2814
2830
|
function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
2815
2831
|
const jsTokenUpdater = new JsTokenUpdater();
|
|
2816
2832
|
const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
|
|
@@ -2838,7 +2854,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
|
2838
2854
|
const importDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_IMPORT_DECLARATIONS;
|
|
2839
2855
|
const exportDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_EXPORT_DECLARATIONS;
|
|
2840
2856
|
const requireCallPaths = collectModuleMetadata ? [] : EMPTY_REQUIRE_CALL_PATHS;
|
|
2841
|
-
const evalHandler = handler ??
|
|
2857
|
+
const evalHandler = handler ?? getDefaultEvalHandler();
|
|
2842
2858
|
const templateElementEnter = hasTaggedTemplateIgnoreIdentifiers ? (p) => {
|
|
2843
2859
|
const pp = p.parentPath;
|
|
2844
2860
|
if (pp.isTemplateLiteral()) {
|
|
@@ -2979,8 +2995,52 @@ function jsHandler(rawSource, options) {
|
|
|
2979
2995
|
}
|
|
2980
2996
|
return result;
|
|
2981
2997
|
}
|
|
2998
|
+
defaultEvalHandler = jsHandler;
|
|
2982
2999
|
|
|
2983
3000
|
// src/js/index.ts
|
|
3001
|
+
var RESULT_CACHE_MAX = 512;
|
|
3002
|
+
var classNameSetIds = /* @__PURE__ */ new WeakMap();
|
|
3003
|
+
var nextClassNameSetId = 0;
|
|
3004
|
+
function getClassNameSetId(set) {
|
|
3005
|
+
if (!set) {
|
|
3006
|
+
return "none";
|
|
3007
|
+
}
|
|
3008
|
+
const existing = classNameSetIds.get(set);
|
|
3009
|
+
if (existing !== void 0) {
|
|
3010
|
+
return String(existing);
|
|
3011
|
+
}
|
|
3012
|
+
const id = nextClassNameSetId++;
|
|
3013
|
+
classNameSetIds.set(set, id);
|
|
3014
|
+
return String(id);
|
|
3015
|
+
}
|
|
3016
|
+
var fingerprintCache = /* @__PURE__ */ new WeakMap();
|
|
3017
|
+
function getOptionsFingerprint(options) {
|
|
3018
|
+
const cached = fingerprintCache.get(options);
|
|
3019
|
+
if (cached) {
|
|
3020
|
+
return cached;
|
|
3021
|
+
}
|
|
3022
|
+
const parts = [
|
|
3023
|
+
getClassNameSetId(options.classNameSet),
|
|
3024
|
+
JSON.stringify(options.escapeMap ?? null),
|
|
3025
|
+
options.needEscaped ? "1" : "0",
|
|
3026
|
+
options.alwaysEscape ? "1" : "0",
|
|
3027
|
+
options.unescapeUnicode ? "1" : "0",
|
|
3028
|
+
options.generateMap ? "1" : "0",
|
|
3029
|
+
options.uniAppX ? "1" : "0",
|
|
3030
|
+
options.wrapExpression ? "1" : "0",
|
|
3031
|
+
String(options.tailwindcssMajorVersion ?? ""),
|
|
3032
|
+
String(options.staleClassNameFallback ?? ""),
|
|
3033
|
+
String(options.jsArbitraryValueFallback ?? ""),
|
|
3034
|
+
JSON.stringify(options.arbitraryValues ?? null),
|
|
3035
|
+
JSON.stringify(options.ignoreCallExpressionIdentifiers ?? null),
|
|
3036
|
+
JSON.stringify(options.ignoreTaggedTemplateExpressionIdentifiers?.map((v) => v instanceof RegExp ? v.source : v) ?? null),
|
|
3037
|
+
JSON.stringify(options.moduleSpecifierReplacements ?? null),
|
|
3038
|
+
JSON.stringify(options.babelParserOptions ?? null)
|
|
3039
|
+
];
|
|
3040
|
+
const fingerprint = parts.join("|");
|
|
3041
|
+
fingerprintCache.set(options, fingerprint);
|
|
3042
|
+
return fingerprint;
|
|
3043
|
+
}
|
|
2984
3044
|
function hasDefinedOverrides(options) {
|
|
2985
3045
|
if (!options) {
|
|
2986
3046
|
return false;
|
|
@@ -2992,17 +3052,6 @@ function hasDefinedOverrides(options) {
|
|
|
2992
3052
|
}
|
|
2993
3053
|
return false;
|
|
2994
3054
|
}
|
|
2995
|
-
var CACHEABLE_SOURCE_MAX_LENGTH = 512;
|
|
2996
|
-
var RESULT_CACHE_LIMIT = 256;
|
|
2997
|
-
function shouldCacheJsResult(rawSource, options) {
|
|
2998
|
-
if (rawSource.length === 0 || rawSource.length > CACHEABLE_SOURCE_MAX_LENGTH) {
|
|
2999
|
-
return false;
|
|
3000
|
-
}
|
|
3001
|
-
if (options.moduleGraph || options.filename) {
|
|
3002
|
-
return false;
|
|
3003
|
-
}
|
|
3004
|
-
return true;
|
|
3005
|
-
}
|
|
3006
3055
|
function createJsHandler(options) {
|
|
3007
3056
|
const defaults = {
|
|
3008
3057
|
escapeMap: options.escapeMap,
|
|
@@ -3021,11 +3070,10 @@ function createJsHandler(options) {
|
|
|
3021
3070
|
uniAppX: options.uniAppX,
|
|
3022
3071
|
moduleSpecifierReplacements: options.moduleSpecifierReplacements
|
|
3023
3072
|
};
|
|
3024
|
-
const
|
|
3073
|
+
const defaultOptionsCache = /* @__PURE__ */ new WeakMap();
|
|
3025
3074
|
let resolvedOptionsWithoutClassNameSet;
|
|
3026
|
-
const
|
|
3027
|
-
const
|
|
3028
|
-
const resultCache = /* @__PURE__ */ new WeakMap();
|
|
3075
|
+
const overrideOptionsCache = /* @__PURE__ */ new WeakMap();
|
|
3076
|
+
const resultCache = new LRUCache3({ max: RESULT_CACHE_MAX });
|
|
3029
3077
|
function resolveDefaultOptions(classNameSet) {
|
|
3030
3078
|
if (!classNameSet) {
|
|
3031
3079
|
if (!resolvedOptionsWithoutClassNameSet) {
|
|
@@ -3036,7 +3084,7 @@ function createJsHandler(options) {
|
|
|
3036
3084
|
}
|
|
3037
3085
|
return resolvedOptionsWithoutClassNameSet;
|
|
3038
3086
|
}
|
|
3039
|
-
const cached =
|
|
3087
|
+
const cached = defaultOptionsCache.get(classNameSet);
|
|
3040
3088
|
if (cached) {
|
|
3041
3089
|
return cached;
|
|
3042
3090
|
}
|
|
@@ -3044,42 +3092,36 @@ function createJsHandler(options) {
|
|
|
3044
3092
|
...defaults,
|
|
3045
3093
|
classNameSet
|
|
3046
3094
|
};
|
|
3047
|
-
|
|
3095
|
+
defaultOptionsCache.set(classNameSet, created);
|
|
3048
3096
|
return created;
|
|
3049
3097
|
}
|
|
3050
3098
|
function getCachedJsResult(rawSource, resolvedOptions) {
|
|
3051
|
-
if (
|
|
3099
|
+
if (rawSource.length === 0) {
|
|
3052
3100
|
return void 0;
|
|
3053
3101
|
}
|
|
3054
|
-
const
|
|
3055
|
-
return
|
|
3102
|
+
const key = `${getOptionsFingerprint(resolvedOptions)}:${md5(rawSource)}`;
|
|
3103
|
+
return resultCache.get(key);
|
|
3056
3104
|
}
|
|
3057
3105
|
function setCachedJsResult(rawSource, resolvedOptions, result) {
|
|
3058
|
-
if (
|
|
3106
|
+
if (rawSource.length === 0 || result.error || result.linked) {
|
|
3059
3107
|
return result;
|
|
3060
3108
|
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
cache = /* @__PURE__ */ new Map();
|
|
3064
|
-
resultCache.set(resolvedOptions, cache);
|
|
3065
|
-
}
|
|
3066
|
-
cache.set(rawSource, result);
|
|
3067
|
-
if (cache.size > RESULT_CACHE_LIMIT) {
|
|
3068
|
-
const firstKey = cache.keys().next().value;
|
|
3069
|
-
if (typeof firstKey === "string") {
|
|
3070
|
-
cache.delete(firstKey);
|
|
3071
|
-
}
|
|
3072
|
-
}
|
|
3109
|
+
const key = `${getOptionsFingerprint(resolvedOptions)}:${md5(rawSource)}`;
|
|
3110
|
+
resultCache.set(key, result);
|
|
3073
3111
|
return result;
|
|
3074
3112
|
}
|
|
3075
3113
|
function resolveOptions(classNameSet, overrideOptions) {
|
|
3076
3114
|
if (!hasDefinedOverrides(overrideOptions)) {
|
|
3077
3115
|
return resolveDefaultOptions(classNameSet);
|
|
3078
3116
|
}
|
|
3117
|
+
let entry = overrideOptionsCache.get(overrideOptions);
|
|
3118
|
+
if (!entry) {
|
|
3119
|
+
entry = { bySet: /* @__PURE__ */ new WeakMap() };
|
|
3120
|
+
overrideOptionsCache.set(overrideOptions, entry);
|
|
3121
|
+
}
|
|
3079
3122
|
if (!classNameSet) {
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
return cached2;
|
|
3123
|
+
if (entry.noSet) {
|
|
3124
|
+
return entry.noSet;
|
|
3083
3125
|
}
|
|
3084
3126
|
const created2 = defuOverrideArray(
|
|
3085
3127
|
{
|
|
@@ -3088,15 +3130,10 @@ function createJsHandler(options) {
|
|
|
3088
3130
|
},
|
|
3089
3131
|
defaults
|
|
3090
3132
|
);
|
|
3091
|
-
|
|
3133
|
+
entry.noSet = created2;
|
|
3092
3134
|
return created2;
|
|
3093
3135
|
}
|
|
3094
|
-
|
|
3095
|
-
if (!cache) {
|
|
3096
|
-
cache = /* @__PURE__ */ new WeakMap();
|
|
3097
|
-
resolvedOverrideOptionsByClassNameSet.set(overrideOptions, cache);
|
|
3098
|
-
}
|
|
3099
|
-
const cached = cache.get(classNameSet);
|
|
3136
|
+
const cached = entry.bySet.get(classNameSet);
|
|
3100
3137
|
if (cached) {
|
|
3101
3138
|
return cached;
|
|
3102
3139
|
}
|
|
@@ -3107,7 +3144,7 @@ function createJsHandler(options) {
|
|
|
3107
3144
|
},
|
|
3108
3145
|
defaults
|
|
3109
3146
|
);
|
|
3110
|
-
|
|
3147
|
+
entry.bySet.set(classNameSet, created);
|
|
3111
3148
|
return created;
|
|
3112
3149
|
}
|
|
3113
3150
|
function handler(rawSource, classNameSet, options2) {
|
|
@@ -3637,6 +3674,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
|
|
|
3637
3674
|
cssRemoveProperty,
|
|
3638
3675
|
cssRemoveHoverPseudoClass,
|
|
3639
3676
|
cssPresetEnv,
|
|
3677
|
+
autoprefixer,
|
|
3640
3678
|
uniAppX,
|
|
3641
3679
|
px2rpx,
|
|
3642
3680
|
unitsToPx,
|
|
@@ -3652,6 +3690,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
|
|
|
3652
3690
|
replaceRuntimePackages
|
|
3653
3691
|
} = ctx;
|
|
3654
3692
|
const uniAppXEnabled = isUniAppXEnabled(uniAppX);
|
|
3693
|
+
const resolvedUniAppXOptions = resolveUniAppXOptions(uniAppX);
|
|
3655
3694
|
const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
|
|
3656
3695
|
const styleHandler = createStyleHandler({
|
|
3657
3696
|
cssPreflight,
|
|
@@ -3665,10 +3704,13 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
|
|
|
3665
3704
|
cssRemoveProperty,
|
|
3666
3705
|
cssRemoveHoverPseudoClass,
|
|
3667
3706
|
cssPresetEnv,
|
|
3707
|
+
autoprefixer,
|
|
3668
3708
|
uniAppX: uniAppXEnabled,
|
|
3709
|
+
uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
|
|
3669
3710
|
cssCalc: cssCalcOptions,
|
|
3670
3711
|
px2rpx,
|
|
3671
|
-
unitsToPx
|
|
3712
|
+
unitsToPx,
|
|
3713
|
+
majorVersion: tailwindcssMajorVersion
|
|
3672
3714
|
});
|
|
3673
3715
|
const jsHandler2 = createJsHandler({
|
|
3674
3716
|
escapeMap,
|
|
@@ -3808,6 +3850,31 @@ function getCompilerContext(opts) {
|
|
|
3808
3850
|
return withCompilerContextCache(opts, () => createInternalCompilerContext(opts));
|
|
3809
3851
|
}
|
|
3810
3852
|
|
|
3853
|
+
// src/js/precheck.ts
|
|
3854
|
+
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
|
+
var DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
|
|
3856
|
+
function shouldSkipJsTransform(rawSource, options) {
|
|
3857
|
+
if (process.env.WEAPP_TW_DISABLE_JS_PRECHECK === "1") {
|
|
3858
|
+
return false;
|
|
3859
|
+
}
|
|
3860
|
+
if (!rawSource) {
|
|
3861
|
+
return true;
|
|
3862
|
+
}
|
|
3863
|
+
if (options?.alwaysEscape) {
|
|
3864
|
+
return false;
|
|
3865
|
+
}
|
|
3866
|
+
if (options?.moduleSpecifierReplacements && Object.keys(options.moduleSpecifierReplacements).length > 0) {
|
|
3867
|
+
return false;
|
|
3868
|
+
}
|
|
3869
|
+
if (options?.wrapExpression) {
|
|
3870
|
+
return false;
|
|
3871
|
+
}
|
|
3872
|
+
if (DEPENDENCY_HINT_RE.test(rawSource)) {
|
|
3873
|
+
return false;
|
|
3874
|
+
}
|
|
3875
|
+
return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3811
3878
|
// src/tailwindcss/recorder.ts
|
|
3812
3879
|
function setupPatchRecorder(patcher, baseDir, options) {
|
|
3813
3880
|
const recorder = createPatchTargetRecorder(baseDir, patcher, options);
|
|
@@ -3843,5 +3910,6 @@ export {
|
|
|
3843
3910
|
createAttributeMatcher,
|
|
3844
3911
|
generateCode,
|
|
3845
3912
|
getCompilerContext,
|
|
3913
|
+
shouldSkipJsTransform,
|
|
3846
3914
|
setupPatchRecorder
|
|
3847
3915
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkONLKZIRQjs = require('./chunk-ONLKZIRQ.js');
|
|
7
7
|
|
|
8
8
|
// src/tailwindcss/patcher-options.ts
|
|
9
9
|
function resolveTailwindcssOptions(options) {
|
|
@@ -532,7 +532,7 @@ function resolveModuleFromPaths(specifier, paths) {
|
|
|
532
532
|
return void 0;
|
|
533
533
|
}
|
|
534
534
|
try {
|
|
535
|
-
const req = _module.createRequire.call(void 0,
|
|
535
|
+
const req = _module.createRequire.call(void 0, _chunkONLKZIRQjs.importMetaUrl);
|
|
536
536
|
return req.resolve(specifier, { paths });
|
|
537
537
|
} catch (e4) {
|
|
538
538
|
return void 0;
|
|
@@ -587,11 +587,11 @@ function createDefaultResolvePaths(basedir) {
|
|
|
587
587
|
const cwd = _process2.default.cwd();
|
|
588
588
|
appendNodeModules(paths, cwd);
|
|
589
589
|
try {
|
|
590
|
-
const modulePath = _url.fileURLToPath.call(void 0,
|
|
590
|
+
const modulePath = _url.fileURLToPath.call(void 0, _chunkONLKZIRQjs.importMetaUrl);
|
|
591
591
|
const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
|
|
592
592
|
paths.add(candidate);
|
|
593
593
|
} catch (e5) {
|
|
594
|
-
paths.add(
|
|
594
|
+
paths.add(_chunkONLKZIRQjs.importMetaUrl);
|
|
595
595
|
}
|
|
596
596
|
if (paths.size === 0) {
|
|
597
597
|
fallbackCandidates = fallbackCandidates.filter(Boolean);
|
|
@@ -1195,12 +1195,14 @@ function resolveUniAppXOptions(option) {
|
|
|
1195
1195
|
if (typeof option === "object" && option) {
|
|
1196
1196
|
return {
|
|
1197
1197
|
enabled: option.enabled !== false,
|
|
1198
|
-
componentLocalStyles: resolveComponentLocalStyles(option)
|
|
1198
|
+
componentLocalStyles: resolveComponentLocalStyles(option),
|
|
1199
|
+
uvueUnsupported: _nullishCoalesce(option.uvueUnsupported, () => ( "warn"))
|
|
1199
1200
|
};
|
|
1200
1201
|
}
|
|
1201
1202
|
return {
|
|
1202
1203
|
enabled: Boolean(option),
|
|
1203
|
-
componentLocalStyles: resolveComponentLocalStyles(option)
|
|
1204
|
+
componentLocalStyles: resolveComponentLocalStyles(option),
|
|
1205
|
+
uvueUnsupported: "warn"
|
|
1204
1206
|
};
|
|
1205
1207
|
}
|
|
1206
1208
|
function isUniAppXEnabled(option) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.12.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.12.2__@swc+core@1.15.32_@swc+_5ed6cbcda668e45f9f2d3d9f21b34c59/node_modules/tsup/assets/cjs_shims.js
|
|
2
2
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
3
3
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
4
|
|