@let-value/translate-extract 1.1.2 → 1.1.6-beta.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.
Files changed (49) hide show
  1. package/dist/bin/cli.cjs +40 -28
  2. package/dist/bin/{cli.js → cli.mjs} +39 -23
  3. package/dist/bin/cli.mjs.map +1 -0
  4. package/dist/{configuration-CTy0NMkD.d.cts → configuration-BVNh7M_I.d.cts} +33 -12
  5. package/dist/configuration-BVNh7M_I.d.cts.map +1 -0
  6. package/dist/{configuration-fs9HmV_j.d.ts → configuration-oHJyypq5.d.mts} +34 -12
  7. package/dist/configuration-oHJyypq5.d.mts.map +1 -0
  8. package/dist/exclude-CpTGSisK.mjs +21 -0
  9. package/dist/exclude-CpTGSisK.mjs.map +1 -0
  10. package/dist/exclude-CzNSDMG-.cjs +36 -0
  11. package/dist/{run-C8z_uhxb.js → run-Bv3fv1N8.mjs} +233 -206
  12. package/dist/run-Bv3fv1N8.mjs.map +1 -0
  13. package/dist/{run-DtE6y27D.cjs → run-oGs6tkeL.cjs} +297 -247
  14. package/dist/src/core.cjs +55 -4
  15. package/dist/src/core.d.cts +2 -3
  16. package/dist/src/core.d.mts +2 -0
  17. package/dist/{core-DR3oxhSq.js → src/core.mjs} +12 -15
  18. package/dist/src/core.mjs.map +1 -0
  19. package/dist/src/index.cjs +5 -6
  20. package/dist/src/index.d.cts +2 -4
  21. package/dist/src/index.d.cts.map +1 -1
  22. package/dist/src/index.d.mts +22 -0
  23. package/dist/src/index.d.mts.map +1 -0
  24. package/dist/src/index.mjs +3 -0
  25. package/dist/src/static.cjs +31 -6
  26. package/dist/src/static.d.cts +1 -1
  27. package/dist/src/static.d.mts +2 -0
  28. package/dist/{static-DQHT7uqP.js → src/static.mjs} +2 -2
  29. package/dist/src/static.mjs.map +1 -0
  30. package/package.json +62 -57
  31. package/dist/bin/cli.js.map +0 -1
  32. package/dist/chunk-CUT6urMc.cjs +0 -30
  33. package/dist/configuration-CTy0NMkD.d.cts.map +0 -1
  34. package/dist/configuration-fs9HmV_j.d.ts.map +0 -1
  35. package/dist/core-ACuLoi2B.d.ts +0 -1
  36. package/dist/core-CHb_Xdzl.cjs +0 -65
  37. package/dist/core-CPg6_re5.d.cts +0 -1
  38. package/dist/core-DR3oxhSq.js.map +0 -1
  39. package/dist/run-C8z_uhxb.js.map +0 -1
  40. package/dist/src/core.d.ts +0 -3
  41. package/dist/src/core.js +0 -4
  42. package/dist/src/index.d.ts +0 -24
  43. package/dist/src/index.d.ts.map +0 -1
  44. package/dist/src/index.js +0 -5
  45. package/dist/src/static.d.ts +0 -2
  46. package/dist/src/static.js +0 -3
  47. package/dist/static-CNiWpXhx.cjs +0 -52
  48. package/dist/static-DQHT7uqP.js.map +0 -1
  49. /package/dist/bin/{cli.d.ts → cli.d.mts} +0 -0
package/dist/src/core.cjs CHANGED
@@ -1,4 +1,55 @@
1
- require('../static-CNiWpXhx.cjs');
2
- const require_core = require('../core-CHb_Xdzl.cjs');
3
-
4
- exports.defineConfig = require_core.defineConfig;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_exclude = require("../exclude-CzNSDMG-.cjs");
3
+ const require_src_static = require("./static.cjs");
4
+ let node_path = require("node:path");
5
+ //#region src/configuration.ts
6
+ const defaultPlugins = {
7
+ core: require_src_static.core,
8
+ po: require_src_static.po,
9
+ cleanup: require_src_static.cleanup
10
+ };
11
+ const defaultDestination = ({ entrypoint, locale }) => (0, node_path.join)((0, node_path.dirname)(entrypoint), "translations", `${(0, node_path.basename)(entrypoint, (0, node_path.extname)(entrypoint))}.${locale}.po`);
12
+ function normalizeExclude(exclude) {
13
+ if (!exclude) return [];
14
+ return Array.isArray(exclude) ? exclude : [exclude];
15
+ }
16
+ function resolveExcludes(exclude) {
17
+ if (typeof exclude === "function") return exclude(require_exclude.defaultExclude);
18
+ return [...require_exclude.defaultExcludes, ...normalizeExclude(exclude)];
19
+ }
20
+ function resolveEntrypoint(ep) {
21
+ if (typeof ep === "string") return { entrypoint: ep };
22
+ const { entrypoint, destination, obsolete, walk, exclude } = ep;
23
+ return {
24
+ entrypoint,
25
+ destination,
26
+ obsolete,
27
+ walk,
28
+ exclude: exclude ? resolveExcludes(exclude) : void 0
29
+ };
30
+ }
31
+ function resolvePlugins(user) {
32
+ if (typeof user === "function") return user(defaultPlugins);
33
+ if (Array.isArray(user)) return [...Object.values(defaultPlugins).map((plugin) => plugin()), ...user];
34
+ return Object.values(defaultPlugins).map((plugin) => plugin());
35
+ }
36
+ /**
37
+ * Type helper to make it easier to use translate.config.ts
38
+ * @param config - {@link UserConfig}.
39
+ */
40
+ function defineConfig(config) {
41
+ const defaultLocale = config.defaultLocale ?? "en";
42
+ return {
43
+ plugins: resolvePlugins(config.plugins),
44
+ entrypoints: (Array.isArray(config.entrypoints) ? config.entrypoints : [config.entrypoints]).map(resolveEntrypoint),
45
+ defaultLocale,
46
+ locales: config.locales ?? [defaultLocale],
47
+ destination: config.destination ?? defaultDestination,
48
+ obsolete: config.obsolete ?? "mark",
49
+ walk: config.walk ?? true,
50
+ logLevel: config.logLevel ?? "info",
51
+ exclude: resolveExcludes(config.exclude)
52
+ };
53
+ }
54
+ //#endregion
55
+ exports.defineConfig = defineConfig;
@@ -1,3 +1,2 @@
1
- import { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, UniversalPlugin, UserConfig, defineConfig } from "../configuration-CTy0NMkD.cjs";
2
- import "../core-CPg6_re5.cjs";
3
- export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, UniversalPlugin, UserConfig, defineConfig };
1
+ import { C as ResolveHook, S as ResolveArgs, T as UniversalPlugin, _ as LoadResult, a as ExcludeFn, b as ProcessHook, c as ResolvedEntrypoint, d as Build, f as Context, g as LoadHook, h as LoadArgs, i as ExcludeConfig, l as UserConfig, m as ImportReference, n as EntrypointConfig, o as ObsoleteStrategy, p as Filter, r as Exclude, s as ResolvedConfig, t as DestinationFn, u as defineConfig, v as Plugin, w as ResolveResult, x as ProcessResult, y as ProcessArgs } from "../configuration-BVNh7M_I.cjs";
2
+ export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn, Filter, ImportReference, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, UniversalPlugin, UserConfig, defineConfig };
@@ -0,0 +1,2 @@
1
+ import { C as ResolveHook, S as ResolveArgs, T as UniversalPlugin, _ as LoadResult, a as ExcludeFn, b as ProcessHook, c as ResolvedEntrypoint, d as Build, f as Context, g as LoadHook, h as LoadArgs, i as ExcludeConfig, l as UserConfig, m as ImportReference, n as EntrypointConfig, o as ObsoleteStrategy, p as Filter, r as Exclude, s as ResolvedConfig, t as DestinationFn, u as defineConfig, v as Plugin, w as ResolveResult, x as ProcessResult, y as ProcessArgs } from "../configuration-oHJyypq5.mjs";
2
+ export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn, Filter, ImportReference, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, UniversalPlugin, UserConfig, defineConfig };
@@ -1,6 +1,6 @@
1
- import { cleanup, core, po } from "./static-DQHT7uqP.js";
1
+ import { n as defaultExcludes, t as defaultExclude } from "../exclude-CpTGSisK.mjs";
2
+ import { cleanup, core, po } from "./static.mjs";
2
3
  import { basename, dirname, extname, join } from "node:path";
3
-
4
4
  //#region src/configuration.ts
5
5
  const defaultPlugins = {
6
6
  core,
@@ -8,15 +8,14 @@ const defaultPlugins = {
8
8
  cleanup
9
9
  };
10
10
  const defaultDestination = ({ entrypoint, locale }) => join(dirname(entrypoint), "translations", `${basename(entrypoint, extname(entrypoint))}.${locale}.po`);
11
- const defaultExclude = [
12
- /(?:^|[\\/])node_modules(?:[\\/]|$)/,
13
- /(?:^|[\\/])dist(?:[\\/]|$)/,
14
- /(?:^|[\\/])build(?:[\\/]|$)/
15
- ];
16
11
  function normalizeExclude(exclude) {
17
12
  if (!exclude) return [];
18
13
  return Array.isArray(exclude) ? exclude : [exclude];
19
14
  }
15
+ function resolveExcludes(exclude) {
16
+ if (typeof exclude === "function") return exclude(defaultExclude);
17
+ return [...defaultExcludes, ...normalizeExclude(exclude)];
18
+ }
20
19
  function resolveEntrypoint(ep) {
21
20
  if (typeof ep === "string") return { entrypoint: ep };
22
21
  const { entrypoint, destination, obsolete, walk, exclude } = ep;
@@ -25,7 +24,7 @@ function resolveEntrypoint(ep) {
25
24
  destination,
26
25
  obsolete,
27
26
  walk,
28
- exclude: exclude ? normalizeExclude(exclude) : void 0
27
+ exclude: exclude ? resolveExcludes(exclude) : void 0
29
28
  };
30
29
  }
31
30
  function resolvePlugins(user) {
@@ -39,21 +38,19 @@ function resolvePlugins(user) {
39
38
  */
40
39
  function defineConfig(config) {
41
40
  const defaultLocale = config.defaultLocale ?? "en";
42
- const plugins = resolvePlugins(config.plugins);
43
- const entrypoints = (Array.isArray(config.entrypoints) ? config.entrypoints : [config.entrypoints]).map(resolveEntrypoint);
44
41
  return {
45
- plugins,
46
- entrypoints,
42
+ plugins: resolvePlugins(config.plugins),
43
+ entrypoints: (Array.isArray(config.entrypoints) ? config.entrypoints : [config.entrypoints]).map(resolveEntrypoint),
47
44
  defaultLocale,
48
45
  locales: config.locales ?? [defaultLocale],
49
46
  destination: config.destination ?? defaultDestination,
50
47
  obsolete: config.obsolete ?? "mark",
51
48
  walk: config.walk ?? true,
52
49
  logLevel: config.logLevel ?? "info",
53
- exclude: config.exclude ? normalizeExclude(config.exclude) : defaultExclude
50
+ exclude: resolveExcludes(config.exclude)
54
51
  };
55
52
  }
56
-
57
53
  //#endregion
58
54
  export { defineConfig };
59
- //# sourceMappingURL=core-DR3oxhSq.js.map
55
+
56
+ //# sourceMappingURL=core.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.mjs","names":[],"sources":["../../src/configuration.ts"],"sourcesContent":["import { basename, dirname, extname, join } from \"node:path\";\nimport type { PluralFormsLocale } from \"@let-value/translate\";\nimport { type DefaultExclude, defaultExclude, defaultExcludes } from \"./exclude.ts\";\nimport type { LogLevel } from \"./logger.ts\";\n\nimport type { ResolveArgs, UniversalPlugin } from \"./plugin.ts\";\nimport { cleanup, core, po } from \"./static.ts\";\n\nexport type DestinationFn = (args: { locale: string; entrypoint: string; path: string }) => string;\nexport type ExcludeFn = (args: ResolveArgs) => boolean;\nexport type Exclude = RegExp | ExcludeFn;\nexport type ExcludeConfig = RegExp | Exclude[] | ((defaultExclude: DefaultExclude) => Exclude[]);\n\nconst defaultPlugins = { core, po, cleanup };\ntype DefaultPlugins = typeof defaultPlugins;\n\n/**\n * Strategy to handle obsolete translations in existing locale files:\n * - \"mark\": keep obsolete entries in the locale file but mark them as obsolete\n * - \"remove\": remove obsolete entries from the locale file\n */\nexport type ObsoleteStrategy = \"mark\" | \"remove\";\n\nexport interface EntrypointConfig {\n entrypoint: string;\n destination?: DestinationFn;\n obsolete?: ObsoleteStrategy;\n walk?: boolean;\n exclude?: ExcludeConfig;\n}\n\nexport interface UserConfig {\n /**\n * Default locale to use as the base for extraction\n * @default \"en\"\n * @see {@link PluralFormsLocale} for available locales\n */\n defaultLocale?: PluralFormsLocale;\n /**\n * Array of locales to extract translations for\n * @default [defaultLocale]\n * @see {@link PluralFormsLocale} for available locales\n */\n locales?: PluralFormsLocale[];\n /**\n * Array of plugins to use or a function to override the default plugins\n * @default DefaultPlugins\n * @see {@link DefaultPlugins} for available plugins\n */\n plugins?: UniversalPlugin[] | ((defaultPlugins: DefaultPlugins) => UniversalPlugin[]);\n /**\n * One or more entrypoints to extract translations from, could be:\n * - file path, will be treated as a single file entrypoint\n * - glob pattern will be expanded to match files, each treated as a separate entrypoint\n * - configuration object with options for the entrypoint\n * @see {@link EntrypointConfig} for configuration options\n */\n entrypoints: string | EntrypointConfig | Array<string | EntrypointConfig>;\n /**\n * Function to determine the destination path for each extracted locale file\n * @default `./translations/entrypoint.locale.po`\n * @see {@link DestinationFn}\n * @see Can be overridden per entrypoint via `destination` in {@link EntrypointConfig\n */\n destination?: DestinationFn;\n /**\n * Strategy to handle obsolete translations in existing locale files\n * @default \"mark\"\n * @see {@link ObsoleteStrategy} for available strategies\n * @see Can be overridden per entrypoint via `obsolete` in {@link EntrypointConfig\n */\n obsolete?: ObsoleteStrategy;\n /**\n * Whether to recursively walk dependencies of the entrypoints\n * @default true\n * @see Can be overridden per entrypoint via `walk` in {@link EntrypointConfig}.\n */\n walk?: boolean;\n /**\n * Paths or patterns to exclude from extraction, applied to all entrypoints\n * @default [/node_modules/, /dist/, /build/]\n * @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.\n */\n exclude?: ExcludeConfig;\n /**\n * Log level for the extraction process\n * @default \"info\"\n */\n logLevel?: LogLevel;\n}\n\nexport interface ResolvedEntrypoint extends Omit<EntrypointConfig, \"exclude\"> {\n exclude?: Exclude[];\n}\n\nexport interface ResolvedConfig {\n plugins: UniversalPlugin[];\n entrypoints: ResolvedEntrypoint[];\n defaultLocale: string;\n locales: string[];\n destination: DestinationFn;\n obsolete: ObsoleteStrategy;\n walk: boolean;\n logLevel: LogLevel;\n exclude: Exclude[];\n}\n\nconst defaultDestination: DestinationFn = ({ entrypoint, locale }) =>\n join(dirname(entrypoint), \"translations\", `${basename(entrypoint, extname(entrypoint))}.${locale}.po`);\n\nfunction normalizeExclude(exclude?: RegExp | Exclude[]): Exclude[] {\n if (!exclude) return [];\n return Array.isArray(exclude) ? exclude : [exclude];\n}\n\nfunction resolveExcludes(exclude?: ExcludeConfig): Exclude[] {\n if (typeof exclude === \"function\") {\n return exclude(defaultExclude);\n }\n\n return [...defaultExcludes, ...normalizeExclude(exclude)];\n}\n\nfunction resolveEntrypoint(ep: string | EntrypointConfig): ResolvedEntrypoint {\n if (typeof ep === \"string\") {\n return { entrypoint: ep };\n }\n const { entrypoint, destination, obsolete, walk, exclude } = ep;\n return {\n entrypoint,\n destination,\n obsolete,\n walk,\n exclude: exclude ? resolveExcludes(exclude) : undefined,\n };\n}\n\nfunction resolvePlugins(user?: UserConfig[\"plugins\"]): UniversalPlugin[] {\n if (typeof user === \"function\") {\n return user(defaultPlugins);\n }\n if (Array.isArray(user)) {\n return [...Object.values(defaultPlugins).map((plugin) => plugin()), ...user];\n }\n return Object.values(defaultPlugins).map((plugin) => plugin());\n}\n\n/**\n * Type helper to make it easier to use translate.config.ts\n * @param config - {@link UserConfig}.\n */\nexport function defineConfig(config: UserConfig): ResolvedConfig {\n const defaultLocale = config.defaultLocale ?? \"en\";\n\n const plugins = resolvePlugins(config.plugins);\n\n const raw = Array.isArray(config.entrypoints) ? config.entrypoints : [config.entrypoints];\n const entrypoints = raw.map(resolveEntrypoint);\n\n return {\n plugins,\n entrypoints,\n defaultLocale,\n locales: config.locales ?? [defaultLocale],\n destination: config.destination ?? defaultDestination,\n obsolete: config.obsolete ?? \"mark\",\n walk: config.walk ?? true,\n logLevel: config.logLevel ?? \"info\",\n exclude: resolveExcludes(config.exclude),\n };\n}\n"],"mappings":";;;;AAaA,MAAM,iBAAiB;CAAE;CAAM;CAAI;AAAQ;AA8F3C,MAAM,sBAAqC,EAAE,YAAY,aACrD,KAAK,QAAQ,UAAU,GAAG,gBAAgB,GAAG,SAAS,YAAY,QAAQ,UAAU,CAAC,EAAE,GAAG,OAAO,IAAI;AAEzG,SAAS,iBAAiB,SAAyC;CAC/D,IAAI,CAAC,SAAS,OAAO,CAAC;CACtB,OAAO,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AACtD;AAEA,SAAS,gBAAgB,SAAoC;CACzD,IAAI,OAAO,YAAY,YACnB,OAAO,QAAQ,cAAc;CAGjC,OAAO,CAAC,GAAG,iBAAiB,GAAG,iBAAiB,OAAO,CAAC;AAC5D;AAEA,SAAS,kBAAkB,IAAmD;CAC1E,IAAI,OAAO,OAAO,UACd,OAAO,EAAE,YAAY,GAAG;CAE5B,MAAM,EAAE,YAAY,aAAa,UAAU,MAAM,YAAY;CAC7D,OAAO;EACH;EACA;EACA;EACA;EACA,SAAS,UAAU,gBAAgB,OAAO,IAAI,KAAA;CAClD;AACJ;AAEA,SAAS,eAAe,MAAiD;CACrE,IAAI,OAAO,SAAS,YAChB,OAAO,KAAK,cAAc;CAE9B,IAAI,MAAM,QAAQ,IAAI,GAClB,OAAO,CAAC,GAAG,OAAO,OAAO,cAAc,CAAC,CAAC,KAAK,WAAW,OAAO,CAAC,GAAG,GAAG,IAAI;CAE/E,OAAO,OAAO,OAAO,cAAc,CAAC,CAAC,KAAK,WAAW,OAAO,CAAC;AACjE;;;;;AAMA,SAAgB,aAAa,QAAoC;CAC7D,MAAM,gBAAgB,OAAO,iBAAiB;CAO9C,OAAO;EACH,SANY,eAAe,OAAO,OAM5B;EACN,cALQ,MAAM,QAAQ,OAAO,WAAW,IAAI,OAAO,cAAc,CAAC,OAAO,WAAW,EAAA,CAChE,IAAI,iBAId;EACV;EACA,SAAS,OAAO,WAAW,CAAC,aAAa;EACzC,aAAa,OAAO,eAAe;EACnC,UAAU,OAAO,YAAY;EAC7B,MAAM,OAAO,QAAQ;EACrB,UAAU,OAAO,YAAY;EAC7B,SAAS,gBAAgB,OAAO,OAAO;CAC3C;AACJ"}
@@ -1,10 +1,9 @@
1
- const require_run = require('../run-DtE6y27D.cjs');
2
- require('../static-CNiWpXhx.cjs');
3
- const require_core = require('../core-CHb_Xdzl.cjs');
4
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_run = require("../run-oGs6tkeL.cjs");
3
+ const require_src_core = require("./core.cjs");
5
4
  exports.cleanup = require_run.cleanup;
6
5
  exports.core = require_run.core;
7
- exports.defineConfig = require_core.defineConfig;
6
+ exports.defineConfig = require_src_core.defineConfig;
8
7
  exports.po = require_run.po;
9
8
  exports.react = require_run.react;
10
- exports.run = require_run.run;
9
+ exports.run = require_run.run;
@@ -1,6 +1,4 @@
1
- import { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, Logger, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, UniversalPlugin, UserConfig, cleanup$1 as cleanup, core$1 as core, defineConfig, po$1 as po, react$1 as react } from "../configuration-CTy0NMkD.cjs";
2
- import "../core-CPg6_re5.cjs";
3
-
1
+ import { C as ResolveHook, F as Logger, M as po, N as core, P as cleanup, S as ResolveArgs, T as UniversalPlugin, _ as LoadResult, a as ExcludeFn, b as ProcessHook, c as ResolvedEntrypoint, d as Build, f as Context, g as LoadHook, h as LoadArgs, i as ExcludeConfig, j as react, l as UserConfig, m as ImportReference, n as EntrypointConfig, o as ObsoleteStrategy, p as Filter, r as Exclude, s as ResolvedConfig, t as DestinationFn, u as defineConfig, v as Plugin, w as ResolveResult, x as ProcessResult, y as ProcessArgs } from "../configuration-BVNh7M_I.cjs";
4
2
  //#region src/run.d.ts
5
3
  type Task = {
6
4
  type: "resolve";
@@ -20,5 +18,5 @@ declare function run(entrypoint: ResolvedEntrypoint, {
20
18
  logger?: Logger;
21
19
  }): Promise<void>;
22
20
  //#endregion
23
- export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, Task, UniversalPlugin, UserConfig, cleanup, core, defineConfig, po, react, run };
21
+ export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn, Filter, ImportReference, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, Task, UniversalPlugin, UserConfig, cleanup, core, defineConfig, po, react, run };
24
22
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/run.ts"],"sourcesContent":[],"mappings":";;;;KAkBY,IAAA;EAAA,IAAA,EAAA,SAAI;EAAA,IAAA,EAGA,WAHA;;MAOA,EAAA,MAAA;MAIA,EAJA,QAIA;CAAW,GAAA;EASL,IAAA,EAAG,SAAA;EAAA,IAAA,EATT,WASS;;AAEnB,iBAFgB,GAAA,CAEhB,UAAA,EADU,kBACV,EAAA;EAAA,MAAA;EAAA;CAAA,EAAA;QAAQ,EAAoB,cAApB;QAAoB,CAAA,EAAyB,MAAzB;IAAiC,OAAR,CAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/run.ts"],"mappings":";;KAoBY,IAAA;EAEF,IAAA;EACA,IAAA,EAAM,WAAA;AAAA;EAGN,IAAA;EACA,IAAA,EAAM,QAAA;AAAA;EAGN,IAAA;EACA,IAAA,EAAM,WAAA;AAAA;AAAA,iBASM,GAAA,CAClB,UAAA,EAAY,kBAAA;EACV,MAAA;EAAQ;AAAA;EAAY,MAAA,EAAQ,cAAA;EAAgB,MAAA,GAAS,MAAA;AAAA,IAAQ,OAAA"}
@@ -0,0 +1,22 @@
1
+ import { C as ResolveHook, F as Logger, M as po, N as core, P as cleanup, S as ResolveArgs, T as UniversalPlugin, _ as LoadResult, a as ExcludeFn, b as ProcessHook, c as ResolvedEntrypoint, d as Build, f as Context, g as LoadHook, h as LoadArgs, i as ExcludeConfig, j as react, l as UserConfig, m as ImportReference, n as EntrypointConfig, o as ObsoleteStrategy, p as Filter, r as Exclude, s as ResolvedConfig, t as DestinationFn, u as defineConfig, v as Plugin, w as ResolveResult, x as ProcessResult, y as ProcessArgs } from "../configuration-oHJyypq5.mjs";
2
+ //#region src/run.d.ts
3
+ type Task = {
4
+ type: "resolve";
5
+ args: ResolveArgs;
6
+ } | {
7
+ type: "load";
8
+ args: LoadArgs;
9
+ } | {
10
+ type: "process";
11
+ args: ProcessArgs;
12
+ };
13
+ declare function run(entrypoint: ResolvedEntrypoint, {
14
+ config,
15
+ logger
16
+ }: {
17
+ config: ResolvedConfig;
18
+ logger?: Logger;
19
+ }): Promise<void>;
20
+ //#endregion
21
+ export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeConfig, ExcludeFn, Filter, ImportReference, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, Task, UniversalPlugin, UserConfig, cleanup, core, defineConfig, po, react, run };
22
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/run.ts"],"mappings":";;KAoBY,IAAA;EAEF,IAAA;EACA,IAAA,EAAM,WAAA;AAAA;EAGN,IAAA;EACA,IAAA,EAAM,QAAA;AAAA;EAGN,IAAA;EACA,IAAA,EAAM,WAAA;AAAA;AAAA,iBASM,GAAA,CAClB,UAAA,EAAY,kBAAA;EACV,MAAA;EAAQ;AAAA;EAAY,MAAA,EAAQ,cAAA;EAAgB,MAAA,GAAS,MAAA;AAAA,IAAQ,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { defineConfig } from "./core.mjs";
2
+ import { a as cleanup, i as core, n as react, r as po, t as run } from "../run-Bv3fv1N8.mjs";
3
+ export { cleanup, core, defineConfig, po, react, run };
@@ -1,6 +1,31 @@
1
- const require_static = require('../static-CNiWpXhx.cjs');
2
-
3
- exports.cleanup = require_static.cleanup;
4
- exports.core = require_static.core;
5
- exports.po = require_static.po;
6
- exports.react = require_static.react;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/static.ts
3
+ function core(...props) {
4
+ return { static: {
5
+ name: "core",
6
+ props
7
+ } };
8
+ }
9
+ function react(...props) {
10
+ return { static: {
11
+ name: "react",
12
+ props
13
+ } };
14
+ }
15
+ function po(...props) {
16
+ return { static: {
17
+ name: "po",
18
+ props
19
+ } };
20
+ }
21
+ function cleanup(...props) {
22
+ return { static: {
23
+ name: "cleanup",
24
+ props
25
+ } };
26
+ }
27
+ //#endregion
28
+ exports.cleanup = cleanup;
29
+ exports.core = core;
30
+ exports.po = po;
31
+ exports.react = react;
@@ -1,2 +1,2 @@
1
- import { StaticPlugin, cleanup, core, po, react } from "../configuration-CTy0NMkD.cjs";
1
+ import { A as react, D as cleanup, E as StaticPlugin, O as core, k as po } from "../configuration-BVNh7M_I.cjs";
2
2
  export { StaticPlugin, cleanup, core, po, react };
@@ -0,0 +1,2 @@
1
+ import { A as react, D as cleanup, E as StaticPlugin, O as core, k as po } from "../configuration-oHJyypq5.mjs";
2
+ export { StaticPlugin, cleanup, core, po, react };
@@ -23,7 +23,7 @@ function cleanup(...props) {
23
23
  props
24
24
  } };
25
25
  }
26
-
27
26
  //#endregion
28
27
  export { cleanup, core, po, react };
29
- //# sourceMappingURL=static-DQHT7uqP.js.map
28
+
29
+ //# sourceMappingURL=static.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static.mjs","names":[],"sources":["../../src/static.ts"],"sourcesContent":["import type { cleanup as cleanupPlugin } from \"./plugins/cleanup/cleanup.ts\";\nimport type { core as corePlugin } from \"./plugins/core/core.ts\";\nimport type { po as poPlugin } from \"./plugins/po/po.ts\";\nimport type { react as reactPlugin } from \"./plugins/react/react.ts\";\n\nexport function core(...props: Parameters<typeof corePlugin>) {\n return {\n static: {\n name: \"core\",\n props,\n },\n } as const;\n}\n\nexport function react(...props: Parameters<typeof reactPlugin>) {\n return {\n static: {\n name: \"react\",\n props,\n },\n } as const;\n}\nexport function po(...props: Parameters<typeof poPlugin>) {\n return {\n static: {\n name: \"po\",\n props,\n },\n } as const;\n}\n\nexport function cleanup(...props: Parameters<typeof cleanupPlugin>) {\n return {\n static: {\n name: \"cleanup\",\n props,\n },\n } as const;\n}\n\nexport type StaticPlugin =\n | ReturnType<typeof core>\n | ReturnType<typeof react>\n | ReturnType<typeof po>\n | ReturnType<typeof cleanup>;\n"],"mappings":";AAKA,SAAgB,KAAK,GAAG,OAAsC;CAC1D,OAAO,EACH,QAAQ;EACJ,MAAM;EACN;CACJ,EACJ;AACJ;AAEA,SAAgB,MAAM,GAAG,OAAuC;CAC5D,OAAO,EACH,QAAQ;EACJ,MAAM;EACN;CACJ,EACJ;AACJ;AACA,SAAgB,GAAG,GAAG,OAAoC;CACtD,OAAO,EACH,QAAQ;EACJ,MAAM;EACN;CACJ,EACJ;AACJ;AAEA,SAAgB,QAAQ,GAAG,OAAyC;CAChE,OAAO,EACH,QAAQ;EACJ,MAAM;EACN;CACJ,EACJ;AACJ"}
package/package.json CHANGED
@@ -1,62 +1,67 @@
1
1
  {
2
- "name": "@let-value/translate-extract",
3
- "version": "1.1.2",
4
- "type": "module",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "extract": "dist/bin/cli.js"
2
+ "name": "@let-value/translate-extract",
3
+ "version": "1.1.6-beta.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/let-value/translate"
7
+ },
8
+ "bin": {
9
+ "extract": "dist/bin/cli.mjs"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "type": "module",
15
+ "main": "dist/src/index.cjs",
16
+ "module": "dist/src/index.mjs",
17
+ "types": "dist/src/index.d.mts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/src/index.d.mts",
21
+ "import": "./dist/src/index.mjs",
22
+ "require": "./dist/src/index.cjs"
10
23
  },
11
- "exports": {
12
- ".": {
13
- "types": "./dist/src/index.d.ts",
14
- "import": "./dist/src/index.js",
15
- "require": "./dist/src/index.cjs"
16
- },
17
- "./core": {
18
- "types": "./dist/src/core.d.ts",
19
- "import": "./dist/src/core.js",
20
- "require": "./dist/src/core.cjs"
21
- },
22
- "./static": {
23
- "types": "./dist/src/static.d.ts",
24
- "import": "./dist/src/static.js",
25
- "require": "./dist/src/static.cjs"
26
- },
27
- "./cli": {
28
- "import": "./dist/bin/cli.js",
29
- "require": "./dist/bin/cli.cjs"
30
- },
31
- "./package.json": "./package.json"
24
+ "./core": {
25
+ "types": "./dist/src/core.d.mts",
26
+ "import": "./dist/src/core.mjs",
27
+ "require": "./dist/src/core.cjs"
32
28
  },
33
- "files": [
34
- "dist"
35
- ],
36
- "dependencies": {
37
- "@let-value/translate": "1.1.2",
38
- "chalk": "5.3.0",
39
- "cosmiconfig": "9.0.0",
40
- "fast-glob": "3.3.2",
41
- "gettext-parser": "8.0.0",
42
- "loglevel": "1.9.1",
43
- "loglevel-plugin-prefix": "0.8.4",
44
- "oxc-resolver": "11.8.0",
45
- "plural-forms": "0.5.5",
46
- "@keqingmoe/tree-sitter": "0.26.2",
47
- "tree-sitter-javascript": "0.25.0",
48
- "tree-sitter-typescript": "0.23.2"
29
+ "./static": {
30
+ "types": "./dist/src/static.d.mts",
31
+ "import": "./dist/src/static.mjs",
32
+ "require": "./dist/src/static.cjs"
49
33
  },
50
- "devDependencies": {
51
- "@types/gettext-parser": "8.0.0",
52
- "tsdown": "0.15.2",
53
- "typescript": "5.9.2"
34
+ "./cli": {
35
+ "bun": "./bin/cli.ts",
36
+ "import": "./dist/bin/cli.mjs",
37
+ "require": "./dist/bin/cli.cjs"
54
38
  },
55
- "scripts": {
56
- "build": "tsdown",
57
- "check": "biome check .",
58
- "format": "biome check --write .",
59
- "typecheck": "tsc --build",
60
- "test": "node --test"
61
- }
62
- }
39
+ "./package.json": "./package.json"
40
+ },
41
+ "dependencies": {
42
+ "@keqingmoe/tree-sitter": "0.26.2",
43
+ "chalk": "5.6.2",
44
+ "fast-glob": "3.3.3",
45
+ "gettext-parser": "9.0.2",
46
+ "lilconfig": "3.1.3",
47
+ "loglevel": "1.9.2",
48
+ "loglevel-plugin-prefix": "0.8.4",
49
+ "oxc-resolver": "11.21.3",
50
+ "plural-forms": "0.5.5",
51
+ "tree-sitter-javascript": "0.25.0",
52
+ "tree-sitter-typescript": "0.23.2",
53
+ "@let-value/translate": "1.1.6-beta.1"
54
+ },
55
+ "devDependencies": {
56
+ "@types/gettext-parser": "9.0.0",
57
+ "typescript": "6.0.3",
58
+ "vite-plus": "latest"
59
+ },
60
+ "scripts": {
61
+ "build": "vp pack",
62
+ "check": "vp check",
63
+ "format": "vp fmt",
64
+ "typecheck": "tsc --build",
65
+ "test": "vp test"
66
+ }
67
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","names":["colors: Record<LogLevel, ChalkInstance>","defaultLogLevel: LogLevel","config: ResolvedConfig"],"sources":["../../src/logger.ts","../../bin/cli.ts"],"sourcesContent":["import chalk, { type ChalkInstance } from \"chalk\";\nimport log from \"loglevel\";\nimport prefix from \"loglevel-plugin-prefix\";\n\nexport type Logger = log.Logger;\nexport type LogLevelNames = log.LogLevelNames;\nexport type LogLevel = LogLevelNames;\n\nconst colors: Record<LogLevel, ChalkInstance> = {\n trace: chalk.magenta,\n debug: chalk.cyan,\n info: chalk.blue,\n warn: chalk.yellow,\n error: chalk.red,\n};\n\nprefix.reg(log);\nprefix.apply(log, {\n format(level, name) {\n const color = colors[level as LogLevelNames] ?? ((value: string) => value);\n const scope = name ? ` ${chalk.green(`${name}:`)}` : \"\";\n\n return `${color(level)}${scope}`;\n },\n});\n\nexport const logger = log;\n","#!/usr/bin/env node\n\nimport { parseArgs } from \"node:util\";\nimport { cosmiconfig } from \"cosmiconfig\";\nimport type { ResolvedConfig } from \"../src/configuration.ts\";\nimport { type LogLevel, logger } from \"../src/logger.ts\";\nimport { run } from \"../src/run.ts\";\n\nconst moduleName = \"translate\";\nconst defaultLogLevel: LogLevel = \"info\";\n\nfunction unwrapConfig(\n config: ResolvedConfig | { default: ResolvedConfig } | { translateConfig: ResolvedConfig } | undefined,\n) {\n if (config && typeof config === \"object\" && \"default\" in config) {\n return config.default;\n }\n\n if (config && typeof config === \"object\" && \"translateConfig\" in config) {\n return config.translateConfig;\n }\n\n return config;\n}\n\nasync function main() {\n const {\n values: { logLevel },\n } = parseArgs({\n args: process.argv.slice(2),\n options: {\n logLevel: { type: \"string\", short: \"l\" },\n },\n });\n\n const explorer = cosmiconfig(moduleName, {\n searchPlaces: [\n `.${moduleName}rc.js`,\n `.${moduleName}rc.ts`,\n `.${moduleName}rc.mjs`,\n `.${moduleName}rc.cjs`,\n `.config/${moduleName}rc.js`,\n `.config/${moduleName}rc.ts`,\n `.config/${moduleName}rc.mjs`,\n `.config/${moduleName}rc.cjs`,\n `${moduleName}.config.js`,\n `${moduleName}.config.ts`,\n `${moduleName}.config.mjs`,\n `${moduleName}.config.cjs`,\n ],\n });\n\n const result = await explorer.search();\n if (!result || !result.config) {\n logger.error(\"No configuration file found\");\n process.exit(1);\n }\n\n const resolvedConfig = unwrapConfig(result.config);\n if (!resolvedConfig) {\n logger.error(\"Invalid configuration file\");\n process.exit(1);\n }\n\n const effectiveLogLevel = (logLevel as LogLevel | undefined) ?? resolvedConfig.logLevel ?? defaultLogLevel;\n const config: ResolvedConfig = {\n ...resolvedConfig,\n logLevel: effectiveLogLevel,\n };\n logger.setLevel(effectiveLogLevel);\n\n for (const entrypoint of config.entrypoints) {\n await run(entrypoint, { config, logger });\n }\n}\n\nvoid main().catch((err) => {\n logger.error(err);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;AAQA,MAAMA,SAA0C;CAC5C,OAAO,MAAM;CACb,OAAO,MAAM;CACb,MAAM,MAAM;CACZ,MA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G;EACH,UAAU;EACb;AACD,QAAO,SAAS,kBAAkB;AAElC,MAAK,MAAM,cAAc,OAAO,YAC5B,OAAM,IAAI,YAAY;EAAE;EAAQ;EAAQ,CAAC;;AAI5C,MAAM,CAAC,OAAO,QAAQ;AACvB,QAAO,MAAM,IAAI;AACjB,SAAQ,KAAK,EAAE;EACjB"}
@@ -1,30 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
-
25
- Object.defineProperty(exports, '__toESM', {
26
- enumerable: true,
27
- get: function () {
28
- return __toESM;
29
- }
30
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration-CTy0NMkD.d.cts","names":[],"sources":["../src/logger.ts","../src/plugins/cleanup/cleanup.ts","../src/plugins/core/queries/types.ts","../src/plugins/core/core.ts","../src/plugins/po/po.ts","../src/plugins/react/react.ts","../src/static.ts","../src/plugin.ts","../src/configuration.ts"],"sourcesContent":[],"mappings":";;;;KAIY,MAAA,GAAS,GAAA,CAAI;KACb,aAAA,GAAgB,GAAA,CAAI;KACp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O,EAAA;;;;AAQrB;;SAA+C,CAAA,EEyBjC,eFzBiC,EAAA,GAAA,CAAA,CAAA,cAAA,EEyBK,cFzBL,EAAA,GEyBwB,eFzBxB,EAAA,CAAA;;;AAS/C;;;;;EASY,WAAA,EAAA,MAAY,GEeE,gBFfF,GEeqB,KFfrB,CAAA,MAAA,GEeoC,gBFfpC,CAAA;EAAA;;;;;;aAGlB,CAAA,EEmBY,aFnBZ;;;;;;;ECvCD,QAAA,CAAA,ECiEU,gBDjEE;EAAA;;;;;EAEA,IAAA,CAAA,EAAA,OAAO;EAAA;;;;;EAIL,OAAA,CAAA,ECuEL,ODvEK,GCuEK,ODvEL,EAAA;EAGF;AAOjB;AAOA;AAOA;EAOiB,QAAA,CAAA,EC6CF,QD7Ca;AAO5B;AAOY,UCkCK,kBAAA,SAA2B,IDlCP,CCkCY,gBDlCZ,EAAA,SAAA,CAAA,CAAA;EACzB,OAAA,CAAA,ECkCE,ODlCS,EAAA;;AACD,UCoCL,cAAA,CDpCK;SAAZ,ECqCG,eDrCH,EAAA;aACsB,ECqCf,kBDrCe,EAAA;eAAd,EAAA,MAAA;SAAb,EAAA,MAAA,EAAA;EAAY,WAAA,ECwCA,aDxCA;EACL,QAAA,ECwCE,gBDxCM;EAAA,IAAA,EAAA,OAAA;UAAqC,EC0C3C,QD1C2C;SAAT,EC2CnC,OD3CmC,EAAA;;;;;AAChD;AAAuB,iBCiFP,YAAA,CDjFO,MAAA,ECiFc,UDjFd,CAAA,ECiF2B,cDjF3B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration-fs9HmV_j.d.ts","names":[],"sources":["../src/logger.ts","../src/plugins/cleanup/cleanup.ts","../src/plugins/core/queries/types.ts","../src/plugins/core/core.ts","../src/plugins/po/po.ts","../src/plugins/react/react.ts","../src/static.ts","../src/plugin.ts","../src/configuration.ts"],"sourcesContent":[],"mappings":";;;;;KAIY,MAAA,GAAS,GAAA,CAAI;KACb,aAAA,GAAgB,GAAA,CAAI;KACpB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F3BO,EAAA;EAAA;;;;AAQrB;EAAkB,OAAA,CAAA,EEyBJ,eFzBI,EAAA,GAAA,CAAA,CAAA,cAAA,EEyBkC,cFzBlC,EAAA,GEyBqD,eFzBrD,EAAA,CAAA;;;;AASlB;;;;EAA4C,WAAA,EAAA,MAAA,GEwBlB,gBFxBkB,GEwBC,KFxBD,CAAA,MAAA,GEwBgB,gBFxBhB,CAAA;EAShC;;;;;;aAGY,CAAA,EEmBN,aFnBM;;;;;;;aE0BT;EDjEV;;;;;EAA6B,IAAA,CAAA,EAAA,OAAA;EAEjB;;;;;SAIJ,CAAA,ECuEC,ODvED,GCuEW,ODvEX,EAAA;EAAM;AAGnB;AAOA;AAOA;EAOiB,QAAA,CAAA,ECoDF,QDpDY;AAO3B;AAOiB,UCyCA,kBAAA,SAA2B,IDrC3B,CCqCgC,gBDrChC,EAAA,SAAA,CAAA,CAAA;EAGL,OAAA,CAAA,ECmCE,ODnCI,EAAA;AAClB;AAAuB,UCqCN,cAAA,CDrCM;SACD,ECqCT,eDrCS,EAAA;aAAZ,ECsCO,kBDtCP,EAAA;eACsB,EAAA,MAAA;SAAd,EAAA,MAAA,EAAA;aAAb,ECwCY,aDxCZ;EAAY,QAAA,ECyCH,gBDzCG;EACL,IAAA,EAAA,OAAQ;EAAA,QAAA,EC0CN,QD1CM;SAAqC,EC2C5C,OD3C4C,EAAA;;;;;;AAC7C,iBCiFI,YAAA,CDjFO,MAAA,ECiFc,UDjFd,CAAA,ECiF2B,cDjF3B"}
@@ -1 +0,0 @@
1
- export { };
@@ -1,65 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_static = require('./static-CNiWpXhx.cjs');
3
- let node_path = require("node:path");
4
- node_path = require_chunk.__toESM(node_path);
5
-
6
- //#region src/configuration.ts
7
- const defaultPlugins = {
8
- core: require_static.core,
9
- po: require_static.po,
10
- cleanup: require_static.cleanup
11
- };
12
- const defaultDestination = ({ entrypoint, locale }) => (0, node_path.join)((0, node_path.dirname)(entrypoint), "translations", `${(0, node_path.basename)(entrypoint, (0, node_path.extname)(entrypoint))}.${locale}.po`);
13
- const defaultExclude = [
14
- /(?:^|[\\/])node_modules(?:[\\/]|$)/,
15
- /(?:^|[\\/])dist(?:[\\/]|$)/,
16
- /(?:^|[\\/])build(?:[\\/]|$)/
17
- ];
18
- function normalizeExclude(exclude) {
19
- if (!exclude) return [];
20
- return Array.isArray(exclude) ? exclude : [exclude];
21
- }
22
- function resolveEntrypoint(ep) {
23
- if (typeof ep === "string") return { entrypoint: ep };
24
- const { entrypoint, destination, obsolete, walk, exclude } = ep;
25
- return {
26
- entrypoint,
27
- destination,
28
- obsolete,
29
- walk,
30
- exclude: exclude ? normalizeExclude(exclude) : void 0
31
- };
32
- }
33
- function resolvePlugins(user) {
34
- if (typeof user === "function") return user(defaultPlugins);
35
- if (Array.isArray(user)) return [...Object.values(defaultPlugins).map((plugin) => plugin()), ...user];
36
- return Object.values(defaultPlugins).map((plugin) => plugin());
37
- }
38
- /**
39
- * Type helper to make it easier to use translate.config.ts
40
- * @param config - {@link UserConfig}.
41
- */
42
- function defineConfig(config) {
43
- const defaultLocale = config.defaultLocale ?? "en";
44
- const plugins = resolvePlugins(config.plugins);
45
- const entrypoints = (Array.isArray(config.entrypoints) ? config.entrypoints : [config.entrypoints]).map(resolveEntrypoint);
46
- return {
47
- plugins,
48
- entrypoints,
49
- defaultLocale,
50
- locales: config.locales ?? [defaultLocale],
51
- destination: config.destination ?? defaultDestination,
52
- obsolete: config.obsolete ?? "mark",
53
- walk: config.walk ?? true,
54
- logLevel: config.logLevel ?? "info",
55
- exclude: config.exclude ? normalizeExclude(config.exclude) : defaultExclude
56
- };
57
- }
58
-
59
- //#endregion
60
- Object.defineProperty(exports, 'defineConfig', {
61
- enumerable: true,
62
- get: function () {
63
- return defineConfig;
64
- }
65
- });
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-DR3oxhSq.js","names":["defaultDestination: DestinationFn","defaultExclude: Exclude[]"],"sources":["../src/configuration.ts"],"sourcesContent":["import { basename, dirname, extname, join } from \"node:path\";\nimport type { PluralFormsLocale } from \"@let-value/translate\";\nimport type { LogLevel } from \"./logger.ts\";\n\nimport type { UniversalPlugin } from \"./plugin.ts\";\nimport { cleanup, core, po } from \"./static.ts\";\n\nexport type DestinationFn = (args: { locale: string; entrypoint: string; path: string }) => string;\nexport type ExcludeFn = (args: { entrypoint: string; path: string }) => boolean;\nexport type Exclude = RegExp | ExcludeFn;\n\nconst defaultPlugins = { core, po, cleanup };\ntype DefaultPlugins = typeof defaultPlugins;\n\n/**\n * Strategy to handle obsolete translations in existing locale files:\n * - \"mark\": keep obsolete entries in the locale file but mark them as obsolete\n * - \"remove\": remove obsolete entries from the locale file\n */\nexport type ObsoleteStrategy = \"mark\" | \"remove\";\n\nexport interface EntrypointConfig {\n entrypoint: string;\n destination?: DestinationFn;\n obsolete?: ObsoleteStrategy;\n walk?: boolean;\n exclude?: Exclude | Exclude[];\n}\n\nexport interface UserConfig {\n /**\n * Default locale to use as the base for extraction\n * @default \"en\"\n * @see {@link PluralFormsLocale} for available locales\n */\n defaultLocale?: PluralFormsLocale;\n /**\n * Array of locales to extract translations for\n * @default [defaultLocale]\n * @see {@link PluralFormsLocale} for available locales\n */\n locales?: PluralFormsLocale[];\n /**\n * Array of plugins to use or a function to override the default plugins\n * @default DefaultPlugins\n * @see {@link DefaultPlugins} for available plugins\n */\n plugins?: UniversalPlugin[] | ((defaultPlugins: DefaultPlugins) => UniversalPlugin[]);\n /**\n * One or more entrypoints to extract translations from, could be:\n * - file path, will be treated as a single file entrypoint\n * - glob pattern will be expanded to match files, each treated as a separate entrypoint\n * - configuration object with options for the entrypoint\n * @see {@link EntrypointConfig} for configuration options\n */\n entrypoints: string | EntrypointConfig | Array<string | EntrypointConfig>;\n /**\n * Function to determine the destination path for each extracted locale file\n * @default `./translations/entrypoint.locale.po`\n * @see {@link DestinationFn}\n * @see Can be overridden per entrypoint via `destination` in {@link EntrypointConfig\n */\n destination?: DestinationFn;\n /**\n * Strategy to handle obsolete translations in existing locale files\n * @default \"mark\"\n * @see {@link ObsoleteStrategy} for available strategies\n * @see Can be overridden per entrypoint via `obsolete` in {@link EntrypointConfig\n */\n obsolete?: ObsoleteStrategy;\n /**\n * Whether to recursively walk dependencies of the entrypoints\n * @default true\n * @see Can be overridden per entrypoint via `walk` in {@link EntrypointConfig}.\n */\n walk?: boolean;\n /**\n * Paths or patterns to exclude from extraction, applied to all entrypoints\n * @default [/node_modules/, /dist/, /build/]\n * @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.\n */\n exclude?: Exclude | Exclude[];\n /**\n * Log level for the extraction process\n * @default \"info\"\n */\n logLevel?: LogLevel;\n}\n\nexport interface ResolvedEntrypoint extends Omit<EntrypointConfig, \"exclude\"> {\n exclude?: Exclude[];\n}\n\nexport interface ResolvedConfig {\n plugins: UniversalPlugin[];\n entrypoints: ResolvedEntrypoint[];\n defaultLocale: string;\n locales: string[];\n destination: DestinationFn;\n obsolete: ObsoleteStrategy;\n walk: boolean;\n logLevel: LogLevel;\n exclude: Exclude[];\n}\n\nconst defaultDestination: DestinationFn = ({ entrypoint, locale }) =>\n join(dirname(entrypoint), \"translations\", `${basename(entrypoint, extname(entrypoint))}.${locale}.po`);\n\nconst defaultExclude: Exclude[] = [\n /(?:^|[\\\\/])node_modules(?:[\\\\/]|$)/,\n /(?:^|[\\\\/])dist(?:[\\\\/]|$)/,\n /(?:^|[\\\\/])build(?:[\\\\/]|$)/,\n];\n\nfunction normalizeExclude(exclude?: Exclude | Exclude[]): Exclude[] {\n if (!exclude) return [];\n return Array.isArray(exclude) ? exclude : [exclude];\n}\n\nfunction resolveEntrypoint(ep: string | EntrypointConfig): ResolvedEntrypoint {\n if (typeof ep === \"string\") {\n return { entrypoint: ep };\n }\n const { entrypoint, destination, obsolete, walk, exclude } = ep;\n return { entrypoint, destination, obsolete, walk, exclude: exclude ? normalizeExclude(exclude) : undefined };\n}\n\nfunction resolvePlugins(user?: UserConfig[\"plugins\"]): UniversalPlugin[] {\n if (typeof user === \"function\") {\n return user(defaultPlugins);\n }\n if (Array.isArray(user)) {\n return [...Object.values(defaultPlugins).map((plugin) => plugin()), ...user];\n }\n return Object.values(defaultPlugins).map((plugin) => plugin());\n}\n\n/**\n * Type helper to make it easier to use translate.config.ts\n * @param config - {@link UserConfig}.\n */\nexport function defineConfig(config: UserConfig): ResolvedConfig {\n const defaultLocale = config.defaultLocale ?? \"en\";\n\n const plugins = resolvePlugins(config.plugins);\n\n const raw = Array.isArray(config.entrypoints) ? config.entrypoints : [config.entrypoints];\n const entrypoints = raw.map(resolveEntrypoint);\n\n return {\n plugins,\n entrypoints,\n defaultLocale,\n locales: config.locales ?? [defaultLocale],\n destination: config.destination ?? defaultDestination,\n obsolete: config.obsolete ?? \"mark\",\n walk: config.walk ?? true,\n logLevel: config.logLevel ?? \"info\",\n exclude: config.exclude ? normalizeExclude(config.exclude) : defaultExclude,\n };\n}\n"],"mappings":";;;;AAWA,MAAM,iBAAiB;CAAE;CAAM;CAAI;CAAS;AA8F5C,MAAMA,sBAAqC,EAAE,YAAY,aACrD,KAAK,QAAQ,WAAW,EAAE,gBAAgB,GAAG,SAAS,YAAY,QAAQ,WAAW,CAAC,CAAC,GAAG,OAAO,KAAK;AAE1G,MAAMC,iBAA4B;CAC9B;CACA;CACA;CACH;AAED,SAAS,iBAAiB,SAA0C;AAChE,KAAI,CAAC,QAAS,QAAO,EAAE;AACvB,QAAO,MAAM,QAAQ,QAAQ,GAAG,UAAU,CAAC,QAAQ;;AAGvD,SAAS,kBAAkB,IAAmD;AAC1E,KAAI,OAAO,OAAO,SACd,QAAO,EAAE,YAAY,IAAI;CAE7B,MAAM,EAAE,YAAY,aAAa,UAAU,MAAM,YAAY;AAC7D,QAAO;EAAE;EAAY;EAAa;EAAU;EAAM,SAAS,UAAU,iBAAiB,QAAQ,GAAG;EAAW;;AAGhH,SAAS,eAAe,MAAiD;A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