@hyperframes/producer 0.9.83 → 0.9.85
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/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/index.js +45 -6
- package/dist/public-server.js +45 -6
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -2090,13 +2090,44 @@ import {
|
|
|
2090
2090
|
rmSync as rmSync2,
|
|
2091
2091
|
writeFileSync as writeFileSync2
|
|
2092
2092
|
} from "node:fs";
|
|
2093
|
+
import { execFileSync } from "node:child_process";
|
|
2093
2094
|
import { hostname, uptime } from "node:os";
|
|
2094
|
-
import { basename as basename4, dirname as dirname3, join as join5 } from "node:path";
|
|
2095
|
+
import { basename as basename4, dirname as dirname3, join as join5, win32 } from "node:path";
|
|
2095
2096
|
import { RENDER_TEMP_DIR } from "@hyperframes/core/project-folders";
|
|
2096
2097
|
import { createStagingDir } from "@hyperframes/core/atomic-file";
|
|
2097
2098
|
var OWNER_FILE = "owner.json";
|
|
2098
2099
|
var TRANSACTION_BACKUP = "backup";
|
|
2099
2100
|
var RENDER_JOB_DIR = /^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
|
|
2101
|
+
var machineIdRead;
|
|
2102
|
+
function machineId() {
|
|
2103
|
+
const read2 = (file, args, pattern) => {
|
|
2104
|
+
try {
|
|
2105
|
+
const out = execFileSync(file, args, {
|
|
2106
|
+
encoding: "utf-8",
|
|
2107
|
+
timeout: 2e3,
|
|
2108
|
+
windowsHide: true
|
|
2109
|
+
});
|
|
2110
|
+
return pattern.exec(out)?.[1];
|
|
2111
|
+
} catch {
|
|
2112
|
+
return void 0;
|
|
2113
|
+
}
|
|
2114
|
+
};
|
|
2115
|
+
if (machineIdRead?.platform === process.platform) return machineIdRead.id;
|
|
2116
|
+
const systemRoot = process.env.SystemRoot;
|
|
2117
|
+
machineIdRead = {
|
|
2118
|
+
platform: process.platform,
|
|
2119
|
+
id: process.platform === "darwin" ? read2(
|
|
2120
|
+
"/usr/sbin/ioreg",
|
|
2121
|
+
["-rd1", "-c", "IOPlatformExpertDevice"],
|
|
2122
|
+
/"IOPlatformUUID" = "([^"]+)"/
|
|
2123
|
+
) : process.platform === "win32" && systemRoot && /^[A-Za-z]:\\/.test(systemRoot) ? read2(
|
|
2124
|
+
win32.join(systemRoot, "System32", "reg.exe"),
|
|
2125
|
+
["query", "HKLM\\SOFTWARE\\Microsoft\\Cryptography", "/v", "MachineGuid"],
|
|
2126
|
+
/MachineGuid\s+REG_SZ\s+(\S+)/
|
|
2127
|
+
) : void 0
|
|
2128
|
+
};
|
|
2129
|
+
return machineIdRead.id;
|
|
2130
|
+
}
|
|
2100
2131
|
function pidScope() {
|
|
2101
2132
|
const attempt = (read2) => {
|
|
2102
2133
|
try {
|
|
@@ -2105,11 +2136,13 @@ function pidScope() {
|
|
|
2105
2136
|
return void 0;
|
|
2106
2137
|
}
|
|
2107
2138
|
};
|
|
2139
|
+
const bootId = attempt(() => readFileSync2("/proc/sys/kernel/random/boot_id", "utf-8").trim());
|
|
2108
2140
|
return {
|
|
2109
2141
|
host: hostname(),
|
|
2110
|
-
// Without /proc (macOS, Windows) the boot time
|
|
2111
|
-
boot:
|
|
2112
|
-
pidns: attempt(() => readlinkSync2("/proc/self/ns/pid"))
|
|
2142
|
+
// Without /proc (macOS, Windows) the boot time in seconds stands in for the boot id, on this machine's own id.
|
|
2143
|
+
boot: bootId ?? attempt(() => `s:${Math.round(Date.now() / 1e3 - uptime())}`),
|
|
2144
|
+
pidns: attempt(() => readlinkSync2("/proc/self/ns/pid")),
|
|
2145
|
+
machine: bootId === void 0 ? machineId() : void 0
|
|
2113
2146
|
};
|
|
2114
2147
|
}
|
|
2115
2148
|
function createOwnedRenderDir(prefix) {
|
|
@@ -2128,12 +2161,18 @@ function alive(pid) {
|
|
|
2128
2161
|
}
|
|
2129
2162
|
function knownPidScope() {
|
|
2130
2163
|
const scope = pidScope();
|
|
2131
|
-
const unknown = scope.boot === void 0 || process.platform === "linux" && scope.pidns === void 0;
|
|
2164
|
+
const unknown = scope.boot === void 0 || process.platform === "linux" && scope.pidns === void 0 || scope.boot.startsWith("s:") && scope.machine === void 0;
|
|
2132
2165
|
return unknown ? void 0 : scope;
|
|
2133
2166
|
}
|
|
2167
|
+
function sameBoot(stamped, current) {
|
|
2168
|
+
if (stamped === current) return true;
|
|
2169
|
+
const seconds = (boot) => typeof boot === "string" ? /^s:(\d+)$/.exec(boot)?.[1] : void 0;
|
|
2170
|
+
const [a, b] = [seconds(stamped), seconds(current)];
|
|
2171
|
+
return a !== void 0 && b !== void 0 && Math.abs(Number(a) - Number(b)) <= 2;
|
|
2172
|
+
}
|
|
2134
2173
|
function inThisPidScope(owner) {
|
|
2135
2174
|
const scope = knownPidScope();
|
|
2136
|
-
return scope !== void 0 && owner.host === scope.host && owner.boot
|
|
2175
|
+
return scope !== void 0 && owner.host === scope.host && sameBoot(owner.boot, scope.boot) && owner.pidns === scope.pidns && owner.machine === scope.machine;
|
|
2137
2176
|
}
|
|
2138
2177
|
function ownerState(dir) {
|
|
2139
2178
|
let owner;
|
package/dist/public-server.js
CHANGED
|
@@ -2122,12 +2122,43 @@ import {
|
|
|
2122
2122
|
rmSync as rmSync2,
|
|
2123
2123
|
writeFileSync as writeFileSync2
|
|
2124
2124
|
} from "node:fs";
|
|
2125
|
+
import { execFileSync } from "node:child_process";
|
|
2125
2126
|
import { hostname, uptime } from "node:os";
|
|
2126
|
-
import { basename as basename4, dirname as dirname3, join as join5 } from "node:path";
|
|
2127
|
+
import { basename as basename4, dirname as dirname3, join as join5, win32 } from "node:path";
|
|
2127
2128
|
import { RENDER_TEMP_DIR } from "@hyperframes/core/project-folders";
|
|
2128
2129
|
import { createStagingDir } from "@hyperframes/core/atomic-file";
|
|
2129
2130
|
var OWNER_FILE = "owner.json";
|
|
2130
2131
|
var TRANSACTION_BACKUP = "backup";
|
|
2132
|
+
var machineIdRead;
|
|
2133
|
+
function machineId() {
|
|
2134
|
+
const read2 = (file, args, pattern) => {
|
|
2135
|
+
try {
|
|
2136
|
+
const out = execFileSync(file, args, {
|
|
2137
|
+
encoding: "utf-8",
|
|
2138
|
+
timeout: 2e3,
|
|
2139
|
+
windowsHide: true
|
|
2140
|
+
});
|
|
2141
|
+
return pattern.exec(out)?.[1];
|
|
2142
|
+
} catch {
|
|
2143
|
+
return void 0;
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
if (machineIdRead?.platform === process.platform) return machineIdRead.id;
|
|
2147
|
+
const systemRoot = process.env.SystemRoot;
|
|
2148
|
+
machineIdRead = {
|
|
2149
|
+
platform: process.platform,
|
|
2150
|
+
id: process.platform === "darwin" ? read2(
|
|
2151
|
+
"/usr/sbin/ioreg",
|
|
2152
|
+
["-rd1", "-c", "IOPlatformExpertDevice"],
|
|
2153
|
+
/"IOPlatformUUID" = "([^"]+)"/
|
|
2154
|
+
) : process.platform === "win32" && systemRoot && /^[A-Za-z]:\\/.test(systemRoot) ? read2(
|
|
2155
|
+
win32.join(systemRoot, "System32", "reg.exe"),
|
|
2156
|
+
["query", "HKLM\\SOFTWARE\\Microsoft\\Cryptography", "/v", "MachineGuid"],
|
|
2157
|
+
/MachineGuid\s+REG_SZ\s+(\S+)/
|
|
2158
|
+
) : void 0
|
|
2159
|
+
};
|
|
2160
|
+
return machineIdRead.id;
|
|
2161
|
+
}
|
|
2131
2162
|
function pidScope() {
|
|
2132
2163
|
const attempt = (read2) => {
|
|
2133
2164
|
try {
|
|
@@ -2136,11 +2167,13 @@ function pidScope() {
|
|
|
2136
2167
|
return void 0;
|
|
2137
2168
|
}
|
|
2138
2169
|
};
|
|
2170
|
+
const bootId = attempt(() => readFileSync2("/proc/sys/kernel/random/boot_id", "utf-8").trim());
|
|
2139
2171
|
return {
|
|
2140
2172
|
host: hostname(),
|
|
2141
|
-
// Without /proc (macOS, Windows) the boot time
|
|
2142
|
-
boot:
|
|
2143
|
-
pidns: attempt(() => readlinkSync2("/proc/self/ns/pid"))
|
|
2173
|
+
// Without /proc (macOS, Windows) the boot time in seconds stands in for the boot id, on this machine's own id.
|
|
2174
|
+
boot: bootId ?? attempt(() => `s:${Math.round(Date.now() / 1e3 - uptime())}`),
|
|
2175
|
+
pidns: attempt(() => readlinkSync2("/proc/self/ns/pid")),
|
|
2176
|
+
machine: bootId === void 0 ? machineId() : void 0
|
|
2144
2177
|
};
|
|
2145
2178
|
}
|
|
2146
2179
|
function createOwnedRenderDir(prefix) {
|
|
@@ -2159,12 +2192,18 @@ function alive(pid) {
|
|
|
2159
2192
|
}
|
|
2160
2193
|
function knownPidScope() {
|
|
2161
2194
|
const scope = pidScope();
|
|
2162
|
-
const unknown = scope.boot === void 0 || process.platform === "linux" && scope.pidns === void 0;
|
|
2195
|
+
const unknown = scope.boot === void 0 || process.platform === "linux" && scope.pidns === void 0 || scope.boot.startsWith("s:") && scope.machine === void 0;
|
|
2163
2196
|
return unknown ? void 0 : scope;
|
|
2164
2197
|
}
|
|
2198
|
+
function sameBoot(stamped, current) {
|
|
2199
|
+
if (stamped === current) return true;
|
|
2200
|
+
const seconds = (boot) => typeof boot === "string" ? /^s:(\d+)$/.exec(boot)?.[1] : void 0;
|
|
2201
|
+
const [a, b] = [seconds(stamped), seconds(current)];
|
|
2202
|
+
return a !== void 0 && b !== void 0 && Math.abs(Number(a) - Number(b)) <= 2;
|
|
2203
|
+
}
|
|
2165
2204
|
function inThisPidScope(owner) {
|
|
2166
2205
|
const scope = knownPidScope();
|
|
2167
|
-
return scope !== void 0 && owner.host === scope.host && owner.boot
|
|
2206
|
+
return scope !== void 0 && owner.host === scope.host && sameBoot(owner.boot, scope.boot) && owner.pidns === scope.pidns && owner.machine === scope.machine;
|
|
2168
2207
|
}
|
|
2169
2208
|
function ownerState(dir) {
|
|
2170
2209
|
let owner;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.85",
|
|
4
4
|
"description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"postcss": "^8.4.0",
|
|
36
36
|
"puppeteer": "~25.13.0",
|
|
37
37
|
"puppeteer-core": "^25.13.0",
|
|
38
|
-
"@hyperframes/engine": "0.9.
|
|
39
|
-
"@hyperframes/lint": "0.9.
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/engine": "0.9.85",
|
|
39
|
+
"@hyperframes/lint": "0.9.85",
|
|
40
|
+
"@hyperframes/studio-server": "0.9.85",
|
|
41
|
+
"@hyperframes/core": "0.9.85",
|
|
42
|
+
"@hyperframes/parsers": "0.9.85"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.10",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsx": "^4.21.0",
|
|
49
49
|
"typescript": "^5.7.2",
|
|
50
50
|
"vitest": "^4.1.12",
|
|
51
|
-
"@hyperframes/aws-lambda": "0.9.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.85"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|