shelfware 0.0.1 → 0.1.0

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/4c307968-4837-497b-a570-d6ee336accc4.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 +158 -0
  204. package/bin/shelfware.mjs +6 -0
  205. package/package.json +64 -5
  206. package/cli.mjs +0 -3
@@ -0,0 +1,445 @@
1
+ import { parseHtmlForIndexes, applyHeadToHtml } from '../parser.mjs';
2
+ export { prepareTemplate } from '../parser.mjs';
3
+ import { c as createHead } from '../shared/unhead.Dssd7L5I.mjs';
4
+ import { e as resolveHeadInput, h as hashTag, n as normalizeEntryToTags, b as normalizeProps, d as dedupeKey } from '../shared/unhead.-hZVKou0.mjs';
5
+ import { a as callHook } from '../shared/unhead.Bm4Y6XQI.mjs';
6
+ import { DEFAULT_STREAM_KEY } from './client.mjs';
7
+ import '../shared/unhead.Bf_fPVYA.mjs';
8
+ import '../shared/unhead.D7HkBzZn.mjs';
9
+ import '../shared/unhead.CGPOfp5O.mjs';
10
+ import 'hookable';
11
+ import '../shared/unhead.C5Bksi2B.mjs';
12
+
13
+ const LT_RE = /</g;
14
+ const GT_RE = />/g;
15
+ const AMP_RE = /&/g;
16
+ const SSR_OUTLET_RE = /<!--\s*(?:app-html|ssr-outlet)\s*-->/;
17
+ let encoder;
18
+ let preparedStreamingLayouts;
19
+ const VALID_STREAM_KEY_RE = /^[$_a-z][$\w]*$/i;
20
+ function assertValidStreamKey(streamKey) {
21
+ if (typeof streamKey !== "string" || !VALID_STREAM_KEY_RE.test(streamKey)) {
22
+ throw new Error(
23
+ `[unhead] Invalid streamKey: must be a valid JavaScript identifier matching ${VALID_STREAM_KEY_RE}. Received: ${JSON.stringify(streamKey)}`
24
+ );
25
+ }
26
+ }
27
+ // @__NO_SIDE_EFFECTS__
28
+ function createStreamableHead(options = {}) {
29
+ const { streamKey, writesBodyTags, ...rest } = options;
30
+ if (streamKey !== void 0)
31
+ assertValidStreamKey(streamKey);
32
+ const head = createHead({
33
+ ...rest,
34
+ experimentalStreamKey: streamKey
35
+ });
36
+ if (writesBodyTags)
37
+ streamState(head).writesBodyTags = true;
38
+ let resolveShellReady;
39
+ const shellReady = new Promise((resolve) => {
40
+ resolveShellReady = resolve;
41
+ });
42
+ return {
43
+ head,
44
+ onShellReady: () => resolveShellReady(),
45
+ shellReady
46
+ };
47
+ }
48
+ function getStreamKey(head) {
49
+ const key = head.resolvedOptions.experimentalStreamKey || DEFAULT_STREAM_KEY;
50
+ assertValidStreamKey(key);
51
+ return key;
52
+ }
53
+ function createBootstrapScript(streamKey = DEFAULT_STREAM_KEY, nonce) {
54
+ assertValidStreamKey(streamKey);
55
+ const nonceAttr = nonce ? ` nonce="${nonce.replace(/"/g, "&quot;")}"` : "";
56
+ return `<script${nonceAttr}>window.${streamKey}||(window.${streamKey}={_q:[],push(e){this._q.push(e)}})<\/script>`;
57
+ }
58
+ function renderShell(head) {
59
+ const result = head.render();
60
+ rememberShellBodyTags(head);
61
+ head.entries.clear();
62
+ return result;
63
+ }
64
+ function renderSSRHeadShell(head, template) {
65
+ const parsed = typeof template === "string" ? parseHtmlForIndexes(template) : template;
66
+ const result = applyShellToTemplate(head, head.render(), parsed);
67
+ rememberShellBodyTags(head);
68
+ head.entries.clear();
69
+ return result;
70
+ }
71
+ function applyShellToTemplate(head, ssr, parsed) {
72
+ return applyHeadToHtml(parsed, {
73
+ htmlAttrs: ssr.htmlAttrs,
74
+ headTags: createBootstrapScript(getStreamKey(head)) + ssr.headTags,
75
+ bodyAttrs: ssr.bodyAttrs,
76
+ bodyTags: ssr.bodyTags
77
+ });
78
+ }
79
+ function normalizePendingTags(head) {
80
+ const propResolvers = head.resolvedOptions.propResolvers || [];
81
+ const tags = [];
82
+ const entries = /* @__PURE__ */ new Map();
83
+ for (const entry of head.entries.values()) {
84
+ const resolved = resolveHeadInput(unwrapEntryInput(entry.input), propResolvers);
85
+ entries.set(entry._i, { input: entry.input, resolved });
86
+ let index = 0;
87
+ for (const tag of normalizeEntryToTags(resolved, [])) {
88
+ if (entry.options)
89
+ Object.assign(tag, entry.options);
90
+ tag._p = (entry._i << 10) + index++;
91
+ if (tag.tag === "templateParams")
92
+ tag.props = { ...tag.props };
93
+ tags.push(tag);
94
+ }
95
+ }
96
+ return { tags, entries };
97
+ }
98
+ const JSON_LD_TYPE_RE = /\bld\+json\b/i;
99
+ function streamState(head) {
100
+ return head._stream ||= {};
101
+ }
102
+ function isStreamedBodyTag(tagName, tag, entryPosition) {
103
+ if (!tag || typeof tag !== "object")
104
+ return false;
105
+ if (tagName === "noscript")
106
+ return true;
107
+ const position = tag.tagPosition ?? entryPosition;
108
+ if (position === "bodyClose" || position === "bodyOpen")
109
+ return true;
110
+ const type = tag.type ?? tag.props?.type;
111
+ return tagName === "script" && typeof type === "string" && JSON_LD_TYPE_RE.test(type);
112
+ }
113
+ function streamedBodyTagIdentity(tagName, tag) {
114
+ const normalized = normalizeProps({ tag: tagName, props: {} }, tag);
115
+ const content = hashTag(normalized);
116
+ return { slot: dedupeKey(normalized) || content, content };
117
+ }
118
+ function unwrapEntryInput(input) {
119
+ return typeof input === "function" ? input() : input;
120
+ }
121
+ function rememberShellBodyTags(head) {
122
+ const state = streamState(head);
123
+ let seen = state.seen;
124
+ for (const entry of head.entries.values()) {
125
+ const entryPosition = entry.options?.tagPosition;
126
+ for (const tag of entry._tags || entry._precomputedTags || []) {
127
+ if (!isStreamedBodyTag(tag.tag, tag, entryPosition))
128
+ continue;
129
+ seen ||= state.seen = /* @__PURE__ */ new Set();
130
+ if (tag.textContent || tag.innerHTML)
131
+ seen.add(String(tag.textContent || tag.innerHTML));
132
+ seen.add(tag._d || tag._h || hashTag(tag));
133
+ }
134
+ }
135
+ }
136
+ function hasStreamedBodyTags(input, entryPosition) {
137
+ if (input && typeof input === "object") {
138
+ for (const key in input) {
139
+ const value = input[key];
140
+ if (Array.isArray(value)) {
141
+ for (const tag of value) {
142
+ if (isStreamedBodyTag(key, tag, entryPosition))
143
+ return true;
144
+ }
145
+ }
146
+ }
147
+ }
148
+ return false;
149
+ }
150
+ function splitStreamedBodyTags(input, seen, entryPosition) {
151
+ let patch;
152
+ let bodyTags;
153
+ for (const key in input) {
154
+ const value = input[key];
155
+ if (!Array.isArray(value) || !value.some((tag) => isStreamedBodyTag(key, tag, entryPosition)))
156
+ continue;
157
+ const rest = [];
158
+ const carried = [];
159
+ for (const tag of value) {
160
+ if (!isStreamedBodyTag(key, tag, entryPosition)) {
161
+ rest.push(tag);
162
+ continue;
163
+ }
164
+ const id = streamedBodyTagIdentity(key, tag);
165
+ if (seen.has(id.content))
166
+ continue;
167
+ if (seen.has(id.slot)) {
168
+ rest.push(tag);
169
+ continue;
170
+ }
171
+ seen.add(id.content);
172
+ carried.push({ ...tag, tagPosition: "bodyClose" });
173
+ }
174
+ patch ||= { ...input };
175
+ if (rest.length)
176
+ patch[key] = rest;
177
+ else
178
+ delete patch[key];
179
+ if (carried.length)
180
+ (bodyTags ||= {})[key] = carried;
181
+ }
182
+ const hasPatch = Object.keys(patch).some((k) => patch[k] !== void 0);
183
+ return { patch: hasPatch ? patch : void 0, bodyTags };
184
+ }
185
+ function renderStreamBodyTags(head) {
186
+ const bodyTagInputs = streamState(head).bodyTags;
187
+ if (!bodyTagInputs?.length) {
188
+ return "";
189
+ }
190
+ const restore = new Map(head.entries);
191
+ head.entries.clear();
192
+ try {
193
+ for (const input of bodyTagInputs)
194
+ head.push(input);
195
+ const bodyTags = head.render().bodyTags;
196
+ streamState(head).bodyTags = void 0;
197
+ return bodyTags;
198
+ } finally {
199
+ head.entries.clear();
200
+ for (const [k, v] of restore)
201
+ head.entries.set(k, v);
202
+ }
203
+ }
204
+ function renderStreamEnd(head, parts) {
205
+ const bodyTags = renderStreamBodyTags(head);
206
+ if (!bodyTags)
207
+ return parts.end;
208
+ const at = parts.bodyTagsAt ?? parts.end.length;
209
+ return parts.end.slice(0, at) + bodyTags + parts.end.slice(at);
210
+ }
211
+ function renderSSRHeadSuspenseChunk(head) {
212
+ if (!head.entries.size)
213
+ return "";
214
+ const streamKey = getStreamKey(head);
215
+ const propResolvers = head.resolvedOptions.propResolvers || [];
216
+ let normalizedEntries;
217
+ let serialized;
218
+ let patchCount = 0;
219
+ try {
220
+ if (head.hooks?._hooks?.["ssr:streamChunk"]?.length) {
221
+ const normalized = normalizePendingTags(head);
222
+ normalizedEntries = normalized.entries;
223
+ callHook(head, "ssr:streamChunk", { tags: normalized.tags });
224
+ }
225
+ const state = streamState(head);
226
+ let nextSeen;
227
+ const inputs = [];
228
+ let bodyTags;
229
+ for (const entry of head.entries.values()) {
230
+ const normalized = normalizedEntries?.get(entry._i);
231
+ const input = normalized && normalized.input === entry.input ? normalized.resolved : resolveHeadInput(unwrapEntryInput(entry.input), propResolvers);
232
+ const entryPosition = entry.options?.tagPosition;
233
+ if (!state.writesBodyTags || !hasStreamedBodyTags(input, entryPosition)) {
234
+ inputs.push(input);
235
+ continue;
236
+ }
237
+ const split = splitStreamedBodyTags(input, nextSeen ||= new Set(state.seen), entryPosition);
238
+ if (split.patch)
239
+ inputs.push(split.patch);
240
+ if (split.bodyTags)
241
+ (bodyTags ||= []).push(split.bodyTags);
242
+ }
243
+ serialized = safeJsonStringify(inputs);
244
+ patchCount = inputs.length;
245
+ if (nextSeen)
246
+ state.seen = nextSeen;
247
+ if (bodyTags)
248
+ (state.bodyTags ||= []).push(...bodyTags);
249
+ } catch (error) {
250
+ for (const [key, entry] of head.entries) {
251
+ try {
252
+ safeJsonStringify(resolveHeadInput(unwrapEntryInput(entry.input), propResolvers));
253
+ } catch {
254
+ head.entries.delete(key);
255
+ }
256
+ }
257
+ throw error;
258
+ }
259
+ head.entries.clear();
260
+ if (!patchCount)
261
+ return "";
262
+ return `window.${streamKey}.push(${serialized})`;
263
+ }
264
+ function safeJsonStringify(obj) {
265
+ return JSON.stringify(obj).replace(LT_RE, "\\u003c").replace(GT_RE, "\\u003e").replace(AMP_RE, "\\u0026");
266
+ }
267
+ function wrapStream(head, stream, template, preRenderedState, options) {
268
+ streamState(head).writesBodyTags = true;
269
+ const flushChunk = options?.flushChunk ?? (() => {
270
+ let chunk;
271
+ try {
272
+ chunk = renderSSRHeadSuspenseChunk(head);
273
+ } catch {
274
+ return "";
275
+ }
276
+ if (!chunk)
277
+ return "";
278
+ return `<script>window.${getStreamKey(head)}&&(${chunk});document.currentScript.remove()<\/script>`;
279
+ });
280
+ const enc = encoder ??= new TextEncoder();
281
+ let reader;
282
+ let parts;
283
+ return new ReadableStream({
284
+ // Async so a failure here rejects into an errored stream instead of
285
+ // throwing synchronously out of the constructor. The reader is acquired
286
+ // before rendering (and released if rendering fails) so a failure at
287
+ // either step leaves `head.entries` intact and the upstream unlocked
288
+ // for retry.
289
+ async start(controller) {
290
+ const activeReader = stream.getReader();
291
+ let prepared;
292
+ try {
293
+ prepared = prepareStreamingTemplate(head, template, preRenderedState);
294
+ } catch (error) {
295
+ activeReader.releaseLock();
296
+ throw error;
297
+ }
298
+ reader = activeReader;
299
+ parts = prepared;
300
+ controller.enqueue(enc.encode(prepared.shell));
301
+ },
302
+ // Read at most one upstream chunk per downstream request so backpressure
303
+ // propagates instead of eagerly draining the app stream.
304
+ async pull(controller) {
305
+ const activeReader = reader;
306
+ if (!activeReader)
307
+ return;
308
+ const result = await activeReader.read().then(
309
+ (value) => ({ ok: true, value }),
310
+ (error) => ({ ok: false, error })
311
+ );
312
+ if (activeReader !== reader)
313
+ return;
314
+ if (!result.ok) {
315
+ reader = void 0;
316
+ activeReader.releaseLock();
317
+ controller.error(result.error);
318
+ return;
319
+ }
320
+ if (result.value.done) {
321
+ reader = void 0;
322
+ activeReader.releaseLock();
323
+ const extra2 = flushChunk?.();
324
+ if (extra2)
325
+ controller.enqueue(enc.encode(extra2));
326
+ const closing = parts ? renderStreamEnd(head, parts) : "";
327
+ if (closing)
328
+ controller.enqueue(enc.encode(closing));
329
+ controller.close();
330
+ return;
331
+ }
332
+ controller.enqueue(result.value.value);
333
+ const extra = flushChunk?.();
334
+ if (extra)
335
+ controller.enqueue(enc.encode(extra));
336
+ },
337
+ async cancel(reason) {
338
+ const activeReader = reader;
339
+ reader = void 0;
340
+ if (activeReader) {
341
+ try {
342
+ await activeReader.cancel(reason);
343
+ } catch {
344
+ }
345
+ activeReader.releaseLock();
346
+ }
347
+ }
348
+ });
349
+ }
350
+ function createStreamingTemplateLayout(parsed) {
351
+ const html = parsed.html;
352
+ const bodyEnd = parsed.indexes.bodyTagEnd;
353
+ const bodyCloseStart = parsed.indexes.bodyCloseTagStart;
354
+ if (bodyEnd < 0 || bodyCloseStart < 0)
355
+ return;
356
+ const bodyInterior = html.substring(bodyEnd, bodyCloseStart);
357
+ const markerMatch = bodyInterior.match(SSR_OUTLET_RE);
358
+ let beforeStream;
359
+ let afterStream;
360
+ if (markerMatch) {
361
+ beforeStream = bodyInterior.substring(0, markerMatch.index);
362
+ afterStream = bodyInterior.substring(markerMatch.index + markerMatch[0].length);
363
+ } else {
364
+ beforeStream = "";
365
+ afterStream = bodyInterior;
366
+ }
367
+ const shellPart = html.substring(0, bodyEnd) + beforeStream;
368
+ const endPart = html.substring(bodyCloseStart);
369
+ let shellTemplate;
370
+ if (bodyCloseStart >= bodyEnd) {
371
+ const shellLen = shellPart.length;
372
+ const { htmlTagStart, headTagEnd, bodyTagStart } = parsed.indexes;
373
+ const shellHtmlTagStart = htmlTagStart >= 0 && htmlTagStart + 5 <= shellLen ? htmlTagStart : -1;
374
+ let shellHtmlTagEnd = -1;
375
+ if (shellHtmlTagStart >= 0) {
376
+ const gt = shellPart.indexOf(">", shellHtmlTagStart);
377
+ shellHtmlTagEnd = gt >= 0 ? gt + 1 : shellLen + 7;
378
+ }
379
+ shellTemplate = {
380
+ html: `${shellPart}</body></html>`,
381
+ input: parsed.input,
382
+ indexes: {
383
+ htmlTagStart: shellHtmlTagStart,
384
+ htmlTagEnd: shellHtmlTagEnd,
385
+ headTagEnd: headTagEnd >= 0 && headTagEnd + 7 <= shellLen ? headTagEnd : -1,
386
+ // <body> is always fully inside the prefix in this branch.
387
+ bodyTagStart,
388
+ bodyTagEnd: bodyEnd,
389
+ bodyCloseTagStart: bodyCloseStart + 7 <= shellLen ? bodyCloseStart : shellLen
390
+ }
391
+ };
392
+ } else {
393
+ shellTemplate = parseHtmlForIndexes(`${shellPart}</body></html>`);
394
+ }
395
+ return {
396
+ shellTemplate,
397
+ endBeforeBodyTags: afterStream,
398
+ endAfterBodyTags: endPart
399
+ };
400
+ }
401
+ function getPreparedStreamingLayout(template) {
402
+ const cache = preparedStreamingLayouts ||= /* @__PURE__ */ new WeakMap();
403
+ let layout = cache.get(template);
404
+ if (layout === void 0) {
405
+ layout = createStreamingTemplateLayout(template) || null;
406
+ if (layout) {
407
+ Object.freeze(layout.shellTemplate.indexes);
408
+ Object.freeze(layout.shellTemplate);
409
+ Object.freeze(layout);
410
+ }
411
+ cache.set(template, layout);
412
+ }
413
+ return layout || void 0;
414
+ }
415
+ function prepareStreamingTemplate(head, template, preRenderedState) {
416
+ const ssr = preRenderedState ?? head.render();
417
+ const parsed = typeof template === "string" ? parseHtmlForIndexes(template) : template;
418
+ const layout = typeof template === "string" ? createStreamingTemplateLayout(parsed) : getPreparedStreamingLayout(template);
419
+ let parts;
420
+ if (layout) {
421
+ const shell = applyHeadToHtml(layout.shellTemplate, {
422
+ htmlAttrs: ssr.htmlAttrs,
423
+ headTags: createBootstrapScript(getStreamKey(head)) + ssr.headTags,
424
+ bodyAttrs: ssr.bodyAttrs,
425
+ bodyTags: ""
426
+ }).replace("</body></html>", "");
427
+ parts = {
428
+ shell,
429
+ end: layout.endBeforeBodyTags + ssr.bodyTags + layout.endAfterBodyTags,
430
+ bodyTagsAt: layout.endBeforeBodyTags.length
431
+ };
432
+ } else {
433
+ parts = {
434
+ shell: applyShellToTemplate(head, ssr, parsed),
435
+ end: ""
436
+ };
437
+ }
438
+ if (!preRenderedState) {
439
+ rememberShellBodyTags(head);
440
+ head.entries.clear();
441
+ }
442
+ return parts;
443
+ }
444
+
445
+ export { createBootstrapScript, createStreamableHead, prepareStreamingTemplate, renderSSRHeadShell, renderSSRHeadSuspenseChunk, renderShell, renderStreamBodyTags, renderStreamEnd, wrapStream };
@@ -0,0 +1,7 @@
1
+ export { D as DupeableTags, H as HasElementTags, M as MetaTagsArrayable, S as ScriptNetworkEvents, a as SelfClosingTags, T as TagConfigKeys, b as TagPriorityAliases, c as TagsWithInnerContent, U as UniqueTags, d as UsesMergeStrategy, V as ValidHeadTags } from './shared/unhead.CGPOfp5O.mjs';
2
+ export { d as dedupeKey, a as dedupeTags, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, b as normalizeProps, r as resolveTags, c as resolveTitleTemplate, s as sanitizeTags, w as walkResolver } from './shared/unhead.-hZVKou0.mjs';
3
+ export { h as hasOwn } from './shared/unhead.Bf_fPVYA.mjs';
4
+ export { r as resolveMetaKeyType, a as resolveMetaKeyValue, b as resolvePackedMetaObjectValue, u as unpackMeta } from './shared/unhead.BQWSw36o.mjs';
5
+ export { p as processTemplateParams } from './shared/unhead.BGFxPGPQ.mjs';
6
+ import './shared/unhead.Bm4Y6XQI.mjs';
7
+ import 'hookable';
@@ -0,0 +1,179 @@
1
+ {
2
+ "name": "unhead",
3
+ "type": "module",
4
+ "version": "3.4.0",
5
+ "description": "Full-stack <head> manager built for any framework.",
6
+ "author": {
7
+ "name": "Harlan Wilton",
8
+ "email": "harlan@harlanzw.com",
9
+ "url": "https://harlanzw.com/"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "tag": "next"
14
+ },
15
+ "license": "MIT",
16
+ "funding": "https://github.com/sponsors/harlan-zw",
17
+ "homepage": "https://unhead.unjs.io",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/unjs/unhead.git",
21
+ "directory": "packages/unhead"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/unjs/unhead/issues"
25
+ },
26
+ "sideEffects": false,
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.mjs"
31
+ },
32
+ "./plugins": {
33
+ "types": "./dist/plugins.d.ts",
34
+ "default": "./dist/plugins.mjs"
35
+ },
36
+ "./legacy": {
37
+ "types": "./dist/legacy.d.ts",
38
+ "default": "./dist/legacy.mjs"
39
+ },
40
+ "./minify": {
41
+ "types": "./dist/minify.d.ts",
42
+ "default": "./dist/minify.mjs"
43
+ },
44
+ "./server": {
45
+ "types": "./dist/server.d.ts",
46
+ "default": "./dist/server.mjs"
47
+ },
48
+ "./client": {
49
+ "types": "./dist/client.d.ts",
50
+ "default": "./dist/client.mjs"
51
+ },
52
+ "./stream/server": {
53
+ "types": "./dist/stream/server.d.ts",
54
+ "default": "./dist/stream/server.mjs"
55
+ },
56
+ "./stream/client": {
57
+ "types": "./dist/stream/client.d.ts",
58
+ "default": "./dist/stream/client.mjs"
59
+ },
60
+ "./utils": {
61
+ "types": "./dist/utils.d.ts",
62
+ "default": "./dist/utils.mjs"
63
+ },
64
+ "./types": {
65
+ "types": "./dist/types.d.ts",
66
+ "default": "./dist/types.mjs"
67
+ },
68
+ "./scripts": {
69
+ "types": "./dist/scripts.d.ts",
70
+ "node": "./dist/scripts.node.mjs",
71
+ "default": "./dist/scripts.mjs"
72
+ },
73
+ "./scripts/triggers": {
74
+ "types": "./dist/scripts/triggers.d.ts",
75
+ "default": "./dist/scripts/triggers.mjs"
76
+ },
77
+ "./parser": {
78
+ "types": "./dist/parser.d.ts",
79
+ "default": "./dist/parser.mjs"
80
+ },
81
+ "./validate": {
82
+ "types": "./dist/validate.d.ts",
83
+ "default": "./dist/validate.mjs"
84
+ },
85
+ "./stream/unplugin": {
86
+ "types": "./dist/stream/unplugin.d.ts",
87
+ "default": "./dist/stream/unplugin.mjs"
88
+ },
89
+ "./stream/vite": {
90
+ "types": "./dist/stream/vite.d.ts",
91
+ "default": "./dist/stream/vite.mjs"
92
+ },
93
+ "./stream/iife": {
94
+ "types": "./dist/stream/iife.d.ts",
95
+ "default": "./dist/stream/iife.mjs"
96
+ }
97
+ },
98
+ "main": "dist/index.mjs",
99
+ "module": "dist/index.mjs",
100
+ "types": "dist/index.d.ts",
101
+ "typesVersions": {
102
+ "*": {
103
+ "plugins": [
104
+ "dist/plugins.d.ts"
105
+ ],
106
+ "legacy": [
107
+ "dist/legacy.d.ts"
108
+ ],
109
+ "minify": [
110
+ "dist/minify.d.ts"
111
+ ],
112
+ "server": [
113
+ "dist/server.d.ts"
114
+ ],
115
+ "client": [
116
+ "dist/client.d.ts"
117
+ ],
118
+ "stream/server": [
119
+ "dist/stream/server.d.ts"
120
+ ],
121
+ "stream/client": [
122
+ "dist/stream/client.d.ts"
123
+ ],
124
+ "utils": [
125
+ "dist/utils.d.ts"
126
+ ],
127
+ "types": [
128
+ "dist/types.d.ts"
129
+ ],
130
+ "scripts": [
131
+ "dist/scripts.d.ts"
132
+ ],
133
+ "scripts/triggers": [
134
+ "dist/scripts/triggers.d.ts"
135
+ ],
136
+ "parser": [
137
+ "dist/parser.d.ts"
138
+ ],
139
+ "validate": [
140
+ "dist/validate.d.ts"
141
+ ],
142
+ "stream/unplugin": [
143
+ "dist/stream/unplugin.d.ts"
144
+ ],
145
+ "stream/vite": [
146
+ "dist/stream/vite.d.ts"
147
+ ],
148
+ "stream/iife": [
149
+ "dist/stream/iife.d.ts"
150
+ ]
151
+ }
152
+ },
153
+ "files": [
154
+ "*.d.ts",
155
+ "dist"
156
+ ],
157
+ "peerDependencies": {
158
+ "vite": ">=6.4.2"
159
+ },
160
+ "peerDependenciesMeta": {
161
+ "vite": {
162
+ "optional": true
163
+ }
164
+ },
165
+ "dependencies": {
166
+ "hookable": "^6.1.1",
167
+ "unplugin": "^3.3.0"
168
+ },
169
+ "devDependencies": {
170
+ "@rollup/plugin-node-resolve": "^16.0.3",
171
+ "rollup": "^4.62.4",
172
+ "vite": "^8.2.1"
173
+ },
174
+ "scripts": {
175
+ "build": "unbuild",
176
+ "stub": "unbuild --stub",
177
+ "test:attw": "attw --pack"
178
+ }
179
+ }