@esportsplus/typescript 0.31.0 → 0.31.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/README.md +86 -0
- package/bin/tsc-lsp +3 -0
- package/build/cli/diagnostics.d.ts +5 -1
- package/build/cli/diagnostics.js +13 -8
- package/build/cli/tsc.d.ts +3 -1
- package/build/cli/tsc.js +77 -87
- package/build/compiler/coordinator.d.ts +1 -2
- package/build/compiler/coordinator.js +33 -22
- package/build/compiler/imports.d.ts +2 -0
- package/build/compiler/imports.js +9 -2
- package/build/compiler/language-service.d.ts +15 -4
- package/build/compiler/language-service.js +56 -24
- package/build/compiler/plugins/vite.js +7 -5
- package/build/compiler/sourcemap.d.ts +3 -1
- package/build/compiler/sourcemap.js +23 -5
- package/build/jsonc.d.ts +2 -0
- package/build/jsonc.js +85 -0
- package/build/lsp/bin.d.ts +1 -0
- package/build/lsp/bin.js +2 -0
- package/build/lsp/diagnostics.d.ts +10 -0
- package/build/lsp/diagnostics.js +69 -0
- package/build/lsp/index.d.ts +2 -0
- package/build/lsp/index.js +2 -0
- package/build/lsp/server.d.ts +4 -0
- package/build/lsp/server.js +130 -0
- package/build/lsp/workspace.d.ts +14 -0
- package/build/lsp/workspace.js +46 -0
- package/build/probe/adapter.d.ts +14 -0
- package/build/probe/adapter.js +42 -0
- package/build/probe/async/channel.d.ts +4 -0
- package/build/probe/async/channel.js +560 -0
- package/build/probe/async/value.d.ts +9 -0
- package/build/probe/async/value.js +16 -0
- package/build/probe/channels.d.ts +4 -0
- package/build/probe/channels.js +16 -0
- package/build/probe/exceptions/channel.d.ts +5 -0
- package/build/probe/exceptions/channel.js +657 -0
- package/build/probe/exceptions/jsdoc.d.ts +8 -0
- package/build/probe/exceptions/jsdoc.js +34 -0
- package/build/probe/exceptions/value.d.ts +39 -0
- package/build/probe/exceptions/value.js +158 -0
- package/build/probe/kernel/analyze.d.ts +8 -0
- package/build/probe/kernel/analyze.js +68 -0
- package/build/probe/kernel/ast.d.ts +11 -0
- package/build/probe/kernel/ast.js +49 -0
- package/build/probe/kernel/config.d.ts +5 -0
- package/build/probe/kernel/config.js +209 -0
- package/build/probe/kernel/fixpoint.d.ts +6 -0
- package/build/probe/kernel/fixpoint.js +206 -0
- package/build/probe/kernel/format.d.ts +4 -0
- package/build/probe/kernel/format.js +32 -0
- package/build/probe/kernel/graph.d.ts +4 -0
- package/build/probe/kernel/graph.js +507 -0
- package/build/probe/kernel/ids.d.ts +8 -0
- package/build/probe/kernel/ids.js +66 -0
- package/build/probe/kernel/program.d.ts +8 -0
- package/build/probe/kernel/program.js +13 -0
- package/build/probe/kernel/types.d.ts +134 -0
- package/build/probe/kernel/types.js +1 -0
- package/build/probe/overlay/base/async.jsonc +13 -0
- package/build/probe/overlay/base/exceptions.jsonc +54 -0
- package/build/probe/overlay/base/resources.jsonc +57 -0
- package/build/probe/overlay/load.d.ts +18 -0
- package/build/probe/overlay/load.js +302 -0
- package/build/probe/overlay/presets/express.jsonc +25 -0
- package/build/probe/overlay/presets/node.jsonc +17 -0
- package/build/probe/resources/channel.d.ts +4 -0
- package/build/probe/resources/channel.js +798 -0
- package/build/probe/resources/value.d.ts +9 -0
- package/build/probe/resources/value.js +36 -0
- package/build/tsconfig.d.ts +2 -0
- package/build/tsconfig.js +150 -0
- package/package.json +10 -4
- package/tsconfig.base.json +19 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ResourcesValue = {
|
|
2
|
+
readonly ownsParams: ReadonlySet<number>;
|
|
3
|
+
};
|
|
4
|
+
declare function bottom(): ResourcesValue;
|
|
5
|
+
declare function fromParams(indices: Iterable<number>): ResourcesValue;
|
|
6
|
+
declare function join(a: ResourcesValue, b: ResourcesValue): ResourcesValue;
|
|
7
|
+
declare function equals(a: ResourcesValue, b: ResourcesValue): boolean;
|
|
8
|
+
declare function widen(_prev: ResourcesValue, next: ResourcesValue, _round: number): ResourcesValue;
|
|
9
|
+
export { bottom, equals, fromParams, join, type ResourcesValue, widen };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const EMPTY = new Set();
|
|
2
|
+
function bottom() {
|
|
3
|
+
return { ownsParams: EMPTY };
|
|
4
|
+
}
|
|
5
|
+
function fromParams(indices) {
|
|
6
|
+
const set = new Set(indices);
|
|
7
|
+
return { ownsParams: set.size === 0 ? EMPTY : set };
|
|
8
|
+
}
|
|
9
|
+
function join(a, b) {
|
|
10
|
+
if (a.ownsParams.size === 0) {
|
|
11
|
+
return b;
|
|
12
|
+
}
|
|
13
|
+
if (b.ownsParams.size === 0) {
|
|
14
|
+
return a;
|
|
15
|
+
}
|
|
16
|
+
const set = new Set(a.ownsParams);
|
|
17
|
+
for (const i of b.ownsParams) {
|
|
18
|
+
set.add(i);
|
|
19
|
+
}
|
|
20
|
+
return { ownsParams: set };
|
|
21
|
+
}
|
|
22
|
+
function equals(a, b) {
|
|
23
|
+
if (a.ownsParams.size !== b.ownsParams.size) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
for (const i of a.ownsParams) {
|
|
27
|
+
if (!b.ownsParams.has(i)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
function widen(_prev, next, _round) {
|
|
34
|
+
return next;
|
|
35
|
+
}
|
|
36
|
+
export { bottom, equals, fromParams, join, widen };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { stripJsonc } from './jsonc.js';
|
|
5
|
+
let require = createRequire(import.meta.url);
|
|
6
|
+
function extendsTarget(specifier, fromDir) {
|
|
7
|
+
if (typeof specifier !== 'string') {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
if (specifier.startsWith('.')) {
|
|
11
|
+
let resolved = path.resolve(fromDir, specifier);
|
|
12
|
+
if (fs.existsSync(resolved) && fs.statSync(resolved).isFile()) {
|
|
13
|
+
return resolved;
|
|
14
|
+
}
|
|
15
|
+
if (fs.existsSync(resolved + '.json')) {
|
|
16
|
+
return resolved + '.json';
|
|
17
|
+
}
|
|
18
|
+
let nested = path.join(resolved, 'tsconfig.json');
|
|
19
|
+
return fs.existsSync(nested) ? nested : null;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
return require.resolve(specifier, { paths: [fromDir] });
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
try {
|
|
26
|
+
return require.resolve(specifier + '/tsconfig.json', { paths: [fromDir] });
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function legacyStripJsonc(text) {
|
|
34
|
+
let escaped = false, inBlockComment = false, inLineComment = false, inString = false, stripped = '';
|
|
35
|
+
for (let i = 0, n = text.length; i < n; i++) {
|
|
36
|
+
let char = text[i], next = text[i + 1];
|
|
37
|
+
if (inLineComment) {
|
|
38
|
+
if (char === '\n') {
|
|
39
|
+
inLineComment = false;
|
|
40
|
+
stripped += char;
|
|
41
|
+
}
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (inBlockComment) {
|
|
45
|
+
if (char === '*' && next === '/') {
|
|
46
|
+
inBlockComment = false;
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (inString) {
|
|
52
|
+
stripped += char;
|
|
53
|
+
if (escaped) {
|
|
54
|
+
escaped = false;
|
|
55
|
+
}
|
|
56
|
+
else if (char === '\\') {
|
|
57
|
+
escaped = true;
|
|
58
|
+
}
|
|
59
|
+
else if (char === '"') {
|
|
60
|
+
inString = false;
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (char === '"') {
|
|
65
|
+
inString = true;
|
|
66
|
+
stripped += char;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (char === '/' && next === '/') {
|
|
70
|
+
inLineComment = true;
|
|
71
|
+
i++;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (char === '/' && next === '*') {
|
|
75
|
+
inBlockComment = true;
|
|
76
|
+
i++;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
stripped += char;
|
|
80
|
+
}
|
|
81
|
+
escaped = false;
|
|
82
|
+
inString = false;
|
|
83
|
+
let result = '';
|
|
84
|
+
for (let i = 0, n = stripped.length; i < n; i++) {
|
|
85
|
+
let char = stripped[i];
|
|
86
|
+
if (inString) {
|
|
87
|
+
result += char;
|
|
88
|
+
if (escaped) {
|
|
89
|
+
escaped = false;
|
|
90
|
+
}
|
|
91
|
+
else if (char === '\\') {
|
|
92
|
+
escaped = true;
|
|
93
|
+
}
|
|
94
|
+
else if (char === '"') {
|
|
95
|
+
inString = false;
|
|
96
|
+
}
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (char === '"') {
|
|
100
|
+
inString = true;
|
|
101
|
+
result += char;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (char === ',') {
|
|
105
|
+
let j = i + 1;
|
|
106
|
+
while (j < n && /\s/.test(stripped[j])) {
|
|
107
|
+
j++;
|
|
108
|
+
}
|
|
109
|
+
if (stripped[j] === ']' || stripped[j] === '}') {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
result += char;
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
void legacyStripJsonc;
|
|
118
|
+
const readPlugins = (tsconfigPath) => {
|
|
119
|
+
let seen = new Set();
|
|
120
|
+
function read(configPath) {
|
|
121
|
+
let id = path.resolve(configPath);
|
|
122
|
+
if (seen.has(id)) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
seen.add(id);
|
|
126
|
+
let config;
|
|
127
|
+
try {
|
|
128
|
+
config = JSON.parse(stripJsonc(fs.readFileSync(id, 'utf8')));
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
let plugins;
|
|
134
|
+
if (config.extends !== undefined) {
|
|
135
|
+
let bases = Array.isArray(config.extends) ? config.extends : [config.extends];
|
|
136
|
+
for (let base of bases) {
|
|
137
|
+
let target = extendsTarget(base, path.dirname(id));
|
|
138
|
+
if (target) {
|
|
139
|
+
let inherited = read(target);
|
|
140
|
+
if (inherited !== undefined) {
|
|
141
|
+
plugins = inherited;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return Array.isArray(config.compilerOptions?.plugins) ? config.compilerOptions.plugins : plugins;
|
|
147
|
+
}
|
|
148
|
+
return read(tsconfigPath);
|
|
149
|
+
};
|
|
150
|
+
export { readPlugins };
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"bin": {
|
|
4
4
|
"esportsplus-tsc": "./bin/tsc",
|
|
5
5
|
"esportsplus-tsc-alias": "./bin/tsc-alias",
|
|
6
|
+
"esportsplus-tsc-lsp": "./bin/tsc-lsp",
|
|
6
7
|
"tsc": "./bin/tsc",
|
|
7
8
|
"tsc-alias": "./bin/tsc-alias"
|
|
8
9
|
},
|
|
@@ -11,7 +12,9 @@
|
|
|
11
12
|
"@esportsplus/utilities": "^0.28.0",
|
|
12
13
|
"@types/node": "^26.1.1",
|
|
13
14
|
"tsc-alias": "^1.9.1",
|
|
14
|
-
"typescript": "7.0.2"
|
|
15
|
+
"typescript": "7.0.2",
|
|
16
|
+
"vscode-languageserver": "^10.1.0",
|
|
17
|
+
"vscode-languageserver-textdocument": "^1.0.12"
|
|
15
18
|
},
|
|
16
19
|
"devDependencies": {
|
|
17
20
|
"vite": "^8.1.5",
|
|
@@ -27,6 +30,10 @@
|
|
|
27
30
|
"types": "./build/compiler/index.d.ts",
|
|
28
31
|
"default": "./build/compiler/index.js"
|
|
29
32
|
},
|
|
33
|
+
"./lsp": {
|
|
34
|
+
"types": "./build/lsp/index.d.ts",
|
|
35
|
+
"default": "./build/lsp/index.js"
|
|
36
|
+
},
|
|
30
37
|
".": {
|
|
31
38
|
"types": "./build/index.d.ts",
|
|
32
39
|
"default": "./build/index.js"
|
|
@@ -53,14 +60,13 @@
|
|
|
53
60
|
},
|
|
54
61
|
"type": "module",
|
|
55
62
|
"types": "build/index.d.ts",
|
|
56
|
-
"version": "0.31.
|
|
63
|
+
"version": "0.31.1",
|
|
57
64
|
"scripts": {
|
|
58
65
|
"agent:bench": "pnpm bench:run",
|
|
59
66
|
"agent:build": "pnpm build",
|
|
60
67
|
"agent:test": "pnpm typecheck && pnpm test",
|
|
61
68
|
"bench:run": "vitest bench --run",
|
|
62
|
-
"build": "tsc -p tsconfig.package.json && tsc-alias -p tsconfig.package.json",
|
|
63
|
-
"-": "-",
|
|
69
|
+
"build": "tsc -p tsconfig.package.json && tsc-alias -p tsconfig.package.json && node -e \"const fs=require('fs');fs.cpSync('src/probe/overlay','build/probe/overlay',{recursive:true,filter:(s)=>!/\\.[cm]?tsx?$/.test(s)})\"",
|
|
64
70
|
"test": "vitest run",
|
|
65
71
|
"typecheck": "tsc"
|
|
66
72
|
}
|
package/tsconfig.base.json
CHANGED
|
@@ -23,6 +23,25 @@
|
|
|
23
23
|
"${configDir}/storage/*"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
|
+
"plugins": [
|
|
27
|
+
{
|
|
28
|
+
"name": "ts-probe",
|
|
29
|
+
// Editor squiggle color; "warn" opts down. CLI/build ignore this.
|
|
30
|
+
"severity": "error",
|
|
31
|
+
// Fail the tsc/build run when there are findings.
|
|
32
|
+
"failOnFindings": true,
|
|
33
|
+
"channels": {
|
|
34
|
+
"exceptions": {
|
|
35
|
+
"enabled": true,
|
|
36
|
+
"report": "consumers",
|
|
37
|
+
// Flag `throw`s inside `catch` that drop the caught error's cause.
|
|
38
|
+
"errorCause": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
// Model third-party throw behavior: "node", "express".
|
|
42
|
+
"presets": ["node"]
|
|
43
|
+
}
|
|
44
|
+
],
|
|
26
45
|
"removeComments": true,
|
|
27
46
|
"resolveJsonModule": true,
|
|
28
47
|
"rootDir": "${configDir}/src",
|