@vocoder/cli 0.15.0 → 0.16.0
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 +184 -154
- package/dist/bin.mjs.map +1 -1
- package/dist/{chunk-62KCB6C6.mjs → chunk-IK4ZCESQ.mjs} +10 -168
- package/dist/chunk-IK4ZCESQ.mjs.map +1 -0
- package/dist/lib.d.mts +7 -7
- package/dist/lib.mjs +159 -2
- package/dist/lib.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-62KCB6C6.mjs.map +0 -1
|
@@ -43572,7 +43572,7 @@ var require_brace_expansion = __commonJS({
|
|
|
43572
43572
|
function computeStringsHash(input) {
|
|
43573
43573
|
const { createHash: createHash2 } = __require("crypto");
|
|
43574
43574
|
const sorted = [...input.keys].sort();
|
|
43575
|
-
return createHash2("sha256").update(JSON.stringify({ strings: sorted,
|
|
43575
|
+
return createHash2("sha256").update(JSON.stringify({ strings: sorted, industry: input.industry ?? null })).digest("hex");
|
|
43576
43576
|
}
|
|
43577
43577
|
function isLimitErrorResponse(value) {
|
|
43578
43578
|
if (!value || typeof value !== "object") {
|
|
@@ -43727,7 +43727,7 @@ var VocoderAPI = class {
|
|
|
43727
43727
|
async submitTranslation(branch, entries, targetLocales, options, repoIdentity) {
|
|
43728
43728
|
const allEntries = this.normalizeStringEntries(entries);
|
|
43729
43729
|
const stringEntries = allEntries.filter((e) => e.text != null);
|
|
43730
|
-
const stringsHash = computeStringsHash({ keys: allEntries.map((e) => e.key),
|
|
43730
|
+
const stringsHash = computeStringsHash({ keys: allEntries.map((e) => e.key), industry: options?.industry ?? null });
|
|
43731
43731
|
return this.request(
|
|
43732
43732
|
"/api/cli/sync",
|
|
43733
43733
|
{
|
|
@@ -43746,7 +43746,7 @@ var VocoderAPI = class {
|
|
|
43746
43746
|
...repoIdentity?.repoCanonical ? { repoCanonical: repoIdentity.repoCanonical } : {},
|
|
43747
43747
|
...repoIdentity?.repoAppDir !== void 0 ? { repoAppDir: repoIdentity.repoAppDir } : {},
|
|
43748
43748
|
...repoIdentity?.commitSha ? { commitSha: repoIdentity.commitSha } : {},
|
|
43749
|
-
...options?.
|
|
43749
|
+
...options?.industry ? { industry: options.industry } : {}
|
|
43750
43750
|
})
|
|
43751
43751
|
},
|
|
43752
43752
|
"Translation submission failed"
|
|
@@ -44465,164 +44465,6 @@ function clearAuthData() {
|
|
|
44465
44465
|
}
|
|
44466
44466
|
}
|
|
44467
44467
|
|
|
44468
|
-
// src/utils/setup-snippets.ts
|
|
44469
|
-
function getSetupSnippets(params) {
|
|
44470
|
-
const { framework, ecosystem, sourceLocale } = params;
|
|
44471
|
-
return {
|
|
44472
|
-
pluginStep: getPluginSnippet(framework, ecosystem),
|
|
44473
|
-
providerStep: getProviderSnippet(ecosystem, sourceLocale),
|
|
44474
|
-
wrapStep: getWrapSnippet(ecosystem),
|
|
44475
|
-
whatsNext: "Push to a target branch to trigger translations."
|
|
44476
|
-
};
|
|
44477
|
-
}
|
|
44478
|
-
function getPluginSnippet(framework, ecosystem) {
|
|
44479
|
-
switch (framework) {
|
|
44480
|
-
case "nextjs":
|
|
44481
|
-
return {
|
|
44482
|
-
file: "next.config.ts",
|
|
44483
|
-
code: `import { withVocoder } from '@vocoder/plugin/next';
|
|
44484
|
-
|
|
44485
|
-
export default withVocoder({
|
|
44486
|
-
// your existing Next.js config
|
|
44487
|
-
});`
|
|
44488
|
-
};
|
|
44489
|
-
case "vite":
|
|
44490
|
-
case "remix":
|
|
44491
|
-
return {
|
|
44492
|
-
file: "vite.config.ts",
|
|
44493
|
-
code: `import vocoder from '@vocoder/plugin/vite';
|
|
44494
|
-
|
|
44495
|
-
export default defineConfig({
|
|
44496
|
-
plugins: [
|
|
44497
|
-
vocoder(),
|
|
44498
|
-
// your other plugins
|
|
44499
|
-
],
|
|
44500
|
-
});`
|
|
44501
|
-
};
|
|
44502
|
-
case "nuxt":
|
|
44503
|
-
return {
|
|
44504
|
-
file: "nuxt.config.ts",
|
|
44505
|
-
code: `import vocoder from '@vocoder/plugin/vite';
|
|
44506
|
-
|
|
44507
|
-
export default defineNuxtConfig({
|
|
44508
|
-
vite: {
|
|
44509
|
-
plugins: [vocoder()],
|
|
44510
|
-
},
|
|
44511
|
-
});`
|
|
44512
|
-
};
|
|
44513
|
-
case "sveltekit":
|
|
44514
|
-
return {
|
|
44515
|
-
file: "vite.config.ts",
|
|
44516
|
-
code: `import vocoder from '@vocoder/plugin/vite';
|
|
44517
|
-
import { sveltekit } from '@sveltejs/kit/vite';
|
|
44518
|
-
|
|
44519
|
-
export default defineConfig({
|
|
44520
|
-
plugins: [
|
|
44521
|
-
sveltekit(),
|
|
44522
|
-
vocoder(),
|
|
44523
|
-
],
|
|
44524
|
-
});`
|
|
44525
|
-
};
|
|
44526
|
-
case "gatsby":
|
|
44527
|
-
return {
|
|
44528
|
-
file: "gatsby-node.js",
|
|
44529
|
-
code: `const vocoder = require('@vocoder/plugin/webpack');
|
|
44530
|
-
|
|
44531
|
-
exports.onCreateWebpackConfig = ({ actions }) => {
|
|
44532
|
-
actions.setWebpackConfig({
|
|
44533
|
-
plugins: [vocoder()],
|
|
44534
|
-
});
|
|
44535
|
-
};`
|
|
44536
|
-
};
|
|
44537
|
-
case "angular":
|
|
44538
|
-
return null;
|
|
44539
|
-
// Angular CLI doesn't expose plugin config easily
|
|
44540
|
-
default:
|
|
44541
|
-
if (ecosystem) {
|
|
44542
|
-
return {
|
|
44543
|
-
file: "your bundler config",
|
|
44544
|
-
code: `// Vite
|
|
44545
|
-
import vocoder from '@vocoder/plugin/vite';
|
|
44546
|
-
// Webpack
|
|
44547
|
-
const vocoder = require('@vocoder/plugin/webpack');
|
|
44548
|
-
|
|
44549
|
-
// Add vocoder() to your plugins array`
|
|
44550
|
-
};
|
|
44551
|
-
}
|
|
44552
|
-
return null;
|
|
44553
|
-
}
|
|
44554
|
-
}
|
|
44555
|
-
function getProviderSnippet(ecosystem, sourceLocale) {
|
|
44556
|
-
switch (ecosystem) {
|
|
44557
|
-
case "react":
|
|
44558
|
-
return {
|
|
44559
|
-
file: "your root layout or App component",
|
|
44560
|
-
code: `import { VocoderProvider } from '@vocoder/react';
|
|
44561
|
-
|
|
44562
|
-
<VocoderProvider defaultLocale="${sourceLocale}">
|
|
44563
|
-
{children}
|
|
44564
|
-
</VocoderProvider>`
|
|
44565
|
-
};
|
|
44566
|
-
case "vue":
|
|
44567
|
-
return {
|
|
44568
|
-
file: "your app entry",
|
|
44569
|
-
code: `import { createVocoder } from '@vocoder/vue';
|
|
44570
|
-
|
|
44571
|
-
const vocoder = createVocoder({
|
|
44572
|
-
defaultLocale: '${sourceLocale}',
|
|
44573
|
-
});
|
|
44574
|
-
|
|
44575
|
-
app.use(vocoder);`
|
|
44576
|
-
};
|
|
44577
|
-
case "svelte":
|
|
44578
|
-
return {
|
|
44579
|
-
file: "your root layout",
|
|
44580
|
-
code: `<script>
|
|
44581
|
-
import { VocoderProvider } from '@vocoder/svelte';
|
|
44582
|
-
</script>
|
|
44583
|
-
|
|
44584
|
-
<VocoderProvider defaultLocale="${sourceLocale}">
|
|
44585
|
-
<slot />
|
|
44586
|
-
</VocoderProvider>`
|
|
44587
|
-
};
|
|
44588
|
-
default:
|
|
44589
|
-
return null;
|
|
44590
|
-
}
|
|
44591
|
-
}
|
|
44592
|
-
function getWrapSnippet(ecosystem) {
|
|
44593
|
-
switch (ecosystem) {
|
|
44594
|
-
case "react":
|
|
44595
|
-
return {
|
|
44596
|
-
code: `import { T } from '@vocoder/react';
|
|
44597
|
-
|
|
44598
|
-
<T>Hello, world!</T>`
|
|
44599
|
-
};
|
|
44600
|
-
case "vue":
|
|
44601
|
-
return {
|
|
44602
|
-
code: `<template>
|
|
44603
|
-
<T>Hello, world!</T>
|
|
44604
|
-
</template>
|
|
44605
|
-
|
|
44606
|
-
<script setup>
|
|
44607
|
-
import { T } from '@vocoder/vue';
|
|
44608
|
-
</script>`
|
|
44609
|
-
};
|
|
44610
|
-
case "svelte":
|
|
44611
|
-
return {
|
|
44612
|
-
code: `<script>
|
|
44613
|
-
import { T } from '@vocoder/svelte';
|
|
44614
|
-
</script>
|
|
44615
|
-
|
|
44616
|
-
<T>Hello, world!</T>`
|
|
44617
|
-
};
|
|
44618
|
-
default:
|
|
44619
|
-
return {
|
|
44620
|
-
code: `// Wrap translatable strings with <T>
|
|
44621
|
-
<T>Hello, world!</T>`
|
|
44622
|
-
};
|
|
44623
|
-
}
|
|
44624
|
-
}
|
|
44625
|
-
|
|
44626
44468
|
// ../extractor/src/config.ts
|
|
44627
44469
|
var import_parser = __toESM(require_lib());
|
|
44628
44470
|
var import_traverse = __toESM(require_lib8());
|
|
@@ -44695,8 +44537,11 @@ function extractFromObject(obj) {
|
|
|
44695
44537
|
if (key === "localesPath" && prop.value.type === "StringLiteral") {
|
|
44696
44538
|
config.localesPath = prop.value.value;
|
|
44697
44539
|
}
|
|
44540
|
+
if (key === "industry" && prop.value.type === "StringLiteral") {
|
|
44541
|
+
config.industry = prop.value.value;
|
|
44542
|
+
}
|
|
44698
44543
|
if (key === "appIndustry" && prop.value.type === "StringLiteral") {
|
|
44699
|
-
config.
|
|
44544
|
+
config.industry = prop.value.value;
|
|
44700
44545
|
}
|
|
44701
44546
|
if (key === "formality" && prop.value.type === "StringLiteral") {
|
|
44702
44547
|
config.formality = prop.value.value;
|
|
@@ -51097,7 +50942,7 @@ function generateMessageHash(text, context, formality) {
|
|
|
51097
50942
|
return h.toString(36).padStart(7, "0");
|
|
51098
50943
|
}
|
|
51099
50944
|
|
|
51100
|
-
// ../
|
|
50945
|
+
// ../core/src/icu-builders.ts
|
|
51101
50946
|
var PLURAL_CLDR = /* @__PURE__ */ new Set(["zero", "one", "two", "few", "many"]);
|
|
51102
50947
|
var ALL_CLDR = /* @__PURE__ */ new Set(["zero", "one", "two", "few", "many", "other"]);
|
|
51103
50948
|
var DEFAULT_ORDINAL_ICU = "{count, selectordinal, other {#}}";
|
|
@@ -51124,9 +50969,7 @@ function buildSelectICU(props) {
|
|
|
51124
50969
|
cases.push(`other {${text}}`);
|
|
51125
50970
|
} else {
|
|
51126
50971
|
const wordCase = key.match(/^_([a-zA-Z].*)$/);
|
|
51127
|
-
if (wordCase) {
|
|
51128
|
-
cases.push(`${wordCase[1]} {${text}}`);
|
|
51129
|
-
}
|
|
50972
|
+
if (wordCase) cases.push(`${wordCase[1]} {${text}}`);
|
|
51130
50973
|
}
|
|
51131
50974
|
}
|
|
51132
50975
|
if (!hasOther) cases.push("other {other}");
|
|
@@ -51554,9 +51397,8 @@ export {
|
|
|
51554
51397
|
writeAuthData,
|
|
51555
51398
|
verifyStoredAuth,
|
|
51556
51399
|
clearAuthData,
|
|
51557
|
-
getSetupSnippets,
|
|
51558
51400
|
loadVocoderConfig,
|
|
51559
51401
|
computeFingerprint,
|
|
51560
51402
|
StringExtractor
|
|
51561
51403
|
};
|
|
51562
|
-
//# sourceMappingURL=chunk-
|
|
51404
|
+
//# sourceMappingURL=chunk-IK4ZCESQ.mjs.map
|