@hyperframes/parsers 0.9.34 → 0.9.36
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/assetResolution.d.ts +2 -1
- package/dist/assetResolution.js +6 -1
- package/dist/ffBinaries.d.ts +1 -3
- package/dist/ffBinaries.js +19 -41
- package/package.json +2 -2
|
@@ -50,6 +50,7 @@ declare function cleanAssetUrl(url: string): string;
|
|
|
50
50
|
declare function isWithinProjectRoot(projectDir: string, candidate: string, pathModule?: PathModuleLike): boolean;
|
|
51
51
|
declare function resolveLocalAssetCandidates(projectDir: string, url: string): string[];
|
|
52
52
|
declare function namesAnotherNetworkRoot(base: string, target: string): boolean;
|
|
53
|
+
declare function srcOnAnotherNetworkRoot(projectDir: string, src: string): boolean;
|
|
53
54
|
/** The project file a data-composition-src names, as the preview reads it; null when it leaves the project. */
|
|
54
55
|
declare function resolveCompositionSrc(projectDir: string, src: string): string | null;
|
|
55
56
|
declare function localAbsoluteAssetFile(projectDir: string, src: string): string | null;
|
|
@@ -77,4 +78,4 @@ declare const readTextFile: (path: string) => string;
|
|
|
77
78
|
/** Reads through one descriptor, so the file-type check and the read see the same file. */
|
|
78
79
|
declare function readProjectFile(path: string): ProjectFileRead;
|
|
79
80
|
|
|
80
|
-
export { type ProjectFileRead, cleanAssetUrl, collectSubCompositionSrcs, decodeTextHonoringBom, hasUnresolvedTemplatingToken, isRemoteOrInlineUrl, isUnresolvedAssetPlaceholder, isWithinProjectRoot, localAbsoluteAssetFile, maskNonScannableRanges, namesAnotherNetworkRoot, readProjectFile, readTextFile, resolveAuthoredAssetFile, resolveCompositionSrc, resolveExistingLocalAsset, resolveLocalAssetCandidates, resolveProjectRelativeSrc };
|
|
81
|
+
export { type ProjectFileRead, cleanAssetUrl, collectSubCompositionSrcs, decodeTextHonoringBom, hasUnresolvedTemplatingToken, isRemoteOrInlineUrl, isUnresolvedAssetPlaceholder, isWithinProjectRoot, localAbsoluteAssetFile, maskNonScannableRanges, namesAnotherNetworkRoot, readProjectFile, readTextFile, resolveAuthoredAssetFile, resolveCompositionSrc, resolveExistingLocalAsset, resolveLocalAssetCandidates, resolveProjectRelativeSrc, srcOnAnotherNetworkRoot };
|
package/dist/assetResolution.js
CHANGED
|
@@ -210,6 +210,10 @@ function namesAnotherNetworkRoot(base, target) {
|
|
|
210
210
|
const root = parse(resolve3(target)).root;
|
|
211
211
|
return /^[\\/]{2}/.test(root) && root.toLowerCase() !== parse(resolve3(base)).root.toLowerCase();
|
|
212
212
|
}
|
|
213
|
+
function srcOnAnotherNetworkRoot(projectDir, src) {
|
|
214
|
+
const path = fileUrlAsPath(cleanAssetUrl(src));
|
|
215
|
+
return isAbsolute2(path) && namesAnotherNetworkRoot(projectDir, path);
|
|
216
|
+
}
|
|
213
217
|
var LEADING_PARENT_SEGMENT = /^\.\.(?:[\\/]|$)/;
|
|
214
218
|
function staysInsideProject(projectDir, path) {
|
|
215
219
|
const relativePath = relative2(resolve3(projectDir), path);
|
|
@@ -338,5 +342,6 @@ export {
|
|
|
338
342
|
resolveCompositionSrc,
|
|
339
343
|
resolveExistingLocalAsset,
|
|
340
344
|
resolveLocalAssetCandidates,
|
|
341
|
-
resolveProjectRelativeSrc
|
|
345
|
+
resolveProjectRelativeSrc,
|
|
346
|
+
srcOnAnotherNetworkRoot
|
|
342
347
|
};
|
package/dist/ffBinaries.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ declare function isTrustedDirectory(dir: string): boolean;
|
|
|
4
4
|
declare function isTrustedExecutablePath(file: string): boolean;
|
|
5
5
|
/** The PATH folders a helper program may come from, in PATH order. */
|
|
6
6
|
declare function trustedPathDirs(pathValue?: string): string[];
|
|
7
|
-
/** Windows walks PATH itself: `where` lists the working directory first. Elsewhere `which`
|
|
8
|
-
* answers, and an untrusted first hit falls through to the PATH walk. */
|
|
9
7
|
declare function findTrustedExecutable(name: string): string | undefined;
|
|
10
8
|
|
|
11
9
|
/**
|
|
@@ -32,7 +30,7 @@ interface FindFfBinaryOptions {
|
|
|
32
30
|
}
|
|
33
31
|
/**
|
|
34
32
|
* Resolve an FFmpeg-family binary: env override first, then a native
|
|
35
|
-
*
|
|
33
|
+
* in-process PATH scan, then well-known Unix install dirs,
|
|
36
34
|
* then an `@ffmpeg-installer`/`@ffprobe-installer` package installed next to HyperFrames.
|
|
37
35
|
* Discovery never returns a file in the working directory (see trustedExecutable.ts).
|
|
38
36
|
* A found binary is cached for the process lifetime; a miss only for a few
|
package/dist/ffBinaries.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
// src/ffBinaries.ts
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
accessSync as accessSync2,
|
|
4
|
+
closeSync,
|
|
5
|
+
constants as constants2,
|
|
6
|
+
existsSync as existsSync2,
|
|
7
|
+
openSync,
|
|
8
|
+
readSync,
|
|
9
|
+
statSync as statSync2
|
|
10
|
+
} from "fs";
|
|
4
11
|
import { createRequire } from "module";
|
|
5
12
|
import { basename, dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
6
13
|
|
|
7
14
|
// src/trustedExecutable.ts
|
|
8
|
-
import {
|
|
9
|
-
import { accessSync, constants, existsSync, realpathSync } from "fs";
|
|
15
|
+
import { accessSync, constants, existsSync, realpathSync, statSync } from "fs";
|
|
10
16
|
import { homedir } from "os";
|
|
11
17
|
import { delimiter, dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
12
18
|
function comparable(path) {
|
|
@@ -32,8 +38,12 @@ function isTrustedDirectory(dir) {
|
|
|
32
38
|
function isTrustedExecutablePath(file) {
|
|
33
39
|
return isAbsolute(file) && isTrustedDirectory(dirname(file));
|
|
34
40
|
}
|
|
41
|
+
function expandHome(dir) {
|
|
42
|
+
if (process.platform === "win32" || !(dir === "~" || dir.startsWith("~/"))) return dir;
|
|
43
|
+
return join(homedir(), dir.slice(1));
|
|
44
|
+
}
|
|
35
45
|
function trustedPathDirs(pathValue = process.env.PATH ?? "") {
|
|
36
|
-
const entries = pathValue.split(delimiter);
|
|
46
|
+
const entries = pathValue.split(delimiter).map(expandHome);
|
|
37
47
|
return [...new Set(entries.filter((dir) => isTrustedDirectory(dir)))];
|
|
38
48
|
}
|
|
39
49
|
function windowsExtensions() {
|
|
@@ -44,12 +54,12 @@ function isExecutableFile(file) {
|
|
|
44
54
|
if (process.platform === "win32") return existsSync(file);
|
|
45
55
|
try {
|
|
46
56
|
accessSync(file, constants.X_OK);
|
|
47
|
-
return
|
|
57
|
+
return statSync(file).isFile();
|
|
48
58
|
} catch {
|
|
49
59
|
return false;
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
|
-
function
|
|
62
|
+
function findTrustedExecutable(name) {
|
|
53
63
|
const extensions = process.platform === "win32" ? windowsExtensions() : [""];
|
|
54
64
|
for (const dir of trustedPathDirs()) {
|
|
55
65
|
for (const ext of extensions) {
|
|
@@ -59,21 +69,6 @@ function scanTrustedPath(name) {
|
|
|
59
69
|
}
|
|
60
70
|
return void 0;
|
|
61
71
|
}
|
|
62
|
-
function findTrustedExecutable(name) {
|
|
63
|
-
if (process.platform === "win32") return scanTrustedPath(name);
|
|
64
|
-
let listed;
|
|
65
|
-
try {
|
|
66
|
-
listed = execFileSync("which", [name], {
|
|
67
|
-
encoding: "utf-8",
|
|
68
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
69
|
-
timeout: 5e3
|
|
70
|
-
}).split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
71
|
-
} catch {
|
|
72
|
-
return void 0;
|
|
73
|
-
}
|
|
74
|
-
if (!listed) return void 0;
|
|
75
|
-
return isTrustedExecutablePath(listed) ? listed : scanTrustedPath(name);
|
|
76
|
-
}
|
|
77
72
|
|
|
78
73
|
// src/ffBinaries.ts
|
|
79
74
|
var FFMPEG_PATH_ENV = "HYPERFRAMES_FFMPEG_PATH";
|
|
@@ -125,7 +120,7 @@ function isExecutablePathCandidate(candidate) {
|
|
|
125
120
|
if (process.platform === "win32") return existsSync2(candidate);
|
|
126
121
|
try {
|
|
127
122
|
accessSync2(candidate, constants2.X_OK);
|
|
128
|
-
return runsOnThisMac(candidate);
|
|
123
|
+
return statSync2(candidate).isFile() && runsOnThisMac(candidate);
|
|
129
124
|
} catch {
|
|
130
125
|
return false;
|
|
131
126
|
}
|
|
@@ -178,24 +173,7 @@ function findInInstallerPackage(name) {
|
|
|
178
173
|
return candidate && isTrustedExecutablePath(candidate) && isExecutablePathCandidate(candidate) ? candidate : void 0;
|
|
179
174
|
}
|
|
180
175
|
function searchSystem(name) {
|
|
181
|
-
|
|
182
|
-
if (process.platform === "win32") {
|
|
183
|
-
found = scanPath(name);
|
|
184
|
-
} else {
|
|
185
|
-
try {
|
|
186
|
-
const output = execFileSync2("which", [name], {
|
|
187
|
-
encoding: "utf-8",
|
|
188
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
189
|
-
timeout: 5e3
|
|
190
|
-
});
|
|
191
|
-
const candidate = chooseBestPathCandidate(name, output.split(/\r?\n/));
|
|
192
|
-
found = candidate && isTrustedExecutablePath(candidate) && isExecutablePathCandidate(candidate) ? candidate : scanPath(name);
|
|
193
|
-
} catch {
|
|
194
|
-
found = scanPath(name);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
found ??= findInCommonDirsOrInstallerPackage(name);
|
|
198
|
-
return found;
|
|
176
|
+
return scanPath(name) ?? findInCommonDirsOrInstallerPackage(name);
|
|
199
177
|
}
|
|
200
178
|
function lookupOnSystem(name) {
|
|
201
179
|
const cached = pathLookupCache.get(name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/parsers",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.36",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tsx": "^4.21.0",
|
|
140
140
|
"typescript": "^5.0.0",
|
|
141
141
|
"vitest": "^4.1.11",
|
|
142
|
-
"@hyperframes/core": "0.9.
|
|
142
|
+
"@hyperframes/core": "0.9.36"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|
|
145
145
|
"build": "tsup",
|