@tamagui/cli 1.2.9 → 1.2.10
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/dist/esm/build.mjs +49 -0
- package/dist/esm/build.mjs.map +7 -0
- package/dist/esm/cli.mjs +138 -0
- package/dist/esm/cli.mjs.map +7 -0
- package/dist/esm/create.mjs +1 -0
- package/dist/esm/create.mjs.map +7 -0
- package/dist/esm/dev/createDevServer.mjs +141 -0
- package/dist/esm/dev/createDevServer.mjs.map +7 -0
- package/dist/esm/dev.mjs +151 -0
- package/dist/esm/dev.mjs.map +7 -0
- package/dist/esm/generate.mjs +49 -0
- package/dist/esm/generate.mjs.map +7 -0
- package/dist/esm/index.mjs +9 -0
- package/dist/esm/index.mjs.map +7 -0
- package/dist/esm/studio.mjs +61 -0
- package/dist/esm/studio.mjs.map +7 -0
- package/dist/esm/tamaguiConfigUtils.mjs +52 -0
- package/dist/esm/tamaguiConfigUtils.mjs.map +7 -0
- package/dist/esm/test.mjs +9 -0
- package/dist/esm/test.mjs.map +7 -0
- package/dist/esm/types.mjs +1 -0
- package/dist/esm/types.mjs.map +7 -0
- package/dist/esm/update.mjs +6 -0
- package/dist/esm/update.mjs.map +7 -0
- package/dist/esm/utils/constants.mjs +5 -0
- package/dist/esm/utils/constants.mjs.map +7 -0
- package/dist/esm/utils.mjs +78 -0
- package/dist/esm/utils.mjs.map +7 -0
- package/dist/esm/vendor/debugger-app/index.mjs +6 -0
- package/dist/esm/vendor/debugger-app/index.mjs.map +7 -0
- package/dist/esm/vendor/debugger-app/src/debuggerWorker.mjs +63 -0
- package/dist/esm/vendor/debugger-app/src/debuggerWorker.mjs.map +7 -0
- package/dist/esm/vendor/debugger-app/src/index.mjs +142 -0
- package/dist/esm/vendor/debugger-app/src/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/createServer.mjs +95 -0
- package/dist/esm/vendor/repack/dev-server/src/createServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/index.mjs +3 -0
- package/dist/esm/vendor/repack/dev-server/src/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/api/apiPlugin.mjs +37 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/api/apiPlugin.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/api/index.mjs +5 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/api/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/compiler/compilerPlugin.mjs +67 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/compiler/compilerPlugin.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/compiler/index.mjs +6 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/compiler/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/compiler/types.mjs +1 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/compiler/types.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/devtools/devtoolsPlugin.mjs +87 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/devtools/devtoolsPlugin.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/devtools/index.mjs +5 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/devtools/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/favicon/faviconPlugin.mjs +13 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/favicon/faviconPlugin.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/favicon/index.mjs +5 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/favicon/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/multipart/index.mjs +6 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/multipart/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/multipart/multipartPlugin.mjs +50 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/multipart/multipartPlugin.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/multipart/types.mjs +1 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/multipart/types.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/Symbolicator.mjs +186 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/Symbolicator.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/index.mjs +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/sybmolicatePlugin.mjs +35 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/sybmolicatePlugin.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/types.mjs +1 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/symbolicate/types.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/WebSocketRouter.mjs +50 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/WebSocketRouter.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/WebSocketServer.mjs +32 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/WebSocketServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/index.mjs +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/index.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/HermesInspectorProxy.mjs +110 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/HermesInspectorProxy.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketApiServer.mjs +52 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketApiServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketDebuggerServer.mjs +106 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketDebuggerServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketDevClientServer.mjs +62 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketDevClientServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketEventsServer.mjs +154 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketEventsServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketHMRServer.mjs +76 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketHMRServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketMessageServer.mjs +330 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketMessageServer.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/types.mjs +1 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/types.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/wssPlugin.mjs +47 -0
- package/dist/esm/vendor/repack/dev-server/src/plugins/wss/wssPlugin.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/src/types.mjs +13 -0
- package/dist/esm/vendor/repack/dev-server/src/types.mjs.map +7 -0
- package/dist/esm/vendor/repack/dev-server/vendor/metro-inspector-proxy/src/Device.mjs +5 -0
- package/dist/esm/vendor/repack/dev-server/vendor/metro-inspector-proxy/src/Device.mjs.map +7 -0
- package/package.json +6 -6
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Writable } from "stream";
|
|
2
|
+
import fastifySensible from "@fastify/sensible";
|
|
3
|
+
import Fastify from "fastify";
|
|
4
|
+
import apiPlugin from "./plugins/api";
|
|
5
|
+
import compilerPlugin from "./plugins/compiler";
|
|
6
|
+
import devtoolsPlugin from "./plugins/devtools";
|
|
7
|
+
import multipartPlugin from "./plugins/multipart";
|
|
8
|
+
import symbolicatePlugin from "./plugins/symbolicate";
|
|
9
|
+
import wssPlugin from "./plugins/wss";
|
|
10
|
+
import { Internal } from "./types";
|
|
11
|
+
async function createServer(config) {
|
|
12
|
+
let delegate;
|
|
13
|
+
const instance = Fastify({
|
|
14
|
+
logger: {
|
|
15
|
+
level: "trace",
|
|
16
|
+
stream: new Writable({
|
|
17
|
+
write: (chunk, _encoding, callback) => {
|
|
18
|
+
var _a;
|
|
19
|
+
const log = JSON.parse(chunk.toString());
|
|
20
|
+
delegate == null ? void 0 : delegate.logger.onMessage(log);
|
|
21
|
+
(_a = instance.wss) == null ? void 0 : _a.apiServer.send(log);
|
|
22
|
+
callback();
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
...config.options.https ? { https: config.options.https } : void 0
|
|
27
|
+
});
|
|
28
|
+
delegate = config.delegate({
|
|
29
|
+
log: instance.log,
|
|
30
|
+
notifyBuildStart: (platform) => {
|
|
31
|
+
instance.wss.apiServer.send({
|
|
32
|
+
event: Internal.EventTypes.BuildStart,
|
|
33
|
+
platform
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
notifyBuildEnd: (platform) => {
|
|
37
|
+
instance.wss.apiServer.send({
|
|
38
|
+
event: Internal.EventTypes.BuildEnd,
|
|
39
|
+
platform
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
broadcastToHmrClients: (event, platform, clientIds) => {
|
|
43
|
+
instance.wss.hmrServer.send(event, platform, clientIds);
|
|
44
|
+
},
|
|
45
|
+
broadcastToMessageClients: ({ method, params }) => {
|
|
46
|
+
instance.wss.messageServer.broadcast(method, params);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
await instance.register(fastifySensible);
|
|
50
|
+
await instance.register(wssPlugin, {
|
|
51
|
+
options: config.options,
|
|
52
|
+
delegate
|
|
53
|
+
});
|
|
54
|
+
await instance.register(multipartPlugin);
|
|
55
|
+
await instance.register(apiPlugin, {
|
|
56
|
+
delegate,
|
|
57
|
+
prefix: "/api"
|
|
58
|
+
});
|
|
59
|
+
await instance.register(compilerPlugin, {
|
|
60
|
+
delegate
|
|
61
|
+
});
|
|
62
|
+
await instance.register(symbolicatePlugin, {
|
|
63
|
+
delegate
|
|
64
|
+
});
|
|
65
|
+
await instance.register(devtoolsPlugin, {
|
|
66
|
+
options: config.options
|
|
67
|
+
});
|
|
68
|
+
console.warn("disable debugger-ui + favicon for now");
|
|
69
|
+
instance.addHook("onSend", async (request, reply, payload) => {
|
|
70
|
+
reply.header("X-Content-Type-Options", "nosniff");
|
|
71
|
+
const [pathname] = request.url.split("?");
|
|
72
|
+
if (pathname.endsWith(".map")) {
|
|
73
|
+
reply.header("Access-Control-Allow-Origin", "devtools://devtools");
|
|
74
|
+
}
|
|
75
|
+
return payload;
|
|
76
|
+
});
|
|
77
|
+
instance.head("/", async () => "");
|
|
78
|
+
instance.get("/", async () => delegate.messages.getHello());
|
|
79
|
+
instance.get("/status", async () => delegate.messages.getStatus());
|
|
80
|
+
async function start() {
|
|
81
|
+
await instance.listen(config.options.port, config.options.host);
|
|
82
|
+
}
|
|
83
|
+
async function stop() {
|
|
84
|
+
await instance.close();
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
start,
|
|
88
|
+
stop,
|
|
89
|
+
instance
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
createServer
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=createServer.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/vendor/repack/dev-server/src/createServer.ts"],
|
|
4
|
+
"sourcesContent": ["import { Writable } from 'stream'\n\n// import debuggerAppPath from '@callstack/repack-debugger-app'\nimport fastifySensible from '@fastify/sensible'\nimport fastifyStatic from '@fastify/static'\nimport Fastify from 'fastify'\n\nimport apiPlugin from './plugins/api'\nimport compilerPlugin from './plugins/compiler'\nimport devtoolsPlugin from './plugins/devtools'\n// import faviconPlugin from './plugins/favicon'\nimport multipartPlugin from './plugins/multipart'\nimport symbolicatePlugin from './plugins/symbolicate'\nimport wssPlugin from './plugins/wss'\nimport { Internal, 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 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 console.warn('disable debugger-ui + favicon for now')\n // await instance.register(fastifyStatic, {\n // root: debuggerAppPath,\n // prefix: '/debugger-ui',\n // prefixAvoidTrailingSlash: true,\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\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.head('/', async () => '')\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"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAGzB,OAAO,qBAAqB;AAE5B,OAAO,aAAa;AAEpB,OAAO,eAAe;AACtB,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAE3B,OAAO,qBAAqB;AAC5B,OAAO,uBAAuB;AAC9B,OAAO,eAAe;AACtB,SAAS,gBAAwB;AAQjC,eAAsB,aAAa,QAAuB;AACxD,MAAI;AAGJ,QAAM,WAAW,QAAQ;AAAA,IACvB,QAAQ;AAAA,MACN,OAAO;AAAA,MACP,QAAQ,IAAI,SAAS;AAAA,QACnB,OAAO,CAAC,OAAO,WAAW,aAAa;AA9B/C;AA+BU,gBAAM,MAAM,KAAK,MAAM,MAAM,SAAS,CAAC;AACvC,+CAAU,OAAO,UAAU;AAC3B,yBAAS,QAAT,mBAAc,UAAU,KAAK;AAC7B,mBAAS;AAAA,QACX;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,GAAI,OAAO,QAAQ,QAAQ,EAAE,OAAO,OAAO,QAAQ,MAAM,IAAI;AAAA,EAC/D,CAAC;AAED,aAAW,OAAO,SAAS;AAAA,IACzB,KAAK,SAAS;AAAA,IACd,kBAAkB,CAAC,aAAa;AAC9B,eAAS,IAAI,UAAU,KAA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,IAAI,WAAW,YAAY,SAAS,SAAS,UAAU,CAAC;AAGjE,iBAAe,QAAQ;AACrB,UAAM,SAAS,OAAO,OAAO,QAAQ,MAAM,OAAO,QAAQ,IAAI;AAAA,EAChE;AAGA,iBAAe,OAAO;AACpB,UAAM,SAAS,MAAM;AAAA,EACvB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const paramsSchema = {
|
|
2
|
+
type: "object",
|
|
3
|
+
properties: {
|
|
4
|
+
platform: {
|
|
5
|
+
type: "string"
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
required: ["platform"]
|
|
9
|
+
};
|
|
10
|
+
async function apiPlugin(instance, { delegate }) {
|
|
11
|
+
instance.get(
|
|
12
|
+
"/platforms",
|
|
13
|
+
async (_request, reply) => delegate.api ? reply.send({ data: await delegate.api.getPlatforms() }) : reply.notImplemented("Missing API delegate implementation")
|
|
14
|
+
);
|
|
15
|
+
instance.get(
|
|
16
|
+
"/:platform/assets",
|
|
17
|
+
{ schema: { params: paramsSchema } },
|
|
18
|
+
async (request, reply) => delegate.api ? reply.send({
|
|
19
|
+
data: await delegate.api.getAssets(request.params.platform)
|
|
20
|
+
}) : reply.notImplemented("Missing API delegate implementation")
|
|
21
|
+
);
|
|
22
|
+
instance.get(
|
|
23
|
+
"/:platform/stats",
|
|
24
|
+
{ schema: { params: paramsSchema } },
|
|
25
|
+
async (request, reply) => {
|
|
26
|
+
var _a;
|
|
27
|
+
return delegate.api ? reply.send({
|
|
28
|
+
data: await ((_a = delegate.api) == null ? void 0 : _a.getCompilationStats(request.params.platform))
|
|
29
|
+
}) : reply.notImplemented("Missing API delegate implementation");
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
var apiPlugin_default = apiPlugin;
|
|
34
|
+
export {
|
|
35
|
+
apiPlugin_default as default
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=apiPlugin.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/vendor/repack/dev-server/src/plugins/api/apiPlugin.ts"],
|
|
4
|
+
"sourcesContent": ["import type { FastifyInstance } from 'fastify'\n\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(request.params.platform),\n })\n : reply.notImplemented('Missing API delegate implementation')\n )\n}\n\nexport default apiPlugin\n"],
|
|
5
|
+
"mappings": "AAIA,MAAM,eAAe;AAAA,EACnB,MAAM;AAAA,EACN,YAAY;AAAA,IACV,UAAU;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,UAAU,CAAC,UAAU;AACvB;AAIA,eAAe,UACb,UACA,EAAE,SAAS,GACX;AACA,WAAS;AAAA,IAAI;AAAA,IAAc,OAAO,UAAU,UAC1C,SAAS,MACL,MAAM,KAAK,EAAE,MAAM,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC,IACtD,MAAM,eAAe,qCAAqC;AAAA,EAChE;AAEA,WAAS;AAAA,IACP;AAAA,IACA,EAAE,QAAQ,EAAE,QAAQ,aAAa,EAAE;AAAA,IACnC,OAAO,SAAS,UACd,SAAS,MACL,MAAM,KAAK;AAAA,MACT,MAAM,MAAM,SAAS,IAAI,UAAU,QAAQ,OAAO,QAAQ;AAAA,IAC5D,CAAC,IACD,MAAM,eAAe,qCAAqC;AAAA,EAClE;AAEA,WAAS;AAAA,IACP;AAAA,IACA,EAAE,QAAQ,EAAE,QAAQ,aAAa,EAAE;AAAA,IACnC,OAAO,SAAS,UAAO;AAxC3B;AAyCM,sBAAS,MACL,MAAM,KAAK;AAAA,QACT,MAAM,QAAM,cAAS,QAAT,mBAAc,oBAAoB,QAAQ,OAAO;AAAA,MAC/D,CAAC,IACD,MAAM,eAAe,qCAAqC;AAAA;AAAA,EAClE;AACF;AAEA,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import fastifyPlugin from "fastify-plugin";
|
|
2
|
+
async function compilerPlugin(instance, { delegate }) {
|
|
3
|
+
instance.route({
|
|
4
|
+
method: ["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD"],
|
|
5
|
+
url: "/*",
|
|
6
|
+
schema: {
|
|
7
|
+
querystring: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
platform: {
|
|
11
|
+
type: "string"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
handler: async (request, reply) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
let file = request.params["*"];
|
|
19
|
+
let { platform } = request.query;
|
|
20
|
+
if (!file) {
|
|
21
|
+
request.log.error(`File was not provided`);
|
|
22
|
+
return reply.notFound();
|
|
23
|
+
}
|
|
24
|
+
platform = ((_b = (_a = delegate.compiler).inferPlatform) == null ? void 0 : _b.call(_a, request.url)) ?? platform;
|
|
25
|
+
if (!platform) {
|
|
26
|
+
request.log.error("Cannot detect platform");
|
|
27
|
+
return reply.badRequest("Cannot detect platform");
|
|
28
|
+
}
|
|
29
|
+
if (file.startsWith(`${platform}/`)) {
|
|
30
|
+
file = file.replace(`${platform}/`, "");
|
|
31
|
+
}
|
|
32
|
+
const multipart = reply.asMultipart();
|
|
33
|
+
const sendProgress = ({ completed, total }) => {
|
|
34
|
+
multipart == null ? void 0 : multipart.writeChunk(
|
|
35
|
+
{ "Content-Type": "application/json" },
|
|
36
|
+
JSON.stringify({
|
|
37
|
+
done: completed,
|
|
38
|
+
total
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
const asset = await delegate.compiler.getAsset(file, platform, sendProgress);
|
|
44
|
+
const mimeType = delegate.compiler.getMimeType(file, platform, asset);
|
|
45
|
+
if (multipart) {
|
|
46
|
+
const buffer = Buffer.isBuffer(asset) ? asset : Buffer.from(asset);
|
|
47
|
+
multipart.setHeader("Content-Type", `${mimeType}; charset=UTF-8`);
|
|
48
|
+
multipart.setHeader("Content-Length", String(Buffer.byteLength(buffer)));
|
|
49
|
+
multipart.end(buffer);
|
|
50
|
+
} else {
|
|
51
|
+
return reply.code(200).type(mimeType).send(asset);
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
request.log.error(error);
|
|
55
|
+
return reply.notFound(error.message);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
var compilerPlugin_default = fastifyPlugin(compilerPlugin, {
|
|
61
|
+
name: "compiler-plugin",
|
|
62
|
+
dependencies: ["fastify-sensible", "multipart-plugin"]
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
compilerPlugin_default as default
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=compilerPlugin.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/vendor/repack/dev-server/src/plugins/compiler/compilerPlugin.ts"],
|
|
4
|
+
"sourcesContent": ["import type { FastifyInstance } from 'fastify'\nimport fastifyPlugin from 'fastify-plugin'\n\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\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(file, platform, sendProgress)\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('Content-Length', String(Buffer.byteLength(buffer)))\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})\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;AACjE,oBAAU,UAAU,gBAAgB,GAAG,yBAAyB;AAChE,oBAAU,UAAU,kBAAkB,OAAO,OAAO,WAAW,MAAM,CAAC,CAAC;AACvE,oBAAU,IAAI,MAAM;AAAA,QACtB,OAAO;AACL,iBAAO,MAAM,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK;AAAA,QAClD;AAAA,MACF,SAAS,OAAP;AACA,gBAAQ,IAAI,MAAM,KAAK;AACvB,eAAO,MAAM,SAAU,MAAgB,OAAO;AAAA,MAChD;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,IAAO,yBAAQ,cAAc,gBAAgB;AAAA,EAC3C,MAAM;AAAA,EACN,cAAc,CAAC,oBAAoB,kBAAkB;AACvD,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/vendor/repack/dev-server/src/plugins/compiler/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { default } from './compilerPlugin'\nexport * from './types'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAAA,gBAAe;AACxB,cAAc;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fastifyPlugin from "fastify-plugin";
|
|
3
|
+
import open from "open";
|
|
4
|
+
async function devtoolsPlugin(instance, { options }) {
|
|
5
|
+
instance.route({
|
|
6
|
+
method: ["GET", "POST", "PUT"],
|
|
7
|
+
url: "/reload",
|
|
8
|
+
handler: (_request, reply) => {
|
|
9
|
+
instance.wss.messageServer.broadcast("reload");
|
|
10
|
+
reply.send("OK");
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
instance.route({
|
|
14
|
+
method: ["GET", "POST", "PUT"],
|
|
15
|
+
url: "/launch-js-devtools",
|
|
16
|
+
handler: async (request, reply) => {
|
|
17
|
+
const customDebugger = process.env.REACT_DEBUGGER;
|
|
18
|
+
if (customDebugger) {
|
|
19
|
+
} else if (!instance.wss.debuggerServer.isDebuggerConnected()) {
|
|
20
|
+
const url = `${options.https ? "https" : "http"}://${options.host || "localhost"}:${options.port}/debugger-ui`;
|
|
21
|
+
try {
|
|
22
|
+
request.log.info({ msg: "Opening debugger UI", url });
|
|
23
|
+
await open(url);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (error) {
|
|
26
|
+
request.log.error({
|
|
27
|
+
msg: "Cannot open debugger UI",
|
|
28
|
+
url,
|
|
29
|
+
error
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
reply.send("OK");
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
instance.route({
|
|
38
|
+
method: ["GET", "POST", "PUT"],
|
|
39
|
+
url: "/open-stack-frame",
|
|
40
|
+
handler: async (request, reply) => {
|
|
41
|
+
try {
|
|
42
|
+
const { file, lineNumber, column } = JSON.parse(request.body);
|
|
43
|
+
const url = `${path.join(
|
|
44
|
+
options.rootDir,
|
|
45
|
+
// TODO: make it generic
|
|
46
|
+
file.replace("webpack://", "")
|
|
47
|
+
)}:${lineNumber}:${column ?? 1}`;
|
|
48
|
+
request.log.info({ msg: "Opening stack frame in editor", url });
|
|
49
|
+
const openEditor = (await import("open-editor")).default;
|
|
50
|
+
openEditor([url]);
|
|
51
|
+
reply.send("OK");
|
|
52
|
+
} catch (error) {
|
|
53
|
+
request.log.error({
|
|
54
|
+
msg: "Failed to open stack frame in editor",
|
|
55
|
+
error: error.message
|
|
56
|
+
});
|
|
57
|
+
reply.code(400).send();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
instance.route({
|
|
62
|
+
method: ["GET", "POST", "PUT"],
|
|
63
|
+
url: "/open-url",
|
|
64
|
+
handler: async (request, reply) => {
|
|
65
|
+
try {
|
|
66
|
+
const { url } = JSON.parse(request.body);
|
|
67
|
+
request.log.info({ msg: "Opening URL", url });
|
|
68
|
+
await open(url);
|
|
69
|
+
reply.send("OK");
|
|
70
|
+
} catch (error) {
|
|
71
|
+
request.log.error({ msg: "Failed to open URL", error });
|
|
72
|
+
reply.code(400).send();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
instance.get("/inspector/device", { logLevel: "silent" }, (_request, reply) => {
|
|
77
|
+
reply.code(404).send();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
var devtoolsPlugin_default = fastifyPlugin(devtoolsPlugin, {
|
|
81
|
+
name: "devtools-plugin",
|
|
82
|
+
dependencies: ["wss-plugin"]
|
|
83
|
+
});
|
|
84
|
+
export {
|
|
85
|
+
devtoolsPlugin_default as default
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=devtoolsPlugin.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/vendor/repack/dev-server/src/plugins/devtools/devtoolsPlugin.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'path'\n\nimport type { FastifyInstance } from 'fastify'\nimport fastifyPlugin from 'fastify-plugin'\nimport open from 'open'\n\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 } = JSON.parse(request.body as string) 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\n const openEditor = (await import('open-editor')).default\n\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('/inspector/device', { logLevel: 'silent' as any }, (_request, reply) => {\n reply.code(404).send()\n })\n}\n\nexport default fastifyPlugin(devtoolsPlugin, {\n name: 'devtools-plugin',\n dependencies: ['wss-plugin'],\n})\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AAGjB,OAAO,mBAAmB;AAC1B,OAAO,UAAU;AAIjB,eAAe,eACb,UACA,EAAE,QAAQ,GACV;AACA,WAAS,MAAM;AAAA,IACb,QAAQ,CAAC,OAAO,QAAQ,KAAK;AAAA,IAC7B,KAAK;AAAA,IACL,SAAS,CAAC,UAAU,UAAU;AAC5B,eAAS,IAAI,cAAc,UAAU,QAAQ;AAC7C,YAAM,KAAK,IAAI;AAAA,IACjB;AA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EAAE,KAAK;AAAA,MACvB;AAAA,IACF;AAAA,EACF,CAAC;AAED,WAAS,MAAM;AAAA,IACb,QAAQ,CAAC,OAAO,QAAQ,KAAK;AAAA,IAC7B,KAAK;AAAA,IACL,SAAS,OAAO,SAAS,UAAU;AACjC,UAAI;AACF,cAAM,EAAE,IAAI,IAAI,KAAK,MAAM,QAAQ,IAAc;AACjD,gBAAQ,IAAI,KAAK,EAAE,KAAK,eAAe,IAAI,CAAC;AAC5C,cAAM,KAAK,GAAG;AACd,cAAM,KAAK,IAAI;AAAA,MACjB,SAAS,OAAP;AACA,gBAAQ,IAAI,MAAM,EAAE,KAAK,sBAAsB,MAAM,CAAC;AACtD,cAAM,KAAK,GAAG,EAAE,KAAK;AAAA,MACvB;AAAA,IACF;AAAA,EACF,CAAC;AAGD,WAAS,IAAI,qBAAqB,EAAE,UAAU,SAAgB,GAAG,CAAC,UAAU,UAAU;AACpF,UAAM,KAAK,GAAG,EAAE,KAAK;AAAA,EACvB,CAAC;AACH;AAEA,IAAO,yBAAQ,cAAc,gBAAgB;AAAA,EAC3C,MAAM;AAAA,EACN,cAAc,CAAC,YAAY;AAC7B,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fastifyFavicon from "fastify-favicon";
|
|
2
|
+
import fastifyPlugin from "fastify-plugin";
|
|
3
|
+
const pathToImg = new URL("../../img", import.meta.url).pathname;
|
|
4
|
+
async function faviconPlugin(instance) {
|
|
5
|
+
instance.register(fastifyFavicon, { path: pathToImg });
|
|
6
|
+
}
|
|
7
|
+
var faviconPlugin_default = fastifyPlugin(faviconPlugin, {
|
|
8
|
+
name: "favicon-plugin"
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
faviconPlugin_default as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=faviconPlugin.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/vendor/repack/dev-server/src/plugins/favicon/faviconPlugin.ts"],
|
|
4
|
+
"sourcesContent": ["import type { FastifyInstance } from 'fastify'\nimport fastifyFavicon from 'fastify-favicon'\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"],
|
|
5
|
+
"mappings": "AACA,OAAO,oBAAoB;AAC3B,OAAO,mBAAmB;AAG1B,MAAM,YAAY,IAAI,IAAI,aAAa,YAAY,GAAG,EAAE;AAExD,eAAe,cAAc,UAA2B;AACtD,WAAS,SAAS,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvD;AAEA,IAAO,wBAAQ,cAAc,eAAe;AAAA,EAC1C,MAAM;AACR,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/vendor/repack/dev-server/src/plugins/multipart/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { default } from './multipartPlugin'\nexport * from './types'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAAA,gBAAe;AACxB,cAAc;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PassThrough } from "stream";
|
|
2
|
+
import fastifyPlugin from "fastify-plugin";
|
|
3
|
+
const CRLF = "\r\n";
|
|
4
|
+
const BOUNDARY = "3beqjf3apnqeu3h5jqorms4i";
|
|
5
|
+
async function multipartPlugin(instance) {
|
|
6
|
+
function asMultipart() {
|
|
7
|
+
if (this.request.headers.accept !== "multipart/mixed") {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
10
|
+
const headers = {};
|
|
11
|
+
const stream = new PassThrough();
|
|
12
|
+
this.code(200).header("Content-Type", `multipart/mixed; boundary="${BOUNDARY}"`).send(stream);
|
|
13
|
+
function serializeHeaders(headers2) {
|
|
14
|
+
return Object.keys(headers2).map((key) => `${key}: ${headers2[key]}`).join(CRLF);
|
|
15
|
+
}
|
|
16
|
+
function writeChunk(headers2, data, isLast) {
|
|
17
|
+
let chunk = `${CRLF}--${BOUNDARY}${CRLF}`;
|
|
18
|
+
if (headers2) {
|
|
19
|
+
chunk += serializeHeaders(headers2) + CRLF + CRLF;
|
|
20
|
+
}
|
|
21
|
+
if (data) {
|
|
22
|
+
chunk += data;
|
|
23
|
+
}
|
|
24
|
+
if (isLast) {
|
|
25
|
+
chunk += `${CRLF}--${BOUNDARY}--${CRLF}`;
|
|
26
|
+
}
|
|
27
|
+
stream.write(chunk);
|
|
28
|
+
}
|
|
29
|
+
function setHeader(name, value) {
|
|
30
|
+
headers[name] = value;
|
|
31
|
+
}
|
|
32
|
+
function end(data) {
|
|
33
|
+
writeChunk(headers, data, true);
|
|
34
|
+
stream.end();
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
writeChunk,
|
|
38
|
+
setHeader,
|
|
39
|
+
end
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
instance.decorateReply("asMultipart", asMultipart);
|
|
43
|
+
}
|
|
44
|
+
var multipartPlugin_default = fastifyPlugin(multipartPlugin, {
|
|
45
|
+
name: "multipart-plugin"
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
multipartPlugin_default as default
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=multipartPlugin.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/vendor/repack/dev-server/src/plugins/multipart/multipartPlugin.ts"],
|
|
4
|
+
"sourcesContent": ["import type { IncomingHttpHeaders } from 'http'\nimport { PassThrough } from 'stream'\n\nimport type { FastifyInstance, FastifyReply } from 'fastify'\nimport fastifyPlugin from 'fastify-plugin'\n\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>(headers: IncomingHttpHeaders, data: T, isLast?: boolean) {\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"],
|
|
5
|
+
"mappings": "AACA,SAAS,mBAAmB;AAG5B,OAAO,mBAAmB;AAS1B,MAAM,OAAO;AACb,MAAM,WAAW;AAEjB,eAAe,gBAAgB,UAA2B;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