knip 6.26.0 → 6.27.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 +6 -0
- package/dist/DependencyDeputy.d.ts +1 -1
- package/dist/DependencyDeputy.js +2 -2
- package/dist/ProjectPrincipal.d.ts +3 -3
- package/dist/ProjectPrincipal.js +4 -4
- package/dist/binaries/fallback.js +5 -1
- package/dist/binaries/resolvers/bun.js +13 -5
- package/dist/binaries/resolvers/npm.js +4 -2
- package/dist/binaries/resolvers/pnpm.js +11 -1
- package/dist/binaries/resolvers/yarn.js +10 -4
- package/dist/binaries/util.d.ts +4 -0
- package/dist/binaries/util.js +14 -0
- package/dist/compilers/index.d.ts +10 -0
- package/dist/compilers/less.js +1 -1
- package/dist/compilers/scss.js +1 -1
- package/dist/compilers/stylus.js +1 -1
- package/dist/constants.js +6 -0
- package/dist/graph/analyze.js +1 -1
- package/dist/graph/build.js +16 -4
- package/dist/plugins/_vue/auto-import.js +64 -4
- package/dist/plugins/_vue/types.d.ts +18 -11
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/react-email/index.js +1 -0
- package/dist/plugins/tailwind/compiler.js +9 -4
- package/dist/plugins/tanstack-router/index.js +3 -1
- package/dist/plugins/temporal/index.d.ts +3 -0
- package/dist/plugins/temporal/index.js +12 -0
- package/dist/plugins/tsdown/index.js +15 -3
- package/dist/plugins/tsdown/types.d.ts +4 -1
- package/dist/plugins/vitest/index.js +15 -0
- package/dist/plugins/vitest/types.d.ts +5 -0
- package/dist/run.js +3 -3
- package/dist/schema/configuration.d.ts +15 -0
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/typescript/ast-nodes.d.ts +1 -0
- package/dist/typescript/get-imports-and-exports.js +8 -5
- package/dist/typescript/resolve-module-names.d.ts +2 -2
- package/dist/typescript/resolve-module-names.js +97 -18
- package/dist/typescript/visitors/walk.d.ts +2 -1
- package/dist/typescript/visitors/walk.js +13 -2
- package/dist/util/create-input-handler.js +8 -1
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/package-json.d.ts +7 -0
- package/dist/util/package-json.js +37 -0
- package/dist/util/resolve.d.ts +1 -0
- package/dist/util/resolve.js +1 -1
- package/dist/util/to-source-path.d.ts +4 -3
- package/dist/util/to-source-path.js +22 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +4 -0
|
@@ -757,6 +757,11 @@ export declare class ConfigurationChief {
|
|
|
757
757
|
entry?: string | string[] | undefined;
|
|
758
758
|
project?: string | string[] | undefined;
|
|
759
759
|
} | undefined;
|
|
760
|
+
temporal?: string | boolean | string[] | {
|
|
761
|
+
config?: string | string[] | undefined;
|
|
762
|
+
entry?: string | string[] | undefined;
|
|
763
|
+
project?: string | string[] | undefined;
|
|
764
|
+
} | undefined;
|
|
760
765
|
travis?: string | boolean | string[] | {
|
|
761
766
|
config?: string | string[] | undefined;
|
|
762
767
|
entry?: string | string[] | undefined;
|
|
@@ -1104,6 +1109,7 @@ export declare class ConfigurationChief {
|
|
|
1104
1109
|
"tanstack-router"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
1105
1110
|
taskfile?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
1106
1111
|
tauri?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
1112
|
+
temporal?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
1107
1113
|
travis?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
1108
1114
|
"ts-node"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
1109
1115
|
tsdown?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -58,7 +58,7 @@ export declare class DependencyDeputy {
|
|
|
58
58
|
isPeerOptional: boolean;
|
|
59
59
|
}[];
|
|
60
60
|
getOptionalPeerDependencies(workspaceName: string): DependencySet;
|
|
61
|
-
maybeAddReferencedExternalDependency(workspace: Workspace, packageName: string, isDevOnly?: boolean, isTypeOnly?: boolean): boolean;
|
|
61
|
+
maybeAddReferencedExternalDependency(workspace: Workspace, packageName: string, isDevOnly?: boolean, isTypeOnly?: boolean, isResolved?: boolean): boolean;
|
|
62
62
|
maybeAddReferencedBinary(workspace: Workspace, binaryName: string): Set<string> | undefined;
|
|
63
63
|
private isInDependencies;
|
|
64
64
|
settleDependencyIssues(): {
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -122,7 +122,7 @@ export class DependencyDeputy {
|
|
|
122
122
|
getOptionalPeerDependencies(workspaceName) {
|
|
123
123
|
return this._manifests.get(workspaceName)?.optionalPeerDependencies ?? new Set();
|
|
124
124
|
}
|
|
125
|
-
maybeAddReferencedExternalDependency(workspace, packageName, isDevOnly, isTypeOnly) {
|
|
125
|
+
maybeAddReferencedExternalDependency(workspace, packageName, isDevOnly, isTypeOnly, isResolved) {
|
|
126
126
|
if (!this.isReportDependencies)
|
|
127
127
|
return true;
|
|
128
128
|
if (isBuiltin(packageName))
|
|
@@ -150,7 +150,7 @@ export class DependencyDeputy {
|
|
|
150
150
|
this.addReferencedDependency(workspace.name, packageName);
|
|
151
151
|
return true;
|
|
152
152
|
}
|
|
153
|
-
if (!this.isStrict) {
|
|
153
|
+
if (!this.isStrict && isResolved !== false) {
|
|
154
154
|
for (const name of workspaceNames) {
|
|
155
155
|
const hosts = this.getHostDependenciesFor(name, packageName);
|
|
156
156
|
if (hosts.length === 0)
|
|
@@ -7,7 +7,7 @@ import type { Paths } from './types/project.ts';
|
|
|
7
7
|
import type { ResolveGlobPattern } from './typescript/resolve-module-names.ts';
|
|
8
8
|
import { SourceFileManager } from './typescript/SourceFileManager.ts';
|
|
9
9
|
import type { MainOptions } from './util/create-options.ts';
|
|
10
|
-
import type { ToSourceFilePath,
|
|
10
|
+
import type { ToSourceFilePath, WorkspacePackageTargetHandler } from './util/to-source-path.ts';
|
|
11
11
|
export declare class ProjectPrincipal {
|
|
12
12
|
entryPaths: Set<string>;
|
|
13
13
|
projectPaths: Set<string>;
|
|
@@ -25,14 +25,14 @@ export declare class ProjectPrincipal {
|
|
|
25
25
|
private extensions;
|
|
26
26
|
cache: CacheConsultant<FileNode>;
|
|
27
27
|
toSourceFilePath: ToSourceFilePath;
|
|
28
|
-
private
|
|
28
|
+
private findWorkspacePackageTarget;
|
|
29
29
|
fileManager: SourceFileManager;
|
|
30
30
|
private resolveModule;
|
|
31
31
|
resolveGlobPattern: ResolveGlobPattern;
|
|
32
32
|
resolvedFiles: Set<string>;
|
|
33
33
|
deletedFiles: Set<string>;
|
|
34
34
|
private onPathAdded;
|
|
35
|
-
constructor(options: MainOptions, toSourceFilePath: ToSourceFilePath,
|
|
35
|
+
constructor(options: MainOptions, toSourceFilePath: ToSourceFilePath, findWorkspacePackageTarget?: WorkspacePackageTargetHandler);
|
|
36
36
|
addCompilers(compilers: [SyncCompilers, AsyncCompilers]): void;
|
|
37
37
|
addPaths(paths: Paths, basePath: string, scope: string): void;
|
|
38
38
|
addRootDirs(rootDirs: string[] | undefined, scope: string): void;
|
package/dist/ProjectPrincipal.js
CHANGED
|
@@ -35,17 +35,17 @@ export class ProjectPrincipal {
|
|
|
35
35
|
extensions = new Set(DEFAULT_EXTENSIONS);
|
|
36
36
|
cache;
|
|
37
37
|
toSourceFilePath;
|
|
38
|
-
|
|
38
|
+
findWorkspacePackageTarget;
|
|
39
39
|
fileManager;
|
|
40
40
|
resolveModule = () => undefined;
|
|
41
41
|
resolveGlobPattern = pattern => [pattern];
|
|
42
42
|
resolvedFiles = new Set();
|
|
43
43
|
deletedFiles = new Set();
|
|
44
44
|
onPathAdded;
|
|
45
|
-
constructor(options, toSourceFilePath,
|
|
45
|
+
constructor(options, toSourceFilePath, findWorkspacePackageTarget) {
|
|
46
46
|
this.cache = new CacheConsultant('root', options);
|
|
47
47
|
this.toSourceFilePath = toSourceFilePath;
|
|
48
|
-
this.
|
|
48
|
+
this.findWorkspacePackageTarget = findWorkspacePackageTarget;
|
|
49
49
|
this.tsConfigFile = options.tsConfigFile ? toAbsolute(options.tsConfigFile, options.cwd) : undefined;
|
|
50
50
|
this.pluginVisitorObjects.push(createBunShellVisitor(this.pluginCtx));
|
|
51
51
|
this.fileManager = new SourceFileManager({
|
|
@@ -91,7 +91,7 @@ export class ProjectPrincipal {
|
|
|
91
91
|
const customCompilerExtensions = getCompilerExtensions([this.syncCompilers, this.asyncCompilers]);
|
|
92
92
|
const scopedPaths = this.paths.size > 0 ? Array.from(this.paths, ([scope, paths]) => ({ scope, paths })) : undefined;
|
|
93
93
|
const scopedRootDirs = this.rootDirs.size > 0 ? Array.from(this.rootDirs, ([scope, rootDirs]) => ({ scope, rootDirs })) : undefined;
|
|
94
|
-
this.resolveModule = createCustomModuleResolver({ scopedPaths, scopedRootDirs }, customCompilerExtensions, this.toSourceFilePath, this.
|
|
94
|
+
this.resolveModule = createCustomModuleResolver({ scopedPaths, scopedRootDirs }, customCompilerExtensions, this.toSourceFilePath, this.findWorkspacePackageTarget, this.tsConfigFile);
|
|
95
95
|
this.resolveGlobPattern = createGlobAliasResolver(scopedPaths);
|
|
96
96
|
}
|
|
97
97
|
readFile(filePath) {
|
|
@@ -7,7 +7,11 @@ const positionals = new Set(['babel-node', 'esbuild', 'execa', 'jiti', 'oxnode',
|
|
|
7
7
|
const positionalBinaries = new Set(['concurrently']);
|
|
8
8
|
export const resolve = (binary, args, { fromArgs }) => {
|
|
9
9
|
const parsed = parseArgs(args, { boolean: ['quiet', 'verbose'], '--': endOfCommandBinaries.includes(binary) });
|
|
10
|
-
const bin = binary.startsWith('.')
|
|
10
|
+
const bin = binary.startsWith('.') || binary.includes('/')
|
|
11
|
+
? toEntry(binary)
|
|
12
|
+
: isValidBinary(binary)
|
|
13
|
+
? toBinary(binary)
|
|
14
|
+
: undefined;
|
|
11
15
|
const pos = positionals.has(binary) ? [toDeferResolve(parsed._[0])] : [];
|
|
12
16
|
const newCommand = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--']) : [];
|
|
13
17
|
const commands = positionalBinaries.has(binary) ? parsed._.flatMap(cmd => fromArgs([cmd])) : [];
|
|
@@ -2,6 +2,7 @@ import parseArgs from '../../util/parse-args.js';
|
|
|
2
2
|
import { toBinary, toEntry } from '../../util/input.js';
|
|
3
3
|
import { isAbsolute, join } from '../../util/path.js';
|
|
4
4
|
import { _resolveSync } from '../../util/resolve.js';
|
|
5
|
+
import { argsAfter, expandScript } from '../util.js';
|
|
5
6
|
import { resolveX } from './bunx.js';
|
|
6
7
|
const commands = new Set([
|
|
7
8
|
'add',
|
|
@@ -59,10 +60,12 @@ export const resolve = (_binary, args, options) => {
|
|
|
59
60
|
return [binary, ...resolveX(argsForX, options)];
|
|
60
61
|
}
|
|
61
62
|
const { manifest, cwd, fromArgs } = options;
|
|
62
|
-
if (command === 'run' && manifest.scriptNames.has(script))
|
|
63
|
-
return [binary];
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
if (command === 'run' && manifest.scriptNames.has(script)) {
|
|
64
|
+
return [binary, ...(expandScript(script, argsAfter(args, script), manifest.scripts, options) ?? [])];
|
|
65
|
+
}
|
|
66
|
+
if (manifest.scriptNames.has(command)) {
|
|
67
|
+
return [binary, ...(expandScript(command, argsAfter(args, command), manifest.scripts, options) ?? [])];
|
|
68
|
+
}
|
|
66
69
|
if (command !== 'run' && commands.has(command))
|
|
67
70
|
return [binary];
|
|
68
71
|
const filePath = command === 'run' ? script : command;
|
|
@@ -74,5 +77,10 @@ export const resolve = (_binary, args, options) => {
|
|
|
74
77
|
return [binary, toEntry(resolved)];
|
|
75
78
|
const dir = parsed.cwd ? join(cwd, parsed.cwd) : undefined;
|
|
76
79
|
const opts = dir ? { cwd: dir } : {};
|
|
77
|
-
|
|
80
|
+
if (command !== 'run')
|
|
81
|
+
return [binary, ...fromArgs(args, opts)];
|
|
82
|
+
const input = toBinary(filePath, { optional: true });
|
|
83
|
+
if (dir)
|
|
84
|
+
input.dir = dir;
|
|
85
|
+
return [binary, input];
|
|
78
86
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
|
+
import { expandScript } from '../util.js';
|
|
2
3
|
export const resolve = (_binary, args, options) => {
|
|
3
4
|
const { fromArgs, manifest } = options;
|
|
4
5
|
const parsed = parseArgs(args, { '--': true });
|
|
@@ -6,7 +7,8 @@ export const resolve = (_binary, args, options) => {
|
|
|
6
7
|
const _childArgs = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--'], { knownBinsOnly: true }) : [];
|
|
7
8
|
if (command === 'exec')
|
|
8
9
|
return _childArgs;
|
|
9
|
-
if (command === 'run' && manifest.scriptNames.has(script))
|
|
10
|
-
return _childArgs;
|
|
10
|
+
if (command === 'run' && manifest.scriptNames.has(script)) {
|
|
11
|
+
return expandScript(script, parsed['--'] ?? [], manifest.scripts, options) ?? _childArgs;
|
|
12
|
+
}
|
|
11
13
|
return [];
|
|
12
14
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
2
|
import { toBinary } from '../../util/input.js';
|
|
3
3
|
import { isValidBinary } from '../../util/modules.js';
|
|
4
|
+
import { argsAfter, expandScript } from '../util.js';
|
|
4
5
|
import { resolveDlx } from './pnpx.js';
|
|
5
6
|
const commands = [
|
|
6
7
|
'add',
|
|
@@ -98,8 +99,17 @@ export const resolve = (_binary, args, options) => {
|
|
|
98
99
|
if (command === 'exec') {
|
|
99
100
|
return childInputs.length > 0 ? childInputs : fromArgs(parsed._.slice(1));
|
|
100
101
|
}
|
|
102
|
+
if (command === 'run') {
|
|
103
|
+
const script = parsed._[1];
|
|
104
|
+
if (script && manifest.scriptNames.has(script)) {
|
|
105
|
+
return expandScript(script, argsAfter(args, script), manifest.scripts, options) ?? childInputs;
|
|
106
|
+
}
|
|
107
|
+
return childInputs;
|
|
108
|
+
}
|
|
101
109
|
const isScript = manifest.scriptNames.has(command);
|
|
102
|
-
if (isScript
|
|
110
|
+
if (isScript)
|
|
111
|
+
return expandScript(command, argsAfter(args, command), manifest.scripts, options) ?? childInputs;
|
|
112
|
+
if (commands.includes(command))
|
|
103
113
|
return childInputs;
|
|
104
114
|
return command && isValidBinary(command) ? [toBinary(command)] : [];
|
|
105
115
|
};
|
|
@@ -2,7 +2,7 @@ import parseArgs from '../../util/parse-args.js';
|
|
|
2
2
|
import { isBinary, isDependency, toBinary, toDependency } from '../../util/input.js';
|
|
3
3
|
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
4
|
import { join } from '../../util/path.js';
|
|
5
|
-
import { argsFrom } from '../util.js';
|
|
5
|
+
import { argsAfter, argsFrom, expandScript } from '../util.js';
|
|
6
6
|
const commands = [
|
|
7
7
|
'add',
|
|
8
8
|
'bin',
|
|
@@ -58,8 +58,10 @@ export const resolve = (_binary, args, options) => {
|
|
|
58
58
|
const dirManifest = (dir && getManifest(dir)) || manifest;
|
|
59
59
|
const _childArgs = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--'], { knownBinsOnly: true }) : [];
|
|
60
60
|
if (command === 'run') {
|
|
61
|
-
if (dirManifest.scriptNames.has(binary))
|
|
62
|
-
|
|
61
|
+
if (dirManifest.scriptNames.has(binary)) {
|
|
62
|
+
const opts = dir ? { cwd: dir, manifest: dirManifest } : {};
|
|
63
|
+
return expandScript(binary, argsAfter(args, binary), dirManifest.scripts, options, opts) ?? _childArgs;
|
|
64
|
+
}
|
|
63
65
|
const bin = toBinary(binary, { optional: true });
|
|
64
66
|
if (dir)
|
|
65
67
|
Object.assign(bin, { dir });
|
|
@@ -71,7 +73,11 @@ export const resolve = (_binary, args, options) => {
|
|
|
71
73
|
const argsForDlx = args.filter(arg => arg !== 'dlx');
|
|
72
74
|
return resolveDlx(argsForDlx, options);
|
|
73
75
|
}
|
|
74
|
-
if (dirManifest.scriptNames.has(command)
|
|
76
|
+
if (dirManifest.scriptNames.has(command)) {
|
|
77
|
+
const opts = dir ? { cwd: dir, manifest: dirManifest } : {};
|
|
78
|
+
return expandScript(command, argsAfter(args, command), dirManifest.scripts, options, opts) ?? _childArgs;
|
|
79
|
+
}
|
|
80
|
+
if (commands.includes(command))
|
|
75
81
|
return _childArgs;
|
|
76
82
|
const opts = dir ? { cwd: dir } : {};
|
|
77
83
|
return fromArgs(argsFrom(args, command === 'exec' ? binary : command), opts);
|
package/dist/binaries/util.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import type { BinaryResolverOptions, GetInputsFromScriptsOptions } from '../types/config.ts';
|
|
2
|
+
import type { Input } from '../util/input.ts';
|
|
1
3
|
export declare const argsFrom: (args: string[], from: string) => string[];
|
|
4
|
+
export declare const argsAfter: (args: string[], token: string) => string[];
|
|
5
|
+
export declare const expandScript: (name: string, forwardedArgs: string[], scripts: Record<string, string> | undefined, options: BinaryResolverOptions, opts?: Partial<GetInputsFromScriptsOptions>) => Input[] | undefined;
|
|
2
6
|
export declare const parseNodeArgs: (args: string[]) => import("../util/parse-args.ts").ParsedArgs;
|
package/dist/binaries/util.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import parseArgs from '../util/parse-args.js';
|
|
2
2
|
export const argsFrom = (args, from) => args.slice(args.indexOf(from));
|
|
3
|
+
export const argsAfter = (args, token) => {
|
|
4
|
+
const index = args.indexOf(token);
|
|
5
|
+
return index === -1 ? [] : args.slice(index + 1).filter(arg => arg !== '--');
|
|
6
|
+
};
|
|
7
|
+
export const expandScript = (name, forwardedArgs, scripts, options, opts = {}) => {
|
|
8
|
+
const source = scripts?.[name];
|
|
9
|
+
if (!source || forwardedArgs.length === 0)
|
|
10
|
+
return;
|
|
11
|
+
const expandedScripts = options.expandedScripts ?? new Set();
|
|
12
|
+
if (expandedScripts.has(name))
|
|
13
|
+
return;
|
|
14
|
+
expandedScripts.add(name);
|
|
15
|
+
return options.fromArgs([source, ...forwardedArgs], { ...opts, expandedScripts });
|
|
16
|
+
};
|
|
3
17
|
export const parseNodeArgs = (args) => parseArgs(args, {
|
|
4
18
|
string: ['r'],
|
|
5
19
|
alias: { require: ['r', 'loader', 'experimental-loader', 'test-reporter', 'watch', 'import'] },
|
|
@@ -703,6 +703,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
703
703
|
entry?: string | string[] | undefined;
|
|
704
704
|
project?: string | string[] | undefined;
|
|
705
705
|
} | undefined;
|
|
706
|
+
temporal?: string | boolean | string[] | {
|
|
707
|
+
config?: string | string[] | undefined;
|
|
708
|
+
entry?: string | string[] | undefined;
|
|
709
|
+
project?: string | string[] | undefined;
|
|
710
|
+
} | undefined;
|
|
706
711
|
travis?: string | boolean | string[] | {
|
|
707
712
|
config?: string | string[] | undefined;
|
|
708
713
|
entry?: string | string[] | undefined;
|
|
@@ -1609,6 +1614,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1609
1614
|
entry?: string | string[] | undefined;
|
|
1610
1615
|
project?: string | string[] | undefined;
|
|
1611
1616
|
} | undefined;
|
|
1617
|
+
temporal?: string | boolean | string[] | {
|
|
1618
|
+
config?: string | string[] | undefined;
|
|
1619
|
+
entry?: string | string[] | undefined;
|
|
1620
|
+
project?: string | string[] | undefined;
|
|
1621
|
+
} | undefined;
|
|
1612
1622
|
travis?: string | boolean | string[] | {
|
|
1613
1623
|
config?: string | string[] | undefined;
|
|
1614
1624
|
entry?: string | string[] | undefined;
|
package/dist/compilers/less.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isScopedPackage, isTildePackage, splitSpec } from './shared.js';
|
|
2
2
|
const dependencies = ['less'];
|
|
3
|
-
const importMatcher =
|
|
3
|
+
const importMatcher = /"(?:\\(?:\r\n|[\s\S]|$)|[^"\\\r\n\f])*(?:"|[\r\n\f]|$)|'(?:\\(?:\r\n|[\s\S]|$)|[^'\\\r\n\f])*(?:'|[\r\n\f]|$)|\/\*[\s\S]*?(?:\*\/|$)|@import\s+(?:\([^)]*\)\s+)?(?:url\(\s*['"]?([^'")\s]+)['"]?\s*\)|['"]([^'"]+)['"])/g;
|
|
4
4
|
const isExternalUrl = (s) => s.startsWith('//') || s.startsWith('http://') || s.startsWith('https://');
|
|
5
5
|
const candidates = (specifier) => {
|
|
6
6
|
const { dir, name } = splitSpec(specifier);
|
package/dist/compilers/scss.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isScopedPackage, isTildePackage, splitSpec } from './shared.js';
|
|
2
2
|
const dependencies = ['sass', 'sass-embedded', 'node-sass'];
|
|
3
|
-
const importMatcher =
|
|
3
|
+
const importMatcher = /"(?:\\(?:\r\n|[\s\S]|$)|[^"\\\r\n\f])*(?:"|[\r\n\f]|$)|'(?:\\(?:\r\n|[\s\S]|$)|[^'\\\r\n\f])*(?:'|[\r\n\f]|$)|\/\*[\s\S]*?(?:\*\/|$)|@(?:use|import|forward)\s+['"](pkg:)?([^'"]+)['"]/g;
|
|
4
4
|
const candidates = (specifier) => {
|
|
5
5
|
const { dir, name } = splitSpec(specifier);
|
|
6
6
|
const hasExt = name.endsWith('.scss') || name.endsWith('.sass');
|
package/dist/compilers/stylus.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isScopedPackage, isTildePackage, splitSpec } from './shared.js';
|
|
2
2
|
const dependencies = ['stylus'];
|
|
3
|
-
const importMatcher =
|
|
3
|
+
const importMatcher = /"(?:\\(?:\r\n|[\s\S]|$)|[^"\\\r\n\f])*(?:"|[\r\n\f]|$)|'(?:\\(?:\r\n|[\s\S]|$)|[^'\\\r\n\f])*(?:'|[\r\n\f]|$)|\/\*[\s\S]*?(?:\*\/|$)|@(?:import|require)\s+['"]([^'"]+)['"]/g;
|
|
4
4
|
const candidates = (specifier) => {
|
|
5
5
|
const { dir, name } = splitSpec(specifier);
|
|
6
6
|
if (name.endsWith('.styl') || name.endsWith('.stylus') || name.endsWith('.css'))
|
package/dist/constants.js
CHANGED
|
@@ -36,6 +36,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
36
36
|
'chmod',
|
|
37
37
|
'chown',
|
|
38
38
|
'cksum',
|
|
39
|
+
'claude',
|
|
39
40
|
'clear',
|
|
40
41
|
'cmd',
|
|
41
42
|
'cmd.exe',
|
|
@@ -77,6 +78,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
77
78
|
'id',
|
|
78
79
|
'join',
|
|
79
80
|
'kill',
|
|
81
|
+
'launchctl',
|
|
80
82
|
'ln',
|
|
81
83
|
'logname',
|
|
82
84
|
'ls',
|
|
@@ -102,6 +104,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
102
104
|
'powershell.exe',
|
|
103
105
|
'pr',
|
|
104
106
|
'printenv',
|
|
107
|
+
'pulumi',
|
|
105
108
|
'pwd',
|
|
106
109
|
'python',
|
|
107
110
|
'python3',
|
|
@@ -125,12 +128,15 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
125
128
|
'stty',
|
|
126
129
|
'sudo',
|
|
127
130
|
'sync',
|
|
131
|
+
'systemctl',
|
|
128
132
|
'tac',
|
|
129
133
|
'tar',
|
|
130
134
|
'tee',
|
|
131
135
|
'test',
|
|
132
136
|
'time',
|
|
133
137
|
'timeout',
|
|
138
|
+
'tmux',
|
|
139
|
+
'tmuxinator',
|
|
134
140
|
'touch',
|
|
135
141
|
'trap',
|
|
136
142
|
'tr',
|
package/dist/graph/analyze.js
CHANGED
|
@@ -193,7 +193,7 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
193
193
|
for (const extImport of file.imports.external) {
|
|
194
194
|
const packageName = getPackageNameFromModuleSpecifier(extImport.specifier);
|
|
195
195
|
const isHandled = packageName &&
|
|
196
|
-
deputy.maybeAddReferencedExternalDependency(ws, packageName, undefined, extImport.isTypeOnly);
|
|
196
|
+
deputy.maybeAddReferencedExternalDependency(ws, packageName, undefined, extImport.isTypeOnly, extImport.filePath !== undefined);
|
|
197
197
|
if (!isHandled)
|
|
198
198
|
collector.addIssue({
|
|
199
199
|
type: 'unlisted',
|
package/dist/graph/build.js
CHANGED
|
@@ -18,6 +18,7 @@ import { getPackageNameFromModuleSpecifier, isStartsLikePackageName, sanitizeSpe
|
|
|
18
18
|
import { perfObserver } from '../util/Performance.js';
|
|
19
19
|
import { getEntrySpecifiersFromManifest, getManifestImportDependencies } from '../util/package-json.js';
|
|
20
20
|
import { dirname, extname, isAbsolute, isInNodeModules, join, relative } from '../util/path.js';
|
|
21
|
+
import { extensionAlias } from '../util/resolve.js';
|
|
21
22
|
import { augmentWorkspace, getToSourcePathsHandler, toSourceMappedSpecifiers } from '../util/to-source-path.js';
|
|
22
23
|
import { WorkspaceWorker } from '../WorkspaceWorker.js';
|
|
23
24
|
export async function build({ chief, collector, counselor, deputy, principal, isGitIgnored, streamer, workspaces, options, }) {
|
|
@@ -331,10 +332,21 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
331
332
|
file.imports.external.add({ ...unresolvedImport, specifier: sanitizedSpecifier });
|
|
332
333
|
}
|
|
333
334
|
else {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
335
|
+
const candidate = join(dirname(filePath), sanitizedSpecifier);
|
|
336
|
+
const ext = extname(sanitizedSpecifier);
|
|
337
|
+
const aliases = extensionAlias[ext];
|
|
338
|
+
let isIgnored = isGitIgnored(candidate);
|
|
339
|
+
if (!isIgnored && aliases) {
|
|
340
|
+
const basePath = candidate.slice(0, -ext.length);
|
|
341
|
+
for (const alias of aliases) {
|
|
342
|
+
if (alias !== ext && isGitIgnored(basePath + alias)) {
|
|
343
|
+
isIgnored = true;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (!isIgnored && (!ext || (ext !== '.json' && !FOREIGN_FILE_EXTENSIONS.has(ext)))) {
|
|
349
|
+
unresolvedImports.add(unresolvedImport);
|
|
338
350
|
}
|
|
339
351
|
}
|
|
340
352
|
}
|
|
@@ -9,7 +9,26 @@ import { _syncGlob } from '../../util/glob.js';
|
|
|
9
9
|
import { dirname, isInNodeModules, join } from '../../util/path.js';
|
|
10
10
|
const getVueSfc = (cwd) => {
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
const sfc = createRequire(join(cwd, 'package.json'))('vue/compiler-sfc');
|
|
13
|
+
if (typeof sfc.parseComponent === 'function') {
|
|
14
|
+
return {
|
|
15
|
+
parse: (source, path) => ({
|
|
16
|
+
descriptor: sfc.parse({ source, filename: path, sourceMap: false }),
|
|
17
|
+
}),
|
|
18
|
+
compileTemplate: (source, path, isTS, preprocessLang) => sfc.compileTemplate({
|
|
19
|
+
source,
|
|
20
|
+
filename: path,
|
|
21
|
+
sourceMap: false,
|
|
22
|
+
isProduction: true,
|
|
23
|
+
prettify: false,
|
|
24
|
+
isTS,
|
|
25
|
+
preprocessLang,
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
parse: (source, path) => sfc.parse(source, { filename: path, sourceMap: false }),
|
|
31
|
+
};
|
|
13
32
|
}
|
|
14
33
|
catch { }
|
|
15
34
|
return {
|
|
@@ -40,11 +59,15 @@ const collectIdentifiers = (source, fileName) => {
|
|
|
40
59
|
const collectTemplateInfo = (tree) => {
|
|
41
60
|
const tags = new Set();
|
|
42
61
|
const identifiers = new Set();
|
|
62
|
+
const visited = new Set();
|
|
43
63
|
const addExprIdentifiers = (expr) => {
|
|
44
64
|
for (const id of collectIdentifiers(expr, 'expr.ts'))
|
|
45
65
|
identifiers.add(id);
|
|
46
66
|
};
|
|
47
67
|
const visit = (node) => {
|
|
68
|
+
if (visited.has(node))
|
|
69
|
+
return;
|
|
70
|
+
visited.add(node);
|
|
48
71
|
if (node.tag)
|
|
49
72
|
tags.add(node.tag);
|
|
50
73
|
if (node.type === 5 && node.content && !node.content.isStatic)
|
|
@@ -62,10 +85,34 @@ const collectTemplateInfo = (tree) => {
|
|
|
62
85
|
if (node.children)
|
|
63
86
|
for (const child of node.children)
|
|
64
87
|
visit(child);
|
|
88
|
+
if (node.ifConditions)
|
|
89
|
+
for (const condition of node.ifConditions)
|
|
90
|
+
visit(condition.block);
|
|
91
|
+
if (node.scopedSlots)
|
|
92
|
+
for (const name in node.scopedSlots)
|
|
93
|
+
visit(node.scopedSlots[name]);
|
|
65
94
|
};
|
|
66
95
|
visit(tree);
|
|
67
96
|
return { tags, identifiers };
|
|
68
97
|
};
|
|
98
|
+
const collectVue2TemplateIdentifiers = (source) => {
|
|
99
|
+
const identifiers = new Set();
|
|
100
|
+
const visitor = new Visitor({
|
|
101
|
+
MemberExpression(node) {
|
|
102
|
+
if (!node.computed &&
|
|
103
|
+
node.object.type === 'Identifier' &&
|
|
104
|
+
node.object.name === '_vm' &&
|
|
105
|
+
node.property.type === 'Identifier') {
|
|
106
|
+
const name = node.property.name;
|
|
107
|
+
if (name !== '_self' && name !== '$set' && name !== '$delete' && !(name.length === 2 && name[0] === '_')) {
|
|
108
|
+
identifiers.add(name);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
visitor.visit(_parseFile('template.js', source).program);
|
|
114
|
+
return identifiers;
|
|
115
|
+
};
|
|
69
116
|
const toKebabCase = (s) => s.replace(/[A-Z]/g, (m, i) => (i ? '-' : '') + m.toLowerCase());
|
|
70
117
|
const isLocalSpecifier = (specifier) => specifier.startsWith('.') && !isInNodeModules(specifier);
|
|
71
118
|
export const collectLocalImportPaths = (filePath, result) => {
|
|
@@ -182,20 +229,33 @@ const compileVueSfc = (source, path, maps, root) => {
|
|
|
182
229
|
if (maps.importMap.size === 0 && maps.componentMap.size === 0) {
|
|
183
230
|
return [scriptBodies(source, path), stylePreprocessorImports(source, path)].filter(Boolean).join(';\n');
|
|
184
231
|
}
|
|
185
|
-
const
|
|
232
|
+
const sfc = sfcForRoot(root);
|
|
233
|
+
const { descriptor } = sfc.parse(source, path);
|
|
186
234
|
const scripts = [];
|
|
187
235
|
if (descriptor.script?.content)
|
|
188
236
|
scripts.push(descriptor.script.content);
|
|
189
237
|
if (descriptor.scriptSetup?.content)
|
|
190
238
|
scripts.push(descriptor.scriptSetup.content);
|
|
191
239
|
const identifiers = scripts.length === 0 ? new Set() : collectIdentifiers(scripts.join('\n'), path);
|
|
240
|
+
const template = descriptor.template;
|
|
241
|
+
const compiled = template && !template.ast && sfc.compileTemplate
|
|
242
|
+
? sfc.compileTemplate(template.content, path, descriptor.script?.lang === 'ts' ||
|
|
243
|
+
descriptor.script?.lang === 'tsx' ||
|
|
244
|
+
descriptor.scriptSetup?.lang === 'ts' ||
|
|
245
|
+
descriptor.scriptSetup?.lang === 'tsx', template.lang)
|
|
246
|
+
: undefined;
|
|
192
247
|
let templateTags;
|
|
193
|
-
|
|
194
|
-
|
|
248
|
+
const templateAst = template?.ast ?? compiled?.ast;
|
|
249
|
+
if (templateAst) {
|
|
250
|
+
const info = collectTemplateInfo(templateAst);
|
|
195
251
|
templateTags = info.tags;
|
|
196
252
|
for (const id of info.identifiers)
|
|
197
253
|
identifiers.add(id);
|
|
198
254
|
}
|
|
255
|
+
if (compiled?.code) {
|
|
256
|
+
for (const id of collectVue2TemplateIdentifiers(compiled.code))
|
|
257
|
+
identifiers.add(id);
|
|
258
|
+
}
|
|
199
259
|
scripts.push(...getSyntheticImports(maps, identifiers, templateTags));
|
|
200
260
|
const styles = stylePreprocessorImports(source, path);
|
|
201
261
|
if (styles)
|
|
@@ -13,24 +13,31 @@ export interface TemplateAstNode {
|
|
|
13
13
|
props?: TemplateAstProp[];
|
|
14
14
|
content?: TemplateExpressionNode;
|
|
15
15
|
children?: TemplateAstNode[];
|
|
16
|
+
ifConditions?: {
|
|
17
|
+
block: TemplateAstNode;
|
|
18
|
+
}[];
|
|
19
|
+
scopedSlots?: Record<string, TemplateAstNode>;
|
|
20
|
+
}
|
|
21
|
+
interface DescriptorBlock {
|
|
22
|
+
content: string;
|
|
23
|
+
lang?: string;
|
|
16
24
|
}
|
|
17
25
|
interface Descriptor {
|
|
18
|
-
script:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
scriptSetup: {
|
|
22
|
-
content: string;
|
|
23
|
-
} | null;
|
|
24
|
-
template: {
|
|
25
|
-
content: string;
|
|
26
|
+
script: DescriptorBlock | null;
|
|
27
|
+
scriptSetup: DescriptorBlock | null;
|
|
28
|
+
template: (DescriptorBlock & {
|
|
26
29
|
ast?: TemplateAstNode;
|
|
27
|
-
} | null;
|
|
30
|
+
}) | null;
|
|
28
31
|
}
|
|
29
|
-
export
|
|
32
|
+
export interface VueSfc {
|
|
30
33
|
parse: (source: string, path: string) => {
|
|
31
34
|
descriptor: Descriptor;
|
|
32
35
|
};
|
|
33
|
-
|
|
36
|
+
compileTemplate?: (source: string, path: string, isTS: boolean, preprocessLang?: string) => {
|
|
37
|
+
ast?: TemplateAstNode;
|
|
38
|
+
code: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
34
41
|
export interface AutoImportMaps {
|
|
35
42
|
importMap: Map<string, string>;
|
|
36
43
|
componentMap: Map<string, string[]>;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -144,6 +144,7 @@ export declare const Plugins: {
|
|
|
144
144
|
'tanstack-router': import("../types/config.ts").Plugin;
|
|
145
145
|
taskfile: import("../types/config.ts").Plugin;
|
|
146
146
|
tauri: import("../types/config.ts").Plugin;
|
|
147
|
+
temporal: import("../types/config.ts").Plugin;
|
|
147
148
|
travis: import("../types/config.ts").Plugin;
|
|
148
149
|
'ts-node': import("../types/config.ts").Plugin;
|
|
149
150
|
tsdown: import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -138,6 +138,7 @@ import { default as tailwind } from './tailwind/index.js';
|
|
|
138
138
|
import { default as tanstackRouter } from './tanstack-router/index.js';
|
|
139
139
|
import { default as taskfile } from './taskfile/index.js';
|
|
140
140
|
import { default as tauri } from './tauri/index.js';
|
|
141
|
+
import { default as temporal } from './temporal/index.js';
|
|
141
142
|
import { default as travis } from './travis/index.js';
|
|
142
143
|
import { default as tsNode } from './ts-node/index.js';
|
|
143
144
|
import { default as tsdown } from './tsdown/index.js';
|
|
@@ -315,6 +316,7 @@ export const Plugins = {
|
|
|
315
316
|
'tanstack-router': tanstackRouter,
|
|
316
317
|
taskfile,
|
|
317
318
|
tauri,
|
|
319
|
+
temporal,
|
|
318
320
|
travis,
|
|
319
321
|
'ts-node': tsNode,
|
|
320
322
|
tsdown,
|
|
@@ -7,6 +7,7 @@ const entry = ['emails/**/*.tsx'];
|
|
|
7
7
|
const previewCommands = new Set(['build', 'dev', 'start']);
|
|
8
8
|
const args = {
|
|
9
9
|
binaries: ['email'],
|
|
10
|
+
alias: { dir: ['d'] },
|
|
10
11
|
resolveInputs: (parsed, { manifest }) => {
|
|
11
12
|
const inputs = [];
|
|
12
13
|
if (previewCommands.has(parsed._[0])) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const directiveMatcher =
|
|
1
|
+
const directiveMatcher = /"(?:\\(?:\r\n|[\s\S]|$)|[^"\\\r\n\f])*(?:"|[\r\n\f]|$)|'(?:\\(?:\r\n|[\s\S]|$)|[^'\\\r\n\f])*(?:'|[\r\n\f]|$)|\/\*[\s\S]*?(?:\*\/|$)|@(?:(?:import|config|plugin)\s+['"]([^'"]+)['"]|import\s+url\(\s*(?:['"]([^'"]+)['"]|([^'")\s]+))\s*\))[^;]*;/g;
|
|
2
|
+
const urlSchemeMatcher = /^[a-z][a-z\d+.-]*:/i;
|
|
2
3
|
const compiler = (text) => {
|
|
3
4
|
if (!text.includes('@import') && !text.includes('@config') && !text.includes('@plugin'))
|
|
4
5
|
return '';
|
|
@@ -6,9 +7,13 @@ const compiler = (text) => {
|
|
|
6
7
|
let match;
|
|
7
8
|
let index = 0;
|
|
8
9
|
directiveMatcher.lastIndex = 0;
|
|
9
|
-
while ((match = directiveMatcher.exec(text)))
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
while ((match = directiveMatcher.exec(text))) {
|
|
11
|
+
const url = match[2] ?? match[3];
|
|
12
|
+
const specifier = match[1] ?? url;
|
|
13
|
+
if (!specifier || (url && (url.startsWith('//') || urlSchemeMatcher.test(url))))
|
|
14
|
+
continue;
|
|
15
|
+
imports.push(`import _$${index++} from '${specifier}';`);
|
|
16
|
+
}
|
|
12
17
|
return imports.join('\n');
|
|
13
18
|
};
|
|
14
19
|
export default compiler;
|
|
@@ -9,10 +9,12 @@ const enablers = [
|
|
|
9
9
|
'@tanstack/svelte-router',
|
|
10
10
|
'@tanstack/router-cli',
|
|
11
11
|
'@tanstack/router-plugin',
|
|
12
|
+
'@tanstack/react-start',
|
|
13
|
+
'@tanstack/solid-start',
|
|
12
14
|
];
|
|
13
15
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
14
16
|
const config = ['tsr.config.json'];
|
|
15
|
-
const production = ['src/routeTree.gen.{ts,js}'];
|
|
17
|
+
const production = ['src/routeTree.gen.{ts,js}', 'src/{router,start,client,server}.{js,jsx,ts,tsx}'];
|
|
16
18
|
const resolveConfig = async (localConfig, options) => {
|
|
17
19
|
const { configFileDir } = options;
|
|
18
20
|
const generatedRouteTree = localConfig.generatedRouteTree ?? './src/routeTree.gen.ts';
|