@somewhere-cloud/cli 0.38.169 → 0.38.171
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.38.171
|
|
4
|
+
|
|
5
|
+
- Preview deploys report when a preview contains only part of a large table.
|
|
6
|
+
|
|
7
|
+
## 0.38.170
|
|
8
|
+
|
|
9
|
+
- Import app users from a CSV with bcrypt password hashes using `somewhere db import --source users users.csv`.
|
|
10
|
+
|
|
3
11
|
## 0.38.169
|
|
4
12
|
|
|
5
13
|
- Fix the API path used by `somewhere db import --source supabase`.
|
package/dist/lib/bundle.js
CHANGED
|
@@ -20314,7 +20314,7 @@ var require_snapshot_utils = __commonJS({
|
|
|
20314
20314
|
var require_snapshot_recorder = __commonJS({
|
|
20315
20315
|
"node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
20316
20316
|
"use strict";
|
|
20317
|
-
var { writeFile: writeFile2, readFile:
|
|
20317
|
+
var { writeFile: writeFile2, readFile: readFile3, mkdir } = __require("node:fs/promises");
|
|
20318
20318
|
var { dirname: dirname17, resolve: resolve27 } = __require("node:path");
|
|
20319
20319
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
20320
20320
|
var { InvalidArgumentError: InvalidArgumentError2, UndiciError } = require_errors();
|
|
@@ -20541,7 +20541,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
20541
20541
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
20542
20542
|
}
|
|
20543
20543
|
try {
|
|
20544
|
-
const data2 = await
|
|
20544
|
+
const data2 = await readFile3(resolve27(path3), "utf8");
|
|
20545
20545
|
const parsed = JSON.parse(data2);
|
|
20546
20546
|
if (Array.isArray(parsed)) {
|
|
20547
20547
|
this.#snapshots.clear();
|
|
@@ -76655,8 +76655,8 @@ var init_esm4 = __esm({
|
|
|
76655
76655
|
}
|
|
76656
76656
|
return this._userIgnored(path3, stats);
|
|
76657
76657
|
}
|
|
76658
|
-
_isntIgnored(path3,
|
|
76659
|
-
return !this._isIgnored(path3,
|
|
76658
|
+
_isntIgnored(path3, stat7) {
|
|
76659
|
+
return !this._isIgnored(path3, stat7);
|
|
76660
76660
|
}
|
|
76661
76661
|
/**
|
|
76662
76662
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
@@ -80412,19 +80412,19 @@ function resolveBrowserUpload(raw, baseDir = process.cwd()) {
|
|
|
80412
80412
|
return inline;
|
|
80413
80413
|
}
|
|
80414
80414
|
const absolute = resolve12(baseDir, raw);
|
|
80415
|
-
let
|
|
80415
|
+
let stat7;
|
|
80416
80416
|
try {
|
|
80417
|
-
|
|
80417
|
+
stat7 = statSync4(absolute);
|
|
80418
80418
|
} catch {
|
|
80419
80419
|
const inline = inlineBrowserUpload(raw);
|
|
80420
80420
|
if (inline)
|
|
80421
80421
|
return inline;
|
|
80422
80422
|
throw new Error(`upload file is not readable: ${absolute}`);
|
|
80423
80423
|
}
|
|
80424
|
-
if (!
|
|
80424
|
+
if (!stat7.isFile())
|
|
80425
80425
|
throw new Error(`upload path is not a regular file: ${absolute}`);
|
|
80426
|
-
if (
|
|
80427
|
-
throw new Error(`BROWSER_UPLOAD_TOO_LARGE: Upload file is ${
|
|
80426
|
+
if (stat7.size > MAX_BROWSER_UPLOAD_BYTES) {
|
|
80427
|
+
throw new Error(`BROWSER_UPLOAD_TOO_LARGE: Upload file is ${stat7.size} bytes; the browser upload limit is ${MAX_BROWSER_UPLOAD_BYTES} bytes (10 MB).`);
|
|
80428
80428
|
}
|
|
80429
80429
|
const name = basename4(absolute);
|
|
80430
80430
|
const contentType2 = MIME_TYPES[extname4(name).toLowerCase()] ?? "application/octet-stream";
|
|
@@ -85971,10 +85971,10 @@ function registerPull(program2) {
|
|
|
85971
85971
|
throw new Error(`Conflicting exported source path: ${path3}`);
|
|
85972
85972
|
}
|
|
85973
85973
|
const target2 = join35(outDir, ...parts.slice(0, i));
|
|
85974
|
-
const
|
|
85975
|
-
if (!
|
|
85974
|
+
const stat7 = lstatSync4(target2, { throwIfNoEntry: false });
|
|
85975
|
+
if (!stat7)
|
|
85976
85976
|
continue;
|
|
85977
|
-
if (
|
|
85977
|
+
if (stat7.isSymbolicLink() || (i < parts.length ? !stat7.isDirectory() : !stat7.isFile())) {
|
|
85978
85978
|
throw new Error(`Pull would conflict with local path ${path3}. Pull into a fresh folder.`);
|
|
85979
85979
|
}
|
|
85980
85980
|
}
|
|
@@ -86846,13 +86846,39 @@ var init_restore = __esm({
|
|
|
86846
86846
|
});
|
|
86847
86847
|
|
|
86848
86848
|
// dist/commands/db-import.js
|
|
86849
|
+
import { readFile as readFile2, stat as stat4 } from "node:fs/promises";
|
|
86849
86850
|
function registerDbImport(db) {
|
|
86850
|
-
db.command("import [tables...]").description("Generate a table declaration or
|
|
86851
|
-
if (options2.source !== void 0 && options2.source !== "supabase") {
|
|
86852
|
-
error("--source must be supabase when provided.");
|
|
86851
|
+
db.command("import [tables...]").description("Generate a table declaration or import Supabase tables or app users").option("--source <source>", "Import Supabase tables or import user CSV with the project owner\u2019s full-scope developer key").option("--project <id>", "Project ID (defaults to the linked project)").option("--all", "Copy all exposed Supabase tables").option("--order-by <column>", "Stable unique column for a table without a single supported primary key").option("--resume", "Skip existing destination primary keys").option("--job <id>", "Read the progress and receipt of a Supabase import job").action(async (tables, options2) => {
|
|
86852
|
+
if (options2.source !== void 0 && options2.source !== "supabase" && options2.source !== "users") {
|
|
86853
|
+
error("--source must be supabase or users when provided.");
|
|
86853
86854
|
process.exitCode = 1;
|
|
86854
86855
|
return;
|
|
86855
86856
|
}
|
|
86857
|
+
if (options2.source === "users") {
|
|
86858
|
+
if (tables.length !== 1 || tables[0] === "-" || options2.all || options2.orderBy || options2.resume || options2.job) {
|
|
86859
|
+
error("Use somewhere db import --source users users.csv with one CSV file.");
|
|
86860
|
+
process.exitCode = 1;
|
|
86861
|
+
return;
|
|
86862
|
+
}
|
|
86863
|
+
let csv;
|
|
86864
|
+
try {
|
|
86865
|
+
const file = await stat4(tables[0]);
|
|
86866
|
+
if (!file.isFile() || file.size > 5 * 1024 * 1024) {
|
|
86867
|
+
error("Send a user CSV file up to 5 MB.");
|
|
86868
|
+
process.exitCode = 1;
|
|
86869
|
+
return;
|
|
86870
|
+
}
|
|
86871
|
+
csv = await readFile2(tables[0], "utf8");
|
|
86872
|
+
} catch {
|
|
86873
|
+
error("Could not read the user CSV file.");
|
|
86874
|
+
process.exitCode = 1;
|
|
86875
|
+
return;
|
|
86876
|
+
}
|
|
86877
|
+
const project2 = resolveProjectRef(options2.project);
|
|
86878
|
+
const client2 = new ApiClient(getToken());
|
|
86879
|
+
printJson(await client2.call("POST", "/auth/import", { project_id: project2, csv }, void 0, { timeoutMs: 9e4 }));
|
|
86880
|
+
return;
|
|
86881
|
+
}
|
|
86856
86882
|
const supabase = options2.source === "supabase";
|
|
86857
86883
|
if (!supabase && (tables.length !== 1 || options2.all || options2.orderBy || options2.resume || options2.job)) {
|
|
86858
86884
|
error("Name one table to generate its declaration, or use --source supabase.");
|
|
@@ -87731,8 +87757,8 @@ function isDotenvPath(path3) {
|
|
|
87731
87757
|
function buildAdvisorContext(filePath) {
|
|
87732
87758
|
const context = {};
|
|
87733
87759
|
if (filePath) {
|
|
87734
|
-
const
|
|
87735
|
-
if (!
|
|
87760
|
+
const stat7 = statSync6(filePath);
|
|
87761
|
+
if (!stat7.isFile())
|
|
87736
87762
|
throw new Error("--file must name a regular file.");
|
|
87737
87763
|
const content = readFileSync34(filePath, "utf8");
|
|
87738
87764
|
context.file = {
|
|
@@ -90408,8 +90434,10 @@ async function mintPreviewHandoff(client, projectId, draftId, candidateReleaseId
|
|
|
90408
90434
|
})
|
|
90409
90435
|
};
|
|
90410
90436
|
}
|
|
90411
|
-
function printPreviewHandoff(handoff2) {
|
|
90437
|
+
function printPreviewHandoff(handoff2, warnings = []) {
|
|
90412
90438
|
console.log(`${teal("\u{1F310}")} ${bold("Preview capability:")} ${teal(handoff2.capabilityUrl)}`);
|
|
90439
|
+
for (const warning of warnings)
|
|
90440
|
+
warn(warning);
|
|
90413
90441
|
printPreviewIdentity(handoff2.draftId, handoff2.candidateReleaseId, handoff2.projectRef);
|
|
90414
90442
|
}
|
|
90415
90443
|
function printPreviewIdentity(draftId, candidateReleaseId, projectRef3) {
|
|
@@ -91123,6 +91151,7 @@ async function runHotDeploy(opts) {
|
|
|
91123
91151
|
const spinner = showPublishProgress ? null : ora("Syncing to preview...").start();
|
|
91124
91152
|
let candidateReleaseId = null;
|
|
91125
91153
|
let initialHandoff;
|
|
91154
|
+
let initialWarnings = [];
|
|
91126
91155
|
let initialAutoOpenUrl;
|
|
91127
91156
|
try {
|
|
91128
91157
|
const body = {
|
|
@@ -91159,9 +91188,7 @@ async function runHotDeploy(opts) {
|
|
|
91159
91188
|
success(`Synced ${formatPublishSurface(countPublishSurface({ files, binaryFiles, functions }))} to preview`);
|
|
91160
91189
|
if (expectedPreviewId === null)
|
|
91161
91190
|
say(`Opened preview ${draftId} for this folder; \`${cliInvocation()} preview\` continues it until it is promoted, closed or expires.`);
|
|
91162
|
-
|
|
91163
|
-
for (const w2 of res.warnings)
|
|
91164
|
-
warn(w2);
|
|
91191
|
+
initialWarnings = res.warnings ?? [];
|
|
91165
91192
|
} catch (err) {
|
|
91166
91193
|
spinner?.fail("Initial sync failed");
|
|
91167
91194
|
if (!(isBuildError(err) && renderBuildError(err, cwd))) {
|
|
@@ -91177,14 +91204,14 @@ async function runHotDeploy(opts) {
|
|
|
91177
91204
|
}
|
|
91178
91205
|
if (opts.once) {
|
|
91179
91206
|
console.log("");
|
|
91180
|
-
printPreviewHandoff(initialHandoff);
|
|
91207
|
+
printPreviewHandoff(initialHandoff, initialWarnings);
|
|
91181
91208
|
console.log(dim(" private to you. The preview stays open until you promote it or it expires."));
|
|
91182
91209
|
console.log(dim(` Each link works once; mint another with: ${cliInvocation()} preview link`));
|
|
91183
91210
|
process.exit(0);
|
|
91184
91211
|
}
|
|
91185
91212
|
console.log("");
|
|
91186
91213
|
console.log(`${green("\u{1F440}")} ${bold("Watching")} ${dim(cwd)} ${dim("for changes")}`);
|
|
91187
|
-
printPreviewHandoff(initialHandoff);
|
|
91214
|
+
printPreviewHandoff(initialHandoff, initialWarnings);
|
|
91188
91215
|
console.log(dim(" private to you \u2014 save a file and the preview updates. Not live to users."));
|
|
91189
91216
|
console.log(dim(" Ctrl-C to stop.\n"));
|
|
91190
91217
|
open(initialAutoOpenUrl).catch(() => {
|
|
@@ -91919,7 +91946,7 @@ var init_check = __esm({
|
|
|
91919
91946
|
|
|
91920
91947
|
// dist/commands/api.js
|
|
91921
91948
|
import { createReadStream } from "node:fs";
|
|
91922
|
-
import { stat as
|
|
91949
|
+
import { stat as stat5 } from "node:fs/promises";
|
|
91923
91950
|
import { extname as extname5, resolve as resolve22 } from "node:path";
|
|
91924
91951
|
function registerApi(program2) {
|
|
91925
91952
|
program2.command("api <method> <path>").description("Make a raw API call (adds auth automatically)").option("-d, --data <json>", "JSON body").option("--data-file <path>", "Stream the request body from a file; use - for stdin").option("--content-type <type>", "Content type for --data-file (defaults to JSON for .json/stdin, otherwise octet-stream)").option("--raw", "Print the response body as-is without JSON-parsing \u2014 for non-JSON endpoints (e.g. a SQL db dump); a 200 non-JSON body is not treated as an error").option("--json", "Print parsed JSON (the default; accepted for automation consistency)").action(async (method, path3, opts) => {
|
|
@@ -91972,7 +91999,7 @@ function registerApi(program2) {
|
|
|
91972
91999
|
try {
|
|
91973
92000
|
const stdin = opts.dataFile === "-";
|
|
91974
92001
|
const source = stdin ? void 0 : resolve22(opts.dataFile);
|
|
91975
|
-
const file = source ? await
|
|
92002
|
+
const file = source ? await stat5(source) : void 0;
|
|
91976
92003
|
if (file && !file.isFile())
|
|
91977
92004
|
throw new Error(`${opts.dataFile} is not a file.`);
|
|
91978
92005
|
const headers = {
|
|
@@ -92140,7 +92167,7 @@ var init_api2 = __esm({
|
|
|
92140
92167
|
|
|
92141
92168
|
// dist/commands/fs.js
|
|
92142
92169
|
import { createReadStream as createReadStream2, createWriteStream as createWriteStream3 } from "node:fs";
|
|
92143
|
-
import { stat as
|
|
92170
|
+
import { stat as stat6, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
92144
92171
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
92145
92172
|
import { basename as basename9, dirname as dirname14, extname as extname6, join as join43, resolve as resolve23 } from "node:path";
|
|
92146
92173
|
import { pipeline as pipeline3 } from "node:stream/promises";
|
|
@@ -92152,7 +92179,7 @@ function registerFs(program2) {
|
|
|
92152
92179
|
throw new CliApiError("INVALID_REMOTE_PATH", "Upload destination must name a file and cannot end with `/`.", 0);
|
|
92153
92180
|
}
|
|
92154
92181
|
const source = resolve23(local);
|
|
92155
|
-
const file = await
|
|
92182
|
+
const file = await stat6(source);
|
|
92156
92183
|
if (!file.isFile())
|
|
92157
92184
|
throw new Error(`${local} is not a file.`);
|
|
92158
92185
|
const project = resolveProject(opts.project);
|
|
@@ -109988,7 +110015,7 @@ var require_polyfill = __commonJS({
|
|
|
109988
110015
|
mkdir,
|
|
109989
110016
|
readdir: readdir3,
|
|
109990
110017
|
readlink,
|
|
109991
|
-
stat:
|
|
110018
|
+
stat: stat7,
|
|
109992
110019
|
symlink,
|
|
109993
110020
|
unlink: unlink3,
|
|
109994
110021
|
utimes
|
|
@@ -110085,7 +110112,7 @@ var require_polyfill = __commonJS({
|
|
|
110085
110112
|
}
|
|
110086
110113
|
__name(areIdentical, "areIdentical");
|
|
110087
110114
|
function getStats(src, dest, opts) {
|
|
110088
|
-
const statFunc = opts.dereference ? (file) =>
|
|
110115
|
+
const statFunc = opts.dereference ? (file) => stat7(file, { bigint: true }) : (file) => lstat3(file, { bigint: true });
|
|
110089
110116
|
return Promise.all([
|
|
110090
110117
|
statFunc(src),
|
|
110091
110118
|
statFunc(dest).catch((err) => {
|
|
@@ -110108,7 +110135,7 @@ var require_polyfill = __commonJS({
|
|
|
110108
110135
|
}
|
|
110109
110136
|
__name(checkParentDir, "checkParentDir");
|
|
110110
110137
|
function pathExists(dest) {
|
|
110111
|
-
return
|
|
110138
|
+
return stat7(dest).then(
|
|
110112
110139
|
() => true,
|
|
110113
110140
|
// istanbul ignore next: not sure when this would occur
|
|
110114
110141
|
(err) => err.code === "ENOENT" ? false : Promise.reject(err)
|
|
@@ -110123,7 +110150,7 @@ var require_polyfill = __commonJS({
|
|
|
110123
110150
|
}
|
|
110124
110151
|
let destStat;
|
|
110125
110152
|
try {
|
|
110126
|
-
destStat = await
|
|
110153
|
+
destStat = await stat7(destParent, { bigint: true });
|
|
110127
110154
|
} catch (err) {
|
|
110128
110155
|
if (err.code === "ENOENT") {
|
|
110129
110156
|
return;
|
|
@@ -110163,7 +110190,7 @@ var require_polyfill = __commonJS({
|
|
|
110163
110190
|
}
|
|
110164
110191
|
__name(startCopy, "startCopy");
|
|
110165
110192
|
async function getStatsForCopy(destStat, src, dest, opts) {
|
|
110166
|
-
const statFn = opts.dereference ?
|
|
110193
|
+
const statFn = opts.dereference ? stat7 : lstat3;
|
|
110167
110194
|
const srcStat = await statFn(src);
|
|
110168
110195
|
if (srcStat.isDirectory() && opts.recursive) {
|
|
110169
110196
|
return onDir(srcStat, destStat, src, dest, opts);
|
|
@@ -110256,7 +110283,7 @@ var require_polyfill = __commonJS({
|
|
|
110256
110283
|
}
|
|
110257
110284
|
__name(setDestMode, "setDestMode");
|
|
110258
110285
|
async function setDestTimestamps(src, dest) {
|
|
110259
|
-
const updatedSrcStat = await
|
|
110286
|
+
const updatedSrcStat = await stat7(src);
|
|
110260
110287
|
return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
110261
110288
|
}
|
|
110262
110289
|
__name(setDestTimestamps, "setDestTimestamps");
|
|
@@ -110312,7 +110339,7 @@ var require_polyfill = __commonJS({
|
|
|
110312
110339
|
errno: EINVAL
|
|
110313
110340
|
});
|
|
110314
110341
|
}
|
|
110315
|
-
const srcStat = await
|
|
110342
|
+
const srcStat = await stat7(src);
|
|
110316
110343
|
if (srcStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
110317
110344
|
throw new ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY({
|
|
110318
110345
|
message: `cannot overwrite ${resolvedDest} with ${resolvedSrc}`,
|
|
@@ -110870,7 +110897,7 @@ var require_entry_index = __commonJS({
|
|
|
110870
110897
|
var {
|
|
110871
110898
|
appendFile,
|
|
110872
110899
|
mkdir,
|
|
110873
|
-
readFile:
|
|
110900
|
+
readFile: readFile3,
|
|
110874
110901
|
readdir: readdir3,
|
|
110875
110902
|
rm,
|
|
110876
110903
|
writeFile: writeFile2
|
|
@@ -111062,7 +111089,7 @@ ${hashEntry(stringified)} ${stringified}`);
|
|
|
111062
111089
|
__name(ls2, "ls");
|
|
111063
111090
|
module.exports.bucketEntries = bucketEntries;
|
|
111064
111091
|
async function bucketEntries(bucket, filter) {
|
|
111065
|
-
const data2 = await
|
|
111092
|
+
const data2 = await readFile3(bucket, "utf8");
|
|
111066
111093
|
return _bucketEntries(data2, filter);
|
|
111067
111094
|
}
|
|
111068
111095
|
__name(bucketEntries, "bucketEntries");
|
|
@@ -112242,16 +112269,16 @@ var require_read = __commonJS({
|
|
|
112242
112269
|
var MAX_SINGLE_READ_SIZE = 64 * 1024 * 1024;
|
|
112243
112270
|
async function read(cache, integrity, opts = {}) {
|
|
112244
112271
|
const { size } = opts;
|
|
112245
|
-
const { stat:
|
|
112246
|
-
const
|
|
112247
|
-
return { stat:
|
|
112272
|
+
const { stat: stat7, cpath, sri } = await withContentSri(cache, integrity, async (cpath2, sri2) => {
|
|
112273
|
+
const stat8 = size ? { size } : await fs2.stat(cpath2);
|
|
112274
|
+
return { stat: stat8, cpath: cpath2, sri: sri2 };
|
|
112248
112275
|
});
|
|
112249
|
-
if (
|
|
112250
|
-
return readPipeline(cpath,
|
|
112276
|
+
if (stat7.size > MAX_SINGLE_READ_SIZE) {
|
|
112277
|
+
return readPipeline(cpath, stat7.size, sri, new Pipeline()).concat();
|
|
112251
112278
|
}
|
|
112252
112279
|
const data2 = await fs2.readFile(cpath, { encoding: null });
|
|
112253
|
-
if (
|
|
112254
|
-
throw sizeError(
|
|
112280
|
+
if (stat7.size !== data2.length) {
|
|
112281
|
+
throw sizeError(stat7.size, data2.length);
|
|
112255
112282
|
}
|
|
112256
112283
|
if (!ssri.checkData(data2, sri)) {
|
|
112257
112284
|
throw integrityError(sri, cpath);
|
|
@@ -112278,11 +112305,11 @@ var require_read = __commonJS({
|
|
|
112278
112305
|
const { size } = opts;
|
|
112279
112306
|
const stream = new Pipeline();
|
|
112280
112307
|
Promise.resolve().then(async () => {
|
|
112281
|
-
const { stat:
|
|
112282
|
-
const
|
|
112283
|
-
return { stat:
|
|
112308
|
+
const { stat: stat7, cpath, sri } = await withContentSri(cache, integrity, async (cpath2, sri2) => {
|
|
112309
|
+
const stat8 = size ? { size } : await fs2.stat(cpath2);
|
|
112310
|
+
return { stat: stat8, cpath: cpath2, sri: sri2 };
|
|
112284
112311
|
});
|
|
112285
|
-
return readPipeline(cpath,
|
|
112312
|
+
return readPipeline(cpath, stat7.size, sri, stream);
|
|
112286
112313
|
}).catch((err) => stream.emit("error", err));
|
|
112287
112314
|
return stream;
|
|
112288
112315
|
}
|
|
@@ -112301,8 +112328,8 @@ var require_read = __commonJS({
|
|
|
112301
112328
|
}
|
|
112302
112329
|
try {
|
|
112303
112330
|
return await withContentSri(cache, integrity, async (cpath, sri) => {
|
|
112304
|
-
const
|
|
112305
|
-
return { size:
|
|
112331
|
+
const stat7 = await fs2.stat(cpath);
|
|
112332
|
+
return { size: stat7.size, sri, stat: stat7 };
|
|
112306
112333
|
});
|
|
112307
112334
|
} catch (err) {
|
|
112308
112335
|
if (err.code === "ENOENT") {
|
|
@@ -115989,9 +116016,9 @@ var require_verify = __commonJS({
|
|
|
115989
116016
|
"use strict";
|
|
115990
116017
|
var {
|
|
115991
116018
|
mkdir,
|
|
115992
|
-
readFile:
|
|
116019
|
+
readFile: readFile3,
|
|
115993
116020
|
rm,
|
|
115994
|
-
stat:
|
|
116021
|
+
stat: stat7,
|
|
115995
116022
|
truncate: truncate2,
|
|
115996
116023
|
writeFile: writeFile2
|
|
115997
116024
|
} = __require("fs/promises");
|
|
@@ -116111,7 +116138,7 @@ var require_verify = __commonJS({
|
|
|
116111
116138
|
}
|
|
116112
116139
|
} else {
|
|
116113
116140
|
stats.reclaimedCount++;
|
|
116114
|
-
const s3 = await
|
|
116141
|
+
const s3 = await stat7(f2);
|
|
116115
116142
|
await rm(f2, { recursive: true, force: true });
|
|
116116
116143
|
stats.reclaimedSize += s3.size;
|
|
116117
116144
|
}
|
|
@@ -116125,7 +116152,7 @@ var require_verify = __commonJS({
|
|
|
116125
116152
|
async function verifyContent(filepath, sri) {
|
|
116126
116153
|
const contentInfo = {};
|
|
116127
116154
|
try {
|
|
116128
|
-
const { size } = await
|
|
116155
|
+
const { size } = await stat7(filepath);
|
|
116129
116156
|
contentInfo.size = size;
|
|
116130
116157
|
contentInfo.valid = true;
|
|
116131
116158
|
await ssri.checkStream(new fsm.ReadStream(filepath), sri);
|
|
@@ -116185,7 +116212,7 @@ var require_verify = __commonJS({
|
|
|
116185
116212
|
for (const entry of bucket) {
|
|
116186
116213
|
const content = contentPath(cache, entry.integrity);
|
|
116187
116214
|
try {
|
|
116188
|
-
await
|
|
116215
|
+
await stat7(content);
|
|
116189
116216
|
await index.insert(cache, entry.key, entry.integrity, {
|
|
116190
116217
|
metadata: entry.metadata,
|
|
116191
116218
|
size: entry.size,
|
|
@@ -116216,7 +116243,7 @@ var require_verify = __commonJS({
|
|
|
116216
116243
|
__name(writeVerifile, "writeVerifile");
|
|
116217
116244
|
module.exports.lastRun = lastRun;
|
|
116218
116245
|
async function lastRun(cache) {
|
|
116219
|
-
const data2 = await
|
|
116246
|
+
const data2 = await readFile3(path3.join(cache, "_lastverified"), { encoding: "utf8" });
|
|
116220
116247
|
return /* @__PURE__ */ new Date(+data2);
|
|
116221
116248
|
}
|
|
116222
116249
|
__name(lastRun, "lastRun");
|
|
@@ -132706,12 +132733,12 @@ async function runPinnedNpm(args, cwd, ambientEnvironment, userConfigPath, globa
|
|
|
132706
132733
|
function snapshotAuthenticatedArtifact(tarballPath) {
|
|
132707
132734
|
const fd = openSync5(tarballPath, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0));
|
|
132708
132735
|
try {
|
|
132709
|
-
const
|
|
132710
|
-
if (!
|
|
132736
|
+
const stat7 = fstatSync(fd);
|
|
132737
|
+
if (!stat7.isFile() || stat7.size <= 0 || stat7.size > MAX_UPDATE_BYTES) {
|
|
132711
132738
|
throw new Error("the downloaded update artifact is not a usable regular file");
|
|
132712
132739
|
}
|
|
132713
132740
|
unlinkSync5(tarballPath);
|
|
132714
|
-
return readOpenArtifact(fd,
|
|
132741
|
+
return readOpenArtifact(fd, stat7.size);
|
|
132715
132742
|
} finally {
|
|
132716
132743
|
closeSync5(fd);
|
|
132717
132744
|
}
|