create-cloudflare 2.12.1 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +782 -606
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
- 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/templates/solid/c3.ts +52 -11
- package/templates/solid/js/vite.config.js +0 -12
- package/templates/solid/ts/vite.config.ts +0 -12
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.1";
|
|
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: types6 } = 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 (!types6.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" || !types6.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 && types6.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" || !types6.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 && types6.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" || !types6.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 && types6.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 (types6.isAnyArrayBuffer(V2)) {
|
|
10938
10939
|
return webidl.converters.ArrayBuffer(V2, opts);
|
|
10939
10940
|
}
|
|
10940
|
-
if (
|
|
10941
|
+
if (types6.isTypedArray(V2)) {
|
|
10941
10942
|
return webidl.converters.TypedArray(V2, V2.constructor);
|
|
10942
10943
|
}
|
|
10943
|
-
if (
|
|
10944
|
+
if (types6.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: types6 } = 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) || types6.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 (types6.isAnyArrayBuffer(element) || types6.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: types6 } = 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 (types6.isArrayBuffer(V2) || types6.isTypedArray(V2) || types6.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: types6 } = 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 && types6.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: types6 } = 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 (types6.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) || types6.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.2",
|
|
24220
24221
|
"create-docusaurus": "3.1.1",
|
|
24221
|
-
"create-hono": "0.
|
|
24222
|
+
"create-hono": "0.5.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.
|
|
24226
|
+
"create-remix": "2.8.0",
|
|
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.31.0";
|
|
25814
25815
|
}
|
|
25815
25816
|
});
|
|
25816
25817
|
|
|
@@ -27871,7 +27872,7 @@ var require_toml = __commonJS({
|
|
|
27871
27872
|
});
|
|
27872
27873
|
|
|
27873
27874
|
// src/helpers/files.ts
|
|
27874
|
-
var import_fs5, import_path5, import_toml, copyFile, writeFile2, readFile, readJSON, writeJSON, probePaths, usesTypescript, eslintRcExts, usesEslint, compatDateFlag;
|
|
27875
|
+
var import_fs5, import_path5, import_toml, copyFile, writeFile2, appendFile, readFile, directoryExists, readJSON, writeJSON, probePaths, usesTypescript, eslintRcExts, usesEslint, compatDateFlag;
|
|
27875
27876
|
var init_files = __esm({
|
|
27876
27877
|
"src/helpers/files.ts"() {
|
|
27877
27878
|
import_fs5 = __toESM(require("fs"));
|
|
@@ -27893,6 +27894,13 @@ var init_files = __esm({
|
|
|
27893
27894
|
crash(error2);
|
|
27894
27895
|
}
|
|
27895
27896
|
};
|
|
27897
|
+
appendFile = (path3, content) => {
|
|
27898
|
+
try {
|
|
27899
|
+
import_fs5.default.appendFileSync(path3, content);
|
|
27900
|
+
} catch (error2) {
|
|
27901
|
+
crash(error2);
|
|
27902
|
+
}
|
|
27903
|
+
};
|
|
27896
27904
|
readFile = (path3) => {
|
|
27897
27905
|
try {
|
|
27898
27906
|
return import_fs5.default.readFileSync(path3, "utf-8");
|
|
@@ -27900,6 +27908,17 @@ var init_files = __esm({
|
|
|
27900
27908
|
return crash(error2);
|
|
27901
27909
|
}
|
|
27902
27910
|
};
|
|
27911
|
+
directoryExists = (path3) => {
|
|
27912
|
+
try {
|
|
27913
|
+
const stat = (0, import_fs5.statSync)(path3);
|
|
27914
|
+
return stat.isDirectory();
|
|
27915
|
+
} catch (error2) {
|
|
27916
|
+
if (error2.code === "ENOENT") {
|
|
27917
|
+
return false;
|
|
27918
|
+
}
|
|
27919
|
+
return crash(error2);
|
|
27920
|
+
}
|
|
27921
|
+
};
|
|
27903
27922
|
readJSON = (path3) => {
|
|
27904
27923
|
const contents = readFile(path3);
|
|
27905
27924
|
return contents ? JSON.parse(contents) : contents;
|
|
@@ -32655,7 +32674,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
32655
32674
|
}
|
|
32656
32675
|
}
|
|
32657
32676
|
};
|
|
32658
|
-
var
|
|
32677
|
+
var types6 = createCommonjsModule(function(module3, exports3) {
|
|
32659
32678
|
exports3.name = /* @__PURE__ */ new Map([
|
|
32660
32679
|
["0", "File"],
|
|
32661
32680
|
// same as File
|
|
@@ -32909,14 +32928,14 @@ var require_index_688c5d50 = __commonJS({
|
|
|
32909
32928
|
}
|
|
32910
32929
|
}
|
|
32911
32930
|
get type() {
|
|
32912
|
-
return
|
|
32931
|
+
return types6.name.get(this[TYPE]) || this[TYPE];
|
|
32913
32932
|
}
|
|
32914
32933
|
get typeKey() {
|
|
32915
32934
|
return this[TYPE];
|
|
32916
32935
|
}
|
|
32917
32936
|
set type(type) {
|
|
32918
|
-
if (
|
|
32919
|
-
this[TYPE] =
|
|
32937
|
+
if (types6.code.has(type))
|
|
32938
|
+
this[TYPE] = types6.code.get(type);
|
|
32920
32939
|
else
|
|
32921
32940
|
this[TYPE] = type;
|
|
32922
32941
|
}
|
|
@@ -36028,7 +36047,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
36028
36047
|
exports3.WriteEntry = writeEntry;
|
|
36029
36048
|
exports3.Header = header;
|
|
36030
36049
|
exports3.Pax = pax;
|
|
36031
|
-
exports3.types =
|
|
36050
|
+
exports3.types = types6;
|
|
36032
36051
|
});
|
|
36033
36052
|
var colorName = {
|
|
36034
36053
|
"aliceblue": [240, 248, 255],
|
|
@@ -37986,8 +38005,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
37986
38005
|
}
|
|
37987
38006
|
var fs$appendFile = fs3.appendFile;
|
|
37988
38007
|
if (fs$appendFile)
|
|
37989
|
-
fs3.appendFile =
|
|
37990
|
-
function
|
|
38008
|
+
fs3.appendFile = appendFile2;
|
|
38009
|
+
function appendFile2(path4, data, options, cb) {
|
|
37991
38010
|
if (typeof options === "function")
|
|
37992
38011
|
cb = options, options = null;
|
|
37993
38012
|
return go$appendFile(path4, data, options, cb);
|
|
@@ -42394,364 +42413,6 @@ var init_c3 = __esm({
|
|
|
42394
42413
|
}
|
|
42395
42414
|
});
|
|
42396
42415
|
|
|
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
42416
|
// ../../node_modules/.pnpm/tslib@2.5.3/node_modules/tslib/tslib.es6.mjs
|
|
42756
42417
|
var tslib_es6_exports = {};
|
|
42757
42418
|
__export(tslib_es6_exports, {
|
|
@@ -43342,9 +43003,9 @@ var require_types = __commonJS({
|
|
|
43342
43003
|
/** @class */
|
|
43343
43004
|
function(_super) {
|
|
43344
43005
|
(0, tslib_1.__extends)(OrType2, _super);
|
|
43345
|
-
function OrType2(
|
|
43006
|
+
function OrType2(types6) {
|
|
43346
43007
|
var _this = _super.call(this) || this;
|
|
43347
|
-
_this.types =
|
|
43008
|
+
_this.types = types6;
|
|
43348
43009
|
_this.kind = "OrType";
|
|
43349
43010
|
return _this;
|
|
43350
43011
|
}
|
|
@@ -43489,11 +43150,11 @@ var require_types = __commonJS({
|
|
|
43489
43150
|
function typesPlugin(_fork) {
|
|
43490
43151
|
var Type = {
|
|
43491
43152
|
or: function() {
|
|
43492
|
-
var
|
|
43153
|
+
var types6 = [];
|
|
43493
43154
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
43494
|
-
|
|
43155
|
+
types6[_i] = arguments[_i];
|
|
43495
43156
|
}
|
|
43496
|
-
return new OrType(
|
|
43157
|
+
return new OrType(types6.map(function(type) {
|
|
43497
43158
|
return Type.from(type);
|
|
43498
43159
|
}));
|
|
43499
43160
|
},
|
|
@@ -43942,9 +43603,9 @@ var require_path = __commonJS({
|
|
|
43942
43603
|
var Op = Object.prototype;
|
|
43943
43604
|
var hasOwn = Op.hasOwnProperty;
|
|
43944
43605
|
function pathPlugin(fork) {
|
|
43945
|
-
var
|
|
43946
|
-
var isArray =
|
|
43947
|
-
var isNumber =
|
|
43606
|
+
var types6 = fork.use(types_1.default);
|
|
43607
|
+
var isArray = types6.builtInTypes.array;
|
|
43608
|
+
var isNumber = types6.builtInTypes.number;
|
|
43948
43609
|
var Path = function Path2(value, parentPath, name2) {
|
|
43949
43610
|
if (!(this instanceof Path2)) {
|
|
43950
43611
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -44244,13 +43905,13 @@ var require_scope = __commonJS({
|
|
|
44244
43905
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
44245
43906
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
44246
43907
|
function scopePlugin(fork) {
|
|
44247
|
-
var
|
|
44248
|
-
var Type =
|
|
44249
|
-
var namedTypes =
|
|
43908
|
+
var types6 = fork.use(types_1.default);
|
|
43909
|
+
var Type = types6.Type;
|
|
43910
|
+
var namedTypes = types6.namedTypes;
|
|
44250
43911
|
var Node = namedTypes.Node;
|
|
44251
43912
|
var Expression = namedTypes.Expression;
|
|
44252
|
-
var isArray =
|
|
44253
|
-
var b2 =
|
|
43913
|
+
var isArray = types6.builtInTypes.array;
|
|
43914
|
+
var b2 = types6.builders;
|
|
44254
43915
|
var Scope = function Scope2(path3, parentScope) {
|
|
44255
43916
|
if (!(this instanceof Scope2)) {
|
|
44256
43917
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -44318,7 +43979,7 @@ var require_scope = __commonJS({
|
|
|
44318
43979
|
++index;
|
|
44319
43980
|
}
|
|
44320
43981
|
var name2 = prefix + index;
|
|
44321
|
-
return this.bindings[name2] =
|
|
43982
|
+
return this.bindings[name2] = types6.builders.identifier(name2);
|
|
44322
43983
|
};
|
|
44323
43984
|
Sp.injectTemporary = function(identifier, init) {
|
|
44324
43985
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -44398,7 +44059,7 @@ var require_scope = __commonJS({
|
|
|
44398
44059
|
bindings
|
|
44399
44060
|
);
|
|
44400
44061
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
44401
|
-
|
|
44062
|
+
types6.eachField(node, function(name2, child) {
|
|
44402
44063
|
var childPath = path3.get(name2);
|
|
44403
44064
|
if (!pathHasValue(childPath, child)) {
|
|
44404
44065
|
throw new Error("");
|
|
@@ -44477,24 +44138,24 @@ var require_scope = __commonJS({
|
|
|
44477
44138
|
addPattern(patternPath.get("argument"), bindings);
|
|
44478
44139
|
}
|
|
44479
44140
|
}
|
|
44480
|
-
function addTypePattern(patternPath,
|
|
44141
|
+
function addTypePattern(patternPath, types7) {
|
|
44481
44142
|
var pattern = patternPath.value;
|
|
44482
44143
|
namedTypes.Pattern.assert(pattern);
|
|
44483
44144
|
if (namedTypes.Identifier.check(pattern)) {
|
|
44484
|
-
if (hasOwn.call(
|
|
44485
|
-
|
|
44145
|
+
if (hasOwn.call(types7, pattern.name)) {
|
|
44146
|
+
types7[pattern.name].push(patternPath);
|
|
44486
44147
|
} else {
|
|
44487
|
-
|
|
44148
|
+
types7[pattern.name] = [patternPath];
|
|
44488
44149
|
}
|
|
44489
44150
|
}
|
|
44490
44151
|
}
|
|
44491
|
-
function addTypeParameter(parameterPath,
|
|
44152
|
+
function addTypeParameter(parameterPath, types7) {
|
|
44492
44153
|
var parameter = parameterPath.value;
|
|
44493
44154
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
44494
|
-
if (hasOwn.call(
|
|
44495
|
-
|
|
44155
|
+
if (hasOwn.call(types7, parameter.name)) {
|
|
44156
|
+
types7[parameter.name].push(parameterPath);
|
|
44496
44157
|
} else {
|
|
44497
|
-
|
|
44158
|
+
types7[parameter.name] = [parameterPath];
|
|
44498
44159
|
}
|
|
44499
44160
|
}
|
|
44500
44161
|
Sp.lookup = function(name2) {
|
|
@@ -44532,11 +44193,11 @@ var require_node_path = __commonJS({
|
|
|
44532
44193
|
var path_1 = (0, tslib_1.__importDefault)(require_path());
|
|
44533
44194
|
var scope_1 = (0, tslib_1.__importDefault)(require_scope());
|
|
44534
44195
|
function nodePathPlugin(fork) {
|
|
44535
|
-
var
|
|
44536
|
-
var n2 =
|
|
44537
|
-
var b2 =
|
|
44538
|
-
var isNumber =
|
|
44539
|
-
var isArray =
|
|
44196
|
+
var types6 = fork.use(types_1.default);
|
|
44197
|
+
var n2 = types6.namedTypes;
|
|
44198
|
+
var b2 = types6.builders;
|
|
44199
|
+
var isNumber = types6.builtInTypes.number;
|
|
44200
|
+
var isArray = types6.builtInTypes.array;
|
|
44540
44201
|
var Path = fork.use(path_1.default);
|
|
44541
44202
|
var Scope = fork.use(scope_1.default);
|
|
44542
44203
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -44627,7 +44288,7 @@ var require_node_path = __commonJS({
|
|
|
44627
44288
|
return scope || null;
|
|
44628
44289
|
};
|
|
44629
44290
|
NPp.getValueProperty = function(name2) {
|
|
44630
|
-
return
|
|
44291
|
+
return types6.getFieldValue(this.value, name2);
|
|
44631
44292
|
};
|
|
44632
44293
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
44633
44294
|
var pp = this.parentPath;
|
|
@@ -44769,7 +44430,7 @@ var require_node_path = __commonJS({
|
|
|
44769
44430
|
return node.some(containsCallExpression);
|
|
44770
44431
|
}
|
|
44771
44432
|
if (n2.Node.check(node)) {
|
|
44772
|
-
return
|
|
44433
|
+
return types6.someField(node, function(_name, child) {
|
|
44773
44434
|
return containsCallExpression(child);
|
|
44774
44435
|
});
|
|
44775
44436
|
}
|
|
@@ -44887,11 +44548,11 @@ var require_path_visitor = __commonJS({
|
|
|
44887
44548
|
var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
|
|
44888
44549
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
44889
44550
|
function pathVisitorPlugin(fork) {
|
|
44890
|
-
var
|
|
44551
|
+
var types6 = fork.use(types_1.default);
|
|
44891
44552
|
var NodePath = fork.use(node_path_1.default);
|
|
44892
|
-
var isArray =
|
|
44893
|
-
var isObject2 =
|
|
44894
|
-
var isFunction2 =
|
|
44553
|
+
var isArray = types6.builtInTypes.array;
|
|
44554
|
+
var isObject2 = types6.builtInTypes.object;
|
|
44555
|
+
var isFunction2 = types6.builtInTypes.function;
|
|
44895
44556
|
var undefined2;
|
|
44896
44557
|
var PathVisitor = function PathVisitor2() {
|
|
44897
44558
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -44911,7 +44572,7 @@ var require_path_visitor = __commonJS({
|
|
|
44911
44572
|
typeNames[methodName.slice("visit".length)] = true;
|
|
44912
44573
|
}
|
|
44913
44574
|
}
|
|
44914
|
-
var supertypeTable =
|
|
44575
|
+
var supertypeTable = types6.computeSupertypeLookupTable(typeNames);
|
|
44915
44576
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
44916
44577
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
44917
44578
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -45030,7 +44691,7 @@ var require_path_visitor = __commonJS({
|
|
|
45030
44691
|
path3.each(visitor.visitWithoutReset, visitor);
|
|
45031
44692
|
} else if (!isObject2.check(value)) {
|
|
45032
44693
|
} else {
|
|
45033
|
-
var childNames =
|
|
44694
|
+
var childNames = types6.getFieldNames(value);
|
|
45034
44695
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
45035
44696
|
childNames.push("comments");
|
|
45036
44697
|
}
|
|
@@ -45039,7 +44700,7 @@ var require_path_visitor = __commonJS({
|
|
|
45039
44700
|
for (var i = 0; i < childCount; ++i) {
|
|
45040
44701
|
var childName = childNames[i];
|
|
45041
44702
|
if (!hasOwn.call(value, childName)) {
|
|
45042
|
-
value[childName] =
|
|
44703
|
+
value[childName] = types6.getFieldValue(value, childName);
|
|
45043
44704
|
}
|
|
45044
44705
|
childPaths.push(path3.get(childName));
|
|
45045
44706
|
}
|
|
@@ -45179,13 +44840,13 @@ var require_equiv = __commonJS({
|
|
|
45179
44840
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
45180
44841
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45181
44842
|
function default_1(fork) {
|
|
45182
|
-
var
|
|
45183
|
-
var getFieldNames =
|
|
45184
|
-
var getFieldValue =
|
|
45185
|
-
var isArray =
|
|
45186
|
-
var isObject2 =
|
|
45187
|
-
var isDate =
|
|
45188
|
-
var isRegExp =
|
|
44843
|
+
var types6 = fork.use(types_1.default);
|
|
44844
|
+
var getFieldNames = types6.getFieldNames;
|
|
44845
|
+
var getFieldValue = types6.getFieldValue;
|
|
44846
|
+
var isArray = types6.builtInTypes.array;
|
|
44847
|
+
var isObject2 = types6.builtInTypes.object;
|
|
44848
|
+
var isDate = types6.builtInTypes.Date;
|
|
44849
|
+
var isRegExp = types6.builtInTypes.RegExp;
|
|
45189
44850
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
45190
44851
|
function astNodesAreEquivalent(a, b2, problemPath) {
|
|
45191
44852
|
if (isArray.check(problemPath)) {
|
|
@@ -45335,24 +44996,24 @@ var require_fork = __commonJS({
|
|
|
45335
44996
|
var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
|
|
45336
44997
|
function default_1(plugins) {
|
|
45337
44998
|
var fork = createFork();
|
|
45338
|
-
var
|
|
44999
|
+
var types6 = fork.use(types_1.default);
|
|
45339
45000
|
plugins.forEach(fork.use);
|
|
45340
|
-
|
|
45001
|
+
types6.finalize();
|
|
45341
45002
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
45342
45003
|
return {
|
|
45343
|
-
Type:
|
|
45344
|
-
builtInTypes:
|
|
45345
|
-
namedTypes:
|
|
45346
|
-
builders:
|
|
45347
|
-
defineMethod:
|
|
45348
|
-
getFieldNames:
|
|
45349
|
-
getFieldValue:
|
|
45350
|
-
eachField:
|
|
45351
|
-
someField:
|
|
45352
|
-
getSupertypeNames:
|
|
45353
|
-
getBuilderName:
|
|
45004
|
+
Type: types6.Type,
|
|
45005
|
+
builtInTypes: types6.builtInTypes,
|
|
45006
|
+
namedTypes: types6.namedTypes,
|
|
45007
|
+
builders: types6.builders,
|
|
45008
|
+
defineMethod: types6.defineMethod,
|
|
45009
|
+
getFieldNames: types6.getFieldNames,
|
|
45010
|
+
getFieldValue: types6.getFieldValue,
|
|
45011
|
+
eachField: types6.eachField,
|
|
45012
|
+
someField: types6.someField,
|
|
45013
|
+
getSupertypeNames: types6.getSupertypeNames,
|
|
45014
|
+
getBuilderName: types6.getBuilderName,
|
|
45354
45015
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
45355
|
-
finalize:
|
|
45016
|
+
finalize: types6.finalize,
|
|
45356
45017
|
Path: fork.use(path_1.default),
|
|
45357
45018
|
NodePath: fork.use(node_path_1.default),
|
|
45358
45019
|
PathVisitor,
|
|
@@ -45388,9 +45049,9 @@ var require_shared = __commonJS({
|
|
|
45388
45049
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
45389
45050
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45390
45051
|
function default_1(fork) {
|
|
45391
|
-
var
|
|
45392
|
-
var Type =
|
|
45393
|
-
var builtin =
|
|
45052
|
+
var types6 = fork.use(types_1.default);
|
|
45053
|
+
var Type = types6.Type;
|
|
45054
|
+
var builtin = types6.builtInTypes;
|
|
45394
45055
|
var isNumber = builtin.number;
|
|
45395
45056
|
function geq(than) {
|
|
45396
45057
|
return Type.from(function(value) {
|
|
@@ -45569,8 +45230,8 @@ var require_core2 = __commonJS({
|
|
|
45569
45230
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45570
45231
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45571
45232
|
function default_1(fork) {
|
|
45572
|
-
var
|
|
45573
|
-
var Type =
|
|
45233
|
+
var types6 = fork.use(types_1.default);
|
|
45234
|
+
var Type = types6.Type;
|
|
45574
45235
|
var def = Type.def;
|
|
45575
45236
|
var or = Type.or;
|
|
45576
45237
|
var shared = fork.use(shared_1.default);
|
|
@@ -45660,9 +45321,9 @@ var require_es6 = __commonJS({
|
|
|
45660
45321
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45661
45322
|
function default_1(fork) {
|
|
45662
45323
|
fork.use(core_1.default);
|
|
45663
|
-
var
|
|
45664
|
-
var def =
|
|
45665
|
-
var or =
|
|
45324
|
+
var types6 = fork.use(types_1.default);
|
|
45325
|
+
var def = types6.Type.def;
|
|
45326
|
+
var or = types6.Type.or;
|
|
45666
45327
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45667
45328
|
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
45329
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -45748,8 +45409,8 @@ var require_es2017 = __commonJS({
|
|
|
45748
45409
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45749
45410
|
function default_1(fork) {
|
|
45750
45411
|
fork.use(es2016_1.default);
|
|
45751
|
-
var
|
|
45752
|
-
var def =
|
|
45412
|
+
var types6 = fork.use(types_1.default);
|
|
45413
|
+
var def = types6.Type.def;
|
|
45753
45414
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45754
45415
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
45755
45416
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -45770,9 +45431,9 @@ var require_es2018 = __commonJS({
|
|
|
45770
45431
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45771
45432
|
function default_1(fork) {
|
|
45772
45433
|
fork.use(es2017_1.default);
|
|
45773
|
-
var
|
|
45774
|
-
var def =
|
|
45775
|
-
var or =
|
|
45434
|
+
var types6 = fork.use(types_1.default);
|
|
45435
|
+
var def = types6.Type.def;
|
|
45436
|
+
var or = types6.Type.or;
|
|
45776
45437
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45777
45438
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
45778
45439
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -45802,9 +45463,9 @@ var require_es2019 = __commonJS({
|
|
|
45802
45463
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45803
45464
|
function default_1(fork) {
|
|
45804
45465
|
fork.use(es2018_1.default);
|
|
45805
|
-
var
|
|
45806
|
-
var def =
|
|
45807
|
-
var or =
|
|
45466
|
+
var types6 = fork.use(types_1.default);
|
|
45467
|
+
var def = types6.Type.def;
|
|
45468
|
+
var or = types6.Type.or;
|
|
45808
45469
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45809
45470
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
45810
45471
|
}
|
|
@@ -45826,9 +45487,9 @@ var require_es20202 = __commonJS({
|
|
|
45826
45487
|
function default_1(fork) {
|
|
45827
45488
|
fork.use(es2020_1.default);
|
|
45828
45489
|
fork.use(es2019_1.default);
|
|
45829
|
-
var
|
|
45830
|
-
var def =
|
|
45831
|
-
var or =
|
|
45490
|
+
var types6 = fork.use(types_1.default);
|
|
45491
|
+
var def = types6.Type.def;
|
|
45492
|
+
var or = types6.Type.or;
|
|
45832
45493
|
var shared = fork.use(shared_1.default);
|
|
45833
45494
|
var defaults = shared.defaults;
|
|
45834
45495
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -45872,8 +45533,8 @@ var require_es2022 = __commonJS({
|
|
|
45872
45533
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45873
45534
|
function default_1(fork) {
|
|
45874
45535
|
fork.use(es2021_1.default);
|
|
45875
|
-
var
|
|
45876
|
-
var def =
|
|
45536
|
+
var types6 = fork.use(types_1.default);
|
|
45537
|
+
var def = types6.Type.def;
|
|
45877
45538
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
45878
45539
|
}
|
|
45879
45540
|
exports2.default = default_1;
|
|
@@ -45892,9 +45553,9 @@ var require_es_proposals = __commonJS({
|
|
|
45892
45553
|
var es2022_1 = (0, tslib_1.__importDefault)(require_es2022());
|
|
45893
45554
|
function default_1(fork) {
|
|
45894
45555
|
fork.use(es2022_1.default);
|
|
45895
|
-
var
|
|
45896
|
-
var Type =
|
|
45897
|
-
var def =
|
|
45556
|
+
var types6 = fork.use(types_1.default);
|
|
45557
|
+
var Type = types6.Type;
|
|
45558
|
+
var def = types6.Type.def;
|
|
45898
45559
|
var or = Type.or;
|
|
45899
45560
|
var shared = fork.use(shared_1.default);
|
|
45900
45561
|
var defaults = shared.defaults;
|
|
@@ -45932,9 +45593,9 @@ var require_jsx = __commonJS({
|
|
|
45932
45593
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45933
45594
|
function default_1(fork) {
|
|
45934
45595
|
fork.use(es_proposals_1.default);
|
|
45935
|
-
var
|
|
45936
|
-
var def =
|
|
45937
|
-
var or =
|
|
45596
|
+
var types6 = fork.use(types_1.default);
|
|
45597
|
+
var def = types6.Type.def;
|
|
45598
|
+
var or = types6.Type.or;
|
|
45938
45599
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45939
45600
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
45940
45601
|
def("Literal"),
|
|
@@ -45996,9 +45657,9 @@ var require_type_annotations = __commonJS({
|
|
|
45996
45657
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45997
45658
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45998
45659
|
function default_1(fork) {
|
|
45999
|
-
var
|
|
46000
|
-
var def =
|
|
46001
|
-
var or =
|
|
45660
|
+
var types6 = fork.use(types_1.default);
|
|
45661
|
+
var def = types6.Type.def;
|
|
45662
|
+
var or = types6.Type.or;
|
|
46002
45663
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46003
45664
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
46004
45665
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -46031,9 +45692,9 @@ var require_flow = __commonJS({
|
|
|
46031
45692
|
function default_1(fork) {
|
|
46032
45693
|
fork.use(es_proposals_1.default);
|
|
46033
45694
|
fork.use(type_annotations_1.default);
|
|
46034
|
-
var
|
|
46035
|
-
var def =
|
|
46036
|
-
var or =
|
|
45695
|
+
var types6 = fork.use(types_1.default);
|
|
45696
|
+
var def = types6.Type.def;
|
|
45697
|
+
var or = types6.Type.or;
|
|
46037
45698
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46038
45699
|
def("Flow").bases("Node");
|
|
46039
45700
|
def("FlowType").bases("Flow");
|
|
@@ -46148,10 +45809,10 @@ var require_esprima = __commonJS({
|
|
|
46148
45809
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
46149
45810
|
function default_1(fork) {
|
|
46150
45811
|
fork.use(es_proposals_1.default);
|
|
46151
|
-
var
|
|
45812
|
+
var types6 = fork.use(types_1.default);
|
|
46152
45813
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46153
|
-
var def =
|
|
46154
|
-
var or =
|
|
45814
|
+
var def = types6.Type.def;
|
|
45815
|
+
var or = types6.Type.or;
|
|
46155
45816
|
def("VariableDeclaration").field("declarations", [or(
|
|
46156
45817
|
def("VariableDeclarator"),
|
|
46157
45818
|
def("Identifier")
|
|
@@ -46208,11 +45869,11 @@ var require_babel_core = __commonJS({
|
|
|
46208
45869
|
function default_1(fork) {
|
|
46209
45870
|
var _a2, _b2, _c2, _d, _e;
|
|
46210
45871
|
fork.use(es_proposals_1.default);
|
|
46211
|
-
var
|
|
45872
|
+
var types6 = fork.use(types_1.default);
|
|
46212
45873
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46213
|
-
var def =
|
|
46214
|
-
var or =
|
|
46215
|
-
var isUndefined =
|
|
45874
|
+
var def = types6.Type.def;
|
|
45875
|
+
var or = types6.Type.or;
|
|
45876
|
+
var isUndefined = types6.builtInTypes.undefined;
|
|
46216
45877
|
def("Noop").bases("Statement").build();
|
|
46217
45878
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
46218
45879
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -46247,7 +45908,7 @@ var require_babel_core = __commonJS({
|
|
|
46247
45908
|
raw: String
|
|
46248
45909
|
},
|
|
46249
45910
|
function getDefault() {
|
|
46250
|
-
var value =
|
|
45911
|
+
var value = types6.getFieldValue(this, "value");
|
|
46251
45912
|
return {
|
|
46252
45913
|
rawValue: value,
|
|
46253
45914
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -46338,8 +45999,8 @@ var require_babel = __commonJS({
|
|
|
46338
45999
|
var babel_core_1 = (0, tslib_1.__importDefault)(require_babel_core());
|
|
46339
46000
|
var flow_1 = (0, tslib_1.__importDefault)(require_flow());
|
|
46340
46001
|
function default_1(fork) {
|
|
46341
|
-
var
|
|
46342
|
-
var def =
|
|
46002
|
+
var types6 = fork.use(types_1.default);
|
|
46003
|
+
var def = types6.Type.def;
|
|
46343
46004
|
fork.use(babel_core_1.default);
|
|
46344
46005
|
fork.use(flow_1.default);
|
|
46345
46006
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -46363,12 +46024,12 @@ var require_typescript = __commonJS({
|
|
|
46363
46024
|
function default_1(fork) {
|
|
46364
46025
|
fork.use(babel_core_1.default);
|
|
46365
46026
|
fork.use(type_annotations_1.default);
|
|
46366
|
-
var
|
|
46367
|
-
var n2 =
|
|
46368
|
-
var def =
|
|
46369
|
-
var or =
|
|
46027
|
+
var types6 = fork.use(types_1.default);
|
|
46028
|
+
var n2 = types6.namedTypes;
|
|
46029
|
+
var def = types6.Type.def;
|
|
46030
|
+
var or = types6.Type.or;
|
|
46370
46031
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46371
|
-
var StringLiteral =
|
|
46032
|
+
var StringLiteral = types6.Type.from(function(value, deep) {
|
|
46372
46033
|
if (n2.StringLiteral && n2.StringLiteral.check(value, deep)) {
|
|
46373
46034
|
return true;
|
|
46374
46035
|
}
|
|
@@ -48346,8 +48007,8 @@ var require_util9 = __commonJS({
|
|
|
48346
48007
|
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
48008
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
48348
48009
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
48349
|
-
var
|
|
48350
|
-
var n2 =
|
|
48010
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
48011
|
+
var n2 = types6.namedTypes;
|
|
48351
48012
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
48352
48013
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
48353
48014
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -55760,10 +55421,10 @@ var require_comments = __commonJS({
|
|
|
55760
55421
|
exports2.printComments = exports2.attach = void 0;
|
|
55761
55422
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
55762
55423
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
55763
|
-
var
|
|
55764
|
-
var n2 =
|
|
55765
|
-
var isArray =
|
|
55766
|
-
var isObject2 =
|
|
55424
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
55425
|
+
var n2 = types6.namedTypes;
|
|
55426
|
+
var isArray = types6.builtInTypes.array;
|
|
55427
|
+
var isObject2 = types6.builtInTypes.object;
|
|
55767
55428
|
var lines_1 = require_lines();
|
|
55768
55429
|
var util_1 = require_util9();
|
|
55769
55430
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -55794,7 +55455,7 @@ var require_comments = __commonJS({
|
|
|
55794
55455
|
if (isArray.check(node)) {
|
|
55795
55456
|
names = Object.keys(node);
|
|
55796
55457
|
} else if (isObject2.check(node)) {
|
|
55797
|
-
names =
|
|
55458
|
+
names = types6.getFieldNames(node);
|
|
55798
55459
|
} else {
|
|
55799
55460
|
return resultArray;
|
|
55800
55461
|
}
|
|
@@ -55974,7 +55635,7 @@ var require_comments = __commonJS({
|
|
|
55974
55635
|
function printComments(path3, print2) {
|
|
55975
55636
|
var value = path3.getValue();
|
|
55976
55637
|
var innerLines = print2(path3);
|
|
55977
|
-
var comments = n2.Node.check(value) &&
|
|
55638
|
+
var comments = n2.Node.check(value) && types6.getFieldValue(value, "comments");
|
|
55978
55639
|
if (!comments || comments.length === 0) {
|
|
55979
55640
|
return innerLines;
|
|
55980
55641
|
}
|
|
@@ -55982,8 +55643,8 @@ var require_comments = __commonJS({
|
|
|
55982
55643
|
var trailingParts = [innerLines];
|
|
55983
55644
|
path3.each(function(commentPath) {
|
|
55984
55645
|
var comment = commentPath.getValue();
|
|
55985
|
-
var leading =
|
|
55986
|
-
var trailing =
|
|
55646
|
+
var leading = types6.getFieldValue(comment, "leading");
|
|
55647
|
+
var trailing = types6.getFieldValue(comment, "trailing");
|
|
55987
55648
|
if (leading || trailing && !(n2.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55988
55649
|
leadingParts.push(printLeadingComment(commentPath, print2));
|
|
55989
55650
|
} else if (trailing) {
|
|
@@ -56005,10 +55666,10 @@ var require_parser2 = __commonJS({
|
|
|
56005
55666
|
exports2.parse = void 0;
|
|
56006
55667
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56007
55668
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56008
|
-
var
|
|
56009
|
-
var b2 =
|
|
56010
|
-
var isObject2 =
|
|
56011
|
-
var isArray =
|
|
55669
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
55670
|
+
var b2 = types6.builders;
|
|
55671
|
+
var isObject2 = types6.builtInTypes.object;
|
|
55672
|
+
var isArray = types6.builtInTypes.array;
|
|
56012
55673
|
var options_1 = require_options();
|
|
56013
55674
|
var lines_1 = require_lines();
|
|
56014
55675
|
var comments_1 = require_comments();
|
|
@@ -56195,11 +55856,11 @@ var require_fast_path = __commonJS({
|
|
|
56195
55856
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
56196
55857
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56197
55858
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56198
|
-
var
|
|
55859
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
56199
55860
|
var util = tslib_1.__importStar(require_util9());
|
|
56200
|
-
var n2 =
|
|
56201
|
-
var isArray =
|
|
56202
|
-
var isNumber =
|
|
55861
|
+
var n2 = types6.namedTypes;
|
|
55862
|
+
var isArray = types6.builtInTypes.array;
|
|
55863
|
+
var isNumber = types6.builtInTypes.number;
|
|
56203
55864
|
var PRECEDENCE = {};
|
|
56204
55865
|
[
|
|
56205
55866
|
["??"],
|
|
@@ -56228,7 +55889,7 @@ var require_fast_path = __commonJS({
|
|
|
56228
55889
|
if (obj instanceof FastPath) {
|
|
56229
55890
|
return obj.copy();
|
|
56230
55891
|
}
|
|
56231
|
-
if (obj instanceof
|
|
55892
|
+
if (obj instanceof types6.NodePath) {
|
|
56232
55893
|
var copy = Object.create(FastPath.prototype);
|
|
56233
55894
|
var stack = [obj.value];
|
|
56234
55895
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -56539,7 +56200,7 @@ var require_fast_path = __commonJS({
|
|
|
56539
56200
|
return node.some(containsCallExpression);
|
|
56540
56201
|
}
|
|
56541
56202
|
if (n2.Node.check(node)) {
|
|
56542
|
-
return
|
|
56203
|
+
return types6.someField(node, function(_name, child) {
|
|
56543
56204
|
return containsCallExpression(child);
|
|
56544
56205
|
});
|
|
56545
56206
|
}
|
|
@@ -56629,16 +56290,16 @@ var require_patcher = __commonJS({
|
|
|
56629
56290
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56630
56291
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56631
56292
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
56632
|
-
var
|
|
56633
|
-
var Printable =
|
|
56634
|
-
var Expression =
|
|
56635
|
-
var ReturnStatement =
|
|
56636
|
-
var SourceLocation =
|
|
56293
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
56294
|
+
var Printable = types6.namedTypes.Printable;
|
|
56295
|
+
var Expression = types6.namedTypes.Expression;
|
|
56296
|
+
var ReturnStatement = types6.namedTypes.ReturnStatement;
|
|
56297
|
+
var SourceLocation = types6.namedTypes.SourceLocation;
|
|
56637
56298
|
var util_1 = require_util9();
|
|
56638
56299
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
56639
|
-
var isObject2 =
|
|
56640
|
-
var isArray =
|
|
56641
|
-
var isString =
|
|
56300
|
+
var isObject2 = types6.builtInTypes.object;
|
|
56301
|
+
var isArray = types6.builtInTypes.array;
|
|
56302
|
+
var isString = types6.builtInTypes.string;
|
|
56642
56303
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
56643
56304
|
var Patcher = function Patcher2(lines) {
|
|
56644
56305
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -56917,8 +56578,8 @@ var require_patcher = __commonJS({
|
|
|
56917
56578
|
if (k2.charAt(0) === "_") {
|
|
56918
56579
|
continue;
|
|
56919
56580
|
}
|
|
56920
|
-
newPath.stack.push(k2,
|
|
56921
|
-
oldPath.stack.push(k2,
|
|
56581
|
+
newPath.stack.push(k2, types6.getFieldValue(newNode, k2));
|
|
56582
|
+
oldPath.stack.push(k2, types6.getFieldValue(oldNode, k2));
|
|
56922
56583
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
56923
56584
|
newPath.stack.length -= 2;
|
|
56924
56585
|
oldPath.stack.length -= 2;
|
|
@@ -56946,10 +56607,10 @@ var require_printer = __commonJS({
|
|
|
56946
56607
|
var lines_1 = require_lines();
|
|
56947
56608
|
var options_1 = require_options();
|
|
56948
56609
|
var patcher_1 = require_patcher();
|
|
56949
|
-
var
|
|
56950
|
-
var namedTypes =
|
|
56951
|
-
var isString =
|
|
56952
|
-
var isObject2 =
|
|
56610
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
56611
|
+
var namedTypes = types6.namedTypes;
|
|
56612
|
+
var isString = types6.builtInTypes.string;
|
|
56613
|
+
var isObject2 = types6.builtInTypes.object;
|
|
56953
56614
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
56954
56615
|
var util = tslib_1.__importStar(require_util9());
|
|
56955
56616
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
@@ -57123,7 +56784,7 @@ var require_printer = __commonJS({
|
|
|
57123
56784
|
case "OptionalMemberExpression": {
|
|
57124
56785
|
parts.push(path3.call(print2, "object"));
|
|
57125
56786
|
var property = path3.call(print2, "property");
|
|
57126
|
-
var optional =
|
|
56787
|
+
var optional = types6.getFieldValue(n2, "optional");
|
|
57127
56788
|
if (n2.computed) {
|
|
57128
56789
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
57129
56790
|
} else {
|
|
@@ -57394,7 +57055,7 @@ var require_printer = __commonJS({
|
|
|
57394
57055
|
if (n2.typeArguments) {
|
|
57395
57056
|
parts.push(path3.call(print2, "typeArguments"));
|
|
57396
57057
|
}
|
|
57397
|
-
if (
|
|
57058
|
+
if (types6.getFieldValue(n2, "optional")) {
|
|
57398
57059
|
parts.push("?.");
|
|
57399
57060
|
}
|
|
57400
57061
|
parts.push(printArgumentsList(path3, options, print2));
|
|
@@ -59026,8 +58687,8 @@ var require_printer = __commonJS({
|
|
|
59026
58687
|
});
|
|
59027
58688
|
}
|
|
59028
58689
|
function getPossibleRaw(node) {
|
|
59029
|
-
var value =
|
|
59030
|
-
var extra =
|
|
58690
|
+
var value = types6.getFieldValue(node, "value");
|
|
58691
|
+
var extra = types6.getFieldValue(node, "extra");
|
|
59031
58692
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
59032
58693
|
return extra.raw;
|
|
59033
58694
|
}
|
|
@@ -59075,8 +58736,8 @@ var require_main3 = __commonJS({
|
|
|
59075
58736
|
exports2.run = exports2.prettyPrint = exports2.print = exports2.visit = exports2.types = exports2.parse = void 0;
|
|
59076
58737
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
59077
58738
|
var fs_1 = tslib_1.__importDefault(require("fs"));
|
|
59078
|
-
var
|
|
59079
|
-
exports2.types =
|
|
58739
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
58740
|
+
exports2.types = types6;
|
|
59080
58741
|
var parser_1 = require_parser2();
|
|
59081
58742
|
Object.defineProperty(exports2, "parse", { enumerable: true, get: function() {
|
|
59082
58743
|
return parser_1.parse;
|
|
@@ -59940,14 +59601,14 @@ var require_lib = __commonJS({
|
|
|
59940
59601
|
this.preserveSpace = !!preserveSpace;
|
|
59941
59602
|
}
|
|
59942
59603
|
};
|
|
59943
|
-
var
|
|
59604
|
+
var types6 = {
|
|
59944
59605
|
brace: new TokContext("{"),
|
|
59945
59606
|
j_oTag: new TokContext("<tag"),
|
|
59946
59607
|
j_cTag: new TokContext("</tag"),
|
|
59947
59608
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
59948
59609
|
};
|
|
59949
59610
|
{
|
|
59950
|
-
|
|
59611
|
+
types6.template = new TokContext("`", true);
|
|
59951
59612
|
}
|
|
59952
59613
|
var beforeExpr = true;
|
|
59953
59614
|
var startsExpr = true;
|
|
@@ -60479,17 +60140,17 @@ var require_lib = __commonJS({
|
|
|
60479
60140
|
context.pop();
|
|
60480
60141
|
};
|
|
60481
60142
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
60482
|
-
context.push(
|
|
60143
|
+
context.push(types6.brace);
|
|
60483
60144
|
};
|
|
60484
60145
|
tokenTypes[22].updateContext = (context) => {
|
|
60485
|
-
if (context[context.length - 1] ===
|
|
60146
|
+
if (context[context.length - 1] === types6.template) {
|
|
60486
60147
|
context.pop();
|
|
60487
60148
|
} else {
|
|
60488
|
-
context.push(
|
|
60149
|
+
context.push(types6.template);
|
|
60489
60150
|
}
|
|
60490
60151
|
};
|
|
60491
60152
|
tokenTypes[140].updateContext = (context) => {
|
|
60492
|
-
context.push(
|
|
60153
|
+
context.push(types6.j_expr, types6.j_oTag);
|
|
60493
60154
|
};
|
|
60494
60155
|
}
|
|
60495
60156
|
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 +60756,7 @@ var require_lib = __commonJS({
|
|
|
61095
60756
|
this.lastTokEndLoc = null;
|
|
61096
60757
|
this.lastTokStartLoc = null;
|
|
61097
60758
|
this.lastTokStart = 0;
|
|
61098
|
-
this.context = [
|
|
60759
|
+
this.context = [types6.brace];
|
|
61099
60760
|
this.canStartJSXElement = true;
|
|
61100
60761
|
this.containsEsc = false;
|
|
61101
60762
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -64986,7 +64647,7 @@ var require_lib = __commonJS({
|
|
|
64986
64647
|
context
|
|
64987
64648
|
} = this.state;
|
|
64988
64649
|
const currentContext = context[context.length - 1];
|
|
64989
|
-
if (currentContext ===
|
|
64650
|
+
if (currentContext === types6.j_oTag || currentContext === types6.j_expr) {
|
|
64990
64651
|
context.pop();
|
|
64991
64652
|
}
|
|
64992
64653
|
}
|
|
@@ -66044,9 +65705,9 @@ var require_lib = __commonJS({
|
|
|
66044
65705
|
switch (this.state.type) {
|
|
66045
65706
|
case 5:
|
|
66046
65707
|
node = this.startNode();
|
|
66047
|
-
this.setContext(
|
|
65708
|
+
this.setContext(types6.brace);
|
|
66048
65709
|
this.next();
|
|
66049
|
-
node = this.jsxParseExpressionContainer(node,
|
|
65710
|
+
node = this.jsxParseExpressionContainer(node, types6.j_oTag);
|
|
66050
65711
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
66051
65712
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
66052
65713
|
at: node
|
|
@@ -66069,7 +65730,7 @@ var require_lib = __commonJS({
|
|
|
66069
65730
|
jsxParseSpreadChild(node) {
|
|
66070
65731
|
this.next();
|
|
66071
65732
|
node.expression = this.parseExpression();
|
|
66072
|
-
this.setContext(
|
|
65733
|
+
this.setContext(types6.j_expr);
|
|
66073
65734
|
this.state.canStartJSXElement = true;
|
|
66074
65735
|
this.expect(8);
|
|
66075
65736
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -66089,11 +65750,11 @@ var require_lib = __commonJS({
|
|
|
66089
65750
|
jsxParseAttribute() {
|
|
66090
65751
|
const node = this.startNode();
|
|
66091
65752
|
if (this.match(5)) {
|
|
66092
|
-
this.setContext(
|
|
65753
|
+
this.setContext(types6.brace);
|
|
66093
65754
|
this.next();
|
|
66094
65755
|
this.expect(21);
|
|
66095
65756
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
66096
|
-
this.setContext(
|
|
65757
|
+
this.setContext(types6.j_oTag);
|
|
66097
65758
|
this.state.canStartJSXElement = true;
|
|
66098
65759
|
this.expect(8);
|
|
66099
65760
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -66152,12 +65813,12 @@ var require_lib = __commonJS({
|
|
|
66152
65813
|
break;
|
|
66153
65814
|
case 5: {
|
|
66154
65815
|
const node2 = this.startNode();
|
|
66155
|
-
this.setContext(
|
|
65816
|
+
this.setContext(types6.brace);
|
|
66156
65817
|
this.next();
|
|
66157
65818
|
if (this.match(21)) {
|
|
66158
65819
|
children.push(this.jsxParseSpreadChild(node2));
|
|
66159
65820
|
} else {
|
|
66160
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
65821
|
+
children.push(this.jsxParseExpressionContainer(node2, types6.j_expr));
|
|
66161
65822
|
}
|
|
66162
65823
|
break;
|
|
66163
65824
|
}
|
|
@@ -66228,11 +65889,11 @@ var require_lib = __commonJS({
|
|
|
66228
65889
|
}
|
|
66229
65890
|
getTokenFromCode(code) {
|
|
66230
65891
|
const context = this.curContext();
|
|
66231
|
-
if (context ===
|
|
65892
|
+
if (context === types6.j_expr) {
|
|
66232
65893
|
this.jsxReadToken();
|
|
66233
65894
|
return;
|
|
66234
65895
|
}
|
|
66235
|
-
if (context ===
|
|
65896
|
+
if (context === types6.j_oTag || context === types6.j_cTag) {
|
|
66236
65897
|
if (isIdentifierStart(code)) {
|
|
66237
65898
|
this.jsxReadWord();
|
|
66238
65899
|
return;
|
|
@@ -66242,7 +65903,7 @@ var require_lib = __commonJS({
|
|
|
66242
65903
|
this.finishToken(141);
|
|
66243
65904
|
return;
|
|
66244
65905
|
}
|
|
66245
|
-
if ((code === 34 || code === 39) && context ===
|
|
65906
|
+
if ((code === 34 || code === 39) && context === types6.j_oTag) {
|
|
66246
65907
|
this.jsxReadString(code);
|
|
66247
65908
|
return;
|
|
66248
65909
|
}
|
|
@@ -66260,17 +65921,17 @@ var require_lib = __commonJS({
|
|
|
66260
65921
|
type
|
|
66261
65922
|
} = this.state;
|
|
66262
65923
|
if (type === 56 && prevType === 140) {
|
|
66263
|
-
context.splice(-2, 2,
|
|
65924
|
+
context.splice(-2, 2, types6.j_cTag);
|
|
66264
65925
|
this.state.canStartJSXElement = false;
|
|
66265
65926
|
} else if (type === 140) {
|
|
66266
|
-
context.push(
|
|
65927
|
+
context.push(types6.j_oTag);
|
|
66267
65928
|
} else if (type === 141) {
|
|
66268
65929
|
const out = context[context.length - 1];
|
|
66269
|
-
if (out ===
|
|
65930
|
+
if (out === types6.j_oTag && prevType === 56 || out === types6.j_cTag) {
|
|
66270
65931
|
context.pop();
|
|
66271
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
65932
|
+
this.state.canStartJSXElement = context[context.length - 1] === types6.j_expr;
|
|
66272
65933
|
} else {
|
|
66273
|
-
this.setContext(
|
|
65934
|
+
this.setContext(types6.j_expr);
|
|
66274
65935
|
this.state.canStartJSXElement = true;
|
|
66275
65936
|
}
|
|
66276
65937
|
} else {
|
|
@@ -67714,14 +67375,14 @@ var require_lib = __commonJS({
|
|
|
67714
67375
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
67715
67376
|
const node = this.startNode();
|
|
67716
67377
|
const hasLeadingOperator = this.eat(operator);
|
|
67717
|
-
const
|
|
67378
|
+
const types7 = [];
|
|
67718
67379
|
do {
|
|
67719
|
-
|
|
67380
|
+
types7.push(parseConstituentType());
|
|
67720
67381
|
} while (this.eat(operator));
|
|
67721
|
-
if (
|
|
67722
|
-
return
|
|
67382
|
+
if (types7.length === 1 && !hasLeadingOperator) {
|
|
67383
|
+
return types7[0];
|
|
67723
67384
|
}
|
|
67724
|
-
node.types =
|
|
67385
|
+
node.types = types7;
|
|
67725
67386
|
return this.finishNode(node, kind);
|
|
67726
67387
|
}
|
|
67727
67388
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -68295,7 +67956,7 @@ var require_lib = __commonJS({
|
|
|
68295
67956
|
this.raise(TSErrors.EmptyTypeArguments, {
|
|
68296
67957
|
at: node
|
|
68297
67958
|
});
|
|
68298
|
-
} else if (!this.state.inType && this.curContext() ===
|
|
67959
|
+
} else if (!this.state.inType && this.curContext() === types6.brace) {
|
|
68299
67960
|
this.reScan_lt_gt();
|
|
68300
67961
|
}
|
|
68301
67962
|
this.expect(48);
|
|
@@ -68972,7 +68633,7 @@ var require_lib = __commonJS({
|
|
|
68972
68633
|
context
|
|
68973
68634
|
} = this.state;
|
|
68974
68635
|
const currentContext = context[context.length - 1];
|
|
68975
|
-
if (currentContext ===
|
|
68636
|
+
if (currentContext === types6.j_oTag || currentContext === types6.j_expr) {
|
|
68976
68637
|
context.pop();
|
|
68977
68638
|
}
|
|
68978
68639
|
}
|
|
@@ -73805,11 +73466,11 @@ var require_typescript2 = __commonJS({
|
|
|
73805
73466
|
});
|
|
73806
73467
|
|
|
73807
73468
|
// src/helpers/codemod.ts
|
|
73808
|
-
var import_fs9,
|
|
73469
|
+
var import_fs9, import_path9, recast, esprimaParser, typescriptParser, parseFile, transformFile, loadSnippets, loadTemplateSnippets;
|
|
73809
73470
|
var init_codemod = __esm({
|
|
73810
73471
|
"src/helpers/codemod.ts"() {
|
|
73811
73472
|
import_fs9 = require("fs");
|
|
73812
|
-
|
|
73473
|
+
import_path9 = __toESM(require("path"));
|
|
73813
73474
|
init_cli();
|
|
73814
73475
|
recast = __toESM(require_main3());
|
|
73815
73476
|
esprimaParser = __toESM(require_esprima3());
|
|
@@ -73817,10 +73478,10 @@ var init_codemod = __esm({
|
|
|
73817
73478
|
init_templates();
|
|
73818
73479
|
init_files();
|
|
73819
73480
|
parseFile = (filePath) => {
|
|
73820
|
-
const lang =
|
|
73481
|
+
const lang = import_path9.default.extname(filePath).slice(1);
|
|
73821
73482
|
const parser2 = lang === "js" ? esprimaParser : typescriptParser;
|
|
73822
73483
|
try {
|
|
73823
|
-
const fileContents = readFile(
|
|
73484
|
+
const fileContents = readFile(import_path9.default.resolve(filePath));
|
|
73824
73485
|
if (fileContents) {
|
|
73825
73486
|
return recast.parse(fileContents, { parser: parser2 }).program;
|
|
73826
73487
|
}
|
|
@@ -73837,7 +73498,7 @@ var init_codemod = __esm({
|
|
|
73837
73498
|
}
|
|
73838
73499
|
};
|
|
73839
73500
|
loadSnippets = (parentFolder) => {
|
|
73840
|
-
const snippetsPath = (0,
|
|
73501
|
+
const snippetsPath = (0, import_path9.join)(parentFolder, "snippets");
|
|
73841
73502
|
if (!(0, import_fs9.existsSync)(snippetsPath)) {
|
|
73842
73503
|
return {};
|
|
73843
73504
|
}
|
|
@@ -73845,12 +73506,12 @@ var init_codemod = __esm({
|
|
|
73845
73506
|
return {};
|
|
73846
73507
|
}
|
|
73847
73508
|
const files = (0, import_fs9.readdirSync)(snippetsPath);
|
|
73848
|
-
return files.filter((fileName) => (0, import_fs9.lstatSync)((0,
|
|
73509
|
+
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
73510
|
const [file, ext] = snippetPath.split(".");
|
|
73850
73511
|
const key = `${file}${ext === "js" ? "Js" : "Ts"}`;
|
|
73851
73512
|
return {
|
|
73852
73513
|
...acc,
|
|
73853
|
-
[key]: parseFile((0,
|
|
73514
|
+
[key]: parseFile((0, import_path9.join)(snippetsPath, snippetPath))?.body
|
|
73854
73515
|
};
|
|
73855
73516
|
}, {});
|
|
73856
73517
|
};
|
|
@@ -73860,12 +73521,425 @@ var init_codemod = __esm({
|
|
|
73860
73521
|
}
|
|
73861
73522
|
});
|
|
73862
73523
|
|
|
73524
|
+
// templates/astro/c3.ts
|
|
73525
|
+
var c3_exports2 = {};
|
|
73526
|
+
__export(c3_exports2, {
|
|
73527
|
+
default: () => c3_default2
|
|
73528
|
+
});
|
|
73529
|
+
var recast2, npx2, generate2, configure2, updateAstroConfig, updateEnvDeclaration, config2, c3_default2;
|
|
73530
|
+
var init_c32 = __esm({
|
|
73531
|
+
"templates/astro/c3.ts"() {
|
|
73532
|
+
init_cli();
|
|
73533
|
+
init_colors();
|
|
73534
|
+
init_codemod();
|
|
73535
|
+
init_command();
|
|
73536
|
+
init_files();
|
|
73537
|
+
init_packages();
|
|
73538
|
+
recast2 = __toESM(require_main3());
|
|
73539
|
+
({ npx: npx2 } = detectPackageManager());
|
|
73540
|
+
generate2 = async (ctx) => {
|
|
73541
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
73542
|
+
logRaw("");
|
|
73543
|
+
};
|
|
73544
|
+
configure2 = async (ctx) => {
|
|
73545
|
+
await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
|
|
73546
|
+
silent: true,
|
|
73547
|
+
startText: "Installing adapter",
|
|
73548
|
+
doneText: `${brandColor("installed")} ${dim(
|
|
73549
|
+
`via \`${npx2} astro add cloudflare\``
|
|
73550
|
+
)}`
|
|
73551
|
+
});
|
|
73552
|
+
updateAstroConfig();
|
|
73553
|
+
updateEnvDeclaration(ctx);
|
|
73554
|
+
};
|
|
73555
|
+
updateAstroConfig = () => {
|
|
73556
|
+
const filePath = "astro.config.mjs";
|
|
73557
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
73558
|
+
transformFile(filePath, {
|
|
73559
|
+
visitCallExpression: function(n2) {
|
|
73560
|
+
const callee = n2.node.callee;
|
|
73561
|
+
if (callee.name !== "cloudflare") {
|
|
73562
|
+
return this.traverse(n2);
|
|
73563
|
+
}
|
|
73564
|
+
const b2 = recast2.types.builders;
|
|
73565
|
+
n2.node.arguments = [
|
|
73566
|
+
b2.objectExpression([
|
|
73567
|
+
b2.objectProperty(
|
|
73568
|
+
b2.identifier("runtime"),
|
|
73569
|
+
b2.objectExpression([
|
|
73570
|
+
b2.objectProperty(b2.identifier("mode"), b2.stringLiteral("local"))
|
|
73571
|
+
])
|
|
73572
|
+
)
|
|
73573
|
+
])
|
|
73574
|
+
];
|
|
73575
|
+
return false;
|
|
73576
|
+
}
|
|
73577
|
+
});
|
|
73578
|
+
};
|
|
73579
|
+
updateEnvDeclaration = (ctx) => {
|
|
73580
|
+
if (!usesTypescript(ctx)) {
|
|
73581
|
+
return;
|
|
73582
|
+
}
|
|
73583
|
+
const filePath = "src/env.d.ts";
|
|
73584
|
+
updateStatus(`Adding type declarations in ${blue(filePath)}`);
|
|
73585
|
+
transformFile(filePath, {
|
|
73586
|
+
visitProgram: function(n2) {
|
|
73587
|
+
const snippets = loadTemplateSnippets(ctx);
|
|
73588
|
+
const patch = snippets.runtimeDeclarationTs;
|
|
73589
|
+
const b2 = recast2.types.builders;
|
|
73590
|
+
const comments = n2.get("comments").value;
|
|
73591
|
+
n2.node.comments = comments.map(
|
|
73592
|
+
(c2) => b2.commentLine(c2.value)
|
|
73593
|
+
);
|
|
73594
|
+
n2.get("body").push(...patch);
|
|
73595
|
+
return false;
|
|
73596
|
+
}
|
|
73597
|
+
});
|
|
73598
|
+
};
|
|
73599
|
+
config2 = {
|
|
73600
|
+
configVersion: 1,
|
|
73601
|
+
id: "astro",
|
|
73602
|
+
platform: "pages",
|
|
73603
|
+
displayName: "Astro",
|
|
73604
|
+
copyFiles: {
|
|
73605
|
+
path: "./templates"
|
|
73606
|
+
},
|
|
73607
|
+
devScript: "dev",
|
|
73608
|
+
deployScript: "deploy",
|
|
73609
|
+
previewScript: "preview",
|
|
73610
|
+
generate: generate2,
|
|
73611
|
+
configure: configure2,
|
|
73612
|
+
transformPackageJson: async (pkgJson, ctx) => ({
|
|
73613
|
+
scripts: {
|
|
73614
|
+
deploy: `astro build && wrangler pages deploy ./dist`,
|
|
73615
|
+
preview: `astro build && wrangler pages dev ./dist`,
|
|
73616
|
+
...usesTypescript(ctx) && { "build-cf-types": `wrangler types` }
|
|
73617
|
+
}
|
|
73618
|
+
}),
|
|
73619
|
+
testFlags: [
|
|
73620
|
+
"--skip-houston",
|
|
73621
|
+
"--no-install",
|
|
73622
|
+
"--no-git",
|
|
73623
|
+
"--template",
|
|
73624
|
+
"blog",
|
|
73625
|
+
"--typescript",
|
|
73626
|
+
"strict"
|
|
73627
|
+
]
|
|
73628
|
+
};
|
|
73629
|
+
c3_default2 = config2;
|
|
73630
|
+
}
|
|
73631
|
+
});
|
|
73632
|
+
|
|
73633
|
+
// templates/docusaurus/c3.ts
|
|
73634
|
+
var c3_exports3 = {};
|
|
73635
|
+
__export(c3_exports3, {
|
|
73636
|
+
default: () => c3_default3
|
|
73637
|
+
});
|
|
73638
|
+
var npm4, generate3, config3, c3_default3;
|
|
73639
|
+
var init_c33 = __esm({
|
|
73640
|
+
"templates/docusaurus/c3.ts"() {
|
|
73641
|
+
init_command();
|
|
73642
|
+
init_files();
|
|
73643
|
+
init_packages();
|
|
73644
|
+
({ npm: npm4 } = detectPackageManager());
|
|
73645
|
+
generate3 = async (ctx) => {
|
|
73646
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
73647
|
+
};
|
|
73648
|
+
config3 = {
|
|
73649
|
+
configVersion: 1,
|
|
73650
|
+
id: "docusaurus",
|
|
73651
|
+
platform: "pages",
|
|
73652
|
+
displayName: "Docusaurus",
|
|
73653
|
+
generate: generate3,
|
|
73654
|
+
transformPackageJson: async () => ({
|
|
73655
|
+
scripts: {
|
|
73656
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm4} run start`,
|
|
73657
|
+
"pages:deploy": `${npm4} run build && wrangler pages deploy ./build`
|
|
73658
|
+
}
|
|
73659
|
+
}),
|
|
73660
|
+
testFlags: [`--package-manager`, npm4]
|
|
73661
|
+
};
|
|
73662
|
+
c3_default3 = config3;
|
|
73663
|
+
}
|
|
73664
|
+
});
|
|
73665
|
+
|
|
73666
|
+
// templates/gatsby/c3.ts
|
|
73667
|
+
var c3_exports4 = {};
|
|
73668
|
+
__export(c3_exports4, {
|
|
73669
|
+
default: () => c3_default4
|
|
73670
|
+
});
|
|
73671
|
+
var npm5, generate4, config4, c3_default4;
|
|
73672
|
+
var init_c34 = __esm({
|
|
73673
|
+
"templates/gatsby/c3.ts"() {
|
|
73674
|
+
init_interactive();
|
|
73675
|
+
init_command();
|
|
73676
|
+
init_files();
|
|
73677
|
+
init_packages();
|
|
73678
|
+
({ npm: npm5 } = detectPackageManager());
|
|
73679
|
+
generate4 = async (ctx) => {
|
|
73680
|
+
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
73681
|
+
const useTemplate = await inputPrompt({
|
|
73682
|
+
type: "confirm",
|
|
73683
|
+
question: "Would you like to use a template?",
|
|
73684
|
+
label: "template",
|
|
73685
|
+
defaultValue: true
|
|
73686
|
+
});
|
|
73687
|
+
let templateUrl = "";
|
|
73688
|
+
if (useTemplate) {
|
|
73689
|
+
templateUrl = await inputPrompt({
|
|
73690
|
+
type: "text",
|
|
73691
|
+
question: `Please specify the url of the template you'd like to use`,
|
|
73692
|
+
label: "template",
|
|
73693
|
+
defaultValue: defaultTemplate
|
|
73694
|
+
});
|
|
73695
|
+
}
|
|
73696
|
+
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
73697
|
+
};
|
|
73698
|
+
config4 = {
|
|
73699
|
+
configVersion: 1,
|
|
73700
|
+
id: "gatsby",
|
|
73701
|
+
platform: "pages",
|
|
73702
|
+
displayName: "Gatsby",
|
|
73703
|
+
generate: generate4,
|
|
73704
|
+
transformPackageJson: async () => ({
|
|
73705
|
+
scripts: {
|
|
73706
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 8000 -- ${npm5} run develop`,
|
|
73707
|
+
"pages:deploy": `${npm5} run build && wrangler pages deploy ./public`
|
|
73708
|
+
}
|
|
73709
|
+
})
|
|
73710
|
+
};
|
|
73711
|
+
c3_default4 = config4;
|
|
73712
|
+
}
|
|
73713
|
+
});
|
|
73714
|
+
|
|
73715
|
+
// templates/hono/c3.ts
|
|
73716
|
+
var c3_exports5 = {};
|
|
73717
|
+
__export(c3_exports5, {
|
|
73718
|
+
default: () => c3_default5
|
|
73719
|
+
});
|
|
73720
|
+
var generate5, config5, c3_default5;
|
|
73721
|
+
var init_c35 = __esm({
|
|
73722
|
+
"templates/hono/c3.ts"() {
|
|
73723
|
+
init_cli();
|
|
73724
|
+
init_command();
|
|
73725
|
+
generate5 = async (ctx) => {
|
|
73726
|
+
await runFrameworkGenerator(ctx, [
|
|
73727
|
+
ctx.project.name,
|
|
73728
|
+
"--template",
|
|
73729
|
+
"cloudflare-workers"
|
|
73730
|
+
]);
|
|
73731
|
+
logRaw("");
|
|
73732
|
+
};
|
|
73733
|
+
config5 = {
|
|
73734
|
+
configVersion: 1,
|
|
73735
|
+
id: "hono",
|
|
73736
|
+
displayName: "Hono",
|
|
73737
|
+
platform: "workers",
|
|
73738
|
+
generate: generate5,
|
|
73739
|
+
devScript: "dev",
|
|
73740
|
+
deployScript: "deploy"
|
|
73741
|
+
};
|
|
73742
|
+
c3_default5 = config5;
|
|
73743
|
+
}
|
|
73744
|
+
});
|
|
73745
|
+
|
|
73746
|
+
// templates/next/c3.ts
|
|
73747
|
+
var c3_exports6 = {};
|
|
73748
|
+
__export(c3_exports6, {
|
|
73749
|
+
default: () => c3_default6,
|
|
73750
|
+
shouldInstallNextOnPagesEslintPlugin: () => shouldInstallNextOnPagesEslintPlugin,
|
|
73751
|
+
writeEslintrc: () => writeEslintrc
|
|
73752
|
+
});
|
|
73753
|
+
var import_path10, npm6, npx3, generate6, updateNextConfig, configure3, shouldInstallNextOnPagesEslintPlugin, writeEslintrc, addDevDependencies, c3_default6;
|
|
73754
|
+
var init_c36 = __esm({
|
|
73755
|
+
"templates/next/c3.ts"() {
|
|
73756
|
+
import_path10 = require("path");
|
|
73757
|
+
init_cli();
|
|
73758
|
+
init_args();
|
|
73759
|
+
init_colors();
|
|
73760
|
+
init_interactive();
|
|
73761
|
+
init_command();
|
|
73762
|
+
init_files();
|
|
73763
|
+
init_packages();
|
|
73764
|
+
init_templates();
|
|
73765
|
+
({ npm: npm6, npx: npx3 } = detectPackageManager());
|
|
73766
|
+
generate6 = async (ctx) => {
|
|
73767
|
+
const projectName = ctx.project.name;
|
|
73768
|
+
await runFrameworkGenerator(ctx, [projectName]);
|
|
73769
|
+
copyFile(
|
|
73770
|
+
(0, import_path10.join)(getTemplatePath(ctx), "wrangler.toml"),
|
|
73771
|
+
(0, import_path10.join)(ctx.project.path, "wrangler.toml")
|
|
73772
|
+
);
|
|
73773
|
+
updateStatus("Created wrangler.toml file");
|
|
73774
|
+
};
|
|
73775
|
+
updateNextConfig = () => {
|
|
73776
|
+
const s = spinner();
|
|
73777
|
+
const configFile = "next.config.mjs";
|
|
73778
|
+
s.start(`Updating \`${configFile}\``);
|
|
73779
|
+
const configContent = readFile(configFile);
|
|
73780
|
+
const updatedConfigFile = `import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
|
|
73781
|
+
|
|
73782
|
+
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
|
|
73783
|
+
// (when running the application with \`next dev\`), for more information see:
|
|
73784
|
+
// https://github.com/cloudflare/next-on-pages/blob/5712c57ea7/internal-packages/next-dev/README.md
|
|
73785
|
+
if (process.env.NODE_ENV === 'development') {
|
|
73786
|
+
await setupDevPlatform();
|
|
73787
|
+
}
|
|
73788
|
+
|
|
73789
|
+
`.replace(/\n\t*/g, "\n") + configContent;
|
|
73790
|
+
writeFile2(configFile, updatedConfigFile);
|
|
73791
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
73792
|
+
};
|
|
73793
|
+
configure3 = async (ctx) => {
|
|
73794
|
+
const projectPath = ctx.project.path;
|
|
73795
|
+
const path3 = probePaths([
|
|
73796
|
+
`${projectPath}/pages/api`,
|
|
73797
|
+
`${projectPath}/src/pages/api`,
|
|
73798
|
+
`${projectPath}/src/app/api`,
|
|
73799
|
+
`${projectPath}/app/api`,
|
|
73800
|
+
`${projectPath}/src/app`,
|
|
73801
|
+
`${projectPath}/app`
|
|
73802
|
+
]);
|
|
73803
|
+
if (!path3) {
|
|
73804
|
+
crash("Could not find the `/api` or `/app` directory");
|
|
73805
|
+
}
|
|
73806
|
+
const usesTs = usesTypescript(ctx);
|
|
73807
|
+
if (usesTs) {
|
|
73808
|
+
copyFile(
|
|
73809
|
+
(0, import_path10.join)(getTemplatePath(ctx), "env.d.ts"),
|
|
73810
|
+
(0, import_path10.join)(projectPath, "env.d.ts")
|
|
73811
|
+
);
|
|
73812
|
+
updateStatus("Created an env.d.ts file");
|
|
73813
|
+
}
|
|
73814
|
+
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
73815
|
+
if (installEslintPlugin) {
|
|
73816
|
+
await writeEslintrc(ctx);
|
|
73817
|
+
}
|
|
73818
|
+
updateNextConfig();
|
|
73819
|
+
copyFile(
|
|
73820
|
+
(0, import_path10.join)(getTemplatePath(ctx), "README.md"),
|
|
73821
|
+
(0, import_path10.join)(projectPath, "README.md")
|
|
73822
|
+
);
|
|
73823
|
+
updateStatus("Updated the README file");
|
|
73824
|
+
await addDevDependencies(installEslintPlugin);
|
|
73825
|
+
};
|
|
73826
|
+
shouldInstallNextOnPagesEslintPlugin = async (ctx) => {
|
|
73827
|
+
const eslintUsage = usesEslint(ctx);
|
|
73828
|
+
if (!eslintUsage.used)
|
|
73829
|
+
return false;
|
|
73830
|
+
if (eslintUsage.configType !== ".eslintrc.json") {
|
|
73831
|
+
warn(
|
|
73832
|
+
`Expected .eslintrc.json from Next.js scaffolding but found ${eslintUsage.configType} instead`
|
|
73833
|
+
);
|
|
73834
|
+
return false;
|
|
73835
|
+
}
|
|
73836
|
+
return await processArgument(ctx.args, "eslint-plugin", {
|
|
73837
|
+
type: "confirm",
|
|
73838
|
+
question: "Do you want to use the next-on-pages eslint-plugin?",
|
|
73839
|
+
label: "eslint-plugin",
|
|
73840
|
+
defaultValue: true
|
|
73841
|
+
});
|
|
73842
|
+
};
|
|
73843
|
+
writeEslintrc = async (ctx) => {
|
|
73844
|
+
const eslintConfig = readJSON(`${ctx.project.path}/.eslintrc.json`);
|
|
73845
|
+
eslintConfig.plugins ??= [];
|
|
73846
|
+
eslintConfig.plugins.push("eslint-plugin-next-on-pages");
|
|
73847
|
+
if (typeof eslintConfig.extends === "string") {
|
|
73848
|
+
eslintConfig.extends = [eslintConfig.extends];
|
|
73849
|
+
}
|
|
73850
|
+
eslintConfig.extends ??= [];
|
|
73851
|
+
eslintConfig.extends.push("plugin:eslint-plugin-next-on-pages/recommended");
|
|
73852
|
+
writeJSON(`${ctx.project.path}/.eslintrc.json`, eslintConfig);
|
|
73853
|
+
};
|
|
73854
|
+
addDevDependencies = async (installEslintPlugin) => {
|
|
73855
|
+
const packages = [
|
|
73856
|
+
"@cloudflare/next-on-pages@1",
|
|
73857
|
+
"@cloudflare/workers-types",
|
|
73858
|
+
"vercel",
|
|
73859
|
+
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
73860
|
+
];
|
|
73861
|
+
await installPackages(packages, {
|
|
73862
|
+
dev: true,
|
|
73863
|
+
startText: "Adding the Cloudflare Pages adapter",
|
|
73864
|
+
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
73865
|
+
});
|
|
73866
|
+
};
|
|
73867
|
+
c3_default6 = {
|
|
73868
|
+
configVersion: 1,
|
|
73869
|
+
id: "next",
|
|
73870
|
+
platform: "pages",
|
|
73871
|
+
displayName: "Next",
|
|
73872
|
+
devScript: "dev",
|
|
73873
|
+
previewScript: "preview",
|
|
73874
|
+
deployScript: "deploy",
|
|
73875
|
+
generate: generate6,
|
|
73876
|
+
configure: configure3,
|
|
73877
|
+
copyFiles: {
|
|
73878
|
+
async selectVariant(ctx) {
|
|
73879
|
+
const isApp = probePaths([
|
|
73880
|
+
`${ctx.project.path}/src/app`,
|
|
73881
|
+
`${ctx.project.path}/app`
|
|
73882
|
+
]);
|
|
73883
|
+
const isTypescript = usesTypescript(ctx);
|
|
73884
|
+
const dir = isApp ? "app" : "pages";
|
|
73885
|
+
return `${dir}/${isTypescript ? "ts" : "js"}`;
|
|
73886
|
+
},
|
|
73887
|
+
destinationDir(ctx) {
|
|
73888
|
+
const srcPath = probePaths([`${ctx.project.path}/src`]);
|
|
73889
|
+
return srcPath ? "./src" : "./";
|
|
73890
|
+
},
|
|
73891
|
+
variants: {
|
|
73892
|
+
"app/ts": {
|
|
73893
|
+
path: "./app/ts"
|
|
73894
|
+
},
|
|
73895
|
+
"app/js": {
|
|
73896
|
+
path: "./app/js"
|
|
73897
|
+
},
|
|
73898
|
+
"pages/ts": {
|
|
73899
|
+
path: "./pages/ts"
|
|
73900
|
+
},
|
|
73901
|
+
"pages/js": {
|
|
73902
|
+
path: "./pages/js"
|
|
73903
|
+
}
|
|
73904
|
+
}
|
|
73905
|
+
},
|
|
73906
|
+
transformPackageJson: async () => {
|
|
73907
|
+
const isNpm = npm6 === "npm";
|
|
73908
|
+
const isBun = npm6 === "bun";
|
|
73909
|
+
const isNpmOrBun = isNpm || isBun;
|
|
73910
|
+
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
73911
|
+
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
73912
|
+
const pmCommand = isNpmOrBun ? npx3 : npm6;
|
|
73913
|
+
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
73914
|
+
return {
|
|
73915
|
+
scripts: {
|
|
73916
|
+
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
73917
|
+
preview: `${pagesBuildRunCommand} && wrangler pages dev .vercel/output/static`,
|
|
73918
|
+
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static`
|
|
73919
|
+
}
|
|
73920
|
+
};
|
|
73921
|
+
},
|
|
73922
|
+
testFlags: [
|
|
73923
|
+
"--typescript",
|
|
73924
|
+
"--no-install",
|
|
73925
|
+
"--eslint",
|
|
73926
|
+
"--tailwind",
|
|
73927
|
+
"--src-dir",
|
|
73928
|
+
"--app",
|
|
73929
|
+
"--import-alias",
|
|
73930
|
+
"@/*"
|
|
73931
|
+
],
|
|
73932
|
+
compatibilityFlags: ["nodejs_compat"]
|
|
73933
|
+
};
|
|
73934
|
+
}
|
|
73935
|
+
});
|
|
73936
|
+
|
|
73863
73937
|
// templates/nuxt/c3.ts
|
|
73864
73938
|
var c3_exports7 = {};
|
|
73865
73939
|
__export(c3_exports7, {
|
|
73866
73940
|
default: () => c3_default7
|
|
73867
73941
|
});
|
|
73868
|
-
var
|
|
73942
|
+
var recast3, npm7, generate7, configure4, updateNuxtConfig, config6, c3_default7;
|
|
73869
73943
|
var init_c37 = __esm({
|
|
73870
73944
|
"templates/nuxt/c3.ts"() {
|
|
73871
73945
|
init_cli();
|
|
@@ -73875,7 +73949,7 @@ var init_c37 = __esm({
|
|
|
73875
73949
|
init_command();
|
|
73876
73950
|
init_files();
|
|
73877
73951
|
init_packages();
|
|
73878
|
-
|
|
73952
|
+
recast3 = __toESM(require_main3());
|
|
73879
73953
|
({ npm: npm7 } = detectPackageManager());
|
|
73880
73954
|
generate7 = async (ctx) => {
|
|
73881
73955
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
@@ -73901,7 +73975,7 @@ var init_c37 = __esm({
|
|
|
73901
73975
|
const s = spinner();
|
|
73902
73976
|
const configFile = "nuxt.config.ts";
|
|
73903
73977
|
s.start(`Updating \`${configFile}\``);
|
|
73904
|
-
const b2 =
|
|
73978
|
+
const b2 = recast3.types.builders;
|
|
73905
73979
|
const presetDef = b2.objectProperty(
|
|
73906
73980
|
b2.identifier("nitro"),
|
|
73907
73981
|
b2.objectExpression([
|
|
@@ -73932,10 +74006,10 @@ var init_c37 = __esm({
|
|
|
73932
74006
|
configVersion: 1,
|
|
73933
74007
|
id: "nuxt",
|
|
73934
74008
|
platform: "pages",
|
|
74009
|
+
displayName: "Nuxt",
|
|
73935
74010
|
copyFiles: {
|
|
73936
74011
|
path: "./templates"
|
|
73937
74012
|
},
|
|
73938
|
-
displayName: "Nuxt",
|
|
73939
74013
|
devScript: "dev",
|
|
73940
74014
|
deployScript: "deploy",
|
|
73941
74015
|
generate: generate7,
|
|
@@ -73957,7 +74031,7 @@ var c3_exports8 = {};
|
|
|
73957
74031
|
__export(c3_exports8, {
|
|
73958
74032
|
default: () => c3_default8
|
|
73959
74033
|
});
|
|
73960
|
-
var
|
|
74034
|
+
var recast4, npm8, npx4, generate8, configure5, addBindingsProxy, populateCloudflareEnv, config7, c3_default8;
|
|
73961
74035
|
var init_c38 = __esm({
|
|
73962
74036
|
"templates/qwik/c3.ts"() {
|
|
73963
74037
|
init_cli();
|
|
@@ -73967,7 +74041,7 @@ var init_c38 = __esm({
|
|
|
73967
74041
|
init_command();
|
|
73968
74042
|
init_files();
|
|
73969
74043
|
init_packages();
|
|
73970
|
-
|
|
74044
|
+
recast4 = __toESM(require_main3());
|
|
73971
74045
|
init_common2();
|
|
73972
74046
|
({ npm: npm8, npx: npx4 } = detectPackageManager());
|
|
73973
74047
|
generate8 = async (ctx) => {
|
|
@@ -73987,7 +74061,7 @@ var init_c38 = __esm({
|
|
|
73987
74061
|
const s = spinner();
|
|
73988
74062
|
s.start("Updating `vite.config.ts`");
|
|
73989
74063
|
const snippets = loadTemplateSnippets(ctx);
|
|
73990
|
-
const b2 =
|
|
74064
|
+
const b2 = recast4.types.builders;
|
|
73991
74065
|
transformFile("vite.config.ts", {
|
|
73992
74066
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
73993
74067
|
visitProgram: function(n2) {
|
|
@@ -74029,7 +74103,7 @@ var init_c38 = __esm({
|
|
|
74029
74103
|
s.start(`Updating \`${entrypointPath}\``);
|
|
74030
74104
|
transformFile(entrypointPath, {
|
|
74031
74105
|
visitTSInterfaceDeclaration: function(n2) {
|
|
74032
|
-
const b2 =
|
|
74106
|
+
const b2 = recast4.types.builders;
|
|
74033
74107
|
const id = n2.node.id;
|
|
74034
74108
|
if (id.name !== "QwikCityPlatform") {
|
|
74035
74109
|
this.traverse(n2);
|
|
@@ -74113,10 +74187,13 @@ var c3_exports10 = {};
|
|
|
74113
74187
|
__export(c3_exports10, {
|
|
74114
74188
|
default: () => c3_default10
|
|
74115
74189
|
});
|
|
74116
|
-
var npm10, generate10, config9, c3_default10;
|
|
74190
|
+
var npm10, generate10, configure6, config9, c3_default10;
|
|
74117
74191
|
var init_c310 = __esm({
|
|
74118
74192
|
"templates/remix/c3.ts"() {
|
|
74119
74193
|
init_cli();
|
|
74194
|
+
init_colors();
|
|
74195
|
+
init_interactive();
|
|
74196
|
+
init_codemod();
|
|
74120
74197
|
init_command();
|
|
74121
74198
|
init_packages();
|
|
74122
74199
|
({ npm: npm10 } = detectPackageManager());
|
|
@@ -74124,22 +74201,45 @@ var init_c310 = __esm({
|
|
|
74124
74201
|
await runFrameworkGenerator(ctx, [
|
|
74125
74202
|
ctx.project.name,
|
|
74126
74203
|
"--template",
|
|
74127
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare
|
|
74204
|
+
"https://github.com/remix-run/remix/tree/main/templates/vite-cloudflare"
|
|
74128
74205
|
]);
|
|
74129
74206
|
logRaw("");
|
|
74130
74207
|
};
|
|
74208
|
+
configure6 = async () => {
|
|
74209
|
+
const typeDefsPath = "load-context.ts";
|
|
74210
|
+
const s = spinner();
|
|
74211
|
+
s.start(`Updating \`${typeDefsPath}\``);
|
|
74212
|
+
transformFile(typeDefsPath, {
|
|
74213
|
+
visitTSInterfaceDeclaration(n2) {
|
|
74214
|
+
if (n2.node.id.type === "Identifier" && n2.node.id.name !== "Env") {
|
|
74215
|
+
return this.traverse(n2);
|
|
74216
|
+
}
|
|
74217
|
+
n2.replace();
|
|
74218
|
+
return false;
|
|
74219
|
+
}
|
|
74220
|
+
});
|
|
74221
|
+
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
74222
|
+
};
|
|
74131
74223
|
config9 = {
|
|
74132
74224
|
configVersion: 1,
|
|
74133
74225
|
id: "remix",
|
|
74134
|
-
displayName: "Remix",
|
|
74135
74226
|
platform: "pages",
|
|
74227
|
+
displayName: "Remix",
|
|
74228
|
+
copyFiles: {
|
|
74229
|
+
path: "./templates"
|
|
74230
|
+
},
|
|
74136
74231
|
generate: generate10,
|
|
74232
|
+
configure: configure6,
|
|
74137
74233
|
transformPackageJson: async () => ({
|
|
74138
74234
|
scripts: {
|
|
74139
|
-
|
|
74235
|
+
deploy: `${npm10} run build && wrangler pages deploy ./build/client`,
|
|
74236
|
+
preview: `${npm10} run build && wrangler pages dev ./build/client`,
|
|
74237
|
+
"build-cf-types": `wrangler types`
|
|
74140
74238
|
}
|
|
74141
74239
|
}),
|
|
74142
74240
|
devScript: "dev",
|
|
74241
|
+
deployScript: "deploy",
|
|
74242
|
+
previewScript: "preview",
|
|
74143
74243
|
testFlags: ["--typescript", "--no-install", "--no-git-init"]
|
|
74144
74244
|
};
|
|
74145
74245
|
c3_default10 = config9;
|
|
@@ -74151,38 +74251,74 @@ var c3_exports11 = {};
|
|
|
74151
74251
|
__export(c3_exports11, {
|
|
74152
74252
|
default: () => c3_default11
|
|
74153
74253
|
});
|
|
74154
|
-
var npm11, generate11, config10, c3_default11;
|
|
74254
|
+
var recast5, npm11, generate11, configure7, config10, c3_default11;
|
|
74155
74255
|
var init_c311 = __esm({
|
|
74156
74256
|
"templates/solid/c3.ts"() {
|
|
74157
74257
|
init_cli();
|
|
74258
|
+
init_colors();
|
|
74259
|
+
init_codemod();
|
|
74158
74260
|
init_command();
|
|
74159
74261
|
init_files();
|
|
74160
74262
|
init_packages();
|
|
74263
|
+
recast5 = __toESM(require_main3());
|
|
74161
74264
|
({ npm: npm11 } = detectPackageManager());
|
|
74162
74265
|
generate11 = async (ctx) => {
|
|
74163
74266
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
74164
74267
|
logRaw("");
|
|
74165
74268
|
};
|
|
74269
|
+
configure7 = async (ctx) => {
|
|
74270
|
+
usesTypescript(ctx);
|
|
74271
|
+
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
74272
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
74273
|
+
transformFile(filePath, {
|
|
74274
|
+
visitCallExpression: function(n2) {
|
|
74275
|
+
const callee = n2.node.callee;
|
|
74276
|
+
if (callee.name !== "defineConfig") {
|
|
74277
|
+
return this.traverse(n2);
|
|
74278
|
+
}
|
|
74279
|
+
const b2 = recast5.types.builders;
|
|
74280
|
+
n2.node.arguments = [
|
|
74281
|
+
b2.objectExpression([
|
|
74282
|
+
b2.objectProperty(
|
|
74283
|
+
b2.identifier("server"),
|
|
74284
|
+
b2.objectExpression([
|
|
74285
|
+
b2.objectProperty(
|
|
74286
|
+
b2.identifier("preset"),
|
|
74287
|
+
b2.stringLiteral("cloudflare-pages")
|
|
74288
|
+
),
|
|
74289
|
+
b2.objectProperty(
|
|
74290
|
+
b2.identifier("rollupConfig"),
|
|
74291
|
+
b2.objectExpression([
|
|
74292
|
+
b2.objectProperty(
|
|
74293
|
+
b2.identifier("external"),
|
|
74294
|
+
b2.arrayExpression([b2.stringLiteral("node:async_hooks")])
|
|
74295
|
+
)
|
|
74296
|
+
])
|
|
74297
|
+
)
|
|
74298
|
+
])
|
|
74299
|
+
)
|
|
74300
|
+
])
|
|
74301
|
+
];
|
|
74302
|
+
return false;
|
|
74303
|
+
}
|
|
74304
|
+
});
|
|
74305
|
+
};
|
|
74166
74306
|
config10 = {
|
|
74167
74307
|
configVersion: 1,
|
|
74168
74308
|
id: "solid",
|
|
74169
74309
|
displayName: "Solid",
|
|
74170
74310
|
platform: "pages",
|
|
74171
|
-
copyFiles: {
|
|
74172
|
-
variants: {
|
|
74173
|
-
js: { path: "./js" },
|
|
74174
|
-
ts: { path: "./ts" }
|
|
74175
|
-
}
|
|
74176
|
-
},
|
|
74177
74311
|
generate: generate11,
|
|
74312
|
+
configure: configure7,
|
|
74178
74313
|
transformPackageJson: async () => ({
|
|
74179
74314
|
scripts: {
|
|
74180
|
-
|
|
74181
|
-
|
|
74315
|
+
preview: `${npm11} run build && npx wrangler pages dev dist ${await compatDateFlag()} --compatibility-flag nodejs_compat`,
|
|
74316
|
+
deploy: `${npm11} run build && wrangler pages deploy ./dist`
|
|
74182
74317
|
}
|
|
74183
74318
|
}),
|
|
74184
74319
|
devScript: "dev",
|
|
74185
|
-
|
|
74320
|
+
deployScript: "deploy",
|
|
74321
|
+
previewScript: "preview",
|
|
74186
74322
|
compatibilityFlags: ["nodejs_compat"]
|
|
74187
74323
|
};
|
|
74188
74324
|
c3_default11 = config10;
|
|
@@ -74194,7 +74330,7 @@ var c3_exports12 = {};
|
|
|
74194
74330
|
__export(c3_exports12, {
|
|
74195
74331
|
default: () => c3_default12
|
|
74196
74332
|
});
|
|
74197
|
-
var import_node_os,
|
|
74333
|
+
var import_node_os, recast6, npm12, generate12, configure8, updateSvelteConfig, updateTypeDefinitions, config11, c3_default12;
|
|
74198
74334
|
var init_c312 = __esm({
|
|
74199
74335
|
"templates/svelte/c3.ts"() {
|
|
74200
74336
|
import_node_os = require("node:os");
|
|
@@ -74204,13 +74340,13 @@ var init_c312 = __esm({
|
|
|
74204
74340
|
init_command();
|
|
74205
74341
|
init_files();
|
|
74206
74342
|
init_packages();
|
|
74207
|
-
|
|
74343
|
+
recast6 = __toESM(require_main3());
|
|
74208
74344
|
({ npm: npm12 } = detectPackageManager());
|
|
74209
74345
|
generate12 = async (ctx) => {
|
|
74210
74346
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
74211
74347
|
logRaw("");
|
|
74212
74348
|
};
|
|
74213
|
-
|
|
74349
|
+
configure8 = async (ctx) => {
|
|
74214
74350
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
74215
74351
|
await installPackages([pkg], {
|
|
74216
74352
|
dev: true,
|
|
@@ -74237,7 +74373,7 @@ var init_c312 = __esm({
|
|
|
74237
74373
|
return;
|
|
74238
74374
|
}
|
|
74239
74375
|
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
74240
|
-
const b2 =
|
|
74376
|
+
const b2 = recast6.types.builders;
|
|
74241
74377
|
transformFile("src/app.d.ts", {
|
|
74242
74378
|
visitTSModuleDeclaration(n2) {
|
|
74243
74379
|
if (n2.value.id.name === "App" && n2.node.body) {
|
|
@@ -74281,7 +74417,7 @@ var init_c312 = __esm({
|
|
|
74281
74417
|
}
|
|
74282
74418
|
},
|
|
74283
74419
|
generate: generate12,
|
|
74284
|
-
configure:
|
|
74420
|
+
configure: configure8,
|
|
74285
74421
|
transformPackageJson: async (original, ctx) => {
|
|
74286
74422
|
let scripts = {
|
|
74287
74423
|
preview: `${npm12} run build && wrangler pages dev .svelte-kit/cloudflare`,
|
|
@@ -74609,7 +74745,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
74609
74745
|
}
|
|
74610
74746
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
74611
74747
|
}
|
|
74612
|
-
var import_fs10, import_promises2, import_os2, import_path12, import_deepmerge, import_degit, defaultSelectVariant, getFrameworkMap, getTemplateMap, selectTemplate, selectFramework, shouldUseTs, processRemoteTemplate, validateTemplate, validateTemplateSrcDirectory, inferTemplateConfig, inferCopyFilesDefinition, downloadRemoteTemplate, updatePackageName, updatePackageScripts, getTemplatePath, isVariantInfo, getCopyFilesDestinationDir;
|
|
74748
|
+
var import_fs10, import_promises2, import_os2, import_path12, import_deepmerge, import_degit, defaultSelectVariant, getFrameworkMap, getTemplateMap, selectTemplate, selectFramework, shouldUseTs, processRemoteTemplate, validateTemplate, validateTemplateSrcDirectory, inferTemplateConfig, inferCopyFilesDefinition, downloadRemoteTemplate, updatePackageName, updatePackageScripts, getTemplatePath, isVariantInfo, getCopyFilesDestinationDir, addWranglerToGitIgnore;
|
|
74613
74749
|
var init_templates = __esm({
|
|
74614
74750
|
"src/templates.ts"() {
|
|
74615
74751
|
import_fs10 = require("fs");
|
|
@@ -74867,6 +75003,45 @@ var init_templates = __esm({
|
|
|
74867
75003
|
}
|
|
74868
75004
|
return copyFiles.destinationDir(ctx);
|
|
74869
75005
|
};
|
|
75006
|
+
addWranglerToGitIgnore = (ctx) => {
|
|
75007
|
+
const gitIgnorePath = `${ctx.project.path}/.gitignore`;
|
|
75008
|
+
const gitIgnorePreExisted = (0, import_fs10.existsSync)(gitIgnorePath);
|
|
75009
|
+
const gitDirExists = directoryExists(`${ctx.project.path}/.git`);
|
|
75010
|
+
if (!gitIgnorePreExisted && !gitDirExists) {
|
|
75011
|
+
return;
|
|
75012
|
+
}
|
|
75013
|
+
if (!gitIgnorePreExisted) {
|
|
75014
|
+
writeFile2(gitIgnorePath, "");
|
|
75015
|
+
}
|
|
75016
|
+
const existingGitIgnoreContent = readFile(gitIgnorePath);
|
|
75017
|
+
const wranglerGitIgnoreFiles = [".wrangler", ".dev.vars"];
|
|
75018
|
+
const wranglerGitIgnoreFilesToAdd = wranglerGitIgnoreFiles.filter(
|
|
75019
|
+
(file) => !existingGitIgnoreContent.match(
|
|
75020
|
+
new RegExp(`
|
|
75021
|
+
${file}${file === ".wrangler" ? "/?" : ""}\\s+(#'*)?`)
|
|
75022
|
+
)
|
|
75023
|
+
);
|
|
75024
|
+
if (wranglerGitIgnoreFilesToAdd.length === 0) {
|
|
75025
|
+
return;
|
|
75026
|
+
}
|
|
75027
|
+
const s = spinner();
|
|
75028
|
+
s.start("Adding Wrangler files to the .gitignore file");
|
|
75029
|
+
const linesToAppend = [
|
|
75030
|
+
"",
|
|
75031
|
+
...!existingGitIgnoreContent.match(/\n\s*$/) ? [""] : []
|
|
75032
|
+
];
|
|
75033
|
+
if (wranglerGitIgnoreFilesToAdd.length === wranglerGitIgnoreFiles.length) {
|
|
75034
|
+
linesToAppend.push("# wrangler files");
|
|
75035
|
+
}
|
|
75036
|
+
wranglerGitIgnoreFilesToAdd.forEach((line) => linesToAppend.push(line));
|
|
75037
|
+
linesToAppend.push("");
|
|
75038
|
+
appendFile(gitIgnorePath, linesToAppend.join("\n"));
|
|
75039
|
+
s.stop(
|
|
75040
|
+
`${brandColor(gitIgnorePreExisted ? "updated" : "created")} ${dim(
|
|
75041
|
+
".gitignore file"
|
|
75042
|
+
)}`
|
|
75043
|
+
);
|
|
75044
|
+
};
|
|
74870
75045
|
}
|
|
74871
75046
|
});
|
|
74872
75047
|
|
|
@@ -79978,7 +80153,7 @@ var runCli = async (args) => {
|
|
|
79978
80153
|
};
|
|
79979
80154
|
var runTemplate = async (ctx) => {
|
|
79980
80155
|
await create(ctx);
|
|
79981
|
-
await
|
|
80156
|
+
await configure9(ctx);
|
|
79982
80157
|
await deploy(ctx);
|
|
79983
80158
|
await printSummary(ctx);
|
|
79984
80159
|
};
|
|
@@ -79994,7 +80169,7 @@ var create = async (ctx) => {
|
|
|
79994
80169
|
await rectifyPmMismatch(ctx);
|
|
79995
80170
|
endSection(`Application created`);
|
|
79996
80171
|
};
|
|
79997
|
-
var
|
|
80172
|
+
var configure9 = async (ctx) => {
|
|
79998
80173
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
79999
80174
|
await installWrangler();
|
|
80000
80175
|
await installWorkersTypes(ctx);
|
|
@@ -80003,6 +80178,7 @@ var configure7 = async (ctx) => {
|
|
|
80003
80178
|
if (template.configure) {
|
|
80004
80179
|
await template.configure({ ...ctx });
|
|
80005
80180
|
}
|
|
80181
|
+
addWranglerToGitIgnore(ctx);
|
|
80006
80182
|
await updatePackageScripts(ctx);
|
|
80007
80183
|
await offerGit(ctx);
|
|
80008
80184
|
await gitCommit(ctx);
|