i18next-cli 1.63.1 → 1.64.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/README.md +5 -2
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/extractor/parsers/call-expression-handler.js +6 -13
- package/dist/cjs/extractor/utils/function-matcher.js +36 -0
- package/dist/cjs/linter.js +44 -13
- package/dist/cjs/rename-key.js +4 -0
- package/dist/esm/cli.js +1 -1
- package/dist/esm/extractor/parsers/call-expression-handler.js +6 -13
- package/dist/esm/extractor/utils/function-matcher.js +34 -0
- package/dist/esm/linter.js +44 -13
- package/dist/esm/rename-key.js +4 -0
- package/package.json +1 -1
- package/types/extractor/parsers/call-expression-handler.d.ts.map +1 -1
- package/types/extractor/utils/function-matcher.d.ts +24 -0
- package/types/extractor/utils/function-matcher.d.ts.map +1 -0
- package/types/linter.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -773,8 +773,11 @@ export default defineConfig({
|
|
|
773
773
|
mergeNamespaces: false,
|
|
774
774
|
|
|
775
775
|
// Translation functions to detect. Defaults to ['t', '*.t'].
|
|
776
|
-
// Supports
|
|
777
|
-
|
|
776
|
+
// Supports a leading wildcard to match any object (suffix match), e.g.
|
|
777
|
+
// '*.t' matches `i18n.t` / `this._i18n.t`, and a trailing wildcard to match
|
|
778
|
+
// any method on an object (prefix match), e.g. 'tProps.*' matches
|
|
779
|
+
// `tProps.label` / `tProps.title`.
|
|
780
|
+
functions: ['t', '*.t', 'i18next.t', 'tProps.*'],
|
|
778
781
|
|
|
779
782
|
// React components to analyze
|
|
780
783
|
transComponents: ['Trans', 'Translation'],
|
package/dist/cjs/cli.js
CHANGED
|
@@ -37,7 +37,7 @@ const program = new commander.Command();
|
|
|
37
37
|
program
|
|
38
38
|
.name('i18next-cli')
|
|
39
39
|
.description('A unified, high-performance i18next CLI.')
|
|
40
|
-
.version('1.
|
|
40
|
+
.version('1.64.0'); // This string is replaced with the actual version at build time by rollup
|
|
41
41
|
// new: global config override option
|
|
42
42
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
43
43
|
program
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var pluralRules = require('../../utils/plural-rules.js');
|
|
4
4
|
var nesting = require('../../utils/nesting.js');
|
|
5
5
|
var astUtils = require('./ast-utils.js');
|
|
6
|
+
var functionMatcher = require('../utils/function-matcher.js');
|
|
6
7
|
|
|
7
8
|
// Helper to escape regex characters
|
|
8
9
|
const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -72,19 +73,11 @@ class CallExpressionHandler {
|
|
|
72
73
|
let isFunctionToParse = scopeInfo !== undefined; // A scoped variable (from useTranslation, etc.) is always parsed.
|
|
73
74
|
if (!isFunctionToParse) {
|
|
74
75
|
for (const pattern of configuredFunctions) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// Handle exact match
|
|
84
|
-
if (pattern === functionName) {
|
|
85
|
-
isFunctionToParse = true;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
76
|
+
// Supports exact ('t', 'i18next.t'), prefix wildcards ('*.t' -> 'i18n.t')
|
|
77
|
+
// and suffix wildcards ('tProps.*' -> 'tProps.label').
|
|
78
|
+
if (functionMatcher.matchesFunctionPattern(functionName, pattern)) {
|
|
79
|
+
isFunctionToParse = true;
|
|
80
|
+
break;
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether a (possibly dotted) function name matches a configured
|
|
5
|
+
* `functions` pattern.
|
|
6
|
+
*
|
|
7
|
+
* Supported pattern forms:
|
|
8
|
+
* - Exact match: `'t'` matches `t`, `'i18next.t'` matches `i18next.t`.
|
|
9
|
+
* - Prefix wildcard: `'*.t'` matches any call ending in `.t`
|
|
10
|
+
* (e.g. `i18n.t`, `this._i18n.t`).
|
|
11
|
+
* - Suffix wildcard: `'tProps.*'` matches any single-segment member call on the
|
|
12
|
+
* prefix (e.g. `tProps.label`, `tProps.title`) but not deeper nesting like
|
|
13
|
+
* `tProps.label.t`.
|
|
14
|
+
*
|
|
15
|
+
* @param functionName - The dotted callee name (e.g. `tProps.label`).
|
|
16
|
+
* @param pattern - A single configured pattern from `extract.functions`.
|
|
17
|
+
*/
|
|
18
|
+
function matchesFunctionPattern(functionName, pattern) {
|
|
19
|
+
if (pattern === functionName)
|
|
20
|
+
return true;
|
|
21
|
+
// Prefix wildcard, e.g. '*.t' -> matches any callee ending in '.t'
|
|
22
|
+
if (pattern.startsWith('*.')) {
|
|
23
|
+
return functionName.endsWith(pattern.slice(1));
|
|
24
|
+
}
|
|
25
|
+
// Suffix wildcard, e.g. 'tProps.*' -> matches 'tProps.<segment>'
|
|
26
|
+
if (pattern.endsWith('.*')) {
|
|
27
|
+
const prefix = pattern.slice(0, -1); // keep the trailing dot: 'tProps.'
|
|
28
|
+
if (!functionName.startsWith(prefix))
|
|
29
|
+
return false;
|
|
30
|
+
const rest = functionName.slice(prefix.length);
|
|
31
|
+
return rest.length > 0 && !rest.includes('.');
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.matchesFunctionPattern = matchesFunctionPattern;
|
package/dist/cjs/linter.js
CHANGED
|
@@ -10,6 +10,7 @@ var logger = require('./utils/logger.js');
|
|
|
10
10
|
var wrapOra = require('./utils/wrap-ora.js');
|
|
11
11
|
var jsxAttributes = require('./utils/jsx-attributes.js');
|
|
12
12
|
var astUtils = require('./extractor/parsers/ast-utils.js');
|
|
13
|
+
var functionMatcher = require('./extractor/utils/function-matcher.js');
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Loads all translation values from the primary locale's JSON files and returns
|
|
@@ -141,28 +142,58 @@ function lintInterpolationParams(ast, code, config, translationValues) {
|
|
|
141
142
|
}
|
|
142
143
|
// Modularized CallExpression handler
|
|
143
144
|
function handleCallExpression(node, ancestors) {
|
|
145
|
+
// Build the full dotted callee name (e.g. 'i18n.t', 'tProps.label') as well as
|
|
146
|
+
// the bare last segment ('t', 'label') so both exact and wildcard patterns match.
|
|
144
147
|
let calleeName = '';
|
|
148
|
+
let fullCalleeName = '';
|
|
145
149
|
if (node.callee) {
|
|
146
|
-
if (node.callee.type === 'Identifier'
|
|
147
|
-
calleeName = node.callee.value;
|
|
150
|
+
if (node.callee.type === 'Identifier') {
|
|
151
|
+
calleeName = node.callee.value || node.callee.name || '';
|
|
152
|
+
fullCalleeName = calleeName;
|
|
148
153
|
}
|
|
149
|
-
else if (node.callee.type === '
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
else if (node.callee.type === 'MemberExpression') {
|
|
155
|
+
const parts = [];
|
|
156
|
+
let current = node.callee;
|
|
157
|
+
let computed = false;
|
|
158
|
+
while (current?.type === 'MemberExpression') {
|
|
159
|
+
if (current.property?.type === 'Identifier') {
|
|
160
|
+
parts.unshift(current.property.value || current.property.name);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
computed = true;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
current = current.object;
|
|
167
|
+
}
|
|
168
|
+
if (!computed) {
|
|
169
|
+
if (current?.type === 'ThisExpression') {
|
|
170
|
+
parts.unshift('this');
|
|
171
|
+
}
|
|
172
|
+
else if (current?.type === 'Identifier') {
|
|
173
|
+
parts.unshift(current.value || current.name);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
parts.length = 0;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (node.callee.property?.type === 'Identifier') {
|
|
180
|
+
calleeName = node.callee.property.value || node.callee.property.name;
|
|
181
|
+
}
|
|
182
|
+
fullCalleeName = parts.length ? parts.join('.') : calleeName;
|
|
154
183
|
}
|
|
155
184
|
}
|
|
156
185
|
const fnPatterns = config.extract.functions || ['t', '*.t'];
|
|
157
186
|
let matches = false;
|
|
158
187
|
for (const pattern of fnPatterns) {
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
|
|
188
|
+
if (functionMatcher.matchesFunctionPattern(fullCalleeName, pattern)) {
|
|
189
|
+
matches = true;
|
|
190
|
+
break;
|
|
162
191
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
192
|
+
// Backwards-compatible: '*.X' also matches a call whose last segment is X
|
|
193
|
+
// (covers computed member expressions where the full chain is unavailable).
|
|
194
|
+
if (pattern.startsWith('*.') && calleeName === pattern.slice(2)) {
|
|
195
|
+
matches = true;
|
|
196
|
+
break;
|
|
166
197
|
}
|
|
167
198
|
}
|
|
168
199
|
if (matches) {
|
package/dist/cjs/rename-key.js
CHANGED
|
@@ -297,6 +297,10 @@ function replaceKeyWithRegex(code, oldParts, newParts, config, namespaceKeyMap)
|
|
|
297
297
|
const suffix = fnPattern.slice(2);
|
|
298
298
|
return `\\b[\\w$]+\\.${escapeRegex(suffix)}`;
|
|
299
299
|
}
|
|
300
|
+
if (fnPattern.endsWith('.*')) {
|
|
301
|
+
const prefix = fnPattern.slice(0, -2);
|
|
302
|
+
return `\\b${escapeRegex(prefix)}\\.[\\w$]+`;
|
|
303
|
+
}
|
|
300
304
|
return `\\b${escapeRegex(fnPattern)}`;
|
|
301
305
|
};
|
|
302
306
|
// Helper: check whether the old key exists in a given namespace (from the prebuilt map)
|
package/dist/esm/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ const program = new Command();
|
|
|
31
31
|
program
|
|
32
32
|
.name('i18next-cli')
|
|
33
33
|
.description('A unified, high-performance i18next CLI.')
|
|
34
|
-
.version('1.
|
|
34
|
+
.version('1.64.0'); // This string is replaced with the actual version at build time by rollup
|
|
35
35
|
// new: global config override option
|
|
36
36
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
37
37
|
program
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { safePluralRules } from '../../utils/plural-rules.js';
|
|
2
2
|
import { parseNestedReferences } from '../../utils/nesting.js';
|
|
3
3
|
import { lineColumnFromOffset, isSimpleTemplateLiteral, getObjectPropValue, getObjectPropValueExpression } from './ast-utils.js';
|
|
4
|
+
import { matchesFunctionPattern } from '../utils/function-matcher.js';
|
|
4
5
|
|
|
5
6
|
// Helper to escape regex characters
|
|
6
7
|
const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -70,19 +71,11 @@ class CallExpressionHandler {
|
|
|
70
71
|
let isFunctionToParse = scopeInfo !== undefined; // A scoped variable (from useTranslation, etc.) is always parsed.
|
|
71
72
|
if (!isFunctionToParse) {
|
|
72
73
|
for (const pattern of configuredFunctions) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
// Handle exact match
|
|
82
|
-
if (pattern === functionName) {
|
|
83
|
-
isFunctionToParse = true;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
74
|
+
// Supports exact ('t', 'i18next.t'), prefix wildcards ('*.t' -> 'i18n.t')
|
|
75
|
+
// and suffix wildcards ('tProps.*' -> 'tProps.label').
|
|
76
|
+
if (matchesFunctionPattern(functionName, pattern)) {
|
|
77
|
+
isFunctionToParse = true;
|
|
78
|
+
break;
|
|
86
79
|
}
|
|
87
80
|
}
|
|
88
81
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a (possibly dotted) function name matches a configured
|
|
3
|
+
* `functions` pattern.
|
|
4
|
+
*
|
|
5
|
+
* Supported pattern forms:
|
|
6
|
+
* - Exact match: `'t'` matches `t`, `'i18next.t'` matches `i18next.t`.
|
|
7
|
+
* - Prefix wildcard: `'*.t'` matches any call ending in `.t`
|
|
8
|
+
* (e.g. `i18n.t`, `this._i18n.t`).
|
|
9
|
+
* - Suffix wildcard: `'tProps.*'` matches any single-segment member call on the
|
|
10
|
+
* prefix (e.g. `tProps.label`, `tProps.title`) but not deeper nesting like
|
|
11
|
+
* `tProps.label.t`.
|
|
12
|
+
*
|
|
13
|
+
* @param functionName - The dotted callee name (e.g. `tProps.label`).
|
|
14
|
+
* @param pattern - A single configured pattern from `extract.functions`.
|
|
15
|
+
*/
|
|
16
|
+
function matchesFunctionPattern(functionName, pattern) {
|
|
17
|
+
if (pattern === functionName)
|
|
18
|
+
return true;
|
|
19
|
+
// Prefix wildcard, e.g. '*.t' -> matches any callee ending in '.t'
|
|
20
|
+
if (pattern.startsWith('*.')) {
|
|
21
|
+
return functionName.endsWith(pattern.slice(1));
|
|
22
|
+
}
|
|
23
|
+
// Suffix wildcard, e.g. 'tProps.*' -> matches 'tProps.<segment>'
|
|
24
|
+
if (pattern.endsWith('.*')) {
|
|
25
|
+
const prefix = pattern.slice(0, -1); // keep the trailing dot: 'tProps.'
|
|
26
|
+
if (!functionName.startsWith(prefix))
|
|
27
|
+
return false;
|
|
28
|
+
const rest = functionName.slice(prefix.length);
|
|
29
|
+
return rest.length > 0 && !rest.includes('.');
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { matchesFunctionPattern };
|
package/dist/esm/linter.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ConsoleLogger } from './utils/logger.js';
|
|
|
8
8
|
import { createSpinnerLike } from './utils/wrap-ora.js';
|
|
9
9
|
import { acceptedTags, translatableAttributes, ignoredTags, ignoredAttributeLowerSet } from './utils/jsx-attributes.js';
|
|
10
10
|
import { findFirstTokenIndex, normalizeASTSpans, buildByteToCharMap, convertSpansToCharIndices, collectIgnoredLineRanges } from './extractor/parsers/ast-utils.js';
|
|
11
|
+
import { matchesFunctionPattern } from './extractor/utils/function-matcher.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Loads all translation values from the primary locale's JSON files and returns
|
|
@@ -139,28 +140,58 @@ function lintInterpolationParams(ast, code, config, translationValues) {
|
|
|
139
140
|
}
|
|
140
141
|
// Modularized CallExpression handler
|
|
141
142
|
function handleCallExpression(node, ancestors) {
|
|
143
|
+
// Build the full dotted callee name (e.g. 'i18n.t', 'tProps.label') as well as
|
|
144
|
+
// the bare last segment ('t', 'label') so both exact and wildcard patterns match.
|
|
142
145
|
let calleeName = '';
|
|
146
|
+
let fullCalleeName = '';
|
|
143
147
|
if (node.callee) {
|
|
144
|
-
if (node.callee.type === 'Identifier'
|
|
145
|
-
calleeName = node.callee.value;
|
|
148
|
+
if (node.callee.type === 'Identifier') {
|
|
149
|
+
calleeName = node.callee.value || node.callee.name || '';
|
|
150
|
+
fullCalleeName = calleeName;
|
|
146
151
|
}
|
|
147
|
-
else if (node.callee.type === '
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
else if (node.callee.type === 'MemberExpression') {
|
|
153
|
+
const parts = [];
|
|
154
|
+
let current = node.callee;
|
|
155
|
+
let computed = false;
|
|
156
|
+
while (current?.type === 'MemberExpression') {
|
|
157
|
+
if (current.property?.type === 'Identifier') {
|
|
158
|
+
parts.unshift(current.property.value || current.property.name);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
computed = true;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
current = current.object;
|
|
165
|
+
}
|
|
166
|
+
if (!computed) {
|
|
167
|
+
if (current?.type === 'ThisExpression') {
|
|
168
|
+
parts.unshift('this');
|
|
169
|
+
}
|
|
170
|
+
else if (current?.type === 'Identifier') {
|
|
171
|
+
parts.unshift(current.value || current.name);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
parts.length = 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (node.callee.property?.type === 'Identifier') {
|
|
178
|
+
calleeName = node.callee.property.value || node.callee.property.name;
|
|
179
|
+
}
|
|
180
|
+
fullCalleeName = parts.length ? parts.join('.') : calleeName;
|
|
152
181
|
}
|
|
153
182
|
}
|
|
154
183
|
const fnPatterns = config.extract.functions || ['t', '*.t'];
|
|
155
184
|
let matches = false;
|
|
156
185
|
for (const pattern of fnPatterns) {
|
|
157
|
-
if (pattern
|
|
158
|
-
|
|
159
|
-
|
|
186
|
+
if (matchesFunctionPattern(fullCalleeName, pattern)) {
|
|
187
|
+
matches = true;
|
|
188
|
+
break;
|
|
160
189
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
190
|
+
// Backwards-compatible: '*.X' also matches a call whose last segment is X
|
|
191
|
+
// (covers computed member expressions where the full chain is unavailable).
|
|
192
|
+
if (pattern.startsWith('*.') && calleeName === pattern.slice(2)) {
|
|
193
|
+
matches = true;
|
|
194
|
+
break;
|
|
164
195
|
}
|
|
165
196
|
}
|
|
166
197
|
if (matches) {
|
package/dist/esm/rename-key.js
CHANGED
|
@@ -295,6 +295,10 @@ function replaceKeyWithRegex(code, oldParts, newParts, config, namespaceKeyMap)
|
|
|
295
295
|
const suffix = fnPattern.slice(2);
|
|
296
296
|
return `\\b[\\w$]+\\.${escapeRegex(suffix)}`;
|
|
297
297
|
}
|
|
298
|
+
if (fnPattern.endsWith('.*')) {
|
|
299
|
+
const prefix = fnPattern.slice(0, -2);
|
|
300
|
+
return `\\b${escapeRegex(prefix)}\\.[\\w$]+`;
|
|
301
|
+
}
|
|
298
302
|
return `\\b${escapeRegex(fnPattern)}`;
|
|
299
303
|
};
|
|
300
304
|
// Helper: check whether the old key exists in a given namespace (from the prebuilt map)
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-expression-handler.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/call-expression-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA6C,MAAM,WAAW,CAAA;AAC1F,OAAO,KAAK,EAA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EhC;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;IAsDpC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,sBAAsB;IA2B9B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;;;;;;;OAQG;IACH,OAAO,CAAC,iCAAiC;IAwFzC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,gBAAgB;IAyMxB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;CA2BxB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a (possibly dotted) function name matches a configured
|
|
3
|
+
* `functions` pattern.
|
|
4
|
+
*
|
|
5
|
+
* Supported pattern forms:
|
|
6
|
+
* - Exact match: `'t'` matches `t`, `'i18next.t'` matches `i18next.t`.
|
|
7
|
+
* - Prefix wildcard: `'*.t'` matches any call ending in `.t`
|
|
8
|
+
* (e.g. `i18n.t`, `this._i18n.t`).
|
|
9
|
+
* - Suffix wildcard: `'tProps.*'` matches any single-segment member call on the
|
|
10
|
+
* prefix (e.g. `tProps.label`, `tProps.title`) but not deeper nesting like
|
|
11
|
+
* `tProps.label.t`.
|
|
12
|
+
*
|
|
13
|
+
* @param functionName - The dotted callee name (e.g. `tProps.label`).
|
|
14
|
+
* @param pattern - A single configured pattern from `extract.functions`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function matchesFunctionPattern(functionName: string, pattern: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Checks whether a function name matches any of the configured patterns.
|
|
19
|
+
*
|
|
20
|
+
* @param functionName - The dotted callee name (e.g. `tProps.label`).
|
|
21
|
+
* @param patterns - The configured `extract.functions` patterns.
|
|
22
|
+
*/
|
|
23
|
+
export declare function matchesAnyFunctionPattern(functionName: string, patterns: string[]): boolean;
|
|
24
|
+
//# sourceMappingURL=function-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-matcher.d.ts","sourceRoot":"","sources":["../../../src/extractor/utils/function-matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAiBtF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAK5F"}
|
package/types/linter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../src/linter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../src/linter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,SAAS,EAA6B,MAAM,YAAY,CAAA;AA8SpG,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE;QAAC;YACT,OAAO,EAAE,MAAM,CAAC;SACjB;KAAC,CAAC;IACH,IAAI,EAAE;QAAC;YACL,OAAO,EAAE,OAAO,CAAC;YACjB,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;SACpC;KAAC,CAAC;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;CACvB,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAAiD,CAAA;AAC7F,eAAO,MAAM,6BAA6B,EAAE,MAAM,EAAqD,CAAA;AAKvG,qBAAa,MAAO,SAAQ,YAAY,CAAC,cAAc,CAAC;IACtD,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,MAAM,CAAQ;gBAET,MAAM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