weapp-tailwindcss 5.3.6 → 5.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/README.zh-CN.md +4 -4
- package/dist/bundlers/shared/framework-postcss.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/result-helpers.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/types.d.ts +3 -1
- package/dist/bundlers/shared/source-candidates/snapshot.d.ts +19 -0
- package/dist/bundlers/shared/source-candidates/source-priority.d.ts +1 -0
- package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +1 -0
- package/dist/bundlers/shared/source-candidates/views.d.ts +12 -0
- package/dist/bundlers/shared/style-requests.d.ts +1 -0
- package/dist/bundlers/vite/bundle-state.d.ts +9 -1
- package/dist/bundlers/vite/capability-profile.d.ts +18 -0
- package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +12 -0
- package/dist/bundlers/vite/hot-css-modules.d.ts +2 -2
- package/dist/bundlers/vite/shared/configured-css-entry-observer.d.ts +29 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +8 -0
- package/dist/bundlers/vite/shared/framework-css-generation-queue.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-hmr-module-version.d.ts +9 -0
- package/dist/bundlers/vite/shared/framework-runtime-utils.d.ts +5 -0
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +12 -2
- package/dist/compiler/compilation-session-pool.d.ts +1 -0
- package/dist/compiler/framework-compiler-session.d.ts +21 -0
- package/dist/compiler/index.d.ts +1 -0
- package/dist/{context-DTLRADfE.cjs → compiler-CDAz4SwJ.cjs} +907 -11
- package/dist/{context-4ittVpgt.js → compiler-DWcUgi3A.js} +813 -6
- package/dist/context/handlers.d.ts +1 -1
- package/dist/core/compiler/compiler.d.ts +2 -0
- package/dist/core/compiler/generation-cache.d.ts +30 -0
- package/dist/core/compiler/generation-state.d.ts +17 -0
- package/dist/core/compiler/index.d.ts +2 -0
- package/dist/core/compiler/root-store.d.ts +41 -0
- package/dist/core/compiler/snapshot.d.ts +35 -0
- package/dist/core/compiler/source-fingerprint.d.ts +3 -0
- package/dist/core/compiler/transforms.d.ts +15 -0
- package/dist/core/compiler/types.d.ts +75 -0
- package/dist/core.cjs +34 -8
- package/dist/core.d.ts +4 -1
- package/dist/core.js +3 -2
- package/dist/framework/index.d.ts +3 -1
- package/dist/framework.cjs +6 -1
- package/dist/framework.js +6 -1
- package/dist/{generator-EnTXLBlK.js → generator-BjK5PRR-.js} +28 -10
- package/dist/{generator-DKiYbTFR.cjs → generator-WlhrtNa3.cjs} +26 -8
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-DwtrU4V1.js → gulp-BbMMp7vY.js} +7 -7
- package/dist/{gulp-CUysZjW3.cjs → gulp-CBu_waef.cjs} +14 -16
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-utmOgn6p.js → hmr-timing-B_4sAvsk.js} +369 -291
- package/dist/{hmr-timing-Cvh5UgnM.cjs → hmr-timing-CYhNto2U.cjs} +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-CyVXL3h6.cjs → pipeline-helpers-Du8eAtMG.cjs} +6 -6
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -3
- package/dist/presets.js +1 -1
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{source-candidate-scan-signature-BNt7NrrI.cjs → source-candidate-scan-signature-ZOm0O17V.cjs} +5 -5
- package/dist/{source-candidate-scan-signature-CDrLxVKu.js → source-candidate-scan-signature-wieibgE7.js} +3 -3
- package/dist/{tailwindcss-ChnpCv25.js → tailwindcss-9xmoCkaR.js} +1 -1
- package/dist/{tailwindcss-CexDJBhx.cjs → tailwindcss-D3jltF7M.cjs} +763 -5
- package/dist/{transform-CL-UZW1U.cjs → transform-C6k9zTQR.cjs} +12 -4
- package/dist/{transform-Bfi1_VgN.js → transform-DQhgAarN.js} +12 -4
- package/dist/typedoc.export.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/uni-app-x/component-local-style.d.ts +2 -0
- package/dist/uni-app-x/transform.d.ts +1 -0
- package/dist/uni-app-x/vite/asset-task.d.ts +21 -0
- package/dist/uni-app-x/vite/plugin-options.d.ts +8 -0
- package/dist/uni-app-x/vite/web-local-style.d.ts +2 -1
- package/dist/uni-app-x/vite.d.ts +1 -21
- package/dist/{v4-generation-core-Dhsu9Deu.cjs → v4-generation-core-BhYkeoZ4.cjs} +378 -300
- package/dist/{vite-DMX5zoID.cjs → vite-B0cvyfSY.cjs} +807 -200
- package/dist/{vite-DJkhb8n1.js → vite-Fu6GTjIY.js} +774 -165
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +7 -7
- package/dist/{webpack-Cpy_yggg.cjs → webpack-Amn5lmnx.cjs} +33 -35
- package/dist/{webpack-CzhrD9p3.js → webpack-BKHO-WSM.js} +10 -10
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/wxml/utils.d.ts +1 -1
- package/dist/{wxml-B7OAVpXJ.js → wxml-CvKyV69S.js} +10 -2
- package/dist/{wxml-PrK-8ARX.cjs → wxml-o-CUulAM.cjs} +40 -32
- package/package.json +12 -11
- package/dist/options-BJrtIQbH.cjs +0 -768
- package/dist/style-options-DW30H5PV.cjs +0 -82
|
@@ -2,5 +2,5 @@ import type { ICustomAttributesEntities, InternalUserDefinedOptions } from '../t
|
|
|
2
2
|
export declare function createHandlersFromContext(ctx: InternalUserDefinedOptions, customAttributesEntities: ICustomAttributesEntities, cssCalcOptions: InternalUserDefinedOptions['cssCalc'], tailwindcssMajorVersion?: number): {
|
|
3
3
|
styleHandler: import("@weapp-tailwindcss/postcss").StyleHandler;
|
|
4
4
|
jsHandler: import("../types/index.js").JsHandler;
|
|
5
|
-
templateHandler: (rawSource: string, opt?:
|
|
5
|
+
templateHandler: (rawSource: string, opt?: import("../types/index.js").ITemplateHandlerOptions) => Promise<string>;
|
|
6
6
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CompilerGenerateRequest, CompilerTarget } from './types.js';
|
|
2
|
+
import type { WeappTailwindcssGenerateResult } from '../../generator/index.js';
|
|
3
|
+
export interface CompilerGenerationCacheEntry {
|
|
4
|
+
key: CompilerGenerationCacheKey;
|
|
5
|
+
result: WeappTailwindcssGenerateResult;
|
|
6
|
+
}
|
|
7
|
+
interface CompilerGenerationCacheKey {
|
|
8
|
+
bareArbitraryValues: CompilerGenerateRequest['bareArbitraryValues'];
|
|
9
|
+
candidateSignature: string;
|
|
10
|
+
incrementalCache: CompilerGenerateRequest['incrementalCache'];
|
|
11
|
+
scanSources: CompilerGenerateRequest['scanSources'];
|
|
12
|
+
sourcesFingerprint: string | undefined;
|
|
13
|
+
styleOptionsFingerprint: string | undefined;
|
|
14
|
+
target: CompilerTarget;
|
|
15
|
+
}
|
|
16
|
+
export declare function createCompilerGenerationCacheKey(request: CompilerGenerateRequest, candidates: Iterable<string>, target: CompilerTarget): CompilerGenerationCacheKey;
|
|
17
|
+
export declare function isSameCompilerGenerationCacheKey(left: CompilerGenerationCacheKey, right: CompilerGenerationCacheKey): boolean;
|
|
18
|
+
export declare function reuseCompilerGenerationResult(result: WeappTailwindcssGenerateResult): {
|
|
19
|
+
incrementalCss: string;
|
|
20
|
+
incrementalRawCss: string;
|
|
21
|
+
css: string;
|
|
22
|
+
rawCss: string;
|
|
23
|
+
target: "weapp" | "web";
|
|
24
|
+
root: import("@tailwindcss-mangle/engine").TailwindV4CompiledSourceRoot;
|
|
25
|
+
sources: import("@tailwindcss-mangle/engine").TailwindV4SourcePattern[];
|
|
26
|
+
classSet: Set<string>;
|
|
27
|
+
rawCandidates: Set<string>;
|
|
28
|
+
dependencies: string[];
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CompilerRootSession } from './root-store.js';
|
|
2
|
+
import type { CompilerGenerateRequest } from './types.js';
|
|
3
|
+
import type { CompilationGraphSnapshot, CompilationResult } from '../../compiler/types.js';
|
|
4
|
+
import type { TailwindV4ResolvedSource } from '../../generator/index.js';
|
|
5
|
+
export interface CompilerCompilationCacheEntry {
|
|
6
|
+
candidateSignature: string;
|
|
7
|
+
compilation: CompilationResult;
|
|
8
|
+
graph: CompilationGraphSnapshot;
|
|
9
|
+
}
|
|
10
|
+
interface PreparedCompilerGeneration extends CompilerCompilationCacheEntry {
|
|
11
|
+
compilation: CompilationResult;
|
|
12
|
+
explicitCandidates: boolean;
|
|
13
|
+
graph: CompilationGraphSnapshot;
|
|
14
|
+
}
|
|
15
|
+
export declare function prepareCompilerGeneration(entry: CompilerRootSession, request: CompilerGenerateRequest, source: TailwindV4ResolvedSource, sourceChanged: boolean): PreparedCompilerGeneration;
|
|
16
|
+
export declare function commitCompilerGeneration(entry: CompilerRootSession, prepared: PreparedCompilerGeneration, source: TailwindV4ResolvedSource, dependencies: Iterable<string>, classSet: Iterable<string>): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createCompiler } from './compiler.js';
|
|
2
|
+
export type { Compiler, CompilerCacheReuseState, CompilerCssTransformOptions, CompilerGenerateRequest, CompilerGenerateResult, CompilerSnapshot, CompilerSnapshotRoot, CompilerSourcePattern, CompilerTarget, CompilerTemplateTransformOptions, CreateCompilerOptions, CreateCompilerSnapshotRequest, } from './types.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CompilerGenerationCacheEntry } from './generation-cache.js';
|
|
2
|
+
import type { CompilerCompilationCacheEntry } from './generation-state.js';
|
|
3
|
+
import type { CompilerSnapshot, CompilerSourcePattern } from './types.js';
|
|
4
|
+
import type { TailwindV4ResolvedSource, WeappTailwindcssGenerator } from '../../generator/index.js';
|
|
5
|
+
import { DefaultCompilationSession } from '../../compiler/session.js';
|
|
6
|
+
export interface CompilerRootSession {
|
|
7
|
+
accepting: boolean;
|
|
8
|
+
active: boolean;
|
|
9
|
+
appliedInvalidation: number;
|
|
10
|
+
compilation: DefaultCompilationSession;
|
|
11
|
+
compilationCache?: CompilerCompilationCacheEntry | undefined;
|
|
12
|
+
compilationRevision: number;
|
|
13
|
+
dependencies: Set<string>;
|
|
14
|
+
generator?: WeappTailwindcssGenerator | undefined;
|
|
15
|
+
generationCache?: CompilerGenerationCacheEntry | undefined;
|
|
16
|
+
id: string;
|
|
17
|
+
invalidation: number;
|
|
18
|
+
latestSnapshot?: CompilerSnapshot | undefined;
|
|
19
|
+
pending: Promise<void>;
|
|
20
|
+
pendingCount: number;
|
|
21
|
+
source?: TailwindV4ResolvedSource | undefined;
|
|
22
|
+
sourceFingerprint?: string | undefined;
|
|
23
|
+
sourceInput?: object | undefined;
|
|
24
|
+
sources: CompilerSourcePattern[];
|
|
25
|
+
}
|
|
26
|
+
export declare class CompilerRootStore {
|
|
27
|
+
private readonly maxRoots;
|
|
28
|
+
private readonly onRootEvicted?;
|
|
29
|
+
private readonly dependencyRoots;
|
|
30
|
+
private readonly releasing;
|
|
31
|
+
private readonly roots;
|
|
32
|
+
constructor(maxRoots: number, onRootEvicted?: ((id: string) => void) | undefined);
|
|
33
|
+
get(id: string): CompilerRootSession;
|
|
34
|
+
attachDependencies(entry: CompilerRootSession, dependencies: Iterable<string>): void;
|
|
35
|
+
attachSources(entry: CompilerRootSession, sources: Iterable<CompilerSourcePattern>): void;
|
|
36
|
+
invalidate(ids: Iterable<string>): readonly string[];
|
|
37
|
+
trim(): void;
|
|
38
|
+
remove(id: string, notifyEvicted?: boolean): Promise<void>;
|
|
39
|
+
dispose(): Promise<void>;
|
|
40
|
+
private detachDependencies;
|
|
41
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CompilerSnapshot, CompilerSnapshotRoot, CompilerSourcePattern, CompilerTarget, CreateCompilerSnapshotRequest } from './types.js';
|
|
2
|
+
interface InternalSnapshotRoot extends CompilerSnapshotRoot {
|
|
3
|
+
fingerprint: string;
|
|
4
|
+
}
|
|
5
|
+
export interface InternalCompilerSnapshot {
|
|
6
|
+
classSet: Set<string>;
|
|
7
|
+
dependencies: readonly string[];
|
|
8
|
+
fingerprint: string;
|
|
9
|
+
roots: ReadonlyMap<string, InternalSnapshotRoot>;
|
|
10
|
+
sources: readonly CompilerSourcePattern[];
|
|
11
|
+
target: CompilerTarget;
|
|
12
|
+
}
|
|
13
|
+
export declare function createRegisteredCompilerSnapshot(request: CreateCompilerSnapshotRequest, reusableClassSet?: Set<string>, reusableClassSetView?: ReadonlySet<string>): Readonly<{
|
|
14
|
+
classSet: ReadonlySet<string>;
|
|
15
|
+
dependencies: readonly string[];
|
|
16
|
+
roots: readonly Readonly<{
|
|
17
|
+
id: string;
|
|
18
|
+
revision: number;
|
|
19
|
+
}>[];
|
|
20
|
+
sources: readonly import("../../tailwindcss/v4-engine/types.js").TailwindV4SourcePattern[];
|
|
21
|
+
target: CompilerTarget;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function getInternalCompilerSnapshot(snapshot: CompilerSnapshot): InternalCompilerSnapshot;
|
|
24
|
+
export declare function mergeRegisteredCompilerSnapshots(snapshots: Iterable<CompilerSnapshot>): Readonly<{
|
|
25
|
+
classSet: ReadonlySet<string>;
|
|
26
|
+
dependencies: readonly string[];
|
|
27
|
+
roots: readonly Readonly<{
|
|
28
|
+
id: string;
|
|
29
|
+
revision: number;
|
|
30
|
+
}>[];
|
|
31
|
+
sources: readonly import("../../tailwindcss/v4-engine/types.js").TailwindV4SourcePattern[];
|
|
32
|
+
target: CompilerTarget;
|
|
33
|
+
}>;
|
|
34
|
+
export declare function createImmutableSet<T>(values: Iterable<T>): ReadonlySet<T>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Compiler, CompilerSnapshot } from './types.js';
|
|
2
|
+
import type { UserDefinedOptions } from '../../types/index.js';
|
|
3
|
+
interface CreateCompilerTransformsOptions {
|
|
4
|
+
ensureActive: () => void;
|
|
5
|
+
track: <T>(task: Promise<T>) => Promise<T>;
|
|
6
|
+
userOptions: UserDefinedOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare function createCompilerTransforms({ ensureActive, track, userOptions }: CreateCompilerTransformsOptions): {
|
|
9
|
+
clearCache: () => void;
|
|
10
|
+
transformCss: (css: string, snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformCss"]>[2]) => Promise<import("postcss").Result<import("postcss").Document | import("postcss").Root>>;
|
|
11
|
+
transformCssRoot: (root: Parameters<Compiler["transformCssRoot"]>[0], snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformCssRoot"]>[2]) => Promise<import("postcss").Result<import("postcss").Document | import("postcss").Root>>;
|
|
12
|
+
transformJavaScript: (source: string, snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformJavaScript"]>[2]) => Promise<import("../../types/index.js").JsHandlerResult>;
|
|
13
|
+
transformTemplate: (source: string, snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformTemplate"]>[2]) => Promise<string>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Document, FinalizeMiniProgramCssOptions, IStyleHandlerOptions, Result as PostcssResult, Root } from '@weapp-tailwindcss/postcss';
|
|
2
|
+
import type { TailwindV4ResolvedSource, TailwindV4SourceOptions, WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult } from '../../generator/index.js';
|
|
3
|
+
import type { CreateJsHandlerOptions, ITemplateHandlerOptions, JsHandlerResult, UserDefinedOptions } from '../../types/index.js';
|
|
4
|
+
export type CompilerTarget = 'tailwind' | 'weapp' | 'web';
|
|
5
|
+
export type CompilerSourcePattern = NonNullable<TailwindV4ResolvedSource['sources']>[number];
|
|
6
|
+
export interface CompilerSnapshotRoot {
|
|
7
|
+
id: string;
|
|
8
|
+
revision: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CompilerSnapshot {
|
|
11
|
+
readonly classSet: ReadonlySet<string>;
|
|
12
|
+
readonly dependencies: readonly string[];
|
|
13
|
+
readonly roots: readonly CompilerSnapshotRoot[];
|
|
14
|
+
readonly sources: readonly CompilerSourcePattern[];
|
|
15
|
+
readonly target: CompilerTarget;
|
|
16
|
+
}
|
|
17
|
+
interface CompilerGenerateRequestBase extends Omit<WeappTailwindcssGenerateOptions, 'target'> {
|
|
18
|
+
id: string;
|
|
19
|
+
target?: CompilerTarget | undefined;
|
|
20
|
+
}
|
|
21
|
+
export type CompilerGenerateRequest = CompilerGenerateRequestBase & {
|
|
22
|
+
source: TailwindV4ResolvedSource;
|
|
23
|
+
sourceOptions?: never;
|
|
24
|
+
} | CompilerGenerateRequestBase & {
|
|
25
|
+
source?: never;
|
|
26
|
+
sourceOptions: TailwindV4SourceOptions;
|
|
27
|
+
};
|
|
28
|
+
export interface CompilerCacheReuseState {
|
|
29
|
+
source: boolean;
|
|
30
|
+
engine: boolean;
|
|
31
|
+
output: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface CompilerGenerateResult extends Omit<WeappTailwindcssGenerateResult, 'classSet' | 'dependencies' | 'rawCandidates' | 'sources' | 'target'> {
|
|
34
|
+
cache: Readonly<CompilerCacheReuseState>;
|
|
35
|
+
classSet: ReadonlySet<string>;
|
|
36
|
+
dependencies: readonly string[];
|
|
37
|
+
rawCandidates: ReadonlySet<string>;
|
|
38
|
+
revision: number;
|
|
39
|
+
snapshot: CompilerSnapshot;
|
|
40
|
+
sources: readonly CompilerSourcePattern[];
|
|
41
|
+
target: CompilerTarget;
|
|
42
|
+
}
|
|
43
|
+
export interface CreateCompilerSnapshotRequest {
|
|
44
|
+
classSet: Iterable<string>;
|
|
45
|
+
dependencies?: Iterable<string> | undefined;
|
|
46
|
+
id: string;
|
|
47
|
+
revision?: number | undefined;
|
|
48
|
+
sources?: Iterable<CompilerSourcePattern> | undefined;
|
|
49
|
+
target?: CompilerTarget | undefined;
|
|
50
|
+
}
|
|
51
|
+
export type CompilerTemplateTransformOptions = Omit<ITemplateHandlerOptions, 'classSetMode' | 'runtimeSet'>;
|
|
52
|
+
export type CompilerCssTransformOptions = Partial<IStyleHandlerOptions> & {
|
|
53
|
+
finalize?: boolean | undefined;
|
|
54
|
+
};
|
|
55
|
+
export type CreateCompilerOptions = UserDefinedOptions & {
|
|
56
|
+
compiler?: {
|
|
57
|
+
maxRoots?: number | undefined;
|
|
58
|
+
onRootEvicted?: ((id: string) => void) | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
};
|
|
61
|
+
export interface Compiler {
|
|
62
|
+
createSnapshot: (request: CreateCompilerSnapshotRequest) => CompilerSnapshot;
|
|
63
|
+
dispose: () => Promise<void>;
|
|
64
|
+
finalizeCss: (css: string, options?: FinalizeMiniProgramCssOptions) => string;
|
|
65
|
+
finalizeCssRoot: (root: Root, options?: FinalizeMiniProgramCssOptions) => Root;
|
|
66
|
+
generate: (request: CompilerGenerateRequest) => Promise<CompilerGenerateResult>;
|
|
67
|
+
invalidate: (ids: Iterable<string>) => readonly string[];
|
|
68
|
+
mergeSnapshots: (snapshots: Iterable<CompilerSnapshot>) => CompilerSnapshot;
|
|
69
|
+
remove: (id: string) => Promise<void>;
|
|
70
|
+
transformCss: (css: string, snapshot: CompilerSnapshot, options?: CompilerCssTransformOptions) => Promise<PostcssResult<Root | Document>>;
|
|
71
|
+
transformCssRoot: (root: Root, snapshot: CompilerSnapshot, options?: CompilerCssTransformOptions) => Promise<PostcssResult<Root>>;
|
|
72
|
+
transformJavaScript: (source: string, snapshot: CompilerSnapshot, options?: CreateJsHandlerOptions) => Promise<JsHandlerResult>;
|
|
73
|
+
transformTemplate: (source: string, snapshot: CompilerSnapshot, options?: CompilerTemplateTransformOptions) => Promise<string>;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
package/dist/core.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_compiler = require("./compiler-CDAz4SwJ.cjs");
|
|
3
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
3
4
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
4
5
|
//#region src/core.ts
|
|
5
6
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -14,11 +15,11 @@ function resolveTransformWxssOptions(options) {
|
|
|
14
15
|
* @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
|
|
15
16
|
*/
|
|
16
17
|
function createContext(options = {}) {
|
|
17
|
-
const opts =
|
|
18
|
+
const opts = require_compiler.getCompilerContext(options);
|
|
18
19
|
const { templateHandler, styleHandler, jsHandler } = opts;
|
|
19
20
|
const initialTailwindRuntime = opts.tailwindRuntime;
|
|
20
21
|
const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
|
|
21
|
-
const readyPromise =
|
|
22
|
+
const readyPromise = require_compiler.createTailwindRuntimeReadyPromise(initialTailwindRuntime);
|
|
22
23
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
23
24
|
const runtimeState = {
|
|
24
25
|
tailwindRuntime: initialTailwindRuntime,
|
|
@@ -109,25 +110,25 @@ function createContext(options = {}) {
|
|
|
109
110
|
async function transformWxss(rawCss, options) {
|
|
110
111
|
await runtimeState.readyPromise;
|
|
111
112
|
const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
|
|
112
|
-
runtimeSet = await
|
|
113
|
+
runtimeSet = await require_compiler.ensureRuntimeClassSet(runtimeState);
|
|
113
114
|
return result;
|
|
114
115
|
}
|
|
115
116
|
async function getRuntimeSet(options) {
|
|
116
117
|
await runtimeState.readyPromise;
|
|
117
|
-
runtimeSet = await
|
|
118
|
+
runtimeSet = await require_compiler.ensureRuntimeClassSet(runtimeState, options);
|
|
118
119
|
return runtimeSet;
|
|
119
120
|
}
|
|
120
121
|
async function transformJs(rawJs, options) {
|
|
121
122
|
await runtimeState.readyPromise;
|
|
122
123
|
if (options?.runtimeSet) runtimeSet = options.runtimeSet;
|
|
123
|
-
else if (runtimeSet.size === 0) runtimeSet = await
|
|
124
|
+
else if (runtimeSet.size === 0) runtimeSet = await require_compiler.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
124
125
|
const resolvedOptions = resolveTransformJsOptions(options);
|
|
125
|
-
if (
|
|
126
|
+
if (require_compiler.shouldSkipJsTransform(rawJs, resolvedOptions)) return { code: rawJs };
|
|
126
127
|
return await jsHandler(rawJs, runtimeSet, resolvedOptions);
|
|
127
128
|
}
|
|
128
129
|
async function transformWxml(rawWxml, options) {
|
|
129
130
|
await runtimeState.readyPromise;
|
|
130
|
-
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await
|
|
131
|
+
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await require_compiler.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
131
132
|
return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
|
|
132
133
|
}
|
|
133
134
|
return {
|
|
@@ -138,4 +139,29 @@ function createContext(options = {}) {
|
|
|
138
139
|
};
|
|
139
140
|
}
|
|
140
141
|
//#endregion
|
|
142
|
+
exports.createCompiler = require_compiler.createCompiler;
|
|
141
143
|
exports.createContext = createContext;
|
|
144
|
+
Object.defineProperty(exports, "finalizeMiniProgramCss", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function() {
|
|
147
|
+
return _weapp_tailwindcss_postcss.finalizeMiniProgramCss;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "finalizeMiniProgramCssRoot", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function() {
|
|
153
|
+
return _weapp_tailwindcss_postcss.finalizeMiniProgramCssRoot;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "postcss", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function() {
|
|
159
|
+
return _weapp_tailwindcss_postcss.postcss;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "removeTailwindSourceDirectivesRoot", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function() {
|
|
165
|
+
return _weapp_tailwindcss_postcss.removeTailwindSourceDirectivesRoot;
|
|
166
|
+
}
|
|
167
|
+
});
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { CreateJsHandlerOptions, IStyleHandlerOptions, ITemplateHandlerOptions, UserDefinedOptions } from './types/index.js';
|
|
2
|
+
export type { Compiler, CompilerCacheReuseState, CompilerCssTransformOptions, CompilerGenerateRequest, CompilerGenerateResult, CompilerSnapshot, CompilerSnapshotRoot, CompilerSourcePattern, CompilerTarget, CompilerTemplateTransformOptions, CreateCompilerOptions, CreateCompilerSnapshotRequest, } from './core/compiler/index.js';
|
|
3
|
+
export { createCompiler } from './core/compiler/index.js';
|
|
4
|
+
export { finalizeMiniProgramCss, finalizeMiniProgramCssRoot, postcss, removeTailwindSourceDirectivesRoot, } from '@weapp-tailwindcss/postcss';
|
|
5
|
+
export type { FinalizeMiniProgramCssOptions } from '@weapp-tailwindcss/postcss';
|
|
2
6
|
type RuntimeJsTransformOptions = {
|
|
3
7
|
runtimeSet?: Set<string>;
|
|
4
8
|
} & CreateJsHandlerOptions;
|
|
@@ -14,4 +18,3 @@ export declare function createContext(options?: UserDefinedOptions): {
|
|
|
14
18
|
transformWxml: (rawWxml: string, options?: ITemplateHandlerOptions) => Promise<string>;
|
|
15
19
|
transformJs: (rawJs: string, options?: RuntimeJsTransformOptions) => Promise<import("./types/index.js").JsHandlerResult>;
|
|
16
20
|
};
|
|
17
|
-
export {};
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as ensureRuntimeClassSet, n as getCompilerContext, s as shouldSkipJsTransform, t as createCompiler, u as createTailwindRuntimeReadyPromise } from "./compiler-DWcUgi3A.js";
|
|
2
|
+
import { finalizeMiniProgramCss, finalizeMiniProgramCssRoot, postcss, removeTailwindSourceDirectivesRoot } from "@weapp-tailwindcss/postcss";
|
|
2
3
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
3
4
|
//#region src/core.ts
|
|
4
5
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -137,4 +138,4 @@ function createContext(options = {}) {
|
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
//#endregion
|
|
140
|
-
export { createContext };
|
|
141
|
+
export { createCompiler, createContext, finalizeMiniProgramCss, finalizeMiniProgramCssRoot, postcss, removeTailwindSourceDirectivesRoot };
|
|
@@ -61,4 +61,6 @@ export declare function isUniAppPackage(pkg: PackageJsonLike): boolean;
|
|
|
61
61
|
export declare function isUniAppXManifest(manifest: UniAppManifestLike | undefined): boolean;
|
|
62
62
|
export declare function detectAppTypeFromPackageJson(pkg: PackageJsonLike): DetectableAppType | undefined;
|
|
63
63
|
export declare function detectAppType(options?: DetectAppTypeOptions): DetectableAppType | undefined;
|
|
64
|
-
export declare
|
|
64
|
+
export declare function resolveImplicitAppTypeFromViteRoot(root: string, options?: {
|
|
65
|
+
searchUp?: boolean;
|
|
66
|
+
}): DetectableAppType | undefined;
|
package/dist/framework.cjs
CHANGED
|
@@ -206,7 +206,12 @@ function detectAppType(options = {}) {
|
|
|
206
206
|
hbuilderxVite: options.hbuilderxVite
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
function resolveImplicitAppTypeFromViteRoot(root, options = {}) {
|
|
210
|
+
return detectAppType({
|
|
211
|
+
root,
|
|
212
|
+
searchUp: options.searchUp
|
|
213
|
+
});
|
|
214
|
+
}
|
|
210
215
|
//#endregion
|
|
211
216
|
exports.detectAppType = detectAppType;
|
|
212
217
|
exports.detectAppTypeFromEnv = detectAppTypeFromEnv;
|
package/dist/framework.js
CHANGED
|
@@ -202,6 +202,11 @@ function detectAppType(options = {}) {
|
|
|
202
202
|
hbuilderxVite: options.hbuilderxVite
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
function resolveImplicitAppTypeFromViteRoot(root, options = {}) {
|
|
206
|
+
return detectAppType({
|
|
207
|
+
root,
|
|
208
|
+
searchUp: options.searchUp
|
|
209
|
+
});
|
|
210
|
+
}
|
|
206
211
|
//#endregion
|
|
207
212
|
export { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform };
|
|
@@ -7,7 +7,7 @@ import fs, { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
9
9
|
import { createTailwindGenerationSession, createTailwindV4Engine, extractRawCandidates, loadTailwindV4DesignSystem, resolveProjectSourceFiles, resolveTailwindV4Source, resolveValidTailwindV4Candidates as resolveValidTailwindV4Candidates$1 } from "@tailwindcss-mangle/engine";
|
|
10
|
-
import { analyzeTailwindCssDirectives, createStyleHandler, filterExistingCssRules, finalizeMiniProgramCss, hasMiniProgramCssSpecificityPlaceholders, isTailwindCssGenerationDirective, isTailwindCssImportAtRule, isTailwindCssPackageJsonImportRequest, normalizeTailwindCssImportRequest, normalizeTailwindcssWebRpxDeclarations, parseTailwindCssConfigRequest, parseTailwindCssDirectiveRequest, postcss, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss, pruneMiniProgramGeneratedCss as pruneMiniProgramGeneratedCss$1, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, selectorContainsPseudoClass, stripMiniProgramCssSpecificityPlaceholders } from "@weapp-tailwindcss/postcss";
|
|
10
|
+
import { analyzeTailwindCssDirectives, createStyleHandler, filterExistingCssRules, finalizeMiniProgramCss as finalizeMiniProgramCss$1, hasMiniProgramCssSpecificityPlaceholders, isTailwindCssGenerationDirective, isTailwindCssImportAtRule, isTailwindCssPackageJsonImportRequest, normalizeTailwindCssImportRequest, normalizeTailwindcssWebRpxDeclarations, parseTailwindCssConfigRequest, parseTailwindCssDirectiveRequest, postcss, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss, pruneMiniProgramGeneratedCss as pruneMiniProgramGeneratedCss$1, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, selectorContainsPseudoClass, stripMiniProgramCssSpecificityPlaceholders } from "@weapp-tailwindcss/postcss";
|
|
11
11
|
import { LRUCache } from "lru-cache";
|
|
12
12
|
import { stat } from "node:fs/promises";
|
|
13
13
|
import micromatch from "micromatch";
|
|
@@ -934,7 +934,7 @@ function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
|
|
|
934
934
|
const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
|
|
935
935
|
const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
|
|
936
936
|
function toPosixPath(value) {
|
|
937
|
-
return value.split(path.sep).join("/");
|
|
937
|
+
return value.split(path.sep).join("/").split(path.win32.sep).join("/");
|
|
938
938
|
}
|
|
939
939
|
function resolveSourceScanPath(value) {
|
|
940
940
|
const resolved = path.resolve(value);
|
|
@@ -944,27 +944,44 @@ function resolveSourceScanPath(value) {
|
|
|
944
944
|
return resolved;
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
|
+
function resolveSourceScanPathWithApi(value, pathApi) {
|
|
948
|
+
const resolved = pathApi.resolve(value);
|
|
949
|
+
try {
|
|
950
|
+
return realpathSync.native(resolved);
|
|
951
|
+
} catch {
|
|
952
|
+
return resolved;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
947
955
|
function normalizeEntryPattern(entry) {
|
|
948
|
-
|
|
956
|
+
const pathApi = isWindowsPath(entry.base) || isWindowsPath(entry.pattern) ? path.win32 : path;
|
|
957
|
+
return pathApi.isAbsolute(entry.pattern) ? toPosixPath(pathApi.relative(pathApi.resolve(entry.base), entry.pattern)) : entry.pattern;
|
|
949
958
|
}
|
|
950
959
|
function isFileMatchedByTailwindSourceEntry(file, entry) {
|
|
951
|
-
const
|
|
952
|
-
|
|
960
|
+
const pathApi = isWindowsPath(entry.base) || isWindowsPath(file) ? path.win32 : path;
|
|
961
|
+
const base = resolveSourceScanPathWithApi(entry.base, pathApi);
|
|
962
|
+
const relative = toPosixPath(pathApi.relative(base, file));
|
|
963
|
+
return relative && !relative.startsWith("../") && !pathApi.isAbsolute(relative) && micromatch.isMatch(relative, normalizeEntryPattern(entry));
|
|
964
|
+
}
|
|
965
|
+
function isWindowsPath(value) {
|
|
966
|
+
return /^[A-Z]:[\\/]/i.test(value) || value.includes("\\");
|
|
953
967
|
}
|
|
954
968
|
function isFileExcludedByTailwindSourceEntries(file, entries) {
|
|
955
969
|
if (!entries?.length) return false;
|
|
956
|
-
const resolvedFile =
|
|
970
|
+
const resolvedFile = resolveSourceScanMatcherFile(file, entries);
|
|
957
971
|
return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
958
972
|
}
|
|
959
973
|
function isFileMatchedByTailwindSourceEntries(file, entries) {
|
|
960
974
|
if (!entries?.length) return true;
|
|
975
|
+
const resolvedFile = resolveSourceScanMatcherFile(file, entries);
|
|
961
976
|
const positiveEntries = entries.filter((entry) => !entry.negated);
|
|
962
977
|
const negativeEntries = entries.filter((entry) => entry.negated);
|
|
963
|
-
const resolvedFile = resolveSourceScanPath(file);
|
|
964
978
|
if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
965
979
|
if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
|
|
966
980
|
return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
967
981
|
}
|
|
982
|
+
function resolveSourceScanMatcherFile(file, entries) {
|
|
983
|
+
return isWindowsPath(file) || entries.some((entry) => isWindowsPath(entry.base) || isWindowsPath(entry.pattern)) ? resolveSourceScanPathWithApi(file, path.win32) : resolveSourceScanPath(file);
|
|
984
|
+
}
|
|
968
985
|
function resolveTailwindV4CssSourceBase(source, fallbackBase) {
|
|
969
986
|
if (typeof source.base === "string" && source.base.length > 0) return source.base;
|
|
970
987
|
if (typeof source.file === "string" && source.file.length > 0) return path.dirname(source.file);
|
|
@@ -2981,9 +2998,10 @@ function normalizeTailwindV4CssEntrySources(cssEntries, packageName) {
|
|
|
2981
2998
|
const remainingCssEntries = [];
|
|
2982
2999
|
const cssSources = [];
|
|
2983
3000
|
for (const cssEntry of cssEntries) {
|
|
2984
|
-
const
|
|
3001
|
+
const normalizedCssEntry = cssEntry.replace(/[?#].*$/, "");
|
|
3002
|
+
const file = path.resolve(normalizedCssEntry);
|
|
2985
3003
|
if (!existsSync(file)) {
|
|
2986
|
-
remainingCssEntries.push(
|
|
3004
|
+
remainingCssEntries.push(normalizedCssEntry);
|
|
2987
3005
|
continue;
|
|
2988
3006
|
}
|
|
2989
3007
|
const base = path.dirname(file);
|
|
@@ -3220,4 +3238,4 @@ async function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime) {
|
|
|
3220
3238
|
return createWeappTailwindcssGenerator(await resolveTailwindSourceFromRuntime(tailwindRuntime));
|
|
3221
3239
|
}
|
|
3222
3240
|
//#endregion
|
|
3223
|
-
export { hasTailwindSourceDirectives as $, transformGeneratorUserCss as A, toPosixPath as At, stripMiniProgramCssSpecificityPlaceholders as B, findWorkspacePackageDir as C, isFileExcludedByTailwindSourceEntries as Ct, resolveTailwindcssOptions as D, resolveCssSourceEntries as Dt, normalizeTailwindcssRuntimeOptions as E, parseConfigParam as Et, stripUnmatchedTailwindSourceMediaCloseFragments as F, filterUnsupportedMiniProgramTailwindV4Candidates as Ft, extractGeneratedCssForUserLayerSelectors as G, filterApplyOnlyGeneratedCss as H, finalizeMiniProgramCss as I, shouldUseUniAppWebRpxCompatibility as It, preferScopedGeneratedCssRules as J, hasUserCssLayerBlocks as K, hasMiniProgramCssSpecificityPlaceholders as L, loadTailwindV4DesignSystem as Lt, removeMiniProgramInteractiveSelectors as M, transformTailwindV4CssToWeapp as Mt, removeTailwindV4GeneratorAtRules as N, resolveCssMacroTailwindV4Source as Nt, normalizeStringListOption as O, resolveSourceScanPath as Ot, stripTailwindSourceMediaFragments as P, getTailwindV4IncrementalGenerateCacheStats as Pt, hasTailwindRootDirectives as Q, pruneMiniProgramGeneratedCss as R, resolveValidTailwindV4Candidates$1 as Rt, findNearestPackageRoot as S, expandTailwindSourceEntries as St, normalizeExtendLengthUnits as T, normalizeLegacyContentEntries as Tt, normalizeEmptyTailwindCustomVariants as U, removeTailwindV4GeneratedUserCssArtifacts as V, shouldFilterApplyOnlyGeneratedCss as W, hasTailwindApplyDirective as X, hasLocalCssImport as Y, hasTailwindNonRootGenerationDirectives as Z, upsertTailwindV4CssSource as _, normalizeConfigDirective as _t, resolveGeneratorRuntimeBranch as a, resolveCssEntrySource as at, isTailwindV4CssEntry as b, FULL_SOURCE_SCAN_EXTENSION_RE as bt, shouldUseNativeAppCssBranch as c, createCssAppend as ct, resolveTailwindV4SourceFromRuntime as d, splitGeneratorPlaceholderCssBySourceOrder as dt, normalizeTailwindConfigDirectives as et, resolveTailwindV4SourceFromRuntimeOptions as f, splitTailwindGeneratedCssByBanner as ft, removeTailwindV4CssSource as g, stripTailwindBanners as gt, hasConfiguredTailwindV4CssRoots as h, stripTailwindBanner as ht, normalizeWeappTailwindcssGeneratorOptions as i, removeTailwindSourceDirectives as it, isCommentOnlyCss as j, transformTailwindV4CssByTarget as jt, resolveBooleanObjectOption as k, resolveTailwindV4CssSourceBase as kt, resolveUniUtsPlatform as l, hasTailwindGeneratedCss as lt, filterTailwindV4CssSourceRoots as m, stripGeneratorPlaceholderMarkers as mt, createWeappTailwindcssGeneratorFromRuntime as n, normalizeTailwindSourceForGenerator as nt, resolveRuntimeBranch as o, GENERATOR_PLACEHOLDER_MARKER_RE as ot, resolveTailwindV4SourceOptionsFromRuntime as p, splitTailwindV4GeneratedCssBySourceOrder as pt, splitUserCssLayerBlocks as q, resolveTailwindSourceFromRuntime as r, parseImportRequest as rt, shouldUseMiniProgramCssBranch as s, VITE_MARKER_RE as st, createWeappTailwindcssGenerator as t, normalizeTailwindSourceDirectives as tt, resolveTailwindV4Source$1 as u, hasTailwindGeneratedCssMarkers as ut, groupCssEntriesByBase as v, prependConfigDirective as vt, findWorkspaceRoot as w, isFileMatchedByTailwindSourceEntries as wt, normalizeCssEntries as x, FULL_SOURCE_SCAN_PATTERN as xt, guessBasedirFromEntries as y, createTailwindV4Engine$1 as yt, removeUnsupportedMiniProgramAtRules as z };
|
|
3241
|
+
export { hasTailwindSourceDirectives as $, transformGeneratorUserCss as A, toPosixPath as At, stripMiniProgramCssSpecificityPlaceholders as B, findWorkspacePackageDir as C, isFileExcludedByTailwindSourceEntries as Ct, resolveTailwindcssOptions as D, resolveCssSourceEntries as Dt, normalizeTailwindcssRuntimeOptions as E, parseConfigParam as Et, stripUnmatchedTailwindSourceMediaCloseFragments as F, filterUnsupportedMiniProgramTailwindV4Candidates as Ft, extractGeneratedCssForUserLayerSelectors as G, filterApplyOnlyGeneratedCss as H, finalizeMiniProgramCss$1 as I, shouldUseUniAppWebRpxCompatibility as It, preferScopedGeneratedCssRules as J, hasUserCssLayerBlocks as K, hasMiniProgramCssSpecificityPlaceholders as L, loadTailwindV4DesignSystem as Lt, removeMiniProgramInteractiveSelectors as M, transformTailwindV4CssToWeapp as Mt, removeTailwindV4GeneratorAtRules as N, resolveCssMacroTailwindV4Source as Nt, normalizeStringListOption as O, resolveSourceScanPath as Ot, stripTailwindSourceMediaFragments as P, getTailwindV4IncrementalGenerateCacheStats as Pt, hasTailwindRootDirectives as Q, pruneMiniProgramGeneratedCss as R, resolveValidTailwindV4Candidates$1 as Rt, findNearestPackageRoot as S, expandTailwindSourceEntries as St, normalizeExtendLengthUnits as T, normalizeLegacyContentEntries as Tt, normalizeEmptyTailwindCustomVariants as U, removeTailwindV4GeneratedUserCssArtifacts as V, shouldFilterApplyOnlyGeneratedCss as W, hasTailwindApplyDirective as X, hasLocalCssImport as Y, hasTailwindNonRootGenerationDirectives as Z, upsertTailwindV4CssSource as _, normalizeConfigDirective as _t, resolveGeneratorRuntimeBranch as a, resolveCssEntrySource as at, isTailwindV4CssEntry as b, FULL_SOURCE_SCAN_EXTENSION_RE as bt, shouldUseNativeAppCssBranch as c, createCssAppend as ct, resolveTailwindV4SourceFromRuntime as d, splitGeneratorPlaceholderCssBySourceOrder as dt, normalizeTailwindConfigDirectives as et, resolveTailwindV4SourceFromRuntimeOptions as f, splitTailwindGeneratedCssByBanner as ft, removeTailwindV4CssSource as g, stripTailwindBanners as gt, hasConfiguredTailwindV4CssRoots as h, stripTailwindBanner as ht, normalizeWeappTailwindcssGeneratorOptions as i, removeTailwindSourceDirectives as it, isCommentOnlyCss as j, transformTailwindV4CssByTarget as jt, resolveBooleanObjectOption as k, resolveTailwindV4CssSourceBase as kt, resolveUniUtsPlatform as l, hasTailwindGeneratedCss as lt, filterTailwindV4CssSourceRoots as m, stripGeneratorPlaceholderMarkers as mt, createWeappTailwindcssGeneratorFromRuntime as n, normalizeTailwindSourceForGenerator as nt, resolveRuntimeBranch as o, GENERATOR_PLACEHOLDER_MARKER_RE as ot, resolveTailwindV4SourceOptionsFromRuntime as p, splitTailwindV4GeneratedCssBySourceOrder as pt, splitUserCssLayerBlocks as q, resolveTailwindSourceFromRuntime as r, parseImportRequest as rt, shouldUseMiniProgramCssBranch as s, VITE_MARKER_RE as st, createWeappTailwindcssGenerator as t, normalizeTailwindSourceDirectives as tt, resolveTailwindV4Source$1 as u, hasTailwindGeneratedCssMarkers as ut, groupCssEntriesByBase as v, prependConfigDirective as vt, findWorkspaceRoot as w, isFileMatchedByTailwindSourceEntries as wt, normalizeCssEntries as x, FULL_SOURCE_SCAN_PATTERN as xt, guessBasedirFromEntries as y, createTailwindV4Engine$1 as yt, removeUnsupportedMiniProgramAtRules as z };
|
|
@@ -939,7 +939,7 @@ function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
|
|
|
939
939
|
const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
|
|
940
940
|
const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
|
|
941
941
|
function toPosixPath(value) {
|
|
942
|
-
return value.split(node_path.default.sep).join("/");
|
|
942
|
+
return value.split(node_path.default.sep).join("/").split(node_path.default.win32.sep).join("/");
|
|
943
943
|
}
|
|
944
944
|
function resolveSourceScanPath(value) {
|
|
945
945
|
const resolved = node_path.default.resolve(value);
|
|
@@ -949,27 +949,44 @@ function resolveSourceScanPath(value) {
|
|
|
949
949
|
return resolved;
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
+
function resolveSourceScanPathWithApi(value, pathApi) {
|
|
953
|
+
const resolved = pathApi.resolve(value);
|
|
954
|
+
try {
|
|
955
|
+
return node_fs.realpathSync.native(resolved);
|
|
956
|
+
} catch {
|
|
957
|
+
return resolved;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
952
960
|
function normalizeEntryPattern(entry) {
|
|
953
|
-
|
|
961
|
+
const pathApi = isWindowsPath(entry.base) || isWindowsPath(entry.pattern) ? node_path.default.win32 : node_path.default;
|
|
962
|
+
return pathApi.isAbsolute(entry.pattern) ? toPosixPath(pathApi.relative(pathApi.resolve(entry.base), entry.pattern)) : entry.pattern;
|
|
954
963
|
}
|
|
955
964
|
function isFileMatchedByTailwindSourceEntry(file, entry) {
|
|
956
|
-
const
|
|
957
|
-
|
|
965
|
+
const pathApi = isWindowsPath(entry.base) || isWindowsPath(file) ? node_path.default.win32 : node_path.default;
|
|
966
|
+
const base = resolveSourceScanPathWithApi(entry.base, pathApi);
|
|
967
|
+
const relative = toPosixPath(pathApi.relative(base, file));
|
|
968
|
+
return relative && !relative.startsWith("../") && !pathApi.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizeEntryPattern(entry));
|
|
969
|
+
}
|
|
970
|
+
function isWindowsPath(value) {
|
|
971
|
+
return /^[A-Z]:[\\/]/i.test(value) || value.includes("\\");
|
|
958
972
|
}
|
|
959
973
|
function isFileExcludedByTailwindSourceEntries(file, entries) {
|
|
960
974
|
if (!entries?.length) return false;
|
|
961
|
-
const resolvedFile =
|
|
975
|
+
const resolvedFile = resolveSourceScanMatcherFile(file, entries);
|
|
962
976
|
return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
963
977
|
}
|
|
964
978
|
function isFileMatchedByTailwindSourceEntries(file, entries) {
|
|
965
979
|
if (!entries?.length) return true;
|
|
980
|
+
const resolvedFile = resolveSourceScanMatcherFile(file, entries);
|
|
966
981
|
const positiveEntries = entries.filter((entry) => !entry.negated);
|
|
967
982
|
const negativeEntries = entries.filter((entry) => entry.negated);
|
|
968
|
-
const resolvedFile = resolveSourceScanPath(file);
|
|
969
983
|
if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
970
984
|
if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
|
|
971
985
|
return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
972
986
|
}
|
|
987
|
+
function resolveSourceScanMatcherFile(file, entries) {
|
|
988
|
+
return isWindowsPath(file) || entries.some((entry) => isWindowsPath(entry.base) || isWindowsPath(entry.pattern)) ? resolveSourceScanPathWithApi(file, node_path.default.win32) : resolveSourceScanPath(file);
|
|
989
|
+
}
|
|
973
990
|
function resolveTailwindV4CssSourceBase(source, fallbackBase) {
|
|
974
991
|
if (typeof source.base === "string" && source.base.length > 0) return source.base;
|
|
975
992
|
if (typeof source.file === "string" && source.file.length > 0) return node_path.default.dirname(source.file);
|
|
@@ -2990,9 +3007,10 @@ function normalizeTailwindV4CssEntrySources(cssEntries, packageName) {
|
|
|
2990
3007
|
const remainingCssEntries = [];
|
|
2991
3008
|
const cssSources = [];
|
|
2992
3009
|
for (const cssEntry of cssEntries) {
|
|
2993
|
-
const
|
|
3010
|
+
const normalizedCssEntry = cssEntry.replace(/[?#].*$/, "");
|
|
3011
|
+
const file = node_path.default.resolve(normalizedCssEntry);
|
|
2994
3012
|
if (!(0, node_fs.existsSync)(file)) {
|
|
2995
|
-
remainingCssEntries.push(
|
|
3013
|
+
remainingCssEntries.push(normalizedCssEntry);
|
|
2996
3014
|
continue;
|
|
2997
3015
|
}
|
|
2998
3016
|
const base = node_path.default.dirname(file);
|
package/dist/generator.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-WlhrtNa3.cjs");
|
|
3
3
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
4
4
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
5
5
|
exports.createWeappTailwindcssGeneratorFromRuntime = require_generator.createWeappTailwindcssGeneratorFromRuntime;
|
package/dist/generator.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Lt as loadTailwindV4DesignSystem, Mt as transformTailwindV4CssToWeapp, d as resolveTailwindV4SourceFromRuntime, f as resolveTailwindV4SourceFromRuntimeOptions, i as normalizeWeappTailwindcssGeneratorOptions, jt as transformTailwindV4CssByTarget, n as createWeappTailwindcssGeneratorFromRuntime, p as resolveTailwindV4SourceOptionsFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-
|
|
1
|
+
import { Lt as loadTailwindV4DesignSystem, Mt as transformTailwindV4CssToWeapp, d as resolveTailwindV4SourceFromRuntime, f as resolveTailwindV4SourceFromRuntimeOptions, i as normalizeWeappTailwindcssGeneratorOptions, jt as transformTailwindV4CssByTarget, n as createWeappTailwindcssGeneratorFromRuntime, p as resolveTailwindV4SourceOptionsFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-BjK5PRR-.js";
|
|
2
2
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromRuntime, loadTailwindV4DesignSystem, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromRuntime, resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Pt as getTailwindV4IncrementalGenerateCacheStats, Q as hasTailwindRootDirectives, _ as upsertTailwindV4CssSource, et as normalizeTailwindConfigDirectives, g as removeTailwindV4CssSource, h as hasConfiguredTailwindV4CssRoots, nt as normalizeTailwindSourceForGenerator, vt as prependConfigDirective } from "./generator-
|
|
2
|
-
import { f as resolveSourceScanEntries, l as getRuntimeClassSetSignature } from "./tailwindcss-
|
|
3
|
-
import { $ as AssetEmissionPlan, B as rewriteLocalCssImportRequestsForOutput, E as hasBundlerGeneratedCssMarker, F as processCachedTask, G as createRuntimeCompilationBuildState, H as finalizeCompilerShadowRun, I as createRuntimeClassSetManager, J as updateRuntimeCompilationBuildState, K as removeRuntimeCompilationBuildStateFiles, M as createCssSourceTraceCacheSignature, N as createCssTokenSourceMap, O as stripBundlerGeneratedCssMarkers, Q as getCompilerShadowRunSnapshot, T as createBundlerGeneratedCssMarker, U as buildRuntimeCompilationSnapshot, V as splitLocalCssImports, X as disposeCompilerOwner, Y as createRuntimeAffectingSourceSignature, Z as beginCompilerShadowRun, b as finalizeMiniProgramGeneratorCss, et as getCompilationScopeDependencyRevision, it as createSourceCandidateCollector, j as annotateCssSourceTrace, k as finalizeMiniProgramCssStructure, n as emitHmrTiming, nt as recordCompilationDependencyChanges, r as generateTailwindV4Css, rt as createCompilationDependencyChanges, tt as invalidateCompilationScope } from "./hmr-timing-
|
|
4
|
-
import { m as createDebug } from "./wxml-
|
|
5
|
-
import {
|
|
1
|
+
import { Pt as getTailwindV4IncrementalGenerateCacheStats, Q as hasTailwindRootDirectives, _ as upsertTailwindV4CssSource, et as normalizeTailwindConfigDirectives, g as removeTailwindV4CssSource, h as hasConfiguredTailwindV4CssRoots, nt as normalizeTailwindSourceForGenerator, vt as prependConfigDirective } from "./generator-BjK5PRR-.js";
|
|
2
|
+
import { f as resolveSourceScanEntries, l as getRuntimeClassSetSignature } from "./tailwindcss-9xmoCkaR.js";
|
|
3
|
+
import { $ as AssetEmissionPlan, B as rewriteLocalCssImportRequestsForOutput, E as hasBundlerGeneratedCssMarker, F as processCachedTask, G as createRuntimeCompilationBuildState, H as finalizeCompilerShadowRun, I as createRuntimeClassSetManager, J as updateRuntimeCompilationBuildState, K as removeRuntimeCompilationBuildStateFiles, M as createCssSourceTraceCacheSignature, N as createCssTokenSourceMap, O as stripBundlerGeneratedCssMarkers, Q as getCompilerShadowRunSnapshot, T as createBundlerGeneratedCssMarker, U as buildRuntimeCompilationSnapshot, V as splitLocalCssImports, X as disposeCompilerOwner, Y as createRuntimeAffectingSourceSignature, Z as beginCompilerShadowRun, b as finalizeMiniProgramGeneratorCss, et as getCompilationScopeDependencyRevision, it as createSourceCandidateCollector, j as annotateCssSourceTrace, k as finalizeMiniProgramCssStructure, n as emitHmrTiming, nt as recordCompilationDependencyChanges, r as generateTailwindV4Css, rt as createCompilationDependencyChanges, tt as invalidateCompilationScope } from "./hmr-timing-B_4sAvsk.js";
|
|
4
|
+
import { m as createDebug } from "./wxml-CvKyV69S.js";
|
|
5
|
+
import { d as ensureRuntimeClassSet, n as getCompilerContext, r as normalizeStyleHandlerMajorVersion, s as shouldSkipJsTransform, u as createTailwindRuntimeReadyPromise } from "./compiler-DWcUgi3A.js";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
@@ -363,7 +363,7 @@ const GULP_COMPILATION_SCOPE_CACHE_MAX = 512;
|
|
|
363
363
|
/**
|
|
364
364
|
* @name weapp-tw-gulp
|
|
365
365
|
* @description native framework 的插件组合实现
|
|
366
|
-
* @link https://tw.
|
|
366
|
+
* @link https://tw.weapp.dev/docs/quick-start/frameworks/native
|
|
367
367
|
*/
|
|
368
368
|
function createNativeGulpPlugins(options = {}) {
|
|
369
369
|
const hasInitialTailwindCssRoots = hasConfiguredTailwindV4CssRoots(options);
|
|
@@ -669,7 +669,7 @@ function createNativeGulpFrameworkPlugins(options = {}) {
|
|
|
669
669
|
/**
|
|
670
670
|
* @name weapp-tw-gulp
|
|
671
671
|
* @description Gulp 入口直接创建 native framework,具体 stream 组合由 frameworks/native 拥有。
|
|
672
|
-
* @link https://tw.
|
|
672
|
+
* @link https://tw.weapp.dev/docs/quick-start/frameworks/native
|
|
673
673
|
*/
|
|
674
674
|
function createPlugins(options = {}) {
|
|
675
675
|
return createNativeGulpFrameworkPlugins(options);
|