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