create-cloudflare 2.70.0 → 2.70.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.js +1963 -1621
- package/package.json +9 -9
- package/templates/angular/pages/c3.ts +1 -1
- package/templates/angular/workers/c3.ts +1 -1
package/dist/cli.js
CHANGED
|
@@ -32661,8 +32661,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
32661
32661
|
var pathReservations = () => {
|
|
32662
32662
|
const queues = /* @__PURE__ */ new Map();
|
|
32663
32663
|
const reservations = /* @__PURE__ */ new Map();
|
|
32664
|
-
const { join:
|
|
32665
|
-
const getDirs = (path7) =>
|
|
32664
|
+
const { join: join10 } = path__default["default"];
|
|
32665
|
+
const getDirs = (path7) => join10(path7).split(/[\\/]/).slice(0, -1).reduce((set, path8) => set.length ? set.concat(join10(set[set.length - 1], path8)) : [path8], []);
|
|
32666
32666
|
const running = /* @__PURE__ */ new Set();
|
|
32667
32667
|
const getQueues = (fn) => {
|
|
32668
32668
|
const res = reservations.get(fn);
|
|
@@ -47871,10 +47871,10 @@ var require_stringify2 = __commonJS({
|
|
|
47871
47871
|
replacer = null;
|
|
47872
47872
|
indent2 = EMPTY;
|
|
47873
47873
|
};
|
|
47874
|
-
var
|
|
47874
|
+
var join10 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
|
|
47875
47875
|
var join_content = (inside, value, gap) => {
|
|
47876
47876
|
const comment = process_comments(value, PREFIX_BEFORE, gap + indent2, true);
|
|
47877
|
-
return
|
|
47877
|
+
return join10(comment, inside, gap);
|
|
47878
47878
|
};
|
|
47879
47879
|
var array_stringify = (value, gap) => {
|
|
47880
47880
|
const deeper_gap = gap + indent2;
|
|
@@ -47885,7 +47885,7 @@ var require_stringify2 = __commonJS({
|
|
|
47885
47885
|
if (i !== 0) {
|
|
47886
47886
|
inside += COMMA;
|
|
47887
47887
|
}
|
|
47888
|
-
const before =
|
|
47888
|
+
const before = join10(
|
|
47889
47889
|
after_comma,
|
|
47890
47890
|
process_comments(value, BEFORE(i), deeper_gap),
|
|
47891
47891
|
deeper_gap
|
|
@@ -47895,7 +47895,7 @@ var require_stringify2 = __commonJS({
|
|
|
47895
47895
|
inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
|
|
47896
47896
|
after_comma = process_comments(value, AFTER(i), deeper_gap);
|
|
47897
47897
|
}
|
|
47898
|
-
inside +=
|
|
47898
|
+
inside += join10(
|
|
47899
47899
|
after_comma,
|
|
47900
47900
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
47901
47901
|
deeper_gap
|
|
@@ -47920,7 +47920,7 @@ var require_stringify2 = __commonJS({
|
|
|
47920
47920
|
inside += COMMA;
|
|
47921
47921
|
}
|
|
47922
47922
|
first = false;
|
|
47923
|
-
const before =
|
|
47923
|
+
const before = join10(
|
|
47924
47924
|
after_comma,
|
|
47925
47925
|
process_comments(value, BEFORE(key), deeper_gap),
|
|
47926
47926
|
deeper_gap
|
|
@@ -47930,7 +47930,7 @@ var require_stringify2 = __commonJS({
|
|
|
47930
47930
|
after_comma = process_comments(value, AFTER(key), deeper_gap);
|
|
47931
47931
|
};
|
|
47932
47932
|
keys.forEach(iteratee);
|
|
47933
|
-
inside +=
|
|
47933
|
+
inside += join10(
|
|
47934
47934
|
after_comma,
|
|
47935
47935
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
47936
47936
|
deeper_gap
|
|
@@ -52225,7 +52225,7 @@ var require_util8 = __commonJS({
|
|
|
52225
52225
|
return path6;
|
|
52226
52226
|
}
|
|
52227
52227
|
exports2.normalize = normalize2;
|
|
52228
|
-
function
|
|
52228
|
+
function join10(aRoot, aPath) {
|
|
52229
52229
|
if (aRoot === "") {
|
|
52230
52230
|
aRoot = ".";
|
|
52231
52231
|
}
|
|
@@ -52257,7 +52257,7 @@ var require_util8 = __commonJS({
|
|
|
52257
52257
|
}
|
|
52258
52258
|
return joined;
|
|
52259
52259
|
}
|
|
52260
|
-
exports2.join =
|
|
52260
|
+
exports2.join = join10;
|
|
52261
52261
|
exports2.isAbsolute = function(aPath) {
|
|
52262
52262
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
52263
52263
|
};
|
|
@@ -52430,7 +52430,7 @@ var require_util8 = __commonJS({
|
|
|
52430
52430
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
52431
52431
|
}
|
|
52432
52432
|
}
|
|
52433
|
-
sourceURL =
|
|
52433
|
+
sourceURL = join10(urlGenerate(parsed), sourceURL);
|
|
52434
52434
|
}
|
|
52435
52435
|
return normalize2(sourceURL);
|
|
52436
52436
|
}
|
|
@@ -73902,8 +73902,8 @@ __export(cli_exports, {
|
|
|
73902
73902
|
setupProjectDirectory: () => setupProjectDirectory
|
|
73903
73903
|
});
|
|
73904
73904
|
module.exports = __toCommonJS(cli_exports);
|
|
73905
|
-
var
|
|
73906
|
-
var
|
|
73905
|
+
var import_node_fs22 = require("node:fs");
|
|
73906
|
+
var import_node_path25 = require("node:path");
|
|
73907
73907
|
var import_node_process14 = require("node:process");
|
|
73908
73908
|
|
|
73909
73909
|
// ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
@@ -74415,11 +74415,6 @@ var stderr = process.stderr;
|
|
|
74415
74415
|
// ../cli/dist/check-macos-version.mjs
|
|
74416
74416
|
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
74417
74417
|
|
|
74418
|
-
// ../workers-utils/dist/chunk-OZQVB3L3.mjs
|
|
74419
|
-
var SERVICE_TAG_PREFIX = "cf:service=";
|
|
74420
|
-
var ENVIRONMENT_TAG_PREFIX = "cf:environment=";
|
|
74421
|
-
var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
|
|
74422
|
-
|
|
74423
74418
|
// ../workers-utils/dist/chunk-DCOBXSFB.mjs
|
|
74424
74419
|
var __create2 = Object.create;
|
|
74425
74420
|
var __defProp2 = Object.defineProperty;
|
|
@@ -74459,7 +74454,7 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__
|
|
|
74459
74454
|
mod
|
|
74460
74455
|
));
|
|
74461
74456
|
|
|
74462
|
-
// ../workers-utils/dist/chunk-
|
|
74457
|
+
// ../workers-utils/dist/chunk-J6D57QVQ.mjs
|
|
74463
74458
|
var import_node_assert = __toESM(require("node:assert"), 1);
|
|
74464
74459
|
function isCompatDate(str) {
|
|
74465
74460
|
return /^\d{4}-\d{2}-\d{2}$/.test(str);
|
|
@@ -74754,9 +74749,9 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
74754
74749
|
}
|
|
74755
74750
|
];
|
|
74756
74751
|
break;
|
|
74757
|
-
case "
|
|
74752
|
+
case "websearch":
|
|
74758
74753
|
{
|
|
74759
|
-
configObj.
|
|
74754
|
+
configObj.websearch = {
|
|
74760
74755
|
binding: binding.name
|
|
74761
74756
|
};
|
|
74762
74757
|
}
|
|
@@ -74889,7 +74884,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
74889
74884
|
}, {});
|
|
74890
74885
|
}
|
|
74891
74886
|
__name(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
74892
|
-
function
|
|
74887
|
+
function constructWranglerConfig(config49) {
|
|
74893
74888
|
const mappedBindings = mapWorkerMetadataBindings(config49.bindings);
|
|
74894
74889
|
const durableObjectClassNames = config49.bindings.filter(
|
|
74895
74890
|
(binding) => binding.type === "durable_object_namespace" && binding.script_name === config49.name
|
|
@@ -74937,45 +74932,9 @@ function convertWorkerToWranglerConfig(config49) {
|
|
|
74937
74932
|
...mappedBindings
|
|
74938
74933
|
};
|
|
74939
74934
|
}
|
|
74940
|
-
__name(convertWorkerToWranglerConfig, "convertWorkerToWranglerConfig");
|
|
74941
|
-
function constructWranglerConfig(workerOrWorkers) {
|
|
74942
|
-
let workers;
|
|
74943
|
-
if (Array.isArray(workerOrWorkers)) {
|
|
74944
|
-
workers = workerOrWorkers;
|
|
74945
|
-
} else {
|
|
74946
|
-
workers = [workerOrWorkers];
|
|
74947
|
-
}
|
|
74948
|
-
const topLevelEnv = workers.find(
|
|
74949
|
-
(w2) => !w2.tags?.some((t2) => t2.startsWith(ENVIRONMENT_TAG_PREFIX))
|
|
74950
|
-
);
|
|
74951
|
-
const workerName = topLevelEnv?.name ?? workers[0].name;
|
|
74952
|
-
const entrypoint = topLevelEnv?.entrypoint ?? workers[0].entrypoint;
|
|
74953
|
-
let combinedConfig;
|
|
74954
|
-
if (topLevelEnv) {
|
|
74955
|
-
combinedConfig = convertWorkerToWranglerConfig(topLevelEnv);
|
|
74956
|
-
} else {
|
|
74957
|
-
combinedConfig = {
|
|
74958
|
-
name: workerName,
|
|
74959
|
-
main: entrypoint
|
|
74960
|
-
};
|
|
74961
|
-
}
|
|
74962
|
-
for (const env3 of workers) {
|
|
74963
|
-
const serviceTag = env3.tags?.find(
|
|
74964
|
-
(t2) => t2 === `${SERVICE_TAG_PREFIX}${workerName}`
|
|
74965
|
-
);
|
|
74966
|
-
const envTag = env3.tags?.find((t2) => t2.startsWith(ENVIRONMENT_TAG_PREFIX));
|
|
74967
|
-
if (serviceTag !== `${SERVICE_TAG_PREFIX}${workerName}` || envTag === void 0) {
|
|
74968
|
-
continue;
|
|
74969
|
-
}
|
|
74970
|
-
const [_2, envName] = envTag.split("=");
|
|
74971
|
-
combinedConfig.env ??= {};
|
|
74972
|
-
combinedConfig.env[envName] = convertWorkerToWranglerConfig(env3);
|
|
74973
|
-
}
|
|
74974
|
-
return combinedConfig;
|
|
74975
|
-
}
|
|
74976
74935
|
__name(constructWranglerConfig, "constructWranglerConfig");
|
|
74977
74936
|
|
|
74978
|
-
// ../workers-utils/dist/chunk-
|
|
74937
|
+
// ../workers-utils/dist/chunk-ULVYGN52.mjs
|
|
74979
74938
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
74980
74939
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
74981
74940
|
var UserError = class extends Error {
|
|
@@ -77596,6 +77555,7 @@ function removeBOMAndValidate(buffer, file2) {
|
|
|
77596
77555
|
return content;
|
|
77597
77556
|
}
|
|
77598
77557
|
__name(removeBOMAndValidate, "removeBOMAndValidate");
|
|
77558
|
+
var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
|
|
77599
77559
|
function absolute(input, root) {
|
|
77600
77560
|
return (0, import_node_path.isAbsolute)(input) ? input : (0, import_node_path.resolve)(root || ".", input);
|
|
77601
77561
|
}
|
|
@@ -77840,6 +77800,7 @@ var import_node_crypto = require("node:crypto");
|
|
|
77840
77800
|
var import_undici = __toESM(require_undici(), 1);
|
|
77841
77801
|
var import_node_url = require("node:url");
|
|
77842
77802
|
var timersPromises = __toESM(require("node:timers/promises"), 1);
|
|
77803
|
+
var import_promises = require("node:timers/promises");
|
|
77843
77804
|
var require_XDGAppPaths = __commonJS2({
|
|
77844
77805
|
"../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/lib/XDGAppPaths.js"(exports2) {
|
|
77845
77806
|
exports2.__esModule = true;
|
|
@@ -79688,7 +79649,7 @@ var defaultWranglerConfig = {
|
|
|
79688
79649
|
vectorize: [],
|
|
79689
79650
|
ai_search_namespaces: [],
|
|
79690
79651
|
ai_search: [],
|
|
79691
|
-
|
|
79652
|
+
websearch: void 0,
|
|
79692
79653
|
agent_memory: [],
|
|
79693
79654
|
hyperdrive: [],
|
|
79694
79655
|
workflows: [],
|
|
@@ -83651,14 +83612,24 @@ __export2(mod_esm_exports, {
|
|
|
83651
83612
|
var import_mod_cjs = __toESM2(require_mod_cjs3(), 1);
|
|
83652
83613
|
__reExport2(mod_esm_exports, __toESM2(require_mod_cjs3(), 1));
|
|
83653
83614
|
var mod_esm_default = import_mod_cjs.default;
|
|
83615
|
+
function getGlobalConfigPath({
|
|
83616
|
+
appName = "wrangler",
|
|
83617
|
+
leadingDot = true,
|
|
83618
|
+
useLegacyHomeDir = true
|
|
83619
|
+
} = {}) {
|
|
83620
|
+
const dirName = `${leadingDot ? "." : ""}${appName}`;
|
|
83621
|
+
const configDir = mod_esm_default(dirName).config();
|
|
83622
|
+
if (useLegacyHomeDir) {
|
|
83623
|
+
const legacyConfigDir = import_node_path2.default.join(import_node_os2.default.homedir(), dirName);
|
|
83624
|
+
if (isDirectory(legacyConfigDir)) {
|
|
83625
|
+
return legacyConfigDir;
|
|
83626
|
+
}
|
|
83627
|
+
}
|
|
83628
|
+
return configDir;
|
|
83629
|
+
}
|
|
83630
|
+
__name(getGlobalConfigPath, "getGlobalConfigPath");
|
|
83654
83631
|
function getGlobalWranglerConfigPath() {
|
|
83655
|
-
|
|
83656
|
-
const legacyConfigDir = import_node_path2.default.join(import_node_os2.default.homedir(), ".wrangler");
|
|
83657
|
-
if (isDirectory(legacyConfigDir)) {
|
|
83658
|
-
return legacyConfigDir;
|
|
83659
|
-
} else {
|
|
83660
|
-
return configDir;
|
|
83661
|
-
}
|
|
83632
|
+
return getGlobalConfigPath();
|
|
83662
83633
|
}
|
|
83663
83634
|
__name(getGlobalWranglerConfigPath, "getGlobalWranglerConfigPath");
|
|
83664
83635
|
function getBooleanEnvironmentVariableFactory(options) {
|
|
@@ -84293,7 +84264,7 @@ var friendlyBindingNames = {
|
|
|
84293
84264
|
vectorize: "Vectorize Index",
|
|
84294
84265
|
ai_search_namespaces: "AI Search Namespace",
|
|
84295
84266
|
ai_search: "AI Search Instance",
|
|
84296
|
-
|
|
84267
|
+
websearch: "Web Search",
|
|
84297
84268
|
agent_memory: "Agent Memory",
|
|
84298
84269
|
hyperdrive: "Hyperdrive Config",
|
|
84299
84270
|
r2_buckets: "R2 Bucket",
|
|
@@ -84347,7 +84318,7 @@ var bindingTypeFriendlyNames = {
|
|
|
84347
84318
|
vectorize: "Vectorize Index",
|
|
84348
84319
|
ai_search_namespace: "AI Search Namespace",
|
|
84349
84320
|
ai_search: "AI Search Instance",
|
|
84350
|
-
|
|
84321
|
+
websearch: "Web Search",
|
|
84351
84322
|
agent_memory: "Agent Memory",
|
|
84352
84323
|
hyperdrive: "Hyperdrive Config",
|
|
84353
84324
|
service: "Worker",
|
|
@@ -85019,8 +84990,8 @@ function normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv) {
|
|
|
85019
84990
|
);
|
|
85020
84991
|
}
|
|
85021
84992
|
__name(normalizeAndValidateRoute, "normalizeAndValidateRoute");
|
|
85022
|
-
function validateRoutes(diagnostics, topLevelEnv, rawEnv) {
|
|
85023
|
-
|
|
84993
|
+
function validateRoutes(diagnostics, topLevelEnv, rawEnv, envName) {
|
|
84994
|
+
const result = inheritable(
|
|
85024
84995
|
diagnostics,
|
|
85025
84996
|
topLevelEnv,
|
|
85026
84997
|
rawEnv,
|
|
@@ -85028,6 +84999,18 @@ function validateRoutes(diagnostics, topLevelEnv, rawEnv) {
|
|
|
85028
84999
|
all(isRouteArray, isMutuallyExclusiveWith(rawEnv, "route")),
|
|
85029
85000
|
void 0
|
|
85030
85001
|
);
|
|
85002
|
+
if (topLevelEnv !== void 0 && envName !== void 0 && rawEnv.routes === void 0) {
|
|
85003
|
+
const customDomainRoutes = topLevelEnv.routes?.filter(
|
|
85004
|
+
(r2) => typeof r2 === "object" && r2 !== null && r2.custom_domain === true
|
|
85005
|
+
);
|
|
85006
|
+
if (customDomainRoutes && customDomainRoutes.length > 0) {
|
|
85007
|
+
const customDomains = customDomainRoutes.map((r2) => r2.pattern).join(", ");
|
|
85008
|
+
diagnostics.warnings.push(
|
|
85009
|
+
`The "env.${envName}" environment inherits the top-level \`routes\` configuration, which includes the custom domain(s): ${customDomains}. Deploying this environment will reassign these custom domains away from the top-level Worker. Add \`"routes": []\` to "env.${envName}" to prevent inheritance, or copy the route configuration from the top level to hide this warning.`
|
|
85010
|
+
);
|
|
85011
|
+
}
|
|
85012
|
+
}
|
|
85013
|
+
return result;
|
|
85031
85014
|
}
|
|
85032
85015
|
__name(validateRoutes, "validateRoutes");
|
|
85033
85016
|
function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
@@ -85243,7 +85226,12 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
85243
85226
|
void 0,
|
|
85244
85227
|
void 0
|
|
85245
85228
|
);
|
|
85246
|
-
const routes = validateRoutes(
|
|
85229
|
+
const routes = validateRoutes(
|
|
85230
|
+
diagnostics,
|
|
85231
|
+
topLevelEnv,
|
|
85232
|
+
rawEnv,
|
|
85233
|
+
topLevelEnv === void 0 ? void 0 : envName
|
|
85234
|
+
);
|
|
85247
85235
|
const workers_dev = inheritable(
|
|
85248
85236
|
diagnostics,
|
|
85249
85237
|
topLevelEnv,
|
|
@@ -85543,13 +85531,13 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
85543
85531
|
validateBindingArray(envName, validateAISearchBinding),
|
|
85544
85532
|
[]
|
|
85545
85533
|
),
|
|
85546
|
-
|
|
85534
|
+
websearch: notInheritable(
|
|
85547
85535
|
diagnostics,
|
|
85548
85536
|
topLevelEnv,
|
|
85549
85537
|
rawConfig,
|
|
85550
85538
|
rawEnv,
|
|
85551
85539
|
envName,
|
|
85552
|
-
"
|
|
85540
|
+
"websearch",
|
|
85553
85541
|
validateNamedSimpleBinding(envName),
|
|
85554
85542
|
void 0
|
|
85555
85543
|
),
|
|
@@ -86646,7 +86634,7 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
|
|
|
86646
86634
|
"ai",
|
|
86647
86635
|
"ai_search_namespace",
|
|
86648
86636
|
"ai_search",
|
|
86649
|
-
"
|
|
86637
|
+
"websearch",
|
|
86650
86638
|
"agent_memory",
|
|
86651
86639
|
"kv_namespace",
|
|
86652
86640
|
"durable_object_namespace",
|
|
@@ -87457,12 +87445,21 @@ var validateD1Binding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
|
87457
87445
|
if (!isRemoteValid(value, field, diagnostics)) {
|
|
87458
87446
|
isValid2 = false;
|
|
87459
87447
|
}
|
|
87448
|
+
if (!isOptionalProperty(value, "migrations_pattern", "string")) {
|
|
87449
|
+
diagnostics.errors.push(
|
|
87450
|
+
`"${field}" bindings should, optionally, have a string "migrations_pattern" field but got ${JSON.stringify(
|
|
87451
|
+
value
|
|
87452
|
+
)}.`
|
|
87453
|
+
);
|
|
87454
|
+
isValid2 = false;
|
|
87455
|
+
}
|
|
87460
87456
|
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
|
87461
87457
|
"binding",
|
|
87462
87458
|
"database_id",
|
|
87463
87459
|
"database_internal_env",
|
|
87464
87460
|
"database_name",
|
|
87465
87461
|
"migrations_dir",
|
|
87462
|
+
"migrations_pattern",
|
|
87466
87463
|
"migrations_table",
|
|
87467
87464
|
"preview_database_id",
|
|
87468
87465
|
"remote"
|
|
@@ -89054,7 +89051,7 @@ var BINDING_LOCAL_SUPPORT = {
|
|
|
89054
89051
|
flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
89055
89052
|
vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
89056
89053
|
vpc_network: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
89057
|
-
|
|
89054
|
+
websearch: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
89058
89055
|
agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
|
|
89059
89056
|
};
|
|
89060
89057
|
function getBindingLocalSupport(type) {
|
|
@@ -90023,7 +90020,7 @@ __name(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
|
90023
90020
|
function logHeaders(headers, logger) {
|
|
90024
90021
|
const clone = cloneHeaders(headers);
|
|
90025
90022
|
clone.delete("Authorization");
|
|
90026
|
-
logger.debugWithSanitization(
|
|
90023
|
+
logger.debugWithSanitization?.(
|
|
90027
90024
|
"HEADERS:",
|
|
90028
90025
|
JSON.stringify(Object.fromEntries(clone), null, 2)
|
|
90029
90026
|
);
|
|
@@ -90044,11 +90041,11 @@ async function performApiFetchBase(complianceConfig, resource, init = {}, userAg
|
|
|
90044
90041
|
logger.debug(
|
|
90045
90042
|
`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`
|
|
90046
90043
|
);
|
|
90047
|
-
logger.debugWithSanitization("QUERY STRING:", queryString);
|
|
90044
|
+
logger.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
90048
90045
|
logHeaders(headers, logger);
|
|
90049
|
-
logger.debugWithSanitization("INIT:", JSON.stringify({ ...init }, null, 2));
|
|
90046
|
+
logger.debugWithSanitization?.("INIT:", JSON.stringify({ ...init }, null, 2));
|
|
90050
90047
|
if (init.body instanceof import_undici.FormData) {
|
|
90051
|
-
logger.debugWithSanitization(
|
|
90048
|
+
logger.debugWithSanitization?.(
|
|
90052
90049
|
"BODY:",
|
|
90053
90050
|
await new import_undici.Response(init.body).text(),
|
|
90054
90051
|
null,
|
|
@@ -90086,7 +90083,7 @@ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgen
|
|
|
90086
90083
|
response.status
|
|
90087
90084
|
);
|
|
90088
90085
|
logHeaders(response.headers, logger);
|
|
90089
|
-
logger.debugWithSanitization("RESPONSE:", jsonText);
|
|
90086
|
+
logger.debugWithSanitization?.("RESPONSE:", jsonText);
|
|
90090
90087
|
logger.debug("-- END CF API RESPONSE");
|
|
90091
90088
|
if (!jsonText && (response.status === 204 || response.status === 205)) {
|
|
90092
90089
|
return {
|
|
@@ -90325,6 +90322,27 @@ function throwWAFBlockError(headers, method, resource, status2, statusText) {
|
|
|
90325
90322
|
});
|
|
90326
90323
|
}
|
|
90327
90324
|
__name(throwWAFBlockError, "throwWAFBlockError");
|
|
90325
|
+
async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger, credentials) {
|
|
90326
|
+
const headers = new import_undici.Headers();
|
|
90327
|
+
addAuthorizationHeader(headers, credentials);
|
|
90328
|
+
headers.set("User-Agent", userAgent);
|
|
90329
|
+
maybeAddTraceHeader(headers);
|
|
90330
|
+
const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
|
|
90331
|
+
logger.debug(`-- START CF API REQUEST: GET ${resource}`);
|
|
90332
|
+
logger.debug("-- END CF API REQUEST");
|
|
90333
|
+
const response = await (0, import_undici.fetch)(resource, {
|
|
90334
|
+
method: "GET",
|
|
90335
|
+
headers
|
|
90336
|
+
});
|
|
90337
|
+
if (response.ok) {
|
|
90338
|
+
return await response.arrayBuffer();
|
|
90339
|
+
} else {
|
|
90340
|
+
throw new Error(
|
|
90341
|
+
`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`
|
|
90342
|
+
);
|
|
90343
|
+
}
|
|
90344
|
+
}
|
|
90345
|
+
__name(fetchKVGetValueBase, "fetchKVGetValueBase");
|
|
90328
90346
|
function hasCursor(result_info) {
|
|
90329
90347
|
const cursor = result_info?.cursor;
|
|
90330
90348
|
return cursor !== void 0 && cursor !== null && cursor !== "";
|
|
@@ -90370,6 +90388,74 @@ async function fetchLatestNpmVersion(name3, version3) {
|
|
|
90370
90388
|
return { status: "update-available", latest: result.latest };
|
|
90371
90389
|
}
|
|
90372
90390
|
__name(fetchLatestNpmVersion, "fetchLatestNpmVersion");
|
|
90391
|
+
var MAX_ATTEMPTS = 3;
|
|
90392
|
+
async function retryOnAPIFailure(action, logger, backoff = 0, attempts = MAX_ATTEMPTS, abortSignal) {
|
|
90393
|
+
try {
|
|
90394
|
+
return await action();
|
|
90395
|
+
} catch (err) {
|
|
90396
|
+
if (err instanceof APIError) {
|
|
90397
|
+
if (!err.isRetryable()) {
|
|
90398
|
+
throw err;
|
|
90399
|
+
}
|
|
90400
|
+
} else if (err instanceof DOMException && err.name === "TimeoutError") ;
|
|
90401
|
+
else if (!(err instanceof TypeError)) {
|
|
90402
|
+
throw err;
|
|
90403
|
+
}
|
|
90404
|
+
logger.debug(`Retrying API call after error...`);
|
|
90405
|
+
logger.debug(err);
|
|
90406
|
+
if (attempts <= 1) {
|
|
90407
|
+
throw err;
|
|
90408
|
+
}
|
|
90409
|
+
await (0, import_promises.setTimeout)(backoff, void 0, { signal: abortSignal });
|
|
90410
|
+
return retryOnAPIFailure(
|
|
90411
|
+
action,
|
|
90412
|
+
logger,
|
|
90413
|
+
backoff + 1e3,
|
|
90414
|
+
attempts - 1,
|
|
90415
|
+
abortSignal
|
|
90416
|
+
);
|
|
90417
|
+
}
|
|
90418
|
+
}
|
|
90419
|
+
__name(retryOnAPIFailure, "retryOnAPIFailure");
|
|
90420
|
+
function formatTime(duration) {
|
|
90421
|
+
return `(${(duration / 1e3).toFixed(2)} sec)`;
|
|
90422
|
+
}
|
|
90423
|
+
__name(formatTime, "formatTime");
|
|
90424
|
+
function getHostFromRoute(route) {
|
|
90425
|
+
let host;
|
|
90426
|
+
if (typeof route === "string") {
|
|
90427
|
+
host = getHostFromUrl(route);
|
|
90428
|
+
} else if (typeof route === "object") {
|
|
90429
|
+
host = getHostFromUrl(route.pattern);
|
|
90430
|
+
if (host === void 0 && "zone_name" in route) {
|
|
90431
|
+
host = getHostFromUrl(route.zone_name);
|
|
90432
|
+
}
|
|
90433
|
+
}
|
|
90434
|
+
return host;
|
|
90435
|
+
}
|
|
90436
|
+
__name(getHostFromRoute, "getHostFromRoute");
|
|
90437
|
+
function getZoneFromRoute(route) {
|
|
90438
|
+
if (typeof route === "object" && "zone_name" in route && route.zone_name) {
|
|
90439
|
+
return route.zone_name;
|
|
90440
|
+
}
|
|
90441
|
+
return getHostFromRoute(route);
|
|
90442
|
+
}
|
|
90443
|
+
__name(getZoneFromRoute, "getZoneFromRoute");
|
|
90444
|
+
function getHostFromUrl(urlLike) {
|
|
90445
|
+
if (urlLike.startsWith("*/") || urlLike.startsWith("http://*/") || urlLike.startsWith("https://*/")) {
|
|
90446
|
+
return void 0;
|
|
90447
|
+
}
|
|
90448
|
+
urlLike = urlLike.replace(/\*(\.)?/g, "");
|
|
90449
|
+
if (!(urlLike.startsWith("http://") || urlLike.startsWith("https://"))) {
|
|
90450
|
+
urlLike = "http://" + urlLike;
|
|
90451
|
+
}
|
|
90452
|
+
try {
|
|
90453
|
+
return new URL(urlLike).host;
|
|
90454
|
+
} catch {
|
|
90455
|
+
return void 0;
|
|
90456
|
+
}
|
|
90457
|
+
}
|
|
90458
|
+
__name(getHostFromUrl, "getHostFromUrl");
|
|
90373
90459
|
|
|
90374
90460
|
// ../cli/dist/check-macos-version.mjs
|
|
90375
90461
|
var import_ci_info = __toESM(require_ci_info(), 1);
|
|
@@ -97337,11 +97423,11 @@ var Yargs = YargsFactory(esm_default2);
|
|
|
97337
97423
|
var yargs_default = Yargs;
|
|
97338
97424
|
|
|
97339
97425
|
// package.json
|
|
97340
|
-
var version = "2.70.
|
|
97426
|
+
var version = "2.70.2";
|
|
97341
97427
|
|
|
97342
97428
|
// src/metrics.ts
|
|
97343
97429
|
var import_node_async_hooks = require("node:async_hooks");
|
|
97344
|
-
var
|
|
97430
|
+
var import_promises2 = require("node:timers/promises");
|
|
97345
97431
|
|
|
97346
97432
|
// src/helpers/metrics-config.ts
|
|
97347
97433
|
var import_node_crypto2 = require("node:crypto");
|
|
@@ -97684,7 +97770,7 @@ function createReporter() {
|
|
|
97684
97770
|
async function collectAsyncMetrics(options) {
|
|
97685
97771
|
const cancelDeferred = promiseWithResolvers();
|
|
97686
97772
|
const cancel2 = async (signal) => {
|
|
97687
|
-
await (0,
|
|
97773
|
+
await (0, import_promises2.setTimeout)(10);
|
|
97688
97774
|
cancelDeferred.reject(new CancelError(`Operation cancelled`, signal));
|
|
97689
97775
|
};
|
|
97690
97776
|
const tracker = !options.disableTelemetry ? createTracker(options.eventPrefix, options.props) : null;
|
|
@@ -97786,10 +97872,10 @@ var runTelemetryCommand = (action) => {
|
|
|
97786
97872
|
};
|
|
97787
97873
|
|
|
97788
97874
|
// src/templates.ts
|
|
97789
|
-
var
|
|
97790
|
-
var
|
|
97875
|
+
var import_node_fs19 = require("node:fs");
|
|
97876
|
+
var import_promises7 = require("node:fs/promises");
|
|
97791
97877
|
var import_node_os7 = require("node:os");
|
|
97792
|
-
var
|
|
97878
|
+
var import_node_path20 = require("node:path");
|
|
97793
97879
|
var import_deepmerge = __toESM(require_cjs());
|
|
97794
97880
|
var import_degit = __toESM(require_dist());
|
|
97795
97881
|
|
|
@@ -97797,13 +97883,13 @@ var import_degit = __toESM(require_dist());
|
|
|
97797
97883
|
var import_haikunator = __toESM(require_dist_web());
|
|
97798
97884
|
|
|
97799
97885
|
// src/helpers/packages.ts
|
|
97800
|
-
var
|
|
97801
|
-
var
|
|
97886
|
+
var import_node_fs9 = require("node:fs");
|
|
97887
|
+
var import_node_path10 = __toESM(require("node:path"));
|
|
97802
97888
|
|
|
97803
97889
|
// ../cli/dist/packages.mjs
|
|
97804
97890
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
97805
97891
|
var import_node_assert4 = __toESM(require("node:assert"), 1);
|
|
97806
|
-
var
|
|
97892
|
+
var import_promises3 = require("node:fs/promises");
|
|
97807
97893
|
var installPackages = async (packageManager, packages, config49 = {}) => {
|
|
97808
97894
|
const { force, dev, startText, doneText } = config49;
|
|
97809
97895
|
const isWorkspaceRoot = config49.isWorkspaceRoot ?? false;
|
|
@@ -97876,7 +97962,7 @@ var installPackages = async (packageManager, packages, config49 = {}) => {
|
|
|
97876
97962
|
if (pkgVersion !== "latest") deps[pkgName] = pkgVersion;
|
|
97877
97963
|
}
|
|
97878
97964
|
}
|
|
97879
|
-
await (0,
|
|
97965
|
+
await (0, import_promises3.writeFile)(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
97880
97966
|
}
|
|
97881
97967
|
};
|
|
97882
97968
|
function getWorkspaceInstallRootFlag(packageManager, isWorkspaceRoot) {
|
|
@@ -97902,1580 +97988,1828 @@ async function installWrangler(packageManager, isWorkspaceRoot) {
|
|
|
97902
97988
|
|
|
97903
97989
|
// src/helpers/packages.ts
|
|
97904
97990
|
var import_undici3 = __toESM(require_undici());
|
|
97905
|
-
var installPackages2 = async (packages, config49 = {}) => {
|
|
97906
|
-
const { npm: npm25 } = detectPackageManager();
|
|
97907
|
-
return installPackages(npm25, packages, config49);
|
|
97908
|
-
};
|
|
97909
|
-
async function installWrangler2() {
|
|
97910
|
-
const { npm: npm25 } = detectPackageManager();
|
|
97911
|
-
return installWrangler(npm25, false);
|
|
97912
|
-
}
|
|
97913
|
-
var npmInstall = async (ctx) => {
|
|
97914
|
-
const nodeModulesPath = import_node_path8.default.join(ctx.project.path, "node_modules");
|
|
97915
|
-
if ((0, import_node_fs7.existsSync)(nodeModulesPath)) {
|
|
97916
|
-
return;
|
|
97917
|
-
}
|
|
97918
|
-
const { npm: npm25 } = detectPackageManager();
|
|
97919
|
-
await runCommand([npm25, "install"], {
|
|
97920
|
-
silent: true,
|
|
97921
|
-
startText: "Installing dependencies",
|
|
97922
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
97923
|
-
});
|
|
97924
|
-
};
|
|
97925
|
-
async function getLatestPackageVersion(packageSpecifier) {
|
|
97926
|
-
const resp = await (0, import_undici3.fetch)(`https://registry.npmjs.org/${packageSpecifier}`);
|
|
97927
|
-
const npmInfo = await resp.json();
|
|
97928
|
-
return npmInfo["dist-tags"].latest;
|
|
97929
|
-
}
|
|
97930
|
-
|
|
97931
|
-
// ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
97932
|
-
var import_node_process13 = __toESM(require("node:process"), 1);
|
|
97933
|
-
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
97934
|
-
var import_node_url2 = require("node:url");
|
|
97935
|
-
var import_node_child_process8 = __toESM(require("node:child_process"), 1);
|
|
97936
|
-
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
97937
|
-
|
|
97938
|
-
// ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
|
|
97939
|
-
var import_node_util3 = require("node:util");
|
|
97940
|
-
var import_node_child_process3 = __toESM(require("node:child_process"), 1);
|
|
97941
|
-
var import_promises3 = __toESM(require("node:fs/promises"), 1);
|
|
97942
97991
|
|
|
97943
|
-
//
|
|
97944
|
-
var
|
|
97945
|
-
var
|
|
97946
|
-
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
97992
|
+
// src/helpers/pnpmBuildApprovals.ts
|
|
97993
|
+
var import_node_fs8 = require("node:fs");
|
|
97994
|
+
var import_node_path9 = require("node:path");
|
|
97947
97995
|
|
|
97948
|
-
//
|
|
97949
|
-
var
|
|
97996
|
+
// src/helpers/files.ts
|
|
97997
|
+
var import_node_fs7 = __toESM(require("node:fs"));
|
|
97998
|
+
var import_node_path8 = require("node:path");
|
|
97999
|
+
var import_comment_json = __toESM(require_src3());
|
|
97950
98000
|
|
|
97951
|
-
// ../../node_modules/.pnpm/
|
|
97952
|
-
|
|
97953
|
-
|
|
97954
|
-
|
|
97955
|
-
try {
|
|
97956
|
-
import_node_fs8.default.statSync("/.dockerenv");
|
|
97957
|
-
return true;
|
|
97958
|
-
} catch {
|
|
97959
|
-
return false;
|
|
97960
|
-
}
|
|
97961
|
-
}
|
|
97962
|
-
function hasDockerCGroup() {
|
|
97963
|
-
try {
|
|
97964
|
-
return import_node_fs8.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
97965
|
-
} catch {
|
|
97966
|
-
return false;
|
|
97967
|
-
}
|
|
98001
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/error.js
|
|
98002
|
+
function getLineColFromPtr2(string, ptr) {
|
|
98003
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
98004
|
+
return [lines.length, lines.pop().length + 1];
|
|
97968
98005
|
}
|
|
97969
|
-
function
|
|
97970
|
-
|
|
97971
|
-
|
|
98006
|
+
function makeCodeBlock2(string, line, column) {
|
|
98007
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
98008
|
+
let codeblock = "";
|
|
98009
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
98010
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
98011
|
+
let l = lines[i - 1];
|
|
98012
|
+
if (!l)
|
|
98013
|
+
continue;
|
|
98014
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
98015
|
+
codeblock += ": ";
|
|
98016
|
+
codeblock += l;
|
|
98017
|
+
codeblock += "\n";
|
|
98018
|
+
if (i === line) {
|
|
98019
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
98020
|
+
codeblock += "^\n";
|
|
98021
|
+
}
|
|
97972
98022
|
}
|
|
97973
|
-
return
|
|
98023
|
+
return codeblock;
|
|
97974
98024
|
}
|
|
98025
|
+
var TomlError2 = class extends Error {
|
|
98026
|
+
line;
|
|
98027
|
+
column;
|
|
98028
|
+
codeblock;
|
|
98029
|
+
constructor(message, options) {
|
|
98030
|
+
const [line, column] = getLineColFromPtr2(options.toml, options.ptr);
|
|
98031
|
+
const codeblock = makeCodeBlock2(options.toml, line, column);
|
|
98032
|
+
super(`Invalid TOML document: ${message}
|
|
97975
98033
|
|
|
97976
|
-
|
|
97977
|
-
|
|
97978
|
-
|
|
97979
|
-
|
|
97980
|
-
import_node_fs9.default.statSync("/run/.containerenv");
|
|
97981
|
-
return true;
|
|
97982
|
-
} catch {
|
|
97983
|
-
return false;
|
|
98034
|
+
${codeblock}`, options);
|
|
98035
|
+
this.line = line;
|
|
98036
|
+
this.column = column;
|
|
98037
|
+
this.codeblock = codeblock;
|
|
97984
98038
|
}
|
|
97985
98039
|
};
|
|
97986
|
-
function isInsideContainer() {
|
|
97987
|
-
if (cachedResult === void 0) {
|
|
97988
|
-
cachedResult = hasContainerEnv() || isDocker();
|
|
97989
|
-
}
|
|
97990
|
-
return cachedResult;
|
|
97991
|
-
}
|
|
97992
98040
|
|
|
97993
|
-
// ../../node_modules/.pnpm/
|
|
97994
|
-
|
|
97995
|
-
|
|
97996
|
-
|
|
97997
|
-
|
|
97998
|
-
|
|
97999
|
-
|
|
98000
|
-
|
|
98041
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/util.js
|
|
98042
|
+
function isEscaped2(str, ptr) {
|
|
98043
|
+
let i = 0;
|
|
98044
|
+
while (str[ptr - ++i] === "\\")
|
|
98045
|
+
;
|
|
98046
|
+
return --i && i % 2;
|
|
98047
|
+
}
|
|
98048
|
+
function indexOfNewline2(str, start = 0, end = str.length) {
|
|
98049
|
+
let idx = str.indexOf("\n", start);
|
|
98050
|
+
if (str[idx - 1] === "\r")
|
|
98051
|
+
idx--;
|
|
98052
|
+
return idx <= end ? idx : -1;
|
|
98053
|
+
}
|
|
98054
|
+
function skipComment2(str, ptr) {
|
|
98055
|
+
for (let i = ptr; i < str.length; i++) {
|
|
98056
|
+
let c2 = str[i];
|
|
98057
|
+
if (c2 === "\n")
|
|
98058
|
+
return i;
|
|
98059
|
+
if (c2 === "\r" && str[i + 1] === "\n")
|
|
98060
|
+
return i + 1;
|
|
98061
|
+
if (c2 < " " && c2 !== " " || c2 === "\x7F") {
|
|
98062
|
+
throw new TomlError2("control characters are not allowed in comments", {
|
|
98063
|
+
toml: str,
|
|
98064
|
+
ptr
|
|
98065
|
+
});
|
|
98001
98066
|
}
|
|
98002
|
-
return true;
|
|
98003
98067
|
}
|
|
98004
|
-
|
|
98005
|
-
|
|
98006
|
-
|
|
98007
|
-
|
|
98068
|
+
return str.length;
|
|
98069
|
+
}
|
|
98070
|
+
function skipVoid2(str, ptr, banNewLines, banComments) {
|
|
98071
|
+
let c2;
|
|
98072
|
+
while ((c2 = str[ptr]) === " " || c2 === " " || !banNewLines && (c2 === "\n" || c2 === "\r" && str[ptr + 1] === "\n"))
|
|
98073
|
+
ptr++;
|
|
98074
|
+
return banComments || c2 !== "#" ? ptr : skipVoid2(str, skipComment2(str, ptr), banNewLines);
|
|
98075
|
+
}
|
|
98076
|
+
function skipUntil2(str, ptr, sep, end, banNewLines = false) {
|
|
98077
|
+
if (!end) {
|
|
98078
|
+
ptr = indexOfNewline2(str, ptr);
|
|
98079
|
+
return ptr < 0 ? str.length : ptr;
|
|
98008
98080
|
}
|
|
98009
|
-
|
|
98010
|
-
|
|
98011
|
-
|
|
98012
|
-
|
|
98013
|
-
|
|
98014
|
-
|
|
98015
|
-
|
|
98016
|
-
|
|
98017
|
-
var execFile = (0, import_node_util2.promisify)(import_node_child_process2.default.execFile);
|
|
98018
|
-
var powerShellPath = () => `${import_node_process8.default.env.SYSTEMROOT || import_node_process8.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
98019
|
-
var executePowerShell = async (command2, options = {}) => {
|
|
98020
|
-
const {
|
|
98021
|
-
powerShellPath: psPath,
|
|
98022
|
-
...execFileOptions
|
|
98023
|
-
} = options;
|
|
98024
|
-
const encodedCommand = executePowerShell.encodeCommand(command2);
|
|
98025
|
-
return execFile(
|
|
98026
|
-
psPath ?? powerShellPath(),
|
|
98027
|
-
[
|
|
98028
|
-
...executePowerShell.argumentsPrefix,
|
|
98029
|
-
encodedCommand
|
|
98030
|
-
],
|
|
98031
|
-
{
|
|
98032
|
-
encoding: "utf8",
|
|
98033
|
-
...execFileOptions
|
|
98034
|
-
}
|
|
98035
|
-
);
|
|
98036
|
-
};
|
|
98037
|
-
executePowerShell.argumentsPrefix = [
|
|
98038
|
-
"-NoProfile",
|
|
98039
|
-
"-NonInteractive",
|
|
98040
|
-
"-ExecutionPolicy",
|
|
98041
|
-
"Bypass",
|
|
98042
|
-
"-EncodedCommand"
|
|
98043
|
-
];
|
|
98044
|
-
executePowerShell.encodeCommand = (command2) => import_node_buffer.Buffer.from(command2, "utf16le").toString("base64");
|
|
98045
|
-
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
98046
|
-
|
|
98047
|
-
// ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
|
|
98048
|
-
function parseMountPointFromConfig(content) {
|
|
98049
|
-
for (const line of content.split("\n")) {
|
|
98050
|
-
if (/^\s*#/.test(line)) {
|
|
98051
|
-
continue;
|
|
98081
|
+
for (let i = ptr; i < str.length; i++) {
|
|
98082
|
+
let c2 = str[i];
|
|
98083
|
+
if (c2 === "#") {
|
|
98084
|
+
i = indexOfNewline2(str, i);
|
|
98085
|
+
} else if (c2 === sep) {
|
|
98086
|
+
return i + 1;
|
|
98087
|
+
} else if (c2 === end || banNewLines && (c2 === "\n" || c2 === "\r" && str[i + 1] === "\n")) {
|
|
98088
|
+
return i;
|
|
98052
98089
|
}
|
|
98053
|
-
|
|
98054
|
-
|
|
98055
|
-
|
|
98090
|
+
}
|
|
98091
|
+
throw new TomlError2("cannot find end of structure", {
|
|
98092
|
+
toml: str,
|
|
98093
|
+
ptr
|
|
98094
|
+
});
|
|
98095
|
+
}
|
|
98096
|
+
function getStringEnd2(str, seek) {
|
|
98097
|
+
let first = str[seek];
|
|
98098
|
+
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
98099
|
+
seek += target.length - 1;
|
|
98100
|
+
do
|
|
98101
|
+
seek = str.indexOf(target, ++seek);
|
|
98102
|
+
while (seek > -1 && first !== "'" && isEscaped2(str, seek));
|
|
98103
|
+
if (seek > -1) {
|
|
98104
|
+
seek += target.length;
|
|
98105
|
+
if (target.length > 1) {
|
|
98106
|
+
if (str[seek] === first)
|
|
98107
|
+
seek++;
|
|
98108
|
+
if (str[seek] === first)
|
|
98109
|
+
seek++;
|
|
98056
98110
|
}
|
|
98057
|
-
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
98058
98111
|
}
|
|
98112
|
+
return seek;
|
|
98059
98113
|
}
|
|
98060
98114
|
|
|
98061
|
-
// ../../node_modules/.pnpm/
|
|
98062
|
-
var
|
|
98063
|
-
var
|
|
98064
|
-
|
|
98065
|
-
|
|
98066
|
-
|
|
98067
|
-
|
|
98068
|
-
|
|
98069
|
-
|
|
98070
|
-
|
|
98071
|
-
|
|
98072
|
-
|
|
98073
|
-
|
|
98074
|
-
|
|
98075
|
-
|
|
98076
|
-
|
|
98077
|
-
|
|
98078
|
-
|
|
98079
|
-
|
|
98080
|
-
|
|
98081
|
-
|
|
98082
|
-
|
|
98083
|
-
|
|
98115
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/date.js
|
|
98116
|
+
var DATE_TIME_RE2 = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
98117
|
+
var TomlDate2 = class _TomlDate2 extends Date {
|
|
98118
|
+
#hasDate = false;
|
|
98119
|
+
#hasTime = false;
|
|
98120
|
+
#offset = null;
|
|
98121
|
+
constructor(date) {
|
|
98122
|
+
let hasDate = true;
|
|
98123
|
+
let hasTime = true;
|
|
98124
|
+
let offset = "Z";
|
|
98125
|
+
if (typeof date === "string") {
|
|
98126
|
+
let match = date.match(DATE_TIME_RE2);
|
|
98127
|
+
if (match) {
|
|
98128
|
+
if (!match[1]) {
|
|
98129
|
+
hasDate = false;
|
|
98130
|
+
date = `0000-01-01T${date}`;
|
|
98131
|
+
}
|
|
98132
|
+
hasTime = !!match[2];
|
|
98133
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
98134
|
+
if (match[2] && +match[2] > 23) {
|
|
98135
|
+
date = "";
|
|
98136
|
+
} else {
|
|
98137
|
+
offset = match[3] || null;
|
|
98138
|
+
date = date.toUpperCase();
|
|
98139
|
+
if (!offset && hasTime)
|
|
98140
|
+
date += "Z";
|
|
98141
|
+
}
|
|
98142
|
+
} else {
|
|
98143
|
+
date = "";
|
|
98144
|
+
}
|
|
98084
98145
|
}
|
|
98085
|
-
|
|
98086
|
-
|
|
98087
|
-
|
|
98088
|
-
|
|
98089
|
-
|
|
98090
|
-
var powerShellPathFromWsl = async () => {
|
|
98091
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
98092
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
98093
|
-
};
|
|
98094
|
-
var powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
|
|
98095
|
-
var canAccessPowerShellPromise;
|
|
98096
|
-
var canAccessPowerShell = async () => {
|
|
98097
|
-
canAccessPowerShellPromise ??= (async () => {
|
|
98098
|
-
try {
|
|
98099
|
-
const psPath = await powerShellPath2();
|
|
98100
|
-
await import_promises3.default.access(psPath, import_promises3.constants.X_OK);
|
|
98101
|
-
return true;
|
|
98102
|
-
} catch {
|
|
98103
|
-
return false;
|
|
98146
|
+
super(date);
|
|
98147
|
+
if (!isNaN(this.getTime())) {
|
|
98148
|
+
this.#hasDate = hasDate;
|
|
98149
|
+
this.#hasTime = hasTime;
|
|
98150
|
+
this.#offset = offset;
|
|
98104
98151
|
}
|
|
98105
|
-
})();
|
|
98106
|
-
return canAccessPowerShellPromise;
|
|
98107
|
-
};
|
|
98108
|
-
var wslDefaultBrowser = async () => {
|
|
98109
|
-
const psPath = await powerShellPath2();
|
|
98110
|
-
const command2 = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
98111
|
-
const { stdout: stdout2 } = await executePowerShell(command2, { powerShellPath: psPath });
|
|
98112
|
-
return stdout2.trim();
|
|
98113
|
-
};
|
|
98114
|
-
var convertWslPathToWindows = async (path6) => {
|
|
98115
|
-
if (/^[a-z]+:\/\//i.test(path6)) {
|
|
98116
|
-
return path6;
|
|
98117
98152
|
}
|
|
98118
|
-
|
|
98119
|
-
|
|
98120
|
-
return stdout2.trim();
|
|
98121
|
-
} catch {
|
|
98122
|
-
return path6;
|
|
98153
|
+
isDateTime() {
|
|
98154
|
+
return this.#hasDate && this.#hasTime;
|
|
98123
98155
|
}
|
|
98124
|
-
|
|
98125
|
-
|
|
98126
|
-
// ../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
|
|
98127
|
-
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
98128
|
-
const define2 = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
98129
|
-
Object.defineProperty(object, propertyName, {
|
|
98130
|
-
configurable: true,
|
|
98131
|
-
enumerable: true,
|
|
98132
|
-
get() {
|
|
98133
|
-
const result = valueGetter();
|
|
98134
|
-
define2(result);
|
|
98135
|
-
return result;
|
|
98136
|
-
},
|
|
98137
|
-
set(value) {
|
|
98138
|
-
define2(value);
|
|
98139
|
-
}
|
|
98140
|
-
});
|
|
98141
|
-
return object;
|
|
98142
|
-
}
|
|
98143
|
-
|
|
98144
|
-
// ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
|
|
98145
|
-
var import_node_util7 = require("node:util");
|
|
98146
|
-
var import_node_process11 = __toESM(require("node:process"), 1);
|
|
98147
|
-
var import_node_child_process7 = require("node:child_process");
|
|
98148
|
-
|
|
98149
|
-
// ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
98150
|
-
var import_node_util4 = require("node:util");
|
|
98151
|
-
var import_node_process9 = __toESM(require("node:process"), 1);
|
|
98152
|
-
var import_node_child_process4 = require("node:child_process");
|
|
98153
|
-
var execFileAsync = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
|
|
98154
|
-
async function defaultBrowserId() {
|
|
98155
|
-
if (import_node_process9.default.platform !== "darwin") {
|
|
98156
|
-
throw new Error("macOS only");
|
|
98156
|
+
isLocal() {
|
|
98157
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
98157
98158
|
}
|
|
98158
|
-
|
|
98159
|
-
|
|
98160
|
-
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
98161
|
-
if (browserId === "com.apple.safari") {
|
|
98162
|
-
return "com.apple.Safari";
|
|
98159
|
+
isDate() {
|
|
98160
|
+
return this.#hasDate && !this.#hasTime;
|
|
98163
98161
|
}
|
|
98164
|
-
|
|
98165
|
-
|
|
98166
|
-
|
|
98167
|
-
// ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
98168
|
-
var import_node_process10 = __toESM(require("node:process"), 1);
|
|
98169
|
-
var import_node_util5 = require("node:util");
|
|
98170
|
-
var import_node_child_process5 = require("node:child_process");
|
|
98171
|
-
var execFileAsync2 = (0, import_node_util5.promisify)(import_node_child_process5.execFile);
|
|
98172
|
-
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
98173
|
-
if (import_node_process10.default.platform !== "darwin") {
|
|
98174
|
-
throw new Error("macOS only");
|
|
98162
|
+
isTime() {
|
|
98163
|
+
return this.#hasTime && !this.#hasDate;
|
|
98175
98164
|
}
|
|
98176
|
-
|
|
98177
|
-
|
|
98178
|
-
if (signal) {
|
|
98179
|
-
execOptions.signal = signal;
|
|
98165
|
+
isValid() {
|
|
98166
|
+
return this.#hasDate || this.#hasTime;
|
|
98180
98167
|
}
|
|
98181
|
-
|
|
98182
|
-
|
|
98183
|
-
|
|
98184
|
-
|
|
98185
|
-
|
|
98186
|
-
|
|
98187
|
-
|
|
98188
|
-
|
|
98189
|
-
|
|
98168
|
+
toISOString() {
|
|
98169
|
+
let iso = super.toISOString();
|
|
98170
|
+
if (this.isDate())
|
|
98171
|
+
return iso.slice(0, 10);
|
|
98172
|
+
if (this.isTime())
|
|
98173
|
+
return iso.slice(11, 23);
|
|
98174
|
+
if (this.#offset === null)
|
|
98175
|
+
return iso.slice(0, -1);
|
|
98176
|
+
if (this.#offset === "Z")
|
|
98177
|
+
return iso;
|
|
98178
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
98179
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
98180
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
98181
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
98182
|
+
}
|
|
98183
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
98184
|
+
let date = new _TomlDate2(jsDate);
|
|
98185
|
+
date.#offset = offset;
|
|
98186
|
+
return date;
|
|
98187
|
+
}
|
|
98188
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
98189
|
+
let date = new _TomlDate2(jsDate);
|
|
98190
|
+
date.#offset = null;
|
|
98191
|
+
return date;
|
|
98192
|
+
}
|
|
98193
|
+
static wrapAsLocalDate(jsDate) {
|
|
98194
|
+
let date = new _TomlDate2(jsDate);
|
|
98195
|
+
date.#hasTime = false;
|
|
98196
|
+
date.#offset = null;
|
|
98197
|
+
return date;
|
|
98198
|
+
}
|
|
98199
|
+
static wrapAsLocalTime(jsDate) {
|
|
98200
|
+
let date = new _TomlDate2(jsDate);
|
|
98201
|
+
date.#hasDate = false;
|
|
98202
|
+
date.#offset = null;
|
|
98203
|
+
return date;
|
|
98204
|
+
}
|
|
98205
|
+
};
|
|
98190
98206
|
|
|
98191
|
-
// ../../node_modules/.pnpm/
|
|
98192
|
-
var
|
|
98193
|
-
var
|
|
98194
|
-
var
|
|
98195
|
-
var
|
|
98196
|
-
|
|
98197
|
-
|
|
98198
|
-
|
|
98199
|
-
|
|
98200
|
-
|
|
98201
|
-
|
|
98202
|
-
|
|
98203
|
-
|
|
98204
|
-
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
98205
|
-
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
98206
|
-
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
98207
|
-
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
98208
|
-
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
98209
|
-
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
98210
|
-
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
98211
|
-
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
98212
|
-
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
98213
|
-
};
|
|
98214
|
-
var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
98215
|
-
var UnknownBrowserError = class extends Error {
|
|
98207
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/primitive.js
|
|
98208
|
+
var INT_REGEX2 = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
98209
|
+
var FLOAT_REGEX2 = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
98210
|
+
var LEADING_ZERO2 = /^[+-]?0[0-9_]/;
|
|
98211
|
+
var ESCAPE_REGEX2 = /^[0-9a-f]{4,8}$/i;
|
|
98212
|
+
var ESC_MAP2 = {
|
|
98213
|
+
b: "\b",
|
|
98214
|
+
t: " ",
|
|
98215
|
+
n: "\n",
|
|
98216
|
+
f: "\f",
|
|
98217
|
+
r: "\r",
|
|
98218
|
+
'"': '"',
|
|
98219
|
+
"\\": "\\"
|
|
98216
98220
|
};
|
|
98217
|
-
|
|
98218
|
-
|
|
98219
|
-
|
|
98220
|
-
|
|
98221
|
-
|
|
98222
|
-
"
|
|
98223
|
-
|
|
98224
|
-
|
|
98225
|
-
|
|
98226
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout2)}`);
|
|
98221
|
+
function parseString2(str, ptr = 0, endPtr = str.length) {
|
|
98222
|
+
let isLiteral = str[ptr] === "'";
|
|
98223
|
+
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
98224
|
+
if (isMultiline) {
|
|
98225
|
+
endPtr -= 2;
|
|
98226
|
+
if (str[ptr += 2] === "\r")
|
|
98227
|
+
ptr++;
|
|
98228
|
+
if (str[ptr] === "\n")
|
|
98229
|
+
ptr++;
|
|
98227
98230
|
}
|
|
98228
|
-
|
|
98229
|
-
|
|
98230
|
-
|
|
98231
|
-
|
|
98231
|
+
let tmp = 0;
|
|
98232
|
+
let isEscape;
|
|
98233
|
+
let parsed = "";
|
|
98234
|
+
let sliceStart = ptr;
|
|
98235
|
+
while (ptr < endPtr - 1) {
|
|
98236
|
+
let c2 = str[ptr++];
|
|
98237
|
+
if (c2 === "\n" || c2 === "\r" && str[ptr] === "\n") {
|
|
98238
|
+
if (!isMultiline) {
|
|
98239
|
+
throw new TomlError2("newlines are not allowed in strings", {
|
|
98240
|
+
toml: str,
|
|
98241
|
+
ptr: ptr - 1
|
|
98242
|
+
});
|
|
98243
|
+
}
|
|
98244
|
+
} else if (c2 < " " && c2 !== " " || c2 === "\x7F") {
|
|
98245
|
+
throw new TomlError2("control characters are not allowed in strings", {
|
|
98246
|
+
toml: str,
|
|
98247
|
+
ptr: ptr - 1
|
|
98248
|
+
});
|
|
98249
|
+
}
|
|
98250
|
+
if (isEscape) {
|
|
98251
|
+
isEscape = false;
|
|
98252
|
+
if (c2 === "u" || c2 === "U") {
|
|
98253
|
+
let code = str.slice(ptr, ptr += c2 === "u" ? 4 : 8);
|
|
98254
|
+
if (!ESCAPE_REGEX2.test(code)) {
|
|
98255
|
+
throw new TomlError2("invalid unicode escape", {
|
|
98256
|
+
toml: str,
|
|
98257
|
+
ptr: tmp
|
|
98258
|
+
});
|
|
98259
|
+
}
|
|
98260
|
+
try {
|
|
98261
|
+
parsed += String.fromCodePoint(parseInt(code, 16));
|
|
98262
|
+
} catch {
|
|
98263
|
+
throw new TomlError2("invalid unicode escape", {
|
|
98264
|
+
toml: str,
|
|
98265
|
+
ptr: tmp
|
|
98266
|
+
});
|
|
98267
|
+
}
|
|
98268
|
+
} else if (isMultiline && (c2 === "\n" || c2 === " " || c2 === " " || c2 === "\r")) {
|
|
98269
|
+
ptr = skipVoid2(str, ptr - 1, true);
|
|
98270
|
+
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
98271
|
+
throw new TomlError2("invalid escape: only line-ending whitespace may be escaped", {
|
|
98272
|
+
toml: str,
|
|
98273
|
+
ptr: tmp
|
|
98274
|
+
});
|
|
98275
|
+
}
|
|
98276
|
+
ptr = skipVoid2(str, ptr);
|
|
98277
|
+
} else if (c2 in ESC_MAP2) {
|
|
98278
|
+
parsed += ESC_MAP2[c2];
|
|
98279
|
+
} else {
|
|
98280
|
+
throw new TomlError2("unrecognized escape sequence", {
|
|
98281
|
+
toml: str,
|
|
98282
|
+
ptr: tmp
|
|
98283
|
+
});
|
|
98284
|
+
}
|
|
98285
|
+
sliceStart = ptr;
|
|
98286
|
+
} else if (!isLiteral && c2 === "\\") {
|
|
98287
|
+
tmp = ptr - 1;
|
|
98288
|
+
isEscape = true;
|
|
98289
|
+
parsed += str.slice(sliceStart, tmp);
|
|
98290
|
+
}
|
|
98232
98291
|
}
|
|
98233
|
-
return
|
|
98292
|
+
return parsed + str.slice(sliceStart, endPtr - 1);
|
|
98234
98293
|
}
|
|
98235
|
-
|
|
98236
|
-
|
|
98237
|
-
|
|
98238
|
-
|
|
98239
|
-
|
|
98240
|
-
if (
|
|
98241
|
-
|
|
98242
|
-
|
|
98243
|
-
return
|
|
98244
|
-
|
|
98245
|
-
|
|
98246
|
-
|
|
98247
|
-
|
|
98248
|
-
|
|
98249
|
-
|
|
98294
|
+
function parseValue2(value, toml, ptr, integersAsBigInt) {
|
|
98295
|
+
if (value === "true")
|
|
98296
|
+
return true;
|
|
98297
|
+
if (value === "false")
|
|
98298
|
+
return false;
|
|
98299
|
+
if (value === "-inf")
|
|
98300
|
+
return -Infinity;
|
|
98301
|
+
if (value === "inf" || value === "+inf")
|
|
98302
|
+
return Infinity;
|
|
98303
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
98304
|
+
return NaN;
|
|
98305
|
+
if (value === "-0")
|
|
98306
|
+
return integersAsBigInt ? 0n : 0;
|
|
98307
|
+
let isInt = INT_REGEX2.test(value);
|
|
98308
|
+
if (isInt || FLOAT_REGEX2.test(value)) {
|
|
98309
|
+
if (LEADING_ZERO2.test(value)) {
|
|
98310
|
+
throw new TomlError2("leading zeroes are not allowed", {
|
|
98311
|
+
toml,
|
|
98312
|
+
ptr
|
|
98313
|
+
});
|
|
98314
|
+
}
|
|
98315
|
+
value = value.replace(/_/g, "");
|
|
98316
|
+
let numeric = +value;
|
|
98317
|
+
if (isNaN(numeric)) {
|
|
98318
|
+
throw new TomlError2("invalid number", {
|
|
98319
|
+
toml,
|
|
98320
|
+
ptr
|
|
98321
|
+
});
|
|
98322
|
+
}
|
|
98323
|
+
if (isInt) {
|
|
98324
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
98325
|
+
throw new TomlError2("integer value cannot be represented losslessly", {
|
|
98326
|
+
toml,
|
|
98327
|
+
ptr
|
|
98328
|
+
});
|
|
98329
|
+
}
|
|
98330
|
+
if (isInt || integersAsBigInt === true)
|
|
98331
|
+
numeric = BigInt(value);
|
|
98332
|
+
}
|
|
98333
|
+
return numeric;
|
|
98250
98334
|
}
|
|
98251
|
-
|
|
98252
|
-
|
|
98335
|
+
const date = new TomlDate2(value);
|
|
98336
|
+
if (!date.isValid()) {
|
|
98337
|
+
throw new TomlError2("invalid value", {
|
|
98338
|
+
toml,
|
|
98339
|
+
ptr
|
|
98340
|
+
});
|
|
98253
98341
|
}
|
|
98254
|
-
|
|
98342
|
+
return date;
|
|
98255
98343
|
}
|
|
98256
98344
|
|
|
98257
|
-
// ../../node_modules/.pnpm/
|
|
98258
|
-
|
|
98259
|
-
|
|
98260
|
-
|
|
98261
|
-
|
|
98262
|
-
|
|
98263
|
-
|
|
98264
|
-
var fallbackAttemptSymbol = /* @__PURE__ */ Symbol("fallbackAttempt");
|
|
98265
|
-
var __dirname3 = import_meta2.url ? import_node_path9.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)) : "";
|
|
98266
|
-
var localXdgOpenPath = import_node_path9.default.join(__dirname3, "xdg-open");
|
|
98267
|
-
var { platform, arch: arch2 } = import_node_process13.default;
|
|
98268
|
-
var tryEachApp = async (apps2, opener) => {
|
|
98269
|
-
if (apps2.length === 0) {
|
|
98270
|
-
return;
|
|
98345
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/extract.js
|
|
98346
|
+
function sliceAndTrimEndOf2(str, startPtr, endPtr, allowNewLines) {
|
|
98347
|
+
let value = str.slice(startPtr, endPtr);
|
|
98348
|
+
let commentIdx = value.indexOf("#");
|
|
98349
|
+
if (commentIdx > -1) {
|
|
98350
|
+
skipComment2(str, commentIdx);
|
|
98351
|
+
value = value.slice(0, commentIdx);
|
|
98271
98352
|
}
|
|
98272
|
-
|
|
98273
|
-
|
|
98274
|
-
|
|
98275
|
-
|
|
98276
|
-
|
|
98277
|
-
|
|
98353
|
+
let trimmed = value.trimEnd();
|
|
98354
|
+
if (!allowNewLines) {
|
|
98355
|
+
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
98356
|
+
if (newlineIdx > -1) {
|
|
98357
|
+
throw new TomlError2("newlines are not allowed in inline tables", {
|
|
98358
|
+
toml: str,
|
|
98359
|
+
ptr: startPtr + newlineIdx
|
|
98360
|
+
});
|
|
98278
98361
|
}
|
|
98279
98362
|
}
|
|
98280
|
-
|
|
98281
|
-
}
|
|
98282
|
-
|
|
98283
|
-
|
|
98284
|
-
|
|
98285
|
-
|
|
98286
|
-
|
|
98287
|
-
|
|
98288
|
-
...options
|
|
98289
|
-
};
|
|
98290
|
-
const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
|
|
98291
|
-
delete options[fallbackAttemptSymbol];
|
|
98292
|
-
if (Array.isArray(options.app)) {
|
|
98293
|
-
return tryEachApp(options.app, (singleApp) => baseOpen({
|
|
98294
|
-
...options,
|
|
98295
|
-
app: singleApp,
|
|
98296
|
-
[fallbackAttemptSymbol]: true
|
|
98297
|
-
}));
|
|
98363
|
+
return [trimmed, commentIdx];
|
|
98364
|
+
}
|
|
98365
|
+
function extractValue2(str, ptr, end, depth, integersAsBigInt) {
|
|
98366
|
+
if (depth === 0) {
|
|
98367
|
+
throw new TomlError2("document contains excessively nested structures. aborting.", {
|
|
98368
|
+
toml: str,
|
|
98369
|
+
ptr
|
|
98370
|
+
});
|
|
98298
98371
|
}
|
|
98299
|
-
let
|
|
98300
|
-
|
|
98301
|
-
|
|
98302
|
-
|
|
98303
|
-
|
|
98304
|
-
|
|
98305
|
-
|
|
98306
|
-
|
|
98307
|
-
|
|
98308
|
-
|
|
98309
|
-
|
|
98372
|
+
let c2 = str[ptr];
|
|
98373
|
+
if (c2 === "[" || c2 === "{") {
|
|
98374
|
+
let [value, endPtr2] = c2 === "[" ? parseArray2(str, ptr, depth, integersAsBigInt) : parseInlineTable2(str, ptr, depth, integersAsBigInt);
|
|
98375
|
+
let newPtr = end ? skipUntil2(str, endPtr2, ",", end) : endPtr2;
|
|
98376
|
+
if (endPtr2 - newPtr && end === "}") {
|
|
98377
|
+
let nextNewLine = indexOfNewline2(str, endPtr2, newPtr);
|
|
98378
|
+
if (nextNewLine > -1) {
|
|
98379
|
+
throw new TomlError2("newlines are not allowed in inline tables", {
|
|
98380
|
+
toml: str,
|
|
98381
|
+
ptr: nextNewLine
|
|
98382
|
+
});
|
|
98383
|
+
}
|
|
98384
|
+
}
|
|
98385
|
+
return [value, newPtr];
|
|
98310
98386
|
}
|
|
98311
|
-
|
|
98312
|
-
|
|
98313
|
-
|
|
98314
|
-
|
|
98315
|
-
|
|
98316
|
-
|
|
98317
|
-
"
|
|
98318
|
-
|
|
98319
|
-
|
|
98320
|
-
|
|
98321
|
-
|
|
98322
|
-
|
|
98323
|
-
|
|
98324
|
-
const flags = {
|
|
98325
|
-
chrome: "--incognito",
|
|
98326
|
-
brave: "--incognito",
|
|
98327
|
-
firefox: "--private-window",
|
|
98328
|
-
edge: "--inPrivate"
|
|
98329
|
-
// Safari doesn't support private mode via command line
|
|
98330
|
-
};
|
|
98331
|
-
let browser;
|
|
98332
|
-
if (is_wsl_default) {
|
|
98333
|
-
const progId = await wslDefaultBrowser();
|
|
98334
|
-
const browserInfo = _windowsBrowserProgIdMap.get(progId);
|
|
98335
|
-
browser = browserInfo ?? {};
|
|
98336
|
-
} else {
|
|
98337
|
-
browser = await defaultBrowser2();
|
|
98387
|
+
let endPtr;
|
|
98388
|
+
if (c2 === '"' || c2 === "'") {
|
|
98389
|
+
endPtr = getStringEnd2(str, ptr);
|
|
98390
|
+
let parsed = parseString2(str, ptr, endPtr);
|
|
98391
|
+
if (end) {
|
|
98392
|
+
endPtr = skipVoid2(str, endPtr, end !== "]");
|
|
98393
|
+
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
98394
|
+
throw new TomlError2("unexpected character encountered", {
|
|
98395
|
+
toml: str,
|
|
98396
|
+
ptr: endPtr
|
|
98397
|
+
});
|
|
98398
|
+
}
|
|
98399
|
+
endPtr += +(str[endPtr] === ",");
|
|
98338
98400
|
}
|
|
98339
|
-
|
|
98340
|
-
|
|
98341
|
-
|
|
98342
|
-
|
|
98343
|
-
|
|
98401
|
+
return [parsed, endPtr];
|
|
98402
|
+
}
|
|
98403
|
+
endPtr = skipUntil2(str, ptr, ",", end);
|
|
98404
|
+
let slice = sliceAndTrimEndOf2(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
|
|
98405
|
+
if (!slice[0]) {
|
|
98406
|
+
throw new TomlError2("incomplete key-value declaration: no value specified", {
|
|
98407
|
+
toml: str,
|
|
98408
|
+
ptr
|
|
98409
|
+
});
|
|
98410
|
+
}
|
|
98411
|
+
if (end && slice[1] > -1) {
|
|
98412
|
+
endPtr = skipVoid2(str, ptr + slice[1]);
|
|
98413
|
+
endPtr += +(str[endPtr] === ",");
|
|
98414
|
+
}
|
|
98415
|
+
return [
|
|
98416
|
+
parseValue2(slice[0], str, ptr, integersAsBigInt),
|
|
98417
|
+
endPtr
|
|
98418
|
+
];
|
|
98419
|
+
}
|
|
98420
|
+
|
|
98421
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/struct.js
|
|
98422
|
+
var KEY_PART_RE2 = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
98423
|
+
function parseKey2(str, ptr, end = "=") {
|
|
98424
|
+
let dot = ptr - 1;
|
|
98425
|
+
let parsed = [];
|
|
98426
|
+
let endPtr = str.indexOf(end, ptr);
|
|
98427
|
+
if (endPtr < 0) {
|
|
98428
|
+
throw new TomlError2("incomplete key-value: cannot find end of key", {
|
|
98429
|
+
toml: str,
|
|
98430
|
+
ptr
|
|
98431
|
+
});
|
|
98432
|
+
}
|
|
98433
|
+
do {
|
|
98434
|
+
let c2 = str[ptr = ++dot];
|
|
98435
|
+
if (c2 !== " " && c2 !== " ") {
|
|
98436
|
+
if (c2 === '"' || c2 === "'") {
|
|
98437
|
+
if (c2 === str[ptr + 1] && c2 === str[ptr + 2]) {
|
|
98438
|
+
throw new TomlError2("multiline strings are not allowed in keys", {
|
|
98439
|
+
toml: str,
|
|
98440
|
+
ptr
|
|
98441
|
+
});
|
|
98344
98442
|
}
|
|
98345
|
-
|
|
98443
|
+
let eos = getStringEnd2(str, ptr);
|
|
98444
|
+
if (eos < 0) {
|
|
98445
|
+
throw new TomlError2("unfinished string encountered", {
|
|
98446
|
+
toml: str,
|
|
98447
|
+
ptr
|
|
98448
|
+
});
|
|
98449
|
+
}
|
|
98450
|
+
dot = str.indexOf(".", eos);
|
|
98451
|
+
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
98452
|
+
let newLine = indexOfNewline2(strEnd);
|
|
98453
|
+
if (newLine > -1) {
|
|
98454
|
+
throw new TomlError2("newlines are not allowed in keys", {
|
|
98455
|
+
toml: str,
|
|
98456
|
+
ptr: ptr + dot + newLine
|
|
98457
|
+
});
|
|
98458
|
+
}
|
|
98459
|
+
if (strEnd.trimStart()) {
|
|
98460
|
+
throw new TomlError2("found extra tokens after the string part", {
|
|
98461
|
+
toml: str,
|
|
98462
|
+
ptr: eos
|
|
98463
|
+
});
|
|
98464
|
+
}
|
|
98465
|
+
if (endPtr < eos) {
|
|
98466
|
+
endPtr = str.indexOf(end, eos);
|
|
98467
|
+
if (endPtr < 0) {
|
|
98468
|
+
throw new TomlError2("incomplete key-value: cannot find end of key", {
|
|
98469
|
+
toml: str,
|
|
98470
|
+
ptr
|
|
98471
|
+
});
|
|
98472
|
+
}
|
|
98473
|
+
}
|
|
98474
|
+
parsed.push(parseString2(str, ptr, eos));
|
|
98475
|
+
} else {
|
|
98476
|
+
dot = str.indexOf(".", ptr);
|
|
98477
|
+
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
98478
|
+
if (!KEY_PART_RE2.test(part)) {
|
|
98479
|
+
throw new TomlError2("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
98480
|
+
toml: str,
|
|
98481
|
+
ptr
|
|
98482
|
+
});
|
|
98483
|
+
}
|
|
98484
|
+
parsed.push(part.trimEnd());
|
|
98346
98485
|
}
|
|
98347
|
-
|
|
98348
|
-
|
|
98349
|
-
|
|
98350
|
-
|
|
98351
|
-
|
|
98486
|
+
}
|
|
98487
|
+
} while (dot + 1 && dot < endPtr);
|
|
98488
|
+
return [parsed, skipVoid2(str, endPtr + 1, true, true)];
|
|
98489
|
+
}
|
|
98490
|
+
function parseInlineTable2(str, ptr, depth, integersAsBigInt) {
|
|
98491
|
+
let res = {};
|
|
98492
|
+
let seen = /* @__PURE__ */ new Set();
|
|
98493
|
+
let c2;
|
|
98494
|
+
let comma = 0;
|
|
98495
|
+
ptr++;
|
|
98496
|
+
while ((c2 = str[ptr++]) !== "}" && c2) {
|
|
98497
|
+
let err = { toml: str, ptr: ptr - 1 };
|
|
98498
|
+
if (c2 === "\n") {
|
|
98499
|
+
throw new TomlError2("newlines are not allowed in inline tables", err);
|
|
98500
|
+
} else if (c2 === "#") {
|
|
98501
|
+
throw new TomlError2("inline tables cannot contain comments", err);
|
|
98502
|
+
} else if (c2 === ",") {
|
|
98503
|
+
throw new TomlError2("expected key-value, found comma", err);
|
|
98504
|
+
} else if (c2 !== " " && c2 !== " ") {
|
|
98505
|
+
let k;
|
|
98506
|
+
let t2 = res;
|
|
98507
|
+
let hasOwn = false;
|
|
98508
|
+
let [key, keyEndPtr] = parseKey2(str, ptr - 1);
|
|
98509
|
+
for (let i = 0; i < key.length; i++) {
|
|
98510
|
+
if (i)
|
|
98511
|
+
t2 = hasOwn ? t2[k] : t2[k] = {};
|
|
98512
|
+
k = key[i];
|
|
98513
|
+
if ((hasOwn = Object.hasOwn(t2, k)) && (typeof t2[k] !== "object" || seen.has(t2[k]))) {
|
|
98514
|
+
throw new TomlError2("trying to redefine an already defined value", {
|
|
98515
|
+
toml: str,
|
|
98516
|
+
ptr
|
|
98517
|
+
});
|
|
98352
98518
|
}
|
|
98353
|
-
|
|
98519
|
+
if (!hasOwn && k === "__proto__") {
|
|
98520
|
+
Object.defineProperty(t2, k, { enumerable: true, configurable: true, writable: true });
|
|
98521
|
+
}
|
|
98522
|
+
}
|
|
98523
|
+
if (hasOwn) {
|
|
98524
|
+
throw new TomlError2("trying to redefine an already defined value", {
|
|
98525
|
+
toml: str,
|
|
98526
|
+
ptr
|
|
98527
|
+
});
|
|
98528
|
+
}
|
|
98529
|
+
let [value, valueEndPtr] = extractValue2(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
98530
|
+
seen.add(value);
|
|
98531
|
+
t2[k] = value;
|
|
98532
|
+
ptr = valueEndPtr;
|
|
98533
|
+
comma = str[ptr - 1] === "," ? ptr - 1 : 0;
|
|
98354
98534
|
}
|
|
98355
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
98356
98535
|
}
|
|
98357
|
-
|
|
98358
|
-
|
|
98359
|
-
|
|
98360
|
-
|
|
98361
|
-
|
|
98362
|
-
shouldUseWindowsInWsl = await canAccessPowerShell();
|
|
98536
|
+
if (comma) {
|
|
98537
|
+
throw new TomlError2("trailing commas are not allowed in inline tables", {
|
|
98538
|
+
toml: str,
|
|
98539
|
+
ptr: comma
|
|
98540
|
+
});
|
|
98363
98541
|
}
|
|
98364
|
-
if (
|
|
98365
|
-
|
|
98366
|
-
|
|
98367
|
-
|
|
98368
|
-
}
|
|
98369
|
-
|
|
98370
|
-
|
|
98371
|
-
|
|
98372
|
-
|
|
98373
|
-
|
|
98374
|
-
|
|
98375
|
-
|
|
98376
|
-
|
|
98377
|
-
|
|
98378
|
-
|
|
98379
|
-
|
|
98380
|
-
|
|
98381
|
-
|
|
98382
|
-
|
|
98542
|
+
if (!c2) {
|
|
98543
|
+
throw new TomlError2("unfinished table encountered", {
|
|
98544
|
+
toml: str,
|
|
98545
|
+
ptr
|
|
98546
|
+
});
|
|
98547
|
+
}
|
|
98548
|
+
return [res, ptr];
|
|
98549
|
+
}
|
|
98550
|
+
function parseArray2(str, ptr, depth, integersAsBigInt) {
|
|
98551
|
+
let res = [];
|
|
98552
|
+
let c2;
|
|
98553
|
+
ptr++;
|
|
98554
|
+
while ((c2 = str[ptr++]) !== "]" && c2) {
|
|
98555
|
+
if (c2 === ",") {
|
|
98556
|
+
throw new TomlError2("expected value, found comma", {
|
|
98557
|
+
toml: str,
|
|
98558
|
+
ptr: ptr - 1
|
|
98559
|
+
});
|
|
98560
|
+
} else if (c2 === "#")
|
|
98561
|
+
ptr = skipComment2(str, ptr);
|
|
98562
|
+
else if (c2 !== " " && c2 !== " " && c2 !== "\n" && c2 !== "\r") {
|
|
98563
|
+
let e = extractValue2(str, ptr - 1, "]", depth - 1, integersAsBigInt);
|
|
98564
|
+
res.push(e[0]);
|
|
98565
|
+
ptr = e[1];
|
|
98383
98566
|
}
|
|
98384
|
-
|
|
98385
|
-
|
|
98567
|
+
}
|
|
98568
|
+
if (!c2) {
|
|
98569
|
+
throw new TomlError2("unfinished array encountered", {
|
|
98570
|
+
toml: str,
|
|
98571
|
+
ptr
|
|
98572
|
+
});
|
|
98573
|
+
}
|
|
98574
|
+
return [res, ptr];
|
|
98575
|
+
}
|
|
98576
|
+
|
|
98577
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/parse.js
|
|
98578
|
+
function peekTable2(key, table, meta, type) {
|
|
98579
|
+
let t2 = table;
|
|
98580
|
+
let m = meta;
|
|
98581
|
+
let k;
|
|
98582
|
+
let hasOwn = false;
|
|
98583
|
+
let state;
|
|
98584
|
+
for (let i = 0; i < key.length; i++) {
|
|
98585
|
+
if (i) {
|
|
98586
|
+
t2 = hasOwn ? t2[k] : t2[k] = {};
|
|
98587
|
+
m = (state = m[k]).c;
|
|
98588
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
98589
|
+
return null;
|
|
98590
|
+
}
|
|
98591
|
+
if (state.t === 2) {
|
|
98592
|
+
let l = t2.length - 1;
|
|
98593
|
+
t2 = t2[l];
|
|
98594
|
+
m = m[l].c;
|
|
98595
|
+
}
|
|
98386
98596
|
}
|
|
98387
|
-
|
|
98388
|
-
if (
|
|
98389
|
-
|
|
98597
|
+
k = key[i];
|
|
98598
|
+
if ((hasOwn = Object.hasOwn(t2, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
98599
|
+
return null;
|
|
98390
98600
|
}
|
|
98391
|
-
if (
|
|
98392
|
-
|
|
98393
|
-
|
|
98394
|
-
|
|
98601
|
+
if (!hasOwn) {
|
|
98602
|
+
if (k === "__proto__") {
|
|
98603
|
+
Object.defineProperty(t2, k, { enumerable: true, configurable: true, writable: true });
|
|
98604
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
98395
98605
|
}
|
|
98396
|
-
|
|
98397
|
-
|
|
98398
|
-
|
|
98399
|
-
|
|
98400
|
-
|
|
98401
|
-
|
|
98606
|
+
m[k] = {
|
|
98607
|
+
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
98608
|
+
d: false,
|
|
98609
|
+
i: 0,
|
|
98610
|
+
c: {}
|
|
98611
|
+
};
|
|
98402
98612
|
}
|
|
98403
|
-
|
|
98404
|
-
|
|
98405
|
-
|
|
98613
|
+
}
|
|
98614
|
+
state = m[k];
|
|
98615
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
98616
|
+
return null;
|
|
98617
|
+
}
|
|
98618
|
+
if (type === 2) {
|
|
98619
|
+
if (!state.d) {
|
|
98620
|
+
state.d = true;
|
|
98621
|
+
t2[k] = [];
|
|
98406
98622
|
}
|
|
98407
|
-
|
|
98408
|
-
|
|
98409
|
-
|
|
98623
|
+
t2[k].push(t2 = {});
|
|
98624
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
98625
|
+
}
|
|
98626
|
+
if (state.d) {
|
|
98627
|
+
return null;
|
|
98628
|
+
}
|
|
98629
|
+
state.d = true;
|
|
98630
|
+
if (type === 1) {
|
|
98631
|
+
t2 = hasOwn ? t2[k] : t2[k] = {};
|
|
98632
|
+
} else if (type === 0 && hasOwn) {
|
|
98633
|
+
return null;
|
|
98634
|
+
}
|
|
98635
|
+
return [k, t2, state.c];
|
|
98636
|
+
}
|
|
98637
|
+
function parse4(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
98638
|
+
let res = {};
|
|
98639
|
+
let meta = {};
|
|
98640
|
+
let tbl = res;
|
|
98641
|
+
let m = meta;
|
|
98642
|
+
for (let ptr = skipVoid2(toml, 0); ptr < toml.length; ) {
|
|
98643
|
+
if (toml[ptr] === "[") {
|
|
98644
|
+
let isTableArray = toml[++ptr] === "[";
|
|
98645
|
+
let k = parseKey2(toml, ptr += +isTableArray, "]");
|
|
98646
|
+
if (isTableArray) {
|
|
98647
|
+
if (toml[k[1] - 1] !== "]") {
|
|
98648
|
+
throw new TomlError2("expected end of table declaration", {
|
|
98649
|
+
toml,
|
|
98650
|
+
ptr: k[1] - 1
|
|
98651
|
+
});
|
|
98652
|
+
}
|
|
98653
|
+
k[1]++;
|
|
98654
|
+
}
|
|
98655
|
+
let p2 = peekTable2(
|
|
98656
|
+
k[0],
|
|
98657
|
+
res,
|
|
98658
|
+
meta,
|
|
98659
|
+
isTableArray ? 2 : 1
|
|
98660
|
+
/* Type.EXPLICIT */
|
|
98661
|
+
);
|
|
98662
|
+
if (!p2) {
|
|
98663
|
+
throw new TomlError2("trying to redefine an already defined table or value", {
|
|
98664
|
+
toml,
|
|
98665
|
+
ptr
|
|
98666
|
+
});
|
|
98667
|
+
}
|
|
98668
|
+
m = p2[2];
|
|
98669
|
+
tbl = p2[1];
|
|
98670
|
+
ptr = k[1];
|
|
98410
98671
|
} else {
|
|
98411
|
-
|
|
98412
|
-
let
|
|
98413
|
-
|
|
98414
|
-
|
|
98415
|
-
|
|
98416
|
-
|
|
98672
|
+
let k = parseKey2(toml, ptr);
|
|
98673
|
+
let p2 = peekTable2(
|
|
98674
|
+
k[0],
|
|
98675
|
+
tbl,
|
|
98676
|
+
m,
|
|
98677
|
+
0
|
|
98678
|
+
/* Type.DOTTED */
|
|
98679
|
+
);
|
|
98680
|
+
if (!p2) {
|
|
98681
|
+
throw new TomlError2("trying to redefine an already defined table or value", {
|
|
98682
|
+
toml,
|
|
98683
|
+
ptr
|
|
98684
|
+
});
|
|
98417
98685
|
}
|
|
98418
|
-
|
|
98419
|
-
|
|
98420
|
-
|
|
98421
|
-
if (appArguments.length > 0) {
|
|
98422
|
-
cliArguments.push(...appArguments);
|
|
98686
|
+
let v = extractValue2(toml, k[1], void 0, maxDepth, integersAsBigInt);
|
|
98687
|
+
p2[1][p2[0]] = v[0];
|
|
98688
|
+
ptr = v[1];
|
|
98423
98689
|
}
|
|
98424
|
-
|
|
98425
|
-
|
|
98426
|
-
|
|
98690
|
+
ptr = skipVoid2(toml, ptr, true);
|
|
98691
|
+
if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
|
|
98692
|
+
throw new TomlError2("each key-value declaration must be followed by an end-of-line", {
|
|
98693
|
+
toml,
|
|
98694
|
+
ptr
|
|
98695
|
+
});
|
|
98427
98696
|
}
|
|
98697
|
+
ptr = skipVoid2(toml, ptr);
|
|
98428
98698
|
}
|
|
98429
|
-
|
|
98430
|
-
|
|
98699
|
+
return res;
|
|
98700
|
+
}
|
|
98701
|
+
|
|
98702
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/stringify.js
|
|
98703
|
+
var BARE_KEY2 = /^[a-z0-9-_]+$/i;
|
|
98704
|
+
function extendedTypeOf2(obj) {
|
|
98705
|
+
let type = typeof obj;
|
|
98706
|
+
if (type === "object") {
|
|
98707
|
+
if (Array.isArray(obj))
|
|
98708
|
+
return "array";
|
|
98709
|
+
if (obj instanceof Date)
|
|
98710
|
+
return "date";
|
|
98431
98711
|
}
|
|
98432
|
-
|
|
98433
|
-
|
|
98712
|
+
return type;
|
|
98713
|
+
}
|
|
98714
|
+
function isArrayOfTables2(obj) {
|
|
98715
|
+
for (let i = 0; i < obj.length; i++) {
|
|
98716
|
+
if (extendedTypeOf2(obj[i]) !== "object")
|
|
98717
|
+
return false;
|
|
98434
98718
|
}
|
|
98435
|
-
|
|
98436
|
-
|
|
98437
|
-
|
|
98438
|
-
|
|
98439
|
-
|
|
98440
|
-
|
|
98441
|
-
|
|
98442
|
-
|
|
98443
|
-
}
|
|
98444
|
-
resolve13(subprocess);
|
|
98445
|
-
});
|
|
98446
|
-
});
|
|
98719
|
+
return obj.length != 0;
|
|
98720
|
+
}
|
|
98721
|
+
function formatString2(s) {
|
|
98722
|
+
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
98723
|
+
}
|
|
98724
|
+
function stringifyValue2(val, type, depth, numberAsFloat) {
|
|
98725
|
+
if (depth === 0) {
|
|
98726
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
98447
98727
|
}
|
|
98448
|
-
if (
|
|
98449
|
-
|
|
98450
|
-
|
|
98451
|
-
|
|
98452
|
-
|
|
98453
|
-
|
|
98454
|
-
|
|
98455
|
-
|
|
98456
|
-
|
|
98457
|
-
|
|
98458
|
-
subprocess.unref();
|
|
98459
|
-
resolve13(subprocess);
|
|
98460
|
-
});
|
|
98461
|
-
});
|
|
98462
|
-
});
|
|
98728
|
+
if (type === "number") {
|
|
98729
|
+
if (isNaN(val))
|
|
98730
|
+
return "nan";
|
|
98731
|
+
if (val === Infinity)
|
|
98732
|
+
return "inf";
|
|
98733
|
+
if (val === -Infinity)
|
|
98734
|
+
return "-inf";
|
|
98735
|
+
if (numberAsFloat && Number.isInteger(val))
|
|
98736
|
+
return val.toFixed(1);
|
|
98737
|
+
return val.toString();
|
|
98463
98738
|
}
|
|
98464
|
-
|
|
98465
|
-
|
|
98466
|
-
subprocess.once("error", reject);
|
|
98467
|
-
subprocess.once("spawn", () => {
|
|
98468
|
-
subprocess.off("error", reject);
|
|
98469
|
-
resolve13(subprocess);
|
|
98470
|
-
});
|
|
98471
|
-
});
|
|
98472
|
-
};
|
|
98473
|
-
var open = (target, options) => {
|
|
98474
|
-
if (typeof target !== "string") {
|
|
98475
|
-
throw new TypeError("Expected a `target`");
|
|
98739
|
+
if (type === "bigint" || type === "boolean") {
|
|
98740
|
+
return val.toString();
|
|
98476
98741
|
}
|
|
98477
|
-
|
|
98478
|
-
|
|
98479
|
-
target
|
|
98480
|
-
});
|
|
98481
|
-
};
|
|
98482
|
-
function detectArchBinary(binary) {
|
|
98483
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
98484
|
-
return binary;
|
|
98742
|
+
if (type === "string") {
|
|
98743
|
+
return formatString2(val);
|
|
98485
98744
|
}
|
|
98486
|
-
|
|
98487
|
-
|
|
98488
|
-
|
|
98745
|
+
if (type === "date") {
|
|
98746
|
+
if (isNaN(val.getTime())) {
|
|
98747
|
+
throw new TypeError("cannot serialize invalid date");
|
|
98748
|
+
}
|
|
98749
|
+
return val.toISOString();
|
|
98489
98750
|
}
|
|
98490
|
-
|
|
98491
|
-
|
|
98492
|
-
function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
|
|
98493
|
-
if (wsl && is_wsl_default) {
|
|
98494
|
-
return detectArchBinary(wsl);
|
|
98751
|
+
if (type === "object") {
|
|
98752
|
+
return stringifyInlineTable2(val, depth, numberAsFloat);
|
|
98495
98753
|
}
|
|
98496
|
-
if (
|
|
98497
|
-
|
|
98754
|
+
if (type === "array") {
|
|
98755
|
+
return stringifyArray2(val, depth, numberAsFloat);
|
|
98498
98756
|
}
|
|
98499
|
-
return detectArchBinary(platformBinary);
|
|
98500
98757
|
}
|
|
98501
|
-
|
|
98502
|
-
|
|
98503
|
-
|
|
98504
|
-
};
|
|
98505
|
-
|
|
98506
|
-
|
|
98507
|
-
|
|
98508
|
-
|
|
98509
|
-
|
|
98510
|
-
|
|
98511
|
-
|
|
98512
|
-
|
|
98513
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
98758
|
+
function stringifyInlineTable2(obj, depth, numberAsFloat) {
|
|
98759
|
+
let keys = Object.keys(obj);
|
|
98760
|
+
if (keys.length === 0)
|
|
98761
|
+
return "{}";
|
|
98762
|
+
let res = "{ ";
|
|
98763
|
+
for (let i = 0; i < keys.length; i++) {
|
|
98764
|
+
let k = keys[i];
|
|
98765
|
+
if (i)
|
|
98766
|
+
res += ", ";
|
|
98767
|
+
res += BARE_KEY2.test(k) ? k : formatString2(k);
|
|
98768
|
+
res += " = ";
|
|
98769
|
+
res += stringifyValue2(obj[k], extendedTypeOf2(obj[k]), depth - 1, numberAsFloat);
|
|
98514
98770
|
}
|
|
98515
|
-
}
|
|
98516
|
-
|
|
98517
|
-
|
|
98518
|
-
|
|
98519
|
-
|
|
98520
|
-
|
|
98521
|
-
|
|
98522
|
-
|
|
98523
|
-
|
|
98771
|
+
return res + " }";
|
|
98772
|
+
}
|
|
98773
|
+
function stringifyArray2(array, depth, numberAsFloat) {
|
|
98774
|
+
if (array.length === 0)
|
|
98775
|
+
return "[]";
|
|
98776
|
+
let res = "[ ";
|
|
98777
|
+
for (let i = 0; i < array.length; i++) {
|
|
98778
|
+
if (i)
|
|
98779
|
+
res += ", ";
|
|
98780
|
+
if (array[i] === null || array[i] === void 0) {
|
|
98781
|
+
throw new TypeError("arrays cannot contain null or undefined values");
|
|
98782
|
+
}
|
|
98783
|
+
res += stringifyValue2(array[i], extendedTypeOf2(array[i]), depth - 1, numberAsFloat);
|
|
98524
98784
|
}
|
|
98525
|
-
|
|
98526
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
98527
|
-
darwin: "firefox",
|
|
98528
|
-
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
98529
|
-
linux: "firefox"
|
|
98530
|
-
}, {
|
|
98531
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
98532
|
-
}));
|
|
98533
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
98534
|
-
darwin: "microsoft edge",
|
|
98535
|
-
win32: "msedge",
|
|
98536
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
98537
|
-
}, {
|
|
98538
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
98539
|
-
}));
|
|
98540
|
-
defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
98541
|
-
darwin: "Safari"
|
|
98542
|
-
}));
|
|
98543
|
-
var open_default = open;
|
|
98544
|
-
|
|
98545
|
-
// src/helpers/cli.ts
|
|
98546
|
-
var import_semver2 = __toESM(require_semver2());
|
|
98547
|
-
async function openInBrowser(url) {
|
|
98548
|
-
updateStatus("Opening browser");
|
|
98549
|
-
const childProcess4 = await open_default(url);
|
|
98550
|
-
childProcess4.on("error", () => {
|
|
98551
|
-
warn("Failed to open browser");
|
|
98552
|
-
});
|
|
98785
|
+
return res + " ]";
|
|
98553
98786
|
}
|
|
98554
|
-
|
|
98555
|
-
|
|
98556
|
-
|
|
98557
|
-
try {
|
|
98558
|
-
const latestVersion = await getLatestPackageVersion("create-cloudflare");
|
|
98559
|
-
return (
|
|
98560
|
-
// Don't auto-update to major versions
|
|
98561
|
-
import_semver2.default.diff(latestVersion, version) !== "major" && import_semver2.default.gt(latestVersion, version)
|
|
98562
|
-
);
|
|
98563
|
-
} catch {
|
|
98564
|
-
s.update("Failed to read latest version from npm.");
|
|
98565
|
-
return false;
|
|
98566
|
-
} finally {
|
|
98567
|
-
s.stop();
|
|
98787
|
+
function stringifyArrayTable2(array, key, depth, numberAsFloat) {
|
|
98788
|
+
if (depth === 0) {
|
|
98789
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
98568
98790
|
}
|
|
98569
|
-
|
|
98570
|
-
|
|
98571
|
-
|
|
98572
|
-
|
|
98573
|
-
|
|
98574
|
-
|
|
98575
|
-
|
|
98576
|
-
autoUpdate: true,
|
|
98577
|
-
deploy: false,
|
|
98578
|
-
git: true,
|
|
98579
|
-
agents: true,
|
|
98580
|
-
open: true,
|
|
98581
|
-
lang: "ts",
|
|
98582
|
-
template: "cloudflare/workers-sdk/packages/create-cloudflare/templates/hello-world-with-assets"
|
|
98583
|
-
};
|
|
98584
|
-
var WRANGLER_DEFAULTS = {
|
|
98585
|
-
...C3_DEFAULTS,
|
|
98586
|
-
type: "hello-world-with-assets",
|
|
98587
|
-
deploy: false
|
|
98588
|
-
};
|
|
98589
|
-
|
|
98590
|
-
// src/helpers/files.ts
|
|
98591
|
-
var import_node_fs11 = __toESM(require("node:fs"));
|
|
98592
|
-
var import_node_path10 = require("node:path");
|
|
98593
|
-
var import_comment_json = __toESM(require_src3());
|
|
98594
|
-
|
|
98595
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/error.js
|
|
98596
|
-
function getLineColFromPtr2(string, ptr) {
|
|
98597
|
-
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
98598
|
-
return [lines.length, lines.pop().length + 1];
|
|
98791
|
+
let res = "";
|
|
98792
|
+
for (let i = 0; i < array.length; i++) {
|
|
98793
|
+
res += `${res && "\n"}[[${key}]]
|
|
98794
|
+
`;
|
|
98795
|
+
res += stringifyTable2(0, array[i], key, depth, numberAsFloat);
|
|
98796
|
+
}
|
|
98797
|
+
return res;
|
|
98599
98798
|
}
|
|
98600
|
-
function
|
|
98601
|
-
|
|
98602
|
-
|
|
98603
|
-
|
|
98604
|
-
|
|
98605
|
-
|
|
98606
|
-
|
|
98607
|
-
|
|
98608
|
-
|
|
98609
|
-
|
|
98610
|
-
|
|
98611
|
-
|
|
98612
|
-
|
|
98613
|
-
|
|
98614
|
-
|
|
98799
|
+
function stringifyTable2(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
98800
|
+
if (depth === 0) {
|
|
98801
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
98802
|
+
}
|
|
98803
|
+
let preamble = "";
|
|
98804
|
+
let tables = "";
|
|
98805
|
+
let keys = Object.keys(obj);
|
|
98806
|
+
for (let i = 0; i < keys.length; i++) {
|
|
98807
|
+
let k = keys[i];
|
|
98808
|
+
if (obj[k] !== null && obj[k] !== void 0) {
|
|
98809
|
+
let type = extendedTypeOf2(obj[k]);
|
|
98810
|
+
if (type === "symbol" || type === "function") {
|
|
98811
|
+
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
98812
|
+
}
|
|
98813
|
+
let key = BARE_KEY2.test(k) ? k : formatString2(k);
|
|
98814
|
+
if (type === "array" && isArrayOfTables2(obj[k])) {
|
|
98815
|
+
tables += (tables && "\n") + stringifyArrayTable2(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
98816
|
+
} else if (type === "object") {
|
|
98817
|
+
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
98818
|
+
tables += (tables && "\n") + stringifyTable2(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
98819
|
+
} else {
|
|
98820
|
+
preamble += key;
|
|
98821
|
+
preamble += " = ";
|
|
98822
|
+
preamble += stringifyValue2(obj[k], type, depth, numberAsFloat);
|
|
98823
|
+
preamble += "\n";
|
|
98824
|
+
}
|
|
98615
98825
|
}
|
|
98616
98826
|
}
|
|
98617
|
-
|
|
98827
|
+
if (tableKey && (preamble || !tables))
|
|
98828
|
+
preamble = preamble ? `[${tableKey}]
|
|
98829
|
+
${preamble}` : `[${tableKey}]`;
|
|
98830
|
+
return preamble && tables ? `${preamble}
|
|
98831
|
+
${tables}` : preamble || tables;
|
|
98832
|
+
}
|
|
98833
|
+
function stringify2(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
98834
|
+
if (extendedTypeOf2(obj) !== "object") {
|
|
98835
|
+
throw new TypeError("stringify can only be called with an object");
|
|
98836
|
+
}
|
|
98837
|
+
let str = stringifyTable2(0, obj, "", maxDepth, numbersAsFloat);
|
|
98838
|
+
if (str[str.length - 1] !== "\n")
|
|
98839
|
+
return str + "\n";
|
|
98840
|
+
return str;
|
|
98618
98841
|
}
|
|
98619
|
-
var TomlError2 = class extends Error {
|
|
98620
|
-
line;
|
|
98621
|
-
column;
|
|
98622
|
-
codeblock;
|
|
98623
|
-
constructor(message, options) {
|
|
98624
|
-
const [line, column] = getLineColFromPtr2(options.toml, options.ptr);
|
|
98625
|
-
const codeblock = makeCodeBlock2(options.toml, line, column);
|
|
98626
|
-
super(`Invalid TOML document: ${message}
|
|
98627
98842
|
|
|
98628
|
-
|
|
98629
|
-
|
|
98630
|
-
|
|
98631
|
-
|
|
98843
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/index.js
|
|
98844
|
+
var dist_default4 = { parse: parse4, stringify: stringify2, TomlDate: TomlDate2, TomlError: TomlError2 };
|
|
98845
|
+
|
|
98846
|
+
// src/helpers/files.ts
|
|
98847
|
+
var writeFile3 = (path6, content) => {
|
|
98848
|
+
try {
|
|
98849
|
+
import_node_fs7.default.writeFileSync(path6, content);
|
|
98850
|
+
} catch (error2) {
|
|
98851
|
+
throw new Error(error2);
|
|
98852
|
+
}
|
|
98853
|
+
};
|
|
98854
|
+
var readFile = (path6) => {
|
|
98855
|
+
try {
|
|
98856
|
+
return import_node_fs7.default.readFileSync(path6, "utf-8");
|
|
98857
|
+
} catch (error2) {
|
|
98858
|
+
throw new Error(error2);
|
|
98859
|
+
}
|
|
98860
|
+
};
|
|
98861
|
+
var removeFile = (path6) => {
|
|
98862
|
+
try {
|
|
98863
|
+
import_node_fs7.default.rmSync(path6, { force: true });
|
|
98864
|
+
} catch (error2) {
|
|
98865
|
+
throw new Error(`Remove file failed: ${path6}`, { cause: error2 });
|
|
98632
98866
|
}
|
|
98633
98867
|
};
|
|
98868
|
+
var readJSON = (path6) => {
|
|
98869
|
+
const contents = readFile(path6);
|
|
98870
|
+
return contents ? (0, import_comment_json.parse)(contents) : contents;
|
|
98871
|
+
};
|
|
98872
|
+
var writeJSON = (path6, object, stringifySpace = " ") => {
|
|
98873
|
+
writeFile3(path6, (0, import_comment_json.stringify)(object, null, stringifySpace));
|
|
98874
|
+
};
|
|
98875
|
+
var usesTypescript = (ctx) => {
|
|
98876
|
+
return hasTsConfig(ctx.project.path);
|
|
98877
|
+
};
|
|
98878
|
+
var hasTsConfig = (path6) => {
|
|
98879
|
+
return (0, import_node_fs7.existsSync)((0, import_node_path8.join)(`${path6}`, `tsconfig.json`));
|
|
98880
|
+
};
|
|
98634
98881
|
|
|
98635
|
-
//
|
|
98636
|
-
|
|
98637
|
-
|
|
98638
|
-
|
|
98639
|
-
|
|
98640
|
-
|
|
98641
|
-
|
|
98642
|
-
function indexOfNewline2(str, start = 0, end = str.length) {
|
|
98643
|
-
let idx = str.indexOf("\n", start);
|
|
98644
|
-
if (str[idx - 1] === "\r")
|
|
98645
|
-
idx--;
|
|
98646
|
-
return idx <= end ? idx : -1;
|
|
98647
|
-
}
|
|
98648
|
-
function skipComment2(str, ptr) {
|
|
98649
|
-
for (let i = ptr; i < str.length; i++) {
|
|
98650
|
-
let c2 = str[i];
|
|
98651
|
-
if (c2 === "\n")
|
|
98652
|
-
return i;
|
|
98653
|
-
if (c2 === "\r" && str[i + 1] === "\n")
|
|
98654
|
-
return i + 1;
|
|
98655
|
-
if (c2 < " " && c2 !== " " || c2 === "\x7F") {
|
|
98656
|
-
throw new TomlError2("control characters are not allowed in comments", {
|
|
98657
|
-
toml: str,
|
|
98658
|
-
ptr
|
|
98659
|
-
});
|
|
98660
|
-
}
|
|
98882
|
+
// src/helpers/pnpmBuildApprovals.ts
|
|
98883
|
+
var APPROVED_BUILDS = ["esbuild", "workerd", "sharp"];
|
|
98884
|
+
var APPROVED_BUILDS_SET = new Set(APPROVED_BUILDS);
|
|
98885
|
+
var writePnpmBuildApprovals = (projectPath) => {
|
|
98886
|
+
const { npm: npm25 } = detectPackageManager();
|
|
98887
|
+
if (npm25 !== "pnpm") {
|
|
98888
|
+
return;
|
|
98661
98889
|
}
|
|
98662
|
-
|
|
98663
|
-
|
|
98664
|
-
|
|
98665
|
-
|
|
98666
|
-
while ((c2 = str[ptr]) === " " || c2 === " " || !banNewLines && (c2 === "\n" || c2 === "\r" && str[ptr + 1] === "\n"))
|
|
98667
|
-
ptr++;
|
|
98668
|
-
return banComments || c2 !== "#" ? ptr : skipVoid2(str, skipComment2(str, ptr), banNewLines);
|
|
98669
|
-
}
|
|
98670
|
-
function skipUntil2(str, ptr, sep, end, banNewLines = false) {
|
|
98671
|
-
if (!end) {
|
|
98672
|
-
ptr = indexOfNewline2(str, ptr);
|
|
98673
|
-
return ptr < 0 ? str.length : ptr;
|
|
98890
|
+
const yamlPath = (0, import_node_path9.join)(projectPath, "pnpm-workspace.yaml");
|
|
98891
|
+
if (!(0, import_node_fs8.existsSync)(yamlPath)) {
|
|
98892
|
+
writeFile3(yamlPath, freshWorkspaceYaml());
|
|
98893
|
+
return;
|
|
98674
98894
|
}
|
|
98675
|
-
|
|
98676
|
-
|
|
98677
|
-
|
|
98678
|
-
|
|
98679
|
-
} else if (c2 === sep) {
|
|
98680
|
-
return i + 1;
|
|
98681
|
-
} else if (c2 === end || banNewLines && (c2 === "\n" || c2 === "\r" && str[i + 1] === "\n")) {
|
|
98682
|
-
return i;
|
|
98683
|
-
}
|
|
98895
|
+
const original = readFile(yamlPath);
|
|
98896
|
+
const updated = mergeAllowBuilds(original);
|
|
98897
|
+
if (updated !== original) {
|
|
98898
|
+
writeFile3(yamlPath, updated);
|
|
98684
98899
|
}
|
|
98685
|
-
|
|
98686
|
-
|
|
98687
|
-
|
|
98688
|
-
|
|
98689
|
-
|
|
98690
|
-
|
|
98691
|
-
|
|
98692
|
-
|
|
98693
|
-
|
|
98694
|
-
|
|
98695
|
-
|
|
98696
|
-
|
|
98697
|
-
|
|
98698
|
-
|
|
98699
|
-
|
|
98700
|
-
|
|
98701
|
-
|
|
98702
|
-
|
|
98703
|
-
|
|
98900
|
+
};
|
|
98901
|
+
var FRESH_HEADER = [
|
|
98902
|
+
"# Pre-approve build scripts for the packages C3 itself installs that need",
|
|
98903
|
+
"# them: `workerd` downloads the platform binary, `esbuild` and `sharp`",
|
|
98904
|
+
"# (via miniflare) download/build native bindings. Without these, pnpm 11+",
|
|
98905
|
+
"# aborts the install with ERR_PNPM_IGNORED_BUILDS."
|
|
98906
|
+
];
|
|
98907
|
+
var formatEntry = (pkg) => pkg.startsWith("@") ? ` '${pkg}': true` : ` ${pkg}: true`;
|
|
98908
|
+
var freshWorkspaceYaml = () => [
|
|
98909
|
+
...FRESH_HEADER,
|
|
98910
|
+
"allowBuilds:",
|
|
98911
|
+
...APPROVED_BUILDS.map(formatEntry),
|
|
98912
|
+
""
|
|
98913
|
+
].join("\n");
|
|
98914
|
+
var ALLOW_BUILDS_ENTRY = /^( {2})(['"]?)([^'":]+)\2:\s*(.*)$/;
|
|
98915
|
+
var mergeAllowBuilds = (original) => {
|
|
98916
|
+
const eol = detectEol(original);
|
|
98917
|
+
const lines = original.split(/\r?\n/);
|
|
98918
|
+
const headerIdx = lines.findIndex((line) => /^allowBuilds:\s*$/.test(line));
|
|
98919
|
+
if (headerIdx === -1) {
|
|
98920
|
+
const needsLeadingBlank = lines.length > 0 && lines[lines.length - 1] !== "";
|
|
98921
|
+
const block = [
|
|
98922
|
+
...needsLeadingBlank ? [""] : [],
|
|
98923
|
+
...FRESH_HEADER,
|
|
98924
|
+
"allowBuilds:",
|
|
98925
|
+
...APPROVED_BUILDS.map(formatEntry),
|
|
98926
|
+
""
|
|
98927
|
+
].join(eol);
|
|
98928
|
+
return original.replace(/(\r?\n)?$/, eol + block);
|
|
98929
|
+
}
|
|
98930
|
+
const seenOurKeys = /* @__PURE__ */ new Set();
|
|
98931
|
+
let blockEnd = lines.length;
|
|
98932
|
+
for (let i = headerIdx + 1; i < lines.length; i++) {
|
|
98933
|
+
const line = lines[i];
|
|
98934
|
+
if (line.trim() === "") {
|
|
98935
|
+
continue;
|
|
98704
98936
|
}
|
|
98705
|
-
|
|
98706
|
-
|
|
98707
|
-
|
|
98708
|
-
|
|
98709
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/date.js
|
|
98710
|
-
var DATE_TIME_RE2 = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
98711
|
-
var TomlDate2 = class _TomlDate2 extends Date {
|
|
98712
|
-
#hasDate = false;
|
|
98713
|
-
#hasTime = false;
|
|
98714
|
-
#offset = null;
|
|
98715
|
-
constructor(date) {
|
|
98716
|
-
let hasDate = true;
|
|
98717
|
-
let hasTime = true;
|
|
98718
|
-
let offset = "Z";
|
|
98719
|
-
if (typeof date === "string") {
|
|
98720
|
-
let match = date.match(DATE_TIME_RE2);
|
|
98721
|
-
if (match) {
|
|
98722
|
-
if (!match[1]) {
|
|
98723
|
-
hasDate = false;
|
|
98724
|
-
date = `0000-01-01T${date}`;
|
|
98725
|
-
}
|
|
98726
|
-
hasTime = !!match[2];
|
|
98727
|
-
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
98728
|
-
if (match[2] && +match[2] > 23) {
|
|
98729
|
-
date = "";
|
|
98730
|
-
} else {
|
|
98731
|
-
offset = match[3] || null;
|
|
98732
|
-
date = date.toUpperCase();
|
|
98733
|
-
if (!offset && hasTime)
|
|
98734
|
-
date += "Z";
|
|
98735
|
-
}
|
|
98736
|
-
} else {
|
|
98737
|
-
date = "";
|
|
98738
|
-
}
|
|
98937
|
+
if (!line.startsWith(" ")) {
|
|
98938
|
+
blockEnd = i;
|
|
98939
|
+
break;
|
|
98739
98940
|
}
|
|
98740
|
-
|
|
98741
|
-
if (!
|
|
98742
|
-
|
|
98743
|
-
|
|
98744
|
-
|
|
98941
|
+
const match = line.match(ALLOW_BUILDS_ENTRY);
|
|
98942
|
+
if (!match) {
|
|
98943
|
+
continue;
|
|
98944
|
+
}
|
|
98945
|
+
const [, indent2, quote, key, value] = match;
|
|
98946
|
+
if (!APPROVED_BUILDS_SET.has(key)) {
|
|
98947
|
+
continue;
|
|
98948
|
+
}
|
|
98949
|
+
seenOurKeys.add(key);
|
|
98950
|
+
const trimmed = value.trim();
|
|
98951
|
+
if (trimmed !== "true" && trimmed !== "false") {
|
|
98952
|
+
lines[i] = `${indent2}${quote}${key}${quote}: true`;
|
|
98745
98953
|
}
|
|
98746
98954
|
}
|
|
98747
|
-
|
|
98748
|
-
|
|
98955
|
+
const missing = APPROVED_BUILDS.filter((pkg) => !seenOurKeys.has(pkg)).map(
|
|
98956
|
+
formatEntry
|
|
98957
|
+
);
|
|
98958
|
+
if (missing.length > 0) {
|
|
98959
|
+
lines.splice(blockEnd, 0, ...missing);
|
|
98749
98960
|
}
|
|
98750
|
-
|
|
98751
|
-
|
|
98961
|
+
return lines.join(eol);
|
|
98962
|
+
};
|
|
98963
|
+
var detectEol = (text) => text.includes("\r\n") ? "\r\n" : "\n";
|
|
98964
|
+
var isPnpmIgnoredBuildsError = (error2) => {
|
|
98965
|
+
if (!(error2 instanceof Error)) {
|
|
98966
|
+
return false;
|
|
98752
98967
|
}
|
|
98753
|
-
|
|
98754
|
-
|
|
98968
|
+
return error2.message.includes("ERR_PNPM_IGNORED_BUILDS");
|
|
98969
|
+
};
|
|
98970
|
+
var IGNORED_BUILDS_LINE = /Ignored build scripts:\s*([^\n\r]+)/;
|
|
98971
|
+
var extractIgnoredBuildPackages = (error2) => {
|
|
98972
|
+
const text = error2 instanceof Error ? error2.message : typeof error2 === "string" ? error2 : "";
|
|
98973
|
+
const match = text.match(IGNORED_BUILDS_LINE);
|
|
98974
|
+
if (!match) {
|
|
98975
|
+
return [];
|
|
98755
98976
|
}
|
|
98756
|
-
|
|
98757
|
-
|
|
98977
|
+
const seen = /* @__PURE__ */ new Set();
|
|
98978
|
+
const result = [];
|
|
98979
|
+
for (const raw of match[1].split(",")) {
|
|
98980
|
+
const trimmed = raw.trim();
|
|
98981
|
+
if (!trimmed) {
|
|
98982
|
+
continue;
|
|
98983
|
+
}
|
|
98984
|
+
const name3 = stripPackageVersion(trimmed);
|
|
98985
|
+
if (name3 && !seen.has(name3)) {
|
|
98986
|
+
seen.add(name3);
|
|
98987
|
+
result.push(name3);
|
|
98988
|
+
}
|
|
98758
98989
|
}
|
|
98759
|
-
|
|
98760
|
-
|
|
98990
|
+
return result;
|
|
98991
|
+
};
|
|
98992
|
+
var stripPackageVersion = (spec) => {
|
|
98993
|
+
if (spec.startsWith("@")) {
|
|
98994
|
+
const slashIdx = spec.indexOf("/");
|
|
98995
|
+
if (slashIdx === -1) {
|
|
98996
|
+
return spec;
|
|
98997
|
+
}
|
|
98998
|
+
const versionAt = spec.indexOf("@", slashIdx);
|
|
98999
|
+
return versionAt === -1 ? spec : spec.slice(0, versionAt);
|
|
98761
99000
|
}
|
|
98762
|
-
|
|
98763
|
-
|
|
98764
|
-
|
|
98765
|
-
|
|
98766
|
-
|
|
98767
|
-
|
|
98768
|
-
|
|
98769
|
-
|
|
98770
|
-
|
|
98771
|
-
|
|
98772
|
-
|
|
98773
|
-
|
|
98774
|
-
|
|
98775
|
-
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
99001
|
+
const atIdx = spec.indexOf("@");
|
|
99002
|
+
return atIdx === -1 ? spec : spec.slice(0, atIdx);
|
|
99003
|
+
};
|
|
99004
|
+
var IgnoredBuildsError = class extends Error {
|
|
99005
|
+
packages;
|
|
99006
|
+
constructor(packages, cause) {
|
|
99007
|
+
const list = packages.length > 0 ? packages.join(", ") : "(unknown)";
|
|
99008
|
+
super(`pnpm blocked unapproved dependency build scripts: ${list}`);
|
|
99009
|
+
this.name = "IgnoredBuildsError";
|
|
99010
|
+
this.packages = packages;
|
|
99011
|
+
if (cause !== void 0) {
|
|
99012
|
+
this.cause = cause;
|
|
99013
|
+
}
|
|
98776
99014
|
}
|
|
98777
|
-
|
|
98778
|
-
|
|
98779
|
-
|
|
98780
|
-
|
|
99015
|
+
};
|
|
99016
|
+
var isIgnoredBuildsError = (error2) => error2 instanceof IgnoredBuildsError;
|
|
99017
|
+
var getPnpmIgnoredBuildsGuidance = (packages = []) => {
|
|
99018
|
+
const approveCommand = packages.length > 0 ? ` pnpm approve-builds ${packages.join(" ")}` : " pnpm approve-builds";
|
|
99019
|
+
return [
|
|
99020
|
+
"create-cloudflare only pre-approves build scripts for the packages it",
|
|
99021
|
+
"installs itself. The packages flagged above were introduced by the",
|
|
99022
|
+
"framework generator and need to be approved separately.",
|
|
99023
|
+
"",
|
|
99024
|
+
"Inside the generated project, run:",
|
|
99025
|
+
"",
|
|
99026
|
+
approveCommand,
|
|
99027
|
+
"",
|
|
99028
|
+
"then re-run the install."
|
|
99029
|
+
].join("\n");
|
|
99030
|
+
};
|
|
99031
|
+
|
|
99032
|
+
// src/helpers/packages.ts
|
|
99033
|
+
var installPackages2 = async (packages, config49 = {}) => {
|
|
99034
|
+
const { npm: npm25 } = detectPackageManager();
|
|
99035
|
+
return installPackages(npm25, packages, config49);
|
|
99036
|
+
};
|
|
99037
|
+
async function installWrangler2() {
|
|
99038
|
+
const { npm: npm25 } = detectPackageManager();
|
|
99039
|
+
return installWrangler(npm25, false);
|
|
99040
|
+
}
|
|
99041
|
+
var npmInstall = async (ctx) => {
|
|
99042
|
+
const nodeModulesPath = import_node_path10.default.join(ctx.project.path, "node_modules");
|
|
99043
|
+
if ((0, import_node_fs9.existsSync)(nodeModulesPath)) {
|
|
99044
|
+
return;
|
|
98781
99045
|
}
|
|
98782
|
-
|
|
98783
|
-
|
|
98784
|
-
|
|
98785
|
-
return
|
|
99046
|
+
const { npm: npm25 } = detectPackageManager();
|
|
99047
|
+
if (npm25 === "pnpm") {
|
|
99048
|
+
await pnpmInstallWithBuildApprovalRetry(npm25);
|
|
99049
|
+
return;
|
|
98786
99050
|
}
|
|
98787
|
-
|
|
98788
|
-
|
|
98789
|
-
|
|
98790
|
-
|
|
98791
|
-
|
|
99051
|
+
await runCommand([npm25, "install"], {
|
|
99052
|
+
silent: true,
|
|
99053
|
+
startText: "Installing dependencies",
|
|
99054
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
99055
|
+
});
|
|
99056
|
+
};
|
|
99057
|
+
var runPnpmInstallQuiet = async (npm25, startText) => {
|
|
99058
|
+
const s = spinner();
|
|
99059
|
+
s.start(startText);
|
|
99060
|
+
try {
|
|
99061
|
+
await runCommand([npm25, "install"], { silent: true, useSpinner: false });
|
|
99062
|
+
s.stop(`${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`);
|
|
99063
|
+
} catch (err) {
|
|
99064
|
+
s.stop(red("install failed"));
|
|
99065
|
+
throw err;
|
|
98792
99066
|
}
|
|
98793
|
-
|
|
98794
|
-
|
|
98795
|
-
|
|
98796
|
-
|
|
98797
|
-
return
|
|
99067
|
+
};
|
|
99068
|
+
var pnpmInstallWithBuildApprovalRetry = async (npm25) => {
|
|
99069
|
+
try {
|
|
99070
|
+
await runPnpmInstallQuiet(npm25, "Installing dependencies");
|
|
99071
|
+
return;
|
|
99072
|
+
} catch (err) {
|
|
99073
|
+
if (!isPnpmIgnoredBuildsError(err)) {
|
|
99074
|
+
throw err;
|
|
99075
|
+
}
|
|
99076
|
+
await recoverFromIgnoredBuilds(npm25, err);
|
|
98798
99077
|
}
|
|
98799
99078
|
};
|
|
98800
|
-
|
|
98801
|
-
|
|
98802
|
-
var
|
|
98803
|
-
|
|
98804
|
-
|
|
98805
|
-
|
|
98806
|
-
|
|
98807
|
-
|
|
98808
|
-
|
|
98809
|
-
|
|
98810
|
-
|
|
98811
|
-
|
|
98812
|
-
|
|
98813
|
-
|
|
99079
|
+
var STDIN_EOF_MARKER = "__c3_stdin_eof__";
|
|
99080
|
+
var isStdinEOFError = (err) => err instanceof Error && err.message === STDIN_EOF_MARKER;
|
|
99081
|
+
var promptOrEOF = async (packages) => {
|
|
99082
|
+
const prompt = inputPrompt({
|
|
99083
|
+
type: "confirm",
|
|
99084
|
+
question: `Run \`pnpm approve-builds ${packages.join(" ")}\` and retry the install?`,
|
|
99085
|
+
label: "approve-builds",
|
|
99086
|
+
defaultValue: true,
|
|
99087
|
+
throwOnError: true
|
|
99088
|
+
});
|
|
99089
|
+
if (process.stdin.isTTY) {
|
|
99090
|
+
return prompt;
|
|
99091
|
+
}
|
|
99092
|
+
let onEnd;
|
|
99093
|
+
const eof = new Promise((_2, reject) => {
|
|
99094
|
+
onEnd = () => reject(new Error(STDIN_EOF_MARKER));
|
|
99095
|
+
process.stdin.once("end", onEnd);
|
|
99096
|
+
process.stdin.resume();
|
|
99097
|
+
});
|
|
99098
|
+
prompt.catch(() => {
|
|
99099
|
+
});
|
|
99100
|
+
try {
|
|
99101
|
+
return await Promise.race([prompt, eof]);
|
|
99102
|
+
} finally {
|
|
99103
|
+
if (onEnd) {
|
|
99104
|
+
process.stdin.removeListener("end", onEnd);
|
|
99105
|
+
}
|
|
99106
|
+
}
|
|
98814
99107
|
};
|
|
98815
|
-
|
|
98816
|
-
|
|
98817
|
-
|
|
98818
|
-
|
|
98819
|
-
endPtr -= 2;
|
|
98820
|
-
if (str[ptr += 2] === "\r")
|
|
98821
|
-
ptr++;
|
|
98822
|
-
if (str[ptr] === "\n")
|
|
98823
|
-
ptr++;
|
|
99108
|
+
var recoverFromIgnoredBuilds = async (npm25, originalErr) => {
|
|
99109
|
+
const packages = extractIgnoredBuildPackages(originalErr);
|
|
99110
|
+
if (packages.length === 0) {
|
|
99111
|
+
throw new IgnoredBuildsError([], originalErr);
|
|
98824
99112
|
}
|
|
98825
|
-
|
|
98826
|
-
|
|
98827
|
-
|
|
98828
|
-
let
|
|
98829
|
-
|
|
98830
|
-
|
|
98831
|
-
|
|
98832
|
-
|
|
98833
|
-
|
|
98834
|
-
toml: str,
|
|
98835
|
-
ptr: ptr - 1
|
|
98836
|
-
});
|
|
98837
|
-
}
|
|
98838
|
-
} else if (c2 < " " && c2 !== " " || c2 === "\x7F") {
|
|
98839
|
-
throw new TomlError2("control characters are not allowed in strings", {
|
|
98840
|
-
toml: str,
|
|
98841
|
-
ptr: ptr - 1
|
|
98842
|
-
});
|
|
99113
|
+
updateStatus(
|
|
99114
|
+
`${red("pnpm refused to run build scripts for:")} ${packages.join(", ")}`
|
|
99115
|
+
);
|
|
99116
|
+
let approve;
|
|
99117
|
+
try {
|
|
99118
|
+
approve = await promptOrEOF(packages);
|
|
99119
|
+
} catch (promptErr) {
|
|
99120
|
+
if (promptErr instanceof CancelError || isStdinEOFError(promptErr)) {
|
|
99121
|
+
throw new IgnoredBuildsError(packages, originalErr);
|
|
98843
99122
|
}
|
|
98844
|
-
|
|
98845
|
-
|
|
98846
|
-
|
|
98847
|
-
|
|
98848
|
-
|
|
98849
|
-
|
|
98850
|
-
|
|
98851
|
-
|
|
98852
|
-
|
|
98853
|
-
|
|
98854
|
-
|
|
98855
|
-
|
|
98856
|
-
|
|
98857
|
-
|
|
98858
|
-
|
|
98859
|
-
|
|
98860
|
-
|
|
98861
|
-
|
|
98862
|
-
} else if (isMultiline && (c2 === "\n" || c2 === " " || c2 === " " || c2 === "\r")) {
|
|
98863
|
-
ptr = skipVoid2(str, ptr - 1, true);
|
|
98864
|
-
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
98865
|
-
throw new TomlError2("invalid escape: only line-ending whitespace may be escaped", {
|
|
98866
|
-
toml: str,
|
|
98867
|
-
ptr: tmp
|
|
98868
|
-
});
|
|
98869
|
-
}
|
|
98870
|
-
ptr = skipVoid2(str, ptr);
|
|
98871
|
-
} else if (c2 in ESC_MAP2) {
|
|
98872
|
-
parsed += ESC_MAP2[c2];
|
|
98873
|
-
} else {
|
|
98874
|
-
throw new TomlError2("unrecognized escape sequence", {
|
|
98875
|
-
toml: str,
|
|
98876
|
-
ptr: tmp
|
|
98877
|
-
});
|
|
98878
|
-
}
|
|
98879
|
-
sliceStart = ptr;
|
|
98880
|
-
} else if (!isLiteral && c2 === "\\") {
|
|
98881
|
-
tmp = ptr - 1;
|
|
98882
|
-
isEscape = true;
|
|
98883
|
-
parsed += str.slice(sliceStart, tmp);
|
|
99123
|
+
throw promptErr;
|
|
99124
|
+
}
|
|
99125
|
+
if (!approve) {
|
|
99126
|
+
throw new IgnoredBuildsError(packages, originalErr);
|
|
99127
|
+
}
|
|
99128
|
+
await runCommand([npm25, "approve-builds", ...packages], {
|
|
99129
|
+
silent: true,
|
|
99130
|
+
startText: "Approving dependency build scripts",
|
|
99131
|
+
doneText: `${brandColor("approved")} ${dim(packages.join(", "))}`
|
|
99132
|
+
});
|
|
99133
|
+
try {
|
|
99134
|
+
await runPnpmInstallQuiet(npm25, "Re-running install");
|
|
99135
|
+
} catch (retryErr) {
|
|
99136
|
+
if (isPnpmIgnoredBuildsError(retryErr)) {
|
|
99137
|
+
throw new IgnoredBuildsError(
|
|
99138
|
+
extractIgnoredBuildPackages(retryErr),
|
|
99139
|
+
retryErr
|
|
99140
|
+
);
|
|
98884
99141
|
}
|
|
99142
|
+
throw retryErr;
|
|
98885
99143
|
}
|
|
98886
|
-
|
|
99144
|
+
};
|
|
99145
|
+
async function getLatestPackageVersion(packageSpecifier) {
|
|
99146
|
+
const resp = await (0, import_undici3.fetch)(`https://registry.npmjs.org/${packageSpecifier}`);
|
|
99147
|
+
const npmInfo = await resp.json();
|
|
99148
|
+
return npmInfo["dist-tags"].latest;
|
|
98887
99149
|
}
|
|
98888
|
-
|
|
98889
|
-
|
|
99150
|
+
|
|
99151
|
+
// ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
99152
|
+
var import_node_process13 = __toESM(require("node:process"), 1);
|
|
99153
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
99154
|
+
var import_node_url2 = require("node:url");
|
|
99155
|
+
var import_node_child_process8 = __toESM(require("node:child_process"), 1);
|
|
99156
|
+
var import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
99157
|
+
|
|
99158
|
+
// ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
|
|
99159
|
+
var import_node_util3 = require("node:util");
|
|
99160
|
+
var import_node_child_process3 = __toESM(require("node:child_process"), 1);
|
|
99161
|
+
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
99162
|
+
|
|
99163
|
+
// ../../node_modules/.pnpm/is-wsl@3.1.0/node_modules/is-wsl/index.js
|
|
99164
|
+
var import_node_process7 = __toESM(require("node:process"), 1);
|
|
99165
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
99166
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
99167
|
+
|
|
99168
|
+
// ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
99169
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
99170
|
+
|
|
99171
|
+
// ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
|
|
99172
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
99173
|
+
var isDockerCached;
|
|
99174
|
+
function hasDockerEnv() {
|
|
99175
|
+
try {
|
|
99176
|
+
import_node_fs10.default.statSync("/.dockerenv");
|
|
98890
99177
|
return true;
|
|
98891
|
-
|
|
99178
|
+
} catch {
|
|
98892
99179
|
return false;
|
|
98893
|
-
|
|
98894
|
-
|
|
98895
|
-
|
|
98896
|
-
|
|
98897
|
-
|
|
98898
|
-
|
|
98899
|
-
|
|
98900
|
-
|
|
98901
|
-
|
|
98902
|
-
|
|
98903
|
-
|
|
98904
|
-
|
|
98905
|
-
|
|
98906
|
-
|
|
98907
|
-
|
|
99180
|
+
}
|
|
99181
|
+
}
|
|
99182
|
+
function hasDockerCGroup() {
|
|
99183
|
+
try {
|
|
99184
|
+
return import_node_fs10.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
99185
|
+
} catch {
|
|
99186
|
+
return false;
|
|
99187
|
+
}
|
|
99188
|
+
}
|
|
99189
|
+
function isDocker() {
|
|
99190
|
+
if (isDockerCached === void 0) {
|
|
99191
|
+
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
99192
|
+
}
|
|
99193
|
+
return isDockerCached;
|
|
99194
|
+
}
|
|
99195
|
+
|
|
99196
|
+
// ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
99197
|
+
var cachedResult;
|
|
99198
|
+
var hasContainerEnv = () => {
|
|
99199
|
+
try {
|
|
99200
|
+
import_node_fs11.default.statSync("/run/.containerenv");
|
|
99201
|
+
return true;
|
|
99202
|
+
} catch {
|
|
99203
|
+
return false;
|
|
99204
|
+
}
|
|
99205
|
+
};
|
|
99206
|
+
function isInsideContainer() {
|
|
99207
|
+
if (cachedResult === void 0) {
|
|
99208
|
+
cachedResult = hasContainerEnv() || isDocker();
|
|
99209
|
+
}
|
|
99210
|
+
return cachedResult;
|
|
99211
|
+
}
|
|
99212
|
+
|
|
99213
|
+
// ../../node_modules/.pnpm/is-wsl@3.1.0/node_modules/is-wsl/index.js
|
|
99214
|
+
var isWsl = () => {
|
|
99215
|
+
if (import_node_process7.default.platform !== "linux") {
|
|
99216
|
+
return false;
|
|
99217
|
+
}
|
|
99218
|
+
if (import_node_os5.default.release().toLowerCase().includes("microsoft")) {
|
|
99219
|
+
if (isInsideContainer()) {
|
|
99220
|
+
return false;
|
|
98908
99221
|
}
|
|
98909
|
-
|
|
98910
|
-
|
|
98911
|
-
|
|
98912
|
-
|
|
98913
|
-
|
|
98914
|
-
|
|
98915
|
-
|
|
99222
|
+
return true;
|
|
99223
|
+
}
|
|
99224
|
+
try {
|
|
99225
|
+
return import_node_fs12.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
|
|
99226
|
+
} catch {
|
|
99227
|
+
return false;
|
|
99228
|
+
}
|
|
99229
|
+
};
|
|
99230
|
+
var is_wsl_default = import_node_process7.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
99231
|
+
|
|
99232
|
+
// ../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
|
|
99233
|
+
var import_node_process8 = __toESM(require("node:process"), 1);
|
|
99234
|
+
var import_node_buffer = require("node:buffer");
|
|
99235
|
+
var import_node_util2 = require("node:util");
|
|
99236
|
+
var import_node_child_process2 = __toESM(require("node:child_process"), 1);
|
|
99237
|
+
var execFile = (0, import_node_util2.promisify)(import_node_child_process2.default.execFile);
|
|
99238
|
+
var powerShellPath = () => `${import_node_process8.default.env.SYSTEMROOT || import_node_process8.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
99239
|
+
var executePowerShell = async (command2, options = {}) => {
|
|
99240
|
+
const {
|
|
99241
|
+
powerShellPath: psPath,
|
|
99242
|
+
...execFileOptions
|
|
99243
|
+
} = options;
|
|
99244
|
+
const encodedCommand = executePowerShell.encodeCommand(command2);
|
|
99245
|
+
return execFile(
|
|
99246
|
+
psPath ?? powerShellPath(),
|
|
99247
|
+
[
|
|
99248
|
+
...executePowerShell.argumentsPrefix,
|
|
99249
|
+
encodedCommand
|
|
99250
|
+
],
|
|
99251
|
+
{
|
|
99252
|
+
encoding: "utf8",
|
|
99253
|
+
...execFileOptions
|
|
98916
99254
|
}
|
|
98917
|
-
|
|
98918
|
-
|
|
98919
|
-
|
|
98920
|
-
|
|
98921
|
-
|
|
98922
|
-
|
|
98923
|
-
|
|
98924
|
-
|
|
98925
|
-
|
|
99255
|
+
);
|
|
99256
|
+
};
|
|
99257
|
+
executePowerShell.argumentsPrefix = [
|
|
99258
|
+
"-NoProfile",
|
|
99259
|
+
"-NonInteractive",
|
|
99260
|
+
"-ExecutionPolicy",
|
|
99261
|
+
"Bypass",
|
|
99262
|
+
"-EncodedCommand"
|
|
99263
|
+
];
|
|
99264
|
+
executePowerShell.encodeCommand = (command2) => import_node_buffer.Buffer.from(command2, "utf16le").toString("base64");
|
|
99265
|
+
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
99266
|
+
|
|
99267
|
+
// ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
|
|
99268
|
+
function parseMountPointFromConfig(content) {
|
|
99269
|
+
for (const line of content.split("\n")) {
|
|
99270
|
+
if (/^\s*#/.test(line)) {
|
|
99271
|
+
continue;
|
|
98926
99272
|
}
|
|
98927
|
-
|
|
98928
|
-
|
|
98929
|
-
|
|
98930
|
-
|
|
98931
|
-
|
|
98932
|
-
toml,
|
|
98933
|
-
ptr
|
|
98934
|
-
});
|
|
99273
|
+
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
99274
|
+
if (!match) {
|
|
99275
|
+
continue;
|
|
99276
|
+
}
|
|
99277
|
+
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
98935
99278
|
}
|
|
98936
|
-
return date;
|
|
98937
99279
|
}
|
|
98938
99280
|
|
|
98939
|
-
// ../../node_modules/.pnpm/
|
|
98940
|
-
|
|
98941
|
-
|
|
98942
|
-
|
|
98943
|
-
|
|
98944
|
-
|
|
98945
|
-
|
|
98946
|
-
|
|
98947
|
-
|
|
98948
|
-
|
|
98949
|
-
let
|
|
98950
|
-
|
|
98951
|
-
|
|
98952
|
-
|
|
98953
|
-
|
|
98954
|
-
|
|
99281
|
+
// ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
|
|
99282
|
+
var execFile2 = (0, import_node_util3.promisify)(import_node_child_process3.default.execFile);
|
|
99283
|
+
var wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
99284
|
+
const defaultMountPoint = "/mnt/";
|
|
99285
|
+
let mountPoint;
|
|
99286
|
+
return async function() {
|
|
99287
|
+
if (mountPoint) {
|
|
99288
|
+
return mountPoint;
|
|
99289
|
+
}
|
|
99290
|
+
const configFilePath = "/etc/wsl.conf";
|
|
99291
|
+
let isConfigFileExists = false;
|
|
99292
|
+
try {
|
|
99293
|
+
await import_promises4.default.access(configFilePath, import_promises4.constants.F_OK);
|
|
99294
|
+
isConfigFileExists = true;
|
|
99295
|
+
} catch {
|
|
99296
|
+
}
|
|
99297
|
+
if (!isConfigFileExists) {
|
|
99298
|
+
return defaultMountPoint;
|
|
99299
|
+
}
|
|
99300
|
+
const configContent = await import_promises4.default.readFile(configFilePath, { encoding: "utf8" });
|
|
99301
|
+
const parsedMountPoint = parseMountPointFromConfig(configContent);
|
|
99302
|
+
if (parsedMountPoint === void 0) {
|
|
99303
|
+
return defaultMountPoint;
|
|
99304
|
+
}
|
|
99305
|
+
mountPoint = parsedMountPoint;
|
|
99306
|
+
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
99307
|
+
return mountPoint;
|
|
99308
|
+
};
|
|
99309
|
+
})();
|
|
99310
|
+
var powerShellPathFromWsl = async () => {
|
|
99311
|
+
const mountPoint = await wslDrivesMountPoint();
|
|
99312
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
99313
|
+
};
|
|
99314
|
+
var powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
|
|
99315
|
+
var canAccessPowerShellPromise;
|
|
99316
|
+
var canAccessPowerShell = async () => {
|
|
99317
|
+
canAccessPowerShellPromise ??= (async () => {
|
|
99318
|
+
try {
|
|
99319
|
+
const psPath = await powerShellPath2();
|
|
99320
|
+
await import_promises4.default.access(psPath, import_promises4.constants.X_OK);
|
|
99321
|
+
return true;
|
|
99322
|
+
} catch {
|
|
99323
|
+
return false;
|
|
98955
99324
|
}
|
|
99325
|
+
})();
|
|
99326
|
+
return canAccessPowerShellPromise;
|
|
99327
|
+
};
|
|
99328
|
+
var wslDefaultBrowser = async () => {
|
|
99329
|
+
const psPath = await powerShellPath2();
|
|
99330
|
+
const command2 = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
99331
|
+
const { stdout: stdout2 } = await executePowerShell(command2, { powerShellPath: psPath });
|
|
99332
|
+
return stdout2.trim();
|
|
99333
|
+
};
|
|
99334
|
+
var convertWslPathToWindows = async (path6) => {
|
|
99335
|
+
if (/^[a-z]+:\/\//i.test(path6)) {
|
|
99336
|
+
return path6;
|
|
98956
99337
|
}
|
|
98957
|
-
|
|
98958
|
-
}
|
|
98959
|
-
|
|
98960
|
-
|
|
98961
|
-
|
|
98962
|
-
toml: str,
|
|
98963
|
-
ptr
|
|
98964
|
-
});
|
|
99338
|
+
try {
|
|
99339
|
+
const { stdout: stdout2 } = await execFile2("wslpath", ["-aw", path6], { encoding: "utf8" });
|
|
99340
|
+
return stdout2.trim();
|
|
99341
|
+
} catch {
|
|
99342
|
+
return path6;
|
|
98965
99343
|
}
|
|
98966
|
-
|
|
98967
|
-
|
|
98968
|
-
|
|
98969
|
-
|
|
98970
|
-
|
|
98971
|
-
|
|
98972
|
-
|
|
98973
|
-
|
|
98974
|
-
|
|
98975
|
-
|
|
98976
|
-
|
|
98977
|
-
|
|
99344
|
+
};
|
|
99345
|
+
|
|
99346
|
+
// ../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
|
|
99347
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
99348
|
+
const define2 = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
99349
|
+
Object.defineProperty(object, propertyName, {
|
|
99350
|
+
configurable: true,
|
|
99351
|
+
enumerable: true,
|
|
99352
|
+
get() {
|
|
99353
|
+
const result = valueGetter();
|
|
99354
|
+
define2(result);
|
|
99355
|
+
return result;
|
|
99356
|
+
},
|
|
99357
|
+
set(value) {
|
|
99358
|
+
define2(value);
|
|
98978
99359
|
}
|
|
98979
|
-
|
|
99360
|
+
});
|
|
99361
|
+
return object;
|
|
99362
|
+
}
|
|
99363
|
+
|
|
99364
|
+
// ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
|
|
99365
|
+
var import_node_util7 = require("node:util");
|
|
99366
|
+
var import_node_process11 = __toESM(require("node:process"), 1);
|
|
99367
|
+
var import_node_child_process7 = require("node:child_process");
|
|
99368
|
+
|
|
99369
|
+
// ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
99370
|
+
var import_node_util4 = require("node:util");
|
|
99371
|
+
var import_node_process9 = __toESM(require("node:process"), 1);
|
|
99372
|
+
var import_node_child_process4 = require("node:child_process");
|
|
99373
|
+
var execFileAsync = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
|
|
99374
|
+
async function defaultBrowserId() {
|
|
99375
|
+
if (import_node_process9.default.platform !== "darwin") {
|
|
99376
|
+
throw new Error("macOS only");
|
|
98980
99377
|
}
|
|
98981
|
-
|
|
98982
|
-
|
|
98983
|
-
|
|
98984
|
-
|
|
98985
|
-
|
|
98986
|
-
endPtr = skipVoid2(str, endPtr, end !== "]");
|
|
98987
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
98988
|
-
throw new TomlError2("unexpected character encountered", {
|
|
98989
|
-
toml: str,
|
|
98990
|
-
ptr: endPtr
|
|
98991
|
-
});
|
|
98992
|
-
}
|
|
98993
|
-
endPtr += +(str[endPtr] === ",");
|
|
98994
|
-
}
|
|
98995
|
-
return [parsed, endPtr];
|
|
99378
|
+
const { stdout: stdout2 } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
99379
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout2);
|
|
99380
|
+
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
99381
|
+
if (browserId === "com.apple.safari") {
|
|
99382
|
+
return "com.apple.Safari";
|
|
98996
99383
|
}
|
|
98997
|
-
|
|
98998
|
-
|
|
98999
|
-
|
|
99000
|
-
|
|
99001
|
-
|
|
99002
|
-
|
|
99003
|
-
|
|
99384
|
+
return browserId;
|
|
99385
|
+
}
|
|
99386
|
+
|
|
99387
|
+
// ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
99388
|
+
var import_node_process10 = __toESM(require("node:process"), 1);
|
|
99389
|
+
var import_node_util5 = require("node:util");
|
|
99390
|
+
var import_node_child_process5 = require("node:child_process");
|
|
99391
|
+
var execFileAsync2 = (0, import_node_util5.promisify)(import_node_child_process5.execFile);
|
|
99392
|
+
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
99393
|
+
if (import_node_process10.default.platform !== "darwin") {
|
|
99394
|
+
throw new Error("macOS only");
|
|
99004
99395
|
}
|
|
99005
|
-
|
|
99006
|
-
|
|
99007
|
-
|
|
99396
|
+
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
99397
|
+
const execOptions = {};
|
|
99398
|
+
if (signal) {
|
|
99399
|
+
execOptions.signal = signal;
|
|
99008
99400
|
}
|
|
99009
|
-
|
|
99010
|
-
|
|
99011
|
-
endPtr
|
|
99012
|
-
];
|
|
99401
|
+
const { stdout: stdout2 } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
99402
|
+
return stdout2.trim();
|
|
99013
99403
|
}
|
|
99014
99404
|
|
|
99015
|
-
// ../../node_modules/.pnpm/
|
|
99016
|
-
|
|
99017
|
-
|
|
99018
|
-
|
|
99019
|
-
let parsed = [];
|
|
99020
|
-
let endPtr = str.indexOf(end, ptr);
|
|
99021
|
-
if (endPtr < 0) {
|
|
99022
|
-
throw new TomlError2("incomplete key-value: cannot find end of key", {
|
|
99023
|
-
toml: str,
|
|
99024
|
-
ptr
|
|
99025
|
-
});
|
|
99026
|
-
}
|
|
99027
|
-
do {
|
|
99028
|
-
let c2 = str[ptr = ++dot];
|
|
99029
|
-
if (c2 !== " " && c2 !== " ") {
|
|
99030
|
-
if (c2 === '"' || c2 === "'") {
|
|
99031
|
-
if (c2 === str[ptr + 1] && c2 === str[ptr + 2]) {
|
|
99032
|
-
throw new TomlError2("multiline strings are not allowed in keys", {
|
|
99033
|
-
toml: str,
|
|
99034
|
-
ptr
|
|
99035
|
-
});
|
|
99036
|
-
}
|
|
99037
|
-
let eos = getStringEnd2(str, ptr);
|
|
99038
|
-
if (eos < 0) {
|
|
99039
|
-
throw new TomlError2("unfinished string encountered", {
|
|
99040
|
-
toml: str,
|
|
99041
|
-
ptr
|
|
99042
|
-
});
|
|
99043
|
-
}
|
|
99044
|
-
dot = str.indexOf(".", eos);
|
|
99045
|
-
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
99046
|
-
let newLine = indexOfNewline2(strEnd);
|
|
99047
|
-
if (newLine > -1) {
|
|
99048
|
-
throw new TomlError2("newlines are not allowed in keys", {
|
|
99049
|
-
toml: str,
|
|
99050
|
-
ptr: ptr + dot + newLine
|
|
99051
|
-
});
|
|
99052
|
-
}
|
|
99053
|
-
if (strEnd.trimStart()) {
|
|
99054
|
-
throw new TomlError2("found extra tokens after the string part", {
|
|
99055
|
-
toml: str,
|
|
99056
|
-
ptr: eos
|
|
99057
|
-
});
|
|
99058
|
-
}
|
|
99059
|
-
if (endPtr < eos) {
|
|
99060
|
-
endPtr = str.indexOf(end, eos);
|
|
99061
|
-
if (endPtr < 0) {
|
|
99062
|
-
throw new TomlError2("incomplete key-value: cannot find end of key", {
|
|
99063
|
-
toml: str,
|
|
99064
|
-
ptr
|
|
99065
|
-
});
|
|
99066
|
-
}
|
|
99067
|
-
}
|
|
99068
|
-
parsed.push(parseString2(str, ptr, eos));
|
|
99069
|
-
} else {
|
|
99070
|
-
dot = str.indexOf(".", ptr);
|
|
99071
|
-
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
99072
|
-
if (!KEY_PART_RE2.test(part)) {
|
|
99073
|
-
throw new TomlError2("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
99074
|
-
toml: str,
|
|
99075
|
-
ptr
|
|
99076
|
-
});
|
|
99077
|
-
}
|
|
99078
|
-
parsed.push(part.trimEnd());
|
|
99079
|
-
}
|
|
99080
|
-
}
|
|
99081
|
-
} while (dot + 1 && dot < endPtr);
|
|
99082
|
-
return [parsed, skipVoid2(str, endPtr + 1, true, true)];
|
|
99405
|
+
// ../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js
|
|
99406
|
+
async function bundleName(bundleId) {
|
|
99407
|
+
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
99408
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
99083
99409
|
}
|
|
99084
|
-
|
|
99085
|
-
|
|
99086
|
-
|
|
99087
|
-
|
|
99088
|
-
|
|
99089
|
-
|
|
99090
|
-
|
|
99091
|
-
|
|
99092
|
-
|
|
99093
|
-
|
|
99094
|
-
|
|
99095
|
-
|
|
99096
|
-
|
|
99097
|
-
|
|
99098
|
-
|
|
99099
|
-
|
|
99100
|
-
|
|
99101
|
-
|
|
99102
|
-
|
|
99103
|
-
|
|
99104
|
-
|
|
99105
|
-
|
|
99106
|
-
|
|
99107
|
-
|
|
99108
|
-
|
|
99109
|
-
|
|
99110
|
-
|
|
99111
|
-
|
|
99112
|
-
|
|
99113
|
-
|
|
99114
|
-
|
|
99115
|
-
|
|
99116
|
-
|
|
99117
|
-
|
|
99118
|
-
|
|
99119
|
-
|
|
99120
|
-
|
|
99121
|
-
});
|
|
99122
|
-
}
|
|
99123
|
-
let [value, valueEndPtr] = extractValue2(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
99124
|
-
seen.add(value);
|
|
99125
|
-
t2[k] = value;
|
|
99126
|
-
ptr = valueEndPtr;
|
|
99127
|
-
comma = str[ptr - 1] === "," ? ptr - 1 : 0;
|
|
99128
|
-
}
|
|
99129
|
-
}
|
|
99130
|
-
if (comma) {
|
|
99131
|
-
throw new TomlError2("trailing commas are not allowed in inline tables", {
|
|
99132
|
-
toml: str,
|
|
99133
|
-
ptr: comma
|
|
99134
|
-
});
|
|
99410
|
+
|
|
99411
|
+
// ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/windows.js
|
|
99412
|
+
var import_node_util6 = require("node:util");
|
|
99413
|
+
var import_node_child_process6 = require("node:child_process");
|
|
99414
|
+
var execFileAsync3 = (0, import_node_util6.promisify)(import_node_child_process6.execFile);
|
|
99415
|
+
var windowsBrowserProgIds = {
|
|
99416
|
+
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
99417
|
+
// The missing `L` is correct.
|
|
99418
|
+
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
99419
|
+
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
99420
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
99421
|
+
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
99422
|
+
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
99423
|
+
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
99424
|
+
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
99425
|
+
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
99426
|
+
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
99427
|
+
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
99428
|
+
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
99429
|
+
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
99430
|
+
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
99431
|
+
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
99432
|
+
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
99433
|
+
};
|
|
99434
|
+
var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
99435
|
+
var UnknownBrowserError = class extends Error {
|
|
99436
|
+
};
|
|
99437
|
+
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
99438
|
+
const { stdout: stdout2 } = await _execFileAsync("reg", [
|
|
99439
|
+
"QUERY",
|
|
99440
|
+
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
99441
|
+
"/v",
|
|
99442
|
+
"ProgId"
|
|
99443
|
+
]);
|
|
99444
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout2);
|
|
99445
|
+
if (!match) {
|
|
99446
|
+
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout2)}`);
|
|
99135
99447
|
}
|
|
99136
|
-
|
|
99137
|
-
|
|
99138
|
-
|
|
99139
|
-
|
|
99140
|
-
});
|
|
99448
|
+
const { id } = match.groups;
|
|
99449
|
+
const browser = windowsBrowserProgIds[id];
|
|
99450
|
+
if (!browser) {
|
|
99451
|
+
throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
|
|
99141
99452
|
}
|
|
99142
|
-
return
|
|
99453
|
+
return browser;
|
|
99143
99454
|
}
|
|
99144
|
-
|
|
99145
|
-
|
|
99146
|
-
|
|
99147
|
-
|
|
99148
|
-
|
|
99149
|
-
|
|
99150
|
-
|
|
99151
|
-
|
|
99152
|
-
|
|
99153
|
-
});
|
|
99154
|
-
} else if (c2 === "#")
|
|
99155
|
-
ptr = skipComment2(str, ptr);
|
|
99156
|
-
else if (c2 !== " " && c2 !== " " && c2 !== "\n" && c2 !== "\r") {
|
|
99157
|
-
let e = extractValue2(str, ptr - 1, "]", depth - 1, integersAsBigInt);
|
|
99158
|
-
res.push(e[0]);
|
|
99159
|
-
ptr = e[1];
|
|
99160
|
-
}
|
|
99455
|
+
|
|
99456
|
+
// ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
|
|
99457
|
+
var execFileAsync4 = (0, import_node_util7.promisify)(import_node_child_process7.execFile);
|
|
99458
|
+
var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
99459
|
+
async function defaultBrowser2() {
|
|
99460
|
+
if (import_node_process11.default.platform === "darwin") {
|
|
99461
|
+
const id = await defaultBrowserId();
|
|
99462
|
+
const name3 = await bundleName(id);
|
|
99463
|
+
return { name: name3, id };
|
|
99161
99464
|
}
|
|
99162
|
-
if (
|
|
99163
|
-
|
|
99164
|
-
|
|
99165
|
-
|
|
99166
|
-
}
|
|
99465
|
+
if (import_node_process11.default.platform === "linux") {
|
|
99466
|
+
const { stdout: stdout2 } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
99467
|
+
const id = stdout2.trim();
|
|
99468
|
+
const name3 = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
99469
|
+
return { name: name3, id };
|
|
99167
99470
|
}
|
|
99168
|
-
|
|
99471
|
+
if (import_node_process11.default.platform === "win32") {
|
|
99472
|
+
return defaultBrowser();
|
|
99473
|
+
}
|
|
99474
|
+
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
99169
99475
|
}
|
|
99170
99476
|
|
|
99171
|
-
// ../../node_modules/.pnpm/
|
|
99172
|
-
|
|
99173
|
-
|
|
99174
|
-
|
|
99175
|
-
|
|
99176
|
-
|
|
99177
|
-
|
|
99178
|
-
|
|
99179
|
-
|
|
99180
|
-
|
|
99181
|
-
|
|
99182
|
-
|
|
99183
|
-
|
|
99184
|
-
|
|
99185
|
-
|
|
99186
|
-
|
|
99187
|
-
|
|
99188
|
-
|
|
99189
|
-
|
|
99477
|
+
// ../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
|
|
99478
|
+
var import_node_process12 = __toESM(require("node:process"), 1);
|
|
99479
|
+
var isInSsh = Boolean(import_node_process12.default.env.SSH_CONNECTION || import_node_process12.default.env.SSH_CLIENT || import_node_process12.default.env.SSH_TTY);
|
|
99480
|
+
var is_in_ssh_default = isInSsh;
|
|
99481
|
+
|
|
99482
|
+
// ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
99483
|
+
var import_meta2 = {};
|
|
99484
|
+
var fallbackAttemptSymbol = /* @__PURE__ */ Symbol("fallbackAttempt");
|
|
99485
|
+
var __dirname3 = import_meta2.url ? import_node_path11.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)) : "";
|
|
99486
|
+
var localXdgOpenPath = import_node_path11.default.join(__dirname3, "xdg-open");
|
|
99487
|
+
var { platform, arch: arch2 } = import_node_process13.default;
|
|
99488
|
+
var tryEachApp = async (apps2, opener) => {
|
|
99489
|
+
if (apps2.length === 0) {
|
|
99490
|
+
return;
|
|
99491
|
+
}
|
|
99492
|
+
const errors = [];
|
|
99493
|
+
for (const app of apps2) {
|
|
99494
|
+
try {
|
|
99495
|
+
return await opener(app);
|
|
99496
|
+
} catch (error2) {
|
|
99497
|
+
errors.push(error2);
|
|
99190
99498
|
}
|
|
99191
|
-
|
|
99192
|
-
|
|
99193
|
-
|
|
99499
|
+
}
|
|
99500
|
+
throw new AggregateError(errors, "Failed to open in all supported apps");
|
|
99501
|
+
};
|
|
99502
|
+
var baseOpen = async (options) => {
|
|
99503
|
+
options = {
|
|
99504
|
+
wait: false,
|
|
99505
|
+
background: false,
|
|
99506
|
+
newInstance: false,
|
|
99507
|
+
allowNonzeroExitCode: false,
|
|
99508
|
+
...options
|
|
99509
|
+
};
|
|
99510
|
+
const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
|
|
99511
|
+
delete options[fallbackAttemptSymbol];
|
|
99512
|
+
if (Array.isArray(options.app)) {
|
|
99513
|
+
return tryEachApp(options.app, (singleApp) => baseOpen({
|
|
99514
|
+
...options,
|
|
99515
|
+
app: singleApp,
|
|
99516
|
+
[fallbackAttemptSymbol]: true
|
|
99517
|
+
}));
|
|
99518
|
+
}
|
|
99519
|
+
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
99520
|
+
appArguments = [...appArguments];
|
|
99521
|
+
if (Array.isArray(app)) {
|
|
99522
|
+
return tryEachApp(app, (appName) => baseOpen({
|
|
99523
|
+
...options,
|
|
99524
|
+
app: {
|
|
99525
|
+
name: appName,
|
|
99526
|
+
arguments: appArguments
|
|
99527
|
+
},
|
|
99528
|
+
[fallbackAttemptSymbol]: true
|
|
99529
|
+
}));
|
|
99530
|
+
}
|
|
99531
|
+
if (app === "browser" || app === "browserPrivate") {
|
|
99532
|
+
const ids = {
|
|
99533
|
+
"com.google.chrome": "chrome",
|
|
99534
|
+
"google-chrome.desktop": "chrome",
|
|
99535
|
+
"com.brave.browser": "brave",
|
|
99536
|
+
"org.mozilla.firefox": "firefox",
|
|
99537
|
+
"firefox.desktop": "firefox",
|
|
99538
|
+
"com.microsoft.msedge": "edge",
|
|
99539
|
+
"com.microsoft.edge": "edge",
|
|
99540
|
+
"com.microsoft.edgemac": "edge",
|
|
99541
|
+
"microsoft-edge.desktop": "edge",
|
|
99542
|
+
"com.apple.safari": "safari"
|
|
99543
|
+
};
|
|
99544
|
+
const flags = {
|
|
99545
|
+
chrome: "--incognito",
|
|
99546
|
+
brave: "--incognito",
|
|
99547
|
+
firefox: "--private-window",
|
|
99548
|
+
edge: "--inPrivate"
|
|
99549
|
+
// Safari doesn't support private mode via command line
|
|
99550
|
+
};
|
|
99551
|
+
let browser;
|
|
99552
|
+
if (is_wsl_default) {
|
|
99553
|
+
const progId = await wslDefaultBrowser();
|
|
99554
|
+
const browserInfo = _windowsBrowserProgIdMap.get(progId);
|
|
99555
|
+
browser = browserInfo ?? {};
|
|
99556
|
+
} else {
|
|
99557
|
+
browser = await defaultBrowser2();
|
|
99194
99558
|
}
|
|
99195
|
-
if (
|
|
99196
|
-
|
|
99197
|
-
|
|
99198
|
-
|
|
99559
|
+
if (browser.id in ids) {
|
|
99560
|
+
const browserName = ids[browser.id.toLowerCase()];
|
|
99561
|
+
if (app === "browserPrivate") {
|
|
99562
|
+
if (browserName === "safari") {
|
|
99563
|
+
throw new Error("Safari doesn't support opening in private mode via command line");
|
|
99564
|
+
}
|
|
99565
|
+
appArguments.push(flags[browserName]);
|
|
99199
99566
|
}
|
|
99200
|
-
|
|
99201
|
-
|
|
99202
|
-
|
|
99203
|
-
|
|
99204
|
-
|
|
99205
|
-
|
|
99567
|
+
return baseOpen({
|
|
99568
|
+
...options,
|
|
99569
|
+
app: {
|
|
99570
|
+
name: apps[browserName],
|
|
99571
|
+
arguments: appArguments
|
|
99572
|
+
}
|
|
99573
|
+
});
|
|
99206
99574
|
}
|
|
99575
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
99207
99576
|
}
|
|
99208
|
-
|
|
99209
|
-
|
|
99210
|
-
|
|
99577
|
+
let command2;
|
|
99578
|
+
const cliArguments = [];
|
|
99579
|
+
const childProcessOptions = {};
|
|
99580
|
+
let shouldUseWindowsInWsl = false;
|
|
99581
|
+
if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
|
|
99582
|
+
shouldUseWindowsInWsl = await canAccessPowerShell();
|
|
99211
99583
|
}
|
|
99212
|
-
if (
|
|
99213
|
-
|
|
99214
|
-
|
|
99215
|
-
|
|
99584
|
+
if (platform === "darwin") {
|
|
99585
|
+
command2 = "open";
|
|
99586
|
+
if (options.wait) {
|
|
99587
|
+
cliArguments.push("--wait-apps");
|
|
99216
99588
|
}
|
|
99217
|
-
|
|
99218
|
-
|
|
99219
|
-
|
|
99220
|
-
|
|
99221
|
-
|
|
99222
|
-
|
|
99223
|
-
|
|
99224
|
-
|
|
99225
|
-
|
|
99226
|
-
} else if (
|
|
99227
|
-
|
|
99228
|
-
|
|
99229
|
-
|
|
99230
|
-
|
|
99231
|
-
|
|
99232
|
-
|
|
99233
|
-
|
|
99234
|
-
|
|
99235
|
-
|
|
99236
|
-
|
|
99237
|
-
|
|
99238
|
-
|
|
99239
|
-
|
|
99240
|
-
|
|
99241
|
-
|
|
99242
|
-
|
|
99243
|
-
toml,
|
|
99244
|
-
ptr: k[1] - 1
|
|
99245
|
-
});
|
|
99246
|
-
}
|
|
99247
|
-
k[1]++;
|
|
99248
|
-
}
|
|
99249
|
-
let p2 = peekTable2(
|
|
99250
|
-
k[0],
|
|
99251
|
-
res,
|
|
99252
|
-
meta,
|
|
99253
|
-
isTableArray ? 2 : 1
|
|
99254
|
-
/* Type.EXPLICIT */
|
|
99255
|
-
);
|
|
99256
|
-
if (!p2) {
|
|
99257
|
-
throw new TomlError2("trying to redefine an already defined table or value", {
|
|
99258
|
-
toml,
|
|
99259
|
-
ptr
|
|
99260
|
-
});
|
|
99589
|
+
if (options.background) {
|
|
99590
|
+
cliArguments.push("--background");
|
|
99591
|
+
}
|
|
99592
|
+
if (options.newInstance) {
|
|
99593
|
+
cliArguments.push("--new");
|
|
99594
|
+
}
|
|
99595
|
+
if (app) {
|
|
99596
|
+
cliArguments.push("-a", app);
|
|
99597
|
+
}
|
|
99598
|
+
} else if (platform === "win32" || shouldUseWindowsInWsl) {
|
|
99599
|
+
command2 = await powerShellPath2();
|
|
99600
|
+
cliArguments.push(...executePowerShell.argumentsPrefix);
|
|
99601
|
+
if (!is_wsl_default) {
|
|
99602
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
99603
|
+
}
|
|
99604
|
+
if (is_wsl_default && options.target) {
|
|
99605
|
+
options.target = await convertWslPathToWindows(options.target);
|
|
99606
|
+
}
|
|
99607
|
+
const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
|
|
99608
|
+
if (options.wait) {
|
|
99609
|
+
encodedArguments.push("-Wait");
|
|
99610
|
+
}
|
|
99611
|
+
if (app) {
|
|
99612
|
+
encodedArguments.push(executePowerShell.escapeArgument(app));
|
|
99613
|
+
if (options.target) {
|
|
99614
|
+
appArguments.push(options.target);
|
|
99261
99615
|
}
|
|
99262
|
-
|
|
99263
|
-
|
|
99264
|
-
|
|
99616
|
+
} else if (options.target) {
|
|
99617
|
+
encodedArguments.push(executePowerShell.escapeArgument(options.target));
|
|
99618
|
+
}
|
|
99619
|
+
if (appArguments.length > 0) {
|
|
99620
|
+
appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
|
|
99621
|
+
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
99622
|
+
}
|
|
99623
|
+
options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
|
|
99624
|
+
if (!options.wait) {
|
|
99625
|
+
childProcessOptions.stdio = "ignore";
|
|
99626
|
+
}
|
|
99627
|
+
} else {
|
|
99628
|
+
if (app) {
|
|
99629
|
+
command2 = app;
|
|
99265
99630
|
} else {
|
|
99266
|
-
|
|
99267
|
-
let
|
|
99268
|
-
|
|
99269
|
-
|
|
99270
|
-
|
|
99271
|
-
|
|
99272
|
-
/* Type.DOTTED */
|
|
99273
|
-
);
|
|
99274
|
-
if (!p2) {
|
|
99275
|
-
throw new TomlError2("trying to redefine an already defined table or value", {
|
|
99276
|
-
toml,
|
|
99277
|
-
ptr
|
|
99278
|
-
});
|
|
99631
|
+
const isBundled = !__dirname3 || __dirname3 === "/";
|
|
99632
|
+
let exeLocalXdgOpen = false;
|
|
99633
|
+
try {
|
|
99634
|
+
await import_promises5.default.access(localXdgOpenPath, import_promises5.constants.X_OK);
|
|
99635
|
+
exeLocalXdgOpen = true;
|
|
99636
|
+
} catch {
|
|
99279
99637
|
}
|
|
99280
|
-
|
|
99281
|
-
|
|
99282
|
-
ptr = v[1];
|
|
99638
|
+
const useSystemXdgOpen = import_node_process13.default.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
99639
|
+
command2 = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
99283
99640
|
}
|
|
99284
|
-
|
|
99285
|
-
|
|
99286
|
-
|
|
99287
|
-
|
|
99288
|
-
|
|
99289
|
-
|
|
99641
|
+
if (appArguments.length > 0) {
|
|
99642
|
+
cliArguments.push(...appArguments);
|
|
99643
|
+
}
|
|
99644
|
+
if (!options.wait) {
|
|
99645
|
+
childProcessOptions.stdio = "ignore";
|
|
99646
|
+
childProcessOptions.detached = true;
|
|
99290
99647
|
}
|
|
99291
|
-
ptr = skipVoid2(toml, ptr);
|
|
99292
|
-
}
|
|
99293
|
-
return res;
|
|
99294
|
-
}
|
|
99295
|
-
|
|
99296
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/stringify.js
|
|
99297
|
-
var BARE_KEY2 = /^[a-z0-9-_]+$/i;
|
|
99298
|
-
function extendedTypeOf2(obj) {
|
|
99299
|
-
let type = typeof obj;
|
|
99300
|
-
if (type === "object") {
|
|
99301
|
-
if (Array.isArray(obj))
|
|
99302
|
-
return "array";
|
|
99303
|
-
if (obj instanceof Date)
|
|
99304
|
-
return "date";
|
|
99305
|
-
}
|
|
99306
|
-
return type;
|
|
99307
|
-
}
|
|
99308
|
-
function isArrayOfTables2(obj) {
|
|
99309
|
-
for (let i = 0; i < obj.length; i++) {
|
|
99310
|
-
if (extendedTypeOf2(obj[i]) !== "object")
|
|
99311
|
-
return false;
|
|
99312
|
-
}
|
|
99313
|
-
return obj.length != 0;
|
|
99314
|
-
}
|
|
99315
|
-
function formatString2(s) {
|
|
99316
|
-
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
99317
|
-
}
|
|
99318
|
-
function stringifyValue2(val, type, depth, numberAsFloat) {
|
|
99319
|
-
if (depth === 0) {
|
|
99320
|
-
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
99321
|
-
}
|
|
99322
|
-
if (type === "number") {
|
|
99323
|
-
if (isNaN(val))
|
|
99324
|
-
return "nan";
|
|
99325
|
-
if (val === Infinity)
|
|
99326
|
-
return "inf";
|
|
99327
|
-
if (val === -Infinity)
|
|
99328
|
-
return "-inf";
|
|
99329
|
-
if (numberAsFloat && Number.isInteger(val))
|
|
99330
|
-
return val.toFixed(1);
|
|
99331
|
-
return val.toString();
|
|
99332
99648
|
}
|
|
99333
|
-
if (
|
|
99334
|
-
|
|
99649
|
+
if (platform === "darwin" && appArguments.length > 0) {
|
|
99650
|
+
cliArguments.push("--args", ...appArguments);
|
|
99335
99651
|
}
|
|
99336
|
-
if (
|
|
99337
|
-
|
|
99652
|
+
if (options.target) {
|
|
99653
|
+
cliArguments.push(options.target);
|
|
99338
99654
|
}
|
|
99339
|
-
|
|
99340
|
-
|
|
99341
|
-
|
|
99342
|
-
|
|
99343
|
-
|
|
99655
|
+
const subprocess = import_node_child_process8.default.spawn(command2, cliArguments, childProcessOptions);
|
|
99656
|
+
if (options.wait) {
|
|
99657
|
+
return new Promise((resolve13, reject) => {
|
|
99658
|
+
subprocess.once("error", reject);
|
|
99659
|
+
subprocess.once("close", (exitCode) => {
|
|
99660
|
+
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
99661
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
99662
|
+
return;
|
|
99663
|
+
}
|
|
99664
|
+
resolve13(subprocess);
|
|
99665
|
+
});
|
|
99666
|
+
});
|
|
99344
99667
|
}
|
|
99345
|
-
if (
|
|
99346
|
-
return
|
|
99668
|
+
if (isFallbackAttempt) {
|
|
99669
|
+
return new Promise((resolve13, reject) => {
|
|
99670
|
+
subprocess.once("error", reject);
|
|
99671
|
+
subprocess.once("spawn", () => {
|
|
99672
|
+
subprocess.once("close", (exitCode) => {
|
|
99673
|
+
subprocess.off("error", reject);
|
|
99674
|
+
if (exitCode !== 0) {
|
|
99675
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
99676
|
+
return;
|
|
99677
|
+
}
|
|
99678
|
+
subprocess.unref();
|
|
99679
|
+
resolve13(subprocess);
|
|
99680
|
+
});
|
|
99681
|
+
});
|
|
99682
|
+
});
|
|
99347
99683
|
}
|
|
99348
|
-
|
|
99349
|
-
|
|
99684
|
+
subprocess.unref();
|
|
99685
|
+
return new Promise((resolve13, reject) => {
|
|
99686
|
+
subprocess.once("error", reject);
|
|
99687
|
+
subprocess.once("spawn", () => {
|
|
99688
|
+
subprocess.off("error", reject);
|
|
99689
|
+
resolve13(subprocess);
|
|
99690
|
+
});
|
|
99691
|
+
});
|
|
99692
|
+
};
|
|
99693
|
+
var open = (target, options) => {
|
|
99694
|
+
if (typeof target !== "string") {
|
|
99695
|
+
throw new TypeError("Expected a `target`");
|
|
99350
99696
|
}
|
|
99351
|
-
|
|
99352
|
-
|
|
99353
|
-
|
|
99354
|
-
|
|
99355
|
-
|
|
99356
|
-
|
|
99357
|
-
|
|
99358
|
-
|
|
99359
|
-
if (i)
|
|
99360
|
-
res += ", ";
|
|
99361
|
-
res += BARE_KEY2.test(k) ? k : formatString2(k);
|
|
99362
|
-
res += " = ";
|
|
99363
|
-
res += stringifyValue2(obj[k], extendedTypeOf2(obj[k]), depth - 1, numberAsFloat);
|
|
99697
|
+
return baseOpen({
|
|
99698
|
+
...options,
|
|
99699
|
+
target
|
|
99700
|
+
});
|
|
99701
|
+
};
|
|
99702
|
+
function detectArchBinary(binary) {
|
|
99703
|
+
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
99704
|
+
return binary;
|
|
99364
99705
|
}
|
|
99365
|
-
|
|
99366
|
-
|
|
99367
|
-
|
|
99368
|
-
if (array.length === 0)
|
|
99369
|
-
return "[]";
|
|
99370
|
-
let res = "[ ";
|
|
99371
|
-
for (let i = 0; i < array.length; i++) {
|
|
99372
|
-
if (i)
|
|
99373
|
-
res += ", ";
|
|
99374
|
-
if (array[i] === null || array[i] === void 0) {
|
|
99375
|
-
throw new TypeError("arrays cannot contain null or undefined values");
|
|
99376
|
-
}
|
|
99377
|
-
res += stringifyValue2(array[i], extendedTypeOf2(array[i]), depth - 1, numberAsFloat);
|
|
99706
|
+
const { [arch2]: archBinary } = binary;
|
|
99707
|
+
if (!archBinary) {
|
|
99708
|
+
throw new Error(`${arch2} is not supported`);
|
|
99378
99709
|
}
|
|
99379
|
-
return
|
|
99710
|
+
return archBinary;
|
|
99380
99711
|
}
|
|
99381
|
-
function
|
|
99382
|
-
if (
|
|
99383
|
-
|
|
99712
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
|
|
99713
|
+
if (wsl && is_wsl_default) {
|
|
99714
|
+
return detectArchBinary(wsl);
|
|
99384
99715
|
}
|
|
99385
|
-
|
|
99386
|
-
|
|
99387
|
-
res += `${res && "\n"}[[${key}]]
|
|
99388
|
-
`;
|
|
99389
|
-
res += stringifyTable2(0, array[i], key, depth, numberAsFloat);
|
|
99716
|
+
if (!platformBinary) {
|
|
99717
|
+
throw new Error(`${platform} is not supported`);
|
|
99390
99718
|
}
|
|
99391
|
-
return
|
|
99719
|
+
return detectArchBinary(platformBinary);
|
|
99392
99720
|
}
|
|
99393
|
-
|
|
99394
|
-
|
|
99395
|
-
|
|
99396
|
-
|
|
99397
|
-
|
|
99398
|
-
|
|
99399
|
-
|
|
99400
|
-
|
|
99401
|
-
|
|
99402
|
-
|
|
99403
|
-
|
|
99404
|
-
|
|
99405
|
-
|
|
99406
|
-
}
|
|
99407
|
-
let key = BARE_KEY2.test(k) ? k : formatString2(k);
|
|
99408
|
-
if (type === "array" && isArrayOfTables2(obj[k])) {
|
|
99409
|
-
tables += (tables && "\n") + stringifyArrayTable2(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
99410
|
-
} else if (type === "object") {
|
|
99411
|
-
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
99412
|
-
tables += (tables && "\n") + stringifyTable2(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
99413
|
-
} else {
|
|
99414
|
-
preamble += key;
|
|
99415
|
-
preamble += " = ";
|
|
99416
|
-
preamble += stringifyValue2(obj[k], type, depth, numberAsFloat);
|
|
99417
|
-
preamble += "\n";
|
|
99418
|
-
}
|
|
99419
|
-
}
|
|
99721
|
+
var apps = {
|
|
99722
|
+
browser: "browser",
|
|
99723
|
+
browserPrivate: "browserPrivate"
|
|
99724
|
+
};
|
|
99725
|
+
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
99726
|
+
darwin: "google chrome",
|
|
99727
|
+
win32: "chrome",
|
|
99728
|
+
// `chromium-browser` is the older deb package name used by Ubuntu/Debian before snap.
|
|
99729
|
+
linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
|
|
99730
|
+
}, {
|
|
99731
|
+
wsl: {
|
|
99732
|
+
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
99733
|
+
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
99420
99734
|
}
|
|
99421
|
-
|
|
99422
|
-
|
|
99423
|
-
|
|
99424
|
-
|
|
99425
|
-
|
|
99426
|
-
}
|
|
99427
|
-
|
|
99428
|
-
|
|
99429
|
-
|
|
99735
|
+
}));
|
|
99736
|
+
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
99737
|
+
darwin: "brave browser",
|
|
99738
|
+
win32: "brave",
|
|
99739
|
+
linux: ["brave-browser", "brave"]
|
|
99740
|
+
}, {
|
|
99741
|
+
wsl: {
|
|
99742
|
+
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
99743
|
+
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
99430
99744
|
}
|
|
99431
|
-
|
|
99432
|
-
|
|
99433
|
-
|
|
99434
|
-
|
|
99435
|
-
|
|
99436
|
-
|
|
99437
|
-
|
|
99438
|
-
|
|
99745
|
+
}));
|
|
99746
|
+
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
99747
|
+
darwin: "firefox",
|
|
99748
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
99749
|
+
linux: "firefox"
|
|
99750
|
+
}, {
|
|
99751
|
+
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
99752
|
+
}));
|
|
99753
|
+
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
99754
|
+
darwin: "microsoft edge",
|
|
99755
|
+
win32: "msedge",
|
|
99756
|
+
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
99757
|
+
}, {
|
|
99758
|
+
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
99759
|
+
}));
|
|
99760
|
+
defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
99761
|
+
darwin: "Safari"
|
|
99762
|
+
}));
|
|
99763
|
+
var open_default = open;
|
|
99439
99764
|
|
|
99440
|
-
// src/helpers/
|
|
99441
|
-
var
|
|
99442
|
-
|
|
99443
|
-
|
|
99444
|
-
|
|
99445
|
-
|
|
99446
|
-
|
|
99447
|
-
};
|
|
99448
|
-
|
|
99449
|
-
|
|
99450
|
-
|
|
99451
|
-
|
|
99452
|
-
throw new Error(error2);
|
|
99453
|
-
}
|
|
99454
|
-
};
|
|
99455
|
-
var removeFile = (path6) => {
|
|
99765
|
+
// src/helpers/cli.ts
|
|
99766
|
+
var import_semver2 = __toESM(require_semver2());
|
|
99767
|
+
async function openInBrowser(url) {
|
|
99768
|
+
updateStatus("Opening browser");
|
|
99769
|
+
const childProcess4 = await open_default(url);
|
|
99770
|
+
childProcess4.on("error", () => {
|
|
99771
|
+
warn("Failed to open browser");
|
|
99772
|
+
});
|
|
99773
|
+
}
|
|
99774
|
+
var isUpdateAvailable = async () => {
|
|
99775
|
+
const s = spinner(spinnerFrames.vertical, blue);
|
|
99776
|
+
s.start("Checking if a newer version is available");
|
|
99456
99777
|
try {
|
|
99457
|
-
|
|
99458
|
-
|
|
99459
|
-
|
|
99778
|
+
const latestVersion = await getLatestPackageVersion("create-cloudflare");
|
|
99779
|
+
return (
|
|
99780
|
+
// Don't auto-update to major versions
|
|
99781
|
+
import_semver2.default.diff(latestVersion, version) !== "major" && import_semver2.default.gt(latestVersion, version)
|
|
99782
|
+
);
|
|
99783
|
+
} catch {
|
|
99784
|
+
s.update("Failed to read latest version from npm.");
|
|
99785
|
+
return false;
|
|
99786
|
+
} finally {
|
|
99787
|
+
s.stop();
|
|
99460
99788
|
}
|
|
99461
99789
|
};
|
|
99462
|
-
var
|
|
99463
|
-
|
|
99464
|
-
|
|
99465
|
-
|
|
99466
|
-
|
|
99467
|
-
|
|
99468
|
-
|
|
99469
|
-
|
|
99470
|
-
|
|
99790
|
+
var C3_DEFAULTS = {
|
|
99791
|
+
projectName: new import_haikunator.default().haikunate({ tokenHex: true }),
|
|
99792
|
+
category: "hello-world",
|
|
99793
|
+
type: "hello-world-with-assets",
|
|
99794
|
+
framework: "analog",
|
|
99795
|
+
experimental: false,
|
|
99796
|
+
autoUpdate: true,
|
|
99797
|
+
deploy: false,
|
|
99798
|
+
git: true,
|
|
99799
|
+
agents: true,
|
|
99800
|
+
open: true,
|
|
99801
|
+
lang: "ts",
|
|
99802
|
+
template: "cloudflare/workers-sdk/packages/create-cloudflare/templates/hello-world-with-assets"
|
|
99471
99803
|
};
|
|
99472
|
-
var
|
|
99473
|
-
|
|
99804
|
+
var WRANGLER_DEFAULTS = {
|
|
99805
|
+
...C3_DEFAULTS,
|
|
99806
|
+
type: "hello-world-with-assets",
|
|
99807
|
+
deploy: false
|
|
99474
99808
|
};
|
|
99475
99809
|
|
|
99476
99810
|
// ../codemod/dist/index.mjs
|
|
99477
|
-
var
|
|
99478
|
-
var
|
|
99811
|
+
var import_node_fs13 = require("node:fs");
|
|
99812
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
99479
99813
|
var recast = __toESM(require_main2(), 1);
|
|
99480
99814
|
var esprimaParser = __toESM(require_esprima3(), 1);
|
|
99481
99815
|
var typescriptParser = __toESM(require_typescript2(), 1);
|
|
@@ -99500,10 +99834,10 @@ function parseTs(src) {
|
|
|
99500
99834
|
}
|
|
99501
99835
|
__name2(parseTs, "parseTs");
|
|
99502
99836
|
function parseFile(filePath) {
|
|
99503
|
-
const lang =
|
|
99837
|
+
const lang = import_node_path12.default.extname(filePath).slice(1);
|
|
99504
99838
|
const parser2 = lang === "js" ? esprimaParser : typescriptParser;
|
|
99505
99839
|
try {
|
|
99506
|
-
const fileContents = (0,
|
|
99840
|
+
const fileContents = (0, import_node_fs13.readFileSync)(import_node_path12.default.resolve(filePath), "utf-8");
|
|
99507
99841
|
if (fileContents) {
|
|
99508
99842
|
return recast.parse(fileContents, { parser: parser2 }).program;
|
|
99509
99843
|
}
|
|
@@ -99517,7 +99851,7 @@ function transformFile(filePath, methods) {
|
|
|
99517
99851
|
const ast = parseFile(filePath);
|
|
99518
99852
|
if (ast) {
|
|
99519
99853
|
recast.visit(ast, methods);
|
|
99520
|
-
(0,
|
|
99854
|
+
(0, import_node_fs13.writeFileSync)(filePath, recast.print(ast).code);
|
|
99521
99855
|
}
|
|
99522
99856
|
}
|
|
99523
99857
|
__name2(transformFile, "transformFile");
|
|
@@ -99555,15 +99889,15 @@ __name2(getPropertyName, "getPropertyName");
|
|
|
99555
99889
|
var package_default = {
|
|
99556
99890
|
name: "frameworks_clis_info",
|
|
99557
99891
|
dependencies: {
|
|
99558
|
-
"@angular/create": "
|
|
99559
|
-
"@tanstack/cli": "0.
|
|
99560
|
-
"create-analog": "2.
|
|
99892
|
+
"@angular/create": "22.0.0",
|
|
99893
|
+
"@tanstack/cli": "0.69.2",
|
|
99894
|
+
"create-analog": "2.6.0",
|
|
99561
99895
|
"create-astro": "5.0.6",
|
|
99562
99896
|
"create-docusaurus": "3.10.1",
|
|
99563
99897
|
"create-hono": "0.19.4",
|
|
99564
|
-
"create-next-app": "16.2.
|
|
99898
|
+
"create-next-app": "16.2.7",
|
|
99565
99899
|
"create-qwik": "1.20.0",
|
|
99566
|
-
"create-react-router": "7.
|
|
99900
|
+
"create-react-router": "7.17.0",
|
|
99567
99901
|
"create-rwsdk": "3.1.3",
|
|
99568
99902
|
"create-solid": "0.7.0",
|
|
99569
99903
|
"create-vike": "0.0.627",
|
|
@@ -99572,7 +99906,7 @@ var package_default = {
|
|
|
99572
99906
|
"create-waku": "0.12.5-1.0.0-alpha.10-0",
|
|
99573
99907
|
gatsby: "5.16.1",
|
|
99574
99908
|
nuxi: "3.35.2",
|
|
99575
|
-
sv: "0.15.
|
|
99909
|
+
sv: "0.15.4"
|
|
99576
99910
|
},
|
|
99577
99911
|
info: [
|
|
99578
99912
|
"This package.json is only used to keep track of the frameworks cli dependencies",
|
|
@@ -99607,8 +99941,8 @@ var runFrameworkGenerator = async (ctx, args) => {
|
|
|
99607
99941
|
};
|
|
99608
99942
|
|
|
99609
99943
|
// src/helpers/compatDate.ts
|
|
99610
|
-
var
|
|
99611
|
-
var
|
|
99944
|
+
var import_node_fs14 = require("node:fs");
|
|
99945
|
+
var import_node_path13 = require("node:path");
|
|
99612
99946
|
function getWorkerdCompatibilityDate(_projectPath) {
|
|
99613
99947
|
const s = spinner();
|
|
99614
99948
|
s.start("Retrieving current workerd compatibility date");
|
|
@@ -99617,14 +99951,14 @@ function getWorkerdCompatibilityDate(_projectPath) {
|
|
|
99617
99951
|
return date;
|
|
99618
99952
|
}
|
|
99619
99953
|
function getLatestTypesEntrypoint(ctx) {
|
|
99620
|
-
const workersTypesPath = (0,
|
|
99954
|
+
const workersTypesPath = (0, import_node_path13.resolve)(
|
|
99621
99955
|
ctx.project.path,
|
|
99622
99956
|
"node_modules",
|
|
99623
99957
|
"@cloudflare",
|
|
99624
99958
|
"workers-types"
|
|
99625
99959
|
);
|
|
99626
99960
|
try {
|
|
99627
|
-
const entrypoints = (0,
|
|
99961
|
+
const entrypoints = (0, import_node_fs14.readdirSync)(workersTypesPath);
|
|
99628
99962
|
const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
|
|
99629
99963
|
if (sorted.length === 0) {
|
|
99630
99964
|
return null;
|
|
@@ -99708,7 +100042,7 @@ var config = {
|
|
|
99708
100042
|
var c3_default = config;
|
|
99709
100043
|
|
|
99710
100044
|
// templates/angular/pages/c3.ts
|
|
99711
|
-
var
|
|
100045
|
+
var import_node_path14 = require("node:path");
|
|
99712
100046
|
var { npm: npm2 } = detectPackageManager();
|
|
99713
100047
|
var generate2 = async (ctx) => {
|
|
99714
100048
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
|
|
@@ -99730,23 +100064,23 @@ async function updateAppCode() {
|
|
|
99730
100064
|
const s = spinner();
|
|
99731
100065
|
s.start(`Updating application code`);
|
|
99732
100066
|
const appConfigPath = "src/app/app.config.ts";
|
|
99733
|
-
const appConfig = readFile((0,
|
|
100067
|
+
const appConfig = readFile((0, import_node_path14.resolve)(appConfigPath));
|
|
99734
100068
|
const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
|
|
99735
100069
|
"providers: [",
|
|
99736
100070
|
"providers: [provideHttpClient(withFetch()), "
|
|
99737
100071
|
);
|
|
99738
|
-
writeFile3((0,
|
|
100072
|
+
writeFile3((0, import_node_path14.resolve)(appConfigPath), newAppConfig);
|
|
99739
100073
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
99740
100074
|
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
99741
|
-
const appRoutes = readFile((0,
|
|
100075
|
+
const appRoutes = readFile((0, import_node_path14.resolve)(appServerRoutesPath));
|
|
99742
100076
|
const newAppRoutes = appRoutes.replace(
|
|
99743
100077
|
"RenderMode.Prerender",
|
|
99744
100078
|
"RenderMode.Server"
|
|
99745
100079
|
);
|
|
99746
|
-
writeFile3((0,
|
|
100080
|
+
writeFile3((0, import_node_path14.resolve)(appServerRoutesPath), newAppRoutes);
|
|
99747
100081
|
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
99748
100082
|
s.start(`Updating package.json`);
|
|
99749
|
-
const packageJsonPath = (0,
|
|
100083
|
+
const packageJsonPath = (0, import_node_path14.resolve)("package.json");
|
|
99750
100084
|
const packageManifest = readJSON(packageJsonPath);
|
|
99751
100085
|
delete packageManifest["dependencies"]?.["express"];
|
|
99752
100086
|
delete packageManifest["devDependencies"]?.["@types/express"];
|
|
@@ -99760,9 +100094,9 @@ function updateAngularJson(ctx) {
|
|
|
99760
100094
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
99761
100095
|
architectSection.build.options.outputPath = "dist";
|
|
99762
100096
|
architectSection.build.options.outputMode = "server";
|
|
99763
|
-
architectSection.build.options.ssr.
|
|
100097
|
+
architectSection.build.options.ssr.platform = "neutral";
|
|
99764
100098
|
architectSection.build.options.assets.push("src/_routes.json");
|
|
99765
|
-
writeFile3((0,
|
|
100099
|
+
writeFile3((0, import_node_path14.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
99766
100100
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
99767
100101
|
}
|
|
99768
100102
|
var config2 = {
|
|
@@ -99794,7 +100128,7 @@ var config2 = {
|
|
|
99794
100128
|
var c3_default2 = config2;
|
|
99795
100129
|
|
|
99796
100130
|
// templates/angular/workers/c3.ts
|
|
99797
|
-
var
|
|
100131
|
+
var import_node_path15 = require("node:path");
|
|
99798
100132
|
var { npm: npm3 } = detectPackageManager();
|
|
99799
100133
|
var generate3 = async (ctx) => {
|
|
99800
100134
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
|
|
@@ -99816,23 +100150,23 @@ async function updateAppCode2() {
|
|
|
99816
100150
|
const s = spinner();
|
|
99817
100151
|
s.start(`Updating application code`);
|
|
99818
100152
|
const appConfigPath = "src/app/app.config.ts";
|
|
99819
|
-
const appConfig = readFile((0,
|
|
100153
|
+
const appConfig = readFile((0, import_node_path15.resolve)(appConfigPath));
|
|
99820
100154
|
const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
|
|
99821
100155
|
"providers: [",
|
|
99822
100156
|
"providers: [provideHttpClient(withFetch()), "
|
|
99823
100157
|
);
|
|
99824
|
-
writeFile3((0,
|
|
100158
|
+
writeFile3((0, import_node_path15.resolve)(appConfigPath), newAppConfig);
|
|
99825
100159
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
99826
100160
|
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
99827
|
-
const appRoutes = readFile((0,
|
|
100161
|
+
const appRoutes = readFile((0, import_node_path15.resolve)(appServerRoutesPath));
|
|
99828
100162
|
const newAppRoutes = appRoutes.replace(
|
|
99829
100163
|
"RenderMode.Prerender",
|
|
99830
100164
|
"RenderMode.Server"
|
|
99831
100165
|
);
|
|
99832
|
-
writeFile3((0,
|
|
100166
|
+
writeFile3((0, import_node_path15.resolve)(appServerRoutesPath), newAppRoutes);
|
|
99833
100167
|
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
99834
100168
|
s.start(`Updating package.json`);
|
|
99835
|
-
const packageJsonPath = (0,
|
|
100169
|
+
const packageJsonPath = (0, import_node_path15.resolve)("package.json");
|
|
99836
100170
|
const packageManifest = readJSON(packageJsonPath);
|
|
99837
100171
|
delete packageManifest["dependencies"]?.["express"];
|
|
99838
100172
|
delete packageManifest["devDependencies"]?.["@types/express"];
|
|
@@ -99842,12 +100176,12 @@ async function updateAppCode2() {
|
|
|
99842
100176
|
function updateAngularJson2(ctx) {
|
|
99843
100177
|
const s = spinner();
|
|
99844
100178
|
s.start(`Updating angular.json config`);
|
|
99845
|
-
const angularJson = readJSON((0,
|
|
100179
|
+
const angularJson = readJSON((0, import_node_path15.resolve)("angular.json"));
|
|
99846
100180
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
99847
100181
|
architectSection.build.options.outputPath = "dist";
|
|
99848
100182
|
architectSection.build.options.outputMode = "server";
|
|
99849
|
-
architectSection.build.options.ssr.
|
|
99850
|
-
writeFile3((0,
|
|
100183
|
+
architectSection.build.options.ssr.platform = "neutral";
|
|
100184
|
+
writeFile3((0, import_node_path15.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
99851
100185
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
99852
100186
|
}
|
|
99853
100187
|
var config3 = {
|
|
@@ -100682,10 +101016,10 @@ var config25 = {
|
|
|
100682
101016
|
var c3_default28 = config25;
|
|
100683
101017
|
|
|
100684
101018
|
// templates/pre-existing/c3.ts
|
|
100685
|
-
var
|
|
100686
|
-
var
|
|
101019
|
+
var import_node_fs15 = require("node:fs");
|
|
101020
|
+
var import_promises6 = require("node:fs/promises");
|
|
100687
101021
|
var import_node_os6 = require("node:os");
|
|
100688
|
-
var
|
|
101022
|
+
var import_node_path16 = require("node:path");
|
|
100689
101023
|
|
|
100690
101024
|
// src/helpers/command.ts
|
|
100691
101025
|
var runWranglerCommand = async (command2, opts = {}) => {
|
|
@@ -100815,7 +101149,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
100815
101149
|
}
|
|
100816
101150
|
);
|
|
100817
101151
|
}
|
|
100818
|
-
const tempdir = await (0,
|
|
101152
|
+
const tempdir = await (0, import_promises6.mkdtemp)((0, import_node_path16.join)((0, import_node_os6.tmpdir)(), "c3-wrangler-init--from-dash-"));
|
|
100819
101153
|
await runCommand(
|
|
100820
101154
|
[
|
|
100821
101155
|
...dlx,
|
|
@@ -100837,17 +101171,17 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
100837
101171
|
)}`
|
|
100838
101172
|
}
|
|
100839
101173
|
);
|
|
100840
|
-
await (0,
|
|
100841
|
-
(0,
|
|
100842
|
-
(0,
|
|
101174
|
+
await (0, import_promises6.cp)(
|
|
101175
|
+
(0, import_node_path16.join)(tempdir, ctx.args.existingScript, "src"),
|
|
101176
|
+
(0, import_node_path16.join)(ctx.project.path, "src"),
|
|
100843
101177
|
{ recursive: true }
|
|
100844
101178
|
);
|
|
100845
101179
|
const configFiles = ["wrangler.jsonc", "wrangler.json", "wrangler.toml"];
|
|
100846
101180
|
let configFileCopied = false;
|
|
100847
101181
|
for (const configFile of configFiles) {
|
|
100848
|
-
const sourcePath = (0,
|
|
100849
|
-
if ((0,
|
|
100850
|
-
await (0,
|
|
101182
|
+
const sourcePath = (0, import_node_path16.join)(tempdir, ctx.args.existingScript, configFile);
|
|
101183
|
+
if ((0, import_node_fs15.existsSync)(sourcePath)) {
|
|
101184
|
+
await (0, import_promises6.cp)(sourcePath, (0, import_node_path16.join)(ctx.project.path, configFile));
|
|
100851
101185
|
configFileCopied = true;
|
|
100852
101186
|
break;
|
|
100853
101187
|
}
|
|
@@ -100918,20 +101252,20 @@ var config27 = {
|
|
|
100918
101252
|
var c3_default30 = config27;
|
|
100919
101253
|
|
|
100920
101254
|
// src/helpers/codemod.ts
|
|
100921
|
-
var
|
|
100922
|
-
var
|
|
101255
|
+
var import_node_fs16 = require("node:fs");
|
|
101256
|
+
var import_node_path17 = require("node:path");
|
|
100923
101257
|
var loadSnippets = (parentFolder) => {
|
|
100924
|
-
const snippetsPath = (0,
|
|
100925
|
-
if (!(0,
|
|
101258
|
+
const snippetsPath = (0, import_node_path17.join)(parentFolder, "snippets");
|
|
101259
|
+
if (!(0, import_node_fs16.lstatSync)(snippetsPath, { throwIfNoEntry: false })?.isDirectory()) {
|
|
100926
101260
|
return {};
|
|
100927
101261
|
}
|
|
100928
|
-
const files = (0,
|
|
100929
|
-
return files.filter((fileName) => (0,
|
|
101262
|
+
const files = (0, import_node_fs16.readdirSync)(snippetsPath);
|
|
101263
|
+
return files.filter((fileName) => (0, import_node_fs16.lstatSync)((0, import_node_path17.join)(snippetsPath, fileName)).isFile()).filter((fileName) => [".js", ".ts"].includes((0, import_node_path17.extname)(fileName))).reduce((acc, snippetPath) => {
|
|
100930
101264
|
const [file2, ext] = snippetPath.split(".");
|
|
100931
101265
|
const key = `${file2}${ext === "js" ? "Js" : "Ts"}`;
|
|
100932
101266
|
return {
|
|
100933
101267
|
...acc,
|
|
100934
|
-
[key]: parseFile((0,
|
|
101268
|
+
[key]: parseFile((0, import_node_path17.join)(snippetsPath, snippetPath))?.body
|
|
100935
101269
|
};
|
|
100936
101270
|
}, {});
|
|
100937
101271
|
};
|
|
@@ -101122,7 +101456,7 @@ var config30 = {
|
|
|
101122
101456
|
var c3_default33 = config30;
|
|
101123
101457
|
|
|
101124
101458
|
// templates/react-router/c3.ts
|
|
101125
|
-
var
|
|
101459
|
+
var import_node_path18 = require("node:path");
|
|
101126
101460
|
var { npm: npm12 } = detectPackageManager();
|
|
101127
101461
|
var generate18 = async (ctx) => {
|
|
101128
101462
|
await runFrameworkGenerator(ctx, [
|
|
@@ -101141,9 +101475,9 @@ var configure10 = async (ctx) => {
|
|
|
101141
101475
|
});
|
|
101142
101476
|
const s = spinner();
|
|
101143
101477
|
s.start("Removing non-Cloudflare artifacts from template");
|
|
101144
|
-
removeFile((0,
|
|
101145
|
-
removeFile((0,
|
|
101146
|
-
const pkgJsonPath = (0,
|
|
101478
|
+
removeFile((0, import_node_path18.resolve)(ctx.project.path, "Dockerfile"));
|
|
101479
|
+
removeFile((0, import_node_path18.resolve)(ctx.project.path, ".dockerignore"));
|
|
101480
|
+
const pkgJsonPath = (0, import_node_path18.resolve)(ctx.project.path, "package.json");
|
|
101147
101481
|
const pkgJson = readJSON(pkgJsonPath);
|
|
101148
101482
|
delete pkgJson.dependencies?.["@react-router/node"];
|
|
101149
101483
|
delete pkgJson.dependencies?.["@react-router/serve"];
|
|
@@ -101518,7 +101852,7 @@ var config37 = {
|
|
|
101518
101852
|
var c3_default40 = config37;
|
|
101519
101853
|
|
|
101520
101854
|
// templates/svelte/pages/c3.ts
|
|
101521
|
-
var
|
|
101855
|
+
var import_node_fs17 = require("node:fs");
|
|
101522
101856
|
var recast10 = __toESM(require_main2());
|
|
101523
101857
|
var { npm: npm17 } = detectPackageManager();
|
|
101524
101858
|
var generate23 = async (ctx) => {
|
|
@@ -101550,7 +101884,7 @@ var updateSvelteConfig = () => {
|
|
|
101550
101884
|
};
|
|
101551
101885
|
var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
101552
101886
|
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
101553
|
-
if (!(0,
|
|
101887
|
+
if (!(0, import_node_fs17.existsSync)(filePath)) {
|
|
101554
101888
|
return;
|
|
101555
101889
|
}
|
|
101556
101890
|
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
@@ -102049,7 +102383,7 @@ If the application uses Durable Objects or Workflows, refer to the relevant best
|
|
|
102049
102383
|
var import_node_assert6 = __toESM(require("node:assert"));
|
|
102050
102384
|
|
|
102051
102385
|
// ../wrangler/package.json
|
|
102052
|
-
var version2 = "4.
|
|
102386
|
+
var version2 = "4.100.0";
|
|
102053
102387
|
|
|
102054
102388
|
// src/git.ts
|
|
102055
102389
|
var offerGit = async (ctx) => {
|
|
@@ -102237,8 +102571,8 @@ async function getProductionBranch(cwd) {
|
|
|
102237
102571
|
}
|
|
102238
102572
|
|
|
102239
102573
|
// src/validators.ts
|
|
102240
|
-
var
|
|
102241
|
-
var
|
|
102574
|
+
var import_node_fs18 = require("node:fs");
|
|
102575
|
+
var import_node_path19 = require("node:path");
|
|
102242
102576
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
102243
102577
|
var validateTemplateUrl = (value) => {
|
|
102244
102578
|
if (!String(value).match(TEMPLATE_REGEX)) {
|
|
@@ -102246,17 +102580,17 @@ var validateTemplateUrl = (value) => {
|
|
|
102246
102580
|
}
|
|
102247
102581
|
};
|
|
102248
102582
|
var validateProjectDirectory = (relativePath, args) => {
|
|
102249
|
-
const path6 = (0,
|
|
102250
|
-
const existsAlready = (0,
|
|
102583
|
+
const path6 = (0, import_node_path19.resolve)(relativePath);
|
|
102584
|
+
const existsAlready = (0, import_node_fs18.existsSync)(path6);
|
|
102251
102585
|
if (existsAlready) {
|
|
102252
|
-
for (const file2 of (0,
|
|
102586
|
+
for (const file2 of (0, import_node_fs18.readdirSync)(path6)) {
|
|
102253
102587
|
if (!isAllowedExistingFile(file2)) {
|
|
102254
102588
|
return `Directory \`${relativePath}\` already exists and contains files that might conflict. Please choose a new name.`;
|
|
102255
102589
|
}
|
|
102256
102590
|
}
|
|
102257
102591
|
}
|
|
102258
102592
|
if (!args.existingScript) {
|
|
102259
|
-
const projectName = (0,
|
|
102593
|
+
const projectName = (0, import_node_path19.basename)(path6);
|
|
102260
102594
|
const invalidChars = /[^a-z0-9-]/;
|
|
102261
102595
|
const invalidStartEnd = /^-|-$/;
|
|
102262
102596
|
if (projectName.match(invalidStartEnd)) {
|
|
@@ -102710,7 +103044,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
102710
103044
|
envInterfaceName: "Env",
|
|
102711
103045
|
...template
|
|
102712
103046
|
};
|
|
102713
|
-
const path6 = (0,
|
|
103047
|
+
const path6 = (0, import_node_path20.resolve)(projectName);
|
|
102714
103048
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
102715
103049
|
if (languageVariants.length > 0) {
|
|
102716
103050
|
if (hasTsConfig(path6)) {
|
|
@@ -102736,8 +103070,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
102736
103070
|
}
|
|
102737
103071
|
}
|
|
102738
103072
|
}
|
|
102739
|
-
const name3 = (0,
|
|
102740
|
-
const directory = (0,
|
|
103073
|
+
const name3 = (0, import_node_path20.basename)(path6);
|
|
103074
|
+
const directory = (0, import_node_path20.dirname)(path6);
|
|
102741
103075
|
const originalCWD = process.cwd();
|
|
102742
103076
|
return {
|
|
102743
103077
|
project: { name: name3, path: path6 },
|
|
@@ -102757,7 +103091,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
102757
103091
|
const { copyFiles } = ctx.template;
|
|
102758
103092
|
let srcdir;
|
|
102759
103093
|
if (isVariantInfo(copyFiles)) {
|
|
102760
|
-
srcdir = (0,
|
|
103094
|
+
srcdir = (0, import_node_path20.join)(getTemplatePath(ctx), copyFiles.path);
|
|
102761
103095
|
} else {
|
|
102762
103096
|
const selectVariant = copyFiles.selectVariant ?? defaultSelectVariant;
|
|
102763
103097
|
const variant = await selectVariant(ctx);
|
|
@@ -102767,22 +103101,22 @@ async function copyTemplateFiles(ctx) {
|
|
|
102767
103101
|
`Unknown variant provided: ${JSON.stringify(variant ?? "")}`
|
|
102768
103102
|
);
|
|
102769
103103
|
}
|
|
102770
|
-
srcdir = (0,
|
|
103104
|
+
srcdir = (0, import_node_path20.join)(getTemplatePath(ctx), variantInfo.path);
|
|
102771
103105
|
}
|
|
102772
103106
|
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
102773
|
-
const destdir = (0,
|
|
103107
|
+
const destdir = (0, import_node_path20.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
102774
103108
|
const s = spinner();
|
|
102775
103109
|
s.start(`Copying template files`);
|
|
102776
|
-
await (0,
|
|
102777
|
-
const dummyGitIgnorePath = (0,
|
|
102778
|
-
if ((0,
|
|
102779
|
-
await (0,
|
|
103110
|
+
await (0, import_promises7.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
103111
|
+
const dummyGitIgnorePath = (0, import_node_path20.join)(destdir, "__dot__gitignore");
|
|
103112
|
+
if ((0, import_node_fs19.existsSync)(dummyGitIgnorePath)) {
|
|
103113
|
+
await (0, import_promises7.rename)(dummyGitIgnorePath, (0, import_node_path20.join)(destdir, ".gitignore"));
|
|
102780
103114
|
}
|
|
102781
103115
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
102782
103116
|
}
|
|
102783
103117
|
function writeAgentsMd(projectPath) {
|
|
102784
|
-
const agentsMdPath = (0,
|
|
102785
|
-
if ((0,
|
|
103118
|
+
const agentsMdPath = (0, import_node_path20.join)(projectPath, "AGENTS.md");
|
|
103119
|
+
if ((0, import_node_fs19.existsSync)(agentsMdPath)) {
|
|
102786
103120
|
return;
|
|
102787
103121
|
}
|
|
102788
103122
|
writeFile3(agentsMdPath, getAgentsMd());
|
|
@@ -102811,26 +103145,26 @@ var validateTemplate = (path6, config49) => {
|
|
|
102811
103145
|
return;
|
|
102812
103146
|
}
|
|
102813
103147
|
if (isVariantInfo(config49.copyFiles)) {
|
|
102814
|
-
validateTemplateSrcDirectory((0,
|
|
103148
|
+
validateTemplateSrcDirectory((0, import_node_path20.resolve)(path6, config49.copyFiles.path), config49);
|
|
102815
103149
|
} else {
|
|
102816
103150
|
for (const variant of Object.values(config49.copyFiles.variants)) {
|
|
102817
|
-
validateTemplateSrcDirectory((0,
|
|
103151
|
+
validateTemplateSrcDirectory((0, import_node_path20.resolve)(path6, variant.path), config49);
|
|
102818
103152
|
}
|
|
102819
103153
|
}
|
|
102820
103154
|
};
|
|
102821
103155
|
var validateTemplateSrcDirectory = (path6, config49) => {
|
|
102822
103156
|
if (config49.platform === "workers") {
|
|
102823
|
-
const wranglerTomlPath = (0,
|
|
102824
|
-
const wranglerJsonPath = (0,
|
|
102825
|
-
const wranglerJsoncPath = (0,
|
|
102826
|
-
if (!(0,
|
|
103157
|
+
const wranglerTomlPath = (0, import_node_path20.resolve)(path6, "wrangler.toml");
|
|
103158
|
+
const wranglerJsonPath = (0, import_node_path20.resolve)(path6, "wrangler.json");
|
|
103159
|
+
const wranglerJsoncPath = (0, import_node_path20.resolve)(path6, "wrangler.jsonc");
|
|
103160
|
+
if (!(0, import_node_fs19.existsSync)(wranglerTomlPath) && !(0, import_node_fs19.existsSync)(wranglerJsonPath) && !(0, import_node_fs19.existsSync)(wranglerJsoncPath)) {
|
|
102827
103161
|
throw new Error(
|
|
102828
103162
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
102829
103163
|
);
|
|
102830
103164
|
}
|
|
102831
103165
|
}
|
|
102832
|
-
const pkgJsonPath = (0,
|
|
102833
|
-
if (!(0,
|
|
103166
|
+
const pkgJsonPath = (0, import_node_path20.resolve)(path6, "package.json");
|
|
103167
|
+
if (!(0, import_node_fs19.existsSync)(pkgJsonPath)) {
|
|
102834
103168
|
throw new Error(
|
|
102835
103169
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
102836
103170
|
);
|
|
@@ -102847,10 +103181,10 @@ var inferTemplateConfig = (path6) => {
|
|
|
102847
103181
|
};
|
|
102848
103182
|
var inferCopyFilesDefinition = (path6) => {
|
|
102849
103183
|
const variants = {};
|
|
102850
|
-
if ((0,
|
|
103184
|
+
if ((0, import_node_fs19.existsSync)((0, import_node_path20.join)(path6, "js"))) {
|
|
102851
103185
|
variants["js"] = { path: "./js" };
|
|
102852
103186
|
}
|
|
102853
|
-
if ((0,
|
|
103187
|
+
if ((0, import_node_fs19.existsSync)((0, import_node_path20.join)(path6, "ts"))) {
|
|
102854
103188
|
variants["ts"] = { path: "./ts" };
|
|
102855
103189
|
}
|
|
102856
103190
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
@@ -102885,7 +103219,7 @@ Use the format "github:<owner>/<repo>/sub/directory[#<branch>]" to clone a speci
|
|
|
102885
103219
|
force: true,
|
|
102886
103220
|
mode: options.mode
|
|
102887
103221
|
});
|
|
102888
|
-
const tmpDir = options.intoFolder ?? await (0,
|
|
103222
|
+
const tmpDir = options.intoFolder ?? await (0, import_promises7.mkdtemp)((0, import_node_path20.join)((0, import_node_os7.tmpdir)(), "c3-template"));
|
|
102889
103223
|
await emitter.clone(tmpDir);
|
|
102890
103224
|
return tmpDir;
|
|
102891
103225
|
} catch {
|
|
@@ -102894,8 +103228,8 @@ Use the format "github:<owner>/<repo>/sub/directory[#<branch>]" to clone a speci
|
|
|
102894
103228
|
}
|
|
102895
103229
|
}
|
|
102896
103230
|
function updatePythonPackageName(path6, projectName) {
|
|
102897
|
-
const pyProjectFile = (0,
|
|
102898
|
-
if (!(0,
|
|
103231
|
+
const pyProjectFile = (0, import_node_path20.resolve)(path6, "pyproject.toml");
|
|
103232
|
+
if (!(0, import_node_fs19.existsSync)(pyProjectFile)) {
|
|
102899
103233
|
return;
|
|
102900
103234
|
}
|
|
102901
103235
|
const s = spinner();
|
|
@@ -102907,7 +103241,7 @@ function updatePythonPackageName(path6, projectName) {
|
|
|
102907
103241
|
}
|
|
102908
103242
|
var updatePackageName = (ctx) => {
|
|
102909
103243
|
const placeholderNames = ["<PACKAGE_NAME>", "<TBD>", "TBD", ""];
|
|
102910
|
-
const pkgJsonPath = (0,
|
|
103244
|
+
const pkgJsonPath = (0, import_node_path20.resolve)(ctx.project.path, "package.json");
|
|
102911
103245
|
const pkgJson = readJSON(pkgJsonPath);
|
|
102912
103246
|
if (!placeholderNames.includes(pkgJson.name)) {
|
|
102913
103247
|
return;
|
|
@@ -102925,7 +103259,7 @@ var updatePackageScripts = async (ctx) => {
|
|
|
102925
103259
|
}
|
|
102926
103260
|
const s = spinner();
|
|
102927
103261
|
s.start("Updating `package.json` scripts");
|
|
102928
|
-
const pkgJsonPath = (0,
|
|
103262
|
+
const pkgJsonPath = (0, import_node_path20.resolve)(ctx.project.path, "package.json");
|
|
102929
103263
|
let pkgJson = readJSON(pkgJsonPath);
|
|
102930
103264
|
const transformed = await ctx.template.transformPackageJson(pkgJson, ctx);
|
|
102931
103265
|
pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
|
|
@@ -102934,9 +103268,9 @@ var updatePackageScripts = async (ctx) => {
|
|
|
102934
103268
|
};
|
|
102935
103269
|
var getTemplatePath = (ctx) => {
|
|
102936
103270
|
if (ctx.template.path) {
|
|
102937
|
-
return (0,
|
|
103271
|
+
return (0, import_node_path20.resolve)(__dirname, "..", ctx.template.path);
|
|
102938
103272
|
}
|
|
102939
|
-
return (0,
|
|
103273
|
+
return (0, import_node_path20.resolve)(__dirname, "..", "templates", ctx.template.id);
|
|
102940
103274
|
};
|
|
102941
103275
|
var isVariantInfo = (copyFiles) => {
|
|
102942
103276
|
return "path" in copyFiles;
|
|
@@ -103311,12 +103645,12 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
103311
103645
|
};
|
|
103312
103646
|
|
|
103313
103647
|
// src/deploy.ts
|
|
103314
|
-
var
|
|
103648
|
+
var import_promises9 = require("node:fs/promises");
|
|
103315
103649
|
var import_node_os8 = require("node:os");
|
|
103316
|
-
var
|
|
103650
|
+
var import_node_path22 = require("node:path");
|
|
103317
103651
|
|
|
103318
103652
|
// src/helpers/poll.ts
|
|
103319
|
-
var
|
|
103653
|
+
var import_promises8 = require("node:timers/promises");
|
|
103320
103654
|
var import_dns2 = __toESM(require_dns22());
|
|
103321
103655
|
var import_undici4 = __toESM(require_undici());
|
|
103322
103656
|
var TIMEOUT_MS = 1e3 * 60 * 5;
|
|
@@ -103326,7 +103660,7 @@ var poll = async (url) => {
|
|
|
103326
103660
|
const domain = new URL(url).host;
|
|
103327
103661
|
const s = spinner();
|
|
103328
103662
|
s.start("Waiting for DNS to propagate. This might take a few minutes.");
|
|
103329
|
-
await (0,
|
|
103663
|
+
await (0, import_promises8.setTimeout)(1e4);
|
|
103330
103664
|
await pollDns(domain, start, s);
|
|
103331
103665
|
if (await pollHttp(url, start, s)) {
|
|
103332
103666
|
return true;
|
|
@@ -103347,7 +103681,7 @@ var pollDns = async (domain, start, s) => {
|
|
|
103347
103681
|
s.stop(`${brandColor("DNS propagation")} ${dim("complete")}.`);
|
|
103348
103682
|
return;
|
|
103349
103683
|
}
|
|
103350
|
-
await (0,
|
|
103684
|
+
await (0, import_promises8.setTimeout)(POLL_INTERVAL_MS);
|
|
103351
103685
|
}
|
|
103352
103686
|
};
|
|
103353
103687
|
var pollHttp = async (url, start, s) => {
|
|
@@ -103372,7 +103706,7 @@ var pollHttp = async (url, start, s) => {
|
|
|
103372
103706
|
throw e;
|
|
103373
103707
|
}
|
|
103374
103708
|
}
|
|
103375
|
-
await (0,
|
|
103709
|
+
await (0, import_promises8.setTimeout)(POLL_INTERVAL_MS);
|
|
103376
103710
|
}
|
|
103377
103711
|
};
|
|
103378
103712
|
var isDomainResolvable = async (domain) => {
|
|
@@ -103405,8 +103739,8 @@ function secondsSince(start) {
|
|
|
103405
103739
|
}
|
|
103406
103740
|
|
|
103407
103741
|
// src/wrangler/config.ts
|
|
103408
|
-
var
|
|
103409
|
-
var
|
|
103742
|
+
var import_node_fs20 = require("node:fs");
|
|
103743
|
+
var import_node_path21 = require("node:path");
|
|
103410
103744
|
|
|
103411
103745
|
// src/helpers/json.ts
|
|
103412
103746
|
var import_comment_json2 = __toESM(require_src3());
|
|
@@ -103518,22 +103852,22 @@ ${generateHintsAsTomlComments(wranglerToml)}
|
|
|
103518
103852
|
}
|
|
103519
103853
|
};
|
|
103520
103854
|
var getWranglerTomlPath = (ctx) => {
|
|
103521
|
-
return (0,
|
|
103855
|
+
return (0, import_node_path21.resolve)(ctx.project.path, "wrangler.toml");
|
|
103522
103856
|
};
|
|
103523
103857
|
var getWranglerJsonPath = (ctx) => {
|
|
103524
|
-
return (0,
|
|
103858
|
+
return (0, import_node_path21.resolve)(ctx.project.path, "wrangler.json");
|
|
103525
103859
|
};
|
|
103526
103860
|
var getWranglerJsoncPath = (ctx) => {
|
|
103527
|
-
return (0,
|
|
103861
|
+
return (0, import_node_path21.resolve)(ctx.project.path, "wrangler.jsonc");
|
|
103528
103862
|
};
|
|
103529
103863
|
var wranglerTomlExists = (ctx) => {
|
|
103530
103864
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
103531
|
-
return (0,
|
|
103865
|
+
return (0, import_node_fs20.existsSync)(wranglerTomlPath);
|
|
103532
103866
|
};
|
|
103533
103867
|
var wranglerJsonOrJsoncExists = (ctx) => {
|
|
103534
103868
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
103535
103869
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
103536
|
-
return (0,
|
|
103870
|
+
return (0, import_node_fs20.existsSync)(wranglerJsonPath) || (0, import_node_fs20.existsSync)(wranglerJsoncPath);
|
|
103537
103871
|
};
|
|
103538
103872
|
var readWranglerToml = (ctx) => {
|
|
103539
103873
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
@@ -103541,7 +103875,7 @@ var readWranglerToml = (ctx) => {
|
|
|
103541
103875
|
};
|
|
103542
103876
|
var readWranglerJsonOrJsonc = (ctx, reviver) => {
|
|
103543
103877
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
103544
|
-
if ((0,
|
|
103878
|
+
if ((0, import_node_fs20.existsSync)(wranglerJsonPath)) {
|
|
103545
103879
|
return readJSONWithComments(wranglerJsonPath, reviver);
|
|
103546
103880
|
}
|
|
103547
103881
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
@@ -103553,7 +103887,7 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
103553
103887
|
};
|
|
103554
103888
|
var writeWranglerJsonOrJsonc = (ctx, config49) => {
|
|
103555
103889
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
103556
|
-
if ((0,
|
|
103890
|
+
if ((0, import_node_fs20.existsSync)(wranglerJsonPath)) {
|
|
103557
103891
|
return writeJSONWithComments(wranglerJsonPath, config49);
|
|
103558
103892
|
}
|
|
103559
103893
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
@@ -103561,10 +103895,10 @@ var writeWranglerJsonOrJsonc = (ctx, config49) => {
|
|
|
103561
103895
|
};
|
|
103562
103896
|
var addVscodeConfig = (ctx) => {
|
|
103563
103897
|
const settingsPath = `${ctx.project.path}/.vscode/settings.json`;
|
|
103564
|
-
if ((0,
|
|
103898
|
+
if ((0, import_node_fs20.existsSync)(settingsPath)) {
|
|
103565
103899
|
return;
|
|
103566
103900
|
}
|
|
103567
|
-
(0,
|
|
103901
|
+
(0, import_node_fs20.mkdirSync)(`${ctx.project.path}/.vscode`, { recursive: true });
|
|
103568
103902
|
writeJSON(settingsPath, {
|
|
103569
103903
|
"files.associations": {
|
|
103570
103904
|
"wrangler.json": "jsonc"
|
|
@@ -103730,8 +104064,8 @@ var runDeploy = async (ctx) => {
|
|
|
103730
104064
|
JSON.stringify(ctx.commitMessage)
|
|
103731
104065
|
] : []
|
|
103732
104066
|
];
|
|
103733
|
-
const outputFile = (0,
|
|
103734
|
-
await (0,
|
|
104067
|
+
const outputFile = (0, import_node_path22.join)(
|
|
104068
|
+
await (0, import_promises9.mkdtemp)((0, import_node_path22.join)((0, import_node_os8.tmpdir)(), "c3-wrangler-deploy-")),
|
|
103735
104069
|
"output.json"
|
|
103736
104070
|
);
|
|
103737
104071
|
await runCommand(deployCmd, {
|
|
@@ -103793,7 +104127,7 @@ var hasBinding = (node) => {
|
|
|
103793
104127
|
};
|
|
103794
104128
|
|
|
103795
104129
|
// src/dialog.ts
|
|
103796
|
-
var
|
|
104130
|
+
var import_node_path23 = require("node:path");
|
|
103797
104131
|
function createDialog(lines) {
|
|
103798
104132
|
const screenWidth = process.stdout.columns;
|
|
103799
104133
|
const maxLineWidth = Math.max(
|
|
@@ -103833,7 +104167,7 @@ function printWelcomeMessage(version3, telemetryEnabled, args) {
|
|
|
103833
104167
|
}
|
|
103834
104168
|
var printSummary = (ctx) => {
|
|
103835
104169
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}/production` : null;
|
|
103836
|
-
const relativePath = (0,
|
|
104170
|
+
const relativePath = (0, import_node_path23.relative)(ctx.originalCWD, ctx.project.path);
|
|
103837
104171
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
103838
104172
|
const { npm: npm25 } = detectPackageManager();
|
|
103839
104173
|
const deployCommand = quoteShellArgs([
|
|
@@ -104204,7 +104538,7 @@ var renderValues = (values) => {
|
|
|
104204
104538
|
};
|
|
104205
104539
|
|
|
104206
104540
|
// src/helpers/retry.ts
|
|
104207
|
-
var
|
|
104541
|
+
var import_promises10 = require("node:timers/promises");
|
|
104208
104542
|
var retry = async (config49, fn) => {
|
|
104209
104543
|
let { times } = config49;
|
|
104210
104544
|
let error2 = null;
|
|
@@ -104217,7 +104551,7 @@ var retry = async (config49, fn) => {
|
|
|
104217
104551
|
if (config49.exitCondition?.(e)) {
|
|
104218
104552
|
break;
|
|
104219
104553
|
}
|
|
104220
|
-
await (0,
|
|
104554
|
+
await (0, import_promises10.setTimeout)(config49.sleepMs ?? 1e3);
|
|
104221
104555
|
}
|
|
104222
104556
|
}
|
|
104223
104557
|
throw error2;
|
|
@@ -104304,8 +104638,8 @@ var createProject = async (ctx) => {
|
|
|
104304
104638
|
};
|
|
104305
104639
|
|
|
104306
104640
|
// src/workers.ts
|
|
104307
|
-
var
|
|
104308
|
-
var
|
|
104641
|
+
var import_node_fs21 = require("node:fs");
|
|
104642
|
+
var import_node_path24 = require("node:path");
|
|
104309
104643
|
|
|
104310
104644
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
104311
104645
|
function createScanner2(text, ignoreTrivia = false) {
|
|
@@ -105635,8 +105969,8 @@ async function addTypes(ctx) {
|
|
|
105635
105969
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
105636
105970
|
}
|
|
105637
105971
|
async function generateWorkersTypes(ctx, npm25) {
|
|
105638
|
-
const packageJsonPath = (0,
|
|
105639
|
-
if (!(0,
|
|
105972
|
+
const packageJsonPath = (0, import_node_path24.join)(ctx.project.path, "package.json");
|
|
105973
|
+
if (!(0, import_node_fs21.existsSync)(packageJsonPath)) {
|
|
105640
105974
|
return;
|
|
105641
105975
|
}
|
|
105642
105976
|
const packageManifest = readJSON(packageJsonPath);
|
|
@@ -105675,8 +106009,8 @@ var maybeInstallNodeTypes = async (ctx, npm25) => {
|
|
|
105675
106009
|
return false;
|
|
105676
106010
|
};
|
|
105677
106011
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
105678
|
-
const tsconfigPath = (0,
|
|
105679
|
-
if (!(0,
|
|
106012
|
+
const tsconfigPath = (0, import_node_path24.join)(ctx.project.path, "tsconfig.json");
|
|
106013
|
+
if (!(0, import_node_fs21.existsSync)(tsconfigPath)) {
|
|
105680
106014
|
return;
|
|
105681
106015
|
}
|
|
105682
106016
|
const tsconfig = readFile(tsconfigPath);
|
|
@@ -105806,8 +106140,8 @@ var setupProjectDirectory = (ctx) => {
|
|
|
105806
106140
|
if (err) {
|
|
105807
106141
|
throw new Error(err);
|
|
105808
106142
|
}
|
|
105809
|
-
const directory = (0,
|
|
105810
|
-
(0,
|
|
106143
|
+
const directory = (0, import_node_path25.dirname)(path6);
|
|
106144
|
+
(0, import_node_fs22.mkdirSync)(directory, { recursive: true });
|
|
105811
106145
|
(0, import_node_process14.chdir)(directory);
|
|
105812
106146
|
};
|
|
105813
106147
|
var create = async (ctx) => {
|
|
@@ -105820,6 +106154,7 @@ var create = async (ctx) => {
|
|
|
105820
106154
|
await copyTemplateFiles(ctx);
|
|
105821
106155
|
}
|
|
105822
106156
|
updatePackageName(ctx);
|
|
106157
|
+
writePnpmBuildApprovals(ctx.project.path);
|
|
105823
106158
|
(0, import_node_process14.chdir)(ctx.project.path);
|
|
105824
106159
|
await npmInstall(ctx);
|
|
105825
106160
|
await rectifyPmMismatch(ctx);
|
|
@@ -105885,9 +106220,16 @@ var offerAgentsMd = async (ctx) => {
|
|
|
105885
106220
|
main(process.argv).catch((e) => {
|
|
105886
106221
|
if (e instanceof CancelError) {
|
|
105887
106222
|
cancel(e.message);
|
|
106223
|
+
return;
|
|
106224
|
+
}
|
|
106225
|
+
if (isIgnoredBuildsError(e)) {
|
|
106226
|
+
error(`${e.message}
|
|
106227
|
+
|
|
106228
|
+
${getPnpmIgnoredBuildsGuidance(e.packages)}`);
|
|
105888
106229
|
} else {
|
|
105889
106230
|
error(e);
|
|
105890
106231
|
}
|
|
106232
|
+
process.exitCode = 1;
|
|
105891
106233
|
}).finally(async () => {
|
|
105892
106234
|
await reporter.waitForAllEventsSettled();
|
|
105893
106235
|
process.exit();
|