@fossil-lang/wasm 0.3.0-alpha.5 → 0.3.0-alpha.7
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 +31 -0
- package/dist/client.d.ts +25 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +38 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/pkg/fossil_wasm.d.ts +46 -4
- package/pkg/fossil_wasm.js +79 -6
- package/pkg/fossil_wasm_bg.wasm +0 -0
- package/pkg/fossil_wasm_bg.wasm.d.ts +5 -1
package/README.md
CHANGED
|
@@ -10,6 +10,37 @@ JS/TS wrapper around the `fossil-wasm` Rust crate's wasm-bindgen artefacts. Prov
|
|
|
10
10
|
itself is native-only (stdio over crossbeam), so the browser gets this
|
|
11
11
|
equivalent dispatch surface over the same `fossil-ide` functions.
|
|
12
12
|
|
|
13
|
+
## Documents and sources: fossil resolves, the host reads
|
|
14
|
+
|
|
15
|
+
A program names shape documents (`io.shex("@vocab/person.shex")`) and data
|
|
16
|
+
sources (`io.csv("@lake/users.csv")`). The checker reads no file and no
|
|
17
|
+
network: it reports what it is missing, and the host hands back text through a
|
|
18
|
+
`SourceHost` (`@fossil-lang/types`) — the connection map, and `sign(locators)`.
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { resolveDocuments } from '@fossil-lang/types';
|
|
22
|
+
|
|
23
|
+
const pg = new FossilPlayground();
|
|
24
|
+
const h = pg.openFile('prog.fossil', text); // edited buffers only
|
|
25
|
+
const { unread } = await resolveDocuments(pg.workspace(h), host); // sets the connections too
|
|
26
|
+
const rows = pg.check();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- `missingDocuments(h)` — `{ key, locator }` rows. The key is what the program
|
|
30
|
+
wrote, so repointing a connection invalidates nothing; the locator is that
|
|
31
|
+
key through the map, and it is what `sign` receives.
|
|
32
|
+
- `registerDocument(key, text)` — what `resolveDocuments` calls for each
|
|
33
|
+
fetched document, until nothing new is missing (a document can name another).
|
|
34
|
+
It is the one loop; a host does not write a second.
|
|
35
|
+
- `openFile` is for buffers the user edits. An open `.shex` is the document
|
|
36
|
+
every program naming it reads; opening a program registers nothing it names.
|
|
37
|
+
- `setConnections(map)` — name → base; re-checks nothing. `resolveDocuments`
|
|
38
|
+
calls it with `host.connections()`, so a host never does.
|
|
39
|
+
- `sources(h)` — the `ProgramSource[]` the program reads, through the map the
|
|
40
|
+
last `resolveDocuments` set: binding, key,
|
|
41
|
+
locator, catalogue row, reader option. Introspection DESCRIBEs these and
|
|
42
|
+
registers each descriptor under `key` with `registerInferredDescriptor`.
|
|
43
|
+
|
|
13
44
|
## Why explicit `init({ wasmUrl })` and not auto-load?
|
|
14
45
|
|
|
15
46
|
We use `wasm-bindgen --target web` (NOT `--target bundler`). This means consumers
|
package/dist/client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Mirrors `@fossil-lang/corpus`'s `client.ts` split, the known-good shape.
|
|
13
13
|
*/
|
|
14
14
|
import { FileHandle as RawFileHandle } from '../pkg/fossil_wasm.js';
|
|
15
|
-
import type {
|
|
15
|
+
import type { DocumentWorkspace, MissingDocument, ProgramSource, SemanticTokensLegend, TokenKindLegend, TokenRow } from '@fossil-lang/types';
|
|
16
16
|
import type { CheckRow, CompletionRow, DefinitionRow, HoverRow, InferredDescriptorJson, SourceRefInfo, ProviderInfo } from './index.js';
|
|
17
17
|
/**
|
|
18
18
|
* Install the LSP-over-postMessage dispatcher on the current Worker scope.
|
|
@@ -129,6 +129,30 @@ export declare class FossilPlayground {
|
|
|
129
129
|
* handle throws so JS-side bugs surface loudly.
|
|
130
130
|
*/
|
|
131
131
|
closeFile(handle: FileHandle): void;
|
|
132
|
+
/**
|
|
133
|
+
* The connection map `@name/…` expands against — what
|
|
134
|
+
* `SourceHost.connections()` answers. It reaches locators only, so setting it
|
|
135
|
+
* re-checks nothing.
|
|
136
|
+
*/
|
|
137
|
+
setConnections(connections: Record<string, string>): void;
|
|
138
|
+
/**
|
|
139
|
+
* The documents the file at `handle` names and nothing has registered, each
|
|
140
|
+
* with the key to register it under and the locator to read it from.
|
|
141
|
+
*/
|
|
142
|
+
missingDocuments(handle: FileHandle): MissingDocument[];
|
|
143
|
+
/** Register a fetched document's text under the key {@link missingDocuments} reported. */
|
|
144
|
+
registerDocument(key: string, text: string): void;
|
|
145
|
+
/**
|
|
146
|
+
* The data sources the file at `handle` reads, as fossil resolved them: the
|
|
147
|
+
* binding, the URI as written, its locator through the connection map, the
|
|
148
|
+
* catalogue row and the reader option.
|
|
149
|
+
*/
|
|
150
|
+
sources(handle: FileHandle): ProgramSource[];
|
|
151
|
+
/**
|
|
152
|
+
* The file at `handle` as a {@link DocumentWorkspace}, for
|
|
153
|
+
* `resolveDocuments(playground.workspace(handle), host)`.
|
|
154
|
+
*/
|
|
155
|
+
workspace(handle: FileHandle): DocumentWorkspace;
|
|
132
156
|
/**
|
|
133
157
|
* Workspace-wide diagnostic drain. Runs `parse → def_map → typecheck_mapping`
|
|
134
158
|
* across every open file and returns a flat array of {@link CheckRow}.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,UAAU,IAAI,aAAa,EAO5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,UAAU,IAAI,aAAa,EAO5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB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AM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,EAAE;IAI5C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,iBAAiB;IAQhD;;;OAGG;IACH,KAAK,IAAI,QAAQ,EAAE;IAInB;;;OAGG;IACH,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,EAAE;IAI9C;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAM3E;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE;IAIjF;;;;;;;OAOG;IACH,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE;IAIpF;;;;;;;;;;;OAWG;IACH,0BAA0B,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;CAKrE"}
|
package/dist/client.js
CHANGED
|
@@ -145,6 +145,44 @@ export class FossilPlayground {
|
|
|
145
145
|
closeFile(handle) {
|
|
146
146
|
this._inner.close_file(handle);
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* The connection map `@name/…` expands against — what
|
|
150
|
+
* `SourceHost.connections()` answers. It reaches locators only, so setting it
|
|
151
|
+
* re-checks nothing.
|
|
152
|
+
*/
|
|
153
|
+
setConnections(connections) {
|
|
154
|
+
this._inner.setConnections(connections);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The documents the file at `handle` names and nothing has registered, each
|
|
158
|
+
* with the key to register it under and the locator to read it from.
|
|
159
|
+
*/
|
|
160
|
+
missingDocuments(handle) {
|
|
161
|
+
return this._inner.missingDocuments(handle);
|
|
162
|
+
}
|
|
163
|
+
/** Register a fetched document's text under the key {@link missingDocuments} reported. */
|
|
164
|
+
registerDocument(key, text) {
|
|
165
|
+
this._inner.registerDocument(key, text);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The data sources the file at `handle` reads, as fossil resolved them: the
|
|
169
|
+
* binding, the URI as written, its locator through the connection map, the
|
|
170
|
+
* catalogue row and the reader option.
|
|
171
|
+
*/
|
|
172
|
+
sources(handle) {
|
|
173
|
+
return this._inner.sources(handle);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The file at `handle` as a {@link DocumentWorkspace}, for
|
|
177
|
+
* `resolveDocuments(playground.workspace(handle), host)`.
|
|
178
|
+
*/
|
|
179
|
+
workspace(handle) {
|
|
180
|
+
return {
|
|
181
|
+
setConnections: (connections) => this.setConnections(connections),
|
|
182
|
+
missingDocuments: () => this.missingDocuments(handle),
|
|
183
|
+
registerDocument: (key, text) => this.registerDocument(key, text),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
148
186
|
/**
|
|
149
187
|
* Workspace-wide diagnostic drain. Runs `parse → def_map → typecheck_mapping`
|
|
150
188
|
* across every open file and returns a flat array of {@link CheckRow}.
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,gBAAgB,IAAI,mBAAmB,EACvC,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,eAAe,IAAI,iBAAiB,EACpC,UAAU,IAAI,aAAa,EAC3B,gBAAgB,IAAI,iBAAiB,EACrC,IAAI,IAAI,OAAO,EACf,SAAS,IAAI,YAAY,GAC1B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;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OAGG;IACH,cAAc,CAAC,MAAkB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAe,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAkB,EAAE,IAAY,EAAE,SAAiB;QACvD,yEAAyE;QACzE,kDAAkD;QAClD,OAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAiC,IAAI,IAAI,CAAC;IAC7F,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,MAAkB,EAAE,IAAY,EAAE,SAAiB;QAC7D,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAoB,CAAC;IAC7E,CAAC;IAED;;;;;;;OAOG;IACH,cAAc,CAAC,MAAkB,EAAE,IAAY,EAAE,SAAiB;QAChE,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAoB,CAAC;IAChF,CAAC;IAED;;;;;;;;;;;OAWG;IACH,0BAA0B,CAAC,UAAkC;QAC3D,4EAA4E;QAC5E,uBAAuB;QACvB,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACrE,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* - {@link tokenKinds} — the legend for TokenRow.kind: variant names by index.
|
|
9
9
|
* - {@link semanticLegend} — returns the LSP SemanticTokensLegend.
|
|
10
10
|
* - {@link FossilPlayground} — Workspace API class: open / update / close,
|
|
11
|
-
* `check`,
|
|
12
|
-
* `gotoDefinition`) an editor draws its IDE surface from
|
|
11
|
+
* `check`, the three position queries (`hover`, `completions`,
|
|
12
|
+
* `gotoDefinition`) an editor draws its IDE surface from, and the documents
|
|
13
|
+
* and sources a program reads (`missingDocuments`, `registerDocument`,
|
|
14
|
+
* `sources`) that a host resolves through its `SourceHost`.
|
|
13
15
|
*
|
|
14
16
|
* Consumer pattern (wasm-bindgen --target web):
|
|
15
17
|
*
|
|
@@ -153,5 +155,5 @@ export interface InferredDescriptorJson {
|
|
|
153
155
|
*/
|
|
154
156
|
freshness_token: string;
|
|
155
157
|
}
|
|
156
|
-
export type { TokenRow, SemanticTokensLegend } from '@fossil-lang/types';
|
|
158
|
+
export type { TokenRow, SemanticTokensLegend, SourceHost, MissingDocument, UnreadDocument, DocumentWorkspace, ProgramSource, } from '@fossil-lang/types';
|
|
157
159
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,IAAI,EACJ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;4EAI4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;CACzB;AAED;;oEAEoE;AACpE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,QAAQ,GAAG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Ae,EAAE,MAAM,CAAC;CACzB;AAKD,YAAY,EACV,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* - {@link tokenKinds} — the legend for TokenRow.kind: variant names by index.
|
|
9
9
|
* - {@link semanticLegend} — returns the LSP SemanticTokensLegend.
|
|
10
10
|
* - {@link FossilPlayground} — Workspace API class: open / update / close,
|
|
11
|
-
* `check`,
|
|
12
|
-
* `gotoDefinition`) an editor draws its IDE surface from
|
|
11
|
+
* `check`, the three position queries (`hover`, `completions`,
|
|
12
|
+
* `gotoDefinition`) an editor draws its IDE surface from, and the documents
|
|
13
|
+
* and sources a program reads (`missingDocuments`, `registerDocument`,
|
|
14
|
+
* `sources`) that a host resolves through its `SourceHost`.
|
|
13
15
|
*
|
|
14
16
|
* Consumer pattern (wasm-bindgen --target web):
|
|
15
17
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,6EAA6E;AAC7E,iFAAiF;AACjF,iFAAiF;AACjF,2EAA2E;AAC3E,yEAAyE;AACzE,4EAA4E;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,IAAI,EACJ,SAAS,GACV,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fossil-lang/wasm",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.7",
|
|
4
4
|
"description": "JS/TS wrapper around the fossil-wasm wasm-bindgen artifacts (--target web). Exposes initFossilWasm + tokenize + semanticLegend + FossilPlayground class for downstream @fossil-lang/* packages.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"sideEffects": false,
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fossil-lang/types": "0.3.0-alpha.
|
|
36
|
+
"@fossil-lang/types": "0.3.0-alpha.7"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"typescript": "^5.6.0",
|
package/pkg/fossil_wasm.d.ts
CHANGED
|
@@ -74,9 +74,8 @@ export class FossilPlayground {
|
|
|
74
74
|
* playground's panel view. It is NOT what the LSP Worker publishes; see
|
|
75
75
|
* [`CheckRow`], and `lsp_worker::publish_diagnostics` for the wire.
|
|
76
76
|
*
|
|
77
|
-
* A buffer the installed provider catalogue claims —
|
|
78
|
-
*
|
|
79
|
-
* `.parquet` — is an INPUT and is not parsed as fossil.
|
|
77
|
+
* A buffer the installed provider catalogue claims — a `.shex` being
|
|
78
|
+
* edited, a `.csv`, a `.parquet` — is an INPUT and is not parsed as fossil.
|
|
80
79
|
* [`fossil_ide::diagnostics()`] is where that is said and measured, for both
|
|
81
80
|
* hosts.
|
|
82
81
|
*
|
|
@@ -162,6 +161,16 @@ export class FossilPlayground {
|
|
|
162
161
|
* see [`FossilPlayground::hover_row`].
|
|
163
162
|
*/
|
|
164
163
|
hover(handle: FileHandle, line: number, character: number): any;
|
|
164
|
+
/**
|
|
165
|
+
* The documents the file at `handle` names that nothing has registered:
|
|
166
|
+
* `{ key, locator }` rows, the locator expanded through the connection map.
|
|
167
|
+
*
|
|
168
|
+
* # Errors
|
|
169
|
+
*
|
|
170
|
+
* Returns a JS error if `handle` is unknown, if the workspace is busy, or
|
|
171
|
+
* if serialization fails.
|
|
172
|
+
*/
|
|
173
|
+
missingDocuments(handle: FileHandle): any;
|
|
165
174
|
/**
|
|
166
175
|
* Construct a new playground.
|
|
167
176
|
*
|
|
@@ -184,6 +193,15 @@ export class FossilPlayground {
|
|
|
184
193
|
* see the type-level note on [`WasmPlayground`].
|
|
185
194
|
*/
|
|
186
195
|
open_file(path: string, contents: string): FileHandle;
|
|
196
|
+
/**
|
|
197
|
+
* Register a fetched document's `text` under the `key` `missingDocuments`
|
|
198
|
+
* reported.
|
|
199
|
+
*
|
|
200
|
+
* # Errors
|
|
201
|
+
*
|
|
202
|
+
* Returns a JS error if the workspace is busy.
|
|
203
|
+
*/
|
|
204
|
+
registerDocument(key: string, text: string): void;
|
|
187
205
|
/**
|
|
188
206
|
* Register an [`fossil_descriptors_input::InferredDescriptor`] for a
|
|
189
207
|
* source binding name BEFORE invoking `check`. The Rust compiler reads
|
|
@@ -201,6 +219,26 @@ export class FossilPlayground {
|
|
|
201
219
|
* - The workspace is busy.
|
|
202
220
|
*/
|
|
203
221
|
registerInferredDescriptor(descriptor_json: string): void;
|
|
222
|
+
/**
|
|
223
|
+
* Replace the connection map `@name/…` expands against, as
|
|
224
|
+
* `SourceHost.connections()` answers it.
|
|
225
|
+
*
|
|
226
|
+
* # Errors
|
|
227
|
+
*
|
|
228
|
+
* Returns a JS error if `connections` is not a string-to-string record, or
|
|
229
|
+
* if the workspace is busy.
|
|
230
|
+
*/
|
|
231
|
+
setConnections(connections: any): void;
|
|
232
|
+
/**
|
|
233
|
+
* The data sources the file at `handle` reads — see
|
|
234
|
+
* [`fossil_lineage::program_sources`].
|
|
235
|
+
*
|
|
236
|
+
* # Errors
|
|
237
|
+
*
|
|
238
|
+
* Returns a JS error if `handle` is unknown, if the workspace is busy, or
|
|
239
|
+
* if serialization fails.
|
|
240
|
+
*/
|
|
241
|
+
sources(handle: FileHandle): any;
|
|
204
242
|
/**
|
|
205
243
|
* Apply an edit to an open file. Mutates the SAME `SourceFile` via the
|
|
206
244
|
* Salsa [`salsa::Setter`] (`set_text`) — this BUMPS THE REVISION, the
|
|
@@ -326,13 +364,17 @@ export interface InitOutput {
|
|
|
326
364
|
readonly fossilplayground_close_file: (a: number, b: number) => [number, number];
|
|
327
365
|
readonly fossilplayground_check: (a: number) => [number, number, number];
|
|
328
366
|
readonly fossilplayground_diagnostics_for: (a: number, b: number) => [number, number, number];
|
|
367
|
+
readonly fossilplayground_setConnections: (a: number, b: any) => [number, number];
|
|
368
|
+
readonly fossilplayground_missingDocuments: (a: number, b: number) => [number, number, number];
|
|
369
|
+
readonly fossilplayground_registerDocument: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
370
|
+
readonly fossilplayground_sources: (a: number, b: number) => [number, number, number];
|
|
329
371
|
readonly fossilplayground_hover: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
330
372
|
readonly fossilplayground_completions: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
331
373
|
readonly fossilplayground_gotoDefinition: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
332
374
|
readonly fossilplayground_registerInferredDescriptor: (a: number, b: number, c: number) => [number, number];
|
|
333
375
|
readonly providers: () => [number, number, number];
|
|
334
376
|
readonly refs: (a: number, b: number) => [number, number, number];
|
|
335
|
-
readonly
|
|
377
|
+
readonly wasm_bindgen__convert__closures_____invoke__h6c9357f9f01d3cd7: (a: number, b: number, c: any) => void;
|
|
336
378
|
readonly __wbindgen_malloc_command_export: (a: number, b: number) => number;
|
|
337
379
|
readonly __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
|
|
338
380
|
readonly __wbindgen_exn_store_command_export: (a: number) => void;
|
package/pkg/fossil_wasm.js
CHANGED
|
@@ -95,9 +95,8 @@ export class FossilPlayground {
|
|
|
95
95
|
* playground's panel view. It is NOT what the LSP Worker publishes; see
|
|
96
96
|
* [`CheckRow`], and `lsp_worker::publish_diagnostics` for the wire.
|
|
97
97
|
*
|
|
98
|
-
* A buffer the installed provider catalogue claims —
|
|
99
|
-
*
|
|
100
|
-
* `.parquet` — is an INPUT and is not parsed as fossil.
|
|
98
|
+
* A buffer the installed provider catalogue claims — a `.shex` being
|
|
99
|
+
* edited, a `.csv`, a `.parquet` — is an INPUT and is not parsed as fossil.
|
|
101
100
|
* [`fossil_ide::diagnostics()`] is where that is said and measured, for both
|
|
102
101
|
* hosts.
|
|
103
102
|
*
|
|
@@ -239,6 +238,25 @@ export class FossilPlayground {
|
|
|
239
238
|
}
|
|
240
239
|
return takeFromExternrefTable0(ret[0]);
|
|
241
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* The documents the file at `handle` names that nothing has registered:
|
|
243
|
+
* `{ key, locator }` rows, the locator expanded through the connection map.
|
|
244
|
+
*
|
|
245
|
+
* # Errors
|
|
246
|
+
*
|
|
247
|
+
* Returns a JS error if `handle` is unknown, if the workspace is busy, or
|
|
248
|
+
* if serialization fails.
|
|
249
|
+
* @param {FileHandle} handle
|
|
250
|
+
* @returns {any}
|
|
251
|
+
*/
|
|
252
|
+
missingDocuments(handle) {
|
|
253
|
+
_assertClass(handle, FileHandle);
|
|
254
|
+
const ret = wasm.fossilplayground_missingDocuments(this.__wbg_ptr, handle.__wbg_ptr);
|
|
255
|
+
if (ret[2]) {
|
|
256
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
257
|
+
}
|
|
258
|
+
return takeFromExternrefTable0(ret[0]);
|
|
259
|
+
}
|
|
242
260
|
/**
|
|
243
261
|
* Construct a new playground.
|
|
244
262
|
*
|
|
@@ -279,6 +297,26 @@ export class FossilPlayground {
|
|
|
279
297
|
}
|
|
280
298
|
return FileHandle.__wrap(ret[0]);
|
|
281
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Register a fetched document's `text` under the `key` `missingDocuments`
|
|
302
|
+
* reported.
|
|
303
|
+
*
|
|
304
|
+
* # Errors
|
|
305
|
+
*
|
|
306
|
+
* Returns a JS error if the workspace is busy.
|
|
307
|
+
* @param {string} key
|
|
308
|
+
* @param {string} text
|
|
309
|
+
*/
|
|
310
|
+
registerDocument(key, text) {
|
|
311
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
312
|
+
const len0 = WASM_VECTOR_LEN;
|
|
313
|
+
const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
314
|
+
const len1 = WASM_VECTOR_LEN;
|
|
315
|
+
const ret = wasm.fossilplayground_registerDocument(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
316
|
+
if (ret[1]) {
|
|
317
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
282
320
|
/**
|
|
283
321
|
* Register an [`fossil_descriptors_input::InferredDescriptor`] for a
|
|
284
322
|
* source binding name BEFORE invoking `check`. The Rust compiler reads
|
|
@@ -304,6 +342,41 @@ export class FossilPlayground {
|
|
|
304
342
|
throw takeFromExternrefTable0(ret[0]);
|
|
305
343
|
}
|
|
306
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Replace the connection map `@name/…` expands against, as
|
|
347
|
+
* `SourceHost.connections()` answers it.
|
|
348
|
+
*
|
|
349
|
+
* # Errors
|
|
350
|
+
*
|
|
351
|
+
* Returns a JS error if `connections` is not a string-to-string record, or
|
|
352
|
+
* if the workspace is busy.
|
|
353
|
+
* @param {any} connections
|
|
354
|
+
*/
|
|
355
|
+
setConnections(connections) {
|
|
356
|
+
const ret = wasm.fossilplayground_setConnections(this.__wbg_ptr, connections);
|
|
357
|
+
if (ret[1]) {
|
|
358
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* The data sources the file at `handle` reads — see
|
|
363
|
+
* [`fossil_lineage::program_sources`].
|
|
364
|
+
*
|
|
365
|
+
* # Errors
|
|
366
|
+
*
|
|
367
|
+
* Returns a JS error if `handle` is unknown, if the workspace is busy, or
|
|
368
|
+
* if serialization fails.
|
|
369
|
+
* @param {FileHandle} handle
|
|
370
|
+
* @returns {any}
|
|
371
|
+
*/
|
|
372
|
+
sources(handle) {
|
|
373
|
+
_assertClass(handle, FileHandle);
|
|
374
|
+
const ret = wasm.fossilplayground_sources(this.__wbg_ptr, handle.__wbg_ptr);
|
|
375
|
+
if (ret[2]) {
|
|
376
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
377
|
+
}
|
|
378
|
+
return takeFromExternrefTable0(ret[0]);
|
|
379
|
+
}
|
|
307
380
|
/**
|
|
308
381
|
* Apply an edit to an open file. Mutates the SAME `SourceFile` via the
|
|
309
382
|
* Salsa [`salsa::Setter`] (`set_text`) — this BUMPS THE REVISION, the
|
|
@@ -733,7 +806,7 @@ function __wbg_get_imports() {
|
|
|
733
806
|
},
|
|
734
807
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
735
808
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
736
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
809
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6c9357f9f01d3cd7);
|
|
737
810
|
return ret;
|
|
738
811
|
},
|
|
739
812
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
@@ -772,8 +845,8 @@ function __wbg_get_imports() {
|
|
|
772
845
|
};
|
|
773
846
|
}
|
|
774
847
|
|
|
775
|
-
function
|
|
776
|
-
wasm.
|
|
848
|
+
function wasm_bindgen__convert__closures_____invoke__h6c9357f9f01d3cd7(arg0, arg1, arg2) {
|
|
849
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h6c9357f9f01d3cd7(arg0, arg1, arg2);
|
|
777
850
|
}
|
|
778
851
|
|
|
779
852
|
const FileHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
package/pkg/fossil_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -13,13 +13,17 @@ export const fossilplayground_update_file: (a: number, b: number, c: number, d:
|
|
|
13
13
|
export const fossilplayground_close_file: (a: number, b: number) => [number, number];
|
|
14
14
|
export const fossilplayground_check: (a: number) => [number, number, number];
|
|
15
15
|
export const fossilplayground_diagnostics_for: (a: number, b: number) => [number, number, number];
|
|
16
|
+
export const fossilplayground_setConnections: (a: number, b: any) => [number, number];
|
|
17
|
+
export const fossilplayground_missingDocuments: (a: number, b: number) => [number, number, number];
|
|
18
|
+
export const fossilplayground_registerDocument: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
19
|
+
export const fossilplayground_sources: (a: number, b: number) => [number, number, number];
|
|
16
20
|
export const fossilplayground_hover: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
17
21
|
export const fossilplayground_completions: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
18
22
|
export const fossilplayground_gotoDefinition: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
19
23
|
export const fossilplayground_registerInferredDescriptor: (a: number, b: number, c: number) => [number, number];
|
|
20
24
|
export const providers: () => [number, number, number];
|
|
21
25
|
export const refs: (a: number, b: number) => [number, number, number];
|
|
22
|
-
export const
|
|
26
|
+
export const wasm_bindgen__convert__closures_____invoke__h6c9357f9f01d3cd7: (a: number, b: number, c: any) => void;
|
|
23
27
|
export const __wbindgen_malloc_command_export: (a: number, b: number) => number;
|
|
24
28
|
export const __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
|
|
25
29
|
export const __wbindgen_exn_store_command_export: (a: number) => void;
|