@hyperframes/studio-server 0.8.7 → 0.8.8
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.
- package/dist/index.d.ts +22 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,27 @@ import './helpers/mediaCodecMap.js';
|
|
|
16
16
|
*/
|
|
17
17
|
declare function createStudioApi(adapter: StudioApiAdapter): Hono;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Whether a write at `changedPath` can change `createProjectSignature(projectDir)`.
|
|
21
|
+
*
|
|
22
|
+
* Owned here because it is the exact complement of what the walk below collects,
|
|
23
|
+
* and a second copy of that reasoning drifts the moment either set changes. A
|
|
24
|
+
* watcher that invalidates on everything is not merely wasteful: `.thumbnails/`
|
|
25
|
+
* is written by the thumbnail route on every capture, and each capture reads the
|
|
26
|
+
* preview, so an unfiltered watcher discards the memo on roughly every request of
|
|
27
|
+
* the one workload the memo exists for.
|
|
28
|
+
*
|
|
29
|
+
* Note this is not `WATCHER_EXCLUDED_DIRS`, which is character-identical but
|
|
30
|
+
* excludes all of `.hyperframes/` — the signature deliberately reads two manifest
|
|
31
|
+
* files from inside it, so filtering with that set would stop motion-state saves
|
|
32
|
+
* from ever invalidating.
|
|
33
|
+
*
|
|
34
|
+
* Every segment is tested, not just the parents, so a directory event on an
|
|
35
|
+
* excluded dir itself (`unlinkDir .thumbnails`) is filtered too. The cost is that
|
|
36
|
+
* a *file* literally named `dist` at the project root reads as excluded; the walk
|
|
37
|
+
* would collect it, so it is a false negative, and no real project has one.
|
|
38
|
+
*/
|
|
39
|
+
declare function affectsProjectSignature(projectDir: string, changedPath: string): boolean;
|
|
19
40
|
/**
|
|
20
41
|
* Creates a stable preview cache-busting signature for project source plus Studio manifests.
|
|
21
42
|
*/
|
|
@@ -97,4 +118,4 @@ type BackgroundRemovalRender = (options: {
|
|
|
97
118
|
}>;
|
|
98
119
|
declare function createBackgroundRemovalJob(opts: BackgroundRemovalJobOptions, render: BackgroundRemovalRender): MediaProcessingJobState;
|
|
99
120
|
|
|
100
|
-
export { type BackgroundRemovalRender, type FileWriteReceipt, MIME_TYPES, MediaProcessingJobState, StudioApiAdapter, type ThumbnailOutputDimensions, buildSubCompositionHtml, consumeFileWriteReceipt, createBackgroundRemovalJob, createProjectSignature, createStudioApi, fileContentVersion, getMimeType, thumbnailDeviceScaleFactor, walkDir };
|
|
121
|
+
export { type BackgroundRemovalRender, type FileWriteReceipt, MIME_TYPES, MediaProcessingJobState, StudioApiAdapter, type ThumbnailOutputDimensions, affectsProjectSignature, buildSubCompositionHtml, consumeFileWriteReceipt, createBackgroundRemovalJob, createProjectSignature, createStudioApi, fileContentVersion, getMimeType, thumbnailDeviceScaleFactor, walkDir };
|
package/dist/index.js
CHANGED
|
@@ -85,7 +85,7 @@ function walkDir(dir, prefix = "") {
|
|
|
85
85
|
// src/helpers/projectSignature.ts
|
|
86
86
|
import { createHash } from "crypto";
|
|
87
87
|
import { lstatSync, readFileSync, readdirSync as readdirSync2 } from "fs";
|
|
88
|
-
import { extname, isAbsolute, relative, resolve } from "path";
|
|
88
|
+
import { extname, isAbsolute, relative, resolve, sep } from "path";
|
|
89
89
|
var SIGNATURE_TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
90
90
|
".cjs",
|
|
91
91
|
".css",
|
|
@@ -119,6 +119,15 @@ var STUDIO_SIGNATURE_MANIFEST_PATHS = [
|
|
|
119
119
|
".hyperframes/studio-manual-edits.json",
|
|
120
120
|
".hyperframes/studio-motion.json"
|
|
121
121
|
];
|
|
122
|
+
function affectsProjectSignature(projectDir, changedPath) {
|
|
123
|
+
const relativePath = relative(resolve(projectDir), resolve(changedPath));
|
|
124
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute(relativePath)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const segments = relativePath.split(sep);
|
|
128
|
+
if (STUDIO_SIGNATURE_MANIFEST_PATHS.includes(segments.join("/"))) return true;
|
|
129
|
+
return !segments.some((segment) => SIGNATURE_EXCLUDED_DIRS.has(segment));
|
|
130
|
+
}
|
|
122
131
|
var projectSignatureCache = /* @__PURE__ */ new Map();
|
|
123
132
|
function isPathWithin(parentDir, childPath) {
|
|
124
133
|
const childRelativePath = relative(parentDir, childPath);
|
|
@@ -679,7 +688,7 @@ import { parseHTML as parseHTML2 } from "linkedom";
|
|
|
679
688
|
// src/helpers/compositionInsertion.ts
|
|
680
689
|
import { existsSync as existsSync3, readFileSync as readFileSync4, realpathSync } from "fs";
|
|
681
690
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
682
|
-
import { dirname, relative as relative3, resolve as resolve2, sep } from "path";
|
|
691
|
+
import { dirname, relative as relative3, resolve as resolve2, sep as sep2 } from "path";
|
|
683
692
|
import { parseHTML } from "linkedom";
|
|
684
693
|
var CompositionInsertionError = class extends Error {
|
|
685
694
|
constructor(message, status) {
|
|
@@ -807,7 +816,7 @@ function uniqueHostId(root, base) {
|
|
|
807
816
|
return `${base}_${suffix}`;
|
|
808
817
|
}
|
|
809
818
|
function relativeSourcePath(targetAbs, sourceAbs) {
|
|
810
|
-
return relative3(dirname(targetAbs), sourceAbs).split(
|
|
819
|
+
return relative3(dirname(targetAbs), sourceAbs).split(sep2).join("/");
|
|
811
820
|
}
|
|
812
821
|
function insertCompositionIntoSource(input) {
|
|
813
822
|
const targetAbs = canonicalProjectFile(input.projectDir, input.targetPath);
|
|
@@ -4912,6 +4921,7 @@ export {
|
|
|
4912
4921
|
MIME_TYPES,
|
|
4913
4922
|
STUDIO_MANUAL_EDITS_PATH,
|
|
4914
4923
|
STUDIO_MOTION_PATH,
|
|
4924
|
+
affectsProjectSignature,
|
|
4915
4925
|
buildSubCompositionHtml,
|
|
4916
4926
|
consumeFileWriteReceipt,
|
|
4917
4927
|
createBackgroundRemovalJob,
|