weapp-tailwindcss 5.0.13 → 5.1.1
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.en.md +1 -1
- package/README.md +1 -1
- package/dist/auto-Ba6hDrse.mjs +13 -0
- package/dist/auto-DtU6f3X6.js +18 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/class-selectors.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +10 -6
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +0 -1
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +3 -3
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/types.d.ts +13 -1
- package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -1
- package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
- package/dist/bundlers/shared/run-tasks.d.ts +1 -0
- package/dist/bundlers/shared/v4-generation-core.d.ts +11 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- package/dist/bundlers/vite/css-memory.d.ts +16 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +0 -1
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +39 -0
- package/dist/bundlers/vite/generate-bundle/css-output.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +26 -0
- package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +21 -18
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +25 -0
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +3 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +15 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle.d.ts +2 -1
- package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +3 -3
- package/dist/bundlers/vite/plugin-cache.d.ts +15 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -4
- package/dist/bundlers/vite/source-candidates/script.d.ts +1 -7
- package/dist/bundlers/vite/source-candidates.d.ts +9 -2
- package/dist/bundlers/vite/source-scan/css-entries.d.ts +2 -6
- package/dist/bundlers/vite/source-scan.d.ts +2 -2
- package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
- package/dist/bundlers/vite/utils.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +26 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +34 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -11
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +37 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +199 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -2
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +10 -1
- package/dist/bundlers/webpack/shared/css-loader-runtime.d.ts +1 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cli/mount-options.d.ts +2 -2
- package/dist/cli.js +138 -444
- package/dist/cli.mjs +134 -440
- package/dist/context/index.d.ts +3 -3
- package/dist/context/style-options.d.ts +5 -1
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/{precheck-B0Z8yW7E.js → context-B6hVF7dr.js} +405 -156
- package/dist/{precheck-CRI90iL1.mjs → context-DlpKD7aN.mjs} +377 -141
- package/dist/core.js +15 -12
- package/dist/core.mjs +10 -7
- package/dist/css-macro/index.d.ts +3 -7
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{defaults-Bqx18S1f.mjs → defaults-BhE26nSw.mjs} +12 -13
- package/dist/{defaults-C_J_kBpw.js → defaults-CmFBmxsr.js} +11 -18
- package/dist/defaults.d.ts +2 -8
- package/dist/defaults.js +1 -2
- package/dist/defaults.mjs +2 -2
- package/dist/generator/index.d.ts +6 -7
- package/dist/generator/options.d.ts +3 -3
- package/dist/generator/types.d.ts +9 -10
- package/dist/generator-6oMJtTDO.js +170 -0
- package/dist/generator-CjzBK7h-.mjs +123 -0
- package/dist/generator.js +10 -16
- package/dist/generator.mjs +3 -3
- package/dist/{gulp-XT8Jc7lH.js → gulp-BtGq6LP9.js} +49 -87
- package/dist/{gulp-DfOQERcV.mjs → gulp-DNU10Vtc.mjs} +42 -80
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DQIP_8qP.mjs → hmr-timing-B0KuWDjV.mjs} +1197 -858
- package/dist/{hmr-timing-BMftW7Us.js → hmr-timing-CegXR9O4.js} +1356 -927
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/fast-path/oxc.d.ts +4 -0
- package/dist/js/precheck.d.ts +1 -0
- package/dist/postcss.js +3 -4
- package/dist/postcss.mjs +2 -3
- package/dist/presets.js +9 -19
- package/dist/presets.mjs +8 -18
- package/dist/runtime-branch/create-branch.d.ts +2 -0
- package/dist/runtime-branch/generator-target-env.d.ts +4 -0
- package/dist/runtime-branch/index.d.ts +6 -0
- package/dist/runtime-branch/mini-program.d.ts +2 -0
- package/dist/runtime-branch/native-app.d.ts +2 -0
- package/dist/runtime-branch/platform.d.ts +6 -0
- package/dist/runtime-branch/tailwind-version.d.ts +2 -0
- package/dist/runtime-branch/types.d.ts +37 -0
- package/dist/runtime-branch/web.d.ts +2 -0
- package/dist/runtime-branch.d.ts +1 -0
- package/dist/{bundle-state-zQ2MrDdi.mjs → source-candidate-scan-signature-B5af2Ahe.mjs} +187 -17
- package/dist/{bundle-state-CKWeTEhv.js → source-candidate-scan-signature-BKYb9jxa.js} +261 -19
- package/dist/tailwindcss/candidates.d.ts +7 -0
- package/dist/tailwindcss/index.d.ts +2 -2
- package/dist/tailwindcss/runtime/cache.d.ts +6 -6
- package/dist/tailwindcss/runtime-factory.d.ts +12 -0
- package/dist/tailwindcss/runtime-options.d.ts +8 -0
- package/dist/tailwindcss/runtime-types.d.ts +87 -0
- package/dist/tailwindcss/runtime.d.ts +6 -6
- package/dist/tailwindcss/source-scan.d.ts +1 -1
- package/dist/tailwindcss/targets.d.ts +2 -2
- package/dist/tailwindcss/v4/config.d.ts +3 -3
- package/dist/tailwindcss/v4/css-entries.d.ts +1 -0
- package/dist/tailwindcss/v4/css-sources.d.ts +4 -2
- package/dist/tailwindcss/v4/index.d.ts +1 -1
- package/dist/tailwindcss/v4/multi-runtime.d.ts +2 -0
- package/dist/tailwindcss/v4/runtime-factory.d.ts +15 -0
- package/dist/tailwindcss/v4/runtime-options.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +3 -3
- package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator.d.ts +10 -3
- package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +7 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +15 -7
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -10
- package/dist/tailwindcss/version.d.ts +1 -1
- package/dist/tailwindcss-B5mRo0-M.mjs +1423 -0
- package/dist/tailwindcss-dbrbY4cd.js +1528 -0
- package/dist/{transform-DfcEjsZF.mjs → transform-fRBeuuK-.mjs} +2 -2
- package/dist/{transform-YmrmxuF3.js → transform-vLwZpiTE.js} +17 -17
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +16 -17
- package/dist/types/shared.d.ts +1 -1
- package/dist/types/{typedoc-tailwindcss-patch.d.ts → typedoc-tailwindcss-runtime.d.ts} +4 -10
- package/dist/types/user-defined-options/general.d.ts +5 -3
- package/dist/types/user-defined-options/important.d.ts +2 -2
- package/dist/types/user-defined-options/matcher.d.ts +7 -0
- package/dist/uni-app-x/style-asset.d.ts +1 -0
- package/dist/v4-engine-C3qSwQ-e.mjs +2376 -0
- package/dist/v4-engine-ON_oSLfO.js +2752 -0
- package/dist/{vite-DjI09vVN.mjs → vite-CWRooooa.mjs} +1417 -540
- package/dist/{vite-CXHVsHmX.js → vite-w-RkgaTY.js} +1575 -698
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5665 -4443
- package/dist/weapp-tw-runtime-classset-loader.js +15 -4
- package/dist/webpack-8PaV1gG3.mjs +2334 -0
- package/dist/webpack-CGgBOx9l.js +2346 -0
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +6 -7
- package/dist/auto-CTp6wE5a.js +0 -33
- package/dist/auto-Cl8_hsG6.mjs +0 -22
- package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +0 -13
- package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +0 -1
- package/dist/context/tailwindcss/rax.d.ts +0 -2
- package/dist/generator-CzpArpCL.js +0 -92
- package/dist/generator-ITLd7PTl.mjs +0 -67
- package/dist/tailwindcss/patcher-options.d.ts +0 -8
- package/dist/tailwindcss/patcher.d.ts +0 -12
- package/dist/tailwindcss/runtime-patch.d.ts +0 -5
- package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +0 -3
- package/dist/tailwindcss/v3-engine/generator/content.d.ts +0 -10
- package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +0 -2
- package/dist/tailwindcss/v3-engine/generator.d.ts +0 -19
- package/dist/tailwindcss/v3-engine/index.d.ts +0 -4
- package/dist/tailwindcss/v3-engine/miniprogram.d.ts +0 -4
- package/dist/tailwindcss/v3-engine/source.d.ts +0 -5
- package/dist/tailwindcss/v3-engine/types.d.ts +0 -61
- package/dist/tailwindcss/v4/multi-patcher.d.ts +0 -2
- package/dist/tailwindcss/v4/patcher-options.d.ts +0 -2
- package/dist/tailwindcss/v4/patcher.d.ts +0 -15
- package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +0 -1
- package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +0 -1
- package/dist/tailwindcss-DTq3uYBK.mjs +0 -556
- package/dist/tailwindcss-DZEwT3C_.js +0 -613
- package/dist/v3-engine-2rrgylhn.js +0 -4686
- package/dist/v3-engine-C6eJ0YzK.mjs +0 -4272
- package/dist/webpack-BcPpnT90.mjs +0 -1184
- package/dist/webpack-CfkUkMXG.js +0 -1196
- /package/dist/tailwindcss/{patcher-resolve.d.ts → runtime-resolve.d.ts} +0 -0
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
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_gulp = require("./gulp-
|
|
3
|
+
const require_generator = require("./generator-6oMJtTDO.js");
|
|
4
|
+
const require_gulp = require("./gulp-BtGq6LP9.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-w-RkgaTY.js");
|
|
7
|
+
const require_webpack = require("./webpack-CGgBOx9l.js");
|
|
8
8
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
9
9
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
10
10
|
exports.createPlugins = require_gulp.createPlugins;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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-
|
|
2
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-CjzBK7h-.mjs";
|
|
3
|
+
import { t as createPlugins } from "./gulp-DNU10Vtc.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-CWRooooa.mjs";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-8PaV1gG3.mjs";
|
|
7
7
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
|
|
8
8
|
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IJsHandlerOptions, JsHandlerResult } from '../../types';
|
|
2
|
+
export declare function isOxcParserRuntimeSupported(version?: string): boolean;
|
|
3
|
+
export declare function canUseOxcJsFastPath(options: IJsHandlerOptions): boolean;
|
|
4
|
+
export declare function oxcJsHandler(rawSource: string, options: IJsHandlerOptions): JsHandlerResult | undefined;
|
package/dist/js/precheck.d.ts
CHANGED
package/dist/postcss.js
CHANGED
|
@@ -2,15 +2,14 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
const require_generator = require("./generator-
|
|
5
|
+
const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
|
|
6
|
+
const require_generator = require("./generator-6oMJtTDO.js");
|
|
7
7
|
const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss").createWeappTailwindcssPostcssPlugin)({
|
|
8
8
|
createGenerator: (source) => {
|
|
9
9
|
return require_generator.createWeappTailwindcssGenerator(source);
|
|
10
10
|
},
|
|
11
11
|
normalizeGeneratorOptions: (options) => require_generator.normalizeWeappTailwindcssGeneratorOptions(options),
|
|
12
|
-
|
|
13
|
-
resolveTailwindV4Source: (options) => require_v3_engine.resolveTailwindV4Source(options)
|
|
12
|
+
resolveTailwindV4Source: (options) => require_v4_engine.resolveTailwindV4Source(options)
|
|
14
13
|
});
|
|
15
14
|
//#endregion
|
|
16
15
|
exports.default = weappTailwindcssPostcssPlugin;
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { t as resolveTailwindV4Source } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-CjzBK7h-.mjs";
|
|
3
3
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
4
4
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
5
5
|
createGenerator: (source) => {
|
|
6
6
|
return createWeappTailwindcssGenerator(source);
|
|
7
7
|
},
|
|
8
8
|
normalizeGeneratorOptions: (options) => normalizeWeappTailwindcssGeneratorOptions(options),
|
|
9
|
-
resolveTailwindV3Source: (options) => resolveTailwindV3Source(options),
|
|
10
9
|
resolveTailwindV4Source: (options) => resolveTailwindV4Source(options)
|
|
11
10
|
});
|
|
12
11
|
//#endregion
|
package/dist/presets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
3
|
-
const
|
|
3
|
+
const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
|
|
4
4
|
const require_utils = require("./utils-BCa37Wqj.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
|
|
6
6
|
require("./logger-TlKT3xmR.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -21,19 +21,15 @@ function createBasePreset(options = {}) {
|
|
|
21
21
|
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
22
22
|
const baseDir = require_tailwindcss.resolveTailwindcssBasedir(base);
|
|
23
23
|
const normalizedCssEntries = normalizeCssEntries(cssEntries);
|
|
24
|
-
const tailwindConfig = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
base: baseDir,
|
|
29
|
-
cssEntries: normalizedCssEntries
|
|
30
|
-
})
|
|
31
|
-
};
|
|
24
|
+
const tailwindConfig = { v4: require_v4_engine.omitUndefined({
|
|
25
|
+
base: baseDir,
|
|
26
|
+
cssEntries: normalizedCssEntries
|
|
27
|
+
}) };
|
|
32
28
|
if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
|
|
33
29
|
const preset = {
|
|
34
30
|
tailwindcssBasedir: baseDir,
|
|
35
31
|
tailwindcss: tailwindConfig,
|
|
36
|
-
|
|
32
|
+
tailwindcssRuntimeOptions: {
|
|
37
33
|
projectRoot: baseDir,
|
|
38
34
|
tailwindcss: resolve ? {
|
|
39
35
|
...tailwindConfig,
|
|
@@ -85,11 +81,6 @@ function resolveInstalledTailwindDefaults(resolve) {
|
|
|
85
81
|
packageName: "tailwindcss",
|
|
86
82
|
postcssPlugin: "@tailwindcss/postcss"
|
|
87
83
|
};
|
|
88
|
-
if (major === 3) return {
|
|
89
|
-
version: 3,
|
|
90
|
-
packageName: "tailwindcss",
|
|
91
|
-
postcssPlugin: "tailwindcss"
|
|
92
|
-
};
|
|
93
84
|
}
|
|
94
85
|
function uniAppX(options) {
|
|
95
86
|
_weapp_tailwindcss_logger.logger.info(`UNI_PLATFORM: ${node_process.default.env["UNI_PLATFORM"]}`);
|
|
@@ -115,14 +106,13 @@ function uniAppX(options) {
|
|
|
115
106
|
unitConversion: options.unitConversion,
|
|
116
107
|
appType: "uni-app-x",
|
|
117
108
|
tailwindcssBasedir: options.base,
|
|
118
|
-
|
|
109
|
+
tailwindcssRuntimeOptions: {
|
|
119
110
|
projectRoot: options.base,
|
|
120
111
|
tailwindcss: {
|
|
121
112
|
...installedTailwindDefaults ?? {},
|
|
122
113
|
cwd: options.base,
|
|
123
114
|
resolve: resolvedResolve,
|
|
124
|
-
|
|
125
|
-
v4: require_v3_engine.omitUndefined({
|
|
115
|
+
v4: require_v4_engine.omitUndefined({
|
|
126
116
|
base: options.base,
|
|
127
117
|
cssEntries
|
|
128
118
|
})
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { st as omitUndefined } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
2
|
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-B5mRo0-M.mjs";
|
|
4
4
|
import { t as logger } from "./logger-BNzxZbZj.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
@@ -15,19 +15,15 @@ function createBasePreset(options = {}) {
|
|
|
15
15
|
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
16
16
|
const baseDir = resolveTailwindcssBasedir(base);
|
|
17
17
|
const normalizedCssEntries = normalizeCssEntries(cssEntries);
|
|
18
|
-
const tailwindConfig = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
base: baseDir,
|
|
23
|
-
cssEntries: normalizedCssEntries
|
|
24
|
-
})
|
|
25
|
-
};
|
|
18
|
+
const tailwindConfig = { v4: omitUndefined({
|
|
19
|
+
base: baseDir,
|
|
20
|
+
cssEntries: normalizedCssEntries
|
|
21
|
+
}) };
|
|
26
22
|
if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
|
|
27
23
|
const preset = {
|
|
28
24
|
tailwindcssBasedir: baseDir,
|
|
29
25
|
tailwindcss: tailwindConfig,
|
|
30
|
-
|
|
26
|
+
tailwindcssRuntimeOptions: {
|
|
31
27
|
projectRoot: baseDir,
|
|
32
28
|
tailwindcss: resolve ? {
|
|
33
29
|
...tailwindConfig,
|
|
@@ -79,11 +75,6 @@ function resolveInstalledTailwindDefaults(resolve) {
|
|
|
79
75
|
packageName: "tailwindcss",
|
|
80
76
|
postcssPlugin: "@tailwindcss/postcss"
|
|
81
77
|
};
|
|
82
|
-
if (major === 3) return {
|
|
83
|
-
version: 3,
|
|
84
|
-
packageName: "tailwindcss",
|
|
85
|
-
postcssPlugin: "tailwindcss"
|
|
86
|
-
};
|
|
87
78
|
}
|
|
88
79
|
function uniAppX(options) {
|
|
89
80
|
logger.info(`UNI_PLATFORM: ${process.env["UNI_PLATFORM"]}`);
|
|
@@ -109,13 +100,12 @@ function uniAppX(options) {
|
|
|
109
100
|
unitConversion: options.unitConversion,
|
|
110
101
|
appType: "uni-app-x",
|
|
111
102
|
tailwindcssBasedir: options.base,
|
|
112
|
-
|
|
103
|
+
tailwindcssRuntimeOptions: {
|
|
113
104
|
projectRoot: options.base,
|
|
114
105
|
tailwindcss: {
|
|
115
106
|
...installedTailwindDefaults ?? {},
|
|
116
107
|
cwd: options.base,
|
|
117
108
|
resolve: resolvedResolve,
|
|
118
|
-
v3: { cwd: options.base },
|
|
119
109
|
v4: omitUndefined({
|
|
120
110
|
base: options.base,
|
|
121
111
|
cssEntries
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RuntimeBranch, RuntimeBranchBaseContext, RuntimePlatformFamily } from './types';
|
|
2
|
+
export declare function createRuntimeBranch(base: RuntimeBranchBaseContext, platformFamily: RuntimePlatformFamily, options: Pick<RuntimeBranch, 'platform'> & Partial<Pick<RuntimeBranch, 'nativeAppPlatform'>>): RuntimeBranch;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WeappTailwindcssGeneratorTarget } from './types';
|
|
2
|
+
export declare const generatorTargetEnvKeys: readonly ["UNI_PLATFORM", "UNI_UTS_PLATFORM", "MPX_CLI_MODE", "MPX_CURRENT_TARGET_MODE", "TARO_ENV", "WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
|
|
3
|
+
export declare function shouldUseWebGeneratorTargetFromEnv(): boolean;
|
|
4
|
+
export declare function inferGeneratorTargetFromEnv(): WeappTailwindcssGeneratorTarget;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RuntimeBranch, RuntimeBranchContext, RuntimeBranchGeneratorOptions } from './types';
|
|
2
|
+
export declare function resolveRuntimeBranch(context: RuntimeBranchContext): RuntimeBranch;
|
|
3
|
+
export declare function resolveGeneratorRuntimeBranch(options: RuntimeBranchGeneratorOptions, context?: Omit<RuntimeBranchContext, 'generatorTarget'>): RuntimeBranch;
|
|
4
|
+
export declare function shouldUseMiniProgramCssBranch(branch: RuntimeBranch): boolean;
|
|
5
|
+
export declare function shouldUseNativeAppCssBranch(branch: RuntimeBranch): boolean;
|
|
6
|
+
export type { NativeAppPlatform, RuntimeBranch, RuntimeBranchContext, RuntimeBranchGeneratorOptions, RuntimePlatformFamily, TailwindcssBranchVersion, } from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NativeAppPlatform, RuntimeBranchContext } from './types';
|
|
2
|
+
import type { UniUtsPlatformInfo } from '../utils';
|
|
3
|
+
export declare function isRuntimeUniAppXEnabled(value: RuntimeBranchContext['uniAppX']): boolean;
|
|
4
|
+
export declare function normalizeRuntimeUniUtsPlatform(value: RuntimeBranchContext['uniUtsPlatform']): UniUtsPlatformInfo;
|
|
5
|
+
export declare function resolveNativeAppPlatform(platform: UniUtsPlatformInfo): NativeAppPlatform;
|
|
6
|
+
export declare function resolveExplicitOrEnvPlatform(context: RuntimeBranchContext, uniUtsPlatform: UniUtsPlatformInfo): string | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { AppType } from '../types/shared';
|
|
3
|
+
import type { UniUtsPlatformInfo } from '../utils';
|
|
4
|
+
export type TailwindcssBranchVersion = 4;
|
|
5
|
+
export type RuntimePlatformFamily = 'web' | 'mini-program' | 'native-app';
|
|
6
|
+
export type NativeAppPlatform = 'android' | 'ios' | 'harmony' | 'unknown';
|
|
7
|
+
export type WeappTailwindcssGeneratorTarget = 'weapp' | 'web';
|
|
8
|
+
export interface RuntimeBranchContext {
|
|
9
|
+
appType?: AppType | undefined;
|
|
10
|
+
generatorTarget: WeappTailwindcssGeneratorTarget;
|
|
11
|
+
platform?: IStyleHandlerOptions['platform'] | undefined;
|
|
12
|
+
tailwindcssMajorVersion?: number | undefined;
|
|
13
|
+
uniAppX?: boolean | {
|
|
14
|
+
enabled?: boolean | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
uniUtsPlatform?: string | UniUtsPlatformInfo | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface RuntimeBranch {
|
|
19
|
+
tailwindcssVersion: TailwindcssBranchVersion;
|
|
20
|
+
generatorTarget: WeappTailwindcssGeneratorTarget;
|
|
21
|
+
platformFamily: RuntimePlatformFamily;
|
|
22
|
+
platform: string | undefined;
|
|
23
|
+
nativeAppPlatform?: NativeAppPlatform | undefined;
|
|
24
|
+
isTailwindV4: boolean;
|
|
25
|
+
isWeb: boolean;
|
|
26
|
+
isMiniProgram: boolean;
|
|
27
|
+
isNativeApp: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface RuntimeBranchGeneratorOptions {
|
|
30
|
+
target: WeappTailwindcssGeneratorTarget;
|
|
31
|
+
branch?: RuntimeBranch | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface RuntimeBranchBaseContext {
|
|
34
|
+
context: RuntimeBranchContext;
|
|
35
|
+
tailwindcssVersion: TailwindcssBranchVersion;
|
|
36
|
+
uniUtsPlatform: UniUtsPlatformInfo;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './runtime-branch/index';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as traverse, h as babelParse, o as Parser } from "./context-DlpKD7aN.mjs";
|
|
2
|
+
import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-B5mRo0-M.mjs";
|
|
3
|
+
import { u as generateCssByGenerator } from "./hmr-timing-B0KuWDjV.mjs";
|
|
2
4
|
import { createRequire } from "node:module";
|
|
3
5
|
import path from "node:path";
|
|
4
6
|
import process from "node:process";
|
|
@@ -77,10 +79,14 @@ function slash(p) {
|
|
|
77
79
|
return ensurePosix(p);
|
|
78
80
|
}
|
|
79
81
|
const isWindows = process.platform === "win32";
|
|
80
|
-
const cssLangRE = new RegExp(`\\.(css|less|sass|scss|styl|stylus|pcss|postcss)(
|
|
82
|
+
const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
|
|
83
|
+
const htmlLangRE = /\.html?(?:$|\?)/;
|
|
81
84
|
function isCSSRequest(request) {
|
|
82
85
|
return cssLangRE.test(request) || isSourceStyleRequest(request);
|
|
83
86
|
}
|
|
87
|
+
function isHTMLRequest(request) {
|
|
88
|
+
return htmlLangRE.test(request);
|
|
89
|
+
}
|
|
84
90
|
function normalizePath(id) {
|
|
85
91
|
return path.posix.normalize(isWindows ? ensurePosix(id) : id);
|
|
86
92
|
}
|
|
@@ -116,9 +122,9 @@ function resolvePackageDir(name) {
|
|
|
116
122
|
}
|
|
117
123
|
//#endregion
|
|
118
124
|
//#region src/bundlers/shared/generated-css-marker.ts
|
|
119
|
-
const BUNDLER_GENERATED_CSS_MARKER_RE =
|
|
120
|
-
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE =
|
|
121
|
-
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE =
|
|
125
|
+
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
|
|
126
|
+
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
127
|
+
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
122
128
|
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
123
129
|
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
124
130
|
}
|
|
@@ -147,6 +153,25 @@ function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
|
147
153
|
return blocks;
|
|
148
154
|
}
|
|
149
155
|
//#endregion
|
|
156
|
+
//#region src/bundlers/shared/v4-generation-core.ts
|
|
157
|
+
async function generateTailwindV4Css(options) {
|
|
158
|
+
const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
|
|
159
|
+
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
160
|
+
const generated = await generateCssByGenerator(options);
|
|
161
|
+
if (!generated) return;
|
|
162
|
+
return {
|
|
163
|
+
...generated,
|
|
164
|
+
classSet: generated.classSet,
|
|
165
|
+
dependencies: generated.dependencies,
|
|
166
|
+
metadata: {
|
|
167
|
+
file: options.file,
|
|
168
|
+
majorVersion,
|
|
169
|
+
outputFile: options.outputFile,
|
|
170
|
+
...generated.metadata ?? {}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
150
175
|
//#region src/bundlers/vite/bundle-entries.ts
|
|
151
176
|
function readOutputEntry(entry) {
|
|
152
177
|
if (entry.output.type === "chunk") return entry.output.code;
|
|
@@ -200,6 +225,8 @@ const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
|
200
225
|
const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
|
|
201
226
|
const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
|
|
202
227
|
const CSS_WHITESPACE_RE = /\s+/g;
|
|
228
|
+
const JS_RUNTIME_AFFECTING_TEXT_HINT_RE = /["'`/]/;
|
|
229
|
+
const JS_INCOMPLETE_TRAILING_OPERATOR_RE = /(?:=>|[=+\-*%&|^!~?:,.({[\]])\s*$/;
|
|
203
230
|
function createHtmlRuntimeAffectingSignature(source) {
|
|
204
231
|
try {
|
|
205
232
|
const parts = [];
|
|
@@ -223,9 +250,10 @@ function createHtmlRuntimeAffectingSignature(source) {
|
|
|
223
250
|
}
|
|
224
251
|
}
|
|
225
252
|
function createJsRuntimeAffectingSignature(source) {
|
|
253
|
+
if (!JS_RUNTIME_AFFECTING_TEXT_HINT_RE.test(source) && !JS_INCOMPLETE_TRAILING_OPERATOR_RE.test(source)) return "";
|
|
226
254
|
try {
|
|
227
255
|
const ast = babelParse(source, {
|
|
228
|
-
cache:
|
|
256
|
+
cache: false,
|
|
229
257
|
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
230
258
|
plugins: ["jsx", "typescript"],
|
|
231
259
|
sourceType: "unambiguous"
|
|
@@ -295,8 +323,8 @@ function readEntrySource(output) {
|
|
|
295
323
|
return output.source.toString();
|
|
296
324
|
}
|
|
297
325
|
function classifyBundleEntry(file, opts) {
|
|
326
|
+
if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
|
|
298
327
|
if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
|
|
299
|
-
if (opts.htmlMatcher(file)) return "html";
|
|
300
328
|
if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
|
|
301
329
|
return "other";
|
|
302
330
|
}
|
|
@@ -331,12 +359,12 @@ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false, opti
|
|
|
331
359
|
sourceHashByFile.set(file, hash);
|
|
332
360
|
const previousHash = state.sourceHashByFile.get(file);
|
|
333
361
|
const changed = previousHash == null || previousHash !== hash;
|
|
334
|
-
const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
|
|
335
362
|
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
363
|
+
const runtimeAffectingHash = !changed && previousRuntimeAffectingHash != null ? previousRuntimeAffectingHash : (() => {
|
|
364
|
+
const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
|
|
365
|
+
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
366
|
+
return opts.cache.computeHash(runtimeAffectingSignature);
|
|
367
|
+
})();
|
|
340
368
|
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
341
369
|
if (changed) changedByType[type].add(file);
|
|
342
370
|
if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
|
|
@@ -389,14 +417,156 @@ function invertLinkedByEntry(linkedByEntry) {
|
|
|
389
417
|
}
|
|
390
418
|
return dependentsByLinkedFile;
|
|
391
419
|
}
|
|
420
|
+
function replaceMapEntries(target, source) {
|
|
421
|
+
target.clear();
|
|
422
|
+
for (const [key, value] of source) target.set(key, value);
|
|
423
|
+
return target;
|
|
424
|
+
}
|
|
425
|
+
function mergeMapEntries(target, source) {
|
|
426
|
+
for (const [key, value] of source) target.set(key, value);
|
|
427
|
+
return target;
|
|
428
|
+
}
|
|
392
429
|
function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
393
430
|
const incremental = options.incremental === true;
|
|
394
431
|
state.iteration += 1;
|
|
395
|
-
state.sourceHashByFile = incremental ?
|
|
396
|
-
state.runtimeAffectingSignatureByFile
|
|
397
|
-
state.runtimeAffectingHashByFile = incremental ?
|
|
398
|
-
state.linkedByEntry = incremental ?
|
|
432
|
+
state.sourceHashByFile = incremental ? mergeMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile) : replaceMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile);
|
|
433
|
+
state.runtimeAffectingSignatureByFile.clear();
|
|
434
|
+
state.runtimeAffectingHashByFile = incremental ? mergeMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile) : replaceMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile);
|
|
435
|
+
state.linkedByEntry = incremental ? mergeMapEntries(state.linkedByEntry, linkedByEntry) : replaceMapEntries(state.linkedByEntry, linkedByEntry);
|
|
399
436
|
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
400
437
|
}
|
|
401
438
|
//#endregion
|
|
402
|
-
|
|
439
|
+
//#region src/bundlers/vite/generate-bundle/signatures.ts
|
|
440
|
+
function summarizeStringDiff(previous, next) {
|
|
441
|
+
if (previous === next) return "same";
|
|
442
|
+
const previousLength = previous.length;
|
|
443
|
+
const nextLength = next.length;
|
|
444
|
+
const minLength = Math.min(previousLength, nextLength);
|
|
445
|
+
let prefixLength = 0;
|
|
446
|
+
while (prefixLength < minLength && previous.charCodeAt(prefixLength) === next.charCodeAt(prefixLength)) prefixLength += 1;
|
|
447
|
+
let previousSuffixCursor = previousLength - 1;
|
|
448
|
+
let nextSuffixCursor = nextLength - 1;
|
|
449
|
+
while (previousSuffixCursor >= prefixLength && nextSuffixCursor >= prefixLength && previous.charCodeAt(previousSuffixCursor) === next.charCodeAt(nextSuffixCursor)) {
|
|
450
|
+
previousSuffixCursor -= 1;
|
|
451
|
+
nextSuffixCursor -= 1;
|
|
452
|
+
}
|
|
453
|
+
const previousChangedLength = previousSuffixCursor >= prefixLength ? previousSuffixCursor - prefixLength + 1 : 0;
|
|
454
|
+
const nextChangedLength = nextSuffixCursor >= prefixLength ? nextSuffixCursor - prefixLength + 1 : 0;
|
|
455
|
+
return `changed@${prefixLength} old=${previousChangedLength} new=${nextChangedLength} len=${previousLength}->${nextLength}`;
|
|
456
|
+
}
|
|
457
|
+
function createLinkedImpactSignature(entry, linkedImpactsByEntry, sourceHashByFile) {
|
|
458
|
+
const changedLinkedFiles = linkedImpactsByEntry.get(entry);
|
|
459
|
+
if (!changedLinkedFiles || changedLinkedFiles.size === 0) return;
|
|
460
|
+
return [...changedLinkedFiles].sort().map((file) => {
|
|
461
|
+
return `${file}:${sourceHashByFile.get(file) ?? "missing"}`;
|
|
462
|
+
}).join(",");
|
|
463
|
+
}
|
|
464
|
+
function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
465
|
+
if (!linkedImpactSignature) return runtimeSignature;
|
|
466
|
+
return `${runtimeSignature}:linked:${linkedImpactSignature}`;
|
|
467
|
+
}
|
|
468
|
+
function createStableTextSignature(input) {
|
|
469
|
+
let hash = 2166136261;
|
|
470
|
+
for (let i = 0; i < input.length; i++) {
|
|
471
|
+
hash ^= input.charCodeAt(i);
|
|
472
|
+
hash = Math.imul(hash, 16777619);
|
|
473
|
+
}
|
|
474
|
+
return (hash >>> 0).toString(36);
|
|
475
|
+
}
|
|
476
|
+
function createCandidateSignature(candidates) {
|
|
477
|
+
if (candidates.size === 0) return "empty";
|
|
478
|
+
return createStableTextSignature([...candidates].sort().join("\n"));
|
|
479
|
+
}
|
|
480
|
+
function getSnapshotHash(snapshotMap, file, fallback) {
|
|
481
|
+
return snapshotMap.get(file) ?? fallback;
|
|
482
|
+
}
|
|
483
|
+
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
484
|
+
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
485
|
+
}
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/bundlers/vite/generate-bundle/scoped-generator.ts
|
|
488
|
+
function hasOwnSourceDirectives(rawSource) {
|
|
489
|
+
return rawSource.includes("@source") || rawSource.includes("@config");
|
|
490
|
+
}
|
|
491
|
+
function createLocalSourceEntries(sourceFile) {
|
|
492
|
+
return [{
|
|
493
|
+
base: path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, ""))),
|
|
494
|
+
negated: false,
|
|
495
|
+
pattern: "**/*"
|
|
496
|
+
}];
|
|
497
|
+
}
|
|
498
|
+
function intersectCandidates(first, second) {
|
|
499
|
+
const scoped = /* @__PURE__ */ new Set();
|
|
500
|
+
const [small, large] = first.size <= second.size ? [first, second] : [second, first];
|
|
501
|
+
for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
|
|
502
|
+
return scoped;
|
|
503
|
+
}
|
|
504
|
+
function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
|
|
505
|
+
if (!hasOwnSourceDirectives(rawSource)) return {
|
|
506
|
+
entries: resolvedEntries,
|
|
507
|
+
localEntries: void 0
|
|
508
|
+
};
|
|
509
|
+
const localEntries = createLocalSourceEntries(sourceFile);
|
|
510
|
+
if (!resolvedEntries || resolvedEntries.length === 0) return {
|
|
511
|
+
entries: localEntries,
|
|
512
|
+
localEntries: void 0
|
|
513
|
+
};
|
|
514
|
+
return {
|
|
515
|
+
entries: resolvedEntries,
|
|
516
|
+
localEntries
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
|
|
520
|
+
if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
|
|
521
|
+
const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
|
|
522
|
+
if (entries === void 0) return fallbackSignature;
|
|
523
|
+
const scopedCandidates = getSourceCandidatesForEntries(entries);
|
|
524
|
+
const scopedSignature = createCandidateSignature(localEntries ? intersectCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries)) : scopedCandidates);
|
|
525
|
+
return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
|
|
526
|
+
}
|
|
527
|
+
async function createScopedGeneratorRuntime(options) {
|
|
528
|
+
const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
|
|
529
|
+
if (getSourceCandidatesForEntries && rawSource && sourceFile) {
|
|
530
|
+
const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
|
|
531
|
+
if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
|
|
532
|
+
const scopedCandidates = scopedSourceCandidateGetter?.(entries) ?? getSourceCandidatesForEntries(entries);
|
|
533
|
+
if (!localEntries) return scopedCandidates;
|
|
534
|
+
return intersectCandidates(scopedCandidates, scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries));
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
|
|
538
|
+
if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return scopedCandidates;
|
|
539
|
+
if (!shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions)) return fallbackRuntime;
|
|
540
|
+
return fallbackRuntime;
|
|
541
|
+
}
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/bundlers/vite/source-candidate-scan-signature.ts
|
|
544
|
+
function normalizeSignaturePath(value) {
|
|
545
|
+
return slash(path.resolve(value));
|
|
546
|
+
}
|
|
547
|
+
function serializeInlineCandidates(inlineCandidates) {
|
|
548
|
+
return {
|
|
549
|
+
excluded: [...inlineCandidates?.excluded ?? []].sort(),
|
|
550
|
+
included: [...inlineCandidates?.included ?? []].sort()
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function serializeSourceEntries(entries) {
|
|
554
|
+
return (entries ?? []).map((entry) => ({
|
|
555
|
+
base: normalizeSignaturePath(entry.base),
|
|
556
|
+
negated: entry.negated,
|
|
557
|
+
pattern: entry.pattern
|
|
558
|
+
})).sort((a, b) => `${a.base}\0${a.pattern}\0${a.negated}`.localeCompare(`${b.base}\0${b.pattern}\0${b.negated}`));
|
|
559
|
+
}
|
|
560
|
+
function createSourceCandidateScanSignature(input) {
|
|
561
|
+
return JSON.stringify({
|
|
562
|
+
inlineCandidates: serializeInlineCandidates(input.inlineCandidates),
|
|
563
|
+
outDir: input.outDir ? normalizeSignaturePath(input.outDir) : void 0,
|
|
564
|
+
roots: input.roots.map((root) => ({
|
|
565
|
+
entries: serializeSourceEntries(root.entries),
|
|
566
|
+
root: normalizeSignaturePath(root.root)
|
|
567
|
+
})),
|
|
568
|
+
scanAllSources: input.scanAllSources ?? false
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
//#endregion
|
|
572
|
+
export { isSourceStyleRequest as A, resolvePluginDisabledState as C, isHTMLRequest as D, isCSSRequest as E, normalizeOutputPathKey as M, resolveOutputSpecifier as N, normalizePath as O, toAbsoluteOutputPath as P, resolvePackageDir as S, formatPostcssSourceMap as T, generateTailwindV4Css as _, createJsHashSalt as a, parseBundlerGeneratedCssMarkerBlocks as b, hasRuntimeAffectingSourceChanges as c, classifyBundleEntry as d, createBundleBuildState as f, createBundleModuleGraphOptions as g, applyLinkedResults as h, createCandidateSignature as i, stripRequestQuery as j, slash as k, summarizeStringDiff as l, createRuntimeAffectingSourceSignature as m, createScopedGeneratorCandidateSignature as n, createLinkedImpactSignature as o, updateBundleBuildState as p, createScopedGeneratorRuntime as r, getSnapshotHash as s, createSourceCandidateScanSignature as t, buildBundleSnapshot as u, createBundlerGeneratedCssMarker as v, cleanUrl as w, stripBundlerGeneratedCssMarkers as x, hasBundlerGeneratedCssMarker as y };
|