@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.
- package/dist/bin/cli.cjs +40 -28
- package/dist/bin/{cli.js → cli.mjs} +39 -23
- package/dist/bin/cli.mjs.map +1 -0
- package/dist/{configuration-CTy0NMkD.d.cts → configuration-BVNh7M_I.d.cts} +33 -12
- package/dist/configuration-BVNh7M_I.d.cts.map +1 -0
- package/dist/{configuration-fs9HmV_j.d.ts → configuration-oHJyypq5.d.mts} +34 -12
- package/dist/configuration-oHJyypq5.d.mts.map +1 -0
- package/dist/exclude-CpTGSisK.mjs +21 -0
- package/dist/exclude-CpTGSisK.mjs.map +1 -0
- package/dist/exclude-CzNSDMG-.cjs +36 -0
- package/dist/{run-C8z_uhxb.js → run-Bv3fv1N8.mjs} +233 -206
- package/dist/run-Bv3fv1N8.mjs.map +1 -0
- package/dist/{run-DtE6y27D.cjs → run-oGs6tkeL.cjs} +297 -247
- package/dist/src/core.cjs +55 -4
- package/dist/src/core.d.cts +2 -3
- package/dist/src/core.d.mts +2 -0
- package/dist/{core-DR3oxhSq.js → src/core.mjs} +12 -15
- package/dist/src/core.mjs.map +1 -0
- package/dist/src/index.cjs +5 -6
- package/dist/src/index.d.cts +2 -4
- package/dist/src/index.d.cts.map +1 -1
- package/dist/src/index.d.mts +22 -0
- package/dist/src/index.d.mts.map +1 -0
- package/dist/src/index.mjs +3 -0
- package/dist/src/static.cjs +31 -6
- package/dist/src/static.d.cts +1 -1
- package/dist/src/static.d.mts +2 -0
- package/dist/{static-DQHT7uqP.js → src/static.mjs} +2 -2
- package/dist/src/static.mjs.map +1 -0
- package/package.json +62 -57
- package/dist/bin/cli.js.map +0 -1
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/configuration-CTy0NMkD.d.cts.map +0 -1
- package/dist/configuration-fs9HmV_j.d.ts.map +0 -1
- package/dist/core-ACuLoi2B.d.ts +0 -1
- package/dist/core-CHb_Xdzl.cjs +0 -65
- package/dist/core-CPg6_re5.d.cts +0 -1
- package/dist/core-DR3oxhSq.js.map +0 -1
- package/dist/run-C8z_uhxb.js.map +0 -1
- package/dist/src/core.d.ts +0 -3
- package/dist/src/core.js +0 -4
- package/dist/src/index.d.ts +0 -24
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -5
- package/dist/src/static.d.ts +0 -2
- package/dist/src/static.js +0 -3
- package/dist/static-CNiWpXhx.cjs +0 -52
- package/dist/static-DQHT7uqP.js.map +0 -1
- /package/dist/bin/{cli.d.ts → cli.d.mts} +0 -0
package/dist/bin/cli.cjs
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
3
|
-
const require_run = require('../run-DtE6y27D.cjs');
|
|
2
|
+
const require_run = require("../run-oGs6tkeL.cjs");
|
|
4
3
|
let node_util = require("node:util");
|
|
5
|
-
node_util = require_chunk.__toESM(node_util);
|
|
6
|
-
let cosmiconfig = require("cosmiconfig");
|
|
7
|
-
cosmiconfig = require_chunk.__toESM(cosmiconfig);
|
|
8
4
|
let chalk = require("chalk");
|
|
9
|
-
chalk =
|
|
5
|
+
chalk = require_run.__toESM(chalk, 1);
|
|
10
6
|
let loglevel = require("loglevel");
|
|
11
|
-
loglevel =
|
|
7
|
+
loglevel = require_run.__toESM(loglevel, 1);
|
|
12
8
|
let loglevel_plugin_prefix = require("loglevel-plugin-prefix");
|
|
13
|
-
loglevel_plugin_prefix =
|
|
14
|
-
|
|
9
|
+
loglevel_plugin_prefix = require_run.__toESM(loglevel_plugin_prefix, 1);
|
|
10
|
+
let node_url = require("node:url");
|
|
11
|
+
let lilconfig = require("lilconfig");
|
|
15
12
|
//#region src/logger.ts
|
|
16
13
|
const colors = {
|
|
17
14
|
trace: chalk.default.magenta,
|
|
@@ -27,16 +24,45 @@ loglevel_plugin_prefix.default.apply(loglevel.default, { format(level, name) {
|
|
|
27
24
|
return `${color(level)}${scope}`;
|
|
28
25
|
} });
|
|
29
26
|
const logger = loglevel.default;
|
|
30
|
-
|
|
31
27
|
//#endregion
|
|
32
|
-
//#region bin/
|
|
28
|
+
//#region bin/config-loader.ts
|
|
33
29
|
const moduleName = "translate";
|
|
34
|
-
const
|
|
30
|
+
const configModuleLoader = async (filepath) => {
|
|
31
|
+
const configModule = await import((0, node_url.pathToFileURL)(filepath).href);
|
|
32
|
+
return configModule.default ?? configModule;
|
|
33
|
+
};
|
|
35
34
|
function unwrapConfig(config) {
|
|
36
35
|
if (config && typeof config === "object" && "default" in config) return config.default;
|
|
37
36
|
if (config && typeof config === "object" && "translateConfig" in config) return config.translateConfig;
|
|
38
37
|
return config;
|
|
39
38
|
}
|
|
39
|
+
function createConfigExplorer() {
|
|
40
|
+
return (0, lilconfig.lilconfig)(moduleName, {
|
|
41
|
+
loaders: {
|
|
42
|
+
".js": configModuleLoader,
|
|
43
|
+
".ts": configModuleLoader,
|
|
44
|
+
".mjs": configModuleLoader,
|
|
45
|
+
".cjs": configModuleLoader
|
|
46
|
+
},
|
|
47
|
+
searchPlaces: [
|
|
48
|
+
`.${moduleName}rc.js`,
|
|
49
|
+
`.${moduleName}rc.ts`,
|
|
50
|
+
`.${moduleName}rc.mjs`,
|
|
51
|
+
`.${moduleName}rc.cjs`,
|
|
52
|
+
`.config/${moduleName}rc.js`,
|
|
53
|
+
`.config/${moduleName}rc.ts`,
|
|
54
|
+
`.config/${moduleName}rc.mjs`,
|
|
55
|
+
`.config/${moduleName}rc.cjs`,
|
|
56
|
+
`${moduleName}.config.js`,
|
|
57
|
+
`${moduleName}.config.ts`,
|
|
58
|
+
`${moduleName}.config.mjs`,
|
|
59
|
+
`${moduleName}.config.cjs`
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region bin/cli.ts
|
|
65
|
+
const defaultLogLevel = "info";
|
|
40
66
|
async function main() {
|
|
41
67
|
const { values: { logLevel } } = (0, node_util.parseArgs)({
|
|
42
68
|
args: process.argv.slice(2),
|
|
@@ -45,20 +71,7 @@ async function main() {
|
|
|
45
71
|
short: "l"
|
|
46
72
|
} }
|
|
47
73
|
});
|
|
48
|
-
const result = await (
|
|
49
|
-
`.${moduleName}rc.js`,
|
|
50
|
-
`.${moduleName}rc.ts`,
|
|
51
|
-
`.${moduleName}rc.mjs`,
|
|
52
|
-
`.${moduleName}rc.cjs`,
|
|
53
|
-
`.config/${moduleName}rc.js`,
|
|
54
|
-
`.config/${moduleName}rc.ts`,
|
|
55
|
-
`.config/${moduleName}rc.mjs`,
|
|
56
|
-
`.config/${moduleName}rc.cjs`,
|
|
57
|
-
`${moduleName}.config.js`,
|
|
58
|
-
`${moduleName}.config.ts`,
|
|
59
|
-
`${moduleName}.config.mjs`,
|
|
60
|
-
`${moduleName}.config.cjs`
|
|
61
|
-
] }).search();
|
|
74
|
+
const result = await createConfigExplorer().search();
|
|
62
75
|
if (!result || !result.config) {
|
|
63
76
|
logger.error("No configuration file found");
|
|
64
77
|
process.exit(1);
|
|
@@ -83,5 +96,4 @@ main().catch((err) => {
|
|
|
83
96
|
logger.error(err);
|
|
84
97
|
process.exit(1);
|
|
85
98
|
});
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
99
|
+
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { run } from "../run-
|
|
2
|
+
import { t as run } from "../run-Bv3fv1N8.mjs";
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
|
-
import { cosmiconfig } from "cosmiconfig";
|
|
5
4
|
import chalk from "chalk";
|
|
6
5
|
import log from "loglevel";
|
|
7
6
|
import prefix from "loglevel-plugin-prefix";
|
|
8
|
-
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import { lilconfig } from "lilconfig";
|
|
9
9
|
//#region src/logger.ts
|
|
10
10
|
const colors = {
|
|
11
11
|
trace: chalk.magenta,
|
|
@@ -21,16 +21,45 @@ prefix.apply(log, { format(level, name) {
|
|
|
21
21
|
return `${color(level)}${scope}`;
|
|
22
22
|
} });
|
|
23
23
|
const logger = log;
|
|
24
|
-
|
|
25
24
|
//#endregion
|
|
26
|
-
//#region bin/
|
|
25
|
+
//#region bin/config-loader.ts
|
|
27
26
|
const moduleName = "translate";
|
|
28
|
-
const
|
|
27
|
+
const configModuleLoader = async (filepath) => {
|
|
28
|
+
const configModule = await import(pathToFileURL(filepath).href);
|
|
29
|
+
return configModule.default ?? configModule;
|
|
30
|
+
};
|
|
29
31
|
function unwrapConfig(config) {
|
|
30
32
|
if (config && typeof config === "object" && "default" in config) return config.default;
|
|
31
33
|
if (config && typeof config === "object" && "translateConfig" in config) return config.translateConfig;
|
|
32
34
|
return config;
|
|
33
35
|
}
|
|
36
|
+
function createConfigExplorer() {
|
|
37
|
+
return lilconfig(moduleName, {
|
|
38
|
+
loaders: {
|
|
39
|
+
".js": configModuleLoader,
|
|
40
|
+
".ts": configModuleLoader,
|
|
41
|
+
".mjs": configModuleLoader,
|
|
42
|
+
".cjs": configModuleLoader
|
|
43
|
+
},
|
|
44
|
+
searchPlaces: [
|
|
45
|
+
`.${moduleName}rc.js`,
|
|
46
|
+
`.${moduleName}rc.ts`,
|
|
47
|
+
`.${moduleName}rc.mjs`,
|
|
48
|
+
`.${moduleName}rc.cjs`,
|
|
49
|
+
`.config/${moduleName}rc.js`,
|
|
50
|
+
`.config/${moduleName}rc.ts`,
|
|
51
|
+
`.config/${moduleName}rc.mjs`,
|
|
52
|
+
`.config/${moduleName}rc.cjs`,
|
|
53
|
+
`${moduleName}.config.js`,
|
|
54
|
+
`${moduleName}.config.ts`,
|
|
55
|
+
`${moduleName}.config.mjs`,
|
|
56
|
+
`${moduleName}.config.cjs`
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region bin/cli.ts
|
|
62
|
+
const defaultLogLevel = "info";
|
|
34
63
|
async function main() {
|
|
35
64
|
const { values: { logLevel } } = parseArgs({
|
|
36
65
|
args: process.argv.slice(2),
|
|
@@ -39,20 +68,7 @@ async function main() {
|
|
|
39
68
|
short: "l"
|
|
40
69
|
} }
|
|
41
70
|
});
|
|
42
|
-
const result = await
|
|
43
|
-
`.${moduleName}rc.js`,
|
|
44
|
-
`.${moduleName}rc.ts`,
|
|
45
|
-
`.${moduleName}rc.mjs`,
|
|
46
|
-
`.${moduleName}rc.cjs`,
|
|
47
|
-
`.config/${moduleName}rc.js`,
|
|
48
|
-
`.config/${moduleName}rc.ts`,
|
|
49
|
-
`.config/${moduleName}rc.mjs`,
|
|
50
|
-
`.config/${moduleName}rc.cjs`,
|
|
51
|
-
`${moduleName}.config.js`,
|
|
52
|
-
`${moduleName}.config.ts`,
|
|
53
|
-
`${moduleName}.config.mjs`,
|
|
54
|
-
`${moduleName}.config.cjs`
|
|
55
|
-
] }).search();
|
|
71
|
+
const result = await createConfigExplorer().search();
|
|
56
72
|
if (!result || !result.config) {
|
|
57
73
|
logger.error("No configuration file found");
|
|
58
74
|
process.exit(1);
|
|
@@ -77,7 +93,7 @@ main().catch((err) => {
|
|
|
77
93
|
logger.error(err);
|
|
78
94
|
process.exit(1);
|
|
79
95
|
});
|
|
80
|
-
|
|
81
96
|
//#endregion
|
|
82
|
-
export {
|
|
83
|
-
|
|
97
|
+
export {};
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../../src/logger.ts","../../bin/config-loader.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","import { pathToFileURL } from \"node:url\";\nimport { lilconfig, type Loader } from \"lilconfig\";\nimport type { ResolvedConfig } from \"../src/configuration.ts\";\n\nexport const moduleName = \"translate\";\n\ntype ConfigExport =\n | ResolvedConfig\n | { default: ResolvedConfig | undefined }\n | { translateConfig: ResolvedConfig | undefined }\n | undefined;\n\nconst configModuleLoader: Loader = async (filepath) => {\n const configModule = await import(pathToFileURL(filepath).href);\n\n return configModule.default ?? configModule;\n};\n\nexport function unwrapConfig(config: ConfigExport) {\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\nexport function createConfigExplorer() {\n return lilconfig(moduleName, {\n loaders: {\n \".js\": configModuleLoader,\n \".ts\": configModuleLoader,\n \".mjs\": configModuleLoader,\n \".cjs\": configModuleLoader,\n },\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","#!/usr/bin/env node\n\nimport { parseArgs } from \"node:util\";\nimport type { ResolvedConfig } from \"../src/configuration.ts\";\nimport { type LogLevel, logger } from \"../src/logger.ts\";\nimport { run } from \"../src/run.ts\";\nimport { createConfigExplorer, unwrapConfig } from \"./config-loader.ts\";\n\nconst defaultLogLevel: LogLevel = \"info\";\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 result = await createConfigExplorer().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,MAAM,SAA0C;CAC5C,OAAO,MAAM;CACb,OAAO,MAAM;CACb,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,OAAO,MAAM;AACjB;AAEA,OAAO,IAAI,GAAG;AACd,OAAO,MAAM,KAAK,EACd,OAAO,OAAO,MAAM;CAChB,MAAM,QAAQ,OAAO,YAA6B,UAAkB;CACpE,MAAM,QAAQ,OAAO,IAAI,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM;CAErD,OAAO,GAAG,MAAM,KAAK,IAAI;AAC7B,EACJ,CAAC;AAED,MAAa,SAAS;;;ACtBtB,MAAa,aAAa;AAQ1B,MAAM,qBAA6B,OAAO,aAAa;CACnD,MAAM,eAAe,MAAM,OAAO,cAAc,QAAQ,CAAC,CAAC;CAE1D,OAAO,aAAa,WAAW;AACnC;AAEA,SAAgB,aAAa,QAAsB;CAC/C,IAAI,UAAU,OAAO,WAAW,YAAY,aAAa,QACrD,OAAO,OAAO;CAGlB,IAAI,UAAU,OAAO,WAAW,YAAY,qBAAqB,QAC7D,OAAO,OAAO;CAGlB,OAAO;AACX;AAEA,SA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src/logger.d.ts
|
|
5
4
|
type Logger = log.Logger;
|
|
6
5
|
type LogLevelNames = log.LogLevelNames;
|
|
@@ -33,7 +32,7 @@ declare function core$1(): Plugin<string, Translation[]>;
|
|
|
33
32
|
declare function po$1(): Plugin;
|
|
34
33
|
//#endregion
|
|
35
34
|
//#region src/plugins/react/react.d.ts
|
|
36
|
-
declare function react(): Plugin<string, Translation[]>;
|
|
35
|
+
declare function react$1(): Plugin<string, Translation[]>;
|
|
37
36
|
//#endregion
|
|
38
37
|
//#region src/static.d.ts
|
|
39
38
|
declare function core(...props: Parameters<typeof core$1>): {
|
|
@@ -42,7 +41,7 @@ declare function core(...props: Parameters<typeof core$1>): {
|
|
|
42
41
|
readonly props: [];
|
|
43
42
|
};
|
|
44
43
|
};
|
|
45
|
-
declare function react
|
|
44
|
+
declare function react(...props: Parameters<typeof react$1>): {
|
|
46
45
|
readonly static: {
|
|
47
46
|
readonly name: "react";
|
|
48
47
|
readonly props: [];
|
|
@@ -60,7 +59,7 @@ declare function cleanup(...props: Parameters<typeof cleanup$1>): {
|
|
|
60
59
|
readonly props: [];
|
|
61
60
|
};
|
|
62
61
|
};
|
|
63
|
-
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react
|
|
62
|
+
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react> | ReturnType<typeof po> | ReturnType<typeof cleanup>;
|
|
64
63
|
//#endregion
|
|
65
64
|
//#region src/plugin.d.ts
|
|
66
65
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -70,16 +69,23 @@ interface Context {
|
|
|
70
69
|
paths: Set<string>;
|
|
71
70
|
logger?: Logger;
|
|
72
71
|
}
|
|
72
|
+
interface ImportReference {
|
|
73
|
+
spec: string;
|
|
74
|
+
kind: "static" | "dynamic";
|
|
75
|
+
typeOnly: boolean;
|
|
76
|
+
}
|
|
73
77
|
interface ResolveArgs<TInput = unknown> {
|
|
74
78
|
entrypoint: string;
|
|
75
79
|
path: string;
|
|
76
80
|
namespace: string;
|
|
81
|
+
import?: ImportReference;
|
|
77
82
|
data?: TInput;
|
|
78
83
|
}
|
|
79
84
|
interface ResolveResult<TInput = unknown> {
|
|
80
85
|
entrypoint: string;
|
|
81
86
|
path: string;
|
|
82
87
|
namespace: string;
|
|
88
|
+
import?: ImportReference;
|
|
83
89
|
data?: TInput;
|
|
84
90
|
}
|
|
85
91
|
interface LoadArgs<TInput = unknown> {
|
|
@@ -130,17 +136,32 @@ interface Plugin<TInput = unknown, TOutput = unknown> {
|
|
|
130
136
|
}
|
|
131
137
|
type UniversalPlugin = Plugin | StaticPlugin;
|
|
132
138
|
//#endregion
|
|
139
|
+
//#region src/exclude.d.ts
|
|
140
|
+
declare const defaultExclude: {
|
|
141
|
+
readonly modules: ({
|
|
142
|
+
path
|
|
143
|
+
}: ResolveArgs) => boolean;
|
|
144
|
+
readonly dist: ({
|
|
145
|
+
path
|
|
146
|
+
}: ResolveArgs) => boolean;
|
|
147
|
+
readonly build: ({
|
|
148
|
+
path
|
|
149
|
+
}: ResolveArgs) => boolean;
|
|
150
|
+
readonly types: ({
|
|
151
|
+
import: imp
|
|
152
|
+
}: ResolveArgs) => boolean;
|
|
153
|
+
};
|
|
154
|
+
type DefaultExclude = typeof defaultExclude;
|
|
155
|
+
//#endregion
|
|
133
156
|
//#region src/configuration.d.ts
|
|
134
157
|
type DestinationFn = (args: {
|
|
135
158
|
locale: string;
|
|
136
159
|
entrypoint: string;
|
|
137
160
|
path: string;
|
|
138
161
|
}) => string;
|
|
139
|
-
type ExcludeFn = (args:
|
|
140
|
-
entrypoint: string;
|
|
141
|
-
path: string;
|
|
142
|
-
}) => boolean;
|
|
162
|
+
type ExcludeFn = (args: ResolveArgs) => boolean;
|
|
143
163
|
type Exclude = RegExp | ExcludeFn;
|
|
164
|
+
type ExcludeConfig = RegExp | Exclude[] | ((defaultExclude: DefaultExclude) => Exclude[]);
|
|
144
165
|
declare const defaultPlugins: {
|
|
145
166
|
core: typeof core;
|
|
146
167
|
po: typeof po;
|
|
@@ -158,7 +179,7 @@ interface EntrypointConfig {
|
|
|
158
179
|
destination?: DestinationFn;
|
|
159
180
|
obsolete?: ObsoleteStrategy;
|
|
160
181
|
walk?: boolean;
|
|
161
|
-
exclude?:
|
|
182
|
+
exclude?: ExcludeConfig;
|
|
162
183
|
}
|
|
163
184
|
interface UserConfig {
|
|
164
185
|
/**
|
|
@@ -212,7 +233,7 @@ interface UserConfig {
|
|
|
212
233
|
* @default [/node_modules/, /dist/, /build/]
|
|
213
234
|
* @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.
|
|
214
235
|
*/
|
|
215
|
-
exclude?:
|
|
236
|
+
exclude?: ExcludeConfig;
|
|
216
237
|
/**
|
|
217
238
|
* Log level for the extraction process
|
|
218
239
|
* @default "info"
|
|
@@ -239,5 +260,5 @@ interface ResolvedConfig {
|
|
|
239
260
|
*/
|
|
240
261
|
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
241
262
|
//#endregion
|
|
242
|
-
export {
|
|
243
|
-
//# sourceMappingURL=configuration-
|
|
263
|
+
export { react as A, ResolveHook as C, cleanup as D, StaticPlugin as E, Logger as F, po$1 as M, core$1 as N, core as O, cleanup$1 as P, ResolveArgs as S, UniversalPlugin as T, LoadResult as _, ExcludeFn as a, ProcessHook as b, ResolvedEntrypoint as c, Build as d, Context as f, LoadHook as g, LoadArgs as h, ExcludeConfig as i, react$1 as j, po as k, UserConfig as l, ImportReference as m, EntrypointConfig as n, ObsoleteStrategy as o, Filter as p, Exclude as r, ResolvedConfig as s, DestinationFn as t, defineConfig as u, Plugin as v, ResolveResult as w, ProcessResult as x, ProcessArgs as y };
|
|
264
|
+
//# sourceMappingURL=configuration-BVNh7M_I.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-BVNh7M_I.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/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EACT,WAAA,EAAa,kBAAA;EACb,aAAA;EACA,OAAA;EACA,WAAA,EAAa,aAAA;EACb,QAAA,EAAU,gBAAA;EACV,IAAA;EACA,QAAA,EAAU,QAAA;EACV,OAAA,EAAS,OAAA;AAAA;;AHlFb;;;iBGiIgB,YAAA,CAAa,MAAA,EAAQ,UAAA,GAAa,cAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import log from "loglevel";
|
|
2
1
|
import Parser from "@keqingmoe/tree-sitter";
|
|
2
|
+
import log from "loglevel";
|
|
3
3
|
import { PluralFormsLocale } from "@let-value/translate";
|
|
4
4
|
|
|
5
5
|
//#region src/logger.d.ts
|
|
@@ -34,7 +34,7 @@ declare function core$1(): Plugin<string, Translation[]>;
|
|
|
34
34
|
declare function po$1(): Plugin;
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/plugins/react/react.d.ts
|
|
37
|
-
declare function react(): Plugin<string, Translation[]>;
|
|
37
|
+
declare function react$1(): Plugin<string, Translation[]>;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/static.d.ts
|
|
40
40
|
declare function core(...props: Parameters<typeof core$1>): {
|
|
@@ -43,7 +43,7 @@ declare function core(...props: Parameters<typeof core$1>): {
|
|
|
43
43
|
readonly props: [];
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
declare function react
|
|
46
|
+
declare function react(...props: Parameters<typeof react$1>): {
|
|
47
47
|
readonly static: {
|
|
48
48
|
readonly name: "react";
|
|
49
49
|
readonly props: [];
|
|
@@ -61,7 +61,7 @@ declare function cleanup(...props: Parameters<typeof cleanup$1>): {
|
|
|
61
61
|
readonly props: [];
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
-
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react
|
|
64
|
+
type StaticPlugin = ReturnType<typeof core> | ReturnType<typeof react> | ReturnType<typeof po> | ReturnType<typeof cleanup>;
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/plugin.d.ts
|
|
67
67
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -71,16 +71,23 @@ interface Context {
|
|
|
71
71
|
paths: Set<string>;
|
|
72
72
|
logger?: Logger;
|
|
73
73
|
}
|
|
74
|
+
interface ImportReference {
|
|
75
|
+
spec: string;
|
|
76
|
+
kind: "static" | "dynamic";
|
|
77
|
+
typeOnly: boolean;
|
|
78
|
+
}
|
|
74
79
|
interface ResolveArgs<TInput = unknown> {
|
|
75
80
|
entrypoint: string;
|
|
76
81
|
path: string;
|
|
77
82
|
namespace: string;
|
|
83
|
+
import?: ImportReference;
|
|
78
84
|
data?: TInput;
|
|
79
85
|
}
|
|
80
86
|
interface ResolveResult<TInput = unknown> {
|
|
81
87
|
entrypoint: string;
|
|
82
88
|
path: string;
|
|
83
89
|
namespace: string;
|
|
90
|
+
import?: ImportReference;
|
|
84
91
|
data?: TInput;
|
|
85
92
|
}
|
|
86
93
|
interface LoadArgs<TInput = unknown> {
|
|
@@ -131,17 +138,32 @@ interface Plugin<TInput = unknown, TOutput = unknown> {
|
|
|
131
138
|
}
|
|
132
139
|
type UniversalPlugin = Plugin | StaticPlugin;
|
|
133
140
|
//#endregion
|
|
141
|
+
//#region src/exclude.d.ts
|
|
142
|
+
declare const defaultExclude: {
|
|
143
|
+
readonly modules: ({
|
|
144
|
+
path
|
|
145
|
+
}: ResolveArgs) => boolean;
|
|
146
|
+
readonly dist: ({
|
|
147
|
+
path
|
|
148
|
+
}: ResolveArgs) => boolean;
|
|
149
|
+
readonly build: ({
|
|
150
|
+
path
|
|
151
|
+
}: ResolveArgs) => boolean;
|
|
152
|
+
readonly types: ({
|
|
153
|
+
import: imp
|
|
154
|
+
}: ResolveArgs) => boolean;
|
|
155
|
+
};
|
|
156
|
+
type DefaultExclude = typeof defaultExclude;
|
|
157
|
+
//#endregion
|
|
134
158
|
//#region src/configuration.d.ts
|
|
135
159
|
type DestinationFn = (args: {
|
|
136
160
|
locale: string;
|
|
137
161
|
entrypoint: string;
|
|
138
162
|
path: string;
|
|
139
163
|
}) => string;
|
|
140
|
-
type ExcludeFn = (args:
|
|
141
|
-
entrypoint: string;
|
|
142
|
-
path: string;
|
|
143
|
-
}) => boolean;
|
|
164
|
+
type ExcludeFn = (args: ResolveArgs) => boolean;
|
|
144
165
|
type Exclude = RegExp | ExcludeFn;
|
|
166
|
+
type ExcludeConfig = RegExp | Exclude[] | ((defaultExclude: DefaultExclude) => Exclude[]);
|
|
145
167
|
declare const defaultPlugins: {
|
|
146
168
|
core: typeof core;
|
|
147
169
|
po: typeof po;
|
|
@@ -159,7 +181,7 @@ interface EntrypointConfig {
|
|
|
159
181
|
destination?: DestinationFn;
|
|
160
182
|
obsolete?: ObsoleteStrategy;
|
|
161
183
|
walk?: boolean;
|
|
162
|
-
exclude?:
|
|
184
|
+
exclude?: ExcludeConfig;
|
|
163
185
|
}
|
|
164
186
|
interface UserConfig {
|
|
165
187
|
/**
|
|
@@ -213,7 +235,7 @@ interface UserConfig {
|
|
|
213
235
|
* @default [/node_modules/, /dist/, /build/]
|
|
214
236
|
* @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.
|
|
215
237
|
*/
|
|
216
|
-
exclude?:
|
|
238
|
+
exclude?: ExcludeConfig;
|
|
217
239
|
/**
|
|
218
240
|
* Log level for the extraction process
|
|
219
241
|
* @default "info"
|
|
@@ -240,5 +262,5 @@ interface ResolvedConfig {
|
|
|
240
262
|
*/
|
|
241
263
|
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
242
264
|
//#endregion
|
|
243
|
-
export {
|
|
244
|
-
//# sourceMappingURL=configuration-
|
|
265
|
+
export { react as A, ResolveHook as C, cleanup as D, StaticPlugin as E, Logger as F, po$1 as M, core$1 as N, core as O, cleanup$1 as P, ResolveArgs as S, UniversalPlugin as T, LoadResult as _, ExcludeFn as a, ProcessHook as b, ResolvedEntrypoint as c, Build as d, Context as f, LoadHook as g, LoadArgs as h, ExcludeConfig as i, react$1 as j, po as k, UserConfig as l, ImportReference as m, EntrypointConfig as n, ObsoleteStrategy as o, Filter as p, Exclude as r, ResolvedConfig as s, DestinationFn as t, defineConfig as u, Plugin as v, ResolveResult as w, ProcessResult as x, ProcessArgs as y };
|
|
266
|
+
//# sourceMappingURL=configuration-oHJyypq5.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-oHJyypq5.d.mts","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/exclude.ts","../src/configuration.ts"],"mappings":";;;;;KAIY,MAAA,GAAS,GAAA,CAAI,MAAM;AAAA,KACnB,aAAA,GAAgB,GAAA,CAAI,aAAa;AAAA,KACjC,QAAA,GAAW,aAAa;;;iBCGpB,SAAA,IAAW,MAAM;;;UCNhB,QAAA;EACb,UAAA;EACA,SAAA;EACA,SAAA;EACA,IAAA;EACA,QAAA;AAAA;AAAA,UAGa,WAAA;EACb,OAAA;EACA,EAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA,GAAW,QAAQ;EACnB,QAAA;AAAA;;;iBCLY,MAAA,IAAQ,MAAM,SAAS,WAAA;;;iBCAvB,IAAA,IAAM,MAAM;;;iBCNZ,OAAA,IAAS,MAAM,SAAS,WAAA;;;iBCDxB,IAAA,IAAQ,KAAA,EAAO,UAAU,QAAQ,MAAA;EAAA;;;;;iBASjC,KAAA,IAAS,KAAA,EAAO,UAAU,QAAQ,OAAA;EAAA;;;;;iBAQlC,EAAA,IAAM,KAAA,EAAO,UAAU,QAAQ,IAAA;EAAA;;;;;iBAS/B,OAAA,IAAW,KAAA,EAAO,UAAU,QAAQ,SAAA;EAAA;;;;;KASxC,YAAA,GACN,UAAA,QAAkB,IAAA,IAClB,UAAA,QAAkB,KAAA,IAClB,UAAA,QAAkB,EAAA,IAClB,UAAA,QAAkB,OAAA;;;KCxCnB,YAAA,MAA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,KAAA,UAAe,gBAAA;EN7CxC;;;AAA8B;;;EMoD9C,WAAA,GAAc,aAAA;ELpDF;;;;AAAY;;EK2DxB,QAAA,GAAW,gBAAA;;AJjEf;;;;EIuEI,IAAA;;;;AHxEJ;;EG8EI,OAAA,GAAU,aAAA;EH9E2B;;;;EGmFrC,QAAA,GAAW,QAAA;AAAA;AAAA,UAGE,kBAAA,SAA2B,IAAA,CAAK,gBAAA;EAC7C,OAAA,GAAU,OAAA;AAAA;AAAA,UAGG,cAAA;EACb,OAAA,EAAS,eAAA;EACT,WAAA,EAAa,kBAAA;EACb,aAAA;EACA,OAAA;EACA,WAAA,EAAa,aAAA;EACb,QAAA,EAAU,gBAAA;EACV,IAAA;EACA,QAAA,EAAU,QAAA;EACV,OAAA,EAAS,OAAA;AAAA;;AHlFb;;;iBGiIgB,YAAA,CAAa,MAAA,EAAQ,UAAA,GAAa,cAAc"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/exclude.ts
|
|
2
|
+
function normalizedPath(path) {
|
|
3
|
+
return path.replace(/\\/g, "/");
|
|
4
|
+
}
|
|
5
|
+
function isInsideDirectory(path, directory) {
|
|
6
|
+
return normalizedPath(path).split("/").some((part) => part === directory);
|
|
7
|
+
}
|
|
8
|
+
const defaultExclude = {
|
|
9
|
+
modules: ({ path }) => isInsideDirectory(path, "node_modules"),
|
|
10
|
+
dist: ({ path }) => isInsideDirectory(path, "dist"),
|
|
11
|
+
build: ({ path }) => isInsideDirectory(path, "build"),
|
|
12
|
+
types: ({ import: imp }) => imp?.typeOnly ?? false
|
|
13
|
+
};
|
|
14
|
+
const defaultExcludes = Object.values(defaultExclude);
|
|
15
|
+
function isExcluded(args, exclude) {
|
|
16
|
+
return exclude.some((ex) => typeof ex === "function" ? ex(args) : ex.test(args.path));
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { defaultExcludes as n, isExcluded as r, defaultExclude as t };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=exclude-CpTGSisK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude-CpTGSisK.mjs","names":[],"sources":["../src/exclude.ts"],"sourcesContent":["import type { Exclude } from \"./configuration.ts\";\nimport type { ResolveArgs } from \"./plugin.ts\";\n\nfunction normalizedPath(path: string) {\n return path.replace(/\\\\/g, \"/\");\n}\n\nfunction isInsideDirectory(path: string, directory: string) {\n return normalizedPath(path)\n .split(\"/\")\n .some((part) => part === directory);\n}\n\nexport const defaultExclude = {\n modules: ({ path }: ResolveArgs) => isInsideDirectory(path, \"node_modules\"),\n dist: ({ path }: ResolveArgs) => isInsideDirectory(path, \"dist\"),\n build: ({ path }: ResolveArgs) => isInsideDirectory(path, \"build\"),\n types: ({ import: imp }: ResolveArgs) => imp?.typeOnly ?? false,\n} as const;\n\nexport type DefaultExclude = typeof defaultExclude;\n\nexport const defaultExcludes: Exclude[] = Object.values(defaultExclude);\n\nexport function isExcluded(args: ResolveArgs, exclude: Exclude[]) {\n return exclude.some((ex) => (typeof ex === \"function\" ? ex(args) : ex.test(args.path)));\n}\n"],"mappings":";AAGA,SAAS,eAAe,MAAc;CAClC,OAAO,KAAK,QAAQ,OAAO,GAAG;AAClC;AAEA,SAAS,kBAAkB,MAAc,WAAmB;CACxD,OAAO,eAAe,IAAI,CAAC,CACtB,MAAM,GAAG,CAAC,CACV,MAAM,SAAS,SAAS,SAAS;AAC1C;AAEA,MAAa,iBAAiB;CAC1B,UAAU,EAAE,WAAwB,kBAAkB,MAAM,cAAc;CAC1E,OAAO,EAAE,WAAwB,kBAAkB,MAAM,MAAM;CAC/D,QAAQ,EAAE,WAAwB,kBAAkB,MAAM,OAAO;CACjE,QAAQ,EAAE,QAAQ,UAAuB,KAAK,YAAY;AAC9D;AAIA,MAAa,kBAA6B,OAAO,OAAO,cAAc;AAEtE,SAAgB,WAAW,MAAmB,SAAoB;CAC9D,OAAO,QAAQ,MAAM,OAAQ,OAAO,OAAO,aAAa,GAAG,IAAI,IAAI,GAAG,KAAK,KAAK,IAAI,CAAE;AAC1F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/exclude.ts
|
|
2
|
+
function normalizedPath(path) {
|
|
3
|
+
return path.replace(/\\/g, "/");
|
|
4
|
+
}
|
|
5
|
+
function isInsideDirectory(path, directory) {
|
|
6
|
+
return normalizedPath(path).split("/").some((part) => part === directory);
|
|
7
|
+
}
|
|
8
|
+
const defaultExclude = {
|
|
9
|
+
modules: ({ path }) => isInsideDirectory(path, "node_modules"),
|
|
10
|
+
dist: ({ path }) => isInsideDirectory(path, "dist"),
|
|
11
|
+
build: ({ path }) => isInsideDirectory(path, "build"),
|
|
12
|
+
types: ({ import: imp }) => imp?.typeOnly ?? false
|
|
13
|
+
};
|
|
14
|
+
const defaultExcludes = Object.values(defaultExclude);
|
|
15
|
+
function isExcluded(args, exclude) {
|
|
16
|
+
return exclude.some((ex) => typeof ex === "function" ? ex(args) : ex.test(args.path));
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
Object.defineProperty(exports, "defaultExclude", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function() {
|
|
22
|
+
return defaultExclude;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "defaultExcludes", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function() {
|
|
28
|
+
return defaultExcludes;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "isExcluded", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function() {
|
|
34
|
+
return isExcluded;
|
|
35
|
+
}
|
|
36
|
+
});
|