knip 6.44.1 → 6.45.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 +23 -1033
- package/dist/ConfigurationChief.js +71 -15
- package/dist/DependencyDeputy.d.ts +10 -6
- package/dist/DependencyDeputy.js +51 -27
- package/dist/IssueCollector.d.ts +14 -11
- package/dist/IssueCollector.js +25 -20
- package/dist/IssueFixer.js +1 -1
- package/dist/PackagePeeker.d.ts +6 -0
- package/dist/PackagePeeker.js +43 -14
- package/dist/ProjectPrincipal.d.ts +6 -3
- package/dist/ProjectPrincipal.js +83 -32
- package/dist/WorkspaceWorker.d.ts +5 -1
- package/dist/WorkspaceWorker.js +39 -22
- package/dist/binaries/bash-parser.js +1 -7
- package/dist/binaries/command.d.ts +3 -3
- package/dist/binaries/command.js +6 -2
- package/dist/binaries/fallback.js +1 -1
- package/dist/binaries/plugins.d.ts +4 -1
- package/dist/binaries/plugins.js +66 -18
- package/dist/binaries/resolvers/bun.js +2 -2
- package/dist/binaries/resolvers/index.d.ts +1 -0
- package/dist/binaries/resolvers/index.js +2 -0
- package/dist/binaries/resolvers/npm.js +7 -5
- package/dist/binaries/resolvers/npx.js +15 -12
- package/dist/binaries/resolvers/nub.js +2 -2
- package/dist/binaries/resolvers/vp.d.ts +2 -0
- package/dist/binaries/resolvers/vp.js +52 -0
- package/dist/binaries/util.d.ts +13 -1
- package/dist/binaries/util.js +35 -1
- package/dist/cli.js +10 -84
- package/dist/compilers/scss.js +2 -1
- package/dist/configuration-hints.d.ts +16 -0
- package/dist/configuration-hints.js +64 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +37 -0
- package/dist/graph/SubpathReferences.d.ts +33 -0
- package/dist/graph/SubpathReferences.js +114 -0
- package/dist/graph/analyze.d.ts +4 -1
- package/dist/graph/analyze.js +16 -5
- package/dist/graph/build.d.ts +3 -1
- package/dist/graph/build.js +47 -23
- package/dist/graph-explorer/operations/resolve-export-origins.js +1 -1
- package/dist/plugins/angular/index.js +10 -17
- package/dist/plugins/aws-cdk/index.d.ts +3 -0
- package/dist/plugins/aws-cdk/index.js +32 -0
- package/dist/plugins/aws-cdk/types.d.ts +5 -0
- package/dist/plugins/aws-cdk/types.js +1 -0
- package/dist/plugins/babel/index.d.ts +1 -1
- package/dist/plugins/babel/index.js +25 -6
- package/dist/plugins/babel/types.d.ts +1 -0
- package/dist/plugins/bun/index.js +8 -7
- package/dist/plugins/c8/index.js +17 -4
- package/dist/plugins/changesets/index.js +3 -2
- package/dist/plugins/commitizen/index.js +6 -3
- package/dist/plugins/commitlint/index.js +10 -11
- package/dist/plugins/cypress/index.js +4 -2
- package/dist/plugins/danger/index.js +1 -1
- package/dist/plugins/docusaurus/helpers.js +6 -6
- package/dist/plugins/docusaurus/index.js +2 -2
- package/dist/plugins/electron-forge/index.js +2 -2
- package/dist/plugins/electron-vite/index.js +2 -2
- package/dist/plugins/eleventy/index.js +3 -2
- package/dist/plugins/eslint/helpers.js +4 -3
- package/dist/plugins/eslint/resolveFromAST.js +2 -2
- package/dist/plugins/evalite/index.d.ts +3 -0
- package/dist/plugins/evalite/index.js +26 -0
- package/dist/plugins/flue/index.js +2 -2
- package/dist/plugins/gatsby/index.js +1 -1
- package/dist/plugins/github-action/index.js +2 -2
- package/dist/plugins/github-actions/index.js +2 -2
- package/dist/plugins/graphql-codegen/index.js +13 -9
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/jest/index.js +5 -5
- package/dist/plugins/knex/index.js +2 -2
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/lunaria/index.js +5 -2
- package/dist/plugins/markdownlint/index.js +8 -2
- package/dist/plugins/marko/index.js +2 -2
- package/dist/plugins/marko/taglibs.d.ts +1 -1
- package/dist/plugins/marko/taglibs.js +4 -28
- package/dist/plugins/mdx/index.d.ts +2 -1
- package/dist/plugins/mdx/index.js +7 -4
- package/dist/plugins/mdxlint/index.js +18 -15
- package/dist/plugins/mikro-orm/index.d.ts +3 -0
- package/dist/plugins/mikro-orm/index.js +77 -0
- package/dist/plugins/mikro-orm/types.d.ts +21 -0
- package/dist/plugins/mikro-orm/types.js +1 -0
- package/dist/plugins/msw/index.js +6 -3
- package/dist/plugins/msw/types.d.ts +1 -1
- package/dist/plugins/netlify/index.js +7 -3
- package/dist/plugins/next/index.js +63 -9
- package/dist/plugins/next/types.d.ts +5 -0
- package/dist/plugins/next-mdx/resolveFromAST.js +15 -10
- package/dist/plugins/nitro/index.js +5 -6
- package/dist/plugins/node/index.js +4 -4
- package/dist/plugins/npm-package-json-lint/index.js +10 -3
- package/dist/plugins/nuxt/index.js +18 -10
- package/dist/plugins/nuxt/types.d.ts +4 -0
- package/dist/plugins/nx/index.js +6 -3
- package/dist/plugins/openclaw/index.js +11 -11
- package/dist/plugins/oxlint/index.js +2 -2
- package/dist/plugins/payload/index.js +1 -1
- package/dist/plugins/playwright/index.js +3 -3
- package/dist/plugins/pm2/index.js +7 -7
- package/dist/plugins/prettier/index.js +2 -1
- package/dist/plugins/prisma/index.js +2 -2
- package/dist/plugins/quasar/resolveFromAST.js +14 -9
- package/dist/plugins/react-router/index.js +12 -15
- package/dist/plugins/release-it/index.js +6 -2
- package/dist/plugins/remix/index.js +3 -3
- package/dist/plugins/retry-cli/index.d.ts +3 -0
- package/dist/plugins/retry-cli/index.js +14 -0
- package/dist/plugins/rollup/index.js +1 -4
- package/dist/plugins/rstest/index.js +3 -3
- package/dist/plugins/semantic-release/index.js +3 -3
- package/dist/plugins/serverless-framework/index.js +10 -8
- package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/stencil/resolveFromAST.js +5 -5
- package/dist/plugins/storybook/index.js +9 -3
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/stylelint/index.js +2 -2
- package/dist/plugins/swc/index.js +4 -3
- package/dist/plugins/tailwind/index.js +2 -2
- package/dist/plugins/tanstack-router/index.js +2 -2
- package/dist/plugins/ts-node/index.js +6 -1
- package/dist/plugins/turbo/index.js +3 -3
- package/dist/plugins/typedoc/index.js +2 -2
- package/dist/plugins/typescript/content-mappers.d.ts +1 -1
- package/dist/plugins/typescript/index.js +6 -9
- package/dist/plugins/unocss/index.js +3 -0
- package/dist/plugins/varlock/scan.js +1 -1
- package/dist/plugins/vite/helpers.d.ts +1 -0
- package/dist/plugins/vite/helpers.js +13 -3
- package/dist/plugins/vite/index.js +5 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vitest/index.js +26 -18
- package/dist/plugins/vitest/types.d.ts +1 -0
- package/dist/plugins/vue/index.js +1 -1
- package/dist/plugins/web-test-runner/index.d.ts +3 -0
- package/dist/plugins/web-test-runner/index.js +86 -0
- package/dist/plugins/wrangler/index.js +3 -3
- package/dist/plugins/yarn/index.js +5 -5
- package/dist/plugins.js +2 -5
- package/dist/reporters/github-actions.js +3 -7
- package/dist/reporters/json.d.ts +1 -0
- package/dist/reporters/json.js +1 -0
- package/dist/reporters/util/configuration-hints.d.ts +3 -1
- package/dist/reporters/util/configuration-hints.js +40 -21
- package/dist/reporters/util/util.d.ts +1 -1
- package/dist/run-cli.d.ts +2 -0
- package/dist/run-cli.js +82 -0
- package/dist/run.js +12 -0
- package/dist/session/incremental.d.ts +1 -0
- package/dist/session/incremental.js +1 -0
- package/dist/session/watch.js +2 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +5 -0
- package/dist/types/args.d.ts +3 -1
- package/dist/types/config.d.ts +17 -10
- package/dist/types/configuration.d.ts +45 -0
- package/dist/types/configuration.js +1 -0
- package/dist/types/issues.d.ts +4 -0
- package/dist/types/module-graph.d.ts +1 -0
- package/dist/types/options.d.ts +1 -0
- package/dist/types/package-json.d.ts +3 -8
- package/dist/types/workspace.d.ts +1 -0
- package/dist/typescript/get-imports-and-exports.js +18 -6
- package/dist/typescript/resolve-module-names.js +7 -45
- package/dist/typescript/visitors/calls.d.ts +1 -1
- package/dist/typescript/visitors/calls.js +14 -10
- package/dist/typescript/visitors/exports.js +16 -26
- package/dist/typescript/visitors/imports.d.ts +2 -1
- package/dist/typescript/visitors/imports.js +41 -24
- package/dist/typescript/visitors/members.d.ts +1 -1
- package/dist/typescript/visitors/members.js +38 -24
- package/dist/typescript/visitors/shadow.d.ts +2 -0
- package/dist/typescript/visitors/shadow.js +25 -0
- package/dist/typescript/visitors/walk.d.ts +20 -12
- package/dist/typescript/visitors/walk.js +78 -48
- package/dist/util/Performance.d.ts +25 -3
- package/dist/util/Performance.js +51 -27
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +5 -3
- package/dist/util/create-input-handler.js +138 -119
- package/dist/util/create-options.d.ts +4 -2071
- package/dist/util/create-options.js +6 -4
- package/dist/util/create-workspace-graph.js +2 -1
- package/dist/util/errors.d.ts +5 -2
- package/dist/util/errors.js +11 -18
- package/dist/util/fs.js +4 -2
- package/dist/util/input.d.ts +2 -2
- package/dist/util/input.js +2 -2
- package/dist/util/is-plugin-name.d.ts +2 -0
- package/dist/util/is-plugin-name.js +3 -0
- package/dist/util/jiti.d.ts +2 -1
- package/dist/util/jiti.js +11 -3
- package/dist/util/load-config.d.ts +1 -1
- package/dist/util/load-config.js +3 -2
- package/dist/util/loader.js +3 -2
- package/dist/util/map-workspaces.js +23 -1
- package/dist/util/module-graph.js +1 -0
- package/dist/util/modules.d.ts +2 -0
- package/dist/util/modules.js +78 -0
- package/dist/util/package-json.d.ts +12 -5
- package/dist/util/package-json.js +54 -26
- package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
- package/dist/util/parse-and-convert-gitignores.js +5 -5
- package/dist/util/parse-configuration.d.ts +2 -0
- package/dist/util/parse-configuration.js +66 -0
- package/dist/util/plugin.js +8 -12
- package/dist/util/resolve.d.ts +1 -0
- package/dist/util/resolve.js +3 -2
- package/dist/util/scripts.d.ts +0 -5
- package/dist/util/scripts.js +1 -32
- package/dist/util/to-source-path.d.ts +4 -1
- package/dist/util/to-source-path.js +2 -2
- package/dist/util/unhandled-rejection.d.ts +8 -0
- package/dist/util/unhandled-rejection.js +29 -0
- package/dist/util/validation.d.ts +11 -0
- package/dist/util/validation.js +68 -0
- package/dist/util/watch.d.ts +3 -1
- package/dist/util/watch.js +5 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -10
- package/schema.json +34 -0
- package/dist/schema/configuration.d.ts +0 -3103
- package/dist/schema/configuration.js +0 -94
- package/dist/schema/plugins.d.ts +0 -1019
- package/dist/schema/plugins.js +0 -215
package/dist/types/config.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { Program, VisitorObject } from 'oxc-parser';
|
|
2
2
|
import type { Word } from 'unbash';
|
|
3
|
-
import type { z } from 'zod/mini';
|
|
4
3
|
import type { Compiler, HasDependency, RawCompilers } from '../compilers/types.ts';
|
|
5
|
-
import type { knipConfigurationSchema, workspaceConfigurationSchema } from '../schema/configuration.ts';
|
|
6
|
-
import type { pluginSchema } from '../schema/plugins.ts';
|
|
7
4
|
import type { ParsedCLIArgs } from '../util/cli-arguments.ts';
|
|
8
5
|
import type { Input } from '../util/input.ts';
|
|
9
6
|
import type { Manifest } from '../util/package-json.ts';
|
|
10
7
|
import type { Args } from './args.ts';
|
|
8
|
+
import type { RawConfiguration } from './configuration.ts';
|
|
11
9
|
import type { IssueType, SymbolType } from './issues.ts';
|
|
12
10
|
import type { Tags } from './options.ts';
|
|
13
11
|
import type { PluginName } from './PluginNames.ts';
|
|
@@ -21,23 +19,28 @@ export interface GetInputsFromScriptsOptions extends BaseOptions {
|
|
|
21
19
|
}
|
|
22
20
|
export type GetInputsFromScripts<T = GetInputsFromScriptsOptions> = (npmScripts: string | string[] | Set<string>, options: T) => Input[];
|
|
23
21
|
export type GetInputsFromScriptsPartial = (npmScripts: string | string[] | Set<string>, options?: Partial<GetInputsFromScriptsOptions>) => Input[];
|
|
22
|
+
export interface ScriptCommand {
|
|
23
|
+
binary: string;
|
|
24
|
+
args: string[];
|
|
25
|
+
}
|
|
26
|
+
export type GetScriptCommands = (script: string, cwd?: string) => ScriptCommand[];
|
|
24
27
|
export type ScriptArg = string | Word;
|
|
25
28
|
export type FromArgs = (args: ScriptArg[], options?: Partial<GetInputsFromScriptsOptions>) => Input[];
|
|
26
29
|
export interface BinaryResolverOptions extends GetInputsFromScriptsOptions {
|
|
27
30
|
fromArgs: FromArgs;
|
|
28
31
|
}
|
|
29
32
|
export type BinaryResolver = (binary: string, words: Word[], options: BinaryResolverOptions) => Input[];
|
|
30
|
-
export type RawConfiguration
|
|
33
|
+
export type { RawConfiguration, RawPluginConfiguration, WorkspaceProjectConfig } from './configuration.ts';
|
|
31
34
|
export type RawConfigurationOrFn = RawConfiguration | ((options: ParsedCLIArgs) => RawConfiguration | Promise<RawConfiguration>);
|
|
32
|
-
export type RawPluginConfiguration = z.infer<typeof pluginSchema>;
|
|
33
|
-
export type WorkspaceProjectConfig = z.infer<typeof workspaceConfigurationSchema>;
|
|
34
35
|
export type IgnorePatterns = (string | RegExp)[];
|
|
35
36
|
type IgnorableExport = Exclude<SymbolType, 'unknown'>;
|
|
36
|
-
export type IgnoreExportsUsedInFile = boolean |
|
|
37
|
+
export type IgnoreExportsUsedInFile = boolean | {
|
|
38
|
+
[K in IgnorableExport]?: boolean | undefined;
|
|
39
|
+
};
|
|
37
40
|
export type IgnoreIssues = Record<string, IssueType[]>;
|
|
38
41
|
export type CyclesConfig = {
|
|
39
|
-
allow?: string[][];
|
|
40
|
-
dynamicImports?: boolean;
|
|
42
|
+
allow?: string[][] | undefined;
|
|
43
|
+
dynamicImports?: boolean | undefined;
|
|
41
44
|
};
|
|
42
45
|
export type GetImportsAndExportsOptions = {
|
|
43
46
|
skipTypeOnly: boolean;
|
|
@@ -59,6 +62,7 @@ export interface Configuration {
|
|
|
59
62
|
ignoreUnresolved: IgnorePatterns;
|
|
60
63
|
ignoreWorkspaces: string[];
|
|
61
64
|
isIncludeEntryExports: boolean;
|
|
65
|
+
isIncludeSubpathExports: boolean;
|
|
62
66
|
compilers: RawCompilers;
|
|
63
67
|
rootPluginConfigs: Partial<PluginsConfiguration>;
|
|
64
68
|
}
|
|
@@ -77,6 +81,7 @@ interface BaseWorkspaceConfiguration {
|
|
|
77
81
|
ignoreGlobalBinaries: boolean;
|
|
78
82
|
ignoreExportsUsedInFile: IgnoreExportsUsedInFile;
|
|
79
83
|
isIncludeEntryExports: boolean;
|
|
84
|
+
isIncludeSubpathExports: boolean;
|
|
80
85
|
}
|
|
81
86
|
type PluginConfiguration = EnsuredPluginConfiguration | boolean;
|
|
82
87
|
export type PluginsConfiguration = Record<PluginName, PluginConfiguration>;
|
|
@@ -94,6 +99,7 @@ type IsPluginEnabledOptions = {
|
|
|
94
99
|
manifest: Manifest;
|
|
95
100
|
dependencies: Set<string>;
|
|
96
101
|
config: WorkspaceConfiguration;
|
|
102
|
+
getScriptCommands: GetScriptCommands;
|
|
97
103
|
};
|
|
98
104
|
export type IsPluginEnabled = (options: IsPluginEnabledOptions) => boolean | Promise<boolean>;
|
|
99
105
|
export interface PluginOptions extends BaseOptions {
|
|
@@ -106,6 +112,7 @@ export interface PluginOptions extends BaseOptions {
|
|
|
106
112
|
isProduction: boolean;
|
|
107
113
|
enabledPlugins: string[];
|
|
108
114
|
getInputsFromScripts: GetInputsFromScriptsPartial;
|
|
115
|
+
getScriptCommands: GetScriptCommands;
|
|
109
116
|
}
|
|
110
117
|
type PluginSetup = () => Promise<void> | void;
|
|
111
118
|
export type IsLoadConfig = (options: PluginOptions, dependencies: Set<string>) => boolean;
|
|
@@ -134,6 +141,7 @@ export type ResolveFromAST = (program: Program, options: PluginOptions & {
|
|
|
134
141
|
}) => Input[];
|
|
135
142
|
type RegisterCompilersOptions = {
|
|
136
143
|
cwd: string;
|
|
144
|
+
dependencies: Set<string>;
|
|
137
145
|
hasDependency: HasDependency;
|
|
138
146
|
registerCompiler: RegisterCompiler;
|
|
139
147
|
};
|
|
@@ -185,4 +193,3 @@ export interface Plugin {
|
|
|
185
193
|
}
|
|
186
194
|
export type PluginMap = Record<PluginName, Plugin>;
|
|
187
195
|
export type Entries = [PluginName, Plugin][];
|
|
188
|
-
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Compiler } from '../compilers/types.ts';
|
|
2
|
+
import type { CyclesConfig, IgnoreExportsUsedInFile, IgnoreIssues, IgnorePatterns } from './config.ts';
|
|
3
|
+
import type { IssueType, Rules } from './issues.ts';
|
|
4
|
+
import type { PluginName } from './PluginNames.ts';
|
|
5
|
+
type Glob = string | string[];
|
|
6
|
+
export type RawPluginConfiguration = boolean | Glob | {
|
|
7
|
+
config?: Glob | undefined;
|
|
8
|
+
entry?: Glob | undefined;
|
|
9
|
+
project?: Glob | undefined;
|
|
10
|
+
};
|
|
11
|
+
type RawPluginsConfiguration = {
|
|
12
|
+
[K in PluginName]?: RawPluginConfiguration | undefined;
|
|
13
|
+
};
|
|
14
|
+
export interface RawConfiguration extends RawPluginsConfiguration {
|
|
15
|
+
$schema?: string | undefined;
|
|
16
|
+
rules?: Partial<Rules> | undefined;
|
|
17
|
+
entry?: Glob | undefined;
|
|
18
|
+
project?: Glob | undefined;
|
|
19
|
+
paths?: Record<string, string[]> | undefined;
|
|
20
|
+
ignore?: Glob | undefined;
|
|
21
|
+
ignoreFiles?: Glob | undefined;
|
|
22
|
+
ignoreBinaries?: IgnorePatterns | undefined;
|
|
23
|
+
ignoreGlobalBinaries?: boolean | undefined;
|
|
24
|
+
ignoreDependencies?: IgnorePatterns | undefined;
|
|
25
|
+
ignoreMembers?: IgnorePatterns | undefined;
|
|
26
|
+
ignoreUnresolved?: IgnorePatterns | undefined;
|
|
27
|
+
ignoreExportsUsedInFile?: IgnoreExportsUsedInFile | undefined;
|
|
28
|
+
ignoreIssues?: IgnoreIssues | undefined;
|
|
29
|
+
cycles?: CyclesConfig | undefined;
|
|
30
|
+
ignoreWorkspaces?: string[] | undefined;
|
|
31
|
+
includeEntryExports?: boolean | undefined;
|
|
32
|
+
includeSubpathExports?: boolean | undefined;
|
|
33
|
+
compilers?: Record<string, Compiler | true> | undefined;
|
|
34
|
+
asyncCompilers?: Record<string, Compiler> | undefined;
|
|
35
|
+
tags?: string[] | undefined;
|
|
36
|
+
treatConfigHintsAsErrors?: boolean | undefined;
|
|
37
|
+
treatTagHintsAsErrors?: boolean | undefined;
|
|
38
|
+
preprocessor?: Glob | undefined;
|
|
39
|
+
preprocessorOptions?: Record<string, unknown> | undefined;
|
|
40
|
+
include?: IssueType[] | undefined;
|
|
41
|
+
exclude?: IssueType[] | undefined;
|
|
42
|
+
workspaces?: Record<string, WorkspaceProjectConfig> | undefined;
|
|
43
|
+
}
|
|
44
|
+
export type WorkspaceProjectConfig = Pick<RawConfiguration, 'entry' | 'project' | 'paths' | 'ignore' | 'ignoreFiles' | 'ignoreBinaries' | 'ignoreGlobalBinaries' | 'ignoreDependencies' | 'ignoreMembers' | 'ignoreUnresolved' | 'ignoreExportsUsedInFile' | 'ignoreIssues' | 'includeEntryExports' | 'includeSubpathExports'> & RawPluginsConfiguration;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/issues.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface Issue {
|
|
|
28
28
|
export type IssueRecords = Record<string, Record<string, Issue>>;
|
|
29
29
|
export type Issues = {
|
|
30
30
|
files: IssueRecords;
|
|
31
|
+
subpaths: IssueRecords;
|
|
31
32
|
dependencies: IssueRecords;
|
|
32
33
|
devDependencies: IssueRecords;
|
|
33
34
|
optionalPeerDependencies: IssueRecords;
|
|
@@ -82,11 +83,14 @@ export type IssueSeverity = 'error' | 'warn' | 'off';
|
|
|
82
83
|
export type Rules = Record<IssueType, IssueSeverity>;
|
|
83
84
|
export type ConfigurationHints = Map<string, ConfigurationHint>;
|
|
84
85
|
export type ConfigurationHintType = 'ignore' | 'ignoreFiles' | 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreUnresolved' | 'workspaces' | 'ignoreWorkspaces' | 'entry-redundant' | 'project-redundant' | 'entry-top-level' | 'project-top-level' | 'entry-empty' | 'project-empty' | 'project-extension-unregistered' | 'project-extension-excluded' | 'package-entry' | 'top-level-unconfigured' | 'workspace-unconfigured';
|
|
86
|
+
export type UnusedIgnorePatternReason = 'no-issues' | 'gitignored' | 'no-matches';
|
|
85
87
|
export type ConfigurationHint = {
|
|
86
88
|
type: ConfigurationHintType;
|
|
87
89
|
identifier: string | RegExp;
|
|
88
90
|
filePath?: string;
|
|
89
91
|
workspaceName?: string;
|
|
92
|
+
configKey?: string;
|
|
93
|
+
reason?: UnusedIgnorePatternReason;
|
|
90
94
|
size?: number;
|
|
91
95
|
};
|
|
92
96
|
type TagHints = Set<TagHint>;
|
package/dist/types/options.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import type { PluginMap, WorkspaceConfiguration } from './config.ts';
|
|
2
|
-
type
|
|
3
|
-
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
4
|
-
type C = 'import' | 'require' | 'node' | 'node-addons' | 'deno' | 'browser' | 'electron' | 'react-native' | 'default';
|
|
5
|
-
type ExportCondition = LiteralUnion<C, string>;
|
|
6
|
-
type Exports = null | string | string[] | {
|
|
7
|
-
[key in ExportCondition]: Exports;
|
|
8
|
-
} | {
|
|
2
|
+
export type Exports = null | string | string[] | {
|
|
9
3
|
[key: string]: Exports;
|
|
10
4
|
};
|
|
11
5
|
type Imports = {
|
|
12
|
-
[key:
|
|
6
|
+
[key: string]: Exports;
|
|
13
7
|
};
|
|
14
8
|
type PackageJsonPath<T> = T extends {
|
|
15
9
|
packageJsonPath: infer P;
|
|
@@ -86,5 +80,6 @@ export type WorkspacePackage = {
|
|
|
86
80
|
manifest: PackageJson;
|
|
87
81
|
manifestPath: string;
|
|
88
82
|
manifestStr: string;
|
|
83
|
+
aliases: Map<string, string>;
|
|
89
84
|
};
|
|
90
85
|
export {};
|
|
@@ -19,6 +19,7 @@ type WorkspaceManifest = {
|
|
|
19
19
|
unusedIgnoreDependencies: Set<string | RegExp>;
|
|
20
20
|
unusedIgnoreBinaries: Set<string | RegExp>;
|
|
21
21
|
unusedIgnoreUnresolved: Set<string | RegExp>;
|
|
22
|
+
ignoreConfigKeys: Record<'ignoreDependencies' | 'ignoreBinaries' | 'ignoreUnresolved', Map<string | RegExp, string | undefined>>;
|
|
22
23
|
};
|
|
23
24
|
export type WorkspaceManifests = Map<string, WorkspaceManifest>;
|
|
24
25
|
export type HostDependencies = Map<string, Array<{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { isBuiltin } from 'node:module';
|
|
2
1
|
import { IMPORT_FLAGS, IMPORT_STAR, LOADER_DEFAULT, OPAQUE, PROTOCOL_VIRTUAL, SIDE_EFFECTS } from '../constants.js';
|
|
3
2
|
import { addNsValue, addValue, createImports } from '../util/module-graph.js';
|
|
4
|
-
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier, isStartsLikePackageName, sanitizeSpecifier, } from '../util/modules.js';
|
|
3
|
+
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier, getSubpathImport, isBuiltin, isStartsLikePackageName, sanitizeSpecifier, } from '../util/modules.js';
|
|
5
4
|
import { timerify } from '../util/Performance.js';
|
|
6
5
|
import { dirname, isInNodeModules, resolve } from '../util/path.js';
|
|
7
6
|
import { shouldIgnore } from '../util/tag.js';
|
|
@@ -20,6 +19,7 @@ const getImportsAndExports = (filePath, sourceText, resolveModule, options, igno
|
|
|
20
19
|
const programFiles = new Set();
|
|
21
20
|
const entryFiles = new Set();
|
|
22
21
|
const imports = new Set();
|
|
22
|
+
let subpathImports;
|
|
23
23
|
const exports = new Map();
|
|
24
24
|
const aliasedExports = new Map();
|
|
25
25
|
const specifierExportNames = new Set();
|
|
@@ -28,12 +28,12 @@ const getImportsAndExports = (filePath, sourceText, resolveModule, options, igno
|
|
|
28
28
|
const handledImportExpressions = new Set();
|
|
29
29
|
const caughtImportExpressions = new Set();
|
|
30
30
|
const importAliases = new Map();
|
|
31
|
-
const addImportAlias = (aliasName, id,
|
|
31
|
+
const addImportAlias = (aliasName, id, _import) => {
|
|
32
32
|
const aliases = importAliases.get(aliasName);
|
|
33
33
|
if (aliases)
|
|
34
|
-
aliases.add({ id,
|
|
34
|
+
aliases.add({ id, import: _import });
|
|
35
35
|
else
|
|
36
|
-
importAliases.set(aliasName, new Set([{ id,
|
|
36
|
+
importAliases.set(aliasName, new Set([{ id, import: _import }]));
|
|
37
37
|
};
|
|
38
38
|
const localImportMap = new Map();
|
|
39
39
|
let builtinImports;
|
|
@@ -119,6 +119,9 @@ const getImportsAndExports = (filePath, sourceText, resolveModule, options, igno
|
|
|
119
119
|
return _import;
|
|
120
120
|
}
|
|
121
121
|
const module = preResolvedModule ?? resolveModule(specifier, filePath);
|
|
122
|
+
const subpathImport = getSubpathImport(specifier);
|
|
123
|
+
if (subpathImport)
|
|
124
|
+
(subpathImports ??= new Set()).add(subpathImport);
|
|
122
125
|
if (modifiers & IMPORT_FLAGS.AUGMENT &&
|
|
123
126
|
(!module || module.isExternalLibraryImport || isInNodeModules(module.resolvedFileName))) {
|
|
124
127
|
return;
|
|
@@ -366,7 +369,16 @@ const getImportsAndExports = (filePath, sourceText, resolveModule, options, igno
|
|
|
366
369
|
}
|
|
367
370
|
return {
|
|
368
371
|
skipExports,
|
|
369
|
-
imports: {
|
|
372
|
+
imports: {
|
|
373
|
+
internal,
|
|
374
|
+
external,
|
|
375
|
+
externalRefs: new Set(),
|
|
376
|
+
programFiles,
|
|
377
|
+
entryFiles,
|
|
378
|
+
imports,
|
|
379
|
+
unresolved,
|
|
380
|
+
subpathImports,
|
|
381
|
+
},
|
|
370
382
|
exports,
|
|
371
383
|
duplicates: [...aliasedExports.values()],
|
|
372
384
|
scripts,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
-
import { isBuiltin } from 'node:module';
|
|
3
2
|
import { DEFAULT_EXTENSIONS, DTS_EXTENSIONS, IS_DTS } from '../constants.js';
|
|
4
3
|
import { isFile } from '../util/fs.js';
|
|
5
|
-
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier, sanitizeSpecifier } from '../util/modules.js';
|
|
4
|
+
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier, isBuiltin, sanitizeSpecifier, } from '../util/modules.js';
|
|
5
|
+
import { expandPackageTarget, getPackageTargetPaths, toPackagePath } from '../util/package-json.js';
|
|
6
6
|
import { timerify } from '../util/Performance.js';
|
|
7
7
|
import { dirname, extname, isAbsolute, isInNodeModules, join, toPosix } from '../util/path.js';
|
|
8
8
|
import { _createSyncModuleResolver, _resolveModuleSync, resolvePackageManifestPath } from '../util/resolve.js';
|
|
@@ -33,46 +33,6 @@ function pickStringTarget(value) {
|
|
|
33
33
|
return s;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const invalidSegments = /(^|\\|\/)((\.|%2e)(\.|%2e)?|node_modules)(\\|\/|$)/i;
|
|
37
|
-
const expandPackageTarget = (target, patternMatch) => {
|
|
38
|
-
if (!target?.startsWith('./') || invalidSegments.test(target.slice(2)))
|
|
39
|
-
return;
|
|
40
|
-
if (!target.includes('*'))
|
|
41
|
-
return target;
|
|
42
|
-
if (patternMatch === undefined || invalidSegments.test(patternMatch))
|
|
43
|
-
return;
|
|
44
|
-
return target.replaceAll('*', patternMatch);
|
|
45
|
-
};
|
|
46
|
-
const toPackagePath = (dir, target) => {
|
|
47
|
-
const candidate = join(dir, target);
|
|
48
|
-
return candidate.startsWith(`${dir}/`) ? candidate : undefined;
|
|
49
|
-
};
|
|
50
|
-
function pickExistingPackageTarget(value, dir, patternMatch, moduleExtensions) {
|
|
51
|
-
if (typeof value === 'string') {
|
|
52
|
-
const target = expandPackageTarget(value, patternMatch);
|
|
53
|
-
if (!target || IS_DTS.test(target) || !moduleExtensions.has(extname(target)))
|
|
54
|
-
return;
|
|
55
|
-
const candidate = toPackagePath(dir, target);
|
|
56
|
-
return candidate && isFile(candidate) ? candidate : undefined;
|
|
57
|
-
}
|
|
58
|
-
if (!value || typeof value !== 'object')
|
|
59
|
-
return;
|
|
60
|
-
if (Array.isArray(value)) {
|
|
61
|
-
for (const item of value) {
|
|
62
|
-
const target = pickExistingPackageTarget(item, dir, patternMatch, moduleExtensions);
|
|
63
|
-
if (target)
|
|
64
|
-
return target;
|
|
65
|
-
}
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
for (const [condition, child] of Object.entries(value)) {
|
|
69
|
-
if (condition === 'types')
|
|
70
|
-
continue;
|
|
71
|
-
const target = pickExistingPackageTarget(child, dir, patternMatch, moduleExtensions);
|
|
72
|
-
if (target)
|
|
73
|
-
return target;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
36
|
const moduleResolutionCaches = [];
|
|
77
37
|
export function clearModuleResolutionCaches() {
|
|
78
38
|
for (const cache of moduleResolutionCaches)
|
|
@@ -167,6 +127,7 @@ export function createCustomModuleResolver(compilerOptions, customCompilerExtens
|
|
|
167
127
|
}
|
|
168
128
|
return resolvedFileName;
|
|
169
129
|
}
|
|
130
|
+
const isModuleFile = (filePath) => !IS_DTS.test(filePath) && moduleExtensions.has(extname(filePath)) && isFile(filePath);
|
|
170
131
|
function toResult(specifier, containingFile, resolvedFileName) {
|
|
171
132
|
const mapped = toSourcePath(resolvedFileName);
|
|
172
133
|
const isExternalLibraryImport = mapped === resolvedFileName && isInNodeModules(resolvedFileName);
|
|
@@ -247,9 +208,10 @@ export function createCustomModuleResolver(compilerOptions, customCompilerExtens
|
|
|
247
208
|
if (sourcePath)
|
|
248
209
|
return toResult(specifier, containingFile, sourcePath);
|
|
249
210
|
}
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
211
|
+
for (const targetPath of getPackageTargetPaths(workspaceTarget.target, workspaceTarget.dir, workspaceTarget.patternMatch, false)) {
|
|
212
|
+
if (isModuleFile(targetPath))
|
|
213
|
+
return toResult(specifier, containingFile, targetPath);
|
|
214
|
+
}
|
|
253
215
|
}
|
|
254
216
|
const candidate = isAbsolute(specifier) ? specifier : join(dirname(containingFile), specifier);
|
|
255
217
|
if (existsSync(candidate)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CallExpression, NewExpression, VariableDeclarator } from 'oxc-parser';
|
|
2
|
-
import {
|
|
2
|
+
import type { WalkState } from './walk.ts';
|
|
3
3
|
export declare function trackCustomElementRegistry(node: VariableDeclarator, s: WalkState): void;
|
|
4
4
|
export declare function handleCallExpression(node: CallExpression, s: WalkState): void;
|
|
5
5
|
export declare function handleNewExpression(node: NewExpression, s: WalkState): void;
|
|
@@ -2,7 +2,7 @@ import { IMPORT_FLAGS, OPAQUE } from '../../constants.js';
|
|
|
2
2
|
import { addValue } from '../../util/module-graph.js';
|
|
3
3
|
import { isStartsLikePackageName } from '../../util/modules.js';
|
|
4
4
|
import { getSafeScriptFromArgs, getScriptFromArg, getStringValue, isStringLiteral } from '../ast-nodes.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isShadowedIn } from './shadow.js';
|
|
6
6
|
function getRegisteredCustomElement(node, s) {
|
|
7
7
|
const callee = node.callee;
|
|
8
8
|
if (callee.type !== 'MemberExpression' || callee.computed)
|
|
@@ -14,7 +14,7 @@ function getRegisteredCustomElement(node, s) {
|
|
|
14
14
|
if (object.type === 'Identifier') {
|
|
15
15
|
isRegistry =
|
|
16
16
|
(object.name === 'customElements' || s.customElementRegistries.has(object.name)) &&
|
|
17
|
-
!
|
|
17
|
+
!isShadowedIn(s, object.name, object.start);
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
20
|
isRegistry =
|
|
@@ -27,7 +27,7 @@ function getRegisteredCustomElement(node, s) {
|
|
|
27
27
|
return undefined;
|
|
28
28
|
const arg = node.arguments[1];
|
|
29
29
|
if (arg?.type === 'Identifier')
|
|
30
|
-
return
|
|
30
|
+
return isShadowedIn(s, arg.name, arg.start) ? undefined : arg.name;
|
|
31
31
|
if (arg?.type === 'ThisExpression' && s.staticBlockDepth > 0)
|
|
32
32
|
return s.classNameStack[s.classNameStack.length - 1] || undefined;
|
|
33
33
|
return undefined;
|
|
@@ -36,7 +36,7 @@ export function trackCustomElementRegistry(node, s) {
|
|
|
36
36
|
if (node.id.type !== 'Identifier' || !node.init)
|
|
37
37
|
return;
|
|
38
38
|
const init = node.init;
|
|
39
|
-
if ((init.type === 'Identifier' && init.name === 'customElements' && !
|
|
39
|
+
if ((init.type === 'Identifier' && init.name === 'customElements' && !isShadowedIn(s, 'customElements', init.start)) ||
|
|
40
40
|
(init.type === 'MemberExpression' &&
|
|
41
41
|
!init.computed &&
|
|
42
42
|
init.property.type === 'Identifier' &&
|
|
@@ -214,17 +214,21 @@ export function handleCallExpression(node, s) {
|
|
|
214
214
|
}
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
const markRefIfNs = (name) => {
|
|
217
|
+
const markRefIfNs = (name, pos) => {
|
|
218
218
|
const _import = s.localImportMap.get(name);
|
|
219
219
|
if (_import?.isNamespace) {
|
|
220
220
|
const internalImport = s.internal.get(_import.filePath);
|
|
221
|
-
if (internalImport)
|
|
221
|
+
if (!internalImport)
|
|
222
|
+
return;
|
|
223
|
+
if (!_import.isDynamicImport)
|
|
222
224
|
internalImport.refs.add(name);
|
|
225
|
+
else if (!isShadowedIn(s, name, pos))
|
|
226
|
+
addValue(internalImport.import, OPAQUE, s.filePath);
|
|
223
227
|
}
|
|
224
228
|
};
|
|
225
229
|
for (const arg of node.arguments) {
|
|
226
230
|
if (arg.type === 'Identifier')
|
|
227
|
-
markRefIfNs(arg.name);
|
|
231
|
+
markRefIfNs(arg.name, arg.start);
|
|
228
232
|
else if (arg.type === 'ArrowFunctionExpression' && arg.expression) {
|
|
229
233
|
const body = arg.body.type === 'AwaitExpression' ? arg.body.argument : arg.body;
|
|
230
234
|
if (body.type === 'ImportExpression' && isStringLiteral(body.source)) {
|
|
@@ -236,15 +240,15 @@ export function handleCallExpression(node, s) {
|
|
|
236
240
|
else if (arg.type === 'ArrayExpression') {
|
|
237
241
|
for (const el of arg.elements ?? []) {
|
|
238
242
|
if (el?.type === 'Identifier')
|
|
239
|
-
markRefIfNs(el.name);
|
|
243
|
+
markRefIfNs(el.name, el.start);
|
|
240
244
|
}
|
|
241
245
|
}
|
|
242
246
|
else if (arg.type === 'ObjectExpression') {
|
|
243
247
|
for (const prop of arg.properties ?? []) {
|
|
244
248
|
if (prop.type === 'Property' && !prop.computed && prop.value?.type === 'Identifier')
|
|
245
|
-
markRefIfNs(prop.value.name);
|
|
249
|
+
markRefIfNs(prop.value.name, prop.value.start);
|
|
246
250
|
if (prop.type === 'SpreadElement' && prop.argument?.type === 'Identifier')
|
|
247
|
-
markRefIfNs(prop.argument.name);
|
|
251
|
+
markRefIfNs(prop.argument.name, prop.argument.start);
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
254
|
}
|
|
@@ -44,24 +44,21 @@ export function handleExportNamed(node, s) {
|
|
|
44
44
|
for (const p of declarator.id.properties) {
|
|
45
45
|
if (p.type === 'RestElement' && p.argument?.type === 'Identifier') {
|
|
46
46
|
const name = p.argument.name;
|
|
47
|
-
|
|
48
|
-
s.addExport(name, SYMBOL_TYPE.UNKNOWN, p.argument.start, [], fix, false, s.getJSDocTags(exportStart));
|
|
47
|
+
s.addExport(name, SYMBOL_TYPE.UNKNOWN, p.argument.start, [], undefined, false, s.getJSDocTags(exportStart));
|
|
49
48
|
if (declarator.init)
|
|
50
49
|
s.collectRefsInType(declarator.init, name, false);
|
|
51
50
|
s.destructuredExports.add(name);
|
|
52
51
|
}
|
|
53
52
|
else if (p.value?.type === 'Identifier') {
|
|
54
53
|
const name = p.value.name;
|
|
55
|
-
|
|
56
|
-
s.addExport(name, SYMBOL_TYPE.UNKNOWN, p.value.start, [], fix, false, s.getJSDocTags(exportStart));
|
|
54
|
+
s.addExport(name, SYMBOL_TYPE.UNKNOWN, p.value.start, [], undefined, false, s.getJSDocTags(exportStart));
|
|
57
55
|
if (declarator.init)
|
|
58
56
|
s.collectRefsInType(declarator.init, name, false);
|
|
59
57
|
s.destructuredExports.add(name);
|
|
60
58
|
}
|
|
61
59
|
else if (p.value?.type === 'AssignmentPattern' && p.value.left?.type === 'Identifier') {
|
|
62
60
|
const name = p.value.left.name;
|
|
63
|
-
|
|
64
|
-
s.addExport(name, SYMBOL_TYPE.UNKNOWN, p.value.left.start, [], fix, false, s.getJSDocTags(exportStart));
|
|
61
|
+
s.addExport(name, SYMBOL_TYPE.UNKNOWN, p.value.left.start, [], undefined, false, s.getJSDocTags(exportStart));
|
|
65
62
|
if (declarator.init)
|
|
66
63
|
s.collectRefsInType(declarator.init, name, false);
|
|
67
64
|
s.destructuredExports.add(name);
|
|
@@ -71,15 +68,13 @@ export function handleExportNamed(node, s) {
|
|
|
71
68
|
else if (declarator.id.type === 'ArrayPattern') {
|
|
72
69
|
for (const el of declarator.id.elements) {
|
|
73
70
|
if (el?.type === 'Identifier') {
|
|
74
|
-
|
|
75
|
-
s.addExport(el.name, SYMBOL_TYPE.UNKNOWN, el.start, [], fix, false, s.getJSDocTags(exportStart));
|
|
71
|
+
s.addExport(el.name, SYMBOL_TYPE.UNKNOWN, el.start, [], undefined, false, s.getJSDocTags(exportStart));
|
|
76
72
|
if (declarator.init)
|
|
77
73
|
s.collectRefsInType(declarator.init, el.name, false);
|
|
78
74
|
s.destructuredExports.add(el.name);
|
|
79
75
|
}
|
|
80
76
|
else if (el?.type === 'RestElement' && el.argument?.type === 'Identifier') {
|
|
81
|
-
|
|
82
|
-
s.addExport(el.argument.name, SYMBOL_TYPE.UNKNOWN, el.argument.start, [], fix, false, s.getJSDocTags(exportStart));
|
|
77
|
+
s.addExport(el.argument.name, SYMBOL_TYPE.UNKNOWN, el.argument.start, [], undefined, false, s.getJSDocTags(exportStart));
|
|
83
78
|
if (declarator.init)
|
|
84
79
|
s.collectRefsInType(declarator.init, el.argument.name, false);
|
|
85
80
|
s.destructuredExports.add(el.argument.name);
|
|
@@ -275,7 +270,10 @@ export function handleExportDefault(node, s) {
|
|
|
275
270
|
if (_import) {
|
|
276
271
|
const internalImport = s.internal.get(_import.filePath);
|
|
277
272
|
if (internalImport) {
|
|
278
|
-
if (_import.
|
|
273
|
+
if (_import.isNamespace) {
|
|
274
|
+
addValue(internalImport.reExportNs, 'default', s.filePath);
|
|
275
|
+
}
|
|
276
|
+
else if (_import.importedName !== 'default') {
|
|
279
277
|
addNsValue(internalImport.reExportAs, _import.importedName, 'default', s.filePath);
|
|
280
278
|
}
|
|
281
279
|
else {
|
|
@@ -337,21 +335,12 @@ export function handleExpressionStatement(node, s) {
|
|
|
337
335
|
const left = expr.left;
|
|
338
336
|
if (left.type !== 'MemberExpression')
|
|
339
337
|
return;
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
s.addExport(name, SYMBOL_TYPE.UNKNOWN, left.property.start, [], fix, false, EMPTY_TAGS);
|
|
347
|
-
}
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
if (left.object.type === 'MemberExpression' &&
|
|
351
|
-
!left.object.computed &&
|
|
352
|
-
left.object.object.type === 'Identifier' &&
|
|
353
|
-
left.object.object.name === 'module' &&
|
|
354
|
-
left.object.property.name === 'exports') {
|
|
338
|
+
if ((left.object.type === 'Identifier' && left.object.name === 'exports') ||
|
|
339
|
+
(left.object.type === 'MemberExpression' &&
|
|
340
|
+
!left.object.computed &&
|
|
341
|
+
left.object.object.type === 'Identifier' &&
|
|
342
|
+
left.object.object.name === 'module' &&
|
|
343
|
+
left.object.property.name === 'exports')) {
|
|
355
344
|
let exportName;
|
|
356
345
|
if (!left.computed && left.property.type === 'Identifier') {
|
|
357
346
|
exportName = left.property.name;
|
|
@@ -377,6 +366,7 @@ export function handleExpressionStatement(node, s) {
|
|
|
377
366
|
if (memberName) {
|
|
378
367
|
const alias = exportName !== memberName ? exportName : undefined;
|
|
379
368
|
s.addImport(specifier, memberName, alias, undefined, right.object.arguments[0].start, IMPORT_FLAGS.RE_EXPORT);
|
|
369
|
+
s.handledImportExpressions.add(right.object.start);
|
|
380
370
|
isReExport = true;
|
|
381
371
|
}
|
|
382
372
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ArrayExpression, CallExpression, Expression, ImportExpression, VariableDeclarator } from 'oxc-parser';
|
|
2
2
|
import type { WalkState } from './walk.ts';
|
|
3
|
+
export declare function markDynamicNamespaceOpaque(name: string, pos: number, s: WalkState): void;
|
|
3
4
|
export declare function getPromiseAllElements(expression: Expression): ArrayExpression['elements'] | undefined;
|
|
4
|
-
export declare function handleVariableDeclarator(node: VariableDeclarator, s: WalkState): void;
|
|
5
|
+
export declare function handleVariableDeclarator(node: VariableDeclarator, isVar: boolean, s: WalkState): void;
|
|
5
6
|
export declare function handleImportThen(node: CallExpression, s: WalkState): void;
|
|
6
7
|
export declare function handleImportExpression(node: ImportExpression, s: WalkState): void;
|