knip 6.45.1 → 6.46.1
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/README.md +42 -18
- package/dist/ConfigurationChief.d.ts +6 -0
- package/dist/ConfigurationChief.js +2 -2
- package/dist/DependencyDeputy.d.ts +12 -14
- package/dist/DependencyDeputy.js +33 -21
- package/dist/IssueCollector.d.ts +1 -0
- package/dist/IssueCollector.js +4 -1
- package/dist/PackagePeeker.d.ts +0 -9
- package/dist/PackagePeeker.js +0 -38
- package/dist/ProjectPrincipal.d.ts +1 -1
- package/dist/ProjectPrincipal.js +3 -1
- package/dist/WorkspaceWorker.js +7 -7
- package/dist/binaries/bash-parser.js +5 -8
- package/dist/binaries/command.js +2 -2
- package/dist/binaries/fallback.d.ts +5 -1
- package/dist/binaries/fallback.js +41 -10
- package/dist/binaries/plugins.d.ts +1 -0
- package/dist/binaries/plugins.js +75 -39
- package/dist/binaries/resolvers/bun.js +2 -2
- package/dist/binaries/resolvers/npm.js +2 -2
- package/dist/binaries/resolvers/npx.js +2 -2
- package/dist/binaries/resolvers/nub.js +2 -2
- package/dist/binaries/resolvers/pnpm.js +29 -21
- package/dist/binaries/resolvers/pnpx.js +20 -8
- package/dist/binaries/resolvers/vp.js +1 -1
- package/dist/binaries/resolvers/yarn.js +1 -1
- package/dist/binaries/util.d.ts +4 -1
- package/dist/binaries/util.js +10 -13
- package/dist/constants.js +18 -0
- package/dist/graph/SubpathReferences.d.ts +1 -1
- package/dist/graph/SubpathReferences.js +4 -3
- package/dist/graph/build.js +11 -12
- package/dist/plugins/_template/index.js +2 -2
- package/dist/plugins/angular/index.js +3 -8
- package/dist/plugins/astro/resolveFromAST.js +2 -2
- package/dist/plugins/astro-markdoc/index.js +2 -2
- package/dist/plugins/astro-og-canvas/index.js +1 -1
- package/dist/plugins/aws-cdk/index.js +3 -3
- package/dist/plugins/babel/index.js +5 -3
- package/dist/plugins/borp/index.js +2 -2
- package/dist/plugins/bun/index.js +3 -3
- package/dist/plugins/capacitor/index.js +33 -6
- package/dist/plugins/capacitor/types.d.ts +10 -0
- package/dist/plugins/changesets/index.js +2 -2
- package/dist/plugins/commitizen/index.js +2 -2
- package/dist/plugins/commitlint/index.js +2 -2
- package/dist/plugins/convex/index.js +2 -2
- package/dist/plugins/cspell/index.js +2 -2
- package/dist/plugins/cucumber/index.js +2 -2
- package/dist/plugins/cypress/index.js +3 -3
- package/dist/plugins/docusaurus/helpers.js +6 -6
- package/dist/plugins/docusaurus/index.js +3 -3
- package/dist/plugins/dotenv/index.js +6 -2
- package/dist/plugins/drizzle/index.js +2 -2
- package/dist/plugins/electron-builder/index.d.ts +3 -0
- package/dist/plugins/electron-builder/index.js +61 -0
- package/dist/plugins/electron-forge/index.js +2 -2
- package/dist/plugins/electron-vite/index.js +4 -3
- package/dist/plugins/electron-vite/types.d.ts +3 -0
- package/dist/plugins/eleventy/index.js +2 -2
- package/dist/plugins/ember/compiler.d.ts +2 -0
- package/dist/plugins/ember/compiler.js +14 -0
- package/dist/plugins/ember/index.d.ts +6 -0
- package/dist/plugins/ember/index.js +160 -0
- package/dist/plugins/ember/types.d.ts +13 -0
- package/dist/plugins/ember/types.js +1 -0
- package/dist/plugins/ember/visitors/importSync.d.ts +2 -0
- package/dist/plugins/ember/visitors/importSync.js +32 -0
- package/dist/plugins/ember-template-lint/index.d.ts +3 -0
- package/dist/plugins/ember-template-lint/index.js +20 -0
- package/dist/plugins/env-cmd/index.d.ts +3 -0
- package/dist/plugins/env-cmd/index.js +16 -0
- package/dist/plugins/esbuild/index.js +2 -2
- package/dist/plugins/eslint/helpers.js +6 -6
- package/dist/plugins/eslint/index.js +0 -1
- package/dist/plugins/eslint/resolveFromAST.js +11 -3
- package/dist/plugins/evalite/index.js +2 -2
- package/dist/plugins/expo/helpers.js +10 -10
- package/dist/plugins/expo-router/index.js +3 -3
- package/dist/plugins/filesystem-routing/index.js +4 -4
- package/dist/plugins/flue/index.js +4 -4
- package/dist/plugins/gatsby/index.js +3 -3
- package/dist/plugins/github-action/index.js +2 -2
- package/dist/plugins/github-actions/index.js +2 -2
- package/dist/plugins/graphql-codegen/index.js +8 -6
- package/dist/plugins/index.d.ts +6 -0
- package/dist/plugins/index.js +12 -0
- package/dist/plugins/jasmine/index.js +3 -4
- package/dist/plugins/jest/index.js +3 -3
- package/dist/plugins/karma/helpers.js +2 -2
- package/dist/plugins/karma/index.js +5 -1
- package/dist/plugins/knex/index.js +13 -7
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/linthtml/index.js +2 -2
- package/dist/plugins/lunaria/index.js +3 -3
- package/dist/plugins/maestro/index.d.ts +3 -0
- package/dist/plugins/maestro/index.js +54 -0
- package/dist/plugins/maestro/types.d.ts +21 -0
- package/dist/plugins/maestro/types.js +1 -0
- package/dist/plugins/markdownlint/index.js +3 -3
- package/dist/plugins/marko/index.js +4 -4
- package/dist/plugins/mastra/index.js +3 -3
- package/dist/plugins/mdx/index.js +3 -3
- package/dist/plugins/mdxlint/index.js +2 -2
- package/dist/plugins/metro/index.js +5 -5
- package/dist/plugins/mikro-orm/index.js +3 -4
- package/dist/plugins/mise/scripts.js +2 -3
- package/dist/plugins/mocha/index.js +8 -7
- package/dist/plugins/netlify/index.js +4 -4
- package/dist/plugins/next/index.js +5 -5
- package/dist/plugins/next-mdx/resolveFromAST.js +2 -2
- package/dist/plugins/nitro/index.js +4 -4
- package/dist/plugins/node/index.d.ts +16 -0
- package/dist/plugins/node/index.js +89 -23
- package/dist/plugins/nodemon/index.js +1 -1
- package/dist/plugins/npm-package-json-lint/index.js +2 -2
- package/dist/plugins/nuxt/index.js +16 -14
- package/dist/plugins/nx/index.js +3 -3
- package/dist/plugins/nyc/index.js +39 -2
- package/dist/plugins/oclif/index.js +5 -3
- package/dist/plugins/openclaw/index.js +5 -5
- package/dist/plugins/oxlint/index.js +2 -2
- package/dist/plugins/panda-css/index.js +2 -2
- package/dist/plugins/parcel/index.js +2 -2
- package/dist/plugins/payload/index.js +3 -3
- package/dist/plugins/playwright/index.js +4 -4
- package/dist/plugins/pm2/index.js +2 -2
- package/dist/plugins/pnpm/index.js +1 -1
- package/dist/plugins/postcss/index.js +2 -2
- package/dist/plugins/preconstruct/index.js +2 -2
- package/dist/plugins/prettier/index.js +4 -3
- package/dist/plugins/prisma/index.js +5 -5
- package/dist/plugins/quasar/resolveFromAST.js +8 -8
- package/dist/plugins/qwik/resolveFromAST.js +3 -3
- package/dist/plugins/raycast/index.js +2 -2
- package/dist/plugins/react-cosmos/index.js +2 -2
- package/dist/plugins/react-native/index.js +1 -1
- package/dist/plugins/react-router/index.js +6 -6
- package/dist/plugins/relay/index.js +3 -3
- package/dist/plugins/release-it/index.js +2 -5
- package/dist/plugins/remark/helpers.js +2 -2
- package/dist/plugins/retry-cli/index.js +0 -1
- package/dist/plugins/rolldown/index.js +2 -2
- package/dist/plugins/rollup/index.js +2 -2
- package/dist/plugins/rsbuild/index.js +3 -3
- package/dist/plugins/rslib/index.js +2 -2
- package/dist/plugins/rslint/index.d.ts +3 -0
- package/dist/plugins/rslint/index.js +16 -0
- package/dist/plugins/rspack/index.js +4 -0
- package/dist/plugins/rstest/index.js +4 -4
- package/dist/plugins/semantic-release/index.js +2 -2
- package/dist/plugins/serverless-framework/index.js +4 -4
- package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +3 -3
- package/dist/plugins/sst/resolveFromAST.js +2 -2
- package/dist/plugins/starlight/resolveFromAST.js +3 -3
- package/dist/plugins/stencil/resolveFromAST.js +5 -5
- package/dist/plugins/storybook/index.js +2 -2
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/stylelint/index.js +4 -4
- package/dist/plugins/sveltekit/resolveFromAST.js +7 -5
- package/dist/plugins/swc/index.js +8 -5
- package/dist/plugins/tailwind/index.js +3 -2
- package/dist/plugins/tanstack-router/index.js +5 -2
- package/dist/plugins/textlint/helpers.js +2 -2
- package/dist/plugins/ts-node/index.js +23 -6
- package/dist/plugins/tsd/index.js +1 -1
- package/dist/plugins/tsdown/index.js +4 -4
- package/dist/plugins/tsup/index.js +3 -3
- package/dist/plugins/tsx/index.js +4 -3
- package/dist/plugins/turbo/index.js +2 -2
- package/dist/plugins/typedoc/index.js +4 -3
- package/dist/plugins/typescript/index.js +4 -4
- package/dist/plugins/varlock/scan.js +6 -3
- package/dist/plugins/vite/helpers.js +2 -2
- package/dist/plugins/vite-plugin-pages/index.js +2 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vite-plugin-vue-layouts-next/index.js +2 -2
- package/dist/plugins/vitest/index.js +14 -18
- package/dist/plugins/webdriver-io/index.js +13 -1
- package/dist/plugins/webpack/index.js +7 -12
- package/dist/plugins/wrangler/index.js +3 -3
- package/dist/plugins/wxt/index.js +2 -2
- package/dist/plugins/yarn/index.js +5 -5
- package/dist/session/incremental.d.ts +1 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +6 -0
- package/dist/types/args.d.ts +4 -3
- package/dist/types/config.d.ts +2 -0
- package/dist/types/module-graph.d.ts +1 -1
- package/dist/types/package-json.d.ts +1 -0
- package/dist/types/workspace.d.ts +10 -8
- package/dist/typescript/ast-nodes.js +4 -5
- package/dist/typescript/get-imports-and-exports.js +5 -2
- package/dist/typescript/visitors/exports.js +6 -32
- package/dist/typescript/visitors/imports.d.ts +1 -1
- package/dist/typescript/visitors/imports.js +15 -24
- package/dist/typescript/visitors/walk.d.ts +5 -0
- package/dist/typescript/visitors/walk.js +75 -30
- package/dist/util/codeowners.js +4 -1
- package/dist/util/input.d.ts +3 -6
- package/dist/util/input.js +6 -20
- package/dist/util/parse-and-convert-gitignores.js +5 -4
- package/dist/util/parse-args.d.ts +2 -1
- package/dist/util/parse-args.js +13 -3
- package/dist/util/plugin.js +6 -4
- package/dist/util/watch.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +36 -5
package/dist/binaries/plugins.js
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import { parse as parseScript } from 'unbash';
|
|
2
|
-
import parseArgs from '../util/parse-args.js';
|
|
2
|
+
import parseArgs, {} from '../util/parse-args.js';
|
|
3
3
|
import { pluginArgsMap } from '../plugins.js';
|
|
4
4
|
import { compact } from '../util/array.js';
|
|
5
|
-
import { toBinary, toConfig,
|
|
5
|
+
import { toBinary, toConfig, toModule, toEntryPath, toEntry } from '../util/input.js';
|
|
6
6
|
import { extractBinary, isInNodeModulesBin } from '../util/modules.js';
|
|
7
7
|
import { dirname } from '../util/path.js';
|
|
8
8
|
import { collectCommands, getCommandWords } from '../util/scripts.js';
|
|
9
|
-
import { isWrapper as isFallbackWrapper, resolve as fallbackResolve, spawningBinaries } from './fallback.js';
|
|
10
|
-
import {
|
|
11
|
-
const isGlobLikeMatch = /(^!|[*+\\(|{^$])/;
|
|
12
|
-
const isGlobLike = (value) => isGlobLikeMatch.test(value);
|
|
13
|
-
const nodeLoadersArgs = { import: ['r', 'experimental-loader', 'require', 'loader'] };
|
|
9
|
+
import { getEnvAssignmentCount, getWrappedScripts, isWrapper as isFallbackWrapper, resolve as fallbackResolve, shellSpawningBinaries, spawningBinaries, } from './fallback.js';
|
|
10
|
+
import { isGlobLike, nodeLoadersArgs, toCommandBinary, toWordArgs } from './util.js';
|
|
14
11
|
export const isWrapper = (binary) => !!pluginArgsMap.get(binary)?.[1].fromArgs || isFallbackWrapper(binary);
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
for (const word of words)
|
|
19
|
-
values.push(word.value);
|
|
20
|
-
return typeof pluginArgs.args === 'function' ? pluginArgs.args(values) : values;
|
|
12
|
+
const toShellAssignment = (assignment) => {
|
|
13
|
+
const index = assignment.indexOf('=');
|
|
14
|
+
return `${assignment.slice(0, index)}='${assignment.slice(index + 1).replaceAll("'", "'\\''")}'`;
|
|
21
15
|
};
|
|
16
|
+
const toCrossEnvCommand = (args) => {
|
|
17
|
+
const command = args.slice();
|
|
18
|
+
const count = getEnvAssignmentCount(args);
|
|
19
|
+
for (let index = 0; index < count; index++)
|
|
20
|
+
command[index] = toShellAssignment(args[index]);
|
|
21
|
+
return command;
|
|
22
|
+
};
|
|
23
|
+
const spawningPluginArgs = { fromArgs: (_, args) => toCrossEnvCommand(args) };
|
|
24
|
+
const shellSpawningPluginArgs = { fromArgs: (_, args) => toCrossEnvCommand(args).join(' ') };
|
|
25
|
+
const toArgValues = (pluginArgs, values) => typeof pluginArgs.args === 'function' ? pluginArgs.args(values) : values;
|
|
26
|
+
const toArgs = (pluginArgs, words) => toArgValues(pluginArgs, words.map(word => word.value));
|
|
22
27
|
const parse = (pluginArgs, args) => {
|
|
23
28
|
const config = pluginArgs.config === true ? ['config'] : pluginArgs.config || [];
|
|
24
29
|
const string = [
|
|
@@ -32,22 +37,51 @@ const parse = (pluginArgs, args) => {
|
|
|
32
37
|
string.push(...pluginArgs.fromArgs);
|
|
33
38
|
return parseArgs(args, {
|
|
34
39
|
string,
|
|
35
|
-
boolean: ['quiet', 'verbose', 'watch', ...(pluginArgs.boolean ?? [])],
|
|
40
|
+
boolean: pluginArgs.boolean === true ? true : ['quiet', 'verbose', 'watch', ...(pluginArgs.boolean ?? [])],
|
|
36
41
|
alias: {
|
|
37
42
|
...(pluginArgs.nodeImportArgs ? nodeLoadersArgs : {}),
|
|
38
43
|
...(pluginArgs.config === true ? { config: ['c'] } : {}),
|
|
39
44
|
...pluginArgs.alias,
|
|
40
45
|
},
|
|
41
46
|
'--': true,
|
|
47
|
+
isStorePositions: true,
|
|
48
|
+
stopEarly: pluginArgs.stopEarly,
|
|
42
49
|
});
|
|
43
50
|
};
|
|
51
|
+
const valueOf = (arg) => (typeof arg === 'string' ? arg : arg.value);
|
|
52
|
+
export const toForwardedScript = (args) => {
|
|
53
|
+
const parts = [];
|
|
54
|
+
for (const arg of args) {
|
|
55
|
+
if (parts.length === 0 && valueOf(arg) === '--')
|
|
56
|
+
continue;
|
|
57
|
+
parts.push(typeof arg === 'string' ? arg : arg.text);
|
|
58
|
+
}
|
|
59
|
+
return parts.join(' ');
|
|
60
|
+
};
|
|
61
|
+
const toCommandArgs = (command, words) => typeof command === 'string' ? (command ? [command] : []) : toWordArgs(command, words);
|
|
62
|
+
const toWrappedCommand = (pluginArgs, parsed, args, words, cwd) => {
|
|
63
|
+
const { fromArgs } = pluginArgs;
|
|
64
|
+
if (typeof fromArgs === 'function')
|
|
65
|
+
return toCommandArgs(fromArgs(parsed, args, { cwd }), words);
|
|
66
|
+
if (Array.isArray(fromArgs))
|
|
67
|
+
return fromArgs.flatMap(key => parsed[key]).filter(Boolean);
|
|
68
|
+
return [];
|
|
69
|
+
};
|
|
44
70
|
export const getWrappedCommand = (binary, words, cwd = process.cwd()) => {
|
|
45
|
-
const pluginArgs = pluginArgsMap.get(binary)?.[1] ??
|
|
46
|
-
|
|
47
|
-
|
|
71
|
+
const pluginArgs = pluginArgsMap.get(binary)?.[1] ??
|
|
72
|
+
(shellSpawningBinaries.includes(binary)
|
|
73
|
+
? shellSpawningPluginArgs
|
|
74
|
+
: spawningBinaries.includes(binary)
|
|
75
|
+
? spawningPluginArgs
|
|
76
|
+
: undefined);
|
|
77
|
+
if (!pluginArgs?.fromArgs)
|
|
48
78
|
return;
|
|
49
79
|
const args = toArgs(pluginArgs, words);
|
|
50
|
-
return
|
|
80
|
+
return toWrappedCommand(pluginArgs, parse(pluginArgs, args), args, words, cwd);
|
|
81
|
+
};
|
|
82
|
+
const getWrappedCommands = (binary, words, cwd) => {
|
|
83
|
+
const command = getWrappedCommand(binary, words, cwd);
|
|
84
|
+
return command ? [command] : getWrappedScripts(binary, words);
|
|
51
85
|
};
|
|
52
86
|
export const getScriptCommands = (script, cwd = process.cwd()) => {
|
|
53
87
|
if (!script)
|
|
@@ -61,11 +95,11 @@ export const getScriptCommands = (script, cwd = process.cwd()) => {
|
|
|
61
95
|
continue;
|
|
62
96
|
const binary = extractBinary(text);
|
|
63
97
|
const words = getCommandWords(node);
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
out.push(...getScriptCommands(toScript(command), cwd));
|
|
67
|
-
else
|
|
98
|
+
const commands = getWrappedCommands(binary, words, cwd).filter(command => command.length > 0);
|
|
99
|
+
if (commands.length === 0)
|
|
68
100
|
out.push({ binary, args: words.map(word => word.value) });
|
|
101
|
+
for (const command of commands)
|
|
102
|
+
out.push(...getScriptCommands(toForwardedScript(command), cwd));
|
|
69
103
|
}
|
|
70
104
|
}
|
|
71
105
|
}
|
|
@@ -85,39 +119,41 @@ export const resolve = (binary, words, options) => {
|
|
|
85
119
|
const args = toArgs(pluginArgs, words);
|
|
86
120
|
const parsed = parse(pluginArgs, args);
|
|
87
121
|
const positionals = [];
|
|
88
|
-
|
|
89
|
-
|
|
122
|
+
const operand = parsed._[0] ?? parsed['--']?.[0];
|
|
123
|
+
const ids = typeof pluginArgs.positional === 'function'
|
|
124
|
+
? pluginArgs.positional(parsed)
|
|
125
|
+
: pluginArgs.positional && operand
|
|
126
|
+
? [operand]
|
|
127
|
+
: [];
|
|
128
|
+
for (const id of ids) {
|
|
90
129
|
if (isGlobLike(id))
|
|
91
130
|
positionals.push(toEntry(id));
|
|
92
|
-
else
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
positionals.push(toDeferResolveEntry(id, { optional: true }));
|
|
97
|
-
}
|
|
131
|
+
else if (isInNodeModulesBin(id))
|
|
132
|
+
positionals.push(toBinary(extractBinary(id)));
|
|
133
|
+
else
|
|
134
|
+
positionals.push(toEntryPath(id, { optional: true }));
|
|
98
135
|
}
|
|
99
136
|
const mapToParsedKey = (id) => parsed[id];
|
|
100
137
|
const resolved = compact(pluginArgs.resolve ? pluginArgs.resolve.flatMap(mapToParsedKey) : []);
|
|
101
138
|
const resolvedImports = pluginArgs.nodeImportArgs && parsed.import ? [parsed.import].flat() : [];
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
: Array.isArray(pluginArgs.fromArgs)
|
|
105
|
-
? fromArgs(pluginArgs.fromArgs.flatMap(mapToParsedKey).filter(Boolean))
|
|
106
|
-
: [];
|
|
139
|
+
const wrappedCommand = toWrappedCommand(pluginArgs, parsed, args, words, cwd);
|
|
140
|
+
const resolvedFromArgs = wrappedCommand.length > 0 ? fromArgs(wrappedCommand) : [];
|
|
107
141
|
const config = pluginArgs.config === true ? ['config'] : pluginArgs.config || [];
|
|
108
142
|
const mapToConfigPattern = (value) => {
|
|
143
|
+
if (!pluginName)
|
|
144
|
+
return [];
|
|
109
145
|
if (typeof value === 'string')
|
|
110
|
-
return parsed[value]
|
|
146
|
+
return compact([parsed[value]].flat()).map(arg => toConfig(pluginName, arg, inputOpts));
|
|
111
147
|
const [id, fn] = value;
|
|
112
|
-
return parsed[id]
|
|
148
|
+
return compact([parsed[id]].flat()).map(arg => toConfig(pluginName, fn(arg), inputOpts));
|
|
113
149
|
};
|
|
114
150
|
const configFilePaths = config.flatMap(mapToConfigPattern);
|
|
115
151
|
const inputs = pluginArgs.resolveInputs?.(parsed, { args, cwd, manifest }) ?? [];
|
|
116
152
|
return [
|
|
117
153
|
toCommandBinary(binary, options, inputOpts),
|
|
118
154
|
...positionals,
|
|
119
|
-
...resolved.map(id =>
|
|
120
|
-
...resolvedImports.map(id =>
|
|
155
|
+
...resolved.map(id => toModule(id)),
|
|
156
|
+
...resolvedImports.map(id => toModule(id)),
|
|
121
157
|
...resolvedFromArgs,
|
|
122
158
|
...configFilePaths,
|
|
123
159
|
...inputs,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
|
-
import { toBinary,
|
|
2
|
+
import { toBinary, toEntryPath } from '../../util/input.js';
|
|
3
3
|
import { isAbsolute, join } from '../../util/path.js';
|
|
4
4
|
import { _resolveSync } from '../../util/resolve.js';
|
|
5
5
|
import { argsAfter, expandScript, toCommandBinary } from '../util.js';
|
|
@@ -82,7 +82,7 @@ export const resolve = (_binary, words, options) => {
|
|
|
82
82
|
const _cwd = parsed.cwd ? join(cwd, parsed.cwd) : cwd;
|
|
83
83
|
const resolved = _resolveSync(isAbsolute(filePath) ? filePath : join(_cwd, filePath), _cwd);
|
|
84
84
|
if (resolved)
|
|
85
|
-
return [binary,
|
|
85
|
+
return [binary, toEntryPath(resolved, { optional: true })];
|
|
86
86
|
const dir = parsed.cwd ? join(cwd, parsed.cwd) : undefined;
|
|
87
87
|
const opts = dir ? { cwd: dir } : {};
|
|
88
88
|
if (command !== 'run')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
|
-
import { isBinary, toBinary,
|
|
2
|
+
import { isBinary, toBinary, toModule, toDependency } from '../../util/input.js';
|
|
3
3
|
import { extractBinary, isValidBinary, stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
4
|
import { isInternal } from '../../util/path.js';
|
|
5
5
|
import { argsAfter, expandScript, npmBooleanAliases, npmBooleanFlags } from '../util.js';
|
|
@@ -25,7 +25,7 @@ export const resolve = (_binary, words, options) => {
|
|
|
25
25
|
if (command === 'exec' || command === 'x') {
|
|
26
26
|
const packages = parsed.package ? [parsed.package].flat() : [];
|
|
27
27
|
const packageInputs = packages.map(specifier => isInternal(specifier)
|
|
28
|
-
?
|
|
28
|
+
? toModule(specifier, { optional: true, dir: options.cwd })
|
|
29
29
|
: toDependency(stripVersionFromSpecifier(specifier), { optional: true }));
|
|
30
30
|
const separator = words.findIndex(word => word.value === '--');
|
|
31
31
|
const args = parsed.positionalIndices.slice(1).map(index => words[index]);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
|
-
import { toBinary,
|
|
2
|
+
import { toBinary, toModule, toDependency } from '../../util/input.js';
|
|
3
3
|
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
4
|
import { isInternal } from '../../util/path.js';
|
|
5
5
|
import { argsFrom, npmBooleanAliases, npmBooleanFlags } from '../util.js';
|
|
6
6
|
const noInstallFlags = new Set(['--no', '--no-install', '--yes=false', '--no-yes']);
|
|
7
7
|
export const resolve = (_binary, words, options) => {
|
|
8
8
|
const { fromArgs, cwd } = options;
|
|
9
|
-
const toPackage = (id, opts) => isInternal(id) ?
|
|
9
|
+
const toPackage = (id, opts) => isInternal(id) ? toModule(id, { ...opts, dir: cwd }) : toDependency(id, opts);
|
|
10
10
|
const args = {
|
|
11
11
|
isStorePositions: true,
|
|
12
12
|
boolean: npmBooleanFlags,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntryPath } from '../../util/input.js';
|
|
3
3
|
import { isAbsolute, join } from '../../util/path.js';
|
|
4
4
|
import { _resolveSync } from '../../util/resolve.js';
|
|
5
5
|
import { toCommandBinary } from '../util.js';
|
|
@@ -39,7 +39,7 @@ export const resolve = (_binary, words, options) => {
|
|
|
39
39
|
if (!script || manifest.scriptNames.has(script))
|
|
40
40
|
return [binary];
|
|
41
41
|
const resolved = _resolveSync(isAbsolute(script) ? script : join(cwd, script), cwd);
|
|
42
|
-
return resolved ? [binary,
|
|
42
|
+
return resolved ? [binary, toEntryPath(resolved, { optional: true })] : [binary];
|
|
43
43
|
}
|
|
44
44
|
if (command && (commands.has(command) || manifest.scriptNames.has(command)))
|
|
45
45
|
return [binary];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import parseArgs from '../../util/parse-args.js';
|
|
2
|
-
import {
|
|
3
|
-
import { isValidBinary } from '../../util/modules.js';
|
|
1
|
+
import parseArgs, {} from '../../util/parse-args.js';
|
|
2
|
+
import { toAbsolute } from '../../util/path.js';
|
|
4
3
|
import { argsAfter, expandScript } from '../util.js';
|
|
5
4
|
import { resolveDlx } from './pnpx.js';
|
|
6
5
|
const commands = [
|
|
@@ -93,46 +92,55 @@ const testAliases = new Set(['t', 'tst']);
|
|
|
93
92
|
export const resolve = (_binary, words, options) => {
|
|
94
93
|
const parseOptions = {
|
|
95
94
|
isStorePositions: true,
|
|
95
|
+
string: ['dir'],
|
|
96
96
|
boolean: ['aggregate-output', 'if-present', 'parallel', 'recursive', 'reverse', 'shell-mode', 'silent', 'stream'],
|
|
97
|
-
alias: { recursive: 'r', silent: 's', 'shell-mode': 'c', filter: 'F' },
|
|
97
|
+
alias: { recursive: 'r', silent: 's', 'shell-mode': 'c', filter: 'F', dir: 'C' },
|
|
98
98
|
'--': true,
|
|
99
99
|
};
|
|
100
100
|
const parsed = parseArgs(words, parseOptions);
|
|
101
101
|
const [command] = parsed._;
|
|
102
|
+
const [commandIndex, scriptIndex] = parsed.positionalIndices;
|
|
102
103
|
if (command === 'dlx') {
|
|
103
|
-
const
|
|
104
|
-
return resolveDlx(
|
|
104
|
+
const index = parsed.positionalIndices[0];
|
|
105
|
+
return resolveDlx([...words.slice(0, index), ...words.slice(index + 1)], options);
|
|
105
106
|
}
|
|
106
107
|
if (recursiveCommands.includes(command)) {
|
|
107
108
|
return resolve(_binary, argsAfter(words, command), options);
|
|
108
109
|
}
|
|
109
110
|
const { manifest, fromArgs } = options;
|
|
111
|
+
const forward = (index, pnpmOptions) => {
|
|
112
|
+
const rest = words.slice(index);
|
|
113
|
+
const script = rest.length === 1 ? rest[0].value : rest.map(word => word.text).join(' ');
|
|
114
|
+
if (!pnpmOptions.dir)
|
|
115
|
+
return fromArgs([script]);
|
|
116
|
+
const dir = toAbsolute(pnpmOptions.dir, options.cwd);
|
|
117
|
+
const inputs = fromArgs([script], { cwd: dir });
|
|
118
|
+
for (const input of inputs)
|
|
119
|
+
input.dir ??= dir;
|
|
120
|
+
return inputs;
|
|
121
|
+
};
|
|
122
|
+
const isRun = command === 'run' || command === 'run-script';
|
|
123
|
+
const name = testAliases.has(command) ? 'test' : command;
|
|
124
|
+
const optionsEnd = isRun ? scriptIndex : name === 'test' || !commands.includes(command) ? commandIndex : words.length;
|
|
125
|
+
const pnpmOptions = parseArgs(words.slice(0, optionsEnd), parseOptions);
|
|
126
|
+
if (pnpmOptions.filter && !pnpmOptions.recursive)
|
|
127
|
+
return [];
|
|
110
128
|
if (command === 'exec') {
|
|
111
|
-
const commandIndex = parsed.positionalIndices[0];
|
|
112
|
-
if (commandIndex > 0) {
|
|
113
|
-
const execOptions = parseArgs(words.slice(0, commandIndex), parseOptions);
|
|
114
|
-
if (execOptions.filter && !execOptions.recursive)
|
|
115
|
-
return [];
|
|
116
|
-
}
|
|
117
129
|
const index = commandIndex + 1;
|
|
118
|
-
|
|
119
|
-
return fromArgs([rest.length === 1 ? rest[0].value : rest.map(word => word.text).join(' ')]);
|
|
130
|
+
return forward(words[index]?.value === '--' ? index + 1 : index, pnpmOptions);
|
|
120
131
|
}
|
|
121
|
-
if (parsed.filter && !parsed.recursive)
|
|
122
|
-
return [];
|
|
123
132
|
const childInputs = parsed['--'] && parsed['--'].length > 0 ? fromArgs(argsAfter(words, '--'), { isForwardedArgs: true }) : [];
|
|
124
|
-
if (
|
|
133
|
+
if (isRun) {
|
|
125
134
|
const script = parsed._[1];
|
|
126
135
|
if (script && manifest.scriptNames.has(script)) {
|
|
127
136
|
return expandScript(script, argsAfter(words, script), manifest.scripts, options) ?? childInputs;
|
|
128
137
|
}
|
|
129
138
|
return childInputs;
|
|
130
139
|
}
|
|
131
|
-
|
|
132
|
-
const isScript = manifest.scriptNames.has(name);
|
|
133
|
-
if (isScript)
|
|
140
|
+
if (manifest.scriptNames.has(name)) {
|
|
134
141
|
return expandScript(name, argsAfter(words, command), manifest.scripts, options) ?? childInputs;
|
|
142
|
+
}
|
|
135
143
|
if (commands.includes(command))
|
|
136
144
|
return childInputs;
|
|
137
|
-
return command
|
|
145
|
+
return command ? forward(commandIndex, pnpmOptions) : [];
|
|
138
146
|
};
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
2
|
import { getCatalogReference } from '../../util/catalog.js';
|
|
3
3
|
import { toCatalog, toDependency } from '../../util/input.js';
|
|
4
|
-
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
|
+
import { extractBinary, stripVersionFromSpecifier } from '../../util/modules.js';
|
|
5
5
|
const toDependencyInputs = (packageSpecifier) => {
|
|
6
6
|
const dependency = toDependency(stripVersionFromSpecifier(packageSpecifier), { optional: true });
|
|
7
7
|
const reference = getCatalogReference(packageSpecifier);
|
|
8
8
|
return reference ? [dependency, toCatalog(reference.packageName, reference.catalogName)] : [dependency];
|
|
9
9
|
};
|
|
10
|
+
const parseOptions = {
|
|
11
|
+
isStorePositions: true,
|
|
12
|
+
boolean: ['silent'],
|
|
13
|
+
alias: { package: 'p', 'shell-mode': 'c', dir: 'C' },
|
|
14
|
+
};
|
|
10
15
|
export const resolveDlx = (words, options) => {
|
|
11
|
-
const parsed = parseArgs(words,
|
|
12
|
-
boolean: ['silent'],
|
|
13
|
-
alias: { package: 'p', 'shell-mode': 'c' },
|
|
14
|
-
});
|
|
16
|
+
const parsed = parseArgs(words, parseOptions);
|
|
15
17
|
const packageSpecifier = parsed._[0];
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
+
const commandIndex = parsed.positionalIndices[0] ?? words.length;
|
|
19
|
+
const flags = parseArgs(words.slice(0, commandIndex), parseOptions);
|
|
20
|
+
const packages = flags.package && !flags.yes ? [flags.package].flat() : [];
|
|
21
|
+
const command = flags['shell-mode'] ? options.fromArgs([flags['shell-mode']]) : [];
|
|
18
22
|
const dependencyInputs = packageSpecifier ? toDependencyInputs(packageSpecifier) : [];
|
|
19
|
-
|
|
23
|
+
const executable = packageSpecifier ? extractBinary(String(packageSpecifier)) : '';
|
|
24
|
+
const forwarded = executable && !flags.dir ? options.fromArgs([executable, ...words.slice(commandIndex + 1)]) : [];
|
|
25
|
+
const isOuterCommand = forwarded[0]?.specifier === executable;
|
|
26
|
+
return [
|
|
27
|
+
...dependencyInputs,
|
|
28
|
+
...packages.flatMap(toDependencyInputs),
|
|
29
|
+
...command,
|
|
30
|
+
...(isOuterCommand ? forwarded.slice(1) : forwarded),
|
|
31
|
+
];
|
|
20
32
|
};
|
|
21
33
|
export const resolve = (_binary, words, options) => {
|
|
22
34
|
return resolveDlx(words, options);
|
|
@@ -81,7 +81,7 @@ export const resolve = (_binary, words, options) => {
|
|
|
81
81
|
return _childArgs;
|
|
82
82
|
const opts = dir ? { cwd: dir } : {};
|
|
83
83
|
if (command === 'exec') {
|
|
84
|
-
const rest = argsFrom(words, binary);
|
|
84
|
+
const rest = binary === undefined ? argsFrom(words, '--').slice(1) : argsFrom(words, binary);
|
|
85
85
|
return rest.length === 1 ? fromArgs([rest[0].value], opts) : fromArgs(rest, opts);
|
|
86
86
|
}
|
|
87
87
|
return fromArgs(argsFrom(words, command), opts);
|
package/dist/binaries/util.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ export declare const npmBooleanAliases: {
|
|
|
15
15
|
workspaces: string;
|
|
16
16
|
yes: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const nodeLoadersArgs: {
|
|
19
|
+
import: string[];
|
|
20
|
+
};
|
|
21
|
+
export declare const isGlobLike: (value: string) => boolean;
|
|
19
22
|
export declare const argsFrom: <T extends string | Word>(args: readonly T[], from: string) => T[];
|
|
20
23
|
export declare const spawningArgs: (parsed: ParsedArgs, args: string[]) => string[];
|
|
21
24
|
export declare const argsAfter: <T extends string | Word>(args: readonly T[], token: string) => T[];
|
package/dist/binaries/util.js
CHANGED
|
@@ -35,20 +35,17 @@ export const npmBooleanAliases = {
|
|
|
35
35
|
yes: 'y',
|
|
36
36
|
};
|
|
37
37
|
const valueOf = (arg) => (typeof arg === 'string' ? arg : arg.value);
|
|
38
|
-
export const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return parts.join(' ');
|
|
38
|
+
export const nodeLoadersArgs = { import: ['r', 'experimental-loader', 'require', 'loader'] };
|
|
39
|
+
const isGlobLikeMatch = /(^!|[*+\\(|{^$])/;
|
|
40
|
+
export const isGlobLike = (value) => isGlobLikeMatch.test(value);
|
|
41
|
+
export const argsFrom = (args, from) => {
|
|
42
|
+
const index = args.findIndex(arg => valueOf(arg) === from);
|
|
43
|
+
return index === -1 ? [] : args.slice(index);
|
|
44
|
+
};
|
|
45
|
+
export const spawningArgs = (parsed, args) => {
|
|
46
|
+
const index = parsed.positionalIndices?.[0];
|
|
47
|
+
return index === undefined ? (parsed['--'] ?? []) : args.slice(index);
|
|
49
48
|
};
|
|
50
|
-
export const argsFrom = (args, from) => args.slice(args.findIndex(arg => valueOf(arg) === from));
|
|
51
|
-
export const spawningArgs = (parsed, args) => parsed._[0] ? argsFrom(args, parsed._[0]) : (parsed['--'] ?? []);
|
|
52
49
|
export const argsAfter = (args, token) => {
|
|
53
50
|
const index = args.findIndex(arg => valueOf(arg) === token);
|
|
54
51
|
return index === -1 ? [] : args.slice(index + 1).filter(arg => valueOf(arg) !== '--');
|
package/dist/constants.js
CHANGED
|
@@ -24,6 +24,7 @@ export const PROTOCOL_CLOUDFLARE = 'cloudflare:';
|
|
|
24
24
|
export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
25
25
|
'alias',
|
|
26
26
|
'amplify',
|
|
27
|
+
'awk',
|
|
27
28
|
'aws',
|
|
28
29
|
'az',
|
|
29
30
|
'base64',
|
|
@@ -67,8 +68,10 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
67
68
|
'df',
|
|
68
69
|
'dir',
|
|
69
70
|
'dirname',
|
|
71
|
+
'ditto',
|
|
70
72
|
'docker',
|
|
71
73
|
'dotnet',
|
|
74
|
+
'dscl',
|
|
72
75
|
'du',
|
|
73
76
|
'echo',
|
|
74
77
|
'env',
|
|
@@ -76,10 +79,12 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
76
79
|
'exec',
|
|
77
80
|
'exit',
|
|
78
81
|
'expand',
|
|
82
|
+
'explorer.exe',
|
|
79
83
|
'export',
|
|
80
84
|
'expr',
|
|
81
85
|
'factor',
|
|
82
86
|
'false',
|
|
87
|
+
'fc-list',
|
|
83
88
|
'fg',
|
|
84
89
|
'find',
|
|
85
90
|
'fuser',
|
|
@@ -107,8 +112,10 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
107
112
|
'logname',
|
|
108
113
|
'ls',
|
|
109
114
|
'lsof',
|
|
115
|
+
'maestro',
|
|
110
116
|
'md5sum',
|
|
111
117
|
'mkdir',
|
|
118
|
+
'mkfifo',
|
|
112
119
|
'mknod',
|
|
113
120
|
'mktemp',
|
|
114
121
|
'mv',
|
|
@@ -127,6 +134,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
127
134
|
'paste',
|
|
128
135
|
'pgrep',
|
|
129
136
|
'pkill',
|
|
137
|
+
'plutil',
|
|
130
138
|
'pnpm',
|
|
131
139
|
'pnpx',
|
|
132
140
|
'powershell',
|
|
@@ -153,6 +161,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
153
161
|
'sed',
|
|
154
162
|
'seq',
|
|
155
163
|
'set',
|
|
164
|
+
'sftp',
|
|
156
165
|
'sh',
|
|
157
166
|
'sha1sum',
|
|
158
167
|
'sha512sum',
|
|
@@ -163,12 +172,17 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
163
172
|
'sort',
|
|
164
173
|
'split',
|
|
165
174
|
'ssh',
|
|
175
|
+
'ssh-add',
|
|
176
|
+
'ssh-agent',
|
|
177
|
+
'ssh-keygen',
|
|
178
|
+
'ssh-keyscan',
|
|
166
179
|
'stat',
|
|
167
180
|
'stty',
|
|
168
181
|
'sudo',
|
|
169
182
|
'sw_vers',
|
|
170
183
|
'sync',
|
|
171
184
|
'sysctl',
|
|
185
|
+
'system_profiler',
|
|
172
186
|
'systemctl',
|
|
173
187
|
'tac',
|
|
174
188
|
'tail',
|
|
@@ -200,7 +214,11 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
200
214
|
'which',
|
|
201
215
|
'who',
|
|
202
216
|
'whoami',
|
|
217
|
+
'wmic',
|
|
218
|
+
'wsl.exe',
|
|
219
|
+
'wslpath',
|
|
203
220
|
'xargs',
|
|
221
|
+
'xclip',
|
|
204
222
|
'xcodebuild',
|
|
205
223
|
'xcrun',
|
|
206
224
|
'xvfb-run',
|
|
@@ -24,7 +24,7 @@ export declare class SubpathReferences {
|
|
|
24
24
|
constructor({ chief, principal, workspaces, findWorkspacePackageTarget, isGitIgnored }: SubpathReferencesOptions);
|
|
25
25
|
private isSubpathSpecifier;
|
|
26
26
|
addInput(input: Input, owner: string): void;
|
|
27
|
-
add(specifier: string, containingFilePath: string): void;
|
|
27
|
+
add(specifier: string, containingFilePath: string, importedFilePath?: string): void;
|
|
28
28
|
release(owner: string): void;
|
|
29
29
|
reset(): void;
|
|
30
30
|
getIssues(): Issue[];
|
|
@@ -41,9 +41,9 @@ export class SubpathReferences {
|
|
|
41
41
|
if (this.isActive)
|
|
42
42
|
this.add(specifier, filePath);
|
|
43
43
|
}
|
|
44
|
-
add(specifier, containingFilePath) {
|
|
44
|
+
add(specifier, containingFilePath, importedFilePath) {
|
|
45
45
|
const workspace = this.chief.findWorkspaceByFilePath(containingFilePath);
|
|
46
|
-
const id = `${workspace?.name ?? ''}\0${specifier}`;
|
|
46
|
+
const id = `${workspace?.name ?? ''}\0${specifier}\0${importedFilePath ?? ''}`;
|
|
47
47
|
if (this.seen.has(id))
|
|
48
48
|
return;
|
|
49
49
|
this.seen.add(id);
|
|
@@ -55,9 +55,10 @@ export class SubpathReferences {
|
|
|
55
55
|
subpaths.add(target.subpath);
|
|
56
56
|
else
|
|
57
57
|
this.referenced.set(target.name, new Set([target.subpath]));
|
|
58
|
+
const skipFilePath = target.patternMatch === undefined ? undefined : importedFilePath;
|
|
58
59
|
for (const targetPath of getPackageTargetPaths(target.target, target.dir, target.patternMatch, true)) {
|
|
59
60
|
const filePath = this.principal.toSourceFilePath(targetPath, this.extensions) ?? (isFile(targetPath) ? targetPath : undefined);
|
|
60
|
-
if (filePath && !this.isGitIgnored(filePath))
|
|
61
|
+
if (filePath && filePath !== skipFilePath && !this.isGitIgnored(filePath))
|
|
61
62
|
this.principal.claimEntryPath(filePath);
|
|
62
63
|
}
|
|
63
64
|
}
|
package/dist/graph/build.js
CHANGED
|
@@ -12,7 +12,7 @@ import { isDynamicPattern } from 'tinyglobby';
|
|
|
12
12
|
import { tryRealpath } from '../util/fs.js';
|
|
13
13
|
import { createManifest } from '../util/package-json.js';
|
|
14
14
|
import { _glob, _syncGlob, prependDirToPattern as prependDir, rebasePattern, removeProductionSuffix, } from '../util/glob.js';
|
|
15
|
-
import { isAlias, isCatalog, isConfig, isEntry, isIgnore, isProductionEntry, isProject,
|
|
15
|
+
import { isAlias, isCatalog, isConfig, isEntry, isIgnore, isProductionEntry, isProject, toEntryPath, toDependency, toEntry, } from '../util/input.js';
|
|
16
16
|
import { isAmbientDeclarationFile } from '../typescript/ast-nodes.js';
|
|
17
17
|
import { resolveImportGlobs } from '../typescript/glob-imports.js';
|
|
18
18
|
import { createPublishedTypeDependencyAnalyzer } from '../typescript/get-published-type-dependencies.js';
|
|
@@ -57,6 +57,8 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
57
57
|
...chief.getIgnores(name),
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
+
if (!deputy.getWorkspaceManifest(ROOT_WORKSPACE_NAME))
|
|
61
|
+
deputy.setRootIgnores(chief.getIgnores(ROOT_WORKSPACE_NAME));
|
|
60
62
|
deputy.setWorkspacePkgNames(chief.availableWorkspacePkgNames);
|
|
61
63
|
collector.addIgnorePatterns(chief.config.ignore.map(id => ({ pattern: id, id })));
|
|
62
64
|
collector.addIgnoreFilesPatterns(chief.config.ignoreFiles.map(id => ({ pattern: id, id })));
|
|
@@ -68,7 +70,7 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
68
70
|
const containingFilePath = options.configFilePath ?? join(options.cwd, 'package.json');
|
|
69
71
|
const isLocal = isInternal(specifier);
|
|
70
72
|
const input = isLocal
|
|
71
|
-
?
|
|
73
|
+
? toEntryPath(specifier, { containingFilePath })
|
|
72
74
|
: toDependency(specifier, { containingFilePath, optional: true });
|
|
73
75
|
const owner = isLocal ? chief.findWorkspaceByFilePath(specifier)?.name : undefined;
|
|
74
76
|
const name = owner ?? ROOT_WORKSPACE_NAME;
|
|
@@ -131,7 +133,7 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
131
133
|
if (definitionPaths.length > 0) {
|
|
132
134
|
debugLogArray(name, 'Definition paths', definitionPaths);
|
|
133
135
|
for (const id of definitionPaths)
|
|
134
|
-
inputs.add(
|
|
136
|
+
inputs.add(toEntry(tryRealpath(id), { production: true, containingFilePath: tsConfigFilePath }));
|
|
135
137
|
}
|
|
136
138
|
const sharedGlobOptions = { cwd: options.cwd, dir, gitignore: options.gitignore };
|
|
137
139
|
const fn = (id) => ({
|
|
@@ -146,7 +148,7 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
146
148
|
const label = 'entry paths from package.json';
|
|
147
149
|
for (const filePath of await toSourceFilePaths(entrySpecifiersFromManifest, dir, extensionGlobStr, label)) {
|
|
148
150
|
if (!isGitIgnored(filePath))
|
|
149
|
-
inputs.add(
|
|
151
|
+
inputs.add(toEntry(filePath, { production: true }));
|
|
150
152
|
}
|
|
151
153
|
if (getPublishedTypeDependencies && !manifest.private && !manifest.publishConfig?.directory) {
|
|
152
154
|
for (const dependency of getPublishedTypeDependencies(workspace, manifest)) {
|
|
@@ -212,7 +214,6 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
212
214
|
const productionPatterns = createPatternMap();
|
|
213
215
|
const productionPatternsSkipExports = createPatternMap();
|
|
214
216
|
const projectFilePatterns = new Set();
|
|
215
|
-
const developmentFilePaths = new Set();
|
|
216
217
|
const addPattern = (map, group, pattern) => {
|
|
217
218
|
let patterns = map.get(group);
|
|
218
219
|
if (!patterns)
|
|
@@ -267,7 +268,7 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
267
268
|
if (resolvedFilePath) {
|
|
268
269
|
if (options.isProduction && !input.production) {
|
|
269
270
|
if (!input.optional)
|
|
270
|
-
|
|
271
|
+
collector.addReferencedFile(resolvedFilePath);
|
|
271
272
|
}
|
|
272
273
|
else {
|
|
273
274
|
principal.addEntryPath(resolvedFilePath, { skipExportsAnalysis: input.skipExportsAnalysis ?? true });
|
|
@@ -372,10 +373,8 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
372
373
|
for (const hint of hints)
|
|
373
374
|
collector.addConfigurationHint(hint);
|
|
374
375
|
}
|
|
375
|
-
for (const projectPath of productionPaths(projectPaths))
|
|
376
|
-
|
|
377
|
-
principal.addProjectPath(projectPath);
|
|
378
|
-
}
|
|
376
|
+
for (const projectPath of productionPaths(projectPaths))
|
|
377
|
+
principal.addProjectPath(projectPath);
|
|
379
378
|
}
|
|
380
379
|
worker.onDispose();
|
|
381
380
|
perfObserver.addMemoryMark(name);
|
|
@@ -439,8 +438,8 @@ export const build = timerify(async function build({ chief, collector, counselor
|
|
|
439
438
|
principal.addEntryPath(filePath, { skipExportsAnalysis: true });
|
|
440
439
|
}
|
|
441
440
|
if (file.imports.subpathImports) {
|
|
442
|
-
for (const specifier of file.imports.subpathImports)
|
|
443
|
-
subpathReferences.add(specifier, filePath);
|
|
441
|
+
for (const [specifier, importedFilePath] of file.imports.subpathImports)
|
|
442
|
+
subpathReferences.add(specifier, filePath, importedFilePath);
|
|
444
443
|
}
|
|
445
444
|
const wsDependencies = deputy.getDependencies(workspace.name);
|
|
446
445
|
for (const _import of file.imports.imports) {
|