@hyperframes/parsers 0.9.91 → 0.9.92

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.
@@ -181,10 +181,11 @@ function collectSubCompositionSrcs(html) {
181
181
  function cleanAssetUrl(url) {
182
182
  return url.trim().split(/[?#]/, 1)[0] ?? "";
183
183
  }
184
+ var LEADING_PARENT_SEGMENT = /^\.\.(?:[\\/]|$)/;
184
185
  function isWithinProjectRoot(projectDir, candidate, pathModule = { resolve: resolve3, relative: relative2, isAbsolute: isAbsolute2 }) {
185
186
  const projectRoot = pathModule.resolve(projectDir);
186
187
  const relativePath = pathModule.relative(projectRoot, candidate);
187
- return relativePath === "" || !relativePath.startsWith("..") && !pathModule.isAbsolute(relativePath);
188
+ return !LEADING_PARENT_SEGMENT.test(relativePath) && !pathModule.isAbsolute(relativePath);
188
189
  }
189
190
  function addCandidate(candidates, candidate) {
190
191
  if (!candidates.includes(candidate)) candidates.push(candidate);
@@ -222,17 +223,12 @@ function srcOnAnotherNetworkRoot(projectDir, src) {
222
223
  const path = fileUrlAsPath(cleanAssetUrl(src));
223
224
  return isAbsolute2(path) && namesAnotherNetworkRoot(projectDir, path);
224
225
  }
225
- var LEADING_PARENT_SEGMENT = /^\.\.(?:[\\/]|$)/;
226
- function staysInsideProject(projectDir, path) {
227
- const relativePath = relative2(resolve3(projectDir), path);
228
- return !LEADING_PARENT_SEGMENT.test(relativePath) && !isAbsolute2(relativePath);
229
- }
230
226
  function resolveCompositionSrc(projectDir, src) {
231
227
  const rooted = (value) => resolve3(projectDir, value.replace(/^(?:\.?[\\/])+/, ""));
232
228
  const decoded = rooted(decodedUrlPath(src));
233
- if (!staysInsideProject(projectDir, decoded)) return null;
229
+ if (!isWithinProjectRoot(projectDir, decoded)) return null;
234
230
  const raw = rooted(src);
235
- return !existsSync(decoded) && staysInsideProject(projectDir, raw) && existsSync(raw) ? raw : decoded;
231
+ return !existsSync(decoded) && isWithinProjectRoot(projectDir, raw) && existsSync(raw) ? raw : decoded;
236
232
  }
237
233
  function localAbsoluteAssetFile(projectDir, src) {
238
234
  const path = cleanAssetUrl(src);
@@ -286,7 +282,8 @@ function resolveProjectRelativeSrc(src, baseDir, compiledDir) {
286
282
  if (compiledDir) candidates.add(join2(compiledDir, variant));
287
283
  candidates.add(join2(baseDir, variant));
288
284
  }
289
- return [...candidates].find(existsSync) ?? gitBashFile(cleanSrc) ?? join2(baseDir, cleanSrc);
285
+ const inside = (path) => isWithinProjectRoot(baseDir, path) || compiledDir !== void 0 && isWithinProjectRoot(compiledDir, path);
286
+ return [...candidates].filter(inside).find(existsSync) ?? gitBashFile(cleanSrc) ?? join2(baseDir, cleanSrc);
290
287
  }
291
288
  function maskRange(src, pattern) {
292
289
  return src.replace(pattern, (m) => " ".repeat(m.length));
@@ -56,7 +56,7 @@ declare function concatListText(entries: readonly (string | {
56
56
  */
57
57
  declare function concatListInputArgs(concatListPath: string): string[];
58
58
  /** What a render service lets a media input open: containers that name no other file. */
59
- 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";
59
+ declare const SELF_CONTAINED_FORMATS = "mov,matroska,mxf,avi,mpeg,mpegts,mpegvideo,flv,asf,ogg,wav,mp3,aac,flac,aiff,caf,w64,wv,au,ac3,gif,image2,png_pipe,jpeg_pipe,webp_pipe,bmp_pipe,tiff_pipe";
60
60
  /** Tests feed a `-demuxers` listing so none spawns a binary; no argument forgets it. */
61
61
  declare function _setDemuxerListingForTests(listing?: string): void;
62
62
  declare function localContainerInputArgs(container: "mov" | "matroska" | undefined): string[];
@@ -324,7 +324,7 @@ function concatListInputArgs(concatListPath) {
324
324
  concatListPath
325
325
  ];
326
326
  }
327
- var 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";
327
+ var SELF_CONTAINED_FORMATS = "mov,matroska,mxf,avi,mpeg,mpegts,mpegvideo,flv,asf,ogg,wav,mp3,aac,flac,aiff,caf,w64,wv,au,ac3,gif,image2,png_pipe,jpeg_pipe,webp_pipe,bmp_pipe,tiff_pipe";
328
328
  var PATH_OPENING_DEMUXERS = /* @__PURE__ */ new Set([
329
329
  "dash",
330
330
  "imf",
@@ -76,8 +76,9 @@ function isStudioPrivatePath(relPath) {
76
76
  const inside = !isAbsolute(relPath) && !/^\.\.[. ]*$/.test(relPath.split(/[\\/]/, 1)[0] ?? "");
77
77
  const name = segments.at(-1) ?? "";
78
78
  const loadedType = !name.startsWith(".") && LOADED_ASSET_TYPE.test(name);
79
+ const firstNamed = segments.findIndex((segment) => segment !== "");
79
80
  return segments.some((segment, at) => {
80
- const atRoot = segments.slice(0, at).every((before) => before === "");
81
+ const atRoot = firstNamed === -1 || at <= firstNamed;
81
82
  if (segment === ".hyperframes")
82
83
  return !atRoot || !isStudioOwnFile(segments.slice(at).join("/"));
83
84
  if (BUILD_OUTPUT_FOLDERS.has(segment)) return inside;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/parsers",
3
- "version": "0.9.91",
3
+ "version": "0.9.92",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -151,7 +151,7 @@
151
151
  "tsx": "^4.21.0",
152
152
  "typescript": "^5.0.0",
153
153
  "vitest": "^4.1.12",
154
- "@hyperframes/core": "0.9.91"
154
+ "@hyperframes/core": "0.9.92"
155
155
  },
156
156
  "scripts": {
157
157
  "build": "tsup",