weapp-tailwindcss 5.0.0-next.13 → 5.0.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bundle-state-Bz8vLnCf.js → bundle-state-ClSg28Qk.js} +1 -1
- package/dist/{bundle-state-CP2XS3Uj.mjs → bundle-state-CrhkNTsw.mjs} +1 -1
- package/dist/bundlers/shared/generator-css/markers.d.ts +8 -0
- package/dist/bundlers/shared/generator-css.d.ts +1 -1
- package/dist/cli.js +33 -9
- package/dist/cli.mjs +33 -9
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults-B1igPF_e.mjs +150 -0
- package/dist/defaults-IHhYxNeU.js +193 -0
- package/dist/defaults.js +6 -150
- package/dist/defaults.mjs +1 -143
- package/dist/{generator-CRORPkpW.js → generator-CImaTibB.js} +1 -1
- package/dist/{generator-C9H44wEF.mjs → generator-DSMdL4vg.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-DN9KKjSi.js → incremental-runtime-class-set-CH1L--wj.js} +74 -31
- package/dist/{incremental-runtime-class-set-Dbn4yPfZ.mjs → incremental-runtime-class-set-P-3ZoWW5.mjs} +74 -31
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/{postcss-CtlrNknb.mjs → postcss-CgFCqilE.mjs} +2 -2
- package/dist/{postcss-Ab7YzAbs.js → postcss-k0BshZZQ.js} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-SG48aLG2.mjs → precheck-DMXLnfTN.mjs} +32 -12
- package/dist/{precheck-CRX-pMKJ.js → precheck-GcUdX1BX.js} +32 -12
- package/dist/presets.js +4 -4
- package/dist/presets.mjs +4 -4
- package/dist/{source-candidates-C4YgmZ8A.js → source-candidates-ES3ttZPe.js} +1 -1
- package/dist/{source-candidates-CyupdLKi.mjs → source-candidates-om5-wQJ0.mjs} +1 -1
- package/dist/{tailwindcss-DZ6jVYb4.js → tailwindcss-CkTBauKa.js} +2 -2
- package/dist/{tailwindcss-BbTVeQkG.mjs → tailwindcss-fe0rGj7T.mjs} +2 -2
- package/dist/types/index.d.ts +7 -1
- package/dist/types/user-defined-options/general.d.ts +2 -0
- package/dist/{v3-engine-D61eilBl.mjs → v3-engine-qoWtwjIj.mjs} +15 -0
- package/dist/{v3-engine-DwV1E6rX.js → v3-engine-v__n8_Sd.js} +15 -0
- package/dist/{vite-xKS6RvLR.js → vite-Bob_Mrva.js} +9 -9
- package/dist/{vite-Ti_qSctn.mjs → vite-cBjGYHFH.mjs} +9 -9
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/{webpack-wfNutjMm.js → webpack-BedfyGbF.js} +6 -6
- package/dist/{webpack-DvptFz7B.mjs → webpack-Cq45BZzs.mjs} +6 -6
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -4
- /package/dist/{constants-E_loJC49.mjs → constants-BG12WAKw.mjs} +0 -0
- /package/dist/{constants-BoB_6lFw.js → constants-BeeyfJ9k.js} +0 -0
- /package/dist/{logger-Bub1jggA.mjs → logger-CZUxvJJD.mjs} +0 -0
- /package/dist/{logger-BRy6XPQ2.js → logger-EVNB9z7i.js} +0 -0
- /package/dist/{utils-D0MZP_tr.js → utils-4ODFyoqD.js} +0 -0
- /package/dist/{utils-CycMvPn_.mjs → utils-CGBVVNm6.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_precheck = require("./precheck-GcUdX1BX.js");
|
|
3
3
|
let node_module = require("node:module");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -8,7 +8,15 @@ export declare const TAILWIND_BANNER_GLOBAL_RE: RegExp;
|
|
|
8
8
|
export declare const VITE_MARKER_RE: RegExp;
|
|
9
9
|
export declare function createCssAppend(base: string, extra: string): string;
|
|
10
10
|
export declare function splitTailwindV4GeneratedCss(rawSource: string, rawTailwindCss: string): string | undefined;
|
|
11
|
+
export declare function splitTailwindV4GeneratedCssBySourceOrder(rawSource: string, rawTailwindCss: string): {
|
|
12
|
+
before: string;
|
|
13
|
+
after: string;
|
|
14
|
+
} | undefined;
|
|
11
15
|
export declare function removeTailwindGeneratedCssByBanner(rawSource: string): string | undefined;
|
|
16
|
+
export declare function splitTailwindGeneratedCssByBanner(rawSource: string, start?: number): {
|
|
17
|
+
before: string;
|
|
18
|
+
after: string;
|
|
19
|
+
} | undefined;
|
|
12
20
|
export declare function stripTailwindBanner(css: string): string;
|
|
13
21
|
export declare function stripTailwindBanners(css: string): string;
|
|
14
22
|
export declare function stripGeneratorPlaceholderMarkers(css: string): string;
|
|
@@ -4,7 +4,7 @@ import type { InternalUserDefinedOptions } from '../../types';
|
|
|
4
4
|
export { hasTailwindSourceDirectives, normalizeTailwindSourceForGenerator, removeTailwindSourceDirectives, resolveCssEntrySource, } from './generator-css/directives';
|
|
5
5
|
export { removeTailwindApplyRules, } from './generator-css/legacy-compat';
|
|
6
6
|
export { inheritLegacyUnitConvertedDeclarations, } from './generator-css/legacy-units';
|
|
7
|
-
export { createCssAppend, hasTailwindGeneratedCss, hasTailwindGeneratedCssMarkers, removeTailwindGeneratedCssByBanner, splitTailwindV4GeneratedCss, stripGeneratorPlaceholderMarkers, stripTailwindBanner, stripTailwindBanners, } from './generator-css/markers';
|
|
7
|
+
export { createCssAppend, hasTailwindGeneratedCss, hasTailwindGeneratedCssMarkers, removeTailwindGeneratedCssByBanner, splitTailwindGeneratedCssByBanner, splitTailwindV4GeneratedCss, splitTailwindV4GeneratedCssBySourceOrder, stripGeneratorPlaceholderMarkers, stripTailwindBanner, stripTailwindBanners, } from './generator-css/markers';
|
|
8
8
|
export { resolveGeneratorSource, } from './generator-css/source-resolver';
|
|
9
9
|
export interface GenerateCssByGeneratorOptions {
|
|
10
10
|
opts: InternalUserDefinedOptions;
|
package/dist/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ node_path = __toESM(node_path);
|
|
|
30
30
|
let node_fs_promises = require("node:fs/promises");
|
|
31
31
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
32
32
|
let lru_cache = require("lru-cache");
|
|
33
|
-
require("@weapp-tailwindcss/shared/node");
|
|
33
|
+
let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
|
|
34
34
|
let _weapp_core_escape = require("@weapp-core/escape");
|
|
35
35
|
require("@weapp-tailwindcss/shared");
|
|
36
36
|
let debug = require("debug");
|
|
@@ -53,6 +53,10 @@ let _ast_core_escape = require("@ast-core/escape");
|
|
|
53
53
|
let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
|
|
54
54
|
require("@babel/types");
|
|
55
55
|
require("htmlparser2");
|
|
56
|
+
//#region src/js/babel/cache-options.ts
|
|
57
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
58
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
59
|
+
//#endregion
|
|
56
60
|
//#region src/debug/index.ts
|
|
57
61
|
const _debug = (0, debug.default)("weapp-tw");
|
|
58
62
|
function createDebug(prefix) {
|
|
@@ -597,20 +601,40 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
597
601
|
}
|
|
598
602
|
//#endregion
|
|
599
603
|
//#region src/js/babel/parse.ts
|
|
600
|
-
const parseCache = new lru_cache.LRUCache({ max:
|
|
604
|
+
const parseCache = new lru_cache.LRUCache({ max: HARD_PARSE_CACHE_MAX_ENTRIES });
|
|
601
605
|
function genCacheKey(source, options) {
|
|
602
|
-
if (typeof options === "string") return source
|
|
603
|
-
return source
|
|
606
|
+
if (typeof options === "string") return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${options}`;
|
|
607
|
+
return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val)}`;
|
|
608
|
+
}
|
|
609
|
+
function normalizeCacheMaxEntries(value) {
|
|
610
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 128;
|
|
611
|
+
return Math.min(Math.max(Math.floor(value), 0), HARD_PARSE_CACHE_MAX_ENTRIES);
|
|
612
|
+
}
|
|
613
|
+
function normalizeCacheMaxSourceLength(value) {
|
|
614
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
|
|
615
|
+
return Math.max(Math.floor(value), 0);
|
|
616
|
+
}
|
|
617
|
+
function trimParseCache(maxEntries) {
|
|
618
|
+
while (parseCache.size > maxEntries) parseCache.pop();
|
|
604
619
|
}
|
|
605
620
|
function babelParse(code, opts = {}) {
|
|
606
|
-
const { cache, cacheKey, ...rest } = opts;
|
|
607
|
-
const
|
|
621
|
+
const { cache, cacheKey, cacheMaxEntries, cacheMaxSourceLength, ...rest } = opts;
|
|
622
|
+
const maxEntries = normalizeCacheMaxEntries(cacheMaxEntries);
|
|
623
|
+
const maxSourceLength = normalizeCacheMaxSourceLength(cacheMaxSourceLength);
|
|
624
|
+
const shouldCache = cache === true && maxEntries > 0 && code.length <= maxSourceLength;
|
|
625
|
+
const cacheKeyString = shouldCache ? genCacheKey(code, cacheKey ?? rest) : void 0;
|
|
608
626
|
let result;
|
|
609
|
-
if (
|
|
627
|
+
if (shouldCache) {
|
|
628
|
+
trimParseCache(maxEntries);
|
|
629
|
+
result = parseCache.get(cacheKeyString);
|
|
630
|
+
}
|
|
610
631
|
if (!result) {
|
|
611
|
-
const { cache: _cache, cacheKey: _cacheKey, ...parseOptions } = opts;
|
|
632
|
+
const { cache: _cache, cacheKey: _cacheKey, cacheMaxEntries: _cacheMaxEntries, cacheMaxSourceLength: _cacheMaxSourceLength, ...parseOptions } = opts;
|
|
612
633
|
result = (0, _babel_parser.parse)(code, parseOptions);
|
|
613
|
-
if (
|
|
634
|
+
if (shouldCache) {
|
|
635
|
+
parseCache.set(cacheKeyString, result);
|
|
636
|
+
trimParseCache(maxEntries);
|
|
637
|
+
}
|
|
614
638
|
}
|
|
615
639
|
return result;
|
|
616
640
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import path from "node:path";
|
|
|
6
6
|
import { access, mkdir, writeFile } from "node:fs/promises";
|
|
7
7
|
import { logger } from "@weapp-tailwindcss/logger";
|
|
8
8
|
import { LRUCache } from "lru-cache";
|
|
9
|
-
import "@weapp-tailwindcss/shared/node";
|
|
9
|
+
import { md5 as md5Hash } from "@weapp-tailwindcss/shared/node";
|
|
10
10
|
import { MappingChars2String, escape } from "@weapp-core/escape";
|
|
11
11
|
import "@weapp-tailwindcss/shared";
|
|
12
12
|
import _createDebug from "debug";
|
|
@@ -24,6 +24,10 @@ import { jsStringEscape } from "@ast-core/escape";
|
|
|
24
24
|
import { splitCode } from "@weapp-tailwindcss/shared/extractors";
|
|
25
25
|
import "@babel/types";
|
|
26
26
|
import "htmlparser2";
|
|
27
|
+
//#region src/js/babel/cache-options.ts
|
|
28
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
29
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
30
|
+
//#endregion
|
|
27
31
|
//#region src/debug/index.ts
|
|
28
32
|
const _debug = _createDebug("weapp-tw");
|
|
29
33
|
function createDebug(prefix) {
|
|
@@ -568,20 +572,40 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
568
572
|
}
|
|
569
573
|
//#endregion
|
|
570
574
|
//#region src/js/babel/parse.ts
|
|
571
|
-
const parseCache = new LRUCache({ max:
|
|
575
|
+
const parseCache = new LRUCache({ max: HARD_PARSE_CACHE_MAX_ENTRIES });
|
|
572
576
|
function genCacheKey(source, options) {
|
|
573
|
-
if (typeof options === "string") return source
|
|
574
|
-
return source
|
|
577
|
+
if (typeof options === "string") return `${md5Hash(source)}:${options}`;
|
|
578
|
+
return `${md5Hash(source)}:${JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val)}`;
|
|
579
|
+
}
|
|
580
|
+
function normalizeCacheMaxEntries(value) {
|
|
581
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 128;
|
|
582
|
+
return Math.min(Math.max(Math.floor(value), 0), HARD_PARSE_CACHE_MAX_ENTRIES);
|
|
583
|
+
}
|
|
584
|
+
function normalizeCacheMaxSourceLength(value) {
|
|
585
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
|
|
586
|
+
return Math.max(Math.floor(value), 0);
|
|
587
|
+
}
|
|
588
|
+
function trimParseCache(maxEntries) {
|
|
589
|
+
while (parseCache.size > maxEntries) parseCache.pop();
|
|
575
590
|
}
|
|
576
591
|
function babelParse(code, opts = {}) {
|
|
577
|
-
const { cache, cacheKey, ...rest } = opts;
|
|
578
|
-
const
|
|
592
|
+
const { cache, cacheKey, cacheMaxEntries, cacheMaxSourceLength, ...rest } = opts;
|
|
593
|
+
const maxEntries = normalizeCacheMaxEntries(cacheMaxEntries);
|
|
594
|
+
const maxSourceLength = normalizeCacheMaxSourceLength(cacheMaxSourceLength);
|
|
595
|
+
const shouldCache = cache === true && maxEntries > 0 && code.length <= maxSourceLength;
|
|
596
|
+
const cacheKeyString = shouldCache ? genCacheKey(code, cacheKey ?? rest) : void 0;
|
|
579
597
|
let result;
|
|
580
|
-
if (
|
|
598
|
+
if (shouldCache) {
|
|
599
|
+
trimParseCache(maxEntries);
|
|
600
|
+
result = parseCache.get(cacheKeyString);
|
|
601
|
+
}
|
|
581
602
|
if (!result) {
|
|
582
|
-
const { cache: _cache, cacheKey: _cacheKey, ...parseOptions } = opts;
|
|
603
|
+
const { cache: _cache, cacheKey: _cacheKey, cacheMaxEntries: _cacheMaxEntries, cacheMaxSourceLength: _cacheMaxSourceLength, ...parseOptions } = opts;
|
|
583
604
|
result = parse(code, parseOptions);
|
|
584
|
-
if (
|
|
605
|
+
if (shouldCache) {
|
|
606
|
+
parseCache.set(cacheKeyString, result);
|
|
607
|
+
trimParseCache(maxEntries);
|
|
608
|
+
}
|
|
585
609
|
}
|
|
586
610
|
return result;
|
|
587
611
|
}
|
package/dist/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_precheck = require("./precheck-
|
|
3
|
+
const require_precheck = require("./precheck-GcUdX1BX.js");
|
|
4
4
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
5
5
|
//#region src/core.ts
|
|
6
6
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-
|
|
1
|
+
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-DMXLnfTN.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,4 +1,4 @@
|
|
|
1
|
-
import { a as matchCustomPropertyFromValue, i as ifndef, r as ifdef } from "../constants-
|
|
1
|
+
import { a as matchCustomPropertyFromValue, i as ifndef, r as ifdef } from "../constants-BG12WAKw.mjs";
|
|
2
2
|
//#region src/css-macro/postcss.ts
|
|
3
3
|
const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
|
|
4
4
|
const creator = () => {
|
package/dist/css-macro.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
require("./utils-
|
|
3
|
-
const require_constants = require("./constants-
|
|
2
|
+
require("./utils-4ODFyoqD.js");
|
|
3
|
+
const require_constants = require("./constants-BeeyfJ9k.js");
|
|
4
4
|
let tailwindcss_plugin = require("tailwindcss/plugin");
|
|
5
5
|
tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
|
|
6
6
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
package/dist/css-macro.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as defu } from "./utils-
|
|
2
|
-
import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-
|
|
1
|
+
import { t as defu } from "./utils-CGBVVNm6.mjs";
|
|
2
|
+
import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-BG12WAKw.mjs";
|
|
3
3
|
import plugin from "tailwindcss/plugin";
|
|
4
4
|
//#region src/css-macro/index.ts
|
|
5
5
|
const defaultOptions = {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { a as noop } from "./utils-CGBVVNm6.mjs";
|
|
2
|
+
import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
|
|
3
|
+
//#region src/js/babel/cache-options.ts
|
|
4
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
5
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/defaults.ts
|
|
8
|
+
const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
9
|
+
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
10
|
+
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
11
|
+
const BACKSLASH_RE = /\\/g;
|
|
12
|
+
function normalizePath(p) {
|
|
13
|
+
return p.replace(BACKSLASH_RE, "/");
|
|
14
|
+
}
|
|
15
|
+
const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
|
|
16
|
+
const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
|
|
17
|
+
const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
|
|
18
|
+
const MAIN_CSS_CHUNK_MATCHERS = {
|
|
19
|
+
"uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
|
|
20
|
+
"uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
21
|
+
"uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
22
|
+
"mpx": (file) => {
|
|
23
|
+
const normalized = normalizePath(file);
|
|
24
|
+
if (normalized.startsWith("app")) return true;
|
|
25
|
+
return MPX_STYLES_DIR_PATTERN.test(normalized);
|
|
26
|
+
},
|
|
27
|
+
"taro": (file) => file.startsWith("app"),
|
|
28
|
+
"remax": (file) => file.startsWith("app"),
|
|
29
|
+
"rax": (file) => file.startsWith("bundle"),
|
|
30
|
+
"native": (file) => file.startsWith("app"),
|
|
31
|
+
"weapp-vite": (file) => file.startsWith("app"),
|
|
32
|
+
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
33
|
+
};
|
|
34
|
+
const alwaysFalse = () => false;
|
|
35
|
+
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
36
|
+
"box-sizing": "border-box",
|
|
37
|
+
"border-width": "0",
|
|
38
|
+
"border-style": "solid",
|
|
39
|
+
"border-color": "currentColor"
|
|
40
|
+
};
|
|
41
|
+
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
42
|
+
"box-sizing": "border-box",
|
|
43
|
+
"margin": "0",
|
|
44
|
+
"padding": "0",
|
|
45
|
+
"border": "0 solid"
|
|
46
|
+
};
|
|
47
|
+
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
48
|
+
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
49
|
+
}
|
|
50
|
+
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
51
|
+
if (cssPreflight === false) return false;
|
|
52
|
+
return {
|
|
53
|
+
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
54
|
+
...cssPreflight ?? {}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function createMainCssChunkMatcher() {
|
|
58
|
+
return (file, appType) => {
|
|
59
|
+
if (!appType) {
|
|
60
|
+
const normalized = normalizePath(file);
|
|
61
|
+
return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
|
|
62
|
+
}
|
|
63
|
+
const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
|
|
64
|
+
return matcher ? matcher(file) : true;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function getDefaultOptions() {
|
|
68
|
+
return {
|
|
69
|
+
/**
|
|
70
|
+
* wxss 微信小程序
|
|
71
|
+
* acss 支付宝小程序
|
|
72
|
+
* jxss 京东小程序
|
|
73
|
+
* ttss 头条小程序
|
|
74
|
+
* qss QQ小程序
|
|
75
|
+
* css 最正常的样式文件
|
|
76
|
+
* tyss 涂鸦小程序
|
|
77
|
+
*/
|
|
78
|
+
cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
|
|
79
|
+
/**
|
|
80
|
+
* wxml 微信小程序
|
|
81
|
+
* axml 支付宝小程序
|
|
82
|
+
* jxml 京东小程序
|
|
83
|
+
* ksml 快手小程序
|
|
84
|
+
* ttml 头条小程序
|
|
85
|
+
* qml QQ小程序
|
|
86
|
+
* tyml 涂鸦小程序
|
|
87
|
+
* xhsml 小红书小程序
|
|
88
|
+
* swan 百度小程序
|
|
89
|
+
*/
|
|
90
|
+
htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
|
|
91
|
+
jsMatcher: (file) => {
|
|
92
|
+
if (file.includes("node_modules")) return false;
|
|
93
|
+
return JS_FILE_PATTERN.test(file);
|
|
94
|
+
},
|
|
95
|
+
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
96
|
+
wxsMatcher: alwaysFalse,
|
|
97
|
+
cssPreflight: getDefaultCssPreflight(3),
|
|
98
|
+
disabled: false,
|
|
99
|
+
onLoad: noop,
|
|
100
|
+
onStart: noop,
|
|
101
|
+
onEnd: noop,
|
|
102
|
+
onUpdate: noop,
|
|
103
|
+
customAttributes: {},
|
|
104
|
+
customReplaceDictionary: MappingChars2String,
|
|
105
|
+
appType: void 0,
|
|
106
|
+
arbitraryValues: {
|
|
107
|
+
allowDoubleQuotes: false,
|
|
108
|
+
bareArbitraryValues: false
|
|
109
|
+
},
|
|
110
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
111
|
+
inlineWxs: false,
|
|
112
|
+
injectAdditionalCssVarScope: false,
|
|
113
|
+
jsPreserveClass: (keyword) => {
|
|
114
|
+
/**
|
|
115
|
+
* 默认保留 keyword
|
|
116
|
+
*/
|
|
117
|
+
if (keyword === "*") return true;
|
|
118
|
+
return false;
|
|
119
|
+
},
|
|
120
|
+
disabledDefaultTemplateHandler: false,
|
|
121
|
+
cssSelectorReplacement: {
|
|
122
|
+
root: [
|
|
123
|
+
"page",
|
|
124
|
+
".tw-root",
|
|
125
|
+
"wx-root-portal-content"
|
|
126
|
+
],
|
|
127
|
+
universal: ["view", "text"]
|
|
128
|
+
},
|
|
129
|
+
babelParserOptions: {
|
|
130
|
+
sourceType: "unambiguous",
|
|
131
|
+
cache: true,
|
|
132
|
+
cacheKey: "st:unambiguous",
|
|
133
|
+
cacheMaxEntries: 128,
|
|
134
|
+
cacheMaxSourceLength: DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH
|
|
135
|
+
},
|
|
136
|
+
postcssOptions: {},
|
|
137
|
+
cssRemoveProperty: true,
|
|
138
|
+
cssRemoveHoverPseudoClass: true,
|
|
139
|
+
ignoreCallExpressionIdentifiers: [],
|
|
140
|
+
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
141
|
+
replaceRuntimePackages: false,
|
|
142
|
+
generator: { target: "weapp" },
|
|
143
|
+
tailwindcssPatcherOptions: { filter(className) {
|
|
144
|
+
return !isAllowedClassName(className);
|
|
145
|
+
} },
|
|
146
|
+
logLevel: "info"
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { resolveDefaultCssPreflight as a, getDefaultOptions as i, TAILWIND_V4_CSS_PREFLIGHT as n, DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH as o, getDefaultCssPreflight as r, HARD_PARSE_CACHE_MAX_ENTRIES as s, TAILWIND_V3_CSS_PREFLIGHT as t };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
require("./chunk-8l464Juk.js");
|
|
2
|
+
require("./utils-4ODFyoqD.js");
|
|
3
|
+
let _weapp_core_escape = require("@weapp-core/escape");
|
|
4
|
+
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
5
|
+
//#region src/js/babel/cache-options.ts
|
|
6
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
7
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/defaults.ts
|
|
10
|
+
const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
11
|
+
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
12
|
+
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
13
|
+
const BACKSLASH_RE = /\\/g;
|
|
14
|
+
function normalizePath(p) {
|
|
15
|
+
return p.replace(BACKSLASH_RE, "/");
|
|
16
|
+
}
|
|
17
|
+
const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
|
|
18
|
+
const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
|
|
19
|
+
const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
|
|
20
|
+
const MAIN_CSS_CHUNK_MATCHERS = {
|
|
21
|
+
"uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
|
|
22
|
+
"uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
23
|
+
"uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
24
|
+
"mpx": (file) => {
|
|
25
|
+
const normalized = normalizePath(file);
|
|
26
|
+
if (normalized.startsWith("app")) return true;
|
|
27
|
+
return MPX_STYLES_DIR_PATTERN.test(normalized);
|
|
28
|
+
},
|
|
29
|
+
"taro": (file) => file.startsWith("app"),
|
|
30
|
+
"remax": (file) => file.startsWith("app"),
|
|
31
|
+
"rax": (file) => file.startsWith("bundle"),
|
|
32
|
+
"native": (file) => file.startsWith("app"),
|
|
33
|
+
"weapp-vite": (file) => file.startsWith("app"),
|
|
34
|
+
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
35
|
+
};
|
|
36
|
+
const alwaysFalse = () => false;
|
|
37
|
+
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
38
|
+
"box-sizing": "border-box",
|
|
39
|
+
"border-width": "0",
|
|
40
|
+
"border-style": "solid",
|
|
41
|
+
"border-color": "currentColor"
|
|
42
|
+
};
|
|
43
|
+
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
44
|
+
"box-sizing": "border-box",
|
|
45
|
+
"margin": "0",
|
|
46
|
+
"padding": "0",
|
|
47
|
+
"border": "0 solid"
|
|
48
|
+
};
|
|
49
|
+
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
50
|
+
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
51
|
+
}
|
|
52
|
+
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
53
|
+
if (cssPreflight === false) return false;
|
|
54
|
+
return {
|
|
55
|
+
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
56
|
+
...cssPreflight ?? {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function createMainCssChunkMatcher() {
|
|
60
|
+
return (file, appType) => {
|
|
61
|
+
if (!appType) {
|
|
62
|
+
const normalized = normalizePath(file);
|
|
63
|
+
return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
|
|
64
|
+
}
|
|
65
|
+
const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
|
|
66
|
+
return matcher ? matcher(file) : true;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function getDefaultOptions() {
|
|
70
|
+
return {
|
|
71
|
+
/**
|
|
72
|
+
* wxss 微信小程序
|
|
73
|
+
* acss 支付宝小程序
|
|
74
|
+
* jxss 京东小程序
|
|
75
|
+
* ttss 头条小程序
|
|
76
|
+
* qss QQ小程序
|
|
77
|
+
* css 最正常的样式文件
|
|
78
|
+
* tyss 涂鸦小程序
|
|
79
|
+
*/
|
|
80
|
+
cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
|
|
81
|
+
/**
|
|
82
|
+
* wxml 微信小程序
|
|
83
|
+
* axml 支付宝小程序
|
|
84
|
+
* jxml 京东小程序
|
|
85
|
+
* ksml 快手小程序
|
|
86
|
+
* ttml 头条小程序
|
|
87
|
+
* qml QQ小程序
|
|
88
|
+
* tyml 涂鸦小程序
|
|
89
|
+
* xhsml 小红书小程序
|
|
90
|
+
* swan 百度小程序
|
|
91
|
+
*/
|
|
92
|
+
htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
|
|
93
|
+
jsMatcher: (file) => {
|
|
94
|
+
if (file.includes("node_modules")) return false;
|
|
95
|
+
return JS_FILE_PATTERN.test(file);
|
|
96
|
+
},
|
|
97
|
+
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
98
|
+
wxsMatcher: alwaysFalse,
|
|
99
|
+
cssPreflight: getDefaultCssPreflight(3),
|
|
100
|
+
disabled: false,
|
|
101
|
+
onLoad: _weapp_tailwindcss_shared.noop,
|
|
102
|
+
onStart: _weapp_tailwindcss_shared.noop,
|
|
103
|
+
onEnd: _weapp_tailwindcss_shared.noop,
|
|
104
|
+
onUpdate: _weapp_tailwindcss_shared.noop,
|
|
105
|
+
customAttributes: {},
|
|
106
|
+
customReplaceDictionary: _weapp_core_escape.MappingChars2String,
|
|
107
|
+
appType: void 0,
|
|
108
|
+
arbitraryValues: {
|
|
109
|
+
allowDoubleQuotes: false,
|
|
110
|
+
bareArbitraryValues: false
|
|
111
|
+
},
|
|
112
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
113
|
+
inlineWxs: false,
|
|
114
|
+
injectAdditionalCssVarScope: false,
|
|
115
|
+
jsPreserveClass: (keyword) => {
|
|
116
|
+
/**
|
|
117
|
+
* 默认保留 keyword
|
|
118
|
+
*/
|
|
119
|
+
if (keyword === "*") return true;
|
|
120
|
+
return false;
|
|
121
|
+
},
|
|
122
|
+
disabledDefaultTemplateHandler: false,
|
|
123
|
+
cssSelectorReplacement: {
|
|
124
|
+
root: [
|
|
125
|
+
"page",
|
|
126
|
+
".tw-root",
|
|
127
|
+
"wx-root-portal-content"
|
|
128
|
+
],
|
|
129
|
+
universal: ["view", "text"]
|
|
130
|
+
},
|
|
131
|
+
babelParserOptions: {
|
|
132
|
+
sourceType: "unambiguous",
|
|
133
|
+
cache: true,
|
|
134
|
+
cacheKey: "st:unambiguous",
|
|
135
|
+
cacheMaxEntries: 128,
|
|
136
|
+
cacheMaxSourceLength: DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH
|
|
137
|
+
},
|
|
138
|
+
postcssOptions: {},
|
|
139
|
+
cssRemoveProperty: true,
|
|
140
|
+
cssRemoveHoverPseudoClass: true,
|
|
141
|
+
ignoreCallExpressionIdentifiers: [],
|
|
142
|
+
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
143
|
+
replaceRuntimePackages: false,
|
|
144
|
+
generator: { target: "weapp" },
|
|
145
|
+
tailwindcssPatcherOptions: { filter(className) {
|
|
146
|
+
return !(0, _weapp_core_escape.isAllowedClassName)(className);
|
|
147
|
+
} },
|
|
148
|
+
logLevel: "info"
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
Object.defineProperty(exports, "DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function() {
|
|
155
|
+
return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, "HARD_PARSE_CACHE_MAX_ENTRIES", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: function() {
|
|
161
|
+
return HARD_PARSE_CACHE_MAX_ENTRIES;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
Object.defineProperty(exports, "TAILWIND_V3_CSS_PREFLIGHT", {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function() {
|
|
167
|
+
return TAILWIND_V3_CSS_PREFLIGHT;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "TAILWIND_V4_CSS_PREFLIGHT", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function() {
|
|
173
|
+
return TAILWIND_V4_CSS_PREFLIGHT;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
Object.defineProperty(exports, "getDefaultCssPreflight", {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function() {
|
|
179
|
+
return getDefaultCssPreflight;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, "getDefaultOptions", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function() {
|
|
185
|
+
return getDefaultOptions;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
Object.defineProperty(exports, "resolveDefaultCssPreflight", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function() {
|
|
191
|
+
return resolveDefaultCssPreflight;
|
|
192
|
+
}
|
|
193
|
+
});
|