create-cloudflare 0.0.0-b92e5ac0 → 0.0.0-b9b34ce0

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 CHANGED
@@ -3814,7 +3814,7 @@ var init_args = __esm({
3814
3814
  var version, devDependencies;
3815
3815
  var init_package = __esm({
3816
3816
  "package.json"() {
3817
- version = "0.0.0-b92e5ac0";
3817
+ version = "0.0.0-b9b34ce0";
3818
3818
  devDependencies = {
3819
3819
  "@babel/parser": "^7.21.3",
3820
3820
  "@babel/types": "^7.21.4",
@@ -4548,14 +4548,14 @@ var require_open = __commonJS({
4548
4548
  }
4549
4549
  const subprocess = childProcess.spawn(command2, cliArguments, childProcessOptions);
4550
4550
  if (options.wait) {
4551
- return new Promise((resolve10, reject) => {
4551
+ return new Promise((resolve9, reject) => {
4552
4552
  subprocess.once("error", reject);
4553
4553
  subprocess.once("close", (exitCode) => {
4554
4554
  if (options.allowNonzeroExitCode && exitCode > 0) {
4555
4555
  reject(new Error(`Exited with code ${exitCode}`));
4556
4556
  return;
4557
4557
  }
4558
- resolve10(subprocess);
4558
+ resolve9(subprocess);
4559
4559
  });
4560
4560
  });
4561
4561
  }
@@ -10366,8 +10366,8 @@ var require_util2 = __commonJS({
10366
10366
  function createDeferredPromise() {
10367
10367
  let res;
10368
10368
  let rej;
10369
- const promise = new Promise((resolve10, reject) => {
10370
- res = resolve10;
10369
+ const promise = new Promise((resolve9, reject) => {
10370
+ res = resolve9;
10371
10371
  rej = reject;
10372
10372
  });
10373
10373
  return { promise, resolve: res, reject: rej };
@@ -10599,7 +10599,7 @@ var require_symbols2 = __commonJS({
10599
10599
  var require_webidl = __commonJS({
10600
10600
  "../../node_modules/.pnpm/undici@5.28.2/node_modules/undici/lib/fetch/webidl.js"(exports2, module2) {
10601
10601
  "use strict";
10602
- var { types } = require("util");
10602
+ var { types: types2 } = require("util");
10603
10603
  var { hasOwn, toUSVString } = require_util2();
10604
10604
  var webidl = {};
10605
10605
  webidl.converters = {};
@@ -10764,7 +10764,7 @@ var require_webidl = __commonJS({
10764
10764
  });
10765
10765
  }
10766
10766
  const result = {};
10767
- if (!types.isProxy(O2)) {
10767
+ if (!types2.isProxy(O2)) {
10768
10768
  const keys2 = Object.keys(O2);
10769
10769
  for (const key of keys2) {
10770
10770
  const typedKey = keyConverter(key);
@@ -10890,14 +10890,14 @@ var require_webidl = __commonJS({
10890
10890
  return x2;
10891
10891
  };
10892
10892
  webidl.converters.ArrayBuffer = function(V2, opts = {}) {
10893
- if (webidl.util.Type(V2) !== "Object" || !types.isAnyArrayBuffer(V2)) {
10893
+ if (webidl.util.Type(V2) !== "Object" || !types2.isAnyArrayBuffer(V2)) {
10894
10894
  throw webidl.errors.conversionFailed({
10895
10895
  prefix: `${V2}`,
10896
10896
  argument: `${V2}`,
10897
10897
  types: ["ArrayBuffer"]
10898
10898
  });
10899
10899
  }
10900
- if (opts.allowShared === false && types.isSharedArrayBuffer(V2)) {
10900
+ if (opts.allowShared === false && types2.isSharedArrayBuffer(V2)) {
10901
10901
  throw webidl.errors.exception({
10902
10902
  header: "ArrayBuffer",
10903
10903
  message: "SharedArrayBuffer is not allowed."
@@ -10906,14 +10906,14 @@ var require_webidl = __commonJS({
10906
10906
  return V2;
10907
10907
  };
10908
10908
  webidl.converters.TypedArray = function(V2, T2, opts = {}) {
10909
- if (webidl.util.Type(V2) !== "Object" || !types.isTypedArray(V2) || V2.constructor.name !== T2.name) {
10909
+ if (webidl.util.Type(V2) !== "Object" || !types2.isTypedArray(V2) || V2.constructor.name !== T2.name) {
10910
10910
  throw webidl.errors.conversionFailed({
10911
10911
  prefix: `${T2.name}`,
10912
10912
  argument: `${V2}`,
10913
10913
  types: [T2.name]
10914
10914
  });
10915
10915
  }
10916
- if (opts.allowShared === false && types.isSharedArrayBuffer(V2.buffer)) {
10916
+ if (opts.allowShared === false && types2.isSharedArrayBuffer(V2.buffer)) {
10917
10917
  throw webidl.errors.exception({
10918
10918
  header: "ArrayBuffer",
10919
10919
  message: "SharedArrayBuffer is not allowed."
@@ -10922,13 +10922,13 @@ var require_webidl = __commonJS({
10922
10922
  return V2;
10923
10923
  };
10924
10924
  webidl.converters.DataView = function(V2, opts = {}) {
10925
- if (webidl.util.Type(V2) !== "Object" || !types.isDataView(V2)) {
10925
+ if (webidl.util.Type(V2) !== "Object" || !types2.isDataView(V2)) {
10926
10926
  throw webidl.errors.exception({
10927
10927
  header: "DataView",
10928
10928
  message: "Object is not a DataView."
10929
10929
  });
10930
10930
  }
10931
- if (opts.allowShared === false && types.isSharedArrayBuffer(V2.buffer)) {
10931
+ if (opts.allowShared === false && types2.isSharedArrayBuffer(V2.buffer)) {
10932
10932
  throw webidl.errors.exception({
10933
10933
  header: "ArrayBuffer",
10934
10934
  message: "SharedArrayBuffer is not allowed."
@@ -10937,13 +10937,13 @@ var require_webidl = __commonJS({
10937
10937
  return V2;
10938
10938
  };
10939
10939
  webidl.converters.BufferSource = function(V2, opts = {}) {
10940
- if (types.isAnyArrayBuffer(V2)) {
10940
+ if (types2.isAnyArrayBuffer(V2)) {
10941
10941
  return webidl.converters.ArrayBuffer(V2, opts);
10942
10942
  }
10943
- if (types.isTypedArray(V2)) {
10943
+ if (types2.isTypedArray(V2)) {
10944
10944
  return webidl.converters.TypedArray(V2, V2.constructor);
10945
10945
  }
10946
- if (types.isDataView(V2)) {
10946
+ if (types2.isDataView(V2)) {
10947
10947
  return webidl.converters.DataView(V2, opts);
10948
10948
  }
10949
10949
  throw new TypeError(`Could not convert ${V2} to a BufferSource.`);
@@ -11258,7 +11258,7 @@ var require_file = __commonJS({
11258
11258
  "../../node_modules/.pnpm/undici@5.28.2/node_modules/undici/lib/fetch/file.js"(exports2, module2) {
11259
11259
  "use strict";
11260
11260
  var { Blob: Blob2, File: NativeFile } = require("buffer");
11261
- var { types } = require("util");
11261
+ var { types: types2 } = require("util");
11262
11262
  var { kState } = require_symbols2();
11263
11263
  var { isBlobLike } = require_util2();
11264
11264
  var { webidl } = require_webidl();
@@ -11367,7 +11367,7 @@ var require_file = __commonJS({
11367
11367
  if (isBlobLike(V2)) {
11368
11368
  return webidl.converters.Blob(V2, { strict: false });
11369
11369
  }
11370
- if (ArrayBuffer.isView(V2) || types.isAnyArrayBuffer(V2)) {
11370
+ if (ArrayBuffer.isView(V2) || types2.isAnyArrayBuffer(V2)) {
11371
11371
  return webidl.converters.BufferSource(V2, opts);
11372
11372
  }
11373
11373
  }
@@ -11411,7 +11411,7 @@ var require_file = __commonJS({
11411
11411
  s = convertLineEndingsNative(s);
11412
11412
  }
11413
11413
  bytes.push(encoder.encode(s));
11414
- } else if (types.isAnyArrayBuffer(element) || types.isTypedArray(element)) {
11414
+ } else if (types2.isAnyArrayBuffer(element) || types2.isTypedArray(element)) {
11415
11415
  if (!element.buffer) {
11416
11416
  bytes.push(new Uint8Array(element));
11417
11417
  } else {
@@ -11868,8 +11868,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
11868
11868
  });
11869
11869
  }
11870
11870
  });
11871
- const busboyResolve = new Promise((resolve10, reject) => {
11872
- busboy.on("finish", resolve10);
11871
+ const busboyResolve = new Promise((resolve9, reject) => {
11872
+ busboy.on("finish", resolve9);
11873
11873
  busboy.on("error", (err) => reject(new TypeError(err)));
11874
11874
  });
11875
11875
  if (this.body !== null)
@@ -12414,9 +12414,9 @@ var require_dispatcher_base = __commonJS({
12414
12414
  }
12415
12415
  close(callback) {
12416
12416
  if (callback === void 0) {
12417
- return new Promise((resolve10, reject) => {
12417
+ return new Promise((resolve9, reject) => {
12418
12418
  this.close((err, data) => {
12419
- return err ? reject(err) : resolve10(data);
12419
+ return err ? reject(err) : resolve9(data);
12420
12420
  });
12421
12421
  });
12422
12422
  }
@@ -12454,12 +12454,12 @@ var require_dispatcher_base = __commonJS({
12454
12454
  err = null;
12455
12455
  }
12456
12456
  if (callback === void 0) {
12457
- return new Promise((resolve10, reject) => {
12457
+ return new Promise((resolve9, reject) => {
12458
12458
  this.destroy(err, (err2, data) => {
12459
12459
  return err2 ? (
12460
12460
  /* istanbul ignore next: should never error */
12461
12461
  reject(err2)
12462
- ) : resolve10(data);
12462
+ ) : resolve9(data);
12463
12463
  });
12464
12464
  });
12465
12465
  }
@@ -13509,16 +13509,16 @@ var require_client = __commonJS({
13509
13509
  return this[kNeedDrain] < 2;
13510
13510
  }
13511
13511
  async [kClose]() {
13512
- return new Promise((resolve10) => {
13512
+ return new Promise((resolve9) => {
13513
13513
  if (!this[kSize]) {
13514
- resolve10(null);
13514
+ resolve9(null);
13515
13515
  } else {
13516
- this[kClosedResolve] = resolve10;
13516
+ this[kClosedResolve] = resolve9;
13517
13517
  }
13518
13518
  });
13519
13519
  }
13520
13520
  async [kDestroy](err) {
13521
- return new Promise((resolve10) => {
13521
+ return new Promise((resolve9) => {
13522
13522
  const requests = this[kQueue].splice(this[kPendingIdx]);
13523
13523
  for (let i = 0; i < requests.length; i++) {
13524
13524
  const request2 = requests[i];
@@ -13529,7 +13529,7 @@ var require_client = __commonJS({
13529
13529
  this[kClosedResolve]();
13530
13530
  this[kClosedResolve] = null;
13531
13531
  }
13532
- resolve10();
13532
+ resolve9();
13533
13533
  };
13534
13534
  if (this[kHTTP2Session] != null) {
13535
13535
  util.destroy(this[kHTTP2Session], err);
@@ -14109,7 +14109,7 @@ var require_client = __commonJS({
14109
14109
  });
14110
14110
  }
14111
14111
  try {
14112
- const socket = await new Promise((resolve10, reject) => {
14112
+ const socket = await new Promise((resolve9, reject) => {
14113
14113
  client[kConnector]({
14114
14114
  host,
14115
14115
  hostname,
@@ -14121,7 +14121,7 @@ var require_client = __commonJS({
14121
14121
  if (err) {
14122
14122
  reject(err);
14123
14123
  } else {
14124
- resolve10(socket2);
14124
+ resolve9(socket2);
14125
14125
  }
14126
14126
  });
14127
14127
  });
@@ -14748,12 +14748,12 @@ upgrade: ${upgrade}\r
14748
14748
  cb();
14749
14749
  }
14750
14750
  }
14751
- const waitForDrain = () => new Promise((resolve10, reject) => {
14751
+ const waitForDrain = () => new Promise((resolve9, reject) => {
14752
14752
  assert(callback === null);
14753
14753
  if (socket[kError]) {
14754
14754
  reject(socket[kError]);
14755
14755
  } else {
14756
- callback = resolve10;
14756
+ callback = resolve9;
14757
14757
  }
14758
14758
  });
14759
14759
  if (client[kHTTPConnVersion] === "h2") {
@@ -15098,8 +15098,8 @@ var require_pool_base = __commonJS({
15098
15098
  if (this[kQueue].isEmpty()) {
15099
15099
  return Promise.all(this[kClients].map((c2) => c2.close()));
15100
15100
  } else {
15101
- return new Promise((resolve10) => {
15102
- this[kClosedResolve] = resolve10;
15101
+ return new Promise((resolve9) => {
15102
+ this[kClosedResolve] = resolve9;
15103
15103
  });
15104
15104
  }
15105
15105
  }
@@ -15670,7 +15670,7 @@ var require_readable = __commonJS({
15670
15670
  if (this.closed) {
15671
15671
  return Promise.resolve(null);
15672
15672
  }
15673
- return new Promise((resolve10, reject) => {
15673
+ return new Promise((resolve9, reject) => {
15674
15674
  const signalListenerCleanup = signal ? util.addAbortListener(signal, () => {
15675
15675
  this.destroy();
15676
15676
  }) : noop;
@@ -15679,7 +15679,7 @@ var require_readable = __commonJS({
15679
15679
  if (signal && signal.aborted) {
15680
15680
  reject(signal.reason || Object.assign(new Error("The operation was aborted"), { name: "AbortError" }));
15681
15681
  } else {
15682
- resolve10(null);
15682
+ resolve9(null);
15683
15683
  }
15684
15684
  }).on("error", noop).on("data", function(chunk) {
15685
15685
  limit -= chunk.length;
@@ -15701,11 +15701,11 @@ var require_readable = __commonJS({
15701
15701
  throw new TypeError("unusable");
15702
15702
  }
15703
15703
  assert(!stream[kConsume]);
15704
- return new Promise((resolve10, reject) => {
15704
+ return new Promise((resolve9, reject) => {
15705
15705
  stream[kConsume] = {
15706
15706
  type,
15707
15707
  stream,
15708
- resolve: resolve10,
15708
+ resolve: resolve9,
15709
15709
  reject,
15710
15710
  length: 0,
15711
15711
  body: []
@@ -15740,12 +15740,12 @@ var require_readable = __commonJS({
15740
15740
  }
15741
15741
  }
15742
15742
  function consumeEnd(consume2) {
15743
- const { type, body, resolve: resolve10, stream, length } = consume2;
15743
+ const { type, body, resolve: resolve9, stream, length } = consume2;
15744
15744
  try {
15745
15745
  if (type === "text") {
15746
- resolve10(toUSVString(Buffer.concat(body)));
15746
+ resolve9(toUSVString(Buffer.concat(body)));
15747
15747
  } else if (type === "json") {
15748
- resolve10(JSON.parse(Buffer.concat(body)));
15748
+ resolve9(JSON.parse(Buffer.concat(body)));
15749
15749
  } else if (type === "arrayBuffer") {
15750
15750
  const dst = new Uint8Array(length);
15751
15751
  let pos = 0;
@@ -15753,12 +15753,12 @@ var require_readable = __commonJS({
15753
15753
  dst.set(buf, pos);
15754
15754
  pos += buf.byteLength;
15755
15755
  }
15756
- resolve10(dst.buffer);
15756
+ resolve9(dst.buffer);
15757
15757
  } else if (type === "blob") {
15758
15758
  if (!Blob2) {
15759
15759
  Blob2 = require("buffer").Blob;
15760
15760
  }
15761
- resolve10(new Blob2(body, { type: stream[kContentType] }));
15761
+ resolve9(new Blob2(body, { type: stream[kContentType] }));
15762
15762
  }
15763
15763
  consumeFinish(consume2);
15764
15764
  } catch (err) {
@@ -16013,9 +16013,9 @@ var require_api_request = __commonJS({
16013
16013
  };
16014
16014
  function request2(opts, callback) {
16015
16015
  if (callback === void 0) {
16016
- return new Promise((resolve10, reject) => {
16016
+ return new Promise((resolve9, reject) => {
16017
16017
  request2.call(this, opts, (err, data) => {
16018
- return err ? reject(err) : resolve10(data);
16018
+ return err ? reject(err) : resolve9(data);
16019
16019
  });
16020
16020
  });
16021
16021
  }
@@ -16188,9 +16188,9 @@ var require_api_stream = __commonJS({
16188
16188
  };
16189
16189
  function stream(opts, factory, callback) {
16190
16190
  if (callback === void 0) {
16191
- return new Promise((resolve10, reject) => {
16191
+ return new Promise((resolve9, reject) => {
16192
16192
  stream.call(this, opts, factory, (err, data) => {
16193
- return err ? reject(err) : resolve10(data);
16193
+ return err ? reject(err) : resolve9(data);
16194
16194
  });
16195
16195
  });
16196
16196
  }
@@ -16471,9 +16471,9 @@ var require_api_upgrade = __commonJS({
16471
16471
  };
16472
16472
  function upgrade(opts, callback) {
16473
16473
  if (callback === void 0) {
16474
- return new Promise((resolve10, reject) => {
16474
+ return new Promise((resolve9, reject) => {
16475
16475
  upgrade.call(this, opts, (err, data) => {
16476
- return err ? reject(err) : resolve10(data);
16476
+ return err ? reject(err) : resolve9(data);
16477
16477
  });
16478
16478
  });
16479
16479
  }
@@ -16562,9 +16562,9 @@ var require_api_connect = __commonJS({
16562
16562
  };
16563
16563
  function connect(opts, callback) {
16564
16564
  if (callback === void 0) {
16565
- return new Promise((resolve10, reject) => {
16565
+ return new Promise((resolve9, reject) => {
16566
16566
  connect.call(this, opts, (err, data) => {
16567
- return err ? reject(err) : resolve10(data);
16567
+ return err ? reject(err) : resolve9(data);
16568
16568
  });
16569
16569
  });
16570
16570
  }
@@ -18300,7 +18300,7 @@ var require_response = __commonJS({
18300
18300
  var { URLSerializer } = require_dataURL();
18301
18301
  var { kHeadersList, kConstruct } = require_symbols();
18302
18302
  var assert = require("assert");
18303
- var { types } = require("util");
18303
+ var { types: types2 } = require("util");
18304
18304
  var ReadableStream = globalThis.ReadableStream || require("stream/web").ReadableStream;
18305
18305
  var textEncoder = new TextEncoder("utf-8");
18306
18306
  var Response = class {
@@ -18603,7 +18603,7 @@ var require_response = __commonJS({
18603
18603
  if (isBlobLike(V2)) {
18604
18604
  return webidl.converters.Blob(V2, { strict: false });
18605
18605
  }
18606
- if (types.isArrayBuffer(V2) || types.isTypedArray(V2) || types.isDataView(V2)) {
18606
+ if (types2.isArrayBuffer(V2) || types2.isTypedArray(V2) || types2.isDataView(V2)) {
18607
18607
  return webidl.converters.BufferSource(V2);
18608
18608
  }
18609
18609
  if (util.isFormDataLike(V2)) {
@@ -20184,7 +20184,7 @@ var require_fetch = __commonJS({
20184
20184
  async function dispatch({ body }) {
20185
20185
  const url = requestCurrentURL(request2);
20186
20186
  const agent = fetchParams.controller.dispatcher;
20187
- return new Promise((resolve10, reject) => agent.dispatch(
20187
+ return new Promise((resolve9, reject) => agent.dispatch(
20188
20188
  {
20189
20189
  path: url.pathname + url.search,
20190
20190
  origin: url.origin,
@@ -20260,7 +20260,7 @@ var require_fetch = __commonJS({
20260
20260
  }
20261
20261
  }
20262
20262
  }
20263
- resolve10({
20263
+ resolve9({
20264
20264
  status: status2,
20265
20265
  statusText,
20266
20266
  headersList: headers[kHeadersList],
@@ -20303,7 +20303,7 @@ var require_fetch = __commonJS({
20303
20303
  const val = headersList[n2 + 1].toString("latin1");
20304
20304
  headers[kHeadersList].append(key, val);
20305
20305
  }
20306
- resolve10({
20306
+ resolve9({
20307
20307
  status: status2,
20308
20308
  statusText: STATUS_CODES[status2],
20309
20309
  headersList: headers[kHeadersList],
@@ -20708,7 +20708,7 @@ var require_util4 = __commonJS({
20708
20708
  var { getEncoding } = require_encoding();
20709
20709
  var { DOMException: DOMException2 } = require_constants2();
20710
20710
  var { serializeAMimeType, parseMIMEType } = require_dataURL();
20711
- var { types } = require("util");
20711
+ var { types: types2 } = require("util");
20712
20712
  var { StringDecoder } = require("string_decoder");
20713
20713
  var { btoa: btoa2 } = require("buffer");
20714
20714
  var staticPropertyDescriptors = {
@@ -20738,7 +20738,7 @@ var require_util4 = __commonJS({
20738
20738
  });
20739
20739
  }
20740
20740
  isFirstChunk = false;
20741
- if (!done && types.isUint8Array(value)) {
20741
+ if (!done && types2.isUint8Array(value)) {
20742
20742
  bytes.push(value);
20743
20743
  if ((fr[kLastProgressEventFired] === void 0 || Date.now() - fr[kLastProgressEventFired] >= 50) && !fr[kAborted]) {
20744
20744
  fr[kLastProgressEventFired] = Date.now();
@@ -23120,7 +23120,7 @@ var require_websocket = __commonJS({
23120
23120
  var { ByteParser } = require_receiver();
23121
23121
  var { kEnumerableProperty, isBlobLike } = require_util();
23122
23122
  var { getGlobalDispatcher } = require_global2();
23123
- var { types } = require("util");
23123
+ var { types: types2 } = require("util");
23124
23124
  var experimentalWarned = false;
23125
23125
  var WebSocket = class extends EventTarget {
23126
23126
  #events = {
@@ -23267,7 +23267,7 @@ var require_websocket = __commonJS({
23267
23267
  socket.write(buffer, () => {
23268
23268
  this.#bufferedAmount -= value.byteLength;
23269
23269
  });
23270
- } else if (types.isArrayBuffer(data)) {
23270
+ } else if (types2.isArrayBuffer(data)) {
23271
23271
  const value = Buffer.from(data);
23272
23272
  const frame = new WebsocketFrameSend(value);
23273
23273
  const buffer = frame.createFrame(opcodes.BINARY);
@@ -23489,7 +23489,7 @@ var require_websocket = __commonJS({
23489
23489
  if (isBlobLike(V2)) {
23490
23490
  return webidl.converters.Blob(V2, { strict: false });
23491
23491
  }
23492
- if (ArrayBuffer.isView(V2) || types.isAnyArrayBuffer(V2)) {
23492
+ if (ArrayBuffer.isView(V2) || types2.isAnyArrayBuffer(V2)) {
23493
23493
  return webidl.converters.BufferSource(V2);
23494
23494
  }
23495
23495
  }
@@ -23802,12 +23802,12 @@ var require_isexe = __commonJS({
23802
23802
  if (typeof Promise !== "function") {
23803
23803
  throw new TypeError("callback not provided");
23804
23804
  }
23805
- return new Promise(function(resolve10, reject) {
23805
+ return new Promise(function(resolve9, reject) {
23806
23806
  isexe(path3, options || {}, function(er, is) {
23807
23807
  if (er) {
23808
23808
  reject(er);
23809
23809
  } else {
23810
- resolve10(is);
23810
+ resolve9(is);
23811
23811
  }
23812
23812
  });
23813
23813
  });
@@ -23873,27 +23873,27 @@ var require_which = __commonJS({
23873
23873
  opt = {};
23874
23874
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
23875
23875
  const found = [];
23876
- const step = (i) => new Promise((resolve10, reject) => {
23876
+ const step = (i) => new Promise((resolve9, reject) => {
23877
23877
  if (i === pathEnv.length)
23878
- return opt.all && found.length ? resolve10(found) : reject(getNotFoundError(cmd));
23878
+ return opt.all && found.length ? resolve9(found) : reject(getNotFoundError(cmd));
23879
23879
  const ppRaw = pathEnv[i];
23880
23880
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
23881
23881
  const pCmd = path3.join(pathPart, cmd);
23882
23882
  const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
23883
- resolve10(subStep(p2, i, 0));
23883
+ resolve9(subStep(p2, i, 0));
23884
23884
  });
23885
- const subStep = (p2, i, ii) => new Promise((resolve10, reject) => {
23885
+ const subStep = (p2, i, ii) => new Promise((resolve9, reject) => {
23886
23886
  if (ii === pathExt.length)
23887
- return resolve10(step(i + 1));
23887
+ return resolve9(step(i + 1));
23888
23888
  const ext = pathExt[ii];
23889
23889
  isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
23890
23890
  if (!er && is) {
23891
23891
  if (opt.all)
23892
23892
  found.push(p2 + ext);
23893
23893
  else
23894
- return resolve10(p2 + ext);
23894
+ return resolve9(p2 + ext);
23895
23895
  }
23896
- return resolve10(subStep(p2, i, ii + 1));
23896
+ return resolve9(subStep(p2, i, ii + 1));
23897
23897
  });
23898
23898
  });
23899
23899
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -24218,16 +24218,16 @@ var init_package2 = __esm({
24218
24218
  ],
24219
24219
  dependencies: {
24220
24220
  "create-astro": "4.7.2",
24221
- "@angular/create": "17.1.1",
24221
+ "@angular/create": "17.1.3",
24222
24222
  "create-docusaurus": "3.1.1",
24223
24223
  "create-hono": "0.3.2",
24224
- "create-next-app": "14.0.4",
24225
- "create-qwik": "1.4.2",
24224
+ "create-next-app": "14.1.0",
24225
+ "create-qwik": "1.4.4",
24226
24226
  "create-react-app": "5.0.1",
24227
- "create-remix": "2.5.1",
24227
+ "create-remix": "2.6.0",
24228
24228
  "create-solid": "0.4.10",
24229
24229
  "create-svelte": "6.0.8",
24230
- "create-vue": "3.9.1",
24230
+ "create-vue": "3.9.2",
24231
24231
  gatsby: "5.13.3",
24232
24232
  nuxi: "3.10.0"
24233
24233
  },
@@ -25105,13 +25105,13 @@ var require_packet = __commonJS({
25105
25105
  let chunklen = 0;
25106
25106
  let received = false;
25107
25107
  let expected = false;
25108
- return new Promise((resolve10, reject) => {
25108
+ return new Promise((resolve9, reject) => {
25109
25109
  const processMessage = () => {
25110
25110
  if (received)
25111
25111
  return;
25112
25112
  received = true;
25113
25113
  const buffer = Buffer.concat(chunks, chunklen);
25114
- resolve10(buffer.slice(2));
25114
+ resolve9(buffer.slice(2));
25115
25115
  };
25116
25116
  socket.on("end", processMessage);
25117
25117
  socket.on("error", reject);
@@ -25173,16 +25173,16 @@ var require_udp = __commonJS({
25173
25173
  if (message instanceof Packet) {
25174
25174
  message = message.toBuffer();
25175
25175
  }
25176
- return new Promise((resolve10, reject) => {
25176
+ return new Promise((resolve9, reject) => {
25177
25177
  this.send(message, rinfo.port, rinfo.address, (err) => {
25178
25178
  if (err)
25179
25179
  return reject(err);
25180
- resolve10(message);
25180
+ resolve9(message);
25181
25181
  });
25182
25182
  });
25183
25183
  }
25184
25184
  listen(port, address) {
25185
- return new Promise((resolve10) => this.bind(port, address, resolve10));
25185
+ return new Promise((resolve9) => this.bind(port, address, resolve9));
25186
25186
  }
25187
25187
  };
25188
25188
  module2.exports = Server;
@@ -25245,11 +25245,11 @@ var require_doh = __commonJS({
25245
25245
  }
25246
25246
  return queryData;
25247
25247
  };
25248
- var readStream = (stream) => new Promise((resolve10, reject) => {
25248
+ var readStream = (stream) => new Promise((resolve9, reject) => {
25249
25249
  let buffer = "";
25250
25250
  stream.on("error", reject).on("data", (chunk) => {
25251
25251
  buffer += chunk;
25252
- }).on("end", () => resolve10(buffer));
25252
+ }).on("end", () => resolve9(buffer));
25253
25253
  });
25254
25254
  var Server = class extends EventEmitter {
25255
25255
  constructor(options) {
@@ -25375,12 +25375,12 @@ var require_dns = __commonJS({
25375
25375
  }
25376
25376
  const servers = Object.values(this.servers);
25377
25377
  this.closed = Promise.all(
25378
- servers.map((server) => new Promise((resolve10) => server.once("close", resolve10)))
25378
+ servers.map((server) => new Promise((resolve9) => server.once("close", resolve9)))
25379
25379
  ).then(() => {
25380
25380
  this.emit("close");
25381
25381
  });
25382
25382
  this.listening = Promise.all(
25383
- servers.map((server) => new Promise((resolve10) => server.once("listening", resolve10)))
25383
+ servers.map((server) => new Promise((resolve9) => server.once("listening", resolve9)))
25384
25384
  ).then(() => {
25385
25385
  const addresses = this.addresses();
25386
25386
  this.emit("listening", addresses);
@@ -25512,18 +25512,18 @@ var require_tcp2 = __commonJS({
25512
25512
  var require_doh2 = __commonJS({
25513
25513
  "../../node_modules/.pnpm/dns2@2.1.0/node_modules/dns2/client/doh.js"(exports2, module2) {
25514
25514
  var Packet = require_packet();
25515
- var defaultGet = (url) => new Promise((resolve10, reject) => {
25515
+ var defaultGet = (url) => new Promise((resolve9, reject) => {
25516
25516
  const headers = {
25517
25517
  accept: "application/dns-message"
25518
25518
  };
25519
25519
  const base = url.startsWith("https") ? require("https") : require("http");
25520
- const req = base.get(url, { headers }, resolve10);
25520
+ const req = base.get(url, { headers }, resolve9);
25521
25521
  req.on("error", reject);
25522
25522
  });
25523
25523
  var readStream = (stream) => {
25524
25524
  const buffer = [];
25525
- return new Promise((resolve10, reject) => {
25526
- stream.on("error", reject).on("data", (chunk) => buffer.push(chunk)).on("end", () => resolve10(Buffer.concat(buffer)));
25525
+ return new Promise((resolve9, reject) => {
25526
+ stream.on("error", reject).on("data", (chunk) => buffer.push(chunk)).on("end", () => resolve9(Buffer.concat(buffer)));
25527
25527
  });
25528
25528
  };
25529
25529
  var DOHClient = ({ dns, http, get = defaultGet } = {}) => {
@@ -25576,12 +25576,12 @@ var require_udp2 = __commonJS({
25576
25576
  type: Packet.TYPE[type]
25577
25577
  });
25578
25578
  const client = new udp.Socket(socketType);
25579
- return new Promise((resolve10, reject) => {
25579
+ return new Promise((resolve9, reject) => {
25580
25580
  client.once("message", function onMessage(message) {
25581
25581
  client.close();
25582
25582
  const response = Packet.parse(message);
25583
25583
  equal(response.header.id, query.header.id);
25584
- resolve10(response);
25584
+ resolve9(response);
25585
25585
  });
25586
25586
  debug2("send", dns, query.toBuffer());
25587
25587
  client.send(query.toBuffer(), port, dns, (err) => err && reject(err));
@@ -25595,13 +25595,13 @@ var require_udp2 = __commonJS({
25595
25595
  var require_google = __commonJS({
25596
25596
  "../../node_modules/.pnpm/dns2@2.1.0/node_modules/dns2/client/google.js"(exports2, module2) {
25597
25597
  var https = require("https");
25598
- var get = (url) => new Promise((resolve10) => https.get(url, resolve10));
25598
+ var get = (url) => new Promise((resolve9) => https.get(url, resolve9));
25599
25599
  var readStream = (stream) => {
25600
25600
  const buffer = [];
25601
- return new Promise((resolve10, reject) => {
25601
+ return new Promise((resolve9, reject) => {
25602
25602
  stream.on("error", reject).on("data", (chunk) => {
25603
25603
  buffer.push(chunk);
25604
- }).on("end", () => resolve10(Buffer.concat(buffer)));
25604
+ }).on("end", () => resolve9(Buffer.concat(buffer)));
25605
25605
  });
25606
25606
  };
25607
25607
  var GoogleClient = () => (name2, type = "ANY") => {
@@ -25662,8 +25662,8 @@ var require_dns2 = __commonJS({
25662
25662
  const { port, nameServers, recursive, resolverProtocol = "UDP" } = this;
25663
25663
  const createResolver = DNS[resolverProtocol + "Client"];
25664
25664
  return Promise.race(nameServers.map((address) => {
25665
- const resolve10 = createResolver({ dns: address, port, recursive });
25666
- return resolve10(name2, type, cls, clientIp);
25665
+ const resolve9 = createResolver({ dns: address, port, recursive });
25666
+ return resolve9(name2, type, cls, clientIp);
25667
25667
  }));
25668
25668
  }
25669
25669
  /**
@@ -25812,7 +25812,7 @@ var init_poll = __esm({
25812
25812
  var version2;
25813
25813
  var init_package3 = __esm({
25814
25814
  "../wrangler/package.json"() {
25815
- version2 = "3.25.0";
25815
+ version2 = "3.28.2";
25816
25816
  }
25817
25817
  });
25818
25818
 
@@ -27500,20 +27500,20 @@ var require_parse_async = __commonJS({
27500
27500
  const index = 0;
27501
27501
  const blocksize = opts.blocksize || 40960;
27502
27502
  const parser2 = new TOMLParser();
27503
- return new Promise((resolve10, reject) => {
27504
- setImmediate(parseAsyncNext, index, blocksize, resolve10, reject);
27503
+ return new Promise((resolve9, reject) => {
27504
+ setImmediate(parseAsyncNext, index, blocksize, resolve9, reject);
27505
27505
  });
27506
- function parseAsyncNext(index2, blocksize2, resolve10, reject) {
27506
+ function parseAsyncNext(index2, blocksize2, resolve9, reject) {
27507
27507
  if (index2 >= str.length) {
27508
27508
  try {
27509
- return resolve10(parser2.finish());
27509
+ return resolve9(parser2.finish());
27510
27510
  } catch (err) {
27511
27511
  return reject(prettyError(err, str));
27512
27512
  }
27513
27513
  }
27514
27514
  try {
27515
27515
  parser2.parse(str.slice(index2, index2 + blocksize2));
27516
- setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve10, reject);
27516
+ setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve9, reject);
27517
27517
  } catch (err) {
27518
27518
  reject(prettyError(err, str));
27519
27519
  }
@@ -27539,7 +27539,7 @@ var require_parse_stream = __commonJS({
27539
27539
  function parseReadable(stm) {
27540
27540
  const parser2 = new TOMLParser();
27541
27541
  stm.setEncoding("utf8");
27542
- return new Promise((resolve10, reject) => {
27542
+ return new Promise((resolve9, reject) => {
27543
27543
  let readable;
27544
27544
  let ended = false;
27545
27545
  let errored = false;
@@ -27548,7 +27548,7 @@ var require_parse_stream = __commonJS({
27548
27548
  if (readable)
27549
27549
  return;
27550
27550
  try {
27551
- resolve10(parser2.finish());
27551
+ resolve9(parser2.finish());
27552
27552
  } catch (err) {
27553
27553
  reject(err);
27554
27554
  }
@@ -27873,7 +27873,7 @@ var require_toml = __commonJS({
27873
27873
  });
27874
27874
 
27875
27875
  // src/helpers/files.ts
27876
- var import_fs5, import_path5, import_toml, writeFile2, readFile, readJSON, writeJSON, probePaths, usesTypescript, eslintRcExts, usesEslint, compatDateFlag;
27876
+ var import_fs5, import_path5, import_toml, copyFile, writeFile2, readFile, readJSON, writeJSON, probePaths, usesTypescript, eslintRcExts, usesEslint, compatDateFlag;
27877
27877
  var init_files = __esm({
27878
27878
  "src/helpers/files.ts"() {
27879
27879
  import_fs5 = __toESM(require("fs"));
@@ -27881,6 +27881,13 @@ var init_files = __esm({
27881
27881
  init_cli();
27882
27882
  import_toml = __toESM(require_toml());
27883
27883
  init_command();
27884
+ copyFile = (path3, dest) => {
27885
+ try {
27886
+ import_fs5.default.copyFileSync(path3, dest);
27887
+ } catch (error2) {
27888
+ crash(error2);
27889
+ }
27890
+ };
27884
27891
  writeFile2 = (path3, content) => {
27885
27892
  try {
27886
27893
  import_fs5.default.writeFileSync(path3, content);
@@ -29092,7 +29099,7 @@ function getLatestTypesEntrypoint(ctx) {
29092
29099
  return null;
29093
29100
  }
29094
29101
  }
29095
- var import_fs6, import_path6, npm, readWranglerToml, writeWranglerToml, updateWranglerToml;
29102
+ var import_fs6, import_path6, npm, wranglerTomlExists, readWranglerToml, writeWranglerToml, updateWranglerToml;
29096
29103
  var init_workers = __esm({
29097
29104
  "src/workers.ts"() {
29098
29105
  import_fs6 = require("fs");
@@ -29105,6 +29112,10 @@ var init_workers = __esm({
29105
29112
  init_packages();
29106
29113
  init_magic_string_es();
29107
29114
  ({ npm } = detectPackageManager());
29115
+ wranglerTomlExists = (ctx) => {
29116
+ const wranglerTomlPath = (0, import_path6.resolve)(ctx.project.path, "wrangler.toml");
29117
+ return (0, import_fs6.existsSync)(wranglerTomlPath);
29118
+ };
29108
29119
  readWranglerToml = (ctx) => {
29109
29120
  const wranglerTomlPath = (0, import_path6.resolve)(ctx.project.path, "wrangler.toml");
29110
29121
  return readFile(wranglerTomlPath);
@@ -29114,7 +29125,7 @@ var init_workers = __esm({
29114
29125
  return writeFile2(wranglerTomlPath, contents);
29115
29126
  };
29116
29127
  updateWranglerToml = async (ctx) => {
29117
- if (ctx.template.platform !== "workers") {
29128
+ if (!wranglerTomlExists(ctx)) {
29118
29129
  return;
29119
29130
  }
29120
29131
  const wranglerToml = readWranglerToml(ctx);
@@ -30781,9 +30792,9 @@ var require_index_688c5d50 = __commonJS({
30781
30792
  }
30782
30793
  // stream.promise().then(() => done, er => emitted error)
30783
30794
  promise() {
30784
- return new Promise((resolve11, reject) => {
30795
+ return new Promise((resolve10, reject) => {
30785
30796
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
30786
- this.on("end", () => resolve11());
30797
+ this.on("end", () => resolve10());
30787
30798
  this.on("error", (er) => reject(er));
30788
30799
  });
30789
30800
  }
@@ -30795,7 +30806,7 @@ var require_index_688c5d50 = __commonJS({
30795
30806
  return Promise.resolve({ done: false, value: res });
30796
30807
  if (this[EOF$1])
30797
30808
  return Promise.resolve({ done: true });
30798
- let resolve11 = null;
30809
+ let resolve10 = null;
30799
30810
  let reject = null;
30800
30811
  const onerr = (er) => {
30801
30812
  this.removeListener("data", ondata);
@@ -30806,17 +30817,17 @@ var require_index_688c5d50 = __commonJS({
30806
30817
  this.removeListener("error", onerr);
30807
30818
  this.removeListener("end", onend);
30808
30819
  this.pause();
30809
- resolve11({ value, done: !!this[EOF$1] });
30820
+ resolve10({ value, done: !!this[EOF$1] });
30810
30821
  };
30811
30822
  const onend = () => {
30812
30823
  this.removeListener("error", onerr);
30813
30824
  this.removeListener("data", ondata);
30814
- resolve11({ done: true });
30825
+ resolve10({ done: true });
30815
30826
  };
30816
30827
  const ondestroy = () => onerr(new Error("stream destroyed"));
30817
30828
  return new Promise((res2, rej) => {
30818
30829
  reject = rej;
30819
- resolve11 = res2;
30830
+ resolve10 = res2;
30820
30831
  this.once(DESTROYED, ondestroy);
30821
30832
  this.once("error", onerr);
30822
30833
  this.once("end", onend);
@@ -31301,7 +31312,7 @@ var require_index_688c5d50 = __commonJS({
31301
31312
  }
31302
31313
  }
31303
31314
  };
31304
- var types = createCommonjsModule(function(module3, exports3) {
31315
+ var types2 = createCommonjsModule(function(module3, exports3) {
31305
31316
  exports3.name = /* @__PURE__ */ new Map([
31306
31317
  ["0", "File"],
31307
31318
  // same as File
@@ -31555,14 +31566,14 @@ var require_index_688c5d50 = __commonJS({
31555
31566
  }
31556
31567
  }
31557
31568
  get type() {
31558
- return types.name.get(this[TYPE]) || this[TYPE];
31569
+ return types2.name.get(this[TYPE]) || this[TYPE];
31559
31570
  }
31560
31571
  get typeKey() {
31561
31572
  return this[TYPE];
31562
31573
  }
31563
31574
  set type(type) {
31564
- if (types.code.has(type))
31565
- this[TYPE] = types.code.get(type);
31575
+ if (types2.code.has(type))
31576
+ this[TYPE] = types2.code.get(type);
31566
31577
  else
31567
31578
  this[TYPE] = type;
31568
31579
  }
@@ -33238,9 +33249,9 @@ var require_index_688c5d50 = __commonJS({
33238
33249
  const parse3 = new parse$4(opt);
33239
33250
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
33240
33251
  const file = opt.file;
33241
- const p2 = new Promise((resolve11, reject) => {
33252
+ const p2 = new Promise((resolve10, reject) => {
33242
33253
  parse3.on("error", reject);
33243
- parse3.on("end", resolve11);
33254
+ parse3.on("end", resolve10);
33244
33255
  fs__default["default"].stat(file, (er, stat) => {
33245
33256
  if (er)
33246
33257
  reject(er);
@@ -33452,7 +33463,7 @@ var require_index_688c5d50 = __commonJS({
33452
33463
  };
33453
33464
  fs__default["default"].read(fd, headBuf, 0, 512, position, onread);
33454
33465
  };
33455
- const promise = new Promise((resolve11, reject) => {
33466
+ const promise = new Promise((resolve10, reject) => {
33456
33467
  p2.on("error", reject);
33457
33468
  let flag = "r+";
33458
33469
  const onopen = (er, fd) => {
@@ -33474,7 +33485,7 @@ var require_index_688c5d50 = __commonJS({
33474
33485
  });
33475
33486
  p2.pipe(stream);
33476
33487
  stream.on("error", reject);
33477
- stream.on("close", resolve11);
33488
+ stream.on("close", resolve10);
33478
33489
  addFilesAsync(p2, files);
33479
33490
  });
33480
33491
  });
@@ -33551,7 +33562,7 @@ var require_index_688c5d50 = __commonJS({
33551
33562
  };
33552
33563
  var optsArg_1 = optsArg;
33553
33564
  var platform$2 = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
33554
- var { resolve: resolve10, parse: parse$3 } = path__default["default"];
33565
+ var { resolve: resolve9, parse: parse$3 } = path__default["default"];
33555
33566
  var pathArg = (path4) => {
33556
33567
  if (/\0/.test(path4)) {
33557
33568
  throw Object.assign(
@@ -33562,7 +33573,7 @@ var require_index_688c5d50 = __commonJS({
33562
33573
  }
33563
33574
  );
33564
33575
  }
33565
- path4 = resolve10(path4);
33576
+ path4 = resolve9(path4);
33566
33577
  if (platform$2 === "win32") {
33567
33578
  const badWinChars = /[*|"<>?:]/;
33568
33579
  const { root } = parse$3(path4);
@@ -33992,8 +34003,8 @@ var require_index_688c5d50 = __commonJS({
33992
34003
  var pathReservations = () => {
33993
34004
  const queues = /* @__PURE__ */ new Map();
33994
34005
  const reservations = /* @__PURE__ */ new Map();
33995
- const { join: join5 } = path__default["default"];
33996
- const getDirs = (path4) => join5(path4).split(/[\\/]/).slice(0, -1).reduce((set, path5) => set.length ? set.concat(join5(set[set.length - 1], path5)) : [path5], []);
34006
+ const { join: join6 } = path__default["default"];
34007
+ const getDirs = (path4) => join6(path4).split(/[\\/]/).slice(0, -1).reduce((set, path5) => set.length ? set.concat(join6(set[set.length - 1], path5)) : [path5], []);
33997
34008
  const running = /* @__PURE__ */ new Set();
33998
34009
  const getQueues = (fn) => {
33999
34010
  const res = reservations.get(fn);
@@ -34641,9 +34652,9 @@ var require_index_688c5d50 = __commonJS({
34641
34652
  const u = new unpack(opt);
34642
34653
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
34643
34654
  const file = opt.file;
34644
- const p2 = new Promise((resolve11, reject) => {
34655
+ const p2 = new Promise((resolve10, reject) => {
34645
34656
  u.on("error", reject);
34646
- u.on("close", resolve11);
34657
+ u.on("close", resolve10);
34647
34658
  fs__default["default"].stat(file, (er, stat) => {
34648
34659
  if (er)
34649
34660
  reject(er);
@@ -34674,7 +34685,7 @@ var require_index_688c5d50 = __commonJS({
34674
34685
  exports3.WriteEntry = writeEntry;
34675
34686
  exports3.Header = header;
34676
34687
  exports3.Pax = pax;
34677
- exports3.types = types;
34688
+ exports3.types = types2;
34678
34689
  });
34679
34690
  var colorName = {
34680
34691
  "aliceblue": [240, 248, 255],
@@ -40028,12 +40039,12 @@ var require_index_688c5d50 = __commonJS({
40028
40039
  });
40029
40040
  function promisify(fn) {
40030
40041
  return function(req, opts) {
40031
- return new Promise((resolve11, reject) => {
40042
+ return new Promise((resolve10, reject) => {
40032
40043
  fn.call(this, req, opts, (err, rtn) => {
40033
40044
  if (err) {
40034
40045
  reject(err);
40035
40046
  } else {
40036
- resolve11(rtn);
40047
+ resolve10(rtn);
40037
40048
  }
40038
40049
  });
40039
40050
  });
@@ -40224,7 +40235,7 @@ var require_index_688c5d50 = __commonJS({
40224
40235
  var debug_1$1 = __importDefault$2(src$1);
40225
40236
  var debug$1 = debug_1$1.default("https-proxy-agent:parse-proxy-response");
40226
40237
  function parseProxyResponse(socket) {
40227
- return new Promise((resolve11, reject) => {
40238
+ return new Promise((resolve10, reject) => {
40228
40239
  let buffersLength = 0;
40229
40240
  const buffers = [];
40230
40241
  function read() {
@@ -40264,7 +40275,7 @@ var require_index_688c5d50 = __commonJS({
40264
40275
  const firstLine = buffered.toString("ascii", 0, buffered.indexOf("\r\n"));
40265
40276
  const statusCode = +firstLine.split(" ")[1];
40266
40277
  debug$1("got proxy server response: %o", firstLine);
40267
- resolve11({
40278
+ resolve10({
40268
40279
  statusCode,
40269
40280
  buffered
40270
40281
  });
@@ -40281,11 +40292,11 @@ var require_index_688c5d50 = __commonJS({
40281
40292
  }, "__esModule", { value: true });
40282
40293
  var __awaiter2 = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) {
40283
40294
  function adopt(value) {
40284
- return value instanceof P2 ? value : new P2(function(resolve11) {
40285
- resolve11(value);
40295
+ return value instanceof P2 ? value : new P2(function(resolve10) {
40296
+ resolve10(value);
40286
40297
  });
40287
40298
  }
40288
- return new (P2 || (P2 = Promise))(function(resolve11, reject) {
40299
+ return new (P2 || (P2 = Promise))(function(resolve10, reject) {
40289
40300
  function fulfilled(value) {
40290
40301
  try {
40291
40302
  step(generator.next(value));
@@ -40301,7 +40312,7 @@ var require_index_688c5d50 = __commonJS({
40301
40312
  }
40302
40313
  }
40303
40314
  function step(result) {
40304
- result.done ? resolve11(result.value) : adopt(result.value).then(fulfilled, rejected);
40315
+ result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
40305
40316
  }
40306
40317
  step((generator = generator.apply(thisArg, _arguments || [])).next());
40307
40318
  });
@@ -40937,6 +40948,19 @@ var require_dist = __commonJS({
40937
40948
  }
40938
40949
  });
40939
40950
 
40951
+ // src/validators.ts
40952
+ var TEMPLATE_REGEX, validateTemplateUrl;
40953
+ var init_validators = __esm({
40954
+ "src/validators.ts"() {
40955
+ TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
40956
+ validateTemplateUrl = (value) => {
40957
+ if (!String(value).match(TEMPLATE_REGEX)) {
40958
+ return "Please enter a valid template url.";
40959
+ }
40960
+ };
40961
+ }
40962
+ });
40963
+
40940
40964
  // templates/angular/c3.ts
40941
40965
  var c3_exports = {};
40942
40966
  __export(c3_exports, {
@@ -41194,283 +41218,6 @@ var init_c35 = __esm({
41194
41218
  }
41195
41219
  });
41196
41220
 
41197
- // templates/next/templates.ts
41198
- var handlerCode, apiPagesDirHelloTs, apiPagesDirHelloJs, apiAppDirHelloTs, apiAppDirHelloJs, appDirNotFoundJs, appDirNotFoundTs, nextConfig, envDts, readme;
41199
- var init_templates = __esm({
41200
- "templates/next/templates.ts"() {
41201
- handlerCode = ` let responseText = 'Hello World'
41202
-
41203
- // In the edge runtime you can use Bindings that are available in your application
41204
- // (for more details see:
41205
- // - https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/#use-bindings-in-your-nextjs-application
41206
- // - https://developers.cloudflare.com/pages/functions/bindings/
41207
- // )
41208
- //
41209
- // KV Example:
41210
- // const myKv = process.env.MY_KV
41211
- // await myKv.put('suffix', ' from a KV store!')
41212
- // const suffix = await myKv.get('suffix')
41213
- // responseText += suffix
41214
-
41215
- return new Response(responseText)`;
41216
- apiPagesDirHelloTs = `// Next.js Edge API Routes: https://nextjs.org/docs/pages/building-your-application/routing/api-routes#edge-api-routes
41217
-
41218
- import type { NextRequest } from 'next/server'
41219
-
41220
- export const config = {
41221
- runtime: 'edge',
41222
- }
41223
-
41224
- export default async function handler(req: NextRequest) {
41225
- ${handlerCode}
41226
- }
41227
- `;
41228
- apiPagesDirHelloJs = `// Next.js Edge API Routes: https://nextjs.org/docs/pages/building-your-application/routing/api-routes#edge-api-routes
41229
-
41230
- export const config = {
41231
- runtime: 'edge',
41232
- }
41233
-
41234
- export default async function handler(req) {
41235
- ${handlerCode}
41236
- }
41237
- `;
41238
- apiAppDirHelloTs = `// Next.js Edge API Route Handlers: https://nextjs.org/docs/app/building-your-application/routing/router-handlers#edge-and-nodejs-runtimes
41239
-
41240
- import type { NextRequest } from 'next/server'
41241
-
41242
- export const runtime = 'edge'
41243
-
41244
- export async function GET(request: NextRequest) {
41245
- ${handlerCode}
41246
- }
41247
- `;
41248
- apiAppDirHelloJs = `// Next.js Edge API Route Handlers: https://nextjs.org/docs/app/building-your-application/routing/router-handlers#edge-and-nodejs-runtimes
41249
-
41250
- export const runtime = 'edge'
41251
-
41252
- export async function GET(request) {
41253
- ${handlerCode}
41254
- }
41255
- `;
41256
- appDirNotFoundJs = `export const runtime = "edge";
41257
-
41258
- export default function NotFound() {
41259
- return (
41260
- <>
41261
- <title>404: This page could not be found.</title>
41262
- <div style={styles.error}>
41263
- <div>
41264
- <style
41265
- dangerouslySetInnerHTML={{
41266
- __html: \`body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\`,
41267
- }}
41268
- />
41269
- <h1 className="next-error-h1" style={styles.h1}>
41270
- 404
41271
- </h1>
41272
- <div style={styles.desc}>
41273
- <h2 style={styles.h2}>This page could not be found.</h2>
41274
- </div>
41275
- </div>
41276
- </div>
41277
- </>
41278
- );
41279
- }
41280
-
41281
- const styles = {
41282
- error: {
41283
- fontFamily:
41284
- 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
41285
- height: "100vh",
41286
- textAlign: "center",
41287
- display: "flex",
41288
- flexDirection: "column",
41289
- alignItems: "center",
41290
- justifyContent: "center",
41291
- },
41292
-
41293
- desc: {
41294
- display: "inline-block",
41295
- },
41296
-
41297
- h1: {
41298
- display: "inline-block",
41299
- margin: "0 20px 0 0",
41300
- padding: "0 23px 0 0",
41301
- fontSize: 24,
41302
- fontWeight: 500,
41303
- verticalAlign: "top",
41304
- lineHeight: "49px",
41305
- },
41306
-
41307
- h2: {
41308
- fontSize: 14,
41309
- fontWeight: 400,
41310
- lineHeight: "49px",
41311
- margin: 0,
41312
- },
41313
- };
41314
- `;
41315
- appDirNotFoundTs = `export const runtime = "edge";
41316
-
41317
- export default function NotFound() {
41318
- return (
41319
- <>
41320
- <title>404: This page could not be found.</title>
41321
- <div style={styles.error}>
41322
- <div>
41323
- <style
41324
- dangerouslySetInnerHTML={{
41325
- __html: \`body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\`,
41326
- }}
41327
- />
41328
- <h1 className="next-error-h1" style={styles.h1}>
41329
- 404
41330
- </h1>
41331
- <div style={styles.desc}>
41332
- <h2 style={styles.h2}>This page could not be found.</h2>
41333
- </div>
41334
- </div>
41335
- </div>
41336
- </>
41337
- );
41338
- }
41339
-
41340
- const styles = {
41341
- error: {
41342
- fontFamily:
41343
- 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
41344
- height: "100vh",
41345
- textAlign: "center",
41346
- display: "flex",
41347
- flexDirection: "column",
41348
- alignItems: "center",
41349
- justifyContent: "center",
41350
- },
41351
-
41352
- desc: {
41353
- display: "inline-block",
41354
- },
41355
-
41356
- h1: {
41357
- display: "inline-block",
41358
- margin: "0 20px 0 0",
41359
- padding: "0 23px 0 0",
41360
- fontSize: 24,
41361
- fontWeight: 500,
41362
- verticalAlign: "top",
41363
- lineHeight: "49px",
41364
- },
41365
-
41366
- h2: {
41367
- fontSize: 14,
41368
- fontWeight: 400,
41369
- lineHeight: "49px",
41370
- margin: 0,
41371
- },
41372
- } as const;
41373
- `;
41374
- nextConfig = `/** @type {import('next').NextConfig} */
41375
- const nextConfig = {}
41376
-
41377
- module.exports = nextConfig
41378
-
41379
- // Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
41380
- // (when running the application with \`next dev\`), for more information see:
41381
- // https://github.com/dario-piotrowicz/next-on-pages/blob/8e93067/internal-packages/next-dev/README.md
41382
- if (process.env.NODE_ENV === 'development') {
41383
- import('@cloudflare/next-on-pages/next-dev').then(({ setupDevBindings }) => {
41384
- setupDevBindings({
41385
- bindings: {
41386
- // Add here the Cloudflare Bindings you want to have available during local development,
41387
- // for more details on Bindings see: https://developers.cloudflare.com/pages/functions/bindings/)
41388
- //
41389
- // KV Example:
41390
- // MY_KV: {
41391
- // type: 'kv',
41392
- // id: 'xxx',
41393
- // }
41394
- }
41395
- })
41396
- })
41397
- }
41398
- `;
41399
- envDts = `declare global {
41400
- namespace NodeJS {
41401
- interface ProcessEnv {
41402
- // Add here the Cloudflare Bindings you want to have available in your application
41403
- // (for more details on Bindings see: https://developers.cloudflare.com/pages/functions/bindings/)
41404
- //
41405
- // KV Example:
41406
- // MY_KV: KVNamespace
41407
- }
41408
- }
41409
- }
41410
-
41411
- export {}
41412
- `;
41413
- readme = `This is a [Next.js](https://nextjs.org/) project bootstrapped with [\`c3\`](https://developers.cloudflare.com/pages/get-started/c3).
41414
-
41415
- ## Getting Started
41416
-
41417
- First, run the development server:
41418
-
41419
- \`\`\`bash
41420
- npm run dev
41421
- # or
41422
- yarn dev
41423
- # or
41424
- pnpm dev
41425
- # or
41426
- bun dev
41427
- \`\`\`
41428
-
41429
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
41430
-
41431
- ## Cloudflare integration
41432
-
41433
- Besides the \`dev\` script mentioned above \`c3\` has added a few extra scripts that allow you to integrate the application with the [Cloudflare Pages](https://pages.cloudflare.com/) environment, these are:
41434
- - \`pages:build\` to build the application for Pages using the [\`@cloudflare/next-on-pages\`](https://github.com/cloudflare/next-on-pages) CLI
41435
- - \`pages:preview\` to locally preview your Pages application using the [Wrangler](https://developers.cloudflare.com/workers/wrangler/) CLI
41436
- - \`pages:deploy\` to deploy your Pages application using the [Wrangler](https://developers.cloudflare.com/workers/wrangler/) CLI
41437
-
41438
- > __Note:__ while the \`dev\` script is optimal for local development you should preview your Pages application as well (periodically or before deployments) in order to make sure that it can properly work in the Pages environment (for more details see the [\`@cloudflare/next-on-pages\` recommended workflow](https://github.com/cloudflare/next-on-pages/blob/05b6256/internal-packages/next-dev/README.md#recommended-workflow))
41439
-
41440
- ### Bindings
41441
-
41442
- Cloudflare [Bindings](https://developers.cloudflare.com/pages/functions/bindings/) are what allows you to interact with resources available in the Cloudflare Platform.
41443
-
41444
- You can use bindings during development, when previewing locally your application and of course in the deployed application:
41445
-
41446
- - To use bindings in dev mode you need to define them in the \`next.config.js\` file under \`setupDevBindings\`, this mode uses the \`next-dev\` \`@cloudflare/next-on-pages\` submodule. For more details see its [documentation](https://github.com/cloudflare/next-on-pages/blob/05b6256/internal-packages/next-dev/README.md).
41447
-
41448
- - To use bindings in the preview mode you need to add them to the \`pages:preview\` script accordingly to the \`wrangler pages dev\` command. For more details see its [documentation](https://developers.cloudflare.com/workers/wrangler/commands/#dev-1) or the [Pages Bindings documentation](https://developers.cloudflare.com/pages/functions/bindings/).
41449
-
41450
- - To use bindings in the deployed application you will need to configure them in the Cloudflare [dashboard](https://dash.cloudflare.com/). For more details see the [Pages Bindings documentation](https://developers.cloudflare.com/pages/functions/bindings/).
41451
-
41452
- #### KV Example
41453
-
41454
- \`c3\` has added for you an example showing how you can use a KV binding, in order to enable the example, search for lines containing the following comment:
41455
- \`\`\`ts
41456
- // KV Example:
41457
- \`\`\`
41458
-
41459
- and uncomment the commented lines below it.
41460
-
41461
- After doing this you can run the \`dev\` script and visit the \`/api/hello\` route to see the example in action.
41462
-
41463
- To then enable such example also in preview mode add a \`kv\` in the \`pages:preview\` script like so:
41464
- \`\`\`diff
41465
- - "pages:preview": "npm run pages:build && wrangler pages dev .vercel/output/static --compatibility-date=2023-12-18 --compatibility-flag=nodejs_compat",
41466
- + "pages:preview": "npm run pages:build && wrangler pages dev .vercel/output/static --compatibility-date=2023-12-18 --compatibility-flag=nodejs_compat --kv MY_KV",
41467
- \`\`\`
41468
-
41469
- Finally, if you also want to see the example work in the deployed application make sure to add a \`MY_KV\` binding to your Pages application in its [dashboard kv bindings settings section](https://dash.cloudflare.com/?to=/:account/pages/view/:pages-project/settings/functions#kv_namespace_bindings_section). After having configured it make sure to re-deploy your application.
41470
- `;
41471
- }
41472
- });
41473
-
41474
41221
  // templates/next/c3.ts
41475
41222
  var c3_exports6 = {};
41476
41223
  __export(c3_exports6, {
@@ -41478,31 +41225,22 @@ __export(c3_exports6, {
41478
41225
  shouldInstallNextOnPagesEslintPlugin: () => shouldInstallNextOnPagesEslintPlugin,
41479
41226
  writeEslintrc: () => writeEslintrc
41480
41227
  });
41481
- var import_fs9, npm6, npx3, generate6, getApiTemplate, configure3, shouldInstallNextOnPagesEslintPlugin, writeEslintrc, addDevDependencies, c3_default6;
41228
+ var import_path9, npm6, npx3, generate6, configure3, shouldInstallNextOnPagesEslintPlugin, writeEslintrc, addDevDependencies, c3_default6;
41482
41229
  var init_c36 = __esm({
41483
41230
  "templates/next/c3.ts"() {
41484
- import_fs9 = require("fs");
41231
+ import_path9 = require("path");
41485
41232
  init_cli();
41486
41233
  init_args();
41487
41234
  init_colors();
41488
41235
  init_command();
41489
41236
  init_files();
41490
41237
  init_packages();
41491
- init_templates();
41238
+ init_templates2();
41492
41239
  ({ npm: npm6, npx: npx3 } = detectPackageManager());
41493
41240
  generate6 = async (ctx) => {
41494
41241
  const projectName = ctx.project.name;
41495
41242
  await runFrameworkGenerator(ctx, [projectName]);
41496
41243
  };
41497
- getApiTemplate = (apiPath, isTypescript) => {
41498
- const isAppDir = /\/app\/api$/.test(apiPath);
41499
- if (isAppDir) {
41500
- const routeHandlerPath = `${apiPath}/hello`;
41501
- (0, import_fs9.mkdirSync)(routeHandlerPath, { recursive: true });
41502
- return isTypescript ? [`${routeHandlerPath}/route.ts`, apiAppDirHelloTs] : [`${routeHandlerPath}/route.js`, apiAppDirHelloJs];
41503
- }
41504
- return isTypescript ? [`${apiPath}/hello.ts`, apiPagesDirHelloTs] : [`${apiPath}/hello.js`, apiPagesDirHelloJs];
41505
- };
41506
41244
  configure3 = async (ctx) => {
41507
41245
  const projectPath = ctx.project.path;
41508
41246
  const path3 = probePaths([
@@ -41516,37 +41254,27 @@ var init_c36 = __esm({
41516
41254
  if (!path3) {
41517
41255
  crash("Could not find the `/api` or `/app` directory");
41518
41256
  }
41519
- const apiPath = path3.replace(/\/app$/, "/app/api");
41520
41257
  const usesTs = usesTypescript(ctx);
41521
- const appDirPath = probePaths([
41522
- `${projectPath}/src/app`,
41523
- `${projectPath}/app`
41524
- ]);
41525
- if (appDirPath) {
41526
- const notFoundPath = `${appDirPath}/not-found.${usesTs ? "tsx" : "js"}`;
41527
- if (!(0, import_fs9.existsSync)(notFoundPath)) {
41528
- const notFoundContent = usesTs ? appDirNotFoundTs : appDirNotFoundJs;
41529
- writeFile2(notFoundPath, notFoundContent);
41530
- updateStatus("Created a custom edge not-found route");
41531
- }
41532
- }
41533
- const [handlerPath, handlerFile] = getApiTemplate(
41534
- apiPath,
41535
- usesTypescript(ctx)
41536
- );
41537
- writeFile2(handlerPath, handlerFile);
41538
- updateStatus("Created an example API route handler");
41539
41258
  if (usesTs) {
41540
- writeFile2(`${projectPath}/env.d.ts`, envDts);
41259
+ copyFile(
41260
+ (0, import_path9.join)(getTemplatePath(ctx), "env.d.ts"),
41261
+ (0, import_path9.join)(projectPath, "env.d.ts")
41262
+ );
41541
41263
  updateStatus("Created an env.d.ts file");
41542
41264
  }
41543
41265
  const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
41544
41266
  if (installEslintPlugin) {
41545
41267
  await writeEslintrc(ctx);
41546
41268
  }
41547
- writeFile2(`${projectPath}/next.config.js`, nextConfig);
41548
- updateStatus("Updated the next.config.js file");
41549
- writeFile2(`${projectPath}/README.md`, readme);
41269
+ copyFile(
41270
+ (0, import_path9.join)(getTemplatePath(ctx), "next.config.mjs"),
41271
+ (0, import_path9.join)(projectPath, "next.config.mjs")
41272
+ );
41273
+ updateStatus("Updated the next.config.mjs file");
41274
+ copyFile(
41275
+ (0, import_path9.join)(getTemplatePath(ctx), "README.md"),
41276
+ (0, import_path9.join)(projectPath, "README.md")
41277
+ );
41550
41278
  updateStatus("Updated the README file");
41551
41279
  await addDevDependencies(installEslintPlugin);
41552
41280
  };
@@ -41600,6 +41328,35 @@ var init_c36 = __esm({
41600
41328
  previewScript: "pages:preview",
41601
41329
  generate: generate6,
41602
41330
  configure: configure3,
41331
+ copyFiles: {
41332
+ async selectVariant(ctx) {
41333
+ const isApp = probePaths([
41334
+ `${ctx.project.path}/src/app`,
41335
+ `${ctx.project.path}/app`
41336
+ ]);
41337
+ const isTypescript = usesTypescript(ctx);
41338
+ const dir = isApp ? "app" : "pages";
41339
+ return `${dir}/${isTypescript ? "ts" : "js"}`;
41340
+ },
41341
+ destinationDir(ctx) {
41342
+ const srcPath = probePaths([`${ctx.project.path}/src`]);
41343
+ return srcPath ? "./src" : "./";
41344
+ },
41345
+ variants: {
41346
+ "app/ts": {
41347
+ path: "./app/ts"
41348
+ },
41349
+ "app/js": {
41350
+ path: "./app/js"
41351
+ },
41352
+ "pages/ts": {
41353
+ path: "./pages/ts"
41354
+ },
41355
+ "pages/js": {
41356
+ path: "./pages/js"
41357
+ }
41358
+ }
41359
+ },
41603
41360
  transformPackageJson: async () => {
41604
41361
  const isNpm = npm6 === "npm";
41605
41362
  const isBun = npm6 === "bun";
@@ -41631,219 +41388,6 @@ var init_c36 = __esm({
41631
41388
  }
41632
41389
  });
41633
41390
 
41634
- // templates/nuxt/c3.ts
41635
- var c3_exports7 = {};
41636
- __export(c3_exports7, {
41637
- default: () => c3_default7
41638
- });
41639
- var import_node_fs, import_node_path2, npm7, generate7, configure4, config6, c3_default7;
41640
- var init_c37 = __esm({
41641
- "templates/nuxt/c3.ts"() {
41642
- import_node_fs = require("node:fs");
41643
- import_node_path2 = require("node:path");
41644
- init_cli();
41645
- init_colors();
41646
- init_interactive();
41647
- init_command();
41648
- init_files();
41649
- init_packages();
41650
- ({ npm: npm7 } = detectPackageManager());
41651
- generate7 = async (ctx) => {
41652
- const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
41653
- await runFrameworkGenerator(ctx, [
41654
- "init",
41655
- ctx.project.name,
41656
- "--packageManager",
41657
- npm7,
41658
- gitFlag
41659
- ]);
41660
- writeFile2("./.node-version", "17");
41661
- logRaw("");
41662
- };
41663
- configure4 = async () => {
41664
- const configFileName = "nuxt.config.ts";
41665
- const configFilePath = (0, import_node_path2.resolve)(configFileName);
41666
- const s = spinner();
41667
- s.start(`Updating \`${configFileName}\``);
41668
- const originalConfigFile = (0, import_node_fs.readFileSync)(configFilePath, "utf8");
41669
- const updatedConfigFile = originalConfigFile.replace(
41670
- "defineNuxtConfig({",
41671
- "defineNuxtConfig({\n nitro: {\n preset: 'cloudflare-pages'\n },"
41672
- );
41673
- writeFile2(configFilePath, updatedConfigFile);
41674
- s.stop(`${brandColor(`updated`)} ${dim(`\`${configFileName}\``)}`);
41675
- };
41676
- config6 = {
41677
- configVersion: 1,
41678
- id: "nuxt",
41679
- platform: "pages",
41680
- displayName: "Nuxt",
41681
- generate: generate7,
41682
- configure: configure4,
41683
- transformPackageJson: async () => ({
41684
- scripts: {
41685
- "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm7} run dev`,
41686
- "pages:deploy": `${npm7} run build && wrangler pages deploy ./dist`
41687
- }
41688
- })
41689
- };
41690
- c3_default7 = config6;
41691
- }
41692
- });
41693
-
41694
- // templates/qwik/c3.ts
41695
- var c3_exports8 = {};
41696
- __export(c3_exports8, {
41697
- default: () => c3_default8
41698
- });
41699
- var npm8, npx4, generate8, configure5, config7, c3_default8;
41700
- var init_c38 = __esm({
41701
- "templates/qwik/c3.ts"() {
41702
- init_cli();
41703
- init_command();
41704
- init_files();
41705
- init_packages();
41706
- init_common2();
41707
- ({ npm: npm8, npx: npx4 } = detectPackageManager());
41708
- generate8 = async (ctx) => {
41709
- await runFrameworkGenerator(ctx, ["basic", ctx.project.name]);
41710
- };
41711
- configure5 = async () => {
41712
- const cmd = [npx4, "qwik", "add", "cloudflare-pages"];
41713
- endSection(`Running ${quoteShellArgs(cmd)}`);
41714
- await runCommand(cmd);
41715
- };
41716
- config7 = {
41717
- configVersion: 1,
41718
- id: "qwik",
41719
- displayName: "Qwik",
41720
- platform: "pages",
41721
- generate: generate8,
41722
- configure: configure5,
41723
- transformPackageJson: async () => ({
41724
- scripts: {
41725
- "pages:dev": `wrangler pages dev ${await compatDateFlag()} -- ${npm8} run dev`,
41726
- "pages:deploy": `${npm8} run build && wrangler pages deploy ./dist`
41727
- }
41728
- })
41729
- };
41730
- c3_default8 = config7;
41731
- }
41732
- });
41733
-
41734
- // templates/react/c3.ts
41735
- var c3_exports9 = {};
41736
- __export(c3_exports9, {
41737
- default: () => c3_default9
41738
- });
41739
- var npm9, generate9, config8, c3_default9;
41740
- var init_c39 = __esm({
41741
- "templates/react/c3.ts"() {
41742
- init_cli();
41743
- init_command();
41744
- init_files();
41745
- init_packages();
41746
- ({ npm: npm9 } = detectPackageManager());
41747
- generate9 = async (ctx) => {
41748
- await runFrameworkGenerator(ctx, [ctx.project.name]);
41749
- logRaw("");
41750
- };
41751
- config8 = {
41752
- configVersion: 1,
41753
- id: "react",
41754
- displayName: "React",
41755
- platform: "pages",
41756
- generate: generate9,
41757
- transformPackageJson: async () => ({
41758
- scripts: {
41759
- "pages:dev": `wrangler pages dev ${await compatDateFlag()} --port 3000 -- ${npm9} start`,
41760
- "pages:deploy": `${npm9} run build && wrangler pages deploy ./build`
41761
- }
41762
- })
41763
- };
41764
- c3_default9 = config8;
41765
- }
41766
- });
41767
-
41768
- // templates/remix/c3.ts
41769
- var c3_exports10 = {};
41770
- __export(c3_exports10, {
41771
- default: () => c3_default10
41772
- });
41773
- var npm10, generate10, config9, c3_default10;
41774
- var init_c310 = __esm({
41775
- "templates/remix/c3.ts"() {
41776
- init_cli();
41777
- init_command();
41778
- init_packages();
41779
- ({ npm: npm10 } = detectPackageManager());
41780
- generate10 = async (ctx) => {
41781
- await runFrameworkGenerator(ctx, [
41782
- ctx.project.name,
41783
- "--template",
41784
- "https://github.com/remix-run/remix/tree/main/templates/cloudflare-pages"
41785
- ]);
41786
- logRaw("");
41787
- };
41788
- config9 = {
41789
- configVersion: 1,
41790
- id: "remix",
41791
- displayName: "Remix",
41792
- platform: "pages",
41793
- generate: generate10,
41794
- transformPackageJson: async () => ({
41795
- scripts: {
41796
- "pages:deploy": `${npm10} run build && wrangler pages deploy ./public`
41797
- }
41798
- }),
41799
- devScript: "dev",
41800
- testFlags: ["--typescript", "--no-install", "--no-git-init"]
41801
- };
41802
- c3_default10 = config9;
41803
- }
41804
- });
41805
-
41806
- // templates/solid/c3.ts
41807
- var c3_exports11 = {};
41808
- __export(c3_exports11, {
41809
- default: () => c3_default11
41810
- });
41811
- var npm11, generate11, config10, c3_default11;
41812
- var init_c311 = __esm({
41813
- "templates/solid/c3.ts"() {
41814
- init_cli();
41815
- init_command();
41816
- init_files();
41817
- init_packages();
41818
- ({ npm: npm11 } = detectPackageManager());
41819
- generate11 = async (ctx) => {
41820
- await runFrameworkGenerator(ctx, [ctx.project.name]);
41821
- logRaw("");
41822
- };
41823
- config10 = {
41824
- configVersion: 1,
41825
- id: "solid",
41826
- displayName: "Solid",
41827
- platform: "pages",
41828
- copyFiles: {
41829
- js: { path: "./js" },
41830
- ts: { path: "./ts" }
41831
- },
41832
- generate: generate11,
41833
- transformPackageJson: async () => ({
41834
- scripts: {
41835
- "pages:preview": `${npm11} run build && npx wrangler pages dev dist ${await compatDateFlag()} --compatibility-flag nodejs_compat`,
41836
- "pages:deploy": `${npm11} run build && wrangler pages deploy ./dist`
41837
- }
41838
- }),
41839
- devScript: "dev",
41840
- previewScript: "pages:preview",
41841
- compatibilityFlags: ["nodejs_compat"]
41842
- };
41843
- c3_default11 = config10;
41844
- }
41845
- });
41846
-
41847
41391
  // ../../node_modules/.pnpm/tslib@2.5.3/node_modules/tslib/tslib.es6.mjs
41848
41392
  var tslib_es6_exports = {};
41849
41393
  __export(tslib_es6_exports, {
@@ -41979,11 +41523,11 @@ function __metadata(metadataKey, metadataValue) {
41979
41523
  }
41980
41524
  function __awaiter(thisArg, _arguments, P2, generator) {
41981
41525
  function adopt(value) {
41982
- return value instanceof P2 ? value : new P2(function(resolve10) {
41983
- resolve10(value);
41526
+ return value instanceof P2 ? value : new P2(function(resolve9) {
41527
+ resolve9(value);
41984
41528
  });
41985
41529
  }
41986
- return new (P2 || (P2 = Promise))(function(resolve10, reject) {
41530
+ return new (P2 || (P2 = Promise))(function(resolve9, reject) {
41987
41531
  function fulfilled(value) {
41988
41532
  try {
41989
41533
  step(generator.next(value));
@@ -41999,7 +41543,7 @@ function __awaiter(thisArg, _arguments, P2, generator) {
41999
41543
  }
42000
41544
  }
42001
41545
  function step(result) {
42002
- result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
41546
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
42003
41547
  }
42004
41548
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42005
41549
  });
@@ -42205,14 +41749,14 @@ function __asyncValues(o) {
42205
41749
  }, i);
42206
41750
  function verb(n2) {
42207
41751
  i[n2] = o[n2] && function(v2) {
42208
- return new Promise(function(resolve10, reject) {
42209
- v2 = o[n2](v2), settle(resolve10, reject, v2.done, v2.value);
41752
+ return new Promise(function(resolve9, reject) {
41753
+ v2 = o[n2](v2), settle(resolve9, reject, v2.done, v2.value);
42210
41754
  });
42211
41755
  };
42212
41756
  }
42213
- function settle(resolve10, reject, d2, v2) {
41757
+ function settle(resolve9, reject, d2, v2) {
42214
41758
  Promise.resolve(v2).then(function(v3) {
42215
- resolve10({ value: v3, done: d2 });
41759
+ resolve9({ value: v3, done: d2 });
42216
41760
  }, reject);
42217
41761
  }
42218
41762
  }
@@ -42434,9 +41978,9 @@ var require_types = __commonJS({
42434
41978
  /** @class */
42435
41979
  function(_super) {
42436
41980
  (0, tslib_1.__extends)(OrType2, _super);
42437
- function OrType2(types) {
41981
+ function OrType2(types2) {
42438
41982
  var _this = _super.call(this) || this;
42439
- _this.types = types;
41983
+ _this.types = types2;
42440
41984
  _this.kind = "OrType";
42441
41985
  return _this;
42442
41986
  }
@@ -42581,11 +42125,11 @@ var require_types = __commonJS({
42581
42125
  function typesPlugin(_fork) {
42582
42126
  var Type = {
42583
42127
  or: function() {
42584
- var types = [];
42128
+ var types2 = [];
42585
42129
  for (var _i = 0; _i < arguments.length; _i++) {
42586
- types[_i] = arguments[_i];
42130
+ types2[_i] = arguments[_i];
42587
42131
  }
42588
- return new OrType(types.map(function(type) {
42132
+ return new OrType(types2.map(function(type) {
42589
42133
  return Type.from(type);
42590
42134
  }));
42591
42135
  },
@@ -43034,9 +42578,9 @@ var require_path = __commonJS({
43034
42578
  var Op = Object.prototype;
43035
42579
  var hasOwn = Op.hasOwnProperty;
43036
42580
  function pathPlugin(fork) {
43037
- var types = fork.use(types_1.default);
43038
- var isArray = types.builtInTypes.array;
43039
- var isNumber = types.builtInTypes.number;
42581
+ var types2 = fork.use(types_1.default);
42582
+ var isArray = types2.builtInTypes.array;
42583
+ var isNumber = types2.builtInTypes.number;
43040
42584
  var Path = function Path2(value, parentPath, name2) {
43041
42585
  if (!(this instanceof Path2)) {
43042
42586
  throw new Error("Path constructor cannot be invoked without 'new'");
@@ -43336,13 +42880,13 @@ var require_scope = __commonJS({
43336
42880
  var types_1 = (0, tslib_1.__importDefault)(require_types());
43337
42881
  var hasOwn = Object.prototype.hasOwnProperty;
43338
42882
  function scopePlugin(fork) {
43339
- var types = fork.use(types_1.default);
43340
- var Type = types.Type;
43341
- var namedTypes = types.namedTypes;
42883
+ var types2 = fork.use(types_1.default);
42884
+ var Type = types2.Type;
42885
+ var namedTypes = types2.namedTypes;
43342
42886
  var Node = namedTypes.Node;
43343
42887
  var Expression = namedTypes.Expression;
43344
- var isArray = types.builtInTypes.array;
43345
- var b2 = types.builders;
42888
+ var isArray = types2.builtInTypes.array;
42889
+ var b2 = types2.builders;
43346
42890
  var Scope = function Scope2(path3, parentScope) {
43347
42891
  if (!(this instanceof Scope2)) {
43348
42892
  throw new Error("Scope constructor cannot be invoked without 'new'");
@@ -43410,7 +42954,7 @@ var require_scope = __commonJS({
43410
42954
  ++index;
43411
42955
  }
43412
42956
  var name2 = prefix + index;
43413
- return this.bindings[name2] = types.builders.identifier(name2);
42957
+ return this.bindings[name2] = types2.builders.identifier(name2);
43414
42958
  };
43415
42959
  Sp.injectTemporary = function(identifier, init) {
43416
42960
  identifier || (identifier = this.declareTemporary());
@@ -43490,7 +43034,7 @@ var require_scope = __commonJS({
43490
43034
  bindings
43491
43035
  );
43492
43036
  } else if (Node.check(node) && !Expression.check(node)) {
43493
- types.eachField(node, function(name2, child) {
43037
+ types2.eachField(node, function(name2, child) {
43494
43038
  var childPath = path3.get(name2);
43495
43039
  if (!pathHasValue(childPath, child)) {
43496
43040
  throw new Error("");
@@ -43569,24 +43113,24 @@ var require_scope = __commonJS({
43569
43113
  addPattern(patternPath.get("argument"), bindings);
43570
43114
  }
43571
43115
  }
43572
- function addTypePattern(patternPath, types2) {
43116
+ function addTypePattern(patternPath, types3) {
43573
43117
  var pattern = patternPath.value;
43574
43118
  namedTypes.Pattern.assert(pattern);
43575
43119
  if (namedTypes.Identifier.check(pattern)) {
43576
- if (hasOwn.call(types2, pattern.name)) {
43577
- types2[pattern.name].push(patternPath);
43120
+ if (hasOwn.call(types3, pattern.name)) {
43121
+ types3[pattern.name].push(patternPath);
43578
43122
  } else {
43579
- types2[pattern.name] = [patternPath];
43123
+ types3[pattern.name] = [patternPath];
43580
43124
  }
43581
43125
  }
43582
43126
  }
43583
- function addTypeParameter(parameterPath, types2) {
43127
+ function addTypeParameter(parameterPath, types3) {
43584
43128
  var parameter = parameterPath.value;
43585
43129
  FlowOrTSTypeParameterType.assert(parameter);
43586
- if (hasOwn.call(types2, parameter.name)) {
43587
- types2[parameter.name].push(parameterPath);
43130
+ if (hasOwn.call(types3, parameter.name)) {
43131
+ types3[parameter.name].push(parameterPath);
43588
43132
  } else {
43589
- types2[parameter.name] = [parameterPath];
43133
+ types3[parameter.name] = [parameterPath];
43590
43134
  }
43591
43135
  }
43592
43136
  Sp.lookup = function(name2) {
@@ -43624,11 +43168,11 @@ var require_node_path = __commonJS({
43624
43168
  var path_1 = (0, tslib_1.__importDefault)(require_path());
43625
43169
  var scope_1 = (0, tslib_1.__importDefault)(require_scope());
43626
43170
  function nodePathPlugin(fork) {
43627
- var types = fork.use(types_1.default);
43628
- var n2 = types.namedTypes;
43629
- var b2 = types.builders;
43630
- var isNumber = types.builtInTypes.number;
43631
- var isArray = types.builtInTypes.array;
43171
+ var types2 = fork.use(types_1.default);
43172
+ var n2 = types2.namedTypes;
43173
+ var b2 = types2.builders;
43174
+ var isNumber = types2.builtInTypes.number;
43175
+ var isArray = types2.builtInTypes.array;
43632
43176
  var Path = fork.use(path_1.default);
43633
43177
  var Scope = fork.use(scope_1.default);
43634
43178
  var NodePath = function NodePath2(value, parentPath, name2) {
@@ -43719,7 +43263,7 @@ var require_node_path = __commonJS({
43719
43263
  return scope || null;
43720
43264
  };
43721
43265
  NPp.getValueProperty = function(name2) {
43722
- return types.getFieldValue(this.value, name2);
43266
+ return types2.getFieldValue(this.value, name2);
43723
43267
  };
43724
43268
  NPp.needsParens = function(assumeExpressionContext) {
43725
43269
  var pp = this.parentPath;
@@ -43861,7 +43405,7 @@ var require_node_path = __commonJS({
43861
43405
  return node.some(containsCallExpression);
43862
43406
  }
43863
43407
  if (n2.Node.check(node)) {
43864
- return types.someField(node, function(_name, child) {
43408
+ return types2.someField(node, function(_name, child) {
43865
43409
  return containsCallExpression(child);
43866
43410
  });
43867
43411
  }
@@ -43979,11 +43523,11 @@ var require_path_visitor = __commonJS({
43979
43523
  var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
43980
43524
  var hasOwn = Object.prototype.hasOwnProperty;
43981
43525
  function pathVisitorPlugin(fork) {
43982
- var types = fork.use(types_1.default);
43526
+ var types2 = fork.use(types_1.default);
43983
43527
  var NodePath = fork.use(node_path_1.default);
43984
- var isArray = types.builtInTypes.array;
43985
- var isObject2 = types.builtInTypes.object;
43986
- var isFunction2 = types.builtInTypes.function;
43528
+ var isArray = types2.builtInTypes.array;
43529
+ var isObject2 = types2.builtInTypes.object;
43530
+ var isFunction2 = types2.builtInTypes.function;
43987
43531
  var undefined2;
43988
43532
  var PathVisitor = function PathVisitor2() {
43989
43533
  if (!(this instanceof PathVisitor2)) {
@@ -44003,7 +43547,7 @@ var require_path_visitor = __commonJS({
44003
43547
  typeNames[methodName.slice("visit".length)] = true;
44004
43548
  }
44005
43549
  }
44006
- var supertypeTable = types.computeSupertypeLookupTable(typeNames);
43550
+ var supertypeTable = types2.computeSupertypeLookupTable(typeNames);
44007
43551
  var methodNameTable = /* @__PURE__ */ Object.create(null);
44008
43552
  var typeNameKeys = Object.keys(supertypeTable);
44009
43553
  var typeNameCount = typeNameKeys.length;
@@ -44122,7 +43666,7 @@ var require_path_visitor = __commonJS({
44122
43666
  path3.each(visitor.visitWithoutReset, visitor);
44123
43667
  } else if (!isObject2.check(value)) {
44124
43668
  } else {
44125
- var childNames = types.getFieldNames(value);
43669
+ var childNames = types2.getFieldNames(value);
44126
43670
  if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
44127
43671
  childNames.push("comments");
44128
43672
  }
@@ -44131,7 +43675,7 @@ var require_path_visitor = __commonJS({
44131
43675
  for (var i = 0; i < childCount; ++i) {
44132
43676
  var childName = childNames[i];
44133
43677
  if (!hasOwn.call(value, childName)) {
44134
- value[childName] = types.getFieldValue(value, childName);
43678
+ value[childName] = types2.getFieldValue(value, childName);
44135
43679
  }
44136
43680
  childPaths.push(path3.get(childName));
44137
43681
  }
@@ -44271,13 +43815,13 @@ var require_equiv = __commonJS({
44271
43815
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
44272
43816
  var types_1 = (0, tslib_1.__importDefault)(require_types());
44273
43817
  function default_1(fork) {
44274
- var types = fork.use(types_1.default);
44275
- var getFieldNames = types.getFieldNames;
44276
- var getFieldValue = types.getFieldValue;
44277
- var isArray = types.builtInTypes.array;
44278
- var isObject2 = types.builtInTypes.object;
44279
- var isDate = types.builtInTypes.Date;
44280
- var isRegExp = types.builtInTypes.RegExp;
43818
+ var types2 = fork.use(types_1.default);
43819
+ var getFieldNames = types2.getFieldNames;
43820
+ var getFieldValue = types2.getFieldValue;
43821
+ var isArray = types2.builtInTypes.array;
43822
+ var isObject2 = types2.builtInTypes.object;
43823
+ var isDate = types2.builtInTypes.Date;
43824
+ var isRegExp = types2.builtInTypes.RegExp;
44281
43825
  var hasOwn = Object.prototype.hasOwnProperty;
44282
43826
  function astNodesAreEquivalent(a, b2, problemPath) {
44283
43827
  if (isArray.check(problemPath)) {
@@ -44427,24 +43971,24 @@ var require_fork = __commonJS({
44427
43971
  var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
44428
43972
  function default_1(plugins) {
44429
43973
  var fork = createFork();
44430
- var types = fork.use(types_1.default);
43974
+ var types2 = fork.use(types_1.default);
44431
43975
  plugins.forEach(fork.use);
44432
- types.finalize();
43976
+ types2.finalize();
44433
43977
  var PathVisitor = fork.use(path_visitor_1.default);
44434
43978
  return {
44435
- Type: types.Type,
44436
- builtInTypes: types.builtInTypes,
44437
- namedTypes: types.namedTypes,
44438
- builders: types.builders,
44439
- defineMethod: types.defineMethod,
44440
- getFieldNames: types.getFieldNames,
44441
- getFieldValue: types.getFieldValue,
44442
- eachField: types.eachField,
44443
- someField: types.someField,
44444
- getSupertypeNames: types.getSupertypeNames,
44445
- getBuilderName: types.getBuilderName,
43979
+ Type: types2.Type,
43980
+ builtInTypes: types2.builtInTypes,
43981
+ namedTypes: types2.namedTypes,
43982
+ builders: types2.builders,
43983
+ defineMethod: types2.defineMethod,
43984
+ getFieldNames: types2.getFieldNames,
43985
+ getFieldValue: types2.getFieldValue,
43986
+ eachField: types2.eachField,
43987
+ someField: types2.someField,
43988
+ getSupertypeNames: types2.getSupertypeNames,
43989
+ getBuilderName: types2.getBuilderName,
44446
43990
  astNodesAreEquivalent: fork.use(equiv_1.default),
44447
- finalize: types.finalize,
43991
+ finalize: types2.finalize,
44448
43992
  Path: fork.use(path_1.default),
44449
43993
  NodePath: fork.use(node_path_1.default),
44450
43994
  PathVisitor,
@@ -44480,9 +44024,9 @@ var require_shared = __commonJS({
44480
44024
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
44481
44025
  var types_1 = (0, tslib_1.__importDefault)(require_types());
44482
44026
  function default_1(fork) {
44483
- var types = fork.use(types_1.default);
44484
- var Type = types.Type;
44485
- var builtin = types.builtInTypes;
44027
+ var types2 = fork.use(types_1.default);
44028
+ var Type = types2.Type;
44029
+ var builtin = types2.builtInTypes;
44486
44030
  var isNumber = builtin.number;
44487
44031
  function geq(than) {
44488
44032
  return Type.from(function(value) {
@@ -44661,8 +44205,8 @@ var require_core2 = __commonJS({
44661
44205
  var types_1 = (0, tslib_1.__importDefault)(require_types());
44662
44206
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
44663
44207
  function default_1(fork) {
44664
- var types = fork.use(types_1.default);
44665
- var Type = types.Type;
44208
+ var types2 = fork.use(types_1.default);
44209
+ var Type = types2.Type;
44666
44210
  var def = Type.def;
44667
44211
  var or = Type.or;
44668
44212
  var shared = fork.use(shared_1.default);
@@ -44752,9 +44296,9 @@ var require_es6 = __commonJS({
44752
44296
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
44753
44297
  function default_1(fork) {
44754
44298
  fork.use(core_1.default);
44755
- var types = fork.use(types_1.default);
44756
- var def = types.Type.def;
44757
- var or = types.Type.or;
44299
+ var types2 = fork.use(types_1.default);
44300
+ var def = types2.Type.def;
44301
+ var or = types2.Type.or;
44758
44302
  var defaults = fork.use(shared_1.default).defaults;
44759
44303
  def("Function").field("generator", Boolean, defaults["false"]).field("expression", Boolean, defaults["false"]).field("defaults", [or(def("Expression"), null)], defaults.emptyArray).field("rest", or(def("Identifier"), null), defaults["null"]);
44760
44304
  def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
@@ -44840,8 +44384,8 @@ var require_es2017 = __commonJS({
44840
44384
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
44841
44385
  function default_1(fork) {
44842
44386
  fork.use(es2016_1.default);
44843
- var types = fork.use(types_1.default);
44844
- var def = types.Type.def;
44387
+ var types2 = fork.use(types_1.default);
44388
+ var def = types2.Type.def;
44845
44389
  var defaults = fork.use(shared_1.default).defaults;
44846
44390
  def("Function").field("async", Boolean, defaults["false"]);
44847
44391
  def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
@@ -44862,9 +44406,9 @@ var require_es2018 = __commonJS({
44862
44406
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
44863
44407
  function default_1(fork) {
44864
44408
  fork.use(es2017_1.default);
44865
- var types = fork.use(types_1.default);
44866
- var def = types.Type.def;
44867
- var or = types.Type.or;
44409
+ var types2 = fork.use(types_1.default);
44410
+ var def = types2.Type.def;
44411
+ var or = types2.Type.or;
44868
44412
  var defaults = fork.use(shared_1.default).defaults;
44869
44413
  def("ForOfStatement").field("await", Boolean, defaults["false"]);
44870
44414
  def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
@@ -44894,9 +44438,9 @@ var require_es2019 = __commonJS({
44894
44438
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
44895
44439
  function default_1(fork) {
44896
44440
  fork.use(es2018_1.default);
44897
- var types = fork.use(types_1.default);
44898
- var def = types.Type.def;
44899
- var or = types.Type.or;
44441
+ var types2 = fork.use(types_1.default);
44442
+ var def = types2.Type.def;
44443
+ var or = types2.Type.or;
44900
44444
  var defaults = fork.use(shared_1.default).defaults;
44901
44445
  def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
44902
44446
  }
@@ -44918,9 +44462,9 @@ var require_es20202 = __commonJS({
44918
44462
  function default_1(fork) {
44919
44463
  fork.use(es2020_1.default);
44920
44464
  fork.use(es2019_1.default);
44921
- var types = fork.use(types_1.default);
44922
- var def = types.Type.def;
44923
- var or = types.Type.or;
44465
+ var types2 = fork.use(types_1.default);
44466
+ var def = types2.Type.def;
44467
+ var or = types2.Type.or;
44924
44468
  var shared = fork.use(shared_1.default);
44925
44469
  var defaults = shared.defaults;
44926
44470
  def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
@@ -44964,8 +44508,8 @@ var require_es2022 = __commonJS({
44964
44508
  var types_1 = (0, tslib_1.__importDefault)(require_types());
44965
44509
  function default_1(fork) {
44966
44510
  fork.use(es2021_1.default);
44967
- var types = fork.use(types_1.default);
44968
- var def = types.Type.def;
44511
+ var types2 = fork.use(types_1.default);
44512
+ var def = types2.Type.def;
44969
44513
  def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
44970
44514
  }
44971
44515
  exports2.default = default_1;
@@ -44984,9 +44528,9 @@ var require_es_proposals = __commonJS({
44984
44528
  var es2022_1 = (0, tslib_1.__importDefault)(require_es2022());
44985
44529
  function default_1(fork) {
44986
44530
  fork.use(es2022_1.default);
44987
- var types = fork.use(types_1.default);
44988
- var Type = types.Type;
44989
- var def = types.Type.def;
44531
+ var types2 = fork.use(types_1.default);
44532
+ var Type = types2.Type;
44533
+ var def = types2.Type.def;
44990
44534
  var or = Type.or;
44991
44535
  var shared = fork.use(shared_1.default);
44992
44536
  var defaults = shared.defaults;
@@ -45024,9 +44568,9 @@ var require_jsx = __commonJS({
45024
44568
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
45025
44569
  function default_1(fork) {
45026
44570
  fork.use(es_proposals_1.default);
45027
- var types = fork.use(types_1.default);
45028
- var def = types.Type.def;
45029
- var or = types.Type.or;
44571
+ var types2 = fork.use(types_1.default);
44572
+ var def = types2.Type.def;
44573
+ var or = types2.Type.or;
45030
44574
  var defaults = fork.use(shared_1.default).defaults;
45031
44575
  def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
45032
44576
  def("Literal"),
@@ -45088,9 +44632,9 @@ var require_type_annotations = __commonJS({
45088
44632
  var types_1 = (0, tslib_1.__importDefault)(require_types());
45089
44633
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
45090
44634
  function default_1(fork) {
45091
- var types = fork.use(types_1.default);
45092
- var def = types.Type.def;
45093
- var or = types.Type.or;
44635
+ var types2 = fork.use(types_1.default);
44636
+ var def = types2.Type.def;
44637
+ var or = types2.Type.or;
45094
44638
  var defaults = fork.use(shared_1.default).defaults;
45095
44639
  var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
45096
44640
  var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
@@ -45123,9 +44667,9 @@ var require_flow = __commonJS({
45123
44667
  function default_1(fork) {
45124
44668
  fork.use(es_proposals_1.default);
45125
44669
  fork.use(type_annotations_1.default);
45126
- var types = fork.use(types_1.default);
45127
- var def = types.Type.def;
45128
- var or = types.Type.or;
44670
+ var types2 = fork.use(types_1.default);
44671
+ var def = types2.Type.def;
44672
+ var or = types2.Type.or;
45129
44673
  var defaults = fork.use(shared_1.default).defaults;
45130
44674
  def("Flow").bases("Node");
45131
44675
  def("FlowType").bases("Flow");
@@ -45240,10 +44784,10 @@ var require_esprima = __commonJS({
45240
44784
  var shared_1 = (0, tslib_1.__importDefault)(require_shared());
45241
44785
  function default_1(fork) {
45242
44786
  fork.use(es_proposals_1.default);
45243
- var types = fork.use(types_1.default);
44787
+ var types2 = fork.use(types_1.default);
45244
44788
  var defaults = fork.use(shared_1.default).defaults;
45245
- var def = types.Type.def;
45246
- var or = types.Type.or;
44789
+ var def = types2.Type.def;
44790
+ var or = types2.Type.or;
45247
44791
  def("VariableDeclaration").field("declarations", [or(
45248
44792
  def("VariableDeclarator"),
45249
44793
  def("Identifier")
@@ -45300,11 +44844,11 @@ var require_babel_core = __commonJS({
45300
44844
  function default_1(fork) {
45301
44845
  var _a2, _b2, _c2, _d, _e;
45302
44846
  fork.use(es_proposals_1.default);
45303
- var types = fork.use(types_1.default);
44847
+ var types2 = fork.use(types_1.default);
45304
44848
  var defaults = fork.use(shared_1.default).defaults;
45305
- var def = types.Type.def;
45306
- var or = types.Type.or;
45307
- var isUndefined = types.builtInTypes.undefined;
44849
+ var def = types2.Type.def;
44850
+ var or = types2.Type.or;
44851
+ var isUndefined = types2.builtInTypes.undefined;
45308
44852
  def("Noop").bases("Statement").build();
45309
44853
  def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
45310
44854
  def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
@@ -45339,7 +44883,7 @@ var require_babel_core = __commonJS({
45339
44883
  raw: String
45340
44884
  },
45341
44885
  function getDefault() {
45342
- var value = types.getFieldValue(this, "value");
44886
+ var value = types2.getFieldValue(this, "value");
45343
44887
  return {
45344
44888
  rawValue: value,
45345
44889
  raw: toRaw ? toRaw(value) : String(value)
@@ -45430,8 +44974,8 @@ var require_babel = __commonJS({
45430
44974
  var babel_core_1 = (0, tslib_1.__importDefault)(require_babel_core());
45431
44975
  var flow_1 = (0, tslib_1.__importDefault)(require_flow());
45432
44976
  function default_1(fork) {
45433
- var types = fork.use(types_1.default);
45434
- var def = types.Type.def;
44977
+ var types2 = fork.use(types_1.default);
44978
+ var def = types2.Type.def;
45435
44979
  fork.use(babel_core_1.default);
45436
44980
  fork.use(flow_1.default);
45437
44981
  def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
@@ -45455,12 +44999,12 @@ var require_typescript = __commonJS({
45455
44999
  function default_1(fork) {
45456
45000
  fork.use(babel_core_1.default);
45457
45001
  fork.use(type_annotations_1.default);
45458
- var types = fork.use(types_1.default);
45459
- var n2 = types.namedTypes;
45460
- var def = types.Type.def;
45461
- var or = types.Type.or;
45002
+ var types2 = fork.use(types_1.default);
45003
+ var n2 = types2.namedTypes;
45004
+ var def = types2.Type.def;
45005
+ var or = types2.Type.or;
45462
45006
  var defaults = fork.use(shared_1.default).defaults;
45463
- var StringLiteral = types.Type.from(function(value, deep) {
45007
+ var StringLiteral = types2.Type.from(function(value, deep) {
45464
45008
  if (n2.StringLiteral && n2.StringLiteral.check(value, deep)) {
45465
45009
  return true;
45466
45010
  }
@@ -45865,7 +45409,7 @@ var require_util8 = __commonJS({
45865
45409
  return path3;
45866
45410
  }
45867
45411
  exports2.normalize = normalize2;
45868
- function join5(aRoot, aPath) {
45412
+ function join6(aRoot, aPath) {
45869
45413
  if (aRoot === "") {
45870
45414
  aRoot = ".";
45871
45415
  }
@@ -45897,7 +45441,7 @@ var require_util8 = __commonJS({
45897
45441
  }
45898
45442
  return joined;
45899
45443
  }
45900
- exports2.join = join5;
45444
+ exports2.join = join6;
45901
45445
  exports2.isAbsolute = function(aPath) {
45902
45446
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
45903
45447
  };
@@ -46070,7 +45614,7 @@ var require_util8 = __commonJS({
46070
45614
  parsed.path = parsed.path.substring(0, index + 1);
46071
45615
  }
46072
45616
  }
46073
- sourceURL = join5(urlGenerate(parsed), sourceURL);
45617
+ sourceURL = join6(urlGenerate(parsed), sourceURL);
46074
45618
  }
46075
45619
  return normalize2(sourceURL);
46076
45620
  }
@@ -47438,8 +46982,8 @@ var require_util9 = __commonJS({
47438
46982
  exports2.isTrailingCommaEnabled = exports2.getParentExportDeclaration = exports2.isExportDeclaration = exports2.fixFaultyLocations = exports2.getTrueLoc = exports2.composeSourceMaps = exports2.copyPos = exports2.comparePos = exports2.getUnionOfKeys = exports2.getOption = exports2.isBrowser = exports2.getLineTerminator = void 0;
47439
46983
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
47440
46984
  var assert_1 = tslib_1.__importDefault(require("assert"));
47441
- var types = tslib_1.__importStar(require_main2());
47442
- var n2 = types.namedTypes;
46985
+ var types2 = tslib_1.__importStar(require_main2());
46986
+ var n2 = types2.namedTypes;
47443
46987
  var source_map_1 = tslib_1.__importDefault(require_source_map());
47444
46988
  var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
47445
46989
  var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
@@ -54852,10 +54396,10 @@ var require_comments = __commonJS({
54852
54396
  exports2.printComments = exports2.attach = void 0;
54853
54397
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
54854
54398
  var assert_1 = tslib_1.__importDefault(require("assert"));
54855
- var types = tslib_1.__importStar(require_main2());
54856
- var n2 = types.namedTypes;
54857
- var isArray = types.builtInTypes.array;
54858
- var isObject2 = types.builtInTypes.object;
54399
+ var types2 = tslib_1.__importStar(require_main2());
54400
+ var n2 = types2.namedTypes;
54401
+ var isArray = types2.builtInTypes.array;
54402
+ var isObject2 = types2.builtInTypes.object;
54859
54403
  var lines_1 = require_lines();
54860
54404
  var util_1 = require_util9();
54861
54405
  var childNodesCache = /* @__PURE__ */ new WeakMap();
@@ -54886,7 +54430,7 @@ var require_comments = __commonJS({
54886
54430
  if (isArray.check(node)) {
54887
54431
  names = Object.keys(node);
54888
54432
  } else if (isObject2.check(node)) {
54889
- names = types.getFieldNames(node);
54433
+ names = types2.getFieldNames(node);
54890
54434
  } else {
54891
54435
  return resultArray;
54892
54436
  }
@@ -55066,7 +54610,7 @@ var require_comments = __commonJS({
55066
54610
  function printComments(path3, print2) {
55067
54611
  var value = path3.getValue();
55068
54612
  var innerLines = print2(path3);
55069
- var comments = n2.Node.check(value) && types.getFieldValue(value, "comments");
54613
+ var comments = n2.Node.check(value) && types2.getFieldValue(value, "comments");
55070
54614
  if (!comments || comments.length === 0) {
55071
54615
  return innerLines;
55072
54616
  }
@@ -55074,8 +54618,8 @@ var require_comments = __commonJS({
55074
54618
  var trailingParts = [innerLines];
55075
54619
  path3.each(function(commentPath) {
55076
54620
  var comment = commentPath.getValue();
55077
- var leading = types.getFieldValue(comment, "leading");
55078
- var trailing = types.getFieldValue(comment, "trailing");
54621
+ var leading = types2.getFieldValue(comment, "leading");
54622
+ var trailing = types2.getFieldValue(comment, "trailing");
55079
54623
  if (leading || trailing && !(n2.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
55080
54624
  leadingParts.push(printLeadingComment(commentPath, print2));
55081
54625
  } else if (trailing) {
@@ -55097,10 +54641,10 @@ var require_parser2 = __commonJS({
55097
54641
  exports2.parse = void 0;
55098
54642
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
55099
54643
  var assert_1 = tslib_1.__importDefault(require("assert"));
55100
- var types = tslib_1.__importStar(require_main2());
55101
- var b2 = types.builders;
55102
- var isObject2 = types.builtInTypes.object;
55103
- var isArray = types.builtInTypes.array;
54644
+ var types2 = tslib_1.__importStar(require_main2());
54645
+ var b2 = types2.builders;
54646
+ var isObject2 = types2.builtInTypes.object;
54647
+ var isArray = types2.builtInTypes.array;
55104
54648
  var options_1 = require_options();
55105
54649
  var lines_1 = require_lines();
55106
54650
  var comments_1 = require_comments();
@@ -55287,11 +54831,11 @@ var require_fast_path = __commonJS({
55287
54831
  Object.defineProperty(exports2, "__esModule", { value: true });
55288
54832
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
55289
54833
  var assert_1 = tslib_1.__importDefault(require("assert"));
55290
- var types = tslib_1.__importStar(require_main2());
54834
+ var types2 = tslib_1.__importStar(require_main2());
55291
54835
  var util = tslib_1.__importStar(require_util9());
55292
- var n2 = types.namedTypes;
55293
- var isArray = types.builtInTypes.array;
55294
- var isNumber = types.builtInTypes.number;
54836
+ var n2 = types2.namedTypes;
54837
+ var isArray = types2.builtInTypes.array;
54838
+ var isNumber = types2.builtInTypes.number;
55295
54839
  var PRECEDENCE = {};
55296
54840
  [
55297
54841
  ["??"],
@@ -55320,7 +54864,7 @@ var require_fast_path = __commonJS({
55320
54864
  if (obj instanceof FastPath) {
55321
54865
  return obj.copy();
55322
54866
  }
55323
- if (obj instanceof types.NodePath) {
54867
+ if (obj instanceof types2.NodePath) {
55324
54868
  var copy = Object.create(FastPath.prototype);
55325
54869
  var stack = [obj.value];
55326
54870
  for (var pp = void 0; pp = obj.parentPath; obj = pp)
@@ -55631,7 +55175,7 @@ var require_fast_path = __commonJS({
55631
55175
  return node.some(containsCallExpression);
55632
55176
  }
55633
55177
  if (n2.Node.check(node)) {
55634
- return types.someField(node, function(_name, child) {
55178
+ return types2.someField(node, function(_name, child) {
55635
55179
  return containsCallExpression(child);
55636
55180
  });
55637
55181
  }
@@ -55721,16 +55265,16 @@ var require_patcher = __commonJS({
55721
55265
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
55722
55266
  var assert_1 = tslib_1.__importDefault(require("assert"));
55723
55267
  var linesModule = tslib_1.__importStar(require_lines());
55724
- var types = tslib_1.__importStar(require_main2());
55725
- var Printable = types.namedTypes.Printable;
55726
- var Expression = types.namedTypes.Expression;
55727
- var ReturnStatement = types.namedTypes.ReturnStatement;
55728
- var SourceLocation = types.namedTypes.SourceLocation;
55268
+ var types2 = tslib_1.__importStar(require_main2());
55269
+ var Printable = types2.namedTypes.Printable;
55270
+ var Expression = types2.namedTypes.Expression;
55271
+ var ReturnStatement = types2.namedTypes.ReturnStatement;
55272
+ var SourceLocation = types2.namedTypes.SourceLocation;
55729
55273
  var util_1 = require_util9();
55730
55274
  var fast_path_1 = tslib_1.__importDefault(require_fast_path());
55731
- var isObject2 = types.builtInTypes.object;
55732
- var isArray = types.builtInTypes.array;
55733
- var isString = types.builtInTypes.string;
55275
+ var isObject2 = types2.builtInTypes.object;
55276
+ var isArray = types2.builtInTypes.array;
55277
+ var isString = types2.builtInTypes.string;
55734
55278
  var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
55735
55279
  var Patcher = function Patcher2(lines) {
55736
55280
  assert_1.default.ok(this instanceof Patcher2);
@@ -56009,8 +55553,8 @@ var require_patcher = __commonJS({
56009
55553
  if (k2.charAt(0) === "_") {
56010
55554
  continue;
56011
55555
  }
56012
- newPath.stack.push(k2, types.getFieldValue(newNode, k2));
56013
- oldPath.stack.push(k2, types.getFieldValue(oldNode, k2));
55556
+ newPath.stack.push(k2, types2.getFieldValue(newNode, k2));
55557
+ oldPath.stack.push(k2, types2.getFieldValue(oldNode, k2));
56014
55558
  var canReprint = findAnyReprints(newPath, oldPath, reprints);
56015
55559
  newPath.stack.length -= 2;
56016
55560
  oldPath.stack.length -= 2;
@@ -56038,10 +55582,10 @@ var require_printer = __commonJS({
56038
55582
  var lines_1 = require_lines();
56039
55583
  var options_1 = require_options();
56040
55584
  var patcher_1 = require_patcher();
56041
- var types = tslib_1.__importStar(require_main2());
56042
- var namedTypes = types.namedTypes;
56043
- var isString = types.builtInTypes.string;
56044
- var isObject2 = types.builtInTypes.object;
55585
+ var types2 = tslib_1.__importStar(require_main2());
55586
+ var namedTypes = types2.namedTypes;
55587
+ var isString = types2.builtInTypes.string;
55588
+ var isObject2 = types2.builtInTypes.object;
56045
55589
  var fast_path_1 = tslib_1.__importDefault(require_fast_path());
56046
55590
  var util = tslib_1.__importStar(require_util9());
56047
55591
  var PrintResult = function PrintResult2(code, sourceMap) {
@@ -56215,7 +55759,7 @@ var require_printer = __commonJS({
56215
55759
  case "OptionalMemberExpression": {
56216
55760
  parts.push(path3.call(print2, "object"));
56217
55761
  var property = path3.call(print2, "property");
56218
- var optional = types.getFieldValue(n2, "optional");
55762
+ var optional = types2.getFieldValue(n2, "optional");
56219
55763
  if (n2.computed) {
56220
55764
  parts.push(optional ? "?.[" : "[", property, "]");
56221
55765
  } else {
@@ -56486,7 +56030,7 @@ var require_printer = __commonJS({
56486
56030
  if (n2.typeArguments) {
56487
56031
  parts.push(path3.call(print2, "typeArguments"));
56488
56032
  }
56489
- if (types.getFieldValue(n2, "optional")) {
56033
+ if (types2.getFieldValue(n2, "optional")) {
56490
56034
  parts.push("?.");
56491
56035
  }
56492
56036
  parts.push(printArgumentsList(path3, options, print2));
@@ -58118,8 +57662,8 @@ var require_printer = __commonJS({
58118
57662
  });
58119
57663
  }
58120
57664
  function getPossibleRaw(node) {
58121
- var value = types.getFieldValue(node, "value");
58122
- var extra = types.getFieldValue(node, "extra");
57665
+ var value = types2.getFieldValue(node, "value");
57666
+ var extra = types2.getFieldValue(node, "extra");
58123
57667
  if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
58124
57668
  return extra.raw;
58125
57669
  }
@@ -58167,8 +57711,8 @@ var require_main3 = __commonJS({
58167
57711
  exports2.run = exports2.prettyPrint = exports2.print = exports2.visit = exports2.types = exports2.parse = void 0;
58168
57712
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
58169
57713
  var fs_1 = tslib_1.__importDefault(require("fs"));
58170
- var types = tslib_1.__importStar(require_main2());
58171
- exports2.types = types;
57714
+ var types2 = tslib_1.__importStar(require_main2());
57715
+ exports2.types = types2;
58172
57716
  var parser_1 = require_parser2();
58173
57717
  Object.defineProperty(exports2, "parse", { enumerable: true, get: function() {
58174
57718
  return parser_1.parse;
@@ -59032,14 +58576,14 @@ var require_lib = __commonJS({
59032
58576
  this.preserveSpace = !!preserveSpace;
59033
58577
  }
59034
58578
  };
59035
- var types = {
58579
+ var types2 = {
59036
58580
  brace: new TokContext("{"),
59037
58581
  j_oTag: new TokContext("<tag"),
59038
58582
  j_cTag: new TokContext("</tag"),
59039
58583
  j_expr: new TokContext("<tag>...</tag>", true)
59040
58584
  };
59041
58585
  {
59042
- types.template = new TokContext("`", true);
58586
+ types2.template = new TokContext("`", true);
59043
58587
  }
59044
58588
  var beforeExpr = true;
59045
58589
  var startsExpr = true;
@@ -59571,17 +59115,17 @@ var require_lib = __commonJS({
59571
59115
  context.pop();
59572
59116
  };
59573
59117
  tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
59574
- context.push(types.brace);
59118
+ context.push(types2.brace);
59575
59119
  };
59576
59120
  tokenTypes[22].updateContext = (context) => {
59577
- if (context[context.length - 1] === types.template) {
59121
+ if (context[context.length - 1] === types2.template) {
59578
59122
  context.pop();
59579
59123
  } else {
59580
- context.push(types.template);
59124
+ context.push(types2.template);
59581
59125
  }
59582
59126
  };
59583
59127
  tokenTypes[140].updateContext = (context) => {
59584
- context.push(types.j_expr, types.j_oTag);
59128
+ context.push(types2.j_expr, types2.j_oTag);
59585
59129
  };
59586
59130
  }
59587
59131
  var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
@@ -60187,7 +59731,7 @@ var require_lib = __commonJS({
60187
59731
  this.lastTokEndLoc = null;
60188
59732
  this.lastTokStartLoc = null;
60189
59733
  this.lastTokStart = 0;
60190
- this.context = [types.brace];
59734
+ this.context = [types2.brace];
60191
59735
  this.canStartJSXElement = true;
60192
59736
  this.containsEsc = false;
60193
59737
  this.firstInvalidTemplateEscapePos = null;
@@ -64078,7 +63622,7 @@ var require_lib = __commonJS({
64078
63622
  context
64079
63623
  } = this.state;
64080
63624
  const currentContext = context[context.length - 1];
64081
- if (currentContext === types.j_oTag || currentContext === types.j_expr) {
63625
+ if (currentContext === types2.j_oTag || currentContext === types2.j_expr) {
64082
63626
  context.pop();
64083
63627
  }
64084
63628
  }
@@ -65136,9 +64680,9 @@ var require_lib = __commonJS({
65136
64680
  switch (this.state.type) {
65137
64681
  case 5:
65138
64682
  node = this.startNode();
65139
- this.setContext(types.brace);
64683
+ this.setContext(types2.brace);
65140
64684
  this.next();
65141
- node = this.jsxParseExpressionContainer(node, types.j_oTag);
64685
+ node = this.jsxParseExpressionContainer(node, types2.j_oTag);
65142
64686
  if (node.expression.type === "JSXEmptyExpression") {
65143
64687
  this.raise(JsxErrors.AttributeIsEmpty, {
65144
64688
  at: node
@@ -65161,7 +64705,7 @@ var require_lib = __commonJS({
65161
64705
  jsxParseSpreadChild(node) {
65162
64706
  this.next();
65163
64707
  node.expression = this.parseExpression();
65164
- this.setContext(types.j_expr);
64708
+ this.setContext(types2.j_expr);
65165
64709
  this.state.canStartJSXElement = true;
65166
64710
  this.expect(8);
65167
64711
  return this.finishNode(node, "JSXSpreadChild");
@@ -65181,11 +64725,11 @@ var require_lib = __commonJS({
65181
64725
  jsxParseAttribute() {
65182
64726
  const node = this.startNode();
65183
64727
  if (this.match(5)) {
65184
- this.setContext(types.brace);
64728
+ this.setContext(types2.brace);
65185
64729
  this.next();
65186
64730
  this.expect(21);
65187
64731
  node.argument = this.parseMaybeAssignAllowIn();
65188
- this.setContext(types.j_oTag);
64732
+ this.setContext(types2.j_oTag);
65189
64733
  this.state.canStartJSXElement = true;
65190
64734
  this.expect(8);
65191
64735
  return this.finishNode(node, "JSXSpreadAttribute");
@@ -65244,12 +64788,12 @@ var require_lib = __commonJS({
65244
64788
  break;
65245
64789
  case 5: {
65246
64790
  const node2 = this.startNode();
65247
- this.setContext(types.brace);
64791
+ this.setContext(types2.brace);
65248
64792
  this.next();
65249
64793
  if (this.match(21)) {
65250
64794
  children.push(this.jsxParseSpreadChild(node2));
65251
64795
  } else {
65252
- children.push(this.jsxParseExpressionContainer(node2, types.j_expr));
64796
+ children.push(this.jsxParseExpressionContainer(node2, types2.j_expr));
65253
64797
  }
65254
64798
  break;
65255
64799
  }
@@ -65320,11 +64864,11 @@ var require_lib = __commonJS({
65320
64864
  }
65321
64865
  getTokenFromCode(code) {
65322
64866
  const context = this.curContext();
65323
- if (context === types.j_expr) {
64867
+ if (context === types2.j_expr) {
65324
64868
  this.jsxReadToken();
65325
64869
  return;
65326
64870
  }
65327
- if (context === types.j_oTag || context === types.j_cTag) {
64871
+ if (context === types2.j_oTag || context === types2.j_cTag) {
65328
64872
  if (isIdentifierStart(code)) {
65329
64873
  this.jsxReadWord();
65330
64874
  return;
@@ -65334,7 +64878,7 @@ var require_lib = __commonJS({
65334
64878
  this.finishToken(141);
65335
64879
  return;
65336
64880
  }
65337
- if ((code === 34 || code === 39) && context === types.j_oTag) {
64881
+ if ((code === 34 || code === 39) && context === types2.j_oTag) {
65338
64882
  this.jsxReadString(code);
65339
64883
  return;
65340
64884
  }
@@ -65352,17 +64896,17 @@ var require_lib = __commonJS({
65352
64896
  type
65353
64897
  } = this.state;
65354
64898
  if (type === 56 && prevType === 140) {
65355
- context.splice(-2, 2, types.j_cTag);
64899
+ context.splice(-2, 2, types2.j_cTag);
65356
64900
  this.state.canStartJSXElement = false;
65357
64901
  } else if (type === 140) {
65358
- context.push(types.j_oTag);
64902
+ context.push(types2.j_oTag);
65359
64903
  } else if (type === 141) {
65360
64904
  const out = context[context.length - 1];
65361
- if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
64905
+ if (out === types2.j_oTag && prevType === 56 || out === types2.j_cTag) {
65362
64906
  context.pop();
65363
- this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
64907
+ this.state.canStartJSXElement = context[context.length - 1] === types2.j_expr;
65364
64908
  } else {
65365
- this.setContext(types.j_expr);
64909
+ this.setContext(types2.j_expr);
65366
64910
  this.state.canStartJSXElement = true;
65367
64911
  }
65368
64912
  } else {
@@ -66806,14 +66350,14 @@ var require_lib = __commonJS({
66806
66350
  tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
66807
66351
  const node = this.startNode();
66808
66352
  const hasLeadingOperator = this.eat(operator);
66809
- const types2 = [];
66353
+ const types3 = [];
66810
66354
  do {
66811
- types2.push(parseConstituentType());
66355
+ types3.push(parseConstituentType());
66812
66356
  } while (this.eat(operator));
66813
- if (types2.length === 1 && !hasLeadingOperator) {
66814
- return types2[0];
66357
+ if (types3.length === 1 && !hasLeadingOperator) {
66358
+ return types3[0];
66815
66359
  }
66816
- node.types = types2;
66360
+ node.types = types3;
66817
66361
  return this.finishNode(node, kind);
66818
66362
  }
66819
66363
  tsParseIntersectionTypeOrHigher() {
@@ -67387,7 +66931,7 @@ var require_lib = __commonJS({
67387
66931
  this.raise(TSErrors.EmptyTypeArguments, {
67388
66932
  at: node
67389
66933
  });
67390
- } else if (!this.state.inType && this.curContext() === types.brace) {
66934
+ } else if (!this.state.inType && this.curContext() === types2.brace) {
67391
66935
  this.reScan_lt_gt();
67392
66936
  }
67393
66937
  this.expect(48);
@@ -68064,7 +67608,7 @@ var require_lib = __commonJS({
68064
67608
  context
68065
67609
  } = this.state;
68066
67610
  const currentContext = context[context.length - 1];
68067
- if (currentContext === types.j_oTag || currentContext === types.j_expr) {
67611
+ if (currentContext === types2.j_oTag || currentContext === types2.j_expr) {
68068
67612
  context.pop();
68069
67613
  }
68070
67614
  }
@@ -72897,16 +72441,17 @@ var require_typescript2 = __commonJS({
72897
72441
  });
72898
72442
 
72899
72443
  // src/helpers/codemod.ts
72900
- var import_path9, recast, esprimaParser, typescriptParser, parseTs, parseFile, transformFile;
72444
+ var import_path10, recast, esprimaParser, typescriptParser, parseTs, parseFile, transformFile;
72901
72445
  var init_codemod = __esm({
72902
72446
  "src/helpers/codemod.ts"() {
72903
- import_path9 = __toESM(require("path"));
72447
+ import_path10 = __toESM(require("path"));
72904
72448
  init_cli();
72905
72449
  recast = __toESM(require_main3());
72906
72450
  esprimaParser = __toESM(require_esprima3());
72907
72451
  typescriptParser = __toESM(require_typescript2());
72908
72452
  init_files();
72909
72453
  parseTs = (src) => {
72454
+ src = src.trim();
72910
72455
  try {
72911
72456
  return recast.parse(src, { parser: typescriptParser });
72912
72457
  } catch (error2) {
@@ -72914,10 +72459,10 @@ var init_codemod = __esm({
72914
72459
  }
72915
72460
  };
72916
72461
  parseFile = (filePath) => {
72917
- const lang = import_path9.default.extname(filePath).slice(1);
72462
+ const lang = import_path10.default.extname(filePath).slice(1);
72918
72463
  const parser2 = lang === "js" ? esprimaParser : typescriptParser;
72919
72464
  try {
72920
- const fileContents = readFile(import_path9.default.resolve(filePath));
72465
+ const fileContents = readFile(import_path10.default.resolve(filePath));
72921
72466
  if (fileContents) {
72922
72467
  return recast.parse(fileContents, { parser: parser2 });
72923
72468
  }
@@ -72936,9 +72481,299 @@ var init_codemod = __esm({
72936
72481
  }
72937
72482
  });
72938
72483
 
72484
+ // templates/nuxt/c3.ts
72485
+ var c3_exports7 = {};
72486
+ __export(c3_exports7, {
72487
+ default: () => c3_default7
72488
+ });
72489
+ var recast2, npm7, generate7, configure4, updateNuxtConfig, config6, c3_default7;
72490
+ var init_c37 = __esm({
72491
+ "templates/nuxt/c3.ts"() {
72492
+ init_cli();
72493
+ init_colors();
72494
+ init_interactive();
72495
+ init_codemod();
72496
+ init_command();
72497
+ init_files();
72498
+ init_packages();
72499
+ recast2 = __toESM(require_main3());
72500
+ ({ npm: npm7 } = detectPackageManager());
72501
+ generate7 = async (ctx) => {
72502
+ const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
72503
+ await runFrameworkGenerator(ctx, [
72504
+ "init",
72505
+ ctx.project.name,
72506
+ "--packageManager",
72507
+ npm7,
72508
+ gitFlag
72509
+ ]);
72510
+ writeFile2("./.node-version", "17");
72511
+ logRaw("");
72512
+ };
72513
+ configure4 = async () => {
72514
+ await installPackages(["nitro-cloudflare-dev"], {
72515
+ dev: true,
72516
+ startText: "Installing nitro module `nitro-cloudflare-dev`",
72517
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm7} install\``)}`
72518
+ });
72519
+ updateNuxtConfig();
72520
+ };
72521
+ updateNuxtConfig = () => {
72522
+ const s = spinner();
72523
+ const configFile = "nuxt.config.ts";
72524
+ s.start(`Updating \`${configFile}\``);
72525
+ const b2 = recast2.types.builders;
72526
+ const presetDef = b2.objectProperty(
72527
+ b2.identifier("nitro"),
72528
+ b2.objectExpression([
72529
+ b2.objectProperty(
72530
+ b2.identifier("preset"),
72531
+ b2.stringLiteral("cloudflare-pages")
72532
+ )
72533
+ ])
72534
+ );
72535
+ const moduleDef = b2.objectProperty(
72536
+ b2.identifier("modules"),
72537
+ b2.arrayExpression([b2.stringLiteral("nitro-cloudflare-dev")])
72538
+ );
72539
+ transformFile(configFile, {
72540
+ visitCallExpression: function(n2) {
72541
+ const callee = n2.node.callee;
72542
+ if (callee.name === "defineNuxtConfig") {
72543
+ const obj = n2.node.arguments[0];
72544
+ obj.properties.push(presetDef);
72545
+ obj.properties.push(moduleDef);
72546
+ }
72547
+ return this.traverse(n2);
72548
+ }
72549
+ });
72550
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
72551
+ };
72552
+ config6 = {
72553
+ configVersion: 1,
72554
+ id: "nuxt",
72555
+ platform: "pages",
72556
+ copyFiles: {
72557
+ path: "./templates"
72558
+ },
72559
+ displayName: "Nuxt",
72560
+ devScript: "dev",
72561
+ deployScript: "deploy",
72562
+ generate: generate7,
72563
+ configure: configure4,
72564
+ transformPackageJson: async () => ({
72565
+ scripts: {
72566
+ deploy: `${npm7} run build && wrangler pages deploy ./dist`,
72567
+ preview: `${npm7} run build && wrangler pages dev ./dist`
72568
+ }
72569
+ })
72570
+ };
72571
+ c3_default7 = config6;
72572
+ }
72573
+ });
72574
+
72575
+ // templates/qwik/c3.ts
72576
+ var c3_exports8 = {};
72577
+ __export(c3_exports8, {
72578
+ default: () => c3_default8
72579
+ });
72580
+ var npm8, npx4, generate8, configure5, addBindingsProxy, config7, c3_default8;
72581
+ var init_c38 = __esm({
72582
+ "templates/qwik/c3.ts"() {
72583
+ init_cli();
72584
+ init_colors();
72585
+ init_interactive();
72586
+ init_codemod();
72587
+ init_command();
72588
+ init_files();
72589
+ init_packages();
72590
+ init_common2();
72591
+ ({ npm: npm8, npx: npx4 } = detectPackageManager());
72592
+ generate8 = async (ctx) => {
72593
+ await runFrameworkGenerator(ctx, ["basic", ctx.project.name]);
72594
+ };
72595
+ configure5 = async (ctx) => {
72596
+ const cmd = [npx4, "qwik", "add", "cloudflare-pages"];
72597
+ endSection(`Running ${quoteShellArgs(cmd)}`);
72598
+ await runCommand(cmd);
72599
+ addBindingsProxy(ctx);
72600
+ };
72601
+ addBindingsProxy = (ctx) => {
72602
+ if (!usesTypescript(ctx)) {
72603
+ return;
72604
+ }
72605
+ const s = spinner();
72606
+ s.start("Updating `vite.config.ts`");
72607
+ const envDeclaration = `
72608
+ let env = {};
72609
+
72610
+ if(process.env.NODE_ENV === 'development') {
72611
+ const { getBindingsProxy } = await import('wrangler');
72612
+ const { bindings } = await getBindingsProxy();
72613
+ env = bindings;
72614
+ }
72615
+ `;
72616
+ transformFile("vite.config.ts", {
72617
+ visitProgram: function(n2) {
72618
+ const lastImportIndex = n2.node.body.findLastIndex(
72619
+ (t) => t.type === "ImportDeclaration"
72620
+ );
72621
+ n2.get("body").insertAt(lastImportIndex + 1, envDeclaration);
72622
+ return false;
72623
+ }
72624
+ });
72625
+ const platformObject = parseTs(`{ platform: { env } }`);
72626
+ transformFile("vite.config.ts", {
72627
+ visitCallExpression: function(n2) {
72628
+ const callee = n2.node.callee;
72629
+ if (callee.name === "qwikCity") {
72630
+ n2.node.arguments = [platformObject];
72631
+ }
72632
+ this.traverse(n2);
72633
+ }
72634
+ });
72635
+ s.stop(`${brandColor("updated")} \`vite.config.ts\``);
72636
+ };
72637
+ config7 = {
72638
+ configVersion: 1,
72639
+ id: "qwik",
72640
+ displayName: "Qwik",
72641
+ platform: "pages",
72642
+ copyFiles: {
72643
+ path: "./templates"
72644
+ },
72645
+ devScript: "dev",
72646
+ deployScript: "deploy",
72647
+ generate: generate8,
72648
+ configure: configure5,
72649
+ transformPackageJson: async () => ({
72650
+ scripts: {
72651
+ deploy: `${npm8} run build && wrangler pages deploy ./dist`
72652
+ }
72653
+ })
72654
+ };
72655
+ c3_default8 = config7;
72656
+ }
72657
+ });
72658
+
72659
+ // templates/react/c3.ts
72660
+ var c3_exports9 = {};
72661
+ __export(c3_exports9, {
72662
+ default: () => c3_default9
72663
+ });
72664
+ var npm9, generate9, config8, c3_default9;
72665
+ var init_c39 = __esm({
72666
+ "templates/react/c3.ts"() {
72667
+ init_cli();
72668
+ init_command();
72669
+ init_files();
72670
+ init_packages();
72671
+ ({ npm: npm9 } = detectPackageManager());
72672
+ generate9 = async (ctx) => {
72673
+ await runFrameworkGenerator(ctx, [ctx.project.name]);
72674
+ logRaw("");
72675
+ };
72676
+ config8 = {
72677
+ configVersion: 1,
72678
+ id: "react",
72679
+ displayName: "React",
72680
+ platform: "pages",
72681
+ generate: generate9,
72682
+ transformPackageJson: async () => ({
72683
+ scripts: {
72684
+ "pages:dev": `wrangler pages dev ${await compatDateFlag()} --port 3000 -- ${npm9} start`,
72685
+ "pages:deploy": `${npm9} run build && wrangler pages deploy ./build`
72686
+ }
72687
+ })
72688
+ };
72689
+ c3_default9 = config8;
72690
+ }
72691
+ });
72692
+
72693
+ // templates/remix/c3.ts
72694
+ var c3_exports10 = {};
72695
+ __export(c3_exports10, {
72696
+ default: () => c3_default10
72697
+ });
72698
+ var npm10, generate10, config9, c3_default10;
72699
+ var init_c310 = __esm({
72700
+ "templates/remix/c3.ts"() {
72701
+ init_cli();
72702
+ init_command();
72703
+ init_packages();
72704
+ ({ npm: npm10 } = detectPackageManager());
72705
+ generate10 = async (ctx) => {
72706
+ await runFrameworkGenerator(ctx, [
72707
+ ctx.project.name,
72708
+ "--template",
72709
+ "https://github.com/remix-run/remix/tree/main/templates/cloudflare-pages"
72710
+ ]);
72711
+ logRaw("");
72712
+ };
72713
+ config9 = {
72714
+ configVersion: 1,
72715
+ id: "remix",
72716
+ displayName: "Remix",
72717
+ platform: "pages",
72718
+ generate: generate10,
72719
+ transformPackageJson: async () => ({
72720
+ scripts: {
72721
+ "pages:deploy": `${npm10} run build && wrangler pages deploy ./public`
72722
+ }
72723
+ }),
72724
+ devScript: "dev",
72725
+ testFlags: ["--typescript", "--no-install", "--no-git-init"]
72726
+ };
72727
+ c3_default10 = config9;
72728
+ }
72729
+ });
72730
+
72731
+ // templates/solid/c3.ts
72732
+ var c3_exports11 = {};
72733
+ __export(c3_exports11, {
72734
+ default: () => c3_default11
72735
+ });
72736
+ var npm11, generate11, config10, c3_default11;
72737
+ var init_c311 = __esm({
72738
+ "templates/solid/c3.ts"() {
72739
+ init_cli();
72740
+ init_command();
72741
+ init_files();
72742
+ init_packages();
72743
+ ({ npm: npm11 } = detectPackageManager());
72744
+ generate11 = async (ctx) => {
72745
+ await runFrameworkGenerator(ctx, [ctx.project.name]);
72746
+ logRaw("");
72747
+ };
72748
+ config10 = {
72749
+ configVersion: 1,
72750
+ id: "solid",
72751
+ displayName: "Solid",
72752
+ platform: "pages",
72753
+ copyFiles: {
72754
+ variants: {
72755
+ js: { path: "./js" },
72756
+ ts: { path: "./ts" }
72757
+ }
72758
+ },
72759
+ generate: generate11,
72760
+ transformPackageJson: async () => ({
72761
+ scripts: {
72762
+ "pages:preview": `${npm11} run build && npx wrangler pages dev dist ${await compatDateFlag()} --compatibility-flag nodejs_compat`,
72763
+ "pages:deploy": `${npm11} run build && wrangler pages deploy ./dist`
72764
+ }
72765
+ }),
72766
+ devScript: "dev",
72767
+ previewScript: "pages:preview",
72768
+ compatibilityFlags: ["nodejs_compat"]
72769
+ };
72770
+ c3_default11 = config10;
72771
+ }
72772
+ });
72773
+
72939
72774
  // templates/svelte/templates.ts
72940
72775
  var platformInterface;
72941
- var init_templates2 = __esm({
72776
+ var init_templates = __esm({
72942
72777
  "templates/svelte/templates.ts"() {
72943
72778
  platformInterface = `
72944
72779
  interface Platform {
@@ -72968,7 +72803,7 @@ var init_c312 = __esm({
72968
72803
  init_command();
72969
72804
  init_files();
72970
72805
  init_packages();
72971
- init_templates2();
72806
+ init_templates();
72972
72807
  ({ npm: npm12 } = detectPackageManager());
72973
72808
  generate12 = async (ctx) => {
72974
72809
  await runFrameworkGenerator(ctx, [ctx.project.name]);
@@ -73072,11 +72907,13 @@ var init_c314 = __esm({
73072
72907
  displayName: '"Hello World" Worker',
73073
72908
  platform: "workers",
73074
72909
  copyFiles: {
73075
- js: {
73076
- path: "./js"
73077
- },
73078
- ts: {
73079
- path: "./ts"
72910
+ variants: {
72911
+ js: {
72912
+ path: "./js"
72913
+ },
72914
+ ts: {
72915
+ path: "./ts"
72916
+ }
73080
72917
  }
73081
72918
  }
73082
72919
  };
@@ -73097,11 +72934,13 @@ var init_c315 = __esm({
73097
72934
  displayName: '"Hello World" Durable Object',
73098
72935
  platform: "workers",
73099
72936
  copyFiles: {
73100
- js: {
73101
- path: "./js"
73102
- },
73103
- ts: {
73104
- path: "./ts"
72937
+ variants: {
72938
+ js: {
72939
+ path: "./js"
72940
+ },
72941
+ ts: {
72942
+ path: "./ts"
72943
+ }
73105
72944
  }
73106
72945
  }
73107
72946
  };
@@ -73122,11 +72961,13 @@ var init_c316 = __esm({
73122
72961
  displayName: "Example router & proxy Worker",
73123
72962
  platform: "workers",
73124
72963
  copyFiles: {
73125
- js: {
73126
- path: "./js"
73127
- },
73128
- ts: {
73129
- path: "./ts"
72964
+ variants: {
72965
+ js: {
72966
+ path: "./js"
72967
+ },
72968
+ ts: {
72969
+ path: "./ts"
72970
+ }
73130
72971
  }
73131
72972
  }
73132
72973
  };
@@ -73147,11 +72988,13 @@ var init_c317 = __esm({
73147
72988
  displayName: "Scheduled Worker (Cron Trigger)",
73148
72989
  platform: "workers",
73149
72990
  copyFiles: {
73150
- js: {
73151
- path: "./js"
73152
- },
73153
- ts: {
73154
- path: "./ts"
72991
+ variants: {
72992
+ js: {
72993
+ path: "./js"
72994
+ },
72995
+ ts: {
72996
+ path: "./ts"
72997
+ }
73155
72998
  }
73156
72999
  }
73157
73000
  };
@@ -73172,11 +73015,13 @@ var init_c318 = __esm({
73172
73015
  displayName: "Queue consumer & producer Worker",
73173
73016
  platform: "workers",
73174
73017
  copyFiles: {
73175
- js: {
73176
- path: "./js"
73177
- },
73178
- ts: {
73179
- path: "./ts"
73018
+ variants: {
73019
+ js: {
73020
+ path: "./js"
73021
+ },
73022
+ ts: {
73023
+ path: "./ts"
73024
+ }
73180
73025
  }
73181
73026
  },
73182
73027
  bindings: {
@@ -73234,7 +73079,7 @@ async function copyExistingWorkerFiles(ctx) {
73234
73079
  }
73235
73080
  );
73236
73081
  }
73237
- const tempdir = await (0, import_promises.mkdtemp)((0, import_path10.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-"));
73082
+ const tempdir = await (0, import_promises.mkdtemp)((0, import_path11.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-"));
73238
73083
  await runCommand(
73239
73084
  [
73240
73085
  ...dlx,
@@ -73257,21 +73102,21 @@ async function copyExistingWorkerFiles(ctx) {
73257
73102
  }
73258
73103
  );
73259
73104
  await (0, import_promises.cp)(
73260
- (0, import_path10.join)(tempdir, ctx.args.existingScript, "src"),
73261
- (0, import_path10.join)(ctx.project.path, "src"),
73105
+ (0, import_path11.join)(tempdir, ctx.args.existingScript, "src"),
73106
+ (0, import_path11.join)(ctx.project.path, "src"),
73262
73107
  { recursive: true }
73263
73108
  );
73264
73109
  await (0, import_promises.cp)(
73265
- (0, import_path10.join)(tempdir, ctx.args.existingScript, "wrangler.toml"),
73266
- (0, import_path10.join)(ctx.project.path, "wrangler.toml")
73110
+ (0, import_path11.join)(tempdir, ctx.args.existingScript, "wrangler.toml"),
73111
+ (0, import_path11.join)(ctx.project.path, "wrangler.toml")
73267
73112
  );
73268
73113
  }
73269
- var import_promises, import_os, import_path10, c3_default20;
73114
+ var import_promises, import_os, import_path11, c3_default20;
73270
73115
  var init_c320 = __esm({
73271
73116
  "templates/pre-existing/c3.ts"() {
73272
73117
  import_promises = require("fs/promises");
73273
73118
  import_os = require("os");
73274
- import_path10 = require("path");
73119
+ import_path11 = require("path");
73275
73120
  init_args();
73276
73121
  init_colors();
73277
73122
  init_command();
@@ -73294,6 +73139,293 @@ var init_c320 = __esm({
73294
73139
  }
73295
73140
  });
73296
73141
 
73142
+ // src/templates.ts
73143
+ async function copyTemplateFiles(ctx) {
73144
+ if (!ctx.template.copyFiles) {
73145
+ return;
73146
+ }
73147
+ const { copyFiles } = ctx.template;
73148
+ let srcdir;
73149
+ if (isVariantInfo(copyFiles)) {
73150
+ srcdir = (0, import_path12.join)(getTemplatePath(ctx), copyFiles.path);
73151
+ } else {
73152
+ const selectVariant = copyFiles.selectVariant ?? defaultSelectVariant;
73153
+ const variant = await selectVariant(ctx);
73154
+ const variantPath = copyFiles.variants[variant].path;
73155
+ srcdir = (0, import_path12.join)(getTemplatePath(ctx), variantPath);
73156
+ }
73157
+ const copyDestDir = await getCopyFilesDestinationDir(ctx);
73158
+ const destdir = (0, import_path12.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
73159
+ const s = spinner();
73160
+ s.start(`Copying template files`);
73161
+ await (0, import_promises2.cp)(srcdir, destdir, { recursive: true, force: true });
73162
+ const dummyGitIgnorePath = (0, import_path12.join)(destdir, "__dot__gitignore");
73163
+ if ((0, import_fs9.existsSync)(dummyGitIgnorePath)) {
73164
+ await (0, import_promises2.rename)(dummyGitIgnorePath, (0, import_path12.join)(destdir, ".gitignore"));
73165
+ }
73166
+ s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
73167
+ }
73168
+ var import_fs9, import_promises2, import_os2, import_path12, import_deepmerge, import_degit, defaultSelectVariant, getFrameworkMap, getTemplateMap, selectTemplate, selectFramework, shouldUseTs, processRemoteTemplate, validateTemplate, validateTemplateSrcDirectory, inferTemplateConfig, inferCopyFilesDefinition, downloadRemoteTemplate, updatePackageName, updatePackageScripts, getTemplatePath, isVariantInfo, getCopyFilesDestinationDir;
73169
+ var init_templates2 = __esm({
73170
+ "src/templates.ts"() {
73171
+ import_fs9 = require("fs");
73172
+ import_promises2 = require("fs/promises");
73173
+ import_os2 = require("os");
73174
+ import_path12 = require("path");
73175
+ init_cli();
73176
+ init_args();
73177
+ init_colors();
73178
+ init_interactive();
73179
+ import_deepmerge = __toESM(require_cjs());
73180
+ import_degit = __toESM(require_dist());
73181
+ init_cli2();
73182
+ init_files();
73183
+ init_validators();
73184
+ defaultSelectVariant = async (ctx) => {
73185
+ const typescript = await shouldUseTs(ctx);
73186
+ return typescript ? "ts" : "js";
73187
+ };
73188
+ getFrameworkMap = async () => ({
73189
+ angular: (await Promise.resolve().then(() => (init_c3(), c3_exports))).default,
73190
+ astro: (await Promise.resolve().then(() => (init_c32(), c3_exports2))).default,
73191
+ docusaurus: (await Promise.resolve().then(() => (init_c33(), c3_exports3))).default,
73192
+ gatsby: (await Promise.resolve().then(() => (init_c34(), c3_exports4))).default,
73193
+ hono: (await Promise.resolve().then(() => (init_c35(), c3_exports5))).default,
73194
+ next: (await Promise.resolve().then(() => (init_c36(), c3_exports6))).default,
73195
+ nuxt: (await Promise.resolve().then(() => (init_c37(), c3_exports7))).default,
73196
+ qwik: (await Promise.resolve().then(() => (init_c38(), c3_exports8))).default,
73197
+ react: (await Promise.resolve().then(() => (init_c39(), c3_exports9))).default,
73198
+ remix: (await Promise.resolve().then(() => (init_c310(), c3_exports10))).default,
73199
+ solid: (await Promise.resolve().then(() => (init_c311(), c3_exports11))).default,
73200
+ svelte: (await Promise.resolve().then(() => (init_c312(), c3_exports12))).default,
73201
+ vue: (await Promise.resolve().then(() => (init_c313(), c3_exports13))).default
73202
+ });
73203
+ getTemplateMap = async () => {
73204
+ return {
73205
+ "hello-world": (await Promise.resolve().then(() => (init_c314(), c3_exports14))).default,
73206
+ "hello-world-durable-object": (await Promise.resolve().then(() => (init_c315(), c3_exports15))).default,
73207
+ // Dummy record -- actual template config resolved in `selectFramework`
73208
+ webFramework: { displayName: "Website or web app" },
73209
+ common: (await Promise.resolve().then(() => (init_c316(), c3_exports16))).default,
73210
+ scheduled: (await Promise.resolve().then(() => (init_c317(), c3_exports17))).default,
73211
+ queues: (await Promise.resolve().then(() => (init_c318(), c3_exports18))).default,
73212
+ openapi: (await Promise.resolve().then(() => (init_c319(), c3_exports19))).default,
73213
+ // Dummy record -- actual template config resolved in `processRemoteTemplate`
73214
+ "remote-template": {
73215
+ displayName: "Worker built from a template hosted in a git repository"
73216
+ },
73217
+ "pre-existing": (await Promise.resolve().then(() => (init_c320(), c3_exports20))).default
73218
+ };
73219
+ };
73220
+ selectTemplate = async (args) => {
73221
+ if (!args.type) {
73222
+ if (args.framework) {
73223
+ args.type = "webFramework";
73224
+ } else if (args.existingScript) {
73225
+ args.type = "pre-existing";
73226
+ } else if (args.template) {
73227
+ args.type = "remote-template";
73228
+ }
73229
+ }
73230
+ const templateMap = await getTemplateMap();
73231
+ const templateOptions = Object.entries(templateMap).map(
73232
+ ([value, { displayName, hidden: hidden2 }]) => ({
73233
+ value,
73234
+ label: displayName,
73235
+ hidden: hidden2
73236
+ })
73237
+ );
73238
+ const type = await processArgument(args, "type", {
73239
+ type: "select",
73240
+ question: "What type of application do you want to create?",
73241
+ label: "type",
73242
+ options: templateOptions,
73243
+ defaultValue: C3_DEFAULTS.type
73244
+ });
73245
+ if (!type) {
73246
+ return crash("An application type must be specified to continue.");
73247
+ }
73248
+ if (!Object.keys(templateMap).includes(type)) {
73249
+ return crash(`Unknown application type provided: ${type}.`);
73250
+ }
73251
+ if (type === "webFramework") {
73252
+ return selectFramework(args);
73253
+ }
73254
+ if (type === "remote-template") {
73255
+ return processRemoteTemplate(args);
73256
+ }
73257
+ return templateMap[type];
73258
+ };
73259
+ selectFramework = async (args) => {
73260
+ const frameworkMap = await getFrameworkMap();
73261
+ const frameworkOptions = Object.entries(frameworkMap).map(
73262
+ ([key, config13]) => ({
73263
+ label: config13.displayName,
73264
+ value: key
73265
+ })
73266
+ );
73267
+ const framework = await processArgument(args, "framework", {
73268
+ type: "select",
73269
+ label: "framework",
73270
+ question: "Which development framework do you want to use?",
73271
+ options: frameworkOptions,
73272
+ defaultValue: C3_DEFAULTS.framework
73273
+ });
73274
+ if (!framework) {
73275
+ crash("A framework must be selected to continue.");
73276
+ }
73277
+ if (!Object.keys(frameworkMap).includes(framework)) {
73278
+ crash(`Unsupported framework: ${framework}`);
73279
+ }
73280
+ const defaultFrameworkConfig = {
73281
+ deployScript: "pages:deploy",
73282
+ devScript: "pages:dev"
73283
+ };
73284
+ return {
73285
+ ...defaultFrameworkConfig,
73286
+ ...frameworkMap[framework]
73287
+ };
73288
+ };
73289
+ shouldUseTs = async (ctx) => {
73290
+ if (usesTypescript(ctx)) {
73291
+ return true;
73292
+ }
73293
+ if (ctx.template.generate) {
73294
+ return false;
73295
+ }
73296
+ return processArgument(ctx.args, "ts", {
73297
+ type: "confirm",
73298
+ question: "Do you want to use TypeScript?",
73299
+ label: "typescript",
73300
+ defaultValue: C3_DEFAULTS.ts
73301
+ });
73302
+ };
73303
+ processRemoteTemplate = async (args) => {
73304
+ const templateUrl = await processArgument(args, "template", {
73305
+ type: "text",
73306
+ question: "What's the url of git repo containing the template you'd like to use?",
73307
+ label: "repository",
73308
+ validate: (val) => validateTemplateUrl(val || C3_DEFAULTS.template),
73309
+ defaultValue: C3_DEFAULTS.template
73310
+ });
73311
+ const path3 = await downloadRemoteTemplate(templateUrl);
73312
+ const config13 = inferTemplateConfig(path3);
73313
+ validateTemplate(path3, config13);
73314
+ return {
73315
+ path: path3,
73316
+ ...config13
73317
+ };
73318
+ };
73319
+ validateTemplate = (path3, config13) => {
73320
+ if (!config13.copyFiles) {
73321
+ return;
73322
+ }
73323
+ if (isVariantInfo(config13.copyFiles)) {
73324
+ validateTemplateSrcDirectory((0, import_path12.resolve)(path3, config13.copyFiles.path), config13);
73325
+ } else {
73326
+ for (const variant of Object.values(config13.copyFiles.variants)) {
73327
+ validateTemplateSrcDirectory((0, import_path12.resolve)(path3, variant.path), config13);
73328
+ }
73329
+ }
73330
+ };
73331
+ validateTemplateSrcDirectory = (path3, config13) => {
73332
+ if (config13.platform === "workers") {
73333
+ const wranglerTomlPath = (0, import_path12.resolve)(path3, "wrangler.toml");
73334
+ if (!(0, import_fs9.existsSync)(wranglerTomlPath)) {
73335
+ crash(`create-cloudflare templates must contain a "wrangler.toml" file.`);
73336
+ }
73337
+ }
73338
+ const pkgJsonPath = (0, import_path12.resolve)(path3, "package.json");
73339
+ if (!(0, import_fs9.existsSync)(pkgJsonPath)) {
73340
+ crash(`create-cloudflare templates must contain a "package.json" file.`);
73341
+ }
73342
+ };
73343
+ inferTemplateConfig = (path3) => {
73344
+ return {
73345
+ configVersion: 1,
73346
+ id: "remote-template",
73347
+ displayName: "A remote C3 template",
73348
+ platform: "workers",
73349
+ copyFiles: inferCopyFilesDefinition(path3)
73350
+ };
73351
+ };
73352
+ inferCopyFilesDefinition = (path3) => {
73353
+ const variants = {};
73354
+ if ((0, import_fs9.existsSync)((0, import_path12.join)(path3, "js"))) {
73355
+ variants["js"] = { path: "./js" };
73356
+ }
73357
+ if ((0, import_fs9.existsSync)((0, import_path12.join)(path3, "ts"))) {
73358
+ variants["ts"] = { path: "./ts" };
73359
+ }
73360
+ const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
73361
+ return copyFiles;
73362
+ };
73363
+ downloadRemoteTemplate = async (src) => {
73364
+ const s = spinner();
73365
+ try {
73366
+ s.start(`Cloning template from: ${blue(src)}`);
73367
+ const emitter = (0, import_degit.default)(src, {
73368
+ cache: false,
73369
+ verbose: false,
73370
+ force: true
73371
+ });
73372
+ const tmpDir = await (0, import_promises2.mkdtemp)((0, import_path12.join)((0, import_os2.tmpdir)(), "c3-template"));
73373
+ await emitter.clone(tmpDir);
73374
+ s.stop(`${brandColor("template")} ${dim("cloned and validated")}`);
73375
+ return tmpDir;
73376
+ } catch (error2) {
73377
+ s.stop(`${brandColor("template")} ${dim("failed")}`);
73378
+ return crash(`Failed to clone remote template: ${src}`);
73379
+ }
73380
+ };
73381
+ updatePackageName = async (ctx) => {
73382
+ const placeholderNames = ["<TBD>", "TBD", ""];
73383
+ const pkgJsonPath = (0, import_path12.resolve)(ctx.project.path, "package.json");
73384
+ const pkgJson = readJSON(pkgJsonPath);
73385
+ if (!placeholderNames.includes(pkgJson.name)) {
73386
+ return;
73387
+ }
73388
+ const s = spinner();
73389
+ s.start("Updating name in `package.json`");
73390
+ pkgJson.name = ctx.project.name;
73391
+ writeJSON(pkgJsonPath, pkgJson);
73392
+ s.stop(`${brandColor("updated")} ${dim("`package.json`")}`);
73393
+ };
73394
+ updatePackageScripts = async (ctx) => {
73395
+ if (!ctx.template.transformPackageJson) {
73396
+ return;
73397
+ }
73398
+ const s = spinner();
73399
+ s.start("Updating `package.json` scripts");
73400
+ const pkgJsonPath = (0, import_path12.resolve)(ctx.project.path, "package.json");
73401
+ let pkgJson = readJSON(pkgJsonPath);
73402
+ const transformed = await ctx.template.transformPackageJson(pkgJson);
73403
+ pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
73404
+ writeJSON(pkgJsonPath, pkgJson);
73405
+ s.stop(`${brandColor("updated")} ${dim("`package.json`")}`);
73406
+ };
73407
+ getTemplatePath = (ctx) => {
73408
+ if (ctx.template.path) {
73409
+ return ctx.template.path;
73410
+ }
73411
+ return (0, import_path12.resolve)(__dirname, "..", "templates", ctx.template.id);
73412
+ };
73413
+ isVariantInfo = (copyFiles) => {
73414
+ return "path" in copyFiles;
73415
+ };
73416
+ getCopyFilesDestinationDir = (ctx) => {
73417
+ const { copyFiles } = ctx.template;
73418
+ if (!copyFiles?.destinationDir) {
73419
+ return void 0;
73420
+ }
73421
+ if (typeof copyFiles.destinationDir === "string") {
73422
+ return copyFiles.destinationDir;
73423
+ }
73424
+ return copyFiles.destinationDir(ctx);
73425
+ };
73426
+ }
73427
+ });
73428
+
73297
73429
  // src/cli.ts
73298
73430
  var cli_exports = {};
73299
73431
  __export(cli_exports, {
@@ -73302,7 +73434,7 @@ __export(cli_exports, {
73302
73434
  runLatest: () => runLatest
73303
73435
  });
73304
73436
  module.exports = __toCommonJS(cli_exports);
73305
- var import_path12 = require("path");
73437
+ var import_path13 = require("path");
73306
73438
  var import_process3 = require("process");
73307
73439
  init_cli();
73308
73440
  init_args();
@@ -77121,12 +77253,12 @@ var YargsInstance = class {
77121
77253
  async getCompletion(args, done) {
77122
77254
  argsert("<array> [function]", [args, done], arguments.length);
77123
77255
  if (!done) {
77124
- return new Promise((resolve10, reject) => {
77256
+ return new Promise((resolve9, reject) => {
77125
77257
  __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
77126
77258
  if (err)
77127
77259
  reject(err);
77128
77260
  else
77129
- resolve10(completions);
77261
+ resolve9(completions);
77130
77262
  });
77131
77263
  });
77132
77264
  } else {
@@ -78351,268 +78483,8 @@ var createProject = async (ctx) => {
78351
78483
  }
78352
78484
  };
78353
78485
 
78354
- // src/templates.ts
78355
- var import_fs10 = require("fs");
78356
- var import_promises2 = require("fs/promises");
78357
- var import_os2 = require("os");
78358
- var import_path11 = require("path");
78359
- init_cli();
78360
- init_args();
78361
- init_colors();
78362
- init_interactive();
78363
- var import_deepmerge = __toESM(require_cjs());
78364
- var import_degit = __toESM(require_dist());
78365
- init_cli2();
78366
- init_files();
78367
-
78368
- // src/validators.ts
78369
- var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
78370
- var validateTemplateUrl = (value) => {
78371
- if (!String(value).match(TEMPLATE_REGEX)) {
78372
- return "Please enter a valid template url.";
78373
- }
78374
- };
78375
-
78376
- // src/templates.ts
78377
- var getFrameworkMap = async () => ({
78378
- angular: (await Promise.resolve().then(() => (init_c3(), c3_exports))).default,
78379
- astro: (await Promise.resolve().then(() => (init_c32(), c3_exports2))).default,
78380
- docusaurus: (await Promise.resolve().then(() => (init_c33(), c3_exports3))).default,
78381
- gatsby: (await Promise.resolve().then(() => (init_c34(), c3_exports4))).default,
78382
- hono: (await Promise.resolve().then(() => (init_c35(), c3_exports5))).default,
78383
- next: (await Promise.resolve().then(() => (init_c36(), c3_exports6))).default,
78384
- nuxt: (await Promise.resolve().then(() => (init_c37(), c3_exports7))).default,
78385
- qwik: (await Promise.resolve().then(() => (init_c38(), c3_exports8))).default,
78386
- react: (await Promise.resolve().then(() => (init_c39(), c3_exports9))).default,
78387
- remix: (await Promise.resolve().then(() => (init_c310(), c3_exports10))).default,
78388
- solid: (await Promise.resolve().then(() => (init_c311(), c3_exports11))).default,
78389
- svelte: (await Promise.resolve().then(() => (init_c312(), c3_exports12))).default,
78390
- vue: (await Promise.resolve().then(() => (init_c313(), c3_exports13))).default
78391
- });
78392
- var getTemplateMap = async () => {
78393
- return {
78394
- "hello-world": (await Promise.resolve().then(() => (init_c314(), c3_exports14))).default,
78395
- "hello-world-durable-object": (await Promise.resolve().then(() => (init_c315(), c3_exports15))).default,
78396
- // Dummy record -- actual template config resolved in `selectFramework`
78397
- webFramework: { displayName: "Website or web app" },
78398
- common: (await Promise.resolve().then(() => (init_c316(), c3_exports16))).default,
78399
- scheduled: (await Promise.resolve().then(() => (init_c317(), c3_exports17))).default,
78400
- queues: (await Promise.resolve().then(() => (init_c318(), c3_exports18))).default,
78401
- openapi: (await Promise.resolve().then(() => (init_c319(), c3_exports19))).default,
78402
- // Dummy record -- actual template config resolved in `processRemoteTemplate`
78403
- "remote-template": {
78404
- displayName: "Worker built from a template hosted in a git repository"
78405
- },
78406
- "pre-existing": (await Promise.resolve().then(() => (init_c320(), c3_exports20))).default
78407
- };
78408
- };
78409
- var selectTemplate = async (args) => {
78410
- if (!args.type) {
78411
- if (args.framework) {
78412
- args.type = "webFramework";
78413
- } else if (args.existingScript) {
78414
- args.type = "pre-existing";
78415
- } else if (args.template) {
78416
- args.type = "remote-template";
78417
- }
78418
- }
78419
- const templateMap = await getTemplateMap();
78420
- const templateOptions = Object.entries(templateMap).map(
78421
- ([value, { displayName, hidden: hidden2 }]) => ({
78422
- value,
78423
- label: displayName,
78424
- hidden: hidden2
78425
- })
78426
- );
78427
- const type = await processArgument(args, "type", {
78428
- type: "select",
78429
- question: "What type of application do you want to create?",
78430
- label: "type",
78431
- options: templateOptions,
78432
- defaultValue: C3_DEFAULTS.type
78433
- });
78434
- if (!type) {
78435
- return crash("An application type must be specified to continue.");
78436
- }
78437
- if (!Object.keys(templateMap).includes(type)) {
78438
- return crash(`Unknown application type provided: ${type}.`);
78439
- }
78440
- if (type === "webFramework") {
78441
- return selectFramework(args);
78442
- }
78443
- if (type === "remote-template") {
78444
- return processRemoteTemplate(args);
78445
- }
78446
- return templateMap[type];
78447
- };
78448
- var selectFramework = async (args) => {
78449
- const frameworkMap = await getFrameworkMap();
78450
- const frameworkOptions = Object.entries(frameworkMap).map(
78451
- ([key, config13]) => ({
78452
- label: config13.displayName,
78453
- value: key
78454
- })
78455
- );
78456
- const framework = await processArgument(args, "framework", {
78457
- type: "select",
78458
- label: "framework",
78459
- question: "Which development framework do you want to use?",
78460
- options: frameworkOptions,
78461
- defaultValue: C3_DEFAULTS.framework
78462
- });
78463
- if (!framework) {
78464
- crash("A framework must be selected to continue.");
78465
- }
78466
- if (!Object.keys(frameworkMap).includes(framework)) {
78467
- crash(`Unsupported framework: ${framework}`);
78468
- }
78469
- const defaultFrameworkConfig = {
78470
- deployScript: "pages:deploy",
78471
- devScript: "pages:dev"
78472
- };
78473
- return {
78474
- ...defaultFrameworkConfig,
78475
- ...frameworkMap[framework]
78476
- };
78477
- };
78478
- async function copyTemplateFiles(ctx) {
78479
- if (!ctx.template.copyFiles) {
78480
- return;
78481
- }
78482
- const { copyFiles } = ctx.template;
78483
- let srcdir;
78484
- if (copyFiles.path) {
78485
- srcdir = (0, import_path11.join)(getTemplatePath(ctx), copyFiles.path);
78486
- } else {
78487
- const typescript = await shouldUseTs(ctx);
78488
- const languageTarget = typescript ? "ts" : "js";
78489
- const variantPath = copyFiles[languageTarget].path;
78490
- srcdir = (0, import_path11.join)(getTemplatePath(ctx), variantPath);
78491
- }
78492
- const destdir = ctx.project.path;
78493
- const s = spinner();
78494
- s.start(`Copying template files`);
78495
- await (0, import_promises2.cp)(srcdir, destdir, { recursive: true, force: true });
78496
- const dummyGitIgnorePath = (0, import_path11.join)(destdir, "__dot__gitignore");
78497
- if ((0, import_fs10.existsSync)(dummyGitIgnorePath)) {
78498
- await (0, import_promises2.rename)(dummyGitIgnorePath, (0, import_path11.join)(destdir, ".gitignore"));
78499
- }
78500
- s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
78501
- }
78502
- var shouldUseTs = async (ctx) => {
78503
- if (usesTypescript(ctx)) {
78504
- return true;
78505
- }
78506
- return processArgument(ctx.args, "ts", {
78507
- type: "confirm",
78508
- question: "Do you want to use TypeScript?",
78509
- label: "typescript",
78510
- defaultValue: C3_DEFAULTS.ts
78511
- });
78512
- };
78513
- var processRemoteTemplate = async (args) => {
78514
- const templateUrl = await processArgument(args, "template", {
78515
- type: "text",
78516
- question: "What's the url of git repo containing the template you'd like to use?",
78517
- label: "repository",
78518
- validate: (val) => validateTemplateUrl(val || C3_DEFAULTS.template),
78519
- defaultValue: C3_DEFAULTS.template
78520
- });
78521
- const path3 = await downloadRemoteTemplate(templateUrl);
78522
- const config13 = inferTemplateConfig(path3);
78523
- validateTemplate(path3, config13);
78524
- return {
78525
- path: path3,
78526
- ...config13
78527
- };
78528
- };
78529
- var validateTemplate = (path3, config13) => {
78530
- if (typeof config13.copyFiles?.path == "string") {
78531
- validateTemplateSrcDirectory((0, import_path11.resolve)(path3, config13.copyFiles.path), config13);
78532
- } else {
78533
- for (const variant of Object.values(config13.copyFiles)) {
78534
- validateTemplateSrcDirectory((0, import_path11.resolve)(path3, variant.path), config13);
78535
- }
78536
- }
78537
- };
78538
- var validateTemplateSrcDirectory = (path3, config13) => {
78539
- if (config13.platform === "workers") {
78540
- const wranglerTomlPath = (0, import_path11.resolve)(path3, "wrangler.toml");
78541
- if (!(0, import_fs10.existsSync)(wranglerTomlPath)) {
78542
- crash(`create-cloudflare templates must contain a "wrangler.toml" file.`);
78543
- }
78544
- }
78545
- const pkgJsonPath = (0, import_path11.resolve)(path3, "package.json");
78546
- if (!(0, import_fs10.existsSync)(pkgJsonPath)) {
78547
- crash(`create-cloudflare templates must contain a "package.json" file.`);
78548
- }
78549
- };
78550
- var inferTemplateConfig = (path3) => {
78551
- return {
78552
- configVersion: 1,
78553
- id: "remote-template",
78554
- displayName: "A remote C3 template",
78555
- platform: "workers",
78556
- copyFiles: inferCopyFilesDefinition(path3)
78557
- };
78558
- };
78559
- var inferCopyFilesDefinition = (path3) => {
78560
- const copyFiles = {};
78561
- if ((0, import_fs10.existsSync)((0, import_path11.join)(path3, "js"))) {
78562
- copyFiles["js"] = { path: "./js" };
78563
- }
78564
- if ((0, import_fs10.existsSync)((0, import_path11.join)(path3, "ts"))) {
78565
- copyFiles["ts"] = { path: "./ts" };
78566
- }
78567
- if (Object.keys(copyFiles).length !== 0) {
78568
- return copyFiles;
78569
- }
78570
- return {
78571
- path: "."
78572
- };
78573
- };
78574
- var downloadRemoteTemplate = async (src) => {
78575
- const s = spinner();
78576
- try {
78577
- s.start(`Cloning template from: ${blue(src)}`);
78578
- const emitter = (0, import_degit.default)(src, {
78579
- cache: false,
78580
- verbose: false,
78581
- force: true
78582
- });
78583
- const tmpDir = await (0, import_promises2.mkdtemp)((0, import_path11.join)((0, import_os2.tmpdir)(), "c3-template"));
78584
- await emitter.clone(tmpDir);
78585
- s.stop(`${brandColor("template")} ${dim("cloned and validated")}`);
78586
- return tmpDir;
78587
- } catch (error2) {
78588
- s.stop(`${brandColor("template")} ${dim("failed")}`);
78589
- return crash(`Failed to clone remote template: ${src}`);
78590
- }
78591
- };
78592
- var updatePackageJson = async (ctx) => {
78593
- const s = spinner();
78594
- s.start("Updating `package.json`");
78595
- const placeholderNames = ["<TBD>", "TBD", ""];
78596
- const pkgJsonPath = (0, import_path11.resolve)(ctx.project.path, "package.json");
78597
- let pkgJson = readJSON(pkgJsonPath);
78598
- if (placeholderNames.includes(pkgJson.name)) {
78599
- pkgJson.name = ctx.project.name;
78600
- }
78601
- if (ctx.template.transformPackageJson) {
78602
- const transformed = await ctx.template.transformPackageJson(pkgJson);
78603
- pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
78604
- }
78605
- writeJSON(pkgJsonPath, pkgJson);
78606
- s.stop(`${brandColor("updated")} ${dim("`package.json`")}`);
78607
- };
78608
- var getTemplatePath = (ctx) => {
78609
- if (ctx.template.path) {
78610
- return ctx.template.path;
78611
- }
78612
- return (0, import_path11.resolve)(__dirname, "..", "templates", ctx.template.id);
78613
- };
78614
-
78615
78486
  // src/cli.ts
78487
+ init_templates2();
78616
78488
  init_workers();
78617
78489
  var { npm: npm14 } = detectPackageManager();
78618
78490
  var main = async (argv) => {
@@ -78655,7 +78527,7 @@ var runCli = async (args) => {
78655
78527
  args: validatedArgs,
78656
78528
  template,
78657
78529
  originalCWD,
78658
- gitRepoAlreadyExisted: await isInsideGitRepo((0, import_path12.dirname)(path3)),
78530
+ gitRepoAlreadyExisted: await isInsideGitRepo((0, import_path13.dirname)(path3)),
78659
78531
  deployment: {}
78660
78532
  };
78661
78533
  await runTemplate(ctx);
@@ -78672,7 +78544,7 @@ var create = async (ctx) => {
78672
78544
  await template.generate(ctx);
78673
78545
  }
78674
78546
  await copyTemplateFiles(ctx);
78675
- await updatePackageJson(ctx);
78547
+ await updatePackageName(ctx);
78676
78548
  (0, import_process3.chdir)(ctx.project.path);
78677
78549
  await npmInstall(ctx);
78678
78550
  await rectifyPmMismatch(ctx);
@@ -78687,6 +78559,7 @@ var configure7 = async (ctx) => {
78687
78559
  if (template.configure) {
78688
78560
  await template.configure({ ...ctx });
78689
78561
  }
78562
+ await updatePackageScripts(ctx);
78690
78563
  await offerGit(ctx);
78691
78564
  await gitCommit(ctx);
78692
78565
  endSection(`Application configured`);