frizz 0.7.3 → 0.7.5
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/dev-child.js +246 -195
- package/dist/frizz.js +70 -36
- package/package.json +1 -1
package/dist/frizz.js
CHANGED
|
@@ -495,6 +495,7 @@ var init_logging = __esm({
|
|
|
495
495
|
import { execFileSync } from "node:child_process";
|
|
496
496
|
import { randomUUID } from "node:crypto";
|
|
497
497
|
import { readFileSync } from "node:fs";
|
|
498
|
+
import { join as join4 } from "node:path";
|
|
498
499
|
function errorCode(error) {
|
|
499
500
|
return error && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
500
501
|
}
|
|
@@ -535,6 +536,38 @@ function fixedPsGeneration(pid) {
|
|
|
535
536
|
return null;
|
|
536
537
|
}
|
|
537
538
|
}
|
|
539
|
+
function windowsGeneration(pid) {
|
|
540
|
+
if (!Number.isInteger(pid) || pid <= 0) return null;
|
|
541
|
+
try {
|
|
542
|
+
const shell = join4(
|
|
543
|
+
process.env.SystemRoot ?? "C:\\Windows",
|
|
544
|
+
"System32",
|
|
545
|
+
"WindowsPowerShell",
|
|
546
|
+
"v1.0",
|
|
547
|
+
"powershell.exe"
|
|
548
|
+
);
|
|
549
|
+
const value = execFileSync(shell, [
|
|
550
|
+
"-NoProfile",
|
|
551
|
+
"-NonInteractive",
|
|
552
|
+
"-NoLogo",
|
|
553
|
+
"-Command",
|
|
554
|
+
// A vanished PID, a protected process and an access-denied StartTime all throw. Exit non-zero
|
|
555
|
+
// so execFileSync rejects, rather than letting PowerShell's error prose become a marker.
|
|
556
|
+
`try{[Console]::Out.Write((Get-Process -Id ${pid} -ErrorAction Stop).StartTime.ToFileTimeUtc())}catch{exit 1}`
|
|
557
|
+
], {
|
|
558
|
+
encoding: "utf8",
|
|
559
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
560
|
+
// A wedged spawn must not hold a launcher's poll loop open forever; a timeout reads as
|
|
561
|
+
// unavailable, which retains the owner.
|
|
562
|
+
timeout: 5e3,
|
|
563
|
+
windowsHide: true
|
|
564
|
+
}).trim();
|
|
565
|
+
if (!/^\d{1,20}$/u.test(value)) return null;
|
|
566
|
+
return { processStart: `win32:${value}`, confidence: "exact" };
|
|
567
|
+
} catch {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
538
571
|
function observeDefault(pid) {
|
|
539
572
|
if (!processAlive(pid)) return { confidence: "unavailable" };
|
|
540
573
|
if (process.platform === "linux") {
|
|
@@ -544,6 +577,7 @@ function observeDefault(pid) {
|
|
|
544
577
|
return fallback ?? { confidence: "unavailable" };
|
|
545
578
|
}
|
|
546
579
|
if (process.platform === "darwin") return fixedPsGeneration(pid) ?? { confidence: "unavailable" };
|
|
580
|
+
if (process.platform === "win32") return windowsGeneration(pid) ?? { confidence: "unavailable" };
|
|
547
581
|
return { confidence: "unavailable" };
|
|
548
582
|
}
|
|
549
583
|
function observeProcessGeneration(generation, adapter = defaultProcessPlatformAdapter) {
|
|
@@ -551,7 +585,7 @@ function observeProcessGeneration(generation, adapter = defaultProcessPlatformAd
|
|
|
551
585
|
const self = adapter.current();
|
|
552
586
|
if (generation.pid === self.pid && generation.processStart === self.processStart) return "exact";
|
|
553
587
|
if (generation.processStart.startsWith("opaque:")) return "unavailable";
|
|
554
|
-
if (!/^(?:linux|ps-utc|opaque):/u.test(generation.processStart)) return "unavailable";
|
|
588
|
+
if (!/^(?:linux|ps-utc|win32|opaque):/u.test(generation.processStart)) return "unavailable";
|
|
555
589
|
const observed = adapter.observe(generation.pid);
|
|
556
590
|
if (!observed.processStart || observed.confidence === "unavailable") return "unavailable";
|
|
557
591
|
if (observed.processStart.split(":", 1)[0] !== generation.processStart.split(":", 1)[0]) {
|
|
@@ -607,7 +641,7 @@ import {
|
|
|
607
641
|
writeFileSync as writeFileSync2
|
|
608
642
|
} from "node:fs";
|
|
609
643
|
import { homedir as homedir4 } from "node:os";
|
|
610
|
-
import { dirname as dirname2, join as
|
|
644
|
+
import { dirname as dirname2, join as join5, resolve } from "node:path";
|
|
611
645
|
import { setTimeout as delay } from "node:timers/promises";
|
|
612
646
|
function errorCode2(error) {
|
|
613
647
|
return error && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
@@ -623,10 +657,10 @@ function canonicalHome(home) {
|
|
|
623
657
|
}
|
|
624
658
|
}
|
|
625
659
|
function globalLaunchLockPath(home = homedir4()) {
|
|
626
|
-
return
|
|
660
|
+
return join5(frizzPaths({ home: canonicalHome(home) }).state, GLOBAL_LOCK_NAME);
|
|
627
661
|
}
|
|
628
662
|
function namedLaunchLockPath(home, name) {
|
|
629
|
-
return
|
|
663
|
+
return join5(frizzPaths({ home: canonicalHome(home) }).state, name);
|
|
630
664
|
}
|
|
631
665
|
function pidIsAlive(pid) {
|
|
632
666
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
@@ -654,7 +688,7 @@ function syncDirectory(path) {
|
|
|
654
688
|
}
|
|
655
689
|
function lockOwnerPath(lockPath) {
|
|
656
690
|
try {
|
|
657
|
-
return statSync2(lockPath).isDirectory() ?
|
|
691
|
+
return statSync2(lockPath).isDirectory() ? join5(lockPath, GLOBAL_LOCK_OWNER) : lockPath;
|
|
658
692
|
} catch {
|
|
659
693
|
return lockPath;
|
|
660
694
|
}
|
|
@@ -761,7 +795,7 @@ function tryAcquireGlobalLaunchLock(home, adapter) {
|
|
|
761
795
|
return tryAcquireLock(globalLaunchLockPath(home), adapter);
|
|
762
796
|
}
|
|
763
797
|
function portReservationPath(port, home = homedir4()) {
|
|
764
|
-
return
|
|
798
|
+
return join5(frizzPaths({ home: canonicalHome(home) }).state, PORT_LOCK_DIR, `${port}.lock`);
|
|
765
799
|
}
|
|
766
800
|
function tryReservePort(port, home = homedir4(), adapter = defaultProcessPlatformAdapter) {
|
|
767
801
|
const lockPath = portReservationPath(port, home);
|
|
@@ -842,7 +876,7 @@ function resolveGitWorktree(dir) {
|
|
|
842
876
|
// Do not enable Git's repository-wide `extensions.worktreeConfig` merely to hold one private Frizz
|
|
843
877
|
// value. A config file inside the linked worktree's own administrative directory has Git's atomic
|
|
844
878
|
// config-lock behavior, survives `git worktree move`, and disappears with `git worktree remove`.
|
|
845
|
-
...scope === "worktree" ? { identityConfig:
|
|
879
|
+
...scope === "worktree" ? { identityConfig: join5(gitDir, "frizz.config") } : {}
|
|
846
880
|
};
|
|
847
881
|
}
|
|
848
882
|
function readProjectIdConfig(dir, args2, description) {
|
|
@@ -1022,7 +1056,7 @@ import {
|
|
|
1022
1056
|
statSync as statSync3,
|
|
1023
1057
|
writeFileSync as writeFileSync3
|
|
1024
1058
|
} from "node:fs";
|
|
1025
|
-
import { basename as basename2, dirname as dirname3, isAbsolute, join as
|
|
1059
|
+
import { basename as basename2, dirname as dirname3, isAbsolute, join as join6 } from "node:path";
|
|
1026
1060
|
function errorCode3(error) {
|
|
1027
1061
|
return error && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
1028
1062
|
}
|
|
@@ -1046,7 +1080,7 @@ function syncDirectory2(path) {
|
|
|
1046
1080
|
}
|
|
1047
1081
|
function atomicJson(path, value) {
|
|
1048
1082
|
mkdirSync3(dirname3(path), { recursive: true, mode: 448 });
|
|
1049
|
-
const temp =
|
|
1083
|
+
const temp = join6(dirname3(path), `.${basename2(path)}.${process.pid}.${randomUUID3()}.tmp`);
|
|
1050
1084
|
let fd;
|
|
1051
1085
|
try {
|
|
1052
1086
|
fd = openSync3(temp, "wx", 384);
|
|
@@ -1105,7 +1139,7 @@ function parseGuard(path) {
|
|
|
1105
1139
|
}
|
|
1106
1140
|
}
|
|
1107
1141
|
function acquireMutationGuard(stateDir, timeoutMs = GUARD_TIMEOUT_MS, adapter = defaultProcessPlatformAdapter) {
|
|
1108
|
-
const path =
|
|
1142
|
+
const path = join6(stateDir, MUTATION_GUARD_NAME);
|
|
1109
1143
|
mkdirSync3(stateDir, { recursive: true, mode: 448 });
|
|
1110
1144
|
const deadline = adapter.now() + Math.max(0, timeoutMs);
|
|
1111
1145
|
for (; ; ) {
|
|
@@ -1199,7 +1233,7 @@ function parseOwner(path) {
|
|
|
1199
1233
|
}
|
|
1200
1234
|
}
|
|
1201
1235
|
function projectLaunchOwnerPath(stateDir) {
|
|
1202
|
-
return
|
|
1236
|
+
return join6(stateDir, OWNER_NAME);
|
|
1203
1237
|
}
|
|
1204
1238
|
function readProjectLaunchOwner(stateDir) {
|
|
1205
1239
|
return parseOwner(projectLaunchOwnerPath(stateDir));
|
|
@@ -1216,7 +1250,7 @@ function projectLaunchTokenProof(target2, token) {
|
|
|
1216
1250
|
}
|
|
1217
1251
|
function removeStatusesForToken(stateDir, token) {
|
|
1218
1252
|
for (const name of ["dev-supervisor.lock", "server.lock"]) {
|
|
1219
|
-
const path =
|
|
1253
|
+
const path = join6(stateDir, name);
|
|
1220
1254
|
try {
|
|
1221
1255
|
const value = JSON.parse(readFileSync3(path, "utf8"));
|
|
1222
1256
|
if (value.ownerToken === token) quarantine(path, "stale");
|
|
@@ -1467,9 +1501,9 @@ var init_project_launch = __esm({
|
|
|
1467
1501
|
|
|
1468
1502
|
// packages/server/src/boot-progress.ts
|
|
1469
1503
|
import { mkdirSync as mkdirSync4, readFileSync as readFileSync4, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
1470
|
-
import { basename as basename3, dirname as dirname4, join as
|
|
1504
|
+
import { basename as basename3, dirname as dirname4, join as join7 } from "node:path";
|
|
1471
1505
|
function bootProgressPath(stateDir) {
|
|
1472
|
-
return
|
|
1506
|
+
return join7(stateDir, BOOT_PROGRESS_NAME);
|
|
1473
1507
|
}
|
|
1474
1508
|
function readBootProgress(stateDir) {
|
|
1475
1509
|
try {
|
|
@@ -1492,9 +1526,9 @@ var init_boot_progress = __esm({
|
|
|
1492
1526
|
import { createHash as createHash3, randomUUID as randomUUID4 } from "node:crypto";
|
|
1493
1527
|
import { closeSync as closeSync3, existsSync as existsSync2, fsyncSync as fsyncSync3, mkdirSync as mkdirSync5, openSync as openSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, renameSync as renameSync4, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
1494
1528
|
import { homedir as homedir5 } from "node:os";
|
|
1495
|
-
import { dirname as dirname5, join as
|
|
1529
|
+
import { dirname as dirname5, join as join8, parse, resolve as resolve2 } from "node:path";
|
|
1496
1530
|
function projectIdPath(root) {
|
|
1497
|
-
return
|
|
1531
|
+
return join8(root, FRIZZ_DIR, ID_FILE);
|
|
1498
1532
|
}
|
|
1499
1533
|
function readProjectIdFile(root) {
|
|
1500
1534
|
let raw;
|
|
@@ -1510,9 +1544,9 @@ function readProjectIdFile(root) {
|
|
|
1510
1544
|
}
|
|
1511
1545
|
}
|
|
1512
1546
|
function writeProjectIdFile(root, id) {
|
|
1513
|
-
const dir =
|
|
1547
|
+
const dir = join8(root, FRIZZ_DIR);
|
|
1514
1548
|
mkdirSync5(dir, { recursive: true });
|
|
1515
|
-
const ignore =
|
|
1549
|
+
const ignore = join8(dir, SELF_IGNORE);
|
|
1516
1550
|
if (!existsSync2(ignore)) {
|
|
1517
1551
|
try {
|
|
1518
1552
|
writeFileSync5(ignore, "*\n", { flag: "wx" });
|
|
@@ -1520,7 +1554,7 @@ function writeProjectIdFile(root, id) {
|
|
|
1520
1554
|
}
|
|
1521
1555
|
}
|
|
1522
1556
|
const path = projectIdPath(root);
|
|
1523
|
-
const temp =
|
|
1557
|
+
const temp = join8(dir, `.${ID_FILE}.${process.pid}.${randomUUID4()}.tmp`);
|
|
1524
1558
|
let fd;
|
|
1525
1559
|
try {
|
|
1526
1560
|
fd = openSync4(temp, "wx", 384);
|
|
@@ -1568,7 +1602,7 @@ function isNotAGitWorktree(error) {
|
|
|
1568
1602
|
return /not a git repository/iu.test(stderr) || /must be run in a work ?tree/iu.test(stderr);
|
|
1569
1603
|
}
|
|
1570
1604
|
function hasAny(dir, names) {
|
|
1571
|
-
return names.some((name) => existsSync2(
|
|
1605
|
+
return names.some((name) => existsSync2(join8(dir, name)));
|
|
1572
1606
|
}
|
|
1573
1607
|
function isHomeDirectory(dir, home = homedir5()) {
|
|
1574
1608
|
const canonical = (value) => {
|
|
@@ -15310,9 +15344,9 @@ ${DISPATCH_TASK_BANNER}
|
|
|
15310
15344
|
// packages/server/src/project-registry.ts
|
|
15311
15345
|
import { closeSync as closeSync4, existsSync as existsSync3, fsyncSync as fsyncSync4, mkdirSync as mkdirSync6, openSync as openSync5, readFileSync as readFileSync6, readdirSync as readdirSync2, realpathSync as realpathSync3, renameSync as renameSync5, rmSync as rmSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
15312
15346
|
import { homedir as homedir6 } from "node:os";
|
|
15313
|
-
import { basename as basename4, dirname as dirname6, join as
|
|
15347
|
+
import { basename as basename4, dirname as dirname6, join as join9 } from "node:path";
|
|
15314
15348
|
function registryPath(home = homedir6()) {
|
|
15315
|
-
return
|
|
15349
|
+
return join9(frizzPaths({ home }).data, "registry.json");
|
|
15316
15350
|
}
|
|
15317
15351
|
function readRegistry(home = homedir6()) {
|
|
15318
15352
|
let raw;
|
|
@@ -15401,7 +15435,7 @@ function registerProject(input, home = homedir6()) {
|
|
|
15401
15435
|
writeRegistry(registry, home);
|
|
15402
15436
|
return { entry: byId, action: "reopened" };
|
|
15403
15437
|
}
|
|
15404
|
-
if (existsSync3(
|
|
15438
|
+
if (existsSync3(join9(byId.path, ".frizz", ".id"))) return { action: "duplicate" };
|
|
15405
15439
|
byId.path = input.dir;
|
|
15406
15440
|
byId.lastOpenedAt = at;
|
|
15407
15441
|
writeRegistry(registry, home);
|
|
@@ -15526,7 +15560,7 @@ init_local_origin();
|
|
|
15526
15560
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
15527
15561
|
import { homedir as homedir8 } from "node:os";
|
|
15528
15562
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
15529
|
-
import { join as
|
|
15563
|
+
import { join as join12 } from "node:path";
|
|
15530
15564
|
|
|
15531
15565
|
// src/browser.ts
|
|
15532
15566
|
import { spawn, execFile } from "node:child_process";
|
|
@@ -16326,7 +16360,7 @@ import { execFileSync as execFileSync3 } from "node:child_process";
|
|
|
16326
16360
|
import { createServer } from "node:net";
|
|
16327
16361
|
import { mkdirSync as mkdirSync7, readFileSync as readFileSync7, realpathSync as realpathSync4, writeFileSync as writeFileSync7 } from "node:fs";
|
|
16328
16362
|
import { homedir as homedir7, hostname as osHostname, networkInterfaces } from "node:os";
|
|
16329
|
-
import { basename as basename5, join as
|
|
16363
|
+
import { basename as basename5, join as join10, resolve as resolve3 } from "node:path";
|
|
16330
16364
|
import { setTimeout as delay2 } from "node:timers/promises";
|
|
16331
16365
|
var PORT_SCAN_COUNT = 100;
|
|
16332
16366
|
var LAUNCH_TIMEOUT_MS = 3e4;
|
|
@@ -16624,12 +16658,12 @@ function liveWorkspaceOwner(stateDir, expected2, adapter = defaultProcessPlatfor
|
|
|
16624
16658
|
if (authoritative && processGenerationIsStale(authoritative, adapter))
|
|
16625
16659
|
return null;
|
|
16626
16660
|
return parseStatusFile(
|
|
16627
|
-
|
|
16661
|
+
join10(stateDir, "dev-supervisor.lock"),
|
|
16628
16662
|
authoritative,
|
|
16629
16663
|
expected2,
|
|
16630
16664
|
adapter
|
|
16631
16665
|
) ?? parseStatusFile(
|
|
16632
|
-
|
|
16666
|
+
join10(stateDir, "server.lock"),
|
|
16633
16667
|
authoritative,
|
|
16634
16668
|
expected2,
|
|
16635
16669
|
adapter
|
|
@@ -16638,7 +16672,7 @@ function liveWorkspaceOwner(stateDir, expected2, adapter = defaultProcessPlatfor
|
|
|
16638
16672
|
function readPreferredPort(stateDir) {
|
|
16639
16673
|
try {
|
|
16640
16674
|
const value = JSON.parse(
|
|
16641
|
-
readFileSync7(
|
|
16675
|
+
readFileSync7(join10(stateDir, "launcher.json"), "utf8")
|
|
16642
16676
|
);
|
|
16643
16677
|
return Number.isInteger(value.port) && value.port > 0 && value.port <= 65535 ? value.port : void 0;
|
|
16644
16678
|
} catch {
|
|
@@ -18191,7 +18225,7 @@ var npmRegistryReleaseAdapter = {
|
|
|
18191
18225
|
import { spawnSync } from "node:child_process";
|
|
18192
18226
|
import { chmodSync, statSync as statSync5 } from "node:fs";
|
|
18193
18227
|
import { createRequire } from "node:module";
|
|
18194
|
-
import { dirname as dirname8, join as
|
|
18228
|
+
import { dirname as dirname8, join as join11 } from "node:path";
|
|
18195
18229
|
var SUPPORTED_NODE_LINES = [
|
|
18196
18230
|
{ major: 22, minor: 13 },
|
|
18197
18231
|
{ major: 23, minor: 4 }
|
|
@@ -18242,7 +18276,7 @@ function ensureNativeHelperPermissions(options2 = {}) {
|
|
|
18242
18276
|
const chmod = options2.chmod ?? ((path, mode) => chmodSync(path, mode));
|
|
18243
18277
|
const resolvePty = options2.resolvePty ?? (() => createRequire(import.meta.url).resolve("node-pty/package.json"));
|
|
18244
18278
|
try {
|
|
18245
|
-
const helper =
|
|
18279
|
+
const helper = join11(
|
|
18246
18280
|
dirname8(resolvePty()),
|
|
18247
18281
|
"prebuilds",
|
|
18248
18282
|
`${platform}-${options2.arch ?? process.arch}`,
|
|
@@ -18262,7 +18296,7 @@ init_project_identity();
|
|
|
18262
18296
|
var PACKAGE_NAME = process.env.FRIZZ_REGISTRY_PACKAGE ?? "frizz";
|
|
18263
18297
|
function resolvePackageVersion() {
|
|
18264
18298
|
try {
|
|
18265
|
-
const manifest = JSON.parse(readFileSync10(
|
|
18299
|
+
const manifest = JSON.parse(readFileSync10(join12(import.meta.dirname, "..", "package.json"), "utf8"));
|
|
18266
18300
|
if (typeof manifest.version === "string" && manifest.version.trim()) return manifest.version.trim();
|
|
18267
18301
|
} catch {
|
|
18268
18302
|
}
|
|
@@ -18416,7 +18450,7 @@ async function openOrPrint(port, reused, path = "") {
|
|
|
18416
18450
|
readout?.begin("browser", options.appMode ? "requesting app window" : "requesting default browser");
|
|
18417
18451
|
try {
|
|
18418
18452
|
if (options.appMode) {
|
|
18419
|
-
await launchApp(url, { dataPath:
|
|
18453
|
+
await launchApp(url, { dataPath: join12(workspace.stateDir, "browser-profile") });
|
|
18420
18454
|
browser = reused ? "focused the Frizz app window" : "opened the Frizz app window";
|
|
18421
18455
|
} else {
|
|
18422
18456
|
await launchBrowserTab(url);
|
|
@@ -18480,10 +18514,10 @@ async function runSupervisor(port, token) {
|
|
|
18480
18514
|
target,
|
|
18481
18515
|
owner.token
|
|
18482
18516
|
);
|
|
18483
|
-
const webDist =
|
|
18484
|
-
const runtimeDir =
|
|
18485
|
-
const scriptsDir =
|
|
18486
|
-
const workerPluginDir =
|
|
18517
|
+
const webDist = join12(import.meta.dirname, "..", "web-dist");
|
|
18518
|
+
const runtimeDir = join12(import.meta.dirname, "..", "runtime");
|
|
18519
|
+
const scriptsDir = join12(runtimeDir, "board");
|
|
18520
|
+
const workerPluginDir = join12(runtimeDir, "cc-worker");
|
|
18487
18521
|
const childEntry = fileURLToPath2(new URL("./dev-child.js", import.meta.url));
|
|
18488
18522
|
let plannedUpdate;
|
|
18489
18523
|
let updateAvailable = true;
|