create-cloudflare 0.0.0-96b79b3f → 0.0.0-96e4e165
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 +899 -648
- package/package.json +6 -4
- 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 +38 -5
- package/templates/nuxt/templates/env.d.ts +14 -0
- package/templates/nuxt/templates/worker-configuration.d.ts +3 -0
- package/templates/qwik/c3.ts +73 -23
- package/templates/qwik/snippets/getPlatformProxy.ts +6 -0
- package/templates/qwik/templates/worker-configuration.d.ts +3 -0
- 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 +54 -12
- 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 = "0.0.0-
|
|
3817
|
+
version = "0.0.0-96e4e165";
|
|
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.3",
|
|
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-solid": "0.
|
|
24227
|
-
"create-svelte": "6.0.
|
|
24226
|
+
"create-remix": "2.8.0",
|
|
24227
|
+
"create-solid": "0.5.3",
|
|
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"
|
|
@@ -24296,7 +24297,8 @@ var init_packages = __esm({
|
|
|
24296
24297
|
import_which_pm_runs = __toESM(require_which_pm_runs());
|
|
24297
24298
|
init_package();
|
|
24298
24299
|
detectPackageManager = () => {
|
|
24299
|
-
|
|
24300
|
+
const pmInfo = (0, import_which_pm_runs.default)();
|
|
24301
|
+
let { name: name2, version: version3 } = pmInfo ?? { name: "npm", version: "0.0.0" };
|
|
24300
24302
|
if (process.env.TEST_PM) {
|
|
24301
24303
|
switch (process.env.TEST_PM) {
|
|
24302
24304
|
case "pnpm":
|
|
@@ -25810,7 +25812,7 @@ var init_poll = __esm({
|
|
|
25810
25812
|
var version2;
|
|
25811
25813
|
var init_package3 = __esm({
|
|
25812
25814
|
"../wrangler/package.json"() {
|
|
25813
|
-
version2 = "3.
|
|
25815
|
+
version2 = "3.32.0";
|
|
25814
25816
|
}
|
|
25815
25817
|
});
|
|
25816
25818
|
|
|
@@ -27871,7 +27873,7 @@ var require_toml = __commonJS({
|
|
|
27871
27873
|
});
|
|
27872
27874
|
|
|
27873
27875
|
// src/helpers/files.ts
|
|
27874
|
-
var import_fs5, import_path5, import_toml, copyFile, writeFile2, readFile, readJSON, writeJSON, probePaths, usesTypescript, eslintRcExts, usesEslint, compatDateFlag;
|
|
27876
|
+
var import_fs5, import_path5, import_toml, copyFile, writeFile2, appendFile, readFile, directoryExists, readJSON, writeJSON, probePaths, usesTypescript, eslintRcExts, usesEslint, compatDateFlag;
|
|
27875
27877
|
var init_files = __esm({
|
|
27876
27878
|
"src/helpers/files.ts"() {
|
|
27877
27879
|
import_fs5 = __toESM(require("fs"));
|
|
@@ -27893,6 +27895,13 @@ var init_files = __esm({
|
|
|
27893
27895
|
crash(error2);
|
|
27894
27896
|
}
|
|
27895
27897
|
};
|
|
27898
|
+
appendFile = (path3, content) => {
|
|
27899
|
+
try {
|
|
27900
|
+
import_fs5.default.appendFileSync(path3, content);
|
|
27901
|
+
} catch (error2) {
|
|
27902
|
+
crash(error2);
|
|
27903
|
+
}
|
|
27904
|
+
};
|
|
27896
27905
|
readFile = (path3) => {
|
|
27897
27906
|
try {
|
|
27898
27907
|
return import_fs5.default.readFileSync(path3, "utf-8");
|
|
@@ -27900,6 +27909,17 @@ var init_files = __esm({
|
|
|
27900
27909
|
return crash(error2);
|
|
27901
27910
|
}
|
|
27902
27911
|
};
|
|
27912
|
+
directoryExists = (path3) => {
|
|
27913
|
+
try {
|
|
27914
|
+
const stat = (0, import_fs5.statSync)(path3);
|
|
27915
|
+
return stat.isDirectory();
|
|
27916
|
+
} catch (error2) {
|
|
27917
|
+
if (error2.code === "ENOENT") {
|
|
27918
|
+
return false;
|
|
27919
|
+
}
|
|
27920
|
+
return crash(error2);
|
|
27921
|
+
}
|
|
27922
|
+
};
|
|
27903
27923
|
readJSON = (path3) => {
|
|
27904
27924
|
const contents = readFile(path3);
|
|
27905
27925
|
return contents ? JSON.parse(contents) : contents;
|
|
@@ -32655,7 +32675,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
32655
32675
|
}
|
|
32656
32676
|
}
|
|
32657
32677
|
};
|
|
32658
|
-
var
|
|
32678
|
+
var types6 = createCommonjsModule(function(module3, exports3) {
|
|
32659
32679
|
exports3.name = /* @__PURE__ */ new Map([
|
|
32660
32680
|
["0", "File"],
|
|
32661
32681
|
// same as File
|
|
@@ -32909,14 +32929,14 @@ var require_index_688c5d50 = __commonJS({
|
|
|
32909
32929
|
}
|
|
32910
32930
|
}
|
|
32911
32931
|
get type() {
|
|
32912
|
-
return
|
|
32932
|
+
return types6.name.get(this[TYPE]) || this[TYPE];
|
|
32913
32933
|
}
|
|
32914
32934
|
get typeKey() {
|
|
32915
32935
|
return this[TYPE];
|
|
32916
32936
|
}
|
|
32917
32937
|
set type(type) {
|
|
32918
|
-
if (
|
|
32919
|
-
this[TYPE] =
|
|
32938
|
+
if (types6.code.has(type))
|
|
32939
|
+
this[TYPE] = types6.code.get(type);
|
|
32920
32940
|
else
|
|
32921
32941
|
this[TYPE] = type;
|
|
32922
32942
|
}
|
|
@@ -35098,7 +35118,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
35098
35118
|
} : (path4, uid, gid) => lchownSync(path4, uid, gid);
|
|
35099
35119
|
var nodeVersion2 = process.version;
|
|
35100
35120
|
var readdir = (path4, options, cb) => fs__default["default"].readdir(path4, options, cb);
|
|
35101
|
-
var
|
|
35121
|
+
var readdirSync5 = (path4, options) => fs__default["default"].readdirSync(path4, options);
|
|
35102
35122
|
if (/^v4\./.test(nodeVersion2))
|
|
35103
35123
|
readdir = (path4, options, cb) => fs__default["default"].readdir(path4, cb);
|
|
35104
35124
|
var chown = (cpath, uid, gid, cb) => {
|
|
@@ -35169,7 +35189,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
35169
35189
|
var chownrSync = (p2, uid, gid) => {
|
|
35170
35190
|
let children;
|
|
35171
35191
|
try {
|
|
35172
|
-
children =
|
|
35192
|
+
children = readdirSync5(p2, { withFileTypes: true });
|
|
35173
35193
|
} catch (er) {
|
|
35174
35194
|
if (er.code === "ENOENT")
|
|
35175
35195
|
return;
|
|
@@ -35346,8 +35366,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
35346
35366
|
var pathReservations = () => {
|
|
35347
35367
|
const queues = /* @__PURE__ */ new Map();
|
|
35348
35368
|
const reservations = /* @__PURE__ */ new Map();
|
|
35349
|
-
const { join:
|
|
35350
|
-
const getDirs = (path4) =>
|
|
35369
|
+
const { join: join7 } = path__default["default"];
|
|
35370
|
+
const getDirs = (path4) => join7(path4).split(/[\\/]/).slice(0, -1).reduce((set, path5) => set.length ? set.concat(join7(set[set.length - 1], path5)) : [path5], []);
|
|
35351
35371
|
const running = /* @__PURE__ */ new Set();
|
|
35352
35372
|
const getQueues = (fn) => {
|
|
35353
35373
|
const res = reservations.get(fn);
|
|
@@ -36028,7 +36048,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
36028
36048
|
exports3.WriteEntry = writeEntry;
|
|
36029
36049
|
exports3.Header = header;
|
|
36030
36050
|
exports3.Pax = pax;
|
|
36031
|
-
exports3.types =
|
|
36051
|
+
exports3.types = types6;
|
|
36032
36052
|
});
|
|
36033
36053
|
var colorName = {
|
|
36034
36054
|
"aliceblue": [240, 248, 255],
|
|
@@ -37986,8 +38006,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
37986
38006
|
}
|
|
37987
38007
|
var fs$appendFile = fs3.appendFile;
|
|
37988
38008
|
if (fs$appendFile)
|
|
37989
|
-
fs3.appendFile =
|
|
37990
|
-
function
|
|
38009
|
+
fs3.appendFile = appendFile2;
|
|
38010
|
+
function appendFile2(path4, data, options, cb) {
|
|
37991
38011
|
if (typeof options === "function")
|
|
37992
38012
|
cb = options, options = null;
|
|
37993
38013
|
return go$appendFile(path4, data, options, cb);
|
|
@@ -42394,364 +42414,6 @@ var init_c3 = __esm({
|
|
|
42394
42414
|
}
|
|
42395
42415
|
});
|
|
42396
42416
|
|
|
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
42417
|
// ../../node_modules/.pnpm/tslib@2.5.3/node_modules/tslib/tslib.es6.mjs
|
|
42756
42418
|
var tslib_es6_exports = {};
|
|
42757
42419
|
__export(tslib_es6_exports, {
|
|
@@ -43342,9 +43004,9 @@ var require_types = __commonJS({
|
|
|
43342
43004
|
/** @class */
|
|
43343
43005
|
function(_super) {
|
|
43344
43006
|
(0, tslib_1.__extends)(OrType2, _super);
|
|
43345
|
-
function OrType2(
|
|
43007
|
+
function OrType2(types6) {
|
|
43346
43008
|
var _this = _super.call(this) || this;
|
|
43347
|
-
_this.types =
|
|
43009
|
+
_this.types = types6;
|
|
43348
43010
|
_this.kind = "OrType";
|
|
43349
43011
|
return _this;
|
|
43350
43012
|
}
|
|
@@ -43489,11 +43151,11 @@ var require_types = __commonJS({
|
|
|
43489
43151
|
function typesPlugin(_fork) {
|
|
43490
43152
|
var Type = {
|
|
43491
43153
|
or: function() {
|
|
43492
|
-
var
|
|
43154
|
+
var types6 = [];
|
|
43493
43155
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
43494
|
-
|
|
43156
|
+
types6[_i] = arguments[_i];
|
|
43495
43157
|
}
|
|
43496
|
-
return new OrType(
|
|
43158
|
+
return new OrType(types6.map(function(type) {
|
|
43497
43159
|
return Type.from(type);
|
|
43498
43160
|
}));
|
|
43499
43161
|
},
|
|
@@ -43942,9 +43604,9 @@ var require_path = __commonJS({
|
|
|
43942
43604
|
var Op = Object.prototype;
|
|
43943
43605
|
var hasOwn = Op.hasOwnProperty;
|
|
43944
43606
|
function pathPlugin(fork) {
|
|
43945
|
-
var
|
|
43946
|
-
var isArray =
|
|
43947
|
-
var isNumber =
|
|
43607
|
+
var types6 = fork.use(types_1.default);
|
|
43608
|
+
var isArray = types6.builtInTypes.array;
|
|
43609
|
+
var isNumber = types6.builtInTypes.number;
|
|
43948
43610
|
var Path = function Path2(value, parentPath, name2) {
|
|
43949
43611
|
if (!(this instanceof Path2)) {
|
|
43950
43612
|
throw new Error("Path constructor cannot be invoked without 'new'");
|
|
@@ -44244,13 +43906,13 @@ var require_scope = __commonJS({
|
|
|
44244
43906
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
44245
43907
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
44246
43908
|
function scopePlugin(fork) {
|
|
44247
|
-
var
|
|
44248
|
-
var Type =
|
|
44249
|
-
var namedTypes =
|
|
43909
|
+
var types6 = fork.use(types_1.default);
|
|
43910
|
+
var Type = types6.Type;
|
|
43911
|
+
var namedTypes = types6.namedTypes;
|
|
44250
43912
|
var Node = namedTypes.Node;
|
|
44251
43913
|
var Expression = namedTypes.Expression;
|
|
44252
|
-
var isArray =
|
|
44253
|
-
var b2 =
|
|
43914
|
+
var isArray = types6.builtInTypes.array;
|
|
43915
|
+
var b2 = types6.builders;
|
|
44254
43916
|
var Scope = function Scope2(path3, parentScope) {
|
|
44255
43917
|
if (!(this instanceof Scope2)) {
|
|
44256
43918
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
@@ -44318,7 +43980,7 @@ var require_scope = __commonJS({
|
|
|
44318
43980
|
++index;
|
|
44319
43981
|
}
|
|
44320
43982
|
var name2 = prefix + index;
|
|
44321
|
-
return this.bindings[name2] =
|
|
43983
|
+
return this.bindings[name2] = types6.builders.identifier(name2);
|
|
44322
43984
|
};
|
|
44323
43985
|
Sp.injectTemporary = function(identifier, init) {
|
|
44324
43986
|
identifier || (identifier = this.declareTemporary());
|
|
@@ -44398,7 +44060,7 @@ var require_scope = __commonJS({
|
|
|
44398
44060
|
bindings
|
|
44399
44061
|
);
|
|
44400
44062
|
} else if (Node.check(node) && !Expression.check(node)) {
|
|
44401
|
-
|
|
44063
|
+
types6.eachField(node, function(name2, child) {
|
|
44402
44064
|
var childPath = path3.get(name2);
|
|
44403
44065
|
if (!pathHasValue(childPath, child)) {
|
|
44404
44066
|
throw new Error("");
|
|
@@ -44477,24 +44139,24 @@ var require_scope = __commonJS({
|
|
|
44477
44139
|
addPattern(patternPath.get("argument"), bindings);
|
|
44478
44140
|
}
|
|
44479
44141
|
}
|
|
44480
|
-
function addTypePattern(patternPath,
|
|
44142
|
+
function addTypePattern(patternPath, types7) {
|
|
44481
44143
|
var pattern = patternPath.value;
|
|
44482
44144
|
namedTypes.Pattern.assert(pattern);
|
|
44483
44145
|
if (namedTypes.Identifier.check(pattern)) {
|
|
44484
|
-
if (hasOwn.call(
|
|
44485
|
-
|
|
44146
|
+
if (hasOwn.call(types7, pattern.name)) {
|
|
44147
|
+
types7[pattern.name].push(patternPath);
|
|
44486
44148
|
} else {
|
|
44487
|
-
|
|
44149
|
+
types7[pattern.name] = [patternPath];
|
|
44488
44150
|
}
|
|
44489
44151
|
}
|
|
44490
44152
|
}
|
|
44491
|
-
function addTypeParameter(parameterPath,
|
|
44153
|
+
function addTypeParameter(parameterPath, types7) {
|
|
44492
44154
|
var parameter = parameterPath.value;
|
|
44493
44155
|
FlowOrTSTypeParameterType.assert(parameter);
|
|
44494
|
-
if (hasOwn.call(
|
|
44495
|
-
|
|
44156
|
+
if (hasOwn.call(types7, parameter.name)) {
|
|
44157
|
+
types7[parameter.name].push(parameterPath);
|
|
44496
44158
|
} else {
|
|
44497
|
-
|
|
44159
|
+
types7[parameter.name] = [parameterPath];
|
|
44498
44160
|
}
|
|
44499
44161
|
}
|
|
44500
44162
|
Sp.lookup = function(name2) {
|
|
@@ -44532,11 +44194,11 @@ var require_node_path = __commonJS({
|
|
|
44532
44194
|
var path_1 = (0, tslib_1.__importDefault)(require_path());
|
|
44533
44195
|
var scope_1 = (0, tslib_1.__importDefault)(require_scope());
|
|
44534
44196
|
function nodePathPlugin(fork) {
|
|
44535
|
-
var
|
|
44536
|
-
var n2 =
|
|
44537
|
-
var b2 =
|
|
44538
|
-
var isNumber =
|
|
44539
|
-
var isArray =
|
|
44197
|
+
var types6 = fork.use(types_1.default);
|
|
44198
|
+
var n2 = types6.namedTypes;
|
|
44199
|
+
var b2 = types6.builders;
|
|
44200
|
+
var isNumber = types6.builtInTypes.number;
|
|
44201
|
+
var isArray = types6.builtInTypes.array;
|
|
44540
44202
|
var Path = fork.use(path_1.default);
|
|
44541
44203
|
var Scope = fork.use(scope_1.default);
|
|
44542
44204
|
var NodePath = function NodePath2(value, parentPath, name2) {
|
|
@@ -44627,7 +44289,7 @@ var require_node_path = __commonJS({
|
|
|
44627
44289
|
return scope || null;
|
|
44628
44290
|
};
|
|
44629
44291
|
NPp.getValueProperty = function(name2) {
|
|
44630
|
-
return
|
|
44292
|
+
return types6.getFieldValue(this.value, name2);
|
|
44631
44293
|
};
|
|
44632
44294
|
NPp.needsParens = function(assumeExpressionContext) {
|
|
44633
44295
|
var pp = this.parentPath;
|
|
@@ -44769,7 +44431,7 @@ var require_node_path = __commonJS({
|
|
|
44769
44431
|
return node.some(containsCallExpression);
|
|
44770
44432
|
}
|
|
44771
44433
|
if (n2.Node.check(node)) {
|
|
44772
|
-
return
|
|
44434
|
+
return types6.someField(node, function(_name, child) {
|
|
44773
44435
|
return containsCallExpression(child);
|
|
44774
44436
|
});
|
|
44775
44437
|
}
|
|
@@ -44887,11 +44549,11 @@ var require_path_visitor = __commonJS({
|
|
|
44887
44549
|
var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
|
|
44888
44550
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
44889
44551
|
function pathVisitorPlugin(fork) {
|
|
44890
|
-
var
|
|
44552
|
+
var types6 = fork.use(types_1.default);
|
|
44891
44553
|
var NodePath = fork.use(node_path_1.default);
|
|
44892
|
-
var isArray =
|
|
44893
|
-
var isObject2 =
|
|
44894
|
-
var isFunction2 =
|
|
44554
|
+
var isArray = types6.builtInTypes.array;
|
|
44555
|
+
var isObject2 = types6.builtInTypes.object;
|
|
44556
|
+
var isFunction2 = types6.builtInTypes.function;
|
|
44895
44557
|
var undefined2;
|
|
44896
44558
|
var PathVisitor = function PathVisitor2() {
|
|
44897
44559
|
if (!(this instanceof PathVisitor2)) {
|
|
@@ -44911,7 +44573,7 @@ var require_path_visitor = __commonJS({
|
|
|
44911
44573
|
typeNames[methodName.slice("visit".length)] = true;
|
|
44912
44574
|
}
|
|
44913
44575
|
}
|
|
44914
|
-
var supertypeTable =
|
|
44576
|
+
var supertypeTable = types6.computeSupertypeLookupTable(typeNames);
|
|
44915
44577
|
var methodNameTable = /* @__PURE__ */ Object.create(null);
|
|
44916
44578
|
var typeNameKeys = Object.keys(supertypeTable);
|
|
44917
44579
|
var typeNameCount = typeNameKeys.length;
|
|
@@ -45030,7 +44692,7 @@ var require_path_visitor = __commonJS({
|
|
|
45030
44692
|
path3.each(visitor.visitWithoutReset, visitor);
|
|
45031
44693
|
} else if (!isObject2.check(value)) {
|
|
45032
44694
|
} else {
|
|
45033
|
-
var childNames =
|
|
44695
|
+
var childNames = types6.getFieldNames(value);
|
|
45034
44696
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
45035
44697
|
childNames.push("comments");
|
|
45036
44698
|
}
|
|
@@ -45039,7 +44701,7 @@ var require_path_visitor = __commonJS({
|
|
|
45039
44701
|
for (var i = 0; i < childCount; ++i) {
|
|
45040
44702
|
var childName = childNames[i];
|
|
45041
44703
|
if (!hasOwn.call(value, childName)) {
|
|
45042
|
-
value[childName] =
|
|
44704
|
+
value[childName] = types6.getFieldValue(value, childName);
|
|
45043
44705
|
}
|
|
45044
44706
|
childPaths.push(path3.get(childName));
|
|
45045
44707
|
}
|
|
@@ -45179,13 +44841,13 @@ var require_equiv = __commonJS({
|
|
|
45179
44841
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
45180
44842
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45181
44843
|
function default_1(fork) {
|
|
45182
|
-
var
|
|
45183
|
-
var getFieldNames =
|
|
45184
|
-
var getFieldValue =
|
|
45185
|
-
var isArray =
|
|
45186
|
-
var isObject2 =
|
|
45187
|
-
var isDate =
|
|
45188
|
-
var isRegExp =
|
|
44844
|
+
var types6 = fork.use(types_1.default);
|
|
44845
|
+
var getFieldNames = types6.getFieldNames;
|
|
44846
|
+
var getFieldValue = types6.getFieldValue;
|
|
44847
|
+
var isArray = types6.builtInTypes.array;
|
|
44848
|
+
var isObject2 = types6.builtInTypes.object;
|
|
44849
|
+
var isDate = types6.builtInTypes.Date;
|
|
44850
|
+
var isRegExp = types6.builtInTypes.RegExp;
|
|
45189
44851
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
45190
44852
|
function astNodesAreEquivalent(a, b2, problemPath) {
|
|
45191
44853
|
if (isArray.check(problemPath)) {
|
|
@@ -45335,24 +44997,24 @@ var require_fork = __commonJS({
|
|
|
45335
44997
|
var node_path_1 = (0, tslib_1.__importDefault)(require_node_path());
|
|
45336
44998
|
function default_1(plugins) {
|
|
45337
44999
|
var fork = createFork();
|
|
45338
|
-
var
|
|
45000
|
+
var types6 = fork.use(types_1.default);
|
|
45339
45001
|
plugins.forEach(fork.use);
|
|
45340
|
-
|
|
45002
|
+
types6.finalize();
|
|
45341
45003
|
var PathVisitor = fork.use(path_visitor_1.default);
|
|
45342
45004
|
return {
|
|
45343
|
-
Type:
|
|
45344
|
-
builtInTypes:
|
|
45345
|
-
namedTypes:
|
|
45346
|
-
builders:
|
|
45347
|
-
defineMethod:
|
|
45348
|
-
getFieldNames:
|
|
45349
|
-
getFieldValue:
|
|
45350
|
-
eachField:
|
|
45351
|
-
someField:
|
|
45352
|
-
getSupertypeNames:
|
|
45353
|
-
getBuilderName:
|
|
45005
|
+
Type: types6.Type,
|
|
45006
|
+
builtInTypes: types6.builtInTypes,
|
|
45007
|
+
namedTypes: types6.namedTypes,
|
|
45008
|
+
builders: types6.builders,
|
|
45009
|
+
defineMethod: types6.defineMethod,
|
|
45010
|
+
getFieldNames: types6.getFieldNames,
|
|
45011
|
+
getFieldValue: types6.getFieldValue,
|
|
45012
|
+
eachField: types6.eachField,
|
|
45013
|
+
someField: types6.someField,
|
|
45014
|
+
getSupertypeNames: types6.getSupertypeNames,
|
|
45015
|
+
getBuilderName: types6.getBuilderName,
|
|
45354
45016
|
astNodesAreEquivalent: fork.use(equiv_1.default),
|
|
45355
|
-
finalize:
|
|
45017
|
+
finalize: types6.finalize,
|
|
45356
45018
|
Path: fork.use(path_1.default),
|
|
45357
45019
|
NodePath: fork.use(node_path_1.default),
|
|
45358
45020
|
PathVisitor,
|
|
@@ -45388,9 +45050,9 @@ var require_shared = __commonJS({
|
|
|
45388
45050
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
45389
45051
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45390
45052
|
function default_1(fork) {
|
|
45391
|
-
var
|
|
45392
|
-
var Type =
|
|
45393
|
-
var builtin =
|
|
45053
|
+
var types6 = fork.use(types_1.default);
|
|
45054
|
+
var Type = types6.Type;
|
|
45055
|
+
var builtin = types6.builtInTypes;
|
|
45394
45056
|
var isNumber = builtin.number;
|
|
45395
45057
|
function geq(than) {
|
|
45396
45058
|
return Type.from(function(value) {
|
|
@@ -45569,8 +45231,8 @@ var require_core2 = __commonJS({
|
|
|
45569
45231
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45570
45232
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45571
45233
|
function default_1(fork) {
|
|
45572
|
-
var
|
|
45573
|
-
var Type =
|
|
45234
|
+
var types6 = fork.use(types_1.default);
|
|
45235
|
+
var Type = types6.Type;
|
|
45574
45236
|
var def = Type.def;
|
|
45575
45237
|
var or = Type.or;
|
|
45576
45238
|
var shared = fork.use(shared_1.default);
|
|
@@ -45660,9 +45322,9 @@ var require_es6 = __commonJS({
|
|
|
45660
45322
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45661
45323
|
function default_1(fork) {
|
|
45662
45324
|
fork.use(core_1.default);
|
|
45663
|
-
var
|
|
45664
|
-
var def =
|
|
45665
|
-
var or =
|
|
45325
|
+
var types6 = fork.use(types_1.default);
|
|
45326
|
+
var def = types6.Type.def;
|
|
45327
|
+
var or = types6.Type.or;
|
|
45666
45328
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45667
45329
|
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
45330
|
def("RestElement").bases("Pattern").build("argument").field("argument", def("Pattern")).field(
|
|
@@ -45748,8 +45410,8 @@ var require_es2017 = __commonJS({
|
|
|
45748
45410
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45749
45411
|
function default_1(fork) {
|
|
45750
45412
|
fork.use(es2016_1.default);
|
|
45751
|
-
var
|
|
45752
|
-
var def =
|
|
45413
|
+
var types6 = fork.use(types_1.default);
|
|
45414
|
+
var def = types6.Type.def;
|
|
45753
45415
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45754
45416
|
def("Function").field("async", Boolean, defaults["false"]);
|
|
45755
45417
|
def("AwaitExpression").bases("Expression").build("argument").field("argument", def("Expression"));
|
|
@@ -45770,9 +45432,9 @@ var require_es2018 = __commonJS({
|
|
|
45770
45432
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45771
45433
|
function default_1(fork) {
|
|
45772
45434
|
fork.use(es2017_1.default);
|
|
45773
|
-
var
|
|
45774
|
-
var def =
|
|
45775
|
-
var or =
|
|
45435
|
+
var types6 = fork.use(types_1.default);
|
|
45436
|
+
var def = types6.Type.def;
|
|
45437
|
+
var or = types6.Type.or;
|
|
45776
45438
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45777
45439
|
def("ForOfStatement").field("await", Boolean, defaults["false"]);
|
|
45778
45440
|
def("SpreadProperty").bases("Node").build("argument").field("argument", def("Expression"));
|
|
@@ -45802,9 +45464,9 @@ var require_es2019 = __commonJS({
|
|
|
45802
45464
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45803
45465
|
function default_1(fork) {
|
|
45804
45466
|
fork.use(es2018_1.default);
|
|
45805
|
-
var
|
|
45806
|
-
var def =
|
|
45807
|
-
var or =
|
|
45467
|
+
var types6 = fork.use(types_1.default);
|
|
45468
|
+
var def = types6.Type.def;
|
|
45469
|
+
var or = types6.Type.or;
|
|
45808
45470
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45809
45471
|
def("CatchClause").field("param", or(def("Pattern"), null), defaults["null"]);
|
|
45810
45472
|
}
|
|
@@ -45826,9 +45488,9 @@ var require_es20202 = __commonJS({
|
|
|
45826
45488
|
function default_1(fork) {
|
|
45827
45489
|
fork.use(es2020_1.default);
|
|
45828
45490
|
fork.use(es2019_1.default);
|
|
45829
|
-
var
|
|
45830
|
-
var def =
|
|
45831
|
-
var or =
|
|
45491
|
+
var types6 = fork.use(types_1.default);
|
|
45492
|
+
var def = types6.Type.def;
|
|
45493
|
+
var or = types6.Type.or;
|
|
45832
45494
|
var shared = fork.use(shared_1.default);
|
|
45833
45495
|
var defaults = shared.defaults;
|
|
45834
45496
|
def("ImportExpression").bases("Expression").build("source").field("source", def("Expression"));
|
|
@@ -45872,8 +45534,8 @@ var require_es2022 = __commonJS({
|
|
|
45872
45534
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45873
45535
|
function default_1(fork) {
|
|
45874
45536
|
fork.use(es2021_1.default);
|
|
45875
|
-
var
|
|
45876
|
-
var def =
|
|
45537
|
+
var types6 = fork.use(types_1.default);
|
|
45538
|
+
var def = types6.Type.def;
|
|
45877
45539
|
def("StaticBlock").bases("Declaration").build("body").field("body", [def("Statement")]);
|
|
45878
45540
|
}
|
|
45879
45541
|
exports2.default = default_1;
|
|
@@ -45892,9 +45554,9 @@ var require_es_proposals = __commonJS({
|
|
|
45892
45554
|
var es2022_1 = (0, tslib_1.__importDefault)(require_es2022());
|
|
45893
45555
|
function default_1(fork) {
|
|
45894
45556
|
fork.use(es2022_1.default);
|
|
45895
|
-
var
|
|
45896
|
-
var Type =
|
|
45897
|
-
var def =
|
|
45557
|
+
var types6 = fork.use(types_1.default);
|
|
45558
|
+
var Type = types6.Type;
|
|
45559
|
+
var def = types6.Type.def;
|
|
45898
45560
|
var or = Type.or;
|
|
45899
45561
|
var shared = fork.use(shared_1.default);
|
|
45900
45562
|
var defaults = shared.defaults;
|
|
@@ -45932,9 +45594,9 @@ var require_jsx = __commonJS({
|
|
|
45932
45594
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45933
45595
|
function default_1(fork) {
|
|
45934
45596
|
fork.use(es_proposals_1.default);
|
|
45935
|
-
var
|
|
45936
|
-
var def =
|
|
45937
|
-
var or =
|
|
45597
|
+
var types6 = fork.use(types_1.default);
|
|
45598
|
+
var def = types6.Type.def;
|
|
45599
|
+
var or = types6.Type.or;
|
|
45938
45600
|
var defaults = fork.use(shared_1.default).defaults;
|
|
45939
45601
|
def("JSXAttribute").bases("Node").build("name", "value").field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))).field("value", or(
|
|
45940
45602
|
def("Literal"),
|
|
@@ -45996,9 +45658,9 @@ var require_type_annotations = __commonJS({
|
|
|
45996
45658
|
var types_1 = (0, tslib_1.__importDefault)(require_types());
|
|
45997
45659
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
45998
45660
|
function default_1(fork) {
|
|
45999
|
-
var
|
|
46000
|
-
var def =
|
|
46001
|
-
var or =
|
|
45661
|
+
var types6 = fork.use(types_1.default);
|
|
45662
|
+
var def = types6.Type.def;
|
|
45663
|
+
var or = types6.Type.or;
|
|
46002
45664
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46003
45665
|
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
|
|
46004
45666
|
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
|
|
@@ -46031,9 +45693,9 @@ var require_flow = __commonJS({
|
|
|
46031
45693
|
function default_1(fork) {
|
|
46032
45694
|
fork.use(es_proposals_1.default);
|
|
46033
45695
|
fork.use(type_annotations_1.default);
|
|
46034
|
-
var
|
|
46035
|
-
var def =
|
|
46036
|
-
var or =
|
|
45696
|
+
var types6 = fork.use(types_1.default);
|
|
45697
|
+
var def = types6.Type.def;
|
|
45698
|
+
var or = types6.Type.or;
|
|
46037
45699
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46038
45700
|
def("Flow").bases("Node");
|
|
46039
45701
|
def("FlowType").bases("Flow");
|
|
@@ -46148,10 +45810,10 @@ var require_esprima = __commonJS({
|
|
|
46148
45810
|
var shared_1 = (0, tslib_1.__importDefault)(require_shared());
|
|
46149
45811
|
function default_1(fork) {
|
|
46150
45812
|
fork.use(es_proposals_1.default);
|
|
46151
|
-
var
|
|
45813
|
+
var types6 = fork.use(types_1.default);
|
|
46152
45814
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46153
|
-
var def =
|
|
46154
|
-
var or =
|
|
45815
|
+
var def = types6.Type.def;
|
|
45816
|
+
var or = types6.Type.or;
|
|
46155
45817
|
def("VariableDeclaration").field("declarations", [or(
|
|
46156
45818
|
def("VariableDeclarator"),
|
|
46157
45819
|
def("Identifier")
|
|
@@ -46208,11 +45870,11 @@ var require_babel_core = __commonJS({
|
|
|
46208
45870
|
function default_1(fork) {
|
|
46209
45871
|
var _a2, _b2, _c2, _d, _e;
|
|
46210
45872
|
fork.use(es_proposals_1.default);
|
|
46211
|
-
var
|
|
45873
|
+
var types6 = fork.use(types_1.default);
|
|
46212
45874
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46213
|
-
var def =
|
|
46214
|
-
var or =
|
|
46215
|
-
var isUndefined =
|
|
45875
|
+
var def = types6.Type.def;
|
|
45876
|
+
var or = types6.Type.or;
|
|
45877
|
+
var isUndefined = types6.builtInTypes.undefined;
|
|
46216
45878
|
def("Noop").bases("Statement").build();
|
|
46217
45879
|
def("DoExpression").bases("Expression").build("body").field("body", [def("Statement")]);
|
|
46218
45880
|
def("BindExpression").bases("Expression").build("object", "callee").field("object", or(def("Expression"), null)).field("callee", def("Expression"));
|
|
@@ -46247,7 +45909,7 @@ var require_babel_core = __commonJS({
|
|
|
46247
45909
|
raw: String
|
|
46248
45910
|
},
|
|
46249
45911
|
function getDefault() {
|
|
46250
|
-
var value =
|
|
45912
|
+
var value = types6.getFieldValue(this, "value");
|
|
46251
45913
|
return {
|
|
46252
45914
|
rawValue: value,
|
|
46253
45915
|
raw: toRaw ? toRaw(value) : String(value)
|
|
@@ -46338,8 +46000,8 @@ var require_babel = __commonJS({
|
|
|
46338
46000
|
var babel_core_1 = (0, tslib_1.__importDefault)(require_babel_core());
|
|
46339
46001
|
var flow_1 = (0, tslib_1.__importDefault)(require_flow());
|
|
46340
46002
|
function default_1(fork) {
|
|
46341
|
-
var
|
|
46342
|
-
var def =
|
|
46003
|
+
var types6 = fork.use(types_1.default);
|
|
46004
|
+
var def = types6.Type.def;
|
|
46343
46005
|
fork.use(babel_core_1.default);
|
|
46344
46006
|
fork.use(flow_1.default);
|
|
46345
46007
|
def("V8IntrinsicIdentifier").bases("Expression").build("name").field("name", String);
|
|
@@ -46363,12 +46025,12 @@ var require_typescript = __commonJS({
|
|
|
46363
46025
|
function default_1(fork) {
|
|
46364
46026
|
fork.use(babel_core_1.default);
|
|
46365
46027
|
fork.use(type_annotations_1.default);
|
|
46366
|
-
var
|
|
46367
|
-
var n2 =
|
|
46368
|
-
var def =
|
|
46369
|
-
var or =
|
|
46028
|
+
var types6 = fork.use(types_1.default);
|
|
46029
|
+
var n2 = types6.namedTypes;
|
|
46030
|
+
var def = types6.Type.def;
|
|
46031
|
+
var or = types6.Type.or;
|
|
46370
46032
|
var defaults = fork.use(shared_1.default).defaults;
|
|
46371
|
-
var StringLiteral =
|
|
46033
|
+
var StringLiteral = types6.Type.from(function(value, deep) {
|
|
46372
46034
|
if (n2.StringLiteral && n2.StringLiteral.check(value, deep)) {
|
|
46373
46035
|
return true;
|
|
46374
46036
|
}
|
|
@@ -46773,7 +46435,7 @@ var require_util8 = __commonJS({
|
|
|
46773
46435
|
return path3;
|
|
46774
46436
|
}
|
|
46775
46437
|
exports2.normalize = normalize2;
|
|
46776
|
-
function
|
|
46438
|
+
function join7(aRoot, aPath) {
|
|
46777
46439
|
if (aRoot === "") {
|
|
46778
46440
|
aRoot = ".";
|
|
46779
46441
|
}
|
|
@@ -46805,7 +46467,7 @@ var require_util8 = __commonJS({
|
|
|
46805
46467
|
}
|
|
46806
46468
|
return joined;
|
|
46807
46469
|
}
|
|
46808
|
-
exports2.join =
|
|
46470
|
+
exports2.join = join7;
|
|
46809
46471
|
exports2.isAbsolute = function(aPath) {
|
|
46810
46472
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
46811
46473
|
};
|
|
@@ -46978,7 +46640,7 @@ var require_util8 = __commonJS({
|
|
|
46978
46640
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
46979
46641
|
}
|
|
46980
46642
|
}
|
|
46981
|
-
sourceURL =
|
|
46643
|
+
sourceURL = join7(urlGenerate(parsed), sourceURL);
|
|
46982
46644
|
}
|
|
46983
46645
|
return normalize2(sourceURL);
|
|
46984
46646
|
}
|
|
@@ -48346,8 +48008,8 @@ var require_util9 = __commonJS({
|
|
|
48346
48008
|
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
48009
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
48348
48010
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
48349
|
-
var
|
|
48350
|
-
var n2 =
|
|
48011
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
48012
|
+
var n2 = types6.namedTypes;
|
|
48351
48013
|
var source_map_1 = tslib_1.__importDefault(require_source_map());
|
|
48352
48014
|
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
|
|
48353
48015
|
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
|
|
@@ -55760,10 +55422,10 @@ var require_comments = __commonJS({
|
|
|
55760
55422
|
exports2.printComments = exports2.attach = void 0;
|
|
55761
55423
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
55762
55424
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
55763
|
-
var
|
|
55764
|
-
var n2 =
|
|
55765
|
-
var isArray =
|
|
55766
|
-
var isObject2 =
|
|
55425
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
55426
|
+
var n2 = types6.namedTypes;
|
|
55427
|
+
var isArray = types6.builtInTypes.array;
|
|
55428
|
+
var isObject2 = types6.builtInTypes.object;
|
|
55767
55429
|
var lines_1 = require_lines();
|
|
55768
55430
|
var util_1 = require_util9();
|
|
55769
55431
|
var childNodesCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -55794,7 +55456,7 @@ var require_comments = __commonJS({
|
|
|
55794
55456
|
if (isArray.check(node)) {
|
|
55795
55457
|
names = Object.keys(node);
|
|
55796
55458
|
} else if (isObject2.check(node)) {
|
|
55797
|
-
names =
|
|
55459
|
+
names = types6.getFieldNames(node);
|
|
55798
55460
|
} else {
|
|
55799
55461
|
return resultArray;
|
|
55800
55462
|
}
|
|
@@ -55974,7 +55636,7 @@ var require_comments = __commonJS({
|
|
|
55974
55636
|
function printComments(path3, print2) {
|
|
55975
55637
|
var value = path3.getValue();
|
|
55976
55638
|
var innerLines = print2(path3);
|
|
55977
|
-
var comments = n2.Node.check(value) &&
|
|
55639
|
+
var comments = n2.Node.check(value) && types6.getFieldValue(value, "comments");
|
|
55978
55640
|
if (!comments || comments.length === 0) {
|
|
55979
55641
|
return innerLines;
|
|
55980
55642
|
}
|
|
@@ -55982,8 +55644,8 @@ var require_comments = __commonJS({
|
|
|
55982
55644
|
var trailingParts = [innerLines];
|
|
55983
55645
|
path3.each(function(commentPath) {
|
|
55984
55646
|
var comment = commentPath.getValue();
|
|
55985
|
-
var leading =
|
|
55986
|
-
var trailing =
|
|
55647
|
+
var leading = types6.getFieldValue(comment, "leading");
|
|
55648
|
+
var trailing = types6.getFieldValue(comment, "trailing");
|
|
55987
55649
|
if (leading || trailing && !(n2.Statement.check(value) || comment.type === "Block" || comment.type === "CommentBlock")) {
|
|
55988
55650
|
leadingParts.push(printLeadingComment(commentPath, print2));
|
|
55989
55651
|
} else if (trailing) {
|
|
@@ -56005,10 +55667,10 @@ var require_parser2 = __commonJS({
|
|
|
56005
55667
|
exports2.parse = void 0;
|
|
56006
55668
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56007
55669
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56008
|
-
var
|
|
56009
|
-
var b2 =
|
|
56010
|
-
var isObject2 =
|
|
56011
|
-
var isArray =
|
|
55670
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
55671
|
+
var b2 = types6.builders;
|
|
55672
|
+
var isObject2 = types6.builtInTypes.object;
|
|
55673
|
+
var isArray = types6.builtInTypes.array;
|
|
56012
55674
|
var options_1 = require_options();
|
|
56013
55675
|
var lines_1 = require_lines();
|
|
56014
55676
|
var comments_1 = require_comments();
|
|
@@ -56195,11 +55857,11 @@ var require_fast_path = __commonJS({
|
|
|
56195
55857
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
56196
55858
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56197
55859
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56198
|
-
var
|
|
55860
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
56199
55861
|
var util = tslib_1.__importStar(require_util9());
|
|
56200
|
-
var n2 =
|
|
56201
|
-
var isArray =
|
|
56202
|
-
var isNumber =
|
|
55862
|
+
var n2 = types6.namedTypes;
|
|
55863
|
+
var isArray = types6.builtInTypes.array;
|
|
55864
|
+
var isNumber = types6.builtInTypes.number;
|
|
56203
55865
|
var PRECEDENCE = {};
|
|
56204
55866
|
[
|
|
56205
55867
|
["??"],
|
|
@@ -56228,7 +55890,7 @@ var require_fast_path = __commonJS({
|
|
|
56228
55890
|
if (obj instanceof FastPath) {
|
|
56229
55891
|
return obj.copy();
|
|
56230
55892
|
}
|
|
56231
|
-
if (obj instanceof
|
|
55893
|
+
if (obj instanceof types6.NodePath) {
|
|
56232
55894
|
var copy = Object.create(FastPath.prototype);
|
|
56233
55895
|
var stack = [obj.value];
|
|
56234
55896
|
for (var pp = void 0; pp = obj.parentPath; obj = pp)
|
|
@@ -56539,7 +56201,7 @@ var require_fast_path = __commonJS({
|
|
|
56539
56201
|
return node.some(containsCallExpression);
|
|
56540
56202
|
}
|
|
56541
56203
|
if (n2.Node.check(node)) {
|
|
56542
|
-
return
|
|
56204
|
+
return types6.someField(node, function(_name, child) {
|
|
56543
56205
|
return containsCallExpression(child);
|
|
56544
56206
|
});
|
|
56545
56207
|
}
|
|
@@ -56629,16 +56291,16 @@ var require_patcher = __commonJS({
|
|
|
56629
56291
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
56630
56292
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
56631
56293
|
var linesModule = tslib_1.__importStar(require_lines());
|
|
56632
|
-
var
|
|
56633
|
-
var Printable =
|
|
56634
|
-
var Expression =
|
|
56635
|
-
var ReturnStatement =
|
|
56636
|
-
var SourceLocation =
|
|
56294
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
56295
|
+
var Printable = types6.namedTypes.Printable;
|
|
56296
|
+
var Expression = types6.namedTypes.Expression;
|
|
56297
|
+
var ReturnStatement = types6.namedTypes.ReturnStatement;
|
|
56298
|
+
var SourceLocation = types6.namedTypes.SourceLocation;
|
|
56637
56299
|
var util_1 = require_util9();
|
|
56638
56300
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
56639
|
-
var isObject2 =
|
|
56640
|
-
var isArray =
|
|
56641
|
-
var isString =
|
|
56301
|
+
var isObject2 = types6.builtInTypes.object;
|
|
56302
|
+
var isArray = types6.builtInTypes.array;
|
|
56303
|
+
var isString = types6.builtInTypes.string;
|
|
56642
56304
|
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
|
|
56643
56305
|
var Patcher = function Patcher2(lines) {
|
|
56644
56306
|
assert_1.default.ok(this instanceof Patcher2);
|
|
@@ -56917,8 +56579,8 @@ var require_patcher = __commonJS({
|
|
|
56917
56579
|
if (k2.charAt(0) === "_") {
|
|
56918
56580
|
continue;
|
|
56919
56581
|
}
|
|
56920
|
-
newPath.stack.push(k2,
|
|
56921
|
-
oldPath.stack.push(k2,
|
|
56582
|
+
newPath.stack.push(k2, types6.getFieldValue(newNode, k2));
|
|
56583
|
+
oldPath.stack.push(k2, types6.getFieldValue(oldNode, k2));
|
|
56922
56584
|
var canReprint = findAnyReprints(newPath, oldPath, reprints);
|
|
56923
56585
|
newPath.stack.length -= 2;
|
|
56924
56586
|
oldPath.stack.length -= 2;
|
|
@@ -56946,10 +56608,10 @@ var require_printer = __commonJS({
|
|
|
56946
56608
|
var lines_1 = require_lines();
|
|
56947
56609
|
var options_1 = require_options();
|
|
56948
56610
|
var patcher_1 = require_patcher();
|
|
56949
|
-
var
|
|
56950
|
-
var namedTypes =
|
|
56951
|
-
var isString =
|
|
56952
|
-
var isObject2 =
|
|
56611
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
56612
|
+
var namedTypes = types6.namedTypes;
|
|
56613
|
+
var isString = types6.builtInTypes.string;
|
|
56614
|
+
var isObject2 = types6.builtInTypes.object;
|
|
56953
56615
|
var fast_path_1 = tslib_1.__importDefault(require_fast_path());
|
|
56954
56616
|
var util = tslib_1.__importStar(require_util9());
|
|
56955
56617
|
var PrintResult = function PrintResult2(code, sourceMap) {
|
|
@@ -57123,7 +56785,7 @@ var require_printer = __commonJS({
|
|
|
57123
56785
|
case "OptionalMemberExpression": {
|
|
57124
56786
|
parts.push(path3.call(print2, "object"));
|
|
57125
56787
|
var property = path3.call(print2, "property");
|
|
57126
|
-
var optional =
|
|
56788
|
+
var optional = types6.getFieldValue(n2, "optional");
|
|
57127
56789
|
if (n2.computed) {
|
|
57128
56790
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
57129
56791
|
} else {
|
|
@@ -57394,7 +57056,7 @@ var require_printer = __commonJS({
|
|
|
57394
57056
|
if (n2.typeArguments) {
|
|
57395
57057
|
parts.push(path3.call(print2, "typeArguments"));
|
|
57396
57058
|
}
|
|
57397
|
-
if (
|
|
57059
|
+
if (types6.getFieldValue(n2, "optional")) {
|
|
57398
57060
|
parts.push("?.");
|
|
57399
57061
|
}
|
|
57400
57062
|
parts.push(printArgumentsList(path3, options, print2));
|
|
@@ -59026,8 +58688,8 @@ var require_printer = __commonJS({
|
|
|
59026
58688
|
});
|
|
59027
58689
|
}
|
|
59028
58690
|
function getPossibleRaw(node) {
|
|
59029
|
-
var value =
|
|
59030
|
-
var extra =
|
|
58691
|
+
var value = types6.getFieldValue(node, "value");
|
|
58692
|
+
var extra = types6.getFieldValue(node, "extra");
|
|
59031
58693
|
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
|
|
59032
58694
|
return extra.raw;
|
|
59033
58695
|
}
|
|
@@ -59075,8 +58737,8 @@ var require_main3 = __commonJS({
|
|
|
59075
58737
|
exports2.run = exports2.prettyPrint = exports2.print = exports2.visit = exports2.types = exports2.parse = void 0;
|
|
59076
58738
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
59077
58739
|
var fs_1 = tslib_1.__importDefault(require("fs"));
|
|
59078
|
-
var
|
|
59079
|
-
exports2.types =
|
|
58740
|
+
var types6 = tslib_1.__importStar(require_main2());
|
|
58741
|
+
exports2.types = types6;
|
|
59080
58742
|
var parser_1 = require_parser2();
|
|
59081
58743
|
Object.defineProperty(exports2, "parse", { enumerable: true, get: function() {
|
|
59082
58744
|
return parser_1.parse;
|
|
@@ -59940,14 +59602,14 @@ var require_lib = __commonJS({
|
|
|
59940
59602
|
this.preserveSpace = !!preserveSpace;
|
|
59941
59603
|
}
|
|
59942
59604
|
};
|
|
59943
|
-
var
|
|
59605
|
+
var types6 = {
|
|
59944
59606
|
brace: new TokContext("{"),
|
|
59945
59607
|
j_oTag: new TokContext("<tag"),
|
|
59946
59608
|
j_cTag: new TokContext("</tag"),
|
|
59947
59609
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
59948
59610
|
};
|
|
59949
59611
|
{
|
|
59950
|
-
|
|
59612
|
+
types6.template = new TokContext("`", true);
|
|
59951
59613
|
}
|
|
59952
59614
|
var beforeExpr = true;
|
|
59953
59615
|
var startsExpr = true;
|
|
@@ -60479,17 +60141,17 @@ var require_lib = __commonJS({
|
|
|
60479
60141
|
context.pop();
|
|
60480
60142
|
};
|
|
60481
60143
|
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
|
|
60482
|
-
context.push(
|
|
60144
|
+
context.push(types6.brace);
|
|
60483
60145
|
};
|
|
60484
60146
|
tokenTypes[22].updateContext = (context) => {
|
|
60485
|
-
if (context[context.length - 1] ===
|
|
60147
|
+
if (context[context.length - 1] === types6.template) {
|
|
60486
60148
|
context.pop();
|
|
60487
60149
|
} else {
|
|
60488
|
-
context.push(
|
|
60150
|
+
context.push(types6.template);
|
|
60489
60151
|
}
|
|
60490
60152
|
};
|
|
60491
60153
|
tokenTypes[140].updateContext = (context) => {
|
|
60492
|
-
context.push(
|
|
60154
|
+
context.push(types6.j_expr, types6.j_oTag);
|
|
60493
60155
|
};
|
|
60494
60156
|
}
|
|
60495
60157
|
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 +60757,7 @@ var require_lib = __commonJS({
|
|
|
61095
60757
|
this.lastTokEndLoc = null;
|
|
61096
60758
|
this.lastTokStartLoc = null;
|
|
61097
60759
|
this.lastTokStart = 0;
|
|
61098
|
-
this.context = [
|
|
60760
|
+
this.context = [types6.brace];
|
|
61099
60761
|
this.canStartJSXElement = true;
|
|
61100
60762
|
this.containsEsc = false;
|
|
61101
60763
|
this.firstInvalidTemplateEscapePos = null;
|
|
@@ -64986,7 +64648,7 @@ var require_lib = __commonJS({
|
|
|
64986
64648
|
context
|
|
64987
64649
|
} = this.state;
|
|
64988
64650
|
const currentContext = context[context.length - 1];
|
|
64989
|
-
if (currentContext ===
|
|
64651
|
+
if (currentContext === types6.j_oTag || currentContext === types6.j_expr) {
|
|
64990
64652
|
context.pop();
|
|
64991
64653
|
}
|
|
64992
64654
|
}
|
|
@@ -66044,9 +65706,9 @@ var require_lib = __commonJS({
|
|
|
66044
65706
|
switch (this.state.type) {
|
|
66045
65707
|
case 5:
|
|
66046
65708
|
node = this.startNode();
|
|
66047
|
-
this.setContext(
|
|
65709
|
+
this.setContext(types6.brace);
|
|
66048
65710
|
this.next();
|
|
66049
|
-
node = this.jsxParseExpressionContainer(node,
|
|
65711
|
+
node = this.jsxParseExpressionContainer(node, types6.j_oTag);
|
|
66050
65712
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
66051
65713
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
66052
65714
|
at: node
|
|
@@ -66069,7 +65731,7 @@ var require_lib = __commonJS({
|
|
|
66069
65731
|
jsxParseSpreadChild(node) {
|
|
66070
65732
|
this.next();
|
|
66071
65733
|
node.expression = this.parseExpression();
|
|
66072
|
-
this.setContext(
|
|
65734
|
+
this.setContext(types6.j_expr);
|
|
66073
65735
|
this.state.canStartJSXElement = true;
|
|
66074
65736
|
this.expect(8);
|
|
66075
65737
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -66089,11 +65751,11 @@ var require_lib = __commonJS({
|
|
|
66089
65751
|
jsxParseAttribute() {
|
|
66090
65752
|
const node = this.startNode();
|
|
66091
65753
|
if (this.match(5)) {
|
|
66092
|
-
this.setContext(
|
|
65754
|
+
this.setContext(types6.brace);
|
|
66093
65755
|
this.next();
|
|
66094
65756
|
this.expect(21);
|
|
66095
65757
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
66096
|
-
this.setContext(
|
|
65758
|
+
this.setContext(types6.j_oTag);
|
|
66097
65759
|
this.state.canStartJSXElement = true;
|
|
66098
65760
|
this.expect(8);
|
|
66099
65761
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -66152,12 +65814,12 @@ var require_lib = __commonJS({
|
|
|
66152
65814
|
break;
|
|
66153
65815
|
case 5: {
|
|
66154
65816
|
const node2 = this.startNode();
|
|
66155
|
-
this.setContext(
|
|
65817
|
+
this.setContext(types6.brace);
|
|
66156
65818
|
this.next();
|
|
66157
65819
|
if (this.match(21)) {
|
|
66158
65820
|
children.push(this.jsxParseSpreadChild(node2));
|
|
66159
65821
|
} else {
|
|
66160
|
-
children.push(this.jsxParseExpressionContainer(node2,
|
|
65822
|
+
children.push(this.jsxParseExpressionContainer(node2, types6.j_expr));
|
|
66161
65823
|
}
|
|
66162
65824
|
break;
|
|
66163
65825
|
}
|
|
@@ -66228,11 +65890,11 @@ var require_lib = __commonJS({
|
|
|
66228
65890
|
}
|
|
66229
65891
|
getTokenFromCode(code) {
|
|
66230
65892
|
const context = this.curContext();
|
|
66231
|
-
if (context ===
|
|
65893
|
+
if (context === types6.j_expr) {
|
|
66232
65894
|
this.jsxReadToken();
|
|
66233
65895
|
return;
|
|
66234
65896
|
}
|
|
66235
|
-
if (context ===
|
|
65897
|
+
if (context === types6.j_oTag || context === types6.j_cTag) {
|
|
66236
65898
|
if (isIdentifierStart(code)) {
|
|
66237
65899
|
this.jsxReadWord();
|
|
66238
65900
|
return;
|
|
@@ -66242,7 +65904,7 @@ var require_lib = __commonJS({
|
|
|
66242
65904
|
this.finishToken(141);
|
|
66243
65905
|
return;
|
|
66244
65906
|
}
|
|
66245
|
-
if ((code === 34 || code === 39) && context ===
|
|
65907
|
+
if ((code === 34 || code === 39) && context === types6.j_oTag) {
|
|
66246
65908
|
this.jsxReadString(code);
|
|
66247
65909
|
return;
|
|
66248
65910
|
}
|
|
@@ -66260,17 +65922,17 @@ var require_lib = __commonJS({
|
|
|
66260
65922
|
type
|
|
66261
65923
|
} = this.state;
|
|
66262
65924
|
if (type === 56 && prevType === 140) {
|
|
66263
|
-
context.splice(-2, 2,
|
|
65925
|
+
context.splice(-2, 2, types6.j_cTag);
|
|
66264
65926
|
this.state.canStartJSXElement = false;
|
|
66265
65927
|
} else if (type === 140) {
|
|
66266
|
-
context.push(
|
|
65928
|
+
context.push(types6.j_oTag);
|
|
66267
65929
|
} else if (type === 141) {
|
|
66268
65930
|
const out = context[context.length - 1];
|
|
66269
|
-
if (out ===
|
|
65931
|
+
if (out === types6.j_oTag && prevType === 56 || out === types6.j_cTag) {
|
|
66270
65932
|
context.pop();
|
|
66271
|
-
this.state.canStartJSXElement = context[context.length - 1] ===
|
|
65933
|
+
this.state.canStartJSXElement = context[context.length - 1] === types6.j_expr;
|
|
66272
65934
|
} else {
|
|
66273
|
-
this.setContext(
|
|
65935
|
+
this.setContext(types6.j_expr);
|
|
66274
65936
|
this.state.canStartJSXElement = true;
|
|
66275
65937
|
}
|
|
66276
65938
|
} else {
|
|
@@ -67714,14 +67376,14 @@ var require_lib = __commonJS({
|
|
|
67714
67376
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
67715
67377
|
const node = this.startNode();
|
|
67716
67378
|
const hasLeadingOperator = this.eat(operator);
|
|
67717
|
-
const
|
|
67379
|
+
const types7 = [];
|
|
67718
67380
|
do {
|
|
67719
|
-
|
|
67381
|
+
types7.push(parseConstituentType());
|
|
67720
67382
|
} while (this.eat(operator));
|
|
67721
|
-
if (
|
|
67722
|
-
return
|
|
67383
|
+
if (types7.length === 1 && !hasLeadingOperator) {
|
|
67384
|
+
return types7[0];
|
|
67723
67385
|
}
|
|
67724
|
-
node.types =
|
|
67386
|
+
node.types = types7;
|
|
67725
67387
|
return this.finishNode(node, kind);
|
|
67726
67388
|
}
|
|
67727
67389
|
tsParseIntersectionTypeOrHigher() {
|
|
@@ -68295,7 +67957,7 @@ var require_lib = __commonJS({
|
|
|
68295
67957
|
this.raise(TSErrors.EmptyTypeArguments, {
|
|
68296
67958
|
at: node
|
|
68297
67959
|
});
|
|
68298
|
-
} else if (!this.state.inType && this.curContext() ===
|
|
67960
|
+
} else if (!this.state.inType && this.curContext() === types6.brace) {
|
|
68299
67961
|
this.reScan_lt_gt();
|
|
68300
67962
|
}
|
|
68301
67963
|
this.expect(48);
|
|
@@ -68972,7 +68634,7 @@ var require_lib = __commonJS({
|
|
|
68972
68634
|
context
|
|
68973
68635
|
} = this.state;
|
|
68974
68636
|
const currentContext = context[context.length - 1];
|
|
68975
|
-
if (currentContext ===
|
|
68637
|
+
if (currentContext === types6.j_oTag || currentContext === types6.j_expr) {
|
|
68976
68638
|
context.pop();
|
|
68977
68639
|
}
|
|
68978
68640
|
}
|
|
@@ -73805,30 +73467,24 @@ var require_typescript2 = __commonJS({
|
|
|
73805
73467
|
});
|
|
73806
73468
|
|
|
73807
73469
|
// src/helpers/codemod.ts
|
|
73808
|
-
var
|
|
73470
|
+
var import_fs9, import_path9, recast, esprimaParser, typescriptParser, parseFile, transformFile, loadSnippets, loadTemplateSnippets;
|
|
73809
73471
|
var init_codemod = __esm({
|
|
73810
73472
|
"src/helpers/codemod.ts"() {
|
|
73811
|
-
|
|
73473
|
+
import_fs9 = require("fs");
|
|
73474
|
+
import_path9 = __toESM(require("path"));
|
|
73812
73475
|
init_cli();
|
|
73813
73476
|
recast = __toESM(require_main3());
|
|
73814
73477
|
esprimaParser = __toESM(require_esprima3());
|
|
73815
73478
|
typescriptParser = __toESM(require_typescript2());
|
|
73479
|
+
init_templates();
|
|
73816
73480
|
init_files();
|
|
73817
|
-
parseTs = (src) => {
|
|
73818
|
-
src = src.trim();
|
|
73819
|
-
try {
|
|
73820
|
-
return recast.parse(src, { parser: typescriptParser });
|
|
73821
|
-
} catch (error2) {
|
|
73822
|
-
crash("Error parsing ts template.");
|
|
73823
|
-
}
|
|
73824
|
-
};
|
|
73825
73481
|
parseFile = (filePath) => {
|
|
73826
|
-
const lang =
|
|
73482
|
+
const lang = import_path9.default.extname(filePath).slice(1);
|
|
73827
73483
|
const parser2 = lang === "js" ? esprimaParser : typescriptParser;
|
|
73828
73484
|
try {
|
|
73829
|
-
const fileContents = readFile(
|
|
73485
|
+
const fileContents = readFile(import_path9.default.resolve(filePath));
|
|
73830
73486
|
if (fileContents) {
|
|
73831
|
-
return recast.parse(fileContents, { parser: parser2 });
|
|
73487
|
+
return recast.parse(fileContents, { parser: parser2 }).program;
|
|
73832
73488
|
}
|
|
73833
73489
|
} catch (error2) {
|
|
73834
73490
|
crash(`Error parsing file: ${filePath}`);
|
|
@@ -73842,6 +73498,440 @@ var init_codemod = __esm({
|
|
|
73842
73498
|
writeFile2(filePath, recast.print(ast).code);
|
|
73843
73499
|
}
|
|
73844
73500
|
};
|
|
73501
|
+
loadSnippets = (parentFolder) => {
|
|
73502
|
+
const snippetsPath = (0, import_path9.join)(parentFolder, "snippets");
|
|
73503
|
+
if (!(0, import_fs9.existsSync)(snippetsPath)) {
|
|
73504
|
+
return {};
|
|
73505
|
+
}
|
|
73506
|
+
if (!(0, import_fs9.lstatSync)(snippetsPath).isDirectory) {
|
|
73507
|
+
return {};
|
|
73508
|
+
}
|
|
73509
|
+
const files = (0, import_fs9.readdirSync)(snippetsPath);
|
|
73510
|
+
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) => {
|
|
73511
|
+
const [file, ext] = snippetPath.split(".");
|
|
73512
|
+
const key = `${file}${ext === "js" ? "Js" : "Ts"}`;
|
|
73513
|
+
return {
|
|
73514
|
+
...acc,
|
|
73515
|
+
[key]: parseFile((0, import_path9.join)(snippetsPath, snippetPath))?.body
|
|
73516
|
+
};
|
|
73517
|
+
}, {});
|
|
73518
|
+
};
|
|
73519
|
+
loadTemplateSnippets = (ctx) => {
|
|
73520
|
+
return loadSnippets(getTemplatePath(ctx));
|
|
73521
|
+
};
|
|
73522
|
+
}
|
|
73523
|
+
});
|
|
73524
|
+
|
|
73525
|
+
// templates/astro/c3.ts
|
|
73526
|
+
var c3_exports2 = {};
|
|
73527
|
+
__export(c3_exports2, {
|
|
73528
|
+
default: () => c3_default2
|
|
73529
|
+
});
|
|
73530
|
+
var recast2, npx2, generate2, configure2, updateAstroConfig, updateEnvDeclaration, config2, c3_default2;
|
|
73531
|
+
var init_c32 = __esm({
|
|
73532
|
+
"templates/astro/c3.ts"() {
|
|
73533
|
+
init_cli();
|
|
73534
|
+
init_colors();
|
|
73535
|
+
init_codemod();
|
|
73536
|
+
init_command();
|
|
73537
|
+
init_files();
|
|
73538
|
+
init_packages();
|
|
73539
|
+
recast2 = __toESM(require_main3());
|
|
73540
|
+
({ npx: npx2 } = detectPackageManager());
|
|
73541
|
+
generate2 = async (ctx) => {
|
|
73542
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
73543
|
+
logRaw("");
|
|
73544
|
+
};
|
|
73545
|
+
configure2 = async (ctx) => {
|
|
73546
|
+
await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
|
|
73547
|
+
silent: true,
|
|
73548
|
+
startText: "Installing adapter",
|
|
73549
|
+
doneText: `${brandColor("installed")} ${dim(
|
|
73550
|
+
`via \`${npx2} astro add cloudflare\``
|
|
73551
|
+
)}`
|
|
73552
|
+
});
|
|
73553
|
+
updateAstroConfig();
|
|
73554
|
+
updateEnvDeclaration(ctx);
|
|
73555
|
+
};
|
|
73556
|
+
updateAstroConfig = () => {
|
|
73557
|
+
const filePath = "astro.config.mjs";
|
|
73558
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
73559
|
+
transformFile(filePath, {
|
|
73560
|
+
visitCallExpression: function(n2) {
|
|
73561
|
+
const callee = n2.node.callee;
|
|
73562
|
+
if (callee.name !== "cloudflare") {
|
|
73563
|
+
return this.traverse(n2);
|
|
73564
|
+
}
|
|
73565
|
+
const b2 = recast2.types.builders;
|
|
73566
|
+
n2.node.arguments = [
|
|
73567
|
+
b2.objectExpression([
|
|
73568
|
+
b2.objectProperty(
|
|
73569
|
+
b2.identifier("runtime"),
|
|
73570
|
+
b2.objectExpression([
|
|
73571
|
+
b2.objectProperty(b2.identifier("mode"), b2.stringLiteral("local"))
|
|
73572
|
+
])
|
|
73573
|
+
)
|
|
73574
|
+
])
|
|
73575
|
+
];
|
|
73576
|
+
return false;
|
|
73577
|
+
}
|
|
73578
|
+
});
|
|
73579
|
+
};
|
|
73580
|
+
updateEnvDeclaration = (ctx) => {
|
|
73581
|
+
if (!usesTypescript(ctx)) {
|
|
73582
|
+
return;
|
|
73583
|
+
}
|
|
73584
|
+
const filePath = "src/env.d.ts";
|
|
73585
|
+
updateStatus(`Adding type declarations in ${blue(filePath)}`);
|
|
73586
|
+
transformFile(filePath, {
|
|
73587
|
+
visitProgram: function(n2) {
|
|
73588
|
+
const snippets = loadTemplateSnippets(ctx);
|
|
73589
|
+
const patch = snippets.runtimeDeclarationTs;
|
|
73590
|
+
const b2 = recast2.types.builders;
|
|
73591
|
+
const comments = n2.get("comments").value;
|
|
73592
|
+
n2.node.comments = comments.map(
|
|
73593
|
+
(c2) => b2.commentLine(c2.value)
|
|
73594
|
+
);
|
|
73595
|
+
n2.get("body").push(...patch);
|
|
73596
|
+
return false;
|
|
73597
|
+
}
|
|
73598
|
+
});
|
|
73599
|
+
};
|
|
73600
|
+
config2 = {
|
|
73601
|
+
configVersion: 1,
|
|
73602
|
+
id: "astro",
|
|
73603
|
+
platform: "pages",
|
|
73604
|
+
displayName: "Astro",
|
|
73605
|
+
copyFiles: {
|
|
73606
|
+
path: "./templates"
|
|
73607
|
+
},
|
|
73608
|
+
devScript: "dev",
|
|
73609
|
+
deployScript: "deploy",
|
|
73610
|
+
previewScript: "preview",
|
|
73611
|
+
generate: generate2,
|
|
73612
|
+
configure: configure2,
|
|
73613
|
+
transformPackageJson: async (pkgJson, ctx) => ({
|
|
73614
|
+
scripts: {
|
|
73615
|
+
deploy: `astro build && wrangler pages deploy ./dist`,
|
|
73616
|
+
preview: `astro build && wrangler pages dev ./dist`,
|
|
73617
|
+
...usesTypescript(ctx) && { "build-cf-types": `wrangler types` }
|
|
73618
|
+
}
|
|
73619
|
+
}),
|
|
73620
|
+
testFlags: [
|
|
73621
|
+
"--skip-houston",
|
|
73622
|
+
"--no-install",
|
|
73623
|
+
"--no-git",
|
|
73624
|
+
"--template",
|
|
73625
|
+
"blog",
|
|
73626
|
+
"--typescript",
|
|
73627
|
+
"strict"
|
|
73628
|
+
]
|
|
73629
|
+
};
|
|
73630
|
+
c3_default2 = config2;
|
|
73631
|
+
}
|
|
73632
|
+
});
|
|
73633
|
+
|
|
73634
|
+
// templates/docusaurus/c3.ts
|
|
73635
|
+
var c3_exports3 = {};
|
|
73636
|
+
__export(c3_exports3, {
|
|
73637
|
+
default: () => c3_default3
|
|
73638
|
+
});
|
|
73639
|
+
var npm4, generate3, config3, c3_default3;
|
|
73640
|
+
var init_c33 = __esm({
|
|
73641
|
+
"templates/docusaurus/c3.ts"() {
|
|
73642
|
+
init_command();
|
|
73643
|
+
init_files();
|
|
73644
|
+
init_packages();
|
|
73645
|
+
({ npm: npm4 } = detectPackageManager());
|
|
73646
|
+
generate3 = async (ctx) => {
|
|
73647
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
73648
|
+
};
|
|
73649
|
+
config3 = {
|
|
73650
|
+
configVersion: 1,
|
|
73651
|
+
id: "docusaurus",
|
|
73652
|
+
platform: "pages",
|
|
73653
|
+
displayName: "Docusaurus",
|
|
73654
|
+
generate: generate3,
|
|
73655
|
+
transformPackageJson: async () => ({
|
|
73656
|
+
scripts: {
|
|
73657
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm4} run start`,
|
|
73658
|
+
"pages:deploy": `${npm4} run build && wrangler pages deploy ./build`
|
|
73659
|
+
}
|
|
73660
|
+
}),
|
|
73661
|
+
testFlags: [`--package-manager`, npm4]
|
|
73662
|
+
};
|
|
73663
|
+
c3_default3 = config3;
|
|
73664
|
+
}
|
|
73665
|
+
});
|
|
73666
|
+
|
|
73667
|
+
// templates/gatsby/c3.ts
|
|
73668
|
+
var c3_exports4 = {};
|
|
73669
|
+
__export(c3_exports4, {
|
|
73670
|
+
default: () => c3_default4
|
|
73671
|
+
});
|
|
73672
|
+
var npm5, generate4, config4, c3_default4;
|
|
73673
|
+
var init_c34 = __esm({
|
|
73674
|
+
"templates/gatsby/c3.ts"() {
|
|
73675
|
+
init_interactive();
|
|
73676
|
+
init_command();
|
|
73677
|
+
init_files();
|
|
73678
|
+
init_packages();
|
|
73679
|
+
({ npm: npm5 } = detectPackageManager());
|
|
73680
|
+
generate4 = async (ctx) => {
|
|
73681
|
+
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
73682
|
+
const useTemplate = await inputPrompt({
|
|
73683
|
+
type: "confirm",
|
|
73684
|
+
question: "Would you like to use a template?",
|
|
73685
|
+
label: "template",
|
|
73686
|
+
defaultValue: true
|
|
73687
|
+
});
|
|
73688
|
+
let templateUrl = "";
|
|
73689
|
+
if (useTemplate) {
|
|
73690
|
+
templateUrl = await inputPrompt({
|
|
73691
|
+
type: "text",
|
|
73692
|
+
question: `Please specify the url of the template you'd like to use`,
|
|
73693
|
+
label: "template",
|
|
73694
|
+
defaultValue: defaultTemplate
|
|
73695
|
+
});
|
|
73696
|
+
}
|
|
73697
|
+
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
73698
|
+
};
|
|
73699
|
+
config4 = {
|
|
73700
|
+
configVersion: 1,
|
|
73701
|
+
id: "gatsby",
|
|
73702
|
+
platform: "pages",
|
|
73703
|
+
displayName: "Gatsby",
|
|
73704
|
+
generate: generate4,
|
|
73705
|
+
transformPackageJson: async () => ({
|
|
73706
|
+
scripts: {
|
|
73707
|
+
"pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 8000 -- ${npm5} run develop`,
|
|
73708
|
+
"pages:deploy": `${npm5} run build && wrangler pages deploy ./public`
|
|
73709
|
+
}
|
|
73710
|
+
})
|
|
73711
|
+
};
|
|
73712
|
+
c3_default4 = config4;
|
|
73713
|
+
}
|
|
73714
|
+
});
|
|
73715
|
+
|
|
73716
|
+
// templates/hono/c3.ts
|
|
73717
|
+
var c3_exports5 = {};
|
|
73718
|
+
__export(c3_exports5, {
|
|
73719
|
+
default: () => c3_default5
|
|
73720
|
+
});
|
|
73721
|
+
var generate5, config5, c3_default5;
|
|
73722
|
+
var init_c35 = __esm({
|
|
73723
|
+
"templates/hono/c3.ts"() {
|
|
73724
|
+
init_cli();
|
|
73725
|
+
init_command();
|
|
73726
|
+
generate5 = async (ctx) => {
|
|
73727
|
+
await runFrameworkGenerator(ctx, [
|
|
73728
|
+
ctx.project.name,
|
|
73729
|
+
"--template",
|
|
73730
|
+
"cloudflare-workers"
|
|
73731
|
+
]);
|
|
73732
|
+
logRaw("");
|
|
73733
|
+
};
|
|
73734
|
+
config5 = {
|
|
73735
|
+
configVersion: 1,
|
|
73736
|
+
id: "hono",
|
|
73737
|
+
displayName: "Hono",
|
|
73738
|
+
platform: "workers",
|
|
73739
|
+
generate: generate5,
|
|
73740
|
+
devScript: "dev",
|
|
73741
|
+
deployScript: "deploy"
|
|
73742
|
+
};
|
|
73743
|
+
c3_default5 = config5;
|
|
73744
|
+
}
|
|
73745
|
+
});
|
|
73746
|
+
|
|
73747
|
+
// templates/next/c3.ts
|
|
73748
|
+
var c3_exports6 = {};
|
|
73749
|
+
__export(c3_exports6, {
|
|
73750
|
+
default: () => c3_default6,
|
|
73751
|
+
shouldInstallNextOnPagesEslintPlugin: () => shouldInstallNextOnPagesEslintPlugin,
|
|
73752
|
+
writeEslintrc: () => writeEslintrc
|
|
73753
|
+
});
|
|
73754
|
+
var import_path10, npm6, npx3, generate6, updateNextConfig, configure3, shouldInstallNextOnPagesEslintPlugin, writeEslintrc, addDevDependencies, c3_default6;
|
|
73755
|
+
var init_c36 = __esm({
|
|
73756
|
+
"templates/next/c3.ts"() {
|
|
73757
|
+
import_path10 = require("path");
|
|
73758
|
+
init_cli();
|
|
73759
|
+
init_args();
|
|
73760
|
+
init_colors();
|
|
73761
|
+
init_interactive();
|
|
73762
|
+
init_command();
|
|
73763
|
+
init_files();
|
|
73764
|
+
init_packages();
|
|
73765
|
+
init_templates();
|
|
73766
|
+
({ npm: npm6, npx: npx3 } = detectPackageManager());
|
|
73767
|
+
generate6 = async (ctx) => {
|
|
73768
|
+
const projectName = ctx.project.name;
|
|
73769
|
+
await runFrameworkGenerator(ctx, [projectName]);
|
|
73770
|
+
copyFile(
|
|
73771
|
+
(0, import_path10.join)(getTemplatePath(ctx), "wrangler.toml"),
|
|
73772
|
+
(0, import_path10.join)(ctx.project.path, "wrangler.toml")
|
|
73773
|
+
);
|
|
73774
|
+
updateStatus("Created wrangler.toml file");
|
|
73775
|
+
};
|
|
73776
|
+
updateNextConfig = () => {
|
|
73777
|
+
const s = spinner();
|
|
73778
|
+
const configFile = "next.config.mjs";
|
|
73779
|
+
s.start(`Updating \`${configFile}\``);
|
|
73780
|
+
const configContent = readFile(configFile);
|
|
73781
|
+
const updatedConfigFile = `import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
|
|
73782
|
+
|
|
73783
|
+
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
|
|
73784
|
+
// (when running the application with \`next dev\`), for more information see:
|
|
73785
|
+
// https://github.com/cloudflare/next-on-pages/blob/5712c57ea7/internal-packages/next-dev/README.md
|
|
73786
|
+
if (process.env.NODE_ENV === 'development') {
|
|
73787
|
+
await setupDevPlatform();
|
|
73788
|
+
}
|
|
73789
|
+
|
|
73790
|
+
`.replace(/\n\t*/g, "\n") + configContent;
|
|
73791
|
+
writeFile2(configFile, updatedConfigFile);
|
|
73792
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
73793
|
+
};
|
|
73794
|
+
configure3 = async (ctx) => {
|
|
73795
|
+
const projectPath = ctx.project.path;
|
|
73796
|
+
const path3 = probePaths([
|
|
73797
|
+
`${projectPath}/pages/api`,
|
|
73798
|
+
`${projectPath}/src/pages/api`,
|
|
73799
|
+
`${projectPath}/src/app/api`,
|
|
73800
|
+
`${projectPath}/app/api`,
|
|
73801
|
+
`${projectPath}/src/app`,
|
|
73802
|
+
`${projectPath}/app`
|
|
73803
|
+
]);
|
|
73804
|
+
if (!path3) {
|
|
73805
|
+
crash("Could not find the `/api` or `/app` directory");
|
|
73806
|
+
}
|
|
73807
|
+
const usesTs = usesTypescript(ctx);
|
|
73808
|
+
if (usesTs) {
|
|
73809
|
+
copyFile(
|
|
73810
|
+
(0, import_path10.join)(getTemplatePath(ctx), "env.d.ts"),
|
|
73811
|
+
(0, import_path10.join)(projectPath, "env.d.ts")
|
|
73812
|
+
);
|
|
73813
|
+
updateStatus("Created an env.d.ts file");
|
|
73814
|
+
}
|
|
73815
|
+
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
73816
|
+
if (installEslintPlugin) {
|
|
73817
|
+
await writeEslintrc(ctx);
|
|
73818
|
+
}
|
|
73819
|
+
updateNextConfig();
|
|
73820
|
+
copyFile(
|
|
73821
|
+
(0, import_path10.join)(getTemplatePath(ctx), "README.md"),
|
|
73822
|
+
(0, import_path10.join)(projectPath, "README.md")
|
|
73823
|
+
);
|
|
73824
|
+
updateStatus("Updated the README file");
|
|
73825
|
+
await addDevDependencies(installEslintPlugin);
|
|
73826
|
+
};
|
|
73827
|
+
shouldInstallNextOnPagesEslintPlugin = async (ctx) => {
|
|
73828
|
+
const eslintUsage = usesEslint(ctx);
|
|
73829
|
+
if (!eslintUsage.used)
|
|
73830
|
+
return false;
|
|
73831
|
+
if (eslintUsage.configType !== ".eslintrc.json") {
|
|
73832
|
+
warn(
|
|
73833
|
+
`Expected .eslintrc.json from Next.js scaffolding but found ${eslintUsage.configType} instead`
|
|
73834
|
+
);
|
|
73835
|
+
return false;
|
|
73836
|
+
}
|
|
73837
|
+
return await processArgument(ctx.args, "eslint-plugin", {
|
|
73838
|
+
type: "confirm",
|
|
73839
|
+
question: "Do you want to use the next-on-pages eslint-plugin?",
|
|
73840
|
+
label: "eslint-plugin",
|
|
73841
|
+
defaultValue: true
|
|
73842
|
+
});
|
|
73843
|
+
};
|
|
73844
|
+
writeEslintrc = async (ctx) => {
|
|
73845
|
+
const eslintConfig = readJSON(`${ctx.project.path}/.eslintrc.json`);
|
|
73846
|
+
eslintConfig.plugins ??= [];
|
|
73847
|
+
eslintConfig.plugins.push("eslint-plugin-next-on-pages");
|
|
73848
|
+
if (typeof eslintConfig.extends === "string") {
|
|
73849
|
+
eslintConfig.extends = [eslintConfig.extends];
|
|
73850
|
+
}
|
|
73851
|
+
eslintConfig.extends ??= [];
|
|
73852
|
+
eslintConfig.extends.push("plugin:eslint-plugin-next-on-pages/recommended");
|
|
73853
|
+
writeJSON(`${ctx.project.path}/.eslintrc.json`, eslintConfig);
|
|
73854
|
+
};
|
|
73855
|
+
addDevDependencies = async (installEslintPlugin) => {
|
|
73856
|
+
const packages = [
|
|
73857
|
+
"@cloudflare/next-on-pages@1",
|
|
73858
|
+
"@cloudflare/workers-types",
|
|
73859
|
+
"vercel",
|
|
73860
|
+
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
73861
|
+
];
|
|
73862
|
+
await installPackages(packages, {
|
|
73863
|
+
dev: true,
|
|
73864
|
+
startText: "Adding the Cloudflare Pages adapter",
|
|
73865
|
+
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
73866
|
+
});
|
|
73867
|
+
};
|
|
73868
|
+
c3_default6 = {
|
|
73869
|
+
configVersion: 1,
|
|
73870
|
+
id: "next",
|
|
73871
|
+
platform: "pages",
|
|
73872
|
+
displayName: "Next",
|
|
73873
|
+
devScript: "dev",
|
|
73874
|
+
previewScript: "preview",
|
|
73875
|
+
deployScript: "deploy",
|
|
73876
|
+
generate: generate6,
|
|
73877
|
+
configure: configure3,
|
|
73878
|
+
copyFiles: {
|
|
73879
|
+
async selectVariant(ctx) {
|
|
73880
|
+
const isApp = probePaths([
|
|
73881
|
+
`${ctx.project.path}/src/app`,
|
|
73882
|
+
`${ctx.project.path}/app`
|
|
73883
|
+
]);
|
|
73884
|
+
const isTypescript = usesTypescript(ctx);
|
|
73885
|
+
const dir = isApp ? "app" : "pages";
|
|
73886
|
+
return `${dir}/${isTypescript ? "ts" : "js"}`;
|
|
73887
|
+
},
|
|
73888
|
+
destinationDir(ctx) {
|
|
73889
|
+
const srcPath = probePaths([`${ctx.project.path}/src`]);
|
|
73890
|
+
return srcPath ? "./src" : "./";
|
|
73891
|
+
},
|
|
73892
|
+
variants: {
|
|
73893
|
+
"app/ts": {
|
|
73894
|
+
path: "./app/ts"
|
|
73895
|
+
},
|
|
73896
|
+
"app/js": {
|
|
73897
|
+
path: "./app/js"
|
|
73898
|
+
},
|
|
73899
|
+
"pages/ts": {
|
|
73900
|
+
path: "./pages/ts"
|
|
73901
|
+
},
|
|
73902
|
+
"pages/js": {
|
|
73903
|
+
path: "./pages/js"
|
|
73904
|
+
}
|
|
73905
|
+
}
|
|
73906
|
+
},
|
|
73907
|
+
transformPackageJson: async () => {
|
|
73908
|
+
const isNpm = npm6 === "npm";
|
|
73909
|
+
const isBun = npm6 === "bun";
|
|
73910
|
+
const isNpmOrBun = isNpm || isBun;
|
|
73911
|
+
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
73912
|
+
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
73913
|
+
const pmCommand = isNpmOrBun ? npx3 : npm6;
|
|
73914
|
+
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
73915
|
+
return {
|
|
73916
|
+
scripts: {
|
|
73917
|
+
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
73918
|
+
preview: `${pagesBuildRunCommand} && wrangler pages dev .vercel/output/static`,
|
|
73919
|
+
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static`
|
|
73920
|
+
}
|
|
73921
|
+
};
|
|
73922
|
+
},
|
|
73923
|
+
testFlags: [
|
|
73924
|
+
"--typescript",
|
|
73925
|
+
"--no-install",
|
|
73926
|
+
"--eslint",
|
|
73927
|
+
"--tailwind",
|
|
73928
|
+
"--src-dir",
|
|
73929
|
+
"--app",
|
|
73930
|
+
"--import-alias",
|
|
73931
|
+
"@/*"
|
|
73932
|
+
],
|
|
73933
|
+
compatibilityFlags: ["nodejs_compat"]
|
|
73934
|
+
};
|
|
73845
73935
|
}
|
|
73846
73936
|
});
|
|
73847
73937
|
|
|
@@ -73850,7 +73940,7 @@ var c3_exports7 = {};
|
|
|
73850
73940
|
__export(c3_exports7, {
|
|
73851
73941
|
default: () => c3_default7
|
|
73852
73942
|
});
|
|
73853
|
-
var
|
|
73943
|
+
var recast3, npm7, pm, generate7, configure4, updateEnvTypes, updateNuxtConfig, config6, c3_default7;
|
|
73854
73944
|
var init_c37 = __esm({
|
|
73855
73945
|
"templates/nuxt/c3.ts"() {
|
|
73856
73946
|
init_cli();
|
|
@@ -73860,8 +73950,9 @@ var init_c37 = __esm({
|
|
|
73860
73950
|
init_command();
|
|
73861
73951
|
init_files();
|
|
73862
73952
|
init_packages();
|
|
73863
|
-
|
|
73864
|
-
(
|
|
73953
|
+
recast3 = __toESM(require_main3());
|
|
73954
|
+
init_workers();
|
|
73955
|
+
({ npm: npm7, name: pm } = detectPackageManager());
|
|
73865
73956
|
generate7 = async (ctx) => {
|
|
73866
73957
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
73867
73958
|
await runFrameworkGenerator(ctx, [
|
|
@@ -73874,19 +73965,38 @@ var init_c37 = __esm({
|
|
|
73874
73965
|
writeFile2("./.node-version", "17");
|
|
73875
73966
|
logRaw("");
|
|
73876
73967
|
};
|
|
73877
|
-
configure4 = async () => {
|
|
73878
|
-
|
|
73968
|
+
configure4 = async (ctx) => {
|
|
73969
|
+
const packages = ["nitro-cloudflare-dev"];
|
|
73970
|
+
if (pm === "pnpm") {
|
|
73971
|
+
packages.push("h3");
|
|
73972
|
+
}
|
|
73973
|
+
await installPackages(packages, {
|
|
73879
73974
|
dev: true,
|
|
73880
73975
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
73881
73976
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm7} install\``)}`
|
|
73882
73977
|
});
|
|
73883
73978
|
updateNuxtConfig();
|
|
73979
|
+
updateEnvTypes(ctx);
|
|
73980
|
+
};
|
|
73981
|
+
updateEnvTypes = (ctx) => {
|
|
73982
|
+
const filepath = "env.d.ts";
|
|
73983
|
+
const s = spinner();
|
|
73984
|
+
s.start(`Updating ${filepath}`);
|
|
73985
|
+
let file = readFile(filepath);
|
|
73986
|
+
let typesEntrypoint = `@cloudflare/workers-types/`;
|
|
73987
|
+
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
73988
|
+
if (latestEntrypoint) {
|
|
73989
|
+
typesEntrypoint += `/${latestEntrypoint}`;
|
|
73990
|
+
}
|
|
73991
|
+
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
73992
|
+
writeFile2("env.d.ts", file);
|
|
73993
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
73884
73994
|
};
|
|
73885
73995
|
updateNuxtConfig = () => {
|
|
73886
73996
|
const s = spinner();
|
|
73887
73997
|
const configFile = "nuxt.config.ts";
|
|
73888
73998
|
s.start(`Updating \`${configFile}\``);
|
|
73889
|
-
const b2 =
|
|
73999
|
+
const b2 = recast3.types.builders;
|
|
73890
74000
|
const presetDef = b2.objectProperty(
|
|
73891
74001
|
b2.identifier("nitro"),
|
|
73892
74002
|
b2.objectExpression([
|
|
@@ -73917,10 +74027,10 @@ var init_c37 = __esm({
|
|
|
73917
74027
|
configVersion: 1,
|
|
73918
74028
|
id: "nuxt",
|
|
73919
74029
|
platform: "pages",
|
|
74030
|
+
displayName: "Nuxt",
|
|
73920
74031
|
copyFiles: {
|
|
73921
74032
|
path: "./templates"
|
|
73922
74033
|
},
|
|
73923
|
-
displayName: "Nuxt",
|
|
73924
74034
|
devScript: "dev",
|
|
73925
74035
|
deployScript: "deploy",
|
|
73926
74036
|
generate: generate7,
|
|
@@ -73928,7 +74038,8 @@ var init_c37 = __esm({
|
|
|
73928
74038
|
transformPackageJson: async () => ({
|
|
73929
74039
|
scripts: {
|
|
73930
74040
|
deploy: `${npm7} run build && wrangler pages deploy ./dist`,
|
|
73931
|
-
preview: `${npm7} run build && wrangler pages dev ./dist
|
|
74041
|
+
preview: `${npm7} run build && wrangler pages dev ./dist`,
|
|
74042
|
+
"build-cf-types": `wrangler types`
|
|
73932
74043
|
}
|
|
73933
74044
|
})
|
|
73934
74045
|
};
|
|
@@ -73941,7 +74052,7 @@ var c3_exports8 = {};
|
|
|
73941
74052
|
__export(c3_exports8, {
|
|
73942
74053
|
default: () => c3_default8
|
|
73943
74054
|
});
|
|
73944
|
-
var npm8, npx4, generate8, configure5, addBindingsProxy, config7, c3_default8;
|
|
74055
|
+
var recast4, npm8, npx4, generate8, configure5, addBindingsProxy, populateCloudflareEnv, config7, c3_default8;
|
|
73945
74056
|
var init_c38 = __esm({
|
|
73946
74057
|
"templates/qwik/c3.ts"() {
|
|
73947
74058
|
init_cli();
|
|
@@ -73951,6 +74062,7 @@ var init_c38 = __esm({
|
|
|
73951
74062
|
init_command();
|
|
73952
74063
|
init_files();
|
|
73953
74064
|
init_packages();
|
|
74065
|
+
recast4 = __toESM(require_main3());
|
|
73954
74066
|
init_common2();
|
|
73955
74067
|
({ npm: npm8, npx: npx4 } = detectPackageManager());
|
|
73956
74068
|
generate8 = async (ctx) => {
|
|
@@ -73961,6 +74073,7 @@ var init_c38 = __esm({
|
|
|
73961
74073
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
73962
74074
|
await runCommand(cmd);
|
|
73963
74075
|
addBindingsProxy(ctx);
|
|
74076
|
+
populateCloudflareEnv();
|
|
73964
74077
|
};
|
|
73965
74078
|
addBindingsProxy = (ctx) => {
|
|
73966
74079
|
if (!usesTypescript(ctx)) {
|
|
@@ -73968,36 +74081,70 @@ var init_c38 = __esm({
|
|
|
73968
74081
|
}
|
|
73969
74082
|
const s = spinner();
|
|
73970
74083
|
s.start("Updating `vite.config.ts`");
|
|
73971
|
-
const
|
|
73972
|
-
|
|
73973
|
-
|
|
73974
|
-
if(process.env.NODE_ENV === 'development') {
|
|
73975
|
-
const { getPlatformProxy } = await import('wrangler');
|
|
73976
|
-
const platformProxy = await getPlatformProxy();
|
|
73977
|
-
env = platformProxy.env;
|
|
73978
|
-
}
|
|
73979
|
-
`;
|
|
74084
|
+
const snippets = loadTemplateSnippets(ctx);
|
|
74085
|
+
const b2 = recast4.types.builders;
|
|
73980
74086
|
transformFile("vite.config.ts", {
|
|
74087
|
+
// Insert the env declaration after the last import (but before the rest of the body)
|
|
73981
74088
|
visitProgram: function(n2) {
|
|
73982
74089
|
const lastImportIndex = n2.node.body.findLastIndex(
|
|
73983
74090
|
(t) => t.type === "ImportDeclaration"
|
|
73984
74091
|
);
|
|
73985
|
-
n2.get("body"
|
|
73986
|
-
|
|
73987
|
-
|
|
73988
|
-
|
|
73989
|
-
|
|
73990
|
-
transformFile("vite.config.ts", {
|
|
74092
|
+
const lastImport = n2.get("body", lastImportIndex);
|
|
74093
|
+
lastImport.insertAfter(...snippets.getPlatformProxyTs);
|
|
74094
|
+
return this.traverse(n2);
|
|
74095
|
+
},
|
|
74096
|
+
// Pass the `platform` object from the declaration to the `qwikCity` plugin
|
|
73991
74097
|
visitCallExpression: function(n2) {
|
|
73992
74098
|
const callee = n2.node.callee;
|
|
73993
|
-
if (callee.name
|
|
73994
|
-
n2
|
|
74099
|
+
if (callee.name !== "qwikCity") {
|
|
74100
|
+
return this.traverse(n2);
|
|
74101
|
+
}
|
|
74102
|
+
const configArgument = n2.node.arguments[0];
|
|
74103
|
+
const platformPropery = b2.objectProperty.from({
|
|
74104
|
+
key: b2.identifier("platform"),
|
|
74105
|
+
value: b2.identifier("platform"),
|
|
74106
|
+
shorthand: true
|
|
74107
|
+
});
|
|
74108
|
+
if (!configArgument) {
|
|
74109
|
+
n2.node.arguments = [b2.objectExpression([platformPropery])];
|
|
74110
|
+
return false;
|
|
73995
74111
|
}
|
|
73996
|
-
|
|
74112
|
+
if (configArgument.type !== "ObjectExpression") {
|
|
74113
|
+
crash("Failed to update `vite.config.ts`");
|
|
74114
|
+
}
|
|
74115
|
+
configArgument.properties.push(platformPropery);
|
|
74116
|
+
return false;
|
|
73997
74117
|
}
|
|
73998
74118
|
});
|
|
73999
74119
|
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
|
|
74000
74120
|
};
|
|
74121
|
+
populateCloudflareEnv = () => {
|
|
74122
|
+
const entrypointPath = "src/entry.cloudflare-pages.tsx";
|
|
74123
|
+
const s = spinner();
|
|
74124
|
+
s.start(`Updating \`${entrypointPath}\``);
|
|
74125
|
+
transformFile(entrypointPath, {
|
|
74126
|
+
visitTSInterfaceDeclaration: function(n2) {
|
|
74127
|
+
const b2 = recast4.types.builders;
|
|
74128
|
+
const id = n2.node.id;
|
|
74129
|
+
if (id.name !== "QwikCityPlatform") {
|
|
74130
|
+
this.traverse(n2);
|
|
74131
|
+
}
|
|
74132
|
+
const newBody = [
|
|
74133
|
+
["env", "Env"]
|
|
74134
|
+
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
|
|
74135
|
+
// ["cf", "CfProperties"],
|
|
74136
|
+
].map(
|
|
74137
|
+
([varName, type]) => b2.tsPropertySignature(
|
|
74138
|
+
b2.identifier(varName),
|
|
74139
|
+
b2.tsTypeAnnotation(b2.tsTypeReference(b2.identifier(type)))
|
|
74140
|
+
)
|
|
74141
|
+
);
|
|
74142
|
+
n2.node.body.body = newBody;
|
|
74143
|
+
return false;
|
|
74144
|
+
}
|
|
74145
|
+
});
|
|
74146
|
+
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
74147
|
+
};
|
|
74001
74148
|
config7 = {
|
|
74002
74149
|
configVersion: 1,
|
|
74003
74150
|
id: "qwik",
|
|
@@ -74012,7 +74159,9 @@ if(process.env.NODE_ENV === 'development') {
|
|
|
74012
74159
|
configure: configure5,
|
|
74013
74160
|
transformPackageJson: async () => ({
|
|
74014
74161
|
scripts: {
|
|
74015
|
-
deploy: `${npm8} run build && wrangler pages deploy ./dist
|
|
74162
|
+
deploy: `${npm8} run build && wrangler pages deploy ./dist`,
|
|
74163
|
+
preview: `${npm8} run build && wrangler pages dev ./dist`,
|
|
74164
|
+
"build-cf-types": `wrangler types`
|
|
74016
74165
|
}
|
|
74017
74166
|
})
|
|
74018
74167
|
};
|
|
@@ -74059,10 +74208,13 @@ var c3_exports10 = {};
|
|
|
74059
74208
|
__export(c3_exports10, {
|
|
74060
74209
|
default: () => c3_default10
|
|
74061
74210
|
});
|
|
74062
|
-
var npm10, generate10, config9, c3_default10;
|
|
74211
|
+
var npm10, generate10, configure6, config9, c3_default10;
|
|
74063
74212
|
var init_c310 = __esm({
|
|
74064
74213
|
"templates/remix/c3.ts"() {
|
|
74065
74214
|
init_cli();
|
|
74215
|
+
init_colors();
|
|
74216
|
+
init_interactive();
|
|
74217
|
+
init_codemod();
|
|
74066
74218
|
init_command();
|
|
74067
74219
|
init_packages();
|
|
74068
74220
|
({ npm: npm10 } = detectPackageManager());
|
|
@@ -74070,22 +74222,45 @@ var init_c310 = __esm({
|
|
|
74070
74222
|
await runFrameworkGenerator(ctx, [
|
|
74071
74223
|
ctx.project.name,
|
|
74072
74224
|
"--template",
|
|
74073
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare
|
|
74225
|
+
"https://github.com/remix-run/remix/tree/main/templates/vite-cloudflare"
|
|
74074
74226
|
]);
|
|
74075
74227
|
logRaw("");
|
|
74076
74228
|
};
|
|
74229
|
+
configure6 = async () => {
|
|
74230
|
+
const typeDefsPath = "load-context.ts";
|
|
74231
|
+
const s = spinner();
|
|
74232
|
+
s.start(`Updating \`${typeDefsPath}\``);
|
|
74233
|
+
transformFile(typeDefsPath, {
|
|
74234
|
+
visitTSInterfaceDeclaration(n2) {
|
|
74235
|
+
if (n2.node.id.type === "Identifier" && n2.node.id.name !== "Env") {
|
|
74236
|
+
return this.traverse(n2);
|
|
74237
|
+
}
|
|
74238
|
+
n2.replace();
|
|
74239
|
+
return false;
|
|
74240
|
+
}
|
|
74241
|
+
});
|
|
74242
|
+
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
74243
|
+
};
|
|
74077
74244
|
config9 = {
|
|
74078
74245
|
configVersion: 1,
|
|
74079
74246
|
id: "remix",
|
|
74080
|
-
displayName: "Remix",
|
|
74081
74247
|
platform: "pages",
|
|
74248
|
+
displayName: "Remix",
|
|
74249
|
+
copyFiles: {
|
|
74250
|
+
path: "./templates"
|
|
74251
|
+
},
|
|
74082
74252
|
generate: generate10,
|
|
74253
|
+
configure: configure6,
|
|
74083
74254
|
transformPackageJson: async () => ({
|
|
74084
74255
|
scripts: {
|
|
74085
|
-
|
|
74256
|
+
deploy: `${npm10} run build && wrangler pages deploy ./build/client`,
|
|
74257
|
+
preview: `${npm10} run build && wrangler pages dev ./build/client`,
|
|
74258
|
+
"build-cf-types": `wrangler types`
|
|
74086
74259
|
}
|
|
74087
74260
|
}),
|
|
74088
74261
|
devScript: "dev",
|
|
74262
|
+
deployScript: "deploy",
|
|
74263
|
+
previewScript: "preview",
|
|
74089
74264
|
testFlags: ["--typescript", "--no-install", "--no-git-init"]
|
|
74090
74265
|
};
|
|
74091
74266
|
c3_default10 = config9;
|
|
@@ -74097,38 +74272,74 @@ var c3_exports11 = {};
|
|
|
74097
74272
|
__export(c3_exports11, {
|
|
74098
74273
|
default: () => c3_default11
|
|
74099
74274
|
});
|
|
74100
|
-
var npm11, generate11, config10, c3_default11;
|
|
74275
|
+
var recast5, npm11, generate11, configure7, config10, c3_default11;
|
|
74101
74276
|
var init_c311 = __esm({
|
|
74102
74277
|
"templates/solid/c3.ts"() {
|
|
74103
74278
|
init_cli();
|
|
74279
|
+
init_colors();
|
|
74280
|
+
init_codemod();
|
|
74104
74281
|
init_command();
|
|
74105
74282
|
init_files();
|
|
74106
74283
|
init_packages();
|
|
74284
|
+
recast5 = __toESM(require_main3());
|
|
74107
74285
|
({ npm: npm11 } = detectPackageManager());
|
|
74108
74286
|
generate11 = async (ctx) => {
|
|
74109
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
74287
|
+
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
74110
74288
|
logRaw("");
|
|
74111
74289
|
};
|
|
74290
|
+
configure7 = async (ctx) => {
|
|
74291
|
+
usesTypescript(ctx);
|
|
74292
|
+
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
74293
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
74294
|
+
transformFile(filePath, {
|
|
74295
|
+
visitCallExpression: function(n2) {
|
|
74296
|
+
const callee = n2.node.callee;
|
|
74297
|
+
if (callee.name !== "defineConfig") {
|
|
74298
|
+
return this.traverse(n2);
|
|
74299
|
+
}
|
|
74300
|
+
const b2 = recast5.types.builders;
|
|
74301
|
+
n2.node.arguments = [
|
|
74302
|
+
b2.objectExpression([
|
|
74303
|
+
b2.objectProperty(
|
|
74304
|
+
b2.identifier("server"),
|
|
74305
|
+
b2.objectExpression([
|
|
74306
|
+
b2.objectProperty(
|
|
74307
|
+
b2.identifier("preset"),
|
|
74308
|
+
b2.stringLiteral("cloudflare-pages")
|
|
74309
|
+
),
|
|
74310
|
+
b2.objectProperty(
|
|
74311
|
+
b2.identifier("rollupConfig"),
|
|
74312
|
+
b2.objectExpression([
|
|
74313
|
+
b2.objectProperty(
|
|
74314
|
+
b2.identifier("external"),
|
|
74315
|
+
b2.arrayExpression([b2.stringLiteral("node:async_hooks")])
|
|
74316
|
+
)
|
|
74317
|
+
])
|
|
74318
|
+
)
|
|
74319
|
+
])
|
|
74320
|
+
)
|
|
74321
|
+
])
|
|
74322
|
+
];
|
|
74323
|
+
return false;
|
|
74324
|
+
}
|
|
74325
|
+
});
|
|
74326
|
+
};
|
|
74112
74327
|
config10 = {
|
|
74113
74328
|
configVersion: 1,
|
|
74114
74329
|
id: "solid",
|
|
74115
74330
|
displayName: "Solid",
|
|
74116
74331
|
platform: "pages",
|
|
74117
|
-
copyFiles: {
|
|
74118
|
-
variants: {
|
|
74119
|
-
js: { path: "./js" },
|
|
74120
|
-
ts: { path: "./ts" }
|
|
74121
|
-
}
|
|
74122
|
-
},
|
|
74123
74332
|
generate: generate11,
|
|
74333
|
+
configure: configure7,
|
|
74124
74334
|
transformPackageJson: async () => ({
|
|
74125
74335
|
scripts: {
|
|
74126
|
-
|
|
74127
|
-
|
|
74336
|
+
preview: `${npm11} run build && npx wrangler pages dev dist ${await compatDateFlag()} --compatibility-flag nodejs_compat`,
|
|
74337
|
+
deploy: `${npm11} run build && wrangler pages deploy ./dist`
|
|
74128
74338
|
}
|
|
74129
74339
|
}),
|
|
74130
74340
|
devScript: "dev",
|
|
74131
|
-
|
|
74341
|
+
deployScript: "deploy",
|
|
74342
|
+
previewScript: "preview",
|
|
74132
74343
|
compatibilityFlags: ["nodejs_compat"]
|
|
74133
74344
|
};
|
|
74134
74345
|
c3_default11 = config10;
|
|
@@ -74140,7 +74351,7 @@ var c3_exports12 = {};
|
|
|
74140
74351
|
__export(c3_exports12, {
|
|
74141
74352
|
default: () => c3_default12
|
|
74142
74353
|
});
|
|
74143
|
-
var import_node_os,
|
|
74354
|
+
var import_node_os, recast6, npm12, generate12, configure8, updateSvelteConfig, updateTypeDefinitions, config11, c3_default12;
|
|
74144
74355
|
var init_c312 = __esm({
|
|
74145
74356
|
"templates/svelte/c3.ts"() {
|
|
74146
74357
|
import_node_os = require("node:os");
|
|
@@ -74150,13 +74361,13 @@ var init_c312 = __esm({
|
|
|
74150
74361
|
init_command();
|
|
74151
74362
|
init_files();
|
|
74152
74363
|
init_packages();
|
|
74153
|
-
|
|
74364
|
+
recast6 = __toESM(require_main3());
|
|
74154
74365
|
({ npm: npm12 } = detectPackageManager());
|
|
74155
74366
|
generate12 = async (ctx) => {
|
|
74156
74367
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
74157
74368
|
logRaw("");
|
|
74158
74369
|
};
|
|
74159
|
-
|
|
74370
|
+
configure8 = async (ctx) => {
|
|
74160
74371
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
74161
74372
|
await installPackages([pkg], {
|
|
74162
74373
|
dev: true,
|
|
@@ -74183,7 +74394,7 @@ var init_c312 = __esm({
|
|
|
74183
74394
|
return;
|
|
74184
74395
|
}
|
|
74185
74396
|
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
74186
|
-
const b2 =
|
|
74397
|
+
const b2 = recast6.types.builders;
|
|
74187
74398
|
transformFile("src/app.d.ts", {
|
|
74188
74399
|
visitTSModuleDeclaration(n2) {
|
|
74189
74400
|
if (n2.value.id.name === "App" && n2.node.body) {
|
|
@@ -74227,7 +74438,7 @@ var init_c312 = __esm({
|
|
|
74227
74438
|
}
|
|
74228
74439
|
},
|
|
74229
74440
|
generate: generate12,
|
|
74230
|
-
configure:
|
|
74441
|
+
configure: configure8,
|
|
74231
74442
|
transformPackageJson: async (original, ctx) => {
|
|
74232
74443
|
let scripts = {
|
|
74233
74444
|
preview: `${npm12} run build && wrangler pages dev .svelte-kit/cloudflare`,
|
|
@@ -74550,15 +74761,15 @@ async function copyTemplateFiles(ctx) {
|
|
|
74550
74761
|
s.start(`Copying template files`);
|
|
74551
74762
|
await (0, import_promises2.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
74552
74763
|
const dummyGitIgnorePath = (0, import_path12.join)(destdir, "__dot__gitignore");
|
|
74553
|
-
if ((0,
|
|
74764
|
+
if ((0, import_fs10.existsSync)(dummyGitIgnorePath)) {
|
|
74554
74765
|
await (0, import_promises2.rename)(dummyGitIgnorePath, (0, import_path12.join)(destdir, ".gitignore"));
|
|
74555
74766
|
}
|
|
74556
74767
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
74557
74768
|
}
|
|
74558
|
-
var
|
|
74769
|
+
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;
|
|
74559
74770
|
var init_templates = __esm({
|
|
74560
74771
|
"src/templates.ts"() {
|
|
74561
|
-
|
|
74772
|
+
import_fs10 = require("fs");
|
|
74562
74773
|
import_promises2 = require("fs/promises");
|
|
74563
74774
|
import_os2 = require("os");
|
|
74564
74775
|
import_path12 = require("path");
|
|
@@ -74721,12 +74932,12 @@ var init_templates = __esm({
|
|
|
74721
74932
|
validateTemplateSrcDirectory = (path3, config13) => {
|
|
74722
74933
|
if (config13.platform === "workers") {
|
|
74723
74934
|
const wranglerTomlPath = (0, import_path12.resolve)(path3, "wrangler.toml");
|
|
74724
|
-
if (!(0,
|
|
74935
|
+
if (!(0, import_fs10.existsSync)(wranglerTomlPath)) {
|
|
74725
74936
|
crash(`create-cloudflare templates must contain a "wrangler.toml" file.`);
|
|
74726
74937
|
}
|
|
74727
74938
|
}
|
|
74728
74939
|
const pkgJsonPath = (0, import_path12.resolve)(path3, "package.json");
|
|
74729
|
-
if (!(0,
|
|
74940
|
+
if (!(0, import_fs10.existsSync)(pkgJsonPath)) {
|
|
74730
74941
|
crash(`create-cloudflare templates must contain a "package.json" file.`);
|
|
74731
74942
|
}
|
|
74732
74943
|
};
|
|
@@ -74741,10 +74952,10 @@ var init_templates = __esm({
|
|
|
74741
74952
|
};
|
|
74742
74953
|
inferCopyFilesDefinition = (path3) => {
|
|
74743
74954
|
const variants = {};
|
|
74744
|
-
if ((0,
|
|
74955
|
+
if ((0, import_fs10.existsSync)((0, import_path12.join)(path3, "js"))) {
|
|
74745
74956
|
variants["js"] = { path: "./js" };
|
|
74746
74957
|
}
|
|
74747
|
-
if ((0,
|
|
74958
|
+
if ((0, import_fs10.existsSync)((0, import_path12.join)(path3, "ts"))) {
|
|
74748
74959
|
variants["ts"] = { path: "./ts" };
|
|
74749
74960
|
}
|
|
74750
74961
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
@@ -74813,6 +75024,45 @@ var init_templates = __esm({
|
|
|
74813
75024
|
}
|
|
74814
75025
|
return copyFiles.destinationDir(ctx);
|
|
74815
75026
|
};
|
|
75027
|
+
addWranglerToGitIgnore = (ctx) => {
|
|
75028
|
+
const gitIgnorePath = `${ctx.project.path}/.gitignore`;
|
|
75029
|
+
const gitIgnorePreExisted = (0, import_fs10.existsSync)(gitIgnorePath);
|
|
75030
|
+
const gitDirExists = directoryExists(`${ctx.project.path}/.git`);
|
|
75031
|
+
if (!gitIgnorePreExisted && !gitDirExists) {
|
|
75032
|
+
return;
|
|
75033
|
+
}
|
|
75034
|
+
if (!gitIgnorePreExisted) {
|
|
75035
|
+
writeFile2(gitIgnorePath, "");
|
|
75036
|
+
}
|
|
75037
|
+
const existingGitIgnoreContent = readFile(gitIgnorePath);
|
|
75038
|
+
const wranglerGitIgnoreFiles = [".wrangler", ".dev.vars"];
|
|
75039
|
+
const wranglerGitIgnoreFilesToAdd = wranglerGitIgnoreFiles.filter(
|
|
75040
|
+
(file) => !existingGitIgnoreContent.match(
|
|
75041
|
+
new RegExp(`
|
|
75042
|
+
${file}${file === ".wrangler" ? "/?" : ""}\\s+(#'*)?`)
|
|
75043
|
+
)
|
|
75044
|
+
);
|
|
75045
|
+
if (wranglerGitIgnoreFilesToAdd.length === 0) {
|
|
75046
|
+
return;
|
|
75047
|
+
}
|
|
75048
|
+
const s = spinner();
|
|
75049
|
+
s.start("Adding Wrangler files to the .gitignore file");
|
|
75050
|
+
const linesToAppend = [
|
|
75051
|
+
"",
|
|
75052
|
+
...!existingGitIgnoreContent.match(/\n\s*$/) ? [""] : []
|
|
75053
|
+
];
|
|
75054
|
+
if (wranglerGitIgnoreFilesToAdd.length === wranglerGitIgnoreFiles.length) {
|
|
75055
|
+
linesToAppend.push("# wrangler files");
|
|
75056
|
+
}
|
|
75057
|
+
wranglerGitIgnoreFilesToAdd.forEach((line) => linesToAppend.push(line));
|
|
75058
|
+
linesToAppend.push("");
|
|
75059
|
+
appendFile(gitIgnorePath, linesToAppend.join("\n"));
|
|
75060
|
+
s.stop(
|
|
75061
|
+
`${brandColor(gitIgnorePreExisted ? "updated" : "created")} ${dim(
|
|
75062
|
+
".gitignore file"
|
|
75063
|
+
)}`
|
|
75064
|
+
);
|
|
75065
|
+
};
|
|
74816
75066
|
}
|
|
74817
75067
|
});
|
|
74818
75068
|
|
|
@@ -79924,7 +80174,7 @@ var runCli = async (args) => {
|
|
|
79924
80174
|
};
|
|
79925
80175
|
var runTemplate = async (ctx) => {
|
|
79926
80176
|
await create(ctx);
|
|
79927
|
-
await
|
|
80177
|
+
await configure9(ctx);
|
|
79928
80178
|
await deploy(ctx);
|
|
79929
80179
|
await printSummary(ctx);
|
|
79930
80180
|
};
|
|
@@ -79940,7 +80190,7 @@ var create = async (ctx) => {
|
|
|
79940
80190
|
await rectifyPmMismatch(ctx);
|
|
79941
80191
|
endSection(`Application created`);
|
|
79942
80192
|
};
|
|
79943
|
-
var
|
|
80193
|
+
var configure9 = async (ctx) => {
|
|
79944
80194
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
79945
80195
|
await installWrangler();
|
|
79946
80196
|
await installWorkersTypes(ctx);
|
|
@@ -79949,6 +80199,7 @@ var configure7 = async (ctx) => {
|
|
|
79949
80199
|
if (template.configure) {
|
|
79950
80200
|
await template.configure({ ...ctx });
|
|
79951
80201
|
}
|
|
80202
|
+
addWranglerToGitIgnore(ctx);
|
|
79952
80203
|
await updatePackageScripts(ctx);
|
|
79953
80204
|
await offerGit(ctx);
|
|
79954
80205
|
await gitCommit(ctx);
|