knip 5.71.0 → 5.73.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/ConfigurationChief.d.ts +18 -0
- package/dist/ConsoleStreamer.js +1 -1
- package/dist/compilers/index.d.ts +30 -0
- package/dist/compilers/index.js +3 -0
- package/dist/compilers/scss.d.ts +6 -0
- package/dist/compilers/scss.js +14 -0
- package/dist/constants.js +1 -0
- package/dist/graph/analyze.js +19 -8
- package/dist/graph-explorer/explorer.d.ts +1 -1
- package/dist/graph-explorer/explorer.js +1 -1
- package/dist/graph-explorer/operations/{build-trace-tree.d.ts → build-exports-tree.d.ts} +4 -1
- package/dist/graph-explorer/operations/build-exports-tree.js +96 -0
- package/dist/graph-explorer/operations/is-referenced.js +4 -4
- package/dist/graph-explorer/utils.d.ts +1 -2
- package/dist/graph-explorer/utils.js +0 -15
- package/dist/graph-explorer/walk-down.d.ts +2 -1
- package/dist/graph-explorer/walk-down.js +7 -10
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.js +6 -0
- package/dist/plugins/next/index.js +3 -5
- package/dist/plugins/next/resolveFromAST.d.ts +0 -1
- package/dist/plugins/next/resolveFromAST.js +1 -42
- package/dist/plugins/next-intl/index.d.ts +3 -0
- package/dist/plugins/next-intl/index.js +12 -0
- package/dist/plugins/next-mdx/index.d.ts +3 -0
- package/dist/plugins/next-mdx/index.js +21 -0
- package/dist/plugins/next-mdx/resolveFromAST.d.ts +2 -0
- package/dist/plugins/next-mdx/resolveFromAST.js +43 -0
- package/dist/plugins/rsbuild/index.js +8 -0
- package/dist/plugins/rsbuild/types.d.ts +1 -0
- package/dist/plugins/storybook/index.js +12 -4
- package/dist/plugins/storybook/types.d.ts +5 -0
- package/dist/plugins/svgo/index.js +1 -1
- package/dist/plugins/svgr/index.d.ts +3 -0
- package/dist/plugins/svgr/index.js +24 -0
- package/dist/plugins/svgr/types.d.ts +3 -0
- package/dist/plugins/svgr/types.js +1 -0
- package/dist/plugins/vite/index.js +4 -0
- package/dist/plugins/vitest/index.js +1 -1
- package/dist/schema/configuration.d.ts +30 -0
- package/dist/schema/plugins.d.ts +15 -0
- package/dist/schema/plugins.js +3 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +3 -0
- package/dist/types/module-graph.d.ts +2 -3
- package/dist/typescript/ast-helpers.d.ts +1 -1
- package/dist/typescript/ast-helpers.js +0 -3
- package/dist/typescript/get-imports-and-exports.js +74 -11
- package/dist/typescript/resolve-module-names.js +5 -4
- package/dist/typescript/visitors/dynamic-imports/requireCall.js +2 -1
- package/dist/util/Performance.js +4 -2
- package/dist/util/create-options.d.ts +30 -0
- package/dist/util/create-options.js +7 -3
- package/dist/util/module-graph.js +0 -1
- package/dist/util/modules.js +8 -4
- package/dist/util/resolve.d.ts +3 -2
- package/dist/util/resolve.js +25 -2
- package/dist/util/trace.d.ts +2 -10
- package/dist/util/trace.js +42 -36
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -7
- package/schema.json +12 -0
- package/dist/graph-explorer/operations/build-trace-tree.js +0 -51
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'next-intl';
|
|
3
|
+
const enablers = ['next-intl'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const production = ['{src/,}i18n/request.{js,jsx,ts,tsx}'];
|
|
6
|
+
const plugin = {
|
|
7
|
+
title,
|
|
8
|
+
enablers,
|
|
9
|
+
isEnabled,
|
|
10
|
+
production,
|
|
11
|
+
};
|
|
12
|
+
export default plugin;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { toDependency, toProductionEntry } from '../../util/input.js';
|
|
2
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
3
|
+
import { getMdxPlugins } from './resolveFromAST.js';
|
|
4
|
+
const title = 'Next.js MDX';
|
|
5
|
+
const enablers = ['@next/mdx'];
|
|
6
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
|
+
const config = ['next.config.{js,ts,cjs,mjs}'];
|
|
8
|
+
const production = ['{src/,}mdx-components.{js,jsx,ts,tsx}'];
|
|
9
|
+
const resolveFromAST = sourceFile => {
|
|
10
|
+
const mdxPlugins = getMdxPlugins(sourceFile);
|
|
11
|
+
return [...production.map(id => toProductionEntry(id)), ...Array.from(mdxPlugins).map(id => toDependency(id))];
|
|
12
|
+
};
|
|
13
|
+
const plugin = {
|
|
14
|
+
title,
|
|
15
|
+
enablers,
|
|
16
|
+
isEnabled,
|
|
17
|
+
config,
|
|
18
|
+
production,
|
|
19
|
+
resolveFromAST,
|
|
20
|
+
};
|
|
21
|
+
export default plugin;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { getDefaultImportName, getImportMap, stripQuotes } from '../../typescript/ast-helpers.js';
|
|
3
|
+
const isNamedProp = (prop, name) => ts.isPropertyAssignment(prop) && prop.name.getText() === name;
|
|
4
|
+
export const getMdxPlugins = (sourceFile) => {
|
|
5
|
+
const plugins = new Set();
|
|
6
|
+
const importMap = getImportMap(sourceFile);
|
|
7
|
+
const mdxImportName = getDefaultImportName(importMap, '@next/mdx');
|
|
8
|
+
if (!mdxImportName)
|
|
9
|
+
return plugins;
|
|
10
|
+
function visit(node) {
|
|
11
|
+
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === mdxImportName) {
|
|
12
|
+
if (node.arguments.length > 0 && ts.isObjectLiteralExpression(node.arguments[0])) {
|
|
13
|
+
const options = node.arguments[0]?.properties.find(prop => isNamedProp(prop, 'options'));
|
|
14
|
+
if (options && ts.isPropertyAssignment(options)) {
|
|
15
|
+
if (ts.isObjectLiteralExpression(options.initializer)) {
|
|
16
|
+
for (const pluginType of ['remarkPlugins', 'rehypePlugins', 'recmaPlugins']) {
|
|
17
|
+
const props = options.initializer.properties.find(prop => isNamedProp(prop, pluginType));
|
|
18
|
+
if (props && ts.isPropertyAssignment(props)) {
|
|
19
|
+
if (ts.isArrayLiteralExpression(props.initializer)) {
|
|
20
|
+
for (const element of props.initializer.elements) {
|
|
21
|
+
if (ts.isStringLiteral(element)) {
|
|
22
|
+
plugins.add(stripQuotes(element.text));
|
|
23
|
+
}
|
|
24
|
+
else if (ts.isArrayLiteralExpression(element) && element.elements.length > 0) {
|
|
25
|
+
const firstElement = element.elements[0];
|
|
26
|
+
if (ts.isStringLiteral(firstElement)) {
|
|
27
|
+
plugins.add(stripQuotes(firstElement.text));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return ts.forEachChild(node, visit) ?? false;
|
|
40
|
+
}
|
|
41
|
+
visit(sourceFile);
|
|
42
|
+
return plugins;
|
|
43
|
+
};
|
|
@@ -23,6 +23,14 @@ const resolveConfig = async (config) => {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
if (source?.preEntry) {
|
|
27
|
+
const entry = source.preEntry;
|
|
28
|
+
if (typeof entry === 'string')
|
|
29
|
+
entries.add(entry);
|
|
30
|
+
else if (Array.isArray(entry))
|
|
31
|
+
for (const e of entry)
|
|
32
|
+
entries.add(e);
|
|
33
|
+
}
|
|
26
34
|
};
|
|
27
35
|
checkSource(config.source);
|
|
28
36
|
if (config.environments) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
1
|
+
import { toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
2
2
|
import { join, relative } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Storybook';
|
|
@@ -10,7 +10,7 @@ const restEntry = ['.{storybook,rnstorybook}/{manager,preview,index,vitest.setup
|
|
|
10
10
|
const entry = [...restEntry, ...stories];
|
|
11
11
|
const project = ['.{storybook,rnstorybook}/**/*.{js,jsx,ts,tsx,mts}'];
|
|
12
12
|
const resolveConfig = async (localConfig, options) => {
|
|
13
|
-
const { cwd, configFileDir } = options;
|
|
13
|
+
const { cwd, configFileDir, configFilePath } = options;
|
|
14
14
|
const strs = typeof localConfig?.stories === 'function' ? await localConfig.stories(stories) : localConfig?.stories;
|
|
15
15
|
const relativePatterns = strs?.map(pattern => {
|
|
16
16
|
if (typeof pattern === 'string')
|
|
@@ -29,13 +29,21 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
29
29
|
? [`@storybook/builder-${builder}`, `@storybook/manager-${builder}`]
|
|
30
30
|
: [builder]
|
|
31
31
|
: [];
|
|
32
|
-
const framework =
|
|
33
|
-
const
|
|
32
|
+
const framework = localConfig.framework;
|
|
33
|
+
const frameworkName = typeof framework === 'string' ? framework : framework?.name;
|
|
34
|
+
const frameworks = frameworkName ? [frameworkName] : [];
|
|
35
|
+
const viteConfigPath = typeof framework === 'object' &&
|
|
36
|
+
framework?.name === '@storybook/react-vite' &&
|
|
37
|
+
framework?.options?.builder?.viteConfigPath;
|
|
38
|
+
const configs = viteConfigPath
|
|
39
|
+
? [toConfig('vite', viteConfigPath, { dir: cwd, containingFilePath: configFilePath })]
|
|
40
|
+
: [];
|
|
34
41
|
return [
|
|
35
42
|
...patterns.map(id => toEntry(id)),
|
|
36
43
|
...addons.map(id => toDeferResolve(id)),
|
|
37
44
|
...builderPackages.map(id => toDependency(id)),
|
|
38
45
|
...frameworks.map(id => toDependency(id)),
|
|
46
|
+
...configs,
|
|
39
47
|
];
|
|
40
48
|
};
|
|
41
49
|
const plugin = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
2
|
const title = 'SVGO';
|
|
3
|
-
const enablers = ['svgo'];
|
|
3
|
+
const enablers = ['svgo', '@svgr/plugin-svgo'];
|
|
4
4
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
5
|
const entry = ['svgo.config.{js,cjs,mjs}'];
|
|
6
6
|
const plugin = {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { toDependency } from '../../util/input.js';
|
|
2
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
3
|
+
const title = 'SVGR';
|
|
4
|
+
const enablers = ['@svgr/cli', '@svgr/core'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['.svgrrc', '.svgrrc.{yaml,yml,json,js}', 'svgr.config.{js,cjs}', 'package.json'];
|
|
7
|
+
const resolveConfig = async (config) => {
|
|
8
|
+
const inputs = [];
|
|
9
|
+
if (config.plugins) {
|
|
10
|
+
for (const plugin of config.plugins) {
|
|
11
|
+
if (typeof plugin === 'string')
|
|
12
|
+
inputs.push(toDependency(plugin));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return inputs;
|
|
16
|
+
};
|
|
17
|
+
const plugin = {
|
|
18
|
+
title,
|
|
19
|
+
enablers,
|
|
20
|
+
isEnabled,
|
|
21
|
+
config,
|
|
22
|
+
resolveConfig,
|
|
23
|
+
};
|
|
24
|
+
export default plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,6 +10,9 @@ const resolveFromAST = (sourceFile) => {
|
|
|
10
10
|
const babelPlugins = getReactBabelPlugins(sourceFile);
|
|
11
11
|
return babelPlugins.map(plugin => toDependency(plugin));
|
|
12
12
|
};
|
|
13
|
+
const args = {
|
|
14
|
+
config: true,
|
|
15
|
+
};
|
|
13
16
|
const plugin = {
|
|
14
17
|
title,
|
|
15
18
|
enablers,
|
|
@@ -17,5 +20,6 @@ const plugin = {
|
|
|
17
20
|
config,
|
|
18
21
|
resolveConfig,
|
|
19
22
|
resolveFromAST,
|
|
23
|
+
args,
|
|
20
24
|
};
|
|
21
25
|
export default plugin;
|
|
@@ -13,7 +13,7 @@ const entry = ['**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)', ...mocks];
|
|
|
13
13
|
const isVitestCoverageCommand = /vitest(.+)--coverage(?:\.enabled(?:=true)?)?/;
|
|
14
14
|
const hasScriptWithCoverage = (scripts) => scripts ? Object.values(scripts).some(script => isVitestCoverageCommand.test(script)) : false;
|
|
15
15
|
const findConfigDependencies = (localConfig, options) => {
|
|
16
|
-
const { manifest,
|
|
16
|
+
const { manifest, configFileDir: dir } = options;
|
|
17
17
|
const testConfig = localConfig.test;
|
|
18
18
|
if (!testConfig)
|
|
19
19
|
return [];
|
|
@@ -277,6 +277,16 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
277
277
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
278
278
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
279
279
|
}, z.core.$strip>]>>;
|
|
280
|
+
'next-intl': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
281
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
282
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
283
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
284
|
+
}, z.core.$strip>]>>;
|
|
285
|
+
'next-mdx': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
286
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
287
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
288
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
289
|
+
}, z.core.$strip>]>>;
|
|
280
290
|
node: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
281
291
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
282
292
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -477,6 +487,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
477
487
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
478
488
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
479
489
|
}, z.core.$strip>]>>;
|
|
490
|
+
svgr: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
491
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
492
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
493
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
494
|
+
}, z.core.$strip>]>>;
|
|
480
495
|
syncpack: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
481
496
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
482
497
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -873,6 +888,16 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
873
888
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
874
889
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
875
890
|
}, z.core.$strip>]>>;
|
|
891
|
+
'next-intl': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
892
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
893
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
894
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
895
|
+
}, z.core.$strip>]>>;
|
|
896
|
+
'next-mdx': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
897
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
898
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
899
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
900
|
+
}, z.core.$strip>]>>;
|
|
876
901
|
node: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
877
902
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
878
903
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1073,6 +1098,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1073
1098
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1074
1099
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1075
1100
|
}, z.core.$strip>]>>;
|
|
1101
|
+
svgr: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1102
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1103
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1104
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1105
|
+
}, z.core.$strip>]>>;
|
|
1076
1106
|
syncpack: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1077
1107
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1078
1108
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -281,6 +281,16 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
281
281
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
282
282
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
283
283
|
}, z.core.$strip>]>;
|
|
284
|
+
'next-intl': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
285
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
286
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
287
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
288
|
+
}, z.core.$strip>]>;
|
|
289
|
+
'next-mdx': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
290
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
291
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
292
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
293
|
+
}, z.core.$strip>]>;
|
|
284
294
|
node: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
285
295
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
286
296
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -481,6 +491,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
481
491
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
482
492
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
483
493
|
}, z.core.$strip>]>;
|
|
494
|
+
svgr: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
495
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
496
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
497
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
498
|
+
}, z.core.$strip>]>;
|
|
484
499
|
syncpack: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
485
500
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
486
501
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -65,6 +65,8 @@ export const pluginsSchema = z.object({
|
|
|
65
65
|
nest: pluginSchema,
|
|
66
66
|
netlify: pluginSchema,
|
|
67
67
|
next: pluginSchema,
|
|
68
|
+
'next-intl': pluginSchema,
|
|
69
|
+
'next-mdx': pluginSchema,
|
|
68
70
|
node: pluginSchema,
|
|
69
71
|
'node-modules-inspector': pluginSchema,
|
|
70
72
|
nodemon: pluginSchema,
|
|
@@ -105,6 +107,7 @@ export const pluginsSchema = z.object({
|
|
|
105
107
|
stylelint: pluginSchema,
|
|
106
108
|
svelte: pluginSchema,
|
|
107
109
|
svgo: pluginSchema,
|
|
110
|
+
svgr: pluginSchema,
|
|
108
111
|
syncpack: pluginSchema,
|
|
109
112
|
tailwind: pluginSchema,
|
|
110
113
|
taskfile: pluginSchema,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
-
export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdx", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "taskfile", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'svgr' | 'syncpack' | 'tailwind' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
+
export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdx", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "next-intl", "next-mdx", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "svgr", "syncpack", "tailwind", "taskfile", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
|
@@ -54,6 +54,8 @@ export const pluginNames = [
|
|
|
54
54
|
'nest',
|
|
55
55
|
'netlify',
|
|
56
56
|
'next',
|
|
57
|
+
'next-intl',
|
|
58
|
+
'next-mdx',
|
|
57
59
|
'node',
|
|
58
60
|
'node-modules-inspector',
|
|
59
61
|
'nodemon',
|
|
@@ -94,6 +96,7 @@ export const pluginNames = [
|
|
|
94
96
|
'stylelint',
|
|
95
97
|
'svelte',
|
|
96
98
|
'svgo',
|
|
99
|
+
'svgr',
|
|
97
100
|
'syncpack',
|
|
98
101
|
'tailwind',
|
|
99
102
|
'taskfile',
|
|
@@ -35,7 +35,7 @@ export interface Export extends SourceLocation {
|
|
|
35
35
|
type: SymbolType;
|
|
36
36
|
members: ExportMember[];
|
|
37
37
|
jsDocTags: Tags;
|
|
38
|
-
|
|
38
|
+
self: [number, boolean];
|
|
39
39
|
fixes: Fixes;
|
|
40
40
|
symbol?: ts.Symbol;
|
|
41
41
|
isReExport?: boolean;
|
|
@@ -46,7 +46,7 @@ export type ExportMember = {
|
|
|
46
46
|
line: number;
|
|
47
47
|
col: number;
|
|
48
48
|
type: SymbolType;
|
|
49
|
-
|
|
49
|
+
self: [number, boolean];
|
|
50
50
|
fix: Fix;
|
|
51
51
|
symbol?: ts.Symbol;
|
|
52
52
|
jsDocTags: Tags;
|
|
@@ -66,7 +66,6 @@ export type FileNode = {
|
|
|
66
66
|
scripts: Set<string>;
|
|
67
67
|
imported?: ImportMaps;
|
|
68
68
|
internalImportCache?: ImportMap;
|
|
69
|
-
traceRefs: References;
|
|
70
69
|
};
|
|
71
70
|
export type ModuleGraph = Map<FilePath, FileNode>;
|
|
72
71
|
export {};
|
|
@@ -40,7 +40,7 @@ export declare const getLineAndCharacterOfPosition: (node: ts.Node, pos: number)
|
|
|
40
40
|
col: number;
|
|
41
41
|
pos: number;
|
|
42
42
|
};
|
|
43
|
-
export declare const getAccessMembers: (typeChecker: ts.TypeChecker, node: ts.
|
|
43
|
+
export declare const getAccessMembers: (typeChecker: ts.TypeChecker, node: ts.Node) => string[];
|
|
44
44
|
export declare const isDestructuring: (node: ts.Node) => boolean;
|
|
45
45
|
export declare const getDestructuredNames: (name: ts.ObjectBindingPattern) => [string[], boolean];
|
|
46
46
|
export declare const isConsiderReferencedNS: (node: ts.Identifier) => boolean;
|
|
@@ -198,13 +198,10 @@ export const getDestructuredNames = (name) => {
|
|
|
198
198
|
return [members, hasSpread];
|
|
199
199
|
};
|
|
200
200
|
export const isConsiderReferencedNS = (node) => ts.isPropertyAssignment(node.parent) ||
|
|
201
|
-
ts.isShorthandPropertyAssignment(node.parent) ||
|
|
202
201
|
(ts.isCallExpression(node.parent) && node.parent.arguments.includes(node)) ||
|
|
203
202
|
ts.isSpreadAssignment(node.parent) ||
|
|
204
203
|
ts.isArrayLiteralExpression(node.parent) ||
|
|
205
204
|
ts.isExportAssignment(node.parent) ||
|
|
206
|
-
ts.isConditionalExpression(node.parent) ||
|
|
207
|
-
(ts.isVariableDeclaration(node.parent) && node.parent.initializer === node) ||
|
|
208
205
|
ts.isTypeQueryNode(node.parent.parent);
|
|
209
206
|
export const isInOpaqueExpression = (node) => ts.isAwaitExpression(node.parent)
|
|
210
207
|
? isInOpaqueExpression(node.parent)
|
|
@@ -29,7 +29,7 @@ const createMember = (node, member, pos) => {
|
|
|
29
29
|
line: line + 1,
|
|
30
30
|
col: character + 1,
|
|
31
31
|
fix: member.fix,
|
|
32
|
-
|
|
32
|
+
self: [0, false],
|
|
33
33
|
jsDocTags: getJSDocTags(member.node),
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -42,19 +42,24 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
42
42
|
const exports = new Map();
|
|
43
43
|
const aliasedExports = new Map();
|
|
44
44
|
const scripts = new Set();
|
|
45
|
-
const traceRefs = new Set();
|
|
46
45
|
const importedInternalSymbols = new Map();
|
|
46
|
+
const importAliases = new Map();
|
|
47
|
+
const addImportAlias = (aliasName, id, filePath) => {
|
|
48
|
+
const aliases = importAliases.get(aliasName);
|
|
49
|
+
if (aliases)
|
|
50
|
+
aliases.add({ id, filePath });
|
|
51
|
+
else
|
|
52
|
+
importAliases.set(aliasName, new Set([{ id, filePath }]));
|
|
53
|
+
};
|
|
47
54
|
const referencedSymbolsInExport = new Set();
|
|
48
55
|
const visitors = getVisitors(sourceFile);
|
|
49
56
|
const addNsMemberRefs = (internalImport, namespace, member) => {
|
|
50
57
|
if (typeof member === 'string') {
|
|
51
58
|
internalImport.refs.add(`${namespace}.${member}`);
|
|
52
|
-
traceRefs.add(`${namespace}.${member}`);
|
|
53
59
|
}
|
|
54
60
|
else {
|
|
55
61
|
for (const m of member) {
|
|
56
62
|
internalImport.refs.add(`${namespace}.${m}`);
|
|
57
|
-
traceRefs.add(`${namespace}.${m}`);
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
};
|
|
@@ -231,7 +236,7 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
231
236
|
line: line + 1,
|
|
232
237
|
col: character + 1,
|
|
233
238
|
fixes: fix ? [fix] : [],
|
|
234
|
-
|
|
239
|
+
self: [0, false],
|
|
235
240
|
isReExport,
|
|
236
241
|
});
|
|
237
242
|
}
|
|
@@ -285,13 +290,25 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
285
290
|
if (ts.isIdentifier(node)) {
|
|
286
291
|
const id = String(node.escapedText);
|
|
287
292
|
const { symbol, filePath } = getImport(id, node);
|
|
293
|
+
if (importAliases.has(id) && isAccessExpression(node.parent)) {
|
|
294
|
+
const members = getAccessMembers(typeChecker, node);
|
|
295
|
+
for (const { id: aliasedId, filePath: aliasFilePath } of importAliases.get(id)) {
|
|
296
|
+
const aliasImports = internal.get(aliasFilePath);
|
|
297
|
+
if (aliasImports)
|
|
298
|
+
addNsMemberRefs(aliasImports, aliasedId, members);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
288
301
|
if (symbol) {
|
|
289
302
|
if (filePath) {
|
|
290
303
|
if (!isImportSpecifier(node)) {
|
|
291
304
|
const imports = internal.get(filePath);
|
|
292
305
|
if (imports) {
|
|
293
|
-
|
|
294
|
-
if (isAccessExpression(node.parent)) {
|
|
306
|
+
const isPropName = ts.isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
307
|
+
if (isPropName && isAccessExpression(node.parent.parent)) {
|
|
308
|
+
const members = getAccessMembers(typeChecker, node.parent);
|
|
309
|
+
addNsMemberRefs(imports, id, members);
|
|
310
|
+
}
|
|
311
|
+
else if (isAccessExpression(node.parent) && !isPropName) {
|
|
295
312
|
if (isDestructuring(node.parent)) {
|
|
296
313
|
if (ts.isPropertyAccessExpression(node.parent)) {
|
|
297
314
|
const ns = String(symbol.escapedName);
|
|
@@ -318,6 +335,25 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
318
335
|
else
|
|
319
336
|
addNsMemberRefs(imports, id, members);
|
|
320
337
|
}
|
|
338
|
+
else if (ts.isSpreadAssignment(node.parent)) {
|
|
339
|
+
const path = [];
|
|
340
|
+
let _node = node.parent;
|
|
341
|
+
while (_node && !ts.isVariableDeclaration(_node)) {
|
|
342
|
+
if (ts.isPropertyAssignment(_node) && ts.isIdentifier(_node.name))
|
|
343
|
+
path.unshift(_node.name.text);
|
|
344
|
+
_node = _node.parent;
|
|
345
|
+
}
|
|
346
|
+
if (_node && ts.isIdentifier(_node.name)) {
|
|
347
|
+
const varName = _node.name.text;
|
|
348
|
+
if (exports.has(varName)) {
|
|
349
|
+
addNsValue(imports.reExportedAs, id, [varName, ...path].join('.'), sourceFile.fileName);
|
|
350
|
+
}
|
|
351
|
+
else if (path.length === 0) {
|
|
352
|
+
addImportAlias(varName, id, filePath);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
imports.refs.add(id);
|
|
356
|
+
}
|
|
321
357
|
else {
|
|
322
358
|
const typeRef = getTypeRef(node);
|
|
323
359
|
if (typeRef) {
|
|
@@ -331,6 +367,34 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
331
367
|
imports.refs.add(id);
|
|
332
368
|
}
|
|
333
369
|
}
|
|
370
|
+
else if (ts.isVariableDeclaration(node.parent) &&
|
|
371
|
+
node.parent.initializer === node &&
|
|
372
|
+
ts.isIdentifier(node.parent.name)) {
|
|
373
|
+
const aliasName = node.parent.name.text;
|
|
374
|
+
if (exports.has(aliasName)) {
|
|
375
|
+
addNsValue(imports.reExportedAs, id, aliasName, sourceFile.fileName);
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
addImportAlias(aliasName, id, filePath);
|
|
379
|
+
imports.refs.add(id);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
else if (ts.isConditionalExpression(node.parent) || ts.isBinaryExpression(node.parent)) {
|
|
383
|
+
let _node = node.parent;
|
|
384
|
+
while (_node && !ts.isVariableDeclaration(_node))
|
|
385
|
+
_node = _node.parent;
|
|
386
|
+
if (_node && ts.isIdentifier(_node.name))
|
|
387
|
+
addImportAlias(_node.name.text, id, filePath);
|
|
388
|
+
imports.refs.add(id);
|
|
389
|
+
}
|
|
390
|
+
else if (ts.isShorthandPropertyAssignment(node.parent)) {
|
|
391
|
+
let _node = node.parent;
|
|
392
|
+
while (_node && !ts.isVariableDeclaration(_node))
|
|
393
|
+
_node = _node.parent;
|
|
394
|
+
if (_node && ts.isIdentifier(_node.name))
|
|
395
|
+
addImportAlias(`${_node.name.text}.${id}`, id, filePath);
|
|
396
|
+
imports.refs.add(id);
|
|
397
|
+
}
|
|
334
398
|
else if (imports.importedNs.has(id) && isConsiderReferencedNS(node)) {
|
|
335
399
|
imports.refs.add(id);
|
|
336
400
|
}
|
|
@@ -358,7 +422,7 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
358
422
|
addImport(node, sourceFile);
|
|
359
423
|
for (const item of exports.values()) {
|
|
360
424
|
if (!isType(item) && item.symbol && referencedSymbolsInExport.has(item.symbol)) {
|
|
361
|
-
item.
|
|
425
|
+
item.self = [1, true];
|
|
362
426
|
}
|
|
363
427
|
else {
|
|
364
428
|
const isBindingElement = item.symbol?.valueDeclaration && ts.isBindingElement(item.symbol.valueDeclaration);
|
|
@@ -367,11 +431,11 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
367
431
|
item.type !== 'unknown' &&
|
|
368
432
|
ignoreExportsUsedInFile[item.type]) ||
|
|
369
433
|
isBindingElement) {
|
|
370
|
-
item.
|
|
434
|
+
item.self = findInternalReferences(item, sourceFile, typeChecker, referencedSymbolsInExport, isBindingElement);
|
|
371
435
|
}
|
|
372
436
|
}
|
|
373
437
|
for (const member of item.members) {
|
|
374
|
-
member.
|
|
438
|
+
member.self = findInternalReferences(member, sourceFile, typeChecker, referencedSymbolsInExport);
|
|
375
439
|
member.symbol = undefined;
|
|
376
440
|
}
|
|
377
441
|
item.symbol = undefined;
|
|
@@ -381,7 +445,6 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
|
|
|
381
445
|
exports,
|
|
382
446
|
duplicates: [...aliasedExports.values()],
|
|
383
447
|
scripts,
|
|
384
|
-
traceRefs,
|
|
385
448
|
};
|
|
386
449
|
};
|
|
387
450
|
export const _getImportsAndExports = timerify(getImportsAndExports);
|