@hyperframes/inspector 0.9.12 → 0.9.13

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 (2) hide show
  1. package/dist/service.js +65 -1
  2. package/package.json +3 -3
package/dist/service.js CHANGED
@@ -55323,6 +55323,69 @@ function findLinkedClipFindings(ctx) {
55323
55323
  }
55324
55324
  return findings;
55325
55325
  }
55326
+ var AUDIO_ATTRIBUTES = {
55327
+ "data-automation": { list: "lanes", noun: "automation", item: "Lane" },
55328
+ "data-fx-chain": { list: "nodes", noun: "chain", item: "Node" }
55329
+ };
55330
+ var AUDIO_ATTRIBUTE_VERSION = 1;
55331
+ function audioAttributeShapeError(attr, json) {
55332
+ const { list, noun, item } = AUDIO_ATTRIBUTES[attr];
55333
+ const parsed = parseEnvelope(json);
55334
+ if (typeof parsed === "string") return parsed;
55335
+ if (parsed.version !== AUDIO_ATTRIBUTE_VERSION) {
55336
+ return `unsupported ${noun} version: ${String(parsed.version)}`;
55337
+ }
55338
+ const entries2 = parsed[list];
55339
+ if (!Array.isArray(entries2)) return `it is missing a \`${list}\` array`;
55340
+ for (const [i, entry] of entries2.entries()) {
55341
+ const reason = entryShapeError(attr, item, i, entry);
55342
+ if (reason) return reason;
55343
+ }
55344
+ return null;
55345
+ }
55346
+ function parseEnvelope(json) {
55347
+ let raw;
55348
+ try {
55349
+ raw = JSON.parse(json);
55350
+ } catch (err) {
55351
+ return `it is not valid JSON (${err.message})`;
55352
+ }
55353
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw))
55354
+ return "it is not a JSON object";
55355
+ return raw;
55356
+ }
55357
+ function entryShapeError(attr, item, i, entry) {
55358
+ if (typeof entry !== "object" || entry === null) return `${item} ${i} is not an object`;
55359
+ const fields = entry;
55360
+ if (attr === "data-fx-chain") {
55361
+ return typeof fields.type === "string" ? null : `Node ${i} has no effect \`type\``;
55362
+ }
55363
+ if (typeof fields.target !== "string") return `Lane ${i} has no \`target\``;
55364
+ if (!Array.isArray(fields.points)) return `Lane ${i} is missing a \`points\` array`;
55365
+ return null;
55366
+ }
55367
+ function findUnreadableAudioAttributeFindings(ctx) {
55368
+ const findings = [];
55369
+ for (const tag of ctx.tags) {
55370
+ for (const attr of Object.keys(AUDIO_ATTRIBUTES)) {
55371
+ const value = readDecodedAttr(tag.raw, attr);
55372
+ if (value === null || value === "") continue;
55373
+ const reason = audioAttributeShapeError(attr, value);
55374
+ if (!reason) continue;
55375
+ const id = readAttr(tag.raw, "id");
55376
+ const { list } = AUDIO_ATTRIBUTES[attr];
55377
+ findings.push({
55378
+ code: "audio_attribute_unreadable",
55379
+ severity: "error",
55380
+ message: `${id ? `#${id}` : `<${tag.name}>`} has a \`${attr}\` the render cannot read: ${reason}. The render fails on it, locally and in the cloud.`,
55381
+ elementId: id || void 0,
55382
+ fixHint: `Write it as {"version": ${AUDIO_ATTRIBUTE_VERSION}, "${list}": [...]}, or remove the attribute.`,
55383
+ snippet: truncateSnippet(tag.raw)
55384
+ });
55385
+ }
55386
+ }
55387
+ return findings;
55388
+ }
55326
55389
  function tweensVolumeInSameCall(script, id) {
55327
55390
  const selector = new RegExp(`#${escapeRegExp3(id)}(?![\\w-])`, "g");
55328
55391
  for (let hit = selector.exec(script); hit; hit = selector.exec(script)) {
@@ -56054,7 +56117,8 @@ var mediaRules = [
56054
56117
  findAudioGroupCarveAttrFindings,
56055
56118
  // audio_group_holds_elements
56056
56119
  findAudioGroupHoldsElementsFindings,
56057
- findLinkedClipFindings
56120
+ findLinkedClipFindings,
56121
+ findUnreadableAudioAttributeFindings
56058
56122
  ];
56059
56123
  function findVolumeTweenOverridesGainFindings(ctx) {
56060
56124
  const boosted = ctx.tags.filter((tag) => isMediaTag(tag.name)).map((tag) => ({ tag, volume: Number(readAttr(tag.raw, "data-volume") ?? "1") })).filter((entry) => Number.isFinite(entry.volume) && entry.volume !== 1).filter((entry) => !readDecodedAttr(entry.tag.raw, "data-automation")).map((entry) => ({ ...entry, id: readAttr(entry.tag.raw, "id") })).filter((entry) => Boolean(entry.id));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/inspector",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -43,8 +43,8 @@
43
43
  "htmlparser2": "^10.1.0",
44
44
  "postcss": "^8.5.8",
45
45
  "puppeteer-core": "^25.8.0",
46
- "@hyperframes/core": "0.9.12",
47
- "@hyperframes/parsers": "0.9.12"
46
+ "@hyperframes/parsers": "0.9.13",
47
+ "@hyperframes/core": "0.9.13"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^25.0.10",