@vercel/node 2.12.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dev-server.js → dev-server.mjs} +20 -28
- package/dist/edge-functions/{edge-handler.js → edge-handler.mjs} +29 -53
- package/dist/edge-functions/{edge-node-compat-plugin.js → edge-node-compat-plugin.mjs} +12 -20
- package/dist/edge-functions/{edge-wasm-plugin.js → edge-wasm-plugin.mjs} +7 -12
- package/dist/fork-dev-server.js +7 -13
- package/dist/index.d.ts +13 -12
- package/dist/index.js +115 -193
- package/dist/serverless-functions/helpers.js +1 -1
- package/dist/serverless-functions/serverless-handler.mjs +65 -0
- package/dist/typescript.js +4 -4
- package/dist/utils.js +5 -5
- package/package.json +8 -9
- package/dist/edge-functions/edge-handler.d.ts +0 -4
- package/dist/edge-functions/edge-node-compat-plugin.d.ts +0 -15
- package/dist/edge-functions/edge-wasm-plugin.d.ts +0 -21
- package/dist/fork-dev-server.d.ts +0 -34
- package/dist/serverless-functions/dynamic-import.js +0 -13
- package/dist/serverless-functions/helpers.d.ts +0 -22
- package/dist/serverless-functions/serverless-handler.d.ts +0 -10
- package/dist/serverless-functions/serverless-handler.js +0 -70
package/dist/index.js
CHANGED
@@ -15545,7 +15545,7 @@ function hoistVariables(path, emit, kind = "var") {
|
|
15545
15545
|
|
15546
15546
|
/***/ }),
|
15547
15547
|
|
15548
|
-
/***/
|
15548
|
+
/***/ 92288:
|
15549
15549
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
15550
15550
|
|
15551
15551
|
"use strict";
|
@@ -15555,11 +15555,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
15555
15555
|
value: true
|
15556
15556
|
}));
|
15557
15557
|
exports.default = void 0;
|
15558
|
-
|
15559
15558
|
var _assert = __webpack_require__(42357);
|
15560
|
-
|
15561
15559
|
var _t = __webpack_require__(32338);
|
15562
|
-
|
15563
15560
|
const {
|
15564
15561
|
callExpression,
|
15565
15562
|
cloneNode,
|
@@ -15574,7 +15571,6 @@ const {
|
|
15574
15571
|
variableDeclaration,
|
15575
15572
|
variableDeclarator
|
15576
15573
|
} = _t;
|
15577
|
-
|
15578
15574
|
class ImportBuilder {
|
15579
15575
|
constructor(importedSource, scope, hub) {
|
15580
15576
|
this._statements = [];
|
@@ -15584,139 +15580,102 @@ class ImportBuilder {
|
|
15584
15580
|
this._hub = hub;
|
15585
15581
|
this._importedSource = importedSource;
|
15586
15582
|
}
|
15587
|
-
|
15588
15583
|
done() {
|
15589
15584
|
return {
|
15590
15585
|
statements: this._statements,
|
15591
15586
|
resultName: this._resultName
|
15592
15587
|
};
|
15593
15588
|
}
|
15594
|
-
|
15595
15589
|
import() {
|
15596
15590
|
this._statements.push(importDeclaration([], stringLiteral(this._importedSource)));
|
15597
|
-
|
15598
15591
|
return this;
|
15599
15592
|
}
|
15600
|
-
|
15601
15593
|
require() {
|
15602
15594
|
this._statements.push(expressionStatement(callExpression(identifier("require"), [stringLiteral(this._importedSource)])));
|
15603
|
-
|
15604
15595
|
return this;
|
15605
15596
|
}
|
15606
|
-
|
15607
15597
|
namespace(name = "namespace") {
|
15608
15598
|
const local = this._scope.generateUidIdentifier(name);
|
15609
|
-
|
15610
15599
|
const statement = this._statements[this._statements.length - 1];
|
15611
|
-
|
15612
15600
|
_assert(statement.type === "ImportDeclaration");
|
15613
|
-
|
15614
15601
|
_assert(statement.specifiers.length === 0);
|
15615
|
-
|
15616
15602
|
statement.specifiers = [importNamespaceSpecifier(local)];
|
15617
15603
|
this._resultName = cloneNode(local);
|
15618
15604
|
return this;
|
15619
15605
|
}
|
15620
|
-
|
15621
15606
|
default(name) {
|
15622
15607
|
const id = this._scope.generateUidIdentifier(name);
|
15623
|
-
|
15624
15608
|
const statement = this._statements[this._statements.length - 1];
|
15625
|
-
|
15626
15609
|
_assert(statement.type === "ImportDeclaration");
|
15627
|
-
|
15628
15610
|
_assert(statement.specifiers.length === 0);
|
15629
|
-
|
15630
15611
|
statement.specifiers = [importDefaultSpecifier(id)];
|
15631
15612
|
this._resultName = cloneNode(id);
|
15632
15613
|
return this;
|
15633
15614
|
}
|
15634
|
-
|
15635
15615
|
named(name, importName) {
|
15636
15616
|
if (importName === "default") return this.default(name);
|
15637
|
-
|
15638
15617
|
const id = this._scope.generateUidIdentifier(name);
|
15639
|
-
|
15640
15618
|
const statement = this._statements[this._statements.length - 1];
|
15641
|
-
|
15642
15619
|
_assert(statement.type === "ImportDeclaration");
|
15643
|
-
|
15644
15620
|
_assert(statement.specifiers.length === 0);
|
15645
|
-
|
15646
15621
|
statement.specifiers = [importSpecifier(id, identifier(importName))];
|
15647
15622
|
this._resultName = cloneNode(id);
|
15648
15623
|
return this;
|
15649
15624
|
}
|
15650
|
-
|
15651
15625
|
var(name) {
|
15652
15626
|
const id = this._scope.generateUidIdentifier(name);
|
15653
|
-
|
15654
15627
|
let statement = this._statements[this._statements.length - 1];
|
15655
|
-
|
15656
15628
|
if (statement.type !== "ExpressionStatement") {
|
15657
15629
|
_assert(this._resultName);
|
15658
|
-
|
15659
15630
|
statement = expressionStatement(this._resultName);
|
15660
|
-
|
15661
15631
|
this._statements.push(statement);
|
15662
15632
|
}
|
15663
|
-
|
15664
15633
|
this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(id, statement.expression)]);
|
15665
15634
|
this._resultName = cloneNode(id);
|
15666
15635
|
return this;
|
15667
15636
|
}
|
15668
|
-
|
15669
15637
|
defaultInterop() {
|
15670
15638
|
return this._interop(this._hub.addHelper("interopRequireDefault"));
|
15671
15639
|
}
|
15672
|
-
|
15673
15640
|
wildcardInterop() {
|
15674
15641
|
return this._interop(this._hub.addHelper("interopRequireWildcard"));
|
15675
15642
|
}
|
15676
|
-
|
15677
15643
|
_interop(callee) {
|
15678
15644
|
const statement = this._statements[this._statements.length - 1];
|
15679
|
-
|
15680
15645
|
if (statement.type === "ExpressionStatement") {
|
15681
15646
|
statement.expression = callExpression(callee, [statement.expression]);
|
15682
15647
|
} else if (statement.type === "VariableDeclaration") {
|
15683
15648
|
_assert(statement.declarations.length === 1);
|
15684
|
-
|
15685
15649
|
statement.declarations[0].init = callExpression(callee, [statement.declarations[0].init]);
|
15686
15650
|
} else {
|
15687
15651
|
_assert.fail("Unexpected type.");
|
15688
15652
|
}
|
15689
|
-
|
15690
15653
|
return this;
|
15691
15654
|
}
|
15692
|
-
|
15693
15655
|
prop(name) {
|
15694
15656
|
const statement = this._statements[this._statements.length - 1];
|
15695
|
-
|
15696
15657
|
if (statement.type === "ExpressionStatement") {
|
15697
15658
|
statement.expression = memberExpression(statement.expression, identifier(name));
|
15698
15659
|
} else if (statement.type === "VariableDeclaration") {
|
15699
15660
|
_assert(statement.declarations.length === 1);
|
15700
|
-
|
15701
15661
|
statement.declarations[0].init = memberExpression(statement.declarations[0].init, identifier(name));
|
15702
15662
|
} else {
|
15703
15663
|
_assert.fail("Unexpected type:" + statement.type);
|
15704
15664
|
}
|
15705
|
-
|
15706
15665
|
return this;
|
15707
15666
|
}
|
15708
|
-
|
15709
15667
|
read(name) {
|
15710
15668
|
this._resultName = memberExpression(this._resultName, identifier(name));
|
15711
15669
|
}
|
15712
|
-
|
15713
15670
|
}
|
15714
|
-
|
15715
15671
|
exports.default = ImportBuilder;
|
15716
15672
|
|
15673
|
+
//# sourceMappingURL=import-builder.js.map
|
15674
|
+
|
15675
|
+
|
15717
15676
|
/***/ }),
|
15718
15677
|
|
15719
|
-
/***/
|
15678
|
+
/***/ 37615:
|
15720
15679
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
15721
15680
|
|
15722
15681
|
"use strict";
|
@@ -15726,20 +15685,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
15726
15685
|
value: true
|
15727
15686
|
}));
|
15728
15687
|
exports.default = void 0;
|
15729
|
-
|
15730
15688
|
var _assert = __webpack_require__(42357);
|
15731
|
-
|
15732
15689
|
var _t = __webpack_require__(32338);
|
15733
|
-
|
15734
|
-
var
|
15735
|
-
|
15736
|
-
var _isModule = __webpack_require__(77901);
|
15737
|
-
|
15690
|
+
var _importBuilder = __webpack_require__(92288);
|
15691
|
+
var _isModule = __webpack_require__(59462);
|
15738
15692
|
const {
|
15739
15693
|
numericLiteral,
|
15740
15694
|
sequenceExpression
|
15741
15695
|
} = _t;
|
15742
|
-
|
15743
15696
|
class ImportInjector {
|
15744
15697
|
constructor(path, importedSource, opts) {
|
15745
15698
|
this._defaultOpts = {
|
@@ -15757,46 +15710,35 @@ class ImportInjector {
|
|
15757
15710
|
this._hub = programPath.hub;
|
15758
15711
|
this._defaultOpts = this._applyDefaults(importedSource, opts, true);
|
15759
15712
|
}
|
15760
|
-
|
15761
15713
|
addDefault(importedSourceIn, opts) {
|
15762
15714
|
return this.addNamed("default", importedSourceIn, opts);
|
15763
15715
|
}
|
15764
|
-
|
15765
15716
|
addNamed(importName, importedSourceIn, opts) {
|
15766
15717
|
_assert(typeof importName === "string");
|
15767
|
-
|
15768
15718
|
return this._generateImport(this._applyDefaults(importedSourceIn, opts), importName);
|
15769
15719
|
}
|
15770
|
-
|
15771
15720
|
addNamespace(importedSourceIn, opts) {
|
15772
15721
|
return this._generateImport(this._applyDefaults(importedSourceIn, opts), null);
|
15773
15722
|
}
|
15774
|
-
|
15775
15723
|
addSideEffect(importedSourceIn, opts) {
|
15776
15724
|
return this._generateImport(this._applyDefaults(importedSourceIn, opts), void 0);
|
15777
15725
|
}
|
15778
|
-
|
15779
15726
|
_applyDefaults(importedSource, opts, isInit = false) {
|
15780
15727
|
let newOpts;
|
15781
|
-
|
15782
15728
|
if (typeof importedSource === "string") {
|
15783
15729
|
newOpts = Object.assign({}, this._defaultOpts, {
|
15784
15730
|
importedSource
|
15785
15731
|
}, opts);
|
15786
15732
|
} else {
|
15787
15733
|
_assert(!opts, "Unexpected secondary arguments.");
|
15788
|
-
|
15789
15734
|
newOpts = Object.assign({}, this._defaultOpts, importedSource);
|
15790
15735
|
}
|
15791
|
-
|
15792
15736
|
if (!isInit && opts) {
|
15793
15737
|
if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint;
|
15794
15738
|
if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist;
|
15795
15739
|
}
|
15796
|
-
|
15797
15740
|
return newOpts;
|
15798
15741
|
}
|
15799
|
-
|
15800
15742
|
_generateImport(opts, importName) {
|
15801
15743
|
const isDefault = importName === "default";
|
15802
15744
|
const isNamed = !!importName && !isDefault;
|
@@ -15816,20 +15758,15 @@ class ImportInjector {
|
|
15816
15758
|
const isMod = (0, _isModule.default)(this._programPath);
|
15817
15759
|
const isModuleForNode = isMod && importingInterop === "node";
|
15818
15760
|
const isModuleForBabel = isMod && importingInterop === "babel";
|
15819
|
-
|
15820
15761
|
if (importPosition === "after" && !isMod) {
|
15821
15762
|
throw new Error(`"importPosition": "after" is only supported in modules`);
|
15822
15763
|
}
|
15823
|
-
|
15824
15764
|
const builder = new _importBuilder.default(importedSource, this._programScope, this._hub);
|
15825
|
-
|
15826
15765
|
if (importedType === "es6") {
|
15827
15766
|
if (!isModuleForNode && !isModuleForBabel) {
|
15828
15767
|
throw new Error("Cannot import an ES6 module from CommonJS");
|
15829
15768
|
}
|
15830
|
-
|
15831
15769
|
builder.import();
|
15832
|
-
|
15833
15770
|
if (isNamespace) {
|
15834
15771
|
builder.namespace(nameHint || importedSource);
|
15835
15772
|
} else if (isDefault || isNamed) {
|
@@ -15842,7 +15779,6 @@ class ImportInjector {
|
|
15842
15779
|
name = name !== "default" ? name : importedSource;
|
15843
15780
|
const es6Default = `${importedSource}$es6Default`;
|
15844
15781
|
builder.import();
|
15845
|
-
|
15846
15782
|
if (isNamespace) {
|
15847
15783
|
builder.default(es6Default).var(name || importedSource).wildcardInterop();
|
15848
15784
|
} else if (isDefault) {
|
@@ -15856,7 +15792,6 @@ class ImportInjector {
|
|
15856
15792
|
}
|
15857
15793
|
} else if (isModuleForBabel) {
|
15858
15794
|
builder.import();
|
15859
|
-
|
15860
15795
|
if (isNamespace) {
|
15861
15796
|
builder.namespace(name || importedSource);
|
15862
15797
|
} else if (isDefault || isNamed) {
|
@@ -15864,7 +15799,6 @@ class ImportInjector {
|
|
15864
15799
|
}
|
15865
15800
|
} else {
|
15866
15801
|
builder.require();
|
15867
|
-
|
15868
15802
|
if (isNamespace) {
|
15869
15803
|
builder.var(name || importedSource).wildcardInterop();
|
15870
15804
|
} else if ((isDefault || isNamed) && ensureLiveReference) {
|
@@ -15884,7 +15818,6 @@ class ImportInjector {
|
|
15884
15818
|
} else if (importedInterop === "compiled") {
|
15885
15819
|
if (isModuleForNode) {
|
15886
15820
|
builder.import();
|
15887
|
-
|
15888
15821
|
if (isNamespace) {
|
15889
15822
|
builder.default(name || importedSource);
|
15890
15823
|
} else if (isDefault || isNamed) {
|
@@ -15892,7 +15825,6 @@ class ImportInjector {
|
|
15892
15825
|
}
|
15893
15826
|
} else if (isModuleForBabel) {
|
15894
15827
|
builder.import();
|
15895
|
-
|
15896
15828
|
if (isNamespace) {
|
15897
15829
|
builder.namespace(name || importedSource);
|
15898
15830
|
} else if (isDefault || isNamed) {
|
@@ -15900,7 +15832,6 @@ class ImportInjector {
|
|
15900
15832
|
}
|
15901
15833
|
} else {
|
15902
15834
|
builder.require();
|
15903
|
-
|
15904
15835
|
if (isNamespace) {
|
15905
15836
|
builder.var(name || importedSource);
|
15906
15837
|
} else if (isDefault || isNamed) {
|
@@ -15915,10 +15846,8 @@ class ImportInjector {
|
|
15915
15846
|
if (isDefault && ensureLiveReference) {
|
15916
15847
|
throw new Error("No live reference for commonjs default");
|
15917
15848
|
}
|
15918
|
-
|
15919
15849
|
if (isModuleForNode) {
|
15920
15850
|
builder.import();
|
15921
|
-
|
15922
15851
|
if (isNamespace) {
|
15923
15852
|
builder.default(name || importedSource);
|
15924
15853
|
} else if (isDefault) {
|
@@ -15928,7 +15857,6 @@ class ImportInjector {
|
|
15928
15857
|
}
|
15929
15858
|
} else if (isModuleForBabel) {
|
15930
15859
|
builder.import();
|
15931
|
-
|
15932
15860
|
if (isNamespace) {
|
15933
15861
|
builder.default(name || importedSource);
|
15934
15862
|
} else if (isDefault) {
|
@@ -15938,7 +15866,6 @@ class ImportInjector {
|
|
15938
15866
|
}
|
15939
15867
|
} else {
|
15940
15868
|
builder.require();
|
15941
|
-
|
15942
15869
|
if (isNamespace) {
|
15943
15870
|
builder.var(name || importedSource);
|
15944
15871
|
} else if (isDefault) {
|
@@ -15954,24 +15881,18 @@ class ImportInjector {
|
|
15954
15881
|
} else {
|
15955
15882
|
throw new Error(`Unknown importedInterop "${importedInterop}".`);
|
15956
15883
|
}
|
15957
|
-
|
15958
15884
|
const {
|
15959
15885
|
statements,
|
15960
15886
|
resultName
|
15961
15887
|
} = builder.done();
|
15962
|
-
|
15963
15888
|
this._insertStatements(statements, importPosition, blockHoist);
|
15964
|
-
|
15965
15889
|
if ((isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier") {
|
15966
15890
|
return sequenceExpression([numericLiteral(0), resultName]);
|
15967
15891
|
}
|
15968
|
-
|
15969
15892
|
return resultName;
|
15970
15893
|
}
|
15971
|
-
|
15972
15894
|
_insertStatements(statements, importPosition = "before", blockHoist = 3) {
|
15973
15895
|
const body = this._programPath.get("body");
|
15974
|
-
|
15975
15896
|
if (importPosition === "after") {
|
15976
15897
|
for (let i = body.length - 1; i >= 0; i--) {
|
15977
15898
|
if (body[i].isImportDeclaration()) {
|
@@ -15987,23 +15908,22 @@ class ImportInjector {
|
|
15987
15908
|
const val = p.node._blockHoist;
|
15988
15909
|
return Number.isFinite(val) && val < 4;
|
15989
15910
|
});
|
15990
|
-
|
15991
15911
|
if (targetPath) {
|
15992
15912
|
targetPath.insertBefore(statements);
|
15993
15913
|
return;
|
15994
15914
|
}
|
15995
15915
|
}
|
15996
|
-
|
15997
15916
|
this._programPath.unshiftContainer("body", statements);
|
15998
15917
|
}
|
15999
|
-
|
16000
15918
|
}
|
16001
|
-
|
16002
15919
|
exports.default = ImportInjector;
|
16003
15920
|
|
15921
|
+
//# sourceMappingURL=import-injector.js.map
|
15922
|
+
|
15923
|
+
|
16004
15924
|
/***/ }),
|
16005
15925
|
|
16006
|
-
/***/
|
15926
|
+
/***/ 10742:
|
16007
15927
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
16008
15928
|
|
16009
15929
|
"use strict";
|
@@ -16028,30 +15948,27 @@ Object.defineProperty(exports, "isModule", ({
|
|
16028
15948
|
return _isModule.default;
|
16029
15949
|
}
|
16030
15950
|
}));
|
16031
|
-
|
16032
|
-
var
|
16033
|
-
|
16034
|
-
var _isModule = __webpack_require__(77901);
|
16035
|
-
|
15951
|
+
var _importInjector = __webpack_require__(37615);
|
15952
|
+
var _isModule = __webpack_require__(59462);
|
16036
15953
|
function addDefault(path, importedSource, opts) {
|
16037
15954
|
return new _importInjector.default(path).addDefault(importedSource, opts);
|
16038
15955
|
}
|
16039
|
-
|
16040
15956
|
function addNamed(path, name, importedSource, opts) {
|
16041
15957
|
return new _importInjector.default(path).addNamed(name, importedSource, opts);
|
16042
15958
|
}
|
16043
|
-
|
16044
15959
|
function addNamespace(path, importedSource, opts) {
|
16045
15960
|
return new _importInjector.default(path).addNamespace(importedSource, opts);
|
16046
15961
|
}
|
16047
|
-
|
16048
15962
|
function addSideEffect(path, importedSource, opts) {
|
16049
15963
|
return new _importInjector.default(path).addSideEffect(importedSource, opts);
|
16050
15964
|
}
|
16051
15965
|
|
15966
|
+
//# sourceMappingURL=index.js.map
|
15967
|
+
|
15968
|
+
|
16052
15969
|
/***/ }),
|
16053
15970
|
|
16054
|
-
/***/
|
15971
|
+
/***/ 59462:
|
16055
15972
|
/***/ ((__unused_webpack_module, exports) => {
|
16056
15973
|
|
16057
15974
|
"use strict";
|
@@ -16061,19 +15978,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
16061
15978
|
value: true
|
16062
15979
|
}));
|
16063
15980
|
exports.default = isModule;
|
16064
|
-
|
16065
15981
|
function isModule(path) {
|
16066
|
-
const {
|
16067
|
-
sourceType
|
16068
|
-
} = path.node;
|
16069
|
-
|
16070
|
-
if (sourceType !== "module" && sourceType !== "script") {
|
16071
|
-
throw path.buildCodeFrameError(`Unknown sourceType "${sourceType}", cannot transform.`);
|
16072
|
-
}
|
16073
|
-
|
16074
15982
|
return path.node.sourceType === "module";
|
16075
15983
|
}
|
16076
15984
|
|
15985
|
+
//# sourceMappingURL=is-module.js.map
|
15986
|
+
|
15987
|
+
|
16077
15988
|
/***/ }),
|
16078
15989
|
|
16079
15990
|
/***/ 40380:
|
@@ -16252,7 +16163,7 @@ exports.wrapInterop = wrapInterop;
|
|
16252
16163
|
var _assert = __webpack_require__(42357);
|
16253
16164
|
var _t = __webpack_require__(32338);
|
16254
16165
|
var _template = __webpack_require__(82272);
|
16255
|
-
var _helperModuleImports = __webpack_require__(
|
16166
|
+
var _helperModuleImports = __webpack_require__(10742);
|
16256
16167
|
var _rewriteThis = __webpack_require__(52831);
|
16257
16168
|
var _rewriteLiveReferences = __webpack_require__(72337);
|
16258
16169
|
var _normalizeAndLoadMetadata = __webpack_require__(34376);
|
@@ -140038,17 +139949,12 @@ const path_1 = __webpack_require__(85622);
|
|
140038
139949
|
function forkDevServer(options) {
|
140039
139950
|
let nodeOptions = process.env.NODE_OPTIONS;
|
140040
139951
|
const tsNodePath = options.require_.resolve('ts-node');
|
140041
|
-
const esmLoader = url_1.pathToFileURL(path_1.join(tsNodePath, '..', '..', 'esm.mjs'));
|
140042
|
-
const cjsLoader = path_1.join(tsNodePath, '..', '..', 'register', 'index.js');
|
140043
|
-
const devServerPath = options.devServerPath || path_1.join(__dirname, 'dev-server.
|
139952
|
+
const esmLoader = (0, url_1.pathToFileURL)((0, path_1.join)(tsNodePath, '..', '..', 'esm.mjs'));
|
139953
|
+
const cjsLoader = (0, path_1.join)(tsNodePath, '..', '..', 'register', 'index.js');
|
139954
|
+
const devServerPath = options.devServerPath || (0, path_1.join)(__dirname, 'dev-server.mjs');
|
140044
139955
|
if (options.maybeTranspile) {
|
140045
139956
|
if (options.isTypeScript) {
|
140046
|
-
|
140047
|
-
nodeOptions = `--loader ${esmLoader} ${nodeOptions || ''}`;
|
140048
|
-
}
|
140049
|
-
else {
|
140050
|
-
nodeOptions = `--require ${cjsLoader} ${nodeOptions || ''}`;
|
140051
|
-
}
|
139957
|
+
nodeOptions = `--loader ${esmLoader} ${nodeOptions || ''}`;
|
140052
139958
|
}
|
140053
139959
|
else {
|
140054
139960
|
if (options.isEsm) {
|
@@ -140062,9 +139968,8 @@ function forkDevServer(options) {
|
|
140062
139968
|
const forkOptions = {
|
140063
139969
|
cwd: options.workPath,
|
140064
139970
|
execArgv: [],
|
140065
|
-
env: build_utils_1.cloneEnv(process.env, options.meta.env, {
|
139971
|
+
env: (0, build_utils_1.cloneEnv)(process.env, options.meta.env, {
|
140066
139972
|
VERCEL_DEV_ENTRYPOINT: options.entrypoint,
|
140067
|
-
VERCEL_DEV_IS_ESM: options.isEsm ? '1' : undefined,
|
140068
139973
|
VERCEL_DEV_CONFIG: JSON.stringify(options.config),
|
140069
139974
|
VERCEL_DEV_BUILD_ENV: JSON.stringify(options.meta.buildEnv || {}),
|
140070
139975
|
TS_NODE_TRANSPILE_ONLY: '1',
|
@@ -140074,7 +139979,7 @@ function forkDevServer(options) {
|
|
140074
139979
|
NODE_OPTIONS: nodeOptions,
|
140075
139980
|
}),
|
140076
139981
|
};
|
140077
|
-
const child = child_process_1.fork(devServerPath, [], forkOptions);
|
139982
|
+
const child = (0, child_process_1.fork)(devServerPath, [], forkOptions);
|
140078
139983
|
checkForPid(devServerPath, child);
|
140079
139984
|
return child;
|
140080
139985
|
}
|
@@ -140090,7 +139995,7 @@ function checkForPid(path, process) {
|
|
140090
139995
|
* or it is listening to new requests, and we can start proxying requests.
|
140091
139996
|
*/
|
140092
139997
|
async function readMessage(child) {
|
140093
|
-
const onMessage = once_1.default(child, 'message');
|
139998
|
+
const onMessage = (0, once_1.default)(child, 'message');
|
140094
139999
|
const onExit = once_1.default.spread(child, 'close');
|
140095
140000
|
const result = await Promise.race([
|
140096
140001
|
onMessage.then(x => {
|
@@ -140116,7 +140021,11 @@ exports.readMessage = readMessage;
|
|
140116
140021
|
|
140117
140022
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
140118
140023
|
if (k2 === undefined) k2 = k;
|
140119
|
-
Object.
|
140024
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
140025
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
140026
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
140027
|
+
}
|
140028
|
+
Object.defineProperty(o, k2, desc);
|
140120
140029
|
}) : (function(o, m, k, k2) {
|
140121
140030
|
if (k2 === undefined) k2 = k;
|
140122
140031
|
o[k2] = m[k];
|
@@ -140146,15 +140055,15 @@ const utils_1 = __webpack_require__(76136);
|
|
140146
140055
|
const fork_dev_server_1 = __webpack_require__(31158);
|
140147
140056
|
const ALLOWED_RUNTIMES = ['nodejs', ...Object.values(utils_1.EdgeRuntimes)];
|
140148
140057
|
const require_ = eval('require');
|
140149
|
-
const tscPath = path_1.resolve(path_1.dirname(require_.resolve('typescript')), '../bin/tsc');
|
140058
|
+
const tscPath = (0, path_1.resolve)((0, path_1.dirname)(require_.resolve('typescript')), '../bin/tsc');
|
140150
140059
|
// eslint-disable-next-line no-useless-escape
|
140151
140060
|
const libPathRegEx = /^node_modules|[\/\\]node_modules[\/\\]/;
|
140152
140061
|
async function downloadInstallAndBundle({ files, entrypoint, workPath, config, meta, }) {
|
140153
|
-
const downloadedFiles = await build_utils_1.download(files, workPath, meta);
|
140154
|
-
const entrypointFsDirname = path_1.join(workPath, path_1.dirname(entrypoint));
|
140155
|
-
const nodeVersion = await build_utils_1.getNodeVersion(entrypointFsDirname, undefined, config, meta);
|
140156
|
-
const spawnOpts = build_utils_1.getSpawnOptions(meta, nodeVersion);
|
140157
|
-
await build_utils_1.runNpmInstall(entrypointFsDirname, [], spawnOpts, meta, nodeVersion);
|
140062
|
+
const downloadedFiles = await (0, build_utils_1.download)(files, workPath, meta);
|
140063
|
+
const entrypointFsDirname = (0, path_1.join)(workPath, (0, path_1.dirname)(entrypoint));
|
140064
|
+
const nodeVersion = await (0, build_utils_1.getNodeVersion)(entrypointFsDirname, undefined, config, meta);
|
140065
|
+
const spawnOpts = (0, build_utils_1.getSpawnOptions)(meta, nodeVersion);
|
140066
|
+
await (0, build_utils_1.runNpmInstall)(entrypointFsDirname, [], spawnOpts, meta, nodeVersion);
|
140158
140067
|
const entrypointPath = downloadedFiles[entrypoint].fsPath;
|
140159
140068
|
return { entrypointPath, entrypointFsDirname, nodeVersion, spawnOpts };
|
140160
140069
|
}
|
@@ -140180,10 +140089,10 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140180
140089
|
? [config.includeFiles]
|
140181
140090
|
: config.includeFiles;
|
140182
140091
|
for (const pattern of includeFiles) {
|
140183
|
-
const files = await build_utils_1.glob(pattern, workPath);
|
140092
|
+
const files = await (0, build_utils_1.glob)(pattern, workPath);
|
140184
140093
|
await Promise.all(Object.values(files).map(async (entry) => {
|
140185
140094
|
const { fsPath } = entry;
|
140186
|
-
const relPath = path_1.relative(baseDir, fsPath);
|
140095
|
+
const relPath = (0, path_1.relative)(baseDir, fsPath);
|
140187
140096
|
fsCache.set(relPath, entry);
|
140188
140097
|
preparedFiles[relPath] = entry;
|
140189
140098
|
}));
|
@@ -140191,9 +140100,9 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140191
140100
|
}
|
140192
140101
|
let tsCompile;
|
140193
140102
|
function compileTypeScript(path, source) {
|
140194
|
-
const relPath = path_1.relative(baseDir, path);
|
140103
|
+
const relPath = (0, path_1.relative)(baseDir, path);
|
140195
140104
|
if (!tsCompile) {
|
140196
|
-
tsCompile = typescript_1.register({
|
140105
|
+
tsCompile = (0, typescript_1.register)({
|
140197
140106
|
basePath: workPath,
|
140198
140107
|
project: path,
|
140199
140108
|
files: true,
|
@@ -140212,7 +140121,7 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140212
140121
|
const conditions = isEdgeFunction
|
140213
140122
|
? ['edge-light', 'browser', 'module', 'import', 'require']
|
140214
140123
|
: undefined;
|
140215
|
-
const { fileList, esmFileList, warnings } = await nft_1.nodeFileTrace([...inputFiles], {
|
140124
|
+
const { fileList, esmFileList, warnings } = await (0, nft_1.nodeFileTrace)([...inputFiles], {
|
140216
140125
|
base: baseDir,
|
140217
140126
|
processCwd: workPath,
|
140218
140127
|
ts: true,
|
@@ -140220,29 +140129,29 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140220
140129
|
conditions,
|
140221
140130
|
resolve(id, parent, job, cjsResolve) {
|
140222
140131
|
const normalizedWasmImports = id.replace(/\.wasm\?module$/i, '.wasm');
|
140223
|
-
return resolve_dependency_1.default(normalizedWasmImports, parent, job, cjsResolve);
|
140132
|
+
return (0, resolve_dependency_1.default)(normalizedWasmImports, parent, job, cjsResolve);
|
140224
140133
|
},
|
140225
140134
|
ignore: config.excludeFiles,
|
140226
140135
|
async readFile(fsPath) {
|
140227
|
-
const relPath = path_1.relative(baseDir, fsPath);
|
140136
|
+
const relPath = (0, path_1.relative)(baseDir, fsPath);
|
140228
140137
|
// If this file has already been read then return from the cache
|
140229
140138
|
const cached = sourceCache.get(relPath);
|
140230
140139
|
if (typeof cached !== 'undefined')
|
140231
140140
|
return cached;
|
140232
140141
|
try {
|
140233
140142
|
let entry;
|
140234
|
-
let source = fs_1.readFileSync(fsPath);
|
140235
|
-
const { mode } = fs_1.lstatSync(fsPath);
|
140236
|
-
if (build_utils_1.isSymbolicLink(mode)) {
|
140143
|
+
let source = (0, fs_1.readFileSync)(fsPath);
|
140144
|
+
const { mode } = (0, fs_1.lstatSync)(fsPath);
|
140145
|
+
if ((0, build_utils_1.isSymbolicLink)(mode)) {
|
140237
140146
|
entry = new build_utils_1.FileFsRef({ fsPath, mode });
|
140238
140147
|
}
|
140239
|
-
if (isEdgeFunction && path_1.basename(fsPath) === 'package.json') {
|
140148
|
+
if (isEdgeFunction && (0, path_1.basename)(fsPath) === 'package.json') {
|
140240
140149
|
// For Edge Functions, patch "main" field to prefer "browser" or "module"
|
140241
140150
|
const pkgJson = JSON.parse(source.toString());
|
140242
140151
|
for (const prop of ['browser', 'module']) {
|
140243
140152
|
const val = pkgJson[prop];
|
140244
140153
|
if (typeof val === 'string') {
|
140245
|
-
build_utils_1.debug(`Using "${prop}" field in ${fsPath}`);
|
140154
|
+
(0, build_utils_1.debug)(`Using "${prop}" field in ${fsPath}`);
|
140246
140155
|
pkgJson.main = val;
|
140247
140156
|
// Create the `entry` with the original so that the output is unmodified
|
140248
140157
|
if (!entry) {
|
@@ -140266,7 +140175,7 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140266
140175
|
return source;
|
140267
140176
|
}
|
140268
140177
|
catch (error) {
|
140269
|
-
if (error_utils_1.isErrnoException(error) &&
|
140178
|
+
if ((0, error_utils_1.isErrnoException)(error) &&
|
140270
140179
|
(error.code === 'ENOENT' || error.code === 'EISDIR')) {
|
140271
140180
|
// `null` represents a not found
|
140272
140181
|
sourceCache.set(relPath, null);
|
@@ -140277,27 +140186,27 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140277
140186
|
},
|
140278
140187
|
});
|
140279
140188
|
for (const warning of warnings) {
|
140280
|
-
build_utils_1.debug(`Warning from trace: ${warning.message}`);
|
140189
|
+
(0, build_utils_1.debug)(`Warning from trace: ${warning.message}`);
|
140281
140190
|
}
|
140282
140191
|
for (const path of fileList) {
|
140283
140192
|
let entry = fsCache.get(path);
|
140284
140193
|
if (!entry) {
|
140285
|
-
const fsPath = path_1.resolve(baseDir, path);
|
140286
|
-
const { mode } = fs_1.lstatSync(fsPath);
|
140287
|
-
if (build_utils_1.isSymbolicLink(mode)) {
|
140194
|
+
const fsPath = (0, path_1.resolve)(baseDir, path);
|
140195
|
+
const { mode } = (0, fs_1.lstatSync)(fsPath);
|
140196
|
+
if ((0, build_utils_1.isSymbolicLink)(mode)) {
|
140288
140197
|
entry = new build_utils_1.FileFsRef({ fsPath, mode });
|
140289
140198
|
}
|
140290
140199
|
else {
|
140291
|
-
const source = fs_1.readFileSync(fsPath);
|
140200
|
+
const source = (0, fs_1.readFileSync)(fsPath);
|
140292
140201
|
entry = new build_utils_1.FileBlob({ data: source, mode });
|
140293
140202
|
}
|
140294
140203
|
}
|
140295
|
-
if (build_utils_1.isSymbolicLink(entry.mode) && entry.type === 'FileFsRef') {
|
140204
|
+
if ((0, build_utils_1.isSymbolicLink)(entry.mode) && entry.type === 'FileFsRef') {
|
140296
140205
|
// ensure the symlink target is added to the file list
|
140297
|
-
const symlinkTarget = path_1.relative(baseDir, path_1.resolve(path_1.dirname(entry.fsPath), fs_1.readlinkSync(entry.fsPath)));
|
140206
|
+
const symlinkTarget = (0, path_1.relative)(baseDir, (0, path_1.resolve)((0, path_1.dirname)(entry.fsPath), (0, fs_1.readlinkSync)(entry.fsPath)));
|
140298
140207
|
if (!symlinkTarget.startsWith('..' + path_1.sep) &&
|
140299
140208
|
!fileList.has(symlinkTarget)) {
|
140300
|
-
const stats = fs_1.statSync(path_1.resolve(baseDir, symlinkTarget));
|
140209
|
+
const stats = (0, fs_1.statSync)((0, path_1.resolve)(baseDir, symlinkTarget));
|
140301
140210
|
if (stats.isFile()) {
|
140302
140211
|
fileList.add(symlinkTarget);
|
140303
140212
|
}
|
@@ -140318,9 +140227,9 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140318
140227
|
if (esmPaths.length) {
|
140319
140228
|
const babelCompile = __webpack_require__(20007)/* .compile */ .M;
|
140320
140229
|
for (const path of esmPaths) {
|
140321
|
-
const pathDir = path_1.join(workPath, path_1.dirname(path));
|
140230
|
+
const pathDir = (0, path_1.join)(workPath, (0, path_1.dirname)(path));
|
140322
140231
|
if (!pkgCache.has(pathDir)) {
|
140323
|
-
const pathToPkg = await build_utils_1.walkParentDirs({
|
140232
|
+
const pathToPkg = await (0, build_utils_1.walkParentDirs)({
|
140324
140233
|
base: workPath,
|
140325
140234
|
start: pathDir,
|
140326
140235
|
filename: 'package.json',
|
@@ -140335,7 +140244,7 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
|
|
140335
140244
|
// https://nodejs.org/api/packages.html#packages_type
|
140336
140245
|
continue;
|
140337
140246
|
}
|
140338
|
-
const filename = path_1.basename(path);
|
140247
|
+
const filename = (0, path_1.basename)(path);
|
140339
140248
|
const { data: source } = await build_utils_1.FileBlob.fromStream({
|
140340
140249
|
stream: preparedFiles[path].toStream(),
|
140341
140250
|
});
|
@@ -140360,7 +140269,7 @@ function getAWSLambdaHandler(entrypoint, config) {
|
|
140360
140269
|
return config.awsLambdaHandler;
|
140361
140270
|
}
|
140362
140271
|
if (process.env.NODEJS_AWS_HANDLER_NAME) {
|
140363
|
-
const { dir, name } = path_1.parse(entrypoint);
|
140272
|
+
const { dir, name } = (0, path_1.parse)(entrypoint);
|
140364
140273
|
return `${dir}${dir ? path_1.sep : ''}${name}.${process.env.NODEJS_AWS_HANDLER_NAME}`;
|
140365
140274
|
}
|
140366
140275
|
return '';
|
@@ -140378,7 +140287,7 @@ const build = async ({ files, entrypoint, workPath, repoRootPath, config = {}, m
|
|
140378
140287
|
config,
|
140379
140288
|
meta,
|
140380
140289
|
});
|
140381
|
-
await build_utils_1.runPackageJsonScript(entrypointFsDirname,
|
140290
|
+
await (0, build_utils_1.runPackageJsonScript)(entrypointFsDirname,
|
140382
140291
|
// Don't consider "build" script since its intended for frontend code
|
140383
140292
|
['vercel-build', 'now-build'], spawnOpts);
|
140384
140293
|
const isMiddleware = config.middleware === true;
|
@@ -140387,7 +140296,7 @@ const build = async ({ files, entrypoint, workPath, repoRootPath, config = {}, m
|
|
140387
140296
|
// `export const config = { runtime: 'edge' }`
|
140388
140297
|
let isEdgeFunction = isMiddleware;
|
140389
140298
|
const project = new ts_morph_1.Project();
|
140390
|
-
const staticConfig = static_config_1.getConfig(project, entrypointPath);
|
140299
|
+
const staticConfig = (0, static_config_1.getConfig)(project, entrypointPath);
|
140391
140300
|
if (staticConfig?.runtime) {
|
140392
140301
|
if (!ALLOWED_RUNTIMES.includes(staticConfig.runtime)) {
|
140393
140302
|
throw new Error(`Unsupported "runtime" property in \`config\`: ${JSON.stringify(staticConfig.runtime)} (must be one of: ${JSON.stringify(ALLOWED_RUNTIMES)})`);
|
@@ -140395,16 +140304,16 @@ const build = async ({ files, entrypoint, workPath, repoRootPath, config = {}, m
|
|
140395
140304
|
if (staticConfig.runtime === 'nodejs') {
|
140396
140305
|
console.log(`Detected unused static config runtime "nodejs" in "${entrypointPath}"`);
|
140397
140306
|
}
|
140398
|
-
isEdgeFunction = utils_1.isEdgeRuntime(staticConfig.runtime);
|
140307
|
+
isEdgeFunction = (0, utils_1.isEdgeRuntime)(staticConfig.runtime);
|
140399
140308
|
}
|
140400
|
-
build_utils_1.debug('Tracing input files...');
|
140309
|
+
(0, build_utils_1.debug)('Tracing input files...');
|
140401
140310
|
const traceTime = Date.now();
|
140402
140311
|
const { preparedFiles, shouldAddSourcemapSupport } = await compile(workPath, baseDir, entrypointPath, config, nodeVersion, isEdgeFunction);
|
140403
|
-
build_utils_1.debug(`Trace complete [${Date.now() - traceTime}ms]`);
|
140312
|
+
(0, build_utils_1.debug)(`Trace complete [${Date.now() - traceTime}ms]`);
|
140404
140313
|
let routes;
|
140405
140314
|
let output;
|
140406
|
-
const handler = renameTStoJS(path_1.relative(baseDir, entrypointPath));
|
140407
|
-
const outputPath = utils_1.entrypointToOutputPath(entrypoint, config.zeroConfig);
|
140315
|
+
const handler = renameTStoJS((0, path_1.relative)(baseDir, entrypointPath));
|
140316
|
+
const outputPath = (0, utils_1.entrypointToOutputPath)(entrypoint, config.zeroConfig);
|
140408
140317
|
// Add a `route` for Middleware
|
140409
140318
|
if (isMiddleware) {
|
140410
140319
|
if (!isEdgeFunction) {
|
@@ -140412,7 +140321,7 @@ const build = async ({ files, entrypoint, workPath, repoRootPath, config = {}, m
|
|
140412
140321
|
throw new Error(`Middleware file can not be a Node.js Serverless Function`);
|
140413
140322
|
}
|
140414
140323
|
// Middleware is a catch-all for all paths unless a `matcher` property is defined
|
140415
|
-
const src = utils_1.getRegExpFromMatchers(staticConfig?.matcher);
|
140324
|
+
const src = (0, utils_1.getRegExpFromMatchers)(staticConfig?.matcher);
|
140416
140325
|
const middlewareRawSrc = [];
|
140417
140326
|
if (staticConfig?.matcher) {
|
140418
140327
|
if (Array.isArray(staticConfig.matcher)) {
|
@@ -140463,19 +140372,19 @@ const build = async ({ files, entrypoint, workPath, repoRootPath, config = {}, m
|
|
140463
140372
|
};
|
140464
140373
|
exports.build = build;
|
140465
140374
|
const prepareCache = ({ repoRootPath, workPath }) => {
|
140466
|
-
return build_utils_1.glob('**/node_modules/**', repoRootPath || workPath);
|
140375
|
+
return (0, build_utils_1.glob)('**/node_modules/**', repoRootPath || workPath);
|
140467
140376
|
};
|
140468
140377
|
exports.prepareCache = prepareCache;
|
140469
140378
|
const startDevServer = async (opts) => {
|
140470
140379
|
const { entrypoint, workPath, config, meta = {} } = opts;
|
140471
|
-
const entrypointPath = path_1.join(workPath, entrypoint);
|
140380
|
+
const entrypointPath = (0, path_1.join)(workPath, entrypoint);
|
140472
140381
|
if (config.middleware === true && typeof meta.requestUrl === 'string') {
|
140473
140382
|
// TODO: static config is also parsed in `dev-server.ts`.
|
140474
140383
|
// we should pass in this version as an env var instead.
|
140475
140384
|
const project = new ts_morph_1.Project();
|
140476
|
-
const staticConfig = static_config_1.getConfig(project, entrypointPath);
|
140385
|
+
const staticConfig = (0, static_config_1.getConfig)(project, entrypointPath);
|
140477
140386
|
// Middleware is a catch-all for all paths unless a `matcher` property is defined
|
140478
|
-
const matchers = new RegExp(utils_1.getRegExpFromMatchers(staticConfig?.matcher));
|
140387
|
+
const matchers = new RegExp((0, utils_1.getRegExpFromMatchers)(staticConfig?.matcher));
|
140479
140388
|
const parsed = url_1.default.parse(meta.requestUrl, true);
|
140480
140389
|
if (typeof parsed.pathname !== 'string' ||
|
140481
140390
|
!matchers.test(parsed.pathname)) {
|
@@ -140484,14 +140393,14 @@ const startDevServer = async (opts) => {
|
|
140484
140393
|
return null;
|
140485
140394
|
}
|
140486
140395
|
}
|
140487
|
-
const entryDir = path_1.dirname(entrypointPath);
|
140488
|
-
const ext = path_1.extname(entrypoint);
|
140489
|
-
const pathToTsConfig = await build_utils_1.walkParentDirs({
|
140396
|
+
const entryDir = (0, path_1.dirname)(entrypointPath);
|
140397
|
+
const ext = (0, path_1.extname)(entrypoint);
|
140398
|
+
const pathToTsConfig = await (0, build_utils_1.walkParentDirs)({
|
140490
140399
|
base: workPath,
|
140491
140400
|
start: entryDir,
|
140492
140401
|
filename: 'tsconfig.json',
|
140493
140402
|
});
|
140494
|
-
const pathToPkg = await build_utils_1.walkParentDirs({
|
140403
|
+
const pathToPkg = await (0, build_utils_1.walkParentDirs)({
|
140495
140404
|
base: workPath,
|
140496
140405
|
start: entryDir,
|
140497
140406
|
filename: 'package.json',
|
@@ -140523,7 +140432,7 @@ const startDevServer = async (opts) => {
|
|
140523
140432
|
}
|
140524
140433
|
// Otherwise fall back to using the copy that `@vercel/node` uses
|
140525
140434
|
if (!ts) {
|
140526
|
-
compiler = resolveTypescript(path_1.join(__dirname, '..'));
|
140435
|
+
compiler = resolveTypescript((0, path_1.join)(__dirname, '..'));
|
140527
140436
|
ts = requireTypescript(compiler);
|
140528
140437
|
}
|
140529
140438
|
if (pathToTsConfig) {
|
@@ -140531,14 +140440,27 @@ const startDevServer = async (opts) => {
|
|
140531
140440
|
tsConfig = ts.readConfigFile(pathToTsConfig, ts.sys.readFile).config;
|
140532
140441
|
}
|
140533
140442
|
catch (error) {
|
140534
|
-
if (error_utils_1.isErrnoException(error) && error.code !== 'ENOENT') {
|
140443
|
+
if ((0, error_utils_1.isErrnoException)(error) && error.code !== 'ENOENT') {
|
140535
140444
|
console.error(`Error while parsing "${pathToTsConfig}"`);
|
140536
140445
|
throw error;
|
140537
140446
|
}
|
140538
140447
|
}
|
140539
140448
|
}
|
140449
|
+
// if we're using ESM, we need to tell TypeScript to use `nodenext` to
|
140450
|
+
// preserve the `import` semantics
|
140451
|
+
if (isEsm) {
|
140452
|
+
if (!tsConfig.compilerOptions) {
|
140453
|
+
tsConfig.compilerOptions = {};
|
140454
|
+
}
|
140455
|
+
if (tsConfig.compilerOptions.module === undefined) {
|
140456
|
+
tsConfig.compilerOptions.module = 'nodenext';
|
140457
|
+
}
|
140458
|
+
if (tsConfig.compilerOptions.moduleResolution === undefined) {
|
140459
|
+
tsConfig.compilerOptions.moduleResolution = 'nodenext';
|
140460
|
+
}
|
140461
|
+
}
|
140540
140462
|
const nodeVersionMajor = Number(process.versions.node.split('.')[0]);
|
140541
|
-
typescript_1.fixConfig(tsConfig, nodeVersionMajor);
|
140463
|
+
(0, typescript_1.fixConfig)(tsConfig, nodeVersionMajor);
|
140542
140464
|
// In prod, `.ts` inputs use TypeScript and
|
140543
140465
|
// `.js` inputs use Babel to convert ESM to CJS.
|
140544
140466
|
// In dev, both `.ts` and `.js` inputs use ts-node
|
@@ -140548,7 +140470,7 @@ const startDevServer = async (opts) => {
|
|
140548
140470
|
// In dev, we don't emit because we use ts-node.
|
140549
140471
|
tsConfig.compilerOptions.noEmit = true;
|
140550
140472
|
}
|
140551
|
-
const child = fork_dev_server_1.forkDevServer({
|
140473
|
+
const child = (0, fork_dev_server_1.forkDevServer)({
|
140552
140474
|
workPath,
|
140553
140475
|
config,
|
140554
140476
|
entrypoint,
|
@@ -140560,7 +140482,7 @@ const startDevServer = async (opts) => {
|
|
140560
140482
|
tsConfig,
|
140561
140483
|
});
|
140562
140484
|
const { pid } = child;
|
140563
|
-
const message = await fork_dev_server_1.readMessage(child);
|
140485
|
+
const message = await (0, fork_dev_server_1.readMessage)(child);
|
140564
140486
|
if (message.state === 'message') {
|
140565
140487
|
// "message" event
|
140566
140488
|
if (isTypeScript) {
|
@@ -140581,22 +140503,22 @@ const startDevServer = async (opts) => {
|
|
140581
140503
|
};
|
140582
140504
|
exports.startDevServer = startDevServer;
|
140583
140505
|
async function doTypeCheck({ entrypoint, workPath, meta = {} }, projectTsConfig) {
|
140584
|
-
const { devCacheDir = path_1.join(workPath, '.vercel', 'cache') } = meta;
|
140585
|
-
const entrypointCacheDir = path_1.join(devCacheDir, 'node', entrypoint);
|
140506
|
+
const { devCacheDir = (0, path_1.join)(workPath, '.vercel', 'cache') } = meta;
|
140507
|
+
const entrypointCacheDir = (0, path_1.join)(devCacheDir, 'node', entrypoint);
|
140586
140508
|
// In order to type-check a single file, a standalone tsconfig
|
140587
140509
|
// file needs to be created that inherits from the base one :(
|
140588
140510
|
// See: https://stackoverflow.com/a/44748041/376773
|
140589
140511
|
//
|
140590
140512
|
// A different filename needs to be used for different `extends` tsconfig.json
|
140591
140513
|
const tsconfigName = projectTsConfig
|
140592
|
-
? `tsconfig-with-${path_1.relative(workPath, projectTsConfig).replace(/[\\/.]/g, '-')}.json`
|
140514
|
+
? `tsconfig-with-${(0, path_1.relative)(workPath, projectTsConfig).replace(/[\\/.]/g, '-')}.json`
|
140593
140515
|
: 'tsconfig.json';
|
140594
|
-
const tsconfigPath = path_1.join(entrypointCacheDir, tsconfigName);
|
140516
|
+
const tsconfigPath = (0, path_1.join)(entrypointCacheDir, tsconfigName);
|
140595
140517
|
const tsconfig = {
|
140596
140518
|
extends: projectTsConfig
|
140597
|
-
? path_1.relative(entrypointCacheDir, projectTsConfig)
|
140519
|
+
? (0, path_1.relative)(entrypointCacheDir, projectTsConfig)
|
140598
140520
|
: undefined,
|
140599
|
-
include: [path_1.relative(entrypointCacheDir, path_1.join(workPath, entrypoint))],
|
140521
|
+
include: [(0, path_1.relative)(entrypointCacheDir, (0, path_1.join)(workPath, entrypoint))],
|
140600
140522
|
};
|
140601
140523
|
try {
|
140602
140524
|
const json = JSON.stringify(tsconfig, null, '\t');
|
@@ -140604,10 +140526,10 @@ async function doTypeCheck({ entrypoint, workPath, meta = {} }, projectTsConfig)
|
|
140604
140526
|
await fs_1.promises.writeFile(tsconfigPath, json, { flag: 'wx' });
|
140605
140527
|
}
|
140606
140528
|
catch (error) {
|
140607
|
-
if (error_utils_1.isErrnoException(error) && error.code !== 'EEXIST')
|
140529
|
+
if ((0, error_utils_1.isErrnoException)(error) && error.code !== 'EEXIST')
|
140608
140530
|
throw error;
|
140609
140531
|
}
|
140610
|
-
const child = child_process_1.spawn(process.execPath, [
|
140532
|
+
const child = (0, child_process_1.spawn)(process.execPath, [
|
140611
140533
|
tscPath,
|
140612
140534
|
'--project',
|
140613
140535
|
tsconfigPath,
|
@@ -140869,7 +140791,7 @@ function register(opts = {}) {
|
|
140869
140791
|
const diagnosticList = filterDiagnostics(diagnostics, ignoreDiagnostics);
|
140870
140792
|
reportTSError(diagnosticList, config.options.noEmitOnError);
|
140871
140793
|
if (output.emitSkipped) {
|
140872
|
-
throw new TypeError(`${path_1.relative(cwd, fileName)}: Emit skipped`);
|
140794
|
+
throw new TypeError(`${(0, path_1.relative)(cwd, fileName)}: Emit skipped`);
|
140873
140795
|
}
|
140874
140796
|
// Throw an error when requiring `.d.ts` files.
|
140875
140797
|
if (output.outputFiles.length === 0) {
|
@@ -140877,7 +140799,7 @@ function register(opts = {}) {
|
|
140877
140799
|
'This is usually the result of a faulty configuration or import. ' +
|
140878
140800
|
'Make sure there is a `.js`, `.json` or another executable extension and ' +
|
140879
140801
|
'loader (attached before `ts-node`) available alongside ' +
|
140880
|
-
`\`${path_1.basename(fileName)}\`.`);
|
140802
|
+
`\`${(0, path_1.basename)(fileName)}\`.`);
|
140881
140803
|
}
|
140882
140804
|
const file = {
|
140883
140805
|
code: output.outputFiles[1].text,
|
@@ -140905,7 +140827,7 @@ function register(opts = {}) {
|
|
140905
140827
|
*/
|
140906
140828
|
function readConfig(configFileName) {
|
140907
140829
|
let config = { compilerOptions: {} };
|
140908
|
-
const basePath = normalizeSlashes(path_1.dirname(configFileName));
|
140830
|
+
const basePath = normalizeSlashes((0, path_1.dirname)(configFileName));
|
140909
140831
|
// Read project configuration when available.
|
140910
140832
|
if (configFileName) {
|
140911
140833
|
const result = ts.readConfigFile(configFileName, readFile);
|
@@ -140947,7 +140869,7 @@ function register(opts = {}) {
|
|
140947
140869
|
const output = {
|
140948
140870
|
code: value,
|
140949
140871
|
map: Object.assign(JSON.parse(sourceMap), {
|
140950
|
-
file: path_1.basename(fileName),
|
140872
|
+
file: (0, path_1.basename)(fileName),
|
140951
140873
|
sources: [fileName],
|
140952
140874
|
}),
|
140953
140875
|
};
|
@@ -141038,9 +140960,9 @@ function getRegExpFromMatcher(matcher, index, allMatchers) {
|
|
141038
140960
|
if (!matcher.startsWith('/')) {
|
141039
140961
|
throw new Error(`Middleware's \`config.matcher\` values must start with "/". Received: ${matcher}`);
|
141040
140962
|
}
|
141041
|
-
const regExps = [path_to_regexp_1.pathToRegexp(matcher).source];
|
140963
|
+
const regExps = [(0, path_to_regexp_1.pathToRegexp)(matcher).source];
|
141042
140964
|
if (matcher === '/' && !allMatchers.includes('/index')) {
|
141043
|
-
regExps.push(path_to_regexp_1.pathToRegexp('/index').source);
|
140965
|
+
regExps.push((0, path_to_regexp_1.pathToRegexp)('/index').source);
|
141044
140966
|
}
|
141045
140967
|
return regExps;
|
141046
140968
|
}
|
@@ -141055,7 +140977,7 @@ function getRegExpFromMatcher(matcher, index, allMatchers) {
|
|
141055
140977
|
*/
|
141056
140978
|
function entrypointToOutputPath(entrypoint, zeroConfig) {
|
141057
140979
|
if (zeroConfig) {
|
141058
|
-
const ext = path_1.extname(entrypoint);
|
140980
|
+
const ext = (0, path_1.extname)(entrypoint);
|
141059
140981
|
return entrypoint.slice(0, entrypoint.length - ext.length);
|
141060
140982
|
}
|
141061
140983
|
return entrypoint;
|
@@ -141068,7 +140990,7 @@ function logError(error) {
|
|
141068
140990
|
// because it points to internals, not user code
|
141069
140991
|
const errorPrefixLength = 'Error: '.length;
|
141070
140992
|
const errorMessageLength = errorPrefixLength + error.message.length;
|
141071
|
-
build_utils_1.debug(error.stack.substring(errorMessageLength + 1));
|
140993
|
+
(0, build_utils_1.debug)(error.stack.substring(errorMessageLength + 1));
|
141072
140994
|
}
|
141073
140995
|
}
|
141074
140996
|
exports.logError = logError;
|
@@ -141084,7 +141006,7 @@ function isEdgeRuntime(runtime) {
|
|
141084
141006
|
exports.isEdgeRuntime = isEdgeRuntime;
|
141085
141007
|
async function serializeBody(request) {
|
141086
141008
|
return request.method !== 'GET' && request.method !== 'HEAD'
|
141087
|
-
? await build_utils_1.streamToBuffer(request)
|
141009
|
+
? await (0, build_utils_1.streamToBuffer)(request)
|
141088
141010
|
: undefined;
|
141089
141011
|
}
|
141090
141012
|
exports.serializeBody = serializeBody;
|