weapp-tailwindcss 4.8.1 → 4.8.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/dist/{chunk-KMCQEHJM.js → chunk-467NHGLF.js} +52 -8
- package/dist/{chunk-3RXY3OXF.mjs → chunk-5BZA7BAP.mjs} +1 -1
- package/dist/{chunk-DHHTSM3K.mjs → chunk-6OTI5FPH.mjs} +1 -1
- package/dist/{chunk-X7QD7NUX.js → chunk-ACSKKIYM.js} +76 -28
- package/dist/{chunk-YHZB3KHY.mjs → chunk-GVPBDBX4.mjs} +1 -1
- package/dist/{chunk-U7OMIV3S.js → chunk-H34KPZQW.js} +2 -2
- package/dist/{chunk-YW5YW5D4.mjs → chunk-HCXLLOIU.mjs} +47 -3
- package/dist/{chunk-MYNTKRVT.js → chunk-IXZDFEPL.js} +19 -19
- package/dist/{chunk-NQTLEEK5.js → chunk-JPLWILCP.js} +5 -5
- package/dist/{chunk-QNGB574L.js → chunk-K7AD7FLJ.js} +6 -6
- package/dist/{chunk-MSFAEBH6.mjs → chunk-OJRQGFJR.mjs} +3 -3
- package/dist/{chunk-BTPDRSHI.mjs → chunk-QGH4JZRW.mjs} +1 -1
- package/dist/{chunk-XGRBCPBI.js → chunk-UJIUFWXE.js} +1 -1
- package/dist/{chunk-TTCMOWCO.mjs → chunk-W4ERVC6L.mjs} +74 -26
- package/dist/{chunk-5XFZ2DUB.js → chunk-Z6IWSDU3.js} +21 -21
- package/dist/cli.js +14 -14
- package/dist/cli.mjs +5 -5
- package/dist/core.js +9 -9
- package/dist/core.mjs +3 -3
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +4 -4
- 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.js +3 -3
- package/dist/presets.mjs +2 -2
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +4 -4
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.js +21 -21
- package/dist/webpack4.mjs +4 -4
- package/package.json +3 -3
|
@@ -7,7 +7,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkACSKKIYMjs = require('./chunk-ACSKKIYM.js');
|
|
11
11
|
|
|
12
12
|
// src/bundlers/gulp/index.ts
|
|
13
13
|
var _buffer = require('buffer');
|
|
@@ -15,21 +15,21 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
|
15
15
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
16
16
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
17
17
|
var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
18
|
-
var debug =
|
|
18
|
+
var debug = _chunkACSKKIYMjs.createDebug.call(void 0, );
|
|
19
19
|
var Transform = _stream2.default.Transform;
|
|
20
20
|
function createPlugins(options = {}) {
|
|
21
|
-
const opts =
|
|
21
|
+
const opts = _chunkACSKKIYMjs.getCompilerContext.call(void 0, options);
|
|
22
22
|
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
23
23
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
24
24
|
const runtimeState = {
|
|
25
25
|
twPatcher: initialTwPatcher,
|
|
26
|
-
patchPromise:
|
|
26
|
+
patchPromise: _chunkACSKKIYMjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
27
27
|
refreshTailwindcssPatcher
|
|
28
28
|
};
|
|
29
29
|
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
30
30
|
let runtimeSetInitialized = false;
|
|
31
31
|
async function refreshRuntimeState(force) {
|
|
32
|
-
await
|
|
32
|
+
await _chunkACSKKIYMjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
33
33
|
}
|
|
34
34
|
async function refreshRuntimeSet(force = false) {
|
|
35
35
|
await refreshRuntimeState(force);
|
|
@@ -37,7 +37,7 @@ function createPlugins(options = {}) {
|
|
|
37
37
|
if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
|
|
38
38
|
return runtimeSet;
|
|
39
39
|
}
|
|
40
|
-
runtimeSet = await
|
|
40
|
+
runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
|
|
41
41
|
runtimeSetInitialized = true;
|
|
42
42
|
return runtimeSet;
|
|
43
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyTailwindcssCssImportRewrite,
|
|
3
3
|
getCacheKey
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GVPBDBX4.mjs";
|
|
5
5
|
import {
|
|
6
6
|
pushConcurrentTaskFactories,
|
|
7
7
|
resolveOutputSpecifier,
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
getCompilerContext,
|
|
19
19
|
pluginName,
|
|
20
20
|
refreshTailwindRuntimeState
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-W4ERVC6L.mjs";
|
|
22
22
|
import {
|
|
23
23
|
getGroupedEntries
|
|
24
24
|
} from "./chunk-ZNKIYZRQ.mjs";
|
|
25
25
|
import {
|
|
26
26
|
__dirname
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-QGH4JZRW.mjs";
|
|
28
28
|
|
|
29
29
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
30
30
|
import fs from "fs";
|
|
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
5
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.
|
|
8
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.3_@swc+h_5a981c295142658a01fde01f36b7c0a8/node_modules/tsup/assets/esm_shims.js
|
|
9
9
|
import path from "path";
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
11
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.
|
|
8
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.3_@swc+h_5a981c295142658a01fde01f36b7c0a8/node_modules/tsup/assets/cjs_shims.js
|
|
9
9
|
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;
|
|
10
10
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTailwindcssPatcherFromContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HCXLLOIU.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getDefaultOptions
|
|
6
6
|
} from "./chunk-DKPIYG24.mjs";
|
|
@@ -176,8 +176,10 @@ import { mkdir, writeFile } from "fs/promises";
|
|
|
176
176
|
import path from "path";
|
|
177
177
|
import process from "process";
|
|
178
178
|
import { logger } from "@weapp-tailwindcss/logger";
|
|
179
|
-
var PATCH_INFO_DIRNAME = ".tw-patch";
|
|
180
179
|
var PATCH_INFO_FILENAME = "tailwindcss-target.json";
|
|
180
|
+
var PATCH_INFO_CACHE_RELATIVE_PATH = path.join("node_modules", ".cache", "weapp-tailwindcss", PATCH_INFO_FILENAME);
|
|
181
|
+
var PATCH_INFO_LEGACY_RELATIVE_PATH = path.join(".tw-patch", PATCH_INFO_FILENAME);
|
|
182
|
+
var loggedInvalidPatchRecords = /* @__PURE__ */ new Set();
|
|
181
183
|
function formatRelativeToBase(targetPath, baseDir) {
|
|
182
184
|
if (!baseDir) {
|
|
183
185
|
return path.normalize(targetPath);
|
|
@@ -192,7 +194,13 @@ function formatRelativeToBase(targetPath, baseDir) {
|
|
|
192
194
|
return path.join(".", relative);
|
|
193
195
|
}
|
|
194
196
|
function getRecordFilePath(baseDir) {
|
|
195
|
-
return path.join(baseDir,
|
|
197
|
+
return path.join(baseDir, PATCH_INFO_CACHE_RELATIVE_PATH);
|
|
198
|
+
}
|
|
199
|
+
function getRecordFileCandidates(baseDir) {
|
|
200
|
+
return [
|
|
201
|
+
path.join(baseDir, PATCH_INFO_CACHE_RELATIVE_PATH),
|
|
202
|
+
path.join(baseDir, PATCH_INFO_LEGACY_RELATIVE_PATH)
|
|
203
|
+
];
|
|
196
204
|
}
|
|
197
205
|
function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
198
206
|
const packageInfo = patcher?.packageInfo;
|
|
@@ -209,41 +217,61 @@ function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
|
209
217
|
const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
|
|
210
218
|
logger.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
|
|
211
219
|
}
|
|
220
|
+
function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
|
|
221
|
+
const normalizedPath = path.normalize(recordPath);
|
|
222
|
+
if (loggedInvalidPatchRecords.has(normalizedPath)) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
loggedInvalidPatchRecords.add(normalizedPath);
|
|
226
|
+
const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
|
|
227
|
+
const baseDisplay = formatRelativeToBase(path.normalize(baseDir), process.cwd());
|
|
228
|
+
const reasonMessage = reason ? `\uFF1A${reason}` : "";
|
|
229
|
+
logger.warn(
|
|
230
|
+
`\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`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
212
233
|
function readPatchTargetRecord(baseDir) {
|
|
213
234
|
if (!baseDir) {
|
|
214
235
|
return void 0;
|
|
215
236
|
}
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
237
|
+
const normalizedBase = path.normalize(baseDir);
|
|
238
|
+
for (const recordPath of getRecordFileCandidates(normalizedBase)) {
|
|
239
|
+
if (!existsSync(recordPath)) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
const content = readFileSync(recordPath, "utf8");
|
|
244
|
+
const parsed = JSON.parse(content);
|
|
245
|
+
if (!parsed || typeof parsed.tailwindPackagePath !== "string") {
|
|
246
|
+
warnInvalidPatchTargetRecord(normalizedBase, recordPath, "\u7F3A\u5C11 tailwindPackagePath \u5B57\u6BB5");
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
baseDir: normalizedBase,
|
|
251
|
+
path: recordPath,
|
|
252
|
+
record: parsed
|
|
253
|
+
};
|
|
254
|
+
} catch (error) {
|
|
255
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
256
|
+
warnInvalidPatchTargetRecord(normalizedBase, recordPath, reason);
|
|
257
|
+
continue;
|
|
225
258
|
}
|
|
226
|
-
return {
|
|
227
|
-
path: recordPath,
|
|
228
|
-
record: parsed
|
|
229
|
-
};
|
|
230
|
-
} catch (error) {
|
|
231
|
-
logger.debug("failed to read patch target record from %s: %O", recordPath, error);
|
|
232
|
-
return void 0;
|
|
233
259
|
}
|
|
260
|
+
return void 0;
|
|
234
261
|
}
|
|
235
262
|
async function saveCliPatchTargetRecord(baseDir, patcher) {
|
|
236
263
|
if (!baseDir || !patcher?.packageInfo?.rootPath) {
|
|
237
264
|
return void 0;
|
|
238
265
|
}
|
|
266
|
+
const normalizedBase = path.normalize(baseDir);
|
|
239
267
|
const record = {
|
|
240
268
|
tailwindPackagePath: path.normalize(patcher.packageInfo.rootPath),
|
|
241
269
|
packageVersion: patcher.packageInfo.version,
|
|
242
270
|
recordedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
243
271
|
source: "cli",
|
|
244
|
-
tailwindcssBasedir:
|
|
272
|
+
tailwindcssBasedir: normalizedBase
|
|
245
273
|
};
|
|
246
|
-
const recordPath = getRecordFilePath(
|
|
274
|
+
const recordPath = getRecordFilePath(normalizedBase);
|
|
247
275
|
try {
|
|
248
276
|
await mkdir(path.dirname(recordPath), { recursive: true });
|
|
249
277
|
await writeFile(recordPath, `${JSON.stringify(record, null, 2)}
|
|
@@ -254,11 +282,29 @@ async function saveCliPatchTargetRecord(baseDir, patcher) {
|
|
|
254
282
|
return void 0;
|
|
255
283
|
}
|
|
256
284
|
}
|
|
285
|
+
function findPatchTargetRecord(baseDir) {
|
|
286
|
+
const visited = /* @__PURE__ */ new Set();
|
|
287
|
+
const fallback = baseDir ?? process.cwd();
|
|
288
|
+
let current = path.resolve(fallback);
|
|
289
|
+
while (!visited.has(current)) {
|
|
290
|
+
const record = readPatchTargetRecord(current);
|
|
291
|
+
if (record) {
|
|
292
|
+
return record;
|
|
293
|
+
}
|
|
294
|
+
const parent = path.dirname(current);
|
|
295
|
+
if (parent === current) {
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
visited.add(current);
|
|
299
|
+
current = parent;
|
|
300
|
+
}
|
|
301
|
+
return void 0;
|
|
302
|
+
}
|
|
257
303
|
function warnIfCliPatchTargetMismatch(baseDir, patcher) {
|
|
258
304
|
if (!baseDir || !patcher?.packageInfo?.rootPath) {
|
|
259
305
|
return;
|
|
260
306
|
}
|
|
261
|
-
const recorded =
|
|
307
|
+
const recorded = findPatchTargetRecord(baseDir);
|
|
262
308
|
if (!recorded) {
|
|
263
309
|
return;
|
|
264
310
|
}
|
|
@@ -267,12 +313,14 @@ function warnIfCliPatchTargetMismatch(baseDir, patcher) {
|
|
|
267
313
|
if (normalizedRecorded === normalizedRuntime) {
|
|
268
314
|
return;
|
|
269
315
|
}
|
|
270
|
-
const
|
|
316
|
+
const runtimeBaseDisplay = formatRelativeToBase(path.normalize(baseDir), process.cwd());
|
|
317
|
+
const recordBaseDir = recorded.record.tailwindcssBasedir ?? recorded.baseDir;
|
|
318
|
+
const recordBaseDisplay = formatRelativeToBase(recordBaseDir, baseDir);
|
|
319
|
+
const recordedDisplay = formatRelativeToBase(normalizedRecorded, recordBaseDir);
|
|
271
320
|
const runtimeDisplay = formatRelativeToBase(normalizedRuntime, baseDir);
|
|
272
|
-
const
|
|
273
|
-
const recordFileDisplay = formatRelativeToBase(recorded.path, baseDir);
|
|
321
|
+
const recordFileDisplay = formatRelativeToBase(recorded.path, recorded.baseDir);
|
|
274
322
|
logger.warn(
|
|
275
|
-
`\u68C0\u6D4B\u5230 ${
|
|
323
|
+
`\u68C0\u6D4B\u5230 ${runtimeBaseDisplay} \u7684 Tailwind CSS \u76EE\u6807\u4E0D\u4E00\u81F4\uFF1ACLI \u5728 ${recordBaseDisplay} \u6253\u8865\u4E01\u7684\u662F ${recordedDisplay}\uFF0C\u8FD0\u884C\u65F6\u8BFB\u53D6\u7684\u662F ${runtimeDisplay}\u3002\u8BF7\u5728\u5BF9\u5E94\u5B50\u5305\u6267\u884C "weapp-tw patch --cwd ${baseDir}" \u6216\u4F7F\u7528 pnpm --filter \u9488\u5BF9\u8BE5\u5305\u6267\u884C\uFF0C\u8BB0\u5F55\u6587\u4EF6\uFF1A${recordFileDisplay}\u3002`
|
|
276
324
|
);
|
|
277
325
|
}
|
|
278
326
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkH34KPZQWjs = require('./chunk-H34KPZQW.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
@@ -20,7 +20,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkACSKKIYMjs = require('./chunk-ACSKKIYM.js');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
@@ -52,7 +52,7 @@ function updateStaticAttribute(ms, prop) {
|
|
|
52
52
|
const start = prop.value.loc.start.offset + 1;
|
|
53
53
|
const end = prop.value.loc.end.offset - 1;
|
|
54
54
|
if (start < end) {
|
|
55
|
-
ms.update(start, end,
|
|
55
|
+
ms.update(start, end, _chunkACSKKIYMjs.replaceWxml.call(void 0, prop.value.content));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
@@ -64,7 +64,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
|
64
64
|
if (start >= end) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const generated =
|
|
67
|
+
const generated = _chunkACSKKIYMjs.generateCode.call(void 0, prop.exp.content, {
|
|
68
68
|
jsHandler,
|
|
69
69
|
runtimeSet,
|
|
70
70
|
wrapExpression: true
|
|
@@ -93,7 +93,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
96
|
-
const matchCustomAttribute =
|
|
96
|
+
const matchCustomAttribute = _chunkACSKKIYMjs.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
97
97
|
const ms = new (0, _magicstring2.default)(code);
|
|
98
98
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
99
99
|
if (errors.length === 0) {
|
|
@@ -216,8 +216,8 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// src/bundlers/vite/index.ts
|
|
219
|
-
var debug =
|
|
220
|
-
var weappTailwindcssPackageDir =
|
|
219
|
+
var debug = _chunkACSKKIYMjs.createDebug.call(void 0, );
|
|
220
|
+
var weappTailwindcssPackageDir = _chunkH34KPZQWjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
221
221
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
222
222
|
function joinPosixPath(base, subpath) {
|
|
223
223
|
if (base.endsWith("/")) {
|
|
@@ -261,7 +261,7 @@ function isJavaScriptEntry(entry) {
|
|
|
261
261
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
262
262
|
return {
|
|
263
263
|
resolve(specifier, importer) {
|
|
264
|
-
return
|
|
264
|
+
return _chunkH34KPZQWjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
|
|
265
265
|
},
|
|
266
266
|
load(id) {
|
|
267
267
|
const entry = entries.get(id);
|
|
@@ -299,7 +299,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
299
299
|
}
|
|
300
300
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
301
301
|
const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
|
|
302
|
-
const opts =
|
|
302
|
+
const opts = _chunkACSKKIYMjs.getCompilerContext.call(void 0, options);
|
|
303
303
|
const {
|
|
304
304
|
disabled,
|
|
305
305
|
customAttributes,
|
|
@@ -321,17 +321,17 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
321
321
|
if (disabled) {
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
-
const customAttributesEntities =
|
|
324
|
+
const customAttributesEntities = _chunkACSKKIYMjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
325
325
|
const runtimeState = {
|
|
326
326
|
twPatcher: initialTwPatcher,
|
|
327
|
-
patchPromise:
|
|
327
|
+
patchPromise: _chunkACSKKIYMjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
328
328
|
refreshTailwindcssPatcher
|
|
329
329
|
};
|
|
330
330
|
let runtimeSet;
|
|
331
331
|
let runtimeSetPromise;
|
|
332
332
|
let resolvedConfig;
|
|
333
333
|
async function refreshRuntimeState(force) {
|
|
334
|
-
const refreshed = await
|
|
334
|
+
const refreshed = await _chunkACSKKIYMjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
335
335
|
if (refreshed) {
|
|
336
336
|
runtimeSet = void 0;
|
|
337
337
|
runtimeSetPromise = void 0;
|
|
@@ -344,7 +344,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
344
344
|
return runtimeSet;
|
|
345
345
|
}
|
|
346
346
|
if (force || !runtimeSetPromise) {
|
|
347
|
-
const task2 =
|
|
347
|
+
const task2 = _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
348
348
|
force: force || !runtimeSet,
|
|
349
349
|
skipRefresh: force
|
|
350
350
|
});
|
|
@@ -364,10 +364,10 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
364
364
|
const shouldRewriteCssImports = opts.rewriteCssImports !== false && (rewriteCssImportsSpecified || (_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( 0))) >= 4);
|
|
365
365
|
const rewritePlugins = !shouldRewriteCssImports ? [] : [
|
|
366
366
|
{
|
|
367
|
-
name: `${
|
|
367
|
+
name: `${_chunkACSKKIYMjs.vitePluginName}:rewrite-css-imports`,
|
|
368
368
|
enforce: "pre",
|
|
369
369
|
resolveId(id, importer) {
|
|
370
|
-
const replacement =
|
|
370
|
+
const replacement = _chunkH34KPZQWjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix, { join: joinPosixPath });
|
|
371
371
|
if (!replacement) {
|
|
372
372
|
return null;
|
|
373
373
|
}
|
|
@@ -380,7 +380,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
380
380
|
if (!isCSSRequest(id)) {
|
|
381
381
|
return null;
|
|
382
382
|
}
|
|
383
|
-
const rewritten =
|
|
383
|
+
const rewritten = _chunkH34KPZQWjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix, { join: joinPosixPath });
|
|
384
384
|
if (!rewritten) {
|
|
385
385
|
return null;
|
|
386
386
|
}
|
|
@@ -394,7 +394,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
394
394
|
const plugins = [
|
|
395
395
|
...rewritePlugins,
|
|
396
396
|
{
|
|
397
|
-
name: `${
|
|
397
|
+
name: `${_chunkACSKKIYMjs.vitePluginName}:post`,
|
|
398
398
|
enforce: "post",
|
|
399
399
|
configResolved(config) {
|
|
400
400
|
resolvedConfig = config;
|
|
@@ -420,7 +420,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
420
420
|
for (const [fileName, output] of entries) {
|
|
421
421
|
const entry = { fileName, output };
|
|
422
422
|
if (isJavaScriptEntry(entry)) {
|
|
423
|
-
const absolute =
|
|
423
|
+
const absolute = _chunkH34KPZQWjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
|
|
424
424
|
jsEntries.set(absolute, entry);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
@@ -484,7 +484,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
484
484
|
if (Array.isArray(groupedEntries.js)) {
|
|
485
485
|
for (const [file, originalSource] of groupedEntries.js) {
|
|
486
486
|
if (originalSource.type === "chunk") {
|
|
487
|
-
const absoluteFile =
|
|
487
|
+
const absoluteFile = _chunkH34KPZQWjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
488
488
|
const initialRawSource = originalSource.code;
|
|
489
489
|
jsTaskFactories.push(async () => {
|
|
490
490
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
@@ -510,7 +510,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
510
510
|
});
|
|
511
511
|
});
|
|
512
512
|
} else if (uniAppX && originalSource.type === "asset") {
|
|
513
|
-
const absoluteFile =
|
|
513
|
+
const absoluteFile = _chunkH34KPZQWjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
514
514
|
const rawSource = originalSource.source.toString();
|
|
515
515
|
jsTaskFactories.push(async () => {
|
|
516
516
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
@@ -581,7 +581,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
581
581
|
);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
_chunkH34KPZQWjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
585
585
|
await Promise.all(tasks);
|
|
586
586
|
for (const apply of pendingLinkedUpdates) {
|
|
587
587
|
apply();
|
package/dist/cli.js
CHANGED
|
@@ -7,8 +7,8 @@ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('./chunk-
|
|
10
|
+
var _chunkACSKKIYMjs = require('./chunk-ACSKKIYM.js');
|
|
11
|
+
require('./chunk-467NHGLF.js');
|
|
12
12
|
require('./chunk-ZSTF2AEN.js');
|
|
13
13
|
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkUJIUFWXEjs = require('./chunk-UJIUFWXE.js');
|
|
20
20
|
|
|
21
21
|
// src/cli.ts
|
|
22
22
|
var _promises = require('fs/promises');
|
|
@@ -34,12 +34,12 @@ function getNodeRequire() {
|
|
|
34
34
|
if (cachedRequire) {
|
|
35
35
|
return cachedRequire;
|
|
36
36
|
}
|
|
37
|
-
if (typeof
|
|
38
|
-
cachedRequire =
|
|
37
|
+
if (typeof _chunkUJIUFWXEjs.__require === "function") {
|
|
38
|
+
cachedRequire = _chunkUJIUFWXEjs.__require;
|
|
39
39
|
return cachedRequire;
|
|
40
40
|
}
|
|
41
41
|
try {
|
|
42
|
-
cachedRequire = _module.createRequire.call(void 0,
|
|
42
|
+
cachedRequire = _module.createRequire.call(void 0, _chunkUJIUFWXEjs.importMetaUrl);
|
|
43
43
|
} catch (e) {
|
|
44
44
|
cachedRequire = void 0;
|
|
45
45
|
}
|
|
@@ -124,7 +124,7 @@ function createCliContext(overrides, resolvedCwd) {
|
|
|
124
124
|
current
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
|
-
return
|
|
127
|
+
return _chunkACSKKIYMjs.getCompilerContext.call(void 0, userOptions);
|
|
128
128
|
}
|
|
129
129
|
function formatOutputPath(target, baseDir) {
|
|
130
130
|
const root = _nullishCoalesce(baseDir, () => ( _process2.default.cwd()));
|
|
@@ -429,25 +429,25 @@ async function generateVscodeIntellisenseEntry(options) {
|
|
|
429
429
|
|
|
430
430
|
// src/cli.ts
|
|
431
431
|
_process2.default.title = "node (weapp-tailwindcss)";
|
|
432
|
-
if (_semver2.default.lt(_process2.default.versions.node,
|
|
432
|
+
if (_semver2.default.lt(_process2.default.versions.node, _chunkACSKKIYMjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
433
433
|
_chunkOXASK55Qjs.logger.warn(
|
|
434
|
-
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${
|
|
434
|
+
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkACSKKIYMjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
|
|
435
435
|
);
|
|
436
436
|
}
|
|
437
437
|
var cli = _cac2.default.call(void 0, "weapp-tailwindcss");
|
|
438
|
-
cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").option("--record-target",
|
|
438
|
+
cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").option("--record-target", 'Write tailwindcss target metadata (node_modules/.cache/weapp-tailwindcss/tailwindcss-target.json). Pass "--record-target false" to skip.').option("--clear-cache", "Clear tailwindcss-patch cache before patch (opt-in)").action(
|
|
439
439
|
commandAction(async (options) => {
|
|
440
440
|
const resolvedCwd = resolveCliCwd(options.cwd);
|
|
441
441
|
const ctx = createCliContext(void 0, resolvedCwd);
|
|
442
442
|
const shouldClearCache = toBoolean(options.clearCache, false);
|
|
443
443
|
if (shouldClearCache) {
|
|
444
|
-
await
|
|
444
|
+
await _chunkACSKKIYMjs.clearTailwindcssPatcherCache.call(void 0, ctx.twPatcher, { removeDirectory: true });
|
|
445
445
|
}
|
|
446
|
-
|
|
446
|
+
_chunkACSKKIYMjs.logTailwindcssTarget.call(void 0, "cli", ctx.twPatcher, ctx.tailwindcssBasedir);
|
|
447
447
|
await ctx.twPatcher.patch();
|
|
448
|
-
const shouldRecordTarget = toBoolean(options.recordTarget,
|
|
448
|
+
const shouldRecordTarget = toBoolean(options.recordTarget, true);
|
|
449
449
|
if (shouldRecordTarget) {
|
|
450
|
-
const recordPath = await
|
|
450
|
+
const recordPath = await _chunkACSKKIYMjs.saveCliPatchTargetRecord.call(void 0, ctx.tailwindcssBasedir, ctx.twPatcher);
|
|
451
451
|
if (recordPath) {
|
|
452
452
|
_chunkOXASK55Qjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, resolvedCwd)}`);
|
|
453
453
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
getCompilerContext,
|
|
8
8
|
logTailwindcssTarget,
|
|
9
9
|
saveCliPatchTargetRecord
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-W4ERVC6L.mjs";
|
|
11
|
+
import "./chunk-HCXLLOIU.mjs";
|
|
12
12
|
import "./chunk-DKPIYG24.mjs";
|
|
13
13
|
import {
|
|
14
14
|
defuOverrideArray
|
|
15
15
|
} from "./chunk-ZNKIYZRQ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
__require
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QGH4JZRW.mjs";
|
|
19
19
|
|
|
20
20
|
// src/cli.ts
|
|
21
21
|
import { writeFile as writeFile2 } from "fs/promises";
|
|
@@ -434,7 +434,7 @@ if (semver.lt(process3.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
|
434
434
|
);
|
|
435
435
|
}
|
|
436
436
|
var cli = cac("weapp-tailwindcss");
|
|
437
|
-
cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").option("--record-target",
|
|
437
|
+
cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").option("--record-target", 'Write tailwindcss target metadata (node_modules/.cache/weapp-tailwindcss/tailwindcss-target.json). Pass "--record-target false" to skip.').option("--clear-cache", "Clear tailwindcss-patch cache before patch (opt-in)").action(
|
|
438
438
|
commandAction(async (options) => {
|
|
439
439
|
const resolvedCwd = resolveCliCwd(options.cwd);
|
|
440
440
|
const ctx = createCliContext(void 0, resolvedCwd);
|
|
@@ -444,7 +444,7 @@ cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").opti
|
|
|
444
444
|
}
|
|
445
445
|
logTailwindcssTarget("cli", ctx.twPatcher, ctx.tailwindcssBasedir);
|
|
446
446
|
await ctx.twPatcher.patch();
|
|
447
|
-
const shouldRecordTarget = toBoolean(options.recordTarget,
|
|
447
|
+
const shouldRecordTarget = toBoolean(options.recordTarget, true);
|
|
448
448
|
if (shouldRecordTarget) {
|
|
449
449
|
const recordPath = await saveCliPatchTargetRecord(ctx.tailwindcssBasedir, ctx.twPatcher);
|
|
450
450
|
if (recordPath) {
|
package/dist/core.js
CHANGED
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkACSKKIYMjs = require('./chunk-ACSKKIYM.js');
|
|
7
|
+
require('./chunk-467NHGLF.js');
|
|
8
8
|
require('./chunk-ZSTF2AEN.js');
|
|
9
9
|
require('./chunk-UW3WHSZ5.js');
|
|
10
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-UJIUFWXE.js');
|
|
11
11
|
|
|
12
12
|
// src/core.ts
|
|
13
13
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
14
14
|
function createContext(options = {}) {
|
|
15
|
-
const opts =
|
|
15
|
+
const opts = _chunkACSKKIYMjs.getCompilerContext.call(void 0, options);
|
|
16
16
|
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
17
17
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
18
18
|
const runtimeState = {
|
|
19
19
|
twPatcher: initialTwPatcher,
|
|
20
|
-
patchPromise:
|
|
20
|
+
patchPromise: _chunkACSKKIYMjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
21
21
|
refreshTailwindcssPatcher
|
|
22
22
|
};
|
|
23
23
|
async function refreshRuntimeState(force) {
|
|
24
|
-
await
|
|
24
|
+
await _chunkACSKKIYMjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
25
25
|
}
|
|
26
26
|
async function transformWxss(rawCss, options2) {
|
|
27
27
|
await runtimeState.patchPromise;
|
|
@@ -30,7 +30,7 @@ function createContext(options = {}) {
|
|
|
30
30
|
}));
|
|
31
31
|
await refreshRuntimeState(true);
|
|
32
32
|
await runtimeState.patchPromise;
|
|
33
|
-
runtimeSet = await
|
|
33
|
+
runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
34
34
|
return result;
|
|
35
35
|
}
|
|
36
36
|
async function transformJs(rawJs, options2 = {}) {
|
|
@@ -40,7 +40,7 @@ function createContext(options = {}) {
|
|
|
40
40
|
} else {
|
|
41
41
|
await refreshRuntimeState(true);
|
|
42
42
|
await runtimeState.patchPromise;
|
|
43
|
-
runtimeSet = await
|
|
43
|
+
runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
44
44
|
}
|
|
45
45
|
return await jsHandler(rawJs, runtimeSet, options2);
|
|
46
46
|
}
|
|
@@ -49,7 +49,7 @@ function createContext(options = {}) {
|
|
|
49
49
|
if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
|
|
50
50
|
await refreshRuntimeState(true);
|
|
51
51
|
await runtimeState.patchPromise;
|
|
52
|
-
runtimeSet = await
|
|
52
|
+
runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
53
53
|
}
|
|
54
54
|
return templateHandler(rawWxml, _shared.defuOverrideArray.call(void 0, options2, {
|
|
55
55
|
runtimeSet
|
package/dist/core.mjs
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
createTailwindPatchPromise,
|
|
4
4
|
getCompilerContext,
|
|
5
5
|
refreshTailwindRuntimeState
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-W4ERVC6L.mjs";
|
|
7
|
+
import "./chunk-HCXLLOIU.mjs";
|
|
8
8
|
import "./chunk-DKPIYG24.mjs";
|
|
9
9
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-QGH4JZRW.mjs";
|
|
11
11
|
|
|
12
12
|
// src/core.ts
|
|
13
13
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
package/dist/css-macro.js
CHANGED
|
@@ -5,7 +5,7 @@ var _chunkNS3NEDWDjs = require('./chunk-NS3NEDWD.js');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-UJIUFWXE.js');
|
|
9
9
|
|
|
10
10
|
// src/css-macro/index.ts
|
|
11
11
|
var _plugin = require('tailwindcss/plugin'); var _plugin2 = _interopRequireDefault(_plugin);
|