mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
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).
This commit is contained in:
@@ -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` —
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 {
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user