@lang-tag/cli 0.9.4 → 0.10.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 +1 -1
- package/{cli/config.d.ts → config.d.ts} +21 -16
- package/index.cjs +1674 -74
- package/index.js +1656 -74
- package/package.json +6 -3
- package/cli/index.cjs +0 -1492
- package/cli/index.js +0 -1474
- package/index.d.ts +0 -169
- /package/{cli/logger.d.ts → logger.d.ts} +0 -0
- /package/{cli/template → template}/base-app.mustache +0 -0
- /package/{cli/template → template}/base-library.mustache +0 -0
- /package/{cli/template → template}/placeholder.mustache +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Lang-tag
|
|
1
|
+
# Lang-tag CLI
|
|
2
2
|
|
|
3
3
|
A professional solution for managing translations in modern JavaScript/TypeScript projects, especially those using component-based architectures. `lang-tag` simplifies internationalization by allowing you to define translation keys directly within the components where they are used. Translations become local, callable function objects with full TypeScript support, IntelliSense, and compile-time safety.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LangTagTranslationsConfig } from '
|
|
1
|
+
import { LangTagTranslationsConfig } from 'lang-tag';
|
|
2
2
|
import { LangTagCLILogger } from './logger.ts';
|
|
3
3
|
export interface LangTagCLIConfig {
|
|
4
4
|
/**
|
|
@@ -98,9 +98,12 @@ export interface LangTagCLIConfig {
|
|
|
98
98
|
* A function called for each found lang tag before processing.
|
|
99
99
|
* Allows dynamic modification of the tag's configuration (namespace, path, etc.)
|
|
100
100
|
* based on the file path or other context.
|
|
101
|
-
*
|
|
101
|
+
*
|
|
102
|
+
* Changes made inside this function are **applied only if you explicitly call**
|
|
103
|
+
* `event.save(configuration)`. Returning a value or modifying the event object
|
|
104
|
+
* without calling `save()` will **not** update the configuration.
|
|
102
105
|
*/
|
|
103
|
-
onConfigGeneration: (
|
|
106
|
+
onConfigGeneration: (event: LangTagCLIConfigGenerationEvent) => Promise<void>;
|
|
104
107
|
debug?: boolean;
|
|
105
108
|
}
|
|
106
109
|
/**
|
|
@@ -131,19 +134,6 @@ export interface LangTagCLIOnImportActions {
|
|
|
131
134
|
/** Sets the configuration for the currently imported tag. */
|
|
132
135
|
setConfig: (config: LangTagTranslationsConfig) => void;
|
|
133
136
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Parameters passed to the `onConfigGeneration` configuration function.
|
|
136
|
-
*/
|
|
137
|
-
export interface LangTagCLIOnConfigGenerationParams {
|
|
138
|
-
/** The absolute path to the source file being processed. */
|
|
139
|
-
fullPath: string;
|
|
140
|
-
/** The path of the source file relative to the project root (where the command was invoked). */
|
|
141
|
-
path: string;
|
|
142
|
-
/** True if the file being processed is located within the configured library import directory (`config.import.dir`). */
|
|
143
|
-
isImportedLibrary: boolean;
|
|
144
|
-
/** The configuration object extracted from the lang tag's options argument (e.g., `{ namespace: 'common', path: 'my.path' }`). */
|
|
145
|
-
config: LangTagTranslationsConfig;
|
|
146
|
-
}
|
|
147
137
|
type Validity = 'ok' | 'invalid-param-1' | 'invalid-param-2' | 'translations-not-found';
|
|
148
138
|
export interface LangTagCLIProcessedTag {
|
|
149
139
|
fullMatch: string;
|
|
@@ -171,6 +161,21 @@ export interface LangTagCLIConflict {
|
|
|
171
161
|
tagB: LangTagCLITagConflictInfo;
|
|
172
162
|
conflictType: 'path_overwrite' | 'type_mismatch';
|
|
173
163
|
}
|
|
164
|
+
export interface LangTagCLIConfigGenerationEvent {
|
|
165
|
+
/** The absolute path to the source file being processed. */
|
|
166
|
+
absolutePath: string;
|
|
167
|
+
/** The path of the source file relative to the project root (where the command was invoked). */
|
|
168
|
+
relativePath: string;
|
|
169
|
+
/** True if the file being processed is located within the configured library import directory (`config.import.dir`). */
|
|
170
|
+
isImportedLibrary: boolean;
|
|
171
|
+
/** The configuration object extracted from the lang tag's options argument (e.g., `{ namespace: 'common', path: 'my.path' }`). */
|
|
172
|
+
config: LangTagTranslationsConfig | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Tells CLI to replace tag configuration
|
|
175
|
+
* undefined = means configuration will be removed
|
|
176
|
+
**/
|
|
177
|
+
save(config: LangTagTranslationsConfig | undefined): void;
|
|
178
|
+
}
|
|
174
179
|
export interface LangTagCLICollectConfigFixEvent {
|
|
175
180
|
config: LangTagTranslationsConfig;
|
|
176
181
|
langTagConfig: LangTagCLIConfig;
|