Adding missing node modules

This commit is contained in:
Drew Heavner
2020-11-13 16:25:03 -05:00
parent ff34f681c1
commit 64ce3ed0eb
3915 changed files with 667176 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
// @flow
import type { Handler } from "gensync";
import type {
ConfigFile,
IgnoreFile,
RelativeConfig,
FilePackageData,
} from "./types";
import type { CallerMetadata } from "../validation/options";
export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };
// eslint-disable-next-line require-yield
export function* findConfigUpwards(
rootDir: string, // eslint-disable-line no-unused-vars
): Handler<string | null> {
return null;
}
// eslint-disable-next-line require-yield
export function* findPackageData(filepath: string): Handler<FilePackageData> {
return {
filepath,
directories: [],
pkg: null,
isPackage: false,
};
}
// eslint-disable-next-line require-yield
export function* findRelativeConfig(
pkgData: FilePackageData, // eslint-disable-line no-unused-vars
envName: string, // eslint-disable-line no-unused-vars
caller: CallerMetadata | void, // eslint-disable-line no-unused-vars
): Handler<RelativeConfig> {
return { pkg: null, config: null, ignore: null };
}
// eslint-disable-next-line require-yield
export function* findRootConfig(
dirname: string, // eslint-disable-line no-unused-vars
envName: string, // eslint-disable-line no-unused-vars
caller: CallerMetadata | void, // eslint-disable-line no-unused-vars
): Handler<ConfigFile | null> {
return null;
}
// eslint-disable-next-line require-yield
export function* loadConfig(
name: string,
dirname: string,
envName: string, // eslint-disable-line no-unused-vars
caller: CallerMetadata | void, // eslint-disable-line no-unused-vars
): Handler<ConfigFile> {
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
}
// eslint-disable-next-line require-yield
export function* resolveShowConfigPath(
dirname: string, // eslint-disable-line no-unused-vars
): Handler<string | null> {
return null;
}
export const ROOT_CONFIG_FILENAMES = [];
// eslint-disable-next-line no-unused-vars
export function resolvePlugin(name: string, dirname: string): string | null {
return null;
}
// eslint-disable-next-line no-unused-vars
export function resolvePreset(name: string, dirname: string): string | null {
return null;
}
export function loadPlugin(
name: string,
dirname: string,
): { filepath: string, value: mixed } {
throw new Error(
`Cannot load plugin ${name} relative to ${dirname} in a browser`,
);
}
export function loadPreset(
name: string,
dirname: string,
): { filepath: string, value: mixed } {
throw new Error(
`Cannot load preset ${name} relative to ${dirname} in a browser`,
);
}
+31
View File
@@ -0,0 +1,31 @@
// @flow
import typeof * as indexBrowserType from "./index-browser";
import typeof * as indexType from "./index";
// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of index-browser, since this file may be replaced at bundle time with index-browser.
((({}: any): $Exact<indexBrowserType>): $Exact<indexType>);
export { findPackageData } from "./package";
export {
findConfigUpwards,
findRelativeConfig,
findRootConfig,
loadConfig,
resolveShowConfigPath,
ROOT_CONFIG_FILENAMES,
} from "./configuration";
export type {
ConfigFile,
IgnoreFile,
RelativeConfig,
FilePackageData,
} from "./types";
export {
resolvePlugin,
resolvePreset,
loadPlugin,
loadPreset,
} from "./plugins";
+29
View File
@@ -0,0 +1,29 @@
// @flow
// duplicated from transform-file so we do not have to import anything here
type TransformFile = {
(filename: string, callback: Function): void,
(filename: string, opts: ?Object, callback: Function): void,
};
export const transformFile: TransformFile = (function transformFile(
filename,
opts,
callback,
) {
if (typeof opts === "function") {
callback = opts;
}
callback(new Error("Transforming files is not supported in browsers"), null);
}: Function);
export function transformFileSync() {
throw new Error("Transforming files is not supported in browsers");
}
export function transformFileAsync() {
return Promise.reject(
new Error("Transforming files is not supported in browsers"),
);
}
+40
View File
@@ -0,0 +1,40 @@
// @flow
import gensync from "gensync";
import loadConfig, { type InputOptions, type ResolvedConfig } from "./config";
import {
run,
type FileResult,
type FileResultCallback,
} from "./transformation";
import * as fs from "./gensync-utils/fs";
import typeof * as transformFileBrowserType from "./transform-file-browser";
import typeof * as transformFileType from "./transform-file";
// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of transform-file-browser, since this file may be replaced at bundle time with
// transform-file-browser.
((({}: any): $Exact<transformFileBrowserType>): $Exact<transformFileType>);
type TransformFile = {
(filename: string, callback: FileResultCallback): void,
(filename: string, opts: ?InputOptions, callback: FileResultCallback): void,
};
const transformFileRunner = gensync<[string, ?InputOptions], FileResult | null>(
function* (filename, opts) {
const options = { ...opts, filename };
const config: ResolvedConfig | null = yield* loadConfig(options);
if (config === null) return null;
const code = yield* fs.readFile(filename, "utf8");
return yield* run(config, code);
},
);
export const transformFile: TransformFile = transformFileRunner.errback;
export const transformFileSync = transformFileRunner.sync;
export const transformFileAsync = transformFileRunner.async;