@fluentic/i18n-compiler 0.0.0-stage → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +23 -2
- package/dist/analyze.d.ts +25 -0
- package/dist/babel.d.ts +9 -0
- package/dist/babel.mjs +33 -0
- package/dist/babel.mjs.map +1 -0
- package/dist/esbuild.d.ts +5 -0
- package/dist/esbuild.mjs +35 -0
- package/dist/esbuild.mjs.map +1 -0
- package/dist/filter-Bc7CtppJ.mjs +73 -0
- package/dist/filter-Bc7CtppJ.mjs.map +1 -0
- package/dist/filter.d.ts +28 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.mjs +3 -0
- package/dist/message.d.ts +12 -0
- package/dist/nextjs.d.ts +6 -0
- package/dist/nextjs.mjs +58 -0
- package/dist/nextjs.mjs.map +1 -0
- package/dist/options-CHPeMkCj.mjs +19 -0
- package/dist/options-CHPeMkCj.mjs.map +1 -0
- package/dist/options.d.ts +13 -0
- package/dist/rollup.d.ts +21 -0
- package/dist/rollup.mjs +30 -0
- package/dist/rollup.mjs.map +1 -0
- package/dist/src-BBeF3k1d.mjs +420 -0
- package/dist/src-BBeF3k1d.mjs.map +1 -0
- package/dist/vite.d.ts +33 -0
- package/dist/vite.mjs +17 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/webpack-loader.d.ts +1 -0
- package/dist/webpack-loader.mjs +18 -0
- package/dist/webpack-loader.mjs.map +1 -0
- package/dist/webpack.d.ts +6 -0
- package/dist/webpack.mjs +24 -0
- package/dist/webpack.mjs.map +1 -0
- package/dist-cjs/babel.cjs +491 -0
- package/dist-cjs/babel.cjs.map +1 -0
- package/package.json +87 -4
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
let _babel_parser = require("@babel/parser");
|
|
23
|
+
let _babel_traverse = require("@babel/traverse");
|
|
24
|
+
_babel_traverse = __toESM(_babel_traverse, 1);
|
|
25
|
+
let _babel_types = require("@babel/types");
|
|
26
|
+
_babel_types = __toESM(_babel_types, 1);
|
|
27
|
+
let _fluentic_i18n_compiler_support = require("@fluentic/i18n/compiler-support");
|
|
28
|
+
let picomatch = require("picomatch");
|
|
29
|
+
picomatch = __toESM(picomatch, 1);
|
|
30
|
+
let _babel_generator = require("@babel/generator");
|
|
31
|
+
_babel_generator = __toESM(_babel_generator, 1);
|
|
32
|
+
let _formatjs_icu_messageformat_parser = require("@formatjs/icu-messageformat-parser");
|
|
33
|
+
let jiti = require("jiti");
|
|
34
|
+
let node_path = require("node:path");
|
|
35
|
+
// src/analyze.ts
|
|
36
|
+
const traverse = _babel_traverse.default.default ?? _babel_traverse.default;
|
|
37
|
+
const importMap = {
|
|
38
|
+
"@fluentic/i18n": "@fluentic/i18n/compiled",
|
|
39
|
+
"@fluentic/i18n/core": "@fluentic/i18n/compiled"
|
|
40
|
+
};
|
|
41
|
+
function parseSource(code, filename) {
|
|
42
|
+
return (0, _babel_parser.parse)(code, {
|
|
43
|
+
sourceFilename: filename,
|
|
44
|
+
sourceType: "unambiguous",
|
|
45
|
+
plugins: [
|
|
46
|
+
.../\.[cm]?tsx?$/.test(filename) ? ["typescript"] : [],
|
|
47
|
+
...!/\.[cm]?ts$/.test(filename) ? ["jsx"] : [],
|
|
48
|
+
"decorators-legacy",
|
|
49
|
+
"importAttributes"
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function unwrap(path) {
|
|
54
|
+
while (path.isTSAsExpression() || path.isTSSatisfiesExpression() || path.isTSNonNullExpression() || path.isTypeCastExpression() || path.isParenthesizedExpression()) path = path.get("expression");
|
|
55
|
+
return path;
|
|
56
|
+
}
|
|
57
|
+
function literal(path, seen = /* @__PURE__ */ new Set()) {
|
|
58
|
+
path = unwrap(path);
|
|
59
|
+
if (path.isStringLiteral()) return (0, _fluentic_i18n_compiler_support.normalizeMessage)(path.node.value);
|
|
60
|
+
if (path.isTemplateLiteral() && !path.node.expressions.length) return (0, _fluentic_i18n_compiler_support.normalizeMessage)(path.node.quasis[0].value.cooked ?? "");
|
|
61
|
+
if (path.isIdentifier()) {
|
|
62
|
+
const binding = path.scope.getBinding(path.node.name);
|
|
63
|
+
if (binding?.constant && binding.path.isVariableDeclarator() && !seen.has(binding)) {
|
|
64
|
+
seen.add(binding);
|
|
65
|
+
return literal(binding.path.get("init"), seen);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function memberName(path) {
|
|
71
|
+
if (!path.isMemberExpression()) return null;
|
|
72
|
+
const property = path.get("property");
|
|
73
|
+
return !path.node.computed && property.isIdentifier() ? property.node.name : property.isStringLiteral() ? property.node.value : null;
|
|
74
|
+
}
|
|
75
|
+
function analyzer(imports = Object.keys(importMap)) {
|
|
76
|
+
const memo = /* @__PURE__ */ new Map();
|
|
77
|
+
const scopedBindings = /* @__PURE__ */ new Set();
|
|
78
|
+
const scopeCalls = /* @__PURE__ */ new Set();
|
|
79
|
+
const resolve = (path, visiting = /* @__PURE__ */ new Set()) => {
|
|
80
|
+
path = unwrap(path);
|
|
81
|
+
if (path.isIdentifier()) {
|
|
82
|
+
const binding = path.scope.getBinding(path.node.name);
|
|
83
|
+
if (!binding) return null;
|
|
84
|
+
if (memo.has(binding)) return memo.get(binding);
|
|
85
|
+
if (visiting.has(binding)) throw new Error("[i18n] circular translator alias");
|
|
86
|
+
if (binding.path.isImportSpecifier()) {
|
|
87
|
+
const declaration = binding.path.parentPath;
|
|
88
|
+
const imported = binding.path.node.imported;
|
|
89
|
+
return declaration.isImportDeclaration() && imports.includes(declaration.node.source.value) && (_babel_types.isIdentifier(imported) ? imported.name : imported.value) === "t" && declaration.node.importKind !== "type" ? {
|
|
90
|
+
context: null,
|
|
91
|
+
notes: []
|
|
92
|
+
} : null;
|
|
93
|
+
}
|
|
94
|
+
if (binding.path.isVariableDeclarator()) {
|
|
95
|
+
visiting.add(binding);
|
|
96
|
+
const scope = resolve(binding.path.get("init"), visiting);
|
|
97
|
+
visiting.delete(binding);
|
|
98
|
+
if (scope && !binding.constant) throw new Error("[i18n] translator aliases must not be reassigned: " + path.node.name);
|
|
99
|
+
memo.set(binding, scope);
|
|
100
|
+
if (scope) scopedBindings.add(binding);
|
|
101
|
+
return scope;
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
if (path.isMemberExpression() && memberName(path) === "t") {
|
|
106
|
+
const object = path.get("object");
|
|
107
|
+
if (!object.isIdentifier()) return null;
|
|
108
|
+
const binding = object.scope.getBinding(object.node.name);
|
|
109
|
+
const declaration = binding?.path.parentPath;
|
|
110
|
+
if (binding?.path.isImportNamespaceSpecifier() && declaration?.isImportDeclaration() && imports.includes(declaration.node.source.value)) return {
|
|
111
|
+
context: null,
|
|
112
|
+
notes: []
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (!path.isCallExpression()) return null;
|
|
116
|
+
const callee = path.get("callee");
|
|
117
|
+
const method = memberName(callee);
|
|
118
|
+
if (!method || ![
|
|
119
|
+
"context",
|
|
120
|
+
"note",
|
|
121
|
+
"meta"
|
|
122
|
+
].includes(method)) return null;
|
|
123
|
+
const parent = resolve(callee.get("object"), visiting);
|
|
124
|
+
if (!parent) return null;
|
|
125
|
+
if (path.node.arguments.length !== 1) throw new Error("[i18n] scope methods require one static argument");
|
|
126
|
+
const argument = path.get("arguments.0");
|
|
127
|
+
scopeCalls.add(path);
|
|
128
|
+
if (method === "meta") {
|
|
129
|
+
const evaluated = argument.evaluate();
|
|
130
|
+
if (!evaluated.confident) throw new Error("[i18n] metadata must be statically known");
|
|
131
|
+
return {
|
|
132
|
+
...parent,
|
|
133
|
+
meta: evaluated.value
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const value = literal(argument);
|
|
137
|
+
if (value === null) throw new Error("[i18n] " + method + " must be a static string");
|
|
138
|
+
return method === "note" ? {
|
|
139
|
+
...parent,
|
|
140
|
+
notes: [...parent.notes, value]
|
|
141
|
+
} : {
|
|
142
|
+
...parent,
|
|
143
|
+
context: parent.context ? `${parent.context}.${value}` : value
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
resolve,
|
|
148
|
+
scopedBindings,
|
|
149
|
+
scopeCalls
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
// src/filter.ts
|
|
153
|
+
const normalizePath = (path) => path.replace(/\\/g, "/");
|
|
154
|
+
const DEFAULT_TRANSFORM_INCLUDE = /* @__PURE__ */ new RegExp("\\.[cm]?[jt]sx?$");
|
|
155
|
+
const DEFAULT_TRANSFORM_EXCLUDE = /node_modules/;
|
|
156
|
+
function normalizeModuleId(id) {
|
|
157
|
+
return id.split("?")[0]?.split("#")[0] ?? id;
|
|
158
|
+
}
|
|
159
|
+
function createTransformFilter(options = {}) {
|
|
160
|
+
const includes = normalizeMatchers(options.include);
|
|
161
|
+
const includePackages = createPackagePattern(options.includePackages);
|
|
162
|
+
const excludePackages = createPackagePattern(options.excludePackages);
|
|
163
|
+
const excludes = normalizeMatchers(options.exclude ?? (options.include || options.includeDependencies ? void 0 : DEFAULT_TRANSFORM_EXCLUDE));
|
|
164
|
+
const cache = /* @__PURE__ */ new Map();
|
|
165
|
+
const filter = ((id) => {
|
|
166
|
+
const filePath = normalizeModuleId(id);
|
|
167
|
+
const cached = cache.get(filePath);
|
|
168
|
+
if (cached !== void 0) return cached;
|
|
169
|
+
const packagePath = normalizePath(filePath);
|
|
170
|
+
const result = excludePackages?.test(packagePath) ? false : includePackages?.test(packagePath) ? DEFAULT_TRANSFORM_INCLUDE.test(filePath) : shouldTransform(filePath, includes, excludes);
|
|
171
|
+
cache.set(filePath, result);
|
|
172
|
+
return result;
|
|
173
|
+
});
|
|
174
|
+
filter.clear = () => {
|
|
175
|
+
cache.clear();
|
|
176
|
+
};
|
|
177
|
+
return filter;
|
|
178
|
+
}
|
|
179
|
+
function normalizeMatchers(patterns) {
|
|
180
|
+
if (!patterns) return [];
|
|
181
|
+
return (Array.isArray(patterns) ? patterns : [patterns]).map(createMatcher);
|
|
182
|
+
}
|
|
183
|
+
function createMatcher(pattern) {
|
|
184
|
+
if (pattern instanceof RegExp) return (id) => {
|
|
185
|
+
pattern.lastIndex = 0;
|
|
186
|
+
return pattern.test(id);
|
|
187
|
+
};
|
|
188
|
+
const matcher = (0, picomatch.default)(normalizePath(pattern), { dot: true });
|
|
189
|
+
return (id) => matcher(normalizePath(id));
|
|
190
|
+
}
|
|
191
|
+
function shouldTransform(id, includes, excludes) {
|
|
192
|
+
for (const exclude of excludes) if (exclude(id)) return false;
|
|
193
|
+
if (!includes.length) return DEFAULT_TRANSFORM_INCLUDE.test(id);
|
|
194
|
+
for (const include of includes) if (include(id)) return true;
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
function createPackagePattern(packages) {
|
|
198
|
+
const names = typeof packages === "string" ? [packages] : packages ?? [];
|
|
199
|
+
if (!names.length) return void 0;
|
|
200
|
+
for (const name of names) if (!/^(?:@[a-zA-Z0-9_][a-zA-Z0-9._-]*\/)?[a-zA-Z0-9_][a-zA-Z0-9._-]*$/.test(name)) throw new Error(`[i18n] Invalid package name in includePackages/excludePackages: ${JSON.stringify(name)}`);
|
|
201
|
+
const separator = "[/\\\\]";
|
|
202
|
+
const alternatives = names.map((name) => name.split("/").map(escapeRegExp).join(separator)).join("|");
|
|
203
|
+
return new RegExp(`^(?:[^?#]*${separator})?node_modules${separator}(?:${alternatives})(?![^?#]*${separator}node_modules${separator})(?:${separator}[^?#]*)?(?:[?#][\\s\\S]*)?$`);
|
|
204
|
+
}
|
|
205
|
+
function escapeRegExp(value) {
|
|
206
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
207
|
+
}
|
|
208
|
+
// src/message.ts
|
|
209
|
+
function messageIdentity(context, source) {
|
|
210
|
+
source = (0, _fluentic_i18n_compiler_support.normalizeMessage)(source);
|
|
211
|
+
return context ? `${context}\0${source}` : source;
|
|
212
|
+
}
|
|
213
|
+
function messageId(context, source, hashLength = _fluentic_i18n_compiler_support.DEFAULT_HASH_LENGTH) {
|
|
214
|
+
return (0, _fluentic_i18n_compiler_support.messageHash)(messageIdentity(context, source), hashLength);
|
|
215
|
+
}
|
|
216
|
+
function compileMessage(source) {
|
|
217
|
+
source = (0, _fluentic_i18n_compiler_support.normalizeMessage)(source);
|
|
218
|
+
const compact = (elements) => {
|
|
219
|
+
const result = elements.map((element) => {
|
|
220
|
+
switch (element.type) {
|
|
221
|
+
case _formatjs_icu_messageformat_parser.TYPE.literal: return element.value;
|
|
222
|
+
case _formatjs_icu_messageformat_parser.TYPE.argument: return [0, element.value];
|
|
223
|
+
case _formatjs_icu_messageformat_parser.TYPE.number:
|
|
224
|
+
case _formatjs_icu_messageformat_parser.TYPE.date:
|
|
225
|
+
case _formatjs_icu_messageformat_parser.TYPE.time: return [
|
|
226
|
+
element.type === _formatjs_icu_messageformat_parser.TYPE.number ? 1 : element.type === _formatjs_icu_messageformat_parser.TYPE.date ? 2 : 3,
|
|
227
|
+
element.value,
|
|
228
|
+
typeof element.style === "object" && element.style ? element.style.parsedOptions : element.style ?? null
|
|
229
|
+
];
|
|
230
|
+
case _formatjs_icu_messageformat_parser.TYPE.select: return [
|
|
231
|
+
4,
|
|
232
|
+
element.value,
|
|
233
|
+
Object.fromEntries(Object.entries(element.options).map(([key, option]) => [key, compact(option.value)]))
|
|
234
|
+
];
|
|
235
|
+
case _formatjs_icu_messageformat_parser.TYPE.plural: return [
|
|
236
|
+
5,
|
|
237
|
+
element.value,
|
|
238
|
+
element.offset,
|
|
239
|
+
element.pluralType === "ordinal" ? 1 : 0,
|
|
240
|
+
Object.fromEntries(Object.entries(element.options).map(([key, option]) => [key, compact(option.value)]))
|
|
241
|
+
];
|
|
242
|
+
case _formatjs_icu_messageformat_parser.TYPE.pound: return [6];
|
|
243
|
+
case _formatjs_icu_messageformat_parser.TYPE.tag: return [
|
|
244
|
+
7,
|
|
245
|
+
element.value,
|
|
246
|
+
compact(element.children)
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
return result.every((part) => typeof part === "string") ? result.join("") : result;
|
|
251
|
+
};
|
|
252
|
+
return compact((0, _formatjs_icu_messageformat_parser.parse)(source, { captureLocation: false }));
|
|
253
|
+
}
|
|
254
|
+
_babel_generator.default.default ?? _babel_generator.default;
|
|
255
|
+
function reactFunction(path) {
|
|
256
|
+
for (let current = path.findParent((parent) => parent.isFunction()); current; current = current.findParent((parent) => parent.isFunction())) {
|
|
257
|
+
const fn = current;
|
|
258
|
+
const parent = fn.parentPath;
|
|
259
|
+
const ownName = _babel_types.isFunctionDeclaration(fn.node) || _babel_types.isFunctionExpression(fn.node) ? fn.node.id?.name : null;
|
|
260
|
+
const variableId = parent?.isVariableDeclarator() ? parent.get("id") : null;
|
|
261
|
+
const name = ownName ?? (variableId?.isIdentifier() ? variableId.node.name : null);
|
|
262
|
+
if (parent?.isExportDefaultDeclaration() || name && (/^[A-Z]/.test(name) || /^use[A-Z]/.test(name))) return fn;
|
|
263
|
+
}
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
function hashLength(length) {
|
|
267
|
+
return (0, _fluentic_i18n_compiler_support.normalizeHashLength)(length ?? _fluentic_i18n_compiler_support.DEFAULT_HASH_LENGTH);
|
|
268
|
+
}
|
|
269
|
+
function resolveJsxCallback(path, seen = /* @__PURE__ */ new Set()) {
|
|
270
|
+
while (path.isTSAsExpression() || path.isTSSatisfiesExpression() || path.isTSNonNullExpression() || path.isTypeCastExpression() || path.isParenthesizedExpression()) path = path.get("expression");
|
|
271
|
+
if (path.isArrowFunctionExpression() || path.isFunctionExpression() || path.isFunctionDeclaration()) return path;
|
|
272
|
+
if (!path.isIdentifier()) return null;
|
|
273
|
+
const binding = path.scope.getBinding(path.node.name);
|
|
274
|
+
if (!binding?.constant || seen.has(binding)) return null;
|
|
275
|
+
seen.add(binding);
|
|
276
|
+
if (binding.path.isFunctionDeclaration()) return binding.path;
|
|
277
|
+
if (!binding.path.isVariableDeclarator()) return null;
|
|
278
|
+
return resolveJsxCallback(binding.path.get("init"), seen);
|
|
279
|
+
}
|
|
280
|
+
function compileProgram(code, filename, options = {}) {
|
|
281
|
+
const ast = parseSource(code, filename);
|
|
282
|
+
const messages = [];
|
|
283
|
+
const analysis = analyzer();
|
|
284
|
+
const plans = [];
|
|
285
|
+
const declarations = [];
|
|
286
|
+
const jsxCallbacks = /* @__PURE__ */ new Set();
|
|
287
|
+
traverse(ast, { CallExpression(path) {
|
|
288
|
+
const callee = path.get("callee");
|
|
289
|
+
if (memberName(callee) !== "jsx") return;
|
|
290
|
+
if (!analysis.resolve(callee.get("object"))) return;
|
|
291
|
+
const callback = resolveJsxCallback(path.get("arguments.0"));
|
|
292
|
+
if (callback) jsxCallbacks.add(callback.node);
|
|
293
|
+
} });
|
|
294
|
+
let program;
|
|
295
|
+
const clientModule = ast.program.directives.some((directive) => directive.value.value === "use client");
|
|
296
|
+
traverse(ast, {
|
|
297
|
+
Program(path) {
|
|
298
|
+
program = path;
|
|
299
|
+
},
|
|
300
|
+
ExportAllDeclaration(path) {
|
|
301
|
+
if (importMap[path.node.source.value]) throw new Error("[i18n] do not re-export the translator in compiled mode; import t directly at each use");
|
|
302
|
+
},
|
|
303
|
+
ExportNamedDeclaration(path) {
|
|
304
|
+
if (path.node.source && importMap[path.node.source.value] && path.node.specifiers.some((specifier) => _babel_types.isExportSpecifier(specifier) && (_babel_types.isIdentifier(specifier.local) ? specifier.local.name : "") === "t")) throw new Error("[i18n] do not re-export the translator in compiled mode; export message descriptors instead");
|
|
305
|
+
},
|
|
306
|
+
ImportDeclaration(path) {
|
|
307
|
+
if (importMap[path.node.source.value] && path.node.importKind !== "type") declarations.push(path);
|
|
308
|
+
},
|
|
309
|
+
CallExpression(path) {
|
|
310
|
+
const callee = path.get("callee");
|
|
311
|
+
const method = memberName(callee);
|
|
312
|
+
if (!method || ![
|
|
313
|
+
"msg",
|
|
314
|
+
"jsx",
|
|
315
|
+
"text"
|
|
316
|
+
].includes(method)) return;
|
|
317
|
+
const scope = analysis.resolve(callee.get("object"));
|
|
318
|
+
if (!scope) return;
|
|
319
|
+
if (method === "jsx" && resolveJsxCallback(path.get("arguments.0"))) return;
|
|
320
|
+
const source = literal(path.get("arguments.0"));
|
|
321
|
+
if (source === null && method === "msg") throw new Error(`[i18n] ${filename}:${path.node.loc?.start.line}: t.msg requires a static message`);
|
|
322
|
+
const callbackOwned = method === "text" && Boolean(path.findParent((parent) => parent.isFunction() && jsxCallbacks.has(parent.node)));
|
|
323
|
+
const reactOwner = options.bindReactText && clientModule && method === "text" && !callbackOwned ? reactFunction(path) : void 0;
|
|
324
|
+
if (options.bindReactText && clientModule && method === "text" && !callbackOwned && !reactOwner) throw new Error(`[i18n] ${filename}:${path.node.loc?.start.line}: client t.text must be rendered inside a component or hook`);
|
|
325
|
+
plans.push({
|
|
326
|
+
path,
|
|
327
|
+
source,
|
|
328
|
+
scope,
|
|
329
|
+
reactOwner: reactOwner ?? void 0
|
|
330
|
+
});
|
|
331
|
+
if (source !== null) messages.push({
|
|
332
|
+
...scope,
|
|
333
|
+
source,
|
|
334
|
+
id: scope.context ? `${scope.context}\0${source}` : source
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
traverse(ast, {
|
|
339
|
+
VariableDeclarator(path) {
|
|
340
|
+
analysis.resolve(path.get("id"));
|
|
341
|
+
},
|
|
342
|
+
CallExpression(path) {
|
|
343
|
+
const name = memberName(path.get("callee"));
|
|
344
|
+
if (name && [
|
|
345
|
+
"context",
|
|
346
|
+
"note",
|
|
347
|
+
"meta"
|
|
348
|
+
].includes(name)) analysis.resolve(path);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
const expressionUse = (path) => {
|
|
352
|
+
while (path.parentPath && (path.parentPath.isTSAsExpression() || path.parentPath.isTSSatisfiesExpression() || path.parentPath.isTSNonNullExpression() || path.parentPath.isTypeCastExpression() || path.parentPath.isParenthesizedExpression())) path = path.parentPath;
|
|
353
|
+
return path;
|
|
354
|
+
};
|
|
355
|
+
for (const path of analysis.scopeCalls) {
|
|
356
|
+
const use = expressionUse(path);
|
|
357
|
+
const parent = use.parentPath;
|
|
358
|
+
if (parent?.isVariableDeclarator() || parent?.isExpressionStatement()) continue;
|
|
359
|
+
if (parent?.isMemberExpression() && parent.get("object") === use && parent.parentPath?.isCallExpression()) continue;
|
|
360
|
+
throw new Error("[i18n] scoped translator escapes same-file message calls");
|
|
361
|
+
}
|
|
362
|
+
for (const binding of analysis.scopedBindings) {
|
|
363
|
+
if (binding.path.parentPath?.parentPath?.isExportNamedDeclaration()) throw new Error("[i18n] scoped translators cannot be exported; repeat the context in the consuming file");
|
|
364
|
+
for (const reference of binding.referencePaths) {
|
|
365
|
+
if (reference.findParent((parent) => parent.isTSType())) continue;
|
|
366
|
+
const use = expressionUse(reference);
|
|
367
|
+
const parent = use.parentPath;
|
|
368
|
+
if (parent?.isVariableDeclarator() && parent.get("init") === use) continue;
|
|
369
|
+
if (parent?.isMemberExpression() && parent.get("object") === use) {
|
|
370
|
+
const method = memberName(parent);
|
|
371
|
+
if (method && [
|
|
372
|
+
"msg",
|
|
373
|
+
"text",
|
|
374
|
+
"jsx",
|
|
375
|
+
"context",
|
|
376
|
+
"note",
|
|
377
|
+
"meta"
|
|
378
|
+
].includes(method) && parent.parentPath?.isCallExpression()) continue;
|
|
379
|
+
}
|
|
380
|
+
throw new Error("[i18n] scoped translator escapes same-file message calls: " + binding.identifier.name);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (!declarations.length) return {
|
|
384
|
+
ast,
|
|
385
|
+
messages,
|
|
386
|
+
changed: false
|
|
387
|
+
};
|
|
388
|
+
const helper = program.scope.generateUidIdentifier("tc");
|
|
389
|
+
const rendererHook = program.scope.generateUidIdentifier("useI18nRenderer");
|
|
390
|
+
const rendererBindings = /* @__PURE__ */ new Map();
|
|
391
|
+
if (plans.length) program.unshiftContainer("body", _babel_types.importDeclaration([_babel_types.importSpecifier(helper, _babel_types.identifier("t"))], _babel_types.stringLiteral("@fluentic/i18n/compiled")));
|
|
392
|
+
if (plans.some((plan) => plan.reactOwner)) {
|
|
393
|
+
program.unshiftContainer("body", _babel_types.importDeclaration([_babel_types.importSpecifier(rendererHook, _babel_types.identifier("useI18nRenderer"))], _babel_types.stringLiteral("@fluentic/i18n/react")));
|
|
394
|
+
for (const owner of new Set(plans.map((plan) => plan.reactOwner).filter(Boolean))) {
|
|
395
|
+
const binding = owner.scope.generateUidIdentifier("text");
|
|
396
|
+
rendererBindings.set(owner, binding);
|
|
397
|
+
const body = owner.get("body");
|
|
398
|
+
if (!body.isBlockStatement()) {
|
|
399
|
+
const expression = body.node;
|
|
400
|
+
body.replaceWith(_babel_types.blockStatement([_babel_types.returnStatement(expression)]));
|
|
401
|
+
}
|
|
402
|
+
owner.get("body").unshiftContainer("body", _babel_types.variableDeclaration("const", [_babel_types.variableDeclarator(_babel_types.cloneNode(binding), _babel_types.callExpression(_babel_types.cloneNode(rendererHook), [_babel_types.memberExpression(_babel_types.cloneNode(helper), _babel_types.identifier("text"))]))]));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
for (const { path, source, scope, reactOwner } of plans) {
|
|
406
|
+
const callee = path.get("callee");
|
|
407
|
+
const renderer = reactOwner && rendererBindings.get(reactOwner);
|
|
408
|
+
if (renderer) callee.replaceWith(_babel_types.cloneNode(renderer));
|
|
409
|
+
else callee.get("object").replaceWith(_babel_types.cloneNode(helper));
|
|
410
|
+
if (source !== null) {
|
|
411
|
+
const replacement = _babel_types.valueToNode([messageId(scope.context, source, hashLength(options.hashLength)), compileMessage(source)]);
|
|
412
|
+
_babel_types.inherits(replacement, path.node.arguments[0]);
|
|
413
|
+
path.node.arguments[0] = replacement;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
let removed = true;
|
|
417
|
+
while (removed) {
|
|
418
|
+
removed = false;
|
|
419
|
+
program.scope.crawl();
|
|
420
|
+
for (const binding of analysis.scopedBindings) {
|
|
421
|
+
if (binding.path.removed) continue;
|
|
422
|
+
const current = binding.path.scope.getBinding(binding.identifier.name);
|
|
423
|
+
if (current && !current.referenced) {
|
|
424
|
+
binding.path.remove();
|
|
425
|
+
removed = true;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
for (const path of analysis.scopeCalls) if (!path.removed) {
|
|
430
|
+
const use = expressionUse(path);
|
|
431
|
+
if (use.parentPath?.isExpressionStatement()) use.parentPath.remove();
|
|
432
|
+
}
|
|
433
|
+
for (const declaration of declarations) declaration.node.source.value = importMap[declaration.node.source.value];
|
|
434
|
+
program.scope.crawl();
|
|
435
|
+
for (const declaration of declarations) {
|
|
436
|
+
declaration.node.specifiers = declaration.node.specifiers.filter((specifier) => {
|
|
437
|
+
if (!_babel_types.isImportSpecifier(specifier) || (_babel_types.isIdentifier(specifier.imported) ? specifier.imported.name : specifier.imported.value) !== "t") return true;
|
|
438
|
+
return Boolean(program.scope.getBinding(specifier.local.name)?.referenced);
|
|
439
|
+
});
|
|
440
|
+
if (!declaration.node.specifiers.length) declaration.remove();
|
|
441
|
+
}
|
|
442
|
+
return {
|
|
443
|
+
ast,
|
|
444
|
+
messages,
|
|
445
|
+
changed: true
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
// src/options.ts
|
|
449
|
+
function loadOptions(options = {}, root = process.cwd()) {
|
|
450
|
+
if ("compiled" in options) throw new TypeError("[i18n] compiler plugins always compile; use hashLength instead of compiled");
|
|
451
|
+
const file = options.config ? (0, node_path.resolve)(root, options.config) : void 0;
|
|
452
|
+
const config = file ? (0, jiti.createJiti)(require("url").pathToFileURL(__filename).href, { moduleCache: false })(file) : {};
|
|
453
|
+
const { compiled, ...configOptions } = config.default ?? config;
|
|
454
|
+
const sharedHashLength = typeof compiled === "object" ? compiled.hashLength : void 0;
|
|
455
|
+
return {
|
|
456
|
+
...configOptions,
|
|
457
|
+
...sharedHashLength === void 0 ? {} : { hashLength: sharedHashLength },
|
|
458
|
+
...options,
|
|
459
|
+
configFile: file
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
// src/babel.ts
|
|
463
|
+
/** Owns parsing even when a host (e.g. Metro) passes an already parsed AST. */
|
|
464
|
+
function fluenticBabel(_api, options = {}) {
|
|
465
|
+
const config = loadOptions(options);
|
|
466
|
+
const filter = createTransformFilter(config);
|
|
467
|
+
const handled = /* @__PURE__ */ new WeakSet();
|
|
468
|
+
const enabled = (code) => code.includes("@fluentic/i18n");
|
|
469
|
+
const compile = (code, filename) => {
|
|
470
|
+
const { ast } = compileProgram(code, filename, config);
|
|
471
|
+
traverse.cache.clear();
|
|
472
|
+
handled.add(ast.program);
|
|
473
|
+
return ast;
|
|
474
|
+
};
|
|
475
|
+
return {
|
|
476
|
+
name: "fluentic-i18n",
|
|
477
|
+
parserOverride(code, parserOptions) {
|
|
478
|
+
if (!enabled(code) || !filter(parserOptions.sourceFilename ?? "source.tsx")) return void 0;
|
|
479
|
+
return compile(code, parserOptions.sourceFilename ?? "source.tsx");
|
|
480
|
+
},
|
|
481
|
+
pre(file) {
|
|
482
|
+
if (!enabled(file.code) || !filter(file.opts.filename ?? "source.tsx") || handled.has(file.path.node)) return;
|
|
483
|
+
const ast = compile(file.code, file.opts.filename ?? "source.tsx");
|
|
484
|
+
file.path.replaceWith(ast.program);
|
|
485
|
+
file.scope.crawl();
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
module.exports = fluenticBabel;
|
|
490
|
+
|
|
491
|
+
//# sourceMappingURL=babel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel.cjs","names":["traverseModule","parse","normalizeMessage","b","normalizeMessage","DEFAULT_HASH_LENGTH","messageHash","TYPE","parse","generatorModule","b","normalizeHashLength","DEFAULT_HASH_LENGTH","resolve","createJiti"],"sources":["../src/analyze.ts","../src/filter.ts","../src/message.ts","../src/index.ts","../src/options.ts","../src/babel.ts"],"sourcesContent":["import { parse } from '@babel/parser';\nimport * as traverseModule from '@babel/traverse';\nimport type { Binding, NodePath } from '@babel/traverse';\nimport * as b from '@babel/types';\nimport { normalizeMessage } from '@fluentic/i18n/compiler-support';\n\nconst traverse = ((traverseModule.default as unknown as { default?: typeof traverseModule.default; }).default ??\n traverseModule.default) as typeof traverseModule.default;\nexport { traverse };\n\nexport const importMap: Record<string, string> = {\n '@fluentic/i18n': '@fluentic/i18n/compiled',\n '@fluentic/i18n/core': '@fluentic/i18n/compiled',\n};\nexport type Scope = { context: string | null; notes: string[]; meta?: unknown; };\nexport type ExtractedMessage = Scope & { id: string; source: string; };\n\nexport function parseSource(code: string, filename: string) {\n return parse(code, {\n sourceFilename: filename,\n sourceType: 'unambiguous',\n plugins: [\n ...(/\\.[cm]?tsx?$/.test(filename) ? ['typescript' as const] : []),\n ...(!/\\.[cm]?ts$/.test(filename) ? ['jsx' as const] : []),\n 'decorators-legacy',\n 'importAttributes',\n ],\n });\n}\n\nexport function unwrap(path: NodePath): NodePath {\n while (\n path.isTSAsExpression() || path.isTSSatisfiesExpression() || path.isTSNonNullExpression() ||\n path.isTypeCastExpression() || path.isParenthesizedExpression()\n ) path = path.get('expression') as NodePath;\n\n return path;\n}\n\nexport function literal(path: NodePath, seen = new Set<Binding>()): string | null {\n path = unwrap(path);\n if (path.isStringLiteral()) return normalizeMessage(path.node.value);\n if (path.isTemplateLiteral() && !path.node.expressions.length) {\n return normalizeMessage(path.node.quasis[0].value.cooked ?? '');\n }\n if (path.isIdentifier()) {\n const binding = path.scope.getBinding(path.node.name);\n\n if (binding?.constant && binding.path.isVariableDeclarator() && !seen.has(binding)) {\n seen.add(binding);\n\n return literal(binding.path.get('init') as NodePath, seen);\n }\n }\n\n return null;\n}\n\nexport function memberName(path: NodePath): string | null {\n if (!path.isMemberExpression()) return null;\n\n const property = path.get('property');\n\n return !path.node.computed && property.isIdentifier()\n ? property.node.name\n : property.isStringLiteral()\n ? property.node.value\n : null;\n}\n\nexport function analyzer(imports = Object.keys(importMap)) {\n const memo = new Map<Binding, Scope | null>();\n const scopedBindings = new Set<Binding>();\n const scopeCalls = new Set<NodePath>();\n\n const resolve = (path: NodePath, visiting = new Set<Binding>()): Scope | null => {\n path = unwrap(path);\n if (path.isIdentifier()) {\n const binding = path.scope.getBinding(path.node.name);\n\n if (!binding) return null;\n if (memo.has(binding)) return memo.get(binding)!;\n if (visiting.has(binding)) throw new Error('[i18n] circular translator alias');\n if (binding.path.isImportSpecifier()) {\n const declaration = binding.path.parentPath;\n const imported = binding.path.node.imported;\n\n return declaration.isImportDeclaration() && imports.includes(declaration.node.source.value) &&\n (b.isIdentifier(imported) ? imported.name : imported.value) === 't' &&\n declaration.node.importKind !== 'type'\n ? { context: null, notes: [] }\n : null;\n }\n if (binding.path.isVariableDeclarator()) {\n visiting.add(binding);\n const scope = resolve(binding.path.get('init') as NodePath, visiting);\n visiting.delete(binding);\n if (scope && !binding.constant) {\n throw new Error('[i18n] translator aliases must not be reassigned: ' + path.node.name);\n }\n memo.set(binding, scope);\n if (scope) scopedBindings.add(binding);\n\n return scope;\n }\n\n return null;\n }\n if (path.isMemberExpression() && memberName(path) === 't') {\n const object = path.get('object');\n\n if (!object.isIdentifier()) return null;\n\n const binding = object.scope.getBinding(object.node.name);\n const declaration = binding?.path.parentPath;\n\n if (\n binding?.path.isImportNamespaceSpecifier() && declaration?.isImportDeclaration() &&\n imports.includes(declaration.node.source.value)\n ) return { context: null, notes: [] };\n }\n if (!path.isCallExpression()) return null;\n\n const callee = path.get('callee');\n const method = memberName(callee);\n\n if (!method || !['context', 'note', 'meta'].includes(method)) return null;\n\n const parent = resolve((callee as NodePath<b.MemberExpression>).get('object'), visiting);\n\n if (!parent) return null;\n if (path.node.arguments.length !== 1) throw new Error('[i18n] scope methods require one static argument');\n\n const argument = path.get('arguments.0') as NodePath;\n scopeCalls.add(path);\n if (method === 'meta') {\n const evaluated = argument.evaluate();\n\n if (!evaluated.confident) throw new Error('[i18n] metadata must be statically known');\n\n return { ...parent, meta: evaluated.value };\n }\n\n const value = literal(argument);\n\n if (value === null) throw new Error('[i18n] ' + method + ' must be a static string');\n\n return method === 'note'\n ? { ...parent, notes: [...parent.notes, value] }\n : { ...parent, context: parent.context ? `${parent.context}.${value}` : value };\n };\n\n return { resolve, scopedBindings, scopeCalls };\n}\n\nexport function collectMessages(code: string, filename: string, imports?: string[]): ExtractedMessage[] {\n const ast = parseSource(code, filename);\n const { resolve } = analyzer(imports);\n const messages: ExtractedMessage[] = [];\n traverse(ast, {\n CallExpression(path) {\n const callee = path.get('callee');\n const method = memberName(callee);\n\n if (!method || !['msg', 'text', 'jsx'].includes(method)) return;\n\n const scope = resolve((callee as NodePath<b.MemberExpression>).get('object'));\n\n if (!scope) return;\n\n const source = literal(path.get('arguments.0') as NodePath);\n\n if (source === null) {\n if (method === 'msg') {\n throw new Error(`[i18n] ${filename}:${path.node.loc?.start.line}: t.msg requires a static message`);\n }\n\n return;\n }\n messages.push({ ...scope, id: scope.context ? `${scope.context}\\0${source}` : source, source });\n },\n });\n\n return [...new Map(messages.map((message) => [message.id, message])).values()];\n}\n","import picomatch from 'picomatch';\nconst normalizePath = (path: string) => path.replace(/\\\\/g, '/');\n\nexport const DEFAULT_TRANSFORM_INCLUDE_PATTERN = '\\\\.[cm]?[jt]sx?$';\n\nexport const DEFAULT_TRANSFORM_INCLUDE = new RegExp(DEFAULT_TRANSFORM_INCLUDE_PATTERN);\n\nexport const DEFAULT_TRANSFORM_EXCLUDE = /node_modules/;\n\nexport type FilterPattern = string | RegExp | Array<string | RegExp>;\n\nexport type TransformFilterOptions = {\n /** File globs or regular expressions matched against IDs without query/hash suffixes. */\n include?: FilterPattern;\n exclude?: FilterPattern;\n /** Backwards-compatible opt-in to all dependencies; explicit exclude still wins. */\n includeDependencies?: boolean;\n /** Exact npm package names whose script files override file include/exclude rules. */\n includePackages?: string | string[];\n /** Exact npm package names excluded before all other filter rules. */\n excludePackages?: string | string[];\n};\n\nexport type TransformFilter = {\n (id: string): boolean;\n clear(): void;\n};\n\nexport function normalizeModuleId(id: string) {\n return id.split('?')[0]?.split('#')[0] ?? id;\n}\n\nexport function createTransformFilter(options: TransformFilterOptions = {}): TransformFilter {\n const includes = normalizeMatchers(options.include);\n const includePackages = createPackagePattern(options.includePackages);\n const excludePackages = createPackagePattern(options.excludePackages);\n\n const excludes = normalizeMatchers(\n options.exclude ?? (options.include || options.includeDependencies ? undefined : DEFAULT_TRANSFORM_EXCLUDE),\n );\n\n const cache = new Map<string, boolean>();\n\n const filter = ((id: string) => {\n const filePath = normalizeModuleId(id);\n const cached = cache.get(filePath);\n\n if (cached !== undefined) return cached;\n\n const packagePath = normalizePath(filePath);\n const result = excludePackages?.test(packagePath)\n ? false\n : includePackages?.test(packagePath)\n ? DEFAULT_TRANSFORM_INCLUDE.test(filePath)\n : shouldTransform(filePath, includes, excludes);\n\n cache.set(filePath, result);\n\n return result;\n }) as TransformFilter;\n\n filter.clear = () => {\n cache.clear();\n };\n\n return filter;\n}\n\ntype FilterMatcher = (id: string) => boolean;\n\nfunction normalizeMatchers(patterns?: FilterPattern) {\n if (!patterns) return [];\n\n const items = Array.isArray(patterns) ? patterns : [patterns];\n\n return items.map(createMatcher);\n}\n\nfunction createMatcher(pattern: string | RegExp): FilterMatcher {\n if (pattern instanceof RegExp) {\n return (id) => {\n pattern.lastIndex = 0;\n return pattern.test(id);\n };\n }\n\n const matcher = picomatch(normalizePath(pattern), {\n dot: true,\n });\n\n return (id) => matcher(normalizePath(id));\n}\n\nfunction shouldTransform(\n id: string,\n includes: FilterMatcher[],\n excludes: FilterMatcher[],\n): boolean {\n for (const exclude of excludes) {\n if (exclude(id)) return false;\n }\n\n if (!includes.length) {\n return DEFAULT_TRANSFORM_INCLUDE.test(id);\n }\n\n for (const include of includes) {\n if (include(id)) return true;\n }\n\n return false;\n}\n\n/** A conservative native prefilter; the shared JS filter remains authoritative. */\nexport function createTransformHookFilter(options: TransformFilterOptions = {}) {\n const includePackages = createPackagePattern(options.includePackages);\n const excludePackages = createPackagePattern(options.excludePackages);\n const exclude: RegExp[] = [];\n if (excludePackages) exclude.push(excludePackages);\n\n if (!options.include && !options.includeDependencies && options.exclude === undefined) {\n // Package inclusions override the default node_modules exclusion.\n exclude.push(\n new RegExp(\n `^${includePackages ? `(?!${includePackages.source})` : ''}[^?#]*node_modules`,\n ),\n );\n }\n\n return {\n id: {\n // Custom globs/regexes run against normalized IDs in the shared filter.\n // Keeping the native check broad avoids changing their matching semantics.\n include: options.include ? undefined : /^[^?#]*\\.[cm]?[jt]sx?(?:[?#][\\s\\S]*)?$/,\n exclude,\n },\n };\n}\n\nfunction createPackagePattern(packages?: string | string[]): RegExp | undefined {\n const names = typeof packages === 'string' ? [packages] : packages ?? [];\n if (!names.length) return undefined;\n\n for (const name of names) {\n if (!/^(?:@[a-zA-Z0-9_][a-zA-Z0-9._-]*\\/)?[a-zA-Z0-9_][a-zA-Z0-9._-]*$/.test(name)) {\n throw new Error(\n `[i18n] Invalid package name in includePackages/excludePackages: ${JSON.stringify(name)}`,\n );\n }\n }\n\n const separator = '[/\\\\\\\\]';\n const alternatives = names.map((name) => name.split('/').map(escapeRegExp).join(separator)).join('|');\n // Match the innermost node_modules owner, including pnpm's nested layout.\n // A package's nested dependencies must not inherit its include/exclude rule.\n return new RegExp(\n `^(?:[^?#]*${separator})?node_modules${separator}(?:${alternatives})` +\n `(?![^?#]*${separator}node_modules${separator})` +\n `(?:${separator}[^?#]*)?(?:[?#][\\\\s\\\\S]*)?$`,\n );\n}\n\nfunction escapeRegExp(value: string) {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n","import {\n type CompactMessage,\n type CompactPart,\n DEFAULT_HASH_LENGTH,\n messageHash,\n normalizeMessage,\n} from '@fluentic/i18n/compiler-support';\nimport { type MessageFormatElement, parse, TYPE } from '@formatjs/icu-messageformat-parser';\n\nexport { COMPACT_VERSION } from '@fluentic/i18n/compiler-support';\n\nexport function messageIdentity(context: string | null, source: string): string {\n source = normalizeMessage(source);\n return context ? `${context}\\0${source}` : source;\n}\n\nexport function messageId(context: string | null, source: string, hashLength = DEFAULT_HASH_LENGTH): string {\n return messageHash(messageIdentity(context, source), hashLength);\n}\n\nexport function compileMessage(source: string): CompactMessage {\n source = normalizeMessage(source);\n const compact = (elements: MessageFormatElement[]): CompactMessage => {\n const result: CompactPart[] = elements.map((element): CompactPart => {\n switch (element.type) {\n case TYPE.literal:\n return element.value;\n case TYPE.argument:\n return [0, element.value];\n case TYPE.number:\n case TYPE.date:\n case TYPE.time:\n return [\n element.type === TYPE.number ? 1 : element.type === TYPE.date ? 2 : 3,\n element.value,\n typeof element.style === 'object' && element.style\n ? element.style.parsedOptions as Record<string, unknown>\n : element.style ?? null,\n ];\n case TYPE.select:\n return [\n 4,\n element.value,\n Object.fromEntries(Object.entries(element.options).map(([key, option]) => [key, compact(option.value)])),\n ];\n case TYPE.plural:\n return [\n 5,\n element.value,\n element.offset,\n element.pluralType === 'ordinal' ? 1 : 0,\n Object.fromEntries(Object.entries(element.options).map(([key, option]) => [key, compact(option.value)])),\n ];\n case TYPE.pound:\n return [6];\n case TYPE.tag:\n return [7, element.value, compact(element.children)];\n }\n });\n\n return result.every((part) => typeof part === 'string') ? result.join('') : result;\n };\n\n return compact(parse(source, { captureLocation: false }));\n}\n\nexport function compileCatalog(\n records: Array<{ source: string; context: string | null; translation: string; }>,\n options: { hashLength?: number; } = {},\n): Array<[string, CompactMessage]> {\n const seen = new Map<string, string>();\n\n return records.flatMap((record) => {\n const id = messageId(record.context, record.source, options.hashLength);\n const identity = messageIdentity(record.context, record.source);\n\n if (seen.has(id) && seen.get(id) !== identity) throw new Error('[i18n] message hash collision: ' + id);\n seen.set(id, identity);\n\n return record.translation === '' ? [] : [[id, compileMessage(record.translation)] as [string, CompactMessage]];\n });\n}\n","import * as generatorModule from '@babel/generator';\nimport type { NodePath } from '@babel/traverse';\nimport * as b from '@babel/types';\nimport { DEFAULT_HASH_LENGTH, normalizeHashLength } from '@fluentic/i18n/compiler-support';\nimport {\n analyzer,\n collectMessages,\n type ExtractedMessage,\n importMap,\n literal,\n memberName,\n parseSource,\n traverse,\n} from './analyze';\nimport { compileMessage, messageId } from './message';\n\nexport { collectMessages } from './analyze';\nexport * from './filter';\nexport * from './message';\nexport type { PluginOptions } from './options';\n\nconst generate = ((generatorModule.default as unknown as { default?: typeof generatorModule.default; }).default ??\n generatorModule.default) as typeof generatorModule.default;\nexport type CompiledOptions = { hashLength?: number; };\nexport type CompilerOptions = CompiledOptions & { filename?: string; bindReactText?: boolean; };\n\ntype FunctionPath = NodePath<\n b.ArrowFunctionExpression | b.FunctionDeclaration | b.FunctionExpression | b.ObjectMethod | b.ClassMethod\n>;\n\nfunction reactFunction(path: NodePath): FunctionPath | null {\n for (\n let current = path.findParent((parent) => parent.isFunction());\n current;\n current = current.findParent(\n (parent) => parent.isFunction(),\n )\n ) {\n const fn = current as FunctionPath;\n const parent = fn.parentPath;\n const ownName = (b.isFunctionDeclaration(fn.node) || b.isFunctionExpression(fn.node)) ? fn.node.id?.name : null;\n const variableId = parent?.isVariableDeclarator() ? parent.get('id') : null;\n const name = ownName ?? (variableId?.isIdentifier() ? variableId.node.name : null);\n const exported = parent?.isExportDefaultDeclaration();\n\n if (exported || (name && (/^[A-Z]/.test(name) || /^use[A-Z]/.test(name)))) return fn;\n }\n\n return null;\n}\n\nfunction hashLength(length: CompilerOptions['hashLength']): number {\n return normalizeHashLength(length ?? DEFAULT_HASH_LENGTH);\n}\n\nfunction resolveJsxCallback(path: NodePath, seen = new Set<unknown>()): FunctionPath | null {\n while (\n path.isTSAsExpression() || path.isTSSatisfiesExpression() || path.isTSNonNullExpression() ||\n path.isTypeCastExpression() || path.isParenthesizedExpression()\n ) path = path.get('expression') as NodePath;\n if (path.isArrowFunctionExpression() || path.isFunctionExpression() || path.isFunctionDeclaration()) {\n return path as FunctionPath;\n }\n if (!path.isIdentifier()) return null;\n const binding = path.scope.getBinding(path.node.name);\n if (!binding?.constant || seen.has(binding)) return null;\n seen.add(binding);\n if (binding.path.isFunctionDeclaration()) return binding.path as FunctionPath;\n if (!binding.path.isVariableDeclarator()) return null;\n return resolveJsxCallback(binding.path.get('init') as NodePath, seen);\n}\n\nexport function compileProgram(code: string, filename: string, options: CompilerOptions = {}) {\n const ast = parseSource(code, filename);\n const messages: ExtractedMessage[] = [];\n\n const analysis = analyzer();\n\n const plans: Array<\n {\n path: NodePath<b.CallExpression>;\n source: string | null;\n scope: NonNullable<ReturnType<typeof analysis.resolve>>;\n reactOwner?: FunctionPath;\n }\n > = [];\n const declarations: NodePath<b.ImportDeclaration>[] = [];\n const jsxCallbacks = new Set<b.Function>();\n\n traverse(ast, {\n CallExpression(path) {\n const callee = path.get('callee');\n if (memberName(callee) !== 'jsx') return;\n const scope = analysis.resolve((callee as NodePath<b.MemberExpression>).get('object'));\n if (!scope) return;\n const callback = resolveJsxCallback(path.get('arguments.0') as NodePath);\n if (callback) jsxCallbacks.add(callback.node);\n },\n });\n\n let program: NodePath<b.Program> | undefined;\n const clientModule = ast.program.directives.some((directive) => directive.value.value === 'use client');\n traverse(ast, {\n Program(path) {\n program = path;\n },\n ExportAllDeclaration(path) {\n if (importMap[path.node.source.value]) {\n throw new Error('[i18n] do not re-export the translator in compiled mode; import t directly at each use');\n }\n },\n ExportNamedDeclaration(path) {\n if (\n path.node.source && importMap[path.node.source.value] &&\n path.node.specifiers.some((specifier) =>\n b.isExportSpecifier(specifier) && (b.isIdentifier(specifier.local) ? specifier.local.name : '') === 't'\n )\n ) throw new Error('[i18n] do not re-export the translator in compiled mode; export message descriptors instead');\n },\n ImportDeclaration(path) {\n if (importMap[path.node.source.value] && path.node.importKind !== 'type') declarations.push(path);\n },\n CallExpression(path) {\n const callee = path.get('callee');\n const method = memberName(callee);\n\n if (!method || !['msg', 'jsx', 'text'].includes(method)) return;\n\n const scope = analysis.resolve((callee as NodePath<b.MemberExpression>).get('object'));\n\n if (!scope) return;\n\n if (method === 'jsx' && resolveJsxCallback(path.get('arguments.0') as NodePath)) return;\n\n const source = literal(path.get('arguments.0') as NodePath);\n\n if (source === null && method === 'msg') {\n throw new Error(`[i18n] ${filename}:${path.node.loc?.start.line}: t.msg requires a static message`);\n }\n const callbackOwned = method === 'text' && Boolean(\n path.findParent((parent) => parent.isFunction() && jsxCallbacks.has(parent.node as b.Function)),\n );\n const reactOwner = options.bindReactText && clientModule && method === 'text' && !callbackOwned\n ? reactFunction(path)\n : undefined;\n if (options.bindReactText && clientModule && method === 'text' && !callbackOwned && !reactOwner) {\n throw new Error(\n `[i18n] ${filename}:${path.node.loc?.start.line}: client t.text must be rendered inside a component or hook`,\n );\n }\n plans.push({ path, source, scope, reactOwner: reactOwner ?? undefined });\n if (source !== null) {\n messages.push({ ...scope, source, id: scope.context ? `${scope.context}\\0${source}` : source });\n }\n },\n });\n // Discover unused/escaping scopes as well as scopes reached by message calls.\n traverse(ast, {\n VariableDeclarator(path) {\n analysis.resolve(path.get('id') as NodePath);\n },\n CallExpression(path) {\n const name = memberName(path.get('callee'));\n\n if (name && ['context', 'note', 'meta'].includes(name)) analysis.resolve(path);\n },\n });\n const expressionUse = (path: NodePath): NodePath => {\n while (\n path.parentPath &&\n (path.parentPath.isTSAsExpression() || path.parentPath.isTSSatisfiesExpression() ||\n path.parentPath.isTSNonNullExpression() || path.parentPath.isTypeCastExpression() ||\n path.parentPath.isParenthesizedExpression())\n ) path = path.parentPath;\n\n return path;\n };\n\n for (const path of analysis.scopeCalls) {\n const use = expressionUse(path);\n const parent = use.parentPath;\n\n if (parent?.isVariableDeclarator() || parent?.isExpressionStatement()) continue;\n if (parent?.isMemberExpression() && parent.get('object') === use && parent.parentPath?.isCallExpression()) continue;\n throw new Error('[i18n] scoped translator escapes same-file message calls');\n }\n for (const binding of analysis.scopedBindings) {\n if (binding.path.parentPath?.parentPath?.isExportNamedDeclaration()) {\n throw new Error('[i18n] scoped translators cannot be exported; repeat the context in the consuming file');\n }\n\n for (const reference of binding.referencePaths) {\n if (reference.findParent((parent) => parent.isTSType())) continue;\n\n const use = expressionUse(reference);\n const parent = use.parentPath;\n\n if (parent?.isVariableDeclarator() && parent.get('init') === use) continue;\n if (parent?.isMemberExpression() && parent.get('object') === use) {\n const method = memberName(parent);\n\n if (\n method && ['msg', 'text', 'jsx', 'context', 'note', 'meta'].includes(method) &&\n parent.parentPath?.isCallExpression()\n ) continue;\n }\n throw new Error('[i18n] scoped translator escapes same-file message calls: ' + binding.identifier.name);\n }\n }\n if (!declarations.length) return { ast, messages, changed: false };\n\n const helper = program!.scope.generateUidIdentifier('tc');\n const rendererHook = program!.scope.generateUidIdentifier('useI18nRenderer');\n const rendererBindings = new Map<FunctionPath, b.Identifier>();\n\n if (plans.length) {\n program!.unshiftContainer(\n 'body',\n b.importDeclaration([b.importSpecifier(helper, b.identifier('t'))], b.stringLiteral('@fluentic/i18n/compiled')),\n );\n }\n if (plans.some((plan) => plan.reactOwner)) {\n program!.unshiftContainer(\n 'body',\n b.importDeclaration(\n [b.importSpecifier(rendererHook, b.identifier('useI18nRenderer'))],\n b.stringLiteral('@fluentic/i18n/react'),\n ),\n );\n for (const owner of new Set(plans.map((plan) => plan.reactOwner).filter(Boolean) as FunctionPath[])) {\n const binding = owner.scope.generateUidIdentifier('text');\n rendererBindings.set(owner, binding);\n const body = owner.get('body');\n if (!body.isBlockStatement()) {\n const expression = body.node as b.Expression;\n body.replaceWith(b.blockStatement([b.returnStatement(expression)]));\n }\n (owner.get('body') as NodePath<b.BlockStatement>).unshiftContainer(\n 'body',\n b.variableDeclaration('const', [\n b.variableDeclarator(\n b.cloneNode(binding),\n b.callExpression(b.cloneNode(rendererHook), [\n b.memberExpression(b.cloneNode(helper), b.identifier('text')),\n ]),\n ),\n ]),\n );\n }\n }\n\n for (const { path, source, scope, reactOwner } of plans) {\n const callee = path.get('callee') as NodePath<b.MemberExpression>;\n const renderer = reactOwner && rendererBindings.get(reactOwner);\n if (renderer) callee.replaceWith(b.cloneNode(renderer));\n else callee.get('object').replaceWith(b.cloneNode(helper));\n if (source !== null) {\n const replacement = b.valueToNode([\n messageId(scope.context, source, hashLength(options.hashLength)),\n compileMessage(source),\n ]);\n b.inherits(replacement, path.node.arguments[0]);\n path.node.arguments[0] = replacement;\n }\n }\n // All scope uses were checked before mutation. Remove aliases from leaves to roots.\n let removed = true;\n\n while (removed) {\n removed = false;\n program!.scope.crawl();\n\n for (const binding of analysis.scopedBindings) {\n if (binding.path.removed) continue;\n\n const current = binding.path.scope.getBinding(binding.identifier.name);\n\n if (current && !current.referenced) {\n binding.path.remove();\n removed = true;\n }\n }\n }\n\n for (const path of analysis.scopeCalls) {\n if (!path.removed) {\n const use = expressionUse(path);\n\n if (use.parentPath?.isExpressionStatement()) use.parentPath.remove();\n }\n }\n for (const declaration of declarations) declaration.node.source.value = importMap[declaration.node.source.value];\n program!.scope.crawl();\n\n for (const declaration of declarations) {\n declaration.node.specifiers = declaration.node.specifiers.filter((specifier) => {\n if (\n !b.isImportSpecifier(specifier) ||\n (b.isIdentifier(specifier.imported) ? specifier.imported.name : specifier.imported.value) !== 't'\n ) return true;\n\n return Boolean(program!.scope.getBinding(specifier.local.name)?.referenced);\n });\n if (!declaration.node.specifiers.length) declaration.remove();\n }\n\n return { ast, messages, changed: true };\n}\n\nexport function transform(code: string, options: CompilerOptions = {}) {\n const filename = options.filename ?? 'source.tsx';\n const result = compileProgram(code, filename, options);\n\n if (!result.changed) return null;\n\n const output = generate(result.ast, { sourceMaps: true, sourceFileName: filename, comments: true }, code);\n\n return { code: output.code, map: output.map, messages: result.messages };\n}\n","import { createJiti } from 'jiti';\nimport { resolve } from 'node:path';\n\nimport type { TransformFilterOptions } from './filter';\nimport type { CompiledOptions } from './index';\n\nexport type { FilterPattern, TransformFilterOptions } from './filter';\n\nexport type PluginOptions = TransformFilterOptions & {\n /** Direct override; otherwise reuse compiled.hashLength from an explicitly selected config or the default. */\n hashLength?: number;\n /** Optional i18n config path, resolved from the plugin's working directory. */\n config?: string;\n /** Next.js client modules: bind synchronous text calls to the hydration boundary. */\n bindReactText?: boolean;\n};\n\nexport function loadOptions(\n options: PluginOptions = {},\n root = process.cwd(),\n): PluginOptions & { configFile?: string; } {\n if ('compiled' in options) {\n throw new TypeError('[i18n] compiler plugins always compile; use hashLength instead of compiled');\n }\n const file = options.config ? resolve(root, options.config) : undefined;\n\n const config = file\n ? createJiti(import.meta.url, { moduleCache: false })(file) as\n & { default?: PluginOptions & { compiled?: true | CompiledOptions; }; }\n & PluginOptions\n & { compiled?: true | CompiledOptions; }\n : {};\n const loaded = (config.default ?? config) as PluginOptions & { compiled?: true | CompiledOptions; };\n const { compiled, ...configOptions } = loaded;\n const sharedHashLength = typeof compiled === 'object' ? compiled.hashLength : undefined;\n\n return {\n ...configOptions,\n ...(sharedHashLength === undefined ? {} : { hashLength: sharedHashLength }),\n ...options,\n configFile: file,\n };\n}\n","import { traverse } from './analyze';\nimport { createTransformFilter } from './filter';\nimport { compileProgram } from './index';\nimport { loadOptions, type PluginOptions } from './options';\n/** Owns parsing even when a host (e.g. Metro) passes an already parsed AST. */\nexport default function fluenticBabel(_api: unknown, options: PluginOptions = {}) {\n const config = loadOptions(options);\n const filter = createTransformFilter(config);\n const handled = new WeakSet<object>();\n const enabled = (code: string) => code.includes('@fluentic/i18n');\n\n const compile = (code: string, filename: string) => {\n const { ast } = compileProgram(code, filename, config);\n // Standalone paths have a default Hub. Babel must create its own paths for presets.\n traverse.cache.clear();\n handled.add(ast.program);\n\n return ast;\n };\n\n return {\n name: 'fluentic-i18n',\n parserOverride(code: string, parserOptions: { sourceFilename?: string; }) {\n if (!enabled(code) || !filter(parserOptions.sourceFilename ?? 'source.tsx')) return undefined;\n\n return compile(code, parserOptions.sourceFilename ?? 'source.tsx');\n },\n pre(file: any) {\n if (!enabled(file.code) || !filter(file.opts.filename ?? 'source.tsx') || handled.has(file.path.node)) return;\n\n const ast = compile(file.code, file.opts.filename ?? 'source.tsx');\n file.path.replaceWith(ast.program);\n file.scope.crawl();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,WAAaA,gBAAe,QAAoE,WACpGA,gBAAe;AAGjB,MAAa,YAAoC;CAC/C,kBAAkB;CAClB,uBAAuB;AACzB;AAIA,SAAgB,YAAY,MAAc,UAAkB;CAC1D,QAAA,GAAOC,cAAAA,MAAAA,CAAM,MAAM;EACjB,gBAAgB;EAChB,YAAY;EACZ,SAAS;GACP,GAAI,eAAe,KAAK,QAAQ,IAAI,CAAC,YAAqB,IAAI,CAAC;GAC/D,GAAI,CAAC,aAAa,KA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