Skip to content

Commit 053e127

Browse files
committed
refactor(parsers): share local-asset resolution across lint and studio-server
Moves assetResolution.ts from packages/lint into @hyperframes/parsers behind a ./asset-resolution subpath export, mirroring the ./ff-binaries shape, and points lint's two importers at it. Pure move: no behavior change. Unblocks studio-server consuming the same helpers without a dependency cycle (the CLI already depends on lint, so importing lint from studio-server is not an option).
1 parent 7980479 commit 053e127

5 files changed

Lines changed: 18 additions & 8 deletions

File tree

‎packages/lint/src/hevcPreviewLint.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
isRemoteOrInlineUrl,
77
maskNonScannableRanges,
88
resolveExistingLocalAsset,
9-
} from "./assetResolution.js";
9+
} from "@hyperframes/parsers/asset-resolution";
1010
import type { HyperframeLintFinding } from "./types.js";
1111

1212
/** Structurally compatible with `project.ts`'s (unexported) `HtmlSource` —

‎packages/lint/src/project.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
maskNonScannableRanges,
1212
resolveExistingLocalAsset,
1313
resolveLocalAssetCandidates,
14-
} from "./assetResolution.js";
14+
} from "@hyperframes/parsers/asset-resolution";
1515
import { collectLocalVideoCandidates, lintHevcPreviewCodec } from "./hevcPreviewLint.js";
1616
import { lintHyperframeHtml } from "./hyperframeLinter.js";
1717
import type { HyperframeLintFinding, HyperframeLintResult } from "./types.js";

‎packages/parsers/package.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@
9999
"node": "./dist/ffBinaries.js",
100100
"import": "./src/ffBinaries.ts",
101101
"types": "./src/ffBinaries.ts"
102+
},
103+
"./asset-resolution": {
104+
"bun": "./src/assetResolution.ts",
105+
"node": "./dist/assetResolution.js",
106+
"import": "./src/assetResolution.ts",
107+
"types": "./src/assetResolution.ts"
102108
}
103109
},
104110
"publishConfig": {
@@ -160,6 +166,10 @@
160166
"./ff-binaries": {
161167
"import": "./dist/ffBinaries.js",
162168
"types": "./dist/ffBinaries.d.ts"
169+
},
170+
"./asset-resolution": {
171+
"import": "./dist/assetResolution.js",
172+
"types": "./dist/assetResolution.d.ts"
163173
}
164174
},
165175
"main": "./dist/index.js",
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { existsSync } from "node:fs";
22
import { isAbsolute, posix, relative, resolve } from "node:path";
3-
import { decodeUrlPathVariants } from "@hyperframes/parsers/composition";
3+
import { decodeUrlPathVariants } from "./composition.js";
44

55
/**
6-
* Shared local-asset resolution helpers used by both the project-level lint
7-
* rules (`project.ts`) and the HEVC preview-codec check
8-
* (`hevcPreviewLint.ts`). Split out so the latter doesn't need to import from
9-
* `project.ts` (which imports it back to run the rule) — that would be a
10-
* circular import within the package.
6+
* Shared local-asset resolution helpers for every package that maps
7+
* composition asset URLs to files on disk (lint project rules, the HEVC
8+
* preview check, studio-server's media codec scan). Import via the
9+
* `@hyperframes/parsers/asset-resolution` subpath.
1110
*/
1211

1312
export function isRemoteOrInlineUrl(url: string): boolean {

‎packages/parsers/tsup.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default defineConfig({
1616
compositionContract: "src/compositionContract.ts",
1717
subCompositionValidity: "src/subCompositionValidity.ts",
1818
ffBinaries: "src/ffBinaries.ts",
19+
assetResolution: "src/assetResolution.ts",
1920
},
2021
format: ["esm"],
2122
outDir: "dist",

0 commit comments

Comments
 (0)