weapp-tailwindcss 5.0.0-next.3 → 5.0.0-next.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/README.md +4 -5
- package/bin/weapp-tailwindcss.js +1 -21
- 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 +1 -2
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +11 -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 +12 -22
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- 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 +2 -1
- package/dist/bundlers/vite/index.d.ts +1 -1
- 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/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +0 -1
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +1 -1
- package/dist/cache-DPN5yKSX.js +497 -0
- package/dist/cache-nq0_XJoS.mjs +429 -0
- package/dist/cli/context.d.ts +0 -3
- package/dist/cli/helpers.d.ts +1 -2
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/types.d.ts +0 -2
- package/dist/cli.js +108 -598
- package/dist/cli.mjs +119 -608
- package/dist/constants.d.ts +1 -2
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +13 -20
- package/dist/core.mjs +8 -14
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.d.ts +1 -0
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.d.ts +15 -1
- package/dist/defaults.js +33 -14
- package/dist/defaults.mjs +30 -15
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/options.d.ts +3 -4
- package/dist/{generator-Y-Ikv4Fu.mjs → generator-CzfdCZyd.mjs} +277 -23
- package/dist/{generator-mmhXzZnv.js → generator-TOp4uz7c.js} +281 -27
- package/dist/{generator-css-Bwy_Uz89.mjs → generator-css-B938WI9a.mjs} +694 -506
- package/dist/{generator-css-CRLrHW4F.js → generator-css-Dnpl-IY2.js} +699 -505
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/gulp.js +29 -28
- package/dist/gulp.mjs +25 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/js/index.d.ts +1 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/logger-BRy6XPQ2.js +1 -0
- package/dist/logger-Bub1jggA.mjs +2 -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-BtAP6sQO.mjs +288 -0
- package/dist/postcss-WsXlC7A-.js +298 -0
- package/dist/postcss.d.ts +2 -2
- package/dist/postcss.js +3 -276
- package/dist/postcss.mjs +1 -269
- package/dist/{recorder-GdTJ3QqX.js → precheck-Dka94ArV.js} +141 -283
- package/dist/{recorder-XdFvVASS.mjs → precheck-DlrmwCc-.mjs} +106 -247
- package/dist/presets.js +6 -4
- package/dist/presets.mjs +4 -2
- package/dist/reset.d.ts +1 -0
- package/dist/{css-imports-BbrbluP9.js → run-tasks-B50A3pxt.js} +6 -55
- package/dist/{css-imports-CSdPq_Sc.mjs → run-tasks-DdNi-hkk.mjs} +5 -42
- package/dist/runtime-patch-pGdCqAEu.mjs +71 -0
- package/dist/runtime-patch-qwuisukL.js +85 -0
- package/dist/tailwindcss/miniprogram.d.ts +5 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.d.ts +1 -2
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +2 -3
- package/dist/tailwindcss/targets.d.ts +1 -5
- package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
- package/dist/tailwindcss/v4/patcher.d.ts +2 -1
- package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/{logger-BoVx1Dbt.mjs → tailwindcss-BIJ185GB.mjs} +25 -434
- package/dist/{logger-BZ45DZJT.js → tailwindcss-T1U5T-iF.js} +30 -468
- package/dist/typedoc.export.d.ts +0 -2
- package/dist/types/index.d.ts +2 -9
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +0 -2
- package/dist/types/user-defined-options/important.d.ts +3 -3
- package/dist/uni-app-x/vite.d.ts +1 -1
- package/dist/utils/disabled.d.ts +2 -3
- package/dist/{vite-BDywuCjn.mjs → vite-BXChkciE.mjs} +669 -481
- package/dist/{vite-DgRh_GXn.js → vite-D0CoRblu.js} +707 -519
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +3 -4
- package/dist/vite.mjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.js +1 -1
- package/dist/{webpack-CiHqVZTg.mjs → webpack-BNdGm9KL.mjs} +224 -38
- package/dist/{webpack-CAJR4hhP.js → webpack-D-sUCY0u.js} +250 -69
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +23 -35
- package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
- package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
- package/dist/cli/config.d.ts +0 -5
- package/dist/cli/helpers/patch-cwd.d.ts +0 -1
- package/dist/cli/mount-options/patch-status.d.ts +0 -2
- package/dist/cli/patch-options.d.ts +0 -6
- package/dist/cli/tokens.d.ts +0 -4
- package/dist/cli/workspace/package-dirs.d.ts +0 -3
- package/dist/cli/workspace/patch-package.d.ts +0 -3
- package/dist/cli/workspace/patch-utils.d.ts +0 -3
- package/dist/cli/workspace/types.d.ts +0 -11
- package/dist/cli/workspace/workspace-globs.d.ts +0 -2
- package/dist/cli/workspace/workspace-io.d.ts +0 -1
- package/dist/cli/workspace/workspace-lock.d.ts +0 -1
- package/dist/cli/workspace.d.ts +0 -2
- package/dist/experimental/index.d.ts +0 -2
- package/dist/experimental/oxc/ast-utils.d.ts +0 -30
- package/dist/experimental/oxc/index.d.ts +0 -2
- package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
- package/dist/experimental/shared/cache.d.ts +0 -3
- package/dist/experimental/shared/transform.d.ts +0 -3
- package/dist/experimental/shared.d.ts +0 -8
- package/dist/experimental/swc/ast-utils.d.ts +0 -30
- package/dist/experimental/swc/index.d.ts +0 -2
- package/dist/experimental/swc/module-specifiers.d.ts +0 -2
- package/dist/js/syntax.d.ts +0 -10
- package/dist/loader-anchors-1MumTAtA.mjs +0 -205
- package/dist/loader-anchors-TrFvT6g1.js +0 -273
- package/dist/patcher-options-6gJN2EXy.js +0 -115
- package/dist/patcher-options-DQfR5xxT.mjs +0 -92
- package/dist/tailwindcss/recorder.d.ts +0 -13
- package/dist/tailwindcss/targets/paths.d.ts +0 -13
- package/dist/tailwindcss/targets/record-io.d.ts +0 -5
- package/dist/tailwindcss/targets/recorder.d.ts +0 -3
- package/dist/tailwindcss/targets/types.d.ts +0 -35
- package/dist/types/disabled-options.d.ts +0 -4
- package/dist/webpack4.d.ts +0 -4
- package/dist/webpack4.js +0 -387
- package/dist/webpack4.mjs +0 -379
- package/scripts/postinstall.mjs +0 -59
- /package/dist/{constants-p1dyh1x1.js → constants-BoB_6lFw.js} +0 -0
- /package/dist/{constants-B-_T5UnW.mjs → constants-E_loJC49.mjs} +0 -0
- /package/dist/{utils-7DUGTFED.mjs → utils-BJjKRQgf.mjs} +0 -0
- /package/dist/{utils-DmC9_In3.js → utils-VZvGusYs.js} +0 -0
package/README.md
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|

|
|
17
17
|

|
|
18
|
-

|
|
19
18
|

|
|
20
19
|
[](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
|
|
21
20
|
[](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
|
|
@@ -55,12 +54,12 @@
|
|
|
55
54
|
|
|
56
55
|
## 版本对应
|
|
57
56
|
|
|
58
|
-
目前,`weapp-tailwindcss` 的 `
|
|
57
|
+
目前,`weapp-tailwindcss` 的 `5.x` 版本
|
|
59
58
|
|
|
60
|
-
- 支持最新版本的 `tailwindcss v4` 和 `v3
|
|
61
|
-
- 支持 `webpack5
|
|
59
|
+
- 支持最新版本的 `tailwindcss v4` 和 `v3`。
|
|
60
|
+
- 支持 `webpack5`、`vite`、`rspack`、`rollup`、`rolldown` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
|
|
62
61
|
|
|
63
|
-
>
|
|
62
|
+
> `weapp-tailwindcss@5` 面向 Tailwind CSS v3/v4 和现代构建链路,不再内置 Webpack4、PostCSS7、Tailwind CSS v2 兼容入口。`weapp-tailwindcss@5` 需要 `nodejs` 版本 `^20.19.0 || >=22.12.0`,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
|
|
64
63
|
|
|
65
64
|
## [安装与使用方式](https://tw.icebreaker.top/docs/quick-start/install)
|
|
66
65
|
|
package/bin/weapp-tailwindcss.js
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const fs = require('node:fs')
|
|
3
3
|
const path = require('node:path')
|
|
4
|
-
const process = require('node:process')
|
|
5
|
-
|
|
6
|
-
function isInstallLifecycle() {
|
|
7
|
-
return process.env.npm_lifecycle_event === 'postinstall' || process.env.npm_lifecycle_event === 'prepare'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function isMissingRuntimeModuleError(error) {
|
|
11
|
-
return error && error.code === 'MODULE_NOT_FOUND'
|
|
12
|
-
}
|
|
13
4
|
|
|
14
5
|
const cliPath = path.resolve(__dirname, '../dist/cli.js')
|
|
15
6
|
if (fs.existsSync(cliPath)) {
|
|
16
|
-
|
|
17
|
-
require(cliPath)
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
if (isInstallLifecycle() && isMissingRuntimeModuleError(error)) {
|
|
21
|
-
console.error('[weapp-tailwindcss] install lifecycle patch skipped because a runtime module is missing.')
|
|
22
|
-
console.error('Run `pnpm --filter weapp-tailwindcss build` before strict CLI validation.')
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
throw error
|
|
26
|
-
}
|
|
27
|
-
}
|
|
7
|
+
require(cliPath)
|
|
28
8
|
}
|
|
@@ -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;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function removeUnsupportedAtSupports(css: string): string;
|
|
1
|
+
export { removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules } from './css-cleanup/at-rules';
|
|
3
2
|
export declare function hoistTailwindPreflightBase(css: string): string;
|
|
4
3
|
export declare function finalizeMiniProgramCss(css: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 resolveCssEntrySource(rawSource: string, base: string, options?: {
|
|
5
|
+
removeConfig?: boolean;
|
|
6
|
+
}): {
|
|
7
|
+
css: string;
|
|
8
|
+
config: string | undefined;
|
|
9
|
+
configRequest: string | undefined;
|
|
10
|
+
base: string;
|
|
11
|
+
} | 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 {};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
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';
|
|
3
8
|
export interface GenerateCssByGeneratorOptions {
|
|
4
9
|
opts: InternalUserDefinedOptions;
|
|
5
10
|
runtimeState: {
|
|
6
11
|
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
7
|
-
|
|
12
|
+
readyPromise: Promise<void>;
|
|
8
13
|
};
|
|
9
14
|
runtime: Set<string>;
|
|
10
15
|
rawSource: string;
|
|
@@ -17,27 +22,12 @@ export interface GenerateCssByGeneratorOptions {
|
|
|
17
22
|
export interface GenerateCssByGeneratorResult {
|
|
18
23
|
css: string;
|
|
19
24
|
target: string;
|
|
20
|
-
source: 'generator'
|
|
25
|
+
source: 'generator';
|
|
26
|
+
dependencies: string[];
|
|
21
27
|
}
|
|
22
|
-
export declare function createCssAppend(base: string, extra: string): string;
|
|
23
|
-
export declare function splitTailwindV4GeneratedCss(rawSource: string, rawTailwindCss: string): string | undefined;
|
|
24
|
-
export declare function removeTailwindGeneratedCssByBanner(rawSource: string): string | undefined;
|
|
25
|
-
export declare function stripTailwindBanner(css: string): string;
|
|
26
|
-
export declare function stripTailwindBanners(css: string): string;
|
|
27
|
-
export declare function stripGeneratorPlaceholderMarkers(css: string): string;
|
|
28
|
-
export declare function hasTailwindGeneratedCss(rawSource: string): boolean;
|
|
29
|
-
export declare function hasTailwindGeneratedCssMarkers(rawSource: string): boolean;
|
|
30
|
-
export declare function inheritLegacyUnitConvertedDeclarations(css: string, legacyCss: string): string;
|
|
31
|
-
export declare function removeTailwindSourceDirectives(rawSource: string): string;
|
|
32
|
-
export declare function hasTailwindSourceDirectives(rawSource: string): boolean;
|
|
33
|
-
export declare function resolveCssEntrySource(rawSource: string, base: string, options?: {
|
|
34
|
-
removeConfig?: boolean;
|
|
35
|
-
}): {
|
|
36
|
-
css: string;
|
|
37
|
-
config: string | undefined;
|
|
38
|
-
configRequest: string | undefined;
|
|
39
|
-
base: string;
|
|
40
|
-
} | undefined;
|
|
41
|
-
export declare function resolveGeneratorSource(majorVersion: number | undefined, runtimeState: GenerateCssByGeneratorOptions['runtimeState'], rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions): Promise<import("@/generator").TailwindV3ResolvedSource | import("tailwindcss-patch").TailwindV4ResolvedSource>;
|
|
42
28
|
export declare function isPureLocalCssImportWrapper(css: string): boolean;
|
|
43
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>>;
|
|
@@ -5,7 +5,7 @@ interface CssFinalizerContext {
|
|
|
5
5
|
opts: InternalUserDefinedOptions;
|
|
6
6
|
runtimeState: {
|
|
7
7
|
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
8
|
-
|
|
8
|
+
readyPromise: Promise<void>;
|
|
9
9
|
};
|
|
10
10
|
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
11
11
|
isCssAssetProcessed: (asset: OutputAsset, file?: string) => boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InternalUserDefinedOptions, IStyleHandlerOptions } from '../../../types';
|
|
2
|
+
type CssHandlerOptions = IStyleHandlerOptions & {
|
|
3
|
+
postcssOptions: {
|
|
4
|
+
options: {
|
|
5
|
+
from: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
majorVersion: number | undefined;
|
|
9
|
+
};
|
|
10
|
+
interface CssHandlerOptionsCacheOptions {
|
|
11
|
+
appType: InternalUserDefinedOptions['appType'];
|
|
12
|
+
mainCssChunkMatcher: InternalUserDefinedOptions['mainCssChunkMatcher'];
|
|
13
|
+
getMajorVersion: () => number | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface CssHandlerOptionsCache {
|
|
16
|
+
getCssHandlerOptions: (file: string) => CssHandlerOptions;
|
|
17
|
+
getCssUserHandlerOptions: (file: string) => CssHandlerOptions;
|
|
18
|
+
}
|
|
19
|
+
export declare function createCssHandlerOptionsCache(options: CssHandlerOptionsCacheOptions): CssHandlerOptionsCache;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InternalUserDefinedOptions } from '../../../types';
|
|
2
|
+
export declare function createCssTransformShareScopeKey(opts: InternalUserDefinedOptions, file: string, rawSource: string): string;
|
|
3
|
+
export declare function createCssRuntimeSignature(runtimeSignature: string, generatorCandidateSignature: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasOmittedKnownBundleFiles(currentBundleFiles: string[], previousBundleFiles: Iterable<string>): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CreateJsHandlerOptions, InternalUserDefinedOptions } from '../../../types';
|
|
2
|
+
interface JsHandlerOptionsFactoryOptions {
|
|
3
|
+
getMajorVersion: () => number | undefined;
|
|
4
|
+
moduleGraph: CreateJsHandlerOptions['moduleGraph'];
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveUniAppXJsTransformEnabled(uniAppX: InternalUserDefinedOptions['uniAppX'] | undefined): boolean;
|
|
7
|
+
export declare function createJsHandlerOptionsFactory(options: JsHandlerOptionsFactoryOptions): (absoluteFilename: string, extra?: CreateJsHandlerOptions) => CreateJsHandlerOptions;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OutputEntry } from '../bundle-entries';
|
|
2
|
+
import type { LinkedJsModuleResult } from '../../../types';
|
|
3
|
+
interface LinkedUpdateHelpersOptions {
|
|
4
|
+
jsEntries: Map<string, OutputEntry>;
|
|
5
|
+
onUpdate: (fileName: string, previous: string, next: string) => void;
|
|
6
|
+
debug: (format: string, ...args: unknown[]) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createLinkedUpdateHelpers(options: LinkedUpdateHelpersOptions): {
|
|
9
|
+
applyLinkedUpdates: (linked?: Record<string, LinkedJsModuleResult>) => void;
|
|
10
|
+
pendingLinkedUpdates: (() => void)[];
|
|
11
|
+
};
|
|
12
|
+
export declare function collectLinkedFileNames(linked: Record<string, LinkedJsModuleResult> | undefined, getJsEntry: (id: string) => OutputEntry | undefined, linkedSet: Set<string> | undefined): void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface BundleMetric {
|
|
2
|
+
total: number;
|
|
3
|
+
transformed: number;
|
|
4
|
+
cacheHits: number;
|
|
5
|
+
elapsed: number;
|
|
6
|
+
}
|
|
7
|
+
export interface BundleMetrics {
|
|
8
|
+
runtimeSet: number;
|
|
9
|
+
html: BundleMetric;
|
|
10
|
+
js: BundleMetric;
|
|
11
|
+
css: BundleMetric;
|
|
12
|
+
}
|
|
13
|
+
export declare function formatDebugFileList(files: Set<string>, limit?: number): string;
|
|
14
|
+
export declare function createEmptyMetrics(): BundleMetrics;
|
|
15
|
+
export declare function measureElapsed(start: number): number;
|
|
16
|
+
export declare function formatCacheHitRate(metric: BundleMetric): string;
|
|
17
|
+
export declare function formatMs(value: number): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BundleSnapshot } from '../bundle-state';
|
|
2
|
+
interface LogBundleProcessPlanOptions {
|
|
3
|
+
debug: (format: string, ...args: unknown[]) => void;
|
|
4
|
+
snapshot: BundleSnapshot;
|
|
5
|
+
useIncrementalMode: boolean;
|
|
6
|
+
iteration: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function logBundleProcessPlan(options: LogBundleProcessPlanOptions): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OutputAsset } from 'rollup';
|
|
2
|
+
interface GeneratorDependencyContext {
|
|
3
|
+
addWatchFile?: (id: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function createReplayCssAsset(fileName: string, source: string): OutputAsset;
|
|
6
|
+
export declare function registerGeneratorDependencies(ctx: GeneratorDependencyContext, dependencies: readonly string[] | undefined): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EntryType } from '../bundle-state';
|
|
2
|
+
export declare function summarizeStringDiff(previous: string, next: string): string;
|
|
3
|
+
export declare function createLinkedImpactSignature(entry: string, linkedImpactsByEntry: Map<string, Set<string>>, sourceHashByFile: Map<string, string>): string | undefined;
|
|
4
|
+
export declare function createJsHashSalt(runtimeSignature: string, linkedImpactSignature?: string): string;
|
|
5
|
+
export declare function createStableTextSignature(input: string): string;
|
|
6
|
+
export declare function createCandidateSignature(candidates: Set<string>): string;
|
|
7
|
+
export declare function getSnapshotHash(snapshotMap: Map<string, string>, file: string, fallback: string): string;
|
|
8
|
+
export declare function hasRuntimeAffectingSourceChanges(changedByType: Record<EntryType, Set<string>>): boolean;
|
|
@@ -6,7 +6,7 @@ interface GenerateBundleContext {
|
|
|
6
6
|
opts: InternalUserDefinedOptions;
|
|
7
7
|
runtimeState: {
|
|
8
8
|
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
9
|
-
|
|
9
|
+
readyPromise: Promise<void>;
|
|
10
10
|
};
|
|
11
11
|
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
12
12
|
ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean) => Promise<Set<string>>;
|
|
@@ -23,6 +23,7 @@ interface GenerateBundleContext {
|
|
|
23
23
|
recordGeneratorCandidates?: (candidates: Set<string>) => void;
|
|
24
24
|
}
|
|
25
25
|
interface GenerateBundleThis {
|
|
26
|
+
addWatchFile?: (id: string) => void;
|
|
26
27
|
emitFile?: (emittedFile: {
|
|
27
28
|
type: 'asset';
|
|
28
29
|
fileName: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
2
|
import type { UserDefinedOptions } from '../../types';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function WeappTailwindcss(options?: UserDefinedOptions): Plugin[] | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export declare function getPostcssPluginName(plugin: unknown): string | undefined;
|
|
3
|
+
export declare function removeTailwindPostcssPlugins(plugins: unknown[]): number;
|
|
4
|
+
export declare function removeTailwindVitePlugins(plugins: Plugin[]): number;
|
|
5
|
+
export declare function disableAndRemoveTailwindVitePlugins(plugins: unknown[]): number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import postcssrc from 'postcss-load-config';
|
|
2
|
+
export declare function resolveFilteredPostcssConfig(root: string): Promise<{
|
|
3
|
+
options: import("postcss").ProcessOptions<import("postcss").Document | import("postcss").Root>;
|
|
4
|
+
plugins: postcssrc.ResultPlugin[];
|
|
5
|
+
removed: number;
|
|
6
|
+
} | undefined>;
|
|
@@ -3,6 +3,7 @@ import type { AppType } from '../../types';
|
|
|
3
3
|
interface RewriteCssImportsOptions {
|
|
4
4
|
appType?: AppType;
|
|
5
5
|
getAppType?: () => AppType | undefined;
|
|
6
|
+
shouldOwnTailwindGeneration?: boolean;
|
|
6
7
|
shouldRewrite: boolean;
|
|
7
8
|
rootImport?: string;
|
|
8
9
|
weappTailwindcssDirPosix: string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BundleSnapshot } from './bundle-state';
|
|
2
|
+
import type { InternalUserDefinedOptions } from '../../types';
|
|
3
|
+
interface CreateViteRuntimeClassSetOptions {
|
|
4
|
+
opts: InternalUserDefinedOptions;
|
|
5
|
+
initialTwPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
6
|
+
refreshTailwindcssPatcher: InternalUserDefinedOptions['refreshTailwindcssPatcher'];
|
|
7
|
+
uniAppXEnabled: boolean;
|
|
8
|
+
customAttributesEntities: unknown;
|
|
9
|
+
disabledDefaultTemplateHandler: boolean;
|
|
10
|
+
debug: (format: string, ...args: unknown[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createViteRuntimeClassSet(options: CreateViteRuntimeClassSetOptions): {
|
|
13
|
+
runtimeState: {
|
|
14
|
+
twPatcher: import("@/types").TailwindcssPatcherLike;
|
|
15
|
+
readyPromise: Promise<void>;
|
|
16
|
+
refreshTailwindcssPatcher: (options?: import("@/types").RefreshTailwindcssPatcherOptions) => Promise<import("@/types").TailwindcssPatcherLike>;
|
|
17
|
+
};
|
|
18
|
+
refreshRuntimeState: (force: boolean) => Promise<void>;
|
|
19
|
+
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
20
|
+
ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean) => Promise<Set<string>>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveImplicitTailwindcssBasedirFromViteRoot(root: string): string;
|
|
@@ -16,5 +16,6 @@ interface WebpackWatchChangeLike {
|
|
|
16
16
|
removedFiles?: Set<string>;
|
|
17
17
|
}
|
|
18
18
|
export declare function createAssetHashByChunkMap(chunks: Iterable<ChunkLike>): Map<string, string>;
|
|
19
|
+
export declare function createRuntimeAwareCssHash(assetHash: string | undefined, sourceHash: string, runtimeSetHash: string): string;
|
|
19
20
|
export declare function hasWatchChanges(compiler: WebpackWatchChangeLike): boolean;
|
|
20
21
|
export {};
|
|
@@ -6,7 +6,7 @@ interface SetupWebpackV5ProcessAssetsHookOptions {
|
|
|
6
6
|
appType?: AppType;
|
|
7
7
|
runtimeState: {
|
|
8
8
|
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
9
|
-
|
|
9
|
+
readyPromise: Promise<void>;
|
|
10
10
|
};
|
|
11
11
|
getRuntimeRefreshRequirement: () => boolean;
|
|
12
12
|
refreshRuntimeMetadata: (force: boolean) => Promise<void>;
|
|
@@ -7,7 +7,6 @@ interface SetupWebpackV5LoadersOptions {
|
|
|
7
7
|
weappTailwindcssPackageDir: string;
|
|
8
8
|
shouldRewriteCssImports: boolean;
|
|
9
9
|
runtimeLoaderPath?: string;
|
|
10
|
-
runtimeCssImportRewriteLoaderPath?: string;
|
|
11
10
|
getClassSetInLoader: () => Promise<void>;
|
|
12
11
|
getRuntimeWatchDependencies: () => {
|
|
13
12
|
files: ReadonlySet<string>;
|