weapp-tailwindcss 5.1.15 → 5.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundlers/gulp/shared/create-native-framework-plugins/cache-state.d.ts +71 -0
- package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +43 -0
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +2 -2
- package/dist/bundlers/shared/framework-postcss.d.ts +14 -0
- package/dist/bundlers/shared/generator-css/generation-helpers/preflight.d.ts +18 -0
- package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +25 -0
- package/dist/bundlers/shared/generator-css/generation-helpers/runtime-isolation.d.ts +30 -0
- package/dist/bundlers/shared/generator-css/generation-helpers/source-order.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +4 -72
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +3 -1
- package/dist/bundlers/shared/generator-css/pipeline/deferred-output.d.ts +14 -0
- package/dist/bundlers/shared/generator-css/pipeline/execution.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/pipeline/fallback-output.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/pipeline/ordered-output.d.ts +25 -0
- package/dist/bundlers/shared/generator-css/pipeline.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/result-helpers.d.ts +6 -0
- package/dist/bundlers/shared/generator-css/scoped-rules.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/source-resolver/configuration.d.ts +33 -0
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-source.d.ts +4 -0
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-sources.d.ts +4 -0
- package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +16 -0
- package/dist/bundlers/shared/generator-css/source-resolver/source-entries.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/source-matching.d.ts +5 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +3 -6
- package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +9 -0
- package/dist/bundlers/shared/generator-css/user-css/at-rules.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +4 -0
- package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +9 -0
- package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +10 -0
- package/dist/bundlers/shared/generator-css/user-css/user-layers.d.ts +15 -0
- package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -33
- package/dist/bundlers/shared/generator-css.d.ts +1 -2
- package/dist/bundlers/shared/v4-generation-core.d.ts +3 -0
- package/dist/bundlers/vite/css-finalizer/options.d.ts +54 -0
- package/dist/bundlers/vite/css-finalizer/plugin.d.ts +3 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -43
- package/dist/bundlers/vite/generate-bundle/finalize/bundle.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/finalize/root-import-shell.d.ts +69 -0
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +2 -70
- package/dist/bundlers/vite/generate-bundle-runtime.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +12 -0
- package/dist/bundlers/vite/processed-css-assets/collector.d.ts +4 -0
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +34 -0
- package/dist/bundlers/vite/processed-css-assets/injection-plan.d.ts +42 -0
- package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +89 -0
- package/dist/bundlers/vite/processed-css-assets/style-files.d.ts +3 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +4 -71
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/serve-css-generation.d.ts +1 -0
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +2 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +4 -4
- package/dist/bundlers/vite/source-candidates/collector.d.ts +8 -0
- package/dist/bundlers/vite/source-candidates/store.d.ts +2 -0
- package/dist/bundlers/vite/source-candidates/types-and-cache.d.ts +69 -0
- package/dist/bundlers/vite/source-candidates.d.ts +4 -68
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/finalize-assets.d.ts +2 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/generated-css-result.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/generated-css-task.d.ts +2 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/html-js-tasks.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/finalize.d.ts +30 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/generated-css.d.ts +8 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/memory-trace.d.ts +78 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/preflight-runtime.d.ts +43 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/resources.d.ts +30 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/runtime-candidates.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/sources.d.ts +28 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css-markers.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css.d.ts +21 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +9 -219
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/processed-css-task.d.ts +4 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +5 -0
- package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +20 -0
- package/dist/bundlers/webpack/shared/create-framework-plugin/watch-output.d.ts +13 -0
- package/dist/bundlers/webpack/shared/create-framework-plugin.d.ts +3 -21
- package/dist/cli.js +14 -18
- package/dist/cli.mjs +14 -18
- package/dist/{context-VeFq_8vW.js → context-BtLIID4m.js} +3 -3
- package/dist/{context-BgGWVAmN.mjs → context-JzwzSX36.mjs} +3 -3
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-CEnUsjed.js → generator-B91GhUJQ.js} +636 -505
- package/dist/{generator-CEo920So.mjs → generator-Bv7myuhY.mjs} +556 -431
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/{gulp-DP71z1jG.mjs → gulp-CKSklPlH.mjs} +217 -186
- package/dist/{gulp-3m1dAiig.js → gulp-Q1wITegn.js} +217 -186
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-1aS6--U7.mjs → hmr-timing-BXg7nI8N.mjs} +3411 -3276
- package/dist/{hmr-timing-B8p4f0ca.js → hmr-timing-CMPaWn9P.js} +3425 -3278
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/shared/mpx-plugin-owner.d.ts +2 -0
- package/dist/{source-candidate-scan-signature-BAahhiwb.js → source-candidate-scan-signature-BKZZk_e6.js} +144 -4
- package/dist/{source-candidate-scan-signature-Cf7259PR.mjs → source-candidate-scan-signature-CtK-mB_C.mjs} +127 -4
- package/dist/tailwindcss/v4-engine/generator/cache-stats.d.ts +26 -0
- package/dist/tailwindcss/v4-engine/generator/engine.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +52 -0
- package/dist/tailwindcss/v4-engine/generator.d.ts +2 -28
- package/dist/{tailwindcss-KBYPJ2DW.js → tailwindcss-B4phC0kB.js} +2 -2
- package/dist/{tailwindcss-xs704TRw.mjs → tailwindcss-BTcXX8Ka.mjs} +2 -2
- package/dist/{vite-nXZEiwG0.mjs → vite-BwQWl9ft.mjs} +806 -692
- package/dist/{vite-DUVjMduj.js → vite-DhVnXvAQ.js} +805 -691
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-generation-loader.js +1 -1
- package/dist/{weapp-tw-css-import-rewrite-loader-DNk0IxAt.js → weapp-tw-css-import-rewrite-loader-B0tVkJLH.js} +2410 -2084
- package/dist/weapp-tw-css-import-rewrite-loader.js +1 -1
- package/dist/weapp-tw-runtime-classset-loader.js +10 -4
- package/dist/{webpack-C_UUFRgj.mjs → webpack-Bo1QrFPf.mjs} +1387 -1114
- package/dist/{webpack-nppysF4B.js → webpack-kh78iMSS.js} +1386 -1113
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +9 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
2
|
+
const require_generator = require("./generator-B91GhUJQ.js");
|
|
3
|
+
const require_tailwindcss = require("./tailwindcss-B4phC0kB.js");
|
|
4
4
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
5
|
-
const require_context = require("./context-
|
|
6
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
5
|
+
const require_context = require("./context-BtLIID4m.js");
|
|
6
|
+
const require_hmr_timing = require("./hmr-timing-CMPaWn9P.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -109,29 +109,7 @@ function createGulpRuntimeSnapshot(runtimeSourcesByFile, changedFiles) {
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
//#endregion
|
|
112
|
-
//#region src/bundlers/gulp/
|
|
113
|
-
const Transform = node_stream.default.Transform;
|
|
114
|
-
function createVinylTransform(phase, handler, getTimingDetails) {
|
|
115
|
-
return new Transform({
|
|
116
|
-
objectMode: true,
|
|
117
|
-
async transform(file, _encoding, callback) {
|
|
118
|
-
const hmrTimingStartedAt = performance.now();
|
|
119
|
-
try {
|
|
120
|
-
await handler(file);
|
|
121
|
-
require_hmr_timing.emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, {
|
|
122
|
-
file: file.relative || node_path.default.basename(file.path),
|
|
123
|
-
...getTimingDetails?.(file)
|
|
124
|
-
});
|
|
125
|
-
callback(null, file);
|
|
126
|
-
} catch (error) {
|
|
127
|
-
callback(error, file);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region src/bundlers/gulp/shared/create-native-framework-plugins.ts
|
|
134
|
-
const debug = require_wxml.createDebug();
|
|
112
|
+
//#region src/bundlers/gulp/shared/create-native-framework-plugins/cache-state.ts
|
|
135
113
|
const GULP_RUNTIME_SOURCE_CACHE_MAX = 256;
|
|
136
114
|
const GULP_PROCESS_CACHE_MAX = 512;
|
|
137
115
|
function toMb(bytes) {
|
|
@@ -192,6 +170,195 @@ function resolveGulpMemoryDebugStats(context) {
|
|
|
192
170
|
tailwind: { v4: require_generator.getTailwindV4IncrementalGenerateCacheStats() }
|
|
193
171
|
};
|
|
194
172
|
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/bundlers/gulp/vinyl-transform.ts
|
|
175
|
+
const Transform = node_stream.default.Transform;
|
|
176
|
+
function createVinylTransform(phase, handler, getTimingDetails) {
|
|
177
|
+
return new Transform({
|
|
178
|
+
objectMode: true,
|
|
179
|
+
async transform(file, _encoding, callback) {
|
|
180
|
+
const hmrTimingStartedAt = performance.now();
|
|
181
|
+
try {
|
|
182
|
+
await handler(file);
|
|
183
|
+
require_hmr_timing.emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, {
|
|
184
|
+
file: file.relative || node_path.default.basename(file.path),
|
|
185
|
+
...getTimingDetails?.(file)
|
|
186
|
+
});
|
|
187
|
+
callback(null, file);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
callback(error, file);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.ts
|
|
196
|
+
function createGulpFileTransforms(context) {
|
|
197
|
+
const { cache, createRuntimeSetHash, debug, generatedCssPreflightModeByFile, getSourceCandidateGetter, getSourceCandidateSourceGetter, getRuntimeSet, gulpProcessCacheKeys, opts, refreshGulpV4SourceCandidates, refreshRuntimeSet, refreshRuntimeSetForSource, registerAutoCssSource, resolveGulpStyleOutputExtension, resolveGulpTransformTimingDetails, resolveModuleGraphOptions, resolveWxmlHandlerOptions, resolveWxssFileHandlerOptions, resolveWxssUserHandlerOptions, runtimeState } = context;
|
|
198
|
+
const { templateHandler, styleHandler, jsHandler } = opts;
|
|
199
|
+
function createWxssTransform(options, stage) {
|
|
200
|
+
return createVinylTransform(`css:${stage}`, async (file) => {
|
|
201
|
+
if (!file.contents) return;
|
|
202
|
+
const rawSource = file.contents.toString();
|
|
203
|
+
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
204
|
+
const shouldUseGenerator = runtimeState.tailwindRuntime.majorVersion === 4;
|
|
205
|
+
let gulpSourceCandidateGetter = getSourceCandidateGetter();
|
|
206
|
+
if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
207
|
+
const nextRuntimeSet = await refreshRuntimeSet({
|
|
208
|
+
forceRefresh: cssSourceChanged,
|
|
209
|
+
forceCollect: cssSourceChanged,
|
|
210
|
+
clearCache: cssSourceChanged
|
|
211
|
+
});
|
|
212
|
+
const sourceCandidateSourceGetter = getSourceCandidateSourceGetter();
|
|
213
|
+
const sourceTraceTokenSources = sourceCandidateSourceGetter ? require_hmr_timing.createCssTokenSourceMap(sourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
214
|
+
const sourceTraceSignature = require_hmr_timing.createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
215
|
+
const sourceCandidateSignature = gulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...gulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
216
|
+
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
217
|
+
const outputSignature = styleOutputExtension ? `gulp-output:1:${stage}:${styleOutputExtension}` : `gulp-output:0:${stage}`;
|
|
218
|
+
await require_hmr_timing.processCachedTask({
|
|
219
|
+
cache,
|
|
220
|
+
cacheKey: file.path,
|
|
221
|
+
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
|
|
222
|
+
applyResult(source) {
|
|
223
|
+
file.contents = node_buffer.Buffer.from(source);
|
|
224
|
+
},
|
|
225
|
+
onCacheHit() {
|
|
226
|
+
debug("css cache hit: %s", file.path);
|
|
227
|
+
},
|
|
228
|
+
async transform() {
|
|
229
|
+
await runtimeState.readyPromise;
|
|
230
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
231
|
+
const generated = shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
|
|
232
|
+
opts,
|
|
233
|
+
runtimeState,
|
|
234
|
+
runtime: nextRuntimeSet,
|
|
235
|
+
rawSource,
|
|
236
|
+
file: file.path,
|
|
237
|
+
cssHandlerOptions,
|
|
238
|
+
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
239
|
+
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
240
|
+
styleHandler,
|
|
241
|
+
debug,
|
|
242
|
+
deferCssAdaptation: stage === "generate"
|
|
243
|
+
}) : void 0;
|
|
244
|
+
const transformedCss = generated?.css ?? (stage === "generate" ? rawSource : (await styleHandler(rawSource, cssHandlerOptions)).css);
|
|
245
|
+
if (stage === "generate") {
|
|
246
|
+
const preflightMode = generated?.metadata?.preflightMode;
|
|
247
|
+
if (preflightMode) generatedCssPreflightModeByFile.set(file.path, preflightMode);
|
|
248
|
+
else generatedCssPreflightModeByFile.delete(file.path);
|
|
249
|
+
}
|
|
250
|
+
const css = require_hmr_timing.annotateCssSourceTrace(transformedCss, {
|
|
251
|
+
opts,
|
|
252
|
+
tokenSources: sourceTraceTokenSources
|
|
253
|
+
});
|
|
254
|
+
const generatedCss = stage === "generate" && generated ? `${require_hmr_timing.createBundlerGeneratedCssMarker("gulp", file.path)}\n${css}` : css;
|
|
255
|
+
const outputCss = stage === "generate" ? generatedCss : (0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(generatedCss, { styleOutputExtension });
|
|
256
|
+
debug("css handle: %s", file.path);
|
|
257
|
+
return { result: outputCss };
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
261
|
+
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
262
|
+
}, () => resolveGulpTransformTimingDetails(`css:${stage}`));
|
|
263
|
+
}
|
|
264
|
+
const generateWxss = (options = {}) => createWxssTransform(options, "generate");
|
|
265
|
+
const transformWxss = (options = {}) => createWxssTransform(options, "transform");
|
|
266
|
+
const adaptWxss = (options = {}) => createVinylTransform("css:adapt", async (file) => {
|
|
267
|
+
if (!file.contents) return;
|
|
268
|
+
const rawSource = file.contents.toString();
|
|
269
|
+
const generatedCss = require_hmr_timing.hasBundlerGeneratedCssMarker(rawSource);
|
|
270
|
+
const source = generatedCss ? require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource) : rawSource;
|
|
271
|
+
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
272
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, source, options);
|
|
273
|
+
const handled = await styleHandler(source, cssHandlerOptions);
|
|
274
|
+
const preflightMode = generatedCssPreflightModeByFile.get(file.path);
|
|
275
|
+
const finalized = generatedCss ? require_hmr_timing.finalizeMiniProgramGeneratorCss(handled.css, "weapp", runtimeState.tailwindRuntime.majorVersion, opts.cssPreflight, {
|
|
276
|
+
injectPreflight: preflightMode?.inject ?? cssHandlerOptions.isMainChunk,
|
|
277
|
+
preservePreflight: preflightMode?.preserve ?? cssHandlerOptions.isMainChunk,
|
|
278
|
+
styleOptions: cssHandlerOptions
|
|
279
|
+
}) : handled.css;
|
|
280
|
+
file.contents = node_buffer.Buffer.from((0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(finalized, { styleOutputExtension }));
|
|
281
|
+
debug("css adapt: %s", file.path);
|
|
282
|
+
}, () => resolveGulpTransformTimingDetails("css:adapt"));
|
|
283
|
+
const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
|
|
284
|
+
if (!file.contents) return;
|
|
285
|
+
const filename = node_path.default.resolve(file.path);
|
|
286
|
+
const rawSource = file.contents.toString();
|
|
287
|
+
await refreshRuntimeSetForSource(file, rawSource, "js");
|
|
288
|
+
await runtimeState.readyPromise;
|
|
289
|
+
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
290
|
+
const handlerOptions = {
|
|
291
|
+
...options,
|
|
292
|
+
generateMap: false,
|
|
293
|
+
filename,
|
|
294
|
+
moduleGraph,
|
|
295
|
+
babelParserOptions: {
|
|
296
|
+
...options?.babelParserOptions ?? {},
|
|
297
|
+
sourceFilename: filename
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
if (runtimeState.tailwindRuntime.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
301
|
+
await require_hmr_timing.processCachedTask({
|
|
302
|
+
cache,
|
|
303
|
+
cacheKey: file.path,
|
|
304
|
+
rawSource,
|
|
305
|
+
applyResult(source) {
|
|
306
|
+
file.contents = node_buffer.Buffer.from(source);
|
|
307
|
+
},
|
|
308
|
+
onCacheHit() {
|
|
309
|
+
debug("js cache hit: %s", file.path);
|
|
310
|
+
},
|
|
311
|
+
async transform() {
|
|
312
|
+
await runtimeState.readyPromise;
|
|
313
|
+
const currentSource = file.contents?.toString() ?? rawSource;
|
|
314
|
+
if (require_context.shouldSkipJsTransform(currentSource, {
|
|
315
|
+
...handlerOptions,
|
|
316
|
+
classNameSet: getRuntimeSet()
|
|
317
|
+
})) return { result: currentSource };
|
|
318
|
+
const { code } = await jsHandler(currentSource, getRuntimeSet(), handlerOptions);
|
|
319
|
+
debug("js handle: %s", file.path);
|
|
320
|
+
return { result: code };
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
324
|
+
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
325
|
+
}, () => resolveGulpTransformTimingDetails("js"));
|
|
326
|
+
const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
|
|
327
|
+
if (!file.contents) return;
|
|
328
|
+
const rawSource = file.contents.toString();
|
|
329
|
+
await refreshRuntimeSetForSource(file, rawSource, "html");
|
|
330
|
+
await runtimeState.readyPromise;
|
|
331
|
+
await require_hmr_timing.processCachedTask({
|
|
332
|
+
cache,
|
|
333
|
+
cacheKey: file.path,
|
|
334
|
+
rawSource,
|
|
335
|
+
applyResult(source) {
|
|
336
|
+
file.contents = node_buffer.Buffer.from(source);
|
|
337
|
+
},
|
|
338
|
+
onCacheHit() {
|
|
339
|
+
debug("html cache hit: %s", file.path);
|
|
340
|
+
},
|
|
341
|
+
async transform() {
|
|
342
|
+
await runtimeState.readyPromise;
|
|
343
|
+
const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
|
|
344
|
+
debug("html handle: %s", file.path);
|
|
345
|
+
return { result: code };
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
349
|
+
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
350
|
+
}, () => resolveGulpTransformTimingDetails("html"));
|
|
351
|
+
return {
|
|
352
|
+
adaptWxss,
|
|
353
|
+
generateWxss,
|
|
354
|
+
transformWxss,
|
|
355
|
+
transformWxml,
|
|
356
|
+
transformJs
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/bundlers/gulp/shared/create-native-framework-plugins.ts
|
|
361
|
+
const debug = require_wxml.createDebug();
|
|
195
362
|
/**
|
|
196
363
|
* @name weapp-tw-gulp
|
|
197
364
|
* @description native framework 的插件组合实现
|
|
@@ -203,7 +370,7 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
203
370
|
...options,
|
|
204
371
|
__internalDeferMissingCssEntriesWarning: true
|
|
205
372
|
});
|
|
206
|
-
const {
|
|
373
|
+
const { cache } = opts;
|
|
207
374
|
const initialTailwindRuntime = opts.tailwindRuntime;
|
|
208
375
|
const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
|
|
209
376
|
const readyPromise = require_context.createTailwindRuntimeReadyPromise(initialTailwindRuntime);
|
|
@@ -421,164 +588,28 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
421
588
|
runtimeSourcesByFile
|
|
422
589
|
}) };
|
|
423
590
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
applyResult(source) {
|
|
447
|
-
file.contents = node_buffer.Buffer.from(source);
|
|
448
|
-
},
|
|
449
|
-
onCacheHit() {
|
|
450
|
-
debug("css cache hit: %s", file.path);
|
|
451
|
-
},
|
|
452
|
-
async transform() {
|
|
453
|
-
await runtimeState.readyPromise;
|
|
454
|
-
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
455
|
-
const generated = shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
|
|
456
|
-
opts,
|
|
457
|
-
runtimeState,
|
|
458
|
-
runtime: nextRuntimeSet,
|
|
459
|
-
rawSource,
|
|
460
|
-
file: file.path,
|
|
461
|
-
cssHandlerOptions,
|
|
462
|
-
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
463
|
-
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
464
|
-
styleHandler,
|
|
465
|
-
debug,
|
|
466
|
-
deferCssAdaptation: stage === "generate"
|
|
467
|
-
}) : void 0;
|
|
468
|
-
const transformedCss = generated?.css ?? (stage === "generate" ? rawSource : (await styleHandler(rawSource, cssHandlerOptions)).css);
|
|
469
|
-
if (stage === "generate") {
|
|
470
|
-
const preflightMode = generated?.metadata?.preflightMode;
|
|
471
|
-
if (preflightMode) generatedCssPreflightModeByFile.set(file.path, preflightMode);
|
|
472
|
-
else generatedCssPreflightModeByFile.delete(file.path);
|
|
473
|
-
}
|
|
474
|
-
const css = require_hmr_timing.annotateCssSourceTrace(transformedCss, {
|
|
475
|
-
opts,
|
|
476
|
-
tokenSources: sourceTraceTokenSources
|
|
477
|
-
});
|
|
478
|
-
const generatedCss = stage === "generate" && generated ? `${require_hmr_timing.createBundlerGeneratedCssMarker("gulp", file.path)}\n${css}` : css;
|
|
479
|
-
const outputCss = stage === "generate" ? generatedCss : (0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(generatedCss, { styleOutputExtension });
|
|
480
|
-
debug("css handle: %s", file.path);
|
|
481
|
-
return { result: outputCss };
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
485
|
-
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
486
|
-
}, () => resolveGulpTransformTimingDetails(`css:${stage}`));
|
|
487
|
-
}
|
|
488
|
-
const generateWxss = (options = {}) => createWxssTransform(options, "generate");
|
|
489
|
-
const transformWxss = (options = {}) => createWxssTransform(options, "transform");
|
|
490
|
-
const adaptWxss = (options = {}) => createVinylTransform("css:adapt", async (file) => {
|
|
491
|
-
if (!file.contents) return;
|
|
492
|
-
const rawSource = file.contents.toString();
|
|
493
|
-
const generatedCss = require_hmr_timing.hasBundlerGeneratedCssMarker(rawSource);
|
|
494
|
-
const source = generatedCss ? require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource) : rawSource;
|
|
495
|
-
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
496
|
-
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, source, options);
|
|
497
|
-
const handled = await styleHandler(source, cssHandlerOptions);
|
|
498
|
-
const preflightMode = generatedCssPreflightModeByFile.get(file.path);
|
|
499
|
-
const finalized = generatedCss ? require_hmr_timing.finalizeMiniProgramGeneratorCss(handled.css, "weapp", runtimeState.tailwindRuntime.majorVersion, opts.cssPreflight, {
|
|
500
|
-
injectPreflight: preflightMode?.inject ?? cssHandlerOptions.isMainChunk,
|
|
501
|
-
preservePreflight: preflightMode?.preserve ?? cssHandlerOptions.isMainChunk,
|
|
502
|
-
styleOptions: cssHandlerOptions
|
|
503
|
-
}) : handled.css;
|
|
504
|
-
file.contents = node_buffer.Buffer.from((0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(finalized, { styleOutputExtension }));
|
|
505
|
-
debug("css adapt: %s", file.path);
|
|
506
|
-
}, () => resolveGulpTransformTimingDetails("css:adapt"));
|
|
507
|
-
const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
|
|
508
|
-
if (!file.contents) return;
|
|
509
|
-
const filename = node_path.default.resolve(file.path);
|
|
510
|
-
const rawSource = file.contents.toString();
|
|
511
|
-
await refreshRuntimeSetForSource(file, rawSource, "js");
|
|
512
|
-
await runtimeState.readyPromise;
|
|
513
|
-
const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
|
|
514
|
-
const handlerOptions = {
|
|
515
|
-
...options,
|
|
516
|
-
generateMap: false,
|
|
517
|
-
filename,
|
|
518
|
-
moduleGraph,
|
|
519
|
-
babelParserOptions: {
|
|
520
|
-
...options?.babelParserOptions ?? {},
|
|
521
|
-
sourceFilename: filename
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
if (runtimeState.tailwindRuntime.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
525
|
-
await require_hmr_timing.processCachedTask({
|
|
526
|
-
cache,
|
|
527
|
-
cacheKey: file.path,
|
|
528
|
-
rawSource,
|
|
529
|
-
applyResult(source) {
|
|
530
|
-
file.contents = node_buffer.Buffer.from(source);
|
|
531
|
-
},
|
|
532
|
-
onCacheHit() {
|
|
533
|
-
debug("js cache hit: %s", file.path);
|
|
534
|
-
},
|
|
535
|
-
async transform() {
|
|
536
|
-
await runtimeState.readyPromise;
|
|
537
|
-
const currentSource = file.contents?.toString() ?? rawSource;
|
|
538
|
-
if (require_context.shouldSkipJsTransform(currentSource, {
|
|
539
|
-
...handlerOptions,
|
|
540
|
-
classNameSet: runtimeSet
|
|
541
|
-
})) return { result: currentSource };
|
|
542
|
-
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
543
|
-
debug("js handle: %s", file.path);
|
|
544
|
-
return { result: code };
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
548
|
-
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
549
|
-
}, () => resolveGulpTransformTimingDetails("js"));
|
|
550
|
-
const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
|
|
551
|
-
if (!file.contents) return;
|
|
552
|
-
const rawSource = file.contents.toString();
|
|
553
|
-
await refreshRuntimeSetForSource(file, rawSource, "html");
|
|
554
|
-
await runtimeState.readyPromise;
|
|
555
|
-
await require_hmr_timing.processCachedTask({
|
|
556
|
-
cache,
|
|
557
|
-
cacheKey: file.path,
|
|
558
|
-
rawSource,
|
|
559
|
-
applyResult(source) {
|
|
560
|
-
file.contents = node_buffer.Buffer.from(source);
|
|
561
|
-
},
|
|
562
|
-
onCacheHit() {
|
|
563
|
-
debug("html cache hit: %s", file.path);
|
|
564
|
-
},
|
|
565
|
-
async transform() {
|
|
566
|
-
await runtimeState.readyPromise;
|
|
567
|
-
const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
|
|
568
|
-
debug("html handle: %s", file.path);
|
|
569
|
-
return { result: code };
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
573
|
-
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
574
|
-
}, () => resolveGulpTransformTimingDetails("html"));
|
|
575
|
-
return {
|
|
576
|
-
adaptWxss,
|
|
577
|
-
generateWxss,
|
|
578
|
-
transformWxss,
|
|
579
|
-
transformWxml,
|
|
580
|
-
transformJs
|
|
581
|
-
};
|
|
591
|
+
return createGulpFileTransforms({
|
|
592
|
+
cache,
|
|
593
|
+
createRuntimeSetHash,
|
|
594
|
+
debug,
|
|
595
|
+
generatedCssPreflightModeByFile,
|
|
596
|
+
getSourceCandidateGetter: () => cachedGulpSourceCandidateGetter,
|
|
597
|
+
getSourceCandidateSourceGetter: () => cachedGulpSourceCandidateSourceGetter,
|
|
598
|
+
getRuntimeSet: () => runtimeSet,
|
|
599
|
+
gulpProcessCacheKeys,
|
|
600
|
+
opts,
|
|
601
|
+
refreshGulpV4SourceCandidates,
|
|
602
|
+
refreshRuntimeSet,
|
|
603
|
+
refreshRuntimeSetForSource,
|
|
604
|
+
registerAutoCssSource,
|
|
605
|
+
resolveGulpStyleOutputExtension,
|
|
606
|
+
resolveGulpTransformTimingDetails,
|
|
607
|
+
resolveModuleGraphOptions,
|
|
608
|
+
resolveWxmlHandlerOptions,
|
|
609
|
+
resolveWxssFileHandlerOptions,
|
|
610
|
+
resolveWxssUserHandlerOptions,
|
|
611
|
+
runtimeState
|
|
612
|
+
});
|
|
582
613
|
}
|
|
583
614
|
//#endregion
|
|
584
615
|
//#region src/bundlers/gulp/frameworks/native/index.ts
|
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-Q1wITegn.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-CKSklPlH.mjs";
|
|
2
2
|
export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
|