@callstack/repack-dev-server 1.0.0-next.2 → 1.0.0-next.3

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 (121) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/createServer.d.ts +0 -0
  3. package/dist/createServer.js +5 -1
  4. package/dist/createServer.js.map +1 -1
  5. package/dist/img/favicon.ico +0 -0
  6. package/dist/index.d.ts +0 -0
  7. package/dist/index.js +0 -0
  8. package/dist/index.js.map +0 -0
  9. package/dist/plugins/api/apiPlugin.d.ts +0 -0
  10. package/dist/plugins/api/apiPlugin.js +0 -0
  11. package/dist/plugins/api/apiPlugin.js.map +0 -0
  12. package/dist/plugins/api/index.d.ts +0 -0
  13. package/dist/plugins/api/index.js +0 -0
  14. package/dist/plugins/api/index.js.map +0 -0
  15. package/dist/plugins/compiler/compilerPlugin.d.ts +0 -0
  16. package/dist/plugins/compiler/compilerPlugin.js +0 -0
  17. package/dist/plugins/compiler/compilerPlugin.js.map +0 -0
  18. package/dist/plugins/compiler/index.d.ts +0 -0
  19. package/dist/plugins/compiler/index.js +0 -0
  20. package/dist/plugins/compiler/index.js.map +0 -0
  21. package/dist/plugins/compiler/types.d.ts +0 -0
  22. package/dist/plugins/compiler/types.js +0 -0
  23. package/dist/plugins/compiler/types.js.map +0 -0
  24. package/dist/plugins/devtools/devtoolsPlugin.d.ts +0 -0
  25. package/dist/plugins/devtools/devtoolsPlugin.js +0 -0
  26. package/dist/plugins/devtools/devtoolsPlugin.js.map +0 -0
  27. package/dist/plugins/devtools/index.d.ts +0 -0
  28. package/dist/plugins/devtools/index.js +0 -0
  29. package/dist/plugins/devtools/index.js.map +0 -0
  30. package/dist/plugins/favicon/faviconPlugin.d.ts +3 -0
  31. package/dist/plugins/favicon/faviconPlugin.js +15 -0
  32. package/dist/plugins/favicon/faviconPlugin.js.map +1 -0
  33. package/dist/plugins/favicon/index.d.ts +1 -0
  34. package/dist/plugins/favicon/index.js +2 -0
  35. package/dist/plugins/favicon/index.js.map +1 -0
  36. package/dist/plugins/multipart/index.d.ts +0 -0
  37. package/dist/plugins/multipart/index.js +0 -0
  38. package/dist/plugins/multipart/index.js.map +0 -0
  39. package/dist/plugins/multipart/multipartPlugin.d.ts +0 -0
  40. package/dist/plugins/multipart/multipartPlugin.js +0 -0
  41. package/dist/plugins/multipart/multipartPlugin.js.map +0 -0
  42. package/dist/plugins/multipart/types.d.ts +0 -0
  43. package/dist/plugins/multipart/types.js +0 -0
  44. package/dist/plugins/multipart/types.js.map +0 -0
  45. package/dist/plugins/symbolicate/Symbolicator.d.ts +0 -0
  46. package/dist/plugins/symbolicate/Symbolicator.js +0 -0
  47. package/dist/plugins/symbolicate/Symbolicator.js.map +0 -0
  48. package/dist/plugins/symbolicate/index.d.ts +0 -0
  49. package/dist/plugins/symbolicate/index.js +0 -0
  50. package/dist/plugins/symbolicate/index.js.map +0 -0
  51. package/dist/plugins/symbolicate/sybmolicatePlugin.d.ts +0 -0
  52. package/dist/plugins/symbolicate/sybmolicatePlugin.js +0 -0
  53. package/dist/plugins/symbolicate/sybmolicatePlugin.js.map +0 -0
  54. package/dist/plugins/symbolicate/types.d.ts +0 -0
  55. package/dist/plugins/symbolicate/types.js +0 -0
  56. package/dist/plugins/symbolicate/types.js.map +0 -0
  57. package/dist/plugins/wss/WebSocketRouter.d.ts +0 -0
  58. package/dist/plugins/wss/WebSocketRouter.js +0 -0
  59. package/dist/plugins/wss/WebSocketRouter.js.map +0 -0
  60. package/dist/plugins/wss/WebSocketServer.d.ts +0 -0
  61. package/dist/plugins/wss/WebSocketServer.js +0 -0
  62. package/dist/plugins/wss/WebSocketServer.js.map +0 -0
  63. package/dist/plugins/wss/index.d.ts +0 -0
  64. package/dist/plugins/wss/index.js +0 -0
  65. package/dist/plugins/wss/index.js.map +0 -0
  66. package/dist/plugins/wss/servers/HermesInspectorProxy.d.ts +0 -0
  67. package/dist/plugins/wss/servers/HermesInspectorProxy.js +0 -0
  68. package/dist/plugins/wss/servers/HermesInspectorProxy.js.map +0 -0
  69. package/dist/plugins/wss/servers/WebSocketApiServer.d.ts +0 -0
  70. package/dist/plugins/wss/servers/WebSocketApiServer.js +0 -0
  71. package/dist/plugins/wss/servers/WebSocketApiServer.js.map +0 -0
  72. package/dist/plugins/wss/servers/WebSocketDebuggerServer.d.ts +0 -0
  73. package/dist/plugins/wss/servers/WebSocketDebuggerServer.js +0 -0
  74. package/dist/plugins/wss/servers/WebSocketDebuggerServer.js.map +0 -0
  75. package/dist/plugins/wss/servers/WebSocketDevClientServer.d.ts +0 -0
  76. package/dist/plugins/wss/servers/WebSocketDevClientServer.js +0 -0
  77. package/dist/plugins/wss/servers/WebSocketDevClientServer.js.map +0 -0
  78. package/dist/plugins/wss/servers/WebSocketEventsServer.d.ts +0 -0
  79. package/dist/plugins/wss/servers/WebSocketEventsServer.js +0 -0
  80. package/dist/plugins/wss/servers/WebSocketEventsServer.js.map +0 -0
  81. package/dist/plugins/wss/servers/WebSocketHMRServer.d.ts +0 -0
  82. package/dist/plugins/wss/servers/WebSocketHMRServer.js +0 -0
  83. package/dist/plugins/wss/servers/WebSocketHMRServer.js.map +0 -0
  84. package/dist/plugins/wss/servers/WebSocketMessageServer.d.ts +0 -0
  85. package/dist/plugins/wss/servers/WebSocketMessageServer.js +0 -0
  86. package/dist/plugins/wss/servers/WebSocketMessageServer.js.map +0 -0
  87. package/dist/plugins/wss/types.d.ts +0 -0
  88. package/dist/plugins/wss/types.js +0 -0
  89. package/dist/plugins/wss/types.js.map +0 -0
  90. package/dist/plugins/wss/wssPlugin.d.ts +0 -0
  91. package/dist/plugins/wss/wssPlugin.js +0 -0
  92. package/dist/plugins/wss/wssPlugin.js.map +0 -0
  93. package/dist/types.d.ts +0 -0
  94. package/dist/types.js +0 -0
  95. package/dist/types.js.map +0 -0
  96. package/package.json +5 -3
  97. package/docs/README.md +0 -28
  98. package/docs/enums/Internal.EventTypes.md +0 -41
  99. package/docs/functions/createServer.md +0 -21
  100. package/docs/interfaces/CodeFrame.md +0 -48
  101. package/docs/interfaces/CompilerDelegate.md +0 -83
  102. package/docs/interfaces/HmrDelegate.md +0 -51
  103. package/docs/interfaces/InputStackFrame.md +0 -76
  104. package/docs/interfaces/ProgressData.md +0 -34
  105. package/docs/interfaces/ReactNativeStackFrame.md +0 -58
  106. package/docs/interfaces/Server.Api.Asset.md +0 -36
  107. package/docs/interfaces/Server.Api.CompilationStats.md +0 -9
  108. package/docs/interfaces/Server.Api.Delegate.md +0 -75
  109. package/docs/interfaces/Server.Config.md +0 -49
  110. package/docs/interfaces/Server.Delegate.md +0 -88
  111. package/docs/interfaces/Server.DelegateContext.md +0 -134
  112. package/docs/interfaces/Server.LoggerDelegate.md +0 -33
  113. package/docs/interfaces/Server.MessagesDelegate.md +0 -44
  114. package/docs/interfaces/Server.Options.md +0 -70
  115. package/docs/interfaces/StackFrame.md +0 -85
  116. package/docs/interfaces/SymbolicatorDelegate.md +0 -77
  117. package/docs/interfaces/SymbolicatorResults.md +0 -30
  118. package/docs/modules/Internal.md +0 -11
  119. package/docs/modules/Server.Api.md +0 -11
  120. package/docs/modules/Server.md +0 -16
  121. package/docs/types/SendProgress.md +0 -26
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @callstack/repack-dev-server
2
2
 
3
+ ## 1.0.0-next.3
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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.
8
+
9
+ * [#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
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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
14
+
3
15
  ## 1.0.0-next.2
4
16
 
5
17
  ### Patch Changes
File without changes
@@ -8,6 +8,7 @@ import compilerPlugin from "./plugins/compiler/index.js";
8
8
  import devtoolsPlugin from "./plugins/devtools/index.js";
9
9
  import apiPlugin from "./plugins/api/index.js";
10
10
  import wssPlugin from "./plugins/wss/index.js";
11
+ import faviconPlugin from "./plugins/favicon/index.js";
11
12
  import { Internal } from "./types.js";
12
13
  import symbolicatePlugin from "./plugins/symbolicate/index.js";
13
14
  /**
@@ -87,7 +88,10 @@ export async function createServer(config) {
87
88
  root: debuggerAppPath,
88
89
  prefix: '/debugger-ui',
89
90
  prefixAvoidTrailingSlash: true
90
- });
91
+ }); // below is to prevent showing `GET 400 /favicon.ico`
92
+ // errors in console when requesting the bundle via browser
93
+
94
+ await instance.register(faviconPlugin);
91
95
  instance.addHook('onSend', async (request, reply, payload) => {
92
96
  reply.header('X-Content-Type-Options', 'nosniff');
93
97
  const [pathname] = request.url.split('?');
@@ -1 +1 @@
1
- {"version":3,"file":"createServer.js","names":["Writable","Fastify","fastifySensible","fastifyStatic","debuggerAppPath","multipartPlugin","compilerPlugin","devtoolsPlugin","apiPlugin","wssPlugin","Internal","symbolicatePlugin","createServer","config","delegate","instance","logger","level","stream","write","chunk","_encoding","callback","log","JSON","parse","toString","onMessage","wss","apiServer","send","options","https","undefined","notifyBuildStart","platform","event","EventTypes","BuildStart","notifyBuildEnd","BuildEnd","broadcastToHmrClients","clientIds","hmrServer","broadcastToMessageClients","method","params","messageServer","broadcast","register","prefix","root","prefixAvoidTrailingSlash","addHook","request","reply","payload","header","pathname","url","split","endsWith","get","messages","getHello","getStatus","start","listen","port","host","stop","close"],"sources":["../src/createServer.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport Fastify from 'fastify';\nimport fastifySensible from '@fastify/sensible';\nimport fastifyStatic from '@fastify/static';\nimport debuggerAppPath from '@callstack/repack-debugger-app';\nimport multipartPlugin from './plugins/multipart';\nimport compilerPlugin from './plugins/compiler';\nimport devtoolsPlugin from './plugins/devtools';\nimport apiPlugin from './plugins/api';\nimport wssPlugin from './plugins/wss';\nimport { Internal, Server } from './types';\nimport symbolicatePlugin from './plugins/symbolicate';\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 let delegate: Server.Delegate;\n\n /** Fastify instance powering the development server. */\n const instance = Fastify({\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 = 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 // Register plugins\n await instance.register(fastifySensible);\n await instance.register(wssPlugin, {\n options: config.options,\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(symbolicatePlugin, {\n delegate,\n });\n await instance.register(devtoolsPlugin, {\n options: config.options,\n });\n\n await instance.register(fastifyStatic, {\n root: debuggerAppPath,\n prefix: '/debugger-ui',\n prefixAvoidTrailingSlash: true,\n });\n\n instance.addHook('onSend', async (request, reply, payload) => {\n reply.header('X-Content-Type-Options', 'nosniff');\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 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(config.options.port, config.options.host);\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,QAAT,QAAyB,QAAzB;AACA,OAAOC,OAAP,MAAoB,SAApB;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,eAAP,MAA4B,gCAA5B;OACOC,e;OACAC,c;OACAC,c;OACAC,S;OACAC,S;SACEC,Q;OACFC,iB;AAEP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,eAAeC,YAAf,CAA4BC,MAA5B,EAAmD;EACxD,IAAIC,QAAJ;EAEA;;EACA,MAAMC,QAAQ,GAAGd,OAAO,CAAC;IACvBe,MAAM,EAAE;MACNC,KAAK,EAAE,OADD;MAENC,MAAM,EAAE,IAAIlB,QAAJ,CAAa;QACnBmB,KAAK,EAAE,CAACC,KAAD,EAAQC,SAAR,EAAmBC,QAAnB,KAAgC;UAAA;;UACrC,MAAMC,GAAG,GAAGC,IAAI,CAACC,KAAL,CAAWL,KAAK,CAACM,QAAN,EAAX,CAAZ;UACA,aAAAZ,QAAQ,UAAR,8CAAUE,MAAV,CAAiBW,SAAjB,CAA2BJ,GAA3B;UACA,iBAAAR,QAAQ,CAACa,GAAT,gEAAcC,SAAd,CAAwBC,IAAxB,CAA6BP,GAA7B;UACAD,QAAQ;QACT;MANkB,CAAb;IAFF,CADe;IAYvB,IAAIT,MAAM,CAACkB,OAAP,CAAeC,KAAf,GAAuB;MAAEA,KAAK,EAAEnB,MAAM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kB,OAAP,CAAesC,IAApD,CAAN;EACD;EAED;;;EACA,eAAeC,IAAf,GAAsB;IACpB,MAAMvD,QAAQ,CAACwD,KAAT,EAAN;EACD;;EAED,OAAO;IACLL,KADK;IAELI,IAFK;IAGLvD;EAHK,CAAP;AAKD"}
1
+ {"version":3,"file":"createServer.js","names":["Writable","Fastify","fastifySensible","fastifyStatic","debuggerAppPath","multipartPlugin","compilerPlugin","devtoolsPlugin","apiPlugin","wssPlugin","faviconPlugin","Internal","symbolicatePlugin","createServer","config","delegate","instance","logger","level","stream","write","chunk","_encoding","callback","log","JSON","parse","toString","onMessage","wss","apiServer","send","options","https","undefined","notifyBuildStart","platform","event","EventTypes","BuildStart","notifyBuildEnd","BuildEnd","broadcastToHmrClients","clientIds","hmrServer","broadcastToMessageClients","method","params","messageServer","broadcast","register","prefix","root","prefixAvoidTrailingSlash","addHook","request","reply","payload","header","pathname","url","split","endsWith","get","messages","getHello","getStatus","start","listen","port","host","stop","close"],"sources":["../src/createServer.ts"],"sourcesContent":["import { Writable } from 'stream';\nimport Fastify from 'fastify';\nimport fastifySensible from '@fastify/sensible';\nimport fastifyStatic from '@fastify/static';\nimport debuggerAppPath from '@callstack/repack-debugger-app';\nimport multipartPlugin from './plugins/multipart';\nimport compilerPlugin from './plugins/compiler';\nimport devtoolsPlugin from './plugins/devtools';\nimport apiPlugin from './plugins/api';\nimport wssPlugin from './plugins/wss';\nimport faviconPlugin from './plugins/favicon';\nimport { Internal, Server } from './types';\nimport symbolicatePlugin from './plugins/symbolicate';\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 let delegate: Server.Delegate;\n\n /** Fastify instance powering the development server. */\n const instance = Fastify({\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 = 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 // Register plugins\n await instance.register(fastifySensible);\n await instance.register(wssPlugin, {\n options: config.options,\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(symbolicatePlugin, {\n delegate,\n });\n await instance.register(devtoolsPlugin, {\n options: config.options,\n });\n\n await instance.register(fastifyStatic, {\n root: debuggerAppPath,\n prefix: '/debugger-ui',\n prefixAvoidTrailingSlash: true,\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\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 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(config.options.port, config.options.host);\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,QAAT,QAAyB,QAAzB;AACA,OAAOC,OAAP,MAAoB,SAApB;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,aAAP,M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E,wBAAwB,EAAE;EAHW,CAAjC,CAAN,CA9DwD,CAmExD;EACA;;EACA,MAAMrC,QAAQ,CAACkC,QAAT,CAAkBxC,aAAlB,CAAN;EAEAM,QAAQ,CAACsC,OAAT,CAAiB,QAAjB,EAA2B,OAAOC,OAAP,EAAgBC,KAAhB,EAAuBC,OAAvB,KAAmC;IAC5DD,KAAK,CAACE,MAAN,CAAa,wBAAb,EAAuC,SAAvC;IAEA,MAAM,CAACC,QAAD,IAAaJ,OAAO,CAACK,GAAR,CAAYC,KAAZ,CAAkB,GAAlB,CAAnB;;IACA,IAAIF,QAAQ,CAACG,QAAT,CAAkB,MAAlB,CAAJ,EAA+B;MAC7BN,KAAK,CAACE,MAAN,CAAa,6BAAb,EAA4C,qBAA5C;IACD;;IAED,OAAOD,OAAP;EACD,CATD,EAvEwD,CAkFxD;;EACAzC,QAAQ,CAAC+C,GAAT,CAAa,GAAb,EAAkB,YAAYhD,QAAQ,CAACiD,QAAT,CAAkBC,QAAlB,EAA9B;EACAjD,QAAQ,CAAC+C,GAAT,CAAa,SAAb,EAAwB,YAAYhD,QAAQ,CAACiD,QAAT,CAAkBE,SAAlB,EAApC;EAEA;;EACA,eAAeC,KAAf,GAAuB;IACrB,MAAMnD,QAAQ,CAACoD,MAAT,CAAgBtD,MAAM,CAACkB,OAAP,CAAeqC,IAA/B,EAAqCvD,MAAM,CAACkB,OAAP,CAAesC,IAApD,CAAN;EACD;EAED;;;EACA,eAAeC,IAAf,GAAsB;IACpB,MAAMvD,QAAQ,CAACwD,KAAT,EAAN;EACD;;EAED,OAAO;IACLL,KADK;IAELI,IAFK;IAGLvD;EAHK,CAAP;AAKD"}
Binary file
package/dist/index.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
package/dist/index.js.map CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ declare const _default: import("fastify").FastifyPluginAsync<unknown, import("http").Server>;
3
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import fastifyFavicon from 'fastify-favicon';
2
+ import fastifyPlugin from 'fastify-plugin'; // @ts-ignore
3
+
4
+ const pathToImg = new URL('../../img', import.meta.url).pathname;
5
+
6
+ async function faviconPlugin(instance) {
7
+ instance.register(fastifyFavicon, {
8
+ path: pathToImg
9
+ });
10
+ }
11
+
12
+ export default fastifyPlugin(faviconPlugin, {
13
+ name: 'favicon-plugin'
14
+ });
15
+ //# sourceMappingURL=faviconPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faviconPlugin.js","names":["fastifyFavicon","fastifyPlugin","pathToImg","URL","import","meta","url","pathname","faviconPlugin","instance","register","path","name"],"sources":["../../../src/plugins/favicon/faviconPlugin.ts"],"sourcesContent":["import fastifyFavicon from 'fastify-favicon';\nimport type { FastifyInstance } from 'fastify';\nimport fastifyPlugin from 'fastify-plugin';\n\n// @ts-ignore\nconst pathToImg = new URL('../../img', import.meta.url).pathname;\n\nasync function faviconPlugin(instance: FastifyInstance) {\n instance.register(fastifyFavicon, { path: pathToImg });\n}\n\nexport default fastifyPlugin(faviconPlugin, {\n name: 'favicon-plugin',\n});\n"],"mappings":"AAAA,OAAOA,cAAP,MAA2B,iBAA3B;AAEA,OAAOC,aAAP,MAA0B,gBAA1B,C,CAEA;;AACA,MAAMC,SAAS,GAAG,IAAIC,GAAJ,CAAQ,WAAR,EAAqBC,MAAM,CAACC,IAAP,CAAYC,GAAjC,EAAsCC,QAAxD;;AAEA,eAAeC,aAAf,CAA6BC,QAA7B,EAAwD;EACtDA,QAAQ,CAACC,QAAT,CAAkBV,cAAlB,EAAkC;IAAEW,IAAI,EAAET;EAAR,CAAlC;AACD;;AAED,eAAeD,aAAa,CAACO,aAAD,EAAgB;EAC1CI,IAAI,EAAE;AADoC,CAAhB,CAA5B"}
@@ -0,0 +1 @@
1
+ export { default } from './faviconPlugin';
@@ -0,0 +1,2 @@
1
+ export { default } from "./faviconPlugin.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/favicon/index.ts"],"sourcesContent":["export { default } from './faviconPlugin';\n"],"mappings":"SAASA,O"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/types.d.ts CHANGED
File without changes
package/dist/types.js CHANGED
File without changes
package/dist/types.js.map CHANGED
File without changes
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": "1.0.0-next.2",
5
+ "version": "1.0.0-next.3",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -34,14 +34,15 @@
34
34
  "access": "public"
35
35
  },
36
36
  "scripts": {
37
- "build:js": "babel src --out-dir dist --extensions \".js,.cjs,.ts\" --source-maps --ignore \"**/__tests__/**\" --delete-dir-on-start",
37
+ "build:js": "babel src --out-dir dist --extensions \".js,.cjs,.ts\" --source-maps --ignore \"**/__tests__/**\" --delete-dir-on-start --copy-files",
38
38
  "build:js:watch": "yarn build:js --watch",
39
39
  "build:ts": "tsc --emitDeclarationOnly",
40
40
  "build:ts:watch": "yarn build:ts --watch --preserveWatchOutput",
41
41
  "build": "yarn build:js && yarn build:ts",
42
42
  "docs": "typedoc",
43
43
  "typecheck": "tsc --noEmit",
44
- "lint": "eslint --ext \".js,.ts\" src"
44
+ "lint": "eslint --ext \".js,.ts\" src",
45
+ "archive": "yarn build && yarn pack --out repack-dev-server-%v-$(git log -1 --format=\"%h\").tgz"
45
46
  },
46
47
  "dependencies": {
47
48
  "@babel/code-frame": "^7.16.7",
@@ -49,6 +50,7 @@
49
50
  "@fastify/sensible": "^4.1.0",
50
51
  "@fastify/static": "^5.0.2",
51
52
  "fastify": "^3.29.0",
53
+ "fastify-favicon": "^3.2.0",
52
54
  "fastify-plugin": "^3.0.1",
53
55
  "metro-inspector-proxy": "^0.71.0",
54
56
  "open": "^8.4.0",
package/docs/README.md DELETED
@@ -1,28 +0,0 @@
1
- # @callstack/repack-dev-server
2
-
3
- ## Table of contents
4
-
5
- ### Namespaces
6
-
7
- - [Internal](modules/Internal.md)
8
- - [Server](modules/Server.md)
9
-
10
- ### Interfaces
11
-
12
- - [CodeFrame](interfaces/CodeFrame.md)
13
- - [CompilerDelegate](interfaces/CompilerDelegate.md)
14
- - [HmrDelegate](interfaces/HmrDelegate.md)
15
- - [InputStackFrame](interfaces/InputStackFrame.md)
16
- - [ProgressData](interfaces/ProgressData.md)
17
- - [ReactNativeStackFrame](interfaces/ReactNativeStackFrame.md)
18
- - [StackFrame](interfaces/StackFrame.md)
19
- - [SymbolicatorDelegate](interfaces/SymbolicatorDelegate.md)
20
- - [SymbolicatorResults](interfaces/SymbolicatorResults.md)
21
-
22
- ### Type Aliases
23
-
24
- - [SendProgress](types/SendProgress.md)
25
-
26
- ### Functions
27
-
28
- - [createServer](functions/createServer.md)
@@ -1,41 +0,0 @@
1
- # Enumeration: EventTypes
2
-
3
- [Internal](../modules/Internal.md).EventTypes
4
-
5
- ## Table of contents
6
-
7
- ### Enumeration Members
8
-
9
- - [BuildEnd](Internal.EventTypes.md#buildend)
10
- - [BuildStart](Internal.EventTypes.md#buildstart)
11
- - [HmrEvent](Internal.EventTypes.md#hmrevent)
12
-
13
- ## Enumeration Members
14
-
15
- ### BuildEnd
16
-
17
- • **BuildEnd**
18
-
19
- #### Defined in
20
-
21
- [types.ts:200](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/types.ts#L200)
22
-
23
- ___
24
-
25
- ### BuildStart
26
-
27
- • **BuildStart**
28
-
29
- #### Defined in
30
-
31
- [types.ts:199](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/types.ts#L199)
32
-
33
- ___
34
-
35
- ### HmrEvent
36
-
37
- • **HmrEvent**
38
-
39
- #### Defined in
40
-
41
- [types.ts:201](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/types.ts#L201)
@@ -1,21 +0,0 @@
1
- # Function: createServer
2
-
3
- ▸ **createServer**(`config`): `Promise`<{ `instance`: `FastifyInstance`<`Server`, `IncomingMessage`, `ServerResponse`, `FastifyLoggerInstance`\> & `PromiseLike`<`FastifyInstance`<`Server`, `IncomingMessage`, `ServerResponse`, `FastifyLoggerInstance`\>\> ; `start`: () => `Promise`<`void`\> ; `stop`: () => `Promise`<`void`\> }\>
4
-
5
- Create instance of development server, powered by Fastify.
6
-
7
- #### Parameters
8
-
9
- | Name | Type | Description |
10
- | :------ | :------ | :------ |
11
- | `config` | [`Config`](../interfaces/Server.Config.md) | Server configuration. |
12
-
13
- #### Returns
14
-
15
- `Promise`<{ `instance`: `FastifyInstance`<`Server`, `IncomingMessage`, `ServerResponse`, `FastifyLoggerInstance`\> & `PromiseLike`<`FastifyInstance`<`Server`, `IncomingMessage`, `ServerResponse`, `FastifyLoggerInstance`\>\> ; `start`: () => `Promise`<`void`\> ; `stop`: () => `Promise`<`void`\> }\>
16
-
17
- `start` and `stop` functions as well as an underlying Fastify `instance`.
18
-
19
- #### Defined in
20
-
21
- [createServer.ts:20](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/createServer.ts#L20)
@@ -1,48 +0,0 @@
1
- # Interface: CodeFrame
2
-
3
- Represents [@babel/core-frame](https://babeljs.io/docs/en/babel-code-frame).
4
-
5
- ## Table of contents
6
-
7
- ### Properties
8
-
9
- - [content](CodeFrame.md#content)
10
- - [fileName](CodeFrame.md#filename)
11
- - [location](CodeFrame.md#location)
12
-
13
- ## Properties
14
-
15
- ### content
16
-
17
- • **content**: `string`
18
-
19
- #### Defined in
20
-
21
- [plugins/symbolicate/types.ts:29](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/plugins/symbolicate/types.ts#L29)
22
-
23
- ___
24
-
25
- ### fileName
26
-
27
- • **fileName**: `string`
28
-
29
- #### Defined in
30
-
31
- [plugins/symbolicate/types.ts:34](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/plugins/symbolicate/types.ts#L34)
32
-
33
- ___
34
-
35
- ### location
36
-
37
- • **location**: `Object`
38
-
39
- #### Type declaration
40
-
41
- | Name | Type |
42
- | :------ | :------ |
43
- | `column` | `number` |
44
- | `row` | `number` |
45
-
46
- #### Defined in
47
-
48
- [plugins/symbolicate/types.ts:30](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/plugins/symbolicate/types.ts#L30)
@@ -1,83 +0,0 @@
1
- # Interface: CompilerDelegate
2
-
3
- Delegate with implementation for compiler-specific functions.
4
-
5
- ## Table of contents
6
-
7
- ### Methods
8
-
9
- - [getAsset](CompilerDelegate.md#getasset)
10
- - [getMimeType](CompilerDelegate.md#getmimetype)
11
- - [inferPlatform](CompilerDelegate.md#inferplatform)
12
-
13
- ## Methods
14
-
15
- ### getAsset
16
-
17
- ▸ **getAsset**(`filename`, `platform`, `sendProgress?`): `Promise`<`string` \| `Buffer`\>
18
-
19
- Get compiled asset content.
20
-
21
- If the compilation is in progress, it should wait until compilation finishes and then return the asset.
22
-
23
- #### Parameters
24
-
25
- | Name | Type | Description |
26
- | :------ | :------ | :------ |
27
- | `filename` | `string` | Filename of the asset to get. |
28
- | `platform` | `string` | Platform of the asset to get. |
29
- | `sendProgress?` | [`SendProgress`](../types/SendProgress.md) | Function to notify the client who requested the asset about compilation progress. |
30
-
31
- #### Returns
32
-
33
- `Promise`<`string` \| `Buffer`\>
34
-
35
- #### Defined in
36
-
37
- [plugins/compiler/types.ts:16](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/plugins/compiler/types.ts#L16)
38
-
39
- ___
40
-
41
- ### getMimeType
42
-
43
- ▸ **getMimeType**(`filename`, `platform`, `data`): `string`
44
-
45
- Detect MIME type of the asset from `filename`, `platform` or `data` (or from combination of either).
46
-
47
- #### Parameters
48
-
49
- | Name | Type | Description |
50
- | :------ | :------ | :------ |
51
- | `filename` | `string` | Filename of the asset. |
52
- | `platform` | `string` | Platform of the asset. |
53
- | `data` | `string` \| `Buffer` | Asset's content. |
54
-
55
- #### Returns
56
-
57
- `string`
58
-
59
- #### Defined in
60
-
61
- [plugins/compiler/types.ts:29](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/plugins/compiler/types.ts#L29)
62
-
63
- ___
64
-
65
- ### inferPlatform
66
-
67
- ▸ `Optional` **inferPlatform**(`uri`): `undefined` \| `string`
68
-
69
- Detect the platform from the URI - either from filename, query params or both.
70
-
71
- #### Parameters
72
-
73
- | Name | Type | Description |
74
- | :------ | :------ | :------ |
75
- | `uri` | `string` | URI string. |
76
-
77
- #### Returns
78
-
79
- `undefined` \| `string`
80
-
81
- #### Defined in
82
-
83
- [plugins/compiler/types.ts:40](https://github.com/callstack/repack/blob/a067171/packages/dev-server/src/plugins/compiler/types.ts#L40)