i18nsmith 0.3.3 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ensure-cli-built.d.ts","sourceRoot":"","sources":["../../src/test-helpers/ensure-cli-built.ts"],"names":[],"mappings":"AAUA,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBnE"}
1
+ {"version":3,"file":"ensure-cli-built.d.ts","sourceRoot":"","sources":["../../src/test-helpers/ensure-cli-built.ts"],"names":[],"mappings":"AAaA,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18nsmith",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "CLI for i18nsmith",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -827,7 +827,7 @@ function printSyncSummary(summary: SyncSummary) {
827
827
  } else {
828
828
  console.log(
829
829
  chalk.gray(
830
- "Use --assume key1,key2 to prevent false positives for known runtime-only translation keys."
830
+ "Use --assume to prevent false positives for known runtime-only translation keys."
831
831
  )
832
832
  );
833
833
  }
@@ -78,6 +78,8 @@ export async function handleCsvExport(options: TranslateCommandOptions): Promise
78
78
  const plan = await translationService.buildPlan({
79
79
  locales: options.locales,
80
80
  force: options.force,
81
+ // Export should represent what the UI calls "missing" (usually includes empty strings)
82
+ treatEmptyAsMissing: true,
81
83
  });
82
84
 
83
85
  if (!plan.totalTasks) {
@@ -165,7 +167,6 @@ export async function handleCsvImport(options: TranslateCommandOptions): Promise
165
167
  // Parse header
166
168
  const headerFields = parseCsvLine(lines[0]);
167
169
  const keyIdx = headerFields.indexOf('key');
168
- const sourceLocaleIdx = headerFields.indexOf('sourceLocale');
169
170
  const sourceValueIdx = headerFields.indexOf('sourceValue');
170
171
  const targetLocaleIdx = headerFields.indexOf('targetLocale');
171
172
  const translatedValueIdx = headerFields.indexOf('translatedValue');
package/src/index.ts CHANGED
@@ -22,7 +22,7 @@ export const program = new Command();
22
22
  program
23
23
  .name('i18nsmith')
24
24
  .description('Universal Automated i18n Library')
25
- .version('0.3.3');
25
+ .version('0.3.4');
26
26
 
27
27
  registerInit(program);
28
28
  registerScaffoldAdapter(program);
@@ -1,7 +1,10 @@
1
1
  import { stat } from 'fs/promises';
2
+ import path from 'path';
2
3
 
3
4
  const DEFAULT_MAX_ATTEMPTS = 20;
4
5
  const DEFAULT_DELAY_MS = 300;
6
+ // dist/index.js is an ESM shim that re-exports dist/index.cjs.
7
+ // It's intentionally small, so we validate the underlying bundle size instead.
5
8
  const MIN_FILE_SIZE_BYTES = 1024;
6
9
 
7
10
  function sleep(ms: number) {
@@ -12,12 +15,27 @@ export async function ensureCliBuilt(cliPath: string): Promise<void> {
12
15
  const maxAttempts = Number(process.env.I18NSMITH_TEST_CLI_ATTEMPTS ?? DEFAULT_MAX_ATTEMPTS);
13
16
  const delayMs = Number(process.env.I18NSMITH_TEST_CLI_DELAY_MS ?? DEFAULT_DELAY_MS);
14
17
 
18
+ const cjsFallbackPath = cliPath.endsWith(`${path.sep}index.js`)
19
+ ? cliPath.slice(0, -'index.js'.length) + 'index.cjs'
20
+ : cliPath;
21
+
15
22
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
16
23
  try {
17
24
  const stats = await stat(cliPath);
25
+ // Accept either:
26
+ // 1) a full bundle directly at cliPath, or
27
+ // 2) a tiny ESM shim at cliPath + a full CJS bundle at index.cjs
18
28
  if (stats.size >= MIN_FILE_SIZE_BYTES) {
19
29
  return;
20
30
  }
31
+
32
+ // If it's the shim, validate the underlying bundle.
33
+ if (cjsFallbackPath !== cliPath) {
34
+ const cjsStats = await stat(cjsFallbackPath);
35
+ if (cjsStats.size >= MIN_FILE_SIZE_BYTES) {
36
+ return;
37
+ }
38
+ }
21
39
  } catch {
22
40
  // ignore and retry
23
41
  }