@yodaos-pkg/aix 0.7.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
@@ -76,6 +76,22 @@ http://localhost:5173/aix/play
76
76
 
77
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
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.
94
+
79
95
  ## API Reference
80
96
 
81
97
  ### `AIX` Class
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.7.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.7.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
@@ -76,6 +76,22 @@ http://localhost:5173/aix/play
76
76
 
77
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
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.
94
+
79
95
  ## API Reference
80
96
 
81
97
  ### `AIX` Class
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,13 +20,35 @@ 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;
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];
21
52
  readonly aixreaderwasm_get_pages: (a: number) => [number, number, number];
22
53
  readonly aixreaderwasm_get_title: (a: number) => [number, number];
23
54
  readonly aixreaderwasm_get_tools: (a: number) => [number, number, number];
@@ -25,8 +56,18 @@ export interface InitOutput {
25
56
  readonly aixreaderwasm_list: (a: number) => [number, number, number];
26
57
  readonly aixreaderwasm_new: (a: number, b: number) => [number, number, number];
27
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];
28
67
  readonly __wbindgen_malloc: (a: number, b: number) => number;
29
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;
30
71
  readonly __wbindgen_externrefs: WebAssembly.Table;
31
72
  readonly __externref_table_dealloc: (a: number) => void;
32
73
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
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;
@@ -94,8 +141,143 @@ export class AixReaderWasm {
94
141
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
95
142
  return v2;
96
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]);
154
+ }
155
+ return ret[0] !== 0;
156
+ }
97
157
  }
98
158
  if (Symbol.dispose) AixReaderWasm.prototype[Symbol.dispose] = AixReaderWasm.prototype.free;
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
+ }
99
281
  function __wbg_get_imports() {
100
282
  const import0 = {
101
283
  __proto__: null,
@@ -103,6 +285,10 @@ function __wbg_get_imports() {
103
285
  const ret = Error(getStringFromWasm0(arg0, arg1));
104
286
  return ret;
105
287
  },
288
+ __wbg_Number_9a4e0ecb0fa16705: function(arg0) {
289
+ const ret = Number(arg0);
290
+ return ret;
291
+ },
106
292
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
107
293
  const ret = String(arg1);
108
294
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -110,13 +296,128 @@ function __wbg_get_imports() {
110
296
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
111
297
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
112
298
  },
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;
313
+ return ret;
314
+ },
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
+ },
113
328
  __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
114
329
  const ret = typeof(arg0) === 'string';
115
330
  return ret;
116
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
+ },
117
354
  __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
118
355
  throw new Error(getStringFromWasm0(arg0, arg1));
119
356
  },
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;
408
+ },
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
+ },
120
421
  __wbg_new_32b398fb48b6d94a: function() {
121
422
  const ret = new Array();
122
423
  return ret;
@@ -125,10 +426,29 @@ function __wbg_get_imports() {
125
426
  const ret = new Map();
126
427
  return ret;
127
428
  },
429
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
430
+ const ret = new Uint8Array(arg0);
431
+ return ret;
432
+ },
128
433
  __wbg_new_da52cf8fe3429cb2: function() {
129
434
  const ret = new Object();
130
435
  return ret;
131
436
  },
437
+ __wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
438
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
439
+ return ret;
440
+ },
441
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
442
+ const ret = arg0.next;
443
+ return ret;
444
+ },
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);
451
+ },
132
452
  __wbg_set_575dd786d51585f8: function(arg0, arg1, arg2) {
133
453
  const ret = arg0.set(arg1, arg2);
134
454
  return ret;
@@ -139,7 +459,11 @@ function __wbg_get_imports() {
139
459
  __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
140
460
  arg0[arg1 >>> 0] = arg2;
141
461
  },
142
- __wbg_warn_faa1de0d37661523: function(arg0, arg1) {
462
+ __wbg_value_a5d5488a9589444a: function(arg0) {
463
+ const ret = arg0.value;
464
+ return ret;
465
+ },
466
+ __wbg_warn_8bb2cd442b445478: function(arg0, arg1) {
143
467
  console.warn(getStringFromWasm0(arg0, arg1));
144
468
  },
145
469
  __wbindgen_cast_0000000000000001: function(arg0) {
@@ -178,9 +502,86 @@ function __wbg_get_imports() {
178
502
  };
179
503
  }
180
504
 
505
+ const AixPackResultWasmFinalization = (typeof FinalizationRegistry === 'undefined')
506
+ ? { register: () => {}, unregister: () => {} }
507
+ : new FinalizationRegistry(ptr => wasm.__wbg_aixpackresultwasm_free(ptr, 1));
181
508
  const AixReaderWasmFinalization = (typeof FinalizationRegistry === 'undefined')
182
509
  ? { register: () => {}, unregister: () => {} }
183
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));
514
+
515
+ function addToExternrefTable0(obj) {
516
+ const idx = wasm.__externref_table_alloc();
517
+ wasm.__wbindgen_externrefs.set(idx, obj);
518
+ return idx;
519
+ }
520
+
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;
584
+ }
184
585
 
185
586
  function getArrayU8FromWasm0(ptr, len) {
186
587
  ptr = ptr >>> 0;
@@ -207,6 +608,19 @@ function getUint8ArrayMemory0() {
207
608
  return cachedUint8ArrayMemory0;
208
609
  }
209
610
 
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
+ }
619
+
620
+ function isLikeNone(x) {
621
+ return x === undefined || x === null;
622
+ }
623
+
210
624
  function passArray8ToWasm0(arg, malloc) {
211
625
  const ptr = malloc(arg.length * 1, 1) >>> 0;
212
626
  getUint8ArrayMemory0().set(arg, ptr / 1);
Binary file
@@ -1,7 +1,12 @@
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;
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];
5
10
  export const aixreaderwasm_get_pages: (a: number) => [number, number, number];
6
11
  export const aixreaderwasm_get_title: (a: number) => [number, number];
7
12
  export const aixreaderwasm_get_tools: (a: number) => [number, number, number];
@@ -9,8 +14,18 @@ export const aixreaderwasm_get_version: (a: number) => [number, number];
9
14
  export const aixreaderwasm_list: (a: number) => [number, number, number];
10
15
  export const aixreaderwasm_new: (a: number, b: number) => [number, number, number];
11
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];
12
25
  export const __wbindgen_malloc: (a: number, b: number) => number;
13
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;
14
29
  export const __wbindgen_externrefs: WebAssembly.Table;
15
30
  export const __externref_table_dealloc: (a: number) => void;
16
31
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
package/pkg/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiui-aix-web",
3
- "version": "0.7.0",
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
  }