weapp-tailwindcss 4.12.0 → 5.0.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/bin/weapp-tailwindcss.js +1 -21
- package/dist/babel/index.d.ts +3 -0
- package/dist/bundle-state-BWqi5ZyX.mjs +343 -0
- package/dist/bundle-state-EUbcdKqo.js +410 -0
- package/dist/bundlers/gulp/index.d.ts +7 -0
- package/dist/bundlers/shared/cache.d.ts +16 -0
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +4 -0
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +3 -0
- package/dist/bundlers/shared/css-imports.d.ts +8 -0
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +13 -0
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +33 -0
- package/dist/bundlers/shared/module-graph.d.ts +5 -0
- package/dist/bundlers/shared/run-tasks.d.ts +2 -0
- package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
- package/dist/bundlers/vite/bundle-state.d.ts +43 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +22 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
- package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
- package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +34 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
- package/dist/bundlers/vite/index.d.ts +3 -0
- package/dist/bundlers/vite/js-precheck.d.ts +1 -0
- package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
- package/dist/bundlers/vite/postcss-config.d.ts +6 -0
- package/dist/bundlers/vite/query.d.ts +15 -0
- package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +13 -0
- package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
- package/dist/bundlers/vite/source-candidates.d.ts +18 -0
- package/dist/bundlers/vite/source-scan.d.ts +8 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/vite/utils.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +21 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +20 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +20 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +10 -0
- package/dist/bundlers/webpack/index.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +14 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
- package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
- package/dist/cache/index.d.ts +38 -0
- package/dist/cache/md5.d.ts +1 -0
- package/dist/cache-BVAiJV3J.js +502 -0
- package/dist/cache-CHs4DXui.mjs +434 -0
- package/dist/chunk-8l464Juk.js +28 -0
- package/dist/cli/context.d.ts +13 -0
- package/dist/cli/doctor/constants.d.ts +7 -0
- package/dist/cli/doctor/types.d.ts +31 -0
- package/dist/cli/doctor.d.ts +4 -0
- package/dist/cli/helpers/options/format.d.ts +2 -0
- package/dist/cli/helpers/options/parse.d.ts +3 -0
- package/dist/cli/helpers/options/resolve.d.ts +1 -0
- package/dist/cli/helpers/options.d.ts +3 -0
- package/dist/cli/helpers.d.ts +4 -0
- package/dist/cli/mount-options.d.ts +4 -0
- package/dist/cli/types.d.ts +15 -0
- package/dist/cli/vscode-entry.d.ts +14 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +1985 -3574
- package/dist/cli.mjs +1962 -3554
- package/dist/constants-BG12WAKw.mjs +44 -0
- package/dist/constants-BeeyfJ9k.js +73 -0
- package/dist/constants.d.ts +12 -0
- package/dist/context/compiler-context-cache.d.ts +3 -0
- package/dist/context/custom-attributes.d.ts +2 -0
- package/dist/context/handlers.d.ts +6 -0
- package/dist/context/index.d.ts +7 -0
- package/dist/context/logger.d.ts +4 -0
- package/dist/context/tailwindcss/basedir.d.ts +1 -0
- package/dist/context/tailwindcss/rax.d.ts +2 -0
- package/dist/context/tailwindcss.d.ts +4 -0
- package/dist/context/workspace.d.ts +3 -0
- package/dist/core.d.ts +5 -21
- package/dist/core.js +131 -180
- package/dist/core.mjs +129 -180
- package/dist/css-macro/constants.d.ts +14 -0
- package/dist/css-macro/index.d.ts +15 -0
- package/dist/css-macro/postcss.d.ts +3 -7
- package/dist/css-macro/postcss.js +44 -58
- package/dist/css-macro/postcss.mjs +44 -56
- package/dist/css-macro.d.ts +2 -20
- package/dist/css-macro.js +37 -50
- package/dist/css-macro.mjs +33 -47
- package/dist/debug/index.d.ts +5 -0
- package/dist/defaults.d.ts +16 -11
- package/dist/defaults.js +151 -8
- package/dist/defaults.mjs +143 -7
- package/dist/escape.js +31 -54
- package/dist/escape.mjs +18 -25
- package/dist/generator/index.d.ts +11 -0
- package/dist/generator/options.d.ts +16 -0
- package/dist/generator/types.d.ts +20 -0
- package/dist/generator-DKkhJbOg.js +1531 -0
- package/dist/generator-UBmfduYg.mjs +1432 -0
- package/dist/generator.d.ts +1 -0
- package/dist/generator.js +19 -0
- package/dist/generator.mjs +2 -0
- package/dist/gulp.d.ts +4 -24
- package/dist/gulp.js +370 -13
- package/dist/gulp.mjs +362 -13
- package/dist/incremental-runtime-class-set-BYmzQ-_f.js +1555 -0
- package/dist/incremental-runtime-class-set-BgMW6wf2.mjs +1510 -0
- package/dist/index.d.ts +8 -15
- package/dist/index.js +12 -24
- package/dist/index.mjs +6 -24
- package/dist/js/JsTokenUpdater.d.ts +14 -0
- package/dist/js/ModuleGraph.d.ts +18 -0
- package/dist/js/NodePathWalker.d.ts +33 -0
- package/dist/js/babel/parse.d.ts +9 -0
- package/dist/js/babel/process.d.ts +4 -0
- package/dist/js/babel.d.ts +13 -0
- package/dist/js/class-context.d.ts +3 -0
- package/dist/js/evalTransforms.d.ts +7 -0
- package/dist/js/handlers.d.ts +5 -0
- package/dist/js/index.d.ts +5 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/js/module-graph/ignored-exports.d.ts +18 -0
- package/dist/js/module-graph/types.d.ts +17 -0
- package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
- package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
- package/dist/js/precheck.d.ts +2 -0
- package/dist/js/sourceAnalysis.d.ts +17 -0
- package/dist/js/taggedTemplateIgnore.d.ts +13 -0
- package/dist/js/types.d.ts +11 -0
- package/dist/lightningcss/index.d.ts +8 -0
- package/dist/lightningcss/style-handler/options.d.ts +3 -0
- package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
- package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
- package/dist/lightningcss/style-handler.d.ts +17 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger-CZUxvJJD.mjs +2 -0
- package/dist/logger-EVNB9z7i.js +1 -0
- package/dist/postcss/config-directive.d.ts +1 -0
- package/dist/postcss/context.d.ts +9 -0
- package/dist/postcss/source-files.d.ts +8 -0
- package/dist/postcss/tailwind-version.d.ts +3 -0
- package/dist/postcss-C7efq3hr.mjs +231 -0
- package/dist/postcss-Dg-_lyHS.js +240 -0
- package/dist/postcss-html-transform.d.ts +3 -3
- package/dist/postcss-html-transform.js +7 -10
- package/dist/postcss-html-transform.mjs +3 -6
- package/dist/postcss.d.ts +15 -0
- package/dist/postcss.js +7 -0
- package/dist/postcss.mjs +2 -0
- package/dist/precheck-B32p-gLI.js +2736 -0
- package/dist/precheck-B4RH6ZNN.mjs +2622 -0
- package/dist/presets/hbuilderx.d.ts +4 -0
- package/dist/presets/index.d.ts +3 -0
- package/dist/presets/shared.d.ts +10 -0
- package/dist/presets/taro.d.ts +4 -0
- package/dist/presets/uni-app-x.d.ts +16 -0
- package/dist/presets/uni-app.d.ts +4 -0
- package/dist/presets.d.ts +1 -76
- package/dist/presets.js +117 -163
- package/dist/presets.mjs +109 -163
- package/dist/reset/index.d.ts +2 -0
- package/dist/reset.d.ts +2 -4
- package/dist/reset.js +19 -8
- package/dist/reset.mjs +2 -8
- package/dist/runtime-patch-CwN5ya72.mjs +71 -0
- package/dist/runtime-patch-D6mBo_KB.js +85 -0
- package/dist/shared/classname-transform.d.ts +14 -0
- package/dist/shared/mpx.d.ts +7 -0
- package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
- package/dist/source-scan-BaYvNx-k.js +293 -0
- package/dist/source-scan-cGZxoJqP.mjs +254 -0
- package/dist/tailwindcss/index.d.ts +11 -0
- package/dist/tailwindcss/miniprogram.d.ts +5 -0
- package/dist/tailwindcss/patcher-options.d.ts +8 -0
- package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
- package/dist/tailwindcss/patcher.d.ts +12 -0
- package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
- package/dist/tailwindcss/runtime/cache.d.ts +11 -0
- package/dist/tailwindcss/runtime-logs.d.ts +3 -0
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +28 -0
- package/dist/tailwindcss/source-scan.d.ts +25 -0
- package/dist/tailwindcss/targets.d.ts +2 -0
- package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
- package/dist/tailwindcss/v4/config.d.ts +5 -0
- package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
- package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
- package/dist/tailwindcss/v4/index.d.ts +2 -0
- package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
- package/dist/tailwindcss/v4/patcher-options.d.ts +2 -0
- package/dist/tailwindcss/v4/patcher.d.ts +15 -0
- package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +5 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
- package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +19 -0
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/tailwindcss-Bu-RWIHx.js +630 -0
- package/dist/tailwindcss-C5IgPlQ0.mjs +579 -0
- package/dist/typedoc.export.d.ts +3 -0
- package/dist/types/base.d.ts +1 -0
- package/dist/types/index.d.ts +97 -0
- package/dist/types/shared.d.ts +10 -0
- package/dist/types/user-defined-options/general.d.ts +29 -0
- package/dist/types/user-defined-options/important.d.ts +37 -0
- package/dist/types/user-defined-options/index.d.ts +11 -0
- package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
- package/dist/types/user-defined-options/matcher.d.ts +9 -0
- package/dist/types.d.ts +1 -150
- package/dist/types.js +0 -1
- package/dist/types.mjs +1 -1
- package/dist/uni-app-x/component-local-style.d.ts +19 -0
- package/dist/uni-app-x/index.d.ts +2 -0
- package/dist/uni-app-x/options.d.ts +12 -0
- package/dist/uni-app-x/style-isolation.d.ts +2 -0
- package/dist/uni-app-x/transform.d.ts +9 -0
- package/dist/uni-app-x/vite.d.ts +36 -0
- package/dist/utils/decode.d.ts +2 -0
- package/dist/utils/disabled.d.ts +5 -0
- package/dist/utils/hbuilderx.d.ts +5 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/nameMatcher.d.ts +4 -0
- package/dist/utils/resolve-package.d.ts +1 -0
- package/dist/utils/uni-platform.d.ts +11 -0
- package/dist/utils-BiShvil9.js +61 -0
- package/dist/utils-Btw1iOVV.mjs +48 -0
- package/dist/vite-BU74SkOi.mjs +2246 -0
- package/dist/vite-CKjx_5c3.js +2261 -0
- package/dist/vite.d.ts +3 -17
- package/dist/vite.js +4 -14
- package/dist/vite.mjs +2 -14
- package/dist/weapp-tw-css-import-rewrite-loader.js +68 -92
- package/dist/weapp-tw-runtime-classset-loader.js +31 -50
- package/dist/webpack-CAk_ITq7.mjs +713 -0
- package/dist/webpack-damWiYqY.js +723 -0
- package/dist/webpack.d.ts +4 -25
- package/dist/webpack.js +6 -17
- package/dist/webpack.mjs +2 -17
- package/dist/wxml/Tokenizer.d.ts +15 -0
- package/dist/wxml/custom-attributes.d.ts +4 -0
- package/dist/wxml/index.d.ts +2 -0
- package/dist/wxml/shared.d.ts +2 -0
- package/dist/wxml/tokenizer/types.d.ts +18 -0
- package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
- package/dist/wxml/utils/codegen.d.ts +2 -0
- package/dist/wxml/utils/custom-template.d.ts +3 -0
- package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
- package/dist/wxml/utils/fragment-updater.d.ts +4 -0
- package/dist/wxml/utils/template-fragments.d.ts +3 -0
- package/dist/wxml/utils.d.ts +8 -0
- package/dist/wxml/whitespace.d.ts +2 -0
- package/generator-placeholder.css +1 -0
- package/package.json +39 -38
- package/dist/chunk-24AGZQVR.js +0 -183
- package/dist/chunk-3VQKDHGP.mjs +0 -179
- package/dist/chunk-4AFQP74Z.js +0 -24
- package/dist/chunk-57SOQCAU.mjs +0 -582
- package/dist/chunk-5ZYHNDEK.mjs +0 -2439
- package/dist/chunk-76S2EME4.mjs +0 -34
- package/dist/chunk-A5PB4KZT.js +0 -138
- package/dist/chunk-DUHYLR2R.js +0 -276
- package/dist/chunk-DYLQ6UOI.js +0 -71
- package/dist/chunk-E7I5TW5K.js +0 -52
- package/dist/chunk-FS2NOOEB.js +0 -292
- package/dist/chunk-HVNGIKLS.js +0 -3930
- package/dist/chunk-JZQBZHN5.js +0 -579
- package/dist/chunk-KGTVD4EP.mjs +0 -3930
- package/dist/chunk-NNOQDMUP.mjs +0 -10
- package/dist/chunk-OF6MFURR.js +0 -34
- package/dist/chunk-OFB2KBRP.js +0 -2442
- package/dist/chunk-OOHJLO5M.mjs +0 -71
- package/dist/chunk-PCDYXXSK.mjs +0 -1515
- package/dist/chunk-RKISS72P.js +0 -7
- package/dist/chunk-RRQZL7FQ.mjs +0 -292
- package/dist/chunk-XAKAD2CR.mjs +0 -138
- package/dist/chunk-XZP3MREK.mjs +0 -276
- package/dist/chunk-ZAA5ZG3D.js +0 -1518
- package/dist/chunk-ZCH4YINE.mjs +0 -52
- package/dist/cli.d.mts +0 -2
- package/dist/core.d.mts +0 -26
- package/dist/css-macro/postcss.d.mts +0 -7
- package/dist/css-macro.d.mts +0 -18
- package/dist/defaults.d.mts +0 -11
- package/dist/gulp.d.mts +0 -24
- package/dist/index-BXrmQelt.d.mts +0 -672
- package/dist/index-BXrmQelt.d.ts +0 -672
- package/dist/index.d.mts +0 -15
- package/dist/postcss-html-transform.d.mts +0 -2
- package/dist/presets.d.mts +0 -76
- package/dist/reset.d.mts +0 -1
- package/dist/types.d.mts +0 -150
- package/dist/vite.d.mts +0 -17
- package/dist/webpack.d.mts +0 -25
- package/dist/webpack4.d.mts +0 -26
- package/dist/webpack4.d.ts +0 -26
- package/dist/webpack4.js +0 -493
- package/dist/webpack4.mjs +0 -495
- package/scripts/postinstall.mjs +0 -59
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
const require_precheck = require("./precheck-B32p-gLI.js");
|
|
3
|
+
let node_module = require("node:module");
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_chunk.__toESM(node_path);
|
|
6
|
+
let node_buffer = require("node:buffer");
|
|
7
|
+
let htmlparser2 = require("htmlparser2");
|
|
8
|
+
//#region src/bundlers/shared/module-graph.ts
|
|
9
|
+
const QUERY_HASH_RE = /[?#].*$/u;
|
|
10
|
+
const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
|
|
11
|
+
const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
|
|
12
|
+
const VIRTUAL_PREFIX = "\0";
|
|
13
|
+
const JS_EXTENSIONS = [
|
|
14
|
+
".js",
|
|
15
|
+
".mjs",
|
|
16
|
+
".cjs"
|
|
17
|
+
];
|
|
18
|
+
function normalizeOutputPathKey(value) {
|
|
19
|
+
return node_path.default.normalize(value).replace(/\\/g, "/");
|
|
20
|
+
}
|
|
21
|
+
function stripQueryAndHash(specifier) {
|
|
22
|
+
return specifier.replace(QUERY_HASH_RE, "");
|
|
23
|
+
}
|
|
24
|
+
function isResolvableSpecifier(specifier) {
|
|
25
|
+
if (!specifier) return false;
|
|
26
|
+
const normalized = stripQueryAndHash(specifier);
|
|
27
|
+
if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
|
|
28
|
+
if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
|
|
29
|
+
return !PROTOCOL_RE.test(normalized);
|
|
30
|
+
}
|
|
31
|
+
function toAbsoluteOutputPath(fileName, outDir) {
|
|
32
|
+
if (node_path.default.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return node_path.default.normalize(fileName);
|
|
33
|
+
return node_path.default.resolve(outDir, fileName);
|
|
34
|
+
}
|
|
35
|
+
function matchWithExtensions(candidate, hasOutput) {
|
|
36
|
+
if (hasOutput(candidate)) return candidate;
|
|
37
|
+
if (!node_path.default.extname(candidate)) for (const ext of JS_EXTENSIONS) {
|
|
38
|
+
const extended = `${candidate}${ext}`;
|
|
39
|
+
if (hasOutput(extended)) return extended;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
|
|
43
|
+
if (!isResolvableSpecifier(specifier)) return;
|
|
44
|
+
const normalized = stripQueryAndHash(specifier);
|
|
45
|
+
let candidate;
|
|
46
|
+
if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = node_path.default.normalize(normalized);
|
|
47
|
+
else if (normalized.startsWith("/")) candidate = node_path.default.resolve(outDir, normalized.slice(1));
|
|
48
|
+
else candidate = node_path.default.resolve(node_path.default.dirname(importer), normalized);
|
|
49
|
+
return matchWithExtensions(candidate, hasOutput);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/utils/disabled.ts
|
|
53
|
+
function resolvePluginDisabledState(disabled) {
|
|
54
|
+
if (disabled === true) return { plugin: true };
|
|
55
|
+
if (disabled === false || disabled == null) return { plugin: false };
|
|
56
|
+
return { plugin: disabled.plugin ?? false };
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/utils/resolve-package.ts
|
|
60
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
61
|
+
function resolvePackageDir(name) {
|
|
62
|
+
const pkgPath = require$1.resolve(`${name}/package.json`);
|
|
63
|
+
return node_path.default.dirname(pkgPath);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/bundlers/shared/run-tasks.ts
|
|
67
|
+
async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
|
|
68
|
+
if (factories.length === 0) return [];
|
|
69
|
+
const results = Array.from({ length: factories.length });
|
|
70
|
+
const executing = /* @__PURE__ */ new Set();
|
|
71
|
+
let cursor = 0;
|
|
72
|
+
const effectiveLimit = Math.max(1, limit);
|
|
73
|
+
const scheduleNext = () => {
|
|
74
|
+
if (cursor >= factories.length) return;
|
|
75
|
+
const currentIndex = cursor++;
|
|
76
|
+
const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
|
|
77
|
+
results[currentIndex] = value;
|
|
78
|
+
}).finally(() => {
|
|
79
|
+
executing.delete(wrapped);
|
|
80
|
+
});
|
|
81
|
+
executing.add(wrapped);
|
|
82
|
+
};
|
|
83
|
+
while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
|
|
84
|
+
while (cursor < factories.length) {
|
|
85
|
+
await Promise.race(executing);
|
|
86
|
+
scheduleNext();
|
|
87
|
+
}
|
|
88
|
+
await Promise.all(executing);
|
|
89
|
+
return results;
|
|
90
|
+
}
|
|
91
|
+
function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
92
|
+
if (factories.length === 0) return;
|
|
93
|
+
queue.push(runWithConcurrency(factories, limit).then(() => void 0));
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/bundlers/vite/bundle-entries.ts
|
|
97
|
+
function readOutputEntry(entry) {
|
|
98
|
+
if (entry.output.type === "chunk") return entry.output.code;
|
|
99
|
+
const source = entry.output.source;
|
|
100
|
+
if (typeof source === "string") return source;
|
|
101
|
+
if (source instanceof Uint8Array) return node_buffer.Buffer.from(source).toString();
|
|
102
|
+
const fallbackSource = source;
|
|
103
|
+
if (fallbackSource == null) return;
|
|
104
|
+
if (typeof fallbackSource.toString === "function") return fallbackSource.toString();
|
|
105
|
+
}
|
|
106
|
+
function isJavaScriptEntry(entry) {
|
|
107
|
+
if (entry.output.type === "chunk") return true;
|
|
108
|
+
return entry.fileName.endsWith(".js");
|
|
109
|
+
}
|
|
110
|
+
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
111
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
112
|
+
for (const [id, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(id), entry);
|
|
113
|
+
const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
114
|
+
return {
|
|
115
|
+
resolve(specifier, importer) {
|
|
116
|
+
return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
117
|
+
},
|
|
118
|
+
load(id) {
|
|
119
|
+
const entry = getEntry(id);
|
|
120
|
+
if (!entry) return;
|
|
121
|
+
return readOutputEntry(entry);
|
|
122
|
+
},
|
|
123
|
+
filter(id) {
|
|
124
|
+
return Boolean(getEntry(id));
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
129
|
+
if (!linked) return;
|
|
130
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
131
|
+
for (const [entryId, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
|
|
132
|
+
for (const [id, { code }] of Object.entries(linked)) {
|
|
133
|
+
const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
134
|
+
if (!entry) continue;
|
|
135
|
+
const previous = readOutputEntry(entry);
|
|
136
|
+
if (previous == null || previous === code) continue;
|
|
137
|
+
if (entry.output.type === "chunk") entry.output.code = code;
|
|
138
|
+
else entry.output.source = code;
|
|
139
|
+
onApplied?.(entry, code);
|
|
140
|
+
onLinkedUpdate(entry.fileName, previous, code);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/bundlers/vite/runtime-affecting-signature.ts
|
|
145
|
+
const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
146
|
+
const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
|
|
147
|
+
const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
|
|
148
|
+
const CSS_WHITESPACE_RE = /\s+/g;
|
|
149
|
+
function createHtmlRuntimeAffectingSignature(source) {
|
|
150
|
+
try {
|
|
151
|
+
const parts = [];
|
|
152
|
+
const parser = new htmlparser2.Parser({
|
|
153
|
+
onattribute(name, value) {
|
|
154
|
+
parts.push(`a:${name}=${value}`);
|
|
155
|
+
},
|
|
156
|
+
oncomment(data) {
|
|
157
|
+
parts.push(`c:${data}`);
|
|
158
|
+
},
|
|
159
|
+
ontext(data) {
|
|
160
|
+
const value = data.trim();
|
|
161
|
+
if (value.length > 0) parts.push(`t:${value}`);
|
|
162
|
+
}
|
|
163
|
+
}, { xmlMode: true });
|
|
164
|
+
parser.write(source);
|
|
165
|
+
parser.end();
|
|
166
|
+
return parts.join("\n");
|
|
167
|
+
} catch {
|
|
168
|
+
return source;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function createJsRuntimeAffectingSignature(source) {
|
|
172
|
+
try {
|
|
173
|
+
const ast = require_precheck.babelParse(source, {
|
|
174
|
+
cache: true,
|
|
175
|
+
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
176
|
+
plugins: ["jsx", "typescript"],
|
|
177
|
+
sourceType: "unambiguous"
|
|
178
|
+
});
|
|
179
|
+
const parts = [];
|
|
180
|
+
require_precheck.traverse(ast, {
|
|
181
|
+
noScope: true,
|
|
182
|
+
StringLiteral(path) {
|
|
183
|
+
parts.push(`s:${path.node.value}`);
|
|
184
|
+
},
|
|
185
|
+
TemplateElement(path) {
|
|
186
|
+
parts.push(`t:${path.node.value.raw}`);
|
|
187
|
+
},
|
|
188
|
+
JSXText(path) {
|
|
189
|
+
const value = path.node.value.trim();
|
|
190
|
+
if (value.length > 0) parts.push(`x:${value}`);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
const comments = ast.comments;
|
|
194
|
+
if (Array.isArray(comments)) {
|
|
195
|
+
for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
|
|
196
|
+
}
|
|
197
|
+
return parts.join("\n");
|
|
198
|
+
} catch {
|
|
199
|
+
return source;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function createCssRuntimeAffectingSignature(source) {
|
|
203
|
+
return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
|
|
204
|
+
}
|
|
205
|
+
function createRuntimeAffectingSourceSignature(source, type) {
|
|
206
|
+
if (type === "html") return createHtmlRuntimeAffectingSignature(source);
|
|
207
|
+
if (type === "js") return createJsRuntimeAffectingSignature(source);
|
|
208
|
+
if (type === "css") return createCssRuntimeAffectingSignature(source);
|
|
209
|
+
return source;
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/bundlers/vite/bundle-state.ts
|
|
213
|
+
function createBundleBuildState() {
|
|
214
|
+
return {
|
|
215
|
+
iteration: 0,
|
|
216
|
+
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
217
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
218
|
+
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
219
|
+
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
220
|
+
dependentsByLinkedFile: /* @__PURE__ */ new Map()
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function createChangedByType() {
|
|
224
|
+
return {
|
|
225
|
+
html: /* @__PURE__ */ new Set(),
|
|
226
|
+
js: /* @__PURE__ */ new Set(),
|
|
227
|
+
css: /* @__PURE__ */ new Set(),
|
|
228
|
+
other: /* @__PURE__ */ new Set()
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function createProcessFiles() {
|
|
232
|
+
return {
|
|
233
|
+
html: /* @__PURE__ */ new Set(),
|
|
234
|
+
js: /* @__PURE__ */ new Set(),
|
|
235
|
+
css: /* @__PURE__ */ new Set()
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function readEntrySource(output) {
|
|
239
|
+
if (output.type === "chunk") return output.code;
|
|
240
|
+
return output.source.toString();
|
|
241
|
+
}
|
|
242
|
+
function classifyBundleEntry(file, opts) {
|
|
243
|
+
if (opts.cssMatcher(file)) return "css";
|
|
244
|
+
if (opts.htmlMatcher(file)) return "html";
|
|
245
|
+
if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
|
|
246
|
+
return "other";
|
|
247
|
+
}
|
|
248
|
+
function collectJsEntries(fileName, output, outDir, store) {
|
|
249
|
+
const entry = {
|
|
250
|
+
fileName,
|
|
251
|
+
output
|
|
252
|
+
};
|
|
253
|
+
if (!isJavaScriptEntry(entry)) return;
|
|
254
|
+
const absolute = toAbsoluteOutputPath(fileName, outDir);
|
|
255
|
+
store.set(absolute, entry);
|
|
256
|
+
}
|
|
257
|
+
function markProcessFile(type, file, processFiles) {
|
|
258
|
+
if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
|
|
259
|
+
}
|
|
260
|
+
function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
|
|
261
|
+
const sourceHashByFile = /* @__PURE__ */ new Map();
|
|
262
|
+
const runtimeAffectingSignatureByFile = /* @__PURE__ */ new Map();
|
|
263
|
+
const runtimeAffectingHashByFile = /* @__PURE__ */ new Map();
|
|
264
|
+
const changedByType = createChangedByType();
|
|
265
|
+
const runtimeAffectingChangedByType = createChangedByType();
|
|
266
|
+
const processFiles = createProcessFiles();
|
|
267
|
+
const linkedImpactsByEntry = /* @__PURE__ */ new Map();
|
|
268
|
+
const jsEntries = /* @__PURE__ */ new Map();
|
|
269
|
+
const entries = [];
|
|
270
|
+
const firstRun = state.linkedByEntry.size === 0;
|
|
271
|
+
for (const [file, output] of Object.entries(bundle)) {
|
|
272
|
+
const type = classifyBundleEntry(file, opts);
|
|
273
|
+
const source = readEntrySource(output);
|
|
274
|
+
const hash = opts.cache.computeHash(source);
|
|
275
|
+
sourceHashByFile.set(file, hash);
|
|
276
|
+
const previousHash = state.sourceHashByFile.get(file);
|
|
277
|
+
const changed = previousHash == null || previousHash !== hash;
|
|
278
|
+
const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
|
|
279
|
+
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
280
|
+
const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
|
|
281
|
+
const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
|
|
282
|
+
const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
|
|
283
|
+
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
284
|
+
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
285
|
+
if (changed) changedByType[type].add(file);
|
|
286
|
+
if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
|
|
287
|
+
if (forceAll || firstRun) markProcessFile(type, file, processFiles);
|
|
288
|
+
else if (type === "html") processFiles.html.add(file);
|
|
289
|
+
else if (changed && (type === "js" || type === "css")) processFiles[type].add(file);
|
|
290
|
+
collectJsEntries(file, output, outDir, jsEntries);
|
|
291
|
+
entries.push({
|
|
292
|
+
file,
|
|
293
|
+
output,
|
|
294
|
+
source,
|
|
295
|
+
type
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
if (!forceAll && !firstRun) for (const changedFile of changedByType.js) {
|
|
299
|
+
const dependents = state.dependentsByLinkedFile.get(changedFile);
|
|
300
|
+
if (!dependents) continue;
|
|
301
|
+
for (const entryFile of dependents) {
|
|
302
|
+
processFiles.js.add(entryFile);
|
|
303
|
+
let impacts = linkedImpactsByEntry.get(entryFile);
|
|
304
|
+
if (!impacts) {
|
|
305
|
+
impacts = /* @__PURE__ */ new Set();
|
|
306
|
+
linkedImpactsByEntry.set(entryFile, impacts);
|
|
307
|
+
}
|
|
308
|
+
impacts.add(changedFile);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
entries,
|
|
313
|
+
jsEntries,
|
|
314
|
+
sourceHashByFile,
|
|
315
|
+
runtimeAffectingSignatureByFile,
|
|
316
|
+
runtimeAffectingHashByFile,
|
|
317
|
+
changedByType,
|
|
318
|
+
runtimeAffectingChangedByType,
|
|
319
|
+
processFiles,
|
|
320
|
+
linkedImpactsByEntry
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function invertLinkedByEntry(linkedByEntry) {
|
|
324
|
+
const dependentsByLinkedFile = /* @__PURE__ */ new Map();
|
|
325
|
+
for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
|
|
326
|
+
let dependents = dependentsByLinkedFile.get(linkedFile);
|
|
327
|
+
if (!dependents) {
|
|
328
|
+
dependents = /* @__PURE__ */ new Set();
|
|
329
|
+
dependentsByLinkedFile.set(linkedFile, dependents);
|
|
330
|
+
}
|
|
331
|
+
dependents.add(entryFile);
|
|
332
|
+
}
|
|
333
|
+
return dependentsByLinkedFile;
|
|
334
|
+
}
|
|
335
|
+
function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
336
|
+
const incremental = options.incremental === true;
|
|
337
|
+
state.iteration += 1;
|
|
338
|
+
state.sourceHashByFile = incremental ? new Map([...state.sourceHashByFile, ...snapshot.sourceHashByFile]) : snapshot.sourceHashByFile;
|
|
339
|
+
state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
|
|
340
|
+
state.runtimeAffectingHashByFile = incremental ? new Map([...state.runtimeAffectingHashByFile, ...snapshot.runtimeAffectingHashByFile]) : snapshot.runtimeAffectingHashByFile;
|
|
341
|
+
state.linkedByEntry = incremental ? new Map([...state.linkedByEntry, ...linkedByEntry]) : linkedByEntry;
|
|
342
|
+
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
343
|
+
}
|
|
344
|
+
//#endregion
|
|
345
|
+
Object.defineProperty(exports, "applyLinkedResults", {
|
|
346
|
+
enumerable: true,
|
|
347
|
+
get: function() {
|
|
348
|
+
return applyLinkedResults;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
Object.defineProperty(exports, "buildBundleSnapshot", {
|
|
352
|
+
enumerable: true,
|
|
353
|
+
get: function() {
|
|
354
|
+
return buildBundleSnapshot;
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
Object.defineProperty(exports, "createBundleBuildState", {
|
|
358
|
+
enumerable: true,
|
|
359
|
+
get: function() {
|
|
360
|
+
return createBundleBuildState;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
Object.defineProperty(exports, "createBundleModuleGraphOptions", {
|
|
364
|
+
enumerable: true,
|
|
365
|
+
get: function() {
|
|
366
|
+
return createBundleModuleGraphOptions;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
Object.defineProperty(exports, "normalizeOutputPathKey", {
|
|
370
|
+
enumerable: true,
|
|
371
|
+
get: function() {
|
|
372
|
+
return normalizeOutputPathKey;
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
Object.defineProperty(exports, "pushConcurrentTaskFactories", {
|
|
376
|
+
enumerable: true,
|
|
377
|
+
get: function() {
|
|
378
|
+
return pushConcurrentTaskFactories;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
Object.defineProperty(exports, "resolveOutputSpecifier", {
|
|
382
|
+
enumerable: true,
|
|
383
|
+
get: function() {
|
|
384
|
+
return resolveOutputSpecifier;
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
Object.defineProperty(exports, "resolvePackageDir", {
|
|
388
|
+
enumerable: true,
|
|
389
|
+
get: function() {
|
|
390
|
+
return resolvePackageDir;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
Object.defineProperty(exports, "resolvePluginDisabledState", {
|
|
394
|
+
enumerable: true,
|
|
395
|
+
get: function() {
|
|
396
|
+
return resolvePluginDisabledState;
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
Object.defineProperty(exports, "toAbsoluteOutputPath", {
|
|
400
|
+
enumerable: true,
|
|
401
|
+
get: function() {
|
|
402
|
+
return toAbsoluteOutputPath;
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
Object.defineProperty(exports, "updateBundleBuildState", {
|
|
406
|
+
enumerable: true,
|
|
407
|
+
get: function() {
|
|
408
|
+
return updateBundleBuildState;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CreateJsHandlerOptions, IStyleHandlerOptions, ITemplateHandlerOptions, UserDefinedOptions } from '../../types';
|
|
2
|
+
import stream from 'node:stream';
|
|
3
|
+
export declare function createPlugins(options?: UserDefinedOptions): {
|
|
4
|
+
transformWxss: (options?: Partial<IStyleHandlerOptions>) => stream.Transform;
|
|
5
|
+
transformWxml: (options?: Partial<ITemplateHandlerOptions>) => stream.Transform;
|
|
6
|
+
transformJs: (options?: Partial<CreateJsHandlerOptions>) => stream.Transform;
|
|
7
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CacheValue, HashMapKey, ICreateCacheReturnType } from '../../cache';
|
|
2
|
+
export interface ProcessCachedTaskOptions<TValue extends CacheValue> {
|
|
3
|
+
cache: ICreateCacheReturnType;
|
|
4
|
+
cacheKey: string;
|
|
5
|
+
hashKey?: HashMapKey;
|
|
6
|
+
rawSource?: string;
|
|
7
|
+
hash?: string;
|
|
8
|
+
readCache?: () => TValue | undefined;
|
|
9
|
+
applyResult: (value: TValue) => void | Promise<void>;
|
|
10
|
+
transform: () => Promise<{
|
|
11
|
+
result: TValue;
|
|
12
|
+
cacheValue?: CacheValue;
|
|
13
|
+
}>;
|
|
14
|
+
onCacheHit?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function processCachedTask<TValue extends CacheValue>({ cache, cacheKey, hashKey, rawSource, hash, readCache, applyResult, transform, onCacheHit, }: ProcessCachedTaskOptions<TValue>): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type postcss from 'postcss';
|
|
2
|
+
export declare function removeSpecificityPlaceholders(root: postcss.Root): void;
|
|
3
|
+
export declare function removeUnsupportedBrowserSelectors(root: postcss.Root): void;
|
|
4
|
+
export declare function removeDisplayP3Declarations(root: postcss.Root): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type postcss from 'postcss';
|
|
2
|
+
export declare const MINI_PROGRAM_THEME_SCOPE_SELECTOR = ":host,page,.tw-root,wx-root-portal-content";
|
|
3
|
+
export declare const MINI_PROGRAM_PREFLIGHT_SELECTORS: Set<string>;
|
|
4
|
+
export declare const MINI_PROGRAM_THEME_SCOPE_SELECTORS: Set<string>;
|
|
5
|
+
export declare const SPECIFICITY_PLACEHOLDER_SUFFIXES: string[];
|
|
6
|
+
export declare function normalizeSelector(selector: string): string;
|
|
7
|
+
export declare function getRuleSelectors(rule: postcss.Rule): string[];
|
|
8
|
+
export declare function isUnsupportedBrowserSelector(selector: string): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppType } from '../../types';
|
|
2
|
+
export interface ResolveTailwindcssImportOptions {
|
|
3
|
+
join?: (base: string, subpath: string) => string;
|
|
4
|
+
appType?: AppType;
|
|
5
|
+
rootImport?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveTailwindcssImport(specifier: string, pkgDir: string, options?: ResolveTailwindcssImportOptions): string | null;
|
|
8
|
+
export declare function rewriteTailwindcssImportsInCode(code: string, pkgDir: string, options?: ResolveTailwindcssImportOptions): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function parseImportRequest(params: string): string | undefined;
|
|
2
|
+
export declare function removeTailwindSourceDirectives(rawSource: string): string;
|
|
3
|
+
export declare function hasTailwindSourceDirectives(rawSource: string): boolean;
|
|
4
|
+
export declare function hasTailwindRootDirectives(rawSource: string): boolean;
|
|
5
|
+
export declare function hasTailwindApplyDirective(rawSource: string): boolean;
|
|
6
|
+
export declare function resolveCssEntrySource(rawSource: string, base: string, options?: {
|
|
7
|
+
removeConfig?: boolean;
|
|
8
|
+
}): {
|
|
9
|
+
css: string;
|
|
10
|
+
config: string | undefined;
|
|
11
|
+
configRequest: string | undefined;
|
|
12
|
+
base: string;
|
|
13
|
+
} | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { TailwindResolvedSource } from '../../../generator';
|
|
3
|
+
import type { InternalUserDefinedOptions } from '../../../types';
|
|
4
|
+
export declare function removeTailwindApplyRules(rawSource: string): string;
|
|
5
|
+
export declare function hasConfiguredContainerCompatSources(sources: TailwindResolvedSource[]): boolean;
|
|
6
|
+
export declare function appendLegacyCompatCss(css: string, rawSource: string, generatorTarget: string, styleHandler: InternalUserDefinedOptions['styleHandler'], cssHandlerOptions: IStyleHandlerOptions, generatorStyleOptions: Partial<IStyleHandlerOptions> | undefined): Promise<string>;
|
|
7
|
+
export declare function appendLegacyContainerCompatCss(css: string, rawSource: string, file: string, runtime: Set<string>, configuredContainerCompat: boolean, generatorTarget: string, styleHandler: InternalUserDefinedOptions['styleHandler'], cssHandlerOptions: IStyleHandlerOptions, generatorStyleOptions: Partial<IStyleHandlerOptions> | undefined): Promise<string>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function normalizeCompatSelectors(selector: string): string[];
|
|
2
|
+
export declare function collectGeneratedSelectors(css: string): Set<string>;
|
|
3
|
+
export declare function removeGeneratedSelectorCompatCss(css: string, generatedCss: string): string;
|
|
4
|
+
export declare function collectDedupedPostTransformCompatCss(css: string, generatedCss: string): string;
|
|
5
|
+
export declare function removeDuplicatedViteMarkers(css: string, baseCss: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function inheritLegacyUnitConvertedDeclarations(css: string, legacyCss: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const TAILWIND_V4_BANNER_RE: RegExp;
|
|
2
|
+
export declare const TAILWIND_GENERATED_CSS_MARKER_RE: RegExp;
|
|
3
|
+
export declare const GENERATOR_PLACEHOLDER_MARKER_RE: RegExp;
|
|
4
|
+
export declare const GENERATOR_PLACEHOLDER_MARKER_GLOBAL_RE: RegExp;
|
|
5
|
+
export declare const TAILWIND_BANNER_PREFIX_RE: RegExp;
|
|
6
|
+
export declare const TAILWIND_BANNER_RE: RegExp;
|
|
7
|
+
export declare const TAILWIND_BANNER_GLOBAL_RE: RegExp;
|
|
8
|
+
export declare const VITE_MARKER_RE: RegExp;
|
|
9
|
+
export declare function createCssAppend(base: string, extra: string): string;
|
|
10
|
+
export declare function splitTailwindV4GeneratedCss(rawSource: string, rawTailwindCss: string): string | undefined;
|
|
11
|
+
export declare function removeTailwindGeneratedCssByBanner(rawSource: string): string | undefined;
|
|
12
|
+
export declare function stripTailwindBanner(css: string): string;
|
|
13
|
+
export declare function stripTailwindBanners(css: string): string;
|
|
14
|
+
export declare function stripGeneratorPlaceholderMarkers(css: string): string;
|
|
15
|
+
export declare function hasTailwindGeneratedCss(rawSource: string): boolean;
|
|
16
|
+
export declare function hasTailwindGeneratedCssMarkers(rawSource: string): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function resolveSourceSideCssEntrySource(file: string, sourceOptions: {
|
|
2
|
+
projectRoot?: string;
|
|
3
|
+
cwd?: string;
|
|
4
|
+
}, resolveOptions?: {
|
|
5
|
+
removeConfig?: boolean;
|
|
6
|
+
}): {
|
|
7
|
+
css: string;
|
|
8
|
+
config: string | undefined;
|
|
9
|
+
configRequest: string | undefined;
|
|
10
|
+
base: string;
|
|
11
|
+
} | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { NormalizedWeappTailwindcssGeneratorOptions, TailwindResolvedSource } from '../../../generator';
|
|
3
|
+
import type { InternalUserDefinedOptions } from '../../../types';
|
|
4
|
+
interface GeneratorSourceRuntimeState {
|
|
5
|
+
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveCssSourceBase(file: string, cssHandlerOptions: IStyleHandlerOptions): string;
|
|
8
|
+
export declare function resolveGeneratorSource(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions): Promise<import("@/generator").TailwindV3ResolvedSource | import("tailwindcss-patch").TailwindV4ResolvedSource>;
|
|
9
|
+
export declare function resolveGeneratorSources(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions): Promise<TailwindResolvedSource[]>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { InternalUserDefinedOptions } from '../../types';
|
|
3
|
+
export { hasTailwindSourceDirectives, removeTailwindSourceDirectives, resolveCssEntrySource, } from './generator-css/directives';
|
|
4
|
+
export { removeTailwindApplyRules, } from './generator-css/legacy-compat';
|
|
5
|
+
export { inheritLegacyUnitConvertedDeclarations, } from './generator-css/legacy-units';
|
|
6
|
+
export { createCssAppend, hasTailwindGeneratedCss, hasTailwindGeneratedCssMarkers, removeTailwindGeneratedCssByBanner, splitTailwindV4GeneratedCss, stripGeneratorPlaceholderMarkers, stripTailwindBanner, stripTailwindBanners, } from './generator-css/markers';
|
|
7
|
+
export { resolveGeneratorSource, } from './generator-css/source-resolver';
|
|
8
|
+
export interface GenerateCssByGeneratorOptions {
|
|
9
|
+
opts: InternalUserDefinedOptions;
|
|
10
|
+
runtimeState: {
|
|
11
|
+
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
12
|
+
readyPromise: Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
runtime: Set<string>;
|
|
15
|
+
rawSource: string;
|
|
16
|
+
file: string;
|
|
17
|
+
cssHandlerOptions: IStyleHandlerOptions;
|
|
18
|
+
cssUserHandlerOptions: IStyleHandlerOptions;
|
|
19
|
+
styleHandler: InternalUserDefinedOptions['styleHandler'];
|
|
20
|
+
debug: (format: string, ...args: unknown[]) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface GenerateCssByGeneratorResult {
|
|
23
|
+
css: string;
|
|
24
|
+
target: string;
|
|
25
|
+
source: 'generator';
|
|
26
|
+
dependencies: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function isPureLocalCssImportWrapper(css: string): boolean;
|
|
29
|
+
export declare function generateCssByGenerator(options: GenerateCssByGeneratorOptions): Promise<GenerateCssByGeneratorResult | undefined>;
|
|
30
|
+
export interface ValidateCandidatesByGeneratorOptions extends Omit<GenerateCssByGeneratorOptions, 'runtime'> {
|
|
31
|
+
candidates: Set<string>;
|
|
32
|
+
}
|
|
33
|
+
export declare function validateCandidatesByGenerator(options: ValidateCandidatesByGeneratorOptions): Promise<Set<string>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function normalizeOutputPathKey(value: string): string;
|
|
2
|
+
export declare function stripQueryAndHash(specifier: string): string;
|
|
3
|
+
export declare function isResolvableSpecifier(specifier: string): boolean;
|
|
4
|
+
export declare function toAbsoluteOutputPath(fileName: string, outDir: string): string;
|
|
5
|
+
export declare function resolveOutputSpecifier(specifier: string, importer: string, outDir: string, hasOutput: (value: string) => boolean): string | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OutputAsset, OutputChunk } from 'rollup';
|
|
2
|
+
import type { LinkedJsModuleResult } from '../../types';
|
|
3
|
+
export interface OutputEntry {
|
|
4
|
+
fileName: string;
|
|
5
|
+
output: OutputAsset | OutputChunk;
|
|
6
|
+
}
|
|
7
|
+
export declare function readOutputEntry(entry: OutputEntry): string | undefined;
|
|
8
|
+
export declare function isJavaScriptEntry(entry: OutputEntry): boolean;
|
|
9
|
+
export declare function createBundleModuleGraphOptions(outputDir: string, entries: Map<string, OutputEntry>): {
|
|
10
|
+
resolve(specifier: string, importer: string): string | undefined;
|
|
11
|
+
load(id: string): string | undefined;
|
|
12
|
+
filter(id: string): boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function applyLinkedResults(linked: Record<string, LinkedJsModuleResult> | undefined, entries: Map<string, OutputEntry>, onLinkedUpdate: (fileName: string, previous: string, next: string) => void, onApplied?: (entry: OutputEntry, code: string) => void): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { OutputAsset, OutputChunk } from 'rollup';
|
|
2
|
+
import type { OutputEntry } from './bundle-entries';
|
|
3
|
+
import type { InternalUserDefinedOptions } from '../../types';
|
|
4
|
+
export type EntryType = 'html' | 'js' | 'css' | 'other';
|
|
5
|
+
export interface BundleStateEntry {
|
|
6
|
+
file: string;
|
|
7
|
+
output: OutputAsset | OutputChunk;
|
|
8
|
+
source: string;
|
|
9
|
+
type: EntryType;
|
|
10
|
+
}
|
|
11
|
+
export interface ProcessFileSets {
|
|
12
|
+
html: Set<string>;
|
|
13
|
+
js: Set<string>;
|
|
14
|
+
css: Set<string>;
|
|
15
|
+
}
|
|
16
|
+
export interface BundleSnapshot {
|
|
17
|
+
entries: BundleStateEntry[];
|
|
18
|
+
jsEntries: Map<string, OutputEntry>;
|
|
19
|
+
sourceHashByFile: Map<string, string>;
|
|
20
|
+
runtimeAffectingSignatureByFile: Map<string, string>;
|
|
21
|
+
runtimeAffectingHashByFile: Map<string, string>;
|
|
22
|
+
changedByType: Record<EntryType, Set<string>>;
|
|
23
|
+
runtimeAffectingChangedByType: Record<EntryType, Set<string>>;
|
|
24
|
+
processFiles: ProcessFileSets;
|
|
25
|
+
linkedImpactsByEntry: Map<string, Set<string>>;
|
|
26
|
+
}
|
|
27
|
+
export interface BundleBuildState {
|
|
28
|
+
iteration: number;
|
|
29
|
+
sourceHashByFile: Map<string, string>;
|
|
30
|
+
runtimeAffectingSignatureByFile: Map<string, string>;
|
|
31
|
+
runtimeAffectingHashByFile: Map<string, string>;
|
|
32
|
+
linkedByEntry: Map<string, Set<string>>;
|
|
33
|
+
dependentsByLinkedFile: Map<string, Set<string>>;
|
|
34
|
+
}
|
|
35
|
+
interface UpdateBundleBuildStateOptions {
|
|
36
|
+
incremental?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare function createBundleBuildState(): BundleBuildState;
|
|
39
|
+
export declare function classifyBundleEntry(file: string, opts: InternalUserDefinedOptions): EntryType;
|
|
40
|
+
export declare function buildBundleSnapshot(bundle: Record<string, OutputAsset | OutputChunk>, opts: InternalUserDefinedOptions, outDir: string, state: BundleBuildState, forceAll?: boolean): BundleSnapshot;
|
|
41
|
+
export declare function buildBundleSnapshotForBuild(bundle: Record<string, OutputAsset | OutputChunk>, opts: InternalUserDefinedOptions, outDir: string): BundleSnapshot;
|
|
42
|
+
export declare function updateBundleBuildState(state: BundleBuildState, snapshot: BundleSnapshot, linkedByEntry: Map<string, Set<string>>, options?: UpdateBundleBuildStateOptions): void;
|
|
43
|
+
export {};
|