weapp-tailwindcss 4.10.0-beta.2 → 4.10.0-beta.4
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-7ATL22KK.mjs → chunk-3A7VW4BZ.mjs} +3 -3
- package/dist/{chunk-EGOFMIDI.mjs → chunk-3WUHHFLF.mjs} +1 -0
- package/dist/{chunk-3RGU475C.js → chunk-5APD2MNV.js} +163 -77
- package/dist/{chunk-LBZCKOMT.js → chunk-5U24PLVV.js} +1 -0
- package/dist/{chunk-UCDOKKRH.js → chunk-BFZDZRA5.js} +28 -16
- package/dist/{chunk-QOWSZHYT.js → chunk-GQVBN7UT.js} +3 -3
- package/dist/{chunk-Q7TIBSU2.mjs → chunk-JP45MK3F.mjs} +1 -1
- package/dist/{chunk-AGF55OIE.mjs → chunk-KAK3XMAW.mjs} +2 -2
- package/dist/{chunk-GFJYJ6WV.js → chunk-OCV5QLZM.js} +27 -27
- package/dist/{chunk-D3I6GQUV.mjs → chunk-OYR4XWM4.mjs} +16 -4
- package/dist/{chunk-YS2V3XY2.js → chunk-PLI5CO4U.js} +50 -25
- package/dist/{chunk-7D27E7TU.mjs → chunk-QOTLDKI4.mjs} +131 -45
- package/dist/{chunk-2KAM7AAG.mjs → chunk-UELU5NFH.mjs} +33 -8
- package/dist/{chunk-F7FBGRWS.js → chunk-WQPYYMRL.js} +7 -7
- package/dist/{chunk-FIJF6OL7.mjs → chunk-XCKQ4YQM.mjs} +2 -2
- package/dist/{chunk-FLJBD5TW.js → chunk-Y6OZDS7V.js} +5 -5
- package/dist/cli.js +46 -46
- package/dist/cli.mjs +10 -10
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +9 -9
- package/dist/core.mjs +4 -4
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +2 -2
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +5 -5
- package/dist/{index-vGuAfNvT.d.mts → index-B6U7MoOM.d.mts} +13 -1
- package/dist/{index-vGuAfNvT.d.ts → index-B6U7MoOM.d.ts} +13 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.mjs +8 -8
- package/dist/presets.d.mts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +8 -8
- package/dist/presets.mjs +5 -5
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +5 -5
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +6 -6
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +28 -28
- package/dist/webpack4.mjs +5 -5
- package/package.json +5 -5
|
@@ -79,6 +79,9 @@ function hasConfiguredCssEntries(ctx) {
|
|
|
79
79
|
}
|
|
80
80
|
const patcherOptions = ctx.tailwindcssPatcherOptions;
|
|
81
81
|
if (patcherOptions) {
|
|
82
|
+
if (normalizeCssEntriesConfig(patcherOptions.tailwindcss?.v4?.cssEntries)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
82
85
|
if (normalizeCssEntriesConfig(patcherOptions.tailwind?.v4?.cssEntries)) {
|
|
83
86
|
return true;
|
|
84
87
|
}
|
|
@@ -232,8 +235,10 @@ function normalizeTailwindcssPatcherOptions(options) {
|
|
|
232
235
|
if (cache !== void 0) {
|
|
233
236
|
normalized.cache = cache;
|
|
234
237
|
}
|
|
238
|
+
const apply = {};
|
|
239
|
+
const extract = {};
|
|
235
240
|
if (patch?.overwrite !== void 0) {
|
|
236
|
-
|
|
241
|
+
apply.overwrite = patch.overwrite;
|
|
237
242
|
}
|
|
238
243
|
if (patch?.filter) {
|
|
239
244
|
normalized.filter = patch.filter;
|
|
@@ -241,14 +246,12 @@ function normalizeTailwindcssPatcherOptions(options) {
|
|
|
241
246
|
const extendLengthUnits = normalizeExtendLengthUnits(patch?.applyPatches?.extendLengthUnits);
|
|
242
247
|
const exposeContext = patch?.applyPatches?.exportContext;
|
|
243
248
|
if (extendLengthUnits !== void 0 || exposeContext !== void 0) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
extendLengthUnits
|
|
247
|
-
};
|
|
249
|
+
apply.exposeContext = exposeContext;
|
|
250
|
+
apply.extendLengthUnits = extendLengthUnits;
|
|
248
251
|
}
|
|
249
252
|
const cwd = patch?.cwd ?? patch?.basedir;
|
|
250
253
|
if (cwd) {
|
|
251
|
-
normalized.
|
|
254
|
+
normalized.projectRoot = cwd;
|
|
252
255
|
}
|
|
253
256
|
const tailwindOptions = patch?.tailwindcss ? { ...patch.tailwindcss } : void 0;
|
|
254
257
|
const legacyResolve = patch?.resolve;
|
|
@@ -269,14 +272,92 @@ function normalizeTailwindcssPatcherOptions(options) {
|
|
|
269
272
|
...resolveOptions ?? {},
|
|
270
273
|
...legacyResolve ?? {}
|
|
271
274
|
} : void 0;
|
|
272
|
-
normalized.
|
|
275
|
+
normalized.tailwindcss = {
|
|
273
276
|
...nextTailwindOptions ?? {},
|
|
274
277
|
...mergedResolve ? { resolve: mergedResolve } : {}
|
|
275
278
|
};
|
|
276
279
|
}
|
|
277
|
-
|
|
280
|
+
if (patch?.output) {
|
|
281
|
+
if (patch.output.filename !== void 0) {
|
|
282
|
+
extract.file = patch.output.filename;
|
|
283
|
+
}
|
|
284
|
+
if (patch.output.loose !== void 0) {
|
|
285
|
+
extract.pretty = patch.output.loose ? 2 : false;
|
|
286
|
+
}
|
|
287
|
+
if (patch.output.removeUniversalSelector !== void 0) {
|
|
288
|
+
extract.removeUniversalSelector = patch.output.removeUniversalSelector;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (Object.keys(apply).length > 0) {
|
|
292
|
+
normalized.apply = apply;
|
|
293
|
+
}
|
|
294
|
+
if (Object.keys(extract).length > 0) {
|
|
295
|
+
normalized.extract = extract;
|
|
296
|
+
}
|
|
297
|
+
return toModernTailwindcssPatchOptions(normalized);
|
|
298
|
+
}
|
|
299
|
+
return toModernTailwindcssPatchOptions(options);
|
|
300
|
+
}
|
|
301
|
+
function toModernTailwindcssPatchOptions(options) {
|
|
302
|
+
if (!options) {
|
|
303
|
+
return void 0;
|
|
304
|
+
}
|
|
305
|
+
const normalized = {};
|
|
306
|
+
if (options.cache !== void 0) {
|
|
307
|
+
normalized.cache = options.cache;
|
|
308
|
+
}
|
|
309
|
+
if (options.filter) {
|
|
310
|
+
normalized.filter = options.filter;
|
|
311
|
+
}
|
|
312
|
+
const projectRoot = options.projectRoot ?? options.cwd;
|
|
313
|
+
if (projectRoot) {
|
|
314
|
+
normalized.projectRoot = projectRoot;
|
|
315
|
+
}
|
|
316
|
+
const tailwindcss = options.tailwindcss ?? options.tailwind;
|
|
317
|
+
if (tailwindcss) {
|
|
318
|
+
normalized.tailwindcss = {
|
|
319
|
+
...tailwindcss
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
const apply = {
|
|
323
|
+
...options.apply ?? {}
|
|
324
|
+
};
|
|
325
|
+
if (apply.overwrite === void 0 && options.overwrite !== void 0) {
|
|
326
|
+
apply.overwrite = options.overwrite;
|
|
327
|
+
}
|
|
328
|
+
if (apply.exposeContext === void 0 && options.features?.exposeContext !== void 0) {
|
|
329
|
+
apply.exposeContext = options.features.exposeContext;
|
|
330
|
+
}
|
|
331
|
+
if (apply.extendLengthUnits === void 0 && options.features?.extendLengthUnits !== void 0) {
|
|
332
|
+
apply.extendLengthUnits = options.features.extendLengthUnits;
|
|
333
|
+
}
|
|
334
|
+
if (Object.keys(apply).length > 0) {
|
|
335
|
+
normalized.apply = apply;
|
|
336
|
+
}
|
|
337
|
+
const extract = {
|
|
338
|
+
...options.extract ?? {}
|
|
339
|
+
};
|
|
340
|
+
if (options.output) {
|
|
341
|
+
if (extract.write === void 0 && options.output.enabled !== void 0) {
|
|
342
|
+
extract.write = options.output.enabled;
|
|
343
|
+
}
|
|
344
|
+
if (extract.file === void 0 && options.output.file !== void 0) {
|
|
345
|
+
extract.file = options.output.file;
|
|
346
|
+
}
|
|
347
|
+
if (extract.format === void 0 && options.output.format !== void 0) {
|
|
348
|
+
extract.format = options.output.format;
|
|
349
|
+
}
|
|
350
|
+
if (extract.pretty === void 0 && options.output.pretty !== void 0) {
|
|
351
|
+
extract.pretty = options.output.pretty;
|
|
352
|
+
}
|
|
353
|
+
if (extract.removeUniversalSelector === void 0 && options.output.removeUniversalSelector !== void 0) {
|
|
354
|
+
extract.removeUniversalSelector = options.output.removeUniversalSelector;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (Object.keys(extract).length > 0) {
|
|
358
|
+
normalized.extract = extract;
|
|
278
359
|
}
|
|
279
|
-
return
|
|
360
|
+
return normalized;
|
|
280
361
|
}
|
|
281
362
|
|
|
282
363
|
// src/tailwindcss/patcher-resolve.ts
|
|
@@ -479,71 +560,74 @@ function createTailwindcssPatcher(options) {
|
|
|
479
560
|
}
|
|
480
561
|
}
|
|
481
562
|
const baseOptions = {
|
|
482
|
-
|
|
563
|
+
projectRoot: normalizedBasedir,
|
|
483
564
|
cache,
|
|
484
|
-
|
|
485
|
-
|
|
565
|
+
tailwindcss: baseTailwindOptions,
|
|
566
|
+
apply: {
|
|
486
567
|
exposeContext: true,
|
|
487
568
|
extendLengthUnits
|
|
488
569
|
}
|
|
489
570
|
};
|
|
490
|
-
const
|
|
571
|
+
const mergedOptions = defuOverrideArray2(
|
|
491
572
|
normalizedUserOptions ?? {},
|
|
492
573
|
baseOptions
|
|
493
574
|
);
|
|
494
|
-
|
|
495
|
-
|
|
575
|
+
const resolvedOptions = toModernTailwindcssPatchOptions(mergedOptions) ?? {};
|
|
576
|
+
const resolvedTailwindOptions = resolvedOptions.tailwindcss;
|
|
577
|
+
if (resolvedTailwindOptions) {
|
|
578
|
+
const existingResolve = resolvedTailwindOptions.resolve ?? {};
|
|
496
579
|
const customPaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0;
|
|
497
580
|
const sourcePaths = customPaths ? existingResolve.paths : resolvePaths;
|
|
498
|
-
|
|
581
|
+
resolvedTailwindOptions.resolve = {
|
|
499
582
|
...existingResolve,
|
|
500
583
|
paths: Array.from(new Set(sourcePaths))
|
|
501
584
|
};
|
|
502
585
|
logger3.debug("Tailwind resolve config %O", {
|
|
503
|
-
packageName:
|
|
504
|
-
version:
|
|
505
|
-
resolve:
|
|
506
|
-
cwd:
|
|
586
|
+
packageName: resolvedTailwindOptions.packageName,
|
|
587
|
+
version: resolvedTailwindOptions.version,
|
|
588
|
+
resolve: resolvedTailwindOptions.resolve,
|
|
589
|
+
cwd: resolvedTailwindOptions.cwd
|
|
507
590
|
});
|
|
508
|
-
if (typeof
|
|
591
|
+
if (typeof resolvedTailwindOptions.postcssPlugin === "string") {
|
|
509
592
|
const resolvedPlugin = resolveModuleFromPaths(
|
|
510
|
-
|
|
511
|
-
|
|
593
|
+
resolvedTailwindOptions.postcssPlugin,
|
|
594
|
+
resolvedTailwindOptions.resolve?.paths ?? resolvePaths
|
|
512
595
|
);
|
|
513
596
|
if (resolvedPlugin) {
|
|
514
|
-
|
|
597
|
+
resolvedTailwindOptions.postcssPlugin = resolvedPlugin;
|
|
515
598
|
}
|
|
516
599
|
}
|
|
517
600
|
const searchRoots = /* @__PURE__ */ new Set();
|
|
518
|
-
if (
|
|
519
|
-
searchRoots.add(
|
|
601
|
+
if (resolvedTailwindOptions.cwd) {
|
|
602
|
+
searchRoots.add(resolvedTailwindOptions.cwd);
|
|
520
603
|
}
|
|
521
|
-
for (const resolvePath of
|
|
604
|
+
for (const resolvePath of resolvedTailwindOptions.resolve?.paths ?? []) {
|
|
522
605
|
const parentDir = path3.dirname(resolvePath);
|
|
523
606
|
searchRoots.add(parentDir);
|
|
524
607
|
}
|
|
525
608
|
const configPath = findTailwindConfig(searchRoots);
|
|
526
|
-
if (!
|
|
609
|
+
if (!resolvedTailwindOptions.config) {
|
|
527
610
|
if (configPath) {
|
|
528
|
-
|
|
611
|
+
resolvedTailwindOptions.config = configPath;
|
|
529
612
|
} else {
|
|
530
613
|
const fallbackConfig = resolveTailwindConfigFallback(
|
|
531
|
-
|
|
532
|
-
|
|
614
|
+
resolvedTailwindOptions.packageName,
|
|
615
|
+
resolvedTailwindOptions.resolve.paths ?? resolvePaths
|
|
533
616
|
);
|
|
534
617
|
if (fallbackConfig) {
|
|
535
|
-
|
|
618
|
+
resolvedTailwindOptions.config = fallbackConfig;
|
|
536
619
|
}
|
|
537
620
|
}
|
|
538
621
|
}
|
|
539
|
-
if (!
|
|
540
|
-
|
|
622
|
+
if (!resolvedTailwindOptions.cwd && configPath) {
|
|
623
|
+
resolvedTailwindOptions.cwd = path3.dirname(configPath);
|
|
541
624
|
}
|
|
625
|
+
resolvedOptions.tailwindcss = resolvedTailwindOptions;
|
|
542
626
|
}
|
|
543
627
|
try {
|
|
544
628
|
return new TailwindcssPatcher(resolvedOptions);
|
|
545
629
|
} catch (error) {
|
|
546
|
-
const searchPaths = resolvedOptions.
|
|
630
|
+
const searchPaths = resolvedOptions.tailwindcss?.resolve?.paths;
|
|
547
631
|
if (error instanceof Error && /tailwindcss not found/i.test(error.message)) {
|
|
548
632
|
if (!hasLoggedMissingTailwind) {
|
|
549
633
|
logger3.warn("Tailwind CSS \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7 Tailwind \u76F8\u5173\u8865\u4E01\u3002\u82E5\u9700\u4F7F\u7528 Tailwind \u80FD\u529B\uFF0C\u8BF7\u5B89\u88C5 tailwindcss\u3002");
|
|
@@ -552,7 +636,7 @@ function createTailwindcssPatcher(options) {
|
|
|
552
636
|
return createFallbackTailwindcssPatcher();
|
|
553
637
|
}
|
|
554
638
|
if (error instanceof Error && /unable to locate tailwind css package/i.test(error.message)) {
|
|
555
|
-
logger3.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', resolvedOptions.
|
|
639
|
+
logger3.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', resolvedOptions.tailwindcss?.packageName, searchPaths);
|
|
556
640
|
}
|
|
557
641
|
throw error;
|
|
558
642
|
}
|
|
@@ -694,17 +778,19 @@ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries)
|
|
|
694
778
|
if (!isModernTailwindcssPatchOptions(options)) {
|
|
695
779
|
return options;
|
|
696
780
|
}
|
|
697
|
-
|
|
781
|
+
const modernTailwind = options.tailwindcss ?? options.tailwind;
|
|
782
|
+
if (!modernTailwind) {
|
|
698
783
|
return options;
|
|
699
784
|
}
|
|
785
|
+
const { tailwind: _legacyTailwind, ...rest } = options;
|
|
700
786
|
return {
|
|
701
|
-
...
|
|
702
|
-
|
|
703
|
-
...
|
|
787
|
+
...rest,
|
|
788
|
+
tailwindcss: {
|
|
789
|
+
...modernTailwind,
|
|
704
790
|
v4: {
|
|
705
|
-
...
|
|
706
|
-
...hasCssEntries ? {} : { base:
|
|
707
|
-
cssEntries: hasCssEntries ? cssEntries :
|
|
791
|
+
...modernTailwind.v4 ?? {},
|
|
792
|
+
...hasCssEntries ? {} : { base: modernTailwind.v4?.base ?? baseDir },
|
|
793
|
+
cssEntries: hasCssEntries ? cssEntries : modernTailwind.v4?.cssEntries ?? cssEntries
|
|
708
794
|
}
|
|
709
795
|
}
|
|
710
796
|
};
|
|
@@ -843,8 +929,8 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
843
929
|
baseDir,
|
|
844
930
|
cssEntries ?? []
|
|
845
931
|
);
|
|
846
|
-
const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwind?.packageName || tailwindcssPatcherOptions?.patch?.tailwindcss?.packageName;
|
|
847
|
-
const configuredVersion = tailwindcss?.version || tailwindcssPatcherOptions?.tailwind?.version || tailwindcssPatcherOptions?.patch?.tailwindcss?.version || mergedTailwindOptions.version;
|
|
932
|
+
const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwind?.packageName || tailwindcssPatcherOptions?.patch?.tailwindcss?.packageName;
|
|
933
|
+
const configuredVersion = tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || tailwindcssPatcherOptions?.tailwind?.version || tailwindcssPatcherOptions?.patch?.tailwindcss?.version || mergedTailwindOptions.version;
|
|
848
934
|
const isTailwindcss4Package = (packageName) => Boolean(
|
|
849
935
|
packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4"))
|
|
850
936
|
);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-RRHPTTCP.mjs";
|
|
13
13
|
import {
|
|
14
14
|
setupPatchRecorder
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KAK3XMAW.mjs";
|
|
16
16
|
import {
|
|
17
17
|
collectRuntimeClassSet,
|
|
18
18
|
createAttributeMatcher,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
replaceWxml,
|
|
25
25
|
toCustomAttributesEntities,
|
|
26
26
|
vitePluginName
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-OYR4XWM4.mjs";
|
|
28
28
|
import {
|
|
29
29
|
resolveUniUtsPlatform
|
|
30
30
|
} from "./chunk-OOHJLO5M.mjs";
|
|
@@ -661,6 +661,24 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
|
661
661
|
}
|
|
662
662
|
return `${runtimeSignature}:linked:${linkedImpactSignature}`;
|
|
663
663
|
}
|
|
664
|
+
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
665
|
+
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
666
|
+
}
|
|
667
|
+
function resolveViteStaleClassNameFallback(option, resolvedConfig) {
|
|
668
|
+
if (typeof option === "boolean") {
|
|
669
|
+
return option;
|
|
670
|
+
}
|
|
671
|
+
if (!resolvedConfig) {
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
if (resolvedConfig.command === "serve") {
|
|
675
|
+
return true;
|
|
676
|
+
}
|
|
677
|
+
if (resolvedConfig.command === "build" && resolvedConfig.build?.watch) {
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
return false;
|
|
681
|
+
}
|
|
664
682
|
function createGenerateBundleHook(context) {
|
|
665
683
|
const state = {
|
|
666
684
|
iteration: 0,
|
|
@@ -697,15 +715,18 @@ function createGenerateBundleHook(context) {
|
|
|
697
715
|
debug2("start");
|
|
698
716
|
onStart();
|
|
699
717
|
const metrics = createEmptyMetrics();
|
|
700
|
-
const
|
|
718
|
+
const forceRuntimeRefreshByEnv = process2.env.WEAPP_TW_VITE_FORCE_RUNTIME_REFRESH === "1";
|
|
701
719
|
const disableDirtyOptimization = process2.env.WEAPP_TW_VITE_DISABLE_DIRTY === "1";
|
|
702
720
|
const disableJsPrecheck = process2.env.WEAPP_TW_VITE_DISABLE_JS_PRECHECK === "1";
|
|
703
721
|
const debugCssDiff = process2.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
|
|
704
722
|
const entries = Object.entries(bundle);
|
|
705
723
|
const dirtyEntries = computeDirtyEntries(entries, opts, state);
|
|
724
|
+
const forceRuntimeRefreshBySource = hasRuntimeAffectingSourceChanges(dirtyEntries.changedByType);
|
|
725
|
+
const forceRuntimeRefresh = forceRuntimeRefreshByEnv || forceRuntimeRefreshBySource;
|
|
706
726
|
const processSets = buildProcessSets(entries, opts, dirtyEntries.changedByType, state.previousLinkedByEntry, disableDirtyOptimization);
|
|
707
727
|
const processFiles = processSets.files;
|
|
708
728
|
const resolvedConfig = getResolvedConfig();
|
|
729
|
+
const staleClassNameFallback = resolveViteStaleClassNameFallback(opts.staleClassNameFallback, resolvedConfig);
|
|
709
730
|
const rootDir = resolvedConfig?.root ? path2.resolve(resolvedConfig.root) : process2.cwd();
|
|
710
731
|
const outDir = resolvedConfig?.build?.outDir ? path2.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
711
732
|
const jsEntries = /* @__PURE__ */ new Map();
|
|
@@ -720,6 +741,13 @@ function createGenerateBundleHook(context) {
|
|
|
720
741
|
const runtimeStart = performance.now();
|
|
721
742
|
const runtime = await ensureRuntimeClassSet(forceRuntimeRefresh);
|
|
722
743
|
metrics.runtimeSet = measureElapsed(runtimeStart);
|
|
744
|
+
if (forceRuntimeRefreshBySource) {
|
|
745
|
+
debug2(
|
|
746
|
+
"runtimeSet forced refresh due to source changes: html=%d js=%d",
|
|
747
|
+
dirtyEntries.changedByType.html.size,
|
|
748
|
+
dirtyEntries.changedByType.js.size
|
|
749
|
+
);
|
|
750
|
+
}
|
|
723
751
|
debug2("get runtimeSet, class count: %d", runtime.size);
|
|
724
752
|
const runtimeSignature = getRuntimeClassSetSignature(runtimeState.twPatcher) ?? "runtime:missing";
|
|
725
753
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
@@ -741,6 +769,7 @@ function createGenerateBundleHook(context) {
|
|
|
741
769
|
};
|
|
742
770
|
const createHandlerOptions = (absoluteFilename, extra) => ({
|
|
743
771
|
...extra,
|
|
772
|
+
staleClassNameFallback: extra?.staleClassNameFallback ?? staleClassNameFallback,
|
|
744
773
|
filename: absoluteFilename,
|
|
745
774
|
moduleGraph: moduleGraphOptions,
|
|
746
775
|
babelParserOptions: {
|
|
@@ -965,11 +994,7 @@ function createGenerateBundleHook(context) {
|
|
|
965
994
|
apply();
|
|
966
995
|
}
|
|
967
996
|
state.iteration += 1;
|
|
968
|
-
|
|
969
|
-
for (const [fileName, output] of entries) {
|
|
970
|
-
finalSourceHashByFile.set(fileName, opts.cache.computeHash(readEntrySource(output)));
|
|
971
|
-
}
|
|
972
|
-
state.previousSourceHashByFile = finalSourceHashByFile;
|
|
997
|
+
state.previousSourceHashByFile = dirtyEntries.sourceHashByFile;
|
|
973
998
|
state.changedByType = dirtyEntries.changedByType;
|
|
974
999
|
const nextLinkedByEntry = new Map(state.previousLinkedByEntry);
|
|
975
1000
|
for (const [entryFile, linkedFiles] of linkedByEntry.entries()) {
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkY6OZDS7Vjs = require('./chunk-Y6OZDS7V.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkBFZDZRA5js = require('./chunk-BFZDZRA5.js');
|
|
13
13
|
|
|
14
14
|
// src/bundlers/gulp/index.ts
|
|
15
15
|
var _buffer = require('buffer');
|
|
@@ -17,12 +17,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
|
17
17
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
18
18
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
19
19
|
var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
20
|
-
var debug =
|
|
20
|
+
var debug = _chunkBFZDZRA5js.createDebug.call(void 0, );
|
|
21
21
|
var Transform = _stream2.default.Transform;
|
|
22
22
|
function createPlugins(options = {}) {
|
|
23
|
-
const opts =
|
|
23
|
+
const opts = _chunkBFZDZRA5js.getCompilerContext.call(void 0, options);
|
|
24
24
|
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
25
|
-
const patchRecorderState =
|
|
25
|
+
const patchRecorderState = _chunkY6OZDS7Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
26
26
|
source: "runtime",
|
|
27
27
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
28
28
|
});
|
|
@@ -36,13 +36,13 @@ function createPlugins(options = {}) {
|
|
|
36
36
|
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
37
37
|
let runtimeSetInitialized = false;
|
|
38
38
|
async function refreshRuntimeState(force) {
|
|
39
|
-
await
|
|
39
|
+
await _chunkBFZDZRA5js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
40
40
|
}
|
|
41
41
|
async function refreshRuntimeSet(force = false) {
|
|
42
42
|
if (!force && runtimeSetInitialized) {
|
|
43
43
|
return runtimeSet;
|
|
44
44
|
}
|
|
45
|
-
runtimeSet = await
|
|
45
|
+
runtimeSet = await _chunkBFZDZRA5js.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
46
46
|
forceRefresh: force,
|
|
47
47
|
forceCollect: force,
|
|
48
48
|
clearCache: force,
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-RRHPTTCP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
setupPatchRecorder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KAK3XMAW.mjs";
|
|
7
7
|
import {
|
|
8
8
|
createDebug,
|
|
9
9
|
ensureRuntimeClassSet,
|
|
10
10
|
getCompilerContext,
|
|
11
11
|
refreshTailwindRuntimeState
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OYR4XWM4.mjs";
|
|
13
13
|
|
|
14
14
|
// src/bundlers/gulp/index.ts
|
|
15
15
|
import { Buffer } from "buffer";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkBFZDZRA5js = require('./chunk-BFZDZRA5.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk5APD2MNVjs = require('./chunk-5APD2MNV.js');
|
|
8
8
|
|
|
9
9
|
// src/tailwindcss/recorder.ts
|
|
10
10
|
function setupPatchRecorder(patcher, baseDir, options) {
|
|
11
|
-
const recorder =
|
|
11
|
+
const recorder = _chunkBFZDZRA5js.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
|
|
12
12
|
if (_optionalChain([recorder, 'optionalAccess', _ => _.message]) && _optionalChain([options, 'optionalAccess', _2 => _2.logMessage]) !== false) {
|
|
13
13
|
const prefix = _optionalChain([options, 'optionalAccess', _3 => _3.messagePrefix]) ? `${options.messagePrefix} ` : "";
|
|
14
|
-
|
|
14
|
+
_chunk5APD2MNVjs.logger.info("%s%s", prefix, recorder.message);
|
|
15
15
|
}
|
|
16
16
|
const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _4 => _4.onPatched]) ? async () => {
|
|
17
17
|
await recorder.onPatched();
|
|
18
18
|
} : void 0;
|
|
19
|
-
const patchPromise = patcher ?
|
|
19
|
+
const patchPromise = patcher ? _chunkBFZDZRA5js.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
|
|
20
20
|
return {
|
|
21
21
|
recorder,
|
|
22
22
|
patchPromise,
|