Unshare global types
Summary: This diff adds `types` fields on the compiler config for every project. This way we can make sure that for example node types and packages are not available in flipper-ui-core. Without an explicit types field, all types would be shared between all packages, and implicitly included into the compilation of everything. For the same reason `types/index.d.ts` has been removed, we want to be intentional on which types are being used in which package. This diff does most of the work, the next diff will fine tune the globals, and do some further cleanup. As an alternative solution I first tried a `nohoist: **/node_modules/types/**` and make sure every package list explicitly the types used in package json, which works but is much more error prone, as for example two different react types versions in two packages will cause the most unreadable compiler error due to the types not being shared and not literally the same. Reviewed By: lawrencelomax Differential Revision: D33124441 fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
af3757dcae
commit
5df34a337c
14
desktop/types/ansi-to-html.d.ts
vendored
14
desktop/types/ansi-to-html.d.ts
vendored
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
declare module 'ansi-to-html' {
|
||||
export default class Filter {
|
||||
toHtml: (input: string) => string;
|
||||
}
|
||||
}
|
||||
30
desktop/types/index.d.ts
vendored
30
desktop/types/index.d.ts
vendored
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
/// <reference path="JSONStream.d.ts" />
|
||||
/// <reference path="ReactDebounceRender.d.ts" />
|
||||
/// <reference path="XmlBeautifier.d.ts" />
|
||||
/// <reference path="adbkit-logcat.d.ts" />
|
||||
/// <reference path="adbkit.d.ts" />
|
||||
/// <reference path="ansi-to-html.d.ts" />
|
||||
/// <reference path="decompress-targz.d.ts" />
|
||||
/// <reference path="decompress-unzip.d.ts" />
|
||||
/// <reference path="download-tarball.d.ts" />
|
||||
/// <reference path="flipperGlobals.d.ts" />
|
||||
/// <reference path="jest-extensions.d.ts" />
|
||||
/// <reference path="json-format-highlight.d.ts" />
|
||||
/// <reference path="line-replace.d.ts" />
|
||||
/// <reference path="live-plugin-manager.d.ts" />
|
||||
/// <reference path="memoize-weak.d.ts" />
|
||||
/// <reference path="metro-cache.d.ts" />
|
||||
/// <reference path="metro-resolver.d.ts" />
|
||||
/// <reference path="metro.d.ts" />
|
||||
/// <reference path="nodejs.d.ts" />
|
||||
/// <reference path="npm-api.d.ts" />
|
||||
/// <reference path="openssl-wrapper.d.ts" />
|
||||
23
desktop/types/line-replace.d.ts
vendored
23
desktop/types/line-replace.d.ts
vendored
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
declare module 'line-replace' {
|
||||
export default function (args: {
|
||||
file: string;
|
||||
line: number;
|
||||
text: string;
|
||||
addNewLine: boolean;
|
||||
callback: (args: {
|
||||
file: string;
|
||||
line: number;
|
||||
replacedText: string;
|
||||
text: string;
|
||||
}) => void;
|
||||
}): void;
|
||||
}
|
||||
82
desktop/types/live-plugin-manager.d.ts
vendored
82
desktop/types/live-plugin-manager.d.ts
vendored
@@ -1,82 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export declare class PluginManager {
|
||||
constructor(options?: Partial<LivePluginManager.PluginManagerOptions>);
|
||||
install(
|
||||
name: string,
|
||||
version?: string,
|
||||
): Promise<LivePluginManager.IPluginInfo>;
|
||||
installFromPath(
|
||||
location: string,
|
||||
options?: {
|
||||
force: boolean;
|
||||
},
|
||||
): Promise<LivePluginManager.IPluginInfo>;
|
||||
|
||||
readonly options: LivePluginManager.PluginManagerOptions;
|
||||
}
|
||||
|
||||
declare namespace LivePluginManager {
|
||||
interface IPluginInfo {
|
||||
readonly mainFile: string;
|
||||
readonly location: string;
|
||||
readonly name: string;
|
||||
readonly version: string;
|
||||
readonly dependencies: {[name: string]: string};
|
||||
}
|
||||
|
||||
interface PluginSandbox {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
global?: NodeJS.Global;
|
||||
}
|
||||
|
||||
export interface NpmRegistryAuthToken {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface NpmRegistryAuthBasic {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface NpmRegistryConfig {
|
||||
auth?: NpmRegistryAuthToken | NpmRegistryAuthBasic;
|
||||
userAgent?: string;
|
||||
}
|
||||
|
||||
export interface GithubAuthUserToken {
|
||||
type: 'token';
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface GithubAuthBasic {
|
||||
type: 'basic';
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export type GithubAuth = GithubAuthUserToken | GithubAuthBasic;
|
||||
|
||||
interface PluginManagerOptions {
|
||||
cwd: string;
|
||||
pluginsPath: string;
|
||||
sandbox: PluginSandbox;
|
||||
npmRegistryUrl: string;
|
||||
npmRegistryConfig: NpmRegistryConfig;
|
||||
npmInstallMode: 'useCache' | 'noCache';
|
||||
requireCoreModules: boolean;
|
||||
hostRequire?: NodeRequire;
|
||||
ignoredDependencies: Array<string | RegExp>;
|
||||
staticDependencies: {[key: string]: any};
|
||||
githubAuthentication?: GithubAuth;
|
||||
lockWait: number;
|
||||
lockStale: number;
|
||||
}
|
||||
}
|
||||
17
desktop/types/nodejs.d.ts
vendored
17
desktop/types/nodejs.d.ts
vendored
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
declare module NodeJS {
|
||||
interface Global {
|
||||
window: Window | undefined;
|
||||
WebSocket: any;
|
||||
fetch: any;
|
||||
originalConsole: Console | undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user