@yodaos-pkg/aix 0.6.0 → 0.8.2

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/README.md CHANGED
@@ -30,11 +30,11 @@ async function fromFile(file: File) {
30
30
  }
31
31
  ```
32
32
 
33
- ## Using the Playground
33
+ ## Using the Package Lab
34
34
 
35
- `aix-web` includes a local playground for trying `.aix` packages in the browser.
35
+ The official browser lab now lives in the docs site at `/play`.
36
36
 
37
- If you are developing inside this repository, install dependencies in `packages/aix-web` first:
37
+ If you are developing inside this repository, install dependencies in `crates/aix-web` first:
38
38
 
39
39
  ```bash
40
40
  npm install
@@ -46,28 +46,51 @@ npm install
46
46
  npm run build
47
47
  ```
48
48
 
49
- This step builds the `aix-web` WebAssembly bundle and TypeScript output into `dist/`, which is what the playground loads locally.
49
+ This step builds the `aix-web` WebAssembly bundle and TypeScript output into `dist/`, which is what the docs-integrated Package Lab loads.
50
50
 
51
- 2. Start the playground:
51
+ 2. Install the docs dependencies:
52
+
53
+ ```bash
54
+ cd ../../docs
55
+ npm install
56
+ ```
57
+
58
+ 3. Start the docs site:
52
59
 
53
60
  ```bash
54
61
  npm run dev
55
62
  ```
56
63
 
57
- 3. Open the local Vite URL shown in the terminal, usually:
64
+ 4. Open the local VitePress URL shown in the terminal, then navigate to `/play`, usually:
58
65
 
59
66
  ```text
60
- http://localhost:5173
67
+ http://localhost:5173/aix/play
61
68
  ```
62
69
 
63
- 4. Upload an `.aix` file in the page to inspect:
70
+ 5. Upload an `.aix` file in the page to inspect:
64
71
 
65
72
  - package title and version
66
73
  - parsed `pages`
67
74
  - generated OpenAI-compatible `tools`
68
75
  - package file list and raw file contents
69
76
 
70
- This is useful for verifying whether `app.json`, page schemas, and `getTools()` output match expectations while developing or debugging an AIX package.
77
+ This is useful for verifying whether `app.json`, page schemas, and `getTools()` output match expectations while developing or debugging an AIX package inside the official docs experience.
78
+
79
+ ### Pack and Optimize
80
+
81
+ The Web package includes the same in-memory packer and pure Rust resource
82
+ optimizer as the native CLI:
83
+
84
+ ```ts
85
+ const packed = await AIX.pack(
86
+ [{ path: "app.json", data: new TextEncoder().encode('{"pages":[]}') }],
87
+ { optimize: { level: 2 } },
88
+ );
89
+
90
+ const optimized = await AIX.optimize(packed.data, { level: 3 });
91
+ ```
92
+
93
+ Both methods return the generated `Uint8Array` and a structured per-file report.
71
94
 
72
95
  ## API Reference
73
96
 
package/index.d.ts CHANGED
@@ -1,3 +1,37 @@
1
+ export interface AixInputFile {
2
+ path: string;
3
+ data: Uint8Array;
4
+ }
5
+ export interface OptimizeOptions {
6
+ level?: 1 | 2 | 3;
7
+ json?: boolean;
8
+ png?: boolean;
9
+ jpeg?: boolean;
10
+ }
11
+ export interface FileOptimizeReport {
12
+ path: string;
13
+ status: 'optimized' | 'unchanged' | 'skipped';
14
+ original_size: number;
15
+ output_size: number;
16
+ saved_bytes: number;
17
+ converted_to_utf8: boolean;
18
+ }
19
+ export interface OptimizeReport {
20
+ files: FileOptimizeReport[];
21
+ original_size: number;
22
+ output_size: number;
23
+ saved_bytes: number;
24
+ }
25
+ export interface PackResult {
26
+ data: Uint8Array;
27
+ report: OptimizeReport;
28
+ warnings: string[];
29
+ }
30
+ type PackOptions = {
31
+ buildId?: string;
32
+ engine?: string;
33
+ optimize?: false | OptimizeOptions;
34
+ };
1
35
  export interface AixEntry {
2
36
  name: string;
3
37
  size: number;
@@ -24,6 +58,9 @@ export declare class AIX {
24
58
  * @param data The .aix file content as Uint8Array or File
25
59
  */
26
60
  static From(data: Uint8Array | File): Promise<AIX>;
61
+ static pack(files: AixInputFile[], options?: PackOptions): Promise<PackResult>;
62
+ static packFromFiles(files: File[], options?: PackOptions): Promise<PackResult>;
63
+ static optimize(data: Uint8Array | File, options?: OptimizeOptions): Promise<PackResult>;
27
64
  /**
28
65
  * List all files in the AIX package.
29
66
  */
@@ -37,6 +74,7 @@ export declare class AIX {
37
74
  * Get the version metadata from the AIX package.
38
75
  */
39
76
  getVersion(): string | undefined;
77
+ supportsEngine(currentVersion: string): boolean;
40
78
  /**
41
79
  * Get the title from app.json.
42
80
  */
@@ -50,3 +88,4 @@ export declare class AIX {
50
88
  */
51
89
  getTools(): Tool[];
52
90
  }
91
+ export {};
package/index.js CHANGED
@@ -1,4 +1,25 @@
1
- import init, { AixReaderWasm } from './pkg/aix_web';
1
+ import init, { AixReaderWasm, optimize_aix, pack_aix, } from './pkg/aix_web.js';
2
+ import * as wasmExports from './pkg/aix_web.js';
3
+ function generateBuildId() {
4
+ const cryptoApi = globalThis.crypto;
5
+ if (typeof cryptoApi?.randomUUID === 'function') {
6
+ return cryptoApi.randomUUID();
7
+ }
8
+ const bytes = new Uint8Array(16);
9
+ if (typeof cryptoApi?.getRandomValues === 'function') {
10
+ cryptoApi.getRandomValues(bytes);
11
+ }
12
+ else {
13
+ const timestamp = Date.now();
14
+ for (let index = 0; index < bytes.length; index += 1) {
15
+ bytes[index] = Math.floor(Math.random() * 256) ^ (timestamp >>> ((index % 6) * 8));
16
+ }
17
+ }
18
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
19
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
20
+ const hex = Array.from(bytes, (value) => value.toString(16).padStart(2, '0')).join('');
21
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
22
+ }
2
23
  export class AIX {
3
24
  constructor(reader) {
4
25
  this.reader = reader;
@@ -20,6 +41,32 @@ export class AIX {
20
41
  const reader = new AixReaderWasm(buffer);
21
42
  return new AIX(reader);
22
43
  }
44
+ static async pack(files, options) {
45
+ await init();
46
+ const buildId = options?.buildId ?? generateBuildId();
47
+ const optimize = options?.optimize === false ? undefined : options?.optimize;
48
+ const result = pack_aix(files, buildId, options?.engine, optimize);
49
+ return { data: result.data, report: result.report, warnings: result.warnings ?? [] };
50
+ }
51
+ static async packFromFiles(files, options) {
52
+ await init();
53
+ const buildId = options?.buildId ?? generateBuildId();
54
+ const optimize = options?.optimize === false ? undefined : options?.optimize;
55
+ const sourceFiles = await Promise.all(files.map(async (file) => ({
56
+ path: resolveWebFilePath(file),
57
+ data: new Uint8Array(await file.arrayBuffer()),
58
+ })));
59
+ const result = getPackFromSource()(sourceFiles, buildId, options?.engine, optimize);
60
+ return { data: result.data, report: result.report, warnings: result.warnings ?? [] };
61
+ }
62
+ static async optimize(data, options) {
63
+ await init();
64
+ const buffer = data instanceof Uint8Array
65
+ ? data
66
+ : new Uint8Array(await data.arrayBuffer());
67
+ const result = optimize_aix(buffer, options);
68
+ return { data: result.data, report: result.report, warnings: result.warnings ?? [] };
69
+ }
23
70
  /**
24
71
  * List all files in the AIX package.
25
72
  */
@@ -39,6 +86,9 @@ export class AIX {
39
86
  getVersion() {
40
87
  return this.reader.get_version();
41
88
  }
89
+ supportsEngine(currentVersion) {
90
+ return this.reader.supports_engine(currentVersion);
91
+ }
42
92
  /**
43
93
  * Get the title from app.json.
44
94
  */
@@ -58,3 +108,14 @@ export class AIX {
58
108
  return this.reader.get_tools();
59
109
  }
60
110
  }
111
+ function resolveWebFilePath(file) {
112
+ const candidate = file.webkitRelativePath;
113
+ return candidate && candidate.length > 0 ? candidate : file.name;
114
+ }
115
+ function getPackFromSource() {
116
+ const packFromSource = wasmExports.pack_aix_from_source;
117
+ if (!packFromSource) {
118
+ throw new Error('pack_aix_from_source is not available in the current WASM bundle');
119
+ }
120
+ return packFromSource;
121
+ }
package/jsr.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@yodaos-pkg/aix",
3
- "version": "0.6.0",
3
+ "version": "0.8.2",
4
4
  "exports": "./index.js"
5
5
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@yodaos-pkg/aix",
3
- "version": "0.6.0",
3
+ "version": "0.8.2",
4
4
  "description": "Ink AIX Package Reader",
5
+ "type": "module",
5
6
  "main": "index.js",
6
7
  "types": "index.d.ts",
7
8
  "files": [
package/pkg/README.md CHANGED
@@ -30,11 +30,11 @@ async function fromFile(file: File) {
30
30
  }
31
31
  ```
32
32
 
33
- ## Using the Playground
33
+ ## Using the Package Lab
34
34
 
35
- `aix-web` includes a local playground for trying `.aix` packages in the browser.
35
+ The official browser lab now lives in the docs site at `/play`.
36
36
 
37
- If you are developing inside this repository, install dependencies in `packages/aix-web` first:
37
+ If you are developing inside this repository, install dependencies in `crates/aix-web` first:
38
38
 
39
39
  ```bash
40
40
  npm install
@@ -46,28 +46,51 @@ npm install
46
46
  npm run build
47
47
  ```
48
48
 
49
- This step builds the `aix-web` WebAssembly bundle and TypeScript output into `dist/`, which is what the playground loads locally.
49
+ This step builds the `aix-web` WebAssembly bundle and TypeScript output into `dist/`, which is what the docs-integrated Package Lab loads.
50
50
 
51
- 2. Start the playground:
51
+ 2. Install the docs dependencies:
52
+
53
+ ```bash
54
+ cd ../../docs
55
+ npm install
56
+ ```
57
+
58
+ 3. Start the docs site:
52
59
 
53
60
  ```bash
54
61
  npm run dev
55
62
  ```
56
63
 
57
- 3. Open the local Vite URL shown in the terminal, usually:
64
+ 4. Open the local VitePress URL shown in the terminal, then navigate to `/play`, usually:
58
65
 
59
66
  ```text
60
- http://localhost:5173
67
+ http://localhost:5173/aix/play
61
68
  ```
62
69
 
63
- 4. Upload an `.aix` file in the page to inspect:
70
+ 5. Upload an `.aix` file in the page to inspect:
64
71
 
65
72
  - package title and version
66
73
  - parsed `pages`
67
74
  - generated OpenAI-compatible `tools`
68
75
  - package file list and raw file contents
69
76
 
70
- This is useful for verifying whether `app.json`, page schemas, and `getTools()` output match expectations while developing or debugging an AIX package.
77
+ This is useful for verifying whether `app.json`, page schemas, and `getTools()` output match expectations while developing or debugging an AIX package inside the official docs experience.
78
+
79
+ ### Pack and Optimize
80
+
81
+ The Web package includes the same in-memory packer and pure Rust resource
82
+ optimizer as the native CLI:
83
+
84
+ ```ts
85
+ const packed = await AIX.pack(
86
+ [{ path: "app.json", data: new TextEncoder().encode('{"pages":[]}') }],
87
+ { optimize: { level: 2 } },
88
+ );
89
+
90
+ const optimized = await AIX.optimize(packed.data, { level: 3 });
91
+ ```
92
+
93
+ Both methods return the generated `Uint8Array` and a structured per-file report.
71
94
 
72
95
  ## API Reference
73
96
 
package/pkg/aix_web.d.ts CHANGED
@@ -1,6 +1,15 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ export class AixPackResultWasm {
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ readonly data: Uint8Array;
9
+ readonly report: any;
10
+ readonly warnings: any;
11
+ }
12
+
4
13
  export class AixReaderWasm {
5
14
  free(): void;
6
15
  [Symbol.dispose](): void;
@@ -11,24 +20,58 @@ export class AixReaderWasm {
11
20
  list(): any;
12
21
  constructor(data: Uint8Array);
13
22
  read_file(name: string): Uint8Array;
23
+ supports_engine(current_version: string): boolean;
24
+ }
25
+
26
+ export class AixSourcePackBuilderWasm {
27
+ free(): void;
28
+ [Symbol.dispose](): void;
29
+ add_file(path: string, data: Uint8Array): void;
30
+ constructor();
31
+ pack_from_source_with_progress(build_id: string, engine: string | null | undefined, optimize_options: any, progress: Function): AixPackResultWasm;
14
32
  }
15
33
 
34
+ export function optimize_aix(data: Uint8Array, options: any): AixPackResultWasm;
35
+
36
+ export function pack_aix(files: any, build_id: string, engine: string | null | undefined, optimize_options: any): AixPackResultWasm;
37
+
38
+ export function pack_aix_from_source(files: any, build_id: string, engine: string | null | undefined, optimize_options: any): AixPackResultWasm;
39
+
40
+ export function pack_aix_from_source_with_progress(files: any, build_id: string, engine: string | null | undefined, optimize_options: any, progress: Function): AixPackResultWasm;
41
+
16
42
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
17
43
 
18
44
  export interface InitOutput {
19
45
  readonly memory: WebAssembly.Memory;
46
+ readonly __wbg_aixpackresultwasm_free: (a: number, b: number) => void;
20
47
  readonly __wbg_aixreaderwasm_free: (a: number, b: number) => void;
21
- readonly aixreaderwasm_get_pages: (a: number, b: number) => void;
22
- readonly aixreaderwasm_get_title: (a: number, b: number) => void;
23
- readonly aixreaderwasm_get_tools: (a: number, b: number) => void;
24
- readonly aixreaderwasm_get_version: (a: number, b: number) => void;
25
- readonly aixreaderwasm_list: (a: number, b: number) => void;
26
- readonly aixreaderwasm_new: (a: number, b: number, c: number) => void;
27
- readonly aixreaderwasm_read_file: (a: number, b: number, c: number, d: number) => void;
28
- readonly __wbindgen_export: (a: number, b: number) => number;
29
- readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
30
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
31
- readonly __wbindgen_export3: (a: number, b: number, c: number) => void;
48
+ readonly __wbg_aixsourcepackbuilderwasm_free: (a: number, b: number) => void;
49
+ readonly aixpackresultwasm_data: (a: number) => any;
50
+ readonly aixpackresultwasm_report: (a: number) => [number, number, number];
51
+ readonly aixpackresultwasm_warnings: (a: number) => [number, number, number];
52
+ readonly aixreaderwasm_get_pages: (a: number) => [number, number, number];
53
+ readonly aixreaderwasm_get_title: (a: number) => [number, number];
54
+ readonly aixreaderwasm_get_tools: (a: number) => [number, number, number];
55
+ readonly aixreaderwasm_get_version: (a: number) => [number, number];
56
+ readonly aixreaderwasm_list: (a: number) => [number, number, number];
57
+ readonly aixreaderwasm_new: (a: number, b: number) => [number, number, number];
58
+ readonly aixreaderwasm_read_file: (a: number, b: number, c: number) => [number, number, number, number];
59
+ readonly aixreaderwasm_supports_engine: (a: number, b: number, c: number) => [number, number, number];
60
+ readonly aixsourcepackbuilderwasm_add_file: (a: number, b: number, c: number, d: number, e: number) => void;
61
+ readonly aixsourcepackbuilderwasm_new: () => number;
62
+ readonly aixsourcepackbuilderwasm_pack_from_source_with_progress: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => [number, number, number];
63
+ readonly optimize_aix: (a: number, b: number, c: any) => [number, number, number];
64
+ readonly pack_aix: (a: any, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
65
+ readonly pack_aix_from_source: (a: any, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
66
+ readonly pack_aix_from_source_with_progress: (a: any, b: number, c: number, d: number, e: number, f: any, g: any) => [number, number, number];
67
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
68
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
69
+ readonly __wbindgen_exn_store: (a: number) => void;
70
+ readonly __externref_table_alloc: () => number;
71
+ readonly __wbindgen_externrefs: WebAssembly.Table;
72
+ readonly __externref_table_dealloc: (a: number) => void;
73
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
74
+ readonly __wbindgen_start: () => void;
32
75
  }
33
76
 
34
77
  export type SyncInitInput = BufferSource | WebAssembly.Module;
package/pkg/aix_web.js CHANGED
@@ -1,5 +1,52 @@
1
1
  /* @ts-self-types="./aix_web.d.ts" */
2
2
 
3
+ export class AixPackResultWasm {
4
+ static __wrap(ptr) {
5
+ const obj = Object.create(AixPackResultWasm.prototype);
6
+ obj.__wbg_ptr = ptr;
7
+ AixPackResultWasmFinalization.register(obj, obj.__wbg_ptr, obj);
8
+ return obj;
9
+ }
10
+ __destroy_into_raw() {
11
+ const ptr = this.__wbg_ptr;
12
+ this.__wbg_ptr = 0;
13
+ AixPackResultWasmFinalization.unregister(this);
14
+ return ptr;
15
+ }
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_aixpackresultwasm_free(ptr, 0);
19
+ }
20
+ /**
21
+ * @returns {Uint8Array}
22
+ */
23
+ get data() {
24
+ const ret = wasm.aixpackresultwasm_data(this.__wbg_ptr);
25
+ return ret;
26
+ }
27
+ /**
28
+ * @returns {any}
29
+ */
30
+ get report() {
31
+ const ret = wasm.aixpackresultwasm_report(this.__wbg_ptr);
32
+ if (ret[2]) {
33
+ throw takeFromExternrefTable0(ret[1]);
34
+ }
35
+ return takeFromExternrefTable0(ret[0]);
36
+ }
37
+ /**
38
+ * @returns {any}
39
+ */
40
+ get warnings() {
41
+ const ret = wasm.aixpackresultwasm_warnings(this.__wbg_ptr);
42
+ if (ret[2]) {
43
+ throw takeFromExternrefTable0(ret[1]);
44
+ }
45
+ return takeFromExternrefTable0(ret[0]);
46
+ }
47
+ }
48
+ if (Symbol.dispose) AixPackResultWasm.prototype[Symbol.dispose] = AixPackResultWasm.prototype.free;
49
+
3
50
  export class AixReaderWasm {
4
51
  __destroy_into_raw() {
5
52
  const ptr = this.__wbg_ptr;
@@ -15,215 +62,438 @@ export class AixReaderWasm {
15
62
  * @returns {any}
16
63
  */
17
64
  get_pages() {
18
- try {
19
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
20
- wasm.aixreaderwasm_get_pages(retptr, this.__wbg_ptr);
21
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
22
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
23
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
24
- if (r2) {
25
- throw takeObject(r1);
26
- }
27
- return takeObject(r0);
28
- } finally {
29
- wasm.__wbindgen_add_to_stack_pointer(16);
65
+ const ret = wasm.aixreaderwasm_get_pages(this.__wbg_ptr);
66
+ if (ret[2]) {
67
+ throw takeFromExternrefTable0(ret[1]);
30
68
  }
69
+ return takeFromExternrefTable0(ret[0]);
31
70
  }
32
71
  /**
33
72
  * @returns {string | undefined}
34
73
  */
35
74
  get_title() {
36
- try {
37
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
38
- wasm.aixreaderwasm_get_title(retptr, this.__wbg_ptr);
39
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
40
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
41
- let v1;
42
- if (r0 !== 0) {
43
- v1 = getStringFromWasm0(r0, r1).slice();
44
- wasm.__wbindgen_export3(r0, r1 * 1, 1);
45
- }
46
- return v1;
47
- } finally {
48
- wasm.__wbindgen_add_to_stack_pointer(16);
75
+ const ret = wasm.aixreaderwasm_get_title(this.__wbg_ptr);
76
+ let v1;
77
+ if (ret[0] !== 0) {
78
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
79
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
49
80
  }
81
+ return v1;
50
82
  }
51
83
  /**
52
84
  * @returns {any}
53
85
  */
54
86
  get_tools() {
55
- try {
56
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
57
- wasm.aixreaderwasm_get_tools(retptr, this.__wbg_ptr);
58
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
59
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
60
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
61
- if (r2) {
62
- throw takeObject(r1);
63
- }
64
- return takeObject(r0);
65
- } finally {
66
- wasm.__wbindgen_add_to_stack_pointer(16);
87
+ const ret = wasm.aixreaderwasm_get_tools(this.__wbg_ptr);
88
+ if (ret[2]) {
89
+ throw takeFromExternrefTable0(ret[1]);
67
90
  }
91
+ return takeFromExternrefTable0(ret[0]);
68
92
  }
69
93
  /**
70
94
  * @returns {string | undefined}
71
95
  */
72
96
  get_version() {
73
- try {
74
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
75
- wasm.aixreaderwasm_get_version(retptr, this.__wbg_ptr);
76
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
77
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
78
- let v1;
79
- if (r0 !== 0) {
80
- v1 = getStringFromWasm0(r0, r1).slice();
81
- wasm.__wbindgen_export3(r0, r1 * 1, 1);
82
- }
83
- return v1;
84
- } finally {
85
- wasm.__wbindgen_add_to_stack_pointer(16);
97
+ const ret = wasm.aixreaderwasm_get_version(this.__wbg_ptr);
98
+ let v1;
99
+ if (ret[0] !== 0) {
100
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
101
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
86
102
  }
103
+ return v1;
87
104
  }
88
105
  /**
89
106
  * @returns {any}
90
107
  */
91
108
  list() {
92
- try {
93
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
94
- wasm.aixreaderwasm_list(retptr, this.__wbg_ptr);
95
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
96
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
97
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
98
- if (r2) {
99
- throw takeObject(r1);
100
- }
101
- return takeObject(r0);
102
- } finally {
103
- wasm.__wbindgen_add_to_stack_pointer(16);
109
+ const ret = wasm.aixreaderwasm_list(this.__wbg_ptr);
110
+ if (ret[2]) {
111
+ throw takeFromExternrefTable0(ret[1]);
104
112
  }
113
+ return takeFromExternrefTable0(ret[0]);
105
114
  }
106
115
  /**
107
116
  * @param {Uint8Array} data
108
117
  */
109
118
  constructor(data) {
110
- try {
111
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
112
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
113
- const len0 = WASM_VECTOR_LEN;
114
- wasm.aixreaderwasm_new(retptr, ptr0, len0);
115
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
116
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
117
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
118
- if (r2) {
119
- throw takeObject(r1);
120
- }
121
- this.__wbg_ptr = r0 >>> 0;
122
- AixReaderWasmFinalization.register(this, this.__wbg_ptr, this);
123
- return this;
124
- } finally {
125
- wasm.__wbindgen_add_to_stack_pointer(16);
119
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
120
+ const len0 = WASM_VECTOR_LEN;
121
+ const ret = wasm.aixreaderwasm_new(ptr0, len0);
122
+ if (ret[2]) {
123
+ throw takeFromExternrefTable0(ret[1]);
126
124
  }
125
+ this.__wbg_ptr = ret[0];
126
+ AixReaderWasmFinalization.register(this, this.__wbg_ptr, this);
127
+ return this;
127
128
  }
128
129
  /**
129
130
  * @param {string} name
130
131
  * @returns {Uint8Array}
131
132
  */
132
133
  read_file(name) {
133
- try {
134
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
135
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
136
- const len0 = WASM_VECTOR_LEN;
137
- wasm.aixreaderwasm_read_file(retptr, this.__wbg_ptr, ptr0, len0);
138
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
139
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
140
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
141
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
142
- if (r3) {
143
- throw takeObject(r2);
144
- }
145
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
146
- wasm.__wbindgen_export3(r0, r1 * 1, 1);
147
- return v2;
148
- } finally {
149
- wasm.__wbindgen_add_to_stack_pointer(16);
134
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
135
+ const len0 = WASM_VECTOR_LEN;
136
+ const ret = wasm.aixreaderwasm_read_file(this.__wbg_ptr, ptr0, len0);
137
+ if (ret[3]) {
138
+ throw takeFromExternrefTable0(ret[2]);
139
+ }
140
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
141
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
142
+ return v2;
143
+ }
144
+ /**
145
+ * @param {string} current_version
146
+ * @returns {boolean}
147
+ */
148
+ supports_engine(current_version) {
149
+ const ptr0 = passStringToWasm0(current_version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
150
+ const len0 = WASM_VECTOR_LEN;
151
+ const ret = wasm.aixreaderwasm_supports_engine(this.__wbg_ptr, ptr0, len0);
152
+ if (ret[2]) {
153
+ throw takeFromExternrefTable0(ret[1]);
150
154
  }
155
+ return ret[0] !== 0;
151
156
  }
152
157
  }
153
158
  if (Symbol.dispose) AixReaderWasm.prototype[Symbol.dispose] = AixReaderWasm.prototype.free;
154
159
 
160
+ export class AixSourcePackBuilderWasm {
161
+ __destroy_into_raw() {
162
+ const ptr = this.__wbg_ptr;
163
+ this.__wbg_ptr = 0;
164
+ AixSourcePackBuilderWasmFinalization.unregister(this);
165
+ return ptr;
166
+ }
167
+ free() {
168
+ const ptr = this.__destroy_into_raw();
169
+ wasm.__wbg_aixsourcepackbuilderwasm_free(ptr, 0);
170
+ }
171
+ /**
172
+ * @param {string} path
173
+ * @param {Uint8Array} data
174
+ */
175
+ add_file(path, data) {
176
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
177
+ const len0 = WASM_VECTOR_LEN;
178
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
179
+ const len1 = WASM_VECTOR_LEN;
180
+ wasm.aixsourcepackbuilderwasm_add_file(this.__wbg_ptr, ptr0, len0, ptr1, len1);
181
+ }
182
+ constructor() {
183
+ const ret = wasm.aixsourcepackbuilderwasm_new();
184
+ this.__wbg_ptr = ret;
185
+ AixSourcePackBuilderWasmFinalization.register(this, this.__wbg_ptr, this);
186
+ return this;
187
+ }
188
+ /**
189
+ * @param {string} build_id
190
+ * @param {string | null | undefined} engine
191
+ * @param {any} optimize_options
192
+ * @param {Function} progress
193
+ * @returns {AixPackResultWasm}
194
+ */
195
+ pack_from_source_with_progress(build_id, engine, optimize_options, progress) {
196
+ const ptr0 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
+ const len0 = WASM_VECTOR_LEN;
198
+ var ptr1 = isLikeNone(engine) ? 0 : passStringToWasm0(engine, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
199
+ var len1 = WASM_VECTOR_LEN;
200
+ const ret = wasm.aixsourcepackbuilderwasm_pack_from_source_with_progress(this.__wbg_ptr, ptr0, len0, ptr1, len1, optimize_options, progress);
201
+ if (ret[2]) {
202
+ throw takeFromExternrefTable0(ret[1]);
203
+ }
204
+ return AixPackResultWasm.__wrap(ret[0]);
205
+ }
206
+ }
207
+ if (Symbol.dispose) AixSourcePackBuilderWasm.prototype[Symbol.dispose] = AixSourcePackBuilderWasm.prototype.free;
208
+
209
+ /**
210
+ * @param {Uint8Array} data
211
+ * @param {any} options
212
+ * @returns {AixPackResultWasm}
213
+ */
214
+ export function optimize_aix(data, options) {
215
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
216
+ const len0 = WASM_VECTOR_LEN;
217
+ const ret = wasm.optimize_aix(ptr0, len0, options);
218
+ if (ret[2]) {
219
+ throw takeFromExternrefTable0(ret[1]);
220
+ }
221
+ return AixPackResultWasm.__wrap(ret[0]);
222
+ }
223
+
224
+ /**
225
+ * @param {any} files
226
+ * @param {string} build_id
227
+ * @param {string | null | undefined} engine
228
+ * @param {any} optimize_options
229
+ * @returns {AixPackResultWasm}
230
+ */
231
+ export function pack_aix(files, build_id, engine, optimize_options) {
232
+ const ptr0 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
233
+ const len0 = WASM_VECTOR_LEN;
234
+ var ptr1 = isLikeNone(engine) ? 0 : passStringToWasm0(engine, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
235
+ var len1 = WASM_VECTOR_LEN;
236
+ const ret = wasm.pack_aix(files, ptr0, len0, ptr1, len1, optimize_options);
237
+ if (ret[2]) {
238
+ throw takeFromExternrefTable0(ret[1]);
239
+ }
240
+ return AixPackResultWasm.__wrap(ret[0]);
241
+ }
242
+
243
+ /**
244
+ * @param {any} files
245
+ * @param {string} build_id
246
+ * @param {string | null | undefined} engine
247
+ * @param {any} optimize_options
248
+ * @returns {AixPackResultWasm}
249
+ */
250
+ export function pack_aix_from_source(files, build_id, engine, optimize_options) {
251
+ const ptr0 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ var ptr1 = isLikeNone(engine) ? 0 : passStringToWasm0(engine, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
254
+ var len1 = WASM_VECTOR_LEN;
255
+ const ret = wasm.pack_aix_from_source(files, ptr0, len0, ptr1, len1, optimize_options);
256
+ if (ret[2]) {
257
+ throw takeFromExternrefTable0(ret[1]);
258
+ }
259
+ return AixPackResultWasm.__wrap(ret[0]);
260
+ }
261
+
262
+ /**
263
+ * @param {any} files
264
+ * @param {string} build_id
265
+ * @param {string | null | undefined} engine
266
+ * @param {any} optimize_options
267
+ * @param {Function} progress
268
+ * @returns {AixPackResultWasm}
269
+ */
270
+ export function pack_aix_from_source_with_progress(files, build_id, engine, optimize_options, progress) {
271
+ const ptr0 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
272
+ const len0 = WASM_VECTOR_LEN;
273
+ var ptr1 = isLikeNone(engine) ? 0 : passStringToWasm0(engine, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
274
+ var len1 = WASM_VECTOR_LEN;
275
+ const ret = wasm.pack_aix_from_source_with_progress(files, ptr0, len0, ptr1, len1, optimize_options, progress);
276
+ if (ret[2]) {
277
+ throw takeFromExternrefTable0(ret[1]);
278
+ }
279
+ return AixPackResultWasm.__wrap(ret[0]);
280
+ }
155
281
  function __wbg_get_imports() {
156
282
  const import0 = {
157
283
  __proto__: null,
158
- __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
284
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
159
285
  const ret = Error(getStringFromWasm0(arg0, arg1));
160
- return addHeapObject(ret);
286
+ return ret;
287
+ },
288
+ __wbg_Number_9a4e0ecb0fa16705: function(arg0) {
289
+ const ret = Number(arg0);
290
+ return ret;
161
291
  },
162
- __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
163
- const ret = String(getObject(arg1));
164
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
292
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
293
+ const ret = String(arg1);
294
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
165
295
  const len1 = WASM_VECTOR_LEN;
166
296
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
167
297
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
168
298
  },
169
- __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
170
- const ret = typeof(getObject(arg0)) === 'string';
299
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
300
+ const v = arg0;
301
+ const ret = typeof(v) === 'boolean' ? v : undefined;
302
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
303
+ },
304
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
305
+ const ret = debugString(arg1);
306
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
307
+ const len1 = WASM_VECTOR_LEN;
308
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
309
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
310
+ },
311
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
312
+ const ret = arg0 in arg1;
171
313
  return ret;
172
314
  },
173
- __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
315
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
316
+ const ret = typeof(arg0) === 'function';
317
+ return ret;
318
+ },
319
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
320
+ const ret = arg0 === null;
321
+ return ret;
322
+ },
323
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
324
+ const val = arg0;
325
+ const ret = typeof(val) === 'object' && val !== null;
326
+ return ret;
327
+ },
328
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
329
+ const ret = typeof(arg0) === 'string';
330
+ return ret;
331
+ },
332
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
333
+ const ret = arg0 === undefined;
334
+ return ret;
335
+ },
336
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
337
+ const ret = arg0 == arg1;
338
+ return ret;
339
+ },
340
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
341
+ const obj = arg1;
342
+ const ret = typeof(obj) === 'number' ? obj : undefined;
343
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
344
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
345
+ },
346
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
347
+ const obj = arg1;
348
+ const ret = typeof(obj) === 'string' ? obj : undefined;
349
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
350
+ var len1 = WASM_VECTOR_LEN;
351
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
352
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
353
+ },
354
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
174
355
  throw new Error(getStringFromWasm0(arg0, arg1));
175
356
  },
176
- __wbg_new_361308b2356cecd0: function() {
177
- const ret = new Object();
178
- return addHeapObject(ret);
357
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
358
+ const ret = arg0.call(arg1);
359
+ return ret;
360
+ }, arguments); },
361
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
362
+ const ret = arg0.call(arg1, arg2);
363
+ return ret;
364
+ }, arguments); },
365
+ __wbg_done_89b2b13e91a60321: function(arg0) {
366
+ const ret = arg0.done;
367
+ return ret;
368
+ },
369
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
370
+ const ret = Reflect.get(arg0, arg1);
371
+ return ret;
372
+ }, arguments); },
373
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
374
+ const ret = arg0[arg1 >>> 0];
375
+ return ret;
376
+ },
377
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
378
+ const ret = arg0[arg1];
379
+ return ret;
380
+ },
381
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
382
+ let result;
383
+ try {
384
+ result = arg0 instanceof ArrayBuffer;
385
+ } catch (_) {
386
+ result = false;
387
+ }
388
+ const ret = result;
389
+ return ret;
390
+ },
391
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
392
+ let result;
393
+ try {
394
+ result = arg0 instanceof Uint8Array;
395
+ } catch (_) {
396
+ result = false;
397
+ }
398
+ const ret = result;
399
+ return ret;
400
+ },
401
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
402
+ const ret = Array.isArray(arg0);
403
+ return ret;
404
+ },
405
+ __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
406
+ const ret = Number.isSafeInteger(arg0);
407
+ return ret;
179
408
  },
180
- __wbg_new_3eb36ae241fe6f44: function() {
409
+ __wbg_iterator_6f722e4a93058b71: function() {
410
+ const ret = Symbol.iterator;
411
+ return ret;
412
+ },
413
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
414
+ const ret = arg0.length;
415
+ return ret;
416
+ },
417
+ __wbg_length_370319915dc99107: function(arg0) {
418
+ const ret = arg0.length;
419
+ return ret;
420
+ },
421
+ __wbg_new_32b398fb48b6d94a: function() {
181
422
  const ret = new Array();
182
- return addHeapObject(ret);
423
+ return ret;
183
424
  },
184
- __wbg_new_dca287b076112a51: function() {
425
+ __wbg_new_7796ffc7ed656783: function() {
185
426
  const ret = new Map();
186
- return addHeapObject(ret);
427
+ return ret;
428
+ },
429
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
430
+ const ret = new Uint8Array(arg0);
431
+ return ret;
187
432
  },
188
- __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
189
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
190
- return addHeapObject(ret);
433
+ __wbg_new_da52cf8fe3429cb2: function() {
434
+ const ret = new Object();
435
+ return ret;
436
+ },
437
+ __wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
438
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
439
+ return ret;
191
440
  },
192
- __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
193
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
441
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
442
+ const ret = arg0.next;
443
+ return ret;
194
444
  },
195
- __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
196
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
445
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
446
+ const ret = arg0.next();
447
+ return ret;
448
+ }, arguments); },
449
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
450
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
197
451
  },
198
- __wbg_warn_cf65167dc0d7a3d1: function(arg0, arg1) {
452
+ __wbg_set_575dd786d51585f8: function(arg0, arg1, arg2) {
453
+ const ret = arg0.set(arg1, arg2);
454
+ return ret;
455
+ },
456
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
457
+ arg0[arg1] = arg2;
458
+ },
459
+ __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
460
+ arg0[arg1 >>> 0] = arg2;
461
+ },
462
+ __wbg_value_a5d5488a9589444a: function(arg0) {
463
+ const ret = arg0.value;
464
+ return ret;
465
+ },
466
+ __wbg_warn_8bb2cd442b445478: function(arg0, arg1) {
199
467
  console.warn(getStringFromWasm0(arg0, arg1));
200
468
  },
201
469
  __wbindgen_cast_0000000000000001: function(arg0) {
202
470
  // Cast intrinsic for `F64 -> Externref`.
203
471
  const ret = arg0;
204
- return addHeapObject(ret);
472
+ return ret;
205
473
  },
206
474
  __wbindgen_cast_0000000000000002: function(arg0) {
207
475
  // Cast intrinsic for `I64 -> Externref`.
208
476
  const ret = arg0;
209
- return addHeapObject(ret);
477
+ return ret;
210
478
  },
211
479
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
212
480
  // Cast intrinsic for `Ref(String) -> Externref`.
213
481
  const ret = getStringFromWasm0(arg0, arg1);
214
- return addHeapObject(ret);
482
+ return ret;
215
483
  },
216
484
  __wbindgen_cast_0000000000000004: function(arg0) {
217
485
  // Cast intrinsic for `U64 -> Externref`.
218
486
  const ret = BigInt.asUintN(64, arg0);
219
- return addHeapObject(ret);
220
- },
221
- __wbindgen_object_clone_ref: function(arg0) {
222
- const ret = getObject(arg0);
223
- return addHeapObject(ret);
487
+ return ret;
224
488
  },
225
- __wbindgen_object_drop_ref: function(arg0) {
226
- takeObject(arg0);
489
+ __wbindgen_init_externref_table: function() {
490
+ const table = wasm.__wbindgen_externrefs;
491
+ const offset = table.grow(4);
492
+ table.set(0, undefined);
493
+ table.set(offset + 0, undefined);
494
+ table.set(offset + 1, null);
495
+ table.set(offset + 2, true);
496
+ table.set(offset + 3, false);
227
497
  },
228
498
  };
229
499
  return {
@@ -232,23 +502,85 @@ function __wbg_get_imports() {
232
502
  };
233
503
  }
234
504
 
505
+ const AixPackResultWasmFinalization = (typeof FinalizationRegistry === 'undefined')
506
+ ? { register: () => {}, unregister: () => {} }
507
+ : new FinalizationRegistry(ptr => wasm.__wbg_aixpackresultwasm_free(ptr, 1));
235
508
  const AixReaderWasmFinalization = (typeof FinalizationRegistry === 'undefined')
236
509
  ? { register: () => {}, unregister: () => {} }
237
- : new FinalizationRegistry(ptr => wasm.__wbg_aixreaderwasm_free(ptr >>> 0, 1));
238
-
239
- function addHeapObject(obj) {
240
- if (heap_next === heap.length) heap.push(heap.length + 1);
241
- const idx = heap_next;
242
- heap_next = heap[idx];
510
+ : new FinalizationRegistry(ptr => wasm.__wbg_aixreaderwasm_free(ptr, 1));
511
+ const AixSourcePackBuilderWasmFinalization = (typeof FinalizationRegistry === 'undefined')
512
+ ? { register: () => {}, unregister: () => {} }
513
+ : new FinalizationRegistry(ptr => wasm.__wbg_aixsourcepackbuilderwasm_free(ptr, 1));
243
514
 
244
- heap[idx] = obj;
515
+ function addToExternrefTable0(obj) {
516
+ const idx = wasm.__externref_table_alloc();
517
+ wasm.__wbindgen_externrefs.set(idx, obj);
245
518
  return idx;
246
519
  }
247
520
 
248
- function dropObject(idx) {
249
- if (idx < 132) return;
250
- heap[idx] = heap_next;
251
- heap_next = idx;
521
+ function debugString(val) {
522
+ // primitive types
523
+ const type = typeof val;
524
+ if (type == 'number' || type == 'boolean' || val == null) {
525
+ return `${val}`;
526
+ }
527
+ if (type == 'string') {
528
+ return `"${val}"`;
529
+ }
530
+ if (type == 'symbol') {
531
+ const description = val.description;
532
+ if (description == null) {
533
+ return 'Symbol';
534
+ } else {
535
+ return `Symbol(${description})`;
536
+ }
537
+ }
538
+ if (type == 'function') {
539
+ const name = val.name;
540
+ if (typeof name == 'string' && name.length > 0) {
541
+ return `Function(${name})`;
542
+ } else {
543
+ return 'Function';
544
+ }
545
+ }
546
+ // objects
547
+ if (Array.isArray(val)) {
548
+ const length = val.length;
549
+ let debug = '[';
550
+ if (length > 0) {
551
+ debug += debugString(val[0]);
552
+ }
553
+ for(let i = 1; i < length; i++) {
554
+ debug += ', ' + debugString(val[i]);
555
+ }
556
+ debug += ']';
557
+ return debug;
558
+ }
559
+ // Test for built-in
560
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
561
+ let className;
562
+ if (builtInMatches && builtInMatches.length > 1) {
563
+ className = builtInMatches[1];
564
+ } else {
565
+ // Failed to match the standard '[object ClassName]'
566
+ return toString.call(val);
567
+ }
568
+ if (className == 'Object') {
569
+ // we're a user defined class or Object
570
+ // JSON.stringify avoids problems with cycles, and is generally much
571
+ // easier than looping through ownProperties of `val`.
572
+ try {
573
+ return 'Object(' + JSON.stringify(val) + ')';
574
+ } catch (_) {
575
+ return 'Object';
576
+ }
577
+ }
578
+ // errors
579
+ if (val instanceof Error) {
580
+ return `${val.name}: ${val.message}\n${val.stack}`;
581
+ }
582
+ // TODO we could test for more things here, like `Set`s and `Map`s.
583
+ return className;
252
584
  }
253
585
 
254
586
  function getArrayU8FromWasm0(ptr, len) {
@@ -265,8 +597,7 @@ function getDataViewMemory0() {
265
597
  }
266
598
 
267
599
  function getStringFromWasm0(ptr, len) {
268
- ptr = ptr >>> 0;
269
- return decodeText(ptr, len);
600
+ return decodeText(ptr >>> 0, len);
270
601
  }
271
602
 
272
603
  let cachedUint8ArrayMemory0 = null;
@@ -277,12 +608,18 @@ function getUint8ArrayMemory0() {
277
608
  return cachedUint8ArrayMemory0;
278
609
  }
279
610
 
280
- function getObject(idx) { return heap[idx]; }
281
-
282
- let heap = new Array(128).fill(undefined);
283
- heap.push(undefined, null, true, false);
611
+ function handleError(f, args) {
612
+ try {
613
+ return f.apply(this, args);
614
+ } catch (e) {
615
+ const idx = addToExternrefTable0(e);
616
+ wasm.__wbindgen_exn_store(idx);
617
+ }
618
+ }
284
619
 
285
- let heap_next = heap.length;
620
+ function isLikeNone(x) {
621
+ return x === undefined || x === null;
622
+ }
286
623
 
287
624
  function passArray8ToWasm0(arg, malloc) {
288
625
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -328,10 +665,10 @@ function passStringToWasm0(arg, malloc, realloc) {
328
665
  return ptr;
329
666
  }
330
667
 
331
- function takeObject(idx) {
332
- const ret = getObject(idx);
333
- dropObject(idx);
334
- return ret;
668
+ function takeFromExternrefTable0(idx) {
669
+ const value = wasm.__wbindgen_externrefs.get(idx);
670
+ wasm.__externref_table_dealloc(idx);
671
+ return value;
335
672
  }
336
673
 
337
674
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -363,12 +700,14 @@ if (!('encodeInto' in cachedTextEncoder)) {
363
700
 
364
701
  let WASM_VECTOR_LEN = 0;
365
702
 
366
- let wasmModule, wasm;
703
+ let wasmModule, wasmInstance, wasm;
367
704
  function __wbg_finalize_init(instance, module) {
705
+ wasmInstance = instance;
368
706
  wasm = instance.exports;
369
707
  wasmModule = module;
370
708
  cachedDataViewMemory0 = null;
371
709
  cachedUint8ArrayMemory0 = null;
710
+ wasm.__wbindgen_start();
372
711
  return wasm;
373
712
  }
374
713
 
Binary file
@@ -1,15 +1,32 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_aixpackresultwasm_free: (a: number, b: number) => void;
4
5
  export const __wbg_aixreaderwasm_free: (a: number, b: number) => void;
5
- export const aixreaderwasm_get_pages: (a: number, b: number) => void;
6
- export const aixreaderwasm_get_title: (a: number, b: number) => void;
7
- export const aixreaderwasm_get_tools: (a: number, b: number) => void;
8
- export const aixreaderwasm_get_version: (a: number, b: number) => void;
9
- export const aixreaderwasm_list: (a: number, b: number) => void;
10
- export const aixreaderwasm_new: (a: number, b: number, c: number) => void;
11
- export const aixreaderwasm_read_file: (a: number, b: number, c: number, d: number) => void;
12
- export const __wbindgen_export: (a: number, b: number) => number;
13
- export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
14
- export const __wbindgen_add_to_stack_pointer: (a: number) => number;
15
- export const __wbindgen_export3: (a: number, b: number, c: number) => void;
6
+ export const __wbg_aixsourcepackbuilderwasm_free: (a: number, b: number) => void;
7
+ export const aixpackresultwasm_data: (a: number) => any;
8
+ export const aixpackresultwasm_report: (a: number) => [number, number, number];
9
+ export const aixpackresultwasm_warnings: (a: number) => [number, number, number];
10
+ export const aixreaderwasm_get_pages: (a: number) => [number, number, number];
11
+ export const aixreaderwasm_get_title: (a: number) => [number, number];
12
+ export const aixreaderwasm_get_tools: (a: number) => [number, number, number];
13
+ export const aixreaderwasm_get_version: (a: number) => [number, number];
14
+ export const aixreaderwasm_list: (a: number) => [number, number, number];
15
+ export const aixreaderwasm_new: (a: number, b: number) => [number, number, number];
16
+ export const aixreaderwasm_read_file: (a: number, b: number, c: number) => [number, number, number, number];
17
+ export const aixreaderwasm_supports_engine: (a: number, b: number, c: number) => [number, number, number];
18
+ export const aixsourcepackbuilderwasm_add_file: (a: number, b: number, c: number, d: number, e: number) => void;
19
+ export const aixsourcepackbuilderwasm_new: () => number;
20
+ export const aixsourcepackbuilderwasm_pack_from_source_with_progress: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => [number, number, number];
21
+ export const optimize_aix: (a: number, b: number, c: any) => [number, number, number];
22
+ export const pack_aix: (a: any, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
23
+ export const pack_aix_from_source: (a: any, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
24
+ export const pack_aix_from_source_with_progress: (a: any, b: number, c: number, d: number, e: number, f: any, g: any) => [number, number, number];
25
+ export const __wbindgen_malloc: (a: number, b: number) => number;
26
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
27
+ export const __wbindgen_exn_store: (a: number) => void;
28
+ export const __externref_table_alloc: () => number;
29
+ export const __wbindgen_externrefs: WebAssembly.Table;
30
+ export const __externref_table_dealloc: (a: number) => void;
31
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
32
+ export const __wbindgen_start: () => void;
package/pkg/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "aix-web",
3
- "version": "0.6.0",
2
+ "name": "aiui-aix-web",
3
+ "version": "0.8.2",
4
4
  "files": [
5
5
  "aix_web_bg.wasm",
6
6
  "aix_web.js",
@@ -10,5 +10,6 @@
10
10
  "types": "aix_web.d.ts",
11
11
  "sideEffects": [
12
12
  "./snippets/*"
13
- ]
13
+ ],
14
+ "type": "module"
14
15
  }