knip 6.14.2 → 6.16.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/CacheConsultant.d.ts +1 -0
- package/dist/CacheConsultant.js +2 -0
- package/dist/ConfigurationChief.d.ts +32 -0
- package/dist/ConfigurationChief.js +9 -11
- package/dist/DependencyDeputy.d.ts +0 -4
- package/dist/DependencyDeputy.js +4 -16
- package/dist/IssueCollector.d.ts +1 -0
- package/dist/IssueCollector.js +10 -20
- package/dist/IssueFixer.js +10 -15
- package/dist/ProjectPrincipal.d.ts +2 -3
- package/dist/ProjectPrincipal.js +13 -21
- package/dist/WorkspaceWorker.js +6 -1
- package/dist/binaries/fallback.js +1 -1
- package/dist/binaries/plugins.js +1 -1
- package/dist/binaries/resolvers/bun.js +1 -1
- package/dist/binaries/resolvers/bunx.js +1 -1
- package/dist/binaries/resolvers/npm.js +1 -1
- package/dist/binaries/resolvers/npx.js +1 -1
- package/dist/binaries/resolvers/pnpm.js +1 -1
- package/dist/binaries/resolvers/pnpx.js +1 -1
- package/dist/binaries/resolvers/yarn.js +1 -1
- package/dist/binaries/util.d.ts +1 -2
- package/dist/binaries/util.js +1 -1
- package/dist/cli.js +3 -1
- package/dist/compilers/compilers.d.ts +3 -0
- package/dist/compilers/compilers.js +9 -13
- package/dist/compilers/index.d.ts +52 -0
- package/dist/compilers/scss.js +9 -3
- package/dist/graph/analyze.js +15 -8
- package/dist/graph/build.js +3 -5
- package/dist/manifest/index.js +11 -14
- package/dist/plugins/_custom-elements/custom-element-visitor.d.ts +7 -0
- package/dist/plugins/_custom-elements/custom-element-visitor.js +106 -0
- package/dist/plugins/bun/index.js +1 -1
- package/dist/plugins/catalyst/index.d.ts +3 -0
- package/dist/plugins/catalyst/index.js +16 -0
- package/dist/plugins/execa/visitors/execa.js +4 -17
- package/dist/plugins/fast/index.d.ts +3 -0
- package/dist/plugins/fast/index.js +16 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/lit/index.d.ts +3 -0
- package/dist/plugins/lit/index.js +25 -0
- package/dist/plugins/nano-spawn/index.d.ts +3 -0
- package/dist/plugins/nano-spawn/index.js +15 -0
- package/dist/plugins/nano-spawn/visitors/nano-spawn.d.ts +2 -0
- package/dist/plugins/nano-spawn/visitors/nano-spawn.js +12 -0
- package/dist/plugins/orval/index.d.ts +3 -0
- package/dist/plugins/orval/index.js +16 -0
- package/dist/plugins/orval/resolveFromAST.d.ts +2 -0
- package/dist/plugins/orval/resolveFromAST.js +11 -0
- package/dist/plugins/orval/types.d.ts +9 -0
- package/dist/plugins/orval/types.js +1 -0
- package/dist/plugins/relay/index.js +1 -1
- package/dist/plugins/stencil/index.js +17 -1
- package/dist/plugins/sveltejs-package/helpers.js +1 -1
- package/dist/plugins/vite/helpers.js +23 -6
- package/dist/plugins/webdriver-io/index.js +3 -3
- package/dist/plugins/webdriver-io/types.d.ts +5 -1
- package/dist/reporters/github-actions.d.ts +1 -1
- package/dist/reporters/github-actions.js +19 -1
- package/dist/reporters/index.d.ts +1 -1
- package/dist/reporters/symbols.js +2 -1
- package/dist/reporters/trace.d.ts +3 -1
- package/dist/reporters/trace.js +48 -16
- package/dist/reporters/util/configuration-hints.d.ts +1 -1
- package/dist/reporters/util/configuration-hints.js +3 -2
- package/dist/schema/configuration.d.ts +83 -1
- package/dist/schema/configuration.js +2 -0
- package/dist/schema/plugins.d.ts +25 -0
- package/dist/schema/plugins.js +5 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +5 -0
- package/dist/types/args.d.ts +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/issues.d.ts +1 -0
- package/dist/types/module-graph.d.ts +1 -0
- package/dist/types/project.d.ts +0 -1
- package/dist/typescript/ast-helpers.js +21 -20
- package/dist/typescript/ast-nodes.d.ts +1 -0
- package/dist/typescript/ast-nodes.js +19 -0
- package/dist/typescript/get-imports-and-exports.js +18 -2
- package/dist/typescript/resolve-module-names.d.ts +6 -2
- package/dist/typescript/resolve-module-names.js +20 -29
- package/dist/typescript/visitors/calls.d.ts +3 -2
- package/dist/typescript/visitors/calls.js +88 -16
- package/dist/typescript/visitors/exports.js +12 -0
- package/dist/typescript/visitors/walk.d.ts +7 -0
- package/dist/typescript/visitors/walk.js +43 -1
- package/dist/util/Performance.d.ts +13 -28
- package/dist/util/Performance.js +41 -72
- package/dist/util/cli-arguments.d.ts +3 -1
- package/dist/util/cli-arguments.js +4 -0
- package/dist/util/create-options.d.ts +53 -0
- package/dist/util/create-options.js +2 -1
- package/dist/util/disk-cache.d.ts +1 -0
- package/dist/util/disk-cache.js +8 -0
- package/dist/util/gitignore-cache.js +5 -11
- package/dist/util/glob-cache.js +2 -8
- package/dist/util/glob-core.js +4 -7
- package/dist/util/jiti.js +1 -0
- package/dist/util/load-tsconfig.js +0 -3
- package/dist/util/parse-args.d.ts +14 -0
- package/dist/util/parse-args.js +112 -0
- package/dist/util/trace.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -6
- package/schema.json +73 -43
- package/dist/util/math.d.ts +0 -6
- package/dist/util/math.js +0 -11
|
@@ -58,6 +58,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
58
58
|
entry?: string | string[] | undefined;
|
|
59
59
|
project?: string | string[] | undefined;
|
|
60
60
|
} | undefined;
|
|
61
|
+
catalyst?: string | boolean | string[] | {
|
|
62
|
+
config?: string | string[] | undefined;
|
|
63
|
+
entry?: string | string[] | undefined;
|
|
64
|
+
project?: string | string[] | undefined;
|
|
65
|
+
} | undefined;
|
|
61
66
|
changelogen?: string | boolean | string[] | {
|
|
62
67
|
config?: string | string[] | undefined;
|
|
63
68
|
entry?: string | string[] | undefined;
|
|
@@ -158,6 +163,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
158
163
|
entry?: string | string[] | undefined;
|
|
159
164
|
project?: string | string[] | undefined;
|
|
160
165
|
} | undefined;
|
|
166
|
+
fast?: string | boolean | string[] | {
|
|
167
|
+
config?: string | string[] | undefined;
|
|
168
|
+
entry?: string | string[] | undefined;
|
|
169
|
+
project?: string | string[] | undefined;
|
|
170
|
+
} | undefined;
|
|
161
171
|
gatsby?: string | boolean | string[] | {
|
|
162
172
|
config?: string | string[] | undefined;
|
|
163
173
|
entry?: string | string[] | undefined;
|
|
@@ -233,6 +243,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
233
243
|
entry?: string | string[] | undefined;
|
|
234
244
|
project?: string | string[] | undefined;
|
|
235
245
|
} | undefined;
|
|
246
|
+
lit?: string | boolean | string[] | {
|
|
247
|
+
config?: string | string[] | undefined;
|
|
248
|
+
entry?: string | string[] | undefined;
|
|
249
|
+
project?: string | string[] | undefined;
|
|
250
|
+
} | undefined;
|
|
236
251
|
'lockfile-lint'?: string | boolean | string[] | {
|
|
237
252
|
config?: string | string[] | undefined;
|
|
238
253
|
entry?: string | string[] | undefined;
|
|
@@ -278,6 +293,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
278
293
|
entry?: string | string[] | undefined;
|
|
279
294
|
project?: string | string[] | undefined;
|
|
280
295
|
} | undefined;
|
|
296
|
+
'nano-spawn'?: string | boolean | string[] | {
|
|
297
|
+
config?: string | string[] | undefined;
|
|
298
|
+
entry?: string | string[] | undefined;
|
|
299
|
+
project?: string | string[] | undefined;
|
|
300
|
+
} | undefined;
|
|
281
301
|
'nano-staged'?: string | boolean | string[] | {
|
|
282
302
|
config?: string | string[] | undefined;
|
|
283
303
|
entry?: string | string[] | undefined;
|
|
@@ -358,6 +378,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
358
378
|
entry?: string | string[] | undefined;
|
|
359
379
|
project?: string | string[] | undefined;
|
|
360
380
|
} | undefined;
|
|
381
|
+
orval?: string | boolean | string[] | {
|
|
382
|
+
config?: string | string[] | undefined;
|
|
383
|
+
entry?: string | string[] | undefined;
|
|
384
|
+
project?: string | string[] | undefined;
|
|
385
|
+
} | undefined;
|
|
361
386
|
oxfmt?: string | boolean | string[] | {
|
|
362
387
|
config?: string | string[] | undefined;
|
|
363
388
|
entry?: string | string[] | undefined;
|
|
@@ -771,6 +796,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
771
796
|
compilers?: Record<string, true | CompilerAsync | CompilerSync> | undefined;
|
|
772
797
|
tags?: string[] | undefined;
|
|
773
798
|
treatConfigHintsAsErrors?: boolean | undefined;
|
|
799
|
+
treatTagHintsAsErrors?: boolean | undefined;
|
|
774
800
|
include?: ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
775
801
|
exclude?: ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
776
802
|
workspaces?: Record<string, {
|
|
@@ -829,6 +855,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
829
855
|
entry?: string | string[] | undefined;
|
|
830
856
|
project?: string | string[] | undefined;
|
|
831
857
|
} | undefined;
|
|
858
|
+
catalyst?: string | boolean | string[] | {
|
|
859
|
+
config?: string | string[] | undefined;
|
|
860
|
+
entry?: string | string[] | undefined;
|
|
861
|
+
project?: string | string[] | undefined;
|
|
862
|
+
} | undefined;
|
|
832
863
|
changelogen?: string | boolean | string[] | {
|
|
833
864
|
config?: string | string[] | undefined;
|
|
834
865
|
entry?: string | string[] | undefined;
|
|
@@ -929,6 +960,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
929
960
|
entry?: string | string[] | undefined;
|
|
930
961
|
project?: string | string[] | undefined;
|
|
931
962
|
} | undefined;
|
|
963
|
+
fast?: string | boolean | string[] | {
|
|
964
|
+
config?: string | string[] | undefined;
|
|
965
|
+
entry?: string | string[] | undefined;
|
|
966
|
+
project?: string | string[] | undefined;
|
|
967
|
+
} | undefined;
|
|
932
968
|
gatsby?: string | boolean | string[] | {
|
|
933
969
|
config?: string | string[] | undefined;
|
|
934
970
|
entry?: string | string[] | undefined;
|
|
@@ -1004,6 +1040,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1004
1040
|
entry?: string | string[] | undefined;
|
|
1005
1041
|
project?: string | string[] | undefined;
|
|
1006
1042
|
} | undefined;
|
|
1043
|
+
lit?: string | boolean | string[] | {
|
|
1044
|
+
config?: string | string[] | undefined;
|
|
1045
|
+
entry?: string | string[] | undefined;
|
|
1046
|
+
project?: string | string[] | undefined;
|
|
1047
|
+
} | undefined;
|
|
1007
1048
|
'lockfile-lint'?: string | boolean | string[] | {
|
|
1008
1049
|
config?: string | string[] | undefined;
|
|
1009
1050
|
entry?: string | string[] | undefined;
|
|
@@ -1049,6 +1090,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1049
1090
|
entry?: string | string[] | undefined;
|
|
1050
1091
|
project?: string | string[] | undefined;
|
|
1051
1092
|
} | undefined;
|
|
1093
|
+
'nano-spawn'?: string | boolean | string[] | {
|
|
1094
|
+
config?: string | string[] | undefined;
|
|
1095
|
+
entry?: string | string[] | undefined;
|
|
1096
|
+
project?: string | string[] | undefined;
|
|
1097
|
+
} | undefined;
|
|
1052
1098
|
'nano-staged'?: string | boolean | string[] | {
|
|
1053
1099
|
config?: string | string[] | undefined;
|
|
1054
1100
|
entry?: string | string[] | undefined;
|
|
@@ -1129,6 +1175,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1129
1175
|
entry?: string | string[] | undefined;
|
|
1130
1176
|
project?: string | string[] | undefined;
|
|
1131
1177
|
} | undefined;
|
|
1178
|
+
orval?: string | boolean | string[] | {
|
|
1179
|
+
config?: string | string[] | undefined;
|
|
1180
|
+
entry?: string | string[] | undefined;
|
|
1181
|
+
project?: string | string[] | undefined;
|
|
1182
|
+
} | undefined;
|
|
1132
1183
|
oxfmt?: string | boolean | string[] | {
|
|
1133
1184
|
config?: string | string[] | undefined;
|
|
1134
1185
|
entry?: string | string[] | undefined;
|
|
@@ -1533,6 +1584,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1533
1584
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
1534
1585
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
1535
1586
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1587
|
+
ignoreExportsUsedInFile?: boolean | Record<string, boolean | undefined> | undefined;
|
|
1536
1588
|
includeEntryExports?: boolean | undefined;
|
|
1537
1589
|
}> | undefined;
|
|
1538
1590
|
syncCompilers: Record<string, true | CompilerSync>;
|
package/dist/compilers/scss.js
CHANGED
|
@@ -6,9 +6,15 @@ const candidates = (specifier) => {
|
|
|
6
6
|
const spec = specifier.startsWith('.') || isAlias(specifier) ? specifier : `./${specifier}`;
|
|
7
7
|
const name = basename(spec);
|
|
8
8
|
const dir = dirname(spec);
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
const hasExt = name.endsWith('.scss') || name.endsWith('.sass');
|
|
10
|
+
const bases = hasExt ? [name] : [`${name}.scss`, `${name}.sass`];
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const base of bases) {
|
|
13
|
+
out.push(`${dir}/${base}`);
|
|
14
|
+
if (!name.startsWith('_'))
|
|
15
|
+
out.push(`${dir}/_${base}`);
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
12
18
|
};
|
|
13
19
|
const compiler = text => {
|
|
14
20
|
const out = [];
|
package/dist/graph/analyze.js
CHANGED
|
@@ -11,8 +11,7 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
11
11
|
const shouldIgnore = getShouldIgnoreHandler(options.isProduction);
|
|
12
12
|
const shouldIgnoreTags = getShouldIgnoreTagHandler(options.tags);
|
|
13
13
|
const explorer = createGraphExplorer(graph, entryPaths);
|
|
14
|
-
const
|
|
15
|
-
const isReferencedInUsedExport = (exportedItem, filePath, includeEntryExports, visited) => {
|
|
14
|
+
const isReferencedInUsedExport = (exportedItem, filePath, includeEntryExports, ignoreExportsUsedInFile, visited) => {
|
|
16
15
|
if (!exportedItem.referencedIn)
|
|
17
16
|
return false;
|
|
18
17
|
const file = graph.get(filePath);
|
|
@@ -26,7 +25,7 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
26
25
|
!shouldCountRefs(ignoreExportsUsedInFile, inExport.type)) {
|
|
27
26
|
continue;
|
|
28
27
|
}
|
|
29
|
-
if (inExport.hasRefsInFile)
|
|
28
|
+
if (inExport.hasRefsInFile || inExport.isRegistered)
|
|
30
29
|
return true;
|
|
31
30
|
if (explorer.isReferenced(filePath, containingExport, { traverseEntries: includeEntryExports })[0])
|
|
32
31
|
return true;
|
|
@@ -34,7 +33,7 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
34
33
|
const v = visited ?? new Set();
|
|
35
34
|
if (!v.has(containingExport)) {
|
|
36
35
|
v.add(containingExport);
|
|
37
|
-
if (isReferencedInUsedExport(inExport, filePath, includeEntryExports, v))
|
|
36
|
+
if (isReferencedInUsedExport(inExport, filePath, includeEntryExports, ignoreExportsUsedInFile, v))
|
|
38
37
|
return true;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
@@ -50,7 +49,7 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
50
49
|
continue;
|
|
51
50
|
const workspace = chief.findWorkspaceByFilePath(filePath);
|
|
52
51
|
if (workspace) {
|
|
53
|
-
const { isIncludeEntryExports } = workspace.config;
|
|
52
|
+
const { isIncludeEntryExports, ignoreExportsUsedInFile } = workspace.config;
|
|
54
53
|
const isEntry = entryPaths.has(filePath);
|
|
55
54
|
if (!isIncludeEntryExports && isEntry) {
|
|
56
55
|
continue;
|
|
@@ -66,7 +65,8 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
66
65
|
traverseEntries: isIncludeEntryExports,
|
|
67
66
|
});
|
|
68
67
|
if (isIgnored &&
|
|
69
|
-
(isReferenced ||
|
|
68
|
+
(isReferenced ||
|
|
69
|
+
isReferencedInUsedExport(exportedItem, filePath, isIncludeEntryExports, ignoreExportsUsedInFile))) {
|
|
70
70
|
for (const tagName of exportedItem.jsDocTags) {
|
|
71
71
|
if (options.tags[1].includes(tagName) || (isInternalProd && tagName === INTERNAL_TAG)) {
|
|
72
72
|
collector.addTagHint({ type: 'tag', filePath, identifier, tagName });
|
|
@@ -140,7 +140,8 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
140
140
|
const isType = ['enum', 'type', 'interface'].includes(exportedItem.type);
|
|
141
141
|
if (isIgnored ||
|
|
142
142
|
exportedItem.hasRefsInFile ||
|
|
143
|
-
|
|
143
|
+
exportedItem.isRegistered ||
|
|
144
|
+
isReferencedInUsedExport(exportedItem, filePath, isIncludeEntryExports, ignoreExportsUsedInFile) ||
|
|
144
145
|
(hasStrictlyNsRefs &&
|
|
145
146
|
((!options.includedIssueTypes.nsTypes && isType) || !(options.includedIssueTypes.nsExports || isType)))) {
|
|
146
147
|
continue;
|
|
@@ -245,7 +246,13 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
245
246
|
await analyzeGraph();
|
|
246
247
|
perfObserver.addMemoryMark('analyze');
|
|
247
248
|
if (options.isTrace) {
|
|
248
|
-
traceReporter({
|
|
249
|
+
traceReporter({
|
|
250
|
+
graph,
|
|
251
|
+
explorer,
|
|
252
|
+
options,
|
|
253
|
+
workspaceFilePathFilter: chief.workspaceFilePathFilter,
|
|
254
|
+
issues: collector.getIssues().issues,
|
|
255
|
+
});
|
|
249
256
|
}
|
|
250
257
|
return analyzeGraph;
|
|
251
258
|
};
|
package/dist/graph/build.js
CHANGED
|
@@ -128,9 +128,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
128
128
|
}
|
|
129
129
|
for (const dep of getManifestImportDependencies(manifest))
|
|
130
130
|
deputy.addReferencedDependency(name, dep);
|
|
131
|
-
principal.addPaths(config.paths, dir);
|
|
132
|
-
if (compilerOptions.rootDirs)
|
|
133
|
-
principal.addRootDirs(compilerOptions.rootDirs);
|
|
131
|
+
principal.addPaths(config.paths, dir, dir);
|
|
134
132
|
const inputsFromPlugins = await worker.runPlugins();
|
|
135
133
|
for (const id of inputsFromPlugins)
|
|
136
134
|
inputs.add(Object.assign(id, { skipExportsAnalysis: !id.allowIncludeExports }));
|
|
@@ -170,7 +168,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
170
168
|
projectFilePatterns.add(toWorkspaceRelative(specifier));
|
|
171
169
|
}
|
|
172
170
|
else if (isAlias(input)) {
|
|
173
|
-
principal.addPaths({ [input.specifier]: input.prefixes }, input.dir ?? dir);
|
|
171
|
+
principal.addPaths({ [input.specifier]: input.prefixes }, input.dir ?? dir, dir);
|
|
174
172
|
}
|
|
175
173
|
else if (isIgnore(input)) {
|
|
176
174
|
if (input.issueType === 'dependencies' || input.issueType === 'unlisted') {
|
|
@@ -304,7 +302,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
304
302
|
analyzedFiles.add(filePath);
|
|
305
303
|
const workspace = chief.findWorkspaceByFilePath(filePath);
|
|
306
304
|
if (workspace) {
|
|
307
|
-
const file = pp.analyzeSourceFile(filePath, analyzeOpts,
|
|
305
|
+
const file = pp.analyzeSourceFile(filePath, analyzeOpts, workspace.config.ignoreExportsUsedInFile, parseResult, sourceText, cachedFile);
|
|
308
306
|
const unresolvedImports = new Set();
|
|
309
307
|
for (const unresolvedImport of file.imports.unresolved) {
|
|
310
308
|
const { specifier } = unresolvedImport;
|
package/dist/manifest/index.js
CHANGED
|
@@ -5,24 +5,21 @@ const getMetaDataFromPackageJson = ({ cwd, dir, packageNames }) => {
|
|
|
5
5
|
const hostDependencies = new Map();
|
|
6
6
|
const installedBinaries = new Map();
|
|
7
7
|
const hasTypesIncluded = new Set();
|
|
8
|
+
const addBinary = (key, value) => {
|
|
9
|
+
const set = installedBinaries.get(key);
|
|
10
|
+
if (set)
|
|
11
|
+
set.add(value);
|
|
12
|
+
else
|
|
13
|
+
installedBinaries.set(key, new Set([value]));
|
|
14
|
+
};
|
|
8
15
|
for (const packageName of packageNames) {
|
|
9
16
|
const manifest = loadPackageManifest({ cwd, dir, packageName });
|
|
10
17
|
if (manifest) {
|
|
11
|
-
const
|
|
12
|
-
const binaries = typeof manifest.bin === 'string' ? [
|
|
18
|
+
const defaultBinaryName = packageName.replace(/^@[^/]+\//, '');
|
|
19
|
+
const binaries = typeof manifest.bin === 'string' ? [defaultBinaryName] : Object.keys(manifest.bin ?? {});
|
|
13
20
|
for (const binaryName of binaries) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
installedBinaries.set(binaryName, new Set([packageName]));
|
|
19
|
-
}
|
|
20
|
-
if (installedBinaries.has(packageName)) {
|
|
21
|
-
installedBinaries.get(packageName)?.add(binaryName);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
installedBinaries.set(packageName, new Set([binaryName]));
|
|
25
|
-
}
|
|
21
|
+
addBinary(binaryName, packageName);
|
|
22
|
+
addBinary(packageName, binaryName);
|
|
26
23
|
}
|
|
27
24
|
const packagePeerDependencies = Object.keys(manifest.peerDependencies ?? {});
|
|
28
25
|
for (const packagePeerDependency of packagePeerDependencies) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginVisitorContext, PluginVisitorObject } from '../../types/config.ts';
|
|
2
|
+
interface CustomElementVisitorOptions {
|
|
3
|
+
decoratorName?: string;
|
|
4
|
+
baseClassName?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function createCustomElementVisitor(ctx: PluginVisitorContext, isRegistrationSpecifier: (specifier: string) => boolean, { decoratorName, baseClassName }?: CustomElementVisitorOptions): PluginVisitorObject;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
function isCustomElementDecorated(node, names, namespaces, decoratorName) {
|
|
2
|
+
const decorators = node.decorators;
|
|
3
|
+
if (!decorators || decorators.length === 0)
|
|
4
|
+
return false;
|
|
5
|
+
for (const decorator of decorators) {
|
|
6
|
+
const expression = decorator.expression;
|
|
7
|
+
if (expression?.type === 'Identifier') {
|
|
8
|
+
if (names.has(expression.name))
|
|
9
|
+
return true;
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (expression?.type !== 'CallExpression')
|
|
13
|
+
continue;
|
|
14
|
+
const callee = expression.callee;
|
|
15
|
+
if (callee.type === 'Identifier') {
|
|
16
|
+
if (names.has(callee.name))
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
else if (callee.type === 'MemberExpression' &&
|
|
20
|
+
!callee.computed &&
|
|
21
|
+
callee.object.type === 'Identifier' &&
|
|
22
|
+
callee.property.type === 'Identifier' &&
|
|
23
|
+
callee.property.name === decoratorName &&
|
|
24
|
+
namespaces.has(callee.object.name)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
function extendsBaseClass(node, baseNames) {
|
|
31
|
+
const superClass = node.superClass;
|
|
32
|
+
if (!superClass)
|
|
33
|
+
return false;
|
|
34
|
+
if (superClass.type === 'Identifier')
|
|
35
|
+
return baseNames.has(superClass.name);
|
|
36
|
+
if (superClass.type === 'CallExpression') {
|
|
37
|
+
for (const arg of superClass.arguments) {
|
|
38
|
+
if (arg.type === 'Identifier' && baseNames.has(arg.name))
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
export function createCustomElementVisitor(ctx, isRegistrationSpecifier, { decoratorName = 'customElement', baseClassName } = {}) {
|
|
45
|
+
const decoratorNames = new Set();
|
|
46
|
+
const namespaces = new Set();
|
|
47
|
+
const baseNames = new Set();
|
|
48
|
+
const definedClasses = new Set();
|
|
49
|
+
let depth = 0;
|
|
50
|
+
const visitor = {
|
|
51
|
+
Program() {
|
|
52
|
+
decoratorNames.clear();
|
|
53
|
+
namespaces.clear();
|
|
54
|
+
baseNames.clear();
|
|
55
|
+
definedClasses.clear();
|
|
56
|
+
depth = 0;
|
|
57
|
+
},
|
|
58
|
+
BlockStatement() {
|
|
59
|
+
depth++;
|
|
60
|
+
},
|
|
61
|
+
'BlockStatement:exit'() {
|
|
62
|
+
depth--;
|
|
63
|
+
},
|
|
64
|
+
ImportDeclaration(node) {
|
|
65
|
+
if (!node.source || !isRegistrationSpecifier(node.source.value))
|
|
66
|
+
return;
|
|
67
|
+
for (const spec of node.specifiers ?? []) {
|
|
68
|
+
if (spec.type === 'ImportSpecifier' && spec.imported.type === 'Identifier') {
|
|
69
|
+
if (spec.imported.name === decoratorName)
|
|
70
|
+
decoratorNames.add(spec.local.name);
|
|
71
|
+
else if (baseClassName && spec.imported.name === baseClassName)
|
|
72
|
+
baseNames.add(spec.local.name);
|
|
73
|
+
}
|
|
74
|
+
else if (spec.type === 'ImportNamespaceSpecifier') {
|
|
75
|
+
namespaces.add(spec.local.name);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
ClassDeclaration(node) {
|
|
80
|
+
if (depth !== 0 || !node.id?.name)
|
|
81
|
+
return;
|
|
82
|
+
if (isCustomElementDecorated(node, decoratorNames, namespaces, decoratorName))
|
|
83
|
+
ctx.markExportRegistered(node.id.name);
|
|
84
|
+
else if (baseClassName && extendsBaseClass(node, baseNames))
|
|
85
|
+
definedClasses.add(node.id.name);
|
|
86
|
+
},
|
|
87
|
+
ExportDefaultDeclaration(node) {
|
|
88
|
+
if (node.declaration.type === 'ClassDeclaration' &&
|
|
89
|
+
isCustomElementDecorated(node.declaration, decoratorNames, namespaces, decoratorName))
|
|
90
|
+
ctx.markExportRegistered('default');
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
if (baseClassName) {
|
|
94
|
+
visitor.CallExpression = node => {
|
|
95
|
+
const callee = node.callee;
|
|
96
|
+
if (callee.type === 'MemberExpression' &&
|
|
97
|
+
!callee.computed &&
|
|
98
|
+
callee.object.type === 'Identifier' &&
|
|
99
|
+
callee.property.type === 'Identifier' &&
|
|
100
|
+
(callee.property.name === 'define' || callee.property.name === 'defineAsync') &&
|
|
101
|
+
definedClasses.has(callee.object.name))
|
|
102
|
+
ctx.markExportRegistered(callee.object.name);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return visitor;
|
|
106
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
import { createCustomElementVisitor } from '../_custom-elements/custom-element-visitor.js';
|
|
3
|
+
const title = 'Catalyst';
|
|
4
|
+
const enablers = ['@github/catalyst'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const isCatalystSpecifier = (specifier) => specifier === '@github/catalyst';
|
|
7
|
+
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
8
|
+
registerVisitor(createCustomElementVisitor(ctx, isCatalystSpecifier, { decoratorName: 'controller' }));
|
|
9
|
+
};
|
|
10
|
+
const plugin = {
|
|
11
|
+
title,
|
|
12
|
+
enablers,
|
|
13
|
+
isEnabled,
|
|
14
|
+
registerVisitors,
|
|
15
|
+
};
|
|
16
|
+
export default plugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getStringValue, isStringLiteral } from '../../../typescript/ast-nodes.js';
|
|
1
|
+
import { getSafeScriptFromArgs, getStringValue, isStringLiteral } from '../../../typescript/ast-nodes.js';
|
|
2
2
|
const tags = new Set(['$', '$sync']);
|
|
3
3
|
const methods = new Set(['execa', 'execaSync', 'execaCommand', 'execaCommandSync', '$sync']);
|
|
4
4
|
export function createExecaVisitor(ctx) {
|
|
@@ -29,22 +29,9 @@ export function createExecaVisitor(ctx) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
const args = node.arguments[1];
|
|
36
|
-
if (args?.type === 'ArrayExpression') {
|
|
37
|
-
const argStrings = [];
|
|
38
|
-
for (const a of args.elements) {
|
|
39
|
-
if (a && isStringLiteral(a))
|
|
40
|
-
argStrings.push(getStringValue(a));
|
|
41
|
-
}
|
|
42
|
-
ctx.addScript([executableStr, ...argStrings].join(' '));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
ctx.addScript(executableStr);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
32
|
+
const script = getSafeScriptFromArgs(node.arguments[0], node.arguments[1]);
|
|
33
|
+
if (script)
|
|
34
|
+
ctx.addScript(script);
|
|
48
35
|
}
|
|
49
36
|
},
|
|
50
37
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
import { createCustomElementVisitor } from '../_custom-elements/custom-element-visitor.js';
|
|
3
|
+
const title = 'FAST';
|
|
4
|
+
const enablers = ['@microsoft/fast-element'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const isFastSpecifier = (specifier) => specifier === '@microsoft/fast-element';
|
|
7
|
+
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
8
|
+
registerVisitor(createCustomElementVisitor(ctx, isFastSpecifier, { baseClassName: 'FASTElement' }));
|
|
9
|
+
};
|
|
10
|
+
const plugin = {
|
|
11
|
+
title,
|
|
12
|
+
enablers,
|
|
13
|
+
isEnabled,
|
|
14
|
+
registerVisitors,
|
|
15
|
+
};
|
|
16
|
+
export default plugin;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const Plugins: {
|
|
|
10
10
|
bun: import("../types/config.ts").Plugin;
|
|
11
11
|
c8: import("../types/config.ts").Plugin;
|
|
12
12
|
capacitor: import("../types/config.ts").Plugin;
|
|
13
|
+
catalyst: import("../types/config.ts").Plugin;
|
|
13
14
|
changelogen: import("../types/config.ts").Plugin;
|
|
14
15
|
changelogithub: import("../types/config.ts").Plugin;
|
|
15
16
|
changesets: import("../types/config.ts").Plugin;
|
|
@@ -35,6 +36,7 @@ export declare const Plugins: {
|
|
|
35
36
|
isEnabled: import("../types/config.ts").IsPluginEnabled;
|
|
36
37
|
config: string[];
|
|
37
38
|
};
|
|
39
|
+
fast: import("../types/config.ts").Plugin;
|
|
38
40
|
gatsby: import("../types/config.ts").Plugin;
|
|
39
41
|
'github-action': import("../types/config.ts").Plugin;
|
|
40
42
|
'github-actions': import("../types/config.ts").Plugin;
|
|
@@ -50,6 +52,7 @@ export declare const Plugins: {
|
|
|
50
52
|
lefthook: import("../types/config.ts").Plugin;
|
|
51
53
|
'lint-staged': import("../types/config.ts").Plugin;
|
|
52
54
|
linthtml: import("../types/config.ts").Plugin;
|
|
55
|
+
lit: import("../types/config.ts").Plugin;
|
|
53
56
|
'lockfile-lint': import("../types/config.ts").Plugin;
|
|
54
57
|
'lost-pixel': import("../types/config.ts").Plugin;
|
|
55
58
|
markdownlint: import("../types/config.ts").Plugin;
|
|
@@ -59,6 +62,7 @@ export declare const Plugins: {
|
|
|
59
62
|
mocha: import("../types/config.ts").Plugin;
|
|
60
63
|
moonrepo: import("../types/config.ts").Plugin;
|
|
61
64
|
msw: import("../types/config.ts").Plugin;
|
|
65
|
+
'nano-spawn': import("../types/config.ts").Plugin;
|
|
62
66
|
'nano-staged': import("../types/config.ts").Plugin;
|
|
63
67
|
nest: import("../types/config.ts").Plugin;
|
|
64
68
|
netlify: import("../types/config.ts").Plugin;
|
|
@@ -75,6 +79,7 @@ export declare const Plugins: {
|
|
|
75
79
|
nyc: import("../types/config.ts").Plugin;
|
|
76
80
|
oclif: import("../types/config.ts").Plugin;
|
|
77
81
|
'openapi-ts': import("../types/config.ts").Plugin;
|
|
82
|
+
orval: import("../types/config.ts").Plugin;
|
|
78
83
|
oxfmt: import("../types/config.ts").Plugin;
|
|
79
84
|
oxlint: import("../types/config.ts").Plugin;
|
|
80
85
|
'panda-css': import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { default as bumpp } from './bumpp/index.js';
|
|
|
9
9
|
import { default as bun } from './bun/index.js';
|
|
10
10
|
import { default as c8 } from './c8/index.js';
|
|
11
11
|
import { default as capacitor } from './capacitor/index.js';
|
|
12
|
+
import { default as catalyst } from './catalyst/index.js';
|
|
12
13
|
import { default as changelogen } from './changelogen/index.js';
|
|
13
14
|
import { default as changelogithub } from './changelogithub/index.js';
|
|
14
15
|
import { default as changesets } from './changesets/index.js';
|
|
@@ -29,6 +30,7 @@ import { default as eslint } from './eslint/index.js';
|
|
|
29
30
|
import { default as execa } from './execa/index.js';
|
|
30
31
|
import { default as expo } from './expo/index.js';
|
|
31
32
|
import { default as expressiveCode } from './expressive-code/index.js';
|
|
33
|
+
import { default as fast } from './fast/index.js';
|
|
32
34
|
import { default as gatsby } from './gatsby/index.js';
|
|
33
35
|
import { default as githubAction } from './github-action/index.js';
|
|
34
36
|
import { default as githubActions } from './github-actions/index.js';
|
|
@@ -44,6 +46,7 @@ import { default as ladle } from './ladle/index.js';
|
|
|
44
46
|
import { default as lefthook } from './lefthook/index.js';
|
|
45
47
|
import { default as lintStaged } from './lint-staged/index.js';
|
|
46
48
|
import { default as linthtml } from './linthtml/index.js';
|
|
49
|
+
import { default as lit } from './lit/index.js';
|
|
47
50
|
import { default as lockfileLint } from './lockfile-lint/index.js';
|
|
48
51
|
import { default as lostPixel } from './lost-pixel/index.js';
|
|
49
52
|
import { default as markdownlint } from './markdownlint/index.js';
|
|
@@ -53,6 +56,7 @@ import { default as metro } from './metro/index.js';
|
|
|
53
56
|
import { default as mocha } from './mocha/index.js';
|
|
54
57
|
import { default as moonrepo } from './moonrepo/index.js';
|
|
55
58
|
import { default as msw } from './msw/index.js';
|
|
59
|
+
import { default as nanoSpawn } from './nano-spawn/index.js';
|
|
56
60
|
import { default as nanoStaged } from './nano-staged/index.js';
|
|
57
61
|
import { default as nest } from './nest/index.js';
|
|
58
62
|
import { default as netlify } from './netlify/index.js';
|
|
@@ -69,6 +73,7 @@ import { default as nx } from './nx/index.js';
|
|
|
69
73
|
import { default as nyc } from './nyc/index.js';
|
|
70
74
|
import { default as oclif } from './oclif/index.js';
|
|
71
75
|
import { default as openapiTs } from './openapi-ts/index.js';
|
|
76
|
+
import { default as orval } from './orval/index.js';
|
|
72
77
|
import { default as oxfmt } from './oxfmt/index.js';
|
|
73
78
|
import { default as oxlint } from './oxlint/index.js';
|
|
74
79
|
import { default as pandaCss } from './panda-css/index.js';
|
|
@@ -160,6 +165,7 @@ export const Plugins = {
|
|
|
160
165
|
bun,
|
|
161
166
|
c8,
|
|
162
167
|
capacitor,
|
|
168
|
+
catalyst,
|
|
163
169
|
changelogen,
|
|
164
170
|
changelogithub,
|
|
165
171
|
changesets,
|
|
@@ -180,6 +186,7 @@ export const Plugins = {
|
|
|
180
186
|
execa,
|
|
181
187
|
expo,
|
|
182
188
|
'expressive-code': expressiveCode,
|
|
189
|
+
fast,
|
|
183
190
|
gatsby,
|
|
184
191
|
'github-action': githubAction,
|
|
185
192
|
'github-actions': githubActions,
|
|
@@ -195,6 +202,7 @@ export const Plugins = {
|
|
|
195
202
|
lefthook,
|
|
196
203
|
'lint-staged': lintStaged,
|
|
197
204
|
linthtml,
|
|
205
|
+
lit,
|
|
198
206
|
'lockfile-lint': lockfileLint,
|
|
199
207
|
'lost-pixel': lostPixel,
|
|
200
208
|
markdownlint,
|
|
@@ -204,6 +212,7 @@ export const Plugins = {
|
|
|
204
212
|
mocha,
|
|
205
213
|
moonrepo,
|
|
206
214
|
msw,
|
|
215
|
+
'nano-spawn': nanoSpawn,
|
|
207
216
|
'nano-staged': nanoStaged,
|
|
208
217
|
nest,
|
|
209
218
|
netlify,
|
|
@@ -220,6 +229,7 @@ export const Plugins = {
|
|
|
220
229
|
nyc,
|
|
221
230
|
oclif,
|
|
222
231
|
'openapi-ts': openapiTs,
|
|
232
|
+
orval,
|
|
223
233
|
oxfmt,
|
|
224
234
|
oxlint,
|
|
225
235
|
'panda-css': pandaCss,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
import { createCustomElementVisitor } from '../_custom-elements/custom-element-visitor.js';
|
|
3
|
+
const title = 'Lit';
|
|
4
|
+
const enablers = ['lit', 'lit-element', '@lit/reactive-element'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const isLitDecoratorsSpecifier = (specifier) => specifier === 'lit/decorators.js' ||
|
|
7
|
+
specifier === 'lit/decorators' ||
|
|
8
|
+
specifier.startsWith('lit/decorators/') ||
|
|
9
|
+
specifier === '@lit/reactive-element/decorators.js' ||
|
|
10
|
+
specifier === '@lit/reactive-element/decorators' ||
|
|
11
|
+
specifier.startsWith('@lit/reactive-element/decorators/') ||
|
|
12
|
+
specifier === 'lit-element' ||
|
|
13
|
+
specifier === 'lit-element/decorators.js' ||
|
|
14
|
+
specifier === 'lit-element/decorators' ||
|
|
15
|
+
specifier.startsWith('lit-element/decorators/');
|
|
16
|
+
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
17
|
+
registerVisitor(createCustomElementVisitor(ctx, isLitDecoratorsSpecifier));
|
|
18
|
+
};
|
|
19
|
+
const plugin = {
|
|
20
|
+
title,
|
|
21
|
+
enablers,
|
|
22
|
+
isEnabled,
|
|
23
|
+
registerVisitors,
|
|
24
|
+
};
|
|
25
|
+
export default plugin;
|