unhead 1.2.1 → 1.2.2

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.cjs CHANGED
@@ -335,12 +335,12 @@ function TemplateParamsPlugin() {
335
335
  }
336
336
 
337
337
  const importRe = /@import/;
338
- function CapoPlugin() {
338
+ function CapoPlugin(options) {
339
339
  return shared.defineHeadPlugin({
340
340
  hooks: {
341
341
  "tags:beforeResolve": function({ tags }) {
342
342
  for (const tag of tags) {
343
- if (tag.tagPriority)
343
+ if (tag.tagPriority || tag.tagPosition && tag.tagPosition !== "head")
344
344
  continue;
345
345
  const isTruthy = (val) => val === "";
346
346
  const isScript = tag.tag === "script";
@@ -361,6 +361,12 @@ function CapoPlugin() {
361
361
  tag.tagPriority = 9;
362
362
  }
363
363
  }
364
+ options?.track && tags.push({
365
+ tag: "htmlAttrs",
366
+ props: {
367
+ "data-capo": ""
368
+ }
369
+ });
364
370
  }
365
371
  }
366
372
  });
package/dist/index.d.ts CHANGED
@@ -36,7 +36,9 @@ declare function DedupesTagsPlugin(): _unhead_schema.HeadPlugin;
36
36
  declare function processTemplateParams(s: string, p: TemplateParams): string;
37
37
  declare function TemplateParamsPlugin(): _unhead_schema.HeadPlugin;
38
38
 
39
- declare function CapoPlugin(): _unhead_schema.HeadPlugin;
39
+ declare function CapoPlugin(options: {
40
+ track?: boolean;
41
+ }): _unhead_schema.HeadPlugin;
40
42
 
41
43
  declare function useHead<T extends Head>(input: T, options?: HeadEntryOptions): ActiveHeadEntry<T> | void;
42
44
 
package/dist/index.mjs CHANGED
@@ -333,12 +333,12 @@ function TemplateParamsPlugin() {
333
333
  }
334
334
 
335
335
  const importRe = /@import/;
336
- function CapoPlugin() {
336
+ function CapoPlugin(options) {
337
337
  return defineHeadPlugin({
338
338
  hooks: {
339
339
  "tags:beforeResolve": function({ tags }) {
340
340
  for (const tag of tags) {
341
- if (tag.tagPriority)
341
+ if (tag.tagPriority || tag.tagPosition && tag.tagPosition !== "head")
342
342
  continue;
343
343
  const isTruthy = (val) => val === "";
344
344
  const isScript = tag.tag === "script";
@@ -359,6 +359,12 @@ function CapoPlugin() {
359
359
  tag.tagPriority = 9;
360
360
  }
361
361
  }
362
+ options?.track && tags.push({
363
+ tag: "htmlAttrs",
364
+ props: {
365
+ "data-capo": ""
366
+ }
367
+ });
362
368
  }
363
369
  }
364
370
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "1.2.1",
4
+ "version": "1.2.2",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -30,9 +30,9 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "hookable": "^5.5.3",
33
- "@unhead/dom": "1.2.1",
34
- "@unhead/schema": "1.2.1",
35
- "@unhead/shared": "1.2.1"
33
+ "@unhead/dom": "1.2.2",
34
+ "@unhead/schema": "1.2.2",
35
+ "@unhead/shared": "1.2.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "packrup": "^0.1.0"