weapp-tailwindcss 5.0.0-next.9 → 5.0.1
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.md +2 -2
- package/dist/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/bundle-state-CBF5YX1m.js +529 -0
- package/dist/bundle-state-CQmxxx0R.mjs +413 -0
- package/dist/bundlers/shared/cache.d.ts +9 -7
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
- package/dist/bundlers/shared/css-imports.d.ts +3 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +11 -3
- package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +6 -2
- package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
- package/dist/bundlers/shared/style-requests.d.ts +2 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
- package/dist/bundlers/vite/index.d.ts +5 -2
- package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/bundlers/vite/source-candidates.d.ts +24 -2
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
- package/dist/cli/context.d.ts +1 -11
- package/dist/cli/doctor/types.d.ts +11 -11
- package/dist/cli/vscode-entry.d.ts +3 -3
- package/dist/cli.js +684 -41
- package/dist/cli.mjs +682 -40
- package/dist/context/runtime-package-replacements.d.ts +2 -0
- package/dist/context/style-options.d.ts +3 -0
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +1 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +11 -0
- package/dist/css-macro/constants.d.ts +5 -2
- package/dist/css-macro/postcss.d.ts +1 -0
- package/dist/css-macro/postcss.js +7 -46
- package/dist/css-macro/postcss.mjs +2 -46
- package/dist/css-macro.js +16 -7
- package/dist/css-macro.mjs +15 -6
- package/dist/defaults-8xrgzxFY.mjs +151 -0
- package/dist/defaults-zKUH2mDe.js +193 -0
- package/dist/defaults.js +6 -150
- package/dist/defaults.mjs +1 -143
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/options.d.ts +11 -6
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator-CvmsIQFI.js +92 -0
- package/dist/generator-DDtsUvkH.mjs +67 -0
- package/dist/generator.js +12 -12
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +163 -40
- package/dist/gulp.mjs +155 -32
- package/dist/incremental-runtime-class-set-BffodqHh.js +2366 -0
- package/dist/incremental-runtime-class-set-DArodvWs.mjs +2291 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -5
- package/dist/index.mjs +6 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/precheck.d.ts +2 -2
- package/dist/js/replacement-cache.d.ts +5 -0
- package/dist/{postcss-w48mGIhe.mjs → postcss-BzNYQUOH.mjs} +54 -114
- package/dist/postcss-C7BMYpEF.mjs +169 -0
- package/dist/postcss-CiYLsqZn.js +192 -0
- package/dist/{postcss-QIXwT40c.js → postcss-DE0TOtV9.js} +60 -121
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/precheck-BzYPm-EG.js +4842 -0
- package/dist/precheck-jZvTVXXG.mjs +4716 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +27 -13
- package/dist/presets.mjs +25 -13
- package/dist/reset.js +1 -1
- package/dist/runtime-registry-DpcR3IHI.js +5496 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-BuTlMabx.mjs +322 -0
- package/dist/source-candidates-CxoIaS88.js +335 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -5
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/tailwindcss/runtime/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime.d.ts +9 -9
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/patcher.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
- package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-CCZcu0lr.mjs} +75 -98
- package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-DZckITp1.js} +83 -106
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +51 -41
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
- package/dist/types/user-defined-options/general.d.ts +25 -22
- package/dist/types/user-defined-options/important.d.ts +32 -27
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/unocss/index.d.ts +2 -0
- package/dist/utils/object.d.ts +9 -0
- package/dist/utils/options.d.ts +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
- package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
- package/dist/v3-engine-DGBhUnjn.mjs +3419 -0
- package/dist/v3-engine-M6Aqru5T.js +3714 -0
- package/dist/vite-BBcQIJpD.mjs +24493 -0
- package/dist/vite-DgRkWVPG.js +24507 -0
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5456 -22
- package/dist/weapp-tw-runtime-classset-loader.js +32 -9
- package/dist/{webpack-BzN2ly34.js → webpack-D-gb4ZvO.js} +341 -96
- package/dist/{webpack-DJazm5sT.mjs → webpack-D43aMQzO.mjs} +323 -79
- package/dist/webpack.d.ts +1 -3
- package/dist/webpack.js +3 -4
- package/dist/webpack.mjs +2 -2
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
- package/package.json +22 -20
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
- package/dist/cache-BVAiJV3J.js +0 -502
- package/dist/cache-CHs4DXui.mjs +0 -434
- package/dist/constants-BoB_6lFw.js +0 -73
- package/dist/constants-E_loJC49.mjs +0 -44
- package/dist/generator-DKkhJbOg.js +0 -1531
- package/dist/generator-UBmfduYg.mjs +0 -1432
- package/dist/generator-css-Bwp3nbrl.js +0 -1381
- package/dist/generator-css-DeLLmp2N.mjs +0 -1342
- package/dist/lightningcss/index.d.ts +0 -8
- package/dist/lightningcss/style-handler/options.d.ts +0 -3
- package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
- package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
- package/dist/lightningcss/style-handler.d.ts +0 -17
- package/dist/precheck-B32p-gLI.js +0 -2736
- package/dist/precheck-B4RH6ZNN.mjs +0 -2622
- package/dist/run-tasks-B50A3pxt.js +0 -128
- package/dist/run-tasks-DdNi-hkk.mjs +0 -91
- package/dist/runtime-patch-CwN5ya72.mjs +0 -71
- package/dist/runtime-patch-D6mBo_KB.js +0 -85
- package/dist/vite-By5KQi9s.js +0 -2419
- package/dist/vite-Cyp42bBf.mjs +0 -2406
- /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
- /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
package/dist/gulp.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_chunk = require("./chunk-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
let node_path = require("node:path");
|
|
9
|
-
node_path = require_chunk.__toESM(node_path);
|
|
10
|
-
let node_process = require("node:process");
|
|
11
|
-
node_process = require_chunk.__toESM(node_process);
|
|
2
|
+
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
3
|
+
const require_v3_engine = require("./v3-engine-M6Aqru5T.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-BffodqHh.js");
|
|
5
|
+
const require_precheck = require("./precheck-BzYPm-EG.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-DZckITp1.js");
|
|
7
|
+
const require_source_candidates = require("./source-candidates-CxoIaS88.js");
|
|
12
8
|
let node_fs = require("node:fs");
|
|
13
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
|
+
let node_process = require("node:process");
|
|
11
|
+
node_process = require_chunk.__toESM(node_process);
|
|
12
|
+
let node_path = require("node:path");
|
|
13
|
+
node_path = require_chunk.__toESM(node_path);
|
|
14
14
|
let node_buffer = require("node:buffer");
|
|
15
15
|
let node_stream = require("node:stream");
|
|
16
16
|
node_stream = require_chunk.__toESM(node_stream);
|
|
17
17
|
//#region src/bundlers/gulp/index.ts
|
|
18
|
-
const debug =
|
|
18
|
+
const debug = require_v3_engine.createDebug();
|
|
19
19
|
const Transform = node_stream.default.Transform;
|
|
20
20
|
/**
|
|
21
21
|
* @name weapp-tw-gulp
|
|
@@ -49,32 +49,137 @@ function createPlugins(options = {}) {
|
|
|
49
49
|
".jsx"
|
|
50
50
|
];
|
|
51
51
|
let runtimeSetInitialized = false;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
let runtimeSetDirty = false;
|
|
53
|
+
const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
|
|
54
|
+
const runtimeSourcesByFile = /* @__PURE__ */ new Map();
|
|
55
|
+
let cachedGulpSourceCandidates;
|
|
56
|
+
let cachedGulpSourceCandidateSignature;
|
|
57
|
+
const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? require_incremental_runtime_class_set.createBundleRuntimeClassSetManager();
|
|
58
|
+
async function refreshRuntimeSet(options = false) {
|
|
59
|
+
const normalizedOptions = typeof options === "boolean" ? {
|
|
60
|
+
forceRefresh: options,
|
|
61
|
+
forceCollect: options,
|
|
62
|
+
clearCache: options
|
|
63
|
+
} : options;
|
|
64
|
+
const forceRefresh = normalizedOptions.forceRefresh === true;
|
|
65
|
+
const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
|
|
66
|
+
const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
|
|
67
|
+
if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
|
|
54
68
|
runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
|
|
55
|
-
forceRefresh
|
|
56
|
-
forceCollect:
|
|
57
|
-
clearCache
|
|
69
|
+
forceRefresh,
|
|
70
|
+
forceCollect: shouldForceCollect,
|
|
71
|
+
clearCache,
|
|
58
72
|
allowEmpty: false
|
|
59
73
|
});
|
|
60
74
|
runtimeSetInitialized = true;
|
|
75
|
+
runtimeSetDirty = false;
|
|
61
76
|
return runtimeSet;
|
|
62
77
|
}
|
|
78
|
+
function createRuntimeSnapshot(changedFiles) {
|
|
79
|
+
const runtimeAffectingChangedByType = {
|
|
80
|
+
html: /* @__PURE__ */ new Set(),
|
|
81
|
+
js: /* @__PURE__ */ new Set(),
|
|
82
|
+
css: /* @__PURE__ */ new Set(),
|
|
83
|
+
other: /* @__PURE__ */ new Set()
|
|
84
|
+
};
|
|
85
|
+
for (const file of changedFiles) {
|
|
86
|
+
const entry = runtimeSourcesByFile.get(file);
|
|
87
|
+
if (entry) runtimeAffectingChangedByType[entry.type].add(file);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
entries: [...runtimeSourcesByFile.entries()].map(([file, entry]) => ({
|
|
91
|
+
file,
|
|
92
|
+
output: {
|
|
93
|
+
fileName: file,
|
|
94
|
+
source: entry.source,
|
|
95
|
+
type: "asset"
|
|
96
|
+
},
|
|
97
|
+
source: entry.source,
|
|
98
|
+
type: entry.type
|
|
99
|
+
})),
|
|
100
|
+
jsEntries: /* @__PURE__ */ new Map(),
|
|
101
|
+
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
102
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
103
|
+
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
104
|
+
changedByType: {
|
|
105
|
+
html: /* @__PURE__ */ new Set(),
|
|
106
|
+
js: /* @__PURE__ */ new Set(),
|
|
107
|
+
css: /* @__PURE__ */ new Set(),
|
|
108
|
+
other: /* @__PURE__ */ new Set()
|
|
109
|
+
},
|
|
110
|
+
runtimeAffectingChangedByType,
|
|
111
|
+
processFiles: {
|
|
112
|
+
html: /* @__PURE__ */ new Set(),
|
|
113
|
+
js: /* @__PURE__ */ new Set(),
|
|
114
|
+
css: /* @__PURE__ */ new Set()
|
|
115
|
+
},
|
|
116
|
+
linkedImpactsByEntry: /* @__PURE__ */ new Map()
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
async function refreshRuntimeSetForSource(file, rawSource, type) {
|
|
120
|
+
const filename = node_path.default.resolve(file.path);
|
|
121
|
+
const hash = cache.computeHash(rawSource);
|
|
122
|
+
const changed = runtimeSourceHashByFile.get(filename) !== hash;
|
|
123
|
+
runtimeSourceHashByFile.set(filename, hash);
|
|
124
|
+
runtimeSourcesByFile.set(filename, {
|
|
125
|
+
source: rawSource,
|
|
126
|
+
type
|
|
127
|
+
});
|
|
128
|
+
if (!changed && runtimeSetInitialized) return runtimeSet;
|
|
129
|
+
if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
|
|
130
|
+
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createRuntimeSnapshot([filename]));
|
|
131
|
+
runtimeSetInitialized = true;
|
|
132
|
+
return runtimeSet;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
debug("gulp incremental runtime set sync failed, fallback to collect: %O", error);
|
|
135
|
+
await bundleRuntimeClassSetManager.reset();
|
|
136
|
+
}
|
|
137
|
+
return refreshRuntimeSet({ forceCollect: true });
|
|
138
|
+
}
|
|
139
|
+
async function refreshGulpSourceCandidates(forceRefresh = false) {
|
|
140
|
+
if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
|
|
141
|
+
const root = opts.tailwindcssBasedir ?? node_process.default.cwd();
|
|
142
|
+
const sourceScan = await require_v3_engine.resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
|
|
143
|
+
const nextSignature = cache.computeHash(JSON.stringify({
|
|
144
|
+
root,
|
|
145
|
+
entries: sourceScan?.entries,
|
|
146
|
+
inlineCandidates: sourceScan?.inlineCandidates ? {
|
|
147
|
+
included: [...sourceScan.inlineCandidates.included].sort(),
|
|
148
|
+
excluded: [...sourceScan.inlineCandidates.excluded].sort()
|
|
149
|
+
} : void 0,
|
|
150
|
+
explicit: sourceScan?.explicit ?? false,
|
|
151
|
+
dependencies: [...sourceScan?.dependencies ?? []].sort()
|
|
152
|
+
}));
|
|
153
|
+
if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
|
|
154
|
+
const collector = require_source_candidates.createSourceCandidateCollector({ bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues });
|
|
155
|
+
await collector.scanRoot({
|
|
156
|
+
entries: sourceScan?.entries,
|
|
157
|
+
root
|
|
158
|
+
});
|
|
159
|
+
collector.syncInline(sourceScan?.inlineCandidates);
|
|
160
|
+
cachedGulpSourceCandidateSignature = nextSignature;
|
|
161
|
+
cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
|
|
162
|
+
return cachedGulpSourceCandidates;
|
|
163
|
+
}
|
|
63
164
|
function createRuntimeSetHash(rawSource, nextRuntimeSet) {
|
|
64
165
|
return cache.computeHash([
|
|
65
166
|
rawSource,
|
|
66
|
-
|
|
167
|
+
require_v3_engine.getRuntimeClassSetSignature(runtimeState.twPatcher),
|
|
67
168
|
[...nextRuntimeSet].sort().join("\n")
|
|
68
169
|
].join("\n\n"));
|
|
69
170
|
}
|
|
70
171
|
async function registerAutoCssSource(file, rawSource) {
|
|
71
|
-
if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !
|
|
172
|
+
if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !require_incremental_runtime_class_set.hasTailwindRootDirectives(rawSource)) return false;
|
|
173
|
+
const sourceCss = require_incremental_runtime_class_set.normalizeTailwindSourceForGenerator(rawSource, { importFallback: true });
|
|
72
174
|
if (!require_tailwindcss.upsertTailwindV4CssSource(opts, {
|
|
73
175
|
file: node_path.default.resolve(file.path),
|
|
74
|
-
css:
|
|
75
|
-
})) return;
|
|
176
|
+
css: sourceCss
|
|
177
|
+
})) return false;
|
|
76
178
|
runtimeSetInitialized = false;
|
|
179
|
+
runtimeSetDirty = true;
|
|
180
|
+
await bundleRuntimeClassSetManager.reset();
|
|
77
181
|
debug("detected tailwindcss v4 css source from gulp css file: %s", file.path);
|
|
182
|
+
return true;
|
|
78
183
|
}
|
|
79
184
|
function resolveWithExtensions(base) {
|
|
80
185
|
for (const ext of MODULE_EXTENSIONS) {
|
|
@@ -122,12 +227,14 @@ function createPlugins(options = {}) {
|
|
|
122
227
|
if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
|
|
123
228
|
return cachedDefaultModuleGraphOptions;
|
|
124
229
|
}
|
|
125
|
-
function createVinylTransform(handler) {
|
|
230
|
+
function createVinylTransform(phase, handler) {
|
|
126
231
|
return new Transform({
|
|
127
232
|
objectMode: true,
|
|
128
233
|
async transform(file, _encoding, callback) {
|
|
234
|
+
const hmrTimingStartedAt = performance.now();
|
|
129
235
|
try {
|
|
130
236
|
await handler(file);
|
|
237
|
+
require_incremental_runtime_class_set.emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, { file: file.relative || node_path.default.basename(file.path) });
|
|
131
238
|
callback(null, file);
|
|
132
239
|
} catch (error) {
|
|
133
240
|
callback(error, file);
|
|
@@ -140,12 +247,12 @@ function createPlugins(options = {}) {
|
|
|
140
247
|
if (!options || Object.keys(options).length === 0) {
|
|
141
248
|
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
142
249
|
if (!cached) {
|
|
143
|
-
cached = { majorVersion: runtimeState.twPatcher.majorVersion };
|
|
250
|
+
cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
|
|
144
251
|
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
145
252
|
}
|
|
146
253
|
return cached;
|
|
147
254
|
}
|
|
148
|
-
return {
|
|
255
|
+
return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
|
|
149
256
|
majorVersion: runtimeState.twPatcher.majorVersion,
|
|
150
257
|
...options
|
|
151
258
|
};
|
|
@@ -180,12 +287,25 @@ function createPlugins(options = {}) {
|
|
|
180
287
|
...options
|
|
181
288
|
};
|
|
182
289
|
}
|
|
183
|
-
const transformWxss = (options = {}) => createVinylTransform(async (file) => {
|
|
290
|
+
const transformWxss = (options = {}) => createVinylTransform("css", async (file) => {
|
|
184
291
|
if (!file.contents) return;
|
|
185
292
|
const rawSource = file.contents.toString();
|
|
186
|
-
await registerAutoCssSource(file, rawSource);
|
|
187
|
-
const
|
|
188
|
-
|
|
293
|
+
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
294
|
+
const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
|
|
295
|
+
const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || require_incremental_runtime_class_set.hasTailwindRootDirectives(rawSource);
|
|
296
|
+
let nextRuntimeSet = await refreshRuntimeSet({
|
|
297
|
+
forceRefresh: cssSourceChanged,
|
|
298
|
+
forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
|
|
299
|
+
clearCache: cssSourceChanged
|
|
300
|
+
});
|
|
301
|
+
if (runtimeState.twPatcher.majorVersion === 3 && isMainChunk && shouldUseGenerator) {
|
|
302
|
+
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
|
|
303
|
+
if (sourceCandidates.size > 0) {
|
|
304
|
+
nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
|
|
305
|
+
runtimeSet = nextRuntimeSet;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
await require_incremental_runtime_class_set.processCachedTask({
|
|
189
309
|
cache,
|
|
190
310
|
cacheKey: file.path,
|
|
191
311
|
hash: createRuntimeSetHash(rawSource, nextRuntimeSet),
|
|
@@ -198,7 +318,7 @@ function createPlugins(options = {}) {
|
|
|
198
318
|
async transform() {
|
|
199
319
|
await runtimeState.readyPromise;
|
|
200
320
|
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
|
|
201
|
-
const css = (await
|
|
321
|
+
const css = (shouldUseGenerator ? await require_incremental_runtime_class_set.generateCssByGenerator({
|
|
202
322
|
opts,
|
|
203
323
|
runtimeState,
|
|
204
324
|
runtime: nextRuntimeSet,
|
|
@@ -208,30 +328,30 @@ function createPlugins(options = {}) {
|
|
|
208
328
|
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
209
329
|
styleHandler,
|
|
210
330
|
debug
|
|
211
|
-
}))?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
|
|
331
|
+
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
|
|
212
332
|
debug("css handle: %s", file.path);
|
|
213
333
|
return { result: css };
|
|
214
334
|
}
|
|
215
335
|
});
|
|
216
336
|
});
|
|
217
|
-
const transformJs = (options = {}) => createVinylTransform(async (file) => {
|
|
337
|
+
const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
|
|
218
338
|
if (!file.contents) return;
|
|
219
|
-
await refreshRuntimeSet(true);
|
|
220
|
-
await runtimeState.readyPromise;
|
|
221
339
|
const filename = node_path.default.resolve(file.path);
|
|
340
|
+
const rawSource = file.contents.toString();
|
|
341
|
+
await refreshRuntimeSetForSource(file, rawSource, "js");
|
|
342
|
+
await runtimeState.readyPromise;
|
|
222
343
|
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
223
344
|
const handlerOptions = {
|
|
224
345
|
...options,
|
|
225
346
|
filename,
|
|
226
347
|
moduleGraph,
|
|
227
|
-
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
228
348
|
babelParserOptions: {
|
|
229
349
|
...options?.babelParserOptions ?? {},
|
|
230
350
|
sourceFilename: filename
|
|
231
351
|
}
|
|
232
352
|
};
|
|
233
|
-
|
|
234
|
-
await
|
|
353
|
+
if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
|
|
354
|
+
await require_incremental_runtime_class_set.processCachedTask({
|
|
235
355
|
cache,
|
|
236
356
|
cacheKey: file.path,
|
|
237
357
|
rawSource,
|
|
@@ -244,19 +364,22 @@ function createPlugins(options = {}) {
|
|
|
244
364
|
async transform() {
|
|
245
365
|
await runtimeState.readyPromise;
|
|
246
366
|
const currentSource = file.contents?.toString() ?? rawSource;
|
|
247
|
-
if (require_precheck.shouldSkipJsTransform(currentSource,
|
|
367
|
+
if (require_precheck.shouldSkipJsTransform(currentSource, {
|
|
368
|
+
...handlerOptions,
|
|
369
|
+
classNameSet: runtimeSet
|
|
370
|
+
})) return { result: currentSource };
|
|
248
371
|
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
249
372
|
debug("js handle: %s", file.path);
|
|
250
373
|
return { result: code };
|
|
251
374
|
}
|
|
252
375
|
});
|
|
253
376
|
});
|
|
254
|
-
const transformWxml = (options = {}) => createVinylTransform(async (file) => {
|
|
377
|
+
const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
|
|
255
378
|
if (!file.contents) return;
|
|
256
|
-
await refreshRuntimeSet(true);
|
|
257
|
-
await runtimeState.readyPromise;
|
|
258
379
|
const rawSource = file.contents.toString();
|
|
259
|
-
await
|
|
380
|
+
await refreshRuntimeSetForSource(file, rawSource, "html");
|
|
381
|
+
await runtimeState.readyPromise;
|
|
382
|
+
await require_incremental_runtime_class_set.processCachedTask({
|
|
260
383
|
cache,
|
|
261
384
|
cacheKey: file.path,
|
|
262
385
|
rawSource,
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import process from "node:process";
|
|
1
|
+
import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-jZvTVXXG.mjs";
|
|
2
|
+
import { B as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-DGBhUnjn.mjs";
|
|
3
|
+
import { c as hasTailwindRootDirectives, i as generateCssByGenerator, r as emitHmrTiming, s as processCachedTask, t as createBundleRuntimeClassSetManager, u as normalizeTailwindSourceForGenerator } from "./incremental-runtime-class-set-DArodvWs.mjs";
|
|
4
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-CCZcu0lr.mjs";
|
|
5
|
+
import { t as createSourceCandidateCollector } from "./source-candidates-BuTlMabx.mjs";
|
|
8
6
|
import fs from "node:fs";
|
|
7
|
+
import process from "node:process";
|
|
8
|
+
import path from "node:path";
|
|
9
9
|
import { Buffer } from "node:buffer";
|
|
10
10
|
import stream from "node:stream";
|
|
11
11
|
//#region src/bundlers/gulp/index.ts
|
|
@@ -43,17 +43,118 @@ function createPlugins(options = {}) {
|
|
|
43
43
|
".jsx"
|
|
44
44
|
];
|
|
45
45
|
let runtimeSetInitialized = false;
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
let runtimeSetDirty = false;
|
|
47
|
+
const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
|
|
48
|
+
const runtimeSourcesByFile = /* @__PURE__ */ new Map();
|
|
49
|
+
let cachedGulpSourceCandidates;
|
|
50
|
+
let cachedGulpSourceCandidateSignature;
|
|
51
|
+
const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? createBundleRuntimeClassSetManager();
|
|
52
|
+
async function refreshRuntimeSet(options = false) {
|
|
53
|
+
const normalizedOptions = typeof options === "boolean" ? {
|
|
54
|
+
forceRefresh: options,
|
|
55
|
+
forceCollect: options,
|
|
56
|
+
clearCache: options
|
|
57
|
+
} : options;
|
|
58
|
+
const forceRefresh = normalizedOptions.forceRefresh === true;
|
|
59
|
+
const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
|
|
60
|
+
const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
|
|
61
|
+
if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
|
|
48
62
|
runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
49
|
-
forceRefresh
|
|
50
|
-
forceCollect:
|
|
51
|
-
clearCache
|
|
63
|
+
forceRefresh,
|
|
64
|
+
forceCollect: shouldForceCollect,
|
|
65
|
+
clearCache,
|
|
52
66
|
allowEmpty: false
|
|
53
67
|
});
|
|
54
68
|
runtimeSetInitialized = true;
|
|
69
|
+
runtimeSetDirty = false;
|
|
55
70
|
return runtimeSet;
|
|
56
71
|
}
|
|
72
|
+
function createRuntimeSnapshot(changedFiles) {
|
|
73
|
+
const runtimeAffectingChangedByType = {
|
|
74
|
+
html: /* @__PURE__ */ new Set(),
|
|
75
|
+
js: /* @__PURE__ */ new Set(),
|
|
76
|
+
css: /* @__PURE__ */ new Set(),
|
|
77
|
+
other: /* @__PURE__ */ new Set()
|
|
78
|
+
};
|
|
79
|
+
for (const file of changedFiles) {
|
|
80
|
+
const entry = runtimeSourcesByFile.get(file);
|
|
81
|
+
if (entry) runtimeAffectingChangedByType[entry.type].add(file);
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
entries: [...runtimeSourcesByFile.entries()].map(([file, entry]) => ({
|
|
85
|
+
file,
|
|
86
|
+
output: {
|
|
87
|
+
fileName: file,
|
|
88
|
+
source: entry.source,
|
|
89
|
+
type: "asset"
|
|
90
|
+
},
|
|
91
|
+
source: entry.source,
|
|
92
|
+
type: entry.type
|
|
93
|
+
})),
|
|
94
|
+
jsEntries: /* @__PURE__ */ new Map(),
|
|
95
|
+
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
96
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
97
|
+
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
98
|
+
changedByType: {
|
|
99
|
+
html: /* @__PURE__ */ new Set(),
|
|
100
|
+
js: /* @__PURE__ */ new Set(),
|
|
101
|
+
css: /* @__PURE__ */ new Set(),
|
|
102
|
+
other: /* @__PURE__ */ new Set()
|
|
103
|
+
},
|
|
104
|
+
runtimeAffectingChangedByType,
|
|
105
|
+
processFiles: {
|
|
106
|
+
html: /* @__PURE__ */ new Set(),
|
|
107
|
+
js: /* @__PURE__ */ new Set(),
|
|
108
|
+
css: /* @__PURE__ */ new Set()
|
|
109
|
+
},
|
|
110
|
+
linkedImpactsByEntry: /* @__PURE__ */ new Map()
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
async function refreshRuntimeSetForSource(file, rawSource, type) {
|
|
114
|
+
const filename = path.resolve(file.path);
|
|
115
|
+
const hash = cache.computeHash(rawSource);
|
|
116
|
+
const changed = runtimeSourceHashByFile.get(filename) !== hash;
|
|
117
|
+
runtimeSourceHashByFile.set(filename, hash);
|
|
118
|
+
runtimeSourcesByFile.set(filename, {
|
|
119
|
+
source: rawSource,
|
|
120
|
+
type
|
|
121
|
+
});
|
|
122
|
+
if (!changed && runtimeSetInitialized) return runtimeSet;
|
|
123
|
+
if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
|
|
124
|
+
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createRuntimeSnapshot([filename]));
|
|
125
|
+
runtimeSetInitialized = true;
|
|
126
|
+
return runtimeSet;
|
|
127
|
+
} catch (error) {
|
|
128
|
+
debug("gulp incremental runtime set sync failed, fallback to collect: %O", error);
|
|
129
|
+
await bundleRuntimeClassSetManager.reset();
|
|
130
|
+
}
|
|
131
|
+
return refreshRuntimeSet({ forceCollect: true });
|
|
132
|
+
}
|
|
133
|
+
async function refreshGulpSourceCandidates(forceRefresh = false) {
|
|
134
|
+
if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
|
|
135
|
+
const root = opts.tailwindcssBasedir ?? process.cwd();
|
|
136
|
+
const sourceScan = await resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
|
|
137
|
+
const nextSignature = cache.computeHash(JSON.stringify({
|
|
138
|
+
root,
|
|
139
|
+
entries: sourceScan?.entries,
|
|
140
|
+
inlineCandidates: sourceScan?.inlineCandidates ? {
|
|
141
|
+
included: [...sourceScan.inlineCandidates.included].sort(),
|
|
142
|
+
excluded: [...sourceScan.inlineCandidates.excluded].sort()
|
|
143
|
+
} : void 0,
|
|
144
|
+
explicit: sourceScan?.explicit ?? false,
|
|
145
|
+
dependencies: [...sourceScan?.dependencies ?? []].sort()
|
|
146
|
+
}));
|
|
147
|
+
if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
|
|
148
|
+
const collector = createSourceCandidateCollector({ bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues });
|
|
149
|
+
await collector.scanRoot({
|
|
150
|
+
entries: sourceScan?.entries,
|
|
151
|
+
root
|
|
152
|
+
});
|
|
153
|
+
collector.syncInline(sourceScan?.inlineCandidates);
|
|
154
|
+
cachedGulpSourceCandidateSignature = nextSignature;
|
|
155
|
+
cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
|
|
156
|
+
return cachedGulpSourceCandidates;
|
|
157
|
+
}
|
|
57
158
|
function createRuntimeSetHash(rawSource, nextRuntimeSet) {
|
|
58
159
|
return cache.computeHash([
|
|
59
160
|
rawSource,
|
|
@@ -62,13 +163,17 @@ function createPlugins(options = {}) {
|
|
|
62
163
|
].join("\n\n"));
|
|
63
164
|
}
|
|
64
165
|
async function registerAutoCssSource(file, rawSource) {
|
|
65
|
-
if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !hasTailwindRootDirectives(rawSource)) return;
|
|
166
|
+
if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !hasTailwindRootDirectives(rawSource)) return false;
|
|
167
|
+
const sourceCss = normalizeTailwindSourceForGenerator(rawSource, { importFallback: true });
|
|
66
168
|
if (!upsertTailwindV4CssSource(opts, {
|
|
67
169
|
file: path.resolve(file.path),
|
|
68
|
-
css:
|
|
69
|
-
})) return;
|
|
170
|
+
css: sourceCss
|
|
171
|
+
})) return false;
|
|
70
172
|
runtimeSetInitialized = false;
|
|
173
|
+
runtimeSetDirty = true;
|
|
174
|
+
await bundleRuntimeClassSetManager.reset();
|
|
71
175
|
debug("detected tailwindcss v4 css source from gulp css file: %s", file.path);
|
|
176
|
+
return true;
|
|
72
177
|
}
|
|
73
178
|
function resolveWithExtensions(base) {
|
|
74
179
|
for (const ext of MODULE_EXTENSIONS) {
|
|
@@ -116,12 +221,14 @@ function createPlugins(options = {}) {
|
|
|
116
221
|
if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
|
|
117
222
|
return cachedDefaultModuleGraphOptions;
|
|
118
223
|
}
|
|
119
|
-
function createVinylTransform(handler) {
|
|
224
|
+
function createVinylTransform(phase, handler) {
|
|
120
225
|
return new Transform({
|
|
121
226
|
objectMode: true,
|
|
122
227
|
async transform(file, _encoding, callback) {
|
|
228
|
+
const hmrTimingStartedAt = performance.now();
|
|
123
229
|
try {
|
|
124
230
|
await handler(file);
|
|
231
|
+
emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, { file: file.relative || path.basename(file.path) });
|
|
125
232
|
callback(null, file);
|
|
126
233
|
} catch (error) {
|
|
127
234
|
callback(error, file);
|
|
@@ -134,12 +241,12 @@ function createPlugins(options = {}) {
|
|
|
134
241
|
if (!options || Object.keys(options).length === 0) {
|
|
135
242
|
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
136
243
|
if (!cached) {
|
|
137
|
-
cached = { majorVersion: runtimeState.twPatcher.majorVersion };
|
|
244
|
+
cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
|
|
138
245
|
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
139
246
|
}
|
|
140
247
|
return cached;
|
|
141
248
|
}
|
|
142
|
-
return {
|
|
249
|
+
return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
|
|
143
250
|
majorVersion: runtimeState.twPatcher.majorVersion,
|
|
144
251
|
...options
|
|
145
252
|
};
|
|
@@ -174,11 +281,24 @@ function createPlugins(options = {}) {
|
|
|
174
281
|
...options
|
|
175
282
|
};
|
|
176
283
|
}
|
|
177
|
-
const transformWxss = (options = {}) => createVinylTransform(async (file) => {
|
|
284
|
+
const transformWxss = (options = {}) => createVinylTransform("css", async (file) => {
|
|
178
285
|
if (!file.contents) return;
|
|
179
286
|
const rawSource = file.contents.toString();
|
|
180
|
-
await registerAutoCssSource(file, rawSource);
|
|
181
|
-
const
|
|
287
|
+
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
288
|
+
const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
|
|
289
|
+
const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || hasTailwindRootDirectives(rawSource);
|
|
290
|
+
let nextRuntimeSet = await refreshRuntimeSet({
|
|
291
|
+
forceRefresh: cssSourceChanged,
|
|
292
|
+
forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
|
|
293
|
+
clearCache: cssSourceChanged
|
|
294
|
+
});
|
|
295
|
+
if (runtimeState.twPatcher.majorVersion === 3 && isMainChunk && shouldUseGenerator) {
|
|
296
|
+
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
|
|
297
|
+
if (sourceCandidates.size > 0) {
|
|
298
|
+
nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
|
|
299
|
+
runtimeSet = nextRuntimeSet;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
182
302
|
await processCachedTask({
|
|
183
303
|
cache,
|
|
184
304
|
cacheKey: file.path,
|
|
@@ -192,7 +312,7 @@ function createPlugins(options = {}) {
|
|
|
192
312
|
async transform() {
|
|
193
313
|
await runtimeState.readyPromise;
|
|
194
314
|
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
|
|
195
|
-
const css = (await generateCssByGenerator({
|
|
315
|
+
const css = (shouldUseGenerator ? await generateCssByGenerator({
|
|
196
316
|
opts,
|
|
197
317
|
runtimeState,
|
|
198
318
|
runtime: nextRuntimeSet,
|
|
@@ -202,29 +322,29 @@ function createPlugins(options = {}) {
|
|
|
202
322
|
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
203
323
|
styleHandler,
|
|
204
324
|
debug
|
|
205
|
-
}))?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
|
|
325
|
+
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
|
|
206
326
|
debug("css handle: %s", file.path);
|
|
207
327
|
return { result: css };
|
|
208
328
|
}
|
|
209
329
|
});
|
|
210
330
|
});
|
|
211
|
-
const transformJs = (options = {}) => createVinylTransform(async (file) => {
|
|
331
|
+
const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
|
|
212
332
|
if (!file.contents) return;
|
|
213
|
-
await refreshRuntimeSet(true);
|
|
214
|
-
await runtimeState.readyPromise;
|
|
215
333
|
const filename = path.resolve(file.path);
|
|
334
|
+
const rawSource = file.contents.toString();
|
|
335
|
+
await refreshRuntimeSetForSource(file, rawSource, "js");
|
|
336
|
+
await runtimeState.readyPromise;
|
|
216
337
|
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
217
338
|
const handlerOptions = {
|
|
218
339
|
...options,
|
|
219
340
|
filename,
|
|
220
341
|
moduleGraph,
|
|
221
|
-
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
222
342
|
babelParserOptions: {
|
|
223
343
|
...options?.babelParserOptions ?? {},
|
|
224
344
|
sourceFilename: filename
|
|
225
345
|
}
|
|
226
346
|
};
|
|
227
|
-
|
|
347
|
+
if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
|
|
228
348
|
await processCachedTask({
|
|
229
349
|
cache,
|
|
230
350
|
cacheKey: file.path,
|
|
@@ -238,18 +358,21 @@ function createPlugins(options = {}) {
|
|
|
238
358
|
async transform() {
|
|
239
359
|
await runtimeState.readyPromise;
|
|
240
360
|
const currentSource = file.contents?.toString() ?? rawSource;
|
|
241
|
-
if (shouldSkipJsTransform(currentSource,
|
|
361
|
+
if (shouldSkipJsTransform(currentSource, {
|
|
362
|
+
...handlerOptions,
|
|
363
|
+
classNameSet: runtimeSet
|
|
364
|
+
})) return { result: currentSource };
|
|
242
365
|
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
243
366
|
debug("js handle: %s", file.path);
|
|
244
367
|
return { result: code };
|
|
245
368
|
}
|
|
246
369
|
});
|
|
247
370
|
});
|
|
248
|
-
const transformWxml = (options = {}) => createVinylTransform(async (file) => {
|
|
371
|
+
const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
|
|
249
372
|
if (!file.contents) return;
|
|
250
|
-
await refreshRuntimeSet(true);
|
|
251
|
-
await runtimeState.readyPromise;
|
|
252
373
|
const rawSource = file.contents.toString();
|
|
374
|
+
await refreshRuntimeSetForSource(file, rawSource, "html");
|
|
375
|
+
await runtimeState.readyPromise;
|
|
253
376
|
await processCachedTask({
|
|
254
377
|
cache,
|
|
255
378
|
cacheKey: file.path,
|