@vercel/static-build 2.4.6 → 2.5.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 +210 -82
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2918,12 +2918,12 @@ var require_lib2 = __commonJS({
|
|
|
2918
2918
|
const dest = new URL$1(destination).hostname;
|
|
2919
2919
|
return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
|
|
2920
2920
|
};
|
|
2921
|
-
function
|
|
2922
|
-
if (!
|
|
2921
|
+
function fetch3(url, opts) {
|
|
2922
|
+
if (!fetch3.Promise) {
|
|
2923
2923
|
throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
|
|
2924
2924
|
}
|
|
2925
|
-
Body.Promise =
|
|
2926
|
-
return new
|
|
2925
|
+
Body.Promise = fetch3.Promise;
|
|
2926
|
+
return new fetch3.Promise(function(resolve, reject) {
|
|
2927
2927
|
const request = new Request(url, opts);
|
|
2928
2928
|
const options = getNodeRequestOptions(request);
|
|
2929
2929
|
const send = (options.protocol === "https:" ? https : http).request;
|
|
@@ -2973,7 +2973,7 @@ var require_lib2 = __commonJS({
|
|
|
2973
2973
|
req.on("response", function(res) {
|
|
2974
2974
|
clearTimeout(reqTimeout);
|
|
2975
2975
|
const headers = createHeadersLenient(res.headers);
|
|
2976
|
-
if (
|
|
2976
|
+
if (fetch3.isRedirect(res.statusCode)) {
|
|
2977
2977
|
const location = headers.get("Location");
|
|
2978
2978
|
let locationURL = null;
|
|
2979
2979
|
try {
|
|
@@ -3035,7 +3035,7 @@ var require_lib2 = __commonJS({
|
|
|
3035
3035
|
requestOpts.body = void 0;
|
|
3036
3036
|
requestOpts.headers.delete("content-length");
|
|
3037
3037
|
}
|
|
3038
|
-
resolve(
|
|
3038
|
+
resolve(fetch3(new Request(locationURL, requestOpts)));
|
|
3039
3039
|
finalize();
|
|
3040
3040
|
return;
|
|
3041
3041
|
}
|
|
@@ -3095,11 +3095,11 @@ var require_lib2 = __commonJS({
|
|
|
3095
3095
|
writeToStream(req, request);
|
|
3096
3096
|
});
|
|
3097
3097
|
}
|
|
3098
|
-
|
|
3098
|
+
fetch3.isRedirect = function(code) {
|
|
3099
3099
|
return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
|
|
3100
3100
|
};
|
|
3101
|
-
|
|
3102
|
-
module2.exports = exports2 =
|
|
3101
|
+
fetch3.Promise = global.Promise;
|
|
3102
|
+
module2.exports = exports2 = fetch3;
|
|
3103
3103
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3104
3104
|
exports2.default = exports2;
|
|
3105
3105
|
exports2.Headers = Headers;
|
|
@@ -8788,7 +8788,43 @@ var require_frameworks = __commonJS({
|
|
|
8788
8788
|
]
|
|
8789
8789
|
},
|
|
8790
8790
|
{
|
|
8791
|
-
name: "SolidStart",
|
|
8791
|
+
name: "SolidStart (v1)",
|
|
8792
|
+
slug: "solidstart-1",
|
|
8793
|
+
demo: "https://solid-start-template.vercel.app",
|
|
8794
|
+
logo: "https://api-frameworks.vercel.sh/framework-logos/solid.svg",
|
|
8795
|
+
tagline: "Simple and performant reactivity for building user interfaces.",
|
|
8796
|
+
description: "A Solid app, created with SolidStart.",
|
|
8797
|
+
website: "https://start.solidjs.com",
|
|
8798
|
+
envPrefix: "VITE_",
|
|
8799
|
+
detectors: {
|
|
8800
|
+
every: [
|
|
8801
|
+
{
|
|
8802
|
+
matchPackage: "solid-js"
|
|
8803
|
+
},
|
|
8804
|
+
{
|
|
8805
|
+
matchPackage: "@solidjs/start"
|
|
8806
|
+
}
|
|
8807
|
+
]
|
|
8808
|
+
},
|
|
8809
|
+
settings: {
|
|
8810
|
+
installCommand: {
|
|
8811
|
+
placeholder: "`yarn install`, `pnpm install`, `npm install`, or `bun install`"
|
|
8812
|
+
},
|
|
8813
|
+
buildCommand: {
|
|
8814
|
+
placeholder: "`npm run build` or `vinxi build`",
|
|
8815
|
+
value: "vinxi build"
|
|
8816
|
+
},
|
|
8817
|
+
devCommand: {
|
|
8818
|
+
value: "vinxi dev"
|
|
8819
|
+
},
|
|
8820
|
+
outputDirectory: {
|
|
8821
|
+
value: ".output"
|
|
8822
|
+
}
|
|
8823
|
+
},
|
|
8824
|
+
getOutputDirName: async () => ".output"
|
|
8825
|
+
},
|
|
8826
|
+
{
|
|
8827
|
+
name: "SolidStart (v0)",
|
|
8792
8828
|
slug: "solidstart",
|
|
8793
8829
|
demo: "https://solid-start-template.vercel.app",
|
|
8794
8830
|
logo: "https://api-frameworks.vercel.sh/framework-logos/solid.svg",
|
|
@@ -8796,6 +8832,7 @@ var require_frameworks = __commonJS({
|
|
|
8796
8832
|
description: "A Solid app, created with SolidStart.",
|
|
8797
8833
|
website: "https://solidjs.com",
|
|
8798
8834
|
envPrefix: "VITE_",
|
|
8835
|
+
sort: 98,
|
|
8799
8836
|
detectors: {
|
|
8800
8837
|
every: [
|
|
8801
8838
|
{
|
|
@@ -15597,7 +15634,7 @@ var require_tree_kill = __commonJS({
|
|
|
15597
15634
|
"../../node_modules/.pnpm/tree-kill@1.2.2/node_modules/tree-kill/index.js"(exports2, module2) {
|
|
15598
15635
|
"use strict";
|
|
15599
15636
|
var childProcess = require("child_process");
|
|
15600
|
-
var
|
|
15637
|
+
var spawn2 = childProcess.spawn;
|
|
15601
15638
|
var exec = childProcess.exec;
|
|
15602
15639
|
module2.exports = function(pid, signal, callback) {
|
|
15603
15640
|
if (typeof signal === "function" && callback === void 0) {
|
|
@@ -15622,14 +15659,14 @@ var require_tree_kill = __commonJS({
|
|
|
15622
15659
|
break;
|
|
15623
15660
|
case "darwin":
|
|
15624
15661
|
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
|
|
15625
|
-
return
|
|
15662
|
+
return spawn2("pgrep", ["-P", parentPid]);
|
|
15626
15663
|
}, function() {
|
|
15627
15664
|
killAll(tree, signal, callback);
|
|
15628
15665
|
});
|
|
15629
15666
|
break;
|
|
15630
15667
|
default:
|
|
15631
15668
|
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
|
|
15632
|
-
return
|
|
15669
|
+
return spawn2("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
|
|
15633
15670
|
}, function() {
|
|
15634
15671
|
killAll(tree, signal, callback);
|
|
15635
15672
|
});
|
|
@@ -18697,7 +18734,7 @@ var require_detect_framework = __commonJS({
|
|
|
18697
18734
|
removeSupersededFrameworks: () => removeSupersededFrameworks
|
|
18698
18735
|
});
|
|
18699
18736
|
module2.exports = __toCommonJS2(detect_framework_exports);
|
|
18700
|
-
var
|
|
18737
|
+
var import_child_process2 = require("child_process");
|
|
18701
18738
|
async function matches(fs5, framework) {
|
|
18702
18739
|
const { detectors } = framework;
|
|
18703
18740
|
if (!detectors) {
|
|
@@ -18874,7 +18911,7 @@ var require_detect_framework = __commonJS({
|
|
|
18874
18911
|
function lookupInstalledVersion(cwd, packageName) {
|
|
18875
18912
|
try {
|
|
18876
18913
|
const script = `require('${packageName}/package.json').version`;
|
|
18877
|
-
return (0,
|
|
18914
|
+
return (0, import_child_process2.spawnSync)(cwd, ["-p", script], {
|
|
18878
18915
|
encoding: "utf-8"
|
|
18879
18916
|
}).stdout.trim();
|
|
18880
18917
|
} catch (error) {
|
|
@@ -23820,12 +23857,12 @@ var require_wrappy = __commonJS({
|
|
|
23820
23857
|
var require_once = __commonJS({
|
|
23821
23858
|
"../../node_modules/.pnpm/once@1.4.0/node_modules/once/once.js"(exports2, module2) {
|
|
23822
23859
|
var wrappy = require_wrappy();
|
|
23823
|
-
module2.exports = wrappy(
|
|
23860
|
+
module2.exports = wrappy(once2);
|
|
23824
23861
|
module2.exports.strict = wrappy(onceStrict);
|
|
23825
|
-
|
|
23862
|
+
once2.proto = once2(function() {
|
|
23826
23863
|
Object.defineProperty(Function.prototype, "once", {
|
|
23827
23864
|
value: function() {
|
|
23828
|
-
return
|
|
23865
|
+
return once2(this);
|
|
23829
23866
|
},
|
|
23830
23867
|
configurable: true
|
|
23831
23868
|
});
|
|
@@ -23836,7 +23873,7 @@ var require_once = __commonJS({
|
|
|
23836
23873
|
configurable: true
|
|
23837
23874
|
});
|
|
23838
23875
|
});
|
|
23839
|
-
function
|
|
23876
|
+
function once2(fn) {
|
|
23840
23877
|
var f = function() {
|
|
23841
23878
|
if (f.called)
|
|
23842
23879
|
return f.value;
|
|
@@ -23866,7 +23903,7 @@ var require_inflight = __commonJS({
|
|
|
23866
23903
|
"../../node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js"(exports2, module2) {
|
|
23867
23904
|
var wrappy = require_wrappy();
|
|
23868
23905
|
var reqs = /* @__PURE__ */ Object.create(null);
|
|
23869
|
-
var
|
|
23906
|
+
var once2 = require_once();
|
|
23870
23907
|
module2.exports = wrappy(inflight);
|
|
23871
23908
|
function inflight(key, cb) {
|
|
23872
23909
|
if (reqs[key]) {
|
|
@@ -23878,7 +23915,7 @@ var require_inflight = __commonJS({
|
|
|
23878
23915
|
}
|
|
23879
23916
|
}
|
|
23880
23917
|
function makeres(key) {
|
|
23881
|
-
return
|
|
23918
|
+
return once2(function RES() {
|
|
23882
23919
|
var cbs = reqs[key];
|
|
23883
23920
|
var len = cbs.length;
|
|
23884
23921
|
var args = slice(arguments);
|
|
@@ -23928,7 +23965,7 @@ var require_glob = __commonJS({
|
|
|
23928
23965
|
var util = require("util");
|
|
23929
23966
|
var childrenIgnored = common.childrenIgnored;
|
|
23930
23967
|
var isIgnored = common.isIgnored;
|
|
23931
|
-
var
|
|
23968
|
+
var once2 = require_once();
|
|
23932
23969
|
function glob4(pattern, options, cb) {
|
|
23933
23970
|
if (typeof options === "function")
|
|
23934
23971
|
cb = options, options = {};
|
|
@@ -23989,7 +24026,7 @@ var require_glob = __commonJS({
|
|
|
23989
24026
|
var n = this.minimatch.set.length;
|
|
23990
24027
|
this.matches = new Array(n);
|
|
23991
24028
|
if (typeof cb === "function") {
|
|
23992
|
-
cb =
|
|
24029
|
+
cb = once2(cb);
|
|
23993
24030
|
this.on("error", cb);
|
|
23994
24031
|
this.on("end", function(matches) {
|
|
23995
24032
|
cb(null, matches);
|
|
@@ -26279,13 +26316,14 @@ __export(src_exports, {
|
|
|
26279
26316
|
module.exports = __toCommonJS(src_exports);
|
|
26280
26317
|
var import_ms = __toESM(require_ms());
|
|
26281
26318
|
var import_path6 = __toESM(require("path"));
|
|
26282
|
-
var
|
|
26319
|
+
var import_node_fetch2 = __toESM(require_lib2());
|
|
26283
26320
|
var import_get_port = __toESM(require_get_port());
|
|
26284
26321
|
var import_is_port_reachable = __toESM(require_is_port_reachable());
|
|
26285
26322
|
var import_frameworks = __toESM(require_frameworks());
|
|
26323
|
+
var import_child_process = require("child_process");
|
|
26286
26324
|
var import_fs4 = require("fs");
|
|
26287
26325
|
var import_os = require("os");
|
|
26288
|
-
var
|
|
26326
|
+
var import_build_utils4 = require("@vercel/build-utils");
|
|
26289
26327
|
|
|
26290
26328
|
// src/utils/build-output-v1.ts
|
|
26291
26329
|
var import_path2 = __toESM(require("path"));
|
|
@@ -27071,7 +27109,74 @@ async function injectVercelAnalyticsPlugin(dir) {
|
|
|
27071
27109
|
// src/index.ts
|
|
27072
27110
|
var import_tree_kill = __toESM(require_tree_kill());
|
|
27073
27111
|
var import_fs_detectors = __toESM(require_dist4());
|
|
27074
|
-
|
|
27112
|
+
|
|
27113
|
+
// src/utils/hugo.ts
|
|
27114
|
+
var import_node_fetch = __toESM(require_lib2());
|
|
27115
|
+
var import_build_utils3 = require("@vercel/build-utils");
|
|
27116
|
+
async function getHugoUrl(version2, platform = process.platform, arch = process.arch) {
|
|
27117
|
+
const oses = {
|
|
27118
|
+
linux: ["linux"],
|
|
27119
|
+
darwin: ["darwin", "macos"],
|
|
27120
|
+
win32: ["windows"]
|
|
27121
|
+
}[platform];
|
|
27122
|
+
if (!oses) {
|
|
27123
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
27124
|
+
}
|
|
27125
|
+
const arches = {
|
|
27126
|
+
arm64: ["arm64"],
|
|
27127
|
+
x64: ["amd64", "64bit"]
|
|
27128
|
+
}[arch];
|
|
27129
|
+
if (!arches) {
|
|
27130
|
+
throw new Error(`Unsupported arch: ${arch}`);
|
|
27131
|
+
}
|
|
27132
|
+
if (platform === "darwin") {
|
|
27133
|
+
arches.push("universal");
|
|
27134
|
+
if (arch === "arm64") {
|
|
27135
|
+
arches.push("64bit");
|
|
27136
|
+
}
|
|
27137
|
+
}
|
|
27138
|
+
const checksumsUrl = `https://github.com/gohugoio/hugo/releases/download/v${version2}/hugo_${version2}_checksums.txt`;
|
|
27139
|
+
const checksumsRes = await (0, import_node_fetch.default)(checksumsUrl);
|
|
27140
|
+
if (checksumsRes.status === 404) {
|
|
27141
|
+
throw new import_build_utils3.NowBuildError({
|
|
27142
|
+
code: "STATIC_BUILD_BINARY_NOT_FOUND",
|
|
27143
|
+
message: `Version ${version2} of Hugo does not exist. Please specify a different one.`,
|
|
27144
|
+
link: "https://vercel.link/framework-versioning"
|
|
27145
|
+
});
|
|
27146
|
+
}
|
|
27147
|
+
const checksumsBody = await checksumsRes.text();
|
|
27148
|
+
const checksums = /* @__PURE__ */ new Map();
|
|
27149
|
+
for (const line of checksumsBody.trim().split("\n")) {
|
|
27150
|
+
const [sha, name] = line.split(/\s+/);
|
|
27151
|
+
checksums.set(name, sha);
|
|
27152
|
+
}
|
|
27153
|
+
const file = findFile(checksums.keys(), oses, arches, true) || findFile(checksums.keys(), oses, arches, false);
|
|
27154
|
+
if (!file) {
|
|
27155
|
+
throw new Error(
|
|
27156
|
+
`Could not determine filename for Hugo v${version2} for ${platform} / ${arch}`
|
|
27157
|
+
);
|
|
27158
|
+
}
|
|
27159
|
+
return `https://github.com/gohugoio/hugo/releases/download/v${version2}/${file}`;
|
|
27160
|
+
}
|
|
27161
|
+
function findFile(names, oses, arches, extended) {
|
|
27162
|
+
const prefix = `hugo_${extended ? "extended_" : ""}`;
|
|
27163
|
+
for (const name of names) {
|
|
27164
|
+
if (!name.startsWith(prefix) || !name.endsWith(".tar.gz"))
|
|
27165
|
+
continue;
|
|
27166
|
+
const suffix = name.split("_").pop();
|
|
27167
|
+
if (!suffix)
|
|
27168
|
+
continue;
|
|
27169
|
+
const [os, arch] = suffix.replace(/\.(.*)$/, "").toLowerCase().split("-");
|
|
27170
|
+
if (oses.includes(os) && arches.includes(arch)) {
|
|
27171
|
+
return name;
|
|
27172
|
+
}
|
|
27173
|
+
}
|
|
27174
|
+
return null;
|
|
27175
|
+
}
|
|
27176
|
+
|
|
27177
|
+
// src/index.ts
|
|
27178
|
+
var import_events = require("events");
|
|
27179
|
+
var SUPPORTED_RUBY_VERSION = "3.3.0";
|
|
27075
27180
|
var sleep = (n) => new Promise((resolve) => setTimeout(resolve, n));
|
|
27076
27181
|
var DEV_SERVER_PORT_BIND_TIMEOUT = (0, import_ms.default)("5m");
|
|
27077
27182
|
async function checkForPort(port, timeout) {
|
|
@@ -27090,21 +27195,21 @@ function validateDistDir(distDir) {
|
|
|
27090
27195
|
const isEmpty = () => (0, import_fs4.readdirSync)(distDir).length === 0;
|
|
27091
27196
|
const link = "https://vercel.link/missing-public-directory";
|
|
27092
27197
|
if (!exists()) {
|
|
27093
|
-
throw new
|
|
27198
|
+
throw new import_build_utils4.NowBuildError({
|
|
27094
27199
|
code: "STATIC_BUILD_NO_OUT_DIR",
|
|
27095
27200
|
message: `No Output Directory named "${distDirName}" found after the Build completed. You can configure the Output Directory in your Project Settings.`,
|
|
27096
27201
|
link
|
|
27097
27202
|
});
|
|
27098
27203
|
}
|
|
27099
27204
|
if (!isDirectory()) {
|
|
27100
|
-
throw new
|
|
27205
|
+
throw new import_build_utils4.NowBuildError({
|
|
27101
27206
|
code: "STATIC_BUILD_NOT_A_DIR",
|
|
27102
27207
|
message: `The path specified as Output Directory ("${distDirName}") is not actually a directory.`,
|
|
27103
27208
|
link
|
|
27104
27209
|
});
|
|
27105
27210
|
}
|
|
27106
27211
|
if (isEmpty()) {
|
|
27107
|
-
throw new
|
|
27212
|
+
throw new import_build_utils4.NowBuildError({
|
|
27108
27213
|
code: "STATIC_BUILD_EMPTY_OUT_DIR",
|
|
27109
27214
|
message: `The Output Directory "${distDirName}" is empty.`,
|
|
27110
27215
|
link
|
|
@@ -27166,7 +27271,7 @@ var nowDevChildProcesses = /* @__PURE__ */ new Set();
|
|
|
27166
27271
|
["SIGINT", "SIGTERM"].forEach((signal) => {
|
|
27167
27272
|
process.once(signal, async () => {
|
|
27168
27273
|
for (const child of nowDevChildProcesses) {
|
|
27169
|
-
(0,
|
|
27274
|
+
(0, import_build_utils4.debug)(
|
|
27170
27275
|
`Got ${signal}, killing dev server child process (pid=${child.pid})`
|
|
27171
27276
|
);
|
|
27172
27277
|
await new Promise((resolve) => (0, import_tree_kill.default)(child.pid, signal, resolve));
|
|
@@ -27230,18 +27335,25 @@ function getFramework(config, pkg) {
|
|
|
27230
27335
|
);
|
|
27231
27336
|
return framework;
|
|
27232
27337
|
}
|
|
27233
|
-
async function fetchBinary(url, framework, version2) {
|
|
27234
|
-
const res = await (0,
|
|
27338
|
+
async function fetchBinary(url, framework, version2, dest = "/usr/local/bin") {
|
|
27339
|
+
const res = await (0, import_node_fetch2.default)(url);
|
|
27235
27340
|
if (res.status === 404) {
|
|
27236
|
-
throw new
|
|
27341
|
+
throw new import_build_utils4.NowBuildError({
|
|
27237
27342
|
code: "STATIC_BUILD_BINARY_NOT_FOUND",
|
|
27238
27343
|
message: `Version ${version2} of ${framework} does not exist. Please specify a different one.`,
|
|
27239
27344
|
link: "https://vercel.link/framework-versioning"
|
|
27240
27345
|
});
|
|
27241
27346
|
}
|
|
27242
|
-
|
|
27243
|
-
|
|
27347
|
+
const cp = (0, import_child_process.spawn)("tar", ["-zx", "-C", dest], {
|
|
27348
|
+
stdio: ["pipe", "ignore", "ignore"]
|
|
27244
27349
|
});
|
|
27350
|
+
res.body.pipe(cp.stdin);
|
|
27351
|
+
const [exitCode] = await (0, import_events.once)(cp, "exit");
|
|
27352
|
+
if (exitCode !== 0) {
|
|
27353
|
+
throw new Error(
|
|
27354
|
+
`Extraction of ${framework} failed (exit code ${exitCode})`
|
|
27355
|
+
);
|
|
27356
|
+
}
|
|
27245
27357
|
}
|
|
27246
27358
|
async function getUpdatedDistPath(framework, outputDirPrefix, entrypointDir, distPath, config) {
|
|
27247
27359
|
if (framework) {
|
|
@@ -27264,7 +27376,7 @@ var build = async ({
|
|
|
27264
27376
|
config,
|
|
27265
27377
|
meta = {}
|
|
27266
27378
|
}) => {
|
|
27267
|
-
await (0,
|
|
27379
|
+
await (0, import_build_utils4.download)(files, workPath, meta);
|
|
27268
27380
|
const mountpoint = import_path6.default.dirname(entrypoint);
|
|
27269
27381
|
const entrypointDir = import_path6.default.join(workPath, mountpoint);
|
|
27270
27382
|
let distPath = import_path6.default.join(
|
|
@@ -27294,13 +27406,19 @@ var build = async ({
|
|
|
27294
27406
|
const routes = [];
|
|
27295
27407
|
if (config.zeroConfig) {
|
|
27296
27408
|
const { HUGO_VERSION, ZOLA_VERSION, GUTENBERG_VERSION } = process.env;
|
|
27297
|
-
if (HUGO_VERSION && !meta.isDev) {
|
|
27298
|
-
|
|
27299
|
-
const
|
|
27300
|
-
|
|
27301
|
-
|
|
27302
|
-
|
|
27303
|
-
|
|
27409
|
+
if ((HUGO_VERSION || framework?.slug === "hugo") && !meta.isDev) {
|
|
27410
|
+
const hugoVersion = HUGO_VERSION || "0.58.2";
|
|
27411
|
+
const hugoDir = import_path6.default.join(
|
|
27412
|
+
workPath,
|
|
27413
|
+
`.vercel/cache/hugo-v${hugoVersion}-${process.platform}-${process.arch}`
|
|
27414
|
+
);
|
|
27415
|
+
if (!(0, import_fs4.existsSync)(hugoDir)) {
|
|
27416
|
+
console.log("Installing Hugo version " + hugoVersion);
|
|
27417
|
+
const url = await getHugoUrl(hugoVersion);
|
|
27418
|
+
(0, import_fs4.mkdirSync)(hugoDir, { recursive: true });
|
|
27419
|
+
await fetchBinary(url, "Hugo", hugoVersion, hugoDir);
|
|
27420
|
+
}
|
|
27421
|
+
process.env.PATH = `${hugoDir}${import_path6.default.delimiter}${process.env.PATH}`;
|
|
27304
27422
|
}
|
|
27305
27423
|
if (ZOLA_VERSION && !meta.isDev) {
|
|
27306
27424
|
console.log("Installing Zola version " + ZOLA_VERSION);
|
|
@@ -27319,16 +27437,26 @@ var build = async ({
|
|
|
27319
27437
|
);
|
|
27320
27438
|
}
|
|
27321
27439
|
if (framework) {
|
|
27322
|
-
(0,
|
|
27440
|
+
(0, import_build_utils4.debug)(
|
|
27323
27441
|
`Detected ${framework.name} framework. Optimizing your deployment...`
|
|
27324
27442
|
);
|
|
27325
|
-
const prefixedEnvs = (0,
|
|
27443
|
+
const prefixedEnvs = (0, import_build_utils4.getPrefixedEnvVars)({
|
|
27326
27444
|
envPrefix: framework.envPrefix,
|
|
27327
27445
|
envs: process.env
|
|
27328
27446
|
});
|
|
27329
27447
|
for (const [key, value] of Object.entries(prefixedEnvs)) {
|
|
27330
27448
|
process.env[key] = value;
|
|
27331
27449
|
}
|
|
27450
|
+
const speedInsightsVersion = (0, import_build_utils4.getInstalledPackageVersion)(
|
|
27451
|
+
"@vercel/speed-insights"
|
|
27452
|
+
);
|
|
27453
|
+
const isSpeedInsightsInstalled = Boolean(speedInsightsVersion);
|
|
27454
|
+
if (isSpeedInsightsInstalled && process.env.VERCEL_ANALYTICS_ID && ["next", "nuxtjs", "gatsby"].includes(framework.slug || "")) {
|
|
27455
|
+
delete process.env.VERCEL_ANALYTICS_ID;
|
|
27456
|
+
(0, import_build_utils4.debug)(
|
|
27457
|
+
`Removed VERCEL_ANALYTICS_ID from the environment because we detected the @vercel/speed-insights package`
|
|
27458
|
+
);
|
|
27459
|
+
}
|
|
27332
27460
|
if (framework.slug === "gatsby") {
|
|
27333
27461
|
await injectPlugins(detectedVersion, entrypointDir);
|
|
27334
27462
|
}
|
|
@@ -27342,35 +27470,35 @@ var build = async ({
|
|
|
27342
27470
|
await injectVercelAnalyticsPlugin(frameworkDirectory);
|
|
27343
27471
|
break;
|
|
27344
27472
|
default:
|
|
27345
|
-
(0,
|
|
27473
|
+
(0, import_build_utils4.debug)(
|
|
27346
27474
|
`No Web Vitals plugin injected for framework ${framework.slug}`
|
|
27347
27475
|
);
|
|
27348
27476
|
break;
|
|
27349
27477
|
}
|
|
27350
27478
|
}
|
|
27351
27479
|
}
|
|
27352
|
-
const nodeVersion = await (0,
|
|
27480
|
+
const nodeVersion = await (0, import_build_utils4.getNodeVersion)(
|
|
27353
27481
|
entrypointDir,
|
|
27354
27482
|
void 0,
|
|
27355
27483
|
config,
|
|
27356
27484
|
meta
|
|
27357
27485
|
);
|
|
27358
|
-
const spawnOpts = (0,
|
|
27486
|
+
const spawnOpts = (0, import_build_utils4.getSpawnOptions)(meta, nodeVersion);
|
|
27359
27487
|
if (!spawnOpts.env) {
|
|
27360
27488
|
spawnOpts.env = {};
|
|
27361
27489
|
}
|
|
27362
27490
|
if (framework?.slug === "create-react-app") {
|
|
27363
27491
|
spawnOpts.env.CI = "false";
|
|
27364
27492
|
}
|
|
27365
|
-
const { cliType, lockfileVersion } = await (0,
|
|
27366
|
-
spawnOpts.env = (0,
|
|
27493
|
+
const { cliType, lockfileVersion } = await (0, import_build_utils4.scanParentDirs)(entrypointDir);
|
|
27494
|
+
spawnOpts.env = (0, import_build_utils4.getEnvForPackageManager)({
|
|
27367
27495
|
cliType,
|
|
27368
27496
|
lockfileVersion,
|
|
27369
27497
|
nodeVersion,
|
|
27370
27498
|
env: spawnOpts.env || {}
|
|
27371
27499
|
});
|
|
27372
27500
|
if (meta.isDev) {
|
|
27373
|
-
(0,
|
|
27501
|
+
(0, import_build_utils4.debug)("Skipping dependency installation because dev mode is enabled");
|
|
27374
27502
|
} else {
|
|
27375
27503
|
let hasPrintedInstall = false;
|
|
27376
27504
|
const printInstall = () => {
|
|
@@ -27380,13 +27508,13 @@ var build = async ({
|
|
|
27380
27508
|
}
|
|
27381
27509
|
};
|
|
27382
27510
|
if (!config.zeroConfig) {
|
|
27383
|
-
(0,
|
|
27384
|
-
await (0,
|
|
27511
|
+
(0, import_build_utils4.debug)('Detected "builds" - not zero config');
|
|
27512
|
+
await (0, import_build_utils4.runNpmInstall)(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
27385
27513
|
isNpmInstall = true;
|
|
27386
27514
|
} else if (typeof installCommand === "string") {
|
|
27387
27515
|
if (installCommand.trim()) {
|
|
27388
27516
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
27389
|
-
await (0,
|
|
27517
|
+
await (0, import_build_utils4.execCommand)(installCommand, {
|
|
27390
27518
|
...spawnOpts,
|
|
27391
27519
|
cwd: entrypointDir
|
|
27392
27520
|
});
|
|
@@ -27398,10 +27526,10 @@ var build = async ({
|
|
|
27398
27526
|
}
|
|
27399
27527
|
} else {
|
|
27400
27528
|
if ((0, import_fs4.existsSync)(gemfilePath)) {
|
|
27401
|
-
(0,
|
|
27529
|
+
(0, import_build_utils4.debug)("Detected Gemfile");
|
|
27402
27530
|
printInstall();
|
|
27403
27531
|
const opts = {
|
|
27404
|
-
env: (0,
|
|
27532
|
+
env: (0, import_build_utils4.cloneEnv)(process.env, {
|
|
27405
27533
|
// See more: https://github.com/rubygems/rubygems/blob/a82d04856deba58be6b90f681a5e42a7c0f2baa7/bundler/lib/bundler/man/bundle-config.1.ronn
|
|
27406
27534
|
BUNDLE_BIN: "vendor/bin",
|
|
27407
27535
|
BUNDLE_CACHE_PATH: "vendor/cache",
|
|
@@ -27413,13 +27541,13 @@ var build = async ({
|
|
|
27413
27541
|
BUNDLE_DISABLE_VERSION_CHECK: "1"
|
|
27414
27542
|
})
|
|
27415
27543
|
};
|
|
27416
|
-
await (0,
|
|
27544
|
+
await (0, import_build_utils4.runBundleInstall)(workPath, [], opts, meta);
|
|
27417
27545
|
isBundleInstall = true;
|
|
27418
27546
|
}
|
|
27419
27547
|
if ((0, import_fs4.existsSync)(requirementsPath)) {
|
|
27420
|
-
(0,
|
|
27548
|
+
(0, import_build_utils4.debug)("Detected requirements.txt");
|
|
27421
27549
|
printInstall();
|
|
27422
|
-
await (0,
|
|
27550
|
+
await (0, import_build_utils4.runPipInstall)(
|
|
27423
27551
|
workPath,
|
|
27424
27552
|
["-r", requirementsPath],
|
|
27425
27553
|
void 0,
|
|
@@ -27428,7 +27556,7 @@ var build = async ({
|
|
|
27428
27556
|
isPipInstall = true;
|
|
27429
27557
|
}
|
|
27430
27558
|
if (pkg) {
|
|
27431
|
-
await (0,
|
|
27559
|
+
await (0, import_build_utils4.runNpmInstall)(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
27432
27560
|
isNpmInstall = true;
|
|
27433
27561
|
}
|
|
27434
27562
|
}
|
|
@@ -27439,12 +27567,12 @@ var build = async ({
|
|
|
27439
27567
|
let gemHome = void 0;
|
|
27440
27568
|
const pathList = [];
|
|
27441
27569
|
if (isNpmInstall || pkg && (buildCommand || devCommand)) {
|
|
27442
|
-
const nodeBinPaths = (0,
|
|
27570
|
+
const nodeBinPaths = (0, import_build_utils4.getNodeBinPaths)({
|
|
27443
27571
|
start: entrypointDir,
|
|
27444
27572
|
base: repoRootPath
|
|
27445
27573
|
});
|
|
27446
27574
|
pathList.push(...nodeBinPaths);
|
|
27447
|
-
(0,
|
|
27575
|
+
(0, import_build_utils4.debug)(
|
|
27448
27576
|
`Added "${nodeBinPaths.join(
|
|
27449
27577
|
import_path6.default.delimiter
|
|
27450
27578
|
)}" to PATH env because a package.json file was found`
|
|
@@ -27453,12 +27581,12 @@ var build = async ({
|
|
|
27453
27581
|
if (isBundleInstall) {
|
|
27454
27582
|
const vendorBin = import_path6.default.join(workPath, "vendor", "bin");
|
|
27455
27583
|
pathList.push(vendorBin);
|
|
27456
|
-
(0,
|
|
27584
|
+
(0, import_build_utils4.debug)(`Added "${vendorBin}" to PATH env because a Gemfile was found`);
|
|
27457
27585
|
const dir = import_path6.default.join(workPath, "vendor", "bundle", "ruby");
|
|
27458
27586
|
const rubyVersion = SUPPORTED_RUBY_VERSION;
|
|
27459
27587
|
if (rubyVersion) {
|
|
27460
27588
|
gemHome = import_path6.default.join(dir, rubyVersion);
|
|
27461
|
-
(0,
|
|
27589
|
+
(0, import_build_utils4.debug)(`Set GEM_HOME="${gemHome}" because a Gemfile was found`);
|
|
27462
27590
|
}
|
|
27463
27591
|
}
|
|
27464
27592
|
if (isPipInstall) {
|
|
@@ -27474,7 +27602,7 @@ var build = async ({
|
|
|
27474
27602
|
if (meta.isDev && (devCommand || pkg && devScript && pkg.scripts && pkg.scripts[devScript])) {
|
|
27475
27603
|
let devPort = nowDevScriptPorts.get(entrypoint);
|
|
27476
27604
|
if (typeof devPort === "number") {
|
|
27477
|
-
(0,
|
|
27605
|
+
(0, import_build_utils4.debug)(
|
|
27478
27606
|
"`%s` server already running for %j",
|
|
27479
27607
|
devCommand || devScript,
|
|
27480
27608
|
entrypoint
|
|
@@ -27488,7 +27616,7 @@ var build = async ({
|
|
|
27488
27616
|
env: { ...spawnOpts.env, PORT: String(devPort) }
|
|
27489
27617
|
};
|
|
27490
27618
|
const cmd = devCommand || `yarn run ${devScript}`;
|
|
27491
|
-
const child = (0,
|
|
27619
|
+
const child = (0, import_build_utils4.spawnCommand)(cmd, opts);
|
|
27492
27620
|
child.on("close", () => nowDevScriptPorts.delete(entrypoint));
|
|
27493
27621
|
nowDevChildProcesses.add(child);
|
|
27494
27622
|
try {
|
|
@@ -27499,7 +27627,7 @@ var build = async ({
|
|
|
27499
27627
|
Details: https://err.sh/vercel/vercel/now-static-build-failed-to-detect-a-server`
|
|
27500
27628
|
);
|
|
27501
27629
|
}
|
|
27502
|
-
(0,
|
|
27630
|
+
(0, import_build_utils4.debug)("Detected dev server for %j", entrypoint);
|
|
27503
27631
|
}
|
|
27504
27632
|
let srcBase = mountpoint.replace(/^\.\/?/, "");
|
|
27505
27633
|
if (srcBase.length > 0) {
|
|
@@ -27513,13 +27641,13 @@ Details: https://err.sh/vercel/vercel/now-static-build-failed-to-detect-a-server
|
|
|
27513
27641
|
);
|
|
27514
27642
|
} else {
|
|
27515
27643
|
if (meta.isDev) {
|
|
27516
|
-
(0,
|
|
27644
|
+
(0, import_build_utils4.debug)(`WARN: A dev script is missing`);
|
|
27517
27645
|
}
|
|
27518
27646
|
if (buildCommand) {
|
|
27519
|
-
(0,
|
|
27647
|
+
(0, import_build_utils4.debug)(`Executing "${buildCommand}"`);
|
|
27520
27648
|
}
|
|
27521
27649
|
try {
|
|
27522
|
-
const found = typeof buildCommand === "string" ? await (0,
|
|
27650
|
+
const found = typeof buildCommand === "string" ? await (0, import_build_utils4.execCommand)(buildCommand, {
|
|
27523
27651
|
...spawnOpts,
|
|
27524
27652
|
// Yarn v2 PnP mode may be activated, so force
|
|
27525
27653
|
// "node-modules" linker style
|
|
@@ -27528,7 +27656,7 @@ Details: https://err.sh/vercel/vercel/now-static-build-failed-to-detect-a-server
|
|
|
27528
27656
|
...spawnOpts.env
|
|
27529
27657
|
},
|
|
27530
27658
|
cwd: entrypointDir
|
|
27531
|
-
}) : await (0,
|
|
27659
|
+
}) : await (0, import_build_utils4.runPackageJsonScript)(
|
|
27532
27660
|
entrypointDir,
|
|
27533
27661
|
["vercel-build", "now-build", "build"],
|
|
27534
27662
|
spawnOpts
|
|
@@ -27609,26 +27737,26 @@ Details: https://err.sh/vercel/vercel/now-static-build-failed-to-detect-a-server
|
|
|
27609
27737
|
"package.json",
|
|
27610
27738
|
".vercel_build_output"
|
|
27611
27739
|
];
|
|
27612
|
-
(0,
|
|
27740
|
+
(0, import_build_utils4.debug)(`Using ignore: ${JSON.stringify(ignore)}`);
|
|
27613
27741
|
}
|
|
27614
|
-
output = await (0,
|
|
27742
|
+
output = await (0, import_build_utils4.glob)("**", { cwd: distPath, ignore }, mountpoint);
|
|
27615
27743
|
Object.assign(output, extraOutputs.functions);
|
|
27616
27744
|
}
|
|
27617
27745
|
}
|
|
27618
27746
|
return { routes, images, output };
|
|
27619
27747
|
}
|
|
27620
27748
|
if (!config.zeroConfig && entrypoint.endsWith(".sh")) {
|
|
27621
|
-
(0,
|
|
27622
|
-
const nodeVersion = await (0,
|
|
27749
|
+
(0, import_build_utils4.debug)(`Running build script "${entrypoint}"`);
|
|
27750
|
+
const nodeVersion = await (0, import_build_utils4.getNodeVersion)(
|
|
27623
27751
|
entrypointDir,
|
|
27624
27752
|
void 0,
|
|
27625
27753
|
config,
|
|
27626
27754
|
meta
|
|
27627
27755
|
);
|
|
27628
|
-
const spawnOpts = (0,
|
|
27629
|
-
await (0,
|
|
27756
|
+
const spawnOpts = (0, import_build_utils4.getSpawnOptions)(meta, nodeVersion);
|
|
27757
|
+
await (0, import_build_utils4.runShellScript)(import_path6.default.join(workPath, entrypoint), [], spawnOpts);
|
|
27630
27758
|
validateDistDir(distPath);
|
|
27631
|
-
const output = await (0,
|
|
27759
|
+
const output = await (0, import_build_utils4.glob)("**", distPath, mountpoint);
|
|
27632
27760
|
return {
|
|
27633
27761
|
output,
|
|
27634
27762
|
routes: []
|
|
@@ -27650,7 +27778,7 @@ var prepareCache = async ({
|
|
|
27650
27778
|
const configV3 = await readConfig(workPath);
|
|
27651
27779
|
if (configV3?.cache && Array.isArray(configV3.cache)) {
|
|
27652
27780
|
for (const cacheGlob of configV3.cache) {
|
|
27653
|
-
Object.assign(cacheFiles, await (0,
|
|
27781
|
+
Object.assign(cacheFiles, await (0, import_build_utils4.glob)(cacheGlob, workPath));
|
|
27654
27782
|
}
|
|
27655
27783
|
return cacheFiles;
|
|
27656
27784
|
}
|
|
@@ -27660,18 +27788,18 @@ var prepareCache = async ({
|
|
|
27660
27788
|
});
|
|
27661
27789
|
if (buildConfigV1?.cache && Array.isArray(buildConfigV1.cache)) {
|
|
27662
27790
|
for (const cacheGlob of buildConfigV1.cache) {
|
|
27663
|
-
Object.assign(cacheFiles, await (0,
|
|
27791
|
+
Object.assign(cacheFiles, await (0, import_build_utils4.glob)(cacheGlob, workPath));
|
|
27664
27792
|
}
|
|
27665
27793
|
return cacheFiles;
|
|
27666
27794
|
}
|
|
27667
27795
|
Object.assign(
|
|
27668
27796
|
cacheFiles,
|
|
27669
|
-
await (0,
|
|
27797
|
+
await (0, import_build_utils4.glob)("**/{.shadow-cljs,node_modules}/**", repoRootPath || workPath)
|
|
27670
27798
|
);
|
|
27671
27799
|
const pkg = getPkg(entrypoint, workPath);
|
|
27672
27800
|
const framework = getFramework(config, pkg);
|
|
27673
27801
|
if (framework?.cachePattern) {
|
|
27674
|
-
Object.assign(cacheFiles, await (0,
|
|
27802
|
+
Object.assign(cacheFiles, await (0, import_build_utils4.glob)(framework.cachePattern, workPath));
|
|
27675
27803
|
}
|
|
27676
27804
|
return cacheFiles;
|
|
27677
27805
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/build-step",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
|
|
17
|
-
"@vercel/gatsby-plugin-vercel-builder": "2.0.
|
|
17
|
+
"@vercel/gatsby-plugin-vercel-builder": "2.0.26",
|
|
18
18
|
"@vercel/static-config": "3.0.0",
|
|
19
19
|
"ts-morph": "12.0.0"
|
|
20
20
|
},
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@types/node-fetch": "2.5.4",
|
|
29
29
|
"@types/promise-timeout": "1.3.0",
|
|
30
30
|
"@types/semver": "7.3.13",
|
|
31
|
-
"@vercel/build-utils": "
|
|
31
|
+
"@vercel/build-utils": "8.0.0",
|
|
32
32
|
"@vercel/error-utils": "2.0.2",
|
|
33
|
-
"@vercel/frameworks": "3.0.
|
|
34
|
-
"@vercel/fs-detectors": "5.2.
|
|
33
|
+
"@vercel/frameworks": "3.0.2",
|
|
34
|
+
"@vercel/fs-detectors": "5.2.3",
|
|
35
35
|
"@vercel/routing-utils": "3.1.0",
|
|
36
36
|
"execa": "3.2.0",
|
|
37
37
|
"fs-extra": "10.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "node ../../utils/build-builder.mjs",
|
|
49
49
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
|
|
50
|
-
"test-unit": "pnpm test test/build.test.ts test/gatsby.test.ts test/prepare-cache.test.ts",
|
|
50
|
+
"test-unit": "pnpm test test/build.test.ts test/hugo.test.ts test/gatsby.test.ts test/prepare-cache.test.ts",
|
|
51
51
|
"test-e2e": "pnpm test test/integration-*.test.js",
|
|
52
52
|
"type-check": "tsc --noEmit"
|
|
53
53
|
}
|