Skip to content

Write HTML. Render video. Built for agents.

refactor(parsers): share local-asset resolution across lint and studio-server

Miguel Angel Simon Sierra053e1274b10e
diff --git a/packages/lint/src/hevcPreviewLint.ts b/packages/lint/src/hevcPreviewLint.ts
index db1c2e5361..0dcf0a15e3 100644
--- a/packages/lint/src/hevcPreviewLint.ts
+++ b/packages/lint/src/hevcPreviewLint.ts
@@ -6,7 +6,7 @@ import {
isRemoteOrInlineUrl,
maskNonScannableRanges,
resolveExistingLocalAsset,
-} from "./assetResolution.js";
+} from "@hyperframes/parsers/asset-resolution";
import type { HyperframeLintFinding } from "./types.js";
/** Structurally compatible with `project.ts`'s (unexported) `HtmlSource` —
diff --git a/packages/lint/src/project.ts b/packages/lint/src/project.ts
index 12d27de920..5bf28713e1 100644
--- a/packages/lint/src/project.ts
+++ b/packages/lint/src/project.ts
@@ -11,7 +11,7 @@ import {
maskNonScannableRanges,
resolveExistingLocalAsset,
resolveLocalAssetCandidates,
-} from "./assetResolution.js";
+} from "@hyperframes/parsers/asset-resolution";
import { collectLocalVideoCandidates, lintHevcPreviewCodec } from "./hevcPreviewLint.js";
import { lintHyperframeHtml } from "./hyperframeLinter.js";
import type { HyperframeLintFinding, HyperframeLintResult } from "./types.js";
diff --git a/packages/parsers/package.json b/packages/parsers/package.json
index 28ebb30cec..7171352ba5 100644
--- a/packages/parsers/package.json
+++ b/packages/parsers/package.json
@@ -99,6 +99,12 @@
"node": "./dist/ffBinaries.js",
"import": "./src/ffBinaries.ts",
"types": "./src/ffBinaries.ts"
+ },
+ "./asset-resolution": {
+ "bun": "./src/assetResolution.ts",
+ "node": "./dist/assetResolution.js",
+ "import": "./src/assetResolution.ts",
+ "types": "./src/assetResolution.ts"
}
},
"publishConfig": {
@@ -160,6 +166,10 @@
"./ff-binaries": {
"import": "./dist/ffBinaries.js",
"types": "./dist/ffBinaries.d.ts"
+ },
+ "./asset-resolution": {
+ "import": "./dist/assetResolution.js",
+ "types": "./dist/assetResolution.d.ts"
}
},
"main": "./dist/index.js",
diff --git a/packages/lint/src/assetResolution.ts b/packages/parsers/src/assetResolution.ts
similarity index 86%
rename from packages/lint/src/assetResolution.ts
rename to packages/parsers/src/assetResolution.ts
index 4ff76a1411..f05895a300 100644
--- a/packages/lint/src/assetResolution.ts
+++ b/packages/parsers/src/assetResolution.ts
@@ -1,13 +1,12 @@
import { existsSync } from "node:fs";
import { isAbsolute, posix, relative, resolve } from "node:path";
-import { decodeUrlPathVariants } from "@hyperframes/parsers/composition";
+import { decodeUrlPathVariants } from "./composition.js";
/**
- * Shared local-asset resolution helpers used by both the project-level lint
- * rules (`project.ts`) and the HEVC preview-codec check
- * (`hevcPreviewLint.ts`). Split out so the latter doesn't need to import from
- * `project.ts` (which imports it back to run the rule) — that would be a
- * circular import within the package.
+ * Shared local-asset resolution helpers for every package that maps
+ * composition asset URLs to files on disk (lint project rules, the HEVC
+ * preview check, studio-server's media codec scan). Import via the
+ * `@hyperframes/parsers/asset-resolution` subpath.
*/
export function isRemoteOrInlineUrl(url: string): boolean {
diff --git a/packages/parsers/tsup.config.ts b/packages/parsers/tsup.config.ts
index 79cf04267f..43ace519d9 100644
--- a/packages/parsers/tsup.config.ts
+++ b/packages/parsers/tsup.config.ts
@@ -16,6 +16,7 @@ export default defineConfig({
compositionContract: "src/compositionContract.ts",
subCompositionValidity: "src/subCompositionValidity.ts",
ffBinaries: "src/ffBinaries.ts",
+ assetResolution: "src/assetResolution.ts",
},
format: ["esm"],
outDir: "dist",