weapp-tailwindcss 5.5.6 → 5.5.7
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-DtU6f3X6.cjs → auto-B1OyRrE8.cjs} +1 -1
- package/dist/{auto-2dg_uhEJ.js → auto-ENr4xzzw.js} +1 -1
- package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +1 -1
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -1
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
- package/dist/bundlers/shared/css-source-trace.d.ts +2 -5
- package/dist/bundlers/shared/final-css-cleanup.d.ts +1 -1
- package/dist/bundlers/shared/framework-css-composition.d.ts +1 -1
- package/dist/bundlers/shared/framework-postcss.d.ts +1 -25
- package/dist/bundlers/shared/framework-user-css.d.ts +1 -4
- package/dist/bundlers/shared/generated-css-marker.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/candidates.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/class-selectors.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/directives/fallback.d.ts +1 -11
- package/dist/bundlers/shared/generator-css/directives.d.ts +1 -25
- package/dist/bundlers/shared/generator-css/generation-helpers/preflight.d.ts +1 -19
- package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +1 -23
- package/dist/bundlers/shared/generator-css/generation-helpers/runtime-isolation.d.ts +1 -30
- package/dist/bundlers/shared/generator-css/generation-helpers/source-order.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +1 -12
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/markers.d.ts +1 -28
- package/dist/bundlers/shared/generator-css/output-import-shell.d.ts +1 -8
- package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +1 -60
- package/dist/bundlers/shared/generator-css/pipeline/deferred-output.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline/execution.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline/fallback-output.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline/ordered-output.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/pipeline.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/result-helpers.d.ts +1 -6
- package/dist/bundlers/shared/generator-css/scoped-rules.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -21
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +1 -13
- package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +1 -7
- package/dist/bundlers/shared/generator-css/source-resolver/configuration.d.ts +1 -33
- package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -28
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +1 -14
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-source.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/source-resolver/resolve-sources.d.ts +1 -5
- package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +1 -16
- package/dist/bundlers/shared/generator-css/source-resolver/source-entries.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/source-resolver/source-matching.d.ts +1 -5
- package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +1 -22
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -7
- package/dist/bundlers/shared/generator-css/types.d.ts +1 -64
- package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/user-css/at-rules.d.ts +1 -3
- package/dist/bundlers/shared/generator-css/user-css/compile-functions.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +1 -6
- package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +1 -15
- package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +1 -13
- package/dist/bundlers/shared/generator-css/user-css/user-layers.d.ts +1 -15
- package/dist/bundlers/shared/generator-css/user-css.d.ts +1 -5
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/validate.d.ts +1 -7
- package/dist/bundlers/shared/generator-css.d.ts +1 -9
- package/dist/bundlers/shared/run-tasks.d.ts +1 -3
- package/dist/bundlers/shared/runtime-class-set.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/collector.d.ts +1 -8
- package/dist/bundlers/shared/source-candidates/scan-root.d.ts +1 -12
- package/dist/bundlers/shared/source-candidates/script.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/snapshot.d.ts +1 -19
- package/dist/bundlers/shared/source-candidates/source-priority.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/store.d.ts +1 -2
- package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +1 -75
- package/dist/bundlers/shared/source-candidates/views.d.ts +1 -12
- package/dist/bundlers/shared/source-candidates.d.ts +1 -4
- package/dist/bundlers/shared/source-scan/css-entries.d.ts +1 -18
- package/dist/bundlers/shared/source-scan/dependencies.d.ts +1 -2
- package/dist/bundlers/shared/source-scan.d.ts +1 -16
- package/dist/bundlers/shared/static-config-content.d.ts +1 -5
- package/dist/bundlers/shared/style-handler-options.d.ts +1 -7
- package/dist/bundlers/shared/style-requests.d.ts +1 -5
- package/dist/bundlers/shared/v4-generation-core.d.ts +1 -20
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-transform-task.d.ts +2 -2
- package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +1 -12
- package/dist/bundlers/vite/processed-css-assets/injection-plan.d.ts +1 -4
- package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +4 -7
- package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +1 -13
- package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +2 -2
- package/dist/bundlers/vite/source-candidates/scan-root.d.ts +1 -1
- package/dist/bundlers/vite/source-candidates.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/finalize.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/generated-css.d.ts +2 -7
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/preflight-runtime.d.ts +4 -8
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/sources.d.ts +3 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css-markers.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css.d.ts +2 -7
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/watch-dependencies.d.ts +6 -0
- package/dist/cache/index.d.ts +4 -4
- package/dist/cache/source.d.ts +29 -0
- package/dist/{cache-CBJFB1HN.cjs → cache-CzvIGfwS.cjs} +1 -0
- package/dist/compiler/composition.d.ts +1 -1
- package/dist/compiler/runtime-affecting-signature/js.d.ts +1 -0
- package/dist/compiler/semantic-css.d.ts +1 -1
- package/dist/compiler/types.d.ts +1 -1
- package/dist/{compiler-D3GBwxoa.js → compiler-CThodfGH.js} +3098 -3067
- package/dist/{compiler-C8FqI-P3.cjs → compiler-DkGY5Nmh.cjs} +5011 -4980
- package/dist/core/compiler/generation-cache.d.ts +4 -2
- package/dist/core/compiler/types.d.ts +1 -1
- package/dist/core.cjs +7 -7
- package/dist/core.d.ts +2 -2
- package/dist/core.js +2 -2
- package/dist/css-cleanup-B6FUJC3z.cjs +1 -0
- package/dist/{css-imports-XvtI1zCY.cjs → css-imports-R_RDMjPz.cjs} +7 -21
- package/dist/css-macro/auto.d.ts +1 -1
- package/dist/css-macro/postcss.cjs +1 -1
- package/dist/css-macro.cjs +2 -2
- package/dist/css-macro.js +1 -1
- package/dist/final-css-cleanup-B6FUJC3z.cjs +1 -0
- package/dist/{final-css-cleanup-u_sI2p56.js → final-css-cleanup-BOzhuhGz.js} +3 -2
- package/dist/framework.cjs +1 -1
- package/dist/{v4-generation-core-Cz1D7wm1.cjs → generated-css-marker-jMNbQHpy.cjs} +638 -1546
- package/dist/generation/candidates.d.ts +1 -0
- package/dist/generation/class-selectors.d.ts +4 -0
- package/dist/generation/config-directive.d.ts +1 -0
- package/dist/generation/directives/fallback.d.ts +1 -0
- package/dist/generation/directives.d.ts +1 -0
- package/dist/generation/framework-css-composition.d.ts +1 -0
- package/dist/generation/framework-postcss.d.ts +25 -0
- package/dist/generation/framework-user-css.d.ts +5 -0
- package/dist/generation/generation-helpers/preflight.d.ts +19 -0
- package/dist/generation/generation-helpers/results.d.ts +23 -0
- package/dist/generation/generation-helpers/runtime-isolation.d.ts +30 -0
- package/dist/generation/generation-helpers/source-order.d.ts +1 -0
- package/dist/generation/generation-helpers.d.ts +4 -0
- package/dist/generation/index.d.ts +9 -0
- package/dist/generation/legacy-compat.d.ts +12 -0
- package/dist/generation/legacy-selectors.d.ts +1 -0
- package/dist/generation/legacy-units.d.ts +1 -0
- package/dist/generation/local-imports.d.ts +1 -0
- package/dist/generation/markers.d.ts +1 -0
- package/dist/generation/output-import-shell.d.ts +1 -0
- package/dist/generation/pipeline/context.d.ts +60 -0
- package/dist/generation/pipeline/deferred-output.d.ts +3 -0
- package/dist/generation/pipeline/execution.d.ts +3 -0
- package/dist/generation/pipeline/fallback-output.d.ts +3 -0
- package/dist/generation/pipeline/ordered-output.d.ts +3 -0
- package/dist/generation/pipeline/preparation.d.ts +19 -0
- package/dist/generation/pipeline.d.ts +2 -0
- package/dist/generation/result-helpers.d.ts +6 -0
- package/dist/generation/scoped-rules.d.ts +1 -0
- package/dist/generation/service.d.ts +20 -0
- package/dist/generation/source-files.d.ts +21 -0
- package/dist/generation/source-resolver/apply-reference.d.ts +10 -0
- package/dist/generation/source-resolver/config.d.ts +7 -0
- package/dist/generation/source-resolver/configuration.d.ts +33 -0
- package/dist/generation/source-resolver/matching.d.ts +3 -0
- package/dist/generation/source-resolver/metadata.d.ts +28 -0
- package/dist/generation/source-resolver/postcss-source.d.ts +14 -0
- package/dist/generation/source-resolver/resolve-source.d.ts +4 -0
- package/dist/generation/source-resolver/resolve-sources.d.ts +5 -0
- package/dist/generation/source-resolver/single-source.d.ts +16 -0
- package/dist/generation/source-resolver/source-entries.d.ts +3 -0
- package/dist/generation/source-resolver/source-matching.d.ts +5 -0
- package/dist/generation/source-resolver/types.d.ts +22 -0
- package/dist/generation/source-resolver.d.ts +7 -0
- package/dist/generation/style-options.d.ts +8 -0
- package/dist/generation/style-requests.d.ts +5 -0
- package/dist/generation/types.d.ts +65 -0
- package/dist/generation/user-css/apply-only.d.ts +5 -0
- package/dist/generation/user-css/at-rules.d.ts +1 -0
- package/dist/generation/user-css/compile-functions.d.ts +3 -0
- package/dist/generation/user-css/generated-cleanup.d.ts +1 -0
- package/dist/generation/user-css/source-fragments.d.ts +1 -0
- package/dist/generation/user-css/transform.d.ts +1 -0
- package/dist/generation/user-css/user-layers.d.ts +1 -0
- package/dist/generation/user-css.d.ts +5 -0
- package/dist/generation/user-layer-order.d.ts +1 -0
- package/dist/generation/validate.d.ts +7 -0
- package/dist/generator-CxauQbx3.cjs +1868 -0
- package/dist/generator-oKZ5mCJ5.js +1637 -0
- package/dist/generator.cjs +10 -4
- package/dist/generator.js +1 -1
- package/dist/{gulp-BExe5RBF.cjs → gulp-CVvBpIlq.cjs} +27 -26
- package/dist/{gulp-BhkIIk7J.js → gulp-DhddVxGA.js} +6 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-CoiJIqDu.cjs → hmr-timing-DfMbbZ1E.cjs} +13 -13
- package/dist/{hmr-timing-B9Yt86-U.js → hmr-timing-xPpat-km.js} +518 -1360
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/js/ModuleGraph.d.ts +3 -1
- package/dist/js/babel/analyze.d.ts +6 -0
- package/dist/js/babel.d.ts +1 -2
- package/dist/js/fast-path/analysis.d.ts +14 -0
- package/dist/js/fast-path/oxc.d.ts +1 -1
- package/dist/js/oxc-parser.d.ts +4 -0
- package/dist/pipeline-helpers-zMPmp5F3.cjs +516 -0
- package/dist/postcss-html-transform.cjs +1 -1
- package/dist/postcss.cjs +3 -2
- package/dist/postcss.d.ts +1 -1
- package/dist/postcss.js +3 -2
- package/dist/presets.cjs +3 -3
- package/dist/presets.js +2 -2
- package/dist/project-sources/candidates/collector.d.ts +8 -0
- package/dist/project-sources/candidates/scan-root.d.ts +12 -0
- package/dist/project-sources/candidates/script.d.ts +1 -0
- package/dist/project-sources/candidates/snapshot.d.ts +19 -0
- package/dist/project-sources/candidates/source-priority.d.ts +1 -0
- package/dist/project-sources/candidates/store.d.ts +2 -0
- package/dist/project-sources/candidates/types-and-cache.d.ts +75 -0
- package/dist/project-sources/candidates/views.d.ts +12 -0
- package/dist/project-sources/candidates.d.ts +4 -0
- package/dist/project-sources/css-entries.d.ts +18 -0
- package/dist/project-sources/dependencies.d.ts +2 -0
- package/dist/project-sources/index.d.ts +16 -0
- package/dist/project-sources/static-config-content.d.ts +5 -0
- package/dist/reset.cjs +1 -1
- package/dist/{rolldown-runtime-Ctb5zv51.cjs → rolldown-runtime-fg3euq-1.cjs} +7 -0
- package/dist/rspack.cjs +4 -4
- package/dist/rspack.js +2 -2
- package/dist/{runtime-state-XYSycuGu.cjs → runtime-state-BOzuVoKl.cjs} +1 -1
- package/dist/{scoped-generator-BUBls_oM.cjs → scoped-generator-BIZ7N_J-.cjs} +9 -9
- package/dist/{scoped-generator-B6Y1bxzM.js → scoped-generator-DlQrVbuC.js} +7 -6
- package/dist/{source-candidate-scan-signature-DNuGKTqf.js → source-candidate-scan-signature-BjVQYL-C.js} +3 -3
- package/dist/{source-candidate-scan-signature-BtJZp28T.cjs → source-candidate-scan-signature-nG-rg809.cjs} +4 -4
- package/dist/style-injector/internal.d.ts +35 -35
- package/dist/style-injector/options.d.ts +1 -1
- package/dist/tailwindcss/miniprogram.d.ts +1 -1
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -1
- package/dist/tailwindcss/source-scan/inline-source.d.ts +1 -7
- package/dist/tailwindcss/source-scan.d.ts +3 -32
- package/dist/tailwindcss/v4/css-sources.d.ts +1 -1
- package/dist/tailwindcss/v4/preflight.d.ts +1 -3
- package/dist/tailwindcss/v4/rpx-theme-warning.d.ts +4 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +2 -3
- package/dist/tailwindcss/v4-engine/generator/native-session.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +1 -6
- package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +5 -2
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +3 -7
- package/dist/tailwindcss/v4-engine/source.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/types.d.ts +3 -1
- package/dist/{tailwindcss-CBYjzRmV.cjs → tailwindcss-U3KIUegn.cjs} +65 -264
- package/dist/{tailwindcss-B_4E52WF.js → tailwindcss-kSd0ykiX.js} +71 -243
- package/dist/{transform-CkEnJYIP.js → transform-BAon9ykq.js} +25 -16
- package/dist/{transform-FkqbTBJR.cjs → transform-D2KFdA3C.cjs} +32 -23
- package/dist/types/index.d.ts +2 -2
- package/dist/types/user-defined-options/general.d.ts +1 -1
- package/dist/uni-app-x/border-preflight.d.ts +1 -1
- package/dist/uni-app-x/component-local-style.d.ts +3 -1
- package/dist/uni-app-x/vite/style-result.d.ts +1 -1
- package/dist/utils/run-tasks.d.ts +3 -0
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-DxuKPZlp.cjs → vite-BxW0qd7J.cjs} +217 -828
- package/dist/{vite-lP35OguX.js → vite-D-RGkmOE.js} +62 -674
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/{watch-dependencies-GbC14Rlt.cjs → watch-dependencies-C1so1whD.cjs} +14 -1
- package/dist/weapp-tw-css-generation-loader.cjs +4 -3
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +33 -28
- package/dist/weapp-tw-runtime-classset-loader.cjs +5 -18
- package/dist/{web-Dfz_jpNj.js → web--kA4HUTm.js} +16 -115
- package/dist/{web-DhDxhlkq.cjs → web-Y-H6I1k6.cjs} +83 -192
- package/dist/{webpack-D6jp1o3m.js → webpack-BB-kw4Qr.js} +27 -440
- package/dist/{webpack-R2Sbggiy.cjs → webpack-DxrWatNB.cjs} +87 -87
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +10 -5
- package/dist/final-css-cleanup-CDTmVAye.cjs +0 -1
- package/dist/generator-Bvr4WmuF.cjs +0 -3891
- package/dist/generator-C0BJjyLM.js +0 -3343
- package/dist/pipeline-helpers-BOjTEmMi.cjs +0 -971
|
@@ -1,108 +1,207 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
require("./auto-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
|
+
const require_generator = require("./generator-CxauQbx3.cjs");
|
|
3
|
+
require("./auto-B1OyRrE8.cjs");
|
|
4
|
+
const require_compiler = require("./compiler-DkGY5Nmh.cjs");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-U3KIUegn.cjs");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
9
9
|
let node_process = require("node:process");
|
|
10
10
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
11
|
-
let
|
|
12
|
-
let
|
|
11
|
+
let _weapp_tailwindcss_engine = require("@weapp-tailwindcss/engine");
|
|
12
|
+
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
13
13
|
let lru_cache = require("lru-cache");
|
|
14
|
+
let _weapp_tailwindcss_source_scan = require("@weapp-tailwindcss/source-scan");
|
|
14
15
|
let node_fs_promises = require("node:fs/promises");
|
|
16
|
+
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
15
17
|
let _weapp_core_escape = require("@weapp-core/escape");
|
|
16
18
|
let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
|
|
17
|
-
//#region src/
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
19
|
+
//#region src/compiler/mode.ts
|
|
20
|
+
const COMPILER_MODE_ENV = "WEAPP_TAILWINDCSS_COMPILER";
|
|
21
|
+
function resolveCompilerMode(env = node_process.default.env) {
|
|
22
|
+
const value = env[COMPILER_MODE_ENV];
|
|
23
|
+
return value === "legacy" || value === "shadow" || value === "graph" ? value : "graph";
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/compiler/semantic-css.ts
|
|
27
|
+
const defaultMaxDifferences = 50;
|
|
28
|
+
function isSemanticCssNode(node) {
|
|
29
|
+
return node !== void 0;
|
|
30
|
+
}
|
|
31
|
+
function normalizeNode(node) {
|
|
32
|
+
switch (node.type) {
|
|
33
|
+
case "comment": return;
|
|
34
|
+
case "decl": return {
|
|
35
|
+
type: "declaration",
|
|
36
|
+
property: node.prop,
|
|
37
|
+
value: node.value,
|
|
38
|
+
important: Boolean(node.important)
|
|
39
|
+
};
|
|
40
|
+
case "rule": return {
|
|
41
|
+
type: "rule",
|
|
42
|
+
selector: node.selector,
|
|
43
|
+
nodes: node.nodes.map(normalizeNode).filter(isSemanticCssNode)
|
|
44
|
+
};
|
|
45
|
+
case "atrule": return {
|
|
46
|
+
type: "at-rule",
|
|
47
|
+
name: node.name,
|
|
48
|
+
params: node.params,
|
|
49
|
+
nodes: node.nodes?.map(normalizeNode).filter(isSemanticCssNode) ?? []
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function createArtifactSemanticSummary(snapshot) {
|
|
54
|
+
return {
|
|
55
|
+
present: snapshot.present,
|
|
56
|
+
fragments: snapshot.fragments.length,
|
|
57
|
+
classes: snapshot.classSet.length,
|
|
58
|
+
rawCandidates: snapshot.rawCandidates.length,
|
|
59
|
+
dependencies: snapshot.dependencies.length,
|
|
60
|
+
sourceEntries: snapshot.sourceEntries.length
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function isRecord(value) {
|
|
64
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
65
|
+
}
|
|
66
|
+
function appendObjectPath(path, key) {
|
|
67
|
+
return /^[A-Z_$][\w$]*$/i.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
|
|
68
|
+
}
|
|
69
|
+
function compareSemanticValues(left, right, path, state) {
|
|
70
|
+
if (state.truncated || Object.is(left, right)) return;
|
|
71
|
+
if (left === void 0 || right === void 0) {
|
|
72
|
+
const value = left === void 0 ? right : left;
|
|
73
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
74
|
+
for (let index = 0; index < value.length; index++) {
|
|
75
|
+
compareSemanticValues(left === void 0 ? void 0 : value[index], right === void 0 ? void 0 : value[index], `${path}[${index}]`, state);
|
|
76
|
+
if (state.truncated) return;
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (isRecord(value) && Object.keys(value).length > 0) {
|
|
81
|
+
for (const key of Object.keys(value)) {
|
|
82
|
+
compareSemanticValues(left === void 0 ? void 0 : value[key], right === void 0 ? void 0 : value[key], appendObjectPath(path, key), state);
|
|
83
|
+
if (state.truncated) return;
|
|
84
|
+
}
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
} else if (Array.isArray(left) && Array.isArray(right)) {
|
|
88
|
+
const length = Math.max(left.length, right.length);
|
|
89
|
+
for (let index = 0; index < length; index++) {
|
|
90
|
+
compareSemanticValues(left[index], right[index], `${path}[${index}]`, state);
|
|
91
|
+
if (state.truncated) return;
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
} else if (isRecord(left) && isRecord(right)) {
|
|
95
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
96
|
+
for (const key of keys) {
|
|
97
|
+
compareSemanticValues(left[key], right[key], appendObjectPath(path, key), state);
|
|
98
|
+
if (state.truncated) return;
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
state.equal = false;
|
|
103
|
+
if (state.differences.length >= state.maxDifferences) {
|
|
104
|
+
state.truncated = true;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
state.differences.push({
|
|
108
|
+
kind: left === void 0 ? "added" : right === void 0 ? "removed" : "changed",
|
|
109
|
+
path,
|
|
110
|
+
...left === void 0 ? {} : { left },
|
|
111
|
+
...right === void 0 ? {} : { right }
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function normalizeCssRoot(root) {
|
|
115
|
+
return root.nodes.map(normalizeNode).filter(isSemanticCssNode);
|
|
116
|
+
}
|
|
117
|
+
function createArtifactSemanticSnapshot(artifact) {
|
|
118
|
+
if (artifact === void 0) return {
|
|
119
|
+
present: false,
|
|
120
|
+
fragments: [],
|
|
121
|
+
classSet: [],
|
|
122
|
+
rawCandidates: [],
|
|
123
|
+
dependencies: [],
|
|
124
|
+
sourceEntries: []
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
present: true,
|
|
128
|
+
fragments: [...artifact.fragments].sort((left, right) => left.order - right.order || left.id.localeCompare(right.id)).map((fragment) => ({
|
|
129
|
+
id: fragment.id,
|
|
130
|
+
kind: fragment.kind,
|
|
131
|
+
order: fragment.order,
|
|
132
|
+
scope: { ...fragment.scope },
|
|
133
|
+
sourceId: fragment.sourceId,
|
|
134
|
+
stage: fragment.stage,
|
|
135
|
+
root: normalizeCssRoot(fragment.root)
|
|
136
|
+
})),
|
|
137
|
+
classSet: [...artifact.classSet].sort(),
|
|
138
|
+
rawCandidates: [...artifact.rawCandidates].sort(),
|
|
139
|
+
dependencies: [...artifact.dependencies].sort(),
|
|
140
|
+
sourceEntries: [...artifact.sourceEntries].sort()
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function compareArtifactSemantics(left, right, options = {}) {
|
|
144
|
+
const leftSnapshot = createArtifactSemanticSnapshot(left);
|
|
145
|
+
const rightSnapshot = createArtifactSemanticSnapshot(right);
|
|
146
|
+
const state = {
|
|
147
|
+
differences: [],
|
|
148
|
+
equal: true,
|
|
149
|
+
maxDifferences: Math.max(0, Math.floor(options.maxDifferences ?? defaultMaxDifferences)),
|
|
150
|
+
truncated: false
|
|
151
|
+
};
|
|
152
|
+
compareSemanticValues(leftSnapshot, rightSnapshot, "$", state);
|
|
153
|
+
return {
|
|
154
|
+
equal: state.equal,
|
|
155
|
+
differences: state.differences,
|
|
156
|
+
truncated: state.truncated,
|
|
157
|
+
left: createArtifactSemanticSummary(leftSnapshot),
|
|
158
|
+
right: createArtifactSemanticSummary(rightSnapshot)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/compiler/shadow-report.ts
|
|
163
|
+
function createCompilerShadowReport(file, legacy, graph, options = {}) {
|
|
164
|
+
const comparison = compareArtifactSemantics(legacy, graph, options);
|
|
165
|
+
return {
|
|
166
|
+
file,
|
|
167
|
+
scopeId: options.scopeId ?? file,
|
|
168
|
+
equal: comparison.equal,
|
|
169
|
+
differences: comparison.differences,
|
|
170
|
+
truncated: comparison.truncated,
|
|
171
|
+
legacy: comparison.left,
|
|
172
|
+
graph: comparison.right
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/project-sources/candidates/scan-root.ts
|
|
61
177
|
function resolveOutDirIgnorePattern(root, outDir) {
|
|
62
178
|
if (!outDir) return;
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
179
|
+
const path = (0, _weapp_tailwindcss_source_scan.sourcePathApi)(root, outDir);
|
|
180
|
+
const relative = path.relative(root, path.resolve(root, outDir));
|
|
181
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) return;
|
|
182
|
+
return `${(0, require_tailwindcss.source_scan_exports.toPosixPath)(relative)}/**`;
|
|
66
183
|
}
|
|
67
184
|
function normalizeScanEntries(root, entries, outDirIgnore) {
|
|
68
|
-
|
|
69
|
-
|
|
185
|
+
if (!entries?.length && !outDirIgnore) return;
|
|
186
|
+
return (0, _weapp_tailwindcss_source_scan.createSourceScanPlan)({
|
|
70
187
|
base: root,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
negated: false
|
|
79
|
-
}], {
|
|
80
|
-
base: root,
|
|
81
|
-
pattern: outDirIgnore,
|
|
82
|
-
negated: true
|
|
83
|
-
}];
|
|
188
|
+
mode: "fallback",
|
|
189
|
+
entries: [...entries ?? [], ...outDirIgnore ? [{
|
|
190
|
+
base: root,
|
|
191
|
+
pattern: outDirIgnore,
|
|
192
|
+
negated: true
|
|
193
|
+
}] : []]
|
|
194
|
+
});
|
|
84
195
|
}
|
|
85
196
|
function shouldApplyDefaultIgnoredSources(entries) {
|
|
86
197
|
return entries?.length === void 0 ? false : entries.length > 0 && entries.every((entry) => entry.negated);
|
|
87
198
|
}
|
|
88
199
|
function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
89
|
-
return [...!explicit || shouldApplyDefaultIgnoredSources(entries) ?
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
})),
|
|
95
|
-
...TAILWIND_V4_IGNORED_EXTENSIONS.map((extension) => ({
|
|
96
|
-
base: root,
|
|
97
|
-
pattern: `**/*.${extension}`,
|
|
98
|
-
negated: true
|
|
99
|
-
})),
|
|
100
|
-
...TAILWIND_V4_IGNORED_FILES.map((pattern) => ({
|
|
101
|
-
base: root,
|
|
102
|
-
pattern: `**/${pattern}`,
|
|
103
|
-
negated: true
|
|
104
|
-
}))
|
|
105
|
-
] : [], ...outDirIgnore ? [{
|
|
200
|
+
return [...!explicit || shouldApplyDefaultIgnoredSources(entries) ? _weapp_tailwindcss_source_scan.CANDIDATE_SOURCE_IGNORED_PATTERNS.map((pattern) => ({
|
|
201
|
+
base: root,
|
|
202
|
+
pattern,
|
|
203
|
+
negated: true
|
|
204
|
+
})) : [], ...outDirIgnore ? [{
|
|
106
205
|
base: root,
|
|
107
206
|
pattern: outDirIgnore,
|
|
108
207
|
negated: true
|
|
@@ -110,33 +209,34 @@ function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
|
110
209
|
}
|
|
111
210
|
/** 创建与文件系统 root scan 一致的增量源码资格判断器。 */
|
|
112
211
|
function createSourceCandidateEligibilityMatcher(roots, eligibleFiles) {
|
|
113
|
-
const eligibleFileSet = eligibleFiles === void 0 ? void 0 : new Set([...eligibleFiles].map(
|
|
212
|
+
const eligibleFileSet = eligibleFiles === void 0 ? void 0 : new Set([...eligibleFiles].map(require_tailwindcss.source_scan_exports.resolveSourceScanPath));
|
|
114
213
|
const matchers = roots.map((options) => {
|
|
115
|
-
const root =
|
|
214
|
+
const root = (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(options.root);
|
|
116
215
|
const outDirIgnore = resolveOutDirIgnorePattern(root, options.outDir);
|
|
117
216
|
const entries = options.entries;
|
|
118
217
|
const explicit = options.explicit === true;
|
|
119
218
|
const hasPositiveEntry = entries?.some((entry) => !entry.negated) === true;
|
|
120
219
|
const ignoredSources = createDefaultIgnoredSources(root, outDirIgnore, entries, explicit);
|
|
121
220
|
return (resolvedFile) => {
|
|
122
|
-
if (explicit) return hasPositiveEntry &&
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
221
|
+
if (explicit) return hasPositiveEntry && (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(resolvedFile, entries);
|
|
222
|
+
const path = (0, _weapp_tailwindcss_source_scan.sourcePathApi)(root, resolvedFile);
|
|
223
|
+
const relative = path.relative(root, resolvedFile);
|
|
224
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) return false;
|
|
225
|
+
return (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(resolvedFile, entries) && !(0, require_tailwindcss.source_scan_exports.isFileExcludedByTailwindSourceEntries)(resolvedFile, ignoredSources) && (eligibleFileSet?.has(resolvedFile) ?? true);
|
|
126
226
|
};
|
|
127
227
|
});
|
|
128
228
|
return (file) => {
|
|
129
|
-
const resolvedFile =
|
|
229
|
+
const resolvedFile = (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(file);
|
|
130
230
|
return matchers.some((matches) => matches(resolvedFile));
|
|
131
231
|
};
|
|
132
232
|
}
|
|
133
233
|
function resolveSourceCandidateScanFiles(options) {
|
|
134
|
-
const resolvedRoot =
|
|
135
|
-
if (options.explicit && options.entries?.
|
|
234
|
+
const resolvedRoot = (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(options.root);
|
|
235
|
+
if (options.explicit && !options.entries?.some((entry) => !entry.negated)) return Promise.resolve([]);
|
|
136
236
|
const outDirIgnore = resolveOutDirIgnorePattern(resolvedRoot, options.outDir);
|
|
137
237
|
const scanEntries = normalizeScanEntries(resolvedRoot, options.entries, outDirIgnore);
|
|
138
238
|
const ignoredSources = createDefaultIgnoredSources(resolvedRoot, outDirIgnore, options.entries, options.explicit);
|
|
139
|
-
return (0,
|
|
239
|
+
return (0, _weapp_tailwindcss_engine.resolveProjectSourceFiles)({
|
|
140
240
|
cwd: resolvedRoot,
|
|
141
241
|
...scanEntries === void 0 ? {} : { sources: scanEntries },
|
|
142
242
|
...ignoredSources.length > 0 ? { ignoredSources } : {},
|
|
@@ -144,7 +244,7 @@ function resolveSourceCandidateScanFiles(options) {
|
|
|
144
244
|
});
|
|
145
245
|
}
|
|
146
246
|
//#endregion
|
|
147
|
-
//#region src/
|
|
247
|
+
//#region src/project-sources/candidates/source-priority.ts
|
|
148
248
|
function mergeSourcesByPriority(moduleSourceById, transformSourceById, cssSourceById, scanSourceById) {
|
|
149
249
|
const sources = /* @__PURE__ */ new Map();
|
|
150
250
|
for (const [id, source] of moduleSourceById) sources.set(id, source);
|
|
@@ -154,7 +254,7 @@ function mergeSourcesByPriority(moduleSourceById, transformSourceById, cssSource
|
|
|
154
254
|
return sources;
|
|
155
255
|
}
|
|
156
256
|
//#endregion
|
|
157
|
-
//#region src/
|
|
257
|
+
//#region src/project-sources/candidates/snapshot.ts
|
|
158
258
|
function createCandidateSnapshot(maps) {
|
|
159
259
|
return {
|
|
160
260
|
candidatesById: [...maps.candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
@@ -229,7 +329,7 @@ const TEMPLATE_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
229
329
|
"mpx"
|
|
230
330
|
]);
|
|
231
331
|
async function extractCandidatesFromSource(source, extension, options = {}) {
|
|
232
|
-
const candidates = options.extractor ? new Set(await options.extractor(source, extension)) : new Set(await (0,
|
|
332
|
+
const candidates = options.extractor ? new Set(await options.extractor(source, extension)) : new Set(await (0, _weapp_tailwindcss_engine.extractSourceCandidates)(source, extension, { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } }));
|
|
233
333
|
const scriptCandidates = await extractScriptStringCandidates(source, extension, options);
|
|
234
334
|
for (const candidate of scriptCandidates) candidates.add(candidate);
|
|
235
335
|
const templateAttributeCandidates = await extractTemplateAttributeCandidates(source, extension, options);
|
|
@@ -242,7 +342,7 @@ function isDefaultTemplateAttribute(name) {
|
|
|
242
342
|
return lowerName === "class" || lowerName === "hover-class" || lowerName === "virtualhostclass";
|
|
243
343
|
}
|
|
244
344
|
async function extractCandidateTokensFromTemplateAttributeValue(value, options) {
|
|
245
|
-
return options.extractor ? await options.extractor(value, "html") : await (0,
|
|
345
|
+
return options.extractor ? await options.extractor(value, "html") : await (0, _weapp_tailwindcss_engine.extractSourceCandidates)(value, "html", { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } });
|
|
246
346
|
}
|
|
247
347
|
async function extractTemplateAttributeCandidates(source, extension, options) {
|
|
248
348
|
if (!TEMPLATE_SOURCE_CANDIDATE_EXTENSIONS.has(extension)) return [];
|
|
@@ -298,17 +398,17 @@ async function extractScriptStringCandidates(source, extension, options) {
|
|
|
298
398
|
}
|
|
299
399
|
const candidates = /* @__PURE__ */ new Set();
|
|
300
400
|
for (const value of values) {
|
|
301
|
-
const extractedCandidates = options.extractor ? await options.extractor(value, "html") : await (0,
|
|
401
|
+
const extractedCandidates = options.extractor ? await options.extractor(value, "html") : await (0, _weapp_tailwindcss_engine.extractSourceCandidates)(value, "html", { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } });
|
|
302
402
|
for (const candidate of extractedCandidates) candidates.add(candidate);
|
|
303
403
|
}
|
|
304
404
|
return candidates;
|
|
305
405
|
}
|
|
306
406
|
//#endregion
|
|
307
|
-
//#region src/
|
|
407
|
+
//#region src/project-sources/candidates/types-and-cache.ts
|
|
308
408
|
const CLEAN_URL_RE = /[?#].*$/;
|
|
309
409
|
const sourceCandidateContentCache = new lru_cache.LRUCache({ max: 128 });
|
|
310
410
|
function cleanUrl(id) {
|
|
311
|
-
return
|
|
411
|
+
return (0, require_tailwindcss.source_scan_exports.resolveSourceScanPath)(id.replace(CLEAN_URL_RE, ""));
|
|
312
412
|
}
|
|
313
413
|
function resolveSourceCandidateExtension(id) {
|
|
314
414
|
const normalized = cleanUrl(id);
|
|
@@ -334,7 +434,7 @@ async function extractCandidates(source, extension, options) {
|
|
|
334
434
|
return extractCandidatesFromSource(source, extension, options);
|
|
335
435
|
}
|
|
336
436
|
function isSourceCandidateRequest(id) {
|
|
337
|
-
return
|
|
437
|
+
return require_tailwindcss.source_scan_exports.FULL_SOURCE_SCAN_EXTENSION_RE.test(cleanUrl(id));
|
|
338
438
|
}
|
|
339
439
|
function removeCandidateSet(candidateCount, candidates) {
|
|
340
440
|
for (const candidate of candidates) {
|
|
@@ -361,10 +461,10 @@ function diffCandidateSets(previous, next) {
|
|
|
361
461
|
};
|
|
362
462
|
}
|
|
363
463
|
//#endregion
|
|
364
|
-
//#region src/
|
|
464
|
+
//#region src/project-sources/candidates/views.ts
|
|
365
465
|
function isIncludedFile(id, isActiveModule, entries, excludeEntries) {
|
|
366
|
-
if (entries !== void 0 && (isActiveModule ?
|
|
367
|
-
return !(excludeEntries?.length &&
|
|
466
|
+
if (entries !== void 0 && (isActiveModule ? (0, require_tailwindcss.source_scan_exports.isFileExcludedByTailwindSourceEntries)(id, entries) : entries.length === 0 || !(0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(id, entries))) return false;
|
|
467
|
+
return !(excludeEntries?.length && (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(id, excludeEntries));
|
|
368
468
|
}
|
|
369
469
|
function collectCandidateValues(view, entries, excludeEntries) {
|
|
370
470
|
if (entries === void 0 && !excludeEntries?.length) {
|
|
@@ -401,7 +501,7 @@ function collectCandidateSources(view, entries, excludeEntries) {
|
|
|
401
501
|
return sources;
|
|
402
502
|
}
|
|
403
503
|
//#endregion
|
|
404
|
-
//#region src/
|
|
504
|
+
//#region src/project-sources/candidates/store.ts
|
|
405
505
|
const SOURCE_CANDIDATE_FILE_MEMO_MAX = 4096;
|
|
406
506
|
function areSetsEqual(left, right) {
|
|
407
507
|
if (!left || left.size !== right.size) return false;
|
|
@@ -527,7 +627,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
527
627
|
filter: isSourceCandidateRequest,
|
|
528
628
|
outDir,
|
|
529
629
|
root
|
|
530
|
-
})).map(
|
|
630
|
+
})).map(require_tailwindcss.source_scan_exports.resolveSourceScanPath);
|
|
531
631
|
}
|
|
532
632
|
async function scanRoot(options) {
|
|
533
633
|
const resolvedFiles = await resolveScanFiles(options);
|
|
@@ -737,204 +837,47 @@ function createSourceCandidateStore(options = {}) {
|
|
|
737
837
|
};
|
|
738
838
|
}
|
|
739
839
|
//#endregion
|
|
740
|
-
//#region src/
|
|
840
|
+
//#region src/project-sources/candidates/collector.ts
|
|
741
841
|
function createSourceCandidateCollector(options = {}) {
|
|
742
842
|
return createSourceCandidateStore(options);
|
|
743
843
|
}
|
|
744
844
|
//#endregion
|
|
745
|
-
//#region src/
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
845
|
+
//#region src/bundlers/shared/runtime-class-set/escaped-candidates.ts
|
|
846
|
+
const ESCAPED_CLASS_TOKEN_RE = /[\w-]+_[A-Z][\w-]*/gi;
|
|
847
|
+
const TAILWIND_RESTORED_CANDIDATE_SIGNAL_RE = /[[\]:/#!.]/;
|
|
848
|
+
const MAX_RESTORED_CANDIDATE_VARIANTS = 512;
|
|
849
|
+
const restoredCandidateCaches = /* @__PURE__ */ new WeakMap();
|
|
850
|
+
function hasBalancedCandidateDelimitersFallback(candidate) {
|
|
851
|
+
const stack = [];
|
|
852
|
+
let escaped = false;
|
|
853
|
+
let quote;
|
|
854
|
+
for (const char of candidate) {
|
|
855
|
+
if (escaped) {
|
|
856
|
+
escaped = false;
|
|
857
|
+
continue;
|
|
858
|
+
}
|
|
859
|
+
if (char === "\\") {
|
|
860
|
+
escaped = true;
|
|
861
|
+
continue;
|
|
862
|
+
}
|
|
863
|
+
if (quote) {
|
|
864
|
+
if (char === quote) quote = void 0;
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
if (char === "\"" || char === "'") {
|
|
868
|
+
quote = char;
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
if (char === "(" || char === "[" || char === "{") {
|
|
872
|
+
stack.push(char);
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
if (char === ")" || char === "]" || char === "}") {
|
|
876
|
+
const opening = stack.pop();
|
|
877
|
+
if (!opening || opening === "(" && char !== ")" || opening === "[" && char !== "]" || opening === "{" && char !== "}") return false;
|
|
878
|
+
}
|
|
777
879
|
}
|
|
778
|
-
|
|
779
|
-
function createArtifactSemanticSummary(snapshot) {
|
|
780
|
-
return {
|
|
781
|
-
present: snapshot.present,
|
|
782
|
-
fragments: snapshot.fragments.length,
|
|
783
|
-
classes: snapshot.classSet.length,
|
|
784
|
-
rawCandidates: snapshot.rawCandidates.length,
|
|
785
|
-
dependencies: snapshot.dependencies.length,
|
|
786
|
-
sourceEntries: snapshot.sourceEntries.length
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
function isRecord(value) {
|
|
790
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
791
|
-
}
|
|
792
|
-
function appendObjectPath(path, key) {
|
|
793
|
-
return /^[A-Z_$][\w$]*$/i.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
|
|
794
|
-
}
|
|
795
|
-
function compareSemanticValues(left, right, path, state) {
|
|
796
|
-
if (state.truncated || Object.is(left, right)) return;
|
|
797
|
-
if (left === void 0 || right === void 0) {
|
|
798
|
-
const value = left === void 0 ? right : left;
|
|
799
|
-
if (Array.isArray(value) && value.length > 0) {
|
|
800
|
-
for (let index = 0; index < value.length; index++) {
|
|
801
|
-
compareSemanticValues(left === void 0 ? void 0 : value[index], right === void 0 ? void 0 : value[index], `${path}[${index}]`, state);
|
|
802
|
-
if (state.truncated) return;
|
|
803
|
-
}
|
|
804
|
-
return;
|
|
805
|
-
}
|
|
806
|
-
if (isRecord(value) && Object.keys(value).length > 0) {
|
|
807
|
-
for (const key of Object.keys(value)) {
|
|
808
|
-
compareSemanticValues(left === void 0 ? void 0 : value[key], right === void 0 ? void 0 : value[key], appendObjectPath(path, key), state);
|
|
809
|
-
if (state.truncated) return;
|
|
810
|
-
}
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
} else if (Array.isArray(left) && Array.isArray(right)) {
|
|
814
|
-
const length = Math.max(left.length, right.length);
|
|
815
|
-
for (let index = 0; index < length; index++) {
|
|
816
|
-
compareSemanticValues(left[index], right[index], `${path}[${index}]`, state);
|
|
817
|
-
if (state.truncated) return;
|
|
818
|
-
}
|
|
819
|
-
return;
|
|
820
|
-
} else if (isRecord(left) && isRecord(right)) {
|
|
821
|
-
const keys = /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
822
|
-
for (const key of keys) {
|
|
823
|
-
compareSemanticValues(left[key], right[key], appendObjectPath(path, key), state);
|
|
824
|
-
if (state.truncated) return;
|
|
825
|
-
}
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
state.equal = false;
|
|
829
|
-
if (state.differences.length >= state.maxDifferences) {
|
|
830
|
-
state.truncated = true;
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
state.differences.push({
|
|
834
|
-
kind: left === void 0 ? "added" : right === void 0 ? "removed" : "changed",
|
|
835
|
-
path,
|
|
836
|
-
...left === void 0 ? {} : { left },
|
|
837
|
-
...right === void 0 ? {} : { right }
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
function normalizeCssRoot(root) {
|
|
841
|
-
return root.nodes.map(normalizeNode).filter(isSemanticCssNode);
|
|
842
|
-
}
|
|
843
|
-
function createArtifactSemanticSnapshot(artifact) {
|
|
844
|
-
if (artifact === void 0) return {
|
|
845
|
-
present: false,
|
|
846
|
-
fragments: [],
|
|
847
|
-
classSet: [],
|
|
848
|
-
rawCandidates: [],
|
|
849
|
-
dependencies: [],
|
|
850
|
-
sourceEntries: []
|
|
851
|
-
};
|
|
852
|
-
return {
|
|
853
|
-
present: true,
|
|
854
|
-
fragments: [...artifact.fragments].sort((left, right) => left.order - right.order || left.id.localeCompare(right.id)).map((fragment) => ({
|
|
855
|
-
id: fragment.id,
|
|
856
|
-
kind: fragment.kind,
|
|
857
|
-
order: fragment.order,
|
|
858
|
-
scope: { ...fragment.scope },
|
|
859
|
-
sourceId: fragment.sourceId,
|
|
860
|
-
stage: fragment.stage,
|
|
861
|
-
root: normalizeCssRoot(fragment.root)
|
|
862
|
-
})),
|
|
863
|
-
classSet: [...artifact.classSet].sort(),
|
|
864
|
-
rawCandidates: [...artifact.rawCandidates].sort(),
|
|
865
|
-
dependencies: [...artifact.dependencies].sort(),
|
|
866
|
-
sourceEntries: [...artifact.sourceEntries].sort()
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
function compareArtifactSemantics(left, right, options = {}) {
|
|
870
|
-
const leftSnapshot = createArtifactSemanticSnapshot(left);
|
|
871
|
-
const rightSnapshot = createArtifactSemanticSnapshot(right);
|
|
872
|
-
const state = {
|
|
873
|
-
differences: [],
|
|
874
|
-
equal: true,
|
|
875
|
-
maxDifferences: Math.max(0, Math.floor(options.maxDifferences ?? defaultMaxDifferences)),
|
|
876
|
-
truncated: false
|
|
877
|
-
};
|
|
878
|
-
compareSemanticValues(leftSnapshot, rightSnapshot, "$", state);
|
|
879
|
-
return {
|
|
880
|
-
equal: state.equal,
|
|
881
|
-
differences: state.differences,
|
|
882
|
-
truncated: state.truncated,
|
|
883
|
-
left: createArtifactSemanticSummary(leftSnapshot),
|
|
884
|
-
right: createArtifactSemanticSummary(rightSnapshot)
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
//#endregion
|
|
888
|
-
//#region src/compiler/shadow-report.ts
|
|
889
|
-
function createCompilerShadowReport(file, legacy, graph, options = {}) {
|
|
890
|
-
const comparison = compareArtifactSemantics(legacy, graph, options);
|
|
891
|
-
return {
|
|
892
|
-
file,
|
|
893
|
-
scopeId: options.scopeId ?? file,
|
|
894
|
-
equal: comparison.equal,
|
|
895
|
-
differences: comparison.differences,
|
|
896
|
-
truncated: comparison.truncated,
|
|
897
|
-
legacy: comparison.left,
|
|
898
|
-
graph: comparison.right
|
|
899
|
-
};
|
|
900
|
-
}
|
|
901
|
-
//#endregion
|
|
902
|
-
//#region src/bundlers/shared/runtime-class-set/escaped-candidates.ts
|
|
903
|
-
const ESCAPED_CLASS_TOKEN_RE = /[\w-]+_[A-Z][\w-]*/gi;
|
|
904
|
-
const TAILWIND_RESTORED_CANDIDATE_SIGNAL_RE = /[[\]:/#!.]/;
|
|
905
|
-
const MAX_RESTORED_CANDIDATE_VARIANTS = 512;
|
|
906
|
-
const restoredCandidateCaches = /* @__PURE__ */ new WeakMap();
|
|
907
|
-
function hasBalancedCandidateDelimitersFallback(candidate) {
|
|
908
|
-
const stack = [];
|
|
909
|
-
let escaped = false;
|
|
910
|
-
let quote;
|
|
911
|
-
for (const char of candidate) {
|
|
912
|
-
if (escaped) {
|
|
913
|
-
escaped = false;
|
|
914
|
-
continue;
|
|
915
|
-
}
|
|
916
|
-
if (char === "\\") {
|
|
917
|
-
escaped = true;
|
|
918
|
-
continue;
|
|
919
|
-
}
|
|
920
|
-
if (quote) {
|
|
921
|
-
if (char === quote) quote = void 0;
|
|
922
|
-
continue;
|
|
923
|
-
}
|
|
924
|
-
if (char === "\"" || char === "'") {
|
|
925
|
-
quote = char;
|
|
926
|
-
continue;
|
|
927
|
-
}
|
|
928
|
-
if (char === "(" || char === "[" || char === "{") {
|
|
929
|
-
stack.push(char);
|
|
930
|
-
continue;
|
|
931
|
-
}
|
|
932
|
-
if (char === ")" || char === "]" || char === "}") {
|
|
933
|
-
const opening = stack.pop();
|
|
934
|
-
if (!opening || opening === "(" && char !== ")" || opening === "[" && char !== "]" || opening === "{" && char !== "}") return false;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
return stack.length === 0 && quote === void 0 && !escaped;
|
|
880
|
+
return stack.length === 0 && quote === void 0 && !escaped;
|
|
938
881
|
}
|
|
939
882
|
function hasBalancedCandidateDelimiters(candidate) {
|
|
940
883
|
let delimiterStack = 0;
|
|
@@ -1062,143 +1005,28 @@ function collectStrictEscapedRuntimeCandidates(source, escapeMap, escapeFragment
|
|
|
1062
1005
|
return candidates;
|
|
1063
1006
|
}
|
|
1064
1007
|
//#endregion
|
|
1065
|
-
//#region src/
|
|
1066
|
-
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
return candidate.replace(/(?<!\\)\\:/g, ":").replace(/(?<!\\)\\\//g, "/");
|
|
1070
|
-
}
|
|
1071
|
-
function normalizeSourcePath(source, root) {
|
|
1072
|
-
const resolvedRoot = node_path.default.resolve(root);
|
|
1073
|
-
const resolvedSource = node_path.default.resolve(source);
|
|
1074
|
-
const relative = node_path.default.relative(resolvedRoot, resolvedSource);
|
|
1075
|
-
if (relative && !relative.startsWith("..") && !node_path.default.isAbsolute(relative)) return relative.split(node_path.default.sep).join("/");
|
|
1076
|
-
return source.split(node_path.default.sep).join("/");
|
|
1077
|
-
}
|
|
1078
|
-
function getSourceTraceRoot(opts) {
|
|
1079
|
-
const configured = opts.cssSourceTrace;
|
|
1080
|
-
if (configured && typeof configured === "object" && configured.root) return configured.root;
|
|
1081
|
-
return opts.tailwindcssBasedir ?? node_process.default.cwd();
|
|
1082
|
-
}
|
|
1083
|
-
function isCssSourceTraceEnabled(opts) {
|
|
1084
|
-
return opts.cssSourceTrace === true || typeof opts.cssSourceTrace === "object" && opts.cssSourceTrace !== null;
|
|
1085
|
-
}
|
|
1086
|
-
function createCssTokenSourceMap(sourcesByToken, opts) {
|
|
1087
|
-
const root = getSourceTraceRoot(opts);
|
|
1088
|
-
const tokenSources = /* @__PURE__ */ new Map();
|
|
1089
|
-
for (const [token, sources] of [...sourcesByToken.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
1090
|
-
const source = {
|
|
1091
|
-
token,
|
|
1092
|
-
sources: [...sources].map((file) => normalizeSourcePath(file, root)).sort()
|
|
1093
|
-
};
|
|
1094
|
-
tokenSources.set(token, source);
|
|
1095
|
-
const escaped = require_compiler.replaceWxml(token, { escapeMap: opts.escapeMap });
|
|
1096
|
-
tokenSources.set(escaped, source);
|
|
1097
|
-
tokenSources.set(escaped.replaceAll("\\", ""), source);
|
|
1098
|
-
}
|
|
1099
|
-
return tokenSources;
|
|
1100
|
-
}
|
|
1101
|
-
function createCssSourceTraceCacheSignature(tokenSources, opts) {
|
|
1102
|
-
if (!isCssSourceTraceEnabled(opts)) return "css-source-trace:0";
|
|
1103
|
-
if (!tokenSources?.size) return "css-source-trace:1:empty";
|
|
1104
|
-
return `css-source-trace:1:${[...tokenSources.values()].map(({ token, sources }) => `${token}<=${sources.join(",")}`).sort().join("|")}`;
|
|
1008
|
+
//#region src/generation/source-resolver/postcss-source.ts
|
|
1009
|
+
function resolvePostcssFromOption(cssHandlerOptions) {
|
|
1010
|
+
const from = cssHandlerOptions.postcssOptions?.options?.from;
|
|
1011
|
+
return typeof from === "string" && from.length > 0 ? from : void 0;
|
|
1105
1012
|
}
|
|
1106
|
-
function
|
|
1107
|
-
return
|
|
1108
|
-
}
|
|
1109
|
-
function collectRuleSourceTokens(rule, tokenSources) {
|
|
1110
|
-
const tokens = /* @__PURE__ */ new Map();
|
|
1111
|
-
for (const selector of rule.selectors) {
|
|
1112
|
-
const classMatches = selector.matchAll(/\.((?:\\.|[^\s.#:[{>,])*)/g);
|
|
1113
|
-
for (const match of classMatches) {
|
|
1114
|
-
const rawCandidate = match[1];
|
|
1115
|
-
if (!rawCandidate) continue;
|
|
1116
|
-
const candidates = [normalizeSelectorTokenCandidate(rawCandidate), rawCandidate];
|
|
1117
|
-
for (const candidate of candidates) {
|
|
1118
|
-
const source = getTokenSource(tokenSources, candidate);
|
|
1119
|
-
if (!source) continue;
|
|
1120
|
-
tokens.set(source.token, source);
|
|
1121
|
-
break;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
return tokens;
|
|
1126
|
-
}
|
|
1127
|
-
function removeTracedTailwindGeneratedContainerRules(root) {
|
|
1128
|
-
root.walkRules((rule) => {
|
|
1129
|
-
if (!rule.selectors || rule.selectors.length !== 1 || rule.selectors[0] !== ".container") return;
|
|
1130
|
-
const previous = rule.prev();
|
|
1131
|
-
if (previous?.type !== "comment" || !TAILWIND_GENERATED_CONTAINER_TRACE_COMMENT_RE.test(previous.text)) return;
|
|
1132
|
-
previous.remove();
|
|
1133
|
-
rule.remove();
|
|
1134
|
-
});
|
|
1013
|
+
function resolvePostcssRequestOption(cssHandlerOptions) {
|
|
1014
|
+
return resolveCssHandlerSourceOptions(cssHandlerOptions)?.requestFile ?? resolvePostcssFromOption(cssHandlerOptions);
|
|
1135
1015
|
}
|
|
1136
|
-
function
|
|
1137
|
-
|
|
1016
|
+
function resolvePostcssSourceFile(cssHandlerOptions) {
|
|
1017
|
+
const from = resolvePostcssFromOption(cssHandlerOptions);
|
|
1018
|
+
if (!from || !node_path.default.isAbsolute(from)) return;
|
|
1019
|
+
return from.replace(/[?#].*$/, "");
|
|
1138
1020
|
}
|
|
1139
|
-
function
|
|
1140
|
-
|
|
1141
|
-
try {
|
|
1142
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1143
|
-
root.walkComments((comment) => {
|
|
1144
|
-
if (CSS_SOURCE_TRACE_COMMENT_RE.test(comment.text)) comment.remove();
|
|
1145
|
-
});
|
|
1146
|
-
root.walkRules((rule) => {
|
|
1147
|
-
const tokens = collectRuleSourceTokens(rule, options.tokenSources);
|
|
1148
|
-
if (tokens.size === 0 || !rule.parent) return;
|
|
1149
|
-
const lines = [...tokens.values()].map(({ token, sources }) => {
|
|
1150
|
-
return `${token} <= ${sources.length > 0 ? sources.join(", ") : "<tailwind generated>"}`;
|
|
1151
|
-
});
|
|
1152
|
-
const comment = _weapp_tailwindcss_postcss.postcss.comment({ text: `tokens: ${lines.join(" | ")}` });
|
|
1153
|
-
comment.raws.before = normalizeTraceCommentBefore(rule.raws.before);
|
|
1154
|
-
rule.raws.before = "\n";
|
|
1155
|
-
rule.parent.insertBefore(rule, comment);
|
|
1156
|
-
});
|
|
1157
|
-
removeTracedTailwindGeneratedContainerRules(root);
|
|
1158
|
-
return root.toString();
|
|
1159
|
-
} catch {
|
|
1160
|
-
return css;
|
|
1161
|
-
}
|
|
1021
|
+
function resolveCssHandlerSourceOptions(cssHandlerOptions) {
|
|
1022
|
+
return cssHandlerOptions.sourceOptions;
|
|
1162
1023
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
1167
|
-
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (gulp|vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
1168
|
-
const BUNDLER_GENERATED_CSS_END_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css-end\s*:\s*[^\s*]+\s*\*\/\s*/gi;
|
|
1169
|
-
const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
|
|
1170
|
-
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
1171
|
-
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
1172
|
-
}
|
|
1173
|
-
function createBundlerGeneratedCssEndMarker(bundler, file) {
|
|
1174
|
-
return `/*! weapp-tailwindcss ${bundler}-generated-css-end:${encodeURIComponent(file)} */`;
|
|
1175
|
-
}
|
|
1176
|
-
function hasBundlerGeneratedCssMarker(source) {
|
|
1177
|
-
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
1178
|
-
}
|
|
1179
|
-
function stripBundlerGeneratedCssMarkers(source) {
|
|
1180
|
-
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(BUNDLER_GENERATED_CSS_END_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
|
|
1181
|
-
}
|
|
1182
|
-
function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
1183
|
-
const blocks = [];
|
|
1184
|
-
BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
|
|
1185
|
-
let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
1186
|
-
while (match !== null) {
|
|
1187
|
-
const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
|
|
1188
|
-
const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
1189
|
-
const cssEnd = nextMatch?.index ?? source.length;
|
|
1190
|
-
const file = match[2] ? decodeURIComponent(match[2]) : void 0;
|
|
1191
|
-
blocks.push({
|
|
1192
|
-
bundler: match[1],
|
|
1193
|
-
file,
|
|
1194
|
-
css: source.slice(cssStart, cssEnd)
|
|
1195
|
-
});
|
|
1196
|
-
match = nextMatch;
|
|
1197
|
-
}
|
|
1198
|
-
return blocks;
|
|
1024
|
+
function resolveCssSourceBase(file, cssHandlerOptions) {
|
|
1025
|
+
const normalized = (resolvePostcssFromOption(cssHandlerOptions) ?? file).replace(/[?#].*$/, "");
|
|
1026
|
+
return node_path.default.dirname(node_path.default.resolve(normalized));
|
|
1199
1027
|
}
|
|
1200
1028
|
//#endregion
|
|
1201
|
-
//#region src/
|
|
1029
|
+
//#region src/generation/style-requests.ts
|
|
1202
1030
|
const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
1203
1031
|
const SOURCE_PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)$/i;
|
|
1204
1032
|
const SFC_SOURCE_EXT_RE = /\.(?:vue|uvue|nvue|svelte|mpx)$/i;
|
|
@@ -1250,28 +1078,7 @@ function isVueScopedStyleRequest(request) {
|
|
|
1250
1078
|
return VUE_STYLE_QUERY_RE.test(query) && /(?:^|&)scoped(?:=[^&]*)?(?:&|$)/.test(query);
|
|
1251
1079
|
}
|
|
1252
1080
|
//#endregion
|
|
1253
|
-
//#region src/
|
|
1254
|
-
function resolvePostcssFromOption(cssHandlerOptions) {
|
|
1255
|
-
const from = cssHandlerOptions.postcssOptions?.options?.from;
|
|
1256
|
-
return typeof from === "string" && from.length > 0 ? from : void 0;
|
|
1257
|
-
}
|
|
1258
|
-
function resolvePostcssRequestOption(cssHandlerOptions) {
|
|
1259
|
-
return resolveCssHandlerSourceOptions(cssHandlerOptions)?.requestFile ?? resolvePostcssFromOption(cssHandlerOptions);
|
|
1260
|
-
}
|
|
1261
|
-
function resolvePostcssSourceFile(cssHandlerOptions) {
|
|
1262
|
-
const from = resolvePostcssFromOption(cssHandlerOptions);
|
|
1263
|
-
if (!from || !node_path.default.isAbsolute(from)) return;
|
|
1264
|
-
return from.replace(/[?#].*$/, "");
|
|
1265
|
-
}
|
|
1266
|
-
function resolveCssHandlerSourceOptions(cssHandlerOptions) {
|
|
1267
|
-
return cssHandlerOptions.sourceOptions;
|
|
1268
|
-
}
|
|
1269
|
-
function resolveCssSourceBase(file, cssHandlerOptions) {
|
|
1270
|
-
const normalized = (resolvePostcssFromOption(cssHandlerOptions) ?? file).replace(/[?#].*$/, "");
|
|
1271
|
-
return node_path.default.dirname(node_path.default.resolve(normalized));
|
|
1272
|
-
}
|
|
1273
|
-
//#endregion
|
|
1274
|
-
//#region src/bundlers/shared/generator-css/generation-helpers/preflight.ts
|
|
1081
|
+
//#region src/generation/generation-helpers/preflight.ts
|
|
1275
1082
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
1276
1083
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
1277
1084
|
}
|
|
@@ -1280,7 +1087,7 @@ function isMiniProgramGeneratorTarget(target) {
|
|
|
1280
1087
|
}
|
|
1281
1088
|
function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPreflight, options = {}) {
|
|
1282
1089
|
if (!isMiniProgramGeneratorTarget(target)) return css;
|
|
1283
|
-
if (options.styleOptions && isVueScopedStyleRequest(resolvePostcssRequestOption(options.styleOptions))) return (0,
|
|
1090
|
+
if (options.styleOptions && isVueScopedStyleRequest(resolvePostcssRequestOption(options.styleOptions))) return (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCss)(css, {
|
|
1284
1091
|
cssPreflight: false,
|
|
1285
1092
|
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
1286
1093
|
isTailwindcssV4: true,
|
|
@@ -1290,7 +1097,7 @@ function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPrefligh
|
|
|
1290
1097
|
const hasPreflightReset = hasMiniProgramTailwindV4PreflightReset(css);
|
|
1291
1098
|
const injectPreflight = options.injectPreflight !== false && !hasPreflightReset;
|
|
1292
1099
|
const preservePreflight = options.preservePreflight !== false;
|
|
1293
|
-
return (0,
|
|
1100
|
+
return (0, _weapp_tailwindcss_postcss_transform.finalizeMiniProgramCss)(css, {
|
|
1294
1101
|
cssPreflight: cssPreflight === false || options.injectPreflight === false && (!hasPreflightReset || !preservePreflight) ? false : injectPreflight ? cssPreflight : hasPreflightReset && preservePreflight ? cssPreflight : void 0,
|
|
1295
1102
|
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
1296
1103
|
isTailwindcssV4: true,
|
|
@@ -1338,142 +1145,21 @@ function resolveMiniProgramPreflightModeForGeneratorCss(opts, options) {
|
|
|
1338
1145
|
};
|
|
1339
1146
|
}
|
|
1340
1147
|
//#endregion
|
|
1341
|
-
//#region src/
|
|
1342
|
-
function createCssSourceOrderAppend(base, extra) {
|
|
1343
|
-
if (!base) return extra;
|
|
1344
|
-
if (!extra) return base;
|
|
1345
|
-
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
1346
|
-
return `${base}\n${extra}`;
|
|
1347
|
-
}
|
|
1348
|
-
const LEGACY_PSEUDO_ELEMENTS = [
|
|
1349
|
-
"before",
|
|
1350
|
-
"after",
|
|
1351
|
-
"first-letter",
|
|
1352
|
-
"first-line"
|
|
1353
|
-
];
|
|
1354
|
-
const CSS_STRING_LITERAL_RE = /(["'])((?:\\[\s\S]|(?!\1)[\s\S])*)\1/g;
|
|
1355
|
-
function isLegacyPseudoElementAt(selector, index) {
|
|
1356
|
-
for (const name of LEGACY_PSEUDO_ELEMENTS) {
|
|
1357
|
-
if (!selector.startsWith(name, index)) continue;
|
|
1358
|
-
const next = selector[index + name.length];
|
|
1359
|
-
if (next === void 0 || !/[\w-]/.test(next)) return name;
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
function normalizeLegacyPseudoElements(selector) {
|
|
1363
|
-
let result = "";
|
|
1364
|
-
let quote;
|
|
1365
|
-
let bracketDepth = 0;
|
|
1366
|
-
let index = 0;
|
|
1367
|
-
while (index < selector.length) {
|
|
1368
|
-
const char = selector[index];
|
|
1369
|
-
if (char === "\\") {
|
|
1370
|
-
result += selector.slice(index, index + 2);
|
|
1371
|
-
index += 2;
|
|
1372
|
-
continue;
|
|
1373
|
-
}
|
|
1374
|
-
if (quote !== void 0) {
|
|
1375
|
-
result += char;
|
|
1376
|
-
if (char === quote) quote = void 0;
|
|
1377
|
-
index += 1;
|
|
1378
|
-
continue;
|
|
1379
|
-
}
|
|
1380
|
-
if (char === "\"" || char === "'") {
|
|
1381
|
-
quote = char;
|
|
1382
|
-
result += char;
|
|
1383
|
-
index += 1;
|
|
1384
|
-
continue;
|
|
1385
|
-
}
|
|
1386
|
-
if (char === "[") {
|
|
1387
|
-
bracketDepth++;
|
|
1388
|
-
result += char;
|
|
1389
|
-
index += 1;
|
|
1390
|
-
continue;
|
|
1391
|
-
}
|
|
1392
|
-
if (char === "]") {
|
|
1393
|
-
bracketDepth = Math.max(0, bracketDepth - 1);
|
|
1394
|
-
result += char;
|
|
1395
|
-
index += 1;
|
|
1396
|
-
continue;
|
|
1397
|
-
}
|
|
1398
|
-
if (bracketDepth === 0 && char === ":" && selector[index + 1] === ":") {
|
|
1399
|
-
result += "::";
|
|
1400
|
-
index += 2;
|
|
1401
|
-
continue;
|
|
1402
|
-
}
|
|
1403
|
-
if (bracketDepth === 0 && char === ":") {
|
|
1404
|
-
const name = isLegacyPseudoElementAt(selector, index + 1);
|
|
1405
|
-
if (name) {
|
|
1406
|
-
result += `::${name}`;
|
|
1407
|
-
index += name.length + 1;
|
|
1408
|
-
continue;
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
result += char;
|
|
1412
|
-
index += 1;
|
|
1413
|
-
}
|
|
1414
|
-
return result;
|
|
1415
|
-
}
|
|
1416
|
-
function normalizeCssRuleDeduplicationSelector(selector) {
|
|
1417
|
-
return normalizeLegacyPseudoElements(selector).replace(/\s+/g, " ").replace(/\s*([>+~])\s*/g, "$1").replace(/\(\s+/g, "(").replace(/\s+\)/g, ")").trim();
|
|
1418
|
-
}
|
|
1419
|
-
function normalizeCssRuleDeduplicationValue(value) {
|
|
1420
|
-
return value.replace(/\s+/g, " ").replace(CSS_STRING_LITERAL_RE, (_match, _quote, content) => {
|
|
1421
|
-
return `'${content.replace(/\\(["'])/g, "$1").replace(/'/g, "\\'")}'`;
|
|
1422
|
-
}).trim();
|
|
1423
|
-
}
|
|
1424
|
-
function createRuleDeduplicationKey(rule) {
|
|
1425
|
-
const parents = [];
|
|
1426
|
-
let parent = rule.parent;
|
|
1427
|
-
while (parent && parent.type !== "root") {
|
|
1428
|
-
if (parent.type === "atrule") parents.push(`${parent.name}:${parent.params}`);
|
|
1429
|
-
parent = parent.parent;
|
|
1430
|
-
}
|
|
1431
|
-
const declarations = (rule.nodes ?? []).map((node) => {
|
|
1432
|
-
if (node.type === "decl") return `${node.prop}:${normalizeCssRuleDeduplicationValue(node.value)}:${node.important ? "1" : "0"}`;
|
|
1433
|
-
if (node.type === "comment") return "";
|
|
1434
|
-
return normalizeCssRuleDeduplicationValue(node.toString());
|
|
1435
|
-
}).filter(Boolean);
|
|
1436
|
-
const selectors = (rule.selectors?.length ? rule.selectors : [rule.selector]).map(normalizeCssRuleDeduplicationSelector);
|
|
1437
|
-
return [
|
|
1438
|
-
parents.reverse().join("|"),
|
|
1439
|
-
selectors.join(","),
|
|
1440
|
-
declarations.join(";")
|
|
1441
|
-
].join("\n");
|
|
1442
|
-
}
|
|
1443
|
-
function deduplicateGeneratedCssRules(css) {
|
|
1444
|
-
if (!css) return css;
|
|
1445
|
-
try {
|
|
1446
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1447
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1448
|
-
root.walkRules((rule) => {
|
|
1449
|
-
const key = createRuleDeduplicationKey(rule);
|
|
1450
|
-
if (seen.has(key)) {
|
|
1451
|
-
rule.remove();
|
|
1452
|
-
return;
|
|
1453
|
-
}
|
|
1454
|
-
seen.add(key);
|
|
1455
|
-
});
|
|
1456
|
-
return root.toString();
|
|
1457
|
-
} catch {
|
|
1458
|
-
return css;
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
//#endregion
|
|
1462
|
-
//#region src/bundlers/shared/generator-css/generation-helpers/results.ts
|
|
1148
|
+
//#region src/generation/generation-helpers/results.ts
|
|
1463
1149
|
function shouldFinalizeMarkedUserLayerComponentsCss(file) {
|
|
1464
1150
|
return !/\.(?:vue|svelte|astro|scss|sass|less|styl)(?:[?#].*)?$/i.test(file);
|
|
1465
1151
|
}
|
|
1466
1152
|
function splitRawSourceByGeneratedCssOrder(rawSource, rawTailwindCss) {
|
|
1467
|
-
const placeholderParts =
|
|
1153
|
+
const placeholderParts = (0, _weapp_tailwindcss_postcss_transform.splitGeneratorPlaceholderCssBySourceOrder)(rawSource, rawTailwindCss);
|
|
1468
1154
|
if (placeholderParts) return placeholderParts;
|
|
1469
|
-
const exactParts =
|
|
1155
|
+
const exactParts = (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(rawSource, rawTailwindCss);
|
|
1470
1156
|
if (exactParts) return exactParts;
|
|
1471
|
-
return
|
|
1157
|
+
return (0, _weapp_tailwindcss_postcss_transform.splitTailwindGeneratedCssByBanner)(rawSource);
|
|
1472
1158
|
}
|
|
1473
1159
|
function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, options) {
|
|
1474
|
-
const hasApplyDirectives =
|
|
1160
|
+
const hasApplyDirectives = (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(options.rawSource);
|
|
1475
1161
|
const sourceCss = cssHandlerOptions.sourceOptions?.sourceCss;
|
|
1476
|
-
const hasSourceCssDirectives = typeof sourceCss === "string" && (
|
|
1162
|
+
const hasSourceCssDirectives = typeof sourceCss === "string" && ((0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(sourceCss, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(sourceCss, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(sourceCss));
|
|
1477
1163
|
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;
|
|
1478
1164
|
}
|
|
1479
1165
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
@@ -1487,8 +1173,8 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
1487
1173
|
const incrementalRawCssResults = generatedResults.map((item) => item.incrementalRawCss).filter((css) => typeof css === "string");
|
|
1488
1174
|
return {
|
|
1489
1175
|
...firstGenerated,
|
|
1490
|
-
css: deduplicateGeneratedCssRules(generatedResults.map((item) => item.css).join("\n")),
|
|
1491
|
-
rawCss: deduplicateGeneratedCssRules(generatedResults.map((item) => item.rawCss).join("\n")),
|
|
1176
|
+
css: (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(generatedResults.map((item) => item.css).join("\n")),
|
|
1177
|
+
rawCss: (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(generatedResults.map((item) => item.rawCss).join("\n")),
|
|
1492
1178
|
incrementalCss: incrementalCssResults.length === generatedResults.length ? incrementalCssResults.filter(Boolean).join("\n") : void 0,
|
|
1493
1179
|
incrementalRawCss: incrementalRawCssResults.length === generatedResults.length ? incrementalRawCssResults.filter(Boolean).join("\n") : void 0,
|
|
1494
1180
|
classSet: new Set(generatedResults.flatMap((item) => [...item.classSet])),
|
|
@@ -1497,7 +1183,7 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
1497
1183
|
};
|
|
1498
1184
|
}
|
|
1499
1185
|
//#endregion
|
|
1500
|
-
//#region src/
|
|
1186
|
+
//#region src/generation/generation-helpers/runtime-isolation.ts
|
|
1501
1187
|
function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
|
|
1502
1188
|
if (options.isolateCssSource) {
|
|
1503
1189
|
if (options.matchedCssSourceFile) return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
@@ -1515,7 +1201,7 @@ function shouldIsolateScopedCssSource(_majorVersion, record, sourceEntries, opti
|
|
|
1515
1201
|
return sourceEntries !== void 0 && options.cssHandlerOptions?.isMainChunk !== true;
|
|
1516
1202
|
}
|
|
1517
1203
|
function shouldIsolateCurrentTailwindV4CssCandidates(_majorVersion, cssHandlerOptions, options) {
|
|
1518
|
-
return !cssHandlerOptions.isMainChunk &&
|
|
1204
|
+
return !cssHandlerOptions.isMainChunk && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(options.rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(options.rawSource) && !options.hasGeneratedCss && !options.hasGeneratedMarkers;
|
|
1519
1205
|
}
|
|
1520
1206
|
function shouldScanTailwindV4Sources(majorVersion, target, generatorRuntime, isolateCssSource) {
|
|
1521
1207
|
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
@@ -1546,7 +1232,27 @@ function resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorStyleOpt
|
|
|
1546
1232
|
};
|
|
1547
1233
|
}
|
|
1548
1234
|
//#endregion
|
|
1549
|
-
//#region src/
|
|
1235
|
+
//#region src/tailwindcss/v4/rpx-theme-warning.ts
|
|
1236
|
+
const warnedSessions = /* @__PURE__ */ new WeakSet();
|
|
1237
|
+
function shouldCheckRpxThemeRisk(session, target, opts, platform) {
|
|
1238
|
+
if (target !== "weapp" || warnedSessions.has(session) || opts.logLevel === "silent" || opts.logLevel === "error") return false;
|
|
1239
|
+
const resolved = require_compiler.normalizeFrameworkStylePlatform(platform ?? opts.cssOptions?.platform ?? opts.platform ?? node_process.default.env["UNI_UTS_PLATFORM"] ?? node_process.default.env["UNI_PLATFORM"] ?? node_process.default.env["TARO_ENV"] ?? node_process.default.env["MPX_CURRENT_TARGET_MODE"] ?? node_process.default.env["MPX_CLI_MODE"], opts.appType);
|
|
1240
|
+
return resolved === "mp-weixin" || resolved === "weapp" || resolved === "wx" || resolved === "weixin";
|
|
1241
|
+
}
|
|
1242
|
+
function collectRpxThemeRiskSources(sources) {
|
|
1243
|
+
const variables = /* @__PURE__ */ new Set();
|
|
1244
|
+
for (const css of new Set(sources)) for (const name of (0, _weapp_tailwindcss_postcss_transform.collectRpxThemeVariables)(css)) variables.add(name);
|
|
1245
|
+
return [...variables];
|
|
1246
|
+
}
|
|
1247
|
+
function warnRpxThemeRisk(session, variables, outputCss) {
|
|
1248
|
+
if (warnedSessions.has(session) || variables.length === 0) return;
|
|
1249
|
+
const usage = (0, _weapp_tailwindcss_postcss_transform.inspectRpxCalcUsage)(outputCss, new Set(variables));
|
|
1250
|
+
const runtimeHint = usage === void 0 ? "当前 CSS 无法完成诊断,请检查最终 WXSS。" : usage.variables.length > 0 || usage.inlineRpx ? `当前输出仍含运行时 calc:${[...usage.variables, ...usage.inlineRpx ? ["内联 rpx"] : []].join(", ")}。` : "当前输出未检测到相关运行时 calc;这不代表已验证所有作用域和设备。";
|
|
1251
|
+
warnedSessions.add(session);
|
|
1252
|
+
_weapp_tailwindcss_logger.logger.warn(`[tailwindcss@4][rpx-theme] @theme 中使用 rpx 的主题变量:${variables.join(", ")}。${runtimeHint} 微信 WXSS 可能先独立换算或量化基数再乘法,造成尺寸偏差,具体取整算法尚未确认。固定像素尺寸优先使用 px,需要缩放时在构建期输出最终静态 rpx;偶数或较大 rpx 也不保证准确。请检查最终 WXSS 并在目标设备验证:https://tw.weapp.dev/docs/issues/spacing-rpx`);
|
|
1253
|
+
}
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region src/generation/framework-postcss.ts
|
|
1550
1256
|
const FRAMEWORK_POSTCSS_REGISTRY = Symbol.for("weapp-tailwindcss.framework-postcss-options");
|
|
1551
1257
|
const registryHost = globalThis;
|
|
1552
1258
|
const frameworkPostcssOptions = registryHost[FRAMEWORK_POSTCSS_REGISTRY] ?? (registryHost[FRAMEWORK_POSTCSS_REGISTRY] = /* @__PURE__ */ new WeakMap());
|
|
@@ -1556,7 +1262,7 @@ function isObject(value) {
|
|
|
1556
1262
|
function normalizePlugins(plugins) {
|
|
1557
1263
|
const entries = Array.isArray(plugins) ? plugins : isObject(plugins) ? Object.values(plugins) : [];
|
|
1558
1264
|
const resolved = [...new Set(entries.filter(Boolean))];
|
|
1559
|
-
(0,
|
|
1265
|
+
(0, _weapp_tailwindcss_postcss_transform.removeTailwindPostcssPlugins)(resolved);
|
|
1560
1266
|
return resolved;
|
|
1561
1267
|
}
|
|
1562
1268
|
function resolveFrameworkPostcssOptions(value) {
|
|
@@ -1660,7 +1366,7 @@ function createFrameworkReplayArtifact(generated, options) {
|
|
|
1660
1366
|
}
|
|
1661
1367
|
async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options) {
|
|
1662
1368
|
const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
|
|
1663
|
-
if (generated.target === "web") return (await (0,
|
|
1369
|
+
if (generated.target === "web") return (await (0, _weapp_tailwindcss_postcss_transform.processFrameworkCss)(generated.css, handlerOptions.postcssOptions)).css;
|
|
1664
1370
|
const handled = await options.styleHandler(generated.css, handlerOptions);
|
|
1665
1371
|
const preflightMode = generated.metadata?.preflightMode;
|
|
1666
1372
|
const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
|
|
@@ -1671,358 +1377,41 @@ async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options)
|
|
|
1671
1377
|
styleOptions: options.cssHandlerOptions
|
|
1672
1378
|
});
|
|
1673
1379
|
}
|
|
1674
|
-
async function adaptGeneratedCssWithFrameworkRootPipeline(owner, generated, options) {
|
|
1675
|
-
const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
|
|
1676
|
-
if (generated.target === "web") return (await (0,
|
|
1677
|
-
const replayArtifact = createFrameworkReplayArtifact(generated, options);
|
|
1678
|
-
const handled = options.compiler && options.snapshot ? require_compiler.composeGenerationArtifact(await (async () => {
|
|
1679
|
-
for (const fragment of replayArtifact.fragments) {
|
|
1680
|
-
fragment.root = (await options.compiler.transformCssRoot(fragment.root, options.snapshot, handlerOptions)).root.clone();
|
|
1681
|
-
fragment.stage = "framework-processed";
|
|
1682
|
-
}
|
|
1683
|
-
return replayArtifact;
|
|
1684
|
-
})()) : typeof options.styleHandler.transformRoot === "function" ? require_compiler.composeGenerationArtifact(await require_compiler.createStylePlatformAdapter({
|
|
1685
|
-
id: generated.target === "web" ? "web" : "mini-program",
|
|
1686
|
-
styleHandler: options.styleHandler,
|
|
1687
|
-
styleOptions: handlerOptions
|
|
1688
|
-
}).transform(replayArtifact, { stage: "framework-processed" })) : await options.styleHandler(generated.css, handlerOptions);
|
|
1689
|
-
const preflightMode = generated.metadata?.preflightMode;
|
|
1690
|
-
const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
|
|
1691
|
-
const preservePreflight = preflightMode?.preserve ?? options.cssHandlerOptions.isMainChunk;
|
|
1692
|
-
return finalizeMiniProgramGeneratorCss(handled.css, generated.target, options.majorVersion, owner.cssPreflight, {
|
|
1693
|
-
...injectPreflight === void 0 ? {} : { injectPreflight },
|
|
1694
|
-
...preservePreflight === void 0 ? {} : { preservePreflight },
|
|
1695
|
-
styleOptions: options.cssHandlerOptions
|
|
1696
|
-
});
|
|
1697
|
-
}
|
|
1698
|
-
//#endregion
|
|
1699
|
-
//#region src/bundlers/shared/framework-css-composition.ts
|
|
1700
|
-
function nodeContent(node) {
|
|
1701
|
-
switch (node.type) {
|
|
1702
|
-
case "decl": return `decl\u0000${node.prop}\u0000${node.value}\u0000${node.important ? "1" : "0"}`;
|
|
1703
|
-
case "rule": return `rule\u0000${node.selectors.map((selector) => selector.trim()).join("")}\u0000${node.nodes.reduce((parts, child) => {
|
|
1704
|
-
if (child.type !== "comment") parts.push(nodeContent(child));
|
|
1705
|
-
return parts;
|
|
1706
|
-
}, []).join("")}`;
|
|
1707
|
-
case "atrule": return `atrule\u0000${node.name}\u0000${node.params}\u0000${node.nodes?.reduce((parts, child) => {
|
|
1708
|
-
if (child.type !== "comment") parts.push(nodeContent(child));
|
|
1709
|
-
return parts;
|
|
1710
|
-
}, []).join("") ?? ""}`;
|
|
1711
|
-
default: return `comment\u0000${node.text}`;
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
function visitRules(container, context, visit) {
|
|
1715
|
-
container.each((node) => {
|
|
1716
|
-
if (node.type === "rule" || node.type === "atrule" && /^(?:font-face|(?:-\w+-)?keyframes)$/.test(node.name)) visit(node, `${context}\u0000${nodeContent(node)}`, context);
|
|
1717
|
-
else if (node.type === "atrule" && node.nodes && !(node.name === "layer" && !node.params.trim())) visitRules(node, `${context}\u0000${node.name}\u0000${node.params}`, visit);
|
|
1718
|
-
});
|
|
1719
|
-
}
|
|
1720
|
-
function collectRules(root) {
|
|
1721
|
-
const rules = [];
|
|
1722
|
-
visitRules(root, "", (node, key, context) => rules.push({
|
|
1723
|
-
node,
|
|
1724
|
-
key,
|
|
1725
|
-
context
|
|
1726
|
-
}));
|
|
1727
|
-
return rules;
|
|
1728
|
-
}
|
|
1729
|
-
function removeRules(container, removed, ruleKeys) {
|
|
1730
|
-
const nodes = container.nodes ?? [];
|
|
1731
|
-
const retained = [];
|
|
1732
|
-
for (const node of nodes) {
|
|
1733
|
-
if (removed.has(node)) continue;
|
|
1734
|
-
const key = ruleKeys.get(node);
|
|
1735
|
-
const previous = retained.at(-1);
|
|
1736
|
-
if (key && previous && key === ruleKeys.get(previous)) continue;
|
|
1737
|
-
if (node.type === "atrule" && node.nodes?.length) {
|
|
1738
|
-
removeRules(node, removed, ruleKeys);
|
|
1739
|
-
if (node.nodes.length === 0 && node.name !== "layer") continue;
|
|
1740
|
-
}
|
|
1741
|
-
retained.push(node);
|
|
1742
|
-
}
|
|
1743
|
-
if (retained.length !== nodes.length) {
|
|
1744
|
-
container.removeAll();
|
|
1745
|
-
container.append(retained);
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
function matchOrderedPrefix(rules, positions) {
|
|
1749
|
-
const prefix = [];
|
|
1750
|
-
let previous = -1;
|
|
1751
|
-
for (const rule of rules) {
|
|
1752
|
-
const matches = positions.get(rule.key) ?? [];
|
|
1753
|
-
let left = 0;
|
|
1754
|
-
let right = matches.length;
|
|
1755
|
-
while (left < right) {
|
|
1756
|
-
const middle = left + right >>> 1;
|
|
1757
|
-
if (matches[middle] <= previous) left = middle + 1;
|
|
1758
|
-
else right = middle;
|
|
1759
|
-
}
|
|
1760
|
-
if (left === matches.length) break;
|
|
1761
|
-
previous = matches[left];
|
|
1762
|
-
prefix.push(previous);
|
|
1763
|
-
}
|
|
1764
|
-
return prefix;
|
|
1765
|
-
}
|
|
1766
|
-
/** 保留生成侧已确定的层位置;框架侧重复选择器及其间的覆盖区间按原顺序恢复。 */
|
|
1767
|
-
function composeFrameworkProcessedCss(before, generated, after) {
|
|
1768
|
-
if (!before.trim() && !after.trim()) return generated;
|
|
1769
|
-
const inputs = [
|
|
1770
|
-
before,
|
|
1771
|
-
generated,
|
|
1772
|
-
after
|
|
1773
|
-
];
|
|
1774
|
-
try {
|
|
1775
|
-
const roots = inputs.map((css) => _weapp_tailwindcss_postcss.postcss.parse(css));
|
|
1776
|
-
const generatedRules = collectRules(roots[1]);
|
|
1777
|
-
const generatedKeys = new Set(generatedRules.map((rule) => rule.key));
|
|
1778
|
-
const positions = /* @__PURE__ */ new Map();
|
|
1779
|
-
generatedRules.forEach((rule, index) => {
|
|
1780
|
-
const matches = positions.get(rule.key) ?? [];
|
|
1781
|
-
matches.push(index);
|
|
1782
|
-
positions.set(rule.key, matches);
|
|
1783
|
-
});
|
|
1784
|
-
const frameworkRules = [...collectRules(roots[0]), ...collectRules(roots[2])];
|
|
1785
|
-
const ruleKeys = new Map([...generatedRules, ...frameworkRules].map((record) => [record.node, record.key]));
|
|
1786
|
-
const scopes = /* @__PURE__ */ new Map();
|
|
1787
|
-
for (const record of frameworkRules) {
|
|
1788
|
-
const rules = scopes.get(record.context) ?? [];
|
|
1789
|
-
rules.push(record);
|
|
1790
|
-
scopes.set(record.context, rules);
|
|
1791
|
-
}
|
|
1792
|
-
const preserve = /* @__PURE__ */ new Set();
|
|
1793
|
-
const generatedPrefix = /* @__PURE__ */ new Set();
|
|
1794
|
-
for (const rules of scopes.values()) {
|
|
1795
|
-
const ranges = /* @__PURE__ */ new Map();
|
|
1796
|
-
rules.forEach(({ node }, index) => {
|
|
1797
|
-
const selectors = node.type === "rule" ? node.selectors : [JSON.stringify([node.name, node.params])];
|
|
1798
|
-
for (const selector of selectors) {
|
|
1799
|
-
const range = ranges.get(selector);
|
|
1800
|
-
if (range) range[1] = index;
|
|
1801
|
-
else ranges.set(selector, [index, index]);
|
|
1802
|
-
}
|
|
1803
|
-
});
|
|
1804
|
-
const boundaries = new Int32Array(rules.length + 1);
|
|
1805
|
-
for (const [first, last] of ranges.values()) if (first !== last) {
|
|
1806
|
-
boundaries[first] += 1;
|
|
1807
|
-
boundaries[last + 1] -= 1;
|
|
1808
|
-
}
|
|
1809
|
-
let depth = 0;
|
|
1810
|
-
let start = 0;
|
|
1811
|
-
for (let index = 0; index < rules.length; index++) {
|
|
1812
|
-
const previousDepth = depth;
|
|
1813
|
-
depth += boundaries[index];
|
|
1814
|
-
if (previousDepth === 0 && depth > 0) start = index;
|
|
1815
|
-
if (depth > 0 && depth + boundaries[index + 1] === 0) {
|
|
1816
|
-
const group = rules.slice(start, index + 1);
|
|
1817
|
-
const prefix = matchOrderedPrefix(group, positions);
|
|
1818
|
-
if (prefix.length !== group.length) {
|
|
1819
|
-
prefix.forEach((position) => generatedPrefix.add(generatedRules[position].node));
|
|
1820
|
-
group.slice(prefix.length).forEach((record) => preserve.add(record));
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
const restoredKeys = new Set([...preserve].map((record) => record.key));
|
|
1826
|
-
const removed = /* @__PURE__ */ new Set();
|
|
1827
|
-
for (const record of frameworkRules) if (!preserve.has(record) && generatedKeys.has(record.key)) removed.add(record.node);
|
|
1828
|
-
for (const record of generatedRules) if (restoredKeys.has(record.key) && !generatedPrefix.has(record.node)) removed.add(record.node);
|
|
1829
|
-
let charset;
|
|
1830
|
-
for (const root of roots) {
|
|
1831
|
-
removeRules(root, removed, ruleKeys);
|
|
1832
|
-
root.walkAtRules("charset", (rule) => {
|
|
1833
|
-
charset ?? (charset = rule.clone({ raws: {
|
|
1834
|
-
before: "",
|
|
1835
|
-
afterName: " "
|
|
1836
|
-
} }));
|
|
1837
|
-
rule.remove();
|
|
1838
|
-
});
|
|
1839
|
-
}
|
|
1840
|
-
const css = roots.map((root) => root.toString()).filter((value) => value.trim()).join("\n");
|
|
1841
|
-
return charset ? `${charset.toString()};\n${css}` : css;
|
|
1842
|
-
} catch {
|
|
1843
|
-
return inputs.filter((value) => value.trim()).join("\n");
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
//#endregion
|
|
1847
|
-
//#region src/bundlers/shared/generator-css/user-layer-order.ts
|
|
1848
|
-
const USER_LAYER_COMPONENTS_START = "/*! weapp-tailwindcss layer components start */";
|
|
1849
|
-
const USER_LAYER_COMPONENTS_END = "/*! weapp-tailwindcss layer components end */";
|
|
1850
|
-
function appendCss(base, extra) {
|
|
1851
|
-
if (!base) return extra;
|
|
1852
|
-
if (!extra) return base;
|
|
1853
|
-
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
1854
|
-
return `${base}\n${extra}`;
|
|
1855
|
-
}
|
|
1856
|
-
function removeFirstCssOccurrence(css, chunk) {
|
|
1857
|
-
const trimmed = chunk.trim();
|
|
1858
|
-
if (!trimmed) return css;
|
|
1859
|
-
const index = css.indexOf(trimmed);
|
|
1860
|
-
if (index === -1) return css;
|
|
1861
|
-
return appendCss(css.slice(0, index).trimEnd(), css.slice(index + trimmed.length).trimStart());
|
|
1862
|
-
}
|
|
1863
|
-
function collectSelectorsFromCss(css) {
|
|
1864
|
-
const selectors = /* @__PURE__ */ new Set();
|
|
1865
|
-
try {
|
|
1866
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
1867
|
-
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
1868
|
-
const normalized = selector.trim();
|
|
1869
|
-
if (normalized) selectors.add(normalized);
|
|
1870
|
-
}
|
|
1871
|
-
});
|
|
1872
|
-
} catch {}
|
|
1873
|
-
return selectors;
|
|
1874
|
-
}
|
|
1875
|
-
function normalizeRuleValue(value) {
|
|
1876
|
-
return value.replace(/\s+/g, " ").trim();
|
|
1877
|
-
}
|
|
1878
|
-
function createRuleKey(rule) {
|
|
1879
|
-
const parents = [];
|
|
1880
|
-
let parent = rule.parent;
|
|
1881
|
-
while (parent && parent.type !== "root") {
|
|
1882
|
-
if (parent.type === "atrule") parents.push(`${parent.name}:${normalizeRuleValue(parent.params)}`);
|
|
1883
|
-
parent = parent.parent;
|
|
1884
|
-
}
|
|
1885
|
-
const selectors = (rule.selectors ?? [rule.selector]).map((selector) => normalizeRuleValue(selector)).join(",");
|
|
1886
|
-
const declarations = (rule.nodes ?? []).filter((node) => node.type === "decl").map((node) => `${node.prop}:${normalizeRuleValue(node.value)}:${node.important ? "1" : "0"}`).join(";");
|
|
1887
|
-
return `${parents.reverse().join("|")}\n${selectors}\n${declarations}`;
|
|
1888
|
-
}
|
|
1889
|
-
function collectRuleKeysFromCss(css) {
|
|
1890
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1891
|
-
try {
|
|
1892
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
1893
|
-
keys.add(createRuleKey(rule));
|
|
1894
|
-
});
|
|
1895
|
-
} catch {}
|
|
1896
|
-
return keys;
|
|
1897
|
-
}
|
|
1898
|
-
function matchesLayerSelector(selector, layerSelector) {
|
|
1899
|
-
if (selector === layerSelector) return true;
|
|
1900
|
-
if (!selector.startsWith(layerSelector)) return false;
|
|
1901
|
-
const next = selector[layerSelector.length];
|
|
1902
|
-
return next === ":" || next === "[";
|
|
1903
|
-
}
|
|
1904
|
-
function removeCssRulesForSelectors(css, layerCss) {
|
|
1905
|
-
const selectors = [...collectSelectorsFromCss(layerCss)];
|
|
1906
|
-
if (selectors.length === 0) return css;
|
|
1907
|
-
try {
|
|
1908
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1909
|
-
root.walkRules((rule) => {
|
|
1910
|
-
if ((rule.selectors ?? [rule.selector]).some((selector) => selectors.some((layerSelector) => matchesLayerSelector(selector.trim(), layerSelector)))) rule.remove();
|
|
1911
|
-
});
|
|
1912
|
-
return root.toString();
|
|
1913
|
-
} catch {
|
|
1914
|
-
return removeFirstCssOccurrence(css, layerCss);
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
function removeExactCssRules(css, duplicateCss) {
|
|
1918
|
-
const duplicateKeys = collectRuleKeysFromCss(duplicateCss);
|
|
1919
|
-
if (duplicateKeys.size === 0) return css;
|
|
1920
|
-
try {
|
|
1921
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1922
|
-
root.walkRules((rule) => {
|
|
1923
|
-
if (duplicateKeys.has(createRuleKey(rule))) rule.remove();
|
|
1924
|
-
});
|
|
1925
|
-
return root.toString();
|
|
1926
|
-
} catch {
|
|
1927
|
-
return css;
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
function wrapUserLayerComponentsCss(css) {
|
|
1931
|
-
return css.trim().length > 0 ? `${USER_LAYER_COMPONENTS_START}\n${css}\n${USER_LAYER_COMPONENTS_END}` : css;
|
|
1932
|
-
}
|
|
1933
|
-
function extractMarkedUserLayerComponentsCss(css) {
|
|
1934
|
-
const layers = [];
|
|
1935
|
-
let rest = "";
|
|
1936
|
-
let cursor = 0;
|
|
1937
|
-
while (cursor < css.length) {
|
|
1938
|
-
const startIndex = css.indexOf(USER_LAYER_COMPONENTS_START, cursor);
|
|
1939
|
-
if (startIndex === -1) {
|
|
1940
|
-
rest += css.slice(cursor);
|
|
1941
|
-
break;
|
|
1942
|
-
}
|
|
1943
|
-
rest += css.slice(cursor, startIndex);
|
|
1944
|
-
const contentStart = startIndex + 47;
|
|
1945
|
-
const endIndex = css.indexOf(USER_LAYER_COMPONENTS_END, contentStart);
|
|
1946
|
-
if (endIndex === -1) {
|
|
1947
|
-
rest += css.slice(startIndex);
|
|
1948
|
-
break;
|
|
1949
|
-
}
|
|
1950
|
-
const layerCss = css.slice(contentStart, endIndex).trim();
|
|
1951
|
-
if (layerCss) layers.push(layerCss);
|
|
1952
|
-
cursor = endIndex + 45;
|
|
1953
|
-
}
|
|
1954
|
-
return {
|
|
1955
|
-
layers,
|
|
1956
|
-
rest
|
|
1957
|
-
};
|
|
1958
|
-
}
|
|
1959
|
-
function isGeneratedInfrastructureRule(rule) {
|
|
1960
|
-
const declarations = (rule.nodes ?? []).filter((node) => node.type === "decl");
|
|
1961
|
-
if (declarations.length === 0) return false;
|
|
1962
|
-
if (declarations.every((declaration) => declaration.prop.startsWith("--"))) return true;
|
|
1963
|
-
const selectors = (rule.selectors ?? [rule.selector]).map((selector) => selector.trim());
|
|
1964
|
-
if (!(selectors.length > 0 && selectors.every((selector) => selector === "view" || selector === "text" || selector === "::before" || selector === "::after"))) return false;
|
|
1965
|
-
const declarationMap = new Map(declarations.map((declaration) => [declaration.prop, declaration.value]));
|
|
1966
|
-
return declarationMap.get("box-sizing") === "border-box" && declarationMap.has("border");
|
|
1967
|
-
}
|
|
1968
|
-
function findLayerInsertionIndex(css) {
|
|
1969
|
-
try {
|
|
1970
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
1971
|
-
let insertionIndex = -1;
|
|
1972
|
-
root.walkRules((rule) => {
|
|
1973
|
-
if (insertionIndex !== -1 || isGeneratedInfrastructureRule(rule)) return;
|
|
1974
|
-
let topLevelNode = rule;
|
|
1975
|
-
while (topLevelNode.parent && topLevelNode.parent.type !== "root") topLevelNode = topLevelNode.parent;
|
|
1976
|
-
const offset = topLevelNode.source?.start?.offset;
|
|
1977
|
-
if (typeof offset === "number") insertionIndex = css.lastIndexOf("\n", Math.max(0, offset - 1)) + 1;
|
|
1978
|
-
});
|
|
1979
|
-
return insertionIndex;
|
|
1980
|
-
} catch {
|
|
1981
|
-
return -1;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
function reorderMarkedUserLayerComponentsCss(css) {
|
|
1985
|
-
if (!css.includes(USER_LAYER_COMPONENTS_START)) return css;
|
|
1986
|
-
const { layers, rest } = extractMarkedUserLayerComponentsCss(css);
|
|
1987
|
-
if (layers.length === 0) return rest;
|
|
1988
|
-
const layerCss = layers.join("\n");
|
|
1989
|
-
const restWithoutLayerDuplicates = removeExactCssRules(rest, layerCss);
|
|
1990
|
-
const insertionIndex = findLayerInsertionIndex(restWithoutLayerDuplicates);
|
|
1991
|
-
if (insertionIndex === -1) return appendCss(restWithoutLayerDuplicates, layerCss);
|
|
1992
|
-
return appendCss(appendCss(restWithoutLayerDuplicates.slice(0, insertionIndex), layerCss), restWithoutLayerDuplicates.slice(insertionIndex));
|
|
1993
|
-
}
|
|
1994
|
-
function mergeMarkedUserLayerComponentsCss(baseCss, markedCss) {
|
|
1995
|
-
if (!markedCss.includes(USER_LAYER_COMPONENTS_START)) return {
|
|
1996
|
-
css: baseCss,
|
|
1997
|
-
merged: false
|
|
1998
|
-
};
|
|
1999
|
-
const { layers } = extractMarkedUserLayerComponentsCss(markedCss);
|
|
2000
|
-
if (layers.length === 0) return {
|
|
2001
|
-
css: baseCss,
|
|
2002
|
-
merged: false
|
|
2003
|
-
};
|
|
2004
|
-
const layerCss = layers.join("\n");
|
|
2005
|
-
return {
|
|
2006
|
-
css: reorderMarkedUserLayerComponentsCss(appendCss(removeCssRulesForSelectors(baseCss, layerCss), wrapUserLayerComponentsCss(layerCss))),
|
|
2007
|
-
merged: true
|
|
2008
|
-
};
|
|
2009
|
-
}
|
|
1380
|
+
async function adaptGeneratedCssWithFrameworkRootPipeline(owner, generated, options) {
|
|
1381
|
+
const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
|
|
1382
|
+
if (generated.target === "web") return (await (0, _weapp_tailwindcss_postcss_transform.processFrameworkCss)(generated.css, handlerOptions.postcssOptions)).css;
|
|
1383
|
+
const replayArtifact = createFrameworkReplayArtifact(generated, options);
|
|
1384
|
+
const handled = options.compiler && options.snapshot ? require_compiler.composeGenerationArtifact(await (async () => {
|
|
1385
|
+
for (const fragment of replayArtifact.fragments) {
|
|
1386
|
+
fragment.root = (await options.compiler.transformCssRoot(fragment.root, options.snapshot, handlerOptions)).root.clone();
|
|
1387
|
+
fragment.stage = "framework-processed";
|
|
1388
|
+
}
|
|
1389
|
+
return replayArtifact;
|
|
1390
|
+
})()) : typeof options.styleHandler.transformRoot === "function" ? require_compiler.composeGenerationArtifact(await require_compiler.createStylePlatformAdapter({
|
|
1391
|
+
id: generated.target === "web" ? "web" : "mini-program",
|
|
1392
|
+
styleHandler: options.styleHandler,
|
|
1393
|
+
styleOptions: handlerOptions
|
|
1394
|
+
}).transform(replayArtifact, { stage: "framework-processed" })) : await options.styleHandler(generated.css, handlerOptions);
|
|
1395
|
+
const preflightMode = generated.metadata?.preflightMode;
|
|
1396
|
+
const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
|
|
1397
|
+
const preservePreflight = preflightMode?.preserve ?? options.cssHandlerOptions.isMainChunk;
|
|
1398
|
+
return finalizeMiniProgramGeneratorCss(handled.css, generated.target, options.majorVersion, owner.cssPreflight, {
|
|
1399
|
+
...injectPreflight === void 0 ? {} : { injectPreflight },
|
|
1400
|
+
...preservePreflight === void 0 ? {} : { preservePreflight },
|
|
1401
|
+
styleOptions: options.cssHandlerOptions
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
2010
1404
|
//#endregion
|
|
2011
|
-
//#region src/
|
|
2012
|
-
function
|
|
2013
|
-
if (!
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
root.walkAtRules("media", (rule) => {
|
|
2017
|
-
if (/^source\(/.test(rule.params)) rule.replaceWith(...rule.nodes ?? []);
|
|
2018
|
-
});
|
|
2019
|
-
return root.toString();
|
|
2020
|
-
} catch {
|
|
2021
|
-
return require_generator.stripUnmatchedTailwindSourceMediaCloseFragments(require_generator.stripTailwindSourceMediaFragments(source));
|
|
2022
|
-
}
|
|
1405
|
+
//#region src/generation/user-css/apply-only.ts
|
|
1406
|
+
function shouldFilterApplyOnlyGeneratedCss(_majorVersion, target, source, options) {
|
|
1407
|
+
if (!((target === "weapp" || target === "web") && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(source) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(source) && !options.hasGeneratedCss && !options.hasGeneratedMarkers)) return false;
|
|
1408
|
+
const analysis = (0, _weapp_tailwindcss_postcss_transform.analyzeApplyOnlySource)(source);
|
|
1409
|
+
return analysis.selectors.size > 0 && analysis.onlyApply;
|
|
2023
1410
|
}
|
|
1411
|
+
//#endregion
|
|
1412
|
+
//#region src/generation/framework-user-css.ts
|
|
2024
1413
|
async function restoreFrameworkProcessedUserCss(css, generated, source, options, generatorOptions) {
|
|
2025
|
-
const generatedSource =
|
|
1414
|
+
const generatedSource = (0, _weapp_tailwindcss_postcss_transform.createGeneratedThemeDeclarationResolver)([generated.metadata?.rawCss, css].filter(Boolean).join("\n"));
|
|
2026
1415
|
const userCssOptions = {
|
|
2027
1416
|
compileAuthorCssFunctions: generated.compileAuthorCssFunctions,
|
|
2028
1417
|
generatorTarget: generated.target,
|
|
@@ -2033,33 +1422,26 @@ async function restoreFrameworkProcessedUserCss(css, generated, source, options,
|
|
|
2033
1422
|
importFallback: generatorOptions.importFallback
|
|
2034
1423
|
};
|
|
2035
1424
|
const transform = async (value) => {
|
|
2036
|
-
const parts =
|
|
2037
|
-
const layer = await
|
|
2038
|
-
const rest = await
|
|
2039
|
-
return
|
|
1425
|
+
const parts = (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(value);
|
|
1426
|
+
const layer = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.layer, userCssOptions);
|
|
1427
|
+
const rest = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.rest, userCssOptions);
|
|
1428
|
+
return (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratedUserCssArtifacts)(finalizeMiniProgramGeneratorCss((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layer), rest), generated.target, options.runtimeState.tailwindRuntime.majorVersion, options.opts.cssPreflight, {
|
|
2040
1429
|
injectPreflight: false,
|
|
2041
1430
|
preservePreflight: generated.metadata?.preflightMode?.preserve,
|
|
2042
1431
|
styleOptions: options.cssHandlerOptions
|
|
2043
1432
|
}), generatedSource);
|
|
2044
1433
|
};
|
|
2045
|
-
const userSource = normalizeFrameworkProcessedUserCss(source);
|
|
1434
|
+
const userSource = (0, _weapp_tailwindcss_postcss_transform.normalizeFrameworkProcessedUserCss)(source);
|
|
2046
1435
|
const ordered = splitRawSourceByGeneratedCssOrder(userSource, generated.metadata?.rawCss ?? "") ?? {
|
|
2047
1436
|
before: "",
|
|
2048
1437
|
after: userSource
|
|
2049
1438
|
};
|
|
2050
1439
|
const before = await transform(ordered.before);
|
|
2051
1440
|
const after = await transform(ordered.after);
|
|
2052
|
-
return
|
|
1441
|
+
return (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanners)((0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.composeFrameworkProcessedCss)(before, css, after)));
|
|
2053
1442
|
}
|
|
2054
1443
|
//#endregion
|
|
2055
|
-
//#region src/
|
|
2056
|
-
function removeDuplicatedViteMarkers(css, baseCss) {
|
|
2057
|
-
if (!require_generator.VITE_MARKER_RE.test(baseCss)) return css;
|
|
2058
|
-
require_generator.VITE_MARKER_RE.lastIndex = 0;
|
|
2059
|
-
return css.replace(require_generator.VITE_MARKER_RE, "");
|
|
2060
|
-
}
|
|
2061
|
-
//#endregion
|
|
2062
|
-
//#region src/bundlers/shared/generator-css/source-resolver/metadata.ts
|
|
1444
|
+
//#region src/generation/source-resolver/metadata.ts
|
|
2063
1445
|
const generatorSourceMetadataKey = Symbol.for("weapp-tailwindcss.generator-source-metadata");
|
|
2064
1446
|
function getGeneratorSourceMetadata(source) {
|
|
2065
1447
|
return source[generatorSourceMetadataKey];
|
|
@@ -2087,7 +1469,7 @@ function withMatchedSourceSideMetadata(source, resolvedEntrySource, metadata = {
|
|
|
2087
1469
|
}) : source;
|
|
2088
1470
|
}
|
|
2089
1471
|
//#endregion
|
|
2090
|
-
//#region src/
|
|
1472
|
+
//#region src/generation/source-files.ts
|
|
2091
1473
|
const SFC_STYLE_BLOCK_RE = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
2092
1474
|
const STYLE_IMPORT_EXTENSIONS = [
|
|
2093
1475
|
".css",
|
|
@@ -2200,11 +1582,11 @@ function extractStyleDirectiveSources(source) {
|
|
|
2200
1582
|
let match = SFC_STYLE_BLOCK_RE.exec(source);
|
|
2201
1583
|
while (match !== null) {
|
|
2202
1584
|
const styleSource = match[1] ?? "";
|
|
2203
|
-
if (
|
|
1585
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(styleSource, { importFallback: true })) styleSources.push(styleSource);
|
|
2204
1586
|
match = SFC_STYLE_BLOCK_RE.exec(source);
|
|
2205
1587
|
}
|
|
2206
1588
|
if (styleSources.length > 0) return styleSources;
|
|
2207
|
-
return
|
|
1589
|
+
return (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(source, { importFallback: true }) ? [source] : [];
|
|
2208
1590
|
}
|
|
2209
1591
|
function extractSfcStyleSources(source) {
|
|
2210
1592
|
const styleSources = [];
|
|
@@ -2233,8 +1615,8 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
2233
1615
|
const sources = extractSfcStyleSources(source);
|
|
2234
1616
|
if (sources.length === 0) sources.push(source);
|
|
2235
1617
|
for (const styleSource of sources) try {
|
|
2236
|
-
|
|
2237
|
-
const request =
|
|
1618
|
+
_weapp_tailwindcss_postcss_transform.postcss.parse(styleSource).walkAtRules("import", (rule) => {
|
|
1619
|
+
const request = (0, _weapp_tailwindcss_postcss_transform.parseImportRequest)(rule.params);
|
|
2238
1620
|
if (!isLocalStyleImportRequest(request)) return;
|
|
2239
1621
|
const file = request ? resolveLocalStyleImportFile(request, base) : void 0;
|
|
2240
1622
|
if (file) files.push(file);
|
|
@@ -2244,7 +1626,7 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
2244
1626
|
}
|
|
2245
1627
|
function extractStyleDirectiveSourcesDeep(source, sourceFile, seen) {
|
|
2246
1628
|
const ownSources = extractStyleDirectiveSources(source);
|
|
2247
|
-
if (ownSources.some((styleSource) =>
|
|
1629
|
+
if (ownSources.some((styleSource) => (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(styleSource, { importFallback: true }))) return ownSources.map((styleSource) => ({
|
|
2248
1630
|
source: styleSource,
|
|
2249
1631
|
file: sourceFile
|
|
2250
1632
|
}));
|
|
@@ -2270,7 +1652,7 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
|
|
|
2270
1652
|
if (source === void 0) continue;
|
|
2271
1653
|
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, /* @__PURE__ */ new Set([node_path.default.resolve(sourceFile)]));
|
|
2272
1654
|
for (const styleSource of directiveSources) {
|
|
2273
|
-
const cssEntrySource =
|
|
1655
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(styleSource.source, node_path.default.dirname(styleSource.file), resolveOptions);
|
|
2274
1656
|
if (cssEntrySource) return {
|
|
2275
1657
|
...cssEntrySource,
|
|
2276
1658
|
file: styleSource.file
|
|
@@ -2281,95 +1663,18 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
|
|
|
2281
1663
|
}
|
|
2282
1664
|
}
|
|
2283
1665
|
//#endregion
|
|
2284
|
-
//#region src/
|
|
2285
|
-
function parseGeneratorCss(css) {
|
|
2286
|
-
let root;
|
|
2287
|
-
try {
|
|
2288
|
-
root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2289
|
-
} catch {
|
|
2290
|
-
return;
|
|
2291
|
-
}
|
|
2292
|
-
return root;
|
|
2293
|
-
}
|
|
2294
|
-
function collectApplyCandidates(root) {
|
|
2295
|
-
const candidates = /* @__PURE__ */ new Set();
|
|
2296
|
-
root.walkAtRules("apply", (rule) => {
|
|
2297
|
-
for (const candidate of (0, _tailwindcss_mangle_engine.splitCandidateTokens)(rule.params)) candidates.add(candidate);
|
|
2298
|
-
});
|
|
2299
|
-
return candidates;
|
|
2300
|
-
}
|
|
2301
|
-
function collectCssApplyCandidates(css) {
|
|
2302
|
-
const root = parseGeneratorCss(css);
|
|
2303
|
-
return root ? [...collectApplyCandidates(root)].sort() : [];
|
|
2304
|
-
}
|
|
2305
|
-
function collectGeneratorCssCandidates(css) {
|
|
2306
|
-
const root = parseGeneratorCss(css);
|
|
2307
|
-
if (!root) return [];
|
|
2308
|
-
const candidates = collectApplyCandidates(root);
|
|
2309
|
-
const inlineCandidates = require_tailwindcss.collectCssInlineSourceCandidates(root);
|
|
2310
|
-
for (const candidate of inlineCandidates.included) candidates.add(candidate);
|
|
2311
|
-
for (const candidate of inlineCandidates.excluded) candidates.delete(candidate);
|
|
2312
|
-
return [...candidates].sort();
|
|
2313
|
-
}
|
|
2314
|
-
//#endregion
|
|
2315
|
-
//#region src/bundlers/shared/generator-css/source-resolver/apply-reference.ts
|
|
1666
|
+
//#region src/generation/source-resolver/apply-reference.ts
|
|
2316
1667
|
function resolveTailwindV4ApplyReference(options) {
|
|
2317
1668
|
const references = /* @__PURE__ */ new Set();
|
|
2318
|
-
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" &&
|
|
1669
|
+
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" && (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(source.css, { importFallback: true }) && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyContextDirective)(source.css)) references.add(source.file);
|
|
2319
1670
|
return references.size === 1 ? references.values().next().value : void 0;
|
|
2320
1671
|
}
|
|
2321
|
-
function hasTailwindApplyContextDirective(css) {
|
|
2322
|
-
try {
|
|
2323
|
-
let found = false;
|
|
2324
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules((rule) => {
|
|
2325
|
-
if (rule.name === "theme" || rule.name === "config") {
|
|
2326
|
-
found = true;
|
|
2327
|
-
return false;
|
|
2328
|
-
}
|
|
2329
|
-
});
|
|
2330
|
-
return found;
|
|
2331
|
-
} catch {
|
|
2332
|
-
return false;
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
1672
|
function createTailwindV4ApplyReferenceSource(css, sourceOptions) {
|
|
2336
1673
|
const reference = resolveTailwindV4ApplyReference(sourceOptions);
|
|
2337
|
-
return createTailwindV4SourceReferenceSource(css, sourceOptions, reference ? `@reference ${JSON.stringify(reference.replace(/\\/g, "/"))};` : void 0);
|
|
2338
|
-
}
|
|
2339
|
-
function createTailwindV4SourceReferenceSource(css, sourceOptions, referenceDirective) {
|
|
2340
|
-
if (hasTailwindV4RootImport(css, sourceOptions)) return css;
|
|
2341
|
-
const hasApplyDirective = require_generator.hasTailwindApplyDirective(css);
|
|
2342
|
-
if (!hasApplyDirective && !require_generator.hasTailwindSourceDirectives(css, { importFallback: true })) return css;
|
|
2343
|
-
const utilities = hasApplyDirective ? collectCssApplyCandidates(css) : [];
|
|
2344
|
-
return [
|
|
2345
|
-
referenceDirective ?? `@import "${sourceOptions.packageName ?? "tailwindcss"}" source(none);`,
|
|
2346
|
-
utilities.length > 0 ? `@source inline(${JSON.stringify(utilities.join(" "))});` : void 0,
|
|
2347
|
-
css
|
|
2348
|
-
].filter(Boolean).join("\n");
|
|
2349
|
-
}
|
|
2350
|
-
function hasTailwindV4RootImport(css, sourceOptions) {
|
|
2351
|
-
try {
|
|
2352
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2353
|
-
let found = false;
|
|
2354
|
-
root.walkAtRules((rule) => {
|
|
2355
|
-
if (rule.name === "tailwind") {
|
|
2356
|
-
found = true;
|
|
2357
|
-
return false;
|
|
2358
|
-
}
|
|
2359
|
-
if (rule.name !== "import" && rule.name !== "use" && rule.name !== "forward") return;
|
|
2360
|
-
const request = require_generator.parseImportRequest(rule.params);
|
|
2361
|
-
if (request === (sourceOptions.packageName ?? "tailwindcss") || request === "tailwindcss" || request === "tailwindcss4" || request?.startsWith("tailwindcss/") || request?.startsWith("tailwindcss4/")) {
|
|
2362
|
-
found = true;
|
|
2363
|
-
return false;
|
|
2364
|
-
}
|
|
2365
|
-
});
|
|
2366
|
-
return found;
|
|
2367
|
-
} catch {
|
|
2368
|
-
return /@(?:import|use|forward|tailwind)(?:[\s"'(;]|$)/.test(css) && (css.includes("tailwindcss") || css.includes("tailwindcss4") || css.includes("weapp-tailwindcss"));
|
|
2369
|
-
}
|
|
1674
|
+
return (0, _weapp_tailwindcss_postcss_transform.createTailwindV4SourceReferenceSource)(css, sourceOptions, reference ? `@reference ${JSON.stringify(reference.replace(/\\/g, "/"))};` : void 0);
|
|
2370
1675
|
}
|
|
2371
1676
|
//#endregion
|
|
2372
|
-
//#region src/
|
|
1677
|
+
//#region src/generation/source-resolver/config.ts
|
|
2373
1678
|
function resolveExistingConfigPath(config, configRequest, file, sourceOptions) {
|
|
2374
1679
|
if (config && (0, node_fs.existsSync)(config)) return config;
|
|
2375
1680
|
if (!configRequest || node_path.default.isAbsolute(configRequest)) return sourceOptions.config;
|
|
@@ -2397,9 +1702,9 @@ function resolveExistingConfigPath(config, configRequest, file, sourceOptions) {
|
|
|
2397
1702
|
return sourceOptions.config;
|
|
2398
1703
|
}
|
|
2399
1704
|
//#endregion
|
|
2400
|
-
//#region src/
|
|
1705
|
+
//#region src/generation/source-resolver/matching.ts
|
|
2401
1706
|
function normalizeCssSourceForCompare(css) {
|
|
2402
|
-
return
|
|
1707
|
+
return (0, _weapp_tailwindcss_postcss_transform.stripGeneratorPlaceholderMarkers)((0, _weapp_tailwindcss_postcss_transform.stripTailwindBanners)(css)).trim();
|
|
2403
1708
|
}
|
|
2404
1709
|
function getOutputFileWithoutExtension(file) {
|
|
2405
1710
|
const normalized = file.replace(/[?#].*$/, "");
|
|
@@ -2471,7 +1776,7 @@ function scoreTailwindV4CssSourceFileMatch(file, cssSourceFile, sourceOptions) {
|
|
|
2471
1776
|
return bestScore;
|
|
2472
1777
|
}
|
|
2473
1778
|
//#endregion
|
|
2474
|
-
//#region src/
|
|
1779
|
+
//#region src/generation/source-resolver/configuration.ts
|
|
2475
1780
|
function createCssEntrySources(cssEntries) {
|
|
2476
1781
|
return cssEntries?.filter((entry) => typeof entry === "string" && entry.length > 0 && node_path.default.isAbsolute(entry)).map((entry) => ({ file: node_path.default.resolve(entry) }));
|
|
2477
1782
|
}
|
|
@@ -2498,7 +1803,7 @@ function resolveUniqueTailwindV4CssConfig(sourceOptions) {
|
|
|
2498
1803
|
const configs = /* @__PURE__ */ new Set();
|
|
2499
1804
|
const collect = (css, base) => {
|
|
2500
1805
|
if (!css || !base || !css.includes("@config")) return;
|
|
2501
|
-
const source =
|
|
1806
|
+
const source = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(css, base, { removeConfig: false });
|
|
2502
1807
|
if (source?.config) configs.add(node_path.default.resolve(source.config));
|
|
2503
1808
|
};
|
|
2504
1809
|
collect(sourceOptions.css, sourceOptions.base ?? sourceOptions.projectRoot);
|
|
@@ -2531,7 +1836,7 @@ async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions, options
|
|
|
2531
1836
|
});
|
|
2532
1837
|
const css = (0, node_fs.readFileSync)(cssEntry, "utf8");
|
|
2533
1838
|
const base = node_path.default.dirname(node_path.default.resolve(cssEntry));
|
|
2534
|
-
const entrySource =
|
|
1839
|
+
const entrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(css, base, { removeConfig: false });
|
|
2535
1840
|
const config = resolveExistingConfigPath(entrySource?.config, entrySource?.configRequest, cssEntry, {
|
|
2536
1841
|
...sourceOptions,
|
|
2537
1842
|
sourceFile: sourceOptions.sourceFile ?? cssEntry
|
|
@@ -2539,7 +1844,7 @@ async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions, options
|
|
|
2539
1844
|
return withGeneratorSourceMetadata(await require_generator.resolveTailwindV4Source({
|
|
2540
1845
|
...require_generator.omitUndefined(singleEntrySourceOptions),
|
|
2541
1846
|
base,
|
|
2542
|
-
css:
|
|
1847
|
+
css: (0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)(css, config),
|
|
2543
1848
|
cssEntries: [cssEntry]
|
|
2544
1849
|
}), {
|
|
2545
1850
|
candidateMatchedCssSource: options.candidateMatched,
|
|
@@ -2557,24 +1862,24 @@ function canResolveSourceSideCssEntry(file, cssHandlerOptions, sourceOptions) {
|
|
|
2557
1862
|
return true;
|
|
2558
1863
|
}
|
|
2559
1864
|
function shouldResolveSourceSideCssEntry(rawSource) {
|
|
2560
|
-
return rawSource.includes("@apply") ||
|
|
1865
|
+
return rawSource.includes("@apply") || (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(rawSource, { importFallback: true }) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(rawSource) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource);
|
|
2561
1866
|
}
|
|
2562
1867
|
function normalizeTailwindV4CssSourceConfig(cssSource, sourceBase) {
|
|
2563
1868
|
if (typeof cssSource.css !== "string" || cssSource.css.length === 0 || !cssSource.css.includes("@config")) return cssSource;
|
|
2564
|
-
const entrySource =
|
|
1869
|
+
const entrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(cssSource.css, sourceBase, { removeConfig: false });
|
|
2565
1870
|
if (!entrySource?.config) return cssSource;
|
|
2566
1871
|
return {
|
|
2567
1872
|
...cssSource,
|
|
2568
|
-
css:
|
|
1873
|
+
css: (0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)(cssSource.css, entrySource.config)
|
|
2569
1874
|
};
|
|
2570
1875
|
}
|
|
2571
1876
|
function normalizeResolvedTailwindV4SourceConfig(source, file, sourceOptions) {
|
|
2572
1877
|
if (!("css" in source) || typeof source.css !== "string" || !source.css.includes("@config")) return source;
|
|
2573
1878
|
const sourceFile = typeof file === "string" && file.length > 0 ? file : getGeneratorSourceMetadata(source)?.matchedCssSourceFile;
|
|
2574
1879
|
if (!sourceFile) return source;
|
|
2575
|
-
const entrySource =
|
|
1880
|
+
const entrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(source.css, node_path.default.dirname(node_path.default.resolve(sourceFile)), { removeConfig: false });
|
|
2576
1881
|
const config = resolveExistingConfigPath(entrySource?.config, entrySource?.configRequest, sourceFile, sourceOptions ?? {});
|
|
2577
|
-
const normalizedCss =
|
|
1882
|
+
const normalizedCss = (0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)(source.css, config);
|
|
2578
1883
|
return normalizedCss === source.css ? source : {
|
|
2579
1884
|
...source,
|
|
2580
1885
|
css: normalizedCss
|
|
@@ -2598,7 +1903,7 @@ function normalizeTailwindV4CssSourceConfigs(sourceOptions) {
|
|
|
2598
1903
|
let changed = false;
|
|
2599
1904
|
const cssSources = sourceOptions.cssSources.map((cssSource) => {
|
|
2600
1905
|
const hydratedCssSource = hydrateTailwindV4CssSource(cssSource);
|
|
2601
|
-
const normalizedCssSource = normalizeTailwindV4CssSourceConfig(hydratedCssSource,
|
|
1906
|
+
const normalizedCssSource = normalizeTailwindV4CssSourceConfig(hydratedCssSource, require_tailwindcss.resolveTailwindV4CssSourceBase(hydratedCssSource, sourceBaseFallback));
|
|
2602
1907
|
changed || (changed = normalizedCssSource !== cssSource);
|
|
2603
1908
|
return normalizedCssSource;
|
|
2604
1909
|
});
|
|
@@ -2623,10 +1928,10 @@ function isSameTailwindV4CssSource(a, b) {
|
|
|
2623
1928
|
return typeof a.css === "string" && typeof b.css === "string" && normalizeCssSourceForCompare(a.css) === normalizeCssSourceForCompare(b.css);
|
|
2624
1929
|
}
|
|
2625
1930
|
//#endregion
|
|
2626
|
-
//#region src/
|
|
1931
|
+
//#region src/generation/source-resolver/single-source.ts
|
|
2627
1932
|
async function resolveSingleTailwindV4CssSource(cssSource, sourceOptions, options = {}) {
|
|
2628
1933
|
const sourceBaseFallback = sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd();
|
|
2629
|
-
const sourceBase =
|
|
1934
|
+
const sourceBase = require_tailwindcss.resolveTailwindV4CssSourceBase(cssSource, sourceBaseFallback);
|
|
2630
1935
|
const normalizedCssSource = normalizeTailwindV4CssSourceConfig(cssSource, sourceBase);
|
|
2631
1936
|
const source = await require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(sourceOptions, {
|
|
2632
1937
|
base: sourceBase,
|
|
@@ -2645,7 +1950,7 @@ async function resolveSingleTailwindV4CssSource(cssSource, sourceOptions, option
|
|
|
2645
1950
|
async function resolveTailwindV4CssSourceEntries(cssSource, sourceOptions) {
|
|
2646
1951
|
if (typeof cssSource.css !== "string" || cssSource.css.length === 0) return;
|
|
2647
1952
|
const sourceBaseFallback = sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd();
|
|
2648
|
-
const sourceBase =
|
|
1953
|
+
const sourceBase = require_tailwindcss.resolveTailwindV4CssSourceBase(cssSource, sourceBaseFallback);
|
|
2649
1954
|
return require_tailwindcss.resolveTailwindV4EntriesFromCss(cssSource.css, sourceBase);
|
|
2650
1955
|
}
|
|
2651
1956
|
function countRuntimeCandidateHits(candidates, runtime) {
|
|
@@ -2728,7 +2033,7 @@ async function resolveCandidateMatchedTailwindV4CssEntry(sourceOptions, selectio
|
|
|
2728
2033
|
function createTailwindV4CssSourceResolver(sourceOptions, generatorOptions) {
|
|
2729
2034
|
return (cssSource, index) => resolveSingleTailwindV4CssSource(cssSource, sourceOptions, { index }).then((source) => generatorOptions?.config ? {
|
|
2730
2035
|
...source,
|
|
2731
|
-
css:
|
|
2036
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
2732
2037
|
} : source);
|
|
2733
2038
|
}
|
|
2734
2039
|
async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourceOptions, generatorOptions, file, currentCss) {
|
|
@@ -2738,7 +2043,7 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
|
|
|
2738
2043
|
...resolvedSourceOptions,
|
|
2739
2044
|
sourceFile: resolvedEntrySource.file
|
|
2740
2045
|
});
|
|
2741
|
-
const css = createTailwindV4SourceReferenceSource(
|
|
2046
|
+
const css = (0, _weapp_tailwindcss_postcss_transform.createTailwindV4SourceReferenceSource)((0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)((0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(currentCss ?? resolvedEntrySource.css, generatorOptions?.config), config), resolvedSourceOptions);
|
|
2742
2047
|
const source = await require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(resolvedSourceOptions, {
|
|
2743
2048
|
base: currentCss && config ? node_path.default.dirname(config) : resolvedEntrySource.base,
|
|
2744
2049
|
css,
|
|
@@ -2755,7 +2060,7 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
|
|
|
2755
2060
|
});
|
|
2756
2061
|
}
|
|
2757
2062
|
//#endregion
|
|
2758
|
-
//#region src/
|
|
2063
|
+
//#region src/generation/source-resolver/source-matching.ts
|
|
2759
2064
|
async function resolveMatchingTailwindV4CssEntry(rawSource, file, sourceOptions) {
|
|
2760
2065
|
const cssEntries = sourceOptions.cssEntries;
|
|
2761
2066
|
if (!cssEntries?.length) return;
|
|
@@ -2817,14 +2122,14 @@ async function resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOpt
|
|
|
2817
2122
|
});
|
|
2818
2123
|
}
|
|
2819
2124
|
//#endregion
|
|
2820
|
-
//#region src/
|
|
2125
|
+
//#region src/generation/source-resolver/resolve-source.ts
|
|
2821
2126
|
async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
2822
2127
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
2823
|
-
const cssEntrySource =
|
|
2128
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(rawSource, base, {
|
|
2824
2129
|
importFallback: generatorOptions?.importFallback ?? false,
|
|
2825
2130
|
removeConfig: false
|
|
2826
2131
|
});
|
|
2827
|
-
const applyEntrySource =
|
|
2132
|
+
const applyEntrySource = (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource) ? {
|
|
2828
2133
|
base,
|
|
2829
2134
|
css: rawSource
|
|
2830
2135
|
} : void 0;
|
|
@@ -2837,9 +2142,9 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2837
2142
|
cssSources: mergeCssSources(mergeCssSources(sourceOptions.cssSources, selectionOptions?.cssSources), sourceOptions.cssSources?.length || selectionOptions?.cssSources?.length ? void 0 : createCssEntrySources(selectionOptions?.cssEntries ?? sourceOptions.cssEntries))
|
|
2838
2143
|
}) : void 0;
|
|
2839
2144
|
const normalizedSourceOptions = resolvedSourceOptions ? normalizeTailwindV4CssSourceConfigs(resolvedSourceOptions) : void 0;
|
|
2840
|
-
if (applyEntrySource && !cssHandlerOptions.isMainChunk && !
|
|
2145
|
+
if (applyEntrySource && !cssHandlerOptions.isMainChunk && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: generatorOptions?.importFallback ?? false })) {
|
|
2841
2146
|
const config = generatorOptions?.config ?? (normalizedSourceOptions ? resolveUniqueTailwindV4CssConfig(normalizedSourceOptions) : void 0);
|
|
2842
|
-
const css = createTailwindV4ApplyReferenceSource(
|
|
2147
|
+
const css = createTailwindV4ApplyReferenceSource((0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)((0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(applyEntrySource.css, config), void 0), normalizedSourceOptions ?? {});
|
|
2843
2148
|
return require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(normalizedSourceOptions ?? {}, {
|
|
2844
2149
|
base: applyEntrySource.base,
|
|
2845
2150
|
css
|
|
@@ -2858,24 +2163,24 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2858
2163
|
index: 0,
|
|
2859
2164
|
matched: true
|
|
2860
2165
|
}) : void 0;
|
|
2861
|
-
const canResolveCombinedConfiguredCssSources = (normalizedSourceOptions?.cssSources?.length ?? 0) <= 1 ||
|
|
2862
|
-
const configuredCssSource = normalizedSourceOptions && hasConfiguredTailwindV4CssSource(normalizedSourceOptions) &&
|
|
2166
|
+
const canResolveCombinedConfiguredCssSources = (normalizedSourceOptions?.cssSources?.length ?? 0) <= 1 || (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(rawSource);
|
|
2167
|
+
const configuredCssSource = normalizedSourceOptions && hasConfiguredTailwindV4CssSource(normalizedSourceOptions) && (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource) ? matchedCssSource ?? candidateMatchedCssSource ?? singleConfiguredCssSource ?? (canResolveCombinedConfiguredCssSources ? await require_generator.resolveTailwindV4Source(normalizedSourceOptions) : void 0) : void 0;
|
|
2863
2168
|
if (configuredCssSource) return generatorOptions?.config ? {
|
|
2864
2169
|
...configuredCssSource,
|
|
2865
|
-
css:
|
|
2170
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(configuredCssSource.css, generatorOptions.config)
|
|
2866
2171
|
} : configuredCssSource;
|
|
2867
2172
|
const mainCssEntrySource = normalizedSourceOptions && cssHandlerOptions.isMainChunk && normalizedSourceOptions.cssEntries?.length === 1 ? await resolveTailwindV4CssEntrySource(normalizedSourceOptions.cssEntries[0], normalizedSourceOptions) : void 0;
|
|
2868
2173
|
const preferredCssEntrySource = matchedCssEntrySource ?? matchedCssSource ?? candidateMatchedCssEntrySource ?? candidateMatchedCssSource ?? mainCssEntrySource ?? singleConfiguredCssSource;
|
|
2869
2174
|
if (preferredCssEntrySource) return generatorOptions?.config ? {
|
|
2870
2175
|
...preferredCssEntrySource,
|
|
2871
|
-
css:
|
|
2176
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(preferredCssEntrySource.css, generatorOptions.config)
|
|
2872
2177
|
} : preferredCssEntrySource;
|
|
2873
2178
|
const resolvedEntrySource = sourceSideEntrySource ?? cssEntrySource ?? applyEntrySource;
|
|
2874
2179
|
if (!resolvedEntrySource) {
|
|
2875
2180
|
const source = await require_generator.resolveTailwindV4SourceFromRuntime(runtimeState.tailwindRuntime);
|
|
2876
2181
|
return generatorOptions?.config ? {
|
|
2877
2182
|
...source,
|
|
2878
|
-
css:
|
|
2183
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
2879
2184
|
} : source;
|
|
2880
2185
|
}
|
|
2881
2186
|
const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, require_generator.omitUndefined({
|
|
@@ -2883,21 +2188,21 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2883
2188
|
sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
|
|
2884
2189
|
}));
|
|
2885
2190
|
const sourceBase = resolvedEntrySource === cssEntrySource && config ? node_path.default.dirname(config) : resolvedEntrySource.base;
|
|
2886
|
-
const css = createTailwindV4SourceReferenceSource(
|
|
2191
|
+
const css = (0, _weapp_tailwindcss_postcss_transform.createTailwindV4SourceReferenceSource)((0, _weapp_tailwindcss_postcss_transform.normalizeConfigDirective)((0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(resolvedEntrySource.css, generatorOptions?.config), config), normalizedSourceOptions ?? {});
|
|
2887
2192
|
return require_generator.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(normalizedSourceOptions ?? {}, {
|
|
2888
2193
|
base: sourceBase,
|
|
2889
2194
|
css
|
|
2890
2195
|
}));
|
|
2891
2196
|
}
|
|
2892
2197
|
//#endregion
|
|
2893
|
-
//#region src/
|
|
2198
|
+
//#region src/generation/source-resolver/resolve-sources.ts
|
|
2894
2199
|
async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
2895
2200
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
2896
|
-
const cssEntrySource =
|
|
2201
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(rawSource, base, {
|
|
2897
2202
|
importFallback: generatorOptions?.importFallback ?? false,
|
|
2898
2203
|
removeConfig: false
|
|
2899
2204
|
});
|
|
2900
|
-
if (cssEntrySource && !cssHandlerOptions.isMainChunk || !cssHandlerOptions.isMainChunk &&
|
|
2205
|
+
if (cssEntrySource && !cssHandlerOptions.isMainChunk || !cssHandlerOptions.isMainChunk && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: generatorOptions?.importFallback ?? false })) {
|
|
2901
2206
|
const resolved = await resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions);
|
|
2902
2207
|
return resolved ? [resolved] : [];
|
|
2903
2208
|
}
|
|
@@ -2920,7 +2225,7 @@ async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSo
|
|
|
2920
2225
|
const matchedCssEntrySource = sourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, sourceOptions) : void 0;
|
|
2921
2226
|
if (matchedCssEntrySource) return [normalizeResolvedTailwindV4SourceConfig(generatorOptions?.config ? {
|
|
2922
2227
|
...matchedCssEntrySource,
|
|
2923
|
-
css:
|
|
2228
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(matchedCssEntrySource.css, generatorOptions.config)
|
|
2924
2229
|
} : matchedCssEntrySource, getGeneratorSourceMetadata(matchedCssEntrySource)?.matchedCssSourceFile, sourceOptions)];
|
|
2925
2230
|
const sourceSideCssSource = await resolveTailwindV4SourceSideEntrySource(canResolveSourceSideCssEntry(file, cssHandlerOptions, sourceOptions) ? resolveSourceSideCssEntrySource(file, sourceOptions, { removeConfig: false }) : void 0, sourceOptions, generatorOptions, file);
|
|
2926
2231
|
if (sourceSideCssSource) return [sourceSideCssSource];
|
|
@@ -2930,25 +2235,25 @@ async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSo
|
|
|
2930
2235
|
const preferredCssEntrySource = matchedCssEntrySource ?? matchedCssSource ?? candidateMatchedCssEntrySource ?? candidateMatchedCssSource;
|
|
2931
2236
|
if (preferredCssEntrySource) return [normalizeResolvedTailwindV4SourceConfig(generatorOptions?.config ? {
|
|
2932
2237
|
...preferredCssEntrySource,
|
|
2933
|
-
css:
|
|
2238
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(preferredCssEntrySource.css, generatorOptions.config)
|
|
2934
2239
|
} : preferredCssEntrySource, getGeneratorSourceMetadata(preferredCssEntrySource)?.matchedCssSourceFile, sourceOptions)];
|
|
2935
2240
|
if (!sourceOptions.cssEntries || sourceOptions.cssEntries.length <= 1) {
|
|
2936
2241
|
if (cssHandlerOptions.isMainChunk && sourceOptions.cssEntries?.length === 1) return [await resolveTailwindV4CssEntrySource(sourceOptions.cssEntries[0], normalizeTailwindV4CssSourceConfigs(sourceOptions), { index: 0 }).then((source) => generatorOptions?.config ? {
|
|
2937
2242
|
...source,
|
|
2938
|
-
css:
|
|
2243
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
2939
2244
|
} : source)];
|
|
2940
2245
|
if (sourceOptions.cssSources?.length === 1) return [normalizeResolvedTailwindV4SourceConfig(await createTailwindV4CssSourceResolver(sourceOptions, generatorOptions)(sourceOptions.cssSources[0], 0), sourceOptions.cssSources[0]?.file, sourceOptions)];
|
|
2941
2246
|
const resolved = await resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions);
|
|
2942
2247
|
return resolved ? [resolved] : [];
|
|
2943
2248
|
}
|
|
2944
|
-
if (cssHandlerOptions.isMainChunk && !cssEntrySource && !
|
|
2249
|
+
if (cssHandlerOptions.isMainChunk && !cssEntrySource && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource) && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(rawSource, { importFallback: generatorOptions?.importFallback ?? false }) && !rawSource.includes("weapp-tailwindcss generator-placeholder") && !hasConfiguredTailwindV4CssSource(sourceOptions)) {
|
|
2945
2250
|
const resolved = await resolveGeneratorSource(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions);
|
|
2946
2251
|
return resolved ? [resolved] : [];
|
|
2947
2252
|
}
|
|
2948
2253
|
const normalizedCssSourceOptions = normalizeTailwindV4CssSourceConfigs(sourceOptions);
|
|
2949
2254
|
const cssEntrySources = await Promise.all(sourceOptions.cssEntries.map((cssEntry, index) => resolveTailwindV4CssEntrySource(cssEntry, normalizedCssSourceOptions, { index }).then((source) => generatorOptions?.config ? {
|
|
2950
2255
|
...source,
|
|
2951
|
-
css:
|
|
2256
|
+
css: (0, _weapp_tailwindcss_postcss_transform.prependConfigDirective)(source.css, generatorOptions.config)
|
|
2952
2257
|
} : source)));
|
|
2953
2258
|
const cssSources = sourceOptions.cssSources?.length ? await Promise.all(sourceOptions.cssSources.map(createTailwindV4CssSourceResolver(sourceOptions, generatorOptions))) : [];
|
|
2954
2259
|
return [...cssEntrySources, ...cssSources];
|
|
@@ -2957,7 +2262,7 @@ async function resolveGeneratorSources(majorVersion, runtimeState, rawSource, fi
|
|
|
2957
2262
|
return (await resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions)).map(createGeneratorSourceRecord);
|
|
2958
2263
|
}
|
|
2959
2264
|
//#endregion
|
|
2960
|
-
//#region src/
|
|
2265
|
+
//#region src/generation/source-resolver/source-entries.ts
|
|
2961
2266
|
async function resolveGeneratorSourceEntries(record, runtimeState) {
|
|
2962
2267
|
const { metadata: sourceMetadata, source } = record;
|
|
2963
2268
|
if (sourceMetadata?.sourceEntries) return sourceMetadata.sourceEntries;
|
|
@@ -2985,7 +2290,7 @@ async function resolveGeneratorSourceEntries(record, runtimeState) {
|
|
|
2985
2290
|
return resolved?.entries;
|
|
2986
2291
|
}
|
|
2987
2292
|
//#endregion
|
|
2988
|
-
//#region src/
|
|
2293
|
+
//#region src/generation/legacy-compat.ts
|
|
2989
2294
|
const LEGACY_CONTAINER_COMPAT_CSS = [
|
|
2990
2295
|
".container {",
|
|
2991
2296
|
" width: 100%;",
|
|
@@ -3038,94 +2343,20 @@ function createStableJson(value) {
|
|
|
3038
2343
|
function createLegacyCompatTransformCacheKey(source, options) {
|
|
3039
2344
|
return `${createStableJson(options)}\0${source}`;
|
|
3040
2345
|
}
|
|
3041
|
-
function countUnclosedBlocks(source) {
|
|
3042
|
-
let depth = 0;
|
|
3043
|
-
let quote;
|
|
3044
|
-
let inComment = false;
|
|
3045
|
-
let escaped = false;
|
|
3046
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
3047
|
-
const char = source[index];
|
|
3048
|
-
const next = source[index + 1];
|
|
3049
|
-
if (inComment) {
|
|
3050
|
-
if (char === "*" && next === "/") {
|
|
3051
|
-
inComment = false;
|
|
3052
|
-
index += 1;
|
|
3053
|
-
}
|
|
3054
|
-
continue;
|
|
3055
|
-
}
|
|
3056
|
-
if (quote) {
|
|
3057
|
-
if (escaped) {
|
|
3058
|
-
escaped = false;
|
|
3059
|
-
continue;
|
|
3060
|
-
}
|
|
3061
|
-
if (char === "\\") {
|
|
3062
|
-
escaped = true;
|
|
3063
|
-
continue;
|
|
3064
|
-
}
|
|
3065
|
-
if (char === quote) quote = void 0;
|
|
3066
|
-
continue;
|
|
3067
|
-
}
|
|
3068
|
-
if (char === "/" && next === "*") {
|
|
3069
|
-
inComment = true;
|
|
3070
|
-
index += 1;
|
|
3071
|
-
continue;
|
|
3072
|
-
}
|
|
3073
|
-
if (char === "\"" || char === "'") {
|
|
3074
|
-
quote = char;
|
|
3075
|
-
continue;
|
|
3076
|
-
}
|
|
3077
|
-
if (char === "{") depth += 1;
|
|
3078
|
-
else if (char === "}" && depth > 0) depth -= 1;
|
|
3079
|
-
}
|
|
3080
|
-
return depth;
|
|
3081
|
-
}
|
|
3082
|
-
function closeTrailingUnclosedBlocks(source) {
|
|
3083
|
-
try {
|
|
3084
|
-
_weapp_tailwindcss_postcss.postcss.parse(source);
|
|
3085
|
-
return source;
|
|
3086
|
-
} catch (error) {
|
|
3087
|
-
if (error.reason !== "Unclosed block") return source;
|
|
3088
|
-
const unclosedBlocks = countUnclosedBlocks(source);
|
|
3089
|
-
return unclosedBlocks > 0 ? `${source}${"}".repeat(unclosedBlocks)}` : source;
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
2346
|
function resolveLegacyCompatCssSource(rawSource) {
|
|
3093
2347
|
const cached = legacyCompatSourceCache.get(rawSource);
|
|
3094
2348
|
if (cached !== void 0) return cached;
|
|
3095
|
-
const
|
|
3096
|
-
const source = require_generator.removeTailwindSourceDirectives(parseableSource);
|
|
3097
|
-
const resolved = closeTrailingUnclosedBlocks(require_generator.removeTailwindV4GeneratedUserCssArtifacts((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)((0, _weapp_tailwindcss_postcss.removeTailwindApplyRules)(source))));
|
|
2349
|
+
const resolved = (0, _weapp_tailwindcss_postcss_transform.normalizeLegacyCompatCssSource)(rawSource);
|
|
3098
2350
|
setLimitedCacheValue(legacyCompatSourceCache, rawSource, resolved);
|
|
3099
2351
|
return resolved;
|
|
3100
2352
|
}
|
|
3101
|
-
function removeMiniProgramContainerCompatCss(css) {
|
|
3102
|
-
try {
|
|
3103
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
3104
|
-
let removed = false;
|
|
3105
|
-
root.walkRules((rule) => {
|
|
3106
|
-
if (rule.selectors?.length === 1 && rule.selectors[0] === ".container") {
|
|
3107
|
-
rule.remove();
|
|
3108
|
-
removed = true;
|
|
3109
|
-
}
|
|
3110
|
-
});
|
|
3111
|
-
root.walkAtRules((atRule) => {
|
|
3112
|
-
if (atRule.nodes && atRule.nodes.length === 0) {
|
|
3113
|
-
atRule.remove();
|
|
3114
|
-
removed = true;
|
|
3115
|
-
}
|
|
3116
|
-
});
|
|
3117
|
-
return removed ? root.toString() : css;
|
|
3118
|
-
} catch {
|
|
3119
|
-
return css;
|
|
3120
|
-
}
|
|
3121
|
-
}
|
|
3122
2353
|
function hasContainerConfigToken(rawSource) {
|
|
3123
2354
|
return rawSource.includes("@config") && /\bcontainer\b/.test(rawSource);
|
|
3124
2355
|
}
|
|
3125
2356
|
function hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) {
|
|
3126
2357
|
if (hasContainerConfigToken(rawSource)) return true;
|
|
3127
2358
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
3128
|
-
const cssEntrySource =
|
|
2359
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(rawSource, base);
|
|
3129
2360
|
if (!cssEntrySource?.config) return false;
|
|
3130
2361
|
try {
|
|
3131
2362
|
return /\bcontainer\b/.test((0, node_fs.readFileSync)(cssEntrySource.config, "utf8"));
|
|
@@ -3136,7 +2367,7 @@ function hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) {
|
|
|
3136
2367
|
function hasConfiguredContainerCompatSource(source) {
|
|
3137
2368
|
if (typeof source.css !== "string") return false;
|
|
3138
2369
|
if (hasContainerConfigToken(source.css)) return true;
|
|
3139
|
-
const cssEntrySource =
|
|
2370
|
+
const cssEntrySource = (0, _weapp_tailwindcss_postcss_transform.resolveCssEntrySource)(source.css, source.base);
|
|
3140
2371
|
if (cssEntrySource?.config) try {
|
|
3141
2372
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(cssEntrySource.config, "utf8"))) return true;
|
|
3142
2373
|
} catch {}
|
|
@@ -3150,11 +2381,11 @@ function hasConfiguredContainerCompatSources(sources) {
|
|
|
3150
2381
|
}
|
|
3151
2382
|
async function appendLegacyCompatCss(css, rawSource, generatorTarget, styleHandler, cssHandlerOptions, generatorStyleOptions, options = {}) {
|
|
3152
2383
|
const resolvedCompatSource = resolveLegacyCompatCssSource(rawSource);
|
|
3153
|
-
const normalizedCompatSource = generatorTarget === "weapp" ? removeMiniProgramContainerCompatCss(resolvedCompatSource) : resolvedCompatSource;
|
|
3154
|
-
const filteredCompatSource = options.preserveSelectorOverrides ? normalizedCompatSource : (0,
|
|
2384
|
+
const normalizedCompatSource = generatorTarget === "weapp" ? (0, _weapp_tailwindcss_postcss_transform.removeMiniProgramContainerCompatCss)(resolvedCompatSource) : resolvedCompatSource;
|
|
2385
|
+
const filteredCompatSource = options.preserveSelectorOverrides ? normalizedCompatSource : (0, _weapp_tailwindcss_postcss_transform.removeGeneratedSelectorCompatCss)(normalizedCompatSource, css);
|
|
3155
2386
|
if (filteredCompatSource.trim().length === 0) return css;
|
|
3156
2387
|
const compatSource = await options.compileAuthorCssFunctions?.(filteredCompatSource) ?? filteredCompatSource;
|
|
3157
|
-
if (generatorTarget !== "weapp") return
|
|
2388
|
+
if (generatorTarget !== "weapp") return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(css, compatSource);
|
|
3158
2389
|
const styleOptions = {
|
|
3159
2390
|
...cssHandlerOptions,
|
|
3160
2391
|
...generatorStyleOptions
|
|
@@ -3165,16 +2396,16 @@ async function appendLegacyCompatCss(css, rawSource, generatorTarget, styleHandl
|
|
|
3165
2396
|
compatCss = (await styleHandler(compatSource, styleOptions)).css;
|
|
3166
2397
|
setLimitedCacheValue(legacyCompatTransformCache, compatCssCacheKey, compatCss);
|
|
3167
2398
|
}
|
|
3168
|
-
const transformedCompatCss =
|
|
3169
|
-
const cleanedCompatCss = options.preserveSelectorOverrides ? (0,
|
|
2399
|
+
const transformedCompatCss = (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratedUserCssArtifacts)((0, _weapp_tailwindcss_postcss_transform.removeDuplicatedViteMarkers)((0, _weapp_tailwindcss_postcss_transform.removeUnsupportedMiniProgramAtRules)(compatCss), css), options.generatedSource ?? css);
|
|
2400
|
+
const cleanedCompatCss = options.preserveSelectorOverrides ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, transformedCompatCss) : (0, _weapp_tailwindcss_postcss_transform.collectDedupedPostTransformCompatCss)(transformedCompatCss, css);
|
|
3170
2401
|
if (cleanedCompatCss.trim().length === 0) return css;
|
|
3171
|
-
return
|
|
2402
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(css, cleanedCompatCss);
|
|
3172
2403
|
}
|
|
3173
2404
|
async function appendLegacyContainerCompatCss(css, rawSource, file, runtime, configuredContainerCompat, generatorTarget, styleHandler, cssHandlerOptions, generatorStyleOptions) {
|
|
3174
2405
|
if (generatorTarget === "weapp") return css;
|
|
3175
2406
|
const compatSource = resolveLegacyCompatCssSource(rawSource);
|
|
3176
|
-
const shouldAppendContainer = runtime.has("container") || hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) || configuredContainerCompat || (0,
|
|
3177
|
-
if (generatorTarget !== "weapp" || !shouldAppendContainer || (0,
|
|
2407
|
+
const shouldAppendContainer = runtime.has("container") || hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) || configuredContainerCompat || (0, _weapp_tailwindcss_postcss_transform.collectGeneratedSelectors)(compatSource).has(".container");
|
|
2408
|
+
if (generatorTarget !== "weapp" || !shouldAppendContainer || (0, _weapp_tailwindcss_postcss_transform.collectGeneratedSelectors)(css).has(".container")) return css;
|
|
3178
2409
|
const styleOptions = {
|
|
3179
2410
|
...cssHandlerOptions,
|
|
3180
2411
|
...generatorStyleOptions
|
|
@@ -3185,100 +2416,12 @@ async function appendLegacyContainerCompatCss(css, rawSource, file, runtime, con
|
|
|
3185
2416
|
compatCss = (await styleHandler(LEGACY_CONTAINER_COMPAT_CSS, styleOptions)).css;
|
|
3186
2417
|
setLimitedCacheValue(legacyCompatTransformCache, compatCssCacheKey, compatCss);
|
|
3187
2418
|
}
|
|
3188
|
-
const cleanedCompatCss = (0,
|
|
2419
|
+
const cleanedCompatCss = (0, _weapp_tailwindcss_postcss_transform.collectDedupedPostTransformCompatCss)((0, _weapp_tailwindcss_postcss_transform.removeUnsupportedMiniProgramAtRules)(compatCss), css);
|
|
3189
2420
|
if (cleanedCompatCss.trim().length === 0) return css;
|
|
3190
|
-
return
|
|
3191
|
-
}
|
|
3192
|
-
//#endregion
|
|
3193
|
-
//#region src/bundlers/shared/generator-css/output-import-shell.ts
|
|
3194
|
-
const MINI_PROGRAM_OUTPUT_IMPORT_RE = /(@import\s+(?:url\(\s*)?)(["'])([^"']+\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:[?#][^"']*)?)\2([^;]*;)/gi;
|
|
3195
|
-
const MINI_PROGRAM_OUTPUT_STYLE_RE = /\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
3196
|
-
function normalizeMiniProgramOutputImportRequest(request) {
|
|
3197
|
-
if (request.startsWith(".") || request.startsWith("/") || /^(?:[a-z][a-z\d+.-]*:|#)/i.test(request)) return request;
|
|
3198
|
-
return `./${request}`;
|
|
3199
|
-
}
|
|
3200
|
-
function normalizeMiniProgramImportShell(css, output) {
|
|
3201
|
-
const normalized = output?.cssOnly ? css : css.replace(MINI_PROGRAM_OUTPUT_IMPORT_RE, (_match, prefix, quote, request, suffix) => {
|
|
3202
|
-
return `${prefix}${quote}${normalizeMiniProgramOutputImportRequest(request)}${quote}${suffix}`;
|
|
3203
|
-
});
|
|
3204
|
-
if (!output || !normalized.includes("@import")) return normalized;
|
|
3205
|
-
const files = new Set([...output.outputFiles].map(normalizeOutputPath));
|
|
3206
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(normalized);
|
|
3207
|
-
root.walkAtRules("import", (rule) => {
|
|
3208
|
-
const parsed = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(rule.params);
|
|
3209
|
-
if (!parsed || output.cssOnly && !/\.css(?:$|[?#])/i.test(parsed.specifier) || !files.has(resolveOutputImportRequest(output.outputFile, parsed.specifier))) return;
|
|
3210
|
-
const request = normalizeMiniProgramOutputImportRequest(parsed.specifier);
|
|
3211
|
-
if (request !== parsed.specifier) rule.params = rule.params.replace(parsed.raw, (0, _weapp_tailwindcss_postcss.quoteCssImportSpecifier)(request, parsed.quote));
|
|
3212
|
-
});
|
|
3213
|
-
return root.toString();
|
|
3214
|
-
}
|
|
3215
|
-
function normalizeOutputPath(file) {
|
|
3216
|
-
const segments = [];
|
|
3217
|
-
for (const segment of file.replace(/\\/g, "/").replace(/^\/+/, "").split("/")) {
|
|
3218
|
-
if (!segment || segment === ".") continue;
|
|
3219
|
-
if (segment === "..") {
|
|
3220
|
-
if (segments.length > 0 && segments[segments.length - 1] !== "..") segments.pop();
|
|
3221
|
-
else segments.push(segment);
|
|
3222
|
-
continue;
|
|
3223
|
-
}
|
|
3224
|
-
segments.push(segment);
|
|
3225
|
-
}
|
|
3226
|
-
return segments.join("/");
|
|
3227
|
-
}
|
|
3228
|
-
function splitRequestSuffix(request) {
|
|
3229
|
-
const suffixIndexCandidates = [request.indexOf("?"), request.indexOf("#")].filter((index) => index >= 0);
|
|
3230
|
-
const suffixIndex = suffixIndexCandidates.length > 0 ? Math.min(...suffixIndexCandidates) : -1;
|
|
3231
|
-
return suffixIndex < 0 ? request : request.slice(0, suffixIndex);
|
|
3232
|
-
}
|
|
3233
|
-
function resolveOutputImportRequest(file, request) {
|
|
3234
|
-
const cleanRequest = splitRequestSuffix(request.replace(/\\/g, "/"));
|
|
3235
|
-
if (cleanRequest.startsWith("/")) return normalizeOutputPath(cleanRequest);
|
|
3236
|
-
const normalizedFile = normalizeOutputPath(file);
|
|
3237
|
-
const baseDir = normalizedFile.includes("/") ? normalizedFile.slice(0, normalizedFile.lastIndexOf("/")) : "";
|
|
3238
|
-
return normalizeOutputPath(baseDir ? `${baseDir}/${cleanRequest}` : cleanRequest);
|
|
3239
|
-
}
|
|
3240
|
-
function isMiniProgramOutputImport(node) {
|
|
3241
|
-
if (node.type !== "atrule" || node.name !== "import") return false;
|
|
3242
|
-
const request = require_generator.parseImportRequest(node.params);
|
|
3243
|
-
return request !== void 0 && MINI_PROGRAM_OUTPUT_STYLE_RE.test(request);
|
|
3244
|
-
}
|
|
3245
|
-
function isSelfMiniProgramOutputImport(outputFile, node) {
|
|
3246
|
-
if (node.type !== "atrule" || node.name !== "import") return false;
|
|
3247
|
-
const request = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(node.params)?.specifier;
|
|
3248
|
-
return request !== void 0 && /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(request) && resolveOutputImportRequest(outputFile, request) === normalizeOutputPath(outputFile);
|
|
3249
|
-
}
|
|
3250
|
-
function removeMiniProgramOutputImportsBy(css, predicate) {
|
|
3251
|
-
if (!css.includes("@import")) return css;
|
|
3252
|
-
try {
|
|
3253
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
3254
|
-
let changed = false;
|
|
3255
|
-
root.walk((node) => {
|
|
3256
|
-
if (predicate(node)) {
|
|
3257
|
-
node.remove();
|
|
3258
|
-
changed = true;
|
|
3259
|
-
}
|
|
3260
|
-
});
|
|
3261
|
-
return changed ? root.toString() : css;
|
|
3262
|
-
} catch {
|
|
3263
|
-
return css;
|
|
3264
|
-
}
|
|
3265
|
-
}
|
|
3266
|
-
function removeSelfMiniProgramOutputImports(css, outputFile) {
|
|
3267
|
-
return removeMiniProgramOutputImportsBy(css, (node) => isSelfMiniProgramOutputImport(outputFile, node));
|
|
3268
|
-
}
|
|
3269
|
-
function removeMiniProgramOutputImports(css) {
|
|
3270
|
-
return removeMiniProgramOutputImportsBy(css, isMiniProgramOutputImport);
|
|
3271
|
-
}
|
|
3272
|
-
function normalizeMiniProgramGeneratorCssSource(css, outputFile, outputFiles) {
|
|
3273
|
-
const normalized = normalizeMiniProgramImportShell(css, outputFile && outputFiles ? {
|
|
3274
|
-
outputFile,
|
|
3275
|
-
outputFiles
|
|
3276
|
-
} : void 0);
|
|
3277
|
-
if (outputFile) return removeSelfMiniProgramOutputImports(normalized, outputFile);
|
|
3278
|
-
return (0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(normalized) ? normalized : removeMiniProgramOutputImports(normalized);
|
|
2421
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(css, cleanedCompatCss);
|
|
3279
2422
|
}
|
|
3280
2423
|
//#endregion
|
|
3281
|
-
//#region src/
|
|
2424
|
+
//#region src/utils/run-tasks.ts
|
|
3282
2425
|
async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
|
|
3283
2426
|
if (factories.length === 0) return [];
|
|
3284
2427
|
const results = Array.from({ length: factories.length });
|
|
@@ -3315,31 +2458,16 @@ function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
|
3315
2458
|
queue.push(runWithConcurrency(factories, limit).then(() => void 0));
|
|
3316
2459
|
}
|
|
3317
2460
|
//#endregion
|
|
3318
|
-
//#region src/
|
|
3319
|
-
const AUTHOR_THEME_FUNCTION_RE = /(?:^|[^-\w])(?:theme|--theme)\(/;
|
|
3320
|
-
const AUTHOR_SPACING_FUNCTION_RE = /(?:--spacing|--alpha)\(/;
|
|
3321
|
-
const GENERATED_AUTHOR_FUNCTION_SKIP_MAX_LENGTH = 8192;
|
|
3322
|
-
/**
|
|
3323
|
-
* 判断这段 CSS 是否还需要走作者函数编译。
|
|
3324
|
-
*
|
|
3325
|
-
* `theme()` / `--theme()` 一定要编译。`--spacing()` / `--alpha()` 只在短小的作者 CSS 里保留;
|
|
3326
|
-
* 大段或带生成标记的样式里它们通常已是 Tailwind 工具输出,再 parse 会拖垮 generateBundle。
|
|
3327
|
-
*/
|
|
3328
|
-
function shouldCompileAuthorCssFunctions(css) {
|
|
3329
|
-
if (AUTHOR_THEME_FUNCTION_RE.test(css)) return true;
|
|
3330
|
-
if (!AUTHOR_SPACING_FUNCTION_RE.test(css)) return false;
|
|
3331
|
-
return css.length <= GENERATED_AUTHOR_FUNCTION_SKIP_MAX_LENGTH && !css.includes("weapp-tailwindcss") && !css.includes("tailwindcss v4");
|
|
3332
|
-
}
|
|
2461
|
+
//#region src/generation/user-css/compile-functions.ts
|
|
3333
2462
|
function createAuthorCssFunctionCompiler(sources, session) {
|
|
3334
2463
|
const cache = /* @__PURE__ */ new Map();
|
|
3335
2464
|
return (css) => {
|
|
3336
|
-
|
|
3337
|
-
return (0, _weapp_tailwindcss_postcss.compileTailwindAuthorFunctions)(css, async (values) => {
|
|
2465
|
+
return (0, _weapp_tailwindcss_postcss_transform.compileTailwindAuthorFunctions)(css, async (values) => {
|
|
3338
2466
|
const missing = [...new Set(values.filter((value) => !cache.has(value)))];
|
|
3339
2467
|
if (missing.length > 0) {
|
|
3340
2468
|
let selector = `.weapp-author-functions-${(0, _weapp_tailwindcss_shared_node.md5)(missing.join("\0"))}`;
|
|
3341
2469
|
while (sources.some((source) => source.css.includes(selector))) selector += "-probe";
|
|
3342
|
-
const probe = (0,
|
|
2470
|
+
const probe = (0, _weapp_tailwindcss_postcss_transform.createTailwindAuthorFunctionProbe)(missing, selector);
|
|
3343
2471
|
let resolved;
|
|
3344
2472
|
for (const source of sources) {
|
|
3345
2473
|
const result = await session.generate({
|
|
@@ -3363,25 +2491,13 @@ function createAuthorCssFunctionCompiler(sources, session) {
|
|
|
3363
2491
|
};
|
|
3364
2492
|
}
|
|
3365
2493
|
//#endregion
|
|
3366
|
-
//#region src/
|
|
3367
|
-
function normalizeCssClassSelector(value) {
|
|
3368
|
-
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
3369
|
-
}
|
|
3370
|
-
function collectRawSourceClassSelectors(rawSource) {
|
|
3371
|
-
const selectors = /* @__PURE__ */ new Set();
|
|
3372
|
-
try {
|
|
3373
|
-
_weapp_tailwindcss_postcss.postcss.parse(rawSource).walkRules((rule) => {
|
|
3374
|
-
for (const selector of rule.selectors ?? [rule.selector]) for (const match of selector.matchAll(/\.((?:\\.|[_a-z\u00A0-\uFFFF-])(?:\\.|[\w\u00A0-\uFFFF-])*)/gi)) if (match[1]) selectors.add(normalizeCssClassSelector(match[1]));
|
|
3375
|
-
});
|
|
3376
|
-
} catch {}
|
|
3377
|
-
return selectors;
|
|
3378
|
-
}
|
|
2494
|
+
//#region src/generation/class-selectors.ts
|
|
3379
2495
|
function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
3380
|
-
const selectors = collectRawSourceClassSelectors(rawSource);
|
|
2496
|
+
const selectors = (0, _weapp_tailwindcss_postcss_transform.collectRawSourceClassSelectors)(rawSource);
|
|
3381
2497
|
if (selectors.size === 0) return /* @__PURE__ */ new Set();
|
|
3382
2498
|
const matched = /* @__PURE__ */ new Set();
|
|
3383
2499
|
for (const candidate of candidates) {
|
|
3384
|
-
const escaped = normalizeCssClassSelector(require_compiler.replaceWxml(candidate, { escapeMap }));
|
|
2500
|
+
const escaped = (0, _weapp_tailwindcss_postcss_transform.normalizeCssClassSelector)(require_compiler.replaceWxml(candidate, { escapeMap }));
|
|
3385
2501
|
if (selectors.has(candidate) || selectors.has(escaped)) matched.add(candidate);
|
|
3386
2502
|
}
|
|
3387
2503
|
return matched;
|
|
@@ -3392,27 +2508,7 @@ function collectGeneratedRawSourceCandidatesFromCss(candidates, cssSources, esca
|
|
|
3392
2508
|
return matched;
|
|
3393
2509
|
}
|
|
3394
2510
|
//#endregion
|
|
3395
|
-
//#region src/
|
|
3396
|
-
function collectCssRuleIdentityMarkers(source) {
|
|
3397
|
-
const markers = /* @__PURE__ */ new Set();
|
|
3398
|
-
try {
|
|
3399
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
3400
|
-
root.walkRules((rule) => {
|
|
3401
|
-
for (const selector of rule.selectors ?? [rule.selector]) for (const match of selector.matchAll(/\.((?:\\.|[_a-z\u00A0-\uFFFF-])(?:\\.|[\w\u00A0-\uFFFF-])*)/gi)) markers.add(`class:${match[1]}`);
|
|
3402
|
-
});
|
|
3403
|
-
root.walkAtRules("keyframes", (rule) => {
|
|
3404
|
-
if (rule.params) markers.add(`keyframes:${rule.params}`);
|
|
3405
|
-
});
|
|
3406
|
-
} catch {}
|
|
3407
|
-
return markers;
|
|
3408
|
-
}
|
|
3409
|
-
function isCssAlreadyRepresentedByMarkers(css, source) {
|
|
3410
|
-
const sourceMarkers = collectCssRuleIdentityMarkers(source);
|
|
3411
|
-
if (sourceMarkers.size === 0) return false;
|
|
3412
|
-
const cssMarkers = collectCssRuleIdentityMarkers(css);
|
|
3413
|
-
for (const marker of sourceMarkers) if (!cssMarkers.has(marker)) return false;
|
|
3414
|
-
return true;
|
|
3415
|
-
}
|
|
2511
|
+
//#region src/generation/result-helpers.ts
|
|
3416
2512
|
function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
3417
2513
|
const merged = new Set(classSet);
|
|
3418
2514
|
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
@@ -3423,22 +2519,22 @@ function resolveGeneratedCssClassSet(target, classSet, candidates, css, escapeMa
|
|
|
3423
2519
|
return mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap);
|
|
3424
2520
|
}
|
|
3425
2521
|
function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
3426
|
-
return target === "web" ? (0,
|
|
2522
|
+
return target === "web" ? (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(css, webCompat) : css;
|
|
3427
2523
|
}
|
|
3428
2524
|
function finalizeIncrementalGeneratorCss(previousCss, incrementalCss, target, majorVersion, cssPreflight, options, webCompat) {
|
|
3429
2525
|
const finalizedIncrementalCss = finalizeMiniProgramGeneratorCss(incrementalCss, target, majorVersion, cssPreflight, options);
|
|
3430
|
-
if (target === "web") return
|
|
3431
|
-
return
|
|
2526
|
+
if (target === "web") return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(previousCss, finalizeWebGeneratorCss(finalizedIncrementalCss, target, webCompat));
|
|
2527
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(previousCss, finalizedIncrementalCss);
|
|
3432
2528
|
}
|
|
3433
2529
|
//#endregion
|
|
3434
|
-
//#region src/
|
|
2530
|
+
//#region src/generation/pipeline/deferred-output.ts
|
|
3435
2531
|
async function finalizeDeferredGeneratorCss(context) {
|
|
3436
2532
|
const { cssUserHandlerOptions, file, filterGeneratedApplyOnlyCss, generated, generatedUserCssRawSource, generatorOptions, generatorRawSource, generatorStyleOptions, hasMatchedCssSourceFile, localImports, majorVersion, options, opts, preflightMode, runtimeWithCurrentCss, styleHandler, userCssOrderSource, userRawSourceProcessed } = context;
|
|
3437
2533
|
if (options.deferCssAdaptation) {
|
|
3438
2534
|
const normalizeDeferredGeneratedCss = async (css) => {
|
|
3439
|
-
const rawCss =
|
|
3440
|
-
const generationCss = generated.target === "weapp" && ((0,
|
|
3441
|
-
const normalizedCss = generated.target === "weapp" ? await (0,
|
|
2535
|
+
const rawCss = (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(css);
|
|
2536
|
+
const generationCss = generated.target === "weapp" && ((0, _weapp_tailwindcss_postcss_transform.hasCssMacroStyleOptions)(generatorStyleOptions) || (0, _weapp_tailwindcss_postcss_transform.hasCssMacroTailwindV4InternalAtRules)(rawCss)) ? await (0, _weapp_tailwindcss_postcss_transform.transformCssMacroCss)(rawCss, generatorStyleOptions) : rawCss;
|
|
2537
|
+
const normalizedCss = generated.target === "weapp" ? await (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratedCssForPostcss)(generationCss, {
|
|
3442
2538
|
preservePreflight: true,
|
|
3443
2539
|
preserveRawClassRules: true
|
|
3444
2540
|
}) : generationCss;
|
|
@@ -3457,28 +2553,30 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3457
2553
|
processed: userRawSourceProcessed
|
|
3458
2554
|
};
|
|
3459
2555
|
const transformDeferredUserCss = async (source) => {
|
|
3460
|
-
const parts =
|
|
3461
|
-
const layerCss = await
|
|
3462
|
-
const restCss = await
|
|
3463
|
-
return createCssSourceOrderAppend(wrapUserLayerComponentsCss(layerCss), restCss);
|
|
2556
|
+
const parts = (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(source);
|
|
2557
|
+
const layerCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.layer, userCssOptions);
|
|
2558
|
+
const restCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(parts.rest, userCssOptions);
|
|
2559
|
+
return (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerCss), restCss);
|
|
3464
2560
|
};
|
|
3465
|
-
const orderedUserCss =
|
|
2561
|
+
const orderedUserCss = (0, _weapp_tailwindcss_postcss_transform.splitGeneratorPlaceholderCssBySourceOrder)(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
3466
2562
|
if (orderedUserCss) {
|
|
3467
2563
|
const beforeUserCss = await transformDeferredUserCss(orderedUserCss.before);
|
|
3468
2564
|
const afterUserCss = await transformDeferredUserCss(orderedUserCss.after);
|
|
3469
|
-
const
|
|
3470
|
-
|
|
2565
|
+
const missingBeforeUserCss = (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, beforeUserCss);
|
|
2566
|
+
const cssWithBeforeUserCss = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(missingBeforeUserCss, css);
|
|
2567
|
+
const missingAfterUserCss = (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(cssWithBeforeUserCss, afterUserCss);
|
|
2568
|
+
return (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(cssWithBeforeUserCss, missingAfterUserCss));
|
|
3471
2569
|
}
|
|
3472
2570
|
const userCss = await transformDeferredUserCss(generatedUserCssRawSource);
|
|
3473
|
-
return reorderMarkedUserLayerComponentsCss(createCssSourceOrderAppend(css, (0,
|
|
2571
|
+
return (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss)));
|
|
3474
2572
|
};
|
|
3475
|
-
const canAppendIncrementalCss = generated.target !== "weapp" || !
|
|
2573
|
+
const canAppendIncrementalCss = generated.target !== "weapp" || !(0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource);
|
|
3476
2574
|
const incrementalRawCss = generated.incrementalRawCss ?? generated.incrementalCss;
|
|
3477
2575
|
const previousCss = options.previousCss;
|
|
3478
2576
|
const shouldAppendIncrementalCss = canAppendIncrementalCss && typeof previousCss === "string" && typeof incrementalRawCss === "string";
|
|
3479
|
-
const normalizedCss = shouldAppendIncrementalCss ? incrementalRawCss.trim().length > 0 ?
|
|
2577
|
+
const normalizedCss = shouldAppendIncrementalCss ? incrementalRawCss.trim().length > 0 ? (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(previousCss, await normalizeDeferredGeneratedCss(incrementalRawCss)) : previousCss : await normalizeDeferredGeneratedCss(generated.rawCss ?? generated.css);
|
|
3480
2578
|
const intermediateCss = shouldAppendIncrementalCss ? normalizedCss : await restoreDeferredUserCss(normalizedCss);
|
|
3481
|
-
const css = (0,
|
|
2579
|
+
const css = (0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(intermediateCss, localImports, { outputFile: file });
|
|
3482
2580
|
return {
|
|
3483
2581
|
css,
|
|
3484
2582
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, css, opts.escapeMap, options.previousClassSet),
|
|
@@ -3496,28 +2594,31 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3496
2594
|
}
|
|
3497
2595
|
}
|
|
3498
2596
|
//#endregion
|
|
3499
|
-
//#region src/
|
|
2597
|
+
//#region src/generation/pipeline/fallback-output.ts
|
|
3500
2598
|
async function finalizeFallbackGeneratorCss(context) {
|
|
3501
2599
|
const { configuredContainerCompat, cssHandlerOptions, cssUserHandlerOptions, debug, file, finalizeGeneratorCss, generated, generatedCss, generatedUserCssRawSource, generatorOptions, generatorRawSource, generatorStyleOptions, hasDistinctUserRawSource, hasGeneratedCss, hasGeneratedMarkers, hasMatchedCssSourceFile, hasSourceDirectives, hasWebUserCssFallbackSource, isolateCurrentCssCandidates, legacyCompatUserCssRawSource, majorVersion, options, opts, preflightMode, prepareFinalGeneratorCss, runtime, runtimeWithCurrentCss, shouldFilterApplyOnlyCss, shouldPreserveLegacyCompatSelectorOverrides, styleHandler, userCssRawSource, userRawSourceProcessed } = context;
|
|
3502
2600
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
3503
2601
|
let css = generatedCss;
|
|
3504
|
-
const distinctUserLayerParts = hasDistinctUserRawSource &&
|
|
2602
|
+
const distinctUserLayerParts = hasDistinctUserRawSource && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatedUserCssRawSource) : void 0;
|
|
3505
2603
|
let restoredDistinctUserLayerCss = false;
|
|
3506
|
-
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
2604
|
+
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !(0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource)) {
|
|
2605
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(generatedUserCssRawSource, {
|
|
2606
|
+
generatorTarget: generated.target,
|
|
2607
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
2608
|
+
generatedSource: generated.rawCss,
|
|
2609
|
+
generatorStyleOptions,
|
|
2610
|
+
cssUserHandlerOptions,
|
|
2611
|
+
styleHandler,
|
|
2612
|
+
importFallback: generatorOptions.importFallback,
|
|
2613
|
+
processed: userRawSourceProcessed
|
|
2614
|
+
});
|
|
2615
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(userCss, css);
|
|
2616
|
+
}
|
|
3516
2617
|
if (generated.target === "weapp") {
|
|
3517
|
-
css = (0,
|
|
3518
|
-
if (
|
|
3519
|
-
const layerParts =
|
|
3520
|
-
const layerUserCss = await
|
|
2618
|
+
css = (0, _weapp_tailwindcss_postcss_transform.inheritLegacyUnitConvertedDeclarations)(css, generatorRawSource);
|
|
2619
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource)) {
|
|
2620
|
+
const layerParts = (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatorRawSource);
|
|
2621
|
+
const layerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(layerParts.layer, {
|
|
3521
2622
|
generatorTarget: generated.target,
|
|
3522
2623
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3523
2624
|
generatedSource: generated.rawCss,
|
|
@@ -3527,17 +2628,17 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3527
2628
|
importFallback: generatorOptions.importFallback,
|
|
3528
2629
|
processed: userRawSourceProcessed
|
|
3529
2630
|
});
|
|
3530
|
-
const layerCss = layerUserCss.trim().length > 0 && !
|
|
2631
|
+
const layerCss = layerUserCss.trim().length > 0 && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(layerUserCss) ? {
|
|
3531
2632
|
layer: layerUserCss,
|
|
3532
2633
|
rest: css
|
|
3533
|
-
} :
|
|
2634
|
+
} : (0, _weapp_tailwindcss_postcss_transform.extractGeneratedCssForUserLayerSelectors)(css, layerParts.layer);
|
|
3534
2635
|
if (layerCss.layer.trim().length > 0) {
|
|
3535
|
-
css = createCssSourceOrderAppend(wrapUserLayerComponentsCss(layerCss.layer), layerCss.rest);
|
|
3536
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2636
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerCss.layer), layerCss.rest);
|
|
2637
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3537
2638
|
}
|
|
3538
2639
|
}
|
|
3539
2640
|
if (hasDistinctUserRawSource && distinctUserLayerParts) {
|
|
3540
|
-
const layerUserCss = await
|
|
2641
|
+
const layerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(distinctUserLayerParts.layer, {
|
|
3541
2642
|
generatorTarget: generated.target,
|
|
3542
2643
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3543
2644
|
generatedSource: generated.rawCss,
|
|
@@ -3547,17 +2648,17 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3547
2648
|
importFallback: generatorOptions.importFallback,
|
|
3548
2649
|
processed: userRawSourceProcessed
|
|
3549
2650
|
});
|
|
3550
|
-
if ((0,
|
|
3551
|
-
css = createCssSourceOrderAppend(wrapUserLayerComponentsCss(layerUserCss), css);
|
|
2651
|
+
if ((0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, layerUserCss).trim().length > 0) {
|
|
2652
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerUserCss), css);
|
|
3552
2653
|
restoredDistinctUserLayerCss = true;
|
|
3553
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2654
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3554
2655
|
}
|
|
3555
2656
|
}
|
|
3556
2657
|
}
|
|
3557
2658
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
3558
2659
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
3559
2660
|
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
3560
|
-
const userCss = await
|
|
2661
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(distinctUserCssRawSource, {
|
|
3561
2662
|
generatorTarget: generated.target,
|
|
3562
2663
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3563
2664
|
generatedSource: generated.rawCss,
|
|
@@ -3567,12 +2668,12 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3567
2668
|
importFallback: generatorOptions.importFallback,
|
|
3568
2669
|
processed: userRawSourceProcessed
|
|
3569
2670
|
});
|
|
3570
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, distinctUserCssRawSource) ? (0,
|
|
3571
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2671
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCssAlreadyRepresentedByMarkers)(css, distinctUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss) : userCss;
|
|
2672
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3572
2673
|
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
3573
|
-
const cleanedUserCssRawSource =
|
|
3574
|
-
const cleanedUserCssRestSource = restoredDistinctUserLayerCss &&
|
|
3575
|
-
const userCss = await
|
|
2674
|
+
const cleanedUserCssRawSource = (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratedUserCssArtifacts)(userCssRawSource, generated.rawCss);
|
|
2675
|
+
const cleanedUserCssRestSource = restoredDistinctUserLayerCss && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(cleanedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(cleanedUserCssRawSource).rest : cleanedUserCssRawSource;
|
|
2676
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(cleanedUserCssRestSource, {
|
|
3576
2677
|
generatorTarget: generated.target,
|
|
3577
2678
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3578
2679
|
generatedSource: generated.rawCss,
|
|
@@ -3582,10 +2683,10 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3582
2683
|
importFallback: generatorOptions.importFallback,
|
|
3583
2684
|
processed: userRawSourceProcessed
|
|
3584
2685
|
});
|
|
3585
|
-
const missingUserCss = (0,
|
|
3586
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
3587
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" &&
|
|
3588
|
-
const layerUserCss = await
|
|
2686
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss);
|
|
2687
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
2688
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource)) {
|
|
2689
|
+
const layerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)((0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatedUserCssRawSource).layer, {
|
|
3589
2690
|
generatorTarget: generated.target,
|
|
3590
2691
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3591
2692
|
generatedSource: generated.rawCss,
|
|
@@ -3596,8 +2697,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3596
2697
|
processed: userRawSourceProcessed
|
|
3597
2698
|
});
|
|
3598
2699
|
if (layerUserCss.trim().length > 0) {
|
|
3599
|
-
css = createCssSourceOrderAppend(css, wrapUserLayerComponentsCss(layerUserCss));
|
|
3600
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2700
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, (0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)(layerUserCss));
|
|
2701
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3601
2702
|
}
|
|
3602
2703
|
}
|
|
3603
2704
|
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
@@ -3607,7 +2708,7 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3607
2708
|
hasSourceDirectives,
|
|
3608
2709
|
hasMatchedCssSourceFile
|
|
3609
2710
|
})) {
|
|
3610
|
-
const userCss = await
|
|
2711
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(generatedUserCssRawSource, {
|
|
3611
2712
|
generatorTarget: generated.target,
|
|
3612
2713
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3613
2714
|
generatedSource: generated.rawCss,
|
|
@@ -3617,8 +2718,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3617
2718
|
importFallback: generatorOptions.importFallback,
|
|
3618
2719
|
processed: userRawSourceProcessed
|
|
3619
2720
|
});
|
|
3620
|
-
const missingUserCss =
|
|
3621
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2721
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCommentOnlyCss)(userCss) ? "" : (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss);
|
|
2722
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3622
2723
|
}
|
|
3623
2724
|
const finalCss = finalizeGeneratorCss(prepareFinalGeneratorCss(css), generated.target, {
|
|
3624
2725
|
injectPreflight: preflightMode.inject,
|
|
@@ -3646,9 +2747,9 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3646
2747
|
});
|
|
3647
2748
|
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
3648
2749
|
}
|
|
3649
|
-
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !
|
|
2750
|
+
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(generatedUserCssRawSource)) {
|
|
3650
2751
|
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
3651
|
-
const userCss = await
|
|
2752
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(distinctUserCssRawSource, {
|
|
3652
2753
|
generatorTarget: generated.target,
|
|
3653
2754
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3654
2755
|
generatedSource: generated.rawCss,
|
|
@@ -3658,8 +2759,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3658
2759
|
importFallback: generatorOptions.importFallback,
|
|
3659
2760
|
processed: userRawSourceProcessed
|
|
3660
2761
|
});
|
|
3661
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, distinctUserCssRawSource) ? (0,
|
|
3662
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2762
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCssAlreadyRepresentedByMarkers)(css, distinctUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss) : userCss;
|
|
2763
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3663
2764
|
}
|
|
3664
2765
|
const finalCss = finalizeGeneratorCss(prepareFinalGeneratorCss(css), generated.target, {
|
|
3665
2766
|
injectPreflight: preflightMode.inject,
|
|
@@ -3680,17 +2781,17 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3680
2781
|
};
|
|
3681
2782
|
}
|
|
3682
2783
|
//#endregion
|
|
3683
|
-
//#region src/
|
|
2784
|
+
//#region src/generation/pipeline/ordered-output.ts
|
|
3684
2785
|
async function finalizeOrderedGeneratorCss(context) {
|
|
3685
2786
|
const { configuredContainerCompat, cssHandlerOptions, cssUserHandlerOptions, file, filterGeneratedApplyOnlyCss, finalizeGeneratorCss, generated, generatedUserCssRawSource, generatorOptions, generatorRawSource, generatorStyleOptions, hasDistinctUserRawSource, hasGeneratedCss, hasGeneratedMarkers, hasMatchedCssSourceFile, hasSourceDirectives, hasWebUserCssFallbackSource, isolateCurrentCssCandidates, legacyCompatUserCssRawSource, localImports, majorVersion, options, opts, preflightMode, prepareFinalGeneratorCss, runtime, runtimeWithCurrentCss, shouldFilterApplyOnlyCss, shouldPreserveLegacyCompatSelectorOverrides, styleHandler, userCssOrderSource, userCssRawSource, userRawSourceProcessed } = context;
|
|
3686
|
-
if ((generated.target !== "weapp" || !
|
|
3687
|
-
const incrementalCss =
|
|
2787
|
+
if ((generated.target !== "weapp" || !(0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2788
|
+
const incrementalCss = (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(generated.incrementalCss);
|
|
3688
2789
|
const css = incrementalCss.trim().length > 0 ? finalizeIncrementalGeneratorCss(options.previousCss, incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
3689
2790
|
injectPreflight: false,
|
|
3690
2791
|
removeEmptyAtRuleAncestors: false,
|
|
3691
2792
|
styleOptions: generatorStyleOptions
|
|
3692
2793
|
}, generatorOptions.webCompat) : options.previousCss;
|
|
3693
|
-
const finalCss = generated.target === "web" ? (0,
|
|
2794
|
+
const finalCss = generated.target === "web" ? (0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(css, localImports, { outputFile: file }) : finalizeWebGeneratorCss((0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(css, localImports, { outputFile: file }), generated.target, generatorOptions.webCompat);
|
|
3694
2795
|
return {
|
|
3695
2796
|
css: finalCss,
|
|
3696
2797
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
@@ -3705,12 +2806,12 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3705
2806
|
}
|
|
3706
2807
|
};
|
|
3707
2808
|
}
|
|
3708
|
-
const generatedCss = filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css :
|
|
3709
|
-
const orderedExtraCss =
|
|
2809
|
+
const generatedCss = filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css : (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(generated.css));
|
|
2810
|
+
const orderedExtraCss = (0, _weapp_tailwindcss_postcss_transform.splitGeneratorPlaceholderCssBySourceOrder)(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
3710
2811
|
const shouldAppendMatchedCssSourceCompat = !hasMatchedCssSourceFile || orderedExtraCss !== void 0;
|
|
3711
2812
|
if (orderedExtraCss) {
|
|
3712
2813
|
let css = generatedCss;
|
|
3713
|
-
if (generated.target === "weapp") css = (0,
|
|
2814
|
+
if (generated.target === "weapp") css = (0, _weapp_tailwindcss_postcss_transform.inheritLegacyUnitConvertedDeclarations)(css, generatorRawSource);
|
|
3714
2815
|
const userCssOptions = {
|
|
3715
2816
|
generatorTarget: generated.target,
|
|
3716
2817
|
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
@@ -3721,34 +2822,35 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3721
2822
|
importFallback: generatorOptions.importFallback,
|
|
3722
2823
|
processed: userRawSourceProcessed
|
|
3723
2824
|
};
|
|
3724
|
-
const afterLayerParts = generated.target === "weapp" ?
|
|
2825
|
+
const afterLayerParts = generated.target === "weapp" ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(orderedExtraCss.after) : {
|
|
3725
2826
|
layer: "",
|
|
3726
2827
|
rest: orderedExtraCss.after
|
|
3727
2828
|
};
|
|
3728
|
-
const beforeUserCss = await
|
|
3729
|
-
const afterLayerUserCss = await
|
|
3730
|
-
const afterUserCss = await
|
|
3731
|
-
const fallbackLayerUserCss = generated.target === "weapp" &&
|
|
3732
|
-
|
|
2829
|
+
const beforeUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(orderedExtraCss.before, userCssOptions);
|
|
2830
|
+
const afterLayerUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(afterLayerParts.layer, userCssOptions);
|
|
2831
|
+
const afterUserCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(afterLayerParts.rest, userCssOptions);
|
|
2832
|
+
const fallbackLayerUserCss = generated.target === "weapp" && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(userCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(afterLayerUserCss, await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)((0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(userCssRawSource).layer, userCssOptions)) : "";
|
|
2833
|
+
const orderedAfterLayerUserCss = generated.target === "weapp" ? (0, _weapp_tailwindcss_postcss_transform.wrapUserLayerComponentsCss)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(afterLayerUserCss, fallbackLayerUserCss)) : afterLayerUserCss;
|
|
2834
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)((0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(beforeUserCss, orderedAfterLayerUserCss), css), afterUserCss);
|
|
3733
2835
|
if (hasWebUserCssFallbackSource && isEmptyCssSourceOrderParts(orderedExtraCss) && shouldAppendWebBundleCssFallback(generated.target, {
|
|
3734
2836
|
hasSourceDirectives,
|
|
3735
2837
|
hasMatchedCssSourceFile
|
|
3736
2838
|
})) {
|
|
3737
|
-
const userCss = await
|
|
3738
|
-
css = createCssSourceOrderAppend(css, userCss);
|
|
2839
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(userCssRawSource, userCssOptions);
|
|
2840
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, userCss);
|
|
3739
2841
|
}
|
|
3740
2842
|
if (generated.target === "web" && hasWebUserCssFallbackSource) {
|
|
3741
|
-
const userCss = await
|
|
3742
|
-
const missingUserCss =
|
|
3743
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2843
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(userCssRawSource, userCssOptions);
|
|
2844
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCommentOnlyCss)(userCss) ? "" : (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss);
|
|
2845
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3744
2846
|
}
|
|
3745
|
-
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !
|
|
3746
|
-
const userCss = await
|
|
3747
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0,
|
|
3748
|
-
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
2847
|
+
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !(0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(generatedUserCssRawSource)) {
|
|
2848
|
+
const userCss = await (0, _weapp_tailwindcss_postcss_transform.transformGeneratorUserCss)(generatedUserCssRawSource, userCssOptions);
|
|
2849
|
+
const missingUserCss = (0, _weapp_tailwindcss_postcss_transform.isCssAlreadyRepresentedByMarkers)(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.filterExistingCssRules)(css, userCss) : userCss;
|
|
2850
|
+
css = (0, _weapp_tailwindcss_postcss_transform.createCssSourceOrderAppend)(css, missingUserCss);
|
|
3749
2851
|
}
|
|
3750
2852
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
3751
|
-
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2853
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3752
2854
|
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
3753
2855
|
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
3754
2856
|
preserveSelectorOverrides: shouldPreserveLegacyCompatSelectorOverrides,
|
|
@@ -3757,7 +2859,7 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3757
2859
|
});
|
|
3758
2860
|
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
3759
2861
|
}
|
|
3760
|
-
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2862
|
+
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = (0, _weapp_tailwindcss_postcss_transform.reorderMarkedUserLayerComponentsCss)(css);
|
|
3761
2863
|
const finalCss = finalizeGeneratorCss(prepareFinalGeneratorCss(css), generated.target, {
|
|
3762
2864
|
injectPreflight: preflightMode.inject,
|
|
3763
2865
|
preservePreflight: preflightMode.preserve,
|
|
@@ -3778,7 +2880,7 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3778
2880
|
}
|
|
3779
2881
|
}
|
|
3780
2882
|
//#endregion
|
|
3781
|
-
//#region src/
|
|
2883
|
+
//#region src/generation/pipeline/preparation.ts
|
|
3782
2884
|
function resolveGeneratorSourceConcurrency() {
|
|
3783
2885
|
const configured = Number.parseInt(node_process.default.env["WEAPP_TW_GENERATOR_SOURCE_CONCURRENCY"] ?? "", 10);
|
|
3784
2886
|
return Number.isFinite(configured) && configured > 0 ? configured : 1;
|
|
@@ -3799,14 +2901,9 @@ function resolveCompilationDependencies(dependencies) {
|
|
|
3799
2901
|
kind: isSourceStyleRequest(id) ? "css" : "config"
|
|
3800
2902
|
}));
|
|
3801
2903
|
}
|
|
3802
|
-
async function
|
|
3803
|
-
return require_compiler.runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, require_compiler.getCompilationSessionPool(context.runtimeState), require_compiler.getTailwindGenerationSessionPool(context.runtimeState)));
|
|
3804
|
-
}
|
|
3805
|
-
async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
|
|
2904
|
+
async function prepareGeneratorInputs(context) {
|
|
3806
2905
|
const { cssHandlerOptions, debug, file, generatorBranch, generatorOptions, generatorRawSource, getSourceCandidatesForEntries, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, normalizeGeneratorSource, normalizedCssSources, options, opts, runtime, runtimeState, useMiniProgramCssBranch } = context;
|
|
3807
|
-
|
|
3808
|
-
const compilerSession = options.compilation?.enabled ? require_compiler.getFrameworkCompilerSession(runtimeState, opts) : void 0;
|
|
3809
|
-
const currentCssCandidates = collectGeneratorCssCandidates(generatorRawSource);
|
|
2906
|
+
const currentCssCandidates = (0, _weapp_tailwindcss_postcss_transform.collectGeneratorCssCandidates)(generatorRawSource);
|
|
3810
2907
|
const isolateCurrentCssCandidates = shouldIsolateCurrentTailwindV4CssCandidates(majorVersion, cssHandlerOptions, {
|
|
3811
2908
|
hasGeneratedCss,
|
|
3812
2909
|
hasGeneratedMarkers,
|
|
@@ -3826,46 +2923,65 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3826
2923
|
const generatorStyleOptions = resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorOptions.styleOptions);
|
|
3827
2924
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(generatorSourceRecords.map((record) => record.source));
|
|
3828
2925
|
const sourceConcurrency = resolveGeneratorSourceConcurrency();
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
}
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
isolateCssSource
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
2926
|
+
return {
|
|
2927
|
+
isolateCurrentCssCandidates,
|
|
2928
|
+
runtimeWithCurrentCss,
|
|
2929
|
+
generatorSourceRecords,
|
|
2930
|
+
generatorStyleOptions,
|
|
2931
|
+
configuredContainerCompat,
|
|
2932
|
+
sourceConcurrency,
|
|
2933
|
+
preparedGenerationInputs: (await runWithConcurrency(generatorSourceRecords.map((record, index) => async () => {
|
|
2934
|
+
const { metadata: sourceMetadata, source } = record;
|
|
2935
|
+
const sourceCss = options.deferCssAdaptation ? (0, _weapp_tailwindcss_postcss_transform.removeMatchingLocalCssImports)(source.css, localImports) : source.css;
|
|
2936
|
+
const generatorSource = options.disableSourceScan === true ? {
|
|
2937
|
+
...source,
|
|
2938
|
+
css: (0, _weapp_tailwindcss_postcss_transform.removeTailwindSourceDirectives)(sourceCss, {
|
|
2939
|
+
importFallback: generatorOptions.importFallback,
|
|
2940
|
+
preserveApplyContext: true
|
|
2941
|
+
})
|
|
2942
|
+
} : sourceCss === source.css ? source : {
|
|
2943
|
+
...source,
|
|
2944
|
+
css: sourceCss
|
|
2945
|
+
};
|
|
2946
|
+
const sourceEntries = getSourceCandidatesForEntries ? await resolveGeneratorSourceEntries(record, runtimeState) : void 0;
|
|
2947
|
+
const sourceScopedRuntime = sourceEntries && sourceEntries.length > 0 ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
2948
|
+
const scopedRuntime = resolveScopedRuntimeCandidates(options.sourceCandidates, sourceScopedRuntime);
|
|
2949
|
+
const isolateCssSource = shouldIsolateScopedCssSource(majorVersion, record, sourceEntries, {
|
|
2950
|
+
cssHandlerOptions,
|
|
2951
|
+
target: generatorOptions.target
|
|
2952
|
+
});
|
|
2953
|
+
const matchedCssSourceFile = Boolean(sourceMetadata?.matchedCssSourceFile);
|
|
2954
|
+
if (options.deferEmptyScopedCssSource && isolateCssSource && scopedRuntime?.size === 0 && currentCssCandidates.length === 0 && !cssHandlerOptions.isMainChunk) {
|
|
2955
|
+
debug("defer empty scoped css source generation: %s", file);
|
|
2956
|
+
return;
|
|
2957
|
+
}
|
|
2958
|
+
const sourceRuntime = scopedRuntime && (scopedRuntime.size > 0 || isolateCssSource) || isolateCssSource ? isolateCurrentCssCandidates ? runtimeWithCurrentCss : mergeScopedRuntimeWithCurrentRuntime(scopedRuntime ?? /* @__PURE__ */ new Set(), runtimeWithCurrentCss, {
|
|
2959
|
+
currentCssCandidates,
|
|
2960
|
+
cssHandlerOptions,
|
|
2961
|
+
isolateCssSource,
|
|
2962
|
+
majorVersion,
|
|
2963
|
+
matchedCssSourceFile
|
|
2964
|
+
}) : runtimeWithCurrentCss;
|
|
2965
|
+
return {
|
|
2966
|
+
generatorRuntime: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? require_generator.filterUnsupportedMiniProgramTailwindV4Candidates(sourceRuntime) : sourceRuntime,
|
|
2967
|
+
generatorSource,
|
|
2968
|
+
dependencies: resolveCompilationDependencies(record.source.dependencies),
|
|
2969
|
+
isolateCssSource,
|
|
2970
|
+
sourceId: resolveCompilationSourceId(record, index)
|
|
2971
|
+
};
|
|
2972
|
+
}), sourceConcurrency)).filter((item) => Boolean(item))
|
|
2973
|
+
};
|
|
2974
|
+
}
|
|
2975
|
+
//#endregion
|
|
2976
|
+
//#region src/generation/pipeline/execution.ts
|
|
2977
|
+
async function executeGeneratorPipeline(context) {
|
|
2978
|
+
return require_compiler.runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, require_compiler.getCompilationSessionPool(context.runtimeState), require_compiler.getTailwindGenerationSessionPool(context.runtimeState)));
|
|
2979
|
+
}
|
|
2980
|
+
async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
|
|
2981
|
+
const { cssHandlerOptions, debug, file, generatorOptions, generatorRawSource, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, options, opts, runtimeState } = context;
|
|
2982
|
+
await runtimeState.readyPromise;
|
|
2983
|
+
const compilerSession = options.compilation?.enabled ? require_compiler.getFrameworkCompilerSession(runtimeState, opts) : void 0;
|
|
2984
|
+
const { isolateCurrentCssCandidates, runtimeWithCurrentCss, generatorSourceRecords, generatorStyleOptions, configuredContainerCompat, sourceConcurrency, preparedGenerationInputs } = await prepareGeneratorInputs(context);
|
|
3869
2985
|
const generatePreparedInputs = async (candidateSets) => {
|
|
3870
2986
|
return runWithConcurrency(preparedGenerationInputs.map((input) => async () => {
|
|
3871
2987
|
const projectedCandidates = candidateSets?.get(input.sourceId);
|
|
@@ -3943,17 +3059,17 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3943
3059
|
const appEntryMatchedByCandidates = metadata?.candidateMatchedCssSource === true && metadata.cssEntryIndex === 0 && metadata.cssSourceIndex === void 0;
|
|
3944
3060
|
return metadata?.includesPreflight === true && !appEntryMatchedByCandidates;
|
|
3945
3061
|
});
|
|
3946
|
-
const hasPreflightRawSource =
|
|
3062
|
+
const hasPreflightRawSource = (0, _weapp_tailwindcss_postcss_transform.includesTailwindV4PreflightDirective)(generatorRawSource);
|
|
3947
3063
|
const hasOnlyPrimaryCssSource = generatorSourceRecords.length > 0 && generatorSourceRecords.every(({ metadata }) => {
|
|
3948
3064
|
return metadata?.candidateMatchedCssSource !== true && metadata?.primaryCssSource === true;
|
|
3949
3065
|
});
|
|
3950
|
-
const shouldFilterApplyOnlyCss =
|
|
3066
|
+
const shouldFilterApplyOnlyCss = shouldFilterApplyOnlyGeneratedCss(majorVersion, generated.target, generatorRawSource, {
|
|
3951
3067
|
hasGeneratedCss,
|
|
3952
3068
|
hasGeneratedMarkers
|
|
3953
3069
|
});
|
|
3954
3070
|
const filterGeneratedApplyOnlyCss = (css) => {
|
|
3955
3071
|
if (!shouldFilterApplyOnlyCss) return css;
|
|
3956
|
-
return
|
|
3072
|
+
return (0, _weapp_tailwindcss_postcss_transform.filterTailwindV4ApplyOnlyGeneratedCss)(css, generatorRawSource, {
|
|
3957
3073
|
preserveVariables: generated.target !== "web",
|
|
3958
3074
|
preserveRuntimeProperties: generated.target === "web" && opts.appType === "uni-app-x"
|
|
3959
3075
|
});
|
|
@@ -3978,7 +3094,7 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3978
3094
|
configuredContainerCompat,
|
|
3979
3095
|
filterGeneratedApplyOnlyCss,
|
|
3980
3096
|
generated,
|
|
3981
|
-
generatedCss: filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css :
|
|
3097
|
+
generatedCss: filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css : (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(generated.css)),
|
|
3982
3098
|
generatorStyleOptions,
|
|
3983
3099
|
hasMatchedCssSourceFile,
|
|
3984
3100
|
isolateCurrentCssCandidates,
|
|
@@ -3987,6 +3103,7 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3987
3103
|
shouldFilterApplyOnlyCss
|
|
3988
3104
|
};
|
|
3989
3105
|
const withCompilationMetadata = (result) => {
|
|
3106
|
+
if (result && shouldCheckRpxThemeRisk(runtimeState, generated.target, opts, options.generatorPlatform)) result.rpxThemeVariables = [.../* @__PURE__ */ new Set([...preparedGenerationInputs.flatMap((input) => input.generatorSource.rpxThemeVariables ?? []), ...collectRpxThemeRiskSources([generatorRawSource, ...preparedGenerationInputs.map((input) => input.generatorSource.css)])])];
|
|
3990
3107
|
if (result && frameworkProcessedUserCss !== void 0) result = {
|
|
3991
3108
|
...result,
|
|
3992
3109
|
compileAuthorCssFunctions,
|
|
@@ -4003,11 +3120,10 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4003
3120
|
}
|
|
4004
3121
|
};
|
|
4005
3122
|
};
|
|
4006
|
-
|
|
4007
|
-
return withCompilationMetadata(await finalizeOrderedGeneratorCss(outputContext) ?? await finalizeFallbackGeneratorCss(outputContext));
|
|
3123
|
+
return withCompilationMetadata(options.deferCssAdaptation ? await finalizeDeferredGeneratorCss(outputContext) : await finalizeOrderedGeneratorCss(outputContext) ?? await finalizeFallbackGeneratorCss(outputContext));
|
|
4008
3124
|
}
|
|
4009
3125
|
//#endregion
|
|
4010
|
-
//#region src/
|
|
3126
|
+
//#region src/generation/pipeline.ts
|
|
4011
3127
|
function hasPostcssUserPlugins(options) {
|
|
4012
3128
|
const plugins = options.postcssOptions?.plugins;
|
|
4013
3129
|
if (Array.isArray(plugins)) return plugins.length > 0;
|
|
@@ -4015,24 +3131,24 @@ function hasPostcssUserPlugins(options) {
|
|
|
4015
3131
|
}
|
|
4016
3132
|
function shouldProcessDisabledGeneratorCss(rawSource, options) {
|
|
4017
3133
|
if (!hasPostcssUserPlugins(options)) return false;
|
|
4018
|
-
return /@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[^"')\s]*)?["']/.test(rawSource) ||
|
|
3134
|
+
return /@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[^"')\s]*)?["']/.test(rawSource) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource);
|
|
4019
3135
|
}
|
|
4020
3136
|
function parseCssSourceRoot(rawSource) {
|
|
4021
3137
|
try {
|
|
4022
|
-
return
|
|
3138
|
+
return _weapp_tailwindcss_postcss_transform.postcss.parse(rawSource);
|
|
4023
3139
|
} catch {
|
|
4024
3140
|
return;
|
|
4025
3141
|
}
|
|
4026
3142
|
}
|
|
4027
3143
|
function cleanLocalCssImportWrapperFromParsedRoot(rawSource, root) {
|
|
4028
|
-
if (!root) return (0,
|
|
4029
|
-
return (0,
|
|
3144
|
+
if (!root) return (0, _weapp_tailwindcss_postcss_transform.cleanLocalCssImportWrapperTailwindDirectives)(rawSource);
|
|
3145
|
+
return (0, _weapp_tailwindcss_postcss_transform.cleanLocalCssImportWrapperTailwindDirectivesRoot)(root) ? root.toString() : void 0;
|
|
4030
3146
|
}
|
|
4031
3147
|
function isPureLocalCssImportWrapperFromParsedRoot(rawSource, root) {
|
|
4032
|
-
return root ? (0,
|
|
3148
|
+
return root ? (0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapperRoot)(root) : (0, _weapp_tailwindcss_postcss_transform.isPureLocalCssImportWrapper)(rawSource);
|
|
4033
3149
|
}
|
|
4034
3150
|
function splitLocalCssImportsFromParsedRoot(rawSource, root) {
|
|
4035
|
-
return root ? (0,
|
|
3151
|
+
return root ? (0, _weapp_tailwindcss_postcss_transform.splitLocalCssImportsRoot)(root) : (0, _weapp_tailwindcss_postcss_transform.splitLocalCssImports)(rawSource);
|
|
4036
3152
|
}
|
|
4037
3153
|
async function generateCssByGenerator(options) {
|
|
4038
3154
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, generatorPlatform, userRawSource, userRawSourceProcessed, debug } = options;
|
|
@@ -4056,10 +3172,10 @@ async function generateCssByGenerator(options) {
|
|
|
4056
3172
|
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
4057
3173
|
const useMiniProgramCssBranch = require_generator.shouldUseMiniProgramCssBranch(generatorBranch);
|
|
4058
3174
|
const normalizeGeneratorCssSource = (css) => {
|
|
4059
|
-
return useMiniProgramCssBranch ? normalizeMiniProgramGeneratorCssSource(css, file) : css;
|
|
3175
|
+
return useMiniProgramCssBranch ? (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratorCssSource)(css, file) : css;
|
|
4060
3176
|
};
|
|
4061
3177
|
const normalizeGeneratorSource = (source) => {
|
|
4062
|
-
const css = useMiniProgramCssBranch ? removeMiniProgramOutputImports(normalizeGeneratorCssSource(source.css)) : source.css;
|
|
3178
|
+
const css = useMiniProgramCssBranch ? (0, _weapp_tailwindcss_postcss_transform.removeMiniProgramOutputImports)(normalizeGeneratorCssSource(source.css)) : source.css;
|
|
4063
3179
|
return css === source.css ? source : {
|
|
4064
3180
|
...source,
|
|
4065
3181
|
css
|
|
@@ -4084,11 +3200,11 @@ async function generateCssByGenerator(options) {
|
|
|
4084
3200
|
}
|
|
4085
3201
|
return;
|
|
4086
3202
|
}
|
|
4087
|
-
const effectiveRawSource =
|
|
3203
|
+
const effectiveRawSource = (0, _weapp_tailwindcss_postcss_transform.stripUnmatchedTailwindSourceMediaCloseFragments)((0, _weapp_tailwindcss_postcss_transform.stripTailwindSourceMediaFragments)((0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(normalizeGeneratorCssSource((0, _weapp_tailwindcss_postcss_transform.normalizeTailwindSourceDirectives)(rawSource, { importFallback: generatorOptions.importFallback })))));
|
|
4088
3204
|
const effectiveRawSourceRoot = parseCssSourceRoot(effectiveRawSource);
|
|
4089
3205
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
4090
3206
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
4091
|
-
css: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? (0,
|
|
3207
|
+
css: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? (0, _weapp_tailwindcss_postcss_transform.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
4092
3208
|
classSet: /* @__PURE__ */ new Set(),
|
|
4093
3209
|
target: generatorOptions.target,
|
|
4094
3210
|
source: "generator",
|
|
@@ -4102,26 +3218,26 @@ async function generateCssByGenerator(options) {
|
|
|
4102
3218
|
const localImportParts = splitLocalCssImportsFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
4103
3219
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
4104
3220
|
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
4105
|
-
return finalizeWebGeneratorCss((0,
|
|
3221
|
+
return finalizeWebGeneratorCss((0, _weapp_tailwindcss_postcss_transform.restoreLocalCssImports)(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports, { outputFile: file }), target, generatorOptions.webCompat);
|
|
4106
3222
|
};
|
|
4107
3223
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
4108
|
-
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource :
|
|
4109
|
-
const userSource = (rawUserSource === generatorRawSource ? void 0 : (0,
|
|
4110
|
-
const userCssRawSource =
|
|
4111
|
-
const hasWebUserCssFallbackSource = userCssRawSource.trim().length > 0 && !
|
|
4112
|
-
const generatedUserCssOrderSource =
|
|
4113
|
-
const generatedUserCssRawSource = generatedUserCssOrderSource ?
|
|
4114
|
-
const userCssOrderSource =
|
|
3224
|
+
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : (0, _weapp_tailwindcss_postcss_transform.stripUnmatchedTailwindSourceMediaCloseFragments)((0, _weapp_tailwindcss_postcss_transform.stripTailwindSourceMediaFragments)((0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(normalizeGeneratorCssSource((0, _weapp_tailwindcss_postcss_transform.normalizeTailwindSourceDirectives)(userRawSource, { importFallback: generatorOptions.importFallback })))));
|
|
3225
|
+
const userSource = (rawUserSource === generatorRawSource ? void 0 : (0, _weapp_tailwindcss_postcss_transform.splitLocalCssImports)(rawUserSource))?.source ?? rawUserSource;
|
|
3226
|
+
const userCssRawSource = (0, _weapp_tailwindcss_postcss_transform.removeTailwindV4GeneratorAtRules)(userSource);
|
|
3227
|
+
const hasWebUserCssFallbackSource = userCssRawSource.trim().length > 0 && !(0, _weapp_tailwindcss_postcss_transform.isCommentOnlyCss)(userCssRawSource);
|
|
3228
|
+
const generatedUserCssOrderSource = (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(userSource) ? (0, _weapp_tailwindcss_postcss_transform.splitTailwindV4GeneratedCssBySourceOrder)(userSource, generatorRawSource) : void 0;
|
|
3229
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? (0, _weapp_tailwindcss_postcss_transform.createCssAppend)(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(userSource) ? "" : userCssRawSource;
|
|
3230
|
+
const userCssOrderSource = _weapp_tailwindcss_postcss_transform.GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(userSource) ? userSource : generatedUserCssRawSource;
|
|
4115
3231
|
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
4116
|
-
const legacyCompatUserCssRawSource = generatorOptions.target === "weapp" &&
|
|
3232
|
+
const legacyCompatUserCssRawSource = generatorOptions.target === "weapp" && (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss_transform.splitUserCssLayerBlocks)(generatedUserCssRawSource).rest : generatedUserCssRawSource;
|
|
4117
3233
|
const shouldPreserveLegacyCompatSelectorOverrides = legacyCompatUserCssRawSource !== generatedUserCssRawSource;
|
|
4118
|
-
const shouldDeduplicateUserLayerCss = generatorOptions.target === "weapp" && (
|
|
4119
|
-
const prepareFinalGeneratorCss = (css) => shouldDeduplicateUserLayerCss ? deduplicateGeneratedCssRules(css) : css;
|
|
4120
|
-
const hasGeneratedCss =
|
|
4121
|
-
const hasSourceDirectives =
|
|
4122
|
-
const hasGeneratedMarkers =
|
|
3234
|
+
const shouldDeduplicateUserLayerCss = generatorOptions.target === "weapp" && ((0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(rawUserSource) || (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatorRawSource) || (0, _weapp_tailwindcss_postcss_transform.hasUserCssLayerBlocks)(generatedUserCssRawSource));
|
|
3235
|
+
const prepareFinalGeneratorCss = (css) => shouldDeduplicateUserLayerCss ? (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(css) : css;
|
|
3236
|
+
const hasGeneratedCss = (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCss)(generatorRawSource);
|
|
3237
|
+
const hasSourceDirectives = (0, _weapp_tailwindcss_postcss_transform.hasTailwindSourceDirectives)(generatorRawSource, { importFallback: generatorOptions.importFallback });
|
|
3238
|
+
const hasGeneratedMarkers = (0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(generatorRawSource);
|
|
4123
3239
|
const normalizedCssSources = options.cssSources?.map((source) => {
|
|
4124
|
-
const css = normalizeGeneratorCssSource(
|
|
3240
|
+
const css = normalizeGeneratorCssSource((0, _weapp_tailwindcss_postcss_transform.normalizeEmptyTailwindCustomVariants)(source.css));
|
|
4125
3241
|
return css === source.css ? source : {
|
|
4126
3242
|
...source,
|
|
4127
3243
|
css
|
|
@@ -4177,7 +3293,7 @@ async function generateCssByGenerator(options) {
|
|
|
4177
3293
|
}
|
|
4178
3294
|
}
|
|
4179
3295
|
//#endregion
|
|
4180
|
-
//#region src/
|
|
3296
|
+
//#region src/generation/validate.ts
|
|
4181
3297
|
async function validateCandidatesByGenerator(options) {
|
|
4182
3298
|
return require_compiler.runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options, require_compiler.getTailwindGenerationSessionPool(options.runtimeState)));
|
|
4183
3299
|
}
|
|
@@ -4209,7 +3325,7 @@ async function validateCandidatesByGeneratorWithOwner(options, generationSession
|
|
|
4209
3325
|
return classSet;
|
|
4210
3326
|
}
|
|
4211
3327
|
//#endregion
|
|
4212
|
-
//#region src/
|
|
3328
|
+
//#region src/generation/service.ts
|
|
4213
3329
|
function resolveGenerationOptions(options, mode) {
|
|
4214
3330
|
const physicalFile = stripRequestQuery(options.file);
|
|
4215
3331
|
const normalizedOptions = physicalFile === options.file ? options : {
|
|
@@ -4271,7 +3387,7 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4271
3387
|
};
|
|
4272
3388
|
const generated = await generateCssByGenerator(shouldReplayFrameworkPostcss ? {
|
|
4273
3389
|
...generationInput,
|
|
4274
|
-
frameworkProcessedUserCss: options.frameworkProcessedUserCss === void 0 ? void 0 : normalizeFrameworkProcessedUserCss(options.frameworkProcessedUserCss),
|
|
3390
|
+
frameworkProcessedUserCss: options.frameworkProcessedUserCss === void 0 ? void 0 : (0, _weapp_tailwindcss_postcss_transform.normalizeFrameworkProcessedUserCss)(options.frameworkProcessedUserCss),
|
|
4275
3391
|
compilation: implementation.frameworkAdapter === "graph" ? {
|
|
4276
3392
|
enabled: true,
|
|
4277
3393
|
preserveDeletedCss: normalizedGeneratorOptions.hmr?.preserveDeletedCss ?? true,
|
|
@@ -4301,8 +3417,9 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4301
3417
|
} : {}
|
|
4302
3418
|
}) : generated.css;
|
|
4303
3419
|
const composedCss = shouldReplayFrameworkPostcss && options.frameworkProcessedUserCss ? await restoreFrameworkProcessedUserCss(adaptedCss, generated, generated.frameworkProcessedUserCss ?? options.frameworkProcessedUserCss, options, normalizedGeneratorOptions) : adaptedCss;
|
|
4304
|
-
const css = isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions)) ?
|
|
3420
|
+
const css = isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions)) ? (0, _weapp_tailwindcss_postcss_transform.preferScopedGeneratedCssRules)(composedCss) : composedCss;
|
|
4305
3421
|
const classSet = options.frameworkProcessedUserCss ? resolveGeneratedCssClassSet(generated.target, generated.classSet, options.runtime, css, options.opts.escapeMap, options.previousClassSet) : new Set(generated.classSet);
|
|
3422
|
+
if (shouldCheckRpxThemeRisk(options.runtimeState, generated.target, options.opts, options.generatorPlatform)) warnRpxThemeRisk(options.runtimeState, generated.rpxThemeVariables ?? [], css);
|
|
4306
3423
|
const artifact = implementation.emitArtifact ? createCoreArtifact({
|
|
4307
3424
|
...generated,
|
|
4308
3425
|
classSet
|
|
@@ -4352,6 +3469,47 @@ async function generateTailwindV4Css(options) {
|
|
|
4352
3469
|
return legacy;
|
|
4353
3470
|
}
|
|
4354
3471
|
//#endregion
|
|
3472
|
+
//#region src/bundlers/shared/css-source-trace.ts
|
|
3473
|
+
function normalizeSourcePath(source, root) {
|
|
3474
|
+
const resolvedRoot = node_path.default.resolve(root);
|
|
3475
|
+
const resolvedSource = node_path.default.resolve(source);
|
|
3476
|
+
const relative = node_path.default.relative(resolvedRoot, resolvedSource);
|
|
3477
|
+
if (relative && !relative.startsWith("..") && !node_path.default.isAbsolute(relative)) return relative.split(node_path.default.sep).join("/");
|
|
3478
|
+
return source.split(node_path.default.sep).join("/");
|
|
3479
|
+
}
|
|
3480
|
+
function getSourceTraceRoot(opts) {
|
|
3481
|
+
const configured = opts.cssSourceTrace;
|
|
3482
|
+
if (configured && typeof configured === "object" && configured.root) return configured.root;
|
|
3483
|
+
return opts.tailwindcssBasedir ?? node_process.default.cwd();
|
|
3484
|
+
}
|
|
3485
|
+
function isCssSourceTraceEnabled(opts) {
|
|
3486
|
+
return opts.cssSourceTrace === true || typeof opts.cssSourceTrace === "object" && opts.cssSourceTrace !== null;
|
|
3487
|
+
}
|
|
3488
|
+
function createCssTokenSourceMap(sourcesByToken, opts) {
|
|
3489
|
+
const root = getSourceTraceRoot(opts);
|
|
3490
|
+
const tokenSources = /* @__PURE__ */ new Map();
|
|
3491
|
+
for (const [token, sources] of [...sourcesByToken.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
3492
|
+
const source = {
|
|
3493
|
+
token,
|
|
3494
|
+
sources: [...sources].map((file) => normalizeSourcePath(file, root)).sort()
|
|
3495
|
+
};
|
|
3496
|
+
tokenSources.set(token, source);
|
|
3497
|
+
const escaped = require_compiler.replaceWxml(token, { escapeMap: opts.escapeMap });
|
|
3498
|
+
tokenSources.set(escaped, source);
|
|
3499
|
+
tokenSources.set(escaped.replaceAll("\\", ""), source);
|
|
3500
|
+
}
|
|
3501
|
+
return tokenSources;
|
|
3502
|
+
}
|
|
3503
|
+
function createCssSourceTraceCacheSignature(tokenSources, opts) {
|
|
3504
|
+
if (!isCssSourceTraceEnabled(opts)) return "css-source-trace:0";
|
|
3505
|
+
if (!tokenSources?.size) return "css-source-trace:1:empty";
|
|
3506
|
+
return `css-source-trace:1:${[...tokenSources.values()].map(({ token, sources }) => `${token}<=${sources.join(",")}`).sort().join("|")}`;
|
|
3507
|
+
}
|
|
3508
|
+
function annotateCssSourceTrace(css, options) {
|
|
3509
|
+
if (!isCssSourceTraceEnabled(options.opts) || !options.tokenSources?.size) return css;
|
|
3510
|
+
return (0, _weapp_tailwindcss_postcss_transform.annotateCssTokenSources)(css, options.tokenSources);
|
|
3511
|
+
}
|
|
3512
|
+
//#endregion
|
|
4355
3513
|
Object.defineProperty(exports, "annotateCssSourceTrace", {
|
|
4356
3514
|
enumerable: true,
|
|
4357
3515
|
get: function() {
|
|
@@ -4388,36 +3546,12 @@ Object.defineProperty(exports, "collectGeneratedRawSourceCandidatesFromCss", {
|
|
|
4388
3546
|
return collectGeneratedRawSourceCandidatesFromCss;
|
|
4389
3547
|
}
|
|
4390
3548
|
});
|
|
4391
|
-
Object.defineProperty(exports, "collectRawSourceClassSelectors", {
|
|
4392
|
-
enumerable: true,
|
|
4393
|
-
get: function() {
|
|
4394
|
-
return collectRawSourceClassSelectors;
|
|
4395
|
-
}
|
|
4396
|
-
});
|
|
4397
3549
|
Object.defineProperty(exports, "collectStrictEscapedRuntimeCandidates", {
|
|
4398
3550
|
enumerable: true,
|
|
4399
3551
|
get: function() {
|
|
4400
3552
|
return collectStrictEscapedRuntimeCandidates;
|
|
4401
3553
|
}
|
|
4402
3554
|
});
|
|
4403
|
-
Object.defineProperty(exports, "createBundlerGeneratedCssEndMarker", {
|
|
4404
|
-
enumerable: true,
|
|
4405
|
-
get: function() {
|
|
4406
|
-
return createBundlerGeneratedCssEndMarker;
|
|
4407
|
-
}
|
|
4408
|
-
});
|
|
4409
|
-
Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
|
|
4410
|
-
enumerable: true,
|
|
4411
|
-
get: function() {
|
|
4412
|
-
return createBundlerGeneratedCssMarker;
|
|
4413
|
-
}
|
|
4414
|
-
});
|
|
4415
|
-
Object.defineProperty(exports, "createCssSourceOrderAppend", {
|
|
4416
|
-
enumerable: true,
|
|
4417
|
-
get: function() {
|
|
4418
|
-
return createCssSourceOrderAppend;
|
|
4419
|
-
}
|
|
4420
|
-
});
|
|
4421
3555
|
Object.defineProperty(exports, "createCssSourceTraceCacheSignature", {
|
|
4422
3556
|
enumerable: true,
|
|
4423
3557
|
get: function() {
|
|
@@ -4460,12 +3594,6 @@ Object.defineProperty(exports, "extractCandidatesFromSource", {
|
|
|
4460
3594
|
return extractCandidatesFromSource;
|
|
4461
3595
|
}
|
|
4462
3596
|
});
|
|
4463
|
-
Object.defineProperty(exports, "extractMarkedUserLayerComponentsCss", {
|
|
4464
|
-
enumerable: true,
|
|
4465
|
-
get: function() {
|
|
4466
|
-
return extractMarkedUserLayerComponentsCss;
|
|
4467
|
-
}
|
|
4468
|
-
});
|
|
4469
3597
|
Object.defineProperty(exports, "finalizeMiniProgramGeneratorCss", {
|
|
4470
3598
|
enumerable: true,
|
|
4471
3599
|
get: function() {
|
|
@@ -4478,12 +3606,6 @@ Object.defineProperty(exports, "generateTailwindV4Css", {
|
|
|
4478
3606
|
return generateTailwindV4Css;
|
|
4479
3607
|
}
|
|
4480
3608
|
});
|
|
4481
|
-
Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
|
|
4482
|
-
enumerable: true,
|
|
4483
|
-
get: function() {
|
|
4484
|
-
return hasBundlerGeneratedCssMarker;
|
|
4485
|
-
}
|
|
4486
|
-
});
|
|
4487
3609
|
Object.defineProperty(exports, "hasMiniProgramTailwindV4PreflightReset", {
|
|
4488
3610
|
enumerable: true,
|
|
4489
3611
|
get: function() {
|
|
@@ -4514,30 +3636,6 @@ Object.defineProperty(exports, "isSourceStyleRequest", {
|
|
|
4514
3636
|
return isSourceStyleRequest;
|
|
4515
3637
|
}
|
|
4516
3638
|
});
|
|
4517
|
-
Object.defineProperty(exports, "mergeMarkedUserLayerComponentsCss", {
|
|
4518
|
-
enumerable: true,
|
|
4519
|
-
get: function() {
|
|
4520
|
-
return mergeMarkedUserLayerComponentsCss;
|
|
4521
|
-
}
|
|
4522
|
-
});
|
|
4523
|
-
Object.defineProperty(exports, "normalizeMiniProgramGeneratorCssSource", {
|
|
4524
|
-
enumerable: true,
|
|
4525
|
-
get: function() {
|
|
4526
|
-
return normalizeMiniProgramGeneratorCssSource;
|
|
4527
|
-
}
|
|
4528
|
-
});
|
|
4529
|
-
Object.defineProperty(exports, "normalizeMiniProgramImportShell", {
|
|
4530
|
-
enumerable: true,
|
|
4531
|
-
get: function() {
|
|
4532
|
-
return normalizeMiniProgramImportShell;
|
|
4533
|
-
}
|
|
4534
|
-
});
|
|
4535
|
-
Object.defineProperty(exports, "parseBundlerGeneratedCssMarkerBlocks", {
|
|
4536
|
-
enumerable: true,
|
|
4537
|
-
get: function() {
|
|
4538
|
-
return parseBundlerGeneratedCssMarkerBlocks;
|
|
4539
|
-
}
|
|
4540
|
-
});
|
|
4541
3639
|
Object.defineProperty(exports, "pushConcurrentTaskFactories", {
|
|
4542
3640
|
enumerable: true,
|
|
4543
3641
|
get: function() {
|
|
@@ -4574,12 +3672,6 @@ Object.defineProperty(exports, "scoreTailwindV4CssSourceFileMatch", {
|
|
|
4574
3672
|
return scoreTailwindV4CssSourceFileMatch;
|
|
4575
3673
|
}
|
|
4576
3674
|
});
|
|
4577
|
-
Object.defineProperty(exports, "stripBundlerGeneratedCssMarkers", {
|
|
4578
|
-
enumerable: true,
|
|
4579
|
-
get: function() {
|
|
4580
|
-
return stripBundlerGeneratedCssMarkers;
|
|
4581
|
-
}
|
|
4582
|
-
});
|
|
4583
3675
|
Object.defineProperty(exports, "stripRequestQuery", {
|
|
4584
3676
|
enumerable: true,
|
|
4585
3677
|
get: function() {
|