@mudah-cli/mudah 0.8.0 → 0.9.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 (102) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -0
  3. package/dist/autocomplete.d.ts +8 -0
  4. package/dist/autocomplete.js +38 -0
  5. package/dist/autocomplete.js.map +1 -0
  6. package/dist/built-ins.d.ts +9 -0
  7. package/dist/built-ins.js +144 -0
  8. package/dist/built-ins.js.map +1 -0
  9. package/dist/commands/autocomplete.command.d.ts +11 -0
  10. package/dist/commands/autocomplete.command.js +16 -0
  11. package/dist/commands/autocomplete.command.js.map +1 -0
  12. package/dist/commands/build.command.d.ts +1 -0
  13. package/dist/commands/build.command.js +2 -1
  14. package/dist/commands/build.command.js.map +1 -1
  15. package/dist/commands/cache.command.d.ts +11 -0
  16. package/dist/commands/cache.command.js +47 -0
  17. package/dist/commands/cache.command.js.map +1 -0
  18. package/dist/commands/complete.command.d.ts +13 -0
  19. package/dist/commands/complete.command.js +23 -0
  20. package/dist/commands/complete.command.js.map +1 -0
  21. package/dist/commands/config.diff.command.d.ts +8 -0
  22. package/dist/commands/config.diff.command.js +96 -0
  23. package/dist/commands/config.diff.command.js.map +1 -0
  24. package/dist/commands/config.set.command.d.ts +8 -0
  25. package/dist/commands/config.set.command.js +66 -0
  26. package/dist/commands/config.set.command.js.map +1 -0
  27. package/dist/commands/config.show.command.d.ts +8 -0
  28. package/dist/commands/config.show.command.js +38 -0
  29. package/dist/commands/config.show.command.js.map +1 -0
  30. package/dist/commands/config.source.command.d.ts +8 -0
  31. package/dist/commands/config.source.command.js +42 -0
  32. package/dist/commands/config.source.command.js.map +1 -0
  33. package/dist/commands/config.validate.command.d.ts +14 -0
  34. package/dist/commands/config.validate.command.js +63 -0
  35. package/dist/commands/config.validate.command.js.map +1 -0
  36. package/dist/commands/dev.command.d.ts +1 -0
  37. package/dist/commands/dev.command.js +1 -0
  38. package/dist/commands/dev.command.js.map +1 -1
  39. package/dist/commands/docs.widgets.command.d.ts +11 -0
  40. package/dist/commands/docs.widgets.command.js +17 -0
  41. package/dist/commands/docs.widgets.command.js.map +1 -0
  42. package/dist/commands/doctor.command.d.ts +1 -0
  43. package/dist/commands/doctor.command.js +36 -6
  44. package/dist/commands/doctor.command.js.map +1 -1
  45. package/dist/commands/graph.command.d.ts +10 -0
  46. package/dist/commands/graph.command.js +21 -0
  47. package/dist/commands/graph.command.js.map +1 -0
  48. package/dist/commands/help.command.d.ts +1 -0
  49. package/dist/commands/help.command.js +2 -2
  50. package/dist/commands/help.command.js.map +1 -1
  51. package/dist/commands/info.command.d.ts +8 -0
  52. package/dist/commands/info.command.js +61 -0
  53. package/dist/commands/info.command.js.map +1 -0
  54. package/dist/commands/lsp.command.d.ts +12 -0
  55. package/dist/commands/lsp.command.js +57 -0
  56. package/dist/commands/lsp.command.js.map +1 -0
  57. package/dist/commands/make.command.d.ts +2 -0
  58. package/dist/commands/make.command.js +75 -4
  59. package/dist/commands/make.command.js.map +1 -1
  60. package/dist/commands/plugins.list.command.d.ts +12 -0
  61. package/dist/commands/plugins.list.command.js +29 -0
  62. package/dist/commands/plugins.list.command.js.map +1 -0
  63. package/dist/commands/plugins.update.command.d.ts +29 -0
  64. package/dist/commands/plugins.update.command.js +78 -0
  65. package/dist/commands/plugins.update.command.js.map +1 -0
  66. package/dist/commands/plugins.watch.command.d.ts +10 -0
  67. package/dist/commands/plugins.watch.command.js +37 -0
  68. package/dist/commands/plugins.watch.command.js.map +1 -0
  69. package/dist/commands/replay.command.d.ts +10 -0
  70. package/dist/commands/replay.command.js +50 -0
  71. package/dist/commands/replay.command.js.map +1 -0
  72. package/dist/commands/storybook.command.d.ts +11 -0
  73. package/dist/commands/storybook.command.js +84 -0
  74. package/dist/commands/storybook.command.js.map +1 -0
  75. package/dist/commands/telemetry.command.d.ts +12 -0
  76. package/dist/commands/telemetry.command.js +55 -0
  77. package/dist/commands/telemetry.command.js.map +1 -0
  78. package/dist/commands/test.command.d.ts +13 -0
  79. package/dist/commands/test.command.js +83 -0
  80. package/dist/commands/test.command.js.map +1 -0
  81. package/dist/commands/tutorial.command.d.ts +12 -0
  82. package/dist/commands/tutorial.command.js +57 -0
  83. package/dist/commands/tutorial.command.js.map +1 -0
  84. package/dist/commands/version.command.d.ts +1 -0
  85. package/dist/commands/version.command.js +1 -0
  86. package/dist/commands/version.command.js.map +1 -1
  87. package/dist/commands/watch.command.d.ts +13 -0
  88. package/dist/commands/watch.command.js +62 -0
  89. package/dist/commands/watch.command.js.map +1 -0
  90. package/dist/index.d.ts +8 -5
  91. package/dist/index.js +8 -5
  92. package/dist/index.js.map +1 -1
  93. package/dist/lsp.d.ts +147 -0
  94. package/dist/lsp.js +497 -0
  95. package/dist/lsp.js.map +1 -0
  96. package/dist/run.d.ts +4 -2
  97. package/dist/run.js +372 -37
  98. package/dist/run.js.map +1 -1
  99. package/dist/watcher.d.ts +20 -1
  100. package/dist/watcher.js +41 -4
  101. package/dist/watcher.js.map +1 -1
  102. package/package.json +27 -10
package/dist/watcher.js CHANGED
@@ -1,4 +1,8 @@
1
- import { watch, existsSync } from 'node:fs';
1
+ import { existsSync, watch } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ function ignored(path, ignore) {
4
+ return ignore.some((fragment) => fragment !== '' && path.includes(fragment));
5
+ }
2
6
  /**
3
7
  * Watch a set of files or directories (recursively where the platform
4
8
  * supports it) and invoke `onChange` after a quiet debounce period.
@@ -6,13 +10,18 @@ import { watch, existsSync } from 'node:fs';
6
10
  */
7
11
  export function createWatcher(paths, onChange, options = {}) {
8
12
  const debounceMs = options.debounceMs ?? 150;
13
+ const ignore = options.ignore ?? ['node_modules', '.git', 'dist'];
9
14
  let timer = null;
10
- const emit = () => {
15
+ let lastFile;
16
+ const emit = (filename) => {
17
+ if (filename !== undefined && ignored(filename, ignore))
18
+ return;
19
+ lastFile = filename;
11
20
  if (timer)
12
21
  clearTimeout(timer);
13
22
  timer = setTimeout(() => {
14
23
  timer = null;
15
- onChange();
24
+ onChange(lastFile);
16
25
  }, debounceMs);
17
26
  };
18
27
  const watchers = [];
@@ -20,7 +29,9 @@ export function createWatcher(paths, onChange, options = {}) {
20
29
  if (!existsSync(path))
21
30
  continue;
22
31
  try {
23
- watchers.push(watch(path, { recursive: true }, emit));
32
+ watchers.push(watch(path, { recursive: true }, (_event, filename) => {
33
+ emit(typeof filename === 'string' ? filename : undefined);
34
+ }));
24
35
  }
25
36
  catch {
26
37
  // Some platforms don't support recursive watch; skip that path.
@@ -34,4 +45,30 @@ export function createWatcher(paths, onChange, options = {}) {
34
45
  }
35
46
  };
36
47
  }
48
+ /**
49
+ * Watch a plugin directory (typically `node_modules` or a local plugin
50
+ * folder) and invoke `onReload` after a quiet debounce. Uses
51
+ * {@link createWatcher}.
52
+ */
53
+ export function watchPlugins(dir, onReload, options = {}) {
54
+ return createWatcher([dir], onReload, { ignore: ['dist'], ...options });
55
+ }
56
+ /** Directories `mudah watch` should observe for a glob like `src/**`. */
57
+ export function pathsFromGlob(base, glob) {
58
+ const stripped = glob
59
+ .replace(/\/\*\*.*$/, '')
60
+ .replace(/\/\*$/, '')
61
+ .replace(/\/$/, '');
62
+ const dir = stripped === '' || stripped === '**' ? 'src' : stripped;
63
+ return [join(base, dir), join(base, 'src'), join(base, 'config'), join(base, 'mudah.json')];
64
+ }
65
+ /**
66
+ * Watch `node_modules` (or `dir`) and re-import providers via `reloadPlugins`.
67
+ */
68
+ export function hotReloadPlugins(app, onReload, options = {}) {
69
+ const dir = options.dir ?? join(app.basePath, 'node_modules');
70
+ return watchPlugins(dir, (filename) => {
71
+ void app.reloadPlugins().then(() => onReload?.(filename));
72
+ }, options);
73
+ }
37
74
  //# sourceMappingURL=watcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.js","sourceRoot":"","sources":["../src/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAC;AAO5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,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC9D,OAAO,YAAY,CACjB,GAAG,EACH,CAAC,QAAQ,EAAE,EAAE;QACX,KAAK,GAAG,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,CAAC,EACD,OAAO,CACR,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,26 @@
1
1
  {
2
2
  "name": "@mudah-cli/mudah",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "An ergonomic, animation-rich CLI framework — speed, sleek design, and developer ergonomics for Node and Bun.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "author": "Mudah Contributors",
8
+ "homepage": "https://github.com/thesimonharms/mudah#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/thesimonharms/mudah.git",
12
+ "directory": "packages/mudah"
13
+ },
14
+ "keywords": [
15
+ "cli",
16
+ "terminal",
17
+ "tui",
18
+ "framework",
19
+ "scaffold",
20
+ "bun",
21
+ "node",
22
+ "typescript"
23
+ ],
7
24
  "engines": {
8
25
  "node": ">=26"
9
26
  },
@@ -39,15 +56,15 @@
39
56
  ],
40
57
  "sideEffects": false,
41
58
  "dependencies": {
42
- "@mudah-cli/animation": "^0.8.0",
43
- "@mudah-cli/config": "^0.8.0",
44
- "@mudah-cli/console": "^0.8.0",
45
- "@mudah-cli/container": "^0.8.0",
46
- "@mudah-cli/core": "^0.8.0",
47
- "@mudah-cli/terminal": "^0.8.0",
48
- "@mudah-cli/testing": "^0.8.0",
49
- "@mudah-cli/tui": "^0.8.0",
50
- "@mudah-cli/ui": "^0.8.0"
59
+ "@mudah-cli/animation": "^0.9.0",
60
+ "@mudah-cli/config": "^0.9.0",
61
+ "@mudah-cli/console": "^0.9.0",
62
+ "@mudah-cli/container": "^0.9.0",
63
+ "@mudah-cli/core": "^0.9.0",
64
+ "@mudah-cli/terminal": "^0.9.0",
65
+ "@mudah-cli/testing": "^0.9.0",
66
+ "@mudah-cli/tui": "^0.9.0",
67
+ "@mudah-cli/ui": "^0.9.0"
51
68
  },
52
69
  "publishConfig": {
53
70
  "access": "public"