create-cloudflare 2.0.5 → 2.0.7

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.
Files changed (43) hide show
  1. package/dist/angular/templates/src/_routes.json +5 -0
  2. package/dist/angular/templates/src/main.server.ts +35 -0
  3. package/dist/angular/templates/tools/bundle.mjs +74 -0
  4. package/dist/angular/templates/tools/copy-client-files.mjs +4 -0
  5. package/dist/angular/templates/tools/copy-worker-files.mjs +10 -0
  6. package/dist/angular/templates/tools/paths.mjs +9 -0
  7. package/dist/angular/templates/tsconfig.server.json +5 -0
  8. package/dist/cli.js +501 -4
  9. package/dist/tsconfig.tsbuildinfo +1 -0
  10. package/package.json +5 -4
  11. package/templates/chatgptPlugin/ts/.assets/example.png +0 -0
  12. package/templates/chatgptPlugin/ts/README.md +25 -0
  13. package/templates/chatgptPlugin/ts/package.json +16 -0
  14. package/templates/chatgptPlugin/ts/src/index.ts +33 -0
  15. package/templates/chatgptPlugin/ts/src/search.ts +63 -0
  16. package/templates/chatgptPlugin/ts/wrangler.toml +3 -0
  17. package/templates/common/js/.prettierrc +5 -0
  18. package/templates/common/js/package.json +14 -0
  19. package/templates/common/js/src/ab-test.js +41 -0
  20. package/templates/common/js/src/proxy.js +23 -0
  21. package/templates/common/js/src/redirect.js +13 -0
  22. package/templates/common/js/src/router.js +22 -0
  23. package/templates/common/js/src/worker.js +46 -0
  24. package/templates/common/js/wrangler.toml +40 -0
  25. package/templates/common/ts/.prettierrc +5 -0
  26. package/templates/common/ts/package.json +15 -0
  27. package/templates/common/ts/src/ab-test.ts +41 -0
  28. package/templates/common/ts/src/proxy.ts +23 -0
  29. package/templates/common/ts/src/redirect.ts +13 -0
  30. package/templates/common/ts/src/router.ts +22 -0
  31. package/templates/common/ts/src/worker.ts +46 -0
  32. package/templates/common/ts/tsconfig.json +101 -0
  33. package/templates/common/ts/worker-configuration.d.ts +16 -0
  34. package/templates/common/ts/wrangler.toml +40 -0
  35. package/templates/simple/js/.prettierrc +5 -0
  36. package/templates/simple/js/package.json +14 -0
  37. package/templates/simple/js/src/worker.js +15 -0
  38. package/templates/simple/js/wrangler.toml +40 -0
  39. package/templates/simple/ts/.prettierrc +5 -0
  40. package/templates/simple/ts/package.json +14 -0
  41. package/templates/simple/ts/src/worker.ts +32 -0
  42. package/templates/simple/ts/tsconfig.json +101 -0
  43. package/templates/simple/ts/wrangler.toml +40 -0
@@ -0,0 +1,5 @@
1
+ {
2
+ "version": 1,
3
+ "include": ["/*"],
4
+ "exclude": ["/*.*"]
5
+ }
@@ -0,0 +1,35 @@
1
+ import "zone.js/dist/zone-node";
2
+ import "@angular/platform-server/init";
3
+
4
+ import { bootstrapApplication } from "@angular/platform-browser";
5
+ import { renderApplication } from "@angular/platform-server";
6
+
7
+ import { AppComponent } from "./app/app.component";
8
+ import { config } from "./app/app.config.server";
9
+
10
+ interface Env {
11
+ ASSETS: { fetch: typeof fetch };
12
+ }
13
+
14
+ // We attach the Cloudflare `fetch()` handler to the global scope
15
+ // so that we can export it when we process the Angular output.
16
+ // See tools/bundle.mjs
17
+ (globalThis as any).__workerFetchHandler = async function fetch(
18
+ request: Request,
19
+ env: Env
20
+ ) {
21
+ const url = new URL(request.url);
22
+ console.log("render SSR", url.href);
23
+
24
+ // Get the root `index.html` content.
25
+ const indexUrl = new URL("/", url);
26
+ const indexResponse = await env.ASSETS.fetch(new Request(indexUrl));
27
+ const document = await indexResponse.text();
28
+
29
+ const content = await renderApplication(
30
+ () => bootstrapApplication(AppComponent, config),
31
+ { document, url: url.pathname }
32
+ );
33
+ // console.log("rendered SSR", content);
34
+ return new Response(content, indexResponse);
35
+ };
@@ -0,0 +1,74 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { worker as workerPath } from "./paths.mjs";
4
+ import * as esbuild from "esbuild";
5
+ import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
6
+ import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill";
7
+ import fg from "fast-glob";
8
+
9
+ // Process each of the JS files in the `_worker.js` directory
10
+ for (const entry of await fg("**/*.js", { cwd: workerPath, onlyFiles: true })) {
11
+ if (entry === "index.js") {
12
+ // This is the main bundle and gets special treatment
13
+ await bundleMain();
14
+ } else {
15
+ await bundleLazyModule(entry);
16
+ }
17
+ }
18
+
19
+ // Use esbuild to process the main entry-point.
20
+ // - shim Node.js APIs
21
+ // - convert `global` to `globalThis`
22
+ // - convert dynamic `require()` calls to `await import()` calls
23
+ // - ensure that the Cloudflare `fetch()` handler is exported
24
+ async function bundleMain() {
25
+ const result = await esbuild.build({
26
+ entryPoints: ["index.js"],
27
+ bundle: true,
28
+ format: "iife",
29
+ write: false,
30
+ absWorkingDir: workerPath,
31
+ define: {
32
+ global: "globalThis",
33
+ },
34
+ plugins: [
35
+ NodeGlobalsPolyfillPlugin({ buffer: true }),
36
+ NodeModulesPolyfillPlugin(),
37
+ ],
38
+ });
39
+
40
+ let main = result.outputFiles[0].text;
41
+
42
+ // Patch any dynamic imports (converting `require()` calls to `import()` calls).
43
+ main = main.replace(
44
+ 'installChunk(__require("./" + __webpack_require__.u(chunkId))',
45
+ 'promises.push(import("./" + __webpack_require__.u(chunkId)).then((mod) => installChunk(mod.default))'
46
+ );
47
+ // Export the fetch handler (grabbing it from the global).
48
+ main += "\nexport default { fetch : globalThis.__workerFetchHandler };";
49
+
50
+ await fs.writeFile(path.resolve(workerPath, "index.js"), main);
51
+ }
52
+
53
+ // Use esbuild to process the lazy load modules
54
+ // In particular we need to convert the CommonJS export syntax to ESM.
55
+ async function bundleLazyModule(filePath) {
56
+ const result = await esbuild.build({
57
+ entryPoints: [filePath],
58
+ bundle: true,
59
+ format: "cjs",
60
+ write: false,
61
+ absWorkingDir: workerPath,
62
+ define: {
63
+ global: "globalThis",
64
+ },
65
+ plugins: [NodeModulesPolyfillPlugin()],
66
+ });
67
+
68
+ let content = result.outputFiles[0].text;
69
+
70
+ // Export the fetch handler (grabbing it from the global).
71
+ content = "const exports = {};\n" + content + "\nexport default exports";
72
+
73
+ await fs.writeFile(path.resolve(workerPath, filePath), content);
74
+ }
@@ -0,0 +1,4 @@
1
+ // Copy the client-side files over so that they can be uploaded by the pages publish command.
2
+ import fs from "node:fs";
3
+ import { client, cloudflare } from "./paths.mjs";
4
+ fs.cpSync(client, cloudflare, { recursive: true });
@@ -0,0 +1,10 @@
1
+ // Copy the lazy loaded modules into the dist folder so that they can be
2
+ // uploaded along with the main Worker module.
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { ssr, worker } from "./paths.mjs";
6
+ fs.cpSync(ssr, worker, { recursive: true });
7
+ fs.renameSync(
8
+ path.resolve(worker, "main.js"),
9
+ path.resolve(worker, "index.js")
10
+ );
@@ -0,0 +1,9 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
5
+ export const root = path.resolve(dirname, "..");
6
+ export const client = path.resolve(root, "dist/browser");
7
+ export const ssr = path.resolve(root, "dist/server");
8
+ export const cloudflare = path.resolve(root, "dist/cloudflare");
9
+ export const worker = path.resolve(cloudflare, "_worker.js");
@@ -0,0 +1,5 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.app.json",
4
+ "files": ["./src/main.server.ts"]
5
+ }
package/dist/cli.js CHANGED
@@ -938,6 +938,503 @@ var require_emoji_regex = __commonJS({
938
938
  }
939
939
  });
940
940
 
941
+ // ../../node_modules/isexe/windows.js
942
+ var require_windows = __commonJS({
943
+ "../../node_modules/isexe/windows.js"(exports, module2) {
944
+ module2.exports = isexe;
945
+ isexe.sync = sync;
946
+ var fs2 = require("fs");
947
+ function checkPathExt(path3, options) {
948
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
949
+ if (!pathext) {
950
+ return true;
951
+ }
952
+ pathext = pathext.split(";");
953
+ if (pathext.indexOf("") !== -1) {
954
+ return true;
955
+ }
956
+ for (var i = 0; i < pathext.length; i++) {
957
+ var p3 = pathext[i].toLowerCase();
958
+ if (p3 && path3.substr(-p3.length).toLowerCase() === p3) {
959
+ return true;
960
+ }
961
+ }
962
+ return false;
963
+ }
964
+ function checkStat(stat, path3, options) {
965
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
966
+ return false;
967
+ }
968
+ return checkPathExt(path3, options);
969
+ }
970
+ function isexe(path3, options, cb) {
971
+ fs2.stat(path3, function(er, stat) {
972
+ cb(er, er ? false : checkStat(stat, path3, options));
973
+ });
974
+ }
975
+ function sync(path3, options) {
976
+ return checkStat(fs2.statSync(path3), path3, options);
977
+ }
978
+ }
979
+ });
980
+
981
+ // ../../node_modules/isexe/mode.js
982
+ var require_mode = __commonJS({
983
+ "../../node_modules/isexe/mode.js"(exports, module2) {
984
+ module2.exports = isexe;
985
+ isexe.sync = sync;
986
+ var fs2 = require("fs");
987
+ function isexe(path3, options, cb) {
988
+ fs2.stat(path3, function(er, stat) {
989
+ cb(er, er ? false : checkStat(stat, options));
990
+ });
991
+ }
992
+ function sync(path3, options) {
993
+ return checkStat(fs2.statSync(path3), options);
994
+ }
995
+ function checkStat(stat, options) {
996
+ return stat.isFile() && checkMode(stat, options);
997
+ }
998
+ function checkMode(stat, options) {
999
+ var mod = stat.mode;
1000
+ var uid = stat.uid;
1001
+ var gid = stat.gid;
1002
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
1003
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
1004
+ var u2 = parseInt("100", 8);
1005
+ var g2 = parseInt("010", 8);
1006
+ var o2 = parseInt("001", 8);
1007
+ var ug = u2 | g2;
1008
+ var ret = mod & o2 || mod & g2 && gid === myGid || mod & u2 && uid === myUid || mod & ug && myUid === 0;
1009
+ return ret;
1010
+ }
1011
+ }
1012
+ });
1013
+
1014
+ // ../../node_modules/isexe/index.js
1015
+ var require_isexe = __commonJS({
1016
+ "../../node_modules/isexe/index.js"(exports, module2) {
1017
+ var fs2 = require("fs");
1018
+ var core;
1019
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
1020
+ core = require_windows();
1021
+ } else {
1022
+ core = require_mode();
1023
+ }
1024
+ module2.exports = isexe;
1025
+ isexe.sync = sync;
1026
+ function isexe(path3, options, cb) {
1027
+ if (typeof options === "function") {
1028
+ cb = options;
1029
+ options = {};
1030
+ }
1031
+ if (!cb) {
1032
+ if (typeof Promise !== "function") {
1033
+ throw new TypeError("callback not provided");
1034
+ }
1035
+ return new Promise(function(resolve10, reject) {
1036
+ isexe(path3, options || {}, function(er, is) {
1037
+ if (er) {
1038
+ reject(er);
1039
+ } else {
1040
+ resolve10(is);
1041
+ }
1042
+ });
1043
+ });
1044
+ }
1045
+ core(path3, options || {}, function(er, is) {
1046
+ if (er) {
1047
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
1048
+ er = null;
1049
+ is = false;
1050
+ }
1051
+ }
1052
+ cb(er, is);
1053
+ });
1054
+ }
1055
+ function sync(path3, options) {
1056
+ try {
1057
+ return core.sync(path3, options || {});
1058
+ } catch (er) {
1059
+ if (options && options.ignoreErrors || er.code === "EACCES") {
1060
+ return false;
1061
+ } else {
1062
+ throw er;
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1067
+ });
1068
+
1069
+ // ../../node_modules/which/which.js
1070
+ var require_which = __commonJS({
1071
+ "../../node_modules/which/which.js"(exports, module2) {
1072
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
1073
+ var path3 = require("path");
1074
+ var COLON = isWindows ? ";" : ":";
1075
+ var isexe = require_isexe();
1076
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
1077
+ var getPathInfo = (cmd, opt) => {
1078
+ const colon = opt.colon || COLON;
1079
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
1080
+ // windows always checks the cwd first
1081
+ ...isWindows ? [process.cwd()] : [],
1082
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
1083
+ "").split(colon)
1084
+ ];
1085
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
1086
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
1087
+ if (isWindows) {
1088
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
1089
+ pathExt.unshift("");
1090
+ }
1091
+ return {
1092
+ pathEnv,
1093
+ pathExt,
1094
+ pathExtExe
1095
+ };
1096
+ };
1097
+ var which = (cmd, opt, cb) => {
1098
+ if (typeof opt === "function") {
1099
+ cb = opt;
1100
+ opt = {};
1101
+ }
1102
+ if (!opt)
1103
+ opt = {};
1104
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
1105
+ const found = [];
1106
+ const step = (i) => new Promise((resolve10, reject) => {
1107
+ if (i === pathEnv.length)
1108
+ return opt.all && found.length ? resolve10(found) : reject(getNotFoundError(cmd));
1109
+ const ppRaw = pathEnv[i];
1110
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1111
+ const pCmd = path3.join(pathPart, cmd);
1112
+ const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1113
+ resolve10(subStep(p3, i, 0));
1114
+ });
1115
+ const subStep = (p3, i, ii) => new Promise((resolve10, reject) => {
1116
+ if (ii === pathExt.length)
1117
+ return resolve10(step(i + 1));
1118
+ const ext = pathExt[ii];
1119
+ isexe(p3 + ext, { pathExt: pathExtExe }, (er, is) => {
1120
+ if (!er && is) {
1121
+ if (opt.all)
1122
+ found.push(p3 + ext);
1123
+ else
1124
+ return resolve10(p3 + ext);
1125
+ }
1126
+ return resolve10(subStep(p3, i, ii + 1));
1127
+ });
1128
+ });
1129
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
1130
+ };
1131
+ var whichSync = (cmd, opt) => {
1132
+ opt = opt || {};
1133
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
1134
+ const found = [];
1135
+ for (let i = 0; i < pathEnv.length; i++) {
1136
+ const ppRaw = pathEnv[i];
1137
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1138
+ const pCmd = path3.join(pathPart, cmd);
1139
+ const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1140
+ for (let j2 = 0; j2 < pathExt.length; j2++) {
1141
+ const cur = p3 + pathExt[j2];
1142
+ try {
1143
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
1144
+ if (is) {
1145
+ if (opt.all)
1146
+ found.push(cur);
1147
+ else
1148
+ return cur;
1149
+ }
1150
+ } catch (ex) {
1151
+ }
1152
+ }
1153
+ }
1154
+ if (opt.all && found.length)
1155
+ return found;
1156
+ if (opt.nothrow)
1157
+ return null;
1158
+ throw getNotFoundError(cmd);
1159
+ };
1160
+ module2.exports = which;
1161
+ which.sync = whichSync;
1162
+ }
1163
+ });
1164
+
1165
+ // ../../node_modules/path-key/index.js
1166
+ var require_path_key = __commonJS({
1167
+ "../../node_modules/path-key/index.js"(exports, module2) {
1168
+ "use strict";
1169
+ var pathKey = (options = {}) => {
1170
+ const environment = options.env || process.env;
1171
+ const platform = options.platform || process.platform;
1172
+ if (platform !== "win32") {
1173
+ return "PATH";
1174
+ }
1175
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
1176
+ };
1177
+ module2.exports = pathKey;
1178
+ module2.exports.default = pathKey;
1179
+ }
1180
+ });
1181
+
1182
+ // ../../node_modules/cross-spawn/lib/util/resolveCommand.js
1183
+ var require_resolveCommand = __commonJS({
1184
+ "../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
1185
+ "use strict";
1186
+ var path3 = require("path");
1187
+ var which = require_which();
1188
+ var getPathKey = require_path_key();
1189
+ function resolveCommandAttempt(parsed, withoutPathExt) {
1190
+ const env3 = parsed.options.env || process.env;
1191
+ const cwd = process.cwd();
1192
+ const hasCustomCwd = parsed.options.cwd != null;
1193
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
1194
+ if (shouldSwitchCwd) {
1195
+ try {
1196
+ process.chdir(parsed.options.cwd);
1197
+ } catch (err) {
1198
+ }
1199
+ }
1200
+ let resolved;
1201
+ try {
1202
+ resolved = which.sync(parsed.command, {
1203
+ path: env3[getPathKey({ env: env3 })],
1204
+ pathExt: withoutPathExt ? path3.delimiter : void 0
1205
+ });
1206
+ } catch (e) {
1207
+ } finally {
1208
+ if (shouldSwitchCwd) {
1209
+ process.chdir(cwd);
1210
+ }
1211
+ }
1212
+ if (resolved) {
1213
+ resolved = path3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
1214
+ }
1215
+ return resolved;
1216
+ }
1217
+ function resolveCommand(parsed) {
1218
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
1219
+ }
1220
+ module2.exports = resolveCommand;
1221
+ }
1222
+ });
1223
+
1224
+ // ../../node_modules/cross-spawn/lib/util/escape.js
1225
+ var require_escape = __commonJS({
1226
+ "../../node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
1227
+ "use strict";
1228
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
1229
+ function escapeCommand(arg) {
1230
+ arg = arg.replace(metaCharsRegExp, "^$1");
1231
+ return arg;
1232
+ }
1233
+ function escapeArgument(arg, doubleEscapeMetaChars) {
1234
+ arg = `${arg}`;
1235
+ arg = arg.replace(/(\\*)"/g, '$1$1\\"');
1236
+ arg = arg.replace(/(\\*)$/, "$1$1");
1237
+ arg = `"${arg}"`;
1238
+ arg = arg.replace(metaCharsRegExp, "^$1");
1239
+ if (doubleEscapeMetaChars) {
1240
+ arg = arg.replace(metaCharsRegExp, "^$1");
1241
+ }
1242
+ return arg;
1243
+ }
1244
+ module2.exports.command = escapeCommand;
1245
+ module2.exports.argument = escapeArgument;
1246
+ }
1247
+ });
1248
+
1249
+ // ../../node_modules/shebang-regex/index.js
1250
+ var require_shebang_regex = __commonJS({
1251
+ "../../node_modules/shebang-regex/index.js"(exports, module2) {
1252
+ "use strict";
1253
+ module2.exports = /^#!(.*)/;
1254
+ }
1255
+ });
1256
+
1257
+ // ../../node_modules/shebang-command/index.js
1258
+ var require_shebang_command = __commonJS({
1259
+ "../../node_modules/shebang-command/index.js"(exports, module2) {
1260
+ "use strict";
1261
+ var shebangRegex = require_shebang_regex();
1262
+ module2.exports = (string = "") => {
1263
+ const match = string.match(shebangRegex);
1264
+ if (!match) {
1265
+ return null;
1266
+ }
1267
+ const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
1268
+ const binary = path3.split("/").pop();
1269
+ if (binary === "env") {
1270
+ return argument;
1271
+ }
1272
+ return argument ? `${binary} ${argument}` : binary;
1273
+ };
1274
+ }
1275
+ });
1276
+
1277
+ // ../../node_modules/cross-spawn/lib/util/readShebang.js
1278
+ var require_readShebang = __commonJS({
1279
+ "../../node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
1280
+ "use strict";
1281
+ var fs2 = require("fs");
1282
+ var shebangCommand = require_shebang_command();
1283
+ function readShebang(command2) {
1284
+ const size = 150;
1285
+ const buffer = Buffer.alloc(size);
1286
+ let fd;
1287
+ try {
1288
+ fd = fs2.openSync(command2, "r");
1289
+ fs2.readSync(fd, buffer, 0, size, 0);
1290
+ fs2.closeSync(fd);
1291
+ } catch (e) {
1292
+ }
1293
+ return shebangCommand(buffer.toString());
1294
+ }
1295
+ module2.exports = readShebang;
1296
+ }
1297
+ });
1298
+
1299
+ // ../../node_modules/cross-spawn/lib/parse.js
1300
+ var require_parse = __commonJS({
1301
+ "../../node_modules/cross-spawn/lib/parse.js"(exports, module2) {
1302
+ "use strict";
1303
+ var path3 = require("path");
1304
+ var resolveCommand = require_resolveCommand();
1305
+ var escape = require_escape();
1306
+ var readShebang = require_readShebang();
1307
+ var isWin = process.platform === "win32";
1308
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
1309
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
1310
+ function detectShebang(parsed) {
1311
+ parsed.file = resolveCommand(parsed);
1312
+ const shebang = parsed.file && readShebang(parsed.file);
1313
+ if (shebang) {
1314
+ parsed.args.unshift(parsed.file);
1315
+ parsed.command = shebang;
1316
+ return resolveCommand(parsed);
1317
+ }
1318
+ return parsed.file;
1319
+ }
1320
+ function parseNonShell(parsed) {
1321
+ if (!isWin) {
1322
+ return parsed;
1323
+ }
1324
+ const commandFile = detectShebang(parsed);
1325
+ const needsShell = !isExecutableRegExp.test(commandFile);
1326
+ if (parsed.options.forceShell || needsShell) {
1327
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
1328
+ parsed.command = path3.normalize(parsed.command);
1329
+ parsed.command = escape.command(parsed.command);
1330
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
1331
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
1332
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
1333
+ parsed.command = process.env.comspec || "cmd.exe";
1334
+ parsed.options.windowsVerbatimArguments = true;
1335
+ }
1336
+ return parsed;
1337
+ }
1338
+ function parse2(command2, args, options) {
1339
+ if (args && !Array.isArray(args)) {
1340
+ options = args;
1341
+ args = null;
1342
+ }
1343
+ args = args ? args.slice(0) : [];
1344
+ options = Object.assign({}, options);
1345
+ const parsed = {
1346
+ command: command2,
1347
+ args,
1348
+ options,
1349
+ file: void 0,
1350
+ original: {
1351
+ command: command2,
1352
+ args
1353
+ }
1354
+ };
1355
+ return options.shell ? parsed : parseNonShell(parsed);
1356
+ }
1357
+ module2.exports = parse2;
1358
+ }
1359
+ });
1360
+
1361
+ // ../../node_modules/cross-spawn/lib/enoent.js
1362
+ var require_enoent = __commonJS({
1363
+ "../../node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
1364
+ "use strict";
1365
+ var isWin = process.platform === "win32";
1366
+ function notFoundError(original, syscall) {
1367
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
1368
+ code: "ENOENT",
1369
+ errno: "ENOENT",
1370
+ syscall: `${syscall} ${original.command}`,
1371
+ path: original.command,
1372
+ spawnargs: original.args
1373
+ });
1374
+ }
1375
+ function hookChildProcess(cp3, parsed) {
1376
+ if (!isWin) {
1377
+ return;
1378
+ }
1379
+ const originalEmit = cp3.emit;
1380
+ cp3.emit = function(name, arg1) {
1381
+ if (name === "exit") {
1382
+ const err = verifyENOENT(arg1, parsed, "spawn");
1383
+ if (err) {
1384
+ return originalEmit.call(cp3, "error", err);
1385
+ }
1386
+ }
1387
+ return originalEmit.apply(cp3, arguments);
1388
+ };
1389
+ }
1390
+ function verifyENOENT(status2, parsed) {
1391
+ if (isWin && status2 === 1 && !parsed.file) {
1392
+ return notFoundError(parsed.original, "spawn");
1393
+ }
1394
+ return null;
1395
+ }
1396
+ function verifyENOENTSync(status2, parsed) {
1397
+ if (isWin && status2 === 1 && !parsed.file) {
1398
+ return notFoundError(parsed.original, "spawnSync");
1399
+ }
1400
+ return null;
1401
+ }
1402
+ module2.exports = {
1403
+ hookChildProcess,
1404
+ verifyENOENT,
1405
+ verifyENOENTSync,
1406
+ notFoundError
1407
+ };
1408
+ }
1409
+ });
1410
+
1411
+ // ../../node_modules/cross-spawn/index.js
1412
+ var require_cross_spawn = __commonJS({
1413
+ "../../node_modules/cross-spawn/index.js"(exports, module2) {
1414
+ "use strict";
1415
+ var cp3 = require("child_process");
1416
+ var parse2 = require_parse();
1417
+ var enoent = require_enoent();
1418
+ function spawn2(command2, args, options) {
1419
+ const parsed = parse2(command2, args, options);
1420
+ const spawned = cp3.spawn(parsed.command, parsed.args, parsed.options);
1421
+ enoent.hookChildProcess(spawned, parsed);
1422
+ return spawned;
1423
+ }
1424
+ function spawnSync(command2, args, options) {
1425
+ const parsed = parse2(command2, args, options);
1426
+ const result = cp3.spawnSync(parsed.command, parsed.args, parsed.options);
1427
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
1428
+ return result;
1429
+ }
1430
+ module2.exports = spawn2;
1431
+ module2.exports.spawn = spawn2;
1432
+ module2.exports.sync = spawnSync;
1433
+ module2.exports._parse = parse2;
1434
+ module2.exports._enoent = enoent;
1435
+ }
1436
+ });
1437
+
941
1438
  // ../../node_modules/which-pm-runs/index.js
942
1439
  var require_which_pm_runs = __commonJS({
943
1440
  "../../node_modules/which-pm-runs/index.js"(exports, module2) {
@@ -44367,7 +44864,7 @@ var Yargs = YargsFactory(esm_default);
44367
44864
  var yargs_default = Yargs;
44368
44865
 
44369
44866
  // package.json
44370
- var version = "2.0.5";
44867
+ var version = "2.0.7";
44371
44868
 
44372
44869
  // src/pages.ts
44373
44870
  var import_path8 = require("path");
@@ -44378,9 +44875,9 @@ var import_promises = require("node:fs/promises");
44378
44875
  var import_node_path = require("node:path");
44379
44876
 
44380
44877
  // src/helpers/command.ts
44381
- var import_child_process = require("child_process");
44382
44878
  var import_fs5 = require("fs");
44383
44879
  var import_path5 = __toESM(require("path"));
44880
+ var import_cross_spawn = __toESM(require_cross_spawn());
44384
44881
  var import_which_pm_runs = __toESM(require_which_pm_runs());
44385
44882
  var runCommand = async (command2, opts) => {
44386
44883
  const s = spinner();
@@ -44389,7 +44886,7 @@ var runCommand = async (command2, opts) => {
44389
44886
  }
44390
44887
  const [executable, ...args] = command2.split(" ");
44391
44888
  const squelch = opts?.silent || process.env.VITEST;
44392
- const cmd = (0, import_child_process.spawn)(executable, [...args], {
44889
+ const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
44393
44890
  // TODO: ideally inherit stderr, but npm install uses this for warnings
44394
44891
  // stdio: [ioMode, ioMode, "inherit"],
44395
44892
  stdio: squelch ? "pipe" : "inherit",
@@ -45461,7 +45958,7 @@ async function copyExistingWorkerFiles(ctx) {
45461
45958
  (0, import_path9.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-")
45462
45959
  );
45463
45960
  await runCommand(
45464
- `npx wrangler@3 init --from-dash ${ctx.existingScript} -y`,
45961
+ `npx wrangler@3 init --from-dash ${ctx.existingScript} -y --no-delegate-c3`,
45465
45962
  {
45466
45963
  silent: true,
45467
45964
  cwd: tempdir,