@vercel/remix-builder 5.1.1 → 5.2.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/index.js +59 -73
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3564,6 +3564,8 @@ var REMIX_FRAMEWORK_SETTINGS = {
|
|
|
3564
3564
|
primaryPackageName: "@remix-run/dev",
|
|
3565
3565
|
buildCommand: "remix build",
|
|
3566
3566
|
buildResultFilePath: ".vercel/remix-build-result.json",
|
|
3567
|
+
slug: "remix",
|
|
3568
|
+
sourceSearchValue: "@remix-run/dev/server-build",
|
|
3567
3569
|
createRenderFunction({
|
|
3568
3570
|
nodeVersion,
|
|
3569
3571
|
entrypointDir,
|
|
@@ -3598,6 +3600,8 @@ var REACT_ROUTER_FRAMEWORK_SETTINGS = {
|
|
|
3598
3600
|
primaryPackageName: "react-router",
|
|
3599
3601
|
buildCommand: "react-router build",
|
|
3600
3602
|
buildResultFilePath: ".vercel/react-router-build-result.json",
|
|
3603
|
+
slug: "react-router",
|
|
3604
|
+
sourceSearchValue: "ENTRYPOINT_PLACEHOLDER",
|
|
3601
3605
|
createRenderFunction({
|
|
3602
3606
|
nodeVersion,
|
|
3603
3607
|
entrypointDir,
|
|
@@ -3826,6 +3830,43 @@ var build = async ({
|
|
|
3826
3830
|
});
|
|
3827
3831
|
return { routes, output, framework: { version: frameworkVersion } };
|
|
3828
3832
|
};
|
|
3833
|
+
async function edgeReadFile(fsPath) {
|
|
3834
|
+
let source;
|
|
3835
|
+
try {
|
|
3836
|
+
source = await import_fs2.promises.readFile(fsPath);
|
|
3837
|
+
} catch (err) {
|
|
3838
|
+
if (err.code === "ENOENT" || err.code === "EISDIR") {
|
|
3839
|
+
return null;
|
|
3840
|
+
}
|
|
3841
|
+
throw err;
|
|
3842
|
+
}
|
|
3843
|
+
if ((0, import_path2.basename)(fsPath) === "package.json") {
|
|
3844
|
+
const pkgJson = JSON.parse(source.toString());
|
|
3845
|
+
for (const prop of ["browser", "module"]) {
|
|
3846
|
+
const val = pkgJson[prop];
|
|
3847
|
+
if (typeof val === "string") {
|
|
3848
|
+
pkgJson.main = val;
|
|
3849
|
+
source = JSON.stringify(pkgJson);
|
|
3850
|
+
break;
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
return source;
|
|
3855
|
+
}
|
|
3856
|
+
var EDGE_TRACE_CONDITIONS = [
|
|
3857
|
+
"edge-light",
|
|
3858
|
+
"browser",
|
|
3859
|
+
"module",
|
|
3860
|
+
"import",
|
|
3861
|
+
"require"
|
|
3862
|
+
];
|
|
3863
|
+
var COMMON_NODE_FUNCTION_OPTIONS = {
|
|
3864
|
+
shouldAddHelpers: false,
|
|
3865
|
+
shouldAddSourcemapSupport: false,
|
|
3866
|
+
operationType: "SSR",
|
|
3867
|
+
supportsResponseStreaming: true
|
|
3868
|
+
};
|
|
3869
|
+
var COMMON_EDGE_FUNCTION_OPTIONS = { deploymentTarget: "v8-worker" };
|
|
3829
3870
|
async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootDir, serverBuildPath, serverEntryPoint, frameworkVersion, config) {
|
|
3830
3871
|
const isEdgeFunction = config.runtime === "edge";
|
|
3831
3872
|
const files = {};
|
|
@@ -3839,7 +3880,7 @@ async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootD
|
|
|
3839
3880
|
await import_fs2.promises.writeFile(
|
|
3840
3881
|
handlerPath,
|
|
3841
3882
|
reactRouterServerSrc.replace(
|
|
3842
|
-
|
|
3883
|
+
REACT_ROUTER_FRAMEWORK_SETTINGS.sourceSearchValue,
|
|
3843
3884
|
`./${baseServerBuildPath}.js`
|
|
3844
3885
|
)
|
|
3845
3886
|
);
|
|
@@ -3847,30 +3888,8 @@ async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootD
|
|
|
3847
3888
|
let conditions;
|
|
3848
3889
|
let readFile;
|
|
3849
3890
|
if (isEdgeFunction) {
|
|
3850
|
-
conditions =
|
|
3851
|
-
readFile =
|
|
3852
|
-
let source;
|
|
3853
|
-
try {
|
|
3854
|
-
source = await import_fs2.promises.readFile(fsPath);
|
|
3855
|
-
} catch (err) {
|
|
3856
|
-
if (err.code === "ENOENT" || err.code === "EISDIR") {
|
|
3857
|
-
return null;
|
|
3858
|
-
}
|
|
3859
|
-
throw err;
|
|
3860
|
-
}
|
|
3861
|
-
if ((0, import_path2.basename)(fsPath) === "package.json") {
|
|
3862
|
-
const pkgJson = JSON.parse(source.toString());
|
|
3863
|
-
for (const prop of ["browser", "module"]) {
|
|
3864
|
-
const val = pkgJson[prop];
|
|
3865
|
-
if (typeof val === "string") {
|
|
3866
|
-
pkgJson.main = val;
|
|
3867
|
-
source = JSON.stringify(pkgJson);
|
|
3868
|
-
break;
|
|
3869
|
-
}
|
|
3870
|
-
}
|
|
3871
|
-
}
|
|
3872
|
-
return source;
|
|
3873
|
-
};
|
|
3891
|
+
conditions = EDGE_TRACE_CONDITIONS;
|
|
3892
|
+
readFile = edgeReadFile;
|
|
3874
3893
|
}
|
|
3875
3894
|
const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
|
|
3876
3895
|
base: rootDir,
|
|
@@ -3885,30 +3904,27 @@ async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootD
|
|
|
3885
3904
|
let fn;
|
|
3886
3905
|
if (isEdgeFunction) {
|
|
3887
3906
|
fn = new import_build_utils3.EdgeFunction({
|
|
3907
|
+
...COMMON_EDGE_FUNCTION_OPTIONS,
|
|
3888
3908
|
files,
|
|
3889
|
-
deploymentTarget: "v8-worker",
|
|
3890
3909
|
entrypoint: handler,
|
|
3891
3910
|
regions: config.regions,
|
|
3892
3911
|
framework: {
|
|
3893
|
-
slug:
|
|
3912
|
+
slug: REACT_ROUTER_FRAMEWORK_SETTINGS.slug,
|
|
3894
3913
|
version: frameworkVersion
|
|
3895
3914
|
}
|
|
3896
3915
|
});
|
|
3897
3916
|
} else {
|
|
3898
3917
|
fn = new import_build_utils3.NodejsLambda({
|
|
3918
|
+
...COMMON_NODE_FUNCTION_OPTIONS,
|
|
3899
3919
|
files,
|
|
3900
3920
|
handler,
|
|
3901
3921
|
runtime: nodeVersion.runtime,
|
|
3902
|
-
shouldAddHelpers: false,
|
|
3903
|
-
shouldAddSourcemapSupport: false,
|
|
3904
|
-
operationType: "SSR",
|
|
3905
|
-
supportsResponseStreaming: true,
|
|
3906
3922
|
useWebApi: true,
|
|
3907
3923
|
regions: config.regions,
|
|
3908
3924
|
memory: config.memory,
|
|
3909
3925
|
maxDuration: config.maxDuration,
|
|
3910
3926
|
framework: {
|
|
3911
|
-
slug:
|
|
3927
|
+
slug: REACT_ROUTER_FRAMEWORK_SETTINGS.slug,
|
|
3912
3928
|
version: frameworkVersion
|
|
3913
3929
|
}
|
|
3914
3930
|
});
|
|
@@ -3927,7 +3943,7 @@ async function createRenderNodeFunction(nodeVersion, entrypointDir, rootDir, ser
|
|
|
3927
3943
|
await import_fs2.promises.writeFile(
|
|
3928
3944
|
handlerPath,
|
|
3929
3945
|
nodeServerSrc.replace(
|
|
3930
|
-
|
|
3946
|
+
REMIX_FRAMEWORK_SETTINGS.sourceSearchValue,
|
|
3931
3947
|
`./${baseServerBuildPath}.js`
|
|
3932
3948
|
)
|
|
3933
3949
|
);
|
|
@@ -3941,18 +3957,15 @@ async function createRenderNodeFunction(nodeVersion, entrypointDir, rootDir, ser
|
|
|
3941
3957
|
files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
|
|
3942
3958
|
}
|
|
3943
3959
|
const fn = new import_build_utils3.NodejsLambda({
|
|
3960
|
+
...COMMON_NODE_FUNCTION_OPTIONS,
|
|
3944
3961
|
files,
|
|
3945
3962
|
handler,
|
|
3946
3963
|
runtime: nodeVersion.runtime,
|
|
3947
|
-
shouldAddHelpers: false,
|
|
3948
|
-
shouldAddSourcemapSupport: false,
|
|
3949
|
-
operationType: "SSR",
|
|
3950
|
-
supportsResponseStreaming: true,
|
|
3951
3964
|
regions: config.regions,
|
|
3952
3965
|
memory: config.memory,
|
|
3953
3966
|
maxDuration: config.maxDuration,
|
|
3954
3967
|
framework: {
|
|
3955
|
-
slug:
|
|
3968
|
+
slug: REMIX_FRAMEWORK_SETTINGS.slug,
|
|
3956
3969
|
version: frameworkVersion
|
|
3957
3970
|
}
|
|
3958
3971
|
});
|
|
@@ -3970,55 +3983,28 @@ async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath,
|
|
|
3970
3983
|
await import_fs2.promises.writeFile(
|
|
3971
3984
|
handlerPath,
|
|
3972
3985
|
edgeServerSrc.replace(
|
|
3973
|
-
|
|
3986
|
+
REMIX_FRAMEWORK_SETTINGS.sourceSearchValue,
|
|
3974
3987
|
`./${baseServerBuildPath}.js`
|
|
3975
3988
|
)
|
|
3976
3989
|
);
|
|
3977
3990
|
}
|
|
3978
|
-
let remixRunVercelPkgJson;
|
|
3979
3991
|
const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
|
|
3980
3992
|
base: rootDir,
|
|
3981
3993
|
processCwd: entrypointDir,
|
|
3982
|
-
conditions:
|
|
3983
|
-
|
|
3984
|
-
let source;
|
|
3985
|
-
try {
|
|
3986
|
-
source = await import_fs2.promises.readFile(fsPath);
|
|
3987
|
-
} catch (err) {
|
|
3988
|
-
if (err.code === "ENOENT" || err.code === "EISDIR") {
|
|
3989
|
-
return null;
|
|
3990
|
-
}
|
|
3991
|
-
throw err;
|
|
3992
|
-
}
|
|
3993
|
-
if ((0, import_path2.basename)(fsPath) === "package.json") {
|
|
3994
|
-
const pkgJson = JSON.parse(source.toString());
|
|
3995
|
-
for (const prop of ["browser", "module"]) {
|
|
3996
|
-
const val = pkgJson[prop];
|
|
3997
|
-
if (typeof val === "string") {
|
|
3998
|
-
pkgJson.main = val;
|
|
3999
|
-
source = JSON.stringify(pkgJson);
|
|
4000
|
-
break;
|
|
4001
|
-
}
|
|
4002
|
-
}
|
|
4003
|
-
}
|
|
4004
|
-
return source;
|
|
4005
|
-
}
|
|
3994
|
+
conditions: EDGE_TRACE_CONDITIONS,
|
|
3995
|
+
readFile: edgeReadFile
|
|
4006
3996
|
});
|
|
4007
3997
|
logNftWarnings(trace.warnings, "@remix-run/server-runtime");
|
|
4008
3998
|
for (const file of trace.fileList) {
|
|
4009
|
-
|
|
4010
|
-
files[file] = new import_build_utils3.FileBlob({ data: remixRunVercelPkgJson });
|
|
4011
|
-
} else {
|
|
4012
|
-
files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
|
|
4013
|
-
}
|
|
3999
|
+
files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
|
|
4014
4000
|
}
|
|
4015
4001
|
const fn = new import_build_utils3.EdgeFunction({
|
|
4002
|
+
...COMMON_EDGE_FUNCTION_OPTIONS,
|
|
4016
4003
|
files,
|
|
4017
|
-
deploymentTarget: "v8-worker",
|
|
4018
4004
|
entrypoint: handler,
|
|
4019
4005
|
regions: config.regions,
|
|
4020
4006
|
framework: {
|
|
4021
|
-
slug:
|
|
4007
|
+
slug: REMIX_FRAMEWORK_SETTINGS.slug,
|
|
4022
4008
|
version: frameworkVersion
|
|
4023
4009
|
}
|
|
4024
4010
|
});
|
|
@@ -4727,8 +4713,8 @@ var prepareCache = async ({
|
|
|
4727
4713
|
root
|
|
4728
4714
|
);
|
|
4729
4715
|
}
|
|
4730
|
-
const
|
|
4731
|
-
return { ...
|
|
4716
|
+
const defaultCacheFiles = await (0, import_build_utils5.glob)(import_build_utils5.defaultCachePathGlob, root);
|
|
4717
|
+
return { ...defaultCacheFiles, ...cacheDirFiles };
|
|
4732
4718
|
};
|
|
4733
4719
|
|
|
4734
4720
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/remix-builder",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/jest": "27.5.1",
|
|
25
25
|
"@types/node": "14.18.33",
|
|
26
26
|
"@types/semver": "7.3.13",
|
|
27
|
-
"@vercel/build-utils": "9.
|
|
27
|
+
"@vercel/build-utils": "9.2.0",
|
|
28
28
|
"glob": "10.3.16",
|
|
29
29
|
"jest-junit": "16.0.0",
|
|
30
30
|
"path-to-regexp": "6.2.1",
|