@intlayer/lsp 8.11.4 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/_virtual/_rolldown/runtime.mjs +36 -0
- package/dist/esm/callers/index.mjs +12 -0
- package/dist/esm/callers/index.mjs.map +1 -0
- package/dist/esm/callers/patterns.mjs +37 -0
- package/dist/esm/callers/patterns.mjs.map +1 -0
- package/dist/esm/dictionaryUtils.mjs +84 -0
- package/dist/esm/dictionaryUtils.mjs.map +1 -0
- package/dist/esm/findFieldInFile.mjs +22 -125
- package/dist/esm/findFieldInFile.mjs.map +1 -1
- package/dist/esm/findKeyAtOffset.mjs +20 -24
- package/dist/esm/findKeyAtOffset.mjs.map +1 -1
- package/dist/esm/findKeyInContentFile.mjs +259 -40
- package/dist/esm/findKeyInContentFile.mjs.map +1 -1
- package/dist/esm/findTCallAtOffset.mjs +33 -0
- package/dist/esm/findTCallAtOffset.mjs.map +1 -0
- package/dist/esm/findUsageFieldAtOffset.mjs +12 -51
- package/dist/esm/findUsageFieldAtOffset.mjs.map +1 -1
- package/dist/esm/index.mjs +343 -172
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/oxcUtils.mjs +99 -29
- package/dist/esm/oxcUtils.mjs.map +1 -1
- package/dist/esm/usageAnalyzer.mjs +695 -0
- package/dist/esm/usageAnalyzer.mjs.map +1 -0
- package/dist/esm/utils.mjs +12 -1
- package/dist/types/callers/index.d.ts +5 -0
- package/dist/types/callers/index.d.ts.map +1 -0
- package/dist/types/callers/patterns.d.ts +30 -0
- package/dist/types/callers/patterns.d.ts.map +1 -0
- package/dist/types/dictionaryUtils.d.ts +11 -0
- package/dist/types/dictionaryUtils.d.ts.map +1 -0
- package/dist/types/findFieldInFile.d.ts +19 -22
- package/dist/types/findFieldInFile.d.ts.map +1 -1
- package/dist/types/findKeyAtOffset.d.ts +15 -12
- package/dist/types/findKeyAtOffset.d.ts.map +1 -1
- package/dist/types/findKeyInContentFile.d.ts +23 -21
- package/dist/types/findKeyInContentFile.d.ts.map +1 -1
- package/dist/types/findTCallAtOffset.d.ts +24 -0
- package/dist/types/findTCallAtOffset.d.ts.map +1 -0
- package/dist/types/findUsageFieldAtOffset.d.ts +14 -13
- package/dist/types/findUsageFieldAtOffset.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/oxcUtils.d.ts +44 -15
- package/dist/types/oxcUtils.d.ts.map +1 -1
- package/dist/types/usageAnalyzer.d.ts +141 -0
- package/dist/types/usageAnalyzer.d.ts.map +1 -0
- package/dist/types/utils.d.ts +15 -1
- package/package.json +11 -24
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageAnalyzer.mjs","names":["ALL_CALLERS"],"sources":["../../src/usageAnalyzer.ts"],"sourcesContent":["import {\n ALL_CALLERS,\n type CallerDescriptor,\n type CallerValueSource,\n isCallerActive,\n} from './callers';\nimport {\n buildParentMap,\n getObjectPropertyNode,\n getObjectPropertyString,\n getPropertyKeyName,\n getStaticStringValue,\n nodeEnd,\n nodeStart,\n type OxcNode,\n parseText,\n walkAst,\n} from './oxcUtils';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** How a message usage appears in source code. */\nexport type MessageUsageKind =\n /** Translation-function or self call: `t('title')`, `formatMessage({ id })`. */\n | 'call'\n /** Member access / bare reference on a content object: `content.title`. */\n | 'member'\n /** Destructured content field: `const { title } = useIntlayer('home')`. */\n | 'destructure'\n /** JSX message component: `<FormattedMessage id=\"home.title\" />`. */\n | 'jsx'\n /** Tagged template: lingui's ``t`Hello` ``. */\n | 'tagged-template'\n /** The caller call itself (dictionary-level usage): `useIntlayer('home')`. */\n | 'namespace';\n\n/**\n * One resolved translation usage inside a source file: which dictionary and\n * field it reads, and the text span it occupies.\n */\nexport type MessageUsage = {\n /** The intlayer dictionary key the usage reads from. */\n dictionaryKey: string;\n /**\n * Path of content fields from the dictionary root. Empty for\n * dictionary-level usages (`namespace` kind, or a bare content variable).\n */\n fieldPath: string[];\n /**\n * Spans of each `fieldPath` segment, aligned by index, when the segments\n * are addressable in source (member chains). Used to trim the path to the\n * segment under the cursor.\n */\n fieldSpans?: { start: number; end: number }[];\n /** Start offset of the usage expression. */\n start: number;\n /** End offset of the usage expression. */\n end: number;\n kind: MessageUsageKind;\n /** The caller that produced the usage, e.g. `'useTranslations'`. */\n callerName: string;\n /** The library the caller belongs to, e.g. `'next-intl'` or `'intlayer'`. */\n library: string;\n /** Module specifier the caller was imported from, when resolvable. */\n moduleSource?: string;\n /**\n * `true` for `member` usages that are a bare reference to a bound variable\n * (`{greet}` in JSX after `const { greet } = useIntlayer(…)`) — the field\n * name itself is not spelled at the usage site. Excluded from\n * find-references results but kept for decorations and hover.\n */\n isBareReference?: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Internal binding models\n// ---------------------------------------------------------------------------\n\n/**\n * Variable holding a translation function (`t`) with a bound namespace.\n * `dictionaryKey` is `null` for root-scope translators (`useTranslations()`\n * without a namespace) — the dictionary is then the first dot-segment of\n * each message id.\n */\ntype TranslatorBinding = {\n dictionaryKey: string | null;\n keyPrefix: string[];\n descriptor: CallerDescriptor;\n moduleSource?: string;\n};\n\n/** Variable holding dictionary content (or a field subtree of it). */\ntype ContentBinding = {\n dictionaryKey: string;\n basePath: string[];\n descriptor: CallerDescriptor;\n moduleSource?: string;\n};\n\n/**\n * Property names that are framework accessors rather than content fields\n * (react `.value`, vue refs `.value`, editor `.raw`/`.use`): they are skipped\n * when building field paths.\n */\nconst ACCESSOR_PROPERTY_NAMES = new Set(['value', 'raw', 'use']);\n\n// ---------------------------------------------------------------------------\n// Match helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve a value source against a call expression's arguments.\n */\nconst readValueSource = (\n callNode: OxcNode,\n source: CallerValueSource\n): string | null => {\n const argumentsList = callNode['arguments'] as OxcNode[] | undefined;\n\n switch (source.from) {\n case 'argument':\n return getStaticStringValue(argumentsList?.[source.index]);\n case 'option':\n return getObjectPropertyString(\n argumentsList?.[source.argumentIndex],\n source.property\n );\n case 'fixed':\n return source.value;\n case 'path-first-segment':\n // Resolved from the message id at usage time, not from the call shape.\n return null;\n }\n};\n\n/** Read the first matching value from a list of sources. */\nconst readValueSources = (\n callNode: OxcNode,\n sources: CallerValueSource[] | undefined\n): string | null => {\n for (const source of sources ?? []) {\n const value = readValueSource(callNode, source);\n\n if (value !== null) return value;\n }\n\n return null;\n};\n\n/**\n * Apply nested-namespace semantics: for descriptors flagged\n * `nestedNamespace`, a dotted namespace is split at the first `.` into the\n * dictionary key and a key-prefix path (next-intl:\n * `useTranslations('about.counter')` → dictionary `about`, prefix\n * `['counter']`).\n */\nconst splitNestedNamespace = (\n descriptor: CallerDescriptor,\n rawNamespace: string\n): { dictionaryKey: string; prefixPath: string[] } => {\n if (!descriptor.nestedNamespace || !rawNamespace.includes('.')) {\n return { dictionaryKey: rawNamespace, prefixPath: [] };\n }\n\n const segments = rawNamespace.split('.');\n\n return { dictionaryKey: segments[0]!, prefixPath: segments.slice(1) };\n};\n\n/**\n * Return the caller name matched by a call/tagged-template callee: the bare\n * identifier name, or the property name of a member expression when the\n * descriptor allows method matching.\n */\nconst getCalleeName = (\n calleeNode: OxcNode | undefined\n): { name: string; isMethod: boolean } | null => {\n if (!calleeNode) return null;\n\n if (calleeNode['type'] === 'Identifier') {\n return { name: calleeNode['name'] as string, isMethod: false };\n }\n\n if (\n calleeNode['type'] === 'MemberExpression' &&\n calleeNode['computed'] !== true\n ) {\n const propertyNode = calleeNode['property'] as OxcNode | undefined;\n\n if (propertyNode?.['type'] === 'Identifier') {\n return { name: propertyNode['name'] as string, isMethod: true };\n }\n }\n\n return null;\n};\n\n/**\n * The message id of a self caller: either the first string argument or the\n * `id` property of a descriptor-object first argument\n * (`formatMessage({ id: 'home.title' })`, `i18n._({ id: '…' })`).\n */\nconst getSelfCallMessageId = (callNode: OxcNode): string | null => {\n const argumentsList = callNode['arguments'] as OxcNode[] | undefined;\n const firstArgument = argumentsList?.[0];\n\n if (!firstArgument) return null;\n\n return (\n getStaticStringValue(firstArgument) ??\n getObjectPropertyString(firstArgument, 'id')\n );\n};\n\n/**\n * Split a message id into dictionary key + field path according to the\n * descriptor semantics.\n */\nconst resolveMessageId = (\n descriptor: CallerDescriptor,\n fixedDictionaryKey: string | null,\n messageId: string\n): { dictionaryKey: string; fieldPath: string[] } | null => {\n if (fixedDictionaryKey !== null) {\n return {\n dictionaryKey: fixedDictionaryKey,\n fieldPath: descriptor.flatKey ? [messageId] : messageId.split('.'),\n };\n }\n\n const usesPathFirstSegment = descriptor.namespaceSources.some(\n (source) => source.from === 'path-first-segment'\n );\n\n if (!usesPathFirstSegment) return null;\n\n const segments = messageId.split('.');\n\n if (!segments[0]) return null;\n\n return { dictionaryKey: segments[0], fieldPath: segments.slice(1) };\n};\n\n/**\n * i18next-style `ns:key` ids override the bound namespace:\n * `t('about:title')` reads the `about` dictionary even when the translator\n * was created with another namespace.\n */\nconst splitNamespacePrefixedId = (\n messageId: string\n): { namespaceOverride: string | null; messagePath: string } => {\n const separatorIndex = messageId.indexOf(':');\n\n if (separatorIndex <= 0) {\n return { namespaceOverride: null, messagePath: messageId };\n }\n\n return {\n namespaceOverride: messageId.slice(0, separatorIndex),\n messagePath: messageId.slice(separatorIndex + 1),\n };\n};\n\n// ---------------------------------------------------------------------------\n// Analyzer\n// ---------------------------------------------------------------------------\n\n/** Unwrap `await expression` down to the awaited expression. */\nconst unwrapAwait = (node: OxcNode | undefined): OxcNode | undefined =>\n node?.['type'] === 'AwaitExpression'\n ? (node['argument'] as OxcNode | undefined)\n : node;\n\n/** Collect every module specifier imported by the program. */\nconst collectImportSources = (program: OxcNode): Set<string> => {\n const importSources = new Set<string>();\n\n for (const statement of (program['body'] as OxcNode[]) ?? []) {\n if (statement['type'] !== 'ImportDeclaration') continue;\n const sourceValue = (statement['source'] as OxcNode | undefined)?.['value'];\n\n if (typeof sourceValue === 'string') importSources.add(sourceValue);\n }\n\n return importSources;\n};\n\n/** Map each imported local name to its module specifier. */\nconst collectImportedLocalNames = (program: OxcNode): Map<string, string> => {\n const localNameToSource = new Map<string, string>();\n\n for (const statement of (program['body'] as OxcNode[]) ?? []) {\n if (statement['type'] !== 'ImportDeclaration') continue;\n const sourceValue = (statement['source'] as OxcNode | undefined)?.['value'];\n\n if (typeof sourceValue !== 'string') continue;\n\n for (const specifier of (statement['specifiers'] as OxcNode[]) ?? []) {\n const localName = (specifier['local'] as OxcNode | undefined)?.['name'];\n\n if (typeof localName === 'string') {\n localNameToSource.set(localName, sourceValue);\n }\n }\n }\n\n return localNameToSource;\n};\n\ntype AnalyzerState = {\n usages: MessageUsage[];\n translatorBindings: Map<string, TranslatorBinding>;\n contentBindings: Map<string, ContentBinding>;\n activeDescriptors: CallerDescriptor[];\n importedLocalNames: Map<string, string>;\n};\n\n/**\n * Find the descriptor matching a call (or tagged template) callee among the\n * active descriptors.\n */\nconst matchDescriptorForCallee = (\n state: AnalyzerState,\n calleeNode: OxcNode | undefined,\n filter?: (descriptor: CallerDescriptor) => boolean\n): CallerDescriptor | null => {\n const callee = getCalleeName(calleeNode);\n\n if (!callee) return null;\n\n for (const descriptor of state.activeDescriptors) {\n if (descriptor.callerName !== callee.name) continue;\n\n if (callee.isMethod && !descriptor.matchAsMethod) continue;\n\n if (filter && !filter(descriptor)) continue;\n\n return descriptor;\n }\n\n return null;\n};\n\n/** The module specifier a caller local name was imported from, if any. */\nconst getModuleSource = (\n state: AnalyzerState,\n descriptor: CallerDescriptor\n): string | undefined =>\n state.importedLocalNames.get(descriptor.callerName) ?? undefined;\n\n/**\n * Recursively register a content destructure pattern: each property key is a\n * field usage, each bound identifier becomes a content binding, and nested\n * patterns extend the field path.\n *\n * const { searchInput: { text: alias } } = useIntlayer('key')\n * → usages: ['searchInput'], ['searchInput', 'text']\n * → binding: alias → ['searchInput', 'text']\n */\nconst collectContentDestructure = (\n state: AnalyzerState,\n pattern: OxcNode,\n dictionaryKey: string,\n basePath: string[],\n descriptor: CallerDescriptor,\n moduleSource: string | undefined\n): void => {\n for (const property of (pattern['properties'] as OxcNode[]) ?? []) {\n const propertyType = property['type'] as string;\n\n if (propertyType !== 'Property' && propertyType !== 'ObjectProperty') {\n continue;\n }\n\n const keyNode = property['key'] as OxcNode | undefined;\n const fieldName = getPropertyKeyName(keyNode);\n\n if (!keyNode || !fieldName) continue;\n\n const fieldPath = [...basePath, fieldName];\n\n state.usages.push({\n dictionaryKey,\n fieldPath,\n start: nodeStart(keyNode),\n end: nodeEnd(keyNode),\n kind: 'destructure',\n callerName: descriptor.callerName,\n library: descriptor.library,\n moduleSource,\n });\n\n // Unwrap default values: { title = fallback }\n let valueNode = property['value'] as OxcNode | undefined;\n\n if (valueNode?.['type'] === 'AssignmentPattern') {\n valueNode = valueNode['left'] as OxcNode | undefined;\n }\n\n if (valueNode?.['type'] === 'Identifier') {\n state.contentBindings.set(valueNode['name'] as string, {\n dictionaryKey,\n basePath: fieldPath,\n descriptor,\n moduleSource,\n });\n } else if (valueNode?.['type'] === 'ObjectPattern') {\n collectContentDestructure(\n state,\n valueNode,\n dictionaryKey,\n fieldPath,\n descriptor,\n moduleSource\n );\n }\n }\n};\n\n/**\n * Register bindings created by `const … = caller(…)` declarations, and record\n * dictionary-level (`namespace`) usages for every matched caller call.\n */\nconst collectBindings = (state: AnalyzerState, program: OxcNode): void => {\n walkAst(program, (node) => {\n if (node['type'] === 'CallExpression') {\n const descriptor = matchDescriptorForCallee(\n state,\n node['callee'] as OxcNode | undefined,\n (candidate) => candidate.translationFunction !== 'self'\n );\n\n if (descriptor) {\n const rawNamespace = readValueSources(\n node,\n descriptor.namespaceSources\n );\n\n if (rawNamespace) {\n const { dictionaryKey } = splitNestedNamespace(\n descriptor,\n rawNamespace\n );\n\n state.usages.push({\n dictionaryKey,\n fieldPath: [],\n start: nodeStart(node),\n end: nodeEnd(node),\n kind: 'namespace',\n callerName: descriptor.callerName,\n library: descriptor.library,\n moduleSource: getModuleSource(state, descriptor),\n });\n }\n }\n return;\n }\n\n if (node['type'] !== 'VariableDeclarator') return;\n\n const initializer = unwrapAwait(node['init'] as OxcNode | undefined);\n\n if (initializer?.['type'] !== 'CallExpression') return;\n\n const descriptor = matchDescriptorForCallee(\n state,\n initializer['callee'] as OxcNode | undefined,\n (candidate) => candidate.translationFunction !== 'self'\n );\n\n if (!descriptor) return;\n\n const rawNamespace = readValueSources(\n initializer,\n descriptor.namespaceSources\n );\n\n // Root scope: `useTranslations()` — the dictionary comes from each id.\n if (!rawNamespace && !descriptor.allowRootScope) return;\n\n const namespaceSplit = rawNamespace\n ? splitNestedNamespace(descriptor, rawNamespace)\n : { dictionaryKey: null, prefixPath: [] };\n\n const keyPrefixValue = readValueSources(\n initializer,\n descriptor.keyPrefixSources\n );\n const keyPrefix = [\n ...namespaceSplit.prefixPath,\n ...(keyPrefixValue ? keyPrefixValue.split('.') : []),\n ];\n const dictionaryKey = namespaceSplit.dictionaryKey;\n const moduleSource = getModuleSource(state, descriptor);\n const idNode = node['id'] as OxcNode | undefined;\n\n if (!idNode) return;\n\n // const t = useTranslations('ns') / const content = useIntlayer('key')\n if (idNode['type'] === 'Identifier') {\n const variableName = idNode['name'] as string;\n\n if (descriptor.translationFunction === 'return-value') {\n state.translatorBindings.set(variableName, {\n dictionaryKey,\n keyPrefix,\n descriptor,\n moduleSource,\n });\n } else if (\n descriptor.translationFunction === 'content' &&\n dictionaryKey\n ) {\n state.contentBindings.set(variableName, {\n dictionaryKey,\n basePath: keyPrefix,\n descriptor,\n moduleSource,\n });\n }\n return;\n }\n\n // const { t } = useTranslation('ns') / const { title } = useIntlayer('key')\n if (idNode['type'] !== 'ObjectPattern') return;\n\n if (descriptor.translationFunction === 'content') {\n if (!dictionaryKey) return;\n\n collectContentDestructure(\n state,\n idNode,\n dictionaryKey,\n keyPrefix,\n descriptor,\n moduleSource\n );\n return;\n }\n\n if (descriptor.translationFunction !== 'destructured-t') return;\n\n for (const property of (idNode['properties'] as OxcNode[]) ?? []) {\n const propertyType = property['type'] as string;\n\n if (propertyType !== 'Property' && propertyType !== 'ObjectProperty') {\n continue;\n }\n\n const keyNode = property['key'] as OxcNode | undefined;\n const valueNode = property['value'] as OxcNode | undefined;\n const fieldName = getPropertyKeyName(keyNode);\n const localName =\n valueNode?.['type'] === 'Identifier'\n ? (valueNode['name'] as string)\n : null;\n\n // Only the `t` property carries the translation function.\n if (fieldName !== 't' || !localName) continue;\n\n state.translatorBindings.set(localName, {\n dictionaryKey,\n keyPrefix,\n descriptor,\n moduleSource,\n });\n }\n });\n};\n\n/**\n * Record `t('path.to.field')` calls on translator bindings, and self-caller\n * calls (`formatMessage({ id })`, `i18n._('id')`).\n */\nconst collectCallUsages = (state: AnalyzerState, program: OxcNode): void => {\n walkAst(program, (node) => {\n if (node['type'] === 'TaggedTemplateExpression') {\n collectTaggedTemplateUsage(state, node);\n return;\n }\n\n if (node['type'] !== 'CallExpression') return;\n\n const callee = node['callee'] as OxcNode | undefined;\n\n // Translator binding call: t('path.to.field')\n if (callee?.['type'] === 'Identifier') {\n const binding = state.translatorBindings.get(callee['name'] as string);\n\n if (binding) {\n const argumentsList = node['arguments'] as OxcNode[] | undefined;\n const messageId = getStaticStringValue(argumentsList?.[0]);\n\n if (messageId) {\n const { namespaceOverride, messagePath } =\n splitNamespacePrefixedId(messageId);\n let dictionaryKey = namespaceOverride ?? binding.dictionaryKey;\n let fieldPath = namespaceOverride\n ? messagePath.split('.')\n : [...binding.keyPrefix, ...messagePath.split('.')];\n\n // Root-scope translator (`useTranslations()`): the first id\n // segment is the dictionary key.\n if (dictionaryKey === null) {\n const segments = messagePath.split('.');\n dictionaryKey = segments[0] ?? null;\n fieldPath = segments.slice(1);\n }\n\n if (dictionaryKey) {\n state.usages.push({\n dictionaryKey,\n fieldPath,\n start: nodeStart(node),\n end: nodeEnd(node),\n kind: 'call',\n callerName: binding.descriptor.callerName,\n library: binding.descriptor.library,\n moduleSource: binding.moduleSource,\n });\n }\n }\n return;\n }\n }\n\n // Self caller: the call itself carries the message id.\n const descriptor = matchDescriptorForCallee(\n state,\n callee,\n (candidate) => candidate.translationFunction === 'self'\n );\n\n if (!descriptor) return;\n\n const messageId = getSelfCallMessageId(node);\n\n if (!messageId) return;\n\n const fixedDictionaryKey = readValueSources(\n node,\n descriptor.namespaceSources\n );\n const resolved = resolveMessageId(\n descriptor,\n fixedDictionaryKey,\n messageId\n );\n\n if (!resolved) return;\n\n state.usages.push({\n ...resolved,\n start: nodeStart(node),\n end: nodeEnd(node),\n kind: 'call',\n callerName: descriptor.callerName,\n library: descriptor.library,\n moduleSource: getModuleSource(state, descriptor),\n });\n });\n};\n\n/**\n * Lingui macro tagged template: ``t`Hello ${name}` `` — the catalog id is the\n * template text with `{placeholder}` slots for each expression.\n */\nconst collectTaggedTemplateUsage = (\n state: AnalyzerState,\n node: OxcNode\n): void => {\n const descriptor = matchDescriptorForCallee(\n state,\n node['tag'] as OxcNode | undefined,\n (candidate) => candidate.matchAsTaggedTemplate === true\n );\n\n if (!descriptor) return;\n\n const quasiNode = node['quasi'] as OxcNode | undefined;\n const quasis = (quasiNode?.['quasis'] as OxcNode[]) ?? [];\n const expressions = (quasiNode?.['expressions'] as OxcNode[]) ?? [];\n\n let messageId = '';\n\n for (let index = 0; index < quasis.length; index++) {\n const valueNode = quasis[index]?.['value'] as OxcNode | undefined;\n messageId +=\n (valueNode?.['cooked'] as string) ?? (valueNode?.['raw'] as string) ?? '';\n\n if (index < expressions.length) {\n const expression = expressions[index]!;\n const placeholder =\n expression['type'] === 'Identifier'\n ? (expression['name'] as string)\n : String(index);\n messageId += `{${placeholder}}`;\n }\n }\n\n if (!messageId) return;\n\n const fixedDictionaryKey = readValueSources(\n node,\n descriptor.namespaceSources\n );\n const resolved = resolveMessageId(descriptor, fixedDictionaryKey, messageId);\n\n if (!resolved) return;\n\n state.usages.push({\n ...resolved,\n start: nodeStart(node),\n end: nodeEnd(node),\n kind: 'tagged-template',\n callerName: descriptor.callerName,\n library: descriptor.library,\n moduleSource: getModuleSource(state, descriptor),\n });\n};\n\n/** Read a static string JSX attribute from an opening element. */\nconst getJsxAttributeString = (\n openingElement: OxcNode,\n attributeName: string\n): string | null => {\n for (const attribute of (openingElement['attributes'] as OxcNode[]) ?? []) {\n if (attribute['type'] !== 'JSXAttribute') continue;\n\n const nameNode = attribute['name'] as OxcNode | undefined;\n\n if ((nameNode?.['name'] as string) !== attributeName) continue;\n\n const valueNode = attribute['value'] as OxcNode | undefined;\n\n if (!valueNode) return null;\n\n // <Trans i18nKey=\"key\" /> or <Trans i18nKey={'key'} />\n const directValue = getStaticStringValue(valueNode);\n\n if (directValue !== null) return directValue;\n\n if (valueNode['type'] === 'JSXExpressionContainer') {\n return getStaticStringValue(\n valueNode['expression'] as OxcNode | undefined\n );\n }\n\n return null;\n }\n\n return null;\n};\n\n/**\n * Record JSX message components: `<FormattedMessage id=\"home.title\" />`,\n * `<Trans i18nKey=\"richText\" />`, `<Trans id=\"…\" />`.\n */\nconst collectJsxUsages = (state: AnalyzerState, program: OxcNode): void => {\n // Fallback namespace for JSX components without an explicit one: the single\n // distinct translator namespace declared in the file (react-i18next Trans).\n const translatorNamespaces = new Set(\n [...state.translatorBindings.values()]\n .map((binding) => binding.dictionaryKey)\n .filter(\n (dictionaryKey): dictionaryKey is string => dictionaryKey !== null\n )\n );\n const fallbackNamespace =\n translatorNamespaces.size === 1 ? [...translatorNamespaces][0]! : null;\n\n walkAst(program, (node) => {\n if (node['type'] !== 'JSXOpeningElement') return;\n\n const nameNode = node['name'] as OxcNode | undefined;\n\n if (nameNode?.['type'] !== 'JSXIdentifier') return;\n\n const elementName = nameNode['name'] as string;\n\n for (const descriptor of state.activeDescriptors) {\n if (!descriptor.jsxIdAttribute) continue;\n\n if (descriptor.callerName !== elementName) continue;\n\n const messageId = getJsxAttributeString(node, descriptor.jsxIdAttribute);\n\n if (messageId === null) continue;\n\n const namespaceFromAttribute = descriptor.jsxNamespaceAttribute\n ? getJsxAttributeString(node, descriptor.jsxNamespaceAttribute)\n : null;\n const fixedNamespace = descriptor.namespaceSources.find(\n (source) => source.from === 'fixed'\n );\n const dictionaryKey =\n namespaceFromAttribute ??\n (fixedNamespace?.from === 'fixed' ? fixedNamespace.value : null) ??\n fallbackNamespace;\n\n let resolved: { dictionaryKey: string; fieldPath: string[] } | null;\n\n if (dictionaryKey) {\n resolved = {\n dictionaryKey,\n fieldPath: descriptor.flatKey ? [messageId] : messageId.split('.'),\n };\n } else {\n resolved = resolveMessageId(descriptor, null, messageId);\n }\n\n if (!resolved) continue;\n\n state.usages.push({\n ...resolved,\n start: nodeStart(node),\n end: nodeEnd(node),\n kind: 'jsx',\n callerName: descriptor.callerName,\n library: descriptor.library,\n moduleSource: getModuleSource(state, descriptor),\n });\n return;\n }\n });\n};\n\n/** Identifier positions that are declarations, not references. */\nconst isDeclarationPosition = (\n identifierNode: OxcNode,\n parentMap: Map<OxcNode, OxcNode>\n): boolean => {\n const parent = parentMap.get(identifierNode);\n\n if (!parent) return false;\n\n const parentType = parent['type'] as string;\n\n if (parentType === 'VariableDeclarator' && parent['id'] === identifierNode) {\n return true;\n }\n\n if (\n (parentType === 'Property' || parentType === 'ObjectProperty') &&\n parentMap.get(parent)?.['type'] === 'ObjectPattern'\n ) {\n return true;\n }\n\n if (parentType === 'ImportSpecifier' || parentType === 'PropertyDefinition') {\n return true;\n }\n\n if (\n parentType === 'FunctionDeclaration' ||\n parentType === 'FunctionExpression' ||\n parentType === 'ArrowFunctionExpression'\n ) {\n return true;\n }\n\n // Object-literal keys: { title: … }\n if (\n (parentType === 'Property' || parentType === 'ObjectProperty') &&\n parent['key'] === identifierNode &&\n parentMap.get(parent)?.['type'] === 'ObjectExpression'\n ) {\n return true;\n }\n\n return false;\n};\n\n/** Identifier used as the (non-computed) property name of a member access. */\nconst isPropertyNamePosition = (\n identifierNode: OxcNode,\n parentMap: Map<OxcNode, OxcNode>\n): boolean => {\n const parent = parentMap.get(identifierNode);\n\n if (!parent) return false;\n\n const parentType = parent['type'] as string;\n\n return (\n (parentType === 'MemberExpression' &&\n parent['property'] === identifierNode &&\n parent['computed'] !== true) ||\n (parentType === 'JSXMemberExpression' &&\n parent['property'] === identifierNode)\n );\n};\n\n/**\n * Record member-access / bare-reference usages of content bindings:\n * `content.section.title`, `{title}` (destructured field reference),\n * Svelte's `$content.title`, Vue's `content.value.title`.\n */\nconst collectMemberUsages = (\n state: AnalyzerState,\n program: OxcNode,\n parentMap: Map<OxcNode, OxcNode>\n): void => {\n if (state.contentBindings.size === 0) return;\n\n walkAst(program, (node) => {\n const nodeType = node['type'] as string;\n\n if (nodeType !== 'Identifier' && nodeType !== 'JSXIdentifier') return;\n\n const rawName = node['name'] as string;\n // Svelte store sugar: `$content` reads the `content` store.\n const variableName = rawName.startsWith('$') ? rawName.slice(1) : rawName;\n const binding = state.contentBindings.get(variableName);\n\n if (!binding) return;\n\n // Skip identifiers in non-value positions: TypeScript type annotations\n // (`useIntlayer<{ greet: string }>`) and JSX attribute names.\n const parentType = parentMap.get(node)?.['type'] as string | undefined;\n\n if (parentType?.startsWith('TS') || parentType === 'JSXAttribute') return;\n\n if (isDeclarationPosition(node, parentMap)) return;\n\n if (isPropertyNamePosition(node, parentMap)) return;\n\n // Climb the member chain upward, collecting property segments.\n const fieldPath = [...binding.basePath];\n const fieldSpans: { start: number; end: number }[] = fieldPath.map(() => ({\n start: nodeStart(node),\n end: nodeEnd(node),\n }));\n\n let currentNode: OxcNode = node;\n\n while (true) {\n const parent = parentMap.get(currentNode);\n\n if (!parent) break;\n\n const parentType = parent['type'] as string;\n const isMemberAccess =\n (parentType === 'MemberExpression' &&\n parent['object'] === currentNode &&\n parent['computed'] !== true) ||\n (parentType === 'JSXMemberExpression' &&\n parent['object'] === currentNode);\n\n if (isMemberAccess) {\n const propertyNode = parent['property'] as OxcNode;\n const propertyName = propertyNode['name'] as string;\n\n if (!ACCESSOR_PROPERTY_NAMES.has(propertyName)) {\n fieldPath.push(propertyName);\n fieldSpans.push({\n start: nodeStart(propertyNode),\n end: nodeEnd(propertyNode),\n });\n }\n currentNode = parent;\n continue;\n }\n\n // Computed string access: content['title']\n if (\n parentType === 'MemberExpression' &&\n parent['object'] === currentNode &&\n parent['computed'] === true\n ) {\n const propertyValue = getStaticStringValue(\n parent['property'] as OxcNode | undefined\n );\n\n if (propertyValue === null) break;\n\n fieldPath.push(propertyValue);\n fieldSpans.push({\n start: nodeStart(parent['property'] as OxcNode),\n end: nodeEnd(parent['property'] as OxcNode),\n });\n currentNode = parent;\n continue;\n }\n\n // Call of an accessor / chain terminator: content.title.use()\n if (parentType === 'CallExpression' && parent['callee'] === currentNode) {\n currentNode = parent;\n continue;\n }\n\n break;\n }\n\n state.usages.push({\n dictionaryKey: binding.dictionaryKey,\n fieldPath,\n fieldSpans,\n start: nodeStart(node),\n end: nodeEnd(currentNode),\n kind: 'member',\n callerName: binding.descriptor.callerName,\n library: binding.descriptor.library,\n moduleSource: binding.moduleSource,\n // No explicit property segment: the usage only names the variable.\n isBareReference: fieldPath.length === binding.basePath.length,\n });\n return true;\n });\n};\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Analyse a source file and return every resolvable translation usage:\n * base-intlayer content access and all compat-library forms (translation\n * functions, self calls, JSX message components, tagged templates).\n *\n * Pure and self-contained (oxc parse only) — shared by the LSP handlers and\n * the VS Code extension providers/decorations.\n *\n * @param text - Full source text (a script: TS/TSX or an extracted SFC block).\n * @returns Usages ordered by start offset.\n */\nexport const collectMessageUsages = (text: string): MessageUsage[] => {\n const program = parseText(text);\n\n if (!program) return [];\n\n const fileImportSources = collectImportSources(program);\n const state: AnalyzerState = {\n usages: [],\n translatorBindings: new Map(),\n contentBindings: new Map(),\n activeDescriptors: ALL_CALLERS.filter((descriptor) =>\n isCallerActive(descriptor, fileImportSources)\n ),\n importedLocalNames: collectImportedLocalNames(program),\n };\n\n collectBindings(state, program);\n collectCallUsages(state, program);\n collectJsxUsages(state, program);\n\n const parentMap = buildParentMap(program);\n collectMemberUsages(state, program, parentMap);\n\n return state.usages.sort((first, second) => first.start - second.start);\n};\n\n/**\n * Resolve the dictionary key declared by a single call-expression node when\n * it matches any registered non-self caller (`useIntlayer(\"key\")`,\n * `useI18n({ namespace })`, …). Used for on-the-fly checks where the full\n * file analysis is not needed (e.g. completion context).\n *\n * @param callNode - A candidate CallExpression node.\n */\nexport const matchCallNamespace = (callNode: OxcNode): string | null => {\n if (callNode['type'] !== 'CallExpression') return null;\n\n const callee = getCalleeName(callNode['callee'] as OxcNode | undefined);\n\n if (!callee) return null;\n\n for (const descriptor of ALL_CALLERS) {\n if (descriptor.translationFunction === 'self') continue;\n\n if (descriptor.callerName !== callee.name) continue;\n\n if (callee.isMethod && !descriptor.matchAsMethod) continue;\n\n const namespaceValue = readValueSources(\n callNode,\n descriptor.namespaceSources\n );\n\n if (namespaceValue !== null) {\n return splitNestedNamespace(descriptor, namespaceValue).dictionaryKey;\n }\n }\n\n return null;\n};\n\n/**\n * A call site declaring which dictionary a caller reads\n * (`useIntlayer(\"home\")`, `useI18n({ namespace: 'home' })`), with the spans\n * needed to anchor diagnostics and cursor checks.\n */\nexport type NamespaceReference = {\n dictionaryKey: string;\n callerName: string;\n library: string;\n /** Span of the whole call expression. */\n callStart: number;\n callEnd: number;\n /** Span of the matched callee name (identifier or method property). */\n calleeStart: number;\n calleeEnd: number;\n /** Span of the namespace argument (string literal or option value). */\n namespaceStart: number;\n namespaceEnd: number;\n};\n\n/**\n * The AST node holding the namespace string for a given value source, when\n * that source is addressable in the call (positional argument or options\n * property).\n */\nconst getNamespaceArgumentNode = (\n callNode: OxcNode,\n source: CallerValueSource\n): OxcNode | null => {\n const argumentsList = callNode['arguments'] as OxcNode[] | undefined;\n\n if (source.from === 'argument') {\n return argumentsList?.[source.index] ?? null;\n }\n\n if (source.from === 'option') {\n const property = getObjectPropertyNode(\n argumentsList?.[source.argumentIndex],\n source.property\n );\n\n return (property?.['value'] as OxcNode | undefined) ?? null;\n }\n\n return null;\n};\n\n/**\n * Collect every call site with an addressable namespace argument (positional\n * or options property) resolving to a static string. Powers the\n * unknown-dictionary diagnostics and `findKeyAtOffset`.\n *\n * Self callers (`formatMessage`, lingui `t`/`_`) don't declare a namespace at\n * the call site and are excluded.\n *\n * @param text - Full source text.\n */\nexport const collectNamespaceReferences = (\n text: string\n): NamespaceReference[] => {\n const program = parseText(text);\n\n if (!program) return [];\n\n const fileImportSources = collectImportSources(program);\n const activeDescriptors = ALL_CALLERS.filter(\n (descriptor) =>\n descriptor.translationFunction !== 'self' &&\n isCallerActive(descriptor, fileImportSources)\n );\n const references: NamespaceReference[] = [];\n\n walkAst(program, (node) => {\n if (node['type'] !== 'CallExpression') return;\n\n const calleeNode = node['callee'] as OxcNode | undefined;\n const callee = getCalleeName(calleeNode);\n\n if (!callee) return;\n\n for (const descriptor of activeDescriptors) {\n if (descriptor.callerName !== callee.name) continue;\n\n if (callee.isMethod && !descriptor.matchAsMethod) continue;\n\n const calleeNameNode =\n callee.isMethod && calleeNode\n ? (calleeNode['property'] as OxcNode)\n : calleeNode!;\n\n for (const source of descriptor.namespaceSources) {\n const namespaceNode = getNamespaceArgumentNode(node, source);\n const namespaceValue = getStaticStringValue(namespaceNode ?? undefined);\n\n if (!namespaceNode || namespaceValue === null) continue;\n\n references.push({\n dictionaryKey: splitNestedNamespace(descriptor, namespaceValue)\n .dictionaryKey,\n callerName: descriptor.callerName,\n library: descriptor.library,\n callStart: nodeStart(node),\n callEnd: nodeEnd(node),\n calleeStart: nodeStart(calleeNameNode),\n calleeEnd: nodeEnd(calleeNameNode),\n namespaceStart: nodeStart(namespaceNode),\n namespaceEnd: nodeEnd(namespaceNode),\n });\n return;\n }\n }\n });\n\n return references;\n};\n\n/**\n * A source variable bound to a dictionary by a caller declaration:\n * dictionary content (or a field subtree of it) for `content` callers, or a\n * translation function for `return-value` / `destructured-t` callers.\n */\nexport type CallerVariableBinding = {\n /** Local variable name. */\n variableName: string;\n /** The dictionary the variable reads from. */\n dictionaryKey: string;\n /**\n * Field path from the dictionary root the variable points at (content\n * bindings), or the key prefix applied to every call (translator bindings).\n */\n basePath: string[];\n /** Whether the variable holds content or a translation function. */\n bindingKind: 'content' | 'translator';\n /** The caller that created the binding. */\n callerName: string;\n library: string;\n};\n\n/**\n * Collect every variable bound to a dictionary in the file. Used by consumers\n * that scan non-script regions (Vue/Angular templates) for references to\n * those variables, or that need to know which dictionaries a file consumes.\n *\n * @param text - Full source text (a script: TS/TSX or an extracted SFC block).\n */\nexport const collectCallerBindings = (\n text: string\n): CallerVariableBinding[] => {\n const program = parseText(text);\n\n if (!program) return [];\n\n const fileImportSources = collectImportSources(program);\n const state: AnalyzerState = {\n usages: [],\n translatorBindings: new Map(),\n contentBindings: new Map(),\n activeDescriptors: ALL_CALLERS.filter((descriptor) =>\n isCallerActive(descriptor, fileImportSources)\n ),\n importedLocalNames: collectImportedLocalNames(program),\n };\n\n collectBindings(state, program);\n\n return [\n ...[...state.contentBindings.entries()].map(\n ([variableName, binding]): CallerVariableBinding => ({\n variableName,\n dictionaryKey: binding.dictionaryKey,\n basePath: binding.basePath,\n bindingKind: 'content',\n callerName: binding.descriptor.callerName,\n library: binding.descriptor.library,\n })\n ),\n ...[...state.translatorBindings.entries()]\n // Root-scope translators have no bound dictionary to expose.\n .filter(([, binding]) => binding.dictionaryKey !== null)\n .map(\n ([variableName, binding]): CallerVariableBinding => ({\n variableName,\n dictionaryKey: binding.dictionaryKey!,\n basePath: binding.keyPrefix,\n bindingKind: 'translator',\n callerName: binding.descriptor.callerName,\n library: binding.descriptor.library,\n })\n ),\n ];\n};\n\n/**\n * Find the most specific translation usage at `offset`.\n *\n * For member chains the field path is trimmed to the segment under the\n * cursor: hovering `section` in `content.section.title` yields\n * `['section']`, not the full chain.\n *\n * Dictionary-level `namespace` usages are only returned when no field-level\n * usage matches the offset.\n *\n * @param text - Full source text.\n * @param offset - Cursor offset in `text`.\n */\nexport const findMessageUsageAtOffset = (\n text: string,\n offset: number\n): MessageUsage | null => {\n const usages = collectMessageUsages(text);\n\n let bestMatch: MessageUsage | null = null;\n\n for (const usage of usages) {\n if (offset < usage.start || offset > usage.end) continue;\n\n const isBetter =\n !bestMatch ||\n // Prefer field-level usages over dictionary-level ones…\n (bestMatch.kind === 'namespace' && usage.kind !== 'namespace') ||\n // …then the smallest span containing the offset.\n (usage.end - usage.start < bestMatch.end - bestMatch.start &&\n !(bestMatch.kind !== 'namespace' && usage.kind === 'namespace'));\n\n if (isBetter) bestMatch = usage;\n }\n\n if (!bestMatch) return null;\n\n // Trim member chains to the segment under the cursor.\n if (bestMatch.kind === 'member' && bestMatch.fieldSpans) {\n let lastIncludedIndex = -1;\n\n for (let index = 0; index < bestMatch.fieldSpans.length; index++) {\n if (offset >= bestMatch.fieldSpans[index]!.start) {\n lastIncludedIndex = index;\n }\n }\n\n return {\n ...bestMatch,\n fieldPath: bestMatch.fieldPath.slice(0, lastIncludedIndex + 1),\n fieldSpans: bestMatch.fieldSpans.slice(0, lastIncludedIndex + 1),\n };\n }\n\n return bestMatch;\n};\n"],"mappings":";;;;;;;;;AA0GA,MAAM,0CAA0B,IAAI,IAAI;CAAC;CAAS;CAAO;AAAK,CAAC;;;;AAS/D,MAAM,mBACJ,UACA,WACkB;CAClB,MAAM,gBAAgB,SAAS;CAE/B,QAAQ,OAAO,MAAf;EACE,KAAK,YACH,OAAO,qBAAqB,gBAAgB,OAAO,MAAM;EAC3D,KAAK,UACH,OAAO,wBACL,gBAAgB,OAAO,gBACvB,OAAO,QACT;EACF,KAAK,SACH,OAAO,OAAO;EAChB,KAAK,sBAEH,OAAO;CACX;AACF;;AAGA,MAAM,oBACJ,UACA,YACkB;CAClB,KAAK,MAAM,UAAU,WAAW,CAAC,GAAG;EAClC,MAAM,QAAQ,gBAAgB,UAAU,MAAM;EAE9C,IAAI,UAAU,MAAM,OAAO;CAC7B;CAEA,OAAO;AACT;;;;;;;;AASA,MAAM,wBACJ,YACA,iBACoD;CACpD,IAAI,CAAC,WAAW,m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oB;EAIxB,OAAO;GACL,GAAG;GACH,WAAW,UAAU,UAAU,MAAM,GAAG,oBAAoB,CAAC;GAC7D,YAAY,UAAU,WAAW,MAAM,GAAG,oBAAoB,CAAC;EACjE;CACF;CAEA,OAAO;AACT"}
|
package/dist/esm/utils.mjs
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
import { callers_exports } from "./callers/index.mjs";
|
|
2
|
+
import { buildParentMap, getFirstStringArg, getObjectPropertyNode, getObjectPropertyString, getPropertyKeyName, getStaticStringValue, getStringArgAt, isStringLiteralNode, nodeContainsOffset, nodeEnd, nodeStart, parseText, walkAst } from "./oxcUtils.mjs";
|
|
3
|
+
import { collectCallerBindings, collectMessageUsages, collectNamespaceReferences, findMessageUsageAtOffset, matchCallNamespace } from "./usageAnalyzer.mjs";
|
|
1
4
|
import { escapeRegularExpression, findFieldRangesInFile, offsetToRange } from "./findFieldInFile.mjs";
|
|
5
|
+
import { findTCallAtOffset } from "./findTCallAtOffset.mjs";
|
|
6
|
+
import { buildCallerWithKeyPattern, buildKeyUsagePatterns, getCallerNamesAlternation } from "./callers/patterns.mjs";
|
|
2
7
|
import { findKeyAtOffset } from "./findKeyAtOffset.mjs";
|
|
3
8
|
import { findContentFieldAtOffset, findKeyInContentFile } from "./findKeyInContentFile.mjs";
|
|
4
9
|
import { findUsageFieldAtOffset } from "./findUsageFieldAtOffset.mjs";
|
|
5
10
|
|
|
6
|
-
|
|
11
|
+
var ALL_CALLERS = callers_exports.ALL_CALLERS;
|
|
12
|
+
var BASE_CALLERS = callers_exports.BASE_CALLERS;
|
|
13
|
+
var CALLERS_BY_NAME = callers_exports.CALLERS_BY_NAME;
|
|
14
|
+
var COMPAT_CALLERS = callers_exports.COMPAT_CALLERS;
|
|
15
|
+
var getPositionalKeyCallerNames = callers_exports.getPositionalKeyCallerNames;
|
|
16
|
+
var isCallerActive = callers_exports.isCallerActive;
|
|
17
|
+
export { ALL_CALLERS, BASE_CALLERS, CALLERS_BY_NAME, COMPAT_CALLERS, buildCallerWithKeyPattern, buildKeyUsagePatterns, buildParentMap, collectCallerBindings, collectMessageUsages, collectNamespaceReferences, escapeRegularExpression, findContentFieldAtOffset, findFieldRangesInFile, findKeyAtOffset, findKeyInContentFile, findMessageUsageAtOffset, findTCallAtOffset, findUsageFieldAtOffset, getCallerNamesAlternation, getFirstStringArg, getObjectPropertyNode, getObjectPropertyString, getPositionalKeyCallerNames, getPropertyKeyName, getStaticStringValue, getStringArgAt, isCallerActive, isStringLiteralNode, matchCallNamespace, nodeContainsOffset, nodeEnd, nodeStart, offsetToRange, parseText, walkAst };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/callers/index.ts"],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/callers/patterns.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Alternation of every caller name whose dictionary key appears as a
|
|
4
|
+
* positional string argument — for building text-search patterns.
|
|
5
|
+
*/
|
|
6
|
+
declare const getCallerNamesAlternation: () => string;
|
|
7
|
+
/**
|
|
8
|
+
* Regexes matching call sites that reference the dictionary `key` in project
|
|
9
|
+
* source files. Used by "find all references" (content file → call sites).
|
|
10
|
+
*
|
|
11
|
+
* Two shapes are covered:
|
|
12
|
+
* 1. Positional key argument, with optional TypeScript generic:
|
|
13
|
+
* `useIntlayer("key")`, `useTranslations<T>("key")`, `getFixedT("en", "key")`
|
|
14
|
+
* 2. Options/descriptor object property:
|
|
15
|
+
* `getTranslations({ namespace: 'key' })`, `useI18n({ namespace: 'key' })`,
|
|
16
|
+
* `formatMessage({ id: 'key.field' })`
|
|
17
|
+
*
|
|
18
|
+
* @param key - The dictionary key to search for.
|
|
19
|
+
*/
|
|
20
|
+
declare const buildKeyUsagePatterns: (key: string) => RegExp[];
|
|
21
|
+
/**
|
|
22
|
+
* Regex testing whether a file contains a caller invoked with the given
|
|
23
|
+
* dictionary key — a cheap pre-filter before running field-level analysis.
|
|
24
|
+
*
|
|
25
|
+
* @param key - The dictionary key.
|
|
26
|
+
*/
|
|
27
|
+
declare const buildCallerWithKeyPattern: (key: string) => RegExp;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { buildCallerWithKeyPattern, buildKeyUsagePatterns, getCallerNamesAlternation };
|
|
30
|
+
//# sourceMappingURL=patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","names":[],"sources":["../../../src/callers/patterns.ts"],"mappings":";;;;;cAOa;;;;;;;;;;;;;;cAgBA,wBAAyB,gBAAc;;;;;;;cAqBvC,4BAA6B,gBAAc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
2
|
+
//#region src/dictionaryUtils.d.ts
|
|
3
|
+
declare const formatFieldValue: (value: unknown) => string;
|
|
4
|
+
declare const getFieldByPath: (content: unknown, path: string[]) => unknown;
|
|
5
|
+
declare const getTopLevelFields: (content: unknown) => string[];
|
|
6
|
+
declare const getFieldsAtPath: (content: unknown, path: string[]) => string[];
|
|
7
|
+
declare const formatDictionaryHover: (dictionaries: Dictionary[], key: string) => string;
|
|
8
|
+
declare const formatFieldHover: (dictionaries: Dictionary[], dictionaryKey: string, fieldPath: string[]) => string | null;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { formatDictionaryHover, formatFieldHover, formatFieldValue, getFieldByPath, getFieldsAtPath, getTopLevelFields };
|
|
11
|
+
//# sourceMappingURL=dictionaryUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionaryUtils.d.ts","names":[],"sources":["../../src/dictionaryUtils.ts"],"mappings":";;cAoDa,mBAAoB;cAoBpB,iBAAkB,kBAAkB;cAYpC,oBAAqB;cAKrB,kBAAmB,kBAAkB;cASrC,wBACX,cAAc,cACd;cAyBW,mBACX,cAAc,cACd,uBACA"}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import { Range } from "vscode-languageserver/node
|
|
2
|
-
|
|
1
|
+
import { Range } from "vscode-languageserver/node";
|
|
3
2
|
//#region src/findFieldInFile.d.ts
|
|
4
3
|
declare const escapeRegularExpression: (content: string) => string;
|
|
5
4
|
declare const offsetToRange: (text: string, start: number, end: number) => Range;
|
|
6
5
|
/**
|
|
7
|
-
* Within a single file's text, find all positions where `fieldPath` (or legacy
|
|
8
|
-
* `fieldName`) is
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Covers
|
|
12
|
-
* 1. Direct destructure:
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
* backward compatibility.
|
|
26
|
-
*/
|
|
6
|
+
* Within a single file's text, find all positions where `fieldPath` (or legacy
|
|
7
|
+
* `fieldName`) is consumed from the dictionary `escapedKey` — through any
|
|
8
|
+
* registered caller.
|
|
9
|
+
*
|
|
10
|
+
* Covers base-intlayer patterns:
|
|
11
|
+
* 1. Direct destructure: const { field } = useIntlayer("key")
|
|
12
|
+
* 2. Nested destructure: const { parent: { child } } = useIntlayer("key")
|
|
13
|
+
* 3. Indirect member access: const { parent } = useIntlayer("key"); parent.child
|
|
14
|
+
* 4. Full chain access: const content = useIntlayer("key"); content.parent.child
|
|
15
|
+
*
|
|
16
|
+
* …and every compat form resolved by `collectMessageUsages`: translation
|
|
17
|
+
* calls (`t('parent.child')`), self calls (`formatMessage({ id })`), JSX
|
|
18
|
+
* message components and lingui tagged templates.
|
|
19
|
+
*
|
|
20
|
+
* `fieldPath` (optional 5th parameter) is the preferred input; when omitted
|
|
21
|
+
* the function derives the single-element path from `escapedField`, preserving
|
|
22
|
+
* backward compatibility.
|
|
23
|
+
*/
|
|
27
24
|
declare const findFieldRangesInFile: (text: string, escapedKey: string, _fieldName: string, escapedField: string, fieldPath?: string[]) => Range[];
|
|
28
25
|
//#endregion
|
|
29
26
|
export { escapeRegularExpression, findFieldRangesInFile, offsetToRange };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findFieldInFile.d.ts","names":[],"sources":["../../src/findFieldInFile.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"findFieldInFile.d.ts","names":[],"sources":["../../src/findFieldInFile.ts"],"mappings":";;cAGa,0BAA2B;cAG3B,gBACX,cACA,eACA,gBACC;;;;;;;;;;;;;;;;;;;;cAiCU,wBACX,cACA,oBACA,oBACA,sBACA,yBACC"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
//#region src/findKeyAtOffset.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Scan `text` for a
|
|
4
|
-
* `offset`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Handles
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* )
|
|
13
|
-
*
|
|
14
|
-
|
|
3
|
+
* Scan `text` for a caller whose namespace (dictionary key) is addressed at
|
|
4
|
+
* `offset`. Returns the namespace string when the cursor is on the caller
|
|
5
|
+
* name or on the namespace argument itself, `null` otherwise.
|
|
6
|
+
*
|
|
7
|
+
* Handles every registered caller with a positional or options-object
|
|
8
|
+
* namespace:
|
|
9
|
+
* useIntlayer("my-key") ← cursor on "my-key" or the callee
|
|
10
|
+
* useTranslations("namespace") ← idem
|
|
11
|
+
* getFixedT("en", "namespace") ← cursor on "namespace", not "en"
|
|
12
|
+
* useI18n({ namespace: "ns" }) ← cursor on "ns" or the callee
|
|
13
|
+
* getTranslations({ namespace: "ns" }) ← idem
|
|
14
|
+
*
|
|
15
|
+
* Self callers (`formatMessage`, lingui `t`/`_`) are message *usages*, not
|
|
16
|
+
* namespace declarations — they are resolved by `findMessageUsageAtOffset`.
|
|
17
|
+
*/
|
|
15
18
|
declare const findKeyAtOffset: (text: string, offset: number) => string | null;
|
|
16
19
|
//#endregion
|
|
17
20
|
export { findKeyAtOffset };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findKeyAtOffset.d.ts","names":[],"sources":["../../src/findKeyAtOffset.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"findKeyAtOffset.d.ts","names":[],"sources":["../../src/findKeyAtOffset.ts"],"mappings":";;;;;;;;;;;;;;;;;cAkBa,kBACX,cACA"}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
//#region src/findKeyInContentFile.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* If `offset` falls within a `key:` declaration in a content file,
|
|
4
|
-
* return the declared key string; otherwise return null.
|
|
5
|
-
* Handles
|
|
6
|
-
|
|
3
|
+
* If `offset` falls within a `key:` declaration in a content file,
|
|
4
|
+
* return the declared key string; otherwise return null.
|
|
5
|
+
* Handles:
|
|
6
|
+
* - Quoted values: key: "foo" | key: 'foo' | key: `foo` (TS/JS)
|
|
7
|
+
* - JSON values: "key": "foo" (JSON/JSON5/JSONC)
|
|
8
|
+
* - Bare values: key: foo-bar (YAML / Markdown frontmatter)
|
|
9
|
+
*/
|
|
7
10
|
declare const findKeyInContentFile: (text: string, offset: number) => string | null;
|
|
8
11
|
/**
|
|
9
|
-
* If `offset` falls on a content field property key inside an intlayer content
|
|
10
|
-
* file, return the dictionary key, the leaf field name, and the full field path
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
declare const findContentFieldAtOffset: (text: string, offset: number) => {
|
|
12
|
+
* If `offset` falls on a content field property key inside an intlayer content
|
|
13
|
+
* file, return the dictionary key, the leaf field name, and the full field path.
|
|
14
|
+
*
|
|
15
|
+
* The `fileExtension` parameter controls which parser is used:
|
|
16
|
+
*
|
|
17
|
+
* - `.json` / `.json5` / `.jsonc` → dedicated JSON parser
|
|
18
|
+
* - `.yaml` / `.yml` → YAML regex heuristic
|
|
19
|
+
* - `.md` / `.mdx` → always null (body is the content value)
|
|
20
|
+
* - everything else → Oxc AST (TS/JS/TSX/JSX)
|
|
21
|
+
*
|
|
22
|
+
* When `fileExtension` is omitted the function falls back to Oxc, then to
|
|
23
|
+
* JSON/YAML heuristics based on text shape.
|
|
24
|
+
*/
|
|
25
|
+
declare const findContentFieldAtOffset: (text: string, offset: number, fileExtension?: string) => FieldResult | null;
|
|
26
|
+
type FieldResult = {
|
|
25
27
|
dictionaryKey: string;
|
|
26
28
|
fieldName: string;
|
|
27
29
|
fieldPath: string[];
|
|
28
|
-
}
|
|
30
|
+
};
|
|
29
31
|
//#endregion
|
|
30
32
|
export { findContentFieldAtOffset, findKeyInContentFile };
|
|
31
33
|
//# sourceMappingURL=findKeyInContentFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findKeyInContentFile.d.ts","names":[],"sources":["../../src/findKeyInContentFile.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"findKeyInContentFile.d.ts","names":[],"sources":["../../src/findKeyInContentFile.ts"],"mappings":";;;;;;;;;cAea,uBACX,cACA;;;;;;;;;;;;;;;cA4BW,2BACX,cACA,gBACA,2BACC;KA0LE;EACH;EACA;EACA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/findTCallAtOffset.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Detect when the cursor is on a message usage carrying an explicit id: a
|
|
4
|
+
* `t('key')` call from any translator caller, a self call
|
|
5
|
+
* (`formatMessage({ id })`, `i18n._('id')`), a JSX message component or a
|
|
6
|
+
* lingui tagged template.
|
|
7
|
+
*
|
|
8
|
+
* Thin compatibility wrapper over `findMessageUsageAtOffset` — kept for the
|
|
9
|
+
* VS Code extension. `fieldName` is the dotted field path.
|
|
10
|
+
*
|
|
11
|
+
* Handles all assignment forms:
|
|
12
|
+
* const t = useTranslations('ns'); t('field')
|
|
13
|
+
* const { t } = useTranslation('ns'); t('field')
|
|
14
|
+
* const { t: translate } = useTranslation('ns'); translate('field')
|
|
15
|
+
* const t = await getFixedT('en', 'ns'); t('field')
|
|
16
|
+
* const { t } = useI18n({ namespace: 'ns' }); t('field')
|
|
17
|
+
*/
|
|
18
|
+
declare const findTCallAtOffset: (text: string, offset: number) => {
|
|
19
|
+
dictionaryKey: string;
|
|
20
|
+
fieldName: string;
|
|
21
|
+
} | null;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { findTCallAtOffset };
|
|
24
|
+
//# sourceMappingURL=findTCallAtOffset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findTCallAtOffset.d.ts","names":[],"sources":["../../src/findTCallAtOffset.ts"],"mappings":";;;;;;;;;;;;;;;;;cAkBa,oBACX,cACA;EACG;EAAuB"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
//#region src/findUsageFieldAtOffset.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Detect when the cursor is on a field name that was obtained from a
|
|
4
|
-
* useIntlayer / getIntlayer call in the same file.
|
|
5
|
-
*
|
|
6
|
-
* Pattern 1 — destructuring:
|
|
7
|
-
* const { localeSwitcherLabel } = useIntlayer("locale-switcher")
|
|
8
|
-
* ^^^^^^^^^^^^^^^^^^ ← cursor here
|
|
9
|
-
*
|
|
10
|
-
* Pattern 2 — member access:
|
|
11
|
-
* const t = useIntlayer("locale-switcher")
|
|
12
|
-
* t.localeSwitcherLabel ← cursor on the property
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
3
|
+
* Detect when the cursor is on a field name that was obtained from a
|
|
4
|
+
* useIntlayer / getIntlayer call in the same file. Two patterns:
|
|
5
|
+
*
|
|
6
|
+
* Pattern 1 — destructuring:
|
|
7
|
+
* const { localeSwitcherLabel } = useIntlayer("locale-switcher")
|
|
8
|
+
* ^^^^^^^^^^^^^^^^^^ ← cursor here
|
|
9
|
+
*
|
|
10
|
+
* Pattern 2 — member access:
|
|
11
|
+
* const t = useIntlayer("locale-switcher")
|
|
12
|
+
* t.localeSwitcherLabel ← cursor on the property
|
|
13
|
+
*
|
|
14
|
+
* Thin compatibility wrapper over `findMessageUsageAtOffset`.
|
|
15
|
+
* Returns { dictionaryKey, fieldName } when matched, null otherwise.
|
|
16
|
+
*/
|
|
16
17
|
declare const findUsageFieldAtOffset: (text: string, offset: number) => {
|
|
17
18
|
dictionaryKey: string;
|
|
18
19
|
fieldName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findUsageFieldAtOffset.d.ts","names":[],"sources":["../../src/findUsageFieldAtOffset.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"findUsageFieldAtOffset.d.ts","names":[],"sources":["../../src/findUsageFieldAtOffset.ts"],"mappings":";;;;;;;;;;;;;;;;cAiBa,yBACX,cACA;EACG;EAAuB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/types/oxcUtils.d.ts
CHANGED
|
@@ -1,24 +1,53 @@
|
|
|
1
1
|
//#region src/oxcUtils.d.ts
|
|
2
|
-
declare const INTLAYER_GETTERS: Set<string>;
|
|
3
2
|
type OxcNode = Record<string, unknown>;
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
4
|
+
* Parse `text` into an Oxc program AST.
|
|
5
|
+
* Returns null when the parse completely fails (e.g. unsupported syntax).
|
|
6
|
+
* Oxc is generally resilient to partial/in-progress edits and still returns a
|
|
7
|
+
* usable AST alongside error diagnostics, so this is rare.
|
|
8
|
+
*/
|
|
9
|
+
declare const parseText: (text: string) => OxcNode | null;
|
|
10
|
+
/**
|
|
11
|
+
* Depth-first walk of an Oxc AST. Visitor is called for every node that has
|
|
12
|
+
* a `type` property; returning `true` prunes that subtree.
|
|
13
|
+
*/
|
|
9
14
|
declare const walkAst: (node: unknown, visitor: (node: OxcNode) => boolean | void) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Build a child → parent reference map for upward traversal.
|
|
17
|
+
* Only AST-node-valued properties are followed; primitives are ignored.
|
|
18
|
+
*/
|
|
19
|
+
declare const buildParentMap: (root: OxcNode) => Map<OxcNode, OxcNode>;
|
|
20
|
+
/** Byte offset of the node's start. */
|
|
21
|
+
declare const nodeStart: (node: OxcNode) => number;
|
|
22
|
+
/** Byte offset of the node's end. */
|
|
23
|
+
declare const nodeEnd: (node: OxcNode) => number;
|
|
24
|
+
/** Returns `true` when `offset` falls inside the node's span (inclusive). */
|
|
25
|
+
declare const nodeContainsOffset: (node: OxcNode, offset: number) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Returns `true` for nodes that carry a static string value:
|
|
28
|
+
* Literal / StringLiteral, and no-substitution TemplateLiteral.
|
|
29
|
+
*/
|
|
30
|
+
declare const isStringLiteralNode: (node: OxcNode) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Extract the static string value from a literal node, or null when the node
|
|
33
|
+
* is not a static string.
|
|
34
|
+
*/
|
|
35
|
+
declare const getStaticStringValue: (node: OxcNode | undefined) => string | null;
|
|
36
|
+
/** Extract the string value from the Nth argument of a call expression. */
|
|
37
|
+
declare const getStringArgAt: (callNode: OxcNode, index: number) => string | null;
|
|
10
38
|
/** Extract the string value from the first argument of a call expression. */
|
|
11
39
|
declare const getFirstStringArg: (callExpressionNode: OxcNode) => string | null;
|
|
12
|
-
/** Returns true when `node` is a useIntlayer / getIntlayer CallExpression. */
|
|
13
|
-
declare const isIntlayerCall: (node: OxcNode) => boolean;
|
|
14
40
|
/**
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
* Find the property node named `propertyName` inside an ObjectExpression.
|
|
42
|
+
*/
|
|
43
|
+
declare const getObjectPropertyNode: (objectExpression: OxcNode | undefined, propertyName: string) => OxcNode | null;
|
|
44
|
+
/**
|
|
45
|
+
* Read a static string property from an ObjectExpression argument,
|
|
46
|
+
* e.g. the `namespace` of `useI18n({ namespace: 'about' })`.
|
|
47
|
+
*/
|
|
48
|
+
declare const getObjectPropertyString: (objectExpression: OxcNode | undefined, propertyName: string) => string | null;
|
|
49
|
+
/** Get the identifier or string name of an object-property key node. */
|
|
50
|
+
declare const getPropertyKeyName: (keyNode: OxcNode | undefined) => string | null;
|
|
22
51
|
//#endregion
|
|
23
|
-
export {
|
|
52
|
+
export { OxcNode, buildParentMap, getFirstStringArg, getObjectPropertyNode, getObjectPropertyString, getPropertyKeyName, getStaticStringValue, getStringArgAt, isStringLiteralNode, nodeContainsOffset, nodeEnd, nodeStart, parseText, walkAst };
|
|
24
53
|
//# sourceMappingURL=oxcUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxcUtils.d.ts","names":[],"sources":["../../src/oxcUtils.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"oxcUtils.d.ts","names":[],"sources":["../../src/oxcUtils.ts"],"mappings":";KAEY,UAAU;;;;;;;cAQT,YAAa,iBAAe;;;;;cAc5B,UACX,eAEA,UAAU,MAAM;;;;;cAyBL,iBAAkB,MAAM,YAAU,IAAI,SAAS;;cA4B/C,YAAa,MAAM;;cAMnB,UAAW,MAAM;;cAMjB,qBAAsB,MAAM,SAAS;;;;;cAOrC,sBAAuB,MAAM;;;;;cAkB7B,uBACX,MAAM;;cA8BK,iBACX,UAAU,SACV;;cAUW,oBAAqB,oBAAoB;;;;cAMzC,wBACX,kBAAkB,qBAClB,yBACC;;;;;cA4BU,0BACX,kBAAkB,qBAClB;;cAUW,qBACX,SAAS"}
|