knip 6.46.0 → 6.47.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 +2 -0
- package/dist/IssueFixer.js +2 -6
- package/dist/WorkspaceWorker.d.ts +1 -0
- package/dist/WorkspaceWorker.js +10 -6
- package/dist/compilers/mdx.js +7 -1
- package/dist/plugins/angular/helpers.d.ts +7 -0
- package/dist/plugins/angular/helpers.js +58 -0
- package/dist/plugins/angular/index.js +5 -50
- package/dist/plugins/angular/types.d.ts +2 -2
- package/dist/plugins/astro/index.js +6 -1
- package/dist/plugins/astro-og-canvas/index.js +1 -1
- package/dist/plugins/capacitor/index.js +1 -1
- package/dist/plugins/cucumber/index.js +19 -7
- package/dist/plugins/cucumber/types.d.ts +1 -0
- package/dist/plugins/cypress/index.js +5 -0
- package/dist/plugins/docusaurus/helpers.js +2 -2
- package/dist/plugins/drizzle/index.js +5 -0
- package/dist/plugins/github-action/index.js +13 -3
- package/dist/plugins/github-actions/index.d.ts +2 -1
- package/dist/plugins/github-actions/index.js +4 -2
- package/dist/plugins/github-actions/types.d.ts +5 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/mocha/index.js +6 -0
- package/dist/plugins/mocha/types.d.ts +3 -0
- package/dist/plugins/netlify/index.js +1 -1
- package/dist/plugins/node/index.d.ts +2 -2
- package/dist/plugins/node/index.js +14 -3
- package/dist/plugins/nx/index.js +14 -1
- package/dist/plugins/oclif/index.js +3 -1
- package/dist/plugins/plop/index.js +4 -0
- package/dist/plugins/prisma/index.js +2 -0
- package/dist/plugins/quasar/resolveFromAST.js +2 -2
- package/dist/plugins/react-native/index.js +1 -1
- package/dist/plugins/rollup/index.js +1 -1
- package/dist/plugins/sst/resolveFromAST.js +24 -15
- package/dist/plugins/start-server-and-test/index.d.ts +3 -0
- package/dist/plugins/start-server-and-test/index.js +10 -0
- package/dist/plugins/swc/index.js +7 -4
- package/dist/plugins/trigger-dev/index.d.ts +3 -0
- package/dist/plugins/trigger-dev/index.js +28 -0
- package/dist/plugins/tsx/index.js +1 -1
- package/dist/plugins/typedoc/index.js +5 -2
- package/dist/plugins/typescript/index.d.ts +12 -1
- package/dist/plugins/typescript/index.js +6 -3
- package/dist/plugins/vite-plus/index.d.ts +4 -1
- package/dist/plugins/vite-plus/index.js +19 -4
- package/dist/plugins/vite-plus/types.d.ts +12 -0
- package/dist/plugins/vite-plus/types.js +1 -0
- package/dist/plugins/vitepress/index.js +14 -0
- package/dist/plugins/vitest/index.js +5 -0
- package/dist/plugins/vitest/types.d.ts +2 -1
- package/dist/plugins/web-test-runner/index.js +8 -2
- package/dist/plugins/webpack/index.js +5 -7
- package/dist/plugins/wrangler/index.js +4 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +2 -0
- package/dist/util/create-input-handler.js +3 -1
- package/dist/util/remove-export.d.ts +1 -0
- package/dist/util/remove-export.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +8 -0
- package/dist/plugins/vite-plus/resolveFromAST.d.ts +0 -2
- package/dist/plugins/vite-plus/resolveFromAST.js +0 -37
|
@@ -237,6 +237,7 @@ export declare class ConfigurationChief {
|
|
|
237
237
|
"solidjs-vite-plugin"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
238
238
|
sst?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
239
239
|
starlight?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
240
|
+
"start-server-and-test"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
240
241
|
stencil?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
241
242
|
storybook?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
242
243
|
stryker?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
@@ -255,6 +256,7 @@ export declare class ConfigurationChief {
|
|
|
255
256
|
temporal?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
256
257
|
textlint?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
257
258
|
travis?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
259
|
+
"trigger-dev"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
258
260
|
"ts-node"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
259
261
|
tsd?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
260
262
|
tsdown?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
package/dist/IssueFixer.js
CHANGED
|
@@ -3,8 +3,7 @@ import { DEFAULT_CATALOG } from './util/catalog.js';
|
|
|
3
3
|
import { debugLogArray, debugLogObject } from './util/debug.js';
|
|
4
4
|
import { load, save } from './util/package-json.js';
|
|
5
5
|
import { extname, join } from './util/path.js';
|
|
6
|
-
import { removeExport } from './util/remove-export.js';
|
|
7
|
-
const MODULE_MARKER = /^[ \t]*(import|export)\b/m;
|
|
6
|
+
import { keepModuleMarker, removeExport } from './util/remove-export.js';
|
|
8
7
|
export const fix = async (issues, counters, options) => {
|
|
9
8
|
const fixer = new IssueFixer(options);
|
|
10
9
|
const touchedFiles = await fixer.fixIssues(issues);
|
|
@@ -80,10 +79,7 @@ class IssueFixer {
|
|
|
80
79
|
if (fix[0] >= (disjointFixes.at(-1)?.[1] ?? 0))
|
|
81
80
|
disjointFixes.push(fix);
|
|
82
81
|
}
|
|
83
|
-
|
|
84
|
-
if (MODULE_MARKER.test(originalSource) && !MODULE_MARKER.test(sourceFileText)) {
|
|
85
|
-
sourceFileText = `${sourceFileText.trimEnd()}\n\nexport {};\n`;
|
|
86
|
-
}
|
|
82
|
+
const sourceFileText = keepModuleMarker(originalSource, disjointFixes.reduceRight((text, [start, end, flags]) => removeExport({ text, start, end, flags }), originalSource));
|
|
87
83
|
await writeFile(absFilePath, sourceFileText);
|
|
88
84
|
touchedFiles.add(absFilePath);
|
|
89
85
|
for (const type of types) {
|
|
@@ -68,6 +68,7 @@ export declare class WorkspaceWorker {
|
|
|
68
68
|
private getPluginConfig;
|
|
69
69
|
getPluginConfigPatterns(): string[];
|
|
70
70
|
getPluginEntryFilePatterns(patterns: string[], base?: string): string[];
|
|
71
|
+
private getNegatedDevelopmentEntryFiles;
|
|
71
72
|
getProductionEntryFilePatterns(): string[];
|
|
72
73
|
getProductionProjectFilePatterns(): string[];
|
|
73
74
|
private getConfigurationFilePatterns;
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -152,23 +152,27 @@ export class WorkspaceWorker {
|
|
|
152
152
|
: this.ignoredWorkspacePatterns;
|
|
153
153
|
return [patterns, negateWorkspaces, ignoredWorkspaces.map(negate)].flat();
|
|
154
154
|
}
|
|
155
|
+
getNegatedDevelopmentEntryFiles() {
|
|
156
|
+
const { entry } = this.config;
|
|
157
|
+
return entry.filter(pattern => hasNoProductionSuffix(pattern) && !entry.includes(`${pattern}!`)).map(negate);
|
|
158
|
+
}
|
|
155
159
|
getProductionEntryFilePatterns() {
|
|
156
160
|
const entry = this.config.entry.filter(hasProductionSuffix);
|
|
157
161
|
if (entry.length === 0)
|
|
158
162
|
return [];
|
|
159
|
-
const negatedEntryFiles = this.
|
|
163
|
+
const negatedEntryFiles = this.getNegatedDevelopmentEntryFiles();
|
|
160
164
|
return [entry, negatedEntryFiles, this.negatedWorkspacePatterns].flat();
|
|
161
165
|
}
|
|
162
166
|
getProductionProjectFilePatterns() {
|
|
163
167
|
const project = this.config.project;
|
|
164
168
|
if (project.length === 0)
|
|
165
169
|
return this.getProductionEntryFilePatterns();
|
|
166
|
-
const _project =
|
|
167
|
-
if (
|
|
168
|
-
return
|
|
169
|
-
return pattern;
|
|
170
|
+
const _project = project.flatMap(pattern => {
|
|
171
|
+
if (pattern.endsWith('!') || pattern.startsWith('!'))
|
|
172
|
+
return [pattern];
|
|
173
|
+
return project.includes(`${pattern}!`) ? [] : [negate(pattern)];
|
|
170
174
|
});
|
|
171
|
-
const negatedEntryFiles = this.
|
|
175
|
+
const negatedEntryFiles = this.getNegatedDevelopmentEntryFiles();
|
|
172
176
|
const negatedPluginConfigPatterns = this.getPluginConfigPatterns().map(negate);
|
|
173
177
|
const negatedPluginProjectFilePatterns = this.getPluginProjectFilePatterns().map(negate);
|
|
174
178
|
return [
|
package/dist/compilers/mdx.js
CHANGED
|
@@ -11,8 +11,9 @@ const dependencies = [
|
|
|
11
11
|
'remark-mdx',
|
|
12
12
|
];
|
|
13
13
|
const mdxImportMatcher = /^import[^'"]+['"][^'"]+['"]/gm;
|
|
14
|
+
const mdxReExportMatcher = /^export\s*\{([^}]*)\}\s*from\s*(['"][^'"]+['"])/gm;
|
|
14
15
|
const compiler = (text) => {
|
|
15
|
-
if (!text.includes('import'))
|
|
16
|
+
if (!text.includes('import') && !text.includes('export'))
|
|
16
17
|
return '';
|
|
17
18
|
const imports = [];
|
|
18
19
|
const source = text
|
|
@@ -23,6 +24,11 @@ const compiler = (text) => {
|
|
|
23
24
|
mdxImportMatcher.lastIndex = 0;
|
|
24
25
|
while ((match = mdxImportMatcher.exec(source)))
|
|
25
26
|
imports.push(match[0]);
|
|
27
|
+
mdxReExportMatcher.lastIndex = 0;
|
|
28
|
+
while ((match = mdxReExportMatcher.exec(source))) {
|
|
29
|
+
const names = match[1].replace(/\s+as\s+[\w$]+/g, '').replace(/\bdefault\b/, 'default as _');
|
|
30
|
+
imports.push(`import {${names}} from ${match[2]}`);
|
|
31
|
+
}
|
|
26
32
|
return imports.join('\n');
|
|
27
33
|
};
|
|
28
34
|
export default { dependencies, compiler };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Input } from '../../util/input.ts';
|
|
2
|
+
interface BuilderTarget {
|
|
3
|
+
options?: unknown;
|
|
4
|
+
configurations?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare const getBuilderEntries: (targetName: string, target: BuilderTarget, dir: string, toSpecifier?: (specifier: string) => string) => Input[];
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { toEntryPath, toModule } from '../../util/input.js';
|
|
2
|
+
import { isObject } from '../../util/validation.js';
|
|
3
|
+
const PRODUCTION_CONFIG_NAME = 'production';
|
|
4
|
+
const BUILD_TARGET_NAME = 'build';
|
|
5
|
+
const isPath = (value) => typeof value === 'string' && value.length > 0;
|
|
6
|
+
const getBundleInput = (value) => (isObject(value) ? value.input : value);
|
|
7
|
+
const getReplacementPath = (value) => (isObject(value) ? (value.with ?? value.replaceWith) : undefined);
|
|
8
|
+
const toPaths = (value, getPath = item => item) => {
|
|
9
|
+
const paths = [];
|
|
10
|
+
for (const item of Array.isArray(value) ? value : [value]) {
|
|
11
|
+
const path = getPath(item);
|
|
12
|
+
if (isPath(path))
|
|
13
|
+
paths.push(path);
|
|
14
|
+
}
|
|
15
|
+
return paths;
|
|
16
|
+
};
|
|
17
|
+
const entriesByOption = (opts) => new Map([
|
|
18
|
+
['main', toPaths(opts.main)],
|
|
19
|
+
['scripts', toPaths(opts.scripts, getBundleInput)],
|
|
20
|
+
['styles', toPaths(opts.styles, getBundleInput)],
|
|
21
|
+
['polyfills', toPaths(opts.polyfills)],
|
|
22
|
+
['fileReplacements', toPaths(opts.fileReplacements, getReplacementPath)],
|
|
23
|
+
['browser', toPaths(opts.browser)],
|
|
24
|
+
['server', toPaths(opts.server)],
|
|
25
|
+
['ssrEntry', toPaths(isObject(opts.ssr) ? opts.ssr.entry : undefined)],
|
|
26
|
+
]);
|
|
27
|
+
export const getBuilderEntries = (targetName, target, dir, toSpecifier = specifier => specifier) => {
|
|
28
|
+
const { options: opts, configurations: configs } = target;
|
|
29
|
+
const defaultEntriesByOption = isObject(opts) ? entriesByOption(opts) : new Map();
|
|
30
|
+
const entriesByOptionByConfig = new Map();
|
|
31
|
+
if (isObject(configs)) {
|
|
32
|
+
for (const [configName, configOpts] of Object.entries(configs)) {
|
|
33
|
+
if (isObject(configOpts))
|
|
34
|
+
entriesByOptionByConfig.set(configName, entriesByOption(configOpts));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const productionEntriesByOption = entriesByOptionByConfig.get(PRODUCTION_CONFIG_NAME) ?? new Map();
|
|
38
|
+
const isBuildTarget = targetName === BUILD_TARGET_NAME;
|
|
39
|
+
const toInput = (option, entry, isProduction) => {
|
|
40
|
+
const specifier = toSpecifier(entry);
|
|
41
|
+
const opts = { dir, production: isProduction };
|
|
42
|
+
return option === 'polyfills' ? toModule(specifier, opts) : toEntryPath(specifier, opts);
|
|
43
|
+
};
|
|
44
|
+
const inputs = [];
|
|
45
|
+
for (const [configName, entriesByOption] of entriesByOptionByConfig) {
|
|
46
|
+
for (const [option, entries] of entriesByOption) {
|
|
47
|
+
for (const entry of entries) {
|
|
48
|
+
inputs.push(toInput(option, entry, isBuildTarget && configName === PRODUCTION_CONFIG_NAME));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const [option, entries] of defaultEntriesByOption) {
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
inputs.push(toInput(option, entry, isBuildTarget && !productionEntriesByOption.get(option)?.length));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return inputs;
|
|
58
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { toConfig,
|
|
1
|
+
import { toConfig, toDependency, toEntry } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
import { createComponentStyleUrlsVisitor } from '../_component-style-urls/component-style-urls-visitor.js';
|
|
4
4
|
import * as karma from '../karma/helpers.js';
|
|
5
|
+
import { getBuilderEntries } from './helpers.js';
|
|
5
6
|
const title = 'Angular';
|
|
6
7
|
const enablers = ['@angular/cli'];
|
|
7
8
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
@@ -14,7 +15,7 @@ const resolveConfig = async (config, options) => {
|
|
|
14
15
|
if (!project.architect)
|
|
15
16
|
continue;
|
|
16
17
|
for (const [targetName, target] of Object.entries(project.architect)) {
|
|
17
|
-
const { options: opts
|
|
18
|
+
const { options: opts } = target;
|
|
18
19
|
const [packageName] = typeof target.builder === 'string' ? target.builder.split(':') : [];
|
|
19
20
|
if (packageName)
|
|
20
21
|
inputs.add(toDependency(packageName));
|
|
@@ -23,26 +24,8 @@ const resolveConfig = async (config, options) => {
|
|
|
23
24
|
inputs.add(toConfig('typescript', opts.tsConfig));
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const productionEntriesByOption = entriesByOptionByConfig.get(PRODUCTION_CONFIG_NAME) ?? new Map();
|
|
29
|
-
const isBuildTarget = targetName === BUILD_TARGET_NAME;
|
|
30
|
-
const toInput = (option, specifier, isProduction) => {
|
|
31
|
-
const opts = { dir: options.cwd, production: isProduction };
|
|
32
|
-
return option === 'polyfills' ? toModule(specifier, opts) : toEntryPath(specifier, opts);
|
|
33
|
-
};
|
|
34
|
-
for (const [configName, entriesByOption] of entriesByOptionByConfig) {
|
|
35
|
-
for (const [option, entries] of entriesByOption) {
|
|
36
|
-
for (const entry of entries) {
|
|
37
|
-
inputs.add(toInput(option, entry, isBuildTarget && configName === PRODUCTION_CONFIG_NAME));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
for (const [option, entries] of defaultEntriesByOption) {
|
|
42
|
-
for (const entry of entries) {
|
|
43
|
-
inputs.add(toInput(option, entry, isBuildTarget && !productionEntriesByOption.get(option)?.length));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
27
|
+
for (const input of getBuilderEntries(targetName, target, options.cwd))
|
|
28
|
+
inputs.add(input);
|
|
46
29
|
if (target.builder && isAngularBuilderRefWithName({ builderRef: target.builder, name: 'karma' }) && opts) {
|
|
47
30
|
const karmaBuilderOptions = opts;
|
|
48
31
|
const testFilePatterns = karmaBuilderOptions.include ?? ['**/*.spec.ts'];
|
|
@@ -68,38 +51,10 @@ const resolveConfig = async (config, options) => {
|
|
|
68
51
|
}
|
|
69
52
|
return Array.from(inputs);
|
|
70
53
|
};
|
|
71
|
-
const entriesByOption = (opts) => new Map(Object.entries({
|
|
72
|
-
main: 'main' in opts && opts.main && typeof opts.main === 'string' ? [opts.main] : [],
|
|
73
|
-
scripts: 'scripts' in opts && opts.scripts && Array.isArray(opts.scripts)
|
|
74
|
-
? opts.scripts.map(scriptStringOrObject => typeof scriptStringOrObject === 'string' ? scriptStringOrObject : scriptStringOrObject.input)
|
|
75
|
-
: [],
|
|
76
|
-
styles: 'styles' in opts && opts.styles && Array.isArray(opts.styles)
|
|
77
|
-
? opts.styles.map(styleStringOrObject => typeof styleStringOrObject === 'string' ? styleStringOrObject : styleStringOrObject.input)
|
|
78
|
-
: [],
|
|
79
|
-
polyfills: 'polyfills' in opts && opts.polyfills
|
|
80
|
-
? Array.isArray(opts.polyfills)
|
|
81
|
-
? opts.polyfills
|
|
82
|
-
: [opts.polyfills]
|
|
83
|
-
: [],
|
|
84
|
-
fileReplacements: 'fileReplacements' in opts && opts.fileReplacements && Array.isArray(opts.fileReplacements)
|
|
85
|
-
? opts.fileReplacements.map(fileReplacement => 'with' in fileReplacement ? fileReplacement.with : fileReplacement.replaceWith)
|
|
86
|
-
: [],
|
|
87
|
-
browser: 'browser' in opts && opts.browser && typeof opts.browser === 'string' ? [opts.browser] : [],
|
|
88
|
-
server: 'server' in opts && opts.server && typeof opts.server === 'string' ? [opts.server] : [],
|
|
89
|
-
ssrEntry: 'ssr' in opts &&
|
|
90
|
-
opts.ssr &&
|
|
91
|
-
typeof opts.ssr === 'object' &&
|
|
92
|
-
'entry' in opts.ssr &&
|
|
93
|
-
typeof opts.ssr.entry === 'string'
|
|
94
|
-
? [opts.ssr.entry]
|
|
95
|
-
: [],
|
|
96
|
-
}));
|
|
97
54
|
const isAngularBuilderRefWithName = ({ builderRef, name }) => {
|
|
98
55
|
const [pkg, builderName] = builderRef.split(':');
|
|
99
56
|
return (pkg === '@angular-devkit/build-angular' || pkg === '@angular/build') && builderName === name;
|
|
100
57
|
};
|
|
101
|
-
const PRODUCTION_CONFIG_NAME = 'production';
|
|
102
|
-
const BUILD_TARGET_NAME = 'build';
|
|
103
58
|
const isAngularSpecifier = (specifier) => specifier === '@angular/core';
|
|
104
59
|
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
105
60
|
registerVisitor(createComponentStyleUrlsVisitor(ctx, isAngularSpecifier));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type FileVersion = number;
|
|
2
|
-
|
|
2
|
+
type Project = Project1 & {
|
|
3
3
|
cli?: {
|
|
4
4
|
[k: string]: unknown;
|
|
5
5
|
};
|
|
@@ -620,7 +620,7 @@ interface AppShellTarget {
|
|
|
620
620
|
inputIndexPath?: string;
|
|
621
621
|
outputIndexPath?: string;
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
interface WebpackBrowserSchemaForBuildFacade {
|
|
624
624
|
assets?: ({
|
|
625
625
|
followSymlinks?: boolean;
|
|
626
626
|
glob: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toDependency } from '../../util/input.js';
|
|
1
|
+
import { toConfig, toDependency } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
import compiler from './compiler.js';
|
|
4
4
|
import mdxCompiler from './compiler-mdx.js';
|
|
@@ -24,6 +24,10 @@ const resolve = options => {
|
|
|
24
24
|
}
|
|
25
25
|
return inputs;
|
|
26
26
|
};
|
|
27
|
+
const args = {
|
|
28
|
+
string: ['config', 'root'],
|
|
29
|
+
resolveInputs: (parsed, { cwd }) => parsed.config && !parsed.root ? [toConfig('astro', parsed.config, { dir: cwd })] : [],
|
|
30
|
+
};
|
|
27
31
|
const plugin = {
|
|
28
32
|
title,
|
|
29
33
|
enablers,
|
|
@@ -34,5 +38,6 @@ const plugin = {
|
|
|
34
38
|
registerCompilers,
|
|
35
39
|
resolveFromAST,
|
|
36
40
|
resolve,
|
|
41
|
+
args,
|
|
37
42
|
};
|
|
38
43
|
export default plugin;
|
|
@@ -4,7 +4,7 @@ const title = 'astro-og-canvas';
|
|
|
4
4
|
const enablers = ['astro-og-canvas'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
const resolve = async () => {
|
|
7
|
-
return [toDependency('canvaskit-wasm', { optional: true })];
|
|
7
|
+
return [toDependency('canvaskit-wasm', { production: true, optional: true })];
|
|
8
8
|
};
|
|
9
9
|
const plugin = {
|
|
10
10
|
title,
|
|
@@ -37,7 +37,7 @@ const resolveConfig = async (config, { configFileDir, cwd, manifest }) => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
return [...plugins, ...platforms.map(platform => `@capacitor/${platform}`)].map(id => toDependency(id));
|
|
40
|
+
return [...plugins, ...platforms.map(platform => `@capacitor/${platform}`)].map(id => toDependency(id, { production: true }));
|
|
41
41
|
};
|
|
42
42
|
const plugin = {
|
|
43
43
|
title,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { toModule, toEntry } from '../../util/input.js';
|
|
2
|
+
import { isDirectory } from '../../util/fs.js';
|
|
2
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
4
|
const title = 'Cucumber';
|
|
4
5
|
const enablers = ['@cucumber/cucumber'];
|
|
@@ -25,23 +26,33 @@ const toFormatterName = (format) => {
|
|
|
25
26
|
const [name, quotedName] = format.match(/^"([^"]*)"|^[^:]*/) ?? [format];
|
|
26
27
|
return quotedName ?? name;
|
|
27
28
|
};
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const
|
|
29
|
+
const toSupportEntry = (id, cwd, extension) => toEntry(isDirectory(cwd, id) ? `${id}/**/*${extension}` : id);
|
|
30
|
+
const resolveProfile = (cwd, config) => {
|
|
31
|
+
const imports = (config?.import ? config.import : entry).map(id => toSupportEntry(id, cwd, '.@(js|cjs|mjs)'));
|
|
32
|
+
const requires = (config?.require ? config.require : []).map(id => toSupportEntry(id, cwd, '.js'));
|
|
33
|
+
const modules = (config?.requireModule ? config.requireModule : []).map(id => toModule(id));
|
|
31
34
|
const formatters = (config?.format ? config.format : [])
|
|
32
35
|
.map(toFormatterName)
|
|
33
36
|
.filter(name => !builtinFormatters.has(name))
|
|
34
37
|
.map(id => toModule(id));
|
|
35
|
-
return [...imports, ...requires, ...formatters];
|
|
38
|
+
return [...imports, ...requires, ...modules, ...formatters];
|
|
36
39
|
};
|
|
37
40
|
const resolveConfig = (config, options) => {
|
|
38
41
|
if (typeof config !== 'object' || config === null)
|
|
39
|
-
return resolveProfile();
|
|
42
|
+
return resolveProfile(options.cwd);
|
|
40
43
|
const isProfiles = /\.(json|ya?ml)$/.test(options.configFileName) || 'default' in config;
|
|
41
44
|
if (!isProfiles)
|
|
42
|
-
return resolveProfile(config);
|
|
45
|
+
return resolveProfile(options.cwd, config);
|
|
43
46
|
const profiles = 'default' in config ? Object.values(config) : [undefined, ...Object.values(config)];
|
|
44
|
-
return profiles.flatMap(resolveProfile);
|
|
47
|
+
return profiles.flatMap(profile => resolveProfile(options.cwd, profile));
|
|
48
|
+
};
|
|
49
|
+
const args = {
|
|
50
|
+
binaries: ['cucumber-js'],
|
|
51
|
+
config: true,
|
|
52
|
+
resolve: ['require-module'],
|
|
53
|
+
string: ['require'],
|
|
54
|
+
alias: { require: ['r'] },
|
|
55
|
+
resolveInputs: (parsed, { cwd }) => [parsed.require ?? []].flat().map(id => toSupportEntry(id, cwd, '.js')),
|
|
45
56
|
};
|
|
46
57
|
const plugin = {
|
|
47
58
|
title,
|
|
@@ -50,5 +61,6 @@ const plugin = {
|
|
|
50
61
|
config,
|
|
51
62
|
entry,
|
|
52
63
|
resolveConfig,
|
|
64
|
+
args,
|
|
53
65
|
};
|
|
54
66
|
export default plugin;
|
|
@@ -25,6 +25,10 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
25
25
|
: SUPPORT_FILE_PATTERNS.map(id => toEntry(id))),
|
|
26
26
|
];
|
|
27
27
|
};
|
|
28
|
+
const args = {
|
|
29
|
+
config: ['config-file'],
|
|
30
|
+
alias: { 'config-file': ['C'] },
|
|
31
|
+
};
|
|
28
32
|
const plugin = {
|
|
29
33
|
title,
|
|
30
34
|
enablers,
|
|
@@ -32,5 +36,6 @@ const plugin = {
|
|
|
32
36
|
config,
|
|
33
37
|
entry,
|
|
34
38
|
resolveConfig,
|
|
39
|
+
args,
|
|
35
40
|
};
|
|
36
41
|
export default plugin;
|
|
@@ -64,7 +64,7 @@ const resolveArrayConfig = ([name, config], type, cwd) => {
|
|
|
64
64
|
const sidebar = sidebarPath ? [toEntryPath(sidebarPath, { production: true, dir: cwd })] : [];
|
|
65
65
|
if (isLocalPath(name))
|
|
66
66
|
return [toEntryPath(toAbsolute(name, cwd), { production: true }), ...sidebar];
|
|
67
|
-
return [toDependency(resolveModuleName(name, type)), ...sidebar];
|
|
67
|
+
return [toDependency(resolveModuleName(name, type), { production: type !== 'plugin' }), ...sidebar];
|
|
68
68
|
};
|
|
69
69
|
export const resolveConfigItems = async (items, type, options) => {
|
|
70
70
|
const inputs = new Set();
|
|
@@ -77,7 +77,7 @@ export const resolveConfigItems = async (items, type, options) => {
|
|
|
77
77
|
if (isLocalPath(item))
|
|
78
78
|
inputs.add(toEntryPath(toAbsolute(item, options.cwd), { production: true }));
|
|
79
79
|
else
|
|
80
|
-
inputs.add(toDependency(resolveModuleName(item, type)));
|
|
80
|
+
inputs.add(toDependency(resolveModuleName(item, type), { production: type !== 'plugin' }));
|
|
81
81
|
}
|
|
82
82
|
else if (Array.isArray(item)) {
|
|
83
83
|
for (const input of resolveArrayConfig(item, type, options.cwd))
|
|
@@ -9,11 +9,16 @@ const resolveConfig = config => {
|
|
|
9
9
|
return [];
|
|
10
10
|
return [config.schema].flat().map(id => toEntry(id, { production: true }));
|
|
11
11
|
};
|
|
12
|
+
const args = {
|
|
13
|
+
binaries: ['drizzle-kit'],
|
|
14
|
+
config: ['config'],
|
|
15
|
+
};
|
|
12
16
|
const plugin = {
|
|
13
17
|
title,
|
|
14
18
|
enablers,
|
|
15
19
|
isEnabled,
|
|
16
20
|
config,
|
|
17
21
|
resolveConfig,
|
|
22
|
+
args,
|
|
18
23
|
};
|
|
19
24
|
export default plugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { toEntryPath, toProject } from '../../util/input.js';
|
|
2
|
-
import { relative } from '../../util/path.js';
|
|
1
|
+
import { isDeferResolveEntry, toEntryPath, toProject } from '../../util/input.js';
|
|
2
|
+
import { join, relative } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
|
-
import { getActionDependencies } from '../github-actions/index.js';
|
|
4
|
+
import { getActionDependencies, resolveConfig as resolveStepsConfig } from '../github-actions/index.js';
|
|
5
5
|
const title = 'GitHub Action';
|
|
6
6
|
const enablers = ['@actions/core'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
@@ -9,6 +9,16 @@ const config = ['action.{yml,yaml}'];
|
|
|
9
9
|
const isAssumeArtifact = (specifier) => /^(dist|build)\//.test(specifier);
|
|
10
10
|
const resolveConfig = async (config, options) => {
|
|
11
11
|
const inputs = [];
|
|
12
|
+
if (config?.runs?.using === 'composite') {
|
|
13
|
+
for (const input of await resolveStepsConfig(config, options)) {
|
|
14
|
+
const relativePath = relative(options.cwd, join(input.dir ?? options.cwd, input.specifier));
|
|
15
|
+
if (isDeferResolveEntry(input) && isAssumeArtifact(relativePath))
|
|
16
|
+
inputs.push(toProject(`!${relativePath}`));
|
|
17
|
+
else
|
|
18
|
+
inputs.push(input);
|
|
19
|
+
}
|
|
20
|
+
return inputs;
|
|
21
|
+
}
|
|
12
22
|
const filePaths = getActionDependencies(config, options);
|
|
13
23
|
for (const filePath of new Set(filePaths)) {
|
|
14
24
|
const relativePath = relative(options.cwd, filePath);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Plugin, PluginOptions } from '../../types/config.ts';
|
|
1
|
+
import type { Plugin, PluginOptions, ResolveConfig } from '../../types/config.ts';
|
|
2
2
|
export declare const getActionDependencies: (config: any, options: PluginOptions) => string[];
|
|
3
|
+
export declare const resolveConfig: ResolveConfig;
|
|
3
4
|
declare const plugin: Plugin;
|
|
4
5
|
export default plugin;
|
|
@@ -18,17 +18,19 @@ export const getActionDependencies = (config, options) => {
|
|
|
18
18
|
return scripts.map(script => join(configFileDir, script));
|
|
19
19
|
};
|
|
20
20
|
const ACTION_PATH_VAR = /\$\{\{\s*github\.action_path\s*\}\}|\$\{GITHUB_ACTION_PATH\}|\$GITHUB_ACTION_PATH/g;
|
|
21
|
-
const resolveConfig = async (config, options) => {
|
|
21
|
+
export const resolveConfig = async (config, options) => {
|
|
22
22
|
const { rootCwd, getInputsFromScripts, isProduction, getManifest, configFileDir } = options;
|
|
23
23
|
const inputs = new Set();
|
|
24
24
|
const jobs = findByKeyDeep(config, 'steps');
|
|
25
|
+
const workflowWorkingDir = config?.defaults?.run?.['working-directory'];
|
|
25
26
|
for (const steps of jobs) {
|
|
26
27
|
if (!Array.isArray(steps.steps))
|
|
27
28
|
continue;
|
|
28
29
|
const action = steps.steps.find(step => step.uses?.startsWith('actions/checkout@') && typeof step.with?.path === 'string' && !step.with.repository);
|
|
29
30
|
const path = action?.with?.path;
|
|
31
|
+
const jobWorkingDir = steps.defaults?.run?.['working-directory'] ?? workflowWorkingDir;
|
|
30
32
|
for (const step of steps.steps) {
|
|
31
|
-
const workingDir = step['working-directory'];
|
|
33
|
+
const workingDir = step['working-directory'] ?? jobWorkingDir;
|
|
32
34
|
const dir = join(rootCwd, path && workingDir ? relative(path, workingDir) : workingDir ? workingDir : '.');
|
|
33
35
|
if (step.run) {
|
|
34
36
|
const manifest = getManifest(dir) ?? options.manifest;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -158,6 +158,7 @@ export declare const Plugins: {
|
|
|
158
158
|
'solidjs-vite-plugin': import("../types/config.ts").Plugin;
|
|
159
159
|
sst: import("../types/config.ts").Plugin;
|
|
160
160
|
starlight: import("../types/config.ts").Plugin;
|
|
161
|
+
'start-server-and-test': import("../types/config.ts").Plugin;
|
|
161
162
|
stencil: import("../types/config.ts").Plugin;
|
|
162
163
|
storybook: import("../types/config.ts").Plugin;
|
|
163
164
|
stryker: import("../types/config.ts").Plugin;
|
|
@@ -176,6 +177,7 @@ export declare const Plugins: {
|
|
|
176
177
|
temporal: import("../types/config.ts").Plugin;
|
|
177
178
|
textlint: import("../types/config.ts").Plugin;
|
|
178
179
|
travis: import("../types/config.ts").Plugin;
|
|
180
|
+
'trigger-dev': import("../types/config.ts").Plugin;
|
|
179
181
|
'ts-node': import("../types/config.ts").Plugin;
|
|
180
182
|
tsd: import("../types/config.ts").Plugin;
|
|
181
183
|
tsdown: import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -152,6 +152,7 @@ import { default as sizeLimit } from './size-limit/index.js';
|
|
|
152
152
|
import { default as solidjsVitePlugin } from './solidjs-vite-plugin/index.js';
|
|
153
153
|
import { default as sst } from './sst/index.js';
|
|
154
154
|
import { default as starlight } from './starlight/index.js';
|
|
155
|
+
import { default as startServerAndTest } from './start-server-and-test/index.js';
|
|
155
156
|
import { default as stencil } from './stencil/index.js';
|
|
156
157
|
import { default as storybook } from './storybook/index.js';
|
|
157
158
|
import { default as stryker } from './stryker/index.js';
|
|
@@ -170,6 +171,7 @@ import { default as tauri } from './tauri/index.js';
|
|
|
170
171
|
import { default as temporal } from './temporal/index.js';
|
|
171
172
|
import { default as textlint } from './textlint/index.js';
|
|
172
173
|
import { default as travis } from './travis/index.js';
|
|
174
|
+
import { default as triggerDev } from './trigger-dev/index.js';
|
|
173
175
|
import { default as tsNode } from './ts-node/index.js';
|
|
174
176
|
import { default as tsd } from './tsd/index.js';
|
|
175
177
|
import { default as tsdown } from './tsdown/index.js';
|
|
@@ -366,6 +368,7 @@ export const Plugins = {
|
|
|
366
368
|
'solidjs-vite-plugin': solidjsVitePlugin,
|
|
367
369
|
sst,
|
|
368
370
|
starlight,
|
|
371
|
+
'start-server-and-test': startServerAndTest,
|
|
369
372
|
stencil,
|
|
370
373
|
storybook,
|
|
371
374
|
stryker,
|
|
@@ -384,6 +387,7 @@ export const Plugins = {
|
|
|
384
387
|
temporal,
|
|
385
388
|
textlint,
|
|
386
389
|
travis,
|
|
390
|
+
'trigger-dev': triggerDev,
|
|
387
391
|
'ts-node': tsNode,
|
|
388
392
|
tsd,
|
|
389
393
|
tsdown,
|
|
@@ -41,15 +41,21 @@ const builtInReporters = new Set([
|
|
|
41
41
|
'GithubActions',
|
|
42
42
|
'github-actions',
|
|
43
43
|
]);
|
|
44
|
+
const nodeOptionModule = /^(?:import|require|loader|experimental-loader)=(.+)$/;
|
|
44
45
|
const isExternalReporter = (reporter) => typeof reporter === 'string' && !builtInReporters.has(reporter);
|
|
45
46
|
const resolveConfig = (localConfig, options) => {
|
|
46
47
|
const entryPatterns = localConfig.spec ? [localConfig.spec].flat() : entry;
|
|
47
48
|
const files = localConfig.file ? [localConfig.file].flat() : [];
|
|
48
49
|
const require = localConfig.require ? [localConfig.require].flat() : [];
|
|
50
|
+
const nodeOptions = localConfig['node-option'] ? [localConfig['node-option']].flat() : undefined;
|
|
51
|
+
const preload = nodeOptions
|
|
52
|
+
? nodeOptions.flatMap(option => option.match(nodeOptionModule)?.[1] ?? [])
|
|
53
|
+
: [localConfig.import ?? [], localConfig.loader ?? []].flat();
|
|
49
54
|
const inputs = [];
|
|
50
55
|
inputs.push(...entryPatterns.map(id => toEntry(id)));
|
|
51
56
|
inputs.push(...files.map(id => toEntryPath(id, { dir: options.cwd })));
|
|
52
57
|
inputs.push(...require.map(id => toModule(id, { dir: options.cwd })));
|
|
58
|
+
inputs.push(...preload.map(id => toModule(id, { dir: options.cwd })));
|
|
53
59
|
if (isExternalReporter(localConfig.reporter))
|
|
54
60
|
inputs.push(toModule(localConfig.reporter, { dir: options.cwd }));
|
|
55
61
|
return inputs;
|
|
@@ -22,7 +22,7 @@ const resolveConfig = async (localConfig) => {
|
|
|
22
22
|
.map(id => toEntry(id, { production: true }))
|
|
23
23
|
.concat([
|
|
24
24
|
...(localConfig?.plugins?.map(plugin => plugin.package) ?? []).map(toPluginInput),
|
|
25
|
-
...extractFunctionsConfigProperty(localConfig.functions || {}, 'external_node_modules').map(id => toDependency(id)),
|
|
25
|
+
...extractFunctionsConfigProperty(localConfig.functions || {}, 'external_node_modules').map(id => toDependency(id, { production: true })),
|
|
26
26
|
]);
|
|
27
27
|
};
|
|
28
28
|
const plugin = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Plugin } from '../../types/config.ts';
|
|
2
|
+
import { type Input } from '../../util/input.ts';
|
|
2
3
|
import type { ParsedArgs } from '../../util/parse-args.ts';
|
|
3
4
|
declare const toScripts: (parsed: ParsedArgs) => string[];
|
|
4
5
|
export declare const args: {
|
|
5
6
|
positional: typeof toScripts;
|
|
6
7
|
nodeImportArgs: true;
|
|
7
|
-
resolve: string[];
|
|
8
8
|
string: string[];
|
|
9
9
|
alias: {
|
|
10
10
|
conditions: string[];
|
|
@@ -13,7 +13,7 @@ export declare const args: {
|
|
|
13
13
|
};
|
|
14
14
|
boolean: true;
|
|
15
15
|
stopEarly: true;
|
|
16
|
-
|
|
16
|
+
resolveInputs: (parsed: ParsedArgs) => Input[];
|
|
17
17
|
};
|
|
18
18
|
declare const plugin: Plugin;
|
|
19
19
|
export default plugin;
|