Skip to content

Commit fcba7d1

Browse files
author
Jacek Piętal
committed
fix: type
1 parent 3d3360e commit fcba7d1

37 files changed

+2069
-10633
lines changed

dist/config.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { WSConfig } from "./types";
22
declare const config: WSConfig;
33
export default config;
4-
//# sourceMappingURL=config.d.ts.map
4+
//# sourceMappingURL=config.d.ts.map

dist/config.js

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,33 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
const path_1 = require("path");
44
const ssl = {
5-
key: getParam(
6-
"key",
7-
(0, path_1.resolve)(__dirname, "..", "ssl", "example.key")
8-
),
9-
cert: getParam(
10-
"cert",
11-
(0, path_1.resolve)(__dirname, "..", "ssl", "example.crt")
12-
),
5+
key: getParam("key", (0, path_1.resolve)(__dirname, "..", "ssl", "example.key")),
6+
cert: getParam("cert", (0, path_1.resolve)(__dirname, "..", "ssl", "example.crt")),
137
};
148
const config = {
15-
// this enables http/ws logs
16-
debug: process.argv.includes("--debug"),
17-
// port on which the server listens
18-
port: Number(process.env.PORT || 4200),
19-
// you can use --plugin ./path/to/plugin.js any number of times
20-
plugins: {},
21-
// handshake event
22-
join: "/join",
23-
// disconnect from room event
24-
leave: "/leave",
25-
// folder to static serve files
26-
folder: process.argv[2],
27-
// type of server to start
28-
type: process.argv.includes("--uws") ? "uws" : "express",
29-
// ssl = undefined | { key, cert }
30-
ssl: process.argv.includes("--ssl") ? ssl : undefined,
31-
// max cache size prevents oom
32-
maxCacheSize: 128,
9+
// this enables http/ws logs
10+
debug: process.argv.includes("--debug"),
11+
// port on which the server listens
12+
port: Number(process.env.PORT || 4200),
13+
// you can use --plugin ./path/to/plugin.js any number of times
14+
plugins: {},
15+
// handshake event
16+
join: "/join",
17+
// disconnect from room event
18+
leave: "/leave",
19+
// folder to static serve files
20+
folder: process.argv[2],
21+
// type of server to start
22+
type: process.argv.includes("--uws") ? "uws" : "express",
23+
// ssl = undefined | { key, cert }
24+
ssl: process.argv.includes("--ssl") ? ssl : undefined,
25+
// max cache size prevents oom
26+
maxCacheSize: 128,
3327
};
3428
function getParam(find, fallback) {
35-
const matches = process.argv.join(" ").match(new RegExp(`--${find} ([^ ]+)`));
36-
return matches ? matches[1] : fallback;
29+
const matches = process.argv
30+
.join(" ")
31+
.match(new RegExp(`--${find} ([^ ]+)`));
32+
return matches ? matches[1] : fallback;
3733
}
3834
exports.default = config;

dist/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from "./types";
22
export * from "./server";
3-
//# sourceMappingURL=index.d.ts.map
3+
//# sourceMappingURL=index.d.ts.map

dist/index.js

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,18 @@
11
"use strict";
2-
var __createBinding =
3-
(this && this.__createBinding) ||
4-
(Object.create
5-
? function (o, m, k, k2) {
6-
if (k2 === undefined) k2 = k;
7-
var desc = Object.getOwnPropertyDescriptor(m, k);
8-
if (
9-
!desc ||
10-
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11-
) {
12-
desc = {
13-
enumerable: true,
14-
get: function () {
15-
return m[k];
16-
},
17-
};
18-
}
19-
Object.defineProperty(o, k2, desc);
20-
}
21-
: function (o, m, k, k2) {
22-
if (k2 === undefined) k2 = k;
23-
o[k2] = m[k];
24-
});
25-
var __exportStar =
26-
(this && this.__exportStar) ||
27-
function (m, exports) {
28-
for (var p in m)
29-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
30-
__createBinding(exports, m, p);
31-
};
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
14+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15+
};
3216
Object.defineProperty(exports, "__esModule", { value: true });
3317
__exportStar(require("./types"), exports);
3418
__exportStar(require("./server"), exports);

dist/plugins.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { WSConfig, WSPlugin } from "./types.js";
22
export declare function populatePlugins(config: WSConfig): Promise<void>;
3-
export declare function getPlugin(
4-
config: WSConfig,
5-
topic: string
6-
): WSPlugin | undefined;
7-
//# sourceMappingURL=plugins.d.ts.map
3+
export declare function getPlugin(config: WSConfig, topic: string): WSPlugin | undefined;
4+
//# sourceMappingURL=plugins.d.ts.map

dist/plugins.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
exports.getPlugin = exports.populatePlugins = void 0;
44
const path_1 = require("path");
55
async function populatePlugins(config) {
6-
// get plugins from bash regex
7-
const matches = process.argv.join(" ").match(/--plugin [^ ]+/);
8-
if (matches) {
9-
// we need to get our promises in order
10-
const syncMap = matches.map((path) => {
11-
const [_, plugin] = path.split(" ");
12-
return import((0, path_1.resolve)(plugin));
13-
});
14-
// so the main function awaits properly
15-
const plugins = await Promise.all(syncMap);
16-
plugins.forEach(({ default: plugin }) => {
17-
// populate plugins
18-
config.plugins[plugin.name] = plugin;
19-
});
20-
}
6+
// get plugins from bash regex
7+
const matches = process.argv
8+
.join(" ")
9+
.match(/--plugin [^ ]+/);
10+
if (matches) {
11+
// we need to get our promises in order
12+
const syncMap = matches.map((path) => {
13+
const [_, plugin] = path.split(" ");
14+
return import((0, path_1.resolve)(plugin));
15+
});
16+
// so the main function awaits properly
17+
const plugins = await Promise.all(syncMap);
18+
plugins.forEach(({ default: plugin }) => {
19+
// populate plugins
20+
config.plugins[plugin.name] = plugin;
21+
});
22+
}
2123
}
2224
exports.populatePlugins = populatePlugins;
2325
function getPlugin(config, topic) {
24-
// check if we have such plugin
25-
return config.plugins[topic];
26+
// check if we have such plugin
27+
return config.plugins[topic];
2628
}
2729
exports.getPlugin = getPlugin;

dist/server/get-url.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export default function getUrl(url: string): string;
2-
//# sourceMappingURL=get-url.d.ts.map
2+
//# sourceMappingURL=get-url.d.ts.map

dist/server/get-url.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
33
function getUrl(url) {
4-
return decodeURIComponent(
5-
url.replace(/^\/+/, "").split("?")[0].split("#")[0]
6-
);
4+
return decodeURIComponent(url.replace(/^\/+/, "").split("?")[0].split("#")[0]);
75
}
86
exports.default = getUrl;

dist/server/index.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ import { WSConfig, WSServer, WSCoreConsumer } from "../types.js";
55
* @param {WSCoreConsumer} coreConsumer
66
* @returns {WSServer}
77
*/
8-
export declare function chef(
9-
config: WSConfig,
10-
{ createServer, requestHandler }: WSCoreConsumer
11-
): Promise<WSServer>;
12-
//# sourceMappingURL=index.d.ts.map
8+
export declare function chef(config: Partial<WSConfig>, { createServer, requestHandler }: WSCoreConsumer): Promise<WSServer>;
9+
//# sourceMappingURL=index.d.ts.map

dist/server/index.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)