@vercel/remix-builder 5.1.2 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +57 -59
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3634,6 +3634,27 @@ function determineFrameworkSettings(workPath) {
|
|
|
3634
3634
|
}
|
|
3635
3635
|
return REMIX_FRAMEWORK_SETTINGS;
|
|
3636
3636
|
}
|
|
3637
|
+
async function determineHandler({
|
|
3638
|
+
rootDir,
|
|
3639
|
+
serverBuildPath,
|
|
3640
|
+
serverEntryPoint,
|
|
3641
|
+
serverSourcePromise,
|
|
3642
|
+
sourceSearchValue
|
|
3643
|
+
}) {
|
|
3644
|
+
let handler = (0, import_path2.relative)(rootDir, serverBuildPath);
|
|
3645
|
+
let handlerPath = (0, import_path2.join)(rootDir, handler);
|
|
3646
|
+
if (!serverEntryPoint) {
|
|
3647
|
+
const baseServerBuildPath = (0, import_path2.basename)(serverBuildPath, ".js");
|
|
3648
|
+
handler = (0, import_path2.join)((0, import_path2.dirname)(handler), `server-${baseServerBuildPath}.mjs`);
|
|
3649
|
+
handlerPath = (0, import_path2.join)(rootDir, handler);
|
|
3650
|
+
const serverSource = await serverSourcePromise;
|
|
3651
|
+
await import_fs2.promises.writeFile(
|
|
3652
|
+
handlerPath,
|
|
3653
|
+
serverSource.replace(sourceSearchValue, `./${baseServerBuildPath}.js`)
|
|
3654
|
+
);
|
|
3655
|
+
}
|
|
3656
|
+
return { handler, handlerPath };
|
|
3657
|
+
}
|
|
3637
3658
|
var build = async ({
|
|
3638
3659
|
entrypoint,
|
|
3639
3660
|
workPath,
|
|
@@ -3869,22 +3890,13 @@ var COMMON_NODE_FUNCTION_OPTIONS = {
|
|
|
3869
3890
|
var COMMON_EDGE_FUNCTION_OPTIONS = { deploymentTarget: "v8-worker" };
|
|
3870
3891
|
async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootDir, serverBuildPath, serverEntryPoint, frameworkVersion, config) {
|
|
3871
3892
|
const isEdgeFunction = config.runtime === "edge";
|
|
3872
|
-
const
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
const reactRouterServerSrc = await reactRouterServerSrcPromise;
|
|
3880
|
-
await import_fs2.promises.writeFile(
|
|
3881
|
-
handlerPath,
|
|
3882
|
-
reactRouterServerSrc.replace(
|
|
3883
|
-
REACT_ROUTER_FRAMEWORK_SETTINGS.sourceSearchValue,
|
|
3884
|
-
`./${baseServerBuildPath}.js`
|
|
3885
|
-
)
|
|
3886
|
-
);
|
|
3887
|
-
}
|
|
3893
|
+
const { handler, handlerPath } = await determineHandler({
|
|
3894
|
+
rootDir,
|
|
3895
|
+
serverBuildPath,
|
|
3896
|
+
serverEntryPoint,
|
|
3897
|
+
serverSourcePromise: reactRouterServerSrcPromise,
|
|
3898
|
+
sourceSearchValue: REACT_ROUTER_FRAMEWORK_SETTINGS.sourceSearchValue
|
|
3899
|
+
});
|
|
3888
3900
|
let conditions;
|
|
3889
3901
|
let readFile;
|
|
3890
3902
|
if (isEdgeFunction) {
|
|
@@ -3898,9 +3910,7 @@ async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootD
|
|
|
3898
3910
|
readFile
|
|
3899
3911
|
});
|
|
3900
3912
|
logNftWarnings(trace.warnings, "react-router");
|
|
3901
|
-
|
|
3902
|
-
files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
|
|
3903
|
-
}
|
|
3913
|
+
const files = await getFilesFromTrace({ fileList: trace.fileList, rootDir });
|
|
3904
3914
|
let fn;
|
|
3905
3915
|
if (isEdgeFunction) {
|
|
3906
3916
|
fn = new import_build_utils3.EdgeFunction({
|
|
@@ -3932,30 +3942,19 @@ async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootD
|
|
|
3932
3942
|
return fn;
|
|
3933
3943
|
}
|
|
3934
3944
|
async function createRenderNodeFunction(nodeVersion, entrypointDir, rootDir, serverBuildPath, serverEntryPoint, frameworkVersion, config) {
|
|
3935
|
-
const
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
const nodeServerSrc = await nodeServerSrcPromise;
|
|
3943
|
-
await import_fs2.promises.writeFile(
|
|
3944
|
-
handlerPath,
|
|
3945
|
-
nodeServerSrc.replace(
|
|
3946
|
-
REMIX_FRAMEWORK_SETTINGS.sourceSearchValue,
|
|
3947
|
-
`./${baseServerBuildPath}.js`
|
|
3948
|
-
)
|
|
3949
|
-
);
|
|
3950
|
-
}
|
|
3945
|
+
const { handler, handlerPath } = await determineHandler({
|
|
3946
|
+
rootDir,
|
|
3947
|
+
serverBuildPath,
|
|
3948
|
+
serverEntryPoint,
|
|
3949
|
+
serverSourcePromise: nodeServerSrcPromise,
|
|
3950
|
+
sourceSearchValue: REMIX_FRAMEWORK_SETTINGS.sourceSearchValue
|
|
3951
|
+
});
|
|
3951
3952
|
const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
|
|
3952
3953
|
base: rootDir,
|
|
3953
3954
|
processCwd: entrypointDir
|
|
3954
3955
|
});
|
|
3955
3956
|
logNftWarnings(trace.warnings, "@remix-run/node");
|
|
3956
|
-
|
|
3957
|
-
files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
|
|
3958
|
-
}
|
|
3957
|
+
const files = await getFilesFromTrace({ fileList: trace.fileList, rootDir });
|
|
3959
3958
|
const fn = new import_build_utils3.NodejsLambda({
|
|
3960
3959
|
...COMMON_NODE_FUNCTION_OPTIONS,
|
|
3961
3960
|
files,
|
|
@@ -3972,22 +3971,13 @@ async function createRenderNodeFunction(nodeVersion, entrypointDir, rootDir, ser
|
|
|
3972
3971
|
return fn;
|
|
3973
3972
|
}
|
|
3974
3973
|
async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath, serverEntryPoint, frameworkVersion, config) {
|
|
3975
|
-
const
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
const edgeServerSrc = await edgeServerSrcPromise;
|
|
3983
|
-
await import_fs2.promises.writeFile(
|
|
3984
|
-
handlerPath,
|
|
3985
|
-
edgeServerSrc.replace(
|
|
3986
|
-
REMIX_FRAMEWORK_SETTINGS.sourceSearchValue,
|
|
3987
|
-
`./${baseServerBuildPath}.js`
|
|
3988
|
-
)
|
|
3989
|
-
);
|
|
3990
|
-
}
|
|
3974
|
+
const { handler, handlerPath } = await determineHandler({
|
|
3975
|
+
rootDir,
|
|
3976
|
+
serverBuildPath,
|
|
3977
|
+
serverEntryPoint,
|
|
3978
|
+
serverSourcePromise: edgeServerSrcPromise,
|
|
3979
|
+
sourceSearchValue: REMIX_FRAMEWORK_SETTINGS.sourceSearchValue
|
|
3980
|
+
});
|
|
3991
3981
|
const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
|
|
3992
3982
|
base: rootDir,
|
|
3993
3983
|
processCwd: entrypointDir,
|
|
@@ -3995,9 +3985,7 @@ async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath,
|
|
|
3995
3985
|
readFile: edgeReadFile
|
|
3996
3986
|
});
|
|
3997
3987
|
logNftWarnings(trace.warnings, "@remix-run/server-runtime");
|
|
3998
|
-
|
|
3999
|
-
files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
|
|
4000
|
-
}
|
|
3988
|
+
const files = await getFilesFromTrace({ fileList: trace.fileList, rootDir });
|
|
4001
3989
|
const fn = new import_build_utils3.EdgeFunction({
|
|
4002
3990
|
...COMMON_EDGE_FUNCTION_OPTIONS,
|
|
4003
3991
|
files,
|
|
@@ -4010,6 +3998,16 @@ async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath,
|
|
|
4010
3998
|
});
|
|
4011
3999
|
return fn;
|
|
4012
4000
|
}
|
|
4001
|
+
async function getFilesFromTrace({
|
|
4002
|
+
fileList,
|
|
4003
|
+
rootDir
|
|
4004
|
+
}) {
|
|
4005
|
+
const files = {};
|
|
4006
|
+
for (const file of fileList) {
|
|
4007
|
+
files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
|
|
4008
|
+
}
|
|
4009
|
+
return files;
|
|
4010
|
+
}
|
|
4013
4011
|
|
|
4014
4012
|
// src/build-legacy.ts
|
|
4015
4013
|
var import_ts_morph2 = require("ts-morph");
|
|
@@ -4713,8 +4711,8 @@ var prepareCache = async ({
|
|
|
4713
4711
|
root
|
|
4714
4712
|
);
|
|
4715
4713
|
}
|
|
4716
|
-
const
|
|
4717
|
-
return { ...
|
|
4714
|
+
const defaultCacheFiles = await (0, import_build_utils5.glob)(import_build_utils5.defaultCachePathGlob, root);
|
|
4715
|
+
return { ...defaultCacheFiles, ...cacheDirFiles };
|
|
4718
4716
|
};
|
|
4719
4717
|
|
|
4720
4718
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/remix-builder",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
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",
|