@callstack/repack-dev-server 5.0.0-rc.1 → 5.0.0-rc.11

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 (92) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -23
  3. package/dist/createServer.d.ts +3 -2
  4. package/dist/createServer.js +110 -123
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +2 -3
  7. package/dist/plugins/api/apiPlugin.d.ts +1 -1
  8. package/dist/plugins/api/apiPlugin.js +21 -28
  9. package/dist/plugins/api/index.d.ts +1 -1
  10. package/dist/plugins/api/index.js +1 -2
  11. package/dist/plugins/compiler/compilerPlugin.d.ts +1 -1
  12. package/dist/plugins/compiler/compilerPlugin.js +53 -62
  13. package/dist/plugins/compiler/index.d.ts +2 -2
  14. package/dist/plugins/compiler/index.js +2 -3
  15. package/dist/plugins/compiler/types.d.ts +1 -1
  16. package/dist/plugins/compiler/types.js +0 -1
  17. package/dist/plugins/devtools/devtoolsPlugin.d.ts +2 -3
  18. package/dist/plugins/devtools/devtoolsPlugin.js +16 -19
  19. package/dist/plugins/devtools/index.d.ts +1 -1
  20. package/dist/plugins/devtools/index.js +1 -2
  21. package/dist/plugins/favicon/faviconPlugin.js +3 -7
  22. package/dist/plugins/favicon/index.d.ts +1 -1
  23. package/dist/plugins/favicon/index.js +1 -2
  24. package/dist/plugins/multipart/index.d.ts +2 -2
  25. package/dist/plugins/multipart/index.js +2 -3
  26. package/dist/plugins/multipart/multipartPlugin.js +44 -42
  27. package/dist/plugins/multipart/types.js +0 -1
  28. package/dist/plugins/symbolicate/Symbolicator.d.ts +1 -1
  29. package/dist/plugins/symbolicate/Symbolicator.js +172 -190
  30. package/dist/plugins/symbolicate/index.d.ts +3 -3
  31. package/dist/plugins/symbolicate/index.js +3 -4
  32. package/dist/plugins/symbolicate/sybmolicatePlugin.d.ts +1 -1
  33. package/dist/plugins/symbolicate/sybmolicatePlugin.js +29 -40
  34. package/dist/plugins/symbolicate/types.js +0 -1
  35. package/dist/plugins/wss/WebSocketRouter.d.ts +1 -1
  36. package/dist/plugins/wss/WebSocketRouter.js +39 -44
  37. package/dist/plugins/wss/WebSocketServer.d.ts +1 -1
  38. package/dist/plugins/wss/WebSocketServer.js +23 -38
  39. package/dist/plugins/wss/WebSocketServerAdapter.d.ts +1 -1
  40. package/dist/plugins/wss/WebSocketServerAdapter.js +16 -19
  41. package/dist/plugins/wss/index.d.ts +3 -3
  42. package/dist/plugins/wss/index.js +3 -4
  43. package/dist/plugins/wss/servers/WebSocketApiServer.d.ts +1 -1
  44. package/dist/plugins/wss/servers/WebSocketApiServer.js +47 -53
  45. package/dist/plugins/wss/servers/WebSocketDevClientServer.d.ts +1 -1
  46. package/dist/plugins/wss/servers/WebSocketDevClientServer.js +58 -80
  47. package/dist/plugins/wss/servers/WebSocketEventsServer.d.ts +2 -2
  48. package/dist/plugins/wss/servers/WebSocketEventsServer.js +146 -164
  49. package/dist/plugins/wss/servers/WebSocketHMRServer.d.ts +2 -2
  50. package/dist/plugins/wss/servers/WebSocketHMRServer.js +72 -79
  51. package/dist/plugins/wss/servers/WebSocketMessageServer.d.ts +1 -1
  52. package/dist/plugins/wss/servers/WebSocketMessageServer.js +309 -326
  53. package/dist/plugins/wss/types.js +0 -1
  54. package/dist/plugins/wss/wssPlugin.d.ts +11 -10
  55. package/dist/plugins/wss/wssPlugin.js +37 -42
  56. package/dist/types.d.ts +30 -24
  57. package/dist/types.js +8 -18
  58. package/dist/utils/normalizeOptions.d.ts +12 -0
  59. package/dist/utils/normalizeOptions.js +28 -0
  60. package/package.json +4 -8
  61. package/CHANGELOG.md +0 -158
  62. package/dist/createServer.js.map +0 -1
  63. package/dist/index.js.map +0 -1
  64. package/dist/plugins/api/apiPlugin.js.map +0 -1
  65. package/dist/plugins/api/index.js.map +0 -1
  66. package/dist/plugins/compiler/compilerPlugin.js.map +0 -1
  67. package/dist/plugins/compiler/index.js.map +0 -1
  68. package/dist/plugins/compiler/types.js.map +0 -1
  69. package/dist/plugins/devtools/devtoolsPlugin.js.map +0 -1
  70. package/dist/plugins/devtools/index.js.map +0 -1
  71. package/dist/plugins/favicon/faviconPlugin.js.map +0 -1
  72. package/dist/plugins/favicon/index.js.map +0 -1
  73. package/dist/plugins/multipart/index.js.map +0 -1
  74. package/dist/plugins/multipart/multipartPlugin.js.map +0 -1
  75. package/dist/plugins/multipart/types.js.map +0 -1
  76. package/dist/plugins/symbolicate/Symbolicator.js.map +0 -1
  77. package/dist/plugins/symbolicate/index.js.map +0 -1
  78. package/dist/plugins/symbolicate/sybmolicatePlugin.js.map +0 -1
  79. package/dist/plugins/symbolicate/types.js.map +0 -1
  80. package/dist/plugins/wss/WebSocketRouter.js.map +0 -1
  81. package/dist/plugins/wss/WebSocketServer.js.map +0 -1
  82. package/dist/plugins/wss/WebSocketServerAdapter.js.map +0 -1
  83. package/dist/plugins/wss/index.js.map +0 -1
  84. package/dist/plugins/wss/servers/WebSocketApiServer.js.map +0 -1
  85. package/dist/plugins/wss/servers/WebSocketDevClientServer.js.map +0 -1
  86. package/dist/plugins/wss/servers/WebSocketEventsServer.js.map +0 -1
  87. package/dist/plugins/wss/servers/WebSocketHMRServer.js.map +0 -1
  88. package/dist/plugins/wss/servers/WebSocketMessageServer.js.map +0 -1
  89. package/dist/plugins/wss/types.js.map +0 -1
  90. package/dist/plugins/wss/wssPlugin.js.map +0 -1
  91. package/dist/types.js.map +0 -1
  92. /package/{dist/img → static}/favicon.ico +0 -0
@@ -1,12 +1,13 @@
1
1
  import type { FastifyInstance } from 'fastify';
2
- import type { Server } from '../../types';
3
- import { WebSocketRouter } from './WebSocketRouter';
4
- import { WebSocketServerAdapter } from './WebSocketServerAdapter';
5
- import { WebSocketApiServer } from './servers/WebSocketApiServer';
6
- import { WebSocketDevClientServer } from './servers/WebSocketDevClientServer';
7
- import { WebSocketEventsServer } from './servers/WebSocketEventsServer';
8
- import { WebSocketHMRServer } from './servers/WebSocketHMRServer';
9
- import { WebSocketMessageServer } from './servers/WebSocketMessageServer';
2
+ import type { WebSocketServer } from 'ws';
3
+ import type { Server } from '../../types.js';
4
+ import { WebSocketRouter } from './WebSocketRouter.js';
5
+ import { WebSocketServerAdapter } from './WebSocketServerAdapter.js';
6
+ import { WebSocketApiServer } from './servers/WebSocketApiServer.js';
7
+ import { WebSocketDevClientServer } from './servers/WebSocketDevClientServer.js';
8
+ import { WebSocketEventsServer } from './servers/WebSocketEventsServer.js';
9
+ import { WebSocketHMRServer } from './servers/WebSocketHMRServer.js';
10
+ import { WebSocketMessageServer } from './servers/WebSocketMessageServer.js';
10
11
  declare module 'fastify' {
11
12
  interface FastifyInstance {
12
13
  wss: {
@@ -21,9 +22,9 @@ declare module 'fastify' {
21
22
  };
22
23
  }
23
24
  }
24
- declare function wssPlugin(instance: FastifyInstance, { options, delegate, }: {
25
- options: Server.Options;
25
+ declare function wssPlugin(instance: FastifyInstance, { delegate, endpoints, }: {
26
26
  delegate: Server.Delegate;
27
+ endpoints?: Record<string, WebSocketServer>;
27
28
  }): Promise<void>;
28
29
  declare const _default: typeof wssPlugin;
29
30
  export default _default;
@@ -1,52 +1,47 @@
1
1
  import fastifyPlugin from 'fastify-plugin';
2
- import { WebSocketRouter } from "./WebSocketRouter.js";
3
- import { WebSocketServerAdapter } from "./WebSocketServerAdapter.js";
4
- import { WebSocketApiServer } from "./servers/WebSocketApiServer.js";
5
- import { WebSocketDevClientServer } from "./servers/WebSocketDevClientServer.js";
6
- import { WebSocketEventsServer } from "./servers/WebSocketEventsServer.js";
7
- import { WebSocketHMRServer } from "./servers/WebSocketHMRServer.js";
8
- import { WebSocketMessageServer } from "./servers/WebSocketMessageServer.js";
2
+ import { WebSocketRouter } from './WebSocketRouter.js';
3
+ import { WebSocketServerAdapter } from './WebSocketServerAdapter.js';
4
+ import { WebSocketApiServer } from './servers/WebSocketApiServer.js';
5
+ import { WebSocketDevClientServer } from './servers/WebSocketDevClientServer.js';
6
+ import { WebSocketEventsServer } from './servers/WebSocketEventsServer.js';
7
+ import { WebSocketHMRServer } from './servers/WebSocketHMRServer.js';
8
+ import { WebSocketMessageServer } from './servers/WebSocketMessageServer.js';
9
9
  /**
10
10
  * Defined in @react-native/dev-middleware
11
11
  * Reference: https://github.com/facebook/react-native/blob/main/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js
12
12
  */
13
13
  const WS_DEVICE_URL = '/inspector/device';
14
14
  const WS_DEBUGGER_URL = '/inspector/debug';
15
- async function wssPlugin(instance, {
16
- options,
17
- delegate
18
- }) {
19
- const router = new WebSocketRouter(instance);
20
- const devClientServer = new WebSocketDevClientServer(instance);
21
- const messageServer = new WebSocketMessageServer(instance);
22
- const eventsServer = new WebSocketEventsServer(instance, {
23
- webSocketMessageServer: messageServer
24
- });
25
- const apiServer = new WebSocketApiServer(instance);
26
- const hmrServer = new WebSocketHMRServer(instance, delegate.hmr);
27
-
28
- // @react-native/dev-middleware servers
29
- const deviceConnectionServer = new WebSocketServerAdapter(instance, WS_DEVICE_URL, options.endpoints?.[WS_DEVICE_URL]);
30
- const debuggerConnectionServer = new WebSocketServerAdapter(instance, WS_DEBUGGER_URL, options.endpoints?.[WS_DEBUGGER_URL]);
31
- router.registerServer(devClientServer);
32
- router.registerServer(messageServer);
33
- router.registerServer(eventsServer);
34
- router.registerServer(apiServer);
35
- router.registerServer(hmrServer);
36
- router.registerServer(deviceConnectionServer);
37
- router.registerServer(debuggerConnectionServer);
38
- instance.decorate('wss', {
39
- devClientServer,
40
- messageServer,
41
- eventsServer,
42
- apiServer,
43
- hmrServer,
44
- deviceConnectionServer,
45
- debuggerConnectionServer,
46
- router
47
- });
15
+ async function wssPlugin(instance, { delegate, endpoints, }) {
16
+ const router = new WebSocketRouter(instance);
17
+ const devClientServer = new WebSocketDevClientServer(instance);
18
+ const messageServer = new WebSocketMessageServer(instance);
19
+ const eventsServer = new WebSocketEventsServer(instance, {
20
+ webSocketMessageServer: messageServer,
21
+ });
22
+ const apiServer = new WebSocketApiServer(instance);
23
+ const hmrServer = new WebSocketHMRServer(instance, delegate.hmr);
24
+ // @react-native/dev-middleware servers
25
+ const deviceConnectionServer = new WebSocketServerAdapter(instance, WS_DEVICE_URL, endpoints?.[WS_DEVICE_URL]);
26
+ const debuggerConnectionServer = new WebSocketServerAdapter(instance, WS_DEBUGGER_URL, endpoints?.[WS_DEBUGGER_URL]);
27
+ router.registerServer(devClientServer);
28
+ router.registerServer(messageServer);
29
+ router.registerServer(eventsServer);
30
+ router.registerServer(apiServer);
31
+ router.registerServer(hmrServer);
32
+ router.registerServer(deviceConnectionServer);
33
+ router.registerServer(debuggerConnectionServer);
34
+ instance.decorate('wss', {
35
+ devClientServer,
36
+ messageServer,
37
+ eventsServer,
38
+ apiServer,
39
+ hmrServer,
40
+ deviceConnectionServer,
41
+ debuggerConnectionServer,
42
+ router,
43
+ });
48
44
  }
49
45
  export default fastifyPlugin(wssPlugin, {
50
- name: 'wss-plugin'
46
+ name: 'wss-plugin',
51
47
  });
52
- //# sourceMappingURL=wssPlugin.js.map
package/dist/types.d.ts CHANGED
@@ -1,11 +1,31 @@
1
+ import type { ServerOptions as HttpsServerOptions } from 'node:https';
1
2
  import type { FastifyBaseLogger } from 'fastify';
2
- import type { WebSocketServer } from 'ws';
3
- import type { CompilerDelegate } from './plugins/compiler';
4
- import type { SymbolicatorDelegate } from './plugins/symbolicate';
5
- import type { HmrDelegate } from './plugins/wss';
6
- export type { CompilerDelegate } from './plugins/compiler';
7
- export type { SymbolicatorDelegate, ReactNativeStackFrame, InputStackFrame, StackFrame, CodeFrame, SymbolicatorResults, } from './plugins/symbolicate';
8
- export type { HmrDelegate } from './plugins/wss';
3
+ import type { CompilerDelegate } from './plugins/compiler/types.js';
4
+ import type { CodeFrame, InputStackFrame, ReactNativeStackFrame, StackFrame, SymbolicatorDelegate, SymbolicatorResults } from './plugins/symbolicate/types.js';
5
+ import type { HmrDelegate } from './plugins/wss/types.js';
6
+ import type { NormalizedOptions } from './utils/normalizeOptions.js';
7
+ export type { CompilerDelegate };
8
+ export type { CodeFrame, InputStackFrame, ReactNativeStackFrame, StackFrame, SymbolicatorDelegate, SymbolicatorResults, };
9
+ export type { HmrDelegate };
10
+ export interface DevServerOptions {
11
+ /**
12
+ * Hostname or IP address under which to run the development server.
13
+ * Can be 'local-ip', 'local-ipv4', 'local-ipv6' or a custom string.
14
+ * When left unspecified, it will listen on all available network interfaces.
15
+ */
16
+ host?: 'local-ip' | 'local-ipv4' | 'local-ipv6' | string;
17
+ /** Port under which to run the development server. */
18
+ port?: number;
19
+ /** Whether to enable Hot Module Replacement. */
20
+ hot?: boolean;
21
+ /** Options for running the server as HTTPS. If `undefined`, the server will run as HTTP. */
22
+ server?: 'http' | 'https' | {
23
+ type: 'http';
24
+ } | {
25
+ type: 'https';
26
+ options?: HttpsServerOptions;
27
+ };
28
+ }
9
29
  export declare namespace Server {
10
30
  /** Development server configuration. */
11
31
  interface Config {
@@ -15,25 +35,9 @@ export declare namespace Server {
15
35
  delegate: (context: DelegateContext) => Delegate;
16
36
  }
17
37
  /** Development server options. */
18
- interface Options {
38
+ interface Options extends DevServerOptions {
19
39
  /** Root directory of the project. */
20
40
  rootDir: string;
21
- /** Port under which to run the development server. */
22
- port: number;
23
- /**
24
- * Hostname or IP address under which to run the development server.
25
- * When left unspecified, it will listen on all available network interfaces, similarly to listening on '0.0.0.0'.
26
- */
27
- host?: string;
28
- /** Options for running the server as HTTPS. If `undefined`, the server will run as HTTP. */
29
- https?: {
30
- /** Path to certificate when running server as HTTPS. */
31
- cert?: string;
32
- /** Path to certificate key when running server as HTTPS. */
33
- key?: string;
34
- };
35
- /** Additional endpoints with pre-configured servers */
36
- endpoints?: Record<string, WebSocketServer>;
37
41
  /** Whether to enable logging requests. */
38
42
  logRequests?: boolean;
39
43
  }
@@ -60,6 +64,8 @@ export declare namespace Server {
60
64
  * Allows to emit logs, notify about compilation events and broadcast events to connected clients.
61
65
  */
62
66
  interface DelegateContext {
67
+ /** Normalized development server options. */
68
+ options: NormalizedOptions;
63
69
  /** A logger instance, useful for emitting logs from the delegate. */
64
70
  log: FastifyBaseLogger;
65
71
  /** Send notification about compilation start for given `platform`. */
package/dist/types.js CHANGED
@@ -1,24 +1,14 @@
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
- */
9
1
  /**
10
2
  * Internal types. Do not use.
11
3
  *
12
4
  * @internal
13
5
  */
14
- export let Internal;
15
- (function (_Internal) {
16
- let EventTypes = /*#__PURE__*/function (EventTypes) {
17
- EventTypes["BuildStart"] = "BuildStart";
18
- EventTypes["BuildEnd"] = "BuildEnd";
19
- EventTypes["HmrEvent"] = "HmrEvent";
20
- return EventTypes;
21
- }({});
22
- _Internal.EventTypes = EventTypes;
6
+ export var Internal;
7
+ (function (Internal) {
8
+ let EventTypes;
9
+ (function (EventTypes) {
10
+ EventTypes["BuildStart"] = "BuildStart";
11
+ EventTypes["BuildEnd"] = "BuildEnd";
12
+ EventTypes["HmrEvent"] = "HmrEvent";
13
+ })(EventTypes = Internal.EventTypes || (Internal.EventTypes = {}));
23
14
  })(Internal || (Internal = {}));
24
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,12 @@
1
+ import type { ServerOptions as HttpsServerOptions } from 'node:https';
2
+ import type { Server } from '../types.js';
3
+ export interface NormalizedOptions {
4
+ host: string;
5
+ port: number;
6
+ https: HttpsServerOptions | undefined;
7
+ hot: boolean;
8
+ url: string;
9
+ disableRequestLogging: boolean;
10
+ rootDir: string;
11
+ }
12
+ export declare function normalizeOptions(options: Server.Options): NormalizedOptions;
@@ -0,0 +1,28 @@
1
+ function normalizeHttpsOptions(serverOptions) {
2
+ if (serverOptions &&
3
+ typeof serverOptions === 'object' &&
4
+ serverOptions.type === 'https') {
5
+ return serverOptions.options;
6
+ }
7
+ return undefined;
8
+ }
9
+ export function normalizeOptions(options) {
10
+ const host = options.host ?? 'localhost';
11
+ const port = options.port ?? 8081;
12
+ const https = normalizeHttpsOptions(options.server);
13
+ const hot = options.hot ?? false;
14
+ const protocol = https ? 'https' : 'http';
15
+ const url = `${protocol}://${host}:${options.port}`;
16
+ return {
17
+ // webpack dev server compatible options
18
+ host,
19
+ port,
20
+ https,
21
+ hot,
22
+ url,
23
+ // fastify options
24
+ disableRequestLogging: !options.logRequests,
25
+ // project options
26
+ rootDir: options.rootDir,
27
+ };
28
+ }
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-rc.1",
5
+ "version": "5.0.0-rc.11",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -12,9 +12,7 @@
12
12
  },
13
13
  "files": [
14
14
  "dist",
15
- "docs",
16
- "vendor",
17
- "CHANGELOG.md"
15
+ "static"
18
16
  ],
19
17
  "homepage": "https://github.com/callstack/repack",
20
18
  "repository": "github:callstack/repack",
@@ -53,7 +51,7 @@
53
51
  "@types/node": "18",
54
52
  "@types/ws": "^8.5.3",
55
53
  "babel-plugin-add-import-extension": "^1.6.0",
56
- "typescript": "^5.5.3"
54
+ "typescript": "^5.7.2"
57
55
  },
58
56
  "peerDependencies": {
59
57
  "@react-native-community/cli-server-api": ">=13.6.4"
@@ -64,9 +62,7 @@
64
62
  }
65
63
  },
66
64
  "scripts": {
67
- "build:js": "babel src --out-dir dist --extensions \".js,.cjs,.ts\" --source-maps --ignore \"**/__tests__/**\" --delete-dir-on-start --copy-files",
68
- "build:ts": "tsc --emitDeclarationOnly",
69
- "build": "pnpm run \"/^build:.*/\"",
65
+ "build": "tsc -b",
70
66
  "typecheck": "tsc --noEmit",
71
67
  "archive": "pnpm build && pnpm pack"
72
68
  }
package/CHANGELOG.md DELETED
@@ -1,158 +0,0 @@
1
- # @callstack/repack-dev-server
2
-
3
- ## 5.0.0-rc.1
4
-
5
- ## 5.0.0-rc.0
6
-
7
- ## 5.0.0-alpha.0
8
-
9
- ## 4.3.3
10
-
11
- ## 4.3.2
12
-
13
- ## 4.3.1
14
-
15
- ## 4.3.0
16
-
17
- ## 4.2.0
18
-
19
- ## 4.1.1
20
-
21
- ## 4.1.0
22
-
23
- ## 4.0.0
24
-
25
- ### Major Changes
26
-
27
- - [#430](https://github.com/callstack/repack/pull/430) [`0d96b11`](https://github.com/callstack/repack/commit/0d96b11ff3a6e2c21eb622e21ff7947db29a3272) Thanks [@jbroma](https://github.com/jbroma)! - Upgrade to Node 18, drop support for Node 16
28
-
29
- - [#508](https://github.com/callstack/repack/pull/508) [`fec8962`](https://github.com/callstack/repack/commit/fec8962b45f3d744d7c41e8f6eeae0a2310c7693) Thanks [@RafikiTiki](https://github.com/RafikiTiki)! - - Fixed deprecated remote debugger integration:
30
- - Removed vendored code and used middlewares from `@react-native-community/cli-server-api`
31
- - Removed `package/debugger-app` and replaced it with `@react-native-community/cli-debugger-ui`
32
- - Removed vendored code responsible for integration with Flipper debugger & custom implementation of the Hermes Inspector Proxy
33
- - Added integration with `@react-native/dev-middleware` which enables us to use both Flipper and new experimental debugger
34
-
35
- ### Patch Changes
36
-
37
- - [#567](https://github.com/callstack/repack/pull/567) [`6417da7`](https://github.com/callstack/repack/commit/6417da7ba72e39602735062198165c998e4e19cf) Thanks [@kerm1it](https://github.com/kerm1it)! - Notify clients on all platforms when sending an HMR event update
38
-
39
- - [#554](https://github.com/callstack/repack/pull/554) [`ed82e29`](https://github.com/callstack/repack/commit/ed82e29c2871411fd73616f29a7d4b75ff3dd913) Thanks [@jbroma](https://github.com/jbroma)! - Fix path to `favicon.ico` on Windows
40
-
41
- - [#464](https://github.com/callstack/repack/pull/464) [`72c770b`](https://github.com/callstack/repack/commit/72c770bb4ac5540a3c73cf244ca861069a37b045) Thanks [@jbroma](https://github.com/jbroma)! - Upgrade TypeScript, ESLint, TypeDoc in the repository
42
-
43
- ## 4.0.0-rc.2
44
-
45
- ## 4.0.0-rc.1
46
-
47
- ### Patch Changes
48
-
49
- - [#554](https://github.com/callstack/repack/pull/554) [`ed82e29`](https://github.com/callstack/repack/commit/ed82e29c2871411fd73616f29a7d4b75ff3dd913) Thanks [@jbroma](https://github.com/jbroma)! - Fix path to favicon.ico on Windows
50
-
51
- ## 4.0.0-rc.0
52
-
53
- ### Major Changes
54
-
55
- - [#430](https://github.com/callstack/repack/pull/430) [`0d96b11`](https://github.com/callstack/repack/commit/0d96b11ff3a6e2c21eb622e21ff7947db29a3272) Thanks [@jbroma](https://github.com/jbroma)! - BREAKING CHANGE: Upgrade to Node 18, drop support for Node 16.
56
-
57
- ### Patch Changes
58
-
59
- - [#464](https://github.com/callstack/repack/pull/464) [`72c770b`](https://github.com/callstack/repack/commit/72c770bb4ac5540a3c73cf244ca861069a37b045) Thanks [@jbroma](https://github.com/jbroma)! - chore: upgrade TypeScript, ESLint, TypeDoc
60
-
61
- ## 1.1.0
62
-
63
- ### Minor Changes
64
-
65
- - [#475](https://github.com/callstack/repack/pull/475) [`cc997a2`](https://github.com/callstack/repack/commit/cc997a2f84b4835f8fe597487b0cde6f41b4b7f0) Thanks [@szymonrybczak](https://github.com/szymonrybczak)! - Added X-React-Native-Project-Root header, so the RN CLI picks up the running bundler correctly
66
-
67
- ## 1.0.2
68
-
69
- ### Patch Changes
70
-
71
- - [#441](https://github.com/callstack/repack/pull/441) [`a66785d`](https://github.com/callstack/repack/commit/a66785d4bdb629ab9abce2bf5fc0dc4b632072ef) Thanks [@hexboy](https://github.com/hexboy)! - fix(dev-server): fix Failed to open stack frame in editor error
72
-
73
- * [#426](https://github.com/callstack/repack/pull/426) [`719c2ef`](https://github.com/callstack/repack/commit/719c2ef3e1af0c82de8042de2c5c21ab88a287ea) Thanks [@jbroma](https://github.com/jbroma)! - Upgraded source-map to 0.7.4
74
-
75
- ## 1.0.1
76
-
77
- ### Patch Changes
78
-
79
- - [#308](https://github.com/callstack/repack/pull/308) [`ad9581a`](https://github.com/callstack/repack/commit/ad9581a6d690b128991a9d64374ecb4b8d49c413) Thanks [@jbroma](https://github.com/jbroma)! - Make all packages compatible with Node v18
80
-
81
- - Updated dependencies [[`ad9581a`](https://github.com/callstack/repack/commit/ad9581a6d690b128991a9d64374ecb4b8d49c413)]:
82
- - @callstack/repack-debugger-app@1.0.2
83
-
84
- ## 1.0.0
85
-
86
- ### Major Changes
87
-
88
- - [#186](https://github.com/callstack/repack/pull/186) [`05d126e`](https://github.com/callstack/repack/commit/05d126e63802f0702a9e353e762f8b6a77fcd73e) Thanks [@zamotany](https://github.com/zamotany)! - ### Bundler-agnostic development server
89
-
90
- Extracted development server from `@callstack/repack` into a separate package and made it bundler-agnostic.
91
-
92
- ### Minor Changes
93
-
94
- - [#189](https://github.com/callstack/repack/pull/189) [`bc42023`](https://github.com/callstack/repack/commit/bc420236687047752cf1ee42204b2f510aec144a) Thanks [@zamotany](https://github.com/zamotany)! - ### Development server API
95
-
96
- Added API endpoints to `@callstack/repack-dev-server`:
97
-
98
- - `GET /api/platforms` - List all platforms with active compilations
99
- - `GET /api/:platform/assets` - List all assets (`name` and `size`) for a given compilation
100
- - `GET /api/:platform/stats` - Get compilation stats
101
- - Websocket server under `/api` URI for logs and compilations events
102
-
103
- * [#230](https://github.com/callstack/repack/pull/230) [`e6dc69d`](https://github.com/callstack/repack/commit/e6dc69d35f287af08d09944edd8e6d12f28484cf) Thanks [@jbinda](https://github.com/jbinda)! - Introduce `fastify-favicon` plugin to prevent server logger from emitting error log related to `GET 400 /favicon.ico` when requesting bundles via browser.
104
-
105
- - [#239](https://github.com/callstack/repack/pull/239) [`6d65156`](https://github.com/callstack/repack/commit/6d65156366bc88edefdae7a3d0310ddbcdf48886) Thanks [@jbinda](https://github.com/jbinda)! - Expose favicon.ico in devserver
106
-
107
- ### Patch Changes
108
-
109
- - [#238](https://github.com/callstack/repack/pull/238) [`b913b89`](https://github.com/callstack/repack/commit/b913b8981334854cc13076af2a9c8a12bc465d1b) Thanks [@jbinda](https://github.com/jbinda)! - Add `archive` script in dev-server
110
-
111
- * [#200](https://github.com/callstack/repack/pull/200) [`c75cdc7`](https://github.com/callstack/repack/commit/c75cdc7a44351bb4702232e603031e2880f2839d) Thanks [@zamotany](https://github.com/zamotany)! - Prevent server logger from emitting log to API WS server before WS servers are created.
112
-
113
- * Updated dependencies [[`05d126e`](https://github.com/callstack/repack/commit/05d126e63802f0702a9e353e762f8b6a77fcd73e)]:
114
- - @callstack/repack-debugger-app@1.0.0
115
-
116
- ## 1.0.0-next.3
117
-
118
- ### Minor Changes
119
-
120
- - [#230](https://github.com/callstack/repack/pull/230) [`e6dc69d`](https://github.com/callstack/repack/commit/e6dc69d35f287af08d09944edd8e6d12f28484cf) Thanks [@jbinda](https://github.com/jbinda)! - Introduce `fastify-favicon` plugin to prevent server logger from emitting error log related to `GET 400 /favicon.ico` when requesting bundles via browser.
121
-
122
- * [#239](https://github.com/callstack/repack/pull/239) [`6d65156`](https://github.com/callstack/repack/commit/6d65156366bc88edefdae7a3d0310ddbcdf48886) Thanks [@jbinda](https://github.com/jbinda)! - Expose favicon.ico in devserver
123
-
124
- ### Patch Changes
125
-
126
- - [#238](https://github.com/callstack/repack/pull/238) [`b913b89`](https://github.com/callstack/repack/commit/b913b8981334854cc13076af2a9c8a12bc465d1b) Thanks [@jbinda](https://github.com/jbinda)! - Add `archive` script in dev-server
127
-
128
- ## 1.0.0-next.2
129
-
130
- ### Patch Changes
131
-
132
- - [#200](https://github.com/callstack/repack/pull/200) [`c75cdc7`](https://github.com/callstack/repack/commit/c75cdc7a44351bb4702232e603031e2880f2839d) Thanks [@zamotany](https://github.com/zamotany)! - Prevent server logger from emitting log to API WS server before WS servers are created.
133
-
134
- ## 1.0.0-next.1
135
-
136
- ### Minor Changes
137
-
138
- - ### Development server API
139
-
140
- Added API endpoints to `@callstack/repack-dev-server`:
141
-
142
- - `GET /api/platforms` - List all platforms with active compilations
143
- - `GET /api/:platform/assets` - List all assets (`name` and `size`) for a given compilation
144
- - `GET /api/:platform/stats` - Get compilation stats
145
- - Websocket server under `/api` URI for logs and compilations events
146
-
147
- ## 1.0.0-next.0
148
-
149
- ### Major Changes
150
-
151
- - ### Bundler-agnostic development server
152
-
153
- Extracted development server from `@callstack/repack` into a separate package and made it bundler-agnostic.
154
-
155
- ### Patch Changes
156
-
157
- - Updated dependencies []:
158
- - @callstack/repack-debugger-app@1.0.0-next.0
@@ -1 +0,0 @@
1
- {"version":3,"file":"createServer.js","names":["Writable","middie","fastifySensible","createDevMiddleware","Fastify","apiPlugin","compilerPlugin","devtoolsPlugin","faviconPlugin","multipartPlugin","symbolicatePlugin","wssPlugin","Internal","createServer","config","delegate","instance","disableRequestLogging","options","logRequests","logger","level","stream","write","chunk","_encoding","callback","log","JSON","parse","toString","onMessage","wss","apiServer","send","https","undefined","notifyBuildStart","platform","event","EventTypes","BuildStart","notifyBuildEnd","BuildEnd","broadcastToHmrClients","clientIds","hmrServer","broadcastToMessageClients","method","params","messageServer","broadcast","devMiddleware","projectRoot","rootDir","serverBaseUrl","host","port","unstable_experiments","enableNewDebugger","register","endpoints","websocketEndpoints","prefix","addHook","request","reply","payload","header","pathname","url","split","endsWith","use","middleware","get","messages","getHello","getStatus","start","listen","stop","close"],"sources":["../src/createServer.ts"],"sourcesContent":["import { Writable } from 'node:stream';\nimport middie from '@fastify/middie';\nimport fastifySensible from '@fastify/sensible';\nimport { createDevMiddleware } from '@react-native/dev-middleware';\nimport Fastify from 'fastify';\nimport apiPlugin from './plugins/api';\nimport compilerPlugin from './plugins/compiler';\nimport devtoolsPlugin from './plugins/devtools';\nimport faviconPlugin from './plugins/favicon';\nimport multipartPlugin from './plugins/multipart';\nimport symbolicatePlugin from './plugins/symbolicate';\nimport wssPlugin from './plugins/wss';\nimport { Internal, type Server } from './types';\n\n/**\n * Create instance of development server, powered by Fastify.\n *\n * @param config Server configuration.\n * @returns `start` and `stop` functions as well as an underlying Fastify `instance`.\n */\nexport async function createServer(config: Server.Config) {\n // biome-ignore lint/style/useConst: needed in fastify constructor\n let delegate: Server.Delegate;\n\n /** Fastify instance powering the development server. */\n const instance = Fastify({\n disableRequestLogging: !config.options.logRequests,\n logger: {\n level: 'trace',\n stream: new Writable({\n write: (chunk, _encoding, callback) => {\n const log = JSON.parse(chunk.toString());\n delegate?.logger.onMessage(log);\n instance.wss?.apiServer.send(log);\n callback();\n },\n }),\n },\n ...(config.options.https ? { https: config.options.https } : undefined),\n });\n\n delegate = await config.delegate({\n log: instance.log,\n notifyBuildStart: (platform) => {\n instance.wss.apiServer.send({\n event: Internal.EventTypes.BuildStart,\n platform,\n });\n },\n notifyBuildEnd: (platform) => {\n instance.wss.apiServer.send({\n event: Internal.EventTypes.BuildEnd,\n platform,\n });\n },\n broadcastToHmrClients: (event, platform, clientIds) => {\n instance.wss.hmrServer.send(event, platform, clientIds);\n },\n broadcastToMessageClients: ({ method, params }) => {\n instance.wss.messageServer.broadcast(method, params);\n },\n });\n\n const devMiddleware = createDevMiddleware({\n projectRoot: config.options.rootDir,\n serverBaseUrl: `http://${config.options.host}:${config.options.port}`,\n logger: instance.log,\n unstable_experiments: {\n // @ts-expect-error removed in 0.76, keep this for backkwards compatibility\n enableNewDebugger: true,\n },\n });\n\n // Register plugins\n await instance.register(fastifySensible);\n await instance.register(middie);\n await instance.register(wssPlugin, {\n options: {\n ...config.options,\n endpoints: devMiddleware.websocketEndpoints,\n },\n delegate,\n });\n await instance.register(multipartPlugin);\n await instance.register(apiPlugin, {\n delegate,\n prefix: '/api',\n });\n await instance.register(compilerPlugin, {\n delegate,\n });\n await instance.register(devtoolsPlugin, {\n options: config.options,\n });\n await instance.register(symbolicatePlugin, {\n delegate,\n });\n\n // below is to prevent showing `GET 400 /favicon.ico`\n // errors in console when requesting the bundle via browser\n await instance.register(faviconPlugin);\n\n instance.addHook('onSend', async (request, reply, payload) => {\n reply.header('X-Content-Type-Options', 'nosniff');\n reply.header('X-React-Native-Project-Root', config.options.rootDir);\n\n const [pathname] = request.url.split('?');\n if (pathname.endsWith('.map')) {\n reply.header('Access-Control-Allow-Origin', 'devtools://devtools');\n }\n\n return payload;\n });\n\n // Register dev middleware\n instance.use(devMiddleware.middleware);\n\n // Register routes\n instance.get('/', async () => delegate.messages.getHello());\n instance.get('/status', async () => delegate.messages.getStatus());\n\n /** Start the development server. */\n async function start() {\n await instance.listen({\n port: config.options.port,\n host: config.options.host,\n });\n }\n\n /** Stop the development server. */\n async function stop() {\n await instance.close();\n }\n\n return {\n start,\n stop,\n instance,\n };\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,aAAa;AACtC,OAAOC,MAAM,MAAM,iBAAiB;AACpC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,OAAOC,OAAO,MAAM,SAAS;AAAC,OACvBC,SAAS;AAAA,OACTC,cAAc;AAAA,OACdC,cAAc;AAAA,OACdC,aAAa;AAAA,OACbC,eAAe;AAAA,OACfC,iBAAiB;AAAA,OACjBC,SAAS;AAAA,SACPC,QAAQ;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,YAAYA,CAACC,MAAqB,EAAE;EACxD;EACA,IAAIC,QAAyB;;EAE7B;EACA,MAAMC,QAAQ,GAAGZ,OAAO,CAAC;IACvBa,qBAAqB,EAAE,CAACH,MAAM,CAACI,OAAO,CAACC,WAAW;IAClDC,MAAM,EAAE;MACNC,KAAK,EAAE,OAAO;MACdC,MAAM,EAAE,IAAItB,QAAQ,CAAC;QACnBuB,KAAK,EAAEA,CAACC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,KAAK;UACrC,MAAMC,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACL,KAAK,CAACM,QAAQ,CAAC,CAAC,CAAC;UACxCf,QAAQ,EAAEK,MAAM,CAACW,SAAS,CAACJ,GAAG,CAAC;UAC/BX,QAAQ,CAACgB,GAAG,EAAEC,SAAS,CAACC,IAAI,CAAC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ACzC,IAAIF,QAAQ,CAACG,QAAQ,CAAC,MAAM,CAAC,EAAE;MAC7BN,KAAK,CAACE,MAAM,CAAC,6BAA6B,EAAE,qBAAqB,CAAC;IACpE;IAEA,OAAOD,OAAO;EAChB,CAAC,CAAC;;EAEF;EACAnD,QAAQ,CAACyD,GAAG,CAACrB,aAAa,CAACsB,UAAU,CAAC;;EAEtC;EACA1D,QAAQ,CAAC2D,GAAG,CAAC,GAAG,EAAE,YAAY5D,QAAQ,CAAC6D,QAAQ,CAACC,QAAQ,CAAC,CAAC,CAAC;EAC3D7D,QAAQ,CAAC2D,GAAG,CAAC,SAAS,EAAE,YAAY5D,QAAQ,CAAC6D,QAAQ,CAACE,SAAS,CAAC,CAAC,CAAC;;EAElE;EACA,eAAeC,KAAKA,CAAA,EAAG;IACrB,MAAM/D,QAAQ,CAACgE,MAAM,CAAC;MACpBvB,IAAI,EAAE3C,MAAM,CAACI,OAAO,CAACuC,IAAI;MACzBD,IAAI,EAAE1C,MAAM,CAACI,OAAO,CAACsC;IACvB,CAAC,CAAC;EACJ;;EAEA;EACA,eAAeyB,IAAIA,CAAA,EAAG;IACpB,MAAMjE,QAAQ,CAACkE,KAAK,CAAC,CAAC;EACxB;EAEA,OAAO;IACLH,KAAK;IACLE,IAAI;IACJjE;EACF,CAAC;AACH","ignoreList":[]}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './createServer';\nexport * from './types';\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiPlugin.js","names":["paramsSchema","type","properties","platform","required","apiPlugin","instance","delegate","get","_request","reply","api","send","data","getPlatforms","notImplemented","schema","params","request","getAssets","getCompilationStats"],"sources":["../../../src/plugins/api/apiPlugin.ts"],"sourcesContent":["import type { FastifyInstance } from 'fastify';\nimport type { Server } from '../../types';\n\nconst paramsSchema = {\n type: 'object',\n properties: {\n platform: {\n type: 'string',\n },\n },\n required: ['platform'],\n};\n\ntype Params = { platform: string };\n\nasync function apiPlugin(\n instance: FastifyInstance,\n { delegate }: { delegate: Server.Delegate }\n) {\n instance.get('/platforms', async (_request, reply) =>\n delegate.api\n ? reply.send({ data: await delegate.api.getPlatforms() })\n : reply.notImplemented('Missing API delegate implementation')\n );\n\n instance.get<{ Params: Params }>(\n '/:platform/assets',\n { schema: { params: paramsSchema } },\n async (request, reply) =>\n delegate.api\n ? reply.send({\n data: await delegate.api.getAssets(request.params.platform),\n })\n : reply.notImplemented('Missing API delegate implementation')\n );\n\n instance.get<{ Params: Params }>(\n '/:platform/stats',\n { schema: { params: paramsSchema } },\n async (request, reply) =>\n delegate.api\n ? reply.send({\n data: await delegate.api?.getCompilationStats(\n request.params.platform\n ),\n })\n : reply.notImplemented('Missing API delegate implementation')\n );\n}\n\nexport default apiPlugin;\n"],"mappings":"AAGA,MAAMA,YAAY,GAAG;EACnBC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE;IACVC,QAAQ,EAAE;MACRF,IAAI,EAAE;IACR;EACF,CAAC;EACDG,QAAQ,EAAE,CAAC,UAAU;AACvB,CAAC;AAID,eAAeC,SAASA,CACtBC,QAAyB,EACzB;EAAEC;AAAwC,CAAC,EAC3C;EACAD,QAAQ,CAACE,GAAG,CAAC,YAAY,EAAE,OAAOC,QAAQ,EAAEC,KAAK,KAC/CH,QAAQ,CAACI,GAAG,GACRD,KAAK,CAACE,IAAI,CAAC;IAAEC,IAAI,EAAE,MAAMN,QAAQ,CAACI,GAAG,CAACG,YAAY,CAAC;EAAE,CAAC,CAAC,GACvDJ,KAAK,CAACK,cAAc,CAAC,qCAAqC,CAChE,CAAC;EAEDT,QAAQ,CAACE,GAAG,CACV,mBAAmB,EACnB;IAAEQ,MAAM,EAAE;MAAEC,MAAM,EAAEjB;IAAa;EAAE,CAAC,EACpC,OAAOkB,OAAO,EAAER,KAAK,KACnBH,QAAQ,CAACI,GAAG,GACRD,KAAK,CAACE,IAAI,CAAC;IACTC,IAAI,EAAE,MAAMN,QAAQ,CAACI,GAAG,CAACQ,SAAS,CAACD,OAAO,CAACD,MAAM,CAACd,QAAQ;EAC5D,CAAC,CAAC,GACFO,KAAK,CAACK,cAAc,CAAC,qCAAqC,CAClE,CAAC;EAEDT,QAAQ,CAACE,GAAG,CACV,kBAAkB,EAClB;IAAEQ,MAAM,EAAE;MAAEC,MAAM,EAAEjB;IAAa;EAAE,CAAC,EACpC,OAAOkB,OAAO,EAAER,KAAK,KACnBH,QAAQ,CAACI,GAAG,GACRD,KAAK,CAACE,IAAI,CAAC;IACTC,IAAI,EAAE,MAAMN,QAAQ,CAACI,GAAG,EAAES,mBAAmB,CAC3CF,OAAO,CAACD,MAAM,CAACd,QACjB;EACF,CAAC,CAAC,GACFO,KAAK,CAACK,cAAc,CAAC,qCAAqC,CAClE,CAAC;AACH;AAEA,eAAeV,SAAS","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/api/index.ts"],"sourcesContent":["export { default } from './apiPlugin';\n"],"mappings":"SAASA,OAAO","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"compilerPlugin.js","names":["fastifyPlugin","compilerPlugin","instance","delegate","route","method","url","schema","querystring","type","properties","platform","handler","request","reply","filename","params","query","log","error","notFound","compiler","inferPlatform","multipart","asMultipart","sendProgress","completed","total","writeChunk","JSON","stringify","done","asset","getAsset","mimeType","getMimeType","buffer","Buffer","isBuffer","from","setHeader","String","byteLength","end","code","send","message","name","dependencies"],"sources":["../../../src/plugins/compiler/compilerPlugin.ts"],"sourcesContent":["import type { FastifyInstance } from 'fastify';\nimport fastifyPlugin from 'fastify-plugin';\nimport type { Server } from '../../types';\nimport type { SendProgress } from '../../types';\n\nasync function compilerPlugin(\n instance: FastifyInstance,\n { delegate }: { delegate: Server.Delegate }\n) {\n instance.route({\n method: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD'],\n url: '/*',\n schema: {\n querystring: {\n type: 'object',\n properties: {\n platform: {\n type: 'string',\n },\n },\n },\n },\n handler: async (request, reply) => {\n const filename = (request.params as { '*'?: string })['*'];\n let { platform } = request.query as { platform?: string };\n\n if (!filename) {\n // This technically should never happen - this route should not be called if file is missing.\n request.log.error('File was not provided');\n return reply.notFound();\n }\n\n // Let consumer infer the platform. If function is not provided fallback\n // to platform query param.\n platform = delegate.compiler.inferPlatform?.(request.url) ?? platform;\n\n const multipart = reply.asMultipart();\n\n const sendProgress: SendProgress = ({ completed, total }) => {\n multipart?.writeChunk(\n { 'Content-Type': 'application/json' },\n JSON.stringify({\n done: completed,\n total,\n })\n );\n };\n\n try {\n const asset = await delegate.compiler.getAsset(\n filename,\n platform,\n sendProgress\n );\n const mimeType = delegate.compiler.getMimeType(\n filename,\n platform,\n asset\n );\n\n if (multipart) {\n const buffer = Buffer.isBuffer(asset) ? asset : Buffer.from(asset);\n multipart.setHeader('Content-Type', `${mimeType}; charset=UTF-8`);\n multipart.setHeader(\n 'Content-Length',\n String(Buffer.byteLength(buffer))\n );\n multipart.end(buffer);\n } else {\n return reply.code(200).type(mimeType).send(asset);\n }\n } catch (error) {\n request.log.error(error);\n return reply.notFound((error as Error).message);\n }\n },\n });\n}\n\nexport default fastifyPlugin(compilerPlugin, {\n name: 'compiler-plugin',\n dependencies: ['@fastify/sensible', 'multipart-plugin'],\n});\n"],"mappings":"AACA,OAAOA,aAAa,MAAM,gBAAgB;AAI1C,eAAeC,cAAcA,CAC3BC,QAAyB,EACzB;EAAEC;AAAwC,CAAC,EAC3C;EACAD,QAAQ,CAACE,KAAK,CAAC;IACbC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC;IAC3DC,GAAG,EAAE,IAAI;IACTC,MAAM,EAAE;MACNC,WAAW,EAAE;QACXC,IAAI,EAAE,QAAQ;QACdC,UAAU,EAAE;UACVC,QAAQ,EAA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X,SAAS,CAACiB,SAAS,CACjB,gBAAgB,EAChBC,MAAM,CAACJ,MAAM,CAACK,UAAU,CAACN,MAAM,CAAC,CAClC,CAAC;UACDb,SAAS,CAACoB,GAAG,CAACP,MAAM,CAAC;QACvB,CAAC,MAAM;UACL,OAAOtB,KAAK,CAAC8B,IAAI,CAAC,GAAG,CAAC,CAACnC,IAAI,CAACyB,QAAQ,CAAC,CAACW,IAAI,CAACb,KAAK,CAAC;QACnD;MACF,CAAC,CAAC,OAAOb,KAAK,EAAE;QACdN,OAAO,CAACK,GAAG,CAACC,KAAK,CAACA,KAAK,CAAC;QACxB,OAAOL,KAAK,CAACM,QAAQ,CAAED,KAAK,CAAW2B,OAAO,CAAC;MACjD;IACF;EACF,CAAC,CAAC;AACJ;AAEA,eAAe9C,aAAa,CAACC,cAAc,EAAE;EAC3C8C,IAAI,EAAE,iBAAiB;EACvBC,YAAY,EAAE,CAAC,mBAAmB,EAAE,kBAAkB;AACxD,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/compiler/index.ts"],"sourcesContent":["export { default } from './compilerPlugin';\nexport * from './types';\n"],"mappings":"SAASA,OAAO;AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/plugins/compiler/types.ts"],"sourcesContent":["import type { SendProgress } from '../../types';\n\n/**\n * Delegate with implementation for compiler-specific functions.\n */\nexport interface CompilerDelegate {\n /**\n * Get compiled asset content.\n *\n * If the compilation is in progress, it should wait until compilation finishes and then return the asset.\n *\n * @param filename Filename of the asset to get.\n * @param platform Platform of the asset to get.\n * @param sendProgress Function to notify the client who requested the asset about compilation progress.\n */\n getAsset: (\n filename: string,\n platform: string | undefined,\n sendProgress?: SendProgress\n ) => Promise<string | Buffer>;\n\n /**\n * Detect MIME type of the asset from `filename`, `platform` or `data` (or from combination of either).\n *\n * @param filename Filename of the asset.\n * @param platform Platform of the asset.\n * @param data Asset's content.\n */\n getMimeType: (\n filename: string,\n platform: string | undefined,\n data: string | Buffer\n ) => string;\n\n /**\n * Detect the platform from the URI - either from filename, query params or both.\n *\n * @param uri URI string.\n */\n inferPlatform?: (uri: string) => string | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"devtoolsPlugin.js","names":["openStackFrameInEditorMiddleware","openURLMiddleware","fastifyPlugin","devtoolsPlugin","instance","options","use","watchFolders","rootDir","route","method","url","handler","_request","reply","wss","messageServer","broadcast","send","name","dependencies"],"sources":["../../../src/plugins/devtools/devtoolsPlugin.ts"],"sourcesContent":["import {\n openStackFrameInEditorMiddleware,\n openURLMiddleware,\n} from '@react-native-community/cli-server-api';\nimport type { FastifyInstance } from 'fastify';\nimport fastifyPlugin from 'fastify-plugin';\nimport type { Server } from '../../types';\n\nasync function devtoolsPlugin(\n instance: FastifyInstance,\n { options }: { options: Server.Options }\n) {\n instance.use('/open-url', openURLMiddleware);\n\n instance.use(\n '/open-stack-frame',\n openStackFrameInEditorMiddleware({\n watchFolders: [options.rootDir],\n })\n );\n\n instance.route({\n method: ['GET', 'POST', 'PUT'],\n url: '/reload',\n handler: (_request, reply) => {\n instance.wss.messageServer.broadcast('reload');\n reply.send('OK');\n },\n });\n}\n\nexport default fastifyPlugin(devtoolsPlugin, {\n name: 'devtools-plugin',\n dependencies: ['wss-plugin'],\n});\n"],"mappings":"AAAA,SACEA,gCAAgC,EAChCC,iBAAiB,QACZ,wCAAwC;AAE/C,OAAOC,aAAa,MAAM,gBAAgB;AAG1C,eAAeC,cAAcA,CAC3BC,QAAyB,EACzB;EAAEC;AAAqC,CAAC,EACxC;EACAD,QAAQ,CAACE,GAAG,CAAC,WAAW,EAAEL,iBAAiB,CAAC;EAE5CG,QAAQ,CAACE,GAAG,CACV,mBAAmB,EACnBN,gCAAgC,CAAC;IAC/BO,YAAY,EAAE,CAACF,OAAO,CAACG,OAAO;EAChC,CAAC,CACH,CAAC;EAEDJ,QAAQ,CAACK,KAAK,CAAC;IACbC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;IAC9BC,GAAG,EAAE,SAAS;IACdC,OAAO,EAAEA,CAACC,QAAQ,EAAEC,KAAK,KAAK;MAC5BV,QAAQ,CAACW,GAAG,CAACC,aAAa,CAACC,SAAS,CAAC,QAAQ,CAAC;MAC9CH,KAAK,CAACI,IAAI,CAAC,IAAI,CAAC;IAClB;EACF,CAAC,CAAC;AACJ;AAEA,eAAehB,aAAa,CAACC,cAAc,EAAE;EAC3CgB,IAAI,EAAE,iBAAiB;EACvBC,YAAY,EAAE,CAAC,YAAY;AAC7B,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/devtools/index.ts"],"sourcesContent":["export { default } from './devtoolsPlugin';\n"],"mappings":"SAASA,OAAO","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"faviconPlugin.js","names":["path","fileURLToPath","fastifyFavicon","fastifyPlugin","dirname","import","meta","url","pathToImgDir","join","faviconPlugin","instance","register","name"],"sources":["../../../src/plugins/favicon/faviconPlugin.ts"],"sourcesContent":["import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { FastifyInstance } from 'fastify';\nimport fastifyFavicon from 'fastify-favicon';\nimport fastifyPlugin from 'fastify-plugin';\n\n// @ts-ignore\nconst dirname = path.dirname(fileURLToPath(import.meta.url));\nconst pathToImgDir = path.join(dirname, '../../img');\n\nasync function faviconPlugin(instance: FastifyInstance) {\n instance.register(fastifyFavicon, { path: pathToImgDir });\n}\n\nexport default fastifyPlugin(faviconPlugin, {\n name: 'favicon-plugin',\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,WAAW;AAC5B,SAASC,aAAa,QAAQ,UAAU;AAExC,OAAOC,cAAc,MAAM,iBAAiB;AAC5C,OAAOC,aAAa,MAAM,gBAAgB;;AAE1C;AACA,MAAMC,OAAO,GAAGJ,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAC5D,MAAMC,YAAY,GAAGR,IAAI,CAACS,IAAI,CAACL,OAAO,EAAE,WAAW,CAAC;AAEpD,eAAeM,aAAaA,CAACC,QAAyB,EAAE;EACtDA,QAAQ,CAACC,QAAQ,CAACV,cAAc,EAAE;IAAEF,IAAI,EAAEQ;EAAa,CAAC,CAAC;AAC3D;AAEA,eAAeL,aAAa,CAACO,aAAa,EAAE;EAC1CG,IAAI,EAAE;AACR,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/favicon/index.ts"],"sourcesContent":["export { default } from './faviconPlugin';\n"],"mappings":"SAASA,OAAO","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/multipart/index.ts"],"sourcesContent":["export { default } from './multipartPlugin';\nexport * from './types';\n"],"mappings":"SAASA,OAAO;AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"multipartPlugin.js","names":["PassThrough","fastifyPlugin","CRLF","BOUNDARY","multipartPlugin","instance","asMultipart","request","headers","accept","undefined","stream","code","header","send","serializeHeaders","Object","keys","map","key","join","writeChunk","data","isLast","chunk","write","setHeader","name","value","end","decorateReply"],"sources":["../../../src/plugins/multipart/multipartPlugin.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'node:http';\nimport { PassThrough } from 'node:stream';\nimport type { FastifyInstance, FastifyReply } from 'fastify';\nimport fastifyPlugin from 'fastify-plugin';\nimport type { MultipartHandler } from './types';\n\n/**\n * Implementation is based on:\n * https://github.com/facebook/metro/blob/347b1d7ed87995d7951aaa9fd597c04b06013dac/packages/metro/src/Server/MultipartResponse.js\n */\n\nconst CRLF = '\\r\\n';\nconst BOUNDARY = '3beqjf3apnqeu3h5jqorms4i';\n\nasync function multipartPlugin(instance: FastifyInstance) {\n function asMultipart(this: FastifyReply): MultipartHandler | undefined {\n // We should check if is included in accept or if accept has multipart/* or */*,\n // but React Native will set accept to exactly `multipart/mixed`, so a simple check\n // will suffice.\n if (this.request.headers.accept !== 'multipart/mixed') {\n return undefined;\n }\n\n const headers: IncomingHttpHeaders = {};\n const stream = new PassThrough();\n\n this.code(200)\n .header('Content-Type', `multipart/mixed; boundary=\"${BOUNDARY}\"`)\n .send(stream);\n\n function serializeHeaders(headers: IncomingHttpHeaders) {\n return Object.keys(headers)\n .map((key) => `${key}: ${headers[key]}`)\n .join(CRLF);\n }\n\n function writeChunk<T>(\n headers: IncomingHttpHeaders,\n data: T,\n isLast?: boolean\n ) {\n let chunk = `${CRLF}--${BOUNDARY}${CRLF}`;\n if (headers) {\n chunk += serializeHeaders(headers) + CRLF + CRLF;\n }\n\n if (data) {\n chunk += data;\n }\n\n if (isLast) {\n chunk += `${CRLF}--${BOUNDARY}--${CRLF}`;\n }\n\n stream.write(chunk);\n }\n\n function setHeader(name: string, value: string | string[] | undefined) {\n headers[name] = value;\n }\n\n function end<T>(data: T) {\n writeChunk(headers, data, true);\n stream.end();\n }\n\n return {\n writeChunk,\n setHeader,\n end,\n };\n }\n\n instance.decorateReply('asMultipart', asMultipart);\n}\n\nexport default fastifyPlugin(multipartPlugin, {\n name: 'multipart-plugin',\n});\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,OAAOC,aAAa,MAAM,gBAAgB;AAG1C;AACA;AACA;AACA;;AAEA,MAAMC,IAAI,GAAG,MAAM;AACnB,MAAMC,QAAQ,GAAG,0BAA0B;AAE3C,eAAeC,eAAeA,CAACC,QAAyB,EAAE;EACxD,SAASC,WAAWA,CAAA,EAAmD;IACrE;IACA;IACA;IACA,IAAI,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,KAAK,iBAAiB,EAAE;MACrD,OAAOC,SAAS;IAClB;IAEA,MAAMF,OAA4B,G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ACpD;AAEA,eAAeL,aAAa,CAACG,eAAe,EAAE;EAC5CuB,IAAI,EAAE;AACR,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/plugins/multipart/types.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'node:http';\n\nexport interface MultipartHandler {\n writeChunk: <T>(\n headers: IncomingHttpHeaders,\n data: T,\n isLast?: boolean\n ) => void;\n setHeader: (name: string, value: string | string[] | undefined) => void;\n end: <T>(data: T) => void;\n}\n\ndeclare module 'fastify' {\n interface FastifyReply {\n asMultipart: () => MultipartHandler | undefined;\n }\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Symbolicator.js","names":["URL","codeFrameColumns","SourceMapConsumer","Symbolicator","inferPlatformFromStack","stack","frame","file","searchParams","pathname","platform","get","bundleFilename","split","reverse","platformOrExtension","extension","sourceMapConsumerCache","constructor","delegate","process","logger","debug","msg","frames","startsWith","push","processedFrames","fileUrl","rawSourceMap","getSourceMap","sourceMapLength","length","sourceMapConsumer","toString","processedFrame","processFrame","codeFrame","getCodeFrame","key","destroy","lineNumber","column","collapse","consumer","lookup","originalPositionFor","line","bias","LEAST_UPPER_BOUND","source","methodName","name","shouldIncludeFrame","undefined","content","getSource","start","forceColor","location","row","fileName","error","message"],"sources":["../../../src/plugins/symbolicate/Symbolicator.ts"],"sourcesContent":["import { URL } from 'node:url';\nimport { codeFrameColumns } from '@babel/code-frame';\nimport type { FastifyLoggerInstance } from 'fastify';\nimport { SourceMapConsumer } from 'source-map';\nimport type {\n CodeFrame,\n InputStackFrame,\n ReactNativeStackFrame,\n StackFrame,\n SymbolicatorDelegate,\n SymbolicatorResults,\n} from './types';\n\n/**\n * Class for transforming stack traces from React Native application with using Source Map.\n * Raw stack frames produced by React Native, points to some location from the bundle\n * eg `index.bundle?platform=ios:567:1234`. By using Source Map for that bundle `Symbolicator`\n * produces frames that point to source code inside your project eg `Hello.tsx:10:9`.\n */\nexport class Symbolicator {\n /**\n * Infer platform from stack frames.\n * Usually at least one frame has `file` field with the bundle URL eg:\n * `http://localhost:8081/index.bundle?platform=ios&...`, which can be used to infer platform.\n *\n * @param stack Array of stack frames.\n * @returns Inferred platform or `undefined` if cannot infer.\n */\n static inferPlatformFromStack(stack: ReactNativeStackFrame[]) {\n for (const frame of stack) {\n if (!frame.file) {\n continue;\n }\n\n const { searchParams, pathname } = new URL(frame.file, 'file://');\n const platform = searchParams.get('platform');\n if (platform) {\n return platform;\n }\n const [bundleFilename] = pathname.split('/').reverse();\n const [, platformOrExtension, extension] = bundleFilename.split('.');\n if (extension) {\n return platformOrExtension;\n }\n }\n }\n\n /**\n * Cache with initialized `SourceMapConsumer` to improve symbolication performance.\n */\n sourceMapConsumerCache: Record<string, SourceMapConsumer> = {};\n\n /**\n * Constructs new `Symbolicator` instance.\n *\n * @param delegate Delegate instance with symbolication functions.\n */\n constructor(private delegate: SymbolicatorDelegate) {}\n\n /**\n * Process raw React Native stack frames and transform them using Source Maps.\n * Method will try to symbolicate as much data as possible, but if the Source Maps\n * are not available, invalid or the original positions/data is not found in Source Maps,\n * the method will return raw values - the same as supplied with `stack` parameter.\n * For example out of 10 frames, it's possible that only first 7 will be symbolicated and the\n * remaining 3 will be unchanged.\n *\n * @param logger Fastify logger instance.\n * @param stack Raw stack frames.\n * @returns Symbolicated stack frames.\n */\n async process(\n logger: FastifyLoggerInstance,\n stack: ReactNativeStackFrame[]\n ): Promise<SymbolicatorResults> {\n logger.debug({ msg: 'Filtering out unnecessary frames' });\n\n const frames: InputStackFrame[] = [];\n for (const frame of stack) {\n const { file } = frame;\n if (file?.startsWith('http')) {\n frames.push(frame as InputStackFrame);\n }\n }\n\n try {\n logger.debug({ msg: 'Processing frames', frames });\n\n const processedFrames: StackFrame[] = [];\n for (const frame of frames) {\n if (!this.sourceMapConsumerCache[frame.file]) {\n logger.debug({\n msg: 'Loading raw source map data',\n fileUrl: frame.file,\n });\n\n const rawSourceMap = await this.delegate.getSourceMap(frame.file);\n\n logger.debug({\n msg: 'Creating source map instance',\n fileUrl: frame.file,\n sourceMapLength: rawSourceMap.length,\n });\n const sourceMapConsumer = await new SourceMapConsumer(\n rawSourceMap.toString()\n );\n\n logger.debug({\n msg: 'Saving source map instance into cache',\n fileUrl: frame.file,\n });\n this.sourceMapConsumerCache[frame.file] = sourceMapConsumer;\n }\n\n logger.debug({\n msg: 'Symbolicating frame',\n frame,\n });\n const processedFrame = this.processFrame(frame);\n\n logger.debug({\n msg: 'Finished symbolicating frame',\n frame,\n });\n processedFrames.push(processedFrame);\n }\n\n const codeFrame =\n (await this.getCodeFrame(logger, processedFrames)) ?? null;\n\n logger.debug({\n msg: 'Finished symbolicating frames',\n processedFrames,\n codeFrame,\n });\n\n return {\n stack: processedFrames,\n codeFrame,\n };\n } finally {\n for (const key in this.sourceMapConsumerCache) {\n this.sourceMapConsumerCache[key].destroy();\n delete this.sourceMapConsumerCache[key];\n }\n }\n }\n\n private processFrame(frame: InputStackFrame): StackFrame {\n if (!frame.lineNumber || !frame.column) {\n return {\n ...frame,\n collapse: false,\n };\n }\n\n const consumer = this.sourceMapConsumerCache[frame.file];\n if (!consumer) {\n return {\n ...frame,\n collapse: false,\n };\n }\n\n const lookup = consumer.originalPositionFor({\n line: frame.lineNumber,\n column: frame.column,\n bias: SourceMapConsumer.LEAST_UPPER_BOUND,\n });\n\n // If lookup fails, we get the same shape object, but with\n // all values set to null\n if (!lookup.source) {\n // It is better to gracefully return the original frame\n // than to throw an exception\n return {\n ...frame,\n collapse: false,\n };\n }\n\n return {\n lineNumber: lookup.line || frame.lineNumber,\n column: lookup.column || frame.column,\n file: lookup.source,\n methodName: lookup.name || frame.methodName,\n collapse: false,\n };\n }\n\n private async getCodeFrame(\n logger: FastifyLoggerInstance,\n processedFrames: StackFrame[]\n ): Promise<CodeFrame | undefined> {\n for (const frame of processedFrames) {\n if (frame.collapse || !frame.lineNumber || !frame.column) {\n continue;\n }\n\n if (!this.delegate.shouldIncludeFrame(frame)) {\n return undefined;\n }\n\n logger.debug({\n msg: 'Generating code frame',\n frame,\n });\n\n try {\n return {\n content: codeFrameColumns(\n (await this.delegate.getSource(frame.file)).toString(),\n {\n start: { column: frame.column, line: frame.lineNumber },\n },\n { forceColor: true }\n ),\n location: {\n row: frame.lineNumber,\n column: frame.column,\n },\n fileName: frame.file,\n };\n } catch (error) {\n logger.error({\n msg: 'Failed to create code frame',\n error: (error as Error).message,\n });\n }\n\n return undefined;\n }\n }\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,UAAU;AAC9B,SAASC,gBAAgB,QAAQ,mBAAmB;AAEpD,SAASC,iBAAiB,QAAQ,YAAY;AAU9C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,CAAC;EACxB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,sBAAsBA,CAACC,KAA8B,EAAE;IAC5D,KAAK,MAAMC,KAAK,IAAID,KAAK,EAAE;MACzB,IAAI,CAACC,KAAK,CAACC,IAAI,EAAE;QACf;MACF;MAEA,MAAM;QAAEC,YAAY;QAAEC;MAAS,CAAC,GAAG,IAAIT,GAAG,CAACM,KAAK,CAACC,IAAI,EAAE,SAAS,CAAC;MACjE,MAAMG,QAAQ,GAAGF,YAAY,CAACG,GAAG,CAAC,UAAU,CAAC;MAC7C,IAAID,QAAQ,EAAE;QACZ,OAAOA,QAAQ;MACjB;MACA,MAAM,CAACE,cAAc,CAAC,GAAGH,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC,CAACC,OAAO,CAAC,CAAC;MACtD,MAAM,GAAGC,mBAAmB,EAAEC,SAAS,CAAC,GAAGJ,cAAc,CAACC,KAAK,CAAC,GAAG,CAAC;MACpE,IAAIG,SAAS,EAAE;QACb,OAAOD,mBAAmB;MAC5B;IACF;EACF;;EAEA;AACF;AACA;EACEE,sBAAsB,GAAsC,CAAC,CAAC;;EAE9D;AACF;AACA;AACA;AACA;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