porffor 0.18.26 → 0.18.27

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.
@@ -382,6 +382,22 @@ export const __Array_prototype_map = (_this: any[], callbackFn: any) => {
382
382
  return out;
383
383
  };
384
384
 
385
+ export const __Array_prototype_flatMap = (_this: any[], callbackFn: any) => {
386
+ const len: i32 = _this.length;
387
+ const out: any[] = Porffor.allocate();
388
+
389
+ let i: i32 = 0, j: i32 = 0;
390
+ while (i < len) {
391
+ let x: any = callbackFn(_this[i], i++, _this);
392
+ if (Porffor.rawType(x) == Porffor.TYPES.array) {
393
+ for (const y of x) out[j++] = y;
394
+ } else out[j++] = x;
395
+ }
396
+
397
+ out.length = j;
398
+ return out;
399
+ };
400
+
385
401
  // @porf-typed-array
386
402
  export const __Array_prototype_find = (_this: any[], callbackFn: any) => {
387
403
  const len: i32 = _this.length;
@@ -248,6 +248,13 @@ export const BuiltinFuncs = function() {
248
248
  locals: [124,124,127,124,124,124,127,127,127,124,127,124,127,124,127,127,127], localNames: ["_this","_this#type","callbackFn","callbackFn#type","len","out","#last_type","__length_setter_tmp","i","#member_setter_val_tmp","#member_setter_ptr_tmp","#loadArray_offset","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_func","#indirect_flags","#typeswitch_tmp"],
249
249
  table: 1,
250
250
  };
251
+ this.__Array_prototype_flatMap = {
252
+ wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[16, builtin('__Porffor_allocate')],[33,6],[33,5],[68,0,0,0,0,0,0,0,0],[33,7],[68,0,0,0,0,0,0,0,0],[33,8],[3,64],[32,7],[32,4],[99],[4,64],[32,3],[33,20],[2,124],[32,20],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,7],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,11],[43,0,4],[32,11],[45,0,12],[34,6],[33,12],[33,13],[32,7],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[32,6],[33,14],[33,15],[32,0],[65,208,0],[33,16],[33,17],[32,2],[252,3],[34,18],[65,3],[108],[65,2],[106],[45,0,0,"read func lut"],[34,19],[65,2],[113],[69],[65,0],[113],[4,64],...internalThrow(scope, 'TypeError', `callbackFn is not a constructor`),[11],[2,124],[2,64],[2,64],[2,64],[2,64],[32,18],[65,3],[108],[47,0,0,"read func lut"],[14,4,0,1,2,3,0],[11],[32,19],[65,1],[113],[4,124],[32,19],[65,2],[113],[4,124],[65,0],[32,18],[17,0,0,"no_type_return","constr"],[5],[32,18],[17,0,0,"no_type_return"],[11],[5],[32,19],[65,2],[113],[4,124],[65,0],[32,18],[17,0,0,"constr"],[33,6],[5],[32,18],[17,0,0],[33,6],[11],[11],[12,3],[11],[32,19],[65,1],[113],[4,124],[32,19],[65,2],[113],[4,124],[65,0],[32,13],[32,12],[32,18],[17,1,0,"no_type_return","constr"],[5],[32,13],[32,12],[32,18],[17,1,0,"no_type_return"],[11],[5],[32,19],[65,2],[113],[4,124],[65,0],[32,13],[32,12],[32,18],[17,1,0,"constr"],[33,6],[5],[32,13],[32,12],[32,18],[17,1,0],[33,6],[11],[11],[12,2],[11],[32,19],[65,1],[113],[4,124],[32,19],[65,2],[113],[4,124],[65,0],[32,13],[32,12],[32,15],[32,14],[32,18],[17,2,0,"no_type_return","constr"],[5],[32,13],[32,12],[32,15],[32,14],[32,18],[17,2,0,"no_type_return"],[11],[5],[32,19],[65,2],[113],[4,124],[65,0],[32,13],[32,12],[32,15],[32,14],[32,18],[17,2,0,"constr"],[33,6],[5],[32,13],[32,12],[32,15],[32,14],[32,18],[17,2,0],[33,6],[11],[11],[12,1],[11],[32,19],[65,1],[113],[4,124],[32,19],[65,2],[113],[4,124],[65,0],[32,13],[32,12],[32,15],[32,14],[32,17],[32,16],[32,18],[17,3,0,"no_type_return","constr"],[5],[32,13],[32,12],[32,15],[32,14],[32,17],[32,16],[32,18],[17,3,0,"no_type_return"],[11],[5],[32,19],[65,2],[113],[4,124],[65,0],[32,13],[32,12],[32,15],[32,14],[32,17],[32,16],[32,18],[17,3,0,"constr"],[33,6],[5],[32,13],[32,12],[32,15],[32,14],[32,17],[32,16],[32,18],[17,3,0],[33,6],[11],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,9],[32,6],[33,10],[32,9],[32,10],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,84,64],[97],[4,64],[32,9],[252,3],[33,21],[65,0],[33,23],[32,21],[40,1,0],[33,22],[32,10],[33,20],[2,64],[32,20],[65,19],[70],[4,64,"TYPESWITCH|Set"],[3,64],[32,21],[43,0,4],[32,21],[45,0,12],[33,25],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,21],[65,9],[106],[33,21],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[65,194,0],[33,25],[65,0],[65,1],[54,0,0],[3,64],[65,0],[32,21],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,0,0],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,21],[65,2],[106],[33,21],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[3,64],[32,21],[43,0,4],[32,21],[45,0,12],[33,25],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,21],[65,9],[106],[33,21],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,215,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[106],[45,0,4],[184],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,216,0],[70],[4,64,"TYPESWITCH|Int8Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[106],[44,0,4],[183],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,217,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[106],[45,0,4],[184],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,218,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[65,2],[108],[106],[47,0,4],[184],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,219,0],[70],[4,64,"TYPESWITCH|Int16Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[65,2],[108],[106],[46,0,4],[183],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,220,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[65,4],[108],[106],[40,0,4],[184],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,221,0],[70],[4,64,"TYPESWITCH|Int32Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[65,4],[108],[106],[40,0,4],[183],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,222,0],[70],[4,64,"TYPESWITCH|Float32Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[65,4],[108],[106],[42,0,4],[187],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,223,0],[70],[4,64,"TYPESWITCH|Float64Array"],[65,0],[33,25],[3,64],[32,21],[40,0,4],[32,23],[65,8],[108],[106],[43,0,4],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],[32,20],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,194,1],[33,25],[65,0],[65,1],[54,0,0],[3,64],[65,0],[32,21],[32,23],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,0,0],[33,24],[2,64],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,24],[34,26],[57,0,4],[32,27],[32,25],[58,0,12],[32,23],[65,1],[106],[34,23],[32,22],[71],[13,1],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `Tried for..of on non-iterable type`),[11,"TYPESWITCH_end"],[5],[32,5],[252,3],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,3],[65,9],[108],[106],[34,27],[32,9],[34,26],[57,0,4],[32,27],[32,10],[58,0,12],[11],[12,1],[11],[11],[32,5],[252,3],[32,8],[34,28],[252,3],[54,1,0],[32,5],[65,208,0],[15]],
253
+ params: [124,127,124,127], typedParams: 1,
254
+ returns: [124,127], typedReturns: 1,
255
+ locals: [124,124,127,124,124,124,127,127,127,124,127,124,127,124,127,127,127,127,127,127,124,127,124,127,124], localNames: ["_this","_this#type","callbackFn","callbackFn#type","len","out","#last_type","i","j","x","x#type","#loadArray_offset","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_func","#indirect_flags","#typeswitch_tmp","forof_base_pointer","forof_length","forof_counter","y","y#type","#member_setter_val_tmp","#member_setter_ptr_tmp","__length_setter_tmp"],
256
+ table: 1,
257
+ };
251
258
  this.__Array_prototype_find = {
252
259
  wasm: (scope, {internalThrow}) => [[32,0],[252,3],[40,1,0],[184],[33,4],[68,0,0,0,0,0,0,0,0],[33,5],[3,64],[32,5],[32,4],[99],[4,64],[32,5],[252,3],[65,9],[108],[32,0],[252,3],[106],[34,8],[43,0,4],[32,8],[45,0,12],[33,9],[33,6],[32,9],[33,7],[32,3],[33,18],[2,124],[32,18],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,6],[32,7],[33,10],[33,11],[32,5],[32,5],[68,0,0,0,0,0,0,240,63],[160],[33,5],[32,9],[33,12],[33,13],[32,0],[65,208,0],[33,14],[33,15],[32,2],[252,3],[34,16],[65,3],[108],[65,2],[106],[45,0,0,"read func lut"],[34,17],[65,2],[113],[69],[65,0],[113],[4,64],...internalThrow(scope, 'TypeError', `callbackFn is not a constructor`),[11],[2,124],[2,64],[2,64],[2,64],[2,64],[32,16],[65,3],[108],[47,0,0,"read func lut"],[14,4,0,1,2,3,0],[11],[32,17],[65,1],[113],[4,124],[32,17],[65,2],[113],[4,124],[65,0],[32,16],[17,0,0,"no_type_return","constr"],[5],[32,16],[17,0,0,"no_type_return"],[11],[5],[32,17],[65,2],[113],[4,124],[65,0],[32,16],[17,0,0,"constr"],[33,9],[5],[32,16],[17,0,0],[33,9],[11],[11],[12,3],[11],[32,17],[65,1],[113],[4,124],[32,17],[65,2],[113],[4,124],[65,0],[32,11],[32,10],[32,16],[17,1,0,"no_type_return","constr"],[5],[32,11],[32,10],[32,16],[17,1,0,"no_type_return"],[11],[5],[32,17],[65,2],[113],[4,124],[65,0],[32,11],[32,10],[32,16],[17,1,0,"constr"],[33,9],[5],[32,11],[32,10],[32,16],[17,1,0],[33,9],[11],[11],[12,2],[11],[32,17],[65,1],[113],[4,124],[32,17],[65,2],[113],[4,124],[65,0],[32,11],[32,10],[32,13],[32,12],[32,16],[17,2,0,"no_type_return","constr"],[5],[32,11],[32,10],[32,13],[32,12],[32,16],[17,2,0,"no_type_return"],[11],[5],[32,17],[65,2],[113],[4,124],[65,0],[32,11],[32,10],[32,13],[32,12],[32,16],[17,2,0,"constr"],[33,9],[5],[32,11],[32,10],[32,13],[32,12],[32,16],[17,2,0],[33,9],[11],[11],[12,1],[11],[32,17],[65,1],[113],[4,124],[32,17],[65,2],[113],[4,124],[65,0],[32,11],[32,10],[32,13],[32,12],[32,15],[32,14],[32,16],[17,3,0,"no_type_return","constr"],[5],[32,11],[32,10],[32,13],[32,12],[32,15],[32,14],[32,16],[17,3,0,"no_type_return"],[11],[5],[32,17],[65,2],[113],[4,124],[65,0],[32,11],[32,10],[32,13],[32,12],[32,15],[32,14],[32,16],[17,3,0,"constr"],[33,9],[5],[32,11],[32,10],[32,13],[32,12],[32,15],[32,14],[32,16],[17,3,0],[33,9],[11],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[33,19],[32,9],[33,18],[2,124],[32,18],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[32,19],[252,3],[40,1,0],[184],[12,1],[11],[32,18],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,19],[252,3],[40,1,0],[184],[12,1],[11],[32,19],[252,2],[69],[69],[183],[11,"TYPESWITCH_end"],[252,3],[4,64],[32,6],[32,7],[15],[11],[12,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
253
260
  params: [124,127,124,127], typedParams: 1,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.18.26+ea1b93f98",
4
+ "version": "0.18.27+71e285b9b",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.18.26+ea1b93f98';
3
+ globalThis.version = '0.18.27+71e285b9b';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {