@callstack/repack-dev-server 5.0.0-next.2 → 5.0.0-rc.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +15 -3
  2. package/README.md +1 -1
  3. package/dist/createServer.d.ts +1 -2
  4. package/dist/createServer.js +11 -11
  5. package/dist/createServer.js.map +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/plugins/api/apiPlugin.js.map +1 -1
  8. package/dist/plugins/api/index.js.map +1 -1
  9. package/dist/plugins/compiler/compilerPlugin.js +16 -14
  10. package/dist/plugins/compiler/compilerPlugin.js.map +1 -1
  11. package/dist/plugins/compiler/index.js.map +1 -1
  12. package/dist/plugins/compiler/types.d.ts +4 -3
  13. package/dist/plugins/compiler/types.js.map +1 -1
  14. package/dist/plugins/devtools/devtoolsPlugin.js +1 -1
  15. package/dist/plugins/devtools/devtoolsPlugin.js.map +1 -1
  16. package/dist/plugins/devtools/index.js.map +1 -1
  17. package/dist/plugins/favicon/faviconPlugin.js +2 -2
  18. package/dist/plugins/favicon/faviconPlugin.js.map +1 -1
  19. package/dist/plugins/favicon/index.js.map +1 -1
  20. package/dist/plugins/multipart/index.js.map +1 -1
  21. package/dist/plugins/multipart/multipartPlugin.js +1 -1
  22. package/dist/plugins/multipart/multipartPlugin.js.map +1 -1
  23. package/dist/plugins/multipart/types.d.ts +1 -2
  24. package/dist/plugins/multipart/types.js.map +1 -1
  25. package/dist/plugins/symbolicate/Symbolicator.d.ts +1 -1
  26. package/dist/plugins/symbolicate/Symbolicator.js +6 -7
  27. package/dist/plugins/symbolicate/Symbolicator.js.map +1 -1
  28. package/dist/plugins/symbolicate/index.js.map +1 -1
  29. package/dist/plugins/symbolicate/sybmolicatePlugin.js.map +1 -1
  30. package/dist/plugins/symbolicate/types.d.ts +0 -1
  31. package/dist/plugins/symbolicate/types.js.map +1 -1
  32. package/dist/plugins/wss/WebSocketRouter.d.ts +1 -1
  33. package/dist/plugins/wss/WebSocketRouter.js.map +1 -1
  34. package/dist/plugins/wss/WebSocketServer.d.ts +4 -7
  35. package/dist/plugins/wss/WebSocketServer.js.map +1 -1
  36. package/dist/plugins/wss/WebSocketServerAdapter.d.ts +1 -4
  37. package/dist/plugins/wss/WebSocketServerAdapter.js +2 -2
  38. package/dist/plugins/wss/WebSocketServerAdapter.js.map +1 -1
  39. package/dist/plugins/wss/index.js.map +1 -1
  40. package/dist/plugins/wss/servers/WebSocketApiServer.d.ts +2 -2
  41. package/dist/plugins/wss/servers/WebSocketApiServer.js.map +1 -1
  42. package/dist/plugins/wss/servers/WebSocketDebuggerServer.d.ts +2 -3
  43. package/dist/plugins/wss/servers/WebSocketDebuggerServer.js.map +1 -1
  44. package/dist/plugins/wss/servers/WebSocketDevClientServer.d.ts +1 -1
  45. package/dist/plugins/wss/servers/WebSocketDevClientServer.js.map +1 -1
  46. package/dist/plugins/wss/servers/WebSocketEventsServer.d.ts +2 -2
  47. package/dist/plugins/wss/servers/WebSocketEventsServer.js.map +1 -1
  48. package/dist/plugins/wss/servers/WebSocketHMRServer.d.ts +4 -5
  49. package/dist/plugins/wss/servers/WebSocketHMRServer.js +1 -1
  50. package/dist/plugins/wss/servers/WebSocketHMRServer.js.map +1 -1
  51. package/dist/plugins/wss/servers/WebSocketMessageServer.d.ts +2 -3
  52. package/dist/plugins/wss/servers/WebSocketMessageServer.js +7 -7
  53. package/dist/plugins/wss/servers/WebSocketMessageServer.js.map +1 -1
  54. package/dist/plugins/wss/types.d.ts +2 -5
  55. package/dist/plugins/wss/types.js.map +1 -1
  56. package/dist/plugins/wss/wssPlugin.d.ts +4 -4
  57. package/dist/plugins/wss/wssPlugin.js +4 -4
  58. package/dist/plugins/wss/wssPlugin.js.map +1 -1
  59. package/dist/types.d.ts +15 -1
  60. package/dist/types.js +7 -0
  61. package/dist/types.js.map +1 -1
  62. package/package.json +3 -10
package/dist/types.d.ts CHANGED
@@ -13,7 +13,7 @@ export declare namespace Server {
13
13
  options: Options;
14
14
  experiments?: Experiments;
15
15
  /** Function to create a delegate, which implements crucial functionalities. */
16
- delegate: (context: DelegateContext) => Promise<Delegate>;
16
+ delegate: (context: DelegateContext) => Delegate;
17
17
  }
18
18
  interface Experiments {
19
19
  experimentalDebugger?: boolean;
@@ -139,6 +139,20 @@ export declare namespace Server {
139
139
  }
140
140
  }
141
141
  }
142
+ /** Representation of the compilation progress. */
143
+ export interface ProgressData {
144
+ /** Number of modules built. */
145
+ completed: number;
146
+ /** Total number of modules detect as part of compilation. */
147
+ total: number;
148
+ }
149
+ /**
150
+ * Type representing a function to send the progress.
151
+ *
152
+ * Used by {@link CompilerDelegate} in `getAsset` function to send the compilation
153
+ * progress to the client who requested the asset.
154
+ */
155
+ export type SendProgress = (data: ProgressData) => void;
142
156
  /**
143
157
  * Internal types. Do not use.
144
158
  *
package/dist/types.js CHANGED
@@ -1,4 +1,11 @@
1
1
  export let Server;
2
+ /** Representation of the compilation progress. */
3
+ /**
4
+ * Type representing a function to send the progress.
5
+ *
6
+ * Used by {@link CompilerDelegate} in `getAsset` function to send the compilation
7
+ * progress to the client who requested the asset.
8
+ */
2
9
  /**
3
10
  * Internal types. Do not use.
4
11
  *
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["Server","Internal","_Internal","EventTypes"],"sources":["../src/types.ts"],"sourcesContent":["import type { FastifyBaseLogger } from 'fastify';\nimport type { WebSocketServer } from 'ws';\nimport type { CompilerDelegate } from './plugins/compiler';\nimport type { SymbolicatorDelegate } from './plugins/symbolicate';\nimport type { HmrDelegate } from './plugins/wss';\n\nexport type { CompilerDelegate } from './plugins/compiler';\nexport type {\n SymbolicatorDelegate,\n ReactNativeStackFrame,\n InputStackFrame,\n StackFrame,\n CodeFrame,\n SymbolicatorResults,\n} from './plugins/symbolicate';\nexport type { HmrDelegate } from './plugins/wss';\n\nexport namespace Server {\n /** Development server configuration. */\n export interface Config {\n /** Development server options to configure e.g: `port`, `host` etc. */\n options: Options;\n\n experiments?: Experiments;\n\n /** Function to create a delegate, which implements crucial functionalities. */\n delegate: (context: DelegateContext) => Promise<Delegate>;\n }\n\n export interface Experiments {\n experimentalDebugger?: boolean;\n }\n\n /** Development server options. */\n export interface Options {\n /** Root directory of the project. */\n rootDir: string;\n\n /** Port under which to run the development server. */\n port: number;\n\n /**\n * Hostname or IP address under which to run the development server.\n * When left unspecified, it will listen on all available network interfaces, similarly to listening on '0.0.0.0'.\n */\n host?: string;\n\n /** Options for running the server as HTTPS. If `undefined`, the server will run as HTTP. */\n https?: {\n /** Path to certificate when running server as HTTPS. */\n cert?: string;\n\n /** Path to certificate key when running server as HTTPS. */\n key?: string;\n };\n\n /** Additional endpoints with pre-configured servers */\n endpoints?: Record<string, WebSocketServer>;\n\n /** Whether to enable logging requests. */\n logRequests?: boolean;\n }\n\n /**\n * A complete delegate with implementations for all server functionalities.\n */\n export interface Delegate {\n /** A compiler delegate. */\n compiler: CompilerDelegate;\n\n /** A symbolicator delegate. */\n symbolicator: SymbolicatorDelegate;\n\n /** A logger delegate. */\n logger: LoggerDelegate;\n\n /** An HMR delegate. */\n hmr: HmrDelegate;\n\n /** An messages delegate. */\n messages: MessagesDelegate;\n\n /** An API delegate. */\n api?: Api.Delegate;\n }\n\n /**\n * A delegate context used in `delegate` builder in {@link Config}.\n *\n * Allows to emit logs, notify about compilation events and broadcast events to connected clients.\n */\n export interface DelegateContext {\n /** A logger instance, useful for emitting logs from the delegate. */\n log: FastifyBaseLogger;\n\n /** Send notification about compilation start for given `platform`. */\n notifyBuildStart: (platform: string) => void;\n\n /** Send notification about compilation end for given `platform`. */\n notifyBuildEnd: (platform: string) => void;\n\n /**\n * Broadcast arbitrary event to all connected HMR clients for given `platform`.\n *\n * @param event Arbitrary event to broadcast.\n * @param platform Platform of the clients to which broadcast should be sent.\n * @param clientIds Ids of the client to which broadcast should be sent.\n * If `undefined` the broadcast will be sent to all connected clients for the given `platform`.\n */\n broadcastToHmrClients: <E = any>(\n event: E,\n platform: string,\n clientIds?: string[]\n ) => void;\n\n /**\n * Broadcast arbitrary method-like event to all connected message clients.\n *\n * @param event Arbitrary method-like event to broadcast.\n */\n broadcastToMessageClients: <\n E extends { method: string; params?: Record<string, any> },\n >(\n event: E\n ) => void;\n }\n\n /**\n * Delegate with implementation for logging functions.\n */\n export interface LoggerDelegate {\n /**\n * Callback for when a new log is emitted.\n *\n * @param log An object with log data.\n */\n onMessage: (log: any) => void;\n }\n\n /**\n * Delegate with implementation for messages used in route handlers.\n */\n export interface MessagesDelegate {\n /** Get message to send as a reply for `GET /` route. */\n getHello: () => string;\n\n /** Get message to send as a reply for `GET /status` route. */\n getStatus: () => string;\n }\n\n export namespace Api {\n /** A compilation asset representation for API clients. */\n export interface Asset {\n name: string;\n size: number;\n [key: string]: any;\n }\n\n /** A compilation stats representation for API clients. */\n export interface CompilationStats {\n [key: string]: any;\n }\n\n /**\n * Delegate with implementation for API endpoints.\n */\n export interface Delegate {\n /** Get all platforms - either with already existing compilations or all supported platforms. */\n getPlatforms: () => Promise<string[]>;\n\n /**\n * Get all assets from compilation for given platform.\n * Should return `[]` if the compilation does not exists for given platform.\n */\n getAssets: (platform: string) => Promise<Asset[]>;\n\n /**\n * Get compilation stats for a given platform.\n * Should return `null` if the compilation does not exists for given platform.\n */\n getCompilationStats: (\n platform: string\n ) => Promise<CompilationStats | null>;\n }\n }\n}\n\n/**\n * Internal types. Do not use.\n *\n * @internal\n */\nexport namespace Internal {\n export enum EventTypes {\n BuildStart = 'BuildStart',\n BuildEnd = 'BuildEnd',\n HmrEvent = 'HmrEvent',\n }\n}\n"],"mappings":"WAiBiBA,MAAM;AA0KvB;AACA;AACA;AACA;AACA;AAJA,WAKiBC,QAAQ;AAAA,WAAAC,SAAA;EAAA,IACXC,UAAU,0BAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAA,OAAVA,UAAU;EAAA;EAAAD,SAAA,CAAAC,UAAA,GAAAA,UAAA;AAAA,GADPF,QAAQ,KAARA,QAAQ"}
1
+ {"version":3,"file":"types.js","names":["Server","Internal","_Internal","EventTypes"],"sources":["../src/types.ts"],"sourcesContent":["import type { FastifyBaseLogger } from 'fastify';\nimport type { WebSocketServer } from 'ws';\nimport type { CompilerDelegate } from './plugins/compiler';\nimport type { SymbolicatorDelegate } from './plugins/symbolicate';\nimport type { HmrDelegate } from './plugins/wss';\n\nexport type { CompilerDelegate } from './plugins/compiler';\nexport type {\n SymbolicatorDelegate,\n ReactNativeStackFrame,\n InputStackFrame,\n StackFrame,\n CodeFrame,\n SymbolicatorResults,\n} from './plugins/symbolicate';\nexport type { HmrDelegate } from './plugins/wss';\n\nexport namespace Server {\n /** Development server configuration. */\n export interface Config {\n /** Development server options to configure e.g: `port`, `host` etc. */\n options: Options;\n\n experiments?: Experiments;\n\n /** Function to create a delegate, which implements crucial functionalities. */\n delegate: (context: DelegateContext) => Delegate;\n }\n\n export interface Experiments {\n experimentalDebugger?: boolean;\n }\n\n /** Development server options. */\n export interface Options {\n /** Root directory of the project. */\n rootDir: string;\n\n /** Port under which to run the development server. */\n port: number;\n\n /**\n * Hostname or IP address under which to run the development server.\n * When left unspecified, it will listen on all available network interfaces, similarly to listening on '0.0.0.0'.\n */\n host?: string;\n\n /** Options for running the server as HTTPS. If `undefined`, the server will run as HTTP. */\n https?: {\n /** Path to certificate when running server as HTTPS. */\n cert?: string;\n\n /** Path to certificate key when running server as HTTPS. */\n key?: string;\n };\n\n /** Additional endpoints with pre-configured servers */\n endpoints?: Record<string, WebSocketServer>;\n\n /** Whether to enable logging requests. */\n logRequests?: boolean;\n }\n\n /**\n * A complete delegate with implementations for all server functionalities.\n */\n export interface Delegate {\n /** A compiler delegate. */\n compiler: CompilerDelegate;\n\n /** A symbolicator delegate. */\n symbolicator: SymbolicatorDelegate;\n\n /** A logger delegate. */\n logger: LoggerDelegate;\n\n /** An HMR delegate. */\n hmr: HmrDelegate;\n\n /** An messages delegate. */\n messages: MessagesDelegate;\n\n /** An API delegate. */\n api?: Api.Delegate;\n }\n\n /**\n * A delegate context used in `delegate` builder in {@link Config}.\n *\n * Allows to emit logs, notify about compilation events and broadcast events to connected clients.\n */\n export interface DelegateContext {\n /** A logger instance, useful for emitting logs from the delegate. */\n log: FastifyBaseLogger;\n\n /** Send notification about compilation start for given `platform`. */\n notifyBuildStart: (platform: string) => void;\n\n /** Send notification about compilation end for given `platform`. */\n notifyBuildEnd: (platform: string) => void;\n\n /**\n * Broadcast arbitrary event to all connected HMR clients for given `platform`.\n *\n * @param event Arbitrary event to broadcast.\n * @param platform Platform of the clients to which broadcast should be sent.\n * @param clientIds Ids of the client to which broadcast should be sent.\n * If `undefined` the broadcast will be sent to all connected clients for the given `platform`.\n */\n broadcastToHmrClients: <E = any>(\n event: E,\n platform: string,\n clientIds?: string[]\n ) => void;\n\n /**\n * Broadcast arbitrary method-like event to all connected message clients.\n *\n * @param event Arbitrary method-like event to broadcast.\n */\n broadcastToMessageClients: <\n E extends { method: string; params?: Record<string, any> },\n >(\n event: E\n ) => void;\n }\n\n /**\n * Delegate with implementation for logging functions.\n */\n export interface LoggerDelegate {\n /**\n * Callback for when a new log is emitted.\n *\n * @param log An object with log data.\n */\n onMessage: (log: any) => void;\n }\n\n /**\n * Delegate with implementation for messages used in route handlers.\n */\n export interface MessagesDelegate {\n /** Get message to send as a reply for `GET /` route. */\n getHello: () => string;\n\n /** Get message to send as a reply for `GET /status` route. */\n getStatus: () => string;\n }\n\n export namespace Api {\n /** A compilation asset representation for API clients. */\n export interface Asset {\n name: string;\n size: number;\n [key: string]: any;\n }\n\n /** A compilation stats representation for API clients. */\n export interface CompilationStats {\n [key: string]: any;\n }\n\n /**\n * Delegate with implementation for API endpoints.\n */\n export interface Delegate {\n /** Get all platforms - either with already existing compilations or all supported platforms. */\n getPlatforms: () => Promise<string[]>;\n\n /**\n * Get all assets from compilation for given platform.\n * Should return `[]` if the compilation does not exists for given platform.\n */\n getAssets: (platform: string) => Promise<Asset[]>;\n\n /**\n * Get compilation stats for a given platform.\n * Should return `null` if the compilation does not exists for given platform.\n */\n getCompilationStats: (\n platform: string\n ) => Promise<CompilationStats | null>;\n }\n }\n}\n\n/** Representation of the compilation progress. */\nexport interface ProgressData {\n /** Number of modules built. */\n completed: number;\n\n /** Total number of modules detect as part of compilation. */\n total: number;\n}\n\n/**\n * Type representing a function to send the progress.\n *\n * Used by {@link CompilerDelegate} in `getAsset` function to send the compilation\n * progress to the client who requested the asset.\n */\nexport type SendProgress = (data: ProgressData) => void;\n\n/**\n * Internal types. Do not use.\n *\n * @internal\n */\nexport namespace Internal {\n export enum EventTypes {\n BuildStart = 'BuildStart',\n BuildEnd = 'BuildEnd',\n HmrEvent = 'HmrEvent',\n }\n}\n"],"mappings":"WAiBiBA,MAAM;AA0KvB;AASA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAJA,WAKiBC,QAAQ;AAAA,WAAAC,SAAA;EAAA,IACXC,UAAU,0BAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAA,OAAVA,UAAU;EAAA;EAAAD,SAAA,CAAAC,UAAA,GAAAA,UAAA;AAAA,GADPF,QAAQ,KAARA,QAAQ","ignoreList":[]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@callstack/repack-dev-server",
3
3
  "description": "A bundler-agnostic development server for React Native applications as part of @callstack/repack.",
4
4
  "license": "MIT",
5
- "version": "5.0.0-next.2",
5
+ "version": "5.0.0-rc.0",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -55,10 +55,7 @@
55
55
  "@types/node": "18",
56
56
  "@types/ws": "^8.5.3",
57
57
  "babel-plugin-add-import-extension": "^1.6.0",
58
- "eslint": "^8.53.0",
59
- "typedoc": "^0.25.3",
60
- "typedoc-plugin-markdown": "^3.17.1",
61
- "typescript": "^5.2.2"
58
+ "typescript": "^5.5.3"
62
59
  },
63
60
  "peerDependencies": {
64
61
  "@react-native-community/cli-debugger-ui": ">=11.3.1",
@@ -74,13 +71,9 @@
74
71
  },
75
72
  "scripts": {
76
73
  "build:js": "babel src --out-dir dist --extensions \".js,.cjs,.ts\" --source-maps --ignore \"**/__tests__/**\" --delete-dir-on-start --copy-files",
77
- "build:js:watch": "pnpm build:js --watch",
78
74
  "build:ts": "tsc --emitDeclarationOnly",
79
- "build:ts:watch": "pnpm build:ts --watch --preserveWatchOutput",
80
- "build": "pnpm build:js && pnpm build:ts",
81
- "docs": "typedoc",
75
+ "build": "pnpm run \"/^build:.*/\"",
82
76
  "typecheck": "tsc --noEmit",
83
- "lint": "eslint --ext \".js,.ts\" src",
84
77
  "archive": "pnpm build && pnpm pack"
85
78
  }
86
79
  }