zinfer 1.0.0-next.0 → 1.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/tsgo-host.d.ts
CHANGED
|
@@ -17,21 +17,39 @@ import type { TsHost } from "./ts-host.js";
|
|
|
17
17
|
* union/object types depend on incidental cross-file caching, producing
|
|
18
18
|
* non-deterministic output depending on what else had been processed
|
|
19
19
|
* earlier in the same run.
|
|
20
|
+
*
|
|
21
|
+
* When a real tsconfig.json is supplied, we serve a patched copy of it at
|
|
22
|
+
* its *own* path (only `files` gets an extra entry appended) rather than
|
|
23
|
+
* extracting `compilerOptions` into a from-scratch config elsewhere:
|
|
24
|
+
* `Checker`/`parseConfigFile` return fully-resolved options (enum fields as
|
|
25
|
+
* raw numbers, `lib` as resolved filenames), which isn't valid to re-embed
|
|
26
|
+
* as tsconfig.json text, and moving the served config to a different
|
|
27
|
+
* directory would break relative `extends`/`typeRoots` resolution. Keeping
|
|
28
|
+
* the same path means `extends` and comments are simply passed through
|
|
29
|
+
* unread - the tsgo server resolves them itself when it loads our patched
|
|
30
|
+
* text - and every other relative path in the config keeps working exactly
|
|
31
|
+
* as it would for the real project.
|
|
20
32
|
*/
|
|
21
33
|
export declare class TsgoHost implements TsHost<SourceFile> {
|
|
22
34
|
private readonly api;
|
|
23
|
-
private readonly
|
|
24
|
-
private readonly
|
|
35
|
+
private readonly projectConfigPath;
|
|
36
|
+
private readonly realTsconfigPath;
|
|
25
37
|
private readonly overlays;
|
|
26
38
|
private readonly virtualFiles;
|
|
27
39
|
private readonly normalizeFlags;
|
|
28
40
|
private currentRootFiles;
|
|
29
41
|
constructor(tsconfigPath?: string);
|
|
30
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Builds the text served for `projectConfigPath`. With a real tsconfig,
|
|
44
|
+
* this is the original text - `extends`, comments, everything - with only
|
|
45
|
+
* `files` appended to; `extends` is never read or resolved here, only
|
|
46
|
+
* passed through for the server to handle.
|
|
47
|
+
*/
|
|
48
|
+
private buildProjectConfig;
|
|
31
49
|
/**
|
|
32
50
|
* Opens the virtual project scoped to exactly `rootFiles` for this call.
|
|
33
|
-
* Always marks every root file (not just the
|
|
34
|
-
* the same
|
|
51
|
+
* Always marks every root file (not just the config) as changed: since
|
|
52
|
+
* the same path is repeatedly reused as a root across calls with
|
|
35
53
|
* different virtual-FS overlay content (or none), the server must never
|
|
36
54
|
* assume a cached parse of it is still valid.
|
|
37
55
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsgo-host.d.ts","sourceRoot":"","sources":["../../src/core/tsgo-host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsgo-host.d.ts","sourceRoot":"","sources":["../../src/core/tsgo-host.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAG3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAe3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,QAAS,YAAW,MAAM,CAAC,UAAU,CAAC;IACjD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,gBAAgB,CAAgB;gBAE5B,YAAY,CAAC,EAAE,MAAM;IAkCjC;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAmB1B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAanB,+EAA+E;IAC/E,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;IAU3C,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAM1D;;;;OAIG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU;IAWtE,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAIjD,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAIlD,YAAY,CACV,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EAAE,GAClB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAqDtB,OAAO,CAAC,aAAa;CAwBtB"}
|
package/dist/core/tsgo-host.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { API } from "@typescript/native-preview/unstable/sync";
|
|
5
|
+
import { SyntaxKind } from "@typescript/native-preview/unstable/ast";
|
|
6
|
+
import { parse as parseJsonc } from "jsonc-parser";
|
|
5
7
|
import { NORMALIZE_TYPE_DEFINITION } from "./normalizer.js";
|
|
6
8
|
const DEFAULT_COMPILER_OPTIONS = {
|
|
7
9
|
strict: true,
|
|
@@ -11,69 +13,6 @@ const DEFAULT_COMPILER_OPTIONS = {
|
|
|
11
13
|
esModuleInterop: true,
|
|
12
14
|
skipLibCheck: true,
|
|
13
15
|
};
|
|
14
|
-
// TS's ModuleResolutionKind isn't re-exported from the public unstable/*
|
|
15
|
-
// surface; these numeric values are stable across TS versions.
|
|
16
|
-
const MODULE_RESOLUTION_KIND_NAMES = {
|
|
17
|
-
1: "classic",
|
|
18
|
-
2: "node10",
|
|
19
|
-
3: "node16",
|
|
20
|
-
99: "nodenext",
|
|
21
|
-
100: "bundler",
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* `Checker`/`parseConfigFile` return fully-resolved CompilerOptions: enum
|
|
25
|
-
* fields as raw numbers, `lib` as resolved lib filenames (e.g.
|
|
26
|
-
* `"lib.es2022.d.ts"` instead of the `"es2022"` tsconfig.json expects), and
|
|
27
|
-
* paths (rootDir/outDir/...) absolutized against the *original* project.
|
|
28
|
-
* Naively re-embedding that into our own from-scratch virtual tsconfig.json
|
|
29
|
-
* would fail to parse (invalid `--lib` values, numeric enum fields) and
|
|
30
|
-
* inherit rootDir/outDir constraints from a project zinfer isn't actually
|
|
31
|
-
* building. Only carry over the handful of fields that affect type-checking
|
|
32
|
-
* of the target file, normalized back to valid tsconfig.json string form.
|
|
33
|
-
*
|
|
34
|
-
* `types`/`typeRoots` are resolved relative to the tsconfig's own directory,
|
|
35
|
-
* which for our virtual tsconfig is an unrelated temp directory - so an
|
|
36
|
-
* explicit `types: ["node"]` from the original project would otherwise fail
|
|
37
|
-
* to resolve `@types/node` at all (breaking even ambient globals like
|
|
38
|
-
* `Object`/`Function`). `typeRoots` is pointed at the original project's
|
|
39
|
-
* `node_modules/@types` so `types` keeps resolving correctly.
|
|
40
|
-
*/
|
|
41
|
-
function sanitizeCompilerOptions(options, originalTsconfigDir) {
|
|
42
|
-
const KEEP_KEYS = [
|
|
43
|
-
"strict",
|
|
44
|
-
"esModuleInterop",
|
|
45
|
-
"skipLibCheck",
|
|
46
|
-
"resolveJsonModule",
|
|
47
|
-
"isolatedModules",
|
|
48
|
-
"forceConsistentCasingInFileNames",
|
|
49
|
-
"allowJs",
|
|
50
|
-
"checkJs",
|
|
51
|
-
"types",
|
|
52
|
-
];
|
|
53
|
-
const result = {};
|
|
54
|
-
for (const key of KEEP_KEYS) {
|
|
55
|
-
if (key in options)
|
|
56
|
-
result[key] = options[key];
|
|
57
|
-
}
|
|
58
|
-
if (Array.isArray(options.lib)) {
|
|
59
|
-
result.lib = options.lib.map((lib) => typeof lib === "string" ? lib.replace(/^lib\./, "").replace(/\.d\.ts$/, "") : lib);
|
|
60
|
-
}
|
|
61
|
-
if (typeof options.target === "number") {
|
|
62
|
-
result.target = ScriptTarget[options.target] ?? DEFAULT_COMPILER_OPTIONS.target;
|
|
63
|
-
}
|
|
64
|
-
if (typeof options.module === "number") {
|
|
65
|
-
result.module = ModuleKind[options.module] ?? DEFAULT_COMPILER_OPTIONS.module;
|
|
66
|
-
}
|
|
67
|
-
if (typeof options.moduleResolution === "number") {
|
|
68
|
-
result.moduleResolution =
|
|
69
|
-
MODULE_RESOLUTION_KIND_NAMES[options.moduleResolution] ??
|
|
70
|
-
DEFAULT_COMPILER_OPTIONS.moduleResolution;
|
|
71
|
-
}
|
|
72
|
-
if ("types" in options) {
|
|
73
|
-
result.typeRoots = [path.join(originalTsconfigDir, "node_modules", "@types")];
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
16
|
const NO_TRUNCATION = 1;
|
|
78
17
|
const IN_TYPE_ALIAS = 8388608;
|
|
79
18
|
const FORMAT_FLAGS = NO_TRUNCATION | IN_TYPE_ALIAS;
|
|
@@ -93,23 +32,38 @@ const FORMAT_FLAGS = NO_TRUNCATION | IN_TYPE_ALIAS;
|
|
|
93
32
|
* union/object types depend on incidental cross-file caching, producing
|
|
94
33
|
* non-deterministic output depending on what else had been processed
|
|
95
34
|
* earlier in the same run.
|
|
35
|
+
*
|
|
36
|
+
* When a real tsconfig.json is supplied, we serve a patched copy of it at
|
|
37
|
+
* its *own* path (only `files` gets an extra entry appended) rather than
|
|
38
|
+
* extracting `compilerOptions` into a from-scratch config elsewhere:
|
|
39
|
+
* `Checker`/`parseConfigFile` return fully-resolved options (enum fields as
|
|
40
|
+
* raw numbers, `lib` as resolved filenames), which isn't valid to re-embed
|
|
41
|
+
* as tsconfig.json text, and moving the served config to a different
|
|
42
|
+
* directory would break relative `extends`/`typeRoots` resolution. Keeping
|
|
43
|
+
* the same path means `extends` and comments are simply passed through
|
|
44
|
+
* unread - the tsgo server resolves them itself when it loads our patched
|
|
45
|
+
* text - and every other relative path in the config keeps working exactly
|
|
46
|
+
* as it would for the real project.
|
|
96
47
|
*/
|
|
97
48
|
export class TsgoHost {
|
|
98
49
|
api;
|
|
99
|
-
|
|
100
|
-
|
|
50
|
+
projectConfigPath;
|
|
51
|
+
realTsconfigPath;
|
|
101
52
|
overlays = new Map();
|
|
102
53
|
virtualFiles = new Map();
|
|
103
54
|
normalizeFlags = new Set();
|
|
104
55
|
currentRootFiles = [];
|
|
105
56
|
constructor(tsconfigPath) {
|
|
106
|
-
this.
|
|
57
|
+
this.realTsconfigPath = tsconfigPath ? path.resolve(tsconfigPath) : undefined;
|
|
58
|
+
this.projectConfigPath =
|
|
59
|
+
this.realTsconfigPath ??
|
|
60
|
+
path.join(os.tmpdir(), `zinfer-tsgo-${process.pid}-${Math.random().toString(36).slice(2)}.tsconfig.json`);
|
|
107
61
|
this.api = new API({
|
|
108
62
|
fs: {
|
|
109
63
|
readFile: (fileName) => {
|
|
110
64
|
const resolved = path.resolve(fileName);
|
|
111
|
-
if (resolved === this.
|
|
112
|
-
return this.
|
|
65
|
+
if (resolved === this.projectConfigPath) {
|
|
66
|
+
return this.buildProjectConfig();
|
|
113
67
|
}
|
|
114
68
|
if (this.overlays.has(resolved)) {
|
|
115
69
|
return this.overlays.get(resolved);
|
|
@@ -121,7 +75,7 @@ export class TsgoHost {
|
|
|
121
75
|
},
|
|
122
76
|
fileExists: (fileName) => {
|
|
123
77
|
const resolved = path.resolve(fileName);
|
|
124
|
-
if (resolved === this.
|
|
78
|
+
if (resolved === this.projectConfigPath)
|
|
125
79
|
return true;
|
|
126
80
|
if (this.virtualFiles.has(resolved))
|
|
127
81
|
return true;
|
|
@@ -129,30 +83,41 @@ export class TsgoHost {
|
|
|
129
83
|
},
|
|
130
84
|
},
|
|
131
85
|
});
|
|
132
|
-
this.compilerOptions = tsconfigPath
|
|
133
|
-
? sanitizeCompilerOptions(this.api.parseConfigFile(path.resolve(tsconfigPath)).options, path.dirname(path.resolve(tsconfigPath)))
|
|
134
|
-
: DEFAULT_COMPILER_OPTIONS;
|
|
135
86
|
}
|
|
136
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Builds the text served for `projectConfigPath`. With a real tsconfig,
|
|
89
|
+
* this is the original text - `extends`, comments, everything - with only
|
|
90
|
+
* `files` appended to; `extends` is never read or resolved here, only
|
|
91
|
+
* passed through for the server to handle.
|
|
92
|
+
*/
|
|
93
|
+
buildProjectConfig() {
|
|
94
|
+
if (!this.realTsconfigPath) {
|
|
95
|
+
return JSON.stringify({
|
|
96
|
+
compilerOptions: DEFAULT_COMPILER_OPTIONS,
|
|
97
|
+
files: this.currentRootFiles,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const original = parseJsonc(readFileSync(this.realTsconfigPath, "utf8"));
|
|
101
|
+
const existingFiles = Array.isArray(original.files) ? original.files : [];
|
|
137
102
|
return JSON.stringify({
|
|
138
|
-
|
|
139
|
-
files: this.currentRootFiles,
|
|
103
|
+
...original,
|
|
104
|
+
files: [...existingFiles, ...this.currentRootFiles],
|
|
140
105
|
});
|
|
141
106
|
}
|
|
142
107
|
/**
|
|
143
108
|
* Opens the virtual project scoped to exactly `rootFiles` for this call.
|
|
144
|
-
* Always marks every root file (not just the
|
|
145
|
-
* the same
|
|
109
|
+
* Always marks every root file (not just the config) as changed: since
|
|
110
|
+
* the same path is repeatedly reused as a root across calls with
|
|
146
111
|
* different virtual-FS overlay content (or none), the server must never
|
|
147
112
|
* assume a cached parse of it is still valid.
|
|
148
113
|
*/
|
|
149
114
|
openProject(rootFiles) {
|
|
150
115
|
this.currentRootFiles = rootFiles;
|
|
151
116
|
const snapshot = this.api.updateSnapshot({
|
|
152
|
-
openProject: this.
|
|
153
|
-
fileChanges: { changed: [this.
|
|
117
|
+
openProject: this.projectConfigPath,
|
|
118
|
+
fileChanges: { changed: [this.projectConfigPath, ...rootFiles] },
|
|
154
119
|
});
|
|
155
|
-
const project = snapshot.getProject(this.
|
|
120
|
+
const project = snapshot.getProject(this.projectConfigPath);
|
|
156
121
|
if (!project) {
|
|
157
122
|
throw new Error("tsgo: failed to open virtual project");
|
|
158
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsgo-host.js","sourceRoot":"","sources":["../../src/core/tsgo-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tsgo-host.js","sourceRoot":"","sources":["../../src/core/tsgo-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,0CAA0C,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,MAAM,wBAAwB,GAA4B;IACxD,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,SAAS;IAC3B,eAAe,EAAE,IAAI;IACrB,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,aAAa,GAAG,OAAO,CAAC;AAC9B,MAAM,YAAY,GAAG,aAAa,GAAG,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,QAAQ;IACF,GAAG,CAAM;IACT,iBAAiB,CAAS;IAC1B,gBAAgB,CAAqB;IACrC,QAAQ,GAAG,IAAI,GAAG,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
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.1",
|
|
4
4
|
"description": "Extract input/output types from Zod schemas",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"schema",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"commander": "^15.0.0",
|
|
34
34
|
"glob": "^13.0.0",
|
|
35
35
|
"jiti": "^2.6.1",
|
|
36
|
+
"jsonc-parser": "^3.3.1",
|
|
36
37
|
"pathe": "^2.0.3"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|