@synergenius/flow-weaver 0.12.1 → 0.12.2
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/dist/cli/flow-weaver.mjs
CHANGED
|
@@ -9671,7 +9671,7 @@ var VERSION;
|
|
|
9671
9671
|
var init_generated_version = __esm({
|
|
9672
9672
|
"src/generated-version.ts"() {
|
|
9673
9673
|
"use strict";
|
|
9674
|
-
VERSION = "0.12.
|
|
9674
|
+
VERSION = "0.12.2";
|
|
9675
9675
|
}
|
|
9676
9676
|
});
|
|
9677
9677
|
|
|
@@ -14676,8 +14676,2232 @@ var init_generated_branding = __esm({
|
|
|
14676
14676
|
}
|
|
14677
14677
|
});
|
|
14678
14678
|
|
|
14679
|
+
// node_modules/esbuild/lib/main.js
|
|
14680
|
+
var require_main = __commonJS({
|
|
14681
|
+
"node_modules/esbuild/lib/main.js"(exports2, module2) {
|
|
14682
|
+
"use strict";
|
|
14683
|
+
var __defProp2 = Object.defineProperty;
|
|
14684
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
14685
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
14686
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
14687
|
+
var __export2 = (target, all) => {
|
|
14688
|
+
for (var name in all)
|
|
14689
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
14690
|
+
};
|
|
14691
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
14692
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14693
|
+
for (let key of __getOwnPropNames2(from))
|
|
14694
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
14695
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
14696
|
+
}
|
|
14697
|
+
return to;
|
|
14698
|
+
};
|
|
14699
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
14700
|
+
var node_exports = {};
|
|
14701
|
+
__export2(node_exports, {
|
|
14702
|
+
analyzeMetafile: () => analyzeMetafile,
|
|
14703
|
+
analyzeMetafileSync: () => analyzeMetafileSync,
|
|
14704
|
+
build: () => build,
|
|
14705
|
+
buildSync: () => buildSync,
|
|
14706
|
+
context: () => context,
|
|
14707
|
+
default: () => node_default,
|
|
14708
|
+
formatMessages: () => formatMessages,
|
|
14709
|
+
formatMessagesSync: () => formatMessagesSync,
|
|
14710
|
+
initialize: () => initialize,
|
|
14711
|
+
stop: () => stop,
|
|
14712
|
+
transform: () => transform2,
|
|
14713
|
+
transformSync: () => transformSync2,
|
|
14714
|
+
version: () => version3
|
|
14715
|
+
});
|
|
14716
|
+
module2.exports = __toCommonJS(node_exports);
|
|
14717
|
+
function encodePacket2(packet) {
|
|
14718
|
+
let visit = (value2) => {
|
|
14719
|
+
if (value2 === null) {
|
|
14720
|
+
bb.write8(0);
|
|
14721
|
+
} else if (typeof value2 === "boolean") {
|
|
14722
|
+
bb.write8(1);
|
|
14723
|
+
bb.write8(+value2);
|
|
14724
|
+
} else if (typeof value2 === "number") {
|
|
14725
|
+
bb.write8(2);
|
|
14726
|
+
bb.write32(value2 | 0);
|
|
14727
|
+
} else if (typeof value2 === "string") {
|
|
14728
|
+
bb.write8(3);
|
|
14729
|
+
bb.write(encodeUTF8(value2));
|
|
14730
|
+
} else if (value2 instanceof Uint8Array) {
|
|
14731
|
+
bb.write8(4);
|
|
14732
|
+
bb.write(value2);
|
|
14733
|
+
} else if (value2 instanceof Array) {
|
|
14734
|
+
bb.write8(5);
|
|
14735
|
+
bb.write32(value2.length);
|
|
14736
|
+
for (let item of value2) {
|
|
14737
|
+
visit(item);
|
|
14738
|
+
}
|
|
14739
|
+
} else {
|
|
14740
|
+
let keys2 = Object.keys(value2);
|
|
14741
|
+
bb.write8(6);
|
|
14742
|
+
bb.write32(keys2.length);
|
|
14743
|
+
for (let key of keys2) {
|
|
14744
|
+
bb.write(encodeUTF8(key));
|
|
14745
|
+
visit(value2[key]);
|
|
14746
|
+
}
|
|
14747
|
+
}
|
|
14748
|
+
};
|
|
14749
|
+
let bb = new ByteBuffer();
|
|
14750
|
+
bb.write32(0);
|
|
14751
|
+
bb.write32(packet.id << 1 | +!packet.isRequest);
|
|
14752
|
+
visit(packet.value);
|
|
14753
|
+
writeUInt32LE(bb.buf, bb.len - 4, 0);
|
|
14754
|
+
return bb.buf.subarray(0, bb.len);
|
|
14755
|
+
}
|
|
14756
|
+
function decodePacket2(bytes) {
|
|
14757
|
+
let visit = () => {
|
|
14758
|
+
switch (bb.read8()) {
|
|
14759
|
+
case 0:
|
|
14760
|
+
return null;
|
|
14761
|
+
case 1:
|
|
14762
|
+
return !!bb.read8();
|
|
14763
|
+
case 2:
|
|
14764
|
+
return bb.read32();
|
|
14765
|
+
case 3:
|
|
14766
|
+
return decodeUTF8(bb.read());
|
|
14767
|
+
case 4:
|
|
14768
|
+
return bb.read();
|
|
14769
|
+
case 5: {
|
|
14770
|
+
let count = bb.read32();
|
|
14771
|
+
let value22 = [];
|
|
14772
|
+
for (let i = 0; i < count; i++) {
|
|
14773
|
+
value22.push(visit());
|
|
14774
|
+
}
|
|
14775
|
+
return value22;
|
|
14776
|
+
}
|
|
14777
|
+
case 6: {
|
|
14778
|
+
let count = bb.read32();
|
|
14779
|
+
let value22 = {};
|
|
14780
|
+
for (let i = 0; i < count; i++) {
|
|
14781
|
+
value22[decodeUTF8(bb.read())] = visit();
|
|
14782
|
+
}
|
|
14783
|
+
return value22;
|
|
14784
|
+
}
|
|
14785
|
+
default:
|
|
14786
|
+
throw new Error("Invalid packet");
|
|
14787
|
+
}
|
|
14788
|
+
};
|
|
14789
|
+
let bb = new ByteBuffer(bytes);
|
|
14790
|
+
let id = bb.read32();
|
|
14791
|
+
let isRequest = (id & 1) === 0;
|
|
14792
|
+
id >>>= 1;
|
|
14793
|
+
let value2 = visit();
|
|
14794
|
+
if (bb.ptr !== bytes.length) {
|
|
14795
|
+
throw new Error("Invalid packet");
|
|
14796
|
+
}
|
|
14797
|
+
return { id, isRequest, value: value2 };
|
|
14798
|
+
}
|
|
14799
|
+
var ByteBuffer = class {
|
|
14800
|
+
constructor(buf = new Uint8Array(1024)) {
|
|
14801
|
+
this.buf = buf;
|
|
14802
|
+
this.len = 0;
|
|
14803
|
+
this.ptr = 0;
|
|
14804
|
+
}
|
|
14805
|
+
_write(delta) {
|
|
14806
|
+
if (this.len + delta > this.buf.length) {
|
|
14807
|
+
let clone3 = new Uint8Array((this.len + delta) * 2);
|
|
14808
|
+
clone3.set(this.buf);
|
|
14809
|
+
this.buf = clone3;
|
|
14810
|
+
}
|
|
14811
|
+
this.len += delta;
|
|
14812
|
+
return this.len - delta;
|
|
14813
|
+
}
|
|
14814
|
+
write8(value2) {
|
|
14815
|
+
let offset = this._write(1);
|
|
14816
|
+
this.buf[offset] = value2;
|
|
14817
|
+
}
|
|
14818
|
+
write32(value2) {
|
|
14819
|
+
let offset = this._write(4);
|
|
14820
|
+
writeUInt32LE(this.buf, value2, offset);
|
|
14821
|
+
}
|
|
14822
|
+
write(bytes) {
|
|
14823
|
+
let offset = this._write(4 + bytes.length);
|
|
14824
|
+
writeUInt32LE(this.buf, bytes.length, offset);
|
|
14825
|
+
this.buf.set(bytes, offset + 4);
|
|
14826
|
+
}
|
|
14827
|
+
_read(delta) {
|
|
14828
|
+
if (this.ptr + delta > this.buf.length) {
|
|
14829
|
+
throw new Error("Invalid packet");
|
|
14830
|
+
}
|
|
14831
|
+
this.ptr += delta;
|
|
14832
|
+
return this.ptr - delta;
|
|
14833
|
+
}
|
|
14834
|
+
read8() {
|
|
14835
|
+
return this.buf[this._read(1)];
|
|
14836
|
+
}
|
|
14837
|
+
read32() {
|
|
14838
|
+
return readUInt32LE(this.buf, this._read(4));
|
|
14839
|
+
}
|
|
14840
|
+
read() {
|
|
14841
|
+
let length = this.read32();
|
|
14842
|
+
let bytes = new Uint8Array(length);
|
|
14843
|
+
let ptr = this._read(bytes.length);
|
|
14844
|
+
bytes.set(this.buf.subarray(ptr, ptr + length));
|
|
14845
|
+
return bytes;
|
|
14846
|
+
}
|
|
14847
|
+
};
|
|
14848
|
+
var encodeUTF8;
|
|
14849
|
+
var decodeUTF8;
|
|
14850
|
+
var encodeInvariant;
|
|
14851
|
+
if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") {
|
|
14852
|
+
let encoder = new TextEncoder();
|
|
14853
|
+
let decoder = new TextDecoder();
|
|
14854
|
+
encodeUTF8 = (text) => encoder.encode(text);
|
|
14855
|
+
decodeUTF8 = (bytes) => decoder.decode(bytes);
|
|
14856
|
+
encodeInvariant = 'new TextEncoder().encode("")';
|
|
14857
|
+
} else if (typeof Buffer !== "undefined") {
|
|
14858
|
+
encodeUTF8 = (text) => Buffer.from(text);
|
|
14859
|
+
decodeUTF8 = (bytes) => {
|
|
14860
|
+
let { buffer, byteOffset, byteLength: byteLength2 } = bytes;
|
|
14861
|
+
return Buffer.from(buffer, byteOffset, byteLength2).toString();
|
|
14862
|
+
};
|
|
14863
|
+
encodeInvariant = 'Buffer.from("")';
|
|
14864
|
+
} else {
|
|
14865
|
+
throw new Error("No UTF-8 codec found");
|
|
14866
|
+
}
|
|
14867
|
+
if (!(encodeUTF8("") instanceof Uint8Array))
|
|
14868
|
+
throw new Error(`Invariant violation: "${encodeInvariant} instanceof Uint8Array" is incorrectly false
|
|
14869
|
+
|
|
14870
|
+
This indicates that your JavaScript environment is broken. You cannot use
|
|
14871
|
+
esbuild in this environment because esbuild relies on this invariant. This
|
|
14872
|
+
is not a problem with esbuild. You need to fix your environment instead.
|
|
14873
|
+
`);
|
|
14874
|
+
function readUInt32LE(buffer, offset) {
|
|
14875
|
+
return buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24;
|
|
14876
|
+
}
|
|
14877
|
+
function writeUInt32LE(buffer, value2, offset) {
|
|
14878
|
+
buffer[offset++] = value2;
|
|
14879
|
+
buffer[offset++] = value2 >> 8;
|
|
14880
|
+
buffer[offset++] = value2 >> 16;
|
|
14881
|
+
buffer[offset++] = value2 >> 24;
|
|
14882
|
+
}
|
|
14883
|
+
var quote = JSON.stringify;
|
|
14884
|
+
var buildLogLevelDefault = "warning";
|
|
14885
|
+
var transformLogLevelDefault = "silent";
|
|
14886
|
+
function validateAndJoinStringArray(values2, what) {
|
|
14887
|
+
const toJoin = [];
|
|
14888
|
+
for (const value2 of values2) {
|
|
14889
|
+
validateStringValue(value2, what);
|
|
14890
|
+
if (value2.indexOf(",") >= 0) throw new Error(`Invalid ${what}: ${value2}`);
|
|
14891
|
+
toJoin.push(value2);
|
|
14892
|
+
}
|
|
14893
|
+
return toJoin.join(",");
|
|
14894
|
+
}
|
|
14895
|
+
var canBeAnything = () => null;
|
|
14896
|
+
var mustBeBoolean = (value2) => typeof value2 === "boolean" ? null : "a boolean";
|
|
14897
|
+
var mustBeString = (value2) => typeof value2 === "string" ? null : "a string";
|
|
14898
|
+
var mustBeRegExp = (value2) => value2 instanceof RegExp ? null : "a RegExp object";
|
|
14899
|
+
var mustBeInteger = (value2) => typeof value2 === "number" && value2 === (value2 | 0) ? null : "an integer";
|
|
14900
|
+
var mustBeValidPortNumber = (value2) => typeof value2 === "number" && value2 === (value2 | 0) && value2 >= 0 && value2 <= 65535 ? null : "a valid port number";
|
|
14901
|
+
var mustBeFunction = (value2) => typeof value2 === "function" ? null : "a function";
|
|
14902
|
+
var mustBeArray = (value2) => Array.isArray(value2) ? null : "an array";
|
|
14903
|
+
var mustBeArrayOfStrings = (value2) => Array.isArray(value2) && value2.every((x) => typeof x === "string") ? null : "an array of strings";
|
|
14904
|
+
var mustBeObject = (value2) => typeof value2 === "object" && value2 !== null && !Array.isArray(value2) ? null : "an object";
|
|
14905
|
+
var mustBeEntryPoints = (value2) => typeof value2 === "object" && value2 !== null ? null : "an array or an object";
|
|
14906
|
+
var mustBeWebAssemblyModule = (value2) => value2 instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
|
|
14907
|
+
var mustBeObjectOrNull = (value2) => typeof value2 === "object" && !Array.isArray(value2) ? null : "an object or null";
|
|
14908
|
+
var mustBeStringOrBoolean = (value2) => typeof value2 === "string" || typeof value2 === "boolean" ? null : "a string or a boolean";
|
|
14909
|
+
var mustBeStringOrObject = (value2) => typeof value2 === "string" || typeof value2 === "object" && value2 !== null && !Array.isArray(value2) ? null : "a string or an object";
|
|
14910
|
+
var mustBeStringOrArrayOfStrings = (value2) => typeof value2 === "string" || Array.isArray(value2) && value2.every((x) => typeof x === "string") ? null : "a string or an array of strings";
|
|
14911
|
+
var mustBeStringOrUint8Array = (value2) => typeof value2 === "string" || value2 instanceof Uint8Array ? null : "a string or a Uint8Array";
|
|
14912
|
+
var mustBeStringOrURL = (value2) => typeof value2 === "string" || value2 instanceof URL ? null : "a string or a URL";
|
|
14913
|
+
function getFlag(object3, keys2, key, mustBeFn) {
|
|
14914
|
+
let value2 = object3[key];
|
|
14915
|
+
keys2[key + ""] = true;
|
|
14916
|
+
if (value2 === void 0) return void 0;
|
|
14917
|
+
let mustBe = mustBeFn(value2);
|
|
14918
|
+
if (mustBe !== null) throw new Error(`${quote(key)} must be ${mustBe}`);
|
|
14919
|
+
return value2;
|
|
14920
|
+
}
|
|
14921
|
+
function checkForInvalidFlags(object3, keys2, where) {
|
|
14922
|
+
for (let key in object3) {
|
|
14923
|
+
if (!(key in keys2)) {
|
|
14924
|
+
throw new Error(`Invalid option ${where}: ${quote(key)}`);
|
|
14925
|
+
}
|
|
14926
|
+
}
|
|
14927
|
+
}
|
|
14928
|
+
function validateInitializeOptions(options) {
|
|
14929
|
+
let keys2 = /* @__PURE__ */ Object.create(null);
|
|
14930
|
+
let wasmURL = getFlag(options, keys2, "wasmURL", mustBeStringOrURL);
|
|
14931
|
+
let wasmModule = getFlag(options, keys2, "wasmModule", mustBeWebAssemblyModule);
|
|
14932
|
+
let worker = getFlag(options, keys2, "worker", mustBeBoolean);
|
|
14933
|
+
checkForInvalidFlags(options, keys2, "in initialize() call");
|
|
14934
|
+
return {
|
|
14935
|
+
wasmURL,
|
|
14936
|
+
wasmModule,
|
|
14937
|
+
worker
|
|
14938
|
+
};
|
|
14939
|
+
}
|
|
14940
|
+
function validateMangleCache(mangleCache) {
|
|
14941
|
+
let validated;
|
|
14942
|
+
if (mangleCache !== void 0) {
|
|
14943
|
+
validated = /* @__PURE__ */ Object.create(null);
|
|
14944
|
+
for (let key in mangleCache) {
|
|
14945
|
+
let value2 = mangleCache[key];
|
|
14946
|
+
if (typeof value2 === "string" || value2 === false) {
|
|
14947
|
+
validated[key] = value2;
|
|
14948
|
+
} else {
|
|
14949
|
+
throw new Error(`Expected ${quote(key)} in mangle cache to map to either a string or false`);
|
|
14950
|
+
}
|
|
14951
|
+
}
|
|
14952
|
+
}
|
|
14953
|
+
return validated;
|
|
14954
|
+
}
|
|
14955
|
+
function pushLogFlags(flags, options, keys2, isTTY2, logLevelDefault) {
|
|
14956
|
+
let color = getFlag(options, keys2, "color", mustBeBoolean);
|
|
14957
|
+
let logLevel = getFlag(options, keys2, "logLevel", mustBeString);
|
|
14958
|
+
let logLimit = getFlag(options, keys2, "logLimit", mustBeInteger);
|
|
14959
|
+
if (color !== void 0) flags.push(`--color=${color}`);
|
|
14960
|
+
else if (isTTY2) flags.push(`--color=true`);
|
|
14961
|
+
flags.push(`--log-level=${logLevel || logLevelDefault}`);
|
|
14962
|
+
flags.push(`--log-limit=${logLimit || 0}`);
|
|
14963
|
+
}
|
|
14964
|
+
function validateStringValue(value2, what, key) {
|
|
14965
|
+
if (typeof value2 !== "string") {
|
|
14966
|
+
throw new Error(`Expected value for ${what}${key !== void 0 ? " " + quote(key) : ""} to be a string, got ${typeof value2} instead`);
|
|
14967
|
+
}
|
|
14968
|
+
return value2;
|
|
14969
|
+
}
|
|
14970
|
+
function pushCommonFlags(flags, options, keys2) {
|
|
14971
|
+
let legalComments = getFlag(options, keys2, "legalComments", mustBeString);
|
|
14972
|
+
let sourceRoot = getFlag(options, keys2, "sourceRoot", mustBeString);
|
|
14973
|
+
let sourcesContent = getFlag(options, keys2, "sourcesContent", mustBeBoolean);
|
|
14974
|
+
let target = getFlag(options, keys2, "target", mustBeStringOrArrayOfStrings);
|
|
14975
|
+
let format = getFlag(options, keys2, "format", mustBeString);
|
|
14976
|
+
let globalName = getFlag(options, keys2, "globalName", mustBeString);
|
|
14977
|
+
let mangleProps = getFlag(options, keys2, "mangleProps", mustBeRegExp);
|
|
14978
|
+
let reserveProps = getFlag(options, keys2, "reserveProps", mustBeRegExp);
|
|
14979
|
+
let mangleQuoted = getFlag(options, keys2, "mangleQuoted", mustBeBoolean);
|
|
14980
|
+
let minify = getFlag(options, keys2, "minify", mustBeBoolean);
|
|
14981
|
+
let minifySyntax = getFlag(options, keys2, "minifySyntax", mustBeBoolean);
|
|
14982
|
+
let minifyWhitespace = getFlag(options, keys2, "minifyWhitespace", mustBeBoolean);
|
|
14983
|
+
let minifyIdentifiers = getFlag(options, keys2, "minifyIdentifiers", mustBeBoolean);
|
|
14984
|
+
let lineLimit = getFlag(options, keys2, "lineLimit", mustBeInteger);
|
|
14985
|
+
let drop2 = getFlag(options, keys2, "drop", mustBeArrayOfStrings);
|
|
14986
|
+
let dropLabels = getFlag(options, keys2, "dropLabels", mustBeArrayOfStrings);
|
|
14987
|
+
let charset = getFlag(options, keys2, "charset", mustBeString);
|
|
14988
|
+
let treeShaking = getFlag(options, keys2, "treeShaking", mustBeBoolean);
|
|
14989
|
+
let ignoreAnnotations = getFlag(options, keys2, "ignoreAnnotations", mustBeBoolean);
|
|
14990
|
+
let jsx = getFlag(options, keys2, "jsx", mustBeString);
|
|
14991
|
+
let jsxFactory = getFlag(options, keys2, "jsxFactory", mustBeString);
|
|
14992
|
+
let jsxFragment = getFlag(options, keys2, "jsxFragment", mustBeString);
|
|
14993
|
+
let jsxImportSource = getFlag(options, keys2, "jsxImportSource", mustBeString);
|
|
14994
|
+
let jsxDev = getFlag(options, keys2, "jsxDev", mustBeBoolean);
|
|
14995
|
+
let jsxSideEffects = getFlag(options, keys2, "jsxSideEffects", mustBeBoolean);
|
|
14996
|
+
let define = getFlag(options, keys2, "define", mustBeObject);
|
|
14997
|
+
let logOverride = getFlag(options, keys2, "logOverride", mustBeObject);
|
|
14998
|
+
let supported = getFlag(options, keys2, "supported", mustBeObject);
|
|
14999
|
+
let pure = getFlag(options, keys2, "pure", mustBeArrayOfStrings);
|
|
15000
|
+
let keepNames = getFlag(options, keys2, "keepNames", mustBeBoolean);
|
|
15001
|
+
let platform = getFlag(options, keys2, "platform", mustBeString);
|
|
15002
|
+
let tsconfigRaw = getFlag(options, keys2, "tsconfigRaw", mustBeStringOrObject);
|
|
15003
|
+
let absPaths = getFlag(options, keys2, "absPaths", mustBeArrayOfStrings);
|
|
15004
|
+
if (legalComments) flags.push(`--legal-comments=${legalComments}`);
|
|
15005
|
+
if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
|
|
15006
|
+
if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
|
|
15007
|
+
if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`);
|
|
15008
|
+
if (format) flags.push(`--format=${format}`);
|
|
15009
|
+
if (globalName) flags.push(`--global-name=${globalName}`);
|
|
15010
|
+
if (platform) flags.push(`--platform=${platform}`);
|
|
15011
|
+
if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
|
|
15012
|
+
if (minify) flags.push("--minify");
|
|
15013
|
+
if (minifySyntax) flags.push("--minify-syntax");
|
|
15014
|
+
if (minifyWhitespace) flags.push("--minify-whitespace");
|
|
15015
|
+
if (minifyIdentifiers) flags.push("--minify-identifiers");
|
|
15016
|
+
if (lineLimit) flags.push(`--line-limit=${lineLimit}`);
|
|
15017
|
+
if (charset) flags.push(`--charset=${charset}`);
|
|
15018
|
+
if (treeShaking !== void 0) flags.push(`--tree-shaking=${treeShaking}`);
|
|
15019
|
+
if (ignoreAnnotations) flags.push(`--ignore-annotations`);
|
|
15020
|
+
if (drop2) for (let what of drop2) flags.push(`--drop:${validateStringValue(what, "drop")}`);
|
|
15021
|
+
if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`);
|
|
15022
|
+
if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`);
|
|
15023
|
+
if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`);
|
|
15024
|
+
if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`);
|
|
15025
|
+
if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`);
|
|
15026
|
+
if (jsx) flags.push(`--jsx=${jsx}`);
|
|
15027
|
+
if (jsxFactory) flags.push(`--jsx-factory=${jsxFactory}`);
|
|
15028
|
+
if (jsxFragment) flags.push(`--jsx-fragment=${jsxFragment}`);
|
|
15029
|
+
if (jsxImportSource) flags.push(`--jsx-import-source=${jsxImportSource}`);
|
|
15030
|
+
if (jsxDev) flags.push(`--jsx-dev`);
|
|
15031
|
+
if (jsxSideEffects) flags.push(`--jsx-side-effects`);
|
|
15032
|
+
if (define) {
|
|
15033
|
+
for (let key in define) {
|
|
15034
|
+
if (key.indexOf("=") >= 0) throw new Error(`Invalid define: ${key}`);
|
|
15035
|
+
flags.push(`--define:${key}=${validateStringValue(define[key], "define", key)}`);
|
|
15036
|
+
}
|
|
15037
|
+
}
|
|
15038
|
+
if (logOverride) {
|
|
15039
|
+
for (let key in logOverride) {
|
|
15040
|
+
if (key.indexOf("=") >= 0) throw new Error(`Invalid log override: ${key}`);
|
|
15041
|
+
flags.push(`--log-override:${key}=${validateStringValue(logOverride[key], "log override", key)}`);
|
|
15042
|
+
}
|
|
15043
|
+
}
|
|
15044
|
+
if (supported) {
|
|
15045
|
+
for (let key in supported) {
|
|
15046
|
+
if (key.indexOf("=") >= 0) throw new Error(`Invalid supported: ${key}`);
|
|
15047
|
+
const value2 = supported[key];
|
|
15048
|
+
if (typeof value2 !== "boolean") throw new Error(`Expected value for supported ${quote(key)} to be a boolean, got ${typeof value2} instead`);
|
|
15049
|
+
flags.push(`--supported:${key}=${value2}`);
|
|
15050
|
+
}
|
|
15051
|
+
}
|
|
15052
|
+
if (pure) for (let fn of pure) flags.push(`--pure:${validateStringValue(fn, "pure")}`);
|
|
15053
|
+
if (keepNames) flags.push(`--keep-names`);
|
|
15054
|
+
}
|
|
15055
|
+
function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) {
|
|
15056
|
+
var _a22;
|
|
15057
|
+
let flags = [];
|
|
15058
|
+
let entries = [];
|
|
15059
|
+
let keys2 = /* @__PURE__ */ Object.create(null);
|
|
15060
|
+
let stdinContents = null;
|
|
15061
|
+
let stdinResolveDir = null;
|
|
15062
|
+
pushLogFlags(flags, options, keys2, isTTY2, logLevelDefault);
|
|
15063
|
+
pushCommonFlags(flags, options, keys2);
|
|
15064
|
+
let sourcemap = getFlag(options, keys2, "sourcemap", mustBeStringOrBoolean);
|
|
15065
|
+
let bundle = getFlag(options, keys2, "bundle", mustBeBoolean);
|
|
15066
|
+
let splitting = getFlag(options, keys2, "splitting", mustBeBoolean);
|
|
15067
|
+
let preserveSymlinks = getFlag(options, keys2, "preserveSymlinks", mustBeBoolean);
|
|
15068
|
+
let metafile = getFlag(options, keys2, "metafile", mustBeBoolean);
|
|
15069
|
+
let outfile = getFlag(options, keys2, "outfile", mustBeString);
|
|
15070
|
+
let outdir = getFlag(options, keys2, "outdir", mustBeString);
|
|
15071
|
+
let outbase = getFlag(options, keys2, "outbase", mustBeString);
|
|
15072
|
+
let tsconfig = getFlag(options, keys2, "tsconfig", mustBeString);
|
|
15073
|
+
let resolveExtensions = getFlag(options, keys2, "resolveExtensions", mustBeArrayOfStrings);
|
|
15074
|
+
let nodePathsInput = getFlag(options, keys2, "nodePaths", mustBeArrayOfStrings);
|
|
15075
|
+
let mainFields = getFlag(options, keys2, "mainFields", mustBeArrayOfStrings);
|
|
15076
|
+
let conditions = getFlag(options, keys2, "conditions", mustBeArrayOfStrings);
|
|
15077
|
+
let external = getFlag(options, keys2, "external", mustBeArrayOfStrings);
|
|
15078
|
+
let packages = getFlag(options, keys2, "packages", mustBeString);
|
|
15079
|
+
let alias = getFlag(options, keys2, "alias", mustBeObject);
|
|
15080
|
+
let loader2 = getFlag(options, keys2, "loader", mustBeObject);
|
|
15081
|
+
let outExtension = getFlag(options, keys2, "outExtension", mustBeObject);
|
|
15082
|
+
let publicPath = getFlag(options, keys2, "publicPath", mustBeString);
|
|
15083
|
+
let entryNames = getFlag(options, keys2, "entryNames", mustBeString);
|
|
15084
|
+
let chunkNames = getFlag(options, keys2, "chunkNames", mustBeString);
|
|
15085
|
+
let assetNames = getFlag(options, keys2, "assetNames", mustBeString);
|
|
15086
|
+
let inject = getFlag(options, keys2, "inject", mustBeArrayOfStrings);
|
|
15087
|
+
let banner = getFlag(options, keys2, "banner", mustBeObject);
|
|
15088
|
+
let footer = getFlag(options, keys2, "footer", mustBeObject);
|
|
15089
|
+
let entryPoints = getFlag(options, keys2, "entryPoints", mustBeEntryPoints);
|
|
15090
|
+
let absWorkingDir = getFlag(options, keys2, "absWorkingDir", mustBeString);
|
|
15091
|
+
let stdin = getFlag(options, keys2, "stdin", mustBeObject);
|
|
15092
|
+
let write = (_a22 = getFlag(options, keys2, "write", mustBeBoolean)) != null ? _a22 : writeDefault;
|
|
15093
|
+
let allowOverwrite = getFlag(options, keys2, "allowOverwrite", mustBeBoolean);
|
|
15094
|
+
let mangleCache = getFlag(options, keys2, "mangleCache", mustBeObject);
|
|
15095
|
+
keys2.plugins = true;
|
|
15096
|
+
checkForInvalidFlags(options, keys2, `in ${callName}() call`);
|
|
15097
|
+
if (sourcemap) flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`);
|
|
15098
|
+
if (bundle) flags.push("--bundle");
|
|
15099
|
+
if (allowOverwrite) flags.push("--allow-overwrite");
|
|
15100
|
+
if (splitting) flags.push("--splitting");
|
|
15101
|
+
if (preserveSymlinks) flags.push("--preserve-symlinks");
|
|
15102
|
+
if (metafile) flags.push(`--metafile`);
|
|
15103
|
+
if (outfile) flags.push(`--outfile=${outfile}`);
|
|
15104
|
+
if (outdir) flags.push(`--outdir=${outdir}`);
|
|
15105
|
+
if (outbase) flags.push(`--outbase=${outbase}`);
|
|
15106
|
+
if (tsconfig) flags.push(`--tsconfig=${tsconfig}`);
|
|
15107
|
+
if (packages) flags.push(`--packages=${packages}`);
|
|
15108
|
+
if (resolveExtensions) flags.push(`--resolve-extensions=${validateAndJoinStringArray(resolveExtensions, "resolve extension")}`);
|
|
15109
|
+
if (publicPath) flags.push(`--public-path=${publicPath}`);
|
|
15110
|
+
if (entryNames) flags.push(`--entry-names=${entryNames}`);
|
|
15111
|
+
if (chunkNames) flags.push(`--chunk-names=${chunkNames}`);
|
|
15112
|
+
if (assetNames) flags.push(`--asset-names=${assetNames}`);
|
|
15113
|
+
if (mainFields) flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, "main field")}`);
|
|
15114
|
+
if (conditions) flags.push(`--conditions=${validateAndJoinStringArray(conditions, "condition")}`);
|
|
15115
|
+
if (external) for (let name of external) flags.push(`--external:${validateStringValue(name, "external")}`);
|
|
15116
|
+
if (alias) {
|
|
15117
|
+
for (let old in alias) {
|
|
15118
|
+
if (old.indexOf("=") >= 0) throw new Error(`Invalid package name in alias: ${old}`);
|
|
15119
|
+
flags.push(`--alias:${old}=${validateStringValue(alias[old], "alias", old)}`);
|
|
15120
|
+
}
|
|
15121
|
+
}
|
|
15122
|
+
if (banner) {
|
|
15123
|
+
for (let type2 in banner) {
|
|
15124
|
+
if (type2.indexOf("=") >= 0) throw new Error(`Invalid banner file type: ${type2}`);
|
|
15125
|
+
flags.push(`--banner:${type2}=${validateStringValue(banner[type2], "banner", type2)}`);
|
|
15126
|
+
}
|
|
15127
|
+
}
|
|
15128
|
+
if (footer) {
|
|
15129
|
+
for (let type2 in footer) {
|
|
15130
|
+
if (type2.indexOf("=") >= 0) throw new Error(`Invalid footer file type: ${type2}`);
|
|
15131
|
+
flags.push(`--footer:${type2}=${validateStringValue(footer[type2], "footer", type2)}`);
|
|
15132
|
+
}
|
|
15133
|
+
}
|
|
15134
|
+
if (inject) for (let path310 of inject) flags.push(`--inject:${validateStringValue(path310, "inject")}`);
|
|
15135
|
+
if (loader2) {
|
|
15136
|
+
for (let ext2 in loader2) {
|
|
15137
|
+
if (ext2.indexOf("=") >= 0) throw new Error(`Invalid loader extension: ${ext2}`);
|
|
15138
|
+
flags.push(`--loader:${ext2}=${validateStringValue(loader2[ext2], "loader", ext2)}`);
|
|
15139
|
+
}
|
|
15140
|
+
}
|
|
15141
|
+
if (outExtension) {
|
|
15142
|
+
for (let ext2 in outExtension) {
|
|
15143
|
+
if (ext2.indexOf("=") >= 0) throw new Error(`Invalid out extension: ${ext2}`);
|
|
15144
|
+
flags.push(`--out-extension:${ext2}=${validateStringValue(outExtension[ext2], "out extension", ext2)}`);
|
|
15145
|
+
}
|
|
15146
|
+
}
|
|
15147
|
+
if (entryPoints) {
|
|
15148
|
+
if (Array.isArray(entryPoints)) {
|
|
15149
|
+
for (let i = 0, n = entryPoints.length; i < n; i++) {
|
|
15150
|
+
let entryPoint = entryPoints[i];
|
|
15151
|
+
if (typeof entryPoint === "object" && entryPoint !== null) {
|
|
15152
|
+
let entryPointKeys = /* @__PURE__ */ Object.create(null);
|
|
15153
|
+
let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString);
|
|
15154
|
+
let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString);
|
|
15155
|
+
checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i);
|
|
15156
|
+
if (input === void 0) throw new Error('Missing property "in" for entry point at index ' + i);
|
|
15157
|
+
if (output === void 0) throw new Error('Missing property "out" for entry point at index ' + i);
|
|
15158
|
+
entries.push([output, input]);
|
|
15159
|
+
} else {
|
|
15160
|
+
entries.push(["", validateStringValue(entryPoint, "entry point at index " + i)]);
|
|
15161
|
+
}
|
|
15162
|
+
}
|
|
15163
|
+
} else {
|
|
15164
|
+
for (let key in entryPoints) {
|
|
15165
|
+
entries.push([key, validateStringValue(entryPoints[key], "entry point", key)]);
|
|
15166
|
+
}
|
|
15167
|
+
}
|
|
15168
|
+
}
|
|
15169
|
+
if (stdin) {
|
|
15170
|
+
let stdinKeys = /* @__PURE__ */ Object.create(null);
|
|
15171
|
+
let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
|
|
15172
|
+
let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
|
|
15173
|
+
let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
|
|
15174
|
+
let loader22 = getFlag(stdin, stdinKeys, "loader", mustBeString);
|
|
15175
|
+
checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object');
|
|
15176
|
+
if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
|
|
15177
|
+
if (loader22) flags.push(`--loader=${loader22}`);
|
|
15178
|
+
if (resolveDir) stdinResolveDir = resolveDir;
|
|
15179
|
+
if (typeof contents === "string") stdinContents = encodeUTF8(contents);
|
|
15180
|
+
else if (contents instanceof Uint8Array) stdinContents = contents;
|
|
15181
|
+
}
|
|
15182
|
+
let nodePaths = [];
|
|
15183
|
+
if (nodePathsInput) {
|
|
15184
|
+
for (let value2 of nodePathsInput) {
|
|
15185
|
+
value2 += "";
|
|
15186
|
+
nodePaths.push(value2);
|
|
15187
|
+
}
|
|
15188
|
+
}
|
|
15189
|
+
return {
|
|
15190
|
+
entries,
|
|
15191
|
+
flags,
|
|
15192
|
+
write,
|
|
15193
|
+
stdinContents,
|
|
15194
|
+
stdinResolveDir,
|
|
15195
|
+
absWorkingDir,
|
|
15196
|
+
nodePaths,
|
|
15197
|
+
mangleCache: validateMangleCache(mangleCache)
|
|
15198
|
+
};
|
|
15199
|
+
}
|
|
15200
|
+
function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
|
|
15201
|
+
let flags = [];
|
|
15202
|
+
let keys2 = /* @__PURE__ */ Object.create(null);
|
|
15203
|
+
pushLogFlags(flags, options, keys2, isTTY2, logLevelDefault);
|
|
15204
|
+
pushCommonFlags(flags, options, keys2);
|
|
15205
|
+
let sourcemap = getFlag(options, keys2, "sourcemap", mustBeStringOrBoolean);
|
|
15206
|
+
let sourcefile = getFlag(options, keys2, "sourcefile", mustBeString);
|
|
15207
|
+
let loader2 = getFlag(options, keys2, "loader", mustBeString);
|
|
15208
|
+
let banner = getFlag(options, keys2, "banner", mustBeString);
|
|
15209
|
+
let footer = getFlag(options, keys2, "footer", mustBeString);
|
|
15210
|
+
let mangleCache = getFlag(options, keys2, "mangleCache", mustBeObject);
|
|
15211
|
+
checkForInvalidFlags(options, keys2, `in ${callName}() call`);
|
|
15212
|
+
if (sourcemap) flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`);
|
|
15213
|
+
if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
|
|
15214
|
+
if (loader2) flags.push(`--loader=${loader2}`);
|
|
15215
|
+
if (banner) flags.push(`--banner=${banner}`);
|
|
15216
|
+
if (footer) flags.push(`--footer=${footer}`);
|
|
15217
|
+
return {
|
|
15218
|
+
flags,
|
|
15219
|
+
mangleCache: validateMangleCache(mangleCache)
|
|
15220
|
+
};
|
|
15221
|
+
}
|
|
15222
|
+
function createChannel(streamIn) {
|
|
15223
|
+
const requestCallbacksByKey = {};
|
|
15224
|
+
const closeData = { didClose: false, reason: "" };
|
|
15225
|
+
let responseCallbacks = {};
|
|
15226
|
+
let nextRequestID = 0;
|
|
15227
|
+
let nextBuildKey = 0;
|
|
15228
|
+
let stdout = new Uint8Array(16 * 1024);
|
|
15229
|
+
let stdoutUsed = 0;
|
|
15230
|
+
let readFromStdout = (chunk) => {
|
|
15231
|
+
let limit = stdoutUsed + chunk.length;
|
|
15232
|
+
if (limit > stdout.length) {
|
|
15233
|
+
let swap = new Uint8Array(limit * 2);
|
|
15234
|
+
swap.set(stdout);
|
|
15235
|
+
stdout = swap;
|
|
15236
|
+
}
|
|
15237
|
+
stdout.set(chunk, stdoutUsed);
|
|
15238
|
+
stdoutUsed += chunk.length;
|
|
15239
|
+
let offset = 0;
|
|
15240
|
+
while (offset + 4 <= stdoutUsed) {
|
|
15241
|
+
let length = readUInt32LE(stdout, offset);
|
|
15242
|
+
if (offset + 4 + length > stdoutUsed) {
|
|
15243
|
+
break;
|
|
15244
|
+
}
|
|
15245
|
+
offset += 4;
|
|
15246
|
+
handleIncomingPacket(stdout.subarray(offset, offset + length));
|
|
15247
|
+
offset += length;
|
|
15248
|
+
}
|
|
15249
|
+
if (offset > 0) {
|
|
15250
|
+
stdout.copyWithin(0, offset, stdoutUsed);
|
|
15251
|
+
stdoutUsed -= offset;
|
|
15252
|
+
}
|
|
15253
|
+
};
|
|
15254
|
+
let afterClose = (error2) => {
|
|
15255
|
+
closeData.didClose = true;
|
|
15256
|
+
if (error2) closeData.reason = ": " + (error2.message || error2);
|
|
15257
|
+
const text = "The service was stopped" + closeData.reason;
|
|
15258
|
+
for (let id in responseCallbacks) {
|
|
15259
|
+
responseCallbacks[id](text, null);
|
|
15260
|
+
}
|
|
15261
|
+
responseCallbacks = {};
|
|
15262
|
+
};
|
|
15263
|
+
let sendRequest = (refs, value2, callback) => {
|
|
15264
|
+
if (closeData.didClose) return callback("The service is no longer running" + closeData.reason, null);
|
|
15265
|
+
let id = nextRequestID++;
|
|
15266
|
+
responseCallbacks[id] = (error2, response) => {
|
|
15267
|
+
try {
|
|
15268
|
+
callback(error2, response);
|
|
15269
|
+
} finally {
|
|
15270
|
+
if (refs) refs.unref();
|
|
15271
|
+
}
|
|
15272
|
+
};
|
|
15273
|
+
if (refs) refs.ref();
|
|
15274
|
+
streamIn.writeToStdin(encodePacket2({ id, isRequest: true, value: value2 }));
|
|
15275
|
+
};
|
|
15276
|
+
let sendResponse = (id, value2) => {
|
|
15277
|
+
if (closeData.didClose) throw new Error("The service is no longer running" + closeData.reason);
|
|
15278
|
+
streamIn.writeToStdin(encodePacket2({ id, isRequest: false, value: value2 }));
|
|
15279
|
+
};
|
|
15280
|
+
let handleRequest = async (id, request) => {
|
|
15281
|
+
try {
|
|
15282
|
+
if (request.command === "ping") {
|
|
15283
|
+
sendResponse(id, {});
|
|
15284
|
+
return;
|
|
15285
|
+
}
|
|
15286
|
+
if (typeof request.key === "number") {
|
|
15287
|
+
const requestCallbacks = requestCallbacksByKey[request.key];
|
|
15288
|
+
if (!requestCallbacks) {
|
|
15289
|
+
return;
|
|
15290
|
+
}
|
|
15291
|
+
const callback = requestCallbacks[request.command];
|
|
15292
|
+
if (callback) {
|
|
15293
|
+
await callback(id, request);
|
|
15294
|
+
return;
|
|
15295
|
+
}
|
|
15296
|
+
}
|
|
15297
|
+
throw new Error(`Invalid command: ` + request.command);
|
|
15298
|
+
} catch (e) {
|
|
15299
|
+
const errors2 = [extractErrorMessageV8(e, streamIn, null, void 0, "")];
|
|
15300
|
+
try {
|
|
15301
|
+
sendResponse(id, { errors: errors2 });
|
|
15302
|
+
} catch {
|
|
15303
|
+
}
|
|
15304
|
+
}
|
|
15305
|
+
};
|
|
15306
|
+
let isFirstPacket = true;
|
|
15307
|
+
let handleIncomingPacket = (bytes) => {
|
|
15308
|
+
if (isFirstPacket) {
|
|
15309
|
+
isFirstPacket = false;
|
|
15310
|
+
let binaryVersion = String.fromCharCode(...bytes);
|
|
15311
|
+
if (binaryVersion !== "0.27.3") {
|
|
15312
|
+
throw new Error(`Cannot start service: Host version "${"0.27.3"}" does not match binary version ${quote(binaryVersion)}`);
|
|
15313
|
+
}
|
|
15314
|
+
return;
|
|
15315
|
+
}
|
|
15316
|
+
let packet = decodePacket2(bytes);
|
|
15317
|
+
if (packet.isRequest) {
|
|
15318
|
+
handleRequest(packet.id, packet.value);
|
|
15319
|
+
} else {
|
|
15320
|
+
let callback = responseCallbacks[packet.id];
|
|
15321
|
+
delete responseCallbacks[packet.id];
|
|
15322
|
+
if (packet.value.error) callback(packet.value.error, {});
|
|
15323
|
+
else callback(null, packet.value);
|
|
15324
|
+
}
|
|
15325
|
+
};
|
|
15326
|
+
let buildOrContext = ({ callName, refs, options, isTTY: isTTY2, defaultWD: defaultWD2, callback }) => {
|
|
15327
|
+
let refCount = 0;
|
|
15328
|
+
const buildKey = nextBuildKey++;
|
|
15329
|
+
const requestCallbacks = {};
|
|
15330
|
+
const buildRefs = {
|
|
15331
|
+
ref() {
|
|
15332
|
+
if (++refCount === 1) {
|
|
15333
|
+
if (refs) refs.ref();
|
|
15334
|
+
}
|
|
15335
|
+
},
|
|
15336
|
+
unref() {
|
|
15337
|
+
if (--refCount === 0) {
|
|
15338
|
+
delete requestCallbacksByKey[buildKey];
|
|
15339
|
+
if (refs) refs.unref();
|
|
15340
|
+
}
|
|
15341
|
+
}
|
|
15342
|
+
};
|
|
15343
|
+
requestCallbacksByKey[buildKey] = requestCallbacks;
|
|
15344
|
+
buildRefs.ref();
|
|
15345
|
+
buildOrContextImpl(
|
|
15346
|
+
callName,
|
|
15347
|
+
buildKey,
|
|
15348
|
+
sendRequest,
|
|
15349
|
+
sendResponse,
|
|
15350
|
+
buildRefs,
|
|
15351
|
+
streamIn,
|
|
15352
|
+
requestCallbacks,
|
|
15353
|
+
options,
|
|
15354
|
+
isTTY2,
|
|
15355
|
+
defaultWD2,
|
|
15356
|
+
(err, res) => {
|
|
15357
|
+
try {
|
|
15358
|
+
callback(err, res);
|
|
15359
|
+
} finally {
|
|
15360
|
+
buildRefs.unref();
|
|
15361
|
+
}
|
|
15362
|
+
}
|
|
15363
|
+
);
|
|
15364
|
+
};
|
|
15365
|
+
let transform22 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs310, callback }) => {
|
|
15366
|
+
const details = createObjectStash();
|
|
15367
|
+
let start = (inputPath) => {
|
|
15368
|
+
try {
|
|
15369
|
+
if (typeof input !== "string" && !(input instanceof Uint8Array))
|
|
15370
|
+
throw new Error('The input to "transform" must be a string or a Uint8Array');
|
|
15371
|
+
let {
|
|
15372
|
+
flags,
|
|
15373
|
+
mangleCache
|
|
15374
|
+
} = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
|
|
15375
|
+
let request = {
|
|
15376
|
+
command: "transform",
|
|
15377
|
+
flags,
|
|
15378
|
+
inputFS: inputPath !== null,
|
|
15379
|
+
input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
|
|
15380
|
+
};
|
|
15381
|
+
if (mangleCache) request.mangleCache = mangleCache;
|
|
15382
|
+
sendRequest(refs, request, (error2, response) => {
|
|
15383
|
+
if (error2) return callback(new Error(error2), null);
|
|
15384
|
+
let errors2 = replaceDetailsInMessages(response.errors, details);
|
|
15385
|
+
let warnings = replaceDetailsInMessages(response.warnings, details);
|
|
15386
|
+
let outstanding = 1;
|
|
15387
|
+
let next = () => {
|
|
15388
|
+
if (--outstanding === 0) {
|
|
15389
|
+
let result = {
|
|
15390
|
+
warnings,
|
|
15391
|
+
code: response.code,
|
|
15392
|
+
map: response.map,
|
|
15393
|
+
mangleCache: void 0,
|
|
15394
|
+
legalComments: void 0
|
|
15395
|
+
};
|
|
15396
|
+
if ("legalComments" in response) result.legalComments = response == null ? void 0 : response.legalComments;
|
|
15397
|
+
if (response.mangleCache) result.mangleCache = response == null ? void 0 : response.mangleCache;
|
|
15398
|
+
callback(null, result);
|
|
15399
|
+
}
|
|
15400
|
+
};
|
|
15401
|
+
if (errors2.length > 0) return callback(failureErrorWithLog("Transform failed", errors2, warnings), null);
|
|
15402
|
+
if (response.codeFS) {
|
|
15403
|
+
outstanding++;
|
|
15404
|
+
fs310.readFile(response.code, (err, contents) => {
|
|
15405
|
+
if (err !== null) {
|
|
15406
|
+
callback(err, null);
|
|
15407
|
+
} else {
|
|
15408
|
+
response.code = contents;
|
|
15409
|
+
next();
|
|
15410
|
+
}
|
|
15411
|
+
});
|
|
15412
|
+
}
|
|
15413
|
+
if (response.mapFS) {
|
|
15414
|
+
outstanding++;
|
|
15415
|
+
fs310.readFile(response.map, (err, contents) => {
|
|
15416
|
+
if (err !== null) {
|
|
15417
|
+
callback(err, null);
|
|
15418
|
+
} else {
|
|
15419
|
+
response.map = contents;
|
|
15420
|
+
next();
|
|
15421
|
+
}
|
|
15422
|
+
});
|
|
15423
|
+
}
|
|
15424
|
+
next();
|
|
15425
|
+
});
|
|
15426
|
+
} catch (e) {
|
|
15427
|
+
let flags = [];
|
|
15428
|
+
try {
|
|
15429
|
+
pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault);
|
|
15430
|
+
} catch {
|
|
15431
|
+
}
|
|
15432
|
+
const error2 = extractErrorMessageV8(e, streamIn, details, void 0, "");
|
|
15433
|
+
sendRequest(refs, { command: "error", flags, error: error2 }, () => {
|
|
15434
|
+
error2.detail = details.load(error2.detail);
|
|
15435
|
+
callback(failureErrorWithLog("Transform failed", [error2], []), null);
|
|
15436
|
+
});
|
|
15437
|
+
}
|
|
15438
|
+
};
|
|
15439
|
+
if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
|
|
15440
|
+
let next = start;
|
|
15441
|
+
start = () => fs310.writeFile(input, next);
|
|
15442
|
+
}
|
|
15443
|
+
start(null);
|
|
15444
|
+
};
|
|
15445
|
+
let formatMessages2 = ({ callName, refs, messages, options, callback }) => {
|
|
15446
|
+
if (!options) throw new Error(`Missing second argument in ${callName}() call`);
|
|
15447
|
+
let keys2 = {};
|
|
15448
|
+
let kind = getFlag(options, keys2, "kind", mustBeString);
|
|
15449
|
+
let color = getFlag(options, keys2, "color", mustBeBoolean);
|
|
15450
|
+
let terminalWidth = getFlag(options, keys2, "terminalWidth", mustBeInteger);
|
|
15451
|
+
checkForInvalidFlags(options, keys2, `in ${callName}() call`);
|
|
15452
|
+
if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
|
|
15453
|
+
if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
|
|
15454
|
+
let request = {
|
|
15455
|
+
command: "format-msgs",
|
|
15456
|
+
messages: sanitizeMessages(messages, "messages", null, "", terminalWidth),
|
|
15457
|
+
isWarning: kind === "warning"
|
|
15458
|
+
};
|
|
15459
|
+
if (color !== void 0) request.color = color;
|
|
15460
|
+
if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
|
|
15461
|
+
sendRequest(refs, request, (error2, response) => {
|
|
15462
|
+
if (error2) return callback(new Error(error2), null);
|
|
15463
|
+
callback(null, response.messages);
|
|
15464
|
+
});
|
|
15465
|
+
};
|
|
15466
|
+
let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => {
|
|
15467
|
+
if (options === void 0) options = {};
|
|
15468
|
+
let keys2 = {};
|
|
15469
|
+
let color = getFlag(options, keys2, "color", mustBeBoolean);
|
|
15470
|
+
let verbose = getFlag(options, keys2, "verbose", mustBeBoolean);
|
|
15471
|
+
checkForInvalidFlags(options, keys2, `in ${callName}() call`);
|
|
15472
|
+
let request = {
|
|
15473
|
+
command: "analyze-metafile",
|
|
15474
|
+
metafile
|
|
15475
|
+
};
|
|
15476
|
+
if (color !== void 0) request.color = color;
|
|
15477
|
+
if (verbose !== void 0) request.verbose = verbose;
|
|
15478
|
+
sendRequest(refs, request, (error2, response) => {
|
|
15479
|
+
if (error2) return callback(new Error(error2), null);
|
|
15480
|
+
callback(null, response.result);
|
|
15481
|
+
});
|
|
15482
|
+
};
|
|
15483
|
+
return {
|
|
15484
|
+
readFromStdout,
|
|
15485
|
+
afterClose,
|
|
15486
|
+
service: {
|
|
15487
|
+
buildOrContext,
|
|
15488
|
+
transform: transform22,
|
|
15489
|
+
formatMessages: formatMessages2,
|
|
15490
|
+
analyzeMetafile: analyzeMetafile2
|
|
15491
|
+
}
|
|
15492
|
+
};
|
|
15493
|
+
}
|
|
15494
|
+
function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, options, isTTY2, defaultWD2, callback) {
|
|
15495
|
+
const details = createObjectStash();
|
|
15496
|
+
const isContext = callName === "context";
|
|
15497
|
+
const handleError = (e, pluginName) => {
|
|
15498
|
+
const flags = [];
|
|
15499
|
+
try {
|
|
15500
|
+
pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault);
|
|
15501
|
+
} catch {
|
|
15502
|
+
}
|
|
15503
|
+
const message = extractErrorMessageV8(e, streamIn, details, void 0, pluginName);
|
|
15504
|
+
sendRequest(refs, { command: "error", flags, error: message }, () => {
|
|
15505
|
+
message.detail = details.load(message.detail);
|
|
15506
|
+
callback(failureErrorWithLog(isContext ? "Context failed" : "Build failed", [message], []), null);
|
|
15507
|
+
});
|
|
15508
|
+
};
|
|
15509
|
+
let plugins2;
|
|
15510
|
+
if (typeof options === "object") {
|
|
15511
|
+
const value2 = options.plugins;
|
|
15512
|
+
if (value2 !== void 0) {
|
|
15513
|
+
if (!Array.isArray(value2)) return handleError(new Error(`"plugins" must be an array`), "");
|
|
15514
|
+
plugins2 = value2;
|
|
15515
|
+
}
|
|
15516
|
+
}
|
|
15517
|
+
if (plugins2 && plugins2.length > 0) {
|
|
15518
|
+
if (streamIn.isSync) return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
|
|
15519
|
+
handlePlugins(
|
|
15520
|
+
buildKey,
|
|
15521
|
+
sendRequest,
|
|
15522
|
+
sendResponse,
|
|
15523
|
+
refs,
|
|
15524
|
+
streamIn,
|
|
15525
|
+
requestCallbacks,
|
|
15526
|
+
options,
|
|
15527
|
+
plugins2,
|
|
15528
|
+
details
|
|
15529
|
+
).then(
|
|
15530
|
+
(result) => {
|
|
15531
|
+
if (!result.ok) return handleError(result.error, result.pluginName);
|
|
15532
|
+
try {
|
|
15533
|
+
buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks);
|
|
15534
|
+
} catch (e) {
|
|
15535
|
+
handleError(e, "");
|
|
15536
|
+
}
|
|
15537
|
+
},
|
|
15538
|
+
(e) => handleError(e, "")
|
|
15539
|
+
);
|
|
15540
|
+
return;
|
|
15541
|
+
}
|
|
15542
|
+
try {
|
|
15543
|
+
buildOrContextContinue(null, (result, done) => done([], []), () => {
|
|
15544
|
+
});
|
|
15545
|
+
} catch (e) {
|
|
15546
|
+
handleError(e, "");
|
|
15547
|
+
}
|
|
15548
|
+
function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) {
|
|
15549
|
+
const writeDefault = streamIn.hasFS;
|
|
15550
|
+
const {
|
|
15551
|
+
entries,
|
|
15552
|
+
flags,
|
|
15553
|
+
write,
|
|
15554
|
+
stdinContents,
|
|
15555
|
+
stdinResolveDir,
|
|
15556
|
+
absWorkingDir,
|
|
15557
|
+
nodePaths,
|
|
15558
|
+
mangleCache
|
|
15559
|
+
} = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault);
|
|
15560
|
+
if (write && !streamIn.hasFS) throw new Error(`The "write" option is unavailable in this environment`);
|
|
15561
|
+
const request = {
|
|
15562
|
+
command: "build",
|
|
15563
|
+
key: buildKey,
|
|
15564
|
+
entries,
|
|
15565
|
+
flags,
|
|
15566
|
+
write,
|
|
15567
|
+
stdinContents,
|
|
15568
|
+
stdinResolveDir,
|
|
15569
|
+
absWorkingDir: absWorkingDir || defaultWD2,
|
|
15570
|
+
nodePaths,
|
|
15571
|
+
context: isContext
|
|
15572
|
+
};
|
|
15573
|
+
if (requestPlugins) request.plugins = requestPlugins;
|
|
15574
|
+
if (mangleCache) request.mangleCache = mangleCache;
|
|
15575
|
+
const buildResponseToResult = (response, callback2) => {
|
|
15576
|
+
const result = {
|
|
15577
|
+
errors: replaceDetailsInMessages(response.errors, details),
|
|
15578
|
+
warnings: replaceDetailsInMessages(response.warnings, details),
|
|
15579
|
+
outputFiles: void 0,
|
|
15580
|
+
metafile: void 0,
|
|
15581
|
+
mangleCache: void 0
|
|
15582
|
+
};
|
|
15583
|
+
const originalErrors = result.errors.slice();
|
|
15584
|
+
const originalWarnings = result.warnings.slice();
|
|
15585
|
+
if (response.outputFiles) result.outputFiles = response.outputFiles.map(convertOutputFiles);
|
|
15586
|
+
if (response.metafile) result.metafile = JSON.parse(response.metafile);
|
|
15587
|
+
if (response.mangleCache) result.mangleCache = response.mangleCache;
|
|
15588
|
+
if (response.writeToStdout !== void 0) console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, ""));
|
|
15589
|
+
runOnEndCallbacks(result, (onEndErrors, onEndWarnings) => {
|
|
15590
|
+
if (originalErrors.length > 0 || onEndErrors.length > 0) {
|
|
15591
|
+
const error2 = failureErrorWithLog("Build failed", originalErrors.concat(onEndErrors), originalWarnings.concat(onEndWarnings));
|
|
15592
|
+
return callback2(error2, null, onEndErrors, onEndWarnings);
|
|
15593
|
+
}
|
|
15594
|
+
callback2(null, result, onEndErrors, onEndWarnings);
|
|
15595
|
+
});
|
|
15596
|
+
};
|
|
15597
|
+
let latestResultPromise;
|
|
15598
|
+
let provideLatestResult;
|
|
15599
|
+
if (isContext)
|
|
15600
|
+
requestCallbacks["on-end"] = (id, request2) => new Promise((resolve35) => {
|
|
15601
|
+
buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
|
|
15602
|
+
const response = {
|
|
15603
|
+
errors: onEndErrors,
|
|
15604
|
+
warnings: onEndWarnings
|
|
15605
|
+
};
|
|
15606
|
+
if (provideLatestResult) provideLatestResult(err, result);
|
|
15607
|
+
latestResultPromise = void 0;
|
|
15608
|
+
provideLatestResult = void 0;
|
|
15609
|
+
sendResponse(id, response);
|
|
15610
|
+
resolve35();
|
|
15611
|
+
});
|
|
15612
|
+
});
|
|
15613
|
+
sendRequest(refs, request, (error2, response) => {
|
|
15614
|
+
if (error2) return callback(new Error(error2), null);
|
|
15615
|
+
if (!isContext) {
|
|
15616
|
+
return buildResponseToResult(response, (err, res) => {
|
|
15617
|
+
scheduleOnDisposeCallbacks();
|
|
15618
|
+
return callback(err, res);
|
|
15619
|
+
});
|
|
15620
|
+
}
|
|
15621
|
+
if (response.errors.length > 0) {
|
|
15622
|
+
return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null);
|
|
15623
|
+
}
|
|
15624
|
+
let didDispose = false;
|
|
15625
|
+
const result = {
|
|
15626
|
+
rebuild: () => {
|
|
15627
|
+
if (!latestResultPromise) latestResultPromise = new Promise((resolve35, reject2) => {
|
|
15628
|
+
let settlePromise;
|
|
15629
|
+
provideLatestResult = (err, result2) => {
|
|
15630
|
+
if (!settlePromise) settlePromise = () => err ? reject2(err) : resolve35(result2);
|
|
15631
|
+
};
|
|
15632
|
+
const triggerAnotherBuild = () => {
|
|
15633
|
+
const request2 = {
|
|
15634
|
+
command: "rebuild",
|
|
15635
|
+
key: buildKey
|
|
15636
|
+
};
|
|
15637
|
+
sendRequest(refs, request2, (error22, response2) => {
|
|
15638
|
+
if (error22) {
|
|
15639
|
+
reject2(new Error(error22));
|
|
15640
|
+
} else if (settlePromise) {
|
|
15641
|
+
settlePromise();
|
|
15642
|
+
} else {
|
|
15643
|
+
triggerAnotherBuild();
|
|
15644
|
+
}
|
|
15645
|
+
});
|
|
15646
|
+
};
|
|
15647
|
+
triggerAnotherBuild();
|
|
15648
|
+
});
|
|
15649
|
+
return latestResultPromise;
|
|
15650
|
+
},
|
|
15651
|
+
watch: (options2 = {}) => new Promise((resolve35, reject2) => {
|
|
15652
|
+
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
15653
|
+
const keys2 = {};
|
|
15654
|
+
const delay = getFlag(options2, keys2, "delay", mustBeInteger);
|
|
15655
|
+
checkForInvalidFlags(options2, keys2, `in watch() call`);
|
|
15656
|
+
const request2 = {
|
|
15657
|
+
command: "watch",
|
|
15658
|
+
key: buildKey
|
|
15659
|
+
};
|
|
15660
|
+
if (delay) request2.delay = delay;
|
|
15661
|
+
sendRequest(refs, request2, (error22) => {
|
|
15662
|
+
if (error22) reject2(new Error(error22));
|
|
15663
|
+
else resolve35(void 0);
|
|
15664
|
+
});
|
|
15665
|
+
}),
|
|
15666
|
+
serve: (options2 = {}) => new Promise((resolve35, reject2) => {
|
|
15667
|
+
if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
|
|
15668
|
+
const keys2 = {};
|
|
15669
|
+
const port = getFlag(options2, keys2, "port", mustBeValidPortNumber);
|
|
15670
|
+
const host = getFlag(options2, keys2, "host", mustBeString);
|
|
15671
|
+
const servedir = getFlag(options2, keys2, "servedir", mustBeString);
|
|
15672
|
+
const keyfile = getFlag(options2, keys2, "keyfile", mustBeString);
|
|
15673
|
+
const certfile = getFlag(options2, keys2, "certfile", mustBeString);
|
|
15674
|
+
const fallback = getFlag(options2, keys2, "fallback", mustBeString);
|
|
15675
|
+
const cors = getFlag(options2, keys2, "cors", mustBeObject);
|
|
15676
|
+
const onRequest = getFlag(options2, keys2, "onRequest", mustBeFunction);
|
|
15677
|
+
checkForInvalidFlags(options2, keys2, `in serve() call`);
|
|
15678
|
+
const request2 = {
|
|
15679
|
+
command: "serve",
|
|
15680
|
+
key: buildKey,
|
|
15681
|
+
onRequest: !!onRequest
|
|
15682
|
+
};
|
|
15683
|
+
if (port !== void 0) request2.port = port;
|
|
15684
|
+
if (host !== void 0) request2.host = host;
|
|
15685
|
+
if (servedir !== void 0) request2.servedir = servedir;
|
|
15686
|
+
if (keyfile !== void 0) request2.keyfile = keyfile;
|
|
15687
|
+
if (certfile !== void 0) request2.certfile = certfile;
|
|
15688
|
+
if (fallback !== void 0) request2.fallback = fallback;
|
|
15689
|
+
if (cors) {
|
|
15690
|
+
const corsKeys = {};
|
|
15691
|
+
const origin = getFlag(cors, corsKeys, "origin", mustBeStringOrArrayOfStrings);
|
|
15692
|
+
checkForInvalidFlags(cors, corsKeys, `on "cors" object`);
|
|
15693
|
+
if (Array.isArray(origin)) request2.corsOrigin = origin;
|
|
15694
|
+
else if (origin !== void 0) request2.corsOrigin = [origin];
|
|
15695
|
+
}
|
|
15696
|
+
sendRequest(refs, request2, (error22, response2) => {
|
|
15697
|
+
if (error22) return reject2(new Error(error22));
|
|
15698
|
+
if (onRequest) {
|
|
15699
|
+
requestCallbacks["serve-request"] = (id, request3) => {
|
|
15700
|
+
onRequest(request3.args);
|
|
15701
|
+
sendResponse(id, {});
|
|
15702
|
+
};
|
|
15703
|
+
}
|
|
15704
|
+
resolve35(response2);
|
|
15705
|
+
});
|
|
15706
|
+
}),
|
|
15707
|
+
cancel: () => new Promise((resolve35) => {
|
|
15708
|
+
if (didDispose) return resolve35();
|
|
15709
|
+
const request2 = {
|
|
15710
|
+
command: "cancel",
|
|
15711
|
+
key: buildKey
|
|
15712
|
+
};
|
|
15713
|
+
sendRequest(refs, request2, () => {
|
|
15714
|
+
resolve35();
|
|
15715
|
+
});
|
|
15716
|
+
}),
|
|
15717
|
+
dispose: () => new Promise((resolve35) => {
|
|
15718
|
+
if (didDispose) return resolve35();
|
|
15719
|
+
didDispose = true;
|
|
15720
|
+
const request2 = {
|
|
15721
|
+
command: "dispose",
|
|
15722
|
+
key: buildKey
|
|
15723
|
+
};
|
|
15724
|
+
sendRequest(refs, request2, () => {
|
|
15725
|
+
resolve35();
|
|
15726
|
+
scheduleOnDisposeCallbacks();
|
|
15727
|
+
refs.unref();
|
|
15728
|
+
});
|
|
15729
|
+
})
|
|
15730
|
+
};
|
|
15731
|
+
refs.ref();
|
|
15732
|
+
callback(null, result);
|
|
15733
|
+
});
|
|
15734
|
+
}
|
|
15735
|
+
}
|
|
15736
|
+
var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, initialOptions, plugins2, details) => {
|
|
15737
|
+
let onStartCallbacks = [];
|
|
15738
|
+
let onEndCallbacks = [];
|
|
15739
|
+
let onResolveCallbacks = {};
|
|
15740
|
+
let onLoadCallbacks = {};
|
|
15741
|
+
let onDisposeCallbacks = [];
|
|
15742
|
+
let nextCallbackID = 0;
|
|
15743
|
+
let i = 0;
|
|
15744
|
+
let requestPlugins = [];
|
|
15745
|
+
let isSetupDone = false;
|
|
15746
|
+
plugins2 = [...plugins2];
|
|
15747
|
+
for (let item of plugins2) {
|
|
15748
|
+
let keys2 = {};
|
|
15749
|
+
if (typeof item !== "object") throw new Error(`Plugin at index ${i} must be an object`);
|
|
15750
|
+
const name = getFlag(item, keys2, "name", mustBeString);
|
|
15751
|
+
if (typeof name !== "string" || name === "") throw new Error(`Plugin at index ${i} is missing a name`);
|
|
15752
|
+
try {
|
|
15753
|
+
let setup = getFlag(item, keys2, "setup", mustBeFunction);
|
|
15754
|
+
if (typeof setup !== "function") throw new Error(`Plugin is missing a setup function`);
|
|
15755
|
+
checkForInvalidFlags(item, keys2, `on plugin ${quote(name)}`);
|
|
15756
|
+
let plugin = {
|
|
15757
|
+
name,
|
|
15758
|
+
onStart: false,
|
|
15759
|
+
onEnd: false,
|
|
15760
|
+
onResolve: [],
|
|
15761
|
+
onLoad: []
|
|
15762
|
+
};
|
|
15763
|
+
i++;
|
|
15764
|
+
let resolve35 = (path310, options = {}) => {
|
|
15765
|
+
if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
|
|
15766
|
+
if (typeof path310 !== "string") throw new Error(`The path to resolve must be a string`);
|
|
15767
|
+
let keys22 = /* @__PURE__ */ Object.create(null);
|
|
15768
|
+
let pluginName = getFlag(options, keys22, "pluginName", mustBeString);
|
|
15769
|
+
let importer = getFlag(options, keys22, "importer", mustBeString);
|
|
15770
|
+
let namespace = getFlag(options, keys22, "namespace", mustBeString);
|
|
15771
|
+
let resolveDir = getFlag(options, keys22, "resolveDir", mustBeString);
|
|
15772
|
+
let kind = getFlag(options, keys22, "kind", mustBeString);
|
|
15773
|
+
let pluginData = getFlag(options, keys22, "pluginData", canBeAnything);
|
|
15774
|
+
let importAttributes = getFlag(options, keys22, "with", mustBeObject);
|
|
15775
|
+
checkForInvalidFlags(options, keys22, "in resolve() call");
|
|
15776
|
+
return new Promise((resolve210, reject2) => {
|
|
15777
|
+
const request = {
|
|
15778
|
+
command: "resolve",
|
|
15779
|
+
path: path310,
|
|
15780
|
+
key: buildKey,
|
|
15781
|
+
pluginName: name
|
|
15782
|
+
};
|
|
15783
|
+
if (pluginName != null) request.pluginName = pluginName;
|
|
15784
|
+
if (importer != null) request.importer = importer;
|
|
15785
|
+
if (namespace != null) request.namespace = namespace;
|
|
15786
|
+
if (resolveDir != null) request.resolveDir = resolveDir;
|
|
15787
|
+
if (kind != null) request.kind = kind;
|
|
15788
|
+
else throw new Error(`Must specify "kind" when calling "resolve"`);
|
|
15789
|
+
if (pluginData != null) request.pluginData = details.store(pluginData);
|
|
15790
|
+
if (importAttributes != null) request.with = sanitizeStringMap(importAttributes, "with");
|
|
15791
|
+
sendRequest(refs, request, (error2, response) => {
|
|
15792
|
+
if (error2 !== null) reject2(new Error(error2));
|
|
15793
|
+
else resolve210({
|
|
15794
|
+
errors: replaceDetailsInMessages(response.errors, details),
|
|
15795
|
+
warnings: replaceDetailsInMessages(response.warnings, details),
|
|
15796
|
+
path: response.path,
|
|
15797
|
+
external: response.external,
|
|
15798
|
+
sideEffects: response.sideEffects,
|
|
15799
|
+
namespace: response.namespace,
|
|
15800
|
+
suffix: response.suffix,
|
|
15801
|
+
pluginData: details.load(response.pluginData)
|
|
15802
|
+
});
|
|
15803
|
+
});
|
|
15804
|
+
});
|
|
15805
|
+
};
|
|
15806
|
+
let promise = setup({
|
|
15807
|
+
initialOptions,
|
|
15808
|
+
resolve: resolve35,
|
|
15809
|
+
onStart(callback) {
|
|
15810
|
+
let registeredText = `This error came from the "onStart" callback registered here:`;
|
|
15811
|
+
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
|
|
15812
|
+
onStartCallbacks.push({ name, callback, note: registeredNote });
|
|
15813
|
+
plugin.onStart = true;
|
|
15814
|
+
},
|
|
15815
|
+
onEnd(callback) {
|
|
15816
|
+
let registeredText = `This error came from the "onEnd" callback registered here:`;
|
|
15817
|
+
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd");
|
|
15818
|
+
onEndCallbacks.push({ name, callback, note: registeredNote });
|
|
15819
|
+
plugin.onEnd = true;
|
|
15820
|
+
},
|
|
15821
|
+
onResolve(options, callback) {
|
|
15822
|
+
let registeredText = `This error came from the "onResolve" callback registered here:`;
|
|
15823
|
+
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve");
|
|
15824
|
+
let keys22 = {};
|
|
15825
|
+
let filter3 = getFlag(options, keys22, "filter", mustBeRegExp);
|
|
15826
|
+
let namespace = getFlag(options, keys22, "namespace", mustBeString);
|
|
15827
|
+
checkForInvalidFlags(options, keys22, `in onResolve() call for plugin ${quote(name)}`);
|
|
15828
|
+
if (filter3 == null) throw new Error(`onResolve() call is missing a filter`);
|
|
15829
|
+
let id = nextCallbackID++;
|
|
15830
|
+
onResolveCallbacks[id] = { name, callback, note: registeredNote };
|
|
15831
|
+
plugin.onResolve.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
|
|
15832
|
+
},
|
|
15833
|
+
onLoad(options, callback) {
|
|
15834
|
+
let registeredText = `This error came from the "onLoad" callback registered here:`;
|
|
15835
|
+
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad");
|
|
15836
|
+
let keys22 = {};
|
|
15837
|
+
let filter3 = getFlag(options, keys22, "filter", mustBeRegExp);
|
|
15838
|
+
let namespace = getFlag(options, keys22, "namespace", mustBeString);
|
|
15839
|
+
checkForInvalidFlags(options, keys22, `in onLoad() call for plugin ${quote(name)}`);
|
|
15840
|
+
if (filter3 == null) throw new Error(`onLoad() call is missing a filter`);
|
|
15841
|
+
let id = nextCallbackID++;
|
|
15842
|
+
onLoadCallbacks[id] = { name, callback, note: registeredNote };
|
|
15843
|
+
plugin.onLoad.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
|
|
15844
|
+
},
|
|
15845
|
+
onDispose(callback) {
|
|
15846
|
+
onDisposeCallbacks.push(callback);
|
|
15847
|
+
},
|
|
15848
|
+
esbuild: streamIn.esbuild
|
|
15849
|
+
});
|
|
15850
|
+
if (promise) await promise;
|
|
15851
|
+
requestPlugins.push(plugin);
|
|
15852
|
+
} catch (e) {
|
|
15853
|
+
return { ok: false, error: e, pluginName: name };
|
|
15854
|
+
}
|
|
15855
|
+
}
|
|
15856
|
+
requestCallbacks["on-start"] = async (id, request) => {
|
|
15857
|
+
details.clear();
|
|
15858
|
+
let response = { errors: [], warnings: [] };
|
|
15859
|
+
await Promise.all(onStartCallbacks.map(async ({ name, callback, note }) => {
|
|
15860
|
+
try {
|
|
15861
|
+
let result = await callback();
|
|
15862
|
+
if (result != null) {
|
|
15863
|
+
if (typeof result !== "object") throw new Error(`Expected onStart() callback in plugin ${quote(name)} to return an object`);
|
|
15864
|
+
let keys2 = {};
|
|
15865
|
+
let errors2 = getFlag(result, keys2, "errors", mustBeArray);
|
|
15866
|
+
let warnings = getFlag(result, keys2, "warnings", mustBeArray);
|
|
15867
|
+
checkForInvalidFlags(result, keys2, `from onStart() callback in plugin ${quote(name)}`);
|
|
15868
|
+
if (errors2 != null) response.errors.push(...sanitizeMessages(errors2, "errors", details, name, void 0));
|
|
15869
|
+
if (warnings != null) response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name, void 0));
|
|
15870
|
+
}
|
|
15871
|
+
} catch (e) {
|
|
15872
|
+
response.errors.push(extractErrorMessageV8(e, streamIn, details, note && note(), name));
|
|
15873
|
+
}
|
|
15874
|
+
}));
|
|
15875
|
+
sendResponse(id, response);
|
|
15876
|
+
};
|
|
15877
|
+
requestCallbacks["on-resolve"] = async (id, request) => {
|
|
15878
|
+
let response = {}, name = "", callback, note;
|
|
15879
|
+
for (let id2 of request.ids) {
|
|
15880
|
+
try {
|
|
15881
|
+
({ name, callback, note } = onResolveCallbacks[id2]);
|
|
15882
|
+
let result = await callback({
|
|
15883
|
+
path: request.path,
|
|
15884
|
+
importer: request.importer,
|
|
15885
|
+
namespace: request.namespace,
|
|
15886
|
+
resolveDir: request.resolveDir,
|
|
15887
|
+
kind: request.kind,
|
|
15888
|
+
pluginData: details.load(request.pluginData),
|
|
15889
|
+
with: request.with
|
|
15890
|
+
});
|
|
15891
|
+
if (result != null) {
|
|
15892
|
+
if (typeof result !== "object") throw new Error(`Expected onResolve() callback in plugin ${quote(name)} to return an object`);
|
|
15893
|
+
let keys2 = {};
|
|
15894
|
+
let pluginName = getFlag(result, keys2, "pluginName", mustBeString);
|
|
15895
|
+
let path310 = getFlag(result, keys2, "path", mustBeString);
|
|
15896
|
+
let namespace = getFlag(result, keys2, "namespace", mustBeString);
|
|
15897
|
+
let suffix = getFlag(result, keys2, "suffix", mustBeString);
|
|
15898
|
+
let external = getFlag(result, keys2, "external", mustBeBoolean);
|
|
15899
|
+
let sideEffects = getFlag(result, keys2, "sideEffects", mustBeBoolean);
|
|
15900
|
+
let pluginData = getFlag(result, keys2, "pluginData", canBeAnything);
|
|
15901
|
+
let errors2 = getFlag(result, keys2, "errors", mustBeArray);
|
|
15902
|
+
let warnings = getFlag(result, keys2, "warnings", mustBeArray);
|
|
15903
|
+
let watchFiles = getFlag(result, keys2, "watchFiles", mustBeArrayOfStrings);
|
|
15904
|
+
let watchDirs = getFlag(result, keys2, "watchDirs", mustBeArrayOfStrings);
|
|
15905
|
+
checkForInvalidFlags(result, keys2, `from onResolve() callback in plugin ${quote(name)}`);
|
|
15906
|
+
response.id = id2;
|
|
15907
|
+
if (pluginName != null) response.pluginName = pluginName;
|
|
15908
|
+
if (path310 != null) response.path = path310;
|
|
15909
|
+
if (namespace != null) response.namespace = namespace;
|
|
15910
|
+
if (suffix != null) response.suffix = suffix;
|
|
15911
|
+
if (external != null) response.external = external;
|
|
15912
|
+
if (sideEffects != null) response.sideEffects = sideEffects;
|
|
15913
|
+
if (pluginData != null) response.pluginData = details.store(pluginData);
|
|
15914
|
+
if (errors2 != null) response.errors = sanitizeMessages(errors2, "errors", details, name, void 0);
|
|
15915
|
+
if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0);
|
|
15916
|
+
if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
|
|
15917
|
+
if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
|
|
15918
|
+
break;
|
|
15919
|
+
}
|
|
15920
|
+
} catch (e) {
|
|
15921
|
+
response = { id: id2, errors: [extractErrorMessageV8(e, streamIn, details, note && note(), name)] };
|
|
15922
|
+
break;
|
|
15923
|
+
}
|
|
15924
|
+
}
|
|
15925
|
+
sendResponse(id, response);
|
|
15926
|
+
};
|
|
15927
|
+
requestCallbacks["on-load"] = async (id, request) => {
|
|
15928
|
+
let response = {}, name = "", callback, note;
|
|
15929
|
+
for (let id2 of request.ids) {
|
|
15930
|
+
try {
|
|
15931
|
+
({ name, callback, note } = onLoadCallbacks[id2]);
|
|
15932
|
+
let result = await callback({
|
|
15933
|
+
path: request.path,
|
|
15934
|
+
namespace: request.namespace,
|
|
15935
|
+
suffix: request.suffix,
|
|
15936
|
+
pluginData: details.load(request.pluginData),
|
|
15937
|
+
with: request.with
|
|
15938
|
+
});
|
|
15939
|
+
if (result != null) {
|
|
15940
|
+
if (typeof result !== "object") throw new Error(`Expected onLoad() callback in plugin ${quote(name)} to return an object`);
|
|
15941
|
+
let keys2 = {};
|
|
15942
|
+
let pluginName = getFlag(result, keys2, "pluginName", mustBeString);
|
|
15943
|
+
let contents = getFlag(result, keys2, "contents", mustBeStringOrUint8Array);
|
|
15944
|
+
let resolveDir = getFlag(result, keys2, "resolveDir", mustBeString);
|
|
15945
|
+
let pluginData = getFlag(result, keys2, "pluginData", canBeAnything);
|
|
15946
|
+
let loader2 = getFlag(result, keys2, "loader", mustBeString);
|
|
15947
|
+
let errors2 = getFlag(result, keys2, "errors", mustBeArray);
|
|
15948
|
+
let warnings = getFlag(result, keys2, "warnings", mustBeArray);
|
|
15949
|
+
let watchFiles = getFlag(result, keys2, "watchFiles", mustBeArrayOfStrings);
|
|
15950
|
+
let watchDirs = getFlag(result, keys2, "watchDirs", mustBeArrayOfStrings);
|
|
15951
|
+
checkForInvalidFlags(result, keys2, `from onLoad() callback in plugin ${quote(name)}`);
|
|
15952
|
+
response.id = id2;
|
|
15953
|
+
if (pluginName != null) response.pluginName = pluginName;
|
|
15954
|
+
if (contents instanceof Uint8Array) response.contents = contents;
|
|
15955
|
+
else if (contents != null) response.contents = encodeUTF8(contents);
|
|
15956
|
+
if (resolveDir != null) response.resolveDir = resolveDir;
|
|
15957
|
+
if (pluginData != null) response.pluginData = details.store(pluginData);
|
|
15958
|
+
if (loader2 != null) response.loader = loader2;
|
|
15959
|
+
if (errors2 != null) response.errors = sanitizeMessages(errors2, "errors", details, name, void 0);
|
|
15960
|
+
if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0);
|
|
15961
|
+
if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
|
|
15962
|
+
if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
|
|
15963
|
+
break;
|
|
15964
|
+
}
|
|
15965
|
+
} catch (e) {
|
|
15966
|
+
response = { id: id2, errors: [extractErrorMessageV8(e, streamIn, details, note && note(), name)] };
|
|
15967
|
+
break;
|
|
15968
|
+
}
|
|
15969
|
+
}
|
|
15970
|
+
sendResponse(id, response);
|
|
15971
|
+
};
|
|
15972
|
+
let runOnEndCallbacks = (result, done) => done([], []);
|
|
15973
|
+
if (onEndCallbacks.length > 0) {
|
|
15974
|
+
runOnEndCallbacks = (result, done) => {
|
|
15975
|
+
(async () => {
|
|
15976
|
+
const onEndErrors = [];
|
|
15977
|
+
const onEndWarnings = [];
|
|
15978
|
+
for (const { name, callback, note } of onEndCallbacks) {
|
|
15979
|
+
let newErrors;
|
|
15980
|
+
let newWarnings;
|
|
15981
|
+
try {
|
|
15982
|
+
const value2 = await callback(result);
|
|
15983
|
+
if (value2 != null) {
|
|
15984
|
+
if (typeof value2 !== "object") throw new Error(`Expected onEnd() callback in plugin ${quote(name)} to return an object`);
|
|
15985
|
+
let keys2 = {};
|
|
15986
|
+
let errors2 = getFlag(value2, keys2, "errors", mustBeArray);
|
|
15987
|
+
let warnings = getFlag(value2, keys2, "warnings", mustBeArray);
|
|
15988
|
+
checkForInvalidFlags(value2, keys2, `from onEnd() callback in plugin ${quote(name)}`);
|
|
15989
|
+
if (errors2 != null) newErrors = sanitizeMessages(errors2, "errors", details, name, void 0);
|
|
15990
|
+
if (warnings != null) newWarnings = sanitizeMessages(warnings, "warnings", details, name, void 0);
|
|
15991
|
+
}
|
|
15992
|
+
} catch (e) {
|
|
15993
|
+
newErrors = [extractErrorMessageV8(e, streamIn, details, note && note(), name)];
|
|
15994
|
+
}
|
|
15995
|
+
if (newErrors) {
|
|
15996
|
+
onEndErrors.push(...newErrors);
|
|
15997
|
+
try {
|
|
15998
|
+
result.errors.push(...newErrors);
|
|
15999
|
+
} catch {
|
|
16000
|
+
}
|
|
16001
|
+
}
|
|
16002
|
+
if (newWarnings) {
|
|
16003
|
+
onEndWarnings.push(...newWarnings);
|
|
16004
|
+
try {
|
|
16005
|
+
result.warnings.push(...newWarnings);
|
|
16006
|
+
} catch {
|
|
16007
|
+
}
|
|
16008
|
+
}
|
|
16009
|
+
}
|
|
16010
|
+
done(onEndErrors, onEndWarnings);
|
|
16011
|
+
})();
|
|
16012
|
+
};
|
|
16013
|
+
}
|
|
16014
|
+
let scheduleOnDisposeCallbacks = () => {
|
|
16015
|
+
for (const cb of onDisposeCallbacks) {
|
|
16016
|
+
setTimeout(() => cb(), 0);
|
|
16017
|
+
}
|
|
16018
|
+
};
|
|
16019
|
+
isSetupDone = true;
|
|
16020
|
+
return {
|
|
16021
|
+
ok: true,
|
|
16022
|
+
requestPlugins,
|
|
16023
|
+
runOnEndCallbacks,
|
|
16024
|
+
scheduleOnDisposeCallbacks
|
|
16025
|
+
};
|
|
16026
|
+
};
|
|
16027
|
+
function createObjectStash() {
|
|
16028
|
+
const map3 = /* @__PURE__ */ new Map();
|
|
16029
|
+
let nextID = 0;
|
|
16030
|
+
return {
|
|
16031
|
+
clear() {
|
|
16032
|
+
map3.clear();
|
|
16033
|
+
},
|
|
16034
|
+
load(id) {
|
|
16035
|
+
return map3.get(id);
|
|
16036
|
+
},
|
|
16037
|
+
store(value2) {
|
|
16038
|
+
if (value2 === void 0) return -1;
|
|
16039
|
+
const id = nextID++;
|
|
16040
|
+
map3.set(id, value2);
|
|
16041
|
+
return id;
|
|
16042
|
+
}
|
|
16043
|
+
};
|
|
16044
|
+
}
|
|
16045
|
+
function extractCallerV8(e, streamIn, ident) {
|
|
16046
|
+
let note;
|
|
16047
|
+
let tried = false;
|
|
16048
|
+
return () => {
|
|
16049
|
+
if (tried) return note;
|
|
16050
|
+
tried = true;
|
|
16051
|
+
try {
|
|
16052
|
+
let lines = (e.stack + "").split("\n");
|
|
16053
|
+
lines.splice(1, 1);
|
|
16054
|
+
let location2 = parseStackLinesV8(streamIn, lines, ident);
|
|
16055
|
+
if (location2) {
|
|
16056
|
+
note = { text: e.message, location: location2 };
|
|
16057
|
+
return note;
|
|
16058
|
+
}
|
|
16059
|
+
} catch {
|
|
16060
|
+
}
|
|
16061
|
+
};
|
|
16062
|
+
}
|
|
16063
|
+
function extractErrorMessageV8(e, streamIn, stash, note, pluginName) {
|
|
16064
|
+
let text = "Internal error";
|
|
16065
|
+
let location2 = null;
|
|
16066
|
+
try {
|
|
16067
|
+
text = (e && e.message || e) + "";
|
|
16068
|
+
} catch {
|
|
16069
|
+
}
|
|
16070
|
+
try {
|
|
16071
|
+
location2 = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), "");
|
|
16072
|
+
} catch {
|
|
16073
|
+
}
|
|
16074
|
+
return { id: "", pluginName, text, location: location2, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
|
16075
|
+
}
|
|
16076
|
+
function parseStackLinesV8(streamIn, lines, ident) {
|
|
16077
|
+
let at = " at ";
|
|
16078
|
+
if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) {
|
|
16079
|
+
for (let i = 1; i < lines.length; i++) {
|
|
16080
|
+
let line = lines[i];
|
|
16081
|
+
if (!line.startsWith(at)) continue;
|
|
16082
|
+
line = line.slice(at.length);
|
|
16083
|
+
while (true) {
|
|
16084
|
+
let match2 = /^(?:new |async )?\S+ \((.*)\)$/.exec(line);
|
|
16085
|
+
if (match2) {
|
|
16086
|
+
line = match2[1];
|
|
16087
|
+
continue;
|
|
16088
|
+
}
|
|
16089
|
+
match2 = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line);
|
|
16090
|
+
if (match2) {
|
|
16091
|
+
line = match2[1];
|
|
16092
|
+
continue;
|
|
16093
|
+
}
|
|
16094
|
+
match2 = /^(\S+):(\d+):(\d+)$/.exec(line);
|
|
16095
|
+
if (match2) {
|
|
16096
|
+
let contents;
|
|
16097
|
+
try {
|
|
16098
|
+
contents = streamIn.readFileSync(match2[1], "utf8");
|
|
16099
|
+
} catch {
|
|
16100
|
+
break;
|
|
16101
|
+
}
|
|
16102
|
+
let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match2[2] - 1] || "";
|
|
16103
|
+
let column = +match2[3] - 1;
|
|
16104
|
+
let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0;
|
|
16105
|
+
return {
|
|
16106
|
+
file: match2[1],
|
|
16107
|
+
namespace: "file",
|
|
16108
|
+
line: +match2[2],
|
|
16109
|
+
column: encodeUTF8(lineText.slice(0, column)).length,
|
|
16110
|
+
length: encodeUTF8(lineText.slice(column, column + length)).length,
|
|
16111
|
+
lineText: lineText + "\n" + lines.slice(1).join("\n"),
|
|
16112
|
+
suggestion: ""
|
|
16113
|
+
};
|
|
16114
|
+
}
|
|
16115
|
+
break;
|
|
16116
|
+
}
|
|
16117
|
+
}
|
|
16118
|
+
}
|
|
16119
|
+
return null;
|
|
16120
|
+
}
|
|
16121
|
+
function failureErrorWithLog(text, errors2, warnings) {
|
|
16122
|
+
let limit = 5;
|
|
16123
|
+
text += errors2.length < 1 ? "" : ` with ${errors2.length} error${errors2.length < 2 ? "" : "s"}:` + errors2.slice(0, limit + 1).map((e, i) => {
|
|
16124
|
+
if (i === limit) return "\n...";
|
|
16125
|
+
if (!e.location) return `
|
|
16126
|
+
error: ${e.text}`;
|
|
16127
|
+
let { file, line, column } = e.location;
|
|
16128
|
+
let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : "";
|
|
16129
|
+
return `
|
|
16130
|
+
${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
|
|
16131
|
+
}).join("");
|
|
16132
|
+
let error2 = new Error(text);
|
|
16133
|
+
for (const [key, value2] of [["errors", errors2], ["warnings", warnings]]) {
|
|
16134
|
+
Object.defineProperty(error2, key, {
|
|
16135
|
+
configurable: true,
|
|
16136
|
+
enumerable: true,
|
|
16137
|
+
get: () => value2,
|
|
16138
|
+
set: (value22) => Object.defineProperty(error2, key, {
|
|
16139
|
+
configurable: true,
|
|
16140
|
+
enumerable: true,
|
|
16141
|
+
value: value22
|
|
16142
|
+
})
|
|
16143
|
+
});
|
|
16144
|
+
}
|
|
16145
|
+
return error2;
|
|
16146
|
+
}
|
|
16147
|
+
function replaceDetailsInMessages(messages, stash) {
|
|
16148
|
+
for (const message of messages) {
|
|
16149
|
+
message.detail = stash.load(message.detail);
|
|
16150
|
+
}
|
|
16151
|
+
return messages;
|
|
16152
|
+
}
|
|
16153
|
+
function sanitizeLocation(location2, where, terminalWidth) {
|
|
16154
|
+
if (location2 == null) return null;
|
|
16155
|
+
let keys2 = {};
|
|
16156
|
+
let file = getFlag(location2, keys2, "file", mustBeString);
|
|
16157
|
+
let namespace = getFlag(location2, keys2, "namespace", mustBeString);
|
|
16158
|
+
let line = getFlag(location2, keys2, "line", mustBeInteger);
|
|
16159
|
+
let column = getFlag(location2, keys2, "column", mustBeInteger);
|
|
16160
|
+
let length = getFlag(location2, keys2, "length", mustBeInteger);
|
|
16161
|
+
let lineText = getFlag(location2, keys2, "lineText", mustBeString);
|
|
16162
|
+
let suggestion = getFlag(location2, keys2, "suggestion", mustBeString);
|
|
16163
|
+
checkForInvalidFlags(location2, keys2, where);
|
|
16164
|
+
if (lineText) {
|
|
16165
|
+
const relevantASCII = lineText.slice(
|
|
16166
|
+
0,
|
|
16167
|
+
(column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80)
|
|
16168
|
+
);
|
|
16169
|
+
if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) {
|
|
16170
|
+
lineText = relevantASCII;
|
|
16171
|
+
}
|
|
16172
|
+
}
|
|
16173
|
+
return {
|
|
16174
|
+
file: file || "",
|
|
16175
|
+
namespace: namespace || "",
|
|
16176
|
+
line: line || 0,
|
|
16177
|
+
column: column || 0,
|
|
16178
|
+
length: length || 0,
|
|
16179
|
+
lineText: lineText || "",
|
|
16180
|
+
suggestion: suggestion || ""
|
|
16181
|
+
};
|
|
16182
|
+
}
|
|
16183
|
+
function sanitizeMessages(messages, property2, stash, fallbackPluginName, terminalWidth) {
|
|
16184
|
+
let messagesClone = [];
|
|
16185
|
+
let index = 0;
|
|
16186
|
+
for (const message of messages) {
|
|
16187
|
+
let keys2 = {};
|
|
16188
|
+
let id = getFlag(message, keys2, "id", mustBeString);
|
|
16189
|
+
let pluginName = getFlag(message, keys2, "pluginName", mustBeString);
|
|
16190
|
+
let text = getFlag(message, keys2, "text", mustBeString);
|
|
16191
|
+
let location2 = getFlag(message, keys2, "location", mustBeObjectOrNull);
|
|
16192
|
+
let notes = getFlag(message, keys2, "notes", mustBeArray);
|
|
16193
|
+
let detail = getFlag(message, keys2, "detail", canBeAnything);
|
|
16194
|
+
let where = `in element ${index} of "${property2}"`;
|
|
16195
|
+
checkForInvalidFlags(message, keys2, where);
|
|
16196
|
+
let notesClone = [];
|
|
16197
|
+
if (notes) {
|
|
16198
|
+
for (const note of notes) {
|
|
16199
|
+
let noteKeys = {};
|
|
16200
|
+
let noteText = getFlag(note, noteKeys, "text", mustBeString);
|
|
16201
|
+
let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull);
|
|
16202
|
+
checkForInvalidFlags(note, noteKeys, where);
|
|
16203
|
+
notesClone.push({
|
|
16204
|
+
text: noteText || "",
|
|
16205
|
+
location: sanitizeLocation(noteLocation, where, terminalWidth)
|
|
16206
|
+
});
|
|
16207
|
+
}
|
|
16208
|
+
}
|
|
16209
|
+
messagesClone.push({
|
|
16210
|
+
id: id || "",
|
|
16211
|
+
pluginName: pluginName || fallbackPluginName,
|
|
16212
|
+
text: text || "",
|
|
16213
|
+
location: sanitizeLocation(location2, where, terminalWidth),
|
|
16214
|
+
notes: notesClone,
|
|
16215
|
+
detail: stash ? stash.store(detail) : -1
|
|
16216
|
+
});
|
|
16217
|
+
index++;
|
|
16218
|
+
}
|
|
16219
|
+
return messagesClone;
|
|
16220
|
+
}
|
|
16221
|
+
function sanitizeStringArray(values2, property2) {
|
|
16222
|
+
const result = [];
|
|
16223
|
+
for (const value2 of values2) {
|
|
16224
|
+
if (typeof value2 !== "string") throw new Error(`${quote(property2)} must be an array of strings`);
|
|
16225
|
+
result.push(value2);
|
|
16226
|
+
}
|
|
16227
|
+
return result;
|
|
16228
|
+
}
|
|
16229
|
+
function sanitizeStringMap(map3, property2) {
|
|
16230
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
16231
|
+
for (const key in map3) {
|
|
16232
|
+
const value2 = map3[key];
|
|
16233
|
+
if (typeof value2 !== "string") throw new Error(`key ${quote(key)} in object ${quote(property2)} must be a string`);
|
|
16234
|
+
result[key] = value2;
|
|
16235
|
+
}
|
|
16236
|
+
return result;
|
|
16237
|
+
}
|
|
16238
|
+
function convertOutputFiles({ path: path310, contents, hash }) {
|
|
16239
|
+
let text = null;
|
|
16240
|
+
return {
|
|
16241
|
+
path: path310,
|
|
16242
|
+
contents,
|
|
16243
|
+
hash,
|
|
16244
|
+
get text() {
|
|
16245
|
+
const binary2 = this.contents;
|
|
16246
|
+
if (text === null || binary2 !== contents) {
|
|
16247
|
+
contents = binary2;
|
|
16248
|
+
text = decodeUTF8(binary2);
|
|
16249
|
+
}
|
|
16250
|
+
return text;
|
|
16251
|
+
}
|
|
16252
|
+
};
|
|
16253
|
+
}
|
|
16254
|
+
function jsRegExpToGoRegExp(regexp) {
|
|
16255
|
+
let result = regexp.source;
|
|
16256
|
+
if (regexp.flags) result = `(?${regexp.flags})${result}`;
|
|
16257
|
+
return result;
|
|
16258
|
+
}
|
|
16259
|
+
var fs51 = __require("fs");
|
|
16260
|
+
var os4 = __require("os");
|
|
16261
|
+
var path51 = __require("path");
|
|
16262
|
+
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
|
16263
|
+
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
|
16264
|
+
var packageDarwin_arm64 = "@esbuild/darwin-arm64";
|
|
16265
|
+
var packageDarwin_x64 = "@esbuild/darwin-x64";
|
|
16266
|
+
var knownWindowsPackages = {
|
|
16267
|
+
"win32 arm64 LE": "@esbuild/win32-arm64",
|
|
16268
|
+
"win32 ia32 LE": "@esbuild/win32-ia32",
|
|
16269
|
+
"win32 x64 LE": "@esbuild/win32-x64"
|
|
16270
|
+
};
|
|
16271
|
+
var knownUnixlikePackages = {
|
|
16272
|
+
"aix ppc64 BE": "@esbuild/aix-ppc64",
|
|
16273
|
+
"android arm64 LE": "@esbuild/android-arm64",
|
|
16274
|
+
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
|
16275
|
+
"darwin x64 LE": "@esbuild/darwin-x64",
|
|
16276
|
+
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
|
16277
|
+
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
|
16278
|
+
"linux arm LE": "@esbuild/linux-arm",
|
|
16279
|
+
"linux arm64 LE": "@esbuild/linux-arm64",
|
|
16280
|
+
"linux ia32 LE": "@esbuild/linux-ia32",
|
|
16281
|
+
"linux mips64el LE": "@esbuild/linux-mips64el",
|
|
16282
|
+
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
|
16283
|
+
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
|
16284
|
+
"linux s390x BE": "@esbuild/linux-s390x",
|
|
16285
|
+
"linux x64 LE": "@esbuild/linux-x64",
|
|
16286
|
+
"linux loong64 LE": "@esbuild/linux-loong64",
|
|
16287
|
+
"netbsd arm64 LE": "@esbuild/netbsd-arm64",
|
|
16288
|
+
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
|
16289
|
+
"openbsd arm64 LE": "@esbuild/openbsd-arm64",
|
|
16290
|
+
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
|
16291
|
+
"sunos x64 LE": "@esbuild/sunos-x64"
|
|
16292
|
+
};
|
|
16293
|
+
var knownWebAssemblyFallbackPackages = {
|
|
16294
|
+
"android arm LE": "@esbuild/android-arm",
|
|
16295
|
+
"android x64 LE": "@esbuild/android-x64",
|
|
16296
|
+
"openharmony arm64 LE": "@esbuild/openharmony-arm64"
|
|
16297
|
+
};
|
|
16298
|
+
function pkgAndSubpathForCurrentPlatform() {
|
|
16299
|
+
let pkg;
|
|
16300
|
+
let subpath;
|
|
16301
|
+
let isWASM = false;
|
|
16302
|
+
let platformKey = `${process.platform} ${os4.arch()} ${os4.endianness()}`;
|
|
16303
|
+
if (platformKey in knownWindowsPackages) {
|
|
16304
|
+
pkg = knownWindowsPackages[platformKey];
|
|
16305
|
+
subpath = "esbuild.exe";
|
|
16306
|
+
} else if (platformKey in knownUnixlikePackages) {
|
|
16307
|
+
pkg = knownUnixlikePackages[platformKey];
|
|
16308
|
+
subpath = "bin/esbuild";
|
|
16309
|
+
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
|
16310
|
+
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
|
16311
|
+
subpath = "bin/esbuild";
|
|
16312
|
+
isWASM = true;
|
|
16313
|
+
} else {
|
|
16314
|
+
throw new Error(`Unsupported platform: ${platformKey}`);
|
|
16315
|
+
}
|
|
16316
|
+
return { pkg, subpath, isWASM };
|
|
16317
|
+
}
|
|
16318
|
+
function pkgForSomeOtherPlatform() {
|
|
16319
|
+
const libMainJS = __require.resolve("esbuild");
|
|
16320
|
+
const nodeModulesDirectory = path51.dirname(path51.dirname(path51.dirname(libMainJS)));
|
|
16321
|
+
if (path51.basename(nodeModulesDirectory) === "node_modules") {
|
|
16322
|
+
for (const unixKey in knownUnixlikePackages) {
|
|
16323
|
+
try {
|
|
16324
|
+
const pkg = knownUnixlikePackages[unixKey];
|
|
16325
|
+
if (fs51.existsSync(path51.join(nodeModulesDirectory, pkg))) return pkg;
|
|
16326
|
+
} catch {
|
|
16327
|
+
}
|
|
16328
|
+
}
|
|
16329
|
+
for (const windowsKey in knownWindowsPackages) {
|
|
16330
|
+
try {
|
|
16331
|
+
const pkg = knownWindowsPackages[windowsKey];
|
|
16332
|
+
if (fs51.existsSync(path51.join(nodeModulesDirectory, pkg))) return pkg;
|
|
16333
|
+
} catch {
|
|
16334
|
+
}
|
|
16335
|
+
}
|
|
16336
|
+
}
|
|
16337
|
+
return null;
|
|
16338
|
+
}
|
|
16339
|
+
function downloadedBinPath(pkg, subpath) {
|
|
16340
|
+
const esbuildLibDir = path51.dirname(__require.resolve("esbuild"));
|
|
16341
|
+
return path51.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path51.basename(subpath)}`);
|
|
16342
|
+
}
|
|
16343
|
+
function generateBinPath() {
|
|
16344
|
+
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
|
16345
|
+
if (!fs51.existsSync(ESBUILD_BINARY_PATH)) {
|
|
16346
|
+
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
|
16347
|
+
} else {
|
|
16348
|
+
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
|
|
16349
|
+
}
|
|
16350
|
+
}
|
|
16351
|
+
const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
|
|
16352
|
+
let binPath;
|
|
16353
|
+
try {
|
|
16354
|
+
binPath = __require.resolve(`${pkg}/${subpath}`);
|
|
16355
|
+
} catch (e) {
|
|
16356
|
+
binPath = downloadedBinPath(pkg, subpath);
|
|
16357
|
+
if (!fs51.existsSync(binPath)) {
|
|
16358
|
+
try {
|
|
16359
|
+
__require.resolve(pkg);
|
|
16360
|
+
} catch {
|
|
16361
|
+
const otherPkg = pkgForSomeOtherPlatform();
|
|
16362
|
+
if (otherPkg) {
|
|
16363
|
+
let suggestions = `
|
|
16364
|
+
Specifically the "${otherPkg}" package is present but this platform
|
|
16365
|
+
needs the "${pkg}" package instead. People often get into this
|
|
16366
|
+
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
16367
|
+
into a Docker image that runs Linux, or by copying "node_modules" between
|
|
16368
|
+
Windows and WSL environments.
|
|
16369
|
+
|
|
16370
|
+
If you are installing with npm, you can try not copying the "node_modules"
|
|
16371
|
+
directory when you copy the files over, and running "npm ci" or "npm install"
|
|
16372
|
+
on the destination platform after the copy. Or you could consider using yarn
|
|
16373
|
+
instead of npm which has built-in support for installing a package on multiple
|
|
16374
|
+
platforms simultaneously.
|
|
16375
|
+
|
|
16376
|
+
If you are installing with yarn, you can try listing both this platform and the
|
|
16377
|
+
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
|
16378
|
+
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
16379
|
+
Keep in mind that this means multiple copies of esbuild will be present.
|
|
16380
|
+
`;
|
|
16381
|
+
if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
|
|
16382
|
+
suggestions = `
|
|
16383
|
+
Specifically the "${otherPkg}" package is present but this platform
|
|
16384
|
+
needs the "${pkg}" package instead. People often get into this
|
|
16385
|
+
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
|
16386
|
+
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
|
|
16387
|
+
2 is Apple's on-the-fly x86_64-to-arm64 translation service).
|
|
16388
|
+
|
|
16389
|
+
If you are installing with npm, you can try ensuring that both npm and node are
|
|
16390
|
+
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
|
|
16391
|
+
changing how you installed npm and/or node. For example, installing node with
|
|
16392
|
+
the universal installer here should work: https://nodejs.org/en/download/. Or
|
|
16393
|
+
you could consider using yarn instead of npm which has built-in support for
|
|
16394
|
+
installing a package on multiple platforms simultaneously.
|
|
16395
|
+
|
|
16396
|
+
If you are installing with yarn, you can try listing both "arm64" and "x64"
|
|
16397
|
+
in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
|
|
16398
|
+
https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
16399
|
+
Keep in mind that this means multiple copies of esbuild will be present.
|
|
16400
|
+
`;
|
|
16401
|
+
}
|
|
16402
|
+
throw new Error(`
|
|
16403
|
+
You installed esbuild for another platform than the one you're currently using.
|
|
16404
|
+
This won't work because esbuild is written with native code and needs to
|
|
16405
|
+
install a platform-specific binary executable.
|
|
16406
|
+
${suggestions}
|
|
16407
|
+
Another alternative is to use the "esbuild-wasm" package instead, which works
|
|
16408
|
+
the same way on all platforms. But it comes with a heavy performance cost and
|
|
16409
|
+
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
|
16410
|
+
want to do that.
|
|
16411
|
+
`);
|
|
16412
|
+
}
|
|
16413
|
+
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
|
16414
|
+
|
|
16415
|
+
If you are installing esbuild with npm, make sure that you don't specify the
|
|
16416
|
+
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
|
16417
|
+
of "package.json" is used by esbuild to install the correct binary executable
|
|
16418
|
+
for your current platform.`);
|
|
16419
|
+
}
|
|
16420
|
+
throw e;
|
|
16421
|
+
}
|
|
16422
|
+
}
|
|
16423
|
+
if (/\.zip\//.test(binPath)) {
|
|
16424
|
+
let pnpapi;
|
|
16425
|
+
try {
|
|
16426
|
+
pnpapi = __require("pnpapi");
|
|
16427
|
+
} catch (e) {
|
|
16428
|
+
}
|
|
16429
|
+
if (pnpapi) {
|
|
16430
|
+
const root2 = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
|
|
16431
|
+
const binTargetPath = path51.join(
|
|
16432
|
+
root2,
|
|
16433
|
+
"node_modules",
|
|
16434
|
+
".cache",
|
|
16435
|
+
"esbuild",
|
|
16436
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.27.3"}-${path51.basename(subpath)}`
|
|
16437
|
+
);
|
|
16438
|
+
if (!fs51.existsSync(binTargetPath)) {
|
|
16439
|
+
fs51.mkdirSync(path51.dirname(binTargetPath), { recursive: true });
|
|
16440
|
+
fs51.copyFileSync(binPath, binTargetPath);
|
|
16441
|
+
fs51.chmodSync(binTargetPath, 493);
|
|
16442
|
+
}
|
|
16443
|
+
return { binPath: binTargetPath, isWASM };
|
|
16444
|
+
}
|
|
16445
|
+
}
|
|
16446
|
+
return { binPath, isWASM };
|
|
16447
|
+
}
|
|
16448
|
+
var child_process = __require("child_process");
|
|
16449
|
+
var crypto2 = __require("crypto");
|
|
16450
|
+
var path210 = __require("path");
|
|
16451
|
+
var fs210 = __require("fs");
|
|
16452
|
+
var os22 = __require("os");
|
|
16453
|
+
var tty = __require("tty");
|
|
16454
|
+
var worker_threads;
|
|
16455
|
+
if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
16456
|
+
try {
|
|
16457
|
+
worker_threads = __require("worker_threads");
|
|
16458
|
+
} catch {
|
|
16459
|
+
}
|
|
16460
|
+
let [major, minor] = process.versions.node.split(".");
|
|
16461
|
+
if (
|
|
16462
|
+
// <v12.17.0 does not work
|
|
16463
|
+
+major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13
|
|
16464
|
+
) {
|
|
16465
|
+
worker_threads = void 0;
|
|
16466
|
+
}
|
|
16467
|
+
}
|
|
16468
|
+
var _a2;
|
|
16469
|
+
var isInternalWorkerThread = ((_a2 = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a2.esbuildVersion) === "0.27.3";
|
|
16470
|
+
var esbuildCommandAndArgs = () => {
|
|
16471
|
+
if ((!ESBUILD_BINARY_PATH || false) && (path210.basename(__filename) !== "main.js" || path210.basename(__dirname) !== "lib")) {
|
|
16472
|
+
throw new Error(
|
|
16473
|
+
`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
|
|
16474
|
+
|
|
16475
|
+
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`
|
|
16476
|
+
);
|
|
16477
|
+
}
|
|
16478
|
+
if (false) {
|
|
16479
|
+
return ["node", [path210.join(__dirname, "..", "bin", "esbuild")]];
|
|
16480
|
+
} else {
|
|
16481
|
+
const { binPath, isWASM } = generateBinPath();
|
|
16482
|
+
if (isWASM) {
|
|
16483
|
+
return ["node", [binPath]];
|
|
16484
|
+
} else {
|
|
16485
|
+
return [binPath, []];
|
|
16486
|
+
}
|
|
16487
|
+
}
|
|
16488
|
+
};
|
|
16489
|
+
var isTTY = () => tty.isatty(2);
|
|
16490
|
+
var fsSync = {
|
|
16491
|
+
readFile(tempFile, callback) {
|
|
16492
|
+
try {
|
|
16493
|
+
let contents = fs210.readFileSync(tempFile, "utf8");
|
|
16494
|
+
try {
|
|
16495
|
+
fs210.unlinkSync(tempFile);
|
|
16496
|
+
} catch {
|
|
16497
|
+
}
|
|
16498
|
+
callback(null, contents);
|
|
16499
|
+
} catch (err) {
|
|
16500
|
+
callback(err, null);
|
|
16501
|
+
}
|
|
16502
|
+
},
|
|
16503
|
+
writeFile(contents, callback) {
|
|
16504
|
+
try {
|
|
16505
|
+
let tempFile = randomFileName();
|
|
16506
|
+
fs210.writeFileSync(tempFile, contents);
|
|
16507
|
+
callback(tempFile);
|
|
16508
|
+
} catch {
|
|
16509
|
+
callback(null);
|
|
16510
|
+
}
|
|
16511
|
+
}
|
|
16512
|
+
};
|
|
16513
|
+
var fsAsync = {
|
|
16514
|
+
readFile(tempFile, callback) {
|
|
16515
|
+
try {
|
|
16516
|
+
fs210.readFile(tempFile, "utf8", (err, contents) => {
|
|
16517
|
+
try {
|
|
16518
|
+
fs210.unlink(tempFile, () => callback(err, contents));
|
|
16519
|
+
} catch {
|
|
16520
|
+
callback(err, contents);
|
|
16521
|
+
}
|
|
16522
|
+
});
|
|
16523
|
+
} catch (err) {
|
|
16524
|
+
callback(err, null);
|
|
16525
|
+
}
|
|
16526
|
+
},
|
|
16527
|
+
writeFile(contents, callback) {
|
|
16528
|
+
try {
|
|
16529
|
+
let tempFile = randomFileName();
|
|
16530
|
+
fs210.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile));
|
|
16531
|
+
} catch {
|
|
16532
|
+
callback(null);
|
|
16533
|
+
}
|
|
16534
|
+
}
|
|
16535
|
+
};
|
|
16536
|
+
var version3 = "0.27.3";
|
|
16537
|
+
var build = (options) => ensureServiceIsRunning().build(options);
|
|
16538
|
+
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
16539
|
+
var transform2 = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
16540
|
+
var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options);
|
|
16541
|
+
var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options);
|
|
16542
|
+
var buildSync = (options) => {
|
|
16543
|
+
if (worker_threads && !isInternalWorkerThread) {
|
|
16544
|
+
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
16545
|
+
return workerThreadService.buildSync(options);
|
|
16546
|
+
}
|
|
16547
|
+
let result;
|
|
16548
|
+
runServiceSync((service) => service.buildOrContext({
|
|
16549
|
+
callName: "buildSync",
|
|
16550
|
+
refs: null,
|
|
16551
|
+
options,
|
|
16552
|
+
isTTY: isTTY(),
|
|
16553
|
+
defaultWD,
|
|
16554
|
+
callback: (err, res) => {
|
|
16555
|
+
if (err) throw err;
|
|
16556
|
+
result = res;
|
|
16557
|
+
}
|
|
16558
|
+
}));
|
|
16559
|
+
return result;
|
|
16560
|
+
};
|
|
16561
|
+
var transformSync2 = (input, options) => {
|
|
16562
|
+
if (worker_threads && !isInternalWorkerThread) {
|
|
16563
|
+
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
16564
|
+
return workerThreadService.transformSync(input, options);
|
|
16565
|
+
}
|
|
16566
|
+
let result;
|
|
16567
|
+
runServiceSync((service) => service.transform({
|
|
16568
|
+
callName: "transformSync",
|
|
16569
|
+
refs: null,
|
|
16570
|
+
input,
|
|
16571
|
+
options: options || {},
|
|
16572
|
+
isTTY: isTTY(),
|
|
16573
|
+
fs: fsSync,
|
|
16574
|
+
callback: (err, res) => {
|
|
16575
|
+
if (err) throw err;
|
|
16576
|
+
result = res;
|
|
16577
|
+
}
|
|
16578
|
+
}));
|
|
16579
|
+
return result;
|
|
16580
|
+
};
|
|
16581
|
+
var formatMessagesSync = (messages, options) => {
|
|
16582
|
+
if (worker_threads && !isInternalWorkerThread) {
|
|
16583
|
+
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
16584
|
+
return workerThreadService.formatMessagesSync(messages, options);
|
|
16585
|
+
}
|
|
16586
|
+
let result;
|
|
16587
|
+
runServiceSync((service) => service.formatMessages({
|
|
16588
|
+
callName: "formatMessagesSync",
|
|
16589
|
+
refs: null,
|
|
16590
|
+
messages,
|
|
16591
|
+
options,
|
|
16592
|
+
callback: (err, res) => {
|
|
16593
|
+
if (err) throw err;
|
|
16594
|
+
result = res;
|
|
16595
|
+
}
|
|
16596
|
+
}));
|
|
16597
|
+
return result;
|
|
16598
|
+
};
|
|
16599
|
+
var analyzeMetafileSync = (metafile, options) => {
|
|
16600
|
+
if (worker_threads && !isInternalWorkerThread) {
|
|
16601
|
+
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
16602
|
+
return workerThreadService.analyzeMetafileSync(metafile, options);
|
|
16603
|
+
}
|
|
16604
|
+
let result;
|
|
16605
|
+
runServiceSync((service) => service.analyzeMetafile({
|
|
16606
|
+
callName: "analyzeMetafileSync",
|
|
16607
|
+
refs: null,
|
|
16608
|
+
metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
|
|
16609
|
+
options,
|
|
16610
|
+
callback: (err, res) => {
|
|
16611
|
+
if (err) throw err;
|
|
16612
|
+
result = res;
|
|
16613
|
+
}
|
|
16614
|
+
}));
|
|
16615
|
+
return result;
|
|
16616
|
+
};
|
|
16617
|
+
var stop = () => {
|
|
16618
|
+
if (stopService) stopService();
|
|
16619
|
+
if (workerThreadService) workerThreadService.stop();
|
|
16620
|
+
return Promise.resolve();
|
|
16621
|
+
};
|
|
16622
|
+
var initializeWasCalled = false;
|
|
16623
|
+
var initialize = (options) => {
|
|
16624
|
+
options = validateInitializeOptions(options || {});
|
|
16625
|
+
if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`);
|
|
16626
|
+
if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`);
|
|
16627
|
+
if (options.worker) throw new Error(`The "worker" option only works in the browser`);
|
|
16628
|
+
if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once');
|
|
16629
|
+
ensureServiceIsRunning();
|
|
16630
|
+
initializeWasCalled = true;
|
|
16631
|
+
return Promise.resolve();
|
|
16632
|
+
};
|
|
16633
|
+
var defaultWD = process.cwd();
|
|
16634
|
+
var longLivedService;
|
|
16635
|
+
var stopService;
|
|
16636
|
+
var ensureServiceIsRunning = () => {
|
|
16637
|
+
if (longLivedService) return longLivedService;
|
|
16638
|
+
let [command, args] = esbuildCommandAndArgs();
|
|
16639
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.27.3"}`, "--ping"), {
|
|
16640
|
+
windowsHide: true,
|
|
16641
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
16642
|
+
cwd: defaultWD
|
|
16643
|
+
});
|
|
16644
|
+
let { readFromStdout, afterClose, service } = createChannel({
|
|
16645
|
+
writeToStdin(bytes) {
|
|
16646
|
+
child.stdin.write(bytes, (err) => {
|
|
16647
|
+
if (err) afterClose(err);
|
|
16648
|
+
});
|
|
16649
|
+
},
|
|
16650
|
+
readFileSync: fs210.readFileSync,
|
|
16651
|
+
isSync: false,
|
|
16652
|
+
hasFS: true,
|
|
16653
|
+
esbuild: node_exports
|
|
16654
|
+
});
|
|
16655
|
+
child.stdin.on("error", afterClose);
|
|
16656
|
+
child.on("error", afterClose);
|
|
16657
|
+
const stdin = child.stdin;
|
|
16658
|
+
const stdout = child.stdout;
|
|
16659
|
+
stdout.on("data", readFromStdout);
|
|
16660
|
+
stdout.on("end", afterClose);
|
|
16661
|
+
stopService = () => {
|
|
16662
|
+
stdin.destroy();
|
|
16663
|
+
stdout.destroy();
|
|
16664
|
+
child.kill();
|
|
16665
|
+
initializeWasCalled = false;
|
|
16666
|
+
longLivedService = void 0;
|
|
16667
|
+
stopService = void 0;
|
|
16668
|
+
};
|
|
16669
|
+
let refCount = 0;
|
|
16670
|
+
child.unref();
|
|
16671
|
+
if (stdin.unref) {
|
|
16672
|
+
stdin.unref();
|
|
16673
|
+
}
|
|
16674
|
+
if (stdout.unref) {
|
|
16675
|
+
stdout.unref();
|
|
16676
|
+
}
|
|
16677
|
+
const refs = {
|
|
16678
|
+
ref() {
|
|
16679
|
+
if (++refCount === 1) child.ref();
|
|
16680
|
+
},
|
|
16681
|
+
unref() {
|
|
16682
|
+
if (--refCount === 0) child.unref();
|
|
16683
|
+
}
|
|
16684
|
+
};
|
|
16685
|
+
longLivedService = {
|
|
16686
|
+
build: (options) => new Promise((resolve35, reject2) => {
|
|
16687
|
+
service.buildOrContext({
|
|
16688
|
+
callName: "build",
|
|
16689
|
+
refs,
|
|
16690
|
+
options,
|
|
16691
|
+
isTTY: isTTY(),
|
|
16692
|
+
defaultWD,
|
|
16693
|
+
callback: (err, res) => err ? reject2(err) : resolve35(res)
|
|
16694
|
+
});
|
|
16695
|
+
}),
|
|
16696
|
+
context: (options) => new Promise((resolve35, reject2) => service.buildOrContext({
|
|
16697
|
+
callName: "context",
|
|
16698
|
+
refs,
|
|
16699
|
+
options,
|
|
16700
|
+
isTTY: isTTY(),
|
|
16701
|
+
defaultWD,
|
|
16702
|
+
callback: (err, res) => err ? reject2(err) : resolve35(res)
|
|
16703
|
+
})),
|
|
16704
|
+
transform: (input, options) => new Promise((resolve35, reject2) => service.transform({
|
|
16705
|
+
callName: "transform",
|
|
16706
|
+
refs,
|
|
16707
|
+
input,
|
|
16708
|
+
options: options || {},
|
|
16709
|
+
isTTY: isTTY(),
|
|
16710
|
+
fs: fsAsync,
|
|
16711
|
+
callback: (err, res) => err ? reject2(err) : resolve35(res)
|
|
16712
|
+
})),
|
|
16713
|
+
formatMessages: (messages, options) => new Promise((resolve35, reject2) => service.formatMessages({
|
|
16714
|
+
callName: "formatMessages",
|
|
16715
|
+
refs,
|
|
16716
|
+
messages,
|
|
16717
|
+
options,
|
|
16718
|
+
callback: (err, res) => err ? reject2(err) : resolve35(res)
|
|
16719
|
+
})),
|
|
16720
|
+
analyzeMetafile: (metafile, options) => new Promise((resolve35, reject2) => service.analyzeMetafile({
|
|
16721
|
+
callName: "analyzeMetafile",
|
|
16722
|
+
refs,
|
|
16723
|
+
metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
|
|
16724
|
+
options,
|
|
16725
|
+
callback: (err, res) => err ? reject2(err) : resolve35(res)
|
|
16726
|
+
}))
|
|
16727
|
+
};
|
|
16728
|
+
return longLivedService;
|
|
16729
|
+
};
|
|
16730
|
+
var runServiceSync = (callback) => {
|
|
16731
|
+
let [command, args] = esbuildCommandAndArgs();
|
|
16732
|
+
let stdin = new Uint8Array();
|
|
16733
|
+
let { readFromStdout, afterClose, service } = createChannel({
|
|
16734
|
+
writeToStdin(bytes) {
|
|
16735
|
+
if (stdin.length !== 0) throw new Error("Must run at most one command");
|
|
16736
|
+
stdin = bytes;
|
|
16737
|
+
},
|
|
16738
|
+
isSync: true,
|
|
16739
|
+
hasFS: true,
|
|
16740
|
+
esbuild: node_exports
|
|
16741
|
+
});
|
|
16742
|
+
callback(service);
|
|
16743
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.27.3"}`), {
|
|
16744
|
+
cwd: defaultWD,
|
|
16745
|
+
windowsHide: true,
|
|
16746
|
+
input: stdin,
|
|
16747
|
+
// We don't know how large the output could be. If it's too large, the
|
|
16748
|
+
// command will fail with ENOBUFS. Reserve 16mb for now since that feels
|
|
16749
|
+
// like it should be enough. Also allow overriding this with an environment
|
|
16750
|
+
// variable.
|
|
16751
|
+
maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
|
|
16752
|
+
});
|
|
16753
|
+
readFromStdout(stdout);
|
|
16754
|
+
afterClose(null);
|
|
16755
|
+
};
|
|
16756
|
+
var randomFileName = () => {
|
|
16757
|
+
return path210.join(os22.tmpdir(), `esbuild-${crypto2.randomBytes(32).toString("hex")}`);
|
|
16758
|
+
};
|
|
16759
|
+
var workerThreadService = null;
|
|
16760
|
+
var startWorkerThreadService = (worker_threads2) => {
|
|
16761
|
+
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
16762
|
+
let worker = new worker_threads2.Worker(__filename, {
|
|
16763
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.27.3" },
|
|
16764
|
+
transferList: [workerPort],
|
|
16765
|
+
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
16766
|
+
//
|
|
16767
|
+
// Take care when launching worker threads from preload scripts (scripts loaded
|
|
16768
|
+
// and run using the `-r` command line flag). Unless the `execArgv` option is
|
|
16769
|
+
// explicitly set, new Worker threads automatically inherit the command line flags
|
|
16770
|
+
// from the running process and will preload the same preload scripts as the main
|
|
16771
|
+
// thread. If the preload script unconditionally launches a worker thread, every
|
|
16772
|
+
// thread spawned will spawn another until the application crashes.
|
|
16773
|
+
//
|
|
16774
|
+
execArgv: []
|
|
16775
|
+
});
|
|
16776
|
+
let nextID = 0;
|
|
16777
|
+
let fakeBuildError = (text) => {
|
|
16778
|
+
let error2 = new Error(`Build failed with 1 error:
|
|
16779
|
+
error: ${text}`);
|
|
16780
|
+
let errors2 = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }];
|
|
16781
|
+
error2.errors = errors2;
|
|
16782
|
+
error2.warnings = [];
|
|
16783
|
+
return error2;
|
|
16784
|
+
};
|
|
16785
|
+
let validateBuildSyncOptions = (options) => {
|
|
16786
|
+
if (!options) return;
|
|
16787
|
+
let plugins2 = options.plugins;
|
|
16788
|
+
if (plugins2 && plugins2.length > 0) throw fakeBuildError(`Cannot use plugins in synchronous API calls`);
|
|
16789
|
+
};
|
|
16790
|
+
let applyProperties = (object3, properties) => {
|
|
16791
|
+
for (let key in properties) {
|
|
16792
|
+
object3[key] = properties[key];
|
|
16793
|
+
}
|
|
16794
|
+
};
|
|
16795
|
+
let runCallSync = (command, args) => {
|
|
16796
|
+
let id = nextID++;
|
|
16797
|
+
let sharedBuffer = new SharedArrayBuffer(8);
|
|
16798
|
+
let sharedBufferView = new Int32Array(sharedBuffer);
|
|
16799
|
+
let msg = { sharedBuffer, id, command, args };
|
|
16800
|
+
worker.postMessage(msg);
|
|
16801
|
+
let status = Atomics.wait(sharedBufferView, 0, 0);
|
|
16802
|
+
if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
|
|
16803
|
+
let { message: { id: id2, resolve: resolve35, reject: reject2, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
|
|
16804
|
+
if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
|
|
16805
|
+
if (reject2) {
|
|
16806
|
+
applyProperties(reject2, properties);
|
|
16807
|
+
throw reject2;
|
|
16808
|
+
}
|
|
16809
|
+
return resolve35;
|
|
16810
|
+
};
|
|
16811
|
+
worker.unref();
|
|
16812
|
+
return {
|
|
16813
|
+
buildSync(options) {
|
|
16814
|
+
validateBuildSyncOptions(options);
|
|
16815
|
+
return runCallSync("build", [options]);
|
|
16816
|
+
},
|
|
16817
|
+
transformSync(input, options) {
|
|
16818
|
+
return runCallSync("transform", [input, options]);
|
|
16819
|
+
},
|
|
16820
|
+
formatMessagesSync(messages, options) {
|
|
16821
|
+
return runCallSync("formatMessages", [messages, options]);
|
|
16822
|
+
},
|
|
16823
|
+
analyzeMetafileSync(metafile, options) {
|
|
16824
|
+
return runCallSync("analyzeMetafile", [metafile, options]);
|
|
16825
|
+
},
|
|
16826
|
+
stop() {
|
|
16827
|
+
worker.terminate();
|
|
16828
|
+
workerThreadService = null;
|
|
16829
|
+
}
|
|
16830
|
+
};
|
|
16831
|
+
};
|
|
16832
|
+
var startSyncServiceWorker = () => {
|
|
16833
|
+
let workerPort = worker_threads.workerData.workerPort;
|
|
16834
|
+
let parentPort = worker_threads.parentPort;
|
|
16835
|
+
let extractProperties = (object3) => {
|
|
16836
|
+
let properties = {};
|
|
16837
|
+
if (object3 && typeof object3 === "object") {
|
|
16838
|
+
for (let key in object3) {
|
|
16839
|
+
properties[key] = object3[key];
|
|
16840
|
+
}
|
|
16841
|
+
}
|
|
16842
|
+
return properties;
|
|
16843
|
+
};
|
|
16844
|
+
try {
|
|
16845
|
+
let service = ensureServiceIsRunning();
|
|
16846
|
+
defaultWD = worker_threads.workerData.defaultWD;
|
|
16847
|
+
parentPort.on("message", (msg) => {
|
|
16848
|
+
(async () => {
|
|
16849
|
+
let { sharedBuffer, id, command, args } = msg;
|
|
16850
|
+
let sharedBufferView = new Int32Array(sharedBuffer);
|
|
16851
|
+
try {
|
|
16852
|
+
switch (command) {
|
|
16853
|
+
case "build":
|
|
16854
|
+
workerPort.postMessage({ id, resolve: await service.build(args[0]) });
|
|
16855
|
+
break;
|
|
16856
|
+
case "transform":
|
|
16857
|
+
workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) });
|
|
16858
|
+
break;
|
|
16859
|
+
case "formatMessages":
|
|
16860
|
+
workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) });
|
|
16861
|
+
break;
|
|
16862
|
+
case "analyzeMetafile":
|
|
16863
|
+
workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) });
|
|
16864
|
+
break;
|
|
16865
|
+
default:
|
|
16866
|
+
throw new Error(`Invalid command: ${command}`);
|
|
16867
|
+
}
|
|
16868
|
+
} catch (reject2) {
|
|
16869
|
+
workerPort.postMessage({ id, reject: reject2, properties: extractProperties(reject2) });
|
|
16870
|
+
}
|
|
16871
|
+
Atomics.add(sharedBufferView, 0, 1);
|
|
16872
|
+
Atomics.notify(sharedBufferView, 0, Infinity);
|
|
16873
|
+
})();
|
|
16874
|
+
});
|
|
16875
|
+
} catch (reject2) {
|
|
16876
|
+
parentPort.on("message", (msg) => {
|
|
16877
|
+
let { sharedBuffer, id } = msg;
|
|
16878
|
+
let sharedBufferView = new Int32Array(sharedBuffer);
|
|
16879
|
+
workerPort.postMessage({ id, reject: reject2, properties: extractProperties(reject2) });
|
|
16880
|
+
Atomics.add(sharedBufferView, 0, 1);
|
|
16881
|
+
Atomics.notify(sharedBufferView, 0, Infinity);
|
|
16882
|
+
});
|
|
16883
|
+
}
|
|
16884
|
+
};
|
|
16885
|
+
if (isInternalWorkerThread) {
|
|
16886
|
+
startSyncServiceWorker();
|
|
16887
|
+
}
|
|
16888
|
+
var node_default = node_exports;
|
|
16889
|
+
}
|
|
16890
|
+
});
|
|
16891
|
+
|
|
14679
16892
|
// src/api/inline-runtime.ts
|
|
14680
|
-
function
|
|
16893
|
+
function stripTypeScript(code) {
|
|
16894
|
+
const result = (0, import_esbuild.transformSync)(code, {
|
|
16895
|
+
loader: "ts",
|
|
16896
|
+
target: "es2020",
|
|
16897
|
+
// Keep the code readable (no minification)
|
|
16898
|
+
minify: false,
|
|
16899
|
+
// Preserve formatting as much as possible
|
|
16900
|
+
keepNames: true
|
|
16901
|
+
});
|
|
16902
|
+
return result.code;
|
|
16903
|
+
}
|
|
16904
|
+
function generateInlineRuntime(production, exportClasses = false, outputFormat = "typescript") {
|
|
14681
16905
|
const exportKeyword = exportClasses ? "export " : "";
|
|
14682
16906
|
const lines = [];
|
|
14683
16907
|
lines.push("// ============================================================================");
|
|
@@ -15121,9 +17345,13 @@ function generateInlineRuntime(production, exportClasses = false) {
|
|
|
15121
17345
|
}
|
|
15122
17346
|
lines.push("}");
|
|
15123
17347
|
lines.push("");
|
|
15124
|
-
|
|
17348
|
+
const output = lines.join("\n");
|
|
17349
|
+
if (outputFormat === "javascript") {
|
|
17350
|
+
return stripTypeScript(output);
|
|
17351
|
+
}
|
|
17352
|
+
return output;
|
|
15125
17353
|
}
|
|
15126
|
-
function generateInlineDebugClient(moduleFormat = "esm") {
|
|
17354
|
+
function generateInlineDebugClient(moduleFormat = "esm", outputFormat = "typescript") {
|
|
15127
17355
|
const lines = [];
|
|
15128
17356
|
lines.push("// ============================================================================");
|
|
15129
17357
|
lines.push("// Inline Debug Client (auto-created from FLOW_WEAVER_DEBUG env var)");
|
|
@@ -15196,7 +17424,11 @@ function generateInlineDebugClient(moduleFormat = "esm") {
|
|
|
15196
17424
|
lines.push("}");
|
|
15197
17425
|
lines.push("/* eslint-enable @typescript-eslint/no-explicit-any, no-console */");
|
|
15198
17426
|
lines.push("");
|
|
15199
|
-
|
|
17427
|
+
const output = lines.join("\n");
|
|
17428
|
+
if (outputFormat === "javascript") {
|
|
17429
|
+
return stripTypeScript(output);
|
|
17430
|
+
}
|
|
17431
|
+
return output;
|
|
15200
17432
|
}
|
|
15201
17433
|
function generateStandaloneRuntimeModule(production, moduleFormat = "esm") {
|
|
15202
17434
|
const lines = [];
|
|
@@ -15231,10 +17463,12 @@ function generateStandaloneRuntimeModule(production, moduleFormat = "esm") {
|
|
|
15231
17463
|
lines.push("");
|
|
15232
17464
|
return lines.join("\n");
|
|
15233
17465
|
}
|
|
17466
|
+
var import_esbuild;
|
|
15234
17467
|
var init_inline_runtime = __esm({
|
|
15235
17468
|
"src/api/inline-runtime.ts"() {
|
|
15236
17469
|
"use strict";
|
|
15237
17470
|
init_generated_branding();
|
|
17471
|
+
import_esbuild = __toESM(require_main(), 1);
|
|
15238
17472
|
}
|
|
15239
17473
|
});
|
|
15240
17474
|
|
|
@@ -15346,7 +17580,8 @@ function generateCode(ast, options) {
|
|
|
15346
17580
|
externalRuntimePath,
|
|
15347
17581
|
constants = [],
|
|
15348
17582
|
externalNodeTypes = {},
|
|
15349
|
-
generateStubs = false
|
|
17583
|
+
generateStubs = false,
|
|
17584
|
+
outputFormat = "typescript"
|
|
15350
17585
|
} = options || {};
|
|
15351
17586
|
const stubNodeTypes = ast.nodeTypes.filter((nt) => nt.variant === "STUB");
|
|
15352
17587
|
if (stubNodeTypes.length > 0 && !generateStubs) {
|
|
@@ -15695,7 +17930,10 @@ function generateCode(ast, options) {
|
|
|
15695
17930
|
lines.push(generateModuleExports([ast.functionName]));
|
|
15696
17931
|
addLine();
|
|
15697
17932
|
}
|
|
15698
|
-
|
|
17933
|
+
let code = lines.join("\n");
|
|
17934
|
+
if (outputFormat === "javascript") {
|
|
17935
|
+
code = stripTypeScript(code);
|
|
17936
|
+
}
|
|
15699
17937
|
if (sourceMapGenerator && ast.sourceFile) {
|
|
15700
17938
|
const sourceContent = fs2.readFileSync(ast.sourceFile, "utf8");
|
|
15701
17939
|
sourceMapGenerator.setSourceContent(ast.sourceFile, sourceContent);
|
|
@@ -105190,8 +107428,8 @@ Outputs:
|
|
|
105190
107428
|
`;
|
|
105191
107429
|
|
|
105192
107430
|
// src/export/index.ts
|
|
105193
|
-
var
|
|
105194
|
-
var __dirname2 = path42.dirname(
|
|
107431
|
+
var __filename2 = fileURLToPath4(import.meta.url);
|
|
107432
|
+
var __dirname2 = path42.dirname(__filename2);
|
|
105195
107433
|
async function exportMultiWorkflow(options) {
|
|
105196
107434
|
const inputPath = path42.resolve(options.input);
|
|
105197
107435
|
const outputDir = path42.resolve(options.output);
|
|
@@ -107798,7 +110036,7 @@ async function mcpSetupCommand(options, deps) {
|
|
|
107798
110036
|
|
|
107799
110037
|
// src/cli/index.ts
|
|
107800
110038
|
init_error_utils();
|
|
107801
|
-
var version2 = true ? "0.12.
|
|
110039
|
+
var version2 = true ? "0.12.2" : "0.0.0-dev";
|
|
107802
110040
|
var program2 = new Command();
|
|
107803
110041
|
program2.name("flow-weaver").description("Flow Weaver Annotations - Compile and validate workflow files").version(version2, "-v, --version", "Output the current version");
|
|
107804
110042
|
program2.configureOutput({
|