@influxdata/flux-lsp-cli
Advanced tools
Comparing version 0.4.3 to 0.5.0
let wasm; | ||
const { TextDecoder } = require(String.raw`util`); | ||
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)); | ||
} | ||
const heap = new Array(32); | ||
@@ -26,2 +10,4 @@ | ||
function getObject(idx) { return heap[idx]; } | ||
let heap_next = heap.length; | ||
@@ -38,10 +24,14 @@ | ||
let cachegetInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachegetInt32Memory0; | ||
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 WASM_VECTOR_LEN = 0; | ||
@@ -66,15 +56,36 @@ | ||
function getObject(idx) { return heap[idx]; } | ||
let cachegetInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachegetInt32Memory0; | ||
} | ||
function dropObject(idx) { | ||
if (idx < 36) return; | ||
heap[idx] = heap_next; | ||
heap_next = idx; | ||
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 takeObject(idx) { | ||
const ret = getObject(idx); | ||
dropObject(idx); | ||
return ret; | ||
function getStringFromWasm0(ptr, len) { | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
function __wbg_adapter_16(arg0, arg1, arg2) { | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h5425672529e79e40(arg0, arg1, addHeapObject(arg2)); | ||
} | ||
function handleError(e) { | ||
wasm.__wbindgen_exn_store(addHeapObject(e)); | ||
} | ||
function __wbg_adapter_29(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__he62f6dc15be28482(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
} | ||
/** | ||
@@ -128,4 +139,17 @@ * @param {string} s | ||
/** | ||
* @param {any} f | ||
*/ | ||
register_buckets_callback(f) { | ||
wasm.server_register_buckets_callback(this.ptr, addHeapObject(f)); | ||
} | ||
/** | ||
* @returns {any} | ||
*/ | ||
get_buckets() { | ||
var ret = wasm.server_get_buckets(this.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @param {string} msg | ||
* @returns {ServerResponse} | ||
* @returns {any} | ||
*/ | ||
@@ -136,3 +160,3 @@ process(msg) { | ||
var ret = wasm.server_process(this.ptr, ptr0, len0); | ||
return ServerResponse.__wrap(ret); | ||
return takeObject(ret); | ||
} | ||
@@ -189,2 +213,92 @@ } | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
var ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_object_drop_ref = function(arg0) { | ||
takeObject(arg0); | ||
}; | ||
module.exports.__wbindgen_json_serialize = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
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; | ||
}; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
var ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_serverresponse_new = function(arg0) { | ||
var ret = ServerResponse.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_cb_drop = function(arg0) { | ||
const obj = takeObject(arg0).original; | ||
if (obj.cnt-- == 1) { | ||
obj.a = 0; | ||
return true; | ||
} | ||
var ret = false; | ||
return ret; | ||
}; | ||
module.exports.__wbg_call_12b949cfc461d154 = function(arg0, arg1) { | ||
try { | ||
var ret = getObject(arg0).call(getObject(arg1)); | ||
return addHeapObject(ret); | ||
} catch (e) { | ||
handleError(e) | ||
} | ||
}; | ||
module.exports.__wbg_call_ce7cf17fc6380443 = function(arg0, arg1, arg2) { | ||
try { | ||
var ret = getObject(arg0).call(getObject(arg1), getObject(arg2)); | ||
return addHeapObject(ret); | ||
} catch (e) { | ||
handleError(e) | ||
} | ||
}; | ||
module.exports.__wbg_new_d3eff62d5c013634 = function(arg0, arg1) { | ||
try { | ||
var state0 = {a: arg0, b: arg1}; | ||
var cb0 = (arg0, arg1) => { | ||
const a = state0.a; | ||
state0.a = 0; | ||
try { | ||
return __wbg_adapter_29(a, state0.b, arg0, arg1); | ||
} finally { | ||
state0.a = a; | ||
} | ||
}; | ||
var ret = new Promise(cb0); | ||
return addHeapObject(ret); | ||
} finally { | ||
state0.a = state0.b = 0; | ||
} | ||
}; | ||
module.exports.__wbg_resolve_6885947099a907d3 = function(arg0) { | ||
var ret = Promise.resolve(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_then_b6fef331fde5cf0a = function(arg0, arg1) { | ||
var ret = getObject(arg0).then(getObject(arg1)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_then_7d828a330efec051 = function(arg0, arg1, arg2) { | ||
var ret = getObject(arg0).then(getObject(arg1), getObject(arg2)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_json_parse = function(arg0, arg1) { | ||
@@ -198,3 +312,23 @@ var ret = JSON.parse(getStringFromWasm0(arg0, arg1)); | ||
}; | ||
module.exports.__wbindgen_closure_wrapper686 = function(arg0, arg1, arg2) { | ||
const state = { a: arg0, b: arg1, cnt: 1 }; | ||
const real = (arg0) => { | ||
state.cnt++; | ||
const a = state.a; | ||
state.a = 0; | ||
try { | ||
return __wbg_adapter_16(a, state.b, arg0); | ||
} finally { | ||
if (--state.cnt === 0) wasm.__wbindgen_export_2.get(170)(a, state.b); | ||
else state.a = a; | ||
} | ||
} | ||
; | ||
real.original = state; | ||
var ret = real; | ||
return addHeapObject(ret); | ||
}; | ||
wasm = require('./flux-lsp-node_bg'); | ||
{ | ||
"name": "@influxdata/flux-lsp-cli", | ||
"version": "0.4.3", | ||
"version": "0.5.0", | ||
"description": "Flux cli LSP server", | ||
@@ -24,3 +24,3 @@ "repository": { | ||
"dependencies": { | ||
"@influxdata/flux-lsp-node": "^0.2.2", | ||
"@influxdata/flux-lsp-node": "^0.3.0", | ||
"yargs": "^15.0.2" | ||
@@ -27,0 +27,0 @@ }, |
@@ -6,3 +6,3 @@ const { preserveShebangs } = require('rollup-plugin-preserve-shebangs') | ||
module.exports = { | ||
input: 'src/bin.js', | ||
input: 'src/cli.js', | ||
output: { | ||
@@ -9,0 +9,0 @@ file: 'out/bundle.js', |
#!/usr/bin/env node | ||
const fs = require('fs') | ||
const { Server } = require('@influxdata/flux-lsp-node') | ||
const yargs = require('yargs') | ||
const CLI = require('./cli') | ||
@@ -18,80 +19,16 @@ const argv = yargs | ||
}) | ||
.option('ipc', { | ||
type: 'boolean', | ||
describe: 'use ipc for transport', | ||
default: false | ||
}) | ||
.argv | ||
let log = () => { } | ||
const cli = CLI.new(argv) | ||
const logfile = argv['log-file'] | ||
if (logfile && logfile !== '') { | ||
const stream = fs.createWriteStream(logfile, { encoding: 'utf8' }) | ||
if (argv['log-file'] && argv['log-file'] !== '') { | ||
const stream = fs.createWriteStream(argv['log-file'], { encoding: 'utf8' }) | ||
log = (msg) => { | ||
stream.write(msg.toString()) | ||
} | ||
cli.on('log', (msg) => { | ||
stream.write(msg) | ||
}) | ||
} | ||
let server = new Server(argv['disable-folding']) | ||
const respond = (data) => { | ||
process.stdout.write(data) | ||
} | ||
const respondIPC = (data) => { | ||
const lines = data.split('\n') | ||
if (lines.length === 3) { | ||
process.send(JSON.parse(lines[2])) | ||
} | ||
} | ||
const handleInput = (data) => { | ||
const input = data.toString() | ||
log(`REQUEST: ${input}\n`) | ||
const resp = server.process(input) | ||
const msg = resp.get_message() | ||
if (msg) { | ||
log(`RESPONSE: ${msg}\n`) | ||
respond(msg) | ||
} | ||
const err = resp.get_error() | ||
if (err) { | ||
log(`ERROR: ${err}\n`) | ||
} | ||
} | ||
const handleIPC = (data) => { | ||
try { | ||
const input = `\n\n${JSON.stringify(data)}` | ||
log(`REQUEST: ${input}\n`) | ||
const resp = server.process(input) | ||
const msg = resp.get_message() | ||
if (msg) { | ||
log(`RESPONSE: ${msg}\n`) | ||
respondIPC(msg) | ||
} | ||
const err = resp.get_error() | ||
if (err) { | ||
log(`ERROR: ${err}\n`) | ||
} | ||
} catch (ex) { | ||
log('Caught unknown error') | ||
server = new Server(argv['disable-folding']) | ||
respondIPC('') | ||
} | ||
} | ||
if (argv.ipc) { | ||
process.on('message', handleIPC) | ||
} else { | ||
process.stdin.on('data', handleInput) | ||
} | ||
process.stdin | ||
.pipe(cli.createStream()) | ||
.pipe(process.stdout) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 9 instances in 1 package
15
3
2490849
438
2
+ Added@influxdata/flux-lsp-node@0.3.2(transitive)
- Removed@influxdata/flux-lsp-node@0.2.2(transitive)