silgi 0.43.10 → 0.43.12

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.
@@ -3,10 +3,55 @@ import { reloadScan } from "../core/devServer.mjs";
3
3
  import { prepareBuild } from "./prepare.mjs";
4
4
  import { watch } from "chokidar";
5
5
  import consola from "consola";
6
+ import micromatch from "micromatch";
6
7
  import { basename } from "pathe";
7
8
  import { debounce } from "perfect-debounce";
8
9
 
9
10
  //#region src/cli/build/dev.ts
11
+ const IGNORED_WATCH_PATTERNS = [
12
+ "**/.silgi/**",
13
+ "**/.output/**",
14
+ "**/types/**",
15
+ "**/scan.ts",
16
+ "**/scan.js",
17
+ "**/scan.mjs",
18
+ "**/scan.cjs",
19
+ "**/scan.d.ts",
20
+ "**/scan.d.mts",
21
+ "**/scan.d.cts",
22
+ "**/scan.d.js",
23
+ "**/scan.d.ts",
24
+ "**/meta.ts",
25
+ "**/meta.js",
26
+ "**/meta.mjs",
27
+ "**/meta.cjs",
28
+ "**/meta.d.ts",
29
+ "**/meta.d.mts",
30
+ "**/meta.d.cts",
31
+ "**/meta.d.js",
32
+ "**/meta.d.ts",
33
+ "**/core.ts",
34
+ "**/core.js",
35
+ "**/core.mjs",
36
+ "**/core.cjs",
37
+ "**/core.d.ts",
38
+ "**/core.d.mts",
39
+ "**/core.d.cts",
40
+ "**/core.d.js",
41
+ "**/core.d.ts",
42
+ "**/configs.ts",
43
+ "**/configs.js",
44
+ "**/configs.mjs",
45
+ "**/configs.cjs",
46
+ "**/configs.d.ts",
47
+ "**/configs.d.mts",
48
+ "**/configs.d.cts",
49
+ "**/configs.d.js",
50
+ "**/configs.d.ts"
51
+ ];
52
+ function isIgnoredByPattern(path) {
53
+ return IGNORED_WATCH_PATTERNS.some((pattern) => micromatch.isMatch(path, pattern));
54
+ }
10
55
  async function watchDev() {
11
56
  const silgi = useSilgiCLI();
12
57
  let watcher;
@@ -26,7 +71,8 @@ async function watchDev() {
26
71
  "change"
27
72
  ]);
28
73
  if (silgi.options.devServer.watch.length > 0) {
29
- silgi.options.devServer.watch = [...new Set(silgi.options.devServer.watch)];
74
+ silgi.options.devServer.watch = [...new Set(silgi.options.devServer.watch)].filter((p) => !isIgnoredByPattern(p));
75
+ consola.info("[silgi] Watching files/directories:", silgi.options.devServer.watch);
30
76
  watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
31
77
  watcher.on("all", async (event, path, stats) => {
32
78
  if (!watchReloadEvents.has(event)) return;
@@ -47,6 +93,7 @@ async function watchDev() {
47
93
  });
48
94
  }
49
95
  async function close() {
96
+ if (watcher) await watcher.close();
50
97
  await silgiCLIIClose();
51
98
  }
52
99
  return {
@@ -1,11 +1,11 @@
1
1
  import { isIgnored } from "../utils/ignore.mjs";
2
2
  import { consola as consola$1 } from "consola";
3
+ import micromatch from "micromatch";
3
4
  import { basename, dirname, extname, join, relative, resolve } from "pathe";
4
5
  import { useSilgiCLI } from "silgi";
5
6
  import { hash, relativeWithDot, removeExtension } from "silgi/kit";
6
7
  import { withTrailingSlash } from "ufo";
7
8
  import { readFile, readdir } from "node:fs/promises";
8
- import micromatch from "micromatch";
9
9
  import { parseAsync } from "oxc-parser";
10
10
  import { glob } from "tinyglobby";
11
11
 
package/dist/package.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  //#region package.json
2
2
  var name = "silgi";
3
3
  var type = "module";
4
- var version = "0.43.10";
4
+ var version = "0.43.12";
5
5
  var private$1 = false;
6
6
  var packageManager = "pnpm@10.12.2";
7
7
  var sideEffects = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.43.10",
4
+ "version": "0.43.12",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {