@worldware/msg-cli 0.4.0 → 0.4.1

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/README.md CHANGED
@@ -156,7 +156,7 @@ msg create resource myProject messages --edit
156
156
 
157
157
  - Writes the file to `i18n/resources/<title>.msg.js` (always `.js`, including TypeScript projects).
158
158
  - Uses ES module or CommonJS syntax based on `package.json` `"type"` or presence of `tsconfig.json`.
159
- - Imports the project via the `#i18n/projects/<projectName>` alias (added by `msg init`).
159
+ - Imports the project via the `#i18n/projects/<projectName>.js` alias (added by `msg init`).
160
160
  - Sets `lang` from the project's `sourceLocale` and `dir` to `rtl` for Arabic/Hebrew, `ltr` otherwise.
161
161
  - Exports a named `resource` plus an async `getMessages()` helper that returns `resource.getTranslation(getLang())`, so the resource can be pre-translated for the runtime locale.
162
162
  - Includes sample messages added via chainable `.add()`. Validates that the generated file is importable.
@@ -166,7 +166,7 @@ msg create resource myProject messages --edit
166
166
 
167
167
  ```javascript
168
168
  import { MsgResource, getLang } from '@worldware/msg';
169
- import project from '#i18n/projects/myProject';
169
+ import project from '#i18n/projects/myProject.js';
170
170
 
171
171
  export const resource = MsgResource.create({ /* title, attributes, notes */ }, project);
172
172
 
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-MGHC4AYZ.mjs";
10
10
  import {
11
11
  dynamicImportFromUrl
12
- } from "./chunk-JQKAEOL7.mjs";
12
+ } from "./chunk-PO2Z7EWJ.mjs";
13
13
 
14
14
  // src/lib/import-helpers.ts
15
15
  import { MsgResource } from "@worldware/msg";
@@ -80,7 +80,7 @@ function generateMsgResourceContent(params) {
80
80
  const langStr = `'${escapeSingleQuoted(sourceLocale)}'`;
81
81
  const dirStr = `'${dir}'`;
82
82
  const resourceNote = `This is the ${escapeSingleQuoted(title)} resource.`;
83
- const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}`;
83
+ const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}.js`;
84
84
  const createAndAdd = `MsgResource.create({
85
85
  title: ${titleStr},
86
86
  attributes: {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dynamicImportFromUrl
3
- } from "./chunk-JQKAEOL7.mjs";
3
+ } from "./chunk-PO2Z7EWJ.mjs";
4
4
  import {
5
5
  loadPackageJsonForMsg
6
6
  } from "./chunk-F7XZRKP7.mjs";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-MGHC4AYZ.mjs";
11
11
  import {
12
12
  dynamicImportFromUrl
13
- } from "./chunk-JQKAEOL7.mjs";
13
+ } from "./chunk-PO2Z7EWJ.mjs";
14
14
 
15
15
  // src/lib/export-helpers.ts
16
16
  import { MSG_DEFAULT_FORMAT } from "@worldware/msg";
@@ -3,8 +3,8 @@ import {
3
3
  importMsgProjectFile,
4
4
  loadPackageJsonForCreateProject,
5
5
  writeMsgProjectFile
6
- } from "../../chunk-5VZRQBSH.mjs";
7
- import "../../chunk-JQKAEOL7.mjs";
6
+ } from "../../chunk-QUPCXFIR.mjs";
7
+ import "../../chunk-PO2Z7EWJ.mjs";
8
8
  import {
9
9
  findPackageJsonPath
10
10
  } from "../../chunk-F7XZRKP7.mjs";
@@ -181,7 +181,7 @@ function generateMsgResourceContent(params) {
181
181
  const langStr = `'${escapeSingleQuoted(sourceLocale)}'`;
182
182
  const dirStr = `'${dir}'`;
183
183
  const resourceNote = `This is the ${escapeSingleQuoted(title)} resource.`;
184
- const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}`;
184
+ const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}.js`;
185
185
  const createAndAdd = `MsgResource.create({
186
186
  title: ${titleStr},
187
187
  attributes: {
@@ -4,7 +4,7 @@ import {
4
4
  importMsgProjectForResource,
5
5
  readPackageJsonForCreateResource,
6
6
  writeMsgResourceFile
7
- } from "../../chunk-JQKAEOL7.mjs";
7
+ } from "../../chunk-PO2Z7EWJ.mjs";
8
8
  import {
9
9
  findPackageJsonPath
10
10
  } from "../../chunk-F7XZRKP7.mjs";
@@ -5,11 +5,11 @@ import {
5
5
  importMsgResourcesFromPaths,
6
6
  serializeResourceGroupsToXliff,
7
7
  writeXliffFiles
8
- } from "../chunk-KZ47S4SH.mjs";
8
+ } from "../chunk-XMMVPJHX.mjs";
9
9
  import "../chunk-Q775ZGC5.mjs";
10
10
  import "../chunk-XID5J2F7.mjs";
11
11
  import "../chunk-MGHC4AYZ.mjs";
12
- import "../chunk-JQKAEOL7.mjs";
12
+ import "../chunk-PO2Z7EWJ.mjs";
13
13
  import {
14
14
  loadPackageJsonForMsg
15
15
  } from "../chunk-F7XZRKP7.mjs";
@@ -5,11 +5,11 @@ import {
5
5
  parseXliffFilename,
6
6
  processXliffFile,
7
7
  writeTranslationFiles
8
- } from "../chunk-77PP26JZ.mjs";
8
+ } from "../chunk-LPZ6YNLY.mjs";
9
9
  import "../chunk-Q775ZGC5.mjs";
10
10
  import "../chunk-XID5J2F7.mjs";
11
11
  import "../chunk-MGHC4AYZ.mjs";
12
- import "../chunk-JQKAEOL7.mjs";
12
+ import "../chunk-PO2Z7EWJ.mjs";
13
13
  import {
14
14
  loadPackageJsonForMsg
15
15
  } from "../chunk-F7XZRKP7.mjs";
@@ -3,8 +3,8 @@ import {
3
3
  importMsgProjectFile,
4
4
  loadPackageJsonForCreateProject,
5
5
  writeMsgProjectFile
6
- } from "../chunk-5VZRQBSH.mjs";
7
- import "../chunk-JQKAEOL7.mjs";
6
+ } from "../chunk-QUPCXFIR.mjs";
7
+ import "../chunk-PO2Z7EWJ.mjs";
8
8
  import "../chunk-F7XZRKP7.mjs";
9
9
  export {
10
10
  calculateRelativePath,
@@ -169,7 +169,7 @@ function generateMsgResourceContent(params) {
169
169
  const langStr = `'${escapeSingleQuoted(sourceLocale)}'`;
170
170
  const dirStr = `'${dir}'`;
171
171
  const resourceNote = `This is the ${escapeSingleQuoted(title)} resource.`;
172
- const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}`;
172
+ const projectImport = `#i18n/projects/${escapeSingleQuoted(projectName)}.js`;
173
173
  const createAndAdd = `MsgResource.create({
174
174
  title: ${titleStr},
175
175
  attributes: {
@@ -38,7 +38,7 @@ declare function importMsgProjectForResource(projectsDir: string, projectName: s
38
38
  * Emits ESM or CJS boilerplate that creates a MsgResource, adds sample
39
39
  * messages via chainable `.add()`, and exports `resource` plus an async
40
40
  * `getMessages` loader that calls `resource.getTranslation(getLang())`.
41
- * Project import uses the `#i18n/projects/<name>` alias from `msg init`.
41
+ * Project import uses the `#i18n/projects/<name>.js` alias from `msg init`.
42
42
  * @param params - Title, projectName, sourceLocale, dir, and isEsm
43
43
  * @returns The generated file content
44
44
  */
@@ -38,7 +38,7 @@ declare function importMsgProjectForResource(projectsDir: string, projectName: s
38
38
  * Emits ESM or CJS boilerplate that creates a MsgResource, adds sample
39
39
  * messages via chainable `.add()`, and exports `resource` plus an async
40
40
  * `getMessages` loader that calls `resource.getTranslation(getLang())`.
41
- * Project import uses the `#i18n/projects/<name>` alias from `msg init`.
41
+ * Project import uses the `#i18n/projects/<name>.js` alias from `msg init`.
42
42
  * @param params - Title, projectName, sourceLocale, dir, and isEsm
43
43
  * @returns The generated file content
44
44
  */
@@ -4,7 +4,7 @@ import {
4
4
  importMsgProjectForResource,
5
5
  readPackageJsonForCreateResource,
6
6
  writeMsgResourceFile
7
- } from "../chunk-JQKAEOL7.mjs";
7
+ } from "../chunk-PO2Z7EWJ.mjs";
8
8
  import "../chunk-F7XZRKP7.mjs";
9
9
  export {
10
10
  dynamicImportFromUrl,
@@ -5,11 +5,11 @@ import {
5
5
  importMsgResourcesFromPaths,
6
6
  serializeResourceGroupsToXliff,
7
7
  writeXliffFiles
8
- } from "../chunk-KZ47S4SH.mjs";
8
+ } from "../chunk-XMMVPJHX.mjs";
9
9
  import "../chunk-Q775ZGC5.mjs";
10
10
  import "../chunk-XID5J2F7.mjs";
11
11
  import "../chunk-MGHC4AYZ.mjs";
12
- import "../chunk-JQKAEOL7.mjs";
12
+ import "../chunk-PO2Z7EWJ.mjs";
13
13
  import "../chunk-F7XZRKP7.mjs";
14
14
  export {
15
15
  filterResourceGroupsByProject,
@@ -8,11 +8,11 @@ import {
8
8
  parseXliffFilename,
9
9
  processXliffFile,
10
10
  writeTranslationFiles
11
- } from "../chunk-77PP26JZ.mjs";
11
+ } from "../chunk-LPZ6YNLY.mjs";
12
12
  import "../chunk-Q775ZGC5.mjs";
13
13
  import "../chunk-XID5J2F7.mjs";
14
14
  import "../chunk-MGHC4AYZ.mjs";
15
- import "../chunk-JQKAEOL7.mjs";
15
+ import "../chunk-PO2Z7EWJ.mjs";
16
16
  import "../chunk-F7XZRKP7.mjs";
17
17
  export {
18
18
  extractResourceFromXliffFile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldware/msg-cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "CLI for msg library",
5
5
  "main": "dist/commands/init.cjs",
6
6
  "module": "dist/commands/init.mjs",