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,257 @@
1
+ function flatHooks(configHooks, hooks = {}, parentName) {
2
+ for (const key in configHooks) {
3
+ const subHook = configHooks[key];
4
+ const name = parentName ? `${parentName}:${key}` : key;
5
+ if (typeof subHook === "object" && subHook !== null) flatHooks(subHook, hooks, name);
6
+ else if (typeof subHook === "function") hooks[name] = subHook;
7
+ }
8
+ return hooks;
9
+ }
10
+ function mergeHooks(...hooks) {
11
+ const finalHooks = {};
12
+ for (const hook of hooks) {
13
+ const flatenHook = flatHooks(hook);
14
+ for (const key in flatenHook) if (finalHooks[key]) finalHooks[key].push(flatenHook[key]);
15
+ else finalHooks[key] = [flatenHook[key]];
16
+ }
17
+ for (const key in finalHooks) if (finalHooks[key].length > 1) {
18
+ const array = finalHooks[key];
19
+ finalHooks[key] = (...arguments_) => serial(array, (function_) => function_(...arguments_));
20
+ } else finalHooks[key] = finalHooks[key][0];
21
+ return finalHooks;
22
+ }
23
+ function serial(tasks, function_) {
24
+ return tasks.reduce((promise, task) => promise.then(() => function_(task)), Promise.resolve());
25
+ }
26
+ const createTask = /* @__PURE__ */ (() => {
27
+ if (console.createTask) return console.createTask;
28
+ const defaultTask = { run: (fn) => fn() };
29
+ return () => defaultTask;
30
+ })();
31
+ function callHooks(hooks, args, startIndex, task) {
32
+ for (let i = startIndex; i < hooks.length; i += 1) try {
33
+ const result = task ? task.run(() => hooks[i](...args)) : hooks[i](...args);
34
+ if (result && typeof result.then === "function") return Promise.resolve(result).then(() => callHooks(hooks, args, i + 1, task));
35
+ } catch (error) {
36
+ return Promise.reject(error);
37
+ }
38
+ }
39
+ function serialTaskCaller(hooks, args, name) {
40
+ if (hooks.length > 0) return callHooks(hooks, args, 0, createTask(name));
41
+ }
42
+ function parallelTaskCaller(hooks, args, name) {
43
+ if (hooks.length > 0) {
44
+ const task = createTask(name);
45
+ return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
46
+ }
47
+ }
48
+ function serialCaller(hooks, arguments_) {
49
+ return hooks.reduce((promise, hookFunction) => promise.then(() => hookFunction(...arguments_ || [])), Promise.resolve());
50
+ }
51
+ function parallelCaller(hooks, args) {
52
+ return Promise.all(hooks.map((hook) => hook(...args || [])));
53
+ }
54
+ function callEachWith(callbacks, arg0) {
55
+ for (const callback of [...callbacks]) callback(arg0);
56
+ }
57
+ var Hookable = class {
58
+ _hooks;
59
+ _before;
60
+ _after;
61
+ _deprecatedHooks;
62
+ _deprecatedMessages;
63
+ constructor() {
64
+ this._hooks = {};
65
+ this._before = void 0;
66
+ this._after = void 0;
67
+ this._deprecatedMessages = void 0;
68
+ this._deprecatedHooks = {};
69
+ this.hook = this.hook.bind(this);
70
+ this.callHook = this.callHook.bind(this);
71
+ this.callHookWith = this.callHookWith.bind(this);
72
+ }
73
+ hook(name, function_, options = {}) {
74
+ if (!name || typeof function_ !== "function") return () => {};
75
+ const originalName = name;
76
+ let dep;
77
+ while (this._deprecatedHooks[name]) {
78
+ dep = this._deprecatedHooks[name];
79
+ name = dep.to;
80
+ }
81
+ if (dep && !options.allowDeprecated) {
82
+ let message = dep.message;
83
+ if (!message) message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
84
+ if (!this._deprecatedMessages) this._deprecatedMessages = /* @__PURE__ */ new Set();
85
+ if (!this._deprecatedMessages.has(message)) {
86
+ console.warn(message);
87
+ this._deprecatedMessages.add(message);
88
+ }
89
+ }
90
+ if (!function_.name) try {
91
+ Object.defineProperty(function_, "name", {
92
+ get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
93
+ configurable: true
94
+ });
95
+ } catch {}
96
+ this._hooks[name] = this._hooks[name] || [];
97
+ this._hooks[name].push(function_);
98
+ return () => {
99
+ if (function_) {
100
+ this.removeHook(name, function_);
101
+ function_ = void 0;
102
+ }
103
+ };
104
+ }
105
+ hookOnce(name, function_) {
106
+ let _unreg;
107
+ let _function = (...arguments_) => {
108
+ if (typeof _unreg === "function") _unreg();
109
+ _unreg = void 0;
110
+ _function = void 0;
111
+ return function_(...arguments_);
112
+ };
113
+ _unreg = this.hook(name, _function);
114
+ return _unreg;
115
+ }
116
+ removeHook(name, function_) {
117
+ const hooks = this._hooks[name];
118
+ if (hooks) {
119
+ const index = hooks.indexOf(function_);
120
+ if (index !== -1) hooks.splice(index, 1);
121
+ if (hooks.length === 0) this._hooks[name] = void 0;
122
+ }
123
+ }
124
+ clearHook(name) {
125
+ this._hooks[name] = void 0;
126
+ }
127
+ deprecateHook(name, deprecated) {
128
+ this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
129
+ const _hooks = this._hooks[name] || [];
130
+ this._hooks[name] = void 0;
131
+ for (const hook of _hooks) this.hook(name, hook);
132
+ }
133
+ deprecateHooks(deprecatedHooks) {
134
+ for (const name in deprecatedHooks) this.deprecateHook(name, deprecatedHooks[name]);
135
+ }
136
+ addHooks(configHooks) {
137
+ const hooks = flatHooks(configHooks);
138
+ const removeFns = Object.keys(hooks).map((key) => this.hook(key, hooks[key]));
139
+ return () => {
140
+ for (const unreg of removeFns) unreg();
141
+ removeFns.length = 0;
142
+ };
143
+ }
144
+ removeHooks(configHooks) {
145
+ const hooks = flatHooks(configHooks);
146
+ for (const key in hooks) this.removeHook(key, hooks[key]);
147
+ }
148
+ removeAllHooks() {
149
+ this._hooks = {};
150
+ }
151
+ callHook(name, ...args) {
152
+ return this.callHookWith(serialTaskCaller, name, args);
153
+ }
154
+ callHookParallel(name, ...args) {
155
+ return this.callHookWith(parallelTaskCaller, name, args);
156
+ }
157
+ callHookWith(caller, name, args) {
158
+ const event = this._before || this._after ? {
159
+ name,
160
+ args,
161
+ context: {}
162
+ } : void 0;
163
+ if (this._before) callEachWith(this._before, event);
164
+ const result = caller(this._hooks[name] ? [...this._hooks[name]] : [], args, name);
165
+ if (result instanceof Promise) return result.finally(() => {
166
+ if (this._after && event) callEachWith(this._after, event);
167
+ });
168
+ if (this._after && event) callEachWith(this._after, event);
169
+ return result;
170
+ }
171
+ beforeEach(function_) {
172
+ this._before = this._before || [];
173
+ this._before.push(function_);
174
+ return () => {
175
+ if (this._before !== void 0) {
176
+ const index = this._before.indexOf(function_);
177
+ if (index !== -1) this._before.splice(index, 1);
178
+ }
179
+ };
180
+ }
181
+ afterEach(function_) {
182
+ this._after = this._after || [];
183
+ this._after.push(function_);
184
+ return () => {
185
+ if (this._after !== void 0) {
186
+ const index = this._after.indexOf(function_);
187
+ if (index !== -1) this._after.splice(index, 1);
188
+ }
189
+ };
190
+ }
191
+ };
192
+ function createHooks() {
193
+ return new Hookable();
194
+ }
195
+ var HookableCore = class {
196
+ _hooks;
197
+ constructor() {
198
+ this._hooks = {};
199
+ }
200
+ hook(name, fn) {
201
+ if (!name || typeof fn !== "function") return () => {};
202
+ this._hooks[name] = this._hooks[name] || [];
203
+ this._hooks[name].push(fn);
204
+ return () => {
205
+ if (fn) {
206
+ this.removeHook(name, fn);
207
+ fn = void 0;
208
+ }
209
+ };
210
+ }
211
+ removeHook(name, function_) {
212
+ const hooks = this._hooks[name];
213
+ if (hooks) {
214
+ const index = hooks.indexOf(function_);
215
+ if (index !== -1) hooks.splice(index, 1);
216
+ if (hooks.length === 0) this._hooks[name] = void 0;
217
+ }
218
+ }
219
+ callHook(name, ...args) {
220
+ const hooks = this._hooks[name];
221
+ if (!hooks || hooks.length === 0) return;
222
+ return callHooks(hooks, args, 0);
223
+ }
224
+ };
225
+ const isBrowser = typeof window !== "undefined";
226
+ function createDebugger(hooks, _options = {}) {
227
+ const options = {
228
+ inspect: isBrowser,
229
+ group: isBrowser,
230
+ filter: () => true,
231
+ ..._options
232
+ };
233
+ const _filter = options.filter;
234
+ const filter = typeof _filter === "string" ? (name) => name.startsWith(_filter) : _filter;
235
+ const _tag = options.tag ? `[${options.tag}] ` : "";
236
+ const logPrefix = (event) => _tag + event.name + "".padEnd(event._id, "\0");
237
+ const _idCtr = {};
238
+ const unsubscribeBefore = hooks.beforeEach((event) => {
239
+ if (filter !== void 0 && !filter(event.name)) return;
240
+ _idCtr[event.name] = _idCtr[event.name] || 0;
241
+ event._id = _idCtr[event.name]++;
242
+ console.time(logPrefix(event));
243
+ });
244
+ const unsubscribeAfter = hooks.afterEach((event) => {
245
+ if (filter !== void 0 && !filter(event.name)) return;
246
+ if (options.group) console.groupCollapsed(event.name);
247
+ if (options.inspect) console.timeLog(logPrefix(event), event.args);
248
+ else console.timeEnd(logPrefix(event));
249
+ if (options.group) console.groupEnd();
250
+ _idCtr[event.name]--;
251
+ });
252
+ return { close: () => {
253
+ unsubscribeBefore();
254
+ unsubscribeAfter();
255
+ } };
256
+ }
257
+ export { Hookable, HookableCore, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "hookable",
3
+ "version": "6.1.1",
4
+ "description": "Awaitable hook system",
5
+ "keywords": [
6
+ "hook",
7
+ "hookable",
8
+ "plugin",
9
+ "tapable",
10
+ "tappable"
11
+ ],
12
+ "license": "MIT",
13
+ "repository": "unjs/hookable",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "type": "module",
18
+ "sideEffects": false,
19
+ "main": "./dist/index.mjs",
20
+ "types": "./dist/index.d.mts",
21
+ "exports": {
22
+ ".": "./dist/index.mjs"
23
+ },
24
+ "scripts": {
25
+ "bench": "node --expose-gc --allow-natives-syntax test/bench.ts",
26
+ "build": "obuild src/index.ts",
27
+ "dev": "vitest",
28
+ "lint": "oxlint . && oxfmt --check src test",
29
+ "lint:fix": "oxlint . --fix && oxfmt src test",
30
+ "prepublish": "pnpm build",
31
+ "release": "pnpm test && pnpm build && changelogen --release --publish --push",
32
+ "test": "pnpm lint && vitest run --coverage",
33
+ "test:types": "tsgo --noEmit"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^25.6.0",
37
+ "@typescript/native-preview": "^7.0.0-dev.20260414.1",
38
+ "@vitest/coverage-v8": "^4.1.4",
39
+ "changelogen": "^0.6.2",
40
+ "esbuild": "^0.28.0",
41
+ "eslint-config-unjs": "^0.6.2",
42
+ "expect-type": "^1.3.0",
43
+ "hookable-prev": "npm:hookable@^6.1.0",
44
+ "mitata": "^1.0.34",
45
+ "obuild": "^0.4.33",
46
+ "oxfmt": "^0.45.0",
47
+ "oxlint": "^1.60.0",
48
+ "typescript": "^6.0.2",
49
+ "vite": "^8.0.8",
50
+ "vitest": "^4.1.4"
51
+ },
52
+ "packageManager": "pnpm@10.33.0"
53
+ }
@@ -0,0 +1,19 @@
1
+ //#region src/formatters/ansi.ts
2
+ /* @__NO_SIDE_EFFECTS__ */
3
+ function ansiFormatter(colors) {
4
+ return (d) => {
5
+ const header = `${colors.bold(colors.red(`[${d.name}]`))} ${d.message}`;
6
+ const details = [];
7
+ if (d.fix) details.push(`${colors.dim("fix:")} ${d.fix}`);
8
+ if (d.sources?.length) details.push(`${colors.dim("sources:")} ${d.sources.join(", ")}`);
9
+ if (d.docs) details.push(`${colors.dim("see:")} ${colors.cyan(d.docs)}`);
10
+ if (details.length === 0) return header;
11
+ return [header, ...details.map((detail, i) => {
12
+ return `${colors.dim(i < details.length - 1 ? "├▶" : "╰▶")} ${detail}`;
13
+ })].join("\n");
14
+ };
15
+ }
16
+ //#endregion
17
+ export { ansiFormatter };
18
+
19
+ //# sourceMappingURL=ansi.mjs.map
@@ -0,0 +1,187 @@
1
+ //#region src/formatters/plain.ts
2
+ /**
3
+ * Renders a diagnostic into a multi-line, unicode-decorated string suitable
4
+ * for terminal output. The first line is `[<name>] <message>`; optional
5
+ * details (`fix`, `sources`, `docs`) follow with `├▶`/`╰▶` connectors.
6
+ */
7
+ function formatDiagnostic(diagnostic) {
8
+ const header = `[${diagnostic.name}] ${diagnostic.message}`;
9
+ const details = [];
10
+ if (diagnostic.fix) details.push(`fix: ${diagnostic.fix}`);
11
+ if (diagnostic.sources?.length) details.push(`sources: ${diagnostic.sources.join(", ")}`);
12
+ if (diagnostic.docs) details.push(`see: ${diagnostic.docs}`);
13
+ if (details.length === 0) return header;
14
+ return [header, ...details.map((detail, i) => {
15
+ return `${i < details.length - 1 ? "├▶" : "╰▶"} ${detail}`;
16
+ })].join("\n");
17
+ }
18
+ //#endregion
19
+ //#region src/utils.ts
20
+ /**
21
+ * Transforms a value or a function that returns a value to a value.
22
+ *
23
+ * @param valFn either a value or a function that returns a value
24
+ * @param args arguments to pass to the function if `valFn` is a function
25
+ *
26
+ * @internal
27
+ */
28
+ function toValueWithArgs(valFn, ...args) {
29
+ return typeof valFn === "function" ? valFn(...args) : valFn;
30
+ }
31
+ //#endregion
32
+ //#region src/diagnostic.ts
33
+ /**
34
+ * Creates a console reporter that renders each diagnostic with `formatter` and
35
+ * prints the result via `console[method]`. Both default sensibly (`'warn'` and
36
+ * {@link formatDiagnostic}); `method` can also be overridden per call through
37
+ * the reporter options.
38
+ */
39
+ /* @__NO_SIDE_EFFECTS__ */
40
+ function createConsoleReporter({ method: defaultMethod = "warn", formatter = formatDiagnostic } = {}) {
41
+ return (diagnostic, { method = defaultMethod } = {}) => {
42
+ console[method](formatter(diagnostic));
43
+ };
44
+ }
45
+ const captureStackTrace = Error.captureStackTrace;
46
+ var Diagnostic = class Diagnostic extends Error {
47
+ name;
48
+ /**
49
+ * The diagnostic code, e.g. `MATH_E001`.
50
+ * Also appears as the `name` property.
51
+ */
52
+ code;
53
+ /**
54
+ * URL to extended documentation for this diagnostic code.
55
+ * Auto-generated from {@link DefineDiagnosticsOptions.docsBase}.
56
+ */
57
+ docs;
58
+ /**
59
+ * Optional actionable instructions on how to resolve the problem.
60
+ */
61
+ fix;
62
+ /**
63
+ * Locations in user code that contributed to this diagnostic, in
64
+ * `file:line:column` format. Relevant when the stack trace doesn't reflect
65
+ * the user's source (e.g. compilers, bundlers), otherwise redundant with the
66
+ * stack and should be omitted.
67
+ */
68
+ sources;
69
+ /**
70
+ * Alias for {@link Error.message}: the reason this diagnostic was raised.
71
+ */
72
+ get why() {
73
+ return this.message;
74
+ }
75
+ /**
76
+ * @param init structured initializer; `why` is required
77
+ * @param captureFrom V8 stack-cutoff frame. Defaults to {@link Diagnostic}
78
+ * so the top of the trace is the `new Diagnostic(...)` call site.
79
+ * `defineDiagnostics` passes its action method to strip its own frames too.
80
+ * Ignored on engines without `Error.captureStackTrace`.
81
+ */
82
+ constructor(init, captureFrom = Diagnostic) {
83
+ super(init.why, { cause: init.cause });
84
+ this.code = this.name = init.code;
85
+ this.fix = init.fix;
86
+ this.docs = init.docs;
87
+ this.sources = init.sources;
88
+ captureStackTrace?.(this, captureFrom);
89
+ }
90
+ /**
91
+ * Converts the diagnostic into a serializable structured object.
92
+ */
93
+ toJSON() {
94
+ return {
95
+ name: this.name,
96
+ why: this.why,
97
+ fix: this.fix,
98
+ docs: this.docs,
99
+ sources: this.sources,
100
+ cause: this.cause,
101
+ stack: this.stack
102
+ };
103
+ }
104
+ };
105
+ /**
106
+ * Resolves the docs URL for a code from a `docsBase` (string template or
107
+ * resolver function). Shared by {@link defineDiagnostics} and
108
+ * {@link defineProdDiagnostics}. Per-code `docs` overrides are handled by the
109
+ * caller; this only covers the `docsBase`-derived case.
110
+ *
111
+ * @internal
112
+ */
113
+ function deriveDocs(docsBase, code) {
114
+ return typeof docsBase === "string" ? `${docsBase}/${code.toLowerCase()}` : docsBase?.(code);
115
+ }
116
+ /**
117
+ * Creates a typed diagnostics object from a set of code definitions. Each
118
+ * code becomes a callable {@link DiagnosticHandle}: invoke to report, or
119
+ * `throw` the result to raise. No `new` required, no proxy.
120
+ */
121
+ /* @__NO_SIDE_EFFECTS__ */
122
+ function defineDiagnostics(options) {
123
+ const reporters = options.reporters ?? [];
124
+ const result = {};
125
+ const { docsBase } = options;
126
+ for (const code of Object.keys(options.codes)) {
127
+ const def = options.codes[code];
128
+ const docs = def.docs === false ? void 0 : def.docs || deriveDocs(docsBase, code);
129
+ const handle = (params = {}, reporterOptions = {}) => {
130
+ const diagnostic = new Diagnostic({
131
+ code,
132
+ why: toValueWithArgs(def.why, params),
133
+ fix: toValueWithArgs(def.fix, params),
134
+ docs,
135
+ cause: params.cause,
136
+ sources: params.sources
137
+ }, handle);
138
+ for (const reporter of reporters) reporter(diagnostic, reporterOptions);
139
+ return diagnostic;
140
+ };
141
+ result[code] = handle;
142
+ }
143
+ return result;
144
+ }
145
+ //#endregion
146
+ //#region src/prod-diagnostics.ts
147
+ /**
148
+ * Production counterpart to {@link defineDiagnostics}. Returns a `Proxy` that
149
+ * builds a minimal {@link Diagnostic} for any accessed code: the code becomes
150
+ * the instance `name`, `docs` is derived from `docsBase`, and `why` points to
151
+ * the docs URL when one exists (empty otherwise, so the thrown header is just
152
+ * the code). It carries no catalog text, so it stays tiny in a bundle.
153
+ *
154
+ * The strip plugin (`@nostics/unplugin`) can rewrite a `defineDiagnostics()`
155
+ * call into a `process.env.NODE_ENV === 'production'` ternary that selects this
156
+ * factory in production, dropping every `why`/`fix` string from the bundle.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const diagnostics = defineProdDiagnostics({ docsBase: 'https://docs.example.com' })
161
+ * throw diagnostics.NUXT_B2011() // NUXT_B2011: https://docs.example.com/nuxt_b2011
162
+ * ```
163
+ */
164
+ /* @__NO_SIDE_EFFECTS__ */
165
+ function defineProdDiagnostics(options = {}) {
166
+ const { docsBase, reporters = [] } = options;
167
+ return new Proxy({}, { get(_target, code) {
168
+ if (typeof code !== "string") return void 0;
169
+ const handle = (params = {}, reporterOptions = {}) => {
170
+ const docs = deriveDocs(docsBase, code);
171
+ const diagnostic = new Diagnostic({
172
+ code,
173
+ why: docs ?? "",
174
+ docs,
175
+ cause: params.cause,
176
+ sources: params.sources
177
+ }, handle);
178
+ for (const reporter of reporters) reporter(diagnostic, reporterOptions);
179
+ return diagnostic;
180
+ };
181
+ return handle;
182
+ } });
183
+ }
184
+ //#endregion
185
+ export { Diagnostic, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic };
186
+
187
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,125 @@
1
+ {
2
+ "name": "nostics",
3
+ "type": "module",
4
+ "version": "1.2.0",
5
+ "description": "Structured diagnostic code library",
6
+ "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
+ "contributors": [
8
+ "Eduardo San Martin Morote <posva13@gmail.com>",
9
+ "Daniel Roe <daniel@roe.dev>"
10
+ ],
11
+ "license": "MIT",
12
+ "homepage": "https://github.com/vercel-labs/nostics#readme",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/vercel-labs/nostics.git"
16
+ },
17
+ "bugs": "https://github.com/vercel-labs/nostics/issues",
18
+ "keywords": [],
19
+ "sideEffects": false,
20
+ "exports": {
21
+ ".": "./dist/index.mjs",
22
+ "./formatters/ansi": "./dist/formatters/ansi.mjs",
23
+ "./formatters/json": "./dist/formatters/json.mjs",
24
+ "./reporters/dev": "./dist/reporters/dev.mjs",
25
+ "./reporters/fetch": "./dist/reporters/fetch.mjs",
26
+ "./reporters/node": "./dist/reporters/node.mjs",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "types": "./dist/index.d.mts",
30
+ "files": [
31
+ "dist",
32
+ "skills"
33
+ ],
34
+ "devDependencies": {
35
+ "@antfu/eslint-config": "^9.0.0",
36
+ "@antfu/ni": "^30.1.0",
37
+ "@antfu/utils": "^9.3.0",
38
+ "@posva/prompts": "^2.4.4",
39
+ "@size-limit/esbuild-why": "^12.1.0",
40
+ "@size-limit/preset-small-lib": "^12.1.0",
41
+ "@types/node": "^25.9.3",
42
+ "@types/semver": "^7.7.1",
43
+ "@vitest/coverage-v8": "4.1.8",
44
+ "@vitest/ui": "4.1.8",
45
+ "conventional-changelog": "^7.2.0",
46
+ "conventional-changelog-angular": "^8.3.1",
47
+ "eslint": "^10.5.0",
48
+ "lint-staged": "^17.0.7",
49
+ "oxfmt": "^0.54.0",
50
+ "publint": "^0.3.21",
51
+ "semver": "^7.8.4",
52
+ "simple-git-hooks": "^2.13.1",
53
+ "size-limit": "^12.1.0",
54
+ "tsdown": "^0.22.2",
55
+ "tsnapi": "^0.3.3",
56
+ "typescript": "^6.0.3",
57
+ "vite": "^8.0.16",
58
+ "vitest": "^4.1.8",
59
+ "nostics": "1.2.0"
60
+ },
61
+ "simple-git-hooks": {
62
+ "pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
63
+ },
64
+ "lint-staged": {
65
+ "*": "eslint --fix"
66
+ },
67
+ "size-limit": [
68
+ {
69
+ "name": "defineDiagnostics from source",
70
+ "path": "src/index.ts",
71
+ "import": "{ defineDiagnostics }"
72
+ },
73
+ {
74
+ "name": "defineDiagnostics",
75
+ "path": "dist/index.mjs",
76
+ "import": "{ defineDiagnostics }"
77
+ },
78
+ {
79
+ "name": "defineProdDiagnostics",
80
+ "path": "dist/index.mjs",
81
+ "import": "{ defineProdDiagnostics }"
82
+ },
83
+ {
84
+ "name": "defineDiagnostics + createConsoleReporter",
85
+ "path": "dist/index.mjs",
86
+ "import": "{ defineDiagnostics, createConsoleReporter }"
87
+ },
88
+ {
89
+ "name": "defineProdDiagnostics + createConsoleReporter",
90
+ "path": "dist/index.mjs",
91
+ "import": "{ defineProdDiagnostics, createConsoleReporter }"
92
+ },
93
+ {
94
+ "name": "formatDiagnostic",
95
+ "path": "dist/index.mjs",
96
+ "import": "{ formatDiagnostic }"
97
+ },
98
+ {
99
+ "name": "full root",
100
+ "path": "dist/index.mjs",
101
+ "import": "*"
102
+ },
103
+ {
104
+ "name": "ansi formatter",
105
+ "path": "dist/formatters/ansi.mjs",
106
+ "import": "*"
107
+ }
108
+ ],
109
+ "scripts": {
110
+ "build": "tsdown && pnpm --filter \"./packages/*\" run build",
111
+ "dev": "vitest",
112
+ "docs": "pnpm -C docs run dev",
113
+ "docs:build": "pnpm -C docs run build",
114
+ "play": "pnpm -C playground run dev",
115
+ "lint": "eslint",
116
+ "release": "node scripts/release.ts",
117
+ "size": "size-limit",
118
+ "test": "pnpm run build && pnpm run \"/^test:/\"",
119
+ "test:unit": "vitest run --coverage",
120
+ "test:types": "pnpm run typecheck",
121
+ "test:lint": "pnpm run lint",
122
+ "test:demo": "pnpm -C demo-lib run build && pnpm -C demo-lib run test && pnpm -C playground run build",
123
+ "typecheck": "tsc && pnpm --filter \"./packages/*\" run typecheck"
124
+ }
125
+ }