mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 00:01:34 +00:00
split script argument and dependency parser packages to lighten initial load of the script editor (#4287)
* Add feature flags to split parsers into different pkgs * Split wasm parser imports * Use regex-lite, reorganize the parser split * Update imports to the new wasm parser split * Remove panic system on wasm and simplify snake case convert logic * Adapt new imports * Fix to_snake_case + fix tests * Adapt wasm test dependencies * Add publish script * Fix publish script * Publish script relative to script location * pkg diff + publish * Fix TS WASM import + add pakcage lock * Fix lint --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev> Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
This commit is contained in:
Generated
+5
-4
@@ -10701,6 +10701,7 @@ dependencies = [
|
||||
name = "windmill-parser"
|
||||
version = "1.385.0"
|
||||
dependencies = [
|
||||
"convert_case 0.6.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
@@ -10712,6 +10713,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"regex-lite",
|
||||
"serde_json",
|
||||
"windmill-parser",
|
||||
]
|
||||
@@ -10735,6 +10737,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"regex-lite",
|
||||
"serde_json",
|
||||
"windmill-parser",
|
||||
]
|
||||
@@ -10744,11 +10747,8 @@ name = "windmill-parser-php"
|
||||
version = "1.385.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"convert_case 0.6.0",
|
||||
"itertools 0.13.0",
|
||||
"lazy_static",
|
||||
"php-parser-rs",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"windmill-parser",
|
||||
]
|
||||
@@ -10774,6 +10774,7 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"phf",
|
||||
"regex",
|
||||
"regex-lite",
|
||||
"rustpython-parser",
|
||||
"serde_json",
|
||||
"sqlx",
|
||||
@@ -10788,6 +10789,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"regex-lite",
|
||||
"serde_json",
|
||||
"windmill-parser",
|
||||
]
|
||||
@@ -10797,7 +10799,6 @@ name = "windmill-parser-ts"
|
||||
version = "1.385.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"convert_case 0.6.0",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"serde-wasm-bindgen",
|
||||
|
||||
@@ -266,3 +266,4 @@ tikv-jemalloc-ctl = { version = "^0.5" }
|
||||
triomphe = "<0.1.12"
|
||||
|
||||
tantivy = "0.22.0"
|
||||
regex-lite = "0.1.6"
|
||||
|
||||
@@ -8,9 +8,14 @@ authors.workspace = true
|
||||
name = "windmill_parser_bash"
|
||||
path = "./src/lib.rs"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
regex-lite.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
regex.workspace = true
|
||||
|
||||
[dependencies]
|
||||
windmill-parser.workspace = true
|
||||
anyhow.workspace = true
|
||||
regex.workspace = true
|
||||
lazy_static.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#![allow(non_snake_case)] // TODO: switch to parse_* function naming
|
||||
|
||||
use anyhow::anyhow;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use regex::Regex;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use regex_lite::Regex;
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -8,9 +8,14 @@ authors.workspace = true
|
||||
name = "windmill_parser_graphql"
|
||||
path = "./src/lib.rs"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
regex-lite.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
regex.workspace = true
|
||||
|
||||
[dependencies]
|
||||
windmill-parser.workspace = true
|
||||
anyhow.workspace = true
|
||||
regex.workspace = true
|
||||
lazy_static.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#![allow(non_snake_case)] // TODO: switch to parse_* function naming
|
||||
|
||||
use anyhow::anyhow;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use regex::Regex;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use regex_lite::Regex;
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use windmill_parser::{Arg, MainArgSignature, Typ};
|
||||
|
||||
@@ -14,6 +14,3 @@ itertools.workspace = true
|
||||
serde_json.workspace = true
|
||||
anyhow.workspace = true
|
||||
php-parser-rs.workspace = true
|
||||
convert_case.workspace = true
|
||||
lazy_static.workspace = true
|
||||
regex.workspace = true
|
||||
@@ -1,7 +1,5 @@
|
||||
use convert_case::{Case, Casing};
|
||||
use regex::Regex;
|
||||
use serde_json::Value;
|
||||
use windmill_parser::{Arg, MainArgSignature, Typ};
|
||||
use windmill_parser::{to_snake_case, Arg, MainArgSignature, Typ};
|
||||
|
||||
use php_parser_rs::parser::{
|
||||
self,
|
||||
@@ -13,17 +11,6 @@ use php_parser_rs::parser::{
|
||||
},
|
||||
};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref RE_SNK_CASE: Regex = Regex::new(r"_(\d)").unwrap();
|
||||
}
|
||||
|
||||
fn to_snake_case(s: String) -> String {
|
||||
let r = s.to_case(Case::Snake);
|
||||
|
||||
// s_3 => s3
|
||||
RE_SNK_CASE.replace_all(&r, "$1").to_string()
|
||||
}
|
||||
|
||||
fn parse_php_type(e: Type) -> Typ {
|
||||
match e {
|
||||
Type::Float(_) => Typ::Float,
|
||||
@@ -32,7 +19,7 @@ fn parse_php_type(e: Type) -> Typ {
|
||||
Type::String(_) => Typ::Str(None),
|
||||
Type::Array(_) => Typ::List(Box::new(Typ::Str(None))),
|
||||
Type::Object(_) => Typ::Object(vec![]),
|
||||
Type::Named(_, name) => Typ::Resource(to_snake_case(name.to_string())),
|
||||
Type::Named(_, name) => Typ::Resource(to_snake_case(name.to_string().as_ref())),
|
||||
_ => Typ::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,18 @@ authors.workspace = true
|
||||
name = "windmill_parser_py_imports"
|
||||
path = "./src/lib.rs"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
regex-lite.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
regex.workspace = true
|
||||
|
||||
[dependencies]
|
||||
windmill-parser.workspace = true
|
||||
windmill-common.workspace = true
|
||||
rustpython-parser.workspace = true
|
||||
phf.workspace = true
|
||||
itertools.workspace = true
|
||||
regex.workspace = true
|
||||
serde_json.workspace = true
|
||||
anyhow.workspace = true
|
||||
lazy_static.workspace = true
|
||||
|
||||
@@ -10,7 +10,11 @@ use async_recursion::async_recursion;
|
||||
use itertools::Itertools;
|
||||
use lazy_static::lazy_static;
|
||||
use phf::phf_map;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use regex::Regex;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use regex_lite::Regex;
|
||||
|
||||
use rustpython_parser::{
|
||||
ast::{Stmt, StmtImport, StmtImportFrom, Suite},
|
||||
|
||||
@@ -8,9 +8,14 @@ authors.workspace = true
|
||||
name = "windmill_parser_sql"
|
||||
path = "./src/lib.rs"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
regex-lite.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
regex.workspace = true
|
||||
|
||||
[dependencies]
|
||||
windmill-parser.workspace = true
|
||||
anyhow.workspace = true
|
||||
regex.workspace = true
|
||||
lazy_static.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#![allow(non_snake_case)] // TODO: switch to parse_* function naming
|
||||
|
||||
use anyhow::anyhow;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use regex::Regex;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use regex_lite::Regex;
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use std::{
|
||||
|
||||
@@ -22,6 +22,5 @@ swc_ecma_ast.workspace = true
|
||||
swc_ecma_visit.workspace = true
|
||||
serde_json.workspace = true
|
||||
anyhow.workspace = true
|
||||
convert_case.workspace = true
|
||||
regex.workspace = true
|
||||
lazy_static.workspace = true
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use convert_case::{Case, Casing};
|
||||
use regex::Regex;
|
||||
/*
|
||||
* Author: Ruben Fiszel
|
||||
* Copyright: Windmill Labs, Inc 2022
|
||||
@@ -11,7 +9,9 @@ use regex::Regex;
|
||||
use serde_json::Value;
|
||||
use std::collections::HashSet;
|
||||
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||
use windmill_parser::{json_to_typ, Arg, MainArgSignature, ObjectProperty, OneOfVariant, Typ};
|
||||
use windmill_parser::{
|
||||
json_to_typ, to_snake_case, Arg, MainArgSignature, ObjectProperty, OneOfVariant, Typ,
|
||||
};
|
||||
|
||||
use swc_common::{sync::Lrc, FileName, SourceMap, SourceMapper, Span, Spanned};
|
||||
use swc_ecma_ast::{
|
||||
@@ -23,6 +23,7 @@ use swc_ecma_ast::{
|
||||
};
|
||||
use swc_ecma_parser::{lexer::Lexer, EsConfig, Parser, StringInput, Syntax, TsConfig};
|
||||
|
||||
use regex::Regex;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
@@ -294,7 +295,6 @@ fn binding_ident_to_arg(BindingIdent { id, type_ann }: &BindingIdent) -> (String
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref RE_SNK_CASE: Regex = Regex::new(r"_(\d)").unwrap();
|
||||
static ref IMPORTS_VERSION: Regex = Regex::new(r"^((?:\@[^\/\@]+\/[^\/\@]+)|(?:[^\/\@]+))(?:\@(?:[^\/]+))?(.*)$").unwrap();
|
||||
|
||||
}
|
||||
@@ -320,13 +320,6 @@ pub fn remove_pinned_imports(code: &str) -> anyhow::Result<String> {
|
||||
Ok(content)
|
||||
}
|
||||
|
||||
fn to_snake_case(s: &str) -> String {
|
||||
let r = s.to_case(Case::Snake);
|
||||
|
||||
// s_3 => s3
|
||||
RE_SNK_CASE.replace_all(&r, "$1").to_string()
|
||||
}
|
||||
|
||||
fn tstype_to_typ(ts_type: &TsType) -> (Typ, bool) {
|
||||
match ts_type {
|
||||
TsType::TsKeywordType(t) => (
|
||||
|
||||
@@ -10,19 +10,35 @@ crate-type = ["cdylib"]
|
||||
name = "windmill_parser_wasm"
|
||||
path = "./src/lib.rs"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
opt-level = 's'
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test.workspace = true
|
||||
windmill-parser-ts.workspace = true
|
||||
windmill-parser-bash.workspace = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
go-parser = [ "dep:windmill-parser-go"]
|
||||
bash-parser = [ "dep:windmill-parser-bash"]
|
||||
sql-parser = [ "dep:windmill-parser-sql"]
|
||||
py-parser = [ "dep:windmill-parser-py"]
|
||||
ts-parser = [ "dep:windmill-parser-ts"]
|
||||
php-parser = [ "dep:windmill-parser-php"]
|
||||
graphql-parser = [ "dep:windmill-parser-graphql"]
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
windmill-parser.workspace = true
|
||||
windmill-parser-go.workspace = true
|
||||
windmill-parser-bash.workspace = true
|
||||
windmill-parser-sql.workspace = true
|
||||
windmill-parser-py.workspace = true
|
||||
windmill-parser-ts.workspace = true
|
||||
windmill-parser-php.workspace = true
|
||||
windmill-parser-graphql.workspace = true
|
||||
windmill-parser-go = { workspace = true, optional = true }
|
||||
windmill-parser-bash = { workspace = true, optional = true }
|
||||
windmill-parser-sql = { workspace = true, optional = true }
|
||||
windmill-parser-py = { workspace = true, optional = true }
|
||||
windmill-parser-ts = { workspace = true, optional = true }
|
||||
windmill-parser-php = { workspace = true, optional = true }
|
||||
windmill-parser-graphql = { workspace = true, optional = true }
|
||||
wasm-bindgen.workspace = true
|
||||
serde_json.workspace = true
|
||||
getrandom = { workspace = true, features = ["js"] }
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
set -eou pipefail
|
||||
|
||||
# full pkg
|
||||
OUT_DIR="pkg"
|
||||
wasm-pack build --release --target web --out-dir $OUT_DIR --all-features \
|
||||
-Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort
|
||||
|
||||
# bun and deno
|
||||
OUT_DIR="pkg-ts"
|
||||
wasm-pack build --release --target web --out-dir $OUT_DIR --features "ts-parser" \
|
||||
-Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort
|
||||
sed -i 's/"windmill-parser-wasm"/"windmill-parser-wasm-ts"/' $OUT_DIR/package.json
|
||||
|
||||
# sql languages, graphql and bash/powershell, since they all use regex
|
||||
OUT_DIR="pkg-regex"
|
||||
wasm-pack build --release --target web --out-dir $OUT_DIR \
|
||||
--features "sql-parser,graphql-parser,bash-parser" \
|
||||
-Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort
|
||||
sed -i 's/"windmill-parser-wasm"/"windmill-parser-wasm-regex"/' $OUT_DIR/package.json
|
||||
|
||||
# python
|
||||
OUT_DIR="pkg-py"
|
||||
wasm-pack build --release --target web --out-dir $OUT_DIR --features "py-parser" \
|
||||
-Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort
|
||||
sed -i 's/"windmill-parser-wasm"/"windmill-parser-wasm-py"/' $OUT_DIR/package.json
|
||||
|
||||
# go
|
||||
OUT_DIR="pkg-go"
|
||||
wasm-pack build --release --target web --out-dir $OUT_DIR --features "go-parser" \
|
||||
-Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort
|
||||
sed -i 's/"windmill-parser-wasm"/"windmill-parser-wasm-go"/' $OUT_DIR/package.json
|
||||
|
||||
# php
|
||||
OUT_DIR="pkg-php"
|
||||
wasm-pack build --release --target web --out-dir $OUT_DIR --features "php-parser" \
|
||||
-Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort
|
||||
sed -i 's/"windmill-parser-wasm"/"windmill-parser-wasm-php"/' $OUT_DIR/package.json
|
||||
@@ -3,7 +3,7 @@
|
||||
"collaborators": [
|
||||
"Ruben Fiszel <ruben@windmill.dev>"
|
||||
],
|
||||
"version": "1.367.2",
|
||||
"version": "1.385.0",
|
||||
"files": [
|
||||
"windmill_parser_wasm_bg.wasm",
|
||||
"windmill_parser_wasm.js",
|
||||
|
||||
@@ -107,18 +107,18 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
|
||||
* Instantiates the given `module`, which can either be bytes or
|
||||
* a precompiled `WebAssembly.Module`.
|
||||
*
|
||||
* @param {SyncInitInput} module
|
||||
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {InitOutput}
|
||||
*/
|
||||
export function initSync(module: SyncInitInput): InitOutput;
|
||||
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
||||
|
||||
/**
|
||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||
*
|
||||
* @param {InitInput | Promise<InitInput>} module_or_path
|
||||
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
||||
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
||||
|
||||
@@ -22,13 +22,13 @@ function takeObject(idx) {
|
||||
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
|
||||
let cachedUint8Memory0 = null;
|
||||
let cachedUint8ArrayMemory0 = null;
|
||||
|
||||
function getUint8Memory0() {
|
||||
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
||||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
function getUint8ArrayMemory0() {
|
||||
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
||||
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedUint8Memory0;
|
||||
return cachedUint8ArrayMemory0;
|
||||
}
|
||||
|
||||
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
||||
@@ -51,7 +51,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
||||
if (realloc === undefined) {
|
||||
const buf = cachedTextEncoder.encode(arg);
|
||||
const ptr = malloc(buf.length, 1) >>> 0;
|
||||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
||||
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
||||
WASM_VECTOR_LEN = buf.length;
|
||||
return ptr;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
||||
let len = arg.length;
|
||||
let ptr = malloc(len, 1) >>> 0;
|
||||
|
||||
const mem = getUint8Memory0();
|
||||
const mem = getUint8ArrayMemory0();
|
||||
|
||||
let offset = 0;
|
||||
|
||||
@@ -74,7 +74,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
||||
arg = arg.slice(offset);
|
||||
}
|
||||
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
||||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
||||
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
||||
const ret = encodeString(arg, view);
|
||||
|
||||
offset += ret.written;
|
||||
@@ -89,22 +89,13 @@ function isLikeNone(x) {
|
||||
return x === undefined || x === null;
|
||||
}
|
||||
|
||||
let cachedInt32Memory0 = null;
|
||||
let cachedDataViewMemory0 = null;
|
||||
|
||||
function getInt32Memory0() {
|
||||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
||||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
function getDataViewMemory0() {
|
||||
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
||||
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
||||
}
|
||||
return cachedInt32Memory0;
|
||||
}
|
||||
|
||||
let cachedFloat64Memory0 = null;
|
||||
|
||||
function getFloat64Memory0() {
|
||||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
||||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedFloat64Memory0;
|
||||
return cachedDataViewMemory0;
|
||||
}
|
||||
|
||||
function addHeapObject(obj) {
|
||||
@@ -122,16 +113,7 @@ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
||||
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
ptr = ptr >>> 0;
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
|
||||
let cachedBigInt64Memory0 = null;
|
||||
|
||||
function getBigInt64Memory0() {
|
||||
if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
|
||||
cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedBigInt64Memory0;
|
||||
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
|
||||
function debugString(val) {
|
||||
@@ -210,8 +192,8 @@ export function parse_deno(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_deno(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -233,8 +215,8 @@ export function parse_outputs(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_outputs(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -256,8 +238,8 @@ export function parse_ts_imports(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_ts_imports(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -279,8 +261,8 @@ export function parse_bash(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_bash(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -302,8 +284,8 @@ export function parse_powershell(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_powershell(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -325,8 +307,8 @@ export function parse_go(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_go(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -348,8 +330,8 @@ export function parse_python(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_python(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -371,8 +353,8 @@ export function parse_sql(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_sql(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -394,8 +376,8 @@ export function parse_mysql(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_mysql(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -417,8 +399,8 @@ export function parse_bigquery(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_bigquery(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -440,8 +422,8 @@ export function parse_snowflake(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_snowflake(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -463,8 +445,8 @@ export function parse_mssql(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_mssql(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -484,8 +466,8 @@ export function parse_db_resource(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_db_resource(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
let v2;
|
||||
if (r0 !== 0) {
|
||||
v2 = getStringFromWasm0(r0, r1).slice();
|
||||
@@ -509,8 +491,8 @@ export function parse_graphql(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_graphql(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -532,8 +514,8 @@ export function parse_php(code) {
|
||||
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len0 = WASM_VECTOR_LEN;
|
||||
wasm.parse_php(retptr, ptr0, len0);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
||||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
||||
deferred2_0 = r0;
|
||||
deferred2_1 = r1;
|
||||
return getStringFromWasm0(r0, r1);
|
||||
@@ -585,7 +567,7 @@ async function __wbg_load(module, imports) {
|
||||
function __wbg_get_imports() {
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbg_eval_aa725d466edcea2c = function(arg0, arg1) {
|
||||
imports.wbg.__wbg_eval_204ec87eadeaef4a = function(arg0, arg1) {
|
||||
const ret = eval(getStringFromWasm0(arg0, arg1));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
@@ -597,8 +579,8 @@ function __wbg_get_imports() {
|
||||
const ret = typeof(obj) === 'string' ? obj : undefined;
|
||||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
var len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
||||
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
||||
};
|
||||
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
||||
const v = getObject(arg0);
|
||||
@@ -612,8 +594,8 @@ function __wbg_get_imports() {
|
||||
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
||||
const obj = getObject(arg1);
|
||||
const ret = typeof(obj) === 'number' ? obj : undefined;
|
||||
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
||||
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
||||
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
||||
};
|
||||
imports.wbg.__wbindgen_is_object = function(arg0) {
|
||||
const val = getObject(arg0);
|
||||
@@ -644,11 +626,11 @@ function __wbg_get_imports() {
|
||||
const ret = getObject(arg0) == getObject(arg1);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
|
||||
imports.wbg.__wbg_get_3baa728f9d58d3f6 = function(arg0, arg1) {
|
||||
const ret = getObject(arg0)[arg1 >>> 0];
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
|
||||
imports.wbg.__wbg_length_ae22078168b726f5 = function(arg0) {
|
||||
const ret = getObject(arg0).length;
|
||||
return ret;
|
||||
};
|
||||
@@ -656,39 +638,39 @@ function __wbg_get_imports() {
|
||||
const ret = typeof(getObject(arg0)) === 'function';
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
|
||||
imports.wbg.__wbg_next_de3e9db4440638b2 = function(arg0) {
|
||||
const ret = getObject(arg0).next;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
|
||||
imports.wbg.__wbg_next_f9cb570345655b9a = function() { return handleError(function (arg0) {
|
||||
const ret = getObject(arg0).next();
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
|
||||
imports.wbg.__wbg_done_bfda7aa8f252b39f = function(arg0) {
|
||||
const ret = getObject(arg0).done;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
|
||||
imports.wbg.__wbg_value_6d39332ab4788d86 = function(arg0) {
|
||||
const ret = getObject(arg0).value;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
|
||||
imports.wbg.__wbg_iterator_888179a48810a9fe = function() {
|
||||
const ret = Symbol.iterator;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
|
||||
imports.wbg.__wbg_get_224d16597dbbfd96 = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
|
||||
imports.wbg.__wbg_call_1084a111329e68ce = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg0).call(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
|
||||
imports.wbg.__wbg_isArray_8364a5371e9737d8 = function(arg0) {
|
||||
const ret = Array.isArray(getObject(arg0));
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
|
||||
imports.wbg.__wbg_instanceof_ArrayBuffer_61dfc3198373c902 = function(arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof ArrayBuffer;
|
||||
@@ -698,7 +680,7 @@ function __wbg_get_imports() {
|
||||
const ret = result;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_instanceof_Map_87917e0a7aaf4012 = function(arg0) {
|
||||
imports.wbg.__wbg_instanceof_Map_763ce0e95960d55e = function(arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Map;
|
||||
@@ -708,30 +690,30 @@ function __wbg_get_imports() {
|
||||
const ret = result;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2 = function(arg0) {
|
||||
imports.wbg.__wbg_isSafeInteger_7f1ed56200d90674 = function(arg0) {
|
||||
const ret = Number.isSafeInteger(getObject(arg0));
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_entries_95cc2c823b285a09 = function(arg0) {
|
||||
imports.wbg.__wbg_entries_7a0e06255456ebcd = function(arg0) {
|
||||
const ret = Object.entries(getObject(arg0));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
|
||||
imports.wbg.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
|
||||
const ret = getObject(arg0).buffer;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
|
||||
imports.wbg.__wbg_new_ea1883e1e5e86686 = function(arg0) {
|
||||
const ret = new Uint8Array(getObject(arg0));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
|
||||
imports.wbg.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) {
|
||||
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
||||
};
|
||||
imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
|
||||
imports.wbg.__wbg_length_8339fcf5d8ecd12e = function(arg0) {
|
||||
const ret = getObject(arg0).length;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
|
||||
imports.wbg.__wbg_instanceof_Uint8Array_247a91427532499e = function(arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Uint8Array;
|
||||
@@ -744,15 +726,15 @@ function __wbg_get_imports() {
|
||||
imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
|
||||
const v = getObject(arg1);
|
||||
const ret = typeof(v) === 'bigint' ? v : undefined;
|
||||
getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
||||
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
||||
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
||||
};
|
||||
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
||||
const ret = debugString(getObject(arg1));
|
||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||
const len1 = WASM_VECTOR_LEN;
|
||||
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
||||
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
||||
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
||||
};
|
||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
@@ -765,17 +747,16 @@ function __wbg_get_imports() {
|
||||
return imports;
|
||||
}
|
||||
|
||||
function __wbg_init_memory(imports, maybe_memory) {
|
||||
function __wbg_init_memory(imports, memory) {
|
||||
|
||||
}
|
||||
|
||||
function __wbg_finalize_init(instance, module) {
|
||||
wasm = instance.exports;
|
||||
__wbg_init.__wbindgen_wasm_module = module;
|
||||
cachedBigInt64Memory0 = null;
|
||||
cachedFloat64Memory0 = null;
|
||||
cachedInt32Memory0 = null;
|
||||
cachedUint8Memory0 = null;
|
||||
cachedDataViewMemory0 = null;
|
||||
cachedUint8ArrayMemory0 = null;
|
||||
|
||||
|
||||
|
||||
return wasm;
|
||||
@@ -784,6 +765,12 @@ function __wbg_finalize_init(instance, module) {
|
||||
function initSync(module) {
|
||||
if (wasm !== undefined) return wasm;
|
||||
|
||||
|
||||
if (typeof module !== 'undefined' && Object.getPrototypeOf(module) === Object.prototype)
|
||||
({module} = module)
|
||||
else
|
||||
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
||||
|
||||
const imports = __wbg_get_imports();
|
||||
|
||||
__wbg_init_memory(imports);
|
||||
@@ -797,24 +784,30 @@ function initSync(module) {
|
||||
return __wbg_finalize_init(instance, module);
|
||||
}
|
||||
|
||||
async function __wbg_init(input) {
|
||||
async function __wbg_init(module_or_path) {
|
||||
if (wasm !== undefined) return wasm;
|
||||
|
||||
if (typeof input === 'undefined') {
|
||||
input = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
|
||||
|
||||
if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype)
|
||||
({module_or_path} = module_or_path)
|
||||
else
|
||||
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
||||
|
||||
if (typeof module_or_path === 'undefined') {
|
||||
module_or_path = new URL('windmill_parser_wasm_bg.wasm', import.meta.url);
|
||||
}
|
||||
const imports = __wbg_get_imports();
|
||||
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
||||
module_or_path = fetch(module_or_path);
|
||||
}
|
||||
|
||||
__wbg_init_memory(imports);
|
||||
|
||||
const { instance, module } = await __wbg_load(await input, imports);
|
||||
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
||||
|
||||
return __wbg_finalize_init(instance, module);
|
||||
}
|
||||
|
||||
export { initSync }
|
||||
export { initSync };
|
||||
export default __wbg_init;
|
||||
|
||||
Binary file not shown.
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -eou pipefail
|
||||
script_dirpath="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
args=${1:-}
|
||||
|
||||
# bun and deno
|
||||
pushd "pkg-ts" && npm publish ${args}
|
||||
popd
|
||||
|
||||
pushd "pkg-regex" && npm publish ${args}
|
||||
popd
|
||||
|
||||
pushd "pkg-py" && npm publish ${args}
|
||||
popd
|
||||
|
||||
pushd "pkg-go" && npm publish ${args}
|
||||
popd
|
||||
|
||||
pushd "pkg-php" && npm publish ${args}
|
||||
popd
|
||||
@@ -1,8 +1,12 @@
|
||||
#[cfg(feature = "ts-parser")]
|
||||
use serde_json::json;
|
||||
#[allow(unused_imports)]
|
||||
use wasm_bindgen::prelude::*;
|
||||
use windmill_parser::MainArgSignature;
|
||||
#[cfg(feature = "ts-parser")]
|
||||
use windmill_parser_ts::{parse_expr_for_ids, parse_expr_for_imports};
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn wrap_sig(r: anyhow::Result<MainArgSignature>) -> String {
|
||||
if let Ok(r) = r {
|
||||
return serde_json::to_string(&r).unwrap();
|
||||
@@ -11,11 +15,13 @@ fn wrap_sig(r: anyhow::Result<MainArgSignature>) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "ts-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_deno(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_ts::parse_deno_signature(code, false, None))
|
||||
}
|
||||
|
||||
#[cfg(feature = "ts-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_outputs(code: &str) -> String {
|
||||
let parsed = parse_expr_for_ids(code);
|
||||
@@ -27,6 +33,7 @@ pub fn parse_outputs(code: &str) -> String {
|
||||
return serde_json::to_string(&r).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(feature = "ts-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_ts_imports(code: &str) -> String {
|
||||
let parsed = parse_expr_for_imports(code);
|
||||
@@ -38,61 +45,73 @@ pub fn parse_ts_imports(code: &str) -> String {
|
||||
return serde_json::to_string(&r).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(feature = "bash-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_bash(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_bash::parse_bash_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "bash-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_powershell(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_bash::parse_powershell_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "go-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_go(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_go::parse_go_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "py-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_python(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_py::parse_python_signature(code, None))
|
||||
}
|
||||
|
||||
#[cfg(feature = "sql-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_sql(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_sql::parse_pgsql_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "sql-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_mysql(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_sql::parse_mysql_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "sql-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_bigquery(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_sql::parse_bigquery_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "sql-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_snowflake(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_sql::parse_snowflake_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "sql-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_mssql(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_sql::parse_mssql_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "sql-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_db_resource(code: &str) -> Option<String> {
|
||||
windmill_parser_sql::parse_db_resource(code)
|
||||
}
|
||||
|
||||
#[cfg(feature = "graphql-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_graphql(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_graphql::parse_graphql_sig(code))
|
||||
}
|
||||
|
||||
#[cfg(feature = "php-parser")]
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_php(code: &str) -> String {
|
||||
wrap_sig(windmill_parser_php::parse_php_signature(code, None))
|
||||
|
||||
@@ -11,3 +11,4 @@ path = "./src/lib.rs"
|
||||
[dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
convert_case.workspace = true
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* LICENSE-AGPL for a copy of the license.
|
||||
*/
|
||||
|
||||
use convert_case::{Boundary, Case, Casing};
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
|
||||
@@ -75,3 +76,88 @@ pub fn json_to_typ(js: &Value) -> Typ {
|
||||
_ => Typ::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_snake_case(s: &str) -> String {
|
||||
s.with_boundaries(&Boundary::defaults())
|
||||
.without_boundaries(&Boundary::letter_digit())
|
||||
.to_case(Case::Snake)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_snake_case() {
|
||||
assert_eq!("s3", to_snake_case("S3"));
|
||||
assert_eq!("s3", to_snake_case("s3"));
|
||||
assert_eq!("s_3", to_snake_case("S_3"));
|
||||
assert_eq!("type_name_here", to_snake_case("typeNameHere"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_empty_string() {
|
||||
assert_eq!(to_snake_case(""), "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_char_lowercase() {
|
||||
assert_eq!(to_snake_case("a"), "a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_char_uppercase() {
|
||||
assert_eq!(to_snake_case("A"), "a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_all_uppercase() {
|
||||
assert_eq!(to_snake_case("TEST"), "test");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_all_lowercase() {
|
||||
assert_eq!(to_snake_case("test"), "test");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mixed_case() {
|
||||
assert_eq!(to_snake_case("testCase"), "test_case");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mixed_case_with_numbers() {
|
||||
assert_eq!(to_snake_case("testCase1"), "test_case1");
|
||||
assert_eq!(to_snake_case("Test123Case"), "test123_case");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_numbers_with_hyphen() {
|
||||
assert_eq!(to_snake_case("test-3"), "test_3");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_string_with_spaces() {
|
||||
assert_eq!(to_snake_case("This is a Test"), "this_is_a_test");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_snake_case_input() {
|
||||
assert_eq!(to_snake_case("already_snake_case"), "already_snake_case");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_kebab_case_input() {
|
||||
assert_eq!(to_snake_case("already-kebab-case"), "already_kebab_case");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mixed_delimiters() {
|
||||
assert_eq!(to_snake_case("test-Case_with Spaces"), "test_case_with_spaces");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_leading_and_trailing_spaces() {
|
||||
assert_eq!(to_snake_case(" test case "), "test_case");
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+29
-5
@@ -66,7 +66,11 @@
|
||||
"vscode-languageclient": "~9.0.1",
|
||||
"vscode-uri": "~3.0.8",
|
||||
"vscode-ws-jsonrpc": "~3.3.2",
|
||||
"windmill-parser-wasm": "^1.367.2",
|
||||
"windmill-parser-wasm-go": "^1.382.2",
|
||||
"windmill-parser-wasm-php": "^1.382.2",
|
||||
"windmill-parser-wasm-py": "^1.382.2",
|
||||
"windmill-parser-wasm-regex": "^1.382.2",
|
||||
"windmill-parser-wasm-ts": "^1.382.2",
|
||||
"windmill-sql-datatype-parser-wasm": "^1.318.0",
|
||||
"y-monaco": "^0.1.4",
|
||||
"y-websocket": "^1.5.0",
|
||||
@@ -13402,10 +13406,30 @@
|
||||
"string-width": "^1.0.2 || 2 || 3 || 4"
|
||||
}
|
||||
},
|
||||
"node_modules/windmill-parser-wasm": {
|
||||
"version": "1.367.2",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm/-/windmill-parser-wasm-1.367.2.tgz",
|
||||
"integrity": "sha512-If/IXXXADC0jWq4Vj6IN1IRZ1GTWCpE4oMnyZAkVzZUJ2ZbQLw5maLhAmm4iAMpmMHRb4U4kd68D1h30Iy4MNQ=="
|
||||
"node_modules/windmill-parser-wasm-go": {
|
||||
"version": "1.385.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-go/-/windmill-parser-wasm-go-1.385.0.tgz",
|
||||
"integrity": "sha512-au+i0TDbhnklDrpGTYSXVwqaY4DSKC17anHFLjeG8oHJ9xlc/kNG+2PASs2sqc5m7e6G6D78LDt/5FYs1b9b+g=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-php": {
|
||||
"version": "1.385.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-php/-/windmill-parser-wasm-php-1.385.0.tgz",
|
||||
"integrity": "sha512-3x6fFy19BXNfLhzctFEh5fozrKBoWUla/JsZpYaKPw7AKbQ/aP1o+SKZDSrXStaNDHfipdsPYLZ0MIxjZY6p1Q=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-py": {
|
||||
"version": "1.385.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-py/-/windmill-parser-wasm-py-1.385.0.tgz",
|
||||
"integrity": "sha512-v+6hZNGBp+8KMoAkWIlt5Eu+0n1mNf7vrk/bHr0X2s78cM4JhTXZ24eR7xx69eesQpO7X87pEn/HJHIUHC0kAQ=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-regex": {
|
||||
"version": "1.385.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-regex/-/windmill-parser-wasm-regex-1.385.0.tgz",
|
||||
"integrity": "sha512-rgqTANyiYNgdh2Hcgk8xFt/rmLCMGMnIlnZe+/9z2oggfkOKB9oAt49cyCLD9MZeXdTJuNPKn+IVMeSAOn6WYQ=="
|
||||
},
|
||||
"node_modules/windmill-parser-wasm-ts": {
|
||||
"version": "1.385.0",
|
||||
"resolved": "https://registry.npmjs.org/windmill-parser-wasm-ts/-/windmill-parser-wasm-ts-1.385.0.tgz",
|
||||
"integrity": "sha512-DKQZQzJmSqi7jCbROl9B8ZE/T6sG951zxs1/StWAJmnQazA0FJrdjTj0niiFQNkLaQ2aAPZUkSULZJG+7x1Jow=="
|
||||
},
|
||||
"node_modules/windmill-sql-datatype-parser-wasm": {
|
||||
"version": "1.318.0",
|
||||
|
||||
@@ -139,7 +139,11 @@
|
||||
"vscode-languageclient": "~9.0.1",
|
||||
"vscode-uri": "~3.0.8",
|
||||
"vscode-ws-jsonrpc": "~3.3.2",
|
||||
"windmill-parser-wasm": "^1.367.2",
|
||||
"windmill-parser-wasm-php": "^1.382.2",
|
||||
"windmill-parser-wasm-go": "^1.382.2",
|
||||
"windmill-parser-wasm-py": "^1.382.2",
|
||||
"windmill-parser-wasm-regex": "^1.382.2",
|
||||
"windmill-parser-wasm-ts": "^1.382.2",
|
||||
"windmill-sql-datatype-parser-wasm": "^1.318.0",
|
||||
"y-monaco": "^0.1.4",
|
||||
"y-websocket": "^1.5.0",
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
SNOWFLAKE_TYPES
|
||||
} from '$lib/consts'
|
||||
import { setupTypeAcquisition } from '$lib/ata/index'
|
||||
import { initWasm, parseDeps } from '$lib/infer'
|
||||
import { initWasmTs, parseDeps } from '$lib/infer'
|
||||
import { initVim } from './monaco_keybindings'
|
||||
|
||||
// import EditorTheme from './EditorTheme.svelte'
|
||||
@@ -1232,7 +1232,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
await initWasm()
|
||||
await initWasmTs()
|
||||
const root = await genRoot(hostname)
|
||||
console.log('SETUP TYPE ACQUISITION', { root, path })
|
||||
ata = setupTypeAcquisition({
|
||||
|
||||
+53
-16
@@ -3,33 +3,61 @@ import { get, writable } from 'svelte/store'
|
||||
import type { Schema, SupportedLanguage } from './common.js'
|
||||
import { emptySchema, sortObject } from './utils.js'
|
||||
import { tick } from 'svelte'
|
||||
import init, {
|
||||
|
||||
import initTsParser, {
|
||||
parse_deno,
|
||||
parse_bash,
|
||||
parse_go,
|
||||
parse_python,
|
||||
parse_outputs,
|
||||
parse_ts_imports
|
||||
} from 'windmill-parser-wasm-ts'
|
||||
import initRegexParsers, {
|
||||
parse_sql,
|
||||
parse_mysql,
|
||||
parse_bigquery,
|
||||
parse_snowflake,
|
||||
parse_graphql,
|
||||
parse_powershell,
|
||||
parse_outputs,
|
||||
parse_mssql,
|
||||
parse_ts_imports,
|
||||
parse_db_resource,
|
||||
parse_php
|
||||
} from 'windmill-parser-wasm'
|
||||
import wasmUrl from 'windmill-parser-wasm/windmill_parser_wasm_bg.wasm?url'
|
||||
parse_bash,
|
||||
parse_powershell,
|
||||
} from 'windmill-parser-wasm-regex'
|
||||
import initPythonParser, {
|
||||
parse_python,
|
||||
} from 'windmill-parser-wasm-py'
|
||||
import initGoParser, {
|
||||
parse_go,
|
||||
} from 'windmill-parser-wasm-go'
|
||||
import initPhpParser, {
|
||||
parse_php,
|
||||
} from 'windmill-parser-wasm-php'
|
||||
|
||||
import wasmUrlTs from 'windmill-parser-wasm-ts/windmill_parser_wasm_bg.wasm?url'
|
||||
import wasmUrlRegex from 'windmill-parser-wasm-regex/windmill_parser_wasm_bg.wasm?url'
|
||||
import wasmUrlPy from 'windmill-parser-wasm-py/windmill_parser_wasm_bg.wasm?url'
|
||||
import wasmUrlGo from 'windmill-parser-wasm-go/windmill_parser_wasm_bg.wasm?url'
|
||||
import wasmUrlPhp from 'windmill-parser-wasm-php/windmill_parser_wasm_bg.wasm?url'
|
||||
import { workspaceStore } from './stores.js'
|
||||
import { argSigToJsonSchemaType } from './inferArgSig.js'
|
||||
|
||||
init(wasmUrl)
|
||||
|
||||
const loadSchemaLastRun = writable<[string | undefined, MainArgSignature | undefined]>(undefined)
|
||||
|
||||
export async function initWasm() {
|
||||
await init(wasmUrl)
|
||||
let initializeTsPromise : Promise<any> | undefined = undefined;
|
||||
export async function initWasmTs() {
|
||||
if (initializeTsPromise == undefined) {
|
||||
initializeTsPromise = initTsParser(wasmUrlTs)
|
||||
}
|
||||
await initializeTsPromise
|
||||
}
|
||||
async function initWasmRegex() {
|
||||
await initRegexParsers(wasmUrlRegex)
|
||||
}
|
||||
async function initWasmPython() {
|
||||
await initPythonParser(wasmUrlPy)
|
||||
}
|
||||
async function initWasmPhp() {
|
||||
await initPhpParser(wasmUrlPhp)
|
||||
}
|
||||
async function initWasmGo() {
|
||||
await initGoParser(wasmUrlGo)
|
||||
}
|
||||
|
||||
export function parseDeps(code: string): string[] {
|
||||
@@ -47,7 +75,6 @@ export async function inferArgs(
|
||||
code: string,
|
||||
schema: Schema
|
||||
): Promise<boolean | null> {
|
||||
await init(wasmUrl)
|
||||
const lastRun = get(loadSchemaLastRun)
|
||||
let inferedSchema: MainArgSignature
|
||||
if (lastRun && code == lastRun[0] && lastRun[1]) {
|
||||
@@ -59,15 +86,20 @@ export async function inferArgs(
|
||||
|
||||
let inlineDBResource: string | undefined = undefined
|
||||
if (['postgresql', 'mysql', 'bigquery', 'snowflake', 'mssql'].includes(language ?? '')) {
|
||||
await initWasmRegex()
|
||||
inlineDBResource = parse_db_resource(code)
|
||||
}
|
||||
if (language == 'python3') {
|
||||
await initWasmPython()
|
||||
inferedSchema = JSON.parse(parse_python(code))
|
||||
} else if (language == 'deno') {
|
||||
await initWasmTs()
|
||||
inferedSchema = JSON.parse(parse_deno(code))
|
||||
} else if (language == 'nativets') {
|
||||
await initWasmTs()
|
||||
inferedSchema = JSON.parse(parse_deno(code))
|
||||
} else if (language == 'bun' || language == 'bunnative') {
|
||||
await initWasmTs()
|
||||
inferedSchema = JSON.parse(parse_deno(code))
|
||||
} else if (language == 'postgresql') {
|
||||
inferedSchema = JSON.parse(parse_sql(code))
|
||||
@@ -113,15 +145,20 @@ export async function inferArgs(
|
||||
]
|
||||
}
|
||||
} else if (language == 'graphql') {
|
||||
await initWasmRegex()
|
||||
inferedSchema = JSON.parse(parse_graphql(code))
|
||||
inferedSchema.args = [{ name: 'api', typ: { resource: 'graphql' } }, ...inferedSchema.args]
|
||||
} else if (language == 'go') {
|
||||
await initWasmGo()
|
||||
inferedSchema = JSON.parse(parse_go(code))
|
||||
} else if (language == 'bash') {
|
||||
await initWasmRegex()
|
||||
inferedSchema = JSON.parse(parse_bash(code))
|
||||
} else if (language == 'powershell') {
|
||||
await initWasmRegex()
|
||||
inferedSchema = JSON.parse(parse_powershell(code))
|
||||
} else if (language == 'php') {
|
||||
await initWasmPhp()
|
||||
inferedSchema = JSON.parse(parse_php(code))
|
||||
} else {
|
||||
return null
|
||||
@@ -233,7 +270,7 @@ export async function parseOutputs(
|
||||
code: string,
|
||||
ignoreError
|
||||
): Promise<[string, string][] | undefined> {
|
||||
await init(wasmUrl)
|
||||
await initWasmTs()
|
||||
const getOutputs = await parse_outputs(code)
|
||||
const outputs = JSON.parse(getOutputs)
|
||||
if (outputs.error) {
|
||||
|
||||
Reference in New Issue
Block a user