weapp-tailwindcss 5.0.0-next.36 → 5.0.0-next.38
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-Bsr05EFW.mjs → bundle-state-CnaJxkFY.mjs} +1 -1
- package/dist/{bundle-state-8w8DM8Lw.js → bundle-state-DgGEhk_z.js} +1 -1
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/source-candidates.d.ts +5 -1
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/generator/options.d.ts +3 -0
- package/dist/{generator-BtpQoQEH.js → generator--0-ekuVO.js} +5 -3
- package/dist/{generator-CmLpVJgw.mjs → generator-B76ovqsv.mjs} +5 -3
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +6 -6
- package/dist/{incremental-runtime-class-set-vqTU-eph.js → incremental-runtime-class-set-CN6K_97P.js} +25 -20
- package/dist/{incremental-runtime-class-set-W61zZU00.mjs → incremental-runtime-class-set-x10M9bn_.mjs} +25 -20
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-DGprmeke.mjs → postcss-CR9UCaIK.mjs} +3 -3
- package/dist/{postcss-DSvNrY0J.js → postcss-hYimKoN_.js} +3 -3
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-nPDKYr8V.mjs → precheck-BrNwLG2e.mjs} +3 -3
- package/dist/{precheck-Bp-V1T_Q.js → precheck-DPtJjZmV.js} +3 -3
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{source-candidates-l12JBkKU.mjs → source-candidates-DN1mihlU.mjs} +11 -11
- package/dist/{source-candidates-BjB4wSga.js → source-candidates-DSxme_O2.js} +11 -11
- package/dist/tailwindcss/v3-engine/types.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +1 -0
- package/dist/{tailwindcss-D6zEhnyE.mjs → tailwindcss-DWtPieNE.mjs} +1 -1
- package/dist/{tailwindcss-bNXguXhC.js → tailwindcss-glCm_d3H.js} +1 -1
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
- package/dist/{v3-engine-KDOfD-6F.js → v3-engine-D3BMLVAN.js} +78 -15
- package/dist/{v3-engine-BYcGCWUY.mjs → v3-engine-DCxNPBVs.mjs} +78 -15
- package/dist/{vite-C8SUICPv.mjs → vite-DOprpdH-.mjs} +11 -11
- package/dist/{vite-CMzi0wR2.js → vite-Ec0uX6kF.js} +11 -11
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +87 -18
- package/dist/{webpack-2v1sQKyZ.js → webpack-Ccohlg3A.js} +48 -17
- package/dist/{webpack-BiTMfrBW.mjs → webpack-DFlZcqAU.mjs} +47 -17
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-
|
|
2
|
-
import path from "node:path";
|
|
1
|
+
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-DCxNPBVs.mjs";
|
|
3
2
|
import { extractSourceCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
|
|
3
|
+
import path from "node:path";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
//#region src/bundlers/vite/source-candidates.ts
|
|
6
6
|
const CLEAN_URL_RE = /[?#].*$/;
|
|
@@ -105,8 +105,8 @@ function resolveSourceCandidateExtension(id) {
|
|
|
105
105
|
const normalized = cleanUrl(id);
|
|
106
106
|
return /\.([^.\\/]+)$/.exec(normalized)?.[1] ?? "html";
|
|
107
107
|
}
|
|
108
|
-
function createSourceCandidateContentCacheKey(extension, source) {
|
|
109
|
-
return `${extension}\0${source}`;
|
|
108
|
+
function createSourceCandidateContentCacheKey(extension, source, bareArbitraryValues) {
|
|
109
|
+
return `${extension}\0${JSON.stringify(bareArbitraryValues ?? false)}\0${source}`;
|
|
110
110
|
}
|
|
111
111
|
function isSourceCandidateRequest(id) {
|
|
112
112
|
return FULL_SOURCE_SCAN_EXTENSION_RE.test(cleanUrl(id));
|
|
@@ -125,7 +125,7 @@ function removeCandidateSet(candidateCount, candidates) {
|
|
|
125
125
|
function addCandidateSet(candidateCount, candidates) {
|
|
126
126
|
for (const candidate of candidates) candidateCount.set(candidate, (candidateCount.get(candidate) ?? 0) + 1);
|
|
127
127
|
}
|
|
128
|
-
function createSourceCandidateCollector() {
|
|
128
|
+
function createSourceCandidateCollector(options = {}) {
|
|
129
129
|
const candidatesById = /* @__PURE__ */ new Map();
|
|
130
130
|
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
131
131
|
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
@@ -136,34 +136,34 @@ function createSourceCandidateCollector() {
|
|
|
136
136
|
async function sync(id, source) {
|
|
137
137
|
const normalizedId = cleanUrl(id);
|
|
138
138
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
139
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
139
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues);
|
|
140
140
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
141
141
|
if (cachedCandidates) {
|
|
142
142
|
replaceScanLayer(normalizedId, new Set(cachedCandidates));
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
const nextCandidates = new Set(await extractSourceCandidates(source, extension));
|
|
145
|
+
const nextCandidates = new Set(await extractSourceCandidates(source, extension, { bareArbitraryValues: options.bareArbitraryValues }));
|
|
146
146
|
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
147
147
|
replaceScanLayer(normalizedId, nextCandidates);
|
|
148
148
|
}
|
|
149
149
|
async function syncCss(id, source) {
|
|
150
150
|
const normalizedId = cleanUrl(id);
|
|
151
|
-
const contentCacheKey = createSourceCandidateContentCacheKey("css", source);
|
|
151
|
+
const contentCacheKey = createSourceCandidateContentCacheKey("css", source, options.bareArbitraryValues);
|
|
152
152
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
153
153
|
if (cachedCandidates) {
|
|
154
154
|
replaceCssLayer(normalizedId, new Set(cachedCandidates));
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
const nextCandidates = new Set(await extractSourceCandidates(source, "css"));
|
|
157
|
+
const nextCandidates = new Set(await extractSourceCandidates(source, "css", { bareArbitraryValues: options.bareArbitraryValues }));
|
|
158
158
|
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
159
159
|
replaceCssLayer(normalizedId, nextCandidates);
|
|
160
160
|
}
|
|
161
161
|
async function merge(id, source) {
|
|
162
162
|
const normalizedId = cleanUrl(id);
|
|
163
163
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
164
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
164
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues);
|
|
165
165
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
166
|
-
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : new Set(await extractSourceCandidates(source, extension));
|
|
166
|
+
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : new Set(await extractSourceCandidates(source, extension, { bareArbitraryValues: options.bareArbitraryValues }));
|
|
167
167
|
if (!cachedCandidates) sourceCandidateContentCache.set(contentCacheKey, [...extractedCandidates]);
|
|
168
168
|
replaceTransformLayer(normalizedId, extractedCandidates);
|
|
169
169
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-D3BMLVAN.js");
|
|
3
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
3
4
|
let node_path = require("node:path");
|
|
4
5
|
node_path = require_chunk.__toESM(node_path);
|
|
5
|
-
let tailwindcss_patch = require("tailwindcss-patch");
|
|
6
6
|
let node_fs_promises = require("node:fs/promises");
|
|
7
7
|
//#region src/bundlers/vite/source-candidates.ts
|
|
8
8
|
const CLEAN_URL_RE = /[?#].*$/;
|
|
@@ -107,8 +107,8 @@ function resolveSourceCandidateExtension(id) {
|
|
|
107
107
|
const normalized = cleanUrl(id);
|
|
108
108
|
return /\.([^.\\/]+)$/.exec(normalized)?.[1] ?? "html";
|
|
109
109
|
}
|
|
110
|
-
function createSourceCandidateContentCacheKey(extension, source) {
|
|
111
|
-
return `${extension}\0${source}`;
|
|
110
|
+
function createSourceCandidateContentCacheKey(extension, source, bareArbitraryValues) {
|
|
111
|
+
return `${extension}\0${JSON.stringify(bareArbitraryValues ?? false)}\0${source}`;
|
|
112
112
|
}
|
|
113
113
|
function isSourceCandidateRequest(id) {
|
|
114
114
|
return require_v3_engine.FULL_SOURCE_SCAN_EXTENSION_RE.test(cleanUrl(id));
|
|
@@ -127,7 +127,7 @@ function removeCandidateSet(candidateCount, candidates) {
|
|
|
127
127
|
function addCandidateSet(candidateCount, candidates) {
|
|
128
128
|
for (const candidate of candidates) candidateCount.set(candidate, (candidateCount.get(candidate) ?? 0) + 1);
|
|
129
129
|
}
|
|
130
|
-
function createSourceCandidateCollector() {
|
|
130
|
+
function createSourceCandidateCollector(options = {}) {
|
|
131
131
|
const candidatesById = /* @__PURE__ */ new Map();
|
|
132
132
|
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
133
133
|
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
@@ -138,34 +138,34 @@ function createSourceCandidateCollector() {
|
|
|
138
138
|
async function sync(id, source) {
|
|
139
139
|
const normalizedId = cleanUrl(id);
|
|
140
140
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
141
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
141
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues);
|
|
142
142
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
143
143
|
if (cachedCandidates) {
|
|
144
144
|
replaceScanLayer(normalizedId, new Set(cachedCandidates));
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
const nextCandidates = new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, extension));
|
|
147
|
+
const nextCandidates = new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, extension, { bareArbitraryValues: options.bareArbitraryValues }));
|
|
148
148
|
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
149
149
|
replaceScanLayer(normalizedId, nextCandidates);
|
|
150
150
|
}
|
|
151
151
|
async function syncCss(id, source) {
|
|
152
152
|
const normalizedId = cleanUrl(id);
|
|
153
|
-
const contentCacheKey = createSourceCandidateContentCacheKey("css", source);
|
|
153
|
+
const contentCacheKey = createSourceCandidateContentCacheKey("css", source, options.bareArbitraryValues);
|
|
154
154
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
155
155
|
if (cachedCandidates) {
|
|
156
156
|
replaceCssLayer(normalizedId, new Set(cachedCandidates));
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
|
-
const nextCandidates = new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, "css"));
|
|
159
|
+
const nextCandidates = new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, "css", { bareArbitraryValues: options.bareArbitraryValues }));
|
|
160
160
|
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
161
161
|
replaceCssLayer(normalizedId, nextCandidates);
|
|
162
162
|
}
|
|
163
163
|
async function merge(id, source) {
|
|
164
164
|
const normalizedId = cleanUrl(id);
|
|
165
165
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
166
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
166
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues);
|
|
167
167
|
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
168
|
-
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, extension));
|
|
168
|
+
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, extension, { bareArbitraryValues: options.bareArbitraryValues }));
|
|
169
169
|
if (!cachedCandidates) sourceCandidateContentCache.set(contentCacheKey, [...extractedCandidates]);
|
|
170
170
|
replaceTransformLayer(normalizedId, extractedCandidates);
|
|
171
171
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
import type { Config } from 'tailwindcss';
|
|
3
|
+
import type { IArbitraryValues } from '../../types/shared';
|
|
3
4
|
export type TailwindV3GenerateTarget = 'weapp' | 'web' | 'tailwind';
|
|
4
5
|
export interface TailwindV3CandidateSource {
|
|
5
6
|
content: string;
|
|
@@ -34,6 +35,7 @@ export interface TailwindV3ResolvedSource {
|
|
|
34
35
|
export interface TailwindV3GenerateOptions {
|
|
35
36
|
candidates?: Iterable<string> | undefined;
|
|
36
37
|
sources?: TailwindV3CandidateSource[] | undefined;
|
|
38
|
+
bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
|
|
37
39
|
incrementalCache?: boolean | undefined;
|
|
38
40
|
target?: TailwindV3GenerateTarget | undefined;
|
|
39
41
|
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
@@ -9,6 +9,7 @@ export interface TailwindV4SourcePattern {
|
|
|
9
9
|
type TailwindV4PatchGenerateOptions = Omit<PatchTailwindV4GenerateOptions, 'target' | 'styleOptions' | 'tailwindcssV3Compatibility' | 'scanSources'>;
|
|
10
10
|
export interface TailwindV4GenerateOptions extends TailwindV4PatchGenerateOptions {
|
|
11
11
|
incrementalCache?: boolean | undefined;
|
|
12
|
+
bareArbitraryValues?: PatchTailwindV4GenerateOptions['bareArbitraryValues'] | undefined;
|
|
12
13
|
target?: TailwindV4GenerateTarget | undefined;
|
|
13
14
|
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
14
15
|
tailwindcssV3Compatibility?: boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-
|
|
1
|
+
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-DCxNPBVs.mjs";
|
|
2
2
|
import { n as defuOverrideArray } from "./utils-DsaS975I.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-D3BMLVAN.js");
|
|
3
3
|
require("./utils-D7Ygohep.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_module = require("node:module");
|
package/dist/typedoc.export.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, WeappTailwindcssPostcssPluginOptions, } from './index';
|
|
2
|
+
export type { ApplyOptions, CacheOptions, ExtractOptions, TailwindCssOptions, TailwindCssPatchOptions, TailwindV2Options, TailwindV3Options, TailwindV4Options, } from './types/typedoc-tailwindcss-patch';
|
|
2
3
|
export type { UserDefinedOptions } from './types/user-defined-options';
|
|
3
|
-
export type { ApplyOptions, CacheOptions, ExtractOptions, TailwindCssOptions, TailwindCssPatchOptions, TailwindV2Options, TailwindV3Options, TailwindV4Options, } from 'tailwindcss-patch';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { SourceEntry } from '@tailwindcss/oxide';
|
|
2
|
+
import type { PackageResolvingOptions } from 'local-pkg';
|
|
3
|
+
import type { ILengthUnitsPatchOptions } from 'tailwindcss-patch';
|
|
4
|
+
import type { TailwindV4CssSource } from '../tailwindcss/v4-engine';
|
|
5
|
+
export type CacheStrategy = 'merge' | 'overwrite';
|
|
6
|
+
export type CacheDriver = 'file' | 'memory' | 'noop';
|
|
7
|
+
export interface CacheOptions {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
dir?: string;
|
|
11
|
+
file?: string;
|
|
12
|
+
strategy?: CacheStrategy;
|
|
13
|
+
driver?: CacheDriver;
|
|
14
|
+
}
|
|
15
|
+
export interface ExtractOptions {
|
|
16
|
+
write?: boolean;
|
|
17
|
+
file?: string;
|
|
18
|
+
format?: 'json' | 'lines';
|
|
19
|
+
pretty?: number | boolean;
|
|
20
|
+
removeUniversalSelector?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ExposeContextOptions {
|
|
23
|
+
refProperty?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ExtendLengthUnitsOptions extends Partial<ILengthUnitsPatchOptions> {
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface ApplyOptions {
|
|
29
|
+
overwrite?: boolean;
|
|
30
|
+
exposeContext?: boolean | ExposeContextOptions;
|
|
31
|
+
extendLengthUnits?: false | ExtendLengthUnitsOptions;
|
|
32
|
+
}
|
|
33
|
+
export interface TailwindRuntimeOptionsBase {
|
|
34
|
+
config?: string;
|
|
35
|
+
cwd?: string;
|
|
36
|
+
postcssPlugin?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TailwindV2Options extends TailwindRuntimeOptionsBase {
|
|
39
|
+
}
|
|
40
|
+
export interface TailwindV3Options extends TailwindRuntimeOptionsBase {
|
|
41
|
+
}
|
|
42
|
+
export interface TailwindV4Options {
|
|
43
|
+
base?: string;
|
|
44
|
+
css?: string;
|
|
45
|
+
cssSources?: TailwindV4CssSource[];
|
|
46
|
+
cssEntries?: string[];
|
|
47
|
+
sources?: SourceEntry[];
|
|
48
|
+
bareArbitraryValues?: boolean | {
|
|
49
|
+
units?: string[];
|
|
50
|
+
} | undefined;
|
|
51
|
+
}
|
|
52
|
+
export interface TailwindCssOptions extends TailwindRuntimeOptionsBase {
|
|
53
|
+
version?: 2 | 3 | 4;
|
|
54
|
+
packageName?: string;
|
|
55
|
+
resolve?: PackageResolvingOptions;
|
|
56
|
+
v2?: TailwindV2Options;
|
|
57
|
+
v3?: TailwindV3Options;
|
|
58
|
+
v4?: TailwindV4Options;
|
|
59
|
+
}
|
|
60
|
+
export interface TailwindCssPatchOptions {
|
|
61
|
+
projectRoot?: string;
|
|
62
|
+
tailwindcss?: TailwindCssOptions;
|
|
63
|
+
apply?: ApplyOptions;
|
|
64
|
+
extract?: ExtractOptions;
|
|
65
|
+
filter?: (className: string) => boolean;
|
|
66
|
+
cache?: boolean | CacheOptions;
|
|
67
|
+
}
|
|
@@ -5,13 +5,13 @@ node_fs = require_chunk.__toESM(node_fs);
|
|
|
5
5
|
let node_module = require("node:module");
|
|
6
6
|
let postcss = require("postcss");
|
|
7
7
|
postcss = require_chunk.__toESM(postcss);
|
|
8
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
8
9
|
let node_process = require("node:process");
|
|
9
10
|
node_process = require_chunk.__toESM(node_process);
|
|
10
11
|
let node_path = require("node:path");
|
|
11
12
|
node_path = require_chunk.__toESM(node_path);
|
|
12
13
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
13
14
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
14
|
-
let tailwindcss_patch = require("tailwindcss-patch");
|
|
15
15
|
let node_url = require("node:url");
|
|
16
16
|
let debug = require("debug");
|
|
17
17
|
debug = require_chunk.__toESM(debug);
|
|
@@ -1832,7 +1832,7 @@ function createTailwindV4Engine(source) {
|
|
|
1832
1832
|
const resolvedStyleOptions = resolveStyleOptions$1(generateSource, styleOptions);
|
|
1833
1833
|
const engine = (0, tailwindcss_patch.createTailwindV4Engine)(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
|
|
1834
1834
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1835
|
-
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources)) : void 0;
|
|
1835
|
+
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources, { bareArbitraryValues: patchOptions.bareArbitraryValues })) : void 0;
|
|
1836
1836
|
const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates$1(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
|
|
1837
1837
|
const result = await engine.generate(omitUndefined({
|
|
1838
1838
|
scanSources: false,
|
|
@@ -2894,6 +2894,57 @@ function createChangedContentEntries(candidates, sources) {
|
|
|
2894
2894
|
function collectCandidates(candidates) {
|
|
2895
2895
|
return new Set(candidates ?? []);
|
|
2896
2896
|
}
|
|
2897
|
+
function normalizeBareArbitraryValueCandidate(candidate, bareArbitraryValues) {
|
|
2898
|
+
return (0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(candidate, bareArbitraryValues)?.canonicalCandidate ?? candidate;
|
|
2899
|
+
}
|
|
2900
|
+
function normalizeBareArbitraryValueCandidates(candidates, bareArbitraryValues) {
|
|
2901
|
+
const normalized = /* @__PURE__ */ new Set();
|
|
2902
|
+
const restoreCandidates = /* @__PURE__ */ new Map();
|
|
2903
|
+
for (const candidate of candidates) {
|
|
2904
|
+
const normalizedCandidate = normalizeBareArbitraryValueCandidate(candidate, bareArbitraryValues);
|
|
2905
|
+
normalized.add(normalizedCandidate);
|
|
2906
|
+
if (normalizedCandidate !== candidate) restoreCandidates.set(normalizedCandidate, candidate);
|
|
2907
|
+
}
|
|
2908
|
+
return {
|
|
2909
|
+
candidates: normalized,
|
|
2910
|
+
restoreCandidates
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
async function collectSourceBareArbitraryValueCandidates(sources, bareArbitraryValues) {
|
|
2914
|
+
if (!(0, tailwindcss_patch.isBareArbitraryValuesEnabled)(bareArbitraryValues)) return [];
|
|
2915
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
2916
|
+
for (const source of sources ?? []) for (const candidate of await (0, tailwindcss_patch.extractSourceCandidates)(source.content, source.extension ?? "html", { bareArbitraryValues })) if ((0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(candidate, bareArbitraryValues)) candidates.add(candidate);
|
|
2917
|
+
return [...candidates];
|
|
2918
|
+
}
|
|
2919
|
+
function escapeCssClassSelector(className) {
|
|
2920
|
+
return className.replace(/[^\w-]/g, (char) => `\\${char}`);
|
|
2921
|
+
}
|
|
2922
|
+
function restoreBareArbitraryValueCssSelectors(css, originalCandidates, bareArbitraryValues, escapeClassName) {
|
|
2923
|
+
if (!(0, tailwindcss_patch.isBareArbitraryValuesEnabled)(bareArbitraryValues)) return css;
|
|
2924
|
+
let restored = css;
|
|
2925
|
+
for (const originalCandidate of originalCandidates) {
|
|
2926
|
+
const canonical = (0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(originalCandidate, bareArbitraryValues)?.canonicalCandidate;
|
|
2927
|
+
if (canonical) restored = restored.split(`.${escapeClassName(canonical)}`).join(`.${escapeCssClassSelector(originalCandidate)}`);
|
|
2928
|
+
}
|
|
2929
|
+
return restored;
|
|
2930
|
+
}
|
|
2931
|
+
function restoreBareArbitraryValueClassSet(classSet, originalCandidates, bareArbitraryValues) {
|
|
2932
|
+
if (!(0, tailwindcss_patch.isBareArbitraryValuesEnabled)(bareArbitraryValues)) return new Set(classSet);
|
|
2933
|
+
const restored = new Set(classSet);
|
|
2934
|
+
for (const originalCandidate of originalCandidates) {
|
|
2935
|
+
const canonical = (0, tailwindcss_patch.resolveBareArbitraryValueCandidate)(originalCandidate, bareArbitraryValues)?.canonicalCandidate;
|
|
2936
|
+
if (canonical && restored.has(canonical)) {
|
|
2937
|
+
restored.delete(canonical);
|
|
2938
|
+
restored.add(originalCandidate);
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
return restored;
|
|
2942
|
+
}
|
|
2943
|
+
function collectGeneratedCandidates(context, candidates, restoreCandidates) {
|
|
2944
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
2945
|
+
for (const candidate of candidates) if (context.classCache.has(candidate)) classSet.add(restoreCandidates.get(candidate) ?? candidate);
|
|
2946
|
+
return classSet;
|
|
2947
|
+
}
|
|
2897
2948
|
function hasRemovedCandidates(previousCandidates, nextCandidates) {
|
|
2898
2949
|
for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
|
|
2899
2950
|
return false;
|
|
@@ -3009,6 +3060,7 @@ function loadTailwindV3Internals(source) {
|
|
|
3009
3060
|
};
|
|
3010
3061
|
const collapseAdjacentRulesModule = requireTailwind(`${source.packageName}/lib/lib/collapseAdjacentRules`);
|
|
3011
3062
|
const collapseDuplicateDeclarationsModule = requireTailwind(`${source.packageName}/lib/lib/collapseDuplicateDeclarations`);
|
|
3063
|
+
const escapeClassNameModule = requireTailwind(`${source.packageName}/lib/util/escapeClassName`);
|
|
3012
3064
|
const generateRulesModule = requireTailwind(`${source.packageName}/lib/lib/generateRules`);
|
|
3013
3065
|
const sharedStateModule = requireTailwind(`${source.packageName}/lib/lib/sharedState`);
|
|
3014
3066
|
const setupContextUtils = requireTailwind(`${source.packageName}/lib/lib/setupContextUtils`);
|
|
@@ -3020,6 +3072,7 @@ function loadTailwindV3Internals(source) {
|
|
|
3020
3072
|
collapseAdjacentRules: collapseAdjacentRulesModule["default"] ?? collapseAdjacentRulesModule,
|
|
3021
3073
|
collapseDuplicateDeclarations: collapseDuplicateDeclarationsModule["default"] ?? collapseDuplicateDeclarationsModule,
|
|
3022
3074
|
createContext: setupContextUtils["createContext"],
|
|
3075
|
+
escapeClassName: escapeClassNameModule["default"] ?? escapeClassNameModule,
|
|
3023
3076
|
generateRules: generateRulesModule["generateRules"],
|
|
3024
3077
|
notOnDemandCandidate: String(sharedStateModule["NOT_ON_DEMAND"] ?? "*"),
|
|
3025
3078
|
processTailwindFeatures: processTailwindFeaturesModule["default"] ?? processTailwindFeaturesModule,
|
|
@@ -3047,7 +3100,7 @@ function createDependencyFingerprint(files) {
|
|
|
3047
3100
|
}
|
|
3048
3101
|
}).join("|");
|
|
3049
3102
|
}
|
|
3050
|
-
function createIncrementalGenerateCacheKey(source, target, styleOptions) {
|
|
3103
|
+
function createIncrementalGenerateCacheKey(source, target, styleOptions, bareArbitraryValues) {
|
|
3051
3104
|
return [
|
|
3052
3105
|
source.packageName,
|
|
3053
3106
|
source.postcssPlugin,
|
|
@@ -3057,7 +3110,8 @@ function createIncrementalGenerateCacheKey(source, target, styleOptions) {
|
|
|
3057
3110
|
source.css,
|
|
3058
3111
|
createStableJson(normalizeConfigObject(source.configObject)?.content),
|
|
3059
3112
|
target,
|
|
3060
|
-
createStableJson(styleOptions)
|
|
3113
|
+
createStableJson(styleOptions),
|
|
3114
|
+
createStableJson(bareArbitraryValues)
|
|
3061
3115
|
].join("\0");
|
|
3062
3116
|
}
|
|
3063
3117
|
function createRuntimeReadyCacheKey(source, rootPath) {
|
|
@@ -3132,8 +3186,15 @@ function createTailwindV3Engine(source) {
|
|
|
3132
3186
|
const internals = tailwindInternals;
|
|
3133
3187
|
const { styleOptions, target = "weapp" } = options;
|
|
3134
3188
|
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
3135
|
-
const
|
|
3136
|
-
const
|
|
3189
|
+
const requestedCandidates = mergeGenerateCandidates(generateSource, options);
|
|
3190
|
+
for (const candidate of await collectSourceBareArbitraryValueCandidates(options.sources, options.bareArbitraryValues)) requestedCandidates.add(candidate);
|
|
3191
|
+
const normalizedCandidates = normalizeBareArbitraryValueCandidates(requestedCandidates, options.bareArbitraryValues);
|
|
3192
|
+
const tailwindOptions = {
|
|
3193
|
+
...options,
|
|
3194
|
+
candidates: normalizedCandidates.candidates
|
|
3195
|
+
};
|
|
3196
|
+
const tailwindConfig = internals.validateConfig(internals.resolveConfig(createTailwindConfig(generateSource, tailwindOptions)));
|
|
3197
|
+
const candidates = normalizedCandidates.candidates;
|
|
3137
3198
|
const changedContent = createChangedContentEntries(candidates, options.sources ?? []);
|
|
3138
3199
|
const root = postcss.default.parse(generateSource.css, { from: void 0 });
|
|
3139
3200
|
const result = {
|
|
@@ -3155,17 +3216,17 @@ function createTailwindV3Engine(source) {
|
|
|
3155
3216
|
};
|
|
3156
3217
|
context = await internals.processTailwindFeatures(setupContext)(root, result);
|
|
3157
3218
|
}
|
|
3158
|
-
const rawCss = root.toString();
|
|
3219
|
+
const rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), requestedCandidates, options.bareArbitraryValues, internals.escapeClassName);
|
|
3159
3220
|
const css = await transformTailwindV3CssByTarget(rawCss, target, resolvedStyleOptions);
|
|
3160
3221
|
const dependencies = collectDependencyMessages(result);
|
|
3161
3222
|
for (const dependency of generateSource.dependencies) dependencies.add(dependency);
|
|
3162
|
-
const classSet = collectClassSet(context);
|
|
3223
|
+
const classSet = restoreBareArbitraryValueClassSet(collectClassSet(context), requestedCandidates, options.bareArbitraryValues);
|
|
3163
3224
|
return {
|
|
3164
3225
|
css,
|
|
3165
3226
|
rawCss,
|
|
3166
3227
|
context,
|
|
3167
3228
|
classSet,
|
|
3168
|
-
rawCandidates:
|
|
3229
|
+
rawCandidates: requestedCandidates,
|
|
3169
3230
|
dependencies: [...dependencies],
|
|
3170
3231
|
sources: [],
|
|
3171
3232
|
root: null,
|
|
@@ -3173,7 +3234,7 @@ function createTailwindV3Engine(source) {
|
|
|
3173
3234
|
version: 3
|
|
3174
3235
|
};
|
|
3175
3236
|
}
|
|
3176
|
-
async function generateIncrementalMissingUtilities(context, candidates, target, styleOptions) {
|
|
3237
|
+
async function generateIncrementalMissingUtilities(context, candidates, target, styleOptions, bareArbitraryValues) {
|
|
3177
3238
|
tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
|
|
3178
3239
|
const internals = tailwindInternals;
|
|
3179
3240
|
const root = postcss.default.root();
|
|
@@ -3181,15 +3242,17 @@ function createTailwindV3Engine(source) {
|
|
|
3181
3242
|
css: "",
|
|
3182
3243
|
messages: []
|
|
3183
3244
|
};
|
|
3184
|
-
|
|
3245
|
+
const normalizedCandidates = normalizeBareArbitraryValueCandidates(candidates, bareArbitraryValues);
|
|
3246
|
+
const sortedCandidates = sortCandidates(normalizedCandidates.candidates);
|
|
3247
|
+
appendUtilityRules(root, context, internals.generateRules(new Set(sortedCandidates), context));
|
|
3185
3248
|
internals.resolveDefaultsAtRules(context)(root, result);
|
|
3186
3249
|
internals.collapseAdjacentRules(context)(root, result);
|
|
3187
3250
|
internals.collapseDuplicateDeclarations(context)(root, result);
|
|
3188
|
-
const rawCss = root.toString();
|
|
3251
|
+
const rawCss = restoreBareArbitraryValueCssSelectors(root.toString(), candidates, bareArbitraryValues, internals.escapeClassName);
|
|
3189
3252
|
return {
|
|
3190
3253
|
css: await transformTailwindV3CssByTarget(rawCss, target, resolveStyleOptions(source, styleOptions)),
|
|
3191
3254
|
rawCss,
|
|
3192
|
-
classSet:
|
|
3255
|
+
classSet: collectGeneratedCandidates(context, sortedCandidates, normalizedCandidates.restoreCandidates),
|
|
3193
3256
|
dependencies: collectDependencyMessages(result)
|
|
3194
3257
|
};
|
|
3195
3258
|
}
|
|
@@ -3199,7 +3262,7 @@ function createTailwindV3Engine(source) {
|
|
|
3199
3262
|
const requestedCandidates = mergeGenerateCandidates(source, options);
|
|
3200
3263
|
if (requestedCandidates.size === 0) return generateOnce(source, options);
|
|
3201
3264
|
const styleOptions = resolveStyleOptions(source, options.styleOptions);
|
|
3202
|
-
const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions);
|
|
3265
|
+
const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions, options.bareArbitraryValues);
|
|
3203
3266
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
3204
3267
|
if (cached) {
|
|
3205
3268
|
if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) {
|
|
@@ -3229,7 +3292,7 @@ function createTailwindV3Engine(source) {
|
|
|
3229
3292
|
target: cached.target,
|
|
3230
3293
|
version: 3
|
|
3231
3294
|
};
|
|
3232
|
-
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target, styleOptions);
|
|
3295
|
+
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target, styleOptions, options.bareArbitraryValues);
|
|
3233
3296
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
3234
3297
|
for (const className of generated.classSet) cached.classSet.add(className);
|
|
3235
3298
|
cached.css = [cached.css, generated.css].filter(Boolean).join("\n");
|