localingos 0.1.38 → 0.1.40
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/package.json +1 -1
- package/src/commands/extract.js +2 -1
package/package.json
CHANGED
package/src/commands/extract.js
CHANGED
|
@@ -398,7 +398,8 @@ The extraction script must also detect **orphan messages** — keys defined in \
|
|
|
398
398
|
How it works:
|
|
399
399
|
1. For each \`*${msgExt}\` file, extract the exported const name (e.g. \`HeroMessages\`) and each UPPER_SNAKE_CASE record key (e.g. \`TITLE\`)
|
|
400
400
|
2. Search all \`.ts\`/\`.tsx\` source files (excluding \`*${msgExt}\`) for references like \`HeroMessages.TITLE\`
|
|
401
|
-
3.
|
|
401
|
+
3. Also resolve **import aliases** — scan for \`import { HeroMessages as m }\` patterns and check for \`m.TITLE\` as well. A message is NOT orphaned if it's referenced through any alias.
|
|
402
|
+
4. If a key is never referenced anywhere (neither by its original export name nor any alias), it's an orphan
|
|
402
403
|
|
|
403
404
|
Behavior:
|
|
404
405
|
- **Default run** (\`npm run i18n:extract\`): report orphans with file, export name, record key, and id — grouped by file for readability. Print a message like: \`🧹 N orphan message(s) found — defined but never referenced in code\`
|