@somewhere-cloud/cli 0.38.164 → 0.38.165
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 +6 -0
- package/dist/lib/bundle.js +335 -186
- package/dist/lib/bundle.js.map +2 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/runtime/DECLARED-DATA-VENDOR.json +5 -5
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/SOURCE-LINT-VENDOR.json +2 -2
- package/runtime/declared-data.cjs +4 -2
- package/runtime/source-lint.cjs +2 -2
package/dist/lib/bundle.js
CHANGED
|
@@ -12184,7 +12184,7 @@ var require_client_h2 = __commonJS({
|
|
|
12184
12184
|
"node_modules/undici/lib/dispatcher/client-h2.js"(exports, module) {
|
|
12185
12185
|
"use strict";
|
|
12186
12186
|
var assert2 = __require("node:assert");
|
|
12187
|
-
var { pipeline:
|
|
12187
|
+
var { pipeline: pipeline5 } = __require("node:stream");
|
|
12188
12188
|
var util = require_util();
|
|
12189
12189
|
var {
|
|
12190
12190
|
RequestContentLengthMismatchError,
|
|
@@ -13553,7 +13553,7 @@ var require_client_h2 = __commonJS({
|
|
|
13553
13553
|
__name(writeBuffer, "writeBuffer");
|
|
13554
13554
|
function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) {
|
|
13555
13555
|
assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
|
13556
|
-
const pipe2 =
|
|
13556
|
+
const pipe2 = pipeline5(
|
|
13557
13557
|
body,
|
|
13558
13558
|
h2stream,
|
|
13559
13559
|
(err) => {
|
|
@@ -17413,7 +17413,7 @@ var require_readable = __commonJS({
|
|
|
17413
17413
|
"use strict";
|
|
17414
17414
|
var assert2 = __require("node:assert");
|
|
17415
17415
|
var { addAbortListener } = __require("node:events");
|
|
17416
|
-
var { Readable:
|
|
17416
|
+
var { Readable: Readable4 } = __require("node:stream");
|
|
17417
17417
|
var { RequestAbortedError, NotSupportedError, InvalidArgumentError: InvalidArgumentError2, AbortError } = require_errors();
|
|
17418
17418
|
var util = require_util();
|
|
17419
17419
|
var kConsume = Symbol("kConsume");
|
|
@@ -17426,7 +17426,7 @@ var require_readable = __commonJS({
|
|
|
17426
17426
|
var kBytesRead = Symbol("kBytesRead");
|
|
17427
17427
|
var noop2 = /* @__PURE__ */ __name(() => {
|
|
17428
17428
|
}, "noop");
|
|
17429
|
-
var BodyReadable = class extends
|
|
17429
|
+
var BodyReadable = class extends Readable4 {
|
|
17430
17430
|
static {
|
|
17431
17431
|
__name(this, "BodyReadable");
|
|
17432
17432
|
}
|
|
@@ -17925,7 +17925,7 @@ var require_api_request = __commonJS({
|
|
|
17925
17925
|
"use strict";
|
|
17926
17926
|
var assert2 = __require("node:assert");
|
|
17927
17927
|
var { AsyncResource } = __require("node:async_hooks");
|
|
17928
|
-
var { Readable:
|
|
17928
|
+
var { Readable: Readable4 } = require_readable();
|
|
17929
17929
|
var { InvalidArgumentError: InvalidArgumentError2, RequestAbortedError } = require_errors();
|
|
17930
17930
|
var util = require_util();
|
|
17931
17931
|
var { dispatchWithSignal } = require_abort_signal();
|
|
@@ -18017,7 +18017,7 @@ var require_api_request = __commonJS({
|
|
|
18017
18017
|
const parsedHeaders = headers;
|
|
18018
18018
|
const contentType2 = parsedHeaders?.["content-type"];
|
|
18019
18019
|
const contentLength = parsedHeaders?.["content-length"];
|
|
18020
|
-
const res = new
|
|
18020
|
+
const res = new Readable4({
|
|
18021
18021
|
resume: /* @__PURE__ */ __name(() => controller.resume(), "resume"),
|
|
18022
18022
|
abort: /* @__PURE__ */ __name((reason) => controller.abort(reason), "abort"),
|
|
18023
18023
|
contentType: contentType2,
|
|
@@ -18358,7 +18358,7 @@ var require_api_pipeline = __commonJS({
|
|
|
18358
18358
|
"node_modules/undici/lib/api/api-pipeline.js"(exports, module) {
|
|
18359
18359
|
"use strict";
|
|
18360
18360
|
var {
|
|
18361
|
-
Readable:
|
|
18361
|
+
Readable: Readable4,
|
|
18362
18362
|
Duplex,
|
|
18363
18363
|
PassThrough
|
|
18364
18364
|
} = __require("node:stream");
|
|
@@ -18376,7 +18376,7 @@ var require_api_pipeline = __commonJS({
|
|
|
18376
18376
|
}
|
|
18377
18377
|
__name(noop2, "noop");
|
|
18378
18378
|
var kResume = Symbol("resume");
|
|
18379
|
-
var PipelineRequest = class extends
|
|
18379
|
+
var PipelineRequest = class extends Readable4 {
|
|
18380
18380
|
static {
|
|
18381
18381
|
__name(this, "PipelineRequest");
|
|
18382
18382
|
}
|
|
@@ -18397,7 +18397,7 @@ var require_api_pipeline = __commonJS({
|
|
|
18397
18397
|
callback(err);
|
|
18398
18398
|
}
|
|
18399
18399
|
};
|
|
18400
|
-
var PipelineResponse = class extends
|
|
18400
|
+
var PipelineResponse = class extends Readable4 {
|
|
18401
18401
|
static {
|
|
18402
18402
|
__name(this, "PipelineResponse");
|
|
18403
18403
|
}
|
|
@@ -18557,7 +18557,7 @@ var require_api_pipeline = __commonJS({
|
|
|
18557
18557
|
util.destroy(ret, err);
|
|
18558
18558
|
}
|
|
18559
18559
|
};
|
|
18560
|
-
function
|
|
18560
|
+
function pipeline5(opts, handler) {
|
|
18561
18561
|
try {
|
|
18562
18562
|
const pipelineHandler = new PipelineHandler(opts, handler);
|
|
18563
18563
|
const pipelineOpts = { ...opts, body: pipelineHandler.req };
|
|
@@ -18571,8 +18571,8 @@ var require_api_pipeline = __commonJS({
|
|
|
18571
18571
|
return new PassThrough().destroy(err);
|
|
18572
18572
|
}
|
|
18573
18573
|
}
|
|
18574
|
-
__name(
|
|
18575
|
-
module.exports =
|
|
18574
|
+
__name(pipeline5, "pipeline");
|
|
18575
|
+
module.exports = pipeline5;
|
|
18576
18576
|
}
|
|
18577
18577
|
});
|
|
18578
18578
|
|
|
@@ -20315,7 +20315,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
20315
20315
|
"node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
20316
20316
|
"use strict";
|
|
20317
20317
|
var { writeFile: writeFile2, readFile: readFile2, mkdir } = __require("node:fs/promises");
|
|
20318
|
-
var { dirname:
|
|
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();
|
|
20321
20321
|
var { setHeader } = require_util();
|
|
@@ -20571,7 +20571,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
20571
20571
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
20572
20572
|
}
|
|
20573
20573
|
const resolvedPath = resolve27(path3);
|
|
20574
|
-
await mkdir(
|
|
20574
|
+
await mkdir(dirname17(resolvedPath), { recursive: true });
|
|
20575
20575
|
const data2 = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
20576
20576
|
hash,
|
|
20577
20577
|
snapshot
|
|
@@ -24300,7 +24300,7 @@ var require_cache2 = __commonJS({
|
|
|
24300
24300
|
"node_modules/undici/lib/interceptor/cache.js"(exports, module) {
|
|
24301
24301
|
"use strict";
|
|
24302
24302
|
var assert2 = __require("node:assert");
|
|
24303
|
-
var { Readable:
|
|
24303
|
+
var { Readable: Readable4 } = __require("node:stream");
|
|
24304
24304
|
var util = require_util();
|
|
24305
24305
|
var CacheHandler = require_cache_handler();
|
|
24306
24306
|
var MemoryCacheStore = require_memory_cache_store();
|
|
@@ -24544,7 +24544,7 @@ var require_cache2 = __commonJS({
|
|
|
24544
24544
|
}
|
|
24545
24545
|
__name(handleUncachedResponse, "handleUncachedResponse");
|
|
24546
24546
|
function sendCachedValue(handler, opts, result, age, context, isStale2) {
|
|
24547
|
-
const stream = util.isStream(result.body) ? result.body :
|
|
24547
|
+
const stream = util.isStream(result.body) ? result.body : Readable4.from(result.body ?? []);
|
|
24548
24548
|
assert2(!stream.destroyed, "stream should not be destroyed");
|
|
24549
24549
|
assert2(!stream.readableDidRead, "stream should not be readableDidRead");
|
|
24550
24550
|
let aborted2 = false;
|
|
@@ -24854,7 +24854,7 @@ var require_decompress = __commonJS({
|
|
|
24854
24854
|
"node_modules/undici/lib/interceptor/decompress.js"(exports, module) {
|
|
24855
24855
|
"use strict";
|
|
24856
24856
|
var { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress, constants: constants3 } = __require("node:zlib");
|
|
24857
|
-
var { pipeline:
|
|
24857
|
+
var { pipeline: pipeline5, Transform: TransformStream2 } = __require("node:stream");
|
|
24858
24858
|
var { InvalidArgumentError: InvalidArgumentError2, ResponseExceededMaxSizeError } = require_errors();
|
|
24859
24859
|
var DecoratorHandler = require_decorator_handler();
|
|
24860
24860
|
var DecompressController = class {
|
|
@@ -25173,7 +25173,7 @@ var require_decompress = __commonJS({
|
|
|
25173
25173
|
#setupMultipleDecompressors() {
|
|
25174
25174
|
const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
|
|
25175
25175
|
this.#setupDecompressorEvents(lastDecompressor);
|
|
25176
|
-
|
|
25176
|
+
pipeline5(this.#decompressors, (err) => {
|
|
25177
25177
|
if (this.#terminated) {
|
|
25178
25178
|
return;
|
|
25179
25179
|
}
|
|
@@ -28118,7 +28118,7 @@ var require_fetch = __commonJS({
|
|
|
28118
28118
|
subresourceSet
|
|
28119
28119
|
} = require_constants2();
|
|
28120
28120
|
var EE = __require("node:events");
|
|
28121
|
-
var { Readable:
|
|
28121
|
+
var { Readable: Readable4, pipeline: pipeline5, finished, isErrored, isReadable } = __require("node:stream");
|
|
28122
28122
|
var { addAbortListener, bufferToLowerCasedHeaderName } = require_util();
|
|
28123
28123
|
var { SocketError, InformationalError } = require_errors();
|
|
28124
28124
|
var { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require_data_url();
|
|
@@ -29159,13 +29159,13 @@ var require_fetch = __commonJS({
|
|
|
29159
29159
|
}
|
|
29160
29160
|
}
|
|
29161
29161
|
this.nullBodyStatus = nullBodyStatus.includes(status);
|
|
29162
|
-
this.body = new
|
|
29162
|
+
this.body = new Readable4({ read: /* @__PURE__ */ __name(() => controller.resume(), "read") });
|
|
29163
29163
|
const onError = /* @__PURE__ */ __name((err) => this.onResponseError(controller, err), "onError");
|
|
29164
29164
|
resolve27({
|
|
29165
29165
|
status,
|
|
29166
29166
|
statusText,
|
|
29167
29167
|
headersList,
|
|
29168
|
-
body: decoders.length ?
|
|
29168
|
+
body: decoders.length ? pipeline5(this.body, ...decoders, (err) => {
|
|
29169
29169
|
if (err) {
|
|
29170
29170
|
this.onResponseError(controller, err);
|
|
29171
29171
|
}
|
|
@@ -33230,7 +33230,7 @@ ${value}`;
|
|
|
33230
33230
|
var require_eventsource = __commonJS({
|
|
33231
33231
|
"node_modules/undici/lib/web/eventsource/eventsource.js"(exports, module) {
|
|
33232
33232
|
"use strict";
|
|
33233
|
-
var { pipeline:
|
|
33233
|
+
var { pipeline: pipeline5 } = __require("node:stream");
|
|
33234
33234
|
var { fetching } = require_fetch();
|
|
33235
33235
|
var { webidl } = require_webidl();
|
|
33236
33236
|
var { EventSourceStream } = require_eventsource_stream();
|
|
@@ -33394,7 +33394,7 @@ var require_eventsource = __commonJS({
|
|
|
33394
33394
|
));
|
|
33395
33395
|
}, "push")
|
|
33396
33396
|
});
|
|
33397
|
-
|
|
33397
|
+
pipeline5(
|
|
33398
33398
|
response.body.stream,
|
|
33399
33399
|
eventSourceStream,
|
|
33400
33400
|
(error3) => {
|
|
@@ -75190,10 +75190,10 @@ var init_esm3 = __esm({
|
|
|
75190
75190
|
}
|
|
75191
75191
|
async _formatEntry(dirent, path3) {
|
|
75192
75192
|
let entry;
|
|
75193
|
-
const
|
|
75193
|
+
const basename12 = this._isDirent ? dirent.name : dirent;
|
|
75194
75194
|
try {
|
|
75195
|
-
const fullPath = presolve(pjoin(path3,
|
|
75196
|
-
entry = { path: prelative(this._root, fullPath), fullPath, basename:
|
|
75195
|
+
const fullPath = presolve(pjoin(path3, basename12));
|
|
75196
|
+
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename12 };
|
|
75197
75197
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
75198
75198
|
} catch (err) {
|
|
75199
75199
|
this._onError(err);
|
|
@@ -75726,9 +75726,9 @@ var init_handler = __esm({
|
|
|
75726
75726
|
_watchWithNodeFs(path3, listener) {
|
|
75727
75727
|
const opts = this.fsw.options;
|
|
75728
75728
|
const directory2 = sysPath.dirname(path3);
|
|
75729
|
-
const
|
|
75729
|
+
const basename12 = sysPath.basename(path3);
|
|
75730
75730
|
const parent = this.fsw._getWatchedDir(directory2);
|
|
75731
|
-
parent.add(
|
|
75731
|
+
parent.add(basename12);
|
|
75732
75732
|
const absolutePath = sysPath.resolve(path3);
|
|
75733
75733
|
const options2 = {
|
|
75734
75734
|
persistent: opts.persistent
|
|
@@ -75738,7 +75738,7 @@ var init_handler = __esm({
|
|
|
75738
75738
|
let closer;
|
|
75739
75739
|
if (opts.usePolling) {
|
|
75740
75740
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
75741
|
-
options2.interval = enableBin && isBinaryPath(
|
|
75741
|
+
options2.interval = enableBin && isBinaryPath(basename12) ? opts.binaryInterval : opts.interval;
|
|
75742
75742
|
closer = setFsWatchFileListener(path3, absolutePath, options2, {
|
|
75743
75743
|
listener,
|
|
75744
75744
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -75760,11 +75760,11 @@ var init_handler = __esm({
|
|
|
75760
75760
|
if (this.fsw.closed) {
|
|
75761
75761
|
return;
|
|
75762
75762
|
}
|
|
75763
|
-
const
|
|
75764
|
-
const
|
|
75765
|
-
const parent = this.fsw._getWatchedDir(
|
|
75763
|
+
const dirname17 = sysPath.dirname(file);
|
|
75764
|
+
const basename12 = sysPath.basename(file);
|
|
75765
|
+
const parent = this.fsw._getWatchedDir(dirname17);
|
|
75766
75766
|
let prevStats = stats;
|
|
75767
|
-
if (parent.has(
|
|
75767
|
+
if (parent.has(basename12))
|
|
75768
75768
|
return;
|
|
75769
75769
|
const listener = /* @__PURE__ */ __name(async (path3, newStats) => {
|
|
75770
75770
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
|
@@ -75789,9 +75789,9 @@ var init_handler = __esm({
|
|
|
75789
75789
|
prevStats = newStats2;
|
|
75790
75790
|
}
|
|
75791
75791
|
} catch (error3) {
|
|
75792
|
-
this.fsw._remove(
|
|
75792
|
+
this.fsw._remove(dirname17, basename12);
|
|
75793
75793
|
}
|
|
75794
|
-
} else if (parent.has(
|
|
75794
|
+
} else if (parent.has(basename12)) {
|
|
75795
75795
|
const at2 = newStats.atimeMs;
|
|
75796
75796
|
const mt2 = newStats.mtimeMs;
|
|
75797
75797
|
if (!at2 || at2 <= mt2 || mt2 !== prevStats.mtimeMs) {
|
|
@@ -84351,16 +84351,16 @@ function formatLinkedProjectMismatchExplanation(linkedProjectId, ref, resolvedPr
|
|
|
84351
84351
|
"Next steps:",
|
|
84352
84352
|
` Deploy this folder to its linked project: run \`${cliInvocation()} deploy\` (no --project).`,
|
|
84353
84353
|
` Work on ${ref}: run \`${cliInvocation()} pull ${shellQuote(ref)} --out <fresh-folder>\`, re-apply your changes there, then run \`${cliInvocation()} deploy\`.`,
|
|
84354
|
-
`
|
|
84354
|
+
` Replace ${ref} with these files on purpose: copy them into an unlinked folder and run \`${cliInvocation()} deploy --project ${ref} --force --yes\` there.`
|
|
84355
84355
|
].join("\n");
|
|
84356
84356
|
}
|
|
84357
84357
|
function formatExplicitProjectBaseRequiredExplanation(ref) {
|
|
84358
84358
|
return [
|
|
84359
|
-
`
|
|
84359
|
+
`Project ${ref} is already live, and this folder has no record of deploying or pulling it, so the deploy was NOT applied. The live app is unchanged.`,
|
|
84360
84360
|
"",
|
|
84361
84361
|
"Next steps:",
|
|
84362
|
-
`
|
|
84363
|
-
`
|
|
84362
|
+
` To change the live app, start from its current files: \`${cliInvocation()} pull ${shellQuote(ref)} --out <fresh-folder>\`, re-apply your changes there, then run \`${cliInvocation()} deploy\`.`,
|
|
84363
|
+
` To replace the live app with this folder's files on purpose: \`${cliInvocation()} deploy --project ${ref} --force --yes\`.`
|
|
84364
84364
|
].join("\n");
|
|
84365
84365
|
}
|
|
84366
84366
|
function startDeployPrestart(client, projectId) {
|
|
@@ -84868,8 +84868,10 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
|
|
|
84868
84868
|
// Sending the on-disk static under scope:functions is what bricked
|
|
84869
84869
|
// compiled SPAs; the worker now ignores it too, but
|
|
84870
84870
|
// the CLI shouldn't send it in the first place. --scope static is the
|
|
84871
|
-
// inverse: no functions.
|
|
84872
|
-
|
|
84871
|
+
// inverse: no functions. The dependency manifest is the functions'
|
|
84872
|
+
// too: a backend change that adds a package sends package.json (and
|
|
84873
|
+
// its lockfile), so the platform builds against the new dependencies.
|
|
84874
|
+
files: scope === "functions" ? functionDependencyManifest(files) : files
|
|
84873
84875
|
};
|
|
84874
84876
|
if (scope !== "functions" && Object.keys(binaryFiles).length > 0) {
|
|
84875
84877
|
body.binary_files = binaryFiles;
|
|
@@ -84897,8 +84899,8 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
|
|
|
84897
84899
|
body.base_release_id = sourceBase.releaseId;
|
|
84898
84900
|
} else if (!opts.force && explicitProjectId) {
|
|
84899
84901
|
const liveBase = earlyLiveBase?.projectId === explicitProjectId ? await earlyLiveBase.read : await readExplicitProjectLiveBase(client, explicitProjectId);
|
|
84900
|
-
if (liveBase
|
|
84901
|
-
body.base_release_id =
|
|
84902
|
+
if (liveBase === null)
|
|
84903
|
+
body.base_release_id = null;
|
|
84902
84904
|
}
|
|
84903
84905
|
body.source = "cli";
|
|
84904
84906
|
if (opts.force)
|
|
@@ -85579,6 +85581,9 @@ function formatDryRunNeedsProjectExplanation() {
|
|
|
85579
85581
|
`To deploy for real (signed out, this starts a temporary workspace): \`${cliInvocation()} deploy\`.`
|
|
85580
85582
|
].join("\n");
|
|
85581
85583
|
}
|
|
85584
|
+
function functionDependencyManifest(files) {
|
|
85585
|
+
return Object.fromEntries(["package.json", "package-lock.json", "npm-shrinkwrap.json"].filter((path3) => typeof files[path3] === "string").map((path3) => [path3, files[path3]]));
|
|
85586
|
+
}
|
|
85582
85587
|
function printDryRun(plan, scope) {
|
|
85583
85588
|
const scopeNote = scope === "functions" ? " (scope: functions \u2014 static unchanged)" : scope === "static" ? " (scope: static \u2014 functions unchanged)" : "";
|
|
85584
85589
|
console.log(`
|
|
@@ -85754,6 +85759,7 @@ var init_deploy = __esm({
|
|
|
85754
85759
|
__name(printLocalOmissionsToStderr, "printLocalOmissionsToStderr");
|
|
85755
85760
|
__name(printSensitiveFiles, "printSensitiveFiles");
|
|
85756
85761
|
__name(formatDryRunNeedsProjectExplanation, "formatDryRunNeedsProjectExplanation");
|
|
85762
|
+
__name(functionDependencyManifest, "functionDependencyManifest");
|
|
85757
85763
|
__name(printDryRun, "printDryRun");
|
|
85758
85764
|
}
|
|
85759
85765
|
});
|
|
@@ -86861,7 +86867,62 @@ var init_db_rows = __esm({
|
|
|
86861
86867
|
});
|
|
86862
86868
|
|
|
86863
86869
|
// dist/commands/db.js
|
|
86864
|
-
import { writeFileSync as writeFileSync20 } from "node:fs";
|
|
86870
|
+
import { createWriteStream as createWriteStream2, writeFileSync as writeFileSync20 } from "node:fs";
|
|
86871
|
+
import { rename, unlink } from "node:fs/promises";
|
|
86872
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
86873
|
+
import { basename as basename7, dirname as dirname13, join as join36 } from "node:path";
|
|
86874
|
+
import { Readable as Readable2 } from "node:stream";
|
|
86875
|
+
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
86876
|
+
async function backgroundExport(client, projectId, plane, output, json, spinner) {
|
|
86877
|
+
if (json && !output)
|
|
86878
|
+
throw new Error("This database is exported in the background as a file: pass --output <file> with --json.");
|
|
86879
|
+
const wanted = plane ?? "raw";
|
|
86880
|
+
if (spinner)
|
|
86881
|
+
spinner.text = "The database is larger than one dump response; exporting it in the background\u2026";
|
|
86882
|
+
let current;
|
|
86883
|
+
try {
|
|
86884
|
+
current = (await client.call("POST", "/db/exports", { project_id: projectId, ...plane ? { plane } : {} })).export;
|
|
86885
|
+
} catch (err) {
|
|
86886
|
+
if (err instanceof CliApiError && err.statusCode === 404 && err.code === "NOT_FOUND")
|
|
86887
|
+
return false;
|
|
86888
|
+
throw err;
|
|
86889
|
+
}
|
|
86890
|
+
while (current.state === "running") {
|
|
86891
|
+
await new Promise((resolve27) => setTimeout(resolve27, 3e3));
|
|
86892
|
+
current = (await client.call("GET", `/db/exports/${encodeURIComponent(current.id)}`, void 0, { project_id: projectId })).export;
|
|
86893
|
+
if (spinner)
|
|
86894
|
+
spinner.text = `Exporting in the background: ${current.rows.toLocaleString()} rows, ${sizeText(current.size_bytes)} so far\u2026`;
|
|
86895
|
+
}
|
|
86896
|
+
if (current.state !== "ready")
|
|
86897
|
+
throw new Error(current.detail ?? `The export ended ${current.state}.`);
|
|
86898
|
+
if ((current.plane ?? "raw") !== wanted)
|
|
86899
|
+
throw new Error(`The platform returned an export of the ${current.plane} tables, not the ${wanted} ones. Nothing was written.`);
|
|
86900
|
+
const response = await client.callStream("GET", `/db/exports/${encodeURIComponent(current.id)}/sql?project_id=${encodeURIComponent(projectId)}`, void 0, { timeoutMs: 4 * 60 * 6e4 });
|
|
86901
|
+
if (!response.ok || !response.body)
|
|
86902
|
+
throw new Error(`Downloading the export failed (HTTP ${response.status}).`);
|
|
86903
|
+
const body = Readable2.fromWeb(response.body);
|
|
86904
|
+
if (output) {
|
|
86905
|
+
const temp = join36(dirname13(output), `.${basename7(output)}.${randomUUID7()}.tmp`);
|
|
86906
|
+
try {
|
|
86907
|
+
await pipeline2(body, createWriteStream2(temp, { flags: "wx", mode: 384 }));
|
|
86908
|
+
await rename(temp, output);
|
|
86909
|
+
} catch (err) {
|
|
86910
|
+
await unlink(temp).catch(() => void 0);
|
|
86911
|
+
throw err;
|
|
86912
|
+
}
|
|
86913
|
+
} else {
|
|
86914
|
+
spinner?.stop();
|
|
86915
|
+
await pipeline2(body, process.stdout, { end: false });
|
|
86916
|
+
}
|
|
86917
|
+
const summary = `${current.tables} tables, ${current.rows} rows, ${sizeText(current.size_bytes)}${current.consistency ? `. ${current.consistency}` : ""}`;
|
|
86918
|
+
if (json)
|
|
86919
|
+
printJson({ export: current, output });
|
|
86920
|
+
else if (output)
|
|
86921
|
+
spinner?.succeed(`Wrote ${output} (${summary})`);
|
|
86922
|
+
else
|
|
86923
|
+
process.stderr.write(dim(summary) + "\n");
|
|
86924
|
+
return true;
|
|
86925
|
+
}
|
|
86865
86926
|
function registerDb(program2) {
|
|
86866
86927
|
const db = program2.command("db").description("Inspect managed production rows or run SQL against your raw database");
|
|
86867
86928
|
registerDbRows(db);
|
|
@@ -86952,6 +87013,16 @@ function registerDb(program2) {
|
|
|
86952
87013
|
...opts.plane ? { plane: opts.plane } : {}
|
|
86953
87014
|
});
|
|
86954
87015
|
if (!res.ok) {
|
|
87016
|
+
let refused = null;
|
|
87017
|
+
try {
|
|
87018
|
+
refused = JSON.parse(res.body);
|
|
87019
|
+
} catch {
|
|
87020
|
+
refused = null;
|
|
87021
|
+
}
|
|
87022
|
+
if (res.status === 413 && refused?.data?.background_export === true && !opts.manifest && ["DUMP_SIZE_LIMIT_EXCEEDED", "DUMP_ROW_LIMIT_EXCEEDED", "EXPORT_SIZE_LIMIT_EXCEEDED", "EXPORT_ROW_LIMIT_EXCEEDED"].includes(refused.error ?? "")) {
|
|
87023
|
+
if (await backgroundExport(client, projectId, opts.plane, opts.output, Boolean(opts.json), spinner))
|
|
87024
|
+
return;
|
|
87025
|
+
}
|
|
86955
87026
|
spinner?.fail("Dump failed");
|
|
86956
87027
|
try {
|
|
86957
87028
|
const json = JSON.parse(res.body);
|
|
@@ -86973,7 +87044,7 @@ function registerDb(program2) {
|
|
|
86973
87044
|
process.exit(1);
|
|
86974
87045
|
}
|
|
86975
87046
|
if (opts.output)
|
|
86976
|
-
writeFileSync20(opts.output, res.body);
|
|
87047
|
+
writeFileSync20(opts.output, res.body, { mode: 384 });
|
|
86977
87048
|
else
|
|
86978
87049
|
process.stdout.write(res.body + "\n");
|
|
86979
87050
|
return;
|
|
@@ -86994,7 +87065,7 @@ function registerDb(program2) {
|
|
|
86994
87065
|
truncated_tables: truncated ?? null
|
|
86995
87066
|
};
|
|
86996
87067
|
if (opts.output) {
|
|
86997
|
-
writeFileSync20(opts.output, sql);
|
|
87068
|
+
writeFileSync20(opts.output, sql, { mode: 384 });
|
|
86998
87069
|
if (opts.json) {
|
|
86999
87070
|
printJson(dumpResult);
|
|
87000
87071
|
} else {
|
|
@@ -87018,6 +87089,81 @@ function registerDb(program2) {
|
|
|
87018
87089
|
process.exit(1);
|
|
87019
87090
|
}
|
|
87020
87091
|
});
|
|
87092
|
+
db.command("restore-points").description("List the restore points the platform keeps: full copies of the database taken before each deploy that changes its shape, daily when the data changed, and by hand (project owner only)").option("--project <id>", "Project ID (defaults to .somewhere.json)").option("--take", "Take a restore point now").option("--delete <id>", "Delete one restore point now").option("--json", "Print the API response as JSON").action(async (opts) => {
|
|
87093
|
+
if (opts.take && opts.delete) {
|
|
87094
|
+
error("Use --take or --delete, not both.");
|
|
87095
|
+
process.exit(1);
|
|
87096
|
+
}
|
|
87097
|
+
let projectId = opts.project;
|
|
87098
|
+
if (!projectId) {
|
|
87099
|
+
const config2 = loadProjectConfig();
|
|
87100
|
+
if (!config2) {
|
|
87101
|
+
error("No project specified and no .somewhere.json found. Pass --project <id>." + unlinkedFolderHint());
|
|
87102
|
+
process.exit(1);
|
|
87103
|
+
}
|
|
87104
|
+
projectId = config2.project_id;
|
|
87105
|
+
}
|
|
87106
|
+
const size = /* @__PURE__ */ __name((n) => n >= 1e6 ? `${(n / 1e6).toFixed(1)} MB` : `${Math.max(1, Math.round(n / 1e3))} KB`, "size");
|
|
87107
|
+
const client = new ApiClient(getToken());
|
|
87108
|
+
try {
|
|
87109
|
+
if (opts.take) {
|
|
87110
|
+
const spinner = opts.json ? null : ora("Taking a restore point\u2026").start();
|
|
87111
|
+
let point = (await client.call("POST", "/db/restore-points", { project_id: projectId })).restore_point;
|
|
87112
|
+
for (let waited = 0; point.state === "running" && waited < 30 * 6e4; waited += 3e3) {
|
|
87113
|
+
await new Promise((resolve27) => setTimeout(resolve27, 3e3));
|
|
87114
|
+
const listed = await client.call("GET", "/db/restore-points", void 0, { project_id: projectId });
|
|
87115
|
+
point = listed.restore_points.find((p2) => p2.id === point.id) ?? { ...point, state: "failed", detail: "It is no longer listed." };
|
|
87116
|
+
if (spinner)
|
|
87117
|
+
spinner.text = `Taking a restore point\u2026 ${point.rows.toLocaleString()} rows so far`;
|
|
87118
|
+
}
|
|
87119
|
+
if (opts.json) {
|
|
87120
|
+
printJson({ restore_point: point });
|
|
87121
|
+
if (point.state !== "ready")
|
|
87122
|
+
process.exitCode = 1;
|
|
87123
|
+
return;
|
|
87124
|
+
}
|
|
87125
|
+
if (point.state === "running") {
|
|
87126
|
+
spinner?.succeed(`Restore point ${point.id} is still being taken; \`${cliInvocation()} db restore-points\` shows when it is ready.`);
|
|
87127
|
+
return;
|
|
87128
|
+
}
|
|
87129
|
+
if (point.state !== "ready") {
|
|
87130
|
+
spinner?.fail(`No restore point was taken: ${point.detail ?? point.state}`);
|
|
87131
|
+
process.exitCode = 1;
|
|
87132
|
+
return;
|
|
87133
|
+
}
|
|
87134
|
+
spinner?.succeed(`Restore point ${point.id} taken (${size(point.size_bytes)}, ${point.tables} tables, ${point.rows} rows); kept until ${point.expires_at}.`);
|
|
87135
|
+
for (const line of [point.consistency, point.validation])
|
|
87136
|
+
if (line)
|
|
87137
|
+
info(dim(line));
|
|
87138
|
+
return;
|
|
87139
|
+
}
|
|
87140
|
+
if (opts.delete) {
|
|
87141
|
+
const r2 = await client.call("DELETE", `/db/restore-points/${encodeURIComponent(opts.delete)}`, void 0, { project_id: projectId });
|
|
87142
|
+
if (opts.json) {
|
|
87143
|
+
printJson(r2);
|
|
87144
|
+
return;
|
|
87145
|
+
}
|
|
87146
|
+
success(`Deleted restore point ${r2.deleted}.`);
|
|
87147
|
+
return;
|
|
87148
|
+
}
|
|
87149
|
+
const r = await client.call("GET", "/db/restore-points", void 0, { project_id: projectId });
|
|
87150
|
+
if (opts.json) {
|
|
87151
|
+
printJson(r);
|
|
87152
|
+
return;
|
|
87153
|
+
}
|
|
87154
|
+
if (!r.restore_points.length) {
|
|
87155
|
+
info(dim(`No restore points yet. Take one now with \`${cliInvocation()} db restore-points --take\`; the platform also takes them before deploys that change the database (when it can finish within the deploy's wait) and daily when the data changed.`));
|
|
87156
|
+
return;
|
|
87157
|
+
}
|
|
87158
|
+
table(["Restore point", "Taken", "Why", "State", "Size", "Expires"], r.restore_points.map((p2) => [teal(p2.id), p2.taken_at, p2.reason, p2.state === "ready" ? p2.exact === false ? "ready (read while running)" : "ready" : `${p2.state}${p2.detail ? `: ${p2.detail}` : ""}`, p2.state === "ready" ? size(p2.size_bytes) : dim("\u2014"), p2.expires_at]));
|
|
87159
|
+
for (const p2 of r.restore_points)
|
|
87160
|
+
if (p2.state === "ready" && p2.consistency && p2.consistency !== "Read in one moment: an exact copy.")
|
|
87161
|
+
info(dim(`${p2.id}: ${p2.consistency}`));
|
|
87162
|
+
} catch (err) {
|
|
87163
|
+
error(err instanceof Error ? err.message : String(err), err);
|
|
87164
|
+
process.exit(1);
|
|
87165
|
+
}
|
|
87166
|
+
});
|
|
87021
87167
|
db.command("tables").description("List tables in the project database").option("--project <id>", "Project ID (defaults to .somewhere.json)").option("--json", "Print the raw tables response as JSON").action(async (opts) => {
|
|
87022
87168
|
const client = new ApiClient(getToken());
|
|
87023
87169
|
let projectId = opts.project;
|
|
@@ -87047,6 +87193,7 @@ function registerDb(program2) {
|
|
|
87047
87193
|
}
|
|
87048
87194
|
});
|
|
87049
87195
|
}
|
|
87196
|
+
var sizeText;
|
|
87050
87197
|
var init_db = __esm({
|
|
87051
87198
|
"dist/commands/db.js"() {
|
|
87052
87199
|
"use strict";
|
|
@@ -87057,6 +87204,8 @@ var init_db = __esm({
|
|
|
87057
87204
|
init_config();
|
|
87058
87205
|
init_output();
|
|
87059
87206
|
init_link_hint();
|
|
87207
|
+
sizeText = /* @__PURE__ */ __name((n) => n >= 1e6 ? `${(n / 1e6).toFixed(1)} MB` : `${Math.max(1, Math.round(n / 1e3))} KB`, "sizeText");
|
|
87208
|
+
__name(backgroundExport, "backgroundExport");
|
|
87060
87209
|
__name(registerDb, "registerDb");
|
|
87061
87210
|
}
|
|
87062
87211
|
});
|
|
@@ -87401,16 +87550,16 @@ var init_postgres = __esm({
|
|
|
87401
87550
|
|
|
87402
87551
|
// dist/lib/local-docs.js
|
|
87403
87552
|
import { appendFileSync as appendFileSync3, existsSync as existsSync31, lstatSync as lstatSync5, mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync3, readFileSync as readFileSync32, renameSync as renameSync5, rmSync as rmSync13, writeFileSync as writeFileSync21 } from "node:fs";
|
|
87404
|
-
import { join as
|
|
87553
|
+
import { join as join37 } from "node:path";
|
|
87405
87554
|
function localDocsVersion(root = process.cwd()) {
|
|
87406
|
-
const path3 =
|
|
87555
|
+
const path3 = join37(root, FOLDER, DOCS, STAMP);
|
|
87407
87556
|
if (!existsSync31(path3))
|
|
87408
87557
|
return void 0;
|
|
87409
87558
|
const stamp2 = JSON.parse(readFileSync32(path3, "utf8"));
|
|
87410
87559
|
return typeof stamp2.version === "string" && /^[a-f0-9]{16}$/.test(stamp2.version) ? stamp2.version : void 0;
|
|
87411
87560
|
}
|
|
87412
87561
|
function ensureGitIgnore(root) {
|
|
87413
|
-
const path3 =
|
|
87562
|
+
const path3 = join37(root, ".gitignore");
|
|
87414
87563
|
const text = existsSync31(path3) ? readFileSync32(path3, "utf8") : "";
|
|
87415
87564
|
if (text.split(/\r?\n/).some((line) => line === ".somewhere/" || line === "/.somewhere/"))
|
|
87416
87565
|
return;
|
|
@@ -87418,8 +87567,8 @@ function ensureGitIgnore(root) {
|
|
|
87418
87567
|
`);
|
|
87419
87568
|
}
|
|
87420
87569
|
function saveLocalDocs(version2, files, root = process.cwd()) {
|
|
87421
|
-
const state =
|
|
87422
|
-
const target =
|
|
87570
|
+
const state = join37(root, FOLDER);
|
|
87571
|
+
const target = join37(state, DOCS);
|
|
87423
87572
|
if (existsSync31(state) && !lstatSync5(state).isDirectory())
|
|
87424
87573
|
throw new Error(`${state} must be a directory.`);
|
|
87425
87574
|
if (existsSync31(target) && (!lstatSync5(target).isDirectory() || !localDocsVersion(root))) {
|
|
@@ -87427,17 +87576,17 @@ function saveLocalDocs(version2, files, root = process.cwd()) {
|
|
|
87427
87576
|
}
|
|
87428
87577
|
ensureGitIgnore(root);
|
|
87429
87578
|
mkdirSync16(state, { recursive: true });
|
|
87430
|
-
const staging = mkdtempSync3(
|
|
87431
|
-
const next =
|
|
87432
|
-
const previous =
|
|
87579
|
+
const staging = mkdtempSync3(join37(state, "docs-pull-"));
|
|
87580
|
+
const next = join37(staging, "next");
|
|
87581
|
+
const previous = join37(staging, "previous");
|
|
87433
87582
|
let installed = false;
|
|
87434
87583
|
try {
|
|
87435
87584
|
mkdirSync16(next);
|
|
87436
87585
|
for (const [name, content] of files)
|
|
87437
|
-
writeFileSync21(
|
|
87586
|
+
writeFileSync21(join37(next, name), content, { flag: "wx" });
|
|
87438
87587
|
const pulledAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
87439
|
-
writeFileSync21(
|
|
87440
|
-
writeFileSync21(
|
|
87588
|
+
writeFileSync21(join37(next, STAMP), JSON.stringify({ version: version2, pulledAt }) + "\n");
|
|
87589
|
+
writeFileSync21(join37(next, "README.md"), `# Somewhere docs
|
|
87441
87590
|
|
|
87442
87591
|
Pulled platform docs version ${version2} on ${pulledAt}. Run \`${cliInvocation()} docs\` to check whether this copy is older than the current docs and \`${cliInvocation()} docs pull\` to refresh it.
|
|
87443
87592
|
`, { flag: "wx" });
|
|
@@ -87469,7 +87618,7 @@ var init_local_docs = __esm({
|
|
|
87469
87618
|
|
|
87470
87619
|
// dist/lib/advisor-context.js
|
|
87471
87620
|
import { readFileSync as readFileSync33, statSync as statSync6 } from "node:fs";
|
|
87472
|
-
import { basename as
|
|
87621
|
+
import { basename as basename8 } from "node:path";
|
|
87473
87622
|
function tail(value, limit) {
|
|
87474
87623
|
return value.length <= limit ? value : `\u2026${value.slice(-limit)}`;
|
|
87475
87624
|
}
|
|
@@ -87481,7 +87630,7 @@ function redactAdvisorText(value, redactDotenvValues = false) {
|
|
|
87481
87630
|
return redacted;
|
|
87482
87631
|
}
|
|
87483
87632
|
function isDotenvPath(path3) {
|
|
87484
|
-
const name =
|
|
87633
|
+
const name = basename8(path3);
|
|
87485
87634
|
return name === ".env" || name.startsWith(".env.") || name.endsWith(".env");
|
|
87486
87635
|
}
|
|
87487
87636
|
function buildAdvisorContext(filePath) {
|
|
@@ -87515,18 +87664,18 @@ var init_advisor_context = __esm({
|
|
|
87515
87664
|
});
|
|
87516
87665
|
|
|
87517
87666
|
// dist/lib/advisor-runs.js
|
|
87518
|
-
import { randomBytes as randomBytes7, randomUUID as
|
|
87667
|
+
import { randomBytes as randomBytes7, randomUUID as randomUUID8 } from "node:crypto";
|
|
87519
87668
|
import { chmodSync as chmodSync4, existsSync as existsSync32, mkdirSync as mkdirSync17, readFileSync as readFileSync34, renameSync as renameSync6, writeFileSync as writeFileSync22 } from "node:fs";
|
|
87520
|
-
import { join as
|
|
87669
|
+
import { join as join38 } from "node:path";
|
|
87521
87670
|
function path2(id) {
|
|
87522
87671
|
if (!/^[a-f0-9-]{36}$/i.test(id))
|
|
87523
87672
|
throw Error("Invalid Advisor request ID.");
|
|
87524
|
-
return
|
|
87673
|
+
return join38(directory(), id + ".json");
|
|
87525
87674
|
}
|
|
87526
87675
|
function save(record3) {
|
|
87527
87676
|
mkdirSync17(directory(), { recursive: true, mode: 448 });
|
|
87528
87677
|
chmodSync4(directory(), 448);
|
|
87529
|
-
const target = path2(record3.request_id), temporary = target + "." +
|
|
87678
|
+
const target = path2(record3.request_id), temporary = target + "." + randomUUID8() + ".tmp";
|
|
87530
87679
|
writeFileSync22(temporary, JSON.stringify(record3), { mode: 384, flag: "wx" });
|
|
87531
87680
|
renameSync6(temporary, target);
|
|
87532
87681
|
chmodSync4(target, 384);
|
|
@@ -87603,7 +87752,7 @@ async function callAdvisorRun(args) {
|
|
|
87603
87752
|
else {
|
|
87604
87753
|
if (!args.question)
|
|
87605
87754
|
throw Error("Supply a question or --resume <request-id>.");
|
|
87606
|
-
const id =
|
|
87755
|
+
const id = randomUUID8(), created = Date.now(), context = args.context ? { ...args.context } : void 0;
|
|
87607
87756
|
if (context?.file)
|
|
87608
87757
|
delete context.file;
|
|
87609
87758
|
const config2 = loadConfig();
|
|
@@ -87644,7 +87793,7 @@ async function consumeAdvisorRun(text, progress) {
|
|
|
87644
87793
|
}
|
|
87645
87794
|
if (typeof parsed.run_id !== "string" || typeof parsed.status !== "string")
|
|
87646
87795
|
return null;
|
|
87647
|
-
const config2 = loadConfig(), anonymous = typeof parsed.anonymous_capability === "string", id =
|
|
87796
|
+
const config2 = loadConfig(), anonymous = typeof parsed.anonymous_capability === "string", id = randomUUID8();
|
|
87648
87797
|
if (!anonymous && (!config2?.token || config2.temporary === true))
|
|
87649
87798
|
throw Error("Sign in to the account that owns this Advisor run.");
|
|
87650
87799
|
const record3 = { owner_mode: anonymous ? "anonymous" : "account", request_id: id, request_created_at: Date.now(), capability: anonymous ? String(parsed.anonymous_capability) : randomBytes7(32).toString("hex"), run_id: parsed.run_id, ...Number.isSafeInteger(parsed.payload_expires_at) ? { payload_expires_at: Number(parsed.payload_expires_at) } : {} };
|
|
@@ -87659,7 +87808,7 @@ var init_advisor_runs = __esm({
|
|
|
87659
87808
|
init_config();
|
|
87660
87809
|
init_http();
|
|
87661
87810
|
init_advisor_context();
|
|
87662
|
-
directory = /* @__PURE__ */ __name(() =>
|
|
87811
|
+
directory = /* @__PURE__ */ __name(() => join38(cliConfigDir(), "advisor-runs"), "directory");
|
|
87663
87812
|
__name(path2, "path");
|
|
87664
87813
|
__name(save, "save");
|
|
87665
87814
|
PAYLOAD_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -87678,7 +87827,7 @@ var init_advisor_runs = __esm({
|
|
|
87678
87827
|
// dist/lib/advisor-app.js
|
|
87679
87828
|
import { createHash as createHash8 } from "node:crypto";
|
|
87680
87829
|
import { existsSync as existsSync33, mkdirSync as mkdirSync18, readFileSync as readFileSync35, rmSync as rmSync14, writeFileSync as writeFileSync23 } from "node:fs";
|
|
87681
|
-
import { join as
|
|
87830
|
+
import { join as join39 } from "node:path";
|
|
87682
87831
|
async function gatherAdvisorApp(client, ref) {
|
|
87683
87832
|
const project = await client.call("GET", `/projects/${encodeURIComponent(ref)}`);
|
|
87684
87833
|
if (typeof project.id !== "string" || project.deleted === true)
|
|
@@ -87712,7 +87861,7 @@ async function gatherAdvisorApp(client, ref) {
|
|
|
87712
87861
|
}
|
|
87713
87862
|
function loadAdvisorTurns(dir, projectId, account, now2 = Date.now()) {
|
|
87714
87863
|
try {
|
|
87715
|
-
const saved = JSON.parse(readFileSync35(
|
|
87864
|
+
const saved = JSON.parse(readFileSync35(join39(dir, FILE), "utf8"));
|
|
87716
87865
|
if (saved.project_id !== projectId || saved.owner !== ownerOf(account) || !Array.isArray(saved.turns))
|
|
87717
87866
|
return [];
|
|
87718
87867
|
const last = saved.turns.at(-1);
|
|
@@ -87722,16 +87871,16 @@ function loadAdvisorTurns(dir, projectId, account, now2 = Date.now()) {
|
|
|
87722
87871
|
}
|
|
87723
87872
|
}
|
|
87724
87873
|
function saveAdvisorTurn(dir, projectId, account, earlier, turn) {
|
|
87725
|
-
mkdirSync18(
|
|
87726
|
-
writeFileSync23(
|
|
87874
|
+
mkdirSync18(join39(dir, DIR), { recursive: true, mode: 448 });
|
|
87875
|
+
writeFileSync23(join39(dir, FILE), JSON.stringify({ project_id: projectId, owner: ownerOf(account), turns: [...earlier, { question: turn.question.slice(0, 2e3), answer: turn.answer.slice(0, 3e3), at: turn.at }].slice(-3) }) + "\n", { mode: 384 });
|
|
87727
87876
|
ensureAdvisorStateIgnored(dir);
|
|
87728
87877
|
}
|
|
87729
87878
|
function clearAdvisorTurns(dir) {
|
|
87730
|
-
if (existsSync33(
|
|
87731
|
-
rmSync14(
|
|
87879
|
+
if (existsSync33(join39(dir, FILE)))
|
|
87880
|
+
rmSync14(join39(dir, FILE), { force: true });
|
|
87732
87881
|
}
|
|
87733
87882
|
function ensureAdvisorStateIgnored(dir) {
|
|
87734
|
-
const path3 =
|
|
87883
|
+
const path3 = join39(dir, ".gitignore");
|
|
87735
87884
|
const covered = [".somewhere/", ".somewhere", "/.somewhere/", "/.somewhere", ".somewhere/advisor-conversation.json"];
|
|
87736
87885
|
if (!existsSync33(path3)) {
|
|
87737
87886
|
writeFileSync23(path3, "# somewhere: local CLI state (Advisor follow-ups, test users)\n.somewhere/\n");
|
|
@@ -87751,7 +87900,7 @@ var init_advisor_app = __esm({
|
|
|
87751
87900
|
"use strict";
|
|
87752
87901
|
__name(gatherAdvisorApp, "gatherAdvisorApp");
|
|
87753
87902
|
DIR = ".somewhere";
|
|
87754
|
-
FILE =
|
|
87903
|
+
FILE = join39(DIR, "advisor-conversation.json");
|
|
87755
87904
|
IDLE_MS = 30 * 6e4;
|
|
87756
87905
|
ownerOf = /* @__PURE__ */ __name((account) => createHash8("sha256").update(`advisor:${account}`).digest("hex"), "ownerOf");
|
|
87757
87906
|
__name(loadAdvisorTurns, "loadAdvisorTurns");
|
|
@@ -89879,7 +90028,7 @@ var init_claim = __esm({
|
|
|
89879
90028
|
import { createRequire as createRequire9 } from "node:module";
|
|
89880
90029
|
import { realpathSync as realpathSync4 } from "node:fs";
|
|
89881
90030
|
import { createConnection, createServer as createNetServer } from "node:net";
|
|
89882
|
-
import { join as
|
|
90031
|
+
import { join as join40 } from "node:path";
|
|
89883
90032
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
89884
90033
|
function deployedOrigin(value) {
|
|
89885
90034
|
const url3 = new URL(value);
|
|
@@ -89977,7 +90126,7 @@ async function startFrontendDev(cwd, target, port = 8787, open4 = false) {
|
|
|
89977
90126
|
throw new Error(INSTALL_PROJECT_DEPENDENCIES);
|
|
89978
90127
|
let vitePath;
|
|
89979
90128
|
try {
|
|
89980
|
-
vitePath = createRequire9(
|
|
90129
|
+
vitePath = createRequire9(join40(cwd, "package.json")).resolve("vite");
|
|
89981
90130
|
} catch {
|
|
89982
90131
|
if (readProjectPin(cwd)?.versionOnly) {
|
|
89983
90132
|
throw new Error("Install the local frontend tools: npm install -D --save-exact vite@7.2.2");
|
|
@@ -90119,9 +90268,9 @@ var init_preview_jobs = __esm({
|
|
|
90119
90268
|
});
|
|
90120
90269
|
|
|
90121
90270
|
// dist/commands/dev.js
|
|
90122
|
-
import { randomUUID as
|
|
90271
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
90123
90272
|
import { existsSync as existsSync36, readFileSync as readFileSync38 } from "node:fs";
|
|
90124
|
-
import { join as
|
|
90273
|
+
import { join as join41, relative as relative11 } from "node:path";
|
|
90125
90274
|
function previewFinishedReason(err) {
|
|
90126
90275
|
if (!(err instanceof CliApiError) || err.code !== "DRAFT_SESSION_TERMINAL")
|
|
90127
90276
|
return null;
|
|
@@ -90747,7 +90896,7 @@ async function runHotDeploy(opts) {
|
|
|
90747
90896
|
}
|
|
90748
90897
|
await showProjectNotices(client, projectId);
|
|
90749
90898
|
const { files, binaryFiles, functions } = collected;
|
|
90750
|
-
const firstOperationId = `previewop_${
|
|
90899
|
+
const firstOperationId = `previewop_${randomUUID9()}`;
|
|
90751
90900
|
const showPublishProgress = opts.publishFirst === true && opts.json !== true;
|
|
90752
90901
|
const phase = /* @__PURE__ */ __name((label, operation) => showPublishProgress ? runPreviewPhase(label, operation) : operation(), "phase");
|
|
90753
90902
|
const say = opts.json ? () => {
|
|
@@ -90779,7 +90928,7 @@ async function runHotDeploy(opts) {
|
|
|
90779
90928
|
say(`Continuing this folder's preview ${draftId}${when.length ? ` (${when.join(", ")})` : ""}.`);
|
|
90780
90929
|
say("Pass --new to open a fresh preview with a new copy of production data instead.");
|
|
90781
90930
|
} else {
|
|
90782
|
-
draftId = `draft_${
|
|
90931
|
+
draftId = `draft_${randomUUID9()}`;
|
|
90783
90932
|
expectedPreviewId = null;
|
|
90784
90933
|
if (decision.reason === "stale") {
|
|
90785
90934
|
if (!opts.json) {
|
|
@@ -91108,7 +91257,7 @@ async function deployBatch(client, projectId, cwd, changed, deleted, draftId, ex
|
|
|
91108
91257
|
const updateBinary = {};
|
|
91109
91258
|
const deleteKeys = [];
|
|
91110
91259
|
for (const rel of changed) {
|
|
91111
|
-
const abs =
|
|
91260
|
+
const abs = join41(cwd, rel);
|
|
91112
91261
|
if (!existsSync36(abs))
|
|
91113
91262
|
continue;
|
|
91114
91263
|
const { kind, key } = classifyKey(rel);
|
|
@@ -91121,7 +91270,7 @@ async function deployBatch(client, projectId, cwd, changed, deleted, draftId, ex
|
|
|
91121
91270
|
}
|
|
91122
91271
|
for (const rel of deleted)
|
|
91123
91272
|
deleteKeys.push(classifyKey(rel).key);
|
|
91124
|
-
const operationId = `previewop_${
|
|
91273
|
+
const operationId = `previewop_${randomUUID9()}`;
|
|
91125
91274
|
const body = {
|
|
91126
91275
|
project_id: projectId,
|
|
91127
91276
|
preview: true,
|
|
@@ -91180,7 +91329,7 @@ async function deployBatch(client, projectId, cwd, changed, deleted, draftId, ex
|
|
|
91180
91329
|
for (const rel of deleted)
|
|
91181
91330
|
delete nextFiles[rel];
|
|
91182
91331
|
for (const rel of changed)
|
|
91183
|
-
if (existsSync36(
|
|
91332
|
+
if (existsSync36(join41(cwd, rel)))
|
|
91184
91333
|
Object.assign(nextFiles, hashFiles(cwd, [rel]));
|
|
91185
91334
|
savePreviewRecord(cwd, { ...record3, preview_id: nextCandidate, files: nextFiles });
|
|
91186
91335
|
}
|
|
@@ -91376,7 +91525,7 @@ var init_dev = __esm({
|
|
|
91376
91525
|
|
|
91377
91526
|
// dist/commands/check.js
|
|
91378
91527
|
import { existsSync as existsSync37 } from "node:fs";
|
|
91379
|
-
import { join as
|
|
91528
|
+
import { join as join42, resolve as resolve21 } from "node:path";
|
|
91380
91529
|
function buildCheckBody(collected, projectId) {
|
|
91381
91530
|
const body = { project_id: projectId, files: collected.files };
|
|
91382
91531
|
if (Object.keys(collected.functions).length > 0)
|
|
@@ -91481,7 +91630,7 @@ async function runLocalPreflight(targetDir, collected, typecheck = async (dir) =
|
|
|
91481
91630
|
if (collected.excluded.length)
|
|
91482
91631
|
source.not_published = collected.excluded;
|
|
91483
91632
|
let typecheckStep;
|
|
91484
|
-
if (!existsSync37(
|
|
91633
|
+
if (!existsSync37(join42(targetDir, "tsconfig.json"))) {
|
|
91485
91634
|
typecheckStep = { name: "typecheck", status: "skipped", reason: MISSING_TSCONFIG_GUIDANCE };
|
|
91486
91635
|
} else if (missingProjectDependencies(targetDir).length) {
|
|
91487
91636
|
typecheckStep = { name: "typecheck", status: "skipped", reason: missingTypecheckDependenciesMessage() };
|
|
@@ -91895,11 +92044,11 @@ var init_api2 = __esm({
|
|
|
91895
92044
|
});
|
|
91896
92045
|
|
|
91897
92046
|
// dist/commands/fs.js
|
|
91898
|
-
import { createReadStream as createReadStream2, createWriteStream as
|
|
91899
|
-
import { stat as stat5, rename, unlink } from "node:fs/promises";
|
|
91900
|
-
import { randomUUID as
|
|
91901
|
-
import { basename as
|
|
91902
|
-
import { pipeline as
|
|
92047
|
+
import { createReadStream as createReadStream2, createWriteStream as createWriteStream3 } from "node:fs";
|
|
92048
|
+
import { stat as stat5, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
92049
|
+
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
92050
|
+
import { basename as basename9, dirname as dirname14, extname as extname6, join as join43, resolve as resolve23 } from "node:path";
|
|
92051
|
+
import { pipeline as pipeline3 } from "node:stream/promises";
|
|
91903
92052
|
function registerFs(program2) {
|
|
91904
92053
|
const fs2 = program2.command("fs").description("Manage project file storage");
|
|
91905
92054
|
fs2.command("put <local> <remote>").description("Stream a local file into project storage").option("--project <slug>", "Project slug or ID (defaults to the linked project)").option("--content-type <type>", "Stored content type (inferred from the local filename by default)").option("--json", "Print the raw file response as JSON").action(async (local, remote, opts) => {
|
|
@@ -91942,9 +92091,9 @@ function registerFs(program2) {
|
|
|
91942
92091
|
if (!response.body)
|
|
91943
92092
|
throw new Error("The server returned an empty file response.");
|
|
91944
92093
|
const destination = resolve23(local);
|
|
91945
|
-
tempPath =
|
|
91946
|
-
await
|
|
91947
|
-
await
|
|
92094
|
+
tempPath = join43(dirname14(destination), `.${basename9(destination)}.${randomUUID10()}.tmp`);
|
|
92095
|
+
await pipeline3(response.body, createWriteStream3(tempPath, { flags: "wx" }));
|
|
92096
|
+
await rename2(tempPath, destination);
|
|
91948
92097
|
tempPath = void 0;
|
|
91949
92098
|
const size = Number(response.headers.get("content-length"));
|
|
91950
92099
|
const result = {
|
|
@@ -91959,7 +92108,7 @@ function registerFs(program2) {
|
|
|
91959
92108
|
success(`Downloaded ${remote} \u2192 ${local}`);
|
|
91960
92109
|
} catch (err) {
|
|
91961
92110
|
if (tempPath)
|
|
91962
|
-
await
|
|
92111
|
+
await unlink2(tempPath).catch(() => {
|
|
91963
92112
|
});
|
|
91964
92113
|
fail(err, opts.json);
|
|
91965
92114
|
}
|
|
@@ -109746,13 +109895,13 @@ var require_polyfill = __commonJS({
|
|
|
109746
109895
|
readlink,
|
|
109747
109896
|
stat: stat6,
|
|
109748
109897
|
symlink,
|
|
109749
|
-
unlink:
|
|
109898
|
+
unlink: unlink3,
|
|
109750
109899
|
utimes
|
|
109751
109900
|
} = __require("fs/promises");
|
|
109752
109901
|
var {
|
|
109753
|
-
dirname:
|
|
109902
|
+
dirname: dirname17,
|
|
109754
109903
|
isAbsolute: isAbsolute7,
|
|
109755
|
-
join:
|
|
109904
|
+
join: join53,
|
|
109756
109905
|
parse: parse3,
|
|
109757
109906
|
resolve: resolve27,
|
|
109758
109907
|
sep: sep2,
|
|
@@ -109854,7 +110003,7 @@ var require_polyfill = __commonJS({
|
|
|
109854
110003
|
}
|
|
109855
110004
|
__name(getStats, "getStats");
|
|
109856
110005
|
async function checkParentDir(destStat, src, dest, opts) {
|
|
109857
|
-
const destParent =
|
|
110006
|
+
const destParent = dirname17(dest);
|
|
109858
110007
|
const dirExists = await pathExists(destParent);
|
|
109859
110008
|
if (dirExists) {
|
|
109860
110009
|
return getStatsForCopy(destStat, src, dest, opts);
|
|
@@ -109872,8 +110021,8 @@ var require_polyfill = __commonJS({
|
|
|
109872
110021
|
}
|
|
109873
110022
|
__name(pathExists, "pathExists");
|
|
109874
110023
|
async function checkParentPaths(src, srcStat, dest) {
|
|
109875
|
-
const srcParent = resolve27(
|
|
109876
|
-
const destParent = resolve27(
|
|
110024
|
+
const srcParent = resolve27(dirname17(src));
|
|
110025
|
+
const destParent = resolve27(dirname17(dest));
|
|
109877
110026
|
if (destParent === srcParent || destParent === parse3(destParent).root) {
|
|
109878
110027
|
return;
|
|
109879
110028
|
}
|
|
@@ -109966,7 +110115,7 @@ var require_polyfill = __commonJS({
|
|
|
109966
110115
|
__name(onFile, "onFile");
|
|
109967
110116
|
async function mayCopyFile(srcStat, src, dest, opts) {
|
|
109968
110117
|
if (opts.force) {
|
|
109969
|
-
await
|
|
110118
|
+
await unlink3(dest);
|
|
109970
110119
|
return _copyFile(srcStat, src, dest, opts);
|
|
109971
110120
|
} else if (opts.errorOnExist) {
|
|
109972
110121
|
throw new ERR_FS_CP_EEXIST({
|
|
@@ -110033,8 +110182,8 @@ var require_polyfill = __commonJS({
|
|
|
110033
110182
|
const dir = await readdir3(src);
|
|
110034
110183
|
for (let i = 0; i < dir.length; i++) {
|
|
110035
110184
|
const item = dir[i];
|
|
110036
|
-
const srcItem =
|
|
110037
|
-
const destItem =
|
|
110185
|
+
const srcItem = join53(src, item);
|
|
110186
|
+
const destItem = join53(dest, item);
|
|
110038
110187
|
const { destStat } = await checkPaths(srcItem, destItem, opts);
|
|
110039
110188
|
await startCopy(destStat, srcItem, destItem, opts);
|
|
110040
110189
|
}
|
|
@@ -110043,7 +110192,7 @@ var require_polyfill = __commonJS({
|
|
|
110043
110192
|
async function onLink(destStat, src, dest) {
|
|
110044
110193
|
let resolvedSrc = await readlink(src);
|
|
110045
110194
|
if (!isAbsolute7(resolvedSrc)) {
|
|
110046
|
-
resolvedSrc = resolve27(
|
|
110195
|
+
resolvedSrc = resolve27(dirname17(src), resolvedSrc);
|
|
110047
110196
|
}
|
|
110048
110197
|
if (!destStat) {
|
|
110049
110198
|
return symlink(resolvedSrc, dest);
|
|
@@ -110058,7 +110207,7 @@ var require_polyfill = __commonJS({
|
|
|
110058
110207
|
throw err;
|
|
110059
110208
|
}
|
|
110060
110209
|
if (!isAbsolute7(resolvedDest)) {
|
|
110061
|
-
resolvedDest = resolve27(
|
|
110210
|
+
resolvedDest = resolve27(dirname17(dest), resolvedDest);
|
|
110062
110211
|
}
|
|
110063
110212
|
if (isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
110064
110213
|
throw new ERR_FS_CP_EINVAL({
|
|
@@ -110081,7 +110230,7 @@ var require_polyfill = __commonJS({
|
|
|
110081
110230
|
}
|
|
110082
110231
|
__name(onLink, "onLink");
|
|
110083
110232
|
async function copyLink(resolvedSrc, dest) {
|
|
110084
|
-
await
|
|
110233
|
+
await unlink3(dest);
|
|
110085
110234
|
return symlink(resolvedSrc, dest);
|
|
110086
110235
|
}
|
|
110087
110236
|
__name(copyLink, "copyLink");
|
|
@@ -110110,7 +110259,7 @@ var require_cp = __commonJS({
|
|
|
110110
110259
|
// node_modules/@npmcli/fs/lib/with-temp-dir.js
|
|
110111
110260
|
var require_with_temp_dir = __commonJS({
|
|
110112
110261
|
"node_modules/@npmcli/fs/lib/with-temp-dir.js"(exports, module) {
|
|
110113
|
-
var { join:
|
|
110262
|
+
var { join: join53, sep: sep2 } = __require("path");
|
|
110114
110263
|
var getOptions = require_get_options();
|
|
110115
110264
|
var { mkdir, mkdtemp, rm } = __require("fs/promises");
|
|
110116
110265
|
var withTempDir = /* @__PURE__ */ __name(async (root, fn, opts) => {
|
|
@@ -110118,7 +110267,7 @@ var require_with_temp_dir = __commonJS({
|
|
|
110118
110267
|
copy: ["tmpPrefix"]
|
|
110119
110268
|
});
|
|
110120
110269
|
await mkdir(root, { recursive: true });
|
|
110121
|
-
const target = await mkdtemp(
|
|
110270
|
+
const target = await mkdtemp(join53(`${root}${sep2}`, options2.tmpPrefix || ""));
|
|
110122
110271
|
let err;
|
|
110123
110272
|
let result;
|
|
110124
110273
|
try {
|
|
@@ -110143,13 +110292,13 @@ var require_with_temp_dir = __commonJS({
|
|
|
110143
110292
|
var require_readdir_scoped = __commonJS({
|
|
110144
110293
|
"node_modules/@npmcli/fs/lib/readdir-scoped.js"(exports, module) {
|
|
110145
110294
|
var { readdir: readdir3 } = __require("fs/promises");
|
|
110146
|
-
var { join:
|
|
110295
|
+
var { join: join53 } = __require("path");
|
|
110147
110296
|
var readdirScoped = /* @__PURE__ */ __name(async (dir) => {
|
|
110148
110297
|
const results = [];
|
|
110149
110298
|
for (const item of await readdir3(dir)) {
|
|
110150
110299
|
if (item.startsWith("@")) {
|
|
110151
|
-
for (const scopedItem of await readdir3(
|
|
110152
|
-
results.push(
|
|
110300
|
+
for (const scopedItem of await readdir3(join53(dir, item))) {
|
|
110301
|
+
results.push(join53(item, scopedItem));
|
|
110153
110302
|
}
|
|
110154
110303
|
} else {
|
|
110155
110304
|
results.push(item);
|
|
@@ -110164,7 +110313,7 @@ var require_readdir_scoped = __commonJS({
|
|
|
110164
110313
|
// node_modules/@npmcli/fs/lib/move-file.js
|
|
110165
110314
|
var require_move_file = __commonJS({
|
|
110166
110315
|
"node_modules/@npmcli/fs/lib/move-file.js"(exports, module) {
|
|
110167
|
-
var { dirname:
|
|
110316
|
+
var { dirname: dirname17, join: join53, resolve: resolve27, relative: relative15, isAbsolute: isAbsolute7 } = __require("path");
|
|
110168
110317
|
var fs2 = __require("fs/promises");
|
|
110169
110318
|
var pathExists = /* @__PURE__ */ __name(async (path3) => {
|
|
110170
110319
|
try {
|
|
@@ -110185,7 +110334,7 @@ var require_move_file = __commonJS({
|
|
|
110185
110334
|
if (!options2.overwrite && await pathExists(destination)) {
|
|
110186
110335
|
throw new Error(`The destination file exists: ${destination}`);
|
|
110187
110336
|
}
|
|
110188
|
-
await fs2.mkdir(
|
|
110337
|
+
await fs2.mkdir(dirname17(destination), { recursive: true });
|
|
110189
110338
|
try {
|
|
110190
110339
|
await fs2.rename(source, destination);
|
|
110191
110340
|
} catch (error3) {
|
|
@@ -110194,7 +110343,7 @@ var require_move_file = __commonJS({
|
|
|
110194
110343
|
if (sourceStat.isDirectory()) {
|
|
110195
110344
|
const files = await fs2.readdir(source);
|
|
110196
110345
|
await Promise.all(files.map(
|
|
110197
|
-
(file) => moveFile(
|
|
110346
|
+
(file) => moveFile(join53(source, file), join53(destination, file), options2, false, symlinks)
|
|
110198
110347
|
));
|
|
110199
110348
|
} else if (sourceStat.isSymbolicLink()) {
|
|
110200
110349
|
symlinks.push({ source, destination });
|
|
@@ -110213,7 +110362,7 @@ var require_move_file = __commonJS({
|
|
|
110213
110362
|
}
|
|
110214
110363
|
let targetStat = "file";
|
|
110215
110364
|
try {
|
|
110216
|
-
targetStat = await fs2.stat(resolve27(
|
|
110365
|
+
targetStat = await fs2.stat(resolve27(dirname17(symSource), target));
|
|
110217
110366
|
if (targetStat.isDirectory()) {
|
|
110218
110367
|
targetStat = "junction";
|
|
110219
110368
|
}
|
|
@@ -112415,8 +112564,8 @@ var require_write = __commonJS({
|
|
|
112415
112564
|
hashStream.on("size", (s3) => {
|
|
112416
112565
|
size = s3;
|
|
112417
112566
|
});
|
|
112418
|
-
const
|
|
112419
|
-
await
|
|
112567
|
+
const pipeline5 = new Pipeline(inputStream, hashStream, outStream);
|
|
112568
|
+
await pipeline5.promise();
|
|
112420
112569
|
return { integrity, size };
|
|
112421
112570
|
}
|
|
112422
112571
|
__name(pipeToTmp, "pipeToTmp");
|
|
@@ -112507,12 +112656,12 @@ var require_put = __commonJS({
|
|
|
112507
112656
|
let size;
|
|
112508
112657
|
let error3;
|
|
112509
112658
|
let memoData;
|
|
112510
|
-
const
|
|
112659
|
+
const pipeline5 = new Pipeline();
|
|
112511
112660
|
if (memoize) {
|
|
112512
112661
|
const memoizer2 = new PassThrough().on("collect", (data2) => {
|
|
112513
112662
|
memoData = data2;
|
|
112514
112663
|
});
|
|
112515
|
-
|
|
112664
|
+
pipeline5.push(memoizer2);
|
|
112516
112665
|
}
|
|
112517
112666
|
const contentStream = write.stream(cache, opts).on("integrity", (int2) => {
|
|
112518
112667
|
integrity = int2;
|
|
@@ -112521,20 +112670,20 @@ var require_put = __commonJS({
|
|
|
112521
112670
|
}).on("error", (err) => {
|
|
112522
112671
|
error3 = err;
|
|
112523
112672
|
});
|
|
112524
|
-
|
|
112525
|
-
|
|
112673
|
+
pipeline5.push(contentStream);
|
|
112674
|
+
pipeline5.push(new Flush({
|
|
112526
112675
|
async flush() {
|
|
112527
112676
|
if (!error3) {
|
|
112528
112677
|
const entry = await index.insert(cache, key, integrity, { ...opts, size });
|
|
112529
112678
|
if (memoize && memoData) {
|
|
112530
112679
|
memo2.put(cache, entry, memoData, opts);
|
|
112531
112680
|
}
|
|
112532
|
-
|
|
112533
|
-
|
|
112681
|
+
pipeline5.emit("integrity", integrity);
|
|
112682
|
+
pipeline5.emit("size", size);
|
|
112534
112683
|
}
|
|
112535
112684
|
}
|
|
112536
112685
|
}));
|
|
112537
|
-
return
|
|
112686
|
+
return pipeline5;
|
|
112538
112687
|
}
|
|
112539
112688
|
__name(putStream, "putStream");
|
|
112540
112689
|
}
|
|
@@ -123312,12 +123461,12 @@ var require_remote = __commonJS({
|
|
|
123312
123461
|
integrity: _opts.integrity,
|
|
123313
123462
|
size: _opts.size
|
|
123314
123463
|
});
|
|
123315
|
-
const
|
|
123464
|
+
const pipeline5 = new CachingMinipassPipeline({
|
|
123316
123465
|
events: ["integrity", "size"]
|
|
123317
123466
|
}, res.body, integrityStream);
|
|
123318
|
-
integrityStream.on("integrity", (i) =>
|
|
123319
|
-
integrityStream.on("size", (s3) =>
|
|
123320
|
-
res = new fetch2.Response(
|
|
123467
|
+
integrityStream.on("integrity", (i) => pipeline5.emit("integrity", i));
|
|
123468
|
+
integrityStream.on("size", (s3) => pipeline5.emit("size", s3));
|
|
123469
|
+
res = new fetch2.Response(pipeline5, res);
|
|
123321
123470
|
res.body.hasIntegrityEmitter = true;
|
|
123322
123471
|
}
|
|
123323
123472
|
res.headers.set("x-fetch-attempts", attemptNum);
|
|
@@ -129562,12 +129711,12 @@ var require_url = __commonJS({
|
|
|
129562
129711
|
"node_modules/tuf-js/dist/utils/url.js"(exports) {
|
|
129563
129712
|
"use strict";
|
|
129564
129713
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
129565
|
-
exports.join =
|
|
129714
|
+
exports.join = join53;
|
|
129566
129715
|
var url_1 = __require("url");
|
|
129567
|
-
function
|
|
129716
|
+
function join53(base, path3) {
|
|
129568
129717
|
return new url_1.URL(ensureTrailingSlash(base) + removeLeadingSlash(path3)).toString();
|
|
129569
129718
|
}
|
|
129570
|
-
__name(
|
|
129719
|
+
__name(join53, "join");
|
|
129571
129720
|
function ensureTrailingSlash(path3) {
|
|
129572
129721
|
return path3.endsWith("/") ? path3 : path3 + "/";
|
|
129573
129722
|
}
|
|
@@ -131904,9 +132053,9 @@ var require_dist15 = __commonJS({
|
|
|
131904
132053
|
// dist/lib/update-security.js
|
|
131905
132054
|
import { createHash as createHash9, timingSafeEqual } from "node:crypto";
|
|
131906
132055
|
import { mkdirSync as mkdirSync19, readFileSync as readFileSync39, statSync as statSync7 } from "node:fs";
|
|
131907
|
-
import { join as
|
|
131908
|
-
import { Readable as
|
|
131909
|
-
import { pipeline as
|
|
132056
|
+
import { join as join44 } from "node:path";
|
|
132057
|
+
import { Readable as Readable3 } from "node:stream";
|
|
132058
|
+
import { pipeline as pipeline4 } from "node:stream/promises";
|
|
131910
132059
|
function expectedTarballUrl(version2) {
|
|
131911
132060
|
return `${OFFICIAL_NPM_REGISTRY}/@somewhere-cloud/cli/-/cli-${encodeURIComponent(version2)}.tgz`;
|
|
131912
132061
|
}
|
|
@@ -132249,7 +132398,7 @@ function bundledManifestLockPath(tarPath) {
|
|
|
132249
132398
|
return index === parts.length ? directory2 : void 0;
|
|
132250
132399
|
}
|
|
132251
132400
|
async function extractArtifactSnapshot(artifact, extractionDir, filter) {
|
|
132252
|
-
await
|
|
132401
|
+
await pipeline4(Readable3.from([artifact]), So({ cwd: extractionDir, strip: 1, strict: true, filter }));
|
|
132253
132402
|
}
|
|
132254
132403
|
async function verifyLockedArtifact(artifact, extractionDir, release2) {
|
|
132255
132404
|
mkdirSync19(extractionDir, { recursive: true, mode: 448 });
|
|
@@ -132269,8 +132418,8 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
|
|
|
132269
132418
|
seen2.add(path3);
|
|
132270
132419
|
return true;
|
|
132271
132420
|
});
|
|
132272
|
-
const manifestPath =
|
|
132273
|
-
const lockPath =
|
|
132421
|
+
const manifestPath = join44(extractionDir, "package.json");
|
|
132422
|
+
const lockPath = join44(extractionDir, "npm-shrinkwrap.json");
|
|
132274
132423
|
let manifest;
|
|
132275
132424
|
let lock;
|
|
132276
132425
|
try {
|
|
@@ -132314,7 +132463,7 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
|
|
|
132314
132463
|
}
|
|
132315
132464
|
let bundledManifest;
|
|
132316
132465
|
try {
|
|
132317
|
-
const bundledPath =
|
|
132466
|
+
const bundledPath = join44(extractionDir, ...lockPath2.split("/"), "package.json");
|
|
132318
132467
|
bundledManifest = JSON.parse(readFileSync39(bundledPath, "utf8"));
|
|
132319
132468
|
} catch (cause) {
|
|
132320
132469
|
throw new Error(`the verified artifact has an unreadable bundled dependency ${lockPath2}: ${message(cause)}`);
|
|
@@ -132388,7 +132537,7 @@ import { randomBytes as randomBytes8 } from "node:crypto";
|
|
|
132388
132537
|
import { closeSync as closeSync5, constants as constants2, fstatSync, mkdtempSync as mkdtempSync4, openSync as openSync5, readFileSync as readFileSync40, readSync, rmSync as rmSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync25 } from "node:fs";
|
|
132389
132538
|
import { createServer } from "node:http";
|
|
132390
132539
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
132391
|
-
import { join as
|
|
132540
|
+
import { join as join45 } from "node:path";
|
|
132392
132541
|
function refuse2(cause) {
|
|
132393
132542
|
error(`Update refused: ${message2(cause)}.`);
|
|
132394
132543
|
info(`To install the latest release with npm instead, run: ${teal(NPM_UPDATE_COMMAND)}`);
|
|
@@ -132396,7 +132545,7 @@ function refuse2(cause) {
|
|
|
132396
132545
|
}
|
|
132397
132546
|
function currentVersion2() {
|
|
132398
132547
|
try {
|
|
132399
|
-
const pkg = JSON.parse(readFileSync40(
|
|
132548
|
+
const pkg = JSON.parse(readFileSync40(join45(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
|
|
132400
132549
|
return pkg.version;
|
|
132401
132550
|
} catch {
|
|
132402
132551
|
return "0.0.0";
|
|
@@ -132535,10 +132684,10 @@ async function serveArtifactSnapshot(artifact) {
|
|
|
132535
132684
|
}
|
|
132536
132685
|
async function installVerifiedTarball(tarballPath, tempDir, release2) {
|
|
132537
132686
|
const ambientEnvironment = { ...process.env };
|
|
132538
|
-
const packageDir =
|
|
132539
|
-
const cacheDir =
|
|
132540
|
-
const userConfigPath =
|
|
132541
|
-
const globalConfigPath =
|
|
132687
|
+
const packageDir = join45(tempDir, "authenticated-package");
|
|
132688
|
+
const cacheDir = join45(tempDir, "empty-cache");
|
|
132689
|
+
const userConfigPath = join45(tempDir, "user-npmrc");
|
|
132690
|
+
const globalConfigPath = join45(tempDir, "global-npmrc");
|
|
132542
132691
|
writeFileSync25(userConfigPath, "", { mode: 384 });
|
|
132543
132692
|
writeFileSync25(globalConfigPath, "", { mode: 384 });
|
|
132544
132693
|
const artifact = snapshotAuthenticatedArtifact(tarballPath);
|
|
@@ -132610,8 +132759,8 @@ async function runUpdate(opts, dependencies = {}) {
|
|
|
132610
132759
|
const provenance = await fetchJson(fetchImpl, release2.attestationUrl, "the official npm provenance endpoint");
|
|
132611
132760
|
await (dependencies.verifyProvenance ?? verifyPublishedProvenance)(provenance, release2);
|
|
132612
132761
|
const tarball = await downloadTarball(fetchImpl, release2);
|
|
132613
|
-
tempDir = mkdtempSync4(
|
|
132614
|
-
const tarballPath =
|
|
132762
|
+
tempDir = mkdtempSync4(join45(tmpdir2(), "somewhere-update-"));
|
|
132763
|
+
const tarballPath = join45(tempDir, `cli-${release2.version}.tgz`);
|
|
132615
132764
|
writeFileSync25(tarballPath, tarball, { mode: 384 });
|
|
132616
132765
|
info(`Cryptographically verified provenance and integrity for ${CLI_PACKAGE}@${release2.version}.`);
|
|
132617
132766
|
info(`Updating ${CLI_PACKAGE} from its authenticated dependency lock \u2026`);
|
|
@@ -135043,9 +135192,9 @@ var init_form_auth = __esm({
|
|
|
135043
135192
|
});
|
|
135044
135193
|
|
|
135045
135194
|
// dist/lib/test-response-capture.js
|
|
135046
|
-
import { randomUUID as
|
|
135195
|
+
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
135047
135196
|
function privateMarker() {
|
|
135048
|
-
return "sw-test-" +
|
|
135197
|
+
return "sw-test-" + randomUUID11();
|
|
135049
135198
|
}
|
|
135050
135199
|
function captureResponses(page) {
|
|
135051
135200
|
const pending = [];
|
|
@@ -135092,11 +135241,11 @@ var init_test_response_capture = __esm({
|
|
|
135092
135241
|
});
|
|
135093
135242
|
|
|
135094
135243
|
// dist/lib/app-test.js
|
|
135095
|
-
import { randomUUID as
|
|
135244
|
+
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
135096
135245
|
import { setDefaultResultOrder } from "node:dns";
|
|
135097
135246
|
import { lookup } from "node:dns/promises";
|
|
135098
135247
|
import { existsSync as existsSync38, mkdirSync as mkdirSync20, readFileSync as readFileSync42, writeFileSync as writeFileSync26 } from "node:fs";
|
|
135099
|
-
import { basename as
|
|
135248
|
+
import { basename as basename10, dirname as dirname15, join as join46, relative as relative12, resolve as resolve24 } from "node:path";
|
|
135100
135249
|
function launchOptions(extra = {}) {
|
|
135101
135250
|
return { ...extra, args: ["--disable-features=AsyncDns", ...extra.args ?? []] };
|
|
135102
135251
|
}
|
|
@@ -135146,7 +135295,7 @@ function undeployedChanges(root, projectId, preview = false) {
|
|
|
135146
135295
|
return null;
|
|
135147
135296
|
base = { project_id: record3.project_id, release_id: record3.preview_id, files: record3.files };
|
|
135148
135297
|
} else {
|
|
135149
|
-
const path3 =
|
|
135298
|
+
const path3 = join46(root, ".somewhere", "base-files.json");
|
|
135150
135299
|
if (!existsSync38(path3))
|
|
135151
135300
|
return null;
|
|
135152
135301
|
base = JSON.parse(readFileSync42(path3, "utf8"));
|
|
@@ -135314,12 +135463,12 @@ var init_app_test = __esm({
|
|
|
135314
135463
|
const [ipv4First] = await Promise.all([testAddressOrder(target.origin), lookup(new URL(target.origin).hostname).catch(() => null)]);
|
|
135315
135464
|
if (ipv4First)
|
|
135316
135465
|
setDefaultResultOrder("ipv4first");
|
|
135317
|
-
process.env.SW_TEST_RUN ??=
|
|
135466
|
+
process.env.SW_TEST_RUN ??= randomUUID12();
|
|
135318
135467
|
process.env.SW_TEST_ORIGIN = target.origin;
|
|
135319
135468
|
for (const line of describeSweep(await sweepAccounts(control, root), "Before this script"))
|
|
135320
135469
|
process.stderr.write(line + "\n");
|
|
135321
|
-
const scriptName = process.argv[1] ?
|
|
135322
|
-
const app = new _AppTest(root, control, resolve24(root, options2.results ??
|
|
135470
|
+
const scriptName = process.argv[1] ? basename10(process.argv[1]).replace(/\.[cm]?[jt]s$/, "") : "app-check";
|
|
135471
|
+
const app = new _AppTest(root, control, resolve24(root, options2.results ?? join46(".somewhere", `${scriptName}${preview ? "-preview" : ""}.json`)));
|
|
135323
135472
|
return app;
|
|
135324
135473
|
}
|
|
135325
135474
|
/** What this run tests: the project, environment, preview, origin and script. */
|
|
@@ -135501,7 +135650,7 @@ page ${i + 1}: ${state}`).join("");
|
|
|
135501
135650
|
}
|
|
135502
135651
|
const passed = this.checks.filter((check) => check.ok).length;
|
|
135503
135652
|
const failed = this.checks.filter((check) => !check.ok && !check.skipped).length;
|
|
135504
|
-
mkdirSync20(
|
|
135653
|
+
mkdirSync20(dirname15(this.resultsPath), { recursive: true });
|
|
135505
135654
|
writeFileSync26(this.resultsPath, JSON.stringify({
|
|
135506
135655
|
identity: this.identity(),
|
|
135507
135656
|
origin: this.origin,
|
|
@@ -136093,7 +136242,7 @@ var init_reference_check_note = __esm({
|
|
|
136093
136242
|
// dist/lib/test-scripts.js
|
|
136094
136243
|
import { createRequire as createRequire10 } from "node:module";
|
|
136095
136244
|
import { existsSync as existsSync39, mkdirSync as mkdirSync21, readFileSync as readFileSync43, readdirSync as readdirSync8, rmSync as rmSync17, statSync as statSync8, writeFileSync as writeFileSync27 } from "node:fs";
|
|
136096
|
-
import { dirname as
|
|
136245
|
+
import { dirname as dirname16, join as join47, relative as relative13, resolve as resolve25 } from "node:path";
|
|
136097
136246
|
import { spawn as spawn7, spawnSync as spawnSync5 } from "node:child_process";
|
|
136098
136247
|
function hasSpecFiles(root) {
|
|
136099
136248
|
const walk2 = /* @__PURE__ */ __name((dir) => {
|
|
@@ -136102,24 +136251,24 @@ function hasSpecFiles(root) {
|
|
|
136102
136251
|
for (const entry of readdirSync8(dir, { withFileTypes: true })) {
|
|
136103
136252
|
if (entry.name === "node_modules" || entry.name.startsWith("."))
|
|
136104
136253
|
continue;
|
|
136105
|
-
const path3 =
|
|
136254
|
+
const path3 = join47(dir, entry.name);
|
|
136106
136255
|
if (entry.isDirectory() ? walk2(path3) : /\.spec\.ts$/.test(entry.name))
|
|
136107
136256
|
return true;
|
|
136108
136257
|
}
|
|
136109
136258
|
return false;
|
|
136110
136259
|
}, "walk");
|
|
136111
|
-
return walk2(
|
|
136260
|
+
return walk2(join47(root, "tests"));
|
|
136112
136261
|
}
|
|
136113
136262
|
function listScripts(root, files) {
|
|
136114
136263
|
if (files.length)
|
|
136115
136264
|
return files.map((file) => relative13(root, resolve25(root, file)));
|
|
136116
|
-
const dir =
|
|
136265
|
+
const dir = join47(root, "tests");
|
|
136117
136266
|
if (!existsSync39(dir))
|
|
136118
136267
|
return [];
|
|
136119
|
-
return readdirSync8(dir).filter((name) => isScript(name) && statSync8(
|
|
136268
|
+
return readdirSync8(dir).filter((name) => isScript(name) && statSync8(join47(dir, name)).isFile()).sort().map((name) => join47("tests", name));
|
|
136120
136269
|
}
|
|
136121
136270
|
function scriptBrowserEnv(root) {
|
|
136122
|
-
const require6 = createRequire10(
|
|
136271
|
+
const require6 = createRequire10(join47(root, "package.json"));
|
|
136123
136272
|
let cli;
|
|
136124
136273
|
try {
|
|
136125
136274
|
cli = require6.resolve("@playwright/test/cli");
|
|
@@ -136130,7 +136279,7 @@ function scriptBrowserEnv(root) {
|
|
|
136130
136279
|
const probe = spawnSync5(process.execPath, ["-e", "require(process.argv[1]).chromium.launch().then(b => b.close()).then(() => process.exit(0), () => process.exit(3))", require6.resolve("@playwright/test")], { env, stdio: "ignore" });
|
|
136131
136280
|
if (probe.status === 0)
|
|
136132
136281
|
return env;
|
|
136133
|
-
env.PLAYWRIGHT_BROWSERS_PATH ??=
|
|
136282
|
+
env.PLAYWRIGHT_BROWSERS_PATH ??= join47(cliConfigDir(), "cache", "playwright");
|
|
136134
136283
|
process.stderr.write("Installing Playwright Chromium in the CLI cache (once).\n");
|
|
136135
136284
|
const install = spawnSync5(process.execPath, [cli, "install", "chromium"], { stdio: "inherit", env });
|
|
136136
136285
|
if (install.status !== 0)
|
|
@@ -136153,7 +136302,7 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
|
|
|
136153
136302
|
env = testImportEnv(root, env);
|
|
136154
136303
|
const results = [];
|
|
136155
136304
|
for (const script of scripts) {
|
|
136156
|
-
if (!existsSync39(
|
|
136305
|
+
if (!existsSync39(join47(root, script))) {
|
|
136157
136306
|
results.push({ script, ok: false, exitCode: 1, ms: 0, reason: "no such file" });
|
|
136158
136307
|
continue;
|
|
136159
136308
|
}
|
|
@@ -136162,8 +136311,8 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
|
|
|
136162
136311
|
`);
|
|
136163
136312
|
const started = performance.now();
|
|
136164
136313
|
let output = "";
|
|
136165
|
-
const handOver =
|
|
136166
|
-
mkdirSync21(
|
|
136314
|
+
const handOver = join47(root, ".somewhere", "tests", `report-${results.length}.json`);
|
|
136315
|
+
mkdirSync21(dirname16(handOver), { recursive: true });
|
|
136167
136316
|
rmSync17(handOver, { force: true });
|
|
136168
136317
|
const askedForBrowserLog = /(^|,)\s*(pw:browser|pw:\*|\*)\s*(,|$)/.test(env.DEBUG ?? "");
|
|
136169
136318
|
const childEnv = { ...env, SW_TEST_REPORT: handOver, DEBUG: askedForBrowserLog ? env.DEBUG : [env.DEBUG, "pw:browser"].filter(Boolean).join(",") };
|
|
@@ -136225,7 +136374,7 @@ function describeScriptResults(results, options2 = {}) {
|
|
|
136225
136374
|
return results.some((result) => result.browserCrashed) ? lines.map((line) => line.startsWith("Next: ") ? `Next: give the browser access as the FAIL line says, then run ${TEST_COMMAND} again.` : line) : lines;
|
|
136226
136375
|
}
|
|
136227
136376
|
function lastFailedScripts(root) {
|
|
136228
|
-
const path3 =
|
|
136377
|
+
const path3 = join47(root, LAST);
|
|
136229
136378
|
if (!existsSync39(path3))
|
|
136230
136379
|
return [];
|
|
136231
136380
|
try {
|
|
@@ -136235,10 +136384,10 @@ function lastFailedScripts(root) {
|
|
|
136235
136384
|
}
|
|
136236
136385
|
}
|
|
136237
136386
|
function recordScriptResults(root, results, rerunOnly) {
|
|
136238
|
-
const previous = rerunOnly && existsSync39(
|
|
136387
|
+
const previous = rerunOnly && existsSync39(join47(root, LAST)) ? JSON.parse(readFileSync43(join47(root, LAST), "utf8")).results ?? [] : [];
|
|
136239
136388
|
const merged = [...previous.filter((p2) => !results.some((r) => r.script === p2.script)), ...results];
|
|
136240
|
-
mkdirSync21(
|
|
136241
|
-
writeFileSync27(
|
|
136389
|
+
mkdirSync21(join47(root, ".somewhere", "tests"), { recursive: true });
|
|
136390
|
+
writeFileSync27(join47(root, LAST), JSON.stringify({ finished: (/* @__PURE__ */ new Date()).toISOString(), results: merged }, null, 2) + "\n");
|
|
136242
136391
|
}
|
|
136243
136392
|
var BROWSER_CRASH, BROWSER_CRASH_REASON, isScript, LAST;
|
|
136244
136393
|
var init_test_scripts = __esm({
|
|
@@ -136256,7 +136405,7 @@ var init_test_scripts = __esm({
|
|
|
136256
136405
|
__name(failureReason, "failureReason");
|
|
136257
136406
|
__name(runScripts, "runScripts");
|
|
136258
136407
|
__name(describeScriptResults, "describeScriptResults");
|
|
136259
|
-
LAST =
|
|
136408
|
+
LAST = join47(".somewhere", "tests", "scripts-last.json");
|
|
136260
136409
|
__name(lastFailedScripts, "lastFailedScripts");
|
|
136261
136410
|
__name(recordScriptResults, "recordScriptResults");
|
|
136262
136411
|
}
|
|
@@ -136352,7 +136501,7 @@ var init_test = __esm({
|
|
|
136352
136501
|
|
|
136353
136502
|
// dist/commands/test-users.js
|
|
136354
136503
|
import { existsSync as existsSync40, readFileSync as readFileSync44, rmSync as rmSync18 } from "node:fs";
|
|
136355
|
-
import { basename as
|
|
136504
|
+
import { basename as basename11, join as join48 } from "node:path";
|
|
136356
136505
|
import { randomBytes as randomBytes9 } from "node:crypto";
|
|
136357
136506
|
async function resolveTarget(projectOpt, originOpt) {
|
|
136358
136507
|
const root = process.cwd();
|
|
@@ -136453,7 +136602,7 @@ function registerTestUsers(program2) {
|
|
|
136453
136602
|
const record3 = /* @__PURE__ */ __name((spec, issued, receivedAt) => {
|
|
136454
136603
|
const times = expiryOf(issued, receivedAt);
|
|
136455
136604
|
const file = `${spec.name}.state.json`;
|
|
136456
|
-
writePrivateFile(
|
|
136605
|
+
writePrivateFile(join48(dir, file), JSON.stringify(buildStorageState(target.origin, target.host, issued, times), null, 2) + "\n");
|
|
136457
136606
|
const actor = {
|
|
136458
136607
|
name: spec.name,
|
|
136459
136608
|
user_id: issued.user.id,
|
|
@@ -136551,11 +136700,11 @@ function registerTestUsers(program2) {
|
|
|
136551
136700
|
if (opts.linkOut) {
|
|
136552
136701
|
if (!newest.magic_link)
|
|
136553
136702
|
throw Object.assign(new Error("The newest message has no magic link."), { code: "NO_MAGIC_LINK" });
|
|
136554
|
-
const name =
|
|
136703
|
+
const name = basename11(opts.linkOut);
|
|
136555
136704
|
if (name !== opts.linkOut || !/^[A-Za-z0-9._-]{1,64}$/.test(name))
|
|
136556
136705
|
throw new Error(`--link-out takes a file name; it is written under ${TEST_STATE_DIR}/.`);
|
|
136557
136706
|
ensurePrivateDir(stateDir(target.root));
|
|
136558
|
-
writePrivateFile(
|
|
136707
|
+
writePrivateFile(join48(stateDir(target.root), name), newest.magic_link + "\n");
|
|
136559
136708
|
linkFile = `${TEST_STATE_DIR}/${name}`;
|
|
136560
136709
|
}
|
|
136561
136710
|
const message3 = {
|
|
@@ -136626,12 +136775,12 @@ function registerTestUsers(program2) {
|
|
|
136626
136775
|
local_state: { removed: localRemoved, kept: manifest.actors.map((actor) => actor.state_file).filter((file) => !localRemoved.includes(file)) },
|
|
136627
136776
|
actors: manifest.actors.map(({ name, user_id, email: email2, role, created_at }) => ({ name, user_id, email: email2, role, created_at }))
|
|
136628
136777
|
};
|
|
136629
|
-
writePrivateFile(
|
|
136778
|
+
writePrivateFile(join48(stateDir(target.root), CLEANUP_RECEIPT_FILE), JSON.stringify(receipt, null, 2) + "\n");
|
|
136630
136779
|
const left = manifest.actors.filter((actor) => !removed.includes(actor.user_id));
|
|
136631
136780
|
if (left.length)
|
|
136632
136781
|
writeManifest(target.root, { ...manifest, actors: left, status: "partial" });
|
|
136633
136782
|
else
|
|
136634
|
-
rmSync18(
|
|
136783
|
+
rmSync18(join48(stateDir(target.root), MANIFEST_FILE), { force: true });
|
|
136635
136784
|
if (opts.json) {
|
|
136636
136785
|
printJson(receipt);
|
|
136637
136786
|
if (left.length)
|
|
@@ -136671,7 +136820,7 @@ var init_test_users = __esm({
|
|
|
136671
136820
|
});
|
|
136672
136821
|
|
|
136673
136822
|
// dist/commands/support.js
|
|
136674
|
-
import { join as
|
|
136823
|
+
import { join as join49 } from "node:path";
|
|
136675
136824
|
function commandPaths(program2) {
|
|
136676
136825
|
const paths = /* @__PURE__ */ new Set();
|
|
136677
136826
|
const walk2 = /* @__PURE__ */ __name((command, prefix) => {
|
|
@@ -136756,7 +136905,7 @@ function emitPacket(packet, opts) {
|
|
|
136756
136905
|
if (opts.out) {
|
|
136757
136906
|
if (!/^[A-Za-z0-9._-]{1,64}$/.test(opts.out))
|
|
136758
136907
|
throw new Error("--out takes a plain file name in the current folder.");
|
|
136759
|
-
writePrivateFile(
|
|
136908
|
+
writePrivateFile(join49(process.cwd(), opts.out), JSON.stringify(packet, null, 2) + "\n");
|
|
136760
136909
|
}
|
|
136761
136910
|
if (opts.json) {
|
|
136762
136911
|
printJson(packet);
|
|
@@ -137047,10 +137196,10 @@ var init_startup_notice = __esm({
|
|
|
137047
137196
|
|
|
137048
137197
|
// dist/lib/last-run.js
|
|
137049
137198
|
import { lstatSync as lstatSync6, mkdirSync as mkdirSync22, renameSync as renameSync7, unlinkSync as unlinkSync6, writeFileSync as writeFileSync28 } from "node:fs";
|
|
137050
|
-
import { join as
|
|
137199
|
+
import { join as join50 } from "node:path";
|
|
137051
137200
|
function removeStaleRunRecord(dir = cliConfigDir()) {
|
|
137052
137201
|
for (const name of RUN_RECORD_FILES) {
|
|
137053
|
-
const path3 =
|
|
137202
|
+
const path3 = join50(dir, name);
|
|
137054
137203
|
try {
|
|
137055
137204
|
if (lstatSync6(path3).isDirectory()) {
|
|
137056
137205
|
process.stderr.write(`Could not remove ${path3}: it is a directory, not this CLI's run record. Check it yourself.
|
|
@@ -137090,8 +137239,8 @@ function recordLastRun(cliVersion) {
|
|
|
137090
137239
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
137091
137240
|
cli_version: cliVersion
|
|
137092
137241
|
};
|
|
137093
|
-
const path3 =
|
|
137094
|
-
const temporary =
|
|
137242
|
+
const path3 = join50(dir, "last-run.json");
|
|
137243
|
+
const temporary = join50(dir, "last-run.json.tmp");
|
|
137095
137244
|
writeFileSync28(temporary, JSON.stringify(record3) + "\n", { mode: 384 });
|
|
137096
137245
|
renameSync7(temporary, path3);
|
|
137097
137246
|
} catch {
|
|
@@ -137130,7 +137279,7 @@ __export(dist_exports, {
|
|
|
137130
137279
|
});
|
|
137131
137280
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
137132
137281
|
import { readFileSync as readFileSync46 } from "node:fs";
|
|
137133
|
-
import { join as
|
|
137282
|
+
import { join as join51 } from "node:path";
|
|
137134
137283
|
async function runCli() {
|
|
137135
137284
|
const pinned = decidePin(process.cwd(), CLI_VERSION2, process.argv, process.env);
|
|
137136
137285
|
if (pinned.notice)
|
|
@@ -137158,7 +137307,7 @@ async function runCli() {
|
|
|
137158
137307
|
process.exit(child.status ?? 1);
|
|
137159
137308
|
}
|
|
137160
137309
|
removeStaleRunRecord();
|
|
137161
|
-
const pkg = JSON.parse(readFileSync46(
|
|
137310
|
+
const pkg = JSON.parse(readFileSync46(join51(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
|
|
137162
137311
|
const program2 = new Command().name(cliInvocation()).description(`CLI for somewhere.cloud. Run ${cliInvocation()} init first, then read generated AGENTS.md: call shapes and access patterns for a typical app; docs are for exceptions.`).version(pkg.version);
|
|
137163
137312
|
recordLastRun(pkg.version);
|
|
137164
137313
|
const jsonOutputRequested = process.argv.includes("--json");
|
|
@@ -137576,7 +137725,7 @@ var init_screenshot_guard = __esm({
|
|
|
137576
137725
|
|
|
137577
137726
|
// dist/lib/playwright-fixtures.js
|
|
137578
137727
|
import { createRequire as createRequire11 } from "node:module";
|
|
137579
|
-
import { join as
|
|
137728
|
+
import { join as join52 } from "node:path";
|
|
137580
137729
|
function waitOnNavigation(page) {
|
|
137581
137730
|
async function wait(options2) {
|
|
137582
137731
|
if (options2?.waitUntil === "commit")
|
|
@@ -137628,7 +137777,7 @@ async function previewControlForWorker() {
|
|
|
137628
137777
|
function runner() {
|
|
137629
137778
|
if (loaded)
|
|
137630
137779
|
return loaded;
|
|
137631
|
-
const require6 = createRequire11(
|
|
137780
|
+
const require6 = createRequire11(join52(process.cwd(), "package.json"));
|
|
137632
137781
|
let pw;
|
|
137633
137782
|
try {
|
|
137634
137783
|
pw = require6("@playwright/test");
|