weapp-tailwindcss 5.0.6 → 5.0.8

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.
Files changed (103) hide show
  1. package/dist/{bundle-state-CdNXQl-o.mjs → bundle-state-5FtFktJr.mjs} +2 -1
  2. package/dist/{bundle-state-CFgzVHFP.js → bundle-state-cHwTyrOS.js} +2 -1
  3. package/dist/bundlers/gulp/index.d.ts +3 -4
  4. package/dist/bundlers/gulp/module-graph.d.ts +2 -0
  5. package/dist/bundlers/gulp/runtime-snapshot.d.ts +5 -0
  6. package/dist/bundlers/gulp/vinyl-transform.d.ts +3 -0
  7. package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
  8. package/dist/bundlers/shared/css-source-trace.d.ts +20 -0
  9. package/dist/bundlers/shared/generator-css/directives/fallback.d.ts +11 -0
  10. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +56 -0
  11. package/dist/bundlers/shared/generator-css/local-imports.d.ts +7 -0
  12. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
  13. package/dist/bundlers/shared/generator-css/types.d.ts +27 -0
  14. package/dist/bundlers/shared/generator-css/user-css.d.ts +26 -0
  15. package/dist/bundlers/shared/generator-css/validate.d.ts +5 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +4 -32
  17. package/dist/bundlers/vite/css-finalizer.d.ts +3 -0
  18. package/dist/bundlers/vite/generate-bundle/css-config-directives.d.ts +2 -0
  19. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +14 -0
  20. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +11 -0
  21. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +9 -0
  22. package/dist/bundlers/vite/generate-bundle/style-matching.d.ts +5 -0
  23. package/dist/bundlers/vite/generate-bundle/subpackages.d.ts +7 -0
  24. package/dist/bundlers/vite/generate-bundle/types.d.ts +68 -0
  25. package/dist/bundlers/vite/generate-bundle.d.ts +4 -62
  26. package/dist/bundlers/vite/incremental-runtime-class-set/entries.d.ts +4 -0
  27. package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +2 -0
  28. package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +13 -0
  29. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +1 -0
  30. package/dist/bundlers/vite/processed-css-assets/css-rules.d.ts +17 -0
  31. package/dist/bundlers/vite/processed-css-assets.d.ts +2 -0
  32. package/dist/bundlers/vite/source-candidates/scan-root.d.ts +10 -0
  33. package/dist/bundlers/vite/source-candidates/script.d.ts +7 -0
  34. package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +1 -0
  35. package/dist/bundlers/vite/source-candidates.d.ts +8 -3
  36. package/dist/bundlers/vite/source-scan/css-entries.d.ts +20 -0
  37. package/dist/bundlers/vite/source-scan/dependencies.d.ts +2 -0
  38. package/dist/bundlers/vite/source-scan.d.ts +2 -12
  39. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -0
  40. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -20
  41. package/dist/cli.js +71 -69
  42. package/dist/cli.mjs +71 -69
  43. package/dist/core.js +1 -1
  44. package/dist/core.mjs +1 -1
  45. package/dist/{defaults-BPUuNYcD.js → defaults-Boc26eel.js} +1 -0
  46. package/dist/{defaults-8xrgzxFY.mjs → defaults-DH0ZQRhy.mjs} +1 -0
  47. package/dist/defaults.js +1 -1
  48. package/dist/defaults.mjs +1 -1
  49. package/dist/{generator-C56PJYxA.js → generator-C--TrAod.js} +1 -1
  50. package/dist/{generator-Bgn4m8An.mjs → generator-DnwUQOXB.mjs} +1 -1
  51. package/dist/generator.js +2 -2
  52. package/dist/generator.mjs +2 -2
  53. package/dist/gulp-5Tan5bHG.js +473 -0
  54. package/dist/gulp-B22YSGU_.mjs +463 -0
  55. package/dist/gulp.js +4 -414
  56. package/dist/gulp.mjs +1 -406
  57. package/dist/{incremental-runtime-class-set-Bmzdjlk0.js → hmr-timing-CscCNKb9.js} +1205 -449
  58. package/dist/{incremental-runtime-class-set-BEYHQkZc.mjs → hmr-timing-DK-mine6.mjs} +1169 -467
  59. package/dist/index.js +5 -5
  60. package/dist/index.mjs +5 -5
  61. package/dist/{postcss-BgINK7Nm.mjs → postcss-CjWuDZwL.mjs} +4 -4
  62. package/dist/{postcss-B7QNe78h.js → postcss-R5pDVHUy.js} +7 -7
  63. package/dist/postcss.js +1 -1
  64. package/dist/postcss.mjs +1 -1
  65. package/dist/{precheck-CyPbGn38.js → precheck-B8y6tDvG.js} +19 -5
  66. package/dist/{precheck-Copn2SqE.mjs → precheck-CcxTR7E_.mjs} +19 -5
  67. package/dist/presets.js +2 -2
  68. package/dist/presets.mjs +2 -2
  69. package/dist/tailwindcss/source-scan/inline-source.d.ts +7 -0
  70. package/dist/tailwindcss/source-scan.d.ts +2 -7
  71. package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +3 -0
  72. package/dist/tailwindcss/v3-engine/generator/content.d.ts +10 -0
  73. package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +2 -0
  74. package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +2 -0
  75. package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +6 -0
  76. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +2 -0
  77. package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
  78. package/dist/{tailwindcss-C0Zgo3Es.mjs → tailwindcss-0DaftXcU.mjs} +2 -2
  79. package/dist/{tailwindcss-Tw6CSVHL.js → tailwindcss-DbZ4o4m_.js} +2 -2
  80. package/dist/{transform-DgCFGtQR.mjs → transform-DRyWUN5X.mjs} +11 -2
  81. package/dist/{transform-95ivJthq.js → transform-DiW_u3eD.js} +11 -2
  82. package/dist/types/typedoc-tailwindcss-patch.d.ts +4 -2
  83. package/dist/types/user-defined-options/general.d.ts +5 -0
  84. package/dist/uni-app-x/component-local-style.d.ts +1 -0
  85. package/dist/uni-app-x/harmony.d.ts +1 -0
  86. package/dist/uni-app-x/style-asset/style-value.d.ts +16 -0
  87. package/dist/uni-app-x/style-asset.d.ts +20 -0
  88. package/dist/uni-app-x/transform.d.ts +1 -0
  89. package/dist/uni-app-x/vite.d.ts +1 -0
  90. package/dist/{v3-engine-Ji6AXPh2.mjs → v3-engine-ArQVHEau.mjs} +786 -699
  91. package/dist/{v3-engine-6FVAcrZl.js → v3-engine-DdlvXpID.js} +788 -701
  92. package/dist/{vite-Bw6LOXvf.js → vite-C_IUnDBy.js} +1797 -386
  93. package/dist/{vite-ChZ2cbn4.mjs → vite-_iUhzc4t.mjs} +1779 -369
  94. package/dist/vite.js +1 -1
  95. package/dist/vite.mjs +1 -1
  96. package/dist/weapp-tw-css-import-rewrite-loader.js +1148 -987
  97. package/dist/{webpack-CMJ7iqN7.mjs → webpack-CqnI4Ymw.mjs} +104 -37
  98. package/dist/{webpack-nn3P8_S_.js → webpack-KLoTb5Dr.js} +113 -45
  99. package/dist/webpack.js +1 -1
  100. package/dist/webpack.mjs +1 -1
  101. package/package.json +6 -5
  102. package/dist/source-candidates-BODCmzz5.mjs +0 -355
  103. package/dist/source-candidates-Caf2GDvx.js +0 -374
package/dist/gulp.js CHANGED
@@ -1,415 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_chunk = require("./chunk-emK7D4bc.js");
3
- const require_v3_engine = require("./v3-engine-6FVAcrZl.js");
4
- const require_precheck = require("./precheck-CyPbGn38.js");
5
- const require_tailwindcss = require("./tailwindcss-Tw6CSVHL.js");
6
- const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-Bmzdjlk0.js");
7
- const require_source_candidates = require("./source-candidates-Caf2GDvx.js");
8
- let node_fs = require("node:fs");
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
- let node_buffer = require("node:buffer");
15
- let node_stream = require("node:stream");
16
- node_stream = require_chunk.__toESM(node_stream);
17
- //#region src/bundlers/gulp/index.ts
18
- const debug = require_v3_engine.createDebug();
19
- const Transform = node_stream.default.Transform;
20
- /**
21
- * @name weapp-tw-gulp
22
- * @description gulp版本weapp-tw插件
23
- * @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
24
- */
25
- function createPlugins(options = {}) {
26
- const hasInitialTailwindCssRoots = require_tailwindcss.hasConfiguredTailwindV4CssRoots(options);
27
- const opts = require_precheck.getCompilerContext({
28
- ...options,
29
- __internalDeferMissingCssEntriesWarning: true
30
- });
31
- const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
32
- const readyPromise = require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher);
33
- let runtimeSet = /* @__PURE__ */ new Set();
34
- const runtimeState = {
35
- twPatcher: initialTwPatcher,
36
- readyPromise,
37
- refreshTailwindcssPatcher
38
- };
39
- const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
40
- let cachedDefaultTemplateHandlerOptions;
41
- let cachedDefaultTemplateRuntimeSet;
42
- let cachedDefaultModuleGraphOptions;
43
- const MODULE_EXTENSIONS = [
44
- ".js",
45
- ".mjs",
46
- ".cjs",
47
- ".ts",
48
- ".tsx",
49
- ".jsx"
50
- ];
51
- let runtimeSetInitialized = false;
52
- let runtimeSetDirty = false;
53
- const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
54
- const runtimeSourcesByFile = /* @__PURE__ */ new Map();
55
- let cachedGulpSourceCandidates;
56
- let cachedGulpSourceCandidateSignature;
57
- const sourceCandidateExtractor = initialTwPatcher.majorVersion === 3 ? require_source_candidates.createTailwindV3DefaultExtractor() : void 0;
58
- const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? require_incremental_runtime_class_set.createBundleRuntimeClassSetManager();
59
- async function refreshRuntimeSet(options = false) {
60
- const normalizedOptions = typeof options === "boolean" ? {
61
- forceRefresh: options,
62
- forceCollect: options,
63
- clearCache: options
64
- } : options;
65
- const forceRefresh = normalizedOptions.forceRefresh === true;
66
- const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
67
- const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
68
- if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
69
- runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
70
- forceRefresh,
71
- forceCollect: shouldForceCollect,
72
- clearCache,
73
- allowEmpty: false
74
- });
75
- runtimeSetInitialized = true;
76
- runtimeSetDirty = false;
77
- return runtimeSet;
78
- }
79
- function createRuntimeSnapshot(changedFiles) {
80
- const runtimeAffectingChangedByType = {
81
- html: /* @__PURE__ */ new Set(),
82
- js: /* @__PURE__ */ new Set(),
83
- css: /* @__PURE__ */ new Set(),
84
- other: /* @__PURE__ */ new Set()
85
- };
86
- for (const file of changedFiles) {
87
- const entry = runtimeSourcesByFile.get(file);
88
- if (entry) runtimeAffectingChangedByType[entry.type].add(file);
89
- }
90
- return {
91
- entries: [...runtimeSourcesByFile.entries()].map(([file, entry]) => ({
92
- file,
93
- output: {
94
- fileName: file,
95
- source: entry.source,
96
- type: "asset"
97
- },
98
- source: entry.source,
99
- type: entry.type
100
- })),
101
- jsEntries: /* @__PURE__ */ new Map(),
102
- sourceHashByFile: /* @__PURE__ */ new Map(),
103
- runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
104
- runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
105
- changedByType: {
106
- html: /* @__PURE__ */ new Set(),
107
- js: /* @__PURE__ */ new Set(),
108
- css: /* @__PURE__ */ new Set(),
109
- other: /* @__PURE__ */ new Set()
110
- },
111
- runtimeAffectingChangedByType,
112
- processFiles: {
113
- html: /* @__PURE__ */ new Set(),
114
- js: /* @__PURE__ */ new Set(),
115
- css: /* @__PURE__ */ new Set()
116
- },
117
- linkedImpactsByEntry: /* @__PURE__ */ new Map()
118
- };
119
- }
120
- async function refreshRuntimeSetForSource(file, rawSource, type) {
121
- const filename = node_path.default.resolve(file.path);
122
- const hash = cache.computeHash(rawSource);
123
- const changed = runtimeSourceHashByFile.get(filename) !== hash;
124
- runtimeSourceHashByFile.set(filename, hash);
125
- runtimeSourcesByFile.set(filename, {
126
- source: rawSource,
127
- type
128
- });
129
- if (!changed && runtimeSetInitialized) return runtimeSet;
130
- if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
131
- runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createRuntimeSnapshot([filename]));
132
- runtimeSetInitialized = true;
133
- return runtimeSet;
134
- } catch (error) {
135
- debug("gulp incremental runtime set sync failed, fallback to collect: %O", error);
136
- await bundleRuntimeClassSetManager.reset();
137
- }
138
- return refreshRuntimeSet({ forceCollect: true });
139
- }
140
- async function refreshGulpSourceCandidates(forceRefresh = false) {
141
- if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
142
- const root = opts.tailwindcssBasedir ?? node_process.default.cwd();
143
- const sourceScan = await require_v3_engine.resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
144
- const nextSignature = cache.computeHash(JSON.stringify({
145
- root,
146
- entries: sourceScan?.entries,
147
- inlineCandidates: sourceScan?.inlineCandidates ? {
148
- included: [...sourceScan.inlineCandidates.included].sort(),
149
- excluded: [...sourceScan.inlineCandidates.excluded].sort()
150
- } : void 0,
151
- explicit: sourceScan?.explicit ?? false,
152
- dependencies: [...sourceScan?.dependencies ?? []].sort()
153
- }));
154
- if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
155
- const collector = require_source_candidates.createSourceCandidateCollector({
156
- bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
157
- extractor: sourceCandidateExtractor
158
- });
159
- await collector.scanRoot({
160
- entries: sourceScan?.entries,
161
- root
162
- });
163
- collector.syncInline(sourceScan?.inlineCandidates);
164
- cachedGulpSourceCandidateSignature = nextSignature;
165
- cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
166
- return cachedGulpSourceCandidates;
167
- }
168
- function createRuntimeSetHash(rawSource, nextRuntimeSet) {
169
- return cache.computeHash([
170
- rawSource,
171
- require_v3_engine.getRuntimeClassSetSignature(runtimeState.twPatcher),
172
- [...nextRuntimeSet].sort().join("\n")
173
- ].join("\n\n"));
174
- }
175
- async function registerAutoCssSource(file, rawSource) {
176
- if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !require_v3_engine.hasTailwindRootDirectives(rawSource)) return false;
177
- const sourceFile = node_path.default.resolve(file.path);
178
- const sourceCss = require_v3_engine.normalizeTailwindSourceForGenerator(require_v3_engine.normalizeTailwindConfigDirectives(rawSource, node_path.default.dirname(sourceFile)), { importFallback: true });
179
- if (!require_tailwindcss.upsertTailwindV4CssSource(opts, {
180
- file: sourceFile,
181
- base: node_path.default.dirname(sourceFile),
182
- css: sourceCss
183
- })) return false;
184
- runtimeSetInitialized = false;
185
- runtimeSetDirty = true;
186
- await bundleRuntimeClassSetManager.reset();
187
- debug("detected tailwindcss v4 css source from gulp css file: %s", file.path);
188
- return true;
189
- }
190
- function resolveWithExtensions(base) {
191
- for (const ext of MODULE_EXTENSIONS) {
192
- const candidate = `${base}${ext}`;
193
- try {
194
- if (node_fs.default.statSync(candidate).isFile()) return candidate;
195
- } catch {
196
- continue;
197
- }
198
- }
199
- }
200
- function resolveLocalModuleCandidate(base) {
201
- try {
202
- const stat = node_fs.default.statSync(base);
203
- if (stat.isFile()) return base;
204
- if (stat.isDirectory()) {
205
- const resolvedIndex = resolveWithExtensions(node_path.default.join(base, "index"));
206
- if (resolvedIndex) return resolvedIndex;
207
- }
208
- } catch {}
209
- if (!node_path.default.extname(base)) return resolveWithExtensions(base);
210
- }
211
- function createModuleGraphOptionsFor() {
212
- return {
213
- resolve(specifier, importer) {
214
- if (!specifier) return;
215
- if (!specifier.startsWith(".") && !node_path.default.isAbsolute(specifier)) return;
216
- return resolveLocalModuleCandidate(node_path.default.resolve(node_path.default.dirname(importer), specifier));
217
- },
218
- load(id) {
219
- try {
220
- return node_fs.default.readFileSync(id, "utf8");
221
- } catch {
222
- return;
223
- }
224
- },
225
- filter(id) {
226
- const relative = node_path.default.relative(node_process.default.cwd(), id);
227
- return opts.jsMatcher(relative) || opts.wxsMatcher(relative);
228
- }
229
- };
230
- }
231
- function resolveModuleGraphOptions(moduleGraph) {
232
- if (moduleGraph) return moduleGraph;
233
- if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
234
- return cachedDefaultModuleGraphOptions;
235
- }
236
- function createVinylTransform(phase, handler) {
237
- return new Transform({
238
- objectMode: true,
239
- async transform(file, _encoding, callback) {
240
- const hmrTimingStartedAt = performance.now();
241
- try {
242
- await handler(file);
243
- require_incremental_runtime_class_set.emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, { file: file.relative || node_path.default.basename(file.path) });
244
- callback(null, file);
245
- } catch (error) {
246
- callback(error, file);
247
- }
248
- }
249
- });
250
- }
251
- function resolveWxssHandlerOptions(options) {
252
- const majorVersion = runtimeState.twPatcher.majorVersion ?? "unknown";
253
- if (!options || Object.keys(options).length === 0) {
254
- let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
255
- if (!cached) {
256
- cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
257
- defaultStyleHandlerOptionsCache.set(majorVersion, cached);
258
- }
259
- return cached;
260
- }
261
- return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
262
- majorVersion: runtimeState.twPatcher.majorVersion,
263
- ...options
264
- };
265
- }
266
- function resolveGulpMatcherName(file) {
267
- return (file.relative || node_path.default.basename(file.path)).replaceAll(node_path.default.sep, "/");
268
- }
269
- function resolveWxssFileHandlerOptions(file, options) {
270
- const resolved = resolveWxssHandlerOptions(options);
271
- if (resolved.isMainChunk !== void 0) return resolved;
272
- return {
273
- ...resolved,
274
- isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType)
275
- };
276
- }
277
- function resolveWxssUserHandlerOptions(options) {
278
- return {
279
- ...resolveWxssHandlerOptions(options),
280
- isMainChunk: false
281
- };
282
- }
283
- function resolveWxmlHandlerOptions(options) {
284
- if (!options || Object.keys(options).length === 0) {
285
- if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
286
- cachedDefaultTemplateRuntimeSet = runtimeSet;
287
- cachedDefaultTemplateHandlerOptions = { runtimeSet };
288
- }
289
- return cachedDefaultTemplateHandlerOptions;
290
- }
291
- return {
292
- runtimeSet,
293
- ...options
294
- };
295
- }
296
- const transformWxss = (options = {}) => createVinylTransform("css", async (file) => {
297
- if (!file.contents) return;
298
- const rawSource = file.contents.toString();
299
- const cssSourceChanged = await registerAutoCssSource(file, rawSource);
300
- const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
301
- const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || require_v3_engine.hasTailwindRootDirectives(rawSource);
302
- let nextRuntimeSet = await refreshRuntimeSet({
303
- forceRefresh: cssSourceChanged,
304
- forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
305
- clearCache: cssSourceChanged
306
- });
307
- if (runtimeState.twPatcher.majorVersion === 3 && isMainChunk && shouldUseGenerator) {
308
- const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
309
- if (sourceCandidates.size > 0) {
310
- nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
311
- runtimeSet = nextRuntimeSet;
312
- }
313
- }
314
- await require_incremental_runtime_class_set.processCachedTask({
315
- cache,
316
- cacheKey: file.path,
317
- hash: createRuntimeSetHash(rawSource, nextRuntimeSet),
318
- applyResult(source) {
319
- file.contents = node_buffer.Buffer.from(source);
320
- },
321
- onCacheHit() {
322
- debug("css cache hit: %s", file.path);
323
- },
324
- async transform() {
325
- await runtimeState.readyPromise;
326
- const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
327
- const css = (shouldUseGenerator ? await require_incremental_runtime_class_set.generateCssByGenerator({
328
- opts,
329
- runtimeState,
330
- runtime: nextRuntimeSet,
331
- rawSource,
332
- file: file.path,
333
- cssHandlerOptions,
334
- cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
335
- styleHandler,
336
- debug
337
- }) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
338
- debug("css handle: %s", file.path);
339
- return { result: css };
340
- }
341
- });
342
- });
343
- const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
344
- if (!file.contents) return;
345
- const filename = node_path.default.resolve(file.path);
346
- const rawSource = file.contents.toString();
347
- await refreshRuntimeSetForSource(file, rawSource, "js");
348
- await runtimeState.readyPromise;
349
- const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
350
- const handlerOptions = {
351
- ...options,
352
- filename,
353
- moduleGraph,
354
- babelParserOptions: {
355
- ...options?.babelParserOptions ?? {},
356
- sourceFilename: filename
357
- }
358
- };
359
- if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
360
- await require_incremental_runtime_class_set.processCachedTask({
361
- cache,
362
- cacheKey: file.path,
363
- rawSource,
364
- applyResult(source) {
365
- file.contents = node_buffer.Buffer.from(source);
366
- },
367
- onCacheHit() {
368
- debug("js cache hit: %s", file.path);
369
- },
370
- async transform() {
371
- await runtimeState.readyPromise;
372
- const currentSource = file.contents?.toString() ?? rawSource;
373
- if (require_precheck.shouldSkipJsTransform(currentSource, {
374
- ...handlerOptions,
375
- classNameSet: runtimeSet
376
- })) return { result: currentSource };
377
- const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
378
- debug("js handle: %s", file.path);
379
- return { result: code };
380
- }
381
- });
382
- });
383
- const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
384
- if (!file.contents) return;
385
- const rawSource = file.contents.toString();
386
- await refreshRuntimeSetForSource(file, rawSource, "html");
387
- await runtimeState.readyPromise;
388
- await require_incremental_runtime_class_set.processCachedTask({
389
- cache,
390
- cacheKey: file.path,
391
- rawSource,
392
- applyResult(source) {
393
- file.contents = node_buffer.Buffer.from(source);
394
- },
395
- onCacheHit() {
396
- debug("html cache hit: %s", file.path);
397
- },
398
- async transform() {
399
- await runtimeState.readyPromise;
400
- const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
401
- debug("html handle: %s", file.path);
402
- return { result: code };
403
- }
404
- });
405
- });
406
- return {
407
- transformWxss,
408
- transformWxml,
409
- transformJs
410
- };
411
- }
412
- //#endregion
413
- exports.WeappTailwindcss = createPlugins;
414
- exports.createPlugins = createPlugins;
415
- exports.weappTailwindcss = createPlugins;
2
+ const require_gulp = require("./gulp-5Tan5bHG.js");
3
+ exports.WeappTailwindcss = require_gulp.createPlugins;
4
+ exports.createPlugins = require_gulp.createPlugins;
5
+ exports.weappTailwindcss = require_gulp.createPlugins;