@vincentt-xr/editor-engine 0.0.0-stage → 0.2.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/LICENSE +30 -0
- package/README.md +19 -2
- package/dist/index.d.ts +47 -0
- package/dist/index.js +116 -0
- package/dist/types.d.ts +123 -0
- package/package.json +38 -4
- package/pkg/editor_engine_wasm.d.ts +77 -0
- package/pkg/editor_engine_wasm.js +477 -0
- package/pkg/editor_engine_wasm_bg.wasm +0 -0
- package/pkg/editor_engine_wasm_bg.wasm.d.ts +23 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Copyright (c) 2026 Vincentt. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software and its accompanying files (the "Software") are proprietary to
|
|
4
|
+
Vincentt and are licensed, not sold.
|
|
5
|
+
|
|
6
|
+
You may install and run the Software only to build, preview, and publish
|
|
7
|
+
projects with Vincentt services, under the terms of service that govern your
|
|
8
|
+
use of those services.
|
|
9
|
+
|
|
10
|
+
You may not, except where applicable law expressly permits it despite this
|
|
11
|
+
restriction:
|
|
12
|
+
|
|
13
|
+
1. copy, redistribute, sublicense, sell, or otherwise make the Software
|
|
14
|
+
available to any third party;
|
|
15
|
+
2. modify, adapt, translate, or create derivative works of the Software;
|
|
16
|
+
3. reverse engineer, decompile, or disassemble the Software, or attempt to
|
|
17
|
+
recover its source code;
|
|
18
|
+
4. use the Software with any service other than Vincentt services.
|
|
19
|
+
|
|
20
|
+
Projects you create with the Software belong to you. This license grants no
|
|
21
|
+
rights in the Software itself beyond those stated above.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
26
|
+
VINCENTT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
27
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
28
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
+
|
|
30
|
+
Contact: hello@vincentt.studio
|
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vincentt-xr/editor-engine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Vincentt editor's write-back engine compiled to WebAssembly, with typed ES module access. It is
|
|
4
|
+
consumed by the Vincentt console at an exact version; it is not meant to be imported by apps.
|
|
5
|
+
|
|
6
|
+
| File | What it is |
|
|
7
|
+
|---|---|
|
|
8
|
+
| `dist/index.js` | The binding: `initEngine`, `initEngineSync`, `EditorEngine`, `rebindValueKey`, `isWritableFile`, `EngineInputError`, `EngineCrashedError`. |
|
|
9
|
+
| `dist/index.d.ts`, `dist/types.d.ts` | Its types and the engine's JSON shapes. |
|
|
10
|
+
| `pkg/editor_engine_wasm.js` | The wasm-bindgen glue (`--target web`). |
|
|
11
|
+
| `pkg/editor_engine_wasm_bg.wasm` | The engine. Also exported as `@vincentt-xr/editor-engine/editor_engine_wasm_bg.wasm`. |
|
|
12
|
+
|
|
13
|
+
In a browser, `await initEngine()` fetches the `.wasm` beside the glue (a page CSP needs
|
|
14
|
+
`'wasm-unsafe-eval'`); pass a URL or bytes to load it from elsewhere. In Node or a worker,
|
|
15
|
+
`initEngineSync(bytes)`. Malformed input throws `EngineInputError` and leaves the instance usable;
|
|
16
|
+
any other failure throws `EngineCrashedError` on that call and every later one, and the instance
|
|
17
|
+
must be reloaded.
|
|
18
|
+
|
|
19
|
+
The package has no install scripts and no runtime dependencies. It is published from
|
|
20
|
+
`vincentt-xr/editor` by `.github/workflows/engine-publish.yml` through npm trusted publishing.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as wasm from "../pkg/editor_engine_wasm.js";
|
|
2
|
+
import type { EditResult, FileUpdate, SettingDecl, SettingsStatus, TweakableMap, Unanalysed, WriteRequest } from "./types.js";
|
|
3
|
+
export type * from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* The instance stopped in the middle of a call (call stack exhausted, or a trap). Its memory may
|
|
6
|
+
* be inconsistent, so every later call refuses; load a fresh instance (a page reload).
|
|
7
|
+
*/
|
|
8
|
+
export declare class EngineCrashedError extends Error {
|
|
9
|
+
constructor(cause: unknown);
|
|
10
|
+
}
|
|
11
|
+
/** The caller's input was malformed; the instance is unaffected. */
|
|
12
|
+
export declare class EngineInputError extends Error {
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
/** Loads the module. In a browser with no argument it fetches the `.wasm` beside this file. */
|
|
16
|
+
export declare function initEngine(input?: wasm.InitInput | Promise<wasm.InitInput>): Promise<void>;
|
|
17
|
+
/** Loads the module from bytes or a compiled module (Node, tests, workers). */
|
|
18
|
+
export declare function initEngineSync(module: BufferSource | WebAssembly.Module): void;
|
|
19
|
+
export declare class EditorEngine {
|
|
20
|
+
private readonly p;
|
|
21
|
+
private constructor();
|
|
22
|
+
/**
|
|
23
|
+
* `files`: root-relative posix paths to their contents. Files outside the writable set, over
|
|
24
|
+
* 2 MiB, or past 5000 files are ignored. `settings`: the SDK's `settings.json` text, if any.
|
|
25
|
+
*/
|
|
26
|
+
static open(files: Record<string, string>, settings?: string | null): EditorEngine;
|
|
27
|
+
map(): TweakableMap;
|
|
28
|
+
unanalysed(): Unanalysed[];
|
|
29
|
+
settingsStatus(): SettingsStatus;
|
|
30
|
+
/** A source stamp (1-based line, UTF-16 column) to the object key it belongs to. */
|
|
31
|
+
anchor(file: string, line: number, column: number): string | null;
|
|
32
|
+
/** Call when the frame loads a new generation of the code. */
|
|
33
|
+
resetRemaps(): void;
|
|
34
|
+
decl(id: string): SettingDecl | null;
|
|
35
|
+
computedExpression(valueKey: string): string | null;
|
|
36
|
+
/** The edit a write would make; the project is unchanged. */
|
|
37
|
+
plan(req: WriteRequest): EditResult;
|
|
38
|
+
/** As `plan`, and the edited text becomes the file's current content. */
|
|
39
|
+
apply(req: WriteRequest): EditResult;
|
|
40
|
+
/** Replaces one file with what the source holds now (`null`: the file is gone). */
|
|
41
|
+
setFile(file: string, text: string | null): FileUpdate;
|
|
42
|
+
free(): void;
|
|
43
|
+
}
|
|
44
|
+
/** A `"<object key>:<path>"` held across `setFile`; null when its object no longer resolves. */
|
|
45
|
+
export declare function rebindValueKey(valueKey: string, update: FileUpdate): string | null;
|
|
46
|
+
/** The writable-file allowlist (security F5) the engine applies. */
|
|
47
|
+
export declare function isWritableFile(rel: string): boolean;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Typed access to the write-back engine compiled to WebAssembly. Marshalling only: every decision
|
|
2
|
+
// is made by the Rust engine (editor-app/engine), the same code the desktop app links.
|
|
3
|
+
import init, * as wasm from "../pkg/editor_engine_wasm.js";
|
|
4
|
+
/**
|
|
5
|
+
* The instance stopped in the middle of a call (call stack exhausted, or a trap). Its memory may
|
|
6
|
+
* be inconsistent, so every later call refuses; load a fresh instance (a page reload).
|
|
7
|
+
*/
|
|
8
|
+
export class EngineCrashedError extends Error {
|
|
9
|
+
constructor(cause) {
|
|
10
|
+
super("editor engine instance crashed; reload it", { cause });
|
|
11
|
+
this.name = "EngineCrashedError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** The caller's input was malformed; the instance is unaffected. */
|
|
15
|
+
export class EngineInputError extends Error {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "EngineInputError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Must equal `INPUT_ERROR_PREFIX` in editor-app/engine-wasm/src/lib.rs. */
|
|
22
|
+
const INPUT_ERROR_PREFIX = "editor-engine input: ";
|
|
23
|
+
let crashed;
|
|
24
|
+
/**
|
|
25
|
+
* Runs one call into the module. Only the binding's own input errors pass through; any other
|
|
26
|
+
* exception (stack exhaustion is `RangeError` in V8 and JavaScriptCore but `InternalError` in
|
|
27
|
+
* Firefox; a trap is `WebAssembly.RuntimeError`) leaves the instance unusable.
|
|
28
|
+
*/
|
|
29
|
+
function guard(call) {
|
|
30
|
+
if (crashed !== undefined)
|
|
31
|
+
throw new EngineCrashedError(crashed);
|
|
32
|
+
try {
|
|
33
|
+
return call();
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
if (e instanceof Error && e.constructor === Error && e.message.startsWith(INPUT_ERROR_PREFIX)) {
|
|
37
|
+
throw new EngineInputError(e.message.slice(INPUT_ERROR_PREFIX.length));
|
|
38
|
+
}
|
|
39
|
+
crashed = e ?? new Error("unknown");
|
|
40
|
+
throw new EngineCrashedError(e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Loads the module. In a browser with no argument it fetches the `.wasm` beside this file. */
|
|
44
|
+
export async function initEngine(input) {
|
|
45
|
+
await init(input === undefined ? undefined : { module_or_path: input });
|
|
46
|
+
}
|
|
47
|
+
/** Loads the module from bytes or a compiled module (Node, tests, workers). */
|
|
48
|
+
export function initEngineSync(module) {
|
|
49
|
+
wasm.initSync({ module });
|
|
50
|
+
}
|
|
51
|
+
export class EditorEngine {
|
|
52
|
+
p;
|
|
53
|
+
constructor(p) {
|
|
54
|
+
this.p = p;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `files`: root-relative posix paths to their contents. Files outside the writable set, over
|
|
58
|
+
* 2 MiB, or past 5000 files are ignored. `settings`: the SDK's `settings.json` text, if any.
|
|
59
|
+
*/
|
|
60
|
+
static open(files, settings) {
|
|
61
|
+
const json = JSON.stringify(files);
|
|
62
|
+
return guard(() => new EditorEngine(new wasm.Project(json, settings ?? undefined)));
|
|
63
|
+
}
|
|
64
|
+
map() {
|
|
65
|
+
return guard(() => JSON.parse(this.p.map()));
|
|
66
|
+
}
|
|
67
|
+
unanalysed() {
|
|
68
|
+
return guard(() => JSON.parse(this.p.unanalysed()));
|
|
69
|
+
}
|
|
70
|
+
settingsStatus() {
|
|
71
|
+
return guard(() => JSON.parse(this.p.settingsStatus()));
|
|
72
|
+
}
|
|
73
|
+
/** A source stamp (1-based line, UTF-16 column) to the object key it belongs to. */
|
|
74
|
+
anchor(file, line, column) {
|
|
75
|
+
return guard(() => this.p.anchor(file, line, column) ?? null);
|
|
76
|
+
}
|
|
77
|
+
/** Call when the frame loads a new generation of the code. */
|
|
78
|
+
resetRemaps() {
|
|
79
|
+
guard(() => this.p.resetRemaps());
|
|
80
|
+
}
|
|
81
|
+
decl(id) {
|
|
82
|
+
return guard(() => {
|
|
83
|
+
const d = this.p.decl(id);
|
|
84
|
+
return d === undefined ? null : JSON.parse(d);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
computedExpression(valueKey) {
|
|
88
|
+
return guard(() => this.p.computedExpression(valueKey) ?? null);
|
|
89
|
+
}
|
|
90
|
+
/** The edit a write would make; the project is unchanged. */
|
|
91
|
+
plan(req) {
|
|
92
|
+
const json = JSON.stringify(req);
|
|
93
|
+
return guard(() => JSON.parse(this.p.plan(json)));
|
|
94
|
+
}
|
|
95
|
+
/** As `plan`, and the edited text becomes the file's current content. */
|
|
96
|
+
apply(req) {
|
|
97
|
+
const json = JSON.stringify(req);
|
|
98
|
+
return guard(() => JSON.parse(this.p.apply(json)));
|
|
99
|
+
}
|
|
100
|
+
/** Replaces one file with what the source holds now (`null`: the file is gone). */
|
|
101
|
+
setFile(file, text) {
|
|
102
|
+
return guard(() => JSON.parse(this.p.setFile(file, text ?? undefined)));
|
|
103
|
+
}
|
|
104
|
+
free() {
|
|
105
|
+
guard(() => this.p.free());
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** A `"<object key>:<path>"` held across `setFile`; null when its object no longer resolves. */
|
|
109
|
+
export function rebindValueKey(valueKey, update) {
|
|
110
|
+
const json = JSON.stringify(update);
|
|
111
|
+
return guard(() => wasm.rebindValueKey(valueKey, json) ?? null);
|
|
112
|
+
}
|
|
113
|
+
/** The writable-file allowlist (security F5) the engine applies. */
|
|
114
|
+
export function isWritableFile(rel) {
|
|
115
|
+
return guard(() => wasm.isWritableFile(rel));
|
|
116
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export type Json = null | boolean | number | string | Json[] | {
|
|
2
|
+
[k: string]: Json;
|
|
3
|
+
};
|
|
4
|
+
export type SettingType = "number" | "color" | "boolean" | "vec2" | "vec3" | "euler" | "enum";
|
|
5
|
+
export type Unit = "px" | "m" | "deg" | "rad" | "ratio";
|
|
6
|
+
export type ObjectKind = "host" | "sdk" | "component";
|
|
7
|
+
export type ReadonlyReason = "computed" | "imported" | "spread" | "conditional" | "outside_project" | "generated" | "unsupported";
|
|
8
|
+
export type RefusalReason = "invalid_value" | "outside_project" | "unresolvable" | "ambiguous" | "conflict" | "moved_on" | "verify_failed" | "write_failed" | "no_gesture";
|
|
9
|
+
/** Byte offsets into the UTF-8 text; 1-based line and UTF-16 column. */
|
|
10
|
+
export interface SourceRef {
|
|
11
|
+
file: string;
|
|
12
|
+
start: number;
|
|
13
|
+
end: number;
|
|
14
|
+
line: number;
|
|
15
|
+
column: number;
|
|
16
|
+
}
|
|
17
|
+
export interface Constraints {
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
step?: number;
|
|
21
|
+
unit?: Unit;
|
|
22
|
+
}
|
|
23
|
+
export interface TweakValue {
|
|
24
|
+
/** `"position"`, `"position.1"`, `"screenTransform.position.x"` */
|
|
25
|
+
path: string;
|
|
26
|
+
type: SettingType;
|
|
27
|
+
value: Json;
|
|
28
|
+
editable: true | {
|
|
29
|
+
readonly: ReadonlyReason;
|
|
30
|
+
};
|
|
31
|
+
constraints?: Constraints;
|
|
32
|
+
/** `"@vincentt-xr/sdk:ScreenText.fontSize"` */
|
|
33
|
+
decl?: string;
|
|
34
|
+
source?: SourceRef;
|
|
35
|
+
sharedBy?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface TweakObject {
|
|
38
|
+
key: string;
|
|
39
|
+
/** From the static parse: control, bidi and ANSI characters stripped, at most 80 characters. */
|
|
40
|
+
label: string;
|
|
41
|
+
kind: ObjectKind;
|
|
42
|
+
type: string;
|
|
43
|
+
source: SourceRef;
|
|
44
|
+
parent?: string;
|
|
45
|
+
values: TweakValue[];
|
|
46
|
+
}
|
|
47
|
+
export interface TweakableMap {
|
|
48
|
+
schema: "vincentt.tweakables/1";
|
|
49
|
+
objects: TweakObject[];
|
|
50
|
+
}
|
|
51
|
+
export interface SettingDecl {
|
|
52
|
+
type: SettingType;
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
step?: number;
|
|
56
|
+
unit?: Unit;
|
|
57
|
+
enum?: string[];
|
|
58
|
+
default?: Json;
|
|
59
|
+
label?: string;
|
|
60
|
+
}
|
|
61
|
+
export type SettingsStatus = {
|
|
62
|
+
status: "loaded";
|
|
63
|
+
version: string;
|
|
64
|
+
} | {
|
|
65
|
+
status: "missing";
|
|
66
|
+
} | {
|
|
67
|
+
status: "unknownSchema";
|
|
68
|
+
detail: string;
|
|
69
|
+
} | {
|
|
70
|
+
status: "invalid";
|
|
71
|
+
detail: string;
|
|
72
|
+
};
|
|
73
|
+
export interface Unanalysed {
|
|
74
|
+
file: string;
|
|
75
|
+
/** `too_deep_for_browser`: wasm only; the file would need more call stack than a browser gives. */
|
|
76
|
+
reason: "syntax_error" | "too_deeply_nested" | "too_deep_for_browser" | "map_budget" | "project_map_budget" | "analysis_failed";
|
|
77
|
+
}
|
|
78
|
+
export type Precision = "typed" | {
|
|
79
|
+
step: number;
|
|
80
|
+
};
|
|
81
|
+
export interface WriteRequest {
|
|
82
|
+
/** `"<object key>:<path>"`, from the map. */
|
|
83
|
+
valueKey: string;
|
|
84
|
+
value: Json;
|
|
85
|
+
precision: Precision;
|
|
86
|
+
/**
|
|
87
|
+
* Required (D-S1): the value (or literal text) the edit started from, never null. A source that
|
|
88
|
+
* no longer holds it is `conflict`.
|
|
89
|
+
*/
|
|
90
|
+
started: Exclude<Json, null>;
|
|
91
|
+
/**
|
|
92
|
+
* A literal reached through a const that other code also reads is not written there: this use
|
|
93
|
+
* takes its own copy of the const, in place, with the new value. A const that is not plain
|
|
94
|
+
* literals is refused; one read only by this use is edited where it is.
|
|
95
|
+
*/
|
|
96
|
+
inline?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface Edit {
|
|
99
|
+
result: "edit";
|
|
100
|
+
valueKey: string;
|
|
101
|
+
file: string;
|
|
102
|
+
/** The literal's text before and after. Equal when the value is already written. */
|
|
103
|
+
before: string;
|
|
104
|
+
after: string;
|
|
105
|
+
beforeValue: Json;
|
|
106
|
+
afterValue: Json;
|
|
107
|
+
/** Where the literal sat before the edit. */
|
|
108
|
+
range: SourceRef;
|
|
109
|
+
/** The whole file after the edit. */
|
|
110
|
+
text: string;
|
|
111
|
+
}
|
|
112
|
+
export interface Refused {
|
|
113
|
+
result: "refused";
|
|
114
|
+
valueKey: string;
|
|
115
|
+
reason: RefusalReason;
|
|
116
|
+
}
|
|
117
|
+
export type EditResult = Edit | Refused;
|
|
118
|
+
export interface FileUpdate {
|
|
119
|
+
/** [old, new] object keys that re-bound to a different key. */
|
|
120
|
+
rebinds: [string, string][];
|
|
121
|
+
/** Object keys of the file's old parse that no longer resolve. */
|
|
122
|
+
removed: string[];
|
|
123
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincentt-xr/editor-engine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "The Vincentt editor's write-back engine compiled to WebAssembly, for the Vincentt console",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/vincentt-xr/editor.git",
|
|
11
|
+
"directory": "editor-engine"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/index.js",
|
|
18
|
+
"dist/index.d.ts",
|
|
19
|
+
"dist/types.d.ts",
|
|
20
|
+
"pkg/editor_engine_wasm.js",
|
|
21
|
+
"pkg/editor_engine_wasm.d.ts",
|
|
22
|
+
"pkg/editor_engine_wasm_bg.wasm",
|
|
23
|
+
"pkg/editor_engine_wasm_bg.wasm.d.ts",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./editor_engine_wasm_bg.wasm": "./pkg/editor_engine_wasm_bg.wasm",
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "node build.mjs && tsc -p tsconfig.build.json",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"test": "vitest run"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class Project {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
anchor(file: string, line: number, column: number): string | undefined;
|
|
8
|
+
apply(request_json: string): string;
|
|
9
|
+
computedExpression(value_key: string): string | undefined;
|
|
10
|
+
decl(id: string): string | undefined;
|
|
11
|
+
map(): string;
|
|
12
|
+
/**
|
|
13
|
+
* `files_json`: `{"<root-relative path>": "<content>", ...}`. `settings`: the SDK's
|
|
14
|
+
* `settings.json` text, if any.
|
|
15
|
+
*/
|
|
16
|
+
constructor(files_json: string, settings?: string | null);
|
|
17
|
+
plan(request_json: string): string;
|
|
18
|
+
resetRemaps(): void;
|
|
19
|
+
setFile(file: string, text?: string | null): string;
|
|
20
|
+
settingsStatus(): string;
|
|
21
|
+
unanalysed(): string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The writable-file allowlist (security F5) the engine applies.
|
|
26
|
+
*/
|
|
27
|
+
export function isWritableFile(rel: string): boolean;
|
|
28
|
+
|
|
29
|
+
export function rebindValueKey(value_key: string, update_json: string): string | undefined;
|
|
30
|
+
|
|
31
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
32
|
+
|
|
33
|
+
export interface InitOutput {
|
|
34
|
+
readonly memory: WebAssembly.Memory;
|
|
35
|
+
readonly __wbg_project_free: (a: number, b: number) => void;
|
|
36
|
+
readonly isWritableFile: (a: number, b: number) => number;
|
|
37
|
+
readonly project_anchor: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
38
|
+
readonly project_apply: (a: number, b: number, c: number) => [number, number, number, number];
|
|
39
|
+
readonly project_computedExpression: (a: number, b: number, c: number) => [number, number];
|
|
40
|
+
readonly project_decl: (a: number, b: number, c: number) => [number, number];
|
|
41
|
+
readonly project_map: (a: number) => [number, number];
|
|
42
|
+
readonly project_new: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
43
|
+
readonly project_plan: (a: number, b: number, c: number) => [number, number, number, number];
|
|
44
|
+
readonly project_resetRemaps: (a: number) => void;
|
|
45
|
+
readonly project_setFile: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
46
|
+
readonly project_settingsStatus: (a: number) => [number, number];
|
|
47
|
+
readonly project_unanalysed: (a: number) => [number, number];
|
|
48
|
+
readonly rebindValueKey: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
49
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
50
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
51
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
52
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
53
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
54
|
+
readonly __wbindgen_start: () => void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
61
|
+
* a precompiled `WebAssembly.Module`.
|
|
62
|
+
*
|
|
63
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
64
|
+
*
|
|
65
|
+
* @returns {InitOutput}
|
|
66
|
+
*/
|
|
67
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
71
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
72
|
+
*
|
|
73
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
74
|
+
*
|
|
75
|
+
* @returns {Promise<InitOutput>}
|
|
76
|
+
*/
|
|
77
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
/* @ts-self-types="./editor_engine_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class Project {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
ProjectFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_project_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} file
|
|
16
|
+
* @param {number} line
|
|
17
|
+
* @param {number} column
|
|
18
|
+
* @returns {string | undefined}
|
|
19
|
+
*/
|
|
20
|
+
anchor(file, line, column) {
|
|
21
|
+
const val2 = +line;
|
|
22
|
+
const val3 = +column;
|
|
23
|
+
const ptr0 = passStringToWasm0(file, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
24
|
+
const len0 = WASM_VECTOR_LEN;
|
|
25
|
+
const ret = wasm.project_anchor(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
26
|
+
let v4;
|
|
27
|
+
if (ret[0] !== 0) {
|
|
28
|
+
v4 = getStringFromWasm0(ret[0], ret[1]);
|
|
29
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
30
|
+
}
|
|
31
|
+
return v4;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} request_json
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
37
|
+
apply(request_json) {
|
|
38
|
+
let deferred3_0;
|
|
39
|
+
let deferred3_1;
|
|
40
|
+
try {
|
|
41
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
42
|
+
const len0 = WASM_VECTOR_LEN;
|
|
43
|
+
const ret = wasm.project_apply(this.__wbg_ptr, ptr0, len0);
|
|
44
|
+
var ptr2 = ret[0];
|
|
45
|
+
var len2 = ret[1];
|
|
46
|
+
if (ret[3]) {
|
|
47
|
+
ptr2 = 0; len2 = 0;
|
|
48
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
49
|
+
}
|
|
50
|
+
deferred3_0 = ptr2;
|
|
51
|
+
deferred3_1 = len2;
|
|
52
|
+
return getStringFromWasm0(ptr2, len2);
|
|
53
|
+
} finally {
|
|
54
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @param {string} value_key
|
|
59
|
+
* @returns {string | undefined}
|
|
60
|
+
*/
|
|
61
|
+
computedExpression(value_key) {
|
|
62
|
+
const ptr0 = passStringToWasm0(value_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
63
|
+
const len0 = WASM_VECTOR_LEN;
|
|
64
|
+
const ret = wasm.project_computedExpression(this.__wbg_ptr, ptr0, len0);
|
|
65
|
+
let v2;
|
|
66
|
+
if (ret[0] !== 0) {
|
|
67
|
+
v2 = getStringFromWasm0(ret[0], ret[1]);
|
|
68
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
69
|
+
}
|
|
70
|
+
return v2;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param {string} id
|
|
74
|
+
* @returns {string | undefined}
|
|
75
|
+
*/
|
|
76
|
+
decl(id) {
|
|
77
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
78
|
+
const len0 = WASM_VECTOR_LEN;
|
|
79
|
+
const ret = wasm.project_decl(this.__wbg_ptr, ptr0, len0);
|
|
80
|
+
let v2;
|
|
81
|
+
if (ret[0] !== 0) {
|
|
82
|
+
v2 = getStringFromWasm0(ret[0], ret[1]);
|
|
83
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
84
|
+
}
|
|
85
|
+
return v2;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @returns {string}
|
|
89
|
+
*/
|
|
90
|
+
map() {
|
|
91
|
+
let deferred1_0;
|
|
92
|
+
let deferred1_1;
|
|
93
|
+
try {
|
|
94
|
+
const ret = wasm.project_map(this.__wbg_ptr);
|
|
95
|
+
deferred1_0 = ret[0];
|
|
96
|
+
deferred1_1 = ret[1];
|
|
97
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
98
|
+
} finally {
|
|
99
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* `files_json`: `{"<root-relative path>": "<content>", ...}`. `settings`: the SDK's
|
|
104
|
+
* `settings.json` text, if any.
|
|
105
|
+
* @param {string} files_json
|
|
106
|
+
* @param {string | null} [settings]
|
|
107
|
+
*/
|
|
108
|
+
constructor(files_json, settings) {
|
|
109
|
+
let ptr0, len0, ptr1, len1;
|
|
110
|
+
try {
|
|
111
|
+
ptr0 = passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
112
|
+
len0 = WASM_VECTOR_LEN;
|
|
113
|
+
ptr1 = isLikeNone(settings) ? 0 : passStringToWasm0(settings, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
114
|
+
len1 = WASM_VECTOR_LEN;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
117
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
118
|
+
throw e;
|
|
119
|
+
}
|
|
120
|
+
const ret = wasm.project_new(ptr0, len0, ptr1, len1);
|
|
121
|
+
if (ret[2]) {
|
|
122
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
123
|
+
}
|
|
124
|
+
this.__wbg_ptr = ret[0];
|
|
125
|
+
ProjectFinalization.register(this, this.__wbg_ptr, this);
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @param {string} request_json
|
|
130
|
+
* @returns {string}
|
|
131
|
+
*/
|
|
132
|
+
plan(request_json) {
|
|
133
|
+
let deferred3_0;
|
|
134
|
+
let deferred3_1;
|
|
135
|
+
try {
|
|
136
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
137
|
+
const len0 = WASM_VECTOR_LEN;
|
|
138
|
+
const ret = wasm.project_plan(this.__wbg_ptr, ptr0, len0);
|
|
139
|
+
var ptr2 = ret[0];
|
|
140
|
+
var len2 = ret[1];
|
|
141
|
+
if (ret[3]) {
|
|
142
|
+
ptr2 = 0; len2 = 0;
|
|
143
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
144
|
+
}
|
|
145
|
+
deferred3_0 = ptr2;
|
|
146
|
+
deferred3_1 = len2;
|
|
147
|
+
return getStringFromWasm0(ptr2, len2);
|
|
148
|
+
} finally {
|
|
149
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
resetRemaps() {
|
|
153
|
+
wasm.project_resetRemaps(this.__wbg_ptr);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @param {string} file
|
|
157
|
+
* @param {string | null} [text]
|
|
158
|
+
* @returns {string}
|
|
159
|
+
*/
|
|
160
|
+
setFile(file, text) {
|
|
161
|
+
let deferred3_0;
|
|
162
|
+
let deferred3_1;
|
|
163
|
+
try {
|
|
164
|
+
let ptr0, len0, ptr1, len1;
|
|
165
|
+
try {
|
|
166
|
+
ptr0 = passStringToWasm0(file, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
167
|
+
len0 = WASM_VECTOR_LEN;
|
|
168
|
+
ptr1 = isLikeNone(text) ? 0 : passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
169
|
+
len1 = WASM_VECTOR_LEN;
|
|
170
|
+
} catch (e) {
|
|
171
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
172
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
173
|
+
throw e;
|
|
174
|
+
}
|
|
175
|
+
const ret = wasm.project_setFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
176
|
+
deferred3_0 = ret[0];
|
|
177
|
+
deferred3_1 = ret[1];
|
|
178
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
179
|
+
} finally {
|
|
180
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @returns {string}
|
|
185
|
+
*/
|
|
186
|
+
settingsStatus() {
|
|
187
|
+
let deferred1_0;
|
|
188
|
+
let deferred1_1;
|
|
189
|
+
try {
|
|
190
|
+
const ret = wasm.project_settingsStatus(this.__wbg_ptr);
|
|
191
|
+
deferred1_0 = ret[0];
|
|
192
|
+
deferred1_1 = ret[1];
|
|
193
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
194
|
+
} finally {
|
|
195
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @returns {string}
|
|
200
|
+
*/
|
|
201
|
+
unanalysed() {
|
|
202
|
+
let deferred1_0;
|
|
203
|
+
let deferred1_1;
|
|
204
|
+
try {
|
|
205
|
+
const ret = wasm.project_unanalysed(this.__wbg_ptr);
|
|
206
|
+
deferred1_0 = ret[0];
|
|
207
|
+
deferred1_1 = ret[1];
|
|
208
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
209
|
+
} finally {
|
|
210
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (Symbol.dispose) Project.prototype[Symbol.dispose] = Project.prototype.free;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The writable-file allowlist (security F5) the engine applies.
|
|
218
|
+
* @param {string} rel
|
|
219
|
+
* @returns {boolean}
|
|
220
|
+
*/
|
|
221
|
+
export function isWritableFile(rel) {
|
|
222
|
+
const ptr0 = passStringToWasm0(rel, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
223
|
+
const len0 = WASM_VECTOR_LEN;
|
|
224
|
+
const ret = wasm.isWritableFile(ptr0, len0);
|
|
225
|
+
return ret !== 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @param {string} value_key
|
|
230
|
+
* @param {string} update_json
|
|
231
|
+
* @returns {string | undefined}
|
|
232
|
+
*/
|
|
233
|
+
export function rebindValueKey(value_key, update_json) {
|
|
234
|
+
let ptr0, len0, ptr1, len1;
|
|
235
|
+
try {
|
|
236
|
+
ptr0 = passStringToWasm0(value_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
237
|
+
len0 = WASM_VECTOR_LEN;
|
|
238
|
+
ptr1 = passStringToWasm0(update_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
239
|
+
len1 = WASM_VECTOR_LEN;
|
|
240
|
+
} catch (e) {
|
|
241
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
242
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
243
|
+
throw e;
|
|
244
|
+
}
|
|
245
|
+
const ret = wasm.rebindValueKey(ptr0, len0, ptr1, len1);
|
|
246
|
+
if (ret[3]) {
|
|
247
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
248
|
+
}
|
|
249
|
+
let v3;
|
|
250
|
+
if (ret[0] !== 0) {
|
|
251
|
+
v3 = getStringFromWasm0(ret[0], ret[1]);
|
|
252
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
253
|
+
}
|
|
254
|
+
return v3;
|
|
255
|
+
}
|
|
256
|
+
function __wbg_get_imports() {
|
|
257
|
+
const import0 = {
|
|
258
|
+
__proto__: null,
|
|
259
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
260
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
261
|
+
return ret;
|
|
262
|
+
},
|
|
263
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
264
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
265
|
+
},
|
|
266
|
+
__wbindgen_init_externref_table: function() {
|
|
267
|
+
const table = wasm.__wbindgen_externrefs;
|
|
268
|
+
table.set(0, undefined);
|
|
269
|
+
table.set(1024, undefined);
|
|
270
|
+
table.set(1025, null);
|
|
271
|
+
table.set(1026, true);
|
|
272
|
+
table.set(1027, false);
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
return {
|
|
276
|
+
__proto__: null,
|
|
277
|
+
"./editor_engine_wasm_bg.js": import0,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const ProjectFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
282
|
+
? { register: () => {}, unregister: () => {} }
|
|
283
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_project_free(ptr, 1));
|
|
284
|
+
|
|
285
|
+
function getStringFromWasm0(ptr, len) {
|
|
286
|
+
ptr = ptr >>> 0;
|
|
287
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
let cachedUint8ArrayMemory0 = null;
|
|
291
|
+
function getUint8ArrayMemory0() {
|
|
292
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
293
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
294
|
+
}
|
|
295
|
+
return cachedUint8ArrayMemory0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function isLikeNone(x) {
|
|
299
|
+
return x === undefined || x === null;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
303
|
+
if (realloc === undefined) {
|
|
304
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
305
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
306
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
307
|
+
WASM_VECTOR_LEN = buf.length;
|
|
308
|
+
return ptr;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
let len = arg.length;
|
|
312
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
313
|
+
|
|
314
|
+
const mem = getUint8ArrayMemory0();
|
|
315
|
+
|
|
316
|
+
let offset = 0;
|
|
317
|
+
|
|
318
|
+
for (; offset < len; offset++) {
|
|
319
|
+
const code = arg.charCodeAt(offset);
|
|
320
|
+
if (code > 0x7F) break;
|
|
321
|
+
mem[ptr + offset] = code;
|
|
322
|
+
}
|
|
323
|
+
if (offset !== len) {
|
|
324
|
+
if (offset !== 0) {
|
|
325
|
+
arg = arg.slice(offset);
|
|
326
|
+
}
|
|
327
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
328
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
329
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
330
|
+
|
|
331
|
+
offset += ret.written;
|
|
332
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
WASM_VECTOR_LEN = offset;
|
|
336
|
+
return ptr;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function takeFromExternrefTable0(idx) {
|
|
340
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
341
|
+
wasm.__externref_table_dealloc(idx);
|
|
342
|
+
return value;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
346
|
+
cachedTextDecoder.decode();
|
|
347
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
348
|
+
let numBytesDecoded = 0;
|
|
349
|
+
function decodeText(bytes) {
|
|
350
|
+
numBytesDecoded += bytes.length;
|
|
351
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
352
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
353
|
+
cachedTextDecoder.decode();
|
|
354
|
+
numBytesDecoded = bytes.length;
|
|
355
|
+
}
|
|
356
|
+
return cachedTextDecoder.decode(bytes);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const cachedTextEncoder = new TextEncoder();
|
|
360
|
+
|
|
361
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
362
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
363
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
364
|
+
view.set(buf);
|
|
365
|
+
return {
|
|
366
|
+
read: arg.length,
|
|
367
|
+
written: buf.length
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
let WASM_VECTOR_LEN = 0;
|
|
373
|
+
|
|
374
|
+
let wasmModule, wasmInstance, wasm;
|
|
375
|
+
function __wbg_finalize_init(instance, module) {
|
|
376
|
+
wasmInstance = instance;
|
|
377
|
+
wasm = instance.exports;
|
|
378
|
+
wasmModule = module;
|
|
379
|
+
cachedUint8ArrayMemory0 = null;
|
|
380
|
+
wasm.__wbindgen_start();
|
|
381
|
+
return wasm;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
async function __wbg_load(module, imports) {
|
|
385
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
386
|
+
if (!module.ok) {
|
|
387
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
391
|
+
try {
|
|
392
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
393
|
+
} catch (e) {
|
|
394
|
+
const validResponse = expectedResponseType(module.type);
|
|
395
|
+
|
|
396
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
397
|
+
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);
|
|
398
|
+
|
|
399
|
+
} else { throw e; }
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const bytes = await module.arrayBuffer();
|
|
404
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
405
|
+
} else {
|
|
406
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
407
|
+
|
|
408
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
409
|
+
return { instance, module };
|
|
410
|
+
} else {
|
|
411
|
+
return instance;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function expectedResponseType(type) {
|
|
416
|
+
switch (type) {
|
|
417
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function initSync(module) {
|
|
424
|
+
if (wasm !== undefined) return wasm;
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
if (module !== undefined) {
|
|
428
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
429
|
+
({module} = module)
|
|
430
|
+
} else {
|
|
431
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const imports = __wbg_get_imports();
|
|
436
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
437
|
+
module = new WebAssembly.Module(module);
|
|
438
|
+
}
|
|
439
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
440
|
+
return __wbg_finalize_init(instance, module);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
let __wbg_init_promise;
|
|
444
|
+
async function __wbg_init(module_or_path) {
|
|
445
|
+
if (wasm !== undefined) return wasm;
|
|
446
|
+
if (__wbg_init_promise === undefined) {
|
|
447
|
+
__wbg_init_promise = __wbg_init_once(module_or_path);
|
|
448
|
+
__wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
|
|
449
|
+
}
|
|
450
|
+
return __wbg_init_promise;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
async function __wbg_init_once(module_or_path) {
|
|
454
|
+
|
|
455
|
+
if (module_or_path !== undefined) {
|
|
456
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
457
|
+
({module_or_path} = module_or_path)
|
|
458
|
+
} else {
|
|
459
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if (module_or_path === undefined) {
|
|
464
|
+
module_or_path = new URL('editor_engine_wasm_bg.wasm', import.meta.url);
|
|
465
|
+
}
|
|
466
|
+
const imports = __wbg_get_imports();
|
|
467
|
+
|
|
468
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
469
|
+
module_or_path = fetch(module_or_path);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
473
|
+
|
|
474
|
+
return __wbg_finalize_init(instance, module);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_project_free: (a: number, b: number) => void;
|
|
5
|
+
export const isWritableFile: (a: number, b: number) => number;
|
|
6
|
+
export const project_anchor: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
7
|
+
export const project_apply: (a: number, b: number, c: number) => [number, number, number, number];
|
|
8
|
+
export const project_computedExpression: (a: number, b: number, c: number) => [number, number];
|
|
9
|
+
export const project_decl: (a: number, b: number, c: number) => [number, number];
|
|
10
|
+
export const project_map: (a: number) => [number, number];
|
|
11
|
+
export const project_new: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
12
|
+
export const project_plan: (a: number, b: number, c: number) => [number, number, number, number];
|
|
13
|
+
export const project_resetRemaps: (a: number) => void;
|
|
14
|
+
export const project_setFile: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
15
|
+
export const project_settingsStatus: (a: number) => [number, number];
|
|
16
|
+
export const project_unanalysed: (a: number) => [number, number];
|
|
17
|
+
export const rebindValueKey: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
18
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
19
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
20
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
21
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
22
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
23
|
+
export const __wbindgen_start: () => void;
|