create-cloudflare 2.12.1 → 2.13.0
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 +673 -591
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/templates/astro/c3.ts +78 -8
- package/templates/astro/snippets/runtimeDeclaration.ts +4 -0
- package/templates/astro/templates/wrangler.toml +50 -0
- package/templates/nuxt/c3.ts +1 -1
- package/templates/remix/c3.ts +37 -3
- package/templates/remix/templates/worker-configuration.d.ts +3 -0
- package/templates/remix/templates/wrangler.toml +50 -0
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 = "2.
|
|
3817
|
+
version = "2.13.0";
|
|
3818
3818
|
devDependencies = {
|
|
3819
3819
|
"@babel/parser": "^7.21.3",
|
|
3820
3820
|
"@babel/types": "^7.21.4",
|
|
@@ -3842,6 +3842,7 @@ var init_package = __esm({
|
|
|
3842
3842
|
deepmerge: "^4.3.1",
|
|
3843
3843
|
degit: "^2.8.4",
|
|
3844
3844
|
dns2: "^2.1.0",
|
|
3845
|
+
dotenv: "^16.0.0",
|
|
3845
3846
|
esbuild: "^0.17.12",
|
|
3846
3847
|
execa: "^7.1.1",
|
|
3847
3848
|
glob: "^10.3.3",
|
|
@@ -10596,7 +10597,7 @@ var require_symbols2 = __commonJS({
|
|
|
10596
10597
|
var require_webidl = __commonJS({
|
|
10597
10598
|
"../../node_modules/.pnpm/undici@5.28.3/node_modules/undici/lib/fetch/webidl.js"(exports2, module2) {
|
|
10598
10599
|
"use strict";
|
|
10599
|
-
var { types:
|
|
10600
|
+
var { types: types5 } = require("util");
|
|
10600
10601
|
var { hasOwn, toUSVString } = require_util2();
|
|
10601
10602
|
var webidl = {};
|
|
10602
10603
|
webidl.converters = {};
|
|
@@ -10761,7 +10762,7 @@ var require_webidl = __commonJS({
|
|
|
10761
10762
|
});
|
|
10762
10763
|
}
|
|
10763
10764
|
const result = {};
|
|
10764
|
-
if (!
|
|
10765
|
+
if (!types5.isProxy(O2)) {
|
|
10765
10766
|
const keys2 = Object.keys(O2);
|
|
10766
10767
|
for (const key of keys2) {
|
|
10767
10768
|
const typedKey = keyConverter(key);
|
|
@@ -10887,14 +10888,14 @@ var require_webidl = __commonJS({
|
|
|
10887
10888
|
return x2;
|
|
10888
10889
|
};
|
|
10889
10890
|
webidl.converters.ArrayBuffer = function(V2, opts = {}) {
|
|
10890
|
-
if (webidl.util.Type(V2) !== "Object" || !
|
|
10891
|
+
if (webidl.util.Type(V2) !== "Object" || !types5.isAnyArrayBuffer(V2)) {
|
|
10891
10892
|
throw webidl.errors.conversionFailed({
|
|
10892
10893
|
prefix: `${V2}`,
|
|
10893
10894
|
argument: `${V2}`,
|
|
10894
10895
|
types: ["ArrayBuffer"]
|
|
10895
10896
|
});
|
|
10896
10897
|
}
|
|
10897
|
-
if (opts.allowShared === false &&
|
|
10898
|
+
if (opts.allowShared === false && types5.isSharedArrayBuffer(V2)) {
|
|
10898
10899
|
throw webidl.errors.exception({
|
|
10899
10900
|
header: "ArrayBuffer",
|
|
10900
10901
|
message: "SharedArrayBuffer is not allowed."
|
|
@@ -10903,14 +10904,14 @@ var require_webidl = __commonJS({
|
|
|
10903
10904
|
return V2;
|
|
10904
10905
|
};
|
|
10905
10906
|
webidl.converters.TypedArray = function(V2, T2, opts = {}) {
|
|
10906
|
-
if (webidl.util.Type(V2) !== "Object" || !
|
|
10907
|
+
if (webidl.util.Type(V2) !== "Object" || !types5.isTypedArray(V2) || V2.constructor.name !== T2.name) {
|
|
10907
10908
|
throw webidl.errors.conversionFailed({
|
|
10908
10909
|
prefix: `${T2.name}`,
|
|
10909
10910
|
argument: `${V2}`,
|
|
10910
10911
|
types: [T2.name]
|
|
10911
10912
|
});
|
|
10912
10913
|
}
|
|
10913
|
-
if (opts.allowShared === false &&
|
|
10914
|
+
if (opts.allowShared === false && types5.isSharedArrayBuffer(V2.buffer)) {
|
|
10914
10915
|
throw webidl.errors.exception({
|
|
10915
10916
|
header: "ArrayBuffer",
|
|
10916
10917
|
message: "SharedArrayBuffer is not allowed."
|
|
@@ -10919,13 +10920,13 @@ var require_webidl = __commonJS({
|
|
|
10919
10920
|
return V2;
|
|
10920
10921
|
};
|
|
10921
10922
|
webidl.converters.DataView = function(V2, opts = {}) {
|
|
10922
|
-
if (webidl.util.Type(V2) !== "Object" || !
|
|
10923
|
+
if (webidl.util.Type(V2) !== "Object" || !types5.isDataView(V2)) {
|
|
10923
10924
|
throw webidl.errors.exception({
|
|
10924
10925
|
header: "DataView",
|
|
10925
10926
|
message: "Object is not a DataView."
|
|
10926
10927
|
});
|
|
10927
10928
|
}
|
|
10928
|
-
if (opts.allowShared === false &&
|
|
10929
|
+
if (opts.allowShared === false && types5.isSharedArrayBuffer(V2.buffer)) {
|
|
10929
10930
|
throw webidl.errors.exception({
|
|
10930
10931
|
header: "ArrayBuffer",
|
|
10931
10932
|
message: "SharedArrayBuffer is not allowed."
|
|
@@ -10934,13 +10935,13 @@ var require_webidl = __commonJS({
|
|
|
10934
10935
|
return V2;
|
|
10935
10936
|
};
|
|
10936
10937
|
webidl.converters.BufferSource = function(V2, opts = {}) {
|
|
10937
|
-
if (
|
|
10938
|
+
if (types5.isAnyArrayBuffer(V2)) {
|
|
10938
10939
|
return webidl.converters.ArrayBuffer(V2, opts);
|
|
10939
10940
|
}
|
|
10940
|
-
if (
|
|
10941
|
+
if (types5.isTypedArray(V2)) {
|
|
10941
10942
|
return webidl.converters.TypedArray(V2, V2.constructor);
|
|
10942
10943
|
}
|
|
10943
|
-
if (
|
|
10944
|
+
if (types5.isDataView(V2)) {
|
|
10944
10945
|
return webidl.converters.DataView(V2, opts);
|
|
10945
10946
|
}
|
|
10946
10947
|
throw new TypeError(`Could not convert ${V2} to a BufferSource.`);
|
|
@@ -11255,7 +11256,7 @@ var require_file = __commonJS({
|
|
|
11255
11256
|
"../../node_modules/.pnpm/undici@5.28.3/node_modules/undici/lib/fetch/file.js"(exports2, module2) {
|
|
11256
11257
|
"use strict";
|
|
11257
11258
|
var { Blob: Blob2, File: NativeFile } = require("buffer");
|
|
11258
|
-
var { types:
|
|
11259
|
+
var { types: types5 } = require("util");
|
|
11259
11260
|
var { kState } = require_symbols2();
|
|
11260
11261
|
var { isBlobLike } = require_util2();
|
|
11261
11262
|
var { webidl } = require_webidl();
|
|
@@ -11364,7 +11365,7 @@ var require_file = __commonJS({
|
|
|
11364
11365
|
if (isBlobLike(V2)) {
|
|
11365
11366
|
return webidl.converters.Blob(V2, { strict: false });
|
|
11366
11367
|
}
|
|
11367
|
-
if (ArrayBuffer.isView(V2) ||
|
|
11368
|
+
if (ArrayBuffer.isView(V2) || types5.isAnyArrayBuffer(V2)) {
|
|
11368
11369
|
return webidl.converters.BufferSource(V2, opts);
|
|
11369
11370
|
}
|
|
11370
11371
|
}
|
|
@@ -11408,7 +11409,7 @@ var require_file = __commonJS({
|
|
|
11408
11409
|
s = convertLineEndingsNative(s);
|
|
11409
11410
|
}
|
|
11410
11411
|
bytes.push(encoder.encode(s));
|
|
11411
|
-
} else if (
|
|
11412
|
+
} else if (types5.isAnyArrayBuffer(element) || types5.isTypedArray(element)) {
|
|
11412
11413
|
if (!element.buffer) {
|
|
11413
11414
|
bytes.push(new Uint8Array(element));
|
|
11414
11415
|
} else {
|
|
@@ -18297,7 +18298,7 @@ var require_response = __commonJS({
|
|
|
18297
18298
|
var { URLSerializer } = require_dataURL();
|
|
18298
18299
|
var { kHeadersList, kConstruct } = require_symbols();
|
|
18299
18300
|
var assert = require("assert");
|
|
18300
|
-
var { types:
|
|
18301
|
+
var { types: types5 } = require("util");
|
|
18301
18302
|
var ReadableStream = globalThis.ReadableStream || require("stream/web").ReadableStream;
|
|
18302
18303
|
var textEncoder = new TextEncoder("utf-8");
|
|
18303
18304
|
var Response = class {
|
|
@@ -18600,7 +18601,7 @@ var require_response = __commonJS({
|
|
|
18600
18601
|
if (isBlobLike(V2)) {
|
|
18601
18602
|
return webidl.converters.Blob(V2, { strict: false });
|
|
18602
18603
|
}
|
|
18603
|
-
if (
|
|
18604
|
+
if (types5.isArrayBuffer(V2) || types5.isTypedArray(V2) || types5.isDataView(V2)) {
|
|
18604
18605
|
return webidl.converters.BufferSource(V2);
|
|
18605
18606
|
}
|
|
18606
18607
|
if (util.isFormDataLike(V2)) {
|
|
@@ -20706,7 +20707,7 @@ var require_util4 = __commonJS({
|
|
|
20706
20707
|
var { getEncoding } = require_encoding();
|
|
20707
20708
|
var { DOMException: DOMException2 } = require_constants2();
|
|
20708
20709
|
var { serializeAMimeType, parseMIMEType } = require_dataURL();
|
|
20709
|
-
var { types:
|
|
20710
|
+
var { types: types5 } = require("util");
|
|
20710
20711
|
var { StringDecoder } = require("string_decoder");
|
|
20711
20712
|
var { btoa: btoa2 } = require("buffer");
|
|
20712
20713
|
var staticPropertyDescriptors = {
|
|
@@ -20736,7 +20737,7 @@ var require_util4 = __commonJS({
|
|
|
20736
20737
|
});
|
|
20737
20738
|
}
|
|
20738
20739
|
isFirstChunk = false;
|
|
20739
|
-
if (!done &&
|
|
20740
|
+
if (!done && types5.isUint8Array(value)) {
|
|
20740
20741
|
bytes.push(value);
|
|
20741
20742
|
if ((fr[kLastProgressEventFired] === void 0 || Date.now() - fr[kLastProgressEventFired] >= 50) && !fr[kAborted]) {
|
|
20742
20743
|
fr[kLastProgressEventFired] = Date.now();
|
|
@@ -23118,7 +23119,7 @@ var require_websocket = __commonJS({
|
|
|
23118
23119
|
var { ByteParser } = require_receiver();
|
|
23119
23120
|
var { kEnumerableProperty, isBlobLike } = require_util();
|
|
23120
23121
|
var { getGlobalDispatcher } = require_global2();
|
|
23121
|
-
var { types:
|
|
23122
|
+
var { types: types5 } = require("util");
|
|
23122
23123
|
var experimentalWarned = false;
|
|
23123
23124
|
var WebSocket = class extends EventTarget {
|
|
23124
23125
|
#events = {
|
|
@@ -23265,7 +23266,7 @@ var require_websocket = __commonJS({
|
|
|
23265
23266
|
socket.write(buffer, () => {
|
|
23266
23267
|
this.#bufferedAmount -= value.byteLength;
|
|
23267
23268
|
});
|
|
23268
|
-
} else if (
|
|
23269
|
+
} else if (types5.isArrayBuffer(data)) {
|
|
23269
23270
|
const value = Buffer.from(data);
|
|
23270
23271
|
const frame = new WebsocketFrameSend(value);
|
|
23271
23272
|
const buffer = frame.createFrame(opcodes.BINARY);
|
|
@@ -23487,7 +23488,7 @@ var require_websocket = __commonJS({
|
|
|
23487
23488
|
if (isBlobLike(V2)) {
|
|
23488
23489
|
return webidl.converters.Blob(V2, { strict: false });
|
|
23489
23490
|
}
|
|
23490
|
-
if (ArrayBuffer.isView(V2) ||
|
|
23491
|
+
if (ArrayBuffer.isView(V2) || types5.isAnyArrayBuffer(V2)) {
|
|
23491
23492
|
return webidl.converters.BufferSource(V2);
|
|
23492
23493
|
}
|
|
23493
23494
|
}
|
|
@@ -24216,15 +24217,15 @@ var init_package2 = __esm({
|
|
|
24216
24217
|
],
|
|
24217
24218
|
dependencies: {
|
|
24218
24219
|
"create-astro": "4.7.3",
|
|
24219
|
-
"@angular/create": "17.2.
|
|
24220
|
+
"@angular/create": "17.2.1",
|
|
24220
24221
|
"create-docusaurus": "3.1.1",
|
|
24221
24222
|
"create-hono": "0.4.0",
|
|
24222
24223
|
"create-next-app": "14.1.0",
|
|
24223
24224
|
"create-qwik": "1.4.5",
|
|
24224
24225
|
"create-react-app": "5.0.1",
|
|
24225
|
-
"create-remix": "2.7.
|
|
24226
|
+
"create-remix": "2.7.2",
|
|
24226
24227
|
"create-solid": "0.4.10",
|
|
24227
|
-
"create-svelte": "6.0.
|
|
24228
|
+
"create-svelte": "6.0.9",
|
|
24228
24229
|
"create-vue": "3.9.2",
|
|
24229
24230
|
gatsby: "5.13.3",
|
|
24230
24231
|
nuxi: "3.10.1"
|
|
@@ -25810,7 +25811,7 @@ var init_poll = __esm({
|
|
|
25810
25811
|
var version2;
|
|
25811
25812
|
var init_package3 = __esm({
|
|
25812
25813
|
"../wrangler/package.json"() {
|
|
25813
|
-
version2 = "3.
|
|
25814
|
+
version2 = "3.30.0";
|
|
25814
25815
|
}
|
|
25815
25816
|
});
|
|
25816
25817
|
|
|
@@ -32655,7 +32656,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
32655
32656
|
}
|
|
32656
32657
|
}
|
|
32657
32658
|
};
|
|
32658
|
-
var
|
|
32659
|
+
var types5 = createCommonjsModule(function(module3, exports3) {
|
|
32659
32660
|
exports3.name = /* @__PURE__ */ new Map([
|
|
32660
32661
|
["0", "File"],
|
|
32661
32662
|
// same as File
|
|
@@ -32909,14 +32910,14 @@ var require_index_688c5d50 = __commonJS({
|
|
|
32909
32910
|
}
|
|
32910
32911
|
}
|
|
32911
32912
|
get type() {
|
|
32912
|
-
return
|
|
32913
|
+
return types5.name.get(this[TYPE]) || this[TYPE];
|
|
32913
32914
|
}
|
|
32914
32915
|
get typeKey() {
|
|
32915
32916
|
return this[TYPE];
|
|
32916
32917
|
}
|
|
32917
32918
|
set type(type) {
|
|
32918
|
-
if (
|
|
32919
|
-
this[TYPE] =
|
|
32919
|
+
if (types5.code.has(type))
|
|
32920
|
+
this[TYPE] = types5.code.get(type);
|
|
32920
32921
|
else
|
|
32921
32922
|
this[TYPE] = type;
|
|
32922
32923
|
}
|
|
@@ -36028,7 +36029,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
36028
36029
|
exports3.WriteEntry = writeEntry;
|
|
36029
36030
|
exports3.Header = header;
|
|
36030
36031
|
exports3.Pax = pax;
|
|
36031
|
-
exports3.types =
|
|
36032
|
+
exports3.types = types5;
|
|
36032
36033
|
});
|
|
36033
36034
|
var colorName = {
|
|
36034
36035
|
"aliceblue": [240, 248, 255],
|
|
@@ -42394,364 +42395,6 @@ var init_c3 = __esm({
|
|
|
42394
42395
|
}
|
|
42395
42396
|
});
|
|
42396
42397
|
|
|
42397
|
-
// templates/astro/c3.ts
|
|
42398
|
-
var c3_exports2 = {};
|
|
42399
|
-
__export(c3_exports2, {
|
|
42400
|
-
default: () => c3_default2
|
|
42401
|
-
});
|
|
42402
|
-
var npx2, generate2, configure2, config2, c3_default2;
|
|
42403
|
-
var init_c32 = __esm({
|
|
42404
|
-
"templates/astro/c3.ts"() {
|
|
42405
|
-
init_cli();
|
|
42406
|
-
init_colors();
|
|
42407
|
-
init_command();
|
|
42408
|
-
init_files();
|
|
42409
|
-
init_packages();
|
|
42410
|
-
({ npx: npx2 } = detectPackageManager());
|
|
42411
|
-
generate2 = async (ctx) => {
|
|
42412
|
-
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
42413
|
-
logRaw("");
|
|
42414
|
-
};
|
|
42415
|
-
configure2 = async () => {
|
|
42416
|
-
await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
|
|
42417
|
-
silent: true,
|
|
42418
|
-
startText: "Installing adapter",
|
|
42419
|
-
doneText: `${brandColor("installed")} ${dim(
|
|
42420
|
-
`via \`${npx2} astro add cloudflare\``
|
|
42421
|
-
)}`
|
|
42422
|
-
});
|
|
42423
|
-
};
|
|
42424
|
-
config2 = {
|
|
42425
|
-
configVersion: 1,
|
|
42426
|
-
id: "astro",
|
|
42427
|
-
platform: "pages",
|
|
42428
|
-
displayName: "Astro",
|
|
42429
|
-
generate: generate2,
|
|
42430
|
-
configure: configure2,
|
|
42431
|
-
transformPackageJson: async () => ({
|
|
42432
|
-
scripts: {
|
|
42433
|
-
"pages:dev": `wrangler pages dev ${await compatDateFlag()} -- astro dev`,
|
|
42434
|
-
"pages:deploy": `astro build && wrangler pages deploy ./dist`
|
|
42435
|
-
}
|
|
42436
|
-
}),
|
|
42437
|
-
testFlags: [
|
|
42438
|
-
"--skip-houston",
|
|
42439
|
-
"--no-install",
|
|
42440
|
-
"--no-git",
|
|
42441
|
-
"--template",
|
|
42442
|
-
"blog",
|
|
42443
|
-
"--typescript",
|
|
42444
|
-
"strict"
|
|
42445
|
-
]
|
|
42446
|
-
};
|
|
42447
|
-
c3_default2 = config2;
|
|
42448
|
-
}
|
|
42449
|
-
});
|
|
42450
|
-
|
|
42451
|
-
// templates/docusaurus/c3.ts
|
|
42452
|
-
var c3_exports3 = {};
|
|
42453
|
-
__export(c3_exports3, {
|
|
42454
|
-
default: () => c3_default3
|
|
42455
|
-
});
|
|
42456
|
-
var npm4, generate3, config3, c3_default3;
|
|
42457
|
-
var init_c33 = __esm({
|
|
42458
|
-
"templates/docusaurus/c3.ts"() {
|
|
42459
|
-
init_command();
|
|
42460
|
-
init_files();
|
|
42461
|
-
init_packages();
|
|
42462
|
-
({ npm: npm4 } = detectPackageManager());
|
|
42463
|
-
generate3 = async (ctx) => {
|
|
42464
|
-
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
42465
|
-
};
|
|
42466
|
-
config3 = {
|
|
42467
|
-
configVersion: 1,
|
|
42468
|
-
id: "docusaurus",
|
|
42469
|
-
platform: "pages",
|
|
42470
|
-
displayName: "Docusaurus",
|
|
42471
|
-
generate: generate3,
|
|
42472
|
-
transformPackageJson: async () => ({
|
|
42473
|
-
scripts: {
|
|
42474
|
-
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm4} run start`,
|
|
42475
|
-
"pages:deploy": `${npm4} run build && wrangler pages deploy ./build`
|
|
42476
|
-
}
|
|
42477
|
-
}),
|
|
42478
|
-
testFlags: [`--package-manager`, npm4]
|
|
42479
|
-
};
|
|
42480
|
-
c3_default3 = config3;
|
|
42481
|
-
}
|
|
42482
|
-
});
|
|
42483
|
-
|
|
42484
|
-
// templates/gatsby/c3.ts
|
|
42485
|
-
var c3_exports4 = {};
|
|
42486
|
-
__export(c3_exports4, {
|
|
42487
|
-
default: () => c3_default4
|
|
42488
|
-
});
|
|
42489
|
-
var npm5, generate4, config4, c3_default4;
|
|
42490
|
-
var init_c34 = __esm({
|
|
42491
|
-
"templates/gatsby/c3.ts"() {
|
|
42492
|
-
init_interactive();
|
|
42493
|
-
init_command();
|
|
42494
|
-
init_files();
|
|
42495
|
-
init_packages();
|
|
42496
|
-
({ npm: npm5 } = detectPackageManager());
|
|
42497
|
-
generate4 = async (ctx) => {
|
|
42498
|
-
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
42499
|
-
const useTemplate = await inputPrompt({
|
|
42500
|
-
type: "confirm",
|
|
42501
|
-
question: "Would you like to use a template?",
|
|
42502
|
-
label: "template",
|
|
42503
|
-
defaultValue: true
|
|
42504
|
-
});
|
|
42505
|
-
let templateUrl = "";
|
|
42506
|
-
if (useTemplate) {
|
|
42507
|
-
templateUrl = await inputPrompt({
|
|
42508
|
-
type: "text",
|
|
42509
|
-
question: `Please specify the url of the template you'd like to use`,
|
|
42510
|
-
label: "template",
|
|
42511
|
-
defaultValue: defaultTemplate
|
|
42512
|
-
});
|
|
42513
|
-
}
|
|
42514
|
-
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
42515
|
-
};
|
|
42516
|
-
config4 = {
|
|
42517
|
-
configVersion: 1,
|
|
42518
|
-
id: "gatsby",
|
|
42519
|
-
platform: "pages",
|
|
42520
|
-
displayName: "Gatsby",
|
|
42521
|
-
generate: generate4,
|
|
42522
|
-
transformPackageJson: async () => ({
|
|
42523
|
-
scripts: {
|
|
42524
|
-
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 8000 -- ${npm5} run develop`,
|
|
42525
|
-
"pages:deploy": `${npm5} run build && wrangler pages deploy ./public`
|
|
42526
|
-
}
|
|
42527
|
-
})
|
|
42528
|
-
};
|
|
42529
|
-
c3_default4 = config4;
|
|
42530
|
-
}
|
|
42531
|
-
});
|
|
42532
|
-
|
|
42533
|
-
// templates/hono/c3.ts
|
|
42534
|
-
var c3_exports5 = {};
|
|
42535
|
-
__export(c3_exports5, {
|
|
42536
|
-
default: () => c3_default5
|
|
42537
|
-
});
|
|
42538
|
-
var generate5, config5, c3_default5;
|
|
42539
|
-
var init_c35 = __esm({
|
|
42540
|
-
"templates/hono/c3.ts"() {
|
|
42541
|
-
init_cli();
|
|
42542
|
-
init_command();
|
|
42543
|
-
generate5 = async (ctx) => {
|
|
42544
|
-
await runFrameworkGenerator(ctx, [
|
|
42545
|
-
ctx.project.name,
|
|
42546
|
-
"--template",
|
|
42547
|
-
"cloudflare-workers"
|
|
42548
|
-
]);
|
|
42549
|
-
logRaw("");
|
|
42550
|
-
};
|
|
42551
|
-
config5 = {
|
|
42552
|
-
configVersion: 1,
|
|
42553
|
-
id: "hono",
|
|
42554
|
-
displayName: "Hono",
|
|
42555
|
-
platform: "workers",
|
|
42556
|
-
generate: generate5,
|
|
42557
|
-
devScript: "dev",
|
|
42558
|
-
deployScript: "deploy"
|
|
42559
|
-
};
|
|
42560
|
-
c3_default5 = config5;
|
|
42561
|
-
}
|
|
42562
|
-
});
|
|
42563
|
-
|
|
42564
|
-
// templates/next/c3.ts
|
|
42565
|
-
var c3_exports6 = {};
|
|
42566
|
-
__export(c3_exports6, {
|
|
42567
|
-
default: () => c3_default6,
|
|
42568
|
-
shouldInstallNextOnPagesEslintPlugin: () => shouldInstallNextOnPagesEslintPlugin,
|
|
42569
|
-
writeEslintrc: () => writeEslintrc
|
|
42570
|
-
});
|
|
42571
|
-
var import_path9, npm6, npx3, generate6, updateNextConfig, configure3, shouldInstallNextOnPagesEslintPlugin, writeEslintrc, addDevDependencies, c3_default6;
|
|
42572
|
-
var init_c36 = __esm({
|
|
42573
|
-
"templates/next/c3.ts"() {
|
|
42574
|
-
import_path9 = require("path");
|
|
42575
|
-
init_cli();
|
|
42576
|
-
init_args();
|
|
42577
|
-
init_colors();
|
|
42578
|
-
init_interactive();
|
|
42579
|
-
init_command();
|
|
42580
|
-
init_files();
|
|
42581
|
-
init_packages();
|
|
42582
|
-
init_templates();
|
|
42583
|
-
({ npm: npm6, npx: npx3 } = detectPackageManager());
|
|
42584
|
-
generate6 = async (ctx) => {
|
|
42585
|
-
const projectName = ctx.project.name;
|
|
42586
|
-
await runFrameworkGenerator(ctx, [projectName]);
|
|
42587
|
-
copyFile(
|
|
42588
|
-
(0, import_path9.join)(getTemplatePath(ctx), "wrangler.toml"),
|
|
42589
|
-
(0, import_path9.join)(ctx.project.path, "wrangler.toml")
|
|
42590
|
-
);
|
|
42591
|
-
updateStatus("Created wrangler.toml file");
|
|
42592
|
-
};
|
|
42593
|
-
updateNextConfig = () => {
|
|
42594
|
-
const s = spinner();
|
|
42595
|
-
const configFile = "next.config.mjs";
|
|
42596
|
-
s.start(`Updating \`${configFile}\``);
|
|
42597
|
-
const configContent = readFile(configFile);
|
|
42598
|
-
const updatedConfigFile = `import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
|
|
42599
|
-
|
|
42600
|
-
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
|
|
42601
|
-
// (when running the application with \`next dev\`), for more information see:
|
|
42602
|
-
// https://github.com/cloudflare/next-on-pages/blob/5712c57ea7/internal-packages/next-dev/README.md
|
|
42603
|
-
if (process.env.NODE_ENV === 'development') {
|
|
42604
|
-
await setupDevPlatform();
|
|
42605
|
-
}
|
|
42606
|
-
|
|
42607
|
-
`.replace(/\n\t*/g, "\n") + configContent;
|
|
42608
|
-
writeFile2(configFile, updatedConfigFile);
|
|
42609
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
42610
|
-
};
|
|
42611
|
-
configure3 = async (ctx) => {
|
|
42612
|
-
const projectPath = ctx.project.path;
|
|
42613
|
-
const path3 = probePaths([
|
|
42614
|
-
`${projectPath}/pages/api`,
|
|
42615
|
-
`${projectPath}/src/pages/api`,
|
|
42616
|
-
`${projectPath}/src/app/api`,
|
|
42617
|
-
`${projectPath}/app/api`,
|
|
42618
|
-
`${projectPath}/src/app`,
|
|
42619
|
-
`${projectPath}/app`
|
|
42620
|
-
]);
|
|
42621
|
-
if (!path3) {
|
|
42622
|
-
crash("Could not find the `/api` or `/app` directory");
|
|
42623
|
-
}
|
|
42624
|
-
const usesTs = usesTypescript(ctx);
|
|
42625
|
-
if (usesTs) {
|
|
42626
|
-
copyFile(
|
|
42627
|
-
(0, import_path9.join)(getTemplatePath(ctx), "env.d.ts"),
|
|
42628
|
-
(0, import_path9.join)(projectPath, "env.d.ts")
|
|
42629
|
-
);
|
|
42630
|
-
updateStatus("Created an env.d.ts file");
|
|
42631
|
-
}
|
|
42632
|
-
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
42633
|
-
if (installEslintPlugin) {
|
|
42634
|
-
await writeEslintrc(ctx);
|
|
42635
|
-
}
|
|
42636
|
-
updateNextConfig();
|
|
42637
|
-
copyFile(
|
|
42638
|
-
(0, import_path9.join)(getTemplatePath(ctx), "README.md"),
|
|
42639
|
-
(0, import_path9.join)(projectPath, "README.md")
|
|
42640
|
-
);
|
|
42641
|
-
updateStatus("Updated the README file");
|
|
42642
|
-
await addDevDependencies(installEslintPlugin);
|
|
42643
|
-
};
|
|
42644
|
-
shouldInstallNextOnPagesEslintPlugin = async (ctx) => {
|
|
42645
|
-
const eslintUsage = usesEslint(ctx);
|
|
42646
|
-
if (!eslintUsage.used)
|
|
42647
|
-
return false;
|
|
42648
|
-
if (eslintUsage.configType !== ".eslintrc.json") {
|
|
42649
|
-
warn(
|
|
42650
|
-
`Expected .eslintrc.json from Next.js scaffolding but found ${eslintUsage.configType} instead`
|
|
42651
|
-
);
|
|
42652
|
-
return false;
|
|
42653
|
-
}
|
|
42654
|
-
return await processArgument(ctx.args, "eslint-plugin", {
|
|
42655
|
-
type: "confirm",
|
|
42656
|
-
question: "Do you want to use the next-on-pages eslint-plugin?",
|
|
42657
|
-
label: "eslint-plugin",
|
|
42658
|
-
defaultValue: true
|
|
42659
|
-
});
|
|
42660
|
-
};
|
|
42661
|
-
writeEslintrc = async (ctx) => {
|
|
42662
|
-
const eslintConfig = readJSON(`${ctx.project.path}/.eslintrc.json`);
|
|
42663
|
-
eslintConfig.plugins ??= [];
|
|
42664
|
-
eslintConfig.plugins.push("eslint-plugin-next-on-pages");
|
|
42665
|
-
if (typeof eslintConfig.extends === "string") {
|
|
42666
|
-
eslintConfig.extends = [eslintConfig.extends];
|
|
42667
|
-
}
|
|
42668
|
-
eslintConfig.extends ??= [];
|
|
42669
|
-
eslintConfig.extends.push("plugin:eslint-plugin-next-on-pages/recommended");
|
|
42670
|
-
writeJSON(`${ctx.project.path}/.eslintrc.json`, eslintConfig);
|
|
42671
|
-
};
|
|
42672
|
-
addDevDependencies = async (installEslintPlugin) => {
|
|
42673
|
-
const packages = [
|
|
42674
|
-
"@cloudflare/next-on-pages@1",
|
|
42675
|
-
"@cloudflare/workers-types",
|
|
42676
|
-
"vercel",
|
|
42677
|
-
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
42678
|
-
];
|
|
42679
|
-
await installPackages(packages, {
|
|
42680
|
-
dev: true,
|
|
42681
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
42682
|
-
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
42683
|
-
});
|
|
42684
|
-
};
|
|
42685
|
-
c3_default6 = {
|
|
42686
|
-
configVersion: 1,
|
|
42687
|
-
id: "next",
|
|
42688
|
-
platform: "pages",
|
|
42689
|
-
displayName: "Next",
|
|
42690
|
-
devScript: "dev",
|
|
42691
|
-
previewScript: "preview",
|
|
42692
|
-
deployScript: "deploy",
|
|
42693
|
-
generate: generate6,
|
|
42694
|
-
configure: configure3,
|
|
42695
|
-
copyFiles: {
|
|
42696
|
-
async selectVariant(ctx) {
|
|
42697
|
-
const isApp = probePaths([
|
|
42698
|
-
`${ctx.project.path}/src/app`,
|
|
42699
|
-
`${ctx.project.path}/app`
|
|
42700
|
-
]);
|
|
42701
|
-
const isTypescript = usesTypescript(ctx);
|
|
42702
|
-
const dir = isApp ? "app" : "pages";
|
|
42703
|
-
return `${dir}/${isTypescript ? "ts" : "js"}`;
|
|
42704
|
-
},
|
|
42705
|
-
destinationDir(ctx) {
|
|
42706
|
-
const srcPath = probePaths([`${ctx.project.path}/src`]);
|
|
42707
|
-
return srcPath ? "./src" : "./";
|
|
42708
|
-
},
|
|
42709
|
-
variants: {
|
|
42710
|
-
"app/ts": {
|
|
42711
|
-
path: "./app/ts"
|
|
42712
|
-
},
|
|
42713
|
-
"app/js": {
|
|
42714
|
-
path: "./app/js"
|
|
42715
|
-
},
|
|
42716
|
-
"pages/ts": {
|
|
42717
|
-
path: "./pages/ts"
|
|
42718
|
-
},
|
|
42719
|
-
"pages/js": {
|
|
42720
|
-
path: "./pages/js"
|
|
42721
|
-
}
|
|
42722
|
-
}
|
|
42723
|
-
},
|
|
42724
|
-
transformPackageJson: async () => {
|
|
42725
|
-
const isNpm = npm6 === "npm";
|
|
42726
|
-
const isBun = npm6 === "bun";
|
|
42727
|
-
const isNpmOrBun = isNpm || isBun;
|
|
42728
|
-
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
42729
|
-
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
42730
|
-
const pmCommand = isNpmOrBun ? npx3 : npm6;
|
|
42731
|
-
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
42732
|
-
return {
|
|
42733
|
-
scripts: {
|
|
42734
|
-
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
42735
|
-
preview: `${pagesBuildRunCommand} && wrangler pages dev .vercel/output/static`,
|
|
42736
|
-
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static`
|
|
42737
|
-
}
|
|
42738
|
-
};
|
|
42739
|
-
},
|
|
42740
|
-
testFlags: [
|
|
42741
|
-
"--typescript",
|
|
42742
|
-
"--no-install",
|
|
42743
|
-
"--eslint",
|
|
42744
|
-
"--tailwind",
|
|
42745
|
-
"--src-dir",
|
|
42746
|
-
"--app",
|
|
42747
|
-
"--import-alias",
|
|
42748
|
-
"@/*"
|
|
42749
|
-
],
|
|
42750
|
-
compatibilityFlags: ["nodejs_compat"]
|
|
42751
|
-
};
|
|
42752
|
-
}
|
|
42753
|
-
});
|
|
42754
|
-
|
|
42755
42398
|
// ../../node_modules/.pnpm/tslib@2.5.3/node_modules/tslib/tslib.es6.mjs
|
|
42756
42399
|
var tslib_es6_exports = {};
|
|
42757
42400
|
__export(tslib_es6_exports, {
|
|
@@ -43342,9 +42985,9 @@ var require_types = __commonJS({
|
|
|
43342
42985
|
/** @class */
|
|
43343
42986
|
function(_super) {
|
|
43344
42987
|
(0, tslib_1.__extends)(OrType2, _super);
|
|
43345
|
-
function OrType2(
|
|
42988
|
+
function OrType2(types5) {
|
|
43346
42989
|
var _this = _super.call(this) || this;
|
|
43347
|
-
_this.types =
|
|
42990
|
+
_this.types = types5;
|
|
43348
42991
|
_this.kind = "OrType";
|
|
43349
42992
|
return _this;
|
|
43350
42993
|
}
|
|
@@ -43489,11 +43132,11 @@ var require_types = __commonJS({
|
|
|
43489
43132
|
function typesPlugin(_fork) {
|
|
43490
43133
|
var Type = {
|
|
43491
43134
|
or: function() {
|
|
43492
|
-
var
|
|
43135
|
+
var types5 = [];
|
|
43493
43136
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
43494
|
-
|
|
43137
|
+
types5[_i] = arguments[_i];
|
|
43495
43138
|
}
|
|
43496
|
-
return new OrType(
|
|
43139
|
+
return new OrType(types5.map(function(type) {
|
|
43497
43140
|
return Type.from(type);
|
|
43498
43141
|
}));
|
|
43499
43142
|
},
|
|
@@ -43942,9 +43585,9 @@ var require_path = __commonJS({
|
|
|
43942
43585
|
var Op = Object.prototype;
|
|
43943
43586
|
var hasOwn = Op.hasOwnProperty;
|
|
43944
43587
|
function pathPlugin(fork) {
|
|
43945
|
-
var
|
|
43946
|
-
var isArray =
|
|
43947
|
-
var isNumber =
|
|
43588
|
+
var types5 = fork.use(types_1.default);
|
|
43589
|
+
var isArray = types5.builtInTypes.array;
|
|
43590
|
+
var isNumber = types5.builtInTypes.number;
|
|
43948
43591
|
var Path = function Path2(value, parentPath, name2) {
|
|
43949
43592
|
if (!(this instanceof Path2)) {
|
|
43950
43593
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -44244,13 +43887,13 @@ var require_scope = __commonJS({
|
|
|
44244
43887
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
44245
43888
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
44246
43889
|
function scopePlugin(fork) {
|
|
44247
|
-
var
|
|
44248
|
-
var Type =
|
|
44249
|
-
var namedTypes =
|
|
43890
|
+
var types5 = fork.use(types_1.default);
|
|
43891
|
+
var Type = types5.Type;
|
|
43892
|
+
var namedTypes = types5.namedTypes;
|
|
44250
43893
|
var Node = namedTypes.Node;
|
|
44251
43894
|
var Expression = namedTypes.Expression;
|
|
44252
|
-
var isArray =
|
|
44253
|
-
var b2 =
|
|
43895
|
+
var isArray = types5.builtInTypes.array;
|
|
43896
|
+
var b2 = types5.builders;
|
|
44254
43897
|
var Scope = function Scope2(path3, parentScope) {
|
|
44255
43898
|
if (!(this instanceof Scope2)) {
|
|
44256
43899
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -44318,7 +43961,7 @@ var require_scope = __commonJS({
|
|
|
44318
43961
|
++index;
|
|
44319
43962
|
}
|
|
44320
43963
|
var name2 = prefix + index;
|
|
44321
|
-
return this.bindings[name2] =
|
|
43964
|
+
return this.bindings[name2] = types5.builders.identifier(name2);
|
|
44322
43965
|
};
|
|
44323
43966
|
Sp.injectTemporary = function(identifier, init) {
|
|
44324
43967
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -44398,7 +44041,7 @@ var require_scope = __commonJS({
|
|
|
44398
44041
|
bindings
|
|
44399
44042
|
);
|
|
44400
44043
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
44401
|
-
|
|
44044
|
+
types5.eachField(node, function(name2, child) {
|
|
44402
44045
|
var childPath = path3.get(name2);
|
|
44403
44046
|
if (!pathHasValue(childPath, child)) {
|
|
44404
44047
|
throw new Error("");
|
|
@@ -44477,24 +44120,24 @@ var require_scope = __commonJS({
|
|
|
44477
44120
|
addPattern(patternPath.get("argument"), bindings);
|
|
44478
44121
|
}
|
|
44479
44122
|
}
|
|
44480
|
-
function addTypePattern(patternPath,
|
|
44123
|
+
function addTypePattern(patternPath, types6) {
|
|
44481
44124
|
var pattern = patternPath.value;
|
|
44482
44125
|
namedTypes.Pattern.assert(pattern);
|
|
44483
44126
|
if (namedTypes.Identifier.check(pattern)) {
|
|
44484
|
-
if (hasOwn.call(
|
|
44485
|
-
|
|
44127
|
+
if (hasOwn.call(types6, pattern.name)) {
|
|
44128
|
+
types6[pattern.name].push(patternPath);
|
|
44486
44129
|
} else {
|
|
44487
|
-
|
|
44130
|
+
types6[pattern.name] = [patternPath];
|
|
44488
44131
|
}
|
|
44489
44132
|
}
|
|
44490
44133
|
}
|
|
44491
|
-
function addTypeParameter(parameterPath,
|
|
44134
|
+
function addTypeParameter(parameterPath, types6) {
|
|
44492
44135
|
var parameter = parameterPath.value;
|
|
44493
44136
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
44494
|
-
if (hasOwn.call(
|
|
44495
|
-
|
|
44137
|
+
if (hasOwn.call(types6, parameter.name)) {
|
|
44138
|
+
types6[parameter.name].push(parameterPath);
|
|
44496
44139
|
} else {
|
|
44497
|
-
|
|
44140
|
+
types6[parameter.name] = [parameterPath];
|
|
44498
44141
|
}
|
|
44499
44142
|
}
|
|
44500
44143
|
Sp.lookup = function(name2) {
|
|
@@ -44532,11 +44175,11 @@ var require_node_path = __commonJS({
|
|
|
44532
44175
|
var path_1 = (0, tslib_1.__importDefault)(require_path());
|
|
44533
44176
|
var scope_1 = (0, tslib_1.__importDefault)(require_scope());
|
|
44534
44177
|
function nodePathPlugin(fork) {
|
|
44535
|
-
var
|
|
44536
|
-
var n2 =
|
|
44537
|
-
var b2 =
|
|
44538
|
-
var isNumber =
|
|
44539
|
-
var isArray =
|
|
44178
|
+
var types5 = fork.use(types_1.default);
|
|
44179
|
+
var n2 = types5.namedTypes;
|
|
44180
|
+
var b2 = types5.builders;
|
|
44181
|
+
var isNumber = types5.builtInTypes.number;
|
|
44182
|
+
var isArray = types5.builtInTypes.array;
|
|
44540
44183
|
var Path = fork.use(path_1.default);
|
|
44541
44184
|
var Scope = fork.use(scope_1.default);
|
|
44542
44185
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -44627,7 +44270,7 @@ var require_node_path = __commonJS({
|
|
|
44627
44270
|
return scope || null;
|
|
44628
44271
|
};
|
|
44629
44272
|
NPp.getValueProperty = function(name2) {
|
|
44630
|
-
return
|
|
44273
|
+
return types5.getFieldValue(this.value, name2);
|
|
44631
44274
|
};
|
|
44632
44275
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
44633
44276
|
var pp = this.parentPath;
|
|
@@ -44769,7 +44412,7 @@ var require_node_path = __commonJS({
|
|
|
44769
44412
|
return node.some(containsCallExpression);
|
|
44770
44413
|
}
|
|
44771
44414
|
if (n2.Node.check(node)) {
|
|
44772
|
-
return
|
|
44415
|
+
return types5.someField(node, function(_name, child) {
|
|
44773
44416
|
return containsCallExpression(child);
|
|
44774
44417
|
});
|
|
44775
44418
|
}
|
|
@@ -44887,11 +44530,11 @@ var require_path_visitor = __commonJS({
|
|
|
44887
44530
|
var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
|
|
44888
44531
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
44889
44532
|
function pathVisitorPlugin(fork) {
|
|
44890
|
-
var
|
|
44533
|
+
var types5 = fork.use(types_1.default);
|
|
44891
44534
|
var NodePath = fork.use(node_path_1.default);
|
|
44892
|
-
var isArray =
|
|
44893
|
-
var isObject2 =
|
|
44894
|
-
var isFunction2 =
|
|
44535
|
+
var isArray = types5.builtInTypes.array;
|
|
44536
|
+
var isObject2 = types5.builtInTypes.object;
|
|
44537
|
+
var isFunction2 = types5.builtInTypes.function;
|
|
44895
44538
|
var undefined2;
|
|
44896
44539
|
var PathVisitor = function PathVisitor2() {
|
|
44897
44540
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -44911,7 +44554,7 @@ var require_path_visitor = __commonJS({
|
|
|
44911
44554
|
typeNames[methodName.slice("visit".length)] = true;
|
|
44912
44555
|
}
|
|
44913
44556
|
}
|
|
44914
|
-
var supertypeTable =
|
|
44557
|
+
var supertypeTable = types5.computeSupertypeLookupTable(typeNames);
|
|
44915
44558
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
44916
44559
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
44917
44560
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -45030,7 +44673,7 @@ var require_path_visitor = __commonJS({
|
|
|
45030
44673
|
path3.each(visitor.visitWithoutReset, visitor);
|
|
45031
44674
|
} else if (!isObject2.check(value)) {
|
|
45032
44675
|
} else {
|
|
45033
|
-
var childNames =
|
|
44676
|
+
var childNames = types5.getFieldNames(value);
|
|
45034
44677
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
45035
44678
|
childNames.push("comments");
|
|
45036
44679
|
}
|
|
@@ -45039,7 +44682,7 @@ var require_path_visitor = __commonJS({
|
|
|
45039
44682
|
for (var i = 0; i < childCount; ++i) {
|
|
45040
44683
|
var childName = childNames[i];
|
|
45041
44684
|
if (!hasOwn.call(value, childName)) {
|
|
45042
|
-
value[childName] =
|
|
44685
|
+
value[childName] = types5.getFieldValue(value, childName);
|
|
45043
44686
|
}
|
|
45044
44687
|
childPaths.push(path3.get(childName));
|
|
45045
44688
|
}
|
|
@@ -45179,13 +44822,13 @@ var require_equiv = __commonJS({
|
|
|
45179
44822
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
45180
44823
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45181
44824
|
function default_1(fork) {
|
|
45182
|
-
var
|
|
45183
|
-
var getFieldNames =
|
|
45184
|
-
var getFieldValue =
|
|
45185
|
-
var isArray =
|
|
45186
|
-
var isObject2 =
|
|
45187
|
-
var isDate =
|
|
45188
|
-
var isRegExp =
|
|
44825
|
+
var types5 = fork.use(types_1.default);
|
|
44826
|
+
var getFieldNames = types5.getFieldNames;
|
|
44827
|
+
var getFieldValue = types5.getFieldValue;
|
|
44828
|
+
var isArray = types5.builtInTypes.array;
|
|
44829
|
+
var isObject2 = types5.builtInTypes.object;
|
|
44830
|
+
var isDate = types5.builtInTypes.Date;
|
|
44831
|
+
var isRegExp = types5.builtInTypes.RegExp;
|
|
45189
44832
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
45190
44833
|
function astNodesAreEquivalent(a, b2, problemPath) {
|
|
45191
44834
|
if (isArray.check(problemPath)) {
|
|
@@ -45335,24 +44978,24 @@ var require_fork = __commonJS({
|
|
|
45335
44978
|
var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
|
|
45336
44979
|
function default_1(plugins) {
|
|
45337
44980
|
var fork = createFork();
|
|
45338
|
-
var
|
|
44981
|
+
var types5 = fork.use(types_1.default);
|
|
45339
44982
|
plugins.forEach(fork.use);
|
|
45340
|
-
|
|
44983
|
+
types5.finalize();
|
|
45341
44984
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
45342
44985
|
return {
|
|
45343
|
-
Type:
|
|
45344
|
-
builtInTypes:
|
|
45345
|
-
namedTypes:
|
|
45346
|
-
builders:
|
|
45347
|
-
defineMethod:
|
|
45348
|
-
getFieldNames:
|
|
45349
|
-
getFieldValue:
|
|
45350
|
-
eachField:
|
|
45351
|
-
someField:
|
|
45352
|
-
getSupertypeNames:
|
|
45353
|
-
getBuilderName:
|
|
44986
|
+
Type: types5.Type,
|
|
44987
|
+
builtInTypes: types5.builtInTypes,
|
|
44988
|
+
namedTypes: types5.namedTypes,
|
|
44989
|
+
builders: types5.builders,
|
|
44990
|
+
defineMethod: types5.defineMethod,
|
|
44991
|
+
getFieldNames: types5.getFieldNames,
|
|
44992
|
+
getFieldValue: types5.getFieldValue,
|
|
44993
|
+
eachField: types5.eachField,
|
|
44994
|
+
someField: types5.someField,
|
|
44995
|
+
getSupertypeNames: types5.getSupertypeNames,
|
|
44996
|
+
getBuilderName: types5.getBuilderName,
|
|
45354
44997
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
45355
|
-
finalize:
|
|
44998
|
+
finalize: types5.finalize,
|
|
45356
44999
|
Path: fork.use(path_1.default),
|
|
45357
45000
|
NodePath: fork.use(node_path_1.default),
|
|
45358
45001
|
PathVisitor,
|
|
@@ -45388,9 +45031,9 @@ var require_shared = __commonJS({
|
|
|
45388
45031
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
45389
45032
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45390
45033
|
function default_1(fork) {
|
|
45391
|
-
var
|
|
45392
|
-
var Type =
|
|
45393
|
-
var builtin =
|
|
45034
|
+
var types5 = fork.use(types_1.default);
|
|
45035
|
+
var Type = types5.Type;
|
|
45036
|
+
var builtin = types5.builtInTypes;
|
|
45394
45037
|
var isNumber = builtin.number;
|
|
45395
45038
|
function geq(than) {
|
|
45396
45039
|
return Type.from(function(value) {
|
|
@@ -45569,8 +45212,8 @@ var require_core2 = __commonJS({
|
|
|
45569
45212
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45570
45213
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45571
45214
|
function default_1(fork) {
|
|
45572
|
-
var
|
|
45573
|
-
var Type =
|
|
45215
|
+
var types5 = fork.use(types_1.default);
|
|
45216
|
+
var Type = types5.Type;
|
|
45574
45217
|
var def = Type.def;
|
|
45575
45218
|
var or = Type.or;
|
|
45576
45219
|
var shared = fork.use(shared_1.default);
|
|
@@ -45660,9 +45303,9 @@ var require_es6 = __commonJS({
|
|
|
45660
45303
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45661
45304
|
function default_1(fork) {
|
|
45662
45305
|
fork.use(core_1.default);
|
|
45663
|
-
var
|
|
45664
|
-
var def =
|
|
45665
|
-
var or =
|
|
45306
|
+
var types5 = fork.use(types_1.default);
|
|
45307
|
+
var def = types5.Type.def;
|
|
45308
|
+
var or = types5.Type.or;
|
|
45666
45309
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45667
45310
|
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"]);
|
|
45668
45311
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -45748,8 +45391,8 @@ var require_es2017 = __commonJS({
|
|
|
45748
45391
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45749
45392
|
function default_1(fork) {
|
|
45750
45393
|
fork.use(es2016_1.default);
|
|
45751
|
-
var
|
|
45752
|
-
var def =
|
|
45394
|
+
var types5 = fork.use(types_1.default);
|
|
45395
|
+
var def = types5.Type.def;
|
|
45753
45396
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45754
45397
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
45755
45398
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -45770,9 +45413,9 @@ var require_es2018 = __commonJS({
|
|
|
45770
45413
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45771
45414
|
function default_1(fork) {
|
|
45772
45415
|
fork.use(es2017_1.default);
|
|
45773
|
-
var
|
|
45774
|
-
var def =
|
|
45775
|
-
var or =
|
|
45416
|
+
var types5 = fork.use(types_1.default);
|
|
45417
|
+
var def = types5.Type.def;
|
|
45418
|
+
var or = types5.Type.or;
|
|
45776
45419
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45777
45420
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
45778
45421
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -45802,9 +45445,9 @@ var require_es2019 = __commonJS({
|
|
|
45802
45445
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45803
45446
|
function default_1(fork) {
|
|
45804
45447
|
fork.use(es2018_1.default);
|
|
45805
|
-
var
|
|
45806
|
-
var def =
|
|
45807
|
-
var or =
|
|
45448
|
+
var types5 = fork.use(types_1.default);
|
|
45449
|
+
var def = types5.Type.def;
|
|
45450
|
+
var or = types5.Type.or;
|
|
45808
45451
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45809
45452
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
45810
45453
|
}
|
|
@@ -45826,9 +45469,9 @@ var require_es20202 = __commonJS({
|
|
|
45826
45469
|
function default_1(fork) {
|
|
45827
45470
|
fork.use(es2020_1.default);
|
|
45828
45471
|
fork.use(es2019_1.default);
|
|
45829
|
-
var
|
|
45830
|
-
var def =
|
|
45831
|
-
var or =
|
|
45472
|
+
var types5 = fork.use(types_1.default);
|
|
45473
|
+
var def = types5.Type.def;
|
|
45474
|
+
var or = types5.Type.or;
|
|
45832
45475
|
var shared = fork.use(shared_1.default);
|
|
45833
45476
|
var defaults = shared.defaults;
|
|
45834
45477
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -45872,8 +45515,8 @@ var require_es2022 = __commonJS({
|
|
|
45872
45515
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45873
45516
|
function default_1(fork) {
|
|
45874
45517
|
fork.use(es2021_1.default);
|
|
45875
|
-
var
|
|
45876
|
-
var def =
|
|
45518
|
+
var types5 = fork.use(types_1.default);
|
|
45519
|
+
var def = types5.Type.def;
|
|
45877
45520
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
45878
45521
|
}
|
|
45879
45522
|
exports2.default = default_1;
|
|
@@ -45892,9 +45535,9 @@ var require_es_proposals = __commonJS({
|
|
|
45892
45535
|
var es2022_1 = (0, tslib_1.__importDefault)(require_es2022());
|
|
45893
45536
|
function default_1(fork) {
|
|
45894
45537
|
fork.use(es2022_1.default);
|
|
45895
|
-
var
|
|
45896
|
-
var Type =
|
|
45897
|
-
var def =
|
|
45538
|
+
var types5 = fork.use(types_1.default);
|
|
45539
|
+
var Type = types5.Type;
|
|
45540
|
+
var def = types5.Type.def;
|
|
45898
45541
|
var or = Type.or;
|
|
45899
45542
|
var shared = fork.use(shared_1.default);
|
|
45900
45543
|
var defaults = shared.defaults;
|
|
@@ -45932,9 +45575,9 @@ var require_jsx = __commonJS({
|
|
|
45932
45575
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45933
45576
|
function default_1(fork) {
|
|
45934
45577
|
fork.use(es_proposals_1.default);
|
|
45935
|
-
var
|
|
45936
|
-
var def =
|
|
45937
|
-
var or =
|
|
45578
|
+
var types5 = fork.use(types_1.default);
|
|
45579
|
+
var def = types5.Type.def;
|
|
45580
|
+
var or = types5.Type.or;
|
|
45938
45581
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45939
45582
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
45940
45583
|
def("Literal"),
|
|
@@ -45996,9 +45639,9 @@ var require_type_annotations = __commonJS({
|
|
|
45996
45639
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45997
45640
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45998
45641
|
function default_1(fork) {
|
|
45999
|
-
var
|
|
46000
|
-
var def =
|
|
46001
|
-
var or =
|
|
45642
|
+
var types5 = fork.use(types_1.default);
|
|
45643
|
+
var def = types5.Type.def;
|
|
45644
|
+
var or = types5.Type.or;
|
|
46002
45645
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46003
45646
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
46004
45647
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -46031,9 +45674,9 @@ var require_flow = __commonJS({
|
|
|
46031
45674
|
function default_1(fork) {
|
|
46032
45675
|
fork.use(es_proposals_1.default);
|
|
46033
45676
|
fork.use(type_annotations_1.default);
|
|
46034
|
-
var
|
|
46035
|
-
var def =
|
|
46036
|
-
var or =
|
|
45677
|
+
var types5 = fork.use(types_1.default);
|
|
45678
|
+
var def = types5.Type.def;
|
|
45679
|
+
var or = types5.Type.or;
|
|
46037
45680
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46038
45681
|
def("Flow").bases("Node");
|
|
46039
45682
|
def("FlowType").bases("Flow");
|
|
@@ -46148,10 +45791,10 @@ var require_esprima = __commonJS({
|
|
|
46148
45791
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
46149
45792
|
function default_1(fork) {
|
|
46150
45793
|
fork.use(es_proposals_1.default);
|
|
46151
|
-
var
|
|
45794
|
+
var types5 = fork.use(types_1.default);
|
|
46152
45795
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46153
|
-
var def =
|
|
46154
|
-
var or =
|
|
45796
|
+
var def = types5.Type.def;
|
|
45797
|
+
var or = types5.Type.or;
|
|
46155
45798
|
def("VariableDeclaration").field("declarations", [or(
|
|
46156
45799
|
def("VariableDeclarator"),
|
|
46157
45800
|
def("Identifier")
|
|
@@ -46208,11 +45851,11 @@ var require_babel_core = __commonJS({
|
|
|
46208
45851
|
function default_1(fork) {
|
|
46209
45852
|
var _a2, _b2, _c2, _d, _e;
|
|
46210
45853
|
fork.use(es_proposals_1.default);
|
|
46211
|
-
var
|
|
45854
|
+
var types5 = fork.use(types_1.default);
|
|
46212
45855
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46213
|
-
var def =
|
|
46214
|
-
var or =
|
|
46215
|
-
var isUndefined =
|
|
45856
|
+
var def = types5.Type.def;
|
|
45857
|
+
var or = types5.Type.or;
|
|
45858
|
+
var isUndefined = types5.builtInTypes.undefined;
|
|
46216
45859
|
def("Noop").bases("Statement").build();
|
|
46217
45860
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
46218
45861
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -46247,7 +45890,7 @@ var require_babel_core = __commonJS({
|
|
|
46247
45890
|
raw: String
|
|
46248
45891
|
},
|
|
46249
45892
|
function getDefault() {
|
|
46250
|
-
var value =
|
|
45893
|
+
var value = types5.getFieldValue(this, "value");
|
|
46251
45894
|
return {
|
|
46252
45895
|
rawValue: value,
|
|
46253
45896
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -46338,8 +45981,8 @@ var require_babel = __commonJS({
|
|
|
46338
45981
|
var babel_core_1 = (0, tslib_1.__importDefault)(require_babel_core());
|
|
46339
45982
|
var flow_1 = (0, tslib_1.__importDefault)(require_flow());
|
|
46340
45983
|
function default_1(fork) {
|
|
46341
|
-
var
|
|
46342
|
-
var def =
|
|
45984
|
+
var types5 = fork.use(types_1.default);
|
|
45985
|
+
var def = types5.Type.def;
|
|
46343
45986
|
fork.use(babel_core_1.default);
|
|
46344
45987
|
fork.use(flow_1.default);
|
|
46345
45988
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -46363,12 +46006,12 @@ var require_typescript = __commonJS({
|
|
|
46363
46006
|
function default_1(fork) {
|
|
46364
46007
|
fork.use(babel_core_1.default);
|
|
46365
46008
|
fork.use(type_annotations_1.default);
|
|
46366
|
-
var
|
|
46367
|
-
var n2 =
|
|
46368
|
-
var def =
|
|
46369
|
-
var or =
|
|
46009
|
+
var types5 = fork.use(types_1.default);
|
|
46010
|
+
var n2 = types5.namedTypes;
|
|
46011
|
+
var def = types5.Type.def;
|
|
46012
|
+
var or = types5.Type.or;
|
|
46370
46013
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46371
|
-
var StringLiteral =
|
|
46014
|
+
var StringLiteral = types5.Type.from(function(value, deep) {
|
|
46372
46015
|
if (n2.StringLiteral && n2.StringLiteral.check(value, deep)) {
|
|
46373
46016
|
return true;
|
|
46374
46017
|
}
|
|
@@ -48346,8 +47989,8 @@ var require_util9 = __commonJS({
|
|
|
48346
47989
|
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;
|
|
48347
47990
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
48348
47991
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
48349
|
-
var
|
|
48350
|
-
var n2 =
|
|
47992
|
+
var types5 = tslib_1.__importStar(require_main2());
|
|
47993
|
+
var n2 = types5.namedTypes;
|
|
48351
47994
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
48352
47995
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
48353
47996
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -55760,10 +55403,10 @@ var require_comments = __commonJS({
|
|
|
55760
55403
|
exports2.printComments = exports2.attach = void 0;
|
|
55761
55404
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
55762
55405
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
55763
|
-
var
|
|
55764
|
-
var n2 =
|
|
55765
|
-
var isArray =
|
|
55766
|
-
var isObject2 =
|
|
55406
|
+
var types5 = tslib_1.__importStar(require_main2());
|
|
55407
|
+
var n2 = types5.namedTypes;
|
|
55408
|
+
var isArray = types5.builtInTypes.array;
|
|
55409
|
+
var isObject2 = types5.builtInTypes.object;
|
|
55767
55410
|
var lines_1 = require_lines();
|
|
55768
55411
|
var util_1 = require_util9();
|
|
55769
55412
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -55794,7 +55437,7 @@ var require_comments = __commonJS({
|
|
|
55794
55437
|
if (isArray.check(node)) {
|
|
55795
55438
|
names = Object.keys(node);
|
|
55796
55439
|
} else if (isObject2.check(node)) {
|
|
55797
|
-
names =
|
|
55440
|
+
names = types5.getFieldNames(node);
|
|
55798
55441
|
} else {
|
|
55799
55442
|
return resultArray;
|
|
55800
55443
|
}
|
|
@@ -55974,7 +55617,7 @@ var require_comments = __commonJS({
|
|
|
55974
55617
|
function printComments(path3, print2) {
|
|
55975
55618
|
var value = path3.getValue();
|
|
55976
55619
|
var innerLines = print2(path3);
|
|
55977
|
-
var comments = n2.Node.check(value) &&
|
|
55620
|
+
var comments = n2.Node.check(value) && types5.getFieldValue(value, "comments");
|
|
55978
55621
|
if (!comments || comments.length === 0) {
|
|
55979
55622
|
return innerLines;
|
|
55980
55623
|
}
|
|
@@ -55982,8 +55625,8 @@ var require_comments = __commonJS({
|
|
|
55982
55625
|
var trailingParts = [innerLines];
|
|
55983
55626
|
path3.each(function(commentPath) {
|
|
55984
55627
|
var comment = commentPath.getValue();
|
|
55985
|
-
var leading =
|
|
55986
|
-
var trailing =
|
|
55628
|
+
var leading = types5.getFieldValue(comment, "leading");
|
|
55629
|
+
var trailing = types5.getFieldValue(comment, "trailing");
|
|
55987
55630
|
if (leading || trailing && !(n2.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55988
55631
|
leadingParts.push(printLeadingComment(commentPath, print2));
|
|
55989
55632
|
} else if (trailing) {
|
|
@@ -56005,10 +55648,10 @@ var require_parser2 = __commonJS({
|
|
|
56005
55648
|
exports2.parse = void 0;
|
|
56006
55649
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56007
55650
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56008
|
-
var
|
|
56009
|
-
var b2 =
|
|
56010
|
-
var isObject2 =
|
|
56011
|
-
var isArray =
|
|
55651
|
+
var types5 = tslib_1.__importStar(require_main2());
|
|
55652
|
+
var b2 = types5.builders;
|
|
55653
|
+
var isObject2 = types5.builtInTypes.object;
|
|
55654
|
+
var isArray = types5.builtInTypes.array;
|
|
56012
55655
|
var options_1 = require_options();
|
|
56013
55656
|
var lines_1 = require_lines();
|
|
56014
55657
|
var comments_1 = require_comments();
|
|
@@ -56195,11 +55838,11 @@ var require_fast_path = __commonJS({
|
|
|
56195
55838
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
56196
55839
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56197
55840
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56198
|
-
var
|
|
55841
|
+
var types5 = tslib_1.__importStar(require_main2());
|
|
56199
55842
|
var util = tslib_1.__importStar(require_util9());
|
|
56200
|
-
var n2 =
|
|
56201
|
-
var isArray =
|
|
56202
|
-
var isNumber =
|
|
55843
|
+
var n2 = types5.namedTypes;
|
|
55844
|
+
var isArray = types5.builtInTypes.array;
|
|
55845
|
+
var isNumber = types5.builtInTypes.number;
|
|
56203
55846
|
var PRECEDENCE = {};
|
|
56204
55847
|
[
|
|
56205
55848
|
["??"],
|
|
@@ -56228,7 +55871,7 @@ var require_fast_path = __commonJS({
|
|
|
56228
55871
|
if (obj instanceof FastPath) {
|
|
56229
55872
|
return obj.copy();
|
|
56230
55873
|
}
|
|
56231
|
-
if (obj instanceof
|
|
55874
|
+
if (obj instanceof types5.NodePath) {
|
|
56232
55875
|
var copy = Object.create(FastPath.prototype);
|
|
56233
55876
|
var stack = [obj.value];
|
|
56234
55877
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -56539,7 +56182,7 @@ var require_fast_path = __commonJS({
|
|
|
56539
56182
|
return node.some(containsCallExpression);
|
|
56540
56183
|
}
|
|
56541
56184
|
if (n2.Node.check(node)) {
|
|
56542
|
-
return
|
|
56185
|
+
return types5.someField(node, function(_name, child) {
|
|
56543
56186
|
return containsCallExpression(child);
|
|
56544
56187
|
});
|
|
56545
56188
|
}
|
|
@@ -56629,16 +56272,16 @@ var require_patcher = __commonJS({
|
|
|
56629
56272
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56630
56273
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56631
56274
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
56632
|
-
var
|
|
56633
|
-
var Printable =
|
|
56634
|
-
var Expression =
|
|
56635
|
-
var ReturnStatement =
|
|
56636
|
-
var SourceLocation =
|
|
56275
|
+
var types5 = tslib_1.__importStar(require_main2());
|
|
56276
|
+
var Printable = types5.namedTypes.Printable;
|
|
56277
|
+
var Expression = types5.namedTypes.Expression;
|
|
56278
|
+
var ReturnStatement = types5.namedTypes.ReturnStatement;
|
|
56279
|
+
var SourceLocation = types5.namedTypes.SourceLocation;
|
|
56637
56280
|
var util_1 = require_util9();
|
|
56638
56281
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
56639
|
-
var isObject2 =
|
|
56640
|
-
var isArray =
|
|
56641
|
-
var isString =
|
|
56282
|
+
var isObject2 = types5.builtInTypes.object;
|
|
56283
|
+
var isArray = types5.builtInTypes.array;
|
|
56284
|
+
var isString = types5.builtInTypes.string;
|
|
56642
56285
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
56643
56286
|
var Patcher = function Patcher2(lines) {
|
|
56644
56287
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -56917,8 +56560,8 @@ var require_patcher = __commonJS({
|
|
|
56917
56560
|
if (k2.charAt(0) === "_") {
|
|
56918
56561
|
continue;
|
|
56919
56562
|
}
|
|
56920
|
-
newPath.stack.push(k2,
|
|
56921
|
-
oldPath.stack.push(k2,
|
|
56563
|
+
newPath.stack.push(k2, types5.getFieldValue(newNode, k2));
|
|
56564
|
+
oldPath.stack.push(k2, types5.getFieldValue(oldNode, k2));
|
|
56922
56565
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
56923
56566
|
newPath.stack.length -= 2;
|
|
56924
56567
|
oldPath.stack.length -= 2;
|
|
@@ -56946,10 +56589,10 @@ var require_printer = __commonJS({
|
|
|
56946
56589
|
var lines_1 = require_lines();
|
|
56947
56590
|
var options_1 = require_options();
|
|
56948
56591
|
var patcher_1 = require_patcher();
|
|
56949
|
-
var
|
|
56950
|
-
var namedTypes =
|
|
56951
|
-
var isString =
|
|
56952
|
-
var isObject2 =
|
|
56592
|
+
var types5 = tslib_1.__importStar(require_main2());
|
|
56593
|
+
var namedTypes = types5.namedTypes;
|
|
56594
|
+
var isString = types5.builtInTypes.string;
|
|
56595
|
+
var isObject2 = types5.builtInTypes.object;
|
|
56953
56596
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
56954
56597
|
var util = tslib_1.__importStar(require_util9());
|
|
56955
56598
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
@@ -57123,7 +56766,7 @@ var require_printer = __commonJS({
|
|
|
57123
56766
|
case "OptionalMemberExpression": {
|
|
57124
56767
|
parts.push(path3.call(print2, "object"));
|
|
57125
56768
|
var property = path3.call(print2, "property");
|
|
57126
|
-
var optional =
|
|
56769
|
+
var optional = types5.getFieldValue(n2, "optional");
|
|
57127
56770
|
if (n2.computed) {
|
|
57128
56771
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
57129
56772
|
} else {
|
|
@@ -57394,7 +57037,7 @@ var require_printer = __commonJS({
|
|
|
57394
57037
|
if (n2.typeArguments) {
|
|
57395
57038
|
parts.push(path3.call(print2, "typeArguments"));
|
|
57396
57039
|
}
|
|
57397
|
-
if (
|
|
57040
|
+
if (types5.getFieldValue(n2, "optional")) {
|
|
57398
57041
|
parts.push("?.");
|
|
57399
57042
|
}
|
|
57400
57043
|
parts.push(printArgumentsList(path3, options, print2));
|
|
@@ -59026,8 +58669,8 @@ var require_printer = __commonJS({
|
|
|
59026
58669
|
});
|
|
59027
58670
|
}
|
|
59028
58671
|
function getPossibleRaw(node) {
|
|
59029
|
-
var value =
|
|
59030
|
-
var extra =
|
|
58672
|
+
var value = types5.getFieldValue(node, "value");
|
|
58673
|
+
var extra = types5.getFieldValue(node, "extra");
|
|
59031
58674
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
59032
58675
|
return extra.raw;
|
|
59033
58676
|
}
|
|
@@ -59075,8 +58718,8 @@ var require_main3 = __commonJS({
|
|
|
59075
58718
|
exports2.run = exports2.prettyPrint = exports2.print = exports2.visit = exports2.types = exports2.parse = void 0;
|
|
59076
58719
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
59077
58720
|
var fs_1 = tslib_1.__importDefault(require("fs"));
|
|
59078
|
-
var
|
|
59079
|
-
exports2.types =
|
|
58721
|
+
var types5 = tslib_1.__importStar(require_main2());
|
|
58722
|
+
exports2.types = types5;
|
|
59080
58723
|
var parser_1 = require_parser2();
|
|
59081
58724
|
Object.defineProperty(exports2, "parse", { enumerable: true, get: function() {
|
|
59082
58725
|
return parser_1.parse;
|
|
@@ -59940,14 +59583,14 @@ var require_lib = __commonJS({
|
|
|
59940
59583
|
this.preserveSpace = !!preserveSpace;
|
|
59941
59584
|
}
|
|
59942
59585
|
};
|
|
59943
|
-
var
|
|
59586
|
+
var types5 = {
|
|
59944
59587
|
brace: new TokContext("{"),
|
|
59945
59588
|
j_oTag: new TokContext("<tag"),
|
|
59946
59589
|
j_cTag: new TokContext("</tag"),
|
|
59947
59590
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
59948
59591
|
};
|
|
59949
59592
|
{
|
|
59950
|
-
|
|
59593
|
+
types5.template = new TokContext("`", true);
|
|
59951
59594
|
}
|
|
59952
59595
|
var beforeExpr = true;
|
|
59953
59596
|
var startsExpr = true;
|
|
@@ -60479,17 +60122,17 @@ var require_lib = __commonJS({
|
|
|
60479
60122
|
context.pop();
|
|
60480
60123
|
};
|
|
60481
60124
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
60482
|
-
context.push(
|
|
60125
|
+
context.push(types5.brace);
|
|
60483
60126
|
};
|
|
60484
60127
|
tokenTypes[22].updateContext = (context) => {
|
|
60485
|
-
if (context[context.length - 1] ===
|
|
60128
|
+
if (context[context.length - 1] === types5.template) {
|
|
60486
60129
|
context.pop();
|
|
60487
60130
|
} else {
|
|
60488
|
-
context.push(
|
|
60131
|
+
context.push(types5.template);
|
|
60489
60132
|
}
|
|
60490
60133
|
};
|
|
60491
60134
|
tokenTypes[140].updateContext = (context) => {
|
|
60492
|
-
context.push(
|
|
60135
|
+
context.push(types5.j_expr, types5.j_oTag);
|
|
60493
60136
|
};
|
|
60494
60137
|
}
|
|
60495
60138
|
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";
|
|
@@ -61095,7 +60738,7 @@ var require_lib = __commonJS({
|
|
|
61095
60738
|
this.lastTokEndLoc = null;
|
|
61096
60739
|
this.lastTokStartLoc = null;
|
|
61097
60740
|
this.lastTokStart = 0;
|
|
61098
|
-
this.context = [
|
|
60741
|
+
this.context = [types5.brace];
|
|
61099
60742
|
this.canStartJSXElement = true;
|
|
61100
60743
|
this.containsEsc = false;
|
|
61101
60744
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -64986,7 +64629,7 @@ var require_lib = __commonJS({
|
|
|
64986
64629
|
context
|
|
64987
64630
|
} = this.state;
|
|
64988
64631
|
const currentContext = context[context.length - 1];
|
|
64989
|
-
if (currentContext ===
|
|
64632
|
+
if (currentContext === types5.j_oTag || currentContext === types5.j_expr) {
|
|
64990
64633
|
context.pop();
|
|
64991
64634
|
}
|
|
64992
64635
|
}
|
|
@@ -66044,9 +65687,9 @@ var require_lib = __commonJS({
|
|
|
66044
65687
|
switch (this.state.type) {
|
|
66045
65688
|
case 5:
|
|
66046
65689
|
node = this.startNode();
|
|
66047
|
-
this.setContext(
|
|
65690
|
+
this.setContext(types5.brace);
|
|
66048
65691
|
this.next();
|
|
66049
|
-
node = this.jsxParseExpressionContainer(node,
|
|
65692
|
+
node = this.jsxParseExpressionContainer(node, types5.j_oTag);
|
|
66050
65693
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
66051
65694
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
66052
65695
|
at: node
|
|
@@ -66069,7 +65712,7 @@ var require_lib = __commonJS({
|
|
|
66069
65712
|
jsxParseSpreadChild(node) {
|
|
66070
65713
|
this.next();
|
|
66071
65714
|
node.expression = this.parseExpression();
|
|
66072
|
-
this.setContext(
|
|
65715
|
+
this.setContext(types5.j_expr);
|
|
66073
65716
|
this.state.canStartJSXElement = true;
|
|
66074
65717
|
this.expect(8);
|
|
66075
65718
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -66089,11 +65732,11 @@ var require_lib = __commonJS({
|
|
|
66089
65732
|
jsxParseAttribute() {
|
|
66090
65733
|
const node = this.startNode();
|
|
66091
65734
|
if (this.match(5)) {
|
|
66092
|
-
this.setContext(
|
|
65735
|
+
this.setContext(types5.brace);
|
|
66093
65736
|
this.next();
|
|
66094
65737
|
this.expect(21);
|
|
66095
65738
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
66096
|
-
this.setContext(
|
|
65739
|
+
this.setContext(types5.j_oTag);
|
|
66097
65740
|
this.state.canStartJSXElement = true;
|
|
66098
65741
|
this.expect(8);
|
|
66099
65742
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -66152,12 +65795,12 @@ var require_lib = __commonJS({
|
|
|
66152
65795
|
break;
|
|
66153
65796
|
case 5: {
|
|
66154
65797
|
const node2 = this.startNode();
|
|
66155
|
-
this.setContext(
|
|
65798
|
+
this.setContext(types5.brace);
|
|
66156
65799
|
this.next();
|
|
66157
65800
|
if (this.match(21)) {
|
|
66158
65801
|
children.push(this.jsxParseSpreadChild(node2));
|
|
66159
65802
|
} else {
|
|
66160
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
65803
|
+
children.push(this.jsxParseExpressionContainer(node2, types5.j_expr));
|
|
66161
65804
|
}
|
|
66162
65805
|
break;
|
|
66163
65806
|
}
|
|
@@ -66228,11 +65871,11 @@ var require_lib = __commonJS({
|
|
|
66228
65871
|
}
|
|
66229
65872
|
getTokenFromCode(code) {
|
|
66230
65873
|
const context = this.curContext();
|
|
66231
|
-
if (context ===
|
|
65874
|
+
if (context === types5.j_expr) {
|
|
66232
65875
|
this.jsxReadToken();
|
|
66233
65876
|
return;
|
|
66234
65877
|
}
|
|
66235
|
-
if (context ===
|
|
65878
|
+
if (context === types5.j_oTag || context === types5.j_cTag) {
|
|
66236
65879
|
if (isIdentifierStart(code)) {
|
|
66237
65880
|
this.jsxReadWord();
|
|
66238
65881
|
return;
|
|
@@ -66242,7 +65885,7 @@ var require_lib = __commonJS({
|
|
|
66242
65885
|
this.finishToken(141);
|
|
66243
65886
|
return;
|
|
66244
65887
|
}
|
|
66245
|
-
if ((code === 34 || code === 39) && context ===
|
|
65888
|
+
if ((code === 34 || code === 39) && context === types5.j_oTag) {
|
|
66246
65889
|
this.jsxReadString(code);
|
|
66247
65890
|
return;
|
|
66248
65891
|
}
|
|
@@ -66260,17 +65903,17 @@ var require_lib = __commonJS({
|
|
|
66260
65903
|
type
|
|
66261
65904
|
} = this.state;
|
|
66262
65905
|
if (type === 56 && prevType === 140) {
|
|
66263
|
-
context.splice(-2, 2,
|
|
65906
|
+
context.splice(-2, 2, types5.j_cTag);
|
|
66264
65907
|
this.state.canStartJSXElement = false;
|
|
66265
65908
|
} else if (type === 140) {
|
|
66266
|
-
context.push(
|
|
65909
|
+
context.push(types5.j_oTag);
|
|
66267
65910
|
} else if (type === 141) {
|
|
66268
65911
|
const out = context[context.length - 1];
|
|
66269
|
-
if (out ===
|
|
65912
|
+
if (out === types5.j_oTag && prevType === 56 || out === types5.j_cTag) {
|
|
66270
65913
|
context.pop();
|
|
66271
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
65914
|
+
this.state.canStartJSXElement = context[context.length - 1] === types5.j_expr;
|
|
66272
65915
|
} else {
|
|
66273
|
-
this.setContext(
|
|
65916
|
+
this.setContext(types5.j_expr);
|
|
66274
65917
|
this.state.canStartJSXElement = true;
|
|
66275
65918
|
}
|
|
66276
65919
|
} else {
|
|
@@ -67714,14 +67357,14 @@ var require_lib = __commonJS({
|
|
|
67714
67357
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
67715
67358
|
const node = this.startNode();
|
|
67716
67359
|
const hasLeadingOperator = this.eat(operator);
|
|
67717
|
-
const
|
|
67360
|
+
const types6 = [];
|
|
67718
67361
|
do {
|
|
67719
|
-
|
|
67362
|
+
types6.push(parseConstituentType());
|
|
67720
67363
|
} while (this.eat(operator));
|
|
67721
|
-
if (
|
|
67722
|
-
return
|
|
67364
|
+
if (types6.length === 1 && !hasLeadingOperator) {
|
|
67365
|
+
return types6[0];
|
|
67723
67366
|
}
|
|
67724
|
-
node.types =
|
|
67367
|
+
node.types = types6;
|
|
67725
67368
|
return this.finishNode(node, kind);
|
|
67726
67369
|
}
|
|
67727
67370
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -68295,7 +67938,7 @@ var require_lib = __commonJS({
|
|
|
68295
67938
|
this.raise(TSErrors.EmptyTypeArguments, {
|
|
68296
67939
|
at: node
|
|
68297
67940
|
});
|
|
68298
|
-
} else if (!this.state.inType && this.curContext() ===
|
|
67941
|
+
} else if (!this.state.inType && this.curContext() === types5.brace) {
|
|
68299
67942
|
this.reScan_lt_gt();
|
|
68300
67943
|
}
|
|
68301
67944
|
this.expect(48);
|
|
@@ -68972,7 +68615,7 @@ var require_lib = __commonJS({
|
|
|
68972
68615
|
context
|
|
68973
68616
|
} = this.state;
|
|
68974
68617
|
const currentContext = context[context.length - 1];
|
|
68975
|
-
if (currentContext ===
|
|
68618
|
+
if (currentContext === types5.j_oTag || currentContext === types5.j_expr) {
|
|
68976
68619
|
context.pop();
|
|
68977
68620
|
}
|
|
68978
68621
|
}
|
|
@@ -73805,11 +73448,11 @@ var require_typescript2 = __commonJS({
|
|
|
73805
73448
|
});
|
|
73806
73449
|
|
|
73807
73450
|
// src/helpers/codemod.ts
|
|
73808
|
-
var import_fs9,
|
|
73451
|
+
var import_fs9, import_path9, recast, esprimaParser, typescriptParser, parseFile, transformFile, loadSnippets, loadTemplateSnippets;
|
|
73809
73452
|
var init_codemod = __esm({
|
|
73810
73453
|
"src/helpers/codemod.ts"() {
|
|
73811
73454
|
import_fs9 = require("fs");
|
|
73812
|
-
|
|
73455
|
+
import_path9 = __toESM(require("path"));
|
|
73813
73456
|
init_cli();
|
|
73814
73457
|
recast = __toESM(require_main3());
|
|
73815
73458
|
esprimaParser = __toESM(require_esprima3());
|
|
@@ -73817,10 +73460,10 @@ var init_codemod = __esm({
|
|
|
73817
73460
|
init_templates();
|
|
73818
73461
|
init_files();
|
|
73819
73462
|
parseFile = (filePath) => {
|
|
73820
|
-
const lang =
|
|
73463
|
+
const lang = import_path9.default.extname(filePath).slice(1);
|
|
73821
73464
|
const parser2 = lang === "js" ? esprimaParser : typescriptParser;
|
|
73822
73465
|
try {
|
|
73823
|
-
const fileContents = readFile(
|
|
73466
|
+
const fileContents = readFile(import_path9.default.resolve(filePath));
|
|
73824
73467
|
if (fileContents) {
|
|
73825
73468
|
return recast.parse(fileContents, { parser: parser2 }).program;
|
|
73826
73469
|
}
|
|
@@ -73837,7 +73480,7 @@ var init_codemod = __esm({
|
|
|
73837
73480
|
}
|
|
73838
73481
|
};
|
|
73839
73482
|
loadSnippets = (parentFolder) => {
|
|
73840
|
-
const snippetsPath = (0,
|
|
73483
|
+
const snippetsPath = (0, import_path9.join)(parentFolder, "snippets");
|
|
73841
73484
|
if (!(0, import_fs9.existsSync)(snippetsPath)) {
|
|
73842
73485
|
return {};
|
|
73843
73486
|
}
|
|
@@ -73845,12 +73488,12 @@ var init_codemod = __esm({
|
|
|
73845
73488
|
return {};
|
|
73846
73489
|
}
|
|
73847
73490
|
const files = (0, import_fs9.readdirSync)(snippetsPath);
|
|
73848
|
-
return files.filter((fileName) => (0, import_fs9.lstatSync)((0,
|
|
73491
|
+
return files.filter((fileName) => (0, import_fs9.lstatSync)((0, import_path9.join)(snippetsPath, fileName)).isFile).filter((fileName) => [".js", ".ts"].includes((0, import_path9.extname)(fileName))).reduce((acc, snippetPath) => {
|
|
73849
73492
|
const [file, ext] = snippetPath.split(".");
|
|
73850
73493
|
const key = `${file}${ext === "js" ? "Js" : "Ts"}`;
|
|
73851
73494
|
return {
|
|
73852
73495
|
...acc,
|
|
73853
|
-
[key]: parseFile((0,
|
|
73496
|
+
[key]: parseFile((0, import_path9.join)(snippetsPath, snippetPath))?.body
|
|
73854
73497
|
};
|
|
73855
73498
|
}, {});
|
|
73856
73499
|
};
|
|
@@ -73860,12 +73503,425 @@ var init_codemod = __esm({
|
|
|
73860
73503
|
}
|
|
73861
73504
|
});
|
|
73862
73505
|
|
|
73506
|
+
// templates/astro/c3.ts
|
|
73507
|
+
var c3_exports2 = {};
|
|
73508
|
+
__export(c3_exports2, {
|
|
73509
|
+
default: () => c3_default2
|
|
73510
|
+
});
|
|
73511
|
+
var recast2, npx2, generate2, configure2, updateAstroConfig, updateEnvDeclaration, config2, c3_default2;
|
|
73512
|
+
var init_c32 = __esm({
|
|
73513
|
+
"templates/astro/c3.ts"() {
|
|
73514
|
+
init_cli();
|
|
73515
|
+
init_colors();
|
|
73516
|
+
init_codemod();
|
|
73517
|
+
init_command();
|
|
73518
|
+
init_files();
|
|
73519
|
+
init_packages();
|
|
73520
|
+
recast2 = __toESM(require_main3());
|
|
73521
|
+
({ npx: npx2 } = detectPackageManager());
|
|
73522
|
+
generate2 = async (ctx) => {
|
|
73523
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
73524
|
+
logRaw("");
|
|
73525
|
+
};
|
|
73526
|
+
configure2 = async (ctx) => {
|
|
73527
|
+
await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
|
|
73528
|
+
silent: true,
|
|
73529
|
+
startText: "Installing adapter",
|
|
73530
|
+
doneText: `${brandColor("installed")} ${dim(
|
|
73531
|
+
`via \`${npx2} astro add cloudflare\``
|
|
73532
|
+
)}`
|
|
73533
|
+
});
|
|
73534
|
+
updateAstroConfig();
|
|
73535
|
+
updateEnvDeclaration(ctx);
|
|
73536
|
+
};
|
|
73537
|
+
updateAstroConfig = () => {
|
|
73538
|
+
const filePath = "astro.config.mjs";
|
|
73539
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
73540
|
+
transformFile(filePath, {
|
|
73541
|
+
visitCallExpression: function(n2) {
|
|
73542
|
+
const callee = n2.node.callee;
|
|
73543
|
+
if (callee.name !== "cloudflare") {
|
|
73544
|
+
return this.traverse(n2);
|
|
73545
|
+
}
|
|
73546
|
+
const b2 = recast2.types.builders;
|
|
73547
|
+
n2.node.arguments = [
|
|
73548
|
+
b2.objectExpression([
|
|
73549
|
+
b2.objectProperty(
|
|
73550
|
+
b2.identifier("runtime"),
|
|
73551
|
+
b2.objectExpression([
|
|
73552
|
+
b2.objectProperty(b2.identifier("mode"), b2.stringLiteral("local"))
|
|
73553
|
+
])
|
|
73554
|
+
)
|
|
73555
|
+
])
|
|
73556
|
+
];
|
|
73557
|
+
return false;
|
|
73558
|
+
}
|
|
73559
|
+
});
|
|
73560
|
+
};
|
|
73561
|
+
updateEnvDeclaration = (ctx) => {
|
|
73562
|
+
if (!usesTypescript(ctx)) {
|
|
73563
|
+
return;
|
|
73564
|
+
}
|
|
73565
|
+
const filePath = "src/env.d.ts";
|
|
73566
|
+
updateStatus(`Adding type declarations in ${blue(filePath)}`);
|
|
73567
|
+
transformFile(filePath, {
|
|
73568
|
+
visitProgram: function(n2) {
|
|
73569
|
+
const snippets = loadTemplateSnippets(ctx);
|
|
73570
|
+
const patch = snippets.runtimeDeclarationTs;
|
|
73571
|
+
const b2 = recast2.types.builders;
|
|
73572
|
+
const comments = n2.get("comments").value;
|
|
73573
|
+
n2.node.comments = comments.map(
|
|
73574
|
+
(c2) => b2.commentLine(c2.value)
|
|
73575
|
+
);
|
|
73576
|
+
n2.get("body").push(...patch);
|
|
73577
|
+
return false;
|
|
73578
|
+
}
|
|
73579
|
+
});
|
|
73580
|
+
};
|
|
73581
|
+
config2 = {
|
|
73582
|
+
configVersion: 1,
|
|
73583
|
+
id: "astro",
|
|
73584
|
+
platform: "pages",
|
|
73585
|
+
displayName: "Astro",
|
|
73586
|
+
copyFiles: {
|
|
73587
|
+
path: "./templates"
|
|
73588
|
+
},
|
|
73589
|
+
devScript: "dev",
|
|
73590
|
+
deployScript: "deploy",
|
|
73591
|
+
previewScript: "preview",
|
|
73592
|
+
generate: generate2,
|
|
73593
|
+
configure: configure2,
|
|
73594
|
+
transformPackageJson: async (pkgJson, ctx) => ({
|
|
73595
|
+
scripts: {
|
|
73596
|
+
deploy: `astro build && wrangler pages deploy ./dist`,
|
|
73597
|
+
preview: `astro build && wrangler pages dev ./dist`,
|
|
73598
|
+
...usesTypescript(ctx) && { "build-cf-types": `wrangler types` }
|
|
73599
|
+
}
|
|
73600
|
+
}),
|
|
73601
|
+
testFlags: [
|
|
73602
|
+
"--skip-houston",
|
|
73603
|
+
"--no-install",
|
|
73604
|
+
"--no-git",
|
|
73605
|
+
"--template",
|
|
73606
|
+
"blog",
|
|
73607
|
+
"--typescript",
|
|
73608
|
+
"strict"
|
|
73609
|
+
]
|
|
73610
|
+
};
|
|
73611
|
+
c3_default2 = config2;
|
|
73612
|
+
}
|
|
73613
|
+
});
|
|
73614
|
+
|
|
73615
|
+
// templates/docusaurus/c3.ts
|
|
73616
|
+
var c3_exports3 = {};
|
|
73617
|
+
__export(c3_exports3, {
|
|
73618
|
+
default: () => c3_default3
|
|
73619
|
+
});
|
|
73620
|
+
var npm4, generate3, config3, c3_default3;
|
|
73621
|
+
var init_c33 = __esm({
|
|
73622
|
+
"templates/docusaurus/c3.ts"() {
|
|
73623
|
+
init_command();
|
|
73624
|
+
init_files();
|
|
73625
|
+
init_packages();
|
|
73626
|
+
({ npm: npm4 } = detectPackageManager());
|
|
73627
|
+
generate3 = async (ctx) => {
|
|
73628
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
73629
|
+
};
|
|
73630
|
+
config3 = {
|
|
73631
|
+
configVersion: 1,
|
|
73632
|
+
id: "docusaurus",
|
|
73633
|
+
platform: "pages",
|
|
73634
|
+
displayName: "Docusaurus",
|
|
73635
|
+
generate: generate3,
|
|
73636
|
+
transformPackageJson: async () => ({
|
|
73637
|
+
scripts: {
|
|
73638
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm4} run start`,
|
|
73639
|
+
"pages:deploy": `${npm4} run build && wrangler pages deploy ./build`
|
|
73640
|
+
}
|
|
73641
|
+
}),
|
|
73642
|
+
testFlags: [`--package-manager`, npm4]
|
|
73643
|
+
};
|
|
73644
|
+
c3_default3 = config3;
|
|
73645
|
+
}
|
|
73646
|
+
});
|
|
73647
|
+
|
|
73648
|
+
// templates/gatsby/c3.ts
|
|
73649
|
+
var c3_exports4 = {};
|
|
73650
|
+
__export(c3_exports4, {
|
|
73651
|
+
default: () => c3_default4
|
|
73652
|
+
});
|
|
73653
|
+
var npm5, generate4, config4, c3_default4;
|
|
73654
|
+
var init_c34 = __esm({
|
|
73655
|
+
"templates/gatsby/c3.ts"() {
|
|
73656
|
+
init_interactive();
|
|
73657
|
+
init_command();
|
|
73658
|
+
init_files();
|
|
73659
|
+
init_packages();
|
|
73660
|
+
({ npm: npm5 } = detectPackageManager());
|
|
73661
|
+
generate4 = async (ctx) => {
|
|
73662
|
+
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
73663
|
+
const useTemplate = await inputPrompt({
|
|
73664
|
+
type: "confirm",
|
|
73665
|
+
question: "Would you like to use a template?",
|
|
73666
|
+
label: "template",
|
|
73667
|
+
defaultValue: true
|
|
73668
|
+
});
|
|
73669
|
+
let templateUrl = "";
|
|
73670
|
+
if (useTemplate) {
|
|
73671
|
+
templateUrl = await inputPrompt({
|
|
73672
|
+
type: "text",
|
|
73673
|
+
question: `Please specify the url of the template you'd like to use`,
|
|
73674
|
+
label: "template",
|
|
73675
|
+
defaultValue: defaultTemplate
|
|
73676
|
+
});
|
|
73677
|
+
}
|
|
73678
|
+
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
73679
|
+
};
|
|
73680
|
+
config4 = {
|
|
73681
|
+
configVersion: 1,
|
|
73682
|
+
id: "gatsby",
|
|
73683
|
+
platform: "pages",
|
|
73684
|
+
displayName: "Gatsby",
|
|
73685
|
+
generate: generate4,
|
|
73686
|
+
transformPackageJson: async () => ({
|
|
73687
|
+
scripts: {
|
|
73688
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 8000 -- ${npm5} run develop`,
|
|
73689
|
+
"pages:deploy": `${npm5} run build && wrangler pages deploy ./public`
|
|
73690
|
+
}
|
|
73691
|
+
})
|
|
73692
|
+
};
|
|
73693
|
+
c3_default4 = config4;
|
|
73694
|
+
}
|
|
73695
|
+
});
|
|
73696
|
+
|
|
73697
|
+
// templates/hono/c3.ts
|
|
73698
|
+
var c3_exports5 = {};
|
|
73699
|
+
__export(c3_exports5, {
|
|
73700
|
+
default: () => c3_default5
|
|
73701
|
+
});
|
|
73702
|
+
var generate5, config5, c3_default5;
|
|
73703
|
+
var init_c35 = __esm({
|
|
73704
|
+
"templates/hono/c3.ts"() {
|
|
73705
|
+
init_cli();
|
|
73706
|
+
init_command();
|
|
73707
|
+
generate5 = async (ctx) => {
|
|
73708
|
+
await runFrameworkGenerator(ctx, [
|
|
73709
|
+
ctx.project.name,
|
|
73710
|
+
"--template",
|
|
73711
|
+
"cloudflare-workers"
|
|
73712
|
+
]);
|
|
73713
|
+
logRaw("");
|
|
73714
|
+
};
|
|
73715
|
+
config5 = {
|
|
73716
|
+
configVersion: 1,
|
|
73717
|
+
id: "hono",
|
|
73718
|
+
displayName: "Hono",
|
|
73719
|
+
platform: "workers",
|
|
73720
|
+
generate: generate5,
|
|
73721
|
+
devScript: "dev",
|
|
73722
|
+
deployScript: "deploy"
|
|
73723
|
+
};
|
|
73724
|
+
c3_default5 = config5;
|
|
73725
|
+
}
|
|
73726
|
+
});
|
|
73727
|
+
|
|
73728
|
+
// templates/next/c3.ts
|
|
73729
|
+
var c3_exports6 = {};
|
|
73730
|
+
__export(c3_exports6, {
|
|
73731
|
+
default: () => c3_default6,
|
|
73732
|
+
shouldInstallNextOnPagesEslintPlugin: () => shouldInstallNextOnPagesEslintPlugin,
|
|
73733
|
+
writeEslintrc: () => writeEslintrc
|
|
73734
|
+
});
|
|
73735
|
+
var import_path10, npm6, npx3, generate6, updateNextConfig, configure3, shouldInstallNextOnPagesEslintPlugin, writeEslintrc, addDevDependencies, c3_default6;
|
|
73736
|
+
var init_c36 = __esm({
|
|
73737
|
+
"templates/next/c3.ts"() {
|
|
73738
|
+
import_path10 = require("path");
|
|
73739
|
+
init_cli();
|
|
73740
|
+
init_args();
|
|
73741
|
+
init_colors();
|
|
73742
|
+
init_interactive();
|
|
73743
|
+
init_command();
|
|
73744
|
+
init_files();
|
|
73745
|
+
init_packages();
|
|
73746
|
+
init_templates();
|
|
73747
|
+
({ npm: npm6, npx: npx3 } = detectPackageManager());
|
|
73748
|
+
generate6 = async (ctx) => {
|
|
73749
|
+
const projectName = ctx.project.name;
|
|
73750
|
+
await runFrameworkGenerator(ctx, [projectName]);
|
|
73751
|
+
copyFile(
|
|
73752
|
+
(0, import_path10.join)(getTemplatePath(ctx), "wrangler.toml"),
|
|
73753
|
+
(0, import_path10.join)(ctx.project.path, "wrangler.toml")
|
|
73754
|
+
);
|
|
73755
|
+
updateStatus("Created wrangler.toml file");
|
|
73756
|
+
};
|
|
73757
|
+
updateNextConfig = () => {
|
|
73758
|
+
const s = spinner();
|
|
73759
|
+
const configFile = "next.config.mjs";
|
|
73760
|
+
s.start(`Updating \`${configFile}\``);
|
|
73761
|
+
const configContent = readFile(configFile);
|
|
73762
|
+
const updatedConfigFile = `import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
|
|
73763
|
+
|
|
73764
|
+
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
|
|
73765
|
+
// (when running the application with \`next dev\`), for more information see:
|
|
73766
|
+
// https://github.com/cloudflare/next-on-pages/blob/5712c57ea7/internal-packages/next-dev/README.md
|
|
73767
|
+
if (process.env.NODE_ENV === 'development') {
|
|
73768
|
+
await setupDevPlatform();
|
|
73769
|
+
}
|
|
73770
|
+
|
|
73771
|
+
`.replace(/\n\t*/g, "\n") + configContent;
|
|
73772
|
+
writeFile2(configFile, updatedConfigFile);
|
|
73773
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
73774
|
+
};
|
|
73775
|
+
configure3 = async (ctx) => {
|
|
73776
|
+
const projectPath = ctx.project.path;
|
|
73777
|
+
const path3 = probePaths([
|
|
73778
|
+
`${projectPath}/pages/api`,
|
|
73779
|
+
`${projectPath}/src/pages/api`,
|
|
73780
|
+
`${projectPath}/src/app/api`,
|
|
73781
|
+
`${projectPath}/app/api`,
|
|
73782
|
+
`${projectPath}/src/app`,
|
|
73783
|
+
`${projectPath}/app`
|
|
73784
|
+
]);
|
|
73785
|
+
if (!path3) {
|
|
73786
|
+
crash("Could not find the `/api` or `/app` directory");
|
|
73787
|
+
}
|
|
73788
|
+
const usesTs = usesTypescript(ctx);
|
|
73789
|
+
if (usesTs) {
|
|
73790
|
+
copyFile(
|
|
73791
|
+
(0, import_path10.join)(getTemplatePath(ctx), "env.d.ts"),
|
|
73792
|
+
(0, import_path10.join)(projectPath, "env.d.ts")
|
|
73793
|
+
);
|
|
73794
|
+
updateStatus("Created an env.d.ts file");
|
|
73795
|
+
}
|
|
73796
|
+
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
73797
|
+
if (installEslintPlugin) {
|
|
73798
|
+
await writeEslintrc(ctx);
|
|
73799
|
+
}
|
|
73800
|
+
updateNextConfig();
|
|
73801
|
+
copyFile(
|
|
73802
|
+
(0, import_path10.join)(getTemplatePath(ctx), "README.md"),
|
|
73803
|
+
(0, import_path10.join)(projectPath, "README.md")
|
|
73804
|
+
);
|
|
73805
|
+
updateStatus("Updated the README file");
|
|
73806
|
+
await addDevDependencies(installEslintPlugin);
|
|
73807
|
+
};
|
|
73808
|
+
shouldInstallNextOnPagesEslintPlugin = async (ctx) => {
|
|
73809
|
+
const eslintUsage = usesEslint(ctx);
|
|
73810
|
+
if (!eslintUsage.used)
|
|
73811
|
+
return false;
|
|
73812
|
+
if (eslintUsage.configType !== ".eslintrc.json") {
|
|
73813
|
+
warn(
|
|
73814
|
+
`Expected .eslintrc.json from Next.js scaffolding but found ${eslintUsage.configType} instead`
|
|
73815
|
+
);
|
|
73816
|
+
return false;
|
|
73817
|
+
}
|
|
73818
|
+
return await processArgument(ctx.args, "eslint-plugin", {
|
|
73819
|
+
type: "confirm",
|
|
73820
|
+
question: "Do you want to use the next-on-pages eslint-plugin?",
|
|
73821
|
+
label: "eslint-plugin",
|
|
73822
|
+
defaultValue: true
|
|
73823
|
+
});
|
|
73824
|
+
};
|
|
73825
|
+
writeEslintrc = async (ctx) => {
|
|
73826
|
+
const eslintConfig = readJSON(`${ctx.project.path}/.eslintrc.json`);
|
|
73827
|
+
eslintConfig.plugins ??= [];
|
|
73828
|
+
eslintConfig.plugins.push("eslint-plugin-next-on-pages");
|
|
73829
|
+
if (typeof eslintConfig.extends === "string") {
|
|
73830
|
+
eslintConfig.extends = [eslintConfig.extends];
|
|
73831
|
+
}
|
|
73832
|
+
eslintConfig.extends ??= [];
|
|
73833
|
+
eslintConfig.extends.push("plugin:eslint-plugin-next-on-pages/recommended");
|
|
73834
|
+
writeJSON(`${ctx.project.path}/.eslintrc.json`, eslintConfig);
|
|
73835
|
+
};
|
|
73836
|
+
addDevDependencies = async (installEslintPlugin) => {
|
|
73837
|
+
const packages = [
|
|
73838
|
+
"@cloudflare/next-on-pages@1",
|
|
73839
|
+
"@cloudflare/workers-types",
|
|
73840
|
+
"vercel",
|
|
73841
|
+
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
73842
|
+
];
|
|
73843
|
+
await installPackages(packages, {
|
|
73844
|
+
dev: true,
|
|
73845
|
+
startText: "Adding the Cloudflare Pages adapter",
|
|
73846
|
+
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
73847
|
+
});
|
|
73848
|
+
};
|
|
73849
|
+
c3_default6 = {
|
|
73850
|
+
configVersion: 1,
|
|
73851
|
+
id: "next",
|
|
73852
|
+
platform: "pages",
|
|
73853
|
+
displayName: "Next",
|
|
73854
|
+
devScript: "dev",
|
|
73855
|
+
previewScript: "preview",
|
|
73856
|
+
deployScript: "deploy",
|
|
73857
|
+
generate: generate6,
|
|
73858
|
+
configure: configure3,
|
|
73859
|
+
copyFiles: {
|
|
73860
|
+
async selectVariant(ctx) {
|
|
73861
|
+
const isApp = probePaths([
|
|
73862
|
+
`${ctx.project.path}/src/app`,
|
|
73863
|
+
`${ctx.project.path}/app`
|
|
73864
|
+
]);
|
|
73865
|
+
const isTypescript = usesTypescript(ctx);
|
|
73866
|
+
const dir = isApp ? "app" : "pages";
|
|
73867
|
+
return `${dir}/${isTypescript ? "ts" : "js"}`;
|
|
73868
|
+
},
|
|
73869
|
+
destinationDir(ctx) {
|
|
73870
|
+
const srcPath = probePaths([`${ctx.project.path}/src`]);
|
|
73871
|
+
return srcPath ? "./src" : "./";
|
|
73872
|
+
},
|
|
73873
|
+
variants: {
|
|
73874
|
+
"app/ts": {
|
|
73875
|
+
path: "./app/ts"
|
|
73876
|
+
},
|
|
73877
|
+
"app/js": {
|
|
73878
|
+
path: "./app/js"
|
|
73879
|
+
},
|
|
73880
|
+
"pages/ts": {
|
|
73881
|
+
path: "./pages/ts"
|
|
73882
|
+
},
|
|
73883
|
+
"pages/js": {
|
|
73884
|
+
path: "./pages/js"
|
|
73885
|
+
}
|
|
73886
|
+
}
|
|
73887
|
+
},
|
|
73888
|
+
transformPackageJson: async () => {
|
|
73889
|
+
const isNpm = npm6 === "npm";
|
|
73890
|
+
const isBun = npm6 === "bun";
|
|
73891
|
+
const isNpmOrBun = isNpm || isBun;
|
|
73892
|
+
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
73893
|
+
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
73894
|
+
const pmCommand = isNpmOrBun ? npx3 : npm6;
|
|
73895
|
+
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
73896
|
+
return {
|
|
73897
|
+
scripts: {
|
|
73898
|
+
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
73899
|
+
preview: `${pagesBuildRunCommand} && wrangler pages dev .vercel/output/static`,
|
|
73900
|
+
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static`
|
|
73901
|
+
}
|
|
73902
|
+
};
|
|
73903
|
+
},
|
|
73904
|
+
testFlags: [
|
|
73905
|
+
"--typescript",
|
|
73906
|
+
"--no-install",
|
|
73907
|
+
"--eslint",
|
|
73908
|
+
"--tailwind",
|
|
73909
|
+
"--src-dir",
|
|
73910
|
+
"--app",
|
|
73911
|
+
"--import-alias",
|
|
73912
|
+
"@/*"
|
|
73913
|
+
],
|
|
73914
|
+
compatibilityFlags: ["nodejs_compat"]
|
|
73915
|
+
};
|
|
73916
|
+
}
|
|
73917
|
+
});
|
|
73918
|
+
|
|
73863
73919
|
// templates/nuxt/c3.ts
|
|
73864
73920
|
var c3_exports7 = {};
|
|
73865
73921
|
__export(c3_exports7, {
|
|
73866
73922
|
default: () => c3_default7
|
|
73867
73923
|
});
|
|
73868
|
-
var
|
|
73924
|
+
var recast3, npm7, generate7, configure4, updateNuxtConfig, config6, c3_default7;
|
|
73869
73925
|
var init_c37 = __esm({
|
|
73870
73926
|
"templates/nuxt/c3.ts"() {
|
|
73871
73927
|
init_cli();
|
|
@@ -73875,7 +73931,7 @@ var init_c37 = __esm({
|
|
|
73875
73931
|
init_command();
|
|
73876
73932
|
init_files();
|
|
73877
73933
|
init_packages();
|
|
73878
|
-
|
|
73934
|
+
recast3 = __toESM(require_main3());
|
|
73879
73935
|
({ npm: npm7 } = detectPackageManager());
|
|
73880
73936
|
generate7 = async (ctx) => {
|
|
73881
73937
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
@@ -73901,7 +73957,7 @@ var init_c37 = __esm({
|
|
|
73901
73957
|
const s = spinner();
|
|
73902
73958
|
const configFile = "nuxt.config.ts";
|
|
73903
73959
|
s.start(`Updating \`${configFile}\``);
|
|
73904
|
-
const b2 =
|
|
73960
|
+
const b2 = recast3.types.builders;
|
|
73905
73961
|
const presetDef = b2.objectProperty(
|
|
73906
73962
|
b2.identifier("nitro"),
|
|
73907
73963
|
b2.objectExpression([
|
|
@@ -73932,10 +73988,10 @@ var init_c37 = __esm({
|
|
|
73932
73988
|
configVersion: 1,
|
|
73933
73989
|
id: "nuxt",
|
|
73934
73990
|
platform: "pages",
|
|
73991
|
+
displayName: "Nuxt",
|
|
73935
73992
|
copyFiles: {
|
|
73936
73993
|
path: "./templates"
|
|
73937
73994
|
},
|
|
73938
|
-
displayName: "Nuxt",
|
|
73939
73995
|
devScript: "dev",
|
|
73940
73996
|
deployScript: "deploy",
|
|
73941
73997
|
generate: generate7,
|
|
@@ -73957,7 +74013,7 @@ var c3_exports8 = {};
|
|
|
73957
74013
|
__export(c3_exports8, {
|
|
73958
74014
|
default: () => c3_default8
|
|
73959
74015
|
});
|
|
73960
|
-
var
|
|
74016
|
+
var recast4, npm8, npx4, generate8, configure5, addBindingsProxy, populateCloudflareEnv, config7, c3_default8;
|
|
73961
74017
|
var init_c38 = __esm({
|
|
73962
74018
|
"templates/qwik/c3.ts"() {
|
|
73963
74019
|
init_cli();
|
|
@@ -73967,7 +74023,7 @@ var init_c38 = __esm({
|
|
|
73967
74023
|
init_command();
|
|
73968
74024
|
init_files();
|
|
73969
74025
|
init_packages();
|
|
73970
|
-
|
|
74026
|
+
recast4 = __toESM(require_main3());
|
|
73971
74027
|
init_common2();
|
|
73972
74028
|
({ npm: npm8, npx: npx4 } = detectPackageManager());
|
|
73973
74029
|
generate8 = async (ctx) => {
|
|
@@ -73987,7 +74043,7 @@ var init_c38 = __esm({
|
|
|
73987
74043
|
const s = spinner();
|
|
73988
74044
|
s.start("Updating `vite.config.ts`");
|
|
73989
74045
|
const snippets = loadTemplateSnippets(ctx);
|
|
73990
|
-
const b2 =
|
|
74046
|
+
const b2 = recast4.types.builders;
|
|
73991
74047
|
transformFile("vite.config.ts", {
|
|
73992
74048
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
73993
74049
|
visitProgram: function(n2) {
|
|
@@ -74029,7 +74085,7 @@ var init_c38 = __esm({
|
|
|
74029
74085
|
s.start(`Updating \`${entrypointPath}\``);
|
|
74030
74086
|
transformFile(entrypointPath, {
|
|
74031
74087
|
visitTSInterfaceDeclaration: function(n2) {
|
|
74032
|
-
const b2 =
|
|
74088
|
+
const b2 = recast4.types.builders;
|
|
74033
74089
|
const id = n2.node.id;
|
|
74034
74090
|
if (id.name !== "QwikCityPlatform") {
|
|
74035
74091
|
this.traverse(n2);
|
|
@@ -74113,10 +74169,13 @@ var c3_exports10 = {};
|
|
|
74113
74169
|
__export(c3_exports10, {
|
|
74114
74170
|
default: () => c3_default10
|
|
74115
74171
|
});
|
|
74116
|
-
var npm10, generate10, config9, c3_default10;
|
|
74172
|
+
var npm10, generate10, configure6, config9, c3_default10;
|
|
74117
74173
|
var init_c310 = __esm({
|
|
74118
74174
|
"templates/remix/c3.ts"() {
|
|
74119
74175
|
init_cli();
|
|
74176
|
+
init_colors();
|
|
74177
|
+
init_interactive();
|
|
74178
|
+
init_codemod();
|
|
74120
74179
|
init_command();
|
|
74121
74180
|
init_packages();
|
|
74122
74181
|
({ npm: npm10 } = detectPackageManager());
|
|
@@ -74124,22 +74183,45 @@ var init_c310 = __esm({
|
|
|
74124
74183
|
await runFrameworkGenerator(ctx, [
|
|
74125
74184
|
ctx.project.name,
|
|
74126
74185
|
"--template",
|
|
74127
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare
|
|
74186
|
+
"https://github.com/remix-run/remix/tree/main/templates/vite-cloudflare"
|
|
74128
74187
|
]);
|
|
74129
74188
|
logRaw("");
|
|
74130
74189
|
};
|
|
74190
|
+
configure6 = async () => {
|
|
74191
|
+
const typeDefsPath = "load-context.ts";
|
|
74192
|
+
const s = spinner();
|
|
74193
|
+
s.start(`Updating \`${typeDefsPath}\``);
|
|
74194
|
+
transformFile(typeDefsPath, {
|
|
74195
|
+
visitTSInterfaceDeclaration(n2) {
|
|
74196
|
+
if (n2.node.id.type === "Identifier" && n2.node.id.name !== "Env") {
|
|
74197
|
+
return this.traverse(n2);
|
|
74198
|
+
}
|
|
74199
|
+
n2.replace();
|
|
74200
|
+
return false;
|
|
74201
|
+
}
|
|
74202
|
+
});
|
|
74203
|
+
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
74204
|
+
};
|
|
74131
74205
|
config9 = {
|
|
74132
74206
|
configVersion: 1,
|
|
74133
74207
|
id: "remix",
|
|
74134
|
-
displayName: "Remix",
|
|
74135
74208
|
platform: "pages",
|
|
74209
|
+
displayName: "Remix",
|
|
74210
|
+
copyFiles: {
|
|
74211
|
+
path: "./templates"
|
|
74212
|
+
},
|
|
74136
74213
|
generate: generate10,
|
|
74214
|
+
configure: configure6,
|
|
74137
74215
|
transformPackageJson: async () => ({
|
|
74138
74216
|
scripts: {
|
|
74139
|
-
|
|
74217
|
+
deploy: `${npm10} run build && wrangler pages deploy ./build/client`,
|
|
74218
|
+
preview: `${npm10} run build && wrangler pages dev ./build/client`,
|
|
74219
|
+
"build-cf-types": `wrangler types`
|
|
74140
74220
|
}
|
|
74141
74221
|
}),
|
|
74142
74222
|
devScript: "dev",
|
|
74223
|
+
deployScript: "deploy",
|
|
74224
|
+
previewScript: "preview",
|
|
74143
74225
|
testFlags: ["--typescript", "--no-install", "--no-git-init"]
|
|
74144
74226
|
};
|
|
74145
74227
|
c3_default10 = config9;
|
|
@@ -74194,7 +74276,7 @@ var c3_exports12 = {};
|
|
|
74194
74276
|
__export(c3_exports12, {
|
|
74195
74277
|
default: () => c3_default12
|
|
74196
74278
|
});
|
|
74197
|
-
var import_node_os,
|
|
74279
|
+
var import_node_os, recast5, npm12, generate12, configure7, updateSvelteConfig, updateTypeDefinitions, config11, c3_default12;
|
|
74198
74280
|
var init_c312 = __esm({
|
|
74199
74281
|
"templates/svelte/c3.ts"() {
|
|
74200
74282
|
import_node_os = require("node:os");
|
|
@@ -74204,13 +74286,13 @@ var init_c312 = __esm({
|
|
|
74204
74286
|
init_command();
|
|
74205
74287
|
init_files();
|
|
74206
74288
|
init_packages();
|
|
74207
|
-
|
|
74289
|
+
recast5 = __toESM(require_main3());
|
|
74208
74290
|
({ npm: npm12 } = detectPackageManager());
|
|
74209
74291
|
generate12 = async (ctx) => {
|
|
74210
74292
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
74211
74293
|
logRaw("");
|
|
74212
74294
|
};
|
|
74213
|
-
|
|
74295
|
+
configure7 = async (ctx) => {
|
|
74214
74296
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
74215
74297
|
await installPackages([pkg], {
|
|
74216
74298
|
dev: true,
|
|
@@ -74237,7 +74319,7 @@ var init_c312 = __esm({
|
|
|
74237
74319
|
return;
|
|
74238
74320
|
}
|
|
74239
74321
|
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
74240
|
-
const b2 =
|
|
74322
|
+
const b2 = recast5.types.builders;
|
|
74241
74323
|
transformFile("src/app.d.ts", {
|
|
74242
74324
|
visitTSModuleDeclaration(n2) {
|
|
74243
74325
|
if (n2.value.id.name === "App" && n2.node.body) {
|
|
@@ -74281,7 +74363,7 @@ var init_c312 = __esm({
|
|
|
74281
74363
|
}
|
|
74282
74364
|
},
|
|
74283
74365
|
generate: generate12,
|
|
74284
|
-
configure:
|
|
74366
|
+
configure: configure7,
|
|
74285
74367
|
transformPackageJson: async (original, ctx) => {
|
|
74286
74368
|
let scripts = {
|
|
74287
74369
|
preview: `${npm12} run build && wrangler pages dev .svelte-kit/cloudflare`,
|
|
@@ -79978,7 +80060,7 @@ var runCli = async (args) => {
|
|
|
79978
80060
|
};
|
|
79979
80061
|
var runTemplate = async (ctx) => {
|
|
79980
80062
|
await create(ctx);
|
|
79981
|
-
await
|
|
80063
|
+
await configure8(ctx);
|
|
79982
80064
|
await deploy(ctx);
|
|
79983
80065
|
await printSummary(ctx);
|
|
79984
80066
|
};
|
|
@@ -79994,7 +80076,7 @@ var create = async (ctx) => {
|
|
|
79994
80076
|
await rectifyPmMismatch(ctx);
|
|
79995
80077
|
endSection(`Application created`);
|
|
79996
80078
|
};
|
|
79997
|
-
var
|
|
80079
|
+
var configure8 = async (ctx) => {
|
|
79998
80080
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
79999
80081
|
await installWrangler();
|
|
80000
80082
|
await installWorkersTypes(ctx);
|