@atlaspack/reporter-dev-server 2.14.21-typescript-b27501580.0 → 2.14.21-typescript-5b4d3ad41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ import type { Asset, BundleGraph, NamedBundle, PackagedBundle, PluginOptions } from '@atlaspack/types';
2
+ import type { Diagnostic } from '@atlaspack/diagnostic';
3
+ import type { AnsiDiagnosticResult } from '@atlaspack/utils';
4
+ import type { ServerError, HMRServerOptions, Request, Response } from './types.js.flow';
5
+ import WebSocket from 'ws';
6
+ export type SetComplement<A, B extends A> = A extends B ? never : A;
7
+ export type Diff<T extends U, U extends object> = Pick<T, SetComplement<keyof T, keyof U>>;
8
+ export type HMRAsset = {
9
+ id: string;
10
+ url: string;
11
+ type: string;
12
+ output: string;
13
+ envHash: string;
14
+ outputFormat: string;
15
+ depsByBundle: {
16
+ [key: string]: {
17
+ [key: string]: string;
18
+ };
19
+ };
20
+ };
21
+ export type HMRMessage = {
22
+ type: 'update';
23
+ assets: Array<HMRAsset>;
24
+ } | {
25
+ type: 'reload';
26
+ } | {
27
+ type: 'error';
28
+ diagnostics: {
29
+ ansi: Array<AnsiDiagnosticResult>;
30
+ html: Array<Partial<Diff<AnsiDiagnosticResult, {
31
+ codeframe: string;
32
+ }>>>;
33
+ };
34
+ };
35
+ export default class HMRServer {
36
+ wss: WebSocket.Server;
37
+ unresolvedError: HMRMessage | null;
38
+ options: HMRServerOptions;
39
+ bundleGraph: BundleGraph<PackagedBundle> | BundleGraph<NamedBundle> | null;
40
+ stopServer: (() => Promise<void>) | null | undefined;
41
+ constructor(options: HMRServerOptions);
42
+ start(): Promise<void>;
43
+ handle(req: Request, res: Response): boolean;
44
+ stop(): Promise<void>;
45
+ emitError(options: PluginOptions, diagnostics: Array<Diagnostic>): Promise<void>;
46
+ emitUpdate(event: {
47
+ readonly bundleGraph: BundleGraph<PackagedBundle> | BundleGraph<NamedBundle>;
48
+ readonly changedAssets: Map<string, Asset>;
49
+ }): Promise<void>;
50
+ getHotAssetContents(asset: Asset): Promise<string>;
51
+ getSourceURL(asset: Asset): string;
52
+ handleSocketError(err: ServerError): void;
53
+ broadcast(msg: HMRMessage): void;
54
+ }
@@ -0,0 +1,45 @@
1
+ import type { DevServerOptions, Request, Response } from './types.js.flow';
2
+ import type { BuildSuccessEvent, BundleGraph, FilePath, PluginOptions, PackagedBundle } from '@atlaspack/types';
3
+ import type { Diagnostic } from '@atlaspack/diagnostic';
4
+ import type { FileSystem } from '@atlaspack/fs';
5
+ import type { HTTPServer, FormattedCodeFrame } from '@atlaspack/utils';
6
+ export declare function setHeaders(res: Response): void;
7
+ export declare const SOURCES_ENDPOINT = "/__parcel_source_root";
8
+ type NextFunction = (req: Request, res: Response, next?: (arg1?: any) => any) => any;
9
+ export default class Server {
10
+ pending: boolean;
11
+ pendingRequests: Array<[Request, Response]>;
12
+ middleware: Array<(req: Request, res: Response) => boolean>;
13
+ options: DevServerOptions;
14
+ rootPath: string;
15
+ bundleGraph: BundleGraph<PackagedBundle> | null;
16
+ requestBundle: ((bundle: PackagedBundle) => Promise<BuildSuccessEvent>) | null | undefined;
17
+ errors: Array<{
18
+ message: string;
19
+ stack: string | null | undefined;
20
+ frames: Array<FormattedCodeFrame>;
21
+ hints: Array<string>;
22
+ documentation: string;
23
+ }> | null;
24
+ stopServer: (() => Promise<void>) | null | undefined;
25
+ constructor(options: DevServerOptions);
26
+ buildStart(): void;
27
+ buildSuccess(bundleGraph: BundleGraph<PackagedBundle>, requestBundle: (bundle: PackagedBundle) => Promise<BuildSuccessEvent>): void;
28
+ buildError(options: PluginOptions, diagnostics: Array<Diagnostic>): Promise<void>;
29
+ respond(req: Request, res: Response): unknown;
30
+ sendIndex(req: Request, res: Response): void;
31
+ serveBundle(req: Request, res: Response, next: NextFunction): Promise<void>;
32
+ serveDist(req: Request, res: Response, next: NextFunction): Promise<undefined> | Promise<unknown>;
33
+ serve(fs: FileSystem, root: FilePath, req: Request, res: Response, next: NextFunction): Promise<unknown>;
34
+ sendError(res: Response, statusCode: number): void;
35
+ send404(req: Request, res: Response): void;
36
+ send500(req: Request, res: Response): undefined | Response;
37
+ logAccessIfVerbose(req: Request): void;
38
+ /**
39
+ * Load proxy table from package.json and apply them.
40
+ */
41
+ applyProxyTable(app: any): Promise<Server>;
42
+ start(): Promise<HTTPServer>;
43
+ stop(): Promise<void>;
44
+ }
45
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Reporter } from '@atlaspack/plugin';
2
+ declare const _default: Reporter;
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export type ServerError = Error & {
2
+ code: string;
3
+ };
4
+ export default function serverErrors(err: ServerError, port: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/reporter-dev-server",
3
- "version": "2.14.21-typescript-b27501580.0",
3
+ "version": "2.14.21-typescript-5b4d3ad41.0",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "type": "commonjs",
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@atlaspack/plugin": "2.14.21-typescript-b27501580.0",
30
- "@atlaspack/types": "2.15.11-typescript-b27501580.0",
31
- "@atlaspack/utils": "2.17.3-typescript-b27501580.0",
29
+ "@atlaspack/plugin": "2.14.21-typescript-5b4d3ad41.0",
30
+ "@atlaspack/types": "2.15.11-typescript-5b4d3ad41.0",
31
+ "@atlaspack/utils": "2.17.3-typescript-5b4d3ad41.0",
32
32
  "connect": "^3.7.0",
33
33
  "ejs": "^3.1.6",
34
34
  "fresh": "^0.5.2",
@@ -40,10 +40,10 @@
40
40
  "ws": "^7.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@atlaspack/babel-preset": "2.14.2-typescript-b27501580.0"
43
+ "@atlaspack/babel-preset": "2.14.2-typescript-5b4d3ad41.0"
44
44
  },
45
45
  "scripts": {
46
46
  "check-ts": "tsc --emitDeclarationOnly --rootDir src"
47
47
  },
48
- "gitHead": "b275015805a058452afb6fb48c078ecd4de925f2"
48
+ "gitHead": "5b4d3ad41ffa002b989ba77271bb3010a1f05b2a"
49
49
  }