knip 6.33.0 → 6.35.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/CatalogCounselor.d.ts +2 -0
- package/dist/CatalogCounselor.js +30 -7
- package/dist/ConfigurationChief.d.ts +6 -0
- package/dist/ConfigurationChief.js +3 -5
- package/dist/ProjectPrincipal.d.ts +12 -10
- package/dist/ProjectPrincipal.js +56 -41
- package/dist/WorkspaceWorker.d.ts +3 -3
- package/dist/WorkspaceWorker.js +6 -6
- package/dist/YamlCatalogPeeker.d.ts +4 -0
- package/dist/YamlCatalogPeeker.js +17 -0
- package/dist/binaries/bash-parser.d.ts +1 -1
- package/dist/binaries/bash-parser.js +12 -58
- package/dist/binaries/command.d.ts +5 -0
- package/dist/binaries/command.js +47 -0
- package/dist/binaries/fallback.d.ts +2 -0
- package/dist/binaries/fallback.js +2 -0
- package/dist/binaries/plugins.d.ts +1 -0
- package/dist/binaries/plugins.js +2 -1
- package/dist/binaries/resolvers/pnpm.js +1 -0
- package/dist/binaries/util.d.ts +1 -0
- package/dist/binaries/util.js +12 -0
- package/dist/cli.js +9 -27
- package/dist/compilers/index.d.ts +3 -1866
- package/dist/compilers/index.js +17 -27
- package/dist/compilers/types.d.ts +4 -5
- package/dist/graph/analyze.js +74 -56
- package/dist/graph/build.d.ts +3 -3
- package/dist/graph/build.js +64 -32
- package/dist/plugins/_vue/auto-import.js +28 -4
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/mise/index.d.ts +3 -0
- package/dist/plugins/mise/index.js +82 -0
- package/dist/plugins/mise/scripts.d.ts +7 -0
- package/dist/plugins/mise/scripts.js +108 -0
- package/dist/plugins/mise/types.d.ts +26 -0
- package/dist/plugins/mise/types.js +1 -0
- package/dist/plugins/node/index.js +5 -0
- package/dist/plugins/node/visitors/fsPromisesGlob.d.ts +2 -0
- package/dist/plugins/node/visitors/fsPromisesGlob.js +89 -0
- package/dist/plugins/nuxt/index.js +13 -10
- package/dist/plugins/rstest/index.js +3 -2
- package/dist/plugins/rstest/types.d.ts +3 -1
- package/dist/plugins/vite/helpers.d.ts +2 -2
- package/dist/plugins/vite/helpers.js +18 -11
- package/dist/plugins/vite/visitors/importMetaGlob.js +12 -0
- package/dist/plugins/vitest/index.js +5 -2
- package/dist/plugins/vitest/types.d.ts +1 -0
- package/dist/run.js +1 -1
- package/dist/schema/configuration.d.ts +20 -4
- package/dist/schema/configuration.js +5 -6
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/session.js +22 -4
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/types/config.d.ts +5 -4
- package/dist/types/module-graph.d.ts +4 -0
- package/dist/types.d.ts +1 -0
- package/dist/typescript/SourceFileManager.d.ts +13 -9
- package/dist/typescript/SourceFileManager.js +58 -22
- package/dist/typescript/get-imports-and-exports.js +5 -1
- package/dist/typescript/glob-imports.js +8 -3
- package/dist/typescript/visitors/calls.js +1 -1
- package/dist/typescript/visitors/exports.js +8 -4
- package/dist/typescript/visitors/walk.d.ts +3 -1
- package/dist/typescript/visitors/walk.js +78 -13
- package/dist/util/catalog.d.ts +5 -0
- package/dist/util/catalog.js +37 -17
- package/dist/util/cli-arguments.d.ts +1 -0
- package/dist/util/cli-arguments.js +9 -0
- package/dist/util/create-options.d.ts +19 -4
- package/dist/util/create-options.js +17 -4
- package/dist/util/errors.d.ts +3 -1
- package/dist/util/errors.js +6 -1
- package/dist/util/file-entry-cache.js +2 -2
- package/dist/util/module-graph.js +1 -0
- package/dist/util/package-json.d.ts +1 -0
- package/dist/util/preprocessor.d.ts +6 -0
- package/dist/util/preprocessor.js +24 -0
- package/dist/util/reporter.d.ts +0 -1
- package/dist/util/reporter.js +0 -7
- package/dist/util/watch.d.ts +1 -1
- package/dist/util/watch.js +33 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -8
- package/schema.json +12 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { isFile } from '../../util/fs.js';
|
|
2
|
+
import { isEntry } from '../../util/input.js';
|
|
3
|
+
import { basename, dirname, join, toAbsolute } from '../../util/path.js';
|
|
4
|
+
const title = 'mise';
|
|
5
|
+
const enablers = 'This plugin is enabled when `mise.toml` or `.mise.toml` is found.';
|
|
6
|
+
const config = [
|
|
7
|
+
'{mise,.mise}{,.*}.toml',
|
|
8
|
+
'{mise,.mise}/config{,.*}.toml',
|
|
9
|
+
'.config/mise{,.*}.toml',
|
|
10
|
+
'.config/mise/config{,.*}.toml',
|
|
11
|
+
'.config/mise/mise{,.local}.toml',
|
|
12
|
+
'{mise,.mise}/conf.d/[!.]*.toml',
|
|
13
|
+
'.config/mise/conf.d/[!.]*.toml',
|
|
14
|
+
];
|
|
15
|
+
const isEnabled = ({ cwd }) => isFile(cwd, 'mise.toml') || isFile(cwd, '.mise.toml');
|
|
16
|
+
const getConfigRoot = (configFileDir, configFileName) => {
|
|
17
|
+
const isFragment = basename(configFileDir) === 'conf.d';
|
|
18
|
+
const groupedDir = isFragment ? dirname(configFileDir) : configFileDir;
|
|
19
|
+
const name = basename(groupedDir);
|
|
20
|
+
const root = (isFragment || configFileName.startsWith('config.')) && (name === 'mise' || name === '.mise')
|
|
21
|
+
? dirname(groupedDir)
|
|
22
|
+
: configFileDir;
|
|
23
|
+
return basename(root) === '.config' ? dirname(root) : root;
|
|
24
|
+
};
|
|
25
|
+
const hasTemplate = (value) => value.includes('{{') || value.includes('{%');
|
|
26
|
+
const resolvePath = (value, root) => {
|
|
27
|
+
const expanded = value.replace(/\{\{\s*config_root\s*\}\}/g, () => root);
|
|
28
|
+
if (hasTemplate(expanded) || expanded.startsWith('~') || expanded.includes('$'))
|
|
29
|
+
return;
|
|
30
|
+
return join(toAbsolute(expanded, root), '.');
|
|
31
|
+
};
|
|
32
|
+
const resolveConfig = async (localConfig, options) => {
|
|
33
|
+
const { getInputsFromMiseScript } = await import('./scripts.js');
|
|
34
|
+
const { configFileDir, configFileName, getManifest, isProduction } = options;
|
|
35
|
+
const configRoot = getConfigRoot(configFileDir, configFileName);
|
|
36
|
+
const inputs = [];
|
|
37
|
+
for (const task of Object.values(localConfig.tasks ?? {})) {
|
|
38
|
+
const taskConfig = typeof task === 'string' || Array.isArray(task) ? { run: task } : task;
|
|
39
|
+
const dir = resolvePath(taskConfig.dir ?? localConfig.task_config?.dir ?? '.', configRoot);
|
|
40
|
+
if (!dir)
|
|
41
|
+
continue;
|
|
42
|
+
let hasLocalBinPath = false;
|
|
43
|
+
for (const env of [localConfig.env ?? [], taskConfig.env ?? []].flat()) {
|
|
44
|
+
if (Object.hasOwn(env, 'PATH'))
|
|
45
|
+
hasLocalBinPath = false;
|
|
46
|
+
const paths = env._?.path;
|
|
47
|
+
for (const path of typeof paths === 'string' ? [paths] : Array.isArray(paths) ? paths : []) {
|
|
48
|
+
if (typeof path === 'string' && resolvePath(path, configRoot) === join(dir, 'node_modules/.bin')) {
|
|
49
|
+
hasLocalBinPath = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const manifest = getManifest(dir) ?? options.manifest;
|
|
54
|
+
const scriptOptions = {
|
|
55
|
+
...options,
|
|
56
|
+
cwd: dir,
|
|
57
|
+
manifest,
|
|
58
|
+
containingFilePath: options.configFilePath,
|
|
59
|
+
};
|
|
60
|
+
for (const script of [taskConfig.run ?? [], taskConfig.run_windows ?? []].flat()) {
|
|
61
|
+
if (typeof script !== 'string' || hasTemplate(script))
|
|
62
|
+
continue;
|
|
63
|
+
for (const input of getInputsFromMiseScript(script, scriptOptions, hasLocalBinPath)) {
|
|
64
|
+
if (isProduction)
|
|
65
|
+
input.optional = true;
|
|
66
|
+
input.dir ??= dir;
|
|
67
|
+
if (isEntry(input))
|
|
68
|
+
input.specifier = toAbsolute(input.specifier, input.dir);
|
|
69
|
+
inputs.push(input);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return inputs;
|
|
74
|
+
};
|
|
75
|
+
const plugin = {
|
|
76
|
+
title,
|
|
77
|
+
enablers,
|
|
78
|
+
isEnabled,
|
|
79
|
+
config,
|
|
80
|
+
resolveConfig,
|
|
81
|
+
};
|
|
82
|
+
export default plugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GetInputsFromScriptsOptions, GetInputsFromScriptsPartial } from '../../types/config.ts';
|
|
2
|
+
import { type Input } from '../../util/input.ts';
|
|
3
|
+
type Options = GetInputsFromScriptsOptions & {
|
|
4
|
+
getInputsFromScripts: GetInputsFromScriptsPartial;
|
|
5
|
+
};
|
|
6
|
+
export declare const getInputsFromMiseScript: (script: string, options: Options, hasLocalBinPath: boolean) => Input[];
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { parse } from 'unbash';
|
|
2
|
+
import { getDependenciesFromCommand, getInputsFromNodeOptions } from '../../binaries/command.js';
|
|
3
|
+
import { spawningBinaries } from '../../binaries/fallback.js';
|
|
4
|
+
import { isWrapper } from '../../binaries/plugins.js';
|
|
5
|
+
import KnownResolvers from '../../binaries/resolvers/index.js';
|
|
6
|
+
import { toScript } from '../../binaries/util.js';
|
|
7
|
+
import { SCRIPT_INTERPOLATION } from '../../constants.js';
|
|
8
|
+
import { isBinary } from '../../util/input.js';
|
|
9
|
+
import { extractBinary } from '../../util/modules.js';
|
|
10
|
+
import { walkCommands } from '../../util/scripts.js';
|
|
11
|
+
export const getInputsFromMiseScript = (script, options, hasLocalBinPath) => {
|
|
12
|
+
const inputs = [];
|
|
13
|
+
const definedFunctions = new Set();
|
|
14
|
+
const readParts = (parts) => {
|
|
15
|
+
let text = '';
|
|
16
|
+
let value = '';
|
|
17
|
+
let hasExpansion = false;
|
|
18
|
+
for (const part of parts) {
|
|
19
|
+
if (part.type === 'CommandExpansion' || part.type === 'ProcessSubstitution') {
|
|
20
|
+
if (part.script)
|
|
21
|
+
readScript(part.script);
|
|
22
|
+
text += SCRIPT_INTERPOLATION;
|
|
23
|
+
value += SCRIPT_INTERPOLATION;
|
|
24
|
+
hasExpansion = true;
|
|
25
|
+
}
|
|
26
|
+
else if (part.type === 'DoubleQuoted' || part.type === 'LocaleString') {
|
|
27
|
+
const inner = readParts(part.parts);
|
|
28
|
+
text += `${part.type === 'LocaleString' ? '$"' : '"'}${inner.text}"`;
|
|
29
|
+
value += inner.value;
|
|
30
|
+
if (inner.hasExpansion)
|
|
31
|
+
hasExpansion = true;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
text += part.text;
|
|
35
|
+
value += 'value' in part ? part.value : part.text;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return { text, value, hasExpansion };
|
|
39
|
+
};
|
|
40
|
+
const readWord = (word) => {
|
|
41
|
+
if (!word.parts)
|
|
42
|
+
return word;
|
|
43
|
+
const { text, value, hasExpansion } = readParts(word.parts);
|
|
44
|
+
return hasExpansion ? { ...word, text, value } : word;
|
|
45
|
+
};
|
|
46
|
+
const readScript = (parsed) => {
|
|
47
|
+
for (const statement of parsed.commands) {
|
|
48
|
+
if (statement.command.type === 'Function')
|
|
49
|
+
definedFunctions.add(statement.command.name.value);
|
|
50
|
+
}
|
|
51
|
+
for (const statement of parsed.commands) {
|
|
52
|
+
for (const command of walkCommands(statement.command)) {
|
|
53
|
+
const name = command.name?.value;
|
|
54
|
+
const word = command.name && readWord(command.name);
|
|
55
|
+
const prefix = command.prefix.map(assignment => {
|
|
56
|
+
const value = assignment.value && readWord(assignment.value);
|
|
57
|
+
return value && value !== assignment.value
|
|
58
|
+
? { ...assignment, value, text: `${assignment.name}=${value.text}` }
|
|
59
|
+
: assignment;
|
|
60
|
+
});
|
|
61
|
+
const words = command.suffix.map(readWord);
|
|
62
|
+
if (!name || !word || definedFunctions.has(name))
|
|
63
|
+
continue;
|
|
64
|
+
const binary = extractBinary(name);
|
|
65
|
+
const isPackageManager = binary in KnownResolvers && binary !== 'find';
|
|
66
|
+
const isExplicit = isPackageManager || name.startsWith('./') || /^(?:\.\.?\/)*node_modules\/\.bin\//.test(name);
|
|
67
|
+
const isLocal = hasLocalBinPath && !command.prefix.some(assignment => assignment.name === 'PATH');
|
|
68
|
+
const isWrapperCommand = !isPackageManager && isWrapper(binary);
|
|
69
|
+
if (!isExplicit && !isLocal && !isWrapperCommand && binary !== 'node' && binary !== 'find')
|
|
70
|
+
continue;
|
|
71
|
+
let commandInputs;
|
|
72
|
+
if (isWrapperCommand || binary === 'find') {
|
|
73
|
+
const fromScript = (script) => {
|
|
74
|
+
inputs.push(...getInputsFromMiseScript(script, options, isLocal));
|
|
75
|
+
return [];
|
|
76
|
+
};
|
|
77
|
+
const fromArgs = args => fromScript(toScript(args));
|
|
78
|
+
commandInputs = getDependenciesFromCommand({ ...command, name: word, prefix, suffix: words }, { ...options, fromArgs });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
commandInputs = options.getInputsFromScripts([...prefix.map(assignment => assignment.text), word.text, ...words.map(word => word.text)].join(' '), { cwd: options.cwd, manifest: options.manifest });
|
|
82
|
+
}
|
|
83
|
+
if (!isExplicit && !isLocal && binary !== 'node' && binary !== 'find')
|
|
84
|
+
continue;
|
|
85
|
+
if (isWrapperCommand && spawningBinaries.includes(binary)) {
|
|
86
|
+
commandInputs.push(...getInputsFromNodeOptions(prefix));
|
|
87
|
+
}
|
|
88
|
+
const binaryInput = commandInputs.find(input => isBinary(input) && input.specifier === binary);
|
|
89
|
+
if (!isExplicit && isLocal && binaryInput)
|
|
90
|
+
binaryInput.optional = true;
|
|
91
|
+
for (const input of commandInputs) {
|
|
92
|
+
if (!input.specifier || input.specifier.includes(SCRIPT_INTERPOLATION))
|
|
93
|
+
continue;
|
|
94
|
+
if (!isExplicit && !isLocal && input === binaryInput)
|
|
95
|
+
continue;
|
|
96
|
+
inputs.push(input);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
try {
|
|
102
|
+
readScript(parse(script));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
return inputs;
|
|
108
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type MiseEnvironment = {
|
|
2
|
+
PATH?: unknown;
|
|
3
|
+
_?: {
|
|
4
|
+
path?: string | string[];
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
type TaskReference = {
|
|
8
|
+
task: string;
|
|
9
|
+
} | {
|
|
10
|
+
tasks: string[];
|
|
11
|
+
};
|
|
12
|
+
type Run = string | (string | TaskReference)[];
|
|
13
|
+
type MiseTask = {
|
|
14
|
+
run?: Run;
|
|
15
|
+
run_windows?: Run;
|
|
16
|
+
dir?: string;
|
|
17
|
+
env?: MiseEnvironment;
|
|
18
|
+
};
|
|
19
|
+
export type MiseConfig = {
|
|
20
|
+
tasks?: Record<string, string | string[] | MiseTask>;
|
|
21
|
+
env?: MiseEnvironment | MiseEnvironment[];
|
|
22
|
+
task_config?: {
|
|
23
|
+
dir?: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toEntry, toProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { getScriptCommands } from '../../util/scripts.js';
|
|
3
|
+
import { createFsPromisesGlobVisitor } from './visitors/fsPromisesGlob.js';
|
|
3
4
|
const title = 'Node.js';
|
|
4
5
|
const isEnabled = () => true;
|
|
5
6
|
const patterns = [
|
|
@@ -21,6 +22,9 @@ const hasNodeTest = (scripts) => {
|
|
|
21
22
|
return result;
|
|
22
23
|
};
|
|
23
24
|
const entry = ['server.js'];
|
|
25
|
+
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
26
|
+
registerVisitor(createFsPromisesGlobVisitor(ctx));
|
|
27
|
+
};
|
|
24
28
|
const resolve = options => {
|
|
25
29
|
const entries = entry.map(id => toProductionEntry(id));
|
|
26
30
|
if (hasNodeTest(options.manifest.scripts) || hasNodeTest(options.rootManifest?.scripts)) {
|
|
@@ -53,5 +57,6 @@ const plugin = {
|
|
|
53
57
|
entry,
|
|
54
58
|
resolve,
|
|
55
59
|
args,
|
|
60
|
+
registerVisitors,
|
|
56
61
|
};
|
|
57
62
|
export default plugin;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { findProperty, getPropertyKey } from '../../../typescript/ast-helpers.js';
|
|
2
|
+
import { getStringValue, isStringLiteral } from '../../../typescript/ast-nodes.js';
|
|
3
|
+
const FS_PROMISES = new Set(['node:fs/promises', 'fs/promises']);
|
|
4
|
+
export function createFsPromisesGlobVisitor(ctx) {
|
|
5
|
+
const globNames = new Set();
|
|
6
|
+
const namespaceNames = new Set();
|
|
7
|
+
return {
|
|
8
|
+
Program() {
|
|
9
|
+
globNames.clear();
|
|
10
|
+
namespaceNames.clear();
|
|
11
|
+
},
|
|
12
|
+
ImportDeclaration(node) {
|
|
13
|
+
if (!FS_PROMISES.has(node.source.value))
|
|
14
|
+
return;
|
|
15
|
+
for (const specifier of node.specifiers ?? []) {
|
|
16
|
+
if (specifier.type === 'ImportNamespaceSpecifier') {
|
|
17
|
+
namespaceNames.add(specifier.local.name);
|
|
18
|
+
}
|
|
19
|
+
else if (specifier.type === 'ImportSpecifier' &&
|
|
20
|
+
specifier.imported.type === 'Identifier' &&
|
|
21
|
+
specifier.imported.name === 'glob') {
|
|
22
|
+
globNames.add(specifier.local.name);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
VariableDeclarator(node) {
|
|
27
|
+
if (node.init?.type !== 'CallExpression' ||
|
|
28
|
+
node.init.callee.type !== 'Identifier' ||
|
|
29
|
+
node.init.callee.name !== 'require' ||
|
|
30
|
+
!isStringLiteral(node.init.arguments[0]) ||
|
|
31
|
+
!FS_PROMISES.has(getStringValue(node.init.arguments[0])))
|
|
32
|
+
return;
|
|
33
|
+
if (node.id.type === 'Identifier') {
|
|
34
|
+
namespaceNames.add(node.id.name);
|
|
35
|
+
}
|
|
36
|
+
else if (node.id.type === 'ObjectPattern') {
|
|
37
|
+
for (const property of node.id.properties) {
|
|
38
|
+
if (property.type === 'Property' &&
|
|
39
|
+
getPropertyKey(property) === 'glob' &&
|
|
40
|
+
property.value.type === 'Identifier') {
|
|
41
|
+
globNames.add(property.value.name);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
CallExpression(node) {
|
|
47
|
+
let isGlobCall = node.callee.type === 'Identifier' && globNames.has(node.callee.name);
|
|
48
|
+
if (!isGlobCall &&
|
|
49
|
+
node.callee.type === 'MemberExpression' &&
|
|
50
|
+
!node.callee.computed &&
|
|
51
|
+
node.callee.object.type === 'Identifier' &&
|
|
52
|
+
namespaceNames.has(node.callee.object.name) &&
|
|
53
|
+
node.callee.property.type === 'Identifier' &&
|
|
54
|
+
node.callee.property.name === 'glob') {
|
|
55
|
+
isGlobCall = true;
|
|
56
|
+
}
|
|
57
|
+
if (!isGlobCall)
|
|
58
|
+
return;
|
|
59
|
+
const arg = node.arguments[0];
|
|
60
|
+
if (!arg)
|
|
61
|
+
return;
|
|
62
|
+
let patterns;
|
|
63
|
+
if (isStringLiteral(arg)) {
|
|
64
|
+
patterns = [getStringValue(arg)];
|
|
65
|
+
}
|
|
66
|
+
else if (arg.type === 'ArrayExpression') {
|
|
67
|
+
patterns = [];
|
|
68
|
+
for (const element of arg.elements) {
|
|
69
|
+
if (!element || !isStringLiteral(element))
|
|
70
|
+
return;
|
|
71
|
+
patterns.push(getStringValue(element));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!patterns?.length || patterns.some(pattern => pattern.startsWith('!')))
|
|
75
|
+
return;
|
|
76
|
+
const options = node.arguments[1];
|
|
77
|
+
if (options && options.type !== 'ObjectExpression')
|
|
78
|
+
return;
|
|
79
|
+
if (options &&
|
|
80
|
+
(options.properties.length > 1 ||
|
|
81
|
+
options.properties.some(property => property.type !== 'Property' || property.computed || getPropertyKey(property) !== 'cwd')))
|
|
82
|
+
return;
|
|
83
|
+
const cwdNode = findProperty(options, 'cwd');
|
|
84
|
+
if (cwdNode && !isStringLiteral(cwdNode))
|
|
85
|
+
return;
|
|
86
|
+
ctx.addImportGlob(patterns, { cwd: cwdNode ? getStringValue(cwdNode) : '.' });
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -87,18 +87,18 @@ const addAppEntries = (inputs, srcDir, serverDir, config, dir) => {
|
|
|
87
87
|
inputs.push(toDeferResolveProductionEntry(resolveAlias(id, srcDir, dir)));
|
|
88
88
|
};
|
|
89
89
|
const findLayerConfigs = (cwd) => _syncGlob({ cwd, patterns: [`layers/*/${config.at(0)}`] });
|
|
90
|
+
const definitionFiles = [
|
|
91
|
+
'.nuxt/imports.d.ts',
|
|
92
|
+
'.nuxt/components.d.ts',
|
|
93
|
+
'.nuxt/types/nitro-routes.d.ts',
|
|
94
|
+
'.nuxt/types/nitro-imports.d.ts',
|
|
95
|
+
];
|
|
90
96
|
const registerCompilers = async ({ cwd, hasDependency, registerCompiler }) => {
|
|
91
|
-
if (hasDependency('nuxt') || hasDependency('nuxt-nightly')) {
|
|
97
|
+
if (hasDependency('nuxt') || hasDependency('nuxt-nightly') || isDirectory(cwd, '.nuxt')) {
|
|
98
|
+
const paths = definitionFiles.map(file => join(cwd, file));
|
|
92
99
|
const maps = createAutoImportMaps();
|
|
93
|
-
const
|
|
94
|
-
'.
|
|
95
|
-
'.nuxt/components.d.ts',
|
|
96
|
-
'.nuxt/types/nitro-routes.d.ts',
|
|
97
|
-
'.nuxt/types/nitro-imports.d.ts',
|
|
98
|
-
];
|
|
99
|
-
for (const file of definitionFiles) {
|
|
100
|
-
const path = join(cwd, file);
|
|
101
|
-
buildAutoImportMap(path, readAndParseFile(path), maps, file.endsWith('components.d.ts'));
|
|
100
|
+
for (const path of paths) {
|
|
101
|
+
buildAutoImportMap(path, readAndParseFile(path), maps, path.endsWith('components.d.ts'));
|
|
102
102
|
}
|
|
103
103
|
registerCompiler({ extension: '.vue', compiler: createVueCompiler(maps, cwd) });
|
|
104
104
|
registerCompiler({ extension: '.ts', compiler: createTsCompiler(maps) });
|
|
@@ -121,6 +121,9 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
121
121
|
addModule(id);
|
|
122
122
|
}
|
|
123
123
|
addAppEntries(inputs, srcDir, serverDir, localConfig, cwd);
|
|
124
|
+
const sharedDir = toAbsolute(localConfig.dir?.shared ?? 'shared', cwd);
|
|
125
|
+
inputs.push(toAlias('#shared', sharedDir));
|
|
126
|
+
inputs.push(toAlias('#shared/*', join(sharedDir, '*'), { dir: cwd }));
|
|
124
127
|
const aliases = localConfig.alias;
|
|
125
128
|
if (aliases) {
|
|
126
129
|
for (const key in aliases) {
|
|
@@ -7,9 +7,10 @@ const config = ['rstest.config.{js,cjs,mjs,ts,cts,mts}'];
|
|
|
7
7
|
const mocks = ['**/__mocks__/**/*.?(c|m)[jt]s?(x)'];
|
|
8
8
|
const entry = ['**/*.{test,spec}.?(c|m)[jt]s?(x)'];
|
|
9
9
|
function testEnvironment(config) {
|
|
10
|
-
|
|
10
|
+
const environment = typeof config.testEnvironment === 'string' ? config.testEnvironment : config.testEnvironment?.name;
|
|
11
|
+
if (!environment || environment === 'node')
|
|
11
12
|
return [];
|
|
12
|
-
return [
|
|
13
|
+
return [environment];
|
|
13
14
|
}
|
|
14
15
|
const resolveConfig = async (config) => {
|
|
15
16
|
const entries = (config.include ?? entry)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Program } from 'oxc-parser';
|
|
2
2
|
import { type Input } from '../../util/input.ts';
|
|
3
3
|
export declare const getBabelInputs: (program: Program) => Input[];
|
|
4
|
-
export declare const getHtmlScriptEntries: (htmlPath: string) => Promise<Input[]>;
|
|
5
|
-
export declare const getIndexHtmlEntries: (rootDir: string) => Promise<Input[]>;
|
|
4
|
+
export declare const getHtmlScriptEntries: (htmlPath: string, publicDir?: string) => Promise<Input[]>;
|
|
5
|
+
export declare const getIndexHtmlEntries: (rootDir: string, publicDir?: string) => Promise<Input[]>;
|
|
6
6
|
export declare const getVitePluginDirs: (program: Program, specifiers: string[], key: string) => string[] | undefined;
|
|
@@ -3,7 +3,7 @@ import { findImportedCalls, findProperty, getStringValues } from '../../typescri
|
|
|
3
3
|
import { getStringValue } from '../../typescript/ast-nodes.js';
|
|
4
4
|
import { isFile, loadFile } from '../../util/fs.js';
|
|
5
5
|
import { toProductionEntry } from '../../util/input.js';
|
|
6
|
-
import { dirname, join } from '../../util/path.js';
|
|
6
|
+
import { dirname, join, toAbsolute } from '../../util/path.js';
|
|
7
7
|
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
8
8
|
const babelPluginSources = ['@rolldown/plugin-babel', '@vitejs/plugin-react', 'vite-plugin-babel'];
|
|
9
9
|
const isBabelWrappingPlugin = (path) => babelPluginSources.some(source => path === source || path.startsWith(`${source}/`));
|
|
@@ -26,19 +26,26 @@ const srcAttrPattern = /\bsrc\s*=\s*["']([^"']+)["']/i;
|
|
|
26
26
|
const importSpecPattern = /\bimport\b(?:\s*\(\s*|(?:[\w$*,{}\s]*\bfrom\b)?\s*)(['"])([^'"]+)\1/g;
|
|
27
27
|
const isFilePath = (specifier) => specifier.startsWith('/') || specifier.startsWith('./') || specifier.startsWith('../');
|
|
28
28
|
const normalizeModuleScriptSrc = (value) => value.trim().replace(/^\//, '');
|
|
29
|
-
const
|
|
29
|
+
const getScriptSources = (html, publicDir) => {
|
|
30
30
|
const sources = [];
|
|
31
31
|
for (const [, attrs, body] of html.matchAll(scriptExtractor)) {
|
|
32
|
-
if (!moduleTypePattern.test(attrs))
|
|
33
|
-
continue;
|
|
34
32
|
const srcMatch = attrs.match(srcAttrPattern);
|
|
35
33
|
if (srcMatch) {
|
|
36
|
-
const src =
|
|
37
|
-
if (src)
|
|
38
|
-
|
|
34
|
+
const src = srcMatch[1].trim();
|
|
35
|
+
if (!src || /^(?:[\w+.-]+:|\/\/)/.test(src))
|
|
36
|
+
continue;
|
|
37
|
+
if (publicDir && src.startsWith('/')) {
|
|
38
|
+
const publicPath = join(publicDir, src.split(/[?#]/, 1)[0]);
|
|
39
|
+
if (publicPath.startsWith(join(publicDir, '/')) && isFile(publicPath)) {
|
|
40
|
+
sources.push(publicPath);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (moduleTypePattern.test(attrs))
|
|
45
|
+
sources.push(normalizeModuleScriptSrc(src));
|
|
39
46
|
continue;
|
|
40
47
|
}
|
|
41
|
-
if (body) {
|
|
48
|
+
if (moduleTypePattern.test(attrs) && body) {
|
|
42
49
|
const code = body.replace(blockCommentMatcher, '').replace(lineCommentMatcher, '');
|
|
43
50
|
for (const importMatch of code.matchAll(importSpecPattern)) {
|
|
44
51
|
const specifier = importMatch[2];
|
|
@@ -49,14 +56,14 @@ const getModuleScriptSources = (html) => {
|
|
|
49
56
|
}
|
|
50
57
|
return sources;
|
|
51
58
|
};
|
|
52
|
-
export const getHtmlScriptEntries = async (htmlPath) => {
|
|
59
|
+
export const getHtmlScriptEntries = async (htmlPath, publicDir) => {
|
|
53
60
|
if (!isFile(htmlPath))
|
|
54
61
|
return [];
|
|
55
62
|
const html = await loadFile(htmlPath);
|
|
56
63
|
const dir = dirname(htmlPath);
|
|
57
|
-
return
|
|
64
|
+
return getScriptSources(html, publicDir).map(src => toProductionEntry(toAbsolute(src, dir)));
|
|
58
65
|
};
|
|
59
|
-
export const getIndexHtmlEntries = (rootDir) => getHtmlScriptEntries(join(rootDir, 'index.html'));
|
|
66
|
+
export const getIndexHtmlEntries = (rootDir, publicDir) => getHtmlScriptEntries(join(rootDir, 'index.html'), publicDir);
|
|
60
67
|
export const getVitePluginDirs = (program, specifiers, key) => {
|
|
61
68
|
let dirs;
|
|
62
69
|
for (const call of findImportedCalls(program, specifiers)) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { findProperty } from '../../../typescript/ast-helpers.js';
|
|
1
2
|
import { getStringValue, isStringLiteral } from '../../../typescript/ast-nodes.js';
|
|
3
|
+
const RAW_QUERY_RE = /(\?|&)raw(?:&|$)/;
|
|
2
4
|
export function createImportMetaGlobVisitor(ctx) {
|
|
3
5
|
return {
|
|
4
6
|
CallExpression(node) {
|
|
@@ -22,6 +24,16 @@ export function createImportMetaGlobVisitor(ctx) {
|
|
|
22
24
|
}
|
|
23
25
|
if (!patterns?.length)
|
|
24
26
|
return;
|
|
27
|
+
const options = node.arguments[1];
|
|
28
|
+
if (options?.type === 'ObjectExpression') {
|
|
29
|
+
const queryNode = findProperty(options, 'query');
|
|
30
|
+
const query = getStringValue(queryNode);
|
|
31
|
+
const isRaw = getStringValue(findProperty(options, 'as')) === 'raw' ||
|
|
32
|
+
(query !== undefined && RAW_QUERY_RE.test(query.startsWith('?') ? query : `?${query}`)) ||
|
|
33
|
+
getStringValue(findProperty(queryNode, 'raw')) === '';
|
|
34
|
+
if (isRaw)
|
|
35
|
+
return ctx.addImportGlob(patterns, { analyzeExports: true });
|
|
36
|
+
}
|
|
25
37
|
ctx.addImportGlob(patterns);
|
|
26
38
|
},
|
|
27
39
|
};
|
|
@@ -2,7 +2,7 @@ import { DEFAULT_EXTENSIONS } from '../../constants.js';
|
|
|
2
2
|
import { _glob } from '../../util/glob.js';
|
|
3
3
|
import { toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
4
4
|
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
5
|
-
import { isAbsolute, isInternal, join, toAbsolute } from '../../util/path.js';
|
|
5
|
+
import { isAbsolute, isInternal, join, toAbsolute, toPosix } from '../../util/path.js';
|
|
6
6
|
import { hasDependency } from '../../util/plugin.js';
|
|
7
7
|
import { getIndexHtmlEntries } from '../vite/helpers.js';
|
|
8
8
|
import { getAliasInputs, getEnvSpecifier, getExternalReporters } from './helpers.js';
|
|
@@ -137,7 +137,10 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
137
137
|
const viteRoot = toAbsolute(cfg.root ?? '.', options.cwd);
|
|
138
138
|
if (!seenRoots.has(viteRoot)) {
|
|
139
139
|
seenRoots.add(viteRoot);
|
|
140
|
-
|
|
140
|
+
const publicDir = cfg.publicDir === false || cfg.publicDir === ''
|
|
141
|
+
? undefined
|
|
142
|
+
: toAbsolute(toPosix(cfg.publicDir ?? 'public'), viteRoot);
|
|
143
|
+
for (const entry of await getIndexHtmlEntries(viteRoot, publicDir))
|
|
141
144
|
inputs.add(entry);
|
|
142
145
|
}
|
|
143
146
|
const vitestRoot = toAbsolute(cfg.test?.root ?? '.', options.cwd);
|
package/dist/run.js
CHANGED
|
@@ -60,7 +60,7 @@ export const run = async (options) => {
|
|
|
60
60
|
const isGitIgnored = await getGitIgnoredHandler(options, new Set(workspaces.map(w => w.dir)));
|
|
61
61
|
const toSourceFilePath = getModuleSourcePathHandler(chief);
|
|
62
62
|
const findWorkspacePackageTarget = getWorkspacePackageTargetHandler(chief);
|
|
63
|
-
const principal = new ProjectPrincipal(options, toSourceFilePath, findWorkspacePackageTarget);
|
|
63
|
+
const principal = new ProjectPrincipal(options, toSourceFilePath, findWorkspacePackageTarget, filePath => chief.findWorkspaceByFilePath(filePath)?.name);
|
|
64
64
|
collector.setWorkspaceFilter(chief.workspaceFilePathFilter);
|
|
65
65
|
collector.setSelectedWorkspaces(chief.selectedWorkspaces);
|
|
66
66
|
collector.setIgnoreIssues(chief.getIgnoreIssues());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/mini';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Compiler } from '../compilers/types.ts';
|
|
3
3
|
export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
4
4
|
angular: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
5
5
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -321,6 +321,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
321
321
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
322
322
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
323
323
|
}, z.core.$strip>]>>;
|
|
324
|
+
mise: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
325
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
326
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
327
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
328
|
+
}, z.core.$strip>]>>;
|
|
324
329
|
mocha: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
325
330
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
326
331
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1247,6 +1252,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1247
1252
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1248
1253
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1249
1254
|
}, z.core.$strip>]>>;
|
|
1255
|
+
mise: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1256
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1257
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1258
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1259
|
+
}, z.core.$strip>]>>;
|
|
1250
1260
|
mocha: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1251
1261
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1252
1262
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1862,12 +1872,13 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1862
1872
|
}, z.core.$strict>>;
|
|
1863
1873
|
ignoreWorkspaces: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
1864
1874
|
includeEntryExports: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
1865
|
-
compilers: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.
|
|
1866
|
-
|
|
1867
|
-
asyncCompilers: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniCustom<CompilerAsync, CompilerAsync>>>;
|
|
1875
|
+
compilers: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniLiteral<true>, z.ZodMiniCustom<Compiler, Compiler>]>>>;
|
|
1876
|
+
asyncCompilers: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniCustom<Compiler, Compiler>>>;
|
|
1868
1877
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
1869
1878
|
treatConfigHintsAsErrors: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
1870
1879
|
treatTagHintsAsErrors: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
1880
|
+
preprocessor: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1881
|
+
preprocessorOptions: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
|
|
1871
1882
|
include: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]>>>;
|
|
1872
1883
|
exclude: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]>>>;
|
|
1873
1884
|
workspaces: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
@@ -2191,6 +2202,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
2191
2202
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2192
2203
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2193
2204
|
}, z.core.$strip>]>>;
|
|
2205
|
+
mise: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2206
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2207
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2208
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2209
|
+
}, z.core.$strip>]>>;
|
|
2194
2210
|
mocha: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2195
2211
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2196
2212
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -2,10 +2,8 @@ import { z } from 'zod/mini';
|
|
|
2
2
|
import { SYMBOL_TYPE } from '../constants.js';
|
|
3
3
|
import { globSchema, pluginsSchema } from './plugins.js';
|
|
4
4
|
const pathsSchema = z.record(z.string(), z.array(z.string()));
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const compilerSchema = z.union([syncCompilerSchema, asyncCompilerSchema]);
|
|
8
|
-
const compilersSchema = z.record(z.string(), compilerSchema);
|
|
5
|
+
const compilerSchema = z.custom();
|
|
6
|
+
const compilersSchema = z.record(z.string(), z.union([z.literal(true), compilerSchema]));
|
|
9
7
|
const stringOrRegexSchema = z.array(z.union([z.string(), z.instanceof(RegExp)]));
|
|
10
8
|
const issueTypeSchema = z.union([
|
|
11
9
|
z.literal('files'),
|
|
@@ -53,11 +51,12 @@ const rootConfigurationSchema = z.object({
|
|
|
53
51
|
ignoreWorkspaces: z.optional(z.array(z.string())),
|
|
54
52
|
includeEntryExports: z.optional(z.boolean()),
|
|
55
53
|
compilers: z.optional(compilersSchema),
|
|
56
|
-
|
|
57
|
-
asyncCompilers: z.optional(z.record(z.string(), asyncCompilerSchema)),
|
|
54
|
+
asyncCompilers: z.optional(z.record(z.string(), compilerSchema)),
|
|
58
55
|
tags: z.optional(z.array(z.string())),
|
|
59
56
|
treatConfigHintsAsErrors: z.optional(z.boolean()),
|
|
60
57
|
treatTagHintsAsErrors: z.optional(z.boolean()),
|
|
58
|
+
preprocessor: z.optional(z.union([z.string(), z.array(z.string())])),
|
|
59
|
+
preprocessorOptions: z.optional(z.record(z.string(), z.unknown())),
|
|
61
60
|
});
|
|
62
61
|
const reportConfigSchema = z.object({
|
|
63
62
|
include: z.optional(z.array(issueTypeSchema)),
|