@bleedingdev/modern-js-server 3.2.0-ultramodern.0 → 3.2.0-ultramodern.1
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.
- package/package.json +7 -7
- package/dist/types/createDevServer.d.ts +0 -8
- package/dist/types/dev-tools/https/index.d.ts +0 -6
- package/dist/types/dev-tools/watcher/dependencyTree.d.ts +0 -28
- package/dist/types/dev-tools/watcher/index.d.ts +0 -17
- package/dist/types/dev-tools/watcher/statsCache.d.ts +0 -10
- package/dist/types/dev.d.ts +0 -9
- package/dist/types/helpers/devOptions.d.ts +0 -11
- package/dist/types/helpers/fileReader.d.ts +0 -3
- package/dist/types/helpers/index.d.ts +0 -15
- package/dist/types/helpers/mock.d.ts +0 -16
- package/dist/types/helpers/repack.d.ts +0 -2
- package/dist/types/helpers/utils.d.ts +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/types.d.ts +0 -56
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.2.0-ultramodern.
|
|
20
|
+
"version": "3.2.0-ultramodern.1",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"main": "./dist/cjs/index.js",
|
|
23
23
|
"exports": {
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"minimatch": "^10.2.5",
|
|
47
47
|
"path-to-regexp": "^8.4.2",
|
|
48
48
|
"ws": "^8.20.1",
|
|
49
|
-
"@modern-js/server-
|
|
50
|
-
"@modern-js/
|
|
51
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.
|
|
52
|
-
"@modern-js/
|
|
53
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.
|
|
49
|
+
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.2.0-ultramodern.1",
|
|
50
|
+
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.2.0-ultramodern.1",
|
|
51
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.1",
|
|
52
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.1",
|
|
53
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@rslib/core": "0.21.5",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"node-mocks-http": "^1.17.2",
|
|
62
62
|
"tsconfig-paths": "4.2.0",
|
|
63
63
|
"websocket": "^1.0.35",
|
|
64
|
-
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.2.0-ultramodern.
|
|
64
|
+
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.2.0-ultramodern.1",
|
|
65
65
|
"@scripts/rstest-config": "2.66.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ApplyPlugins, ModernDevServerOptions } from './types';
|
|
2
|
-
export declare function createDevServer(options: ModernDevServerOptions, applyPlugins: ApplyPlugins): Promise<{
|
|
3
|
-
server: (import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse> | import("node:https").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse> | import("node:http2").Http2SecureServer<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse, typeof import("node:http2").Http2ServerRequest, typeof import("node:http2").Http2ServerResponse>) & {
|
|
4
|
-
getRequestListener: () => ReturnType<(handler: import("@modern-js/server-core/dist/types/types").RequestHandler) => (req: import("@modern-js/types/server").NodeRequest, res: import("@modern-js/types/server").NodeResponse) => Promise<void>>;
|
|
5
|
-
getRequestHandler: () => import("@modern-js/server-core/dist/types/types").RequestHandler;
|
|
6
|
-
};
|
|
7
|
-
afterListen: () => Promise<void>;
|
|
8
|
-
}>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare const defaultIgnores: string[];
|
|
2
|
-
export interface DependencyTreeOptions {
|
|
3
|
-
root: string;
|
|
4
|
-
ignore?: string[];
|
|
5
|
-
}
|
|
6
|
-
export interface TreeNode {
|
|
7
|
-
module: NodeModule;
|
|
8
|
-
parent: Set<TreeNode>;
|
|
9
|
-
children: Set<TreeNode>;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* `require.cache` already is a dependency tree, however require cache's
|
|
13
|
-
* `module.parent` is the module that first required. so we have to implement
|
|
14
|
-
* a new tree which revisit the cache tree to find all parent node
|
|
15
|
-
*/
|
|
16
|
-
export declare class DependencyTree {
|
|
17
|
-
private readonly tree;
|
|
18
|
-
private readonly ignore;
|
|
19
|
-
constructor();
|
|
20
|
-
getNode(path: string): TreeNode | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* update dependency tree
|
|
23
|
-
*
|
|
24
|
-
* @param cache
|
|
25
|
-
*/
|
|
26
|
-
update(cache: any): void;
|
|
27
|
-
private shouldIgnore;
|
|
28
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type FSWatcher, type WatchOptions } from '@modern-js/utils';
|
|
2
|
-
export type WatchEvent = 'add' | 'change' | 'unlink';
|
|
3
|
-
export declare const defaultWatchOptions: {
|
|
4
|
-
ignoreInitial: boolean;
|
|
5
|
-
ignored: RegExp;
|
|
6
|
-
};
|
|
7
|
-
export declare const getWatchedFiles: (watcher: FSWatcher) => string[];
|
|
8
|
-
export declare const mergeWatchOptions: (options?: WatchOptions) => WatchOptions;
|
|
9
|
-
export default class Watcher {
|
|
10
|
-
private dependencyTree;
|
|
11
|
-
private watcher;
|
|
12
|
-
listen(files: string[], options: WatchOptions, callback: (changed: string, event: WatchEvent) => void): void;
|
|
13
|
-
createDepTree(): void;
|
|
14
|
-
updateDepTree(): void;
|
|
15
|
-
cleanDepCache(filepath: string): void;
|
|
16
|
-
close(): Promise<void>;
|
|
17
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class StatsCache {
|
|
2
|
-
private readonly cachedHash;
|
|
3
|
-
private readonly cachedSize;
|
|
4
|
-
add(files: string[]): void;
|
|
5
|
-
refresh(filename: string): void;
|
|
6
|
-
del(filename: string): void;
|
|
7
|
-
isDiff(filename: string): boolean;
|
|
8
|
-
has(filename: string): boolean;
|
|
9
|
-
private hash;
|
|
10
|
-
}
|
package/dist/types/dev.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BuilderInstance, Rspack } from '@modern-js/builder';
|
|
2
|
-
import type { ServerBaseOptions, ServerPlugin } from '@modern-js/server-core';
|
|
3
|
-
import type { ModernDevServerOptions } from './types';
|
|
4
|
-
type BuilderDevServer = Awaited<ReturnType<BuilderInstance['createDevServer']>>;
|
|
5
|
-
export type DevPluginOptions = ModernDevServerOptions<ServerBaseOptions> & {
|
|
6
|
-
builderDevServer?: BuilderDevServer;
|
|
7
|
-
};
|
|
8
|
-
export declare const devPlugin: (options: DevPluginOptions, compiler: Rspack.Compiler | Rspack.MultiCompiler | null) => ServerPlugin;
|
|
9
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { BuilderInstance } from '@modern-js/builder';
|
|
2
|
-
import type { DevServerOptions } from '../types';
|
|
3
|
-
export declare const getDevOptions: (devOptions: DevServerOptions) => {
|
|
4
|
-
setupMiddlewares?: Array<(middlewares: {
|
|
5
|
-
unshift: (...handlers: import("@modern-js/types/server").RequestHandler[]) => void;
|
|
6
|
-
push: (...handlers: import("@modern-js/types/server").RequestHandler[]) => void;
|
|
7
|
-
}, server: import("@modern-js/types/server").ExposeServerApis) => void>;
|
|
8
|
-
https?: import("@modern-js/types/server/devServer").DevServerHttpsOptions;
|
|
9
|
-
server?: import("../types").DevServerConfig;
|
|
10
|
-
};
|
|
11
|
-
export declare const getDevAssetPrefix: (builder?: BuilderInstance) => Promise<string>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type ServerBase } from '@modern-js/server-core';
|
|
2
|
-
import { type WatchOptions } from '@modern-js/utils';
|
|
3
|
-
import Watcher from '../dev-tools/watcher';
|
|
4
|
-
export * from './devOptions';
|
|
5
|
-
export * from './fileReader';
|
|
6
|
-
export * from './mock';
|
|
7
|
-
export * from './repack';
|
|
8
|
-
export declare function startWatcher({ pwd, distDir, apiDir, sharedDir, watchOptions, server, }: {
|
|
9
|
-
pwd: string;
|
|
10
|
-
distDir: string;
|
|
11
|
-
apiDir: string;
|
|
12
|
-
sharedDir: string;
|
|
13
|
-
watchOptions?: WatchOptions;
|
|
14
|
-
server: ServerBase;
|
|
15
|
-
}): Watcher;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type InternalRequest, type Middleware } from '@modern-js/server-core';
|
|
2
|
-
import type { NextFunction } from '@modern-js/types';
|
|
3
|
-
import type { NodeRequest, NodeResponse } from '@modern-js/types/server';
|
|
4
|
-
/** Types: Mock */
|
|
5
|
-
type MockHandler = {
|
|
6
|
-
data: any;
|
|
7
|
-
} | ((req: NodeRequest, res: NodeResponse, next: NextFunction) => Promise<void> | void);
|
|
8
|
-
type MockAPI = {
|
|
9
|
-
method: string;
|
|
10
|
-
path: string;
|
|
11
|
-
handler: MockHandler;
|
|
12
|
-
};
|
|
13
|
-
export declare const getMatched: (request: InternalRequest, mockApis: MockAPI[]) => MockAPI | undefined;
|
|
14
|
-
export declare function initOrUpdateMockMiddlewares(pwd: string): Promise<void>;
|
|
15
|
-
export declare function getMockMiddleware(pwd: string): Promise<Middleware>;
|
|
16
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const debug: import("@modern-js/utils/compiled/debug").Debugger;
|
package/dist/types/index.d.ts
DELETED
package/dist/types/types.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { Server as NodeServer } from 'node:http';
|
|
2
|
-
import type { Http2SecureServer } from 'node:http2';
|
|
3
|
-
import type { BuilderInstance } from '@modern-js/builder';
|
|
4
|
-
import type { ServerBase, ServerBaseOptions, ServerPlugin } from '@modern-js/server-core';
|
|
5
|
-
import type { DevServerHttpsOptions, ExposeServerApis, RequestHandler } from '@modern-js/types';
|
|
6
|
-
export type { DevServerHttpsOptions };
|
|
7
|
-
type StaticOrigin = boolean | string | RegExp | Array<boolean | string | RegExp>;
|
|
8
|
-
type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
|
|
9
|
-
export interface CorsOptions {
|
|
10
|
-
/**
|
|
11
|
-
* @default '*''
|
|
12
|
-
*/
|
|
13
|
-
origin?: StaticOrigin | CustomOrigin | undefined;
|
|
14
|
-
}
|
|
15
|
-
export interface DevServerConfig {
|
|
16
|
-
/**
|
|
17
|
-
* Configure CORS for the dev server.
|
|
18
|
-
* - object: enable CORS with the specified options.
|
|
19
|
-
* - true: enable CORS with default options (allow all origins, not recommended).
|
|
20
|
-
* - false: disable CORS.
|
|
21
|
-
* @default
|
|
22
|
-
* ```js
|
|
23
|
-
* { origin: defaultAllowedOrigins }
|
|
24
|
-
* ```
|
|
25
|
-
* where `defaultAllowedOrigins` includes:
|
|
26
|
-
* - `localhost`
|
|
27
|
-
* - `127.0.0.1`
|
|
28
|
-
*
|
|
29
|
-
* @link https://github.com/expressjs/cors
|
|
30
|
-
*/
|
|
31
|
-
cors?: boolean | CorsOptions;
|
|
32
|
-
}
|
|
33
|
-
export type DevServerOptions = {
|
|
34
|
-
/** Provides the ability to execute a custom function and apply custom middlewares */
|
|
35
|
-
setupMiddlewares?: Array<(
|
|
36
|
-
/** Order: `devServer.before` => `unshift` => internal middlewares => `push` => `devServer.after` */
|
|
37
|
-
middlewares: {
|
|
38
|
-
/** Use the `unshift` method if you want to run a middleware before all other middlewares */
|
|
39
|
-
unshift: (...handlers: RequestHandler[]) => void;
|
|
40
|
-
/** Use the `push` method if you want to run a middleware after all other middlewares */
|
|
41
|
-
push: (...handlers: RequestHandler[]) => void;
|
|
42
|
-
}, server: ExposeServerApis) => void>;
|
|
43
|
-
/** Whether to enable hot reload. */
|
|
44
|
-
https?: DevServerHttpsOptions;
|
|
45
|
-
/** Dev server specific options. */
|
|
46
|
-
server?: DevServerConfig;
|
|
47
|
-
};
|
|
48
|
-
export type ExtraOptions = {
|
|
49
|
-
dev: DevServerOptions;
|
|
50
|
-
runCompile?: boolean;
|
|
51
|
-
serverConfigPath: string;
|
|
52
|
-
builder?: BuilderInstance;
|
|
53
|
-
plugins?: ServerPlugin[];
|
|
54
|
-
};
|
|
55
|
-
export type ModernDevServerOptions<O extends ServerBaseOptions = ServerBaseOptions> = O & ExtraOptions;
|
|
56
|
-
export type ApplyPlugins<O extends ServerBaseOptions = ServerBaseOptions> = (server: ServerBase, options: ModernDevServerOptions<O>, nodeServer?: NodeServer | Http2SecureServer) => Promise<void>;
|