@yamada-ui/cli 2.0.9 → 2.0.10-dev-20260305230416
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.
- package/dist/index.mjs +49 -49
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -5544,7 +5544,7 @@ var package_default = {
|
|
|
5544
5544
|
"diff": "^8.0.3",
|
|
5545
5545
|
"esbuild": "^0.27.3",
|
|
5546
5546
|
"eslint": "^9.39.3",
|
|
5547
|
-
"execa": "9.
|
|
5547
|
+
"execa": "9.6.1",
|
|
5548
5548
|
"glob": "^13.0.6",
|
|
5549
5549
|
"https-proxy-agent": "^7.0.6",
|
|
5550
5550
|
"listr2": "^10.2.1",
|
|
@@ -6132,7 +6132,7 @@ async function fetchRegistries(names, config$1, { cache = true, dependencies: wi
|
|
|
6132
6132
|
await fetch$1(names);
|
|
6133
6133
|
return results;
|
|
6134
6134
|
}
|
|
6135
|
-
async function
|
|
6135
|
+
async function fetchLocalRegistry(path$9) {
|
|
6136
6136
|
return JSON.parse(await readFile(path$9, "utf-8"));
|
|
6137
6137
|
}
|
|
6138
6138
|
async function getGeneratedNameMap(config$1) {
|
|
@@ -6459,7 +6459,7 @@ function printConflicts(conflictMap, config$1) {
|
|
|
6459
6459
|
function getDirPath(section, name$1, config$1) {
|
|
6460
6460
|
return config$1.isSection(section) ? path$1.join(config$1.getSectionResolvedPath(section), name$1) : config$1.paths[section === "theme" ? "theme" : "ui"].src;
|
|
6461
6461
|
}
|
|
6462
|
-
async function getDiff(generatedNames, {
|
|
6462
|
+
async function getDiff(generatedNames, { local, remote }, config$1, concurrent = true) {
|
|
6463
6463
|
const changeMap = {};
|
|
6464
6464
|
const dependencyMap = {
|
|
6465
6465
|
add: [],
|
|
@@ -6468,29 +6468,29 @@ async function getDiff(generatedNames, { locale, remote }, config$1, concurrent
|
|
|
6468
6468
|
};
|
|
6469
6469
|
await new Listr(Object.entries(remote).map(([componentName, { dependencies: dependencies$1, section, sources }]) => ({
|
|
6470
6470
|
task: async (_, task) => {
|
|
6471
|
-
const
|
|
6471
|
+
const localRegistry = local[componentName];
|
|
6472
6472
|
if (componentName === "index") {
|
|
6473
6473
|
const [source] = sources;
|
|
6474
6474
|
const fileName = transformExtension(source.name, config$1.jsx);
|
|
6475
|
-
const [remote$1,
|
|
6476
|
-
const diff$1 = diffLines(
|
|
6475
|
+
const [remote$1, local$1] = await Promise.all([transformIndexWithFormatAndLint(source.content, config$1, generatedNames), transformIndexWithFormatAndLint(localRegistry.sources[0].content, config$1, generatedNames)]);
|
|
6476
|
+
const diff$1 = diffLines(local$1, remote$1);
|
|
6477
6477
|
if (diff$1.length < 2) return;
|
|
6478
6478
|
changeMap[componentName] ??= {};
|
|
6479
6479
|
changeMap[componentName][fileName] = {
|
|
6480
6480
|
diff: diff$1,
|
|
6481
|
-
|
|
6481
|
+
local: local$1,
|
|
6482
6482
|
remote: remote$1
|
|
6483
6483
|
};
|
|
6484
6484
|
} else {
|
|
6485
6485
|
const dirPath = getDirPath(section, componentName, config$1);
|
|
6486
|
-
if (dependencies$1 ||
|
|
6486
|
+
if (dependencies$1 || localRegistry.dependencies) {
|
|
6487
6487
|
const remoteDependencies = dependencies$1?.externals ?? [];
|
|
6488
|
-
const
|
|
6488
|
+
const localDependencies = localRegistry.dependencies?.externals ?? [];
|
|
6489
6489
|
const remotePackageNames = remoteDependencies.map(getPackageName);
|
|
6490
|
-
const
|
|
6491
|
-
const add$1 = remotePackageNames.filter((name$1) => !
|
|
6492
|
-
const remove =
|
|
6493
|
-
const update$1 =
|
|
6490
|
+
const localPackageNames = localDependencies.map(getPackageName);
|
|
6491
|
+
const add$1 = remotePackageNames.filter((name$1) => !localPackageNames.includes(name$1));
|
|
6492
|
+
const remove = localPackageNames.filter((name$1) => !remotePackageNames.includes(name$1));
|
|
6493
|
+
const update$1 = localDependencies.map((name$1) => {
|
|
6494
6494
|
const [packageName, current] = splitVersion(name$1);
|
|
6495
6495
|
const remoteDependency = remoteDependencies.find((name$2) => getPackageName(name$2) === packageName);
|
|
6496
6496
|
if (!remoteDependency) return;
|
|
@@ -6507,17 +6507,17 @@ async function getDiff(generatedNames, { locale, remote }, config$1, concurrent
|
|
|
6507
6507
|
dependencyMap.update.push(...update$1);
|
|
6508
6508
|
}
|
|
6509
6509
|
await Promise.all(sources.map(async ({ name: name$1, content, data, template }) => {
|
|
6510
|
-
const source =
|
|
6510
|
+
const source = localRegistry.sources.find((source$1) => source$1.name === name$1);
|
|
6511
6511
|
name$1 = transformExtension(name$1, config$1.jsx);
|
|
6512
6512
|
const targetPath = path$1.join(dirPath, name$1);
|
|
6513
6513
|
if (content) if (source) {
|
|
6514
|
-
const [remote$1,
|
|
6515
|
-
const diff$1 = diffLines(
|
|
6514
|
+
const [remote$1, local$1] = await Promise.all([transformContentWithFormatAndLint(targetPath, section, content, config$1, generatedNames), transformContentWithFormatAndLint(targetPath, section, source.content, config$1, generatedNames)]);
|
|
6515
|
+
const diff$1 = diffLines(local$1, remote$1);
|
|
6516
6516
|
if (diff$1.length < 2) return;
|
|
6517
6517
|
changeMap[componentName] ??= {};
|
|
6518
6518
|
changeMap[componentName][name$1] = {
|
|
6519
6519
|
diff: diff$1,
|
|
6520
|
-
|
|
6520
|
+
local: local$1,
|
|
6521
6521
|
remote: remote$1
|
|
6522
6522
|
};
|
|
6523
6523
|
} else {
|
|
@@ -6536,18 +6536,18 @@ async function getDiff(generatedNames, { locale, remote }, config$1, concurrent
|
|
|
6536
6536
|
};
|
|
6537
6537
|
}
|
|
6538
6538
|
else if (template && data) await Promise.all(data.map(async ({ name: fileName, ...remoteRest }) => {
|
|
6539
|
-
const
|
|
6539
|
+
const localData = source?.data?.find(({ name: name$2 }) => name$2 === fileName);
|
|
6540
6540
|
fileName = transformExtension(fileName, config$1.jsx);
|
|
6541
|
-
if (
|
|
6541
|
+
if (localData) {
|
|
6542
6542
|
if (template === source?.template) return;
|
|
6543
|
-
const { name: _name, ...
|
|
6544
|
-
const [remote$1,
|
|
6545
|
-
const diff$1 = diffLines(
|
|
6543
|
+
const { name: _name, ...localRest } = localData;
|
|
6544
|
+
const [remote$1, local$1] = await Promise.all([transformContentWithFormatAndLint(path$1.join(targetPath, fileName), section, transformTemplateContent(template, remoteRest), config$1, generatedNames), transformContentWithFormatAndLint(path$1.join(targetPath, fileName), section, transformTemplateContent(source.template, localRest), config$1, generatedNames)]);
|
|
6545
|
+
const diff$1 = diffLines(local$1, remote$1);
|
|
6546
6546
|
if (diff$1.length < 2) return;
|
|
6547
6547
|
changeMap[componentName] ??= {};
|
|
6548
6548
|
changeMap[componentName][`${name$1}/${fileName}`] = {
|
|
6549
6549
|
diff: diff$1,
|
|
6550
|
-
|
|
6550
|
+
local: local$1,
|
|
6551
6551
|
remote: remote$1
|
|
6552
6552
|
};
|
|
6553
6553
|
} else {
|
|
@@ -6567,34 +6567,34 @@ async function getDiff(generatedNames, { locale, remote }, config$1, concurrent
|
|
|
6567
6567
|
}
|
|
6568
6568
|
}));
|
|
6569
6569
|
}));
|
|
6570
|
-
|
|
6570
|
+
localRegistry.sources.filter(({ name: name$1 }) => !sources.some((source) => source.name === name$1)).forEach(({ name: name$1, content, data, template }) => {
|
|
6571
6571
|
if (content) {
|
|
6572
|
-
let
|
|
6573
|
-
if (config$1.jsx)
|
|
6572
|
+
let local$1 = transformContent(section, content, config$1, generatedNames);
|
|
6573
|
+
if (config$1.jsx) local$1 = isJsx(name$1) ? transformTsxToJsx(local$1) : transformTsToJs(local$1);
|
|
6574
6574
|
const diff$1 = [{
|
|
6575
6575
|
added: false,
|
|
6576
|
-
count:
|
|
6576
|
+
count: local$1.length,
|
|
6577
6577
|
removed: true,
|
|
6578
|
-
value:
|
|
6578
|
+
value: local$1
|
|
6579
6579
|
}];
|
|
6580
6580
|
changeMap[componentName] ??= {};
|
|
6581
6581
|
changeMap[componentName][name$1] = {
|
|
6582
6582
|
diff: diff$1,
|
|
6583
|
-
|
|
6583
|
+
local: local$1
|
|
6584
6584
|
};
|
|
6585
6585
|
} else if (template && data) data.forEach(({ name: fileName, ...remoteRest }) => {
|
|
6586
|
-
let
|
|
6587
|
-
if (config$1.jsx)
|
|
6586
|
+
let local$1 = transformContent(section, transformTemplateContent(template, remoteRest), config$1, generatedNames);
|
|
6587
|
+
if (config$1.jsx) local$1 = isJsx(fileName) ? transformTsxToJsx(local$1) : transformTsToJs(local$1);
|
|
6588
6588
|
const diff$1 = [{
|
|
6589
6589
|
added: true,
|
|
6590
|
-
count:
|
|
6590
|
+
count: local$1.length,
|
|
6591
6591
|
removed: false,
|
|
6592
|
-
value:
|
|
6592
|
+
value: local$1
|
|
6593
6593
|
}];
|
|
6594
6594
|
changeMap[componentName] ??= {};
|
|
6595
6595
|
changeMap[componentName][`${name$1}/${fileName}`] = {
|
|
6596
6596
|
diff: diff$1,
|
|
6597
|
-
|
|
6597
|
+
local: local$1
|
|
6598
6598
|
};
|
|
6599
6599
|
});
|
|
6600
6600
|
});
|
|
@@ -6611,14 +6611,14 @@ async function getDiff(generatedNames, { locale, remote }, config$1, concurrent
|
|
|
6611
6611
|
|
|
6612
6612
|
//#endregion
|
|
6613
6613
|
//#region src/commands/update/update-files.ts
|
|
6614
|
-
async function mergeContent(remotePath,
|
|
6614
|
+
async function mergeContent(remotePath, localPath, currentPath, fallback) {
|
|
6615
6615
|
let content = "";
|
|
6616
6616
|
let conflict = false;
|
|
6617
6617
|
try {
|
|
6618
6618
|
const { stdout } = await execa("diff3", [
|
|
6619
6619
|
"-m",
|
|
6620
6620
|
remotePath,
|
|
6621
|
-
|
|
6621
|
+
localPath,
|
|
6622
6622
|
currentPath
|
|
6623
6623
|
]);
|
|
6624
6624
|
content = stdout;
|
|
@@ -6629,7 +6629,7 @@ async function mergeContent(remotePath, localePath, currentPath, fallback) {
|
|
|
6629
6629
|
} else content = fallback;
|
|
6630
6630
|
}
|
|
6631
6631
|
content = content.replaceAll(remotePath, "remote");
|
|
6632
|
-
content = content.replaceAll(
|
|
6632
|
+
content = content.replaceAll(localPath, "local");
|
|
6633
6633
|
content = content.replaceAll(currentPath, "current");
|
|
6634
6634
|
content = content.replace(/\|\|\|\|\|\|\|[\s\S]*?=======/g, "=======");
|
|
6635
6635
|
return {
|
|
@@ -6652,11 +6652,11 @@ async function updateFiles(changeMap, { add: add$1, remove, update: update$1 },
|
|
|
6652
6652
|
if (componentName === "index") {
|
|
6653
6653
|
const name$1 = config$1.paths.ui.index.split("/").at(-1);
|
|
6654
6654
|
const data = changes[name$1];
|
|
6655
|
-
if (!("
|
|
6655
|
+
if (!("local" in data && "remote" in data)) return;
|
|
6656
6656
|
const remotePath = path$1.join(tempDirPath, `remote-${name$1}`);
|
|
6657
|
-
const
|
|
6658
|
-
await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(
|
|
6659
|
-
const { conflict, content: mergedContent } = await mergeContent(remotePath,
|
|
6657
|
+
const localPath = path$1.join(tempDirPath, `local-${name$1}`);
|
|
6658
|
+
await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(localPath, data.local, disabledFormatAndLint)]);
|
|
6659
|
+
const { conflict, content: mergedContent } = await mergeContent(remotePath, localPath, config$1.paths.ui.index, data.remote);
|
|
6660
6660
|
await writeFileSafe(config$1.paths.ui.index, mergedContent, conflict ? merge(config$1, disabledFormatAndLint) : config$1);
|
|
6661
6661
|
if (conflict) {
|
|
6662
6662
|
conflictMap[componentName] ??= {};
|
|
@@ -6664,11 +6664,11 @@ async function updateFiles(changeMap, { add: add$1, remove, update: update$1 },
|
|
|
6664
6664
|
}
|
|
6665
6665
|
} else await Promise.all(Object.entries(changes).map(async ([name$1, { ...data }]) => {
|
|
6666
6666
|
const currentPath = path$1.join(dirPath, name$1);
|
|
6667
|
-
if ("
|
|
6667
|
+
if ("local" in data && "remote" in data) {
|
|
6668
6668
|
const remotePath = path$1.join(tempDirPath, `remote-${name$1}`);
|
|
6669
|
-
const
|
|
6670
|
-
await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(
|
|
6671
|
-
const { conflict, content: mergedContent } = await mergeContent(remotePath,
|
|
6669
|
+
const localPath = path$1.join(tempDirPath, `local-${name$1}`);
|
|
6670
|
+
await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(localPath, data.local, disabledFormatAndLint)]);
|
|
6671
|
+
const { conflict, content: mergedContent } = await mergeContent(remotePath, localPath, currentPath, data.remote);
|
|
6672
6672
|
await writeFileSafe(currentPath, mergedContent, conflict ? merge(config$1, disabledFormatAndLint) : config$1);
|
|
6673
6673
|
if (conflict) {
|
|
6674
6674
|
conflictMap[componentName] ??= {};
|
|
@@ -6718,14 +6718,14 @@ async function validateDiff3() {
|
|
|
6718
6718
|
async function getRegistriesAndFiles(componentNames, config$1, { concurrent = true, index = false, theme: theme$1 = false } = {}) {
|
|
6719
6719
|
const fileMap = {};
|
|
6720
6720
|
const registryMap = {
|
|
6721
|
-
|
|
6721
|
+
local: {},
|
|
6722
6722
|
remote: {}
|
|
6723
6723
|
};
|
|
6724
6724
|
const tasks = new Listr([], { concurrent });
|
|
6725
6725
|
if (index) tasks.add([{
|
|
6726
6726
|
task: async (_, task) => {
|
|
6727
6727
|
fileMap.index = { [transformExtension("index.ts", config$1.jsx)]: await readFile(config$1.paths.ui.index, "utf-8") };
|
|
6728
|
-
registryMap.
|
|
6728
|
+
registryMap.local.index = await fetchLocalRegistry(config$1.paths.ui.registry);
|
|
6729
6729
|
task.title = `Got ${c.cyan("index")} file`;
|
|
6730
6730
|
},
|
|
6731
6731
|
title: `Getting ${c.cyan("index")} file`
|
|
@@ -6741,7 +6741,7 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
|
|
|
6741
6741
|
if (!config$1.theme?.path) return;
|
|
6742
6742
|
const { dirPath, files: files$1 } = await getFiles(config$1.paths.theme.src);
|
|
6743
6743
|
fileMap.theme = files$1;
|
|
6744
|
-
registryMap.
|
|
6744
|
+
registryMap.local.theme = await fetchLocalRegistry(path$1.posix.join(dirPath, REGISTRY_FILE_NAME));
|
|
6745
6745
|
task.title = `Got ${c.cyan("theme")} files`;
|
|
6746
6746
|
},
|
|
6747
6747
|
title: `Getting ${c.cyan("theme")} files`
|
|
@@ -6756,7 +6756,7 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
|
|
|
6756
6756
|
task: async (_, task) => {
|
|
6757
6757
|
const { dirPath, files: files$1 } = await getFiles(path$1.posix.join(config$1.paths.ui.src, "**", componentName));
|
|
6758
6758
|
fileMap[componentName] = files$1;
|
|
6759
|
-
registryMap.
|
|
6759
|
+
registryMap.local[componentName] = await fetchLocalRegistry(path$1.posix.join(dirPath, REGISTRY_FILE_NAME));
|
|
6760
6760
|
task.title = `Got ${c.cyan(componentName)} files`;
|
|
6761
6761
|
},
|
|
6762
6762
|
title: `Getting ${c.cyan(componentName)} files`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.10-dev-20260305230416",
|
|
5
5
|
"description": "The official CLI for Yamada UI projects",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"theme",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"diff": "^8.0.3",
|
|
40
40
|
"esbuild": "^0.27.3",
|
|
41
41
|
"eslint": "^9.39.3",
|
|
42
|
-
"execa": "9.
|
|
42
|
+
"execa": "9.6.1",
|
|
43
43
|
"glob": "^13.0.6",
|
|
44
44
|
"https-proxy-agent": "^7.0.6",
|
|
45
45
|
"listr2": "^10.2.1",
|