@beff/cli 0.0.109 → 0.0.111
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/CHANGELOG.md +12 -0
- package/dist-cli/cli.js +5 -17
- package/package.json +1 -1
- package/pkg/beff_wasm.d.ts +5 -18
- package/pkg/beff_wasm.js +303 -337
- package/pkg/beff_wasm_bg.wasm +0 -0
- package/pkg/beff_wasm_bg.wasm.d.ts +11 -8
package/CHANGELOG.md
CHANGED
package/dist-cli/cli.js
CHANGED
|
@@ -45781,7 +45781,7 @@ var fs = __toESM(require("fs"));
|
|
|
45781
45781
|
var path = __toESM(require("path"));
|
|
45782
45782
|
|
|
45783
45783
|
// ts-node/generated/bundle.ts
|
|
45784
|
-
var bundle_default = { "codegen-v2.js": '"use strict";\nimport {\n printErrors\n} from "@beff/client";\nconst JSON_PROTO = Object.getPrototypeOf({});\nfunction deepmergeConstructor(options) {\n function isNotPrototypeKey(value) {\n return value !== "constructor" && value !== "prototype" && value !== "__proto__";\n }\n function cloneArray(value) {\n let i = 0;\n const il = value.length;\n const result = new Array(il);\n for (i; i < il; ++i) {\n result[i] = clone(value[i]);\n }\n return result;\n }\n function cloneObject(target) {\n const result = {};\n if (cloneProtoObject && Object.getPrototypeOf(target) !== JSON_PROTO) {\n return cloneProtoObject(target);\n }\n const targetKeys = getKeys(target);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey(key = targetKeys[i]) && (result[key] = clone(target[key]));\n }\n return result;\n }\n function concatArrays(target, source) {\n const tl = target.length;\n const sl = source.length;\n let i = 0;\n const result = new Array(tl + sl);\n for (i; i < tl; ++i) {\n result[i] = clone(target[i]);\n }\n for (i = 0; i < sl; ++i) {\n result[i + tl] = clone(source[i]);\n }\n return result;\n }\n const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;\n function getSymbolsAndKeys(value) {\n const result = Object.keys(value);\n const keys = Object.getOwnPropertySymbols(value);\n for (let i = 0, il = keys.length; i < il; ++i) {\n propertyIsEnumerable.call(value, keys[i]) && result.push(keys[i]);\n }\n return result;\n }\n const getKeys = options?.symbols ? getSymbolsAndKeys : Object.keys;\n const cloneProtoObject = typeof options?.cloneProtoObject === "function" ? options.cloneProtoObject : void 0;\n function isMergeableObject(value) {\n return typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date);\n }\n function isPrimitive(value) {\n return typeof value !== "object" || value === null;\n }\n const isPrimitiveOrBuiltIn = (\n \n typeof Buffer !== "undefined" ? (value) => typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date || \n value instanceof Buffer : (value) => typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date\n );\n const mergeArray = options && typeof options.mergeArray === "function" ? options.mergeArray({ clone, deepmerge: _deepmerge, getKeys, isMergeableObject }) : concatArrays;\n function clone(entry) {\n return isMergeableObject(entry) ? Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry) : entry;\n }\n function mergeObject(target, source) {\n const result = {};\n const targetKeys = getKeys(target);\n const sourceKeys = getKeys(source);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey(key = targetKeys[i]) && sourceKeys.indexOf(key) === -1 && \n (result[key] = clone(target[key]));\n }\n for (i = 0, il = sourceKeys.length; i < il; ++i) {\n if (!isNotPrototypeKey(key = sourceKeys[i])) {\n continue;\n }\n if (key in target) {\n if (targetKeys.indexOf(key) !== -1) {\n if (cloneProtoObject && isMergeableObject(source[key]) && Object.getPrototypeOf(source[key]) !== JSON_PROTO) {\n result[key] = cloneProtoObject(source[key]);\n } else {\n result[key] = _deepmerge(target[key], source[key]);\n }\n }\n } else {\n result[key] = clone(source[key]);\n }\n }\n return result;\n }\n function _deepmerge(target, source) {\n const sourceIsArray = Array.isArray(source);\n const targetIsArray = Array.isArray(target);\n if (isPrimitive(source)) {\n return source;\n } else if (isPrimitiveOrBuiltIn(target)) {\n return clone(source);\n } else if (sourceIsArray && targetIsArray) {\n return mergeArray(target, source);\n } else if (sourceIsArray !== targetIsArray) {\n return clone(source);\n } else {\n return mergeObject(target, source);\n }\n }\n function _deepmergeAll() {\n switch (arguments.length) {\n case 0:\n return {};\n case 1:\n return clone(arguments[0]);\n case 2:\n return _deepmerge(arguments[0], arguments[1]);\n }\n let result;\n for (let i = 0, il = arguments.length; i < il; ++i) {\n result = _deepmerge(result, arguments[i]);\n }\n return result;\n }\n return _deepmergeAll;\n}\nfunction deepmergeArray(options) {\n const deepmerge2 = options.deepmerge;\n const clone = options.clone;\n return function(target, source) {\n let i = 0;\n const tl = target.length;\n const sl = source.length;\n const il = Math.max(target.length, source.length);\n const result = new Array(il);\n for (i = 0; i < il; ++i) {\n if (i < sl) {\n result[i] = deepmerge2(target[i], source[i]);\n } else {\n result[i] = clone(target[i]);\n }\n }\n return result;\n };\n}\nconst deepmerge = deepmergeConstructor({ mergeArray: deepmergeArray });\nfunction buildUnionError(ctx, errors, received) {\n return [\n {\n path: [...ctx.path],\n received,\n errors,\n isUnionError: true\n }\n ];\n}\nfunction buildError(ctx, message, received) {\n return [\n {\n message,\n path: [...ctx.path],\n received\n }\n ];\n}\nfunction pushPath(ctx, key) {\n ctx.path.push(key);\n}\nfunction popPath(ctx) {\n ctx.path.pop();\n}\nfunction printPath(ctx) {\n return ctx.path.join(".");\n}\nfunction buildSchemaErrorMessage(ctx, message) {\n return `Failed to print schema. At ${printPath(ctx)}: ${message}`;\n}\nconst limitedCommaJoinJson = (arr) => {\n const limit = 3;\n if (arr.length < limit) {\n return arr.map((it) => JSON.stringify(it)).join(", ");\n }\n return arr.slice(0, limit).map((it) => JSON.stringify(it)).join(", ") + `...`;\n};\nconst stringFormatters = {};\nfunction registerStringFormatter(name, validator) {\n stringFormatters[name] = validator;\n}\nconst numberFormatters = {};\nfunction registerNumberFormatter(name, validator) {\n numberFormatters[name] = validator;\n}\nclass TypeofRuntype {\n typeName;\n constructor(typeName) {\n this.typeName = typeName;\n }\n describe(_ctx) {\n return this.typeName;\n }\n schema(_ctx) {\n return { type: this.typeName };\n }\n validate(_ctx, input) {\n return typeof input === this.typeName;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected " + this.typeName, input);\n }\n}\nclass AnyRuntype {\n describe(_ctx) {\n return "any";\n }\n schema(_ctx) {\n return {};\n }\n validate(_ctx, _input) {\n return true;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected any", input);\n }\n}\nclass NullRuntype {\n describe(_ctx) {\n return "(null | undefined)";\n }\n schema(_ctx) {\n return { type: "null" };\n }\n validate(_ctx, input) {\n return input == null;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected nullish value", input);\n }\n}\nclass NeverRuntype {\n describe(_ctx) {\n return "never";\n }\n schema(_ctx) {\n return { anyOf: [] };\n }\n validate(_ctx, _input) {\n return false;\n }\n parseAfterValidation(_ctx, _input) {\n throw new Error("unreachable");\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected never", input);\n }\n}\nclass ConstRuntype {\n value;\n constructor(value) {\n this.value = value ?? null;\n }\n describe(_ctx) {\n return JSON.stringify(this.value);\n }\n schema(_ctx) {\n return { const: this.value };\n }\n validate(_ctx, input) {\n if (this.value == null) {\n return input == this.value;\n }\n return input === this.value;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected ${JSON.stringify(this.value)}`, input);\n }\n}\nclass RegexRuntype {\n regex;\n description;\n constructor(regex, description) {\n this.regex = regex;\n this.description = description;\n }\n describe(_ctx) {\n return this.description;\n }\n schema(_ctx) {\n return { type: "string", pattern: this.description };\n }\n validate(_ctx, input) {\n if (typeof input === "string") {\n return this.regex.test(input);\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected string matching ${this.description}`, input);\n }\n}\nclass DateRuntype {\n describe(_ctx) {\n return "Date";\n }\n schema(ctx) {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for Date"));\n }\n validate(_ctx, input) {\n return input instanceof Date;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected Date`, input);\n }\n}\nclass BigIntRuntype {\n describe(_ctx) {\n return "BigInt";\n }\n schema(ctx) {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for BigInt"));\n }\n validate(_ctx, input) {\n return typeof input === "bigint";\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected BigInt`, input);\n }\n}\nclass StringWithFormatRuntype {\n formats;\n constructor(formats) {\n this.formats = formats;\n }\n describe(ctx) {\n if (this.formats.length === 0) {\n throw new Error("INTERNAL ERROR: No formats provided");\n }\n const [first, ...rest] = this.formats;\n let acc = `StringFormat<"${first}">`;\n for (const r of rest) {\n acc = `StringFormatExtends<${acc}, "${r}">`;\n }\n return acc;\n }\n schema(ctx) {\n return {\n type: "string",\n format: this.formats.join(" and ")\n };\n }\n validate(ctx, input) {\n if (typeof input !== "string") {\n return false;\n }\n for (const f of this.formats) {\n const validator = stringFormatters[f];\n if (validator == null) {\n return false;\n }\n if (!validator(input)) {\n return false;\n }\n }\n return true;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected string with format "${this.formats.join(" and ")}"`, input);\n }\n}\nclass NumberWithFormatRuntype {\n formats;\n constructor(formats) {\n this.formats = formats;\n }\n describe(ctx) {\n if (this.formats.length === 0) {\n throw new Error("INTERNAL ERROR: No formats provided");\n }\n const [first, ...rest] = this.formats;\n let acc = `NumberFormat<"${first}">`;\n for (const r of rest) {\n acc = `NumberFormatExtends<${acc}, "${r}">`;\n }\n return acc;\n }\n schema(ctx) {\n return {\n type: "number",\n format: this.formats.join(" and ")\n };\n }\n validate(ctx, input) {\n if (typeof input !== "number") {\n return false;\n }\n for (const f of this.formats) {\n const validator = numberFormatters[f];\n if (validator == null) {\n return false;\n }\n if (!validator(input)) {\n return false;\n }\n }\n return true;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected number with format "${this.formats.join(" and ")}"`, input);\n }\n}\nclass AnyOfConstsRuntype {\n values;\n constructor(values) {\n this.values = values;\n }\n describe(ctx) {\n const parts = this.values.map((it) => JSON.stringify(it));\n const inner = parts.join(" | ");\n return `(${inner})`;\n }\n schema(ctx) {\n return {\n enum: this.values\n };\n }\n validate(ctx, input) {\n if (input == null) {\n if (this.values.includes(null)) {\n return true;\n }\n }\n return this.values.includes(input);\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected one of ${limitedCommaJoinJson(this.values)}`, input);\n }\n}\nclass TupleRuntype {\n prefix;\n rest;\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n describe(ctx) {\n const prefix = this.prefix.map((it) => it.describe(ctx)).join(", ");\n const rest = this.rest != null ? `...Array<${this.rest.describe(ctx)}>` : null;\n const inner = [prefix, rest].filter((it) => it != null && it.length > 0).join(", ");\n return `[${inner}]`;\n }\n schema(ctx) {\n pushPath(ctx, "[]");\n const prefixItems = this.prefix.map((it) => it.schema(ctx));\n const items = this.rest != null ? this.rest.schema(ctx) : false;\n popPath(ctx);\n return {\n type: "array",\n prefixItems,\n items\n };\n }\n validate(ctx, input) {\n if (Array.isArray(input)) {\n let idx = 0;\n for (const prefixItem of this.prefix) {\n if (!prefixItem.validate(ctx, input[idx])) {\n return false;\n }\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n if (!this.rest.validate(ctx, input[i])) {\n return false;\n }\n }\n } else {\n if (input.length > idx) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n let idx = 0;\n let acc = [];\n for (const prefixItem of this.prefix) {\n acc.push(prefixItem.parseAfterValidation(ctx, input[idx]));\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n acc.push(this.rest.parseAfterValidation(ctx, input[i]));\n }\n }\n return acc;\n }\n reportDecodeError(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected tuple", input);\n }\n let idx = 0;\n let acc = [];\n for (const prefixItem of this.prefix) {\n const ok = prefixItem.validate(ctx, input[idx]);\n if (!ok) {\n pushPath(ctx, `[${idx}]`);\n const errors = prefixItem.reportDecodeError(ctx, input[idx]);\n acc.push(...errors);\n popPath(ctx);\n }\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n const ok = this.rest.validate(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const errors = this.rest.reportDecodeError(ctx, input[i]);\n acc.push(...errors);\n popPath(ctx);\n }\n }\n }\n return acc;\n }\n}\nclass AllOfRuntype {\n schemas;\n constructor(schemas) {\n this.schemas = schemas;\n }\n describe(ctx) {\n return `(${this.schemas.map((it) => it.describe(ctx)).join(" & ")})`;\n }\n schema(ctx) {\n return {\n allOf: this.schemas.map((it) => it.schema(ctx))\n };\n }\n validate(ctx, input) {\n for (const it of this.schemas) {\n const isObj = typeof input === "object";\n if (!isObj) {\n return false;\n }\n if (!it.validate(ctx, input)) {\n return false;\n }\n }\n return true;\n }\n parseAfterValidation(ctx, input) {\n let acc = {};\n for (const it of this.schemas) {\n const parsed = it.parseAfterValidation(ctx, input);\n if (typeof parsed !== "object") {\n throw new Error("INTERNAL ERROR: AllOfParser: Expected object");\n }\n acc = { ...acc, ...parsed };\n }\n return acc;\n }\n reportDecodeError(ctx, input) {\n const acc = [];\n for (const v of this.schemas) {\n const errors = v.reportDecodeError(ctx, input);\n acc.push(...errors);\n }\n return acc;\n }\n}\nclass AnyOfRuntype {\n schemas;\n constructor(schemas) {\n this.schemas = schemas;\n }\n schema(ctx) {\n return {\n anyOf: this.schemas.map((it) => it.schema(ctx))\n };\n }\n validate(ctx, input) {\n for (const it of this.schemas) {\n if (it.validate(ctx, input)) {\n return true;\n }\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n const items = [];\n for (const it of this.schemas) {\n if (it.validate(ctx, input)) {\n items.push(it.parseAfterValidation(ctx, input));\n }\n }\n return deepmerge(...items);\n }\n reportDecodeError(ctx, input) {\n const acc = [];\n const oldPaths = ctx.path;\n ctx.path = [];\n for (const v of this.schemas) {\n const errors = v.reportDecodeError(ctx, input);\n acc.push(...errors);\n }\n ctx.path = oldPaths;\n return buildUnionError(ctx, acc, input);\n }\n describe(ctx) {\n return `(${this.schemas.map((it) => it.describe(ctx)).join(" | ")})`;\n }\n}\nclass ArrayRuntype {\n itemParser;\n constructor(itemParser) {\n this.itemParser = itemParser;\n }\n schema(ctx) {\n pushPath(ctx, "[]");\n const items = this.itemParser.schema(ctx);\n popPath(ctx);\n return {\n type: "array",\n items\n };\n }\n validate(ctx, input) {\n if (Array.isArray(input)) {\n for (let i = 0; i < input.length; i++) {\n const v = input[i];\n const ok = this.itemParser.validate(ctx, v);\n if (!ok) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n return input.map((v) => this.itemParser.parseAfterValidation(ctx, v));\n }\n reportDecodeError(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected array", input);\n }\n let acc = [];\n for (let i = 0; i < input.length; i++) {\n const ok = this.itemParser.validate(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const v = input[i];\n const arr2 = this.itemParser.reportDecodeError(ctx, v);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n return acc;\n }\n describe(ctx) {\n return `Array<${this.itemParser.describe(ctx)}>`;\n }\n}\nclass AnyOfDiscriminatedRuntype {\n schemas;\n discriminator;\n mapping;\n constructor(schemas, discriminator, mapping) {\n this.schemas = schemas;\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n schema(ctx) {\n return {\n anyOf: this.schemas.map((it) => it.schema(ctx))\n };\n }\n validate(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return false;\n }\n const d = input[this.discriminator];\n if (d == null) {\n return false;\n }\n const v = this.mapping[d];\n if (v == null) {\n return false;\n }\n return v.validate(ctx, input);\n }\n parseAfterValidation(ctx, input) {\n const parser = this.mapping[input[this.discriminator]];\n if (parser == null) {\n throw new Error(\n "INTERNAL ERROR: Missing parser for discriminator " + JSON.stringify(input[this.discriminator])\n );\n }\n return {\n ...parser.parseAfterValidation(ctx, input),\n [this.discriminator]: input[this.discriminator]\n };\n }\n reportDecodeError(ctx, input) {\n if (input == null || typeof input !== "object") {\n return buildError(ctx, "expected object", input);\n }\n const d = input[this.discriminator];\n if (d == null) {\n return buildError(ctx, "expected discriminator key " + JSON.stringify(this.discriminator), input);\n }\n const v = this.mapping[d];\n if (v == null) {\n pushPath(ctx, this.discriminator);\n const errs = buildError(\n ctx,\n "expected one of " + Object.keys(this.mapping).map((it) => JSON.stringify(it)).join(", "),\n d\n );\n popPath(ctx);\n return errs;\n }\n return v.reportDecodeError(ctx, input);\n }\n describe(ctx) {\n return `(${this.schemas.map((it) => it.describe(ctx)).join(" | ")})`;\n }\n}\nclass ObjectRuntype {\n properties;\n indexedPropertiesParser;\n constructor(properties, indexedPropertiesParser) {\n this.properties = properties;\n this.indexedPropertiesParser = indexedPropertiesParser;\n }\n describe(ctx) {\n const sortedKeys = Object.keys(this.properties).sort();\n const props = sortedKeys.map((k) => {\n const it = this.properties[k];\n const optionalMark = it._tag === "Optional" ? "?" : "";\n return `${k}${optionalMark}: ${it.t.describe(ctx)}`;\n }).join(", ");\n const indexPropsParats = this.indexedPropertiesParser.map(({ key, value }) => {\n return `[K in ${key.describe(ctx)}]: ${value.describe(ctx)}`;\n });\n const rest = indexPropsParats.join(", ");\n const content = [props, rest].filter((it) => it != null && it.length > 0).join(", ");\n return `{ ${content} }`;\n }\n schema(ctx) {\n const properties = {};\n for (const k in this.properties) {\n pushPath(ctx, k);\n properties[k] = this.properties[k].t.schema(ctx);\n popPath(ctx);\n }\n const required = Object.keys(this.properties);\n const base = {\n type: "object",\n properties,\n required\n };\n const indexSchemas = this.indexedPropertiesParser.map(({ key, value }) => {\n pushPath(ctx, "[key]");\n const keySchema = key.schema(ctx);\n popPath(ctx);\n pushPath(ctx, "[value]");\n const valueSchema = value.schema(ctx);\n popPath(ctx);\n return {\n type: "object",\n additionalProperties: valueSchema,\n propertyNames: keySchema\n };\n });\n if (indexSchemas.length === 0) {\n return { ...base, additionalProperties: false };\n }\n return {\n allOf: [base, ...indexSchemas]\n };\n }\n validate(ctx, input) {\n if (typeof input === "object" && !Array.isArray(input) && input !== null) {\n const configKeys = Object.keys(this.properties);\n for (const k of configKeys) {\n const validator = this.properties[k];\n if (!validator.t.validate(ctx, input[k])) {\n return false;\n }\n }\n if (this.indexedPropertiesParser.length > 0) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n let isValid = false;\n for (const p of this.indexedPropertiesParser) {\n if (!p.key.validate(ctx, k)) {\n continue;\n }\n const v = input[k];\n if (!p.value.validate(ctx, v)) {\n continue;\n }\n isValid = true;\n break;\n }\n if (!isValid) {\n return false;\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n if (extraKeys.length > 0) {\n return false;\n }\n }\n }\n return true;\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n let acc = {};\n const inputKeys = Object.keys(input);\n for (const k of inputKeys) {\n const v = input[k];\n if (k in this.properties) {\n const itemParsed = this.properties[k].t.parseAfterValidation(ctx, v);\n acc[k] = itemParsed;\n } else if (this.indexedPropertiesParser.length > 0) {\n for (const p of this.indexedPropertiesParser) {\n const isValid = p.key.validate(ctx, k) && p.value.validate(ctx, v);\n if (isValid) {\n const itemParsed = p.value.parseAfterValidation(ctx, v);\n const keyParsed = p.key.parseAfterValidation(ctx, k);\n acc[keyParsed] = itemParsed;\n }\n }\n }\n }\n return acc;\n }\n reportDecodeError(ctx, input) {\n if (typeof input !== "object" || Array.isArray(input) || input === null) {\n return buildError(ctx, "expected object", input);\n }\n let acc = [];\n const configKeys = Object.keys(this.properties);\n for (const k of configKeys) {\n const ok = this.properties[k].t.validate(ctx, input[k]);\n if (!ok) {\n pushPath(ctx, k);\n const arr2 = this.properties[k].t.reportDecodeError(ctx, input[k]);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n if (this.indexedPropertiesParser.length > 0) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n for (const p of this.indexedPropertiesParser) {\n const keyOk = p.key.validate(ctx, k);\n const valueOk = p.value.validate(ctx, input[k]);\n const ok = keyOk && valueOk;\n if (!ok) {\n pushPath(ctx, k);\n if (!keyOk) {\n const keyReported = p.key.reportDecodeError(ctx, k);\n acc.push(...keyReported);\n }\n if (!valueOk) {\n const valueReported = p.value.reportDecodeError(ctx, input[k]);\n acc.push(...valueReported);\n }\n popPath(ctx);\n }\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n if (extraKeys.length > 0) {\n return extraKeys.flatMap((k) => {\n pushPath(ctx, k);\n const err = buildError(ctx, `extra property`, input[k]);\n popPath(ctx);\n return err;\n });\n }\n }\n }\n return acc;\n }\n}\nclass RefRuntype {\n refName;\n constructor(refName) {\n this.refName = refName;\n }\n describe(ctx) {\n const name = this.refName;\n const to = namedRuntypes[this.refName];\n if (ctx.measure) {\n ctx.deps_counter[name] = (ctx.deps_counter[name] || 0) + 1;\n if (ctx.deps[name]) {\n return name;\n }\n ctx.deps[name] = true;\n ctx.deps[name] = to.describe(ctx);\n return name;\n } else {\n if (ctx.deps_counter[name] > 1) {\n if (!ctx.deps[name]) {\n ctx.deps[name] = true;\n ctx.deps[name] = to.describe(ctx);\n }\n return name;\n } else {\n return to.describe(ctx);\n }\n }\n }\n schema(ctx) {\n const name = this.refName;\n const to = namedRuntypes[this.refName];\n if (ctx.seen[name]) {\n return {};\n }\n ctx.seen[name] = true;\n var tmp = to.schema(ctx);\n delete ctx.seen[name];\n return tmp;\n }\n validate(ctx, input) {\n const to = namedRuntypes[this.refName];\n return to.validate(ctx, input);\n }\n parseAfterValidation(ctx, input) {\n const to = namedRuntypes[this.refName];\n return to.parseAfterValidation(ctx, input);\n }\n reportDecodeError(ctx, input) {\n const to = namedRuntypes[this.refName];\n return to.reportDecodeError(ctx, input);\n }\n}\nconst buildParsers = (args) => {\n const stringFormats = args?.stringFormats ?? {};\n for (const k of RequiredStringFormats) {\n if (stringFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n Object.keys(stringFormats).forEach((k) => {\n const v = stringFormats[k];\n registerStringFormatter(k, v);\n });\n const numberFormats = args?.numberFormats ?? {};\n for (const k of RequiredNumberFormats) {\n if (numberFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n Object.keys(numberFormats).forEach((k) => {\n const v = numberFormats[k];\n registerNumberFormatter(k, v);\n });\n let acc = {};\n for (const k of Object.keys(buildParsersInput)) {\n const impl = buildParsersInput[k];\n const validate = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ctx = { disallowExtraProperties };\n const ok = impl.validate(ctx, input);\n if (typeof ok !== "boolean") {\n throw new Error("INTERNAL ERROR: Expected boolean");\n }\n return ok;\n };\n const schema = () => {\n const ctx = {\n path: [],\n seen: {}\n };\n return impl.schema(ctx);\n };\n const describe = () => {\n const ctx = {\n deps: {},\n deps_counter: {},\n measure: true\n };\n let out = impl.describe(ctx);\n ctx["deps"] = {};\n ctx["measure"] = false;\n out = impl.describe(ctx);\n let sortedDepsKeys = Object.keys(ctx.deps).sort();\n const depsPart = sortedDepsKeys.map((key) => {\n return `type ${key} = ${ctx.deps[key]};`;\n }).join("\\n\\n");\n const outPart = `type Codec${k} = ${out};`;\n return [depsPart, outPart].filter((it2) => it2 != null && it2.length > 0).join("\\n\\n");\n };\n const safeParse = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ok = validate(input, options);\n if (ok) {\n let ctx2 = { disallowExtraProperties };\n const parsed = impl.parseAfterValidation(ctx2, input);\n return { success: true, data: parsed };\n }\n let ctx = { path: [], disallowExtraProperties };\n return {\n success: false,\n errors: impl.reportDecodeError(ctx, input).slice(0, 10)\n };\n };\n const parse = (input, options) => {\n const safe = safeParse(input, options);\n if (safe.success) {\n return safe.data;\n }\n const explained = printErrors(safe.errors, []);\n throw new Error(`Failed to parse ${k} - ${explained}`);\n };\n const zod = () => {\n return z.custom(\n (data) => validate(data),\n (val) => {\n const errors = impl.reportDecodeError({ path: [], disallowExtraProperties: false }, val);\n return printErrors(errors, []);\n }\n );\n };\n const it = {\n validate,\n schema,\n describe,\n safeParse,\n parse,\n zod,\n name: k\n };\n acc[k] = it;\n }\n return acc;\n};\n', "parser.d.ts": 'import { BuildParserFunction } from "@beff/client";\n\ndeclare const _exports: {\n buildParsers: BuildParserFunction;\n};\n\nexport default _exports;\n' };
|
|
45784
|
+
var bundle_default = { "codegen-v2.js": '"use strict";\nimport {\n printErrors\n} from "@beff/client";\nconst JSON_PROTO = Object.getPrototypeOf({});\nfunction deepmergeConstructor(options) {\n function isNotPrototypeKey(value) {\n return value !== "constructor" && value !== "prototype" && value !== "__proto__";\n }\n function cloneArray(value) {\n let i = 0;\n const il = value.length;\n const result = new Array(il);\n for (i; i < il; ++i) {\n result[i] = clone(value[i]);\n }\n return result;\n }\n function cloneObject(target) {\n const result = {};\n if (cloneProtoObject && Object.getPrototypeOf(target) !== JSON_PROTO) {\n return cloneProtoObject(target);\n }\n const targetKeys = getKeys(target);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey(key = targetKeys[i]) && (result[key] = clone(target[key]));\n }\n return result;\n }\n function concatArrays(target, source) {\n const tl = target.length;\n const sl = source.length;\n let i = 0;\n const result = new Array(tl + sl);\n for (i; i < tl; ++i) {\n result[i] = clone(target[i]);\n }\n for (i = 0; i < sl; ++i) {\n result[i + tl] = clone(source[i]);\n }\n return result;\n }\n const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;\n function getSymbolsAndKeys(value) {\n const result = Object.keys(value);\n const keys = Object.getOwnPropertySymbols(value);\n for (let i = 0, il = keys.length; i < il; ++i) {\n propertyIsEnumerable.call(value, keys[i]) && result.push(keys[i]);\n }\n return result;\n }\n const getKeys = options?.symbols ? getSymbolsAndKeys : Object.keys;\n const cloneProtoObject = typeof options?.cloneProtoObject === "function" ? options.cloneProtoObject : void 0;\n function isMergeableObject(value) {\n return typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date);\n }\n function isPrimitive(value) {\n return typeof value !== "object" || value === null;\n }\n const isPrimitiveOrBuiltIn = (\n \n typeof Buffer !== "undefined" ? (value) => typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date || \n value instanceof Buffer : (value) => typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date\n );\n const mergeArray = options && typeof options.mergeArray === "function" ? options.mergeArray({ clone, deepmerge: _deepmerge, getKeys, isMergeableObject }) : concatArrays;\n function clone(entry) {\n return isMergeableObject(entry) ? Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry) : entry;\n }\n function mergeObject(target, source) {\n const result = {};\n const targetKeys = getKeys(target);\n const sourceKeys = getKeys(source);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey(key = targetKeys[i]) && sourceKeys.indexOf(key) === -1 && \n (result[key] = clone(target[key]));\n }\n for (i = 0, il = sourceKeys.length; i < il; ++i) {\n if (!isNotPrototypeKey(key = sourceKeys[i])) {\n continue;\n }\n if (key in target) {\n if (targetKeys.indexOf(key) !== -1) {\n if (cloneProtoObject && isMergeableObject(source[key]) && Object.getPrototypeOf(source[key]) !== JSON_PROTO) {\n result[key] = cloneProtoObject(source[key]);\n } else {\n result[key] = _deepmerge(target[key], source[key]);\n }\n }\n } else {\n result[key] = clone(source[key]);\n }\n }\n return result;\n }\n function _deepmerge(target, source) {\n const sourceIsArray = Array.isArray(source);\n const targetIsArray = Array.isArray(target);\n if (isPrimitive(source)) {\n return source;\n } else if (isPrimitiveOrBuiltIn(target)) {\n return clone(source);\n } else if (sourceIsArray && targetIsArray) {\n return mergeArray(target, source);\n } else if (sourceIsArray !== targetIsArray) {\n return clone(source);\n } else {\n return mergeObject(target, source);\n }\n }\n function _deepmergeAll() {\n switch (arguments.length) {\n case 0:\n return {};\n case 1:\n return clone(arguments[0]);\n case 2:\n return _deepmerge(arguments[0], arguments[1]);\n }\n let result;\n for (let i = 0, il = arguments.length; i < il; ++i) {\n result = _deepmerge(result, arguments[i]);\n }\n return result;\n }\n return _deepmergeAll;\n}\nfunction deepmergeArray(options) {\n const deepmerge2 = options.deepmerge;\n const clone = options.clone;\n return function(target, source) {\n let i = 0;\n const tl = target.length;\n const sl = source.length;\n const il = Math.max(target.length, source.length);\n const result = new Array(il);\n for (i = 0; i < il; ++i) {\n if (i < sl) {\n result[i] = deepmerge2(target[i], source[i]);\n } else {\n result[i] = clone(target[i]);\n }\n }\n return result;\n };\n}\nconst deepmerge = deepmergeConstructor({ mergeArray: deepmergeArray });\nfunction buildUnionError(ctx, errors, received) {\n return [\n {\n path: [...ctx.path],\n received,\n errors,\n isUnionError: true\n }\n ];\n}\nfunction buildError(ctx, message, received) {\n return [\n {\n message,\n path: [...ctx.path],\n received\n }\n ];\n}\nfunction pushPath(ctx, key) {\n ctx.path.push(key);\n}\nfunction popPath(ctx) {\n ctx.path.pop();\n}\nfunction printPath(ctx) {\n return ctx.path.join(".");\n}\nfunction buildSchemaErrorMessage(ctx, message) {\n return `Failed to print schema. At ${printPath(ctx)}: ${message}`;\n}\nconst limitedCommaJoinJson = (arr) => {\n const limit = 3;\n if (arr.length < limit) {\n return arr.map((it) => JSON.stringify(it)).join(", ");\n }\n return arr.slice(0, limit).map((it) => JSON.stringify(it)).join(", ") + `...`;\n};\nconst stringFormatters = {};\nfunction registerStringFormatter(name, validator) {\n stringFormatters[name] = validator;\n}\nconst numberFormatters = {};\nfunction registerNumberFormatter(name, validator) {\n numberFormatters[name] = validator;\n}\nclass TypeofRuntype {\n typeName;\n constructor(typeName) {\n this.typeName = typeName;\n }\n describe(_ctx) {\n return this.typeName;\n }\n schema(_ctx) {\n return { type: this.typeName };\n }\n validate(_ctx, input) {\n return typeof input === this.typeName;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected " + this.typeName, input);\n }\n}\nclass AnyRuntype {\n describe(_ctx) {\n return "any";\n }\n schema(_ctx) {\n return {};\n }\n validate(_ctx, _input) {\n return true;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected any", input);\n }\n}\nclass NullishRuntype {\n description;\n constructor(description) {\n this.description = description;\n }\n describe(_ctx) {\n return this.description;\n }\n schema(_ctx) {\n return { type: "null" };\n }\n validate(_ctx, input) {\n return input == null;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected nullish value", input);\n }\n}\nclass NeverRuntype {\n describe(_ctx) {\n return "never";\n }\n schema(_ctx) {\n return { anyOf: [] };\n }\n validate(_ctx, _input) {\n return false;\n }\n parseAfterValidation(_ctx, _input) {\n throw new Error("unreachable");\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, "expected never", input);\n }\n}\nclass ConstRuntype {\n value;\n constructor(value) {\n this.value = value ?? null;\n }\n describe(_ctx) {\n return JSON.stringify(this.value);\n }\n schema(_ctx) {\n return { const: this.value };\n }\n validate(_ctx, input) {\n if (this.value == null) {\n return input == this.value;\n }\n return input === this.value;\n }\n parseAfterValidation(_ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected ${JSON.stringify(this.value)}`, input);\n }\n}\nclass RegexRuntype {\n regex;\n description;\n constructor(regex, description) {\n this.regex = regex;\n this.description = description;\n }\n describe(_ctx) {\n return this.description;\n }\n schema(_ctx) {\n return { type: "string", pattern: this.description };\n }\n validate(_ctx, input) {\n if (typeof input === "string") {\n return this.regex.test(input);\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected string matching ${this.description}`, input);\n }\n}\nclass DateRuntype {\n describe(_ctx) {\n return "Date";\n }\n schema(ctx) {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for Date"));\n }\n validate(_ctx, input) {\n return input instanceof Date;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected Date`, input);\n }\n}\nclass BigIntRuntype {\n describe(_ctx) {\n return "BigInt";\n }\n schema(ctx) {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for BigInt"));\n }\n validate(_ctx, input) {\n return typeof input === "bigint";\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected BigInt`, input);\n }\n}\nclass StringWithFormatRuntype {\n formats;\n constructor(formats) {\n this.formats = formats;\n }\n describe(ctx) {\n if (this.formats.length === 0) {\n throw new Error("INTERNAL ERROR: No formats provided");\n }\n const [first, ...rest] = this.formats;\n let acc = `StringFormat<"${first}">`;\n for (const r of rest) {\n acc = `StringFormatExtends<${acc}, "${r}">`;\n }\n return acc;\n }\n schema(ctx) {\n return {\n type: "string",\n format: this.formats.join(" and ")\n };\n }\n validate(ctx, input) {\n if (typeof input !== "string") {\n return false;\n }\n for (const f of this.formats) {\n const validator = stringFormatters[f];\n if (validator == null) {\n return false;\n }\n if (!validator(input)) {\n return false;\n }\n }\n return true;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected string with format "${this.formats.join(" and ")}"`, input);\n }\n}\nclass NumberWithFormatRuntype {\n formats;\n constructor(formats) {\n this.formats = formats;\n }\n describe(ctx) {\n if (this.formats.length === 0) {\n throw new Error("INTERNAL ERROR: No formats provided");\n }\n const [first, ...rest] = this.formats;\n let acc = `NumberFormat<"${first}">`;\n for (const r of rest) {\n acc = `NumberFormatExtends<${acc}, "${r}">`;\n }\n return acc;\n }\n schema(ctx) {\n return {\n type: "number",\n format: this.formats.join(" and ")\n };\n }\n validate(ctx, input) {\n if (typeof input !== "number") {\n return false;\n }\n for (const f of this.formats) {\n const validator = numberFormatters[f];\n if (validator == null) {\n return false;\n }\n if (!validator(input)) {\n return false;\n }\n }\n return true;\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected number with format "${this.formats.join(" and ")}"`, input);\n }\n}\nclass AnyOfConstsRuntype {\n values;\n constructor(values) {\n this.values = values;\n }\n describe(ctx) {\n const parts = this.values.map((it) => JSON.stringify(it));\n const inner = parts.join(" | ");\n return `(${inner})`;\n }\n schema(ctx) {\n return {\n enum: this.values\n };\n }\n validate(ctx, input) {\n if (input == null) {\n if (this.values.includes(null)) {\n return true;\n }\n }\n return this.values.includes(input);\n }\n parseAfterValidation(ctx, input) {\n return input;\n }\n reportDecodeError(ctx, input) {\n return buildError(ctx, `expected one of ${limitedCommaJoinJson(this.values)}`, input);\n }\n}\nclass TupleRuntype {\n prefix;\n rest;\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n describe(ctx) {\n const prefix = this.prefix.map((it) => it.describe(ctx)).join(", ");\n const rest = this.rest != null ? `...Array<${this.rest.describe(ctx)}>` : null;\n const inner = [prefix, rest].filter((it) => it != null && it.length > 0).join(", ");\n return `[${inner}]`;\n }\n schema(ctx) {\n pushPath(ctx, "[]");\n const prefixItems = this.prefix.map((it) => it.schema(ctx));\n const items = this.rest != null ? this.rest.schema(ctx) : false;\n popPath(ctx);\n return {\n type: "array",\n prefixItems,\n items\n };\n }\n validate(ctx, input) {\n if (Array.isArray(input)) {\n let idx = 0;\n for (const prefixItem of this.prefix) {\n if (!prefixItem.validate(ctx, input[idx])) {\n return false;\n }\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n if (!this.rest.validate(ctx, input[i])) {\n return false;\n }\n }\n } else {\n if (input.length > idx) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n let idx = 0;\n let acc = [];\n for (const prefixItem of this.prefix) {\n acc.push(prefixItem.parseAfterValidation(ctx, input[idx]));\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n acc.push(this.rest.parseAfterValidation(ctx, input[i]));\n }\n }\n return acc;\n }\n reportDecodeError(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected tuple", input);\n }\n let idx = 0;\n let acc = [];\n for (const prefixItem of this.prefix) {\n const ok = prefixItem.validate(ctx, input[idx]);\n if (!ok) {\n pushPath(ctx, `[${idx}]`);\n const errors = prefixItem.reportDecodeError(ctx, input[idx]);\n acc.push(...errors);\n popPath(ctx);\n }\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n const ok = this.rest.validate(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const errors = this.rest.reportDecodeError(ctx, input[i]);\n acc.push(...errors);\n popPath(ctx);\n }\n }\n }\n return acc;\n }\n}\nclass AllOfRuntype {\n schemas;\n constructor(schemas) {\n this.schemas = schemas;\n }\n describe(ctx) {\n return `(${this.schemas.map((it) => it.describe(ctx)).join(" & ")})`;\n }\n schema(ctx) {\n return {\n allOf: this.schemas.map((it) => it.schema(ctx))\n };\n }\n validate(ctx, input) {\n for (const it of this.schemas) {\n const isObj = typeof input === "object";\n if (!isObj) {\n return false;\n }\n if (!it.validate(ctx, input)) {\n return false;\n }\n }\n return true;\n }\n parseAfterValidation(ctx, input) {\n let acc = {};\n for (const it of this.schemas) {\n const parsed = it.parseAfterValidation(ctx, input);\n if (typeof parsed !== "object") {\n throw new Error("INTERNAL ERROR: AllOfParser: Expected object");\n }\n acc = { ...acc, ...parsed };\n }\n return acc;\n }\n reportDecodeError(ctx, input) {\n const acc = [];\n for (const v of this.schemas) {\n const errors = v.reportDecodeError(ctx, input);\n acc.push(...errors);\n }\n return acc;\n }\n}\nclass AnyOfRuntype {\n schemas;\n constructor(schemas) {\n this.schemas = schemas;\n }\n schema(ctx) {\n return {\n anyOf: this.schemas.map((it) => it.schema(ctx))\n };\n }\n validate(ctx, input) {\n for (const it of this.schemas) {\n if (it.validate(ctx, input)) {\n return true;\n }\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n const items = [];\n for (const it of this.schemas) {\n if (it.validate(ctx, input)) {\n items.push(it.parseAfterValidation(ctx, input));\n }\n }\n return deepmerge(...items);\n }\n reportDecodeError(ctx, input) {\n const acc = [];\n const oldPaths = ctx.path;\n ctx.path = [];\n for (const v of this.schemas) {\n const errors = v.reportDecodeError(ctx, input);\n acc.push(...errors);\n }\n ctx.path = oldPaths;\n return buildUnionError(ctx, acc, input);\n }\n describe(ctx) {\n return `(${this.schemas.map((it) => it.describe(ctx)).join(" | ")})`;\n }\n}\nclass ArrayRuntype {\n itemParser;\n constructor(itemParser) {\n this.itemParser = itemParser;\n }\n schema(ctx) {\n pushPath(ctx, "[]");\n const items = this.itemParser.schema(ctx);\n popPath(ctx);\n return {\n type: "array",\n items\n };\n }\n validate(ctx, input) {\n if (Array.isArray(input)) {\n for (let i = 0; i < input.length; i++) {\n const v = input[i];\n const ok = this.itemParser.validate(ctx, v);\n if (!ok) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n return input.map((v) => this.itemParser.parseAfterValidation(ctx, v));\n }\n reportDecodeError(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected array", input);\n }\n let acc = [];\n for (let i = 0; i < input.length; i++) {\n const ok = this.itemParser.validate(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const v = input[i];\n const arr2 = this.itemParser.reportDecodeError(ctx, v);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n return acc;\n }\n describe(ctx) {\n return `Array<${this.itemParser.describe(ctx)}>`;\n }\n}\nclass AnyOfDiscriminatedRuntype {\n schemas;\n discriminator;\n mapping;\n constructor(schemas, discriminator, mapping) {\n this.schemas = schemas;\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n schema(ctx) {\n return {\n anyOf: this.schemas.map((it) => it.schema(ctx))\n };\n }\n validate(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return false;\n }\n const d = input[this.discriminator];\n if (d == null) {\n return false;\n }\n const v = this.mapping[d];\n if (v == null) {\n return false;\n }\n return v.validate(ctx, input);\n }\n parseAfterValidation(ctx, input) {\n const parser = this.mapping[input[this.discriminator]];\n if (parser == null) {\n throw new Error(\n "INTERNAL ERROR: Missing parser for discriminator " + JSON.stringify(input[this.discriminator])\n );\n }\n return {\n ...parser.parseAfterValidation(ctx, input),\n [this.discriminator]: input[this.discriminator]\n };\n }\n reportDecodeError(ctx, input) {\n if (input == null || typeof input !== "object") {\n return buildError(ctx, "expected object", input);\n }\n const d = input[this.discriminator];\n if (d == null) {\n return buildError(ctx, "expected discriminator key " + JSON.stringify(this.discriminator), input);\n }\n const v = this.mapping[d];\n if (v == null) {\n pushPath(ctx, this.discriminator);\n const errs = buildError(\n ctx,\n "expected one of " + Object.keys(this.mapping).map((it) => JSON.stringify(it)).join(", "),\n d\n );\n popPath(ctx);\n return errs;\n }\n return v.reportDecodeError(ctx, input);\n }\n describe(ctx) {\n return `(${this.schemas.map((it) => it.describe(ctx)).join(" | ")})`;\n }\n}\nclass OptionalField {\n t;\n constructor(t) {\n this.t = t;\n }\n schema(ctx) {\n const inner = this.t.schema(ctx);\n return {\n anyOf: [inner, { type: "null" }]\n };\n }\n validate(ctx, input) {\n if (input == null) {\n return true;\n }\n return this.t.validate(ctx, input);\n }\n parseAfterValidation(ctx, input) {\n if (input == null) {\n return input;\n }\n return this.t.parseAfterValidation(ctx, input);\n }\n reportDecodeError(ctx, input) {\n const acc = [];\n acc.push(...buildError(ctx, "expected nullish value", input));\n return [...acc, ...this.t.reportDecodeError(ctx, input)];\n }\n describe(ctx) {\n return this.t.describe(ctx);\n }\n}\nclass ObjectRuntype {\n properties;\n indexedPropertiesParser;\n constructor(properties, indexedPropertiesParser) {\n this.properties = properties;\n this.indexedPropertiesParser = indexedPropertiesParser;\n }\n describe(ctx) {\n const sortedKeys = Object.keys(this.properties).sort();\n const props = sortedKeys.map((k) => {\n const it = this.properties[k];\n const optionalMark = it instanceof OptionalField ? "?" : "";\n return `${k}${optionalMark}: ${it.describe(ctx)}`;\n }).join(", ");\n const indexPropsParats = this.indexedPropertiesParser.map(({ key, value }) => {\n return `[K in ${key.describe(ctx)}]: ${value.describe(ctx)}`;\n });\n const rest = indexPropsParats.join(", ");\n const content = [props, rest].filter((it) => it != null && it.length > 0).join(", ");\n return `{ ${content} }`;\n }\n schema(ctx) {\n const properties = {};\n for (const k in this.properties) {\n pushPath(ctx, k);\n const item = this.properties[k];\n properties[k] = item.schema(ctx);\n popPath(ctx);\n }\n const required = Object.keys(this.properties);\n const base = {\n type: "object",\n properties,\n required\n };\n const indexSchemas = this.indexedPropertiesParser.map(({ key, value }) => {\n pushPath(ctx, "[key]");\n const keySchema = key.schema(ctx);\n popPath(ctx);\n pushPath(ctx, "[value]");\n const valueSchema = value.schema(ctx);\n popPath(ctx);\n return {\n type: "object",\n additionalProperties: valueSchema,\n propertyNames: keySchema\n };\n });\n if (indexSchemas.length === 0) {\n return { ...base, additionalProperties: false };\n }\n return {\n allOf: [base, ...indexSchemas]\n };\n }\n validate(ctx, input) {\n if (typeof input === "object" && !Array.isArray(input) && input !== null) {\n const configKeys = Object.keys(this.properties);\n for (const k of configKeys) {\n const validator = this.properties[k];\n if (!validator.validate(ctx, input[k])) {\n return false;\n }\n }\n if (this.indexedPropertiesParser.length > 0) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n let isValid = false;\n for (const p of this.indexedPropertiesParser) {\n if (!p.key.validate(ctx, k)) {\n continue;\n }\n const v = input[k];\n if (!p.value.validate(ctx, v)) {\n continue;\n }\n isValid = true;\n break;\n }\n if (!isValid) {\n return false;\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n if (extraKeys.length > 0) {\n return false;\n }\n }\n }\n return true;\n }\n return false;\n }\n parseAfterValidation(ctx, input) {\n let acc = {};\n const inputKeys = Object.keys(input);\n for (const k of inputKeys) {\n const v = input[k];\n if (k in this.properties) {\n const itemParsed = this.properties[k].parseAfterValidation(ctx, v);\n acc[k] = itemParsed;\n } else if (this.indexedPropertiesParser.length > 0) {\n for (const p of this.indexedPropertiesParser) {\n const isValid = p.key.validate(ctx, k) && p.value.validate(ctx, v);\n if (isValid) {\n const itemParsed = p.value.parseAfterValidation(ctx, v);\n const keyParsed = p.key.parseAfterValidation(ctx, k);\n acc[keyParsed] = itemParsed;\n }\n }\n }\n }\n return acc;\n }\n reportDecodeError(ctx, input) {\n if (typeof input !== "object" || Array.isArray(input) || input === null) {\n return buildError(ctx, "expected object", input);\n }\n let acc = [];\n const configKeys = Object.keys(this.properties);\n for (const k of configKeys) {\n const ok = this.properties[k].validate(ctx, input[k]);\n if (!ok) {\n pushPath(ctx, k);\n const arr2 = this.properties[k].reportDecodeError(ctx, input[k]);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n if (this.indexedPropertiesParser.length > 0) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n for (const p of this.indexedPropertiesParser) {\n const keyOk = p.key.validate(ctx, k);\n const valueOk = p.value.validate(ctx, input[k]);\n const ok = keyOk && valueOk;\n if (!ok) {\n pushPath(ctx, k);\n if (!keyOk) {\n const keyReported = p.key.reportDecodeError(ctx, k);\n acc.push(...keyReported);\n }\n if (!valueOk) {\n const valueReported = p.value.reportDecodeError(ctx, input[k]);\n acc.push(...valueReported);\n }\n popPath(ctx);\n }\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n if (extraKeys.length > 0) {\n return extraKeys.flatMap((k) => {\n pushPath(ctx, k);\n const err = buildError(ctx, `extra property`, input[k]);\n popPath(ctx);\n return err;\n });\n }\n }\n }\n return acc;\n }\n}\nclass RefRuntype {\n refName;\n constructor(refName) {\n this.refName = refName;\n }\n describe(ctx) {\n const name = this.refName;\n const to = namedRuntypes[this.refName];\n if (ctx.measure) {\n ctx.deps_counter[name] = (ctx.deps_counter[name] || 0) + 1;\n if (ctx.deps[name]) {\n return name;\n }\n ctx.deps[name] = true;\n ctx.deps[name] = to.describe(ctx);\n return name;\n } else {\n if (ctx.deps_counter[name] > 1) {\n if (!ctx.deps[name]) {\n ctx.deps[name] = true;\n ctx.deps[name] = to.describe(ctx);\n }\n return name;\n } else {\n return to.describe(ctx);\n }\n }\n }\n schema(ctx) {\n const name = this.refName;\n const to = namedRuntypes[this.refName];\n if (ctx.seen[name]) {\n return {};\n }\n ctx.seen[name] = true;\n var tmp = to.schema(ctx);\n delete ctx.seen[name];\n return tmp;\n }\n validate(ctx, input) {\n const to = namedRuntypes[this.refName];\n return to.validate(ctx, input);\n }\n parseAfterValidation(ctx, input) {\n const to = namedRuntypes[this.refName];\n return to.parseAfterValidation(ctx, input);\n }\n reportDecodeError(ctx, input) {\n const to = namedRuntypes[this.refName];\n return to.reportDecodeError(ctx, input);\n }\n}\nconst buildParsers = (args) => {\n const stringFormats = args?.stringFormats ?? {};\n for (const k of RequiredStringFormats) {\n if (stringFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n Object.keys(stringFormats).forEach((k) => {\n const v = stringFormats[k];\n registerStringFormatter(k, v);\n });\n const numberFormats = args?.numberFormats ?? {};\n for (const k of RequiredNumberFormats) {\n if (numberFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n Object.keys(numberFormats).forEach((k) => {\n const v = numberFormats[k];\n registerNumberFormatter(k, v);\n });\n let acc = {};\n for (const k of Object.keys(buildParsersInput)) {\n const impl = buildParsersInput[k];\n const validate = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ctx = { disallowExtraProperties };\n const ok = impl.validate(ctx, input);\n if (typeof ok !== "boolean") {\n throw new Error("INTERNAL ERROR: Expected boolean");\n }\n return ok;\n };\n const schema = () => {\n const ctx = {\n path: [],\n seen: {}\n };\n return impl.schema(ctx);\n };\n const describe = () => {\n const ctx = {\n deps: {},\n deps_counter: {},\n measure: true\n };\n let out = impl.describe(ctx);\n ctx["deps"] = {};\n ctx["measure"] = false;\n out = impl.describe(ctx);\n let sortedDepsKeys = Object.keys(ctx.deps).sort();\n const depsPart = sortedDepsKeys.map((key) => {\n return `type ${key} = ${ctx.deps[key]};`;\n }).join("\\n\\n");\n const outPart = `type Codec${k} = ${out};`;\n return [depsPart, outPart].filter((it2) => it2 != null && it2.length > 0).join("\\n\\n");\n };\n const safeParse = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ok = validate(input, options);\n if (ok) {\n let ctx2 = { disallowExtraProperties };\n const parsed = impl.parseAfterValidation(ctx2, input);\n return { success: true, data: parsed };\n }\n let ctx = { path: [], disallowExtraProperties };\n return {\n success: false,\n errors: impl.reportDecodeError(ctx, input).slice(0, 10)\n };\n };\n const parse = (input, options) => {\n const safe = safeParse(input, options);\n if (safe.success) {\n return safe.data;\n }\n const explained = printErrors(safe.errors, []);\n throw new Error(`Failed to parse ${k} - ${explained}`);\n };\n const zod = () => {\n return z.custom(\n (data) => validate(data),\n (val) => {\n const errors = impl.reportDecodeError({ path: [], disallowExtraProperties: false }, val);\n return printErrors(errors, []);\n }\n );\n };\n const it = {\n validate,\n schema,\n describe,\n safeParse,\n parse,\n zod,\n name: k\n };\n acc[k] = it;\n }\n return acc;\n};\n', "parser.d.ts": 'import { BuildParserFunction } from "@beff/client";\n\ndeclare const _exports: {\n buildParsers: BuildParserFunction;\n};\n\nexport default _exports;\n' };
|
|
45785
45785
|
|
|
45786
45786
|
// ts-node/bundle-to-disk.ts
|
|
45787
45787
|
var esmTag = (mod) => {
|
|
@@ -45944,24 +45944,12 @@ var emitDiagnosticInfo = (data, padding) => {
|
|
|
45944
45944
|
console.error("");
|
|
45945
45945
|
};
|
|
45946
45946
|
var emitDiagnosticItem = (data) => {
|
|
45947
|
-
if (
|
|
45948
|
-
console.error(chalk.red.bold("Error
|
|
45947
|
+
if (data.UnknownFile) {
|
|
45948
|
+
console.error(chalk.red.bold("Error"));
|
|
45949
45949
|
} else {
|
|
45950
|
-
|
|
45951
|
-
console.error(chalk.red.bold("Error"));
|
|
45952
|
-
} else {
|
|
45953
|
-
console.error(chalk.red.bold("Error: " + data.cause.KnownFile.message));
|
|
45954
|
-
}
|
|
45950
|
+
console.error(chalk.red.bold("Error: " + data.KnownFile.message));
|
|
45955
45951
|
}
|
|
45956
|
-
emitDiagnosticInfo(data
|
|
45957
|
-
const inf = data.related_information ?? [];
|
|
45958
|
-
if (inf.length == 0) {
|
|
45959
|
-
return;
|
|
45960
|
-
}
|
|
45961
|
-
inf.forEach((data2) => {
|
|
45962
|
-
console.error(chalk.yellow(" ".repeat(4) + "Caused by:"));
|
|
45963
|
-
emitDiagnosticInfo(data2, " ".repeat(5));
|
|
45964
|
-
});
|
|
45952
|
+
emitDiagnosticInfo(data, " ".repeat(1));
|
|
45965
45953
|
};
|
|
45966
45954
|
var emitDiagnostics = (diag) => {
|
|
45967
45955
|
diag.diagnostics.forEach((data) => {
|
package/package.json
CHANGED
package/pkg/beff_wasm.d.ts
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
* @param {string} parser_entry_point
|
|
5
|
-
* @param {any} settings
|
|
6
|
-
* @returns {any}
|
|
7
|
-
*/
|
|
3
|
+
|
|
8
4
|
export function bundle_to_diagnostics(parser_entry_point: string, settings: any): any;
|
|
9
|
-
|
|
10
|
-
* @param {string} parser_entry_point
|
|
11
|
-
* @param {any} settings
|
|
12
|
-
* @returns {any}
|
|
13
|
-
*/
|
|
5
|
+
|
|
14
6
|
export function bundle_to_string_v2(parser_entry_point: string, settings: any): any;
|
|
15
|
-
|
|
16
|
-
* @param {string} file_name
|
|
17
|
-
* @param {string} content
|
|
18
|
-
*/
|
|
19
|
-
export function update_file_content(file_name: string, content: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* @param {boolean} verbose
|
|
22
|
-
*/
|
|
7
|
+
|
|
23
8
|
export function init(verbose: boolean): void;
|
|
9
|
+
|
|
10
|
+
export function update_file_content(file_name: string, content: string): void;
|
package/pkg/beff_wasm.js
CHANGED
|
@@ -1,133 +1,13 @@
|
|
|
1
|
+
|
|
1
2
|
let imports = {};
|
|
2
3
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
|
-
let wasm;
|
|
4
|
-
const { TextEncoder, TextDecoder } = require(`util`);
|
|
5
|
-
|
|
6
|
-
const heap = new Array(128).fill(undefined);
|
|
7
|
-
|
|
8
|
-
heap.push(undefined, null, true, false);
|
|
9
|
-
|
|
10
|
-
function getObject(idx) { return heap[idx]; }
|
|
11
|
-
|
|
12
|
-
let heap_next = heap.length;
|
|
13
|
-
|
|
14
|
-
function dropObject(idx) {
|
|
15
|
-
if (idx < 132) return;
|
|
16
|
-
heap[idx] = heap_next;
|
|
17
|
-
heap_next = idx;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function takeObject(idx) {
|
|
21
|
-
const ret = getObject(idx);
|
|
22
|
-
dropObject(idx);
|
|
23
|
-
return ret;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let WASM_VECTOR_LEN = 0;
|
|
27
|
-
|
|
28
|
-
let cachedUint8Memory0 = null;
|
|
29
|
-
|
|
30
|
-
function getUint8Memory0() {
|
|
31
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
32
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
33
|
-
}
|
|
34
|
-
return cachedUint8Memory0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
38
|
-
|
|
39
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
40
|
-
? function (arg, view) {
|
|
41
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
42
|
-
}
|
|
43
|
-
: function (arg, view) {
|
|
44
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
45
|
-
view.set(buf);
|
|
46
|
-
return {
|
|
47
|
-
read: arg.length,
|
|
48
|
-
written: buf.length
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
53
|
-
|
|
54
|
-
if (realloc === undefined) {
|
|
55
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
56
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
57
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
58
|
-
WASM_VECTOR_LEN = buf.length;
|
|
59
|
-
return ptr;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
let len = arg.length;
|
|
63
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
64
|
-
|
|
65
|
-
const mem = getUint8Memory0();
|
|
66
|
-
|
|
67
|
-
let offset = 0;
|
|
68
|
-
|
|
69
|
-
for (; offset < len; offset++) {
|
|
70
|
-
const code = arg.charCodeAt(offset);
|
|
71
|
-
if (code > 0x7F) break;
|
|
72
|
-
mem[ptr + offset] = code;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (offset !== len) {
|
|
76
|
-
if (offset !== 0) {
|
|
77
|
-
arg = arg.slice(offset);
|
|
78
|
-
}
|
|
79
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
80
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
81
|
-
const ret = encodeString(arg, view);
|
|
82
|
-
|
|
83
|
-
offset += ret.written;
|
|
84
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
WASM_VECTOR_LEN = offset;
|
|
88
|
-
return ptr;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function isLikeNone(x) {
|
|
92
|
-
return x === undefined || x === null;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
let cachedInt32Memory0 = null;
|
|
96
|
-
|
|
97
|
-
function getInt32Memory0() {
|
|
98
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
99
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
100
|
-
}
|
|
101
|
-
return cachedInt32Memory0;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
105
|
-
|
|
106
|
-
cachedTextDecoder.decode();
|
|
107
|
-
|
|
108
|
-
function getStringFromWasm0(ptr, len) {
|
|
109
|
-
ptr = ptr >>> 0;
|
|
110
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
111
|
-
}
|
|
112
4
|
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
heap_next = heap[idx];
|
|
117
|
-
|
|
118
|
-
heap[idx] = obj;
|
|
5
|
+
function addToExternrefTable0(obj) {
|
|
6
|
+
const idx = wasm.__externref_table_alloc();
|
|
7
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
119
8
|
return idx;
|
|
120
9
|
}
|
|
121
10
|
|
|
122
|
-
let cachedFloat64Memory0 = null;
|
|
123
|
-
|
|
124
|
-
function getFloat64Memory0() {
|
|
125
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
126
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
127
|
-
}
|
|
128
|
-
return cachedFloat64Memory0;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
11
|
function debugString(val) {
|
|
132
12
|
// primitive types
|
|
133
13
|
const type = typeof val;
|
|
@@ -169,7 +49,7 @@ function debugString(val) {
|
|
|
169
49
|
// Test for built-in
|
|
170
50
|
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
171
51
|
let className;
|
|
172
|
-
if (builtInMatches.length > 1) {
|
|
52
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
173
53
|
className = builtInMatches[1];
|
|
174
54
|
} else {
|
|
175
55
|
// Failed to match the standard '[object ClassName]'
|
|
@@ -192,221 +72,273 @@ function debugString(val) {
|
|
|
192
72
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
193
73
|
return className;
|
|
194
74
|
}
|
|
195
|
-
/**
|
|
196
|
-
* @param {string} parser_entry_point
|
|
197
|
-
* @param {any} settings
|
|
198
|
-
* @returns {any}
|
|
199
|
-
*/
|
|
200
|
-
module.exports.bundle_to_diagnostics = function(parser_entry_point, settings) {
|
|
201
|
-
const ptr0 = passStringToWasm0(parser_entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
202
|
-
const len0 = WASM_VECTOR_LEN;
|
|
203
|
-
const ret = wasm.bundle_to_diagnostics(ptr0, len0, addHeapObject(settings));
|
|
204
|
-
return takeObject(ret);
|
|
205
|
-
};
|
|
206
75
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
*/
|
|
212
|
-
module.exports.bundle_to_string_v2 = function(parser_entry_point, settings) {
|
|
213
|
-
const ptr0 = passStringToWasm0(parser_entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
214
|
-
const len0 = WASM_VECTOR_LEN;
|
|
215
|
-
const ret = wasm.bundle_to_string_v2(ptr0, len0, addHeapObject(settings));
|
|
216
|
-
return takeObject(ret);
|
|
217
|
-
};
|
|
76
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
77
|
+
ptr = ptr >>> 0;
|
|
78
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
79
|
+
}
|
|
218
80
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
227
|
-
const len1 = WASM_VECTOR_LEN;
|
|
228
|
-
wasm.update_file_content(ptr0, len0, ptr1, len1);
|
|
229
|
-
};
|
|
81
|
+
let cachedDataViewMemory0 = null;
|
|
82
|
+
function getDataViewMemory0() {
|
|
83
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
84
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
85
|
+
}
|
|
86
|
+
return cachedDataViewMemory0;
|
|
87
|
+
}
|
|
230
88
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
89
|
+
function getStringFromWasm0(ptr, len) {
|
|
90
|
+
ptr = ptr >>> 0;
|
|
91
|
+
return decodeText(ptr, len);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let cachedUint8ArrayMemory0 = null;
|
|
95
|
+
function getUint8ArrayMemory0() {
|
|
96
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
97
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
98
|
+
}
|
|
99
|
+
return cachedUint8ArrayMemory0;
|
|
100
|
+
}
|
|
237
101
|
|
|
238
102
|
function handleError(f, args) {
|
|
239
103
|
try {
|
|
240
104
|
return f.apply(this, args);
|
|
241
105
|
} catch (e) {
|
|
242
|
-
|
|
106
|
+
const idx = addToExternrefTable0(e);
|
|
107
|
+
wasm.__wbindgen_exn_store(idx);
|
|
243
108
|
}
|
|
244
109
|
}
|
|
245
110
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
111
|
+
function isLikeNone(x) {
|
|
112
|
+
return x === undefined || x === null;
|
|
113
|
+
}
|
|
249
114
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
115
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
116
|
+
if (realloc === undefined) {
|
|
117
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
118
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
119
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
120
|
+
WASM_VECTOR_LEN = buf.length;
|
|
121
|
+
return ptr;
|
|
122
|
+
}
|
|
257
123
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return ret;
|
|
261
|
-
};
|
|
124
|
+
let len = arg.length;
|
|
125
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
262
126
|
|
|
263
|
-
|
|
264
|
-
const ret = getObject(arg0) in getObject(arg1);
|
|
265
|
-
return ret;
|
|
266
|
-
};
|
|
127
|
+
const mem = getUint8ArrayMemory0();
|
|
267
128
|
|
|
268
|
-
|
|
269
|
-
const obj = getObject(arg1);
|
|
270
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
271
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
272
|
-
var len1 = WASM_VECTOR_LEN;
|
|
273
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
274
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
275
|
-
};
|
|
129
|
+
let offset = 0;
|
|
276
130
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
131
|
+
for (; offset < len; offset++) {
|
|
132
|
+
const code = arg.charCodeAt(offset);
|
|
133
|
+
if (code > 0x7F) break;
|
|
134
|
+
mem[ptr + offset] = code;
|
|
135
|
+
}
|
|
136
|
+
if (offset !== len) {
|
|
137
|
+
if (offset !== 0) {
|
|
138
|
+
arg = arg.slice(offset);
|
|
139
|
+
}
|
|
140
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
141
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
142
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
282
143
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
144
|
+
offset += ret.written;
|
|
145
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
146
|
+
}
|
|
286
147
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
var len1 = WASM_VECTOR_LEN;
|
|
291
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
292
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
293
|
-
};
|
|
148
|
+
WASM_VECTOR_LEN = offset;
|
|
149
|
+
return ptr;
|
|
150
|
+
}
|
|
294
151
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
152
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
153
|
+
cachedTextDecoder.decode();
|
|
154
|
+
function decodeText(ptr, len) {
|
|
155
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const cachedTextEncoder = new TextEncoder();
|
|
299
159
|
|
|
300
|
-
|
|
301
|
-
|
|
160
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
161
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
162
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
163
|
+
view.set(buf);
|
|
164
|
+
return {
|
|
165
|
+
read: arg.length,
|
|
166
|
+
written: buf.length
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
let WASM_VECTOR_LEN = 0;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @param {string} parser_entry_point
|
|
175
|
+
* @param {any} settings
|
|
176
|
+
* @returns {any}
|
|
177
|
+
*/
|
|
178
|
+
function bundle_to_diagnostics(parser_entry_point, settings) {
|
|
179
|
+
const ptr0 = passStringToWasm0(parser_entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
180
|
+
const len0 = WASM_VECTOR_LEN;
|
|
181
|
+
const ret = wasm.bundle_to_diagnostics(ptr0, len0, settings);
|
|
302
182
|
return ret;
|
|
303
|
-
}
|
|
183
|
+
}
|
|
184
|
+
exports.bundle_to_diagnostics = bundle_to_diagnostics;
|
|
304
185
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
186
|
+
/**
|
|
187
|
+
* @param {string} parser_entry_point
|
|
188
|
+
* @param {any} settings
|
|
189
|
+
* @returns {any}
|
|
190
|
+
*/
|
|
191
|
+
function bundle_to_string_v2(parser_entry_point, settings) {
|
|
192
|
+
const ptr0 = passStringToWasm0(parser_entry_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
193
|
+
const len0 = WASM_VECTOR_LEN;
|
|
194
|
+
const ret = wasm.bundle_to_string_v2(ptr0, len0, settings);
|
|
308
195
|
return ret;
|
|
309
|
-
}
|
|
196
|
+
}
|
|
197
|
+
exports.bundle_to_string_v2 = bundle_to_string_v2;
|
|
310
198
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
199
|
+
/**
|
|
200
|
+
* @param {boolean} verbose
|
|
201
|
+
*/
|
|
202
|
+
function init(verbose) {
|
|
203
|
+
wasm.init(verbose);
|
|
204
|
+
}
|
|
205
|
+
exports.init = init;
|
|
317
206
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
207
|
+
/**
|
|
208
|
+
* @param {string} file_name
|
|
209
|
+
* @param {string} content
|
|
210
|
+
*/
|
|
211
|
+
function update_file_content(file_name, content) {
|
|
212
|
+
const ptr0 = passStringToWasm0(file_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
213
|
+
const len0 = WASM_VECTOR_LEN;
|
|
214
|
+
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
215
|
+
const len1 = WASM_VECTOR_LEN;
|
|
216
|
+
wasm.update_file_content(ptr0, len0, ptr1, len1);
|
|
217
|
+
}
|
|
218
|
+
exports.update_file_content = update_file_content;
|
|
219
|
+
|
|
220
|
+
exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
221
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
222
|
+
return ret;
|
|
321
223
|
};
|
|
322
224
|
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
|
|
225
|
+
exports.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
|
|
226
|
+
const v = arg0;
|
|
227
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
228
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
326
229
|
};
|
|
327
230
|
|
|
328
|
-
|
|
329
|
-
|
|
231
|
+
exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
232
|
+
const ret = debugString(arg1);
|
|
233
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
234
|
+
const len1 = WASM_VECTOR_LEN;
|
|
235
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
236
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
330
237
|
};
|
|
331
238
|
|
|
332
|
-
|
|
333
|
-
const ret =
|
|
334
|
-
return
|
|
239
|
+
exports.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
|
|
240
|
+
const ret = arg0 in arg1;
|
|
241
|
+
return ret;
|
|
335
242
|
};
|
|
336
243
|
|
|
337
|
-
|
|
338
|
-
const ret = arg0;
|
|
339
|
-
return
|
|
244
|
+
exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
245
|
+
const ret = typeof(arg0) === 'function';
|
|
246
|
+
return ret;
|
|
340
247
|
};
|
|
341
248
|
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
|
|
249
|
+
exports.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
250
|
+
const val = arg0;
|
|
251
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
252
|
+
return ret;
|
|
345
253
|
};
|
|
346
254
|
|
|
347
|
-
|
|
348
|
-
|
|
255
|
+
exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
256
|
+
const ret = arg0 === undefined;
|
|
257
|
+
return ret;
|
|
349
258
|
};
|
|
350
259
|
|
|
351
|
-
|
|
352
|
-
|
|
260
|
+
exports.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
|
|
261
|
+
const ret = arg0 == arg1;
|
|
262
|
+
return ret;
|
|
353
263
|
};
|
|
354
264
|
|
|
355
|
-
|
|
356
|
-
|
|
265
|
+
exports.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
|
|
266
|
+
const obj = arg1;
|
|
267
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
268
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
269
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
357
270
|
};
|
|
358
271
|
|
|
359
|
-
|
|
360
|
-
|
|
272
|
+
exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
273
|
+
const obj = arg1;
|
|
274
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
275
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
276
|
+
var len1 = WASM_VECTOR_LEN;
|
|
277
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
278
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
361
279
|
};
|
|
362
280
|
|
|
363
|
-
|
|
364
|
-
|
|
281
|
+
exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
282
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
365
283
|
};
|
|
366
284
|
|
|
367
|
-
|
|
368
|
-
const ret =
|
|
369
|
-
return
|
|
285
|
+
exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
286
|
+
const ret = arg0.call(arg1);
|
|
287
|
+
return ret;
|
|
288
|
+
}, arguments) };
|
|
289
|
+
|
|
290
|
+
exports.__wbg_debug_9d0c87ddda3dc485 = function(arg0) {
|
|
291
|
+
console.debug(arg0);
|
|
370
292
|
};
|
|
371
293
|
|
|
372
|
-
|
|
373
|
-
const ret =
|
|
374
|
-
return
|
|
294
|
+
exports.__wbg_done_62ea16af4ce34b24 = function(arg0) {
|
|
295
|
+
const ret = arg0.done;
|
|
296
|
+
return ret;
|
|
375
297
|
};
|
|
376
298
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
return addHeapObject(ret);
|
|
299
|
+
exports.__wbg_emit_diagnostic_2f7cf38bc25ebf3d = function(arg0) {
|
|
300
|
+
emit_diagnostic(arg0);
|
|
380
301
|
};
|
|
381
302
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
303
|
+
exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
304
|
+
let deferred0_0;
|
|
305
|
+
let deferred0_1;
|
|
306
|
+
try {
|
|
307
|
+
deferred0_0 = arg0;
|
|
308
|
+
deferred0_1 = arg1;
|
|
309
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
310
|
+
} finally {
|
|
311
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
312
|
+
}
|
|
385
313
|
};
|
|
386
314
|
|
|
387
|
-
|
|
388
|
-
|
|
315
|
+
exports.__wbg_error_7bc7d576a6aaf855 = function(arg0) {
|
|
316
|
+
console.error(arg0);
|
|
389
317
|
};
|
|
390
318
|
|
|
391
|
-
|
|
392
|
-
const ret =
|
|
319
|
+
exports.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
320
|
+
const ret = arg0[arg1 >>> 0];
|
|
393
321
|
return ret;
|
|
394
322
|
};
|
|
395
323
|
|
|
396
|
-
|
|
397
|
-
const ret =
|
|
324
|
+
exports.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
|
|
325
|
+
const ret = Reflect.get(arg0, arg1);
|
|
326
|
+
return ret;
|
|
327
|
+
}, arguments) };
|
|
328
|
+
|
|
329
|
+
exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
|
|
330
|
+
const ret = arg0[arg1];
|
|
398
331
|
return ret;
|
|
399
332
|
};
|
|
400
333
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return addHeapObject(ret);
|
|
334
|
+
exports.__wbg_info_ce6bcc489c22f6f0 = function(arg0) {
|
|
335
|
+
console.info(arg0);
|
|
404
336
|
};
|
|
405
337
|
|
|
406
|
-
|
|
338
|
+
exports.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
|
|
407
339
|
let result;
|
|
408
340
|
try {
|
|
409
|
-
result =
|
|
341
|
+
result = arg0 instanceof ArrayBuffer;
|
|
410
342
|
} catch (_) {
|
|
411
343
|
result = false;
|
|
412
344
|
}
|
|
@@ -414,10 +346,10 @@ module.exports.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
|
|
|
414
346
|
return ret;
|
|
415
347
|
};
|
|
416
348
|
|
|
417
|
-
|
|
349
|
+
exports.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
|
|
418
350
|
let result;
|
|
419
351
|
try {
|
|
420
|
-
result =
|
|
352
|
+
result = arg0 instanceof Uint8Array;
|
|
421
353
|
} catch (_) {
|
|
422
354
|
result = false;
|
|
423
355
|
}
|
|
@@ -425,102 +357,136 @@ module.exports.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
|
|
|
425
357
|
return ret;
|
|
426
358
|
};
|
|
427
359
|
|
|
428
|
-
|
|
429
|
-
const ret =
|
|
430
|
-
return
|
|
360
|
+
exports.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
|
|
361
|
+
const ret = Array.isArray(arg0);
|
|
362
|
+
return ret;
|
|
431
363
|
};
|
|
432
364
|
|
|
433
|
-
|
|
434
|
-
|
|
365
|
+
exports.__wbg_iterator_27b7c8b35ab3e86b = function() {
|
|
366
|
+
const ret = Symbol.iterator;
|
|
367
|
+
return ret;
|
|
435
368
|
};
|
|
436
369
|
|
|
437
|
-
|
|
438
|
-
const ret =
|
|
370
|
+
exports.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
371
|
+
const ret = arg0.length;
|
|
439
372
|
return ret;
|
|
440
373
|
};
|
|
441
374
|
|
|
442
|
-
|
|
443
|
-
const ret =
|
|
375
|
+
exports.__wbg_length_d45040a40c570362 = function(arg0) {
|
|
376
|
+
const ret = arg0.length;
|
|
444
377
|
return ret;
|
|
445
378
|
};
|
|
446
379
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
return addHeapObject(ret);
|
|
380
|
+
exports.__wbg_log_1d990106d99dacb7 = function(arg0) {
|
|
381
|
+
console.log(arg0);
|
|
450
382
|
};
|
|
451
383
|
|
|
452
|
-
|
|
453
|
-
const ret =
|
|
454
|
-
return
|
|
455
|
-
}
|
|
384
|
+
exports.__wbg_new_1ba21ce319a06297 = function() {
|
|
385
|
+
const ret = new Object();
|
|
386
|
+
return ret;
|
|
387
|
+
};
|
|
456
388
|
|
|
457
|
-
|
|
458
|
-
const ret =
|
|
389
|
+
exports.__wbg_new_25f239778d6112b9 = function() {
|
|
390
|
+
const ret = new Array();
|
|
459
391
|
return ret;
|
|
460
392
|
};
|
|
461
393
|
|
|
462
|
-
|
|
463
|
-
const ret =
|
|
464
|
-
return
|
|
394
|
+
exports.__wbg_new_6421f6084cc5bc5a = function(arg0) {
|
|
395
|
+
const ret = new Uint8Array(arg0);
|
|
396
|
+
return ret;
|
|
465
397
|
};
|
|
466
398
|
|
|
467
|
-
|
|
468
|
-
const ret =
|
|
469
|
-
return
|
|
470
|
-
}
|
|
399
|
+
exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
400
|
+
const ret = new Error();
|
|
401
|
+
return ret;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
exports.__wbg_next_138a17bbf04e926c = function(arg0) {
|
|
405
|
+
const ret = arg0.next;
|
|
406
|
+
return ret;
|
|
407
|
+
};
|
|
471
408
|
|
|
472
|
-
|
|
473
|
-
const ret =
|
|
474
|
-
return
|
|
409
|
+
exports.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
|
|
410
|
+
const ret = arg0.next();
|
|
411
|
+
return ret;
|
|
475
412
|
}, arguments) };
|
|
476
413
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
return addHeapObject(ret);
|
|
414
|
+
exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
415
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
480
416
|
};
|
|
481
417
|
|
|
482
|
-
|
|
483
|
-
const ret =
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
418
|
+
exports.__wbg_read_file_content_6ec8279180f5893a = function(arg0, arg1, arg2) {
|
|
419
|
+
const ret = read_file_content(getStringFromWasm0(arg1, arg2));
|
|
420
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
421
|
+
var len1 = WASM_VECTOR_LEN;
|
|
422
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
423
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
488
424
|
};
|
|
489
425
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
497
|
-
} finally {
|
|
498
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
499
|
-
}
|
|
426
|
+
exports.__wbg_resolve_import_9b24ad6900c20040 = function(arg0, arg1, arg2, arg3, arg4) {
|
|
427
|
+
const ret = resolve_import(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
428
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
429
|
+
var len1 = WASM_VECTOR_LEN;
|
|
430
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
431
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
500
432
|
};
|
|
501
433
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
return addHeapObject(ret);
|
|
434
|
+
exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
435
|
+
arg0[arg1] = arg2;
|
|
505
436
|
};
|
|
506
437
|
|
|
507
|
-
|
|
508
|
-
|
|
438
|
+
exports.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
439
|
+
arg0[arg1 >>> 0] = arg2;
|
|
509
440
|
};
|
|
510
441
|
|
|
511
|
-
|
|
512
|
-
const ret =
|
|
442
|
+
exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
443
|
+
const ret = arg1.stack;
|
|
513
444
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
514
445
|
const len1 = WASM_VECTOR_LEN;
|
|
515
|
-
|
|
516
|
-
|
|
446
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
447
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
exports.__wbg_value_57b7b035e117f7ee = function(arg0) {
|
|
451
|
+
const ret = arg0.value;
|
|
452
|
+
return ret;
|
|
517
453
|
};
|
|
518
454
|
|
|
519
|
-
|
|
520
|
-
|
|
455
|
+
exports.__wbg_warn_6e567d0d926ff881 = function(arg0) {
|
|
456
|
+
console.warn(arg0);
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
460
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
461
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
462
|
+
return ret;
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
466
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
467
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
468
|
+
return ret;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
472
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
473
|
+
const ret = arg0;
|
|
474
|
+
return ret;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
exports.__wbindgen_init_externref_table = function() {
|
|
478
|
+
const table = wasm.__wbindgen_externrefs;
|
|
479
|
+
const offset = table.grow(4);
|
|
480
|
+
table.set(0, undefined);
|
|
481
|
+
table.set(offset + 0, undefined);
|
|
482
|
+
table.set(offset + 1, null);
|
|
483
|
+
table.set(offset + 2, true);
|
|
484
|
+
table.set(offset + 3, false);
|
|
485
|
+
};
|
|
521
486
|
|
|
522
|
-
const
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
|
|
487
|
+
const wasmPath = `${__dirname}/beff_wasm_bg.wasm`;
|
|
488
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
489
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
490
|
+
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
526
491
|
|
|
492
|
+
wasm.__wbindgen_start();
|
package/pkg/beff_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
4
|
+
export const bundle_to_diagnostics: (a: number, b: number, c: any) => any;
|
|
5
|
+
export const bundle_to_string_v2: (a: number, b: number, c: any) => any;
|
|
6
|
+
export const init: (a: number) => void;
|
|
7
|
+
export const update_file_content: (a: number, b: number, c: number, d: number) => void;
|
|
8
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
9
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
10
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
11
|
+
export const __externref_table_alloc: () => number;
|
|
12
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
13
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
14
|
+
export const __wbindgen_start: () => void;
|