@hyperframes/parsers 0.9.58 → 0.9.59
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/ffBinaries.d.ts +1 -1
- package/dist/ffBinaries.js +3 -1
- package/dist/privatePath.d.ts +15 -0
- package/dist/privatePath.js +101 -0
- package/package.json +6 -2
package/dist/ffBinaries.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ declare function clearFfBinaryLookupCache(): void;
|
|
|
50
50
|
declare const SELF_CONTAINED_FORMATS = "mov,matroska,mxf,avi,mpeg,mpegts,mpegvideo,flv,asf,ogg,wav,mp3,aac,flac,aiff,gif,image2,png_pipe,jpeg_pipe,webp_pipe,bmp_pipe,tiff_pipe";
|
|
51
51
|
/** Tests feed a `-demuxers` listing so none spawns a binary; no argument forgets it. */
|
|
52
52
|
declare function _setDemuxerListingForTests(listing?: string): void;
|
|
53
|
-
/** Every demuxer `listingBinary` reports that opens nothing by itself; one that cannot be asked gets the self-contained list, and is asked again. */
|
|
53
|
+
/** Every demuxer `listingBinary` reports that opens nothing by itself and is not text art; one that cannot be asked gets the self-contained list, and is asked again. */
|
|
54
54
|
declare function mediaInputFormatArgs(listingBinary: string): string[];
|
|
55
55
|
|
|
56
56
|
export { FFMPEG_PATH_ENV, FFPROBE_PATH_ENV, type FfBinaryName, type FindFfBinaryOptions, SELF_CONTAINED_FORMATS, _setDemuxerListingForTests, clearFfBinaryLookupCache, executableIn, findFfBinary, findTrustedExecutable, getSkippedX86Binary, isTrustedDirectory, isTrustedExecutablePath, isX86OnlyMachO, mediaInputFormatArgs, pathEntries, requireFfBinary, trustedPathDirs };
|
package/dist/ffBinaries.js
CHANGED
|
@@ -291,6 +291,7 @@ var PATH_OPENING_DEMUXERS = /* @__PURE__ */ new Set([
|
|
|
291
291
|
"vapoursynth",
|
|
292
292
|
"lavfi"
|
|
293
293
|
]);
|
|
294
|
+
var TEXT_ART_DEMUXERS = /* @__PURE__ */ new Set(["tty", "bin", "xbin", "idf", "adf"]);
|
|
294
295
|
function demuxersFromListing(listing) {
|
|
295
296
|
const row = /Is a device/.test(listing) ? /^ D[E ]([d ]) (\S+)/ : /^ D[E ]() (\S+)/;
|
|
296
297
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -298,7 +299,8 @@ function demuxersFromListing(listing) {
|
|
|
298
299
|
const match = row.exec(line);
|
|
299
300
|
if (!match || match[1] === "d") continue;
|
|
300
301
|
const aliases = match[2].split(",");
|
|
301
|
-
if (aliases.some((alias) => PATH_OPENING_DEMUXERS.has(alias)))
|
|
302
|
+
if (aliases.some((alias) => PATH_OPENING_DEMUXERS.has(alias) || TEXT_ART_DEMUXERS.has(alias)))
|
|
303
|
+
continue;
|
|
302
304
|
for (const alias of aliases) names.add(alias);
|
|
303
305
|
}
|
|
304
306
|
return names.size > 0 ? [...names].join(",") : void 0;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segments as a case-insensitive file system or Windows opens them: any case or Unicode form (a long s, a ligature or a
|
|
3
|
+
* full-width letter reads as its plain letters, an invisible character is dropped), no trailing dots or spaces, no
|
|
4
|
+
* `:stream` suffix.
|
|
5
|
+
*/
|
|
6
|
+
declare function projectPathSegments(relPath: string): string[];
|
|
7
|
+
declare function isVcsOrSecretPath(relPath: string): boolean;
|
|
8
|
+
/** Credential files and tool or agent state, for a project-relative path in any spelling Windows opens. */
|
|
9
|
+
declare function isCredentialOrToolStatePath(relPath: string): boolean;
|
|
10
|
+
/** Files no composition loads, in any spelling Windows opens: git, env, credentials, tool state, app records. */
|
|
11
|
+
declare function isStudioPrivatePath(relPath: string): boolean;
|
|
12
|
+
/** Whether `isPrivate` holds for a file under `projectDir`, spelled as given or with its links resolved. */
|
|
13
|
+
declare function isPrivateFileUnder(projectDir: string, filePath: string, isPrivate: (relPath: string) => boolean): boolean;
|
|
14
|
+
|
|
15
|
+
export { isCredentialOrToolStatePath, isPrivateFileUnder, isStudioPrivatePath, isVcsOrSecretPath, projectPathSegments };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// src/privatePath.ts
|
|
2
|
+
import { realpathSync } from "fs";
|
|
3
|
+
import { isAbsolute, relative, resolve, sep } from "path";
|
|
4
|
+
function realpath(path) {
|
|
5
|
+
try {
|
|
6
|
+
return realpathSync.native(path);
|
|
7
|
+
} catch (error) {
|
|
8
|
+
if (error.code === "EISDIR") return realpathSync(path);
|
|
9
|
+
throw error;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function projectPathSegments(relPath) {
|
|
13
|
+
return relPath.normalize("NFKC").toUpperCase().toLowerCase().replace(new RegExp("\\p{Default_Ignorable_Code_Point}", "gu"), "").split(/[\\/]/).map((segment) => withoutTrailingDotsOrSpaces(segment.split(":", 1)[0] ?? ""));
|
|
14
|
+
}
|
|
15
|
+
function withoutTrailingDotsOrSpaces(segment) {
|
|
16
|
+
let end = segment.length;
|
|
17
|
+
while (end > 0 && (segment[end - 1] === "." || segment[end - 1] === " ")) end--;
|
|
18
|
+
return segment.slice(0, end);
|
|
19
|
+
}
|
|
20
|
+
function isVcsOrSecretPath(relPath) {
|
|
21
|
+
return projectPathSegments(relPath).some(
|
|
22
|
+
(segment) => segment === ".git" || segment.startsWith(".env")
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
var STUDIO_FILES = /* @__PURE__ */ new Set([
|
|
26
|
+
".hyperframes/studio-motion.json",
|
|
27
|
+
".hyperframes/studio-manual-edits.json"
|
|
28
|
+
]);
|
|
29
|
+
var STUDIO_FOLDERS = [".hyperframes/prepared-assets", ".hyperframes/requests"];
|
|
30
|
+
var CREDENTIAL_FILES = /* @__PURE__ */ new Set([
|
|
31
|
+
".npmrc",
|
|
32
|
+
".yarnrc",
|
|
33
|
+
".yarnrc.yml",
|
|
34
|
+
".pypirc",
|
|
35
|
+
"pip.conf",
|
|
36
|
+
"pip.ini",
|
|
37
|
+
".netrc",
|
|
38
|
+
"_netrc",
|
|
39
|
+
".git-credentials",
|
|
40
|
+
".gitconfig",
|
|
41
|
+
".mcp.json"
|
|
42
|
+
]);
|
|
43
|
+
var CREDENTIAL_FOLDERS = /* @__PURE__ */ new Set([
|
|
44
|
+
".ssh",
|
|
45
|
+
".aws",
|
|
46
|
+
".gnupg",
|
|
47
|
+
".docker",
|
|
48
|
+
".kube",
|
|
49
|
+
".azure",
|
|
50
|
+
".claude",
|
|
51
|
+
".codex",
|
|
52
|
+
".cursor",
|
|
53
|
+
".agents",
|
|
54
|
+
".gemini",
|
|
55
|
+
".vscode",
|
|
56
|
+
".idea"
|
|
57
|
+
]);
|
|
58
|
+
var CREDENTIAL_CONFIG_FOLDERS = /* @__PURE__ */ new Set(["gcloud", "gh"]);
|
|
59
|
+
var KEY_FILE = /^(?:id_(?:rsa|dsa|ecdsa|ed25519).*|.*\.(?:pem|key|p12|pfx|p8|ppk|jks|keystore|kdbx))$/;
|
|
60
|
+
var SECRET_STORE_FILE = /\.(?:tfstate(?:\.backup)?|tfvars(?:\.json)?)$/;
|
|
61
|
+
function isCredentialOrToolStatePath(relPath) {
|
|
62
|
+
const segments = projectPathSegments(relPath);
|
|
63
|
+
const name = segments.at(-1) ?? "";
|
|
64
|
+
return CREDENTIAL_FILES.has(name) || KEY_FILE.test(name) || SECRET_STORE_FILE.test(name) || segments.some(
|
|
65
|
+
(segment, at) => CREDENTIAL_FOLDERS.has(segment) || segment === ".config" && CREDENTIAL_CONFIG_FOLDERS.has(segments[at + 1] ?? "")
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function isStudioPrivatePath(relPath) {
|
|
69
|
+
if (isVcsOrSecretPath(relPath) || isCredentialOrToolStatePath(relPath)) return true;
|
|
70
|
+
const segments = projectPathSegments(relPath);
|
|
71
|
+
const inside = !isAbsolute(relPath) && !/^\.\.[. ]*$/.test(relPath.split(/[\\/]/, 1)[0] ?? "");
|
|
72
|
+
const loadedType = LOADED_ASSET_TYPE.test(segments.at(-1) ?? "");
|
|
73
|
+
return segments.some((segment, at) => {
|
|
74
|
+
const atRoot = segments.slice(0, at).every((before) => before === "");
|
|
75
|
+
if (segment === ".hyperframes")
|
|
76
|
+
return !atRoot || !isStudioOwnFile(segments.slice(at).join("/"));
|
|
77
|
+
const mediaFolder = atRoot && segment === MEDIA_FOLDER;
|
|
78
|
+
return inside && segment.startsWith(".") && !mediaFolder && !loadedType;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
var MEDIA_FOLDER = ".media";
|
|
82
|
+
var LOADED_ASSET_TYPE = /.\.(?:png|jpe?g|gif|webp|avif|svg|ico|bmp|tiff?|heic|heif|mp4|m4v|mov|webm|mkv|mxf|avi|mp3|wav|m4a|aac|ogg|oga|opus|flac|woff2?|ttf|otf|css|m?js|cjs)$/;
|
|
83
|
+
function isStudioOwnFile(path) {
|
|
84
|
+
return STUDIO_FILES.has(path) || STUDIO_FOLDERS.some((folder) => path === folder || path.startsWith(`${folder}/`));
|
|
85
|
+
}
|
|
86
|
+
function isPrivateFileUnder(projectDir, filePath, isPrivate) {
|
|
87
|
+
const rel = (from, to) => relative(from, to).split(sep).join("/");
|
|
88
|
+
if (isPrivate(rel(resolve(projectDir), resolve(filePath)))) return true;
|
|
89
|
+
try {
|
|
90
|
+
return isPrivate(rel(realpath(resolve(projectDir)), realpath(filePath)));
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
isCredentialOrToolStatePath,
|
|
97
|
+
isPrivateFileUnder,
|
|
98
|
+
isStudioPrivatePath,
|
|
99
|
+
isVcsOrSecretPath,
|
|
100
|
+
projectPathSegments
|
|
101
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/parsers",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.59",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -104,6 +104,10 @@
|
|
|
104
104
|
"import": "./dist/assetResolution.js",
|
|
105
105
|
"types": "./dist/assetResolution.d.ts"
|
|
106
106
|
},
|
|
107
|
+
"./private-path": {
|
|
108
|
+
"import": "./dist/privatePath.js",
|
|
109
|
+
"types": "./dist/privatePath.d.ts"
|
|
110
|
+
},
|
|
107
111
|
"./html-attribute-spans": {
|
|
108
112
|
"import": "./dist/htmlAttributeSpans.js",
|
|
109
113
|
"types": "./dist/htmlAttributeSpans.d.ts"
|
|
@@ -143,7 +147,7 @@
|
|
|
143
147
|
"tsx": "^4.21.0",
|
|
144
148
|
"typescript": "^5.0.0",
|
|
145
149
|
"vitest": "^4.1.12",
|
|
146
|
-
"@hyperframes/core": "0.9.
|
|
150
|
+
"@hyperframes/core": "0.9.59"
|
|
147
151
|
},
|
|
148
152
|
"scripts": {
|
|
149
153
|
"build": "tsup",
|