shelfware 0.0.1 → 0.1.1

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 (206) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/6IstVYrV.js +1 -0
  3. package/.output/public/_nuxt/9C5WUlLE.js +36 -0
  4. package/.output/public/_nuxt/BDNMzG2s.js +1 -0
  5. package/.output/public/_nuxt/BW3xJdEx.js +1 -0
  6. package/.output/public/_nuxt/BXXtFil5.js +1 -0
  7. package/.output/public/_nuxt/BZuUK3cr.js +1 -0
  8. package/.output/public/_nuxt/BeLyMmd4.js +1 -0
  9. package/.output/public/_nuxt/C_VgD9ZI.js +3 -0
  10. package/.output/public/_nuxt/DB5Vxbte.js +2 -0
  11. package/.output/public/_nuxt/DMg0j7gv.js +14 -0
  12. package/.output/public/_nuxt/builds/latest.json +1 -0
  13. package/.output/public/_nuxt/builds/meta/e0d2b6a3-3a30-44b7-8c79-a56f66400005.json +1 -0
  14. package/.output/public/_nuxt/entry.b3_DJTEt.css +2 -0
  15. package/.output/public/_nuxt/error-404.CHsn7XF-.css +1 -0
  16. package/.output/public/_nuxt/error-500.Bawx2bLr.css +1 -0
  17. package/.output/server/chunks/_/api-handler.mjs +44 -0
  18. package/.output/server/chunks/_/batch.mjs +27 -0
  19. package/.output/server/chunks/_/catalog.mjs +1115 -0
  20. package/.output/server/chunks/_/detail.mjs +16 -0
  21. package/.output/server/chunks/_/error-500.mjs +19 -0
  22. package/.output/server/chunks/_/quarantine.mjs +159 -0
  23. package/.output/server/chunks/nitro/nitro.mjs +5399 -0
  24. package/.output/server/chunks/routes/api/_..._.mjs +16 -0
  25. package/.output/server/chunks/routes/api/health.get.mjs +13 -0
  26. package/.output/server/chunks/routes/api/skills/_id/file.get.mjs +25 -0
  27. package/.output/server/chunks/routes/api/skills/_id_.get.mjs +25 -0
  28. package/.output/server/chunks/routes/api/skills/_id_.put.mjs +74 -0
  29. package/.output/server/chunks/routes/api/skills/delete.post.mjs +48 -0
  30. package/.output/server/chunks/routes/api/skills/quarantine.post.mjs +26 -0
  31. package/.output/server/chunks/routes/api/skills/restore.post.mjs +26 -0
  32. package/.output/server/chunks/routes/api/skills.get.mjs +41 -0
  33. package/.output/server/chunks/routes/renderer.mjs +341 -0
  34. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +3 -0
  35. package/.output/server/chunks/virtual/precomputed.mjs +3 -0
  36. package/.output/server/index.mjs +9 -0
  37. package/.output/server/node_modules/@babel/parser/lib/index.js +14611 -0
  38. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  39. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6801 -0
  40. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  41. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +692 -0
  42. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  43. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1420 -0
  44. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  45. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1903 -0
  46. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  47. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6980 -0
  48. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  49. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1867 -0
  50. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  51. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +904 -0
  52. package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
  53. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +636 -0
  54. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  55. package/.output/server/node_modules/devalue/index.js +17 -0
  56. package/.output/server/node_modules/devalue/package.json +39 -0
  57. package/.output/server/node_modules/devalue/src/base64.js +60 -0
  58. package/.output/server/node_modules/devalue/src/constants.js +12 -0
  59. package/.output/server/node_modules/devalue/src/operations.js +193 -0
  60. package/.output/server/node_modules/devalue/src/parse.js +274 -0
  61. package/.output/server/node_modules/devalue/src/stringify.js +428 -0
  62. package/.output/server/node_modules/devalue/src/uneval.js +606 -0
  63. package/.output/server/node_modules/devalue/src/utils.js +185 -0
  64. package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  65. package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  66. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  67. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  68. package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  69. package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  70. package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  71. package/.output/server/node_modules/entities/package.json +120 -0
  72. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  73. package/.output/server/node_modules/estree-walker/package.json +37 -0
  74. package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  75. package/.output/server/node_modules/hookable/package.json +53 -0
  76. package/.output/server/node_modules/nostics/dist/formatters/ansi.mjs +19 -0
  77. package/.output/server/node_modules/nostics/dist/index.mjs +187 -0
  78. package/.output/server/node_modules/nostics/package.json +125 -0
  79. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  80. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  81. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  82. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  83. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  84. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  85. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  86. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  87. package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  88. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  89. package/.output/server/node_modules/source-map-js/package.json +71 -0
  90. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  91. package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  92. package/.output/server/node_modules/ufo/package.json +48 -0
  93. package/.output/server/node_modules/unhead/dist/client.mjs +22 -0
  94. package/.output/server/node_modules/unhead/dist/legacy.mjs +33 -0
  95. package/.output/server/node_modules/unhead/dist/minify.mjs +183 -0
  96. package/.output/server/node_modules/unhead/dist/parser.mjs +518 -0
  97. package/.output/server/node_modules/unhead/dist/plugins.mjs +720 -0
  98. package/.output/server/node_modules/unhead/dist/server.mjs +99 -0
  99. package/.output/server/node_modules/unhead/dist/shared/unhead.-hZVKou0.mjs +400 -0
  100. package/.output/server/node_modules/unhead/dist/shared/unhead.BEmVMkeA.mjs +673 -0
  101. package/.output/server/node_modules/unhead/dist/shared/unhead.BGFxPGPQ.mjs +47 -0
  102. package/.output/server/node_modules/unhead/dist/shared/unhead.BQWSw36o.mjs +192 -0
  103. package/.output/server/node_modules/unhead/dist/shared/unhead.Bf_fPVYA.mjs +6 -0
  104. package/.output/server/node_modules/unhead/dist/shared/unhead.Bjbp1C8D.mjs +224 -0
  105. package/.output/server/node_modules/unhead/dist/shared/unhead.Bm4Y6XQI.mjs +17 -0
  106. package/.output/server/node_modules/unhead/dist/shared/unhead.C5Bksi2B.mjs +49 -0
  107. package/.output/server/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs +32 -0
  108. package/.output/server/node_modules/unhead/dist/shared/unhead.CHEy9ana.mjs +7 -0
  109. package/.output/server/node_modules/unhead/dist/shared/unhead.D7HkBzZn.mjs +59 -0
  110. package/.output/server/node_modules/unhead/dist/shared/unhead.Dssd7L5I.mjs +196 -0
  111. package/.output/server/node_modules/unhead/dist/shared/unhead.jEy9BmRq.mjs +264 -0
  112. package/.output/server/node_modules/unhead/dist/shared/unhead.oZ7pkTV1.mjs +19 -0
  113. package/.output/server/node_modules/unhead/dist/shared/unhead.tQnRaXfX.mjs +240 -0
  114. package/.output/server/node_modules/unhead/dist/stream/client.mjs +33 -0
  115. package/.output/server/node_modules/unhead/dist/stream/iife.mjs +2 -0
  116. package/.output/server/node_modules/unhead/dist/stream/server.mjs +445 -0
  117. package/.output/server/node_modules/unhead/dist/utils.mjs +7 -0
  118. package/.output/server/node_modules/unhead/package.json +179 -0
  119. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  120. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  121. package/.output/server/node_modules/vue/index.js +7 -0
  122. package/.output/server/node_modules/vue/index.mjs +1 -0
  123. package/.output/server/node_modules/vue/package.json +112 -0
  124. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  125. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +278 -0
  126. package/.output/server/node_modules/vue-bundle-renderer/package.json +54 -0
  127. package/.output/server/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  128. package/.output/server/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  129. package/.output/server/node_modules/yaml/dist/compose/compose-node.js +112 -0
  130. package/.output/server/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  131. package/.output/server/node_modules/yaml/dist/compose/composer.js +224 -0
  132. package/.output/server/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  133. package/.output/server/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  134. package/.output/server/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  135. package/.output/server/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  136. package/.output/server/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  137. package/.output/server/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
  138. package/.output/server/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  139. package/.output/server/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  140. package/.output/server/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  141. package/.output/server/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  142. package/.output/server/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  143. package/.output/server/node_modules/yaml/dist/doc/Document.js +337 -0
  144. package/.output/server/node_modules/yaml/dist/doc/anchors.js +76 -0
  145. package/.output/server/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  146. package/.output/server/node_modules/yaml/dist/doc/createNode.js +90 -0
  147. package/.output/server/node_modules/yaml/dist/doc/directives.js +178 -0
  148. package/.output/server/node_modules/yaml/dist/errors.js +62 -0
  149. package/.output/server/node_modules/yaml/dist/index.js +50 -0
  150. package/.output/server/node_modules/yaml/dist/log.js +19 -0
  151. package/.output/server/node_modules/yaml/dist/nodes/Alias.js +118 -0
  152. package/.output/server/node_modules/yaml/dist/nodes/Collection.js +151 -0
  153. package/.output/server/node_modules/yaml/dist/nodes/Node.js +40 -0
  154. package/.output/server/node_modules/yaml/dist/nodes/Pair.js +39 -0
  155. package/.output/server/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  156. package/.output/server/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  157. package/.output/server/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  158. package/.output/server/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  159. package/.output/server/node_modules/yaml/dist/nodes/identity.js +53 -0
  160. package/.output/server/node_modules/yaml/dist/nodes/toJS.js +39 -0
  161. package/.output/server/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  162. package/.output/server/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  163. package/.output/server/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  164. package/.output/server/node_modules/yaml/dist/parse/cst.js +112 -0
  165. package/.output/server/node_modules/yaml/dist/parse/lexer.js +723 -0
  166. package/.output/server/node_modules/yaml/dist/parse/line-counter.js +41 -0
  167. package/.output/server/node_modules/yaml/dist/parse/parser.js +980 -0
  168. package/.output/server/node_modules/yaml/dist/public-api.js +107 -0
  169. package/.output/server/node_modules/yaml/dist/schema/Schema.js +39 -0
  170. package/.output/server/node_modules/yaml/dist/schema/common/map.js +19 -0
  171. package/.output/server/node_modules/yaml/dist/schema/common/null.js +17 -0
  172. package/.output/server/node_modules/yaml/dist/schema/common/seq.js +19 -0
  173. package/.output/server/node_modules/yaml/dist/schema/common/string.js +16 -0
  174. package/.output/server/node_modules/yaml/dist/schema/core/bool.js +21 -0
  175. package/.output/server/node_modules/yaml/dist/schema/core/float.js +47 -0
  176. package/.output/server/node_modules/yaml/dist/schema/core/int.js +42 -0
  177. package/.output/server/node_modules/yaml/dist/schema/core/schema.js +25 -0
  178. package/.output/server/node_modules/yaml/dist/schema/json/schema.js +64 -0
  179. package/.output/server/node_modules/yaml/dist/schema/tags.js +99 -0
  180. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  181. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  182. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  183. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  184. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
  185. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  186. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  187. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  188. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  189. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  190. package/.output/server/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  191. package/.output/server/node_modules/yaml/dist/stringify/stringify.js +132 -0
  192. package/.output/server/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
  193. package/.output/server/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  194. package/.output/server/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  195. package/.output/server/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
  196. package/.output/server/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  197. package/.output/server/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  198. package/.output/server/node_modules/yaml/dist/visit.js +236 -0
  199. package/.output/server/node_modules/yaml/package.json +97 -0
  200. package/.output/server/package.json +28 -0
  201. package/LICENSE +21 -0
  202. package/README.md +57 -1
  203. package/bin/launch.mjs +216 -0
  204. package/bin/shelfware.mjs +11 -0
  205. package/package.json +64 -5
  206. package/cli.mjs +0 -3
@@ -0,0 +1,196 @@
1
+ import { c as createUnhead } from './unhead.D7HkBzZn.mjs';
2
+ import { I as INVALID_ATTR_NAME_RE, r as resolveTags, n as normalizeEntryToTags, d as dedupeKey, h as hashTag } from './unhead.-hZVKou0.mjs';
3
+ import { a as callHook, c as createHooks } from './unhead.Bm4Y6XQI.mjs';
4
+ import { b as TagPriorityAliases, a as SelfClosingTags, c as TagsWithInnerContent } from './unhead.CGPOfp5O.mjs';
5
+
6
+ const isTruthy = (v) => v === "" || v === true;
7
+ function capoTagWeight(tag) {
8
+ if (typeof tag.tagPriority === "number")
9
+ return tag.tagPriority;
10
+ let weight = 100;
11
+ const offset = TagPriorityAliases[tag.tagPriority] || 0;
12
+ if (tag.tag === "base") {
13
+ weight = -10;
14
+ } else if (tag.tag === "title") {
15
+ weight = 10;
16
+ } else if (tag.tag === "meta") {
17
+ weight = tag.props["http-equiv"] === "content-security-policy" ? -30 : tag.props.charset ? -20 : tag.props.name === "viewport" ? -15 : weight;
18
+ } else if (tag.tag === "link" && tag.props.rel) {
19
+ const rel = tag.props.rel;
20
+ weight = rel === "preconnect" ? 20 : rel === "stylesheet" ? 60 : rel === "preload" || rel === "modulepreload" ? 70 : rel === "prefetch" || rel === "dns-prefetch" || rel === "prerender" ? 90 : weight;
21
+ } else if (tag.tag === "script") {
22
+ const type = typeof tag.props.type === "string" ? tag.props.type : "";
23
+ const json = type.endsWith("json");
24
+ if (type === "importmap")
25
+ weight = 25;
26
+ else if (type === "speculationrules")
27
+ weight = 90;
28
+ else if (isTruthy(tag.props.async))
29
+ weight = 30;
30
+ else if (tag.props.src && !isTruthy(tag.props.defer) && type !== "module" && !json || (tag.innerHTML || tag.textContent) && !json)
31
+ weight = 50;
32
+ else if (isTruthy(tag.props.defer) && tag.props.src || type === "module")
33
+ weight = 80;
34
+ } else if (tag.tag === "style") {
35
+ weight = tag.innerHTML && /@import/.test(tag.innerHTML) ? 40 : 60;
36
+ }
37
+ return (weight || 100) + offset;
38
+ }
39
+
40
+ const DOUBLE_QUOTE_RE = /"/g;
41
+ function encodeAttribute(value) {
42
+ const s = typeof value === "string" ? value : String(value);
43
+ return s.includes('"') ? s.replace(DOUBLE_QUOTE_RE, """) : s;
44
+ }
45
+ function propsToString(props) {
46
+ let attrs = "";
47
+ for (const key in props) {
48
+ if (!Object.hasOwn(props, key) || !key || INVALID_ATTR_NAME_RE.test(key))
49
+ continue;
50
+ let value = props[key];
51
+ if (typeof value !== "string") {
52
+ if (key === "class") {
53
+ let out = "";
54
+ for (const c of value) out += out ? ` ${c}` : c;
55
+ value = out;
56
+ } else if (key === "style") {
57
+ let out = "";
58
+ for (const [k, v] of value) out += out ? `;${k}:${v}` : `${k}:${v}`;
59
+ value = out;
60
+ }
61
+ }
62
+ if (value !== false && value !== null) {
63
+ attrs += value === true ? ` ${key}` : ` ${key}="${encodeAttribute(value)}"`;
64
+ }
65
+ }
66
+ return attrs;
67
+ }
68
+
69
+ const ESCAPE_HTML_RE = /[&<>"'/]/g;
70
+ const CLOSE_TAG_RE = {};
71
+ const ESCAPE_HTML_MAP = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "/": "&#x2F;" };
72
+ function escapeHtml(str) {
73
+ return str.replace(ESCAPE_HTML_RE, (c) => ESCAPE_HTML_MAP[c]);
74
+ }
75
+ function tagToString(tag) {
76
+ const attrs = propsToString(tag.props);
77
+ const openTag = `<${tag.tag}${attrs}>`;
78
+ if (SelfClosingTags.has(tag.tag))
79
+ return openTag;
80
+ if (!TagsWithInnerContent.has(tag.tag))
81
+ return `${openTag}</${tag.tag}>`;
82
+ let content = String(tag.textContent ?? tag.innerHTML ?? "");
83
+ content = tag.tag === "title" ? escapeHtml(content) : content.replace(CLOSE_TAG_RE[tag.tag] ||= new RegExp(`</${tag.tag}`, "gi"), `<\\/${tag.tag}`);
84
+ return `${openTag}${content}</${tag.tag}>`;
85
+ }
86
+
87
+ function ssrRenderTags(tags, options) {
88
+ const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: "", bodyClose: "", bodyOpen: "" } };
89
+ const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
90
+ for (const tag of tags) {
91
+ if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
92
+ Object.assign(schema[tag.tag], tag.props);
93
+ continue;
94
+ }
95
+ const s = tagToString(tag);
96
+ const tagPosition = tag.tagPosition || "head";
97
+ schema.tags[tagPosition] += schema.tags[tagPosition] ? `${lineBreaks}${s}` : s;
98
+ }
99
+ return {
100
+ headTags: schema.tags.head,
101
+ bodyTags: schema.tags.bodyClose,
102
+ bodyTagsOpen: schema.tags.bodyOpen,
103
+ htmlAttrs: propsToString(schema.htmlAttrs),
104
+ bodyAttrs: propsToString(schema.bodyAttrs)
105
+ };
106
+ }
107
+
108
+ // @__NO_SIDE_EFFECTS__
109
+ function createServerRenderer(options = {}) {
110
+ return (head) => {
111
+ const beforeRenderCtx = { shouldRender: true };
112
+ callHook(head, "ssr:beforeRender", beforeRenderCtx);
113
+ if (!beforeRenderCtx.shouldRender)
114
+ return ssrRenderTags([]);
115
+ const ctx = {
116
+ tags: options.resolvedTags || resolveTags(head, { tagWeight: options.tagWeight ?? capoTagWeight }),
117
+ options: { ...options }
118
+ };
119
+ callHook(head, "ssr:render", ctx);
120
+ const html = ssrRenderTags(ctx.tags, ctx.options);
121
+ const renderCtx = { tags: ctx.tags, html };
122
+ callHook(head, "ssr:rendered", renderCtx);
123
+ return renderCtx.html;
124
+ };
125
+ }
126
+ // @__NO_SIDE_EFFECTS__
127
+ function renderSSRHead(head, options) {
128
+ return (/* @__PURE__ */ createServerRenderer(options))(head);
129
+ }
130
+
131
+ const DEFAULT_INIT = {
132
+ htmlAttrs: {
133
+ lang: "en"
134
+ },
135
+ meta: [
136
+ {
137
+ charset: "utf-8"
138
+ },
139
+ {
140
+ name: "viewport",
141
+ content: "width=device-width, initial-scale=1"
142
+ }
143
+ ]
144
+ };
145
+ const serverPropResolver = /* @__PURE__ */ Object.assign(
146
+ (k, v) => {
147
+ if (k && k.startsWith("on") && typeof v === "function") {
148
+ return `this.dataset.${k}fired = true`;
149
+ }
150
+ return v;
151
+ },
152
+ { _static: true }
153
+ );
154
+ let defaultInitTags;
155
+ function getDefaultInitTags() {
156
+ if (!defaultInitTags) {
157
+ defaultInitTags = normalizeEntryToTags(DEFAULT_INIT, []);
158
+ for (let i = 0; i < defaultInitTags.length; i++) {
159
+ const t = defaultInitTags[i];
160
+ t._w = capoTagWeight(t);
161
+ t._p = (1 << 10) + i;
162
+ t._d = dedupeKey(t);
163
+ if (!t._d)
164
+ t._h = hashTag(t);
165
+ }
166
+ }
167
+ return defaultInitTags;
168
+ }
169
+ // @__NO_SIDE_EFFECTS__
170
+ function createHead(options = {}) {
171
+ const tagWeight = options.tagWeight || capoTagWeight;
172
+ const core = createUnhead(createServerRenderer({ tagWeight, omitLineBreaks: options.omitLineBreaks }), {
173
+ _tagWeight: tagWeight,
174
+ // @ts-expect-error untyped
175
+ document: false,
176
+ experimentalStreamKey: options.experimentalStreamKey,
177
+ propResolvers: [
178
+ ...options.propResolvers || [],
179
+ serverPropResolver
180
+ ],
181
+ init: [
182
+ options.disableDefaults ? void 0 : DEFAULT_INIT,
183
+ ...options.init || []
184
+ ]
185
+ });
186
+ if (!options.disableDefaults && !options.tagWeight && !options.propResolvers?.some((r) => !r._static)) {
187
+ const defaultEntry = core.entries.get(1);
188
+ if (defaultEntry)
189
+ defaultEntry._precomputedTags = getDefaultInitTags();
190
+ }
191
+ core.hooks = createHooks(options.hooks);
192
+ options.plugins?.forEach((p) => core.use(p));
193
+ return core;
194
+ }
195
+
196
+ export { capoTagWeight as a, createServerRenderer as b, createHead as c, escapeHtml as e, propsToString as p, renderSSRHead as r, ssrRenderTags as s, tagToString as t };
@@ -0,0 +1,264 @@
1
+ import { u as unpackMeta } from './unhead.BQWSw36o.mjs';
2
+ import { d as defineHeadPlugin } from './unhead.CHEy9ana.mjs';
3
+ import { h as hasContent, i as isUnsafeKey } from './unhead.CGPOfp5O.mjs';
4
+
5
+ const FlatMetaPlugin = /* @__PURE__ */ defineHeadPlugin({
6
+ key: "flatMeta",
7
+ hooks: {
8
+ "entries:normalize": (ctx) => {
9
+ let hasFlatMeta = false;
10
+ const tags = [];
11
+ const tagsToAdd = [];
12
+ for (const t of ctx.tags) {
13
+ if (t.tag !== "_flatMeta") {
14
+ tags.push(t);
15
+ continue;
16
+ }
17
+ hasFlatMeta = true;
18
+ for (const props of unpackMeta(t.props))
19
+ tagsToAdd.push({ ...t, tag: "meta", props });
20
+ }
21
+ if (!hasFlatMeta)
22
+ return;
23
+ for (const tag of tagsToAdd) tags.push(tag);
24
+ ctx.tags = tags;
25
+ }
26
+ }
27
+ });
28
+
29
+ const WhitelistAttributes = {
30
+ htmlAttrs: /* @__PURE__ */ new Set(["class", "style", "lang", "dir"]),
31
+ bodyAttrs: /* @__PURE__ */ new Set(["class", "style"]),
32
+ meta: /* @__PURE__ */ new Set(["name", "property", "charset", "content", "media"]),
33
+ noscript: /* @__PURE__ */ new Set([]),
34
+ style: /* @__PURE__ */ new Set(["media", "nonce", "title", "blocking"]),
35
+ script: /* @__PURE__ */ new Set(["type", "textContent", "nonce", "blocking"]),
36
+ link: /* @__PURE__ */ new Set(["color", "crossorigin", "fetchpriority", "href", "hreflang", "imagesrcset", "imagesizes", "integrity", "media", "referrerpolicy", "rel", "sizes", "type"])
37
+ };
38
+ const BlockedLinkRels = /* @__PURE__ */ new Set(["canonical", "modulepreload", "prerender", "preload", "prefetch", "dns-prefetch", "preconnect", "manifest", "pingback"]);
39
+ const SafeDataAttrName = /^[a-z][a-z0-9-]*[a-z0-9]$/i;
40
+ const AsciiWhitespace = /[\t\n\f\r ]+/;
41
+ const HtmlEntityHex = /&#x([0-9a-f]+);?/gi;
42
+ const HtmlEntityDec = /&#(\d+);?/g;
43
+ const HtmlEntityNamed = /&(tab|newline|colon|semi|lpar|rpar|sol|bsol|comma|period|excl|num|dollar|percnt|amp|apos|ast|plus|lt|gt|equals|quest|at|lsqb|rsqb|lcub|rcub|vert|hat|grave|tilde|nbsp);?/gi;
44
+ const ControlChars = /[\x00-\x20]+/g;
45
+ const NamedEntityMap = {
46
+ tab: " ",
47
+ newline: "\n",
48
+ colon: ":",
49
+ semi: ";",
50
+ lpar: "(",
51
+ rpar: ")",
52
+ sol: "/",
53
+ bsol: "\\",
54
+ comma: ",",
55
+ period: ".",
56
+ excl: "!",
57
+ num: "#",
58
+ dollar: "$",
59
+ percnt: "%",
60
+ amp: "&",
61
+ apos: "'",
62
+ ast: "*",
63
+ plus: "+",
64
+ lt: "<",
65
+ gt: ">",
66
+ equals: "=",
67
+ quest: "?",
68
+ at: "@",
69
+ lsqb: "[",
70
+ rsqb: "]",
71
+ lcub: "{",
72
+ rcub: "}",
73
+ vert: "|",
74
+ hat: "^",
75
+ grave: "`",
76
+ tilde: "~",
77
+ nbsp: "\xA0"
78
+ };
79
+ function safeFromCodePoint(codePoint) {
80
+ if (codePoint > 1114111 || codePoint < 0 || Number.isNaN(codePoint))
81
+ return "";
82
+ return String.fromCodePoint(codePoint);
83
+ }
84
+ function decodeHtmlEntities(str) {
85
+ return str.replace(HtmlEntityHex, (_, hex) => safeFromCodePoint(Number.parseInt(hex, 16))).replace(HtmlEntityDec, (_, dec) => safeFromCodePoint(Number(dec))).replace(HtmlEntityNamed, (_, name) => NamedEntityMap[name.toLowerCase()] || "");
86
+ }
87
+ function hasDangerousProtocol(url) {
88
+ const entityDecoded = decodeHtmlEntities(url);
89
+ const cleaned = entityDecoded.replace(ControlChars, "");
90
+ let decoded;
91
+ try {
92
+ decoded = decodeURIComponent(cleaned);
93
+ } catch {
94
+ decoded = cleaned;
95
+ }
96
+ const sanitized = decoded.replace(ControlChars, "");
97
+ const lower = sanitized.toLowerCase();
98
+ return lower.startsWith("javascript:") || lower.startsWith("data:") || lower.startsWith("vbscript:");
99
+ }
100
+ function stripProtoKeys(obj) {
101
+ if (Array.isArray(obj))
102
+ return obj.map(stripProtoKeys);
103
+ if (obj && typeof obj === "object") {
104
+ const clean = {};
105
+ for (const key of Object.keys(obj)) {
106
+ if (isUnsafeKey(key))
107
+ continue;
108
+ clean[key] = stripProtoKeys(obj[key]);
109
+ }
110
+ return clean;
111
+ }
112
+ return obj;
113
+ }
114
+ function acceptDataAttrs(value, allowId = true) {
115
+ const next = {};
116
+ if (!value)
117
+ return next;
118
+ const keys = Object.keys(value);
119
+ for (let i = 0; i < keys.length; i++) {
120
+ const key = keys[i];
121
+ const isData = key.startsWith("data-");
122
+ if ((isData || allowId && key === "id") && SafeDataAttrName.test(key))
123
+ next[key] = value[key];
124
+ }
125
+ return next;
126
+ }
127
+ function hasBlockedRel(rel) {
128
+ const tokens = rel.split(AsciiWhitespace);
129
+ return !tokens.some(Boolean) || tokens.some((token) => BlockedLinkRels.has(token.toLowerCase()));
130
+ }
131
+ function makeTagSafe(tag) {
132
+ let next = {};
133
+ const { tag: type, props: prev } = tag;
134
+ switch (type) {
135
+ // title: textContent is escaped in rendering (tagToString), no props needed
136
+ case "title":
137
+ break;
138
+ // virtual tags, not rendered to HTML — but sanitize to prevent injection if rendered
139
+ case "titleTemplate":
140
+ case "templateParams":
141
+ next = prev;
142
+ break;
143
+ case "htmlAttrs":
144
+ case "bodyAttrs":
145
+ WhitelistAttributes[type].forEach((attr) => {
146
+ if (prev[attr]) {
147
+ next[attr] = prev[attr];
148
+ }
149
+ });
150
+ delete tag.innerHTML;
151
+ delete tag.textContent;
152
+ tag.props = { ...acceptDataAttrs(prev, false), ...next };
153
+ return !Object.keys(tag.props).length ? false : tag;
154
+ case "style":
155
+ next = acceptDataAttrs(prev);
156
+ WhitelistAttributes.style.forEach((key) => {
157
+ if (prev[key]) {
158
+ next[key] = prev[key];
159
+ }
160
+ });
161
+ break;
162
+ // meta is safe, except for http-equiv
163
+ case "meta":
164
+ WhitelistAttributes.meta.forEach((key) => {
165
+ if (hasContent(prev[key])) {
166
+ next[key] = prev[key];
167
+ }
168
+ });
169
+ break;
170
+ // link tags we block preloading, prerendering, prefetching, dns-prefetch, preconnect, manifest, etc
171
+ case "link":
172
+ WhitelistAttributes.link.forEach((key) => {
173
+ const val = prev[key];
174
+ if (!val) {
175
+ return;
176
+ }
177
+ if (key === "rel" && (typeof val !== "string" || hasBlockedRel(val))) {
178
+ return;
179
+ }
180
+ if (key === "href" || key === "imagesrcset") {
181
+ if (typeof val !== "string") {
182
+ return;
183
+ }
184
+ const urls = key === "imagesrcset" ? val.split(",").map((s) => s.trim()) : [val];
185
+ if (urls.some((u) => hasDangerousProtocol(u))) {
186
+ return;
187
+ }
188
+ next[key] = val;
189
+ } else if (val) {
190
+ next[key] = val;
191
+ }
192
+ });
193
+ if (!next.href && !next.imagesrcset || !next.rel) {
194
+ return false;
195
+ }
196
+ break;
197
+ case "noscript":
198
+ WhitelistAttributes.noscript.forEach((key) => {
199
+ if (prev[key]) {
200
+ next[key] = prev[key];
201
+ }
202
+ });
203
+ break;
204
+ // we only allow JSON in scripts
205
+ case "script":
206
+ if (!tag.textContent || typeof prev.type !== "string" || !prev.type.endsWith("json")) {
207
+ return false;
208
+ }
209
+ try {
210
+ const jsonVal = typeof tag.textContent === "string" ? JSON.parse(tag.textContent) : tag.textContent;
211
+ tag.textContent = JSON.stringify(stripProtoKeys(jsonVal), null, 0);
212
+ } catch {
213
+ return false;
214
+ }
215
+ WhitelistAttributes.script.forEach((s) => {
216
+ if (s !== "textContent" && prev[s]) {
217
+ next[s] = prev[s];
218
+ }
219
+ });
220
+ break;
221
+ }
222
+ delete tag.innerHTML;
223
+ if (type !== "title" && type !== "script") {
224
+ delete tag.textContent;
225
+ }
226
+ tag.props = { ...acceptDataAttrs(prev), ...next };
227
+ if (!Object.keys(tag.props).length && !tag.tag.endsWith("Attrs") && !tag.textContent) {
228
+ return false;
229
+ }
230
+ return tag;
231
+ }
232
+ const SafeInputPlugin = /* @__PURE__ */ defineHeadPlugin({
233
+ key: "safe",
234
+ hooks: {
235
+ "entries:normalize": (ctx) => {
236
+ if (ctx.entry.options?._safe) {
237
+ ctx.tags = ctx.tags.reduce((acc, tag) => {
238
+ const safeTag = makeTagSafe(tag);
239
+ if (safeTag)
240
+ acc.push(safeTag);
241
+ return acc;
242
+ }, []);
243
+ }
244
+ },
245
+ "tags:afterResolve": (ctx) => {
246
+ ctx.tags = ctx.tags.reduce((acc, tag) => {
247
+ if (!tag._safe) {
248
+ acc.push(tag);
249
+ return acc;
250
+ }
251
+ if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
252
+ acc.push(tag);
253
+ return acc;
254
+ }
255
+ const safeTag = makeTagSafe(tag);
256
+ if (safeTag)
257
+ acc.push(safeTag);
258
+ return acc;
259
+ }, []);
260
+ }
261
+ }
262
+ });
263
+
264
+ export { FlatMetaPlugin as F, SafeInputPlugin as S };
@@ -0,0 +1,19 @@
1
+ import { c as createUnhead } from './unhead.D7HkBzZn.mjs';
2
+ import { b as TagPriorityAliases } from './unhead.CGPOfp5O.mjs';
3
+ import { c as createHooks } from './unhead.Bm4Y6XQI.mjs';
4
+ import { c as createClientHeadAdapter } from './unhead.C5Bksi2B.mjs';
5
+ import { c as createDomRenderer } from './unhead.Bjbp1C8D.mjs';
6
+
7
+ const tagWeight = (tag) => typeof tag.tagPriority === "number" ? tag.tagPriority : 100 + (TagPriorityAliases[tag.tagPriority] || 0);
8
+ function createHead(options = {}) {
9
+ options.document = options.document || (typeof window !== "undefined" ? document : void 0);
10
+ const renderer = options.render || createDomRenderer({ document: options.document });
11
+ const core = createUnhead(renderer, { document: options.document, propResolvers: options.propResolvers, _tagWeight: tagWeight, init: [] });
12
+ const hooks = createHooks(options.hooks);
13
+ const head = createClientHeadAdapter(core, hooks, renderer);
14
+ options.plugins?.forEach((p) => head.use(p));
15
+ options.init?.forEach((e) => e && head.push(e));
16
+ return head;
17
+ }
18
+
19
+ export { createHead as c };