weapp-tailwindcss 5.0.0-next.25 → 5.0.0-next.27
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-B11j1XiD.js → auto-DP-qtQzE.js} +5 -7
- package/dist/{auto-AduSz49t.mjs → auto-XyKTOP7B.mjs} +4 -6
- package/dist/{bundle-state-CBouNDzi.mjs → bundle-state-7DRnJcJp.mjs} +1 -2
- package/dist/{bundle-state-BY7PWHAc.js → bundle-state-Nn90UQDa.js} +3 -4
- package/dist/bundlers/vite/index.d.ts +5 -2
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/bundlers/vite/source-candidates.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/cli.js +9 -11
- package/dist/cli.mjs +9 -11
- package/dist/core.js +1 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +4 -4
- package/dist/css-macro.mjs +3 -3
- package/dist/{defaults-B-1EEhdL.mjs → defaults-8xrgzxFY.mjs} +1 -1
- package/dist/{defaults-C10hYUch.js → defaults-C5w9OOrj.js} +1 -2
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/{generator-CtqzN9L-.mjs → generator-CbpjNxJh.mjs} +1 -1
- package/dist/{generator-DTPePQZ9.js → generator-DRNbzjx5.js} +2 -2
- package/dist/generator.js +2 -3
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-CERcE0fP.js → incremental-runtime-class-set-BQPhkSov.js} +48 -14
- package/dist/{incremental-runtime-class-set-BlJ86j-A.mjs → incremental-runtime-class-set-C4JgSgRY.mjs} +48 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -6
- package/dist/index.mjs +5 -5
- package/dist/{postcss-BAO9tGi5.js → postcss-Br1eOaFd.js} +3 -3
- package/dist/{postcss-DYktK8_T.mjs → postcss-C7BMYpEF.mjs} +4 -4
- package/dist/{postcss-DXkxsPNg.js → postcss-CiYLsqZn.js} +4 -4
- package/dist/{postcss-CYPHxj7a.mjs → postcss-YetooK6S.mjs} +2 -2
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-ezN3ovAq.js → precheck-B6xigu7s.js} +2005 -13
- package/dist/{precheck-B4CpMt_w.mjs → precheck-uG16Cqaj.mjs} +1998 -12
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets.js +19 -6
- package/dist/presets.mjs +17 -6
- package/dist/reset.js +1 -1
- package/dist/{source-candidates-DoyOltpZ.mjs → source-candidates-CX2ozpKM.mjs} +49 -7
- package/dist/{source-candidates-0jPRIPmC.js → source-candidates-DeK5b9i9.js} +50 -8
- package/dist/{tailwindcss-ujlr9Iad.mjs → tailwindcss-C7dJHZ0G.mjs} +2 -2
- package/dist/{tailwindcss-nQetCaPp.js → tailwindcss-DEEtJf4u.js} +3 -3
- package/dist/{utils-CSA174-I.js → utils-nta4tfFs.js} +1 -1
- package/dist/{v3-engine-Bbsrez2w.js → v3-engine-B_33V3Lu.js} +12 -4
- package/dist/{v3-engine-COw08vWd.mjs → v3-engine-DcvCCHfs.mjs} +11 -3
- package/dist/{vite-DE8Vfzal.js → vite-Bg18XZZc.js} +169 -22
- package/dist/{vite-hZsQAY1a.mjs → vite-DOmiMftw.mjs} +168 -21
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +53 -22
- package/dist/weapp-tw-runtime-classset-loader.js +1 -1
- package/dist/{webpack-c2WJnCJI.mjs → webpack-BdrjJf41.mjs} +17 -13
- package/dist/{webpack-CTJcw_sX.js → webpack-BzPDhzSz.js} +18 -14
- package/dist/webpack.d.ts +1 -3
- package/dist/webpack.js +3 -4
- package/dist/webpack.mjs +2 -2
- package/package.json +9 -7
- /package/dist/{chunk-8l464Juk.js → chunk-D6vf50IK.js} +0 -0
- /package/dist/{logger-Dr7IvyH2.mjs → logger-BNzxZbZj.mjs} +0 -0
- /package/dist/{logger-Cdzl3p8j.js → logger-TlKT3xmR.js} +0 -0
- /package/dist/{runtime-registry-CdCV3Opt.js → runtime-registry-DpcR3IHI.js} +0 -0
- /package/dist/{utils-B2SJgA1L.mjs → utils-DsaS975I.mjs} +0 -0
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_runtime_registry = require("./runtime-registry-
|
|
5
|
+
const require_runtime_registry = require("./runtime-registry-DpcR3IHI.js");
|
|
6
6
|
let node_buffer = require("node:buffer");
|
|
7
7
|
let node_process = require("node:process");
|
|
8
8
|
node_process = require_runtime_registry.__toESM(node_process);
|
|
@@ -11,11 +11,11 @@ let node_path = require("node:path");
|
|
|
11
11
|
node_path = require_runtime_registry.__toESM(node_path);
|
|
12
12
|
let node_util = require("node:util");
|
|
13
13
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
14
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
14
15
|
let node_fs = require("node:fs");
|
|
15
16
|
node_fs = require_runtime_registry.__toESM(node_fs);
|
|
16
17
|
let node_module = require("node:module");
|
|
17
18
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
18
|
-
let tailwindcss_patch = require("tailwindcss-patch");
|
|
19
19
|
let node_url = require("node:url");
|
|
20
20
|
let debug = require("debug");
|
|
21
21
|
debug = require_runtime_registry.__toESM(debug);
|
|
@@ -31,7 +31,6 @@ require("@babel/parser");
|
|
|
31
31
|
require("@babel/types");
|
|
32
32
|
require("@ast-core/escape");
|
|
33
33
|
require("@weapp-tailwindcss/shared/extractors");
|
|
34
|
-
require("htmlparser2");
|
|
35
34
|
//#region src/bundlers/shared/css-imports.ts
|
|
36
35
|
const tailwindcssImportRE = /^(?:tailwindcss|weapp-tailwindcss)(?:\/.*)?$/;
|
|
37
36
|
const tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])((?:tailwindcss|weapp-tailwindcss)(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
|
|
@@ -197,10 +196,10 @@ const creator = () => {
|
|
|
197
196
|
];
|
|
198
197
|
atRule.replaceWith(nextNodes);
|
|
199
198
|
startComment.raws.before = hasPreviousNode ? "\n" : "";
|
|
200
|
-
startComment.raws
|
|
199
|
+
startComment.raws["after"] = "\n";
|
|
201
200
|
if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
|
|
202
201
|
endComment.raws.before = "\n";
|
|
203
|
-
endComment.raws
|
|
202
|
+
endComment.raws["after"] = "\n";
|
|
204
203
|
const nextNode = endComment?.next();
|
|
205
204
|
if (nextNode) nextNode.raws.before = "\n";
|
|
206
205
|
}
|
|
@@ -235,10 +234,10 @@ const creator = () => {
|
|
|
235
234
|
if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
|
|
236
235
|
else parentRule.after(nextNodes);
|
|
237
236
|
startComment.raws.before = hasPreviousNode ? "\n" : "";
|
|
238
|
-
startComment.raws
|
|
237
|
+
startComment.raws["after"] = "\n";
|
|
239
238
|
conditionalRule.raws.before = "\n";
|
|
240
239
|
endComment.raws.before = "\n";
|
|
241
|
-
endComment.raws
|
|
240
|
+
endComment.raws["after"] = "\n";
|
|
242
241
|
const nextNode = endComment.next();
|
|
243
242
|
if (nextNode) nextNode.raws.before = "\n";
|
|
244
243
|
return true;
|
|
@@ -319,11 +318,9 @@ function withCssMacroPostcssPlugins(plugins) {
|
|
|
319
318
|
if (!plugins) return [macroPlugin];
|
|
320
319
|
if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
|
|
321
320
|
if (typeof plugins === "object") {
|
|
322
|
-
|
|
323
|
-
return
|
|
324
|
-
|
|
325
|
-
[CSS_MACRO_POSTCSS_PLUGIN_NAME]: macroPlugin
|
|
326
|
-
};
|
|
321
|
+
const values = Object.values(plugins).filter(Boolean);
|
|
322
|
+
if (values.some(isCssMacroPostcssPlugin)) return values;
|
|
323
|
+
return [...values, macroPlugin];
|
|
327
324
|
}
|
|
328
325
|
return [macroPlugin];
|
|
329
326
|
}
|
|
@@ -4618,6 +4615,16 @@ function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
|
|
|
4618
4615
|
function shouldIsolateMatchedCssSource(source, sourceEntries) {
|
|
4619
4616
|
return Boolean(source.__weappTailwindcssMeta?.matchedCssSourceFile && sourceEntries !== void 0);
|
|
4620
4617
|
}
|
|
4618
|
+
function shouldScanTailwindV4Sources(majorVersion, target, generatorRuntime, isolateCssSource) {
|
|
4619
|
+
if (majorVersion !== 4 || isolateCssSource) return false;
|
|
4620
|
+
return target === "web" || generatorRuntime.size === 0;
|
|
4621
|
+
}
|
|
4622
|
+
function shouldAppendWebBundleCssFallback(target, options) {
|
|
4623
|
+
return target === "web" && !options.hasMatchedCssSourceFile && !options.hasSourceDirectives;
|
|
4624
|
+
}
|
|
4625
|
+
function isEmptyCssSourceOrderParts(parts) {
|
|
4626
|
+
return parts.before.trim().length === 0 && parts.after.trim().length === 0;
|
|
4627
|
+
}
|
|
4621
4628
|
function resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorStyleOptions) {
|
|
4622
4629
|
const preflightStyleOptions = {
|
|
4623
4630
|
cssPreflight: opts.cssPreflight,
|
|
@@ -4757,9 +4764,11 @@ async function generateCssByGenerator(options) {
|
|
|
4757
4764
|
if (!SUPPORTED_GENERATOR_MAJOR_VERSIONS.has(majorVersion ?? 0) || !shouldGenerateCurrentCss || majorVersion === 3 && !hasSourceDirectives && !hasGeneratedCss && !hasGeneratedMarkers) return;
|
|
4758
4765
|
try {
|
|
4759
4766
|
await runtimeState.readyPromise;
|
|
4767
|
+
const currentCssCandidates = majorVersion === 4 ? await (0, tailwindcss_patch.extractSourceCandidates)(effectiveRawSource, "css") : [];
|
|
4768
|
+
const runtimeWithCurrentCss = currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
4760
4769
|
const sources = await resolveGeneratorSources(majorVersion, runtimeState, effectiveRawSource, file, cssHandlerOptions, generatorOptions, {
|
|
4761
4770
|
getSourceCandidatesForEntries,
|
|
4762
|
-
runtime
|
|
4771
|
+
runtime: runtimeWithCurrentCss
|
|
4763
4772
|
});
|
|
4764
4773
|
const generatorStyleOptions = resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorOptions.styleOptions);
|
|
4765
4774
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(sources);
|
|
@@ -4768,15 +4777,15 @@ async function generateCssByGenerator(options) {
|
|
|
4768
4777
|
const sourceEntries = getSourceCandidatesForEntries && majorVersion === 4 ? await resolveGeneratorSourceEntries(source, runtimeState) : void 0;
|
|
4769
4778
|
const scopedRuntime = sourceEntries ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
4770
4779
|
const isolateCssSource = shouldIsolateMatchedCssSource(source, sourceEntries);
|
|
4771
|
-
const sourceRuntime = scopedRuntime && (scopedRuntime.size > 0 || isolateCssSource) ? mergeScopedRuntimeWithCurrentRuntime(scopedRuntime,
|
|
4780
|
+
const sourceRuntime = scopedRuntime && (scopedRuntime.size > 0 || isolateCssSource) ? mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtimeWithCurrentCss, {
|
|
4772
4781
|
cssHandlerOptions,
|
|
4773
4782
|
isolateCssSource
|
|
4774
|
-
}) :
|
|
4783
|
+
}) : runtimeWithCurrentCss;
|
|
4775
4784
|
const generatorRuntime = majorVersion === 4 && generatorOptions.target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(sourceRuntime) : sourceRuntime;
|
|
4776
4785
|
return generator.generate({
|
|
4777
4786
|
candidates: generatorRuntime,
|
|
4778
4787
|
incrementalCache: majorVersion === 3 || majorVersion === 4,
|
|
4779
|
-
scanSources: majorVersion
|
|
4788
|
+
scanSources: shouldScanTailwindV4Sources(majorVersion, generatorOptions.target, generatorRuntime, isolateCssSource),
|
|
4780
4789
|
styleOptions: generatorStyleOptions,
|
|
4781
4790
|
tailwindcssV3Compatibility: generatorOptions.tailwindcssV3Compatibility,
|
|
4782
4791
|
target: generatorOptions.target
|
|
@@ -4822,6 +4831,13 @@ async function generateCssByGenerator(options) {
|
|
|
4822
4831
|
const beforeUserCss = await transformGeneratorUserCss(orderedExtraCss.before, userCssOptions);
|
|
4823
4832
|
const afterUserCss = await transformGeneratorUserCss(orderedExtraCss.after, userCssOptions);
|
|
4824
4833
|
css = createCssSourceOrderAppend(createCssSourceOrderAppend(beforeUserCss, css), afterUserCss);
|
|
4834
|
+
if (isEmptyCssSourceOrderParts(orderedExtraCss) && shouldAppendWebBundleCssFallback(generated.target, {
|
|
4835
|
+
hasSourceDirectives,
|
|
4836
|
+
hasMatchedCssSourceFile
|
|
4837
|
+
})) {
|
|
4838
|
+
const userCss = await transformGeneratorUserCss(effectiveRawSource, userCssOptions);
|
|
4839
|
+
css = createCssSourceOrderAppend(css, userCss);
|
|
4840
|
+
}
|
|
4825
4841
|
if (generated.target === "weapp") {
|
|
4826
4842
|
css = await appendLegacyCompatCss(css, effectiveRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
4827
4843
|
css = await appendLegacyContainerCompatCss(css, effectiveRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
@@ -4836,12 +4852,27 @@ async function generateCssByGenerator(options) {
|
|
|
4836
4852
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
4837
4853
|
let css = stripTailwindBanner(generated.css);
|
|
4838
4854
|
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css, effectiveRawSource);
|
|
4839
|
-
if (hasMatchedCssSourceFile || generated.target === "web")
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4855
|
+
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
4856
|
+
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
4857
|
+
hasSourceDirectives,
|
|
4858
|
+
hasMatchedCssSourceFile
|
|
4859
|
+
})) {
|
|
4860
|
+
const userCss = await transformGeneratorUserCss(effectiveRawSource, {
|
|
4861
|
+
generatorTarget: generated.target,
|
|
4862
|
+
generatorStyleOptions,
|
|
4863
|
+
cssUserHandlerOptions,
|
|
4864
|
+
styleHandler,
|
|
4865
|
+
importFallback: generatorOptions.importFallback
|
|
4866
|
+
});
|
|
4867
|
+
css = createCssSourceOrderAppend(css, userCss);
|
|
4868
|
+
}
|
|
4869
|
+
return {
|
|
4870
|
+
css: finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight),
|
|
4871
|
+
target: generated.target,
|
|
4872
|
+
source: "generator",
|
|
4873
|
+
dependencies: generated.dependencies
|
|
4874
|
+
};
|
|
4875
|
+
}
|
|
4845
4876
|
css = await appendLegacyCompatCss(css, effectiveRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
4846
4877
|
css = await appendLegacyContainerCompatCss(css, effectiveRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
4847
4878
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_runtime_registry = require("./runtime-registry-
|
|
1
|
+
const require_runtime_registry = require("./runtime-registry-DpcR3IHI.js");
|
|
2
2
|
let node_buffer = require("node:buffer");
|
|
3
3
|
let node_process = require("node:process");
|
|
4
4
|
node_process = require_runtime_registry.__toESM(node_process);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { B as createDebug, W as resolveTailwindcssOptions, l as getRuntimeClassSetSignature } from "./v3-engine-
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { B as createDebug, W as resolveTailwindcssOptions, l as getRuntimeClassSetSignature } from "./v3-engine-DcvCCHfs.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-CbpjNxJh.mjs";
|
|
3
|
+
import { i as generateCssByGenerator, o as processCachedTask, r as emitHmrTiming, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-C4JgSgRY.mjs";
|
|
4
|
+
import { b as refreshTailwindRuntimeState, d as _defineProperty, i as pluginName, n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-uG16Cqaj.mjs";
|
|
5
|
+
import { r as getGroupedEntries } from "./utils-DsaS975I.mjs";
|
|
6
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-C7dJHZ0G.mjs";
|
|
7
|
+
import { _ as stripRequestQuery, b as toAbsoluteOutputPath, d as resolvePluginDisabledState, g as isSourceStyleRequest, l as stripBundlerGeneratedCssMarkers, n as createBundleBuildState, o as pushConcurrentTaskFactories, r as updateBundleBuildState, t as buildBundleSnapshot, u as resolvePackageDir, y as resolveOutputSpecifier } from "./bundle-state-7DRnJcJp.mjs";
|
|
7
8
|
import Module, { createRequire } from "node:module";
|
|
8
9
|
import fs from "node:fs";
|
|
9
10
|
import path from "node:path";
|
|
@@ -267,6 +268,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
267
268
|
const { compiler, options: compilerOptions, appType, runtimeState, getRuntimeRefreshRequirement, refreshRuntimeMetadata, isWebpackProcessedCssAsset, consumeRuntimeRefreshRequirement, isWatchMode, runtimeClassSetManager, debug } = options;
|
|
268
269
|
const { Compilation, sources } = compiler.webpack;
|
|
269
270
|
const { ConcatSource } = sources;
|
|
271
|
+
const isWebGeneratorTarget = compilerOptions.generator?.target === "web";
|
|
270
272
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
271
273
|
const cssUserHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
272
274
|
const bundleBuildState = createBundleBuildState();
|
|
@@ -390,7 +392,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
390
392
|
const defaultTemplateHandlerOptions = { runtimeSet };
|
|
391
393
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
392
394
|
const tasks = [];
|
|
393
|
-
if (Array.isArray(groupedEntries.html)) for (const element of groupedEntries.html) {
|
|
395
|
+
if (!isWebGeneratorTarget && Array.isArray(groupedEntries.html)) for (const element of groupedEntries.html) {
|
|
394
396
|
const [file, originalSource] = element;
|
|
395
397
|
const rawSource = originalSource.source().toString();
|
|
396
398
|
const cacheKey = file;
|
|
@@ -417,7 +419,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
417
419
|
}));
|
|
418
420
|
}
|
|
419
421
|
const jsTaskFactories = [];
|
|
420
|
-
if (Array.isArray(groupedEntries.js)) for (const [file] of groupedEntries.js) {
|
|
422
|
+
if (!isWebGeneratorTarget && Array.isArray(groupedEntries.js)) for (const [file] of groupedEntries.js) {
|
|
421
423
|
const cacheKey = getCacheKey(file);
|
|
422
424
|
const asset = compilation.getAsset(file);
|
|
423
425
|
if (!asset) continue;
|
|
@@ -532,7 +534,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
532
534
|
});
|
|
533
535
|
}
|
|
534
536
|
//#endregion
|
|
535
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.
|
|
537
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.1_oxc-resolver@11.19.1_@emnapi+core@1.10.0_@emnapi+runtime@1.10.0__tsx@4.22_e88dc79be62bec44963bb28b0067a399/node_modules/tsdown/esm-shims.js
|
|
536
538
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
537
539
|
const getDirname = () => path.dirname(getFilename());
|
|
538
540
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -668,11 +670,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
668
670
|
const debug = createDebug();
|
|
669
671
|
const weappTailwindcssPackageDir = resolvePackageDir("weapp-tailwindcss");
|
|
670
672
|
/**
|
|
671
|
-
* @name
|
|
673
|
+
* @name WeappTailwindcss
|
|
672
674
|
* @description webpack5 核心转义插件
|
|
673
675
|
* @link https://tw.icebreaker.top/docs/intro
|
|
674
676
|
*/
|
|
675
|
-
var
|
|
677
|
+
var WeappTailwindcss = class {
|
|
676
678
|
constructor(options = {}) {
|
|
677
679
|
_defineProperty(this, "options", void 0);
|
|
678
680
|
_defineProperty(this, "appType", void 0);
|
|
@@ -688,7 +690,9 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
688
690
|
compiler.options = compiler.options || {};
|
|
689
691
|
const { disabled, onLoad, runtimeLoaderPath, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = this.options;
|
|
690
692
|
const disabledOptions = resolvePluginDisabledState(disabled);
|
|
691
|
-
const
|
|
693
|
+
const isTailwindcssV4 = (initialTwPatcher.majorVersion ?? 0) >= 4;
|
|
694
|
+
const generatorOptions = normalizeWeappTailwindcssGeneratorOptions(this.options.generator);
|
|
695
|
+
const shouldRewriteCssImports = isTailwindcssV4 || generatorOptions.target === "web";
|
|
692
696
|
const isMpxApp = isMpx(this.appType);
|
|
693
697
|
if (shouldRewriteCssImports) setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
|
|
694
698
|
if (disabledOptions.plugin) return;
|
|
@@ -833,4 +837,4 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
833
837
|
}
|
|
834
838
|
};
|
|
835
839
|
//#endregion
|
|
836
|
-
export { weappTailwindcssPackageDir as n,
|
|
840
|
+
export { weappTailwindcssPackageDir as n, WeappTailwindcss as t };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
1
|
+
const require_chunk = require("./chunk-D6vf50IK.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-B_33V3Lu.js");
|
|
3
|
+
const require_generator = require("./generator-DRNbzjx5.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-BQPhkSov.js");
|
|
5
|
+
const require_precheck = require("./precheck-B6xigu7s.js");
|
|
6
|
+
const require_utils = require("./utils-nta4tfFs.js");
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-DEEtJf4u.js");
|
|
8
|
+
const require_bundle_state = require("./bundle-state-Nn90UQDa.js");
|
|
8
9
|
let node_fs = require("node:fs");
|
|
9
10
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
11
|
let node_module = require("node:module");
|
|
@@ -271,6 +272,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
271
272
|
const { compiler, options: compilerOptions, appType, runtimeState, getRuntimeRefreshRequirement, refreshRuntimeMetadata, isWebpackProcessedCssAsset, consumeRuntimeRefreshRequirement, isWatchMode, runtimeClassSetManager, debug } = options;
|
|
272
273
|
const { Compilation, sources } = compiler.webpack;
|
|
273
274
|
const { ConcatSource } = sources;
|
|
275
|
+
const isWebGeneratorTarget = compilerOptions.generator?.target === "web";
|
|
274
276
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
275
277
|
const cssUserHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
276
278
|
const bundleBuildState = require_bundle_state.createBundleBuildState();
|
|
@@ -394,7 +396,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
394
396
|
const defaultTemplateHandlerOptions = { runtimeSet };
|
|
395
397
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
396
398
|
const tasks = [];
|
|
397
|
-
if (Array.isArray(groupedEntries.html)) for (const element of groupedEntries.html) {
|
|
399
|
+
if (!isWebGeneratorTarget && Array.isArray(groupedEntries.html)) for (const element of groupedEntries.html) {
|
|
398
400
|
const [file, originalSource] = element;
|
|
399
401
|
const rawSource = originalSource.source().toString();
|
|
400
402
|
const cacheKey = file;
|
|
@@ -421,7 +423,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
421
423
|
}));
|
|
422
424
|
}
|
|
423
425
|
const jsTaskFactories = [];
|
|
424
|
-
if (Array.isArray(groupedEntries.js)) for (const [file] of groupedEntries.js) {
|
|
426
|
+
if (!isWebGeneratorTarget && Array.isArray(groupedEntries.js)) for (const [file] of groupedEntries.js) {
|
|
425
427
|
const cacheKey = getCacheKey(file);
|
|
426
428
|
const asset = compilation.getAsset(file);
|
|
427
429
|
if (!asset) continue;
|
|
@@ -667,11 +669,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
667
669
|
const debug = require_v3_engine.createDebug();
|
|
668
670
|
const weappTailwindcssPackageDir = require_bundle_state.resolvePackageDir("weapp-tailwindcss");
|
|
669
671
|
/**
|
|
670
|
-
* @name
|
|
672
|
+
* @name WeappTailwindcss
|
|
671
673
|
* @description webpack5 核心转义插件
|
|
672
674
|
* @link https://tw.icebreaker.top/docs/intro
|
|
673
675
|
*/
|
|
674
|
-
var
|
|
676
|
+
var WeappTailwindcss = class {
|
|
675
677
|
constructor(options = {}) {
|
|
676
678
|
require_precheck._defineProperty(this, "options", void 0);
|
|
677
679
|
require_precheck._defineProperty(this, "appType", void 0);
|
|
@@ -687,7 +689,9 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
687
689
|
compiler.options = compiler.options || {};
|
|
688
690
|
const { disabled, onLoad, runtimeLoaderPath, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = this.options;
|
|
689
691
|
const disabledOptions = require_bundle_state.resolvePluginDisabledState(disabled);
|
|
690
|
-
const
|
|
692
|
+
const isTailwindcssV4 = (initialTwPatcher.majorVersion ?? 0) >= 4;
|
|
693
|
+
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(this.options.generator);
|
|
694
|
+
const shouldRewriteCssImports = isTailwindcssV4 || generatorOptions.target === "web";
|
|
691
695
|
const isMpxApp = isMpx(this.appType);
|
|
692
696
|
if (shouldRewriteCssImports) setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
|
|
693
697
|
if (disabledOptions.plugin) return;
|
|
@@ -832,10 +836,10 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
832
836
|
}
|
|
833
837
|
};
|
|
834
838
|
//#endregion
|
|
835
|
-
Object.defineProperty(exports, "
|
|
839
|
+
Object.defineProperty(exports, "WeappTailwindcss", {
|
|
836
840
|
enumerable: true,
|
|
837
841
|
get: function() {
|
|
838
|
-
return
|
|
842
|
+
return WeappTailwindcss;
|
|
839
843
|
}
|
|
840
844
|
});
|
|
841
845
|
Object.defineProperty(exports, "weappTailwindcssPackageDir", {
|
package/dist/webpack.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { UnifiedWebpackPluginV5 as WeappTailwindcss } from './bundlers/webpack/index';
|
|
3
|
-
export { UnifiedWebpackPluginV5 as weappTailwindcss } from './bundlers/webpack/index';
|
|
1
|
+
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss, weappTailwindcssPackageDir, } from './bundlers/webpack/index';
|
|
4
2
|
export type { UserDefinedOptions } from './types';
|
package/dist/webpack.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_webpack = require("./webpack-
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.weappTailwindcss = require_webpack.UnifiedWebpackPluginV5;
|
|
2
|
+
const require_webpack = require("./webpack-BzPDhzSz.js");
|
|
3
|
+
exports.WeappTailwindcss = require_webpack.WeappTailwindcss;
|
|
4
|
+
exports.weappTailwindcss = require_webpack.WeappTailwindcss;
|
|
6
5
|
exports.weappTailwindcssPackageDir = require_webpack.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, t as
|
|
2
|
-
export {
|
|
1
|
+
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-BdrjJf41.mjs";
|
|
2
|
+
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss, weappTailwindcssPackageDir };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.27",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -178,20 +178,22 @@
|
|
|
178
178
|
"comment-json": "^5.0.0",
|
|
179
179
|
"debug": "~4.4.3",
|
|
180
180
|
"fast-glob": "^3.3.3",
|
|
181
|
-
"htmlparser2": "12.0.0",
|
|
182
181
|
"local-pkg": "^1.2.1",
|
|
183
|
-
"lru-cache": "11.5.
|
|
182
|
+
"lru-cache": "11.5.1",
|
|
184
183
|
"magic-string": "0.30.21",
|
|
185
184
|
"micromatch": "^4.0.8",
|
|
186
185
|
"postcss-load-config": "^6.0.1",
|
|
187
186
|
"semver": "~7.8.1",
|
|
188
187
|
"tailwindcss-patch": "9.3.7",
|
|
189
188
|
"yaml": "^2.9.0",
|
|
190
|
-
"@weapp-tailwindcss/logger": "
|
|
191
|
-
"@weapp-tailwindcss/postcss": "3.0.0-next.7",
|
|
189
|
+
"@weapp-tailwindcss/logger": "2.0.0-next.0",
|
|
192
190
|
"@weapp-tailwindcss/reset": "0.1.1-next.1",
|
|
193
|
-
"@weapp-tailwindcss/
|
|
194
|
-
"tailwindcss
|
|
191
|
+
"@weapp-tailwindcss/postcss": "3.0.0-next.8",
|
|
192
|
+
"@weapp-tailwindcss/shared": "2.0.0-next.0",
|
|
193
|
+
"tailwindcss-config": "2.0.0-next.2"
|
|
194
|
+
},
|
|
195
|
+
"devDependencies": {
|
|
196
|
+
"htmlparser2": "12.0.0"
|
|
195
197
|
},
|
|
196
198
|
"scripts": {
|
|
197
199
|
"dev": "tsdown --watch --sourcemap",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|