@wix/himalaya-cli 0.991.0 → 0.992.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +78 -12
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -18867,7 +18867,6 @@ function shouldRevealError(args) {
|
|
|
18867
18867
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
|
|
18868
18868
|
var init_validation = __esm({
|
|
18869
18869
|
"../../core/ts/src/validation.ts"() {
|
|
18870
|
-
"use strict";
|
|
18871
18870
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
18872
18871
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
18873
18872
|
INTEGER_RE = /^[+-]?[0-9]+$/;
|
|
@@ -22292,7 +22291,6 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
|
|
|
22292
22291
|
var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
|
|
22293
22292
|
var init_worker_subtree = __esm({
|
|
22294
22293
|
"../../core/ts/src/worker-subtree.ts"() {
|
|
22295
|
-
"use strict";
|
|
22296
22294
|
init_worker_subtree_safe_types_generated();
|
|
22297
22295
|
WORKER_SUBTREE_CEILINGS = Object.freeze({
|
|
22298
22296
|
maxEncodedBytes: 65536,
|
|
@@ -54515,7 +54513,7 @@ var init_site_oauth_client = __esm({
|
|
|
54515
54513
|
|
|
54516
54514
|
// src/cli.ts
|
|
54517
54515
|
import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync65, mkdirSync as mkdirSync25, writeFileSync as writeFileSync23, existsSync as existsSync54, rmSync as rmSync9, readdirSync as readdirSync25, statSync as statSync12, lstatSync as lstatSync6, accessSync, constants } from "node:fs";
|
|
54518
|
-
import { execFileSync as execFileSync7, spawnSync as spawnSync5 } from "node:child_process";
|
|
54516
|
+
import { execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn5 } from "node:child_process";
|
|
54519
54517
|
import { createHash as createHash24, randomUUID as randomUUID3 } from "node:crypto";
|
|
54520
54518
|
import { tmpdir as tmpdir5, homedir as homedir7, hostname } from "node:os";
|
|
54521
54519
|
import { join as join51, resolve as resolve42, relative as relative8, basename as basename11, dirname as dirname30 } from "node:path";
|
|
@@ -58885,8 +58883,11 @@ async function fetchPackumentFrom(registry, fetchImpl, timeoutMs) {
|
|
|
58885
58883
|
}
|
|
58886
58884
|
}
|
|
58887
58885
|
async function fetchCliPackument(fetchImpl = fetch, timeoutMs = DOCTOR_TIMEOUT_MS, env = process.env, scopedRegistry = npmScopedWixRegistry) {
|
|
58886
|
+
const deadline = Date.now() + timeoutMs;
|
|
58888
58887
|
for (const registry of registryCandidates(env, scopedRegistry())) {
|
|
58889
|
-
const
|
|
58888
|
+
const remaining = deadline - Date.now();
|
|
58889
|
+
if (remaining <= 0) break;
|
|
58890
|
+
const packument = await fetchPackumentFrom(registry, fetchImpl, remaining);
|
|
58890
58891
|
if (packument) return packument;
|
|
58891
58892
|
}
|
|
58892
58893
|
return void 0;
|
|
@@ -58926,7 +58927,7 @@ function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("
|
|
|
58926
58927
|
}
|
|
58927
58928
|
async function doctorVersionReport(running, fetchImpl = fetch, sdk = resolvedSdkVersion(), scopedRegistry = npmScopedWixRegistry) {
|
|
58928
58929
|
const minimumSdk = "0.33.0";
|
|
58929
|
-
const packument = await fetchCliPackument(fetchImpl,
|
|
58930
|
+
const packument = await fetchCliPackument(fetchImpl, UPDATE_EXPLICIT_BUDGET_MS, process.env, scopedRegistry);
|
|
58930
58931
|
const latest = packument?.latest;
|
|
58931
58932
|
const publishedAt = packument?.time[running];
|
|
58932
58933
|
const ageDays = ageInDays(publishedAt);
|
|
@@ -58958,6 +58959,10 @@ var CLI_PACKAGE = "@wix/himalaya-cli";
|
|
|
58958
58959
|
var UNPUBLISHED_CLI_VERSION = "0.1.0";
|
|
58959
58960
|
var UPDATE_MAX_AGE_DAYS = 7;
|
|
58960
58961
|
var UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
58962
|
+
var UPDATE_FOREGROUND_BUDGET_MS = 1500;
|
|
58963
|
+
var UPDATE_EXPLICIT_BUDGET_MS = 2e4;
|
|
58964
|
+
var UPDATE_BACKGROUND_BUDGET_MS = 6e4;
|
|
58965
|
+
var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
|
|
58961
58966
|
var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
|
|
58962
58967
|
var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
|
|
58963
58968
|
function updateCachePath(env = process.env) {
|
|
@@ -58981,7 +58986,7 @@ function writeUpdateCache(path, cache) {
|
|
|
58981
58986
|
function updateCheckSuppression(running, command, env = process.env, cwd = process.cwd()) {
|
|
58982
58987
|
if (env[UPDATE_REEXEC_ENV] === "1") return "already-updated";
|
|
58983
58988
|
if (env.HIMI_NO_UPDATE_CHECK === "1") return "opted-out";
|
|
58984
|
-
if (command === "upgrade" || command === "doctor") return "own-command";
|
|
58989
|
+
if (command === "upgrade" || command === "doctor" || command === UPDATE_REFRESH_COMMAND) return "own-command";
|
|
58985
58990
|
if (running === UNPUBLISHED_CLI_VERSION) return "unpublished";
|
|
58986
58991
|
if (isHimalayaMonorepoCheckout(cwd)) return "monorepo";
|
|
58987
58992
|
return void 0;
|
|
@@ -59015,12 +59020,12 @@ function npmInstallArgs(registry, version2) {
|
|
|
59015
59020
|
return ["i", "-g", `${CLI_PACKAGE}@${version2}`, `--registry=${pinned}`, `--@wix:registry=${pinned}`];
|
|
59016
59021
|
}
|
|
59017
59022
|
var INSTALLABLE_SPEC = /^(?:latest|\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)$/;
|
|
59018
|
-
function createUpdateRunner(
|
|
59023
|
+
function createUpdateRunner(spawn6 = spawnSync5) {
|
|
59019
59024
|
return {
|
|
59020
59025
|
install: async (registry, version2) => {
|
|
59021
59026
|
if (!isTrustedRegistry(registry)) return { ok: false, detail: `refusing untrusted registry ${registry}` };
|
|
59022
59027
|
if (!INSTALLABLE_SPEC.test(version2)) return { ok: false, detail: `refusing install spec ${JSON.stringify(version2)}` };
|
|
59023
|
-
const result =
|
|
59028
|
+
const result = spawn6("npm", npmInstallArgs(registry, version2), {
|
|
59024
59029
|
// npm's stdout goes to OUR stderr: in `himi <cmd> --json | jq` (and `himi upgrade --json`) its
|
|
59025
59030
|
// "added 212 packages" would otherwise land in stdout ahead of the envelope and break the
|
|
59026
59031
|
// parse — the agent case this whole feature exists for (#2985 review). And no stdin: an
|
|
@@ -59169,6 +59174,49 @@ function upgradeEnvelope(outcome) {
|
|
|
59169
59174
|
...outcome.detail ? { detail: outcome.detail } : {}
|
|
59170
59175
|
};
|
|
59171
59176
|
}
|
|
59177
|
+
var UPDATE_REFRESH_COMMAND = "__refresh-update-cache";
|
|
59178
|
+
async function refreshUpdateCache(opts = {}) {
|
|
59179
|
+
const env = opts.env ?? process.env;
|
|
59180
|
+
const running = opts.running ?? cliVersion();
|
|
59181
|
+
const cachePath = opts.cachePath ?? updateCachePath(env);
|
|
59182
|
+
const packument = await fetchCliPackument(opts.fetchImpl ?? fetch, UPDATE_BACKGROUND_BUDGET_MS, env, opts.scopedRegistry);
|
|
59183
|
+
if (!packument) return false;
|
|
59184
|
+
const now = opts.now ?? Date.now();
|
|
59185
|
+
writeUpdateCache(cachePath, {
|
|
59186
|
+
...readUpdateCache(cachePath),
|
|
59187
|
+
running,
|
|
59188
|
+
latest: packument.latest,
|
|
59189
|
+
runningPublishedAt: packument.time[running],
|
|
59190
|
+
checkedAt: new Date(now).toISOString()
|
|
59191
|
+
});
|
|
59192
|
+
return true;
|
|
59193
|
+
}
|
|
59194
|
+
function createUpdateRefreshSpawner(spawnFn = spawn5, execArgv = process.execArgv) {
|
|
59195
|
+
return () => {
|
|
59196
|
+
try {
|
|
59197
|
+
const child = spawnFn(process.execPath, [...loaderArgs(execArgv), fileURLToPath24(import.meta.url), UPDATE_REFRESH_COMMAND], {
|
|
59198
|
+
detached: true,
|
|
59199
|
+
stdio: "ignore",
|
|
59200
|
+
cwd: homedir7(),
|
|
59201
|
+
env: process.env
|
|
59202
|
+
});
|
|
59203
|
+
child.on("error", () => {
|
|
59204
|
+
});
|
|
59205
|
+
child.unref();
|
|
59206
|
+
} catch {
|
|
59207
|
+
}
|
|
59208
|
+
};
|
|
59209
|
+
}
|
|
59210
|
+
function loaderArgs(execArgv) {
|
|
59211
|
+
const out = [];
|
|
59212
|
+
for (let i = 0; i < execArgv.length; i++) {
|
|
59213
|
+
const arg = execArgv[i];
|
|
59214
|
+
if (/^--(import|loader|experimental-loader|require)=/.test(arg)) out.push(arg);
|
|
59215
|
+
else if (/^(--import|--loader|--experimental-loader|--require|-r)$/.test(arg) && i + 1 < execArgv.length) out.push(arg, execArgv[++i]);
|
|
59216
|
+
}
|
|
59217
|
+
return out;
|
|
59218
|
+
}
|
|
59219
|
+
var spawnUpdateRefresh = createUpdateRefreshSpawner();
|
|
59172
59220
|
async function maybeSelfUpdate(argv, io, opts = {}) {
|
|
59173
59221
|
const env = opts.env ?? process.env;
|
|
59174
59222
|
const running = opts.running ?? cliVersion();
|
|
@@ -59186,14 +59234,19 @@ async function maybeSelfUpdate(argv, io, opts = {}) {
|
|
|
59186
59234
|
if (!describesThisBuild) runningPublishedAt = void 0;
|
|
59187
59235
|
let answeredBy;
|
|
59188
59236
|
let answeredLatest;
|
|
59189
|
-
|
|
59190
|
-
|
|
59237
|
+
const attemptedAt = cache.attemptedAt ? Date.parse(cache.attemptedAt) : Number.NaN;
|
|
59238
|
+
const recentlyTried = cache.attemptedFor === running && Number.isFinite(attemptedAt) && now - attemptedAt < UPDATE_RETRY_AFTER_FAILURE_MS;
|
|
59239
|
+
if (!fresh && !recentlyTried) {
|
|
59240
|
+
const packument = await fetchCliPackument(opts.fetchImpl ?? fetch, UPDATE_FOREGROUND_BUDGET_MS, env, opts.scopedRegistry);
|
|
59191
59241
|
if (packument) {
|
|
59192
59242
|
latest = packument.latest;
|
|
59193
59243
|
runningPublishedAt = packument.time[running];
|
|
59194
59244
|
answeredBy = packument.registry;
|
|
59195
59245
|
answeredLatest = packument.latest;
|
|
59196
59246
|
writeUpdateCache(cachePath, { ...cache, running, checkedAt: new Date(now).toISOString(), latest, runningPublishedAt });
|
|
59247
|
+
} else {
|
|
59248
|
+
writeUpdateCache(cachePath, { ...cache, attemptedAt: new Date(now).toISOString(), attemptedFor: running });
|
|
59249
|
+
(opts.spawnRefresh ?? spawnUpdateRefresh)();
|
|
59197
59250
|
}
|
|
59198
59251
|
}
|
|
59199
59252
|
const ageDays = ageInDays(runningPublishedAt, now);
|
|
@@ -59237,7 +59290,7 @@ async function maybeSelfUpdate(argv, io, opts = {}) {
|
|
|
59237
59290
|
}
|
|
59238
59291
|
try {
|
|
59239
59292
|
if (!answeredBy) {
|
|
59240
|
-
const again = await fetchCliPackument(opts.fetchImpl ?? fetch,
|
|
59293
|
+
const again = await fetchCliPackument(opts.fetchImpl ?? fetch, UPDATE_EXPLICIT_BUDGET_MS, env, opts.scopedRegistry);
|
|
59241
59294
|
answeredBy = again?.registry;
|
|
59242
59295
|
answeredLatest = again?.latest;
|
|
59243
59296
|
}
|
|
@@ -64726,6 +64779,11 @@ ${label2}`);
|
|
|
64726
64779
|
});
|
|
64727
64780
|
return 0;
|
|
64728
64781
|
}
|
|
64782
|
+
case UPDATE_REFRESH_COMMAND: {
|
|
64783
|
+
const up = deps.selfUpdate ?? {};
|
|
64784
|
+
await refreshUpdateCache({ env: up.env, fetchImpl: up.fetchImpl, cachePath: up.cachePath, scopedRegistry: up.scopedRegistry, now: up.now, running: up.running });
|
|
64785
|
+
return 0;
|
|
64786
|
+
}
|
|
64729
64787
|
case "upgrade": {
|
|
64730
64788
|
const up = deps.selfUpdate ?? {};
|
|
64731
64789
|
const runner2 = up.runner ?? defaultUpdateRunner;
|
|
@@ -64741,7 +64799,7 @@ ${label2}`);
|
|
|
64741
64799
|
}
|
|
64742
64800
|
try {
|
|
64743
64801
|
const scoped = up.scopedRegistry ?? npmScopedWixRegistry;
|
|
64744
|
-
const answered = await fetchCliPackument(up.fetchImpl ?? fetch,
|
|
64802
|
+
const answered = await fetchCliPackument(up.fetchImpl ?? fetch, UPDATE_EXPLICIT_BUDGET_MS, env, scoped);
|
|
64745
64803
|
const registry = answered?.registry ?? registryCandidates(env, scoped())[0];
|
|
64746
64804
|
if (answered?.latest && compareVersions2(answered.latest, before) <= 0) {
|
|
64747
64805
|
if (flags.json) print({ ok: true, running: before, installed: before, changed: false, registry, latest: answered.latest });
|
|
@@ -65228,6 +65286,10 @@ export {
|
|
|
65228
65286
|
PREVIEW_TOKEN_NOTE,
|
|
65229
65287
|
PUBLIC_NPM_REGISTRY,
|
|
65230
65288
|
PUBLIC_WIX_API_BASE,
|
|
65289
|
+
UPDATE_BACKGROUND_BUDGET_MS,
|
|
65290
|
+
UPDATE_EXPLICIT_BUDGET_MS,
|
|
65291
|
+
UPDATE_FOREGROUND_BUDGET_MS,
|
|
65292
|
+
UPDATE_REFRESH_COMMAND,
|
|
65231
65293
|
WIX_NPM_MIRROR,
|
|
65232
65294
|
acquireUpdateLock,
|
|
65233
65295
|
ageInDays,
|
|
@@ -65235,6 +65297,7 @@ export {
|
|
|
65235
65297
|
buildDoctorReport,
|
|
65236
65298
|
compareVersions2 as compareVersions,
|
|
65237
65299
|
createScopedRegistryResolver,
|
|
65300
|
+
createUpdateRefreshSpawner,
|
|
65238
65301
|
createUpdateRunner,
|
|
65239
65302
|
credentialKind,
|
|
65240
65303
|
credentialSwapNotice,
|
|
@@ -65257,6 +65320,7 @@ export {
|
|
|
65257
65320
|
isLoopbackBase,
|
|
65258
65321
|
isPublicTarget,
|
|
65259
65322
|
isTrustedRegistry,
|
|
65323
|
+
loaderArgs,
|
|
65260
65324
|
loginModeMark,
|
|
65261
65325
|
loginModeReport,
|
|
65262
65326
|
loopbackTargetWarning,
|
|
@@ -65286,6 +65350,7 @@ export {
|
|
|
65286
65350
|
probeReachable,
|
|
65287
65351
|
pushAuthHint,
|
|
65288
65352
|
readUpdateCache,
|
|
65353
|
+
refreshUpdateCache,
|
|
65289
65354
|
registryCandidates,
|
|
65290
65355
|
renderDataSource,
|
|
65291
65356
|
renderDeviceWidths,
|
|
@@ -65297,6 +65362,7 @@ export {
|
|
|
65297
65362
|
serveUnreachableHint,
|
|
65298
65363
|
servesAll,
|
|
65299
65364
|
shellShaDivergenceWarnings,
|
|
65365
|
+
spawnUpdateRefresh,
|
|
65300
65366
|
staleUpdateLockFile,
|
|
65301
65367
|
switchFlagErrors,
|
|
65302
65368
|
templatePreviewAuthError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.992.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"artifactId": "himalaya-cli"
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
"falconPackageHash": "
|
|
68
|
+
"falconPackageHash": "cbd96ed65b504cab0c2d276b2a961b73f9bf6730d07259f3d334a43e"
|
|
69
69
|
}
|