silgi 0.24.18 → 0.24.20

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.
@@ -1,27 +1,6 @@
1
+ import { withoutTrailingSlash, withLeadingSlash } from 'ufo';
1
2
  import consola from 'consola';
2
3
  import { createContext } from 'unctx';
3
- import { withoutTrailingSlash, withLeadingSlash } from 'ufo';
4
-
5
- const silgiCLICtx = createContext();
6
- function useSilgiCLI() {
7
- const instance = silgiCLICtx.tryUse();
8
- if (!instance) {
9
- throw new Error("Silgi instance is unavailable!");
10
- }
11
- return instance;
12
- }
13
- async function silgiCLIIClose() {
14
- const silgi = silgiCLICtx.tryUse();
15
- if (!silgi) {
16
- return;
17
- }
18
- await silgi.close();
19
- await silgi.callHook("close", silgi);
20
- consola.withTag("silgi").success("Process terminated");
21
- }
22
- function tryUseSilgiCLI() {
23
- return silgiCLICtx.tryUse();
24
- }
25
4
 
26
5
  function patternToRegex(pattern) {
27
6
  let regexStr = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
@@ -308,4 +287,25 @@ function createRouteRules() {
308
287
  };
309
288
  }
310
289
 
290
+ const silgiCLICtx = createContext();
291
+ function useSilgiCLI() {
292
+ const instance = silgiCLICtx.tryUse();
293
+ if (!instance) {
294
+ throw new Error("Silgi instance is unavailable!");
295
+ }
296
+ return instance;
297
+ }
298
+ async function silgiCLIIClose() {
299
+ const silgi = silgiCLICtx.tryUse();
300
+ if (!silgi) {
301
+ return;
302
+ }
303
+ await silgi.close();
304
+ await silgi.callHook("close", silgi);
305
+ consola.withTag("silgi").success("Process terminated");
306
+ }
307
+ function tryUseSilgiCLI() {
308
+ return silgiCLICtx.tryUse();
309
+ }
310
+
311
311
  export { silgiCLIIClose as a, createRouteRules as c, silgiCLICtx as s, tryUseSilgiCLI as t, useSilgiCLI as u };