@influxdata/flux
Advanced tools
Comparing version 0.4.0 to 0.5.0
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* @param {any} js_file | ||
* @returns {string} | ||
*/ | ||
export function format_from_js_file(js_file: any): string; | ||
/** | ||
* @param {string} s | ||
@@ -7,6 +13,1 @@ * @returns {any} | ||
export function parse(s: string): any; | ||
/** | ||
* @param {any} js_file | ||
* @returns {string} | ||
*/ | ||
export function format_from_js_file(js_file: any): string; |
167
flux.js
import * as wasm from './flux_bg.wasm'; | ||
const heap = new Array(32).fill(undefined); | ||
heap.push(undefined, null, true, false); | ||
function getObject(idx) { return heap[idx]; } | ||
let heap_next = heap.length; | ||
function dropObject(idx) { | ||
if (idx < 36) return; | ||
heap[idx] = heap_next; | ||
heap_next = idx; | ||
} | ||
function takeObject(idx) { | ||
const ret = getObject(idx); | ||
dropObject(idx); | ||
return ret; | ||
} | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
let cachegetUint8Memory0 = null; | ||
function getUint8Memory0() { | ||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachegetUint8Memory0; | ||
} | ||
function getStringFromWasm0(ptr, len) { | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
const lTextEncoder = typeof TextEncoder === 'undefined' ? require('util').TextEncoder : TextEncoder; | ||
let cachedTextEncoder = new TextEncoder('utf-8'); | ||
let cachedTextEncoder = new lTextEncoder('utf-8'); | ||
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' | ||
@@ -22,16 +65,16 @@ ? function (arg, view) { | ||
let cachegetUint8Memory = null; | ||
function getUint8Memory() { | ||
if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { | ||
cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); | ||
function passStringToWasm0(arg, malloc, realloc) { | ||
if (realloc === undefined) { | ||
const buf = cachedTextEncoder.encode(arg); | ||
const ptr = malloc(buf.length); | ||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); | ||
WASM_VECTOR_LEN = buf.length; | ||
return ptr; | ||
} | ||
return cachegetUint8Memory; | ||
} | ||
function passStringToWasm(arg) { | ||
let len = arg.length; | ||
let ptr = wasm.__wbindgen_malloc(len); | ||
let ptr = malloc(len); | ||
const mem = getUint8Memory(); | ||
const mem = getUint8Memory0(); | ||
@@ -50,4 +93,4 @@ let offset = 0; | ||
} | ||
ptr = wasm.__wbindgen_realloc(ptr, len, len = offset + arg.length * 3); | ||
const view = getUint8Memory().subarray(ptr + offset, ptr + len); | ||
ptr = realloc(ptr, len, len = offset + arg.length * 3); | ||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len); | ||
const ret = encodeString(arg, view); | ||
@@ -62,23 +105,24 @@ | ||
const heap = new Array(32); | ||
heap.fill(undefined); | ||
heap.push(undefined, null, true, false); | ||
function getObject(idx) { return heap[idx]; } | ||
let heap_next = heap.length; | ||
function dropObject(idx) { | ||
if (idx < 36) return; | ||
heap[idx] = heap_next; | ||
heap_next = idx; | ||
let cachegetInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachegetInt32Memory0; | ||
} | ||
/** | ||
* @param {any} js_file | ||
* @returns {string} | ||
*/ | ||
export function format_from_js_file(js_file) { | ||
try { | ||
wasm.format_from_js_file(8, addHeapObject(js_file)); | ||
var r0 = getInt32Memory0()[8 / 4 + 0]; | ||
var r1 = getInt32Memory0()[8 / 4 + 1]; | ||
return getStringFromWasm0(r0, r1); | ||
} finally { | ||
wasm.__wbindgen_free(r0, r1); | ||
} | ||
} | ||
function takeObject(idx) { | ||
const ret = getObject(idx); | ||
dropObject(idx); | ||
return ret; | ||
} | ||
/** | ||
@@ -89,45 +133,8 @@ * @param {string} s | ||
export function parse(s) { | ||
const ret = wasm.parse(passStringToWasm(s), WASM_VECTOR_LEN); | ||
var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len0 = WASM_VECTOR_LEN; | ||
var ret = wasm.parse(ptr0, len0); | ||
return takeObject(ret); | ||
} | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let cachegetInt32Memory = null; | ||
function getInt32Memory() { | ||
if (cachegetInt32Memory === null || cachegetInt32Memory.buffer !== wasm.memory.buffer) { | ||
cachegetInt32Memory = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachegetInt32Memory; | ||
} | ||
const lTextDecoder = typeof TextDecoder === 'undefined' ? require('util').TextDecoder : TextDecoder; | ||
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
function getStringFromWasm(ptr, len) { | ||
return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); | ||
} | ||
/** | ||
* @param {any} js_file | ||
* @returns {string} | ||
*/ | ||
export function format_from_js_file(js_file) { | ||
const retptr = 8; | ||
const ret = wasm.format_from_js_file(retptr, addHeapObject(js_file)); | ||
const memi32 = getInt32Memory(); | ||
const v0 = getStringFromWasm(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1]).slice(); | ||
wasm.__wbindgen_free(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1] * 1); | ||
return v0; | ||
} | ||
export const __wbindgen_object_drop_ref = function(arg0) { | ||
@@ -138,3 +145,3 @@ takeObject(arg0); | ||
export const __wbindgen_json_parse = function(arg0, arg1) { | ||
const ret = JSON.parse(getStringFromWasm(arg0, arg1)); | ||
var ret = JSON.parse(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
@@ -145,8 +152,8 @@ }; | ||
const obj = getObject(arg1); | ||
const ret = JSON.stringify(obj === undefined ? null : obj); | ||
const ret0 = passStringToWasm(ret); | ||
const ret1 = WASM_VECTOR_LEN; | ||
getInt32Memory()[arg0 / 4 + 0] = ret0; | ||
getInt32Memory()[arg0 / 4 + 1] = ret1; | ||
var ret = JSON.stringify(obj === undefined ? null : obj); | ||
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len0 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len0; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr0; | ||
}; | ||
{ | ||
"name": "@influxdata/flux", | ||
"collaborators": [ | ||
"Nathaniel Cook <nathaniel@influxdata.com>" | ||
"jlapacik <joshua.lapacik@pacbell.net>" | ||
], | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"files": [ | ||
@@ -14,3 +14,3 @@ "flux_bg.wasm", | ||
"types": "flux.d.ts", | ||
"sideEffects": false | ||
"sideEffects": "false" | ||
} |
Sorry, the diff of this file is not supported yet
2426557
135