@pascal-app/geometry-script 0.0.0-stage → 1.0.4
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/LICENSE +21 -0
- package/README.md +4 -2
- package/bpy/runner.py +169 -0
- package/dist/blender-local.d.ts +16 -0
- package/dist/blender-local.d.ts.map +1 -0
- package/dist/blender-local.js +49 -0
- package/dist/blender.d.ts +30 -0
- package/dist/blender.d.ts.map +1 -0
- package/dist/blender.js +79 -0
- package/dist/compile.d.ts +34 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +783 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/sandbox-window.d.ts +2 -0
- package/dist/sandbox-window.d.ts.map +1 -0
- package/dist/sandbox-window.js +5 -0
- package/dist/sandbox-worker.d.ts +2 -0
- package/dist/sandbox-worker.d.ts.map +1 -0
- package/dist/sandbox-worker.js +52 -0
- package/dist/sandbox.d.ts +2 -0
- package/dist/sandbox.js +2 -0
- package/dist/transform.d.ts +10 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +73 -0
- package/package.json +66 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-window.d.ts","sourceRoot":"","sources":["../src/sandbox-window.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-worker.d.ts","sourceRoot":"","sources":["../src/sandbox-worker.ts"],"names":[],"mappings":"AAQA,OAAO,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference lib="webworker" />
|
|
2
|
+
// The compile worker that runs inside the editor's opaque-origin sandbox frame.
|
|
3
|
+
// Built into one self-contained classic script (scripts/build-sandbox.ts): the
|
|
4
|
+
// frame receives it as text and starts it from a blob (an opaque origin cannot
|
|
5
|
+
// start a module worker), under the frame's CSP (no
|
|
6
|
+
// network, fonts, images or nested frames). Removing ambient capabilities
|
|
7
|
+
// below is defence in depth on top of that boundary.
|
|
8
|
+
import './sandbox-window.js';
|
|
9
|
+
import { compileGeometryScript } from './compile.js';
|
|
10
|
+
const scope = globalThis;
|
|
11
|
+
const BLOCKED = [
|
|
12
|
+
'fetch',
|
|
13
|
+
'XMLHttpRequest',
|
|
14
|
+
'WebSocket',
|
|
15
|
+
'WebTransport',
|
|
16
|
+
'EventSource',
|
|
17
|
+
'importScripts',
|
|
18
|
+
'indexedDB',
|
|
19
|
+
'caches',
|
|
20
|
+
'Worker',
|
|
21
|
+
'SharedWorker',
|
|
22
|
+
'BroadcastChannel',
|
|
23
|
+
'Request',
|
|
24
|
+
'Response',
|
|
25
|
+
'FontFace',
|
|
26
|
+
];
|
|
27
|
+
const post = self.postMessage.bind(self);
|
|
28
|
+
for (const name of BLOCKED) {
|
|
29
|
+
for (let target = scope; target; target = Object.getPrototypeOf(target)) {
|
|
30
|
+
if (Object.hasOwn(target, name)) {
|
|
31
|
+
try {
|
|
32
|
+
Object.defineProperty(target, name, {
|
|
33
|
+
value: undefined,
|
|
34
|
+
configurable: false,
|
|
35
|
+
writable: false,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch { }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
self.addEventListener('message', async (event) => {
|
|
43
|
+
const { id, code, params } = event.data;
|
|
44
|
+
try {
|
|
45
|
+
const output = await compileGeometryScript({ code, params });
|
|
46
|
+
post({ id, ok: true, output }, [output.glb]);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
post({ id, ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
post({ ready: true });
|