@intlayer/config 9.3.1 → 9.3.2
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/cjs/bundle/index.cjs +1 -1
- package/dist/cjs/extract/constants.cjs +19 -0
- package/dist/cjs/extract/constants.cjs.map +1 -0
- package/dist/cjs/extract/index.cjs +6 -0
- package/dist/cjs/extract/shouldExtract.cjs +38 -0
- package/dist/cjs/extract/shouldExtract.cjs.map +1 -0
- package/dist/esm/bundle/index.mjs +1 -1
- package/dist/esm/extract/constants.mjs +18 -0
- package/dist/esm/extract/constants.mjs.map +1 -0
- package/dist/esm/extract/index.mjs +4 -0
- package/dist/esm/extract/shouldExtract.mjs +37 -0
- package/dist/esm/extract/shouldExtract.mjs.map +1 -0
- package/dist/types/extract/constants.d.ts +11 -0
- package/dist/types/extract/constants.d.ts.map +1 -0
- package/dist/types/extract/index.d.ts +3 -0
- package/dist/types/extract/shouldExtract.d.ts +15 -0
- package/dist/types/extract/shouldExtract.d.ts.map +1 -0
- package/package.json +10 -2
|
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_utils_alias = require('../utils/alias.cjs');
|
|
4
4
|
const require_configFile_getConfiguration = require('../configFile/getConfiguration.cjs');
|
|
5
|
-
const require_envVars_envVars = require('../envVars/envVars.cjs');
|
|
6
5
|
const require_bundle_logBundle = require('./logBundle.cjs');
|
|
6
|
+
const require_envVars_envVars = require('../envVars/envVars.cjs');
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
let node_fs_promises = require("node:fs/promises");
|
|
9
9
|
let _intlayer_types_package_json = require("@intlayer/types/package.json");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region src/extract/constants.ts
|
|
3
|
+
/**
|
|
4
|
+
* Attributes that should be extracted as translatable strings from JSX/HTML elements.
|
|
5
|
+
* This is the single source of truth shared across all Intlayer compiler packages
|
|
6
|
+
* (@intlayer/babel, @intlayer/vue-compiler, @intlayer/svelte-compiler, @intlayer/engine)
|
|
7
|
+
* and the `eslint-plugin-intlayer` `no-raw-text` rule.
|
|
8
|
+
*/
|
|
9
|
+
const ATTRIBUTES_TO_EXTRACT = [
|
|
10
|
+
"title",
|
|
11
|
+
"placeholder",
|
|
12
|
+
"alt",
|
|
13
|
+
"aria-label",
|
|
14
|
+
"label"
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.ATTRIBUTES_TO_EXTRACT = ATTRIBUTES_TO_EXTRACT;
|
|
19
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../../../src/extract/constants.ts"],"sourcesContent":["/**\n * Attributes that should be extracted as translatable strings from JSX/HTML elements.\n * This is the single source of truth shared across all Intlayer compiler packages\n * (@intlayer/babel, @intlayer/vue-compiler, @intlayer/svelte-compiler, @intlayer/engine)\n * and the `eslint-plugin-intlayer` `no-raw-text` rule.\n */\nexport const ATTRIBUTES_TO_EXTRACT = [\n 'title',\n 'placeholder',\n 'alt',\n 'aria-label',\n 'label',\n] as const;\n"],"mappings":";;;;;;;;AAMA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_extract_shouldExtract = require('./shouldExtract.cjs');
|
|
3
|
+
const require_extract_constants = require('./constants.cjs');
|
|
4
|
+
|
|
5
|
+
exports.ATTRIBUTES_TO_EXTRACT = require_extract_constants.ATTRIBUTES_TO_EXTRACT;
|
|
6
|
+
exports.shouldExtract = require_extract_shouldExtract.shouldExtract;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region src/extract/shouldExtract.ts
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the given text should be extracted as a translatable string.
|
|
5
|
+
*
|
|
6
|
+
* Filters out:
|
|
7
|
+
* - Empty strings
|
|
8
|
+
* - Emails
|
|
9
|
+
* - Single capitalized words (likely brand/proper nouns, e.g. "Intlayer")
|
|
10
|
+
* - Uncapitalized strings of 2 words or fewer (likely technical terms)
|
|
11
|
+
* - Dynamic content patterns like Vue bindings (`v-`) or object patterns (`{`)
|
|
12
|
+
*/
|
|
13
|
+
const shouldExtract = (text) => {
|
|
14
|
+
const trimmed = text.trim();
|
|
15
|
+
if (!trimmed) return false;
|
|
16
|
+
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmed)) return false;
|
|
17
|
+
if (trimmed.startsWith("{") && !trimmed.startsWith("{{") || trimmed.startsWith("v-")) return false;
|
|
18
|
+
if (trimmed.includes("=>") || trimmed.includes(");") || trimmed.includes("(){") || trimmed.includes("==") || trimmed.includes("window.") || trimmed.startsWith("(function") || trimmed.startsWith("function(")) return false;
|
|
19
|
+
if ((trimmed.match(/[^\p{L}\p{N}\s.,!?;:'"()[\]{}–—/«»„“\p{Sc}%&*+#@^_+=<>/~]/gu) || []).length > 5) return false;
|
|
20
|
+
const wordCount = trimmed.split(/\s+/).length;
|
|
21
|
+
const cssClassTokenRegex = /^!?([a-z][a-z0-9-]*:)*[a-z][a-z0-9]*(-[a-z0-9[\].,%#/]+)*(\/[a-z0-9]+)?$/;
|
|
22
|
+
if (wordCount > 1) {
|
|
23
|
+
const tokens = trimmed.split(/\s+/);
|
|
24
|
+
if (tokens.every((token) => cssClassTokenRegex.test(token)) && tokens.some((token) => token.includes("-"))) return false;
|
|
25
|
+
}
|
|
26
|
+
const isCapitalized = /^['"([]*\p{Lu}/u.test(trimmed);
|
|
27
|
+
if (wordCount === 1 && isCapitalized) return false;
|
|
28
|
+
if (wordCount === 1) {
|
|
29
|
+
if (/[a-z]\p{Lu}/u.test(trimmed)) return false;
|
|
30
|
+
if (trimmed.includes("-") || trimmed.includes("_")) return false;
|
|
31
|
+
}
|
|
32
|
+
if (!isCapitalized && wordCount <= 2) return false;
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.shouldExtract = shouldExtract;
|
|
38
|
+
//# sourceMappingURL=shouldExtract.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shouldExtract.cjs","names":[],"sources":["../../../src/extract/shouldExtract.ts"],"sourcesContent":["/**\n * Checks whether the given text should be extracted as a translatable string.\n *\n * Filters out:\n * - Empty strings\n * - Emails\n * - Single capitalized words (likely brand/proper nouns, e.g. \"Intlayer\")\n * - Uncapitalized strings of 2 words or fewer (likely technical terms)\n * - Dynamic content patterns like Vue bindings (`v-`) or object patterns (`{`)\n */\nexport const shouldExtract = (text: string): boolean => {\n const trimmed = text.trim();\n\n if (!trimmed) return false;\n\n // Ignore emails\n if (/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(trimmed)) return false;\n\n // Ignore dynamic content patterns, but allow {{placeholder}} which is intlayer's insertion format\n if (\n (trimmed.startsWith('{') && !trimmed.startsWith('{{')) ||\n trimmed.startsWith('v-')\n )\n return false;\n\n // Ignore explicit code patterns (markers)\n if (\n trimmed.includes('=>') ||\n trimmed.includes(');') ||\n trimmed.includes('(){') ||\n trimmed.includes('==') ||\n trimmed.includes('window.') ||\n trimmed.startsWith('(function') ||\n trimmed.startsWith('function(')\n ) {\n return false;\n }\n\n // Heuristic: check for characters that are common in code but rare in natural text.\n // Whitelist: letters, numbers, spaces, and frequent text symbols (including punctuation, braces, and technical symbols)\n const nonTextualRegex =\n /[^\\p{L}\\p{N}\\s.,!?;:'\"()[\\]{}–—/«»„“\\p{Sc}%&*+#@^_+=<>/~]/gu;\n const nonTextualMatches = trimmed.match(nonTextualRegex) || [];\n\n // If a string contains a high density of truly exceptional symbols (like |, \\, etc.),\n // it is highly likely to be code or complex technical data.\n if (nonTextualMatches.length > 5) return false;\n\n const wordCount = trimmed.split(/\\s+/).length;\n\n // Ignore CSS/Tailwind utility class strings. A string whose tokens all look\n // like CSS utility classes (lowercase, optional responsive/state prefix like\n // \"sm:\" or \"hover:\", optional hyphenated suffix like \"-4\" or \"-full\") and\n // where at least one token contains a hyphen is almost certainly a className\n // value, not translatable text.\n const cssClassTokenRegex =\n /^!?([a-z][a-z0-9-]*:)*[a-z][a-z0-9]*(-[a-z0-9[\\].,%#/]+)*(\\/[a-z0-9]+)?$/;\n if (wordCount > 1) {\n const tokens = trimmed.split(/\\s+/);\n if (\n tokens.every((token) => cssClassTokenRegex.test(token)) &&\n tokens.some((token) => token.includes('-'))\n ) {\n return false;\n }\n }\n\n // Check if starts with a capital letter (including after an opening parenthesis/quote)\n const isCapitalized = /^['\"([]*\\p{Lu}/u.test(trimmed);\n\n // Ignore single capitalized words (e.g. brand or proper nouns like \"Intlayer\").\n // A lone word starting with a capital is almost always a name/identifier rather\n // than a translatable sentence or label.\n if (wordCount === 1 && isCapitalized) return false;\n\n // Ignore technical identifiers (one word strings with camelCase, kebab-case, snake_case etc.)\n if (wordCount === 1) {\n // CamelCase or internal capitals (like camelCaseProperty or CamelCaseProperty)\n if (/[a-z]\\p{Lu}/u.test(trimmed)) return false;\n // kebab-case or snake_case\n if (trimmed.includes('-') || trimmed.includes('_')) return false;\n }\n\n // We usually want to extract full sentences or labels, not single/short technical words.\n // Extract if capitalized, or if it contains more than 2 words.\n if (!isCapitalized && wordCount <= 2) return false;\n\n return true;\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,iBAAiB,SAA0B;CACtD,MAAM,UAAU,KAAK,KAAK;CAE1B,IAAI,CAAC,SAAS,OAAO;CAGrB,IAAI,6BAA6B,KAAK,OAAO,GAAG,OAAO;CAGvD,IACG,QAAQ,WAAW,GAAG,KAAK,CAAC,QAAQ,WAAW,IAAI,KACpD,QAAQ,WAAW,IAAI,GAEvB,OAAO;CAGT,IACE,QAAQ,SAAS,IAAI,KACrB,QAAQ,SAAS,IAAI,KACrB,QAAQ,SAAS,KAAK,KACtB,QAAQ,SAAS,IAAI,KACrB,QAAQ,SAAS,SAAS,KAC1B,QAAQ,WAAW,WAAW,KAC9B,QAAQ,WAAW,WAAW,GAE9B,OAAO;CAWT,KAJ0B,QAAQ,MAAM,6DAAe,KAAK,CAAC,EAIxC,CAAC,SAAS,GAAG,OAAO;CAEzC,MAAM,YAAY,QAAQ,MAAM,KAAK,CAAC,CAAC;CAOvC,MAAM,qBACJ;CACF,IAAI,YAAY,GAAG;EACjB,MAAM,SAAS,QAAQ,MAAM,KAAK;EAClC,IACE,OAAO,OAAO,UAAU,mBAAmB,KAAK,KAAK,CAAC,KACtD,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,CAAC,GAE1C,OAAO;CAEX;CAGA,MAAM,gBAAgB,kBAAkB,KAAK,OAAO;CAKpD,IAAI,cAAc,KAAK,eAAe,OAAO;CAG7C,IAAI,cAAc,GAAG;EAEnB,IAAI,eAAe,KAAK,OAAO,GAAG,OAAO;EAEzC,IAAI,QAAQ,SAAS,GAAG,KAAK,QAAQ,SAAS,GAAG,GAAG,OAAO;CAC7D;CAIA,IAAI,CAAC,iBAAiB,aAAa,GAAG,OAAO;CAE7C,OAAO;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAlias } from "../utils/alias.mjs";
|
|
2
2
|
import { getConfiguration } from "../configFile/getConfiguration.mjs";
|
|
3
|
-
import { getConfigEnvVars } from "../envVars/envVars.mjs";
|
|
4
3
|
import { BundleLogger } from "./logBundle.mjs";
|
|
4
|
+
import { getConfigEnvVars } from "../envVars/envVars.mjs";
|
|
5
5
|
import { isAbsolute, join, resolve } from "node:path";
|
|
6
6
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
7
7
|
import configPackageJson from "@intlayer/types/package.json" with { type: "json" };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/extract/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Attributes that should be extracted as translatable strings from JSX/HTML elements.
|
|
4
|
+
* This is the single source of truth shared across all Intlayer compiler packages
|
|
5
|
+
* (@intlayer/babel, @intlayer/vue-compiler, @intlayer/svelte-compiler, @intlayer/engine)
|
|
6
|
+
* and the `eslint-plugin-intlayer` `no-raw-text` rule.
|
|
7
|
+
*/
|
|
8
|
+
const ATTRIBUTES_TO_EXTRACT = [
|
|
9
|
+
"title",
|
|
10
|
+
"placeholder",
|
|
11
|
+
"alt",
|
|
12
|
+
"aria-label",
|
|
13
|
+
"label"
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ATTRIBUTES_TO_EXTRACT };
|
|
18
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../../src/extract/constants.ts"],"sourcesContent":["/**\n * Attributes that should be extracted as translatable strings from JSX/HTML elements.\n * This is the single source of truth shared across all Intlayer compiler packages\n * (@intlayer/babel, @intlayer/vue-compiler, @intlayer/svelte-compiler, @intlayer/engine)\n * and the `eslint-plugin-intlayer` `no-raw-text` rule.\n */\nexport const ATTRIBUTES_TO_EXTRACT = [\n 'title',\n 'placeholder',\n 'alt',\n 'aria-label',\n 'label',\n] as const;\n"],"mappings":";;;;;;;AAMA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/extract/shouldExtract.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the given text should be extracted as a translatable string.
|
|
4
|
+
*
|
|
5
|
+
* Filters out:
|
|
6
|
+
* - Empty strings
|
|
7
|
+
* - Emails
|
|
8
|
+
* - Single capitalized words (likely brand/proper nouns, e.g. "Intlayer")
|
|
9
|
+
* - Uncapitalized strings of 2 words or fewer (likely technical terms)
|
|
10
|
+
* - Dynamic content patterns like Vue bindings (`v-`) or object patterns (`{`)
|
|
11
|
+
*/
|
|
12
|
+
const shouldExtract = (text) => {
|
|
13
|
+
const trimmed = text.trim();
|
|
14
|
+
if (!trimmed) return false;
|
|
15
|
+
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmed)) return false;
|
|
16
|
+
if (trimmed.startsWith("{") && !trimmed.startsWith("{{") || trimmed.startsWith("v-")) return false;
|
|
17
|
+
if (trimmed.includes("=>") || trimmed.includes(");") || trimmed.includes("(){") || trimmed.includes("==") || trimmed.includes("window.") || trimmed.startsWith("(function") || trimmed.startsWith("function(")) return false;
|
|
18
|
+
if ((trimmed.match(/[^\p{L}\p{N}\s.,!?;:'"()[\]{}–—/«»„“\p{Sc}%&*+#@^_+=<>/~]/gu) || []).length > 5) return false;
|
|
19
|
+
const wordCount = trimmed.split(/\s+/).length;
|
|
20
|
+
const cssClassTokenRegex = /^!?([a-z][a-z0-9-]*:)*[a-z][a-z0-9]*(-[a-z0-9[\].,%#/]+)*(\/[a-z0-9]+)?$/;
|
|
21
|
+
if (wordCount > 1) {
|
|
22
|
+
const tokens = trimmed.split(/\s+/);
|
|
23
|
+
if (tokens.every((token) => cssClassTokenRegex.test(token)) && tokens.some((token) => token.includes("-"))) return false;
|
|
24
|
+
}
|
|
25
|
+
const isCapitalized = /^['"([]*\p{Lu}/u.test(trimmed);
|
|
26
|
+
if (wordCount === 1 && isCapitalized) return false;
|
|
27
|
+
if (wordCount === 1) {
|
|
28
|
+
if (/[a-z]\p{Lu}/u.test(trimmed)) return false;
|
|
29
|
+
if (trimmed.includes("-") || trimmed.includes("_")) return false;
|
|
30
|
+
}
|
|
31
|
+
if (!isCapitalized && wordCount <= 2) return false;
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { shouldExtract };
|
|
37
|
+
//# sourceMappingURL=shouldExtract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shouldExtract.mjs","names":[],"sources":["../../../src/extract/shouldExtract.ts"],"sourcesContent":["/**\n * Checks whether the given text should be extracted as a translatable string.\n *\n * Filters out:\n * - Empty strings\n * - Emails\n * - Single capitalized words (likely brand/proper nouns, e.g. \"Intlayer\")\n * - Uncapitalized strings of 2 words or fewer (likely technical terms)\n * - Dynamic content patterns like Vue bindings (`v-`) or object patterns (`{`)\n */\nexport const shouldExtract = (text: string): boolean => {\n const trimmed = text.trim();\n\n if (!trimmed) return false;\n\n // Ignore emails\n if (/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(trimmed)) return false;\n\n // Ignore dynamic content patterns, but allow {{placeholder}} which is intlayer's insertion format\n if (\n (trimmed.startsWith('{') && !trimmed.startsWith('{{')) ||\n trimmed.startsWith('v-')\n )\n return false;\n\n // Ignore explicit code patterns (markers)\n if (\n trimmed.includes('=>') ||\n trimmed.includes(');') ||\n trimmed.includes('(){') ||\n trimmed.includes('==') ||\n trimmed.includes('window.') ||\n trimmed.startsWith('(function') ||\n trimmed.startsWith('function(')\n ) {\n return false;\n }\n\n // Heuristic: check for characters that are common in code but rare in natural text.\n // Whitelist: letters, numbers, spaces, and frequent text symbols (including punctuation, braces, and technical symbols)\n const nonTextualRegex =\n /[^\\p{L}\\p{N}\\s.,!?;:'\"()[\\]{}–—/«»„“\\p{Sc}%&*+#@^_+=<>/~]/gu;\n const nonTextualMatches = trimmed.match(nonTextualRegex) || [];\n\n // If a string contains a high density of truly exceptional symbols (like |, \\, etc.),\n // it is highly likely to be code or complex technical data.\n if (nonTextualMatches.length > 5) return false;\n\n const wordCount = trimmed.split(/\\s+/).length;\n\n // Ignore CSS/Tailwind utility class strings. A string whose tokens all look\n // like CSS utility classes (lowercase, optional responsive/state prefix like\n // \"sm:\" or \"hover:\", optional hyphenated suffix like \"-4\" or \"-full\") and\n // where at least one token contains a hyphen is almost certainly a className\n // value, not translatable text.\n const cssClassTokenRegex =\n /^!?([a-z][a-z0-9-]*:)*[a-z][a-z0-9]*(-[a-z0-9[\\].,%#/]+)*(\\/[a-z0-9]+)?$/;\n if (wordCount > 1) {\n const tokens = trimmed.split(/\\s+/);\n if (\n tokens.every((token) => cssClassTokenRegex.test(token)) &&\n tokens.some((token) => token.includes('-'))\n ) {\n return false;\n }\n }\n\n // Check if starts with a capital letter (including after an opening parenthesis/quote)\n const isCapitalized = /^['\"([]*\\p{Lu}/u.test(trimmed);\n\n // Ignore single capitalized words (e.g. brand or proper nouns like \"Intlayer\").\n // A lone word starting with a capital is almost always a name/identifier rather\n // than a translatable sentence or label.\n if (wordCount === 1 && isCapitalized) return false;\n\n // Ignore technical identifiers (one word strings with camelCase, kebab-case, snake_case etc.)\n if (wordCount === 1) {\n // CamelCase or internal capitals (like camelCaseProperty or CamelCaseProperty)\n if (/[a-z]\\p{Lu}/u.test(trimmed)) return false;\n // kebab-case or snake_case\n if (trimmed.includes('-') || trimmed.includes('_')) return false;\n }\n\n // We usually want to extract full sentences or labels, not single/short technical words.\n // Extract if capitalized, or if it contains more than 2 words.\n if (!isCapitalized && wordCount <= 2) return false;\n\n return true;\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,iBAAiB,SAA0B;CACtD,MAAM,UAAU,KAAK,KAAK;CAE1B,IAAI,CAAC,SAAS,OAAO;CAGrB,IAAI,6BAA6B,KAAK,OAAO,GAAG,OAAO;CAGvD,IACG,QAAQ,WAAW,GAAG,KAAK,CAAC,QAAQ,WAAW,IAAI,KACpD,QAAQ,WAAW,IAAI,GAEvB,OAAO;CAGT,IACE,QAAQ,SAAS,IAAI,KACrB,QAAQ,SAAS,IAAI,KACrB,QAAQ,SAAS,KAAK,KACtB,QAAQ,SAAS,IAAI,KACrB,QAAQ,SAAS,SAAS,KAC1B,QAAQ,WAAW,WAAW,KAC9B,QAAQ,WAAW,WAAW,GAE9B,OAAO;CAWT,KAJ0B,QAAQ,MAAM,6DAAe,KAAK,CAAC,EAIxC,CAAC,SAAS,GAAG,OAAO;CAEzC,MAAM,YAAY,QAAQ,MAAM,KAAK,CAAC,CAAC;CAOvC,MAAM,qBACJ;CACF,IAAI,YAAY,GAAG;EACjB,MAAM,SAAS,QAAQ,MAAM,KAAK;EAClC,IACE,OAAO,OAAO,UAAU,mBAAmB,KAAK,KAAK,CAAC,KACtD,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,CAAC,GAE1C,OAAO;CAEX;CAGA,MAAM,gBAAgB,kBAAkB,KAAK,OAAO;CAKpD,IAAI,cAAc,KAAK,eAAe,OAAO;CAG7C,IAAI,cAAc,GAAG;EAEnB,IAAI,eAAe,KAAK,OAAO,GAAG,OAAO;EAEzC,IAAI,QAAQ,SAAS,GAAG,KAAK,QAAQ,SAAS,GAAG,GAAG,OAAO;CAC7D;CAIA,IAAI,CAAC,iBAAiB,aAAa,GAAG,OAAO;CAE7C,OAAO;AACT"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/extract/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Attributes that should be extracted as translatable strings from JSX/HTML elements.
|
|
4
|
+
* This is the single source of truth shared across all Intlayer compiler packages
|
|
5
|
+
* (@intlayer/babel, @intlayer/vue-compiler, @intlayer/svelte-compiler, @intlayer/engine)
|
|
6
|
+
* and the `eslint-plugin-intlayer` `no-raw-text` rule.
|
|
7
|
+
*/
|
|
8
|
+
declare const ATTRIBUTES_TO_EXTRACT: readonly ['title', 'placeholder', 'alt', 'aria-label', 'label'];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ATTRIBUTES_TO_EXTRACT };
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/extract/constants.ts"],"mappings":";;;;;;;cAMa"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/extract/shouldExtract.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the given text should be extracted as a translatable string.
|
|
4
|
+
*
|
|
5
|
+
* Filters out:
|
|
6
|
+
* - Empty strings
|
|
7
|
+
* - Emails
|
|
8
|
+
* - Single capitalized words (likely brand/proper nouns, e.g. "Intlayer")
|
|
9
|
+
* - Uncapitalized strings of 2 words or fewer (likely technical terms)
|
|
10
|
+
* - Dynamic content patterns like Vue bindings (`v-`) or object patterns (`{`)
|
|
11
|
+
*/
|
|
12
|
+
declare const shouldExtract: (text: string) => boolean;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { shouldExtract };
|
|
15
|
+
//# sourceMappingURL=shouldExtract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shouldExtract.d.ts","names":[],"sources":["../../../src/extract/shouldExtract.ts"],"mappings":";;;;;;;;;;;cAUa,gBAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/config",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.",
|
|
6
6
|
"keywords": [
|
|
@@ -57,6 +57,11 @@
|
|
|
57
57
|
"import": "./dist/esm/callers/index.mjs",
|
|
58
58
|
"require": "./dist/cjs/callers/index.cjs"
|
|
59
59
|
},
|
|
60
|
+
"./extract": {
|
|
61
|
+
"types": "./dist/types/extract/index.d.ts",
|
|
62
|
+
"import": "./dist/esm/extract/index.mjs",
|
|
63
|
+
"require": "./dist/cjs/extract/index.cjs"
|
|
64
|
+
},
|
|
60
65
|
"./utils": {
|
|
61
66
|
"types": "./dist/types/utils/index.d.ts",
|
|
62
67
|
"require": "./dist/cjs/utils/index.cjs",
|
|
@@ -116,6 +121,9 @@
|
|
|
116
121
|
"utils": [
|
|
117
122
|
"./dist/types/utils/index.d.ts"
|
|
118
123
|
],
|
|
124
|
+
"extract": [
|
|
125
|
+
"./dist/types/extract/index.d.ts"
|
|
126
|
+
],
|
|
119
127
|
"file": [
|
|
120
128
|
"./dist/types/loadExternalFile/index.d.ts"
|
|
121
129
|
],
|
|
@@ -164,7 +172,7 @@
|
|
|
164
172
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
165
173
|
},
|
|
166
174
|
"dependencies": {
|
|
167
|
-
"@intlayer/types": "9.3.
|
|
175
|
+
"@intlayer/types": "9.3.2",
|
|
168
176
|
"defu": "6.1.7",
|
|
169
177
|
"dotenv": "17.4.2",
|
|
170
178
|
"esbuild": "0.28.2",
|