@callstack/repack-dev-server 1.1.0 → 4.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/dist/createServer.d.ts +1 -1
- package/dist/createServer.js +15 -17
- package/dist/createServer.js.map +1 -1
- package/dist/plugins/api/apiPlugin.js +3 -9
- package/dist/plugins/api/apiPlugin.js.map +1 -1
- package/dist/plugins/api/index.js.map +1 -1
- package/dist/plugins/compiler/compilerPlugin.d.ts +4 -3
- package/dist/plugins/compiler/compilerPlugin.js +8 -18
- package/dist/plugins/compiler/compilerPlugin.js.map +1 -1
- package/dist/plugins/compiler/index.js.map +1 -1
- package/dist/plugins/devtools/devtoolsPlugin.d.ts +4 -3
- package/dist/plugins/devtools/devtoolsPlugin.js +6 -8
- package/dist/plugins/devtools/devtoolsPlugin.js.map +1 -1
- package/dist/plugins/devtools/index.js.map +1 -1
- package/dist/plugins/favicon/faviconPlugin.d.ts +3 -2
- package/dist/plugins/favicon/faviconPlugin.js +7 -5
- package/dist/plugins/favicon/faviconPlugin.js.map +1 -1
- package/dist/plugins/favicon/index.js.map +1 -1
- package/dist/plugins/multipart/index.js.map +1 -1
- package/dist/plugins/multipart/multipartPlugin.d.ts +3 -2
- package/dist/plugins/multipart/multipartPlugin.js +1 -14
- package/dist/plugins/multipart/multipartPlugin.js.map +1 -1
- package/dist/plugins/symbolicate/Symbolicator.js +13 -32
- package/dist/plugins/symbolicate/Symbolicator.js.map +1 -1
- package/dist/plugins/symbolicate/index.js.map +1 -1
- package/dist/plugins/symbolicate/sybmolicatePlugin.d.ts +4 -3
- package/dist/plugins/symbolicate/sybmolicatePlugin.js +2 -4
- package/dist/plugins/symbolicate/sybmolicatePlugin.js.map +1 -1
- package/dist/plugins/wss/WebSocketRouter.js +2 -6
- package/dist/plugins/wss/WebSocketRouter.js.map +1 -1
- package/dist/plugins/wss/WebSocketServer.js +2 -5
- package/dist/plugins/wss/WebSocketServer.js.map +1 -1
- package/dist/plugins/wss/index.js.map +1 -1
- package/dist/plugins/wss/servers/HermesInspectorProxy.js +1 -19
- package/dist/plugins/wss/servers/HermesInspectorProxy.js.map +1 -1
- package/dist/plugins/wss/servers/WebSocketApiServer.js +5 -11
- package/dist/plugins/wss/servers/WebSocketApiServer.js.map +1 -1
- package/dist/plugins/wss/servers/WebSocketDebuggerServer.js +6 -20
- package/dist/plugins/wss/servers/WebSocketDebuggerServer.js.map +1 -1
- package/dist/plugins/wss/servers/WebSocketDevClientServer.js +3 -12
- package/dist/plugins/wss/servers/WebSocketDevClientServer.js.map +1 -1
- package/dist/plugins/wss/servers/WebSocketEventsServer.js +18 -25
- package/dist/plugins/wss/servers/WebSocketEventsServer.js.map +1 -1
- package/dist/plugins/wss/servers/WebSocketHMRServer.js +3 -13
- package/dist/plugins/wss/servers/WebSocketHMRServer.js.map +1 -1
- package/dist/plugins/wss/servers/WebSocketMessageServer.d.ts +1 -1
- package/dist/plugins/wss/servers/WebSocketMessageServer.js +21 -51
- package/dist/plugins/wss/servers/WebSocketMessageServer.js.map +1 -1
- package/dist/plugins/wss/wssPlugin.d.ts +4 -3
- package/dist/plugins/wss/wssPlugin.js +0 -2
- package/dist/plugins/wss/wssPlugin.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +9 -34
- package/dist/types.js.map +1 -1
- package/package.json +26 -29
- package/docs/README.md +0 -28
- package/docs/enums/Internal.EventTypes.md +0 -41
- package/docs/functions/createServer.md +0 -21
- package/docs/interfaces/CodeFrame.md +0 -48
- package/docs/interfaces/CompilerDelegate.md +0 -83
- package/docs/interfaces/HmrDelegate.md +0 -51
- package/docs/interfaces/InputStackFrame.md +0 -76
- package/docs/interfaces/ProgressData.md +0 -34
- package/docs/interfaces/ReactNativeStackFrame.md +0 -58
- package/docs/interfaces/Server.Api.Asset.md +0 -36
- package/docs/interfaces/Server.Api.CompilationStats.md +0 -9
- package/docs/interfaces/Server.Api.Delegate.md +0 -75
- package/docs/interfaces/Server.Config.md +0 -49
- package/docs/interfaces/Server.Delegate.md +0 -88
- package/docs/interfaces/Server.DelegateContext.md +0 -134
- package/docs/interfaces/Server.LoggerDelegate.md +0 -33
- package/docs/interfaces/Server.MessagesDelegate.md +0 -44
- package/docs/interfaces/Server.Options.md +0 -70
- package/docs/interfaces/StackFrame.md +0 -85
- package/docs/interfaces/SymbolicatorDelegate.md +0 -77
- package/docs/interfaces/SymbolicatorResults.md +0 -30
- package/docs/modules/Internal.md +0 -11
- package/docs/modules/Server.Api.md +0 -11
- package/docs/modules/Server.md +0 -16
- package/docs/types/SendProgress.md +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @callstack/repack-dev-server
|
|
2
2
|
|
|
3
|
+
## 4.0.0-rc.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
## 4.0.0-rc.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#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.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#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
|
|
18
|
+
|
|
3
19
|
## 1.1.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Callstack
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/createServer.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ import { Server } from './types';
|
|
|
9
9
|
export declare function createServer(config: Server.Config): Promise<{
|
|
10
10
|
start: () => Promise<void>;
|
|
11
11
|
stop: () => Promise<void>;
|
|
12
|
-
instance: import("fastify").FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").
|
|
12
|
+
instance: import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault> & PromiseLike<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
|
|
13
13
|
}>;
|
package/dist/createServer.js
CHANGED
|
@@ -17,21 +17,18 @@ import symbolicatePlugin from "./plugins/symbolicate/index.js";
|
|
|
17
17
|
* @param config Server configuration.
|
|
18
18
|
* @returns `start` and `stop` functions as well as an underlying Fastify `instance`.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
20
|
export async function createServer(config) {
|
|
22
21
|
let delegate;
|
|
23
|
-
/** Fastify instance powering the development server. */
|
|
24
22
|
|
|
23
|
+
/** Fastify instance powering the development server. */
|
|
25
24
|
const instance = Fastify({
|
|
26
25
|
logger: {
|
|
27
26
|
level: 'trace',
|
|
28
27
|
stream: new Writable({
|
|
29
28
|
write: (chunk, _encoding, callback) => {
|
|
30
|
-
var _delegate, _instance$wss;
|
|
31
|
-
|
|
32
29
|
const log = JSON.parse(chunk.toString());
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
delegate?.logger.onMessage(log);
|
|
31
|
+
instance.wss?.apiServer.send(log);
|
|
35
32
|
callback();
|
|
36
33
|
}
|
|
37
34
|
})
|
|
@@ -63,8 +60,9 @@ export async function createServer(config) {
|
|
|
63
60
|
}) => {
|
|
64
61
|
instance.wss.messageServer.broadcast(method, params);
|
|
65
62
|
}
|
|
66
|
-
});
|
|
63
|
+
});
|
|
67
64
|
|
|
65
|
+
// Register plugins
|
|
68
66
|
await instance.register(fastifySensible);
|
|
69
67
|
await instance.register(wssPlugin, {
|
|
70
68
|
options: config.options,
|
|
@@ -88,36 +86,36 @@ export async function createServer(config) {
|
|
|
88
86
|
root: debuggerAppPath,
|
|
89
87
|
prefix: '/debugger-ui',
|
|
90
88
|
prefixAvoidTrailingSlash: true
|
|
91
|
-
});
|
|
89
|
+
});
|
|
90
|
+
// below is to prevent showing `GET 400 /favicon.ico`
|
|
92
91
|
// errors in console when requesting the bundle via browser
|
|
93
|
-
|
|
94
92
|
await instance.register(faviconPlugin);
|
|
95
93
|
instance.addHook('onSend', async (request, reply, payload) => {
|
|
96
94
|
reply.header('X-Content-Type-Options', 'nosniff');
|
|
97
95
|
reply.header('X-React-Native-Project-Root', config.options.rootDir);
|
|
98
96
|
const [pathname] = request.url.split('?');
|
|
99
|
-
|
|
100
97
|
if (pathname.endsWith('.map')) {
|
|
101
98
|
reply.header('Access-Control-Allow-Origin', 'devtools://devtools');
|
|
102
99
|
}
|
|
103
|
-
|
|
104
100
|
return payload;
|
|
105
|
-
});
|
|
101
|
+
});
|
|
106
102
|
|
|
103
|
+
// Register routes
|
|
107
104
|
instance.get('/', async () => delegate.messages.getHello());
|
|
108
105
|
instance.get('/status', async () => delegate.messages.getStatus());
|
|
109
|
-
/** Start the development server. */
|
|
110
106
|
|
|
107
|
+
/** Start the development server. */
|
|
111
108
|
async function start() {
|
|
112
|
-
await instance.listen(
|
|
109
|
+
await instance.listen({
|
|
110
|
+
port: config.options.port,
|
|
111
|
+
host: config.options.host
|
|
112
|
+
});
|
|
113
113
|
}
|
|
114
|
-
/** Stop the development server. */
|
|
115
|
-
|
|
116
114
|
|
|
115
|
+
/** Stop the development server. */
|
|
117
116
|
async function stop() {
|
|
118
117
|
await instance.close();
|
|
119
118
|
}
|
|
120
|
-
|
|
121
119
|
return {
|
|
122
120
|
start,
|
|
123
121
|
stop,
|
package/dist/createServer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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","rootDir","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 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 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
|
|
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","rootDir","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 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 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,QAAQ;AACjC,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,eAAe,MAAM,gCAAgC;AAAC,OACtDC,eAAe;AAAA,OACfC,cAAc;AAAA,OACdC,cAAc;AAAA,OACdC,SAAS;AAAA,OACTC,SAAS;AAAA,OACTC,aAAa;AAAA,SACXC,QAAQ;AAAA,OACVC,iBAAiB;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,YAAYA,CAACC,MAAqB,EAAE;EACxD,IAAIC,QAAyB;;EAE7B;EACA,MAAMC,QAAQ,GAAGf,OAAO,CAAC;IACvBgB,MAAM,EAAE;MACNC,KAAK,EAAE,OAAO;MACdC,MAAM,EAAE,IAAInB,QAAQ,CAAC;QACnBoB,KAAK,EAAEA,CAACC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,KAAK;UACrC,MAAMC,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACL,KAAK,CAACM,QAAQ,CAAC,CAAC,CAAC;UACxCZ,QAAQ,EAAEE,MAAM,CAACW,SAAS,CAACJ,G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AQ,CAACkD,QAAQ,CAACC,QAAQ,CAAC,CAAC,CAAC;EAC3DlD,QAAQ,CAACgD,GAAG,CAAC,SAAS,EAAE,YAAYjD,QAAQ,CAACkD,QAAQ,CAACE,SAAS,CAAC,CAAC,CAAC;;EAElE;EACA,eAAeC,KAAKA,CAAA,EAAG;IACrB,MAAMpD,QAAQ,CAACqD,MAAM,CAAC;MACpBC,IAAI,EAAExD,MAAM,CAACkB,OAAO,CAACsC,IAAI;MACzBC,IAAI,EAAEzD,MAAM,CAACkB,OAAO,CAACuC;IACvB,CAAC,CAAC;EACJ;;EAEA;EACA,eAAeC,IAAIA,CAAA,EAAG;IACpB,MAAMxD,QAAQ,CAACyD,KAAK,CAAC,CAAC;EACxB;EAEA,OAAO;IACLL,KAAK;IACLI,IAAI;IACJxD;EACF,CAAC;AACH"}
|
|
@@ -7,7 +7,6 @@ const paramsSchema = {
|
|
|
7
7
|
},
|
|
8
8
|
required: ['platform']
|
|
9
9
|
};
|
|
10
|
-
|
|
11
10
|
async function apiPlugin(instance, {
|
|
12
11
|
delegate
|
|
13
12
|
}) {
|
|
@@ -25,14 +24,9 @@ async function apiPlugin(instance, {
|
|
|
25
24
|
schema: {
|
|
26
25
|
params: paramsSchema
|
|
27
26
|
}
|
|
28
|
-
}, async (request, reply) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return delegate.api ? reply.send({
|
|
32
|
-
data: await ((_delegate$api = delegate.api) === null || _delegate$api === void 0 ? void 0 : _delegate$api.getCompilationStats(request.params.platform))
|
|
33
|
-
}) : reply.notImplemented('Missing API delegate implementation');
|
|
34
|
-
});
|
|
27
|
+
}, async (request, reply) => delegate.api ? reply.send({
|
|
28
|
+
data: await delegate.api?.getCompilationStats(request.params.platform)
|
|
29
|
+
}) : reply.notImplemented('Missing API delegate implementation'));
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
export default apiPlugin;
|
|
38
32
|
//# sourceMappingURL=apiPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/api/index.ts"],"sourcesContent":["export { default } from './apiPlugin';\n"],"mappings":"SAASA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/api/index.ts"],"sourcesContent":["export { default } from './apiPlugin';\n"],"mappings":"SAASA,OAAO"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
2
|
import type { Server } from '../../types';
|
|
3
|
-
declare
|
|
3
|
+
declare function compilerPlugin(instance: FastifyInstance, { delegate }: {
|
|
4
4
|
delegate: Server.Delegate;
|
|
5
|
-
}
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
declare const _default: typeof compilerPlugin;
|
|
6
7
|
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fastifyPlugin from 'fastify-plugin';
|
|
2
|
-
|
|
3
2
|
async function compilerPlugin(instance, {
|
|
4
3
|
delegate
|
|
5
4
|
}) {
|
|
@@ -17,51 +16,43 @@ async function compilerPlugin(instance, {
|
|
|
17
16
|
}
|
|
18
17
|
},
|
|
19
18
|
handler: async (request, reply) => {
|
|
20
|
-
var _delegate$compiler$in, _delegate$compiler;
|
|
21
|
-
|
|
22
19
|
let file = request.params['*'];
|
|
23
20
|
let {
|
|
24
21
|
platform
|
|
25
22
|
} = request.query;
|
|
26
|
-
|
|
27
23
|
if (!file) {
|
|
28
24
|
// This technically should never happen - this route should not be called if file is missing.
|
|
29
25
|
request.log.error(`File was not provided`);
|
|
30
26
|
return reply.notFound();
|
|
31
|
-
}
|
|
32
|
-
// to platform query param.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
platform = ((_delegate$compiler$in = (_delegate$compiler = delegate.compiler).inferPlatform) === null || _delegate$compiler$in === void 0 ? void 0 : _delegate$compiler$in.call(_delegate$compiler, request.url)) ?? platform;
|
|
27
|
+
}
|
|
36
28
|
|
|
29
|
+
// Let consumer infer the platform. If function is not provided fallback
|
|
30
|
+
// to platform query param.
|
|
31
|
+
platform = delegate.compiler.inferPlatform?.(request.url) ?? platform;
|
|
37
32
|
if (!platform) {
|
|
38
33
|
request.log.error('Cannot detect platform');
|
|
39
34
|
return reply.badRequest('Cannot detect platform');
|
|
40
|
-
}
|
|
41
|
-
|
|
35
|
+
}
|
|
42
36
|
|
|
37
|
+
// If platform happens to be in front of an asset remove it.
|
|
43
38
|
if (file.startsWith(`${platform}/`)) {
|
|
44
39
|
file = file.replace(`${platform}/`, '');
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
const multipart = reply.asMultipart();
|
|
48
|
-
|
|
49
42
|
const sendProgress = ({
|
|
50
43
|
completed,
|
|
51
44
|
total
|
|
52
45
|
}) => {
|
|
53
|
-
multipart
|
|
46
|
+
multipart?.writeChunk({
|
|
54
47
|
'Content-Type': 'application/json'
|
|
55
48
|
}, JSON.stringify({
|
|
56
49
|
done: completed,
|
|
57
50
|
total
|
|
58
51
|
}));
|
|
59
52
|
};
|
|
60
|
-
|
|
61
53
|
try {
|
|
62
54
|
const asset = await delegate.compiler.getAsset(file, platform, sendProgress);
|
|
63
55
|
const mimeType = delegate.compiler.getMimeType(file, platform, asset);
|
|
64
|
-
|
|
65
56
|
if (multipart) {
|
|
66
57
|
const buffer = Buffer.isBuffer(asset) ? asset : Buffer.from(asset);
|
|
67
58
|
multipart.setHeader('Content-Type', `${mimeType}; charset=UTF-8`);
|
|
@@ -77,9 +68,8 @@ async function compilerPlugin(instance, {
|
|
|
77
68
|
}
|
|
78
69
|
});
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
export default fastifyPlugin(compilerPlugin, {
|
|
82
72
|
name: 'compiler-plugin',
|
|
83
|
-
dependencies: ['fastify
|
|
73
|
+
dependencies: ['@fastify/sensible', 'multipart-plugin']
|
|
84
74
|
});
|
|
85
75
|
//# sourceMappingURL=compilerPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compilerPlugin.js","names":["fastifyPlugin","compilerPlugin","instance","delegate","route","method","url","schema","querystring","type","properties","platform","handler","request","reply","file","params","query","log","error","notFound","compiler","inferPlatform","badRequest","startsWith","replace","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 let file = (request.params as { '*'?: string })['*'];\n let { platform } = request.query as { platform?: string };\n\n if (!file) {\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 if (!platform) {\n request.log.error('Cannot detect platform');\n return reply.badRequest('Cannot detect platform');\n }\n\n // If platform happens to be in front of an asset remove it.\n if (file.startsWith(`${platform}/`)) {\n file = file.replace(`${platform}/`, '');\n }\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 file,\n platform,\n sendProgress\n );\n const mimeType = delegate.compiler.getMimeType(file, platform, asset);\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
|
|
1
|
+
{"version":3,"file":"compilerPlugin.js","names":["fastifyPlugin","compilerPlugin","instance","delegate","route","method","url","schema","querystring","type","properties","platform","handler","request","reply","file","params","query","log","error","notFound","compiler","inferPlatform","badRequest","startsWith","replace","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 let file = (request.params as { '*'?: string })['*'];\n let { platform } = request.query as { platform?: string };\n\n if (!file) {\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 if (!platform) {\n request.log.error('Cannot detect platform');\n return reply.badRequest('Cannot detect platform');\n }\n\n // If platform happens to be in front of an asset remove it.\n if (file.startsWith(`${platform}/`)) {\n file = file.replace(`${platform}/`, '');\n }\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 file,\n platform,\n sendProgress\n );\n const mimeType = delegate.compiler.getMimeType(file, platform, asset);\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,KAA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,CAAC;MACH,CAAC;MAED,IAAI;QACF,MAAMK,KAAK,GAAG,MAAMhC,QAAQ,CAACkB,QAAQ,CAACe,QAAQ,CAC5CrB,IAAI,EACJJ,QAAQ,EACRiB,YACF,CAAC;QACD,MAAMS,QAAQ,GAAGlC,QAAQ,CAACkB,QAAQ,CAACiB,WAAW,CAACvB,IAAI,EAAEJ,QAAQ,EAAEwB,KAAK,CAAC;QAErE,IAAIT,SAAS,EAAE;UACb,MAAMa,MAAM,GAAGC,MAAM,CAACC,QAAQ,CAACN,KAAK,CAAC,GAAGA,KAAK,GAAGK,MAAM,CAACE,IAAI,CAACP,KAAK,CAAC;UAClET,SAAS,CAACiB,SAAS,CAAC,cAAc,EAAG,GAAEN,QAAS,iBAAgB,CAAC;UACjEX,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,OAAOzB,KAAK,CAACiC,IAAI,CAAC,GAAG,CAAC,CAACtC,IAAI,CAAC4B,QAAQ,CAAC,CAACW,IAAI,CAACb,KAAK,CAAC;QACnD;MACF,CAAC,CAAC,OAAOhB,KAAK,EAAE;QACdN,OAAO,CAACK,GAAG,CAACC,KAAK,CAACA,KAAK,CAAC;QACxB,OAAOL,KAAK,CAACM,QAAQ,CAAED,KAAK,CAAW8B,OAAO,CAAC;MACjD;IACF;EACF,CAAC,CAAC;AACJ;AAEA,eAAejD,aAAa,CAACC,cAAc,EAAE;EAC3CiD,IAAI,EAAE,iBAAiB;EACvBC,YAAY,EAAE,CAAC,mBAAmB,EAAE,kBAAkB;AACxD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
2
|
import type { Server } from '../../types';
|
|
3
|
-
declare
|
|
3
|
+
declare function devtoolsPlugin(instance: FastifyInstance, { options }: {
|
|
4
4
|
options: Server.Options;
|
|
5
|
-
}
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
declare const _default: typeof devtoolsPlugin;
|
|
6
7
|
export default _default;
|
|
@@ -2,7 +2,6 @@ import path from 'path';
|
|
|
2
2
|
import open from 'open';
|
|
3
3
|
import openEditor from 'open-editor';
|
|
4
4
|
import fastifyPlugin from 'fastify-plugin';
|
|
5
|
-
|
|
6
5
|
async function devtoolsPlugin(instance, {
|
|
7
6
|
options
|
|
8
7
|
}) {
|
|
@@ -19,11 +18,10 @@ async function devtoolsPlugin(instance, {
|
|
|
19
18
|
url: '/launch-js-devtools',
|
|
20
19
|
handler: async (request, reply) => {
|
|
21
20
|
const customDebugger = process.env.REACT_DEBUGGER;
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (customDebugger) {
|
|
22
|
+
// NOOP for now
|
|
24
23
|
} else if (!instance.wss.debuggerServer.isDebuggerConnected()) {
|
|
25
24
|
const url = `${options.https ? 'https' : 'http'}://${options.host || 'localhost'}:${options.port}/debugger-ui`;
|
|
26
|
-
|
|
27
25
|
try {
|
|
28
26
|
request.log.info({
|
|
29
27
|
msg: 'Opening debugger UI',
|
|
@@ -40,7 +38,6 @@ async function devtoolsPlugin(instance, {
|
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
|
-
|
|
44
41
|
reply.send('OK');
|
|
45
42
|
}
|
|
46
43
|
});
|
|
@@ -54,7 +51,8 @@ async function devtoolsPlugin(instance, {
|
|
|
54
51
|
lineNumber,
|
|
55
52
|
column
|
|
56
53
|
} = typeof request.body === 'string' ? JSON.parse(request.body) : request.body;
|
|
57
|
-
const url = `${path.join(options.rootDir,
|
|
54
|
+
const url = `${path.join(options.rootDir,
|
|
55
|
+
// TODO: make it generic
|
|
58
56
|
file.replace('webpack://', ''))}:${lineNumber}:${column ?? 1}`;
|
|
59
57
|
request.log.info({
|
|
60
58
|
msg: 'Opening stack frame in editor',
|
|
@@ -93,15 +91,15 @@ async function devtoolsPlugin(instance, {
|
|
|
93
91
|
reply.code(400).send();
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
|
-
});
|
|
94
|
+
});
|
|
97
95
|
|
|
96
|
+
// Silence this route
|
|
98
97
|
instance.get('/inspector/device', {
|
|
99
98
|
logLevel: 'silent'
|
|
100
99
|
}, (_request, reply) => {
|
|
101
100
|
reply.code(404).send();
|
|
102
101
|
});
|
|
103
102
|
}
|
|
104
|
-
|
|
105
103
|
export default fastifyPlugin(devtoolsPlugin, {
|
|
106
104
|
name: 'devtools-plugin',
|
|
107
105
|
dependencies: ['wss-plugin']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtoolsPlugin.js","names":["path","open","openEditor","fastifyPlugin","devtoolsPlugin","instance","options","route","method","url","handler","_request","reply","wss","messageServer","broadcast","send","request","customDebugger","process","env","REACT_DEBUGGER","debuggerServer","isDebuggerConnected","https","host","port","log","info","msg","error","file","lineNumber","column","body","JSON","parse","join","rootDir","replace","message","code","get","logLevel","name","dependencies"],"sources":["../../../src/plugins/devtools/devtoolsPlugin.ts"],"sourcesContent":["import path from 'path';\nimport open from 'open';\nimport openEditor from 'open-editor';\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.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 instance.route({\n method: ['GET', 'POST', 'PUT'],\n url: '/launch-js-devtools',\n handler: async (request, reply) => {\n const customDebugger = process.env.REACT_DEBUGGER;\n if (customDebugger) {\n // NOOP for now\n } else if (!instance.wss.debuggerServer.isDebuggerConnected()) {\n const url = `${options.https ? 'https' : 'http'}://${\n options.host || 'localhost'\n }:${options.port}/debugger-ui`;\n try {\n request.log.info({ msg: 'Opening debugger UI', url });\n await open(url);\n } catch (error) {\n if (error) {\n request.log.error({\n msg: 'Cannot open debugger UI',\n url,\n error,\n });\n }\n }\n }\n reply.send('OK');\n },\n });\n\n instance.route({\n method: ['GET', 'POST', 'PUT'],\n url: '/open-stack-frame',\n handler: async (request, reply) => {\n try {\n const { file, lineNumber, column } = (\n typeof request.body === 'string'\n ? JSON.parse(request.body)\n : request.body\n ) as {\n file: string;\n lineNumber: number;\n column?: number;\n };\n const url = `${path.join(\n options.rootDir,\n // TODO: make it generic\n file.replace('webpack://', '')\n )}:${lineNumber}:${column ?? 1}`;\n\n request.log.info({ msg: 'Opening stack frame in editor', url });\n openEditor([url]);\n reply.send('OK');\n } catch (error) {\n request.log.error({\n msg: 'Failed to open stack frame in editor',\n error: (error as Error).message,\n });\n reply.code(400).send();\n }\n },\n });\n\n instance.route({\n method: ['GET', 'POST', 'PUT'],\n url: '/open-url',\n handler: async (request, reply) => {\n try {\n const { url } = JSON.parse(request.body as string) as { url: string };\n request.log.info({ msg: 'Opening URL', url });\n await open(url);\n reply.send('OK');\n } catch (error) {\n request.log.error({ msg: 'Failed to open URL', error });\n reply.code(400).send();\n }\n },\n });\n\n // Silence this route\n instance.get(\n '/inspector/device',\n { logLevel: 'silent' as any },\n (_request, reply) => {\n reply.code(404).send();\n }\n );\n}\n\nexport default fastifyPlugin(devtoolsPlugin, {\n name: 'devtools-plugin',\n dependencies: ['wss-plugin'],\n});\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"devtoolsPlugin.js","names":["path","open","openEditor","fastifyPlugin","devtoolsPlugin","instance","options","route","method","url","handler","_request","reply","wss","messageServer","broadcast","send","request","customDebugger","process","env","REACT_DEBUGGER","debuggerServer","isDebuggerConnected","https","host","port","log","info","msg","error","file","lineNumber","column","body","JSON","parse","join","rootDir","replace","message","code","get","logLevel","name","dependencies"],"sources":["../../../src/plugins/devtools/devtoolsPlugin.ts"],"sourcesContent":["import path from 'path';\nimport open from 'open';\nimport openEditor from 'open-editor';\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.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 instance.route({\n method: ['GET', 'POST', 'PUT'],\n url: '/launch-js-devtools',\n handler: async (request, reply) => {\n const customDebugger = process.env.REACT_DEBUGGER;\n if (customDebugger) {\n // NOOP for now\n } else if (!instance.wss.debuggerServer.isDebuggerConnected()) {\n const url = `${options.https ? 'https' : 'http'}://${\n options.host || 'localhost'\n }:${options.port}/debugger-ui`;\n try {\n request.log.info({ msg: 'Opening debugger UI', url });\n await open(url);\n } catch (error) {\n if (error) {\n request.log.error({\n msg: 'Cannot open debugger UI',\n url,\n error,\n });\n }\n }\n }\n reply.send('OK');\n },\n });\n\n instance.route({\n method: ['GET', 'POST', 'PUT'],\n url: '/open-stack-frame',\n handler: async (request, reply) => {\n try {\n const { file, lineNumber, column } = (\n typeof request.body === 'string'\n ? JSON.parse(request.body)\n : request.body\n ) as {\n file: string;\n lineNumber: number;\n column?: number;\n };\n const url = `${path.join(\n options.rootDir,\n // TODO: make it generic\n file.replace('webpack://', '')\n )}:${lineNumber}:${column ?? 1}`;\n\n request.log.info({ msg: 'Opening stack frame in editor', url });\n openEditor([url]);\n reply.send('OK');\n } catch (error) {\n request.log.error({\n msg: 'Failed to open stack frame in editor',\n error: (error as Error).message,\n });\n reply.code(400).send();\n }\n },\n });\n\n instance.route({\n method: ['GET', 'POST', 'PUT'],\n url: '/open-url',\n handler: async (request, reply) => {\n try {\n const { url } = JSON.parse(request.body as string) as { url: string };\n request.log.info({ msg: 'Opening URL', url });\n await open(url);\n reply.send('OK');\n } catch (error) {\n request.log.error({ msg: 'Failed to open URL', error });\n reply.code(400).send();\n }\n },\n });\n\n // Silence this route\n instance.get(\n '/inspector/device',\n { logLevel: 'silent' as any },\n (_request, reply) => {\n reply.code(404).send();\n }\n );\n}\n\nexport default fastifyPlugin(devtoolsPlugin, {\n name: 'devtools-plugin',\n dependencies: ['wss-plugin'],\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,UAAU,MAAM,aAAa;AAEpC,OAAOC,aAAa,MAAM,gBAAgB;AAG1C,eAAeC,cAAcA,CAC3BC,QAAyB,EACzB;EAAEC;AAAqC,CAAC,EACxC;EACAD,QAAQ,CAACE,KAAK,CAAC;IACbC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;IAC9BC,GAAG,EAAE,SAAS;IACdC,OAAO,EAAEA,CAACC,QAAQ,EAAEC,KAAK,KAAK;MAC5BP,QAAQ,CAACQ,GAAG,CAACC,aAAa,CAACC,SAAS,CAAC,QAAQ,CAAC;MAC9CH,KAAK,CAACI,IAAI,CAAC,IAAI,CAAC;IAClB;EACF,CAAC,CAAC;EAEFX,QAAQ,CAACE,KAAK,CAAC;IACbC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;IAC9BC,GAAG,EAAE,qBAAqB;IAC1BC,OAAO,EAAE,MAAAA,CAAOO,OAAO,EAAEL,KAAK,KAAK;MACjC,MAAMM,cAAc,GAAGC,OAAO,CAACC,GAAG,CAACC,cAAc;MACjD,IAAIH,cAAc,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AAChC,QAAQ,EAAEC,KAAK,KAAK;IACnBA,KAAK,CAAC6B,IAAI,CAAC,GAAG,CAAC,CAACzB,IAAI,CAAC,CAAC;EACxB,CACF,CAAC;AACH;AAEA,eAAeb,aAAa,CAACC,cAAc,EAAE;EAC3CwC,IAAI,EAAE,iBAAiB;EACvBC,YAAY,EAAE,CAAC,YAAY;AAC7B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/devtools/index.ts"],"sourcesContent":["export { default } from './devtoolsPlugin';\n"],"mappings":"SAASA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/devtools/index.ts"],"sourcesContent":["export { default } from './devtoolsPlugin';\n"],"mappings":"SAASA,OAAO"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
declare function faviconPlugin(instance: FastifyInstance): Promise<void>;
|
|
3
|
+
declare const _default: typeof faviconPlugin;
|
|
3
4
|
export default _default;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
1
3
|
import fastifyFavicon from 'fastify-favicon';
|
|
2
|
-
import fastifyPlugin from 'fastify-plugin';
|
|
3
|
-
|
|
4
|
-
const pathToImg = new URL('../../img', import.meta.url).pathname;
|
|
4
|
+
import fastifyPlugin from 'fastify-plugin';
|
|
5
5
|
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const pathToImgDir = path.join(dirname, '../../img');
|
|
6
9
|
async function faviconPlugin(instance) {
|
|
7
10
|
instance.register(fastifyFavicon, {
|
|
8
|
-
path:
|
|
11
|
+
path: pathToImgDir
|
|
9
12
|
});
|
|
10
13
|
}
|
|
11
|
-
|
|
12
14
|
export default fastifyPlugin(faviconPlugin, {
|
|
13
15
|
name: 'favicon-plugin'
|
|
14
16
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faviconPlugin.js","names":["
|
|
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 'path';\nimport { fileURLToPath } from 'url';\nimport fastifyFavicon from 'fastify-favicon';\nimport type { FastifyInstance } from 'fastify';\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,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AACnC,OAAOC,cAAc,MAAM,iBAAiB;AAE5C,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/favicon/index.ts"],"sourcesContent":["export { default } from './faviconPlugin';\n"],"mappings":"SAASA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../src/plugins/favicon/index.ts"],"sourcesContent":["export { default } from './faviconPlugin';\n"],"mappings":"SAASA,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
declare function multipartPlugin(instance: FastifyInstance): Promise<void>;
|
|
3
|
+
declare const _default: typeof multipartPlugin;
|
|
3
4
|
export default _default;
|