create-cloudflare 2.21.4 → 2.21.6
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 +72 -43
- package/package.json +6 -3
- package/templates/hello-world/js/vitest.config.js +8 -8
- package/templates/hello-world/ts/test/tsconfig.json +6 -9
- package/templates/hello-world/ts/vitest.config.ts +8 -8
- package/templates/hello-world-durable-object/c3.ts +1 -1
- package/templates/hello-world-durable-object/ts/wrangler.toml +2 -2
- package/templates/nuxt/c3.ts +5 -6
- package/templates/solid/c3.ts +7 -5
package/dist/cli.js
CHANGED
|
@@ -3902,7 +3902,7 @@ var init_args = __esm({
|
|
|
3902
3902
|
var version;
|
|
3903
3903
|
var init_package = __esm({
|
|
3904
3904
|
"package.json"() {
|
|
3905
|
-
version = "2.21.
|
|
3905
|
+
version = "2.21.6";
|
|
3906
3906
|
}
|
|
3907
3907
|
});
|
|
3908
3908
|
|
|
@@ -24720,11 +24720,11 @@ var init_package2 = __esm({
|
|
|
24720
24720
|
"create-docusaurus": "3.3.2",
|
|
24721
24721
|
"create-hono": "0.7.3",
|
|
24722
24722
|
"create-next-app": "14.1.0",
|
|
24723
|
-
"create-qwik": "1.5.
|
|
24723
|
+
"create-qwik": "1.5.5",
|
|
24724
24724
|
"create-react-app": "5.0.1",
|
|
24725
24725
|
"create-remix": "2.9.2",
|
|
24726
|
-
"create-solid": "0.5.
|
|
24727
|
-
"create-svelte": "6.
|
|
24726
|
+
"create-solid": "0.5.11",
|
|
24727
|
+
"create-svelte": "6.3.0",
|
|
24728
24728
|
"create-vue": "3.10.2",
|
|
24729
24729
|
gatsby: "5.13.5",
|
|
24730
24730
|
nuxi: "3.11.1"
|
|
@@ -24803,7 +24803,7 @@ var init_frameworks = __esm({
|
|
|
24803
24803
|
var version2;
|
|
24804
24804
|
var init_package3 = __esm({
|
|
24805
24805
|
"../wrangler/package.json"() {
|
|
24806
|
-
version2 = "3.
|
|
24806
|
+
version2 = "3.60.1";
|
|
24807
24807
|
}
|
|
24808
24808
|
});
|
|
24809
24809
|
|
|
@@ -70808,7 +70808,7 @@ var require_typescript2 = __commonJS({
|
|
|
70808
70808
|
});
|
|
70809
70809
|
|
|
70810
70810
|
// src/helpers/codemod.ts
|
|
70811
|
-
var import_fs11, import_path12, recast, esprimaParser, typescriptParser, parseFile, transformFile, loadSnippets, loadTemplateSnippets;
|
|
70811
|
+
var import_fs11, import_path12, recast, esprimaParser, typescriptParser, parseFile, transformFile, loadSnippets, loadTemplateSnippets, mergeObjectProperties, getPropertyName;
|
|
70812
70812
|
var init_codemod = __esm({
|
|
70813
70813
|
"src/helpers/codemod.ts"() {
|
|
70814
70814
|
import_fs11 = require("fs");
|
|
@@ -70860,6 +70860,33 @@ var init_codemod = __esm({
|
|
|
70860
70860
|
loadTemplateSnippets = (ctx) => {
|
|
70861
70861
|
return loadSnippets(getTemplatePath(ctx));
|
|
70862
70862
|
};
|
|
70863
|
+
mergeObjectProperties = (sourceObject, newProperties) => {
|
|
70864
|
+
newProperties.forEach((newProp) => {
|
|
70865
|
+
const newPropName = getPropertyName(newProp);
|
|
70866
|
+
if (!newPropName) {
|
|
70867
|
+
return false;
|
|
70868
|
+
}
|
|
70869
|
+
const indexOfExisting = sourceObject.properties.findIndex(
|
|
70870
|
+
(p2) => p2.type === "ObjectProperty" && getPropertyName(p2) === newPropName
|
|
70871
|
+
);
|
|
70872
|
+
const existing = sourceObject.properties[indexOfExisting];
|
|
70873
|
+
if (!existing) {
|
|
70874
|
+
sourceObject.properties.push(newProp);
|
|
70875
|
+
return;
|
|
70876
|
+
}
|
|
70877
|
+
if (existing.type === "ObjectProperty" && existing.value.type === "ObjectExpression" && newProp.value.type === "ObjectExpression") {
|
|
70878
|
+
mergeObjectProperties(
|
|
70879
|
+
existing.value,
|
|
70880
|
+
newProp.value.properties
|
|
70881
|
+
);
|
|
70882
|
+
return;
|
|
70883
|
+
}
|
|
70884
|
+
sourceObject.properties[indexOfExisting] = newProp;
|
|
70885
|
+
});
|
|
70886
|
+
};
|
|
70887
|
+
getPropertyName = (newProp) => {
|
|
70888
|
+
return newProp.key.type === "Identifier" ? newProp.key.name : newProp.key.type === "StringLiteral" ? newProp.key.value : null;
|
|
70889
|
+
};
|
|
70863
70890
|
}
|
|
70864
70891
|
});
|
|
70865
70892
|
|
|
@@ -71604,9 +71631,10 @@ var init_c38 = __esm({
|
|
|
71604
71631
|
visitCallExpression: function(n2) {
|
|
71605
71632
|
const callee = n2.node.callee;
|
|
71606
71633
|
if (callee.name === "defineNuxtConfig") {
|
|
71607
|
-
|
|
71608
|
-
|
|
71609
|
-
|
|
71634
|
+
mergeObjectProperties(
|
|
71635
|
+
n2.node.arguments[0],
|
|
71636
|
+
[presetDef, moduleDef]
|
|
71637
|
+
);
|
|
71610
71638
|
}
|
|
71611
71639
|
return this.traverse(n2);
|
|
71612
71640
|
}
|
|
@@ -71891,8 +71919,9 @@ var init_c312 = __esm({
|
|
|
71891
71919
|
return this.traverse(n2);
|
|
71892
71920
|
}
|
|
71893
71921
|
const b2 = recast6.types.builders;
|
|
71894
|
-
|
|
71895
|
-
|
|
71922
|
+
mergeObjectProperties(
|
|
71923
|
+
n2.node.arguments[0],
|
|
71924
|
+
[
|
|
71896
71925
|
b2.objectProperty(
|
|
71897
71926
|
b2.identifier("server"),
|
|
71898
71927
|
b2.objectExpression([
|
|
@@ -71911,8 +71940,8 @@ var init_c312 = __esm({
|
|
|
71911
71940
|
)
|
|
71912
71941
|
])
|
|
71913
71942
|
)
|
|
71914
|
-
]
|
|
71915
|
-
|
|
71943
|
+
]
|
|
71944
|
+
);
|
|
71916
71945
|
return false;
|
|
71917
71946
|
}
|
|
71918
71947
|
});
|
|
@@ -72139,18 +72168,18 @@ var init_c316 = __esm({
|
|
|
72139
72168
|
}
|
|
72140
72169
|
});
|
|
72141
72170
|
|
|
72142
|
-
// templates/
|
|
72171
|
+
// templates/common/c3.ts
|
|
72143
72172
|
var c3_exports17 = {};
|
|
72144
72173
|
__export(c3_exports17, {
|
|
72145
72174
|
default: () => c3_default17
|
|
72146
72175
|
});
|
|
72147
72176
|
var c3_default17;
|
|
72148
72177
|
var init_c317 = __esm({
|
|
72149
|
-
"templates/
|
|
72178
|
+
"templates/common/c3.ts"() {
|
|
72150
72179
|
c3_default17 = {
|
|
72151
72180
|
configVersion: 1,
|
|
72152
|
-
id: "
|
|
72153
|
-
displayName:
|
|
72181
|
+
id: "common",
|
|
72182
|
+
displayName: "Example router & proxy Worker",
|
|
72154
72183
|
platform: "workers",
|
|
72155
72184
|
copyFiles: {
|
|
72156
72185
|
variants: {
|
|
@@ -72166,18 +72195,18 @@ var init_c317 = __esm({
|
|
|
72166
72195
|
}
|
|
72167
72196
|
});
|
|
72168
72197
|
|
|
72169
|
-
// templates/
|
|
72198
|
+
// templates/scheduled/c3.ts
|
|
72170
72199
|
var c3_exports18 = {};
|
|
72171
72200
|
__export(c3_exports18, {
|
|
72172
72201
|
default: () => c3_default18
|
|
72173
72202
|
});
|
|
72174
72203
|
var c3_default18;
|
|
72175
72204
|
var init_c318 = __esm({
|
|
72176
|
-
"templates/
|
|
72205
|
+
"templates/scheduled/c3.ts"() {
|
|
72177
72206
|
c3_default18 = {
|
|
72178
72207
|
configVersion: 1,
|
|
72179
|
-
id: "
|
|
72180
|
-
displayName: "
|
|
72208
|
+
id: "scheduled",
|
|
72209
|
+
displayName: "Scheduled Worker (Cron Trigger)",
|
|
72181
72210
|
platform: "workers",
|
|
72182
72211
|
copyFiles: {
|
|
72183
72212
|
variants: {
|
|
@@ -72193,18 +72222,18 @@ var init_c318 = __esm({
|
|
|
72193
72222
|
}
|
|
72194
72223
|
});
|
|
72195
72224
|
|
|
72196
|
-
// templates/
|
|
72225
|
+
// templates/queues/c3.ts
|
|
72197
72226
|
var c3_exports19 = {};
|
|
72198
72227
|
__export(c3_exports19, {
|
|
72199
72228
|
default: () => c3_default19
|
|
72200
72229
|
});
|
|
72201
72230
|
var c3_default19;
|
|
72202
72231
|
var init_c319 = __esm({
|
|
72203
|
-
"templates/
|
|
72232
|
+
"templates/queues/c3.ts"() {
|
|
72204
72233
|
c3_default19 = {
|
|
72205
72234
|
configVersion: 1,
|
|
72206
|
-
id: "
|
|
72207
|
-
displayName: "
|
|
72235
|
+
id: "queues",
|
|
72236
|
+
displayName: "Queue consumer & producer Worker",
|
|
72208
72237
|
platform: "workers",
|
|
72209
72238
|
copyFiles: {
|
|
72210
72239
|
variants: {
|
|
@@ -72215,23 +72244,33 @@ var init_c319 = __esm({
|
|
|
72215
72244
|
path: "./ts"
|
|
72216
72245
|
}
|
|
72217
72246
|
}
|
|
72247
|
+
},
|
|
72248
|
+
bindings: {
|
|
72249
|
+
queues: [
|
|
72250
|
+
{
|
|
72251
|
+
boundVariable: "MY_QUEUE",
|
|
72252
|
+
defaultValue: "my-queue",
|
|
72253
|
+
producer: true,
|
|
72254
|
+
consumer: true
|
|
72255
|
+
}
|
|
72256
|
+
]
|
|
72218
72257
|
}
|
|
72219
72258
|
};
|
|
72220
72259
|
}
|
|
72221
72260
|
});
|
|
72222
72261
|
|
|
72223
|
-
// templates/
|
|
72262
|
+
// templates/hello-world-durable-object/c3.ts
|
|
72224
72263
|
var c3_exports20 = {};
|
|
72225
72264
|
__export(c3_exports20, {
|
|
72226
72265
|
default: () => c3_default20
|
|
72227
72266
|
});
|
|
72228
72267
|
var c3_default20;
|
|
72229
72268
|
var init_c320 = __esm({
|
|
72230
|
-
"templates/
|
|
72269
|
+
"templates/hello-world-durable-object/c3.ts"() {
|
|
72231
72270
|
c3_default20 = {
|
|
72232
72271
|
configVersion: 1,
|
|
72233
|
-
id: "
|
|
72234
|
-
displayName: "
|
|
72272
|
+
id: "hello-world-durable-object",
|
|
72273
|
+
displayName: "Co-ordination / multiplayer API (using Durable Objects)",
|
|
72235
72274
|
platform: "workers",
|
|
72236
72275
|
copyFiles: {
|
|
72237
72276
|
variants: {
|
|
@@ -72242,16 +72281,6 @@ var init_c320 = __esm({
|
|
|
72242
72281
|
path: "./ts"
|
|
72243
72282
|
}
|
|
72244
72283
|
}
|
|
72245
|
-
},
|
|
72246
|
-
bindings: {
|
|
72247
|
-
queues: [
|
|
72248
|
-
{
|
|
72249
|
-
boundVariable: "MY_QUEUE",
|
|
72250
|
-
defaultValue: "my-queue",
|
|
72251
|
-
producer: true,
|
|
72252
|
-
consumer: true
|
|
72253
|
-
}
|
|
72254
|
-
]
|
|
72255
72284
|
}
|
|
72256
72285
|
};
|
|
72257
72286
|
}
|
|
@@ -72424,12 +72453,12 @@ var init_templates = __esm({
|
|
|
72424
72453
|
return {
|
|
72425
72454
|
"hello-world": (await Promise.resolve().then(() => (init_c315(), c3_exports15))).default,
|
|
72426
72455
|
"hello-world-python": (await Promise.resolve().then(() => (init_c316(), c3_exports16))).default,
|
|
72427
|
-
"hello-world-durable-object": (await Promise.resolve().then(() => (init_c317(), c3_exports17))).default,
|
|
72428
72456
|
// Dummy record -- actual template config resolved in `selectFramework`
|
|
72429
72457
|
"web-framework": { displayName: "Website or web app" },
|
|
72430
|
-
common: (await Promise.resolve().then(() => (
|
|
72431
|
-
scheduled: (await Promise.resolve().then(() => (
|
|
72432
|
-
queues: (await Promise.resolve().then(() => (
|
|
72458
|
+
common: (await Promise.resolve().then(() => (init_c317(), c3_exports17))).default,
|
|
72459
|
+
scheduled: (await Promise.resolve().then(() => (init_c318(), c3_exports18))).default,
|
|
72460
|
+
queues: (await Promise.resolve().then(() => (init_c319(), c3_exports19))).default,
|
|
72461
|
+
"hello-world-durable-object": (await Promise.resolve().then(() => (init_c320(), c3_exports20))).default,
|
|
72433
72462
|
openapi: (await Promise.resolve().then(() => (init_c321(), c3_exports21))).default,
|
|
72434
72463
|
// Dummy record -- actual template config resolved in `processRemoteTemplate`
|
|
72435
72464
|
"remote-template": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.6",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/parser": "^7.21.3",
|
|
30
30
|
"@babel/types": "^7.21.4",
|
|
31
31
|
"@clack/prompts": "^0.6.3",
|
|
32
|
-
"@cloudflare/workers-types": "^4.
|
|
32
|
+
"@cloudflare/workers-types": "^4.20240605.0",
|
|
33
33
|
"@iarna/toml": "^3.0.0",
|
|
34
34
|
"@types/command-exists": "^1.2.0",
|
|
35
35
|
"@types/cross-spawn": "^6.0.2",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@cloudflare/cli": "1.1.1",
|
|
68
68
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
69
69
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
70
|
-
"wrangler": "3.
|
|
70
|
+
"wrangler": "3.60.1"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=18.14.1"
|
|
@@ -75,6 +75,9 @@
|
|
|
75
75
|
"workers-sdk": {
|
|
76
76
|
"prerelease": true
|
|
77
77
|
},
|
|
78
|
+
"volta": {
|
|
79
|
+
"extends": "../../package.json"
|
|
80
|
+
},
|
|
78
81
|
"scripts": {
|
|
79
82
|
"build": "node -r esbuild-register scripts/build.ts",
|
|
80
83
|
"dev:codemod": "node -r esbuild-register scripts/codemodDev.ts",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineWorkersConfig } from
|
|
1
|
+
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config';
|
|
2
2
|
|
|
3
3
|
export default defineWorkersConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
test: {
|
|
5
|
+
poolOptions: {
|
|
6
|
+
workers: {
|
|
7
|
+
wrangler: { configPath: './wrangler.toml' },
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
11
|
});
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
"include": ["./**/*.ts", "../src/env.d.ts"],
|
|
10
|
-
"exclude": []
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"types": ["@cloudflare/workers-types/experimental", "@cloudflare/vitest-pool-workers"]
|
|
5
|
+
},
|
|
6
|
+
"include": ["./**/*.ts", "../src/env.d.ts"],
|
|
7
|
+
"exclude": []
|
|
11
8
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineWorkersConfig } from
|
|
1
|
+
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config';
|
|
2
2
|
|
|
3
3
|
export default defineWorkersConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
test: {
|
|
5
|
+
poolOptions: {
|
|
6
|
+
workers: {
|
|
7
|
+
wrangler: { configPath: './wrangler.toml' },
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
11
|
});
|
|
@@ -48,13 +48,13 @@ compatibility_date = "<TBD>"
|
|
|
48
48
|
|
|
49
49
|
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
50
50
|
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
51
|
-
# Docs: https://developers.cloudflare.com/workers/
|
|
51
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
52
52
|
[[durable_objects.bindings]]
|
|
53
53
|
name = "MY_DURABLE_OBJECT"
|
|
54
54
|
class_name = "MyDurableObject"
|
|
55
55
|
|
|
56
56
|
# Durable Object migrations.
|
|
57
|
-
# Docs: https://developers.cloudflare.com/workers/
|
|
57
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
|
|
58
58
|
[[migrations]]
|
|
59
59
|
tag = "v1"
|
|
60
60
|
new_classes = ["MyDurableObject"]
|
package/templates/nuxt/c3.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { logRaw } from "@cloudflare/cli";
|
|
|
2
2
|
import { brandColor, dim } from "@cloudflare/cli/colors";
|
|
3
3
|
import { spinner } from "@cloudflare/cli/interactive";
|
|
4
4
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
5
|
-
import { transformFile } from "helpers/codemod";
|
|
5
|
+
import { mergeObjectProperties, transformFile } from "helpers/codemod";
|
|
6
6
|
import { getLatestTypesEntrypoint } from "helpers/compatDate";
|
|
7
7
|
import { readFile, writeFile } from "helpers/files";
|
|
8
8
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
@@ -96,11 +96,10 @@ const updateNuxtConfig = () => {
|
|
|
96
96
|
visitCallExpression: function (n) {
|
|
97
97
|
const callee = n.node.callee as recast.types.namedTypes.Identifier;
|
|
98
98
|
if (callee.name === "defineNuxtConfig") {
|
|
99
|
-
|
|
100
|
-
.arguments[0] as recast.types.namedTypes.ObjectExpression
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
obj.properties.push(moduleDef);
|
|
99
|
+
mergeObjectProperties(
|
|
100
|
+
n.node.arguments[0] as recast.types.namedTypes.ObjectExpression,
|
|
101
|
+
[presetDef, moduleDef],
|
|
102
|
+
);
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
return this.traverse(n);
|
package/templates/solid/c3.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
2
2
|
import { blue } from "@cloudflare/cli/colors";
|
|
3
3
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
4
|
-
import { transformFile } from "helpers/codemod";
|
|
4
|
+
import { mergeObjectProperties, transformFile } from "helpers/codemod";
|
|
5
5
|
import { usesTypescript } from "helpers/files";
|
|
6
6
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
7
7
|
import * as recast from "recast";
|
|
@@ -32,8 +32,10 @@ const configure = async (ctx: C3Context) => {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const b = recast.types.builders;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
mergeObjectProperties(
|
|
37
|
+
n.node.arguments[0] as recast.types.namedTypes.ObjectExpression,
|
|
38
|
+
[
|
|
37
39
|
b.objectProperty(
|
|
38
40
|
b.identifier("server"),
|
|
39
41
|
b.objectExpression([
|
|
@@ -52,8 +54,8 @@ const configure = async (ctx: C3Context) => {
|
|
|
52
54
|
),
|
|
53
55
|
]),
|
|
54
56
|
),
|
|
55
|
-
]
|
|
56
|
-
|
|
57
|
+
],
|
|
58
|
+
);
|
|
57
59
|
|
|
58
60
|
return false;
|
|
59
61
|
},
|