create-cloudflare 2.71.1 → 2.72.1
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 +596 -272
- package/package.json +6 -6
- package/templates/analog/c3.ts +1 -1
- package/templates/hello-world/js/package.json +3 -3
- package/templates/hello-world/js/vitest.config.mjs +10 -0
- package/templates/hello-world/ts/package.json +3 -3
- package/templates/hello-world/ts/test/tsconfig.json +1 -1
- package/templates/hello-world/ts/vitest.config.mts +8 -9
- package/templates/hello-world-with-assets/js/package.json +3 -3
- package/templates/hello-world-with-assets/js/vitest.config.mjs +10 -0
- package/templates/hello-world-with-assets/ts/package.json +3 -3
- package/templates/hello-world-with-assets/ts/test/tsconfig.json +1 -1
- package/templates/hello-world-with-assets/ts/vitest.config.mts +8 -9
- package/templates/next/c3.ts +125 -4
- package/templates/next/experimental_c3.ts +8 -4
- package/templates/hello-world/js/vitest.config.js +0 -11
- package/templates/hello-world/ts/test/env.d.ts +0 -3
- package/templates/hello-world-with-assets/js/vitest.config.js +0 -11
- package/templates/hello-world-with-assets/ts/test/env.d.ts +0 -3
package/dist/cli.js
CHANGED
|
@@ -75341,46 +75341,9 @@ var stderr = process.stderr;
|
|
|
75341
75341
|
// ../cli/dist/check-macos-version.mjs
|
|
75342
75342
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
75343
75343
|
|
|
75344
|
-
// ../workers-utils/dist/chunk-
|
|
75344
|
+
// ../workers-utils/dist/chunk-IV7UMGT2.mjs
|
|
75345
75345
|
init_chunk_Q72B4Q5Z();
|
|
75346
|
-
var
|
|
75347
|
-
function isCompatDate(str) {
|
|
75348
|
-
return /^\d{4}-\d{2}-\d{2}$/.test(str);
|
|
75349
|
-
}
|
|
75350
|
-
__name(isCompatDate, "isCompatDate");
|
|
75351
|
-
function formatCompatibilityDate(date5) {
|
|
75352
|
-
const compatDate = date5.toISOString().slice(0, 10);
|
|
75353
|
-
(0, import_node_assert.default)(isCompatDate(compatDate));
|
|
75354
|
-
return compatDate;
|
|
75355
|
-
}
|
|
75356
|
-
__name(formatCompatibilityDate, "formatCompatibilityDate");
|
|
75357
|
-
function getTodaysCompatDate() {
|
|
75358
|
-
return formatCompatibilityDate(/* @__PURE__ */ new Date());
|
|
75359
|
-
}
|
|
75360
|
-
__name(getTodaysCompatDate, "getTodaysCompatDate");
|
|
75361
|
-
var NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
|
|
75362
|
-
function isNodejsCompatDefaultOn(compatibilityDate) {
|
|
75363
|
-
return compatibilityDate !== void 0 && compatibilityDate >= NODEJS_COMPAT_DEFAULT_ON_DATE;
|
|
75364
|
-
}
|
|
75365
|
-
__name(isNodejsCompatDefaultOn, "isNodejsCompatDefaultOn");
|
|
75366
|
-
var NODEJS_COMPAT_V2_SWITCH_OVER_DATE = "2024-09-23";
|
|
75367
|
-
function resolveNodejsCompat(compatibilityDate, compatibilityFlags) {
|
|
75368
|
-
const isDefaultOn = isNodejsCompatDefaultOn(compatibilityDate);
|
|
75369
|
-
const isNodejsCompatEnabled = compatibilityFlags.includes("nodejs_compat") || isDefaultOn && !compatibilityFlags.includes("no_nodejs_compat");
|
|
75370
|
-
const isNodejsCompatV2Enabled = compatibilityFlags.includes("nodejs_compat_v2") || !compatibilityFlags.includes("no_nodejs_compat_v2") && (isDefaultOn || isNodejsCompatEnabled && compatibilityDate >= NODEJS_COMPAT_V2_SWITCH_OVER_DATE);
|
|
75371
|
-
return { isNodejsCompatEnabled, isNodejsCompatV2Enabled };
|
|
75372
|
-
}
|
|
75373
|
-
__name(resolveNodejsCompat, "resolveNodejsCompat");
|
|
75374
|
-
function stripRedundantNodejsCompatFlags(compatibilityDate, compatibilityFlags) {
|
|
75375
|
-
if (!isNodejsCompatDefaultOn(compatibilityDate)) {
|
|
75376
|
-
return compatibilityFlags;
|
|
75377
|
-
}
|
|
75378
|
-
const redundantFlags = ["nodejs_compat", "nodejs_compat_v2"].filter(
|
|
75379
|
-
(flag) => !compatibilityFlags.includes(`no_${flag}`)
|
|
75380
|
-
);
|
|
75381
|
-
return compatibilityFlags.filter((flag) => !redundantFlags.includes(flag));
|
|
75382
|
-
}
|
|
75383
|
-
__name(stripRedundantNodejsCompatFlags, "stripRedundantNodejsCompatFlags");
|
|
75346
|
+
var DEFAULT_COMPAT_DATE = "2026-08-15";
|
|
75384
75347
|
function assertNever(_value) {
|
|
75385
75348
|
}
|
|
75386
75349
|
__name(assertNever, "assertNever");
|
|
@@ -75820,7 +75783,7 @@ function constructWranglerConfig(config50) {
|
|
|
75820
75783
|
main: config50.entrypoint,
|
|
75821
75784
|
workers_dev: config50.subdomain.enabled,
|
|
75822
75785
|
preview_urls: config50.subdomain.previews_enabled,
|
|
75823
|
-
compatibility_date: config50.compatibility_date ??
|
|
75786
|
+
compatibility_date: config50.compatibility_date ?? DEFAULT_COMPAT_DATE,
|
|
75824
75787
|
compatibility_flags: config50.compatibility_flags,
|
|
75825
75788
|
...allRoutes.length ? { routes: allRoutes } : {},
|
|
75826
75789
|
placement: config50.placement?.mode === "smart" ? { mode: "smart" } : void 0,
|
|
@@ -76028,10 +75991,15 @@ function getGlobalWranglerCachePath() {
|
|
|
76028
75991
|
}
|
|
76029
75992
|
__name(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
|
|
76030
75993
|
|
|
76031
|
-
// ../workers-utils/dist/chunk-
|
|
75994
|
+
// ../workers-utils/dist/chunk-QFKPUV4H.mjs
|
|
76032
75995
|
init_chunk_Q72B4Q5Z();
|
|
76033
75996
|
var import_node_fs2 = require("node:fs");
|
|
76034
75997
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
75998
|
+
function hasKnownExportType(entry) {
|
|
75999
|
+
const type = entry?.type;
|
|
76000
|
+
return type === "durable-object" || type === "worker";
|
|
76001
|
+
}
|
|
76002
|
+
__name(hasKnownExportType, "hasKnownExportType");
|
|
76035
76003
|
function partitionExports(exports2) {
|
|
76036
76004
|
const partitioned = {
|
|
76037
76005
|
"durable-object": {},
|
|
@@ -76041,11 +76009,55 @@ function partitionExports(exports2) {
|
|
|
76041
76009
|
return partitioned;
|
|
76042
76010
|
}
|
|
76043
76011
|
for (const [name3, entry] of Object.entries(exports2)) {
|
|
76012
|
+
if (!hasKnownExportType(entry)) {
|
|
76013
|
+
continue;
|
|
76014
|
+
}
|
|
76044
76015
|
partitioned[entry.type][name3] = entry;
|
|
76045
76016
|
}
|
|
76046
76017
|
return partitioned;
|
|
76047
76018
|
}
|
|
76048
76019
|
__name(partitionExports, "partitionExports");
|
|
76020
|
+
function getDurableObjectExports(exports2) {
|
|
76021
|
+
return partitionExports(exports2)["durable-object"];
|
|
76022
|
+
}
|
|
76023
|
+
__name(getDurableObjectExports, "getDurableObjectExports");
|
|
76024
|
+
function hasDurableObjectExports(exports2) {
|
|
76025
|
+
return Object.keys(getDurableObjectExports(exports2)).length > 0;
|
|
76026
|
+
}
|
|
76027
|
+
__name(hasDurableObjectExports, "hasDurableObjectExports");
|
|
76028
|
+
function getContainerNameToClassNameMap(exports2) {
|
|
76029
|
+
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
76030
|
+
for (const [className, entry] of Object.entries(
|
|
76031
|
+
getDurableObjectExports(exports2)
|
|
76032
|
+
)) {
|
|
76033
|
+
if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) {
|
|
76034
|
+
containerNameToClassName.set(entry.container, className);
|
|
76035
|
+
}
|
|
76036
|
+
}
|
|
76037
|
+
return containerNameToClassName;
|
|
76038
|
+
}
|
|
76039
|
+
__name(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
|
|
76040
|
+
function resolveContainerClassName(container, exports2) {
|
|
76041
|
+
if (container.class_name !== void 0) {
|
|
76042
|
+
return container.class_name;
|
|
76043
|
+
}
|
|
76044
|
+
if (container.name === void 0) {
|
|
76045
|
+
return void 0;
|
|
76046
|
+
}
|
|
76047
|
+
return getContainerNameToClassNameMap(exports2).get(container.name);
|
|
76048
|
+
}
|
|
76049
|
+
__name(resolveContainerClassName, "resolveContainerClassName");
|
|
76050
|
+
function getContainerDurableObjectClassNames(containers, exports2) {
|
|
76051
|
+
const classNames = /* @__PURE__ */ new Set();
|
|
76052
|
+
for (const container of containers ?? []) {
|
|
76053
|
+
const className = resolveContainerClassName(container, exports2);
|
|
76054
|
+
if (className !== void 0) {
|
|
76055
|
+
classNames.add(className);
|
|
76056
|
+
}
|
|
76057
|
+
}
|
|
76058
|
+
return classNames;
|
|
76059
|
+
}
|
|
76060
|
+
__name(getContainerDurableObjectClassNames, "getContainerDurableObjectClassNames");
|
|
76049
76061
|
var UserError = class extends Error {
|
|
76050
76062
|
static {
|
|
76051
76063
|
__name(this, "UserError");
|
|
@@ -78902,7 +78914,7 @@ __name(formatConfigSnippet, "formatConfigSnippet");
|
|
|
78902
78914
|
// ../workers-utils/dist/index.mjs
|
|
78903
78915
|
init_chunk_Q72B4Q5Z();
|
|
78904
78916
|
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
78905
|
-
var
|
|
78917
|
+
var import_node_assert = __toESM(require("node:assert"), 1);
|
|
78906
78918
|
var path22 = __toESM(require("node:path"), 1);
|
|
78907
78919
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
78908
78920
|
var import_node_child_process2 = require("node:child_process");
|
|
@@ -80491,14 +80503,6 @@ var ARTIFACTS_EVENT_TYPES = [
|
|
|
80491
80503
|
"cf.artifacts.repo.token.created",
|
|
80492
80504
|
"cf.artifacts.repo.token.revoked"
|
|
80493
80505
|
];
|
|
80494
|
-
function getDurableObjectExports(exports2) {
|
|
80495
|
-
return partitionExports(exports2)["durable-object"];
|
|
80496
|
-
}
|
|
80497
|
-
__name(getDurableObjectExports, "getDurableObjectExports");
|
|
80498
|
-
function hasDurableObjectExports(exports2) {
|
|
80499
|
-
return Object.keys(getDurableObjectExports(exports2)).length > 0;
|
|
80500
|
-
}
|
|
80501
|
-
__name(hasDurableObjectExports, "hasDurableObjectExports");
|
|
80502
80506
|
var defaultWranglerConfig = {
|
|
80503
80507
|
/* COMPUTED_FIELDS */
|
|
80504
80508
|
configPath: void 0,
|
|
@@ -80607,6 +80611,7 @@ var defaultWranglerConfig = {
|
|
|
80607
80611
|
upload_source_maps: void 0,
|
|
80608
80612
|
assets: void 0,
|
|
80609
80613
|
observability: { enabled: true },
|
|
80614
|
+
access: void 0,
|
|
80610
80615
|
cache: void 0,
|
|
80611
80616
|
/** The default here is undefined so that we can delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable. */
|
|
80612
80617
|
compliance_region: void 0,
|
|
@@ -81244,7 +81249,7 @@ __export2(util_exports, {
|
|
|
81244
81249
|
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
81245
81250
|
aborted: () => aborted,
|
|
81246
81251
|
allowsEval: () => allowsEval,
|
|
81247
|
-
assert: () =>
|
|
81252
|
+
assert: () => assert,
|
|
81248
81253
|
assertEqual: () => assertEqual,
|
|
81249
81254
|
assertIs: () => assertIs,
|
|
81250
81255
|
assertNever: () => assertNever2,
|
|
@@ -81318,9 +81323,9 @@ function assertNever2(_x) {
|
|
|
81318
81323
|
throw new Error("Unexpected value in exhaustive check");
|
|
81319
81324
|
}
|
|
81320
81325
|
__name(assertNever2, "assertNever");
|
|
81321
|
-
function
|
|
81326
|
+
function assert(_) {
|
|
81322
81327
|
}
|
|
81323
|
-
__name(
|
|
81328
|
+
__name(assert, "assert");
|
|
81324
81329
|
function getEnumValues(entries) {
|
|
81325
81330
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
81326
81331
|
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -95540,6 +95545,9 @@ function getWranglerSendMetricsFromEnv() {
|
|
|
95540
95545
|
return getWranglerSendMetricsVariableFromEnv();
|
|
95541
95546
|
}
|
|
95542
95547
|
__name(getWranglerSendMetricsFromEnv, "getWranglerSendMetricsFromEnv");
|
|
95548
|
+
var getNoSkillsUpdatePromptsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
95549
|
+
variableName: "WRANGLER_NO_SKILLS_UPDATE_PROMPTS"
|
|
95550
|
+
});
|
|
95543
95551
|
var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
95544
95552
|
variableName: "WRANGLER_SEND_ERROR_REPORTS",
|
|
95545
95553
|
defaultValue: false
|
|
@@ -96293,7 +96301,7 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
|
|
|
96293
96301
|
);
|
|
96294
96302
|
}
|
|
96295
96303
|
const envName = args.env ?? getCloudflareEnv();
|
|
96296
|
-
(0,
|
|
96304
|
+
(0, import_node_assert.default)(envName === void 0 || typeof envName === "string");
|
|
96297
96305
|
let activeEnv = topLevelEnv;
|
|
96298
96306
|
if (envName) {
|
|
96299
96307
|
if (isRedirectedConfig2) {
|
|
@@ -96502,7 +96510,7 @@ function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
|
|
|
96502
96510
|
}
|
|
96503
96511
|
__name(normalizeAndValidatePagesBuildOutputDir, "normalizeAndValidatePagesBuildOutputDir");
|
|
96504
96512
|
function normalizeAndValidateDev(diagnostics, rawDev, args) {
|
|
96505
|
-
(0,
|
|
96513
|
+
(0, import_node_assert.default)(typeof args === "object" && args !== null && !Array.isArray(args));
|
|
96506
96514
|
const {
|
|
96507
96515
|
localProtocol: localProtocolArg,
|
|
96508
96516
|
upstreamProtocol: upstreamProtocolArg,
|
|
@@ -96510,17 +96518,17 @@ function normalizeAndValidateDev(diagnostics, rawDev, args) {
|
|
|
96510
96518
|
enableContainers: enableContainersArg,
|
|
96511
96519
|
generateTypes: generateTypesArg
|
|
96512
96520
|
} = args;
|
|
96513
|
-
(0,
|
|
96521
|
+
(0, import_node_assert.default)(
|
|
96514
96522
|
localProtocolArg === void 0 || localProtocolArg === "http" || localProtocolArg === "https"
|
|
96515
96523
|
);
|
|
96516
|
-
(0,
|
|
96524
|
+
(0, import_node_assert.default)(
|
|
96517
96525
|
upstreamProtocolArg === void 0 || upstreamProtocolArg === "http" || upstreamProtocolArg === "https"
|
|
96518
96526
|
);
|
|
96519
|
-
(0,
|
|
96520
|
-
(0,
|
|
96527
|
+
(0, import_node_assert.default)(remoteArg === void 0 || typeof remoteArg === "boolean");
|
|
96528
|
+
(0, import_node_assert.default)(
|
|
96521
96529
|
enableContainersArg === void 0 || typeof enableContainersArg === "boolean"
|
|
96522
96530
|
);
|
|
96523
|
-
(0,
|
|
96531
|
+
(0, import_node_assert.default)(
|
|
96524
96532
|
generateTypesArg === void 0 || typeof generateTypesArg === "boolean"
|
|
96525
96533
|
);
|
|
96526
96534
|
const {
|
|
@@ -97708,6 +97716,14 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
97708
97716
|
validateObservability,
|
|
97709
97717
|
void 0
|
|
97710
97718
|
),
|
|
97719
|
+
access: inheritable(
|
|
97720
|
+
diagnostics,
|
|
97721
|
+
topLevelEnv,
|
|
97722
|
+
rawEnv,
|
|
97723
|
+
"access",
|
|
97724
|
+
validateAccess,
|
|
97725
|
+
void 0
|
|
97726
|
+
),
|
|
97711
97727
|
cache: inheritable(
|
|
97712
97728
|
diagnostics,
|
|
97713
97729
|
topLevelEnv,
|
|
@@ -97753,6 +97769,15 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
97753
97769
|
environment.migrations,
|
|
97754
97770
|
environment.exports
|
|
97755
97771
|
);
|
|
97772
|
+
const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some(
|
|
97773
|
+
(rawNamedEnv) => rawNamedEnv?.containers !== void 0
|
|
97774
|
+
);
|
|
97775
|
+
validateContainerExportLinks(
|
|
97776
|
+
diagnostics,
|
|
97777
|
+
environment.containers,
|
|
97778
|
+
environment.exports,
|
|
97779
|
+
containersDeclaredElsewhere
|
|
97780
|
+
);
|
|
97756
97781
|
if (envName !== "top level") {
|
|
97757
97782
|
validateAdditionalProperties(
|
|
97758
97783
|
diagnostics,
|
|
@@ -98652,6 +98677,31 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
|
|
|
98652
98677
|
}
|
|
98653
98678
|
return isValid;
|
|
98654
98679
|
}, "validateBindingArray");
|
|
98680
|
+
function validateSshPublicKeys(diagnostics, field, value, nameRequired) {
|
|
98681
|
+
if (!Array.isArray(value)) {
|
|
98682
|
+
diagnostics.errors.push(`${field} must be an array`);
|
|
98683
|
+
return;
|
|
98684
|
+
}
|
|
98685
|
+
for (const [index, key] of value.entries()) {
|
|
98686
|
+
const fieldPath = `${field}[${index}]`;
|
|
98687
|
+
if (typeof key !== "object" || key === null || Array.isArray(key)) {
|
|
98688
|
+
diagnostics.errors.push(`${fieldPath} must be an object`);
|
|
98689
|
+
continue;
|
|
98690
|
+
}
|
|
98691
|
+
const hasValidName = nameRequired ? isRequiredProperty(key, "name", "string") : isOptionalProperty(key, "name", "string");
|
|
98692
|
+
if (!hasValidName) {
|
|
98693
|
+
diagnostics.errors.push(`${fieldPath}.name must be a string`);
|
|
98694
|
+
}
|
|
98695
|
+
if (!isRequiredProperty(key, "public_key", "string")) {
|
|
98696
|
+
diagnostics.errors.push(`${fieldPath}.public_key must be a string`);
|
|
98697
|
+
} else if (!key.public_key.toLowerCase().startsWith("ssh-ed25519")) {
|
|
98698
|
+
diagnostics.errors.push(
|
|
98699
|
+
`${fieldPath}.public_key is an unsupported key type. Please provide an ED25519 public key.`
|
|
98700
|
+
);
|
|
98701
|
+
}
|
|
98702
|
+
}
|
|
98703
|
+
}
|
|
98704
|
+
__name(validateSshPublicKeys, "validateSshPublicKeys");
|
|
98655
98705
|
function validateContainerApp(envName, topLevelName, configPath) {
|
|
98656
98706
|
return (diagnostics, field, value, config210) => {
|
|
98657
98707
|
if (!value) {
|
|
@@ -98664,12 +98714,7 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
98664
98714
|
return false;
|
|
98665
98715
|
}
|
|
98666
98716
|
for (const containerAppOptional of value) {
|
|
98667
|
-
|
|
98668
|
-
diagnostics.errors.push(
|
|
98669
|
-
`Field "name", when present, should be a string, but got ${JSON.stringify(value)}`
|
|
98670
|
-
);
|
|
98671
|
-
}
|
|
98672
|
-
validateRequiredProperty(
|
|
98717
|
+
validateOptionalProperty(
|
|
98673
98718
|
diagnostics,
|
|
98674
98719
|
field,
|
|
98675
98720
|
"class_name",
|
|
@@ -98684,14 +98729,19 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
98684
98729
|
"string"
|
|
98685
98730
|
);
|
|
98686
98731
|
if (!containerAppOptional.name) {
|
|
98687
|
-
if (
|
|
98732
|
+
if (containerAppOptional.class_name === void 0) {
|
|
98733
|
+
diagnostics.errors.push(
|
|
98734
|
+
`"containers.name" is required when "containers.class_name" is not defined, because there is no class name to derive a default name from. Either name this container and reference it from a Durable Object's \`exports\` entry, or set "containers.class_name".`
|
|
98735
|
+
);
|
|
98736
|
+
} else if (!topLevelName) {
|
|
98688
98737
|
diagnostics.errors.push(
|
|
98689
98738
|
`Must have either a top level "name" and "containers.class_name" field defined, or have field "containers.name" defined.`
|
|
98690
98739
|
);
|
|
98740
|
+
} else {
|
|
98741
|
+
let name3 = `${topLevelName}-${containerAppOptional.class_name}`;
|
|
98742
|
+
name3 += config210 === void 0 ? "" : `-${envName}`;
|
|
98743
|
+
containerAppOptional.name = name3.toLowerCase().replace(/ /g, "-");
|
|
98691
98744
|
}
|
|
98692
|
-
let name3 = `${topLevelName}-${containerAppOptional.class_name}`;
|
|
98693
|
-
name3 += config210 === void 0 ? "" : `-${envName}`;
|
|
98694
|
-
containerAppOptional.name = name3.toLowerCase().replace(/ /g, "-");
|
|
98695
98745
|
}
|
|
98696
98746
|
if (!containerAppOptional.configuration?.image && !containerAppOptional.image) {
|
|
98697
98747
|
diagnostics.errors.push(
|
|
@@ -98702,12 +98752,11 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
98702
98752
|
diagnostics.warnings.push(
|
|
98703
98753
|
`"containers.configuration" is deprecated. Use top level "containers" fields instead. "configuration.image" should be "image", limits should be set via "instance_type".`
|
|
98704
98754
|
);
|
|
98705
|
-
if (typeof containerAppOptional.configuration !== "object" || Array.isArray(containerAppOptional.configuration)) {
|
|
98755
|
+
if (typeof containerAppOptional.configuration !== "object" || containerAppOptional.configuration === null || Array.isArray(containerAppOptional.configuration)) {
|
|
98706
98756
|
diagnostics.errors.push(
|
|
98707
98757
|
`"containers.configuration" should be an object`
|
|
98708
98758
|
);
|
|
98709
|
-
}
|
|
98710
|
-
if (containerAppOptional.instance_type && (containerAppOptional.configuration.disk !== void 0 || containerAppOptional.configuration.vcpu !== void 0 || containerAppOptional.configuration.memory_mib !== void 0)) {
|
|
98759
|
+
} else if (containerAppOptional.instance_type && (containerAppOptional.configuration.disk !== void 0 || containerAppOptional.configuration.vcpu !== void 0 || containerAppOptional.configuration.memory_mib !== void 0)) {
|
|
98711
98760
|
diagnostics.errors.push(
|
|
98712
98761
|
`Cannot set custom limits via "containers.configuration" and use preset "instance_type" limits at the same time.`
|
|
98713
98762
|
);
|
|
@@ -98892,7 +98941,7 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
98892
98941
|
"unsafe"
|
|
98893
98942
|
]
|
|
98894
98943
|
);
|
|
98895
|
-
if (
|
|
98944
|
+
if (typeof containerAppOptional.configuration === "object" && containerAppOptional.configuration !== null && !Array.isArray(containerAppOptional.configuration)) {
|
|
98896
98945
|
validateAdditionalProperties(
|
|
98897
98946
|
diagnostics,
|
|
98898
98947
|
`${field}.configuration`,
|
|
@@ -98926,52 +98975,20 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
98926
98975
|
}
|
|
98927
98976
|
}
|
|
98928
98977
|
if ("authorized_keys" in containerAppOptional) {
|
|
98929
|
-
|
|
98930
|
-
diagnostics
|
|
98931
|
-
|
|
98932
|
-
|
|
98933
|
-
|
|
98934
|
-
|
|
98935
|
-
if (!isRequiredProperty(key, "name", "string")) {
|
|
98936
|
-
diagnostics.errors.push(`${fieldPath}.name must be a string`);
|
|
98937
|
-
}
|
|
98938
|
-
if (!isRequiredProperty(key, "public_key", "string")) {
|
|
98939
|
-
diagnostics.errors.push(
|
|
98940
|
-
`${fieldPath}.public_key must be a string`
|
|
98941
|
-
);
|
|
98942
|
-
}
|
|
98943
|
-
if (!key.public_key.toLowerCase().startsWith("ssh-ed25519")) {
|
|
98944
|
-
diagnostics.errors.push(
|
|
98945
|
-
`${fieldPath}.public_key is a unsupported key type. Please provide a ED25519 public key.`
|
|
98946
|
-
);
|
|
98947
|
-
}
|
|
98948
|
-
}
|
|
98949
|
-
}
|
|
98978
|
+
validateSshPublicKeys(
|
|
98979
|
+
diagnostics,
|
|
98980
|
+
`${field}.authorized_keys`,
|
|
98981
|
+
containerAppOptional.authorized_keys,
|
|
98982
|
+
true
|
|
98983
|
+
);
|
|
98950
98984
|
}
|
|
98951
98985
|
if ("trusted_user_ca_keys" in containerAppOptional) {
|
|
98952
|
-
|
|
98953
|
-
diagnostics
|
|
98954
|
-
|
|
98955
|
-
|
|
98956
|
-
|
|
98957
|
-
|
|
98958
|
-
const fieldPath = `${field}.trusted_user_ca_keys[${index}]`;
|
|
98959
|
-
const key = containerAppOptional.trusted_user_ca_keys[index];
|
|
98960
|
-
if (!isOptionalProperty(key, "name", "string")) {
|
|
98961
|
-
diagnostics.errors.push(`${fieldPath}.name must be a string`);
|
|
98962
|
-
}
|
|
98963
|
-
if (!isRequiredProperty(key, "public_key", "string")) {
|
|
98964
|
-
diagnostics.errors.push(
|
|
98965
|
-
`${fieldPath}.public_key must be a string`
|
|
98966
|
-
);
|
|
98967
|
-
}
|
|
98968
|
-
if (!key.public_key.toLowerCase().startsWith("ssh-ed25519")) {
|
|
98969
|
-
diagnostics.errors.push(
|
|
98970
|
-
`${fieldPath}.public_key is a unsupported key type. Please provide a ED25519 public key.`
|
|
98971
|
-
);
|
|
98972
|
-
}
|
|
98973
|
-
}
|
|
98974
|
-
}
|
|
98986
|
+
validateSshPublicKeys(
|
|
98987
|
+
diagnostics,
|
|
98988
|
+
`${field}.trusted_user_ca_keys`,
|
|
98989
|
+
containerAppOptional.trusted_user_ca_keys,
|
|
98990
|
+
false
|
|
98991
|
+
);
|
|
98975
98992
|
}
|
|
98976
98993
|
if (validateOptionalProperty(
|
|
98977
98994
|
diagnostics,
|
|
@@ -100042,12 +100059,13 @@ function validateQueues(envName) {
|
|
|
100042
100059
|
)}.`
|
|
100043
100060
|
);
|
|
100044
100061
|
isValid = false;
|
|
100045
|
-
}
|
|
100046
|
-
|
|
100047
|
-
|
|
100048
|
-
|
|
100049
|
-
|
|
100050
|
-
|
|
100062
|
+
} else {
|
|
100063
|
+
for (let i = 0; i < consumers.length; i++) {
|
|
100064
|
+
const consumer = consumers[i];
|
|
100065
|
+
const consumerPath = `${fieldPath}.consumers[${i}]`;
|
|
100066
|
+
if (!validateConsumer(diagnostics, consumerPath, consumer, config210)) {
|
|
100067
|
+
isValid = false;
|
|
100068
|
+
}
|
|
100051
100069
|
}
|
|
100052
100070
|
}
|
|
100053
100071
|
}
|
|
@@ -100823,6 +100841,25 @@ function validateDurableObjectExportProperties(diagnostics, className, durableOb
|
|
|
100823
100841
|
return valid;
|
|
100824
100842
|
}
|
|
100825
100843
|
__name(validateDurableObjectExportProperties, "validateDurableObjectExportProperties");
|
|
100844
|
+
function validateDurableObjectExportContainer(diagnostics, className, durableObjectExport) {
|
|
100845
|
+
if (durableObjectExport.container === void 0) {
|
|
100846
|
+
return true;
|
|
100847
|
+
}
|
|
100848
|
+
if (typeof durableObjectExport.container !== "string" || durableObjectExport.container === "") {
|
|
100849
|
+
diagnostics.errors.push(
|
|
100850
|
+
`"exports.${className}.container" must be a non-empty string naming a container in the "containers" array, but got ${JSON.stringify(durableObjectExport.container)}.`
|
|
100851
|
+
);
|
|
100852
|
+
return false;
|
|
100853
|
+
}
|
|
100854
|
+
if (durableObjectExport.storage === "legacy-kv") {
|
|
100855
|
+
diagnostics.errors.push(
|
|
100856
|
+
`"exports.${className}.container" requires "storage" to be "sqlite". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`
|
|
100857
|
+
);
|
|
100858
|
+
return false;
|
|
100859
|
+
}
|
|
100860
|
+
return true;
|
|
100861
|
+
}
|
|
100862
|
+
__name(validateDurableObjectExportContainer, "validateDurableObjectExportContainer");
|
|
100826
100863
|
function validateDurableObjectExport(diagnostics, className, durableObjectExport) {
|
|
100827
100864
|
let valid = true;
|
|
100828
100865
|
if (className === "") {
|
|
@@ -100838,11 +100875,16 @@ function validateDurableObjectExport(diagnostics, className, durableObjectExport
|
|
|
100838
100875
|
);
|
|
100839
100876
|
valid = false;
|
|
100840
100877
|
}
|
|
100878
|
+
valid = validateDurableObjectExportContainer(
|
|
100879
|
+
diagnostics,
|
|
100880
|
+
className,
|
|
100881
|
+
durableObjectExport
|
|
100882
|
+
) && valid;
|
|
100841
100883
|
valid = validateDurableObjectExportProperties(
|
|
100842
100884
|
diagnostics,
|
|
100843
100885
|
className,
|
|
100844
100886
|
durableObjectExport,
|
|
100845
|
-
["type", "state", "storage"]
|
|
100887
|
+
["type", "state", "storage", "container"]
|
|
100846
100888
|
) && valid;
|
|
100847
100889
|
break;
|
|
100848
100890
|
}
|
|
@@ -100911,11 +100953,16 @@ function validateDurableObjectExport(diagnostics, className, durableObjectExport
|
|
|
100911
100953
|
);
|
|
100912
100954
|
valid = false;
|
|
100913
100955
|
}
|
|
100956
|
+
valid = validateDurableObjectExportContainer(
|
|
100957
|
+
diagnostics,
|
|
100958
|
+
className,
|
|
100959
|
+
durableObjectExport
|
|
100960
|
+
) && valid;
|
|
100914
100961
|
valid = validateDurableObjectExportProperties(
|
|
100915
100962
|
diagnostics,
|
|
100916
100963
|
className,
|
|
100917
100964
|
durableObjectExport,
|
|
100918
|
-
["type", "state", "storage", "transfer_from"]
|
|
100965
|
+
["type", "state", "storage", "transfer_from", "container"]
|
|
100919
100966
|
) && valid;
|
|
100920
100967
|
break;
|
|
100921
100968
|
}
|
|
@@ -101163,6 +101210,46 @@ function validateHeadSamplingRate(diagnostics, container, key, samplingRate) {
|
|
|
101163
101210
|
}
|
|
101164
101211
|
}
|
|
101165
101212
|
__name(validateHeadSamplingRate, "validateHeadSamplingRate");
|
|
101213
|
+
var validateAccess = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
101214
|
+
if (value === void 0) {
|
|
101215
|
+
return true;
|
|
101216
|
+
}
|
|
101217
|
+
if (typeof value !== "object" || value === null) {
|
|
101218
|
+
diagnostics.errors.push(
|
|
101219
|
+
`"${field}" should be an object but got ${JSON.stringify(value)}.`
|
|
101220
|
+
);
|
|
101221
|
+
return false;
|
|
101222
|
+
}
|
|
101223
|
+
const val = value;
|
|
101224
|
+
let isValid = true;
|
|
101225
|
+
isValid = validateOptionalProperty(diagnostics, field, "dev", val.dev, "object") && isValid;
|
|
101226
|
+
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
|
|
101227
|
+
"dev"
|
|
101228
|
+
]) && isValid;
|
|
101229
|
+
if (typeof val.dev === "object" && val.dev !== null) {
|
|
101230
|
+
isValid = validateRequiredProperty(
|
|
101231
|
+
diagnostics,
|
|
101232
|
+
`${field}.dev`,
|
|
101233
|
+
"aud",
|
|
101234
|
+
val.dev.aud,
|
|
101235
|
+
"string"
|
|
101236
|
+
) && isValid;
|
|
101237
|
+
isValid = validateOptionalProperty(
|
|
101238
|
+
diagnostics,
|
|
101239
|
+
`${field}.dev`,
|
|
101240
|
+
"identity",
|
|
101241
|
+
val.dev.identity,
|
|
101242
|
+
"object"
|
|
101243
|
+
) && isValid;
|
|
101244
|
+
isValid = validateAdditionalProperties(
|
|
101245
|
+
diagnostics,
|
|
101246
|
+
`${field}.dev`,
|
|
101247
|
+
Object.keys(val.dev),
|
|
101248
|
+
["aud", "identity"]
|
|
101249
|
+
) && isValid;
|
|
101250
|
+
}
|
|
101251
|
+
return isValid;
|
|
101252
|
+
}, "validateAccess");
|
|
101166
101253
|
var validateCache = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
101167
101254
|
if (value === void 0) {
|
|
101168
101255
|
return true;
|
|
@@ -101247,6 +101334,124 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports2) {
|
|
|
101247
101334
|
}
|
|
101248
101335
|
}
|
|
101249
101336
|
__name(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
|
|
101337
|
+
function validateContainerExportLinks(diagnostics, containers, exports2, containersDeclaredElsewhere) {
|
|
101338
|
+
if (containers !== void 0 && !Array.isArray(containers)) {
|
|
101339
|
+
return;
|
|
101340
|
+
}
|
|
101341
|
+
if (containers === void 0 && containersDeclaredElsewhere) {
|
|
101342
|
+
return;
|
|
101343
|
+
}
|
|
101344
|
+
const containersByName = /* @__PURE__ */ new Map();
|
|
101345
|
+
const duplicateNames = /* @__PURE__ */ new Set();
|
|
101346
|
+
for (const container of containers ?? []) {
|
|
101347
|
+
if (typeof container.name !== "string") {
|
|
101348
|
+
continue;
|
|
101349
|
+
}
|
|
101350
|
+
if (containersByName.has(container.name)) {
|
|
101351
|
+
duplicateNames.add(container.name);
|
|
101352
|
+
} else {
|
|
101353
|
+
containersByName.set(container.name, container);
|
|
101354
|
+
}
|
|
101355
|
+
}
|
|
101356
|
+
for (const name3 of [...duplicateNames].sort()) {
|
|
101357
|
+
diagnostics.errors.push(
|
|
101358
|
+
`"containers" contains more than one container named "${name3}". Container names must be unique.`
|
|
101359
|
+
);
|
|
101360
|
+
}
|
|
101361
|
+
const containerCountByClassName = /* @__PURE__ */ new Map();
|
|
101362
|
+
for (const container of containers ?? []) {
|
|
101363
|
+
if (typeof container.class_name !== "string") {
|
|
101364
|
+
continue;
|
|
101365
|
+
}
|
|
101366
|
+
containerCountByClassName.set(
|
|
101367
|
+
container.class_name,
|
|
101368
|
+
(containerCountByClassName.get(container.class_name) ?? 0) + 1
|
|
101369
|
+
);
|
|
101370
|
+
}
|
|
101371
|
+
const overSubscribedClassNames = new Set(
|
|
101372
|
+
[...containerCountByClassName].filter(([, count]) => count > 1).map(([className]) => className)
|
|
101373
|
+
);
|
|
101374
|
+
for (const className of [...overSubscribedClassNames].sort()) {
|
|
101375
|
+
diagnostics.errors.push(
|
|
101376
|
+
`More than one container is attached to the Durable Object "${className}". A Durable Object can only have one container attached to it.`
|
|
101377
|
+
);
|
|
101378
|
+
}
|
|
101379
|
+
const durableObjectExports = getDurableObjectExports(exports2);
|
|
101380
|
+
const liveExportClassNames = /* @__PURE__ */ new Set();
|
|
101381
|
+
const classNamesByContainerName = /* @__PURE__ */ new Map();
|
|
101382
|
+
for (const [className, entry] of Object.entries(durableObjectExports)) {
|
|
101383
|
+
if (entry.state !== void 0 && entry.state !== "created" && entry.state !== "expecting-transfer") {
|
|
101384
|
+
continue;
|
|
101385
|
+
}
|
|
101386
|
+
liveExportClassNames.add(className);
|
|
101387
|
+
if (typeof entry.container !== "string" || entry.container === "") {
|
|
101388
|
+
continue;
|
|
101389
|
+
}
|
|
101390
|
+
if (!containersByName.has(entry.container)) {
|
|
101391
|
+
diagnostics.errors.push(
|
|
101392
|
+
`"exports.${className}.container" references a container named "${entry.container}", but no container with that name is defined in "containers".`
|
|
101393
|
+
);
|
|
101394
|
+
continue;
|
|
101395
|
+
}
|
|
101396
|
+
classNamesByContainerName.set(entry.container, [
|
|
101397
|
+
...classNamesByContainerName.get(entry.container) ?? [],
|
|
101398
|
+
className
|
|
101399
|
+
]);
|
|
101400
|
+
}
|
|
101401
|
+
for (const [containerName, classNames] of classNamesByContainerName) {
|
|
101402
|
+
if (classNames.length > 1) {
|
|
101403
|
+
diagnostics.errors.push(
|
|
101404
|
+
`The container "${containerName}" is referenced by more than one Durable Object export (${classNames.join(", ")}). A container can only back a single Durable Object.`
|
|
101405
|
+
);
|
|
101406
|
+
}
|
|
101407
|
+
}
|
|
101408
|
+
const containerNameToClassName = getContainerNameToClassNameMap(exports2);
|
|
101409
|
+
const usesDurableObjectExports = Object.keys(durableObjectExports).length > 0;
|
|
101410
|
+
for (const container of containers ?? []) {
|
|
101411
|
+
if (typeof container.name !== "string") {
|
|
101412
|
+
continue;
|
|
101413
|
+
}
|
|
101414
|
+
if (container.class_name === void 0) {
|
|
101415
|
+
if (!containerNameToClassName.has(container.name)) {
|
|
101416
|
+
diagnostics.errors.push(
|
|
101417
|
+
`The container "${container.name}" is not linked to a Durable Object. Either set "containers.class_name", or reference this container from a Durable Object's \`exports\` entry via its "container" field.`
|
|
101418
|
+
);
|
|
101419
|
+
}
|
|
101420
|
+
continue;
|
|
101421
|
+
}
|
|
101422
|
+
if (overSubscribedClassNames.has(container.class_name)) {
|
|
101423
|
+
continue;
|
|
101424
|
+
}
|
|
101425
|
+
const exportEntry = durableObjectExports[container.class_name];
|
|
101426
|
+
const referencedContainerName = exportEntry !== void 0 && "container" in exportEntry ? exportEntry.container : void 0;
|
|
101427
|
+
if (typeof referencedContainerName === "string" && referencedContainerName !== container.name) {
|
|
101428
|
+
diagnostics.errors.push(
|
|
101429
|
+
`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.container" is "${referencedContainerName}". A Durable Object and its container must reference each other consistently.`
|
|
101430
|
+
);
|
|
101431
|
+
continue;
|
|
101432
|
+
}
|
|
101433
|
+
const claimingClassNames = classNamesByContainerName.get(container.name);
|
|
101434
|
+
const claimingClassName = claimingClassNames?.length === 1 ? claimingClassNames[0] : void 0;
|
|
101435
|
+
if (claimingClassName !== void 0 && claimingClassName !== container.class_name) {
|
|
101436
|
+
diagnostics.errors.push(
|
|
101437
|
+
`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${claimingClassName}.container" references it. A Durable Object and its container must reference each other consistently.`
|
|
101438
|
+
);
|
|
101439
|
+
continue;
|
|
101440
|
+
}
|
|
101441
|
+
if (usesDurableObjectExports && !liveExportClassNames.has(container.class_name)) {
|
|
101442
|
+
diagnostics.errors.push(
|
|
101443
|
+
`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports" has no live "durable-object" entry for "${container.class_name}".`
|
|
101444
|
+
);
|
|
101445
|
+
continue;
|
|
101446
|
+
}
|
|
101447
|
+
if (referencedContainerName === void 0 && exportEntry !== void 0 && "storage" in exportEntry && exportEntry.storage === "legacy-kv") {
|
|
101448
|
+
diagnostics.errors.push(
|
|
101449
|
+
`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.storage" is "legacy-kv". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`
|
|
101450
|
+
);
|
|
101451
|
+
}
|
|
101452
|
+
}
|
|
101453
|
+
}
|
|
101454
|
+
__name(validateContainerExportLinks, "validateContainerExportLinks");
|
|
101250
101455
|
var validatePythonModules = /* @__PURE__ */ __name((diagnostics, field, value, topLevelEnv) => {
|
|
101251
101456
|
if (value === void 0) {
|
|
101252
101457
|
return true;
|
|
@@ -101573,6 +101778,43 @@ function findFileUp(name3, startDir, lastDir) {
|
|
|
101573
101778
|
return void 0;
|
|
101574
101779
|
}
|
|
101575
101780
|
__name(findFileUp, "findFileUp");
|
|
101781
|
+
function isCompatDate(str) {
|
|
101782
|
+
return /^\d{4}-\d{2}-\d{2}$/.test(str);
|
|
101783
|
+
}
|
|
101784
|
+
__name(isCompatDate, "isCompatDate");
|
|
101785
|
+
function formatCompatibilityDate(date5) {
|
|
101786
|
+
const compatDate = date5.toISOString().slice(0, 10);
|
|
101787
|
+
(0, import_node_assert.default)(isCompatDate(compatDate));
|
|
101788
|
+
return compatDate;
|
|
101789
|
+
}
|
|
101790
|
+
__name(formatCompatibilityDate, "formatCompatibilityDate");
|
|
101791
|
+
function getTodaysCompatDate() {
|
|
101792
|
+
return formatCompatibilityDate(/* @__PURE__ */ new Date());
|
|
101793
|
+
}
|
|
101794
|
+
__name(getTodaysCompatDate, "getTodaysCompatDate");
|
|
101795
|
+
var NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
|
|
101796
|
+
function isNodejsCompatDefaultOn(compatibilityDate) {
|
|
101797
|
+
return compatibilityDate !== void 0 && compatibilityDate >= NODEJS_COMPAT_DEFAULT_ON_DATE;
|
|
101798
|
+
}
|
|
101799
|
+
__name(isNodejsCompatDefaultOn, "isNodejsCompatDefaultOn");
|
|
101800
|
+
var NODEJS_COMPAT_V2_SWITCH_OVER_DATE = "2024-09-23";
|
|
101801
|
+
function resolveNodejsCompat(compatibilityDate, compatibilityFlags) {
|
|
101802
|
+
const isDefaultOn = isNodejsCompatDefaultOn(compatibilityDate);
|
|
101803
|
+
const isNodejsCompatEnabled = compatibilityFlags.includes("nodejs_compat") || isDefaultOn && !compatibilityFlags.includes("no_nodejs_compat");
|
|
101804
|
+
const isNodejsCompatV2Enabled = compatibilityFlags.includes("nodejs_compat_v2") || !compatibilityFlags.includes("no_nodejs_compat_v2") && (isDefaultOn || isNodejsCompatEnabled && compatibilityDate >= NODEJS_COMPAT_V2_SWITCH_OVER_DATE);
|
|
101805
|
+
return { isNodejsCompatEnabled, isNodejsCompatV2Enabled };
|
|
101806
|
+
}
|
|
101807
|
+
__name(resolveNodejsCompat, "resolveNodejsCompat");
|
|
101808
|
+
function stripRedundantNodejsCompatFlags(compatibilityDate, compatibilityFlags) {
|
|
101809
|
+
if (!isNodejsCompatDefaultOn(compatibilityDate)) {
|
|
101810
|
+
return compatibilityFlags;
|
|
101811
|
+
}
|
|
101812
|
+
const redundantFlags = ["nodejs_compat", "nodejs_compat_v2"].filter(
|
|
101813
|
+
(flag) => !compatibilityFlags.includes(`no_${flag}`)
|
|
101814
|
+
);
|
|
101815
|
+
return compatibilityFlags.filter((flag) => !redundantFlags.includes(flag));
|
|
101816
|
+
}
|
|
101817
|
+
__name(stripRedundantNodejsCompatFlags, "stripRedundantNodejsCompatFlags");
|
|
101576
101818
|
var import_ci_info = __toESM2(require_ci_info());
|
|
101577
101819
|
function isTtyInteractive() {
|
|
101578
101820
|
try {
|
|
@@ -102777,9 +103019,9 @@ function logHeaders(headers, logger) {
|
|
|
102777
103019
|
}
|
|
102778
103020
|
__name(logHeaders, "logHeaders");
|
|
102779
103021
|
async function performApiFetchBase(complianceConfig, resource, init2 = {}, userAgent, logger, queryParams, abortSignal, credentials) {
|
|
102780
|
-
(0,
|
|
103022
|
+
(0, import_node_assert.default)(credentials, "credentials are required for performApiFetch");
|
|
102781
103023
|
const method = init2.method ?? "GET";
|
|
102782
|
-
(0,
|
|
103024
|
+
(0, import_node_assert.default)(
|
|
102783
103025
|
resource.startsWith("/"),
|
|
102784
103026
|
`CF API fetch - resource path must start with a "/" but got "${resource}"`
|
|
102785
103027
|
);
|
|
@@ -103480,7 +103722,7 @@ function annotate(groupCounts, annotated, input, issue2, path62, groupId) {
|
|
|
103480
103722
|
}
|
|
103481
103723
|
if (groupId !== void 0) {
|
|
103482
103724
|
const current = groupCounts.get(groupId);
|
|
103483
|
-
(0,
|
|
103725
|
+
(0, import_node_assert.default)(current !== void 0);
|
|
103484
103726
|
groupCounts.set(groupId, current + 1);
|
|
103485
103727
|
}
|
|
103486
103728
|
return {
|
|
@@ -103490,7 +103732,7 @@ function annotate(groupCounts, annotated, input, issue2, path62, groupId) {
|
|
|
103490
103732
|
};
|
|
103491
103733
|
}
|
|
103492
103734
|
const [head, ...tail] = path62;
|
|
103493
|
-
(0,
|
|
103735
|
+
(0, import_node_assert.default)(isRecord2(input), "Expected object/array input for nested issue");
|
|
103494
103736
|
if (annotated === void 0) {
|
|
103495
103737
|
if (Array.isArray(input)) {
|
|
103496
103738
|
annotated = new Array(input.length);
|
|
@@ -103499,7 +103741,7 @@ function annotate(groupCounts, annotated, input, issue2, path62, groupId) {
|
|
|
103499
103741
|
annotated = Object.fromEntries(entries);
|
|
103500
103742
|
}
|
|
103501
103743
|
}
|
|
103502
|
-
(0,
|
|
103744
|
+
(0, import_node_assert.default)(isRecord2(annotated), "Expected object/array for nested issue");
|
|
103503
103745
|
annotated[head] = annotate(
|
|
103504
103746
|
groupCounts,
|
|
103505
103747
|
annotated[head],
|
|
@@ -103525,7 +103767,7 @@ function print(inspectOptions, groupCounts, annotated, indent2 = "", extras) {
|
|
|
103525
103767
|
messageColour = groupColours[annotated[kGroupId] % groupColours.length];
|
|
103526
103768
|
messagePrefix += annotated[kGroupId] + 1;
|
|
103527
103769
|
const remaining = groupCounts.get(annotated[kGroupId]);
|
|
103528
|
-
(0,
|
|
103770
|
+
(0, import_node_assert.default)(remaining !== void 0);
|
|
103529
103771
|
if (remaining > 1) {
|
|
103530
103772
|
groupOr = " *or*";
|
|
103531
103773
|
}
|
|
@@ -110526,7 +110768,7 @@ var Yargs = YargsFactory(esm_default2);
|
|
|
110526
110768
|
var yargs_default = Yargs;
|
|
110527
110769
|
|
|
110528
110770
|
// package.json
|
|
110529
|
-
var version2 = "2.
|
|
110771
|
+
var version2 = "2.72.1";
|
|
110530
110772
|
|
|
110531
110773
|
// src/metrics.ts
|
|
110532
110774
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -110660,7 +110902,7 @@ var import_semver = __toESM(require_semver2());
|
|
|
110660
110902
|
var import_which_pm_runs = __toESM(require_which_pm_runs());
|
|
110661
110903
|
|
|
110662
110904
|
// e2e/helpers/constants.ts
|
|
110663
|
-
var
|
|
110905
|
+
var import_node_assert2 = __toESM(require("node:assert"));
|
|
110664
110906
|
var isWindows2 = process.platform === "win32";
|
|
110665
110907
|
var TEST_TIMEOUT = 1e3 * 60 * 5;
|
|
110666
110908
|
var LONG_TIMEOUT = 1e3 * 60 * 10;
|
|
@@ -110680,7 +110922,7 @@ var customTempProjectPath = process.env.E2E_PROJECT_PATH;
|
|
|
110680
110922
|
var testRetries = process.env.E2E_TEST_RETRIES ? parseInt(process.env.E2E_TEST_RETRIES) : 1;
|
|
110681
110923
|
function isOneOf2(key, possibleValues, defaultValue) {
|
|
110682
110924
|
const value = process.env[key] ?? defaultValue;
|
|
110683
|
-
(0,
|
|
110925
|
+
(0, import_node_assert2.default)(
|
|
110684
110926
|
possibleValues.includes(value),
|
|
110685
110927
|
`Invalid environment variable "${key}". Expected one of: ${possibleValues.join(", ")}`
|
|
110686
110928
|
);
|
|
@@ -110759,7 +111001,7 @@ var detectPackageManager = () => {
|
|
|
110759
111001
|
}
|
|
110760
111002
|
};
|
|
110761
111003
|
var rectifyPmMismatch = async (ctx) => {
|
|
110762
|
-
const { npm:
|
|
111004
|
+
const { npm: npm25 } = detectPackageManager();
|
|
110763
111005
|
if (!detectPmMismatch(ctx)) {
|
|
110764
111006
|
return;
|
|
110765
111007
|
}
|
|
@@ -110771,17 +111013,17 @@ var rectifyPmMismatch = async (ctx) => {
|
|
|
110771
111013
|
if ((0, import_node_fs7.existsSync)(lockfilePath)) {
|
|
110772
111014
|
(0, import_node_fs7.rmSync)(lockfilePath);
|
|
110773
111015
|
}
|
|
110774
|
-
await runCommand([
|
|
111016
|
+
await runCommand([npm25, "install"], {
|
|
110775
111017
|
silent: true,
|
|
110776
111018
|
cwd: ctx.project.path,
|
|
110777
111019
|
startText: "Installing dependencies",
|
|
110778
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
111020
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
110779
111021
|
});
|
|
110780
111022
|
};
|
|
110781
111023
|
var detectPmMismatch = (ctx) => {
|
|
110782
|
-
const { npm:
|
|
111024
|
+
const { npm: npm25 } = detectPackageManager();
|
|
110783
111025
|
const projectPath = ctx.project.path;
|
|
110784
|
-
switch (
|
|
111026
|
+
switch (npm25) {
|
|
110785
111027
|
case "npm":
|
|
110786
111028
|
return false;
|
|
110787
111029
|
case "yarn":
|
|
@@ -111067,7 +111309,7 @@ var import_node_path11 = __toESM(require("node:path"));
|
|
|
111067
111309
|
// ../cli/dist/packages.mjs
|
|
111068
111310
|
var import_node_fs8 = require("node:fs");
|
|
111069
111311
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
111070
|
-
var
|
|
111312
|
+
var import_node_assert3 = __toESM(require("node:assert"), 1);
|
|
111071
111313
|
var import_promises4 = require("node:fs/promises");
|
|
111072
111314
|
var installPackages = async (packageManager, packages, config50 = {}) => {
|
|
111073
111315
|
const { force, dev, startText, doneText } = config50;
|
|
@@ -111134,7 +111376,7 @@ var installPackages = async (packageManager, packages, config50 = {}) => {
|
|
|
111134
111376
|
const pkgJsonPath = import_node_path8.default.join(process.cwd(), "package.json");
|
|
111135
111377
|
const pkgJson = parsePackageJSON(readFileSync(pkgJsonPath), pkgJsonPath);
|
|
111136
111378
|
const deps = config50.dev ? pkgJson.devDependencies : pkgJson.dependencies;
|
|
111137
|
-
(0,
|
|
111379
|
+
(0, import_node_assert3.default)(deps, "dependencies should be defined");
|
|
111138
111380
|
for (const pkg of packages) {
|
|
111139
111381
|
const versionMarker = pkg.lastIndexOf("@");
|
|
111140
111382
|
if (versionMarker > 0) {
|
|
@@ -112073,8 +112315,8 @@ var hasTsConfig = (path7) => {
|
|
|
112073
112315
|
var APPROVED_BUILDS = ["esbuild", "workerd"];
|
|
112074
112316
|
var APPROVED_BUILDS_SET = new Set(APPROVED_BUILDS);
|
|
112075
112317
|
var writePnpmBuildApprovals = (projectPath) => {
|
|
112076
|
-
const { npm:
|
|
112077
|
-
if (
|
|
112318
|
+
const { npm: npm25 } = detectPackageManager();
|
|
112319
|
+
if (npm25 !== "pnpm") {
|
|
112078
112320
|
return;
|
|
112079
112321
|
}
|
|
112080
112322
|
const yamlPath = (0, import_node_path10.join)(projectPath, "pnpm-workspace.yaml");
|
|
@@ -112221,49 +112463,49 @@ var getPnpmIgnoredBuildsGuidance = (packages = []) => {
|
|
|
112221
112463
|
|
|
112222
112464
|
// src/helpers/packages.ts
|
|
112223
112465
|
var installPackages2 = async (packages, config50 = {}) => {
|
|
112224
|
-
const { npm:
|
|
112225
|
-
return installPackages(
|
|
112466
|
+
const { npm: npm25 } = detectPackageManager();
|
|
112467
|
+
return installPackages(npm25, packages, config50);
|
|
112226
112468
|
};
|
|
112227
112469
|
async function installWrangler2() {
|
|
112228
|
-
const { npm:
|
|
112229
|
-
return installWrangler(
|
|
112470
|
+
const { npm: npm25 } = detectPackageManager();
|
|
112471
|
+
return installWrangler(npm25, false);
|
|
112230
112472
|
}
|
|
112231
112473
|
var npmInstall = async (ctx) => {
|
|
112232
112474
|
const nodeModulesPath = import_node_path11.default.join(ctx.project.path, "node_modules");
|
|
112233
112475
|
if ((0, import_node_fs11.existsSync)(nodeModulesPath)) {
|
|
112234
112476
|
return;
|
|
112235
112477
|
}
|
|
112236
|
-
const { npm:
|
|
112237
|
-
if (
|
|
112238
|
-
await pnpmInstallWithBuildApprovalRetry(
|
|
112478
|
+
const { npm: npm25 } = detectPackageManager();
|
|
112479
|
+
if (npm25 === "pnpm") {
|
|
112480
|
+
await pnpmInstallWithBuildApprovalRetry(npm25);
|
|
112239
112481
|
return;
|
|
112240
112482
|
}
|
|
112241
|
-
await runCommand([
|
|
112483
|
+
await runCommand([npm25, "install"], {
|
|
112242
112484
|
silent: true,
|
|
112243
112485
|
startText: "Installing dependencies",
|
|
112244
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
112486
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
112245
112487
|
});
|
|
112246
112488
|
};
|
|
112247
|
-
var runPnpmInstallQuiet = async (
|
|
112489
|
+
var runPnpmInstallQuiet = async (npm25, startText) => {
|
|
112248
112490
|
const s = spinner();
|
|
112249
112491
|
s.start(startText);
|
|
112250
112492
|
try {
|
|
112251
|
-
await runCommand([
|
|
112252
|
-
s.stop(`${brandColor("installed")} ${dim(`via \`${
|
|
112493
|
+
await runCommand([npm25, "install"], { silent: true, useSpinner: false });
|
|
112494
|
+
s.stop(`${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`);
|
|
112253
112495
|
} catch (err) {
|
|
112254
112496
|
s.stop(red("install failed"));
|
|
112255
112497
|
throw err;
|
|
112256
112498
|
}
|
|
112257
112499
|
};
|
|
112258
|
-
var pnpmInstallWithBuildApprovalRetry = async (
|
|
112500
|
+
var pnpmInstallWithBuildApprovalRetry = async (npm25) => {
|
|
112259
112501
|
try {
|
|
112260
|
-
await runPnpmInstallQuiet(
|
|
112502
|
+
await runPnpmInstallQuiet(npm25, "Installing dependencies");
|
|
112261
112503
|
return;
|
|
112262
112504
|
} catch (err) {
|
|
112263
112505
|
if (!isPnpmIgnoredBuildsError(err)) {
|
|
112264
112506
|
throw err;
|
|
112265
112507
|
}
|
|
112266
|
-
await recoverFromIgnoredBuilds(
|
|
112508
|
+
await recoverFromIgnoredBuilds(npm25, err);
|
|
112267
112509
|
}
|
|
112268
112510
|
};
|
|
112269
112511
|
var STDIN_EOF_MARKER = "__c3_stdin_eof__";
|
|
@@ -112295,7 +112537,7 @@ var promptOrEOF = async (packages) => {
|
|
|
112295
112537
|
}
|
|
112296
112538
|
}
|
|
112297
112539
|
};
|
|
112298
|
-
var recoverFromIgnoredBuilds = async (
|
|
112540
|
+
var recoverFromIgnoredBuilds = async (npm25, originalErr) => {
|
|
112299
112541
|
const packages = extractIgnoredBuildPackages(originalErr);
|
|
112300
112542
|
if (packages.length === 0) {
|
|
112301
112543
|
throw new IgnoredBuildsError([], originalErr);
|
|
@@ -112315,13 +112557,13 @@ var recoverFromIgnoredBuilds = async (npm24, originalErr) => {
|
|
|
112315
112557
|
if (!approve) {
|
|
112316
112558
|
throw new IgnoredBuildsError(packages, originalErr);
|
|
112317
112559
|
}
|
|
112318
|
-
await runCommand([
|
|
112560
|
+
await runCommand([npm25, "approve-builds", ...packages], {
|
|
112319
112561
|
silent: true,
|
|
112320
112562
|
startText: "Approving dependency build scripts",
|
|
112321
112563
|
doneText: `${brandColor("approved")} ${dim(packages.join(", "))}`
|
|
112322
112564
|
});
|
|
112323
112565
|
try {
|
|
112324
|
-
await runPnpmInstallQuiet(
|
|
112566
|
+
await runPnpmInstallQuiet(npm25, "Re-running install");
|
|
112325
112567
|
} catch (retryErr) {
|
|
112326
112568
|
if (isPnpmIgnoredBuildsError(retryErr)) {
|
|
112327
112569
|
throw new IgnoredBuildsError(
|
|
@@ -112978,12 +113220,12 @@ var isUpdateAvailable = async () => {
|
|
|
112978
113220
|
}
|
|
112979
113221
|
};
|
|
112980
113222
|
var runLatest = async () => {
|
|
112981
|
-
const { npm:
|
|
113223
|
+
const { npm: npm25 } = detectPackageManager();
|
|
112982
113224
|
const args = process.argv.slice(2);
|
|
112983
|
-
if (
|
|
113225
|
+
if (npm25 === "npm") {
|
|
112984
113226
|
args.unshift("--");
|
|
112985
113227
|
}
|
|
112986
|
-
await runCommand([
|
|
113228
|
+
await runCommand([npm25, "create", "cloudflare@latest", ...args], {
|
|
112987
113229
|
// Mark the spawned process so it doesn't attempt to update and re-spawn
|
|
112988
113230
|
// again, which would loop indefinitely when the package manager keeps
|
|
112989
113231
|
// resolving the same version of `cloudflare@latest`.
|
|
@@ -113111,18 +113353,19 @@ __name2(getPropertyName, "getPropertyName");
|
|
|
113111
113353
|
var package_default = {
|
|
113112
113354
|
name: "frameworks_clis_info",
|
|
113113
113355
|
dependencies: {
|
|
113114
|
-
"@angular/create": "22.1.
|
|
113356
|
+
"@angular/create": "22.1.4",
|
|
113115
113357
|
"@tanstack/cli": "0.70.2",
|
|
113116
|
-
"create-analog": "2.
|
|
113358
|
+
"create-analog": "2.7.0",
|
|
113117
113359
|
"create-astro": "5.2.3",
|
|
113118
113360
|
"create-docusaurus": "3.10.2",
|
|
113119
113361
|
"create-hono": "0.19.4",
|
|
113120
|
-
"create-next-app": "16.3.
|
|
113362
|
+
"create-next-app": "16.3.1",
|
|
113121
113363
|
"create-qwik": "1.20.0",
|
|
113122
113364
|
"create-react-router": "8.3.0",
|
|
113123
113365
|
"create-rwsdk": "3.1.3",
|
|
113124
|
-
"create-solid": "0.
|
|
113125
|
-
"create-vike": "0.0.
|
|
113366
|
+
"create-solid": "0.10.0",
|
|
113367
|
+
"create-vike": "0.0.675",
|
|
113368
|
+
"create-vinext-app": "1.0.0-beta.2",
|
|
113126
113369
|
"create-vite": "9.1.2",
|
|
113127
113370
|
"create-vue": "3.23.0",
|
|
113128
113371
|
"create-waku": "0.12.5-1.0.0-alpha.10-0",
|
|
@@ -113147,9 +113390,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
113147
113390
|
};
|
|
113148
113391
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
113149
113392
|
const cli = getFrameworkCli(ctx, true);
|
|
113150
|
-
const { npm:
|
|
113151
|
-
const cmd = [...
|
|
113152
|
-
const env3 =
|
|
113393
|
+
const { npm: npm25, dlx } = detectPackageManager();
|
|
113394
|
+
const cmd = [...npm25 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
113395
|
+
const env3 = npm25 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
|
|
113153
113396
|
if (ctx.args.additionalArgs?.length) {
|
|
113154
113397
|
cmd.push(...ctx.args.additionalArgs);
|
|
113155
113398
|
}
|
|
@@ -113165,12 +113408,11 @@ var runFrameworkGenerator = async (ctx, args) => {
|
|
|
113165
113408
|
// src/helpers/compatDate.ts
|
|
113166
113409
|
var import_node_fs16 = require("node:fs");
|
|
113167
113410
|
var import_node_path14 = require("node:path");
|
|
113168
|
-
function getWorkerdCompatibilityDate(
|
|
113411
|
+
function getWorkerdCompatibilityDate() {
|
|
113169
113412
|
const s = spinner();
|
|
113170
|
-
s.start("
|
|
113171
|
-
|
|
113172
|
-
|
|
113173
|
-
return date5;
|
|
113413
|
+
s.start("Selecting workerd compatibility date");
|
|
113414
|
+
s.stop(`${brandColor("compatibility date")} ${dim(DEFAULT_COMPAT_DATE)}`);
|
|
113415
|
+
return DEFAULT_COMPAT_DATE;
|
|
113174
113416
|
}
|
|
113175
113417
|
function getLatestTypesEntrypoint(ctx) {
|
|
113176
113418
|
const workersTypesPath = (0, import_node_path14.resolve)(
|
|
@@ -113206,7 +113448,7 @@ var generate = async (ctx) => {
|
|
|
113206
113448
|
var configure = async (ctx) => {
|
|
113207
113449
|
usesTypescript(ctx);
|
|
113208
113450
|
const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
113209
|
-
const compatDate = getWorkerdCompatibilityDate(
|
|
113451
|
+
const compatDate = getWorkerdCompatibilityDate();
|
|
113210
113452
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
113211
113453
|
transformFile(filePath, {
|
|
113212
113454
|
visitCallExpression: function(n) {
|
|
@@ -113984,39 +114226,123 @@ var config22 = {
|
|
|
113984
114226
|
var c3_default23 = config22;
|
|
113985
114227
|
|
|
113986
114228
|
// templates/next/c3.ts
|
|
113987
|
-
var
|
|
114229
|
+
var import_node_assert4 = __toESM(require("node:assert"));
|
|
114230
|
+
var { npm: npm8 } = detectPackageManager();
|
|
114231
|
+
var VINEXT_TYPES_PATH = "./worker-configuration.d.ts";
|
|
114232
|
+
var OPENNEXT_TYPES_PATH = "./cloudflare-env.d.ts";
|
|
114233
|
+
var NEXT_VARIANTS = [
|
|
114234
|
+
{
|
|
114235
|
+
value: "vinext",
|
|
114236
|
+
label: "vinext (recommended)"
|
|
114237
|
+
},
|
|
114238
|
+
{
|
|
114239
|
+
value: "opennext",
|
|
114240
|
+
label: "OpenNext adapter"
|
|
114241
|
+
}
|
|
114242
|
+
];
|
|
114243
|
+
async function getNextVariant(ctx) {
|
|
114244
|
+
if (ctx.args.variant) {
|
|
114245
|
+
const selected2 = NEXT_VARIANTS.find(
|
|
114246
|
+
(variant) => variant.value === ctx.args.variant
|
|
114247
|
+
);
|
|
114248
|
+
if (!selected2) {
|
|
114249
|
+
throw new Error(
|
|
114250
|
+
`Unknown Next.js variant "${ctx.args.variant}". Valid variants are: ${NEXT_VARIANTS.map((v) => v.value).join(", ")}`
|
|
114251
|
+
);
|
|
114252
|
+
}
|
|
114253
|
+
return selected2;
|
|
114254
|
+
}
|
|
114255
|
+
const value = await inputPrompt({
|
|
114256
|
+
type: "select",
|
|
114257
|
+
question: "Which Next.js adapter do you want to use?",
|
|
114258
|
+
label: "variant",
|
|
114259
|
+
options: NEXT_VARIANTS,
|
|
114260
|
+
defaultValue: NEXT_VARIANTS[0].value,
|
|
114261
|
+
// Honour -y / --accept-defaults by taking the recommended vinext path.
|
|
114262
|
+
acceptDefault: Boolean(ctx.args.acceptDefaults)
|
|
114263
|
+
});
|
|
114264
|
+
const selected = NEXT_VARIANTS.find((variant) => variant.value === value);
|
|
114265
|
+
(0, import_node_assert4.default)(selected, "Expected a Next.js variant to be selected");
|
|
114266
|
+
return selected;
|
|
114267
|
+
}
|
|
114268
|
+
async function generateVinext(ctx) {
|
|
114269
|
+
const pmFlag = npm8 === "pnpm" ? "--use-pnpm" : npm8 === "yarn" ? "--use-yarn" : npm8 === "bun" ? "--use-bun" : "--use-npm";
|
|
114270
|
+
await runFrameworkGenerator(ctx, [
|
|
114271
|
+
ctx.project.name,
|
|
114272
|
+
"--platform",
|
|
114273
|
+
"cloudflare",
|
|
114274
|
+
// Avoid a placeholder KV namespace id that would block `wrangler deploy`
|
|
114275
|
+
// until the user manually provisions one. Caching can be added later
|
|
114276
|
+
// via vinext's Cloudflare cache adapters.
|
|
114277
|
+
"--data-cache",
|
|
114278
|
+
"none",
|
|
114279
|
+
"--yes",
|
|
114280
|
+
"--skip-install",
|
|
114281
|
+
"--disable-git",
|
|
114282
|
+
pmFlag
|
|
114283
|
+
]);
|
|
114284
|
+
logRaw("");
|
|
114285
|
+
}
|
|
114286
|
+
async function generateOpenNext(ctx) {
|
|
113988
114287
|
const branch = "main";
|
|
113989
114288
|
const repoUrl = `github:opennextjs/opennextjs-cloudflare/create-cloudflare/next#${branch}`;
|
|
113990
114289
|
await downloadRemoteTemplate(repoUrl, {
|
|
113991
114290
|
intoFolder: ctx.project.path
|
|
113992
114291
|
});
|
|
113993
114292
|
await updatePackageName(ctx);
|
|
114293
|
+
}
|
|
114294
|
+
var generate12 = async (ctx) => {
|
|
114295
|
+
const variant = await getNextVariant(ctx);
|
|
114296
|
+
ctx.args.variant = variant.value;
|
|
114297
|
+
ctx.template.typesPath = variant.value === "opennext" ? OPENNEXT_TYPES_PATH : VINEXT_TYPES_PATH;
|
|
114298
|
+
if (variant.value === "opennext") {
|
|
114299
|
+
ctx.template.frameworkCliUsed = false;
|
|
114300
|
+
await generateOpenNext(ctx);
|
|
114301
|
+
return;
|
|
114302
|
+
}
|
|
114303
|
+
await generateVinext(ctx);
|
|
113994
114304
|
};
|
|
113995
114305
|
var envInterfaceName3 = "CloudflareEnv";
|
|
113996
|
-
var typesPath = "./cloudflare-env.d.ts";
|
|
113997
114306
|
var c3_default24 = {
|
|
113998
114307
|
configVersion: 1,
|
|
113999
114308
|
id: "next",
|
|
114000
|
-
|
|
114309
|
+
// Used by runFrameworkGenerator for the vinext path. OpenNext downloads a
|
|
114310
|
+
// remote template and does not invoke this CLI.
|
|
114311
|
+
frameworkCli: "create-vinext-app",
|
|
114001
114312
|
platform: "workers",
|
|
114002
114313
|
displayName: "Next.js",
|
|
114003
114314
|
generate: generate12,
|
|
114315
|
+
transformPackageJson: async (_pkgJson, ctx) => {
|
|
114316
|
+
if (ctx.args.variant === "opennext") {
|
|
114317
|
+
return {};
|
|
114318
|
+
}
|
|
114319
|
+
return {
|
|
114320
|
+
scripts: {
|
|
114321
|
+
// Align with OpenNext so the shared previewScript: "preview" works
|
|
114322
|
+
// for both variants (vinext only ships dev/build/start/deploy).
|
|
114323
|
+
preview: `${npm8} run build && ${npm8} run start${npm8 === "npm" ? " --" : ""}`,
|
|
114324
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${VINEXT_TYPES_PATH}`
|
|
114325
|
+
}
|
|
114326
|
+
};
|
|
114327
|
+
},
|
|
114004
114328
|
devScript: "dev",
|
|
114005
114329
|
previewScript: "preview",
|
|
114006
114330
|
deployScript: "deploy",
|
|
114007
|
-
typesPath,
|
|
114331
|
+
typesPath: VINEXT_TYPES_PATH,
|
|
114008
114332
|
envInterfaceName: envInterfaceName3
|
|
114009
114333
|
};
|
|
114010
114334
|
|
|
114011
114335
|
// templates/next/experimental_c3.ts
|
|
114012
114336
|
var generate13 = async (ctx) => {
|
|
114013
|
-
|
|
114014
|
-
|
|
114015
|
-
|
|
114016
|
-
|
|
114337
|
+
if (ctx.args.variant) {
|
|
114338
|
+
throw new Error(
|
|
114339
|
+
"Next.js adapter variants are not supported with --experimental."
|
|
114340
|
+
);
|
|
114341
|
+
}
|
|
114342
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--skip-install"]);
|
|
114017
114343
|
};
|
|
114018
114344
|
var envInterfaceName4 = "CloudflareEnv";
|
|
114019
|
-
var
|
|
114345
|
+
var typesPath = "./cloudflare-env.d.ts";
|
|
114020
114346
|
var experimental_c3_default = {
|
|
114021
114347
|
configVersion: 1,
|
|
114022
114348
|
id: "next",
|
|
@@ -114027,20 +114353,20 @@ var experimental_c3_default = {
|
|
|
114027
114353
|
devScript: "dev",
|
|
114028
114354
|
previewScript: "preview",
|
|
114029
114355
|
deployScript: "deploy",
|
|
114030
|
-
typesPath
|
|
114356
|
+
typesPath,
|
|
114031
114357
|
envInterfaceName: envInterfaceName4
|
|
114032
114358
|
};
|
|
114033
114359
|
|
|
114034
114360
|
// templates/nuxt/pages/c3.ts
|
|
114035
114361
|
var recast4 = __toESM(require_main2());
|
|
114036
|
-
var { npm:
|
|
114362
|
+
var { npm: npm9, name: pm } = detectPackageManager();
|
|
114037
114363
|
var generate14 = async (ctx) => {
|
|
114038
114364
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
114039
114365
|
await runFrameworkGenerator(ctx, [
|
|
114040
114366
|
"init",
|
|
114041
114367
|
ctx.project.name,
|
|
114042
114368
|
"--packageManager",
|
|
114043
|
-
|
|
114369
|
+
npm9,
|
|
114044
114370
|
"--no-install",
|
|
114045
114371
|
gitFlag
|
|
114046
114372
|
]);
|
|
@@ -114055,7 +114381,7 @@ var configure6 = async () => {
|
|
|
114055
114381
|
await installPackages2(packages, {
|
|
114056
114382
|
dev: true,
|
|
114057
114383
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
114058
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
114384
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm9} install\``)}`
|
|
114059
114385
|
});
|
|
114060
114386
|
updateNuxtConfig();
|
|
114061
114387
|
};
|
|
@@ -114116,8 +114442,8 @@ var config23 = {
|
|
|
114116
114442
|
configure: configure6,
|
|
114117
114443
|
transformPackageJson: async () => ({
|
|
114118
114444
|
scripts: {
|
|
114119
|
-
deploy: `${
|
|
114120
|
-
preview: `${
|
|
114445
|
+
deploy: `${npm9} run build && wrangler pages deploy`,
|
|
114446
|
+
preview: `${npm9} run build && wrangler pages dev`,
|
|
114121
114447
|
"cf-typegen": `wrangler types`
|
|
114122
114448
|
}
|
|
114123
114449
|
}),
|
|
@@ -114129,14 +114455,14 @@ var c3_default25 = config23;
|
|
|
114129
114455
|
|
|
114130
114456
|
// templates/nuxt/workers/c3.ts
|
|
114131
114457
|
var recast5 = __toESM(require_main2());
|
|
114132
|
-
var { npm:
|
|
114458
|
+
var { npm: npm10, name: pm2 } = detectPackageManager();
|
|
114133
114459
|
var generate15 = async (ctx) => {
|
|
114134
114460
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
114135
114461
|
await runFrameworkGenerator(ctx, [
|
|
114136
114462
|
"init",
|
|
114137
114463
|
ctx.project.name,
|
|
114138
114464
|
"--packageManager",
|
|
114139
|
-
|
|
114465
|
+
npm10,
|
|
114140
114466
|
"--no-install",
|
|
114141
114467
|
gitFlag
|
|
114142
114468
|
]);
|
|
@@ -114151,7 +114477,7 @@ var configure7 = async () => {
|
|
|
114151
114477
|
await installPackages2(packages, {
|
|
114152
114478
|
dev: true,
|
|
114153
114479
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
114154
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
114480
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
114155
114481
|
});
|
|
114156
114482
|
updateNuxtConfig2();
|
|
114157
114483
|
};
|
|
@@ -114211,8 +114537,8 @@ var config24 = {
|
|
|
114211
114537
|
configure: configure7,
|
|
114212
114538
|
transformPackageJson: async () => ({
|
|
114213
114539
|
scripts: {
|
|
114214
|
-
deploy: `${
|
|
114215
|
-
preview: `${
|
|
114540
|
+
deploy: `${npm10} run build && wrangler deploy`,
|
|
114541
|
+
preview: `${npm10} run build && wrangler dev`,
|
|
114216
114542
|
"cf-typegen": `wrangler types`
|
|
114217
114543
|
}
|
|
114218
114544
|
}),
|
|
@@ -114502,13 +114828,13 @@ var loadTemplateSnippets = (ctx) => {
|
|
|
114502
114828
|
|
|
114503
114829
|
// templates/qwik/pages/c3.ts
|
|
114504
114830
|
var recast6 = __toESM(require_main2());
|
|
114505
|
-
var { npm:
|
|
114831
|
+
var { npm: npm11, npx: npx3, name } = detectPackageManager();
|
|
114506
114832
|
var generate16 = async (ctx) => {
|
|
114507
114833
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
114508
114834
|
};
|
|
114509
114835
|
var configure8 = async (ctx) => {
|
|
114510
114836
|
const cmd = [
|
|
114511
|
-
name === "pnpm" ?
|
|
114837
|
+
name === "pnpm" ? npm11 : npx3,
|
|
114512
114838
|
"qwik",
|
|
114513
114839
|
"add",
|
|
114514
114840
|
"cloudflare-pages",
|
|
@@ -114576,8 +114902,8 @@ var config29 = {
|
|
|
114576
114902
|
configure: configure8,
|
|
114577
114903
|
transformPackageJson: async () => ({
|
|
114578
114904
|
scripts: {
|
|
114579
|
-
deploy: `${
|
|
114580
|
-
preview: `${
|
|
114905
|
+
deploy: `${npm11} run build && wrangler pages deploy`,
|
|
114906
|
+
preview: `${npm11} run build && wrangler pages dev`,
|
|
114581
114907
|
"cf-typegen": `wrangler types`
|
|
114582
114908
|
}
|
|
114583
114909
|
}),
|
|
@@ -114590,13 +114916,13 @@ var c3_default31 = config29;
|
|
|
114590
114916
|
|
|
114591
114917
|
// templates/qwik/workers/c3.ts
|
|
114592
114918
|
var recast7 = __toESM(require_main2());
|
|
114593
|
-
var { npm:
|
|
114919
|
+
var { npm: npm12, npx: npx4, name: name2 } = detectPackageManager();
|
|
114594
114920
|
var generate17 = async (ctx) => {
|
|
114595
114921
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
114596
114922
|
};
|
|
114597
114923
|
var configure9 = async (ctx) => {
|
|
114598
114924
|
const cmd = [
|
|
114599
|
-
name2 === "pnpm" ?
|
|
114925
|
+
name2 === "pnpm" ? npm12 : npx4,
|
|
114600
114926
|
"qwik",
|
|
114601
114927
|
"add",
|
|
114602
114928
|
"cloudflare-workers",
|
|
@@ -114663,8 +114989,8 @@ var config30 = {
|
|
|
114663
114989
|
configure: configure9,
|
|
114664
114990
|
transformPackageJson: async () => ({
|
|
114665
114991
|
scripts: {
|
|
114666
|
-
deploy: `${
|
|
114667
|
-
preview: `${
|
|
114992
|
+
deploy: `${npm12} run build && wrangler deploy`,
|
|
114993
|
+
preview: `${npm12} run build && wrangler dev`,
|
|
114668
114994
|
"cf-typegen": `wrangler types`
|
|
114669
114995
|
}
|
|
114670
114996
|
}),
|
|
@@ -114684,7 +115010,7 @@ var c3_default33 = config31;
|
|
|
114684
115010
|
|
|
114685
115011
|
// templates/react-router/c3.ts
|
|
114686
115012
|
var import_node_path19 = require("node:path");
|
|
114687
|
-
var { npm:
|
|
115013
|
+
var { npm: npm13 } = detectPackageManager();
|
|
114688
115014
|
var generate18 = async (ctx) => {
|
|
114689
115015
|
await runFrameworkGenerator(ctx, [
|
|
114690
115016
|
ctx.project.name,
|
|
@@ -114725,8 +115051,8 @@ var config32 = {
|
|
|
114725
115051
|
configure: configure10,
|
|
114726
115052
|
transformPackageJson: async () => ({
|
|
114727
115053
|
scripts: {
|
|
114728
|
-
deploy: `${
|
|
114729
|
-
preview: `${
|
|
115054
|
+
deploy: `${npm13} run build && wrangler deploy`,
|
|
115055
|
+
preview: `${npm13} run build && vite preview`,
|
|
114730
115056
|
"cf-typegen": `wrangler types`,
|
|
114731
115057
|
typecheck: `wrangler types && react-router typegen && tsc -b`,
|
|
114732
115058
|
postinstall: `wrangler types`
|
|
@@ -114739,7 +115065,7 @@ var config32 = {
|
|
|
114739
115065
|
var c3_default34 = config32;
|
|
114740
115066
|
|
|
114741
115067
|
// templates/react/pages/c3.ts
|
|
114742
|
-
var { npm:
|
|
115068
|
+
var { npm: npm14 } = detectPackageManager();
|
|
114743
115069
|
var generate19 = async (ctx) => {
|
|
114744
115070
|
const variant = await getVariant(ctx);
|
|
114745
115071
|
await runFrameworkGenerator(ctx, [
|
|
@@ -114799,8 +115125,8 @@ var config33 = {
|
|
|
114799
115125
|
generate: generate19,
|
|
114800
115126
|
transformPackageJson: async () => ({
|
|
114801
115127
|
scripts: {
|
|
114802
|
-
deploy: `${
|
|
114803
|
-
preview: `${
|
|
115128
|
+
deploy: `${npm14} run build && wrangler pages deploy`,
|
|
115129
|
+
preview: `${npm14} run build && wrangler pages dev`,
|
|
114804
115130
|
"cf-typegen": `wrangler types`
|
|
114805
115131
|
}
|
|
114806
115132
|
}),
|
|
@@ -114815,7 +115141,7 @@ var import_node_assert5 = __toESM(require("node:assert"));
|
|
|
114815
115141
|
var recast8 = __toESM(require_main2());
|
|
114816
115142
|
var b = recast8.types.builders;
|
|
114817
115143
|
var t = recast8.types.namedTypes;
|
|
114818
|
-
var { npm:
|
|
115144
|
+
var { npm: npm15 } = detectPackageManager();
|
|
114819
115145
|
var generate20 = async (ctx) => {
|
|
114820
115146
|
const variant = await getVariant2(ctx);
|
|
114821
115147
|
ctx.args.lang = variant.lang;
|
|
@@ -114949,8 +115275,8 @@ var config34 = {
|
|
|
114949
115275
|
configure: configure11,
|
|
114950
115276
|
transformPackageJson: async (_, ctx) => ({
|
|
114951
115277
|
scripts: {
|
|
114952
|
-
deploy: `${
|
|
114953
|
-
preview: `${
|
|
115278
|
+
deploy: `${npm15} run build && wrangler deploy`,
|
|
115279
|
+
preview: `${npm15} run build && vite preview`,
|
|
114954
115280
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
114955
115281
|
}
|
|
114956
115282
|
}),
|
|
@@ -114968,7 +115294,7 @@ var config35 = {
|
|
|
114968
115294
|
var c3_default37 = config35;
|
|
114969
115295
|
|
|
114970
115296
|
// templates/redwood/c3.ts
|
|
114971
|
-
var { npm:
|
|
115297
|
+
var { npm: npm16 } = detectPackageManager();
|
|
114972
115298
|
var generate21 = async (ctx) => {
|
|
114973
115299
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
114974
115300
|
logRaw("");
|
|
@@ -114982,8 +115308,8 @@ var config36 = {
|
|
|
114982
115308
|
generate: generate21,
|
|
114983
115309
|
transformPackageJson: async () => ({
|
|
114984
115310
|
scripts: {
|
|
114985
|
-
deploy: `${
|
|
114986
|
-
preview: `${
|
|
115311
|
+
deploy: `${npm16} run release`,
|
|
115312
|
+
preview: `${npm16} run build && wrangler dev`,
|
|
114987
115313
|
"cf-typegen": `wrangler types`
|
|
114988
115314
|
}
|
|
114989
115315
|
}),
|
|
@@ -115015,7 +115341,7 @@ var c3_default39 = config37;
|
|
|
115015
115341
|
|
|
115016
115342
|
// templates/solid/c3.ts
|
|
115017
115343
|
var recast9 = __toESM(require_main2());
|
|
115018
|
-
var { npm:
|
|
115344
|
+
var { npm: npm17 } = detectPackageManager();
|
|
115019
115345
|
var generate22 = async (ctx) => {
|
|
115020
115346
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
115021
115347
|
logRaw("");
|
|
@@ -115061,8 +115387,8 @@ var config38 = {
|
|
|
115061
115387
|
configure: configure12,
|
|
115062
115388
|
transformPackageJson: async () => ({
|
|
115063
115389
|
scripts: {
|
|
115064
|
-
preview: `${
|
|
115065
|
-
deploy: `${
|
|
115390
|
+
preview: `${npm17} run build && npx wrangler dev`,
|
|
115391
|
+
deploy: `${npm17} run build && wrangler deploy`,
|
|
115066
115392
|
"cf-typegen": `wrangler types`
|
|
115067
115393
|
}
|
|
115068
115394
|
}),
|
|
@@ -115075,7 +115401,7 @@ var c3_default40 = config38;
|
|
|
115075
115401
|
// templates/svelte/pages/c3.ts
|
|
115076
115402
|
var import_node_fs19 = require("node:fs");
|
|
115077
115403
|
var recast10 = __toESM(require_main2());
|
|
115078
|
-
var { npm:
|
|
115404
|
+
var { npm: npm18 } = detectPackageManager();
|
|
115079
115405
|
var generate23 = async (ctx) => {
|
|
115080
115406
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
115081
115407
|
logRaw("");
|
|
@@ -115163,7 +115489,7 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
115163
115489
|
}
|
|
115164
115490
|
});
|
|
115165
115491
|
};
|
|
115166
|
-
var
|
|
115492
|
+
var typesPath2 = "src/worker-configuration.d.ts";
|
|
115167
115493
|
var config39 = {
|
|
115168
115494
|
configVersion: 1,
|
|
115169
115495
|
id: "svelte",
|
|
@@ -115179,13 +115505,13 @@ var config39 = {
|
|
|
115179
115505
|
configure: configure13,
|
|
115180
115506
|
transformPackageJson: async (original, ctx) => {
|
|
115181
115507
|
let scripts = {
|
|
115182
|
-
preview: `${
|
|
115183
|
-
deploy: `${
|
|
115508
|
+
preview: `${npm18} run build && wrangler pages dev`,
|
|
115509
|
+
deploy: `${npm18} run build && wrangler pages deploy`
|
|
115184
115510
|
};
|
|
115185
115511
|
if (usesTypescript(ctx)) {
|
|
115186
115512
|
scripts = {
|
|
115187
115513
|
...scripts,
|
|
115188
|
-
"cf-typegen": `wrangler types ${
|
|
115514
|
+
"cf-typegen": `wrangler types ${typesPath2}`
|
|
115189
115515
|
};
|
|
115190
115516
|
}
|
|
115191
115517
|
return { scripts };
|
|
@@ -115193,13 +115519,13 @@ var config39 = {
|
|
|
115193
115519
|
devScript: "dev",
|
|
115194
115520
|
deployScript: "deploy",
|
|
115195
115521
|
previewScript: "preview",
|
|
115196
|
-
typesPath:
|
|
115522
|
+
typesPath: typesPath2
|
|
115197
115523
|
};
|
|
115198
115524
|
var c3_default41 = config39;
|
|
115199
115525
|
|
|
115200
115526
|
// templates/svelte/workers/c3.ts
|
|
115201
115527
|
var recast11 = __toESM(require_main2());
|
|
115202
|
-
var { npm:
|
|
115528
|
+
var { npm: npm19 } = detectPackageManager();
|
|
115203
115529
|
var generate24 = async (ctx) => {
|
|
115204
115530
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
115205
115531
|
logRaw("");
|
|
@@ -115264,7 +115590,7 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
115264
115590
|
}
|
|
115265
115591
|
});
|
|
115266
115592
|
};
|
|
115267
|
-
var
|
|
115593
|
+
var typesPath3 = "./src/worker-configuration.d.ts";
|
|
115268
115594
|
var config40 = {
|
|
115269
115595
|
configVersion: 1,
|
|
115270
115596
|
id: "svelte",
|
|
@@ -115279,13 +115605,13 @@ var config40 = {
|
|
|
115279
115605
|
configure: configure14,
|
|
115280
115606
|
transformPackageJson: async (original, ctx) => {
|
|
115281
115607
|
let scripts = {
|
|
115282
|
-
preview: `${
|
|
115283
|
-
deploy: `${
|
|
115608
|
+
preview: `${npm19} run build && wrangler dev`,
|
|
115609
|
+
deploy: `${npm19} run build && wrangler deploy`
|
|
115284
115610
|
};
|
|
115285
115611
|
if (usesTypescript(ctx)) {
|
|
115286
115612
|
scripts = {
|
|
115287
115613
|
...scripts,
|
|
115288
|
-
"cf-typegen": `wrangler types ${
|
|
115614
|
+
"cf-typegen": `wrangler types ${typesPath3}`
|
|
115289
115615
|
};
|
|
115290
115616
|
}
|
|
115291
115617
|
return { scripts };
|
|
@@ -115293,7 +115619,7 @@ var config40 = {
|
|
|
115293
115619
|
devScript: "dev",
|
|
115294
115620
|
deployScript: "deploy",
|
|
115295
115621
|
previewScript: "preview",
|
|
115296
|
-
typesPath:
|
|
115622
|
+
typesPath: typesPath3
|
|
115297
115623
|
};
|
|
115298
115624
|
var c3_default42 = config40;
|
|
115299
115625
|
|
|
@@ -115305,7 +115631,7 @@ var config41 = {
|
|
|
115305
115631
|
var c3_default43 = config41;
|
|
115306
115632
|
|
|
115307
115633
|
// templates/tanstack-start/c3.ts
|
|
115308
|
-
var { npm:
|
|
115634
|
+
var { npm: npm20 } = detectPackageManager();
|
|
115309
115635
|
var generate25 = async (ctx) => {
|
|
115310
115636
|
await runFrameworkGenerator(ctx, [
|
|
115311
115637
|
// @tanstack/cli uses `create` as a subcommand
|
|
@@ -115331,8 +115657,8 @@ var config42 = {
|
|
|
115331
115657
|
generate: generate25,
|
|
115332
115658
|
transformPackageJson: async () => ({
|
|
115333
115659
|
scripts: {
|
|
115334
|
-
deploy: `${
|
|
115335
|
-
preview: `${
|
|
115660
|
+
deploy: `${npm20} run build && wrangler deploy`,
|
|
115661
|
+
preview: `${npm20} run build && vite preview`,
|
|
115336
115662
|
"cf-typegen": `wrangler types`
|
|
115337
115663
|
}
|
|
115338
115664
|
}),
|
|
@@ -115396,7 +115722,7 @@ var config44 = {
|
|
|
115396
115722
|
var experimental_c3_default2 = config44;
|
|
115397
115723
|
|
|
115398
115724
|
// templates/vue/pages/c3.ts
|
|
115399
|
-
var { npm:
|
|
115725
|
+
var { npm: npm21 } = detectPackageManager();
|
|
115400
115726
|
var generate28 = async (ctx) => {
|
|
115401
115727
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
115402
115728
|
};
|
|
@@ -115412,8 +115738,8 @@ var config45 = {
|
|
|
115412
115738
|
generate: generate28,
|
|
115413
115739
|
transformPackageJson: async () => ({
|
|
115414
115740
|
scripts: {
|
|
115415
|
-
deploy: `${
|
|
115416
|
-
preview: `${
|
|
115741
|
+
deploy: `${npm21} run build && wrangler pages deploy`,
|
|
115742
|
+
preview: `${npm21} run build && wrangler pages dev`,
|
|
115417
115743
|
"cf-typegen": `wrangler types`
|
|
115418
115744
|
}
|
|
115419
115745
|
}),
|
|
@@ -115424,7 +115750,7 @@ var config45 = {
|
|
|
115424
115750
|
var c3_default46 = config45;
|
|
115425
115751
|
|
|
115426
115752
|
// templates/vue/workers/c3.ts
|
|
115427
|
-
var { npm:
|
|
115753
|
+
var { npm: npm22 } = detectPackageManager();
|
|
115428
115754
|
var generate29 = async (ctx) => {
|
|
115429
115755
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
115430
115756
|
type: "select",
|
|
@@ -115487,8 +115813,8 @@ var config46 = {
|
|
|
115487
115813
|
generate: generate29,
|
|
115488
115814
|
transformPackageJson: async (_, ctx) => ({
|
|
115489
115815
|
scripts: {
|
|
115490
|
-
deploy: `${
|
|
115491
|
-
preview: `${
|
|
115816
|
+
deploy: `${npm22} run build && wrangler deploy`,
|
|
115817
|
+
preview: `${npm22} run build && wrangler dev`,
|
|
115492
115818
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
115493
115819
|
}
|
|
115494
115820
|
}),
|
|
@@ -115507,7 +115833,7 @@ var c3_default48 = config47;
|
|
|
115507
115833
|
|
|
115508
115834
|
// templates/waku/c3.ts
|
|
115509
115835
|
var import_node_path20 = require("node:path");
|
|
115510
|
-
var { npm:
|
|
115836
|
+
var { npm: npm23 } = detectPackageManager();
|
|
115511
115837
|
var generate30 = async (ctx) => {
|
|
115512
115838
|
await runFrameworkGenerator(ctx, [
|
|
115513
115839
|
"--project-name",
|
|
@@ -115547,8 +115873,8 @@ var config48 = {
|
|
|
115547
115873
|
configure: configure16,
|
|
115548
115874
|
transformPackageJson: async () => ({
|
|
115549
115875
|
scripts: {
|
|
115550
|
-
deploy: `${
|
|
115551
|
-
preview: `NODE_ENV=production ${
|
|
115876
|
+
deploy: `${npm23} run build && wrangler deploy`,
|
|
115877
|
+
preview: `NODE_ENV=production ${npm23} run build && wrangler dev`,
|
|
115552
115878
|
start: `wrangler dev`,
|
|
115553
115879
|
"cf-typegen": `wrangler types`
|
|
115554
115880
|
}
|
|
@@ -115560,7 +115886,7 @@ var config48 = {
|
|
|
115560
115886
|
var c3_default49 = config48;
|
|
115561
115887
|
|
|
115562
115888
|
// templates/waku/experimental-c3.ts
|
|
115563
|
-
var { npm:
|
|
115889
|
+
var { npm: npm24 } = detectPackageManager();
|
|
115564
115890
|
var generate31 = async (ctx) => {
|
|
115565
115891
|
await runFrameworkGenerator(ctx, [
|
|
115566
115892
|
"--project-name",
|
|
@@ -115632,7 +115958,7 @@ If the application uses Durable Objects or Workflows, refer to the relevant best
|
|
|
115632
115958
|
var import_node_assert6 = __toESM(require("node:assert"));
|
|
115633
115959
|
|
|
115634
115960
|
// ../wrangler/package.json
|
|
115635
|
-
var version3 = "4.
|
|
115961
|
+
var version3 = "4.124.0";
|
|
115636
115962
|
|
|
115637
115963
|
// src/git.ts
|
|
115638
115964
|
var offerGit = async (ctx) => {
|
|
@@ -115719,7 +116045,7 @@ var createCommitMessage = async (ctx) => {
|
|
|
115719
116045
|
{ key: "C3", value: `create-cloudflare@${version2}` },
|
|
115720
116046
|
{ key: "project name", value: ctx.project.name },
|
|
115721
116047
|
...framework ? [{ key: "framework", value: ctx.template.id }] : [],
|
|
115722
|
-
...framework ? [{ key: "framework cli", value: getFrameworkCli(ctx) }] : [],
|
|
116048
|
+
...framework && ctx.template.frameworkCliUsed !== false ? [{ key: "framework cli", value: getFrameworkCli(ctx) }] : [],
|
|
115723
116049
|
{
|
|
115724
116050
|
key: "package manager",
|
|
115725
116051
|
value: `${packageManager.name}@${packageManager.version}`
|
|
@@ -117040,7 +117366,7 @@ function insertJSONProperty(jsonObject, property, value) {
|
|
|
117040
117366
|
var updateWranglerConfig = async (ctx) => {
|
|
117041
117367
|
const substitutions = {
|
|
117042
117368
|
"<WORKER_NAME>": ctx.project.name,
|
|
117043
|
-
"<COMPATIBILITY_DATE>": getWorkerdCompatibilityDate(
|
|
117369
|
+
"<COMPATIBILITY_DATE>": getWorkerdCompatibilityDate()
|
|
117044
117370
|
};
|
|
117045
117371
|
if (wranglerJsonOrJsoncExists(ctx)) {
|
|
117046
117372
|
let wranglerJson = readWranglerJsonOrJsonc(ctx, (_key, value) => {
|
|
@@ -117059,8 +117385,7 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
117059
117385
|
"node_modules/wrangler/config-schema.json"
|
|
117060
117386
|
);
|
|
117061
117387
|
const compatibilityDate = await getCompatibilityDate(
|
|
117062
|
-
wranglerJson.compatibility_date
|
|
117063
|
-
ctx.project.path
|
|
117388
|
+
wranglerJson.compatibility_date
|
|
117064
117389
|
);
|
|
117065
117390
|
wranglerJson = appendJSONProperty(wranglerJson, "name", ctx.project.name);
|
|
117066
117391
|
wranglerJson = appendJSONProperty(
|
|
@@ -117089,8 +117414,7 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
117089
117414
|
}
|
|
117090
117415
|
const wranglerToml = dist_default4.parse(strToml);
|
|
117091
117416
|
const compatibilityDate = await getCompatibilityDate(
|
|
117092
|
-
wranglerToml.compatibility_date
|
|
117093
|
-
ctx.project.path
|
|
117417
|
+
wranglerToml.compatibility_date
|
|
117094
117418
|
);
|
|
117095
117419
|
wranglerToml.name = ctx.project.name;
|
|
117096
117420
|
wranglerToml.compatibility_date = compatibilityDate;
|
|
@@ -117164,11 +117488,11 @@ var addVscodeConfig = (ctx) => {
|
|
|
117164
117488
|
}
|
|
117165
117489
|
});
|
|
117166
117490
|
};
|
|
117167
|
-
async function getCompatibilityDate(tentativeDate
|
|
117491
|
+
async function getCompatibilityDate(tentativeDate) {
|
|
117168
117492
|
if (typeof tentativeDate === "string" && isCompatDate(tentativeDate)) {
|
|
117169
117493
|
return tentativeDate;
|
|
117170
117494
|
}
|
|
117171
|
-
return getWorkerdCompatibilityDate(
|
|
117495
|
+
return getWorkerdCompatibilityDate();
|
|
117172
117496
|
}
|
|
117173
117497
|
var hints = {
|
|
117174
117498
|
placement: {
|
|
@@ -117281,7 +117605,7 @@ function applyNodejsCompatFlagsToToml(wranglerConfig, compatibilityDate) {
|
|
|
117281
117605
|
|
|
117282
117606
|
// src/deploy.ts
|
|
117283
117607
|
var offerToDeploy = async (ctx) => {
|
|
117284
|
-
const { npm:
|
|
117608
|
+
const { npm: npm25 } = detectPackageManager();
|
|
117285
117609
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
117286
117610
|
if (!await isDeployable(ctx)) {
|
|
117287
117611
|
ctx.args.deploy = false;
|
|
@@ -117292,7 +117616,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
117292
117616
|
);
|
|
117293
117617
|
}
|
|
117294
117618
|
const label = `deploy via \`${quoteShellArgs([
|
|
117295
|
-
|
|
117619
|
+
npm25,
|
|
117296
117620
|
"run",
|
|
117297
117621
|
ctx.template.deployScript ?? "deploy"
|
|
117298
117622
|
])}\``;
|
|
@@ -117328,11 +117652,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
117328
117652
|
return dist_default4.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
117329
117653
|
};
|
|
117330
117654
|
var runDeploy = async (ctx) => {
|
|
117331
|
-
const { npm:
|
|
117655
|
+
const { npm: npm25, name: pm3 } = detectPackageManager();
|
|
117332
117656
|
if (!ctx.account?.id) {
|
|
117333
117657
|
throw new Error("Failed to read Cloudflare account.");
|
|
117334
117658
|
}
|
|
117335
|
-
const baseDeployCmd = [
|
|
117659
|
+
const baseDeployCmd = [npm25, "run", ctx.template.deployScript ?? "deploy"];
|
|
117336
117660
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
117337
117661
|
const deployCmd = [
|
|
117338
117662
|
...baseDeployCmd,
|
|
@@ -117448,9 +117772,9 @@ var printSummary = (ctx) => {
|
|
|
117448
117772
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}/production` : null;
|
|
117449
117773
|
const relativePath = (0, import_node_path25.relative)(ctx.originalCWD, ctx.project.path);
|
|
117450
117774
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
117451
|
-
const { npm:
|
|
117775
|
+
const { npm: npm25 } = detectPackageManager();
|
|
117452
117776
|
const deployCommand = quoteShellArgs([
|
|
117453
|
-
|
|
117777
|
+
npm25,
|
|
117454
117778
|
"run",
|
|
117455
117779
|
ctx.template.deployScript ?? "deploy"
|
|
117456
117780
|
]);
|
|
@@ -119238,16 +119562,16 @@ async function addTypes(ctx) {
|
|
|
119238
119562
|
if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
|
|
119239
119563
|
return;
|
|
119240
119564
|
}
|
|
119241
|
-
const { npm:
|
|
119565
|
+
const { npm: npm25 } = detectPackageManager();
|
|
119242
119566
|
if (ctx.template.workersTypes === "installed") {
|
|
119243
|
-
await installWorkersTypes(
|
|
119567
|
+
await installWorkersTypes(npm25);
|
|
119244
119568
|
} else if (ctx.template.workersTypes === "generated") {
|
|
119245
|
-
await generateWorkersTypes(ctx,
|
|
119569
|
+
await generateWorkersTypes(ctx, npm25);
|
|
119246
119570
|
}
|
|
119247
|
-
const usesNodeCompat = await maybeInstallNodeTypes(ctx,
|
|
119571
|
+
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm25);
|
|
119248
119572
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
119249
119573
|
}
|
|
119250
|
-
async function generateWorkersTypes(ctx,
|
|
119574
|
+
async function generateWorkersTypes(ctx, npm25) {
|
|
119251
119575
|
const packageJsonPath = (0, import_node_path26.join)(ctx.project.path, "package.json");
|
|
119252
119576
|
if (!(0, import_node_fs23.existsSync)(packageJsonPath)) {
|
|
119253
119577
|
return;
|
|
@@ -119256,7 +119580,7 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
119256
119580
|
if (!packageManifest.scripts?.["cf-typegen"]) {
|
|
119257
119581
|
return;
|
|
119258
119582
|
}
|
|
119259
|
-
const typesCmd = [
|
|
119583
|
+
const typesCmd = [npm25, "run", "cf-typegen"];
|
|
119260
119584
|
await runCommand(typesCmd, {
|
|
119261
119585
|
cwd: ctx.project.path,
|
|
119262
119586
|
silent: true,
|
|
@@ -119268,7 +119592,7 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
119268
119592
|
writeFile3(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
119269
119593
|
}
|
|
119270
119594
|
}
|
|
119271
|
-
var maybeInstallNodeTypes = async (ctx,
|
|
119595
|
+
var maybeInstallNodeTypes = async (ctx, npm25) => {
|
|
119272
119596
|
let parsedConfig = {};
|
|
119273
119597
|
if (wranglerJsonOrJsoncExists(ctx)) {
|
|
119274
119598
|
parsedConfig = readWranglerJsonOrJsonc(ctx);
|
|
@@ -119285,7 +119609,7 @@ var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
|
119285
119609
|
await installPackages2(["@types/node"], {
|
|
119286
119610
|
dev: true,
|
|
119287
119611
|
startText: "Installing @types/node",
|
|
119288
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
119612
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
119289
119613
|
});
|
|
119290
119614
|
return true;
|
|
119291
119615
|
}
|
|
@@ -119364,11 +119688,11 @@ function hasProjectReferences(config50) {
|
|
|
119364
119688
|
const tsconfig = config50;
|
|
119365
119689
|
return Array.isArray(tsconfig.references) && tsconfig.references.length > 0;
|
|
119366
119690
|
}
|
|
119367
|
-
async function installWorkersTypes(
|
|
119691
|
+
async function installWorkersTypes(npm25) {
|
|
119368
119692
|
await installPackages2(["@cloudflare/workers-types"], {
|
|
119369
119693
|
dev: true,
|
|
119370
119694
|
startText: "Installing @cloudflare/workers-types",
|
|
119371
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
119695
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
119372
119696
|
});
|
|
119373
119697
|
}
|
|
119374
119698
|
|