@crowdedkingdoms/crowdyjs 8.22.0 → 9.0.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.
Files changed (43) hide show
  1. package/MIGRATION.md +44 -0
  2. package/README.md +74 -3
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/live-coding/assets/browser-authoring-index.json +1 -0
  7. package/dist/live-coding/assets/manifest.json +19 -0
  8. package/dist/live-coding/assets/tree-sitter-rust.wasm +0 -0
  9. package/dist/live-coding/assets/web-tree-sitter.wasm +0 -0
  10. package/dist/live-coding/browser-authoring-index.generated.d.ts +2 -0
  11. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -0
  12. package/dist/live-coding/browser-authoring-index.generated.js +5127 -0
  13. package/dist/live-coding/ide.d.ts +14 -7
  14. package/dist/live-coding/ide.d.ts.map +1 -1
  15. package/dist/live-coding/ide.js +296 -181
  16. package/dist/live-coding/index.d.ts +8 -0
  17. package/dist/live-coding/index.d.ts.map +1 -0
  18. package/dist/live-coding/index.js +7 -0
  19. package/dist/live-coding/lsp-protocol.d.ts +98 -0
  20. package/dist/live-coding/lsp-protocol.d.ts.map +1 -0
  21. package/dist/live-coding/lsp-protocol.js +70 -0
  22. package/dist/live-coding/monaco-services.d.ts +22 -0
  23. package/dist/live-coding/monaco-services.d.ts.map +1 -0
  24. package/dist/live-coding/monaco-services.js +69 -0
  25. package/dist/live-coding/platform-index.d.ts +29 -0
  26. package/dist/live-coding/platform-index.d.ts.map +1 -0
  27. package/dist/live-coding/platform-index.js +281 -0
  28. package/dist/live-coding/rust-analysis.d.ts +24 -0
  29. package/dist/live-coding/rust-analysis.d.ts.map +1 -0
  30. package/dist/live-coding/rust-analysis.js +312 -0
  31. package/dist/live-coding/rust-lsp-server.d.ts +43 -0
  32. package/dist/live-coding/rust-lsp-server.d.ts.map +1 -0
  33. package/dist/live-coding/rust-lsp-server.js +455 -0
  34. package/dist/live-coding/rust-lsp.worker.d.ts +2 -0
  35. package/dist/live-coding/rust-lsp.worker.d.ts.map +1 -0
  36. package/dist/live-coding/rust-lsp.worker.js +26 -0
  37. package/dist/live-coding/vfs.d.ts +41 -0
  38. package/dist/live-coding/vfs.d.ts.map +1 -0
  39. package/dist/live-coding/vfs.js +174 -0
  40. package/dist/live-coding/worker-transport.d.ts +60 -0
  41. package/dist/live-coding/worker-transport.d.ts.map +1 -0
  42. package/dist/live-coding/worker-transport.js +204 -0
  43. package/package.json +18 -6
@@ -0,0 +1,455 @@
1
+ import { JSON_RPC_ERRORS, decodeJsonRpcMessage, isRecord, } from './lsp-protocol.js';
2
+ import { EMBEDDED_PLATFORM_INDEX, loadPlatformIndex, } from './platform-index.js';
3
+ import { DEFAULT_VFS_LIMITS, VfsLimitError, VirtualFileSystem, } from './vfs.js';
4
+ class LspRequestError extends Error {
5
+ constructor(code, message, data) {
6
+ super(message);
7
+ this.code = code;
8
+ this.data = data;
9
+ }
10
+ }
11
+ export const MAX_PENDING_LSP_REQUESTS = 256;
12
+ export class RustLspServer {
13
+ constructor(options) {
14
+ this.options = options;
15
+ this.vfs = null;
16
+ this.analysis = null;
17
+ this.initialized = false;
18
+ this.shuttingDown = false;
19
+ this.disposed = false;
20
+ this.requestStates = new Map();
21
+ this.diagnosticTimers = new Map();
22
+ this.diagnosticGenerations = new Map();
23
+ }
24
+ async handle(raw) {
25
+ if (this.disposed)
26
+ return;
27
+ const decoded = decodeJsonRpcMessage(raw);
28
+ if (!decoded.ok) {
29
+ this.sendError(decoded.id, decoded.code, decoded.message);
30
+ return;
31
+ }
32
+ const message = decoded.message;
33
+ if (!('method' in message))
34
+ return;
35
+ if (!('id' in message) && message.method === '$/cancelRequest') {
36
+ this.cancelRequest(message.params);
37
+ return;
38
+ }
39
+ if ('id' in message) {
40
+ await this.handleRequest(message);
41
+ }
42
+ else {
43
+ await this.handleNotification(message);
44
+ }
45
+ }
46
+ /**
47
+ * Observes a worker message before it enters the serialized dispatch queue.
48
+ * Request state is bounded, and unknown cancellation ids are never retained.
49
+ */
50
+ observeIncoming(raw) {
51
+ const decoded = decodeJsonRpcMessage(raw);
52
+ if (!decoded.ok)
53
+ return false;
54
+ const message = decoded.message;
55
+ if (!('method' in message))
56
+ return false;
57
+ if ('id' in message) {
58
+ if (this.requestStates.has(message.id)) {
59
+ this.sendError(message.id, JSON_RPC_ERRORS.invalidRequest, 'Request id is already pending');
60
+ return true;
61
+ }
62
+ if (this.requestStates.size >= MAX_PENDING_LSP_REQUESTS) {
63
+ this.sendError(message.id, -32000, `Pending request limit is ${MAX_PENDING_LSP_REQUESTS}`);
64
+ return true;
65
+ }
66
+ this.requestStates.set(message.id, { cancelled: false, active: false });
67
+ return false;
68
+ }
69
+ if (message.method !== '$/cancelRequest')
70
+ return false;
71
+ this.cancelRequest(message.params);
72
+ return true;
73
+ }
74
+ /** Backwards-compatible immediate cancellation hook for direct transports. */
75
+ handleImmediate(raw) {
76
+ return this.observeIncoming(raw);
77
+ }
78
+ cancelRequest(value) {
79
+ const params = optionalRecord(value);
80
+ if (typeof params.id === 'string' || typeof params.id === 'number') {
81
+ const request = this.requestStates.get(params.id);
82
+ if (request)
83
+ request.cancelled = true;
84
+ }
85
+ }
86
+ dispose() {
87
+ if (this.disposed)
88
+ return;
89
+ this.disposed = true;
90
+ for (const timer of this.diagnosticTimers.values())
91
+ clearTimeout(timer);
92
+ this.diagnosticTimers.clear();
93
+ this.diagnosticGenerations.clear();
94
+ for (const request of this.requestStates.values()) {
95
+ request.cancelled = true;
96
+ }
97
+ this.requestStates.clear();
98
+ this.vfs?.clear();
99
+ this.analysis?.dispose();
100
+ this.vfs = null;
101
+ this.analysis = null;
102
+ }
103
+ async handleRequest(request) {
104
+ let cancellation = this.requestStates.get(request.id);
105
+ if (!cancellation) {
106
+ if (this.requestStates.size >= MAX_PENDING_LSP_REQUESTS) {
107
+ this.sendError(request.id, -32000, `Pending request limit is ${MAX_PENDING_LSP_REQUESTS}`);
108
+ return;
109
+ }
110
+ cancellation = { cancelled: false, active: false };
111
+ this.requestStates.set(request.id, cancellation);
112
+ }
113
+ if (cancellation.active) {
114
+ this.sendError(request.id, JSON_RPC_ERRORS.invalidRequest, 'Request id is already active');
115
+ return;
116
+ }
117
+ cancellation.active = true;
118
+ try {
119
+ if (cancellation.cancelled) {
120
+ throw new LspRequestError(JSON_RPC_ERRORS.requestCancelled, 'Request cancelled');
121
+ }
122
+ if (request.method === 'initialize') {
123
+ await this.initialize(request);
124
+ return;
125
+ }
126
+ if (!this.initialized) {
127
+ this.sendError(request.id, -32002, 'Server not initialized');
128
+ return;
129
+ }
130
+ if (request.method === 'shutdown') {
131
+ this.shuttingDown = true;
132
+ this.sendResult(request.id, null);
133
+ return;
134
+ }
135
+ if (this.shuttingDown) {
136
+ this.sendError(request.id, JSON_RPC_ERRORS.invalidRequest, 'Server is shutting down');
137
+ return;
138
+ }
139
+ const result = await withTimeout(this.dispatchAnalysisRequest(request, cancellation), this.options.requestTimeoutMs ?? 2000);
140
+ if (cancellation.cancelled) {
141
+ throw new LspRequestError(JSON_RPC_ERRORS.requestCancelled, 'Request cancelled');
142
+ }
143
+ this.sendResult(request.id, result);
144
+ }
145
+ catch (error) {
146
+ const failure = error instanceof LspRequestError
147
+ ? error
148
+ : new LspRequestError(JSON_RPC_ERRORS.internalError, error instanceof Error ? error.message : 'Internal error');
149
+ this.sendError(request.id, failure.code, failure.message, failure.data);
150
+ }
151
+ finally {
152
+ if (this.requestStates.get(request.id) === cancellation) {
153
+ this.requestStates.delete(request.id);
154
+ }
155
+ }
156
+ }
157
+ async initialize(request) {
158
+ if (this.initialized) {
159
+ this.sendError(request.id, JSON_RPC_ERRORS.invalidRequest, 'Already initialized');
160
+ return;
161
+ }
162
+ try {
163
+ const params = optionalRecord(request.params);
164
+ const rootUri = typeof params.rootUri === 'string' ? params.rootUri : 'file:///player-mod';
165
+ const initializationOptions = optionalRecord(params.initializationOptions);
166
+ const limits = loadLimits(initializationOptions.limits);
167
+ const index = loadPlatformIndex(initializationOptions.platformIndex ?? EMBEDDED_PLATFORM_INDEX);
168
+ this.vfs = new VirtualFileSystem(rootUri, limits);
169
+ this.analysis = await this.options.createAnalysis(index);
170
+ this.initialized = true;
171
+ this.sendResult(request.id, {
172
+ capabilities: {
173
+ positionEncoding: 'utf-16',
174
+ textDocumentSync: { openClose: true, change: 2 },
175
+ completionProvider: { triggerCharacters: [':', '.'] },
176
+ hoverProvider: true,
177
+ documentSymbolProvider: true,
178
+ definitionProvider: true,
179
+ },
180
+ serverInfo: {
181
+ name: 'Crowdy browser Rust language service',
182
+ version: '1',
183
+ },
184
+ });
185
+ }
186
+ catch (error) {
187
+ this.sendError(request.id, JSON_RPC_ERRORS.invalidParams, error instanceof Error ? error.message : 'Invalid initialize parameters');
188
+ }
189
+ }
190
+ async dispatchAnalysisRequest(request, cancellation) {
191
+ if (cancellation.cancelled) {
192
+ throw new LspRequestError(JSON_RPC_ERRORS.requestCancelled, 'Request cancelled');
193
+ }
194
+ if (![
195
+ 'textDocument/completion',
196
+ 'textDocument/hover',
197
+ 'textDocument/documentSymbol',
198
+ 'textDocument/definition',
199
+ ].includes(request.method)) {
200
+ throw new LspRequestError(JSON_RPC_ERRORS.methodNotFound, `Method not found: ${request.method}`);
201
+ }
202
+ const params = requireRecord(request.params, 'params');
203
+ const textDocument = requireRecord(params.textDocument, 'textDocument');
204
+ const uri = requiredString(textDocument.uri, 'textDocument.uri');
205
+ const document = this.requireVfs().require(uri);
206
+ const version = document.version;
207
+ const analysis = this.requireAnalysis();
208
+ let result;
209
+ switch (request.method) {
210
+ case 'textDocument/completion':
211
+ result = analysis.completions(document, requiredPosition(params.position), this.requireVfs().documents());
212
+ break;
213
+ case 'textDocument/hover':
214
+ result = analysis.hover(document, requiredPosition(params.position), this.requireVfs().documents());
215
+ break;
216
+ case 'textDocument/documentSymbol':
217
+ result = analysis.documentSymbols(document);
218
+ break;
219
+ case 'textDocument/definition':
220
+ result = analysis.definition(document, requiredPosition(params.position), this.requireVfs().documents());
221
+ break;
222
+ default:
223
+ throw new LspRequestError(JSON_RPC_ERRORS.internalError, 'Unreachable method');
224
+ }
225
+ if (this.requireVfs().get(uri)?.version !== version) {
226
+ throw new LspRequestError(JSON_RPC_ERRORS.contentModified, 'Document changed while request was running');
227
+ }
228
+ return result;
229
+ }
230
+ async handleNotification(message) {
231
+ if (!('method' in message))
232
+ return;
233
+ if (message.method === 'exit') {
234
+ this.dispose();
235
+ return;
236
+ }
237
+ if (message.method === '$/cancelRequest') {
238
+ this.handleImmediate(message);
239
+ return;
240
+ }
241
+ if (!this.initialized || this.shuttingDown)
242
+ return;
243
+ try {
244
+ const params = requireRecord(message.params, 'params');
245
+ switch (message.method) {
246
+ case 'initialized':
247
+ return;
248
+ case 'textDocument/didOpen': {
249
+ const item = requireRecord(params.textDocument, 'textDocument');
250
+ const document = this.requireVfs().open({
251
+ uri: requiredString(item.uri, 'textDocument.uri'),
252
+ languageId: requiredString(item.languageId, 'textDocument.languageId'),
253
+ version: requiredVersion(item.version),
254
+ text: requiredStringValue(item.text, 'textDocument.text'),
255
+ });
256
+ this.requireAnalysis().invalidate(document.uri);
257
+ this.scheduleDiagnostics(document.uri);
258
+ return;
259
+ }
260
+ case 'textDocument/didChange': {
261
+ const item = requireRecord(params.textDocument, 'textDocument');
262
+ if (!Array.isArray(params.contentChanges)) {
263
+ throw new Error('contentChanges must be an array');
264
+ }
265
+ const uri = requiredString(item.uri, 'textDocument.uri');
266
+ const changed = this.requireVfs().change(uri, requiredVersion(item.version), params.contentChanges.map(loadContentChange));
267
+ if (changed.applied) {
268
+ this.requireAnalysis().invalidate(uri);
269
+ this.scheduleDiagnostics(uri);
270
+ }
271
+ return;
272
+ }
273
+ case 'textDocument/didClose': {
274
+ const item = requireRecord(params.textDocument, 'textDocument');
275
+ const uri = requiredString(item.uri, 'textDocument.uri');
276
+ this.cancelDiagnostics(uri);
277
+ this.requireVfs().close(uri);
278
+ this.requireAnalysis().invalidate(uri);
279
+ this.publishDiagnostics(uri, null, []);
280
+ return;
281
+ }
282
+ default:
283
+ return;
284
+ }
285
+ }
286
+ catch (error) {
287
+ const textDocument = isRecord(message.params)
288
+ ? optionalRecord(message.params.textDocument)
289
+ : {};
290
+ const uri = typeof textDocument.uri === 'string' ? textDocument.uri : undefined;
291
+ if (uri && error instanceof VfsLimitError) {
292
+ this.publishDiagnostics(uri, null, [
293
+ {
294
+ range: {
295
+ start: { line: 0, character: 0 },
296
+ end: { line: 0, character: 0 },
297
+ },
298
+ severity: 1,
299
+ source: 'crowdy-rust',
300
+ code: 'workspace-limit',
301
+ message: error.message,
302
+ },
303
+ ]);
304
+ }
305
+ this.options.postMessage({
306
+ jsonrpc: '2.0',
307
+ method: 'window/logMessage',
308
+ params: {
309
+ type: 1,
310
+ message: error instanceof Error ? error.message : 'Invalid notification',
311
+ },
312
+ });
313
+ }
314
+ }
315
+ scheduleDiagnostics(uri) {
316
+ this.cancelDiagnostics(uri);
317
+ const generation = (this.diagnosticGenerations.get(uri) ?? 0) + 1;
318
+ this.diagnosticGenerations.set(uri, generation);
319
+ const timer = setTimeout(() => {
320
+ this.diagnosticTimers.delete(uri);
321
+ if (this.disposed ||
322
+ generation !== this.diagnosticGenerations.get(uri)) {
323
+ return;
324
+ }
325
+ const document = this.vfs?.get(uri);
326
+ if (!document || !this.analysis)
327
+ return;
328
+ const diagnostics = this.analysis.diagnostics(document);
329
+ if (generation === this.diagnosticGenerations.get(uri) &&
330
+ this.vfs?.get(uri)?.version === document.version) {
331
+ this.publishDiagnostics(uri, document.version, diagnostics);
332
+ }
333
+ }, this.options.diagnosticDebounceMs ?? 75);
334
+ this.diagnosticTimers.set(uri, timer);
335
+ }
336
+ cancelDiagnostics(uri) {
337
+ const timer = this.diagnosticTimers.get(uri);
338
+ if (timer)
339
+ clearTimeout(timer);
340
+ this.diagnosticTimers.delete(uri);
341
+ this.diagnosticGenerations.set(uri, (this.diagnosticGenerations.get(uri) ?? 0) + 1);
342
+ }
343
+ publishDiagnostics(uri, version, diagnostics) {
344
+ this.options.postMessage({
345
+ jsonrpc: '2.0',
346
+ method: 'textDocument/publishDiagnostics',
347
+ params: {
348
+ uri,
349
+ ...(version === null ? {} : { version }),
350
+ diagnostics,
351
+ },
352
+ });
353
+ }
354
+ requireVfs() {
355
+ if (!this.vfs)
356
+ throw new Error('Server VFS is unavailable');
357
+ return this.vfs;
358
+ }
359
+ requireAnalysis() {
360
+ if (!this.analysis)
361
+ throw new Error('Rust analysis is unavailable');
362
+ return this.analysis;
363
+ }
364
+ sendResult(id, result) {
365
+ this.options.postMessage({ jsonrpc: '2.0', id, result });
366
+ }
367
+ sendError(id, code, message, data) {
368
+ this.options.postMessage({
369
+ jsonrpc: '2.0',
370
+ id,
371
+ error: { code, message, ...(data === undefined ? {} : { data }) },
372
+ });
373
+ }
374
+ }
375
+ function loadLimits(value) {
376
+ if (value === undefined)
377
+ return DEFAULT_VFS_LIMITS;
378
+ const input = requireRecord(value, 'limits');
379
+ const allowed = new Set(['maxFiles', 'maxFileBytes', 'maxWorkspaceBytes']);
380
+ const unexpected = Object.keys(input).find((key) => !allowed.has(key));
381
+ if (unexpected)
382
+ throw new Error(`limits has unexpected field ${unexpected}`);
383
+ return Object.fromEntries(Object.entries(input).map(([key, item]) => {
384
+ if (!Number.isSafeInteger(item) || item <= 0) {
385
+ throw new Error(`limits.${key} must be a positive safe integer`);
386
+ }
387
+ return [key, item];
388
+ }));
389
+ }
390
+ function loadContentChange(value) {
391
+ const input = requireRecord(value, 'contentChanges[]');
392
+ const text = requiredStringValue(input.text, 'contentChanges[].text');
393
+ if (input.range === undefined)
394
+ return { text };
395
+ const range = requireRecord(input.range, 'contentChanges[].range');
396
+ return {
397
+ text,
398
+ range: {
399
+ start: requiredPosition(range.start),
400
+ end: requiredPosition(range.end),
401
+ },
402
+ };
403
+ }
404
+ function requiredPosition(value) {
405
+ const input = requireRecord(value, 'position');
406
+ if (!Number.isSafeInteger(input.line) ||
407
+ !Number.isSafeInteger(input.character) ||
408
+ input.line < 0 ||
409
+ input.character < 0) {
410
+ throw new LspRequestError(JSON_RPC_ERRORS.invalidParams, 'Invalid position');
411
+ }
412
+ return { line: input.line, character: input.character };
413
+ }
414
+ function requireRecord(value, field) {
415
+ if (!isRecord(value)) {
416
+ throw new LspRequestError(JSON_RPC_ERRORS.invalidParams, `${field} must be an object`);
417
+ }
418
+ return value;
419
+ }
420
+ function optionalRecord(value) {
421
+ return isRecord(value) ? value : {};
422
+ }
423
+ function requiredString(value, field) {
424
+ if (typeof value !== 'string' || value.length === 0 || value.length > 4096) {
425
+ throw new LspRequestError(JSON_RPC_ERRORS.invalidParams, `${field} must be a non-empty bounded string`);
426
+ }
427
+ return value;
428
+ }
429
+ function requiredStringValue(value, field) {
430
+ if (typeof value !== 'string') {
431
+ throw new LspRequestError(JSON_RPC_ERRORS.invalidParams, `${field} must be a string`);
432
+ }
433
+ return value;
434
+ }
435
+ function requiredVersion(value) {
436
+ if (!Number.isSafeInteger(value) || value < 0) {
437
+ throw new LspRequestError(JSON_RPC_ERRORS.invalidParams, 'Document version must be a non-negative safe integer');
438
+ }
439
+ return value;
440
+ }
441
+ async function withTimeout(promise, timeoutMs) {
442
+ let timer;
443
+ try {
444
+ return await Promise.race([
445
+ promise,
446
+ new Promise((_, reject) => {
447
+ timer = setTimeout(() => reject(new LspRequestError(-32001, 'Request timed out')), timeoutMs);
448
+ }),
449
+ ]);
450
+ }
451
+ finally {
452
+ if (timer)
453
+ clearTimeout(timer);
454
+ }
455
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rust-lsp.worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rust-lsp.worker.d.ts","sourceRoot":"","sources":["../../src/live-coding/rust-lsp.worker.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { RustAnalysis } from './rust-analysis.js';
2
+ import { RustLspServer } from './rust-lsp-server.js';
3
+ const scope = globalThis;
4
+ const parserWasmUrl = new URL('./assets/web-tree-sitter.wasm', import.meta.url).href;
5
+ const grammarWasmUrl = new URL('./assets/tree-sitter-rust.wasm', import.meta.url).href;
6
+ const server = new RustLspServer({
7
+ postMessage: (message) => scope.postMessage(message),
8
+ createAnalysis: (platformIndex) => RustAnalysis.create({ parserWasmUrl, grammarWasmUrl, platformIndex }),
9
+ });
10
+ let queue = Promise.resolve();
11
+ scope.onmessage = (event) => {
12
+ if (server.observeIncoming(event.data))
13
+ return;
14
+ queue = queue
15
+ .then(() => server.handle(event.data))
16
+ .catch((error) => {
17
+ scope.postMessage({
18
+ jsonrpc: '2.0',
19
+ method: 'window/logMessage',
20
+ params: {
21
+ type: 1,
22
+ message: error instanceof Error ? error.message : 'Worker failure',
23
+ },
24
+ });
25
+ });
26
+ };
@@ -0,0 +1,41 @@
1
+ import type { Position, TextDocumentContentChangeEvent, TextDocumentItem } from './lsp-protocol.js';
2
+ export interface VirtualFileSystemLimits {
3
+ maxFiles: number;
4
+ maxFileBytes: number;
5
+ maxWorkspaceBytes: number;
6
+ }
7
+ export declare const DEFAULT_VFS_LIMITS: Readonly<VirtualFileSystemLimits>;
8
+ export interface VirtualDocument extends TextDocumentItem {
9
+ readonly path: string;
10
+ readonly bytes: number;
11
+ }
12
+ export declare class VfsLimitError extends Error {
13
+ readonly code = "VFS_LIMIT";
14
+ constructor(message: string);
15
+ }
16
+ export declare class VirtualFileSystem {
17
+ private readonly files;
18
+ private readonly encoder;
19
+ private totalBytes;
20
+ readonly workspaceUri: string;
21
+ readonly limits: Readonly<VirtualFileSystemLimits>;
22
+ constructor(workspaceUri?: string, limits?: Partial<VirtualFileSystemLimits>);
23
+ get size(): number;
24
+ get bytes(): number;
25
+ open(item: TextDocumentItem): VirtualDocument;
26
+ change(uri: string, version: number, changes: readonly TextDocumentContentChangeEvent[]): {
27
+ applied: boolean;
28
+ document: VirtualDocument;
29
+ };
30
+ close(uri: string): boolean;
31
+ get(uri: string): VirtualDocument | undefined;
32
+ require(uri: string): VirtualDocument;
33
+ documents(): VirtualDocument[];
34
+ clear(): void;
35
+ pathForUri(uri: string): string;
36
+ private makeDocument;
37
+ private ensureFits;
38
+ private assertLimits;
39
+ }
40
+ export declare function offsetAt(text: string, position: Position): number;
41
+ //# sourceMappingURL=vfs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vfs.d.ts","sourceRoot":"","sources":["../../src/live-coding/vfs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,8BAA8B,EAC9B,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,uBAAuB,CAIhE,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,eAAe;gBAEhB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsC;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,UAAU,CAAK;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC;gBAGjD,YAAY,SAAuB,EACnC,MAAM,GAAE,OAAO,CAAC,uBAAuB,CAAM;IAiB/C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG,eAAe;IAiB7C,MAAM,CACJ,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,8BAA8B,EAAE,GACjD;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,eAAe,CAAA;KAAE;IA+BlD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAQ3B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI7C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe;IAMrC,SAAS,IAAI,eAAe,EAAE;IAI9B,KAAK,IAAI,IAAI;IAKb,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IA4B/B,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,YAAY;CAUrB;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAoBjE"}