knip 6.47.0 → 6.48.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 +4 -0
- package/dist/binaries/create-script-parser-context.js +2 -1
- package/dist/binaries/fallback.js +2 -3
- package/dist/binaries/plugins.js +1 -5
- package/dist/binaries/resolvers/npx.js +6 -8
- package/dist/binaries/resolvers/pnpx.js +3 -7
- package/dist/binaries/util.d.ts +4 -0
- package/dist/binaries/util.js +12 -2
- package/dist/plugins/docusaurus/helpers.js +19 -5
- package/dist/plugins/ember/index.js +4 -8
- package/dist/plugins/env/index.d.ts +3 -0
- package/dist/plugins/env/index.js +27 -0
- package/dist/plugins/esbuild/index.js +5 -0
- package/dist/plugins/firebase/index.d.ts +3 -0
- package/dist/plugins/firebase/index.js +12 -0
- package/dist/plugins/graphql-codegen/index.js +2 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +8 -0
- package/dist/plugins/netlify/index.js +12 -2
- package/dist/plugins/netlify/types.d.ts +3 -0
- package/dist/plugins/nodemon/index.js +19 -0
- package/dist/plugins/remark/helpers.js +1 -8
- package/dist/plugins/serverless-framework/index.js +14 -5
- package/dist/plugins/serverless-framework/types.d.ts +4 -1
- package/dist/plugins/sst/index.js +13 -0
- package/dist/plugins/sst/resolveFromAST.js +11 -1
- package/dist/plugins/storybook/index.js +3 -3
- package/dist/plugins/storybook/types.d.ts +5 -3
- package/dist/plugins/textlint/helpers.js +1 -5
- package/dist/plugins/ts-node/index.d.ts +6 -0
- package/dist/plugins/ts-node/index.js +19 -0
- package/dist/plugins/ts-node-dev/index.d.ts +3 -0
- package/dist/plugins/ts-node-dev/index.js +46 -0
- package/dist/plugins/tsup/index.js +2 -0
- package/dist/plugins/typescript/index.js +6 -1
- package/dist/plugins/vite/helpers.js +1 -4
- package/dist/plugins/vite-node/index.d.ts +3 -0
- package/dist/plugins/vite-node/index.js +11 -0
- package/dist/plugins/webdriver-io/index.js +6 -2
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +4 -0
- package/dist/types/tsconfig-json.d.ts +5 -0
- package/dist/typescript/ast-helpers.d.ts +3 -1
- package/dist/typescript/ast-helpers.js +14 -4
- package/dist/typescript/visitors/exports.js +11 -8
- package/dist/typescript/visitors/imports.js +10 -8
- package/dist/typescript/visitors/members.js +10 -8
- package/dist/util/create-input-handler.js +2 -2
- package/dist/util/package-json.d.ts +1 -0
- package/dist/util/package-json.js +21 -9
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +16 -0
|
@@ -120,6 +120,7 @@ export declare class ConfigurationChief {
|
|
|
120
120
|
eleventy?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
121
121
|
ember?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
122
122
|
"ember-template-lint"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
123
|
+
env?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
123
124
|
"env-cmd"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
124
125
|
esbuild?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
125
126
|
eslint?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -131,6 +132,7 @@ export declare class ConfigurationChief {
|
|
|
131
132
|
"expressive-code"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
132
133
|
fast?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
133
134
|
"filesystem-routing"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
135
|
+
firebase?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
134
136
|
flue?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
135
137
|
fumadocs?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
136
138
|
gatsby?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -258,6 +260,7 @@ export declare class ConfigurationChief {
|
|
|
258
260
|
travis?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
259
261
|
"trigger-dev"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
260
262
|
"ts-node"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
263
|
+
"ts-node-dev"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
261
264
|
tsd?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
262
265
|
tsdown?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
263
266
|
tsrs?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -280,6 +283,7 @@ export declare class ConfigurationChief {
|
|
|
280
283
|
"vercel-og"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
281
284
|
vike?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
282
285
|
vite?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
286
|
+
"vite-node"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
283
287
|
"vite-plugin-pages"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
284
288
|
"vite-plugin-pwa"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
285
289
|
"vite-plugin-vue-layouts-next"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ROOT_WORKSPACE_NAME } from '../constants.js';
|
|
1
2
|
import { createManifest } from '../util/package-json.js';
|
|
2
3
|
export const createScriptParserContext = (chief) => {
|
|
3
|
-
const rawRootManifest = chief.getManifestForWorkspace(
|
|
4
|
+
const rawRootManifest = chief.getManifestForWorkspace(ROOT_WORKSPACE_NAME);
|
|
4
5
|
const rootManifest = rawRootManifest ? createManifest(rawRootManifest) : undefined;
|
|
5
6
|
const manifests = new Map();
|
|
6
7
|
const getManifest = (dir) => {
|
|
@@ -3,10 +3,9 @@ import { compact } from '../util/array.js';
|
|
|
3
3
|
import { toModule, toEntry } from '../util/input.js';
|
|
4
4
|
import { isValidBinary } from '../util/modules.js';
|
|
5
5
|
import { isAbsolute } from '../util/path.js';
|
|
6
|
-
import { argsFrom, toCommandBinary } from './util.js';
|
|
6
|
+
import { argsFrom, isEnvAssignment, toCommandBinary } from './util.js';
|
|
7
7
|
export const shellSpawningBinaries = ['cross-env-shell'];
|
|
8
8
|
export const spawningBinaries = ['cross-env', ...shellSpawningBinaries];
|
|
9
|
-
const isEnvAssignment = /^\w+=/;
|
|
10
9
|
export const getEnvAssignmentCount = (values) => {
|
|
11
10
|
let count = 0;
|
|
12
11
|
while (count < values.length && isEnvAssignment.test(values[count]))
|
|
@@ -18,7 +17,7 @@ const commandFlagBinaries = new Map([
|
|
|
18
17
|
['doppler', ['command']],
|
|
19
18
|
['infisical', ['command', 'c']],
|
|
20
19
|
]);
|
|
21
|
-
const positionals = new Set(['babel-node', '
|
|
20
|
+
const positionals = new Set(['babel-node', 'execa', 'jiti', 'oxnode', 'zx']);
|
|
22
21
|
const positionalBinaries = new Set(['concurrently']);
|
|
23
22
|
export const isWrapper = (binary) => spawningBinaries.includes(binary) || endOfCommandBinaries.includes(binary) || positionalBinaries.has(binary);
|
|
24
23
|
const parse = (binary, words) => parseArgs(words, {
|
package/dist/binaries/plugins.js
CHANGED
|
@@ -7,12 +7,8 @@ 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
9
|
import { getEnvAssignmentCount, getWrappedScripts, isWrapper as isFallbackWrapper, resolve as fallbackResolve, shellSpawningBinaries, spawningBinaries, } from './fallback.js';
|
|
10
|
-
import { isGlobLike, nodeLoadersArgs, toCommandBinary, toWordArgs } from './util.js';
|
|
10
|
+
import { isGlobLike, nodeLoadersArgs, toCommandBinary, toShellAssignment, toWordArgs } from './util.js';
|
|
11
11
|
export const isWrapper = (binary) => !!pluginArgsMap.get(binary)?.[1].fromArgs || isFallbackWrapper(binary);
|
|
12
|
-
const toShellAssignment = (assignment) => {
|
|
13
|
-
const index = assignment.indexOf('=');
|
|
14
|
-
return `${assignment.slice(0, index)}='${assignment.slice(index + 1).replaceAll("'", "'\\''")}'`;
|
|
15
|
-
};
|
|
16
12
|
const toCrossEnvCommand = (args) => {
|
|
17
13
|
const command = args.slice();
|
|
18
14
|
const count = getEnvAssignmentCount(args);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
2
|
import { toBinary, toModule, toDependency } from '../../util/input.js';
|
|
3
|
-
import { stripVersionFromSpecifier } from '../../util/modules.js';
|
|
3
|
+
import { extractBinary, stripVersionFromSpecifier } from '../../util/modules.js';
|
|
4
4
|
import { isInternal } from '../../util/path.js';
|
|
5
|
-
import { argsFrom, npmBooleanAliases, npmBooleanFlags } from '../util.js';
|
|
5
|
+
import { argsFrom, npmBooleanAliases, npmBooleanFlags, removeOuterCommand } 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;
|
|
@@ -24,10 +24,8 @@ export const resolve = (_binary, words, options) => {
|
|
|
24
24
|
const opts = noInstall ? undefined : { optional: true };
|
|
25
25
|
const dependency = isBinary ? toBinary(specifier, opts) : toPackage(specifier, opts);
|
|
26
26
|
const specifiers = dependency ? [dependency] : [];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...fromArgs(argsFrom(words, packageSpecifier)).slice(1),
|
|
32
|
-
];
|
|
27
|
+
const forwarded = packageSpecifier ? fromArgs(argsFrom(words, packageSpecifier)) : [];
|
|
28
|
+
if (forwarded.length > 0)
|
|
29
|
+
removeOuterCommand(forwarded, extractBinary(packageSpecifier));
|
|
30
|
+
return [...specifiers, ...packages.map(id => toPackage(id, { optional: true })), ...command, ...forwarded];
|
|
33
31
|
};
|
|
@@ -2,6 +2,7 @@ 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
4
|
import { extractBinary, stripVersionFromSpecifier } from '../../util/modules.js';
|
|
5
|
+
import { removeOuterCommand } from '../util.js';
|
|
5
6
|
const toDependencyInputs = (packageSpecifier) => {
|
|
6
7
|
const dependency = toDependency(stripVersionFromSpecifier(packageSpecifier), { optional: true });
|
|
7
8
|
const reference = getCatalogReference(packageSpecifier);
|
|
@@ -22,13 +23,8 @@ export const resolveDlx = (words, options) => {
|
|
|
22
23
|
const dependencyInputs = packageSpecifier ? toDependencyInputs(packageSpecifier) : [];
|
|
23
24
|
const executable = packageSpecifier ? extractBinary(String(packageSpecifier)) : '';
|
|
24
25
|
const forwarded = executable && !flags.dir ? options.fromArgs([executable, ...words.slice(commandIndex + 1)]) : [];
|
|
25
|
-
|
|
26
|
-
return [
|
|
27
|
-
...dependencyInputs,
|
|
28
|
-
...packages.flatMap(toDependencyInputs),
|
|
29
|
-
...command,
|
|
30
|
-
...(isOuterCommand ? forwarded.slice(1) : forwarded),
|
|
31
|
-
];
|
|
26
|
+
removeOuterCommand(forwarded, executable);
|
|
27
|
+
return [...dependencyInputs, ...packages.flatMap(toDependencyInputs), ...command, ...forwarded];
|
|
32
28
|
};
|
|
33
29
|
export const resolve = (_binary, words, options) => {
|
|
34
30
|
return resolveDlx(words, options);
|
package/dist/binaries/util.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { type Input } from '../util/input.ts';
|
|
|
5
5
|
export declare const toCommandBinary: (binary: string, { optionalBinaries }: GetInputsFromScriptsOptions, inputOptions?: {
|
|
6
6
|
dir?: string;
|
|
7
7
|
}) => Input;
|
|
8
|
+
export declare const removeOuterCommand: (inputs: Input[], executable: string) => void;
|
|
8
9
|
export declare const npmBooleanFlags: string[];
|
|
9
10
|
export declare const npmBooleanAliases: {
|
|
10
11
|
force: string;
|
|
@@ -18,8 +19,11 @@ export declare const npmBooleanAliases: {
|
|
|
18
19
|
export declare const nodeLoadersArgs: {
|
|
19
20
|
import: string[];
|
|
20
21
|
};
|
|
22
|
+
export declare const isEnvAssignment: RegExp;
|
|
23
|
+
export declare const toShellAssignment: (assignment: string) => string;
|
|
21
24
|
export declare const isGlobLike: (value: string) => boolean;
|
|
22
25
|
export declare const argsFrom: <T extends string | Word>(args: readonly T[], from: string) => T[];
|
|
26
|
+
export declare const argsFromPositional: (parsed: ParsedArgs, args: string[], position: number) => string[];
|
|
23
27
|
export declare const spawningArgs: (parsed: ParsedArgs, args: string[]) => string[];
|
|
24
28
|
export declare const argsAfter: <T extends string | Word>(args: readonly T[], token: string) => T[];
|
|
25
29
|
export declare const toWordArgs: (values: (string | number)[], words: Word[]) => ScriptArg[];
|
package/dist/binaries/util.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import parseArgs, {} from '../util/parse-args.js';
|
|
2
2
|
import { toBinary } from '../util/input.js';
|
|
3
3
|
export const toCommandBinary = (binary, { optionalBinaries }, inputOptions = {}) => toBinary(binary, optionalBinaries ? { ...inputOptions, optional: true } : inputOptions);
|
|
4
|
+
export const removeOuterCommand = (inputs, executable) => {
|
|
5
|
+
if (inputs[0]?.specifier === executable)
|
|
6
|
+
inputs.shift();
|
|
7
|
+
};
|
|
4
8
|
export const npmBooleanFlags = [
|
|
5
9
|
'color',
|
|
6
10
|
'd',
|
|
@@ -36,16 +40,22 @@ export const npmBooleanAliases = {
|
|
|
36
40
|
};
|
|
37
41
|
const valueOf = (arg) => (typeof arg === 'string' ? arg : arg.value);
|
|
38
42
|
export const nodeLoadersArgs = { import: ['r', 'experimental-loader', 'require', 'loader'] };
|
|
43
|
+
export const isEnvAssignment = /^\w+=/;
|
|
44
|
+
export const toShellAssignment = (assignment) => {
|
|
45
|
+
const index = assignment.indexOf('=');
|
|
46
|
+
return `${assignment.slice(0, index)}='${assignment.slice(index + 1).replaceAll("'", "'\\''")}'`;
|
|
47
|
+
};
|
|
39
48
|
const isGlobLikeMatch = /(^!|[*+\\(|{^$])/;
|
|
40
49
|
export const isGlobLike = (value) => isGlobLikeMatch.test(value);
|
|
41
50
|
export const argsFrom = (args, from) => {
|
|
42
51
|
const index = args.findIndex(arg => valueOf(arg) === from);
|
|
43
52
|
return index === -1 ? [] : args.slice(index);
|
|
44
53
|
};
|
|
45
|
-
export const
|
|
46
|
-
const index = parsed.positionalIndices?.[
|
|
54
|
+
export const argsFromPositional = (parsed, args, position) => {
|
|
55
|
+
const index = parsed.positionalIndices?.[position];
|
|
47
56
|
return index === undefined ? (parsed['--'] ?? []) : args.slice(index);
|
|
48
57
|
};
|
|
58
|
+
export const spawningArgs = (parsed, args) => argsFromPositional(parsed, args, 0);
|
|
49
59
|
export const argsAfter = (args, token) => {
|
|
50
60
|
const index = args.findIndex(arg => valueOf(arg) === token);
|
|
51
61
|
return index === -1 ? [] : args.slice(index + 1).filter(arg => valueOf(arg) !== '--');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { toDependency, toEntryPath } from '../../util/input.js';
|
|
2
|
+
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
2
3
|
import { isAbsolute, toAbsolute } from '../../util/path.js';
|
|
3
4
|
import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
|
|
4
5
|
const isLocalPath = (name) => name.startsWith('.') || isAbsolute(name);
|
|
@@ -42,7 +43,20 @@ export const CORE_CLIENT_API = [
|
|
|
42
43
|
'useIsomorphicLayoutEffect',
|
|
43
44
|
'useRouteContext',
|
|
44
45
|
];
|
|
45
|
-
const
|
|
46
|
+
const getNamePatterns = (name, type) => {
|
|
47
|
+
if (!name.startsWith('@'))
|
|
48
|
+
return [name, `@docusaurus/${type}-${name}`, `docusaurus-${type}-${name}`];
|
|
49
|
+
const index = name.indexOf('/');
|
|
50
|
+
if (index === -1)
|
|
51
|
+
return [`${name}/docusaurus-${type}`];
|
|
52
|
+
return [name, `${name.slice(0, index)}/docusaurus-${type}-${name.slice(index + 1)}`];
|
|
53
|
+
};
|
|
54
|
+
const resolveModuleName = (name, type, manifest) => {
|
|
55
|
+
for (const pattern of getNamePatterns(name, type)) {
|
|
56
|
+
const packageName = getPackageNameFromModuleSpecifier(pattern);
|
|
57
|
+
if (packageName && manifest.allDependencies.has(packageName))
|
|
58
|
+
return pattern;
|
|
59
|
+
}
|
|
46
60
|
if (name.includes(`${type}-`))
|
|
47
61
|
return name;
|
|
48
62
|
if (!name.startsWith('@')) {
|
|
@@ -57,14 +71,14 @@ const resolveSidebarPath = (config) => {
|
|
|
57
71
|
const path = config?.sidebarPath ?? config?.docs?.sidebarPath;
|
|
58
72
|
return typeof path === 'string' ? path : undefined;
|
|
59
73
|
};
|
|
60
|
-
const resolveArrayConfig = ([name, config], type, cwd) => {
|
|
74
|
+
const resolveArrayConfig = ([name, config], type, { cwd, manifest }) => {
|
|
61
75
|
if (typeof name !== 'string')
|
|
62
76
|
return [];
|
|
63
77
|
const sidebarPath = type !== 'theme' ? resolveSidebarPath(config) : undefined;
|
|
64
78
|
const sidebar = sidebarPath ? [toEntryPath(sidebarPath, { production: true, dir: cwd })] : [];
|
|
65
79
|
if (isLocalPath(name))
|
|
66
80
|
return [toEntryPath(toAbsolute(name, cwd), { production: true }), ...sidebar];
|
|
67
|
-
return [toDependency(resolveModuleName(name, type), { production: type !== 'plugin' }), ...sidebar];
|
|
81
|
+
return [toDependency(resolveModuleName(name, type, manifest), { production: type !== 'plugin' }), ...sidebar];
|
|
68
82
|
};
|
|
69
83
|
export const resolveConfigItems = async (items, type, options) => {
|
|
70
84
|
const inputs = new Set();
|
|
@@ -77,10 +91,10 @@ export const resolveConfigItems = async (items, type, options) => {
|
|
|
77
91
|
if (isLocalPath(item))
|
|
78
92
|
inputs.add(toEntryPath(toAbsolute(item, options.cwd), { production: true }));
|
|
79
93
|
else
|
|
80
|
-
inputs.add(toDependency(resolveModuleName(item, type), { production: type !== 'plugin' }));
|
|
94
|
+
inputs.add(toDependency(resolveModuleName(item, type, options.manifest), { production: type !== 'plugin' }));
|
|
81
95
|
}
|
|
82
96
|
else if (Array.isArray(item)) {
|
|
83
|
-
for (const input of resolveArrayConfig(item, type, options
|
|
97
|
+
for (const input of resolveArrayConfig(item, type, options))
|
|
84
98
|
inputs.add(input);
|
|
85
99
|
}
|
|
86
100
|
else if (typeof item.configureWebpack === 'function') {
|
|
@@ -78,17 +78,13 @@ const resolve = async ({ cwd, manifest }) => {
|
|
|
78
78
|
inputs.push(toAlias(`${manifest.name}/tests/*`, './tests/*', { dir: cwd }), toAlias(`${manifest.name}/*`, './app/*', { dir: cwd }));
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const isDeclared = (name) => Boolean(manifest.dependencies?.[name] ||
|
|
82
|
-
manifest.devDependencies?.[name] ||
|
|
83
|
-
manifest.peerDependencies?.[name] ||
|
|
84
|
-
manifest.optionalDependencies?.[name]);
|
|
85
81
|
const checked = new Set();
|
|
86
82
|
const provided = new Set();
|
|
87
83
|
for (const dependencies of [manifest.dependencies, manifest.devDependencies, manifest.peerDependencies]) {
|
|
88
84
|
for (const name in dependencies) {
|
|
89
85
|
if (name === 'ember-auto-import')
|
|
90
86
|
inputs.push(toDependency('webpack', { production: true, optional: true }));
|
|
91
|
-
if (name === 'ember-fetch' && !
|
|
87
|
+
if (name === 'ember-fetch' && !manifest.allDependencies.has('fetch'))
|
|
92
88
|
provided.add('fetch');
|
|
93
89
|
const path = resolvePackageManifestPath(name, cwd);
|
|
94
90
|
if (!path)
|
|
@@ -102,7 +98,7 @@ const resolve = async ({ cwd, manifest }) => {
|
|
|
102
98
|
}
|
|
103
99
|
const dir = dirname(path);
|
|
104
100
|
for (const dependency in pkg.dependencies) {
|
|
105
|
-
if (checked.has(dependency) ||
|
|
101
|
+
if (checked.has(dependency) || manifest.allDependencies.has(dependency))
|
|
106
102
|
continue;
|
|
107
103
|
checked.add(dependency);
|
|
108
104
|
const nestedPath = resolvePackageManifestPath(dependency, dir);
|
|
@@ -115,13 +111,13 @@ const resolve = async ({ cwd, manifest }) => {
|
|
|
115
111
|
...getModuleNames(join(dir, 'dist/packages')),
|
|
116
112
|
...getModuleNames(join(dir, 'dist/dependencies')),
|
|
117
113
|
]) {
|
|
118
|
-
if (!
|
|
114
|
+
if (!manifest.allDependencies.has(module))
|
|
119
115
|
provided.add(module);
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
for (const specifier in renamedModules) {
|
|
123
119
|
const packageName = getPackageNameFromSpecifier(specifier);
|
|
124
|
-
if (packageName && !
|
|
120
|
+
if (packageName && !manifest.allDependencies.has(packageName))
|
|
125
121
|
provided.add(packageName);
|
|
126
122
|
}
|
|
127
123
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isEnvAssignment, spawningArgs, toShellAssignment } from '../../binaries/util.js';
|
|
2
|
+
const title = 'env';
|
|
3
|
+
const isAssignmentOrSubstitution = (arg) => isEnvAssignment.test(arg) || arg.startsWith('$(');
|
|
4
|
+
const options = {
|
|
5
|
+
boolean: ['debug', 'ignore-environment'],
|
|
6
|
+
string: ['chdir'],
|
|
7
|
+
alias: { chdir: ['C'], debug: ['v'], 'ignore-environment': ['i'] },
|
|
8
|
+
};
|
|
9
|
+
const args = {
|
|
10
|
+
...options,
|
|
11
|
+
stopEarly: true,
|
|
12
|
+
fromArgs: (parsed, args) => {
|
|
13
|
+
const command = spawningArgs(parsed, args);
|
|
14
|
+
if (parsed.chdir)
|
|
15
|
+
return [];
|
|
16
|
+
const index = command.findIndex(arg => !isAssignmentOrSubstitution(arg));
|
|
17
|
+
if (index === -1)
|
|
18
|
+
return [];
|
|
19
|
+
const assignments = command.slice(0, index).filter(arg => !arg.startsWith('$('));
|
|
20
|
+
return [...assignments.map(toShellAssignment), ...command.slice(index)];
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const plugin = {
|
|
24
|
+
title,
|
|
25
|
+
args,
|
|
26
|
+
};
|
|
27
|
+
export default plugin;
|
|
@@ -7,11 +7,16 @@ const enablers = ['esbuild'];
|
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
8
|
const config = ['esbuild.config.{js,mjs,cjs,ts,mts,cts}', 'esbuild.{js,mjs,cjs,ts,mts,cts}'];
|
|
9
9
|
const resolveFromAST = (program, { configFileDir }) => Array.from(collectPropertyValues(program, 'entryPoints'), id => toEntry(join(configFileDir, id), { production: true }));
|
|
10
|
+
const args = {
|
|
11
|
+
boolean: true,
|
|
12
|
+
resolveInputs: parsed => parsed._.map(id => toEntry(id, { production: true })),
|
|
13
|
+
};
|
|
10
14
|
const plugin = {
|
|
11
15
|
title,
|
|
12
16
|
enablers,
|
|
13
17
|
isEnabled,
|
|
14
18
|
config,
|
|
15
19
|
resolveFromAST,
|
|
20
|
+
args,
|
|
16
21
|
};
|
|
17
22
|
export default plugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const title = 'Firebase';
|
|
2
|
+
const args = {
|
|
3
|
+
binaries: ['firebase', 'firebase-tools'],
|
|
4
|
+
boolean: ['debug', 'interactive', 'json', 'non-interactive', 'ui'],
|
|
5
|
+
alias: { interactive: ['i'], json: ['j'] },
|
|
6
|
+
fromArgs: parsed => (parsed._[0] === 'emulators:exec' && parsed._[1] ? parsed._[1] : []),
|
|
7
|
+
};
|
|
8
|
+
const plugin = {
|
|
9
|
+
title,
|
|
10
|
+
args,
|
|
11
|
+
};
|
|
12
|
+
export default plugin;
|
|
@@ -8,6 +8,8 @@ const enablers = [/^@graphql-codegen\//, 'graphql-config'];
|
|
|
8
8
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
9
9
|
const args = {
|
|
10
10
|
config: true,
|
|
11
|
+
resolve: ['require'],
|
|
12
|
+
alias: { require: ['r'] },
|
|
11
13
|
};
|
|
12
14
|
const packageJsonPath = manifest => get(manifest, 'codegen') ?? get(manifest, 'graphql');
|
|
13
15
|
const config = [
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare const Plugins: {
|
|
|
36
36
|
eleventy: import("../types/config.ts").Plugin;
|
|
37
37
|
ember: import("../types/config.ts").Plugin;
|
|
38
38
|
'ember-template-lint': import("../types/config.ts").Plugin;
|
|
39
|
+
env: import("../types/config.ts").Plugin;
|
|
39
40
|
'env-cmd': import("../types/config.ts").Plugin;
|
|
40
41
|
esbuild: import("../types/config.ts").Plugin;
|
|
41
42
|
eslint: import("../types/config.ts").Plugin;
|
|
@@ -52,6 +53,7 @@ export declare const Plugins: {
|
|
|
52
53
|
};
|
|
53
54
|
fast: import("../types/config.ts").Plugin;
|
|
54
55
|
'filesystem-routing': import("../types/config.ts").Plugin;
|
|
56
|
+
firebase: import("../types/config.ts").Plugin;
|
|
55
57
|
flue: import("../types/config.ts").Plugin;
|
|
56
58
|
fumadocs: import("../types/config.ts").Plugin;
|
|
57
59
|
gatsby: import("../types/config.ts").Plugin;
|
|
@@ -179,6 +181,7 @@ export declare const Plugins: {
|
|
|
179
181
|
travis: import("../types/config.ts").Plugin;
|
|
180
182
|
'trigger-dev': import("../types/config.ts").Plugin;
|
|
181
183
|
'ts-node': import("../types/config.ts").Plugin;
|
|
184
|
+
'ts-node-dev': import("../types/config.ts").Plugin;
|
|
182
185
|
tsd: import("../types/config.ts").Plugin;
|
|
183
186
|
tsdown: import("../types/config.ts").Plugin;
|
|
184
187
|
tsrs: import("../types/config.ts").Plugin;
|
|
@@ -201,6 +204,7 @@ export declare const Plugins: {
|
|
|
201
204
|
'vercel-og': import("../types/config.ts").Plugin;
|
|
202
205
|
vike: import("../types/config.ts").Plugin;
|
|
203
206
|
vite: import("../types/config.ts").Plugin;
|
|
207
|
+
'vite-node': import("../types/config.ts").Plugin;
|
|
204
208
|
'vite-plugin-pages': import("../types/config.ts").Plugin;
|
|
205
209
|
'vite-plugin-pwa': import("../types/config.ts").Plugin;
|
|
206
210
|
'vite-plugin-vue-layouts-next': import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -35,6 +35,7 @@ import { default as electronVite } from './electron-vite/index.js';
|
|
|
35
35
|
import { default as eleventy } from './eleventy/index.js';
|
|
36
36
|
import { default as ember } from './ember/index.js';
|
|
37
37
|
import { default as emberTemplateLint } from './ember-template-lint/index.js';
|
|
38
|
+
import { default as env } from './env/index.js';
|
|
38
39
|
import { default as envCmd } from './env-cmd/index.js';
|
|
39
40
|
import { default as esbuild } from './esbuild/index.js';
|
|
40
41
|
import { default as eslint } from './eslint/index.js';
|
|
@@ -46,6 +47,7 @@ import { default as expoRouter } from './expo-router/index.js';
|
|
|
46
47
|
import { default as expressiveCode } from './expressive-code/index.js';
|
|
47
48
|
import { default as fast } from './fast/index.js';
|
|
48
49
|
import { default as filesystemRouting } from './filesystem-routing/index.js';
|
|
50
|
+
import { default as firebase } from './firebase/index.js';
|
|
49
51
|
import { default as flue } from './flue/index.js';
|
|
50
52
|
import { default as fumadocs } from './fumadocs/index.js';
|
|
51
53
|
import { default as gatsby } from './gatsby/index.js';
|
|
@@ -173,6 +175,7 @@ import { default as textlint } from './textlint/index.js';
|
|
|
173
175
|
import { default as travis } from './travis/index.js';
|
|
174
176
|
import { default as triggerDev } from './trigger-dev/index.js';
|
|
175
177
|
import { default as tsNode } from './ts-node/index.js';
|
|
178
|
+
import { default as tsNodeDev } from './ts-node-dev/index.js';
|
|
176
179
|
import { default as tsd } from './tsd/index.js';
|
|
177
180
|
import { default as tsdown } from './tsdown/index.js';
|
|
178
181
|
import { default as tsrs } from './tsrs/index.js';
|
|
@@ -195,6 +198,7 @@ import { default as vercel } from './vercel/index.js';
|
|
|
195
198
|
import { default as vercelOg } from './vercel-og/index.js';
|
|
196
199
|
import { default as vike } from './vike/index.js';
|
|
197
200
|
import { default as vite } from './vite/index.js';
|
|
201
|
+
import { default as viteNode } from './vite-node/index.js';
|
|
198
202
|
import { default as vitePluginPages } from './vite-plugin-pages/index.js';
|
|
199
203
|
import { default as vitePluginPwa } from './vite-plugin-pwa/index.js';
|
|
200
204
|
import { default as vitePluginVueLayoutsNext } from './vite-plugin-vue-layouts-next/index.js';
|
|
@@ -251,6 +255,7 @@ export const Plugins = {
|
|
|
251
255
|
eleventy,
|
|
252
256
|
ember,
|
|
253
257
|
'ember-template-lint': emberTemplateLint,
|
|
258
|
+
env,
|
|
254
259
|
'env-cmd': envCmd,
|
|
255
260
|
esbuild,
|
|
256
261
|
eslint,
|
|
@@ -262,6 +267,7 @@ export const Plugins = {
|
|
|
262
267
|
'expressive-code': expressiveCode,
|
|
263
268
|
fast,
|
|
264
269
|
'filesystem-routing': filesystemRouting,
|
|
270
|
+
firebase,
|
|
265
271
|
flue,
|
|
266
272
|
fumadocs,
|
|
267
273
|
gatsby,
|
|
@@ -389,6 +395,7 @@ export const Plugins = {
|
|
|
389
395
|
travis,
|
|
390
396
|
'trigger-dev': triggerDev,
|
|
391
397
|
'ts-node': tsNode,
|
|
398
|
+
'ts-node-dev': tsNodeDev,
|
|
392
399
|
tsd,
|
|
393
400
|
tsdown,
|
|
394
401
|
tsrs,
|
|
@@ -411,6 +418,7 @@ export const Plugins = {
|
|
|
411
418
|
'vercel-og': vercelOg,
|
|
412
419
|
vike,
|
|
413
420
|
vite,
|
|
421
|
+
'vite-node': viteNode,
|
|
414
422
|
'vite-plugin-pages': vitePluginPages,
|
|
415
423
|
'vite-plugin-pwa': vitePluginPwa,
|
|
416
424
|
'vite-plugin-vue-layouts-next': vitePluginVueLayoutsNext,
|
|
@@ -3,12 +3,21 @@ import { isInternal, join } from '../../util/path.js';
|
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { extractFunctionsConfigProperty } from './helpers.js';
|
|
5
5
|
const title = 'Netlify';
|
|
6
|
-
const enablers = [/^@netlify\/plugin-/, 'netlify-cli', '@netlify/functions'];
|
|
6
|
+
const enablers = [/^@netlify\/plugin-/, 'netlify-cli', '@netlify/functions', '@netlify/edge-functions'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
8
|
const config = ['netlify.toml'];
|
|
9
9
|
const NETLIFY_FUNCTIONS_DIR = 'netlify/functions';
|
|
10
10
|
const NETLIFY_FUNCTIONS_EXTS = 'js,mjs,cjs,ts,mts,cts';
|
|
11
|
-
const
|
|
11
|
+
const NETLIFY_EDGE_FUNCTIONS_DIR = 'netlify/edge-functions';
|
|
12
|
+
const NETLIFY_EDGE_FUNCTIONS_EXTS = 'js,jsx,mjs,mts,ts,tsx';
|
|
13
|
+
const toEdgeFunctionPatterns = (dir) => [
|
|
14
|
+
join(dir, `*.{${NETLIFY_EDGE_FUNCTIONS_EXTS}}`),
|
|
15
|
+
join(dir, `*/index.{${NETLIFY_EDGE_FUNCTIONS_EXTS}}`),
|
|
16
|
+
];
|
|
17
|
+
const production = [
|
|
18
|
+
`${NETLIFY_FUNCTIONS_DIR}/**/*.{${NETLIFY_FUNCTIONS_EXTS}}`,
|
|
19
|
+
...toEdgeFunctionPatterns(NETLIFY_EDGE_FUNCTIONS_DIR),
|
|
20
|
+
];
|
|
12
21
|
const toPluginInput = (id) => {
|
|
13
22
|
const specifier = id.startsWith('/') ? `.${id}` : id;
|
|
14
23
|
return isInternal(specifier) ? toModule(specifier) : toDependency(id);
|
|
@@ -17,6 +26,7 @@ const resolveConfig = async (localConfig) => {
|
|
|
17
26
|
return [
|
|
18
27
|
...extractFunctionsConfigProperty(localConfig.functions || {}, 'included_files'),
|
|
19
28
|
join(localConfig.functions?.directory ?? NETLIFY_FUNCTIONS_DIR, `**/*.{${NETLIFY_FUNCTIONS_EXTS}}`),
|
|
29
|
+
...toEdgeFunctionPatterns(localConfig.build?.edge_functions ?? NETLIFY_EDGE_FUNCTIONS_DIR),
|
|
20
30
|
]
|
|
21
31
|
.filter(file => !file.startsWith('!'))
|
|
22
32
|
.map(id => toEntry(id, { production: true }))
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
1
2
|
const title = 'nodemon';
|
|
3
|
+
const enablers = ['nodemon'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const config = ['nodemon.json', 'package.json'];
|
|
6
|
+
const packageJsonPath = 'nodemonConfig';
|
|
7
|
+
const resolveConfig = (config, options) => {
|
|
8
|
+
if (!config.exec)
|
|
9
|
+
return [];
|
|
10
|
+
const inputs = options.getInputsFromScripts(config.exec, { optionalBinaries: true });
|
|
11
|
+
for (const input of inputs)
|
|
12
|
+
input.dir ??= options.cwd;
|
|
13
|
+
return inputs;
|
|
14
|
+
};
|
|
2
15
|
const args = {
|
|
3
16
|
positional: false,
|
|
4
17
|
nodeImportArgs: true,
|
|
5
18
|
alias: { exec: ['x'] },
|
|
6
19
|
fromArgs: ['exec'],
|
|
20
|
+
config: ['config'],
|
|
7
21
|
};
|
|
8
22
|
const plugin = {
|
|
9
23
|
title,
|
|
24
|
+
enablers,
|
|
25
|
+
isEnabled,
|
|
26
|
+
config,
|
|
27
|
+
packageJsonPath,
|
|
28
|
+
resolveConfig,
|
|
10
29
|
args,
|
|
11
30
|
};
|
|
12
31
|
export default plugin;
|
|
@@ -22,18 +22,11 @@ const getCandidates = (prefix, identifier) => {
|
|
|
22
22
|
return [identifier];
|
|
23
23
|
return [prefix + name, name];
|
|
24
24
|
};
|
|
25
|
-
const getDeclaredDependencies = (manifest) => new Set([
|
|
26
|
-
...Object.keys(manifest.dependencies ?? {}),
|
|
27
|
-
...Object.keys(manifest.devDependencies ?? {}),
|
|
28
|
-
...Object.keys(manifest.optionalDependencies ?? {}),
|
|
29
|
-
...Object.keys(manifest.peerDependencies ?? {}),
|
|
30
|
-
]);
|
|
31
25
|
const pickCandidate = (prefix, identifier, manifest) => {
|
|
32
26
|
const candidates = getCandidates(prefix, identifier);
|
|
33
27
|
if (candidates.length === 1 || isInternal(candidates[0]))
|
|
34
28
|
return candidates[0];
|
|
35
|
-
|
|
36
|
-
return candidates.find(candidate => dependencies.has(candidate)) ?? candidates[0];
|
|
29
|
+
return candidates.find(candidate => manifest.allDependencies.has(candidate)) ?? candidates[0];
|
|
37
30
|
};
|
|
38
31
|
export const resolveLoadPluginStylePluginName = (prefix, identifier, manifest) => {
|
|
39
32
|
prefix = prefix + (prefix.at(-1) === '-' ? '' : '-');
|
|
@@ -27,7 +27,11 @@ const handlerToEntry = (handler, dir) => {
|
|
|
27
27
|
const file = handler.slice(0, dot);
|
|
28
28
|
return toEntryPath(file, { production: true, dir });
|
|
29
29
|
};
|
|
30
|
-
const pluginToInput = (plugin, dir) => isInternal(plugin)
|
|
30
|
+
const pluginToInput = (plugin, dir, localPath) => isInternal(plugin)
|
|
31
|
+
? toEntryPath(toAbsolute(plugin, dir), { production: true })
|
|
32
|
+
: localPath
|
|
33
|
+
? toEntryPath(plugin, { production: true, dir: toAbsolute(localPath, dir) })
|
|
34
|
+
: toDependency(plugin);
|
|
31
35
|
const getFunctionEntries = async (functions, dir, cwd) => {
|
|
32
36
|
const entries = [];
|
|
33
37
|
const resolved = await resolveFileVariable(functions, dir);
|
|
@@ -49,9 +53,14 @@ const getInjectEntries = (esbuild, dir) => esbuild && typeof esbuild === 'object
|
|
|
49
53
|
export const resolveConfig = async (config, options) => {
|
|
50
54
|
const functions = await getFunctionEntries(config.functions, options.configFileDir, options.cwd);
|
|
51
55
|
const resolvedPlugins = await resolveFileVariable(config.plugins, options.configFileDir);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
const pluginConfig = isRecord(resolvedPlugins) ? resolvedPlugins : undefined;
|
|
57
|
+
const pluginModules = Array.isArray(resolvedPlugins)
|
|
58
|
+
? resolvedPlugins
|
|
59
|
+
: pluginConfig && Array.isArray(pluginConfig.modules)
|
|
60
|
+
? pluginConfig.modules
|
|
61
|
+
: [];
|
|
62
|
+
const localPath = pluginConfig && typeof pluginConfig.localPath === 'string' ? pluginConfig.localPath : undefined;
|
|
63
|
+
const plugins = pluginModules.filter((plugin) => typeof plugin === 'string');
|
|
55
64
|
const esbuild = config.custom?.esbuild || config.build?.esbuild ? [toDependency('esbuild', { optional: true })] : [];
|
|
56
65
|
const injectEntries = [
|
|
57
66
|
...getInjectEntries(config.custom?.esbuild, options.configFileDir),
|
|
@@ -59,7 +68,7 @@ export const resolveConfig = async (config, options) => {
|
|
|
59
68
|
];
|
|
60
69
|
return [
|
|
61
70
|
...functions,
|
|
62
|
-
...plugins.map(plugin => pluginToInput(plugin, options.configFileDir)),
|
|
71
|
+
...plugins.map(plugin => pluginToInput(plugin, options.configFileDir, localPath)),
|
|
63
72
|
...esbuild,
|
|
64
73
|
...injectEntries,
|
|
65
74
|
];
|
|
@@ -6,7 +6,10 @@ export type PluginConfig = {
|
|
|
6
6
|
esbuild?: EsbuildConfig;
|
|
7
7
|
};
|
|
8
8
|
functions?: Functions | Array<Functions | FileVariable> | FileVariable;
|
|
9
|
-
plugins?: unknown[] |
|
|
9
|
+
plugins?: unknown[] | {
|
|
10
|
+
localPath?: string;
|
|
11
|
+
modules?: unknown[];
|
|
12
|
+
} | FileVariable;
|
|
10
13
|
};
|
|
11
14
|
type FileVariable = string;
|
|
12
15
|
type Functions = Record<string, ServerlessFunction | FileVariable>;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
+
import { argsFromPositional } from '../../binaries/util.js';
|
|
1
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
3
|
import { resolveFromAST } from './resolveFromAST.js';
|
|
3
4
|
const title = 'SST';
|
|
4
5
|
const enablers = ['sst'];
|
|
5
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
7
|
const config = ['sst.config.ts'];
|
|
8
|
+
const wrappers = new Set(['bind', 'dev', 'env', 'shell']);
|
|
9
|
+
const args = {
|
|
10
|
+
boolean: ['print-logs', 'script'],
|
|
11
|
+
config: ['config'],
|
|
12
|
+
fromArgs: (parsed, args) => {
|
|
13
|
+
if (!wrappers.has(parsed._[0]))
|
|
14
|
+
return [];
|
|
15
|
+
const command = argsFromPositional(parsed, args, 1);
|
|
16
|
+
return parsed._[0] === 'bind' || parsed._[0] === 'env' ? command.join(' ') : command;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
7
19
|
const plugin = {
|
|
8
20
|
title,
|
|
9
21
|
enablers,
|
|
10
22
|
isEnabled,
|
|
11
23
|
config,
|
|
12
24
|
resolveFromAST,
|
|
25
|
+
args,
|
|
13
26
|
};
|
|
14
27
|
export default plugin;
|