@yamada-ui/cli 2.0.0-dev-20251006155644 → 2.0.0-dev-20251007054727

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 (2) hide show
  1. package/dist/index.js +386 -240
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1311,7 +1311,7 @@ function hasProperty(object, path$9) {
1311
1311
  }
1312
1312
 
1313
1313
  //#endregion
1314
- //#region ../../node_modules/.pnpm/configstore@7.0.0/node_modules/configstore/index.js
1314
+ //#region ../../node_modules/.pnpm/configstore@7.1.0/node_modules/configstore/index.js
1315
1315
  function getConfigDirectory(id, globalConfigPath) {
1316
1316
  const pathPrefix = globalConfigPath ? path.join(id, "config.json") : path.join("configstore", `${id}.json`);
1317
1317
  const configDirectory = xdgConfig ?? import_graceful_fs.default.mkdtempSync(import_graceful_fs.default.realpathSync(os.tmpdir()) + path.sep);
@@ -1323,9 +1323,14 @@ const mkdirOptions = {
1323
1323
  recursive: true
1324
1324
  };
1325
1325
  const writeFileOptions = { mode: 384 };
1326
+ function handlePermissionError(error) {
1327
+ if (error.code === "EACCES") error.message = `${error.message}\n${permissionError}\n`;
1328
+ throw error;
1329
+ }
1326
1330
  var Configstore = class {
1327
1331
  constructor(id, defaults$1, options = {}) {
1328
1332
  this._path = options.configPath ?? getConfigDirectory(id, options.globalConfigPath);
1333
+ this._clearInvalidConfig = options.clearInvalidConfig ?? true;
1329
1334
  if (defaults$1) this.all = {
1330
1335
  ...defaults$1,
1331
1336
  ...this.all
@@ -1336,12 +1341,16 @@ var Configstore = class {
1336
1341
  return JSON.parse(import_graceful_fs.default.readFileSync(this._path, "utf8"));
1337
1342
  } catch (error) {
1338
1343
  if (error.code === "ENOENT") return {};
1339
- if (error.code === "EACCES") error.message = `${error.message}\n${permissionError}\n`;
1340
1344
  if (error.name === "SyntaxError") {
1341
- writeFileSync(this._path, "", writeFileOptions);
1342
- return {};
1345
+ if (this._clearInvalidConfig) {
1346
+ writeFileSync(this._path, "", writeFileOptions);
1347
+ return {};
1348
+ }
1349
+ throw error;
1343
1350
  }
1344
- throw error;
1351
+ handlePermissionError(error);
1352
+ /* c8 ignore next */
1353
+ return {};
1345
1354
  }
1346
1355
  }
1347
1356
  set all(value) {
@@ -1349,8 +1358,7 @@ var Configstore = class {
1349
1358
  import_graceful_fs.default.mkdirSync(path.dirname(this._path), mkdirOptions);
1350
1359
  writeFileSync(this._path, JSON.stringify(value, void 0, " "), writeFileOptions);
1351
1360
  } catch (error) {
1352
- if (error.code === "EACCES") error.message = `${error.message}\n${permissionError}\n`;
1353
- throw error;
1361
+ handlePermissionError(error);
1354
1362
  }
1355
1363
  }
1356
1364
  get size() {
@@ -1361,7 +1369,7 @@ var Configstore = class {
1361
1369
  }
1362
1370
  set(key, value) {
1363
1371
  const config$1 = this.all;
1364
- if (arguments.length === 1) for (const k of Object.keys(key)) setProperty(config$1, k, key[k]);
1372
+ if (typeof key === "object" && arguments.length === 1) for (const k of Object.keys(key)) setProperty(config$1, k, key[k]);
1365
1373
  else setProperty(config$1, key, value);
1366
1374
  this.all = config$1;
1367
1375
  }
@@ -1792,14 +1800,14 @@ const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1792
1800
  var source_default = chalk;
1793
1801
 
1794
1802
  //#endregion
1795
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/errors/HTTPError.js
1803
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/errors/HTTPError.js
1796
1804
  var HTTPError = class extends Error {
1797
1805
  response;
1798
1806
  request;
1799
1807
  options;
1800
1808
  constructor(response, request, options) {
1801
1809
  const code = response.status || response.status === 0 ? response.status : "";
1802
- const title = response.statusText || "";
1810
+ const title = response.statusText ?? "";
1803
1811
  const status = `${code} ${title}`.trim();
1804
1812
  const reason = status ? `status code ${status}` : "an unknown error";
1805
1813
  super(`Request failed with ${reason}: ${request.method} ${request.url}`);
@@ -1811,7 +1819,7 @@ var HTTPError = class extends Error {
1811
1819
  };
1812
1820
 
1813
1821
  //#endregion
1814
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/errors/TimeoutError.js
1822
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/errors/TimeoutError.js
1815
1823
  var TimeoutError = class extends Error {
1816
1824
  request;
1817
1825
  constructor(request) {
@@ -1822,7 +1830,7 @@ var TimeoutError = class extends Error {
1822
1830
  };
1823
1831
 
1824
1832
  //#endregion
1825
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/core/constants.js
1833
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/core/constants.js
1826
1834
  const supportsRequestStreams = (() => {
1827
1835
  let duplexAccessed = false;
1828
1836
  let hasContentType = false;
@@ -1902,7 +1910,7 @@ const requestOptionsRegistry = {
1902
1910
  };
1903
1911
 
1904
1912
  //#endregion
1905
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/utils/body.js
1913
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/utils/body.js
1906
1914
  const getBodySize = (body) => {
1907
1915
  if (!body) return 0;
1908
1916
  if (body instanceof FormData) {
@@ -1927,93 +1935,65 @@ const getBodySize = (body) => {
1927
1935
  }
1928
1936
  return 0;
1929
1937
  };
1930
- const streamResponse = (response, onDownloadProgress) => {
1931
- const totalBytes = Number(response.headers.get("content-length")) || 0;
1938
+ const withProgress = (stream, totalBytes, onProgress) => {
1939
+ let previousChunk;
1932
1940
  let transferredBytes = 0;
1933
- if (response.status === 204) {
1934
- if (onDownloadProgress) onDownloadProgress({
1935
- percent: 1,
1936
- totalBytes,
1937
- transferredBytes
1938
- }, new Uint8Array());
1939
- return new Response(null, {
1940
- status: response.status,
1941
- statusText: response.statusText,
1942
- headers: response.headers
1943
- });
1944
- }
1945
- return new Response(new ReadableStream({ async start(controller) {
1946
- const reader = response.body.getReader();
1947
- if (onDownloadProgress) onDownloadProgress({
1948
- percent: 0,
1949
- transferredBytes: 0,
1950
- totalBytes
1951
- }, new Uint8Array());
1952
- async function read() {
1953
- const { done, value } = await reader.read();
1954
- if (done) {
1955
- controller.close();
1956
- return;
1957
- }
1958
- if (onDownloadProgress) {
1959
- transferredBytes += value.byteLength;
1960
- const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
1961
- onDownloadProgress({
1941
+ return stream.pipeThrough(new TransformStream({
1942
+ transform(currentChunk, controller) {
1943
+ controller.enqueue(currentChunk);
1944
+ if (previousChunk) {
1945
+ transferredBytes += previousChunk.byteLength;
1946
+ let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
1947
+ if (percent >= 1) percent = 1 - Number.EPSILON;
1948
+ onProgress?.({
1962
1949
  percent,
1963
- transferredBytes,
1964
- totalBytes
1965
- }, value);
1950
+ totalBytes: Math.max(totalBytes, transferredBytes),
1951
+ transferredBytes
1952
+ }, previousChunk);
1953
+ }
1954
+ previousChunk = currentChunk;
1955
+ },
1956
+ flush() {
1957
+ if (previousChunk) {
1958
+ transferredBytes += previousChunk.byteLength;
1959
+ onProgress?.({
1960
+ percent: 1,
1961
+ totalBytes: Math.max(totalBytes, transferredBytes),
1962
+ transferredBytes
1963
+ }, previousChunk);
1966
1964
  }
1967
- controller.enqueue(value);
1968
- await read();
1969
1965
  }
1970
- await read();
1971
- } }), {
1966
+ }));
1967
+ };
1968
+ const streamResponse = (response, onDownloadProgress) => {
1969
+ if (!response.body) return response;
1970
+ if (response.status === 204) return new Response(null, {
1971
+ status: response.status,
1972
+ statusText: response.statusText,
1973
+ headers: response.headers
1974
+ });
1975
+ const totalBytes = Number(response.headers.get("content-length")) || 0;
1976
+ return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
1972
1977
  status: response.status,
1973
1978
  statusText: response.statusText,
1974
1979
  headers: response.headers
1975
1980
  });
1976
1981
  };
1977
1982
  const streamRequest = (request, onUploadProgress, originalBody) => {
1983
+ if (!request.body) return request;
1978
1984
  const totalBytes = getBodySize(originalBody ?? request.body);
1979
- let transferredBytes = 0;
1980
1985
  return new Request(request, {
1981
1986
  duplex: "half",
1982
- body: new ReadableStream({ async start(controller) {
1983
- const reader = request.body instanceof ReadableStream ? request.body.getReader() : new Response("").body.getReader();
1984
- async function read() {
1985
- const { done, value } = await reader.read();
1986
- if (done) {
1987
- if (onUploadProgress) onUploadProgress({
1988
- percent: 1,
1989
- transferredBytes,
1990
- totalBytes: Math.max(totalBytes, transferredBytes)
1991
- }, new Uint8Array());
1992
- controller.close();
1993
- return;
1994
- }
1995
- transferredBytes += value.byteLength;
1996
- let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
1997
- if (totalBytes < transferredBytes || percent === 1) percent = .99;
1998
- if (onUploadProgress) onUploadProgress({
1999
- percent: Number(percent.toFixed(2)),
2000
- transferredBytes,
2001
- totalBytes
2002
- }, value);
2003
- controller.enqueue(value);
2004
- await read();
2005
- }
2006
- await read();
2007
- } })
1987
+ body: withProgress(request.body, totalBytes, onUploadProgress)
2008
1988
  });
2009
1989
  };
2010
1990
 
2011
1991
  //#endregion
2012
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/utils/is.js
1992
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/utils/is.js
2013
1993
  const isObject$1 = (value) => value !== null && typeof value === "object";
2014
1994
 
2015
1995
  //#endregion
2016
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/utils/merge.js
1996
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/utils/merge.js
2017
1997
  const validateAndMerge = (...sources) => {
2018
1998
  for (const source of sources) if ((!isObject$1(source) || Array.isArray(source)) && source !== void 0) throw new TypeError("The `options` argument must be an object");
2019
1999
  return deepMerge({}, ...sources);
@@ -2063,7 +2043,7 @@ const deepMerge = (...sources) => {
2063
2043
  };
2064
2044
 
2065
2045
  //#endregion
2066
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/utils/normalize.js
2046
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/utils/normalize.js
2067
2047
  const normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
2068
2048
  const defaultRetryOptions = {
2069
2049
  limit: 2,
@@ -2107,7 +2087,7 @@ const normalizeRetryOptions = (retry$2 = {}) => {
2107
2087
  };
2108
2088
 
2109
2089
  //#endregion
2110
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/utils/timeout.js
2090
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/utils/timeout.js
2111
2091
  async function timeout(request, init$1, abortController, options) {
2112
2092
  return new Promise((resolve, reject) => {
2113
2093
  const timeoutId = setTimeout(() => {
@@ -2121,7 +2101,7 @@ async function timeout(request, init$1, abortController, options) {
2121
2101
  }
2122
2102
 
2123
2103
  //#endregion
2124
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/utils/delay.js
2104
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/utils/delay.js
2125
2105
  async function delay(ms, { signal }) {
2126
2106
  return new Promise((resolve, reject) => {
2127
2107
  if (signal) {
@@ -2140,7 +2120,7 @@ async function delay(ms, { signal }) {
2140
2120
  }
2141
2121
 
2142
2122
  //#endregion
2143
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/utils/options.js
2123
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/utils/options.js
2144
2124
  const findUnknownOptions = (request, options) => {
2145
2125
  const unknownOptions = {};
2146
2126
  for (const key in options) if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) unknownOptions[key] = options[key];
@@ -2156,7 +2136,7 @@ const hasSearchParameters = (search) => {
2156
2136
  };
2157
2137
 
2158
2138
  //#endregion
2159
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/core/Ky.js
2139
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/core/Ky.js
2160
2140
  var Ky = class Ky {
2161
2141
  static create(input, options) {
2162
2142
  const ky$1 = new Ky(input, options);
@@ -2182,7 +2162,11 @@ var Ky = class Ky {
2182
2162
  return response;
2183
2163
  };
2184
2164
  const result = (ky$1._options.retry.methods.includes(ky$1.request.method.toLowerCase()) ? ky$1._retry(function_) : function_()).finally(async () => {
2185
- if (!ky$1.request.bodyUsed) await ky$1.request.body?.cancel();
2165
+ const originalRequest = ky$1._originalRequest;
2166
+ const cleanupPromises = [];
2167
+ if (originalRequest && !originalRequest.bodyUsed) cleanupPromises.push(originalRequest.body?.cancel());
2168
+ if (!ky$1.request.bodyUsed) cleanupPromises.push(ky$1.request.body?.cancel());
2169
+ await Promise.all(cleanupPromises);
2186
2170
  });
2187
2171
  for (const [type$1, mimeType] of Object.entries(responseTypes)) {
2188
2172
  if (type$1 === "bytes" && typeof globalThis.Response?.prototype?.bytes !== "function") continue;
@@ -2210,6 +2194,7 @@ var Ky = class Ky {
2210
2194
  _retryCount = 0;
2211
2195
  _input;
2212
2196
  _options;
2197
+ _originalRequest;
2213
2198
  constructor(input, options = {}) {
2214
2199
  this._input = input;
2215
2200
  this._options = {
@@ -2305,15 +2290,15 @@ var Ky = class Ky {
2305
2290
  if (result instanceof Response) return result;
2306
2291
  }
2307
2292
  const nonRequestOptions = findUnknownOptions(this.request, this._options);
2308
- const mainRequest = this.request;
2309
- this.request = mainRequest.clone();
2310
- if (this._options.timeout === false) return this._options.fetch(mainRequest, nonRequestOptions);
2311
- return timeout(mainRequest, nonRequestOptions, this.abortController, this._options);
2293
+ this._originalRequest = this.request;
2294
+ this.request = this._originalRequest.clone();
2295
+ if (this._options.timeout === false) return this._options.fetch(this._originalRequest, nonRequestOptions);
2296
+ return timeout(this._originalRequest, nonRequestOptions, this.abortController, this._options);
2312
2297
  }
2313
2298
  };
2314
2299
 
2315
2300
  //#endregion
2316
- //#region ../../node_modules/.pnpm/ky@1.10.0/node_modules/ky/distribution/index.js
2301
+ //#region ../../node_modules/.pnpm/ky@1.11.0/node_modules/ky/distribution/index.js
2317
2302
  const createInstance = (defaults$1) => {
2318
2303
  const ky$1 = (input, options) => Ky.create(input, validateAndMerge(defaults$1, options));
2319
2304
  for (const method of requestMethods) ky$1[method] = (input, options) => Ky.create(input, validateAndMerge(defaults$1, options, { method }));
@@ -3646,9 +3631,9 @@ var require_dist$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@pnp
3646
3631
  }) });
3647
3632
 
3648
3633
  //#endregion
3649
- //#region ../../node_modules/.pnpm/tsdown@0.15.4_typescript@5.9.2/node_modules/tsdown/esm-shims.js
3634
+ //#region ../../node_modules/.pnpm/tsdown@0.15.6_typescript@5.9.3/node_modules/tsdown/esm-shims.js
3650
3635
  var getFilename, getDirname, __dirname$2;
3651
- var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.4_typescript@5.9.2/node_modules/tsdown/esm-shims.js": (() => {
3636
+ var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.6_typescript@5.9.3/node_modules/tsdown/esm-shims.js": (() => {
3652
3637
  getFilename = () => fileURLToPath(import.meta.url);
3653
3638
  getDirname = () => path.dirname(getFilename());
3654
3639
  __dirname$2 = /* @__PURE__ */ getDirname();
@@ -5039,7 +5024,7 @@ function htmlEscape(strings, ...values) {
5039
5024
  }
5040
5025
 
5041
5026
  //#endregion
5042
- //#region ../../node_modules/.pnpm/pupa@3.1.0/node_modules/pupa/index.js
5027
+ //#region ../../node_modules/.pnpm/pupa@3.3.0/node_modules/pupa/index.js
5043
5028
  var MissingValueError = class extends Error {
5044
5029
  constructor(key) {
5045
5030
  super(`Missing a value for ${key ? `the placeholder: ${key}` : "a placeholder"}`, key);
@@ -5047,12 +5032,48 @@ var MissingValueError = class extends Error {
5047
5032
  this.key = key;
5048
5033
  }
5049
5034
  };
5050
- function pupa(template, data, { ignoreMissing = false, transform: transform$1 = ({ value }) => value } = {}) {
5035
+ var MissingFilterError = class extends Error {
5036
+ constructor(filterName) {
5037
+ super(`Missing filter: ${filterName}`);
5038
+ this.name = "MissingFilterError";
5039
+ this.filterName = filterName;
5040
+ }
5041
+ };
5042
+ function pupa(template, data, { ignoreMissing = false, transform: transform$1 = ({ value }) => value, filters = {} } = {}) {
5051
5043
  if (typeof template !== "string") throw new TypeError(`Expected a \`string\` in the first argument, got \`${typeof template}\``);
5052
5044
  if (typeof data !== "object") throw new TypeError(`Expected an \`object\` or \`Array\` in the second argument, got \`${typeof data}\``);
5053
- const replace = (placeholder, key) => {
5045
+ const escapedLeftBrace = "";
5046
+ const escapedRightBrace = "";
5047
+ template = template.replace(/\\{/g, escapedLeftBrace);
5048
+ template = template.replace(/\\}/g, escapedRightBrace);
5049
+ const parseKeyPath = (key) => {
5050
+ const segments = [];
5051
+ let segment = "";
5052
+ for (let index = 0; index < key.length; index++) if (key[index] === "\\" && key[index + 1] === ".") {
5053
+ segment += ".";
5054
+ index++;
5055
+ } else if (key[index] === ".") {
5056
+ segments.push(segment);
5057
+ segment = "";
5058
+ } else segment += key[index];
5059
+ segments.push(segment);
5060
+ return segments;
5061
+ };
5062
+ const replace = (placeholder, keyWithFilters) => {
5063
+ const parts = keyWithFilters.split("|").map((part) => part.trim());
5064
+ const key = parts[0];
5065
+ const filterChain = parts.slice(1);
5066
+ const segments = parseKeyPath(key);
5054
5067
  let value = data;
5055
- for (const property of key.split(".")) value = value ? value[property] : void 0;
5068
+ for (const property of segments) if (value) value = value[property];
5069
+ for (const filterName of filterChain) {
5070
+ const filter = filters[filterName];
5071
+ if (!filter) {
5072
+ if (ignoreMissing) return placeholder;
5073
+ throw new MissingFilterError(filterName);
5074
+ }
5075
+ if (value !== void 0) value = filter(value);
5076
+ }
5056
5077
  const transformedValue = transform$1({
5057
5078
  value,
5058
5079
  key
@@ -5063,10 +5084,14 @@ function pupa(template, data, { ignoreMissing = false, transform: transform$1 =
5063
5084
  }
5064
5085
  return String(transformedValue);
5065
5086
  };
5066
- const composeHtmlEscape = (replacer) => (...args) => htmlEscape(replacer(...args));
5067
- const doubleBraceRegex = /{{(\d+|[a-z$_][\w\-$]*?(?:\.[\w\-$]*?)*?)}}/gi;
5068
- if (doubleBraceRegex.test(template)) template = template.replace(doubleBraceRegex, composeHtmlEscape(replace));
5069
- return template.replace(/{(\d+|[a-z$_][\w\-$]*?(?:\.[\w\-$]*?)*?)}/gi, replace);
5087
+ const keyWithFiltersPattern = `((\\d+|[a-z\$_][\\w\\-.\$\\\\]*)\\s*(?:\\|\\s*[a-z\$_][\\w\$]*\\s*)*)`;
5088
+ const doubleBraceRegex = new RegExp(`{{${keyWithFiltersPattern}}}`, "gi");
5089
+ const singleBraceRegex = new RegExp(`{${keyWithFiltersPattern}}`, "gi");
5090
+ template = template.replace(doubleBraceRegex, (...arguments_) => htmlEscape(replace(...arguments_)));
5091
+ template = template.replace(singleBraceRegex, replace);
5092
+ template = template.replace(new RegExp(escapedLeftBrace, "g"), "{");
5093
+ template = template.replace(new RegExp(escapedRightBrace, "g"), "}");
5094
+ return template;
5070
5095
  }
5071
5096
 
5072
5097
  //#endregion
@@ -5214,17 +5239,17 @@ var dependencies = {
5214
5239
  "@yamada-ui/utils": "workspace:*",
5215
5240
  "boxen": "^8.0.1",
5216
5241
  "cli-check-node": "^1.3.4",
5217
- "commander": "^14.0.0",
5242
+ "commander": "^14.0.1",
5218
5243
  "diff": "^8.0.2",
5219
- "esbuild": "^0.25.9",
5220
- "eslint": "^9.35.0",
5244
+ "esbuild": "^0.25.10",
5245
+ "eslint": "^9.37.0",
5221
5246
  "execa": "9.3.1",
5222
5247
  "glob": "^11.0.3",
5223
5248
  "https-proxy-agent": "^7.0.6",
5224
- "listr2": "^9.0.3",
5249
+ "listr2": "^9.0.4",
5225
5250
  "node-eval": "^2.0.0",
5226
5251
  "node-fetch": "^3.3.2",
5227
- "ora": "^8.2.0",
5252
+ "ora": "^9.0.0",
5228
5253
  "picocolors": "^1.1.1",
5229
5254
  "prettier": "^3.6.2",
5230
5255
  "prompts": "^2.4.2",
@@ -5240,8 +5265,8 @@ var devDependencies = {
5240
5265
  "@types/update-notifier": "6.0.8",
5241
5266
  "@types/validate-npm-package-name": "^4.0.2",
5242
5267
  "@types/yamljs": "^0.2.34",
5243
- "tsx": "^4.20.5",
5244
- "typescript": "^5.9.2",
5268
+ "tsx": "^4.20.6",
5269
+ "typescript": "^5.9.3",
5245
5270
  "update-notifier": "^7.3.1"
5246
5271
  };
5247
5272
  var package_default = {
@@ -5265,6 +5290,104 @@ var package_default = {
5265
5290
  devDependencies
5266
5291
  };
5267
5292
 
5293
+ //#endregion
5294
+ //#region src/constant.ts
5295
+ const CONFIG_FILE_NAME = "ui.json";
5296
+ const REGISTRY_FILE_NAME = "registry.json";
5297
+ const DEFAULT_PACKAGE_NAME = {
5298
+ ui: "@workspaces/ui",
5299
+ theme: "@workspaces/theme"
5300
+ };
5301
+ const REGISTRY_URL = "https://v2.yamada-ui.com/registry/v2";
5302
+ const DEFAULT_PATH = {
5303
+ components: "./components",
5304
+ hooks: "./hooks",
5305
+ providers: "./providers",
5306
+ ui: {
5307
+ monorepo: "./workspaces/ui",
5308
+ polyrepo: "./components/ui"
5309
+ },
5310
+ theme: {
5311
+ monorepo: "./workspaces/theme",
5312
+ polyrepo: "./theme"
5313
+ }
5314
+ };
5315
+ const SECTION_NAMES = [
5316
+ "components",
5317
+ "hooks",
5318
+ "providers"
5319
+ ];
5320
+ const DEFAULT_CONFIG = {
5321
+ $schema: `${REGISTRY_URL}/config.schema.json`,
5322
+ components: { overwrite: true },
5323
+ hooks: { overwrite: true },
5324
+ providers: { overwrite: true }
5325
+ };
5326
+ const REQUIRED_DEPENDENCIES = {
5327
+ ui: ["react@^19", "react-dom@^19"],
5328
+ theme: []
5329
+ };
5330
+ const REQUIRED_DEV_DEPENDENCIES = {
5331
+ ui: ["@types/react@^19", "@types/react-dom@^19"],
5332
+ theme: []
5333
+ };
5334
+ const DEFAULT_PACKAGE_JSON = {
5335
+ version: "1.0.0",
5336
+ type: "module",
5337
+ private: true,
5338
+ scripts: {}
5339
+ };
5340
+ const DEFAULT_PACKAGE_JSON_EXPORTS = {
5341
+ ui: {
5342
+ tsx: {
5343
+ ".": "./src/index.ts",
5344
+ "./components/*": "./src/components/*/index.ts",
5345
+ "./hooks/*": "./src/hooks/*/index.ts",
5346
+ "./providers/*": "./src/providers/*/index.ts"
5347
+ },
5348
+ jsx: {
5349
+ ".": "./src/index.js",
5350
+ "./components/*": "./src/components/*/index.js",
5351
+ "./hooks/*": "./src/hooks/*/index.js",
5352
+ "./providers/*": "./src/providers/*/index.js"
5353
+ }
5354
+ },
5355
+ theme: {
5356
+ tsx: { ".": "./src/index.ts" },
5357
+ jsx: { ".": "./src/index.js" }
5358
+ }
5359
+ };
5360
+ const TSCONFIG_JSON = {
5361
+ compilerOptions: {
5362
+ target: "ESNext",
5363
+ module: "ESNext",
5364
+ lib: [
5365
+ "DOM",
5366
+ "DOM.Iterable",
5367
+ "ESNext"
5368
+ ],
5369
+ moduleResolution: "Bundler",
5370
+ moduleDetection: "force",
5371
+ jsx: "preserve",
5372
+ strict: true,
5373
+ declaration: true,
5374
+ declarationMap: true,
5375
+ esModuleInterop: true,
5376
+ isolatedModules: true,
5377
+ resolveJsonModule: true,
5378
+ incremental: false,
5379
+ noEmit: true,
5380
+ skipLibCheck: true,
5381
+ allowJs: true,
5382
+ allowSyntheticDefaultImports: true,
5383
+ noUncheckedSideEffectImports: true,
5384
+ noFallthroughCasesInSwitch: true,
5385
+ noUncheckedIndexedAccess: true
5386
+ },
5387
+ include: ["src/**/*.ts", "src/**/*.tsx"],
5388
+ exclude: ["node_modules"]
5389
+ };
5390
+
5268
5391
  //#endregion
5269
5392
  //#region src/utils/lint.ts
5270
5393
  async function lintText(content, { cwd: cwd$3, enabled = true, filePath } = {}) {
@@ -5549,6 +5672,17 @@ function transformTsToJs(content) {
5549
5672
 
5550
5673
  //#endregion
5551
5674
  //#region src/utils/config.ts
5675
+ function getPaths(rootPath, jsx) {
5676
+ const srcPath = existsSync(path$1.resolve(rootPath, "src")) ? path$1.resolve(rootPath, "src") : rootPath;
5677
+ const indexPath = path$1.resolve(srcPath, transformExtension("index.ts", jsx));
5678
+ const registryPath = path$1.resolve(srcPath, REGISTRY_FILE_NAME);
5679
+ return {
5680
+ src: srcPath,
5681
+ index: indexPath,
5682
+ registry: registryPath,
5683
+ root: rootPath
5684
+ };
5685
+ }
5552
5686
  async function getConfig(cwd$3, configPath, { format: format$2, jsx, lint } = {}) {
5553
5687
  try {
5554
5688
  const data = await readFile(path$1.resolve(cwd$3, configPath), "utf-8");
@@ -5556,21 +5690,20 @@ async function getConfig(cwd$3, configPath, { format: format$2, jsx, lint } = {}
5556
5690
  if (!isUndefined(format$2)) userConfig.format = { enabled: format$2 };
5557
5691
  if (!isUndefined(lint)) userConfig.lint = { enabled: lint };
5558
5692
  if (!isUndefined(jsx)) userConfig.jsx = jsx;
5559
- const rootPath = path$1.resolve(cwd$3, userConfig.path ?? (userConfig.monorepo ? DEFAULT_PATH.monorepo : DEFAULT_PATH.polyrepo));
5560
- const src = existsSync(path$1.resolve(rootPath, "src"));
5561
- const srcPath = src ? path$1.resolve(rootPath, "src") : rootPath;
5693
+ const paths = {
5694
+ theme: getPaths(path$1.resolve(cwd$3, userConfig.theme?.path ?? (userConfig.monorepo ? DEFAULT_PATH.theme.monorepo : DEFAULT_PATH.theme.polyrepo)), userConfig.jsx),
5695
+ ui: getPaths(path$1.resolve(cwd$3, userConfig.path ?? (userConfig.monorepo ? DEFAULT_PATH.ui.monorepo : DEFAULT_PATH.ui.polyrepo)), userConfig.jsx)
5696
+ };
5562
5697
  const sectionMap = Object.fromEntries(SECTION_NAMES.map((section) => {
5563
5698
  const replacedSection = (userConfig[section]?.path ?? DEFAULT_PATH[section]).replace(/(\.\.\/|\.\/)/g, "").replace(/(^\/|\/$)/g, "");
5564
5699
  return [section, replacedSection];
5565
5700
  }));
5566
- const indexPath = path$1.resolve(srcPath, transformExtension("index.ts", userConfig.jsx));
5567
- const registryPath = path$1.resolve(srcPath, REGISTRY_FILE_NAME);
5568
5701
  if (userConfig.theme?.path) userConfig.theme.path = path$1.resolve(cwd$3, userConfig.theme.path);
5569
5702
  function isSection(section) {
5570
5703
  return SECTION_NAMES.includes(section);
5571
5704
  }
5572
5705
  function getSectionResolvedPath(section) {
5573
- return path$1.resolve(srcPath, userConfig[section]?.path ?? DEFAULT_PATH[section]);
5706
+ return path$1.resolve(paths.ui.src, userConfig[section]?.path ?? DEFAULT_PATH[section]);
5574
5707
  }
5575
5708
  function getSectionPath(section) {
5576
5709
  let path$9 = userConfig[section]?.path ?? DEFAULT_PATH[section];
@@ -5602,16 +5735,12 @@ async function getConfig(cwd$3, configPath, { format: format$2, jsx, lint } = {}
5602
5735
  }
5603
5736
  return {
5604
5737
  ...userConfig,
5605
- src,
5606
5738
  cwd: cwd$3,
5607
5739
  getSection,
5608
5740
  getSectionPath,
5609
5741
  getSectionResolvedPath,
5610
- indexPath,
5611
5742
  isSection,
5612
- registryPath,
5613
- rootPath,
5614
- srcPath
5743
+ paths
5615
5744
  };
5616
5745
  } catch {
5617
5746
  const packageManager = getPackageManager();
@@ -5830,15 +5959,14 @@ function transformIndex(generatedNames, content, { getSection }) {
5830
5959
  return content;
5831
5960
  }
5832
5961
  async function transformIndexWithFormatAndLint(content, config$1, generatedNames) {
5833
- const { cwd: cwd$3, format: format$2, indexPath, jsx, lint } = config$1;
5834
5962
  content = transformIndex(generatedNames, content, config$1);
5835
- if (jsx) content = transformTsToJs(content);
5963
+ if (config$1.jsx) content = transformTsToJs(content);
5836
5964
  content = await lintText(content, {
5837
- ...lint,
5838
- cwd: cwd$3,
5839
- filePath: indexPath
5965
+ ...config$1.lint,
5966
+ cwd: config$1.cwd,
5967
+ filePath: config$1.paths.ui.index
5840
5968
  });
5841
- content = await formatText(content, format$2);
5969
+ content = await formatText(content, config$1.format);
5842
5970
  return content;
5843
5971
  }
5844
5972
  async function generateSource(dirPath, section, { name: fileName, content, data, template }, config$1, generatedNames = []) {
@@ -5860,86 +5988,6 @@ async function generateSources(dirPath, registry, config$1, generatedNames = [])
5860
5988
  await Promise.all([...registry.sources.map((source) => generateSource(dirPath, registry.section, source, config$1, generatedNames)), writeFileSafe(path$1.resolve(dirPath, REGISTRY_FILE_NAME), JSON.stringify(registry), merge(config$1, { format: { parser: "json" } }))]);
5861
5989
  }
5862
5990
 
5863
- //#endregion
5864
- //#region src/constant.ts
5865
- const CONFIG_FILE_NAME = "ui.json";
5866
- const REGISTRY_FILE_NAME = "registry.json";
5867
- const THEME_PATH = "./theme";
5868
- const DEFAULT_PACKAGE_NAME = "@workspaces/ui";
5869
- const REGISTRY_URL = "https://v2.yamada-ui.com/registry/v2";
5870
- const DEFAULT_PATH = {
5871
- components: "./components",
5872
- hooks: "./hooks",
5873
- monorepo: "./workspaces/ui",
5874
- polyrepo: "./components/ui",
5875
- providers: "./providers"
5876
- };
5877
- const SECTION_NAMES = [
5878
- "components",
5879
- "hooks",
5880
- "providers"
5881
- ];
5882
- const DEFAULT_CONFIG = {
5883
- $schema: `${REGISTRY_URL}/config.schema.json`,
5884
- components: { overwrite: true },
5885
- hooks: { overwrite: true },
5886
- providers: { overwrite: true }
5887
- };
5888
- const REQUIRED_DEPENDENCIES = ["react@^19", "react-dom@^19"];
5889
- const REQUIRED_DEV_DEPENDENCIES = ["@types/react@^19", "@types/react-dom@^19"];
5890
- const DEFAULT_PACKAGE_JSON = {
5891
- version: "1.0.0",
5892
- type: "module",
5893
- private: true,
5894
- scripts: {},
5895
- dependencies: Object.fromEntries(REQUIRED_DEPENDENCIES.map((dependency) => splitVersion(dependency))),
5896
- devDependencies: Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.map((dependency) => splitVersion(dependency)))
5897
- };
5898
- const DEFAULT_PACKAGE_JSON_EXPORTS = {
5899
- TSX: {
5900
- ".": "./src/index.ts",
5901
- "./components/*": "./src/components/*/index.ts",
5902
- "./hooks/*": "./src/hooks/*/index.ts",
5903
- "./providers/*": "./src/providers/*/index.ts"
5904
- },
5905
- JSX: {
5906
- ".": "./src/index.js",
5907
- "./components/*": "./src/components/*/index.js",
5908
- "./hooks/*": "./src/hooks/*/index.js",
5909
- "./providers/*": "./src/providers/*/index.js"
5910
- }
5911
- };
5912
- const TSCONFIG_JSON = {
5913
- compilerOptions: {
5914
- target: "ESNext",
5915
- module: "ESNext",
5916
- lib: [
5917
- "DOM",
5918
- "DOM.Iterable",
5919
- "ESNext"
5920
- ],
5921
- moduleResolution: "Bundler",
5922
- moduleDetection: "force",
5923
- jsx: "preserve",
5924
- strict: true,
5925
- declaration: true,
5926
- declarationMap: true,
5927
- esModuleInterop: true,
5928
- isolatedModules: true,
5929
- resolveJsonModule: true,
5930
- incremental: false,
5931
- noEmit: true,
5932
- skipLibCheck: true,
5933
- allowJs: true,
5934
- allowSyntheticDefaultImports: true,
5935
- noUncheckedSideEffectImports: true,
5936
- noFallthroughCasesInSwitch: true,
5937
- noUncheckedIndexedAccess: true
5938
- },
5939
- include: ["src/**/*.ts", "src/**/*.tsx"],
5940
- exclude: ["node_modules"]
5941
- };
5942
-
5943
5991
  //#endregion
5944
5992
  //#region src/commands/add/index.ts
5945
5993
  const add = new Command("add").description("add a component to your project").argument("[components...]", "components to add").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-o, --overwrite", "overwrite existing files.", false).option("-i, --install", "install dependencies", false).option("-s, --sequential", "run tasks sequentially.", false).option("-f, --format", "format the output files.").option("-l, --lint", "lint the output files.").action(async function(componentNames, { config: configPath, cwd: cwd$3, format: format$2, install, lint, overwrite, sequential }) {
@@ -5965,7 +6013,7 @@ const add = new Command("add").description("add a component to your project").ar
5965
6013
  message: c.reset(`Add all available components?`)
5966
6014
  });
5967
6015
  if (!proceed) process.exit(0);
5968
- if (!overwrite && existsSync(config$1.srcPath)) {
6016
+ if (!overwrite && existsSync(config$1.paths.ui.src)) {
5969
6017
  const { overwrite: overwrite$1 } = await prompts({
5970
6018
  type: "confirm",
5971
6019
  name: "overwrite",
@@ -6077,11 +6125,11 @@ const add = new Command("add").description("add a component to your project").ar
6077
6125
  });
6078
6126
  }
6079
6127
  const indexFileName = transformExtension("index.ts", config$1.jsx);
6080
- if (existsSync(config$1.indexPath)) tasks.add({
6128
+ if (existsSync(config$1.paths.ui.index)) tasks.add({
6081
6129
  task: async (_, task) => {
6082
- let content = await readFile(config$1.indexPath, "utf-8");
6130
+ let content = await readFile(config$1.paths.ui.index, "utf-8");
6083
6131
  content = transformIndex(targetNames, content, config$1);
6084
- await writeFileSafe(config$1.indexPath, content, config$1);
6132
+ await writeFileSafe(config$1.paths.ui.index, content, config$1);
6085
6133
  task.title = `Updated ${c.cyan(indexFileName)}`;
6086
6134
  },
6087
6135
  title: `Updating ${c.cyan(indexFileName)}`
@@ -6091,13 +6139,13 @@ const add = new Command("add").description("add a component to your project").ar
6091
6139
  const { sources: [source] } = await fetchRegistry("index");
6092
6140
  let content = transformIndex(targetNames, source.content, config$1);
6093
6141
  if (config$1.jsx) content = transformTsToJs(content);
6094
- await writeFileSafe(config$1.indexPath, content, config$1);
6142
+ await writeFileSafe(config$1.paths.ui.index, content, config$1);
6095
6143
  task.title = `Generated ${c.cyan(indexFileName)}`;
6096
6144
  },
6097
6145
  title: `Generating ${c.cyan(indexFileName)}`
6098
6146
  });
6099
6147
  if (dependencies$1.length) {
6100
- const targetPath = config$1.monorepo ? config$1.rootPath : cwd$3;
6148
+ const targetPath = config$1.monorepo ? config$1.paths.ui.root : cwd$3;
6101
6149
  spinner.start(`Checking ${c.cyan("package.json")} dependencies`);
6102
6150
  const packageJson$2 = await getPackageJson(targetPath);
6103
6151
  const notInstalledDependencies = getNotInstalledDependencies(packageJson$2, dependencies$1);
@@ -6132,7 +6180,7 @@ const add = new Command("add").description("add a component to your project").ar
6132
6180
  //#region src/commands/update/print-conflicts.ts
6133
6181
  function printConflicts(conflictMap, config$1) {
6134
6182
  Object.entries(conflictMap).forEach(([name$1, files$1]) => {
6135
- if (name$1 === "index") console.log(`- ${c.yellow(transformExtension("index.ts", config$1.jsx))}: ${config$1.indexPath.replace(`${config$1.cwd}/`, "")}`);
6183
+ if (name$1 === "index") console.log(`- ${c.yellow(transformExtension("index.ts", config$1.jsx))}: ${config$1.paths.ui.index.replace(`${config$1.cwd}/`, "")}`);
6136
6184
  else {
6137
6185
  console.log(`- ${name$1}`);
6138
6186
  Object.entries(files$1).forEach(([fileName, path$9]) => {
@@ -6145,7 +6193,7 @@ function printConflicts(conflictMap, config$1) {
6145
6193
  //#endregion
6146
6194
  //#region src/commands/diff/get-diff.ts
6147
6195
  function getDirPath(section, name$1, config$1) {
6148
- return config$1.isSection(section) ? path$1.join(config$1.getSectionResolvedPath(section), name$1) : section === "theme" ? config$1.theme.path : config$1.srcPath;
6196
+ return config$1.isSection(section) ? path$1.join(config$1.getSectionResolvedPath(section), name$1) : config$1.paths[section === "theme" ? "theme" : "ui"].src;
6149
6197
  }
6150
6198
  async function getDiff(generatedNames, { locale, remote }, config$1, concurrent = true) {
6151
6199
  const changeMap = {};
@@ -6338,17 +6386,17 @@ async function updateFiles(changeMap, { add: add$1, remove, update: update$1 },
6338
6386
  const dirPath = getDirPath(registry.section, componentName, config$1);
6339
6387
  try {
6340
6388
  if (componentName === "index") {
6341
- const name$1 = config$1.indexPath.split("/").at(-1);
6389
+ const name$1 = config$1.paths.ui.index.split("/").at(-1);
6342
6390
  const data = changes[name$1];
6343
6391
  if (!("locale" in data && "remote" in data)) return;
6344
6392
  const remotePath = path$1.join(tempDirPath, `remote-${name$1}`);
6345
6393
  const localePath = path$1.join(tempDirPath, `locale-${name$1}`);
6346
6394
  await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(localePath, data.locale, disabledFormatAndLint)]);
6347
- const { conflict, content: mergedContent } = await mergeContent(remotePath, localePath, config$1.indexPath, data.remote);
6348
- await writeFileSafe(config$1.indexPath, mergedContent, conflict ? merge(config$1, disabledFormatAndLint) : config$1);
6395
+ const { conflict, content: mergedContent } = await mergeContent(remotePath, localePath, config$1.paths.ui.index, data.remote);
6396
+ await writeFileSafe(config$1.paths.ui.index, mergedContent, conflict ? merge(config$1, disabledFormatAndLint) : config$1);
6349
6397
  if (conflict) {
6350
6398
  conflictMap[componentName] ??= {};
6351
- conflictMap[componentName][name$1] = config$1.indexPath;
6399
+ conflictMap[componentName][name$1] = config$1.paths.ui.index;
6352
6400
  }
6353
6401
  } else await Promise.all(Object.entries(changes).map(async ([name$1, { ...data }]) => {
6354
6402
  const currentPath = path$1.join(dirPath, name$1);
@@ -6382,7 +6430,7 @@ async function updateFiles(changeMap, { add: add$1, remove, update: update$1 },
6382
6430
  });
6383
6431
  if (!install$1) return conflictMap;
6384
6432
  }
6385
- const cwd$3 = config$1.monorepo ? config$1.rootPath : config$1.cwd;
6433
+ const cwd$3 = config$1.monorepo ? config$1.paths.ui.root : config$1.cwd;
6386
6434
  remove.push(...update$1.map(({ name: name$1 }) => name$1));
6387
6435
  add$1.push(...update$1.map(getPackageNameWithVersion));
6388
6436
  if (remove.length) await uninstallDependencies(remove.map(getPackageName), { cwd: cwd$3 });
@@ -6412,8 +6460,8 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
6412
6460
  const tasks = new Listr([], { concurrent });
6413
6461
  if (index) tasks.add([{
6414
6462
  task: async (_, task) => {
6415
- fileMap.index = { [transformExtension("index.ts", config$1.jsx)]: await readFile(config$1.indexPath, "utf-8") };
6416
- registryMap.locale.index = await fetchLocaleRegistry(config$1.registryPath);
6463
+ fileMap.index = { [transformExtension("index.ts", config$1.jsx)]: await readFile(config$1.paths.ui.index, "utf-8") };
6464
+ registryMap.locale.index = await fetchLocaleRegistry(config$1.paths.ui.registry);
6417
6465
  task.title = `Got ${c.cyan("index")} file`;
6418
6466
  },
6419
6467
  title: `Getting ${c.cyan("index")} file`
@@ -6427,7 +6475,7 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
6427
6475
  if (theme$1) tasks.add([{
6428
6476
  task: async (_, task) => {
6429
6477
  if (!config$1.theme?.path) return;
6430
- const { dirPath, files: files$1 } = await getFiles(config$1.theme.path);
6478
+ const { dirPath, files: files$1 } = await getFiles(config$1.paths.theme.src);
6431
6479
  fileMap.theme = files$1;
6432
6480
  registryMap.locale.theme = await fetchLocaleRegistry(path$1.posix.join(dirPath, REGISTRY_FILE_NAME));
6433
6481
  task.title = `Got ${c.cyan("theme")} files`;
@@ -6442,7 +6490,7 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
6442
6490
  }]);
6443
6491
  tasks.add(componentNames.map((componentName) => [{
6444
6492
  task: async (_, task) => {
6445
- const { dirPath, files: files$1 } = await getFiles(path$1.posix.join(config$1.srcPath, "**", componentName));
6493
+ const { dirPath, files: files$1 } = await getFiles(path$1.posix.join(config$1.paths.ui.src, "**", componentName));
6446
6494
  fileMap[componentName] = files$1;
6447
6495
  registryMap.locale[componentName] = await fetchLocaleRegistry(path$1.posix.join(dirPath, REGISTRY_FILE_NAME));
6448
6496
  task.title = `Got ${c.cyan(componentName)} files`;
@@ -6531,7 +6579,7 @@ const diff = new Command("diff").description("check for updates against the regi
6531
6579
  const componentNames = [];
6532
6580
  const generatedNameMap = await getGeneratedNameMap(config$1);
6533
6581
  const generatedNames = Object.values(generatedNameMap).flat();
6534
- const existsTheme = !!config$1.theme?.path && existsSync(config$1.theme.path);
6582
+ const existsTheme = !!config$1.theme?.path && existsSync(config$1.paths.theme.src);
6535
6583
  let index = targetName === "index";
6536
6584
  let theme$1 = targetName === "theme";
6537
6585
  spinner.succeed("Got generated components");
@@ -6630,13 +6678,13 @@ const init = new Command("init").description("initialize your project and instal
6630
6678
  {
6631
6679
  type: "text",
6632
6680
  name: "outdir",
6633
- initial: (_, { monorepo: monorepo$1 }) => monorepo$1 ? DEFAULT_PATH.monorepo : DEFAULT_PATH.polyrepo,
6681
+ initial: (_, { monorepo: monorepo$1 }) => monorepo$1 ? DEFAULT_PATH.ui.monorepo : DEFAULT_PATH.ui.polyrepo,
6634
6682
  message: (_, { monorepo: monorepo$1 }) => monorepo$1 ? c.reset(`What is the path to the monorepo?`) : c.reset(`What is the path to the directory?`)
6635
6683
  },
6636
6684
  {
6637
6685
  type: (_, { monorepo: monorepo$1 }) => monorepo$1 ? "text" : null,
6638
6686
  name: "packageName",
6639
- initial: DEFAULT_PACKAGE_NAME,
6687
+ initial: DEFAULT_PACKAGE_NAME.ui,
6640
6688
  message: c.reset("What is the package name?")
6641
6689
  },
6642
6690
  {
@@ -6665,7 +6713,7 @@ const init = new Command("init").description("initialize your project and instal
6665
6713
  }
6666
6714
  ]);
6667
6715
  outdir = outdir.replace(/\x17/g, "").trim();
6668
- outdir ||= monorepo ? DEFAULT_PATH.monorepo : DEFAULT_PATH.polyrepo;
6716
+ outdir ||= monorepo ? DEFAULT_PATH.ui.monorepo : DEFAULT_PATH.ui.polyrepo;
6669
6717
  packageName = packageName.replace(/\x17/g, "").trim();
6670
6718
  packageName ||= DEFAULT_PACKAGE_NAME;
6671
6719
  if (monorepo) config$1.monorepo = monorepo;
@@ -6717,10 +6765,14 @@ const init = new Command("init").description("initialize your project and instal
6717
6765
  {
6718
6766
  task: async (_, task) => {
6719
6767
  const targetPath = path$1.resolve(outdirPath, "package.json");
6768
+ const defaultExports = DEFAULT_PACKAGE_JSON_EXPORTS.ui[jsx ? "jsx" : "tsx"];
6769
+ const exports$2 = src ? defaultExports : Object.fromEntries(Object.entries(defaultExports).map(([key, value]) => [key, value.replace(/src\//, "")]));
6720
6770
  const content = JSON.stringify({
6721
6771
  name: packageName,
6722
6772
  ...DEFAULT_PACKAGE_JSON,
6723
- exports: DEFAULT_PACKAGE_JSON_EXPORTS[jsx ? "JSX" : "TSX"]
6773
+ dependencies: Object.fromEntries(REQUIRED_DEPENDENCIES.ui.map((dependency) => splitVersion(dependency))),
6774
+ devDependencies: Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.ui.map((dependency) => splitVersion(dependency))),
6775
+ exports: exports$2
6724
6776
  });
6725
6777
  await writeFileSafe(targetPath, content, merge(config$1, { format: { parser: "json" } }));
6726
6778
  task.title = `Generated ${c.cyan("package.json")}`;
@@ -6752,7 +6804,9 @@ const init = new Command("init").description("initialize your project and instal
6752
6804
  if (!jsx) tasks.add({
6753
6805
  task: async (_, task) => {
6754
6806
  const targetPath = path$1.resolve(outdirPath, "tsconfig.json");
6755
- const content = JSON.stringify({ ...TSCONFIG_JSON });
6807
+ const tsconfig = { ...TSCONFIG_JSON };
6808
+ if (!src) tsconfig.include = tsconfig.include.map((value) => value.replace(/src\//, ""));
6809
+ const content = JSON.stringify(tsconfig);
6756
6810
  await writeFileSafe(targetPath, content, merge(config$1, { format: { parser: "json" } }));
6757
6811
  task.title = `Generated ${c.cyan("tsconfig.json")}`;
6758
6812
  },
@@ -6772,8 +6826,8 @@ const init = new Command("init").description("initialize your project and instal
6772
6826
  await new Listr([{
6773
6827
  task: async (_, task) => {
6774
6828
  const packageJson$2 = await getPackageJson(cwd$3);
6775
- notInstalledDependencies.push(...getNotInstalledDependencies(packageJson$2, [...REQUIRED_DEPENDENCIES, "@yamada-ui/react@dev"]));
6776
- notInstalledDevDependencies.push(...getNotInstalledDependencies(packageJson$2, REQUIRED_DEV_DEPENDENCIES));
6829
+ notInstalledDependencies.push(...getNotInstalledDependencies(packageJson$2, [...REQUIRED_DEPENDENCIES.ui, "@yamada-ui/react@dev"]));
6830
+ notInstalledDevDependencies.push(...getNotInstalledDependencies(packageJson$2, REQUIRED_DEV_DEPENDENCIES.ui));
6777
6831
  task.title = `Checked ${c.cyan("package.json")} dependencies`;
6778
6832
  },
6779
6833
  title: `Checking ${c.cyan("package.json")} dependencies`
@@ -6848,9 +6902,45 @@ const theme = new Command("theme").description("generate theme to your project")
6848
6902
  jsx: js,
6849
6903
  lint
6850
6904
  });
6851
- const resolvedPath = themePath ? path$1.resolve(cwd$3, themePath) : config$1.theme?.path ?? path$1.resolve(cwd$3, THEME_PATH);
6852
6905
  spinner.succeed("Fetched config");
6853
- if (!overwrite && existsSync(resolvedPath)) {
6906
+ themePath ??= config$1.theme?.path;
6907
+ const defaultThemePath = config$1.monorepo ? DEFAULT_PATH.theme.monorepo : DEFAULT_PATH.theme.polyrepo;
6908
+ if (!themePath) {
6909
+ let { outdir = "" } = await prompts({
6910
+ type: "text",
6911
+ name: "outdir",
6912
+ initial: defaultThemePath,
6913
+ message: "What is the path to the theme directory?"
6914
+ });
6915
+ outdir = outdir.replace(/\x17/g, "").trim();
6916
+ outdir ||= defaultThemePath;
6917
+ themePath = outdir;
6918
+ }
6919
+ const monorepoConfig = {
6920
+ src: false,
6921
+ packageName: ""
6922
+ };
6923
+ if (config$1.monorepo) {
6924
+ let { src = true, packageName = "" } = await prompts([{
6925
+ type: "text",
6926
+ name: "packageName",
6927
+ initial: DEFAULT_PACKAGE_NAME.theme,
6928
+ message: c.reset("What is the package name?")
6929
+ }, {
6930
+ type: "toggle",
6931
+ name: "src",
6932
+ active: "Yes",
6933
+ inactive: "No",
6934
+ initial: true,
6935
+ message: c.reset("Would you like your code inside a `src/` directory?")
6936
+ }]);
6937
+ packageName = packageName.replace(/\x17/g, "").trim();
6938
+ packageName ||= DEFAULT_PACKAGE_NAME.theme;
6939
+ monorepoConfig.src = src;
6940
+ monorepoConfig.packageName = packageName;
6941
+ }
6942
+ const outdirPath = path$1.resolve(cwd$3, themePath);
6943
+ if (!overwrite && existsSync(outdirPath)) {
6854
6944
  const { overwrite: overwrite$1 } = await prompts({
6855
6945
  type: "confirm",
6856
6946
  name: "overwrite",
@@ -6859,21 +6949,21 @@ const theme = new Command("theme").description("generate theme to your project")
6859
6949
  });
6860
6950
  if (!overwrite$1) process.exit(0);
6861
6951
  spinner.start("Clearing directory");
6862
- await rimraf(resolvedPath);
6952
+ await rimraf(outdirPath);
6863
6953
  spinner.succeed("Cleared directory");
6864
6954
  }
6865
6955
  spinner.start("Fetching registry");
6866
6956
  const registry = await fetchRegistry("theme");
6867
6957
  spinner.succeed("Fetched registry");
6868
- await new Listr([{
6958
+ const tasks = new Listr([{
6869
6959
  task: async (_, task) => {
6960
+ const targetPath = path$1.resolve(outdirPath, monorepoConfig.src ? "src" : "");
6870
6961
  await Promise.all([...registry.sources.map(async ({ name: name$1, content }) => {
6871
6962
  if (!content) return;
6872
6963
  name$1 = transformExtension(name$1, config$1.jsx);
6873
- const targetPath = path$1.resolve(resolvedPath, name$1);
6874
6964
  if (config$1.jsx) content = isTsx(name$1) ? transformTsxToJsx(content) : transformTsToJs(content);
6875
- await writeFileSafe(targetPath, content, config$1);
6876
- }), writeFileSafe(path$1.resolve(resolvedPath, REGISTRY_FILE_NAME), JSON.stringify(registry), merge(config$1, { format: { parser: "json" } }))]);
6965
+ await writeFileSafe(path$1.resolve(targetPath, name$1), content, config$1);
6966
+ }), writeFileSafe(path$1.resolve(targetPath, REGISTRY_FILE_NAME), JSON.stringify(registry), merge(config$1, { format: { parser: "json" } }))]);
6877
6967
  task.title = `Generated theme`;
6878
6968
  },
6879
6969
  title: `Generating theme`
@@ -6883,12 +6973,68 @@ const theme = new Command("theme").description("generate theme to your project")
6883
6973
  const data = await readFile(targetPath, "utf-8");
6884
6974
  const userConfig = JSON.parse(data);
6885
6975
  userConfig.theme ??= {};
6886
- userConfig.theme.path ??= themePath ?? THEME_PATH;
6976
+ userConfig.theme.path ??= themePath;
6887
6977
  await writeFileSafe(targetPath, JSON.stringify(userConfig), merge(config$1, { format: { parser: "json" } }));
6888
6978
  task.title = `Updated config`;
6889
6979
  },
6890
6980
  title: `Updating config`
6891
- }], { concurrent: true }).run();
6981
+ }], { concurrent: true });
6982
+ if (config$1.monorepo) tasks.add({
6983
+ task: async (_, task) => {
6984
+ const targetPath = path$1.resolve(outdirPath, "package.json");
6985
+ const defaultExports = DEFAULT_PACKAGE_JSON_EXPORTS.theme[config$1.jsx ? "jsx" : "tsx"];
6986
+ const exports$2 = monorepoConfig.src ? defaultExports : Object.fromEntries(Object.entries(defaultExports).map(([key, value]) => [key, value.replace(/src\//, "")]));
6987
+ const content = JSON.stringify({
6988
+ name: monorepoConfig.packageName,
6989
+ ...DEFAULT_PACKAGE_JSON,
6990
+ dependencies: Object.fromEntries(REQUIRED_DEPENDENCIES.theme.map((dependency) => splitVersion(dependency))),
6991
+ devDependencies: Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.theme.map((dependency) => splitVersion(dependency))),
6992
+ exports: exports$2
6993
+ });
6994
+ await writeFileSafe(targetPath, content, merge(config$1, { format: { parser: "json" } }));
6995
+ task.title = `Generated ${c.cyan("package.json")}`;
6996
+ },
6997
+ title: `Generating ${c.cyan("package.json")}`
6998
+ });
6999
+ if (!config$1.jsx) tasks.add({
7000
+ task: async (_, task) => {
7001
+ const targetPath = path$1.resolve(outdirPath, "tsconfig.json");
7002
+ const tsconfig = { ...TSCONFIG_JSON };
7003
+ if (!monorepoConfig.src) tsconfig.include = tsconfig.include.map((value) => value.replace(/src\//, ""));
7004
+ const content = JSON.stringify(tsconfig);
7005
+ await writeFileSafe(targetPath, content, merge(config$1, { format: { parser: "json" } }));
7006
+ task.title = `Generated ${c.cyan("tsconfig.json")}`;
7007
+ },
7008
+ title: `Generating ${c.cyan("tsconfig.json")}`
7009
+ });
7010
+ await tasks.run();
7011
+ if (config$1.monorepo) {
7012
+ const { install } = await prompts({
7013
+ type: "confirm",
7014
+ name: "install",
7015
+ initial: true,
7016
+ message: c.reset(`The theme is generated. Do you want to install dependencies?`)
7017
+ });
7018
+ if (install) {
7019
+ spinner.start("Installing dependencies");
7020
+ await installDependencies([], { cwd: cwd$3 });
7021
+ await installDependencies(["@yamada-ui/react@dev"], { cwd: outdirPath });
7022
+ spinner.succeed("Installed dependencies");
7023
+ }
7024
+ const packageManager = getPackageManager();
7025
+ const args = packageAddArgs(packageManager);
7026
+ console.log("");
7027
+ console.log(boxen([
7028
+ "Run",
7029
+ c.cyan(`${packageManager} ${args.join(" ")} "${monorepoConfig.packageName}@workspace:*"`),
7030
+ "in your application."
7031
+ ].join(" "), {
7032
+ borderColor: "yellow",
7033
+ borderStyle: "round",
7034
+ padding: 1,
7035
+ textAlignment: "center"
7036
+ }));
7037
+ }
6892
7038
  end();
6893
7039
  } catch (e) {
6894
7040
  if (e instanceof Error) spinner.fail(e.message);
@@ -7099,7 +7245,7 @@ const tokens = new Command("tokens").description("generate theme typings").argum
7099
7245
  format: format$2,
7100
7246
  lint
7101
7247
  });
7102
- if (config$1.theme?.path) inputPath ??= path$1.resolve(cwd$3, config$1.theme.path, "index.ts");
7248
+ if (config$1.theme?.path) inputPath ??= config$1.paths.theme.index;
7103
7249
  spinner.succeed("Fetched config");
7104
7250
  }
7105
7251
  if (!inputPath) throw new Error("No input path provided");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yamada-ui/cli",
3
3
  "type": "module",
4
- "version": "2.0.0-dev-20251006155644",
4
+ "version": "2.0.0-dev-20251007054727",
5
5
  "description": "The official CLI for Yamada UI projects",
6
6
  "keywords": [
7
7
  "theme",
@@ -38,17 +38,17 @@
38
38
  "dependencies": {
39
39
  "boxen": "^8.0.1",
40
40
  "cli-check-node": "^1.3.4",
41
- "commander": "^14.0.0",
41
+ "commander": "^14.0.1",
42
42
  "diff": "^8.0.2",
43
- "esbuild": "^0.25.9",
44
- "eslint": "^9.35.0",
43
+ "esbuild": "^0.25.10",
44
+ "eslint": "^9.37.0",
45
45
  "execa": "9.3.1",
46
46
  "glob": "^11.0.3",
47
47
  "https-proxy-agent": "^7.0.6",
48
- "listr2": "^9.0.3",
48
+ "listr2": "^9.0.4",
49
49
  "node-eval": "^2.0.0",
50
50
  "node-fetch": "^3.3.2",
51
- "ora": "^8.2.0",
51
+ "ora": "^9.0.0",
52
52
  "picocolors": "^1.1.1",
53
53
  "prettier": "^3.6.2",
54
54
  "prompts": "^2.4.2",
@@ -65,8 +65,8 @@
65
65
  "@types/update-notifier": "6.0.8",
66
66
  "@types/validate-npm-package-name": "^4.0.2",
67
67
  "@types/yamljs": "^0.2.34",
68
- "tsx": "^4.20.5",
69
- "typescript": "^5.9.2",
68
+ "tsx": "^4.20.6",
69
+ "typescript": "^5.9.3",
70
70
  "update-notifier": "^7.3.1"
71
71
  },
72
72
  "scripts": {