@ggui-ai/ui-gen 0.8.0 → 0.9.0
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/adapters/generation-dispatch.d.ts +10 -0
- package/dist/adapters/generation-dispatch.js +172 -1392
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/advanced/index.d.ts +1 -1
- package/dist/advanced/index.js +191 -1403
- package/dist/advanced/index.js.map +1 -1
- package/dist/boilerplate.js +3 -2
- package/dist/boilerplate.js.map +1 -1
- package/dist/compose.js +5 -5
- package/dist/compose.js.map +1 -1
- package/dist/{create-ui-generator-GX7tvbyH.d.ts → create-ui-generator-B9kV4U9h.d.ts} +13 -0
- package/dist/evaluation/axis-checks/index.js +32 -1
- package/dist/evaluation/axis-checks/index.js.map +1 -1
- package/dist/evaluation/axis-checks/registry.js +32 -1
- package/dist/evaluation/axis-checks/registry.js.map +1 -1
- package/dist/evaluation/index.js +57 -12
- package/dist/evaluation/index.js.map +1 -1
- package/dist/fragments/index.js +5 -5
- package/dist/fragments/index.js.map +1 -1
- package/dist/harness/index.d.ts +4 -125
- package/dist/harness/index.js +34 -19
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/runtime.d.ts +9 -0
- package/dist/harness/runtime.js +3 -2
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.js +8 -7
- package/dist/harness/types-public.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +191 -1403
- package/dist/index.js.map +1 -1
- package/dist/llm-router-1TyI0_TV.d.ts +156 -0
- package/dist/providers/index.d.ts +35 -93
- package/dist/providers/index.js +13 -8
- package/dist/providers/index.js.map +1 -1
- package/dist/validation/index.js +2 -2
- package/dist/validation/index.js.map +1 -1
- package/package.json +18 -18
- package/src/adapters/generation-dispatch.ts +19 -2
- package/src/boilerplate/system-prompt.ts +3 -2
- package/src/create-ui-generator.ts +44 -11
- package/src/evaluation/axis-checks/checks/state-merge.ts +1 -1
- package/src/evaluation/axis-checks/checks/universal.ts +39 -0
- package/src/evaluation/llm-evaluator.ts +13 -3
- package/src/evaluation/visual-evaluator.ts +5 -1
- package/src/fragments/realtime.ts +3 -3
- package/src/fragments/state.ts +2 -2
- package/src/harness/coding/init-session.ts +4 -1
- package/src/harness/coding/run-eval-round.ts +6 -0
- package/src/harness/llm-router.ts +59 -14
- package/src/harness/runtime.ts +8 -0
- package/src/providers/bedrock.ts +84 -22
- package/src/validation/ui-compiler.ts +2 -2
|
@@ -10,7 +10,10 @@ import path, { dirname, resolve, join, basename } from 'path';
|
|
|
10
10
|
import { createRequire } from 'module';
|
|
11
11
|
import { Linter } from 'eslint';
|
|
12
12
|
import { createHash } from 'crypto';
|
|
13
|
+
import 'fs/promises';
|
|
13
14
|
import { tmpdir } from 'os';
|
|
15
|
+
import { Readable } from 'stream';
|
|
16
|
+
import { pipeline } from 'stream/promises';
|
|
14
17
|
import { createBrotliDecompress, createUnzip } from 'zlib';
|
|
15
18
|
import { fileURLToPath } from 'url';
|
|
16
19
|
import '@ggui-ai/sandbox';
|
|
@@ -708,16 +711,18 @@ function functionCallSteps(interaction) {
|
|
|
708
711
|
function toUserInputStep(text) {
|
|
709
712
|
return { type: "user_input", content: [{ type: "text", text }] };
|
|
710
713
|
}
|
|
711
|
-
function createAgent(
|
|
714
|
+
function createAgent(providerOrConfig) {
|
|
715
|
+
const provider = typeof providerOrConfig === "string" ? providerOrConfig : providerOrConfig.provider;
|
|
716
|
+
const routeOverride = typeof providerOrConfig === "string" ? void 0 : providerOrConfig.routeOverride;
|
|
712
717
|
switch (provider) {
|
|
713
718
|
case "anthropic":
|
|
714
|
-
return new AnthropicAgent();
|
|
719
|
+
return new AnthropicAgent(routeOverride);
|
|
715
720
|
case "openai":
|
|
716
|
-
return new OpenAIAgent();
|
|
721
|
+
return new OpenAIAgent(routeOverride);
|
|
717
722
|
case "google":
|
|
718
|
-
return new GoogleAgent();
|
|
723
|
+
return new GoogleAgent(routeOverride);
|
|
719
724
|
case "openrouter":
|
|
720
|
-
return new OpenRouterAgent();
|
|
725
|
+
return new OpenRouterAgent(routeOverride);
|
|
721
726
|
}
|
|
722
727
|
}
|
|
723
728
|
var LLMAgent, AnthropicAgent, OpenAIAgent, GoogleAgent, OpenRouterAgent;
|
|
@@ -734,6 +739,16 @@ var init_llm_router = __esm({
|
|
|
734
739
|
// Enables turn 2+ to skip re-sending system prompt + history.
|
|
735
740
|
// Call resetSession() between independent generation runs.
|
|
736
741
|
lastSessionId;
|
|
742
|
+
/**
|
|
743
|
+
* Explicit per-call routing override — see `AgentConfig.routeOverride`.
|
|
744
|
+
* Absent when constructed via the bare `new XAgent()` form (every
|
|
745
|
+
* existing call site), so `createClient()`/`resolveModel()` fall
|
|
746
|
+
* back to `process.env` exactly as before.
|
|
747
|
+
*/
|
|
748
|
+
routeOverride;
|
|
749
|
+
constructor(routeOverride) {
|
|
750
|
+
this.routeOverride = routeOverride;
|
|
751
|
+
}
|
|
737
752
|
async getClient() {
|
|
738
753
|
if (!this.client) {
|
|
739
754
|
this.client = await this.createClient();
|
|
@@ -784,19 +799,21 @@ var init_llm_router = __esm({
|
|
|
784
799
|
AnthropicAgent = class extends LLMAgent {
|
|
785
800
|
provider = "anthropic";
|
|
786
801
|
resolveModel(model) {
|
|
787
|
-
|
|
802
|
+
const useBedrock = this.routeOverride?.useBedrock ?? process.env.CLAUDE_CODE_USE_BEDROCK === "1";
|
|
803
|
+
if (useBedrock) {
|
|
788
804
|
return getBedrockModelId(model);
|
|
789
805
|
}
|
|
790
806
|
return model.startsWith("anthropic/") ? model.slice("anthropic/".length) : model;
|
|
791
807
|
}
|
|
792
808
|
async createClient() {
|
|
793
|
-
|
|
809
|
+
const useBedrock = this.routeOverride?.useBedrock ?? process.env.CLAUDE_CODE_USE_BEDROCK === "1";
|
|
810
|
+
if (useBedrock) {
|
|
794
811
|
const { AnthropicBedrock } = await import('@anthropic-ai/bedrock-sdk');
|
|
795
812
|
return new AnthropicBedrock({
|
|
796
813
|
awsRegion: process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? "us-east-1"
|
|
797
814
|
});
|
|
798
815
|
}
|
|
799
|
-
return createAnthropicClient(process.env.ANTHROPIC_API_KEY);
|
|
816
|
+
return createAnthropicClient(this.routeOverride?.apiKey ?? process.env.ANTHROPIC_API_KEY);
|
|
800
817
|
}
|
|
801
818
|
async callText(model, systemPrompt, userPrompt, maxTokens, temperature) {
|
|
802
819
|
const client = await this.getClient();
|
|
@@ -1067,7 +1084,7 @@ var init_llm_router = __esm({
|
|
|
1067
1084
|
}
|
|
1068
1085
|
async createClient() {
|
|
1069
1086
|
const { default: OpenAISDK } = await import('openai');
|
|
1070
|
-
return new OpenAISDK({ apiKey: process.env.OPENAI_API_KEY });
|
|
1087
|
+
return new OpenAISDK({ apiKey: this.routeOverride?.apiKey ?? process.env.OPENAI_API_KEY });
|
|
1071
1088
|
}
|
|
1072
1089
|
async callText(model, systemPrompt, userPrompt, maxTokens, temperature) {
|
|
1073
1090
|
const client = await this.getClient();
|
|
@@ -1217,7 +1234,7 @@ var init_llm_router = __esm({
|
|
|
1217
1234
|
async createClient() {
|
|
1218
1235
|
const { GoogleGenAI: GoogleGenAISDK } = await import('@google/genai');
|
|
1219
1236
|
return new GoogleGenAISDK({
|
|
1220
|
-
apiKey: process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY,
|
|
1237
|
+
apiKey: this.routeOverride?.apiKey ?? (process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY),
|
|
1221
1238
|
httpOptions: { timeout: 3e5 }
|
|
1222
1239
|
// 5 min — Pro models can be slow
|
|
1223
1240
|
});
|
|
@@ -1444,7 +1461,7 @@ var init_llm_router = __esm({
|
|
|
1444
1461
|
async createClient() {
|
|
1445
1462
|
const { OpenRouterClient: OpenRouterClient2 } = await Promise.resolve().then(() => (init_client2(), client_exports));
|
|
1446
1463
|
return new OpenRouterClient2({
|
|
1447
|
-
apiKey: process.env.OPENROUTER_API_KEY
|
|
1464
|
+
apiKey: this.routeOverride?.apiKey ?? process.env.OPENROUTER_API_KEY
|
|
1448
1465
|
});
|
|
1449
1466
|
}
|
|
1450
1467
|
async callText(model, systemPrompt, userPrompt, maxTokens, temperature) {
|
|
@@ -2239,8 +2256,8 @@ var init_ui_compiler = __esm({
|
|
|
2239
2256
|
"@ggui-ai/design/*",
|
|
2240
2257
|
"@ggui-ai/wire",
|
|
2241
2258
|
"@ggui-ai/wire/*",
|
|
2242
|
-
"@ggui-ai/react",
|
|
2243
|
-
"@ggui-ai/react/*"
|
|
2259
|
+
"@ggui-ai/mcp-apps-react",
|
|
2260
|
+
"@ggui-ai/mcp-apps-react/*"
|
|
2244
2261
|
];
|
|
2245
2262
|
MAX_BUNDLE_SIZE = 2 * 1024 * 1024;
|
|
2246
2263
|
UiValidationError = class extends Error {
|
|
@@ -4713,7 +4730,7 @@ async function runLLMEvaluation(context, config, preWarmedContext) {
|
|
|
4713
4730
|
designSystemSummary: context.designContext
|
|
4714
4731
|
});
|
|
4715
4732
|
const numberedSource = context.sourceCode.split("\n").map((line, i) => `${String(i + 1).padStart(4)} | ${line}`).join("\n");
|
|
4716
|
-
const agent = createAgent(routerProvider);
|
|
4733
|
+
const agent = createAgent({ provider: routerProvider, routeOverride: config.routeOverride });
|
|
4717
4734
|
const evalStart = Date.now();
|
|
4718
4735
|
const totalCriteriaCount = TIER_1_CRITERIA.length + TIER_2_CRITERIA.length;
|
|
4719
4736
|
const results = await Promise.all([
|
|
@@ -4827,1298 +4844,6 @@ var init_cost_tracker = __esm({
|
|
|
4827
4844
|
}
|
|
4828
4845
|
});
|
|
4829
4846
|
|
|
4830
|
-
// ../../node_modules/ms/index.js
|
|
4831
|
-
var require_ms = __commonJS({
|
|
4832
|
-
"../../node_modules/ms/index.js"(exports, module) {
|
|
4833
|
-
var s = 1e3;
|
|
4834
|
-
var m = s * 60;
|
|
4835
|
-
var h = m * 60;
|
|
4836
|
-
var d = h * 24;
|
|
4837
|
-
var w = d * 7;
|
|
4838
|
-
var y = d * 365.25;
|
|
4839
|
-
module.exports = function(val, options) {
|
|
4840
|
-
options = options || {};
|
|
4841
|
-
var type = typeof val;
|
|
4842
|
-
if (type === "string" && val.length > 0) {
|
|
4843
|
-
return parse(val);
|
|
4844
|
-
} else if (type === "number" && isFinite(val)) {
|
|
4845
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
4846
|
-
}
|
|
4847
|
-
throw new Error(
|
|
4848
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
4849
|
-
);
|
|
4850
|
-
};
|
|
4851
|
-
function parse(str) {
|
|
4852
|
-
str = String(str);
|
|
4853
|
-
if (str.length > 100) {
|
|
4854
|
-
return;
|
|
4855
|
-
}
|
|
4856
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
4857
|
-
str
|
|
4858
|
-
);
|
|
4859
|
-
if (!match) {
|
|
4860
|
-
return;
|
|
4861
|
-
}
|
|
4862
|
-
var n = parseFloat(match[1]);
|
|
4863
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
4864
|
-
switch (type) {
|
|
4865
|
-
case "years":
|
|
4866
|
-
case "year":
|
|
4867
|
-
case "yrs":
|
|
4868
|
-
case "yr":
|
|
4869
|
-
case "y":
|
|
4870
|
-
return n * y;
|
|
4871
|
-
case "weeks":
|
|
4872
|
-
case "week":
|
|
4873
|
-
case "w":
|
|
4874
|
-
return n * w;
|
|
4875
|
-
case "days":
|
|
4876
|
-
case "day":
|
|
4877
|
-
case "d":
|
|
4878
|
-
return n * d;
|
|
4879
|
-
case "hours":
|
|
4880
|
-
case "hour":
|
|
4881
|
-
case "hrs":
|
|
4882
|
-
case "hr":
|
|
4883
|
-
case "h":
|
|
4884
|
-
return n * h;
|
|
4885
|
-
case "minutes":
|
|
4886
|
-
case "minute":
|
|
4887
|
-
case "mins":
|
|
4888
|
-
case "min":
|
|
4889
|
-
case "m":
|
|
4890
|
-
return n * m;
|
|
4891
|
-
case "seconds":
|
|
4892
|
-
case "second":
|
|
4893
|
-
case "secs":
|
|
4894
|
-
case "sec":
|
|
4895
|
-
case "s":
|
|
4896
|
-
return n * s;
|
|
4897
|
-
case "milliseconds":
|
|
4898
|
-
case "millisecond":
|
|
4899
|
-
case "msecs":
|
|
4900
|
-
case "msec":
|
|
4901
|
-
case "ms":
|
|
4902
|
-
return n;
|
|
4903
|
-
default:
|
|
4904
|
-
return void 0;
|
|
4905
|
-
}
|
|
4906
|
-
}
|
|
4907
|
-
function fmtShort(ms) {
|
|
4908
|
-
var msAbs = Math.abs(ms);
|
|
4909
|
-
if (msAbs >= d) {
|
|
4910
|
-
return Math.round(ms / d) + "d";
|
|
4911
|
-
}
|
|
4912
|
-
if (msAbs >= h) {
|
|
4913
|
-
return Math.round(ms / h) + "h";
|
|
4914
|
-
}
|
|
4915
|
-
if (msAbs >= m) {
|
|
4916
|
-
return Math.round(ms / m) + "m";
|
|
4917
|
-
}
|
|
4918
|
-
if (msAbs >= s) {
|
|
4919
|
-
return Math.round(ms / s) + "s";
|
|
4920
|
-
}
|
|
4921
|
-
return ms + "ms";
|
|
4922
|
-
}
|
|
4923
|
-
function fmtLong(ms) {
|
|
4924
|
-
var msAbs = Math.abs(ms);
|
|
4925
|
-
if (msAbs >= d) {
|
|
4926
|
-
return plural(ms, msAbs, d, "day");
|
|
4927
|
-
}
|
|
4928
|
-
if (msAbs >= h) {
|
|
4929
|
-
return plural(ms, msAbs, h, "hour");
|
|
4930
|
-
}
|
|
4931
|
-
if (msAbs >= m) {
|
|
4932
|
-
return plural(ms, msAbs, m, "minute");
|
|
4933
|
-
}
|
|
4934
|
-
if (msAbs >= s) {
|
|
4935
|
-
return plural(ms, msAbs, s, "second");
|
|
4936
|
-
}
|
|
4937
|
-
return ms + " ms";
|
|
4938
|
-
}
|
|
4939
|
-
function plural(ms, msAbs, n, name) {
|
|
4940
|
-
var isPlural = msAbs >= n * 1.5;
|
|
4941
|
-
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
4942
|
-
}
|
|
4943
|
-
}
|
|
4944
|
-
});
|
|
4945
|
-
|
|
4946
|
-
// ../../node_modules/debug/src/common.js
|
|
4947
|
-
var require_common = __commonJS({
|
|
4948
|
-
"../../node_modules/debug/src/common.js"(exports, module) {
|
|
4949
|
-
function setup(env) {
|
|
4950
|
-
createDebug.debug = createDebug;
|
|
4951
|
-
createDebug.default = createDebug;
|
|
4952
|
-
createDebug.coerce = coerce;
|
|
4953
|
-
createDebug.disable = disable;
|
|
4954
|
-
createDebug.enable = enable;
|
|
4955
|
-
createDebug.enabled = enabled;
|
|
4956
|
-
createDebug.humanize = require_ms();
|
|
4957
|
-
createDebug.destroy = destroy;
|
|
4958
|
-
Object.keys(env).forEach((key) => {
|
|
4959
|
-
createDebug[key] = env[key];
|
|
4960
|
-
});
|
|
4961
|
-
createDebug.names = [];
|
|
4962
|
-
createDebug.skips = [];
|
|
4963
|
-
createDebug.formatters = {};
|
|
4964
|
-
function selectColor(namespace) {
|
|
4965
|
-
let hash = 0;
|
|
4966
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
4967
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
4968
|
-
hash |= 0;
|
|
4969
|
-
}
|
|
4970
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
4971
|
-
}
|
|
4972
|
-
createDebug.selectColor = selectColor;
|
|
4973
|
-
function createDebug(namespace) {
|
|
4974
|
-
let prevTime;
|
|
4975
|
-
let enableOverride = null;
|
|
4976
|
-
let namespacesCache;
|
|
4977
|
-
let enabledCache;
|
|
4978
|
-
function debug(...args) {
|
|
4979
|
-
if (!debug.enabled) {
|
|
4980
|
-
return;
|
|
4981
|
-
}
|
|
4982
|
-
const self = debug;
|
|
4983
|
-
const curr = Number(/* @__PURE__ */ new Date());
|
|
4984
|
-
const ms = curr - (prevTime || curr);
|
|
4985
|
-
self.diff = ms;
|
|
4986
|
-
self.prev = prevTime;
|
|
4987
|
-
self.curr = curr;
|
|
4988
|
-
prevTime = curr;
|
|
4989
|
-
args[0] = createDebug.coerce(args[0]);
|
|
4990
|
-
if (typeof args[0] !== "string") {
|
|
4991
|
-
args.unshift("%O");
|
|
4992
|
-
}
|
|
4993
|
-
let index = 0;
|
|
4994
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
4995
|
-
if (match === "%%") {
|
|
4996
|
-
return "%";
|
|
4997
|
-
}
|
|
4998
|
-
index++;
|
|
4999
|
-
const formatter = createDebug.formatters[format];
|
|
5000
|
-
if (typeof formatter === "function") {
|
|
5001
|
-
const val = args[index];
|
|
5002
|
-
match = formatter.call(self, val);
|
|
5003
|
-
args.splice(index, 1);
|
|
5004
|
-
index--;
|
|
5005
|
-
}
|
|
5006
|
-
return match;
|
|
5007
|
-
});
|
|
5008
|
-
createDebug.formatArgs.call(self, args);
|
|
5009
|
-
const logFn = self.log || createDebug.log;
|
|
5010
|
-
logFn.apply(self, args);
|
|
5011
|
-
}
|
|
5012
|
-
debug.namespace = namespace;
|
|
5013
|
-
debug.useColors = createDebug.useColors();
|
|
5014
|
-
debug.color = createDebug.selectColor(namespace);
|
|
5015
|
-
debug.extend = extend;
|
|
5016
|
-
debug.destroy = createDebug.destroy;
|
|
5017
|
-
Object.defineProperty(debug, "enabled", {
|
|
5018
|
-
enumerable: true,
|
|
5019
|
-
configurable: false,
|
|
5020
|
-
get: () => {
|
|
5021
|
-
if (enableOverride !== null) {
|
|
5022
|
-
return enableOverride;
|
|
5023
|
-
}
|
|
5024
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
5025
|
-
namespacesCache = createDebug.namespaces;
|
|
5026
|
-
enabledCache = createDebug.enabled(namespace);
|
|
5027
|
-
}
|
|
5028
|
-
return enabledCache;
|
|
5029
|
-
},
|
|
5030
|
-
set: (v) => {
|
|
5031
|
-
enableOverride = v;
|
|
5032
|
-
}
|
|
5033
|
-
});
|
|
5034
|
-
if (typeof createDebug.init === "function") {
|
|
5035
|
-
createDebug.init(debug);
|
|
5036
|
-
}
|
|
5037
|
-
return debug;
|
|
5038
|
-
}
|
|
5039
|
-
function extend(namespace, delimiter) {
|
|
5040
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
5041
|
-
newDebug.log = this.log;
|
|
5042
|
-
return newDebug;
|
|
5043
|
-
}
|
|
5044
|
-
function enable(namespaces) {
|
|
5045
|
-
createDebug.save(namespaces);
|
|
5046
|
-
createDebug.namespaces = namespaces;
|
|
5047
|
-
createDebug.names = [];
|
|
5048
|
-
createDebug.skips = [];
|
|
5049
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
5050
|
-
for (const ns of split) {
|
|
5051
|
-
if (ns[0] === "-") {
|
|
5052
|
-
createDebug.skips.push(ns.slice(1));
|
|
5053
|
-
} else {
|
|
5054
|
-
createDebug.names.push(ns);
|
|
5055
|
-
}
|
|
5056
|
-
}
|
|
5057
|
-
}
|
|
5058
|
-
function matchesTemplate(search, template) {
|
|
5059
|
-
let searchIndex = 0;
|
|
5060
|
-
let templateIndex = 0;
|
|
5061
|
-
let starIndex = -1;
|
|
5062
|
-
let matchIndex = 0;
|
|
5063
|
-
while (searchIndex < search.length) {
|
|
5064
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
5065
|
-
if (template[templateIndex] === "*") {
|
|
5066
|
-
starIndex = templateIndex;
|
|
5067
|
-
matchIndex = searchIndex;
|
|
5068
|
-
templateIndex++;
|
|
5069
|
-
} else {
|
|
5070
|
-
searchIndex++;
|
|
5071
|
-
templateIndex++;
|
|
5072
|
-
}
|
|
5073
|
-
} else if (starIndex !== -1) {
|
|
5074
|
-
templateIndex = starIndex + 1;
|
|
5075
|
-
matchIndex++;
|
|
5076
|
-
searchIndex = matchIndex;
|
|
5077
|
-
} else {
|
|
5078
|
-
return false;
|
|
5079
|
-
}
|
|
5080
|
-
}
|
|
5081
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
5082
|
-
templateIndex++;
|
|
5083
|
-
}
|
|
5084
|
-
return templateIndex === template.length;
|
|
5085
|
-
}
|
|
5086
|
-
function disable() {
|
|
5087
|
-
const namespaces = [
|
|
5088
|
-
...createDebug.names,
|
|
5089
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
5090
|
-
].join(",");
|
|
5091
|
-
createDebug.enable("");
|
|
5092
|
-
return namespaces;
|
|
5093
|
-
}
|
|
5094
|
-
function enabled(name) {
|
|
5095
|
-
for (const skip of createDebug.skips) {
|
|
5096
|
-
if (matchesTemplate(name, skip)) {
|
|
5097
|
-
return false;
|
|
5098
|
-
}
|
|
5099
|
-
}
|
|
5100
|
-
for (const ns of createDebug.names) {
|
|
5101
|
-
if (matchesTemplate(name, ns)) {
|
|
5102
|
-
return true;
|
|
5103
|
-
}
|
|
5104
|
-
}
|
|
5105
|
-
return false;
|
|
5106
|
-
}
|
|
5107
|
-
function coerce(val) {
|
|
5108
|
-
if (val instanceof Error) {
|
|
5109
|
-
return val.stack || val.message;
|
|
5110
|
-
}
|
|
5111
|
-
return val;
|
|
5112
|
-
}
|
|
5113
|
-
function destroy() {
|
|
5114
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
5115
|
-
}
|
|
5116
|
-
createDebug.enable(createDebug.load());
|
|
5117
|
-
return createDebug;
|
|
5118
|
-
}
|
|
5119
|
-
module.exports = setup;
|
|
5120
|
-
}
|
|
5121
|
-
});
|
|
5122
|
-
|
|
5123
|
-
// ../../node_modules/debug/src/browser.js
|
|
5124
|
-
var require_browser = __commonJS({
|
|
5125
|
-
"../../node_modules/debug/src/browser.js"(exports, module) {
|
|
5126
|
-
exports.formatArgs = formatArgs;
|
|
5127
|
-
exports.save = save;
|
|
5128
|
-
exports.load = load;
|
|
5129
|
-
exports.useColors = useColors;
|
|
5130
|
-
exports.storage = localstorage();
|
|
5131
|
-
exports.destroy = /* @__PURE__ */ (() => {
|
|
5132
|
-
let warned = false;
|
|
5133
|
-
return () => {
|
|
5134
|
-
if (!warned) {
|
|
5135
|
-
warned = true;
|
|
5136
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
5137
|
-
}
|
|
5138
|
-
};
|
|
5139
|
-
})();
|
|
5140
|
-
exports.colors = [
|
|
5141
|
-
"#0000CC",
|
|
5142
|
-
"#0000FF",
|
|
5143
|
-
"#0033CC",
|
|
5144
|
-
"#0033FF",
|
|
5145
|
-
"#0066CC",
|
|
5146
|
-
"#0066FF",
|
|
5147
|
-
"#0099CC",
|
|
5148
|
-
"#0099FF",
|
|
5149
|
-
"#00CC00",
|
|
5150
|
-
"#00CC33",
|
|
5151
|
-
"#00CC66",
|
|
5152
|
-
"#00CC99",
|
|
5153
|
-
"#00CCCC",
|
|
5154
|
-
"#00CCFF",
|
|
5155
|
-
"#3300CC",
|
|
5156
|
-
"#3300FF",
|
|
5157
|
-
"#3333CC",
|
|
5158
|
-
"#3333FF",
|
|
5159
|
-
"#3366CC",
|
|
5160
|
-
"#3366FF",
|
|
5161
|
-
"#3399CC",
|
|
5162
|
-
"#3399FF",
|
|
5163
|
-
"#33CC00",
|
|
5164
|
-
"#33CC33",
|
|
5165
|
-
"#33CC66",
|
|
5166
|
-
"#33CC99",
|
|
5167
|
-
"#33CCCC",
|
|
5168
|
-
"#33CCFF",
|
|
5169
|
-
"#6600CC",
|
|
5170
|
-
"#6600FF",
|
|
5171
|
-
"#6633CC",
|
|
5172
|
-
"#6633FF",
|
|
5173
|
-
"#66CC00",
|
|
5174
|
-
"#66CC33",
|
|
5175
|
-
"#9900CC",
|
|
5176
|
-
"#9900FF",
|
|
5177
|
-
"#9933CC",
|
|
5178
|
-
"#9933FF",
|
|
5179
|
-
"#99CC00",
|
|
5180
|
-
"#99CC33",
|
|
5181
|
-
"#CC0000",
|
|
5182
|
-
"#CC0033",
|
|
5183
|
-
"#CC0066",
|
|
5184
|
-
"#CC0099",
|
|
5185
|
-
"#CC00CC",
|
|
5186
|
-
"#CC00FF",
|
|
5187
|
-
"#CC3300",
|
|
5188
|
-
"#CC3333",
|
|
5189
|
-
"#CC3366",
|
|
5190
|
-
"#CC3399",
|
|
5191
|
-
"#CC33CC",
|
|
5192
|
-
"#CC33FF",
|
|
5193
|
-
"#CC6600",
|
|
5194
|
-
"#CC6633",
|
|
5195
|
-
"#CC9900",
|
|
5196
|
-
"#CC9933",
|
|
5197
|
-
"#CCCC00",
|
|
5198
|
-
"#CCCC33",
|
|
5199
|
-
"#FF0000",
|
|
5200
|
-
"#FF0033",
|
|
5201
|
-
"#FF0066",
|
|
5202
|
-
"#FF0099",
|
|
5203
|
-
"#FF00CC",
|
|
5204
|
-
"#FF00FF",
|
|
5205
|
-
"#FF3300",
|
|
5206
|
-
"#FF3333",
|
|
5207
|
-
"#FF3366",
|
|
5208
|
-
"#FF3399",
|
|
5209
|
-
"#FF33CC",
|
|
5210
|
-
"#FF33FF",
|
|
5211
|
-
"#FF6600",
|
|
5212
|
-
"#FF6633",
|
|
5213
|
-
"#FF9900",
|
|
5214
|
-
"#FF9933",
|
|
5215
|
-
"#FFCC00",
|
|
5216
|
-
"#FFCC33"
|
|
5217
|
-
];
|
|
5218
|
-
function useColors() {
|
|
5219
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
5220
|
-
return true;
|
|
5221
|
-
}
|
|
5222
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
5223
|
-
return false;
|
|
5224
|
-
}
|
|
5225
|
-
let m;
|
|
5226
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
5227
|
-
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
5228
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
5229
|
-
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
5230
|
-
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
5231
|
-
}
|
|
5232
|
-
function formatArgs(args) {
|
|
5233
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
5234
|
-
if (!this.useColors) {
|
|
5235
|
-
return;
|
|
5236
|
-
}
|
|
5237
|
-
const c = "color: " + this.color;
|
|
5238
|
-
args.splice(1, 0, c, "color: inherit");
|
|
5239
|
-
let index = 0;
|
|
5240
|
-
let lastC = 0;
|
|
5241
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
5242
|
-
if (match === "%%") {
|
|
5243
|
-
return;
|
|
5244
|
-
}
|
|
5245
|
-
index++;
|
|
5246
|
-
if (match === "%c") {
|
|
5247
|
-
lastC = index;
|
|
5248
|
-
}
|
|
5249
|
-
});
|
|
5250
|
-
args.splice(lastC, 0, c);
|
|
5251
|
-
}
|
|
5252
|
-
exports.log = console.debug || console.log || (() => {
|
|
5253
|
-
});
|
|
5254
|
-
function save(namespaces) {
|
|
5255
|
-
try {
|
|
5256
|
-
if (namespaces) {
|
|
5257
|
-
exports.storage.setItem("debug", namespaces);
|
|
5258
|
-
} else {
|
|
5259
|
-
exports.storage.removeItem("debug");
|
|
5260
|
-
}
|
|
5261
|
-
} catch (error) {
|
|
5262
|
-
}
|
|
5263
|
-
}
|
|
5264
|
-
function load() {
|
|
5265
|
-
let r;
|
|
5266
|
-
try {
|
|
5267
|
-
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
5268
|
-
} catch (error) {
|
|
5269
|
-
}
|
|
5270
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
5271
|
-
r = process.env.DEBUG;
|
|
5272
|
-
}
|
|
5273
|
-
return r;
|
|
5274
|
-
}
|
|
5275
|
-
function localstorage() {
|
|
5276
|
-
try {
|
|
5277
|
-
return localStorage;
|
|
5278
|
-
} catch (error) {
|
|
5279
|
-
}
|
|
5280
|
-
}
|
|
5281
|
-
module.exports = require_common()(exports);
|
|
5282
|
-
var { formatters } = module.exports;
|
|
5283
|
-
formatters.j = function(v) {
|
|
5284
|
-
try {
|
|
5285
|
-
return JSON.stringify(v);
|
|
5286
|
-
} catch (error) {
|
|
5287
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
5288
|
-
}
|
|
5289
|
-
};
|
|
5290
|
-
}
|
|
5291
|
-
});
|
|
5292
|
-
|
|
5293
|
-
// ../../node_modules/has-flag/index.js
|
|
5294
|
-
var require_has_flag = __commonJS({
|
|
5295
|
-
"../../node_modules/has-flag/index.js"(exports, module) {
|
|
5296
|
-
module.exports = (flag, argv = process.argv) => {
|
|
5297
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
5298
|
-
const position = argv.indexOf(prefix + flag);
|
|
5299
|
-
const terminatorPosition = argv.indexOf("--");
|
|
5300
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
5301
|
-
};
|
|
5302
|
-
}
|
|
5303
|
-
});
|
|
5304
|
-
|
|
5305
|
-
// ../../node_modules/supports-color/index.js
|
|
5306
|
-
var require_supports_color = __commonJS({
|
|
5307
|
-
"../../node_modules/supports-color/index.js"(exports, module) {
|
|
5308
|
-
var os = __require("os");
|
|
5309
|
-
var tty = __require("tty");
|
|
5310
|
-
var hasFlag = require_has_flag();
|
|
5311
|
-
var { env } = process;
|
|
5312
|
-
var forceColor;
|
|
5313
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
5314
|
-
forceColor = 0;
|
|
5315
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
5316
|
-
forceColor = 1;
|
|
5317
|
-
}
|
|
5318
|
-
if ("FORCE_COLOR" in env) {
|
|
5319
|
-
if (env.FORCE_COLOR === "true") {
|
|
5320
|
-
forceColor = 1;
|
|
5321
|
-
} else if (env.FORCE_COLOR === "false") {
|
|
5322
|
-
forceColor = 0;
|
|
5323
|
-
} else {
|
|
5324
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
function translateLevel(level) {
|
|
5328
|
-
if (level === 0) {
|
|
5329
|
-
return false;
|
|
5330
|
-
}
|
|
5331
|
-
return {
|
|
5332
|
-
level,
|
|
5333
|
-
hasBasic: true,
|
|
5334
|
-
has256: level >= 2,
|
|
5335
|
-
has16m: level >= 3
|
|
5336
|
-
};
|
|
5337
|
-
}
|
|
5338
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
5339
|
-
if (forceColor === 0) {
|
|
5340
|
-
return 0;
|
|
5341
|
-
}
|
|
5342
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
5343
|
-
return 3;
|
|
5344
|
-
}
|
|
5345
|
-
if (hasFlag("color=256")) {
|
|
5346
|
-
return 2;
|
|
5347
|
-
}
|
|
5348
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
5349
|
-
return 0;
|
|
5350
|
-
}
|
|
5351
|
-
const min = forceColor || 0;
|
|
5352
|
-
if (env.TERM === "dumb") {
|
|
5353
|
-
return min;
|
|
5354
|
-
}
|
|
5355
|
-
if (process.platform === "win32") {
|
|
5356
|
-
const osRelease = os.release().split(".");
|
|
5357
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
5358
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
5359
|
-
}
|
|
5360
|
-
return 1;
|
|
5361
|
-
}
|
|
5362
|
-
if ("CI" in env) {
|
|
5363
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
5364
|
-
return 1;
|
|
5365
|
-
}
|
|
5366
|
-
return min;
|
|
5367
|
-
}
|
|
5368
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
5369
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
5370
|
-
}
|
|
5371
|
-
if (env.COLORTERM === "truecolor") {
|
|
5372
|
-
return 3;
|
|
5373
|
-
}
|
|
5374
|
-
if ("TERM_PROGRAM" in env) {
|
|
5375
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
5376
|
-
switch (env.TERM_PROGRAM) {
|
|
5377
|
-
case "iTerm.app":
|
|
5378
|
-
return version >= 3 ? 3 : 2;
|
|
5379
|
-
case "Apple_Terminal":
|
|
5380
|
-
return 2;
|
|
5381
|
-
}
|
|
5382
|
-
}
|
|
5383
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
5384
|
-
return 2;
|
|
5385
|
-
}
|
|
5386
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
5387
|
-
return 1;
|
|
5388
|
-
}
|
|
5389
|
-
if ("COLORTERM" in env) {
|
|
5390
|
-
return 1;
|
|
5391
|
-
}
|
|
5392
|
-
return min;
|
|
5393
|
-
}
|
|
5394
|
-
function getSupportLevel(stream) {
|
|
5395
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
5396
|
-
return translateLevel(level);
|
|
5397
|
-
}
|
|
5398
|
-
module.exports = {
|
|
5399
|
-
supportsColor: getSupportLevel,
|
|
5400
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
5401
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
5402
|
-
};
|
|
5403
|
-
}
|
|
5404
|
-
});
|
|
5405
|
-
|
|
5406
|
-
// ../../node_modules/debug/src/node.js
|
|
5407
|
-
var require_node = __commonJS({
|
|
5408
|
-
"../../node_modules/debug/src/node.js"(exports, module) {
|
|
5409
|
-
var tty = __require("tty");
|
|
5410
|
-
var util = __require("util");
|
|
5411
|
-
exports.init = init;
|
|
5412
|
-
exports.log = log;
|
|
5413
|
-
exports.formatArgs = formatArgs;
|
|
5414
|
-
exports.save = save;
|
|
5415
|
-
exports.load = load;
|
|
5416
|
-
exports.useColors = useColors;
|
|
5417
|
-
exports.destroy = util.deprecate(
|
|
5418
|
-
() => {
|
|
5419
|
-
},
|
|
5420
|
-
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
5421
|
-
);
|
|
5422
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
5423
|
-
try {
|
|
5424
|
-
const supportsColor = require_supports_color();
|
|
5425
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
5426
|
-
exports.colors = [
|
|
5427
|
-
20,
|
|
5428
|
-
21,
|
|
5429
|
-
26,
|
|
5430
|
-
27,
|
|
5431
|
-
32,
|
|
5432
|
-
33,
|
|
5433
|
-
38,
|
|
5434
|
-
39,
|
|
5435
|
-
40,
|
|
5436
|
-
41,
|
|
5437
|
-
42,
|
|
5438
|
-
43,
|
|
5439
|
-
44,
|
|
5440
|
-
45,
|
|
5441
|
-
56,
|
|
5442
|
-
57,
|
|
5443
|
-
62,
|
|
5444
|
-
63,
|
|
5445
|
-
68,
|
|
5446
|
-
69,
|
|
5447
|
-
74,
|
|
5448
|
-
75,
|
|
5449
|
-
76,
|
|
5450
|
-
77,
|
|
5451
|
-
78,
|
|
5452
|
-
79,
|
|
5453
|
-
80,
|
|
5454
|
-
81,
|
|
5455
|
-
92,
|
|
5456
|
-
93,
|
|
5457
|
-
98,
|
|
5458
|
-
99,
|
|
5459
|
-
112,
|
|
5460
|
-
113,
|
|
5461
|
-
128,
|
|
5462
|
-
129,
|
|
5463
|
-
134,
|
|
5464
|
-
135,
|
|
5465
|
-
148,
|
|
5466
|
-
149,
|
|
5467
|
-
160,
|
|
5468
|
-
161,
|
|
5469
|
-
162,
|
|
5470
|
-
163,
|
|
5471
|
-
164,
|
|
5472
|
-
165,
|
|
5473
|
-
166,
|
|
5474
|
-
167,
|
|
5475
|
-
168,
|
|
5476
|
-
169,
|
|
5477
|
-
170,
|
|
5478
|
-
171,
|
|
5479
|
-
172,
|
|
5480
|
-
173,
|
|
5481
|
-
178,
|
|
5482
|
-
179,
|
|
5483
|
-
184,
|
|
5484
|
-
185,
|
|
5485
|
-
196,
|
|
5486
|
-
197,
|
|
5487
|
-
198,
|
|
5488
|
-
199,
|
|
5489
|
-
200,
|
|
5490
|
-
201,
|
|
5491
|
-
202,
|
|
5492
|
-
203,
|
|
5493
|
-
204,
|
|
5494
|
-
205,
|
|
5495
|
-
206,
|
|
5496
|
-
207,
|
|
5497
|
-
208,
|
|
5498
|
-
209,
|
|
5499
|
-
214,
|
|
5500
|
-
215,
|
|
5501
|
-
220,
|
|
5502
|
-
221
|
|
5503
|
-
];
|
|
5504
|
-
}
|
|
5505
|
-
} catch (error) {
|
|
5506
|
-
}
|
|
5507
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
5508
|
-
return /^debug_/i.test(key);
|
|
5509
|
-
}).reduce((obj, key) => {
|
|
5510
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
5511
|
-
return k.toUpperCase();
|
|
5512
|
-
});
|
|
5513
|
-
let val = process.env[key];
|
|
5514
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
5515
|
-
val = true;
|
|
5516
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
5517
|
-
val = false;
|
|
5518
|
-
} else if (val === "null") {
|
|
5519
|
-
val = null;
|
|
5520
|
-
} else {
|
|
5521
|
-
val = Number(val);
|
|
5522
|
-
}
|
|
5523
|
-
obj[prop] = val;
|
|
5524
|
-
return obj;
|
|
5525
|
-
}, {});
|
|
5526
|
-
function useColors() {
|
|
5527
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
5528
|
-
}
|
|
5529
|
-
function formatArgs(args) {
|
|
5530
|
-
const { namespace: name, useColors: useColors2 } = this;
|
|
5531
|
-
if (useColors2) {
|
|
5532
|
-
const c = this.color;
|
|
5533
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
5534
|
-
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
5535
|
-
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
5536
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
5537
|
-
} else {
|
|
5538
|
-
args[0] = getDate() + name + " " + args[0];
|
|
5539
|
-
}
|
|
5540
|
-
}
|
|
5541
|
-
function getDate() {
|
|
5542
|
-
if (exports.inspectOpts.hideDate) {
|
|
5543
|
-
return "";
|
|
5544
|
-
}
|
|
5545
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
5546
|
-
}
|
|
5547
|
-
function log(...args) {
|
|
5548
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
5549
|
-
}
|
|
5550
|
-
function save(namespaces) {
|
|
5551
|
-
if (namespaces) {
|
|
5552
|
-
process.env.DEBUG = namespaces;
|
|
5553
|
-
} else {
|
|
5554
|
-
delete process.env.DEBUG;
|
|
5555
|
-
}
|
|
5556
|
-
}
|
|
5557
|
-
function load() {
|
|
5558
|
-
return process.env.DEBUG;
|
|
5559
|
-
}
|
|
5560
|
-
function init(debug) {
|
|
5561
|
-
debug.inspectOpts = {};
|
|
5562
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
5563
|
-
for (let i = 0; i < keys.length; i++) {
|
|
5564
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
5565
|
-
}
|
|
5566
|
-
}
|
|
5567
|
-
module.exports = require_common()(exports);
|
|
5568
|
-
var { formatters } = module.exports;
|
|
5569
|
-
formatters.o = function(v) {
|
|
5570
|
-
this.inspectOpts.colors = this.useColors;
|
|
5571
|
-
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
5572
|
-
};
|
|
5573
|
-
formatters.O = function(v) {
|
|
5574
|
-
this.inspectOpts.colors = this.useColors;
|
|
5575
|
-
return util.inspect(v, this.inspectOpts);
|
|
5576
|
-
};
|
|
5577
|
-
}
|
|
5578
|
-
});
|
|
5579
|
-
|
|
5580
|
-
// ../../node_modules/debug/src/index.js
|
|
5581
|
-
var require_src = __commonJS({
|
|
5582
|
-
"../../node_modules/debug/src/index.js"(exports, module) {
|
|
5583
|
-
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
5584
|
-
module.exports = require_browser();
|
|
5585
|
-
} else {
|
|
5586
|
-
module.exports = require_node();
|
|
5587
|
-
}
|
|
5588
|
-
}
|
|
5589
|
-
});
|
|
5590
|
-
|
|
5591
|
-
// ../../node_modules/follow-redirects/debug.js
|
|
5592
|
-
var require_debug = __commonJS({
|
|
5593
|
-
"../../node_modules/follow-redirects/debug.js"(exports, module) {
|
|
5594
|
-
var debug;
|
|
5595
|
-
module.exports = function() {
|
|
5596
|
-
if (!debug) {
|
|
5597
|
-
try {
|
|
5598
|
-
debug = require_src()("follow-redirects");
|
|
5599
|
-
} catch (error) {
|
|
5600
|
-
}
|
|
5601
|
-
if (typeof debug !== "function") {
|
|
5602
|
-
debug = function() {
|
|
5603
|
-
};
|
|
5604
|
-
}
|
|
5605
|
-
}
|
|
5606
|
-
debug.apply(null, arguments);
|
|
5607
|
-
};
|
|
5608
|
-
}
|
|
5609
|
-
});
|
|
5610
|
-
|
|
5611
|
-
// ../../node_modules/follow-redirects/index.js
|
|
5612
|
-
var require_follow_redirects = __commonJS({
|
|
5613
|
-
"../../node_modules/follow-redirects/index.js"(exports, module) {
|
|
5614
|
-
var url = __require("url");
|
|
5615
|
-
var URL2 = url.URL;
|
|
5616
|
-
var http = __require("http");
|
|
5617
|
-
var https = __require("https");
|
|
5618
|
-
var Writable = __require("stream").Writable;
|
|
5619
|
-
var assert = __require("assert");
|
|
5620
|
-
var debug = require_debug();
|
|
5621
|
-
(function detectUnsupportedEnvironment() {
|
|
5622
|
-
var looksLikeNode = typeof process !== "undefined";
|
|
5623
|
-
var looksLikeBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
5624
|
-
var looksLikeV8 = isFunction(Error.captureStackTrace);
|
|
5625
|
-
if (!looksLikeNode && (looksLikeBrowser || !looksLikeV8)) {
|
|
5626
|
-
console.warn("The follow-redirects package should be excluded from browser builds.");
|
|
5627
|
-
}
|
|
5628
|
-
})();
|
|
5629
|
-
var useNativeURL = false;
|
|
5630
|
-
try {
|
|
5631
|
-
assert(new URL2(""));
|
|
5632
|
-
} catch (error) {
|
|
5633
|
-
useNativeURL = error.code === "ERR_INVALID_URL";
|
|
5634
|
-
}
|
|
5635
|
-
var sensitiveHeaders = [
|
|
5636
|
-
"Authorization",
|
|
5637
|
-
"Proxy-Authorization",
|
|
5638
|
-
"Cookie"
|
|
5639
|
-
];
|
|
5640
|
-
var preservedUrlFields = [
|
|
5641
|
-
"auth",
|
|
5642
|
-
"host",
|
|
5643
|
-
"hostname",
|
|
5644
|
-
"href",
|
|
5645
|
-
"path",
|
|
5646
|
-
"pathname",
|
|
5647
|
-
"port",
|
|
5648
|
-
"protocol",
|
|
5649
|
-
"query",
|
|
5650
|
-
"search",
|
|
5651
|
-
"hash"
|
|
5652
|
-
];
|
|
5653
|
-
var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
|
|
5654
|
-
var eventHandlers = /* @__PURE__ */ Object.create(null);
|
|
5655
|
-
events.forEach(function(event) {
|
|
5656
|
-
eventHandlers[event] = function(arg1, arg2, arg3) {
|
|
5657
|
-
this._redirectable.emit(event, arg1, arg2, arg3);
|
|
5658
|
-
};
|
|
5659
|
-
});
|
|
5660
|
-
var InvalidUrlError = createErrorType(
|
|
5661
|
-
"ERR_INVALID_URL",
|
|
5662
|
-
"Invalid URL",
|
|
5663
|
-
TypeError
|
|
5664
|
-
);
|
|
5665
|
-
var RedirectionError = createErrorType(
|
|
5666
|
-
"ERR_FR_REDIRECTION_FAILURE",
|
|
5667
|
-
"Redirected request failed"
|
|
5668
|
-
);
|
|
5669
|
-
var TooManyRedirectsError = createErrorType(
|
|
5670
|
-
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
5671
|
-
"Maximum number of redirects exceeded",
|
|
5672
|
-
RedirectionError
|
|
5673
|
-
);
|
|
5674
|
-
var MaxBodyLengthExceededError = createErrorType(
|
|
5675
|
-
"ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
|
|
5676
|
-
"Request body larger than maxBodyLength limit"
|
|
5677
|
-
);
|
|
5678
|
-
var WriteAfterEndError = createErrorType(
|
|
5679
|
-
"ERR_STREAM_WRITE_AFTER_END",
|
|
5680
|
-
"write after end"
|
|
5681
|
-
);
|
|
5682
|
-
var destroy = Writable.prototype.destroy || noop;
|
|
5683
|
-
function RedirectableRequest(options, responseCallback) {
|
|
5684
|
-
Writable.call(this);
|
|
5685
|
-
this._sanitizeOptions(options);
|
|
5686
|
-
this._options = options;
|
|
5687
|
-
this._ended = false;
|
|
5688
|
-
this._ending = false;
|
|
5689
|
-
this._redirectCount = 0;
|
|
5690
|
-
this._redirects = [];
|
|
5691
|
-
this._requestBodyLength = 0;
|
|
5692
|
-
this._requestBodyBuffers = [];
|
|
5693
|
-
if (responseCallback) {
|
|
5694
|
-
this.on("response", responseCallback);
|
|
5695
|
-
}
|
|
5696
|
-
var self = this;
|
|
5697
|
-
this._onNativeResponse = function(response) {
|
|
5698
|
-
try {
|
|
5699
|
-
self._processResponse(response);
|
|
5700
|
-
} catch (cause) {
|
|
5701
|
-
self.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
|
|
5702
|
-
}
|
|
5703
|
-
};
|
|
5704
|
-
this._headerFilter = new RegExp("^(?:" + sensitiveHeaders.concat(options.sensitiveHeaders).map(escapeRegex).join("|") + ")$", "i");
|
|
5705
|
-
this._performRequest();
|
|
5706
|
-
}
|
|
5707
|
-
RedirectableRequest.prototype = Object.create(Writable.prototype);
|
|
5708
|
-
RedirectableRequest.prototype.abort = function() {
|
|
5709
|
-
destroyRequest(this._currentRequest);
|
|
5710
|
-
this._currentRequest.abort();
|
|
5711
|
-
this.emit("abort");
|
|
5712
|
-
};
|
|
5713
|
-
RedirectableRequest.prototype.destroy = function(error) {
|
|
5714
|
-
destroyRequest(this._currentRequest, error);
|
|
5715
|
-
destroy.call(this, error);
|
|
5716
|
-
return this;
|
|
5717
|
-
};
|
|
5718
|
-
RedirectableRequest.prototype.write = function(data, encoding, callback) {
|
|
5719
|
-
if (this._ending) {
|
|
5720
|
-
throw new WriteAfterEndError();
|
|
5721
|
-
}
|
|
5722
|
-
if (!isString(data) && !isBuffer(data)) {
|
|
5723
|
-
throw new TypeError("data should be a string, Buffer or Uint8Array");
|
|
5724
|
-
}
|
|
5725
|
-
if (isFunction(encoding)) {
|
|
5726
|
-
callback = encoding;
|
|
5727
|
-
encoding = null;
|
|
5728
|
-
}
|
|
5729
|
-
if (data.length === 0) {
|
|
5730
|
-
if (callback) {
|
|
5731
|
-
callback();
|
|
5732
|
-
}
|
|
5733
|
-
return;
|
|
5734
|
-
}
|
|
5735
|
-
if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
|
|
5736
|
-
this._requestBodyLength += data.length;
|
|
5737
|
-
this._requestBodyBuffers.push({ data, encoding });
|
|
5738
|
-
this._currentRequest.write(data, encoding, callback);
|
|
5739
|
-
} else {
|
|
5740
|
-
this.emit("error", new MaxBodyLengthExceededError());
|
|
5741
|
-
this.abort();
|
|
5742
|
-
}
|
|
5743
|
-
};
|
|
5744
|
-
RedirectableRequest.prototype.end = function(data, encoding, callback) {
|
|
5745
|
-
if (isFunction(data)) {
|
|
5746
|
-
callback = data;
|
|
5747
|
-
data = encoding = null;
|
|
5748
|
-
} else if (isFunction(encoding)) {
|
|
5749
|
-
callback = encoding;
|
|
5750
|
-
encoding = null;
|
|
5751
|
-
}
|
|
5752
|
-
if (!data) {
|
|
5753
|
-
this._ended = this._ending = true;
|
|
5754
|
-
this._currentRequest.end(null, null, callback);
|
|
5755
|
-
} else {
|
|
5756
|
-
var self = this;
|
|
5757
|
-
var currentRequest = this._currentRequest;
|
|
5758
|
-
this.write(data, encoding, function() {
|
|
5759
|
-
self._ended = true;
|
|
5760
|
-
currentRequest.end(null, null, callback);
|
|
5761
|
-
});
|
|
5762
|
-
this._ending = true;
|
|
5763
|
-
}
|
|
5764
|
-
};
|
|
5765
|
-
RedirectableRequest.prototype.setHeader = function(name, value) {
|
|
5766
|
-
this._options.headers[name] = value;
|
|
5767
|
-
this._currentRequest.setHeader(name, value);
|
|
5768
|
-
};
|
|
5769
|
-
RedirectableRequest.prototype.removeHeader = function(name) {
|
|
5770
|
-
delete this._options.headers[name];
|
|
5771
|
-
this._currentRequest.removeHeader(name);
|
|
5772
|
-
};
|
|
5773
|
-
RedirectableRequest.prototype.setTimeout = function(msecs, callback) {
|
|
5774
|
-
var self = this;
|
|
5775
|
-
function destroyOnTimeout(socket) {
|
|
5776
|
-
socket.setTimeout(msecs);
|
|
5777
|
-
socket.removeListener("timeout", socket.destroy);
|
|
5778
|
-
socket.addListener("timeout", socket.destroy);
|
|
5779
|
-
}
|
|
5780
|
-
function startTimer(socket) {
|
|
5781
|
-
if (self._timeout) {
|
|
5782
|
-
clearTimeout(self._timeout);
|
|
5783
|
-
}
|
|
5784
|
-
self._timeout = setTimeout(function() {
|
|
5785
|
-
self.emit("timeout");
|
|
5786
|
-
clearTimer();
|
|
5787
|
-
}, msecs);
|
|
5788
|
-
destroyOnTimeout(socket);
|
|
5789
|
-
}
|
|
5790
|
-
function clearTimer() {
|
|
5791
|
-
if (self._timeout) {
|
|
5792
|
-
clearTimeout(self._timeout);
|
|
5793
|
-
self._timeout = null;
|
|
5794
|
-
}
|
|
5795
|
-
self.removeListener("abort", clearTimer);
|
|
5796
|
-
self.removeListener("error", clearTimer);
|
|
5797
|
-
self.removeListener("response", clearTimer);
|
|
5798
|
-
self.removeListener("close", clearTimer);
|
|
5799
|
-
if (callback) {
|
|
5800
|
-
self.removeListener("timeout", callback);
|
|
5801
|
-
}
|
|
5802
|
-
if (!self.socket) {
|
|
5803
|
-
self._currentRequest.removeListener("socket", startTimer);
|
|
5804
|
-
}
|
|
5805
|
-
}
|
|
5806
|
-
if (callback) {
|
|
5807
|
-
this.on("timeout", callback);
|
|
5808
|
-
}
|
|
5809
|
-
if (this.socket) {
|
|
5810
|
-
startTimer(this.socket);
|
|
5811
|
-
} else {
|
|
5812
|
-
this._currentRequest.once("socket", startTimer);
|
|
5813
|
-
}
|
|
5814
|
-
this.on("socket", destroyOnTimeout);
|
|
5815
|
-
this.on("abort", clearTimer);
|
|
5816
|
-
this.on("error", clearTimer);
|
|
5817
|
-
this.on("response", clearTimer);
|
|
5818
|
-
this.on("close", clearTimer);
|
|
5819
|
-
return this;
|
|
5820
|
-
};
|
|
5821
|
-
[
|
|
5822
|
-
"flushHeaders",
|
|
5823
|
-
"getHeader",
|
|
5824
|
-
"setNoDelay",
|
|
5825
|
-
"setSocketKeepAlive"
|
|
5826
|
-
].forEach(function(method) {
|
|
5827
|
-
RedirectableRequest.prototype[method] = function(a, b) {
|
|
5828
|
-
return this._currentRequest[method](a, b);
|
|
5829
|
-
};
|
|
5830
|
-
});
|
|
5831
|
-
["aborted", "connection", "socket"].forEach(function(property) {
|
|
5832
|
-
Object.defineProperty(RedirectableRequest.prototype, property, {
|
|
5833
|
-
get: function() {
|
|
5834
|
-
return this._currentRequest[property];
|
|
5835
|
-
}
|
|
5836
|
-
});
|
|
5837
|
-
});
|
|
5838
|
-
RedirectableRequest.prototype._sanitizeOptions = function(options) {
|
|
5839
|
-
if (!options.headers) {
|
|
5840
|
-
options.headers = {};
|
|
5841
|
-
}
|
|
5842
|
-
if (!isArray(options.sensitiveHeaders)) {
|
|
5843
|
-
options.sensitiveHeaders = [];
|
|
5844
|
-
}
|
|
5845
|
-
if (options.host) {
|
|
5846
|
-
if (!options.hostname) {
|
|
5847
|
-
options.hostname = options.host;
|
|
5848
|
-
}
|
|
5849
|
-
delete options.host;
|
|
5850
|
-
}
|
|
5851
|
-
if (!options.pathname && options.path) {
|
|
5852
|
-
var searchPos = options.path.indexOf("?");
|
|
5853
|
-
if (searchPos < 0) {
|
|
5854
|
-
options.pathname = options.path;
|
|
5855
|
-
} else {
|
|
5856
|
-
options.pathname = options.path.substring(0, searchPos);
|
|
5857
|
-
options.search = options.path.substring(searchPos);
|
|
5858
|
-
}
|
|
5859
|
-
}
|
|
5860
|
-
};
|
|
5861
|
-
RedirectableRequest.prototype._performRequest = function() {
|
|
5862
|
-
var protocol = this._options.protocol;
|
|
5863
|
-
var nativeProtocol = this._options.nativeProtocols[protocol];
|
|
5864
|
-
if (!nativeProtocol) {
|
|
5865
|
-
throw new TypeError("Unsupported protocol " + protocol);
|
|
5866
|
-
}
|
|
5867
|
-
if (this._options.agents) {
|
|
5868
|
-
var scheme = protocol.slice(0, -1);
|
|
5869
|
-
this._options.agent = this._options.agents[scheme];
|
|
5870
|
-
}
|
|
5871
|
-
var request = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse);
|
|
5872
|
-
request._redirectable = this;
|
|
5873
|
-
for (var event of events) {
|
|
5874
|
-
request.on(event, eventHandlers[event]);
|
|
5875
|
-
}
|
|
5876
|
-
this._currentUrl = /^\//.test(this._options.path) ? url.format(this._options) : (
|
|
5877
|
-
// When making a request to a proxy, […]
|
|
5878
|
-
// a client MUST send the target URI in absolute-form […].
|
|
5879
|
-
this._options.path
|
|
5880
|
-
);
|
|
5881
|
-
if (this._isRedirect) {
|
|
5882
|
-
var i = 0;
|
|
5883
|
-
var self = this;
|
|
5884
|
-
var buffers = this._requestBodyBuffers;
|
|
5885
|
-
(function writeNext(error) {
|
|
5886
|
-
if (request === self._currentRequest) {
|
|
5887
|
-
if (error) {
|
|
5888
|
-
self.emit("error", error);
|
|
5889
|
-
} else if (i < buffers.length) {
|
|
5890
|
-
var buffer = buffers[i++];
|
|
5891
|
-
if (!request.finished) {
|
|
5892
|
-
request.write(buffer.data, buffer.encoding, writeNext);
|
|
5893
|
-
}
|
|
5894
|
-
} else if (self._ended) {
|
|
5895
|
-
request.end();
|
|
5896
|
-
}
|
|
5897
|
-
}
|
|
5898
|
-
})();
|
|
5899
|
-
}
|
|
5900
|
-
};
|
|
5901
|
-
RedirectableRequest.prototype._processResponse = function(response) {
|
|
5902
|
-
var statusCode = response.statusCode;
|
|
5903
|
-
if (this._options.trackRedirects) {
|
|
5904
|
-
this._redirects.push({
|
|
5905
|
-
url: this._currentUrl,
|
|
5906
|
-
headers: response.headers,
|
|
5907
|
-
statusCode
|
|
5908
|
-
});
|
|
5909
|
-
}
|
|
5910
|
-
var location = response.headers.location;
|
|
5911
|
-
if (!location || this._options.followRedirects === false || statusCode < 300 || statusCode >= 400) {
|
|
5912
|
-
response.responseUrl = this._currentUrl;
|
|
5913
|
-
response.redirects = this._redirects;
|
|
5914
|
-
this.emit("response", response);
|
|
5915
|
-
this._requestBodyBuffers = [];
|
|
5916
|
-
return;
|
|
5917
|
-
}
|
|
5918
|
-
destroyRequest(this._currentRequest);
|
|
5919
|
-
response.destroy();
|
|
5920
|
-
if (++this._redirectCount > this._options.maxRedirects) {
|
|
5921
|
-
throw new TooManyRedirectsError();
|
|
5922
|
-
}
|
|
5923
|
-
var requestHeaders;
|
|
5924
|
-
var beforeRedirect = this._options.beforeRedirect;
|
|
5925
|
-
if (beforeRedirect) {
|
|
5926
|
-
requestHeaders = Object.assign({
|
|
5927
|
-
// The Host header was set by nativeProtocol.request
|
|
5928
|
-
Host: response.req.getHeader("host")
|
|
5929
|
-
}, this._options.headers);
|
|
5930
|
-
}
|
|
5931
|
-
var method = this._options.method;
|
|
5932
|
-
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || // RFC7231§6.4.4: The 303 (See Other) status code indicates that
|
|
5933
|
-
// the server is redirecting the user agent to a different resource […]
|
|
5934
|
-
// A user agent can perform a retrieval request targeting that URI
|
|
5935
|
-
// (a GET or HEAD request if using HTTP) […]
|
|
5936
|
-
statusCode === 303 && !/^(?:GET|HEAD)$/.test(this._options.method)) {
|
|
5937
|
-
this._options.method = "GET";
|
|
5938
|
-
this._requestBodyBuffers = [];
|
|
5939
|
-
removeMatchingHeaders(/^content-/i, this._options.headers);
|
|
5940
|
-
}
|
|
5941
|
-
var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
|
|
5942
|
-
var currentUrlParts = parseUrl(this._currentUrl);
|
|
5943
|
-
var currentHost = currentHostHeader || currentUrlParts.host;
|
|
5944
|
-
var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url.format(Object.assign(currentUrlParts, { host: currentHost }));
|
|
5945
|
-
var redirectUrl = resolveUrl(location, currentUrl);
|
|
5946
|
-
debug("redirecting to", redirectUrl.href);
|
|
5947
|
-
this._isRedirect = true;
|
|
5948
|
-
spreadUrlObject(redirectUrl, this._options);
|
|
5949
|
-
if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
|
|
5950
|
-
removeMatchingHeaders(this._headerFilter, this._options.headers);
|
|
5951
|
-
}
|
|
5952
|
-
if (isFunction(beforeRedirect)) {
|
|
5953
|
-
var responseDetails = {
|
|
5954
|
-
headers: response.headers,
|
|
5955
|
-
statusCode
|
|
5956
|
-
};
|
|
5957
|
-
var requestDetails = {
|
|
5958
|
-
url: currentUrl,
|
|
5959
|
-
method,
|
|
5960
|
-
headers: requestHeaders
|
|
5961
|
-
};
|
|
5962
|
-
beforeRedirect(this._options, responseDetails, requestDetails);
|
|
5963
|
-
this._sanitizeOptions(this._options);
|
|
5964
|
-
}
|
|
5965
|
-
this._performRequest();
|
|
5966
|
-
};
|
|
5967
|
-
function wrap(protocols) {
|
|
5968
|
-
var exports2 = {
|
|
5969
|
-
maxRedirects: 21,
|
|
5970
|
-
maxBodyLength: 10 * 1024 * 1024
|
|
5971
|
-
};
|
|
5972
|
-
var nativeProtocols = {};
|
|
5973
|
-
Object.keys(protocols).forEach(function(scheme) {
|
|
5974
|
-
var protocol = scheme + ":";
|
|
5975
|
-
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
|
|
5976
|
-
var wrappedProtocol = exports2[scheme] = Object.create(nativeProtocol);
|
|
5977
|
-
function request(input, options, callback) {
|
|
5978
|
-
if (isURL(input)) {
|
|
5979
|
-
input = spreadUrlObject(input);
|
|
5980
|
-
} else if (isString(input)) {
|
|
5981
|
-
input = spreadUrlObject(parseUrl(input));
|
|
5982
|
-
} else {
|
|
5983
|
-
callback = options;
|
|
5984
|
-
options = validateUrl(input);
|
|
5985
|
-
input = { protocol };
|
|
5986
|
-
}
|
|
5987
|
-
if (isFunction(options)) {
|
|
5988
|
-
callback = options;
|
|
5989
|
-
options = null;
|
|
5990
|
-
}
|
|
5991
|
-
options = Object.assign({
|
|
5992
|
-
maxRedirects: exports2.maxRedirects,
|
|
5993
|
-
maxBodyLength: exports2.maxBodyLength
|
|
5994
|
-
}, input, options);
|
|
5995
|
-
options.nativeProtocols = nativeProtocols;
|
|
5996
|
-
if (!isString(options.host) && !isString(options.hostname)) {
|
|
5997
|
-
options.hostname = "::1";
|
|
5998
|
-
}
|
|
5999
|
-
assert.equal(options.protocol, protocol, "protocol mismatch");
|
|
6000
|
-
debug("options", options);
|
|
6001
|
-
return new RedirectableRequest(options, callback);
|
|
6002
|
-
}
|
|
6003
|
-
function get(input, options, callback) {
|
|
6004
|
-
var wrappedRequest = wrappedProtocol.request(input, options, callback);
|
|
6005
|
-
wrappedRequest.end();
|
|
6006
|
-
return wrappedRequest;
|
|
6007
|
-
}
|
|
6008
|
-
Object.defineProperties(wrappedProtocol, {
|
|
6009
|
-
request: { value: request, configurable: true, enumerable: true, writable: true },
|
|
6010
|
-
get: { value: get, configurable: true, enumerable: true, writable: true }
|
|
6011
|
-
});
|
|
6012
|
-
});
|
|
6013
|
-
return exports2;
|
|
6014
|
-
}
|
|
6015
|
-
function noop() {
|
|
6016
|
-
}
|
|
6017
|
-
function parseUrl(input) {
|
|
6018
|
-
var parsed;
|
|
6019
|
-
if (useNativeURL) {
|
|
6020
|
-
parsed = new URL2(input);
|
|
6021
|
-
} else {
|
|
6022
|
-
parsed = validateUrl(url.parse(input));
|
|
6023
|
-
if (!isString(parsed.protocol)) {
|
|
6024
|
-
throw new InvalidUrlError({ input });
|
|
6025
|
-
}
|
|
6026
|
-
}
|
|
6027
|
-
return parsed;
|
|
6028
|
-
}
|
|
6029
|
-
function resolveUrl(relative, base) {
|
|
6030
|
-
return useNativeURL ? new URL2(relative, base) : parseUrl(url.resolve(base, relative));
|
|
6031
|
-
}
|
|
6032
|
-
function validateUrl(input) {
|
|
6033
|
-
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
6034
|
-
throw new InvalidUrlError({ input: input.href || input });
|
|
6035
|
-
}
|
|
6036
|
-
if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) {
|
|
6037
|
-
throw new InvalidUrlError({ input: input.href || input });
|
|
6038
|
-
}
|
|
6039
|
-
return input;
|
|
6040
|
-
}
|
|
6041
|
-
function spreadUrlObject(urlObject, target) {
|
|
6042
|
-
var spread = target || {};
|
|
6043
|
-
for (var key of preservedUrlFields) {
|
|
6044
|
-
spread[key] = urlObject[key];
|
|
6045
|
-
}
|
|
6046
|
-
if (spread.hostname.startsWith("[")) {
|
|
6047
|
-
spread.hostname = spread.hostname.slice(1, -1);
|
|
6048
|
-
}
|
|
6049
|
-
if (spread.port !== "") {
|
|
6050
|
-
spread.port = Number(spread.port);
|
|
6051
|
-
}
|
|
6052
|
-
spread.path = spread.search ? spread.pathname + spread.search : spread.pathname;
|
|
6053
|
-
return spread;
|
|
6054
|
-
}
|
|
6055
|
-
function removeMatchingHeaders(regex, headers) {
|
|
6056
|
-
var lastValue;
|
|
6057
|
-
for (var header in headers) {
|
|
6058
|
-
if (regex.test(header)) {
|
|
6059
|
-
lastValue = headers[header];
|
|
6060
|
-
delete headers[header];
|
|
6061
|
-
}
|
|
6062
|
-
}
|
|
6063
|
-
return lastValue === null || typeof lastValue === "undefined" ? void 0 : String(lastValue).trim();
|
|
6064
|
-
}
|
|
6065
|
-
function createErrorType(code, message, baseClass) {
|
|
6066
|
-
function CustomError(properties) {
|
|
6067
|
-
if (isFunction(Error.captureStackTrace)) {
|
|
6068
|
-
Error.captureStackTrace(this, this.constructor);
|
|
6069
|
-
}
|
|
6070
|
-
Object.assign(this, properties || {});
|
|
6071
|
-
this.code = code;
|
|
6072
|
-
this.message = this.cause ? message + ": " + this.cause.message : message;
|
|
6073
|
-
}
|
|
6074
|
-
CustomError.prototype = new (baseClass || Error)();
|
|
6075
|
-
Object.defineProperties(CustomError.prototype, {
|
|
6076
|
-
constructor: {
|
|
6077
|
-
value: CustomError,
|
|
6078
|
-
enumerable: false
|
|
6079
|
-
},
|
|
6080
|
-
name: {
|
|
6081
|
-
value: "Error [" + code + "]",
|
|
6082
|
-
enumerable: false
|
|
6083
|
-
}
|
|
6084
|
-
});
|
|
6085
|
-
return CustomError;
|
|
6086
|
-
}
|
|
6087
|
-
function destroyRequest(request, error) {
|
|
6088
|
-
for (var event of events) {
|
|
6089
|
-
request.removeListener(event, eventHandlers[event]);
|
|
6090
|
-
}
|
|
6091
|
-
request.on("error", noop);
|
|
6092
|
-
request.destroy(error);
|
|
6093
|
-
}
|
|
6094
|
-
function isSubdomain(subdomain, domain) {
|
|
6095
|
-
assert(isString(subdomain) && isString(domain));
|
|
6096
|
-
var dot = subdomain.length - domain.length - 1;
|
|
6097
|
-
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
|
6098
|
-
}
|
|
6099
|
-
function isArray(value) {
|
|
6100
|
-
return value instanceof Array;
|
|
6101
|
-
}
|
|
6102
|
-
function isString(value) {
|
|
6103
|
-
return typeof value === "string" || value instanceof String;
|
|
6104
|
-
}
|
|
6105
|
-
function isFunction(value) {
|
|
6106
|
-
return typeof value === "function";
|
|
6107
|
-
}
|
|
6108
|
-
function isBuffer(value) {
|
|
6109
|
-
return typeof value === "object" && "length" in value;
|
|
6110
|
-
}
|
|
6111
|
-
function isURL(value) {
|
|
6112
|
-
return URL2 && value instanceof URL2;
|
|
6113
|
-
}
|
|
6114
|
-
function escapeRegex(regex) {
|
|
6115
|
-
return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
|
|
6116
|
-
}
|
|
6117
|
-
module.exports = wrap({ http, https });
|
|
6118
|
-
module.exports.wrap = wrap;
|
|
6119
|
-
}
|
|
6120
|
-
});
|
|
6121
|
-
|
|
6122
4847
|
// ../../node_modules/events-universal/default.js
|
|
6123
4848
|
var require_default = __commonJS({
|
|
6124
4849
|
"../../node_modules/events-universal/default.js"(exports, module) {
|
|
@@ -7244,7 +5969,7 @@ var require_streamx = __commonJS({
|
|
|
7244
5969
|
}
|
|
7245
5970
|
}
|
|
7246
5971
|
};
|
|
7247
|
-
var
|
|
5972
|
+
var Readable2 = class _Readable extends Stream {
|
|
7248
5973
|
constructor(opts) {
|
|
7249
5974
|
super(opts);
|
|
7250
5975
|
this._duplexState |= OPENING | WRITE_DONE | READ_READ_AHEAD;
|
|
@@ -7261,7 +5986,7 @@ var require_streamx = __commonJS({
|
|
|
7261
5986
|
fn().then((src) => {
|
|
7262
5987
|
if (src === null) return out.end();
|
|
7263
5988
|
if (out.destroying) return;
|
|
7264
|
-
|
|
5989
|
+
pipeline2(src, out, noop);
|
|
7265
5990
|
}).catch((err) => out.destroy(err));
|
|
7266
5991
|
return out;
|
|
7267
5992
|
}
|
|
@@ -7455,7 +6180,7 @@ var require_streamx = __commonJS({
|
|
|
7455
6180
|
return this;
|
|
7456
6181
|
}
|
|
7457
6182
|
};
|
|
7458
|
-
var Duplex = class extends
|
|
6183
|
+
var Duplex = class extends Readable2 {
|
|
7459
6184
|
// and Writable
|
|
7460
6185
|
constructor(opts) {
|
|
7461
6186
|
super(opts);
|
|
@@ -7548,13 +6273,13 @@ var require_streamx = __commonJS({
|
|
|
7548
6273
|
}
|
|
7549
6274
|
function pipelinePromise(...streams) {
|
|
7550
6275
|
return new Promise((resolve3, reject) => {
|
|
7551
|
-
return
|
|
6276
|
+
return pipeline2(...streams, (err) => {
|
|
7552
6277
|
if (err) return reject(err);
|
|
7553
6278
|
resolve3();
|
|
7554
6279
|
});
|
|
7555
6280
|
});
|
|
7556
6281
|
}
|
|
7557
|
-
function
|
|
6282
|
+
function pipeline2(stream, ...streams) {
|
|
7558
6283
|
const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
|
|
7559
6284
|
const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
|
|
7560
6285
|
if (all.length < 2) throw StreamError.BAD_ARGUMENT("Pipeline requires at least 2 streams");
|
|
@@ -7652,7 +6377,7 @@ var require_streamx = __commonJS({
|
|
|
7652
6377
|
return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
|
|
7653
6378
|
}
|
|
7654
6379
|
module.exports = {
|
|
7655
|
-
pipeline,
|
|
6380
|
+
pipeline: pipeline2,
|
|
7656
6381
|
pipelinePromise,
|
|
7657
6382
|
isStream,
|
|
7658
6383
|
isStreamx,
|
|
@@ -7664,7 +6389,7 @@ var require_streamx = __commonJS({
|
|
|
7664
6389
|
getStreamError,
|
|
7665
6390
|
Stream,
|
|
7666
6391
|
Writable,
|
|
7667
|
-
Readable,
|
|
6392
|
+
Readable: Readable2,
|
|
7668
6393
|
Duplex,
|
|
7669
6394
|
Transform,
|
|
7670
6395
|
// Export PassThrough for compatibility with Node.js core's stream module
|
|
@@ -7673,9 +6398,9 @@ var require_streamx = __commonJS({
|
|
|
7673
6398
|
}
|
|
7674
6399
|
});
|
|
7675
6400
|
|
|
7676
|
-
// ../../node_modules/
|
|
6401
|
+
// ../../node_modules/@sparticuz/chromium/node_modules/tar-stream/headers.js
|
|
7677
6402
|
var require_headers = __commonJS({
|
|
7678
|
-
"../../node_modules/
|
|
6403
|
+
"../../node_modules/@sparticuz/chromium/node_modules/tar-stream/headers.js"(exports) {
|
|
7679
6404
|
var b4a = require_b4a();
|
|
7680
6405
|
var ZEROS = "0000000000000000000";
|
|
7681
6406
|
var SEVENS = "7777777777777777777";
|
|
@@ -7933,10 +6658,10 @@ var require_headers = __commonJS({
|
|
|
7933
6658
|
}
|
|
7934
6659
|
});
|
|
7935
6660
|
|
|
7936
|
-
// ../../node_modules/
|
|
6661
|
+
// ../../node_modules/@sparticuz/chromium/node_modules/tar-stream/extract.js
|
|
7937
6662
|
var require_extract = __commonJS({
|
|
7938
|
-
"../../node_modules/
|
|
7939
|
-
var { Writable, Readable, getStreamError } = require_streamx();
|
|
6663
|
+
"../../node_modules/@sparticuz/chromium/node_modules/tar-stream/extract.js"(exports, module) {
|
|
6664
|
+
var { Writable, Readable: Readable2, getStreamError } = require_streamx();
|
|
7940
6665
|
var FIFO = require_fast_fifo();
|
|
7941
6666
|
var b4a = require_b4a();
|
|
7942
6667
|
var headers = require_headers();
|
|
@@ -7983,7 +6708,7 @@ var require_extract = __commonJS({
|
|
|
7983
6708
|
return buf.subarray(this._offset, this._offset += size);
|
|
7984
6709
|
}
|
|
7985
6710
|
};
|
|
7986
|
-
var Source = class extends
|
|
6711
|
+
var Source = class extends Readable2 {
|
|
7987
6712
|
constructor(self, header, offset) {
|
|
7988
6713
|
super();
|
|
7989
6714
|
this.header = header;
|
|
@@ -8267,9 +6992,9 @@ var require_extract = __commonJS({
|
|
|
8267
6992
|
}
|
|
8268
6993
|
});
|
|
8269
6994
|
|
|
8270
|
-
// ../../node_modules/
|
|
6995
|
+
// ../../node_modules/@sparticuz/chromium/node_modules/tar-stream/constants.js
|
|
8271
6996
|
var require_constants = __commonJS({
|
|
8272
|
-
"../../node_modules/
|
|
6997
|
+
"../../node_modules/@sparticuz/chromium/node_modules/tar-stream/constants.js"(exports, module) {
|
|
8273
6998
|
var constants = {
|
|
8274
6999
|
// just for envs without fs
|
|
8275
7000
|
S_IFMT: 61440,
|
|
@@ -8287,10 +7012,10 @@ var require_constants = __commonJS({
|
|
|
8287
7012
|
}
|
|
8288
7013
|
});
|
|
8289
7014
|
|
|
8290
|
-
// ../../node_modules/
|
|
7015
|
+
// ../../node_modules/@sparticuz/chromium/node_modules/tar-stream/pack.js
|
|
8291
7016
|
var require_pack = __commonJS({
|
|
8292
|
-
"../../node_modules/
|
|
8293
|
-
var { Readable, Writable, getStreamError } = require_streamx();
|
|
7017
|
+
"../../node_modules/@sparticuz/chromium/node_modules/tar-stream/pack.js"(exports, module) {
|
|
7018
|
+
var { Readable: Readable2, Writable, getStreamError } = require_streamx();
|
|
8294
7019
|
var b4a = require_b4a();
|
|
8295
7020
|
var constants = require_constants();
|
|
8296
7021
|
var headers = require_headers();
|
|
@@ -8383,7 +7108,7 @@ var require_pack = __commonJS({
|
|
|
8383
7108
|
cb();
|
|
8384
7109
|
}
|
|
8385
7110
|
};
|
|
8386
|
-
var Pack = class extends
|
|
7111
|
+
var Pack = class extends Readable2 {
|
|
8387
7112
|
constructor(opts) {
|
|
8388
7113
|
super(opts);
|
|
8389
7114
|
this._drain = noop;
|
|
@@ -8521,9 +7246,9 @@ var require_pack = __commonJS({
|
|
|
8521
7246
|
}
|
|
8522
7247
|
});
|
|
8523
7248
|
|
|
8524
|
-
// ../../node_modules/
|
|
7249
|
+
// ../../node_modules/@sparticuz/chromium/node_modules/tar-stream/index.js
|
|
8525
7250
|
var require_tar_stream = __commonJS({
|
|
8526
|
-
"../../node_modules/
|
|
7251
|
+
"../../node_modules/@sparticuz/chromium/node_modules/tar-stream/index.js"(exports) {
|
|
8527
7252
|
exports.extract = require_extract();
|
|
8528
7253
|
exports.pack = require_pack();
|
|
8529
7254
|
}
|
|
@@ -8761,9 +7486,9 @@ var require_pump = __commonJS({
|
|
|
8761
7486
|
}
|
|
8762
7487
|
});
|
|
8763
7488
|
|
|
8764
|
-
// ../../node_modules/tar-fs/index.js
|
|
7489
|
+
// ../../node_modules/@sparticuz/chromium/node_modules/tar-fs/index.js
|
|
8765
7490
|
var require_tar_fs = __commonJS({
|
|
8766
|
-
"../../node_modules/tar-fs/index.js"(exports) {
|
|
7491
|
+
"../../node_modules/@sparticuz/chromium/node_modules/tar-fs/index.js"(exports) {
|
|
8767
7492
|
var tar = require_tar_stream();
|
|
8768
7493
|
var pump = require_pump();
|
|
8769
7494
|
var fs2 = __require("fs");
|
|
@@ -9089,10 +7814,9 @@ var require_tar_fs = __commonJS({
|
|
|
9089
7814
|
}
|
|
9090
7815
|
}
|
|
9091
7816
|
});
|
|
9092
|
-
var
|
|
7817
|
+
var import_tar_fs, setupLambdaEnvironment, isValidUrl, isRunningInAmazonLinux2023, downloadAndExtract;
|
|
9093
7818
|
var init_helper = __esm({
|
|
9094
|
-
"../../node_modules/@sparticuz/chromium/build/
|
|
9095
|
-
import_follow_redirects = __toESM(require_follow_redirects());
|
|
7819
|
+
"../../node_modules/@sparticuz/chromium/build/helper.js"() {
|
|
9096
7820
|
import_tar_fs = __toESM(require_tar_fs());
|
|
9097
7821
|
setupLambdaEnvironment = (baseLibPath) => {
|
|
9098
7822
|
process.env["FONTCONFIG_PATH"] ??= join(tmpdir(), "fonts");
|
|
@@ -9108,7 +7832,13 @@ var init_helper = __esm({
|
|
|
9108
7832
|
};
|
|
9109
7833
|
isValidUrl = (input) => {
|
|
9110
7834
|
try {
|
|
9111
|
-
|
|
7835
|
+
const url = new URL(input);
|
|
7836
|
+
if (url.protocol === "https:")
|
|
7837
|
+
return true;
|
|
7838
|
+
if (url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]")) {
|
|
7839
|
+
return true;
|
|
7840
|
+
}
|
|
7841
|
+
return false;
|
|
9112
7842
|
} catch {
|
|
9113
7843
|
return false;
|
|
9114
7844
|
}
|
|
@@ -9126,43 +7856,41 @@ var init_helper = __esm({
|
|
|
9126
7856
|
return false;
|
|
9127
7857
|
};
|
|
9128
7858
|
downloadAndExtract = async (url) => {
|
|
9129
|
-
const getOptions = new URL(url);
|
|
9130
|
-
getOptions.maxBodyLength = 60 * 1024 * 1024;
|
|
9131
7859
|
const destDir = join(tmpdir(), "chromium-pack");
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
7860
|
+
const response = await fetch(url, {
|
|
7861
|
+
redirect: "follow",
|
|
7862
|
+
signal: AbortSignal.timeout(3e5)
|
|
7863
|
+
});
|
|
7864
|
+
if (!response.ok) {
|
|
7865
|
+
throw new Error(`Unexpected status code: ${String(response.status)}.`);
|
|
7866
|
+
}
|
|
7867
|
+
if (!response.body) {
|
|
7868
|
+
throw new Error("Response body is empty.");
|
|
7869
|
+
}
|
|
7870
|
+
try {
|
|
7871
|
+
await pipeline(Readable.fromWeb(response.body), (0, import_tar_fs.extract)(destDir));
|
|
7872
|
+
} catch (error) {
|
|
7873
|
+
await new Promise((resolve3) => {
|
|
9135
7874
|
rm(destDir, { force: true, recursive: true }, () => {
|
|
9136
|
-
|
|
7875
|
+
resolve3();
|
|
9137
7876
|
});
|
|
9138
|
-
};
|
|
9139
|
-
extractObj.once("error", cleanupOnError);
|
|
9140
|
-
extractObj.once("finish", () => {
|
|
9141
|
-
resolve3(destDir);
|
|
9142
|
-
});
|
|
9143
|
-
const req = import_follow_redirects.default.https.get(url, (response) => {
|
|
9144
|
-
if (response.statusCode !== 200) {
|
|
9145
|
-
reject(new Error(`Unexpected status code: ${response.statusCode?.toFixed(0) ?? "UNK"}.`));
|
|
9146
|
-
return;
|
|
9147
|
-
}
|
|
9148
|
-
response.pipe(extractObj);
|
|
9149
|
-
response.once("error", cleanupOnError);
|
|
9150
|
-
});
|
|
9151
|
-
req.once("error", cleanupOnError);
|
|
9152
|
-
req.setTimeout(60 * 1e3, () => {
|
|
9153
|
-
req.destroy();
|
|
9154
|
-
cleanupOnError(new Error("Request timeout"));
|
|
9155
7877
|
});
|
|
9156
|
-
|
|
7878
|
+
throw error;
|
|
7879
|
+
}
|
|
7880
|
+
return destDir;
|
|
9157
7881
|
};
|
|
9158
7882
|
}
|
|
9159
7883
|
});
|
|
9160
|
-
var import_tar_fs2, inflate;
|
|
7884
|
+
var import_tar_fs2, ARCHIVE_EXTENSION_REGEX, TAR_EXTENSION_REGEX, BROTLI_EXTENSION_REGEX, GZIP_EXTENSION_REGEX, inflate;
|
|
9161
7885
|
var init_lambdafs = __esm({
|
|
9162
|
-
"../../node_modules/@sparticuz/chromium/build/
|
|
7886
|
+
"../../node_modules/@sparticuz/chromium/build/lambdafs.js"() {
|
|
9163
7887
|
import_tar_fs2 = __toESM(require_tar_fs());
|
|
7888
|
+
ARCHIVE_EXTENSION_REGEX = /\.(?:t(?:ar(?:\.(?:br|gz))?|br|gz)|br|gz)$/i;
|
|
7889
|
+
TAR_EXTENSION_REGEX = /\.t(?:ar(?:\.(?:br|gz))?|br|gz)$/i;
|
|
7890
|
+
BROTLI_EXTENSION_REGEX = /br$/i;
|
|
7891
|
+
GZIP_EXTENSION_REGEX = /gz$/i;
|
|
9164
7892
|
inflate = (filePath) => {
|
|
9165
|
-
const output = filePath.includes("swiftshader") ? tmpdir() : join(tmpdir(), basename(filePath).replace(
|
|
7893
|
+
const output = filePath.includes("swiftshader") ? tmpdir() : join(tmpdir(), basename(filePath).replace(ARCHIVE_EXTENSION_REGEX, ""));
|
|
9166
7894
|
return new Promise((resolve3, reject) => {
|
|
9167
7895
|
if (filePath.includes("swiftshader")) {
|
|
9168
7896
|
if (existsSync(`${output}/libGLESv2.so`)) {
|
|
@@ -9173,9 +7901,9 @@ var init_lambdafs = __esm({
|
|
|
9173
7901
|
resolve3(output);
|
|
9174
7902
|
return;
|
|
9175
7903
|
}
|
|
9176
|
-
const isBrotli =
|
|
9177
|
-
const isGzip =
|
|
9178
|
-
const isTar =
|
|
7904
|
+
const isBrotli = BROTLI_EXTENSION_REGEX.test(filePath);
|
|
7905
|
+
const isGzip = GZIP_EXTENSION_REGEX.test(filePath);
|
|
7906
|
+
const isTar = TAR_EXTENSION_REGEX.test(filePath);
|
|
9179
7907
|
const highWaterMark = 2 ** 22;
|
|
9180
7908
|
const source = createReadStream(filePath, { highWaterMark });
|
|
9181
7909
|
let target;
|
|
@@ -9207,24 +7935,28 @@ var init_lambdafs = __esm({
|
|
|
9207
7935
|
}
|
|
9208
7936
|
});
|
|
9209
7937
|
function getBinPath() {
|
|
9210
|
-
return join(dirname(fileURLToPath(import.meta.url)), "..", "
|
|
7938
|
+
return join(dirname(fileURLToPath(import.meta.url)), "..", "bin");
|
|
9211
7939
|
}
|
|
9212
|
-
var
|
|
9213
|
-
"../../node_modules/@sparticuz/chromium/build/
|
|
7940
|
+
var init_paths = __esm({
|
|
7941
|
+
"../../node_modules/@sparticuz/chromium/build/paths.js"() {
|
|
9214
7942
|
}
|
|
9215
7943
|
});
|
|
9216
7944
|
|
|
9217
|
-
// ../../node_modules/@sparticuz/chromium/build/
|
|
9218
|
-
var
|
|
9219
|
-
__export(
|
|
9220
|
-
default: () =>
|
|
7945
|
+
// ../../node_modules/@sparticuz/chromium/build/index.js
|
|
7946
|
+
var build_exports = {};
|
|
7947
|
+
__export(build_exports, {
|
|
7948
|
+
default: () => build_default,
|
|
7949
|
+
inflate: () => inflate,
|
|
7950
|
+
setupLambdaEnvironment: () => setupLambdaEnvironment
|
|
9221
7951
|
});
|
|
9222
|
-
var nodeMajorVersion, Chromium,
|
|
9223
|
-
var
|
|
9224
|
-
"../../node_modules/@sparticuz/chromium/build/
|
|
7952
|
+
var nodeMajorVersion, Chromium, build_default;
|
|
7953
|
+
var init_build = __esm({
|
|
7954
|
+
"../../node_modules/@sparticuz/chromium/build/index.js"() {
|
|
7955
|
+
init_helper();
|
|
7956
|
+
init_lambdafs();
|
|
7957
|
+
init_paths();
|
|
9225
7958
|
init_helper();
|
|
9226
7959
|
init_lambdafs();
|
|
9227
|
-
init_paths_esm();
|
|
9228
7960
|
nodeMajorVersion = Number.parseInt(process.versions.node.split(".")[0] ?? "");
|
|
9229
7961
|
if (isRunningInAmazonLinux2023(nodeMajorVersion)) {
|
|
9230
7962
|
setupLambdaEnvironment(join(tmpdir(), "al2023", "lib"));
|
|
@@ -9343,7 +8075,7 @@ var init_esm = __esm({
|
|
|
9343
8075
|
}
|
|
9344
8076
|
input ??= getBinPath();
|
|
9345
8077
|
if (!existsSync(input)) {
|
|
9346
|
-
throw new Error(`The input directory "${input}" does not exist.
|
|
8078
|
+
throw new Error(`The input directory "${input}" does not exist. If you are using a bundler (esbuild, webpack, etc.), you must externalize @sparticuz/chromium so it is not relocated. See: https://github.com/Sparticuz/chromium#bundler-configuration`);
|
|
9347
8079
|
}
|
|
9348
8080
|
const promises = [
|
|
9349
8081
|
inflate(join(input, "chromium.br")),
|
|
@@ -9357,7 +8089,7 @@ var init_esm = __esm({
|
|
|
9357
8089
|
return result.shift();
|
|
9358
8090
|
}
|
|
9359
8091
|
};
|
|
9360
|
-
|
|
8092
|
+
build_default = Chromium;
|
|
9361
8093
|
}
|
|
9362
8094
|
});
|
|
9363
8095
|
|
|
@@ -9464,7 +8196,7 @@ ${bundledCode}
|
|
|
9464
8196
|
async function captureScreenshot(html, viewport = { width: 1280, height: 800 }) {
|
|
9465
8197
|
try {
|
|
9466
8198
|
const puppeteer = await import('puppeteer-core');
|
|
9467
|
-
const chromium = await Promise.resolve().then(() => (
|
|
8199
|
+
const chromium = await Promise.resolve().then(() => (init_build(), build_exports));
|
|
9468
8200
|
const launchOptions = {
|
|
9469
8201
|
args: chromium.default.args,
|
|
9470
8202
|
defaultViewport: viewport,
|
|
@@ -9474,7 +8206,9 @@ async function captureScreenshot(html, viewport = { width: 1280, height: 800 })
|
|
|
9474
8206
|
const browser = await puppeteer.default.launch(launchOptions);
|
|
9475
8207
|
try {
|
|
9476
8208
|
const page = await browser.newPage();
|
|
9477
|
-
await page.setContent(html, { waitUntil: "
|
|
8209
|
+
await page.setContent(html, { waitUntil: "load", timeout: 15e3 });
|
|
8210
|
+
await page.waitForNetworkIdle({ idleTime: 500, timeout: 15e3 }).catch(() => {
|
|
8211
|
+
});
|
|
9478
8212
|
await page.waitForSelector("#root > *", { timeout: 1e4 }).catch(() => {
|
|
9479
8213
|
});
|
|
9480
8214
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
@@ -10873,11 +9607,11 @@ var stateFragments = {
|
|
|
10873
9607
|
axis: "state",
|
|
10874
9608
|
value: "merge",
|
|
10875
9609
|
cacheTier: "axisDelta",
|
|
10876
|
-
promptText: "## State: merge (live entity reconciliation)\n1. Seed `const [items, setItems] = useState(props.items ?? [])
|
|
9610
|
+
promptText: "## State: merge (live entity reconciliation)\n1. Seed `const [items, setItems] = useState(props.items ?? [])` AND re-seed on prop change: `useEffect(() => setItems(props.items ?? []), [props.items])` \u2014 a `ggui_amend` repaint must move the list.\n2. On stream updates: `setItems(prev => prev.map(it => it.id === event.id ? { ...it, ...event } : it))` \u2014 merge by id, do NOT append.\n3. Memoize derived views (grouping/sorting/filtering) with useMemo.\n4. Per-item actions pass `{ id, ... }` in the payload.\n5. Never push the stream payload into an append-only list unless realtime=append.",
|
|
10877
9611
|
boilerplateMarker: [
|
|
10878
9612
|
"",
|
|
10879
9613
|
" // \u2500\u2500 Live entity state (merge-by-id) \u2500\u2500",
|
|
10880
|
-
" // useState(props.items ?? []); merge stream events by item.id; never append.",
|
|
9614
|
+
" // useState(props.items ?? []); re-seed via useEffect on [props.items]; merge stream events by item.id; never append.",
|
|
10881
9615
|
""
|
|
10882
9616
|
].join("\n")
|
|
10883
9617
|
},
|
|
@@ -10995,13 +9729,13 @@ var realtimeFragments = {
|
|
|
10995
9729
|
axis: "realtime",
|
|
10996
9730
|
value: "merge",
|
|
10997
9731
|
cacheTier: "axisDelta",
|
|
10998
|
-
promptText: "## Realtime: merge\nStream events carry an id; merge into LOCAL STATE. Subscribing alone is not enough \u2014 the local list must update on each event for the DOM to re-render.\n\n```tsx\nconst stream = useStream<UpdateT>('streamName');\nconst [items, setItems] = useState(props.items);\nuseEffect(() => {\n if (!stream.latest) return;\n setItems((prev) => prev.map((it) => it.id === stream.latest!.id ? { ...it, ...stream.latest } : it));\n}, [stream.latest]);\n// Render `items.map(...)` \u2014 NOT props.items, NOT stream.all.\n```\n\nNever append \u2014 stream=merge means the entity already exists locally."
|
|
9732
|
+
promptText: "## Realtime: merge\nStream events carry an id; merge into LOCAL STATE. Subscribing alone is not enough \u2014 the local list must update on each event for the DOM to re-render.\n\n```tsx\nconst stream = useStream<UpdateT>('streamName');\nconst [items, setItems] = useState(props.items);\nuseEffect(() => setItems(props.items), [props.items]); // re-seed on ggui_amend repaint \u2014 props stay the source of truth\nuseEffect(() => {\n if (!stream.latest) return;\n setItems((prev) => prev.map((it) => it.id === stream.latest!.id ? { ...it, ...stream.latest } : it));\n}, [stream.latest]);\n// Render `items.map(...)` \u2014 NOT props.items, NOT stream.all.\n```\n\nNever append \u2014 stream=merge means the entity already exists locally."
|
|
10999
9733
|
},
|
|
11000
9734
|
append: {
|
|
11001
9735
|
axis: "realtime",
|
|
11002
9736
|
value: "append",
|
|
11003
9737
|
cacheTier: "axisDelta",
|
|
11004
|
-
promptText: "## Realtime: append\nStream events are new entities; APPEND to local state. Subscribing alone is not enough \u2014 the local list must update for the DOM to re-render.\n\n```tsx\nconst stream = useStream<EventT>('streamName');\nconst [items, setItems] = useState(props.items);\nuseEffect(() => {\n if (!stream.latest) return;\n setItems((prev) => [...prev, stream.latest!]);\n}, [stream.latest]);\n// Render `items.map(...)` \u2014 NOT props.items, NOT stream.all (which accumulates only post-mount).\n```\n\nUse head for newest-first, tail for chat-style. Cap list length if needed. Do not dedupe unless the contract guarantees at-most-once."
|
|
9738
|
+
promptText: "## Realtime: append\nStream events are new entities; APPEND to local state. Subscribing alone is not enough \u2014 the local list must update for the DOM to re-render.\n\n```tsx\nconst stream = useStream<EventT>('streamName');\nconst [items, setItems] = useState(props.items);\nuseEffect(() => setItems(props.items), [props.items]); // re-seed on ggui_amend repaint \u2014 props stay the source of truth\nuseEffect(() => {\n if (!stream.latest) return;\n setItems((prev) => [...prev, stream.latest!]);\n}, [stream.latest]);\n// Render `items.map(...)` \u2014 NOT props.items, NOT stream.all (which accumulates only post-mount).\n```\n\nUse head for newest-first, tail for chat-style. Cap list length if needed. Do not dedupe unless the contract guarantees at-most-once."
|
|
11005
9739
|
},
|
|
11006
9740
|
status: {
|
|
11007
9741
|
axis: "realtime",
|
|
@@ -11019,7 +9753,7 @@ var realtimeFragments = {
|
|
|
11019
9753
|
axis: "realtime",
|
|
11020
9754
|
value: "mixed",
|
|
11021
9755
|
cacheTier: "axisDelta",
|
|
11022
|
-
promptText: "## Realtime: mixed\nMultiple stream channels with DIFFERENT semantics. Each `streamKinds` entry in the contract maps to one of: merge, append, status, presence. Subscribe + sync to local state PER CHANNEL \u2014 subscribing alone never re-renders the DOM.\n\nExample (chat-interface \u2014 message=append, typing=presence):\n\n```tsx\nconst messages = useStream<MessageT>('message');\nconst typing = useStream<TypingT>('typing');\nconst [messageList, setMessageList] = useState(props.messages);\nconst [typingUsers, setTypingUsers] = useState<Set<string>>(new Set());\n\nuseEffect(() => {\n if (!messages.latest) return;\n setMessageList((prev) => [...prev, messages.latest!]);\n}, [messages.latest]);\n\nuseEffect(() => {\n if (!typing.latest) return;\n setTypingUsers((prev) => {\n const next = new Set(prev);\n if (typing.latest!.active) next.add(typing.latest!.sender);\n else next.delete(typing.latest!.sender);\n return next;\n });\n}, [typing.latest]);\n```\n\nDo NOT treat all events the same. Do NOT skip the local-state sync \u2014 `useStream` alone won't trigger DOM updates of your derived view.",
|
|
9756
|
+
promptText: "## Realtime: mixed\nMultiple stream channels with DIFFERENT semantics. Each `streamKinds` entry in the contract maps to one of: merge, append, status, presence. Subscribe + sync to local state PER CHANNEL \u2014 subscribing alone never re-renders the DOM.\n\nExample (chat-interface \u2014 message=append, typing=presence):\n\n```tsx\nconst messages = useStream<MessageT>('message');\nconst typing = useStream<TypingT>('typing');\nconst [messageList, setMessageList] = useState(props.messages);\nconst [typingUsers, setTypingUsers] = useState<Set<string>>(new Set());\n\nuseEffect(() => setMessageList(props.messages), [props.messages]); // re-seed on ggui_amend repaint\n\nuseEffect(() => {\n if (!messages.latest) return;\n setMessageList((prev) => [...prev, messages.latest!]);\n}, [messages.latest]);\n\nuseEffect(() => {\n if (!typing.latest) return;\n setTypingUsers((prev) => {\n const next = new Set(prev);\n if (typing.latest!.active) next.add(typing.latest!.sender);\n else next.delete(typing.latest!.sender);\n return next;\n });\n}, [typing.latest]);\n```\n\nDo NOT treat all events the same. Do NOT skip the local-state sync \u2014 `useStream` alone won't trigger DOM updates of your derived view.",
|
|
11023
9757
|
boilerplateMarker: [
|
|
11024
9758
|
"",
|
|
11025
9759
|
" // \u2500\u2500 Mixed stream handlers \u2500\u2500",
|
|
@@ -11893,13 +10627,14 @@ A \`DataContract\` declares everything a GguiSession exchanges with the outside
|
|
|
11893
10627
|
|
|
11894
10628
|
## Defensive coding for absent / late-arriving data
|
|
11895
10629
|
|
|
11896
|
-
Props arrive
|
|
10630
|
+
Props arrive at mount and may be partial on first render; later prop changes reach the SAME mounted component via \`ggui_amend\` (in-place repaint) on the live channel. Stream channels start empty and fill over time. Context slots start at their declared default (often \`null\`). **Never assume a field exists before you read it.**
|
|
11897
10631
|
|
|
11898
10632
|
- **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.all, stream.latest, etc.
|
|
11899
10633
|
- **Object access**: optional-chain through nested fields. \`props.user?.name ?? 'Anonymous'\` not \`props.user.name\`.
|
|
11900
10634
|
- **Number ops**: default before arithmetic. \`(props.count ?? 0) + 1\` not \`props.count + 1\`.
|
|
11901
10635
|
- **Stream latest**: \`useStream\` returns \`{latest: T | null, all: T[], isComplete: boolean}\`. The default \`all\` is \`[]\` so it's safe to map; \`latest\` is null until the first frame arrives \u2014 guard before reading \`.foo\`.
|
|
11902
10636
|
- **Stream reconciliation**: when a stream event carries an \`action\` discriminant (e.g. \`create | move | edit | delete\`), the channel is a CRUD feed \u2014 your handler MUST branch on EVERY value: append on \`create\`, drop on \`delete\`, replace-by-id on \`move\` / \`edit\`. Merging only the "edit" case silently loses created and deleted items. Reconcile into the SAME state that seeds from \`props\` (e.g. \`useState(() => props.tasks ?? [])\`) so the seed data and the live feed render as one list \u2014 and handle an event whose id is not yet present (a \`create\` for an unknown item) by inserting it, not ignoring it.
|
|
10637
|
+
- **Props re-sync on repaint**: props the agent owns are the source of truth for display \u2014 prefer rendering DIRECTLY from \`props\` (controlled, no local copy). When local optimistic state genuinely needs a prop seed (a click bumps a count before the agent confirms), it MUST re-sync on prop change \u2014 \`useEffect(() => setCount(props.count ?? 0), [props.count])\` \u2014 or a \`ggui_amend\` repaint applies the new props while the display keeps the stale local value. BAD: \`const [count, setCount] = useState(props.count ?? 0)\` alone. GOOD: the same seed + the one-line re-sync effect.
|
|
11903
10638
|
- **Loading state**: while data is still absent, render \`<Skeleton>\` placeholders \u2014 never a blank screen. \`<Skeleton variant="text" />\` for a text line, \`variant="circle"\` for an avatar slot, default \`rect\` for a block.
|
|
11904
10639
|
- **Empty state**: when a list or results array is empty, render \`<EmptyState title="\u2026" description="\u2026" />\` \u2014 a region that renders nothing when empty looks broken to the user.
|
|
11905
10640
|
|
|
@@ -12027,7 +10762,7 @@ Every value change is mirrored to the host LLM's context automatically (debounce
|
|
|
12027
10762
|
|
|
12028
10763
|
**When NOT to use it.** Local UI state the contract did NOT declare \u2014 \`isDropdownOpen\`, hover flags, animation phase, ephemeral toggles. For those, use a plain \`useState\` directly. The runtime ignores undeclared state.
|
|
12029
10764
|
|
|
12030
|
-
**\`contextSpec\` direction is one-way: client \u2192 agent.** The agent uses \`propsSpec\` (via \`ggui_update\`) and \`streamSpec\` (via the live channel) to push state TO the client. Don't try to write to the agent via \`contextSpec\` \u2014 there is no return path.
|
|
10765
|
+
**\`contextSpec\` direction is one-way: client \u2192 agent.** The agent uses \`propsSpec\` (via \`ggui_amend\` for in-place repaints of this mount, or \`ggui_update\` when it mints a new history card) and \`streamSpec\` (via the live channel) to push state TO the client. Don't try to write to the agent via \`contextSpec\` \u2014 there is no return path.
|
|
12031
10766
|
|
|
12032
10767
|
**Schema mismatches drop silently.** If you set a value that doesn't match the slot's schema (e.g. a string into a \`{type: 'number'}\` slot), the runtime logs a dev \`console.warn\` and skips the post. Make sure your setter calls produce values that match the declared shape.
|
|
12033
10768
|
|
|
@@ -13458,6 +12193,31 @@ function runNoPhantomUseState(input) {
|
|
|
13458
12193
|
}
|
|
13459
12194
|
return issues;
|
|
13460
12195
|
}
|
|
12196
|
+
function runPropSeedNoResync(input) {
|
|
12197
|
+
if (input.compiledCode === null) return [];
|
|
12198
|
+
const src = input.sourceCode;
|
|
12199
|
+
const issues = [];
|
|
12200
|
+
const re = /const\s*\[\s*(\w+)\s*,\s*(\w+)\s*\]\s*=\s*useState(?:<[^>]*>)?\s*\(\s*props\??\.(\w+)/g;
|
|
12201
|
+
for (const m of src.matchAll(re)) {
|
|
12202
|
+
const [full, stateVar, setter, propName] = m;
|
|
12203
|
+
const idx = m.index ?? 0;
|
|
12204
|
+
const after = src.slice(idx + full.length);
|
|
12205
|
+
if (!new RegExp(`\\b${setter}\\s*\\(`).test(after)) continue;
|
|
12206
|
+
const resync = new RegExp(
|
|
12207
|
+
`\\[[^\\[\\]]*props\\??\\.${propName}\\b[^\\[\\]]*\\]`
|
|
12208
|
+
);
|
|
12209
|
+
if (resync.test(src)) continue;
|
|
12210
|
+
issues.push(
|
|
12211
|
+
mkIssue(
|
|
12212
|
+
"universal.prop_seed_no_resync",
|
|
12213
|
+
`useState(props.${propName}) seeds "${stateVar}" and mutates it, but no effect depends on [props.${propName}] \u2014 a ggui_amend repaint pushes new props that never reach this display (#480).`,
|
|
12214
|
+
`Add \`useEffect(() => ${setter}(props.${propName}), [props.${propName}]);\` so agent repaints re-seed the state, or derive the display directly from props.${propName}.`,
|
|
12215
|
+
"warn"
|
|
12216
|
+
)
|
|
12217
|
+
);
|
|
12218
|
+
}
|
|
12219
|
+
return issues;
|
|
12220
|
+
}
|
|
13461
12221
|
var UNIVERSAL_CHECKS = [
|
|
13462
12222
|
{
|
|
13463
12223
|
id: "universal.prop_coverage",
|
|
@@ -13476,6 +12236,12 @@ var UNIVERSAL_CHECKS = [
|
|
|
13476
12236
|
axis: "render",
|
|
13477
12237
|
values: ALL_RENDER_VALUES,
|
|
13478
12238
|
run: runNoPhantomUseState
|
|
12239
|
+
},
|
|
12240
|
+
{
|
|
12241
|
+
id: "universal.prop_seed_no_resync",
|
|
12242
|
+
axis: "render",
|
|
12243
|
+
values: ALL_RENDER_VALUES,
|
|
12244
|
+
run: runPropSeedNoResync
|
|
13479
12245
|
}
|
|
13480
12246
|
];
|
|
13481
12247
|
|
|
@@ -13495,7 +12261,7 @@ function runStateSeededFromProps(input) {
|
|
|
13495
12261
|
mkIssue(
|
|
13496
12262
|
"state.merge.seeded_from_props",
|
|
13497
12263
|
`Entity collection "${e.name}" is not seeded from props \u2014 no useState initializer reads props.${e.name}.`,
|
|
13498
|
-
`Add \`const [${e.name}, set${cap(e.name)}] = useState(props.${e.name});\` so stream/action updates
|
|
12264
|
+
`Add \`const [${e.name}, set${cap(e.name)}] = useState(props.${e.name});\` paired with \`useEffect(() => set${cap(e.name)}(props.${e.name}), [props.${e.name}]);\` so stream/action updates merge into live state AND agent repaints (ggui_amend) re-seed it (#480).`
|
|
13499
12265
|
)
|
|
13500
12266
|
);
|
|
13501
12267
|
}
|
|
@@ -15154,8 +13920,8 @@ async function setupHappyDom() {
|
|
|
15154
13920
|
};
|
|
15155
13921
|
}
|
|
15156
13922
|
const { Window } = await import('happy-dom');
|
|
15157
|
-
const
|
|
15158
|
-
const windowAny = openRecord(
|
|
13923
|
+
const window = new Window({ url: "https://render-check.local" });
|
|
13924
|
+
const windowAny = openRecord(window);
|
|
15159
13925
|
const keys = [
|
|
15160
13926
|
"window",
|
|
15161
13927
|
"document",
|
|
@@ -17026,7 +15792,13 @@ async function runEvalRound(ctx, input) {
|
|
|
17026
15792
|
},
|
|
17027
15793
|
{
|
|
17028
15794
|
provider: mapProviderForEvaluator(evaluationAgent.provider),
|
|
17029
|
-
model: evaluationAgent.model
|
|
15795
|
+
model: evaluationAgent.model,
|
|
15796
|
+
// #484 — thread the coding-agent's routing override
|
|
15797
|
+
// through to the evaluator so its LLM call never falls
|
|
15798
|
+
// back to `process.env` either (the eval calls run
|
|
15799
|
+
// inside the same concurrent generation, so the race is
|
|
15800
|
+
// real here too, not just on the coding turn).
|
|
15801
|
+
routeOverride: evaluationAgent.routeOverride
|
|
17030
15802
|
},
|
|
17031
15803
|
preWarmedContext
|
|
17032
15804
|
) : null,
|
|
@@ -17674,7 +16446,7 @@ async function initSession(input) {
|
|
|
17674
16446
|
await workspace.stage();
|
|
17675
16447
|
await workspace.commit("scaffold: boilerplate");
|
|
17676
16448
|
const systemPrompt = input.systemPromptOverride ?? harness.how.systemPrompt;
|
|
17677
|
-
const codingAgent = createAgent(agents.coding
|
|
16449
|
+
const codingAgent = createAgent(agents.coding);
|
|
17678
16450
|
await codingAgent.warmCache(
|
|
17679
16451
|
agents.coding.model,
|
|
17680
16452
|
systemPrompt,
|
|
@@ -17763,8 +16535,16 @@ async function dispatchGeneration(params) {
|
|
|
17763
16535
|
}
|
|
17764
16536
|
const routerProvider = mapProviderForLLMRouter(params.provider);
|
|
17765
16537
|
const resolvedModel = params.models?.coding ?? params.models?.default ?? params.model;
|
|
17766
|
-
const codingAgent = {
|
|
17767
|
-
|
|
16538
|
+
const codingAgent = {
|
|
16539
|
+
provider: routerProvider,
|
|
16540
|
+
model: resolvedModel,
|
|
16541
|
+
routeOverride: params.routeOverride
|
|
16542
|
+
};
|
|
16543
|
+
const evaluationAgent = params.models?.evaluation ? {
|
|
16544
|
+
provider: routerProvider,
|
|
16545
|
+
model: params.models.evaluation,
|
|
16546
|
+
routeOverride: params.routeOverride
|
|
16547
|
+
} : void 0;
|
|
17768
16548
|
const effectiveContract = params.contract;
|
|
17769
16549
|
const sessionParams = {
|
|
17770
16550
|
userPrompt: params.originalPrompt ?? params.userPrompt,
|