@fossil-lang/wasm 0.3.0-alpha.24 → 0.3.0-alpha.25
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 +9 -0
- package/dist/client.d.ts +16 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -10
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/load.d.ts +8 -0
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js.map +1 -1
- package/dist/provider.d.ts +23 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +21 -0
- package/dist/provider.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,6 +9,15 @@ JS/TS wrapper around the `fossil-wasm` Rust crate's wasm-bindgen artefacts. Prov
|
|
|
9
9
|
package and the host's bundler emits it as an asset; the host copies nothing.
|
|
10
10
|
- `tokenize(text)` — calls the Rust lexer, returns `TokenRow[]`. The Rust lexer
|
|
11
11
|
is the only lexer: no host reimplements one and drifts from the grammar.
|
|
12
|
+
- `refs(program)` and `providers()` — a program's external references (`@conn`
|
|
13
|
+
alias, path, role), and the providers this build reads. Each boots the module
|
|
14
|
+
itself, as `openProgram` does, so a host writes no `initFossilWasm()` before
|
|
15
|
+
it; both take `{ wasm, signal }` for the same reasons `openProgram` does.
|
|
16
|
+
- `providerFor(path, role, providers)` — which of `providers()`' rows reads a
|
|
17
|
+
file as `'data'` or as `'schema'`, by extension. Pure: a host asks the module
|
|
18
|
+
for the list once and filters a whole listing with it. The role is required
|
|
19
|
+
because one extension names two providers — a `.ttl` is `rdf` as data and
|
|
20
|
+
`shacl` as a schema.
|
|
12
21
|
- `FossilWorkspace` — the Workspace API class for LSP + compile. `fossil-lsp`
|
|
13
22
|
itself is native-only (stdio over crossbeam), so the browser gets this
|
|
14
23
|
equivalent dispatch surface over the same `fossil-ide` functions.
|
package/dist/client.d.ts
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
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, type MissingDocument, type Problem, type ProgramSource, type TokenKindLegend, type TokenRow } from '@fossil-lang/types';
|
|
16
16
|
import type { CheckRow, CompletionRow, DefinitionRow, HoverRow, InferredDescriptorJson, SemanticTokenRow, SourceRefInfo, ProviderInfo } from './index.js';
|
|
17
|
+
import { type BootOptions } from './load.js';
|
|
17
18
|
/**
|
|
18
19
|
* Opaque file-handle returned by {@link FossilWorkspace.openFile}. Pass it
|
|
19
20
|
* back into the matching `updateFile` / `closeFile` / `diagnosticsFor`
|
|
@@ -53,22 +54,26 @@ export declare function tokenKinds(): TokenKindLegend;
|
|
|
53
54
|
/**
|
|
54
55
|
* Parse a Fossil program and return its external references — the typed lineage
|
|
55
56
|
* (every data URI + `schema =` argument, each tagged with its `@conn` alias and
|
|
56
|
-
* role).
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* struct), so the browser and the CLI never diverge.
|
|
57
|
+
* role). A host reads this to derive a program's connections WITHOUT a compile
|
|
58
|
+
* or a server round-trip. Identical shape to the native `fossil_lineage::SourceRefInfo`,
|
|
59
|
+
* so every host reads the same answer.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
61
|
+
* **It boots the module itself**, the way {@link openProgram} does: the boot is shared and kept,
|
|
62
|
+
* so the call after the first costs the parse and nothing else, and a host writes no
|
|
63
|
+
* `initFossilWasm()` before it. That is why it answers a promise where {@link tokenize} does not —
|
|
64
|
+
* the lexer runs on every keystroke inside an editor that has already booted, and this runs once
|
|
65
|
+
* per question.
|
|
62
66
|
*/
|
|
63
|
-
export declare function refs(program: string): SourceRefInfo[]
|
|
67
|
+
export declare function refs(program: string, options?: BootOptions): Promise<SourceRefInfo[]>;
|
|
64
68
|
/**
|
|
65
69
|
* List the data-source providers fossil supports (`io.csv`, `io.rdf`, …) — the
|
|
66
|
-
* provider name, the extensions it reads, and how it can be used.
|
|
67
|
-
*
|
|
70
|
+
* provider name, the extensions it reads, and how it can be used. Compiled into the module,
|
|
71
|
+
* so a host may keep the answer for as long as it keeps the module.
|
|
68
72
|
*
|
|
69
|
-
*
|
|
73
|
+
* Boots the module itself, for the reason {@link refs} does. {@link providerFor} is the
|
|
74
|
+
* question a host usually asks of the answer.
|
|
70
75
|
*/
|
|
71
|
-
export declare function providers(): ProviderInfo[]
|
|
76
|
+
export declare function providers(options?: BootOptions): Promise<ProviderInfo[]>;
|
|
72
77
|
/**
|
|
73
78
|
* Workspace API class. Thin TS wrapper around the wasm-bindgen
|
|
74
79
|
* `FossilWorkspace` that exposes camelCase method names for JS idiom + better
|
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,EAK5B,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,EAK5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,aAAa,EACb,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OA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UAAU,GAAG,iBAAiB;IAQhD;;;OAGG;IACH,KAAK,IAAI,QAAQ,EAAE;IAInB;;OAEG;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;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,EAAE;IAItD;;;;;;;;;;;;OAYG;IACH,0BAA0B,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;IAMpE;;;;;;;OAOG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;CAGzD"}
|
package/dist/client.js
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* Mirrors `@fossil-lang/corpus`'s `client.ts` split, the known-good shape.
|
|
13
13
|
*/
|
|
14
14
|
import { FossilWorkspace as RawFossilWorkspace, FileHandle as RawFileHandle, tokenize as rawTokenize, tokenKinds as rawTokenKinds, refs as rawRefs, providers as rawProviders, } from '../pkg/fossil_wasm.js';
|
|
15
|
+
import { until, } from '@fossil-lang/types';
|
|
16
|
+
import { initFossilWasm } from './load.js';
|
|
15
17
|
/**
|
|
16
18
|
* Tokenize a Fossil source string. Returns the byte-range tokens from the
|
|
17
19
|
* canonical Rust lexer (`fossil_syntax::lexer::raw_lex`) — the single grammar
|
|
@@ -51,24 +53,30 @@ export function tokenKinds() {
|
|
|
51
53
|
/**
|
|
52
54
|
* Parse a Fossil program and return its external references — the typed lineage
|
|
53
55
|
* (every data URI + `schema =` argument, each tagged with its `@conn` alias and
|
|
54
|
-
* role).
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* struct), so the browser and the CLI never diverge.
|
|
56
|
+
* role). A host reads this to derive a program's connections WITHOUT a compile
|
|
57
|
+
* or a server round-trip. Identical shape to the native `fossil_lineage::SourceRefInfo`,
|
|
58
|
+
* so every host reads the same answer.
|
|
58
59
|
*
|
|
59
|
-
*
|
|
60
|
+
* **It boots the module itself**, the way {@link openProgram} does: the boot is shared and kept,
|
|
61
|
+
* so the call after the first costs the parse and nothing else, and a host writes no
|
|
62
|
+
* `initFossilWasm()` before it. That is why it answers a promise where {@link tokenize} does not —
|
|
63
|
+
* the lexer runs on every keystroke inside an editor that has already booted, and this runs once
|
|
64
|
+
* per question.
|
|
60
65
|
*/
|
|
61
|
-
export function refs(program) {
|
|
66
|
+
export async function refs(program, options = {}) {
|
|
67
|
+
await until(initFossilWasm(options.wasm), options.signal);
|
|
62
68
|
return rawRefs(program);
|
|
63
69
|
}
|
|
64
70
|
/**
|
|
65
71
|
* List the data-source providers fossil supports (`io.csv`, `io.rdf`, …) — the
|
|
66
|
-
* provider name, the extensions it reads, and how it can be used.
|
|
67
|
-
*
|
|
72
|
+
* provider name, the extensions it reads, and how it can be used. Compiled into the module,
|
|
73
|
+
* so a host may keep the answer for as long as it keeps the module.
|
|
68
74
|
*
|
|
69
|
-
*
|
|
75
|
+
* Boots the module itself, for the reason {@link refs} does. {@link providerFor} is the
|
|
76
|
+
* question a host usually asks of the answer.
|
|
70
77
|
*/
|
|
71
|
-
export function providers() {
|
|
78
|
+
export async function providers(options = {}) {
|
|
79
|
+
await until(initFossilWasm(options.wasm), options.signal);
|
|
72
80
|
return rawProviders();
|
|
73
81
|
}
|
|
74
82
|
/**
|
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,eAAe,IAAI,kBAAkB,EACrC,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,UAAU,IAAI,aAAa,EAC3B,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;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,eAAe,IAAI,kBAAkB,EACrC,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,UAAU,IAAI,aAAa,EAC3B,IAAI,IAAI,OAAO,EACf,SAAS,IAAI,YAAY,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,GAON,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EAAE,cAAc,EAAoB,MAAM,WAAW,CAAC;AAW7D;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,6EAA6E;IAC7E,sEAAsE;IACtE,8EAA8E;IAC9E,6EAA6E;IAC7E,OAAO,WAAW,CAAC,IAAI,CAAe,CAAC;AACzC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,aAAa,EAAc,CAAC;AACrC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAe,EAAE,UAAuB,EAAE;IACnE,MAAM,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,OAAO,CAAC,OAAO,CAAoB,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,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AAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAuB,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;OAYG;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;IAED;;;;;;;OAOG;IACH,mBAAmB,CAAC,GAAW,EAAE,OAAgB;QAC/C,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* - {@link openProgram} — one program open for an editor: the workspace, the push-before-ask
|
|
11
11
|
* discipline and the document resolution a host would otherwise write, shaped to spread into
|
|
12
12
|
* `@fossil-lang/codemirror-fossil`'s `fossil()`. What a host with one editor calls.
|
|
13
|
+
* - {@link refs} and {@link providers} — a program's external references, and the providers this
|
|
14
|
+
* build reads. Each boots the module itself, as `openProgram` does: no `initFossilWasm()` first.
|
|
15
|
+
* - {@link providerFor} — which of those providers reads a path, as data or as a schema.
|
|
13
16
|
* - {@link FossilWorkspace} — Workspace API class: open / update / close,
|
|
14
17
|
* `check`, the three position queries (`hover`, `completions`,
|
|
15
18
|
* `gotoDefinition`) and `semanticTokens` an editor draws its IDE surface from, and the documents
|
|
@@ -25,9 +28,10 @@
|
|
|
25
28
|
* const extensions = fossil({ ...program, onNavigate });
|
|
26
29
|
*/
|
|
27
30
|
export { initFossilWasm } from './load.js';
|
|
28
|
-
export type { InitInput } from './load.js';
|
|
31
|
+
export type { BootOptions, InitInput } from './load.js';
|
|
29
32
|
export { tokenize, tokenKinds, FossilWorkspace, refs, providers, } from './client.js';
|
|
30
33
|
export type { FileHandle } from './client.js';
|
|
34
|
+
export { providerFor } from './provider.js';
|
|
31
35
|
export { openProgram } from './program.js';
|
|
32
36
|
export type { FossilProgram, Introspection, OpenProgramOptions } from './program.js';
|
|
33
37
|
/** One external reference a program makes — the typed lineage returned by
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,IAAI,EACJ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAErF;;;4EAG4E;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,MAAM,GAAG,MAAM,CAAC;CAClC;AAED;2FAC2F;AAC3F,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;8EAE8E;AAC9E,MAAM,WAAW,QAAQ;IACvB,K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,EACR,IAAI,EACJ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* - {@link openProgram} — one program open for an editor: the workspace, the push-before-ask
|
|
11
11
|
* discipline and the document resolution a host would otherwise write, shaped to spread into
|
|
12
12
|
* `@fossil-lang/codemirror-fossil`'s `fossil()`. What a host with one editor calls.
|
|
13
|
+
* - {@link refs} and {@link providers} — a program's external references, and the providers this
|
|
14
|
+
* build reads. Each boots the module itself, as `openProgram` does: no `initFossilWasm()` first.
|
|
15
|
+
* - {@link providerFor} — which of those providers reads a path, as data or as a schema.
|
|
13
16
|
* - {@link FossilWorkspace} — Workspace API class: open / update / close,
|
|
14
17
|
* `check`, the three position queries (`hover`, `completions`,
|
|
15
18
|
* `gotoDefinition`) and `semanticTokens` an editor draws its IDE surface from, and the documents
|
|
@@ -26,5 +29,6 @@
|
|
|
26
29
|
*/
|
|
27
30
|
export { initFossilWasm } from './load.js';
|
|
28
31
|
export { tokenize, tokenKinds, FossilWorkspace, refs, providers, } from './client.js';
|
|
32
|
+
export { providerFor } from './provider.js';
|
|
29
33
|
export { openProgram } from './program.js';
|
|
30
34
|
//# sourceMappingURL=index.js.map
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,IAAI,EACJ,SAAS,GACV,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/load.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { InitInput } from '../pkg/fossil_wasm.js';
|
|
2
2
|
export type { InitInput };
|
|
3
|
+
/** What a call that boots the module on its own takes — {@link openProgram}'s two boot options,
|
|
4
|
+
* for the calls that need the module and no workspace. */
|
|
5
|
+
export interface BootOptions {
|
|
6
|
+
/** The module's `.wasm`, for a host with no bundler — see {@link initFossilWasm}. */
|
|
7
|
+
wasm?: InitInput;
|
|
8
|
+
/** Stops the wait for the boot, rejecting with its reason. The boot itself is shared and goes on. */
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}
|
|
3
11
|
/**
|
|
4
12
|
* Boot the fossil-wasm module. MUST be awaited before calling any of
|
|
5
13
|
* {@link tokenize}, {@link tokenKinds}, or instantiating
|
package/dist/load.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,YAAY,EAAE,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;2DAC2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,qFAAqF;IACrF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qGAAqG;IACrG,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAUjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
|
package/dist/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,kGAAkG;AAClG,+FAA+F;AAC/F,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,kGAAkG;AAClG,+FAA+F;AAC/F,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAa1C,IAAI,YAAY,GAA4B,IAAI,CAAC;AAEjD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,IAAgB;IAC7C,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;QAC1B,kFAAkF;QAClF,MAAM,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnH,YAAY,GAAG,OAAO,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;YACjB,IAAI,YAAY,KAAK,OAAO;gBAAE,YAAY,GAAG,IAAI,CAAC,CAAC,0CAA0C;QAC/F,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which provider reads a file — the question a host asks of {@link providers} whenever it lists
|
|
3
|
+
* files for a person to pick: which of these can a program read as data, which as a schema, and
|
|
4
|
+
* with which `io.` constructor.
|
|
5
|
+
*
|
|
6
|
+
* Pure, and needs no module: it reads the list `providers()` answered, so a host filtering a
|
|
7
|
+
* listing of a thousand files asks the module once.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProviderInfo, SourceRefInfo } from './index.js';
|
|
10
|
+
/**
|
|
11
|
+
* The provider that reads `path` in `role`, by its extension, case-insensitively — or `undefined`
|
|
12
|
+
* when none does.
|
|
13
|
+
*
|
|
14
|
+
* `role` is {@link SourceRefInfo.role}, and it is not optional because one extension can name two
|
|
15
|
+
* providers: a `.ttl` is `rdf` read as data and `shacl` read as a schema. A provider whose `kind` is
|
|
16
|
+
* `both` answers either.
|
|
17
|
+
*
|
|
18
|
+
* `path` is anything a program could write as a source — a bare name, a `@conn/…` reference, a
|
|
19
|
+
* URL. A URL's query and fragment are not part of its extension (`…/a.csv?sig=…` is a CSV), and a
|
|
20
|
+
* name with no extension (`README`, `.env`) has none, so no provider reads it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function providerFor(path: string, role: SourceRefInfo['role'], providers: readonly ProviderInfo[]): ProviderInfo | undefined;
|
|
23
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,SAAS,EAAE,SAAS,YAAY,EAAE,GACjC,YAAY,GAAG,SAAS,CAQ1B"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The provider that reads `path` in `role`, by its extension, case-insensitively — or `undefined`
|
|
3
|
+
* when none does.
|
|
4
|
+
*
|
|
5
|
+
* `role` is {@link SourceRefInfo.role}, and it is not optional because one extension can name two
|
|
6
|
+
* providers: a `.ttl` is `rdf` read as data and `shacl` read as a schema. A provider whose `kind` is
|
|
7
|
+
* `both` answers either.
|
|
8
|
+
*
|
|
9
|
+
* `path` is anything a program could write as a source — a bare name, a `@conn/…` reference, a
|
|
10
|
+
* URL. A URL's query and fragment are not part of its extension (`…/a.csv?sig=…` is a CSV), and a
|
|
11
|
+
* name with no extension (`README`, `.env`) has none, so no provider reads it.
|
|
12
|
+
*/
|
|
13
|
+
export function providerFor(path, role, providers) {
|
|
14
|
+
const name = path.replace(/[?#].*$/, '').split('/').pop() ?? '';
|
|
15
|
+
const dot = name.lastIndexOf('.');
|
|
16
|
+
if (dot <= 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
const extension = name.slice(dot + 1).toLowerCase();
|
|
19
|
+
return providers.find((p) => (p.kind === role || p.kind === 'both') && p.extensions.includes(extension));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,IAA2B,EAC3B,SAAkC;IAElC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAChE,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACpD,OAAO,SAAS,CAAC,IAAI,CACnB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAClF,CAAC;AACJ,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.25",
|
|
4
4
|
"description": "JS/TS wrapper around the fossil-wasm wasm-bindgen artifacts (--target web). Exposes initFossilWasm + tokenize + openProgram + FossilWorkspace class for downstream @fossil-lang/* packages.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"sideEffects": false,
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fossil-lang/storage": "0.3.0-alpha.
|
|
37
|
-
"@fossil-lang/types": "0.3.0-alpha.
|
|
36
|
+
"@fossil-lang/storage": "0.3.0-alpha.25",
|
|
37
|
+
"@fossil-lang/types": "0.3.0-alpha.25"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "^5.6.0",
|