knip 6.14.2 → 6.15.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 +12 -0
- package/dist/ConfigurationChief.js +7 -10
- 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 +0 -2
- package/dist/ProjectPrincipal.js +1 -9
- package/dist/WorkspaceWorker.js +6 -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 +21 -0
- package/dist/compilers/scss.js +9 -3
- package/dist/graph/analyze.js +7 -1
- package/dist/graph/build.js +0 -2
- package/dist/manifest/index.js +11 -14
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +4 -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 +25 -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/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 +32 -1
- package/dist/schema/configuration.js +1 -0
- package/dist/schema/plugins.d.ts +10 -0
- package/dist/schema/plugins.js +2 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +2 -0
- package/dist/types/issues.d.ts +1 -0
- package/dist/types/project.d.ts +0 -1
- package/dist/typescript/resolve-module-names.d.ts +0 -1
- package/dist/typescript/resolve-module-names.js +0 -17
- package/dist/typescript/visitors/walk.js +7 -0
- 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 +22 -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/trace.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -4
- package/schema.json +12 -0
- package/dist/util/math.d.ts +0 -6
- package/dist/util/math.js +0 -11
|
@@ -4,6 +4,7 @@ export declare class CacheConsultant<T> {
|
|
|
4
4
|
private cache;
|
|
5
5
|
getFileDescriptor: (filePath: string) => FileDescriptor<T>;
|
|
6
6
|
reconcile: () => void;
|
|
7
|
+
removeEntry: (filePath: string) => void;
|
|
7
8
|
constructor(name: string, options: MainOptions);
|
|
8
9
|
getCachedFile(filePath: string): T | undefined;
|
|
9
10
|
}
|
package/dist/CacheConsultant.js
CHANGED
|
@@ -6,6 +6,7 @@ export class CacheConsultant {
|
|
|
6
6
|
cache;
|
|
7
7
|
getFileDescriptor = () => dummyFileDescriptor;
|
|
8
8
|
reconcile = () => { };
|
|
9
|
+
removeEntry = () => { };
|
|
9
10
|
constructor(name, options) {
|
|
10
11
|
if (!options.isCache)
|
|
11
12
|
return;
|
|
@@ -13,6 +14,7 @@ export class CacheConsultant {
|
|
|
13
14
|
this.cache = new FileEntryCache(cacheName, options.cacheLocation);
|
|
14
15
|
this.getFileDescriptor = timerify(this.cache.getFileDescriptor.bind(this.cache));
|
|
15
16
|
this.reconcile = timerify(this.cache.reconcile.bind(this.cache));
|
|
17
|
+
this.removeEntry = timerify(this.cache.removeEntry.bind(this.cache));
|
|
16
18
|
}
|
|
17
19
|
getCachedFile(filePath) {
|
|
18
20
|
if (!this.cache)
|
|
@@ -332,6 +332,11 @@ export declare class ConfigurationChief {
|
|
|
332
332
|
entry?: string | string[] | undefined;
|
|
333
333
|
project?: string | string[] | undefined;
|
|
334
334
|
} | undefined;
|
|
335
|
+
'nano-spawn'?: string | boolean | string[] | {
|
|
336
|
+
config?: string | string[] | undefined;
|
|
337
|
+
entry?: string | string[] | undefined;
|
|
338
|
+
project?: string | string[] | undefined;
|
|
339
|
+
} | undefined;
|
|
335
340
|
'nano-staged'?: string | boolean | string[] | {
|
|
336
341
|
config?: string | string[] | undefined;
|
|
337
342
|
entry?: string | string[] | undefined;
|
|
@@ -412,6 +417,11 @@ export declare class ConfigurationChief {
|
|
|
412
417
|
entry?: string | string[] | undefined;
|
|
413
418
|
project?: string | string[] | undefined;
|
|
414
419
|
} | undefined;
|
|
420
|
+
orval?: string | boolean | string[] | {
|
|
421
|
+
config?: string | string[] | undefined;
|
|
422
|
+
entry?: string | string[] | undefined;
|
|
423
|
+
project?: string | string[] | undefined;
|
|
424
|
+
} | undefined;
|
|
415
425
|
oxfmt?: string | boolean | string[] | {
|
|
416
426
|
config?: string | string[] | undefined;
|
|
417
427
|
entry?: string | string[] | undefined;
|
|
@@ -885,6 +895,7 @@ export declare class ConfigurationChief {
|
|
|
885
895
|
mocha?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
886
896
|
moonrepo?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
887
897
|
msw?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
898
|
+
"nano-spawn"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
888
899
|
"nano-staged"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
889
900
|
nest?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
890
901
|
netlify?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -901,6 +912,7 @@ export declare class ConfigurationChief {
|
|
|
901
912
|
nyc?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
902
913
|
oclif?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
903
914
|
"openapi-ts"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
915
|
+
orval?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
904
916
|
oxfmt?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
905
917
|
oxlint?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
906
918
|
"panda-css"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -8,7 +8,6 @@ import { _dirGlob, removeProductionSuffix } from './util/glob.js';
|
|
|
8
8
|
import { graphSequencer } from './util/graph-sequencer.js';
|
|
9
9
|
import mapWorkspaces from './util/map-workspaces.js';
|
|
10
10
|
import { join, relative } from './util/path.js';
|
|
11
|
-
import { timerify } from './util/Performance.js';
|
|
12
11
|
import { normalizePluginConfig } from './util/plugin.js';
|
|
13
12
|
import { toRegexOrString } from './util/regex.js';
|
|
14
13
|
import { ELLIPSIS } from './util/string.js';
|
|
@@ -76,7 +75,7 @@ export class ConfigurationChief {
|
|
|
76
75
|
this.workspaces = options.workspaces;
|
|
77
76
|
this.rawConfig = options.parsedConfig;
|
|
78
77
|
this.config = this.normalize(options.parsedConfig ?? {});
|
|
79
|
-
this.findWorkspaceByFilePath =
|
|
78
|
+
this.findWorkspaceByFilePath = this.findWorkspaceByFilePath.bind(this);
|
|
80
79
|
}
|
|
81
80
|
getConfigurationHints() {
|
|
82
81
|
const hints = [];
|
|
@@ -269,9 +268,7 @@ export class ConfigurationChief {
|
|
|
269
268
|
return this.availableWorkspaceNames.filter(workspaceName => workspaceName !== name && (name === ROOT_WORKSPACE_NAME || workspaceName.startsWith(prefix)));
|
|
270
269
|
}
|
|
271
270
|
getIgnoredWorkspacesFor(name) {
|
|
272
|
-
return this.ignoredWorkspacePatterns
|
|
273
|
-
.filter(workspaceName => workspaceName !== name)
|
|
274
|
-
.filter(workspaceName => name === ROOT_WORKSPACE_NAME || workspaceName.startsWith(name));
|
|
271
|
+
return this.ignoredWorkspacePatterns.filter(workspaceName => workspaceName !== name && (name === ROOT_WORKSPACE_NAME || workspaceName.startsWith(name)));
|
|
275
272
|
}
|
|
276
273
|
createIgnoredWorkspaceMatcher(name, dir) {
|
|
277
274
|
const ignoredWorkspaces = this.getIgnoredWorkspacesFor(name);
|
|
@@ -305,12 +302,12 @@ export class ConfigurationChief {
|
|
|
305
302
|
}
|
|
306
303
|
getWorkspaceConfig(workspaceName) {
|
|
307
304
|
const key = this.getConfigKeyForWorkspace(workspaceName);
|
|
305
|
+
if (!key)
|
|
306
|
+
return {};
|
|
308
307
|
const workspaces = this.rawConfig?.workspaces ?? {};
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
: workspaces[key]
|
|
313
|
-
: {}) ?? {});
|
|
308
|
+
if (key === ROOT_WORKSPACE_NAME && !(ROOT_WORKSPACE_NAME in workspaces))
|
|
309
|
+
return this.rawConfig ?? {};
|
|
310
|
+
return workspaces[key] ?? {};
|
|
314
311
|
}
|
|
315
312
|
getIgnores(workspaceName) {
|
|
316
313
|
const workspaceConfig = this.getWorkspaceConfig(workspaceName);
|
|
@@ -49,10 +49,6 @@ export declare class DependencyDeputy {
|
|
|
49
49
|
getDevDependencies(workspaceName: string): DependencyArray;
|
|
50
50
|
private dependencyCache;
|
|
51
51
|
getDependencies(workspaceName: string): DependencySet;
|
|
52
|
-
setInstalledBinaries(workspaceName: string, installedBinaries: Map<string, Set<string>>): void;
|
|
53
|
-
getInstalledBinaries(workspaceName: string): InstalledBinaries | undefined;
|
|
54
|
-
setHasTypesIncluded(workspaceName: string, hasTypesIncluded: Set<string>): void;
|
|
55
|
-
getHasTypesIncluded(workspaceName: string): Set<string> | undefined;
|
|
56
52
|
addReferencedDependency(workspaceName: string, packageName: string): void;
|
|
57
53
|
addReferencedBinary(workspaceName: string, binaryName: string): void;
|
|
58
54
|
setHostDependencies(workspaceName: string, hostDependencies: HostDependencies): void;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -48,8 +48,8 @@ export class DependencyDeputy {
|
|
|
48
48
|
cwd,
|
|
49
49
|
});
|
|
50
50
|
this.setHostDependencies(name, hostDependencies);
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
51
|
+
this.installedBinaries.set(name, installedBinaries);
|
|
52
|
+
this.hasTypesIncluded.set(name, hasTypesIncluded);
|
|
53
53
|
}
|
|
54
54
|
const ignoreDependencies = id.flatMap(id => filterIsProduction(id, this.isProduction)).map(toRegexOrString);
|
|
55
55
|
const ignoreBinaries = ib.flatMap(ib => filterIsProduction(ib, this.isProduction)).map(toRegexOrString);
|
|
@@ -100,18 +100,6 @@ export class DependencyDeputy {
|
|
|
100
100
|
this.dependencyCache.set(workspaceName, deps);
|
|
101
101
|
return deps;
|
|
102
102
|
}
|
|
103
|
-
setInstalledBinaries(workspaceName, installedBinaries) {
|
|
104
|
-
this.installedBinaries.set(workspaceName, installedBinaries);
|
|
105
|
-
}
|
|
106
|
-
getInstalledBinaries(workspaceName) {
|
|
107
|
-
return this.installedBinaries.get(workspaceName);
|
|
108
|
-
}
|
|
109
|
-
setHasTypesIncluded(workspaceName, hasTypesIncluded) {
|
|
110
|
-
this.hasTypesIncluded.set(workspaceName, hasTypesIncluded);
|
|
111
|
-
}
|
|
112
|
-
getHasTypesIncluded(workspaceName) {
|
|
113
|
-
return this.hasTypesIncluded.get(workspaceName);
|
|
114
|
-
}
|
|
115
103
|
addReferencedDependency(workspaceName, packageName) {
|
|
116
104
|
if (!this.referencedDependencies.has(workspaceName)) {
|
|
117
105
|
this.referencedDependencies.set(workspaceName, new Set());
|
|
@@ -182,7 +170,7 @@ export class DependencyDeputy {
|
|
|
182
170
|
this.addReferencedBinary(workspace.name, binaryName);
|
|
183
171
|
const workspaceNames = this.isStrict ? [workspace.name] : [workspace.name, ...[...workspace.ancestors].reverse()];
|
|
184
172
|
for (const name of workspaceNames) {
|
|
185
|
-
const binaries = this.
|
|
173
|
+
const binaries = this.installedBinaries.get(name);
|
|
186
174
|
if (binaries?.has(binaryName)) {
|
|
187
175
|
const dependencies = binaries.get(binaryName);
|
|
188
176
|
if (dependencies?.size) {
|
|
@@ -210,7 +198,7 @@ export class DependencyDeputy {
|
|
|
210
198
|
const optionalPeerDependencyIssues = [];
|
|
211
199
|
for (const [workspace, { manifestPath: filePath, manifestStr }] of this._manifests) {
|
|
212
200
|
const referencedDependencies = this.referencedDependencies.get(workspace);
|
|
213
|
-
const hasTypesIncluded = this.
|
|
201
|
+
const hasTypesIncluded = this.hasTypesIncluded.get(workspace);
|
|
214
202
|
const peeker = new PackagePeeker(manifestStr);
|
|
215
203
|
const isReferencedDependency = (dependency, visited = new Set()) => {
|
|
216
204
|
if (referencedDependencies?.has(dependency))
|
package/dist/IssueCollector.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare class IssueCollector {
|
|
|
22
22
|
private unusedIgnoreFilesPatterns;
|
|
23
23
|
constructor(options: MainOptions);
|
|
24
24
|
setWorkspaceFilter(workspaceFilePathFilter: WorkspaceFilePathFilter | undefined): void;
|
|
25
|
+
private collectIgnorePatterns;
|
|
25
26
|
addIgnorePatterns(entries: {
|
|
26
27
|
pattern: string;
|
|
27
28
|
id: string;
|
package/dist/IssueCollector.js
CHANGED
|
@@ -40,37 +40,27 @@ export class IssueCollector {
|
|
|
40
40
|
if (workspaceFilePathFilter)
|
|
41
41
|
this.workspaceFilter = workspaceFilePathFilter;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
collectIgnorePatterns(entries, patterns, unused, type) {
|
|
44
44
|
for (const entry of entries) {
|
|
45
|
-
|
|
45
|
+
patterns.add(entry.pattern);
|
|
46
46
|
if (!this.isTrackUnusedIgnorePatterns)
|
|
47
47
|
continue;
|
|
48
48
|
if (entry.pattern.startsWith('!'))
|
|
49
49
|
continue;
|
|
50
|
-
if (
|
|
50
|
+
if (unused.has(entry.pattern))
|
|
51
51
|
continue;
|
|
52
|
-
|
|
53
|
-
hint: { type
|
|
52
|
+
unused.set(entry.pattern, {
|
|
53
|
+
hint: { type, identifier: entry.id, workspaceName: entry.workspaceName },
|
|
54
54
|
isMatch: picomatch(entry.pattern, { dot: true }),
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
return createMatcher(patterns);
|
|
58
|
+
}
|
|
59
|
+
addIgnorePatterns(entries) {
|
|
60
|
+
this.isMatch = this.collectIgnorePatterns(entries, this.ignorePatterns, this.unusedIgnorePatterns, 'ignore');
|
|
58
61
|
}
|
|
59
62
|
addIgnoreFilesPatterns(entries) {
|
|
60
|
-
|
|
61
|
-
this.ignoreFilesPatterns.add(entry.pattern);
|
|
62
|
-
if (!this.isTrackUnusedIgnorePatterns)
|
|
63
|
-
continue;
|
|
64
|
-
if (entry.pattern.startsWith('!'))
|
|
65
|
-
continue;
|
|
66
|
-
if (this.unusedIgnoreFilesPatterns.has(entry.pattern))
|
|
67
|
-
continue;
|
|
68
|
-
this.unusedIgnoreFilesPatterns.set(entry.pattern, {
|
|
69
|
-
hint: { type: 'ignoreFiles', identifier: entry.id, workspaceName: entry.workspaceName },
|
|
70
|
-
isMatch: picomatch(entry.pattern, { dot: true }),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
this.isFileMatch = createMatcher(this.ignoreFilesPatterns);
|
|
63
|
+
this.isFileMatch = this.collectIgnorePatterns(entries, this.ignoreFilesPatterns, this.unusedIgnoreFilesPatterns, 'ignoreFiles');
|
|
74
64
|
}
|
|
75
65
|
markUsedPatterns(filePath, unused) {
|
|
76
66
|
if (unused.size === 0)
|
package/dist/IssueFixer.js
CHANGED
|
@@ -100,22 +100,17 @@ class IssueFixer {
|
|
|
100
100
|
for (const filePath of filePaths) {
|
|
101
101
|
const absFilePath = join(this.options.cwd, filePath);
|
|
102
102
|
const pkg = await load(absFilePath);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
const removeDependencies = (key) => {
|
|
104
|
+
const deps = pkg[key];
|
|
105
|
+
if (!deps || !(filePath in issues[key]))
|
|
106
|
+
return;
|
|
107
|
+
for (const dependency of Object.keys(issues[key][filePath])) {
|
|
108
|
+
delete deps[dependency];
|
|
109
|
+
issues[key][filePath][dependency].isFixed = true;
|
|
109
110
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (pkg.devDependencies) {
|
|
114
|
-
delete pkg.devDependencies[dependency];
|
|
115
|
-
issues.devDependencies[filePath][dependency].isFixed = true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
111
|
+
};
|
|
112
|
+
removeDependencies('dependencies');
|
|
113
|
+
removeDependencies('devDependencies');
|
|
119
114
|
await save(absFilePath, pkg);
|
|
120
115
|
touchedFiles.add(absFilePath);
|
|
121
116
|
}
|
|
@@ -18,7 +18,6 @@ export declare class ProjectPrincipal {
|
|
|
18
18
|
syncCompilers: SyncCompilers;
|
|
19
19
|
asyncCompilers: AsyncCompilers;
|
|
20
20
|
private paths;
|
|
21
|
-
private rootDirs;
|
|
22
21
|
private extensions;
|
|
23
22
|
cache: CacheConsultant<FileNode>;
|
|
24
23
|
toSourceFilePath: ToSourceFilePath;
|
|
@@ -31,7 +30,6 @@ export declare class ProjectPrincipal {
|
|
|
31
30
|
constructor(options: MainOptions, toSourceFilePath: ToSourceFilePath, findWorkspaceManifestImports?: WorkspaceManifestHandler);
|
|
32
31
|
addCompilers(compilers: [SyncCompilers, AsyncCompilers]): void;
|
|
33
32
|
addPaths(paths: Paths, basePath: string): void;
|
|
34
|
-
addRootDirs(rootDirs: string[]): void;
|
|
35
33
|
init(): void;
|
|
36
34
|
readFile(filePath: string): string;
|
|
37
35
|
private hasAcceptedExtension;
|
package/dist/ProjectPrincipal.js
CHANGED
|
@@ -27,7 +27,6 @@ export class ProjectPrincipal {
|
|
|
27
27
|
syncCompilers = new Map();
|
|
28
28
|
asyncCompilers = new Map();
|
|
29
29
|
paths = {};
|
|
30
|
-
rootDirs = [];
|
|
31
30
|
extensions = new Set(DEFAULT_EXTENSIONS);
|
|
32
31
|
cache;
|
|
33
32
|
toSourceFilePath;
|
|
@@ -74,12 +73,6 @@ export class ProjectPrincipal {
|
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
addRootDirs(rootDirs) {
|
|
78
|
-
for (const dir of rootDirs) {
|
|
79
|
-
if (!this.rootDirs.includes(dir))
|
|
80
|
-
this.rootDirs.push(dir);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
76
|
init() {
|
|
84
77
|
this.extensions = new Set([
|
|
85
78
|
...DEFAULT_EXTENSIONS,
|
|
@@ -87,8 +80,7 @@ export class ProjectPrincipal {
|
|
|
87
80
|
]);
|
|
88
81
|
const customCompilerExtensions = getCompilerExtensions([this.syncCompilers, this.asyncCompilers]);
|
|
89
82
|
const pathsOrUndefined = Object.keys(this.paths).length > 0 ? this.paths : undefined;
|
|
90
|
-
|
|
91
|
-
this.resolveModule = createCustomModuleResolver({ paths: pathsOrUndefined, rootDirs: rootDirsOrUndefined }, customCompilerExtensions, this.toSourceFilePath, this.findWorkspaceManifestImports);
|
|
83
|
+
this.resolveModule = createCustomModuleResolver({ paths: pathsOrUndefined }, customCompilerExtensions, this.toSourceFilePath, this.findWorkspaceManifestImports);
|
|
92
84
|
}
|
|
93
85
|
readFile(filePath) {
|
|
94
86
|
return this.fileManager.readFile(filePath);
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -322,6 +322,7 @@ export class WorkspaceWorker {
|
|
|
322
322
|
configFileName: basename(configFilePath),
|
|
323
323
|
};
|
|
324
324
|
const cache = {};
|
|
325
|
+
let hasLoadConfigError = false;
|
|
325
326
|
const key = `${wsName}:${pluginName}`;
|
|
326
327
|
if (plugin.resolveConfig && !seen.get(key)?.has(configFilePath)) {
|
|
327
328
|
if (parsed && isExternalReExportsOnly(parsed)) {
|
|
@@ -345,6 +346,7 @@ export class WorkspaceWorker {
|
|
|
345
346
|
catch (error) {
|
|
346
347
|
if (!(error instanceof Error))
|
|
347
348
|
throw error;
|
|
349
|
+
hasLoadConfigError = true;
|
|
348
350
|
const relPath = toRelative(configFilePath, this.options.cwd);
|
|
349
351
|
const cause = formatCauseMessage(error, this.options.cwd);
|
|
350
352
|
logError(`Error loading ${relPath} (${cause})`);
|
|
@@ -364,7 +366,10 @@ export class WorkspaceWorker {
|
|
|
364
366
|
inputs.push(toEntry(configFilePath));
|
|
365
367
|
storeConfigFilePath(pluginName, toConfig(pluginName, configFilePath));
|
|
366
368
|
cache.configFile = toEntry(configFilePath);
|
|
367
|
-
if (
|
|
369
|
+
if (hasLoadConfigError) {
|
|
370
|
+
this.cache.removeEntry(configFilePath);
|
|
371
|
+
}
|
|
372
|
+
else if (fd?.changed && fd.meta && !seen.get(key)?.has(configFilePath)) {
|
|
368
373
|
fd.meta.data = cache;
|
|
369
374
|
}
|
|
370
375
|
if (!seen.has(key))
|
package/dist/cli.js
CHANGED
|
@@ -50,6 +50,7 @@ const main = async () => {
|
|
|
50
50
|
isProduction: options.isProduction,
|
|
51
51
|
isShowProgress: options.isShowProgress,
|
|
52
52
|
isTreatConfigHintsAsErrors: options.isTreatConfigHintsAsErrors,
|
|
53
|
+
isTreatTagHintsAsErrors: options.isTreatTagHintsAsErrors,
|
|
53
54
|
maxShowIssues: args['max-show-issues'] ? Number(args['max-show-issues']) : undefined,
|
|
54
55
|
options: args['reporter-options'] ?? '',
|
|
55
56
|
preprocessorOptions: args['preprocessor-options'] ?? '',
|
|
@@ -75,7 +76,8 @@ const main = async () => {
|
|
|
75
76
|
}
|
|
76
77
|
if (!args['no-exit-code'] &&
|
|
77
78
|
(totalErrorCount > Number(args['max-issues'] ?? 0) ||
|
|
78
|
-
(!options.isDisableConfigHints && options.isTreatConfigHintsAsErrors && configurationHints.length > 0)
|
|
79
|
+
(!options.isDisableConfigHints && options.isTreatConfigHintsAsErrors && configurationHints.length > 0) ||
|
|
80
|
+
(!options.isDisableTagHints && options.isTreatTagHintsAsErrors && tagHints.size > 0))) {
|
|
79
81
|
process.exitCode = 1;
|
|
80
82
|
return;
|
|
81
83
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { CompilerSync } from './types.ts';
|
|
2
2
|
export declare const fencedCodeBlockMatcher: RegExp;
|
|
3
3
|
export declare const inlineCodeMatcher: RegExp;
|
|
4
|
+
export declare const scriptExtractor: RegExp;
|
|
5
|
+
export declare const blockCommentMatcher: RegExp;
|
|
6
|
+
export declare const lineCommentMatcher: RegExp;
|
|
4
7
|
export declare const importMatcher: RegExp;
|
|
5
8
|
export declare const importsWithinScripts: CompilerSync;
|
|
6
9
|
export declare const scriptBodies: CompilerSync;
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
export const fencedCodeBlockMatcher = /```[\s\S]*?```/g;
|
|
2
2
|
export const inlineCodeMatcher = /`[^`]+`/g;
|
|
3
|
-
const scriptExtractor = /<script\b(?:[^>"']|"[^"]*"|'[^']*')
|
|
4
|
-
const blockCommentMatcher = /\/\*[\s\S]*?\*\//g;
|
|
5
|
-
const lineCommentMatcher = /^[ \t]*\/\/.*$/gm;
|
|
3
|
+
export const scriptExtractor = /<script\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/script>/gi;
|
|
4
|
+
export const blockCommentMatcher = /\/\*[\s\S]*?\*\//g;
|
|
5
|
+
export const lineCommentMatcher = /^[ \t]*\/\/.*$/gm;
|
|
6
6
|
export const importMatcher = /import(?:\s*\(\s*['"][^'"]+['"][^)]*\)|(?!\s*\()[^'"]+['"][^'"]+['"])/g;
|
|
7
7
|
export const importsWithinScripts = (text) => {
|
|
8
8
|
const scripts = [];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
for (const importMatch of body.matchAll(importMatcher)) {
|
|
9
|
+
for (const [, , scriptBody] of text.matchAll(scriptExtractor)) {
|
|
10
|
+
const body = scriptBody.replace(blockCommentMatcher, '').replace(lineCommentMatcher, '');
|
|
11
|
+
for (const importMatch of body.matchAll(importMatcher))
|
|
13
12
|
scripts.push(importMatch);
|
|
14
|
-
}
|
|
15
13
|
}
|
|
16
14
|
return scripts.join(';\n');
|
|
17
15
|
};
|
|
18
|
-
const scriptBodyExtractor = /<script\b(?:[^>"']|"[^"]*"|'[^']*')*>(?<body>[\s\S]*?)<\/script>/gm;
|
|
19
16
|
export const scriptBodies = (text) => {
|
|
20
17
|
const scripts = [];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
scripts.push(scriptMatch.groups.body);
|
|
18
|
+
for (const [, , body] of text.matchAll(scriptExtractor)) {
|
|
19
|
+
if (body)
|
|
20
|
+
scripts.push(body);
|
|
25
21
|
}
|
|
26
22
|
return scripts.join(';\n');
|
|
27
23
|
};
|
|
@@ -278,6 +278,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
278
278
|
entry?: string | string[] | undefined;
|
|
279
279
|
project?: string | string[] | undefined;
|
|
280
280
|
} | undefined;
|
|
281
|
+
'nano-spawn'?: string | boolean | string[] | {
|
|
282
|
+
config?: string | string[] | undefined;
|
|
283
|
+
entry?: string | string[] | undefined;
|
|
284
|
+
project?: string | string[] | undefined;
|
|
285
|
+
} | undefined;
|
|
281
286
|
'nano-staged'?: string | boolean | string[] | {
|
|
282
287
|
config?: string | string[] | undefined;
|
|
283
288
|
entry?: string | string[] | undefined;
|
|
@@ -358,6 +363,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
358
363
|
entry?: string | string[] | undefined;
|
|
359
364
|
project?: string | string[] | undefined;
|
|
360
365
|
} | undefined;
|
|
366
|
+
orval?: string | boolean | string[] | {
|
|
367
|
+
config?: string | string[] | undefined;
|
|
368
|
+
entry?: string | string[] | undefined;
|
|
369
|
+
project?: string | string[] | undefined;
|
|
370
|
+
} | undefined;
|
|
361
371
|
oxfmt?: string | boolean | string[] | {
|
|
362
372
|
config?: string | string[] | undefined;
|
|
363
373
|
entry?: string | string[] | undefined;
|
|
@@ -771,6 +781,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
771
781
|
compilers?: Record<string, true | CompilerAsync | CompilerSync> | undefined;
|
|
772
782
|
tags?: string[] | undefined;
|
|
773
783
|
treatConfigHintsAsErrors?: boolean | undefined;
|
|
784
|
+
treatTagHintsAsErrors?: boolean | undefined;
|
|
774
785
|
include?: ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
775
786
|
exclude?: ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
776
787
|
workspaces?: Record<string, {
|
|
@@ -1049,6 +1060,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1049
1060
|
entry?: string | string[] | undefined;
|
|
1050
1061
|
project?: string | string[] | undefined;
|
|
1051
1062
|
} | undefined;
|
|
1063
|
+
'nano-spawn'?: string | boolean | string[] | {
|
|
1064
|
+
config?: string | string[] | undefined;
|
|
1065
|
+
entry?: string | string[] | undefined;
|
|
1066
|
+
project?: string | string[] | undefined;
|
|
1067
|
+
} | undefined;
|
|
1052
1068
|
'nano-staged'?: string | boolean | string[] | {
|
|
1053
1069
|
config?: string | string[] | undefined;
|
|
1054
1070
|
entry?: string | string[] | undefined;
|
|
@@ -1129,6 +1145,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1129
1145
|
entry?: string | string[] | undefined;
|
|
1130
1146
|
project?: string | string[] | undefined;
|
|
1131
1147
|
} | undefined;
|
|
1148
|
+
orval?: string | boolean | string[] | {
|
|
1149
|
+
config?: string | string[] | undefined;
|
|
1150
|
+
entry?: string | string[] | undefined;
|
|
1151
|
+
project?: string | string[] | undefined;
|
|
1152
|
+
} | undefined;
|
|
1132
1153
|
oxfmt?: string | boolean | string[] | {
|
|
1133
1154
|
config?: string | string[] | undefined;
|
|
1134
1155
|
entry?: string | string[] | undefined;
|
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
|
@@ -245,7 +245,13 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
245
245
|
await analyzeGraph();
|
|
246
246
|
perfObserver.addMemoryMark('analyze');
|
|
247
247
|
if (options.isTrace) {
|
|
248
|
-
traceReporter({
|
|
248
|
+
traceReporter({
|
|
249
|
+
graph,
|
|
250
|
+
explorer,
|
|
251
|
+
options,
|
|
252
|
+
workspaceFilePathFilter: chief.workspaceFilePathFilter,
|
|
253
|
+
issues: collector.getIssues().issues,
|
|
254
|
+
});
|
|
249
255
|
}
|
|
250
256
|
return analyzeGraph;
|
|
251
257
|
};
|
package/dist/graph/build.js
CHANGED
|
@@ -129,8 +129,6 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
129
129
|
for (const dep of getManifestImportDependencies(manifest))
|
|
130
130
|
deputy.addReferencedDependency(name, dep);
|
|
131
131
|
principal.addPaths(config.paths, dir);
|
|
132
|
-
if (compilerOptions.rootDirs)
|
|
133
|
-
principal.addRootDirs(compilerOptions.rootDirs);
|
|
134
132
|
const inputsFromPlugins = await worker.runPlugins();
|
|
135
133
|
for (const id of inputsFromPlugins)
|
|
136
134
|
inputs.add(Object.assign(id, { skipExportsAnalysis: !id.allowIncludeExports }));
|
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) {
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const Plugins: {
|
|
|
59
59
|
mocha: import("../types/config.ts").Plugin;
|
|
60
60
|
moonrepo: import("../types/config.ts").Plugin;
|
|
61
61
|
msw: import("../types/config.ts").Plugin;
|
|
62
|
+
'nano-spawn': import("../types/config.ts").Plugin;
|
|
62
63
|
'nano-staged': import("../types/config.ts").Plugin;
|
|
63
64
|
nest: import("../types/config.ts").Plugin;
|
|
64
65
|
netlify: import("../types/config.ts").Plugin;
|
|
@@ -75,6 +76,7 @@ export declare const Plugins: {
|
|
|
75
76
|
nyc: import("../types/config.ts").Plugin;
|
|
76
77
|
oclif: import("../types/config.ts").Plugin;
|
|
77
78
|
'openapi-ts': import("../types/config.ts").Plugin;
|
|
79
|
+
orval: import("../types/config.ts").Plugin;
|
|
78
80
|
oxfmt: import("../types/config.ts").Plugin;
|
|
79
81
|
oxlint: import("../types/config.ts").Plugin;
|
|
80
82
|
'panda-css': import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -53,6 +53,7 @@ import { default as metro } from './metro/index.js';
|
|
|
53
53
|
import { default as mocha } from './mocha/index.js';
|
|
54
54
|
import { default as moonrepo } from './moonrepo/index.js';
|
|
55
55
|
import { default as msw } from './msw/index.js';
|
|
56
|
+
import { default as nanoSpawn } from './nano-spawn/index.js';
|
|
56
57
|
import { default as nanoStaged } from './nano-staged/index.js';
|
|
57
58
|
import { default as nest } from './nest/index.js';
|
|
58
59
|
import { default as netlify } from './netlify/index.js';
|
|
@@ -69,6 +70,7 @@ import { default as nx } from './nx/index.js';
|
|
|
69
70
|
import { default as nyc } from './nyc/index.js';
|
|
70
71
|
import { default as oclif } from './oclif/index.js';
|
|
71
72
|
import { default as openapiTs } from './openapi-ts/index.js';
|
|
73
|
+
import { default as orval } from './orval/index.js';
|
|
72
74
|
import { default as oxfmt } from './oxfmt/index.js';
|
|
73
75
|
import { default as oxlint } from './oxlint/index.js';
|
|
74
76
|
import { default as pandaCss } from './panda-css/index.js';
|
|
@@ -204,6 +206,7 @@ export const Plugins = {
|
|
|
204
206
|
mocha,
|
|
205
207
|
moonrepo,
|
|
206
208
|
msw,
|
|
209
|
+
'nano-spawn': nanoSpawn,
|
|
207
210
|
'nano-staged': nanoStaged,
|
|
208
211
|
nest,
|
|
209
212
|
netlify,
|
|
@@ -220,6 +223,7 @@ export const Plugins = {
|
|
|
220
223
|
nyc,
|
|
221
224
|
oclif,
|
|
222
225
|
'openapi-ts': openapiTs,
|
|
226
|
+
orval,
|
|
223
227
|
oxfmt,
|
|
224
228
|
oxlint,
|
|
225
229
|
'panda-css': pandaCss,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
import { createNanoSpawnVisitor } from './visitors/nano-spawn.js';
|
|
3
|
+
const title = 'nano-spawn';
|
|
4
|
+
const enablers = ['nano-spawn'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
7
|
+
registerVisitor(createNanoSpawnVisitor(ctx));
|
|
8
|
+
};
|
|
9
|
+
const plugin = {
|
|
10
|
+
title,
|
|
11
|
+
enablers,
|
|
12
|
+
isEnabled,
|
|
13
|
+
registerVisitors,
|
|
14
|
+
};
|
|
15
|
+
export default plugin;
|