@markii/lua 0.11.0 → 0.12.1
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/dist/require.d.ts +20 -16
- package/package.json +3 -3
package/dist/require.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { ScriptView } from '@markii/bundle';
|
|
2
2
|
/**
|
|
3
3
|
* Sandboxed `require` (spec §8 "Long scripts and shared code", docs/
|
|
4
|
-
* scripting.md): exactly
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
4
|
+
* scripting.md): there are exactly TWO sources of shared Lua, and this
|
|
5
|
+
* module implements both — bundle-local modules, and pack modules (the
|
|
6
|
+
* `PackModuleResolver` seam below, which a host wires to its own installed
|
|
7
|
+
* packs, e.g. `@markii/host`'s `createPackModuleResolver`). There is no
|
|
8
|
+
* third source: a folder of shared Lua with nothing to render is simply a
|
|
9
|
+
* pack whose manifest declares no components (`"components": {}`) and
|
|
10
|
+
* carries its own `scripts/*.lua` — it is a pack module like any other, not
|
|
11
|
+
* a separate mechanism. Both sources share ONE property: every require
|
|
12
|
+
* target this module resolves is PURE LUA SOURCE TEXT, loaded as a fresh
|
|
13
|
+
* PROTECTED CHUNK on the SAME thread as the rest of the run, so it shares
|
|
14
|
+
* that run's globals, capabilities, and instruction/wall-clock/memory
|
|
15
|
+
* budget — a module can never grant itself more than the script that
|
|
16
|
+
* required it already had.
|
|
15
17
|
*
|
|
16
18
|
* ## Two sources, told apart by the first path segment (docs/scripting.md)
|
|
17
19
|
*
|
|
@@ -28,11 +30,13 @@ import type { ScriptView } from '@markii/bundle';
|
|
|
28
30
|
* no separate tier gate to apply on top of what `bundle.read` already
|
|
29
31
|
* enforces.
|
|
30
32
|
* - **Pack-namespaced**: `require "ana/http"` (first segment anything
|
|
31
|
-
* else). This
|
|
32
|
-
* `PackModuleResolver`.
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* else). This package only defines the seam: an optional injected
|
|
34
|
+
* `PackModuleResolver`. A host that has wired up pack installation
|
|
35
|
+
* (`@markii/host`'s `discoverPacks` + `loadPackModules` +
|
|
36
|
+
* `createPackModuleResolver`) passes a real resolver in; with none
|
|
37
|
+
* configured, a pack-namespaced `require` fails cleanly as a capability
|
|
38
|
+
* denial — never a crash, never a fallthrough into filesystem or network
|
|
39
|
+
* access.
|
|
36
40
|
*
|
|
37
41
|
* ## Why a real `require` needs `load` back, carefully
|
|
38
42
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markii/lua",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Sandboxed Lua 5.4 (wasmoon) execution runtime for Mark's document scripting: an empty-env global whitelist, two-tier capability-gated net/cache/bundle access, instruction-count/wall-clock/memory limits, and depth/size-capped Lua<->JS marshaling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"lint": "eslint ."
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@markii/bundle": "0.
|
|
48
|
-
"@markii/runtime": "0.
|
|
47
|
+
"@markii/bundle": "^0.12.1",
|
|
48
|
+
"@markii/runtime": "^0.12.1",
|
|
49
49
|
"wasmoon": "^1.16.0"
|
|
50
50
|
}
|
|
51
51
|
}
|