@cfp-studio/plugin-vue3 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.mts +5 -0
  3. package/dist/index.d.ts +5 -0
  4. package/dist/index.mjs +656 -0
  5. package/package.json +51 -0
  6. package/preview/index.ts +141 -0
  7. package/preview/modules/@vue/compiler-core/LICENSE +21 -0
  8. package/preview/modules/@vue/compiler-core/README.md +1 -0
  9. package/preview/modules/@vue/compiler-core/dist/compiler-core.cjs.js +6813 -0
  10. package/preview/modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6690 -0
  11. package/preview/modules/@vue/compiler-core/dist/compiler-core.d.ts +1091 -0
  12. package/preview/modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js +5790 -0
  13. package/preview/modules/@vue/compiler-core/index.js +7 -0
  14. package/preview/modules/@vue/compiler-core/node_modules/.bin/parser +17 -0
  15. package/preview/modules/@vue/compiler-core/package.json +58 -0
  16. package/preview/modules/@vue/compiler-sfc/LICENSE +21 -0
  17. package/preview/modules/@vue/compiler-sfc/README.md +80 -0
  18. package/preview/modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +24970 -0
  19. package/preview/modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +484 -0
  20. package/preview/modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +53043 -0
  21. package/preview/modules/@vue/compiler-sfc/node_modules/.bin/parser +17 -0
  22. package/preview/modules/@vue/compiler-sfc/package.json +67 -0
  23. package/preview/modules/@vue/reactivity/LICENSE +21 -0
  24. package/preview/modules/@vue/reactivity/README.md +19 -0
  25. package/preview/modules/@vue/reactivity/dist/reactivity.cjs.js +1939 -0
  26. package/preview/modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1789 -0
  27. package/preview/modules/@vue/reactivity/dist/reactivity.d.ts +754 -0
  28. package/preview/modules/@vue/reactivity/dist/reactivity.esm-browser.js +1938 -0
  29. package/preview/modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js +5 -0
  30. package/preview/modules/@vue/reactivity/dist/reactivity.esm-bundler.js +1896 -0
  31. package/preview/modules/@vue/reactivity/dist/reactivity.global.js +1994 -0
  32. package/preview/modules/@vue/reactivity/dist/reactivity.global.prod.js +5 -0
  33. package/preview/modules/@vue/reactivity/index.js +7 -0
  34. package/preview/modules/@vue/reactivity/package.json +55 -0
  35. package/preview/modules/@vue/runtime-core/LICENSE +21 -0
  36. package/preview/modules/@vue/runtime-core/README.md +28 -0
  37. package/preview/modules/@vue/runtime-core/dist/runtime-core.cjs.js +8493 -0
  38. package/preview/modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6654 -0
  39. package/preview/modules/@vue/runtime-core/dist/runtime-core.d.ts +1832 -0
  40. package/preview/modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +8419 -0
  41. package/preview/modules/@vue/runtime-core/index.js +7 -0
  42. package/preview/modules/@vue/runtime-core/package.json +52 -0
  43. package/preview/modules/@vue/runtime-dom/LICENSE +21 -0
  44. package/preview/modules/@vue/runtime-dom/README.md +13 -0
  45. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.cjs.js +1820 -0
  46. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1669 -0
  47. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.d.ts +1395 -0
  48. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +12332 -0
  49. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +5 -0
  50. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1860 -0
  51. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.global.js +12383 -0
  52. package/preview/modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js +5 -0
  53. package/preview/modules/@vue/runtime-dom/index.js +7 -0
  54. package/preview/modules/@vue/runtime-dom/package.json +60 -0
  55. package/preview/modules/@vue/shared/LICENSE +21 -0
  56. package/preview/modules/@vue/shared/README.md +3 -0
  57. package/preview/modules/@vue/shared/dist/shared.cjs.js +594 -0
  58. package/preview/modules/@vue/shared/dist/shared.cjs.prod.js +594 -0
  59. package/preview/modules/@vue/shared/dist/shared.d.ts +328 -0
  60. package/preview/modules/@vue/shared/dist/shared.esm-bundler.js +519 -0
  61. package/preview/modules/@vue/shared/index.js +7 -0
  62. package/preview/modules/@vue/shared/package.json +47 -0
  63. package/preview/modules/vue/LICENSE +21 -0
  64. package/preview/modules/vue/README.md +62 -0
  65. package/preview/modules/vue/compiler-sfc/index.browser.js +1 -0
  66. package/preview/modules/vue/compiler-sfc/index.browser.mjs +1 -0
  67. package/preview/modules/vue/compiler-sfc/index.d.mts +1 -0
  68. package/preview/modules/vue/compiler-sfc/index.d.ts +1 -0
  69. package/preview/modules/vue/compiler-sfc/index.js +3 -0
  70. package/preview/modules/vue/compiler-sfc/index.mjs +3 -0
  71. package/preview/modules/vue/compiler-sfc/package.json +4 -0
  72. package/preview/modules/vue/compiler-sfc/register-ts.js +3 -0
  73. package/preview/modules/vue/dist/vue.cjs.js +80 -0
  74. package/preview/modules/vue/dist/vue.cjs.prod.js +66 -0
  75. package/preview/modules/vue/dist/vue.d.mts +7 -0
  76. package/preview/modules/vue/dist/vue.d.ts +7 -0
  77. package/preview/modules/vue/dist/vue.esm-browser.js +18216 -0
  78. package/preview/modules/vue/dist/vue.esm-browser.prod.js +9 -0
  79. package/preview/modules/vue/dist/vue.esm-bundler.js +71 -0
  80. package/preview/modules/vue/dist/vue.global.js +18096 -0
  81. package/preview/modules/vue/dist/vue.global.prod.js +9 -0
  82. package/preview/modules/vue/dist/vue.runtime.esm-browser.js +12355 -0
  83. package/preview/modules/vue/dist/vue.runtime.esm-browser.prod.js +5 -0
  84. package/preview/modules/vue/dist/vue.runtime.esm-bundler.js +26 -0
  85. package/preview/modules/vue/dist/vue.runtime.global.js +12407 -0
  86. package/preview/modules/vue/dist/vue.runtime.global.prod.js +5 -0
  87. package/preview/modules/vue/index.js +7 -0
  88. package/preview/modules/vue/index.mjs +1 -0
  89. package/preview/modules/vue/jsx-runtime/index.d.ts +25 -0
  90. package/preview/modules/vue/jsx-runtime/index.js +15 -0
  91. package/preview/modules/vue/jsx-runtime/index.mjs +12 -0
  92. package/preview/modules/vue/jsx-runtime/package.json +5 -0
  93. package/preview/modules/vue/jsx.d.ts +22 -0
  94. package/preview/modules/vue/node_modules/.bin/tsc +17 -0
  95. package/preview/modules/vue/node_modules/.bin/tsserver +17 -0
  96. package/preview/modules/vue/package.json +112 -0
  97. package/preview/modules/vue/server-renderer/index.d.mts +1 -0
  98. package/preview/modules/vue/server-renderer/index.d.ts +1 -0
  99. package/preview/modules/vue/server-renderer/index.js +1 -0
  100. package/preview/modules/vue/server-renderer/index.mjs +1 -0
  101. package/preview/modules/vue/server-renderer/package.json +4 -0
  102. package/preview/tsconfig.json +8 -0
@@ -0,0 +1,484 @@
1
+ import * as _babel_types from '@babel/types';
2
+ import { Statement, Expression, TSType, Node, Program, CallExpression, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types';
3
+ import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, RawSourceMap, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
4
+ export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core';
5
+ import { ParserPlugin } from '@babel/parser';
6
+ export { parse as babelParse } from '@babel/parser';
7
+ import { Result, LazyResult } from 'postcss';
8
+ import MagicString from 'magic-string';
9
+ export { default as MagicString } from 'magic-string';
10
+ import TS from 'typescript';
11
+
12
+ export interface AssetURLTagConfig {
13
+ [name: string]: string[];
14
+ }
15
+ export interface AssetURLOptions {
16
+ /**
17
+ * If base is provided, instead of transforming relative asset urls into
18
+ * imports, they will be directly rewritten to absolute urls.
19
+ */
20
+ base?: string | null;
21
+ /**
22
+ * If true, also processes absolute urls.
23
+ */
24
+ includeAbsolute?: boolean;
25
+ tags?: AssetURLTagConfig;
26
+ }
27
+
28
+ export interface TemplateCompiler {
29
+ compile(source: string | RootNode, options: CompilerOptions): CodegenResult;
30
+ parse(template: string, options: ParserOptions): RootNode;
31
+ }
32
+ export interface SFCTemplateCompileResults {
33
+ code: string;
34
+ ast?: RootNode;
35
+ preamble?: string;
36
+ source: string;
37
+ tips: string[];
38
+ errors: (string | CompilerError)[];
39
+ map?: RawSourceMap;
40
+ }
41
+ export interface SFCTemplateCompileOptions {
42
+ source: string;
43
+ ast?: RootNode;
44
+ filename: string;
45
+ id: string;
46
+ scoped?: boolean;
47
+ slotted?: boolean;
48
+ isProd?: boolean;
49
+ ssr?: boolean;
50
+ ssrCssVars?: string[];
51
+ inMap?: RawSourceMap;
52
+ compiler?: TemplateCompiler;
53
+ compilerOptions?: CompilerOptions;
54
+ preprocessLang?: string;
55
+ preprocessOptions?: any;
56
+ /**
57
+ * In some cases, compiler-sfc may not be inside the project root (e.g. when
58
+ * linked or globally installed). In such cases a custom `require` can be
59
+ * passed to correctly resolve the preprocessors.
60
+ */
61
+ preprocessCustomRequire?: (id: string) => any;
62
+ /**
63
+ * Configure what tags/attributes to transform into asset url imports,
64
+ * or disable the transform altogether with `false`.
65
+ */
66
+ transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
67
+ }
68
+ export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
69
+
70
+ export interface SFCScriptCompileOptions {
71
+ /**
72
+ * Scope ID for prefixing injected CSS variables.
73
+ * This must be consistent with the `id` passed to `compileStyle`.
74
+ */
75
+ id: string;
76
+ /**
77
+ * Production mode. Used to determine whether to generate hashed CSS variables
78
+ */
79
+ isProd?: boolean;
80
+ /**
81
+ * Enable/disable source map. Defaults to true.
82
+ */
83
+ sourceMap?: boolean;
84
+ /**
85
+ * https://babeljs.io/docs/en/babel-parser#plugins
86
+ */
87
+ babelParserPlugins?: ParserPlugin[];
88
+ /**
89
+ * A list of files to parse for global types to be made available for type
90
+ * resolving in SFC macros. The list must be fully resolved file system paths.
91
+ */
92
+ globalTypeFiles?: string[];
93
+ /**
94
+ * Compile the template and inline the resulting render function
95
+ * directly inside setup().
96
+ * - Only affects `<script setup>`
97
+ * - This should only be used in production because it prevents the template
98
+ * from being hot-reloaded separately from component state.
99
+ */
100
+ inlineTemplate?: boolean;
101
+ /**
102
+ * Generate the final component as a variable instead of default export.
103
+ * This is useful in e.g. @vitejs/plugin-vue where the script needs to be
104
+ * placed inside the main module.
105
+ */
106
+ genDefaultAs?: string;
107
+ /**
108
+ * Options for template compilation when inlining. Note these are options that
109
+ * would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
110
+ * options passed to `compiler-dom`.
111
+ */
112
+ templateOptions?: Partial<SFCTemplateCompileOptions>;
113
+ /**
114
+ * Hoist <script setup> static constants.
115
+ * - Only enables when one `<script setup>` exists.
116
+ * @default true
117
+ */
118
+ hoistStatic?: boolean;
119
+ /**
120
+ * Set to `false` to disable reactive destructure for `defineProps` (pre-3.5
121
+ * behavior), or set to `'error'` to throw hard error on props destructures.
122
+ * @default true
123
+ */
124
+ propsDestructure?: boolean | 'error';
125
+ /**
126
+ * File system access methods to be used when resolving types
127
+ * imported in SFC macros. Defaults to ts.sys in Node.js, can be overwritten
128
+ * to use a virtual file system for use in browsers (e.g. in REPLs)
129
+ */
130
+ fs?: {
131
+ fileExists(file: string): boolean;
132
+ readFile(file: string): string | undefined;
133
+ realpath?(file: string): string;
134
+ };
135
+ /**
136
+ * Transform Vue SFCs into custom elements.
137
+ */
138
+ customElement?: boolean | ((filename: string) => boolean);
139
+ }
140
+ interface ImportBinding {
141
+ isType: boolean;
142
+ imported: string;
143
+ local: string;
144
+ source: string;
145
+ isFromSetup: boolean;
146
+ isUsedInTemplate: boolean;
147
+ }
148
+ /**
149
+ * Compile `<script setup>`
150
+ * It requires the whole SFC descriptor because we need to handle and merge
151
+ * normal `<script>` + `<script setup>` if both are present.
152
+ */
153
+ export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
154
+
155
+ export interface SFCParseOptions {
156
+ filename?: string;
157
+ sourceMap?: boolean;
158
+ sourceRoot?: string;
159
+ pad?: boolean | 'line' | 'space';
160
+ ignoreEmpty?: boolean;
161
+ compiler?: TemplateCompiler;
162
+ templateParseOptions?: ParserOptions;
163
+ }
164
+ export interface SFCBlock {
165
+ type: string;
166
+ content: string;
167
+ attrs: Record<string, string | true>;
168
+ loc: SourceLocation;
169
+ map?: RawSourceMap;
170
+ lang?: string;
171
+ src?: string;
172
+ }
173
+ export interface SFCTemplateBlock extends SFCBlock {
174
+ type: 'template';
175
+ ast?: RootNode;
176
+ }
177
+ export interface SFCScriptBlock extends SFCBlock {
178
+ type: 'script';
179
+ setup?: string | boolean;
180
+ bindings?: BindingMetadata$1;
181
+ imports?: Record<string, ImportBinding>;
182
+ scriptAst?: _babel_types.Statement[];
183
+ scriptSetupAst?: _babel_types.Statement[];
184
+ warnings?: string[];
185
+ /**
186
+ * Fully resolved dependency file paths (unix slashes) with imported types
187
+ * used in macros, used for HMR cache busting in @vitejs/plugin-vue and
188
+ * vue-loader.
189
+ */
190
+ deps?: string[];
191
+ }
192
+ export interface SFCStyleBlock extends SFCBlock {
193
+ type: 'style';
194
+ scoped?: boolean;
195
+ module?: string | boolean;
196
+ }
197
+ export interface SFCDescriptor {
198
+ filename: string;
199
+ source: string;
200
+ template: SFCTemplateBlock | null;
201
+ script: SFCScriptBlock | null;
202
+ scriptSetup: SFCScriptBlock | null;
203
+ styles: SFCStyleBlock[];
204
+ customBlocks: SFCBlock[];
205
+ cssVars: string[];
206
+ /**
207
+ * whether the SFC uses :slotted() modifier.
208
+ * this is used as a compiler optimization hint.
209
+ */
210
+ slotted: boolean;
211
+ /**
212
+ * compare with an existing descriptor to determine whether HMR should perform
213
+ * a reload vs. re-render.
214
+ *
215
+ * Note: this comparison assumes the prev/next script are already identical,
216
+ * and only checks the special case where <script setup lang="ts"> unused import
217
+ * pruning result changes due to template changes.
218
+ */
219
+ shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
220
+ }
221
+ export interface SFCParseResult {
222
+ descriptor: SFCDescriptor;
223
+ errors: (CompilerError | SyntaxError)[];
224
+ }
225
+ export declare function parse(source: string, options?: SFCParseOptions): SFCParseResult;
226
+
227
+ type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
228
+
229
+ export interface SFCStyleCompileOptions {
230
+ source: string;
231
+ filename: string;
232
+ id: string;
233
+ scoped?: boolean;
234
+ trim?: boolean;
235
+ isProd?: boolean;
236
+ inMap?: RawSourceMap;
237
+ preprocessLang?: PreprocessLang;
238
+ preprocessOptions?: any;
239
+ preprocessCustomRequire?: (id: string) => any;
240
+ postcssOptions?: any;
241
+ postcssPlugins?: any[];
242
+ /**
243
+ * @deprecated use `inMap` instead.
244
+ */
245
+ map?: RawSourceMap;
246
+ }
247
+ /**
248
+ * Aligns with postcss-modules
249
+ * https://github.com/css-modules/postcss-modules
250
+ */
251
+ interface CSSModulesOptions {
252
+ scopeBehaviour?: 'global' | 'local';
253
+ generateScopedName?: string | ((name: string, filename: string, css: string) => string);
254
+ hashPrefix?: string;
255
+ localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
256
+ exportGlobals?: boolean;
257
+ globalModulePaths?: RegExp[];
258
+ }
259
+ export interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
260
+ isAsync?: boolean;
261
+ modules?: boolean;
262
+ modulesOptions?: CSSModulesOptions;
263
+ }
264
+ export interface SFCStyleCompileResults {
265
+ code: string;
266
+ map: RawSourceMap | undefined;
267
+ rawResult: Result | LazyResult | undefined;
268
+ errors: Error[];
269
+ modules?: Record<string, string>;
270
+ dependencies: Set<string>;
271
+ }
272
+ export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
273
+ export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
274
+
275
+ export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
276
+ /**
277
+ * Utility for rewriting `export default` in a script block into a variable
278
+ * declaration so that we can inject things into it
279
+ */
280
+ export declare function rewriteDefaultAST(ast: Statement[], s: MagicString, as: string): void;
281
+
282
+ type PropsDestructureBindings = Record<string, // public prop key
283
+ {
284
+ local: string;
285
+ default?: Expression;
286
+ }>;
287
+ export declare function extractRuntimeProps(ctx: TypeResolveContext): string | undefined;
288
+
289
+ interface ModelDecl {
290
+ type: TSType | undefined;
291
+ options: string | undefined;
292
+ identifier: string | undefined;
293
+ runtimeOptionNodes: Node[];
294
+ }
295
+
296
+ declare enum BindingTypes {
297
+ /**
298
+ * returned from data()
299
+ */
300
+ DATA = "data",
301
+ /**
302
+ * declared as a prop
303
+ */
304
+ PROPS = "props",
305
+ /**
306
+ * a local alias of a `<script setup>` destructured prop.
307
+ * the original is stored in __propsAliases of the bindingMetadata object.
308
+ */
309
+ PROPS_ALIASED = "props-aliased",
310
+ /**
311
+ * a let binding (may or may not be a ref)
312
+ */
313
+ SETUP_LET = "setup-let",
314
+ /**
315
+ * a const binding that can never be a ref.
316
+ * these bindings don't need `unref()` calls when processed in inlined
317
+ * template expressions.
318
+ */
319
+ SETUP_CONST = "setup-const",
320
+ /**
321
+ * a const binding that does not need `unref()`, but may be mutated.
322
+ */
323
+ SETUP_REACTIVE_CONST = "setup-reactive-const",
324
+ /**
325
+ * a const binding that may be a ref.
326
+ */
327
+ SETUP_MAYBE_REF = "setup-maybe-ref",
328
+ /**
329
+ * bindings that are guaranteed to be refs
330
+ */
331
+ SETUP_REF = "setup-ref",
332
+ /**
333
+ * declared by other options, e.g. computed, inject
334
+ */
335
+ OPTIONS = "options",
336
+ /**
337
+ * a literal constant, e.g. 'foo', 1, true
338
+ */
339
+ LITERAL_CONST = "literal-const"
340
+ }
341
+ type BindingMetadata = {
342
+ [key: string]: BindingTypes | undefined;
343
+ } & {
344
+ __isScriptSetup?: boolean;
345
+ __propsAliases?: Record<string, string>;
346
+ };
347
+
348
+ export declare class ScriptCompileContext {
349
+ descriptor: SFCDescriptor;
350
+ options: Partial<SFCScriptCompileOptions>;
351
+ isJS: boolean;
352
+ isTS: boolean;
353
+ isCE: boolean;
354
+ scriptAst: Program | null;
355
+ scriptSetupAst: Program | null;
356
+ source: string;
357
+ filename: string;
358
+ s: MagicString;
359
+ startOffset: number | undefined;
360
+ endOffset: number | undefined;
361
+ scope?: TypeScope;
362
+ globalScopes?: TypeScope[];
363
+ userImports: Record<string, ImportBinding>;
364
+ hasDefinePropsCall: boolean;
365
+ hasDefineEmitCall: boolean;
366
+ hasDefineExposeCall: boolean;
367
+ hasDefaultExportName: boolean;
368
+ hasDefaultExportRender: boolean;
369
+ hasDefineOptionsCall: boolean;
370
+ hasDefineSlotsCall: boolean;
371
+ hasDefineModelCall: boolean;
372
+ propsCall: CallExpression | undefined;
373
+ propsDecl: Node | undefined;
374
+ propsRuntimeDecl: Node | undefined;
375
+ propsTypeDecl: Node | undefined;
376
+ propsDestructureDecl: ObjectPattern | undefined;
377
+ propsDestructuredBindings: PropsDestructureBindings;
378
+ propsDestructureRestId: string | undefined;
379
+ propsRuntimeDefaults: Node | undefined;
380
+ emitsRuntimeDecl: Node | undefined;
381
+ emitsTypeDecl: Node | undefined;
382
+ emitDecl: Node | undefined;
383
+ modelDecls: Record<string, ModelDecl>;
384
+ optionsRuntimeDecl: Node | undefined;
385
+ bindingMetadata: BindingMetadata;
386
+ helperImports: Set<string>;
387
+ helper(key: string): string;
388
+ /**
389
+ * to be exposed on compiled script block for HMR cache busting
390
+ */
391
+ deps?: Set<string>;
392
+ /**
393
+ * cache for resolved fs
394
+ */
395
+ fs?: NonNullable<SFCScriptCompileOptions['fs']>;
396
+ constructor(descriptor: SFCDescriptor, options: Partial<SFCScriptCompileOptions>);
397
+ getString(node: Node, scriptSetup?: boolean): string;
398
+ warn(msg: string, node: Node, scope?: TypeScope): void;
399
+ error(msg: string, node: Node, scope?: TypeScope): never;
400
+ }
401
+
402
+ export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, 'globalTypeFiles' | 'fs' | 'babelParserPlugins' | 'isProd'>>;
403
+ /**
404
+ * TypeResolveContext is compatible with ScriptCompileContext
405
+ * but also allows a simpler version of it with minimal required properties
406
+ * when resolveType needs to be used in a non-SFC context, e.g. in a babel
407
+ * plugin. The simplest context can be just:
408
+ * ```ts
409
+ * const ctx: SimpleTypeResolveContext = {
410
+ * filename: '...',
411
+ * source: '...',
412
+ * options: {},
413
+ * error() {},
414
+ * ast: []
415
+ * }
416
+ * ```
417
+ */
418
+ export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
419
+ ast: Statement[];
420
+ options: SimpleTypeResolveOptions;
421
+ };
422
+ export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext;
423
+ type Import = Pick<ImportBinding, 'source' | 'imported'>;
424
+ interface WithScope {
425
+ _ownerScope: TypeScope;
426
+ }
427
+ type ScopeTypeNode = Node & WithScope & {
428
+ _ns?: TSModuleDeclaration & WithScope;
429
+ };
430
+ declare class TypeScope {
431
+ filename: string;
432
+ source: string;
433
+ offset: number;
434
+ imports: Record<string, Import>;
435
+ types: Record<string, ScopeTypeNode>;
436
+ declares: Record<string, ScopeTypeNode>;
437
+ constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>);
438
+ isGenericScope: boolean;
439
+ resolvedImportSources: Record<string, string>;
440
+ exportedTypes: Record<string, ScopeTypeNode>;
441
+ exportedDeclares: Record<string, ScopeTypeNode>;
442
+ }
443
+ interface MaybeWithScope {
444
+ _ownerScope?: TypeScope;
445
+ }
446
+ interface ResolvedElements {
447
+ props: Record<string, (TSPropertySignature | TSMethodSignature) & {
448
+ _ownerScope: TypeScope;
449
+ }>;
450
+ calls?: (TSCallSignatureDeclaration | TSFunctionType)[];
451
+ }
452
+ /**
453
+ * Resolve arbitrary type node to a list of type elements that can be then
454
+ * mapped to runtime props or emits.
455
+ */
456
+ export declare function resolveTypeElements(ctx: TypeResolveContext, node: Node & MaybeWithScope & {
457
+ _resolvedElements?: ResolvedElements;
458
+ }, scope?: TypeScope, typeParameters?: Record<string, Node>): ResolvedElements;
459
+ /**
460
+ * @private
461
+ */
462
+ export declare function registerTS(_loadTS: () => typeof TS): void;
463
+ /**
464
+ * @private
465
+ */
466
+ export declare function invalidateTypeCache(filename: string): void;
467
+ export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope, isKeyOf?: boolean): string[];
468
+
469
+ export declare function extractRuntimeEmits(ctx: TypeResolveContext): Set<string>;
470
+
471
+ export declare const version: string;
472
+
473
+ export declare const parseCache: Map<string, SFCParseResult>;
474
+ export declare const errorMessages: Record<number, string>;
475
+
476
+ export declare const walk: any;
477
+
478
+ /**
479
+ * @deprecated this is preserved to avoid breaking vite-plugin-vue < 5.0
480
+ * with reactivityTransform: true. The desired behavior should be silently
481
+ * ignoring the option instead of breaking.
482
+ */
483
+ export declare const shouldTransformRef: () => boolean;
484
+