@bemedev/dev-utils 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -5
- package/lib/build-tests/addTarball.d.ts +1 -1
- package/lib/build-tests/buildPackageJson.d.ts +3 -3
- package/lib/build-tests/cleanup.d.ts +1 -1
- package/lib/build-tests/cli/cli.d.ts +51 -1
- package/lib/build-tests/cli/index.d.ts +1 -0
- package/lib/build-tests/cli/post.d.ts +5 -1
- package/lib/build-tests/cli/pre.d.ts +5 -1
- package/lib/build-tests/cli/test.d.ts +15 -1
- package/lib/build-tests/constants.d.ts +1 -1
- package/lib/build-tests/getRelativePath.d.ts +1 -1
- package/lib/build-tests/getTypescriptOutdir.d.ts +1 -1
- package/lib/build-tests/import.d.ts +2 -2
- package/lib/build-tests/imports/create.d.ts +3 -3
- package/lib/build-tests/imports/helper.d.ts +7 -3
- package/lib/build-tests/imports/index.d.ts +1 -1
- package/lib/build-tests/index.d.ts +5 -5
- package/lib/build-tests/pack.d.ts +1 -1
- package/lib/rolldown-config/config.d.ts +1 -1
- package/lib/rolldown-config/constants.d.ts +5 -5
- package/lib/rolldown-config/helpers.d.ts +2 -2
- package/lib/rolldown-config/index.d.ts +3 -3
- package/lib/rolldown-config/input.d.ts +1 -1
- package/lib/rolldown-config/output.d.ts +15 -1
- package/lib/rolldown-config/plugins/circulars.d.ts +9 -9
- package/lib/rolldown-config/plugins/clean.cjs +3 -1
- package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
- package/lib/rolldown-config/plugins/clean.d.ts +13 -4
- package/lib/rolldown-config/plugins/clean.js +4 -2
- package/lib/rolldown-config/plugins/clean.js.map +1 -1
- package/lib/rolldown-config/plugins/externals.d.ts +7 -7
- package/lib/rolldown-config/plugins/index.d.ts +23 -2
- package/lib/rolldown-config/plugins/typescript.cjs +29 -41
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs +46 -39
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.d.ts +2 -4
- package/lib/rolldown-config/plugins/typescript.config.js +47 -41
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.d.ts +6 -6
- package/lib/rolldown-config/plugins/typescript.js +29 -43
- package/lib/rolldown-config/plugins/typescript.js.map +1 -1
- package/lib/rolldown-config/types.d.ts +13 -13
- package/lib/utils/array.d.ts +1 -1
- package/lib/utils/identity.d.ts +1 -1
- package/lib/utils/index.d.ts +4 -4
- package/lib/utils/sleep.d.ts +1 -1
- package/lib/utils/types.d.ts +1 -4
- package/lib/vitest-exclude/index.d.ts +1 -1
- package/lib/vitest-exclude/types.d.ts +11 -8
- package/lib/vitest-exclude/vitest.cjs +0 -2
- package/lib/vitest-exclude/vitest.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.d.ts +27 -15
- package/lib/vitest-exclude/vitest.js +0 -2
- package/lib/vitest-exclude/vitest.js.map +1 -1
- package/lib/vitest-exclude/vitest.utils.d.ts +2 -2
- package/lib/vitest-extended/acceptation.d.ts +3 -2
- package/lib/vitest-extended/bemedev/globals/types.d.ts +1 -4
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.d.ts +10 -10
- package/lib/vitest-extended/createTests.d.ts +55 -34
- package/lib/vitest-extended/createTests.types.d.ts +6 -10
- package/lib/vitest-extended/done.d.ts +14 -8
- package/lib/vitest-extended/each/error.d.ts +1 -1
- package/lib/vitest-extended/each/error.types.d.ts +4 -10
- package/lib/vitest-extended/each/index.d.ts +2 -2
- package/lib/vitest-extended/each/pass.d.ts +26 -26
- package/lib/vitest-extended/each/pass.types.d.ts +6 -18
- package/lib/vitest-extended/fakeWaiter.d.ts +3 -3
- package/lib/vitest-extended/identity.d.ts +2 -2
- package/lib/vitest-extended/index.cjs +2 -0
- package/lib/vitest-extended/index.d.ts +7 -6
- package/lib/vitest-extended/index.js +2 -1
- package/lib/vitest-extended/isDefined.d.ts +1 -1
- package/lib/vitest-extended/isFunction.d.ts +1 -1
- package/lib/vitest-extended/project.cjs +23 -0
- package/lib/vitest-extended/project.cjs.map +1 -0
- package/lib/vitest-extended/project.d.ts +2 -0
- package/lib/vitest-extended/project.js +22 -0
- package/lib/vitest-extended/project.js.map +1 -0
- package/lib/vitest-extended/toArray.d.ts +1 -1
- package/lib/vitest-extended/toStringFlat.d.ts +1 -1
- package/lib/vitest-extended/types.d.ts +38 -40
- package/package.json +3 -7
|
@@ -1,51 +1,58 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
3
|
let fs = require("fs");
|
|
3
4
|
let path = require("path");
|
|
4
|
-
let
|
|
5
|
+
let _typescript_typescript6 = require("@typescript/typescript6");
|
|
6
|
+
_typescript_typescript6 = require_runtime.__toESM(_typescript_typescript6, 1);
|
|
5
7
|
//#region src/rolldown-config/plugins/typescript.config.ts
|
|
6
|
-
|
|
7
|
-
return jsonString.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m);
|
|
8
|
-
}
|
|
9
|
-
function findConfigFile(searchPath, configName = "tsconfig.json") {
|
|
10
|
-
let dir = searchPath;
|
|
11
|
-
while (true) {
|
|
12
|
-
const filePath = (0, path.join)(dir, configName);
|
|
13
|
-
if ((0, fs.existsSync)(filePath)) return filePath;
|
|
14
|
-
const parentDir = (0, path.dirname)(dir);
|
|
15
|
-
if (parentDir === dir) break;
|
|
16
|
-
dir = parentDir;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const readTsConfig = (path$1) => {
|
|
20
|
-
if (!(0, fs.existsSync)(path$1)) throw new Error(`tsconfig.json not found at ${path$1}`);
|
|
21
|
-
const cleanJson = stripComments((0, fs.readFileSync)(path$1, "utf-8"));
|
|
22
|
-
let config;
|
|
8
|
+
const _readFile = (filePath) => {
|
|
23
9
|
try {
|
|
24
|
-
|
|
25
|
-
} catch
|
|
26
|
-
|
|
10
|
+
return (0, fs.readFileSync)(filePath, "utf-8");
|
|
11
|
+
} catch {
|
|
12
|
+
return;
|
|
27
13
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
14
|
+
};
|
|
15
|
+
const _readDirectory = (rootDir, extensions, _, __, depth) => {
|
|
16
|
+
const results = [];
|
|
17
|
+
const walk = (dir, currentDepth) => {
|
|
18
|
+
if (depth !== void 0 && currentDepth > depth) return;
|
|
19
|
+
let entries;
|
|
20
|
+
try {
|
|
21
|
+
entries = (0, fs.readdirSync)(dir);
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
37
24
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
for (const entry of entries) {
|
|
26
|
+
const fullPath = (0, path.join)(dir, entry);
|
|
27
|
+
let stat;
|
|
28
|
+
try {
|
|
29
|
+
stat = (0, fs.statSync)(fullPath);
|
|
30
|
+
} catch {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (stat.isDirectory()) walk(fullPath, currentDepth + 1);
|
|
34
|
+
else if (!extensions || extensions.some((ext) => entry.endsWith(ext))) results.push(fullPath);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
walk(rootDir, 0);
|
|
38
|
+
return results;
|
|
39
|
+
};
|
|
40
|
+
const _host = {
|
|
41
|
+
useCaseSensitiveFileNames: true,
|
|
42
|
+
readDirectory: _readDirectory,
|
|
43
|
+
fileExists: fs.existsSync,
|
|
44
|
+
readFile: _readFile
|
|
45
|
+
};
|
|
46
|
+
const readTsConfig = (path$1) => {
|
|
47
|
+
const configFile = _typescript_typescript6.default.readConfigFile(path$1, _readFile);
|
|
48
|
+
if (configFile.error) throw new Error(_typescript_typescript6.default.formatDiagnostic(configFile.error, {
|
|
49
|
+
getCanonicalFileName: (f) => f,
|
|
50
|
+
getCurrentDirectory: () => process.cwd(),
|
|
51
|
+
getNewLine: () => "\n"
|
|
52
|
+
}));
|
|
53
|
+
return _typescript_typescript6.default.parseJsonConfigFileContent(configFile.config, _host, (0, path.dirname)(path$1));
|
|
46
54
|
};
|
|
47
55
|
//#endregion
|
|
48
|
-
exports.findConfigFile = findConfigFile;
|
|
49
56
|
exports.readTsConfig = readTsConfig;
|
|
50
57
|
|
|
51
58
|
//# sourceMappingURL=typescript.config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.config.cjs","names":["path"],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport {
|
|
1
|
+
{"version":3,"file":"typescript.config.cjs","names":["existsSync","ts","path"],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport ts from '@typescript/typescript6';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;;;;AAKA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,QAAA,GAAA,GAAA,aAAA,CAAoB,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,WAAA,GAAA,GAAA,YAAA,CAAsB,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,YAAA,GAAA,KAAA,KAAA,CAAgB,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,QAAA,GAAA,GAAA,SAAA,CAAgB,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAYA,GAAAA;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB,WAAiB;CAC5C,MAAM,aAAaC,wBAAAA,QAAG,eAAeC,QAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACRD,wBAAAA,QAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqBA,wBAAAA,QAAG,2BACtB,WAAW,QACX,QAAA,GAAA,KAAA,QAAA,CACQC,MAAI,CAGI;AACpB"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const readTsConfig: (path: string) =>
|
|
3
|
-
compilerOptions: any;
|
|
4
|
-
};
|
|
1
|
+
import ts from '@typescript/typescript6';
|
|
2
|
+
export declare const readTsConfig: (path: string) => ts.ParsedCommandLine;
|
|
@@ -1,49 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
2
|
+
import { dirname, join } from "path";
|
|
3
|
+
import ts from "@typescript/typescript6";
|
|
4
4
|
//#region src/rolldown-config/plugins/typescript.config.ts
|
|
5
|
-
|
|
6
|
-
return jsonString.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m);
|
|
7
|
-
}
|
|
8
|
-
function findConfigFile(searchPath, configName = "tsconfig.json") {
|
|
9
|
-
let dir = searchPath;
|
|
10
|
-
while (true) {
|
|
11
|
-
const filePath = join(dir, configName);
|
|
12
|
-
if (existsSync(filePath)) return filePath;
|
|
13
|
-
const parentDir = dirname(dir);
|
|
14
|
-
if (parentDir === dir) break;
|
|
15
|
-
dir = parentDir;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const readTsConfig = (path) => {
|
|
19
|
-
if (!existsSync(path)) throw new Error(`tsconfig.json not found at ${path}`);
|
|
20
|
-
const cleanJson = stripComments(readFileSync(path, "utf-8"));
|
|
21
|
-
let config;
|
|
5
|
+
const _readFile = (filePath) => {
|
|
22
6
|
try {
|
|
23
|
-
|
|
24
|
-
} catch
|
|
25
|
-
|
|
7
|
+
return readFileSync(filePath, "utf-8");
|
|
8
|
+
} catch {
|
|
9
|
+
return;
|
|
26
10
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
};
|
|
12
|
+
const _readDirectory = (rootDir, extensions, _, __, depth) => {
|
|
13
|
+
const results = [];
|
|
14
|
+
const walk = (dir, currentDepth) => {
|
|
15
|
+
if (depth !== void 0 && currentDepth > depth) return;
|
|
16
|
+
let entries;
|
|
17
|
+
try {
|
|
18
|
+
entries = readdirSync(dir);
|
|
19
|
+
} catch {
|
|
20
|
+
return;
|
|
36
21
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const fullPath = join(dir, entry);
|
|
24
|
+
let stat;
|
|
25
|
+
try {
|
|
26
|
+
stat = statSync(fullPath);
|
|
27
|
+
} catch {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (stat.isDirectory()) walk(fullPath, currentDepth + 1);
|
|
31
|
+
else if (!extensions || extensions.some((ext) => entry.endsWith(ext))) results.push(fullPath);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
walk(rootDir, 0);
|
|
35
|
+
return results;
|
|
36
|
+
};
|
|
37
|
+
const _host = {
|
|
38
|
+
useCaseSensitiveFileNames: true,
|
|
39
|
+
readDirectory: _readDirectory,
|
|
40
|
+
fileExists: existsSync,
|
|
41
|
+
readFile: _readFile
|
|
42
|
+
};
|
|
43
|
+
const readTsConfig = (path) => {
|
|
44
|
+
const configFile = ts.readConfigFile(path, _readFile);
|
|
45
|
+
if (configFile.error) throw new Error(ts.formatDiagnostic(configFile.error, {
|
|
46
|
+
getCanonicalFileName: (f) => f,
|
|
47
|
+
getCurrentDirectory: () => process.cwd(),
|
|
48
|
+
getNewLine: () => "\n"
|
|
49
|
+
}));
|
|
50
|
+
return ts.parseJsonConfigFileContent(configFile.config, _host, dirname(path));
|
|
45
51
|
};
|
|
46
52
|
//#endregion
|
|
47
|
-
export {
|
|
53
|
+
export { readTsConfig };
|
|
48
54
|
|
|
49
55
|
//# sourceMappingURL=typescript.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport {
|
|
1
|
+
{"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport ts from '@typescript/typescript6';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;AAKA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,OAAO,aAAa,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,UAAU,YAAY,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,OAAO,SAAS,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAY;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB,SAAiB;CAC5C,MAAM,aAAa,GAAG,eAAe,MAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACR,GAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqB,GAAG,2BACtB,WAAW,QACX,OACA,QAAQ,IAAI,CAGI;AACpB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { RolldownPluginOption } from
|
|
1
|
+
import type { RolldownPluginOption } from 'rolldown';
|
|
2
2
|
type Props = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exclude?: string | string[];
|
|
4
|
+
include?: Record<string, string>;
|
|
5
|
+
declarationMap?: boolean;
|
|
6
|
+
dir?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const typescript: ({ exclude, include, declarationMap, dir }?: Props) => RolldownPluginOption;
|
|
8
|
+
export declare const typescript: ({ exclude, include, declarationMap, dir, }?: Props) => RolldownPluginOption;
|
|
9
9
|
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { toArray } from "../../utils/array.js";
|
|
2
2
|
import "../constants.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { globSync } from "glob";
|
|
7
|
-
import { transformSync } from "oxc-transform";
|
|
3
|
+
import { readTsConfig } from "./typescript.config.js";
|
|
4
|
+
import { existsSync } from "fs";
|
|
5
|
+
import ts from "@typescript/typescript6";
|
|
8
6
|
import { replaceTscAliasPaths } from "tsc-alias";
|
|
9
7
|
//#region src/rolldown-config/plugins/typescript.ts
|
|
10
8
|
const typescript = ({ exclude, include, declarationMap, dir } = {}) => {
|
|
@@ -20,46 +18,34 @@ const typescript = ({ exclude, include, declarationMap, dir } = {}) => {
|
|
|
20
18
|
async handler() {
|
|
21
19
|
if (done) return;
|
|
22
20
|
const cwd = process.cwd();
|
|
23
|
-
const tsconfigPath = findConfigFile(cwd, "tsconfig.json");
|
|
21
|
+
const tsconfigPath = ts.findConfigFile(cwd, existsSync, "tsconfig.json");
|
|
24
22
|
const configFile = readTsConfig(tsconfigPath);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const relativePath = relative(rootDir, file);
|
|
39
|
-
let dtsName = relativePath;
|
|
40
|
-
if (relativePath.endsWith(".tsx")) dtsName = relativePath.slice(0, -4) + ".d.ts";
|
|
41
|
-
else if (relativePath.endsWith(".ts")) dtsName = relativePath.slice(0, -3) + ".d.ts";
|
|
42
|
-
else if (relativePath.endsWith(".cts")) dtsName = relativePath.slice(0, -4) + ".d.cts";
|
|
43
|
-
else if (relativePath.endsWith(".mts")) dtsName = relativePath.slice(0, -4) + ".d.mts";
|
|
44
|
-
const outPath = join(outDir, dtsName);
|
|
45
|
-
const outMapPath = outPath + ".map";
|
|
46
|
-
mkdirSync(dirname(outPath), { recursive: true });
|
|
47
|
-
let dtsCode = result.declaration ?? "";
|
|
48
|
-
if (declarationMap && result.declarationMap) {
|
|
49
|
-
dtsCode += `\n//# sourceMappingURL=${basename(dtsName)}.map\n`;
|
|
50
|
-
writeFileSync(outMapPath, JSON.stringify(result.declarationMap), "utf-8");
|
|
23
|
+
const host = ts.createCompilerHost(configFile.options);
|
|
24
|
+
const outDir = configFile.options.outDir ?? dir ?? "lib";
|
|
25
|
+
const parsed = ts.parseJsonConfigFileContent({
|
|
26
|
+
...configFile,
|
|
27
|
+
include,
|
|
28
|
+
exclude: [...toArray(exclude), "*.ts"],
|
|
29
|
+
compilerOptions: {
|
|
30
|
+
...configFile.options,
|
|
31
|
+
outDir,
|
|
32
|
+
noEmit: false,
|
|
33
|
+
emitDeclarationOnly: true,
|
|
34
|
+
declaration: true,
|
|
35
|
+
declarationMap
|
|
51
36
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
37
|
+
}, ts.sys, cwd);
|
|
38
|
+
const program = ts.createProgram(parsed.fileNames, {
|
|
39
|
+
...configFile.options,
|
|
40
|
+
outDir,
|
|
41
|
+
noEmit: false,
|
|
42
|
+
emitDeclarationOnly: true,
|
|
43
|
+
declaration: true,
|
|
44
|
+
declarationMap
|
|
45
|
+
}, host);
|
|
46
|
+
const emitResult = program.emit();
|
|
47
|
+
const errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).filter((d) => d.category === ts.DiagnosticCategory.Error);
|
|
48
|
+
if (errors.length > 0) console.error(ts.formatDiagnosticsWithColorAndContext(errors, host));
|
|
63
49
|
await replaceTscAliasPaths({
|
|
64
50
|
configFile: tsconfigPath,
|
|
65
51
|
outDir
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\n\nimport ts from '@typescript/typescript6';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;AAkBA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,GAAG,eACtB,KACA,YACA,eACF;IAEA,MAAM,aAAa,aAAa,YAAY;IAC5C,MAAM,OAAO,GAAG,mBAAmB,WAAW,OAAO;IACrD,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAE5C,MAAM,SAAS,GAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAG,QAAQ,OAAO,GAAG,MAAM;KACrC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;KACF;IACF,GACA,GAAG,KACH,GACF;IAEA,MAAM,UAAU,GAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;IACF,GACA,IACF;IAEA,MAAM,aAAa,QAAQ,KAAK;IAEhC,MAAM,SAAS,GACZ,sBAAsB,OAAO,CAAC,CAC9B,OAAO,WAAW,WAAW,CAAC,CAC9B,QAAO,MAAK,EAAE,aAAa,GAAG,mBAAmB,KAAK;IAEzD,IAAI,OAAO,SAAS,GAClB,QAAQ,MACN,GAAG,qCAAqC,QAAQ,IAAI,CACtD;IAGF,MAAM,qBAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { RolldownPluginOption, RolldownOptions } from
|
|
1
|
+
import type { RolldownPluginOption, RolldownOptions } from 'rolldown';
|
|
2
2
|
export type { RolldownOptions };
|
|
3
|
-
import type { PLUGIN_BUILDERS } from
|
|
3
|
+
import type { PLUGIN_BUILDERS } from './plugins';
|
|
4
4
|
export type ToArray_F = <T>(value?: T | T[]) => T[];
|
|
5
5
|
export type Params = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
circularDeps?: string | string[];
|
|
7
|
+
excludesTS?: string | string[];
|
|
8
|
+
ignoresJS?: string | string[];
|
|
9
|
+
externals?: string | string[];
|
|
10
|
+
dir?: string;
|
|
11
|
+
sourcemap?: boolean;
|
|
12
|
+
declarationMap?: boolean;
|
|
13
|
+
plugins?: (RolldownPluginOption | keyof typeof PLUGIN_BUILDERS)[];
|
|
14
14
|
};
|
|
15
15
|
export type BuildInput_F = (...ignores: string[]) => Record<string, string>;
|
|
16
16
|
export type Config_F = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
(additionals?: Params): RolldownOptions;
|
|
18
|
+
bemedev: (additionals?: Params) => RolldownOptions;
|
|
19
|
+
default: (additionals?: Params) => RolldownOptions;
|
|
20
20
|
};
|
package/lib/utils/array.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ToArray_F } from
|
|
1
|
+
import type { ToArray_F } from './types';
|
|
2
2
|
export declare const toArray: ToArray_F;
|
package/lib/utils/identity.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const identity:
|
|
1
|
+
export declare const identity: <T>(x: T) => T;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from './identity';
|
|
2
|
+
export * from './sleep';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './array';
|
package/lib/utils/sleep.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const sleep: unknown
|
|
1
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './vitest';
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { Plugin } from
|
|
1
|
+
import type { Plugin } from 'vitest/config';
|
|
2
2
|
export type Define<T> = Exclude<T, undefined>;
|
|
3
|
-
export type Args = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export type Args = [
|
|
4
|
+
{
|
|
5
|
+
patternTest: string | string[];
|
|
6
|
+
patternCov: string | string[];
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
ignoreTestFiles?: string[];
|
|
10
|
+
ignoreCoverageFiles?: string[];
|
|
11
|
+
}
|
|
12
|
+
];
|
|
10
13
|
export type WithPattern = (...args: Args) => Plugin;
|
|
@@ -32,7 +32,6 @@ create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles,
|
|
|
32
32
|
function exclude(args = {}) {
|
|
33
33
|
return {
|
|
34
34
|
name: require_vitest_exclude_constants.name,
|
|
35
|
-
enforce: "pre",
|
|
36
35
|
config: async (options) => {
|
|
37
36
|
const root = options?.root ?? process.cwd();
|
|
38
37
|
const testConfig = options?.test;
|
|
@@ -71,7 +70,6 @@ function exclude(args = {}) {
|
|
|
71
70
|
exclude.withPattern = (({ patternTest, patternCov }, { ignoreCoverageFiles, ignoreTestFiles }) => {
|
|
72
71
|
return {
|
|
73
72
|
name: require_vitest_exclude_constants.name,
|
|
74
|
-
enforce: "pre",
|
|
75
73
|
config: async (options) => {
|
|
76
74
|
const root = options?.root ?? process.cwd();
|
|
77
75
|
const testConfig = options?.test;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns An object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @remarks You don't have to use test.exclude. The default search pattern is : './src/**\\/*.ts'\n * @param ignore Globs to exclude inside\n * @returns A vitest config\n * @see {@link exclude.withPattern}\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n
|
|
1
|
+
{"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns An object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @remarks You don't have to use test.exclude. The default search pattern is : './src/**\\/*.ts'\n * @param ignore Globs to exclude inside\n * @returns A vitest config\n * @see {@link exclude.withPattern}\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const patternCov = defaultCovPattern(root);\n const patternTest = testPattern(root);\n\n const { ignoreCoverageFiles, ignoreTestFiles } = args;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n } as Plugin;\n}\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param pattern The pattern where searching files\n * @param ignore Globs to exclude inside\n * @returns A vitest config\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;AAgBA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAaA,oCAAAA,YAAY,IAAI;EAC7B,YAAYC,oCAAAA,kBAAkB,IAAI;CACpC;CAEA,OAAO,OAAO,YAAY,QAAQ,MAAM,IAAI;AAC9C;AAEA,OAAO,cAAc,OACnB,EAAE,aAAa,eAAiC,CAAC,GACjD,EAAE,iBAAiB,wBAAiC,CAAC,GACrD,SACG;CAWH,OAAO;EAAE,OAAA,MAVWC,oCAAAA,aAClB,eAAeF,oCAAAA,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALOE,oCAAAA,aACrB,cAAcD,oCAAAA,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;;AAUA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;EACL,MAAA,iCAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAaA,oCAAAA,kBAAkB,IAAI;GACzC,MAAM,cAAcD,oCAAAA,YAAY,IAAI;GAEpC,MAAM,EAAE,qBAAqB,oBAAoB;GAEjD,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF;;;;;;;;AASA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACL,MAAA,iCAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF"}
|
|
@@ -1,18 +1,30 @@
|
|
|
1
|
-
import type { Plugin } from
|
|
2
|
-
import type { Args } from
|
|
1
|
+
import type { Plugin } from 'vitest/config';
|
|
2
|
+
import type { Args, WithPattern } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Create includeTest and includeCoverage arrays from glob patterns
|
|
5
|
-
*
|
|
6
|
-
* @param args Globs to ignore for test and coverage files
|
|
7
|
-
* @returns An object with includeTest and includeCoverage string arrays
|
|
8
|
-
*/
|
|
9
|
-
export declare function create(args?: Args[1], root?: string)
|
|
4
|
+
* Create includeTest and includeCoverage arrays from glob patterns
|
|
5
|
+
*
|
|
6
|
+
* @param args Globs to ignore for test and coverage files
|
|
7
|
+
* @returns An object with includeTest and includeCoverage string arrays
|
|
8
|
+
*/
|
|
9
|
+
export declare function create(args?: Args[1], root?: string): Promise<{
|
|
10
|
+
files: string[];
|
|
11
|
+
coverage: string[];
|
|
12
|
+
}>;
|
|
13
|
+
export declare namespace create {
|
|
14
|
+
var withPattern: ({ patternTest, patternCov }?: Partial<Args[0]>, { ignoreTestFiles, ignoreCoverageFiles }?: Args[1], root?: string) => Promise<{
|
|
15
|
+
files: string[];
|
|
16
|
+
coverage: string[];
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
|
-
* Plugin to add files with glob patterns to vitest
|
|
12
|
-
*
|
|
13
|
-
* @remarks You don't have to use test.exclude. The default search pattern is : './src/**\/*.ts'
|
|
14
|
-
* @param ignore Globs to exclude inside
|
|
15
|
-
* @returns A vitest config
|
|
16
|
-
* @see {@link exclude.withPattern}
|
|
17
|
-
*/
|
|
20
|
+
* Plugin to add files with glob patterns to vitest
|
|
21
|
+
*
|
|
22
|
+
* @remarks You don't have to use test.exclude. The default search pattern is : './src/**\/*.ts'
|
|
23
|
+
* @param ignore Globs to exclude inside
|
|
24
|
+
* @returns A vitest config
|
|
25
|
+
* @see {@link exclude.withPattern}
|
|
26
|
+
*/
|
|
18
27
|
export declare function exclude(args?: Args[1]): Plugin;
|
|
28
|
+
export declare namespace exclude {
|
|
29
|
+
var withPattern: WithPattern;
|
|
30
|
+
}
|
|
@@ -31,7 +31,6 @@ create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles,
|
|
|
31
31
|
function exclude(args = {}) {
|
|
32
32
|
return {
|
|
33
33
|
name,
|
|
34
|
-
enforce: "pre",
|
|
35
34
|
config: async (options) => {
|
|
36
35
|
const root = options?.root ?? process.cwd();
|
|
37
36
|
const testConfig = options?.test;
|
|
@@ -70,7 +69,6 @@ function exclude(args = {}) {
|
|
|
70
69
|
exclude.withPattern = (({ patternTest, patternCov }, { ignoreCoverageFiles, ignoreTestFiles }) => {
|
|
71
70
|
return {
|
|
72
71
|
name,
|
|
73
|
-
enforce: "pre",
|
|
74
72
|
config: async (options) => {
|
|
75
73
|
const root = options?.root ?? process.cwd();
|
|
76
74
|
const testConfig = options?.test;
|