@vercel/static-build 2.8.29 → 2.8.30
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 +44 -29
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -19753,6 +19753,7 @@ var require_utils4 = __commonJS({
|
|
|
19753
19753
|
__export2(utils_exports, {
|
|
19754
19754
|
getBuilderForRuntime: () => getBuilderForRuntime,
|
|
19755
19755
|
inferServiceRuntime: () => inferServiceRuntime,
|
|
19756
|
+
isStaticBuild: () => isStaticBuild2,
|
|
19756
19757
|
readVercelConfig: () => readVercelConfig
|
|
19757
19758
|
});
|
|
19758
19759
|
module2.exports = __toCommonJS2(utils_exports);
|
|
@@ -19765,6 +19766,9 @@ var require_utils4 = __commonJS({
|
|
|
19765
19766
|
}
|
|
19766
19767
|
return builder;
|
|
19767
19768
|
}
|
|
19769
|
+
function isStaticBuild2(service) {
|
|
19770
|
+
return import_types.STATIC_BUILDERS.has(service.builder.use);
|
|
19771
|
+
}
|
|
19768
19772
|
function inferServiceRuntime(config) {
|
|
19769
19773
|
if (config.runtime && config.runtime in import_types.RUNTIME_BUILDERS) {
|
|
19770
19774
|
return config.runtime;
|
|
@@ -19949,7 +19953,7 @@ var require_resolve = __commonJS({
|
|
|
19949
19953
|
builderUse = (0, import_utils.getBuilderForRuntime)(inferredRuntime);
|
|
19950
19954
|
builderSrc = config.entrypoint;
|
|
19951
19955
|
}
|
|
19952
|
-
const routePrefix = type === "web" ? config.routePrefix : void 0;
|
|
19956
|
+
const routePrefix = type === "web" && config.routePrefix ? config.routePrefix.startsWith("/") ? config.routePrefix : `/${config.routePrefix}` : void 0;
|
|
19953
19957
|
const isRoot = workspace === ".";
|
|
19954
19958
|
if (!isRoot && !builderSrc.startsWith(workspace + "/")) {
|
|
19955
19959
|
builderSrc = import_path7.posix.join(workspace, builderSrc);
|
|
@@ -19963,8 +19967,15 @@ var require_resolve = __commonJS({
|
|
|
19963
19967
|
builderConfig.includeFiles = config.includeFiles;
|
|
19964
19968
|
if (config.excludeFiles)
|
|
19965
19969
|
builderConfig.excludeFiles = config.excludeFiles;
|
|
19966
|
-
const
|
|
19967
|
-
const runtime =
|
|
19970
|
+
const isStaticBuild2 = import_types.STATIC_BUILDERS.has(builderUse);
|
|
19971
|
+
const runtime = isStaticBuild2 ? void 0 : inferredRuntime;
|
|
19972
|
+
if (routePrefix) {
|
|
19973
|
+
const stripped = routePrefix.startsWith("/") ? routePrefix.slice(1) : routePrefix;
|
|
19974
|
+
builderConfig.routePrefix = stripped || ".";
|
|
19975
|
+
}
|
|
19976
|
+
if (config.framework) {
|
|
19977
|
+
builderConfig.framework = config.framework;
|
|
19978
|
+
}
|
|
19968
19979
|
return {
|
|
19969
19980
|
name,
|
|
19970
19981
|
type,
|
|
@@ -20074,33 +20085,34 @@ var require_detect_services = __commonJS({
|
|
|
20074
20085
|
const defaults = [];
|
|
20075
20086
|
const crons = [];
|
|
20076
20087
|
const workers = [];
|
|
20077
|
-
const
|
|
20088
|
+
const sortedWebServices = services.filter(
|
|
20078
20089
|
(s) => s.type === "web" && typeof s.routePrefix === "string"
|
|
20079
|
-
);
|
|
20080
|
-
const sortedWebServices = [...webServices].sort((a, b) => {
|
|
20081
|
-
if (a.routePrefix === "/")
|
|
20082
|
-
return 1;
|
|
20083
|
-
if (b.routePrefix === "/")
|
|
20084
|
-
return -1;
|
|
20085
|
-
return b.routePrefix.length - a.routePrefix.length;
|
|
20086
|
-
});
|
|
20090
|
+
).sort((a, b) => b.routePrefix.length - a.routePrefix.length);
|
|
20087
20091
|
for (const service of sortedWebServices) {
|
|
20088
|
-
const { routePrefix
|
|
20089
|
-
const
|
|
20090
|
-
|
|
20091
|
-
|
|
20092
|
-
|
|
20093
|
-
src: "
|
|
20094
|
-
|
|
20095
|
-
|
|
20096
|
-
|
|
20092
|
+
const { routePrefix } = service;
|
|
20093
|
+
const normalizedPrefix = routePrefix.slice(1);
|
|
20094
|
+
if ((0, import_utils.isStaticBuild)(service)) {
|
|
20095
|
+
if (routePrefix === "/") {
|
|
20096
|
+
defaults.push({ handle: "filesystem" });
|
|
20097
|
+
defaults.push({ src: "/(.*)", dest: "/index.html" });
|
|
20098
|
+
} else {
|
|
20099
|
+
rewrites.push({
|
|
20100
|
+
src: `^/${normalizedPrefix}(?:/.*)?$`,
|
|
20101
|
+
dest: `/${normalizedPrefix}/index.html`
|
|
20102
|
+
});
|
|
20103
|
+
}
|
|
20097
20104
|
} else {
|
|
20098
|
-
const
|
|
20099
|
-
|
|
20100
|
-
|
|
20101
|
-
dest: functionPath,
|
|
20102
|
-
|
|
20103
|
-
|
|
20105
|
+
const builderSrc = service.builder.src || routePrefix;
|
|
20106
|
+
const functionPath = builderSrc.startsWith("/") ? builderSrc : `/${builderSrc}`;
|
|
20107
|
+
if (routePrefix === "/") {
|
|
20108
|
+
defaults.push({ src: "^/(.*)$", dest: functionPath, check: true });
|
|
20109
|
+
} else {
|
|
20110
|
+
rewrites.push({
|
|
20111
|
+
src: `^/${normalizedPrefix}(?:/.*)?$`,
|
|
20112
|
+
dest: functionPath,
|
|
20113
|
+
check: true
|
|
20114
|
+
});
|
|
20115
|
+
}
|
|
20104
20116
|
}
|
|
20105
20117
|
}
|
|
20106
20118
|
return { rewrites, defaults, crons, workers };
|
|
@@ -28931,6 +28943,7 @@ var require_dist4 = __commonJS({
|
|
|
28931
28943
|
getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
|
|
28932
28944
|
getWorkspaces: () => import_get_workspaces.getWorkspaces,
|
|
28933
28945
|
isOfficialRuntime: () => import_is_official_runtime.isOfficialRuntime,
|
|
28946
|
+
isStaticBuild: () => import_utils.isStaticBuild,
|
|
28934
28947
|
isStaticRuntime: () => import_is_official_runtime.isStaticRuntime,
|
|
28935
28948
|
monorepoManagers: () => import_monorepo_managers.monorepoManagers,
|
|
28936
28949
|
packageManagers: () => import_package_managers.packageManagers,
|
|
@@ -28939,6 +28952,7 @@ var require_dist4 = __commonJS({
|
|
|
28939
28952
|
module2.exports = __toCommonJS2(src_exports2);
|
|
28940
28953
|
var import_detect_builders = require_detect_builders();
|
|
28941
28954
|
var import_detect_services = require_detect_services();
|
|
28955
|
+
var import_utils = require_utils4();
|
|
28942
28956
|
var import_get_services_builders = require_get_services_builders();
|
|
28943
28957
|
var import_detect_file_system_api = require_detect_file_system_api();
|
|
28944
28958
|
var import_detect_framework = require_detect_framework();
|
|
@@ -30044,8 +30058,9 @@ var build = async ({
|
|
|
30044
30058
|
meta = {}
|
|
30045
30059
|
}) => {
|
|
30046
30060
|
await (0, import_build_utils4.download)(files, workPath, meta);
|
|
30047
|
-
const
|
|
30048
|
-
const
|
|
30061
|
+
const routePrefix = config.routePrefix;
|
|
30062
|
+
const mountpoint = routePrefix ? routePrefix.replace(/^\//, "") || "." : import_path6.default.dirname(entrypoint);
|
|
30063
|
+
const entrypointDir = import_path6.default.join(workPath, import_path6.default.dirname(entrypoint));
|
|
30049
30064
|
let distPath = import_path6.default.join(
|
|
30050
30065
|
workPath,
|
|
30051
30066
|
import_path6.default.dirname(entrypoint),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.30",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/build-step",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ts-morph": "12.0.0",
|
|
17
17
|
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
|
|
18
|
-
"@vercel/
|
|
19
|
-
"@vercel/
|
|
18
|
+
"@vercel/static-config": "3.1.2",
|
|
19
|
+
"@vercel/gatsby-plugin-vercel-builder": "2.0.128"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/aws-lambda": "8.10.64",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"semver": "7.5.2",
|
|
40
40
|
"tree-kill": "1.2.2",
|
|
41
41
|
"@vercel/build-utils": "13.2.17",
|
|
42
|
-
"@vercel/frameworks": "3.16.1",
|
|
43
42
|
"@vercel/error-utils": "2.0.3",
|
|
44
|
-
"@vercel/fs-detectors": "5.7.
|
|
43
|
+
"@vercel/fs-detectors": "5.7.22",
|
|
44
|
+
"@vercel/frameworks": "3.16.1",
|
|
45
45
|
"@vercel/routing-utils": "5.3.2"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|