@let-value/translate-extract-static 1.1.6-beta.3 → 1.2.3
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/cli.d.cts +1 -1
- package/dist/bin/cli.d.mts +1 -1
- package/dist/scripts/postinstall.d.cts +1 -1
- package/dist/scripts/postinstall.d.mts +1 -1
- package/dist/src/index.d.cts +74 -62
- package/dist/src/index.d.mts +74 -62
- package/package.json +3 -3
package/dist/bin/cli.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/bin/cli.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/src/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "@keqingmoe/tree-sitter";
|
|
1
2
|
//#region ../node_modules/.pnpm/loglevel@1.9.2/node_modules/loglevel/index.d.ts
|
|
2
3
|
// Originally from Definitely Typed, see:
|
|
3
4
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b4683d7/types/loglevel/index.d.ts
|
|
@@ -175,16 +176,14 @@ declare namespace log {
|
|
|
175
176
|
//#endregion
|
|
176
177
|
//#region ../translate/dist/index.d.mts
|
|
177
178
|
//#region src/locales.d.ts
|
|
178
|
-
type PluralFormsLocale = "ach" | "af" | "ak" | "am" | "an" | "ar" | "arn" | "ast" | "ay" | "az" | "be" | "bg" | "bn" | "bo" | "br" | "brx" | "bs" | "ca" | "cgg" | "cs" | "csb" | "cy" | "da" | "de" | "doi" | "dz" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fil" | "fo" | "fr" | "fur" | "fy" | "ga" | "gd" | "gl" | "gu" | "gun" | "ha" | "he" | "hi" | "hne" | "hr" | "hu" | "hy" | "id" | "is" | "it" | "ja" | "jbo" | "jv" | "ka" | "kab" | "kk" | "km" | "kn" | "ko" | "ku" | "kw" | "ky" | "lb" | "ln" | "lo" | "lt" | "lv" | "mai" | "mfe" | "mg" | "mi" | "mk" | "ml" | "mn" | "mni" | "mnk" | "mr" | "ms" | "mt" | "my" | "nah" | "nap" | "nb" | "ne" | "nl" | "nn" | "no" | "nso" | "oc" | "or" | "pa" | "pap" | "pl" | "pms" | "ps" | "pt" | "rm" | "ro" | "ru" | "rw" | "sah" | "sat" | "sco" | "sd" | "se" | "si" | "sk" | "sl" | "so" | "son" | "sq" | "sr" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "th" | "ti" | "tk" | "tr" | "tt" | "ug" | "uk" | "ur" | "uz" | "vi" | "wa" | "wo" | "yo" | "zh";
|
|
179
|
-
//#region src/config.d.ts
|
|
179
|
+
type PluralFormsLocale = "ach" | "af" | "ak" | "am" | "an" | "ar" | "arn" | "ast" | "ay" | "az" | "be" | "bg" | "bn" | "bo" | "br" | "brx" | "bs" | "ca" | "cgg" | "cs" | "csb" | "cy" | "da" | "de" | "doi" | "dz" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fil" | "fo" | "fr" | "fur" | "fy" | "ga" | "gd" | "gl" | "gu" | "gun" | "ha" | "he" | "hi" | "hne" | "hr" | "hu" | "hy" | "id" | "is" | "it" | "ja" | "jbo" | "jv" | "ka" | "kab" | "kk" | "km" | "kn" | "ko" | "ku" | "kw" | "ky" | "lb" | "ln" | "lo" | "lt" | "lv" | "mai" | "mfe" | "mg" | "mi" | "mk" | "ml" | "mn" | "mni" | "mnk" | "mr" | "ms" | "mt" | "my" | "nah" | "nap" | "nb" | "ne" | "nl" | "nn" | "no" | "nso" | "oc" | "or" | "pa" | "pap" | "pl" | "pms" | "ps" | "pt" | "rm" | "ro" | "ru" | "rw" | "sah" | "sat" | "sco" | "sd" | "se" | "si" | "sk" | "sl" | "so" | "son" | "sq" | "sr" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "th" | "ti" | "tk" | "tr" | "tt" | "ug" | "uk" | "ur" | "uz" | "vi" | "wa" | "wo" | "yo" | "zh";
|
|
180
180
|
//#endregion
|
|
181
|
-
//#region ../extract/dist/configuration-
|
|
181
|
+
//#region ../extract/dist/configuration-Bwtek7Fh.d.mts
|
|
182
182
|
//#region src/logger.d.ts
|
|
183
183
|
type Logger$1 = log.Logger;
|
|
184
184
|
type LogLevelNames$1 = log.LogLevelNames;
|
|
185
|
-
type LogLevel$1 = LogLevelNames$1;
|
|
186
|
-
//#
|
|
187
|
-
declare function cleanup$1(): Plugin; //#endregion
|
|
185
|
+
type LogLevel$1 = LogLevelNames$1;
|
|
186
|
+
//#endregion
|
|
188
187
|
//#region src/plugins/core/queries/types.d.ts
|
|
189
188
|
interface Comments {
|
|
190
189
|
translator?: string;
|
|
@@ -200,13 +199,20 @@ interface Translation {
|
|
|
200
199
|
message: string[];
|
|
201
200
|
comments?: Comments;
|
|
202
201
|
obsolete?: boolean;
|
|
203
|
-
}
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/plugins/cleanup/cleanup.d.ts
|
|
205
|
+
declare function cleanup$1(): Plugin;
|
|
206
|
+
//#endregion
|
|
204
207
|
//#region src/plugins/core/core.d.ts
|
|
205
|
-
declare function core$1(): Plugin
|
|
208
|
+
declare function core$1(): Plugin;
|
|
209
|
+
//#endregion
|
|
206
210
|
//#region src/plugins/po/po.d.ts
|
|
207
|
-
declare function po$1(): Plugin;
|
|
211
|
+
declare function po$1(): Plugin;
|
|
212
|
+
//#endregion
|
|
208
213
|
//#region src/plugins/react/react.d.ts
|
|
209
|
-
declare function react$1(): Plugin
|
|
214
|
+
declare function react$1(): Plugin;
|
|
215
|
+
//#endregion
|
|
210
216
|
//#region src/static.d.ts
|
|
211
217
|
declare function core(...props: Parameters<typeof core$1>): {
|
|
212
218
|
readonly static: {
|
|
@@ -232,12 +238,14 @@ declare function cleanup(...props: Parameters<typeof cleanup$1>): {
|
|
|
232
238
|
readonly props: [];
|
|
233
239
|
};
|
|
234
240
|
};
|
|
235
|
-
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react> | ReturnType<typeof po> | ReturnType<typeof cleanup>;
|
|
241
|
+
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react> | ReturnType<typeof po> | ReturnType<typeof cleanup>;
|
|
242
|
+
//#endregion
|
|
236
243
|
//#region src/plugin.d.ts
|
|
237
244
|
type MaybePromise<T> = T | Promise<T>;
|
|
238
245
|
interface Context {
|
|
239
246
|
config: ResolvedConfig;
|
|
240
247
|
generatedAt: Date;
|
|
248
|
+
/** Entrypoint roots discovered in this run (including promoted ones). */
|
|
241
249
|
paths: Set<string>;
|
|
242
250
|
logger?: Logger$1;
|
|
243
251
|
}
|
|
@@ -246,6 +254,7 @@ interface ImportReference {
|
|
|
246
254
|
kind: "static" | "dynamic";
|
|
247
255
|
typeOnly: boolean;
|
|
248
256
|
}
|
|
257
|
+
/** Arguments passed to exclude filters. */
|
|
249
258
|
interface ResolveArgs<TInput = unknown> {
|
|
250
259
|
entrypoint: string;
|
|
251
260
|
path: string;
|
|
@@ -253,76 +262,79 @@ interface ResolveArgs<TInput = unknown> {
|
|
|
253
262
|
import?: ImportReference;
|
|
254
263
|
data?: TInput;
|
|
255
264
|
}
|
|
256
|
-
interface
|
|
265
|
+
interface SourceArgs {
|
|
257
266
|
entrypoint: string;
|
|
258
267
|
path: string;
|
|
259
|
-
namespace: string;
|
|
260
268
|
import?: ImportReference;
|
|
261
|
-
data?: TInput;
|
|
262
269
|
}
|
|
263
|
-
interface LoadArgs
|
|
270
|
+
interface LoadArgs {
|
|
264
271
|
entrypoint: string;
|
|
265
272
|
path: string;
|
|
266
|
-
namespace: string;
|
|
267
|
-
data?: TInput;
|
|
268
273
|
}
|
|
269
|
-
|
|
274
|
+
/** Produces the contents of a source file; return undefined to let the next loader try. */
|
|
275
|
+
type LoadHook = (args: LoadArgs) => MaybePromise<string | undefined>;
|
|
276
|
+
interface ProcessArgs {
|
|
270
277
|
entrypoint: string;
|
|
271
278
|
path: string;
|
|
272
|
-
|
|
273
|
-
|
|
279
|
+
contents: string;
|
|
280
|
+
/** Emits translations extracted from this file. */
|
|
281
|
+
emit(translations: Translation[]): void;
|
|
274
282
|
}
|
|
275
|
-
|
|
276
|
-
|
|
283
|
+
/** Runs for every loaded source file. Return a non-undefined value to stop later processors for this file. */
|
|
284
|
+
type ProcessHook = (args: ProcessArgs) => MaybePromise<unknown>;
|
|
285
|
+
interface FileTranslations {
|
|
277
286
|
path: string;
|
|
278
|
-
|
|
279
|
-
data: TInput;
|
|
287
|
+
translations: Translation[];
|
|
280
288
|
}
|
|
281
|
-
interface
|
|
289
|
+
interface CollectedArgs {
|
|
282
290
|
entrypoint: string;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
291
|
+
/** Translations of every processed source file of this entrypoint, one entry per file. */
|
|
292
|
+
files: FileTranslations[];
|
|
293
|
+
/**
|
|
294
|
+
* Schedules an output artifact. Every entrypoint's onCollected hook has
|
|
295
|
+
* run by the time any producer does, so a producer may read state the
|
|
296
|
+
* hook keeps across entrypoints. Outputs run in parallel; writes to the
|
|
297
|
+
* same path are serialized.
|
|
298
|
+
*/
|
|
299
|
+
output(path: string, produce: () => MaybePromise<void>): void;
|
|
286
300
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
301
|
+
/** Runs once per entrypoint, after all of its source files settled and translations are known. */
|
|
302
|
+
type CollectedHook = (args: CollectedArgs) => MaybePromise<void>;
|
|
303
|
+
interface OutputsArgs {
|
|
304
|
+
/** Every output path produced in this run, across all entrypoints. */
|
|
305
|
+
outputs: string[];
|
|
306
|
+
}
|
|
307
|
+
/** Runs once per run, after every entrypoint produced its outputs. */
|
|
308
|
+
type OutputsHook = (args: OutputsArgs) => MaybePromise<void>;
|
|
309
|
+
interface Build {
|
|
295
310
|
context: Context;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
/**
|
|
312
|
+
* Discovers a source file. When `path` equals `entrypoint` a new
|
|
313
|
+
* extraction pipeline is started for it (entrypoint promotion);
|
|
314
|
+
* otherwise the file joins the given entrypoint's walk. Excluded and
|
|
315
|
+
* already-known paths are ignored.
|
|
316
|
+
*/
|
|
317
|
+
source(args: SourceArgs): void;
|
|
318
|
+
onLoad(filter: RegExp, hook: LoadHook): void;
|
|
319
|
+
onProcess(filter: RegExp, hook: ProcessHook): void;
|
|
320
|
+
onCollected(hook: CollectedHook): void;
|
|
321
|
+
onOutputs(hook: OutputsHook): void;
|
|
304
322
|
}
|
|
305
|
-
interface Plugin
|
|
323
|
+
interface Plugin {
|
|
306
324
|
name: string;
|
|
307
|
-
setup(build: Build
|
|
325
|
+
setup(build: Build): void;
|
|
308
326
|
}
|
|
309
|
-
type UniversalPlugin = Plugin | StaticPlugin;
|
|
327
|
+
type UniversalPlugin = Plugin | StaticPlugin;
|
|
328
|
+
//#endregion
|
|
310
329
|
//#region src/exclude.d.ts
|
|
311
330
|
declare const defaultExclude: {
|
|
312
|
-
readonly modules: ({
|
|
313
|
-
|
|
314
|
-
}: ResolveArgs) => boolean;
|
|
315
|
-
readonly
|
|
316
|
-
path
|
|
317
|
-
}: ResolveArgs) => boolean;
|
|
318
|
-
readonly build: ({
|
|
319
|
-
path
|
|
320
|
-
}: ResolveArgs) => boolean;
|
|
321
|
-
readonly types: ({
|
|
322
|
-
import: imp
|
|
323
|
-
}: ResolveArgs) => boolean;
|
|
331
|
+
readonly modules: ({ path }: ResolveArgs) => boolean;
|
|
332
|
+
readonly dist: ({ path }: ResolveArgs) => boolean;
|
|
333
|
+
readonly build: ({ path }: ResolveArgs) => boolean;
|
|
334
|
+
readonly types: ({ import: imp }: ResolveArgs) => boolean;
|
|
324
335
|
};
|
|
325
|
-
type DefaultExclude = typeof defaultExclude;
|
|
336
|
+
type DefaultExclude = typeof defaultExclude;
|
|
337
|
+
//#endregion
|
|
326
338
|
//#region src/configuration.d.ts
|
|
327
339
|
type DestinationFn = (args: {
|
|
328
340
|
locale: string;
|
|
@@ -428,6 +440,6 @@ interface ResolvedConfig {
|
|
|
428
440
|
* Type helper to make it easier to use translate.config.ts
|
|
429
441
|
* @param config - {@link UserConfig}.
|
|
430
442
|
*/
|
|
431
|
-
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
443
|
+
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
432
444
|
//#endregion
|
|
433
|
-
export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn,
|
|
445
|
+
export { Build, CollectedArgs, CollectedHook, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn, FileTranslations, ImportReference, LoadArgs, LoadHook, ObsoleteStrategy, OutputsArgs, OutputsHook, Plugin, ProcessArgs, ProcessHook, ResolveArgs, ResolvedConfig, ResolvedEntrypoint, SourceArgs, StaticPlugin, UniversalPlugin, UserConfig, cleanup, core, defineConfig, po, react };
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "@keqingmoe/tree-sitter";
|
|
1
2
|
//#region ../node_modules/.pnpm/loglevel@1.9.2/node_modules/loglevel/index.d.ts
|
|
2
3
|
// Originally from Definitely Typed, see:
|
|
3
4
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b4683d7/types/loglevel/index.d.ts
|
|
@@ -175,16 +176,14 @@ declare namespace log {
|
|
|
175
176
|
//#endregion
|
|
176
177
|
//#region ../translate/dist/index.d.mts
|
|
177
178
|
//#region src/locales.d.ts
|
|
178
|
-
type PluralFormsLocale = "ach" | "af" | "ak" | "am" | "an" | "ar" | "arn" | "ast" | "ay" | "az" | "be" | "bg" | "bn" | "bo" | "br" | "brx" | "bs" | "ca" | "cgg" | "cs" | "csb" | "cy" | "da" | "de" | "doi" | "dz" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fil" | "fo" | "fr" | "fur" | "fy" | "ga" | "gd" | "gl" | "gu" | "gun" | "ha" | "he" | "hi" | "hne" | "hr" | "hu" | "hy" | "id" | "is" | "it" | "ja" | "jbo" | "jv" | "ka" | "kab" | "kk" | "km" | "kn" | "ko" | "ku" | "kw" | "ky" | "lb" | "ln" | "lo" | "lt" | "lv" | "mai" | "mfe" | "mg" | "mi" | "mk" | "ml" | "mn" | "mni" | "mnk" | "mr" | "ms" | "mt" | "my" | "nah" | "nap" | "nb" | "ne" | "nl" | "nn" | "no" | "nso" | "oc" | "or" | "pa" | "pap" | "pl" | "pms" | "ps" | "pt" | "rm" | "ro" | "ru" | "rw" | "sah" | "sat" | "sco" | "sd" | "se" | "si" | "sk" | "sl" | "so" | "son" | "sq" | "sr" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "th" | "ti" | "tk" | "tr" | "tt" | "ug" | "uk" | "ur" | "uz" | "vi" | "wa" | "wo" | "yo" | "zh";
|
|
179
|
-
//#region src/config.d.ts
|
|
179
|
+
type PluralFormsLocale = "ach" | "af" | "ak" | "am" | "an" | "ar" | "arn" | "ast" | "ay" | "az" | "be" | "bg" | "bn" | "bo" | "br" | "brx" | "bs" | "ca" | "cgg" | "cs" | "csb" | "cy" | "da" | "de" | "doi" | "dz" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fil" | "fo" | "fr" | "fur" | "fy" | "ga" | "gd" | "gl" | "gu" | "gun" | "ha" | "he" | "hi" | "hne" | "hr" | "hu" | "hy" | "id" | "is" | "it" | "ja" | "jbo" | "jv" | "ka" | "kab" | "kk" | "km" | "kn" | "ko" | "ku" | "kw" | "ky" | "lb" | "ln" | "lo" | "lt" | "lv" | "mai" | "mfe" | "mg" | "mi" | "mk" | "ml" | "mn" | "mni" | "mnk" | "mr" | "ms" | "mt" | "my" | "nah" | "nap" | "nb" | "ne" | "nl" | "nn" | "no" | "nso" | "oc" | "or" | "pa" | "pap" | "pl" | "pms" | "ps" | "pt" | "rm" | "ro" | "ru" | "rw" | "sah" | "sat" | "sco" | "sd" | "se" | "si" | "sk" | "sl" | "so" | "son" | "sq" | "sr" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "th" | "ti" | "tk" | "tr" | "tt" | "ug" | "uk" | "ur" | "uz" | "vi" | "wa" | "wo" | "yo" | "zh";
|
|
180
180
|
//#endregion
|
|
181
|
-
//#region ../extract/dist/configuration-
|
|
181
|
+
//#region ../extract/dist/configuration-Bwtek7Fh.d.mts
|
|
182
182
|
//#region src/logger.d.ts
|
|
183
183
|
type Logger$1 = log.Logger;
|
|
184
184
|
type LogLevelNames$1 = log.LogLevelNames;
|
|
185
|
-
type LogLevel$1 = LogLevelNames$1;
|
|
186
|
-
//#
|
|
187
|
-
declare function cleanup$1(): Plugin; //#endregion
|
|
185
|
+
type LogLevel$1 = LogLevelNames$1;
|
|
186
|
+
//#endregion
|
|
188
187
|
//#region src/plugins/core/queries/types.d.ts
|
|
189
188
|
interface Comments {
|
|
190
189
|
translator?: string;
|
|
@@ -200,13 +199,20 @@ interface Translation {
|
|
|
200
199
|
message: string[];
|
|
201
200
|
comments?: Comments;
|
|
202
201
|
obsolete?: boolean;
|
|
203
|
-
}
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/plugins/cleanup/cleanup.d.ts
|
|
205
|
+
declare function cleanup$1(): Plugin;
|
|
206
|
+
//#endregion
|
|
204
207
|
//#region src/plugins/core/core.d.ts
|
|
205
|
-
declare function core$1(): Plugin
|
|
208
|
+
declare function core$1(): Plugin;
|
|
209
|
+
//#endregion
|
|
206
210
|
//#region src/plugins/po/po.d.ts
|
|
207
|
-
declare function po$1(): Plugin;
|
|
211
|
+
declare function po$1(): Plugin;
|
|
212
|
+
//#endregion
|
|
208
213
|
//#region src/plugins/react/react.d.ts
|
|
209
|
-
declare function react$1(): Plugin
|
|
214
|
+
declare function react$1(): Plugin;
|
|
215
|
+
//#endregion
|
|
210
216
|
//#region src/static.d.ts
|
|
211
217
|
declare function core(...props: Parameters<typeof core$1>): {
|
|
212
218
|
readonly static: {
|
|
@@ -232,12 +238,14 @@ declare function cleanup(...props: Parameters<typeof cleanup$1>): {
|
|
|
232
238
|
readonly props: [];
|
|
233
239
|
};
|
|
234
240
|
};
|
|
235
|
-
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react> | ReturnType<typeof po> | ReturnType<typeof cleanup>;
|
|
241
|
+
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react> | ReturnType<typeof po> | ReturnType<typeof cleanup>;
|
|
242
|
+
//#endregion
|
|
236
243
|
//#region src/plugin.d.ts
|
|
237
244
|
type MaybePromise<T> = T | Promise<T>;
|
|
238
245
|
interface Context {
|
|
239
246
|
config: ResolvedConfig;
|
|
240
247
|
generatedAt: Date;
|
|
248
|
+
/** Entrypoint roots discovered in this run (including promoted ones). */
|
|
241
249
|
paths: Set<string>;
|
|
242
250
|
logger?: Logger$1;
|
|
243
251
|
}
|
|
@@ -246,6 +254,7 @@ interface ImportReference {
|
|
|
246
254
|
kind: "static" | "dynamic";
|
|
247
255
|
typeOnly: boolean;
|
|
248
256
|
}
|
|
257
|
+
/** Arguments passed to exclude filters. */
|
|
249
258
|
interface ResolveArgs<TInput = unknown> {
|
|
250
259
|
entrypoint: string;
|
|
251
260
|
path: string;
|
|
@@ -253,76 +262,79 @@ interface ResolveArgs<TInput = unknown> {
|
|
|
253
262
|
import?: ImportReference;
|
|
254
263
|
data?: TInput;
|
|
255
264
|
}
|
|
256
|
-
interface
|
|
265
|
+
interface SourceArgs {
|
|
257
266
|
entrypoint: string;
|
|
258
267
|
path: string;
|
|
259
|
-
namespace: string;
|
|
260
268
|
import?: ImportReference;
|
|
261
|
-
data?: TInput;
|
|
262
269
|
}
|
|
263
|
-
interface LoadArgs
|
|
270
|
+
interface LoadArgs {
|
|
264
271
|
entrypoint: string;
|
|
265
272
|
path: string;
|
|
266
|
-
namespace: string;
|
|
267
|
-
data?: TInput;
|
|
268
273
|
}
|
|
269
|
-
|
|
274
|
+
/** Produces the contents of a source file; return undefined to let the next loader try. */
|
|
275
|
+
type LoadHook = (args: LoadArgs) => MaybePromise<string | undefined>;
|
|
276
|
+
interface ProcessArgs {
|
|
270
277
|
entrypoint: string;
|
|
271
278
|
path: string;
|
|
272
|
-
|
|
273
|
-
|
|
279
|
+
contents: string;
|
|
280
|
+
/** Emits translations extracted from this file. */
|
|
281
|
+
emit(translations: Translation[]): void;
|
|
274
282
|
}
|
|
275
|
-
|
|
276
|
-
|
|
283
|
+
/** Runs for every loaded source file. Return a non-undefined value to stop later processors for this file. */
|
|
284
|
+
type ProcessHook = (args: ProcessArgs) => MaybePromise<unknown>;
|
|
285
|
+
interface FileTranslations {
|
|
277
286
|
path: string;
|
|
278
|
-
|
|
279
|
-
data: TInput;
|
|
287
|
+
translations: Translation[];
|
|
280
288
|
}
|
|
281
|
-
interface
|
|
289
|
+
interface CollectedArgs {
|
|
282
290
|
entrypoint: string;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
291
|
+
/** Translations of every processed source file of this entrypoint, one entry per file. */
|
|
292
|
+
files: FileTranslations[];
|
|
293
|
+
/**
|
|
294
|
+
* Schedules an output artifact. Every entrypoint's onCollected hook has
|
|
295
|
+
* run by the time any producer does, so a producer may read state the
|
|
296
|
+
* hook keeps across entrypoints. Outputs run in parallel; writes to the
|
|
297
|
+
* same path are serialized.
|
|
298
|
+
*/
|
|
299
|
+
output(path: string, produce: () => MaybePromise<void>): void;
|
|
286
300
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
301
|
+
/** Runs once per entrypoint, after all of its source files settled and translations are known. */
|
|
302
|
+
type CollectedHook = (args: CollectedArgs) => MaybePromise<void>;
|
|
303
|
+
interface OutputsArgs {
|
|
304
|
+
/** Every output path produced in this run, across all entrypoints. */
|
|
305
|
+
outputs: string[];
|
|
306
|
+
}
|
|
307
|
+
/** Runs once per run, after every entrypoint produced its outputs. */
|
|
308
|
+
type OutputsHook = (args: OutputsArgs) => MaybePromise<void>;
|
|
309
|
+
interface Build {
|
|
295
310
|
context: Context;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
/**
|
|
312
|
+
* Discovers a source file. When `path` equals `entrypoint` a new
|
|
313
|
+
* extraction pipeline is started for it (entrypoint promotion);
|
|
314
|
+
* otherwise the file joins the given entrypoint's walk. Excluded and
|
|
315
|
+
* already-known paths are ignored.
|
|
316
|
+
*/
|
|
317
|
+
source(args: SourceArgs): void;
|
|
318
|
+
onLoad(filter: RegExp, hook: LoadHook): void;
|
|
319
|
+
onProcess(filter: RegExp, hook: ProcessHook): void;
|
|
320
|
+
onCollected(hook: CollectedHook): void;
|
|
321
|
+
onOutputs(hook: OutputsHook): void;
|
|
304
322
|
}
|
|
305
|
-
interface Plugin
|
|
323
|
+
interface Plugin {
|
|
306
324
|
name: string;
|
|
307
|
-
setup(build: Build
|
|
325
|
+
setup(build: Build): void;
|
|
308
326
|
}
|
|
309
|
-
type UniversalPlugin = Plugin | StaticPlugin;
|
|
327
|
+
type UniversalPlugin = Plugin | StaticPlugin;
|
|
328
|
+
//#endregion
|
|
310
329
|
//#region src/exclude.d.ts
|
|
311
330
|
declare const defaultExclude: {
|
|
312
|
-
readonly modules: ({
|
|
313
|
-
|
|
314
|
-
}: ResolveArgs) => boolean;
|
|
315
|
-
readonly
|
|
316
|
-
path
|
|
317
|
-
}: ResolveArgs) => boolean;
|
|
318
|
-
readonly build: ({
|
|
319
|
-
path
|
|
320
|
-
}: ResolveArgs) => boolean;
|
|
321
|
-
readonly types: ({
|
|
322
|
-
import: imp
|
|
323
|
-
}: ResolveArgs) => boolean;
|
|
331
|
+
readonly modules: ({ path }: ResolveArgs) => boolean;
|
|
332
|
+
readonly dist: ({ path }: ResolveArgs) => boolean;
|
|
333
|
+
readonly build: ({ path }: ResolveArgs) => boolean;
|
|
334
|
+
readonly types: ({ import: imp }: ResolveArgs) => boolean;
|
|
324
335
|
};
|
|
325
|
-
type DefaultExclude = typeof defaultExclude;
|
|
336
|
+
type DefaultExclude = typeof defaultExclude;
|
|
337
|
+
//#endregion
|
|
326
338
|
//#region src/configuration.d.ts
|
|
327
339
|
type DestinationFn = (args: {
|
|
328
340
|
locale: string;
|
|
@@ -428,6 +440,6 @@ interface ResolvedConfig {
|
|
|
428
440
|
* Type helper to make it easier to use translate.config.ts
|
|
429
441
|
* @param config - {@link UserConfig}.
|
|
430
442
|
*/
|
|
431
|
-
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
443
|
+
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
432
444
|
//#endregion
|
|
433
|
-
export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn,
|
|
445
|
+
export { Build, CollectedArgs, CollectedHook, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn, FileTranslations, ImportReference, LoadArgs, LoadHook, ObsoleteStrategy, OutputsArgs, OutputsHook, Plugin, ProcessArgs, ProcessHook, ResolveArgs, ResolvedConfig, ResolvedEntrypoint, SourceArgs, StaticPlugin, UniversalPlugin, UserConfig, cleanup, core, defineConfig, po, react };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@let-value/translate-extract-static",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/let-value/translate"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@types/node": "26.0.1",
|
|
33
33
|
"typescript": "6.0.3",
|
|
34
34
|
"vite-plus": "latest",
|
|
35
|
-
"@let-value/translate": "1.
|
|
36
|
-
"@let-value/translate-extract": "1.
|
|
35
|
+
"@let-value/translate": "1.2.3",
|
|
36
|
+
"@let-value/translate-extract": "1.2.3"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"postinstall": "node postinstall.cjs",
|