@hyperframes/parsers 0.9.102 → 0.9.104

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.
@@ -145,8 +145,9 @@ function rewriteAssetPath(compSrcPath, relativePath, assetExists, charge) {
145
145
  const slashed = basePath.replace(/\\/g, "/");
146
146
  if (!slashed || slashed.startsWith("/")) return relativePath;
147
147
  const filePath = decodeWellFormedEscapes(slashed);
148
- const sibling = resolve2("/", join(compDir, filePath)).slice(1);
149
- if (!needsRewrite(filePath) && (!assetExists || !assetExists(sibling))) return relativePath;
148
+ const siblingOf = (name) => resolve2("/", join(compDir, name)).slice(1);
149
+ const sibling = needsRewrite(filePath) ? siblingOf(filePath) : [filePath, slashed].map(siblingOf).find((name) => assetExists?.(name));
150
+ if (sibling === void 0) return relativePath;
150
151
  const rebased = encodeUrlPath(sibling) + suffix;
151
152
  charge?.(rebased.length - relativePath.length);
152
153
  return rebased;
package/dist/assets.js CHANGED
@@ -178,8 +178,9 @@ function rewriteAssetPath(compSrcPath, relativePath, assetExists, charge) {
178
178
  const slashed = basePath.replace(/\\/g, "/");
179
179
  if (!slashed || slashed.startsWith("/")) return relativePath;
180
180
  const filePath = decodeWellFormedEscapes(slashed);
181
- const sibling = resolve2("/", join(compDir, filePath)).slice(1);
182
- if (!needsRewrite(filePath) && (!assetExists || !assetExists(sibling))) return relativePath;
181
+ const siblingOf = (name) => resolve2("/", join(compDir, name)).slice(1);
182
+ const sibling = needsRewrite(filePath) ? siblingOf(filePath) : [filePath, slashed].map(siblingOf).find((name) => assetExists?.(name));
183
+ if (sibling === void 0) return relativePath;
183
184
  const rebased = encodeUrlPath(sibling) + suffix;
184
185
  charge?.(rebased.length - relativePath.length);
185
186
  return rebased;
package/dist/index.d.ts CHANGED
@@ -186,4 +186,14 @@ interface TimingMismatchReport {
186
186
  */
187
187
  declare function timingMismatches(html: string): TimingMismatchReport;
188
188
 
189
- export { CanvasResolution, CompositionHtmlParseError, type CompositionMetadata, CompositionVariable, Keyframe, type OutputResolutionCompatibility, type OutputResolutionIssueKind, type OutputSizeResolution, type ParsedHtml, StageZoomKeyframe, TimelineElement, type TimingFinding, type TimingMismatchReport, type UnresolvedTiming, ValidationResult, addElementToHtml, checkOutputResolutionCompatibility, extractCompositionMetadata, outputResolutionForSize, parseHtml, queryByAttr, removeElementFromHtml, removeElementWithGsapCascade, suggestMatchingPreset, timingMismatches, unrollComputedTimeline, updateElementInHtml, validateCompositionHtml };
189
+ /** The size the renderer compiles a composition at: each side 1080×1920 when its root leaves it unset. */
190
+ declare function compositionRootSize(root: Element | null): {
191
+ width: number;
192
+ height: number;
193
+ };
194
+ declare const renderedCompositionSize: (html: string) => {
195
+ width: number;
196
+ height: number;
197
+ };
198
+
199
+ export { CanvasResolution, CompositionHtmlParseError, type CompositionMetadata, CompositionVariable, Keyframe, type OutputResolutionCompatibility, type OutputResolutionIssueKind, type OutputSizeResolution, type ParsedHtml, StageZoomKeyframe, TimelineElement, type TimingFinding, type TimingMismatchReport, type UnresolvedTiming, ValidationResult, addElementToHtml, checkOutputResolutionCompatibility, compositionRootSize, extractCompositionMetadata, outputResolutionForSize, parseHtml, queryByAttr, removeElementFromHtml, removeElementWithGsapCascade, renderedCompositionSize, suggestMatchingPreset, timingMismatches, unrollComputedTimeline, updateElementInHtml, validateCompositionHtml };
package/dist/index.js CHANGED
@@ -4509,6 +4509,16 @@ var PENDING_MEDIA_DURATION_READERS = [
4509
4509
  "studio (timelineDOM.ts, timelineElementHelpers.ts, useTimelineSyncCallbacks.ts)"
4510
4510
  ];
4511
4511
 
4512
+ // src/compositionSize.ts
4513
+ function compositionRootSize(root) {
4514
+ if (!root) return { width: 1080, height: 1920 };
4515
+ return {
4516
+ width: parseInt(root.getAttribute("data-width") || "1080", 10),
4517
+ height: parseInt(root.getAttribute("data-height") || "1920", 10)
4518
+ };
4519
+ }
4520
+ var renderedCompositionSize = (html) => compositionRootSize(parseHTML(html).document.querySelector("[data-composition-id]"));
4521
+
4512
4522
  // src/utils/urlPath.ts
4513
4523
  function decodeUrlPathVariants(path) {
4514
4524
  const decoded = decodeWellFormedEscapes(path);
@@ -5062,6 +5072,7 @@ export {
5062
5072
  clampPlaybackRate,
5063
5073
  classifyPropertyGroup,
5064
5074
  classifyTweenPropertyGroup,
5075
+ compositionRootSize,
5065
5076
  decodeAuthoredAttribute,
5066
5077
  decodeUrlPathVariants,
5067
5078
  decodedUrlPath,
@@ -5108,6 +5119,7 @@ export {
5108
5119
  readPlaybackRate,
5109
5120
  removeElementFromHtml,
5110
5121
  removeElementWithGsapCascade,
5122
+ renderedCompositionSize,
5111
5123
  replaceCanvasScaffoldSize,
5112
5124
  resolveAliasDisplayName,
5113
5125
  resolveCompositionDuration,
@@ -0,0 +1,5 @@
1
+ import { Root } from 'postcss';
2
+
3
+ declare function parseCss(css: string): Root;
4
+
5
+ export { parseCss };
@@ -0,0 +1,8 @@
1
+ // src/postcss.ts
2
+ import postcss from "postcss";
3
+ function parseCss(css) {
4
+ return postcss.parse(css, { map: false });
5
+ }
6
+ export {
7
+ parseCss
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/parsers",
3
- "version": "0.9.102",
3
+ "version": "0.9.104",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -48,6 +48,10 @@
48
48
  "import": "./dist/linkedom.js",
49
49
  "types": "./dist/linkedom.d.ts"
50
50
  },
51
+ "./postcss": {
52
+ "import": "./dist/postcss.js",
53
+ "types": "./dist/postcss.d.ts"
54
+ },
51
55
  "./gsap-parser-recast": {
52
56
  "import": "./dist/gsapParser.js",
53
57
  "types": "./dist/gsapParser.d.ts"
@@ -147,6 +151,7 @@
147
151
  "entities": "^7.0.1",
148
152
  "linkedom": "^0.18.12",
149
153
  "magic-string": "^0.30.21",
154
+ "postcss": "^8.5.8",
150
155
  "recast": "^0.23.11"
151
156
  },
152
157
  "devDependencies": {
@@ -155,7 +160,7 @@
155
160
  "tsx": "^4.21.0",
156
161
  "typescript": "^5.0.0",
157
162
  "vitest": "^4.1.12",
158
- "@hyperframes/core": "0.9.102"
163
+ "@hyperframes/core": "0.9.104"
159
164
  },
160
165
  "scripts": {
161
166
  "build": "tsup",