vize 0.717.0 → 0.719.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +3 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-DGQbYEUm.d.mts → config-BaSFJWUp.d.mts} +5 -1
- package/dist/{config-DGQbYEUm.d.mts.map → config-BaSFJWUp.d.mts.map} +1 -1
- package/dist/{config-b4e9G6N2.mjs → config-DP9TSlv2.mjs} +5 -1
- package/dist/{config-b4e9G6N2.mjs.map → config-DP9TSlv2.mjs.map} +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/generated/content-mapper-types.d.ts +34 -9
- package/package.json +8 -4
- package/src/config.ts +4 -0
- package/src/corsa-runtime.ts +3 -0
- package/src/init.ts +8 -0
- package/src/setup.ts +8 -0
- package/src/types/rules.ts +1 -1
- package/virtual-ts-checker-strict.d.ts +23 -0
- package/virtual-ts-checker.d.ts +1 -15
- package/virtual-ts-emit-overloads.d.ts +49 -9
- package/virtual-ts-globals.d.ts +33 -9
- package/virtual-ts.d.cts +1 -11
- package/virtual-ts.d.mts +1 -11
- package/virtual-ts.d.ts +1 -11
|
@@ -233,14 +233,14 @@ type $ComponentInput<T, Declared, Authored> =
|
|
|
233
233
|
: never;
|
|
234
234
|
type $AuthoredKeyWitness<T> = { [K in keyof T]: unknown };
|
|
235
235
|
// Constructor arguments (templates, `new`) bind `Authored`; TSX binds `Jsx` through `$props` (#11629).
|
|
236
|
-
type $ComponentInstanceFor<I, T, Declared, Authored, Jsx> =
|
|
236
|
+
type $ComponentInstanceFor<I, O, B, T, Declared, Authored, Jsx> =
|
|
237
237
|
$IsAny<Authored> extends true
|
|
238
238
|
? I
|
|
239
239
|
: $IsUnknown<Authored> extends true
|
|
240
240
|
? $UsePublicInstance<Jsx> extends true
|
|
241
241
|
? I
|
|
242
242
|
: $ReplaceComponentProps<
|
|
243
|
-
|
|
243
|
+
O,
|
|
244
244
|
Pick<
|
|
245
245
|
$AuthoredKeyWitness<Jsx>,
|
|
246
246
|
keyof Jsx & $ComponentMetadataKeys<$ComponentInputProps<T, Declared>>
|
|
@@ -248,11 +248,13 @@ type $ComponentInstanceFor<I, T, Declared, Authored, Jsx> =
|
|
|
248
248
|
(T extends unknown
|
|
249
249
|
? $ComponentInputProps<T, Declared> & $ComponentInputGuard<T, Declared, Jsx>
|
|
250
250
|
: never)
|
|
251
|
-
>
|
|
251
|
+
> &
|
|
252
|
+
B
|
|
252
253
|
: $ReplaceComponentProps<
|
|
253
|
-
|
|
254
|
+
O,
|
|
254
255
|
$ComponentInputProps<T, Declared> & $ComponentMissingInputGuard<T, Authored>
|
|
255
|
-
|
|
256
|
+
> &
|
|
257
|
+
B;
|
|
256
258
|
type $IsUnknown<T> = unknown extends T ? ([keyof T] extends [never] ? true : false) : false;
|
|
257
259
|
type $UsePublicInstance<T> = $IsAny<T> extends true ? true : $IsUnknown<T>;
|
|
258
260
|
type $LiteralKeys<T> = keyof {
|
|
@@ -272,8 +274,13 @@ type $LiteralKeys<T> = keyof {
|
|
|
272
274
|
: K
|
|
273
275
|
]: unknown;
|
|
274
276
|
};
|
|
275
|
-
type $
|
|
276
|
-
|
|
277
|
+
type $PatternSafeOmit<
|
|
278
|
+
T,
|
|
279
|
+
K extends PropertyKey,
|
|
280
|
+
B = Omit<T, K>,
|
|
281
|
+
L extends PropertyKey = $LiteralKeys<T>,
|
|
282
|
+
> = B & Pick<T, Extract<Exclude<L, K>, keyof T>>;
|
|
283
|
+
type $ReplaceComponentProps<T, P> = $PatternSafeOmit<T, "$props"> & { $props: P };
|
|
277
284
|
type $PublicEmit<T, S = __EmitShape<T>, K extends keyof S & string = keyof S & string> = S extends (
|
|
278
285
|
...args: any[]
|
|
279
286
|
) => any
|
|
@@ -287,8 +294,25 @@ type $PublicSlots<T> = [keyof T] extends [never]
|
|
|
287
294
|
type $ComponentPublicBase<
|
|
288
295
|
// @ts-ignore TS2694/TS2307: a `vue` without `ComponentPublicInstance` must degrade component public extras to unchecked, never error.
|
|
289
296
|
I = import("vue").ComponentPublicInstance,
|
|
290
|
-
|
|
291
|
-
|
|
297
|
+
// @ts-ignore TS2694/TS2307: a `vue` without `ComponentCustomProperties` must degrade component public extras to unchecked, never error.
|
|
298
|
+
C = import("vue").ComponentCustomProperties,
|
|
299
|
+
> = $PatternSafeOmit<
|
|
300
|
+
I,
|
|
301
|
+
"$props" | "$emit" | "$slots",
|
|
302
|
+
symbol extends keyof C ? {} : C,
|
|
303
|
+
| "$"
|
|
304
|
+
| "$data"
|
|
305
|
+
| "$attrs"
|
|
306
|
+
| "$refs"
|
|
307
|
+
| "$root"
|
|
308
|
+
| "$parent"
|
|
309
|
+
| "$host"
|
|
310
|
+
| "$el"
|
|
311
|
+
| "$options"
|
|
312
|
+
| "$forceUpdate"
|
|
313
|
+
| "$nextTick"
|
|
314
|
+
| "$watch"
|
|
315
|
+
>;
|
|
292
316
|
|
|
293
317
|
export type {
|
|
294
318
|
__EmitShape,
|
|
@@ -341,6 +365,7 @@ export type {
|
|
|
341
365
|
$IsUnknown,
|
|
342
366
|
$UsePublicInstance,
|
|
343
367
|
$LiteralKeys,
|
|
368
|
+
$PatternSafeOmit,
|
|
344
369
|
$ReplaceComponentProps,
|
|
345
370
|
$PublicEmit,
|
|
346
371
|
$PublicSlots,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.719.0",
|
|
4
4
|
"description": "Vize - High-performance Vue.js toolchain in Rust",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"content-mapper-helpers.d.ts",
|
|
33
33
|
"generated/content-mapper-types.d.ts",
|
|
34
34
|
"virtual-ts-checker.d.ts",
|
|
35
|
+
"virtual-ts-checker-strict.d.ts",
|
|
35
36
|
"virtual-ts-emit-overloads.d.ts",
|
|
36
37
|
"virtual-ts-globals.d.ts",
|
|
37
38
|
"virtual-ts-listeners.d.ts",
|
|
@@ -72,6 +73,9 @@
|
|
|
72
73
|
"./virtual-ts-checker": {
|
|
73
74
|
"types": "./virtual-ts-checker.d.ts"
|
|
74
75
|
},
|
|
76
|
+
"./virtual-ts-checker-strict": {
|
|
77
|
+
"types": "./virtual-ts-checker-strict.d.ts"
|
|
78
|
+
},
|
|
75
79
|
"./content-mapper-helpers": {
|
|
76
80
|
"import": {
|
|
77
81
|
"types": "./content-mapper-helpers.d.mts"
|
|
@@ -88,14 +92,14 @@
|
|
|
88
92
|
"access": "public"
|
|
89
93
|
},
|
|
90
94
|
"dependencies": {
|
|
91
|
-
"@vizejs/native": "0.
|
|
92
|
-
"oxc-transform": "0.
|
|
95
|
+
"@vizejs/native": "0.719.0",
|
|
96
|
+
"oxc-transform": "0.157.0"
|
|
93
97
|
},
|
|
94
98
|
"devDependencies": {
|
|
95
99
|
"@pkl-community/pkl": "0.30.2",
|
|
96
100
|
"@tsdown/css": "0.22.14",
|
|
97
101
|
"@types/node": "25.9.2",
|
|
98
|
-
"json-schema-to-typescript": "
|
|
102
|
+
"json-schema-to-typescript": "16.0.0",
|
|
99
103
|
"oxfmt": "0.63.0",
|
|
100
104
|
"tsdown": "0.22.14",
|
|
101
105
|
"typescript": "6.0.3",
|
package/src/config.ts
CHANGED
|
@@ -27,6 +27,7 @@ type NativeConfigHelpers = {
|
|
|
27
27
|
|
|
28
28
|
const require = createRequire(import.meta.url);
|
|
29
29
|
|
|
30
|
+
/** Supported Vite configuration filenames searched by the CLI. */
|
|
30
31
|
export const CONFIG_FILE_NAMES = VITE_CONFIG_FILE_NAMES;
|
|
31
32
|
const RETIRED_CONFIG = /^vize\.config\.(?:pkl|[cm]?[jt]s|json)$/;
|
|
32
33
|
const CONFIG_MIGRATION =
|
|
@@ -39,12 +40,14 @@ const DEFAULT_CONFIG_ENV: ConfigEnv = {
|
|
|
39
40
|
|
|
40
41
|
const PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
|
|
41
42
|
|
|
43
|
+
/** Absolute path to the legacy JSON configuration schema shipped with the CLI. */
|
|
42
44
|
export const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(
|
|
43
45
|
PACKAGE_ROOT,
|
|
44
46
|
"schemas",
|
|
45
47
|
"vize.config.schema.json",
|
|
46
48
|
);
|
|
47
49
|
|
|
50
|
+
/** Absolute path to the legacy Pkl configuration schema shipped with the CLI. */
|
|
48
51
|
export const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, "pkl", "vize.pkl");
|
|
49
52
|
|
|
50
53
|
/**
|
|
@@ -190,6 +193,7 @@ function loadPklConfig(filePath: string): ResolvedVizeConfig | null {
|
|
|
190
193
|
return output === null ? null : parseJsonConfig(output, filePath);
|
|
191
194
|
}
|
|
192
195
|
|
|
196
|
+
/** Normalizes an already loaded Vize configuration export. */
|
|
193
197
|
export async function resolveConfigExport(
|
|
194
198
|
exported: UserConfigExport,
|
|
195
199
|
env?: ConfigEnv,
|
package/src/corsa-runtime.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
|
+
/** Environment variables that explicitly override bundled Corsa discovery. */
|
|
6
7
|
export const publicCorsaEnvironmentVariables = [
|
|
7
8
|
"CORSA_PATH",
|
|
8
9
|
"CORSA_EXECUTABLE",
|
|
@@ -16,6 +17,7 @@ type RuntimeResolutionOptions = {
|
|
|
16
17
|
platform?: NodeJS.Platform;
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
/** Configures the bundled Corsa executable unless the environment already overrides it. */
|
|
19
21
|
export function configureBundledCorsaRuntime(
|
|
20
22
|
environment: NodeJS.ProcessEnv = process.env,
|
|
21
23
|
options: RuntimeResolutionOptions = {},
|
|
@@ -29,6 +31,7 @@ export function configureBundledCorsaRuntime(
|
|
|
29
31
|
return executable;
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
/** Resolves a compatible Corsa executable from the CLI's optional dependencies. */
|
|
32
35
|
export function resolveBundledCorsaRuntime(options: RuntimeResolutionOptions = {}): string | null {
|
|
33
36
|
const packageRoot =
|
|
34
37
|
options.packageRoot ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
package/src/init.ts
CHANGED
|
@@ -27,13 +27,20 @@ import { defaultSelection, offerFeatures, type FeatureSelection } from "./init/s
|
|
|
27
27
|
export type { InitCommand, InitPlan } from "./init/plan.js";
|
|
28
28
|
export type { ProjectDetection } from "./init/detect.js";
|
|
29
29
|
|
|
30
|
+
/** Injectable dependencies and host controls for project initialization. */
|
|
30
31
|
export interface InitOptions {
|
|
31
32
|
readonly root: string;
|
|
33
|
+
/** Command-line arguments to parse. @default [] */
|
|
32
34
|
readonly args?: readonly string[];
|
|
35
|
+
/** Command executor used for planned dependency operations. @default built-in synchronous runner */
|
|
33
36
|
readonly runCommand?: (command: InitCommand) => void;
|
|
37
|
+
/** File writer used for generated configuration. @default atomic project writer */
|
|
34
38
|
readonly writeFile?: (filename: string, source: string) => void;
|
|
39
|
+
/** Output sink for detection, plan, and completion reports. @default process.stdout.write */
|
|
35
40
|
readonly output?: (chunk: string) => void;
|
|
41
|
+
/** Prompt implementation supplied by an embedding host. @default interactive terminal prompts */
|
|
36
42
|
readonly promptDeps?: PromptDeps;
|
|
43
|
+
/** Input stream used to determine interactivity and collect answers. @default process.stdin */
|
|
37
44
|
readonly stdin?: NodeJS.ReadableStream;
|
|
38
45
|
}
|
|
39
46
|
|
|
@@ -137,6 +144,7 @@ export async function initProject(options: InitOptions): Promise<InitPlan | null
|
|
|
137
144
|
return plan;
|
|
138
145
|
}
|
|
139
146
|
|
|
147
|
+
/** Runs the `init` command and maps refusal or blocked features to a failing exit code. */
|
|
140
148
|
export async function runInitCli(args: readonly string[]): Promise<void> {
|
|
141
149
|
if (parseInitArgs(args).help) {
|
|
142
150
|
process.stdout.write(initHelp());
|
package/src/setup.ts
CHANGED
|
@@ -21,12 +21,14 @@ import {
|
|
|
21
21
|
} from "./setup/config.js";
|
|
22
22
|
import { planViteMigration } from "./setup/vite.js";
|
|
23
23
|
|
|
24
|
+
/** External command planned by the setup workflow. */
|
|
24
25
|
export interface SetupCommand {
|
|
25
26
|
readonly command: string;
|
|
26
27
|
readonly args: readonly string[];
|
|
27
28
|
readonly cwd: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
/** Complete receipt for files, scripts, migrations, and dependency commands planned by setup. */
|
|
30
32
|
export interface SetupResult {
|
|
31
33
|
readonly root: string;
|
|
32
34
|
readonly createdFiles: readonly string[];
|
|
@@ -40,13 +42,18 @@ export interface SetupResult {
|
|
|
40
42
|
readonly migrationWarnings: readonly string[];
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
/** Injectable host controls for the setup workflow. */
|
|
43
46
|
export interface SetupOptions {
|
|
44
47
|
readonly root: string;
|
|
48
|
+
/** Whether missing dependencies and obsolete plugins are changed. @default true */
|
|
45
49
|
readonly install?: boolean;
|
|
50
|
+
/** Command executor used for dependency changes. @default built-in synchronous runner */
|
|
46
51
|
readonly runCommand?: (command: SetupCommand) => void;
|
|
52
|
+
/** File writer used for generated configuration. @default atomic project writer */
|
|
47
53
|
readonly writeFile?: (filename: string, source: string) => void;
|
|
48
54
|
}
|
|
49
55
|
|
|
56
|
+
/** Configures Vize in an existing Vite or Vite+ project. */
|
|
50
57
|
export function setupProject(options: SetupOptions): SetupResult {
|
|
51
58
|
const root = path.resolve(options.root);
|
|
52
59
|
const packagePath = path.join(root, "package.json");
|
|
@@ -167,6 +174,7 @@ export function setupProject(options: SetupOptions): SetupResult {
|
|
|
167
174
|
};
|
|
168
175
|
}
|
|
169
176
|
|
|
177
|
+
/** Runs the `setup` command against parsed CLI arguments. */
|
|
170
178
|
export function runSetupCli(args: readonly string[]): void {
|
|
171
179
|
if (args.includes("--help") || args.includes("-h")) {
|
|
172
180
|
process.stdout.write(setupHelp());
|
package/src/types/rules.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Globals of a program whose templates vize checks with `checkUnknownProps`.
|
|
2
|
+
// Content-mapper modules load them with a type-only import that declaration
|
|
3
|
+
// emit drops, so an emitted declaration never brings them into its consumer.
|
|
4
|
+
import type {} from "./virtual-ts.js" with { "resolution-mode": "import" };
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
// Nuxt and the JSX runtime declare these for their consumers (#11630).
|
|
8
|
+
interface ImportMeta {
|
|
9
|
+
client: boolean;
|
|
10
|
+
server: boolean;
|
|
11
|
+
dev: boolean;
|
|
12
|
+
prod: boolean;
|
|
13
|
+
ssr: boolean;
|
|
14
|
+
}
|
|
15
|
+
namespace JSX {
|
|
16
|
+
interface IntrinsicAttributes {
|
|
17
|
+
class?: unknown;
|
|
18
|
+
style?: unknown;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {};
|
package/virtual-ts-checker.d.ts
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
// Globals of a program whose templates vize checks. Content-mapper modules load
|
|
2
2
|
// them with a type-only import that declaration emit drops, so an emitted
|
|
3
3
|
// declaration brings only the helpers, never this policy, into its consumer.
|
|
4
|
-
import type {} from "./virtual-ts.js" with { "resolution-mode": "import" };
|
|
4
|
+
import type {} from "./virtual-ts-checker-strict.js" with { "resolution-mode": "import" };
|
|
5
5
|
|
|
6
6
|
declare global {
|
|
7
|
-
// Nuxt and the JSX runtime declare these for their consumers (#11630).
|
|
8
|
-
interface ImportMeta {
|
|
9
|
-
client: boolean;
|
|
10
|
-
server: boolean;
|
|
11
|
-
dev: boolean;
|
|
12
|
-
prod: boolean;
|
|
13
|
-
ssr: boolean;
|
|
14
|
-
}
|
|
15
|
-
namespace JSX {
|
|
16
|
-
interface IntrinsicAttributes {
|
|
17
|
-
class?: unknown;
|
|
18
|
-
style?: unknown;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
7
|
// vue-tsc generic library components accept unknown attrs through this
|
|
22
8
|
// fallback, which vue-tsc itself declares unless `checkUnknownProps` is set.
|
|
23
9
|
var __VLS_PROPS_FALLBACK: Record<string, unknown>;
|
|
@@ -65,24 +65,64 @@ declare global {
|
|
|
65
65
|
>;
|
|
66
66
|
type $OverloadParameters<T extends (...args: any[]) => any> = Parameters<$OverloadUnion<T>>;
|
|
67
67
|
type $IsStringLiteral<T> = T extends string ? (string extends T ? false : true) : false;
|
|
68
|
-
type $
|
|
69
|
-
?
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
type $LiteralParameterKeys<T extends any[]> = T extends unknown
|
|
69
|
+
? $IsStringLiteral<T[0]> extends true
|
|
70
|
+
? T[0]
|
|
71
|
+
: never
|
|
72
|
+
: never;
|
|
73
|
+
type $ParametersForKey<T extends any[], K> = T extends [e: infer E, ...args: infer P]
|
|
74
|
+
? $IsStringLiteral<E> extends true
|
|
75
|
+
? K extends E
|
|
76
|
+
? P
|
|
77
|
+
: never
|
|
78
|
+
: never
|
|
79
|
+
: never;
|
|
80
|
+
type $LiteralParametersToFns<T extends any[]> = {
|
|
81
|
+
[K in $LiteralParameterKeys<T>]: (...args: $ParametersForKey<T, K>) => any;
|
|
82
|
+
};
|
|
83
|
+
type $ParametersToFns<T extends any[]> = $LiteralParametersToFns<T> &
|
|
84
|
+
(string extends T[0]
|
|
85
|
+
? {
|
|
86
|
+
[K in string]: (
|
|
87
|
+
...args: T extends [e: infer E, ...args: infer P]
|
|
88
|
+
? string extends E
|
|
89
|
+
? P
|
|
90
|
+
: never
|
|
91
|
+
: never
|
|
92
|
+
) => any;
|
|
93
|
+
}
|
|
94
|
+
: {});
|
|
77
95
|
type __EmitOptions<T, S = __EmitShape<T>> = {
|
|
78
96
|
[K in keyof S as K extends string ? K : never]: (...args: __EmitArgs<S, K>) => any;
|
|
79
97
|
} & (__EmitShape<T> extends (...args: any[]) => any
|
|
80
98
|
? $ParametersToFns<$OverloadParameters<__EmitShape<T>>>
|
|
81
99
|
: {});
|
|
100
|
+
type $LiteralEmitOptions<T, S = __EmitShape<T>> = S extends (...args: any[]) => any
|
|
101
|
+
? $LiteralParametersToFns<$OverloadParameters<S>>
|
|
102
|
+
: {};
|
|
82
103
|
type $Camelize<S extends string> = S extends `${infer Head}-${infer Tail}`
|
|
83
104
|
? `${Head}${Capitalize<$Camelize<Tail>>}`
|
|
84
105
|
: S;
|
|
85
106
|
type $HandlerKey<K extends string> = `on${Capitalize<$Camelize<K>>}`;
|
|
107
|
+
type $EmitPropsFromOptions<T> = {
|
|
108
|
+
[
|
|
109
|
+
K in keyof T & string as
|
|
110
|
+
| ($Camelize<K> extends keyof T
|
|
111
|
+
? string extends keyof T
|
|
112
|
+
? $HandlerKey<K>
|
|
113
|
+
: never
|
|
114
|
+
: $HandlerKey<K>)
|
|
115
|
+
| `on${Capitalize<K>}`
|
|
116
|
+
]?: T[K];
|
|
117
|
+
};
|
|
118
|
+
type $ResolvedEmitProps<T, O = __EmitOptions<T>, L = $LiteralEmitOptions<T>> =
|
|
119
|
+
$IsAny<T> extends true
|
|
120
|
+
? $EmitPropsFromOptions<O>
|
|
121
|
+
: string extends keyof O
|
|
122
|
+
? [keyof L] extends [never]
|
|
123
|
+
? $EmitPropsFromOptions<O>
|
|
124
|
+
: $EmitPropsFromOptions<O> & $EmitPropsFromOptions<L>
|
|
125
|
+
: $EmitPropsFromOptions<O>;
|
|
86
126
|
}
|
|
87
127
|
|
|
88
128
|
export {};
|
package/virtual-ts-globals.d.ts
CHANGED
|
@@ -240,14 +240,14 @@ declare global {
|
|
|
240
240
|
: never;
|
|
241
241
|
type $AuthoredKeyWitness<T> = { [K in keyof T]: unknown };
|
|
242
242
|
// Constructor arguments (templates, `new`) bind `Authored`; TSX binds `Jsx` through `$props` (#11629).
|
|
243
|
-
type $ComponentInstanceFor<I, T, Declared, Authored, Jsx> =
|
|
243
|
+
type $ComponentInstanceFor<I, O, B, T, Declared, Authored, Jsx> =
|
|
244
244
|
$IsAny<Authored> extends true
|
|
245
245
|
? I
|
|
246
246
|
: $IsUnknown<Authored> extends true
|
|
247
247
|
? $UsePublicInstance<Jsx> extends true
|
|
248
248
|
? I
|
|
249
249
|
: $ReplaceComponentProps<
|
|
250
|
-
|
|
250
|
+
O,
|
|
251
251
|
Pick<
|
|
252
252
|
$AuthoredKeyWitness<Jsx>,
|
|
253
253
|
keyof Jsx & $ComponentMetadataKeys<$ComponentInputProps<T, Declared>>
|
|
@@ -255,11 +255,13 @@ declare global {
|
|
|
255
255
|
(T extends unknown
|
|
256
256
|
? $ComponentInputProps<T, Declared> & $ComponentInputGuard<T, Declared, Jsx>
|
|
257
257
|
: never)
|
|
258
|
-
>
|
|
258
|
+
> &
|
|
259
|
+
B
|
|
259
260
|
: $ReplaceComponentProps<
|
|
260
|
-
|
|
261
|
+
O,
|
|
261
262
|
$ComponentInputProps<T, Declared> & $ComponentMissingInputGuard<T, Authored>
|
|
262
|
-
|
|
263
|
+
> &
|
|
264
|
+
B;
|
|
263
265
|
type $IsUnknown<T> = unknown extends T ? ([keyof T] extends [never] ? true : false) : false;
|
|
264
266
|
type $UsePublicInstance<T> = $IsAny<T> extends true ? true : $IsUnknown<T>;
|
|
265
267
|
type $LiteralKeys<T> = keyof {
|
|
@@ -279,8 +281,13 @@ declare global {
|
|
|
279
281
|
: K
|
|
280
282
|
]: unknown;
|
|
281
283
|
};
|
|
282
|
-
type $
|
|
283
|
-
|
|
284
|
+
type $PatternSafeOmit<
|
|
285
|
+
T,
|
|
286
|
+
K extends PropertyKey,
|
|
287
|
+
B = Omit<T, K>,
|
|
288
|
+
L extends PropertyKey = $LiteralKeys<T>,
|
|
289
|
+
> = B & Pick<T, Extract<Exclude<L, K>, keyof T>>;
|
|
290
|
+
type $ReplaceComponentProps<T, P> = $PatternSafeOmit<T, "$props"> & { $props: P };
|
|
284
291
|
type $PublicEmit<
|
|
285
292
|
T,
|
|
286
293
|
S = __EmitShape<T>,
|
|
@@ -296,8 +303,25 @@ declare global {
|
|
|
296
303
|
type $ComponentPublicBase<
|
|
297
304
|
// @ts-ignore TS2694/TS2307: a `vue` without `ComponentPublicInstance` must degrade component public extras to unchecked, never error.
|
|
298
305
|
I = import("vue").ComponentPublicInstance,
|
|
299
|
-
|
|
300
|
-
|
|
306
|
+
// @ts-ignore TS2694/TS2307: a `vue` without `ComponentCustomProperties` must degrade component public extras to unchecked, never error.
|
|
307
|
+
C = import("vue").ComponentCustomProperties,
|
|
308
|
+
> = $PatternSafeOmit<
|
|
309
|
+
I,
|
|
310
|
+
"$props" | "$emit" | "$slots",
|
|
311
|
+
symbol extends keyof C ? {} : C,
|
|
312
|
+
| "$"
|
|
313
|
+
| "$data"
|
|
314
|
+
| "$attrs"
|
|
315
|
+
| "$refs"
|
|
316
|
+
| "$root"
|
|
317
|
+
| "$parent"
|
|
318
|
+
| "$host"
|
|
319
|
+
| "$el"
|
|
320
|
+
| "$options"
|
|
321
|
+
| "$forceUpdate"
|
|
322
|
+
| "$nextTick"
|
|
323
|
+
| "$watch"
|
|
324
|
+
>;
|
|
301
325
|
// @ts-ignore TS2694/TS2307: a `vue` without `NativeElements` must degrade native prop checks to unchecked, never error. See virtual_ts/expressions/native_props.rs.
|
|
302
326
|
type $NativeElements = import("vue").NativeElements;
|
|
303
327
|
type $NativeElement<Tag extends PropertyKey> = Tag extends keyof $NativeElements
|
package/virtual-ts.d.cts
CHANGED
|
@@ -90,17 +90,7 @@ export type $SlotPayload<S, N, C = $RegisteredSlotProvider<any, never>> =
|
|
|
90
90
|
: any
|
|
91
91
|
: $NamedSlotPayload<S, N>;
|
|
92
92
|
|
|
93
|
-
export type __EmitProps<T> =
|
|
94
|
-
[
|
|
95
|
-
K in keyof __EmitOptions<T> & string as
|
|
96
|
-
| ($Camelize<K> extends keyof __EmitOptions<T>
|
|
97
|
-
? string extends keyof __EmitOptions<T>
|
|
98
|
-
? $HandlerKey<K>
|
|
99
|
-
: never
|
|
100
|
-
: $HandlerKey<K>)
|
|
101
|
-
| `on${Capitalize<K>}`
|
|
102
|
-
]?: __EmitOptions<T>[K];
|
|
103
|
-
};
|
|
93
|
+
export type __EmitProps<T> = $ResolvedEmitProps<T>;
|
|
104
94
|
|
|
105
95
|
type $EmitRequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T];
|
|
106
96
|
type $EmitRequiredFields<T> = T extends unknown
|
package/virtual-ts.d.mts
CHANGED
|
@@ -90,17 +90,7 @@ export type $SlotPayload<S, N, C = $RegisteredSlotProvider<any, never>> =
|
|
|
90
90
|
: any
|
|
91
91
|
: $NamedSlotPayload<S, N>;
|
|
92
92
|
|
|
93
|
-
export type __EmitProps<T> =
|
|
94
|
-
[
|
|
95
|
-
K in keyof __EmitOptions<T> & string as
|
|
96
|
-
| ($Camelize<K> extends keyof __EmitOptions<T>
|
|
97
|
-
? string extends keyof __EmitOptions<T>
|
|
98
|
-
? $HandlerKey<K>
|
|
99
|
-
: never
|
|
100
|
-
: $HandlerKey<K>)
|
|
101
|
-
| `on${Capitalize<K>}`
|
|
102
|
-
]?: __EmitOptions<T>[K];
|
|
103
|
-
};
|
|
93
|
+
export type __EmitProps<T> = $ResolvedEmitProps<T>;
|
|
104
94
|
|
|
105
95
|
type $EmitRequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T];
|
|
106
96
|
type $EmitRequiredFields<T> = T extends unknown
|
package/virtual-ts.d.ts
CHANGED
|
@@ -90,17 +90,7 @@ export type $SlotPayload<S, N, C = $RegisteredSlotProvider<any, never>> =
|
|
|
90
90
|
: any
|
|
91
91
|
: $NamedSlotPayload<S, N>;
|
|
92
92
|
|
|
93
|
-
export type __EmitProps<T> =
|
|
94
|
-
[
|
|
95
|
-
K in keyof __EmitOptions<T> & string as
|
|
96
|
-
| ($Camelize<K> extends keyof __EmitOptions<T>
|
|
97
|
-
? string extends keyof __EmitOptions<T>
|
|
98
|
-
? $HandlerKey<K>
|
|
99
|
-
: never
|
|
100
|
-
: $HandlerKey<K>)
|
|
101
|
-
| `on${Capitalize<K>}`
|
|
102
|
-
]?: __EmitOptions<T>[K];
|
|
103
|
-
};
|
|
93
|
+
export type __EmitProps<T> = $ResolvedEmitProps<T>;
|
|
104
94
|
|
|
105
95
|
type $EmitRequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T];
|
|
106
96
|
type $EmitRequiredFields<T> = T extends unknown
|