@vercel/node 5.0.2 → 5.0.3
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/dev-server.mjs +1 -0
- package/dist/index.js +475 -455
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -33,157 +33,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
33
33
|
));
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
35
35
|
|
36
|
-
// ../../node_modules/.pnpm/@tootallnate+once@1.1.2/node_modules/@tootallnate/once/dist/index.js
|
37
|
-
var require_dist = __commonJS({
|
38
|
-
"../../node_modules/.pnpm/@tootallnate+once@1.1.2/node_modules/@tootallnate/once/dist/index.js"(exports, module2) {
|
39
|
-
"use strict";
|
40
|
-
function noop() {
|
41
|
-
}
|
42
|
-
function once3(emitter, name) {
|
43
|
-
const o = once3.spread(emitter, name);
|
44
|
-
const r = o.then((args) => args[0]);
|
45
|
-
r.cancel = o.cancel;
|
46
|
-
return r;
|
47
|
-
}
|
48
|
-
(function(once4) {
|
49
|
-
function spread(emitter, name) {
|
50
|
-
let c = null;
|
51
|
-
const p = new Promise((resolve2, reject) => {
|
52
|
-
function cancel() {
|
53
|
-
emitter.removeListener(name, onEvent);
|
54
|
-
emitter.removeListener("error", onError);
|
55
|
-
p.cancel = noop;
|
56
|
-
}
|
57
|
-
function onEvent(...args) {
|
58
|
-
cancel();
|
59
|
-
resolve2(args);
|
60
|
-
}
|
61
|
-
function onError(err) {
|
62
|
-
cancel();
|
63
|
-
reject(err);
|
64
|
-
}
|
65
|
-
c = cancel;
|
66
|
-
emitter.on(name, onEvent);
|
67
|
-
emitter.on("error", onError);
|
68
|
-
});
|
69
|
-
if (!c) {
|
70
|
-
throw new TypeError("Could not get `cancel()` function");
|
71
|
-
}
|
72
|
-
p.cancel = c;
|
73
|
-
return p;
|
74
|
-
}
|
75
|
-
once4.spread = spread;
|
76
|
-
})(once3 || (once3 = {}));
|
77
|
-
module2.exports = once3;
|
78
|
-
}
|
79
|
-
});
|
80
|
-
|
81
|
-
// ../../node_modules/.pnpm/tree-kill@1.2.2/node_modules/tree-kill/index.js
|
82
|
-
var require_tree_kill = __commonJS({
|
83
|
-
"../../node_modules/.pnpm/tree-kill@1.2.2/node_modules/tree-kill/index.js"(exports, module2) {
|
84
|
-
"use strict";
|
85
|
-
var childProcess = require("child_process");
|
86
|
-
var spawn2 = childProcess.spawn;
|
87
|
-
var exec = childProcess.exec;
|
88
|
-
module2.exports = function(pid, signal, callback) {
|
89
|
-
if (typeof signal === "function" && callback === void 0) {
|
90
|
-
callback = signal;
|
91
|
-
signal = void 0;
|
92
|
-
}
|
93
|
-
pid = parseInt(pid);
|
94
|
-
if (Number.isNaN(pid)) {
|
95
|
-
if (callback) {
|
96
|
-
return callback(new Error("pid must be a number"));
|
97
|
-
} else {
|
98
|
-
throw new Error("pid must be a number");
|
99
|
-
}
|
100
|
-
}
|
101
|
-
var tree = {};
|
102
|
-
var pidsToProcess = {};
|
103
|
-
tree[pid] = [];
|
104
|
-
pidsToProcess[pid] = 1;
|
105
|
-
switch (process.platform) {
|
106
|
-
case "win32":
|
107
|
-
exec("taskkill /pid " + pid + " /T /F", callback);
|
108
|
-
break;
|
109
|
-
case "darwin":
|
110
|
-
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
|
111
|
-
return spawn2("pgrep", ["-P", parentPid]);
|
112
|
-
}, function() {
|
113
|
-
killAll(tree, signal, callback);
|
114
|
-
});
|
115
|
-
break;
|
116
|
-
default:
|
117
|
-
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
|
118
|
-
return spawn2("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
|
119
|
-
}, function() {
|
120
|
-
killAll(tree, signal, callback);
|
121
|
-
});
|
122
|
-
break;
|
123
|
-
}
|
124
|
-
};
|
125
|
-
function killAll(tree, signal, callback) {
|
126
|
-
var killed = {};
|
127
|
-
try {
|
128
|
-
Object.keys(tree).forEach(function(pid) {
|
129
|
-
tree[pid].forEach(function(pidpid) {
|
130
|
-
if (!killed[pidpid]) {
|
131
|
-
killPid(pidpid, signal);
|
132
|
-
killed[pidpid] = 1;
|
133
|
-
}
|
134
|
-
});
|
135
|
-
if (!killed[pid]) {
|
136
|
-
killPid(pid, signal);
|
137
|
-
killed[pid] = 1;
|
138
|
-
}
|
139
|
-
});
|
140
|
-
} catch (err) {
|
141
|
-
if (callback) {
|
142
|
-
return callback(err);
|
143
|
-
} else {
|
144
|
-
throw err;
|
145
|
-
}
|
146
|
-
}
|
147
|
-
if (callback) {
|
148
|
-
return callback();
|
149
|
-
}
|
150
|
-
}
|
151
|
-
function killPid(pid, signal) {
|
152
|
-
try {
|
153
|
-
process.kill(parseInt(pid, 10), signal);
|
154
|
-
} catch (err) {
|
155
|
-
if (err.code !== "ESRCH")
|
156
|
-
throw err;
|
157
|
-
}
|
158
|
-
}
|
159
|
-
function buildProcessTree(parentPid, tree, pidsToProcess, spawnChildProcessesList, cb) {
|
160
|
-
var ps = spawnChildProcessesList(parentPid);
|
161
|
-
var allData = "";
|
162
|
-
ps.stdout.on("data", function(data) {
|
163
|
-
var data = data.toString("ascii");
|
164
|
-
allData += data;
|
165
|
-
});
|
166
|
-
var onClose = function(code) {
|
167
|
-
delete pidsToProcess[parentPid];
|
168
|
-
if (code != 0) {
|
169
|
-
if (Object.keys(pidsToProcess).length == 0) {
|
170
|
-
cb();
|
171
|
-
}
|
172
|
-
return;
|
173
|
-
}
|
174
|
-
allData.match(/\d+/g).forEach(function(pid) {
|
175
|
-
pid = parseInt(pid, 10);
|
176
|
-
tree[parentPid].push(pid);
|
177
|
-
tree[pid] = [];
|
178
|
-
pidsToProcess[pid] = 1;
|
179
|
-
buildProcessTree(pid, tree, pidsToProcess, spawnChildProcessesList, cb);
|
180
|
-
});
|
181
|
-
};
|
182
|
-
ps.on("close", onClose);
|
183
|
-
}
|
184
|
-
}
|
185
|
-
});
|
186
|
-
|
187
36
|
// ../../node_modules/.pnpm/@babel+types@7.26.3/node_modules/@babel/types/lib/utils/shallowEqual.js
|
188
37
|
var require_shallowEqual = __commonJS({
|
189
38
|
"../../node_modules/.pnpm/@babel+types@7.26.3/node_modules/@babel/types/lib/utils/shallowEqual.js"(exports) {
|
@@ -36616,7 +36465,7 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
36616
36465
|
intToChar[i] = c;
|
36617
36466
|
charToInt[c] = i;
|
36618
36467
|
}
|
36619
|
-
function decodeInteger(reader,
|
36468
|
+
function decodeInteger(reader, relative4) {
|
36620
36469
|
let value2 = 0;
|
36621
36470
|
let shift = 0;
|
36622
36471
|
let integer = 0;
|
@@ -36631,10 +36480,10 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
36631
36480
|
if (shouldNegate) {
|
36632
36481
|
value2 = -2147483648 | -value2;
|
36633
36482
|
}
|
36634
|
-
return
|
36483
|
+
return relative4 + value2;
|
36635
36484
|
}
|
36636
|
-
function encodeInteger(builder, num,
|
36637
|
-
let delta = num -
|
36485
|
+
function encodeInteger(builder, num, relative4) {
|
36486
|
+
let delta = num - relative4;
|
36638
36487
|
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
36639
36488
|
do {
|
36640
36489
|
let clamped = delta & 31;
|
@@ -37144,7 +36993,7 @@ var require_resolve_uri_umd = __commonJS({
|
|
37144
36993
|
}
|
37145
36994
|
url2.path = path;
|
37146
36995
|
}
|
37147
|
-
function
|
36996
|
+
function resolve3(input, base) {
|
37148
36997
|
if (!input && !base)
|
37149
36998
|
return "";
|
37150
36999
|
const url2 = parseUrl(input);
|
@@ -37191,7 +37040,7 @@ var require_resolve_uri_umd = __commonJS({
|
|
37191
37040
|
return url2.scheme + "//" + url2.user + url2.host + url2.port + url2.path + queryHash;
|
37192
37041
|
}
|
37193
37042
|
}
|
37194
|
-
return
|
37043
|
+
return resolve3;
|
37195
37044
|
});
|
37196
37045
|
}
|
37197
37046
|
});
|
@@ -37203,7 +37052,7 @@ var require_trace_mapping_umd = __commonJS({
|
|
37203
37052
|
typeof exports === "object" && typeof module2 !== "undefined" ? factory(exports, require_sourcemap_codec_umd(), require_resolve_uri_umd()) : typeof define === "function" && define.amd ? define(["exports", "@jridgewell/sourcemap-codec", "@jridgewell/resolve-uri"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.traceMapping = {}, global2.sourcemapCodec, global2.resolveURI));
|
37204
37053
|
})(exports, function(exports2, sourcemapCodec, resolveUri) {
|
37205
37054
|
"use strict";
|
37206
|
-
function
|
37055
|
+
function resolve3(input, base) {
|
37207
37056
|
if (base && !base.endsWith("/"))
|
37208
37057
|
base += "/";
|
37209
37058
|
return resolveUri(input, base);
|
@@ -37455,8 +37304,8 @@ var require_trace_mapping_umd = __commonJS({
|
|
37455
37304
|
this.sources = sources;
|
37456
37305
|
this.sourcesContent = sourcesContent;
|
37457
37306
|
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
37458
|
-
const from =
|
37459
|
-
this.resolvedSources = sources.map((s) =>
|
37307
|
+
const from = resolve3(sourceRoot || "", stripFilename(mapUrl));
|
37308
|
+
this.resolvedSources = sources.map((s) => resolve3(s || "", from));
|
37460
37309
|
const { mappings } = parsed;
|
37461
37310
|
if (typeof mappings === "string") {
|
37462
37311
|
this._encoded = mappings;
|
@@ -46079,7 +45928,7 @@ var require_introspection = __commonJS({
|
|
46079
45928
|
exports.isStatic = isStatic;
|
46080
45929
|
exports.matchesPattern = matchesPattern;
|
46081
45930
|
exports.referencesImport = referencesImport;
|
46082
|
-
exports.resolve =
|
45931
|
+
exports.resolve = resolve3;
|
46083
45932
|
exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore;
|
46084
45933
|
var _t = require_lib3();
|
46085
45934
|
var {
|
@@ -46349,7 +46198,7 @@ var require_introspection = __commonJS({
|
|
46349
46198
|
nodeMap.set(target.node, result);
|
46350
46199
|
return result;
|
46351
46200
|
}
|
46352
|
-
function
|
46201
|
+
function resolve3(dangerous, resolved) {
|
46353
46202
|
return _resolve.call(this, dangerous, resolved) || this;
|
46354
46203
|
}
|
46355
46204
|
function _resolve(dangerous, resolved) {
|
@@ -51112,10 +50961,10 @@ var require_gensync = __commonJS({
|
|
51112
50961
|
const items = Array.from(args[0]);
|
51113
50962
|
return items.map((item) => evaluateSync(item));
|
51114
50963
|
},
|
51115
|
-
async: function(args,
|
50964
|
+
async: function(args, resolve3, reject) {
|
51116
50965
|
const items = Array.from(args[0]);
|
51117
50966
|
if (items.length === 0) {
|
51118
|
-
Promise.resolve().then(() =>
|
50967
|
+
Promise.resolve().then(() => resolve3([]));
|
51119
50968
|
return;
|
51120
50969
|
}
|
51121
50970
|
let count = 0;
|
@@ -51127,7 +50976,7 @@ var require_gensync = __commonJS({
|
|
51127
50976
|
results[i] = val;
|
51128
50977
|
count += 1;
|
51129
50978
|
if (count === results.length)
|
51130
|
-
|
50979
|
+
resolve3(results);
|
51131
50980
|
},
|
51132
50981
|
reject
|
51133
50982
|
);
|
@@ -51144,13 +50993,13 @@ var require_gensync = __commonJS({
|
|
51144
50993
|
}
|
51145
50994
|
return evaluateSync(items[0]);
|
51146
50995
|
},
|
51147
|
-
async: function(args,
|
50996
|
+
async: function(args, resolve3, reject) {
|
51148
50997
|
const items = Array.from(args[0]);
|
51149
50998
|
if (items.length === 0) {
|
51150
50999
|
throw makeError("Must race at least 1 item", GENSYNC_RACE_NONEMPTY);
|
51151
51000
|
}
|
51152
51001
|
for (const item of items) {
|
51153
|
-
evaluateAsync(item,
|
51002
|
+
evaluateAsync(item, resolve3, reject);
|
51154
51003
|
}
|
51155
51004
|
}
|
51156
51005
|
})
|
@@ -51162,8 +51011,8 @@ var require_gensync = __commonJS({
|
|
51162
51011
|
return evaluateSync(genFn.apply(this, args));
|
51163
51012
|
},
|
51164
51013
|
async: function(...args) {
|
51165
|
-
return new Promise((
|
51166
|
-
evaluateAsync(genFn.apply(this, args),
|
51014
|
+
return new Promise((resolve3, reject) => {
|
51015
|
+
evaluateAsync(genFn.apply(this, args), resolve3, reject);
|
51167
51016
|
});
|
51168
51017
|
},
|
51169
51018
|
errback: function(...args) {
|
@@ -51261,18 +51110,18 @@ var require_gensync = __commonJS({
|
|
51261
51110
|
sync: function(args) {
|
51262
51111
|
return sync.apply(this, args);
|
51263
51112
|
},
|
51264
|
-
async: function(args,
|
51113
|
+
async: function(args, resolve3, reject) {
|
51265
51114
|
if (async) {
|
51266
|
-
async.apply(this, args).then(
|
51115
|
+
async.apply(this, args).then(resolve3, reject);
|
51267
51116
|
} else if (errback) {
|
51268
51117
|
errback.call(this, ...args, (err, value2) => {
|
51269
51118
|
if (err == null)
|
51270
|
-
|
51119
|
+
resolve3(value2);
|
51271
51120
|
else
|
51272
51121
|
reject(err);
|
51273
51122
|
});
|
51274
51123
|
} else {
|
51275
|
-
|
51124
|
+
resolve3(sync.apply(this, args));
|
51276
51125
|
}
|
51277
51126
|
}
|
51278
51127
|
});
|
@@ -51325,7 +51174,7 @@ var require_gensync = __commonJS({
|
|
51325
51174
|
}
|
51326
51175
|
return value2;
|
51327
51176
|
}
|
51328
|
-
function evaluateAsync(gen,
|
51177
|
+
function evaluateAsync(gen, resolve3, reject) {
|
51329
51178
|
(function step() {
|
51330
51179
|
try {
|
51331
51180
|
let value2;
|
@@ -51346,7 +51195,7 @@ var require_gensync = __commonJS({
|
|
51346
51195
|
return;
|
51347
51196
|
}
|
51348
51197
|
}
|
51349
|
-
return
|
51198
|
+
return resolve3(value2);
|
51350
51199
|
} catch (err) {
|
51351
51200
|
return reject(err);
|
51352
51201
|
}
|
@@ -51434,7 +51283,7 @@ var require_async = __commonJS({
|
|
51434
51283
|
};
|
51435
51284
|
return data;
|
51436
51285
|
}
|
51437
|
-
function asyncGeneratorStep(gen,
|
51286
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
51438
51287
|
try {
|
51439
51288
|
var info = gen[key](arg);
|
51440
51289
|
var value2 = info.value;
|
@@ -51443,7 +51292,7 @@ var require_async = __commonJS({
|
|
51443
51292
|
return;
|
51444
51293
|
}
|
51445
51294
|
if (info.done) {
|
51446
|
-
|
51295
|
+
resolve3(value2);
|
51447
51296
|
} else {
|
51448
51297
|
Promise.resolve(value2).then(_next, _throw);
|
51449
51298
|
}
|
@@ -51451,13 +51300,13 @@ var require_async = __commonJS({
|
|
51451
51300
|
function _asyncToGenerator(fn) {
|
51452
51301
|
return function() {
|
51453
51302
|
var self2 = this, args = arguments;
|
51454
|
-
return new Promise(function(
|
51303
|
+
return new Promise(function(resolve3, reject) {
|
51455
51304
|
var gen = fn.apply(self2, args);
|
51456
51305
|
function _next(value2) {
|
51457
|
-
asyncGeneratorStep(gen,
|
51306
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value2);
|
51458
51307
|
}
|
51459
51308
|
function _throw(err) {
|
51460
|
-
asyncGeneratorStep(gen,
|
51309
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err);
|
51461
51310
|
}
|
51462
51311
|
_next(void 0);
|
51463
51312
|
});
|
@@ -51831,8 +51680,8 @@ var require_caching = __commonJS({
|
|
51831
51680
|
this.released = false;
|
51832
51681
|
this.promise = void 0;
|
51833
51682
|
this._resolve = void 0;
|
51834
|
-
this.promise = new Promise((
|
51835
|
-
this._resolve =
|
51683
|
+
this.promise = new Promise((resolve3) => {
|
51684
|
+
this._resolve = resolve3;
|
51836
51685
|
});
|
51837
51686
|
}
|
51838
51687
|
release(value2) {
|
@@ -52088,16 +51937,16 @@ var require_package = __commonJS({
|
|
52088
51937
|
let pkg = null;
|
52089
51938
|
const directories = [];
|
52090
51939
|
let isPackage = true;
|
52091
|
-
let
|
52092
|
-
while (!pkg && _path().basename(
|
52093
|
-
directories.push(
|
52094
|
-
pkg = yield* readConfigPackage(_path().join(
|
52095
|
-
const nextLoc = _path().dirname(
|
52096
|
-
if (
|
51940
|
+
let dirname4 = _path().dirname(filepath);
|
51941
|
+
while (!pkg && _path().basename(dirname4) !== "node_modules") {
|
51942
|
+
directories.push(dirname4);
|
51943
|
+
pkg = yield* readConfigPackage(_path().join(dirname4, PACKAGE_FILENAME));
|
51944
|
+
const nextLoc = _path().dirname(dirname4);
|
51945
|
+
if (dirname4 === nextLoc) {
|
52097
51946
|
isPackage = false;
|
52098
51947
|
break;
|
52099
51948
|
}
|
52100
|
-
|
51949
|
+
dirname4 = nextLoc;
|
52101
51950
|
}
|
52102
51951
|
return {
|
52103
51952
|
filepath,
|
@@ -53404,9 +53253,9 @@ var require_functional = __commonJS({
|
|
53404
53253
|
};
|
53405
53254
|
}
|
53406
53255
|
} else {
|
53407
|
-
let
|
53256
|
+
let resolve3, reject;
|
53408
53257
|
resultP = new Promise((res, rej) => {
|
53409
|
-
|
53258
|
+
resolve3 = res;
|
53410
53259
|
reject = rej;
|
53411
53260
|
});
|
53412
53261
|
try {
|
@@ -53416,7 +53265,7 @@ var require_functional = __commonJS({
|
|
53416
53265
|
};
|
53417
53266
|
resultP = null;
|
53418
53267
|
if (promiseReferenced)
|
53419
|
-
|
53268
|
+
resolve3(result.value);
|
53420
53269
|
} catch (error) {
|
53421
53270
|
result = {
|
53422
53271
|
ok: false,
|
@@ -54598,7 +54447,7 @@ var require_browserslist = __commonJS({
|
|
54598
54447
|
function isSupported(flags, withPartial) {
|
54599
54448
|
return typeof flags === "string" && (flags.indexOf("y") >= 0 || withPartial && flags.indexOf("a") >= 0);
|
54600
54449
|
}
|
54601
|
-
function
|
54450
|
+
function resolve3(queries, context) {
|
54602
54451
|
return parse(QUERIES, queries).reduce(function(result, node, index) {
|
54603
54452
|
if (node.not && index === 0) {
|
54604
54453
|
throw new BrowserslistError(
|
@@ -54687,7 +54536,7 @@ var require_browserslist = __commonJS({
|
|
54687
54536
|
var cacheKey = JSON.stringify([queries, context]);
|
54688
54537
|
if (cache[cacheKey])
|
54689
54538
|
return cache[cacheKey];
|
54690
|
-
var result = uniq(
|
54539
|
+
var result = uniq(resolve3(queries, context)).sort(function(name1, name2) {
|
54691
54540
|
name1 = name1.split(" ");
|
54692
54541
|
name2 = name2.split(" ");
|
54693
54542
|
if (name1[0] === name2[0]) {
|
@@ -55291,7 +55140,7 @@ var require_browserslist = __commonJS({
|
|
55291
55140
|
matches: [],
|
55292
55141
|
regexp: /^current\s+node$/i,
|
55293
55142
|
select: function(context) {
|
55294
|
-
return [env.currentNode(
|
55143
|
+
return [env.currentNode(resolve3, context)];
|
55295
55144
|
}
|
55296
55145
|
},
|
55297
55146
|
maintained_node: {
|
@@ -55304,7 +55153,7 @@ var require_browserslist = __commonJS({
|
|
55304
55153
|
}).map(function(key) {
|
55305
55154
|
return "node " + key.slice(1);
|
55306
55155
|
});
|
55307
|
-
return
|
55156
|
+
return resolve3(queries, context);
|
55308
55157
|
}
|
55309
55158
|
},
|
55310
55159
|
phantomjs_1_9: {
|
@@ -55363,14 +55212,14 @@ var require_browserslist = __commonJS({
|
|
55363
55212
|
matches: ["config"],
|
55364
55213
|
regexp: /^extends (.+)$/i,
|
55365
55214
|
select: function(context, node) {
|
55366
|
-
return
|
55215
|
+
return resolve3(env.loadQueries(context, node.config), context);
|
55367
55216
|
}
|
55368
55217
|
},
|
55369
55218
|
defaults: {
|
55370
55219
|
matches: [],
|
55371
55220
|
regexp: /^defaults$/i,
|
55372
55221
|
select: function(context) {
|
55373
|
-
return
|
55222
|
+
return resolve3(browserslist.defaults, context);
|
55374
55223
|
}
|
55375
55224
|
},
|
55376
55225
|
dead: {
|
@@ -55385,7 +55234,7 @@ var require_browserslist = __commonJS({
|
|
55385
55234
|
"op_mob <= 12.1",
|
55386
55235
|
"samsung 4"
|
55387
55236
|
];
|
55388
|
-
return
|
55237
|
+
return resolve3(dead, context);
|
55389
55238
|
}
|
55390
55239
|
},
|
55391
55240
|
unknown: {
|
@@ -57659,44 +57508,44 @@ var require_config_descriptors = __commonJS({
|
|
57659
57508
|
function* handlerOf(value2) {
|
57660
57509
|
return value2;
|
57661
57510
|
}
|
57662
|
-
function optionsWithResolvedBrowserslistConfigFile(options,
|
57511
|
+
function optionsWithResolvedBrowserslistConfigFile(options, dirname4) {
|
57663
57512
|
if (typeof options.browserslistConfigFile === "string") {
|
57664
|
-
options.browserslistConfigFile = (0, _resolveTargets.resolveBrowserslistConfigFile)(options.browserslistConfigFile,
|
57513
|
+
options.browserslistConfigFile = (0, _resolveTargets.resolveBrowserslistConfigFile)(options.browserslistConfigFile, dirname4);
|
57665
57514
|
}
|
57666
57515
|
return options;
|
57667
57516
|
}
|
57668
|
-
function createCachedDescriptors(
|
57517
|
+
function createCachedDescriptors(dirname4, options, alias) {
|
57669
57518
|
const {
|
57670
57519
|
plugins,
|
57671
57520
|
presets,
|
57672
57521
|
passPerPreset
|
57673
57522
|
} = options;
|
57674
57523
|
return {
|
57675
|
-
options: optionsWithResolvedBrowserslistConfigFile(options,
|
57676
|
-
plugins: plugins ? () => createCachedPluginDescriptors(plugins,
|
57677
|
-
presets: presets ? () => createCachedPresetDescriptors(presets,
|
57524
|
+
options: optionsWithResolvedBrowserslistConfigFile(options, dirname4),
|
57525
|
+
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname4)(alias) : () => handlerOf([]),
|
57526
|
+
presets: presets ? () => createCachedPresetDescriptors(presets, dirname4)(alias)(!!passPerPreset) : () => handlerOf([])
|
57678
57527
|
};
|
57679
57528
|
}
|
57680
|
-
function createUncachedDescriptors(
|
57529
|
+
function createUncachedDescriptors(dirname4, options, alias) {
|
57681
57530
|
return {
|
57682
|
-
options: optionsWithResolvedBrowserslistConfigFile(options,
|
57683
|
-
plugins: (0, _functional.once)(() => createPluginDescriptors(options.plugins || [],
|
57684
|
-
presets: (0, _functional.once)(() => createPresetDescriptors(options.presets || [],
|
57531
|
+
options: optionsWithResolvedBrowserslistConfigFile(options, dirname4),
|
57532
|
+
plugins: (0, _functional.once)(() => createPluginDescriptors(options.plugins || [], dirname4, alias)),
|
57533
|
+
presets: (0, _functional.once)(() => createPresetDescriptors(options.presets || [], dirname4, alias, !!options.passPerPreset))
|
57685
57534
|
};
|
57686
57535
|
}
|
57687
57536
|
var PRESET_DESCRIPTOR_CACHE = /* @__PURE__ */ new WeakMap();
|
57688
57537
|
var createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
57689
|
-
const
|
57538
|
+
const dirname4 = cache.using((dir) => dir);
|
57690
57539
|
return (0, _caching.makeStrongCacheSync)((alias) => (0, _caching.makeStrongCache)(function* (passPerPreset) {
|
57691
|
-
const descriptors = yield* createPresetDescriptors(items,
|
57540
|
+
const descriptors = yield* createPresetDescriptors(items, dirname4, alias, passPerPreset);
|
57692
57541
|
return descriptors.map((desc) => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc));
|
57693
57542
|
}));
|
57694
57543
|
});
|
57695
57544
|
var PLUGIN_DESCRIPTOR_CACHE = /* @__PURE__ */ new WeakMap();
|
57696
57545
|
var createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
57697
|
-
const
|
57546
|
+
const dirname4 = cache.using((dir) => dir);
|
57698
57547
|
return (0, _caching.makeStrongCache)(function* (alias) {
|
57699
|
-
const descriptors = yield* createPluginDescriptors(items,
|
57548
|
+
const descriptors = yield* createPluginDescriptors(items, dirname4, alias);
|
57700
57549
|
return descriptors.map((desc) => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc));
|
57701
57550
|
});
|
57702
57551
|
});
|
@@ -57727,14 +57576,14 @@ var require_config_descriptors = __commonJS({
|
|
57727
57576
|
}
|
57728
57577
|
return desc;
|
57729
57578
|
}
|
57730
|
-
function* createPresetDescriptors(items,
|
57731
|
-
return yield* createDescriptors("preset", items,
|
57579
|
+
function* createPresetDescriptors(items, dirname4, alias, passPerPreset) {
|
57580
|
+
return yield* createDescriptors("preset", items, dirname4, alias, passPerPreset);
|
57732
57581
|
}
|
57733
|
-
function* createPluginDescriptors(items,
|
57734
|
-
return yield* createDescriptors("plugin", items,
|
57582
|
+
function* createPluginDescriptors(items, dirname4, alias) {
|
57583
|
+
return yield* createDescriptors("plugin", items, dirname4, alias);
|
57735
57584
|
}
|
57736
|
-
function* createDescriptors(type, items,
|
57737
|
-
const descriptors = yield* _gensync().all(items.map((item, index) => createDescriptor(item,
|
57585
|
+
function* createDescriptors(type, items, dirname4, alias, ownPass) {
|
57586
|
+
const descriptors = yield* _gensync().all(items.map((item, index) => createDescriptor(item, dirname4, {
|
57738
57587
|
type,
|
57739
57588
|
alias: `${alias}$${index}`,
|
57740
57589
|
ownPass: !!ownPass
|
@@ -57742,7 +57591,7 @@ var require_config_descriptors = __commonJS({
|
|
57742
57591
|
assertNoDuplicates(descriptors);
|
57743
57592
|
return descriptors;
|
57744
57593
|
}
|
57745
|
-
function* createDescriptor(pair,
|
57594
|
+
function* createDescriptor(pair, dirname4, {
|
57746
57595
|
type,
|
57747
57596
|
alias,
|
57748
57597
|
ownPass
|
@@ -57772,7 +57621,7 @@ var require_config_descriptors = __commonJS({
|
|
57772
57621
|
({
|
57773
57622
|
filepath,
|
57774
57623
|
value: value2
|
57775
|
-
} = yield* resolver(value2,
|
57624
|
+
} = yield* resolver(value2, dirname4));
|
57776
57625
|
file = {
|
57777
57626
|
request,
|
57778
57627
|
resolved: filepath
|
@@ -57799,7 +57648,7 @@ var require_config_descriptors = __commonJS({
|
|
57799
57648
|
alias: filepath || alias,
|
57800
57649
|
value: value2,
|
57801
57650
|
options,
|
57802
|
-
dirname:
|
57651
|
+
dirname: dirname4,
|
57803
57652
|
ownPass,
|
57804
57653
|
file
|
57805
57654
|
};
|
@@ -57846,10 +57695,10 @@ var require_item = __commonJS({
|
|
57846
57695
|
return new ConfigItem(desc);
|
57847
57696
|
}
|
57848
57697
|
function* createConfigItem(value2, {
|
57849
|
-
dirname:
|
57698
|
+
dirname: dirname4 = ".",
|
57850
57699
|
type
|
57851
57700
|
} = {}) {
|
57852
|
-
const descriptor = yield* (0, _configDescriptors.createDescriptor)(value2, _path().resolve(
|
57701
|
+
const descriptor = yield* (0, _configDescriptors.createDescriptor)(value2, _path().resolve(dirname4), {
|
57853
57702
|
type,
|
57854
57703
|
alias: "programmatic item"
|
57855
57704
|
});
|
@@ -58476,8 +58325,8 @@ var require_pattern_to_regex = __commonJS({
|
|
58476
58325
|
function escapeRegExp(string) {
|
58477
58326
|
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
58478
58327
|
}
|
58479
|
-
function pathToPattern(pattern,
|
58480
|
-
const parts = _path().resolve(
|
58328
|
+
function pathToPattern(pattern, dirname4) {
|
58329
|
+
const parts = _path().resolve(dirname4, pattern).split(_path().sep);
|
58481
58330
|
return new RegExp(["^", ...parts.map((part, i) => {
|
58482
58331
|
const last = i === parts.length - 1;
|
58483
58332
|
if (part === "**")
|
@@ -58829,10 +58678,10 @@ var require_config_chain = __commonJS({
|
|
58829
58678
|
});
|
58830
58679
|
}
|
58831
58680
|
function buildRootDescriptors({
|
58832
|
-
dirname:
|
58681
|
+
dirname: dirname4,
|
58833
58682
|
options
|
58834
58683
|
}, alias, descriptors) {
|
58835
|
-
return descriptors(
|
58684
|
+
return descriptors(dirname4, options, alias);
|
58836
58685
|
}
|
58837
58686
|
function buildProgrammaticLogger(_, context, baseLogger) {
|
58838
58687
|
var _context$caller;
|
@@ -58845,25 +58694,25 @@ var require_config_chain = __commonJS({
|
|
58845
58694
|
});
|
58846
58695
|
}
|
58847
58696
|
function buildEnvDescriptors({
|
58848
|
-
dirname:
|
58697
|
+
dirname: dirname4,
|
58849
58698
|
options
|
58850
58699
|
}, alias, descriptors, envName) {
|
58851
58700
|
var _options$env;
|
58852
58701
|
const opts = (_options$env = options.env) == null ? void 0 : _options$env[envName];
|
58853
|
-
return opts ? descriptors(
|
58702
|
+
return opts ? descriptors(dirname4, opts, `${alias}.env["${envName}"]`) : null;
|
58854
58703
|
}
|
58855
58704
|
function buildOverrideDescriptors({
|
58856
|
-
dirname:
|
58705
|
+
dirname: dirname4,
|
58857
58706
|
options
|
58858
58707
|
}, alias, descriptors, index) {
|
58859
58708
|
var _options$overrides;
|
58860
58709
|
const opts = (_options$overrides = options.overrides) == null ? void 0 : _options$overrides[index];
|
58861
58710
|
if (!opts)
|
58862
58711
|
throw new Error("Assertion failure - missing override");
|
58863
|
-
return descriptors(
|
58712
|
+
return descriptors(dirname4, opts, `${alias}.overrides[${index}]`);
|
58864
58713
|
}
|
58865
58714
|
function buildOverrideEnvDescriptors({
|
58866
|
-
dirname:
|
58715
|
+
dirname: dirname4,
|
58867
58716
|
options
|
58868
58717
|
}, alias, descriptors, index, envName) {
|
58869
58718
|
var _options$overrides2, _override$env;
|
@@ -58871,7 +58720,7 @@ var require_config_chain = __commonJS({
|
|
58871
58720
|
if (!override)
|
58872
58721
|
throw new Error("Assertion failure - missing override");
|
58873
58722
|
const opts = (_override$env = override.env) == null ? void 0 : _override$env[envName];
|
58874
|
-
return opts ? descriptors(
|
58723
|
+
return opts ? descriptors(dirname4, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null;
|
58875
58724
|
}
|
58876
58725
|
function makeChainWalker({
|
58877
58726
|
root,
|
@@ -58882,18 +58731,18 @@ var require_config_chain = __commonJS({
|
|
58882
58731
|
}) {
|
58883
58732
|
return function* chainWalker(input, context, files = /* @__PURE__ */ new Set(), baseLogger) {
|
58884
58733
|
const {
|
58885
|
-
dirname:
|
58734
|
+
dirname: dirname4
|
58886
58735
|
} = input;
|
58887
58736
|
const flattenedConfigs = [];
|
58888
58737
|
const rootOpts = root(input);
|
58889
|
-
if (configIsApplicable(rootOpts,
|
58738
|
+
if (configIsApplicable(rootOpts, dirname4, context, input.filepath)) {
|
58890
58739
|
flattenedConfigs.push({
|
58891
58740
|
config: rootOpts,
|
58892
58741
|
envName: void 0,
|
58893
58742
|
index: void 0
|
58894
58743
|
});
|
58895
58744
|
const envOpts = env(input, context.envName);
|
58896
|
-
if (envOpts && configIsApplicable(envOpts,
|
58745
|
+
if (envOpts && configIsApplicable(envOpts, dirname4, context, input.filepath)) {
|
58897
58746
|
flattenedConfigs.push({
|
58898
58747
|
config: envOpts,
|
58899
58748
|
envName: context.envName,
|
@@ -58902,14 +58751,14 @@ var require_config_chain = __commonJS({
|
|
58902
58751
|
}
|
58903
58752
|
(rootOpts.options.overrides || []).forEach((_, index) => {
|
58904
58753
|
const overrideOps = overrides(input, index);
|
58905
|
-
if (configIsApplicable(overrideOps,
|
58754
|
+
if (configIsApplicable(overrideOps, dirname4, context, input.filepath)) {
|
58906
58755
|
flattenedConfigs.push({
|
58907
58756
|
config: overrideOps,
|
58908
58757
|
index,
|
58909
58758
|
envName: void 0
|
58910
58759
|
});
|
58911
58760
|
const overrideEnvOpts = overridesEnv(input, index, context.envName);
|
58912
|
-
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts,
|
58761
|
+
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname4, context, input.filepath)) {
|
58913
58762
|
flattenedConfigs.push({
|
58914
58763
|
config: overrideEnvOpts,
|
58915
58764
|
index,
|
@@ -58926,7 +58775,7 @@ var require_config_chain = __commonJS({
|
|
58926
58775
|
only
|
58927
58776
|
}
|
58928
58777
|
}
|
58929
|
-
}) => shouldIgnore(context, ignore, only,
|
58778
|
+
}) => shouldIgnore(context, ignore, only, dirname4))) {
|
58930
58779
|
return null;
|
58931
58780
|
}
|
58932
58781
|
const chain = emptyChain();
|
@@ -58936,7 +58785,7 @@ var require_config_chain = __commonJS({
|
|
58936
58785
|
index,
|
58937
58786
|
envName
|
58938
58787
|
} of flattenedConfigs) {
|
58939
|
-
if (!(yield* mergeExtendsChain(chain, config.options,
|
58788
|
+
if (!(yield* mergeExtendsChain(chain, config.options, dirname4, context, files, baseLogger))) {
|
58940
58789
|
return null;
|
58941
58790
|
}
|
58942
58791
|
logger(config, index, envName);
|
@@ -58945,10 +58794,10 @@ var require_config_chain = __commonJS({
|
|
58945
58794
|
return chain;
|
58946
58795
|
};
|
58947
58796
|
}
|
58948
|
-
function* mergeExtendsChain(chain, opts,
|
58797
|
+
function* mergeExtendsChain(chain, opts, dirname4, context, files, baseLogger) {
|
58949
58798
|
if (opts.extends === void 0)
|
58950
58799
|
return true;
|
58951
|
-
const file = yield* (0, _index.loadConfig)(opts.extends,
|
58800
|
+
const file = yield* (0, _index.loadConfig)(opts.extends, dirname4, context.envName, context.caller);
|
58952
58801
|
if (files.has(file)) {
|
58953
58802
|
throw new Error(`Configuration cycle detected loading ${file.filepath}.
|
58954
58803
|
File already loaded following the config chain:
|
@@ -59043,12 +58892,12 @@ File already loaded following the config chain:
|
|
59043
58892
|
}
|
59044
58893
|
function configIsApplicable({
|
59045
58894
|
options
|
59046
|
-
},
|
59047
|
-
return (options.test === void 0 || configFieldIsApplicable(context, options.test,
|
58895
|
+
}, dirname4, context, configName) {
|
58896
|
+
return (options.test === void 0 || configFieldIsApplicable(context, options.test, dirname4, configName)) && (options.include === void 0 || configFieldIsApplicable(context, options.include, dirname4, configName)) && (options.exclude === void 0 || !configFieldIsApplicable(context, options.exclude, dirname4, configName));
|
59048
58897
|
}
|
59049
|
-
function configFieldIsApplicable(context, test,
|
58898
|
+
function configFieldIsApplicable(context, test, dirname4, configName) {
|
59050
58899
|
const patterns = Array.isArray(test) ? test : [test];
|
59051
|
-
return matchesPatterns(context, patterns,
|
58900
|
+
return matchesPatterns(context, patterns, dirname4, configName);
|
59052
58901
|
}
|
59053
58902
|
function ignoreListReplacer(_key, value2) {
|
59054
58903
|
if (value2 instanceof RegExp) {
|
@@ -59056,19 +58905,19 @@ File already loaded following the config chain:
|
|
59056
58905
|
}
|
59057
58906
|
return value2;
|
59058
58907
|
}
|
59059
|
-
function shouldIgnore(context, ignore, only,
|
59060
|
-
if (ignore && matchesPatterns(context, ignore,
|
58908
|
+
function shouldIgnore(context, ignore, only, dirname4) {
|
58909
|
+
if (ignore && matchesPatterns(context, ignore, dirname4)) {
|
59061
58910
|
var _context$filename;
|
59062
|
-
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${
|
58911
|
+
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${dirname4}"`;
|
59063
58912
|
debug4(message);
|
59064
58913
|
if (context.showConfig) {
|
59065
58914
|
console.log(message);
|
59066
58915
|
}
|
59067
58916
|
return true;
|
59068
58917
|
}
|
59069
|
-
if (only && !matchesPatterns(context, only,
|
58918
|
+
if (only && !matchesPatterns(context, only, dirname4)) {
|
59070
58919
|
var _context$filename2;
|
59071
|
-
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${
|
58920
|
+
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${dirname4}"`;
|
59072
58921
|
debug4(message);
|
59073
58922
|
if (context.showConfig) {
|
59074
58923
|
console.log(message);
|
@@ -59077,13 +58926,13 @@ File already loaded following the config chain:
|
|
59077
58926
|
}
|
59078
58927
|
return false;
|
59079
58928
|
}
|
59080
|
-
function matchesPatterns(context, patterns,
|
59081
|
-
return patterns.some((pattern) => matchPattern(pattern,
|
58929
|
+
function matchesPatterns(context, patterns, dirname4, configName) {
|
58930
|
+
return patterns.some((pattern) => matchPattern(pattern, dirname4, context.filename, context, configName));
|
59082
58931
|
}
|
59083
|
-
function matchPattern(pattern,
|
58932
|
+
function matchPattern(pattern, dirname4, pathToTest, context, configName) {
|
59084
58933
|
if (typeof pattern === "function") {
|
59085
58934
|
return !!(0, _rewriteStackTrace.endHiddenCallStack)(pattern)(pathToTest, {
|
59086
|
-
dirname:
|
58935
|
+
dirname: dirname4,
|
59087
58936
|
envName: context.envName,
|
59088
58937
|
caller: context.caller
|
59089
58938
|
});
|
@@ -59092,7 +58941,7 @@ File already loaded following the config chain:
|
|
59092
58941
|
throw new _configError.default(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`, configName);
|
59093
58942
|
}
|
59094
58943
|
if (typeof pattern === "string") {
|
59095
|
-
pattern = (0, _patternToRegex.default)(pattern,
|
58944
|
+
pattern = (0, _patternToRegex.default)(pattern, dirname4);
|
59096
58945
|
}
|
59097
58946
|
return pattern.test(pathToTest);
|
59098
58947
|
}
|
@@ -59530,7 +59379,7 @@ var require_full = __commonJS({
|
|
59530
59379
|
var makeDescriptorLoader = (apiFactory) => (0, _caching.makeWeakCache)(function* ({
|
59531
59380
|
value: value2,
|
59532
59381
|
options,
|
59533
|
-
dirname:
|
59382
|
+
dirname: dirname4,
|
59534
59383
|
alias
|
59535
59384
|
}, cache) {
|
59536
59385
|
if (options === false)
|
@@ -59542,7 +59391,7 @@ var require_full = __commonJS({
|
|
59542
59391
|
const factory = (0, _async.maybeAsync)(value2, `You appear to be using an async plugin/preset, but Babel has been called synchronously`);
|
59543
59392
|
const api = Object.assign({}, context, apiFactory(cache, externalDependencies));
|
59544
59393
|
try {
|
59545
|
-
item = yield* factory(api, options,
|
59394
|
+
item = yield* factory(api, options, dirname4);
|
59546
59395
|
} catch (e) {
|
59547
59396
|
if (alias) {
|
59548
59397
|
e.message += ` (While processing: ${JSON.stringify(alias)})`;
|
@@ -59571,7 +59420,7 @@ var require_full = __commonJS({
|
|
59571
59420
|
return {
|
59572
59421
|
value: item,
|
59573
59422
|
options,
|
59574
|
-
dirname:
|
59423
|
+
dirname: dirname4,
|
59575
59424
|
alias,
|
59576
59425
|
externalDependencies: (0, _deepArray.finalize)(externalDependencies)
|
59577
59426
|
};
|
@@ -59581,7 +59430,7 @@ var require_full = __commonJS({
|
|
59581
59430
|
var instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
|
59582
59431
|
value: value2,
|
59583
59432
|
options,
|
59584
|
-
dirname:
|
59433
|
+
dirname: dirname4,
|
59585
59434
|
alias,
|
59586
59435
|
externalDependencies
|
59587
59436
|
}, cache) {
|
@@ -59596,7 +59445,7 @@ var require_full = __commonJS({
|
|
59596
59445
|
alias: `${alias}$inherits`,
|
59597
59446
|
value: plugin.inherits,
|
59598
59447
|
options,
|
59599
|
-
dirname:
|
59448
|
+
dirname: dirname4
|
59600
59449
|
};
|
59601
59450
|
const inherits = yield* (0, _async.forwardAsync)(loadPluginDescriptor, (run) => {
|
59602
59451
|
return cache.invalidate((data) => run(inheritsDescriptor, data));
|
@@ -59643,14 +59492,14 @@ var require_full = __commonJS({
|
|
59643
59492
|
};
|
59644
59493
|
var instantiatePreset = (0, _caching.makeWeakCacheSync)(({
|
59645
59494
|
value: value2,
|
59646
|
-
dirname:
|
59495
|
+
dirname: dirname4,
|
59647
59496
|
alias,
|
59648
59497
|
externalDependencies
|
59649
59498
|
}) => {
|
59650
59499
|
return {
|
59651
59500
|
options: (0, _options.validate)("preset", value2),
|
59652
59501
|
alias,
|
59653
|
-
dirname:
|
59502
|
+
dirname: dirname4,
|
59654
59503
|
externalDependencies
|
59655
59504
|
};
|
59656
59505
|
});
|
@@ -61247,7 +61096,7 @@ var require_lib15 = __commonJS({
|
|
61247
61096
|
});
|
61248
61097
|
}
|
61249
61098
|
function declare(builder) {
|
61250
|
-
return (api, options,
|
61099
|
+
return (api, options, dirname4) => {
|
61251
61100
|
var _clonedApi2;
|
61252
61101
|
let clonedApi;
|
61253
61102
|
for (const name of Object.keys(apiPolyfills)) {
|
@@ -61257,7 +61106,7 @@ var require_lib15 = __commonJS({
|
|
61257
61106
|
(_clonedApi = clonedApi) != null ? _clonedApi : clonedApi = copyApiObject(api);
|
61258
61107
|
clonedApi[name] = apiPolyfills[name](clonedApi);
|
61259
61108
|
}
|
61260
|
-
return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {},
|
61109
|
+
return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {}, dirname4);
|
61261
61110
|
};
|
61262
61111
|
}
|
61263
61112
|
var declarePreset = exports.declarePreset = declare;
|
@@ -66961,7 +66810,7 @@ var require_module_types = __commonJS({
|
|
66961
66810
|
var _rewriteStackTrace = require_rewrite_stack_trace();
|
66962
66811
|
var _configError = require_config_error();
|
66963
66812
|
var _transformFile = require_transform_file();
|
66964
|
-
function asyncGeneratorStep(gen,
|
66813
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
66965
66814
|
try {
|
66966
66815
|
var info = gen[key](arg);
|
66967
66816
|
var value2 = info.value;
|
@@ -66970,7 +66819,7 @@ var require_module_types = __commonJS({
|
|
66970
66819
|
return;
|
66971
66820
|
}
|
66972
66821
|
if (info.done) {
|
66973
|
-
|
66822
|
+
resolve3(value2);
|
66974
66823
|
} else {
|
66975
66824
|
Promise.resolve(value2).then(_next, _throw);
|
66976
66825
|
}
|
@@ -66978,13 +66827,13 @@ var require_module_types = __commonJS({
|
|
66978
66827
|
function _asyncToGenerator(fn) {
|
66979
66828
|
return function() {
|
66980
66829
|
var self2 = this, args = arguments;
|
66981
|
-
return new Promise(function(
|
66830
|
+
return new Promise(function(resolve3, reject) {
|
66982
66831
|
var gen = fn.apply(self2, args);
|
66983
66832
|
function _next(value2) {
|
66984
|
-
asyncGeneratorStep(gen,
|
66833
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value2);
|
66985
66834
|
}
|
66986
66835
|
function _throw(err) {
|
66987
|
-
asyncGeneratorStep(gen,
|
66836
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err);
|
66988
66837
|
}
|
66989
66838
|
_next(void 0);
|
66990
66839
|
});
|
@@ -67286,24 +67135,24 @@ var require_configuration = __commonJS({
|
|
67286
67135
|
};
|
67287
67136
|
});
|
67288
67137
|
function findConfigUpwards(rootDir) {
|
67289
|
-
let
|
67138
|
+
let dirname4 = rootDir;
|
67290
67139
|
for (; ; ) {
|
67291
67140
|
for (const filename of ROOT_CONFIG_FILENAMES) {
|
67292
|
-
if (_fs().existsSync(_path().join(
|
67293
|
-
return
|
67141
|
+
if (_fs().existsSync(_path().join(dirname4, filename))) {
|
67142
|
+
return dirname4;
|
67294
67143
|
}
|
67295
67144
|
}
|
67296
|
-
const nextDir = _path().dirname(
|
67297
|
-
if (
|
67145
|
+
const nextDir = _path().dirname(dirname4);
|
67146
|
+
if (dirname4 === nextDir)
|
67298
67147
|
break;
|
67299
|
-
|
67148
|
+
dirname4 = nextDir;
|
67300
67149
|
}
|
67301
67150
|
return null;
|
67302
67151
|
}
|
67303
67152
|
function* findRelativeConfig(packageData, envName, caller) {
|
67304
67153
|
let config = null;
|
67305
67154
|
let ignore = null;
|
67306
|
-
const
|
67155
|
+
const dirname4 = _path().dirname(packageData.filepath);
|
67307
67156
|
for (const loc of packageData.directories) {
|
67308
67157
|
if (!config) {
|
67309
67158
|
var _packageData$pkg;
|
@@ -67313,7 +67162,7 @@ var require_configuration = __commonJS({
|
|
67313
67162
|
const ignoreLoc = _path().join(loc, BABELIGNORE_FILENAME);
|
67314
67163
|
ignore = yield* readIgnoreConfig(ignoreLoc);
|
67315
67164
|
if (ignore) {
|
67316
|
-
debug4("Found ignore %o from %o.", ignore.filepath,
|
67165
|
+
debug4("Found ignore %o from %o.", ignore.filepath, dirname4);
|
67317
67166
|
}
|
67318
67167
|
}
|
67319
67168
|
}
|
@@ -67322,26 +67171,26 @@ var require_configuration = __commonJS({
|
|
67322
67171
|
ignore
|
67323
67172
|
};
|
67324
67173
|
}
|
67325
|
-
function findRootConfig(
|
67326
|
-
return loadOneConfig(ROOT_CONFIG_FILENAMES,
|
67174
|
+
function findRootConfig(dirname4, envName, caller) {
|
67175
|
+
return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname4, envName, caller);
|
67327
67176
|
}
|
67328
|
-
function* loadOneConfig(names,
|
67329
|
-
const configs = yield* _gensync().all(names.map((filename) => readConfig(_path().join(
|
67177
|
+
function* loadOneConfig(names, dirname4, envName, caller, previousConfig = null) {
|
67178
|
+
const configs = yield* _gensync().all(names.map((filename) => readConfig(_path().join(dirname4, filename), envName, caller)));
|
67330
67179
|
const config = configs.reduce((previousConfig2, config2) => {
|
67331
67180
|
if (config2 && previousConfig2) {
|
67332
67181
|
throw new _configError.default(`Multiple configuration files found. Please remove one:
|
67333
67182
|
- ${_path().basename(previousConfig2.filepath)}
|
67334
67183
|
- ${config2.filepath}
|
67335
|
-
from ${
|
67184
|
+
from ${dirname4}`);
|
67336
67185
|
}
|
67337
67186
|
return config2 || previousConfig2;
|
67338
67187
|
}, previousConfig);
|
67339
67188
|
if (config) {
|
67340
|
-
debug4("Found configuration %o from %o.", config.filepath,
|
67189
|
+
debug4("Found configuration %o from %o.", config.filepath, dirname4);
|
67341
67190
|
}
|
67342
67191
|
return config;
|
67343
67192
|
}
|
67344
|
-
function* loadConfig(name,
|
67193
|
+
function* loadConfig(name, dirname4, envName, caller) {
|
67345
67194
|
const filepath = (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
|
67346
67195
|
paths: [b]
|
67347
67196
|
}, M = require("module")) => {
|
@@ -67352,13 +67201,13 @@ from ${dirname3}`);
|
|
67352
67201
|
f.code = "MODULE_NOT_FOUND";
|
67353
67202
|
throw f;
|
67354
67203
|
})(name, {
|
67355
|
-
paths: [
|
67204
|
+
paths: [dirname4]
|
67356
67205
|
});
|
67357
67206
|
const conf = yield* readConfig(filepath, envName, caller);
|
67358
67207
|
if (!conf) {
|
67359
67208
|
throw new _configError.default(`Config file contains no configuration data`, filepath);
|
67360
67209
|
}
|
67361
|
-
debug4("Loaded config %o from %o.", name,
|
67210
|
+
debug4("Loaded config %o from %o.", name, dirname4);
|
67362
67211
|
return conf;
|
67363
67212
|
}
|
67364
67213
|
function readConfig(filepath, envName, caller) {
|
@@ -67376,10 +67225,10 @@ from ${dirname3}`);
|
|
67376
67225
|
return readConfigJSON5(filepath);
|
67377
67226
|
}
|
67378
67227
|
}
|
67379
|
-
function* resolveShowConfigPath(
|
67228
|
+
function* resolveShowConfigPath(dirname4) {
|
67380
67229
|
const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;
|
67381
67230
|
if (targetPath != null) {
|
67382
|
-
const absolutePath = _path().resolve(
|
67231
|
+
const absolutePath = _path().resolve(dirname4, targetPath);
|
67383
67232
|
const stats = yield* fs.stat(absolutePath);
|
67384
67233
|
if (!stats.isFile()) {
|
67385
67234
|
throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);
|
@@ -67434,7 +67283,7 @@ var require_import_meta_resolve = __commonJS({
|
|
67434
67283
|
value: true
|
67435
67284
|
});
|
67436
67285
|
exports.moduleResolve = moduleResolve;
|
67437
|
-
exports.resolve =
|
67286
|
+
exports.resolve = resolve3;
|
67438
67287
|
function _assert() {
|
67439
67288
|
const data = require("assert");
|
67440
67289
|
_assert = function() {
|
@@ -68509,7 +68358,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
68509
68358
|
})
|
68510
68359
|
};
|
68511
68360
|
}
|
68512
|
-
function
|
68361
|
+
function resolve3(specifier, parent) {
|
68513
68362
|
if (!parent) {
|
68514
68363
|
throw new Error("Please pass `parent`: `import-meta-resolve` cannot ponyfill that");
|
68515
68364
|
}
|
@@ -68580,19 +68429,19 @@ var require_plugins4 = __commonJS({
|
|
68580
68429
|
var OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
|
68581
68430
|
var resolvePlugin = exports.resolvePlugin = resolveStandardizedName.bind(null, "plugin");
|
68582
68431
|
var resolvePreset = exports.resolvePreset = resolveStandardizedName.bind(null, "preset");
|
68583
|
-
function* loadPlugin(name,
|
68584
|
-
const filepath = resolvePlugin(name,
|
68432
|
+
function* loadPlugin(name, dirname4) {
|
68433
|
+
const filepath = resolvePlugin(name, dirname4, yield* (0, _async.isAsync)());
|
68585
68434
|
const value2 = yield* requireModule("plugin", filepath);
|
68586
|
-
debug4("Loaded plugin %o from %o.", name,
|
68435
|
+
debug4("Loaded plugin %o from %o.", name, dirname4);
|
68587
68436
|
return {
|
68588
68437
|
filepath,
|
68589
68438
|
value: value2
|
68590
68439
|
};
|
68591
68440
|
}
|
68592
|
-
function* loadPreset(name,
|
68593
|
-
const filepath = resolvePreset(name,
|
68441
|
+
function* loadPreset(name, dirname4) {
|
68442
|
+
const filepath = resolvePreset(name, dirname4, yield* (0, _async.isAsync)());
|
68594
68443
|
const value2 = yield* requireModule("preset", filepath);
|
68595
|
-
debug4("Loaded preset %o from %o.", name,
|
68444
|
+
debug4("Loaded preset %o from %o.", name, dirname4);
|
68596
68445
|
return {
|
68597
68446
|
filepath,
|
68598
68447
|
value: value2
|
@@ -68645,9 +68494,9 @@ to your top-level package.json.
|
|
68645
68494
|
`;
|
68646
68495
|
throw error;
|
68647
68496
|
}
|
68648
|
-
function tryRequireResolve(id,
|
68497
|
+
function tryRequireResolve(id, dirname4) {
|
68649
68498
|
try {
|
68650
|
-
if (
|
68499
|
+
if (dirname4) {
|
68651
68500
|
return {
|
68652
68501
|
error: null,
|
68653
68502
|
value: (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
|
@@ -68660,7 +68509,7 @@ to your top-level package.json.
|
|
68660
68509
|
f.code = "MODULE_NOT_FOUND";
|
68661
68510
|
throw f;
|
68662
68511
|
})(id, {
|
68663
|
-
paths: [
|
68512
|
+
paths: [dirname4]
|
68664
68513
|
})
|
68665
68514
|
};
|
68666
68515
|
} else {
|
@@ -68689,16 +68538,16 @@ to your top-level package.json.
|
|
68689
68538
|
};
|
68690
68539
|
}
|
68691
68540
|
}
|
68692
|
-
function resolveStandardizedNameForRequire(type, name,
|
68541
|
+
function resolveStandardizedNameForRequire(type, name, dirname4) {
|
68693
68542
|
const it = resolveAlternativesHelper(type, name);
|
68694
68543
|
let res = it.next();
|
68695
68544
|
while (!res.done) {
|
68696
|
-
res = it.next(tryRequireResolve(res.value,
|
68545
|
+
res = it.next(tryRequireResolve(res.value, dirname4));
|
68697
68546
|
}
|
68698
68547
|
return res.value;
|
68699
68548
|
}
|
68700
|
-
function resolveStandardizedNameForImport(type, name,
|
68701
|
-
const parentUrl = (0, _url().pathToFileURL)(_path().join(
|
68549
|
+
function resolveStandardizedNameForImport(type, name, dirname4) {
|
68550
|
+
const parentUrl = (0, _url().pathToFileURL)(_path().join(dirname4, "./babel-virtual-resolve-base.js")).href;
|
68702
68551
|
const it = resolveAlternativesHelper(type, name);
|
68703
68552
|
let res = it.next();
|
68704
68553
|
while (!res.done) {
|
@@ -68706,21 +68555,21 @@ to your top-level package.json.
|
|
68706
68555
|
}
|
68707
68556
|
return (0, _url().fileURLToPath)(res.value);
|
68708
68557
|
}
|
68709
|
-
function resolveStandardizedName(type, name,
|
68558
|
+
function resolveStandardizedName(type, name, dirname4, resolveESM) {
|
68710
68559
|
if (!_moduleTypes.supportsESM || !resolveESM) {
|
68711
|
-
return resolveStandardizedNameForRequire(type, name,
|
68560
|
+
return resolveStandardizedNameForRequire(type, name, dirname4);
|
68712
68561
|
}
|
68713
68562
|
try {
|
68714
|
-
const resolved = resolveStandardizedNameForImport(type, name,
|
68563
|
+
const resolved = resolveStandardizedNameForImport(type, name, dirname4);
|
68715
68564
|
if (!(0, _fs().existsSync)(resolved)) {
|
68716
|
-
throw Object.assign(new Error(`Could not resolve "${name}" in file ${
|
68565
|
+
throw Object.assign(new Error(`Could not resolve "${name}" in file ${dirname4}.`), {
|
68717
68566
|
type: "MODULE_NOT_FOUND"
|
68718
68567
|
});
|
68719
68568
|
}
|
68720
68569
|
return resolved;
|
68721
68570
|
} catch (e) {
|
68722
68571
|
try {
|
68723
|
-
return resolveStandardizedNameForRequire(type, name,
|
68572
|
+
return resolveStandardizedNameForRequire(type, name, dirname4);
|
68724
68573
|
} catch (e2) {
|
68725
68574
|
if (e.type === "MODULE_NOT_FOUND")
|
68726
68575
|
throw e;
|
@@ -69701,27 +69550,177 @@ var init_babel = __esm({
|
|
69701
69550
|
}
|
69702
69551
|
});
|
69703
69552
|
|
69553
|
+
// ../../node_modules/.pnpm/@tootallnate+once@1.1.2/node_modules/@tootallnate/once/dist/index.js
|
69554
|
+
var require_dist = __commonJS({
|
69555
|
+
"../../node_modules/.pnpm/@tootallnate+once@1.1.2/node_modules/@tootallnate/once/dist/index.js"(exports, module2) {
|
69556
|
+
"use strict";
|
69557
|
+
function noop() {
|
69558
|
+
}
|
69559
|
+
function once3(emitter, name) {
|
69560
|
+
const o = once3.spread(emitter, name);
|
69561
|
+
const r = o.then((args) => args[0]);
|
69562
|
+
r.cancel = o.cancel;
|
69563
|
+
return r;
|
69564
|
+
}
|
69565
|
+
(function(once4) {
|
69566
|
+
function spread(emitter, name) {
|
69567
|
+
let c = null;
|
69568
|
+
const p = new Promise((resolve3, reject) => {
|
69569
|
+
function cancel() {
|
69570
|
+
emitter.removeListener(name, onEvent);
|
69571
|
+
emitter.removeListener("error", onError);
|
69572
|
+
p.cancel = noop;
|
69573
|
+
}
|
69574
|
+
function onEvent(...args) {
|
69575
|
+
cancel();
|
69576
|
+
resolve3(args);
|
69577
|
+
}
|
69578
|
+
function onError(err) {
|
69579
|
+
cancel();
|
69580
|
+
reject(err);
|
69581
|
+
}
|
69582
|
+
c = cancel;
|
69583
|
+
emitter.on(name, onEvent);
|
69584
|
+
emitter.on("error", onError);
|
69585
|
+
});
|
69586
|
+
if (!c) {
|
69587
|
+
throw new TypeError("Could not get `cancel()` function");
|
69588
|
+
}
|
69589
|
+
p.cancel = c;
|
69590
|
+
return p;
|
69591
|
+
}
|
69592
|
+
once4.spread = spread;
|
69593
|
+
})(once3 || (once3 = {}));
|
69594
|
+
module2.exports = once3;
|
69595
|
+
}
|
69596
|
+
});
|
69597
|
+
|
69598
|
+
// ../../node_modules/.pnpm/tree-kill@1.2.2/node_modules/tree-kill/index.js
|
69599
|
+
var require_tree_kill = __commonJS({
|
69600
|
+
"../../node_modules/.pnpm/tree-kill@1.2.2/node_modules/tree-kill/index.js"(exports, module2) {
|
69601
|
+
"use strict";
|
69602
|
+
var childProcess = require("child_process");
|
69603
|
+
var spawn2 = childProcess.spawn;
|
69604
|
+
var exec = childProcess.exec;
|
69605
|
+
module2.exports = function(pid, signal, callback) {
|
69606
|
+
if (typeof signal === "function" && callback === void 0) {
|
69607
|
+
callback = signal;
|
69608
|
+
signal = void 0;
|
69609
|
+
}
|
69610
|
+
pid = parseInt(pid);
|
69611
|
+
if (Number.isNaN(pid)) {
|
69612
|
+
if (callback) {
|
69613
|
+
return callback(new Error("pid must be a number"));
|
69614
|
+
} else {
|
69615
|
+
throw new Error("pid must be a number");
|
69616
|
+
}
|
69617
|
+
}
|
69618
|
+
var tree = {};
|
69619
|
+
var pidsToProcess = {};
|
69620
|
+
tree[pid] = [];
|
69621
|
+
pidsToProcess[pid] = 1;
|
69622
|
+
switch (process.platform) {
|
69623
|
+
case "win32":
|
69624
|
+
exec("taskkill /pid " + pid + " /T /F", callback);
|
69625
|
+
break;
|
69626
|
+
case "darwin":
|
69627
|
+
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
|
69628
|
+
return spawn2("pgrep", ["-P", parentPid]);
|
69629
|
+
}, function() {
|
69630
|
+
killAll(tree, signal, callback);
|
69631
|
+
});
|
69632
|
+
break;
|
69633
|
+
default:
|
69634
|
+
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
|
69635
|
+
return spawn2("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
|
69636
|
+
}, function() {
|
69637
|
+
killAll(tree, signal, callback);
|
69638
|
+
});
|
69639
|
+
break;
|
69640
|
+
}
|
69641
|
+
};
|
69642
|
+
function killAll(tree, signal, callback) {
|
69643
|
+
var killed = {};
|
69644
|
+
try {
|
69645
|
+
Object.keys(tree).forEach(function(pid) {
|
69646
|
+
tree[pid].forEach(function(pidpid) {
|
69647
|
+
if (!killed[pidpid]) {
|
69648
|
+
killPid(pidpid, signal);
|
69649
|
+
killed[pidpid] = 1;
|
69650
|
+
}
|
69651
|
+
});
|
69652
|
+
if (!killed[pid]) {
|
69653
|
+
killPid(pid, signal);
|
69654
|
+
killed[pid] = 1;
|
69655
|
+
}
|
69656
|
+
});
|
69657
|
+
} catch (err) {
|
69658
|
+
if (callback) {
|
69659
|
+
return callback(err);
|
69660
|
+
} else {
|
69661
|
+
throw err;
|
69662
|
+
}
|
69663
|
+
}
|
69664
|
+
if (callback) {
|
69665
|
+
return callback();
|
69666
|
+
}
|
69667
|
+
}
|
69668
|
+
function killPid(pid, signal) {
|
69669
|
+
try {
|
69670
|
+
process.kill(parseInt(pid, 10), signal);
|
69671
|
+
} catch (err) {
|
69672
|
+
if (err.code !== "ESRCH")
|
69673
|
+
throw err;
|
69674
|
+
}
|
69675
|
+
}
|
69676
|
+
function buildProcessTree(parentPid, tree, pidsToProcess, spawnChildProcessesList, cb) {
|
69677
|
+
var ps = spawnChildProcessesList(parentPid);
|
69678
|
+
var allData = "";
|
69679
|
+
ps.stdout.on("data", function(data) {
|
69680
|
+
var data = data.toString("ascii");
|
69681
|
+
allData += data;
|
69682
|
+
});
|
69683
|
+
var onClose = function(code) {
|
69684
|
+
delete pidsToProcess[parentPid];
|
69685
|
+
if (code != 0) {
|
69686
|
+
if (Object.keys(pidsToProcess).length == 0) {
|
69687
|
+
cb();
|
69688
|
+
}
|
69689
|
+
return;
|
69690
|
+
}
|
69691
|
+
allData.match(/\d+/g).forEach(function(pid) {
|
69692
|
+
pid = parseInt(pid, 10);
|
69693
|
+
tree[parentPid].push(pid);
|
69694
|
+
tree[pid] = [];
|
69695
|
+
pidsToProcess[pid] = 1;
|
69696
|
+
buildProcessTree(pid, tree, pidsToProcess, spawnChildProcessesList, cb);
|
69697
|
+
});
|
69698
|
+
};
|
69699
|
+
ps.on("close", onClose);
|
69700
|
+
}
|
69701
|
+
}
|
69702
|
+
});
|
69703
|
+
|
69704
69704
|
// src/index.ts
|
69705
69705
|
var src_exports = {};
|
69706
69706
|
__export(src_exports, {
|
69707
69707
|
build: () => build,
|
69708
69708
|
prepareCache: () => prepareCache,
|
69709
|
-
shouldServe: () =>
|
69709
|
+
shouldServe: () => import_build_utils7.shouldServe,
|
69710
69710
|
startDevServer: () => startDevServer,
|
69711
69711
|
version: () => version
|
69712
69712
|
});
|
69713
69713
|
module.exports = __toCommonJS(src_exports);
|
69714
|
+
|
69715
|
+
// src/build.ts
|
69714
69716
|
var import_error_utils = require("@vercel/error-utils");
|
69715
|
-
var import_url2 = __toESM(require("url"));
|
69716
|
-
var import_child_process2 = require("child_process");
|
69717
69717
|
var import_module2 = require("module");
|
69718
69718
|
var import_fs = require("fs");
|
69719
|
-
var
|
69719
|
+
var import_path3 = require("path");
|
69720
69720
|
var import_ts_morph = require("ts-morph");
|
69721
|
-
var import_once2 = __toESM(require_dist());
|
69722
69721
|
var import_nft = require("@vercel/nft");
|
69723
69722
|
var import_resolve_dependency = __toESM(require("@vercel/nft/out/resolve-dependency"));
|
69724
|
-
var
|
69723
|
+
var import_build_utils3 = require("@vercel/build-utils");
|
69725
69724
|
var import_static_config = require("@vercel/static-config");
|
69726
69725
|
|
69727
69726
|
// src/typescript.ts
|
@@ -70100,84 +70099,9 @@ function validateConfiguredRuntime(runtime, entrypoint) {
|
|
70100
70099
|
}
|
70101
70100
|
}
|
70102
70101
|
|
70103
|
-
// src/
|
70104
|
-
var import_once = __toESM(require_dist());
|
70105
|
-
var import_build_utils3 = require("@vercel/build-utils");
|
70106
|
-
var import_child_process = require("child_process");
|
70107
|
-
var import_url = require("url");
|
70108
|
-
var import_path3 = require("path");
|
70109
|
-
function forkDevServer(options) {
|
70110
|
-
let nodeOptions = process.env.NODE_OPTIONS || "";
|
70111
|
-
if (!nodeOptions.includes("--no-warnings")) {
|
70112
|
-
nodeOptions += " --no-warnings";
|
70113
|
-
}
|
70114
|
-
const tsNodePath = options.require_.resolve("ts-node");
|
70115
|
-
const esmLoader = (0, import_url.pathToFileURL)((0, import_path3.join)(tsNodePath, "..", "..", "esm.mjs"));
|
70116
|
-
const cjsLoader = (0, import_path3.join)(tsNodePath, "..", "..", "register", "index.js");
|
70117
|
-
const devServerPath = options.devServerPath || (0, import_path3.join)(__dirname, "dev-server.mjs");
|
70118
|
-
if (options.maybeTranspile) {
|
70119
|
-
if (options.isTypeScript) {
|
70120
|
-
nodeOptions = `--require ${cjsLoader} --loader ${esmLoader} ${nodeOptions || ""}`;
|
70121
|
-
} else {
|
70122
|
-
if (options.isEsm) {
|
70123
|
-
} else {
|
70124
|
-
nodeOptions = `--require ${cjsLoader} ${nodeOptions || ""}`;
|
70125
|
-
}
|
70126
|
-
}
|
70127
|
-
}
|
70128
|
-
const forkOptions = {
|
70129
|
-
cwd: options.workPath,
|
70130
|
-
execArgv: [],
|
70131
|
-
env: (0, import_build_utils3.cloneEnv)(process.env, options.meta.env, {
|
70132
|
-
VERCEL_DEV_ENTRYPOINT: options.entrypoint,
|
70133
|
-
VERCEL_DEV_CONFIG: JSON.stringify(options.config),
|
70134
|
-
VERCEL_DEV_BUILD_ENV: JSON.stringify(options.meta.buildEnv || {}),
|
70135
|
-
TS_NODE_TRANSPILE_ONLY: "1",
|
70136
|
-
TS_NODE_COMPILER_OPTIONS: options.tsConfig?.compilerOptions ? JSON.stringify(options.tsConfig.compilerOptions) : void 0,
|
70137
|
-
NODE_OPTIONS: nodeOptions
|
70138
|
-
}),
|
70139
|
-
stdio: options.printLogs ? "pipe" : void 0
|
70140
|
-
};
|
70141
|
-
const child = (0, import_child_process.fork)(devServerPath, [], forkOptions);
|
70142
|
-
if (options.printLogs) {
|
70143
|
-
child.stdout?.on("data", (data) => {
|
70144
|
-
console.log(`stdout: ${data}`);
|
70145
|
-
});
|
70146
|
-
child.stderr?.on("data", (data) => {
|
70147
|
-
console.error(`stderr: ${data}`);
|
70148
|
-
});
|
70149
|
-
}
|
70150
|
-
checkForPid(devServerPath, child);
|
70151
|
-
return child;
|
70152
|
-
}
|
70153
|
-
function checkForPid(path, process2) {
|
70154
|
-
if (!process2.pid) {
|
70155
|
-
throw new Error(`Child Process has no "pid" when forking: "${path}"`);
|
70156
|
-
}
|
70157
|
-
}
|
70158
|
-
async function readMessage(child) {
|
70159
|
-
const onMessage = (0, import_once.default)(child, "message");
|
70160
|
-
const onExit = import_once.default.spread(child, "close");
|
70161
|
-
const result = await Promise.race([
|
70162
|
-
onMessage.then((x) => {
|
70163
|
-
return { state: "message", value: x };
|
70164
|
-
}),
|
70165
|
-
onExit.then((v) => {
|
70166
|
-
return { state: "exit", value: v };
|
70167
|
-
})
|
70168
|
-
]);
|
70169
|
-
onExit.cancel();
|
70170
|
-
onMessage.cancel();
|
70171
|
-
return result;
|
70172
|
-
}
|
70173
|
-
|
70174
|
-
// src/index.ts
|
70175
|
-
var import_tree_kill = __toESM(require_tree_kill());
|
70176
|
-
var import_util = require("util");
|
70102
|
+
// src/build.ts
|
70177
70103
|
var require_2 = (0, import_module2.createRequire)(__filename);
|
70178
|
-
var tscPath = (0, import_path4.resolve)((0, import_path4.dirname)(require_2.resolve("typescript")), "../bin/tsc");
|
70179
70104
|
var libPathRegEx = /^node_modules|[\/\\]node_modules[\/\\]/;
|
70180
|
-
var treeKill = (0, import_util.promisify)(import_tree_kill.default);
|
70181
70105
|
async function downloadInstallAndBundle({
|
70182
70106
|
files,
|
70183
70107
|
entrypoint,
|
@@ -70185,16 +70109,16 @@ async function downloadInstallAndBundle({
|
|
70185
70109
|
config,
|
70186
70110
|
meta
|
70187
70111
|
}) {
|
70188
|
-
const downloadedFiles = await (0,
|
70189
|
-
const entrypointFsDirname = (0,
|
70190
|
-
const nodeVersion = await (0,
|
70112
|
+
const downloadedFiles = await (0, import_build_utils3.download)(files, workPath, meta);
|
70113
|
+
const entrypointFsDirname = (0, import_path3.join)(workPath, (0, import_path3.dirname)(entrypoint));
|
70114
|
+
const nodeVersion = await (0, import_build_utils3.getNodeVersion)(
|
70191
70115
|
entrypointFsDirname,
|
70192
70116
|
void 0,
|
70193
70117
|
config,
|
70194
70118
|
meta
|
70195
70119
|
);
|
70196
|
-
const spawnOpts = (0,
|
70197
|
-
await (0,
|
70120
|
+
const spawnOpts = (0, import_build_utils3.getSpawnOptions)(meta, nodeVersion);
|
70121
|
+
await (0, import_build_utils3.runNpmInstall)(entrypointFsDirname, [], spawnOpts, meta, nodeVersion);
|
70198
70122
|
const entrypointPath = downloadedFiles[entrypoint].fsPath;
|
70199
70123
|
return { entrypointPath, entrypointFsDirname, nodeVersion, spawnOpts };
|
70200
70124
|
}
|
@@ -70218,11 +70142,11 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70218
70142
|
if (config.includeFiles) {
|
70219
70143
|
const includeFiles = typeof config.includeFiles === "string" ? [config.includeFiles] : config.includeFiles;
|
70220
70144
|
for (const pattern of includeFiles) {
|
70221
|
-
const files = await (0,
|
70145
|
+
const files = await (0, import_build_utils3.glob)(pattern, workPath);
|
70222
70146
|
await Promise.all(
|
70223
70147
|
Object.values(files).map(async (entry) => {
|
70224
70148
|
const { fsPath } = entry;
|
70225
|
-
const relPath = (0,
|
70149
|
+
const relPath = (0, import_path3.relative)(baseDir, fsPath);
|
70226
70150
|
fsCache.set(relPath, entry);
|
70227
70151
|
preparedFiles[relPath] = entry;
|
70228
70152
|
})
|
@@ -70231,7 +70155,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70231
70155
|
}
|
70232
70156
|
let tsCompile;
|
70233
70157
|
function compileTypeScript(path, source) {
|
70234
|
-
const relPath = (0,
|
70158
|
+
const relPath = (0, import_path3.relative)(baseDir, path);
|
70235
70159
|
if (!tsCompile) {
|
70236
70160
|
tsCompile = register({
|
70237
70161
|
basePath: workPath,
|
@@ -70245,7 +70169,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70245
70169
|
}
|
70246
70170
|
const { code, map } = tsCompile(source, path);
|
70247
70171
|
tsCompiled.add(relPath);
|
70248
|
-
preparedFiles[renameTStoJS(relPath) + ".map"] = new
|
70172
|
+
preparedFiles[renameTStoJS(relPath) + ".map"] = new import_build_utils3.FileBlob({
|
70249
70173
|
data: JSON.stringify(map)
|
70250
70174
|
});
|
70251
70175
|
source = code;
|
@@ -70272,7 +70196,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70272
70196
|
},
|
70273
70197
|
ignore: config.excludeFiles,
|
70274
70198
|
async readFile(fsPath) {
|
70275
|
-
const relPath = (0,
|
70199
|
+
const relPath = (0, import_path3.relative)(baseDir, fsPath);
|
70276
70200
|
const cached = sourceCache.get(relPath);
|
70277
70201
|
if (typeof cached !== "undefined")
|
70278
70202
|
return cached;
|
@@ -70280,18 +70204,18 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70280
70204
|
let entry;
|
70281
70205
|
let source = (0, import_fs.readFileSync)(fsPath);
|
70282
70206
|
const { mode } = (0, import_fs.lstatSync)(fsPath);
|
70283
|
-
if ((0,
|
70284
|
-
entry = new
|
70207
|
+
if ((0, import_build_utils3.isSymbolicLink)(mode)) {
|
70208
|
+
entry = new import_build_utils3.FileFsRef({ fsPath, mode });
|
70285
70209
|
}
|
70286
|
-
if (isEdgeFunction && (0,
|
70210
|
+
if (isEdgeFunction && (0, import_path3.basename)(fsPath) === "package.json") {
|
70287
70211
|
const pkgJson = JSON.parse(source.toString());
|
70288
70212
|
for (const prop of ["browser", "module"]) {
|
70289
70213
|
const val = pkgJson[prop];
|
70290
70214
|
if (typeof val === "string") {
|
70291
|
-
(0,
|
70215
|
+
(0, import_build_utils3.debug)(`Using "${prop}" field in ${fsPath}`);
|
70292
70216
|
pkgJson.main = val;
|
70293
70217
|
if (!entry) {
|
70294
|
-
entry = new
|
70218
|
+
entry = new import_build_utils3.FileBlob({ data: source, mode });
|
70295
70219
|
}
|
70296
70220
|
source = JSON.stringify(pkgJson);
|
70297
70221
|
break;
|
@@ -70302,7 +70226,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70302
70226
|
source = compileTypeScript(fsPath, source.toString());
|
70303
70227
|
}
|
70304
70228
|
if (!entry) {
|
70305
|
-
entry = new
|
70229
|
+
entry = new import_build_utils3.FileBlob({ data: source, mode });
|
70306
70230
|
}
|
70307
70231
|
fsCache.set(relPath, entry);
|
70308
70232
|
sourceCache.set(relPath, source);
|
@@ -70318,27 +70242,27 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70318
70242
|
}
|
70319
70243
|
);
|
70320
70244
|
for (const warning of warnings) {
|
70321
|
-
(0,
|
70245
|
+
(0, import_build_utils3.debug)(`Warning from trace: ${warning.message}`);
|
70322
70246
|
}
|
70323
70247
|
for (const path of fileList) {
|
70324
70248
|
let entry = fsCache.get(path);
|
70325
70249
|
if (!entry) {
|
70326
|
-
const fsPath = (0,
|
70250
|
+
const fsPath = (0, import_path3.resolve)(baseDir, path);
|
70327
70251
|
const { mode } = (0, import_fs.lstatSync)(fsPath);
|
70328
|
-
if ((0,
|
70329
|
-
entry = new
|
70252
|
+
if ((0, import_build_utils3.isSymbolicLink)(mode)) {
|
70253
|
+
entry = new import_build_utils3.FileFsRef({ fsPath, mode });
|
70330
70254
|
} else {
|
70331
70255
|
const source = (0, import_fs.readFileSync)(fsPath);
|
70332
|
-
entry = new
|
70256
|
+
entry = new import_build_utils3.FileBlob({ data: source, mode });
|
70333
70257
|
}
|
70334
70258
|
}
|
70335
|
-
if ((0,
|
70336
|
-
const symlinkTarget = (0,
|
70259
|
+
if ((0, import_build_utils3.isSymbolicLink)(entry.mode) && entry.type === "FileFsRef") {
|
70260
|
+
const symlinkTarget = (0, import_path3.relative)(
|
70337
70261
|
baseDir,
|
70338
|
-
(0,
|
70262
|
+
(0, import_path3.resolve)((0, import_path3.dirname)(entry.fsPath), (0, import_fs.readlinkSync)(entry.fsPath))
|
70339
70263
|
);
|
70340
|
-
if (!symlinkTarget.startsWith(".." +
|
70341
|
-
const stats = (0, import_fs.statSync)((0,
|
70264
|
+
if (!symlinkTarget.startsWith(".." + import_path3.sep) && !fileList.has(symlinkTarget)) {
|
70265
|
+
const stats = (0, import_fs.statSync)((0, import_path3.resolve)(baseDir, symlinkTarget));
|
70342
70266
|
if (stats.isFile()) {
|
70343
70267
|
fileList.add(symlinkTarget);
|
70344
70268
|
}
|
@@ -70357,9 +70281,9 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70357
70281
|
if (babelCompileEnabled && esmPaths.length) {
|
70358
70282
|
const babelCompile = (await Promise.resolve().then(() => (init_babel(), babel_exports))).compile;
|
70359
70283
|
for (const path of esmPaths) {
|
70360
|
-
const pathDir = (0,
|
70284
|
+
const pathDir = (0, import_path3.join)(workPath, (0, import_path3.dirname)(path));
|
70361
70285
|
if (!pkgCache.has(pathDir)) {
|
70362
|
-
const pathToPkg = await (0,
|
70286
|
+
const pathToPkg = await (0, import_build_utils3.walkParentDirs)({
|
70363
70287
|
base: workPath,
|
70364
70288
|
start: pathDir,
|
70365
70289
|
filename: "package.json"
|
@@ -70371,8 +70295,8 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70371
70295
|
if (pkg.type === "module" && path.endsWith(".js")) {
|
70372
70296
|
continue;
|
70373
70297
|
}
|
70374
|
-
const filename = (0,
|
70375
|
-
const { data: source } = await
|
70298
|
+
const filename = (0, import_path3.basename)(path);
|
70299
|
+
const { data: source } = await import_build_utils3.FileBlob.fromStream({
|
70376
70300
|
stream: preparedFiles[path].toStream()
|
70377
70301
|
});
|
70378
70302
|
if (!meta.compiledToCommonJS) {
|
@@ -70384,12 +70308,12 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
|
|
70384
70308
|
console.log(`Compiling "${filename}" from ESM to CommonJS...`);
|
70385
70309
|
const { code, map } = babelCompile(filename, String(source));
|
70386
70310
|
shouldAddSourcemapSupport = true;
|
70387
|
-
preparedFiles[path] = new
|
70311
|
+
preparedFiles[path] = new import_build_utils3.FileBlob({
|
70388
70312
|
data: `${code}
|
70389
70313
|
//# sourceMappingURL=${filename}.map`
|
70390
70314
|
});
|
70391
70315
|
delete map.sourcesContent;
|
70392
|
-
preparedFiles[path + ".map"] = new
|
70316
|
+
preparedFiles[path + ".map"] = new import_build_utils3.FileBlob({
|
70393
70317
|
data: JSON.stringify(map)
|
70394
70318
|
});
|
70395
70319
|
}
|
@@ -70404,12 +70328,11 @@ function getAWSLambdaHandler(entrypoint, config) {
|
|
70404
70328
|
return config.awsLambdaHandler;
|
70405
70329
|
}
|
70406
70330
|
if (process.env.NODEJS_AWS_HANDLER_NAME) {
|
70407
|
-
const { dir, name } = (0,
|
70408
|
-
return `${dir}${dir ?
|
70331
|
+
const { dir, name } = (0, import_path3.parse)(entrypoint);
|
70332
|
+
return `${dir}${dir ? import_path3.sep : ""}${name}.${process.env.NODEJS_AWS_HANDLER_NAME}`;
|
70409
70333
|
}
|
70410
70334
|
return "";
|
70411
70335
|
}
|
70412
|
-
var version = 3;
|
70413
70336
|
var build = async ({
|
70414
70337
|
files,
|
70415
70338
|
entrypoint,
|
@@ -70427,7 +70350,7 @@ var build = async ({
|
|
70427
70350
|
config,
|
70428
70351
|
meta
|
70429
70352
|
});
|
70430
|
-
await (0,
|
70353
|
+
await (0, import_build_utils3.runPackageJsonScript)(
|
70431
70354
|
entrypointFsDirname,
|
70432
70355
|
// Don't consider "build" script since its intended for frontend code
|
70433
70356
|
["vercel-build", "now-build"],
|
@@ -70442,7 +70365,7 @@ var build = async ({
|
|
70442
70365
|
if (runtime) {
|
70443
70366
|
isEdgeFunction = isEdgeRuntime(runtime);
|
70444
70367
|
}
|
70445
|
-
(0,
|
70368
|
+
(0, import_build_utils3.debug)("Tracing input files...");
|
70446
70369
|
const traceTime = Date.now();
|
70447
70370
|
const { preparedFiles, shouldAddSourcemapSupport } = await compile2(
|
70448
70371
|
workPath,
|
@@ -70453,10 +70376,10 @@ var build = async ({
|
|
70453
70376
|
nodeVersion,
|
70454
70377
|
isEdgeFunction
|
70455
70378
|
);
|
70456
|
-
(0,
|
70379
|
+
(0, import_build_utils3.debug)(`Trace complete [${Date.now() - traceTime}ms]`);
|
70457
70380
|
let routes;
|
70458
70381
|
let output;
|
70459
|
-
const handler = renameTStoJS((0,
|
70382
|
+
const handler = renameTStoJS((0, import_path3.relative)(baseDir, entrypointPath));
|
70460
70383
|
const outputPath = entrypointToOutputPath(entrypoint, config.zeroConfig);
|
70461
70384
|
if (isMiddleware) {
|
70462
70385
|
if (!isEdgeFunction) {
|
@@ -70484,7 +70407,7 @@ var build = async ({
|
|
70484
70407
|
];
|
70485
70408
|
}
|
70486
70409
|
if (isEdgeFunction) {
|
70487
|
-
output = new
|
70410
|
+
output = new import_build_utils3.EdgeFunction({
|
70488
70411
|
entrypoint: handler,
|
70489
70412
|
files: preparedFiles,
|
70490
70413
|
regions: staticConfig?.regions,
|
@@ -70493,7 +70416,7 @@ var build = async ({
|
|
70493
70416
|
} else {
|
70494
70417
|
const shouldAddHelpers = !(config.helpers === false || process.env.NODEJS_HELPERS === "0");
|
70495
70418
|
const supportsResponseStreaming = (staticConfig?.supportsResponseStreaming ?? staticConfig?.experimentalResponseStreaming) === true ? true : void 0;
|
70496
|
-
output = new
|
70419
|
+
output = new import_build_utils3.NodejsLambda({
|
70497
70420
|
files: preparedFiles,
|
70498
70421
|
handler,
|
70499
70422
|
runtime: nodeVersion.runtime,
|
@@ -70506,34 +70429,127 @@ var build = async ({
|
|
70506
70429
|
}
|
70507
70430
|
return { routes, output };
|
70508
70431
|
};
|
70432
|
+
|
70433
|
+
// src/prepare-cache.ts
|
70434
|
+
var import_build_utils4 = require("@vercel/build-utils");
|
70509
70435
|
var prepareCache = ({ repoRootPath, workPath }) => {
|
70510
70436
|
return (0, import_build_utils4.glob)("**/node_modules/**", repoRootPath || workPath);
|
70511
70437
|
};
|
70438
|
+
|
70439
|
+
// src/start-dev-server.ts
|
70440
|
+
var import_once2 = __toESM(require_dist());
|
70441
|
+
var import_url2 = __toESM(require("url"));
|
70442
|
+
var import_module3 = require("module");
|
70443
|
+
var import_fs2 = require("fs");
|
70444
|
+
var import_path5 = require("path");
|
70445
|
+
var import_child_process2 = require("child_process");
|
70446
|
+
var import_tree_kill = __toESM(require_tree_kill());
|
70447
|
+
var import_util = require("util");
|
70448
|
+
var import_build_utils6 = require("@vercel/build-utils");
|
70449
|
+
var import_error_utils2 = require("@vercel/error-utils");
|
70450
|
+
var import_static_config2 = require("@vercel/static-config");
|
70451
|
+
var import_ts_morph2 = require("ts-morph");
|
70452
|
+
|
70453
|
+
// src/fork-dev-server.ts
|
70454
|
+
var import_once = __toESM(require_dist());
|
70455
|
+
var import_build_utils5 = require("@vercel/build-utils");
|
70456
|
+
var import_child_process = require("child_process");
|
70457
|
+
var import_url = require("url");
|
70458
|
+
var import_path4 = require("path");
|
70459
|
+
function forkDevServer(options) {
|
70460
|
+
let nodeOptions = process.env.NODE_OPTIONS || "";
|
70461
|
+
if (!nodeOptions.includes("--no-warnings")) {
|
70462
|
+
nodeOptions += " --no-warnings";
|
70463
|
+
}
|
70464
|
+
const tsNodePath = options.require_.resolve("ts-node");
|
70465
|
+
const esmLoader = (0, import_url.pathToFileURL)((0, import_path4.join)(tsNodePath, "..", "..", "esm.mjs"));
|
70466
|
+
const cjsLoader = (0, import_path4.join)(tsNodePath, "..", "..", "register", "index.js");
|
70467
|
+
const devServerPath = options.devServerPath || (0, import_path4.join)(__dirname, "dev-server.mjs");
|
70468
|
+
if (options.maybeTranspile) {
|
70469
|
+
if (options.isTypeScript) {
|
70470
|
+
nodeOptions = `--require ${cjsLoader} --loader ${esmLoader} ${nodeOptions || ""}`;
|
70471
|
+
} else {
|
70472
|
+
if (options.isEsm) {
|
70473
|
+
} else {
|
70474
|
+
nodeOptions = `--require ${cjsLoader} ${nodeOptions || ""}`;
|
70475
|
+
}
|
70476
|
+
}
|
70477
|
+
}
|
70478
|
+
const forkOptions = {
|
70479
|
+
cwd: options.workPath,
|
70480
|
+
execArgv: [],
|
70481
|
+
env: (0, import_build_utils5.cloneEnv)(process.env, options.meta.env, {
|
70482
|
+
VERCEL_DEV_ENTRYPOINT: options.entrypoint,
|
70483
|
+
VERCEL_DEV_CONFIG: JSON.stringify(options.config),
|
70484
|
+
VERCEL_DEV_BUILD_ENV: JSON.stringify(options.meta.buildEnv || {}),
|
70485
|
+
TS_NODE_TRANSPILE_ONLY: "1",
|
70486
|
+
TS_NODE_COMPILER_OPTIONS: options.tsConfig?.compilerOptions ? JSON.stringify(options.tsConfig.compilerOptions) : void 0,
|
70487
|
+
NODE_OPTIONS: nodeOptions
|
70488
|
+
}),
|
70489
|
+
stdio: options.printLogs ? "pipe" : void 0
|
70490
|
+
};
|
70491
|
+
const child = (0, import_child_process.fork)(devServerPath, [], forkOptions);
|
70492
|
+
if (options.printLogs) {
|
70493
|
+
child.stdout?.on("data", (data) => {
|
70494
|
+
console.log(`stdout: ${data}`);
|
70495
|
+
});
|
70496
|
+
child.stderr?.on("data", (data) => {
|
70497
|
+
console.error(`stderr: ${data}`);
|
70498
|
+
});
|
70499
|
+
}
|
70500
|
+
checkForPid(devServerPath, child);
|
70501
|
+
return child;
|
70502
|
+
}
|
70503
|
+
function checkForPid(path, process2) {
|
70504
|
+
if (!process2.pid) {
|
70505
|
+
throw new Error(`Child Process has no "pid" when forking: "${path}"`);
|
70506
|
+
}
|
70507
|
+
}
|
70508
|
+
async function readMessage(child) {
|
70509
|
+
const onMessage = (0, import_once.default)(child, "message");
|
70510
|
+
const onExit = import_once.default.spread(child, "close");
|
70511
|
+
const result = await Promise.race([
|
70512
|
+
onMessage.then((x) => {
|
70513
|
+
return { state: "message", value: x };
|
70514
|
+
}),
|
70515
|
+
onExit.then((v) => {
|
70516
|
+
return { state: "exit", value: v };
|
70517
|
+
})
|
70518
|
+
]);
|
70519
|
+
onExit.cancel();
|
70520
|
+
onMessage.cancel();
|
70521
|
+
return result;
|
70522
|
+
}
|
70523
|
+
|
70524
|
+
// src/start-dev-server.ts
|
70525
|
+
var require_3 = (0, import_module3.createRequire)(__filename);
|
70526
|
+
var treeKill = (0, import_util.promisify)(import_tree_kill.default);
|
70527
|
+
var tscPath = (0, import_path5.resolve)((0, import_path5.dirname)(require_3.resolve("typescript")), "../bin/tsc");
|
70512
70528
|
var startDevServer = async (opts) => {
|
70513
70529
|
const { entrypoint, workPath, config, meta = {} } = opts;
|
70514
|
-
const entrypointPath = (0,
|
70530
|
+
const entrypointPath = (0, import_path5.join)(workPath, entrypoint);
|
70515
70531
|
if (config.middleware === true && typeof meta.requestUrl === "string") {
|
70516
|
-
const project = new
|
70517
|
-
const staticConfig = (0,
|
70532
|
+
const project = new import_ts_morph2.Project();
|
70533
|
+
const staticConfig = (0, import_static_config2.getConfig)(project, entrypointPath);
|
70518
70534
|
const matchers = new RegExp(getRegExpFromMatchers(staticConfig?.matcher));
|
70519
70535
|
const parsed = import_url2.default.parse(meta.requestUrl, true);
|
70520
70536
|
if (typeof parsed.pathname !== "string" || !matchers.test(parsed.pathname)) {
|
70521
70537
|
return null;
|
70522
70538
|
}
|
70523
70539
|
}
|
70524
|
-
const entryDir = (0,
|
70525
|
-
const ext = (0,
|
70526
|
-
const pathToTsConfig = await (0,
|
70540
|
+
const entryDir = (0, import_path5.dirname)(entrypointPath);
|
70541
|
+
const ext = (0, import_path5.extname)(entrypoint);
|
70542
|
+
const pathToTsConfig = await (0, import_build_utils6.walkParentDirs)({
|
70527
70543
|
base: workPath,
|
70528
70544
|
start: entryDir,
|
70529
70545
|
filename: "tsconfig.json"
|
70530
70546
|
});
|
70531
|
-
const pathToPkg = await (0,
|
70547
|
+
const pathToPkg = await (0, import_build_utils6.walkParentDirs)({
|
70532
70548
|
base: workPath,
|
70533
70549
|
start: entryDir,
|
70534
70550
|
filename: "package.json"
|
70535
70551
|
});
|
70536
|
-
const pkg = pathToPkg ?
|
70552
|
+
const pkg = pathToPkg ? require_3(pathToPkg) : {};
|
70537
70553
|
const isTypeScript = [".ts", ".tsx", ".mts", ".cts"].includes(ext);
|
70538
70554
|
const maybeTranspile = isTypeScript || ![".cjs", ".mjs"].includes(ext);
|
70539
70555
|
const isEsm = ext === ".mjs" || ext === ".mts" || pkg.type === "module" && [".js", ".ts", ".tsx"].includes(ext);
|
@@ -70541,28 +70557,28 @@ var startDevServer = async (opts) => {
|
|
70541
70557
|
if (maybeTranspile) {
|
70542
70558
|
const resolveTypescript = (p) => {
|
70543
70559
|
try {
|
70544
|
-
return
|
70560
|
+
return require_3.resolve("typescript", {
|
70545
70561
|
paths: [p]
|
70546
70562
|
});
|
70547
70563
|
} catch (_) {
|
70548
70564
|
return "";
|
70549
70565
|
}
|
70550
70566
|
};
|
70551
|
-
const requireTypescript = (p) =>
|
70567
|
+
const requireTypescript = (p) => require_3(p);
|
70552
70568
|
let ts = null;
|
70553
70569
|
let compiler = resolveTypescript(process.cwd());
|
70554
70570
|
if (compiler) {
|
70555
70571
|
ts = requireTypescript(compiler);
|
70556
70572
|
}
|
70557
70573
|
if (!ts) {
|
70558
|
-
compiler = resolveTypescript((0,
|
70574
|
+
compiler = resolveTypescript((0, import_path5.join)(__dirname, ".."));
|
70559
70575
|
ts = requireTypescript(compiler);
|
70560
70576
|
}
|
70561
70577
|
if (pathToTsConfig) {
|
70562
70578
|
try {
|
70563
70579
|
tsConfig = ts.readConfigFile(pathToTsConfig, ts.sys.readFile).config;
|
70564
70580
|
} catch (error) {
|
70565
|
-
if ((0,
|
70581
|
+
if ((0, import_error_utils2.isErrnoException)(error) && error.code !== "ENOENT") {
|
70566
70582
|
console.error(`Error while parsing "${pathToTsConfig}"`);
|
70567
70583
|
throw error;
|
70568
70584
|
}
|
@@ -70588,7 +70604,7 @@ var startDevServer = async (opts) => {
|
|
70588
70604
|
workPath,
|
70589
70605
|
config,
|
70590
70606
|
entrypoint,
|
70591
|
-
require_:
|
70607
|
+
require_: require_3,
|
70592
70608
|
isEsm,
|
70593
70609
|
isTypeScript,
|
70594
70610
|
maybeTranspile,
|
@@ -70618,23 +70634,23 @@ var startDevServer = async (opts) => {
|
|
70618
70634
|
}
|
70619
70635
|
};
|
70620
70636
|
async function doTypeCheck({ entrypoint, workPath, meta = {} }, projectTsConfig) {
|
70621
|
-
const { devCacheDir = (0,
|
70622
|
-
const entrypointCacheDir = (0,
|
70623
|
-
const tsconfigName = projectTsConfig ? `tsconfig-with-${(0,
|
70637
|
+
const { devCacheDir = (0, import_path5.join)(workPath, ".vercel", "cache") } = meta;
|
70638
|
+
const entrypointCacheDir = (0, import_path5.join)(devCacheDir, "node", entrypoint);
|
70639
|
+
const tsconfigName = projectTsConfig ? `tsconfig-with-${(0, import_path5.relative)(workPath, projectTsConfig).replace(
|
70624
70640
|
/[\\/.]/g,
|
70625
70641
|
"-"
|
70626
70642
|
)}.json` : "tsconfig.json";
|
70627
|
-
const tsconfigPath = (0,
|
70643
|
+
const tsconfigPath = (0, import_path5.join)(entrypointCacheDir, tsconfigName);
|
70628
70644
|
const tsconfig = {
|
70629
|
-
extends: projectTsConfig ? (0,
|
70630
|
-
include: [(0,
|
70645
|
+
extends: projectTsConfig ? (0, import_path5.relative)(entrypointCacheDir, projectTsConfig) : void 0,
|
70646
|
+
include: [(0, import_path5.relative)(entrypointCacheDir, (0, import_path5.join)(workPath, entrypoint))]
|
70631
70647
|
};
|
70632
70648
|
try {
|
70633
70649
|
const json = JSON.stringify(tsconfig, null, " ");
|
70634
|
-
await
|
70635
|
-
await
|
70650
|
+
await import_fs2.promises.mkdir(entrypointCacheDir, { recursive: true });
|
70651
|
+
await import_fs2.promises.writeFile(tsconfigPath, json, { flag: "wx" });
|
70636
70652
|
} catch (error) {
|
70637
|
-
if ((0,
|
70653
|
+
if ((0, import_error_utils2.isErrnoException)(error) && error.code !== "EEXIST")
|
70638
70654
|
throw error;
|
70639
70655
|
}
|
70640
70656
|
const child = (0, import_child_process2.spawn)(
|
@@ -70654,6 +70670,10 @@ async function doTypeCheck({ entrypoint, workPath, meta = {} }, projectTsConfig)
|
|
70654
70670
|
);
|
70655
70671
|
await import_once2.default.spread(child, "close");
|
70656
70672
|
}
|
70673
|
+
|
70674
|
+
// src/index.ts
|
70675
|
+
var import_build_utils7 = require("@vercel/build-utils");
|
70676
|
+
var version = 3;
|
70657
70677
|
// Annotate the CommonJS export names for ESM import in node:
|
70658
70678
|
0 && (module.exports = {
|
70659
70679
|
build,
|