@multiplekex/shallot 0.1.10 → 0.1.11
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/package.json +1 -1
- package/rust/transforms/pkg/package.json +15 -0
- package/rust/transforms/pkg/shallot_transforms.d.ts +81 -0
- package/rust/transforms/pkg/shallot_transforms.js +229 -0
- package/rust/transforms/pkg/shallot_transforms_bg.wasm +0 -0
- package/rust/transforms/pkg/shallot_transforms_bg.wasm.d.ts +20 -0
- package/src/core/runtime.ts +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shallot-transforms",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"files": [
|
|
6
|
+
"shallot_transforms_bg.wasm",
|
|
7
|
+
"shallot_transforms.js",
|
|
8
|
+
"shallot_transforms.d.ts"
|
|
9
|
+
],
|
|
10
|
+
"main": "shallot_transforms.js",
|
|
11
|
+
"types": "shallot_transforms.d.ts",
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"./snippets/*"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function compute_transforms(count: number): void;
|
|
5
|
+
|
|
6
|
+
export function get_indices_ptr(): number;
|
|
7
|
+
|
|
8
|
+
export function get_matrices_ptr(): number;
|
|
9
|
+
|
|
10
|
+
export function get_max_entities(): number;
|
|
11
|
+
|
|
12
|
+
export function get_no_parent(): number;
|
|
13
|
+
|
|
14
|
+
export function get_parents_ptr(): number;
|
|
15
|
+
|
|
16
|
+
export function get_pos_x_ptr(): number;
|
|
17
|
+
|
|
18
|
+
export function get_pos_y_ptr(): number;
|
|
19
|
+
|
|
20
|
+
export function get_pos_z_ptr(): number;
|
|
21
|
+
|
|
22
|
+
export function get_quat_w_ptr(): number;
|
|
23
|
+
|
|
24
|
+
export function get_quat_x_ptr(): number;
|
|
25
|
+
|
|
26
|
+
export function get_quat_y_ptr(): number;
|
|
27
|
+
|
|
28
|
+
export function get_quat_z_ptr(): number;
|
|
29
|
+
|
|
30
|
+
export function get_scale_x_ptr(): number;
|
|
31
|
+
|
|
32
|
+
export function get_scale_y_ptr(): number;
|
|
33
|
+
|
|
34
|
+
export function get_scale_z_ptr(): number;
|
|
35
|
+
|
|
36
|
+
export function init_data(): void;
|
|
37
|
+
|
|
38
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
39
|
+
|
|
40
|
+
export interface InitOutput {
|
|
41
|
+
readonly memory: WebAssembly.Memory;
|
|
42
|
+
readonly compute_transforms: (a: number) => void;
|
|
43
|
+
readonly get_indices_ptr: () => number;
|
|
44
|
+
readonly get_matrices_ptr: () => number;
|
|
45
|
+
readonly get_max_entities: () => number;
|
|
46
|
+
readonly get_no_parent: () => number;
|
|
47
|
+
readonly get_parents_ptr: () => number;
|
|
48
|
+
readonly get_pos_x_ptr: () => number;
|
|
49
|
+
readonly get_pos_y_ptr: () => number;
|
|
50
|
+
readonly get_pos_z_ptr: () => number;
|
|
51
|
+
readonly get_quat_w_ptr: () => number;
|
|
52
|
+
readonly get_quat_x_ptr: () => number;
|
|
53
|
+
readonly get_quat_y_ptr: () => number;
|
|
54
|
+
readonly get_quat_z_ptr: () => number;
|
|
55
|
+
readonly get_scale_x_ptr: () => number;
|
|
56
|
+
readonly get_scale_y_ptr: () => number;
|
|
57
|
+
readonly get_scale_z_ptr: () => number;
|
|
58
|
+
readonly init_data: () => void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
65
|
+
* a precompiled `WebAssembly.Module`.
|
|
66
|
+
*
|
|
67
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
68
|
+
*
|
|
69
|
+
* @returns {InitOutput}
|
|
70
|
+
*/
|
|
71
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
75
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
76
|
+
*
|
|
77
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
78
|
+
*
|
|
79
|
+
* @returns {Promise<InitOutput>}
|
|
80
|
+
*/
|
|
81
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {number} count
|
|
5
|
+
*/
|
|
6
|
+
export function compute_transforms(count) {
|
|
7
|
+
wasm.compute_transforms(count);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
export function get_indices_ptr() {
|
|
14
|
+
const ret = wasm.get_indices_ptr();
|
|
15
|
+
return ret >>> 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @returns {number}
|
|
20
|
+
*/
|
|
21
|
+
export function get_matrices_ptr() {
|
|
22
|
+
const ret = wasm.get_matrices_ptr();
|
|
23
|
+
return ret >>> 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @returns {number}
|
|
28
|
+
*/
|
|
29
|
+
export function get_max_entities() {
|
|
30
|
+
const ret = wasm.get_max_entities();
|
|
31
|
+
return ret >>> 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @returns {number}
|
|
36
|
+
*/
|
|
37
|
+
export function get_no_parent() {
|
|
38
|
+
const ret = wasm.get_no_parent();
|
|
39
|
+
return ret >>> 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @returns {number}
|
|
44
|
+
*/
|
|
45
|
+
export function get_parents_ptr() {
|
|
46
|
+
const ret = wasm.get_parents_ptr();
|
|
47
|
+
return ret >>> 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @returns {number}
|
|
52
|
+
*/
|
|
53
|
+
export function get_pos_x_ptr() {
|
|
54
|
+
const ret = wasm.get_pos_x_ptr();
|
|
55
|
+
return ret >>> 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @returns {number}
|
|
60
|
+
*/
|
|
61
|
+
export function get_pos_y_ptr() {
|
|
62
|
+
const ret = wasm.get_pos_y_ptr();
|
|
63
|
+
return ret >>> 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @returns {number}
|
|
68
|
+
*/
|
|
69
|
+
export function get_pos_z_ptr() {
|
|
70
|
+
const ret = wasm.get_pos_z_ptr();
|
|
71
|
+
return ret >>> 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @returns {number}
|
|
76
|
+
*/
|
|
77
|
+
export function get_quat_w_ptr() {
|
|
78
|
+
const ret = wasm.get_quat_w_ptr();
|
|
79
|
+
return ret >>> 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @returns {number}
|
|
84
|
+
*/
|
|
85
|
+
export function get_quat_x_ptr() {
|
|
86
|
+
const ret = wasm.get_quat_x_ptr();
|
|
87
|
+
return ret >>> 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @returns {number}
|
|
92
|
+
*/
|
|
93
|
+
export function get_quat_y_ptr() {
|
|
94
|
+
const ret = wasm.get_quat_y_ptr();
|
|
95
|
+
return ret >>> 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @returns {number}
|
|
100
|
+
*/
|
|
101
|
+
export function get_quat_z_ptr() {
|
|
102
|
+
const ret = wasm.get_quat_z_ptr();
|
|
103
|
+
return ret >>> 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @returns {number}
|
|
108
|
+
*/
|
|
109
|
+
export function get_scale_x_ptr() {
|
|
110
|
+
const ret = wasm.get_scale_x_ptr();
|
|
111
|
+
return ret >>> 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @returns {number}
|
|
116
|
+
*/
|
|
117
|
+
export function get_scale_y_ptr() {
|
|
118
|
+
const ret = wasm.get_scale_y_ptr();
|
|
119
|
+
return ret >>> 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @returns {number}
|
|
124
|
+
*/
|
|
125
|
+
export function get_scale_z_ptr() {
|
|
126
|
+
const ret = wasm.get_scale_z_ptr();
|
|
127
|
+
return ret >>> 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function init_data() {
|
|
131
|
+
wasm.init_data();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
135
|
+
|
|
136
|
+
async function __wbg_load(module, imports) {
|
|
137
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
138
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
139
|
+
try {
|
|
140
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
141
|
+
} catch (e) {
|
|
142
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
143
|
+
|
|
144
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
145
|
+
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);
|
|
146
|
+
|
|
147
|
+
} else {
|
|
148
|
+
throw e;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const bytes = await module.arrayBuffer();
|
|
154
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
155
|
+
} else {
|
|
156
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
157
|
+
|
|
158
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
159
|
+
return { instance, module };
|
|
160
|
+
} else {
|
|
161
|
+
return instance;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function __wbg_get_imports() {
|
|
167
|
+
const imports = {};
|
|
168
|
+
imports.wbg = {};
|
|
169
|
+
|
|
170
|
+
return imports;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function __wbg_finalize_init(instance, module) {
|
|
174
|
+
wasm = instance.exports;
|
|
175
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
return wasm;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function initSync(module) {
|
|
183
|
+
if (wasm !== undefined) return wasm;
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
if (typeof module !== 'undefined') {
|
|
187
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
188
|
+
({module} = module)
|
|
189
|
+
} else {
|
|
190
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const imports = __wbg_get_imports();
|
|
195
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
196
|
+
module = new WebAssembly.Module(module);
|
|
197
|
+
}
|
|
198
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
199
|
+
return __wbg_finalize_init(instance, module);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async function __wbg_init(module_or_path) {
|
|
203
|
+
if (wasm !== undefined) return wasm;
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if (typeof module_or_path !== 'undefined') {
|
|
207
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
208
|
+
({module_or_path} = module_or_path)
|
|
209
|
+
} else {
|
|
210
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (typeof module_or_path === 'undefined') {
|
|
215
|
+
module_or_path = new URL('shallot_transforms_bg.wasm', import.meta.url);
|
|
216
|
+
}
|
|
217
|
+
const imports = __wbg_get_imports();
|
|
218
|
+
|
|
219
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
220
|
+
module_or_path = fetch(module_or_path);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
224
|
+
|
|
225
|
+
return __wbg_finalize_init(instance, module);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { initSync };
|
|
229
|
+
export default __wbg_init;
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const compute_transforms: (a: number) => void;
|
|
5
|
+
export const get_indices_ptr: () => number;
|
|
6
|
+
export const get_matrices_ptr: () => number;
|
|
7
|
+
export const get_max_entities: () => number;
|
|
8
|
+
export const get_no_parent: () => number;
|
|
9
|
+
export const get_parents_ptr: () => number;
|
|
10
|
+
export const get_pos_x_ptr: () => number;
|
|
11
|
+
export const get_pos_y_ptr: () => number;
|
|
12
|
+
export const get_pos_z_ptr: () => number;
|
|
13
|
+
export const get_quat_w_ptr: () => number;
|
|
14
|
+
export const get_quat_x_ptr: () => number;
|
|
15
|
+
export const get_quat_y_ptr: () => number;
|
|
16
|
+
export const get_quat_z_ptr: () => number;
|
|
17
|
+
export const get_scale_x_ptr: () => number;
|
|
18
|
+
export const get_scale_y_ptr: () => number;
|
|
19
|
+
export const get_scale_z_ptr: () => number;
|
|
20
|
+
export const init_data: () => void;
|
package/src/core/runtime.ts
CHANGED
|
@@ -111,6 +111,7 @@ function createStandaloneRuntime(): Runtime {
|
|
|
111
111
|
}
|
|
112
112
|
return response.text();
|
|
113
113
|
}
|
|
114
|
+
// @ts-ignore - Tauri plugin only available in Tauri context
|
|
114
115
|
const { readTextFile } = await import(/* @vite-ignore */ "@tauri-apps/plugin-fs");
|
|
115
116
|
return readTextFile(path);
|
|
116
117
|
},
|
|
@@ -123,6 +124,7 @@ function createStandaloneRuntime(): Runtime {
|
|
|
123
124
|
}
|
|
124
125
|
return response.arrayBuffer();
|
|
125
126
|
}
|
|
127
|
+
// @ts-ignore - Tauri plugin only available in Tauri context
|
|
126
128
|
const { readFile } = await import(/* @vite-ignore */ "@tauri-apps/plugin-fs");
|
|
127
129
|
const bytes = await readFile(path);
|
|
128
130
|
return bytes.buffer;
|