UNPKG

2.1 kBTypeScriptView Raw
1/// <reference types="expo__bunyan" />
2import type Log from '@expo/bunyan';
3import { MessageSocket } from '@expo/dev-server';
4import WebpackDevServer from 'webpack-dev-server';
5interface WebpackSettings {
6 url: string;
7 server: WebpackDevServer;
8 port: number;
9 protocol: 'http' | 'https';
10 host?: string;
11}
12declare type CLIWebOptions = {
13 dev?: boolean;
14 clear?: boolean;
15 pwa?: boolean;
16 nonInteractive?: boolean;
17 port?: number;
18 onWebpackFinished?: (error?: Error) => void;
19 forceManifestType?: 'classic' | 'expo-updates';
20};
21declare type BundlingOptions = {
22 dev?: boolean;
23 clear?: boolean;
24 port?: number;
25 pwa?: boolean;
26 isImageEditingEnabled?: boolean;
27 entryFile?: string;
28 platform?: string;
29 webpackEnv?: object;
30 mode?: 'development' | 'production' | 'test' | 'none';
31 https?: boolean;
32 nonInteractive?: boolean;
33 onWebpackFinished?: (error?: Error) => void;
34};
35export declare type WebEnvironment = {
36 projectRoot: string;
37 isImageEditingEnabled: boolean;
38 pwa: boolean;
39 mode: 'development' | 'production' | 'test' | 'none';
40 https: boolean;
41 logger: Log;
42 port?: number;
43 platform?: string;
44};
45export declare type WebpackDevServerResults = {
46 server: WebpackDevServer;
47 location: Omit<WebpackSettings, 'server'>;
48 messageSocket: MessageSocket;
49};
50export declare function broadcastMessage(message: 'reload' | string, data?: any): Promise<void>;
51export declare function startAsync(projectRoot: string, options?: CLIWebOptions): Promise<WebpackDevServerResults | null>;
52export declare function stopAsync(projectRoot: string): Promise<void>;
53export declare function bundleAsync(projectRoot: string, options?: BundlingOptions): Promise<void>;
54/**
55 * Get the URL for the running instance of Webpack dev server.
56 *
57 * @param projectRoot
58 */
59export declare function getUrlAsync(projectRoot: string): Promise<string | null>;
60export declare function openAsync(projectRoot: string): Promise<{
61 success: true;
62 url: string;
63} | {
64 success: false;
65 error: Error;
66}>;
67export {};