Convert @babel/helper-fixtures to typescript (#12922)
This commit is contained in:
parent
d05fdbc3c7
commit
a653b9c08e
@ -17,5 +17,9 @@
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.19",
|
||||
"semver": "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash": "^4.14.150",
|
||||
"@types/semver": "^7.3.4"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,31 +5,34 @@ import fs from "fs";
|
||||
|
||||
const nodeVersion = semver.clean(process.version.slice(1));
|
||||
|
||||
function humanize(val, noext) {
|
||||
function humanize(val, noext?) {
|
||||
if (noext) val = path.basename(val, path.extname(val));
|
||||
return val.replace(/-/g, " ");
|
||||
}
|
||||
|
||||
type TestFile = {
|
||||
loc: string,
|
||||
code: string,
|
||||
filename: string,
|
||||
loc: string;
|
||||
code: string;
|
||||
filename: string;
|
||||
};
|
||||
|
||||
type Test = {
|
||||
title: string,
|
||||
disabled: boolean,
|
||||
options: Object,
|
||||
exec: TestFile,
|
||||
actual: TestFile,
|
||||
expected: TestFile,
|
||||
title: string;
|
||||
disabled: boolean;
|
||||
options: any;
|
||||
exec: TestFile;
|
||||
actual: TestFile;
|
||||
expected: TestFile;
|
||||
// todo(flow->ts): improve types here
|
||||
sourceMappings;
|
||||
sourceMap;
|
||||
};
|
||||
|
||||
type Suite = {
|
||||
options: Object,
|
||||
tests: Array<Test>,
|
||||
title: string,
|
||||
filename: string,
|
||||
options: any;
|
||||
tests: Array<Test>;
|
||||
title: string;
|
||||
filename: string;
|
||||
};
|
||||
|
||||
function tryResolve(module) {
|
||||
@ -60,7 +63,7 @@ function shouldIgnore(name, ignore?: Array<string>) {
|
||||
|
||||
const EXTENSIONS = [".js", ".mjs", ".ts", ".tsx"];
|
||||
|
||||
function findFile(filepath: string, allowJSON: boolean) {
|
||||
function findFile(filepath: string, allowJSON?: boolean) {
|
||||
const matches = [];
|
||||
|
||||
for (const ext of EXTENSIONS.concat(allowJSON ? ".json" : [])) {
|
||||
@ -148,6 +151,9 @@ function pushTask(taskName, taskDir, suite, suiteName) {
|
||||
code: readFile(expectLoc),
|
||||
filename: expectLocAlias,
|
||||
},
|
||||
sourceMappings: undefined,
|
||||
sourceMap: undefined,
|
||||
inputSourceMap: undefined,
|
||||
};
|
||||
|
||||
delete taskOpts.BABEL_8_BREAKING;
|
||||
@ -293,7 +299,7 @@ function wrapPackagesArray(type, names, optionsDir) {
|
||||
* @returns {{}} options whose plugins/presets are resolved
|
||||
*/
|
||||
export function resolveOptionPluginOrPreset(
|
||||
options: {},
|
||||
options: any,
|
||||
optionsDir: string,
|
||||
): {} {
|
||||
if (options.plugins) {
|
||||
@ -520,6 +520,8 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@babel/helper-fixtures@workspace:packages/babel-helper-fixtures"
|
||||
dependencies:
|
||||
"@types/lodash": ^4.14.150
|
||||
"@types/semver": ^7.3.4
|
||||
lodash: ^4.17.19
|
||||
semver: "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0"
|
||||
languageName: unknown
|
||||
@ -4087,6 +4089,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/semver@npm:^7.3.4":
|
||||
version: 7.3.4
|
||||
resolution: "@types/semver@npm:7.3.4"
|
||||
checksum: 7e8588aa55ecb344eda6954674b83a3c568d97d478e70e4617bd3ab22902590ac416ccf2cea48b58fb2f0fbd80f9ad1896332c9b3c3189ffd24e4350ff22094a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/source-map@npm:^0.5.0":
|
||||
version: 0.5.2
|
||||
resolution: "@types/source-map@npm:0.5.2"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user