weapp-tailwindcss 5.1.14 → 5.1.15
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/auto-2dg_uhEJ.mjs +13 -0
- package/dist/bundlers/gulp/frameworks/native/index.d.ts +2 -0
- package/dist/bundlers/gulp/index.d.ts +2 -0
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +2 -0
- package/dist/bundlers/shared/generated-css-marker.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/types.d.ts +5 -0
- package/dist/bundlers/shared/style-requests.d.ts +1 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +5 -0
- package/dist/bundlers/vite/serve-css-generation.d.ts +3 -2
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/watch-css-post.d.ts +10 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +4 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -0
- package/dist/{context-BL8Gy71H.mjs → context-BgGWVAmN.mjs} +2 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{generator-B59OA64h.mjs → generator-CEo920So.mjs} +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/{gulp-C1Q3LRzg.js → gulp-3m1dAiig.js} +84 -50
- package/dist/{gulp-DUYWxmZC.mjs → gulp-DP71z1jG.mjs} +87 -53
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-C3ed5vCx.mjs → hmr-timing-1aS6--U7.mjs} +170 -44
- package/dist/{hmr-timing-BZ5sWIqO.js → hmr-timing-B8p4f0ca.js} +219 -39
- package/dist/index.js +3 -3
- package/dist/index.mjs +4 -4
- package/dist/postcss.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/shared/mpx.d.ts +4 -1
- package/dist/{source-candidate-scan-signature-R3dzamcm.js → source-candidate-scan-signature-BAahhiwb.js} +4 -96
- package/dist/{source-candidate-scan-signature-D7RWjWsY.mjs → source-candidate-scan-signature-Cf7259PR.mjs} +6 -62
- package/dist/{tailwindcss-DPcKMLxL.mjs → tailwindcss-xs704TRw.mjs} +1 -1
- package/dist/{transform-D5JUgMpE.mjs → transform-B_KM9sLX.mjs} +47 -5
- package/dist/{transform-COFRlmDF.js → transform-CcYptivi.js} +47 -5
- package/dist/uni-app-x/component-local-style.d.ts +1 -0
- package/dist/uni-app-x/style-asset/style-value.d.ts +1 -1
- package/dist/{vite-BNlPdsGM.js → vite-DUVjMduj.js} +550 -273
- package/dist/{vite-CBU5NXTX.mjs → vite-nXZEiwG0.mjs} +501 -224
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-generation-loader.js +12 -0
- package/dist/weapp-tw-css-import-rewrite-loader-DNk0IxAt.js +10198 -0
- package/dist/weapp-tw-css-import-rewrite-loader.js +6 -10255
- package/dist/{webpack-CZ38fMGC.mjs → webpack-C_UUFRgj.mjs} +223 -57
- package/dist/{webpack-Jpe048pQ.js → webpack-nppysF4B.js} +232 -66
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +11 -3
- package/dist/auto-CrJJc5rK.mjs +0 -13
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
2
|
const require_generator = require("./generator-CEnUsjed.js");
|
|
3
|
+
require("./auto-DtU6f3X6.js");
|
|
3
4
|
const require_object = require("./object-COs_Mw6p.js");
|
|
4
5
|
const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
|
|
5
6
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
@@ -133,6 +134,39 @@ function annotateCssSourceTrace(css, options) {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
//#endregion
|
|
137
|
+
//#region src/bundlers/shared/generated-css-marker.ts
|
|
138
|
+
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
|
|
139
|
+
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
140
|
+
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (gulp|vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
141
|
+
const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
|
|
142
|
+
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
143
|
+
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
144
|
+
}
|
|
145
|
+
function hasBundlerGeneratedCssMarker(source) {
|
|
146
|
+
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
147
|
+
}
|
|
148
|
+
function stripBundlerGeneratedCssMarkers(source) {
|
|
149
|
+
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
|
|
150
|
+
}
|
|
151
|
+
function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
152
|
+
const blocks = [];
|
|
153
|
+
BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
|
|
154
|
+
let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
155
|
+
while (match !== null) {
|
|
156
|
+
const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
|
|
157
|
+
const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
158
|
+
const cssEnd = nextMatch?.index ?? source.length;
|
|
159
|
+
const file = match[2] ? decodeURIComponent(match[2]) : void 0;
|
|
160
|
+
blocks.push({
|
|
161
|
+
bundler: match[1],
|
|
162
|
+
file,
|
|
163
|
+
css: source.slice(cssStart, cssEnd)
|
|
164
|
+
});
|
|
165
|
+
match = nextMatch;
|
|
166
|
+
}
|
|
167
|
+
return blocks;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
136
170
|
//#region src/bundlers/shared/generator-css/class-selectors.ts
|
|
137
171
|
function normalizeCssClassSelector(value) {
|
|
138
172
|
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
@@ -157,11 +191,47 @@ function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
|
157
191
|
return matched;
|
|
158
192
|
}
|
|
159
193
|
//#endregion
|
|
194
|
+
//#region src/bundlers/shared/style-requests.ts
|
|
195
|
+
const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
196
|
+
const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
|
|
197
|
+
const VUE_STYLE_QUERY_RE = /(?:^|&)type=style(?:&|$)/;
|
|
198
|
+
const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
|
|
199
|
+
function stripHash(request) {
|
|
200
|
+
const hashIndex = request.indexOf("#");
|
|
201
|
+
return hashIndex === -1 ? request : request.slice(0, hashIndex);
|
|
202
|
+
}
|
|
203
|
+
function stripRequestQuery(request) {
|
|
204
|
+
const normalized = stripHash(request);
|
|
205
|
+
const queryIndex = normalized.indexOf("?");
|
|
206
|
+
return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
207
|
+
}
|
|
208
|
+
function isSourceStyleRequest(request) {
|
|
209
|
+
if (typeof request !== "string" || request.length === 0) return false;
|
|
210
|
+
const normalized = stripHash(request);
|
|
211
|
+
const queryIndex = normalized.indexOf("?");
|
|
212
|
+
const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
213
|
+
if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
|
|
214
|
+
if (queryIndex === -1) return false;
|
|
215
|
+
const query = normalized.slice(queryIndex + 1);
|
|
216
|
+
return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
|
|
217
|
+
}
|
|
218
|
+
function isVueScopedStyleRequest(request) {
|
|
219
|
+
if (typeof request !== "string" || request.length === 0) return false;
|
|
220
|
+
const normalized = stripHash(request);
|
|
221
|
+
const queryIndex = normalized.indexOf("?");
|
|
222
|
+
if (queryIndex === -1) return false;
|
|
223
|
+
const query = normalized.slice(queryIndex + 1);
|
|
224
|
+
return VUE_STYLE_QUERY_RE.test(query) && /(?:^|&)scoped(?:=[^&]*)?(?:&|$)/.test(query);
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
160
227
|
//#region src/bundlers/shared/generator-css/source-resolver/postcss-source.ts
|
|
161
228
|
function resolvePostcssFromOption(cssHandlerOptions) {
|
|
162
229
|
const from = cssHandlerOptions.postcssOptions?.options?.from;
|
|
163
230
|
return typeof from === "string" && from.length > 0 ? from : void 0;
|
|
164
231
|
}
|
|
232
|
+
function resolvePostcssRequestOption(cssHandlerOptions) {
|
|
233
|
+
return resolveCssHandlerSourceOptions(cssHandlerOptions)?.requestFile ?? resolvePostcssFromOption(cssHandlerOptions);
|
|
234
|
+
}
|
|
165
235
|
function resolvePostcssSourceFile(cssHandlerOptions) {
|
|
166
236
|
const from = resolvePostcssFromOption(cssHandlerOptions);
|
|
167
237
|
if (!from || !node_path.default.isAbsolute(from)) return;
|
|
@@ -176,13 +246,6 @@ function resolveCssSourceBase(file, cssHandlerOptions) {
|
|
|
176
246
|
}
|
|
177
247
|
//#endregion
|
|
178
248
|
//#region src/bundlers/shared/generator-css/generation-helpers.ts
|
|
179
|
-
function isVueScopedStyleSource(from) {
|
|
180
|
-
if (typeof from !== "string" || from.length === 0) return false;
|
|
181
|
-
const queryIndex = from.indexOf("?");
|
|
182
|
-
if (queryIndex === -1) return false;
|
|
183
|
-
const query = from.slice(queryIndex + 1);
|
|
184
|
-
return /(?:^|&)type=style(?:&|$)/.test(query) && /(?:^|&)scoped(?:=[^&]*)?(?:&|$)/.test(query);
|
|
185
|
-
}
|
|
186
249
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
187
250
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
188
251
|
}
|
|
@@ -191,7 +254,7 @@ function isMiniProgramGeneratorTarget(target) {
|
|
|
191
254
|
}
|
|
192
255
|
function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPreflight, options = {}) {
|
|
193
256
|
if (!isMiniProgramGeneratorTarget(target)) return css;
|
|
194
|
-
if (
|
|
257
|
+
if (options.styleOptions && isVueScopedStyleRequest(resolvePostcssRequestOption(options.styleOptions))) return (0, _weapp_tailwindcss_postcss.finalizeMiniProgramCss)(css, {
|
|
195
258
|
cssPreflight: false,
|
|
196
259
|
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
197
260
|
isTailwindcssV4: true,
|
|
@@ -208,7 +271,7 @@ function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPrefligh
|
|
|
208
271
|
});
|
|
209
272
|
}
|
|
210
273
|
function resolveMiniProgramPreflightModeForGeneratorCss(opts, options) {
|
|
211
|
-
if (
|
|
274
|
+
if (isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions))) return {
|
|
212
275
|
inject: false,
|
|
213
276
|
preserve: false
|
|
214
277
|
};
|
|
@@ -278,7 +341,7 @@ function isEmptyCssSourceOrderParts(parts) {
|
|
|
278
341
|
}
|
|
279
342
|
function resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorStyleOptions) {
|
|
280
343
|
const resolvedStyleOptions = require_context.resolveStyleOptionsFromContext(opts);
|
|
281
|
-
const scopedVueStyleSource =
|
|
344
|
+
const scopedVueStyleSource = isVueScopedStyleRequest(resolvePostcssRequestOption(cssHandlerOptions));
|
|
282
345
|
const preflightStyleOptions = {
|
|
283
346
|
cssPreflight: scopedVueStyleSource ? false : resolvedStyleOptions.cssPreflight,
|
|
284
347
|
cssPreflightRange: scopedVueStyleSource ? void 0 : resolvedStyleOptions.cssPreflightRange
|
|
@@ -2319,10 +2382,14 @@ async function generateCssByGenerator(options) {
|
|
|
2319
2382
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(generatorSources);
|
|
2320
2383
|
const sourceConcurrency = resolveGeneratorSourceConcurrency();
|
|
2321
2384
|
const generated = mergeGeneratorResults((await runWithConcurrency(generatorSources.map((source) => async () => {
|
|
2385
|
+
const sourceCss = options.deferCssAdaptation ? (0, _weapp_tailwindcss_postcss.removeMatchingLocalCssImports)(source.css, localImports) : source.css;
|
|
2322
2386
|
const generator = require_generator.createWeappTailwindcssGenerator(options.disableSourceScan === true ? {
|
|
2323
2387
|
...source,
|
|
2324
|
-
css: require_generator.removeTailwindSourceDirectives(
|
|
2325
|
-
} : source
|
|
2388
|
+
css: require_generator.removeTailwindSourceDirectives(sourceCss, { importFallback: generatorOptions.importFallback })
|
|
2389
|
+
} : sourceCss === source.css ? source : {
|
|
2390
|
+
...source,
|
|
2391
|
+
css: sourceCss
|
|
2392
|
+
});
|
|
2326
2393
|
const sourceEntries = getSourceCandidatesForEntries ? await resolveGeneratorSourceEntries(source, runtimeState) : void 0;
|
|
2327
2394
|
const sourceScopedRuntime = sourceEntries && sourceEntries.length > 0 ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
2328
2395
|
const scopedRuntime = resolveScopedRuntimeCandidates(options.sourceCandidates, sourceScopedRuntime);
|
|
@@ -2355,6 +2422,91 @@ async function generateCssByGenerator(options) {
|
|
|
2355
2422
|
}), sourceConcurrency)).filter((item) => Boolean(item)));
|
|
2356
2423
|
if (!generated) return;
|
|
2357
2424
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2425
|
+
const hasMatchedCssSourceFile = generatorSources.some((source) => source.__weappTailwindcssMeta?.matchedCssSourceFile);
|
|
2426
|
+
const hasExplicitCssSource = generatorSources.some((source) => {
|
|
2427
|
+
const metadata = source.__weappTailwindcssMeta;
|
|
2428
|
+
return metadata?.candidateMatchedCssSource !== true && (metadata?.cssEntryIndex !== void 0 || metadata?.cssSourceIndex !== void 0);
|
|
2429
|
+
});
|
|
2430
|
+
const hasPreflightCssSource = generatorSources.some((source) => {
|
|
2431
|
+
const metadata = source.__weappTailwindcssMeta;
|
|
2432
|
+
const appEntryMatchedByCandidates = metadata?.candidateMatchedCssSource === true && metadata.cssEntryIndex === 0 && metadata.cssSourceIndex === void 0;
|
|
2433
|
+
return metadata?.includesPreflight === true && !appEntryMatchedByCandidates;
|
|
2434
|
+
});
|
|
2435
|
+
const hasPreflightRawSource = require_tailwindcss.includesTailwindV4PreflightDirective(generatorRawSource);
|
|
2436
|
+
const hasOnlyPrimaryCssSource = generatorSources.length > 0 && generatorSources.every((source) => {
|
|
2437
|
+
const metadata = source.__weappTailwindcssMeta;
|
|
2438
|
+
return metadata?.candidateMatchedCssSource !== true && metadata?.primaryCssSource === true;
|
|
2439
|
+
});
|
|
2440
|
+
const shouldFilterApplyOnlyCss = require_generator.shouldFilterApplyOnlyGeneratedCss(majorVersion, generated.target, generatorRawSource, {
|
|
2441
|
+
hasGeneratedCss,
|
|
2442
|
+
hasGeneratedMarkers
|
|
2443
|
+
});
|
|
2444
|
+
const filterGeneratedApplyOnlyCss = (css) => {
|
|
2445
|
+
if (!shouldFilterApplyOnlyCss) return css;
|
|
2446
|
+
return require_generator.filterApplyOnlyGeneratedCss(css, generatorRawSource, { preserveVariables: generated.target !== "web" });
|
|
2447
|
+
};
|
|
2448
|
+
const preflightMode = resolveMiniProgramPreflightModeForGeneratorCss(opts, {
|
|
2449
|
+
cssHandlerOptions,
|
|
2450
|
+
isolateCurrentCssCandidates,
|
|
2451
|
+
localImports,
|
|
2452
|
+
explicitCssSource: hasExplicitCssSource,
|
|
2453
|
+
primaryCssSource: hasOnlyPrimaryCssSource || hasPreflightCssSource || hasPreflightRawSource
|
|
2454
|
+
});
|
|
2455
|
+
if (options.deferCssAdaptation) {
|
|
2456
|
+
const normalizeDeferredGeneratedCss = async (css) => {
|
|
2457
|
+
const rawCss = require_generator.stripTailwindBanner(css);
|
|
2458
|
+
const generationCss = generated.target === "weapp" && ((0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(generatorStyleOptions) || (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4InternalAtRules)(rawCss)) ? await (0, _weapp_tailwindcss_postcss.transformCssMacroCss)(rawCss, generatorStyleOptions) : rawCss;
|
|
2459
|
+
const normalizedCss = generated.target === "weapp" ? await (0, _weapp_tailwindcss_postcss.normalizeMiniProgramGeneratedCssForPostcss)(generationCss, {
|
|
2460
|
+
preservePreflight: true,
|
|
2461
|
+
preserveRawClassRules: true
|
|
2462
|
+
}) : generationCss;
|
|
2463
|
+
return filterGeneratedApplyOnlyCss(normalizedCss);
|
|
2464
|
+
};
|
|
2465
|
+
const restoreDeferredUserCss = async (css) => {
|
|
2466
|
+
if (generated.target !== "weapp" || generatedUserCssRawSource.trim().length === 0) return css;
|
|
2467
|
+
const userCssOptions = {
|
|
2468
|
+
generatorTarget: generated.target,
|
|
2469
|
+
generatorStyleOptions,
|
|
2470
|
+
cssUserHandlerOptions,
|
|
2471
|
+
styleHandler,
|
|
2472
|
+
importFallback: generatorOptions.importFallback,
|
|
2473
|
+
processed: userRawSourceProcessed
|
|
2474
|
+
};
|
|
2475
|
+
const transformDeferredUserCss = async (source) => {
|
|
2476
|
+
const parts = require_generator.splitUserCssLayerBlocks(source);
|
|
2477
|
+
const layerCss = await require_generator.transformGeneratorUserCss(parts.layer, userCssOptions);
|
|
2478
|
+
const restCss = await require_generator.transformGeneratorUserCss(parts.rest, userCssOptions);
|
|
2479
|
+
return createCssSourceOrderAppend$1(wrapUserLayerComponentsCss(layerCss), restCss);
|
|
2480
|
+
};
|
|
2481
|
+
const orderedUserCss = require_generator.splitGeneratorPlaceholderCssBySourceOrder(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? require_generator.splitTailwindV4GeneratedCssBySourceOrder(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
2482
|
+
if (orderedUserCss) {
|
|
2483
|
+
const beforeUserCss = await transformDeferredUserCss(orderedUserCss.before);
|
|
2484
|
+
const afterUserCss = await transformDeferredUserCss(orderedUserCss.after);
|
|
2485
|
+
const cssWithBeforeUserCss = createCssSourceOrderAppend$1((0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, beforeUserCss), css);
|
|
2486
|
+
return reorderMarkedUserLayerComponentsCss(createCssSourceOrderAppend$1(cssWithBeforeUserCss, (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(cssWithBeforeUserCss, afterUserCss)));
|
|
2487
|
+
}
|
|
2488
|
+
return reorderMarkedUserLayerComponentsCss(createCssSourceOrderAppend$1(css, (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, await transformDeferredUserCss(generatedUserCssRawSource))));
|
|
2489
|
+
};
|
|
2490
|
+
const canAppendIncrementalCss = generated.target !== "weapp" || !require_generator.hasUserCssLayerBlocks(generatorRawSource);
|
|
2491
|
+
const incrementalRawCss = generated.incrementalRawCss ?? generated.incrementalCss;
|
|
2492
|
+
const shouldAppendIncrementalCss = canAppendIncrementalCss && typeof options.previousCss === "string" && typeof incrementalRawCss === "string";
|
|
2493
|
+
const normalizedCss = shouldAppendIncrementalCss ? incrementalRawCss.trim().length > 0 ? require_generator.createCssAppend(options.previousCss, await normalizeDeferredGeneratedCss(incrementalRawCss)) : options.previousCss : await normalizeDeferredGeneratedCss(generated.rawCss ?? generated.css);
|
|
2494
|
+
const css = (0, _weapp_tailwindcss_postcss.restoreLocalCssImports)(shouldAppendIncrementalCss ? normalizedCss : await restoreDeferredUserCss(normalizedCss), localImports, { outputFile: file });
|
|
2495
|
+
return {
|
|
2496
|
+
css,
|
|
2497
|
+
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, css, opts.escapeMap, options.previousClassSet),
|
|
2498
|
+
target: generated.target,
|
|
2499
|
+
source: "generator",
|
|
2500
|
+
dependencies: generated.dependencies,
|
|
2501
|
+
incremental: shouldAppendIncrementalCss,
|
|
2502
|
+
metadata: {
|
|
2503
|
+
file,
|
|
2504
|
+
majorVersion,
|
|
2505
|
+
preflightMode,
|
|
2506
|
+
rawCss: generated.rawCss
|
|
2507
|
+
}
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2358
2510
|
if ((generated.target !== "weapp" || !require_generator.hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2359
2511
|
const incrementalCss = require_generator.stripTailwindBanner(generated.incrementalCss);
|
|
2360
2512
|
const css = incrementalCss.trim().length > 0 ? finalizeIncrementalGeneratorCss(options.previousCss, incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
@@ -2376,33 +2528,7 @@ async function generateCssByGenerator(options) {
|
|
|
2376
2528
|
}
|
|
2377
2529
|
};
|
|
2378
2530
|
}
|
|
2379
|
-
const
|
|
2380
|
-
hasGeneratedCss,
|
|
2381
|
-
hasGeneratedMarkers
|
|
2382
|
-
});
|
|
2383
|
-
const generatedCssSource = generated.target === "web" ? generated.css : require_generator.stripTailwindBanner(generated.css);
|
|
2384
|
-
const generatedCss = shouldFilterApplyOnlyCss ? require_generator.filterApplyOnlyGeneratedCss(generatedCssSource, generatorRawSource, { preserveVariables: generated.target !== "web" }) : generatedCssSource;
|
|
2385
|
-
const hasMatchedCssSourceFile = generatorSources.some((source) => source.__weappTailwindcssMeta?.matchedCssSourceFile);
|
|
2386
|
-
const hasExplicitCssSource = generatorSources.some((source) => {
|
|
2387
|
-
const metadata = source.__weappTailwindcssMeta;
|
|
2388
|
-
return metadata?.candidateMatchedCssSource !== true && (metadata?.cssEntryIndex !== void 0 || metadata?.cssSourceIndex !== void 0);
|
|
2389
|
-
});
|
|
2390
|
-
const hasPreflightCssSource = generatorSources.some((source) => {
|
|
2391
|
-
const metadata = source.__weappTailwindcssMeta;
|
|
2392
|
-
const appEntryMatchedByCandidates = metadata?.candidateMatchedCssSource === true && metadata.cssEntryIndex === 0 && metadata.cssSourceIndex === void 0;
|
|
2393
|
-
return metadata?.includesPreflight === true && !appEntryMatchedByCandidates;
|
|
2394
|
-
});
|
|
2395
|
-
const hasPreflightRawSource = require_tailwindcss.includesTailwindV4PreflightDirective(generatorRawSource);
|
|
2396
|
-
const preflightMode = resolveMiniProgramPreflightModeForGeneratorCss(opts, {
|
|
2397
|
-
cssHandlerOptions,
|
|
2398
|
-
isolateCurrentCssCandidates,
|
|
2399
|
-
localImports,
|
|
2400
|
-
explicitCssSource: hasExplicitCssSource,
|
|
2401
|
-
primaryCssSource: generatorSources.length > 0 && generatorSources.every((source) => {
|
|
2402
|
-
const metadata = source.__weappTailwindcssMeta;
|
|
2403
|
-
return metadata?.candidateMatchedCssSource !== true && metadata?.primaryCssSource === true;
|
|
2404
|
-
}) || hasPreflightCssSource || hasPreflightRawSource
|
|
2405
|
-
});
|
|
2531
|
+
const generatedCss = filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css : require_generator.stripTailwindBanner(generated.css));
|
|
2406
2532
|
const orderedExtraCss = require_generator.splitGeneratorPlaceholderCssBySourceOrder(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? require_generator.splitTailwindV4GeneratedCssBySourceOrder(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
2407
2533
|
const shouldAppendMatchedCssSourceCompat = !hasMatchedCssSourceFile || orderedExtraCss !== void 0;
|
|
2408
2534
|
if (orderedExtraCss) {
|
|
@@ -3552,6 +3678,12 @@ Object.defineProperty(exports, "annotateCssSourceTrace", {
|
|
|
3552
3678
|
return annotateCssSourceTrace;
|
|
3553
3679
|
}
|
|
3554
3680
|
});
|
|
3681
|
+
Object.defineProperty(exports, "collectRawSourceClassSelectors", {
|
|
3682
|
+
enumerable: true,
|
|
3683
|
+
get: function() {
|
|
3684
|
+
return collectRawSourceClassSelectors;
|
|
3685
|
+
}
|
|
3686
|
+
});
|
|
3555
3687
|
Object.defineProperty(exports, "collectStrictEscapedRuntimeCandidates", {
|
|
3556
3688
|
enumerable: true,
|
|
3557
3689
|
get: function() {
|
|
@@ -3564,6 +3696,12 @@ Object.defineProperty(exports, "createBundleRuntimeClassSetManager", {
|
|
|
3564
3696
|
return createBundleRuntimeClassSetManager;
|
|
3565
3697
|
}
|
|
3566
3698
|
});
|
|
3699
|
+
Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
|
|
3700
|
+
enumerable: true,
|
|
3701
|
+
get: function() {
|
|
3702
|
+
return createBundlerGeneratedCssMarker;
|
|
3703
|
+
}
|
|
3704
|
+
});
|
|
3567
3705
|
Object.defineProperty(exports, "createCssSourceOrderAppend", {
|
|
3568
3706
|
enumerable: true,
|
|
3569
3707
|
get: function() {
|
|
@@ -3612,18 +3750,36 @@ Object.defineProperty(exports, "emitHmrTiming", {
|
|
|
3612
3750
|
return emitHmrTiming;
|
|
3613
3751
|
}
|
|
3614
3752
|
});
|
|
3753
|
+
Object.defineProperty(exports, "extractCandidatesFromSource", {
|
|
3754
|
+
enumerable: true,
|
|
3755
|
+
get: function() {
|
|
3756
|
+
return extractCandidatesFromSource;
|
|
3757
|
+
}
|
|
3758
|
+
});
|
|
3615
3759
|
Object.defineProperty(exports, "extractMarkedUserLayerComponentsCss", {
|
|
3616
3760
|
enumerable: true,
|
|
3617
3761
|
get: function() {
|
|
3618
3762
|
return extractMarkedUserLayerComponentsCss;
|
|
3619
3763
|
}
|
|
3620
3764
|
});
|
|
3765
|
+
Object.defineProperty(exports, "finalizeMiniProgramGeneratorCss", {
|
|
3766
|
+
enumerable: true,
|
|
3767
|
+
get: function() {
|
|
3768
|
+
return finalizeMiniProgramGeneratorCss;
|
|
3769
|
+
}
|
|
3770
|
+
});
|
|
3621
3771
|
Object.defineProperty(exports, "generateCssByGenerator", {
|
|
3622
3772
|
enumerable: true,
|
|
3623
3773
|
get: function() {
|
|
3624
3774
|
return generateCssByGenerator;
|
|
3625
3775
|
}
|
|
3626
3776
|
});
|
|
3777
|
+
Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
|
|
3778
|
+
enumerable: true,
|
|
3779
|
+
get: function() {
|
|
3780
|
+
return hasBundlerGeneratedCssMarker;
|
|
3781
|
+
}
|
|
3782
|
+
});
|
|
3627
3783
|
Object.defineProperty(exports, "hasMiniProgramTailwindV4PreflightReset", {
|
|
3628
3784
|
enumerable: true,
|
|
3629
3785
|
get: function() {
|
|
@@ -3642,6 +3798,12 @@ Object.defineProperty(exports, "isSourceCandidateRequest", {
|
|
|
3642
3798
|
return isSourceCandidateRequest;
|
|
3643
3799
|
}
|
|
3644
3800
|
});
|
|
3801
|
+
Object.defineProperty(exports, "isSourceStyleRequest", {
|
|
3802
|
+
enumerable: true,
|
|
3803
|
+
get: function() {
|
|
3804
|
+
return isSourceStyleRequest;
|
|
3805
|
+
}
|
|
3806
|
+
});
|
|
3645
3807
|
Object.defineProperty(exports, "mergeMarkedUserLayerComponentsCss", {
|
|
3646
3808
|
enumerable: true,
|
|
3647
3809
|
get: function() {
|
|
@@ -3660,6 +3822,12 @@ Object.defineProperty(exports, "normalizeMiniProgramImportShell", {
|
|
|
3660
3822
|
return normalizeMiniProgramImportShell;
|
|
3661
3823
|
}
|
|
3662
3824
|
});
|
|
3825
|
+
Object.defineProperty(exports, "parseBundlerGeneratedCssMarkerBlocks", {
|
|
3826
|
+
enumerable: true,
|
|
3827
|
+
get: function() {
|
|
3828
|
+
return parseBundlerGeneratedCssMarkerBlocks;
|
|
3829
|
+
}
|
|
3830
|
+
});
|
|
3663
3831
|
Object.defineProperty(exports, "processCachedTask", {
|
|
3664
3832
|
enumerable: true,
|
|
3665
3833
|
get: function() {
|
|
@@ -3702,6 +3870,18 @@ Object.defineProperty(exports, "scoreTailwindV4CssSourceFileMatch", {
|
|
|
3702
3870
|
return scoreTailwindV4CssSourceFileMatch;
|
|
3703
3871
|
}
|
|
3704
3872
|
});
|
|
3873
|
+
Object.defineProperty(exports, "stripBundlerGeneratedCssMarkers", {
|
|
3874
|
+
enumerable: true,
|
|
3875
|
+
get: function() {
|
|
3876
|
+
return stripBundlerGeneratedCssMarkers;
|
|
3877
|
+
}
|
|
3878
|
+
});
|
|
3879
|
+
Object.defineProperty(exports, "stripRequestQuery", {
|
|
3880
|
+
enumerable: true,
|
|
3881
|
+
get: function() {
|
|
3882
|
+
return stripRequestQuery;
|
|
3883
|
+
}
|
|
3884
|
+
});
|
|
3705
3885
|
Object.defineProperty(exports, "validateCandidatesByGenerator", {
|
|
3706
3886
|
enumerable: true,
|
|
3707
3887
|
get: function() {
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_framework = require("./framework.js");
|
|
3
3
|
const require_generator = require("./generator-CEnUsjed.js");
|
|
4
|
-
const require_gulp = require("./gulp-
|
|
4
|
+
const require_gulp = require("./gulp-3m1dAiig.js");
|
|
5
5
|
const require_postcss = require("./postcss.js");
|
|
6
|
-
const require_vite = require("./vite-
|
|
7
|
-
const require_webpack = require("./webpack-
|
|
6
|
+
const require_vite = require("./vite-DUVjMduj.js");
|
|
7
|
+
const require_webpack = require("./webpack-nppysF4B.js");
|
|
8
8
|
require("./webpack.js");
|
|
9
9
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
10
10
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.mjs";
|
|
2
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { t as createPlugins } from "./gulp-
|
|
2
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-CEo920So.mjs";
|
|
3
|
+
import { t as createPlugins } from "./gulp-DP71z1jG.mjs";
|
|
4
4
|
import weappTailwindcssPostcssPlugin from "./postcss.mjs";
|
|
5
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
6
|
-
import { n as weappTailwindcssPackageDir } from "./webpack-
|
|
5
|
+
import { t as WeappTailwindcss } from "./vite-nXZEiwG0.mjs";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-C_UUFRgj.mjs";
|
|
7
7
|
import "./webpack.mjs";
|
|
8
8
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
|
|
9
9
|
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-
|
|
1
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-CEo920So.mjs";
|
|
2
2
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
3
3
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
4
4
|
createGenerator: (source) => {
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveTaroPlatform, resolveUniPlatformsFromEnv } from "./framework.mjs";
|
|
2
2
|
import { t as omitUndefined } from "./object-BJSWl-E5.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-xs704TRw.mjs";
|
|
4
4
|
import { n as defuOverrideArray } from "./utils-MVwpU07P.mjs";
|
|
5
5
|
import { t as logger } from "./logger-BNzxZbZj.mjs";
|
|
6
6
|
import path from "node:path";
|
package/dist/rspack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
3
|
-
const require_webpack = require("./webpack-
|
|
3
|
+
const require_webpack = require("./webpack-nppysF4B.js");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
6
6
|
//#region src/bundlers/rspack/index.ts
|
package/dist/rspack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-C_UUFRgj.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
//#region src/bundlers/rspack/index.ts
|
|
4
4
|
const CSS_IMPORT_REWRITE_LOADER_NAME = "weapp-tw-css-import-rewrite-loader";
|
package/dist/shared/mpx.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { AppType } from '../types';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
export declare function isMpx(appType?: AppType): appType is "mpx";
|
|
3
4
|
export declare function getTailwindcssCssEntry(pkgDir: string): string;
|
|
4
|
-
export declare function
|
|
5
|
+
export declare function rewriteMpxWebpackPluginRequests(request: string, mpxWebpackPluginDir: string, pathImpl?: Pick<typeof path, 'join'>): string;
|
|
6
|
+
export declare function patchMpxWebpackPluginRequests(compiler: any, mpxWebpackPluginDir: string | undefined): boolean;
|
|
7
|
+
export declare function patchMpxWebpackPluginNormalizeLib(_compiler: any, mpxWebpackPluginDir: string | undefined): boolean;
|
|
5
8
|
export declare function ensureMpxTailwindcssAliases(compiler: any, pkgDir: string): string;
|
|
6
9
|
export declare function patchMpxLoaderResolve(loaderContext: any, pkgDir: string, enabled: boolean): void;
|
|
7
10
|
export declare function setupMpxTailwindcssRedirect(pkgDir: string, enabled: boolean): void;
|
|
@@ -3,7 +3,7 @@ const require_framework = require("./framework.js");
|
|
|
3
3
|
require("./auto-DtU6f3X6.js");
|
|
4
4
|
const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
|
|
5
5
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
6
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
6
|
+
const require_hmr_timing = require("./hmr-timing-B8p4f0ca.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
9
|
let node_process = require("node:process");
|
|
@@ -229,39 +229,6 @@ function resolvePackageDir(name) {
|
|
|
229
229
|
return node_path.default.dirname(pkgPath);
|
|
230
230
|
}
|
|
231
231
|
//#endregion
|
|
232
|
-
//#region src/bundlers/shared/generated-css-marker.ts
|
|
233
|
-
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
|
|
234
|
-
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
235
|
-
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
236
|
-
const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
|
|
237
|
-
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
238
|
-
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
239
|
-
}
|
|
240
|
-
function hasBundlerGeneratedCssMarker(source) {
|
|
241
|
-
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
242
|
-
}
|
|
243
|
-
function stripBundlerGeneratedCssMarkers(source) {
|
|
244
|
-
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
|
|
245
|
-
}
|
|
246
|
-
function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
247
|
-
const blocks = [];
|
|
248
|
-
BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
|
|
249
|
-
let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
250
|
-
while (match !== null) {
|
|
251
|
-
const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
|
|
252
|
-
const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
253
|
-
const cssEnd = nextMatch?.index ?? source.length;
|
|
254
|
-
const file = match[2] ? decodeURIComponent(match[2]) : void 0;
|
|
255
|
-
blocks.push({
|
|
256
|
-
bundler: match[1],
|
|
257
|
-
file,
|
|
258
|
-
css: source.slice(cssStart, cssEnd)
|
|
259
|
-
});
|
|
260
|
-
match = nextMatch;
|
|
261
|
-
}
|
|
262
|
-
return blocks;
|
|
263
|
-
}
|
|
264
|
-
//#endregion
|
|
265
232
|
//#region src/bundlers/shared/module-graph.ts
|
|
266
233
|
const QUERY_HASH_RE = /[?#].*$/u;
|
|
267
234
|
const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
|
|
@@ -306,30 +273,6 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
|
|
|
306
273
|
return matchWithExtensions(candidate, hasOutput);
|
|
307
274
|
}
|
|
308
275
|
//#endregion
|
|
309
|
-
//#region src/bundlers/shared/style-requests.ts
|
|
310
|
-
const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
311
|
-
const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
|
|
312
|
-
const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
|
|
313
|
-
function stripHash(request) {
|
|
314
|
-
const hashIndex = request.indexOf("#");
|
|
315
|
-
return hashIndex === -1 ? request : request.slice(0, hashIndex);
|
|
316
|
-
}
|
|
317
|
-
function stripRequestQuery(request) {
|
|
318
|
-
const normalized = stripHash(request);
|
|
319
|
-
const queryIndex = normalized.indexOf("?");
|
|
320
|
-
return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
321
|
-
}
|
|
322
|
-
function isSourceStyleRequest(request) {
|
|
323
|
-
if (typeof request !== "string" || request.length === 0) return false;
|
|
324
|
-
const normalized = stripHash(request);
|
|
325
|
-
const queryIndex = normalized.indexOf("?");
|
|
326
|
-
const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
327
|
-
if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
|
|
328
|
-
if (queryIndex === -1) return false;
|
|
329
|
-
const query = normalized.slice(queryIndex + 1);
|
|
330
|
-
return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
|
|
331
|
-
}
|
|
332
|
-
//#endregion
|
|
333
276
|
//#region src/bundlers/shared/v4-generation-core.ts
|
|
334
277
|
async function generateTailwindV4Css(options) {
|
|
335
278
|
const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
|
|
@@ -476,7 +419,7 @@ const isWindows = node_process.default.platform === "win32";
|
|
|
476
419
|
const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
|
|
477
420
|
const htmlLangRE = /\.html?(?:$|\?)/;
|
|
478
421
|
function isCSSRequest(request) {
|
|
479
|
-
return cssLangRE.test(request) || isSourceStyleRequest(request);
|
|
422
|
+
return cssLangRE.test(request) || require_hmr_timing.isSourceStyleRequest(request);
|
|
480
423
|
}
|
|
481
424
|
function isHTMLRequest(request) {
|
|
482
425
|
return htmlLangRE.test(request);
|
|
@@ -510,6 +453,7 @@ function createBundleBuildState() {
|
|
|
510
453
|
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
511
454
|
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
512
455
|
dependentsByLinkedFile: /* @__PURE__ */ new Map(),
|
|
456
|
+
bundleMarkupCandidatesByFile: /* @__PURE__ */ new Map(),
|
|
513
457
|
generatorCandidateSignature: void 0
|
|
514
458
|
};
|
|
515
459
|
}
|
|
@@ -530,7 +474,7 @@ function createProcessFiles() {
|
|
|
530
474
|
}
|
|
531
475
|
function readEntrySource(output) {
|
|
532
476
|
if (output.type === "chunk") return output.code;
|
|
533
|
-
return output.source.toString();
|
|
477
|
+
return typeof output.source === "string" ? output.source : node_buffer.Buffer.from(output.source).toString();
|
|
534
478
|
}
|
|
535
479
|
function classifyBundleEntry(file, opts) {
|
|
536
480
|
if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
|
|
@@ -830,12 +774,6 @@ Object.defineProperty(exports, "createBundleModuleGraphOptions", {
|
|
|
830
774
|
return createBundleModuleGraphOptions;
|
|
831
775
|
}
|
|
832
776
|
});
|
|
833
|
-
Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
|
|
834
|
-
enumerable: true,
|
|
835
|
-
get: function() {
|
|
836
|
-
return createBundlerGeneratedCssMarker;
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
777
|
Object.defineProperty(exports, "createCandidateSignature", {
|
|
840
778
|
enumerable: true,
|
|
841
779
|
get: function() {
|
|
@@ -902,12 +840,6 @@ Object.defineProperty(exports, "getSnapshotHash", {
|
|
|
902
840
|
return getSnapshotHash;
|
|
903
841
|
}
|
|
904
842
|
});
|
|
905
|
-
Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
|
|
906
|
-
enumerable: true,
|
|
907
|
-
get: function() {
|
|
908
|
-
return hasBundlerGeneratedCssMarker;
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
843
|
Object.defineProperty(exports, "hasRuntimeAffectingSourceChanges", {
|
|
912
844
|
enumerable: true,
|
|
913
845
|
get: function() {
|
|
@@ -926,12 +858,6 @@ Object.defineProperty(exports, "isHTMLRequest", {
|
|
|
926
858
|
return isHTMLRequest;
|
|
927
859
|
}
|
|
928
860
|
});
|
|
929
|
-
Object.defineProperty(exports, "isSourceStyleRequest", {
|
|
930
|
-
enumerable: true,
|
|
931
|
-
get: function() {
|
|
932
|
-
return isSourceStyleRequest;
|
|
933
|
-
}
|
|
934
|
-
});
|
|
935
861
|
Object.defineProperty(exports, "normalizeOutputPathKey", {
|
|
936
862
|
enumerable: true,
|
|
937
863
|
get: function() {
|
|
@@ -944,12 +870,6 @@ Object.defineProperty(exports, "normalizePath", {
|
|
|
944
870
|
return normalizePath;
|
|
945
871
|
}
|
|
946
872
|
});
|
|
947
|
-
Object.defineProperty(exports, "parseBundlerGeneratedCssMarkerBlocks", {
|
|
948
|
-
enumerable: true,
|
|
949
|
-
get: function() {
|
|
950
|
-
return parseBundlerGeneratedCssMarkerBlocks;
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
873
|
Object.defineProperty(exports, "resolveOutputSpecifier", {
|
|
954
874
|
enumerable: true,
|
|
955
875
|
get: function() {
|
|
@@ -986,18 +906,6 @@ Object.defineProperty(exports, "slash", {
|
|
|
986
906
|
return slash;
|
|
987
907
|
}
|
|
988
908
|
});
|
|
989
|
-
Object.defineProperty(exports, "stripBundlerGeneratedCssMarkers", {
|
|
990
|
-
enumerable: true,
|
|
991
|
-
get: function() {
|
|
992
|
-
return stripBundlerGeneratedCssMarkers;
|
|
993
|
-
}
|
|
994
|
-
});
|
|
995
|
-
Object.defineProperty(exports, "stripRequestQuery", {
|
|
996
|
-
enumerable: true,
|
|
997
|
-
get: function() {
|
|
998
|
-
return stripRequestQuery;
|
|
999
|
-
}
|
|
1000
|
-
});
|
|
1001
909
|
Object.defineProperty(exports, "summarizeStringDiff", {
|
|
1002
910
|
enumerable: true,
|
|
1003
911
|
get: function() {
|