@hyperframes/core 0.9.95 → 0.9.97

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.
Files changed (51) hide show
  1. package/dist/audibleVideo.d.ts +10 -0
  2. package/dist/audibleVideo.js +37 -0
  3. package/dist/generated/runtime-inline.js +1 -1
  4. package/dist/hyperframe.runtime.iife.js +67 -67
  5. package/dist/index.d.ts +1 -1
  6. package/dist/runtime/adapters/seek-dispatch.d.ts +40 -0
  7. package/dist/runtime/adapters/seek-dispatch.js +164 -0
  8. package/dist/runtime/assetUrl.d.ts +6 -0
  9. package/dist/runtime/assetUrl.js +8 -0
  10. package/dist/runtime/audioFx.d.ts +77 -0
  11. package/dist/runtime/audioFx.js +277 -0
  12. package/dist/runtime/bridge.d.ts +6 -0
  13. package/dist/runtime/bridge.js +20 -0
  14. package/dist/runtime/decodesFirst.d.ts +4 -0
  15. package/dist/runtime/decodesFirst.js +14 -0
  16. package/dist/runtime/editing/gsapSnapshot.js +12 -3
  17. package/dist/runtime/editing/gsapSnapshotLimits.d.ts +5 -3
  18. package/dist/runtime/editing/gsapSnapshotLimits.js +5 -3
  19. package/dist/runtime/editing/textCaret.d.ts +14 -0
  20. package/dist/runtime/editing/textCaret.js +98 -0
  21. package/dist/runtime/editing/textEdit.d.ts +8 -0
  22. package/dist/runtime/editing/textEdit.js +67 -10
  23. package/dist/runtime/editingPort.d.ts +3 -2
  24. package/dist/runtime/editingPort.js +2 -1
  25. package/dist/runtime/media.d.ts +113 -0
  26. package/dist/runtime/media.js +820 -0
  27. package/dist/runtime/mediaLoadFailure.d.ts +8 -0
  28. package/dist/runtime/mediaLoadFailure.js +58 -0
  29. package/dist/runtime/mediaProxy.d.ts +91 -0
  30. package/dist/runtime/mediaProxy.js +803 -0
  31. package/dist/runtime/playbackHealth.d.ts +31 -0
  32. package/dist/runtime/playbackHealth.js +137 -0
  33. package/dist/runtime/preloadMedia.d.ts +16 -0
  34. package/dist/runtime/preloadMedia.js +266 -0
  35. package/dist/runtime/previewCopies.d.ts +13 -0
  36. package/dist/runtime/previewCopies.js +80 -0
  37. package/dist/runtime/proxyWait.d.ts +3 -0
  38. package/dist/runtime/proxyWait.js +51 -0
  39. package/dist/runtime/runtimeLoad.d.ts +3 -0
  40. package/dist/runtime/runtimeLoad.js +13 -0
  41. package/dist/runtime/state.d.ts +7 -0
  42. package/dist/runtime/state.js +3 -0
  43. package/dist/runtime/timedClipHide.d.ts +12 -0
  44. package/dist/runtime/timedClipHide.js +94 -0
  45. package/dist/runtime/types.d.ts +29 -18
  46. package/dist/runtime/webAudioTransport.d.ts +243 -0
  47. package/dist/runtime/webAudioTransport.js +1176 -0
  48. package/dist/safePath.js +20 -11
  49. package/dist/terminalText.d.ts +1 -0
  50. package/dist/terminalText.js +17 -0
  51. package/package.json +12 -4
package/dist/safePath.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve, sep, join, dirname, basename, relative, isAbsolute, parse } from "node:path";
2
2
  import { lstatSync, mkdirSync, readdirSync, readFileSync, realpath as realpathWalk, realpathSync, statSync, } from "node:fs";
3
- import { mkdir, realpath as realpathNative } from "node:fs/promises";
3
+ import { mkdir, realpath as realpathNative, stat as statAsync } from "node:fs/promises";
4
4
  import { promisify } from "node:util";
5
5
  import { isWithinProjectRoot } from "@hyperframes/parsers/asset-resolution";
6
6
  import { projectPathSegments } from "@hyperframes/parsers/private-path";
@@ -260,6 +260,15 @@ export function folderGone(dir) {
260
260
  return false;
261
261
  }
262
262
  }
263
+ async function folderGoneAsync(dir) {
264
+ try {
265
+ await statAsync(dir);
266
+ return false;
267
+ }
268
+ catch (error) {
269
+ return isMissing(error);
270
+ }
271
+ }
263
272
  /** The project folder's real path; ProjectRootMissingError when it is gone. */
264
273
  export function realProjectRoot(root) {
265
274
  try {
@@ -276,7 +285,7 @@ export function realProjectRoot(root) {
276
285
  * A `dir` outside `root` is created recursively, but only while `root` exists.
277
286
  */
278
287
  export function mkdirWithinProject(root, dir) {
279
- const folders = foldersToMake(root, dir);
288
+ const folders = foldersToMake(root, dir, folderGone(root));
280
289
  if (folders === null) {
281
290
  mkdirSync(dir, { recursive: true });
282
291
  return;
@@ -286,13 +295,13 @@ export function mkdirWithinProject(root, dir) {
286
295
  mkdirSync(path);
287
296
  }
288
297
  catch (error) {
289
- madeOrThrow(root, error);
298
+ madeOrThrow(root, error, isMissing(error) && folderGone(root));
290
299
  }
291
300
  }
292
301
  }
293
302
  /** {@link mkdirWithinProject} on fs/promises: a write the drive never answers holds a pool thread, not the caller's. */
294
303
  export async function mkdirWithinProjectAsync(root, dir) {
295
- const folders = foldersToMake(root, dir);
304
+ const folders = foldersToMake(root, dir, await folderGoneAsync(root));
296
305
  if (folders === null) {
297
306
  await mkdir(dir, { recursive: true });
298
307
  return;
@@ -302,13 +311,13 @@ export async function mkdirWithinProjectAsync(root, dir) {
302
311
  await mkdir(path);
303
312
  }
304
313
  catch (error) {
305
- madeOrThrow(root, error);
314
+ madeOrThrow(root, error, isMissing(error) && (await folderGoneAsync(root)));
306
315
  }
307
316
  }
308
317
  }
309
318
  /** Each folder from below `root` down to `dir`, or null when `dir` is outside `root`. */
310
- function foldersToMake(root, dir) {
311
- if (folderGone(root))
319
+ function foldersToMake(root, dir, rootGone) {
320
+ if (rootGone)
312
321
  throw new ProjectRootMissingError(root);
313
322
  const inside = relative(resolve(root), resolve(dir));
314
323
  if (inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside))
@@ -319,13 +328,13 @@ function foldersToMake(root, dir) {
319
328
  .filter(Boolean)
320
329
  .map((part) => (path = join(path, part)));
321
330
  }
322
- function madeOrThrow(root, error) {
323
- const code = error.code;
324
- if (code === "ENOENT" && folderGone(root))
331
+ function madeOrThrow(root, error, rootGone) {
332
+ if (rootGone)
325
333
  throw new ProjectRootMissingError(root);
326
- if (code !== "EEXIST")
334
+ if (error.code !== "EEXIST")
327
335
  throw error;
328
336
  }
337
+ const isMissing = (error) => error.code === "ENOENT";
329
338
  /** The real path; for a path not there (yet, or any more), the nearest existing folder's real path plus the rest. */
330
339
  export function realFilePath(filePath) {
331
340
  try {
@@ -1,3 +1,4 @@
1
1
  export declare function terminalText(text: string): string;
2
+ export declare function quotedFilePath(path: string): string;
2
3
  export declare function terminalLines(text: string): string;
3
4
  export declare function terminalTextDeep<T>(value: T): T;
@@ -13,6 +13,23 @@ export function terminalText(text) {
13
13
  }
14
14
  return shown;
15
15
  }
16
+ export function quotedFilePath(path) {
17
+ let result = "";
18
+ for (const ch of JSON.stringify(path)) {
19
+ const code = ch.charCodeAt(0);
20
+ const escape = isControlCode(code) ||
21
+ reordersOrBreaksTextOnScreen(code) ||
22
+ /\p{Default_Ignorable_Code_Point}/u.test(ch) ||
23
+ ch.normalize("NFKC") !== ch;
24
+ if (escape) {
25
+ for (let index = 0; index < ch.length; index++)
26
+ result += `\\u${ch.charCodeAt(index).toString(16).padStart(4, "0")}`;
27
+ }
28
+ else
29
+ result += ch;
30
+ }
31
+ return result;
32
+ }
16
33
  export function terminalLines(text) {
17
34
  return text.split("\n").map(terminalText).join("\n");
18
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.9.95",
3
+ "version": "0.9.97",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -369,6 +369,14 @@
369
369
  "import": "./dist/runtime/mediaSteer.js",
370
370
  "types": "./dist/runtime/mediaSteer.d.ts"
371
371
  },
372
+ "./runtime/web-audio-transport": {
373
+ "import": "./dist/runtime/webAudioTransport.js",
374
+ "types": "./dist/runtime/webAudioTransport.d.ts"
375
+ },
376
+ "./runtime/decodes-first": {
377
+ "import": "./dist/runtime/decodesFirst.js",
378
+ "types": "./dist/runtime/decodesFirst.d.ts"
379
+ },
372
380
  "./runtime/clip-reveal": {
373
381
  "import": "./dist/runtime/clipReveal.js",
374
382
  "types": "./dist/runtime/clipReveal.d.ts"
@@ -517,9 +525,9 @@
517
525
  "linkedom": "^0.18.12",
518
526
  "postcss": "^8.5.8",
519
527
  "wawoff2": "^2.0.1",
520
- "@hyperframes/parsers": "0.9.95",
521
- "@hyperframes/lint": "0.9.95",
522
- "@hyperframes/studio-server": "0.9.95"
528
+ "@hyperframes/lint": "0.9.97",
529
+ "@hyperframes/parsers": "0.9.97",
530
+ "@hyperframes/studio-server": "0.9.97"
523
531
  },
524
532
  "devDependencies": {
525
533
  "@fontsource/archivo-black": "^5.2.8",