@sse-ui/builder 1.3.1 → 1.3.2

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 (3) hide show
  1. package/README.md +2 -0
  2. package/dist/cli.js +443 -145
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -27,6 +27,7 @@ Once installed, you can access the utility via the `sse-tools` command.
27
27
 
28
28
  | Command | Description |
29
29
  | --------------- | ------------------------------------------------------------------------------------ |
30
+ | `init` | To initializes the package with the required configuration files |
30
31
  | `build` | Compiles the package for production using Babel or esbuild. |
31
32
  | `watch` | Starts an incremental rebuild watcher for rapid development. |
32
33
  | `typecheck` | Validates TypeScript types across the project without emitting files. |
@@ -35,6 +36,7 @@ Once installed, you can access the utility via the `sse-tools` command.
35
36
  | `publish` | Publishes the built package directly from your specified build directory. |
36
37
  | `info` | Displays size and file statistics for your built package. |
37
38
  | `clean` | Safely removes the build directory to ensure a fresh start. |
39
+ | `remove` | Safely removes all configuration files and dependencies added by the init command |
38
40
 
39
41
  ## ⚙️ Configuration
40
42
 
package/dist/cli.js CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  } from "./chunk-N46AJ2OI.js";
12
12
 
13
13
  // src/cli.ts
14
- import chalk11 from "chalk";
15
- import { Command as Command11 } from "commander";
14
+ import chalk13 from "chalk";
15
+ import { Command as Command13 } from "commander";
16
16
 
17
17
  // src/core/build.ts
18
18
  import { findWorkspacesRoot } from "find-workspaces";
@@ -1054,7 +1054,7 @@ var ReaddirpStream = class extends Readable {
1054
1054
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
1055
1055
  const statMethod = opts.lstat ? lstat : stat5;
1056
1056
  if (wantBigintFsStats) {
1057
- this._stat = (path10) => statMethod(path10, { bigint: true });
1057
+ this._stat = (path12) => statMethod(path12, { bigint: true });
1058
1058
  } else {
1059
1059
  this._stat = statMethod;
1060
1060
  }
@@ -1079,8 +1079,8 @@ var ReaddirpStream = class extends Readable {
1079
1079
  const par = this.parent;
1080
1080
  const fil = par && par.files;
1081
1081
  if (fil && fil.length > 0) {
1082
- const { path: path10, depth } = par;
1083
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path10));
1082
+ const { path: path12, depth } = par;
1083
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path12));
1084
1084
  const awaited = await Promise.all(slice);
1085
1085
  for (const entry of awaited) {
1086
1086
  if (!entry)
@@ -1120,20 +1120,20 @@ var ReaddirpStream = class extends Readable {
1120
1120
  this.reading = false;
1121
1121
  }
1122
1122
  }
1123
- async _exploreDir(path10, depth) {
1123
+ async _exploreDir(path12, depth) {
1124
1124
  let files;
1125
1125
  try {
1126
- files = await readdir2(path10, this._rdOptions);
1126
+ files = await readdir2(path12, this._rdOptions);
1127
1127
  } catch (error) {
1128
1128
  this._onError(error);
1129
1129
  }
1130
- return { files, depth, path: path10 };
1130
+ return { files, depth, path: path12 };
1131
1131
  }
1132
- async _formatEntry(dirent, path10) {
1132
+ async _formatEntry(dirent, path12) {
1133
1133
  let entry;
1134
1134
  const basename4 = this._isDirent ? dirent.name : dirent;
1135
1135
  try {
1136
- const fullPath = presolve(pjoin(path10, basename4));
1136
+ const fullPath = presolve(pjoin(path12, basename4));
1137
1137
  entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
1138
1138
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
1139
1139
  } catch (err) {
@@ -1533,16 +1533,16 @@ var delFromSet = (main2, prop, item) => {
1533
1533
  };
1534
1534
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
1535
1535
  var FsWatchInstances = /* @__PURE__ */ new Map();
1536
- function createFsWatchInstance(path10, options, listener, errHandler, emitRaw) {
1536
+ function createFsWatchInstance(path12, options, listener, errHandler, emitRaw) {
1537
1537
  const handleEvent = (rawEvent, evPath) => {
1538
- listener(path10);
1539
- emitRaw(rawEvent, evPath, { watchedPath: path10 });
1540
- if (evPath && path10 !== evPath) {
1541
- fsWatchBroadcast(sp.resolve(path10, evPath), KEY_LISTENERS, sp.join(path10, evPath));
1538
+ listener(path12);
1539
+ emitRaw(rawEvent, evPath, { watchedPath: path12 });
1540
+ if (evPath && path12 !== evPath) {
1541
+ fsWatchBroadcast(sp.resolve(path12, evPath), KEY_LISTENERS, sp.join(path12, evPath));
1542
1542
  }
1543
1543
  };
1544
1544
  try {
1545
- return fs_watch(path10, {
1545
+ return fs_watch(path12, {
1546
1546
  persistent: options.persistent
1547
1547
  }, handleEvent);
1548
1548
  } catch (error) {
@@ -1558,12 +1558,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
1558
1558
  listener(val1, val2, val3);
1559
1559
  });
1560
1560
  };
1561
- var setFsWatchListener = (path10, fullPath, options, handlers) => {
1561
+ var setFsWatchListener = (path12, fullPath, options, handlers) => {
1562
1562
  const { listener, errHandler, rawEmitter } = handlers;
1563
1563
  let cont = FsWatchInstances.get(fullPath);
1564
1564
  let watcher;
1565
1565
  if (!options.persistent) {
1566
- watcher = createFsWatchInstance(path10, options, listener, errHandler, rawEmitter);
1566
+ watcher = createFsWatchInstance(path12, options, listener, errHandler, rawEmitter);
1567
1567
  if (!watcher)
1568
1568
  return;
1569
1569
  return watcher.close.bind(watcher);
@@ -1574,7 +1574,7 @@ var setFsWatchListener = (path10, fullPath, options, handlers) => {
1574
1574
  addAndConvert(cont, KEY_RAW, rawEmitter);
1575
1575
  } else {
1576
1576
  watcher = createFsWatchInstance(
1577
- path10,
1577
+ path12,
1578
1578
  options,
1579
1579
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
1580
1580
  errHandler,
@@ -1589,7 +1589,7 @@ var setFsWatchListener = (path10, fullPath, options, handlers) => {
1589
1589
  cont.watcherUnusable = true;
1590
1590
  if (isWindows && error.code === "EPERM") {
1591
1591
  try {
1592
- const fd = await open(path10, "r");
1592
+ const fd = await open(path12, "r");
1593
1593
  await fd.close();
1594
1594
  broadcastErr(error);
1595
1595
  } catch (err) {
@@ -1620,7 +1620,7 @@ var setFsWatchListener = (path10, fullPath, options, handlers) => {
1620
1620
  };
1621
1621
  };
1622
1622
  var FsWatchFileInstances = /* @__PURE__ */ new Map();
1623
- var setFsWatchFileListener = (path10, fullPath, options, handlers) => {
1623
+ var setFsWatchFileListener = (path12, fullPath, options, handlers) => {
1624
1624
  const { listener, rawEmitter } = handlers;
1625
1625
  let cont = FsWatchFileInstances.get(fullPath);
1626
1626
  const copts = cont && cont.options;
@@ -1642,7 +1642,7 @@ var setFsWatchFileListener = (path10, fullPath, options, handlers) => {
1642
1642
  });
1643
1643
  const currmtime = curr.mtimeMs;
1644
1644
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
1645
- foreach(cont.listeners, (listener2) => listener2(path10, curr));
1645
+ foreach(cont.listeners, (listener2) => listener2(path12, curr));
1646
1646
  }
1647
1647
  })
1648
1648
  };
@@ -1672,13 +1672,13 @@ var NodeFsHandler = class {
1672
1672
  * @param listener on fs change
1673
1673
  * @returns closer for the watcher instance
1674
1674
  */
1675
- _watchWithNodeFs(path10, listener) {
1675
+ _watchWithNodeFs(path12, listener) {
1676
1676
  const opts = this.fsw.options;
1677
- const directory = sp.dirname(path10);
1678
- const basename4 = sp.basename(path10);
1677
+ const directory = sp.dirname(path12);
1678
+ const basename4 = sp.basename(path12);
1679
1679
  const parent = this.fsw._getWatchedDir(directory);
1680
1680
  parent.add(basename4);
1681
- const absolutePath = sp.resolve(path10);
1681
+ const absolutePath = sp.resolve(path12);
1682
1682
  const options = {
1683
1683
  persistent: opts.persistent
1684
1684
  };
@@ -1688,12 +1688,12 @@ var NodeFsHandler = class {
1688
1688
  if (opts.usePolling) {
1689
1689
  const enableBin = opts.interval !== opts.binaryInterval;
1690
1690
  options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
1691
- closer = setFsWatchFileListener(path10, absolutePath, options, {
1691
+ closer = setFsWatchFileListener(path12, absolutePath, options, {
1692
1692
  listener,
1693
1693
  rawEmitter: this.fsw._emitRaw
1694
1694
  });
1695
1695
  } else {
1696
- closer = setFsWatchListener(path10, absolutePath, options, {
1696
+ closer = setFsWatchListener(path12, absolutePath, options, {
1697
1697
  listener,
1698
1698
  errHandler: this._boundHandleError,
1699
1699
  rawEmitter: this.fsw._emitRaw
@@ -1715,7 +1715,7 @@ var NodeFsHandler = class {
1715
1715
  let prevStats = stats;
1716
1716
  if (parent.has(basename4))
1717
1717
  return;
1718
- const listener = async (path10, newStats) => {
1718
+ const listener = async (path12, newStats) => {
1719
1719
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
1720
1720
  return;
1721
1721
  if (!newStats || newStats.mtimeMs === 0) {
@@ -1729,11 +1729,11 @@ var NodeFsHandler = class {
1729
1729
  this.fsw._emit(EV.CHANGE, file, newStats2);
1730
1730
  }
1731
1731
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
1732
- this.fsw._closeFile(path10);
1732
+ this.fsw._closeFile(path12);
1733
1733
  prevStats = newStats2;
1734
1734
  const closer2 = this._watchWithNodeFs(file, listener);
1735
1735
  if (closer2)
1736
- this.fsw._addPathCloser(path10, closer2);
1736
+ this.fsw._addPathCloser(path12, closer2);
1737
1737
  } else {
1738
1738
  prevStats = newStats2;
1739
1739
  }
@@ -1765,7 +1765,7 @@ var NodeFsHandler = class {
1765
1765
  * @param item basename of this item
1766
1766
  * @returns true if no more processing is needed for this entry.
1767
1767
  */
1768
- async _handleSymlink(entry, directory, path10, item) {
1768
+ async _handleSymlink(entry, directory, path12, item) {
1769
1769
  if (this.fsw.closed) {
1770
1770
  return;
1771
1771
  }
@@ -1775,7 +1775,7 @@ var NodeFsHandler = class {
1775
1775
  this.fsw._incrReadyCount();
1776
1776
  let linkPath;
1777
1777
  try {
1778
- linkPath = await fsrealpath(path10);
1778
+ linkPath = await fsrealpath(path12);
1779
1779
  } catch (e) {
1780
1780
  this.fsw._emitReady();
1781
1781
  return true;
@@ -1785,12 +1785,12 @@ var NodeFsHandler = class {
1785
1785
  if (dir.has(item)) {
1786
1786
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
1787
1787
  this.fsw._symlinkPaths.set(full, linkPath);
1788
- this.fsw._emit(EV.CHANGE, path10, entry.stats);
1788
+ this.fsw._emit(EV.CHANGE, path12, entry.stats);
1789
1789
  }
1790
1790
  } else {
1791
1791
  dir.add(item);
1792
1792
  this.fsw._symlinkPaths.set(full, linkPath);
1793
- this.fsw._emit(EV.ADD, path10, entry.stats);
1793
+ this.fsw._emit(EV.ADD, path12, entry.stats);
1794
1794
  }
1795
1795
  this.fsw._emitReady();
1796
1796
  return true;
@@ -1820,9 +1820,9 @@ var NodeFsHandler = class {
1820
1820
  return;
1821
1821
  }
1822
1822
  const item = entry.path;
1823
- let path10 = sp.join(directory, item);
1823
+ let path12 = sp.join(directory, item);
1824
1824
  current.add(item);
1825
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path10, item)) {
1825
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path12, item)) {
1826
1826
  return;
1827
1827
  }
1828
1828
  if (this.fsw.closed) {
@@ -1831,8 +1831,8 @@ var NodeFsHandler = class {
1831
1831
  }
1832
1832
  if (item === target || !target && !previous.has(item)) {
1833
1833
  this.fsw._incrReadyCount();
1834
- path10 = sp.join(dir, sp.relative(dir, path10));
1835
- this._addToNodeFs(path10, initialAdd, wh, depth + 1);
1834
+ path12 = sp.join(dir, sp.relative(dir, path12));
1835
+ this._addToNodeFs(path12, initialAdd, wh, depth + 1);
1836
1836
  }
1837
1837
  }).on(EV.ERROR, this._boundHandleError);
1838
1838
  return new Promise((resolve4, reject) => {
@@ -1901,13 +1901,13 @@ var NodeFsHandler = class {
1901
1901
  * @param depth Child path actually targeted for watch
1902
1902
  * @param target Child path actually targeted for watch
1903
1903
  */
1904
- async _addToNodeFs(path10, initialAdd, priorWh, depth, target) {
1904
+ async _addToNodeFs(path12, initialAdd, priorWh, depth, target) {
1905
1905
  const ready = this.fsw._emitReady;
1906
- if (this.fsw._isIgnored(path10) || this.fsw.closed) {
1906
+ if (this.fsw._isIgnored(path12) || this.fsw.closed) {
1907
1907
  ready();
1908
1908
  return false;
1909
1909
  }
1910
- const wh = this.fsw._getWatchHelpers(path10);
1910
+ const wh = this.fsw._getWatchHelpers(path12);
1911
1911
  if (priorWh) {
1912
1912
  wh.filterPath = (entry) => priorWh.filterPath(entry);
1913
1913
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -1923,8 +1923,8 @@ var NodeFsHandler = class {
1923
1923
  const follow = this.fsw.options.followSymlinks;
1924
1924
  let closer;
1925
1925
  if (stats.isDirectory()) {
1926
- const absPath = sp.resolve(path10);
1927
- const targetPath = follow ? await fsrealpath(path10) : path10;
1926
+ const absPath = sp.resolve(path12);
1927
+ const targetPath = follow ? await fsrealpath(path12) : path12;
1928
1928
  if (this.fsw.closed)
1929
1929
  return;
1930
1930
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -1934,29 +1934,29 @@ var NodeFsHandler = class {
1934
1934
  this.fsw._symlinkPaths.set(absPath, targetPath);
1935
1935
  }
1936
1936
  } else if (stats.isSymbolicLink()) {
1937
- const targetPath = follow ? await fsrealpath(path10) : path10;
1937
+ const targetPath = follow ? await fsrealpath(path12) : path12;
1938
1938
  if (this.fsw.closed)
1939
1939
  return;
1940
1940
  const parent = sp.dirname(wh.watchPath);
1941
1941
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
1942
1942
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
1943
- closer = await this._handleDir(parent, stats, initialAdd, depth, path10, wh, targetPath);
1943
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path12, wh, targetPath);
1944
1944
  if (this.fsw.closed)
1945
1945
  return;
1946
1946
  if (targetPath !== void 0) {
1947
- this.fsw._symlinkPaths.set(sp.resolve(path10), targetPath);
1947
+ this.fsw._symlinkPaths.set(sp.resolve(path12), targetPath);
1948
1948
  }
1949
1949
  } else {
1950
1950
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
1951
1951
  }
1952
1952
  ready();
1953
1953
  if (closer)
1954
- this.fsw._addPathCloser(path10, closer);
1954
+ this.fsw._addPathCloser(path12, closer);
1955
1955
  return false;
1956
1956
  } catch (error) {
1957
1957
  if (this.fsw._handleError(error)) {
1958
1958
  ready();
1959
- return path10;
1959
+ return path12;
1960
1960
  }
1961
1961
  }
1962
1962
  }
@@ -1999,24 +1999,24 @@ function createPattern(matcher) {
1999
1999
  }
2000
2000
  return () => false;
2001
2001
  }
2002
- function normalizePath(path10) {
2003
- if (typeof path10 !== "string")
2002
+ function normalizePath(path12) {
2003
+ if (typeof path12 !== "string")
2004
2004
  throw new Error("string expected");
2005
- path10 = sp2.normalize(path10);
2006
- path10 = path10.replace(/\\/g, "/");
2005
+ path12 = sp2.normalize(path12);
2006
+ path12 = path12.replace(/\\/g, "/");
2007
2007
  let prepend = false;
2008
- if (path10.startsWith("//"))
2008
+ if (path12.startsWith("//"))
2009
2009
  prepend = true;
2010
- path10 = path10.replace(DOUBLE_SLASH_RE, "/");
2010
+ path12 = path12.replace(DOUBLE_SLASH_RE, "/");
2011
2011
  if (prepend)
2012
- path10 = "/" + path10;
2013
- return path10;
2012
+ path12 = "/" + path12;
2013
+ return path12;
2014
2014
  }
2015
2015
  function matchPatterns(patterns, testString, stats) {
2016
- const path10 = normalizePath(testString);
2016
+ const path12 = normalizePath(testString);
2017
2017
  for (let index = 0; index < patterns.length; index++) {
2018
2018
  const pattern = patterns[index];
2019
- if (pattern(path10, stats)) {
2019
+ if (pattern(path12, stats)) {
2020
2020
  return true;
2021
2021
  }
2022
2022
  }
@@ -2054,19 +2054,19 @@ var toUnix = (string) => {
2054
2054
  }
2055
2055
  return str;
2056
2056
  };
2057
- var normalizePathToUnix = (path10) => toUnix(sp2.normalize(toUnix(path10)));
2058
- var normalizeIgnored = (cwd = "") => (path10) => {
2059
- if (typeof path10 === "string") {
2060
- return normalizePathToUnix(sp2.isAbsolute(path10) ? path10 : sp2.join(cwd, path10));
2057
+ var normalizePathToUnix = (path12) => toUnix(sp2.normalize(toUnix(path12)));
2058
+ var normalizeIgnored = (cwd = "") => (path12) => {
2059
+ if (typeof path12 === "string") {
2060
+ return normalizePathToUnix(sp2.isAbsolute(path12) ? path12 : sp2.join(cwd, path12));
2061
2061
  } else {
2062
- return path10;
2062
+ return path12;
2063
2063
  }
2064
2064
  };
2065
- var getAbsolutePath = (path10, cwd) => {
2066
- if (sp2.isAbsolute(path10)) {
2067
- return path10;
2065
+ var getAbsolutePath = (path12, cwd) => {
2066
+ if (sp2.isAbsolute(path12)) {
2067
+ return path12;
2068
2068
  }
2069
- return sp2.join(cwd, path10);
2069
+ return sp2.join(cwd, path12);
2070
2070
  };
2071
2071
  var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
2072
2072
  var DirEntry = class {
@@ -2131,10 +2131,10 @@ var WatchHelper = class {
2131
2131
  dirParts;
2132
2132
  followSymlinks;
2133
2133
  statMethod;
2134
- constructor(path10, follow, fsw) {
2134
+ constructor(path12, follow, fsw) {
2135
2135
  this.fsw = fsw;
2136
- const watchPath = path10;
2137
- this.path = path10 = path10.replace(REPLACER_RE, "");
2136
+ const watchPath = path12;
2137
+ this.path = path12 = path12.replace(REPLACER_RE, "");
2138
2138
  this.watchPath = watchPath;
2139
2139
  this.fullWatchPath = sp2.resolve(watchPath);
2140
2140
  this.dirParts = [];
@@ -2274,20 +2274,20 @@ var FSWatcher = class extends EventEmitter {
2274
2274
  this._closePromise = void 0;
2275
2275
  let paths = unifyPaths(paths_);
2276
2276
  if (cwd) {
2277
- paths = paths.map((path10) => {
2278
- const absPath = getAbsolutePath(path10, cwd);
2277
+ paths = paths.map((path12) => {
2278
+ const absPath = getAbsolutePath(path12, cwd);
2279
2279
  return absPath;
2280
2280
  });
2281
2281
  }
2282
- paths.forEach((path10) => {
2283
- this._removeIgnoredPath(path10);
2282
+ paths.forEach((path12) => {
2283
+ this._removeIgnoredPath(path12);
2284
2284
  });
2285
2285
  this._userIgnored = void 0;
2286
2286
  if (!this._readyCount)
2287
2287
  this._readyCount = 0;
2288
2288
  this._readyCount += paths.length;
2289
- Promise.all(paths.map(async (path10) => {
2290
- const res = await this._nodeFsHandler._addToNodeFs(path10, !_internal, void 0, 0, _origAdd);
2289
+ Promise.all(paths.map(async (path12) => {
2290
+ const res = await this._nodeFsHandler._addToNodeFs(path12, !_internal, void 0, 0, _origAdd);
2291
2291
  if (res)
2292
2292
  this._emitReady();
2293
2293
  return res;
@@ -2309,17 +2309,17 @@ var FSWatcher = class extends EventEmitter {
2309
2309
  return this;
2310
2310
  const paths = unifyPaths(paths_);
2311
2311
  const { cwd } = this.options;
2312
- paths.forEach((path10) => {
2313
- if (!sp2.isAbsolute(path10) && !this._closers.has(path10)) {
2312
+ paths.forEach((path12) => {
2313
+ if (!sp2.isAbsolute(path12) && !this._closers.has(path12)) {
2314
2314
  if (cwd)
2315
- path10 = sp2.join(cwd, path10);
2316
- path10 = sp2.resolve(path10);
2315
+ path12 = sp2.join(cwd, path12);
2316
+ path12 = sp2.resolve(path12);
2317
2317
  }
2318
- this._closePath(path10);
2319
- this._addIgnoredPath(path10);
2320
- if (this._watched.has(path10)) {
2318
+ this._closePath(path12);
2319
+ this._addIgnoredPath(path12);
2320
+ if (this._watched.has(path12)) {
2321
2321
  this._addIgnoredPath({
2322
- path: path10,
2322
+ path: path12,
2323
2323
  recursive: true
2324
2324
  });
2325
2325
  }
@@ -2383,38 +2383,38 @@ var FSWatcher = class extends EventEmitter {
2383
2383
  * @param stats arguments to be passed with event
2384
2384
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
2385
2385
  */
2386
- async _emit(event, path10, stats) {
2386
+ async _emit(event, path12, stats) {
2387
2387
  if (this.closed)
2388
2388
  return;
2389
2389
  const opts = this.options;
2390
2390
  if (isWindows)
2391
- path10 = sp2.normalize(path10);
2391
+ path12 = sp2.normalize(path12);
2392
2392
  if (opts.cwd)
2393
- path10 = sp2.relative(opts.cwd, path10);
2394
- const args = [path10];
2393
+ path12 = sp2.relative(opts.cwd, path12);
2394
+ const args = [path12];
2395
2395
  if (stats != null)
2396
2396
  args.push(stats);
2397
2397
  const awf = opts.awaitWriteFinish;
2398
2398
  let pw;
2399
- if (awf && (pw = this._pendingWrites.get(path10))) {
2399
+ if (awf && (pw = this._pendingWrites.get(path12))) {
2400
2400
  pw.lastChange = /* @__PURE__ */ new Date();
2401
2401
  return this;
2402
2402
  }
2403
2403
  if (opts.atomic) {
2404
2404
  if (event === EVENTS.UNLINK) {
2405
- this._pendingUnlinks.set(path10, [event, ...args]);
2405
+ this._pendingUnlinks.set(path12, [event, ...args]);
2406
2406
  setTimeout(() => {
2407
- this._pendingUnlinks.forEach((entry, path11) => {
2407
+ this._pendingUnlinks.forEach((entry, path13) => {
2408
2408
  this.emit(...entry);
2409
2409
  this.emit(EVENTS.ALL, ...entry);
2410
- this._pendingUnlinks.delete(path11);
2410
+ this._pendingUnlinks.delete(path13);
2411
2411
  });
2412
2412
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
2413
2413
  return this;
2414
2414
  }
2415
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path10)) {
2415
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path12)) {
2416
2416
  event = EVENTS.CHANGE;
2417
- this._pendingUnlinks.delete(path10);
2417
+ this._pendingUnlinks.delete(path12);
2418
2418
  }
2419
2419
  }
2420
2420
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -2432,16 +2432,16 @@ var FSWatcher = class extends EventEmitter {
2432
2432
  this.emitWithAll(event, args);
2433
2433
  }
2434
2434
  };
2435
- this._awaitWriteFinish(path10, awf.stabilityThreshold, event, awfEmit);
2435
+ this._awaitWriteFinish(path12, awf.stabilityThreshold, event, awfEmit);
2436
2436
  return this;
2437
2437
  }
2438
2438
  if (event === EVENTS.CHANGE) {
2439
- const isThrottled = !this._throttle(EVENTS.CHANGE, path10, 50);
2439
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path12, 50);
2440
2440
  if (isThrottled)
2441
2441
  return this;
2442
2442
  }
2443
2443
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
2444
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path10) : path10;
2444
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path12) : path12;
2445
2445
  let stats2;
2446
2446
  try {
2447
2447
  stats2 = await stat7(fullPath);
@@ -2472,23 +2472,23 @@ var FSWatcher = class extends EventEmitter {
2472
2472
  * @param timeout duration of time to suppress duplicate actions
2473
2473
  * @returns tracking object or false if action should be suppressed
2474
2474
  */
2475
- _throttle(actionType, path10, timeout) {
2475
+ _throttle(actionType, path12, timeout) {
2476
2476
  if (!this._throttled.has(actionType)) {
2477
2477
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
2478
2478
  }
2479
2479
  const action = this._throttled.get(actionType);
2480
2480
  if (!action)
2481
2481
  throw new Error("invalid throttle");
2482
- const actionPath = action.get(path10);
2482
+ const actionPath = action.get(path12);
2483
2483
  if (actionPath) {
2484
2484
  actionPath.count++;
2485
2485
  return false;
2486
2486
  }
2487
2487
  let timeoutObject;
2488
2488
  const clear = () => {
2489
- const item = action.get(path10);
2489
+ const item = action.get(path12);
2490
2490
  const count = item ? item.count : 0;
2491
- action.delete(path10);
2491
+ action.delete(path12);
2492
2492
  clearTimeout(timeoutObject);
2493
2493
  if (item)
2494
2494
  clearTimeout(item.timeoutObject);
@@ -2496,7 +2496,7 @@ var FSWatcher = class extends EventEmitter {
2496
2496
  };
2497
2497
  timeoutObject = setTimeout(clear, timeout);
2498
2498
  const thr = { timeoutObject, clear, count: 0 };
2499
- action.set(path10, thr);
2499
+ action.set(path12, thr);
2500
2500
  return thr;
2501
2501
  }
2502
2502
  _incrReadyCount() {
@@ -2510,44 +2510,44 @@ var FSWatcher = class extends EventEmitter {
2510
2510
  * @param event
2511
2511
  * @param awfEmit Callback to be called when ready for event to be emitted.
2512
2512
  */
2513
- _awaitWriteFinish(path10, threshold, event, awfEmit) {
2513
+ _awaitWriteFinish(path12, threshold, event, awfEmit) {
2514
2514
  const awf = this.options.awaitWriteFinish;
2515
2515
  if (typeof awf !== "object")
2516
2516
  return;
2517
2517
  const pollInterval = awf.pollInterval;
2518
2518
  let timeoutHandler;
2519
- let fullPath = path10;
2520
- if (this.options.cwd && !sp2.isAbsolute(path10)) {
2521
- fullPath = sp2.join(this.options.cwd, path10);
2519
+ let fullPath = path12;
2520
+ if (this.options.cwd && !sp2.isAbsolute(path12)) {
2521
+ fullPath = sp2.join(this.options.cwd, path12);
2522
2522
  }
2523
2523
  const now = /* @__PURE__ */ new Date();
2524
2524
  const writes = this._pendingWrites;
2525
2525
  function awaitWriteFinishFn(prevStat) {
2526
2526
  statcb(fullPath, (err, curStat) => {
2527
- if (err || !writes.has(path10)) {
2527
+ if (err || !writes.has(path12)) {
2528
2528
  if (err && err.code !== "ENOENT")
2529
2529
  awfEmit(err);
2530
2530
  return;
2531
2531
  }
2532
2532
  const now2 = Number(/* @__PURE__ */ new Date());
2533
2533
  if (prevStat && curStat.size !== prevStat.size) {
2534
- writes.get(path10).lastChange = now2;
2534
+ writes.get(path12).lastChange = now2;
2535
2535
  }
2536
- const pw = writes.get(path10);
2536
+ const pw = writes.get(path12);
2537
2537
  const df = now2 - pw.lastChange;
2538
2538
  if (df >= threshold) {
2539
- writes.delete(path10);
2539
+ writes.delete(path12);
2540
2540
  awfEmit(void 0, curStat);
2541
2541
  } else {
2542
2542
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
2543
2543
  }
2544
2544
  });
2545
2545
  }
2546
- if (!writes.has(path10)) {
2547
- writes.set(path10, {
2546
+ if (!writes.has(path12)) {
2547
+ writes.set(path12, {
2548
2548
  lastChange: now,
2549
2549
  cancelWait: () => {
2550
- writes.delete(path10);
2550
+ writes.delete(path12);
2551
2551
  clearTimeout(timeoutHandler);
2552
2552
  return event;
2553
2553
  }
@@ -2558,8 +2558,8 @@ var FSWatcher = class extends EventEmitter {
2558
2558
  /**
2559
2559
  * Determines whether user has asked to ignore this path.
2560
2560
  */
2561
- _isIgnored(path10, stats) {
2562
- if (this.options.atomic && DOT_RE.test(path10))
2561
+ _isIgnored(path12, stats) {
2562
+ if (this.options.atomic && DOT_RE.test(path12))
2563
2563
  return true;
2564
2564
  if (!this._userIgnored) {
2565
2565
  const { cwd } = this.options;
@@ -2569,17 +2569,17 @@ var FSWatcher = class extends EventEmitter {
2569
2569
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
2570
2570
  this._userIgnored = anymatch(list, void 0);
2571
2571
  }
2572
- return this._userIgnored(path10, stats);
2572
+ return this._userIgnored(path12, stats);
2573
2573
  }
2574
- _isntIgnored(path10, stat9) {
2575
- return !this._isIgnored(path10, stat9);
2574
+ _isntIgnored(path12, stat10) {
2575
+ return !this._isIgnored(path12, stat10);
2576
2576
  }
2577
2577
  /**
2578
2578
  * Provides a set of common helpers and properties relating to symlink handling.
2579
2579
  * @param path file or directory pattern being watched
2580
2580
  */
2581
- _getWatchHelpers(path10) {
2582
- return new WatchHelper(path10, this.options.followSymlinks, this);
2581
+ _getWatchHelpers(path12) {
2582
+ return new WatchHelper(path12, this.options.followSymlinks, this);
2583
2583
  }
2584
2584
  // Directory helpers
2585
2585
  // -----------------
@@ -2611,63 +2611,63 @@ var FSWatcher = class extends EventEmitter {
2611
2611
  * @param item base path of item/directory
2612
2612
  */
2613
2613
  _remove(directory, item, isDirectory) {
2614
- const path10 = sp2.join(directory, item);
2615
- const fullPath = sp2.resolve(path10);
2616
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path10) || this._watched.has(fullPath);
2617
- if (!this._throttle("remove", path10, 100))
2614
+ const path12 = sp2.join(directory, item);
2615
+ const fullPath = sp2.resolve(path12);
2616
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path12) || this._watched.has(fullPath);
2617
+ if (!this._throttle("remove", path12, 100))
2618
2618
  return;
2619
2619
  if (!isDirectory && this._watched.size === 1) {
2620
2620
  this.add(directory, item, true);
2621
2621
  }
2622
- const wp = this._getWatchedDir(path10);
2622
+ const wp = this._getWatchedDir(path12);
2623
2623
  const nestedDirectoryChildren = wp.getChildren();
2624
- nestedDirectoryChildren.forEach((nested) => this._remove(path10, nested));
2624
+ nestedDirectoryChildren.forEach((nested) => this._remove(path12, nested));
2625
2625
  const parent = this._getWatchedDir(directory);
2626
2626
  const wasTracked = parent.has(item);
2627
2627
  parent.remove(item);
2628
2628
  if (this._symlinkPaths.has(fullPath)) {
2629
2629
  this._symlinkPaths.delete(fullPath);
2630
2630
  }
2631
- let relPath = path10;
2631
+ let relPath = path12;
2632
2632
  if (this.options.cwd)
2633
- relPath = sp2.relative(this.options.cwd, path10);
2633
+ relPath = sp2.relative(this.options.cwd, path12);
2634
2634
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
2635
2635
  const event = this._pendingWrites.get(relPath).cancelWait();
2636
2636
  if (event === EVENTS.ADD)
2637
2637
  return;
2638
2638
  }
2639
- this._watched.delete(path10);
2639
+ this._watched.delete(path12);
2640
2640
  this._watched.delete(fullPath);
2641
2641
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
2642
- if (wasTracked && !this._isIgnored(path10))
2643
- this._emit(eventName, path10);
2644
- this._closePath(path10);
2642
+ if (wasTracked && !this._isIgnored(path12))
2643
+ this._emit(eventName, path12);
2644
+ this._closePath(path12);
2645
2645
  }
2646
2646
  /**
2647
2647
  * Closes all watchers for a path
2648
2648
  */
2649
- _closePath(path10) {
2650
- this._closeFile(path10);
2651
- const dir = sp2.dirname(path10);
2652
- this._getWatchedDir(dir).remove(sp2.basename(path10));
2649
+ _closePath(path12) {
2650
+ this._closeFile(path12);
2651
+ const dir = sp2.dirname(path12);
2652
+ this._getWatchedDir(dir).remove(sp2.basename(path12));
2653
2653
  }
2654
2654
  /**
2655
2655
  * Closes only file-specific watchers
2656
2656
  */
2657
- _closeFile(path10) {
2658
- const closers = this._closers.get(path10);
2657
+ _closeFile(path12) {
2658
+ const closers = this._closers.get(path12);
2659
2659
  if (!closers)
2660
2660
  return;
2661
2661
  closers.forEach((closer) => closer());
2662
- this._closers.delete(path10);
2662
+ this._closers.delete(path12);
2663
2663
  }
2664
- _addPathCloser(path10, closer) {
2664
+ _addPathCloser(path12, closer) {
2665
2665
  if (!closer)
2666
2666
  return;
2667
- let list = this._closers.get(path10);
2667
+ let list = this._closers.get(path12);
2668
2668
  if (!list) {
2669
2669
  list = [];
2670
- this._closers.set(path10, list);
2670
+ this._closers.set(path12, list);
2671
2671
  }
2672
2672
  list.push(closer);
2673
2673
  }
@@ -2924,17 +2924,314 @@ var watchCommand = new Command10("watch").description(
2924
2924
  await startWatcher();
2925
2925
  });
2926
2926
 
2927
+ // src/core/init.ts
2928
+ import * as fs10 from "fs/promises";
2929
+ import * as path10 from "path";
2930
+ import { Command as Command11 } from "commander";
2931
+ import enquirer2 from "enquirer";
2932
+ import chalk11 from "chalk";
2933
+ import { $ as $8 } from "execa";
2934
+ import { findWorkspacesRoot as findWorkspacesRoot3 } from "find-workspaces";
2935
+ var initCommand = new Command11("init").description("Initializes the package with the required configuration files").action(async () => {
2936
+ const cwd = process.cwd();
2937
+ const pkgJsonPath = path10.join(cwd, "package.json");
2938
+ try {
2939
+ const pkgExists = await fs10.stat(pkgJsonPath).then(() => true).catch(() => false);
2940
+ if (!pkgExists) {
2941
+ throw new Error("No package.json found in the current directory.");
2942
+ }
2943
+ const packageJsonContent = await fs10.readFile(pkgJsonPath, "utf8");
2944
+ const packageJson = JSON.parse(packageJsonContent);
2945
+ const { builder } = await enquirer2.prompt({
2946
+ type: "select",
2947
+ name: "builder",
2948
+ message: "Which bundler would you like to use?",
2949
+ choices: ["babel", "esbuild"]
2950
+ });
2951
+ const { buildDir } = await enquirer2.prompt({
2952
+ type: "input",
2953
+ name: "buildDir",
2954
+ message: "What is your build output directory?",
2955
+ initial: "build"
2956
+ });
2957
+ const { dts } = await enquirer2.prompt({
2958
+ type: "confirm",
2959
+ name: "dts",
2960
+ message: "Want .d.ts output also",
2961
+ initial: true
2962
+ });
2963
+ let esbuildEntry = "src/index.ts";
2964
+ if (builder === "esbuild") {
2965
+ const response = await enquirer2.prompt({
2966
+ type: "input",
2967
+ name: "entry",
2968
+ message: "What is your esbuild entry point?",
2969
+ initial: "src/index.ts"
2970
+ });
2971
+ esbuildEntry = response.entry;
2972
+ }
2973
+ console.log(chalk11.blue("\n\u2699\uFE0F Applying configuration..."));
2974
+ packageJson.publishConfig = packageJson.publishConfig || {};
2975
+ packageJson.publishConfig.directory = buildDir;
2976
+ await fs10.writeFile(
2977
+ pkgJsonPath,
2978
+ JSON.stringify(packageJson, null, 2) + "\n",
2979
+ "utf8"
2980
+ );
2981
+ console.log(
2982
+ chalk11.gray(
2983
+ `\u{1F4DD} Updated publishConfig.directory to "${buildDir}" in package.json`
2984
+ )
2985
+ );
2986
+ const configPath = path10.join(cwd, "sse.config.ts");
2987
+ let configContent = `import { defineConfig } from "@sse-ui/builder/config";
2988
+
2989
+ export default defineConfig({
2990
+ `;
2991
+ if (builder === "esbuild") {
2992
+ configContent += ` bundle: ["esm", "cjs"],
2993
+ `;
2994
+ configContent += ` buildTypes: ${dts},
2995
+ `;
2996
+ configContent += ` esbuild: {
2997
+ entry: "${esbuildEntry}",
2998
+ external: [],
2999
+ },
3000
+ `;
3001
+ } else {
3002
+ configContent += ` bundle: ["esm", "cjs"],
3003
+ `;
3004
+ configContent += ` buildTypes: ${dts},
3005
+ `;
3006
+ configContent += ` babel: {
3007
+ // enableReactCompiler: false
3008
+ // }
3009
+ `;
3010
+ }
3011
+ configContent += `});
3012
+ `;
3013
+ await fs10.writeFile(configPath, configContent, "utf8");
3014
+ console.log(chalk11.gray(`\u{1F4DD} Created sse.config.ts`));
3015
+ const tsconfigBuildPath = path10.join(cwd, "tsconfig.build.json");
3016
+ const tsconfigBuildExists = await fs10.stat(tsconfigBuildPath).then(() => true).catch(() => false);
3017
+ if (!tsconfigBuildExists) {
3018
+ await fs10.writeFile(
3019
+ tsconfigBuildPath,
3020
+ `{
3021
+ "extends": "./tsconfig.json",
3022
+ , "compilerOptions": {
3023
+ "types": [],
3024
+ }}
3025
+ `,
3026
+ "utf8"
3027
+ );
3028
+ console.log(chalk11.gray(`\u{1F4DD} Created tsconfig.build.json`));
3029
+ }
3030
+ if (builder === "babel") {
3031
+ const workspaceDir = await findWorkspacesRoot3(cwd);
3032
+ const rootDir = workspaceDir ? workspaceDir.location : cwd;
3033
+ let hasBabelConfig = false;
3034
+ for (const ext of [".js", ".mjs"]) {
3035
+ if (await fs10.stat(path10.join(rootDir, `babel.config${ext}`)).then(() => true).catch(() => false)) {
3036
+ hasBabelConfig = true;
3037
+ break;
3038
+ }
3039
+ }
3040
+ if (!hasBabelConfig) {
3041
+ const babelConfigPath = path10.join(rootDir, "babel.config.mjs");
3042
+ const babelConfigContent = `import getBaseConfig from "@sse-ui/builder/babel-config";
3043
+
3044
+ export default function getBabelConfig(api) {
3045
+ const baseConfig = getBaseConfig(api);
3046
+
3047
+ return {
3048
+ ...baseConfig,
3049
+ // Add custom overrides here if needed
3050
+ };
3051
+ }
3052
+ `;
3053
+ await fs10.writeFile(babelConfigPath, babelConfigContent, "utf8");
3054
+ console.log(
3055
+ chalk11.gray(
3056
+ `\u{1F4DD} Created babel.config.mjs in ${workspaceDir ? "workspace root" : "project root"}`
3057
+ )
3058
+ );
3059
+ } else {
3060
+ console.log(
3061
+ chalk11.gray(
3062
+ `\u2139\uFE0F Babel config already exists in ${workspaceDir ? "workspace root" : "project root"}, skipping creation.`
3063
+ )
3064
+ );
3065
+ }
3066
+ const pm = getPackageManager();
3067
+ console.log(
3068
+ chalk11.cyan(`
3069
+ \u23F3 Installing @babel/runtime using ${pm}...`)
3070
+ );
3071
+ try {
3072
+ const ora = (await import("ora")).default;
3073
+ const spinner = ora(`Installing dependencies...`).start();
3074
+ if (pm === "yarn") {
3075
+ await $8`${pm} add @babel/runtime`;
3076
+ } else {
3077
+ await $8`${pm} install @babel/runtime`;
3078
+ }
3079
+ spinner.succeed("Installed @babel/runtime successfully");
3080
+ } catch (installError) {
3081
+ console.log(chalk11.gray(`Falling back to silent install...`));
3082
+ const args = pm === "yarn" ? ["add", "@babel/runtime"] : ["install", "@babel/runtime"];
3083
+ await $8({ stdio: "ignore" })`${pm} ${args}`;
3084
+ console.log(chalk11.green(`\u2705 Installed @babel/runtime successfully`));
3085
+ }
3086
+ }
3087
+ console.log(
3088
+ chalk11.green.bold(
3089
+ "\n\u2728 Initialization complete! You are ready to build."
3090
+ )
3091
+ );
3092
+ } catch (error) {
3093
+ console.error(chalk11.red("\n\u274C Error initializing project:"));
3094
+ if (error instanceof Error) {
3095
+ console.error(chalk11.red(error.message));
3096
+ }
3097
+ process.exit(1);
3098
+ }
3099
+ });
3100
+
3101
+ // src/core/remove.ts
3102
+ import * as fs11 from "fs/promises";
3103
+ import * as path11 from "path";
3104
+ import { Command as Command12 } from "commander";
3105
+ import enquirer3 from "enquirer";
3106
+ import chalk12 from "chalk";
3107
+ import { $ as $9 } from "execa";
3108
+ import { findWorkspacesRoot as findWorkspacesRoot4 } from "find-workspaces";
3109
+ var removeCommand = new Command12("remove").description(
3110
+ "Removes all configuration files and dependencies added by the init command"
3111
+ ).action(async () => {
3112
+ const cwd = process.cwd();
3113
+ const pkgJsonPath = path11.join(cwd, "package.json");
3114
+ try {
3115
+ const { confirm } = await enquirer3.prompt({
3116
+ type: "confirm",
3117
+ name: "confirm",
3118
+ message: chalk12.yellow(
3119
+ "Are you sure you want to remove all sse-tools configurations and the build directory?"
3120
+ ),
3121
+ initial: false
3122
+ });
3123
+ if (!confirm) {
3124
+ console.log(chalk12.gray("Operation cancelled."));
3125
+ return;
3126
+ }
3127
+ console.log(
3128
+ chalk12.blue("\n\u{1F9F9} Removing configurations and build files...")
3129
+ );
3130
+ const configExts = [".ts", ".js", ".mjs", ".cjs"];
3131
+ for (const ext of configExts) {
3132
+ const configPath = path11.join(cwd, `sse.config${ext}`);
3133
+ try {
3134
+ await fs11.unlink(configPath);
3135
+ console.log(chalk12.gray(`\u{1F5D1}\uFE0F Removed sse.config${ext}`));
3136
+ } catch (e) {
3137
+ }
3138
+ }
3139
+ try {
3140
+ await fs11.unlink(path11.join(cwd, "tsconfig.build.json"));
3141
+ console.log(chalk12.gray(`\u{1F5D1}\uFE0F Removed tsconfig.build.json`));
3142
+ } catch (e) {
3143
+ }
3144
+ try {
3145
+ const workspaceDir = await findWorkspacesRoot4(cwd);
3146
+ const rootDir = workspaceDir ? workspaceDir.location : cwd;
3147
+ const babelConfigPath = path11.join(rootDir, "babel.config.mjs");
3148
+ const content = await fs11.readFile(babelConfigPath, "utf8");
3149
+ if (content.includes("@sse-ui/builder/babel-config")) {
3150
+ await fs11.unlink(babelConfigPath);
3151
+ console.log(
3152
+ chalk12.gray(
3153
+ `\u{1F5D1}\uFE0F Removed babel.config.mjs from ${workspaceDir ? "workspace root" : "project root"}`
3154
+ )
3155
+ );
3156
+ }
3157
+ } catch (e) {
3158
+ }
3159
+ try {
3160
+ const packageJsonContent = await fs11.readFile(pkgJsonPath, "utf8");
3161
+ const packageJson = JSON.parse(packageJsonContent);
3162
+ let pkgModified = false;
3163
+ const buildDirBase = packageJson.publishConfig?.directory || "build";
3164
+ const buildDir = path11.join(cwd, buildDirBase);
3165
+ try {
3166
+ await fs11.rm(buildDir, { recursive: true, force: true });
3167
+ console.log(
3168
+ chalk12.gray(`\u{1F5D1}\uFE0F Removed build directory: ./${buildDirBase}`)
3169
+ );
3170
+ } catch (e) {
3171
+ }
3172
+ if (packageJson.publishConfig?.directory) {
3173
+ delete packageJson.publishConfig.directory;
3174
+ if (Object.keys(packageJson.publishConfig).length === 0) {
3175
+ delete packageJson.publishConfig;
3176
+ }
3177
+ pkgModified = true;
3178
+ console.log(
3179
+ chalk12.gray(`\u{1F4DD} Removed publishConfig.directory from package.json`)
3180
+ );
3181
+ }
3182
+ if (pkgModified) {
3183
+ await fs11.writeFile(
3184
+ pkgJsonPath,
3185
+ JSON.stringify(packageJson, null, 2) + "\n",
3186
+ "utf8"
3187
+ );
3188
+ }
3189
+ const hasBabelRuntime = packageJson.dependencies?.["@babel/runtime"] || packageJson.devDependencies?.["@babel/runtime"];
3190
+ if (hasBabelRuntime) {
3191
+ const pm = getPackageManager();
3192
+ console.log(
3193
+ chalk12.cyan(`
3194
+ \u23F3 Uninstalling @babel/runtime using ${pm}...`)
3195
+ );
3196
+ const args = pm === "yarn" ? ["remove", "@babel/runtime"] : ["uninstall", "@babel/runtime"];
3197
+ try {
3198
+ const ora = (await import("ora")).default;
3199
+ const spinner = ora(`Uninstalling dependencies...`).start();
3200
+ await $9({ stdio: "ignore" })`${pm} ${args}`;
3201
+ spinner.succeed("Uninstalled @babel/runtime successfully");
3202
+ } catch (err) {
3203
+ console.log(chalk12.gray(`Falling back to silent uninstall...`));
3204
+ await $9({ stdio: "ignore" })`${pm} ${args}`;
3205
+ console.log(
3206
+ chalk12.green(`\u2705 Uninstalled @babel/runtime successfully`)
3207
+ );
3208
+ }
3209
+ }
3210
+ } catch (e) {
3211
+ console.error(chalk12.red("\u26A0\uFE0F Could not read or update package.json"));
3212
+ }
3213
+ console.log(chalk12.green.bold("\n\u2728 Clean up complete!"));
3214
+ } catch (error) {
3215
+ console.error(chalk12.red("\n\u274C Error removing configuration:"));
3216
+ if (error instanceof Error) {
3217
+ console.error(chalk12.red(error.message));
3218
+ }
3219
+ process.exit(1);
3220
+ }
3221
+ });
3222
+
2927
3223
  // src/cli.ts
2928
3224
  async function main() {
2929
- const program = new Command11();
3225
+ const program = new Command13();
2930
3226
  program.name("sse-tools").description(
2931
- chalk11.cyan("CLI utilities for managing and building SSE packages")
3227
+ chalk13.cyan("CLI utilities for managing and building SSE packages")
2932
3228
  ).version("1.0.0").option("-v, --verbose", "Enable verbose logging across all commands");
2933
3229
  program.hook("preAction", (thisCommand) => {
2934
3230
  if (thisCommand.opts().verbose) {
2935
3231
  process.env.SSE_BUILD_VERBOSE = "true";
2936
3232
  }
2937
3233
  });
3234
+ program.addCommand(initCommand);
2938
3235
  program.addCommand(buildCommand);
2939
3236
  program.addCommand(publishCommand);
2940
3237
  program.addCommand(cleanCommand);
@@ -2945,6 +3242,7 @@ async function main() {
2945
3242
  program.addCommand(linkCommand);
2946
3243
  program.addCommand(checkExportsCommand);
2947
3244
  program.addCommand(watchCommand);
3245
+ program.addCommand(removeCommand);
2948
3246
  try {
2949
3247
  await program.parseAsync(process.argv);
2950
3248
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sse-ui/builder",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Builder By SSE",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -55,6 +55,7 @@
55
55
  "jiti": "^2.6.1",
56
56
  "minimatch": "^10.2.4",
57
57
  "mismatch": "^1.2.0",
58
+ "ora": "^9.3.0",
58
59
  "semver": "^7.7.4"
59
60
  },
60
61
  "repository": {