@hyperframes/core 0.9.21 → 0.9.22

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.
@@ -17,7 +17,7 @@ export declare function findStartTags(html: string, name: string): number[];
17
17
  export declare function hasCompositionOutsideTemplates(html: string): boolean;
18
18
  /** Insert markup before the document's own `</head>`, `</body>` or `</template>`; null if it has none. */
19
19
  export declare function insertBeforeCloseTag(html: string, name: "head" | "body" | "template", markup: string): string | null;
20
- export declare function insertRuntimeTag(html: string, tag: string): string;
20
+ export declare function insertRuntimeTag(html: string, tag: string, atHeadStart?: boolean): string;
21
21
  /**
22
22
  * Insert raw tag markup at the very start of `<head>`, ahead of every author
23
23
  * script (inline or external). Falls back to just before `<body>`, then to the
@@ -346,8 +346,8 @@ function insertTagInHead(html, tag) {
346
346
  }
347
347
  const ACCEL_TRACKER_ATTR = "data-hf-accel-tracker";
348
348
  const OPTS_INTO_MOTION_BLUR = /\sdata-motion-blur\s*=\s*["']?on[\s"'>]/i;
349
- export function insertRuntimeTag(html, tag) {
350
- const withRuntime = insertTagInHead(html, tag);
349
+ export function insertRuntimeTag(html, tag, atHeadStart = false) {
350
+ const withRuntime = atHeadStart ? injectTagsAtHeadStart(html, tag) : insertTagInHead(html, tag);
351
351
  if (!OPTS_INTO_MOTION_BLUR.test(html) || html.includes(ACCEL_TRACKER_ATTR))
352
352
  return withRuntime;
353
353
  const tracker = `<script ${ACCEL_TRACKER_ATTR}>${acceleratedCanvasTrackerSource()}</script>`;