weapp-tailwindcss 5.0.13 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/auto-Ba6hDrse.mjs +13 -0
- package/dist/auto-DtU6f3X6.js +18 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +21 -9
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +0 -1
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +3 -3
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/types.d.ts +13 -1
- package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -1
- package/dist/bundlers/shared/run-tasks.d.ts +1 -0
- package/dist/bundlers/shared/v4-generation-core.d.ts +11 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- package/dist/bundlers/vite/css-memory.d.ts +10 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +0 -1
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-output.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +0 -1
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +12 -0
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +21 -18
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +3 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle.d.ts +3 -1
- package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +3 -3
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -5
- package/dist/bundlers/vite/source-candidates/script.d.ts +1 -7
- package/dist/bundlers/vite/source-candidates.d.ts +9 -2
- package/dist/bundlers/vite/source-scan/css-entries.d.ts +2 -6
- package/dist/bundlers/vite/source-scan.d.ts +2 -2
- package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
- package/dist/bundlers/vite/utils.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +24 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -11
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -2
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +10 -1
- package/dist/bundlers/webpack/shared/css-loader-runtime.d.ts +1 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cli/mount-options.d.ts +2 -2
- package/dist/cli.js +124 -437
- package/dist/cli.mjs +120 -433
- package/dist/context/index.d.ts +3 -3
- package/dist/context/style-options.d.ts +4 -1
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/{precheck-B0Z8yW7E.js → context-BHxLe743.js} +391 -153
- package/dist/{precheck-CRI90iL1.mjs → context-Mbzkek1q.mjs} +368 -137
- package/dist/core.js +15 -12
- package/dist/core.mjs +10 -7
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{defaults-C_J_kBpw.js → defaults-CVcKbXBG.js} +4 -15
- package/dist/{defaults-Bqx18S1f.mjs → defaults-ZElj1zKc.mjs} +5 -10
- package/dist/defaults.d.ts +1 -7
- package/dist/defaults.js +1 -2
- package/dist/defaults.mjs +2 -2
- package/dist/generator/index.d.ts +6 -7
- package/dist/generator/options.d.ts +3 -3
- package/dist/generator/types.d.ts +9 -10
- package/dist/generator-9rUz4Hcb.js +170 -0
- package/dist/generator-Dc4qaPmT.mjs +123 -0
- package/dist/generator.js +10 -16
- package/dist/generator.mjs +3 -3
- package/dist/{gulp-XT8Jc7lH.js → gulp-B_sdP6dx.js} +47 -87
- package/dist/{gulp-DfOQERcV.mjs → gulp-uM36oIJs.mjs} +40 -80
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DQIP_8qP.mjs → hmr-timing-BXMLsF4b.mjs} +1145 -842
- package/dist/{hmr-timing-BMftW7Us.js → hmr-timing-CogqkFaF.js} +1262 -881
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/fast-path/oxc.d.ts +4 -0
- package/dist/js/precheck.d.ts +1 -0
- package/dist/postcss.js +3 -4
- package/dist/postcss.mjs +2 -3
- package/dist/presets.js +9 -19
- package/dist/presets.mjs +8 -18
- package/dist/runtime-branch/create-branch.d.ts +2 -0
- package/dist/runtime-branch/generator-target-env.d.ts +4 -0
- package/dist/runtime-branch/index.d.ts +6 -0
- package/dist/runtime-branch/mini-program.d.ts +2 -0
- package/dist/runtime-branch/native-app.d.ts +2 -0
- package/dist/runtime-branch/platform.d.ts +6 -0
- package/dist/runtime-branch/tailwind-version.d.ts +2 -0
- package/dist/runtime-branch/types.d.ts +37 -0
- package/dist/runtime-branch/web.d.ts +2 -0
- package/dist/runtime-branch.d.ts +1 -0
- package/dist/{bundle-state-CKWeTEhv.js → source-candidate-scan-signature-2ybpptAK.js} +261 -19
- package/dist/{bundle-state-zQ2MrDdi.mjs → source-candidate-scan-signature-Cvb5z1ha.mjs} +187 -17
- package/dist/tailwindcss/candidates.d.ts +7 -0
- package/dist/tailwindcss/index.d.ts +2 -2
- package/dist/tailwindcss/runtime/cache.d.ts +6 -6
- package/dist/tailwindcss/runtime-factory.d.ts +12 -0
- package/dist/tailwindcss/runtime-options.d.ts +8 -0
- package/dist/tailwindcss/runtime-types.d.ts +86 -0
- package/dist/tailwindcss/runtime.d.ts +6 -6
- package/dist/tailwindcss/source-scan.d.ts +1 -1
- package/dist/tailwindcss/targets.d.ts +2 -2
- package/dist/tailwindcss/v4/config.d.ts +3 -3
- package/dist/tailwindcss/v4/css-entries.d.ts +1 -0
- package/dist/tailwindcss/v4/css-sources.d.ts +4 -2
- package/dist/tailwindcss/v4/index.d.ts +1 -1
- package/dist/tailwindcss/v4/multi-runtime.d.ts +2 -0
- package/dist/tailwindcss/v4/runtime-factory.d.ts +15 -0
- package/dist/tailwindcss/v4/runtime-options.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +3 -3
- package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator.d.ts +10 -3
- package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +7 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +23 -6
- package/dist/tailwindcss/v4-engine/types.d.ts +8 -9
- package/dist/tailwindcss/version.d.ts +1 -1
- package/dist/tailwindcss-DHIYcqXT.js +1523 -0
- package/dist/tailwindcss-wyUHrfil.mjs +1418 -0
- package/dist/{transform-YmrmxuF3.js → transform-CQVOgmzM.js} +17 -17
- package/dist/{transform-DfcEjsZF.mjs → transform-tExdt40m.mjs} +2 -2
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +16 -17
- package/dist/types/shared.d.ts +1 -1
- package/dist/types/{typedoc-tailwindcss-patch.d.ts → typedoc-tailwindcss-runtime.d.ts} +4 -10
- package/dist/types/user-defined-options/general.d.ts +5 -3
- package/dist/types/user-defined-options/important.d.ts +2 -2
- package/dist/uni-app-x/style-asset.d.ts +1 -0
- package/dist/v4-engine-CF9zt4Cw.mjs +2396 -0
- package/dist/v4-engine-D4ubP7N5.js +2778 -0
- package/dist/{vite-CXHVsHmX.js → vite-CP0ylSxZ.js} +1081 -542
- package/dist/{vite-DjI09vVN.mjs → vite-CPO83EhA.mjs} +916 -376
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5350 -4165
- package/dist/weapp-tw-runtime-classset-loader.js +15 -4
- package/dist/webpack-Bsek8VhR.js +2094 -0
- package/dist/webpack-BzqhJ8yK.mjs +2082 -0
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -5
- package/dist/auto-CTp6wE5a.js +0 -33
- package/dist/auto-Cl8_hsG6.mjs +0 -22
- package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +0 -13
- package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +0 -1
- package/dist/context/tailwindcss/rax.d.ts +0 -2
- package/dist/generator-CzpArpCL.js +0 -92
- package/dist/generator-ITLd7PTl.mjs +0 -67
- package/dist/tailwindcss/patcher-options.d.ts +0 -8
- package/dist/tailwindcss/patcher.d.ts +0 -12
- package/dist/tailwindcss/runtime-patch.d.ts +0 -5
- package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +0 -3
- package/dist/tailwindcss/v3-engine/generator/content.d.ts +0 -10
- package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +0 -2
- package/dist/tailwindcss/v3-engine/generator.d.ts +0 -19
- package/dist/tailwindcss/v3-engine/index.d.ts +0 -4
- package/dist/tailwindcss/v3-engine/miniprogram.d.ts +0 -4
- package/dist/tailwindcss/v3-engine/source.d.ts +0 -5
- package/dist/tailwindcss/v3-engine/types.d.ts +0 -61
- package/dist/tailwindcss/v4/multi-patcher.d.ts +0 -2
- package/dist/tailwindcss/v4/patcher-options.d.ts +0 -2
- package/dist/tailwindcss/v4/patcher.d.ts +0 -15
- package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +0 -1
- package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +0 -1
- package/dist/tailwindcss-DTq3uYBK.mjs +0 -556
- package/dist/tailwindcss-DZEwT3C_.js +0 -613
- package/dist/v3-engine-2rrgylhn.js +0 -4686
- package/dist/v3-engine-C6eJ0YzK.mjs +0 -4272
- package/dist/webpack-BcPpnT90.mjs +0 -1184
- package/dist/webpack-CfkUkMXG.js +0 -1196
- /package/dist/tailwindcss/{patcher-resolve.d.ts → runtime-resolve.d.ts} +0 -0
package/dist/generator.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
let tailwindcss_patch = require("tailwindcss-patch");
|
|
2
|
+
const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
|
|
3
|
+
const require_generator = require("./generator-9rUz4Hcb.js");
|
|
5
4
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
6
|
-
exports.
|
|
5
|
+
exports.createWeappTailwindcssGeneratorFromRuntime = require_generator.createWeappTailwindcssGeneratorFromRuntime;
|
|
7
6
|
exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.resolveTailwindV4SourceOptionsFromPatcher = require_v3_engine.resolveTailwindV4SourceOptionsFromPatcher;
|
|
16
|
-
exports.transformTailwindV3CssByTarget = require_v3_engine.transformTailwindV3CssByTarget;
|
|
17
|
-
exports.transformTailwindV3CssToWeapp = require_v3_engine.transformTailwindV3CssToWeapp;
|
|
18
|
-
exports.transformTailwindV4CssByTarget = require_v3_engine.transformTailwindV4CssByTarget;
|
|
19
|
-
exports.transformTailwindV4CssToWeapp = require_v3_engine.transformTailwindV4CssToWeapp;
|
|
7
|
+
exports.resolveTailwindSourceFromRuntime = require_generator.resolveTailwindSourceFromRuntime;
|
|
8
|
+
exports.resolveTailwindV4Source = require_v4_engine.resolveTailwindV4Source;
|
|
9
|
+
exports.resolveTailwindV4SourceFromRuntime = require_v4_engine.resolveTailwindV4SourceFromRuntime;
|
|
10
|
+
exports.resolveTailwindV4SourceFromRuntimeOptions = require_v4_engine.resolveTailwindV4SourceFromRuntimeOptions;
|
|
11
|
+
exports.resolveTailwindV4SourceOptionsFromRuntime = require_v4_engine.resolveTailwindV4SourceOptionsFromRuntime;
|
|
12
|
+
exports.transformTailwindV4CssByTarget = require_v4_engine.transformTailwindV4CssByTarget;
|
|
13
|
+
exports.transformTailwindV4CssToWeapp = require_v4_engine.transformTailwindV4CssToWeapp;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, n as
|
|
3
|
-
export { createWeappTailwindcssGenerator,
|
|
1
|
+
import { J as transformTailwindV4CssToWeapp, i as resolveTailwindV4SourceOptionsFromRuntime, n as resolveTailwindV4SourceFromRuntime, q as transformTailwindV4CssByTarget, r as resolveTailwindV4SourceFromRuntimeOptions, t as resolveTailwindV4Source } from "./v4-engine-CF9zt4Cw.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator } from "./generator-Dc4qaPmT.mjs";
|
|
3
|
+
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromRuntime, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromRuntime, resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
2
|
+
const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
|
|
3
|
+
const require_context = require("./context-BHxLe743.js");
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-DHIYcqXT.js");
|
|
5
|
+
const require_hmr_timing = require("./hmr-timing-CogqkFaF.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
node_fs = require_chunk.__toESM(node_fs);
|
|
8
8
|
let node_path = require("node:path");
|
|
@@ -129,7 +129,7 @@ function createVinylTransform(phase, handler, getTimingDetails) {
|
|
|
129
129
|
}
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/bundlers/gulp/index.ts
|
|
132
|
-
const debug =
|
|
132
|
+
const debug = require_context.createDebug();
|
|
133
133
|
const GULP_RUNTIME_SOURCE_CACHE_MAX = 256;
|
|
134
134
|
const GULP_PROCESS_CACHE_MAX = 512;
|
|
135
135
|
function toMb(bytes) {
|
|
@@ -187,10 +187,7 @@ function resolveGulpMemoryDebugStats(context) {
|
|
|
187
187
|
maxCacheKeys: GULP_PROCESS_CACHE_MAX
|
|
188
188
|
},
|
|
189
189
|
gulpOptions: { defaultStyleHandlerOptions: context.defaultStyleHandlerOptionsCache.size },
|
|
190
|
-
tailwind: {
|
|
191
|
-
v3: require_v3_engine.getTailwindV3IncrementalGenerateCacheStats(),
|
|
192
|
-
v4: require_v3_engine.getTailwindV4IncrementalGenerateCacheStats()
|
|
193
|
-
}
|
|
190
|
+
tailwind: { v4: require_v4_engine.getTailwindV4IncrementalGenerateCacheStats() }
|
|
194
191
|
};
|
|
195
192
|
}
|
|
196
193
|
/**
|
|
@@ -199,18 +196,20 @@ function resolveGulpMemoryDebugStats(context) {
|
|
|
199
196
|
* @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
|
|
200
197
|
*/
|
|
201
198
|
function createPlugins(options = {}) {
|
|
202
|
-
const hasInitialTailwindCssRoots =
|
|
203
|
-
const opts =
|
|
199
|
+
const hasInitialTailwindCssRoots = require_v4_engine.hasConfiguredTailwindV4CssRoots(options);
|
|
200
|
+
const opts = require_context.getCompilerContext({
|
|
204
201
|
...options,
|
|
205
202
|
__internalDeferMissingCssEntriesWarning: true
|
|
206
203
|
});
|
|
207
|
-
const { templateHandler, styleHandler, jsHandler, cache
|
|
208
|
-
const
|
|
204
|
+
const { templateHandler, styleHandler, jsHandler, cache } = opts;
|
|
205
|
+
const initialTailwindRuntime = opts.tailwindRuntime;
|
|
206
|
+
const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
|
|
207
|
+
const readyPromise = require_context.createTailwindRuntimeReadyPromise(initialTailwindRuntime);
|
|
209
208
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
210
209
|
const runtimeState = {
|
|
211
|
-
|
|
210
|
+
tailwindRuntime: initialTailwindRuntime,
|
|
212
211
|
readyPromise,
|
|
213
|
-
|
|
212
|
+
refreshTailwindcssRuntime
|
|
214
213
|
};
|
|
215
214
|
const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
216
215
|
let cachedDefaultTemplateHandlerOptions;
|
|
@@ -222,13 +221,10 @@ function createPlugins(options = {}) {
|
|
|
222
221
|
let runtimeSetDirty = false;
|
|
223
222
|
const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
|
|
224
223
|
const runtimeSourcesByFile = /* @__PURE__ */ new Map();
|
|
225
|
-
let cachedGulpSourceCandidates;
|
|
226
224
|
let cachedGulpSourceCandidateSignature;
|
|
227
225
|
const gulpProcessCacheKeys = /* @__PURE__ */ new Set();
|
|
228
|
-
const sourceCandidateExtractor = initialTwPatcher.majorVersion === 3 ? require_hmr_timing.createTailwindV3DefaultExtractor() : void 0;
|
|
229
226
|
const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? require_hmr_timing.createBundleRuntimeClassSetManager();
|
|
230
227
|
function invalidateGulpSourceCandidates() {
|
|
231
|
-
cachedGulpSourceCandidates = void 0;
|
|
232
228
|
cachedGulpSourceCandidateSignature = void 0;
|
|
233
229
|
cachedGulpSourceCandidateGetter = void 0;
|
|
234
230
|
cachedGulpSourceCandidateSourceGetter = void 0;
|
|
@@ -243,7 +239,7 @@ function createPlugins(options = {}) {
|
|
|
243
239
|
const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
|
|
244
240
|
const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
|
|
245
241
|
if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
|
|
246
|
-
runtimeSet = await
|
|
242
|
+
runtimeSet = await require_context.ensureRuntimeClassSet(runtimeState, {
|
|
247
243
|
forceRefresh,
|
|
248
244
|
forceCollect: shouldForceCollect,
|
|
249
245
|
clearCache,
|
|
@@ -266,8 +262,8 @@ function createPlugins(options = {}) {
|
|
|
266
262
|
pruneGulpRuntimeSourceCaches(runtimeSourceHashByFile, runtimeSourcesByFile);
|
|
267
263
|
if (changed) invalidateGulpSourceCandidates();
|
|
268
264
|
if (!changed && runtimeSetInitialized) return runtimeSet;
|
|
269
|
-
if (
|
|
270
|
-
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.
|
|
265
|
+
if (!runtimeSetDirty) try {
|
|
266
|
+
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.tailwindRuntime, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
|
|
271
267
|
runtimeSetInitialized = true;
|
|
272
268
|
return runtimeSet;
|
|
273
269
|
} catch (error) {
|
|
@@ -276,44 +272,9 @@ function createPlugins(options = {}) {
|
|
|
276
272
|
}
|
|
277
273
|
return refreshRuntimeSet({ forceCollect: true });
|
|
278
274
|
}
|
|
279
|
-
async function refreshGulpSourceCandidates(forceRefresh = false) {
|
|
280
|
-
if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
|
|
281
|
-
const root = opts.tailwindcssBasedir ?? node_process.default.cwd();
|
|
282
|
-
const sourceScan = await require_v3_engine.resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
|
|
283
|
-
const nextSignature = cache.computeHash(JSON.stringify({
|
|
284
|
-
root,
|
|
285
|
-
entries: sourceScan?.entries,
|
|
286
|
-
inlineCandidates: sourceScan?.inlineCandidates ? {
|
|
287
|
-
included: [...sourceScan.inlineCandidates.included].sort(),
|
|
288
|
-
excluded: [...sourceScan.inlineCandidates.excluded].sort()
|
|
289
|
-
} : void 0,
|
|
290
|
-
explicit: sourceScan?.explicit ?? false,
|
|
291
|
-
dependencies: [...sourceScan?.dependencies ?? []].sort()
|
|
292
|
-
}));
|
|
293
|
-
if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
|
|
294
|
-
const collector = require_hmr_timing.createSourceCandidateCollector({
|
|
295
|
-
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
296
|
-
extractor: sourceCandidateExtractor
|
|
297
|
-
});
|
|
298
|
-
await collector.scanRoot({
|
|
299
|
-
entries: sourceScan?.entries,
|
|
300
|
-
root
|
|
301
|
-
});
|
|
302
|
-
collector.syncInline(sourceScan?.inlineCandidates);
|
|
303
|
-
cachedGulpSourceCandidateSignature = nextSignature;
|
|
304
|
-
cachedGulpSourceCandidateGetter = (entries) => collector.valuesForEntries(entries);
|
|
305
|
-
cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
|
|
306
|
-
cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
|
|
307
|
-
return cachedGulpSourceCandidates;
|
|
308
|
-
}
|
|
309
275
|
async function refreshGulpV4SourceCandidates(forceRefresh = false) {
|
|
310
|
-
if (runtimeState.twPatcher.majorVersion !== 4) {
|
|
311
|
-
cachedGulpSourceCandidateGetter = void 0;
|
|
312
|
-
cachedGulpSourceCandidateSourceGetter = void 0;
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
276
|
const root = opts.tailwindcssBasedir ?? node_process.default.cwd();
|
|
316
|
-
const sourceScan = await
|
|
277
|
+
const sourceScan = await require_tailwindcss.resolveViteSourceScanEntries(opts, runtimeState.tailwindRuntime, { root });
|
|
317
278
|
const nextSignature = cache.computeHash(JSON.stringify({
|
|
318
279
|
root,
|
|
319
280
|
entries: sourceScan?.entries,
|
|
@@ -337,23 +298,25 @@ function createPlugins(options = {}) {
|
|
|
337
298
|
cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
|
|
338
299
|
return cachedGulpSourceCandidateGetter;
|
|
339
300
|
}
|
|
340
|
-
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature) {
|
|
301
|
+
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature) {
|
|
341
302
|
return cache.computeHash([
|
|
342
303
|
rawSource,
|
|
343
|
-
|
|
304
|
+
require_tailwindcss.getRuntimeClassSetSignature(runtimeState.tailwindRuntime),
|
|
344
305
|
[...nextRuntimeSet].sort().join("\n"),
|
|
345
306
|
sourceTraceSignature ?? "css-source-trace:0",
|
|
346
|
-
sourceCandidateSignature ?? "gulp-source-candidates:0"
|
|
307
|
+
sourceCandidateSignature ?? "gulp-source-candidates:0",
|
|
308
|
+
outputSignature ?? "gulp-output:0"
|
|
347
309
|
].join("\n\n"));
|
|
348
310
|
}
|
|
349
311
|
async function registerAutoCssSource(file, rawSource) {
|
|
350
|
-
if (hasInitialTailwindCssRoots || (runtimeState.
|
|
312
|
+
if (hasInitialTailwindCssRoots || (runtimeState.tailwindRuntime.majorVersion ?? 0) < 4 || !file.path || !require_v4_engine.hasTailwindRootDirectives(rawSource)) return false;
|
|
351
313
|
const sourceFile = node_path.default.resolve(file.path);
|
|
352
|
-
const sourceCss =
|
|
353
|
-
|
|
314
|
+
const sourceCss = require_v4_engine.normalizeTailwindSourceForGenerator(require_v4_engine.normalizeTailwindConfigDirectives(rawSource, node_path.default.dirname(sourceFile)), { importFallback: true });
|
|
315
|
+
const generatorSourceCss = require_hmr_timing.splitLocalCssImports(sourceCss)?.source ?? sourceCss;
|
|
316
|
+
if (!require_v4_engine.upsertTailwindV4CssSource(opts, {
|
|
354
317
|
file: sourceFile,
|
|
355
318
|
base: node_path.default.dirname(sourceFile),
|
|
356
|
-
css:
|
|
319
|
+
css: generatorSourceCss
|
|
357
320
|
})) return false;
|
|
358
321
|
runtimeSetInitialized = false;
|
|
359
322
|
runtimeSetDirty = true;
|
|
@@ -367,20 +330,23 @@ function createPlugins(options = {}) {
|
|
|
367
330
|
return cachedDefaultModuleGraphOptions;
|
|
368
331
|
}
|
|
369
332
|
function resolveWxssHandlerOptions(options) {
|
|
370
|
-
const majorVersion = runtimeState.
|
|
333
|
+
const majorVersion = runtimeState.tailwindRuntime.majorVersion ?? "unknown";
|
|
371
334
|
if (!options || Object.keys(options).length === 0) {
|
|
372
335
|
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
373
336
|
if (!cached) {
|
|
374
|
-
cached = runtimeState.
|
|
337
|
+
cached = runtimeState.tailwindRuntime.majorVersion === void 0 ? {} : { majorVersion: runtimeState.tailwindRuntime.majorVersion };
|
|
375
338
|
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
376
339
|
}
|
|
377
340
|
return cached;
|
|
378
341
|
}
|
|
379
|
-
return runtimeState.
|
|
380
|
-
majorVersion: runtimeState.
|
|
342
|
+
return runtimeState.tailwindRuntime.majorVersion === void 0 ? { ...options } : {
|
|
343
|
+
majorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
381
344
|
...options
|
|
382
345
|
};
|
|
383
346
|
}
|
|
347
|
+
function resolveGulpStyleOutputExtension(file) {
|
|
348
|
+
return typeof opts.cssMatcher === "function" && opts.cssMatcher(node_path.default.basename(file.path)) ? node_path.default.extname(file.path) : void 0;
|
|
349
|
+
}
|
|
384
350
|
function resolveGulpMatcherName(file) {
|
|
385
351
|
return (file.relative || node_path.default.basename(file.path)).replaceAll(node_path.default.sep, "/");
|
|
386
352
|
}
|
|
@@ -450,30 +416,23 @@ function createPlugins(options = {}) {
|
|
|
450
416
|
if (!file.contents) return;
|
|
451
417
|
const rawSource = file.contents.toString();
|
|
452
418
|
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
453
|
-
const
|
|
454
|
-
const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || require_v3_engine.hasTailwindRootDirectives(rawSource);
|
|
419
|
+
const shouldUseGenerator = runtimeState.tailwindRuntime.majorVersion === 4;
|
|
455
420
|
let gulpSourceCandidateGetter;
|
|
456
|
-
if (shouldUseGenerator
|
|
457
|
-
|
|
421
|
+
if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
422
|
+
const nextRuntimeSet = await refreshRuntimeSet({
|
|
458
423
|
forceRefresh: cssSourceChanged,
|
|
459
|
-
forceCollect: cssSourceChanged
|
|
424
|
+
forceCollect: cssSourceChanged,
|
|
460
425
|
clearCache: cssSourceChanged
|
|
461
426
|
});
|
|
462
|
-
if (runtimeState.twPatcher.majorVersion === 3 && shouldUseGenerator) {
|
|
463
|
-
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged || isMainChunk);
|
|
464
|
-
gulpSourceCandidateGetter = cachedGulpSourceCandidateGetter;
|
|
465
|
-
if (sourceCandidates.size > 0) {
|
|
466
|
-
nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
|
|
467
|
-
runtimeSet = nextRuntimeSet;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
427
|
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? require_hmr_timing.createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
471
428
|
const sourceTraceSignature = require_hmr_timing.createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
472
429
|
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
430
|
+
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
431
|
+
const outputSignature = styleOutputExtension ? `gulp-output:1:${styleOutputExtension}` : "gulp-output:0";
|
|
473
432
|
await require_hmr_timing.processCachedTask({
|
|
474
433
|
cache,
|
|
475
434
|
cacheKey: file.path,
|
|
476
|
-
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature),
|
|
435
|
+
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
|
|
477
436
|
applyResult(source) {
|
|
478
437
|
file.contents = node_buffer.Buffer.from(source);
|
|
479
438
|
},
|
|
@@ -483,7 +442,7 @@ function createPlugins(options = {}) {
|
|
|
483
442
|
async transform() {
|
|
484
443
|
await runtimeState.readyPromise;
|
|
485
444
|
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
486
|
-
const
|
|
445
|
+
const outputCss = require_hmr_timing.rewriteLocalCssImportRequestsForOutput(require_hmr_timing.annotateCssSourceTrace((shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
|
|
487
446
|
opts,
|
|
488
447
|
runtimeState,
|
|
489
448
|
runtime: nextRuntimeSet,
|
|
@@ -497,9 +456,9 @@ function createPlugins(options = {}) {
|
|
|
497
456
|
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
|
|
498
457
|
opts,
|
|
499
458
|
tokenSources: sourceTraceTokenSources
|
|
500
|
-
});
|
|
459
|
+
}), { styleOutputExtension });
|
|
501
460
|
debug("css handle: %s", file.path);
|
|
502
|
-
return { result:
|
|
461
|
+
return { result: outputCss };
|
|
503
462
|
}
|
|
504
463
|
});
|
|
505
464
|
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
@@ -514,6 +473,7 @@ function createPlugins(options = {}) {
|
|
|
514
473
|
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
515
474
|
const handlerOptions = {
|
|
516
475
|
...options,
|
|
476
|
+
generateMap: false,
|
|
517
477
|
filename,
|
|
518
478
|
moduleGraph,
|
|
519
479
|
babelParserOptions: {
|
|
@@ -521,7 +481,7 @@ function createPlugins(options = {}) {
|
|
|
521
481
|
sourceFilename: filename
|
|
522
482
|
}
|
|
523
483
|
};
|
|
524
|
-
if (runtimeState.
|
|
484
|
+
if (runtimeState.tailwindRuntime.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
525
485
|
await require_hmr_timing.processCachedTask({
|
|
526
486
|
cache,
|
|
527
487
|
cacheKey: file.path,
|
|
@@ -535,7 +495,7 @@ function createPlugins(options = {}) {
|
|
|
535
495
|
async transform() {
|
|
536
496
|
await runtimeState.readyPromise;
|
|
537
497
|
const currentSource = file.contents?.toString() ?? rawSource;
|
|
538
|
-
if (
|
|
498
|
+
if (require_context.shouldSkipJsTransform(currentSource, {
|
|
539
499
|
...handlerOptions,
|
|
540
500
|
classNameSet: runtimeSet
|
|
541
501
|
})) return { result: currentSource };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { C as hasTailwindRootDirectives, E as normalizeTailwindConfigDirectives, K as getTailwindV4IncrementalGenerateCacheStats, O as normalizeTailwindSourceForGenerator, o as hasConfiguredTailwindV4CssRoots, s as upsertTailwindV4CssSource } from "./v4-engine-CF9zt4Cw.mjs";
|
|
2
|
+
import { c as shouldSkipJsTransform, t as getCompilerContext, v as createTailwindRuntimeReadyPromise, x as createDebug, y as ensureRuntimeClassSet } from "./context-Mbzkek1q.mjs";
|
|
3
|
+
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-wyUHrfil.mjs";
|
|
4
|
+
import { F as processCachedTask, M as createCssSourceTraceCacheSignature, N as createCssTokenSourceMap, j as annotateCssSourceTrace, n as emitHmrTiming, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, u as generateCssByGenerator, v as rewriteLocalCssImportRequestsForOutput, y as splitLocalCssImports } from "./hmr-timing-BXMLsF4b.mjs";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
@@ -182,10 +182,7 @@ function resolveGulpMemoryDebugStats(context) {
|
|
|
182
182
|
maxCacheKeys: GULP_PROCESS_CACHE_MAX
|
|
183
183
|
},
|
|
184
184
|
gulpOptions: { defaultStyleHandlerOptions: context.defaultStyleHandlerOptionsCache.size },
|
|
185
|
-
tailwind: {
|
|
186
|
-
v3: getTailwindV3IncrementalGenerateCacheStats(),
|
|
187
|
-
v4: getTailwindV4IncrementalGenerateCacheStats()
|
|
188
|
-
}
|
|
185
|
+
tailwind: { v4: getTailwindV4IncrementalGenerateCacheStats() }
|
|
189
186
|
};
|
|
190
187
|
}
|
|
191
188
|
/**
|
|
@@ -199,13 +196,15 @@ function createPlugins(options = {}) {
|
|
|
199
196
|
...options,
|
|
200
197
|
__internalDeferMissingCssEntriesWarning: true
|
|
201
198
|
});
|
|
202
|
-
const { templateHandler, styleHandler, jsHandler, cache
|
|
203
|
-
const
|
|
199
|
+
const { templateHandler, styleHandler, jsHandler, cache } = opts;
|
|
200
|
+
const initialTailwindRuntime = opts.tailwindRuntime;
|
|
201
|
+
const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
|
|
202
|
+
const readyPromise = createTailwindRuntimeReadyPromise(initialTailwindRuntime);
|
|
204
203
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
205
204
|
const runtimeState = {
|
|
206
|
-
|
|
205
|
+
tailwindRuntime: initialTailwindRuntime,
|
|
207
206
|
readyPromise,
|
|
208
|
-
|
|
207
|
+
refreshTailwindcssRuntime
|
|
209
208
|
};
|
|
210
209
|
const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
211
210
|
let cachedDefaultTemplateHandlerOptions;
|
|
@@ -217,13 +216,10 @@ function createPlugins(options = {}) {
|
|
|
217
216
|
let runtimeSetDirty = false;
|
|
218
217
|
const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
|
|
219
218
|
const runtimeSourcesByFile = /* @__PURE__ */ new Map();
|
|
220
|
-
let cachedGulpSourceCandidates;
|
|
221
219
|
let cachedGulpSourceCandidateSignature;
|
|
222
220
|
const gulpProcessCacheKeys = /* @__PURE__ */ new Set();
|
|
223
|
-
const sourceCandidateExtractor = initialTwPatcher.majorVersion === 3 ? createTailwindV3DefaultExtractor() : void 0;
|
|
224
221
|
const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? createBundleRuntimeClassSetManager();
|
|
225
222
|
function invalidateGulpSourceCandidates() {
|
|
226
|
-
cachedGulpSourceCandidates = void 0;
|
|
227
223
|
cachedGulpSourceCandidateSignature = void 0;
|
|
228
224
|
cachedGulpSourceCandidateGetter = void 0;
|
|
229
225
|
cachedGulpSourceCandidateSourceGetter = void 0;
|
|
@@ -261,8 +257,8 @@ function createPlugins(options = {}) {
|
|
|
261
257
|
pruneGulpRuntimeSourceCaches(runtimeSourceHashByFile, runtimeSourcesByFile);
|
|
262
258
|
if (changed) invalidateGulpSourceCandidates();
|
|
263
259
|
if (!changed && runtimeSetInitialized) return runtimeSet;
|
|
264
|
-
if (
|
|
265
|
-
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.
|
|
260
|
+
if (!runtimeSetDirty) try {
|
|
261
|
+
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.tailwindRuntime, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
|
|
266
262
|
runtimeSetInitialized = true;
|
|
267
263
|
return runtimeSet;
|
|
268
264
|
} catch (error) {
|
|
@@ -271,44 +267,9 @@ function createPlugins(options = {}) {
|
|
|
271
267
|
}
|
|
272
268
|
return refreshRuntimeSet({ forceCollect: true });
|
|
273
269
|
}
|
|
274
|
-
async function refreshGulpSourceCandidates(forceRefresh = false) {
|
|
275
|
-
if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
|
|
276
|
-
const root = opts.tailwindcssBasedir ?? process.cwd();
|
|
277
|
-
const sourceScan = await resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
|
|
278
|
-
const nextSignature = cache.computeHash(JSON.stringify({
|
|
279
|
-
root,
|
|
280
|
-
entries: sourceScan?.entries,
|
|
281
|
-
inlineCandidates: sourceScan?.inlineCandidates ? {
|
|
282
|
-
included: [...sourceScan.inlineCandidates.included].sort(),
|
|
283
|
-
excluded: [...sourceScan.inlineCandidates.excluded].sort()
|
|
284
|
-
} : void 0,
|
|
285
|
-
explicit: sourceScan?.explicit ?? false,
|
|
286
|
-
dependencies: [...sourceScan?.dependencies ?? []].sort()
|
|
287
|
-
}));
|
|
288
|
-
if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
|
|
289
|
-
const collector = createSourceCandidateCollector({
|
|
290
|
-
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
291
|
-
extractor: sourceCandidateExtractor
|
|
292
|
-
});
|
|
293
|
-
await collector.scanRoot({
|
|
294
|
-
entries: sourceScan?.entries,
|
|
295
|
-
root
|
|
296
|
-
});
|
|
297
|
-
collector.syncInline(sourceScan?.inlineCandidates);
|
|
298
|
-
cachedGulpSourceCandidateSignature = nextSignature;
|
|
299
|
-
cachedGulpSourceCandidateGetter = (entries) => collector.valuesForEntries(entries);
|
|
300
|
-
cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
|
|
301
|
-
cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
|
|
302
|
-
return cachedGulpSourceCandidates;
|
|
303
|
-
}
|
|
304
270
|
async function refreshGulpV4SourceCandidates(forceRefresh = false) {
|
|
305
|
-
if (runtimeState.twPatcher.majorVersion !== 4) {
|
|
306
|
-
cachedGulpSourceCandidateGetter = void 0;
|
|
307
|
-
cachedGulpSourceCandidateSourceGetter = void 0;
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
271
|
const root = opts.tailwindcssBasedir ?? process.cwd();
|
|
311
|
-
const sourceScan = await resolveViteSourceScanEntries(opts, runtimeState.
|
|
272
|
+
const sourceScan = await resolveViteSourceScanEntries(opts, runtimeState.tailwindRuntime, { root });
|
|
312
273
|
const nextSignature = cache.computeHash(JSON.stringify({
|
|
313
274
|
root,
|
|
314
275
|
entries: sourceScan?.entries,
|
|
@@ -332,23 +293,25 @@ function createPlugins(options = {}) {
|
|
|
332
293
|
cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
|
|
333
294
|
return cachedGulpSourceCandidateGetter;
|
|
334
295
|
}
|
|
335
|
-
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature) {
|
|
296
|
+
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature) {
|
|
336
297
|
return cache.computeHash([
|
|
337
298
|
rawSource,
|
|
338
|
-
getRuntimeClassSetSignature(runtimeState.
|
|
299
|
+
getRuntimeClassSetSignature(runtimeState.tailwindRuntime),
|
|
339
300
|
[...nextRuntimeSet].sort().join("\n"),
|
|
340
301
|
sourceTraceSignature ?? "css-source-trace:0",
|
|
341
|
-
sourceCandidateSignature ?? "gulp-source-candidates:0"
|
|
302
|
+
sourceCandidateSignature ?? "gulp-source-candidates:0",
|
|
303
|
+
outputSignature ?? "gulp-output:0"
|
|
342
304
|
].join("\n\n"));
|
|
343
305
|
}
|
|
344
306
|
async function registerAutoCssSource(file, rawSource) {
|
|
345
|
-
if (hasInitialTailwindCssRoots || (runtimeState.
|
|
307
|
+
if (hasInitialTailwindCssRoots || (runtimeState.tailwindRuntime.majorVersion ?? 0) < 4 || !file.path || !hasTailwindRootDirectives(rawSource)) return false;
|
|
346
308
|
const sourceFile = path.resolve(file.path);
|
|
347
309
|
const sourceCss = normalizeTailwindSourceForGenerator(normalizeTailwindConfigDirectives(rawSource, path.dirname(sourceFile)), { importFallback: true });
|
|
310
|
+
const generatorSourceCss = splitLocalCssImports(sourceCss)?.source ?? sourceCss;
|
|
348
311
|
if (!upsertTailwindV4CssSource(opts, {
|
|
349
312
|
file: sourceFile,
|
|
350
313
|
base: path.dirname(sourceFile),
|
|
351
|
-
css:
|
|
314
|
+
css: generatorSourceCss
|
|
352
315
|
})) return false;
|
|
353
316
|
runtimeSetInitialized = false;
|
|
354
317
|
runtimeSetDirty = true;
|
|
@@ -362,20 +325,23 @@ function createPlugins(options = {}) {
|
|
|
362
325
|
return cachedDefaultModuleGraphOptions;
|
|
363
326
|
}
|
|
364
327
|
function resolveWxssHandlerOptions(options) {
|
|
365
|
-
const majorVersion = runtimeState.
|
|
328
|
+
const majorVersion = runtimeState.tailwindRuntime.majorVersion ?? "unknown";
|
|
366
329
|
if (!options || Object.keys(options).length === 0) {
|
|
367
330
|
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
368
331
|
if (!cached) {
|
|
369
|
-
cached = runtimeState.
|
|
332
|
+
cached = runtimeState.tailwindRuntime.majorVersion === void 0 ? {} : { majorVersion: runtimeState.tailwindRuntime.majorVersion };
|
|
370
333
|
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
371
334
|
}
|
|
372
335
|
return cached;
|
|
373
336
|
}
|
|
374
|
-
return runtimeState.
|
|
375
|
-
majorVersion: runtimeState.
|
|
337
|
+
return runtimeState.tailwindRuntime.majorVersion === void 0 ? { ...options } : {
|
|
338
|
+
majorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
376
339
|
...options
|
|
377
340
|
};
|
|
378
341
|
}
|
|
342
|
+
function resolveGulpStyleOutputExtension(file) {
|
|
343
|
+
return typeof opts.cssMatcher === "function" && opts.cssMatcher(path.basename(file.path)) ? path.extname(file.path) : void 0;
|
|
344
|
+
}
|
|
379
345
|
function resolveGulpMatcherName(file) {
|
|
380
346
|
return (file.relative || path.basename(file.path)).replaceAll(path.sep, "/");
|
|
381
347
|
}
|
|
@@ -445,30 +411,23 @@ function createPlugins(options = {}) {
|
|
|
445
411
|
if (!file.contents) return;
|
|
446
412
|
const rawSource = file.contents.toString();
|
|
447
413
|
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
448
|
-
const
|
|
449
|
-
const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || hasTailwindRootDirectives(rawSource);
|
|
414
|
+
const shouldUseGenerator = runtimeState.tailwindRuntime.majorVersion === 4;
|
|
450
415
|
let gulpSourceCandidateGetter;
|
|
451
|
-
if (shouldUseGenerator
|
|
452
|
-
|
|
416
|
+
if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
417
|
+
const nextRuntimeSet = await refreshRuntimeSet({
|
|
453
418
|
forceRefresh: cssSourceChanged,
|
|
454
|
-
forceCollect: cssSourceChanged
|
|
419
|
+
forceCollect: cssSourceChanged,
|
|
455
420
|
clearCache: cssSourceChanged
|
|
456
421
|
});
|
|
457
|
-
if (runtimeState.twPatcher.majorVersion === 3 && shouldUseGenerator) {
|
|
458
|
-
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged || isMainChunk);
|
|
459
|
-
gulpSourceCandidateGetter = cachedGulpSourceCandidateGetter;
|
|
460
|
-
if (sourceCandidates.size > 0) {
|
|
461
|
-
nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
|
|
462
|
-
runtimeSet = nextRuntimeSet;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
422
|
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
466
423
|
const sourceTraceSignature = createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
467
424
|
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
425
|
+
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
426
|
+
const outputSignature = styleOutputExtension ? `gulp-output:1:${styleOutputExtension}` : "gulp-output:0";
|
|
468
427
|
await processCachedTask({
|
|
469
428
|
cache,
|
|
470
429
|
cacheKey: file.path,
|
|
471
|
-
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature),
|
|
430
|
+
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
|
|
472
431
|
applyResult(source) {
|
|
473
432
|
file.contents = Buffer.from(source);
|
|
474
433
|
},
|
|
@@ -478,7 +437,7 @@ function createPlugins(options = {}) {
|
|
|
478
437
|
async transform() {
|
|
479
438
|
await runtimeState.readyPromise;
|
|
480
439
|
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
481
|
-
const
|
|
440
|
+
const outputCss = rewriteLocalCssImportRequestsForOutput(annotateCssSourceTrace((shouldUseGenerator ? await generateCssByGenerator({
|
|
482
441
|
opts,
|
|
483
442
|
runtimeState,
|
|
484
443
|
runtime: nextRuntimeSet,
|
|
@@ -492,9 +451,9 @@ function createPlugins(options = {}) {
|
|
|
492
451
|
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
|
|
493
452
|
opts,
|
|
494
453
|
tokenSources: sourceTraceTokenSources
|
|
495
|
-
});
|
|
454
|
+
}), { styleOutputExtension });
|
|
496
455
|
debug("css handle: %s", file.path);
|
|
497
|
-
return { result:
|
|
456
|
+
return { result: outputCss };
|
|
498
457
|
}
|
|
499
458
|
});
|
|
500
459
|
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
@@ -509,6 +468,7 @@ function createPlugins(options = {}) {
|
|
|
509
468
|
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
510
469
|
const handlerOptions = {
|
|
511
470
|
...options,
|
|
471
|
+
generateMap: false,
|
|
512
472
|
filename,
|
|
513
473
|
moduleGraph,
|
|
514
474
|
babelParserOptions: {
|
|
@@ -516,7 +476,7 @@ function createPlugins(options = {}) {
|
|
|
516
476
|
sourceFilename: filename
|
|
517
477
|
}
|
|
518
478
|
};
|
|
519
|
-
if (runtimeState.
|
|
479
|
+
if (runtimeState.tailwindRuntime.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
520
480
|
await processCachedTask({
|
|
521
481
|
cache,
|
|
522
482
|
cacheKey: file.path,
|
package/dist/gulp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_gulp = require("./gulp-
|
|
2
|
+
const require_gulp = require("./gulp-B_sdP6dx.js");
|
|
3
3
|
exports.WeappTailwindcss = require_gulp.createPlugins;
|
|
4
4
|
exports.createPlugins = require_gulp.createPlugins;
|
|
5
5
|
exports.weappTailwindcss = require_gulp.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPlugins } from "./gulp-
|
|
1
|
+
import { t as createPlugins } from "./gulp-uM36oIJs.mjs";
|
|
2
2
|
export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
|