@yamada-ui/cli 1.2.1 → 1.2.2-dev-20241010145523
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/command/index.js +312 -311
- package/dist/command/theme/index.js +15 -12
- package/dist/command/tokens/create-theme-typings.js +28 -31
- package/dist/command/tokens/index.js +69 -71
- package/dist/command/tokens/resolve-output-path.js +1 -1
- package/dist/index.js +313 -312
- package/dist/utils/assertion.js +1 -1
- package/dist/utils/cli.js +3 -3
- package/dist/utils/fs.js +4 -1
- package/dist/utils/index.js +46 -45
- package/dist/utils/module.js +19 -12
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -33,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.26_@swc+helpers@0.5.5__jiti@2.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.26_@swc+helpers@0.5.5__jiti@2.3.3_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var getImportMetaUrl, importMetaUrl;
|
|
38
38
|
var init_cjs_shims = __esm({
|
|
39
|
-
"../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.26_@swc+helpers@0.5.5__jiti@2.
|
|
39
|
+
"../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.26_@swc+helpers@0.5.5__jiti@2.3.3_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
42
42
|
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
@@ -5919,7 +5919,6 @@ __export(src_exports, {
|
|
|
5919
5919
|
});
|
|
5920
5920
|
module.exports = __toCommonJS(src_exports);
|
|
5921
5921
|
init_cjs_shims();
|
|
5922
|
-
var import_path6 = __toESM(require("path"));
|
|
5923
5922
|
|
|
5924
5923
|
// ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
|
5925
5924
|
init_cjs_shims();
|
|
@@ -6418,6 +6417,7 @@ var source_default = chalk;
|
|
|
6418
6417
|
|
|
6419
6418
|
// src/index.ts
|
|
6420
6419
|
var import_commander = require("commander");
|
|
6420
|
+
var import_path6 = __toESM(require("path"));
|
|
6421
6421
|
|
|
6422
6422
|
// package.json
|
|
6423
6423
|
var package_default = {
|
|
@@ -6474,7 +6474,7 @@ var package_default = {
|
|
|
6474
6474
|
"node-eval": "^2.0.0",
|
|
6475
6475
|
prettier: "^3.3.3",
|
|
6476
6476
|
tar: "^7.4.3",
|
|
6477
|
-
typescript: "^5.6.
|
|
6477
|
+
typescript: "^5.6.3"
|
|
6478
6478
|
},
|
|
6479
6479
|
devDependencies: {
|
|
6480
6480
|
"@types/update-notifier": "6.0.8",
|
|
@@ -6486,12 +6486,17 @@ var package_default = {
|
|
|
6486
6486
|
// src/command/index.ts
|
|
6487
6487
|
init_cjs_shims();
|
|
6488
6488
|
|
|
6489
|
-
// src/command/
|
|
6489
|
+
// src/command/theme/index.ts
|
|
6490
6490
|
init_cjs_shims();
|
|
6491
|
-
var import_promises = require("fs/promises");
|
|
6492
|
-
var import_path4 = __toESM(require("path"));
|
|
6493
6491
|
var p = __toESM(require("@clack/prompts"));
|
|
6494
|
-
var
|
|
6492
|
+
var import_dns = __toESM(require("dns"));
|
|
6493
|
+
var import_fs3 = require("fs");
|
|
6494
|
+
var import_promises = require("fs/promises");
|
|
6495
|
+
var import_node_stream = require("stream");
|
|
6496
|
+
var import_promises2 = require("stream/promises");
|
|
6497
|
+
var import_path3 = __toESM(require("path"));
|
|
6498
|
+
var import_tar = require("tar");
|
|
6499
|
+
var import_typescript = require("typescript");
|
|
6495
6500
|
|
|
6496
6501
|
// src/utils/assertion.ts
|
|
6497
6502
|
init_cjs_shims();
|
|
@@ -9065,6 +9070,48 @@ ${source_default.bold.green("Yamada UI CLI")} v${package_default.version} ${sour
|
|
|
9065
9070
|
}).notify({ isGlobal: true });
|
|
9066
9071
|
};
|
|
9067
9072
|
|
|
9073
|
+
// src/utils/module.ts
|
|
9074
|
+
init_cjs_shims();
|
|
9075
|
+
var import_esbuild = require("esbuild");
|
|
9076
|
+
var import_fs = require("fs");
|
|
9077
|
+
var import_node_eval = __toESM(require("node-eval"));
|
|
9078
|
+
var import_vm = require("vm");
|
|
9079
|
+
var getModule = async (file, cwd) => {
|
|
9080
|
+
const result = await (0, import_esbuild.build)({
|
|
9081
|
+
absWorkingDir: cwd,
|
|
9082
|
+
bundle: true,
|
|
9083
|
+
entryPoints: [file],
|
|
9084
|
+
format: "cjs",
|
|
9085
|
+
mainFields: ["module", "main"],
|
|
9086
|
+
metafile: true,
|
|
9087
|
+
outfile: "out.js",
|
|
9088
|
+
platform: "node",
|
|
9089
|
+
sourcemap: false,
|
|
9090
|
+
write: false
|
|
9091
|
+
});
|
|
9092
|
+
const { text: code } = result.outputFiles[0] ?? {};
|
|
9093
|
+
const dependencies = isObject(result.metafile) ? Object.keys(result.metafile.inputs) : [];
|
|
9094
|
+
try {
|
|
9095
|
+
const realFileName = import_fs.realpathSync.native(file);
|
|
9096
|
+
if (!code) throw new Error("code is undefined");
|
|
9097
|
+
const script = new import_vm.Script(code, { filename: realFileName });
|
|
9098
|
+
const mod = { exports: {} };
|
|
9099
|
+
const require2 = (id) => id === realFileName ? mod.exports : require2(id);
|
|
9100
|
+
script.runInThisContext()(mod.exports, require2, mod);
|
|
9101
|
+
return { code, dependencies, mod };
|
|
9102
|
+
} catch {
|
|
9103
|
+
const mod = (0, import_node_eval.default)(code);
|
|
9104
|
+
return { code, dependencies, mod };
|
|
9105
|
+
}
|
|
9106
|
+
};
|
|
9107
|
+
|
|
9108
|
+
// src/utils/object.ts
|
|
9109
|
+
init_cjs_shims();
|
|
9110
|
+
var getObject2 = (obj, path14) => {
|
|
9111
|
+
const keys = path14.split(".");
|
|
9112
|
+
return keys.reduce((obj2, key) => obj2[key] ?? {}, obj);
|
|
9113
|
+
};
|
|
9114
|
+
|
|
9068
9115
|
// src/utils/prettier.ts
|
|
9069
9116
|
init_cjs_shims();
|
|
9070
9117
|
var import_path2 = __toESM(require("path"));
|
|
@@ -9084,47 +9131,233 @@ var prettier = async (content, options) => {
|
|
|
9084
9131
|
}
|
|
9085
9132
|
};
|
|
9086
9133
|
|
|
9087
|
-
// src/utils/
|
|
9134
|
+
// src/utils/fs.ts
|
|
9088
9135
|
init_cjs_shims();
|
|
9089
|
-
var
|
|
9090
|
-
|
|
9091
|
-
|
|
9136
|
+
var import_fs2 = __toESM(require("fs"));
|
|
9137
|
+
var isWriteable = async (directory) => {
|
|
9138
|
+
try {
|
|
9139
|
+
await import_fs2.default.promises.access(
|
|
9140
|
+
directory,
|
|
9141
|
+
("constants" in import_fs2.default ? import_fs2.default.constants : import_fs2.default).W_OK
|
|
9142
|
+
);
|
|
9143
|
+
return true;
|
|
9144
|
+
} catch {
|
|
9145
|
+
return false;
|
|
9146
|
+
}
|
|
9092
9147
|
};
|
|
9093
9148
|
|
|
9094
|
-
// src/
|
|
9095
|
-
|
|
9096
|
-
var
|
|
9097
|
-
var
|
|
9098
|
-
var
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
outfile: "out.js",
|
|
9108
|
-
write: false,
|
|
9109
|
-
bundle: true,
|
|
9110
|
-
sourcemap: false,
|
|
9111
|
-
metafile: true
|
|
9149
|
+
// src/command/theme/index.ts
|
|
9150
|
+
var ORG_NAME = "yamada-ui";
|
|
9151
|
+
var REPO_NAME = "yamada-ui";
|
|
9152
|
+
var DEFAULT_BRANCH_NAME = "main";
|
|
9153
|
+
var isOnline = async () => {
|
|
9154
|
+
return new Promise((resolve) => {
|
|
9155
|
+
import_dns.default.lookup("github.com", (err) => {
|
|
9156
|
+
if (err && err.code === "ENOTFOUND") {
|
|
9157
|
+
resolve(false);
|
|
9158
|
+
} else {
|
|
9159
|
+
resolve(true);
|
|
9160
|
+
}
|
|
9161
|
+
});
|
|
9112
9162
|
});
|
|
9113
|
-
|
|
9114
|
-
|
|
9163
|
+
};
|
|
9164
|
+
var checkHasReact = async (cwd) => {
|
|
9115
9165
|
try {
|
|
9116
|
-
const
|
|
9117
|
-
const
|
|
9118
|
-
|
|
9119
|
-
const require2 = (id) => id === realFileName ? mod.exports : require2(id);
|
|
9120
|
-
script.runInThisContext()(mod.exports, require2, mod);
|
|
9121
|
-
return { mod, code, dependencies };
|
|
9166
|
+
const packageJson3 = await (0, import_promises.readFile)(import_path3.default.join(cwd, "package.json"), "utf-8");
|
|
9167
|
+
const { dependencies, devDependencies } = JSON.parse(packageJson3);
|
|
9168
|
+
return !!dependencies?.["@yamada-ui/react"] || !!devDependencies?.["@yamada-ui/react"];
|
|
9122
9169
|
} catch {
|
|
9123
|
-
|
|
9124
|
-
|
|
9170
|
+
return false;
|
|
9171
|
+
}
|
|
9172
|
+
};
|
|
9173
|
+
var getSource = async (branch) => {
|
|
9174
|
+
if (!await isOnline()) {
|
|
9175
|
+
throw new Error(
|
|
9176
|
+
"No internet connection, please check your connection and try again."
|
|
9177
|
+
);
|
|
9178
|
+
}
|
|
9179
|
+
const url = `https://codeload.github.com/${ORG_NAME}/${REPO_NAME}/tar.gz/${branch}`;
|
|
9180
|
+
const { body } = await fetch(url);
|
|
9181
|
+
if (!body) throw new Error(`Failed to download: ${url}`);
|
|
9182
|
+
return import_node_stream.Readable.fromWeb(body);
|
|
9183
|
+
};
|
|
9184
|
+
var getFileMap = async (cwd, branch) => {
|
|
9185
|
+
const source = await getSource(branch);
|
|
9186
|
+
const fileMap = /* @__PURE__ */ new Map();
|
|
9187
|
+
const targetPath = `${REPO_NAME}-${branch.replace("/", "-")}/packages/theme/src`;
|
|
9188
|
+
const filter = (path14) => {
|
|
9189
|
+
return path14.startsWith(targetPath);
|
|
9190
|
+
};
|
|
9191
|
+
const onReadEntry = (entry) => {
|
|
9192
|
+
if (entry.type !== "Directory") {
|
|
9193
|
+
const filePath = entry.path.replace(`${targetPath}/`, "");
|
|
9194
|
+
let content = "";
|
|
9195
|
+
entry.on("data", (chunk) => {
|
|
9196
|
+
content += chunk.toString();
|
|
9197
|
+
});
|
|
9198
|
+
entry.on("end", () => {
|
|
9199
|
+
fileMap.set(filePath, content);
|
|
9200
|
+
});
|
|
9201
|
+
}
|
|
9202
|
+
};
|
|
9203
|
+
await (0, import_promises2.pipeline)(
|
|
9204
|
+
source,
|
|
9205
|
+
(0, import_tar.t)({
|
|
9206
|
+
cwd,
|
|
9207
|
+
filter,
|
|
9208
|
+
newer: true,
|
|
9209
|
+
strip: 4,
|
|
9210
|
+
onReadEntry
|
|
9211
|
+
})
|
|
9212
|
+
);
|
|
9213
|
+
return fileMap;
|
|
9214
|
+
};
|
|
9215
|
+
var transformSourceFile = (sourceFile) => {
|
|
9216
|
+
const ImportDeclarations = [];
|
|
9217
|
+
const ImportTypeDeclarations = [];
|
|
9218
|
+
const transformer = (context) => (sourceFile2) => {
|
|
9219
|
+
const visitor = (node) => {
|
|
9220
|
+
if ((0, import_typescript.isImportDeclaration)(node)) {
|
|
9221
|
+
const moduleSpecifier = node.moduleSpecifier.getText().slice(1, -1);
|
|
9222
|
+
if (moduleSpecifier.startsWith("@yamada-ui/")) {
|
|
9223
|
+
if (node.importClause?.isTypeOnly) {
|
|
9224
|
+
ImportTypeDeclarations.push(node);
|
|
9225
|
+
} else {
|
|
9226
|
+
ImportDeclarations.push(node);
|
|
9227
|
+
}
|
|
9228
|
+
return import_typescript.factory.createEmptyStatement();
|
|
9229
|
+
}
|
|
9230
|
+
}
|
|
9231
|
+
return (0, import_typescript.visitEachChild)(node, visitor, context);
|
|
9232
|
+
};
|
|
9233
|
+
return (0, import_typescript.visitNode)(sourceFile2, visitor);
|
|
9234
|
+
};
|
|
9235
|
+
const { transformed } = (0, import_typescript.transform)(sourceFile, [transformer]);
|
|
9236
|
+
const transformedSourceFile = transformed[0];
|
|
9237
|
+
return { ImportDeclarations, ImportTypeDeclarations, transformedSourceFile };
|
|
9238
|
+
};
|
|
9239
|
+
var createImportDeclaration = (isTypeOnly, declarations) => {
|
|
9240
|
+
const elements = declarations.flatMap(
|
|
9241
|
+
({ importClause: importClause2 }) => importClause2?.namedBindings && (0, import_typescript.isNamedImports)(importClause2.namedBindings) ? importClause2.namedBindings.elements : []
|
|
9242
|
+
);
|
|
9243
|
+
const namedBindings = import_typescript.factory.createNamedImports(elements);
|
|
9244
|
+
const importClause = import_typescript.factory.createImportClause(
|
|
9245
|
+
isTypeOnly,
|
|
9246
|
+
void 0,
|
|
9247
|
+
namedBindings
|
|
9248
|
+
);
|
|
9249
|
+
return import_typescript.factory.createImportDeclaration(
|
|
9250
|
+
void 0,
|
|
9251
|
+
importClause,
|
|
9252
|
+
import_typescript.factory.createStringLiteral("@yamada-ui/react")
|
|
9253
|
+
);
|
|
9254
|
+
};
|
|
9255
|
+
var replaceContent = (content) => {
|
|
9256
|
+
const sourceFile = (0, import_typescript.createSourceFile)(
|
|
9257
|
+
"temp.ts",
|
|
9258
|
+
content,
|
|
9259
|
+
import_typescript.ScriptTarget.Latest,
|
|
9260
|
+
true
|
|
9261
|
+
);
|
|
9262
|
+
const printer = (0, import_typescript.createPrinter)({ newLine: import_typescript.NewLineKind.LineFeed });
|
|
9263
|
+
const { ImportDeclarations, ImportTypeDeclarations, transformedSourceFile } = transformSourceFile(sourceFile);
|
|
9264
|
+
const statements = [...transformedSourceFile.statements];
|
|
9265
|
+
if (ImportTypeDeclarations.length) {
|
|
9266
|
+
const newImportTypeDeclarations = createImportDeclaration(
|
|
9267
|
+
true,
|
|
9268
|
+
ImportTypeDeclarations
|
|
9269
|
+
);
|
|
9270
|
+
statements.unshift(newImportTypeDeclarations);
|
|
9271
|
+
}
|
|
9272
|
+
if (ImportDeclarations.length) {
|
|
9273
|
+
const newImportDeclarations = createImportDeclaration(
|
|
9274
|
+
false,
|
|
9275
|
+
ImportDeclarations
|
|
9276
|
+
);
|
|
9277
|
+
statements.unshift(newImportDeclarations);
|
|
9278
|
+
}
|
|
9279
|
+
const updatedSourceFile = import_typescript.factory.updateSourceFile(
|
|
9280
|
+
transformedSourceFile,
|
|
9281
|
+
statements
|
|
9282
|
+
);
|
|
9283
|
+
let printedContent = printer.printFile(updatedSourceFile);
|
|
9284
|
+
printedContent = printedContent.replace(/^;$/gm, "");
|
|
9285
|
+
printedContent = printedContent.replace(/\s\n*(?=import)/g, "");
|
|
9286
|
+
printedContent = printedContent.replace(/(import .*\n)+(?!import)/, "$&\n");
|
|
9287
|
+
return printedContent;
|
|
9288
|
+
};
|
|
9289
|
+
var replaceIndex = (content) => {
|
|
9290
|
+
const index = content.indexOf("export const baseTheme");
|
|
9291
|
+
content = content.slice(0, index);
|
|
9292
|
+
content = content.replace(/export const baseTheme/, "export const theme");
|
|
9293
|
+
content = content.replace(/\nimport { config } from ".\/config"/, "");
|
|
9294
|
+
content += "\nexport { config } from './config'";
|
|
9295
|
+
return content;
|
|
9296
|
+
};
|
|
9297
|
+
var generateTheme = async (outPath, fileMap, isReactReplace, isForceReplace) => {
|
|
9298
|
+
if (!await isWriteable(import_path3.default.dirname(outPath))) {
|
|
9299
|
+
throw new Error(
|
|
9300
|
+
"The provided path is not writable, please check folder permissions and try again. It is likely you do not have write permissions for this folder."
|
|
9301
|
+
);
|
|
9302
|
+
}
|
|
9303
|
+
await (0, import_promises.mkdir)(outPath, { recursive: true });
|
|
9304
|
+
await Promise.all(
|
|
9305
|
+
[...fileMap.entries()].map(async ([filePath, _content]) => {
|
|
9306
|
+
const targetPath = import_path3.default.join(outPath, filePath);
|
|
9307
|
+
let content = _content;
|
|
9308
|
+
if (filePath === "index.ts") {
|
|
9309
|
+
content = replaceIndex(content);
|
|
9310
|
+
} else {
|
|
9311
|
+
if (isReactReplace) content = replaceContent(content);
|
|
9312
|
+
}
|
|
9313
|
+
const formattedContent = await prettier(content);
|
|
9314
|
+
try {
|
|
9315
|
+
if (!isForceReplace && (0, import_fs3.existsSync)(targetPath)) return;
|
|
9316
|
+
await (0, import_promises.writeFile)(targetPath, formattedContent, "utf-8");
|
|
9317
|
+
} catch (e) {
|
|
9318
|
+
if (e instanceof Error && "code" in e && e.code === "ENOENT") {
|
|
9319
|
+
const dirPath = import_path3.default.dirname(targetPath);
|
|
9320
|
+
await (0, import_promises.mkdir)(dirPath, { recursive: true });
|
|
9321
|
+
if (!isForceReplace && (0, import_fs3.existsSync)(targetPath)) return;
|
|
9322
|
+
await (0, import_promises.writeFile)(targetPath, formattedContent, "utf-8");
|
|
9323
|
+
}
|
|
9324
|
+
}
|
|
9325
|
+
})
|
|
9326
|
+
);
|
|
9327
|
+
};
|
|
9328
|
+
var actionTheme = async (_outPath, { branch = DEFAULT_BRANCH_NAME, cwd, replace = false }) => {
|
|
9329
|
+
p.intro(source_default.magenta(`Generating Yamada UI theme`));
|
|
9330
|
+
const s = p.spinner();
|
|
9331
|
+
try {
|
|
9332
|
+
const start = process.hrtime.bigint();
|
|
9333
|
+
cwd ??= import_path3.default.resolve();
|
|
9334
|
+
const outPath = import_path3.default.join(cwd, _outPath);
|
|
9335
|
+
s.start(`Checking "package.json"`);
|
|
9336
|
+
const hasReact = await checkHasReact(cwd);
|
|
9337
|
+
s.stop(`Checked "package.json"`);
|
|
9338
|
+
s.start(`Downloading the theme`);
|
|
9339
|
+
const fileMap = await getFileMap(outPath, branch);
|
|
9340
|
+
s.stop(`Downloaded the theme`);
|
|
9341
|
+
s.start(`Writing the theme "${outPath}"`);
|
|
9342
|
+
await generateTheme(outPath, fileMap, hasReact, replace);
|
|
9343
|
+
s.stop(`Wrote the theme`);
|
|
9344
|
+
const end = process.hrtime.bigint();
|
|
9345
|
+
const duration = (Number(end - start) / 1e9).toFixed(2);
|
|
9346
|
+
p.outro(`${source_default.green(`Done`)} in ${source_default.dim(`${duration}s`)}
|
|
9347
|
+
`);
|
|
9348
|
+
} catch (e) {
|
|
9349
|
+
s.stop(`An error occurred`, 500);
|
|
9350
|
+
p.cancel(source_default.red(e instanceof Error ? e.message : "Message is missing"));
|
|
9125
9351
|
}
|
|
9126
9352
|
};
|
|
9127
9353
|
|
|
9354
|
+
// src/command/tokens/index.ts
|
|
9355
|
+
init_cjs_shims();
|
|
9356
|
+
var p2 = __toESM(require("@clack/prompts"));
|
|
9357
|
+
var import_chokidar = __toESM(require("chokidar"));
|
|
9358
|
+
var import_promises3 = require("fs/promises");
|
|
9359
|
+
var import_path5 = __toESM(require("path"));
|
|
9360
|
+
|
|
9128
9361
|
// src/command/tokens/create-theme-typings.ts
|
|
9129
9362
|
init_cjs_shims();
|
|
9130
9363
|
|
|
@@ -9163,18 +9396,15 @@ var printComponent = (components) => `components: { ${Object.entries(components)
|
|
|
9163
9396
|
var print = (unions) => Object.entries(unions).sort(([a], [b]) => a.localeCompare(b)).map(
|
|
9164
9397
|
([key, union]) => `${key}: ${union.map((value) => `"${value}"`).concat(["(string & {})"]).join(" | ")};`
|
|
9165
9398
|
).join("\n");
|
|
9166
|
-
var extractComponents = ({ components = {} }) => Object.entries(components).reduce(
|
|
9167
|
-
(
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
},
|
|
9176
|
-
{}
|
|
9177
|
-
);
|
|
9399
|
+
var extractComponents = ({ components = {} }) => Object.entries(components).reduce((obj, [key, { sizes, variants }]) => {
|
|
9400
|
+
if (sizes || variants) {
|
|
9401
|
+
obj[key] = {
|
|
9402
|
+
sizes: Object.keys(sizes ?? {}),
|
|
9403
|
+
variants: Object.keys(variants ?? {})
|
|
9404
|
+
};
|
|
9405
|
+
}
|
|
9406
|
+
return obj;
|
|
9407
|
+
}, {});
|
|
9178
9408
|
var isTone = (value) => {
|
|
9179
9409
|
if (!isObject(value)) return false;
|
|
9180
9410
|
const keys = Object.keys(value);
|
|
@@ -9184,13 +9414,13 @@ var extractColorSchemes = (theme) => {
|
|
|
9184
9414
|
const { colors, semantics } = theme;
|
|
9185
9415
|
let colorSchemes = [];
|
|
9186
9416
|
let colorSchemeColors = [];
|
|
9187
|
-
if (!isObject(colors)) return {
|
|
9417
|
+
if (!isObject(colors)) return { colorSchemeColors, colorSchemes };
|
|
9188
9418
|
Object.entries(colors).forEach(([key, value]) => {
|
|
9189
9419
|
if (!isTone(value)) return;
|
|
9190
9420
|
colorSchemes.push(key);
|
|
9191
9421
|
});
|
|
9192
9422
|
if (!isObject(semantics?.colorSchemes))
|
|
9193
|
-
return {
|
|
9423
|
+
return { colorSchemeColors, colorSchemes };
|
|
9194
9424
|
Object.entries(semantics.colorSchemes).forEach(([key, value]) => {
|
|
9195
9425
|
if (isTone(value)) {
|
|
9196
9426
|
colorSchemes.push(key);
|
|
@@ -9202,7 +9432,7 @@ var extractColorSchemes = (theme) => {
|
|
|
9202
9432
|
colorSchemeColors.push(...TONES.map((tone) => `${key}.${tone}`));
|
|
9203
9433
|
}
|
|
9204
9434
|
});
|
|
9205
|
-
return {
|
|
9435
|
+
return { colorSchemeColors, colorSchemes };
|
|
9206
9436
|
};
|
|
9207
9437
|
var extractThemeSchemes = (theme) => {
|
|
9208
9438
|
const { themeSchemes } = theme;
|
|
@@ -9242,10 +9472,10 @@ var createThemeTypings = async (theme, { responsive = false }) => {
|
|
|
9242
9472
|
const tokens = config.reduce(
|
|
9243
9473
|
(prev, {
|
|
9244
9474
|
key,
|
|
9245
|
-
|
|
9475
|
+
flatMap = (value) => value,
|
|
9246
9476
|
maxScanDepth,
|
|
9247
9477
|
omitScanKeys,
|
|
9248
|
-
|
|
9478
|
+
replaceKey
|
|
9249
9479
|
}) => {
|
|
9250
9480
|
const target = getObject2(theme, key);
|
|
9251
9481
|
prev[replaceKey ?? key] = [];
|
|
@@ -9265,7 +9495,7 @@ var createThemeTypings = async (theme, { responsive = false }) => {
|
|
|
9265
9495
|
omitScanKeys,
|
|
9266
9496
|
shouldProcess
|
|
9267
9497
|
).flatMap(flatMap);
|
|
9268
|
-
prev[replaceKey ?? key]
|
|
9498
|
+
prev[replaceKey ?? key]?.push(...semanticKeys);
|
|
9269
9499
|
}
|
|
9270
9500
|
return prev;
|
|
9271
9501
|
},
|
|
@@ -9273,10 +9503,10 @@ var createThemeTypings = async (theme, { responsive = false }) => {
|
|
|
9273
9503
|
);
|
|
9274
9504
|
const textStyles = extractKeys(theme, "styles.textStyles");
|
|
9275
9505
|
const layerStyles = extractKeys(theme, "styles.layerStyles");
|
|
9276
|
-
const {
|
|
9506
|
+
const { colorSchemeColors, colorSchemes } = extractColorSchemes(theme);
|
|
9277
9507
|
const themeSchemes = extractThemeSchemes(theme);
|
|
9278
9508
|
const components = extractComponents(theme);
|
|
9279
|
-
tokens.colors = [...tokens.colors, ...colorSchemeColors];
|
|
9509
|
+
tokens.colors = [...tokens.colors ?? [], ...colorSchemeColors];
|
|
9280
9510
|
return prettier(
|
|
9281
9511
|
[
|
|
9282
9512
|
`import type { UITheme } from './ui-theme.types'`,
|
|
@@ -9284,9 +9514,9 @@ var createThemeTypings = async (theme, { responsive = false }) => {
|
|
|
9284
9514
|
`export interface GeneratedTheme extends UITheme {`,
|
|
9285
9515
|
print({
|
|
9286
9516
|
...tokens,
|
|
9287
|
-
textStyles,
|
|
9288
|
-
layerStyles,
|
|
9289
9517
|
colorSchemes,
|
|
9518
|
+
layerStyles,
|
|
9519
|
+
textStyles,
|
|
9290
9520
|
themeSchemes
|
|
9291
9521
|
}),
|
|
9292
9522
|
printComponent(components),
|
|
@@ -9297,8 +9527,8 @@ var createThemeTypings = async (theme, { responsive = false }) => {
|
|
|
9297
9527
|
|
|
9298
9528
|
// src/command/tokens/resolve-output-path.ts
|
|
9299
9529
|
init_cjs_shims();
|
|
9300
|
-
var import_path3 = __toESM(require("path"));
|
|
9301
9530
|
var import_glob = require("glob");
|
|
9531
|
+
var import_path4 = __toESM(require("path"));
|
|
9302
9532
|
var themePath = [
|
|
9303
9533
|
"node_modules",
|
|
9304
9534
|
"@yamada-ui",
|
|
@@ -9308,10 +9538,10 @@ var themePath = [
|
|
|
9308
9538
|
];
|
|
9309
9539
|
var resolveThemePath = async () => {
|
|
9310
9540
|
const paths = [
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9541
|
+
import_path4.default.join("node_modules", ".pnpm", "@yamada-ui+core@*", ...themePath),
|
|
9542
|
+
import_path4.default.join(...themePath),
|
|
9543
|
+
import_path4.default.posix.join("node_modules", ".pnpm", "@yamada-ui+core@*", ...themePath),
|
|
9544
|
+
import_path4.default.posix.join(...themePath)
|
|
9315
9545
|
];
|
|
9316
9546
|
const triedPaths = await Promise.all(
|
|
9317
9547
|
paths.map(async (possiblePath) => {
|
|
@@ -9322,10 +9552,10 @@ var resolveThemePath = async () => {
|
|
|
9322
9552
|
);
|
|
9323
9553
|
const resolvedPath = triedPaths.find(Boolean);
|
|
9324
9554
|
if (!resolvedPath) return;
|
|
9325
|
-
return
|
|
9555
|
+
return import_path4.default.resolve(process.cwd(), resolvedPath);
|
|
9326
9556
|
};
|
|
9327
9557
|
var resolveOutputPath = async (outPath) => {
|
|
9328
|
-
if (outPath) return
|
|
9558
|
+
if (outPath) return import_path4.default.resolve(process.cwd(), outPath);
|
|
9329
9559
|
const themePath2 = await resolveThemePath();
|
|
9330
9560
|
if (!themePath2)
|
|
9331
9561
|
throw new Error(
|
|
@@ -9336,12 +9566,12 @@ var resolveOutputPath = async (outPath) => {
|
|
|
9336
9566
|
|
|
9337
9567
|
// src/command/tokens/index.ts
|
|
9338
9568
|
var generateThemeTypings = async ({
|
|
9339
|
-
theme,
|
|
9340
9569
|
config: config2,
|
|
9341
|
-
outFile
|
|
9570
|
+
outFile,
|
|
9571
|
+
theme
|
|
9342
9572
|
}) => {
|
|
9343
|
-
|
|
9344
|
-
const s =
|
|
9573
|
+
p2.intro(source_default.magenta(`Generating Yamada UI theme typings`));
|
|
9574
|
+
const s = p2.spinner();
|
|
9345
9575
|
try {
|
|
9346
9576
|
const start = process.hrtime.bigint();
|
|
9347
9577
|
s.start(`Parsing the theme`);
|
|
@@ -9351,30 +9581,30 @@ var generateThemeTypings = async ({
|
|
|
9351
9581
|
const outPath = await resolveOutputPath(outFile);
|
|
9352
9582
|
s.stop(`Resolved the output path`);
|
|
9353
9583
|
s.start(`Writing file "${outPath}"`);
|
|
9354
|
-
await (0,
|
|
9584
|
+
await (0, import_promises3.writeFile)(outPath, generatedTheme, "utf8");
|
|
9355
9585
|
s.stop(`Wrote file`);
|
|
9356
|
-
|
|
9586
|
+
p2.note(outPath, "Output path");
|
|
9357
9587
|
const end = process.hrtime.bigint();
|
|
9358
9588
|
const duration = (Number(end - start) / 1e9).toFixed(2);
|
|
9359
|
-
|
|
9589
|
+
p2.outro(`${source_default.green(`Done`)} in ${source_default.dim(`${duration}s`)}
|
|
9360
9590
|
`);
|
|
9361
9591
|
} catch (e) {
|
|
9362
9592
|
s.stop(`An error occurred`, 500);
|
|
9363
|
-
|
|
9593
|
+
p2.cancel(source_default.red(e instanceof Error ? e.message : "Message is missing"));
|
|
9364
9594
|
}
|
|
9365
9595
|
};
|
|
9366
|
-
var actionTokens = async (themePath2, { cwd =
|
|
9596
|
+
var actionTokens = async (themePath2, { cwd = import_path5.default.resolve(), out: outFile, watch: watchFile }) => {
|
|
9367
9597
|
const readFile2 = async () => {
|
|
9368
|
-
const filePath =
|
|
9369
|
-
const {
|
|
9598
|
+
const filePath = import_path5.default.resolve(themePath2);
|
|
9599
|
+
const { dependencies: dependencies2, mod } = await getModule(filePath, cwd);
|
|
9370
9600
|
const theme2 = mod?.default ?? mod?.theme ?? mod?.customTheme ?? mod?.defaultTheme ?? {};
|
|
9371
9601
|
const config3 = mod?.config ?? mod?.customConfig ?? mod?.defaultConfig ?? {};
|
|
9372
|
-
return {
|
|
9602
|
+
return { config: config3, dependencies: dependencies2, theme: theme2 };
|
|
9373
9603
|
};
|
|
9374
9604
|
let file = await readFile2();
|
|
9375
|
-
const {
|
|
9605
|
+
const { config: config2, dependencies, theme } = file;
|
|
9376
9606
|
const buildFile = async () => {
|
|
9377
|
-
await generateThemeTypings({
|
|
9607
|
+
await generateThemeTypings({ config: config2, outFile, theme });
|
|
9378
9608
|
if (watchFile) console.log("\n", "\u231B\uFE0F Watching for changes...");
|
|
9379
9609
|
};
|
|
9380
9610
|
if (watchFile) {
|
|
@@ -9389,235 +9619,6 @@ var actionTokens = async (themePath2, { cwd = import_path4.default.resolve(), ou
|
|
|
9389
9619
|
}
|
|
9390
9620
|
};
|
|
9391
9621
|
|
|
9392
|
-
// src/command/theme/index.ts
|
|
9393
|
-
init_cjs_shims();
|
|
9394
|
-
var import_dns = __toESM(require("dns"));
|
|
9395
|
-
var import_fs3 = require("fs");
|
|
9396
|
-
var import_promises2 = require("fs/promises");
|
|
9397
|
-
var import_node_stream = require("stream");
|
|
9398
|
-
var import_promises3 = require("stream/promises");
|
|
9399
|
-
var import_path5 = __toESM(require("path"));
|
|
9400
|
-
var p2 = __toESM(require("@clack/prompts"));
|
|
9401
|
-
var import_tar = require("tar");
|
|
9402
|
-
var import_typescript = require("typescript");
|
|
9403
|
-
|
|
9404
|
-
// src/utils/fs.ts
|
|
9405
|
-
init_cjs_shims();
|
|
9406
|
-
var import_fs2 = __toESM(require("fs"));
|
|
9407
|
-
var isWriteable = async (directory) => {
|
|
9408
|
-
try {
|
|
9409
|
-
await import_fs2.default.promises.access(directory, (import_fs2.default.constants || import_fs2.default).W_OK);
|
|
9410
|
-
return true;
|
|
9411
|
-
} catch {
|
|
9412
|
-
return false;
|
|
9413
|
-
}
|
|
9414
|
-
};
|
|
9415
|
-
|
|
9416
|
-
// src/command/theme/index.ts
|
|
9417
|
-
var ORG_NAME = "yamada-ui";
|
|
9418
|
-
var REPO_NAME = "yamada-ui";
|
|
9419
|
-
var DEFAULT_BRANCH_NAME = "main";
|
|
9420
|
-
var isOnline = () => {
|
|
9421
|
-
return new Promise((resolve) => {
|
|
9422
|
-
import_dns.default.lookup("github.com", (err) => {
|
|
9423
|
-
if (err && err.code === "ENOTFOUND") {
|
|
9424
|
-
resolve(false);
|
|
9425
|
-
} else {
|
|
9426
|
-
resolve(true);
|
|
9427
|
-
}
|
|
9428
|
-
});
|
|
9429
|
-
});
|
|
9430
|
-
};
|
|
9431
|
-
var checkHasReact = async (cwd) => {
|
|
9432
|
-
try {
|
|
9433
|
-
const packageJson3 = await (0, import_promises2.readFile)(import_path5.default.join(cwd, "package.json"), "utf-8");
|
|
9434
|
-
const { dependencies, devDependencies } = JSON.parse(packageJson3);
|
|
9435
|
-
return !!dependencies?.["@yamada-ui/react"] || !!devDependencies?.["@yamada-ui/react"];
|
|
9436
|
-
} catch {
|
|
9437
|
-
return false;
|
|
9438
|
-
}
|
|
9439
|
-
};
|
|
9440
|
-
var getSource = async (branch) => {
|
|
9441
|
-
if (!await isOnline()) {
|
|
9442
|
-
throw new Error(
|
|
9443
|
-
"No internet connection, please check your connection and try again."
|
|
9444
|
-
);
|
|
9445
|
-
}
|
|
9446
|
-
const url = `https://codeload.github.com/${ORG_NAME}/${REPO_NAME}/tar.gz/${branch}`;
|
|
9447
|
-
const { body } = await fetch(url);
|
|
9448
|
-
if (!body) throw new Error(`Failed to download: ${url}`);
|
|
9449
|
-
return import_node_stream.Readable.fromWeb(body);
|
|
9450
|
-
};
|
|
9451
|
-
var getFileMap = async (cwd, branch) => {
|
|
9452
|
-
const source = await getSource(branch);
|
|
9453
|
-
const fileMap = /* @__PURE__ */ new Map();
|
|
9454
|
-
const targetPath = `${REPO_NAME}-${branch.replace("/", "-")}/packages/theme/src`;
|
|
9455
|
-
const filter = (path14) => {
|
|
9456
|
-
return path14.startsWith(targetPath);
|
|
9457
|
-
};
|
|
9458
|
-
const onReadEntry = (entry) => {
|
|
9459
|
-
if (entry.type !== "Directory") {
|
|
9460
|
-
const filePath = entry.path.replace(`${targetPath}/`, "");
|
|
9461
|
-
let content = "";
|
|
9462
|
-
entry.on("data", (chunk) => {
|
|
9463
|
-
content += chunk.toString();
|
|
9464
|
-
});
|
|
9465
|
-
entry.on("end", () => {
|
|
9466
|
-
fileMap.set(filePath, content);
|
|
9467
|
-
});
|
|
9468
|
-
}
|
|
9469
|
-
};
|
|
9470
|
-
await (0, import_promises3.pipeline)(
|
|
9471
|
-
source,
|
|
9472
|
-
(0, import_tar.t)({
|
|
9473
|
-
cwd,
|
|
9474
|
-
filter,
|
|
9475
|
-
onReadEntry,
|
|
9476
|
-
strip: 4,
|
|
9477
|
-
newer: true
|
|
9478
|
-
})
|
|
9479
|
-
);
|
|
9480
|
-
return fileMap;
|
|
9481
|
-
};
|
|
9482
|
-
var transformSourceFile = (sourceFile) => {
|
|
9483
|
-
const ImportDeclarations = [];
|
|
9484
|
-
const ImportTypeDeclarations = [];
|
|
9485
|
-
const transformer = (context) => (sourceFile2) => {
|
|
9486
|
-
const visitor = (node) => {
|
|
9487
|
-
if ((0, import_typescript.isImportDeclaration)(node)) {
|
|
9488
|
-
const moduleSpecifier = node.moduleSpecifier.getText().slice(1, -1);
|
|
9489
|
-
if (moduleSpecifier.startsWith("@yamada-ui/")) {
|
|
9490
|
-
if (node.importClause?.isTypeOnly) {
|
|
9491
|
-
ImportTypeDeclarations.push(node);
|
|
9492
|
-
} else {
|
|
9493
|
-
ImportDeclarations.push(node);
|
|
9494
|
-
}
|
|
9495
|
-
return import_typescript.factory.createEmptyStatement();
|
|
9496
|
-
}
|
|
9497
|
-
}
|
|
9498
|
-
return (0, import_typescript.visitEachChild)(node, visitor, context);
|
|
9499
|
-
};
|
|
9500
|
-
return (0, import_typescript.visitNode)(sourceFile2, visitor);
|
|
9501
|
-
};
|
|
9502
|
-
const { transformed } = (0, import_typescript.transform)(sourceFile, [transformer]);
|
|
9503
|
-
const transformedSourceFile = transformed[0];
|
|
9504
|
-
return { ImportDeclarations, ImportTypeDeclarations, transformedSourceFile };
|
|
9505
|
-
};
|
|
9506
|
-
var createImportDeclaration = (isTypeOnly, declarations) => {
|
|
9507
|
-
const elements = declarations.flatMap(
|
|
9508
|
-
({ importClause: importClause2 }) => importClause2?.namedBindings && (0, import_typescript.isNamedImports)(importClause2.namedBindings) ? importClause2.namedBindings.elements : []
|
|
9509
|
-
);
|
|
9510
|
-
const namedBindings = import_typescript.factory.createNamedImports(elements);
|
|
9511
|
-
const importClause = import_typescript.factory.createImportClause(
|
|
9512
|
-
isTypeOnly,
|
|
9513
|
-
void 0,
|
|
9514
|
-
namedBindings
|
|
9515
|
-
);
|
|
9516
|
-
return import_typescript.factory.createImportDeclaration(
|
|
9517
|
-
void 0,
|
|
9518
|
-
importClause,
|
|
9519
|
-
import_typescript.factory.createStringLiteral("@yamada-ui/react")
|
|
9520
|
-
);
|
|
9521
|
-
};
|
|
9522
|
-
var replaceContent = (content) => {
|
|
9523
|
-
const sourceFile = (0, import_typescript.createSourceFile)(
|
|
9524
|
-
"temp.ts",
|
|
9525
|
-
content,
|
|
9526
|
-
import_typescript.ScriptTarget.Latest,
|
|
9527
|
-
true
|
|
9528
|
-
);
|
|
9529
|
-
const printer = (0, import_typescript.createPrinter)({ newLine: import_typescript.NewLineKind.LineFeed });
|
|
9530
|
-
const { ImportDeclarations, ImportTypeDeclarations, transformedSourceFile } = transformSourceFile(sourceFile);
|
|
9531
|
-
const statements = [...transformedSourceFile.statements];
|
|
9532
|
-
if (ImportTypeDeclarations.length) {
|
|
9533
|
-
const newImportTypeDeclarations = createImportDeclaration(
|
|
9534
|
-
true,
|
|
9535
|
-
ImportTypeDeclarations
|
|
9536
|
-
);
|
|
9537
|
-
statements.unshift(newImportTypeDeclarations);
|
|
9538
|
-
}
|
|
9539
|
-
if (ImportDeclarations.length) {
|
|
9540
|
-
const newImportDeclarations = createImportDeclaration(
|
|
9541
|
-
false,
|
|
9542
|
-
ImportDeclarations
|
|
9543
|
-
);
|
|
9544
|
-
statements.unshift(newImportDeclarations);
|
|
9545
|
-
}
|
|
9546
|
-
const updatedSourceFile = import_typescript.factory.updateSourceFile(
|
|
9547
|
-
transformedSourceFile,
|
|
9548
|
-
statements
|
|
9549
|
-
);
|
|
9550
|
-
let printedContent = printer.printFile(updatedSourceFile);
|
|
9551
|
-
printedContent = printedContent.replace(/^;$/gm, "");
|
|
9552
|
-
printedContent = printedContent.replace(/\s\n*(?=import)/g, "");
|
|
9553
|
-
printedContent = printedContent.replace(/(import .*\n)+(?!import)/, "$&\n");
|
|
9554
|
-
return printedContent;
|
|
9555
|
-
};
|
|
9556
|
-
var replaceIndex = (content) => {
|
|
9557
|
-
const index = content.indexOf("export const baseTheme");
|
|
9558
|
-
content = content.slice(0, index);
|
|
9559
|
-
content = content.replace(/export const baseTheme/, "export const theme");
|
|
9560
|
-
content = content.replace(/\nimport { config } from ".\/config"/, "");
|
|
9561
|
-
content += "\nexport { config } from './config'";
|
|
9562
|
-
return content;
|
|
9563
|
-
};
|
|
9564
|
-
var generateTheme = async (outPath, fileMap, isReactReplace, isForceReplace) => {
|
|
9565
|
-
if (!await isWriteable(import_path5.default.dirname(outPath))) {
|
|
9566
|
-
throw new Error(
|
|
9567
|
-
"The provided path is not writable, please check folder permissions and try again. It is likely you do not have write permissions for this folder."
|
|
9568
|
-
);
|
|
9569
|
-
}
|
|
9570
|
-
await (0, import_promises2.mkdir)(outPath, { recursive: true });
|
|
9571
|
-
await Promise.all(
|
|
9572
|
-
[...fileMap.entries()].map(async ([filePath, _content]) => {
|
|
9573
|
-
const targetPath = import_path5.default.join(outPath, filePath);
|
|
9574
|
-
let content = _content;
|
|
9575
|
-
if (filePath === "index.ts") {
|
|
9576
|
-
content = replaceIndex(content);
|
|
9577
|
-
} else {
|
|
9578
|
-
if (isReactReplace) content = replaceContent(content);
|
|
9579
|
-
}
|
|
9580
|
-
const formattedContent = await prettier(content);
|
|
9581
|
-
try {
|
|
9582
|
-
if (!isForceReplace && (0, import_fs3.existsSync)(targetPath)) return;
|
|
9583
|
-
await (0, import_promises2.writeFile)(targetPath, formattedContent, "utf-8");
|
|
9584
|
-
} catch (e) {
|
|
9585
|
-
if (e instanceof Error && "code" in e && e.code === "ENOENT") {
|
|
9586
|
-
const dirPath = import_path5.default.dirname(targetPath);
|
|
9587
|
-
await (0, import_promises2.mkdir)(dirPath, { recursive: true });
|
|
9588
|
-
if (!isForceReplace && (0, import_fs3.existsSync)(targetPath)) return;
|
|
9589
|
-
await (0, import_promises2.writeFile)(targetPath, formattedContent, "utf-8");
|
|
9590
|
-
}
|
|
9591
|
-
}
|
|
9592
|
-
})
|
|
9593
|
-
);
|
|
9594
|
-
};
|
|
9595
|
-
var actionTheme = async (_outPath, { branch = DEFAULT_BRANCH_NAME, cwd, replace = false }) => {
|
|
9596
|
-
p2.intro(source_default.magenta(`Generating Yamada UI theme`));
|
|
9597
|
-
const s = p2.spinner();
|
|
9598
|
-
try {
|
|
9599
|
-
const start = process.hrtime.bigint();
|
|
9600
|
-
cwd ??= import_path5.default.resolve();
|
|
9601
|
-
const outPath = import_path5.default.join(cwd, _outPath);
|
|
9602
|
-
s.start(`Checking "package.json"`);
|
|
9603
|
-
const hasReact = await checkHasReact(cwd);
|
|
9604
|
-
s.stop(`Checked "package.json"`);
|
|
9605
|
-
s.start(`Downloading the theme`);
|
|
9606
|
-
const fileMap = await getFileMap(outPath, branch);
|
|
9607
|
-
s.stop(`Downloaded the theme`);
|
|
9608
|
-
s.start(`Writing the theme "${outPath}"`);
|
|
9609
|
-
await generateTheme(outPath, fileMap, hasReact, replace);
|
|
9610
|
-
s.stop(`Wrote the theme`);
|
|
9611
|
-
const end = process.hrtime.bigint();
|
|
9612
|
-
const duration = (Number(end - start) / 1e9).toFixed(2);
|
|
9613
|
-
p2.outro(`${source_default.green(`Done`)} in ${source_default.dim(`${duration}s`)}
|
|
9614
|
-
`);
|
|
9615
|
-
} catch (e) {
|
|
9616
|
-
s.stop(`An error occurred`, 500);
|
|
9617
|
-
p2.cancel(source_default.red(e instanceof Error ? e.message : "Message is missing"));
|
|
9618
|
-
}
|
|
9619
|
-
};
|
|
9620
|
-
|
|
9621
9622
|
// src/index.ts
|
|
9622
9623
|
var run = async () => {
|
|
9623
9624
|
await initCLI();
|