weapp-vite 1.9.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CompilerContext-BpoRCDyM.d.ts +243 -0
- package/dist/CompilerContext-D9i0PEsF.d.cts +243 -0
- package/dist/auto-import-components/resolvers.cjs +5 -4
- package/dist/auto-import-components/resolvers.mjs +6 -5
- package/dist/{chunk-WKC6OQ3Q.mjs → chunk-3HVIVQUO.mjs} +4 -2
- package/dist/{chunk-2FYXPWJ7.mjs → chunk-5E4BX2PC.mjs} +3 -1
- package/dist/chunk-EO33M7LR.mjs +2714 -0
- package/dist/cli.cjs +1878 -1227
- package/dist/cli.mjs +38 -23
- package/dist/{config-YkkDB5_Y.d.ts → config-BM_dhf8V.d.ts} +42 -46
- package/dist/{config-D__5C2s3.d.cts → config-DYSwq1ku.d.cts} +42 -46
- package/dist/config.cjs +2 -0
- package/dist/config.d.cts +3 -4
- package/dist/config.d.ts +3 -4
- package/dist/config.mjs +2 -2
- package/dist/index.cjs +1830 -1187
- package/dist/index.d.cts +8 -11
- package/dist/index.d.ts +8 -11
- package/dist/index.mjs +4 -5
- package/dist/json.cjs +11 -10
- package/dist/json.d.cts +6 -7
- package/dist/json.d.ts +6 -7
- package/dist/json.mjs +12 -11
- package/package.json +25 -11
- package/bin/weapp-vite-cjs.js +0 -2
- package/bin/weapp-vite-esm.js +0 -2
- package/dist/CompilerContext-C0ZHcUt-.d.cts +0 -128
- package/dist/CompilerContext-DzZuTlqZ.d.ts +0 -128
- package/dist/chunk-I36YQNJ7.mjs +0 -2078
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { R as ResolvedValue } from './types-dS68tjL6.js';
|
|
2
|
+
import { E as Entry, S as SubPackageMetaValue, R as ResolvedAlias, P as ProjectConfig, M as MpPlatform, a as SubPackage, A as AppEntry, b as ScanWxmlOptions } from './config-BM_dhf8V.js';
|
|
3
|
+
import { PackageJson } from 'pkg-types';
|
|
4
|
+
import { InlineConfig } from 'vite';
|
|
5
|
+
import { RollupWatcher, RollupOutput } from 'rollup';
|
|
6
|
+
import { Options } from 'tsup';
|
|
7
|
+
import { Buffer } from 'node:buffer';
|
|
8
|
+
|
|
9
|
+
interface WxmlDep {
|
|
10
|
+
tagName: string;
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
quote: string | null | undefined;
|
|
14
|
+
name: string;
|
|
15
|
+
value: string;
|
|
16
|
+
attrs: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
interface ScanComponentItem {
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
}
|
|
22
|
+
type ComponentsMap = Record<string, ScanComponentItem[]>;
|
|
23
|
+
|
|
24
|
+
declare class AutoImportService {
|
|
25
|
+
private readonly configService;
|
|
26
|
+
private readonly jsonService;
|
|
27
|
+
potentialComponentMap: Map<string, {
|
|
28
|
+
entry: Entry;
|
|
29
|
+
value: ResolvedValue;
|
|
30
|
+
}>;
|
|
31
|
+
constructor(configService: ConfigService, jsonService: JsonService);
|
|
32
|
+
scanPotentialComponentEntries(filePath: string): Promise<void>;
|
|
33
|
+
filter(id: string, _meta?: SubPackageMetaValue): boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class BuildService {
|
|
37
|
+
readonly configService: ConfigService;
|
|
38
|
+
readonly watcherService: WatcherService;
|
|
39
|
+
readonly subPackageService: SubPackageService;
|
|
40
|
+
constructor(configService: ConfigService, watcherService: WatcherService, subPackageService: SubPackageService);
|
|
41
|
+
runDev(): Promise<RollupWatcher>;
|
|
42
|
+
runProd(): Promise<RollupOutput | RollupOutput[]>;
|
|
43
|
+
build(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface OutputExtensions {
|
|
47
|
+
js: string;
|
|
48
|
+
json: string;
|
|
49
|
+
wxml: string;
|
|
50
|
+
wxss: string;
|
|
51
|
+
wxs?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface LoadConfigOptions {
|
|
55
|
+
cwd: string;
|
|
56
|
+
isDev: boolean;
|
|
57
|
+
mode: string;
|
|
58
|
+
}
|
|
59
|
+
type LoadConfigResult = NonNullable<Awaited<ReturnType<typeof loadConfig>>>;
|
|
60
|
+
declare function loadConfig(opts: LoadConfigOptions): Promise<{
|
|
61
|
+
config: InlineConfig;
|
|
62
|
+
aliasEntries: ResolvedAlias[];
|
|
63
|
+
outputExtensions: OutputExtensions;
|
|
64
|
+
packageJson: PackageJson;
|
|
65
|
+
relativeSrcRoot: (p: string) => string;
|
|
66
|
+
cwd: string;
|
|
67
|
+
isDev: boolean;
|
|
68
|
+
mode: string;
|
|
69
|
+
projectConfig: ProjectConfig;
|
|
70
|
+
mpDistRoot: string;
|
|
71
|
+
packageJsonPath: string;
|
|
72
|
+
platform: MpPlatform;
|
|
73
|
+
srcRoot: string;
|
|
74
|
+
} | undefined>;
|
|
75
|
+
declare class ConfigService {
|
|
76
|
+
options: LoadConfigResult;
|
|
77
|
+
outputExtensions: OutputExtensions;
|
|
78
|
+
/**
|
|
79
|
+
* esbuild 定义的环境变量
|
|
80
|
+
*/
|
|
81
|
+
defineEnv: Record<string, any>;
|
|
82
|
+
constructor();
|
|
83
|
+
get defineImportMetaEnv(): Record<string, any>;
|
|
84
|
+
setDefineEnv(key: string, value: any): void;
|
|
85
|
+
load(options?: Partial<LoadConfigOptions>): Promise<Required<{
|
|
86
|
+
config: InlineConfig;
|
|
87
|
+
aliasEntries: ResolvedAlias[];
|
|
88
|
+
outputExtensions: OutputExtensions;
|
|
89
|
+
packageJson: PackageJson;
|
|
90
|
+
relativeSrcRoot: (p: string) => string;
|
|
91
|
+
cwd: string;
|
|
92
|
+
isDev: boolean;
|
|
93
|
+
mode: string;
|
|
94
|
+
projectConfig: ProjectConfig;
|
|
95
|
+
mpDistRoot: string;
|
|
96
|
+
packageJsonPath: string;
|
|
97
|
+
platform: MpPlatform;
|
|
98
|
+
srcRoot: string;
|
|
99
|
+
}>>;
|
|
100
|
+
get cwd(): string;
|
|
101
|
+
get isDev(): boolean;
|
|
102
|
+
get mpDistRoot(): string;
|
|
103
|
+
get outDir(): string;
|
|
104
|
+
get inlineConfig(): InlineConfig;
|
|
105
|
+
get packageJson(): PackageJson;
|
|
106
|
+
get projectConfig(): ProjectConfig;
|
|
107
|
+
get srcRoot(): string;
|
|
108
|
+
get mode(): string;
|
|
109
|
+
get aliasEntries(): ResolvedAlias[];
|
|
110
|
+
get platform(): MpPlatform;
|
|
111
|
+
relativeCwd(p: string): string;
|
|
112
|
+
relativeSrcRoot(p: string): string;
|
|
113
|
+
merge(subPackageMeta?: SubPackageMetaValue, ...configs: Partial<InlineConfig>[]): InlineConfig;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare class JsonService {
|
|
117
|
+
private readonly configService;
|
|
118
|
+
constructor(configService: ConfigService);
|
|
119
|
+
read(filepath: string): Promise<any>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare class NpmService {
|
|
123
|
+
private readonly configService;
|
|
124
|
+
constructor(configService: ConfigService);
|
|
125
|
+
get dependenciesCacheFilePath(): string;
|
|
126
|
+
get dependenciesCacheHash(): string;
|
|
127
|
+
writeDependenciesCache(): Promise<void>;
|
|
128
|
+
readDependenciesCache(): Promise<any>;
|
|
129
|
+
checkDependenciesCacheOutdate(): Promise<boolean>;
|
|
130
|
+
build(subPackage?: SubPackage, options?: Options): Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
declare class ScanService {
|
|
134
|
+
private readonly configService;
|
|
135
|
+
private readonly jsonService;
|
|
136
|
+
private readonly subPackageService;
|
|
137
|
+
private readonly autoImportService;
|
|
138
|
+
private readonly wxmlService;
|
|
139
|
+
entriesSet: Set<string>;
|
|
140
|
+
entries: Entry[];
|
|
141
|
+
appEntry?: AppEntry;
|
|
142
|
+
pagesSet: Set<string>;
|
|
143
|
+
constructor(configService: ConfigService, jsonService: JsonService, subPackageService: SubPackageService, autoImportService: AutoImportService, wxmlService: WxmlService);
|
|
144
|
+
initPagesSet(): Set<string>;
|
|
145
|
+
/**
|
|
146
|
+
* @deps [this.scanComponentEntry]
|
|
147
|
+
* @param entry
|
|
148
|
+
* @param relDir
|
|
149
|
+
*/
|
|
150
|
+
private usingComponentsHandler;
|
|
151
|
+
resetEntries(): void;
|
|
152
|
+
resetAutoImport(): void;
|
|
153
|
+
scanAppEntry(): Promise<AppEntry | undefined>;
|
|
154
|
+
/**
|
|
155
|
+
* 扫描并处理组件入口文件。
|
|
156
|
+
* @param componentEntry 组件入口文件名
|
|
157
|
+
* @param dirname 当前目录路径
|
|
158
|
+
* @param subPackageMeta 分包元信息(可选)
|
|
159
|
+
* @returns Promise<void>
|
|
160
|
+
*
|
|
161
|
+
* 该函数用于扫描并处理组件入口文件,包括查找 JS 入口、JSON 配置文件、模板入口等。
|
|
162
|
+
* 同时处理引入组件的情况,自动注入 usingComponents。
|
|
163
|
+
*/
|
|
164
|
+
scanComponentEntry(componentEntry: string, dirname: string, subPackageMeta?: SubPackageMetaValue): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
declare class SubPackageService {
|
|
168
|
+
private readonly configService;
|
|
169
|
+
private readonly npmService;
|
|
170
|
+
private readonly watcherService;
|
|
171
|
+
metaMap: Record<string, SubPackageMetaValue>;
|
|
172
|
+
constructor(configService: ConfigService, npmService: NpmService, watcherService: WatcherService);
|
|
173
|
+
build(): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare class WatcherService {
|
|
177
|
+
rollupWatcherMap: Map<string, RollupWatcher>;
|
|
178
|
+
constructor();
|
|
179
|
+
setRollupWatcher(watcher: RollupWatcher, root?: string): void;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface Token {
|
|
183
|
+
start: number;
|
|
184
|
+
end: number;
|
|
185
|
+
value: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare function scanWxml(wxml: string | Buffer, options?: ScanWxmlOptions): {
|
|
189
|
+
components: ComponentsMap;
|
|
190
|
+
deps: WxmlDep[];
|
|
191
|
+
removeStartStack: number[];
|
|
192
|
+
removeEndStack: number[];
|
|
193
|
+
commentTokens: Token[];
|
|
194
|
+
inlineWxsTokens: Token[];
|
|
195
|
+
wxsImportNormalizeTokens: Token[];
|
|
196
|
+
removeWxsLangAttrTokens: Token[];
|
|
197
|
+
eventTokens: Token[];
|
|
198
|
+
code: string;
|
|
199
|
+
};
|
|
200
|
+
type ScanWxmlResult = ReturnType<typeof scanWxml>;
|
|
201
|
+
|
|
202
|
+
declare class WxmlService {
|
|
203
|
+
private readonly configService;
|
|
204
|
+
map: Map<string, Set<string>>;
|
|
205
|
+
tokenMap: Map<string, ScanWxmlResult>;
|
|
206
|
+
wxmlComponentsMap: Map<string, ComponentsMap>;
|
|
207
|
+
constructor(configService: ConfigService);
|
|
208
|
+
addDeps(filepath: string, deps?: string[]): Promise<void>;
|
|
209
|
+
getAllDeps(): Set<string>;
|
|
210
|
+
clear(): void;
|
|
211
|
+
scan(filepath: string): Promise<{
|
|
212
|
+
components: ComponentsMap;
|
|
213
|
+
deps: WxmlDep[];
|
|
214
|
+
removeStartStack: number[];
|
|
215
|
+
removeEndStack: number[];
|
|
216
|
+
commentTokens: Token[];
|
|
217
|
+
inlineWxsTokens: Token[];
|
|
218
|
+
wxsImportNormalizeTokens: Token[];
|
|
219
|
+
removeWxsLangAttrTokens: Token[];
|
|
220
|
+
eventTokens: Token[];
|
|
221
|
+
code: string;
|
|
222
|
+
} | undefined>;
|
|
223
|
+
setWxmlComponentsMap(absPath: string, components: ComponentsMap): void;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare class CompilerContext {
|
|
227
|
+
readonly configService: ConfigService;
|
|
228
|
+
readonly npmService: NpmService;
|
|
229
|
+
readonly wxmlService: WxmlService;
|
|
230
|
+
readonly jsonService: JsonService;
|
|
231
|
+
readonly subPackageService: SubPackageService;
|
|
232
|
+
readonly watcherService: WatcherService;
|
|
233
|
+
readonly autoImportService: AutoImportService;
|
|
234
|
+
readonly buildService: BuildService;
|
|
235
|
+
readonly scanService: ScanService;
|
|
236
|
+
/**
|
|
237
|
+
* 构造函数用于初始化编译器上下文对象
|
|
238
|
+
* @param options 可选的编译器上下文配置对象
|
|
239
|
+
*/
|
|
240
|
+
constructor(configService: ConfigService, npmService: NpmService, wxmlService: WxmlService, jsonService: JsonService, subPackageService: SubPackageService, watcherService: WatcherService, autoImportService: AutoImportService, buildService: BuildService, scanService: ScanService);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export { CompilerContext as C, type LoadConfigOptions as L };
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { R as ResolvedValue } from './types-dS68tjL6.cjs';
|
|
2
|
+
import { E as Entry, S as SubPackageMetaValue, R as ResolvedAlias, P as ProjectConfig, M as MpPlatform, a as SubPackage, A as AppEntry, b as ScanWxmlOptions } from './config-DYSwq1ku.cjs';
|
|
3
|
+
import { PackageJson } from 'pkg-types';
|
|
4
|
+
import { InlineConfig } from 'vite';
|
|
5
|
+
import { RollupWatcher, RollupOutput } from 'rollup';
|
|
6
|
+
import { Options } from 'tsup';
|
|
7
|
+
import { Buffer } from 'node:buffer';
|
|
8
|
+
|
|
9
|
+
interface WxmlDep {
|
|
10
|
+
tagName: string;
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
quote: string | null | undefined;
|
|
14
|
+
name: string;
|
|
15
|
+
value: string;
|
|
16
|
+
attrs: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
interface ScanComponentItem {
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
}
|
|
22
|
+
type ComponentsMap = Record<string, ScanComponentItem[]>;
|
|
23
|
+
|
|
24
|
+
declare class AutoImportService {
|
|
25
|
+
private readonly configService;
|
|
26
|
+
private readonly jsonService;
|
|
27
|
+
potentialComponentMap: Map<string, {
|
|
28
|
+
entry: Entry;
|
|
29
|
+
value: ResolvedValue;
|
|
30
|
+
}>;
|
|
31
|
+
constructor(configService: ConfigService, jsonService: JsonService);
|
|
32
|
+
scanPotentialComponentEntries(filePath: string): Promise<void>;
|
|
33
|
+
filter(id: string, _meta?: SubPackageMetaValue): boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class BuildService {
|
|
37
|
+
readonly configService: ConfigService;
|
|
38
|
+
readonly watcherService: WatcherService;
|
|
39
|
+
readonly subPackageService: SubPackageService;
|
|
40
|
+
constructor(configService: ConfigService, watcherService: WatcherService, subPackageService: SubPackageService);
|
|
41
|
+
runDev(): Promise<RollupWatcher>;
|
|
42
|
+
runProd(): Promise<RollupOutput | RollupOutput[]>;
|
|
43
|
+
build(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface OutputExtensions {
|
|
47
|
+
js: string;
|
|
48
|
+
json: string;
|
|
49
|
+
wxml: string;
|
|
50
|
+
wxss: string;
|
|
51
|
+
wxs?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface LoadConfigOptions {
|
|
55
|
+
cwd: string;
|
|
56
|
+
isDev: boolean;
|
|
57
|
+
mode: string;
|
|
58
|
+
}
|
|
59
|
+
type LoadConfigResult = NonNullable<Awaited<ReturnType<typeof loadConfig>>>;
|
|
60
|
+
declare function loadConfig(opts: LoadConfigOptions): Promise<{
|
|
61
|
+
config: InlineConfig;
|
|
62
|
+
aliasEntries: ResolvedAlias[];
|
|
63
|
+
outputExtensions: OutputExtensions;
|
|
64
|
+
packageJson: PackageJson;
|
|
65
|
+
relativeSrcRoot: (p: string) => string;
|
|
66
|
+
cwd: string;
|
|
67
|
+
isDev: boolean;
|
|
68
|
+
mode: string;
|
|
69
|
+
projectConfig: ProjectConfig;
|
|
70
|
+
mpDistRoot: string;
|
|
71
|
+
packageJsonPath: string;
|
|
72
|
+
platform: MpPlatform;
|
|
73
|
+
srcRoot: string;
|
|
74
|
+
} | undefined>;
|
|
75
|
+
declare class ConfigService {
|
|
76
|
+
options: LoadConfigResult;
|
|
77
|
+
outputExtensions: OutputExtensions;
|
|
78
|
+
/**
|
|
79
|
+
* esbuild 定义的环境变量
|
|
80
|
+
*/
|
|
81
|
+
defineEnv: Record<string, any>;
|
|
82
|
+
constructor();
|
|
83
|
+
get defineImportMetaEnv(): Record<string, any>;
|
|
84
|
+
setDefineEnv(key: string, value: any): void;
|
|
85
|
+
load(options?: Partial<LoadConfigOptions>): Promise<Required<{
|
|
86
|
+
config: InlineConfig;
|
|
87
|
+
aliasEntries: ResolvedAlias[];
|
|
88
|
+
outputExtensions: OutputExtensions;
|
|
89
|
+
packageJson: PackageJson;
|
|
90
|
+
relativeSrcRoot: (p: string) => string;
|
|
91
|
+
cwd: string;
|
|
92
|
+
isDev: boolean;
|
|
93
|
+
mode: string;
|
|
94
|
+
projectConfig: ProjectConfig;
|
|
95
|
+
mpDistRoot: string;
|
|
96
|
+
packageJsonPath: string;
|
|
97
|
+
platform: MpPlatform;
|
|
98
|
+
srcRoot: string;
|
|
99
|
+
}>>;
|
|
100
|
+
get cwd(): string;
|
|
101
|
+
get isDev(): boolean;
|
|
102
|
+
get mpDistRoot(): string;
|
|
103
|
+
get outDir(): string;
|
|
104
|
+
get inlineConfig(): InlineConfig;
|
|
105
|
+
get packageJson(): PackageJson;
|
|
106
|
+
get projectConfig(): ProjectConfig;
|
|
107
|
+
get srcRoot(): string;
|
|
108
|
+
get mode(): string;
|
|
109
|
+
get aliasEntries(): ResolvedAlias[];
|
|
110
|
+
get platform(): MpPlatform;
|
|
111
|
+
relativeCwd(p: string): string;
|
|
112
|
+
relativeSrcRoot(p: string): string;
|
|
113
|
+
merge(subPackageMeta?: SubPackageMetaValue, ...configs: Partial<InlineConfig>[]): InlineConfig;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare class JsonService {
|
|
117
|
+
private readonly configService;
|
|
118
|
+
constructor(configService: ConfigService);
|
|
119
|
+
read(filepath: string): Promise<any>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare class NpmService {
|
|
123
|
+
private readonly configService;
|
|
124
|
+
constructor(configService: ConfigService);
|
|
125
|
+
get dependenciesCacheFilePath(): string;
|
|
126
|
+
get dependenciesCacheHash(): string;
|
|
127
|
+
writeDependenciesCache(): Promise<void>;
|
|
128
|
+
readDependenciesCache(): Promise<any>;
|
|
129
|
+
checkDependenciesCacheOutdate(): Promise<boolean>;
|
|
130
|
+
build(subPackage?: SubPackage, options?: Options): Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
declare class ScanService {
|
|
134
|
+
private readonly configService;
|
|
135
|
+
private readonly jsonService;
|
|
136
|
+
private readonly subPackageService;
|
|
137
|
+
private readonly autoImportService;
|
|
138
|
+
private readonly wxmlService;
|
|
139
|
+
entriesSet: Set<string>;
|
|
140
|
+
entries: Entry[];
|
|
141
|
+
appEntry?: AppEntry;
|
|
142
|
+
pagesSet: Set<string>;
|
|
143
|
+
constructor(configService: ConfigService, jsonService: JsonService, subPackageService: SubPackageService, autoImportService: AutoImportService, wxmlService: WxmlService);
|
|
144
|
+
initPagesSet(): Set<string>;
|
|
145
|
+
/**
|
|
146
|
+
* @deps [this.scanComponentEntry]
|
|
147
|
+
* @param entry
|
|
148
|
+
* @param relDir
|
|
149
|
+
*/
|
|
150
|
+
private usingComponentsHandler;
|
|
151
|
+
resetEntries(): void;
|
|
152
|
+
resetAutoImport(): void;
|
|
153
|
+
scanAppEntry(): Promise<AppEntry | undefined>;
|
|
154
|
+
/**
|
|
155
|
+
* 扫描并处理组件入口文件。
|
|
156
|
+
* @param componentEntry 组件入口文件名
|
|
157
|
+
* @param dirname 当前目录路径
|
|
158
|
+
* @param subPackageMeta 分包元信息(可选)
|
|
159
|
+
* @returns Promise<void>
|
|
160
|
+
*
|
|
161
|
+
* 该函数用于扫描并处理组件入口文件,包括查找 JS 入口、JSON 配置文件、模板入口等。
|
|
162
|
+
* 同时处理引入组件的情况,自动注入 usingComponents。
|
|
163
|
+
*/
|
|
164
|
+
scanComponentEntry(componentEntry: string, dirname: string, subPackageMeta?: SubPackageMetaValue): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
declare class SubPackageService {
|
|
168
|
+
private readonly configService;
|
|
169
|
+
private readonly npmService;
|
|
170
|
+
private readonly watcherService;
|
|
171
|
+
metaMap: Record<string, SubPackageMetaValue>;
|
|
172
|
+
constructor(configService: ConfigService, npmService: NpmService, watcherService: WatcherService);
|
|
173
|
+
build(): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare class WatcherService {
|
|
177
|
+
rollupWatcherMap: Map<string, RollupWatcher>;
|
|
178
|
+
constructor();
|
|
179
|
+
setRollupWatcher(watcher: RollupWatcher, root?: string): void;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface Token {
|
|
183
|
+
start: number;
|
|
184
|
+
end: number;
|
|
185
|
+
value: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare function scanWxml(wxml: string | Buffer, options?: ScanWxmlOptions): {
|
|
189
|
+
components: ComponentsMap;
|
|
190
|
+
deps: WxmlDep[];
|
|
191
|
+
removeStartStack: number[];
|
|
192
|
+
removeEndStack: number[];
|
|
193
|
+
commentTokens: Token[];
|
|
194
|
+
inlineWxsTokens: Token[];
|
|
195
|
+
wxsImportNormalizeTokens: Token[];
|
|
196
|
+
removeWxsLangAttrTokens: Token[];
|
|
197
|
+
eventTokens: Token[];
|
|
198
|
+
code: string;
|
|
199
|
+
};
|
|
200
|
+
type ScanWxmlResult = ReturnType<typeof scanWxml>;
|
|
201
|
+
|
|
202
|
+
declare class WxmlService {
|
|
203
|
+
private readonly configService;
|
|
204
|
+
map: Map<string, Set<string>>;
|
|
205
|
+
tokenMap: Map<string, ScanWxmlResult>;
|
|
206
|
+
wxmlComponentsMap: Map<string, ComponentsMap>;
|
|
207
|
+
constructor(configService: ConfigService);
|
|
208
|
+
addDeps(filepath: string, deps?: string[]): Promise<void>;
|
|
209
|
+
getAllDeps(): Set<string>;
|
|
210
|
+
clear(): void;
|
|
211
|
+
scan(filepath: string): Promise<{
|
|
212
|
+
components: ComponentsMap;
|
|
213
|
+
deps: WxmlDep[];
|
|
214
|
+
removeStartStack: number[];
|
|
215
|
+
removeEndStack: number[];
|
|
216
|
+
commentTokens: Token[];
|
|
217
|
+
inlineWxsTokens: Token[];
|
|
218
|
+
wxsImportNormalizeTokens: Token[];
|
|
219
|
+
removeWxsLangAttrTokens: Token[];
|
|
220
|
+
eventTokens: Token[];
|
|
221
|
+
code: string;
|
|
222
|
+
} | undefined>;
|
|
223
|
+
setWxmlComponentsMap(absPath: string, components: ComponentsMap): void;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare class CompilerContext {
|
|
227
|
+
readonly configService: ConfigService;
|
|
228
|
+
readonly npmService: NpmService;
|
|
229
|
+
readonly wxmlService: WxmlService;
|
|
230
|
+
readonly jsonService: JsonService;
|
|
231
|
+
readonly subPackageService: SubPackageService;
|
|
232
|
+
readonly watcherService: WatcherService;
|
|
233
|
+
readonly autoImportService: AutoImportService;
|
|
234
|
+
readonly buildService: BuildService;
|
|
235
|
+
readonly scanService: ScanService;
|
|
236
|
+
/**
|
|
237
|
+
* 构造函数用于初始化编译器上下文对象
|
|
238
|
+
* @param options 可选的编译器上下文配置对象
|
|
239
|
+
*/
|
|
240
|
+
constructor(configService: ConfigService, npmService: NpmService, wxmlService: WxmlService, jsonService: JsonService, subPackageService: SubPackageService, watcherService: WatcherService, autoImportService: AutoImportService, buildService: BuildService, scanService: ScanService);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export { CompilerContext as C, type LoadConfigOptions as L };
|
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -110,7 +111,7 @@ var tdesign_default = [
|
|
|
110
111
|
|
|
111
112
|
// src/auto-import-components/resolvers/tdesign.ts
|
|
112
113
|
var defaultPrefix = "t-";
|
|
113
|
-
var TDesignResolver = (opts) => {
|
|
114
|
+
var TDesignResolver = /* @__PURE__ */ __name((opts) => {
|
|
114
115
|
const { prefix, resolve } = (0, import_shared.defu)(opts, {
|
|
115
116
|
prefix: defaultPrefix,
|
|
116
117
|
resolve({ name, prefix: prefix2 }) {
|
|
@@ -138,7 +139,7 @@ var TDesignResolver = (opts) => {
|
|
|
138
139
|
};
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
|
-
};
|
|
142
|
+
}, "TDesignResolver");
|
|
142
143
|
|
|
143
144
|
// src/auto-import-components/resolvers/vant.ts
|
|
144
145
|
var import_shared2 = require("@weapp-core/shared");
|
|
@@ -218,7 +219,7 @@ var vant_default = [
|
|
|
218
219
|
|
|
219
220
|
// src/auto-import-components/resolvers/vant.ts
|
|
220
221
|
var defaultPrefix2 = "van-";
|
|
221
|
-
var VantResolver = (opts) => {
|
|
222
|
+
var VantResolver = /* @__PURE__ */ __name((opts) => {
|
|
222
223
|
const { prefix, resolve } = (0, import_shared2.defu)(opts, {
|
|
223
224
|
prefix: defaultPrefix2,
|
|
224
225
|
resolve({ name, prefix: prefix2 }) {
|
|
@@ -246,7 +247,7 @@ var VantResolver = (opts) => {
|
|
|
246
247
|
};
|
|
247
248
|
}
|
|
248
249
|
};
|
|
249
|
-
};
|
|
250
|
+
}, "VantResolver");
|
|
250
251
|
// Annotate the CommonJS export names for ESM import in node:
|
|
251
252
|
0 && (module.exports = {
|
|
252
253
|
TDesignResolver,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
__name,
|
|
2
3
|
init_esm_shims
|
|
3
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-3HVIVQUO.mjs";
|
|
4
5
|
|
|
5
6
|
// src/auto-import-components/resolvers/index.ts
|
|
6
7
|
init_esm_shims();
|
|
@@ -91,7 +92,7 @@ var tdesign_default = [
|
|
|
91
92
|
|
|
92
93
|
// src/auto-import-components/resolvers/tdesign.ts
|
|
93
94
|
var defaultPrefix = "t-";
|
|
94
|
-
var TDesignResolver = (opts) => {
|
|
95
|
+
var TDesignResolver = /* @__PURE__ */ __name((opts) => {
|
|
95
96
|
const { prefix, resolve } = defu(opts, {
|
|
96
97
|
prefix: defaultPrefix,
|
|
97
98
|
resolve({ name, prefix: prefix2 }) {
|
|
@@ -119,7 +120,7 @@ var TDesignResolver = (opts) => {
|
|
|
119
120
|
};
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
|
-
};
|
|
123
|
+
}, "TDesignResolver");
|
|
123
124
|
|
|
124
125
|
// src/auto-import-components/resolvers/types.ts
|
|
125
126
|
init_esm_shims();
|
|
@@ -203,7 +204,7 @@ var vant_default = [
|
|
|
203
204
|
|
|
204
205
|
// src/auto-import-components/resolvers/vant.ts
|
|
205
206
|
var defaultPrefix2 = "van-";
|
|
206
|
-
var VantResolver = (opts) => {
|
|
207
|
+
var VantResolver = /* @__PURE__ */ __name((opts) => {
|
|
207
208
|
const { prefix, resolve } = defu2(opts, {
|
|
208
209
|
prefix: defaultPrefix2,
|
|
209
210
|
resolve({ name, prefix: prefix2 }) {
|
|
@@ -231,7 +232,7 @@ var VantResolver = (opts) => {
|
|
|
231
232
|
};
|
|
232
233
|
}
|
|
233
234
|
};
|
|
234
|
-
};
|
|
235
|
+
}, "VantResolver");
|
|
235
236
|
export {
|
|
236
237
|
TDesignResolver,
|
|
237
238
|
VantResolver
|
|
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
8
|
var __esm = (fn, res) => function __init() {
|
|
8
9
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
10
|
};
|
|
@@ -27,14 +28,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
28
|
mod
|
|
28
29
|
));
|
|
29
30
|
|
|
30
|
-
// ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.
|
|
31
|
+
// ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.3_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js
|
|
31
32
|
var init_esm_shims = __esm({
|
|
32
|
-
"../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.
|
|
33
|
+
"../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.3_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
34
|
"use strict";
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
export {
|
|
39
|
+
__name,
|
|
38
40
|
__commonJS,
|
|
39
41
|
__toESM,
|
|
40
42
|
init_esm_shims
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
__name,
|
|
2
3
|
init_esm_shims
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3HVIVQUO.mjs";
|
|
4
5
|
|
|
5
6
|
// src/config.ts
|
|
6
7
|
init_esm_shims();
|
|
7
8
|
function defineConfig(config) {
|
|
8
9
|
return config;
|
|
9
10
|
}
|
|
11
|
+
__name(defineConfig, "defineConfig");
|
|
10
12
|
|
|
11
13
|
export {
|
|
12
14
|
defineConfig
|