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,
|
isRemoteOrInlineUrl,
|
||||||
maskNonScannableRanges,
|
maskNonScannableRanges,
|
||||||
resolveExistingLocalAsset,
|
resolveExistingLocalAsset,
|
||||||
} from "./assetResolution.js";
|
} from "@hyperframes/parsers/asset-resolution";
|
||||||
import type { HyperframeLintFinding } from "./types.js";
|
import type { HyperframeLintFinding } from "./types.js";
|
||||||
|
|
||||||
/** Structurally compatible with `project.ts`'s (unexported) `HtmlSource` —
|
/** Structurally compatible with `project.ts`'s (unexported) `HtmlSource` —
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
maskNonScannableRanges,
|
maskNonScannableRanges,
|
||||||
resolveExistingLocalAsset,
|
resolveExistingLocalAsset,
|
||||||
resolveLocalAssetCandidates,
|
resolveLocalAssetCandidates,
|
||||||
} from "./assetResolution.js";
|
} from "@hyperframes/parsers/asset-resolution";
|
||||||
import { collectLocalVideoCandidates, lintHevcPreviewCodec } from "./hevcPreviewLint.js";
|
import { collectLocalVideoCandidates, lintHevcPreviewCodec } from "./hevcPreviewLint.js";
|
||||||
import { lintHyperframeHtml } from "./hyperframeLinter.js";
|
import { lintHyperframeHtml } from "./hyperframeLinter.js";
|
||||||
import type { HyperframeLintFinding, HyperframeLintResult } from "./types.js";
|
import type { HyperframeLintFinding, HyperframeLintResult } from "./types.js";
|
||||||
|
|||||||
@@ -99,6 +99,12 @@
|
|||||||
"node": "./dist/ffBinaries.js",
|
"node": "./dist/ffBinaries.js",
|
||||||
"import": "./src/ffBinaries.ts",
|
"import": "./src/ffBinaries.ts",
|
||||||
"types": "./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": {
|
"publishConfig": {
|
||||||
@@ -160,6 +166,10 @@
|
|||||||
"./ff-binaries": {
|
"./ff-binaries": {
|
||||||
"import": "./dist/ffBinaries.js",
|
"import": "./dist/ffBinaries.js",
|
||||||
"types": "./dist/ffBinaries.d.ts"
|
"types": "./dist/ffBinaries.d.ts"
|
||||||
|
},
|
||||||
|
"./asset-resolution": {
|
||||||
|
"import": "./dist/assetResolution.js",
|
||||||
|
"types": "./dist/assetResolution.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { existsSync } from "node:fs";
|
import { existsSync } from "node:fs";
|
||||||
import { isAbsolute, posix, relative, resolve } from "node:path";
|
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
|
* Shared local-asset resolution helpers for every package that maps
|
||||||
* rules (`project.ts`) and the HEVC preview-codec check
|
* composition asset URLs to files on disk (lint project rules, the HEVC
|
||||||
* (`hevcPreviewLint.ts`). Split out so the latter doesn't need to import from
|
* preview check, studio-server's media codec scan). Import via the
|
||||||
* `project.ts` (which imports it back to run the rule) — that would be a
|
* `@hyperframes/parsers/asset-resolution` subpath.
|
||||||
* circular import within the package.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function isRemoteOrInlineUrl(url: string): boolean {
|
export function isRemoteOrInlineUrl(url: string): boolean {
|
||||||
@@ -16,6 +16,7 @@ export default defineConfig({
|
|||||||
compositionContract: "src/compositionContract.ts",
|
compositionContract: "src/compositionContract.ts",
|
||||||
subCompositionValidity: "src/subCompositionValidity.ts",
|
subCompositionValidity: "src/subCompositionValidity.ts",
|
||||||
ffBinaries: "src/ffBinaries.ts",
|
ffBinaries: "src/ffBinaries.ts",
|
||||||
|
assetResolution: "src/assetResolution.ts",
|
||||||
},
|
},
|
||||||
format: ["esm"],
|
format: ["esm"],
|
||||||
outDir: "dist",
|
outDir: "dist",
|
||||||
|
|||||||
Reference in New Issue
Block a user