@sanox/sangine-core 0.1.0
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/consts.d.ts +2 -0
- package/dist/consts.d.ts.map +1 -0
- package/dist/gen-types.d.ts +138 -0
- package/dist/gen-types.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +256 -0
- package/dist/rendererService.d.ts +52 -0
- package/dist/rendererService.d.ts.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/wasm/sangine/sangine.d.ts +100 -0
- package/dist/wasm/sangine/sangine.js +3206 -0
- package/dist/wasm/sangine/sangine_bg.wasm +0 -0
- package/dist/wasm/sangine/sangine_bg.wasm.d.ts +33 -0
- package/dist/wasm/sbo-decode/wasm_sbo_decode.d.ts +37 -0
- package/dist/wasm/sbo-decode/wasm_sbo_decode.js +185 -0
- package/dist/wasm/sbo-decode/wasm_sbo_decode_bg.wasm +0 -0
- package/dist/wasm/sbo-decode/wasm_sbo_decode_bg.wasm.d.ts +8 -0
- package/dist/worker/decodeWorkerImpl.d.ts +2 -0
- package/dist/worker/decodeWorkerImpl.d.ts.map +1 -0
- package/dist/worker/pool.d.ts +11 -0
- package/dist/worker/pool.d.ts.map +1 -0
- package/package.json +49 -0
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const animate_to: (a: number, b: any) => [number, number];
|
|
5
|
+
export const animate_to_route: (a: number, b: number, c: number) => [number, number];
|
|
6
|
+
export const create_window: (a: number, b: number, c: any) => number;
|
|
7
|
+
export const destroy_window: (a: number) => [number, number];
|
|
8
|
+
export const read_camera_pos: (a: number) => [number, number, number];
|
|
9
|
+
export const register_asset_decoder: (a: any) => void;
|
|
10
|
+
export const register_event_listener: (a: any) => void;
|
|
11
|
+
export const set_gpu_memory_budget_mb: (a: number, b: number) => [number, number];
|
|
12
|
+
export const set_north_correction: (a: number, b: number) => [number, number];
|
|
13
|
+
export const set_render_quality: (a: number, b: any) => [number, number];
|
|
14
|
+
export const set_route_highlight: (a: number, b: number, c: number, d: number) => [number, number];
|
|
15
|
+
export const set_route_visible: (a: number, b: number, c: number, d: number) => [number, number];
|
|
16
|
+
export const set_sun_properties: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
17
|
+
export const set_window_action: (a: number, b: any) => [number, number];
|
|
18
|
+
export const set_window_scale: (a: number, b: number) => [number, number];
|
|
19
|
+
export const run: () => void;
|
|
20
|
+
export const wasm_bindgen__closure__destroy__h0f9502aef9ad7012: (a: number, b: number) => void;
|
|
21
|
+
export const wasm_bindgen__closure__destroy__h756fff185ea9610f: (a: number, b: number) => void;
|
|
22
|
+
export const wasm_bindgen__convert__closures_____invoke__h9bcfaf9db4ab96db: (a: number, b: number, c: any, d: any) => void;
|
|
23
|
+
export const wasm_bindgen__convert__closures_____invoke__h355f794c725ec492: (a: number, b: number, c: any) => void;
|
|
24
|
+
export const wasm_bindgen__convert__closures_____invoke__h11a2876e668b0630: (a: number, b: number, c: any) => void;
|
|
25
|
+
export const wasm_bindgen__convert__closures_____invoke__h81c46bf303557186: (a: number, b: number) => void;
|
|
26
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
27
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
|
+
export const __externref_table_alloc: () => number;
|
|
29
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
30
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
31
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
32
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
33
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function decode_sbo(data: Uint8Array): Uint8Array;
|
|
5
|
+
|
|
6
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
7
|
+
|
|
8
|
+
export interface InitOutput {
|
|
9
|
+
readonly memory: WebAssembly.Memory;
|
|
10
|
+
readonly decode_sbo: (a: number, b: number) => [number, number, number];
|
|
11
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
12
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
13
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
14
|
+
readonly __wbindgen_start: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
21
|
+
* a precompiled `WebAssembly.Module`.
|
|
22
|
+
*
|
|
23
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
24
|
+
*
|
|
25
|
+
* @returns {InitOutput}
|
|
26
|
+
*/
|
|
27
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
31
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
32
|
+
*
|
|
33
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
34
|
+
*
|
|
35
|
+
* @returns {Promise<InitOutput>}
|
|
36
|
+
*/
|
|
37
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/* @ts-self-types="./wasm_sbo_decode.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {Uint8Array} data
|
|
5
|
+
* @returns {Uint8Array}
|
|
6
|
+
*/
|
|
7
|
+
export function decode_sbo(data) {
|
|
8
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
9
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10
|
+
const ret = wasm.decode_sbo(ptr0, len0);
|
|
11
|
+
if (ret[2]) {
|
|
12
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
13
|
+
}
|
|
14
|
+
return takeFromExternrefTable0(ret[0]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function __wbg_get_imports() {
|
|
18
|
+
const import0 = {
|
|
19
|
+
__proto__: null,
|
|
20
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
21
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
22
|
+
},
|
|
23
|
+
__wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
|
|
24
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
25
|
+
return ret;
|
|
26
|
+
},
|
|
27
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
28
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
29
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
30
|
+
return ret;
|
|
31
|
+
},
|
|
32
|
+
__wbindgen_init_externref_table: function() {
|
|
33
|
+
const table = wasm.__wbindgen_externrefs;
|
|
34
|
+
const offset = table.grow(4);
|
|
35
|
+
table.set(0, undefined);
|
|
36
|
+
table.set(offset + 0, undefined);
|
|
37
|
+
table.set(offset + 1, null);
|
|
38
|
+
table.set(offset + 2, true);
|
|
39
|
+
table.set(offset + 3, false);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
__proto__: null,
|
|
44
|
+
"./wasm_sbo_decode_bg.js": import0,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
49
|
+
ptr = ptr >>> 0;
|
|
50
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getStringFromWasm0(ptr, len) {
|
|
54
|
+
ptr = ptr >>> 0;
|
|
55
|
+
return decodeText(ptr, len);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let cachedUint8ArrayMemory0 = null;
|
|
59
|
+
function getUint8ArrayMemory0() {
|
|
60
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
61
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
62
|
+
}
|
|
63
|
+
return cachedUint8ArrayMemory0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
67
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
68
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
69
|
+
WASM_VECTOR_LEN = arg.length;
|
|
70
|
+
return ptr;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function takeFromExternrefTable0(idx) {
|
|
74
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
75
|
+
wasm.__externref_table_dealloc(idx);
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
80
|
+
cachedTextDecoder.decode();
|
|
81
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
82
|
+
let numBytesDecoded = 0;
|
|
83
|
+
function decodeText(ptr, len) {
|
|
84
|
+
numBytesDecoded += len;
|
|
85
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
86
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
87
|
+
cachedTextDecoder.decode();
|
|
88
|
+
numBytesDecoded = len;
|
|
89
|
+
}
|
|
90
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
let WASM_VECTOR_LEN = 0;
|
|
94
|
+
|
|
95
|
+
let wasmModule, wasm;
|
|
96
|
+
function __wbg_finalize_init(instance, module) {
|
|
97
|
+
wasm = instance.exports;
|
|
98
|
+
wasmModule = module;
|
|
99
|
+
cachedUint8ArrayMemory0 = null;
|
|
100
|
+
wasm.__wbindgen_start();
|
|
101
|
+
return wasm;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function __wbg_load(module, imports) {
|
|
105
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
106
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
107
|
+
try {
|
|
108
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
111
|
+
|
|
112
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
113
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
114
|
+
|
|
115
|
+
} else { throw e; }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const bytes = await module.arrayBuffer();
|
|
120
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
121
|
+
} else {
|
|
122
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
123
|
+
|
|
124
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
125
|
+
return { instance, module };
|
|
126
|
+
} else {
|
|
127
|
+
return instance;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function expectedResponseType(type) {
|
|
132
|
+
switch (type) {
|
|
133
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function initSync(module) {
|
|
140
|
+
if (wasm !== undefined) return wasm;
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
if (module !== undefined) {
|
|
144
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
145
|
+
({module} = module)
|
|
146
|
+
} else {
|
|
147
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const imports = __wbg_get_imports();
|
|
152
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
153
|
+
module = new WebAssembly.Module(module);
|
|
154
|
+
}
|
|
155
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
156
|
+
return __wbg_finalize_init(instance, module);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function __wbg_init(module_or_path) {
|
|
160
|
+
if (wasm !== undefined) return wasm;
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
if (module_or_path !== undefined) {
|
|
164
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
165
|
+
({module_or_path} = module_or_path)
|
|
166
|
+
} else {
|
|
167
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (module_or_path === undefined) {
|
|
172
|
+
module_or_path = new URL('wasm_sbo_decode_bg.wasm', import.meta.url);
|
|
173
|
+
}
|
|
174
|
+
const imports = __wbg_get_imports();
|
|
175
|
+
|
|
176
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
177
|
+
module_or_path = fetch(module_or_path);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
181
|
+
|
|
182
|
+
return __wbg_finalize_init(instance, module);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const decode_sbo: (a: number, b: number) => [number, number, number];
|
|
5
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
6
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
7
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
8
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decodeWorkerImpl.d.ts","sourceRoot":"","sources":["../../src/worker/decodeWorkerImpl.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,QA8EpE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class WorkerPool<Request, Response> {
|
|
2
|
+
private workers;
|
|
3
|
+
private idle;
|
|
4
|
+
private queue;
|
|
5
|
+
constructor(workerFactory: () => Worker, num: number);
|
|
6
|
+
run(request: Request): Promise<Response>;
|
|
7
|
+
private dispatch;
|
|
8
|
+
private release;
|
|
9
|
+
terminate(): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/worker/pool.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU,CAAC,OAAO,EAAE,QAAQ;IACvC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,KAAK,CAIL;gBAEI,aAAa,EAAE,MAAM,MAAM,EAAE,GAAG,EAAE,MAAM;IAKpD,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAWxC,OAAO,CAAC,QAAQ;IA4BhB,OAAO,CAAC,OAAO;IASR,SAAS;CAKjB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sanox/sangine-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Sangine core renderer runtime (WASM + workers)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"main": "./dist/index.cjs.js",
|
|
17
|
+
"module": "./dist/index.es.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@eslint/js": "^9.39.2",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
25
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
26
|
+
"eslint": "^9.39.2",
|
|
27
|
+
"eslint-config-prettier": "^10.1.8",
|
|
28
|
+
"eslint-plugin-import": "^2.32.0",
|
|
29
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
30
|
+
"json-schema-to-typescript": "^15.0.4",
|
|
31
|
+
"prettier": "^3.7.4",
|
|
32
|
+
"typescript": "^5.4.0",
|
|
33
|
+
"vite": "^5.0.0",
|
|
34
|
+
"vite-tsconfig-paths": "^6.0.3"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build:wasm": "./build-sangine.sh && ./build-workers.sh",
|
|
38
|
+
"build:wasm-dev": "./build-sangine.sh --dev && ./build-workers.sh --dev",
|
|
39
|
+
"build:js": "./build-types.sh && vite build && tsc --emitDeclarationOnly",
|
|
40
|
+
"build": "./build-sangine.sh && ./build-workers.sh && ./build-types.sh && vite build && tsc --emitDeclarationOnly",
|
|
41
|
+
"clean": "rm -rf dist",
|
|
42
|
+
"dev": "vite build --watch",
|
|
43
|
+
"typecheck": "tsc --noEmit",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"lint:fix": "eslint --fix .",
|
|
46
|
+
"format": "prettier --write .",
|
|
47
|
+
"format:check": "prettier --check ."
|
|
48
|
+
}
|
|
49
|
+
}
|