@intlayer/babel 9.2.0 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/cjs/babel-plugin-intlayer-extract.cjs.map +1 -1
- package/dist/cjs/babel-plugin-intlayer-field-rename.cjs +32 -0
- package/dist/cjs/babel-plugin-intlayer-field-rename.cjs.map +1 -1
- package/dist/cjs/babel-plugin-intlayer-optimize.cjs +35 -15
- package/dist/cjs/babel-plugin-intlayer-optimize.cjs.map +1 -1
- package/dist/cjs/babel-plugin-intlayer-purge.cjs +161 -16
- package/dist/cjs/babel-plugin-intlayer-purge.cjs.map +1 -1
- package/dist/cjs/babel-plugin-intlayer-usage-analyzer.cjs +45 -1
- package/dist/cjs/babel-plugin-intlayer-usage-analyzer.cjs.map +1 -1
- package/dist/cjs/babelParser.cjs.map +1 -1
- package/dist/cjs/extractContent/babelProcessor.cjs +50 -49
- package/dist/cjs/extractContent/babelProcessor.cjs.map +1 -1
- package/dist/cjs/extractContent/contentWriter.cjs +3 -2
- package/dist/cjs/extractContent/contentWriter.cjs.map +1 -1
- package/dist/cjs/extractContent/extractContent.cjs +4 -2
- package/dist/cjs/extractContent/extractContent.cjs.map +1 -1
- package/dist/cjs/extractContent/processTsxFile.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/constants.cjs +0 -1
- package/dist/cjs/extractContent/utils/constants.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/detectPackageName.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/extractDictionaryInfo.cjs +5 -3
- package/dist/cjs/extractContent/utils/extractDictionaryInfo.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/extractDictionaryKey.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/generateKey.cjs +0 -1
- package/dist/cjs/extractContent/utils/generateKey.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/getExistingIntlayerInfo.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/resolveDictionaryKey.cjs.map +1 -1
- package/dist/cjs/extractContent/utils/shouldExtract.cjs +0 -1
- package/dist/cjs/extractContent/utils/shouldExtract.cjs.map +1 -1
- package/dist/cjs/extractScriptBlocks.cjs.map +1 -1
- package/dist/cjs/getExtractPluginOptions.cjs +4 -2
- package/dist/cjs/getExtractPluginOptions.cjs.map +1 -1
- package/dist/cjs/getOptimizePluginOptions.cjs +2 -0
- package/dist/cjs/getOptimizePluginOptions.cjs.map +1 -1
- package/dist/cjs/getPurgePluginOptions.cjs +3 -0
- package/dist/cjs/getPurgePluginOptions.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/transformers.cjs.map +1 -1
- package/dist/esm/babel-plugin-intlayer-field-rename.mjs +32 -1
- package/dist/esm/babel-plugin-intlayer-field-rename.mjs.map +1 -1
- package/dist/esm/babel-plugin-intlayer-optimize.mjs +35 -15
- package/dist/esm/babel-plugin-intlayer-optimize.mjs.map +1 -1
- package/dist/esm/babel-plugin-intlayer-purge.mjs +160 -18
- package/dist/esm/babel-plugin-intlayer-purge.mjs.map +1 -1
- package/dist/esm/babel-plugin-intlayer-usage-analyzer.mjs +45 -1
- package/dist/esm/babel-plugin-intlayer-usage-analyzer.mjs.map +1 -1
- package/dist/esm/extractContent/babelProcessor.mjs +50 -49
- package/dist/esm/extractContent/babelProcessor.mjs.map +1 -1
- package/dist/esm/extractContent/contentWriter.mjs +3 -2
- package/dist/esm/extractContent/contentWriter.mjs.map +1 -1
- package/dist/esm/extractContent/extractContent.mjs +4 -2
- package/dist/esm/extractContent/extractContent.mjs.map +1 -1
- package/dist/esm/extractContent/utils/extractDictionaryInfo.mjs +5 -3
- package/dist/esm/extractContent/utils/extractDictionaryInfo.mjs.map +1 -1
- package/dist/esm/extractContent/utils/getExistingIntlayerInfo.mjs.map +1 -1
- package/dist/esm/getExtractPluginOptions.mjs +4 -2
- package/dist/esm/getExtractPluginOptions.mjs.map +1 -1
- package/dist/esm/getOptimizePluginOptions.mjs +2 -0
- package/dist/esm/getOptimizePluginOptions.mjs.map +1 -1
- package/dist/esm/getPurgePluginOptions.mjs +3 -0
- package/dist/esm/getPurgePluginOptions.mjs.map +1 -1
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/transformers.mjs.map +1 -1
- package/dist/types/babel-plugin-intlayer-field-rename.d.ts +29 -1
- package/dist/types/babel-plugin-intlayer-field-rename.d.ts.map +1 -1
- package/dist/types/babel-plugin-intlayer-optimize.d.ts +15 -0
- package/dist/types/babel-plugin-intlayer-optimize.d.ts.map +1 -1
- package/dist/types/babel-plugin-intlayer-purge.d.ts +36 -1
- package/dist/types/babel-plugin-intlayer-purge.d.ts.map +1 -1
- package/dist/types/babel-plugin-intlayer-usage-analyzer.d.ts +30 -1
- package/dist/types/babel-plugin-intlayer-usage-analyzer.d.ts.map +1 -1
- package/dist/types/getOptimizePluginOptions.d.ts.map +1 -1
- package/dist/types/getPurgePluginOptions.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/transformers.d.ts +2 -2
- package/dist/types/transformers.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_COMPAT_CALLERS, INTLAYER_CALLER_NAMES, createPruneContext, makeUsageAnalyzerBabelPlugin } from "./babel-plugin-intlayer-usage-analyzer.mjs";
|
|
1
|
+
import { DEFAULT_COMPAT_CALLERS, INTLAYER_CALLER_NAMES, createPruneContext, makeUsageAnalyzerBabelPlugin, preserveNestedDictionaryFields } from "./babel-plugin-intlayer-usage-analyzer.mjs";
|
|
2
2
|
import { extractScriptBlocks, injectScriptBlocks } from "./extractScriptBlocks.mjs";
|
|
3
3
|
import { extractDictionaryKey, extractDictionaryKeyFromPath } from "./extractContent/utils/extractDictionaryKey.mjs";
|
|
4
4
|
import { extractDictionaryInfo, getOutput, resolveContentFilePaths } from "./extractContent/utils/extractDictionaryInfo.mjs";
|
|
@@ -10,12 +10,12 @@ import { generateKey } from "./extractContent/utils/generateKey.mjs";
|
|
|
10
10
|
import { getComponentName } from "./extractContent/utils/getComponentName.mjs";
|
|
11
11
|
import { extractContent, extractContentSync } from "./extractContent/extractContent.mjs";
|
|
12
12
|
import { intlayerExtractBabelPlugin } from "./babel-plugin-intlayer-extract.mjs";
|
|
13
|
-
import { buildNestedRenameMapFromContent, generateShortFieldName, getNestedRenameEntryAtPath, makeFieldRenameBabelPlugin, renameIntlayerFieldAccesses } from "./babel-plugin-intlayer-field-rename.mjs";
|
|
13
|
+
import { buildNestedRenameMapFromContent, generateShortFieldName, getNestedRenameEntryAtPath, makeFieldRenameBabelPlugin, renameIntlayerFieldAccesses, serializeFieldRenameMap } from "./babel-plugin-intlayer-field-rename.mjs";
|
|
14
14
|
import { intlayerOptimizeBabelPlugin } from "./babel-plugin-intlayer-optimize.mjs";
|
|
15
15
|
import { BABEL_PARSER_OPTIONS, INTLAYER_USAGE_REGEX, SOURCE_FILE_REGEX, analyzeFieldUsageInFile, buildUsageCheckRegex, getUsageCheckRegex, optimizeSourceFile, renameFieldsInCode, renameFieldsInSourceFile } from "./transformers.mjs";
|
|
16
|
-
import { getSharedPruneContext, intlayerPurgeBabelPlugin } from "./babel-plugin-intlayer-purge.mjs";
|
|
16
|
+
import { getSharedPruneContext, intlayerPurgeBabelPlugin, runIntlayerPurgePipeline } from "./babel-plugin-intlayer-purge.mjs";
|
|
17
17
|
import { intlayerMinifyBabelPlugin } from "./babel-plugin-intlayer-minify.mjs";
|
|
18
18
|
import { getOptimizePluginOptions } from "./getOptimizePluginOptions.mjs";
|
|
19
19
|
import { getMinifyPluginOptions, getPurgePluginOptions } from "./getPurgePluginOptions.mjs";
|
|
20
20
|
|
|
21
|
-
export { ATTRIBUTES_TO_EXTRACT, BABEL_PARSER_OPTIONS, DEFAULT_COMPAT_CALLERS, INTLAYER_CALLER_NAMES, INTLAYER_USAGE_REGEX, SERVER_CAPABLE_PACKAGES, SOURCE_FILE_REGEX, analyzeFieldUsageInFile, buildNestedRenameMapFromContent, buildUsageCheckRegex, createPruneContext, detectPackageName, extractContent, extractContentSync, extractDictionaryInfo, extractDictionaryKey, extractDictionaryKeyFromPath, extractScriptBlocks, generateKey, generateShortFieldName, getComponentName, getExtractPluginOptions, getMinifyPluginOptions, getNestedRenameEntryAtPath, getOptimizePluginOptions, getOutput, getPurgePluginOptions, getSharedPruneContext, getUsageCheckRegex, injectScriptBlocks, intlayerExtractBabelPlugin, intlayerMinifyBabelPlugin, intlayerOptimizeBabelPlugin, intlayerPurgeBabelPlugin, makeFieldRenameBabelPlugin, makeUsageAnalyzerBabelPlugin, mergeWithExistingMultilingualDictionary, mergeWithExistingPerLocaleDictionary, optimizeSourceFile, packageList, renameFieldsInCode, renameFieldsInSourceFile, renameIntlayerFieldAccesses, resolveContentFilePaths, writeContentHelper };
|
|
21
|
+
export { ATTRIBUTES_TO_EXTRACT, BABEL_PARSER_OPTIONS, DEFAULT_COMPAT_CALLERS, INTLAYER_CALLER_NAMES, INTLAYER_USAGE_REGEX, SERVER_CAPABLE_PACKAGES, SOURCE_FILE_REGEX, analyzeFieldUsageInFile, buildNestedRenameMapFromContent, buildUsageCheckRegex, createPruneContext, detectPackageName, extractContent, extractContentSync, extractDictionaryInfo, extractDictionaryKey, extractDictionaryKeyFromPath, extractScriptBlocks, generateKey, generateShortFieldName, getComponentName, getExtractPluginOptions, getMinifyPluginOptions, getNestedRenameEntryAtPath, getOptimizePluginOptions, getOutput, getPurgePluginOptions, getSharedPruneContext, getUsageCheckRegex, injectScriptBlocks, intlayerExtractBabelPlugin, intlayerMinifyBabelPlugin, intlayerOptimizeBabelPlugin, intlayerPurgeBabelPlugin, makeFieldRenameBabelPlugin, makeUsageAnalyzerBabelPlugin, mergeWithExistingMultilingualDictionary, mergeWithExistingPerLocaleDictionary, optimizeSourceFile, packageList, preserveNestedDictionaryFields, renameFieldsInCode, renameFieldsInSourceFile, renameIntlayerFieldAccesses, resolveContentFilePaths, runIntlayerPurgePipeline, serializeFieldRenameMap, writeContentHelper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.mjs","names":[],"sources":["../../src/transformers.ts"],"sourcesContent":["import { type TransformOptions, transformAsync } from '@babel/core';\nimport { makeFieldRenameBabelPlugin } from './babel-plugin-intlayer-field-rename';\nimport {\n intlayerOptimizeBabelPlugin,\n type OptimizePluginOptions,\n} from './babel-plugin-intlayer-optimize';\nimport {\n type CompatCallerConfig,\n makeUsageAnalyzerBabelPlugin,\n type PruneContext,\n} from './babel-plugin-intlayer-usage-analyzer';\nimport { extractScriptBlocks, injectScriptBlocks } from './extractScriptBlocks';\n\n// ── Shared Babel parser configuration ─────────────────────────────────────────\n\n/**\n * Babel parser options covering the superset of syntaxes used across all\n * supported frameworks (React / Vue / Svelte / Angular / …).\n */\nexport const BABEL_PARSER_OPTIONS: NonNullable<TransformOptions['parserOpts']> =\n {\n sourceType: 'module',\n allowImportExportEverywhere: true,\n plugins: [\n 'typescript',\n 'jsx',\n 'decorators-legacy',\n 'classProperties',\n 'objectRestSpread',\n 'asyncGenerators',\n 'functionBind',\n 'exportDefaultFrom',\n 'exportNamespaceFrom',\n 'dynamicImport',\n 'nullishCoalescingOperator',\n 'optionalChaining',\n ],\n };\n\n/**\n * Fast pre-check: matches files that could contain native intlayer calls\n * (`useIntlayer` / `getIntlayer`). Used by the optimize/transform pass, which\n * only rewrites native calls.\n */\nexport const INTLAYER_USAGE_REGEX = /\\b(use|get)Intlayer\\b/;\n\n/**\n * Builds a fast pre-check regex that matches files potentially containing\n * native intlayer calls and/or the given compat namespace caller names.\n *\n * The result is used to skip files that definitely contain none of the\n * relevant function names, avoiding unnecessary Babel parsing.\n *\n * Compat caller names are NOT hardcoded here — they are provided at runtime by\n * the compat adapter packages that configure the usage-analysis pipeline.\n *\n * @param extraCallerNames - Additional caller function names to match\n * (e.g. `['useTranslation', 'getFixedT']` from `@intlayer/react-i18next`).\n * @returns A `RegExp` matching any of the native or provided caller names.\n */\nexport const buildUsageCheckRegex = (extraCallerNames?: string[]): RegExp => {\n const callerNames = [\n 'useIntlayer',\n 'getIntlayer',\n ...(extraCallerNames ?? []),\n ];\n const uniqueNames = [...new Set(callerNames)];\n return new RegExp(`\\\\b(${uniqueNames.join('|')})\\\\b`);\n};\n\n/** Usage-check regex covering only the native callers (no compat callers). */\nconst NATIVE_USAGE_CHECK_REGEX = buildUsageCheckRegex();\n\n/** Cache of usage-check regexes, keyed by the compat-caller array reference. */\nconst usageCheckRegexCache = new WeakMap<\n readonly CompatCallerConfig[],\n RegExp\n>();\n\n/**\n * Returns the usage-check regex for the given compat callers, memoised by the\n * array reference. Plugins pass the same options array for every analysed\n * file, so the regex is built once per build instead of once per file.\n */\nexport const getUsageCheckRegex = (\n compatCallers?: readonly CompatCallerConfig[]\n): RegExp => {\n if (!compatCallers || compatCallers.length === 0) {\n return NATIVE_USAGE_CHECK_REGEX;\n }\n\n let usageCheckRegex = usageCheckRegexCache.get(compatCallers);\n if (!usageCheckRegex) {\n usageCheckRegex = buildUsageCheckRegex(\n compatCallers.map((caller) => caller.callerName)\n );\n usageCheckRegexCache.set(compatCallers, usageCheckRegex);\n }\n return usageCheckRegex;\n};\n\n/**\n * Matches source files that are valid targets for usage analysis and Babel\n * transformation. Excludes sourcemap files, declaration files, and other\n * non-source extensions.\n */\nexport const SOURCE_FILE_REGEX = /\\.(tsx?|[mc]?jsx?|vue|svelte|astro)$/;\n\n// ── High-level transformer functions ──────────────────────────────────────────\n\n/**\n * Runs the usage-analysis Babel plugin on a single JS/TS code string.\n *\n * This is analysis-only: the transformed code output is discarded.\n * Throws if Babel cannot parse the content.\n */\nconst analyzeScriptContent = async (\n scriptContent: string,\n sourceFilePath: string,\n pruneContext: PruneContext,\n compatCallers?: CompatCallerConfig[]\n): Promise<void> => {\n await transformAsync(scriptContent, {\n filename: sourceFilePath,\n plugins: [makeUsageAnalyzerBabelPlugin(pruneContext, { compatCallers })],\n parserOpts: BABEL_PARSER_OPTIONS,\n ast: false,\n code: false, // analysis only – no output needed\n });\n};\n\n/**\n * Runs the usage-analysis Babel plugin on a source file, accumulating\n * field-usage data into `pruneContext`.\n *\n * For Vue / Svelte SFC files, script blocks are extracted before analysis so\n * Babel does not attempt to parse the full SFC syntax (templates, styles, …).\n * For plain JS/TS files, the whole file content is analysed directly.\n *\n * This is analysis-only: the transformed code output is discarded.\n * Throws if Babel cannot parse the file (caller should handle and flag\n * `pruneContext.hasUnparsableSourceFiles`).\n */\nexport const analyzeFieldUsageInFile = async (\n sourceFilePath: string,\n code: string,\n pruneContext: PruneContext,\n compatCallers?: CompatCallerConfig[]\n): Promise<void> => {\n const usageCheckRegex = getUsageCheckRegex(compatCallers);\n const scriptBlocks = extractScriptBlocks(sourceFilePath, code);\n\n // For SFC files (Vue / Svelte): scriptBlocks[0].contentStartOffset > 0\n // means we extracted actual <script> tags from the file.\n // For plain JS/TS: extractScriptBlocks returns the whole file as a single\n // block with offset 0, so we fall through to the same path.\n for (const block of scriptBlocks) {\n if (!usageCheckRegex.test(block.content)) continue;\n await analyzeScriptContent(\n block.content,\n sourceFilePath,\n pruneContext,\n compatCallers\n );\n }\n};\n\n/**\n * Applies field-renaming to a single JS/TS code string (not an SFC).\n *\n * Returns the renamed code string, or `null` if nothing changed or if\n * Babel failed to parse the input (caller should fall back to original code).\n */\nexport const renameFieldsInCode = async (\n code: string,\n sourceFilePath: string,\n pruneContext: PruneContext\n): Promise<string | null> => {\n try {\n const result = await transformAsync(code, {\n filename: sourceFilePath,\n plugins: [makeFieldRenameBabelPlugin(pruneContext)],\n parserOpts: BABEL_PARSER_OPTIONS,\n ast: false,\n });\n return result?.code ?? null;\n } catch {\n return null; // parse failure – caller falls back to original code\n }\n};\n\n/**\n * Applies field-renaming to a source file, correctly handling both plain\n * JS/TS files and SFC files (Vue / Svelte) by operating on each script block\n * individually and injecting the results back into the original source.\n *\n * Returns the renamed code string, or `null` if nothing changed.\n */\nexport const renameFieldsInSourceFile = async (\n sourceFilePath: string,\n code: string,\n pruneContext: PruneContext\n): Promise<string | null> => {\n if (pruneContext.dictionaryKeyToFieldRenameMap.size === 0) return null;\n if (!INTLAYER_USAGE_REGEX.test(code)) return null;\n\n const scriptBlocks = extractScriptBlocks(sourceFilePath, code);\n\n const isSFC =\n scriptBlocks.length > 0 &&\n ((scriptBlocks[0]?.contentStartOffset ?? 0) > 0 || scriptBlocks.length > 1);\n\n if (isSFC) {\n // Raw SFC: rename each script block individually and inject back.\n const modifications: Array<{\n block: (typeof scriptBlocks)[number];\n modifiedContent: string;\n }> = [];\n\n for (const block of scriptBlocks) {\n if (!INTLAYER_USAGE_REGEX.test(block.content)) continue;\n\n const renamedCode = await renameFieldsInCode(\n block.content,\n sourceFilePath,\n pruneContext\n );\n if (renamedCode && renamedCode !== block.content) {\n modifications.push({ block, modifiedContent: renamedCode });\n }\n }\n\n if (modifications.length === 0) return null;\n return injectScriptBlocks(code, modifications);\n }\n\n // Plain JS/TS or compiled SFC (no block delimiters) – rename the whole file.\n return renameFieldsInCode(code, sourceFilePath, pruneContext);\n};\n\n/**\n * Runs the intlayer optimize Babel plugin on a source file, transforming\n * `useIntlayer('key')` / `getIntlayer('key')` calls into `useDictionary(_hash)`\n * / `getDictionary(_hash)` and injecting the corresponding dictionary imports.\n *\n * Returns `{ code, map }` on success, or `null` if the transformation produced\n * no output.\n */\nexport const optimizeSourceFile = async (\n code: string,\n sourceFilePath: string,\n options: OptimizePluginOptions\n): Promise<{\n code: string;\n map: string | object | null | undefined;\n} | null> => {\n const result = await transformAsync(code, {\n filename: sourceFilePath,\n plugins: [[intlayerOptimizeBabelPlugin, options]],\n parserOpts: BABEL_PARSER_OPTIONS,\n });\n\n if (!result?.code) return null;\n\n return { code: result.code, map: result.map };\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"transformers.mjs","names":[],"sources":["../../src/transformers.ts"],"sourcesContent":["import { transformAsync } from '@babel/core';\n// Typed from `@babel/parser` rather than `@babel/core`'s\n// `InputOptions['parserOpts']` (Babel 8's rename of `TransformOptions`): the\n// two describe the same shape, but naming `@babel/core` in an exported type\n// pulls its declaration file into every consumer's type-check, and that file\n// needs `@types/convert-source-map` to resolve.\nimport type { ParserOptions } from '@babel/parser';\nimport { makeFieldRenameBabelPlugin } from './babel-plugin-intlayer-field-rename';\nimport {\n intlayerOptimizeBabelPlugin,\n type OptimizePluginOptions,\n} from './babel-plugin-intlayer-optimize';\nimport {\n type CompatCallerConfig,\n makeUsageAnalyzerBabelPlugin,\n type PruneContext,\n} from './babel-plugin-intlayer-usage-analyzer';\nimport { extractScriptBlocks, injectScriptBlocks } from './extractScriptBlocks';\n\n// ── Shared Babel parser configuration ─────────────────────────────────────────\n\n/**\n * Babel parser options covering the superset of syntaxes used across all\n * supported frameworks (React / Vue / Svelte / Angular / …).\n */\nexport const BABEL_PARSER_OPTIONS: ParserOptions = {\n sourceType: 'module',\n allowImportExportEverywhere: true,\n plugins: [\n 'typescript',\n 'jsx',\n 'decorators-legacy',\n 'classProperties',\n 'objectRestSpread',\n 'asyncGenerators',\n 'functionBind',\n 'exportDefaultFrom',\n 'exportNamespaceFrom',\n 'dynamicImport',\n 'nullishCoalescingOperator',\n 'optionalChaining',\n ],\n};\n\n/**\n * Fast pre-check: matches files that could contain native intlayer calls\n * (`useIntlayer` / `getIntlayer`). Used by the optimize/transform pass, which\n * only rewrites native calls.\n */\nexport const INTLAYER_USAGE_REGEX = /\\b(use|get)Intlayer\\b/;\n\n/**\n * Builds a fast pre-check regex that matches files potentially containing\n * native intlayer calls and/or the given compat namespace caller names.\n *\n * The result is used to skip files that definitely contain none of the\n * relevant function names, avoiding unnecessary Babel parsing.\n *\n * Compat caller names are NOT hardcoded here — they are provided at runtime by\n * the compat adapter packages that configure the usage-analysis pipeline.\n *\n * @param extraCallerNames - Additional caller function names to match\n * (e.g. `['useTranslation', 'getFixedT']` from `@intlayer/react-i18next`).\n * @returns A `RegExp` matching any of the native or provided caller names.\n */\nexport const buildUsageCheckRegex = (extraCallerNames?: string[]): RegExp => {\n const callerNames = [\n 'useIntlayer',\n 'getIntlayer',\n ...(extraCallerNames ?? []),\n ];\n const uniqueNames = [...new Set(callerNames)];\n return new RegExp(`\\\\b(${uniqueNames.join('|')})\\\\b`);\n};\n\n/** Usage-check regex covering only the native callers (no compat callers). */\nconst NATIVE_USAGE_CHECK_REGEX = buildUsageCheckRegex();\n\n/** Cache of usage-check regexes, keyed by the compat-caller array reference. */\nconst usageCheckRegexCache = new WeakMap<\n readonly CompatCallerConfig[],\n RegExp\n>();\n\n/**\n * Returns the usage-check regex for the given compat callers, memoised by the\n * array reference. Plugins pass the same options array for every analysed\n * file, so the regex is built once per build instead of once per file.\n */\nexport const getUsageCheckRegex = (\n compatCallers?: readonly CompatCallerConfig[]\n): RegExp => {\n if (!compatCallers || compatCallers.length === 0) {\n return NATIVE_USAGE_CHECK_REGEX;\n }\n\n let usageCheckRegex = usageCheckRegexCache.get(compatCallers);\n if (!usageCheckRegex) {\n usageCheckRegex = buildUsageCheckRegex(\n compatCallers.map((caller) => caller.callerName)\n );\n usageCheckRegexCache.set(compatCallers, usageCheckRegex);\n }\n return usageCheckRegex;\n};\n\n/**\n * Matches source files that are valid targets for usage analysis and Babel\n * transformation. Excludes sourcemap files, declaration files, and other\n * non-source extensions.\n */\nexport const SOURCE_FILE_REGEX = /\\.(tsx?|[mc]?jsx?|vue|svelte|astro)$/;\n\n// ── High-level transformer functions ──────────────────────────────────────────\n\n/**\n * Runs the usage-analysis Babel plugin on a single JS/TS code string.\n *\n * This is analysis-only: the transformed code output is discarded.\n * Throws if Babel cannot parse the content.\n */\nconst analyzeScriptContent = async (\n scriptContent: string,\n sourceFilePath: string,\n pruneContext: PruneContext,\n compatCallers?: CompatCallerConfig[]\n): Promise<void> => {\n await transformAsync(scriptContent, {\n filename: sourceFilePath,\n plugins: [makeUsageAnalyzerBabelPlugin(pruneContext, { compatCallers })],\n parserOpts: BABEL_PARSER_OPTIONS,\n ast: false,\n code: false, // analysis only – no output needed\n });\n};\n\n/**\n * Runs the usage-analysis Babel plugin on a source file, accumulating\n * field-usage data into `pruneContext`.\n *\n * For Vue / Svelte SFC files, script blocks are extracted before analysis so\n * Babel does not attempt to parse the full SFC syntax (templates, styles, …).\n * For plain JS/TS files, the whole file content is analysed directly.\n *\n * This is analysis-only: the transformed code output is discarded.\n * Throws if Babel cannot parse the file (caller should handle and flag\n * `pruneContext.hasUnparsableSourceFiles`).\n */\nexport const analyzeFieldUsageInFile = async (\n sourceFilePath: string,\n code: string,\n pruneContext: PruneContext,\n compatCallers?: CompatCallerConfig[]\n): Promise<void> => {\n const usageCheckRegex = getUsageCheckRegex(compatCallers);\n const scriptBlocks = extractScriptBlocks(sourceFilePath, code);\n\n // For SFC files (Vue / Svelte): scriptBlocks[0].contentStartOffset > 0\n // means we extracted actual <script> tags from the file.\n // For plain JS/TS: extractScriptBlocks returns the whole file as a single\n // block with offset 0, so we fall through to the same path.\n for (const block of scriptBlocks) {\n if (!usageCheckRegex.test(block.content)) continue;\n await analyzeScriptContent(\n block.content,\n sourceFilePath,\n pruneContext,\n compatCallers\n );\n }\n};\n\n/**\n * Applies field-renaming to a single JS/TS code string (not an SFC).\n *\n * Returns the renamed code string, or `null` if nothing changed or if\n * Babel failed to parse the input (caller should fall back to original code).\n */\nexport const renameFieldsInCode = async (\n code: string,\n sourceFilePath: string,\n pruneContext: PruneContext\n): Promise<string | null> => {\n try {\n const result = await transformAsync(code, {\n filename: sourceFilePath,\n plugins: [makeFieldRenameBabelPlugin(pruneContext)],\n parserOpts: BABEL_PARSER_OPTIONS,\n ast: false,\n });\n return result?.code ?? null;\n } catch {\n return null; // parse failure – caller falls back to original code\n }\n};\n\n/**\n * Applies field-renaming to a source file, correctly handling both plain\n * JS/TS files and SFC files (Vue / Svelte) by operating on each script block\n * individually and injecting the results back into the original source.\n *\n * Returns the renamed code string, or `null` if nothing changed.\n */\nexport const renameFieldsInSourceFile = async (\n sourceFilePath: string,\n code: string,\n pruneContext: PruneContext\n): Promise<string | null> => {\n if (pruneContext.dictionaryKeyToFieldRenameMap.size === 0) return null;\n if (!INTLAYER_USAGE_REGEX.test(code)) return null;\n\n const scriptBlocks = extractScriptBlocks(sourceFilePath, code);\n\n const isSFC =\n scriptBlocks.length > 0 &&\n ((scriptBlocks[0]?.contentStartOffset ?? 0) > 0 || scriptBlocks.length > 1);\n\n if (isSFC) {\n // Raw SFC: rename each script block individually and inject back.\n const modifications: Array<{\n block: (typeof scriptBlocks)[number];\n modifiedContent: string;\n }> = [];\n\n for (const block of scriptBlocks) {\n if (!INTLAYER_USAGE_REGEX.test(block.content)) continue;\n\n const renamedCode = await renameFieldsInCode(\n block.content,\n sourceFilePath,\n pruneContext\n );\n if (renamedCode && renamedCode !== block.content) {\n modifications.push({ block, modifiedContent: renamedCode });\n }\n }\n\n if (modifications.length === 0) return null;\n return injectScriptBlocks(code, modifications);\n }\n\n // Plain JS/TS or compiled SFC (no block delimiters) – rename the whole file.\n return renameFieldsInCode(code, sourceFilePath, pruneContext);\n};\n\n/**\n * Runs the intlayer optimize Babel plugin on a source file, transforming\n * `useIntlayer('key')` / `getIntlayer('key')` calls into `useDictionary(_hash)`\n * / `getDictionary(_hash)` and injecting the corresponding dictionary imports.\n *\n * Returns `{ code, map }` on success, or `null` if the transformation produced\n * no output.\n */\nexport const optimizeSourceFile = async (\n code: string,\n sourceFilePath: string,\n options: OptimizePluginOptions\n): Promise<{\n code: string;\n map: string | object | null | undefined;\n} | null> => {\n const result = await transformAsync(code, {\n filename: sourceFilePath,\n plugins: [[intlayerOptimizeBabelPlugin, options]],\n parserOpts: BABEL_PARSER_OPTIONS,\n });\n\n if (!result?.code) return null;\n\n return { code: result.code, map: result.map };\n};\n"],"mappings":"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"}
|
|
@@ -47,6 +47,34 @@ declare const buildNestedRenameMapFromContent: (contentValue: unknown) => Nested
|
|
|
47
47
|
* @param fieldPath - Original (pre-rename) field names from the content root.
|
|
48
48
|
*/
|
|
49
49
|
declare const getNestedRenameEntryAtPath: (renameMap: NestedRenameMap, fieldPath: readonly string[]) => NestedRenameEntry | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* JSON-serialisable form of a {@link NestedRenameEntry}.
|
|
52
|
+
*
|
|
53
|
+
* Mirrors `FieldRenameNode` in the `@intlayer/swc` crate — both sides must stay
|
|
54
|
+
* in sync.
|
|
55
|
+
*/
|
|
56
|
+
type SerializedFieldRenameEntry = {
|
|
57
|
+
/** Short alphabetic alias the field is renamed to (`'a'`, `'b'`, …). */
|
|
58
|
+
shortName: string;
|
|
59
|
+
/** Rename table of the fields nested inside this one. */
|
|
60
|
+
children: SerializedFieldRenameMap;
|
|
61
|
+
};
|
|
62
|
+
/** JSON-serialisable form of a {@link NestedRenameMap}. */
|
|
63
|
+
type SerializedFieldRenameMap = Record<string, SerializedFieldRenameEntry>;
|
|
64
|
+
/**
|
|
65
|
+
* Converts the field-rename tables of a {@link PruneContext} into a plain JSON
|
|
66
|
+
* object, keyed by dictionary key.
|
|
67
|
+
*
|
|
68
|
+
* Consumed by bundler integrations that cannot run the Babel rename plugin and
|
|
69
|
+
* must forward the tables to another transformer — currently the `@intlayer/swc`
|
|
70
|
+
* Wasm plugin used by Next.js, which rewrites the source accesses itself.
|
|
71
|
+
*
|
|
72
|
+
* Dictionaries flagged as structural edge cases are omitted: the JSON pipeline
|
|
73
|
+
* leaves them untouched, so their source accesses must stay untouched too.
|
|
74
|
+
* Empty tables are omitted as well, so the result is empty when there is
|
|
75
|
+
* nothing to rename.
|
|
76
|
+
*/
|
|
77
|
+
declare const serializeFieldRenameMap: (pruneContext: PruneContext) => Record<string, SerializedFieldRenameMap>;
|
|
50
78
|
/**
|
|
51
79
|
* Rewrites dictionary content field accesses in the given program to the
|
|
52
80
|
* short aliases defined in `pruneContext.dictionaryKeyToFieldRenameMap`.
|
|
@@ -85,5 +113,5 @@ declare const makeFieldRenameBabelPlugin: (pruneContext: PruneContext) => ({ typ
|
|
|
85
113
|
types: typeof BabelTypes;
|
|
86
114
|
}) => PluginObject;
|
|
87
115
|
//#endregion
|
|
88
|
-
export { buildNestedRenameMapFromContent, generateShortFieldName, getNestedRenameEntryAtPath, makeFieldRenameBabelPlugin, renameIntlayerFieldAccesses };
|
|
116
|
+
export { SerializedFieldRenameEntry, SerializedFieldRenameMap, buildNestedRenameMapFromContent, generateShortFieldName, getNestedRenameEntryAtPath, makeFieldRenameBabelPlugin, renameIntlayerFieldAccesses, serializeFieldRenameMap };
|
|
89
117
|
//# sourceMappingURL=babel-plugin-intlayer-field-rename.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-intlayer-field-rename.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-field-rename.ts"],"mappings":";;;;;;;;cA0Ba,yBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0CtB,kCAA+B,0BAEzC;;;;;;;;;;;;cA2EU,6BAA0B,WAC1B,iBAAe,iCAEzB;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"babel-plugin-intlayer-field-rename.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-field-rename.ts"],"mappings":";;;;;;;;cA0Ba,yBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0CtB,kCAA+B,0BAEzC;;;;;;;;;;;;cA2EU,6BAA0B,WAC1B,iBAAe,iCAEzB;;;;;;;KAqBS;;EAEV;;EAEA,UAAU;;;KAIA,2BAA2B,eAErC;;;;;;;;;;;;;;cAgCW,0BAAuB,cACpB,iBACb,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;cAoSL,8BAA2B,mBACnB,YAAU,aAChB,SAAS,WAAW,UAAQ,cAC3B;;;;;;;;;;cA8IH,6BAA0B,cACtB,oBAAY,OAAA;EACD,cAAc;MAAe"}
|
|
@@ -47,6 +47,21 @@ type OptimizePluginOptions = {
|
|
|
47
47
|
* If true, the plugin will replace the dictionary entry file with `export default {}`.
|
|
48
48
|
*/
|
|
49
49
|
replaceDictionaryEntry: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Keys of the dictionaries that reference other dictionaries through
|
|
52
|
+
* `nest()`.
|
|
53
|
+
*
|
|
54
|
+
* For those, the injected static import points at the generated companion
|
|
55
|
+
* module (`<dictionariesDir>/nested/<key>.mjs`) instead of the raw JSON. The
|
|
56
|
+
* companion re-exports the dictionary with its nest targets attached, so
|
|
57
|
+
* `getNesting` resolves them from that local reference rather than from the
|
|
58
|
+
* global registry this plugin empties — and each target lands in the chunk of
|
|
59
|
+
* the dictionary referencing it.
|
|
60
|
+
*
|
|
61
|
+
* Dynamic and fetch modes need nothing here: their generated loaders already
|
|
62
|
+
* attach the same targets per locale.
|
|
63
|
+
*/
|
|
64
|
+
nestingDictionaryKeys?: string[];
|
|
50
65
|
/**
|
|
51
66
|
* If true, the plugin will activate the dynamic import of the dictionaries. It will rely on Suspense to load the dictionaries.
|
|
52
67
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-intlayer-optimize.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-optimize.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"babel-plugin-intlayer-optimize.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-optimize.ts"],"mappings":";;;;cA8BM;;;;KAqDM;;;;EAIV;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;;;;;;;;;;;;EAeA;;;;EAIA;;;;EAIA,oBAAoB;;;;EAOpB;;;;EAIA;;;;;;;;;;;;;;EAcA,gBAAgB;;KAGb,QAAQ;EACX,MAAM;;EAEN,oBAAoB,YAAY,WAAW;;EAE3C,qBAAqB,YAAY,WAAW;;EAE5C;;EAEA,aAAa,oBAAoB;;EAEjC,oBAAoB;;EAEpB,mBAAmB,YAAY;;EAE/B;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiTW,8BAA2B;EACtC,cAAc;MACZ,aAAa"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CompatCallerConfig, PruneContext } from "./babel-plugin-intlayer-usage-analyzer.js";
|
|
2
2
|
import { PluginObject } from "@babel/core";
|
|
3
3
|
import * as BabelTypes from "@babel/types";
|
|
4
|
+
import { IntlayerConfig } from "@intlayer/types/config";
|
|
5
|
+
import { NestedFieldReferences } from "@intlayer/core/dictionaryManipulator";
|
|
4
6
|
//#region src/babel-plugin-intlayer-purge.d.ts
|
|
5
7
|
/**
|
|
6
8
|
* Pre-resolved options accepted by {@link intlayerPurgeBabelPlugin}.
|
|
@@ -54,6 +56,14 @@ type PurgePluginOptions = {
|
|
|
54
56
|
* `content` glob patterns.
|
|
55
57
|
*/
|
|
56
58
|
componentFilesList: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Dictionaries referenced through `nest()`, mapped to the top-level fields
|
|
61
|
+
* those references read (`'all'` when the whole dictionary is nested).
|
|
62
|
+
*
|
|
63
|
+
* Those fields are resolved at runtime by `getNesting` using their original
|
|
64
|
+
* names, so they must survive purging and must never be renamed.
|
|
65
|
+
*/
|
|
66
|
+
nestedDictionaryReferences?: Map<string, NestedFieldReferences>;
|
|
57
67
|
/**
|
|
58
68
|
* Per-dictionary import-mode overrides, keyed by dictionary `key`.
|
|
59
69
|
* Dictionaries with mode `'fetch'` are excluded from field renaming because
|
|
@@ -72,6 +82,13 @@ type PurgePluginOptions = {
|
|
|
72
82
|
* Defaults to `[]` (no compat callers) when omitted.
|
|
73
83
|
*/
|
|
74
84
|
compatCallers?: CompatCallerConfig[];
|
|
85
|
+
/**
|
|
86
|
+
* Logging configuration used to report what the pipeline purged and
|
|
87
|
+
* minified, so a Babel- or SWC-driven build prints the same summary as the
|
|
88
|
+
* Vite one. Mirrors `log` in `intlayer.config.ts`; omit to fall back to the
|
|
89
|
+
* logger defaults.
|
|
90
|
+
*/
|
|
91
|
+
logConfig?: Pick<IntlayerConfig, 'log'>;
|
|
75
92
|
};
|
|
76
93
|
/**
|
|
77
94
|
* Returns the shared {@link PruneContext} for the given base directory, or
|
|
@@ -82,6 +99,24 @@ type PurgePluginOptions = {
|
|
|
82
99
|
* creating a circular dependency.
|
|
83
100
|
*/
|
|
84
101
|
declare const getSharedPruneContext: (baseDir: string) => PruneContext | null;
|
|
102
|
+
/**
|
|
103
|
+
* Runs the full purge/minify pipeline for the given options, using a
|
|
104
|
+
* module-level cache so the work happens at most once per process per
|
|
105
|
+
* unique `baseDir`.
|
|
106
|
+
*
|
|
107
|
+
* Exported so bundler integrations that do not go through Babel can drive the
|
|
108
|
+
* same pipeline. The Next.js integration is the main consumer: its SWC plugin
|
|
109
|
+
* runs as a per-file Wasm transform with no filesystem access, so the analysis
|
|
110
|
+
* and the dictionary rewrite happen here, in Node, and only the resulting
|
|
111
|
+
* field-rename tables (see {@link serializeFieldRenameMap}) are forwarded to
|
|
112
|
+
* the plugin.
|
|
113
|
+
*
|
|
114
|
+
* **This performs file I/O**: it reads every source file listed in
|
|
115
|
+
* `componentFilesList` and overwrites the compiled dictionary JSON files
|
|
116
|
+
* in-place. Call it at most once per build, after the dictionaries have been
|
|
117
|
+
* built.
|
|
118
|
+
*/
|
|
119
|
+
declare const runIntlayerPurgePipeline: (options: PurgePluginOptions) => PruneContext;
|
|
85
120
|
/**
|
|
86
121
|
* Babel plugin that analyses all project source files and rewrites compiled
|
|
87
122
|
* dictionary JSON files in-place to remove unused content fields
|
|
@@ -134,5 +169,5 @@ declare const intlayerPurgeBabelPlugin: (_babel: {
|
|
|
134
169
|
types: typeof BabelTypes;
|
|
135
170
|
}) => PluginObject;
|
|
136
171
|
//#endregion
|
|
137
|
-
export { PurgePluginOptions, getSharedPruneContext, intlayerPurgeBabelPlugin };
|
|
172
|
+
export { PurgePluginOptions, getSharedPruneContext, intlayerPurgeBabelPlugin, runIntlayerPurgePipeline };
|
|
138
173
|
//# sourceMappingURL=babel-plugin-intlayer-purge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-intlayer-purge.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-purge.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"babel-plugin-intlayer-purge.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-purge.ts"],"mappings":";;;;;;;;;;;;;KA2CY;;;;;;EAMV;;;;;EAMA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;;EAOA;;;;;;;;EASA,6BAA6B,YAAY;;;;;;EAOzC,8BAA8B;;;;;;;;;;;;EAgB9B,gBAAgB;;;;;;;EAQhB,YAAY,KAAK;;;;;;;;;;cAwBN,wBAAqB,oBAAsB;;;;;;;;;;;;;;;;;;cAssB3C,2BAAwB,SAC1B,uBACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2HU,2BAAwB;EACnC,cAAc;MACZ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PluginObject } from "@babel/core";
|
|
2
2
|
import * as BabelTypes from "@babel/types";
|
|
3
3
|
import { CallerDescriptor, CallerDescriptor as CallerDescriptor$1, CallerResultShape, CallerValueSource } from "@intlayer/config/callers";
|
|
4
|
+
import { NestedFieldReferences } from "@intlayer/core/dictionaryManipulator";
|
|
4
5
|
//#region src/babel-plugin-intlayer-usage-analyzer.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* Dictionary field usage result for a single dictionary key.
|
|
@@ -117,6 +118,34 @@ type PruneContext = {
|
|
|
117
118
|
}[]>;
|
|
118
119
|
};
|
|
119
120
|
declare const createPruneContext: () => PruneContext;
|
|
121
|
+
/**
|
|
122
|
+
* Records `nest()` references in a prune context so nest targets stay
|
|
123
|
+
* resolvable — and no larger than they need to be — after purge and minify.
|
|
124
|
+
*
|
|
125
|
+
* A nested node stores the ORIGINAL dot path of the field it reads
|
|
126
|
+
* (`nest('common', 'period')` → `'period'`) and `getNesting` resolves it at
|
|
127
|
+
* runtime against the compiled JSON. That drives three adjustments:
|
|
128
|
+
*
|
|
129
|
+
* - Nest targets never take part in field renaming, since the stored path
|
|
130
|
+
* would no longer match the renamed keys.
|
|
131
|
+
* - A target already consumed by a call site keeps its analysed fields plus
|
|
132
|
+
* the nested ones, so neither consumer loses content.
|
|
133
|
+
* - A target reached *only* through `nest()` is given a usage entry holding
|
|
134
|
+
* exactly the nested fields. Without one, the purge pass leaves the whole
|
|
135
|
+
* dictionary untouched; with one, it trims the dictionary down to what the
|
|
136
|
+
* nest references actually read. This matters most for `dynamic` / `fetch`
|
|
137
|
+
* dictionaries, whose full static snapshot would otherwise be pulled into
|
|
138
|
+
* the eager bundle just to satisfy a single nested field.
|
|
139
|
+
*
|
|
140
|
+
* Seeding is skipped when a source file failed to parse: that file could
|
|
141
|
+
* reference the dictionary in a way the analysis never saw, which is the same
|
|
142
|
+
* guard the purge pass applies to keys with no usage entry.
|
|
143
|
+
*
|
|
144
|
+
* @param pruneContext - Shared analysis state to update in place.
|
|
145
|
+
* @param nestedDictionaryReferences - Nest-target key → referenced top-level
|
|
146
|
+
* fields, as returned by `getNestedDictionaryReferences`.
|
|
147
|
+
*/
|
|
148
|
+
declare const preserveNestedDictionaryFields: (pruneContext: PruneContext, nestedDictionaryReferences: Map<string, NestedFieldReferences>) => void;
|
|
120
149
|
/** Canonical intlayer caller names that trigger usage analysis. */
|
|
121
150
|
declare const INTLAYER_CALLER_NAMES: readonly ['useIntlayer', 'getIntlayer'];
|
|
122
151
|
type IntlayerCallerName = (typeof INTLAYER_CALLER_NAMES)[number];
|
|
@@ -158,5 +187,5 @@ declare const makeUsageAnalyzerBabelPlugin: (pruneContext: PruneContext, options
|
|
|
158
187
|
types: typeof BabelTypes;
|
|
159
188
|
}) => PluginObject;
|
|
160
189
|
//#endregion
|
|
161
|
-
export { type CallerDescriptor, type CallerResultShape, type CallerValueSource, CompatCallerConfig, DEFAULT_COMPAT_CALLERS, DictionaryFieldUsage, INTLAYER_CALLER_NAMES, IntlayerCallerName, NestedRenameEntry, NestedRenameMap, OpaqueFieldOccurrence, PruneContext, createPruneContext, makeUsageAnalyzerBabelPlugin };
|
|
190
|
+
export { type CallerDescriptor, type CallerResultShape, type CallerValueSource, CompatCallerConfig, DEFAULT_COMPAT_CALLERS, DictionaryFieldUsage, INTLAYER_CALLER_NAMES, IntlayerCallerName, NestedRenameEntry, NestedRenameMap, OpaqueFieldOccurrence, PruneContext, createPruneContext, makeUsageAnalyzerBabelPlugin, preserveNestedDictionaryFields };
|
|
162
191
|
//# sourceMappingURL=babel-plugin-intlayer-usage-analyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-intlayer-usage-analyzer.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-usage-analyzer.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"babel-plugin-intlayer-usage-analyzer.d.ts","names":[],"sources":["../../src/babel-plugin-intlayer-usage-analyzer.ts"],"mappings":";;;;;;;;;;;;KAiBY,uBAAuB;;;;;;;;KASvB;EACV;EACA,UAAU;;;KAIA,kBAAkB,YAAY;;;;;;;KAQ9B;;;;;;EAMV;;EAGA;;;;;;;;;KAUU;;;;;;EAMV,8BAA8B,YAAY;;;;;EAM1C,2BAA2B;;;;;;EAO3B;;;;;;EAOA,qCAAqC;;;;;;EAOrC,+BAA+B,YAAY;;;;;;;;;;;;EAa3C,gCAAgC,YAE9B,YAAY;;;;;;;;;;;;;EAed,iCAAiC;;;;;;;;;;;EAYjC,0BAA0B;IAEtB;IAAsB;;;cAIf,0BAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyCzB,iCAA8B,cAC3B,cAAY,4BACE,YAAY;;cAwC7B;KACD,6BAA6B;;;;;;;KAmB7B,qBAAqB;;;;;;;;;;;cAYpB,wBAAwB;;;;;;;;;;;;;;;cAmiCxB,+BAA4B,cAEvB,cAAY;EACd,gBAAgB;SAAsB,OAAA;EAE1B,cAAc;MAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOptimizePluginOptions.d.ts","names":[],"sources":["../../src/getOptimizePluginOptions.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"getOptimizePluginOptions.d.ts","names":[],"sources":["../../src/getOptimizePluginOptions.ts"],"mappings":";;;;KAWK;;;;EAIH,gBAAgB;;;;EAIhB,eAAe;;;;;;EAMf;;;;EAIA,YAAY,QAAQ;;;;;;;cAyBT,2BAAwB,SAC1B,mCACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPurgePluginOptions.d.ts","names":[],"sources":["../../src/getPurgePluginOptions.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"getPurgePluginOptions.d.ts","names":[],"sources":["../../src/getPurgePluginOptions.ts"],"mappings":";;;;;KAmCK;;;;;;EAMH,gBAAgB;;;;;;EAOhB,eAAe;;;;EAKf,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;cA0BT,wBAAqB,SACvB,gCACR;KA8CE;;;;EAIH,gBAAgB;;;;EAKhB,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;cAwBT,yBAAsB,SACxB,iCACR"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ATTRIBUTES_TO_EXTRACT, PackageName, SERVER_CAPABLE_PACKAGES, packageList } from "./extractContent/utils/constants.js";
|
|
2
2
|
import { ExtractPluginOptions, ExtractResult, intlayerExtractBabelPlugin } from "./babel-plugin-intlayer-extract.js";
|
|
3
|
-
import { CallerDescriptor, CallerResultShape, CallerValueSource, CompatCallerConfig, DEFAULT_COMPAT_CALLERS, DictionaryFieldUsage, INTLAYER_CALLER_NAMES, IntlayerCallerName, NestedRenameEntry, NestedRenameMap, OpaqueFieldOccurrence, PruneContext, createPruneContext, makeUsageAnalyzerBabelPlugin } from "./babel-plugin-intlayer-usage-analyzer.js";
|
|
4
|
-
import { buildNestedRenameMapFromContent, generateShortFieldName, getNestedRenameEntryAtPath, makeFieldRenameBabelPlugin, renameIntlayerFieldAccesses } from "./babel-plugin-intlayer-field-rename.js";
|
|
3
|
+
import { CallerDescriptor, CallerResultShape, CallerValueSource, CompatCallerConfig, DEFAULT_COMPAT_CALLERS, DictionaryFieldUsage, INTLAYER_CALLER_NAMES, IntlayerCallerName, NestedRenameEntry, NestedRenameMap, OpaqueFieldOccurrence, PruneContext, createPruneContext, makeUsageAnalyzerBabelPlugin, preserveNestedDictionaryFields } from "./babel-plugin-intlayer-usage-analyzer.js";
|
|
4
|
+
import { SerializedFieldRenameEntry, SerializedFieldRenameMap, buildNestedRenameMapFromContent, generateShortFieldName, getNestedRenameEntryAtPath, makeFieldRenameBabelPlugin, renameIntlayerFieldAccesses, serializeFieldRenameMap } from "./babel-plugin-intlayer-field-rename.js";
|
|
5
5
|
import { MinifyPluginOptions, intlayerMinifyBabelPlugin } from "./babel-plugin-intlayer-minify.js";
|
|
6
6
|
import { OptimizePluginOptions, intlayerOptimizeBabelPlugin } from "./babel-plugin-intlayer-optimize.js";
|
|
7
|
-
import { PurgePluginOptions, getSharedPruneContext, intlayerPurgeBabelPlugin } from "./babel-plugin-intlayer-purge.js";
|
|
7
|
+
import { PurgePluginOptions, getSharedPruneContext, intlayerPurgeBabelPlugin, runIntlayerPurgePipeline } from "./babel-plugin-intlayer-purge.js";
|
|
8
8
|
import { detectPackageName } from "./extractContent/utils/detectPackageName.js";
|
|
9
9
|
import { ExtractDictionaryInfoOptions, ResolveContentFilePaths, extractDictionaryInfo, getOutput, resolveContentFilePaths } from "./extractContent/utils/extractDictionaryInfo.js";
|
|
10
10
|
import { extractDictionaryKey, extractDictionaryKeyFromPath } from "./extractContent/utils/extractDictionaryKey.js";
|
|
@@ -18,4 +18,4 @@ import { CompilerMode, getExtractPluginOptions } from "./getExtractPluginOptions
|
|
|
18
18
|
import { getOptimizePluginOptions } from "./getOptimizePluginOptions.js";
|
|
19
19
|
import { getMinifyPluginOptions, getPurgePluginOptions } from "./getPurgePluginOptions.js";
|
|
20
20
|
import { BABEL_PARSER_OPTIONS, INTLAYER_USAGE_REGEX, SOURCE_FILE_REGEX, analyzeFieldUsageInFile, buildUsageCheckRegex, getUsageCheckRegex, optimizeSourceFile, renameFieldsInCode, renameFieldsInSourceFile } from "./transformers.js";
|
|
21
|
-
export { ATTRIBUTES_TO_EXTRACT, BABEL_PARSER_OPTIONS, type CallerDescriptor, type CallerResultShape, type CallerValueSource, CompatCallerConfig, CompilerMode, DEFAULT_COMPAT_CALLERS, DictionaryFieldUsage, ExtractDictionaryInfoOptions, ExtractIntlayerOptions, ExtractPluginOptions, ExtractResult, INTLAYER_CALLER_NAMES, INTLAYER_USAGE_REGEX, IntlayerCallerName, MinifyPluginOptions, NestedRenameEntry, NestedRenameMap, OpaqueFieldOccurrence, OptimizePluginOptions, PackageName, PruneContext, PurgePluginOptions, ResolveContentFilePaths, SERVER_CAPABLE_PACKAGES, SOURCE_FILE_REGEX, ScriptBlock, analyzeFieldUsageInFile, buildNestedRenameMapFromContent, buildUsageCheckRegex, createPruneContext, detectPackageName, extractContent, extractContentSync, extractDictionaryInfo, extractDictionaryKey, extractDictionaryKeyFromPath, extractScriptBlocks, generateKey, generateShortFieldName, getComponentName, getExtractPluginOptions, getMinifyPluginOptions, getNestedRenameEntryAtPath, getOptimizePluginOptions, getOutput, getPurgePluginOptions, getSharedPruneContext, getUsageCheckRegex, injectScriptBlocks, intlayerExtractBabelPlugin, intlayerMinifyBabelPlugin, intlayerOptimizeBabelPlugin, intlayerPurgeBabelPlugin, makeFieldRenameBabelPlugin, makeUsageAnalyzerBabelPlugin, mergeWithExistingMultilingualDictionary, mergeWithExistingPerLocaleDictionary, optimizeSourceFile, packageList, renameFieldsInCode, renameFieldsInSourceFile, renameIntlayerFieldAccesses, resolveContentFilePaths, writeContentHelper };
|
|
21
|
+
export { ATTRIBUTES_TO_EXTRACT, BABEL_PARSER_OPTIONS, type CallerDescriptor, type CallerResultShape, type CallerValueSource, CompatCallerConfig, CompilerMode, DEFAULT_COMPAT_CALLERS, DictionaryFieldUsage, ExtractDictionaryInfoOptions, ExtractIntlayerOptions, ExtractPluginOptions, ExtractResult, INTLAYER_CALLER_NAMES, INTLAYER_USAGE_REGEX, IntlayerCallerName, MinifyPluginOptions, NestedRenameEntry, NestedRenameMap, OpaqueFieldOccurrence, OptimizePluginOptions, PackageName, PruneContext, PurgePluginOptions, ResolveContentFilePaths, SERVER_CAPABLE_PACKAGES, SOURCE_FILE_REGEX, ScriptBlock, SerializedFieldRenameEntry, SerializedFieldRenameMap, analyzeFieldUsageInFile, buildNestedRenameMapFromContent, buildUsageCheckRegex, createPruneContext, detectPackageName, extractContent, extractContentSync, extractDictionaryInfo, extractDictionaryKey, extractDictionaryKeyFromPath, extractScriptBlocks, generateKey, generateShortFieldName, getComponentName, getExtractPluginOptions, getMinifyPluginOptions, getNestedRenameEntryAtPath, getOptimizePluginOptions, getOutput, getPurgePluginOptions, getSharedPruneContext, getUsageCheckRegex, injectScriptBlocks, intlayerExtractBabelPlugin, intlayerMinifyBabelPlugin, intlayerOptimizeBabelPlugin, intlayerPurgeBabelPlugin, makeFieldRenameBabelPlugin, makeUsageAnalyzerBabelPlugin, mergeWithExistingMultilingualDictionary, mergeWithExistingPerLocaleDictionary, optimizeSourceFile, packageList, preserveNestedDictionaryFields, renameFieldsInCode, renameFieldsInSourceFile, renameIntlayerFieldAccesses, resolveContentFilePaths, runIntlayerPurgePipeline, serializeFieldRenameMap, writeContentHelper };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CompatCallerConfig, PruneContext } from "./babel-plugin-intlayer-usage-analyzer.js";
|
|
2
2
|
import { OptimizePluginOptions } from "./babel-plugin-intlayer-optimize.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ParserOptions } from "@babel/parser";
|
|
4
4
|
//#region src/transformers.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Babel parser options covering the superset of syntaxes used across all
|
|
7
7
|
* supported frameworks (React / Vue / Svelte / Angular / …).
|
|
8
8
|
*/
|
|
9
|
-
declare const BABEL_PARSER_OPTIONS:
|
|
9
|
+
declare const BABEL_PARSER_OPTIONS: ParserOptions;
|
|
10
10
|
/**
|
|
11
11
|
* Fast pre-check: matches files that could contain native intlayer calls
|
|
12
12
|
* (`useIntlayer` / `getIntlayer`). Used by the optimize/transform pass, which
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.d.ts","names":[],"sources":["../../src/transformers.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"transformers.d.ts","names":[],"sources":["../../src/transformers.ts"],"mappings":";;;;;;;;cAyBa,sBAAsB;;;;;;cAwBtB,sBAAoB;;;;;;;;;;;;;;;cAgBpB,uBAAoB,gCAAkC;;;;;;cAwBtD,qBAAkB,yBACJ,yBACxB;;;;;;cAoBU,mBAAiB;;;;;;;;;;;;;cAqCjB,0BAAuB,wBACZ,cACV,cACE,cAAY,gBACV,yBACf;;;;;;;cAyBU,qBAAkB,cACjB,wBACU,cACR,iBACb;;;;;;;;cAqBU,2BAAwB,wBACb,cACV,cACE,iBACb;;;;;;;;;cA8CU,qBAAkB,cACjB,wBACU,SACb,0BACR;EACD;EACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/babel",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Babel plugin for Intlayer that transforms declaration files and provides internationalization features during the build process according to the Intlayer configuration.",
|
|
6
6
|
"keywords": [
|
|
@@ -89,19 +89,19 @@
|
|
|
89
89
|
"@babel/plugin-syntax-jsx": "8.0.1",
|
|
90
90
|
"@babel/traverse": "8.0.4",
|
|
91
91
|
"@babel/types": "8.0.4",
|
|
92
|
-
"@intlayer/config": "9.
|
|
93
|
-
"@intlayer/core": "9.
|
|
94
|
-
"@intlayer/dictionaries-entry": "9.
|
|
95
|
-
"@intlayer/engine": "9.
|
|
96
|
-
"@intlayer/types": "9.
|
|
97
|
-
"@intlayer/unmerged-dictionaries-entry": "9.
|
|
92
|
+
"@intlayer/config": "9.3.1",
|
|
93
|
+
"@intlayer/core": "9.3.1",
|
|
94
|
+
"@intlayer/dictionaries-entry": "9.3.1",
|
|
95
|
+
"@intlayer/engine": "9.3.1",
|
|
96
|
+
"@intlayer/types": "9.3.1",
|
|
97
|
+
"@intlayer/unmerged-dictionaries-entry": "9.3.1"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@babel/plugin-syntax-jsx": "8.0.1",
|
|
101
101
|
"@types/babel__core": "7.20.5",
|
|
102
102
|
"@types/babel__generator": "7.27.0",
|
|
103
103
|
"@types/babel__traverse": "7.28.0",
|
|
104
|
-
"@types/node": "26.
|
|
104
|
+
"@types/node": "26.2.0",
|
|
105
105
|
"@utils/ts-config": "1.0.4",
|
|
106
106
|
"@utils/ts-config-types": "1.0.4",
|
|
107
107
|
"@utils/tsdown-config": "1.0.4",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"vitest": "4.1.10"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
|
-
"@intlayer/svelte-compiler": "9.
|
|
116
|
-
"@intlayer/vue-compiler": "9.
|
|
115
|
+
"@intlayer/svelte-compiler": "9.3.1",
|
|
116
|
+
"@intlayer/vue-compiler": "9.3.1"
|
|
117
117
|
},
|
|
118
118
|
"peerDependenciesMeta": {
|
|
119
119
|
"@intlayer/svelte-compiler": {
|