@inkandswitch/patchwork-pkg-base 0.0.88 → 0.0.90
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/module-settings-url +1 -1
- package/package.json +1 -1
- package/packages/file/dist/assets/tsgo-worker-Dfn0gu8J.js +446 -0
- package/packages/file/dist/assets/tsgo-worker-Dfn0gu8J.js.map +1 -0
- package/packages/file/dist/index.js +1 -1
- package/packages/file/dist/{tool-B3O4i8l2.js → tool-DbKwBmkX.js} +2 -2
- package/packages/file/dist/{tool-B3O4i8l2.js.map → tool-DbKwBmkX.js.map} +1 -1
- package/packages/file/dist/tsgo.wasm +4 -0
- package/packages/file/dist/{typescript-language-server-oTU8pKzb.js → typescript-language-server-ZZGbUVy4.js} +82 -79
- package/packages/file/dist/{typescript-language-server-oTU8pKzb.js.map → typescript-language-server-ZZGbUVy4.js.map} +1 -1
- package/packages/file/package.json +1 -1
- package/packages/sideboard/dist/{chunk-E6Y5RRIY.js → chunk-F2PUIS4B.js} +3 -3
- package/packages/sideboard/dist/{chunk-IBAIF3GD.js → chunk-TPAJEUW4.js} +2 -2
- package/packages/sideboard/dist/create-new-menu-XURDQMPO.js +2 -0
- package/packages/sideboard/dist/create-new-menu-XURDQMPO.js.map +7 -0
- package/packages/sideboard/dist/document-list-panel-6IHXAUVQ.js +2 -0
- package/packages/sideboard/dist/index.js +1 -1
- package/packages/sideboard/dist/sideboard/sideboard.js +1 -1
- package/plugin-registry-url +1 -1
- package/packages/file/dist/assets/tsgo-worker-BDQ8_wHH.js +0 -4
- package/packages/file/dist/assets/tsgo-worker-BDQ8_wHH.js.map +0 -4
- package/packages/sideboard/dist/create-new-menu-WF2LPUEV.js +0 -2
- package/packages/sideboard/dist/create-new-menu-WF2LPUEV.js.map +0 -7
- package/packages/sideboard/dist/document-list-panel-VY4FDLFY.js +0 -2
- /package/packages/sideboard/dist/{chunk-E6Y5RRIY.js.map → chunk-F2PUIS4B.js.map} +0 -0
- /package/packages/sideboard/dist/{chunk-IBAIF3GD.js.map → chunk-TPAJEUW4.js.map} +0 -0
- /package/packages/sideboard/dist/{document-list-panel-VY4FDLFY.js.map → document-list-panel-6IHXAUVQ.js.map} +0 -0
package/module-settings-url
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
automerge:
|
|
1
|
+
automerge:3V2hqH66pixCQ1ETtaYHadx1cuUN
|
package/package.json
CHANGED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
const D = {
|
|
2
|
+
O_RDONLY: 0,
|
|
3
|
+
O_WRONLY: 1,
|
|
4
|
+
O_RDWR: 2,
|
|
5
|
+
O_CREAT: 64,
|
|
6
|
+
O_EXCL: 128,
|
|
7
|
+
O_TRUNC: 512,
|
|
8
|
+
O_APPEND: 1024,
|
|
9
|
+
O_DIRECTORY: 65536
|
|
10
|
+
};
|
|
11
|
+
function a(o, r) {
|
|
12
|
+
return Object.assign(new Error(`${o}${r ? `: ${r}` : ""}`), {
|
|
13
|
+
code: o
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function f(...o) {
|
|
17
|
+
let r = "";
|
|
18
|
+
for (let w = o.length - 1; w >= 0 && !r.startsWith("/"); w--)
|
|
19
|
+
r = o[w] + (r ? "/" + r : "");
|
|
20
|
+
const g = [];
|
|
21
|
+
for (const w of ("/" + r).split("/"))
|
|
22
|
+
!w || w == "." || (w == ".." ? g.pop() : g.push(w));
|
|
23
|
+
return "/" + g.join("/");
|
|
24
|
+
}
|
|
25
|
+
function C(o) {
|
|
26
|
+
return o.slice(0, o.lastIndexOf("/")) || "/";
|
|
27
|
+
}
|
|
28
|
+
function W() {
|
|
29
|
+
const o = /* @__PURE__ */ new Map([
|
|
30
|
+
["/", { kind: "dir", mtime: Date.now() }]
|
|
31
|
+
]), r = /* @__PURE__ */ new Map();
|
|
32
|
+
let g = 3, w = 1;
|
|
33
|
+
const N = /* @__PURE__ */ new Map(), h = [];
|
|
34
|
+
let O, _ = (e) => {
|
|
35
|
+
};
|
|
36
|
+
const S = new TextDecoder();
|
|
37
|
+
let p = "";
|
|
38
|
+
function T(e) {
|
|
39
|
+
const t = o.get(e);
|
|
40
|
+
if (!t) throw a("ENOENT", e);
|
|
41
|
+
N.has(e) || N.set(e, w++);
|
|
42
|
+
const i = t.kind == "file" ? t.data.byteLength : 0;
|
|
43
|
+
return {
|
|
44
|
+
dev: 1,
|
|
45
|
+
ino: N.get(e),
|
|
46
|
+
mode: t.kind == "dir" ? 16877 : 33188,
|
|
47
|
+
nlink: 1,
|
|
48
|
+
uid: 0,
|
|
49
|
+
gid: 0,
|
|
50
|
+
rdev: 0,
|
|
51
|
+
size: i,
|
|
52
|
+
blksize: 4096,
|
|
53
|
+
blocks: Math.ceil(i / 512),
|
|
54
|
+
atimeMs: t.mtime,
|
|
55
|
+
mtimeMs: t.mtime,
|
|
56
|
+
ctimeMs: t.mtime,
|
|
57
|
+
isDirectory: () => t.kind == "dir"
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function b(e) {
|
|
61
|
+
const t = o.get(e);
|
|
62
|
+
if (!t) throw a("ENOENT", e);
|
|
63
|
+
if (t.kind == "dir") throw a("EISDIR", e);
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
66
|
+
function R(e) {
|
|
67
|
+
var t;
|
|
68
|
+
if (((t = o.get(e)) == null ? void 0 : t.kind) != "dir") {
|
|
69
|
+
if (R(C(e)), o.has(e)) throw a("ENOTDIR", e);
|
|
70
|
+
o.set(e, { kind: "dir", mtime: Date.now() });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function I(e, t, i) {
|
|
74
|
+
let n = 0;
|
|
75
|
+
for (; n < i && h.length; ) {
|
|
76
|
+
const s = h[0], c = Math.min(s.byteLength, i - n);
|
|
77
|
+
e.set(s.subarray(0, c), t + n), n += c, c == s.byteLength ? h.shift() : h[0] = s.subarray(c);
|
|
78
|
+
}
|
|
79
|
+
return n;
|
|
80
|
+
}
|
|
81
|
+
function M(e, t) {
|
|
82
|
+
if (e == 1)
|
|
83
|
+
_(t.slice());
|
|
84
|
+
else {
|
|
85
|
+
p += S.decode(t, { stream: !0 });
|
|
86
|
+
const i = p.lastIndexOf(`
|
|
87
|
+
`);
|
|
88
|
+
i != -1 && (console.warn("[tsgo]", p.slice(0, i)), p = p.slice(i + 1));
|
|
89
|
+
}
|
|
90
|
+
return t.byteLength;
|
|
91
|
+
}
|
|
92
|
+
function l(e, t) {
|
|
93
|
+
let i, n = null;
|
|
94
|
+
try {
|
|
95
|
+
i = t();
|
|
96
|
+
} catch (s) {
|
|
97
|
+
n = s;
|
|
98
|
+
}
|
|
99
|
+
queueMicrotask(() => e(n, i));
|
|
100
|
+
}
|
|
101
|
+
const m = {
|
|
102
|
+
constants: D,
|
|
103
|
+
writeSync(e, t) {
|
|
104
|
+
return M(e, t);
|
|
105
|
+
},
|
|
106
|
+
open(e, t, i, n) {
|
|
107
|
+
l(n, () => {
|
|
108
|
+
var d;
|
|
109
|
+
e = f(e);
|
|
110
|
+
let s = o.get(e);
|
|
111
|
+
if (s && t & D.O_CREAT && t & D.O_EXCL)
|
|
112
|
+
throw a("EEXIST", e);
|
|
113
|
+
if (!s) {
|
|
114
|
+
if (!(t & D.O_CREAT) || ((d = o.get(C(e))) == null ? void 0 : d.kind) != "dir")
|
|
115
|
+
throw a("ENOENT", e);
|
|
116
|
+
s = { kind: "file", data: new Uint8Array(), mtime: Date.now() }, o.set(e, s);
|
|
117
|
+
}
|
|
118
|
+
if (s.kind == "dir" && t & (D.O_WRONLY | D.O_RDWR))
|
|
119
|
+
throw a("EISDIR", e);
|
|
120
|
+
s.kind == "file" && t & D.O_TRUNC && (s.data = new Uint8Array(), s.mtime = Date.now());
|
|
121
|
+
const c = g++;
|
|
122
|
+
return r.set(c, {
|
|
123
|
+
path: e,
|
|
124
|
+
pos: 0,
|
|
125
|
+
append: !!(t & D.O_APPEND)
|
|
126
|
+
}), c;
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
close(e, t) {
|
|
130
|
+
l(t, () => {
|
|
131
|
+
r.delete(e);
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
read(e, t, i, n, s, c) {
|
|
135
|
+
if (e == 0) {
|
|
136
|
+
const d = () => {
|
|
137
|
+
if (!h.length) {
|
|
138
|
+
O = d;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
O = void 0, c(null, I(t, i, n));
|
|
142
|
+
};
|
|
143
|
+
return queueMicrotask(d);
|
|
144
|
+
}
|
|
145
|
+
l(c, () => {
|
|
146
|
+
const d = r.get(e);
|
|
147
|
+
if (!d) throw a("EBADF");
|
|
148
|
+
const { data: y } = b(d.path), u = s ?? d.pos, E = y.subarray(u, u + n);
|
|
149
|
+
return t.set(E, i), s == null && (d.pos += E.byteLength), E.byteLength;
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
write(e, t, i, n, s, c) {
|
|
153
|
+
l(c, () => {
|
|
154
|
+
const d = t.subarray(i, i + n);
|
|
155
|
+
if (e == 1 || e == 2) return M(e, d);
|
|
156
|
+
const y = r.get(e);
|
|
157
|
+
if (!y) throw a("EBADF");
|
|
158
|
+
const u = b(y.path), E = y.append ? u.data.byteLength : s ?? y.pos, L = E + d.byteLength;
|
|
159
|
+
if (L > u.data.byteLength) {
|
|
160
|
+
const k = new Uint8Array(L);
|
|
161
|
+
k.set(u.data), u.data = k;
|
|
162
|
+
}
|
|
163
|
+
return u.data.set(d, E), u.mtime = Date.now(), s == null && (y.pos = L), d.byteLength;
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
fstat(e, t) {
|
|
167
|
+
l(t, () => {
|
|
168
|
+
if (e <= 2)
|
|
169
|
+
return { ...T("/"), mode: 8630, isDirectory: () => !1 };
|
|
170
|
+
const i = r.get(e);
|
|
171
|
+
if (!i) throw a("EBADF");
|
|
172
|
+
return T(i.path);
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
stat(e, t) {
|
|
176
|
+
l(t, () => T(f(e)));
|
|
177
|
+
},
|
|
178
|
+
lstat(e, t) {
|
|
179
|
+
l(t, () => T(f(e)));
|
|
180
|
+
},
|
|
181
|
+
readdir(e, t) {
|
|
182
|
+
l(t, () => {
|
|
183
|
+
var s;
|
|
184
|
+
if (e = f(e), ((s = o.get(e)) == null ? void 0 : s.kind) != "dir") throw a("ENOTDIR", e);
|
|
185
|
+
const i = e == "/" ? "/" : e + "/", n = [];
|
|
186
|
+
for (const c of o.keys())
|
|
187
|
+
if (c != e && c.startsWith(i)) {
|
|
188
|
+
const d = c.slice(i.length);
|
|
189
|
+
d.includes("/") || n.push(d);
|
|
190
|
+
}
|
|
191
|
+
return n;
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
mkdir(e, t, i) {
|
|
195
|
+
l(i, () => {
|
|
196
|
+
var n;
|
|
197
|
+
if (e = f(e), o.has(e)) throw a("EEXIST", e);
|
|
198
|
+
if (((n = o.get(C(e))) == null ? void 0 : n.kind) != "dir") throw a("ENOENT", e);
|
|
199
|
+
o.set(e, { kind: "dir", mtime: Date.now() });
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
rmdir(e, t) {
|
|
203
|
+
l(t, () => {
|
|
204
|
+
var i;
|
|
205
|
+
if (e = f(e), ((i = o.get(e)) == null ? void 0 : i.kind) != "dir") throw a("ENOTDIR", e);
|
|
206
|
+
for (const n of o.keys())
|
|
207
|
+
if (n.startsWith(e + "/")) throw a("ENOTEMPTY", e);
|
|
208
|
+
o.delete(e);
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
unlink(e, t) {
|
|
212
|
+
l(t, () => {
|
|
213
|
+
b(f(e)), o.delete(f(e));
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
rename(e, t, i) {
|
|
217
|
+
l(i, () => {
|
|
218
|
+
e = f(e), t = f(t);
|
|
219
|
+
const n = o.get(e);
|
|
220
|
+
if (!n) throw a("ENOENT", e);
|
|
221
|
+
o.delete(e), o.set(t, n);
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
ftruncate(e, t, i) {
|
|
225
|
+
l(i, () => {
|
|
226
|
+
const n = r.get(e);
|
|
227
|
+
if (!n) throw a("EBADF");
|
|
228
|
+
const s = b(n.path);
|
|
229
|
+
s.data = s.data.slice(0, t);
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
truncate(e, t, i) {
|
|
233
|
+
l(i, () => {
|
|
234
|
+
const n = b(f(e));
|
|
235
|
+
n.data = n.data.slice(0, t);
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
readlink(e, t) {
|
|
239
|
+
t(a("EINVAL", e));
|
|
240
|
+
},
|
|
241
|
+
fsync(e, t) {
|
|
242
|
+
t(null);
|
|
243
|
+
},
|
|
244
|
+
utimes(e, t, i, n) {
|
|
245
|
+
l(n, () => {
|
|
246
|
+
const s = o.get(f(e));
|
|
247
|
+
if (!s) throw a("ENOENT", e);
|
|
248
|
+
s.mtime = i * 1e3;
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
chmod: (e, t, i) => i(null),
|
|
252
|
+
fchmod: (e, t, i) => i(null),
|
|
253
|
+
chown: (e, t, i, n) => n(null),
|
|
254
|
+
fchown: (e, t, i, n) => n(null),
|
|
255
|
+
lchown: (e, t, i, n) => n(null),
|
|
256
|
+
link: (e, t, i) => i(a("ENOSYS")),
|
|
257
|
+
symlink: (e, t, i) => i(a("ENOSYS"))
|
|
258
|
+
}, x = {
|
|
259
|
+
getuid: () => 0,
|
|
260
|
+
getgid: () => 0,
|
|
261
|
+
geteuid: () => 0,
|
|
262
|
+
getegid: () => 0,
|
|
263
|
+
getgroups: () => [0],
|
|
264
|
+
pid: 1,
|
|
265
|
+
ppid: 0,
|
|
266
|
+
umask: () => 18,
|
|
267
|
+
cwd: () => "/",
|
|
268
|
+
chdir: () => {
|
|
269
|
+
}
|
|
270
|
+
}, A = new TextEncoder();
|
|
271
|
+
return {
|
|
272
|
+
fs: m,
|
|
273
|
+
process: x,
|
|
274
|
+
path: { resolve: f },
|
|
275
|
+
writeFile(e, t) {
|
|
276
|
+
e = f(e), R(C(e));
|
|
277
|
+
const i = o.get(e);
|
|
278
|
+
return o.set(e, {
|
|
279
|
+
kind: "file",
|
|
280
|
+
data: A.encode(t),
|
|
281
|
+
mtime: Date.now()
|
|
282
|
+
}), i ? "changed" : "created";
|
|
283
|
+
},
|
|
284
|
+
readFile(e) {
|
|
285
|
+
const t = o.get(f(e));
|
|
286
|
+
return (t == null ? void 0 : t.kind) == "file" ? S.decode(t.data) : void 0;
|
|
287
|
+
},
|
|
288
|
+
exists(e) {
|
|
289
|
+
return o.has(f(e));
|
|
290
|
+
},
|
|
291
|
+
remove(e) {
|
|
292
|
+
return o.delete(f(e));
|
|
293
|
+
},
|
|
294
|
+
writeStdin(e) {
|
|
295
|
+
h.push(e), queueMicrotask(() => O == null ? void 0 : O());
|
|
296
|
+
},
|
|
297
|
+
onStdout(e) {
|
|
298
|
+
_ = e;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
const j = {
|
|
303
|
+
"client/registerCapability": () => null,
|
|
304
|
+
"client/unregisterCapability": () => null,
|
|
305
|
+
"window/workDoneProgress/create": () => null,
|
|
306
|
+
"workspace/configuration": (o) => o.items.map(() => null),
|
|
307
|
+
"workspace/diagnostic/refresh": () => null,
|
|
308
|
+
"workspace/semanticTokens/refresh": () => null,
|
|
309
|
+
"workspace/inlayHint/refresh": () => null,
|
|
310
|
+
"workspace/codeLens/refresh": () => null
|
|
311
|
+
};
|
|
312
|
+
async function J(o, r) {
|
|
313
|
+
const g = W(), w = new TextEncoder(), N = new TextDecoder(), h = globalThis;
|
|
314
|
+
h.fs = g.fs, h.path = g.path, h.process ?? (h.process = g.process), await import("./wasm_exec-pYYJXccF.js");
|
|
315
|
+
function O(n) {
|
|
316
|
+
const s = w.encode(n);
|
|
317
|
+
g.writeStdin(
|
|
318
|
+
w.encode(`Content-Length: ${s.byteLength}\r
|
|
319
|
+
\r
|
|
320
|
+
`)
|
|
321
|
+
), g.writeStdin(s);
|
|
322
|
+
}
|
|
323
|
+
const _ = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
324
|
+
let T = 0;
|
|
325
|
+
function b(n) {
|
|
326
|
+
clearTimeout(S.get(n)), S.set(
|
|
327
|
+
n,
|
|
328
|
+
setTimeout(() => {
|
|
329
|
+
if (S.delete(n), !_.has(n)) return;
|
|
330
|
+
const s = `host:${T++}`;
|
|
331
|
+
p.set(s, n), O(JSON.stringify({
|
|
332
|
+
jsonrpc: "2.0",
|
|
333
|
+
id: s,
|
|
334
|
+
method: "textDocument/diagnostic",
|
|
335
|
+
params: { textDocument: { uri: n } }
|
|
336
|
+
}));
|
|
337
|
+
}, 200)
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
let R = !1, I = [];
|
|
341
|
+
function M(n) {
|
|
342
|
+
var d, y;
|
|
343
|
+
const s = JSON.parse(n);
|
|
344
|
+
if (s.method == "initialized") {
|
|
345
|
+
R = !0;
|
|
346
|
+
for (const u of I) O(u);
|
|
347
|
+
I = [];
|
|
348
|
+
for (const u of _) b(u);
|
|
349
|
+
}
|
|
350
|
+
const c = (y = (d = s.params) == null ? void 0 : d.textDocument) == null ? void 0 : y.uri;
|
|
351
|
+
s.method == "textDocument/didOpen" && _.add(c), s.method == "textDocument/didClose" && _.delete(c), (s.method == "textDocument/didOpen" || s.method == "textDocument/didChange") && b(c);
|
|
352
|
+
}
|
|
353
|
+
function l(n) {
|
|
354
|
+
var c;
|
|
355
|
+
const s = JSON.parse(n);
|
|
356
|
+
if (typeof s.id == "string" && p.has(s.id)) {
|
|
357
|
+
const d = p.get(s.id);
|
|
358
|
+
p.delete(s.id), ((c = s.result) == null ? void 0 : c.kind) == "full" && _.has(d) && r(JSON.stringify({
|
|
359
|
+
jsonrpc: "2.0",
|
|
360
|
+
method: "textDocument/publishDiagnostics",
|
|
361
|
+
params: { uri: d, diagnostics: s.result.items }
|
|
362
|
+
}));
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if ("method" in s && "id" in s && s.method in j) {
|
|
366
|
+
O(JSON.stringify({
|
|
367
|
+
jsonrpc: "2.0",
|
|
368
|
+
id: s.id,
|
|
369
|
+
result: j[s.method](s.params)
|
|
370
|
+
}));
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
r(n);
|
|
374
|
+
}
|
|
375
|
+
let m = new Uint8Array();
|
|
376
|
+
g.onStdout((n) => {
|
|
377
|
+
var c;
|
|
378
|
+
const s = new Uint8Array(m.byteLength + n.byteLength);
|
|
379
|
+
for (s.set(m), s.set(n, m.byteLength), m = s; ; ) {
|
|
380
|
+
let d = -1;
|
|
381
|
+
for (let k = 0; k + 3 < m.byteLength; k++)
|
|
382
|
+
if (m[k] == 13 && m[k + 1] == 10 && m[k + 2] == 13 && m[k + 3] == 10) {
|
|
383
|
+
d = k;
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
if (d == -1) return;
|
|
387
|
+
const y = N.decode(m.subarray(0, d)), u = Number((c = /content-length:\s*(\d+)/i.exec(y)) == null ? void 0 : c[1]), E = d + 4;
|
|
388
|
+
if (m.byteLength < E + u) return;
|
|
389
|
+
const L = N.decode(m.subarray(E, E + u));
|
|
390
|
+
m = m.slice(E + u);
|
|
391
|
+
try {
|
|
392
|
+
l(L);
|
|
393
|
+
} catch (k) {
|
|
394
|
+
console.error("[tsgo] bad message", k, L);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
const x = new h.Go();
|
|
399
|
+
x.argv = ["tsgo", "--lsp", "--stdio"], x.env = { HOME: "/home", TMPDIR: "/tmp" };
|
|
400
|
+
const A = x.importObject, e = await o, { instance: t } = e instanceof Response ? await WebAssembly.instantiateStreaming(e.clone(), A).catch(async () => WebAssembly.instantiate(await e.arrayBuffer(), A)) : await WebAssembly.instantiate(e, A), i = x.run(t);
|
|
401
|
+
return {
|
|
402
|
+
fs: g,
|
|
403
|
+
send(n) {
|
|
404
|
+
O(n), M(n);
|
|
405
|
+
},
|
|
406
|
+
notify(n, s) {
|
|
407
|
+
const c = JSON.stringify({ jsonrpc: "2.0", method: n, params: s });
|
|
408
|
+
R ? O(c) : I.push(c);
|
|
409
|
+
},
|
|
410
|
+
refresh() {
|
|
411
|
+
if (R)
|
|
412
|
+
for (const n of _) b(n);
|
|
413
|
+
},
|
|
414
|
+
exited: i
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
const P = JSON.stringify({
|
|
418
|
+
compilerOptions: {
|
|
419
|
+
target: "esnext",
|
|
420
|
+
module: "esnext",
|
|
421
|
+
moduleResolution: "bundler",
|
|
422
|
+
allowJs: !0,
|
|
423
|
+
checkJs: !1,
|
|
424
|
+
noEmit: !0,
|
|
425
|
+
strict: !0,
|
|
426
|
+
skipLibCheck: !0,
|
|
427
|
+
lib: ["esnext", "dom"],
|
|
428
|
+
jsx: "preserve"
|
|
429
|
+
},
|
|
430
|
+
include: ["**/*"]
|
|
431
|
+
});
|
|
432
|
+
let F;
|
|
433
|
+
const v = [];
|
|
434
|
+
function U(o) {
|
|
435
|
+
J(fetch(o), (r) => self.postMessage({ lsp: r })).then((r) => {
|
|
436
|
+
F = r, r.fs.writeFile("/tsconfig.json", P);
|
|
437
|
+
for (const g of v.splice(0)) r.send(g);
|
|
438
|
+
}).catch((r) => {
|
|
439
|
+
console.error("[tsgo] failed to start", r), self.postMessage({ failed: String((r == null ? void 0 : r.message) ?? r) });
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
self.onmessage = (o) => {
|
|
443
|
+
if ("wasm" in o.data) return U(o.data.wasm);
|
|
444
|
+
F ? F.send(o.data.lsp) : v.push(o.data.lsp);
|
|
445
|
+
};
|
|
446
|
+
//# sourceMappingURL=tsgo-worker-Dfn0gu8J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsgo-worker-Dfn0gu8J.js","sources":["../src/tsgo/memfs.ts","../src/tsgo/host.ts","../src/tsgo-worker.ts"],"sourcesContent":["// just enough of node's fs, process and path for a GOOS=js go program to\n// believe it's on a computer. files live in a map, stdin and stdout are pipes\n// to whoever is driving it\n\ntype Callback = (error: Error | null, value?: unknown) => void\n\ninterface File {\n\tkind: \"file\"\n\tdata: Uint8Array\n\tmtime: number\n}\n\ninterface Dir {\n\tkind: \"dir\"\n\tmtime: number\n}\n\nconst S_IFDIR = 0o040000\nconst S_IFREG = 0o100000\n\nconst constants = {\n\tO_RDONLY: 0,\n\tO_WRONLY: 1,\n\tO_RDWR: 2,\n\tO_CREAT: 64,\n\tO_EXCL: 128,\n\tO_TRUNC: 512,\n\tO_APPEND: 1024,\n\tO_DIRECTORY: 65536,\n}\n\nfunction oops(code: string, path?: string) {\n\treturn Object.assign(new Error(`${code}${path ? `: ${path}` : \"\"}`), {\n\t\tcode,\n\t})\n}\n\nexport function resolve(...segments: string[]) {\n\tlet path = \"\"\n\tfor (let i = segments.length - 1; i >= 0 && !path.startsWith(\"/\"); i--) {\n\t\tpath = segments[i] + (path ? \"/\" + path : \"\")\n\t}\n\tconst parts: string[] = []\n\tfor (const part of (\"/\" + path).split(\"/\")) {\n\t\tif (!part || part == \".\") continue\n\t\tif (part == \"..\") parts.pop()\n\t\telse parts.push(part)\n\t}\n\treturn \"/\" + parts.join(\"/\")\n}\n\nfunction parent(path: string) {\n\treturn path.slice(0, path.lastIndexOf(\"/\")) || \"/\"\n}\n\nexport function createMemFS() {\n\tconst nodes = new Map<string, File | Dir>([\n\t\t[\"/\", { kind: \"dir\", mtime: Date.now() }],\n\t])\n\tconst fds = new Map<number, { path: string; pos: number; append: boolean }>()\n\tlet nextFd = 3\n\tlet ino = 1\n\tconst inodes = new Map<string, number>()\n\n\tconst stdin: Uint8Array[] = []\n\tlet waiting: (() => void) | undefined\n\tlet stdout = (_bytes: Uint8Array) => {}\n\tconst decoder = new TextDecoder()\n\tlet stderr = \"\"\n\n\tfunction stat(path: string) {\n\t\tconst node = nodes.get(path)\n\t\tif (!node) throw oops(\"ENOENT\", path)\n\t\tif (!inodes.has(path)) inodes.set(path, ino++)\n\t\tconst size = node.kind == \"file\" ? node.data.byteLength : 0\n\t\treturn {\n\t\t\tdev: 1,\n\t\t\tino: inodes.get(path),\n\t\t\tmode: node.kind == \"dir\" ? S_IFDIR | 0o755 : S_IFREG | 0o644,\n\t\t\tnlink: 1,\n\t\t\tuid: 0,\n\t\t\tgid: 0,\n\t\t\trdev: 0,\n\t\t\tsize,\n\t\t\tblksize: 4096,\n\t\t\tblocks: Math.ceil(size / 512),\n\t\t\tatimeMs: node.mtime,\n\t\t\tmtimeMs: node.mtime,\n\t\t\tctimeMs: node.mtime,\n\t\t\tisDirectory: () => node.kind == \"dir\",\n\t\t}\n\t}\n\n\tfunction file(path: string) {\n\t\tconst node = nodes.get(path)\n\t\tif (!node) throw oops(\"ENOENT\", path)\n\t\tif (node.kind == \"dir\") throw oops(\"EISDIR\", path)\n\t\treturn node\n\t}\n\n\tfunction mkdirp(path: string) {\n\t\tif (nodes.get(path)?.kind == \"dir\") return\n\t\tmkdirp(parent(path))\n\t\tif (nodes.has(path)) throw oops(\"ENOTDIR\", path)\n\t\tnodes.set(path, { kind: \"dir\", mtime: Date.now() })\n\t}\n\n\tfunction readStdin(buffer: Uint8Array, offset: number, length: number) {\n\t\tlet n = 0\n\t\twhile (n < length && stdin.length) {\n\t\t\tconst chunk = stdin[0]\n\t\t\tconst take = Math.min(chunk.byteLength, length - n)\n\t\t\tbuffer.set(chunk.subarray(0, take), offset + n)\n\t\t\tn += take\n\t\t\tif (take == chunk.byteLength) stdin.shift()\n\t\t\telse stdin[0] = chunk.subarray(take)\n\t\t}\n\t\treturn n\n\t}\n\n\tfunction writeOut(fd: number, bytes: Uint8Array) {\n\t\tif (fd == 1) {\n\t\t\tstdout(bytes.slice())\n\t\t} else {\n\t\t\tstderr += decoder.decode(bytes, { stream: true })\n\t\t\tconst nl = stderr.lastIndexOf(\"\\n\")\n\t\t\tif (nl != -1) {\n\t\t\t\tconsole.warn(\"[tsgo]\", stderr.slice(0, nl))\n\t\t\t\tstderr = stderr.slice(nl + 1)\n\t\t\t}\n\t\t}\n\t\treturn bytes.byteLength\n\t}\n\n\t// every method reports through a node-style callback; go waits on it. later, as node does: a\n\t// callback made right away runs go inside this call, so the js stack grows by a go turn per\n\t// call and never unwinds (safari's worker stack runs out while tsgo starts)\n\tfunction call(callback: Callback, fn: () => unknown) {\n\t\tlet value: unknown\n\t\tlet error: Error | null = null\n\t\ttry {\n\t\t\tvalue = fn()\n\t\t} catch (e) {\n\t\t\terror = e as Error\n\t\t}\n\t\tqueueMicrotask(() => callback(error, value))\n\t}\n\n\tconst fs = {\n\t\tconstants,\n\t\twriteSync(fd: number, buf: Uint8Array) {\n\t\t\treturn writeOut(fd, buf)\n\t\t},\n\t\topen(path: string, flags: number, _mode: number, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tpath = resolve(path)\n\t\t\t\tlet node = nodes.get(path)\n\t\t\t\tif (node && flags & constants.O_CREAT && flags & constants.O_EXCL) {\n\t\t\t\t\tthrow oops(\"EEXIST\", path)\n\t\t\t\t}\n\t\t\t\tif (!node) {\n\t\t\t\t\tif (!(flags & constants.O_CREAT)) throw oops(\"ENOENT\", path)\n\t\t\t\t\tif (nodes.get(parent(path))?.kind != \"dir\") {\n\t\t\t\t\t\tthrow oops(\"ENOENT\", path)\n\t\t\t\t\t}\n\t\t\t\t\tnode = { kind: \"file\", data: new Uint8Array(), mtime: Date.now() }\n\t\t\t\t\tnodes.set(path, node)\n\t\t\t\t}\n\t\t\t\tif (node.kind == \"dir\" && flags & (constants.O_WRONLY | constants.O_RDWR)) {\n\t\t\t\t\tthrow oops(\"EISDIR\", path)\n\t\t\t\t}\n\t\t\t\tif (node.kind == \"file\" && flags & constants.O_TRUNC) {\n\t\t\t\t\tnode.data = new Uint8Array()\n\t\t\t\t\tnode.mtime = Date.now()\n\t\t\t\t}\n\t\t\t\tconst fd = nextFd++\n\t\t\t\tfds.set(fd, {\n\t\t\t\t\tpath,\n\t\t\t\t\tpos: 0,\n\t\t\t\t\tappend: Boolean(flags & constants.O_APPEND),\n\t\t\t\t})\n\t\t\t\treturn fd\n\t\t\t})\n\t\t},\n\t\tclose(fd: number, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tfds.delete(fd)\n\t\t\t})\n\t\t},\n\t\tread(\n\t\t\tfd: number,\n\t\t\tbuffer: Uint8Array,\n\t\t\toffset: number,\n\t\t\tlength: number,\n\t\t\tposition: number | null,\n\t\t\tcallback: Callback,\n\t\t) {\n\t\t\tif (fd == 0) {\n\t\t\t\t// park until someone writes to stdin; go keeps running other goroutines\n\t\t\t\tconst attempt = () => {\n\t\t\t\t\tif (!stdin.length) {\n\t\t\t\t\t\twaiting = attempt\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\twaiting = undefined\n\t\t\t\t\tcallback(null, readStdin(buffer, offset, length))\n\t\t\t\t}\n\t\t\t\treturn queueMicrotask(attempt)\n\t\t\t}\n\t\t\tcall(callback, () => {\n\t\t\t\tconst handle = fds.get(fd)\n\t\t\t\tif (!handle) throw oops(\"EBADF\")\n\t\t\t\tconst { data } = file(handle.path)\n\t\t\t\tconst start = position ?? handle.pos\n\t\t\t\tconst chunk = data.subarray(start, start + length)\n\t\t\t\tbuffer.set(chunk, offset)\n\t\t\t\tif (position == null) handle.pos += chunk.byteLength\n\t\t\t\treturn chunk.byteLength\n\t\t\t})\n\t\t},\n\t\twrite(\n\t\t\tfd: number,\n\t\t\tbuffer: Uint8Array,\n\t\t\toffset: number,\n\t\t\tlength: number,\n\t\t\tposition: number | null,\n\t\t\tcallback: Callback,\n\t\t) {\n\t\t\tcall(callback, () => {\n\t\t\t\tconst bytes = buffer.subarray(offset, offset + length)\n\t\t\t\tif (fd == 1 || fd == 2) return writeOut(fd, bytes)\n\t\t\t\tconst handle = fds.get(fd)\n\t\t\t\tif (!handle) throw oops(\"EBADF\")\n\t\t\t\tconst node = file(handle.path)\n\t\t\t\tconst start = handle.append ? node.data.byteLength : position ?? handle.pos\n\t\t\t\tconst end = start + bytes.byteLength\n\t\t\t\tif (end > node.data.byteLength) {\n\t\t\t\t\tconst grown = new Uint8Array(end)\n\t\t\t\t\tgrown.set(node.data)\n\t\t\t\t\tnode.data = grown\n\t\t\t\t}\n\t\t\t\tnode.data.set(bytes, start)\n\t\t\t\tnode.mtime = Date.now()\n\t\t\t\tif (position == null) handle.pos = end\n\t\t\t\treturn bytes.byteLength\n\t\t\t})\n\t\t},\n\t\tfstat(fd: number, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tif (fd <= 2) {\n\t\t\t\t\treturn { ...stat(\"/\"), mode: 0o020000 | 0o666, isDirectory: () => false }\n\t\t\t\t}\n\t\t\t\tconst handle = fds.get(fd)\n\t\t\t\tif (!handle) throw oops(\"EBADF\")\n\t\t\t\treturn stat(handle.path)\n\t\t\t})\n\t\t},\n\t\tstat(path: string, callback: Callback) {\n\t\t\tcall(callback, () => stat(resolve(path)))\n\t\t},\n\t\tlstat(path: string, callback: Callback) {\n\t\t\tcall(callback, () => stat(resolve(path)))\n\t\t},\n\t\treaddir(path: string, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tpath = resolve(path)\n\t\t\t\tif (nodes.get(path)?.kind != \"dir\") throw oops(\"ENOTDIR\", path)\n\t\t\t\tconst prefix = path == \"/\" ? \"/\" : path + \"/\"\n\t\t\t\tconst names: string[] = []\n\t\t\t\tfor (const key of nodes.keys()) {\n\t\t\t\t\tif (key != path && key.startsWith(prefix)) {\n\t\t\t\t\t\tconst rest = key.slice(prefix.length)\n\t\t\t\t\t\tif (!rest.includes(\"/\")) names.push(rest)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn names\n\t\t\t})\n\t\t},\n\t\tmkdir(path: string, _perm: number, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tpath = resolve(path)\n\t\t\t\tif (nodes.has(path)) throw oops(\"EEXIST\", path)\n\t\t\t\tif (nodes.get(parent(path))?.kind != \"dir\") throw oops(\"ENOENT\", path)\n\t\t\t\tnodes.set(path, { kind: \"dir\", mtime: Date.now() })\n\t\t\t})\n\t\t},\n\t\trmdir(path: string, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tpath = resolve(path)\n\t\t\t\tif (nodes.get(path)?.kind != \"dir\") throw oops(\"ENOTDIR\", path)\n\t\t\t\tfor (const key of nodes.keys()) {\n\t\t\t\t\tif (key.startsWith(path + \"/\")) throw oops(\"ENOTEMPTY\", path)\n\t\t\t\t}\n\t\t\t\tnodes.delete(path)\n\t\t\t})\n\t\t},\n\t\tunlink(path: string, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tfile(resolve(path))\n\t\t\t\tnodes.delete(resolve(path))\n\t\t\t})\n\t\t},\n\t\trename(from: string, to: string, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tfrom = resolve(from)\n\t\t\t\tto = resolve(to)\n\t\t\t\tconst node = nodes.get(from)\n\t\t\t\tif (!node) throw oops(\"ENOENT\", from)\n\t\t\t\tnodes.delete(from)\n\t\t\t\tnodes.set(to, node)\n\t\t\t})\n\t\t},\n\t\tftruncate(fd: number, length: number, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tconst handle = fds.get(fd)\n\t\t\t\tif (!handle) throw oops(\"EBADF\")\n\t\t\t\tconst node = file(handle.path)\n\t\t\t\tnode.data = node.data.slice(0, length)\n\t\t\t})\n\t\t},\n\t\ttruncate(path: string, length: number, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tconst node = file(resolve(path))\n\t\t\t\tnode.data = node.data.slice(0, length)\n\t\t\t})\n\t\t},\n\t\treadlink(path: string, callback: Callback) {\n\t\t\tcallback(oops(\"EINVAL\", path))\n\t\t},\n\t\tfsync(_fd: number, callback: Callback) {\n\t\t\tcallback(null)\n\t\t},\n\t\tutimes(path: string, _atime: number, mtime: number, callback: Callback) {\n\t\t\tcall(callback, () => {\n\t\t\t\tconst node = nodes.get(resolve(path))\n\t\t\t\tif (!node) throw oops(\"ENOENT\", path)\n\t\t\t\tnode.mtime = mtime * 1000\n\t\t\t})\n\t\t},\n\t\tchmod: (_p: string, _m: number, cb: Callback) => cb(null),\n\t\tfchmod: (_fd: number, _m: number, cb: Callback) => cb(null),\n\t\tchown: (_p: string, _u: number, _g: number, cb: Callback) => cb(null),\n\t\tfchown: (_fd: number, _u: number, _g: number, cb: Callback) => cb(null),\n\t\tlchown: (_p: string, _u: number, _g: number, cb: Callback) => cb(null),\n\t\tlink: (_p: string, _l: string, cb: Callback) => cb(oops(\"ENOSYS\")),\n\t\tsymlink: (_p: string, _l: string, cb: Callback) => cb(oops(\"ENOSYS\")),\n\t}\n\n\tconst process = {\n\t\tgetuid: () => 0,\n\t\tgetgid: () => 0,\n\t\tgeteuid: () => 0,\n\t\tgetegid: () => 0,\n\t\tgetgroups: () => [0],\n\t\tpid: 1,\n\t\tppid: 0,\n\t\tumask: () => 0o022,\n\t\tcwd: () => \"/\",\n\t\tchdir: () => {},\n\t}\n\n\tconst encoder = new TextEncoder()\n\n\treturn {\n\t\tfs,\n\t\tprocess,\n\t\tpath: { resolve },\n\t\twriteFile(path: string, text: string) {\n\t\t\tpath = resolve(path)\n\t\t\tmkdirp(parent(path))\n\t\t\tconst existing = nodes.get(path)\n\t\t\tnodes.set(path, {\n\t\t\t\tkind: \"file\",\n\t\t\t\tdata: encoder.encode(text),\n\t\t\t\tmtime: Date.now(),\n\t\t\t})\n\t\t\treturn existing ? \"changed\" : \"created\"\n\t\t},\n\t\treadFile(path: string) {\n\t\t\tconst node = nodes.get(resolve(path))\n\t\t\treturn node?.kind == \"file\" ? decoder.decode(node.data) : undefined\n\t\t},\n\t\texists(path: string) {\n\t\t\treturn nodes.has(resolve(path))\n\t\t},\n\t\tremove(path: string) {\n\t\t\treturn nodes.delete(resolve(path))\n\t\t},\n\t\twriteStdin(bytes: Uint8Array) {\n\t\t\tstdin.push(bytes)\n\t\t\t// never call back into go while go might be on the stack\n\t\t\tqueueMicrotask(() => waiting?.())\n\t\t},\n\t\tonStdout(fn: (bytes: Uint8Array) => void) {\n\t\t\tstdout = fn\n\t\t},\n\t}\n}\n\nexport type MemFS = ReturnType<typeof createMemFS>\n","// runs tsgo's language server (typescript 7, compiled to wasm) against an\n// in-memory filesystem. messages in and out are plain json-rpc strings\n\nimport { createMemFS } from \"./memfs\"\n\n// requests the server makes of its client that only make sense to answer\n// here, where the filesystem lives\nconst answers: Record<string, (params: any) => unknown> = {\n\t\"client/registerCapability\": () => null,\n\t\"client/unregisterCapability\": () => null,\n\t\"window/workDoneProgress/create\": () => null,\n\t\"workspace/configuration\": (params) => params.items.map(() => null),\n\t\"workspace/diagnostic/refresh\": () => null,\n\t\"workspace/semanticTokens/refresh\": () => null,\n\t\"workspace/inlayHint/refresh\": () => null,\n\t\"workspace/codeLens/refresh\": () => null,\n}\n\nexport interface Tsgo {\n\tfs: ReturnType<typeof createMemFS>\n\t// a message from the client, forwarded to the server\n\tsend(message: string): void\n\t// a notification of our own, for things the client doesn't know about\n\tnotify(method: string, params: unknown): void\n\t// re-check every open file, e.g. after files they import have changed\n\trefresh(): void\n\texited: Promise<void>\n}\n\nexport async function startTsgo(\n\twasm: BufferSource | Response | Promise<Response>,\n\tonMessage: (message: string) => void,\n): Promise<Tsgo> {\n\tconst memfs = createMemFS()\n\tconst encoder = new TextEncoder()\n\tconst decoder = new TextDecoder()\n\n\tconst g = globalThis as any\n\tg.fs = memfs.fs\n\tg.path = memfs.path\n\tg.process ??= memfs.process\n\t// wasm_exec looks for the globals above when it loads, so it has to wait\n\t// @ts-expect-error go's runtime: a script that sets globalThis.Go, not a module\n\tawait import(\"./wasm_exec.js\")\n\n\tfunction write(message: string) {\n\t\tconst body = encoder.encode(message)\n\t\tmemfs.writeStdin(\n\t\t\tencoder.encode(`Content-Length: ${body.byteLength}\\r\\n\\r\\n`),\n\t\t)\n\t\tmemfs.writeStdin(body)\n\t}\n\n\t// tsgo only answers diagnostic *requests* for source files, but most\n\t// clients wait for them to be pushed. so we ask on their behalf\n\tconst open = new Set<string>()\n\tconst timers = new Map<string, ReturnType<typeof setTimeout>>()\n\tconst ours = new Map<string, string>()\n\tlet nextId = 0\n\n\tfunction check(uri: string) {\n\t\tclearTimeout(timers.get(uri))\n\t\ttimers.set(\n\t\t\turi,\n\t\t\tsetTimeout(() => {\n\t\t\t\ttimers.delete(uri)\n\t\t\t\tif (!open.has(uri)) return\n\t\t\t\tconst id = `host:${nextId++}`\n\t\t\t\tours.set(id, uri)\n\t\t\t\twrite(JSON.stringify({\n\t\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t\t\tid,\n\t\t\t\t\tmethod: \"textDocument/diagnostic\",\n\t\t\t\t\tparams: { textDocument: { uri } },\n\t\t\t\t}))\n\t\t\t}, 200),\n\t\t)\n\t}\n\n\t// the server drops anything we say before the client has said hello\n\tlet initialized = false\n\tlet held: string[] = []\n\n\tfunction watch(message: string) {\n\t\tconst value = JSON.parse(message)\n\t\tif (value.method == \"initialized\") {\n\t\t\tinitialized = true\n\t\t\tfor (const message of held) write(message)\n\t\t\theld = []\n\t\t\tfor (const uri of open) check(uri)\n\t\t}\n\t\tconst uri = value.params?.textDocument?.uri\n\t\tif (value.method == \"textDocument/didOpen\") open.add(uri)\n\t\tif (value.method == \"textDocument/didClose\") open.delete(uri)\n\t\tif (value.method == \"textDocument/didOpen\" || value.method == \"textDocument/didChange\") {\n\t\t\tcheck(uri)\n\t\t}\n\t}\n\n\tfunction receive(message: string) {\n\t\tconst value = JSON.parse(message)\n\t\tif (typeof value.id == \"string\" && ours.has(value.id)) {\n\t\t\tconst uri = ours.get(value.id)!\n\t\t\tours.delete(value.id)\n\t\t\tif (value.result?.kind == \"full\" && open.has(uri)) {\n\t\t\t\tonMessage(JSON.stringify({\n\t\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t\t\tmethod: \"textDocument/publishDiagnostics\",\n\t\t\t\t\tparams: { uri, diagnostics: value.result.items },\n\t\t\t\t}))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif (\"method\" in value && \"id\" in value && value.method in answers) {\n\t\t\twrite(JSON.stringify({\n\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t\tid: value.id,\n\t\t\t\tresult: answers[value.method](value.params),\n\t\t\t}))\n\t\t\treturn\n\t\t}\n\t\tonMessage(message)\n\t}\n\n\t// stdout is a stream of `Content-Length: n\\r\\n\\r\\n` + n bytes of json\n\tlet pending = new Uint8Array()\n\tmemfs.onStdout((bytes) => {\n\t\tconst joined = new Uint8Array(pending.byteLength + bytes.byteLength)\n\t\tjoined.set(pending)\n\t\tjoined.set(bytes, pending.byteLength)\n\t\tpending = joined\n\t\twhile (true) {\n\t\t\tlet end = -1\n\t\t\tfor (let i = 0; i + 3 < pending.byteLength; i++) {\n\t\t\t\tif (\n\t\t\t\t\tpending[i] == 13 && pending[i + 1] == 10 &&\n\t\t\t\t\tpending[i + 2] == 13 && pending[i + 3] == 10\n\t\t\t\t) {\n\t\t\t\t\tend = i\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (end == -1) return\n\t\t\tconst header = decoder.decode(pending.subarray(0, end))\n\t\t\tconst length = Number(/content-length:\\s*(\\d+)/i.exec(header)?.[1])\n\t\t\tconst start = end + 4\n\t\t\tif (pending.byteLength < start + length) return\n\t\t\tconst message = decoder.decode(pending.subarray(start, start + length))\n\t\t\tpending = pending.slice(start + length)\n\t\t\ttry {\n\t\t\t\treceive(message)\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"[tsgo] bad message\", error, message)\n\t\t\t}\n\t\t}\n\t})\n\n\tconst go = new g.Go()\n\tgo.argv = [\"tsgo\", \"--lsp\", \"--stdio\"]\n\tgo.env = { HOME: \"/home\", TMPDIR: \"/tmp\" }\n\tconst imports = go.importObject\n\tconst source = await wasm\n\tconst { instance } = source instanceof Response\n\t\t? await WebAssembly.instantiateStreaming(source.clone(), imports)\n\t\t\t// streaming needs the right mime type, which not every server sends\n\t\t\t.catch(async () => WebAssembly.instantiate(await source.arrayBuffer(), imports))\n\t\t: await WebAssembly.instantiate(source, imports)\n\tconst exited = go.run(instance) as Promise<void>\n\n\treturn {\n\t\tfs: memfs,\n\t\tsend(message) {\n\t\t\twrite(message)\n\t\t\twatch(message)\n\t\t},\n\t\tnotify(method, params) {\n\t\t\tconst message = JSON.stringify({ jsonrpc: \"2.0\", method, params })\n\t\t\tif (initialized) write(message)\n\t\t\telse held.push(message)\n\t\t},\n\t\trefresh() {\n\t\t\tif (initialized) { for (const uri of open) check(uri) }\n\t\t},\n\t\texited,\n\t}\n}\n","// TypeScript 7's language server (tsgo, compiled to wasm) in a worker, talking\n// json-rpc with the editors' LSP client. Its files are in memory: the open\n// editors' documents (as the client sends them) and one tsconfig for them all.\n// The page's first message says where tsgo.wasm is; the rest are LSP.\nimport {startTsgo, type Tsgo} from \"./tsgo/host\"\n\nconst TSCONFIG = JSON.stringify({\n\tcompilerOptions: {\n\t\ttarget: \"esnext\",\n\t\tmodule: \"esnext\",\n\t\tmoduleResolution: \"bundler\",\n\t\tallowJs: true,\n\t\tcheckJs: false,\n\t\tnoEmit: true,\n\t\tstrict: true,\n\t\tskipLibCheck: true,\n\t\tlib: [\"esnext\", \"dom\"],\n\t\tjsx: \"preserve\",\n\t},\n\tinclude: [\"**/*\"],\n})\n\nlet tsgo: Tsgo | undefined\nconst queue: string[] = []\n\nfunction start(wasm: string) {\n\tstartTsgo(fetch(wasm), (lsp) => self.postMessage({lsp}))\n\t\t.then((ready) => {\n\t\t\ttsgo = ready\n\t\t\tready.fs.writeFile(\"/tsconfig.json\", TSCONFIG)\n\t\t\tfor (const message of queue.splice(0)) ready.send(message)\n\t\t})\n\t\t.catch((error) => {\n\t\t\tconsole.error(\"[tsgo] failed to start\", error)\n\t\t\tself.postMessage({failed: String(error?.message ?? error)})\n\t\t})\n}\n\nself.onmessage = (event: MessageEvent<{lsp: string} | {wasm: string}>) => {\n\tif (\"wasm\" in event.data) return start(event.data.wasm)\n\tif (tsgo) tsgo.send(event.data.lsp)\n\telse queue.push(event.data.lsp)\n}\n"],"names":["constants","oops","code","path","resolve","segments","i","parts","part","parent","createMemFS","nodes","fds","nextFd","ino","inodes","stdin","waiting","stdout","_bytes","decoder","stderr","stat","node","size","file","mkdirp","_a","readStdin","buffer","offset","length","chunk","take","writeOut","fd","bytes","nl","call","callback","fn","value","error","e","fs","buf","flags","_mode","position","attempt","handle","data","start","end","grown","prefix","names","key","rest","_perm","from","to","_fd","_atime","mtime","_p","_m","cb","_u","_g","_l","process","encoder","text","existing","answers","params","startTsgo","wasm","onMessage","memfs","g","write","message","body","open","timers","ours","nextId","check","uri","id","initialized","held","watch","_b","receive","pending","joined","header","go","imports","source","instance","exited","method","TSCONFIG","tsgo","queue","lsp","ready","event"],"mappings":"AAoBA,MAAMA,IAAY;AAAA,EACjB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,aAAa;AACd;AAEA,SAASC,EAAKC,GAAcC,GAAe;AAC1C,SAAO,OAAO,OAAO,IAAI,MAAM,GAAGD,CAAI,GAAGC,IAAO,KAAKA,CAAI,KAAK,EAAE,EAAE,GAAG;AAAA,IACpE,MAAAD;AAAA,EAAA,CACA;AACF;AAEO,SAASE,KAAWC,GAAoB;AAC9C,MAAIF,IAAO;AACX,WAASG,IAAID,EAAS,SAAS,GAAGC,KAAK,KAAK,CAACH,EAAK,WAAW,GAAG,GAAGG;AAClE,IAAAH,IAAOE,EAASC,CAAC,KAAKH,IAAO,MAAMA,IAAO;AAE3C,QAAMI,IAAkB,CAAA;AACxB,aAAWC,MAAS,MAAML,GAAM,MAAM,GAAG;AACxC,IAAI,CAACK,KAAQA,KAAQ,Q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AAM,CAAAI,EAAMC,CAAG;AAAA,IACrD;AAAA,IACA,QAAAc;AAAA,EAAA;AAEF;ACnLA,MAAME,IAAW,KAAK,UAAU;AAAA,EAC/B,iBAAiB;AAAA,IAChB,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,KAAK,CAAC,UAAU,KAAK;AAAA,IACrB,KAAK;AAAA,EAAA;AAAA,EAEN,SAAS,CAAC,MAAM;AACjB,CAAC;AAED,IAAIC;AACJ,MAAMC,IAAkB,CAAA;AAExB,SAASxD,EAAM0B,GAAc;AAC5B,EAAAD,EAAU,MAAMC,CAAI,GAAG,CAAC+B,MAAQ,KAAK,YAAY,EAAC,KAAAA,EAAA,CAAI,CAAC,EACrD,KAAK,CAACC,MAAU;AAChB,IAAAH,IAAOG,GACPA,EAAM,GAAG,UAAU,kBAAkBJ,CAAQ;AAC7C,eAAWvB,KAAWyB,EAAM,OAAO,CAAC,EAAG,CAAAE,EAAM,KAAK3B,CAAO;AAAA,EAC1D,CAAC,EACA,MAAM,CAACzC,MAAU;AACjB,YAAQ,MAAM,0BAA0BA,CAAK,GAC7C,KAAK,YAAY,EAAC,QAAQ,QAAOA,KAAA,gBAAAA,EAAO,YAAWA,CAAK,GAAE;AAAA,EAC3D,CAAC;AACH;AAEA,KAAK,YAAY,CAACqE,MAAwD;AACzE,MAAI,UAAUA,EAAM,aAAa3D,EAAM2D,EAAM,KAAK,IAAI;AACtD,EAAIJ,IAAMA,EAAK,KAAKI,EAAM,KAAK,GAAG,IAC7BH,EAAM,KAAKG,EAAM,KAAK,GAAG;AAC/B;"}
|
|
@@ -13565,7 +13565,7 @@ function _m(e) {
|
|
|
13565
13565
|
s = !0;
|
|
13566
13566
|
});
|
|
13567
13567
|
const Q = e.doc.extension.replace(/^\./, "").toLowerCase(), l = `file:///${((n = e.handle) == null ? void 0 : n.documentId) ?? "untitled"}/index.${Q}`;
|
|
13568
|
-
import("./typescript-language-server-
|
|
13568
|
+
import("./typescript-language-server-ZZGbUVy4.js").then(({
|
|
13569
13569
|
typescriptLanguageServer: o
|
|
13570
13570
|
}) => {
|
|
13571
13571
|
s || i.dispatch({
|
|
@@ -13766,4 +13766,4 @@ export {
|
|
|
13766
13766
|
gd as s,
|
|
13767
13767
|
Hm as t
|
|
13768
13768
|
};
|
|
13769
|
-
//# sourceMappingURL=tool-
|
|
13769
|
+
//# sourceMappingURL=tool-DbKwBmkX.js.map
|