weapp-tailwindcss 5.1.2 → 5.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auto-CrJJc5rK.mjs +13 -0
- package/dist/bundlers/gulp/index.d.ts +3 -3
- package/dist/bundlers/rspack/index.d.ts +20 -0
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
- package/dist/bundlers/vite/css-memory.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +12 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +1 -0
- package/dist/bundlers/vite/serve-js-transform.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +4 -1
- package/dist/cli.js +8 -8
- package/dist/cli.mjs +8 -8
- package/dist/{context-C-r8ki7x.mjs → context-Bkpmt3ja.mjs} +62 -36
- package/dist/{context-CH4HFZP2.js → context-DCVMkTRj.js} +76 -44
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +1 -1
- package/dist/css-macro/postcss.js +2 -2
- package/dist/css-macro.js +3 -3
- package/dist/css-macro.mjs +1 -1
- package/dist/{defaults-CmFBmxsr.js → defaults-DQhgnnn-.js} +1 -1
- package/dist/defaults.js +1 -1
- package/dist/framework/index.d.ts +7 -2
- package/dist/framework/platform.d.ts +2 -0
- package/dist/framework.js +39 -8
- package/dist/framework.mjs +33 -6
- package/dist/{generator-BsPIaLtV.mjs → generator-24-HgU9F.mjs} +5 -3
- package/dist/{generator-B6pUjNdD.js → generator-CilgHtxb.js} +6 -4
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-CTdcASq8.mjs → gulp-0RsqkF_d.mjs} +4 -4
- package/dist/{gulp-BBCeA7ky.js → gulp-Bogfnoki.js} +12 -11
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BRx-KnBh.mjs → hmr-timing-BRNaz8Od.mjs} +62 -166
- package/dist/{hmr-timing-Da1eI8S0.js → hmr-timing-BV6nFPoT.js} +65 -187
- package/dist/index.js +9 -4
- package/dist/index.mjs +7 -6
- package/dist/postcss-html-transform.js +2 -2
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets/shared.d.ts +4 -0
- package/dist/presets.js +32 -16
- package/dist/presets.mjs +28 -14
- package/dist/reset.js +2 -2
- package/dist/rspack.d.ts +3 -0
- package/dist/rspack.js +68 -0
- package/dist/rspack.mjs +62 -0
- package/dist/{source-candidate-scan-signature-Dugfplms.mjs → source-candidate-scan-signature-BB1hvW68.mjs} +12 -6
- package/dist/{source-candidate-scan-signature-BO6JSskQ.js → source-candidate-scan-signature-CaDT0gkj.js} +16 -9
- package/dist/tailwindcss/v4-engine/css-macro-source.d.ts +2 -0
- package/dist/{tailwindcss-B5mRo0-M.mjs → tailwindcss-D0JF0fuZ.mjs} +6 -6
- package/dist/{tailwindcss-dbrbY4cd.js → tailwindcss-D2xs4OEu.js} +11 -11
- package/dist/{transform-DeqFRp1D.mjs → transform-BP86eSZp.mjs} +19 -19
- package/dist/{transform-BLleu_bA.js → transform-CXCQ28Tc.js} +47 -47
- package/dist/{utils-BCa37Wqj.js → utils-D3h8j7Mk.js} +2 -2
- package/dist/{v4-engine-C3qSwQ-e.mjs → v4-engine-BuuYDXt1.mjs} +58 -118
- package/dist/{v4-engine-ON_oSLfO.js → v4-engine-CKtsdKxK.js} +66 -120
- package/dist/{vite-CXmUiI9f.mjs → vite-B1SlBmqO.mjs} +436 -73
- package/dist/{vite-Da4uEG_u.js → vite-BYgT1ir9.js} +443 -80
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +143 -216
- package/dist/weapp-tw-runtime-classset-loader.js +2 -2
- package/dist/{webpack-CrFZmdo7.mjs → webpack-Bg6pefpb.mjs} +109 -18
- package/dist/{webpack-Cwqnznng.js → webpack-khSwkXP5.js} +115 -24
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +9 -4
- package/dist/auto-Ba6hDrse.mjs +0 -13
- /package/dist/{chunk-emK7D4bc.js → rolldown-runtime-emK7D4bc.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_v4_engine = require("./v4-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_context = require("./context-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
+
const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
|
|
3
|
+
const require_generator = require("./generator-CilgHtxb.js");
|
|
4
|
+
const require_context = require("./context-DCVMkTRj.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-D2xs4OEu.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
|
-
node_path =
|
|
8
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
9
|
let node_process = require("node:process");
|
|
10
|
-
node_process =
|
|
10
|
+
node_process = require_rolldown_runtime.__toESM(node_process);
|
|
11
11
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
12
12
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
13
13
|
let lru_cache = require("lru-cache");
|
|
@@ -162,8 +162,10 @@ function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
|
162
162
|
}
|
|
163
163
|
function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPreflight, options = {}) {
|
|
164
164
|
if (target !== "weapp") return css;
|
|
165
|
+
const injectPreflight = options.injectPreflight !== false && !hasMiniProgramTailwindV4PreflightReset(css);
|
|
165
166
|
return (0, _weapp_tailwindcss_postcss.finalizeMiniProgramCss)(css, {
|
|
166
|
-
cssPreflight:
|
|
167
|
+
cssPreflight: cssPreflight === false ? false : injectPreflight ? cssPreflight : void 0,
|
|
168
|
+
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
167
169
|
isTailwindcssV4: true,
|
|
168
170
|
tailwindcssV4GradientFallback: options.styleOptions?.cssOptions?.tailwindcssV4GradientFallback ?? options.styleOptions?.tailwindcssV4GradientFallback
|
|
169
171
|
});
|
|
@@ -175,11 +177,11 @@ function shouldInjectMiniProgramPreflightForGeneratorCss(opts, options) {
|
|
|
175
177
|
}
|
|
176
178
|
function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
|
|
177
179
|
if (options.isolateCssSource) {
|
|
178
|
-
if (options.matchedCssSourceFile) return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
179
|
-
return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
180
|
+
if (options.matchedCssSourceFile) return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
181
|
+
return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
180
182
|
}
|
|
181
183
|
if (runtime.size === 0 || !options.cssHandlerOptions.isMainChunk) return scopedRuntime;
|
|
182
|
-
return new Set([...scopedRuntime, ...runtime]);
|
|
184
|
+
return /* @__PURE__ */ new Set([...scopedRuntime, ...runtime]);
|
|
183
185
|
}
|
|
184
186
|
function shouldIsolateScopedCssSource(_majorVersion, source, sourceEntries, options) {
|
|
185
187
|
if (options.target !== "weapp") return false;
|
|
@@ -241,7 +243,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
|
|
|
241
243
|
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives || cssHandlerOptions.isMainChunk && (options.configuredCssSourceCount ?? 0) > 0 || cssHandlerOptions.isMainChunk && options.rawSource.includes("weapp-tailwindcss") || options.target === "web" && cssHandlerOptions.isMainChunk && (options.runtimeCandidateCount ?? 0) > 0;
|
|
242
244
|
}
|
|
243
245
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
244
|
-
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
246
|
+
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? /* @__PURE__ */ new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
245
247
|
}
|
|
246
248
|
function mergeGeneratorResults(generatedResults) {
|
|
247
249
|
const firstGenerated = generatedResults[0];
|
|
@@ -263,7 +265,7 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
263
265
|
//#endregion
|
|
264
266
|
//#region src/bundlers/shared/generator-css/legacy-selectors.ts
|
|
265
267
|
const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
|
|
266
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = new Set([
|
|
268
|
+
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
|
|
267
269
|
":host",
|
|
268
270
|
"page",
|
|
269
271
|
".tw-root",
|
|
@@ -326,7 +328,7 @@ function escapeCompatSelectorClasses(selector) {
|
|
|
326
328
|
function normalizeCompatSelectors(selector) {
|
|
327
329
|
const normalized = normalizeCompatSelector(selector);
|
|
328
330
|
if (!normalized) return [];
|
|
329
|
-
const selectors = new Set([normalized]);
|
|
331
|
+
const selectors = /* @__PURE__ */ new Set([normalized]);
|
|
330
332
|
const escaped = normalizeCompatSelector(escapeCompatSelectorClasses(normalized));
|
|
331
333
|
if (escaped) selectors.add(escaped);
|
|
332
334
|
return [...selectors];
|
|
@@ -677,7 +679,7 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
|
|
|
677
679
|
for (const sourceFile of createSourceStylePathCandidates(file, sourceOptions)) try {
|
|
678
680
|
const source = sourceOptions.sourceFile && node_path.default.resolve(sourceOptions.sourceFile) === node_path.default.resolve(sourceFile) && typeof sourceOptions.sourceCss === "string" ? sourceOptions.sourceCss : (0, node_fs.existsSync)(sourceFile) ? (0, node_fs.readFileSync)(sourceFile, "utf8") : void 0;
|
|
679
681
|
if (source === void 0) continue;
|
|
680
|
-
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, new Set([node_path.default.resolve(sourceFile)]));
|
|
682
|
+
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, /* @__PURE__ */ new Set([node_path.default.resolve(sourceFile)]));
|
|
681
683
|
for (const styleSource of directiveSources) {
|
|
682
684
|
const cssEntrySource = require_v4_engine.resolveCssEntrySource(styleSource.source, node_path.default.dirname(styleSource.file), resolveOptions);
|
|
683
685
|
if (cssEntrySource) return {
|
|
@@ -884,7 +886,8 @@ function createSingleTailwindV4SourceOptions(sourceOptions, options) {
|
|
|
884
886
|
baseFallbacks: sourceOptions.baseFallbacks,
|
|
885
887
|
packageName: sourceOptions.packageName,
|
|
886
888
|
base: options.base,
|
|
887
|
-
css: options.css
|
|
889
|
+
css: options.css,
|
|
890
|
+
cssEntries: options.cssEntries
|
|
888
891
|
});
|
|
889
892
|
}
|
|
890
893
|
async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions) {
|
|
@@ -975,7 +978,7 @@ function hydrateTailwindV4CssSource(cssSource) {
|
|
|
975
978
|
file,
|
|
976
979
|
base: cssSource.base ?? node_path.default.dirname(file),
|
|
977
980
|
css: (0, node_fs.readFileSync)(file, "utf8"),
|
|
978
|
-
dependencies: [
|
|
981
|
+
dependencies: [.../* @__PURE__ */ new Set([...cssSource.dependencies ?? [], file])]
|
|
979
982
|
};
|
|
980
983
|
}
|
|
981
984
|
function normalizeTailwindV4CssSourceConfigs(sourceOptions) {
|
|
@@ -1091,7 +1094,8 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
|
|
|
1091
1094
|
const css = createTailwindV4SourceReferenceSource(require_v4_engine.normalizeConfigDirective(require_v4_engine.prependConfigDirective(resolvedEntrySource.css, generatorOptions?.config), config), resolvedSourceOptions);
|
|
1092
1095
|
return withMatchedSourceSideMetadata(await require_v4_engine.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(resolvedSourceOptions, {
|
|
1093
1096
|
base: resolvedEntrySource.base,
|
|
1094
|
-
css
|
|
1097
|
+
css,
|
|
1098
|
+
cssEntries: [resolvedEntrySource.file]
|
|
1095
1099
|
})), resolvedEntrySource);
|
|
1096
1100
|
}
|
|
1097
1101
|
async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
@@ -1122,6 +1126,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
1122
1126
|
}
|
|
1123
1127
|
const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
|
|
1124
1128
|
const sourceSideEntrySource = normalizedSourceOptions && (shouldPreferSourceSideEntry || normalizedSourceOptions.sourceFile !== void 0) && canResolveSourceSideCssEntry(file, cssHandlerOptions, normalizedSourceOptions) ? resolveSourceSideCssEntrySource(file, normalizedSourceOptions, { removeConfig: false }) : void 0;
|
|
1129
|
+
const sourceSideCssSource = sourceSideEntrySource?.file && normalizedSourceOptions.cssEntries?.some((cssEntry) => node_path.default.resolve(cssEntry.replace(/[?#].*$/, "")) === node_path.default.resolve(sourceSideEntrySource.file)) ? await resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file) : void 0;
|
|
1130
|
+
if (sourceSideCssSource) return sourceSideCssSource;
|
|
1125
1131
|
const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
|
|
1126
1132
|
const matchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOptions, normalizedSourceOptions) : void 0;
|
|
1127
1133
|
const candidateMatchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveCandidateMatchedTailwindV4CssSource(rawSource, cssHandlerOptions, normalizedSourceOptions, selectionOptions) : void 0;
|
|
@@ -1145,7 +1151,6 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
1145
1151
|
css: require_v4_engine.prependConfigDirective(source.css, generatorOptions.config)
|
|
1146
1152
|
} : source;
|
|
1147
1153
|
}
|
|
1148
|
-
if (sourceSideEntrySource && normalizedSourceOptions) return resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file);
|
|
1149
1154
|
const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, require_v4_engine.omitUndefined({
|
|
1150
1155
|
...resolvedSourceOptions ?? {},
|
|
1151
1156
|
sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
|
|
@@ -1245,7 +1250,7 @@ async function resolveGeneratorSourceEntries(source, runtimeState) {
|
|
|
1245
1250
|
}
|
|
1246
1251
|
//#endregion
|
|
1247
1252
|
//#region src/bundlers/shared/generator-css/user-css.ts
|
|
1248
|
-
const TAILWIND_V4_GENERATOR_AT_RULES = new Set([
|
|
1253
|
+
const TAILWIND_V4_GENERATOR_AT_RULES = /* @__PURE__ */ new Set([
|
|
1249
1254
|
"config",
|
|
1250
1255
|
"custom-variant",
|
|
1251
1256
|
"plugin",
|
|
@@ -2000,133 +2005,6 @@ function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
|
|
|
2000
2005
|
}
|
|
2001
2006
|
}
|
|
2002
2007
|
//#endregion
|
|
2003
|
-
//#region src/bundlers/shared/generator-css/local-imports.ts
|
|
2004
|
-
const REMOTE_IMPORT_RE = /^(?:https?:)?\/\//i;
|
|
2005
|
-
const CSS_STYLE_EXTENSION_RE = /\.(?:css|wxss|acss|ttss|qss|jxss|tyss|scss|sass|less|styl|stylus|pcss|postcss)(?:$|[?#])/i;
|
|
2006
|
-
const SOURCE_STYLE_EXTENSION_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)(?:$|[?#])/i;
|
|
2007
|
-
function createCssSourceOrderAppend(base, extra) {
|
|
2008
|
-
if (!base) return extra;
|
|
2009
|
-
if (!extra) return base;
|
|
2010
|
-
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
2011
|
-
return `${base}\n${extra}`;
|
|
2012
|
-
}
|
|
2013
|
-
function isLocalImportRequest(request) {
|
|
2014
|
-
return request.length > 0 && !request.startsWith("#") && !request.startsWith("tailwindcss") && !request.startsWith("weapp-tailwindcss") && !request.startsWith("data:") && !REMOTE_IMPORT_RE.test(request);
|
|
2015
|
-
}
|
|
2016
|
-
function isPureLocalCssImportWrapper(css) {
|
|
2017
|
-
let hasImport = false;
|
|
2018
|
-
try {
|
|
2019
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2020
|
-
for (const node of root.nodes) {
|
|
2021
|
-
if (node.type === "comment") continue;
|
|
2022
|
-
if (node.type !== "atrule" || node.name !== "import") return false;
|
|
2023
|
-
const request = require_v4_engine.parseImportRequest(node.params);
|
|
2024
|
-
if (!request || !isLocalImportRequest(request)) return false;
|
|
2025
|
-
hasImport = true;
|
|
2026
|
-
}
|
|
2027
|
-
} catch {
|
|
2028
|
-
return false;
|
|
2029
|
-
}
|
|
2030
|
-
return hasImport;
|
|
2031
|
-
}
|
|
2032
|
-
function cleanLocalCssImportWrapperTailwindDirectives(css) {
|
|
2033
|
-
let hasLocalImport = false;
|
|
2034
|
-
let hasTailwindDirective = false;
|
|
2035
|
-
try {
|
|
2036
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2037
|
-
for (const node of root.nodes) {
|
|
2038
|
-
if (node.type === "comment") continue;
|
|
2039
|
-
if (node.type === "atrule" && node.name === "import") {
|
|
2040
|
-
const request = require_v4_engine.parseImportRequest(node.params);
|
|
2041
|
-
if (!request || !isLocalImportRequest(request)) return;
|
|
2042
|
-
hasLocalImport = true;
|
|
2043
|
-
continue;
|
|
2044
|
-
}
|
|
2045
|
-
if (node.type === "atrule" && node.name === "source") {
|
|
2046
|
-
hasTailwindDirective = true;
|
|
2047
|
-
continue;
|
|
2048
|
-
}
|
|
2049
|
-
return;
|
|
2050
|
-
}
|
|
2051
|
-
} catch {
|
|
2052
|
-
return;
|
|
2053
|
-
}
|
|
2054
|
-
return hasLocalImport && hasTailwindDirective ? prefixLocalCssImportsWithWebpackIgnore(require_v4_engine.removeTailwindSourceDirectives(css)) : void 0;
|
|
2055
|
-
}
|
|
2056
|
-
function prefixLocalCssImportsWithWebpackIgnore(css) {
|
|
2057
|
-
try {
|
|
2058
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2059
|
-
root.walkAtRules("import", (atRule) => {
|
|
2060
|
-
const request = require_v4_engine.parseImportRequest(atRule.params);
|
|
2061
|
-
if (request && isLocalImportRequest(request)) atRule.raws.before = `${atRule.raws.before ?? ""}/* webpackIgnore: true */\n`;
|
|
2062
|
-
});
|
|
2063
|
-
return root.toString();
|
|
2064
|
-
} catch {
|
|
2065
|
-
return css;
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
function splitLocalCssImports(source) {
|
|
2069
|
-
try {
|
|
2070
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
2071
|
-
const importRoot = _weapp_tailwindcss_postcss.postcss.root();
|
|
2072
|
-
let changed = false;
|
|
2073
|
-
for (const node of [...root.nodes]) {
|
|
2074
|
-
if (node.type !== "atrule" || node.name !== "import") continue;
|
|
2075
|
-
const request = require_v4_engine.parseImportRequest(node.params);
|
|
2076
|
-
if (!request || !isLocalImportRequest(request)) continue;
|
|
2077
|
-
importRoot.append(node.clone());
|
|
2078
|
-
node.remove();
|
|
2079
|
-
changed = true;
|
|
2080
|
-
}
|
|
2081
|
-
const imports = importRoot.nodes.filter((node) => node.type === "atrule" && node.name === "import").map((node) => `@import ${node.params};`).join("\n");
|
|
2082
|
-
return changed ? {
|
|
2083
|
-
imports,
|
|
2084
|
-
source: root.toString()
|
|
2085
|
-
} : void 0;
|
|
2086
|
-
} catch {
|
|
2087
|
-
return;
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
function restoreLocalCssImports(css, imports) {
|
|
2091
|
-
if (!imports?.trim()) return css;
|
|
2092
|
-
return createCssSourceOrderAppend(imports, css);
|
|
2093
|
-
}
|
|
2094
|
-
function splitRequestSuffix(request) {
|
|
2095
|
-
const suffixIndexCandidates = [request.indexOf("?"), request.indexOf("#")].filter((index) => index >= 0);
|
|
2096
|
-
const suffixIndex = suffixIndexCandidates.length > 0 ? Math.min(...suffixIndexCandidates) : -1;
|
|
2097
|
-
if (suffixIndex < 0) return {
|
|
2098
|
-
clean: request,
|
|
2099
|
-
suffix: ""
|
|
2100
|
-
};
|
|
2101
|
-
return {
|
|
2102
|
-
clean: request.slice(0, suffixIndex),
|
|
2103
|
-
suffix: request.slice(suffixIndex)
|
|
2104
|
-
};
|
|
2105
|
-
}
|
|
2106
|
-
function normalizeOutputImportRequest(request, styleOutputExtension) {
|
|
2107
|
-
const normalizedStyleOutputExtension = styleOutputExtension?.startsWith(".") ? styleOutputExtension : styleOutputExtension ? `.${styleOutputExtension}` : void 0;
|
|
2108
|
-
const { clean, suffix } = splitRequestSuffix(request.replace(/\\/g, "/"));
|
|
2109
|
-
return `${clean.replace(/^(?:\.\/)?src\//, "./").replace(SOURCE_STYLE_EXTENSION_RE, normalizedStyleOutputExtension ?? ".css")}${suffix}`;
|
|
2110
|
-
}
|
|
2111
|
-
function rewriteLocalCssImportRequestsForOutput(css, options = {}) {
|
|
2112
|
-
if (!css.includes("@import")) return css;
|
|
2113
|
-
try {
|
|
2114
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2115
|
-
let changed = false;
|
|
2116
|
-
root.walkAtRules("import", (atRule) => {
|
|
2117
|
-
const request = require_v4_engine.parseImportRequest(atRule.params);
|
|
2118
|
-
if (!request || !isLocalImportRequest(request) || !CSS_STYLE_EXTENSION_RE.test(request)) return;
|
|
2119
|
-
const rewritten = normalizeOutputImportRequest(request, options.styleOutputExtension);
|
|
2120
|
-
if (rewritten === request) return;
|
|
2121
|
-
atRule.params = atRule.params.replace(request, rewritten);
|
|
2122
|
-
changed = true;
|
|
2123
|
-
});
|
|
2124
|
-
return changed ? root.toString() : css;
|
|
2125
|
-
} catch {
|
|
2126
|
-
return css;
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
//#endregion
|
|
2130
2008
|
//#region src/bundlers/shared/generator-css/user-layer-order.ts
|
|
2131
2009
|
const USER_LAYER_COMPONENTS_START = "/*! weapp-tailwindcss layer components start */";
|
|
2132
2010
|
const USER_LAYER_COMPONENTS_END = "/*! weapp-tailwindcss layer components end */";
|
|
@@ -2324,6 +2202,23 @@ function intersectCandidateSets(left, right) {
|
|
|
2324
2202
|
for (const candidate of small) if (large.has(candidate)) matched.add(candidate);
|
|
2325
2203
|
return matched;
|
|
2326
2204
|
}
|
|
2205
|
+
function parseCssSourceRoot(rawSource) {
|
|
2206
|
+
try {
|
|
2207
|
+
return _weapp_tailwindcss_postcss.postcss.parse(rawSource);
|
|
2208
|
+
} catch {
|
|
2209
|
+
return;
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
function cleanLocalCssImportWrapperFromParsedRoot(rawSource, root) {
|
|
2213
|
+
if (!root) return (0, _weapp_tailwindcss_postcss.cleanLocalCssImportWrapperTailwindDirectives)(rawSource);
|
|
2214
|
+
return (0, _weapp_tailwindcss_postcss.cleanLocalCssImportWrapperTailwindDirectivesRoot)(root) ? root.toString() : void 0;
|
|
2215
|
+
}
|
|
2216
|
+
function isPureLocalCssImportWrapperFromParsedRoot(rawSource, root) {
|
|
2217
|
+
return root ? (0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapperRoot)(root) : (0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(rawSource);
|
|
2218
|
+
}
|
|
2219
|
+
function splitLocalCssImportsFromParsedRoot(rawSource, root) {
|
|
2220
|
+
return root ? (0, _weapp_tailwindcss_postcss.splitLocalCssImportsRoot)(root) : (0, _weapp_tailwindcss_postcss.splitLocalCssImports)(rawSource);
|
|
2221
|
+
}
|
|
2327
2222
|
function collectCssRuleIdentityMarkers(source) {
|
|
2328
2223
|
const markers = /* @__PURE__ */ new Set();
|
|
2329
2224
|
try {
|
|
@@ -2372,20 +2267,8 @@ async function generateCssByGenerator(options) {
|
|
|
2372
2267
|
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
2373
2268
|
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
2374
2269
|
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
2375
|
-
const
|
|
2376
|
-
const
|
|
2377
|
-
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
2378
|
-
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
2379
|
-
};
|
|
2380
|
-
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
2381
|
-
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
2382
|
-
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
2383
|
-
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
2384
|
-
const generatedUserCssOrderSource = require_v4_engine.hasTailwindGeneratedCss(userSource) ? require_v4_engine.splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
2385
|
-
const generatedUserCssRawSource = generatedUserCssOrderSource ? require_v4_engine.createCssAppend(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : require_v4_engine.hasTailwindGeneratedCss(userSource) ? "" : userCssRawSource;
|
|
2386
|
-
const userCssOrderSource = require_v4_engine.GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : require_v4_engine.hasTailwindGeneratedCss(userSource) ? userSource : generatedUserCssRawSource;
|
|
2387
|
-
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
2388
|
-
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
2270
|
+
const effectiveRawSourceRoot = parseCssSourceRoot(effectiveRawSource);
|
|
2271
|
+
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
2389
2272
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
2390
2273
|
css: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
2391
2274
|
classSet: /* @__PURE__ */ new Set(),
|
|
@@ -2397,7 +2280,20 @@ async function generateCssByGenerator(options) {
|
|
|
2397
2280
|
majorVersion
|
|
2398
2281
|
}
|
|
2399
2282
|
};
|
|
2400
|
-
if (
|
|
2283
|
+
if (isPureLocalCssImportWrapperFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot)) return;
|
|
2284
|
+
const localImportParts = splitLocalCssImportsFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
2285
|
+
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
2286
|
+
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
2287
|
+
return finalizeWebGeneratorCss((0, _weapp_tailwindcss_postcss.restoreLocalCssImports)(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
2288
|
+
};
|
|
2289
|
+
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
2290
|
+
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
2291
|
+
const userSource = (rawUserSource === generatorRawSource ? void 0 : (0, _weapp_tailwindcss_postcss.splitLocalCssImports)(rawUserSource))?.source ?? rawUserSource;
|
|
2292
|
+
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
2293
|
+
const generatedUserCssOrderSource = require_v4_engine.hasTailwindGeneratedCss(userSource) ? require_v4_engine.splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
2294
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? require_v4_engine.createCssAppend(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : require_v4_engine.hasTailwindGeneratedCss(userSource) ? "" : userCssRawSource;
|
|
2295
|
+
const userCssOrderSource = require_v4_engine.GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : require_v4_engine.hasTailwindGeneratedCss(userSource) ? userSource : generatedUserCssRawSource;
|
|
2296
|
+
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
2401
2297
|
const hasGeneratedCss = require_v4_engine.hasTailwindGeneratedCss(generatorRawSource);
|
|
2402
2298
|
const hasSourceDirectives = require_v4_engine.hasTailwindSourceDirectives(generatorRawSource, { importFallback: generatorOptions.importFallback });
|
|
2403
2299
|
const hasGeneratedMarkers = require_v4_engine.hasTailwindGeneratedCssMarkers(generatorRawSource);
|
|
@@ -2465,7 +2361,7 @@ async function generateCssByGenerator(options) {
|
|
|
2465
2361
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2466
2362
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2467
2363
|
const incrementalCss = require_v4_engine.stripTailwindBanner(generated.incrementalCss);
|
|
2468
|
-
const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? require_v4_engine.createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2364
|
+
const finalCss = finalizeWebGeneratorCss((0, _weapp_tailwindcss_postcss.restoreLocalCssImports)(incrementalCss.trim().length > 0 ? require_v4_engine.createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2469
2365
|
injectPreflight: false,
|
|
2470
2366
|
styleOptions: generatorStyleOptions
|
|
2471
2367
|
})) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
|
|
@@ -2746,7 +2642,7 @@ function createRuntimeEntries(snapshot) {
|
|
|
2746
2642
|
return snapshot.entries.filter(isRuntimeCandidateEntry);
|
|
2747
2643
|
}
|
|
2748
2644
|
function collectChangedRuntimeFiles(snapshot) {
|
|
2749
|
-
return new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2645
|
+
return /* @__PURE__ */ new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2750
2646
|
}
|
|
2751
2647
|
function resolveEntryExtension(entry) {
|
|
2752
2648
|
if (entry.type === "html") return "html";
|
|
@@ -2849,7 +2745,7 @@ function addCandidateSet$1(candidateCountByClass, candidates) {
|
|
|
2849
2745
|
}
|
|
2850
2746
|
}
|
|
2851
2747
|
function createRuntimeClassSet(baseClassSet, candidateCountByClass) {
|
|
2852
|
-
return new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2748
|
+
return /* @__PURE__ */ new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2853
2749
|
}
|
|
2854
2750
|
function createNonSourceBaseClassSet(baseClassSet, candidateCountByClass) {
|
|
2855
2751
|
const nextBaseClassSet = new Set(baseClassSet);
|
|
@@ -2980,7 +2876,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
2980
2876
|
}
|
|
2981
2877
|
//#endregion
|
|
2982
2878
|
//#region src/tailwindcss/candidates.ts
|
|
2983
|
-
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = new Set([
|
|
2879
|
+
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2984
2880
|
"js",
|
|
2985
2881
|
"jsx",
|
|
2986
2882
|
"mjs",
|
|
@@ -3272,7 +3168,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3272
3168
|
}
|
|
3273
3169
|
function recompute(id) {
|
|
3274
3170
|
const normalizedId = cleanUrl(id);
|
|
3275
|
-
replaceFinal(normalizedId, new Set([
|
|
3171
|
+
replaceFinal(normalizedId, /* @__PURE__ */ new Set([
|
|
3276
3172
|
...scanCandidatesById.get(normalizedId) ?? [],
|
|
3277
3173
|
...transformCandidatesById.get(normalizedId) ?? [],
|
|
3278
3174
|
...cssCandidatesById.get(normalizedId) ?? []
|
|
@@ -3303,7 +3199,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3303
3199
|
return mergeSourcesByPriority().entries();
|
|
3304
3200
|
}
|
|
3305
3201
|
function values() {
|
|
3306
|
-
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3202
|
+
const values = /* @__PURE__ */ new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3307
3203
|
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
3308
3204
|
return values;
|
|
3309
3205
|
}
|
|
@@ -3407,7 +3303,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3407
3303
|
for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
|
|
3408
3304
|
for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
|
|
3409
3305
|
for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
|
|
3410
|
-
const ids = new Set([
|
|
3306
|
+
const ids = /* @__PURE__ */ new Set([
|
|
3411
3307
|
...scanCandidatesById.keys(),
|
|
3412
3308
|
...transformCandidatesById.keys(),
|
|
3413
3309
|
...cssCandidatesById.keys()
|
|
@@ -3615,12 +3511,6 @@ Object.defineProperty(exports, "isCssSourceTraceEnabled", {
|
|
|
3615
3511
|
return isCssSourceTraceEnabled;
|
|
3616
3512
|
}
|
|
3617
3513
|
});
|
|
3618
|
-
Object.defineProperty(exports, "isPureLocalCssImportWrapper", {
|
|
3619
|
-
enumerable: true,
|
|
3620
|
-
get: function() {
|
|
3621
|
-
return isPureLocalCssImportWrapper;
|
|
3622
|
-
}
|
|
3623
|
-
});
|
|
3624
3514
|
Object.defineProperty(exports, "isSourceCandidateRequest", {
|
|
3625
3515
|
enumerable: true,
|
|
3626
3516
|
get: function() {
|
|
@@ -3681,12 +3571,6 @@ Object.defineProperty(exports, "resolveTaskConcurrency", {
|
|
|
3681
3571
|
return resolveTaskConcurrency;
|
|
3682
3572
|
}
|
|
3683
3573
|
});
|
|
3684
|
-
Object.defineProperty(exports, "rewriteLocalCssImportRequestsForOutput", {
|
|
3685
|
-
enumerable: true,
|
|
3686
|
-
get: function() {
|
|
3687
|
-
return rewriteLocalCssImportRequestsForOutput;
|
|
3688
|
-
}
|
|
3689
|
-
});
|
|
3690
3574
|
Object.defineProperty(exports, "runWithConcurrency", {
|
|
3691
3575
|
enumerable: true,
|
|
3692
3576
|
get: function() {
|
|
@@ -3699,12 +3583,6 @@ Object.defineProperty(exports, "scoreTailwindV4CssSourceFileMatch", {
|
|
|
3699
3583
|
return scoreTailwindV4CssSourceFileMatch;
|
|
3700
3584
|
}
|
|
3701
3585
|
});
|
|
3702
|
-
Object.defineProperty(exports, "splitLocalCssImports", {
|
|
3703
|
-
enumerable: true,
|
|
3704
|
-
get: function() {
|
|
3705
|
-
return splitLocalCssImports;
|
|
3706
|
-
}
|
|
3707
|
-
});
|
|
3708
3586
|
Object.defineProperty(exports, "stripTailwindSourceMediaFragments", {
|
|
3709
3587
|
enumerable: true,
|
|
3710
3588
|
get: function() {
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_framework = require("./framework.js");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_gulp = require("./gulp-
|
|
3
|
+
const require_generator = require("./generator-CilgHtxb.js");
|
|
4
|
+
const require_gulp = require("./gulp-Bogfnoki.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-BYgT1ir9.js");
|
|
7
|
+
const require_webpack = require("./webpack-khSwkXP5.js");
|
|
8
|
+
require("./webpack.js");
|
|
8
9
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
9
10
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
10
11
|
exports.createPlugins = require_gulp.createPlugins;
|
|
@@ -21,6 +22,10 @@ exports.isUniAppXManifest = require_framework.isUniAppXManifest;
|
|
|
21
22
|
exports.isUniAppXPackage = require_framework.isUniAppXPackage;
|
|
22
23
|
exports.isWeappVitePackage = require_framework.isWeappVitePackage;
|
|
23
24
|
exports.resolveImplicitAppTypeFromViteRoot = require_framework.resolveImplicitAppTypeFromViteRoot;
|
|
25
|
+
exports.resolveMpxPlatform = require_framework.resolveMpxPlatform;
|
|
26
|
+
exports.resolvePlatform = require_framework.resolvePlatform;
|
|
27
|
+
exports.resolveTaroPlatform = require_framework.resolveTaroPlatform;
|
|
28
|
+
exports.resolveUniAppXPlatform = require_framework.resolveUniAppXPlatform;
|
|
24
29
|
exports.resolveUniPlatform = require_framework.resolveUniPlatform;
|
|
25
30
|
exports.resolveUniPlatformsFromEnv = require_framework.resolveUniPlatformsFromEnv;
|
|
26
31
|
exports.resolveUniUtsPlatform = require_framework.resolveUniUtsPlatform;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.mjs";
|
|
2
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { t as createPlugins } from "./gulp-
|
|
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-24-HgU9F.mjs";
|
|
3
|
+
import { t as createPlugins } from "./gulp-0RsqkF_d.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-B1SlBmqO.mjs";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-Bg6pefpb.mjs";
|
|
7
|
+
import "./webpack.mjs";
|
|
7
8
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
|
|
8
|
-
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
2
|
let _weapp_tailwindcss_postcss_html_transform = require("@weapp-tailwindcss/postcss/html-transform");
|
|
3
|
-
_weapp_tailwindcss_postcss_html_transform =
|
|
3
|
+
_weapp_tailwindcss_postcss_html_transform = require_rolldown_runtime.__toESM(_weapp_tailwindcss_postcss_html_transform);
|
|
4
4
|
//#region src/postcss-html-transform.ts
|
|
5
5
|
var postcss_html_transform_default = _weapp_tailwindcss_postcss_html_transform.default;
|
|
6
6
|
//#endregion
|
package/dist/postcss.js
CHANGED
|
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_v4_engine = require("./v4-engine-
|
|
6
|
-
const require_generator = require("./generator-
|
|
5
|
+
const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
|
|
6
|
+
const require_generator = require("./generator-CilgHtxb.js");
|
|
7
7
|
const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss").createWeappTailwindcssPostcssPlugin)({
|
|
8
8
|
createGenerator: (source) => {
|
|
9
9
|
return require_generator.createWeappTailwindcssGenerator(source);
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as resolveTailwindV4Source } from "./v4-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { t as resolveTailwindV4Source } from "./v4-engine-BuuYDXt1.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-24-HgU9F.mjs";
|
|
3
3
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
4
4
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
5
5
|
createGenerator: (source) => {
|
package/dist/presets/shared.d.ts
CHANGED
|
@@ -7,4 +7,8 @@ export interface BasePresetOptions extends Omit<Partial<UserDefinedOptions>, 'cs
|
|
|
7
7
|
rawOptions?: UserDefinedOptions;
|
|
8
8
|
}
|
|
9
9
|
export declare function normalizeCssEntries(entries?: string | string[]): string[] | undefined;
|
|
10
|
+
export declare function shouldEnableWebCompatFromEnv(): boolean;
|
|
11
|
+
export declare function withWebCompatGeneratorDefaults<T extends {
|
|
12
|
+
generator?: UserDefinedOptions['generator'];
|
|
13
|
+
}>(options: T, enabled?: boolean): T;
|
|
10
14
|
export declare function createBasePreset(options?: BasePresetOptions): Partial<UserDefinedOptions>;
|
package/dist/presets.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
3
|
+
const require_framework = require("./framework.js");
|
|
4
|
+
const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
|
|
5
|
+
require("./utils-D3h8j7Mk.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-D2xs4OEu.js");
|
|
6
7
|
require("./logger-TlKT3xmR.js");
|
|
7
8
|
let node_path = require("node:path");
|
|
8
|
-
node_path =
|
|
9
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
10
|
let node_process = require("node:process");
|
|
10
|
-
node_process =
|
|
11
|
+
node_process = require_rolldown_runtime.__toESM(node_process);
|
|
11
12
|
let local_pkg = require("local-pkg");
|
|
12
13
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
13
14
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
@@ -17,6 +18,20 @@ function normalizeCssEntries(entries) {
|
|
|
17
18
|
const normalized = Array.isArray(entries) ? entries : [entries];
|
|
18
19
|
return normalized.length > 0 ? normalized : void 0;
|
|
19
20
|
}
|
|
21
|
+
function shouldEnableWebCompatFromEnv() {
|
|
22
|
+
const { uniPlatform, uniUtsPlatform } = require_framework.resolveUniPlatformsFromEnv();
|
|
23
|
+
return uniPlatform.isWeb || uniUtsPlatform.isWeb || require_framework.resolveTaroPlatform().isWeb;
|
|
24
|
+
}
|
|
25
|
+
function withWebCompatGeneratorDefaults(options, enabled = shouldEnableWebCompatFromEnv()) {
|
|
26
|
+
if (!enabled) return options;
|
|
27
|
+
return {
|
|
28
|
+
...options,
|
|
29
|
+
generator: (0, _weapp_tailwindcss_shared.defuOverrideArray)(options.generator ?? {}, {
|
|
30
|
+
target: "web",
|
|
31
|
+
webCompat: true
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
}
|
|
20
35
|
function createBasePreset(options = {}) {
|
|
21
36
|
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
22
37
|
const baseDir = require_tailwindcss.resolveTailwindcssBasedir(base);
|
|
@@ -42,16 +57,16 @@ function createBasePreset(options = {}) {
|
|
|
42
57
|
//#endregion
|
|
43
58
|
//#region src/presets/hbuilderx.ts
|
|
44
59
|
function hbuilderx(options = {}) {
|
|
45
|
-
return createBasePreset({ ...options });
|
|
60
|
+
return createBasePreset(withWebCompatGeneratorDefaults({ ...options }));
|
|
46
61
|
}
|
|
47
62
|
//#endregion
|
|
48
63
|
//#region src/presets/uni-app.ts
|
|
49
64
|
function uniApp(options = {}) {
|
|
50
65
|
const uniPlatform = node_process.default.env["UNI_PLATFORM"];
|
|
51
|
-
return createBasePreset({
|
|
52
|
-
disabled: uniPlatform === "
|
|
66
|
+
return createBasePreset(withWebCompatGeneratorDefaults({
|
|
67
|
+
disabled: uniPlatform === "app" || uniPlatform === "app-plus" ? true : void 0,
|
|
53
68
|
...options
|
|
54
|
-
});
|
|
69
|
+
}));
|
|
55
70
|
}
|
|
56
71
|
//#endregion
|
|
57
72
|
//#region src/tailwindcss/index.ts
|
|
@@ -64,7 +79,7 @@ function resolveTailwindResolveOptions(base, resolve) {
|
|
|
64
79
|
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
65
80
|
return {
|
|
66
81
|
...resolve ?? {},
|
|
67
|
-
paths: [
|
|
82
|
+
paths: [.../* @__PURE__ */ new Set([
|
|
68
83
|
node_path.default.join(base, "node_modules"),
|
|
69
84
|
base,
|
|
70
85
|
...currentPaths
|
|
@@ -84,10 +99,9 @@ function resolveInstalledTailwindDefaults(resolve) {
|
|
|
84
99
|
}
|
|
85
100
|
function uniAppX(options) {
|
|
86
101
|
_weapp_tailwindcss_logger.logger.info(`UNI_PLATFORM: ${node_process.default.env["UNI_PLATFORM"]}`);
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const isApp = utsPlatform.isApp || uniPlatform.isApp;
|
|
102
|
+
const { uniPlatform, uniUtsPlatform } = require_framework.resolveUniPlatformsFromEnv();
|
|
103
|
+
_weapp_tailwindcss_logger.logger.info(`UNI_UTS_PLATFORM: ${uniUtsPlatform.raw ?? "undefined"}`);
|
|
104
|
+
const isApp = uniUtsPlatform.isApp || uniPlatform.isApp;
|
|
91
105
|
const cssEntries = normalizeCssEntries(options.cssEntries);
|
|
92
106
|
const resolvedResolve = resolveTailwindResolveOptions(options.base, options.resolve);
|
|
93
107
|
const installedTailwindDefaults = resolveInstalledTailwindDefaults(resolvedResolve);
|
|
@@ -100,7 +114,7 @@ function uniAppX(options) {
|
|
|
100
114
|
if (typeof options.uniAppX === "boolean") resolvedUniAppX.enabled = options.uniAppX;
|
|
101
115
|
return (0, _weapp_tailwindcss_shared.defuOverrideArray)(options.rawOptions ?? {}, {
|
|
102
116
|
uniAppX: resolvedUniAppX,
|
|
103
|
-
...options.generator !== void 0 ? { generator: options.generator } : {},
|
|
117
|
+
...withWebCompatGeneratorDefaults(options.generator !== void 0 ? { generator: options.generator } : {}),
|
|
104
118
|
rem2rpx: options.rem2rpx,
|
|
105
119
|
unitsToPx: options.unitsToPx,
|
|
106
120
|
unitConversion: options.unitConversion,
|
|
@@ -135,5 +149,7 @@ function uniAppX(options) {
|
|
|
135
149
|
exports.createBasePreset = createBasePreset;
|
|
136
150
|
exports.hbuilderx = hbuilderx;
|
|
137
151
|
exports.normalizeCssEntries = normalizeCssEntries;
|
|
152
|
+
exports.shouldEnableWebCompatFromEnv = shouldEnableWebCompatFromEnv;
|
|
138
153
|
exports.uniApp = uniApp;
|
|
139
154
|
exports.uniAppX = uniAppX;
|
|
155
|
+
exports.withWebCompatGeneratorDefaults = withWebCompatGeneratorDefaults;
|