@vocoder/cli 0.16.2 → 0.16.4
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/bin.mjs +1812 -1804
- package/dist/bin.mjs.map +1 -1
- package/dist/{chunk-2JERZ6DL.mjs → chunk-OQWNYACE.mjs} +119 -119
- package/dist/{chunk-2JERZ6DL.mjs.map → chunk-OQWNYACE.mjs.map} +1 -1
- package/dist/lib.mjs +1 -1
- package/package.json +3 -3
|
@@ -43568,6 +43568,117 @@ var require_brace_expansion = __commonJS({
|
|
|
43568
43568
|
}
|
|
43569
43569
|
});
|
|
43570
43570
|
|
|
43571
|
+
// src/utils/detect-local.ts
|
|
43572
|
+
import { existsSync, readFileSync } from "fs";
|
|
43573
|
+
import { join } from "path";
|
|
43574
|
+
function detectLocalEcosystem(cwd = process.cwd()) {
|
|
43575
|
+
const packageManager = detectPackageManager(cwd);
|
|
43576
|
+
const pkg = readPackageJson(cwd);
|
|
43577
|
+
if (!pkg) {
|
|
43578
|
+
return {
|
|
43579
|
+
ecosystem: null,
|
|
43580
|
+
framework: null,
|
|
43581
|
+
packageManager,
|
|
43582
|
+
uiPackage: null,
|
|
43583
|
+
hasUnplugin: false,
|
|
43584
|
+
hasExtractor: false,
|
|
43585
|
+
hasConfig: false,
|
|
43586
|
+
hasUiPackage: false,
|
|
43587
|
+
sourceLocale: null,
|
|
43588
|
+
isTypeScript: existsSync(join(cwd, "tsconfig.json"))
|
|
43589
|
+
};
|
|
43590
|
+
}
|
|
43591
|
+
const allDeps = {
|
|
43592
|
+
...pkg.dependencies ?? {},
|
|
43593
|
+
...pkg.devDependencies ?? {}
|
|
43594
|
+
};
|
|
43595
|
+
const hasUnplugin = "@vocoder/plugin" in allDeps;
|
|
43596
|
+
const hasExtractor = "@vocoder/extractor" in allDeps;
|
|
43597
|
+
const hasConfig = "@vocoder/config" in allDeps;
|
|
43598
|
+
const isTypeScript = existsSync(join(cwd, "tsconfig.json")) || "typescript" in allDeps;
|
|
43599
|
+
const { ecosystem, framework, uiPackage } = detectFromDeps(allDeps, cwd);
|
|
43600
|
+
const hasUiPackage = uiPackage !== null && uiPackage in allDeps;
|
|
43601
|
+
return {
|
|
43602
|
+
ecosystem,
|
|
43603
|
+
framework,
|
|
43604
|
+
packageManager,
|
|
43605
|
+
uiPackage,
|
|
43606
|
+
hasUnplugin,
|
|
43607
|
+
hasExtractor,
|
|
43608
|
+
hasConfig,
|
|
43609
|
+
hasUiPackage,
|
|
43610
|
+
sourceLocale: null,
|
|
43611
|
+
isTypeScript
|
|
43612
|
+
};
|
|
43613
|
+
}
|
|
43614
|
+
function detectPackageManager(cwd) {
|
|
43615
|
+
if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
43616
|
+
if (existsSync(join(cwd, "bun.lockb")) || existsSync(join(cwd, "bun.lock")))
|
|
43617
|
+
return "bun";
|
|
43618
|
+
if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
|
|
43619
|
+
return "npm";
|
|
43620
|
+
}
|
|
43621
|
+
function readPackageJson(cwd) {
|
|
43622
|
+
const pkgPath = join(cwd, "package.json");
|
|
43623
|
+
if (!existsSync(pkgPath)) return null;
|
|
43624
|
+
try {
|
|
43625
|
+
return JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
43626
|
+
} catch {
|
|
43627
|
+
return null;
|
|
43628
|
+
}
|
|
43629
|
+
}
|
|
43630
|
+
function detectFromDeps(allDeps, cwd) {
|
|
43631
|
+
if ("vue" in allDeps) {
|
|
43632
|
+
const framework = "nuxt" in allDeps ? "nuxt" : null;
|
|
43633
|
+
return { ecosystem: "vue", framework, uiPackage: "@vocoder/vue" };
|
|
43634
|
+
}
|
|
43635
|
+
if ("svelte" in allDeps) {
|
|
43636
|
+
const framework = "@sveltejs/kit" in allDeps ? "sveltekit" : null;
|
|
43637
|
+
return { ecosystem: "svelte", framework, uiPackage: "@vocoder/svelte" };
|
|
43638
|
+
}
|
|
43639
|
+
if ("@angular/core" in allDeps || existsSync(join(cwd, "angular.json"))) {
|
|
43640
|
+
return {
|
|
43641
|
+
ecosystem: "angular",
|
|
43642
|
+
framework: "angular",
|
|
43643
|
+
uiPackage: "@vocoder/angular"
|
|
43644
|
+
};
|
|
43645
|
+
}
|
|
43646
|
+
if ("react" in allDeps) {
|
|
43647
|
+
let framework = null;
|
|
43648
|
+
if ("next" in allDeps) framework = "nextjs";
|
|
43649
|
+
else if ("@remix-run/react" in allDeps) framework = "remix";
|
|
43650
|
+
else if ("gatsby" in allDeps) framework = "gatsby";
|
|
43651
|
+
else if ("vite" in allDeps) framework = "vite";
|
|
43652
|
+
return { ecosystem: "react", framework, uiPackage: "@vocoder/react" };
|
|
43653
|
+
}
|
|
43654
|
+
return { ecosystem: null, framework: null, uiPackage: null };
|
|
43655
|
+
}
|
|
43656
|
+
function buildInstallCommand(packageManager, packages, dev = false) {
|
|
43657
|
+
if (packages.length === 0) return "";
|
|
43658
|
+
const pkgList = packages.join(" ");
|
|
43659
|
+
const devFlag = dev ? " -D" : "";
|
|
43660
|
+
switch (packageManager) {
|
|
43661
|
+
case "pnpm":
|
|
43662
|
+
return `pnpm add${devFlag} ${pkgList}`;
|
|
43663
|
+
case "yarn":
|
|
43664
|
+
return `yarn add${devFlag} ${pkgList}`;
|
|
43665
|
+
case "bun":
|
|
43666
|
+
return `bun add${devFlag} ${pkgList}`;
|
|
43667
|
+
default:
|
|
43668
|
+
return `npm install${devFlag} ${pkgList}`;
|
|
43669
|
+
}
|
|
43670
|
+
}
|
|
43671
|
+
function getPackagesToInstall(detection) {
|
|
43672
|
+
const devPackages = [];
|
|
43673
|
+
const runtimePackages = [];
|
|
43674
|
+
if (!detection.hasUnplugin) devPackages.push("@vocoder/plugin");
|
|
43675
|
+
if (!detection.hasExtractor) devPackages.push("@vocoder/extractor");
|
|
43676
|
+
if (!detection.hasConfig) devPackages.push("@vocoder/config");
|
|
43677
|
+
if (detection.uiPackage && !detection.hasUiPackage)
|
|
43678
|
+
runtimePackages.push(detection.uiPackage);
|
|
43679
|
+
return { devPackages, runtimePackages };
|
|
43680
|
+
}
|
|
43681
|
+
|
|
43571
43682
|
// src/utils/api.ts
|
|
43572
43683
|
function computeStringsHash(input) {
|
|
43573
43684
|
const { createHash: createHash2 } = __require("crypto");
|
|
@@ -44299,16 +44410,16 @@ var VocoderAPI = class {
|
|
|
44299
44410
|
};
|
|
44300
44411
|
|
|
44301
44412
|
// src/utils/auth-store.ts
|
|
44302
|
-
import { mkdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
44413
|
+
import { mkdirSync, readFileSync as readFileSync2, unlinkSync, writeFileSync } from "fs";
|
|
44303
44414
|
import { homedir } from "os";
|
|
44304
|
-
import { dirname, join } from "path";
|
|
44415
|
+
import { dirname, join as join2 } from "path";
|
|
44305
44416
|
function getAuthFilePath() {
|
|
44306
|
-
return
|
|
44417
|
+
return join2(homedir(), ".vocoder", "auth.json");
|
|
44307
44418
|
}
|
|
44308
44419
|
function readAuthData() {
|
|
44309
44420
|
const filePath = getAuthFilePath();
|
|
44310
44421
|
try {
|
|
44311
|
-
const raw =
|
|
44422
|
+
const raw = readFileSync2(filePath, "utf8");
|
|
44312
44423
|
const parsed = JSON.parse(raw);
|
|
44313
44424
|
if (!parsed || typeof parsed !== "object") return null;
|
|
44314
44425
|
const data = parsed;
|
|
@@ -44354,117 +44465,6 @@ function clearAuthData() {
|
|
|
44354
44465
|
}
|
|
44355
44466
|
}
|
|
44356
44467
|
|
|
44357
|
-
// src/utils/detect-local.ts
|
|
44358
|
-
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
44359
|
-
import { join as join2 } from "path";
|
|
44360
|
-
function detectLocalEcosystem(cwd = process.cwd()) {
|
|
44361
|
-
const packageManager = detectPackageManager(cwd);
|
|
44362
|
-
const pkg = readPackageJson(cwd);
|
|
44363
|
-
if (!pkg) {
|
|
44364
|
-
return {
|
|
44365
|
-
ecosystem: null,
|
|
44366
|
-
framework: null,
|
|
44367
|
-
packageManager,
|
|
44368
|
-
uiPackage: null,
|
|
44369
|
-
hasUnplugin: false,
|
|
44370
|
-
hasExtractor: false,
|
|
44371
|
-
hasConfig: false,
|
|
44372
|
-
hasUiPackage: false,
|
|
44373
|
-
sourceLocale: null,
|
|
44374
|
-
isTypeScript: existsSync(join2(cwd, "tsconfig.json"))
|
|
44375
|
-
};
|
|
44376
|
-
}
|
|
44377
|
-
const allDeps = {
|
|
44378
|
-
...pkg.dependencies ?? {},
|
|
44379
|
-
...pkg.devDependencies ?? {}
|
|
44380
|
-
};
|
|
44381
|
-
const hasUnplugin = "@vocoder/plugin" in allDeps;
|
|
44382
|
-
const hasExtractor = "@vocoder/extractor" in allDeps;
|
|
44383
|
-
const hasConfig = "@vocoder/config" in allDeps;
|
|
44384
|
-
const isTypeScript = existsSync(join2(cwd, "tsconfig.json")) || "typescript" in allDeps;
|
|
44385
|
-
const { ecosystem, framework, uiPackage } = detectFromDeps(allDeps, cwd);
|
|
44386
|
-
const hasUiPackage = uiPackage !== null && uiPackage in allDeps;
|
|
44387
|
-
return {
|
|
44388
|
-
ecosystem,
|
|
44389
|
-
framework,
|
|
44390
|
-
packageManager,
|
|
44391
|
-
uiPackage,
|
|
44392
|
-
hasUnplugin,
|
|
44393
|
-
hasExtractor,
|
|
44394
|
-
hasConfig,
|
|
44395
|
-
hasUiPackage,
|
|
44396
|
-
sourceLocale: null,
|
|
44397
|
-
isTypeScript
|
|
44398
|
-
};
|
|
44399
|
-
}
|
|
44400
|
-
function detectPackageManager(cwd) {
|
|
44401
|
-
if (existsSync(join2(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
44402
|
-
if (existsSync(join2(cwd, "bun.lockb")) || existsSync(join2(cwd, "bun.lock")))
|
|
44403
|
-
return "bun";
|
|
44404
|
-
if (existsSync(join2(cwd, "yarn.lock"))) return "yarn";
|
|
44405
|
-
return "npm";
|
|
44406
|
-
}
|
|
44407
|
-
function readPackageJson(cwd) {
|
|
44408
|
-
const pkgPath = join2(cwd, "package.json");
|
|
44409
|
-
if (!existsSync(pkgPath)) return null;
|
|
44410
|
-
try {
|
|
44411
|
-
return JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
44412
|
-
} catch {
|
|
44413
|
-
return null;
|
|
44414
|
-
}
|
|
44415
|
-
}
|
|
44416
|
-
function detectFromDeps(allDeps, cwd) {
|
|
44417
|
-
if ("vue" in allDeps) {
|
|
44418
|
-
const framework = "nuxt" in allDeps ? "nuxt" : null;
|
|
44419
|
-
return { ecosystem: "vue", framework, uiPackage: "@vocoder/vue" };
|
|
44420
|
-
}
|
|
44421
|
-
if ("svelte" in allDeps) {
|
|
44422
|
-
const framework = "@sveltejs/kit" in allDeps ? "sveltekit" : null;
|
|
44423
|
-
return { ecosystem: "svelte", framework, uiPackage: "@vocoder/svelte" };
|
|
44424
|
-
}
|
|
44425
|
-
if ("@angular/core" in allDeps || existsSync(join2(cwd, "angular.json"))) {
|
|
44426
|
-
return {
|
|
44427
|
-
ecosystem: "angular",
|
|
44428
|
-
framework: "angular",
|
|
44429
|
-
uiPackage: "@vocoder/angular"
|
|
44430
|
-
};
|
|
44431
|
-
}
|
|
44432
|
-
if ("react" in allDeps) {
|
|
44433
|
-
let framework = null;
|
|
44434
|
-
if ("next" in allDeps) framework = "nextjs";
|
|
44435
|
-
else if ("@remix-run/react" in allDeps) framework = "remix";
|
|
44436
|
-
else if ("gatsby" in allDeps) framework = "gatsby";
|
|
44437
|
-
else if ("vite" in allDeps) framework = "vite";
|
|
44438
|
-
return { ecosystem: "react", framework, uiPackage: "@vocoder/react" };
|
|
44439
|
-
}
|
|
44440
|
-
return { ecosystem: null, framework: null, uiPackage: null };
|
|
44441
|
-
}
|
|
44442
|
-
function buildInstallCommand(packageManager, packages, dev = false) {
|
|
44443
|
-
if (packages.length === 0) return "";
|
|
44444
|
-
const pkgList = packages.join(" ");
|
|
44445
|
-
const devFlag = dev ? " -D" : "";
|
|
44446
|
-
switch (packageManager) {
|
|
44447
|
-
case "pnpm":
|
|
44448
|
-
return `pnpm add${devFlag} ${pkgList}`;
|
|
44449
|
-
case "yarn":
|
|
44450
|
-
return `yarn add${devFlag} ${pkgList}`;
|
|
44451
|
-
case "bun":
|
|
44452
|
-
return `bun add${devFlag} ${pkgList}`;
|
|
44453
|
-
default:
|
|
44454
|
-
return `npm install${devFlag} ${pkgList}`;
|
|
44455
|
-
}
|
|
44456
|
-
}
|
|
44457
|
-
function getPackagesToInstall(detection) {
|
|
44458
|
-
const devPackages = [];
|
|
44459
|
-
const runtimePackages = [];
|
|
44460
|
-
if (!detection.hasUnplugin) devPackages.push("@vocoder/plugin");
|
|
44461
|
-
if (!detection.hasExtractor) devPackages.push("@vocoder/extractor");
|
|
44462
|
-
if (!detection.hasConfig) devPackages.push("@vocoder/config");
|
|
44463
|
-
if (detection.uiPackage && !detection.hasUiPackage)
|
|
44464
|
-
runtimePackages.push(detection.uiPackage);
|
|
44465
|
-
return { devPackages, runtimePackages };
|
|
44466
|
-
}
|
|
44467
|
-
|
|
44468
44468
|
// ../extractor/src/config.ts
|
|
44469
44469
|
var import_parser = __toESM(require_lib());
|
|
44470
44470
|
var import_traverse = __toESM(require_lib8());
|
|
@@ -51388,17 +51388,17 @@ function deduplicateStrings(strings) {
|
|
|
51388
51388
|
}
|
|
51389
51389
|
|
|
51390
51390
|
export {
|
|
51391
|
+
detectLocalEcosystem,
|
|
51392
|
+
buildInstallCommand,
|
|
51393
|
+
getPackagesToInstall,
|
|
51391
51394
|
VocoderAPIError,
|
|
51392
51395
|
VocoderAPI,
|
|
51393
51396
|
readAuthData,
|
|
51394
51397
|
writeAuthData,
|
|
51395
51398
|
verifyStoredAuth,
|
|
51396
51399
|
clearAuthData,
|
|
51397
|
-
detectLocalEcosystem,
|
|
51398
|
-
buildInstallCommand,
|
|
51399
|
-
getPackagesToInstall,
|
|
51400
51400
|
loadVocoderConfig,
|
|
51401
51401
|
computeFingerprint,
|
|
51402
51402
|
StringExtractor
|
|
51403
51403
|
};
|
|
51404
|
-
//# sourceMappingURL=chunk-
|
|
51404
|
+
//# sourceMappingURL=chunk-OQWNYACE.mjs.map
|