@kimesh/tailwindcss 0.2.48 → 0.2.49
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/index.d.mts +3534 -3
- package/dist/index.mjs +76161 -3
- package/dist/prompt-Cv0Y9nfo.mjs +845 -0
- package/package.json +3 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,3537 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { VitePlugin } from "
|
|
1
|
+
import * as vite from "vite";
|
|
2
|
+
import { Plugin, Plugin as VitePlugin, PluginOption, ResolvedConfig, UserConfig, ViteDevServer } from "vite";
|
|
3
|
+
import MagicString from "magic-string";
|
|
3
4
|
|
|
5
|
+
//#region ../../node_modules/.pnpm/hookable@6.1.0/node_modules/hookable/dist/index.d.mts
|
|
6
|
+
//#region src/types.d.ts
|
|
7
|
+
type HookCallback = (...arguments_: any) => Promise<void> | void;
|
|
8
|
+
type HookKeys<T> = keyof T & string;
|
|
9
|
+
type DeprecatedHook<T> = {
|
|
10
|
+
message?: string;
|
|
11
|
+
to: HookKeys<T>;
|
|
12
|
+
};
|
|
13
|
+
type ValueOf<C> = C extends Record<any, any> ? C[keyof C] : never;
|
|
14
|
+
type Strings<T> = Exclude<keyof T, number | symbol>;
|
|
15
|
+
type KnownKeys<T> = keyof { [K in keyof T as string extends K ? never : number extends K ? never : K]: never };
|
|
16
|
+
type StripGeneric<T> = Pick<T, KnownKeys<T> extends keyof T ? KnownKeys<T> : never>;
|
|
17
|
+
type OnlyGeneric<T> = Omit<T, KnownKeys<T> extends keyof T ? KnownKeys<T> : never>;
|
|
18
|
+
type Namespaces<T> = ValueOf<{ [key in Strings<T>]: key extends `${infer Namespace}:${string}` ? Namespace : never }>;
|
|
19
|
+
type BareHooks<T> = ValueOf<{ [key in Strings<T>]: key extends `${string}:${string}` ? never : key }>;
|
|
20
|
+
type HooksInNamespace<T, Namespace extends string> = ValueOf<{ [key in Strings<T>]: key extends `${Namespace}:${infer HookName}` ? HookName : never }>;
|
|
21
|
+
type WithoutNamespace<T, Namespace extends string> = { [key in HooksInNamespace<T, Namespace>]: `${Namespace}:${key}` extends keyof T ? T[`${Namespace}:${key}`] : never };
|
|
22
|
+
type NestedHooks<T> = (Partial<StripGeneric<T>> | Partial<OnlyGeneric<T>>) & Partial<{ [key in Namespaces<StripGeneric<T>>]: NestedHooks<WithoutNamespace<T, key>> }> & Partial<{ [key in BareHooks<StripGeneric<T>>]: T[key] }>; //#endregion
|
|
23
|
+
//#region src/hookable.d.ts
|
|
24
|
+
type InferCallback<HT, HN extends keyof HT> = HT[HN] extends HookCallback ? HT[HN] : never;
|
|
25
|
+
type InferSpyEvent<HT extends Record<string, any>> = { [key in keyof HT]: {
|
|
26
|
+
name: key;
|
|
27
|
+
args: Parameters<HT[key]>;
|
|
28
|
+
context: Record<string, any>;
|
|
29
|
+
} }[keyof HT];
|
|
30
|
+
declare class Hookable<HooksT extends Record<string, any> = Record<string, HookCallback>, HookNameT extends HookKeys<HooksT> = HookKeys<HooksT>> {
|
|
31
|
+
private _hooks;
|
|
32
|
+
private _before?;
|
|
33
|
+
private _after?;
|
|
34
|
+
private _deprecatedHooks;
|
|
35
|
+
private _deprecatedMessages?;
|
|
36
|
+
constructor();
|
|
37
|
+
hook<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>, options?: {
|
|
38
|
+
allowDeprecated?: boolean;
|
|
39
|
+
}): () => void;
|
|
40
|
+
hookOnce<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): () => void;
|
|
41
|
+
removeHook<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): void;
|
|
42
|
+
clearHook<NameT extends HookNameT>(name: NameT): void;
|
|
43
|
+
deprecateHook<NameT extends HookNameT>(name: NameT, deprecated: HookKeys<HooksT> | DeprecatedHook<HooksT>): void;
|
|
44
|
+
deprecateHooks(deprecatedHooks: Partial<Record<HookNameT, DeprecatedHook<HooksT>>>): void;
|
|
45
|
+
addHooks(configHooks: NestedHooks<HooksT>): () => void;
|
|
46
|
+
removeHooks(configHooks: NestedHooks<HooksT>): void;
|
|
47
|
+
removeAllHooks(): void;
|
|
48
|
+
callHook<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any> | void;
|
|
49
|
+
callHookParallel<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any[]> | void;
|
|
50
|
+
callHookWith<NameT extends HookNameT, CallFunction extends (hooks: HookCallback[], args: Parameters<InferCallback<HooksT, NameT>>, name: NameT) => any>(caller: CallFunction, name: NameT, args: Parameters<InferCallback<HooksT, NameT>>): ReturnType<CallFunction>;
|
|
51
|
+
beforeEach(function_: (event: InferSpyEvent<HooksT>) => void): () => void;
|
|
52
|
+
afterEach(function_: (event: InferSpyEvent<HooksT>) => void): () => void;
|
|
53
|
+
}
|
|
54
|
+
type CreateTask = (name?: string) => {
|
|
55
|
+
run: (function_: () => Promise<any> | any) => Promise<any> | any;
|
|
56
|
+
};
|
|
57
|
+
declare global {
|
|
58
|
+
interface Console {
|
|
59
|
+
createTask?: CreateTask;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** @deprecated */
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region ../../packages/layers/dist/index.d.mts
|
|
65
|
+
//#region src/types.d.ts
|
|
66
|
+
/**
|
|
67
|
+
* @kimesh/layers - Type definitions
|
|
68
|
+
*
|
|
69
|
+
* This module defines the core types for the Kimesh layer system.
|
|
70
|
+
*/
|
|
71
|
+
/**
|
|
72
|
+
* Configuration for a single layer in kimesh.config.ts
|
|
73
|
+
*/
|
|
74
|
+
interface KimeshLayerConfig {
|
|
75
|
+
/** Layer name (e.g., '@kimesh-layers/cms' or 'cms') */
|
|
76
|
+
name: string;
|
|
77
|
+
/** Path to the layer root directory */
|
|
78
|
+
path: string;
|
|
79
|
+
/** Routes configuration for this layer */
|
|
80
|
+
routes?: LayerRouteConfig;
|
|
81
|
+
/** Component configuration for this layer */
|
|
82
|
+
components?: LayerComponentConfig;
|
|
83
|
+
/** Composable configuration for this layer */
|
|
84
|
+
composables?: LayerComposableConfig;
|
|
85
|
+
/** Utils configuration for this layer */
|
|
86
|
+
utils?: LayerUtilsConfig;
|
|
87
|
+
/** Stores configuration for this layer */
|
|
88
|
+
stores?: LayerStoresConfig;
|
|
89
|
+
/** Auto-import configuration for this layer */
|
|
90
|
+
autoImport?: LayerAutoImportConfig;
|
|
91
|
+
/** CSS files to include from this layer */
|
|
92
|
+
css?: string[];
|
|
93
|
+
/** Dependencies required by this layer */
|
|
94
|
+
dependencies?: string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Extended layer configuration (from `extends` array)
|
|
98
|
+
* Can be a string path or full config object
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* Route configuration for a layer
|
|
102
|
+
*/
|
|
103
|
+
interface LayerRouteConfig {
|
|
104
|
+
/** Routes directory within the layer (default: 'routes') */
|
|
105
|
+
folder?: string;
|
|
106
|
+
/** Base path prefix for this layer's routes (e.g., '/blog') */
|
|
107
|
+
basePath?: string;
|
|
108
|
+
/** Include patterns for route files */
|
|
109
|
+
include?: string[];
|
|
110
|
+
/** Exclude patterns for route files */
|
|
111
|
+
exclude?: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Component configuration for a layer
|
|
115
|
+
*/
|
|
116
|
+
interface LayerComponentConfig {
|
|
117
|
+
/** Component directories to scan */
|
|
118
|
+
dirs?: string[];
|
|
119
|
+
/** Prefix for component names (e.g., 'Cms' → CmsButton) */
|
|
120
|
+
prefix?: string | false;
|
|
121
|
+
/** Register components globally */
|
|
122
|
+
global?: boolean;
|
|
123
|
+
/** File extensions to scan */
|
|
124
|
+
extensions?: string[];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Composable configuration for a layer
|
|
128
|
+
*/
|
|
129
|
+
interface LayerComposableConfig {
|
|
130
|
+
/** Composable directories to scan */
|
|
131
|
+
dirs?: string[];
|
|
132
|
+
/** File extensions to scan */
|
|
133
|
+
extensions?: string[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Utils configuration for a layer
|
|
137
|
+
*/
|
|
138
|
+
interface LayerUtilsConfig {
|
|
139
|
+
/** Utils directories to scan */
|
|
140
|
+
dirs?: string[];
|
|
141
|
+
/** File extensions to scan */
|
|
142
|
+
extensions?: string[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Stores configuration for a layer
|
|
146
|
+
*/
|
|
147
|
+
interface LayerStoresConfig {
|
|
148
|
+
/** Stores directories to scan */
|
|
149
|
+
dirs?: string[];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Auto-import configuration for a layer
|
|
153
|
+
*/
|
|
154
|
+
interface LayerAutoImportConfig {
|
|
155
|
+
/** Additional imports specific to this layer */
|
|
156
|
+
imports?: Array<string | {
|
|
157
|
+
from: string;
|
|
158
|
+
imports: string[];
|
|
159
|
+
}>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Resolved layer with all metadata
|
|
163
|
+
*/
|
|
164
|
+
interface ResolvedLayer {
|
|
165
|
+
/** Layer name */
|
|
166
|
+
name: string;
|
|
167
|
+
/** Absolute path to layer root */
|
|
168
|
+
path: string;
|
|
169
|
+
/** Priority (0 = app level, highest priority) */
|
|
170
|
+
priority: number;
|
|
171
|
+
/** Original configuration */
|
|
172
|
+
config: KimeshLayerConfig;
|
|
173
|
+
/** Layers this layer extends */
|
|
174
|
+
extends: string[];
|
|
175
|
+
/** Whether this is the app layer (priority 0) */
|
|
176
|
+
isApp: boolean;
|
|
177
|
+
/** Source type: 'local', 'npm', or 'workspace' */
|
|
178
|
+
source: 'local' | 'npm' | 'workspace';
|
|
179
|
+
/** Alias mappings for this layer */
|
|
180
|
+
aliases: Record<string, string>;
|
|
181
|
+
/** Runtime config from this layer's kimesh.config.ts */
|
|
182
|
+
runtimeConfig?: Record<string, unknown>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Layer stack - ordered list of resolved layers
|
|
186
|
+
*/
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region ../../node_modules/.pnpm/esbuild@0.27.3/node_modules/esbuild/lib/main.d.ts
|
|
189
|
+
// Note: These declarations exist to avoid type errors when you omit "dom" from
|
|
190
|
+
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
|
|
191
|
+
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
|
|
192
|
+
// with the browser DOM and is present in many non-browser JavaScript runtimes
|
|
193
|
+
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
|
|
194
|
+
// these scenarios.
|
|
195
|
+
//
|
|
196
|
+
// There's an open issue about getting this problem corrected (although these
|
|
197
|
+
// declarations will need to remain even if this is fixed for backward
|
|
198
|
+
// compatibility with older TypeScript versions):
|
|
199
|
+
//
|
|
200
|
+
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
|
|
201
|
+
//
|
|
202
|
+
declare global {
|
|
203
|
+
namespace WebAssembly {
|
|
204
|
+
interface Module {}
|
|
205
|
+
}
|
|
206
|
+
interface URL {}
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region ../../node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts
|
|
210
|
+
// This definition file follows a somewhat unusual format. ESTree allows
|
|
211
|
+
// runtime type checks based on the `type` parameter. In order to explain this
|
|
212
|
+
// to typescript we want to use discriminated union types:
|
|
213
|
+
// https://github.com/Microsoft/TypeScript/pull/9163
|
|
214
|
+
//
|
|
215
|
+
// For ESTree this is a bit tricky because the high level interfaces like
|
|
216
|
+
// Node or Function are pulling double duty. We want to pass common fields down
|
|
217
|
+
// to the interfaces that extend them (like Identifier or
|
|
218
|
+
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
|
219
|
+
// common fields on them. So we've split the high level interfaces into two
|
|
220
|
+
// types, a base type which passes down inherited fields, and a type union of
|
|
221
|
+
// all types which extend the base type. Only the type union is exported, and
|
|
222
|
+
// the union is how other types refer to the collection of inheriting types.
|
|
223
|
+
//
|
|
224
|
+
// This makes the definitions file here somewhat more difficult to maintain,
|
|
225
|
+
// but it has the notable advantage of making ESTree much easier to use as
|
|
226
|
+
// an end user.
|
|
227
|
+
interface BaseNodeWithoutComments {
|
|
228
|
+
// Every leaf interface that extends BaseNode must specify a type property.
|
|
229
|
+
// The type property should be a string literal. For example, Identifier
|
|
230
|
+
// has: `type: "Identifier"`
|
|
231
|
+
type: string;
|
|
232
|
+
loc?: SourceLocation | null | undefined;
|
|
233
|
+
range?: [number, number] | undefined;
|
|
234
|
+
}
|
|
235
|
+
interface BaseNode extends BaseNodeWithoutComments {
|
|
236
|
+
leadingComments?: Comment$1[] | undefined;
|
|
237
|
+
trailingComments?: Comment$1[] | undefined;
|
|
238
|
+
}
|
|
239
|
+
interface Comment$1 extends BaseNodeWithoutComments {
|
|
240
|
+
type: "Line" | "Block";
|
|
241
|
+
value: string;
|
|
242
|
+
}
|
|
243
|
+
interface SourceLocation {
|
|
244
|
+
source?: string | null | undefined;
|
|
245
|
+
start: Position;
|
|
246
|
+
end: Position;
|
|
247
|
+
}
|
|
248
|
+
interface Position {
|
|
249
|
+
/** >= 1 */
|
|
250
|
+
line: number;
|
|
251
|
+
/** >= 0 */
|
|
252
|
+
column: number;
|
|
253
|
+
}
|
|
254
|
+
interface BaseFunction extends BaseNode {
|
|
255
|
+
params: Pattern[];
|
|
256
|
+
generator?: boolean | undefined;
|
|
257
|
+
async?: boolean | undefined; // The body is either BlockStatement or Expression because arrow functions
|
|
258
|
+
// can have a body that's either. FunctionDeclarations and
|
|
259
|
+
// FunctionExpressions have only BlockStatement bodies.
|
|
260
|
+
body: BlockStatement | Expression;
|
|
261
|
+
}
|
|
262
|
+
type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
|
|
263
|
+
interface BaseStatement extends BaseNode {}
|
|
264
|
+
interface EmptyStatement extends BaseStatement {
|
|
265
|
+
type: "EmptyStatement";
|
|
266
|
+
}
|
|
267
|
+
interface BlockStatement extends BaseStatement {
|
|
268
|
+
type: "BlockStatement";
|
|
269
|
+
body: Statement[];
|
|
270
|
+
innerComments?: Comment$1[] | undefined;
|
|
271
|
+
}
|
|
272
|
+
interface StaticBlock extends Omit<BlockStatement, "type"> {
|
|
273
|
+
type: "StaticBlock";
|
|
274
|
+
}
|
|
275
|
+
interface ExpressionStatement extends BaseStatement {
|
|
276
|
+
type: "ExpressionStatement";
|
|
277
|
+
expression: Expression;
|
|
278
|
+
}
|
|
279
|
+
interface IfStatement extends BaseStatement {
|
|
280
|
+
type: "IfStatement";
|
|
281
|
+
test: Expression;
|
|
282
|
+
consequent: Statement;
|
|
283
|
+
alternate?: Statement | null | undefined;
|
|
284
|
+
}
|
|
285
|
+
interface LabeledStatement extends BaseStatement {
|
|
286
|
+
type: "LabeledStatement";
|
|
287
|
+
label: Identifier;
|
|
288
|
+
body: Statement;
|
|
289
|
+
}
|
|
290
|
+
interface BreakStatement extends BaseStatement {
|
|
291
|
+
type: "BreakStatement";
|
|
292
|
+
label?: Identifier | null | undefined;
|
|
293
|
+
}
|
|
294
|
+
interface ContinueStatement extends BaseStatement {
|
|
295
|
+
type: "ContinueStatement";
|
|
296
|
+
label?: Identifier | null | undefined;
|
|
297
|
+
}
|
|
298
|
+
interface WithStatement extends BaseStatement {
|
|
299
|
+
type: "WithStatement";
|
|
300
|
+
object: Expression;
|
|
301
|
+
body: Statement;
|
|
302
|
+
}
|
|
303
|
+
interface SwitchStatement extends BaseStatement {
|
|
304
|
+
type: "SwitchStatement";
|
|
305
|
+
discriminant: Expression;
|
|
306
|
+
cases: SwitchCase[];
|
|
307
|
+
}
|
|
308
|
+
interface ReturnStatement extends BaseStatement {
|
|
309
|
+
type: "ReturnStatement";
|
|
310
|
+
argument?: Expression | null | undefined;
|
|
311
|
+
}
|
|
312
|
+
interface ThrowStatement extends BaseStatement {
|
|
313
|
+
type: "ThrowStatement";
|
|
314
|
+
argument: Expression;
|
|
315
|
+
}
|
|
316
|
+
interface TryStatement extends BaseStatement {
|
|
317
|
+
type: "TryStatement";
|
|
318
|
+
block: BlockStatement;
|
|
319
|
+
handler?: CatchClause | null | undefined;
|
|
320
|
+
finalizer?: BlockStatement | null | undefined;
|
|
321
|
+
}
|
|
322
|
+
interface WhileStatement extends BaseStatement {
|
|
323
|
+
type: "WhileStatement";
|
|
324
|
+
test: Expression;
|
|
325
|
+
body: Statement;
|
|
326
|
+
}
|
|
327
|
+
interface DoWhileStatement extends BaseStatement {
|
|
328
|
+
type: "DoWhileStatement";
|
|
329
|
+
body: Statement;
|
|
330
|
+
test: Expression;
|
|
331
|
+
}
|
|
332
|
+
interface ForStatement extends BaseStatement {
|
|
333
|
+
type: "ForStatement";
|
|
334
|
+
init?: VariableDeclaration | Expression | null | undefined;
|
|
335
|
+
test?: Expression | null | undefined;
|
|
336
|
+
update?: Expression | null | undefined;
|
|
337
|
+
body: Statement;
|
|
338
|
+
}
|
|
339
|
+
interface BaseForXStatement extends BaseStatement {
|
|
340
|
+
left: VariableDeclaration | Pattern;
|
|
341
|
+
right: Expression;
|
|
342
|
+
body: Statement;
|
|
343
|
+
}
|
|
344
|
+
interface ForInStatement extends BaseForXStatement {
|
|
345
|
+
type: "ForInStatement";
|
|
346
|
+
}
|
|
347
|
+
interface DebuggerStatement extends BaseStatement {
|
|
348
|
+
type: "DebuggerStatement";
|
|
349
|
+
}
|
|
350
|
+
type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
|
351
|
+
interface BaseDeclaration extends BaseStatement {}
|
|
352
|
+
interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
353
|
+
type: "FunctionDeclaration";
|
|
354
|
+
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
355
|
+
id: Identifier | null;
|
|
356
|
+
body: BlockStatement;
|
|
357
|
+
}
|
|
358
|
+
interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
|
359
|
+
id: Identifier;
|
|
360
|
+
}
|
|
361
|
+
interface VariableDeclaration extends BaseDeclaration {
|
|
362
|
+
type: "VariableDeclaration";
|
|
363
|
+
declarations: VariableDeclarator[];
|
|
364
|
+
kind: "var" | "let" | "const" | "using" | "await using";
|
|
365
|
+
}
|
|
366
|
+
interface VariableDeclarator extends BaseNode {
|
|
367
|
+
type: "VariableDeclarator";
|
|
368
|
+
id: Pattern;
|
|
369
|
+
init?: Expression | null | undefined;
|
|
370
|
+
}
|
|
371
|
+
interface ExpressionMap {
|
|
372
|
+
ArrayExpression: ArrayExpression;
|
|
373
|
+
ArrowFunctionExpression: ArrowFunctionExpression;
|
|
374
|
+
AssignmentExpression: AssignmentExpression;
|
|
375
|
+
AwaitExpression: AwaitExpression;
|
|
376
|
+
BinaryExpression: BinaryExpression;
|
|
377
|
+
CallExpression: CallExpression;
|
|
378
|
+
ChainExpression: ChainExpression;
|
|
379
|
+
ClassExpression: ClassExpression;
|
|
380
|
+
ConditionalExpression: ConditionalExpression;
|
|
381
|
+
FunctionExpression: FunctionExpression;
|
|
382
|
+
Identifier: Identifier;
|
|
383
|
+
ImportExpression: ImportExpression;
|
|
384
|
+
Literal: Literal;
|
|
385
|
+
LogicalExpression: LogicalExpression;
|
|
386
|
+
MemberExpression: MemberExpression;
|
|
387
|
+
MetaProperty: MetaProperty;
|
|
388
|
+
NewExpression: NewExpression;
|
|
389
|
+
ObjectExpression: ObjectExpression;
|
|
390
|
+
SequenceExpression: SequenceExpression;
|
|
391
|
+
TaggedTemplateExpression: TaggedTemplateExpression;
|
|
392
|
+
TemplateLiteral: TemplateLiteral;
|
|
393
|
+
ThisExpression: ThisExpression;
|
|
394
|
+
UnaryExpression: UnaryExpression;
|
|
395
|
+
UpdateExpression: UpdateExpression;
|
|
396
|
+
YieldExpression: YieldExpression;
|
|
397
|
+
}
|
|
398
|
+
type Expression = ExpressionMap[keyof ExpressionMap];
|
|
399
|
+
interface BaseExpression extends BaseNode {}
|
|
400
|
+
type ChainElement = SimpleCallExpression | MemberExpression;
|
|
401
|
+
interface ChainExpression extends BaseExpression {
|
|
402
|
+
type: "ChainExpression";
|
|
403
|
+
expression: ChainElement;
|
|
404
|
+
}
|
|
405
|
+
interface ThisExpression extends BaseExpression {
|
|
406
|
+
type: "ThisExpression";
|
|
407
|
+
}
|
|
408
|
+
interface ArrayExpression extends BaseExpression {
|
|
409
|
+
type: "ArrayExpression";
|
|
410
|
+
elements: Array<Expression | SpreadElement | null>;
|
|
411
|
+
}
|
|
412
|
+
interface ObjectExpression extends BaseExpression {
|
|
413
|
+
type: "ObjectExpression";
|
|
414
|
+
properties: Array<Property | SpreadElement>;
|
|
415
|
+
}
|
|
416
|
+
interface PrivateIdentifier extends BaseNode {
|
|
417
|
+
type: "PrivateIdentifier";
|
|
418
|
+
name: string;
|
|
419
|
+
}
|
|
420
|
+
interface Property extends BaseNode {
|
|
421
|
+
type: "Property";
|
|
422
|
+
key: Expression | PrivateIdentifier;
|
|
423
|
+
value: Expression | Pattern; // Could be an AssignmentProperty
|
|
424
|
+
kind: "init" | "get" | "set";
|
|
425
|
+
method: boolean;
|
|
426
|
+
shorthand: boolean;
|
|
427
|
+
computed: boolean;
|
|
428
|
+
}
|
|
429
|
+
interface PropertyDefinition extends BaseNode {
|
|
430
|
+
type: "PropertyDefinition";
|
|
431
|
+
key: Expression | PrivateIdentifier;
|
|
432
|
+
value?: Expression | null | undefined;
|
|
433
|
+
computed: boolean;
|
|
434
|
+
static: boolean;
|
|
435
|
+
}
|
|
436
|
+
interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
437
|
+
id?: Identifier | null | undefined;
|
|
438
|
+
type: "FunctionExpression";
|
|
439
|
+
body: BlockStatement;
|
|
440
|
+
}
|
|
441
|
+
interface SequenceExpression extends BaseExpression {
|
|
442
|
+
type: "SequenceExpression";
|
|
443
|
+
expressions: Expression[];
|
|
444
|
+
}
|
|
445
|
+
interface UnaryExpression extends BaseExpression {
|
|
446
|
+
type: "UnaryExpression";
|
|
447
|
+
operator: UnaryOperator;
|
|
448
|
+
prefix: true;
|
|
449
|
+
argument: Expression;
|
|
450
|
+
}
|
|
451
|
+
interface BinaryExpression extends BaseExpression {
|
|
452
|
+
type: "BinaryExpression";
|
|
453
|
+
operator: BinaryOperator;
|
|
454
|
+
left: Expression | PrivateIdentifier;
|
|
455
|
+
right: Expression;
|
|
456
|
+
}
|
|
457
|
+
interface AssignmentExpression extends BaseExpression {
|
|
458
|
+
type: "AssignmentExpression";
|
|
459
|
+
operator: AssignmentOperator;
|
|
460
|
+
left: Pattern | MemberExpression;
|
|
461
|
+
right: Expression;
|
|
462
|
+
}
|
|
463
|
+
interface UpdateExpression extends BaseExpression {
|
|
464
|
+
type: "UpdateExpression";
|
|
465
|
+
operator: UpdateOperator;
|
|
466
|
+
argument: Expression;
|
|
467
|
+
prefix: boolean;
|
|
468
|
+
}
|
|
469
|
+
interface LogicalExpression extends BaseExpression {
|
|
470
|
+
type: "LogicalExpression";
|
|
471
|
+
operator: LogicalOperator;
|
|
472
|
+
left: Expression;
|
|
473
|
+
right: Expression;
|
|
474
|
+
}
|
|
475
|
+
interface ConditionalExpression extends BaseExpression {
|
|
476
|
+
type: "ConditionalExpression";
|
|
477
|
+
test: Expression;
|
|
478
|
+
alternate: Expression;
|
|
479
|
+
consequent: Expression;
|
|
480
|
+
}
|
|
481
|
+
interface BaseCallExpression extends BaseExpression {
|
|
482
|
+
callee: Expression | Super;
|
|
483
|
+
arguments: Array<Expression | SpreadElement>;
|
|
484
|
+
}
|
|
485
|
+
type CallExpression = SimpleCallExpression | NewExpression;
|
|
486
|
+
interface SimpleCallExpression extends BaseCallExpression {
|
|
487
|
+
type: "CallExpression";
|
|
488
|
+
optional: boolean;
|
|
489
|
+
}
|
|
490
|
+
interface NewExpression extends BaseCallExpression {
|
|
491
|
+
type: "NewExpression";
|
|
492
|
+
}
|
|
493
|
+
interface MemberExpression extends BaseExpression, BasePattern {
|
|
494
|
+
type: "MemberExpression";
|
|
495
|
+
object: Expression | Super;
|
|
496
|
+
property: Expression | PrivateIdentifier;
|
|
497
|
+
computed: boolean;
|
|
498
|
+
optional: boolean;
|
|
499
|
+
}
|
|
500
|
+
type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
501
|
+
interface BasePattern extends BaseNode {}
|
|
502
|
+
interface SwitchCase extends BaseNode {
|
|
503
|
+
type: "SwitchCase";
|
|
504
|
+
test?: Expression | null | undefined;
|
|
505
|
+
consequent: Statement[];
|
|
506
|
+
}
|
|
507
|
+
interface CatchClause extends BaseNode {
|
|
508
|
+
type: "CatchClause";
|
|
509
|
+
param: Pattern | null;
|
|
510
|
+
body: BlockStatement;
|
|
511
|
+
}
|
|
512
|
+
interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
|
513
|
+
type: "Identifier";
|
|
514
|
+
name: string;
|
|
515
|
+
}
|
|
516
|
+
type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
517
|
+
interface SimpleLiteral extends BaseNode, BaseExpression {
|
|
518
|
+
type: "Literal";
|
|
519
|
+
value: string | boolean | number | null;
|
|
520
|
+
raw?: string | undefined;
|
|
521
|
+
}
|
|
522
|
+
interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
523
|
+
type: "Literal";
|
|
524
|
+
value?: RegExp | null | undefined;
|
|
525
|
+
regex: {
|
|
526
|
+
pattern: string;
|
|
527
|
+
flags: string;
|
|
528
|
+
};
|
|
529
|
+
raw?: string | undefined;
|
|
530
|
+
}
|
|
531
|
+
interface BigIntLiteral extends BaseNode, BaseExpression {
|
|
532
|
+
type: "Literal";
|
|
533
|
+
value?: bigint | null | undefined;
|
|
534
|
+
bigint: string;
|
|
535
|
+
raw?: string | undefined;
|
|
536
|
+
}
|
|
537
|
+
type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
538
|
+
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
|
539
|
+
type LogicalOperator = "||" | "&&" | "??";
|
|
540
|
+
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
541
|
+
type UpdateOperator = "++" | "--";
|
|
542
|
+
interface ForOfStatement extends BaseForXStatement {
|
|
543
|
+
type: "ForOfStatement";
|
|
544
|
+
await: boolean;
|
|
545
|
+
}
|
|
546
|
+
interface Super extends BaseNode {
|
|
547
|
+
type: "Super";
|
|
548
|
+
}
|
|
549
|
+
interface SpreadElement extends BaseNode {
|
|
550
|
+
type: "SpreadElement";
|
|
551
|
+
argument: Expression;
|
|
552
|
+
}
|
|
553
|
+
interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
|
554
|
+
type: "ArrowFunctionExpression";
|
|
555
|
+
expression: boolean;
|
|
556
|
+
body: BlockStatement | Expression;
|
|
557
|
+
}
|
|
558
|
+
interface YieldExpression extends BaseExpression {
|
|
559
|
+
type: "YieldExpression";
|
|
560
|
+
argument?: Expression | null | undefined;
|
|
561
|
+
delegate: boolean;
|
|
562
|
+
}
|
|
563
|
+
interface TemplateLiteral extends BaseExpression {
|
|
564
|
+
type: "TemplateLiteral";
|
|
565
|
+
quasis: TemplateElement[];
|
|
566
|
+
expressions: Expression[];
|
|
567
|
+
}
|
|
568
|
+
interface TaggedTemplateExpression extends BaseExpression {
|
|
569
|
+
type: "TaggedTemplateExpression";
|
|
570
|
+
tag: Expression;
|
|
571
|
+
quasi: TemplateLiteral;
|
|
572
|
+
}
|
|
573
|
+
interface TemplateElement extends BaseNode {
|
|
574
|
+
type: "TemplateElement";
|
|
575
|
+
tail: boolean;
|
|
576
|
+
value: {
|
|
577
|
+
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */cooked?: string | null | undefined;
|
|
578
|
+
raw: string;
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
interface AssignmentProperty extends Property {
|
|
582
|
+
value: Pattern;
|
|
583
|
+
kind: "init";
|
|
584
|
+
method: boolean; // false
|
|
585
|
+
}
|
|
586
|
+
interface ObjectPattern extends BasePattern {
|
|
587
|
+
type: "ObjectPattern";
|
|
588
|
+
properties: Array<AssignmentProperty | RestElement>;
|
|
589
|
+
}
|
|
590
|
+
interface ArrayPattern extends BasePattern {
|
|
591
|
+
type: "ArrayPattern";
|
|
592
|
+
elements: Array<Pattern | null>;
|
|
593
|
+
}
|
|
594
|
+
interface RestElement extends BasePattern {
|
|
595
|
+
type: "RestElement";
|
|
596
|
+
argument: Pattern;
|
|
597
|
+
}
|
|
598
|
+
interface AssignmentPattern extends BasePattern {
|
|
599
|
+
type: "AssignmentPattern";
|
|
600
|
+
left: Pattern;
|
|
601
|
+
right: Expression;
|
|
602
|
+
}
|
|
603
|
+
interface BaseClass extends BaseNode {
|
|
604
|
+
superClass?: Expression | null | undefined;
|
|
605
|
+
body: ClassBody;
|
|
606
|
+
}
|
|
607
|
+
interface ClassBody extends BaseNode {
|
|
608
|
+
type: "ClassBody";
|
|
609
|
+
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
|
610
|
+
}
|
|
611
|
+
interface MethodDefinition extends BaseNode {
|
|
612
|
+
type: "MethodDefinition";
|
|
613
|
+
key: Expression | PrivateIdentifier;
|
|
614
|
+
value: FunctionExpression;
|
|
615
|
+
kind: "constructor" | "method" | "get" | "set";
|
|
616
|
+
computed: boolean;
|
|
617
|
+
static: boolean;
|
|
618
|
+
}
|
|
619
|
+
interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
|
620
|
+
type: "ClassDeclaration";
|
|
621
|
+
/** It is null when a class declaration is a part of the `export default class` statement */
|
|
622
|
+
id: Identifier | null;
|
|
623
|
+
}
|
|
624
|
+
interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
|
625
|
+
id: Identifier;
|
|
626
|
+
}
|
|
627
|
+
interface ClassExpression extends BaseClass, BaseExpression {
|
|
628
|
+
type: "ClassExpression";
|
|
629
|
+
id?: Identifier | null | undefined;
|
|
630
|
+
}
|
|
631
|
+
interface MetaProperty extends BaseExpression {
|
|
632
|
+
type: "MetaProperty";
|
|
633
|
+
meta: Identifier;
|
|
634
|
+
property: Identifier;
|
|
635
|
+
}
|
|
636
|
+
interface ImportExpression extends BaseExpression {
|
|
637
|
+
type: "ImportExpression";
|
|
638
|
+
source: Expression;
|
|
639
|
+
options?: Expression | null | undefined;
|
|
640
|
+
}
|
|
641
|
+
interface AwaitExpression extends BaseExpression {
|
|
642
|
+
type: "AwaitExpression";
|
|
643
|
+
argument: Expression;
|
|
644
|
+
}
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region ../../node_modules/.pnpm/rollup@4.59.0/node_modules/rollup/dist/rollup.d.ts
|
|
647
|
+
declare module 'estree' {
|
|
648
|
+
export interface Decorator extends BaseNode {
|
|
649
|
+
type: 'Decorator';
|
|
650
|
+
expression: Expression;
|
|
651
|
+
}
|
|
652
|
+
interface PropertyDefinition {
|
|
653
|
+
decorators: undefined[];
|
|
654
|
+
}
|
|
655
|
+
interface MethodDefinition {
|
|
656
|
+
decorators: undefined[];
|
|
657
|
+
}
|
|
658
|
+
interface BaseClass {
|
|
659
|
+
decorators: undefined[];
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
// declare AbortSignal here for environments without DOM lib or @types/node
|
|
663
|
+
declare global {
|
|
664
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
665
|
+
interface AbortSignal {}
|
|
666
|
+
}
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region ../../node_modules/.pnpm/unplugin-vue-components@31.0.0_vue@3.5.29_typescript@5.9.3_/node_modules/unplugin-vue-components/dist/types-CWfK8m_y.d.mts
|
|
669
|
+
//#region node_modules/.pnpm/@antfu+utils@9.3.0/node_modules/@antfu/utils/dist/index.d.mts
|
|
670
|
+
/**
|
|
671
|
+
* Promise, or maybe not
|
|
672
|
+
*/
|
|
673
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
674
|
+
/**
|
|
675
|
+
* Null or whatever
|
|
676
|
+
*/
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/types.d.ts
|
|
679
|
+
interface ImportInfo {
|
|
680
|
+
as?: string;
|
|
681
|
+
name?: string;
|
|
682
|
+
from: string;
|
|
683
|
+
}
|
|
684
|
+
type SideEffectsInfo = (ImportInfo | string)[] | ImportInfo | string | undefined;
|
|
685
|
+
interface ComponentInfo extends ImportInfo {
|
|
686
|
+
sideEffects?: SideEffectsInfo;
|
|
687
|
+
}
|
|
688
|
+
type ComponentResolveResult = Awaitable<string | ComponentInfo | null | undefined | void>;
|
|
689
|
+
type ComponentResolverFunction = (name: string) => ComponentResolveResult;
|
|
690
|
+
interface ComponentResolverObject {
|
|
691
|
+
type: 'component' | 'directive';
|
|
692
|
+
resolve: ComponentResolverFunction;
|
|
693
|
+
}
|
|
694
|
+
type ComponentResolver = ComponentResolverFunction | ComponentResolverObject;
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region ../../node_modules/.pnpm/@vue+shared@3.5.29/node_modules/@vue/shared/dist/shared.d.ts
|
|
697
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
698
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
699
|
+
type LooseRequired<T> = { [P in keyof (T & Required<T>)]: T[P] };
|
|
700
|
+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region ../../node_modules/.pnpm/@vue+reactivity@3.5.29/node_modules/@vue/reactivity/dist/reactivity.d.ts
|
|
703
|
+
declare enum TrackOpTypes {
|
|
704
|
+
GET = "get",
|
|
705
|
+
HAS = "has",
|
|
706
|
+
ITERATE = "iterate"
|
|
707
|
+
}
|
|
708
|
+
declare enum TriggerOpTypes {
|
|
709
|
+
SET = "set",
|
|
710
|
+
ADD = "add",
|
|
711
|
+
DELETE = "delete",
|
|
712
|
+
CLEAR = "clear"
|
|
713
|
+
}
|
|
714
|
+
type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
|
715
|
+
declare const ShallowReactiveMarker: unique symbol;
|
|
716
|
+
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
717
|
+
type Builtin = Primitive | Function | Date | Error | RegExp;
|
|
718
|
+
type EffectScheduler = (...args: any[]) => any;
|
|
719
|
+
type DebuggerEvent = {
|
|
720
|
+
effect: Subscriber;
|
|
721
|
+
} & DebuggerEventExtraInfo;
|
|
722
|
+
type DebuggerEventExtraInfo = {
|
|
723
|
+
target: object;
|
|
724
|
+
type: TrackOpTypes | TriggerOpTypes;
|
|
725
|
+
key: any;
|
|
726
|
+
newValue?: any;
|
|
727
|
+
oldValue?: any;
|
|
728
|
+
oldTarget?: Map<any, any> | Set<any>;
|
|
729
|
+
};
|
|
730
|
+
interface DebuggerOptions {
|
|
731
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
732
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
733
|
+
}
|
|
734
|
+
interface ReactiveEffectOptions extends DebuggerOptions {
|
|
735
|
+
scheduler?: EffectScheduler;
|
|
736
|
+
allowRecurse?: boolean;
|
|
737
|
+
onStop?: () => void;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Subscriber is a type that tracks (or subscribes to) a list of deps.
|
|
741
|
+
*/
|
|
742
|
+
interface Subscriber extends DebuggerOptions {}
|
|
743
|
+
declare class ReactiveEffect<T = any> implements Subscriber, ReactiveEffectOptions {
|
|
744
|
+
fn: () => T;
|
|
745
|
+
scheduler?: EffectScheduler;
|
|
746
|
+
onStop?: () => void;
|
|
747
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
748
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
749
|
+
constructor(fn: () => T);
|
|
750
|
+
pause(): void;
|
|
751
|
+
resume(): void;
|
|
752
|
+
run(): T;
|
|
753
|
+
stop(): void;
|
|
754
|
+
trigger(): void;
|
|
755
|
+
get dirty(): boolean;
|
|
756
|
+
}
|
|
757
|
+
type ComputedGetter<T> = (oldValue?: T) => T;
|
|
758
|
+
type ComputedSetter<T> = (newValue: T) => void;
|
|
759
|
+
interface WritableComputedOptions<T, S = T> {
|
|
760
|
+
get: ComputedGetter<T>;
|
|
761
|
+
set: ComputedSetter<S>;
|
|
762
|
+
}
|
|
763
|
+
declare const RefSymbol: unique symbol;
|
|
764
|
+
declare const RawSymbol: unique symbol;
|
|
765
|
+
interface Ref<T = any, S = T> {
|
|
766
|
+
get value(): T;
|
|
767
|
+
set value(_: S);
|
|
768
|
+
/**
|
|
769
|
+
* Type differentiator only.
|
|
770
|
+
* We need this to be in public d.ts but don't want it to show up in IDE
|
|
771
|
+
* autocomplete, so we use a private Symbol instead.
|
|
772
|
+
*/
|
|
773
|
+
[RefSymbol]: true;
|
|
774
|
+
}
|
|
775
|
+
declare const ShallowRefMarker: unique symbol;
|
|
776
|
+
type ShallowRef<T = any, S = T> = Ref<T, S> & {
|
|
777
|
+
[ShallowRefMarker]?: true;
|
|
778
|
+
};
|
|
779
|
+
/**
|
|
780
|
+
* This is a special exported interface for other packages to declare
|
|
781
|
+
* additional types that should bail out for ref unwrapping. For example
|
|
782
|
+
* \@vue/runtime-dom can declare it like so in its d.ts:
|
|
783
|
+
*
|
|
784
|
+
* ``` ts
|
|
785
|
+
* declare module '@vue/reactivity' {
|
|
786
|
+
* export interface RefUnwrapBailTypes {
|
|
787
|
+
* runtimeDOMBailTypes: Node | Window
|
|
788
|
+
* }
|
|
789
|
+
* }
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
interface RefUnwrapBailTypes {}
|
|
793
|
+
type ShallowUnwrapRef<T> = { [K in keyof T]: DistributeRef<T[K]> };
|
|
794
|
+
type DistributeRef<T> = T extends Ref<infer V, unknown> ? V : T;
|
|
795
|
+
type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V : T extends Ref<infer V, unknown> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
796
|
+
type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
797
|
+
[RawSymbol]?: true;
|
|
798
|
+
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? { [K in keyof T]: UnwrapRefSimple<T[K]> } : T extends object & {
|
|
799
|
+
[ShallowReactiveMarker]?: never;
|
|
800
|
+
} ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]> } : T;
|
|
801
|
+
type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
|
|
802
|
+
type OnCleanup = (cleanupFn: () => void) => void;
|
|
803
|
+
type WatchStopHandle = () => void;
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.29/node_modules/@vue/runtime-core/dist/runtime-core.d.ts
|
|
806
|
+
type Slot<T extends any = any> = (...args: IfAny<T, any[], [T] | (T extends undefined ? [] : never)>) => VNode[];
|
|
807
|
+
type InternalSlots = {
|
|
808
|
+
[name: string]: Slot | undefined;
|
|
809
|
+
};
|
|
810
|
+
type Slots = Readonly<InternalSlots>;
|
|
811
|
+
declare const SlotSymbol: unique symbol;
|
|
812
|
+
type SlotsType<T extends Record<string, any> = Record<string, any>> = {
|
|
813
|
+
[SlotSymbol]?: T;
|
|
814
|
+
};
|
|
815
|
+
type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T;
|
|
816
|
+
type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{ [K in keyof T]: NonNullable<T[K]> extends ((...args: any[]) => any) ? T[K] : Slot<T[K]> }>>;
|
|
817
|
+
type RawSlots = {
|
|
818
|
+
[name: string]: unknown;
|
|
819
|
+
$stable?: boolean;
|
|
820
|
+
};
|
|
821
|
+
declare enum SchedulerJobFlags {
|
|
822
|
+
QUEUED = 1,
|
|
823
|
+
PRE = 2,
|
|
824
|
+
/**
|
|
825
|
+
* Indicates whether the effect is allowed to recursively trigger itself
|
|
826
|
+
* when managed by the scheduler.
|
|
827
|
+
*
|
|
828
|
+
* By default, a job cannot trigger itself because some built-in method calls,
|
|
829
|
+
* e.g. Array.prototype.push actually performs reads as well (#1740) which
|
|
830
|
+
* can lead to confusing infinite loops.
|
|
831
|
+
* The allowed cases are component update functions and watch callbacks.
|
|
832
|
+
* Component update functions may update child component props, which in turn
|
|
833
|
+
* trigger flush: "pre" watch callbacks that mutates state that the parent
|
|
834
|
+
* relies on (#1801). Watch callbacks doesn't track its dependencies so if it
|
|
835
|
+
* triggers itself again, it's likely intentional and it is the user's
|
|
836
|
+
* responsibility to perform recursive state mutation that eventually
|
|
837
|
+
* stabilizes (#1727).
|
|
838
|
+
*/
|
|
839
|
+
ALLOW_RECURSE = 4,
|
|
840
|
+
DISPOSED = 8
|
|
841
|
+
}
|
|
842
|
+
interface SchedulerJob extends Function {
|
|
843
|
+
id?: number;
|
|
844
|
+
/**
|
|
845
|
+
* flags can technically be undefined, but it can still be used in bitwise
|
|
846
|
+
* operations just like 0.
|
|
847
|
+
*/
|
|
848
|
+
flags?: SchedulerJobFlags;
|
|
849
|
+
/**
|
|
850
|
+
* Attached by renderer.ts when setting up a component's render effect
|
|
851
|
+
* Used to obtain component information when reporting max recursive updates.
|
|
852
|
+
*/
|
|
853
|
+
i?: ComponentInternalInstance;
|
|
854
|
+
}
|
|
855
|
+
declare function nextTick(): Promise<void>;
|
|
856
|
+
declare function nextTick<T, R>(this: T, fn: (this: T) => R | Promise<R>): Promise<R>;
|
|
857
|
+
type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
|
|
858
|
+
type ComponentObjectPropsOptions<P = Data> = { [K in keyof P]: Prop<P[K]> | null };
|
|
859
|
+
type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
860
|
+
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
861
|
+
interface PropOptions<T = any, D = T> {
|
|
862
|
+
type?: PropType<T> | true | null;
|
|
863
|
+
required?: boolean;
|
|
864
|
+
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
865
|
+
validator?(value: unknown, props: Data): boolean;
|
|
866
|
+
}
|
|
867
|
+
type PropType<T> = PropConstructor<T> | (PropConstructor<T> | null)[];
|
|
868
|
+
type PropConstructor<T = any> = {
|
|
869
|
+
new (...args: any[]): T & {};
|
|
870
|
+
} | {
|
|
871
|
+
(): T;
|
|
872
|
+
} | PropMethod<T>;
|
|
873
|
+
type PropMethod<T, TConstructor = any> = [T] extends [((...args: any) => any) | undefined] ? {
|
|
874
|
+
new (): TConstructor;
|
|
875
|
+
(): T;
|
|
876
|
+
readonly prototype: TConstructor;
|
|
877
|
+
} : never;
|
|
878
|
+
type RequiredKeys<T> = { [K in keyof T]: T[K] extends {
|
|
879
|
+
required: true;
|
|
880
|
+
} | {
|
|
881
|
+
default: any;
|
|
882
|
+
} | BooleanConstructor | {
|
|
883
|
+
type: BooleanConstructor;
|
|
884
|
+
} ? T[K] extends {
|
|
885
|
+
default: undefined | (() => undefined);
|
|
886
|
+
} ? never : K : never }[keyof T];
|
|
887
|
+
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
888
|
+
type DefaultKeys<T> = { [K in keyof T]: T[K] extends {
|
|
889
|
+
default: any;
|
|
890
|
+
} | BooleanConstructor | {
|
|
891
|
+
type: BooleanConstructor;
|
|
892
|
+
} ? T[K] extends {
|
|
893
|
+
type: BooleanConstructor;
|
|
894
|
+
required: true;
|
|
895
|
+
} ? never : K : never }[keyof T];
|
|
896
|
+
type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends true ? any : null : [T] extends [{
|
|
897
|
+
type: null | true;
|
|
898
|
+
}] ? any : [T] extends [ObjectConstructor | {
|
|
899
|
+
type: ObjectConstructor;
|
|
900
|
+
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
901
|
+
type: BooleanConstructor;
|
|
902
|
+
}] ? boolean : [T] extends [DateConstructor | {
|
|
903
|
+
type: DateConstructor;
|
|
904
|
+
}] ? Date : [T] extends [(infer U)[] | {
|
|
905
|
+
type: (infer U)[];
|
|
906
|
+
}] ? U extends DateConstructor ? Date | InferPropType<U, false> : InferPropType<U, false> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? IfAny<V, V, D> : V : V : T;
|
|
907
|
+
/**
|
|
908
|
+
* Extract prop types from a runtime props options object.
|
|
909
|
+
* The extracted types are **internal** - i.e. the resolved props received by
|
|
910
|
+
* the component.
|
|
911
|
+
* - Boolean props are always present
|
|
912
|
+
* - Props with default values are always present
|
|
913
|
+
*
|
|
914
|
+
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
|
|
915
|
+
*/
|
|
916
|
+
type ExtractPropTypes<O> = { [K in keyof Pick<O, RequiredKeys<O>>]: O[K] extends {
|
|
917
|
+
default: any;
|
|
918
|
+
} ? Exclude<InferPropType<O[K]>, undefined> : InferPropType<O[K]> } & { [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]> };
|
|
919
|
+
type ExtractDefaultPropTypes<O> = O extends object ? { [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]> } : {};
|
|
920
|
+
/**
|
|
921
|
+
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
922
|
+
* expected argument is the same as the component `props` option.
|
|
923
|
+
*
|
|
924
|
+
* Example runtime declaration:
|
|
925
|
+
* ```js
|
|
926
|
+
* // using Array syntax
|
|
927
|
+
* const props = defineProps(['foo', 'bar'])
|
|
928
|
+
* // using Object syntax
|
|
929
|
+
* const props = defineProps({
|
|
930
|
+
* foo: String,
|
|
931
|
+
* bar: {
|
|
932
|
+
* type: Number,
|
|
933
|
+
* required: true
|
|
934
|
+
* }
|
|
935
|
+
* })
|
|
936
|
+
* ```
|
|
937
|
+
*
|
|
938
|
+
* Equivalent type-based declaration:
|
|
939
|
+
* ```ts
|
|
940
|
+
* // will be compiled into equivalent runtime declarations
|
|
941
|
+
* const props = defineProps<{
|
|
942
|
+
* foo?: string
|
|
943
|
+
* bar: number
|
|
944
|
+
* }>()
|
|
945
|
+
* ```
|
|
946
|
+
*
|
|
947
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
948
|
+
*
|
|
949
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
950
|
+
* output and should **not** be actually called at runtime.
|
|
951
|
+
*/
|
|
952
|
+
declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{ [key in PropNames]?: any }>>;
|
|
953
|
+
declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
|
|
954
|
+
declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
|
|
955
|
+
type DefineProps<T, BKeys extends keyof T> = Readonly<T> & { readonly [K in BKeys]-?: boolean };
|
|
956
|
+
type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? T[K] extends boolean | undefined ? T[K] extends never | undefined ? never : K : never : never;
|
|
957
|
+
/**
|
|
958
|
+
* Vue `<script setup>` compiler macro for declaring a component's emitted
|
|
959
|
+
* events. The expected argument is the same as the component `emits` option.
|
|
960
|
+
*
|
|
961
|
+
* Example runtime declaration:
|
|
962
|
+
* ```js
|
|
963
|
+
* const emit = defineEmits(['change', 'update'])
|
|
964
|
+
* ```
|
|
965
|
+
*
|
|
966
|
+
* Example type-based declaration:
|
|
967
|
+
* ```ts
|
|
968
|
+
* const emit = defineEmits<{
|
|
969
|
+
* // <eventName>: <expected arguments>
|
|
970
|
+
* change: []
|
|
971
|
+
* update: [value: number] // named tuple syntax
|
|
972
|
+
* }>()
|
|
973
|
+
*
|
|
974
|
+
* emit('change')
|
|
975
|
+
* emit('update', 1)
|
|
976
|
+
* ```
|
|
977
|
+
*
|
|
978
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
979
|
+
* output and should **not** be actually called at runtime.
|
|
980
|
+
*
|
|
981
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
982
|
+
*/
|
|
983
|
+
declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
|
|
984
|
+
declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
|
|
985
|
+
declare function defineEmits<T extends ComponentTypeEmits>(): T extends ((...args: any[]) => any) ? T : ShortEmits<T>;
|
|
986
|
+
type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any>;
|
|
987
|
+
type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
988
|
+
type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{ [K in keyof T]: (evt: K, ...args: T[K]) => void }>>;
|
|
989
|
+
/**
|
|
990
|
+
* Vue `<script setup>` compiler macro for declaring a component's exposed
|
|
991
|
+
* instance properties when it is accessed by a parent component via template
|
|
992
|
+
* refs.
|
|
993
|
+
*
|
|
994
|
+
* `<script setup>` components are closed by default - i.e. variables inside
|
|
995
|
+
* the `<script setup>` scope is not exposed to parent unless explicitly exposed
|
|
996
|
+
* via `defineExpose`.
|
|
997
|
+
*
|
|
998
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
999
|
+
* output and should **not** be actually called at runtime.
|
|
1000
|
+
*
|
|
1001
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
|
|
1002
|
+
*/
|
|
1003
|
+
declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
1004
|
+
/**
|
|
1005
|
+
* Vue `<script setup>` compiler macro for declaring a component's additional
|
|
1006
|
+
* options. This should be used only for options that cannot be expressed via
|
|
1007
|
+
* Composition API - e.g. `inheritAttrs`.
|
|
1008
|
+
*
|
|
1009
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
|
|
1010
|
+
*/
|
|
1011
|
+
declare function defineOptions<RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: ComponentOptionsBase<{}, RawBindings, D, C, M, Mixin, Extends, {}> & {
|
|
1012
|
+
/**
|
|
1013
|
+
* props should be defined via defineProps().
|
|
1014
|
+
*/
|
|
1015
|
+
props?: never;
|
|
1016
|
+
/**
|
|
1017
|
+
* emits should be defined via defineEmits().
|
|
1018
|
+
*/
|
|
1019
|
+
emits?: never;
|
|
1020
|
+
/**
|
|
1021
|
+
* expose should be defined via defineExpose().
|
|
1022
|
+
*/
|
|
1023
|
+
expose?: never;
|
|
1024
|
+
/**
|
|
1025
|
+
* slots should be defined via defineSlots().
|
|
1026
|
+
*/
|
|
1027
|
+
slots?: never;
|
|
1028
|
+
}): void;
|
|
1029
|
+
declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
1030
|
+
type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [ModelRef<T, M, G, S>, Record<M, true | undefined>];
|
|
1031
|
+
type DefineModelOptions<T = any, G = T, S = T> = {
|
|
1032
|
+
get?: (v: T) => G;
|
|
1033
|
+
set?: (v: S) => any;
|
|
1034
|
+
};
|
|
1035
|
+
/**
|
|
1036
|
+
* Vue `<script setup>` compiler macro for declaring a
|
|
1037
|
+
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
1038
|
+
* component. This will declare a prop with the same name and a corresponding
|
|
1039
|
+
* `update:propName` event.
|
|
1040
|
+
*
|
|
1041
|
+
* If the first argument is a string, it will be used as the prop name;
|
|
1042
|
+
* Otherwise the prop name will default to "modelValue". In both cases, you
|
|
1043
|
+
* can also pass an additional object which will be used as the prop's options.
|
|
1044
|
+
*
|
|
1045
|
+
* The returned ref behaves differently depending on whether the parent
|
|
1046
|
+
* provided the corresponding v-model props or not:
|
|
1047
|
+
* - If yes, the returned ref's value will always be in sync with the parent
|
|
1048
|
+
* prop.
|
|
1049
|
+
* - If not, the returned ref will behave like a normal local ref.
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```ts
|
|
1053
|
+
* // default model (consumed via `v-model`)
|
|
1054
|
+
* const modelValue = defineModel<string>()
|
|
1055
|
+
* modelValue.value = "hello"
|
|
1056
|
+
*
|
|
1057
|
+
* // default model with options
|
|
1058
|
+
* const modelValue = defineModel<string>({ required: true })
|
|
1059
|
+
*
|
|
1060
|
+
* // with specified name (consumed via `v-model:count`)
|
|
1061
|
+
* const count = defineModel<number>('count')
|
|
1062
|
+
* count.value++
|
|
1063
|
+
*
|
|
1064
|
+
* // with specified name and default value
|
|
1065
|
+
* const count = defineModel<number>('count', { default: 0 })
|
|
1066
|
+
* ```
|
|
1067
|
+
*/
|
|
1068
|
+
declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options: ({
|
|
1069
|
+
default: any;
|
|
1070
|
+
} | {
|
|
1071
|
+
required: true;
|
|
1072
|
+
}) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
|
|
1073
|
+
declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
|
|
1074
|
+
declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options: ({
|
|
1075
|
+
default: any;
|
|
1076
|
+
} | {
|
|
1077
|
+
required: true;
|
|
1078
|
+
}) & PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T, M, G, S>;
|
|
1079
|
+
declare function defineModel<T, M extends PropertyKey = string, G = T, S = T>(name: string, options?: PropOptions<T> & DefineModelOptions<T, G, S>): ModelRef<T | undefined, M, G | undefined, S | undefined>;
|
|
1080
|
+
type NotUndefined<T> = T extends undefined ? never : T;
|
|
1081
|
+
type MappedOmit<T, K extends keyof any> = { [P in keyof T as P extends K ? never : P]: T[P] };
|
|
1082
|
+
type InferDefaults<T> = { [K in keyof T]?: InferDefault<T, T[K]> };
|
|
1083
|
+
type NativeType = null | undefined | number | string | boolean | symbol | Function;
|
|
1084
|
+
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
1085
|
+
type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = T extends unknown ? Readonly<MappedOmit<T, keyof Defaults>> & { readonly [K in keyof Defaults as K extends keyof T ? K : never]-?: K extends keyof T ? Defaults[K] extends undefined ? IfAny<Defaults[K], NotUndefined<T[K]>, T[K]> : NotUndefined<T[K]> : never } & { readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean } : never;
|
|
1086
|
+
/**
|
|
1087
|
+
* Vue `<script setup>` compiler macro for providing props default values when
|
|
1088
|
+
* using type-based `defineProps` declaration.
|
|
1089
|
+
*
|
|
1090
|
+
* Example usage:
|
|
1091
|
+
* ```ts
|
|
1092
|
+
* withDefaults(defineProps<{
|
|
1093
|
+
* size?: number
|
|
1094
|
+
* labels?: string[]
|
|
1095
|
+
* }>(), {
|
|
1096
|
+
* size: 3,
|
|
1097
|
+
* labels: () => ['default label']
|
|
1098
|
+
* })
|
|
1099
|
+
* ```
|
|
1100
|
+
*
|
|
1101
|
+
* This is only usable inside `<script setup>`, is compiled away in the output
|
|
1102
|
+
* and should **not** be actually called at runtime.
|
|
1103
|
+
*
|
|
1104
|
+
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
|
|
1105
|
+
*/
|
|
1106
|
+
declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
1107
|
+
type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
|
|
1108
|
+
type EmitsOptions = ObjectEmitsOptions | string[];
|
|
1109
|
+
type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? { [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any } : T extends ObjectEmitsOptions ? { [K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends ((...args: infer P) => any) ? P : T[K] extends null ? any[] : never) => any } : {};
|
|
1110
|
+
type ShortEmitsToObject<E> = E extends Record<string, any[]> ? { [K in keyof E]: (...args: E[K]) => any } : E;
|
|
1111
|
+
type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{ [key in Event]: Options[key] extends ((...args: infer Args) => any) ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void }[Event]>;
|
|
1112
|
+
/**
|
|
1113
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
1114
|
+
|
|
1115
|
+
const comp = resolveComponent('comp')
|
|
1116
|
+
const foo = resolveDirective('foo')
|
|
1117
|
+
const bar = resolveDirective('bar')
|
|
1118
|
+
|
|
1119
|
+
return withDirectives(h(comp), [
|
|
1120
|
+
[foo, this.x],
|
|
1121
|
+
[bar, this.y]
|
|
1122
|
+
])
|
|
1123
|
+
*/
|
|
1124
|
+
interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg = any> {
|
|
1125
|
+
instance: ComponentPublicInstance | Record<string, any> | null;
|
|
1126
|
+
value: Value;
|
|
1127
|
+
oldValue: Value | null;
|
|
1128
|
+
arg?: Arg;
|
|
1129
|
+
modifiers: DirectiveModifiers<Modifiers>;
|
|
1130
|
+
dir: ObjectDirective<any, Value, Modifiers, Arg>;
|
|
1131
|
+
}
|
|
1132
|
+
type DirectiveHook<HostElement = any, Prev = VNode<any, HostElement> | null, Value = any, Modifiers extends string = string, Arg = any> = (el: HostElement, binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode<any, HostElement>, prevVNode: Prev) => void;
|
|
1133
|
+
type SSRDirectiveHook<Value = any, Modifiers extends string = string, Arg = any> = (binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode) => Data | undefined;
|
|
1134
|
+
interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> {
|
|
1135
|
+
created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
1136
|
+
beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
1137
|
+
mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
1138
|
+
beforeUpdate?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
|
|
1139
|
+
updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
|
|
1140
|
+
beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
1141
|
+
unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
1142
|
+
getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>;
|
|
1143
|
+
deep?: boolean;
|
|
1144
|
+
}
|
|
1145
|
+
type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg = any> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
|
|
1146
|
+
type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>;
|
|
1147
|
+
type DirectiveModifiers<K extends string = string> = Partial<Record<K, boolean>>;
|
|
1148
|
+
/**
|
|
1149
|
+
* Custom properties added to component instances in any way and can be accessed through `this`
|
|
1150
|
+
*
|
|
1151
|
+
* @example
|
|
1152
|
+
* Here is an example of adding a property `$router` to every component instance:
|
|
1153
|
+
* ```ts
|
|
1154
|
+
* import { createApp } from 'vue'
|
|
1155
|
+
* import { Router, createRouter } from 'vue-router'
|
|
1156
|
+
*
|
|
1157
|
+
* declare module 'vue' {
|
|
1158
|
+
* interface ComponentCustomProperties {
|
|
1159
|
+
* $router: Router
|
|
1160
|
+
* }
|
|
1161
|
+
* }
|
|
1162
|
+
*
|
|
1163
|
+
* // effectively adding the router to every component instance
|
|
1164
|
+
* const app = createApp({})
|
|
1165
|
+
* const router = createRouter()
|
|
1166
|
+
* app.config.globalProperties.$router = router
|
|
1167
|
+
*
|
|
1168
|
+
* const vm = app.mount('#app')
|
|
1169
|
+
* // we can access the router from the instance
|
|
1170
|
+
* vm.$router.push('/')
|
|
1171
|
+
* ```
|
|
1172
|
+
*/
|
|
1173
|
+
interface ComponentCustomProperties {}
|
|
1174
|
+
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
|
|
1175
|
+
type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any, any, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never;
|
|
1176
|
+
type ExtractMixin<T> = {
|
|
1177
|
+
Mixin: MixinToOptionTypes<T>;
|
|
1178
|
+
}[T extends ComponentOptionsMixin ? 'Mixin' : never];
|
|
1179
|
+
type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true ? OptionTypesType : UnionToIntersection<ExtractMixin<T>>;
|
|
1180
|
+
type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
|
|
1181
|
+
type EnsureNonVoid<T> = T extends void ? {} : T;
|
|
1182
|
+
type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
|
|
1183
|
+
__isFragment?: never;
|
|
1184
|
+
__isTeleport?: never;
|
|
1185
|
+
__isSuspense?: never;
|
|
1186
|
+
new (...args: any[]): T;
|
|
1187
|
+
};
|
|
1188
|
+
/**
|
|
1189
|
+
* @deprecated This is no longer used internally, but exported and relied on by
|
|
1190
|
+
* existing library types generated by vue-tsc.
|
|
1191
|
+
*/
|
|
1192
|
+
/**
|
|
1193
|
+
* This is the same as `CreateComponentPublicInstance` but adds local components,
|
|
1194
|
+
* global directives, exposed, and provide inference.
|
|
1195
|
+
* It changes the arguments order so that we don't need to repeat mixin
|
|
1196
|
+
* inference everywhere internally, but it has to be a new type to avoid
|
|
1197
|
+
* breaking types that relies on previous arguments order (#10842)
|
|
1198
|
+
*/
|
|
1199
|
+
type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, TypeRefs extends Data = {}, TypeEl extends Element = any, Provide extends ComponentProvideOptions = ComponentProvideOptions, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S, LC, Directives, Exposed, Provide>, I, S, Exposed, TypeRefs, TypeEl>;
|
|
1200
|
+
type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
|
|
1201
|
+
type ComponentPublicInstance<P = {}, // props type extracted from props option
|
|
1202
|
+
B = {}, // raw bindings returned from setup()
|
|
1203
|
+
D = {}, // return from data()
|
|
1204
|
+
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = '', TypeRefs extends Data = {}, TypeEl extends Element = any> = {
|
|
1205
|
+
$: ComponentInternalInstance;
|
|
1206
|
+
$data: D;
|
|
1207
|
+
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
1208
|
+
$attrs: Data;
|
|
1209
|
+
$refs: Data & TypeRefs;
|
|
1210
|
+
$slots: UnwrapSlotsType<S>;
|
|
1211
|
+
$root: ComponentPublicInstance | null;
|
|
1212
|
+
$parent: ComponentPublicInstance | null;
|
|
1213
|
+
$host: Element | null;
|
|
1214
|
+
$emit: EmitFn<E>;
|
|
1215
|
+
$el: TypeEl;
|
|
1216
|
+
$options: Options & MergedComponentOptionsOverride;
|
|
1217
|
+
$forceUpdate: () => void;
|
|
1218
|
+
$nextTick: typeof nextTick;
|
|
1219
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends ((...args: any) => infer R) ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
|
|
1220
|
+
} & ExposedKeys<IfAny<P, P, Readonly<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
|
|
1221
|
+
interface SuspenseProps {
|
|
1222
|
+
onResolve?: () => void;
|
|
1223
|
+
onPending?: () => void;
|
|
1224
|
+
onFallback?: () => void;
|
|
1225
|
+
timeout?: string | number;
|
|
1226
|
+
/**
|
|
1227
|
+
* Allow suspense to be captured by parent suspense
|
|
1228
|
+
*
|
|
1229
|
+
* @default false
|
|
1230
|
+
*/
|
|
1231
|
+
suspensible?: boolean;
|
|
1232
|
+
}
|
|
1233
|
+
declare const SuspenseImpl: {
|
|
1234
|
+
name: string;
|
|
1235
|
+
__isSuspense: boolean;
|
|
1236
|
+
process(n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void;
|
|
1237
|
+
hydrate: typeof hydrateSuspense;
|
|
1238
|
+
normalize: typeof normalizeSuspenseChildren;
|
|
1239
|
+
};
|
|
1240
|
+
declare const Suspense: {
|
|
1241
|
+
__isSuspense: true;
|
|
1242
|
+
new (): {
|
|
1243
|
+
$props: VNodeProps & SuspenseProps;
|
|
1244
|
+
$slots: {
|
|
1245
|
+
default(): VNode[];
|
|
1246
|
+
fallback(): VNode[];
|
|
1247
|
+
};
|
|
1248
|
+
};
|
|
1249
|
+
};
|
|
1250
|
+
interface SuspenseBoundary {
|
|
1251
|
+
vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
|
|
1252
|
+
parent: SuspenseBoundary | null;
|
|
1253
|
+
parentComponent: ComponentInternalInstance | null;
|
|
1254
|
+
namespace: ElementNamespace;
|
|
1255
|
+
container: RendererElement;
|
|
1256
|
+
hiddenContainer: RendererElement;
|
|
1257
|
+
activeBranch: VNode | null;
|
|
1258
|
+
pendingBranch: VNode | null;
|
|
1259
|
+
deps: number;
|
|
1260
|
+
pendingId: number;
|
|
1261
|
+
timeout: number;
|
|
1262
|
+
isInFallback: boolean;
|
|
1263
|
+
isHydrating: boolean;
|
|
1264
|
+
isUnmounted: boolean;
|
|
1265
|
+
effects: Function[];
|
|
1266
|
+
resolve(force?: boolean, sync?: boolean): void;
|
|
1267
|
+
fallback(fallbackVNode: VNode): void;
|
|
1268
|
+
move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
|
|
1269
|
+
next(): RendererNode | null;
|
|
1270
|
+
registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn, optimized: boolean): void;
|
|
1271
|
+
unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
|
|
1272
|
+
}
|
|
1273
|
+
declare function hydrateSuspense(node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
1274
|
+
declare function normalizeSuspenseChildren(vnode: VNode): void;
|
|
1275
|
+
type Hook<T = () => void> = T | T[];
|
|
1276
|
+
interface BaseTransitionProps<HostElement = RendererElement> {
|
|
1277
|
+
mode?: 'in-out' | 'out-in' | 'default';
|
|
1278
|
+
appear?: boolean;
|
|
1279
|
+
persisted?: boolean;
|
|
1280
|
+
onBeforeEnter?: Hook<(el: HostElement) => void>;
|
|
1281
|
+
onEnter?: Hook<(el: HostElement, done: () => void) => void>;
|
|
1282
|
+
onAfterEnter?: Hook<(el: HostElement) => void>;
|
|
1283
|
+
onEnterCancelled?: Hook<(el: HostElement) => void>;
|
|
1284
|
+
onBeforeLeave?: Hook<(el: HostElement) => void>;
|
|
1285
|
+
onLeave?: Hook<(el: HostElement, done: () => void) => void>;
|
|
1286
|
+
onAfterLeave?: Hook<(el: HostElement) => void>;
|
|
1287
|
+
onLeaveCancelled?: Hook<(el: HostElement) => void>;
|
|
1288
|
+
onBeforeAppear?: Hook<(el: HostElement) => void>;
|
|
1289
|
+
onAppear?: Hook<(el: HostElement, done: () => void) => void>;
|
|
1290
|
+
onAfterAppear?: Hook<(el: HostElement) => void>;
|
|
1291
|
+
onAppearCancelled?: Hook<(el: HostElement) => void>;
|
|
1292
|
+
}
|
|
1293
|
+
interface TransitionHooks<HostElement = RendererElement> {
|
|
1294
|
+
mode: BaseTransitionProps['mode'];
|
|
1295
|
+
persisted: boolean;
|
|
1296
|
+
beforeEnter(el: HostElement): void;
|
|
1297
|
+
enter(el: HostElement): void;
|
|
1298
|
+
leave(el: HostElement, remove: () => void): void;
|
|
1299
|
+
clone(vnode: VNode): TransitionHooks<HostElement>;
|
|
1300
|
+
afterLeave?(): void;
|
|
1301
|
+
delayLeave?(el: HostElement, earlyRemove: () => void, delayedLeave: () => void): void;
|
|
1302
|
+
delayedLeave?(): void;
|
|
1303
|
+
}
|
|
1304
|
+
type ElementNamespace = 'svg' | 'mathml' | undefined;
|
|
1305
|
+
interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
|
|
1306
|
+
patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, parentComponent?: ComponentInternalInstance | null): void;
|
|
1307
|
+
insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
|
|
1308
|
+
remove(el: HostNode): void;
|
|
1309
|
+
createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
|
|
1310
|
+
[key: string]: any;
|
|
1311
|
+
}) | null): HostElement;
|
|
1312
|
+
createText(text: string): HostNode;
|
|
1313
|
+
createComment(text: string): HostNode;
|
|
1314
|
+
setText(node: HostNode, text: string): void;
|
|
1315
|
+
setElementText(node: HostElement, text: string): void;
|
|
1316
|
+
parentNode(node: HostNode): HostElement | null;
|
|
1317
|
+
nextSibling(node: HostNode): HostNode | null;
|
|
1318
|
+
querySelector?(selector: string): HostElement | null;
|
|
1319
|
+
setScopeId?(el: HostElement, id: string): void;
|
|
1320
|
+
cloneNode?(node: HostNode): HostNode;
|
|
1321
|
+
insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
|
|
1322
|
+
}
|
|
1323
|
+
interface RendererNode {
|
|
1324
|
+
[key: string | symbol]: any;
|
|
1325
|
+
}
|
|
1326
|
+
interface RendererElement extends RendererNode {}
|
|
1327
|
+
interface RendererInternals<HostNode = RendererNode, HostElement = RendererElement> {
|
|
1328
|
+
p: PatchFn;
|
|
1329
|
+
um: UnmountFn;
|
|
1330
|
+
r: RemoveFn;
|
|
1331
|
+
m: MoveFn;
|
|
1332
|
+
mt: MountComponentFn;
|
|
1333
|
+
mc: MountChildrenFn;
|
|
1334
|
+
pc: PatchChildrenFn;
|
|
1335
|
+
pbc: PatchBlockChildrenFn;
|
|
1336
|
+
n: NextFn;
|
|
1337
|
+
o: RendererOptions<HostNode, HostElement>;
|
|
1338
|
+
}
|
|
1339
|
+
type PatchFn = (n1: VNode | null, // null means this is a mount
|
|
1340
|
+
n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void;
|
|
1341
|
+
type MountChildrenFn = (children: VNodeArrayChildren, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, start?: number) => void;
|
|
1342
|
+
type PatchChildrenFn = (n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean) => void;
|
|
1343
|
+
type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void;
|
|
1344
|
+
type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void;
|
|
1345
|
+
type NextFn = (vnode: VNode) => RendererNode | null;
|
|
1346
|
+
type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
|
|
1347
|
+
type RemoveFn = (vnode: VNode) => void;
|
|
1348
|
+
type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
1349
|
+
type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
1350
|
+
declare enum MoveType {
|
|
1351
|
+
ENTER = 0,
|
|
1352
|
+
LEAVE = 1,
|
|
1353
|
+
REORDER = 2
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* The createRenderer function accepts two generic arguments:
|
|
1357
|
+
* HostNode and HostElement, corresponding to Node and Element types in the
|
|
1358
|
+
* host environment. For example, for runtime-dom, HostNode would be the DOM
|
|
1359
|
+
* `Node` interface and HostElement would be the DOM `Element` interface.
|
|
1360
|
+
*
|
|
1361
|
+
* Custom renderers can pass in the platform specific types like this:
|
|
1362
|
+
*
|
|
1363
|
+
* ``` js
|
|
1364
|
+
* const { render, createApp } = createRenderer<Node, Element>({
|
|
1365
|
+
* patchProp,
|
|
1366
|
+
* ...nodeOps
|
|
1367
|
+
* })
|
|
1368
|
+
* ```
|
|
1369
|
+
*/
|
|
1370
|
+
type MatchPattern = string | RegExp | (string | RegExp)[];
|
|
1371
|
+
interface KeepAliveProps {
|
|
1372
|
+
include?: MatchPattern;
|
|
1373
|
+
exclude?: MatchPattern;
|
|
1374
|
+
max?: number | string;
|
|
1375
|
+
}
|
|
1376
|
+
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
1377
|
+
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
1378
|
+
declare enum DeprecationTypes$1 {
|
|
1379
|
+
GLOBAL_MOUNT = "GLOBAL_MOUNT",
|
|
1380
|
+
GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER",
|
|
1381
|
+
GLOBAL_EXTEND = "GLOBAL_EXTEND",
|
|
1382
|
+
GLOBAL_PROTOTYPE = "GLOBAL_PROTOTYPE",
|
|
1383
|
+
GLOBAL_SET = "GLOBAL_SET",
|
|
1384
|
+
GLOBAL_DELETE = "GLOBAL_DELETE",
|
|
1385
|
+
GLOBAL_OBSERVABLE = "GLOBAL_OBSERVABLE",
|
|
1386
|
+
GLOBAL_PRIVATE_UTIL = "GLOBAL_PRIVATE_UTIL",
|
|
1387
|
+
CONFIG_SILENT = "CONFIG_SILENT",
|
|
1388
|
+
CONFIG_DEVTOOLS = "CONFIG_DEVTOOLS",
|
|
1389
|
+
CONFIG_KEY_CODES = "CONFIG_KEY_CODES",
|
|
1390
|
+
CONFIG_PRODUCTION_TIP = "CONFIG_PRODUCTION_TIP",
|
|
1391
|
+
CONFIG_IGNORED_ELEMENTS = "CONFIG_IGNORED_ELEMENTS",
|
|
1392
|
+
CONFIG_WHITESPACE = "CONFIG_WHITESPACE",
|
|
1393
|
+
CONFIG_OPTION_MERGE_STRATS = "CONFIG_OPTION_MERGE_STRATS",
|
|
1394
|
+
INSTANCE_SET = "INSTANCE_SET",
|
|
1395
|
+
INSTANCE_DELETE = "INSTANCE_DELETE",
|
|
1396
|
+
INSTANCE_DESTROY = "INSTANCE_DESTROY",
|
|
1397
|
+
INSTANCE_EVENT_EMITTER = "INSTANCE_EVENT_EMITTER",
|
|
1398
|
+
INSTANCE_EVENT_HOOKS = "INSTANCE_EVENT_HOOKS",
|
|
1399
|
+
INSTANCE_CHILDREN = "INSTANCE_CHILDREN",
|
|
1400
|
+
INSTANCE_LISTENERS = "INSTANCE_LISTENERS",
|
|
1401
|
+
INSTANCE_SCOPED_SLOTS = "INSTANCE_SCOPED_SLOTS",
|
|
1402
|
+
INSTANCE_ATTRS_CLASS_STYLE = "INSTANCE_ATTRS_CLASS_STYLE",
|
|
1403
|
+
OPTIONS_DATA_FN = "OPTIONS_DATA_FN",
|
|
1404
|
+
OPTIONS_DATA_MERGE = "OPTIONS_DATA_MERGE",
|
|
1405
|
+
OPTIONS_BEFORE_DESTROY = "OPTIONS_BEFORE_DESTROY",
|
|
1406
|
+
OPTIONS_DESTROYED = "OPTIONS_DESTROYED",
|
|
1407
|
+
WATCH_ARRAY = "WATCH_ARRAY",
|
|
1408
|
+
PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS",
|
|
1409
|
+
V_ON_KEYCODE_MODIFIER = "V_ON_KEYCODE_MODIFIER",
|
|
1410
|
+
CUSTOM_DIR = "CUSTOM_DIR",
|
|
1411
|
+
ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE",
|
|
1412
|
+
ATTR_ENUMERATED_COERCION = "ATTR_ENUMERATED_COERCION",
|
|
1413
|
+
TRANSITION_CLASSES = "TRANSITION_CLASSES",
|
|
1414
|
+
TRANSITION_GROUP_ROOT = "TRANSITION_GROUP_ROOT",
|
|
1415
|
+
COMPONENT_ASYNC = "COMPONENT_ASYNC",
|
|
1416
|
+
COMPONENT_FUNCTIONAL = "COMPONENT_FUNCTIONAL",
|
|
1417
|
+
COMPONENT_V_MODEL = "COMPONENT_V_MODEL",
|
|
1418
|
+
RENDER_FUNCTION = "RENDER_FUNCTION",
|
|
1419
|
+
FILTERS = "FILTERS",
|
|
1420
|
+
PRIVATE_APIS = "PRIVATE_APIS"
|
|
1421
|
+
}
|
|
1422
|
+
type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & {
|
|
1423
|
+
MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3);
|
|
1424
|
+
};
|
|
1425
|
+
/**
|
|
1426
|
+
* Interface for declaring custom options.
|
|
1427
|
+
*
|
|
1428
|
+
* @example
|
|
1429
|
+
* ```ts
|
|
1430
|
+
* declare module 'vue' {
|
|
1431
|
+
* interface ComponentCustomOptions {
|
|
1432
|
+
* beforeRouteUpdate?(
|
|
1433
|
+
* to: Route,
|
|
1434
|
+
* from: Route,
|
|
1435
|
+
* next: () => void
|
|
1436
|
+
* ): void
|
|
1437
|
+
* }
|
|
1438
|
+
* }
|
|
1439
|
+
* ```
|
|
1440
|
+
*/
|
|
1441
|
+
interface ComponentCustomOptions {}
|
|
1442
|
+
type RenderFunction = () => VNodeChild;
|
|
1443
|
+
interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II, Provide>, ComponentInternalOptions, ComponentCustomOptions {
|
|
1444
|
+
setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
|
|
1445
|
+
name?: string;
|
|
1446
|
+
template?: string | object;
|
|
1447
|
+
render?: Function;
|
|
1448
|
+
components?: LC & Record<string, Component>;
|
|
1449
|
+
directives?: Directives & Record<string, Directive>;
|
|
1450
|
+
inheritAttrs?: boolean;
|
|
1451
|
+
emits?: (E | EE[]) & ThisType<void>;
|
|
1452
|
+
slots?: S;
|
|
1453
|
+
expose?: Exposed[];
|
|
1454
|
+
serverPrefetch?(): void | Promise<any>;
|
|
1455
|
+
compilerOptions?: RuntimeCompilerOptions;
|
|
1456
|
+
call?: (this: unknown, ...args: unknown[]) => never;
|
|
1457
|
+
__isFragment?: never;
|
|
1458
|
+
__isTeleport?: never;
|
|
1459
|
+
__isSuspense?: never;
|
|
1460
|
+
__defaults?: Defaults;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Subset of compiler options that makes sense for the runtime.
|
|
1464
|
+
*/
|
|
1465
|
+
interface RuntimeCompilerOptions {
|
|
1466
|
+
isCustomElement?: (tag: string) => boolean;
|
|
1467
|
+
whitespace?: 'preserve' | 'condense';
|
|
1468
|
+
comments?: boolean;
|
|
1469
|
+
delimiters?: [string, string];
|
|
1470
|
+
}
|
|
1471
|
+
type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>, Defaults, false, I, S, LC, Directives>>;
|
|
1472
|
+
type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
1473
|
+
type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
1474
|
+
interface MethodOptions {
|
|
1475
|
+
[key: string]: Function;
|
|
1476
|
+
}
|
|
1477
|
+
type ExtractComputedReturns<T extends any> = { [key in keyof T]: T[key] extends {
|
|
1478
|
+
get: (...args: any[]) => infer TReturn;
|
|
1479
|
+
} ? TReturn : T[key] extends ((...args: any[]) => infer TReturn) ? TReturn : never };
|
|
1480
|
+
type ObjectWatchOptionItem = {
|
|
1481
|
+
handler: WatchCallback | string;
|
|
1482
|
+
} & WatchOptions;
|
|
1483
|
+
type WatchOptionItem = string | WatchCallback | ObjectWatchOptionItem;
|
|
1484
|
+
type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[];
|
|
1485
|
+
type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>;
|
|
1486
|
+
type ComponentProvideOptions = ObjectProvideOptions | Function;
|
|
1487
|
+
type ObjectProvideOptions = Record<string | symbol, unknown>;
|
|
1488
|
+
type ComponentInjectOptions = string[] | ObjectInjectOptions;
|
|
1489
|
+
type ObjectInjectOptions = Record<string | symbol, string | symbol | {
|
|
1490
|
+
from?: string | symbol;
|
|
1491
|
+
default?: unknown;
|
|
1492
|
+
}>;
|
|
1493
|
+
type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? { [K in T[number]]?: unknown } : T extends ObjectInjectOptions ? { [K in keyof T]?: unknown } : never;
|
|
1494
|
+
interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string, Provide extends ComponentProvideOptions = ComponentProvideOptions> {
|
|
1495
|
+
compatConfig?: CompatConfig;
|
|
1496
|
+
[key: string]: any;
|
|
1497
|
+
data?: (this: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
|
|
1498
|
+
computed?: C;
|
|
1499
|
+
methods?: M;
|
|
1500
|
+
watch?: ComponentWatchOptions;
|
|
1501
|
+
provide?: Provide;
|
|
1502
|
+
inject?: I | II[];
|
|
1503
|
+
filters?: Record<string, Function>;
|
|
1504
|
+
mixins?: Mixin[];
|
|
1505
|
+
extends?: Extends;
|
|
1506
|
+
beforeCreate?(): any;
|
|
1507
|
+
created?(): any;
|
|
1508
|
+
beforeMount?(): any;
|
|
1509
|
+
mounted?(): any;
|
|
1510
|
+
beforeUpdate?(): any;
|
|
1511
|
+
updated?(): any;
|
|
1512
|
+
activated?(): any;
|
|
1513
|
+
deactivated?(): any;
|
|
1514
|
+
/** @deprecated use `beforeUnmount` instead */
|
|
1515
|
+
beforeDestroy?(): any;
|
|
1516
|
+
beforeUnmount?(): any;
|
|
1517
|
+
/** @deprecated use `unmounted` instead */
|
|
1518
|
+
destroyed?(): any;
|
|
1519
|
+
unmounted?(): any;
|
|
1520
|
+
renderTracked?: DebuggerHook;
|
|
1521
|
+
renderTriggered?: DebuggerHook;
|
|
1522
|
+
errorCaptured?: ErrorCapturedHook;
|
|
1523
|
+
/**
|
|
1524
|
+
* runtime compile only
|
|
1525
|
+
* @deprecated use `compilerOptions.delimiters` instead.
|
|
1526
|
+
*/
|
|
1527
|
+
delimiters?: [string, string];
|
|
1528
|
+
/**
|
|
1529
|
+
* #3468
|
|
1530
|
+
*
|
|
1531
|
+
* type-only, used to assist Mixin's type inference,
|
|
1532
|
+
* TypeScript will try to simplify the inferred `Mixin` type,
|
|
1533
|
+
* with the `__differentiator`, TypeScript won't be able to combine different mixins,
|
|
1534
|
+
* because the `__differentiator` will be different
|
|
1535
|
+
*/
|
|
1536
|
+
__differentiator?: keyof D | keyof C | keyof M;
|
|
1537
|
+
}
|
|
1538
|
+
type MergedHook<T = () => void> = T | T[];
|
|
1539
|
+
type MergedComponentOptionsOverride = {
|
|
1540
|
+
beforeCreate?: MergedHook;
|
|
1541
|
+
created?: MergedHook;
|
|
1542
|
+
beforeMount?: MergedHook;
|
|
1543
|
+
mounted?: MergedHook;
|
|
1544
|
+
beforeUpdate?: MergedHook;
|
|
1545
|
+
updated?: MergedHook;
|
|
1546
|
+
activated?: MergedHook;
|
|
1547
|
+
deactivated?: MergedHook; /** @deprecated use `beforeUnmount` instead */
|
|
1548
|
+
beforeDestroy?: MergedHook;
|
|
1549
|
+
beforeUnmount?: MergedHook; /** @deprecated use `unmounted` instead */
|
|
1550
|
+
destroyed?: MergedHook;
|
|
1551
|
+
unmounted?: MergedHook;
|
|
1552
|
+
renderTracked?: MergedHook<DebuggerHook>;
|
|
1553
|
+
renderTriggered?: MergedHook<DebuggerHook>;
|
|
1554
|
+
errorCaptured?: MergedHook<ErrorCapturedHook>;
|
|
1555
|
+
};
|
|
1556
|
+
type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults';
|
|
1557
|
+
type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Defaults = {}> = {
|
|
1558
|
+
P: P;
|
|
1559
|
+
B: B;
|
|
1560
|
+
D: D;
|
|
1561
|
+
C: C;
|
|
1562
|
+
M: M;
|
|
1563
|
+
Defaults: Defaults;
|
|
1564
|
+
};
|
|
1565
|
+
/**
|
|
1566
|
+
* @deprecated
|
|
1567
|
+
*/
|
|
1568
|
+
interface InjectionConstraint<T> {}
|
|
1569
|
+
type InjectionKey<T> = symbol & InjectionConstraint<T>;
|
|
1570
|
+
type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
1571
|
+
type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
|
|
1572
|
+
type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = {}, TypeEl extends Element = any> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, TypeRefs, TypeEl>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
|
|
1573
|
+
interface App<HostElement = any> {
|
|
1574
|
+
version: string;
|
|
1575
|
+
config: AppConfig$1;
|
|
1576
|
+
use<Options extends unknown[]>(plugin: Plugin$1<Options>, ...options: NoInfer<Options>): this;
|
|
1577
|
+
use<Options>(plugin: Plugin$1<Options>, options: NoInfer<Options>): this;
|
|
1578
|
+
mixin(mixin: ComponentOptions): this;
|
|
1579
|
+
component(name: string): Component | undefined;
|
|
1580
|
+
component<T extends Component | DefineComponent>(name: string, component: T): this;
|
|
1581
|
+
directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any>(name: string): Directive<HostElement, Value, Modifiers, Arg> | undefined;
|
|
1582
|
+
directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any>(name: string, directive: Directive<HostElement, Value, Modifiers, Arg>): this;
|
|
1583
|
+
mount(rootContainer: HostElement | string,
|
|
1584
|
+
/**
|
|
1585
|
+
* @internal
|
|
1586
|
+
*/
|
|
1587
|
+
|
|
1588
|
+
isHydrate?: boolean,
|
|
1589
|
+
/**
|
|
1590
|
+
* @internal
|
|
1591
|
+
*/
|
|
1592
|
+
|
|
1593
|
+
namespace?: boolean | ElementNamespace,
|
|
1594
|
+
/**
|
|
1595
|
+
* @internal
|
|
1596
|
+
*/
|
|
1597
|
+
|
|
1598
|
+
vnode?: VNode): ComponentPublicInstance;
|
|
1599
|
+
unmount(): void;
|
|
1600
|
+
onUnmount(cb: () => void): void;
|
|
1601
|
+
provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): this;
|
|
1602
|
+
/**
|
|
1603
|
+
* Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
|
|
1604
|
+
* to variables provided via `app.provide()`.
|
|
1605
|
+
*
|
|
1606
|
+
* @param fn - function to run with the app as active instance
|
|
1607
|
+
*/
|
|
1608
|
+
runWithContext<T>(fn: () => T): T;
|
|
1609
|
+
_uid: number;
|
|
1610
|
+
_component: ConcreteComponent;
|
|
1611
|
+
_props: Data | null;
|
|
1612
|
+
_container: HostElement | null;
|
|
1613
|
+
_context: AppContext;
|
|
1614
|
+
_instance: ComponentInternalInstance | null;
|
|
1615
|
+
/**
|
|
1616
|
+
* v2 compat only
|
|
1617
|
+
*/
|
|
1618
|
+
filter?(name: string): Function | undefined;
|
|
1619
|
+
filter?(name: string, filter: Function): this;
|
|
1620
|
+
}
|
|
1621
|
+
type OptionMergeFunction = (to: unknown, from: unknown) => any;
|
|
1622
|
+
interface AppConfig$1 {
|
|
1623
|
+
readonly isNativeTag: (tag: string) => boolean;
|
|
1624
|
+
performance: boolean;
|
|
1625
|
+
optionMergeStrategies: Record<string, OptionMergeFunction>;
|
|
1626
|
+
globalProperties: ComponentCustomProperties & Record<string, any>;
|
|
1627
|
+
errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
|
|
1628
|
+
warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
|
|
1629
|
+
/**
|
|
1630
|
+
* Options to pass to `@vue/compiler-dom`.
|
|
1631
|
+
* Only supported in runtime compiler build.
|
|
1632
|
+
*/
|
|
1633
|
+
compilerOptions: RuntimeCompilerOptions;
|
|
1634
|
+
/**
|
|
1635
|
+
* @deprecated use config.compilerOptions.isCustomElement
|
|
1636
|
+
*/
|
|
1637
|
+
isCustomElement?: (tag: string) => boolean;
|
|
1638
|
+
/**
|
|
1639
|
+
* TODO document for 3.5
|
|
1640
|
+
* Enable warnings for computed getters that recursively trigger itself.
|
|
1641
|
+
*/
|
|
1642
|
+
warnRecursiveComputed?: boolean;
|
|
1643
|
+
/**
|
|
1644
|
+
* Whether to throw unhandled errors in production.
|
|
1645
|
+
* Default is `false` to avoid crashing on any error (and only logs it)
|
|
1646
|
+
* But in some cases, e.g. SSR, throwing might be more desirable.
|
|
1647
|
+
*/
|
|
1648
|
+
throwUnhandledErrorInProduction?: boolean;
|
|
1649
|
+
/**
|
|
1650
|
+
* Prefix for all useId() calls within this app
|
|
1651
|
+
*/
|
|
1652
|
+
idPrefix?: string;
|
|
1653
|
+
}
|
|
1654
|
+
interface AppContext {
|
|
1655
|
+
app: App;
|
|
1656
|
+
config: AppConfig$1;
|
|
1657
|
+
mixins: ComponentOptions[];
|
|
1658
|
+
components: Record<string, Component>;
|
|
1659
|
+
directives: Record<string, Directive>;
|
|
1660
|
+
provides: Record<string | symbol, any>;
|
|
1661
|
+
}
|
|
1662
|
+
type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
|
|
1663
|
+
type ObjectPlugin<Options = any[]> = {
|
|
1664
|
+
install: PluginInstallFunction<Options>;
|
|
1665
|
+
};
|
|
1666
|
+
type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
|
|
1667
|
+
type Plugin$1<Options = any[], P extends unknown[] = (Options extends unknown[] ? Options : [Options])> = FunctionPlugin<P> | ObjectPlugin<P>;
|
|
1668
|
+
type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
|
|
1669
|
+
interface TeleportProps {
|
|
1670
|
+
to: string | RendererElement | null | undefined;
|
|
1671
|
+
disabled?: boolean;
|
|
1672
|
+
defer?: boolean;
|
|
1673
|
+
}
|
|
1674
|
+
declare const TeleportImpl: {
|
|
1675
|
+
name: string;
|
|
1676
|
+
__isTeleport: boolean;
|
|
1677
|
+
process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
|
|
1678
|
+
remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, {
|
|
1679
|
+
um: unmount,
|
|
1680
|
+
o: {
|
|
1681
|
+
remove: hostRemove
|
|
1682
|
+
}
|
|
1683
|
+
}: RendererInternals, doRemove: boolean): void;
|
|
1684
|
+
move: typeof moveTeleport;
|
|
1685
|
+
hydrate: typeof hydrateTeleport;
|
|
1686
|
+
};
|
|
1687
|
+
declare enum TeleportMoveTypes {
|
|
1688
|
+
TARGET_CHANGE = 0,
|
|
1689
|
+
TOGGLE = 1,
|
|
1690
|
+
// enable / disable
|
|
1691
|
+
REORDER = 2
|
|
1692
|
+
}
|
|
1693
|
+
declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, {
|
|
1694
|
+
o: {
|
|
1695
|
+
insert
|
|
1696
|
+
},
|
|
1697
|
+
m: move
|
|
1698
|
+
}: RendererInternals, moveType?: TeleportMoveTypes): void;
|
|
1699
|
+
declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, {
|
|
1700
|
+
o: {
|
|
1701
|
+
nextSibling,
|
|
1702
|
+
parentNode,
|
|
1703
|
+
querySelector,
|
|
1704
|
+
insert,
|
|
1705
|
+
createText
|
|
1706
|
+
}
|
|
1707
|
+
}: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
1708
|
+
declare const Teleport: {
|
|
1709
|
+
__isTeleport: true;
|
|
1710
|
+
new (): {
|
|
1711
|
+
$props: VNodeProps & TeleportProps;
|
|
1712
|
+
$slots: {
|
|
1713
|
+
default(): VNode[];
|
|
1714
|
+
};
|
|
1715
|
+
};
|
|
1716
|
+
};
|
|
1717
|
+
declare const Fragment: {
|
|
1718
|
+
__isFragment: true;
|
|
1719
|
+
new (): {
|
|
1720
|
+
$props: VNodeProps;
|
|
1721
|
+
};
|
|
1722
|
+
};
|
|
1723
|
+
declare const Text: unique symbol;
|
|
1724
|
+
declare const Comment: unique symbol;
|
|
1725
|
+
declare const Static: unique symbol;
|
|
1726
|
+
type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
|
|
1727
|
+
type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
|
|
1728
|
+
type VNodeNormalizedRefAtom = {
|
|
1729
|
+
/**
|
|
1730
|
+
* component instance
|
|
1731
|
+
*/
|
|
1732
|
+
i: ComponentInternalInstance;
|
|
1733
|
+
/**
|
|
1734
|
+
* Actual ref
|
|
1735
|
+
*/
|
|
1736
|
+
r: VNodeRef;
|
|
1737
|
+
/**
|
|
1738
|
+
* setup ref key
|
|
1739
|
+
*/
|
|
1740
|
+
k?: string;
|
|
1741
|
+
/**
|
|
1742
|
+
* refInFor marker
|
|
1743
|
+
*/
|
|
1744
|
+
f?: boolean;
|
|
1745
|
+
};
|
|
1746
|
+
type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
|
|
1747
|
+
type VNodeMountHook = (vnode: VNode) => void;
|
|
1748
|
+
type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
|
|
1749
|
+
type VNodeProps = {
|
|
1750
|
+
key?: PropertyKey;
|
|
1751
|
+
ref?: VNodeRef;
|
|
1752
|
+
ref_for?: boolean;
|
|
1753
|
+
ref_key?: string;
|
|
1754
|
+
onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
|
|
1755
|
+
onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
|
|
1756
|
+
onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
1757
|
+
onVnodeUpdated?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
1758
|
+
onVnodeBeforeUnmount?: VNodeMountHook | VNodeMountHook[];
|
|
1759
|
+
onVnodeUnmounted?: VNodeMountHook | VNodeMountHook[];
|
|
1760
|
+
};
|
|
1761
|
+
type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
|
|
1762
|
+
type VNodeArrayChildren = Array<VNodeArrayChildren | VNodeChildAtom>;
|
|
1763
|
+
type VNodeChild = VNodeChildAtom | VNodeArrayChildren;
|
|
1764
|
+
type VNodeNormalizedChildren = string | VNodeArrayChildren | RawSlots | null;
|
|
1765
|
+
interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraProps = {
|
|
1766
|
+
[key: string]: any;
|
|
1767
|
+
}> {
|
|
1768
|
+
type: VNodeTypes;
|
|
1769
|
+
props: (VNodeProps & ExtraProps) | null;
|
|
1770
|
+
key: PropertyKey | null;
|
|
1771
|
+
ref: VNodeNormalizedRef | null;
|
|
1772
|
+
/**
|
|
1773
|
+
* SFC only. This is assigned on vnode creation using currentScopeId
|
|
1774
|
+
* which is set alongside currentRenderingInstance.
|
|
1775
|
+
*/
|
|
1776
|
+
scopeId: string | null;
|
|
1777
|
+
children: VNodeNormalizedChildren;
|
|
1778
|
+
component: ComponentInternalInstance | null;
|
|
1779
|
+
dirs: DirectiveBinding[] | null;
|
|
1780
|
+
transition: TransitionHooks<HostElement> | null;
|
|
1781
|
+
el: HostNode | null;
|
|
1782
|
+
placeholder: HostNode | null;
|
|
1783
|
+
anchor: HostNode | null;
|
|
1784
|
+
target: HostElement | null;
|
|
1785
|
+
targetStart: HostNode | null;
|
|
1786
|
+
targetAnchor: HostNode | null;
|
|
1787
|
+
suspense: SuspenseBoundary | null;
|
|
1788
|
+
shapeFlag: number;
|
|
1789
|
+
patchFlag: number;
|
|
1790
|
+
appContext: AppContext | null;
|
|
1791
|
+
}
|
|
1792
|
+
type Data = Record<string, unknown>;
|
|
1793
|
+
/**
|
|
1794
|
+
* Public utility type for extracting the instance type of a component.
|
|
1795
|
+
* Works with all valid component definition types. This is intended to replace
|
|
1796
|
+
* the usage of `InstanceType<typeof Comp>` which only works for
|
|
1797
|
+
* constructor-based component definition types.
|
|
1798
|
+
*
|
|
1799
|
+
* @example
|
|
1800
|
+
* ```ts
|
|
1801
|
+
* const MyComp = { ... }
|
|
1802
|
+
* declare const instance: ComponentInstance<typeof MyComp>
|
|
1803
|
+
* ```
|
|
1804
|
+
*/
|
|
1805
|
+
/**
|
|
1806
|
+
* For extending allowed non-declared props on components in TSX
|
|
1807
|
+
*/
|
|
1808
|
+
interface ComponentCustomProps {}
|
|
1809
|
+
/**
|
|
1810
|
+
* For globally defined Directives
|
|
1811
|
+
* Here is an example of adding a directive `VTooltip` as global directive:
|
|
1812
|
+
*
|
|
1813
|
+
* @example
|
|
1814
|
+
* ```ts
|
|
1815
|
+
* import VTooltip from 'v-tooltip'
|
|
1816
|
+
*
|
|
1817
|
+
* declare module '@vue/runtime-core' {
|
|
1818
|
+
* interface GlobalDirectives {
|
|
1819
|
+
* VTooltip
|
|
1820
|
+
* }
|
|
1821
|
+
* }
|
|
1822
|
+
* ```
|
|
1823
|
+
*/
|
|
1824
|
+
interface GlobalDirectives {}
|
|
1825
|
+
/**
|
|
1826
|
+
* For globally defined Components
|
|
1827
|
+
* Here is an example of adding a component `RouterView` as global component:
|
|
1828
|
+
*
|
|
1829
|
+
* @example
|
|
1830
|
+
* ```ts
|
|
1831
|
+
* import { RouterView } from 'vue-router'
|
|
1832
|
+
*
|
|
1833
|
+
* declare module '@vue/runtime-core' {
|
|
1834
|
+
* interface GlobalComponents {
|
|
1835
|
+
* RouterView
|
|
1836
|
+
* }
|
|
1837
|
+
* }
|
|
1838
|
+
* ```
|
|
1839
|
+
*/
|
|
1840
|
+
interface GlobalComponents {
|
|
1841
|
+
Teleport: DefineComponent<TeleportProps>;
|
|
1842
|
+
Suspense: DefineComponent<SuspenseProps>;
|
|
1843
|
+
KeepAlive: DefineComponent<KeepAliveProps>;
|
|
1844
|
+
BaseTransition: DefineComponent<BaseTransitionProps>;
|
|
1845
|
+
}
|
|
1846
|
+
/**
|
|
1847
|
+
* Default allowed non-declared props on component in TSX
|
|
1848
|
+
*/
|
|
1849
|
+
interface AllowedComponentProps {
|
|
1850
|
+
class?: unknown;
|
|
1851
|
+
style?: unknown;
|
|
1852
|
+
}
|
|
1853
|
+
interface ComponentInternalOptions {
|
|
1854
|
+
/**
|
|
1855
|
+
* Compat build only, for bailing out of certain compatibility behavior
|
|
1856
|
+
*/
|
|
1857
|
+
__isBuiltIn?: boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* This one should be exposed so that devtools can make use of it
|
|
1860
|
+
*/
|
|
1861
|
+
__file?: string;
|
|
1862
|
+
/**
|
|
1863
|
+
* name inferred from filename
|
|
1864
|
+
*/
|
|
1865
|
+
__name?: string;
|
|
1866
|
+
}
|
|
1867
|
+
interface FunctionalComponent<P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>> extends ComponentInternalOptions {
|
|
1868
|
+
(props: P & EmitsToProps<EE>, ctx: Omit<SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
|
|
1869
|
+
props?: ComponentPropsOptions<P>;
|
|
1870
|
+
emits?: EE | (keyof EE)[];
|
|
1871
|
+
slots?: IfAny<S, Slots, SlotsType<S>>;
|
|
1872
|
+
inheritAttrs?: boolean;
|
|
1873
|
+
displayName?: string;
|
|
1874
|
+
compatConfig?: CompatConfig;
|
|
1875
|
+
}
|
|
1876
|
+
/**
|
|
1877
|
+
* Concrete component type matches its actual value: it's either an options
|
|
1878
|
+
* object, or a function. Use this where the code expects to work with actual
|
|
1879
|
+
* values, e.g. checking if its a function or not. This is mostly for internal
|
|
1880
|
+
* implementation code.
|
|
1881
|
+
*/
|
|
1882
|
+
type ConcreteComponent<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ComponentOptions<Props, RawBindings, D, C, M> | FunctionalComponent<Props, E, S>;
|
|
1883
|
+
/**
|
|
1884
|
+
* A type used in public APIs where a component type is expected.
|
|
1885
|
+
* The constructor type is an artificial type returned by defineComponent().
|
|
1886
|
+
*/
|
|
1887
|
+
type Component<PropsOrInstance = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ConcreteComponent<PropsOrInstance, RawBindings, D, C, M, E, S> | ComponentPublicInstanceConstructor<PropsOrInstance>;
|
|
1888
|
+
type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
|
|
1889
|
+
attrs: Data;
|
|
1890
|
+
slots: UnwrapSlotsType<S>;
|
|
1891
|
+
emit: EmitFn<E>;
|
|
1892
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
1893
|
+
} : never;
|
|
1894
|
+
/**
|
|
1895
|
+
* We expose a subset of properties on the internal instance as they are
|
|
1896
|
+
* useful for advanced external libraries and tools.
|
|
1897
|
+
*/
|
|
1898
|
+
interface ComponentInternalInstance {
|
|
1899
|
+
uid: number;
|
|
1900
|
+
type: ConcreteComponent;
|
|
1901
|
+
parent: ComponentInternalInstance | null;
|
|
1902
|
+
root: ComponentInternalInstance;
|
|
1903
|
+
appContext: AppContext;
|
|
1904
|
+
/**
|
|
1905
|
+
* Vnode representing this component in its parent's vdom tree
|
|
1906
|
+
*/
|
|
1907
|
+
vnode: VNode;
|
|
1908
|
+
/**
|
|
1909
|
+
* Root vnode of this component's own vdom tree
|
|
1910
|
+
*/
|
|
1911
|
+
subTree: VNode;
|
|
1912
|
+
/**
|
|
1913
|
+
* Render effect instance
|
|
1914
|
+
*/
|
|
1915
|
+
effect: ReactiveEffect;
|
|
1916
|
+
/**
|
|
1917
|
+
* Force update render effect
|
|
1918
|
+
*/
|
|
1919
|
+
update: () => void;
|
|
1920
|
+
/**
|
|
1921
|
+
* Render effect job to be passed to scheduler (checks if dirty)
|
|
1922
|
+
*/
|
|
1923
|
+
job: SchedulerJob;
|
|
1924
|
+
proxy: ComponentPublicInstance | null;
|
|
1925
|
+
exposed: Record<string, any> | null;
|
|
1926
|
+
exposeProxy: Record<string, any> | null;
|
|
1927
|
+
data: Data;
|
|
1928
|
+
props: Data;
|
|
1929
|
+
attrs: Data;
|
|
1930
|
+
slots: InternalSlots;
|
|
1931
|
+
refs: Data;
|
|
1932
|
+
emit: EmitFn;
|
|
1933
|
+
isMounted: boolean;
|
|
1934
|
+
isUnmounted: boolean;
|
|
1935
|
+
isDeactivated: boolean;
|
|
1936
|
+
}
|
|
1937
|
+
interface WatchEffectOptions extends DebuggerOptions {
|
|
1938
|
+
flush?: 'pre' | 'post' | 'sync';
|
|
1939
|
+
}
|
|
1940
|
+
interface WatchOptions<Immediate = boolean> extends WatchEffectOptions {
|
|
1941
|
+
immediate?: Immediate;
|
|
1942
|
+
deep?: boolean | number;
|
|
1943
|
+
once?: boolean;
|
|
1944
|
+
}
|
|
1945
|
+
declare module '@vue/reactivity' {
|
|
1946
|
+
interface RefUnwrapBailTypes {
|
|
1947
|
+
runtimeCoreBailTypes: VNode | {
|
|
1948
|
+
$: ComponentInternalInstance;
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
// Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1953
|
+
// build.
|
|
1954
|
+
declare module '@vue/runtime-core' {
|
|
1955
|
+
export interface GlobalComponents {
|
|
1956
|
+
Teleport: DefineComponent<TeleportProps>;
|
|
1957
|
+
Suspense: DefineComponent<SuspenseProps>;
|
|
1958
|
+
KeepAlive: DefineComponent<KeepAliveProps>;
|
|
1959
|
+
BaseTransition: DefineComponent<BaseTransitionProps>;
|
|
1960
|
+
}
|
|
1961
|
+
} // Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1962
|
+
// build.
|
|
1963
|
+
type _defineProps = typeof defineProps;
|
|
1964
|
+
type _defineEmits = typeof defineEmits;
|
|
1965
|
+
type _defineExpose = typeof defineExpose;
|
|
1966
|
+
type _defineOptions = typeof defineOptions;
|
|
1967
|
+
type _defineSlots = typeof defineSlots;
|
|
1968
|
+
type _defineModel = typeof defineModel;
|
|
1969
|
+
type _withDefaults = typeof withDefaults;
|
|
1970
|
+
declare global {
|
|
1971
|
+
const defineProps: _defineProps;
|
|
1972
|
+
const defineEmits: _defineEmits;
|
|
1973
|
+
const defineExpose: _defineExpose;
|
|
1974
|
+
const defineOptions: _defineOptions;
|
|
1975
|
+
const defineSlots: _defineSlots;
|
|
1976
|
+
const defineModel: _defineModel;
|
|
1977
|
+
const withDefaults: _withDefaults;
|
|
1978
|
+
}
|
|
1979
|
+
//#endregion
|
|
1980
|
+
//#region ../../node_modules/.pnpm/@vue+runtime-dom@3.5.29/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts
|
|
1981
|
+
declare const TRANSITION = "transition";
|
|
1982
|
+
declare const ANIMATION = "animation";
|
|
1983
|
+
type AnimationTypes = typeof TRANSITION | typeof ANIMATION;
|
|
1984
|
+
interface TransitionProps extends BaseTransitionProps<Element> {
|
|
1985
|
+
name?: string;
|
|
1986
|
+
type?: AnimationTypes;
|
|
1987
|
+
css?: boolean;
|
|
1988
|
+
duration?: number | {
|
|
1989
|
+
enter: number;
|
|
1990
|
+
leave: number;
|
|
1991
|
+
};
|
|
1992
|
+
enterFromClass?: string;
|
|
1993
|
+
enterActiveClass?: string;
|
|
1994
|
+
enterToClass?: string;
|
|
1995
|
+
appearFromClass?: string;
|
|
1996
|
+
appearActiveClass?: string;
|
|
1997
|
+
appearToClass?: string;
|
|
1998
|
+
leaveFromClass?: string;
|
|
1999
|
+
leaveActiveClass?: string;
|
|
2000
|
+
leaveToClass?: string;
|
|
2001
|
+
}
|
|
2002
|
+
type TransitionGroupProps = Omit<TransitionProps, 'mode'> & {
|
|
2003
|
+
tag?: string;
|
|
2004
|
+
moveClass?: string;
|
|
2005
|
+
};
|
|
2006
|
+
declare const vShowOriginalDisplay: unique symbol;
|
|
2007
|
+
declare const vShowHidden: unique symbol;
|
|
2008
|
+
interface VShowElement extends HTMLElement {
|
|
2009
|
+
[vShowOriginalDisplay]: string;
|
|
2010
|
+
[vShowHidden]: boolean;
|
|
2011
|
+
}
|
|
2012
|
+
declare const vShow: ObjectDirective<VShowElement> & {
|
|
2013
|
+
name: 'show';
|
|
2014
|
+
};
|
|
2015
|
+
declare const systemModifiers: readonly ["ctrl", "shift", "alt", "meta"];
|
|
2016
|
+
type SystemModifiers = (typeof systemModifiers)[number];
|
|
2017
|
+
type CompatModifiers = keyof typeof keyNames;
|
|
2018
|
+
type VOnModifiers = SystemModifiers | ModifierGuards | CompatModifiers;
|
|
2019
|
+
type ModifierGuards = 'shift' | 'ctrl' | 'alt' | 'meta' | 'left' | 'right' | 'stop' | 'prevent' | 'self' | 'middle' | 'exact';
|
|
2020
|
+
/**
|
|
2021
|
+
* @private
|
|
2022
|
+
*/
|
|
2023
|
+
declare const keyNames: Record<'esc' | 'space' | 'up' | 'left' | 'right' | 'down' | 'delete', string>;
|
|
2024
|
+
/**
|
|
2025
|
+
* @private
|
|
2026
|
+
*/
|
|
2027
|
+
type VOnDirective = Directive<any, any, VOnModifiers>;
|
|
2028
|
+
type AssignerFn = (value: any) => void;
|
|
2029
|
+
declare const assignKey: unique symbol;
|
|
2030
|
+
type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<T & {
|
|
2031
|
+
[assignKey]: AssignerFn;
|
|
2032
|
+
_assigning?: boolean;
|
|
2033
|
+
}, any, Modifiers>;
|
|
2034
|
+
declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement, 'trim' | 'number' | 'lazy'>;
|
|
2035
|
+
declare const vModelCheckbox: ModelDirective<HTMLInputElement>;
|
|
2036
|
+
declare const vModelRadio: ModelDirective<HTMLInputElement>;
|
|
2037
|
+
declare const vModelSelect: ModelDirective<HTMLSelectElement, 'number'>;
|
|
2038
|
+
declare const vModelDynamic: ObjectDirective<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
|
|
2039
|
+
type VModelDirective = typeof vModelText | typeof vModelCheckbox | typeof vModelSelect | typeof vModelRadio | typeof vModelDynamic;
|
|
2040
|
+
/**
|
|
2041
|
+
* This is a stub implementation to prevent the need to use dom types.
|
|
2042
|
+
*
|
|
2043
|
+
* To enable proper types, add `"dom"` to `"lib"` in your `tsconfig.json`.
|
|
2044
|
+
*/
|
|
2045
|
+
type DomType<T> = typeof globalThis extends {
|
|
2046
|
+
window: unknown;
|
|
2047
|
+
} ? T : never;
|
|
2048
|
+
declare module '@vue/reactivity' {
|
|
2049
|
+
interface RefUnwrapBailTypes {
|
|
2050
|
+
runtimeDOMBailTypes: DomType<Node | Window>;
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
declare module '@vue/runtime-core' {
|
|
2054
|
+
interface GlobalComponents {
|
|
2055
|
+
Transition: DefineComponent<TransitionProps>;
|
|
2056
|
+
TransitionGroup: DefineComponent<TransitionGroupProps>;
|
|
2057
|
+
}
|
|
2058
|
+
interface GlobalDirectives {
|
|
2059
|
+
vShow: typeof vShow;
|
|
2060
|
+
vOn: VOnDirective;
|
|
2061
|
+
vBind: VModelDirective;
|
|
2062
|
+
vIf: Directive<any, boolean>;
|
|
2063
|
+
vOnce: Directive;
|
|
2064
|
+
vSlot: Directive;
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
//#endregion
|
|
2068
|
+
//#region ../../packages/kit/dist/index.d.mts
|
|
2069
|
+
//#region src/types/components.d.ts
|
|
2070
|
+
/**
|
|
2071
|
+
* @kimesh/kit - Component Types
|
|
2072
|
+
*/
|
|
2073
|
+
interface KimeshComponent {
|
|
2074
|
+
/** Component name as used in templates */
|
|
2075
|
+
name: string;
|
|
2076
|
+
/** Path to the component file */
|
|
2077
|
+
filePath: string;
|
|
2078
|
+
/** Named export to use (default: 'default') */
|
|
2079
|
+
export?: string;
|
|
2080
|
+
/** Component prefix */
|
|
2081
|
+
prefix?: string;
|
|
2082
|
+
/** Register globally */
|
|
2083
|
+
global?: boolean;
|
|
2084
|
+
/** Priority for resolution (higher = preferred) */
|
|
2085
|
+
priority?: number;
|
|
2086
|
+
/** Source layer name */
|
|
2087
|
+
layer?: string;
|
|
2088
|
+
}
|
|
2089
|
+
interface KimeshComponentsDir {
|
|
2090
|
+
/** Path to the components directory */
|
|
2091
|
+
path: string;
|
|
2092
|
+
/** Component prefix */
|
|
2093
|
+
prefix?: string;
|
|
2094
|
+
/** Register globally */
|
|
2095
|
+
global?: boolean;
|
|
2096
|
+
/** Glob pattern for matching components */
|
|
2097
|
+
pattern?: string | string[];
|
|
2098
|
+
/** Patterns to ignore */
|
|
2099
|
+
ignore?: string[];
|
|
2100
|
+
/** File extensions to include */
|
|
2101
|
+
extensions?: string[];
|
|
2102
|
+
/** Enable deep scanning (subdirectories) */
|
|
2103
|
+
deep?: boolean;
|
|
2104
|
+
/** Source layer name */
|
|
2105
|
+
layer?: string;
|
|
2106
|
+
} //#endregion
|
|
2107
|
+
//#region src/types/imports.d.ts
|
|
2108
|
+
/**
|
|
2109
|
+
* @kimesh/kit - Import Types
|
|
2110
|
+
*/
|
|
2111
|
+
interface KimeshImport {
|
|
2112
|
+
/** Import name */
|
|
2113
|
+
name: string;
|
|
2114
|
+
/** Alias for the import */
|
|
2115
|
+
as?: string;
|
|
2116
|
+
/** Module to import from */
|
|
2117
|
+
from: string;
|
|
2118
|
+
/** Is type-only import */
|
|
2119
|
+
type?: boolean;
|
|
2120
|
+
/** Priority for resolution */
|
|
2121
|
+
priority?: number;
|
|
2122
|
+
/** Source layer name */
|
|
2123
|
+
layer?: string;
|
|
2124
|
+
}
|
|
2125
|
+
interface KimeshImportsDir {
|
|
2126
|
+
/** Path to the directory */
|
|
2127
|
+
path: string;
|
|
2128
|
+
/** Only scan these patterns */
|
|
2129
|
+
pattern?: string | string[];
|
|
2130
|
+
/** Patterns to ignore */
|
|
2131
|
+
ignore?: string[];
|
|
2132
|
+
/** Import as type-only */
|
|
2133
|
+
type?: boolean;
|
|
2134
|
+
/** Source layer name */
|
|
2135
|
+
layer?: string;
|
|
2136
|
+
}
|
|
2137
|
+
interface KimeshImportPreset {
|
|
2138
|
+
/** Preset name (e.g., 'vue', 'vue-router') */
|
|
2139
|
+
from: string;
|
|
2140
|
+
/** Imports to include from the preset */
|
|
2141
|
+
imports: string[];
|
|
2142
|
+
/** Import as type-only */
|
|
2143
|
+
type?: boolean;
|
|
2144
|
+
} //#endregion
|
|
2145
|
+
//#region src/types/router.d.ts
|
|
2146
|
+
/**
|
|
2147
|
+
* @kimesh/kit - Router Types
|
|
2148
|
+
*/
|
|
2149
|
+
interface KimeshRoute {
|
|
2150
|
+
/** Route name */
|
|
2151
|
+
name?: string;
|
|
2152
|
+
/** Route path */
|
|
2153
|
+
path: string;
|
|
2154
|
+
/** Component file path */
|
|
2155
|
+
file?: string;
|
|
2156
|
+
/** Child routes */
|
|
2157
|
+
children?: KimeshRoute[];
|
|
2158
|
+
/** Route meta */
|
|
2159
|
+
meta?: Record<string, unknown>;
|
|
2160
|
+
/** Source layer name */
|
|
2161
|
+
layer?: string;
|
|
2162
|
+
}
|
|
2163
|
+
interface KimeshRouteMiddleware {
|
|
2164
|
+
/** Middleware name */
|
|
2165
|
+
name: string;
|
|
2166
|
+
/** Middleware file path */
|
|
2167
|
+
path: string;
|
|
2168
|
+
/** Global middleware (applied to all routes) */
|
|
2169
|
+
global?: boolean;
|
|
2170
|
+
/** Source layer name */
|
|
2171
|
+
layer?: string;
|
|
2172
|
+
} //#endregion
|
|
2173
|
+
//#region src/types/hooks.d.ts
|
|
2174
|
+
type HookResult = void | Promise<void>;
|
|
2175
|
+
/**
|
|
2176
|
+
* Normalized component directory for shadcn extension hook.
|
|
2177
|
+
* Defined inline to avoid circular dependency with @kimesh/shadcn.
|
|
2178
|
+
*/
|
|
2179
|
+
interface ShadcnComponentDir {
|
|
2180
|
+
/** Absolute or relative path to component directory */
|
|
2181
|
+
path: string;
|
|
2182
|
+
/** Component name prefix (e.g., 'Ui' for UiButton) */
|
|
2183
|
+
prefix: string;
|
|
2184
|
+
}
|
|
2185
|
+
/**
|
|
2186
|
+
* Tailwind source entry for extension hook.
|
|
2187
|
+
* Defined inline to avoid circular dependency with @kimesh/tailwindcss.
|
|
2188
|
+
*/
|
|
2189
|
+
interface TailwindSourceEntry {
|
|
2190
|
+
/** Absolute path to source directory */
|
|
2191
|
+
path: string;
|
|
2192
|
+
/** Optional comment in generated CSS */
|
|
2193
|
+
comment?: string;
|
|
2194
|
+
}
|
|
2195
|
+
interface KimeshHooks {
|
|
2196
|
+
/** Called after config is loaded, before layers */
|
|
2197
|
+
'config:loaded': (config: KimeshConfig) => HookResult;
|
|
2198
|
+
/** Called after layers are resolved */
|
|
2199
|
+
'layers:resolved': (layers: ResolvedLayer[]) => HookResult;
|
|
2200
|
+
/** Called to extend layer configuration */
|
|
2201
|
+
'layers:extend': (layers: ResolvedLayer[]) => HookResult;
|
|
2202
|
+
/** Called when Kimesh is fully initialized and ready */
|
|
2203
|
+
ready: (kimesh: Kimesh) => HookResult;
|
|
2204
|
+
/** Called before modules are processed */
|
|
2205
|
+
'modules:before': (kimesh: Kimesh) => HookResult;
|
|
2206
|
+
/** Called after all modules are processed */
|
|
2207
|
+
'modules:done': (kimesh: Kimesh) => HookResult;
|
|
2208
|
+
/** Called before build starts */
|
|
2209
|
+
'build:before': (kimesh: Kimesh) => HookResult;
|
|
2210
|
+
/** Called after build completes */
|
|
2211
|
+
'build:done': (kimesh: Kimesh) => HookResult;
|
|
2212
|
+
/** Called on build error */
|
|
2213
|
+
'build:error': (error: Error, kimesh: Kimesh) => HookResult;
|
|
2214
|
+
/** Called to extend Vite config before it's resolved */
|
|
2215
|
+
'vite:extend': (ctx: {
|
|
2216
|
+
kimesh: Kimesh;
|
|
2217
|
+
config: vite.UserConfig;
|
|
2218
|
+
}) => HookResult;
|
|
2219
|
+
/** Called after Vite config is resolved */
|
|
2220
|
+
'vite:configResolved': (config: ResolvedConfig, kimesh: Kimesh) => HookResult;
|
|
2221
|
+
/** Called when Vite dev server is created */
|
|
2222
|
+
'vite:serverCreated': (server: ViteDevServer, kimesh: Kimesh) => HookResult;
|
|
2223
|
+
/** Called to add import sources/presets */
|
|
2224
|
+
'imports:sources': (sources: Array<{
|
|
2225
|
+
from: string;
|
|
2226
|
+
imports: string[];
|
|
2227
|
+
}>, kimesh: Kimesh) => HookResult;
|
|
2228
|
+
/** Called to extend imports */
|
|
2229
|
+
'imports:extend': (imports: KimeshImport[], kimesh: Kimesh) => HookResult;
|
|
2230
|
+
/** Called to add import directories */
|
|
2231
|
+
'imports:dirs': (dirs: KimeshImportsDir[], kimesh: Kimesh) => HookResult;
|
|
2232
|
+
/** Called to add component directories */
|
|
2233
|
+
'components:dirs': (dirs: KimeshComponentsDir[], kimesh: Kimesh) => HookResult;
|
|
2234
|
+
/** Called to extend components */
|
|
2235
|
+
'components:extend': (components: KimeshComponent[], kimesh: Kimesh) => HookResult;
|
|
2236
|
+
/** Called to add component resolvers */
|
|
2237
|
+
'components:resolvers': (resolvers: ComponentResolver[], kimesh: Kimesh) => HookResult;
|
|
2238
|
+
/** Called after routes are generated */
|
|
2239
|
+
'routes:extend': (routes: KimeshRoute[], kimesh: Kimesh) => HookResult;
|
|
2240
|
+
/** Called to add route middleware */
|
|
2241
|
+
'routes:middleware': (middleware: KimeshRouteMiddleware[], kimesh: Kimesh) => HookResult;
|
|
2242
|
+
/** Called when templates need generation */
|
|
2243
|
+
'templates:extend': (templates: KimeshTemplate[], kimesh: Kimesh) => HookResult;
|
|
2244
|
+
/** Called after templates are written */
|
|
2245
|
+
'templates:done': (templates: KimeshTemplate[], kimesh: Kimesh) => HookResult;
|
|
2246
|
+
/** Called to extend type templates */
|
|
2247
|
+
'types:extend': (typeTemplates: KimeshTypeTemplate[], kimesh: Kimesh) => HookResult;
|
|
2248
|
+
/** Called after types are generated */
|
|
2249
|
+
'types:done': (files: string[], kimesh: Kimesh) => HookResult;
|
|
2250
|
+
/** Called on file change in watch mode */
|
|
2251
|
+
'watch:change': (file: string, event: 'add' | 'change' | 'unlink', kimesh: Kimesh) => HookResult;
|
|
2252
|
+
/** Called before HMR update */
|
|
2253
|
+
'hmr:before': (file: string, kimesh: Kimesh) => HookResult;
|
|
2254
|
+
/** Called after HMR update */
|
|
2255
|
+
'hmr:after': (file: string, kimesh: Kimesh) => HookResult;
|
|
2256
|
+
/** Called when Kimesh is closing */
|
|
2257
|
+
close: (kimesh: Kimesh) => HookResult;
|
|
2258
|
+
/**
|
|
2259
|
+
* Called by @kimesh/shadcn to allow extending modules to add component directories.
|
|
2260
|
+
* Hook handlers can push entries to the componentDirs array.
|
|
2261
|
+
*
|
|
2262
|
+
* @example
|
|
2263
|
+
* ```ts
|
|
2264
|
+
* defineKimeshModule({
|
|
2265
|
+
* hooks: {
|
|
2266
|
+
* 'shadcn:componentDirs:extend': (componentDirs) => {
|
|
2267
|
+
* componentDirs.push({
|
|
2268
|
+
* path: '/path/to/uikit/components',
|
|
2269
|
+
* prefix: 'Ui'
|
|
2270
|
+
* })
|
|
2271
|
+
* }
|
|
2272
|
+
* }
|
|
2273
|
+
* })
|
|
2274
|
+
* ```
|
|
2275
|
+
*/
|
|
2276
|
+
'shadcn:componentDirs:extend': (componentDirs: ShadcnComponentDir[], kimesh: Kimesh) => HookResult;
|
|
2277
|
+
/**
|
|
2278
|
+
* Called by @kimesh/tailwindcss to allow extending modules to add source directories.
|
|
2279
|
+
* Hook handlers can push entries to the sources array.
|
|
2280
|
+
*
|
|
2281
|
+
* @example
|
|
2282
|
+
* ```ts
|
|
2283
|
+
* defineKimeshModule({
|
|
2284
|
+
* hooks: {
|
|
2285
|
+
* 'tailwindcss:sources:extend': (sources) => {
|
|
2286
|
+
* sources.push({
|
|
2287
|
+
* path: '/path/to/uikit/src',
|
|
2288
|
+
* comment: '@onesystem/uikit'
|
|
2289
|
+
* })
|
|
2290
|
+
* }
|
|
2291
|
+
* }
|
|
2292
|
+
* })
|
|
2293
|
+
* ```
|
|
2294
|
+
*/
|
|
2295
|
+
'tailwindcss:sources:extend': (sources: TailwindSourceEntry[], kimesh: Kimesh) => HookResult;
|
|
2296
|
+
} //#endregion
|
|
2297
|
+
//#region src/types/runtime-plugin.d.ts
|
|
2298
|
+
/**
|
|
2299
|
+
* Metadata for runtime plugin ordering and identification
|
|
2300
|
+
*/
|
|
2301
|
+
interface KimeshRuntimePluginMeta {
|
|
2302
|
+
name?: string;
|
|
2303
|
+
enforce?: 'pre' | 'default' | 'post';
|
|
2304
|
+
order?: number;
|
|
2305
|
+
dependsOn?: string[];
|
|
2306
|
+
parallel?: boolean;
|
|
2307
|
+
}
|
|
2308
|
+
/**
|
|
2309
|
+
* Runtime hooks available in Kimesh app lifecycle
|
|
2310
|
+
*/
|
|
2311
|
+
interface KimeshRuntimeHooks {
|
|
2312
|
+
'app:created': (app: App) => void | Promise<void>;
|
|
2313
|
+
'app:beforeMount': (app: App) => void | Promise<void>;
|
|
2314
|
+
'app:mounted': (app: App) => void | Promise<void>;
|
|
2315
|
+
'app:error': (err: unknown) => void | Promise<void>;
|
|
2316
|
+
'page:start': () => void | Promise<void>;
|
|
2317
|
+
'page:finish': () => void | Promise<void>;
|
|
2318
|
+
'navigate:before': (context: {
|
|
2319
|
+
to: unknown;
|
|
2320
|
+
from: unknown;
|
|
2321
|
+
}) => void | false | Promise<void | false>;
|
|
2322
|
+
'navigate:after': (context: {
|
|
2323
|
+
to: unknown;
|
|
2324
|
+
from: unknown;
|
|
2325
|
+
failure?: unknown;
|
|
2326
|
+
}) => void | Promise<void>;
|
|
2327
|
+
'navigate:error': (context: {
|
|
2328
|
+
error: Error;
|
|
2329
|
+
to: unknown;
|
|
2330
|
+
from: unknown;
|
|
2331
|
+
}) => void | Promise<void>;
|
|
2332
|
+
}
|
|
2333
|
+
interface RuntimeConfigPublic {
|
|
2334
|
+
[key: string]: unknown;
|
|
2335
|
+
}
|
|
2336
|
+
/**
|
|
2337
|
+
* Minimal build-time app context. Full runtime version is in @kimesh/router-runtime.
|
|
2338
|
+
*/
|
|
2339
|
+
interface KimeshAppContext {
|
|
2340
|
+
vueApp: App;
|
|
2341
|
+
router: unknown;
|
|
2342
|
+
queryClient: unknown;
|
|
2343
|
+
hooks: {
|
|
2344
|
+
callHook: <T extends keyof KimeshRuntimeHooks>(name: T, ...args: Parameters<KimeshRuntimeHooks[T]>) => Promise<void>;
|
|
2345
|
+
addHooks: (hooks: Partial<KimeshRuntimeHooks>) => void;
|
|
2346
|
+
};
|
|
2347
|
+
provide: <T>(name: string, value: T) => void;
|
|
2348
|
+
$config: RuntimeConfigPublic;
|
|
2349
|
+
isHydrating: boolean;
|
|
2350
|
+
runWithContext: <T extends () => unknown>(fn: T) => ReturnType<T>;
|
|
2351
|
+
}
|
|
2352
|
+
interface KimeshRuntimePluginResult<Injections = Record<string, unknown>> {
|
|
2353
|
+
provide?: Injections;
|
|
2354
|
+
}
|
|
2355
|
+
/** Plugin setup return type */
|
|
2356
|
+
type PluginSetupReturn<Injections> = void | KimeshRuntimePluginResult<Injections> | Promise<void> | Promise<KimeshRuntimePluginResult<Injections>>;
|
|
2357
|
+
/**
|
|
2358
|
+
* Runtime plugin function signature
|
|
2359
|
+
*/
|
|
2360
|
+
interface KimeshRuntimePlugin<Injections = Record<string, unknown>> {
|
|
2361
|
+
(app: KimeshAppContext): PluginSetupReturn<Injections>;
|
|
2362
|
+
__kimesh_plugin?: true;
|
|
2363
|
+
_name?: string;
|
|
2364
|
+
meta?: KimeshRuntimePluginMeta;
|
|
2365
|
+
hooks?: Partial<KimeshRuntimeHooks>;
|
|
2366
|
+
}
|
|
2367
|
+
/**
|
|
2368
|
+
* Object-style runtime plugin definition
|
|
2369
|
+
*/
|
|
2370
|
+
/**
|
|
2371
|
+
* Normalized runtime plugin for registry storage
|
|
2372
|
+
*/
|
|
2373
|
+
interface KimeshRuntimePluginEntry {
|
|
2374
|
+
src?: string;
|
|
2375
|
+
name?: string;
|
|
2376
|
+
meta?: KimeshRuntimePluginMeta;
|
|
2377
|
+
plugin?: KimeshRuntimePlugin;
|
|
2378
|
+
append?: boolean;
|
|
2379
|
+
}
|
|
2380
|
+
//#endregion
|
|
2381
|
+
//#region src/types/kimesh.d.ts
|
|
2382
|
+
interface KimeshTemplate<TData = unknown> {
|
|
2383
|
+
/** Output filename (relative to buildDir) */
|
|
2384
|
+
filename: string;
|
|
2385
|
+
/** Generate template contents */
|
|
2386
|
+
getContents?: (data: TData & {
|
|
2387
|
+
kimesh: Kimesh;
|
|
2388
|
+
}) => string | Promise<string>;
|
|
2389
|
+
/** Source file path (alternative to getContents) */
|
|
2390
|
+
src?: string;
|
|
2391
|
+
/** Write to disk (default: true) */
|
|
2392
|
+
write?: boolean;
|
|
2393
|
+
/** Custom data passed to getContents */
|
|
2394
|
+
data?: TData;
|
|
2395
|
+
}
|
|
2396
|
+
interface KimeshTypeTemplate<TData = unknown> extends KimeshTemplate<TData> {
|
|
2397
|
+
/** Always writes .d.ts files */
|
|
2398
|
+
filename: `${string}.d.ts`;
|
|
2399
|
+
}
|
|
2400
|
+
interface KimeshAlias {
|
|
2401
|
+
/** Alias name (e.g., '#my-alias', '@/components') */
|
|
2402
|
+
find: string | RegExp;
|
|
2403
|
+
/** Path to resolve to */
|
|
2404
|
+
replacement: string;
|
|
2405
|
+
}
|
|
2406
|
+
interface KimeshVitePluginEntry {
|
|
2407
|
+
/** The Vite plugin */
|
|
2408
|
+
plugin: Plugin;
|
|
2409
|
+
/** Plugin enforce order */
|
|
2410
|
+
enforce?: 'pre' | 'post';
|
|
2411
|
+
/** Numeric order (lower = earlier) */
|
|
2412
|
+
order?: number;
|
|
2413
|
+
/** Metadata for debugging */
|
|
2414
|
+
meta?: {
|
|
2415
|
+
name?: string;
|
|
2416
|
+
module?: string;
|
|
2417
|
+
};
|
|
2418
|
+
}
|
|
2419
|
+
interface KimeshRegistries {
|
|
2420
|
+
/** Vite plugins to add */
|
|
2421
|
+
vitePlugins: KimeshVitePluginEntry[];
|
|
2422
|
+
/** Aliases */
|
|
2423
|
+
aliases: KimeshAlias[];
|
|
2424
|
+
/** Templates to generate */
|
|
2425
|
+
templates: KimeshTemplate[];
|
|
2426
|
+
/** Type templates to generate (.d.ts) */
|
|
2427
|
+
typeTemplates: KimeshTypeTemplate[];
|
|
2428
|
+
/** Auto-imports */
|
|
2429
|
+
imports: KimeshImport[];
|
|
2430
|
+
/** Auto-import directories */
|
|
2431
|
+
importsDirs: KimeshImportsDir[];
|
|
2432
|
+
/** Import presets */
|
|
2433
|
+
importsPresets: KimeshImportPreset[];
|
|
2434
|
+
/** Components */
|
|
2435
|
+
components: KimeshComponent[];
|
|
2436
|
+
/** Component directories */
|
|
2437
|
+
componentsDirs: KimeshComponentsDir[];
|
|
2438
|
+
/** Component resolvers */
|
|
2439
|
+
componentResolvers: ComponentResolver[];
|
|
2440
|
+
/** Routes */
|
|
2441
|
+
routes: KimeshRoute[];
|
|
2442
|
+
/** Route middleware */
|
|
2443
|
+
routeMiddleware: KimeshRouteMiddleware[];
|
|
2444
|
+
/** Runtime plugins (execute in Vue app at runtime) */
|
|
2445
|
+
runtimePlugins: KimeshRuntimePluginEntry[];
|
|
2446
|
+
}
|
|
2447
|
+
interface KimeshOptions {
|
|
2448
|
+
/** Whether in development mode */
|
|
2449
|
+
dev: boolean;
|
|
2450
|
+
/** Project root directory */
|
|
2451
|
+
root: string;
|
|
2452
|
+
/** Build output directory (.kimesh) */
|
|
2453
|
+
buildDir: string;
|
|
2454
|
+
/** The Kimesh configuration */
|
|
2455
|
+
config: KimeshConfig;
|
|
2456
|
+
/** Resolved layers */
|
|
2457
|
+
layers: ResolvedLayer[];
|
|
2458
|
+
/** Runtime config (exposed to client/server) */
|
|
2459
|
+
runtimeConfig: {
|
|
2460
|
+
public: Record<string, unknown>;
|
|
2461
|
+
private: Record<string, unknown>;
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
interface Kimesh {
|
|
2465
|
+
/** Kimesh options */
|
|
2466
|
+
readonly options: KimeshOptions;
|
|
2467
|
+
/** Hookable instance for lifecycle hooks */
|
|
2468
|
+
readonly hooks: Hookable<KimeshHooks>;
|
|
2469
|
+
/** Registries for plugins, templates, imports, components, etc. */
|
|
2470
|
+
readonly _registries: KimeshRegistries;
|
|
2471
|
+
/** Resolved layers (shorthand for options.layers) */
|
|
2472
|
+
readonly layers: ResolvedLayer[];
|
|
2473
|
+
/** Project root directory */
|
|
2474
|
+
readonly root: string;
|
|
2475
|
+
/** Build directory (.kimesh) */
|
|
2476
|
+
readonly buildDir: string;
|
|
2477
|
+
/** Register a hook */
|
|
2478
|
+
hook: <T extends keyof KimeshHooks>(name: T, handler: KimeshHooks[T], options?: {
|
|
2479
|
+
allowDeprecated?: boolean;
|
|
2480
|
+
}) => () => void;
|
|
2481
|
+
/** Call a hook */
|
|
2482
|
+
callHook: <T extends keyof KimeshHooks>(name: T, ...args: Parameters<KimeshHooks[T]>) => Promise<void>;
|
|
2483
|
+
/** Register a hook that runs only once */
|
|
2484
|
+
hookOnce: <T extends keyof KimeshHooks>(name: T, handler: KimeshHooks[T]) => () => void;
|
|
2485
|
+
} //#endregion
|
|
2486
|
+
//#region src/types/module.d.ts
|
|
2487
|
+
interface KimeshModuleMeta {
|
|
2488
|
+
/** Module name (npm package name) */
|
|
2489
|
+
name?: string;
|
|
2490
|
+
/** Module version */
|
|
2491
|
+
version?: string;
|
|
2492
|
+
/** Config key in kimesh.config.ts for module options */
|
|
2493
|
+
configKey?: string;
|
|
2494
|
+
/** Compatibility constraints */
|
|
2495
|
+
compatibility?: {
|
|
2496
|
+
/** Minimum Kimesh version required */kimesh?: string; /** Minimum Vite version required */
|
|
2497
|
+
vite?: string;
|
|
2498
|
+
};
|
|
2499
|
+
/**
|
|
2500
|
+
* Modules to auto-load before this module.
|
|
2501
|
+
* Extended modules will be resolved and their hooks registered
|
|
2502
|
+
* before this module's setup() is called.
|
|
2503
|
+
*
|
|
2504
|
+
* @example
|
|
2505
|
+
* ```ts
|
|
2506
|
+
* defineKimeshModule({
|
|
2507
|
+
* meta: {
|
|
2508
|
+
* name: '@onesystem/uikit',
|
|
2509
|
+
* extends: ['@kimesh/shadcn', '@kimesh/tailwindcss'],
|
|
2510
|
+
* },
|
|
2511
|
+
* // ...
|
|
2512
|
+
* })
|
|
2513
|
+
* ```
|
|
2514
|
+
*/
|
|
2515
|
+
extends?: string[];
|
|
2516
|
+
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Module defaults can be:
|
|
2519
|
+
* - A static object
|
|
2520
|
+
* - A function that receives Kimesh and returns defaults (sync or async)
|
|
2521
|
+
*/
|
|
2522
|
+
type KimeshModuleDefaults<TOptions> = TOptions | ((kimesh: Kimesh) => TOptions | Promise<TOptions>);
|
|
2523
|
+
interface KimeshModuleDefinition<TOptions = Record<string, unknown>> {
|
|
2524
|
+
/** Module metadata */
|
|
2525
|
+
meta?: KimeshModuleMeta;
|
|
2526
|
+
/** Default options (can be function for dynamic defaults) */
|
|
2527
|
+
defaults?: KimeshModuleDefaults<Partial<TOptions>>;
|
|
2528
|
+
/** Shorthand hook registration */
|
|
2529
|
+
hooks?: Partial<KimeshHooks>;
|
|
2530
|
+
/**
|
|
2531
|
+
* Setup function called after layers are resolved
|
|
2532
|
+
* @param options - Merged options (defaults + user config)
|
|
2533
|
+
* @param kimesh - Kimesh context
|
|
2534
|
+
*/
|
|
2535
|
+
setup?: (options: TOptions, kimesh: Kimesh) => void | Promise<void>;
|
|
2536
|
+
}
|
|
2537
|
+
/**
|
|
2538
|
+
* A resolved Kimesh module
|
|
2539
|
+
*/
|
|
2540
|
+
interface KimeshModule<TOptions = Record<string, unknown>> {
|
|
2541
|
+
/** Module definition */
|
|
2542
|
+
_def: KimeshModuleDefinition<TOptions>;
|
|
2543
|
+
/** Module meta (resolved) */
|
|
2544
|
+
meta: Required<KimeshModuleMeta>;
|
|
2545
|
+
/** Get default options */
|
|
2546
|
+
getDefaults: (kimesh: Kimesh) => Promise<Partial<TOptions>>;
|
|
2547
|
+
/** Setup function */
|
|
2548
|
+
setup: (options: TOptions, kimesh: Kimesh) => void | Promise<void>;
|
|
2549
|
+
}
|
|
2550
|
+
/**
|
|
2551
|
+
* Module input in config - can be:
|
|
2552
|
+
* - A string package name (resolved from node_modules)
|
|
2553
|
+
* - A module object
|
|
2554
|
+
* - A tuple of [module, options]
|
|
2555
|
+
* - A tuple of [string, options]
|
|
2556
|
+
*/
|
|
2557
|
+
type KimeshModuleInput<TOptions = any> = string | KimeshModule<TOptions> | [KimeshModule<TOptions>, Partial<TOptions>] | [string, Partial<TOptions>];
|
|
2558
|
+
//#endregion
|
|
2559
|
+
//#region src/types/config.d.ts
|
|
2560
|
+
/**
|
|
2561
|
+
* Runtime configuration that can be overridden by environment variables.
|
|
2562
|
+
*
|
|
2563
|
+
* Values are resolved at build-time via Vite's `define` mechanism.
|
|
2564
|
+
* Use `KIMESH_*` environment variables to override values.
|
|
2565
|
+
*
|
|
2566
|
+
* @example
|
|
2567
|
+
* ```ts
|
|
2568
|
+
* // In kimesh.config.ts
|
|
2569
|
+
* runtimeConfig: {
|
|
2570
|
+
* apiBase: '/api', // KIMESH_API_BASE
|
|
2571
|
+
* debug: false, // KIMESH_DEBUG=true
|
|
2572
|
+
* features: {
|
|
2573
|
+
* darkMode: true, // KIMESH_FEATURES_DARK_MODE
|
|
2574
|
+
* }
|
|
2575
|
+
* }
|
|
2576
|
+
* ```
|
|
2577
|
+
*/
|
|
2578
|
+
interface RuntimeConfig {
|
|
2579
|
+
[key: string]: string | number | boolean | null | undefined | RuntimeConfig;
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Layer configuration in kimesh.config.ts
|
|
2583
|
+
*/
|
|
2584
|
+
interface LayersConfig {
|
|
2585
|
+
/** Directories to scan for layers (default: ['layers']) */
|
|
2586
|
+
dirs?: string[];
|
|
2587
|
+
/** Layers to enable - 'all' | 'none' | string[] */
|
|
2588
|
+
enabled?: 'all' | 'none' | string[];
|
|
2589
|
+
/** Layers to exclude */
|
|
2590
|
+
excluded?: string[];
|
|
2591
|
+
}
|
|
2592
|
+
/**
|
|
2593
|
+
* Auto-import configuration in kimesh.config.ts
|
|
2594
|
+
*/
|
|
2595
|
+
interface AutoImportOptions {
|
|
2596
|
+
/** Enable auto-imports (default: true) */
|
|
2597
|
+
enabled?: boolean;
|
|
2598
|
+
/** Directories to scan for composables */
|
|
2599
|
+
dirs?: string[];
|
|
2600
|
+
/** External import presets (vue, vue-router, etc.) */
|
|
2601
|
+
presets?: string[];
|
|
2602
|
+
/** Custom import sources */
|
|
2603
|
+
imports?: Array<{
|
|
2604
|
+
from: string;
|
|
2605
|
+
imports: string[];
|
|
2606
|
+
type?: boolean;
|
|
2607
|
+
}>;
|
|
2608
|
+
/** Generate .d.ts files (default: true) */
|
|
2609
|
+
dts?: boolean;
|
|
2610
|
+
}
|
|
2611
|
+
/**
|
|
2612
|
+
* Component auto-import configuration
|
|
2613
|
+
*/
|
|
2614
|
+
interface ComponentsConfig {
|
|
2615
|
+
/** Enable component auto-imports (default: true) */
|
|
2616
|
+
enabled?: boolean;
|
|
2617
|
+
/** Directories to scan */
|
|
2618
|
+
dirs?: string[];
|
|
2619
|
+
/** Component prefix */
|
|
2620
|
+
prefix?: string;
|
|
2621
|
+
/** Global component registration */
|
|
2622
|
+
global?: boolean;
|
|
2623
|
+
}
|
|
2624
|
+
/**
|
|
2625
|
+
* Vite configuration options for Kimesh.
|
|
2626
|
+
*/
|
|
2627
|
+
interface KimeshViteConfig extends Omit<UserConfig, 'root' | 'configFile'> {
|
|
2628
|
+
/**
|
|
2629
|
+
* Additional Vite plugins.
|
|
2630
|
+
* These are merged AFTER Kimesh's internal plugins.
|
|
2631
|
+
*/
|
|
2632
|
+
plugins?: PluginOption[];
|
|
2633
|
+
}
|
|
2634
|
+
/**
|
|
2635
|
+
* Default aliases provided by Kimesh.
|
|
2636
|
+
* Templates use placeholders: <srcDir>, <rootDir>
|
|
2637
|
+
* These are replaced at build time with actual paths.
|
|
2638
|
+
*
|
|
2639
|
+
* NOTE: `~` and `@` are NOT included here because they are handled by
|
|
2640
|
+
* the layer-alias-plugin for context-aware resolution. The plugin resolves
|
|
2641
|
+
* these aliases relative to the importing file's layer, not globally.
|
|
2642
|
+
*
|
|
2643
|
+
* @see packages/kit/src/vite/layer-alias-plugin.ts
|
|
2644
|
+
*/
|
|
2645
|
+
/**
|
|
2646
|
+
* Debug mode configuration for detailed logging and diagnostics.
|
|
2647
|
+
*/
|
|
2648
|
+
interface DebugConfig {
|
|
2649
|
+
/**
|
|
2650
|
+
* Log hook execution with timing information
|
|
2651
|
+
* @default false
|
|
2652
|
+
*/
|
|
2653
|
+
hooks?: boolean;
|
|
2654
|
+
/**
|
|
2655
|
+
* Log module loading and setup
|
|
2656
|
+
* @default false
|
|
2657
|
+
*/
|
|
2658
|
+
modules?: boolean;
|
|
2659
|
+
/**
|
|
2660
|
+
* Log layer resolution
|
|
2661
|
+
* @default false
|
|
2662
|
+
*/
|
|
2663
|
+
layers?: boolean;
|
|
2664
|
+
/**
|
|
2665
|
+
* Log configuration loading and merging
|
|
2666
|
+
* @default false
|
|
2667
|
+
*/
|
|
2668
|
+
config?: boolean;
|
|
2669
|
+
/**
|
|
2670
|
+
* Log Vite plugin operations
|
|
2671
|
+
* @default false
|
|
2672
|
+
*/
|
|
2673
|
+
vite?: boolean;
|
|
2674
|
+
/**
|
|
2675
|
+
* Log route generation
|
|
2676
|
+
* @default false
|
|
2677
|
+
*/
|
|
2678
|
+
routes?: boolean;
|
|
2679
|
+
/**
|
|
2680
|
+
* Log auto-import resolution
|
|
2681
|
+
* @default false
|
|
2682
|
+
*/
|
|
2683
|
+
imports?: boolean;
|
|
2684
|
+
}
|
|
2685
|
+
/**
|
|
2686
|
+
* Default file/folder ignore patterns
|
|
2687
|
+
*/
|
|
2688
|
+
/**
|
|
2689
|
+
* Options for file ignore patterns (passed to node-ignore)
|
|
2690
|
+
*/
|
|
2691
|
+
interface IgnoreOptions {
|
|
2692
|
+
/**
|
|
2693
|
+
* Whether matching is case-insensitive
|
|
2694
|
+
* @default false
|
|
2695
|
+
*/
|
|
2696
|
+
ignorecase?: boolean;
|
|
2697
|
+
}
|
|
2698
|
+
/**
|
|
2699
|
+
* Per-route configuration rules.
|
|
2700
|
+
* Keys are route patterns (supports wildcards).
|
|
2701
|
+
*
|
|
2702
|
+
* @example
|
|
2703
|
+
* ```ts
|
|
2704
|
+
* routeRules: {
|
|
2705
|
+
* '/admin/**': {
|
|
2706
|
+
* redirect: '/login',
|
|
2707
|
+
* },
|
|
2708
|
+
* '/api/**': {
|
|
2709
|
+
* headers: { 'Cache-Control': 'no-store' },
|
|
2710
|
+
* },
|
|
2711
|
+
* '/static/**': {
|
|
2712
|
+
* prerender: true,
|
|
2713
|
+
* },
|
|
2714
|
+
* }
|
|
2715
|
+
* ```
|
|
2716
|
+
*/
|
|
2717
|
+
interface RouteRule {
|
|
2718
|
+
/**
|
|
2719
|
+
* Redirect to another path
|
|
2720
|
+
* Can be a string path or an object with statusCode
|
|
2721
|
+
*/
|
|
2722
|
+
redirect?: string | {
|
|
2723
|
+
to: string;
|
|
2724
|
+
statusCode?: 301 | 302 | 307 | 308;
|
|
2725
|
+
};
|
|
2726
|
+
/**
|
|
2727
|
+
* Pre-render this route at build time (for static generation)
|
|
2728
|
+
* @default false
|
|
2729
|
+
*/
|
|
2730
|
+
prerender?: boolean;
|
|
2731
|
+
/**
|
|
2732
|
+
* Cache configuration for this route
|
|
2733
|
+
*/
|
|
2734
|
+
cache?: boolean | {
|
|
2735
|
+
/**
|
|
2736
|
+
* Cache max age in seconds
|
|
2737
|
+
*/
|
|
2738
|
+
maxAge?: number;
|
|
2739
|
+
/**
|
|
2740
|
+
* Stale-while-revalidate in seconds
|
|
2741
|
+
*/
|
|
2742
|
+
swr?: number;
|
|
2743
|
+
/**
|
|
2744
|
+
* Cache key modifiers
|
|
2745
|
+
*/
|
|
2746
|
+
varies?: string[];
|
|
2747
|
+
};
|
|
2748
|
+
/**
|
|
2749
|
+
* Custom headers to set for this route
|
|
2750
|
+
*/
|
|
2751
|
+
headers?: Record<string, string>;
|
|
2752
|
+
/**
|
|
2753
|
+
* CORS configuration for this route
|
|
2754
|
+
*/
|
|
2755
|
+
cors?: boolean | {
|
|
2756
|
+
origin?: string | string[];
|
|
2757
|
+
methods?: string[];
|
|
2758
|
+
headers?: string[];
|
|
2759
|
+
credentials?: boolean;
|
|
2760
|
+
};
|
|
2761
|
+
/**
|
|
2762
|
+
* Custom meta data for the route
|
|
2763
|
+
*/
|
|
2764
|
+
meta?: Record<string, unknown>;
|
|
2765
|
+
}
|
|
2766
|
+
/**
|
|
2767
|
+
* Directory configuration for Kimesh.
|
|
2768
|
+
* Customizes the default directory structure.
|
|
2769
|
+
*/
|
|
2770
|
+
interface DirectoryConfig {
|
|
2771
|
+
/**
|
|
2772
|
+
* Directory for static assets
|
|
2773
|
+
* @default 'assets'
|
|
2774
|
+
*/
|
|
2775
|
+
assets?: string;
|
|
2776
|
+
/**
|
|
2777
|
+
* Directory for runtime plugins
|
|
2778
|
+
* @default 'plugins'
|
|
2779
|
+
*/
|
|
2780
|
+
plugins?: string;
|
|
2781
|
+
/**
|
|
2782
|
+
* Directory for public static files
|
|
2783
|
+
* @default 'public'
|
|
2784
|
+
*/
|
|
2785
|
+
public?: string;
|
|
2786
|
+
/**
|
|
2787
|
+
* Directory for shared code across the app
|
|
2788
|
+
* @default 'shared'
|
|
2789
|
+
*/
|
|
2790
|
+
shared?: string;
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Bundle analyzer configuration options.
|
|
2794
|
+
*/
|
|
2795
|
+
interface AnalyzeConfig {
|
|
2796
|
+
/**
|
|
2797
|
+
* Enable the bundle analyzer
|
|
2798
|
+
* @default false
|
|
2799
|
+
*/
|
|
2800
|
+
enabled?: boolean;
|
|
2801
|
+
/**
|
|
2802
|
+
* Automatically open analyzer report in browser
|
|
2803
|
+
* @default false
|
|
2804
|
+
*/
|
|
2805
|
+
openAnalyzer?: boolean;
|
|
2806
|
+
/**
|
|
2807
|
+
* Custom filename for the report
|
|
2808
|
+
* @default 'report.html'
|
|
2809
|
+
*/
|
|
2810
|
+
reportFilename?: string;
|
|
2811
|
+
}
|
|
2812
|
+
/**
|
|
2813
|
+
* Build configuration for Kimesh.
|
|
2814
|
+
* Controls production build behavior.
|
|
2815
|
+
*/
|
|
2816
|
+
interface BuildConfig {
|
|
2817
|
+
/**
|
|
2818
|
+
* Enable bundle analysis. Shows a visualization of bundle contents.
|
|
2819
|
+
*
|
|
2820
|
+
* @example
|
|
2821
|
+
* ```ts
|
|
2822
|
+
* build: {
|
|
2823
|
+
* analyze: true,
|
|
2824
|
+
* // or with options:
|
|
2825
|
+
* analyze: {
|
|
2826
|
+
* enabled: true,
|
|
2827
|
+
* openAnalyzer: false,
|
|
2828
|
+
* reportFilename: 'stats.html',
|
|
2829
|
+
* },
|
|
2830
|
+
* }
|
|
2831
|
+
* ```
|
|
2832
|
+
*/
|
|
2833
|
+
analyze?: boolean | AnalyzeConfig;
|
|
2834
|
+
/**
|
|
2835
|
+
* Generate source maps for production builds.
|
|
2836
|
+
* - `true`: Generate separate source map files
|
|
2837
|
+
* - `'hidden'`: Generate source maps but don't reference them in bundles
|
|
2838
|
+
* - `'inline'`: Inline source maps into bundles
|
|
2839
|
+
* - `false`: No source maps
|
|
2840
|
+
*
|
|
2841
|
+
* @default false
|
|
2842
|
+
*/
|
|
2843
|
+
sourcemap?: boolean | 'hidden' | 'inline';
|
|
2844
|
+
/**
|
|
2845
|
+
* Build target for esbuild/terser.
|
|
2846
|
+
* Specifies the JS language version to target.
|
|
2847
|
+
*
|
|
2848
|
+
* @default 'esnext'
|
|
2849
|
+
*/
|
|
2850
|
+
target?: string;
|
|
2851
|
+
/**
|
|
2852
|
+
* Minification strategy for production builds.
|
|
2853
|
+
* - `true`: Use default minifier (oxc)
|
|
2854
|
+
* - `'oxc'`: Fast minification with OXC (Vite 8 native)
|
|
2855
|
+
* - `'terser'`: More aggressive minification with terser
|
|
2856
|
+
* - `'esbuild'`: Legacy esbuild minification
|
|
2857
|
+
* - `false`: No minification
|
|
2858
|
+
*
|
|
2859
|
+
* @default 'oxc'
|
|
2860
|
+
*/
|
|
2861
|
+
minify?: boolean | 'oxc' | 'esbuild' | 'terser';
|
|
2862
|
+
}
|
|
2863
|
+
/**
|
|
2864
|
+
* HTTPS configuration options for dev server.
|
|
2865
|
+
*/
|
|
2866
|
+
interface HttpsConfig {
|
|
2867
|
+
/**
|
|
2868
|
+
* Path to SSL key file
|
|
2869
|
+
*/
|
|
2870
|
+
key?: string;
|
|
2871
|
+
/**
|
|
2872
|
+
* Path to SSL certificate file
|
|
2873
|
+
*/
|
|
2874
|
+
cert?: string;
|
|
2875
|
+
}
|
|
2876
|
+
/**
|
|
2877
|
+
* Proxy target configuration.
|
|
2878
|
+
*/
|
|
2879
|
+
interface ProxyOptions {
|
|
2880
|
+
/**
|
|
2881
|
+
* Target URL to proxy to
|
|
2882
|
+
*/
|
|
2883
|
+
target: string;
|
|
2884
|
+
/**
|
|
2885
|
+
* Change the origin header to match target
|
|
2886
|
+
* @default true
|
|
2887
|
+
*/
|
|
2888
|
+
changeOrigin?: boolean;
|
|
2889
|
+
/**
|
|
2890
|
+
* Rewrite the URL path
|
|
2891
|
+
*/
|
|
2892
|
+
rewrite?: (path: string) => string;
|
|
2893
|
+
/**
|
|
2894
|
+
* Whether to proxy WebSocket connections
|
|
2895
|
+
* @default false
|
|
2896
|
+
*/
|
|
2897
|
+
ws?: boolean;
|
|
2898
|
+
/**
|
|
2899
|
+
* SSL verification options
|
|
2900
|
+
*/
|
|
2901
|
+
secure?: boolean;
|
|
2902
|
+
/**
|
|
2903
|
+
* Custom headers to send with the proxy request
|
|
2904
|
+
*/
|
|
2905
|
+
headers?: Record<string, string>;
|
|
2906
|
+
}
|
|
2907
|
+
/**
|
|
2908
|
+
* CORS configuration options for dev server.
|
|
2909
|
+
*/
|
|
2910
|
+
interface CorsOptions {
|
|
2911
|
+
/**
|
|
2912
|
+
* Allowed origins
|
|
2913
|
+
* @default '*'
|
|
2914
|
+
*/
|
|
2915
|
+
origin?: string | string[] | boolean;
|
|
2916
|
+
/**
|
|
2917
|
+
* Allowed HTTP methods
|
|
2918
|
+
* @default ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE']
|
|
2919
|
+
*/
|
|
2920
|
+
methods?: string[];
|
|
2921
|
+
/**
|
|
2922
|
+
* Allowed headers
|
|
2923
|
+
*/
|
|
2924
|
+
allowedHeaders?: string[];
|
|
2925
|
+
/**
|
|
2926
|
+
* Headers exposed to the client
|
|
2927
|
+
*/
|
|
2928
|
+
exposedHeaders?: string[];
|
|
2929
|
+
/**
|
|
2930
|
+
* Allow credentials (cookies, authorization headers)
|
|
2931
|
+
* @default false
|
|
2932
|
+
*/
|
|
2933
|
+
credentials?: boolean;
|
|
2934
|
+
/**
|
|
2935
|
+
* Max age for preflight request caching (seconds)
|
|
2936
|
+
* @default 86400
|
|
2937
|
+
*/
|
|
2938
|
+
maxAge?: number;
|
|
2939
|
+
}
|
|
2940
|
+
/**
|
|
2941
|
+
* Enhanced development server configuration.
|
|
2942
|
+
*/
|
|
2943
|
+
interface DevServerConfig {
|
|
2944
|
+
/**
|
|
2945
|
+
* Port to listen on
|
|
2946
|
+
* @default 3000
|
|
2947
|
+
*/
|
|
2948
|
+
port?: number;
|
|
2949
|
+
/**
|
|
2950
|
+
* Host to bind to.
|
|
2951
|
+
* - `'localhost'`: Only accessible from this machine
|
|
2952
|
+
* - `true` or `'0.0.0.0'`: Accessible from network
|
|
2953
|
+
*
|
|
2954
|
+
* @default 'localhost'
|
|
2955
|
+
*/
|
|
2956
|
+
host?: string | boolean;
|
|
2957
|
+
/**
|
|
2958
|
+
* Automatically open browser when server starts
|
|
2959
|
+
* @default false
|
|
2960
|
+
*/
|
|
2961
|
+
open?: boolean;
|
|
2962
|
+
/**
|
|
2963
|
+
* Enable HTTPS for dev server.
|
|
2964
|
+
* Set to `true` to use auto-generated certificates,
|
|
2965
|
+
* or provide custom key/cert paths.
|
|
2966
|
+
*
|
|
2967
|
+
* @example
|
|
2968
|
+
* ```ts
|
|
2969
|
+
* dev: {
|
|
2970
|
+
* https: true, // Auto-generate certificates
|
|
2971
|
+
* // or with custom certs:
|
|
2972
|
+
* https: {
|
|
2973
|
+
* key: './certs/localhost.key',
|
|
2974
|
+
* cert: './certs/localhost.crt',
|
|
2975
|
+
* },
|
|
2976
|
+
* }
|
|
2977
|
+
* ```
|
|
2978
|
+
*/
|
|
2979
|
+
https?: boolean | HttpsConfig;
|
|
2980
|
+
/**
|
|
2981
|
+
* Configure proxy rules for dev server.
|
|
2982
|
+
* Useful for API proxying during development.
|
|
2983
|
+
*
|
|
2984
|
+
* @example
|
|
2985
|
+
* ```ts
|
|
2986
|
+
* dev: {
|
|
2987
|
+
* proxy: {
|
|
2988
|
+
* '/api': 'http://localhost:8080',
|
|
2989
|
+
* '/socket': {
|
|
2990
|
+
* target: 'ws://localhost:8081',
|
|
2991
|
+
* ws: true,
|
|
2992
|
+
* },
|
|
2993
|
+
* },
|
|
2994
|
+
* }
|
|
2995
|
+
* ```
|
|
2996
|
+
*/
|
|
2997
|
+
proxy?: Record<string, string | ProxyOptions>;
|
|
2998
|
+
/**
|
|
2999
|
+
* Configure CORS for dev server.
|
|
3000
|
+
* Set to `true` to enable default CORS settings.
|
|
3001
|
+
*
|
|
3002
|
+
* @default false
|
|
3003
|
+
*/
|
|
3004
|
+
cors?: boolean | CorsOptions;
|
|
3005
|
+
/**
|
|
3006
|
+
* Exit if the specified port is already in use
|
|
3007
|
+
* @default false
|
|
3008
|
+
*/
|
|
3009
|
+
strictPort?: boolean;
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* TypeScript configuration options for Kimesh.
|
|
3013
|
+
*/
|
|
3014
|
+
interface TypeScriptConfig {
|
|
3015
|
+
/**
|
|
3016
|
+
* Enable strict TypeScript mode.
|
|
3017
|
+
* When true, adds strict compiler options to generated tsconfig.
|
|
3018
|
+
*
|
|
3019
|
+
* @default true
|
|
3020
|
+
*/
|
|
3021
|
+
strict?: boolean;
|
|
3022
|
+
/**
|
|
3023
|
+
* Enable type checking during development and/or build.
|
|
3024
|
+
* - `true`: Enable type checking during both dev and build
|
|
3025
|
+
* - `'build'`: Only type check during build
|
|
3026
|
+
* - `false`: Disable type checking
|
|
3027
|
+
*
|
|
3028
|
+
* @default false
|
|
3029
|
+
*/
|
|
3030
|
+
typeCheck?: boolean | 'build';
|
|
3031
|
+
/**
|
|
3032
|
+
* Additional tsconfig compiler options to merge with generated config.
|
|
3033
|
+
* These options will extend the auto-generated `.kimesh/tsconfig.json`.
|
|
3034
|
+
*
|
|
3035
|
+
* @example
|
|
3036
|
+
* ```ts
|
|
3037
|
+
* typescript: {
|
|
3038
|
+
* tsConfig: {
|
|
3039
|
+
* compilerOptions: {
|
|
3040
|
+
* experimentalDecorators: true,
|
|
3041
|
+
* emitDecoratorMetadata: true,
|
|
3042
|
+
* },
|
|
3043
|
+
* },
|
|
3044
|
+
* }
|
|
3045
|
+
* ```
|
|
3046
|
+
*/
|
|
3047
|
+
tsConfig?: {
|
|
3048
|
+
compilerOptions?: Record<string, unknown>;
|
|
3049
|
+
include?: string[];
|
|
3050
|
+
exclude?: string[];
|
|
3051
|
+
references?: Array<{
|
|
3052
|
+
path: string;
|
|
3053
|
+
}>;
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
/**
|
|
3057
|
+
* Chokidar watch options (simplified subset).
|
|
3058
|
+
* @see https://github.com/paulmillr/chokidar#api
|
|
3059
|
+
*/
|
|
3060
|
+
interface ChokidarOptions {
|
|
3061
|
+
/**
|
|
3062
|
+
* Indicates whether the process should continue as long as files are being watched
|
|
3063
|
+
* @default true
|
|
3064
|
+
*/
|
|
3065
|
+
persistent?: boolean;
|
|
3066
|
+
/**
|
|
3067
|
+
* Patterns to ignore
|
|
3068
|
+
*/
|
|
3069
|
+
ignored?: string | RegExp | string[] | ((path: string) => boolean);
|
|
3070
|
+
/**
|
|
3071
|
+
* Use polling instead of native events
|
|
3072
|
+
* @default false
|
|
3073
|
+
*/
|
|
3074
|
+
usePolling?: boolean;
|
|
3075
|
+
/**
|
|
3076
|
+
* Polling interval in milliseconds (if usePolling is true)
|
|
3077
|
+
* @default 100
|
|
3078
|
+
*/
|
|
3079
|
+
interval?: number;
|
|
3080
|
+
/**
|
|
3081
|
+
* Polling interval for binary files (if usePolling is true)
|
|
3082
|
+
* @default 300
|
|
3083
|
+
*/
|
|
3084
|
+
binaryInterval?: number;
|
|
3085
|
+
/**
|
|
3086
|
+
* Delay in milliseconds for stabilized 'add' events
|
|
3087
|
+
* @default 2000
|
|
3088
|
+
*/
|
|
3089
|
+
awaitWriteFinish?: boolean | {
|
|
3090
|
+
stabilityThreshold?: number;
|
|
3091
|
+
pollInterval?: number;
|
|
3092
|
+
};
|
|
3093
|
+
/**
|
|
3094
|
+
* Use file descriptor watching instead of stat polling
|
|
3095
|
+
* @default false
|
|
3096
|
+
*/
|
|
3097
|
+
atomic?: boolean | number;
|
|
3098
|
+
/**
|
|
3099
|
+
* Watch depth limit (how many levels to traverse)
|
|
3100
|
+
* @default undefined (no limit)
|
|
3101
|
+
*/
|
|
3102
|
+
depth?: number;
|
|
3103
|
+
}
|
|
3104
|
+
/**
|
|
3105
|
+
* Watchers configuration for advanced file watching control.
|
|
3106
|
+
*/
|
|
3107
|
+
interface WatchersConfig {
|
|
3108
|
+
/**
|
|
3109
|
+
* Chokidar options for file watching
|
|
3110
|
+
*/
|
|
3111
|
+
chokidar?: ChokidarOptions;
|
|
3112
|
+
/**
|
|
3113
|
+
* Webpack watch options (for future use if needed)
|
|
3114
|
+
*/
|
|
3115
|
+
webpack?: {
|
|
3116
|
+
aggregateTimeout?: number;
|
|
3117
|
+
poll?: boolean | number;
|
|
3118
|
+
ignored?: string | RegExp | string[];
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
/**
|
|
3122
|
+
* Module options interface - augmented by modules via declaration merging.
|
|
3123
|
+
*
|
|
3124
|
+
* Modules augment this interface to add their config keys.
|
|
3125
|
+
* The keys become available in defineKmConfig once the module is installed.
|
|
3126
|
+
*
|
|
3127
|
+
* @example
|
|
3128
|
+
* ```ts
|
|
3129
|
+
* // In @kimesh/tailwindcss/types.ts:
|
|
3130
|
+
* declare module '@kimesh/kit' {
|
|
3131
|
+
* interface KimeshModuleOptions {
|
|
3132
|
+
* tailwindcss?: KimeshTailwindConfig
|
|
3133
|
+
* }
|
|
3134
|
+
* }
|
|
3135
|
+
* ```
|
|
3136
|
+
*/
|
|
3137
|
+
interface KimeshModuleOptions {
|
|
3138
|
+
[key: string]: unknown;
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* App-level configuration
|
|
3142
|
+
*/
|
|
3143
|
+
interface AppConfig {
|
|
3144
|
+
/**
|
|
3145
|
+
* Global head configuration for the app
|
|
3146
|
+
* Automatically enables @kimesh/head plugin when configured
|
|
3147
|
+
*/
|
|
3148
|
+
head?: {
|
|
3149
|
+
/** Page title */title?: string; /** Title template (e.g., '%s | My App') */
|
|
3150
|
+
titleTemplate?: string | ((title: string) => string); /** Meta tags */
|
|
3151
|
+
meta?: Array<Record<string, string | undefined>>; /** Link tags */
|
|
3152
|
+
link?: Array<Record<string, string | undefined>>; /** Script tags */
|
|
3153
|
+
script?: Array<Record<string, string | boolean | undefined>>; /** Style tags */
|
|
3154
|
+
style?: Array<Record<string, string | undefined>>; /** HTML attributes */
|
|
3155
|
+
htmlAttrs?: Record<string, string | undefined>; /** Body attributes */
|
|
3156
|
+
bodyAttrs?: Record<string, string | undefined>;
|
|
3157
|
+
};
|
|
3158
|
+
}
|
|
3159
|
+
/**
|
|
3160
|
+
* Kimesh configuration (kimesh.config.ts)
|
|
3161
|
+
*
|
|
3162
|
+
* Module options are typed via the KimeshModuleOptions interface.
|
|
3163
|
+
* Modules can augment this interface to add typesafe config keys.
|
|
3164
|
+
*/
|
|
3165
|
+
interface KimeshConfig extends KimeshModuleOptions {
|
|
3166
|
+
/** Application/layer name */
|
|
3167
|
+
name?: string;
|
|
3168
|
+
/** Base path for routes (for layers) */
|
|
3169
|
+
basePath?: string;
|
|
3170
|
+
/**
|
|
3171
|
+
* Define additional aliases to access custom directories within your JavaScript and CSS.
|
|
3172
|
+
*
|
|
3173
|
+
* Aliases are automatically added to the generated TypeScript configurations
|
|
3174
|
+
* for full type support and path auto-complete.
|
|
3175
|
+
*
|
|
3176
|
+
* NOTE: `~` and `@` are NOT included in default aliases. They are handled
|
|
3177
|
+
* by layer-alias-plugin for context-aware resolution - resolving to the
|
|
3178
|
+
* current layer's path, not the global host app path.
|
|
3179
|
+
*
|
|
3180
|
+
* @default { "~~": "/<rootDir>", "@@": "/<rootDir>", "#build": "/<rootDir>/.kimesh" }
|
|
3181
|
+
*
|
|
3182
|
+
* @example
|
|
3183
|
+
* ```ts
|
|
3184
|
+
* import { fileURLToPath } from 'node:url'
|
|
3185
|
+
*
|
|
3186
|
+
* export default defineKmConfig({
|
|
3187
|
+
* alias: {
|
|
3188
|
+
* 'images': fileURLToPath(new URL('./assets/images', import.meta.url)),
|
|
3189
|
+
* 'style': fileURLToPath(new URL('./assets/style', import.meta.url)),
|
|
3190
|
+
* },
|
|
3191
|
+
* })
|
|
3192
|
+
* ```
|
|
3193
|
+
*/
|
|
3194
|
+
alias?: Record<string, string>;
|
|
3195
|
+
/**
|
|
3196
|
+
* Set to `true` to enable debug mode.
|
|
3197
|
+
*
|
|
3198
|
+
* Prints out hook names and timings, logs hook arguments,
|
|
3199
|
+
* and provides detailed information about module loading and layer resolution.
|
|
3200
|
+
*
|
|
3201
|
+
* @default false
|
|
3202
|
+
*
|
|
3203
|
+
* @example
|
|
3204
|
+
* ```ts
|
|
3205
|
+
* export default defineKmConfig({
|
|
3206
|
+
* debug: true,
|
|
3207
|
+
* // or with specific options:
|
|
3208
|
+
* debug: {
|
|
3209
|
+
* hooks: true,
|
|
3210
|
+
* modules: true,
|
|
3211
|
+
* layers: true,
|
|
3212
|
+
* },
|
|
3213
|
+
* })
|
|
3214
|
+
* ```
|
|
3215
|
+
*/
|
|
3216
|
+
debug?: boolean | DebugConfig;
|
|
3217
|
+
/**
|
|
3218
|
+
* Hooks are listeners to Kimesh events that are typically used in modules,
|
|
3219
|
+
* but are also available in `kimesh.config.ts`.
|
|
3220
|
+
*
|
|
3221
|
+
* Internally, hooks follow a naming pattern using colons (e.g., build:done).
|
|
3222
|
+
* For ease of configuration, you can structure them as an hierarchical object.
|
|
3223
|
+
*
|
|
3224
|
+
* @example
|
|
3225
|
+
* ```ts
|
|
3226
|
+
* export default defineKmConfig({
|
|
3227
|
+
* hooks: {
|
|
3228
|
+
* 'ready': (kimesh) => {
|
|
3229
|
+
* console.log('Kimesh is ready!')
|
|
3230
|
+
* },
|
|
3231
|
+
* 'build:done': (kimesh) => {
|
|
3232
|
+
* console.log('Build completed!')
|
|
3233
|
+
* },
|
|
3234
|
+
* },
|
|
3235
|
+
* })
|
|
3236
|
+
* ```
|
|
3237
|
+
*/
|
|
3238
|
+
hooks?: Partial<KimeshHooks>;
|
|
3239
|
+
/**
|
|
3240
|
+
* Files matching glob patterns specified inside the `ignore` array
|
|
3241
|
+
* will be ignored in building.
|
|
3242
|
+
*
|
|
3243
|
+
* More customizable than `ignorePrefix`: allows complex patterns.
|
|
3244
|
+
*
|
|
3245
|
+
* @default ["**\/*.stories.{js,cts,mts,ts,jsx,tsx}", "**\/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}", "**\/*.d.{cts,mts,ts}", ".kimesh"]
|
|
3246
|
+
*
|
|
3247
|
+
* @example
|
|
3248
|
+
* ```ts
|
|
3249
|
+
* export default defineKmConfig({
|
|
3250
|
+
* ignore: [
|
|
3251
|
+
* '**\/__tests__/**',
|
|
3252
|
+
* '**\/*.mock.ts',
|
|
3253
|
+
* 'legacy/**',
|
|
3254
|
+
* ],
|
|
3255
|
+
* })
|
|
3256
|
+
* ```
|
|
3257
|
+
*/
|
|
3258
|
+
ignore?: string[];
|
|
3259
|
+
/**
|
|
3260
|
+
* Any file in routes, layouts, middleware directories will be ignored
|
|
3261
|
+
* during the build process if its filename starts with the prefix specified.
|
|
3262
|
+
*
|
|
3263
|
+
* @default "-"
|
|
3264
|
+
*
|
|
3265
|
+
* @example
|
|
3266
|
+
* ```ts
|
|
3267
|
+
* export default defineKmConfig({
|
|
3268
|
+
* ignorePrefix: '_', // Ignore files starting with underscore
|
|
3269
|
+
* })
|
|
3270
|
+
* ```
|
|
3271
|
+
*/
|
|
3272
|
+
ignorePrefix?: string;
|
|
3273
|
+
/**
|
|
3274
|
+
* Pass options directly to `node-ignore` (which is used by Kimesh to ignore files).
|
|
3275
|
+
*
|
|
3276
|
+
* @see https://github.com/kaelzhang/node-ignore
|
|
3277
|
+
*
|
|
3278
|
+
* @example
|
|
3279
|
+
* ```ts
|
|
3280
|
+
* export default defineKmConfig({
|
|
3281
|
+
* ignoreOptions: {
|
|
3282
|
+
* ignorecase: false, // Case-sensitive matching
|
|
3283
|
+
* },
|
|
3284
|
+
* })
|
|
3285
|
+
* ```
|
|
3286
|
+
*/
|
|
3287
|
+
ignoreOptions?: IgnoreOptions;
|
|
3288
|
+
/**
|
|
3289
|
+
* Global route rules applied to matching routes.
|
|
3290
|
+
*
|
|
3291
|
+
* Keys are route patterns (supports wildcards with **).
|
|
3292
|
+
* Useful for redirects, caching, and per-route configuration.
|
|
3293
|
+
*
|
|
3294
|
+
* @experimental This feature's API may change in the future.
|
|
3295
|
+
*
|
|
3296
|
+
* @example
|
|
3297
|
+
* ```ts
|
|
3298
|
+
* export default defineKmConfig({
|
|
3299
|
+
* routeRules: {
|
|
3300
|
+
* '/admin/**': {
|
|
3301
|
+
* redirect: '/login',
|
|
3302
|
+
* },
|
|
3303
|
+
* '/api/**': {
|
|
3304
|
+
* headers: { 'Cache-Control': 'no-store' },
|
|
3305
|
+
* cors: true,
|
|
3306
|
+
* },
|
|
3307
|
+
* '/blog/**': {
|
|
3308
|
+
* prerender: true,
|
|
3309
|
+
* },
|
|
3310
|
+
* },
|
|
3311
|
+
* })
|
|
3312
|
+
* ```
|
|
3313
|
+
*/
|
|
3314
|
+
routeRules?: Record<string, RouteRule>;
|
|
3315
|
+
/**
|
|
3316
|
+
* Source directory for your application code.
|
|
3317
|
+
* All relative paths are resolved from this directory.
|
|
3318
|
+
*
|
|
3319
|
+
* @default 'src'
|
|
3320
|
+
*
|
|
3321
|
+
* @example
|
|
3322
|
+
* ```ts
|
|
3323
|
+
* export default defineKmConfig({
|
|
3324
|
+
* srcDir: 'app', // Use 'app' instead of 'src'
|
|
3325
|
+
* })
|
|
3326
|
+
* ```
|
|
3327
|
+
*/
|
|
3328
|
+
srcDir?: string;
|
|
3329
|
+
/**
|
|
3330
|
+
* Build output directory for Kimesh's generated files.
|
|
3331
|
+
* Contains TypeScript configs, generated routes, and other build artifacts.
|
|
3332
|
+
*
|
|
3333
|
+
* @default '.kimesh'
|
|
3334
|
+
*
|
|
3335
|
+
* @example
|
|
3336
|
+
* ```ts
|
|
3337
|
+
* export default defineKmConfig({
|
|
3338
|
+
* buildDir: '.output', // Use '.output' instead of '.kimesh'
|
|
3339
|
+
* })
|
|
3340
|
+
* ```
|
|
3341
|
+
*/
|
|
3342
|
+
buildDir?: string;
|
|
3343
|
+
/**
|
|
3344
|
+
* Directory configuration for customizing the project structure.
|
|
3345
|
+
*
|
|
3346
|
+
* @example
|
|
3347
|
+
* ```ts
|
|
3348
|
+
* export default defineKmConfig({
|
|
3349
|
+
* dir: {
|
|
3350
|
+
* assets: 'static/assets',
|
|
3351
|
+
* plugins: 'app/plugins',
|
|
3352
|
+
* public: 'public',
|
|
3353
|
+
* shared: 'lib/shared',
|
|
3354
|
+
* },
|
|
3355
|
+
* })
|
|
3356
|
+
* ```
|
|
3357
|
+
*/
|
|
3358
|
+
dir?: DirectoryConfig;
|
|
3359
|
+
/**
|
|
3360
|
+
* Build configuration for production builds.
|
|
3361
|
+
*
|
|
3362
|
+
* @example
|
|
3363
|
+
* ```ts
|
|
3364
|
+
* export default defineKmConfig({
|
|
3365
|
+
* build: {
|
|
3366
|
+
* analyze: true,
|
|
3367
|
+
* sourcemap: 'hidden',
|
|
3368
|
+
* target: 'es2022',
|
|
3369
|
+
* minify: 'oxc',
|
|
3370
|
+
* },
|
|
3371
|
+
* })
|
|
3372
|
+
* ```
|
|
3373
|
+
*/
|
|
3374
|
+
build?: BuildConfig;
|
|
3375
|
+
/**
|
|
3376
|
+
* Enhanced development server configuration.
|
|
3377
|
+
* Supports HTTPS, proxy, CORS, and more.
|
|
3378
|
+
*
|
|
3379
|
+
* @example
|
|
3380
|
+
* ```ts
|
|
3381
|
+
* export default defineKmConfig({
|
|
3382
|
+
* dev: {
|
|
3383
|
+
* port: 3000,
|
|
3384
|
+
* host: 'localhost',
|
|
3385
|
+
* open: true,
|
|
3386
|
+
* https: true,
|
|
3387
|
+
* proxy: {
|
|
3388
|
+
* '/api': 'http://localhost:8080',
|
|
3389
|
+
* },
|
|
3390
|
+
* cors: true,
|
|
3391
|
+
* strictPort: false,
|
|
3392
|
+
* },
|
|
3393
|
+
* })
|
|
3394
|
+
* ```
|
|
3395
|
+
*/
|
|
3396
|
+
dev?: DevServerConfig;
|
|
3397
|
+
/**
|
|
3398
|
+
* TypeScript configuration options.
|
|
3399
|
+
*
|
|
3400
|
+
* @example
|
|
3401
|
+
* ```ts
|
|
3402
|
+
* export default defineKmConfig({
|
|
3403
|
+
* typescript: {
|
|
3404
|
+
* strict: true,
|
|
3405
|
+
* typeCheck: 'build',
|
|
3406
|
+
* tsConfig: {
|
|
3407
|
+
* compilerOptions: {
|
|
3408
|
+
* experimentalDecorators: true,
|
|
3409
|
+
* },
|
|
3410
|
+
* },
|
|
3411
|
+
* },
|
|
3412
|
+
* })
|
|
3413
|
+
* ```
|
|
3414
|
+
*/
|
|
3415
|
+
typescript?: TypeScriptConfig;
|
|
3416
|
+
/**
|
|
3417
|
+
* Additional file patterns to watch during development.
|
|
3418
|
+
* Uses glob patterns relative to the project root.
|
|
3419
|
+
*
|
|
3420
|
+
* @example
|
|
3421
|
+
* ```ts
|
|
3422
|
+
* export default defineKmConfig({
|
|
3423
|
+
* watch: [
|
|
3424
|
+
* './custom-dir/**\/*',
|
|
3425
|
+
* './config/**\/*.json',
|
|
3426
|
+
* ],
|
|
3427
|
+
* })
|
|
3428
|
+
* ```
|
|
3429
|
+
*/
|
|
3430
|
+
watch?: string[];
|
|
3431
|
+
/**
|
|
3432
|
+
* Advanced watcher configuration.
|
|
3433
|
+
* Customize chokidar options for file watching.
|
|
3434
|
+
*
|
|
3435
|
+
* @example
|
|
3436
|
+
* ```ts
|
|
3437
|
+
* export default defineKmConfig({
|
|
3438
|
+
* watchers: {
|
|
3439
|
+
* chokidar: {
|
|
3440
|
+
* usePolling: true,
|
|
3441
|
+
* interval: 1000,
|
|
3442
|
+
* ignored: ['**\/.git/**'],
|
|
3443
|
+
* },
|
|
3444
|
+
* },
|
|
3445
|
+
* })
|
|
3446
|
+
* ```
|
|
3447
|
+
*/
|
|
3448
|
+
watchers?: WatchersConfig;
|
|
3449
|
+
/** Router configuration */
|
|
3450
|
+
router?: {
|
|
3451
|
+
/** Routes directory relative to srcDir (default: 'routes') */routesDir?: string; /** Import mode for route components */
|
|
3452
|
+
importMode?: 'async' | 'sync';
|
|
3453
|
+
};
|
|
3454
|
+
/** Extend from other layers (paths or package names) */
|
|
3455
|
+
extends?: Array<string | {
|
|
3456
|
+
name: string;
|
|
3457
|
+
path?: string;
|
|
3458
|
+
}>;
|
|
3459
|
+
/** Layers configuration */
|
|
3460
|
+
layers?: LayersConfig;
|
|
3461
|
+
/**
|
|
3462
|
+
* Kimesh modules to load
|
|
3463
|
+
*/
|
|
3464
|
+
modules?: KimeshModuleInput[];
|
|
3465
|
+
/**
|
|
3466
|
+
* App-level configuration
|
|
3467
|
+
* Includes head management and other app-wide settings
|
|
3468
|
+
*/
|
|
3469
|
+
app?: AppConfig;
|
|
3470
|
+
/** Routes configuration (for layers) */
|
|
3471
|
+
routes?: {
|
|
3472
|
+
/** Base path for all routes */basePath?: string; /** Routes folder name */
|
|
3473
|
+
folder?: string;
|
|
3474
|
+
};
|
|
3475
|
+
/** Auto-import configuration */
|
|
3476
|
+
autoImport?: AutoImportOptions;
|
|
3477
|
+
/** Component auto-import configuration */
|
|
3478
|
+
components?: ComponentsConfig;
|
|
3479
|
+
/** Composables configuration (for layers) */
|
|
3480
|
+
composables?: {
|
|
3481
|
+
/** Directories to scan */dirs?: string[];
|
|
3482
|
+
};
|
|
3483
|
+
/** CSS files to include */
|
|
3484
|
+
css?: string[];
|
|
3485
|
+
/**
|
|
3486
|
+
* Vite configuration options.
|
|
3487
|
+
*/
|
|
3488
|
+
vite?: KimeshViteConfig;
|
|
3489
|
+
/**
|
|
3490
|
+
* Runtime configuration with environment variable override support.
|
|
3491
|
+
*
|
|
3492
|
+
* In Phase 1, all config is client-side (build-time injection).
|
|
3493
|
+
* Use KIMESH_* environment variables to override values.
|
|
3494
|
+
*
|
|
3495
|
+
* @example
|
|
3496
|
+
* ```ts
|
|
3497
|
+
* runtimeConfig: {
|
|
3498
|
+
* apiBase: '/api', // KIMESH_API_BASE
|
|
3499
|
+
* debug: false, // KIMESH_DEBUG=true
|
|
3500
|
+
* features: {
|
|
3501
|
+
* darkMode: true, // KIMESH_FEATURES_DARK_MODE
|
|
3502
|
+
* }
|
|
3503
|
+
* }
|
|
3504
|
+
* ```
|
|
3505
|
+
*/
|
|
3506
|
+
runtimeConfig?: RuntimeConfig;
|
|
3507
|
+
}
|
|
3508
|
+
/**
|
|
3509
|
+
* Define Kimesh configuration with type inference.
|
|
3510
|
+
*/
|
|
3511
|
+
//#endregion
|
|
3512
|
+
//#region ../../packages/kit/types.d.ts
|
|
3513
|
+
/**
|
|
3514
|
+
* Function type for defineKmConfig
|
|
3515
|
+
*/
|
|
3516
|
+
type DefineKmConfig = (config: KimeshConfig) => KimeshConfig;
|
|
3517
|
+
declare global {
|
|
3518
|
+
/**
|
|
3519
|
+
* Define Kimesh configuration with type inference.
|
|
3520
|
+
* This function is available globally in kimesh.config.ts files.
|
|
3521
|
+
*
|
|
3522
|
+
* @example
|
|
3523
|
+
* ```ts
|
|
3524
|
+
* export default defineKmConfig({
|
|
3525
|
+
* name: 'my-app',
|
|
3526
|
+
* dev: {
|
|
3527
|
+
* port: 3000,
|
|
3528
|
+
* },
|
|
3529
|
+
* })
|
|
3530
|
+
* ```
|
|
3531
|
+
*/
|
|
3532
|
+
const defineKmConfig: DefineKmConfig;
|
|
3533
|
+
}
|
|
3534
|
+
//#endregion
|
|
4
3535
|
//#region src/types.d.ts
|
|
5
3536
|
/**
|
|
6
3537
|
* Configuration options for the Kimesh TailwindCSS module
|
|
@@ -52,7 +3583,7 @@ interface KimeshTailwindConfig {
|
|
|
52
3583
|
* })
|
|
53
3584
|
* ```
|
|
54
3585
|
*/
|
|
55
|
-
declare const _default:
|
|
3586
|
+
declare const _default: KimeshModule<KimeshTailwindConfig>;
|
|
56
3587
|
//#endregion
|
|
57
3588
|
//#region src/transform.d.ts
|
|
58
3589
|
/**
|