@reddoorla/maintenance 0.54.2 → 0.54.4
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/cli/bin.js +37 -13
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/audit.js +37 -13
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1874,11 +1874,15 @@ async function browserAudit(ctx) {
|
|
|
1874
1874
|
await runner.close?.();
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
|
+
var FETCH_TIMEOUT_MS = 1e4;
|
|
1877
1878
|
function defaultDiscoverDeps() {
|
|
1878
1879
|
return {
|
|
1879
1880
|
fetchText: async (url) => {
|
|
1880
1881
|
try {
|
|
1881
|
-
const res = await fetch(url, {
|
|
1882
|
+
const res = await fetch(url, {
|
|
1883
|
+
redirect: "follow",
|
|
1884
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
|
|
1885
|
+
});
|
|
1882
1886
|
if (!res.ok) return null;
|
|
1883
1887
|
return await res.text();
|
|
1884
1888
|
} catch {
|
|
@@ -1979,9 +1983,17 @@ async function defaultBrowserRunner() {
|
|
|
1979
1983
|
for (const url of urls) {
|
|
1980
1984
|
let status;
|
|
1981
1985
|
try {
|
|
1982
|
-
let res = await fetch(url, {
|
|
1986
|
+
let res = await fetch(url, {
|
|
1987
|
+
method: "HEAD",
|
|
1988
|
+
redirect: "follow",
|
|
1989
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
|
|
1990
|
+
});
|
|
1983
1991
|
if (res.status === 405 || res.status === 501) {
|
|
1984
|
-
res = await fetch(url, {
|
|
1992
|
+
res = await fetch(url, {
|
|
1993
|
+
method: "GET",
|
|
1994
|
+
redirect: "follow",
|
|
1995
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
|
|
1996
|
+
});
|
|
1985
1997
|
}
|
|
1986
1998
|
status = res.status;
|
|
1987
1999
|
} catch {
|
|
@@ -2092,6 +2104,20 @@ function fromJsonFile(path) {
|
|
|
2092
2104
|
}
|
|
2093
2105
|
|
|
2094
2106
|
// src/cli/fleet/resolve-sites.ts
|
|
2107
|
+
init_url();
|
|
2108
|
+
function sanitizeDynamicSites(sites) {
|
|
2109
|
+
return sites.map((s) => {
|
|
2110
|
+
if (s.deployedUrl !== void 0 && !isHttpUrl(s.deployedUrl)) {
|
|
2111
|
+
console.warn(
|
|
2112
|
+
`[inventory] dynamic inventory: ignoring deployedUrl that is not http(s) for ${s.name ?? s.path}: ${JSON.stringify(s.deployedUrl)}`
|
|
2113
|
+
);
|
|
2114
|
+
const copy = { ...s };
|
|
2115
|
+
delete copy.deployedUrl;
|
|
2116
|
+
return copy;
|
|
2117
|
+
}
|
|
2118
|
+
return s;
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2095
2121
|
async function resolveSites(input) {
|
|
2096
2122
|
if (input.site && input.fleet) {
|
|
2097
2123
|
throw Object.assign(new Error("cannot combine a positional [site] with --fleet"), {
|
|
@@ -2108,24 +2134,22 @@ async function resolveSites(input) {
|
|
|
2108
2134
|
if (input.fleet) {
|
|
2109
2135
|
const fleetPath = resolve(input.cwd, input.fleet);
|
|
2110
2136
|
const ext = extname(fleetPath).toLowerCase();
|
|
2111
|
-
let provider;
|
|
2112
2137
|
if (ext === ".json") {
|
|
2113
|
-
|
|
2114
|
-
}
|
|
2138
|
+
return fromJsonFile(fleetPath)();
|
|
2139
|
+
}
|
|
2140
|
+
if (ext === ".js" || ext === ".mjs" || ext === ".cjs") {
|
|
2115
2141
|
const mod = await import(pathToFileURL(fleetPath).href);
|
|
2116
2142
|
if (!mod.default || typeof mod.default !== "function") {
|
|
2117
2143
|
throw Object.assign(new Error(`--fleet ${input.fleet}: default export is not a function`), {
|
|
2118
2144
|
exitCode: 2
|
|
2119
2145
|
});
|
|
2120
2146
|
}
|
|
2121
|
-
|
|
2122
|
-
} else {
|
|
2123
|
-
throw Object.assign(
|
|
2124
|
-
new Error(`--fleet ${input.fleet}: unsupported extension ${ext || "(none)"}`),
|
|
2125
|
-
{ exitCode: 2 }
|
|
2126
|
-
);
|
|
2147
|
+
return sanitizeDynamicSites(await mod.default());
|
|
2127
2148
|
}
|
|
2128
|
-
|
|
2149
|
+
throw Object.assign(
|
|
2150
|
+
new Error(`--fleet ${input.fleet}: unsupported extension ${ext || "(none)"}`),
|
|
2151
|
+
{ exitCode: 2 }
|
|
2152
|
+
);
|
|
2129
2153
|
}
|
|
2130
2154
|
return localPath(resolve(input.cwd, input.site ?? input.cwd))();
|
|
2131
2155
|
}
|