@markii/host 0.0.1 → 0.17.0-next.3
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 +20 -2
- package/dist/browser-worker.js +639 -0
- package/dist/browser.d.ts +61 -0
- package/dist/browser.js +172 -0
- package/dist/conformance/host/01-plain-open/expected.json +5 -0
- package/dist/conformance/host/01-plain-open/note.mk.md +8 -0
- package/dist/conformance/host/01-plain-open/scenario.json +6 -0
- package/dist/conformance/host/02-run-manual-grant-accepted/expected.json +16 -0
- package/dist/conformance/host/02-run-manual-grant-accepted/note.mk.md +5 -0
- package/dist/conformance/host/02-run-manual-grant-accepted/scenario.json +14 -0
- package/dist/conformance/host/03-run-manual-grant-refused/expected.json +18 -0
- package/dist/conformance/host/03-run-manual-grant-refused/note.mk.md +5 -0
- package/dist/conformance/host/03-run-manual-grant-refused/scenario.json +14 -0
- package/dist/conformance/host/04-run-auto-write-denied/expected.json +16 -0
- package/dist/conformance/host/04-run-auto-write-denied/note.mk.md +10 -0
- package/dist/conformance/host/04-run-auto-write-denied/scenario.json +13 -0
- package/dist/conformance/host/05-export-html-pack-directive/expected.json +14 -0
- package/dist/conformance/host/05-export-html-pack-directive/note.mk.md +8 -0
- package/dist/conformance/host/05-export-html-pack-directive/scenario.json +6 -0
- package/dist/conformance/host/06-install-pack-then-render/expected.json +18 -0
- package/dist/conformance/host/06-install-pack-then-render/files/ana-1.0.0/pack.json +13 -0
- package/dist/conformance/host/06-install-pack-then-render/files/ana-1.0.0/webview.js +1 -0
- package/dist/conformance/host/06-install-pack-then-render/note.mk.md +5 -0
- package/dist/conformance/host/06-install-pack-then-render/scenario.json +15 -0
- package/dist/conformance/host/07-complete-in-directive/expected.json +14 -0
- package/dist/conformance/host/07-complete-in-directive/note.mk.md +3 -0
- package/dist/conformance/host/07-complete-in-directive/scenario.json +6 -0
- package/dist/conformance/host/08-hover-standard-component/expected.json +5 -0
- package/dist/conformance/host/08-hover-standard-component/note.mk.md +5 -0
- package/dist/conformance/host/08-hover-standard-component/scenario.json +6 -0
- package/dist/conformance/host/09-insert-skeleton/expected.json +5 -0
- package/dist/conformance/host/09-insert-skeleton/note.mk.md +4 -0
- package/dist/conformance/host/09-insert-skeleton/scenario.json +6 -0
- package/dist/conformance/host/10-scripts-disabled/expected.json +11 -0
- package/dist/conformance/host/10-scripts-disabled/note.mk.md +5 -0
- package/dist/conformance/host/10-scripts-disabled/scenario.json +9 -0
- package/dist/conformance/host/11-complete-closing-fence/expected.json +5 -0
- package/dist/conformance/host/11-complete-closing-fence/note.mk.md +5 -0
- package/dist/conformance/host/11-complete-closing-fence/scenario.json +12 -0
- package/dist/conformance/host/12-complete-nested-container/expected.json +5 -0
- package/dist/conformance/host/12-complete-nested-container/note.mk.md +5 -0
- package/dist/conformance/host/12-complete-nested-container/scenario.json +12 -0
- package/dist/conformance/host/13-install-pack-declined/expected.json +12 -0
- package/dist/conformance/host/13-install-pack-declined/files/ana-1.0.0/pack.json +13 -0
- package/dist/conformance/host/13-install-pack-declined/files/ana-1.0.0/webview.js +1 -0
- package/dist/conformance/host/13-install-pack-declined/note.mk.md +5 -0
- package/dist/conformance/host/13-install-pack-declined/scenario.json +10 -0
- package/dist/conformance/host/14-remove-pack/expected.json +14 -0
- package/dist/conformance/host/14-remove-pack/files/ana-1.0.0/pack.json +13 -0
- package/dist/conformance/host/14-remove-pack/files/ana-1.0.0/webview.js +1 -0
- package/dist/conformance/host/14-remove-pack/note.mk.md +5 -0
- package/dist/conformance/host/14-remove-pack/scenario.json +11 -0
- package/dist/conformance/host/15-load-packs-engine-views/expected.json +19 -0
- package/dist/conformance/host/15-load-packs-engine-views/files/duo-1.0.0/pack.json +9 -0
- package/dist/conformance/host/15-load-packs-engine-views/files/duo-1.0.0/webview.js +1 -0
- package/dist/conformance/host/15-load-packs-engine-views/note.mk.md +9 -0
- package/dist/conformance/host/15-load-packs-engine-views/scenario.json +10 -0
- package/dist/conformance/host/16-pack-trust/expected.json +37 -0
- package/dist/conformance/host/16-pack-trust/files/ana-1.0.0/pack.json +12 -0
- package/dist/conformance/host/16-pack-trust/files/ana-1.0.0/webview.js +1 -0
- package/dist/conformance/host/16-pack-trust/files/sneaky-1.0.0/pack.json +12 -0
- package/dist/conformance/host/16-pack-trust/files/sneaky-1.0.0/webview.js +1 -0
- package/dist/conformance/host/16-pack-trust/note.mk.md +5 -0
- package/dist/conformance/host/16-pack-trust/scenario.json +26 -0
- package/dist/conformance/host/README.md +221 -0
- package/dist/conformance.d.ts +2 -0
- package/dist/conformance.js +5 -0
- package/dist/diagnostics/render-diagnostics.d.ts +41 -0
- package/dist/diagnostics/render-diagnostics.js +46 -0
- package/dist/export/cascade.d.ts +98 -0
- package/dist/export/cascade.js +159 -0
- package/dist/export/export-zip.d.ts +19 -0
- package/dist/export/export-zip.js +38 -0
- package/dist/export/image-embed.d.ts +126 -0
- package/dist/export/image-embed.js +274 -0
- package/dist/export/note-export.d.ts +332 -0
- package/dist/export/note-export.js +366 -0
- package/dist/export/note-links.d.ts +83 -0
- package/dist/export/note-links.js +241 -0
- package/dist/glue.wasm +0 -0
- package/dist/host/adapter.d.ts +218 -0
- package/dist/host/adapter.js +9 -0
- package/dist/host/cascade-export-behavior.d.ts +120 -0
- package/dist/host/cascade-export-behavior.js +151 -0
- package/dist/host/conformance-runner.d.ts +159 -0
- package/dist/host/conformance-runner.js +632 -0
- package/dist/host/create-host.d.ts +251 -0
- package/dist/host/create-host.js +329 -0
- package/dist/host/editor-behavior.d.ts +153 -0
- package/dist/host/editor-behavior.js +223 -0
- package/dist/host/export/md-plain.d.ts +15 -0
- package/dist/host/export/md-plain.js +125 -0
- package/dist/host/export-behavior.d.ts +111 -0
- package/dist/host/export-behavior.js +257 -0
- package/dist/host/labels.d.ts +23 -0
- package/dist/host/labels.js +32 -0
- package/dist/host/pack-archive.d.ts +30 -0
- package/dist/host/pack-archive.js +62 -0
- package/dist/host/pack-install.d.ts +87 -0
- package/dist/host/pack-install.js +186 -0
- package/dist/host/pack-load.d.ts +71 -0
- package/dist/host/pack-load.js +57 -0
- package/dist/host/pack-remove.d.ts +21 -0
- package/dist/host/pack-remove.js +65 -0
- package/dist/host/pack-trust-behavior.d.ts +79 -0
- package/dist/host/pack-trust-behavior.js +262 -0
- package/dist/host/refresh-interval.d.ts +37 -0
- package/dist/host/refresh-interval.js +59 -0
- package/dist/host/run-behavior.d.ts +88 -0
- package/dist/host/run-behavior.js +189 -0
- package/dist/host/run-diagnostics.d.ts +26 -0
- package/dist/host/run-diagnostics.js +43 -0
- package/dist/host/script-execution.d.ts +72 -0
- package/dist/host/script-execution.js +68 -0
- package/dist/host/terminal-packs.d.ts +39 -0
- package/dist/host/terminal-packs.js +51 -0
- package/dist/html-engine.d.ts +2 -0
- package/dist/html-engine.js +29 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.js +69 -0
- package/dist/insert/component-catalog.d.ts +23 -0
- package/dist/insert/component-catalog.js +96 -0
- package/dist/node-fs.d.ts +14 -0
- package/dist/node-fs.js +70 -0
- package/dist/node-worker.js +20657 -0
- package/dist/node.d.ts +6 -0
- package/dist/node.js +13 -0
- package/dist/package.json +3 -0
- package/dist/packs/discover.d.ts +119 -0
- package/dist/packs/discover.js +266 -0
- package/dist/packs/pack-diagnostics.d.ts +79 -0
- package/dist/packs/pack-diagnostics.js +103 -0
- package/dist/packs/pack-paths.d.ts +53 -0
- package/dist/packs/pack-paths.js +105 -0
- package/dist/packs/pack-render-registry.d.ts +82 -0
- package/dist/packs/pack-render-registry.js +182 -0
- package/dist/packs/pack-scripts.d.ts +20 -0
- package/dist/packs/pack-scripts.js +96 -0
- package/dist/packs/pack-trust.d.ts +57 -0
- package/dist/packs/pack-trust.js +111 -0
- package/dist/packs/prebuilt.d.ts +49 -0
- package/dist/packs/prebuilt.js +97 -0
- package/dist/path-util.d.ts +24 -0
- package/dist/path-util.js +82 -0
- package/dist/run/browser-isolate.d.ts +45 -0
- package/dist/run/browser-isolate.js +85 -0
- package/dist/run/bundle-document.d.ts +29 -0
- package/dist/run/bundle-document.js +40 -0
- package/dist/run/bundle-run.d.ts +188 -0
- package/dist/run/bundle-run.js +232 -0
- package/dist/run/grant-flow.d.ts +232 -0
- package/dist/run/grant-flow.js +390 -0
- package/dist/run/ip-address.d.ts +41 -0
- package/dist/run/ip-address.js +255 -0
- package/dist/run/isolate.d.ts +59 -0
- package/dist/run/isolate.js +22 -0
- package/dist/run/lua-resolver.d.ts +21 -0
- package/dist/run/lua-resolver.js +63 -0
- package/dist/run/net-bridge-worker.d.ts +26 -0
- package/dist/run/net-bridge-worker.js +66 -0
- package/dist/run/net-bridge.d.ts +56 -0
- package/dist/run/net-bridge.js +59 -0
- package/dist/run/net-pinning.d.ts +82 -0
- package/dist/run/net-pinning.js +137 -0
- package/dist/run/net-provider.d.ts +72 -0
- package/dist/run/net-provider.js +303 -0
- package/dist/run/node-isolate.d.ts +22 -0
- package/dist/run/node-isolate.js +68 -0
- package/dist/run/run-flow.d.ts +186 -0
- package/dist/run/run-flow.js +323 -0
- package/dist/run/run-host.d.ts +107 -0
- package/dist/run/run-host.js +241 -0
- package/dist/run/run-job.d.ts +130 -0
- package/dist/run/run-job.js +279 -0
- package/dist/run/run-progress.d.ts +55 -0
- package/dist/run/run-progress.js +42 -0
- package/dist/run/run-trace.d.ts +44 -0
- package/dist/run/run-trace.js +36 -0
- package/dist/run/script-requirements.d.ts +98 -0
- package/dist/run/script-requirements.js +212 -0
- package/dist/run/snapshot-storage.d.ts +25 -0
- package/dist/run/snapshot-storage.js +31 -0
- package/dist/run/stale-values.d.ts +25 -0
- package/dist/run/stale-values.js +32 -0
- package/dist/run/worker-entry-browser.d.ts +62 -0
- package/dist/run/worker-entry-browser.js +172 -0
- package/dist/run/worker-entry.d.ts +1 -0
- package/dist/run/worker-entry.js +98 -0
- package/dist/values-failure.d.ts +17 -0
- package/dist/values-failure.js +1 -0
- package/dist/values-merge.d.ts +39 -0
- package/dist/values-merge.js +33 -0
- package/package.json +80 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ValuesFailure` is the wire-protocol shape a host uses to report one
|
|
3
|
+
* script's failure back to its renderer/webview: the script's name and a
|
|
4
|
+
* closed `FailureKind`, never the raw error message (the rendered page
|
|
5
|
+
* shows quiet markers, never error dumps — see AGENTS.md's cleanliness
|
|
6
|
+
* principle). Defined here, in the shared host layer, so every host
|
|
7
|
+
* (`apps/vscode`, and any future host) and this package's own `run-flow.ts`
|
|
8
|
+
* agree on a single definition instead of drifting copies; a consuming
|
|
9
|
+
* app's own wire-protocol module (e.g. `apps/vscode/src/protocol.ts`) is
|
|
10
|
+
* expected to import and re-export this type rather than restate it.
|
|
11
|
+
*/
|
|
12
|
+
import type { FailureKind } from '@markii/runtime';
|
|
13
|
+
/** One script's outcome, reduced to just its name and failure kind — never the raw error message. */
|
|
14
|
+
export interface ValuesFailure {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly kind: FailureKind;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one way a host folds a single arriving value into the value store its
|
|
3
|
+
* preview is rendering from (GitHub issue #35).
|
|
4
|
+
*
|
|
5
|
+
* A run reports its values one at a time, in document order, while it is
|
|
6
|
+
* still going. Each arrival has to replace exactly one name and leave every
|
|
7
|
+
* other name exactly as it was — that is what makes the bound component go
|
|
8
|
+
* fresh while the rest of the note stays visibly stale, instead of the
|
|
9
|
+
* whole page flipping at the end of the batch.
|
|
10
|
+
*
|
|
11
|
+
* It lives here, in the shared host layer, because both hosts do it: the VS
|
|
12
|
+
* Code webview folds a `value` wire message into its React state, and the
|
|
13
|
+
* Obsidian view folds a callback's value into the store it re-renders from.
|
|
14
|
+
* Two copies of a merge this small still drift, and the `__proto__` rule
|
|
15
|
+
* below is exactly the kind of detail one copy would quietly lose.
|
|
16
|
+
*
|
|
17
|
+
* Environment-free on purpose (no `node:*`, no React), so the main entry
|
|
18
|
+
* can export it and a browser bundle can import it.
|
|
19
|
+
*/
|
|
20
|
+
import type { StoredValue } from '@markii/runtime';
|
|
21
|
+
/**
|
|
22
|
+
* `values` with `name` set to `value`, as a NEW object — the input is never
|
|
23
|
+
* mutated, so a caller holding the previous store (React state, a view's
|
|
24
|
+
* last-rendered snapshot) can still compare against it.
|
|
25
|
+
*
|
|
26
|
+
* A name already present keeps its POSITION and takes the new value; a new
|
|
27
|
+
* name is appended. Order is not semantically meaningful to a renderer, but
|
|
28
|
+
* a store whose keys reshuffle on every value would make any diff of two
|
|
29
|
+
* snapshots harder to read than it needs to be.
|
|
30
|
+
*
|
|
31
|
+
* Built through `Object.fromEntries` rather than `{...values, [name]: value}`
|
|
32
|
+
* because a script may legitimately be named `__proto__` (docs/spec.md's
|
|
33
|
+
* name grammar allows it): a computed assignment of that key hits
|
|
34
|
+
* `Object.prototype`'s setter, which sets the object's prototype and
|
|
35
|
+
* creates no own property at all, silently dropping the value. The same
|
|
36
|
+
* guard is in `run/run-flow.ts`'s `mergePersistedValues` and
|
|
37
|
+
* `run/stale-values.ts`, for the same reason.
|
|
38
|
+
*/
|
|
39
|
+
export declare function mergeArrivingValue(values: Readonly<Record<string, StoredValue>> | undefined, name: string, value: StoredValue): Record<string, StoredValue>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `values` with `name` set to `value`, as a NEW object — the input is never
|
|
3
|
+
* mutated, so a caller holding the previous store (React state, a view's
|
|
4
|
+
* last-rendered snapshot) can still compare against it.
|
|
5
|
+
*
|
|
6
|
+
* A name already present keeps its POSITION and takes the new value; a new
|
|
7
|
+
* name is appended. Order is not semantically meaningful to a renderer, but
|
|
8
|
+
* a store whose keys reshuffle on every value would make any diff of two
|
|
9
|
+
* snapshots harder to read than it needs to be.
|
|
10
|
+
*
|
|
11
|
+
* Built through `Object.fromEntries` rather than `{...values, [name]: value}`
|
|
12
|
+
* because a script may legitimately be named `__proto__` (docs/spec.md's
|
|
13
|
+
* name grammar allows it): a computed assignment of that key hits
|
|
14
|
+
* `Object.prototype`'s setter, which sets the object's prototype and
|
|
15
|
+
* creates no own property at all, silently dropping the value. The same
|
|
16
|
+
* guard is in `run/run-flow.ts`'s `mergePersistedValues` and
|
|
17
|
+
* `run/stale-values.ts`, for the same reason.
|
|
18
|
+
*/
|
|
19
|
+
export function mergeArrivingValue(values, name, value) {
|
|
20
|
+
const entries = [];
|
|
21
|
+
let replaced = false;
|
|
22
|
+
for (const [key, existing] of Object.entries(values ?? {})) {
|
|
23
|
+
if (key === name) {
|
|
24
|
+
entries.push([key, value]);
|
|
25
|
+
replaced = true;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
entries.push([key, existing]);
|
|
29
|
+
}
|
|
30
|
+
if (!replaced)
|
|
31
|
+
entries.push([name, value]);
|
|
32
|
+
return Object.fromEntries(entries);
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,89 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markii/host",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.17.0-next.3",
|
|
4
|
+
"description": "Shared, host-neutral script-running layer for Markii hosts: tier gating, the grant model, address pinning, and the terminatable-isolate watchdog, plus the HostAdapter contract and createMarkiiHost. Entries: the neutral main entry, /node, /browser, /conformance.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"markdown",
|
|
7
|
+
"mk.md",
|
|
8
|
+
"markii",
|
|
9
|
+
"host",
|
|
10
|
+
"sandbox"
|
|
11
|
+
],
|
|
5
12
|
"license": "MIT",
|
|
13
|
+
"author": "sadigaxund",
|
|
14
|
+
"homepage": "https://github.com/markii-org/markii#readme",
|
|
15
|
+
"bugs": "https://github.com/markii-org/markii/issues",
|
|
6
16
|
"repository": {
|
|
7
17
|
"type": "git",
|
|
8
18
|
"url": "git+https://github.com/markii-org/markii.git",
|
|
9
19
|
"directory": "packages/markii-host"
|
|
10
20
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"module": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./node": {
|
|
31
|
+
"types": "./dist/node.d.ts",
|
|
32
|
+
"import": "./dist/node.js",
|
|
33
|
+
"default": "./dist/node.js"
|
|
34
|
+
},
|
|
35
|
+
"./node-worker": {
|
|
36
|
+
"default": "./dist/node-worker.js"
|
|
37
|
+
},
|
|
38
|
+
"./browser": {
|
|
39
|
+
"types": "./dist/browser.d.ts",
|
|
40
|
+
"import": "./dist/browser.js",
|
|
41
|
+
"default": "./dist/browser.js"
|
|
42
|
+
},
|
|
43
|
+
"./conformance": {
|
|
44
|
+
"types": "./dist/conformance.d.ts",
|
|
45
|
+
"import": "./dist/conformance.js",
|
|
46
|
+
"default": "./dist/conformance.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"pretest": "npm run generate:doc-css --workspace @markii/html",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"prebuild": "npm run generate:doc-css --workspace @markii/html",
|
|
53
|
+
"build": "tsc --noEmit -p tsconfig.json",
|
|
54
|
+
"lint": "eslint .",
|
|
55
|
+
"build:dist": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/build-dist-assets.mjs"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@markii/bundle": "^0.17.0-next.3",
|
|
59
|
+
"@markii/core": "^0.17.0-next.3",
|
|
60
|
+
"@markii/lua": "^0.17.0-next.3",
|
|
61
|
+
"@markii/pack": "^0.17.0-next.3",
|
|
62
|
+
"@markii/runtime": "^0.17.0-next.3",
|
|
63
|
+
"@markii/stdlib": "^0.17.0-next.3",
|
|
64
|
+
"fflate": "^0.8.3"
|
|
65
|
+
},
|
|
66
|
+
"files": [
|
|
67
|
+
"dist"
|
|
68
|
+
],
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"@markii/html": "^0.17.0-next.3",
|
|
71
|
+
"@markii/react": "^0.17.0-next.3"
|
|
72
|
+
},
|
|
73
|
+
"peerDependenciesMeta": {
|
|
74
|
+
"@markii/html": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"@markii/react": {
|
|
78
|
+
"optional": true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@markii/html": "^0.17.0-next.3",
|
|
83
|
+
"@markii/react": "^0.17.0-next.3",
|
|
84
|
+
"esbuild": "^0.28.2"
|
|
85
|
+
},
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
}
|
|
13
89
|
}
|