@fluidframework/tool-utils 2.41.0-338401 → 2.41.0
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 +4 -0
- package/dist/httpHelpers.d.ts.map +1 -1
- package/dist/httpHelpers.js +0 -5
- package/dist/httpHelpers.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/httpHelpers.d.ts.map +1 -1
- package/lib/httpHelpers.js +0 -5
- package/lib/httpHelpers.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +7 -7
- package/src/httpHelpers.ts +0 -5
- package/src/packageVersion.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpHelpers.d.ts","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIvC,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,IAAI,IAAI,CAAC;CACnB;AAID,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,IAAI,CAAC,eAAe,GACnC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"httpHelpers.d.ts","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIvC,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,IAAI,IAAI,CAAC;CACnB;AAID,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,IAAI,CAAC,eAAe,GACnC,kBAAkB,CAmBpB;AAID,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACpC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,KACpB,OAAO,CAAC,CAAC,CAAC,CAAC;AAIhB,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAI9D,eAAO,MAAM,qBAAqB,YAC3B,MAAM,WACH,oBAAoB,CAAC,CAAC,KAC7B,mBAAmB,CAAC,CAoBpB,CAAC;AAIJ,eAAO,MAAM,WAAW,aAAoB,KAAK,cAAc,KAAG,QAAQ,IAAI,CAO3E,CAAC"}
|
package/dist/httpHelpers.js
CHANGED
|
@@ -12,9 +12,7 @@ const node_http_1 = __importDefault(require("node:http"));
|
|
|
12
12
|
// TODO: Add documentation
|
|
13
13
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
14
14
|
function createTrackedServer(port, requestListener) {
|
|
15
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
16
15
|
const server = node_http_1.default.createServer(requestListener).listen(port);
|
|
17
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
18
16
|
const sockets = new Set();
|
|
19
17
|
server.on("connection", (socket) => {
|
|
20
18
|
sockets.add(socket);
|
|
@@ -25,7 +23,6 @@ function createTrackedServer(port, requestListener) {
|
|
|
25
23
|
sockets,
|
|
26
24
|
fullyClose() {
|
|
27
25
|
server.close();
|
|
28
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
29
26
|
for (const socket of sockets) {
|
|
30
27
|
socket.destroy();
|
|
31
28
|
}
|
|
@@ -38,9 +35,7 @@ exports.createTrackedServer = createTrackedServer;
|
|
|
38
35
|
const serverListenAndHandle = async (port, handler) =>
|
|
39
36
|
// eslint-disable-next-line promise/param-names
|
|
40
37
|
new Promise((outerResolve, outerReject) => {
|
|
41
|
-
// eslint-disable-next-line promise/param-names, jsdoc/require-jsdoc
|
|
42
38
|
const innerP = new Promise((innerResolve, innerReject) => {
|
|
43
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
44
39
|
const httpServer = createTrackedServer(port, (req, res) => {
|
|
45
40
|
// ignore favicon
|
|
46
41
|
if (req.url === "/favicon.ico") {
|
package/dist/httpHelpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpHelpers.js","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,0DAA6B;AAW7B,0BAA0B;AAC1B,+CAA+C;AAC/C,SAAgB,mBAAmB,CAClC,IAAY,EACZ,eAAqC;IAErC
|
|
1
|
+
{"version":3,"file":"httpHelpers.js","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,0DAA6B;AAW7B,0BAA0B;AAC1B,+CAA+C;AAC/C,SAAgB,mBAAmB,CAClC,IAAY,EACZ,eAAqC;IAErC,MAAM,MAAM,GAAG,mBAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;QAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,MAAM,CAA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C;IAClC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAvBS,QAAA,qBAAqB,yBAuB9B;AAEJ,0BAA0B;AAC1B,+CAA+C;AACxC,MAAM,WAAW,GAAG,KAAK,EAAE,QAA6B,EAAiB,EAAE,CACjF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC/B,IAAI,CAAC;QACJ,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;AACF,CAAC,CAAC,CAAC;AAPS,QAAA,WAAW,eAOpB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport http from \"node:http\";\nimport type { Socket } from \"node:net\";\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport interface ITrackedHttpServer {\n\treadonly server: http.Server;\n\treadonly sockets: Set<Socket>;\n\tfullyClose(): void;\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function createTrackedServer(\n\tport: number,\n\trequestListener: http.RequestListener,\n): ITrackedHttpServer {\n\tconst server = http.createServer(requestListener).listen(port);\n\tconst sockets = new Set<Socket>();\n\n\tserver.on(\"connection\", (socket) => {\n\t\tsockets.add(socket);\n\t\tsocket.on(\"close\", () => sockets.delete(socket));\n\t});\n\n\treturn {\n\t\tserver,\n\t\tsockets,\n\t\tfullyClose(): void {\n\t\t\tserver.close();\n\t\t\tfor (const socket of sockets) {\n\t\t\t\tsocket.destroy();\n\t\t\t}\n\t\t},\n\t};\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport type OnceListenerHandler<T> = (\n\treq: http.IncomingMessage,\n\tres: http.ServerResponse,\n) => Promise<T>;\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport type OnceListenerResult<T> = Promise<() => Promise<T>>;\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport const serverListenAndHandle = async <T>(\n\tport: number,\n\thandler: OnceListenerHandler<T>,\n): OnceListenerResult<T> =>\n\t// eslint-disable-next-line promise/param-names\n\tnew Promise((outerResolve, outerReject) => {\n\t\tconst innerP = new Promise<T>((innerResolve, innerReject) => {\n\t\t\tconst httpServer = createTrackedServer(port, (req, res) => {\n\t\t\t\t// ignore favicon\n\t\t\t\tif (req.url === \"/favicon.ico\") {\n\t\t\t\t\tres.writeHead(200, { \"Content-Type\": \"image/x-icon\" });\n\t\t\t\t\tres.end();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thandler(req, res)\n\t\t\t\t\t.finally(() => httpServer.fullyClose())\n\t\t\t\t\t.then(\n\t\t\t\t\t\t(result) => innerResolve(result),\n\t\t\t\t\t\t(error) => innerReject(error),\n\t\t\t\t\t);\n\t\t\t});\n\t\t\touterResolve(async () => innerP);\n\t\t});\n\t});\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport const endResponse = async (response: http.ServerResponse): Promise<void> =>\n\tnew Promise((resolve, reject) => {\n\t\ttry {\n\t\t\tresponse.end(resolve);\n\t\t} catch (error) {\n\t\t\treject(error);\n\t\t}\n\t});\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/tool-utils";
|
|
8
|
-
export declare const pkgVersion = "2.41.0
|
|
8
|
+
export declare const pkgVersion = "2.41.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,WAAW,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/tool-utils";
|
|
11
|
-
exports.pkgVersion = "2.41.0
|
|
11
|
+
exports.pkgVersion = "2.41.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tool-utils\";\nexport const pkgVersion = \"2.41.0\";\n"]}
|
package/lib/httpHelpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpHelpers.d.ts","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;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AAoB,KAAK,cAAc,KAAG,QAAQ,IAAI,CAO3E,CAAC"}
|
package/lib/httpHelpers.js
CHANGED
|
@@ -6,9 +6,7 @@ import http from "node:http";
|
|
|
6
6
|
// TODO: Add documentation
|
|
7
7
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
8
8
|
export function createTrackedServer(port, requestListener) {
|
|
9
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
10
9
|
const server = http.createServer(requestListener).listen(port);
|
|
11
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
12
10
|
const sockets = new Set();
|
|
13
11
|
server.on("connection", (socket) => {
|
|
14
12
|
sockets.add(socket);
|
|
@@ -19,7 +17,6 @@ export function createTrackedServer(port, requestListener) {
|
|
|
19
17
|
sockets,
|
|
20
18
|
fullyClose() {
|
|
21
19
|
server.close();
|
|
22
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
23
20
|
for (const socket of sockets) {
|
|
24
21
|
socket.destroy();
|
|
25
22
|
}
|
|
@@ -31,9 +28,7 @@ export function createTrackedServer(port, requestListener) {
|
|
|
31
28
|
export const serverListenAndHandle = async (port, handler) =>
|
|
32
29
|
// eslint-disable-next-line promise/param-names
|
|
33
30
|
new Promise((outerResolve, outerReject) => {
|
|
34
|
-
// eslint-disable-next-line promise/param-names, jsdoc/require-jsdoc
|
|
35
31
|
const innerP = new Promise((innerResolve, innerReject) => {
|
|
36
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
37
32
|
const httpServer = createTrackedServer(port, (req, res) => {
|
|
38
33
|
// ignore favicon
|
|
39
34
|
if (req.url === "/favicon.ico") {
|
package/lib/httpHelpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpHelpers.js","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAW7B,0BAA0B;AAC1B,+CAA+C;AAC/C,MAA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B;YACjB,IAAI,GAAG,CAAC,GAAG,KAAK,cAAc,EAAE,CAAC;gBAChC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC;gBACvD,GAAG,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO;YACR,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;iBACf,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;iBACtC,IAAI,CACJ,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EAChC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAC7B,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEJ,0BAA0B;AAC1B,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,QAA6B,EAAiB,EAAE,CACjF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC/B,IAAI,CAAC;QACJ,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport http from \"node:http\";\nimport type { Socket } from \"node:net\";\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport interface ITrackedHttpServer {\n\treadonly server: http.Server;\n\treadonly sockets: Set<Socket>;\n\tfullyClose(): void;\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function createTrackedServer(\n\tport: number,\n\trequestListener: http.RequestListener,\n): ITrackedHttpServer {\n\tconst server = http.createServer(requestListener).listen(port);\n\tconst sockets = new Set<Socket>();\n\n\tserver.on(\"connection\", (socket) => {\n\t\tsockets.add(socket);\n\t\tsocket.on(\"close\", () => sockets.delete(socket));\n\t});\n\n\treturn {\n\t\tserver,\n\t\tsockets,\n\t\tfullyClose(): void {\n\t\t\tserver.close();\n\t\t\tfor (const socket of sockets) {\n\t\t\t\tsocket.destroy();\n\t\t\t}\n\t\t},\n\t};\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport type OnceListenerHandler<T> = (\n\treq: http.IncomingMessage,\n\tres: http.ServerResponse,\n) => Promise<T>;\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport type OnceListenerResult<T> = Promise<() => Promise<T>>;\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport const serverListenAndHandle = async <T>(\n\tport: number,\n\thandler: OnceListenerHandler<T>,\n): OnceListenerResult<T> =>\n\t// eslint-disable-next-line promise/param-names\n\tnew Promise((outerResolve, outerReject) => {\n\t\tconst innerP = new Promise<T>((innerResolve, innerReject) => {\n\t\t\tconst httpServer = createTrackedServer(port, (req, res) => {\n\t\t\t\t// ignore favicon\n\t\t\t\tif (req.url === \"/favicon.ico\") {\n\t\t\t\t\tres.writeHead(200, { \"Content-Type\": \"image/x-icon\" });\n\t\t\t\t\tres.end();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thandler(req, res)\n\t\t\t\t\t.finally(() => httpServer.fullyClose())\n\t\t\t\t\t.then(\n\t\t\t\t\t\t(result) => innerResolve(result),\n\t\t\t\t\t\t(error) => innerReject(error),\n\t\t\t\t\t);\n\t\t\t});\n\t\t\touterResolve(async () => innerP);\n\t\t});\n\t});\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport const endResponse = async (response: http.ServerResponse): Promise<void> =>\n\tnew Promise((resolve, reject) => {\n\t\ttry {\n\t\t\tresponse.end(resolve);\n\t\t} catch (error) {\n\t\t\treject(error);\n\t\t}\n\t});\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/tool-utils";
|
|
8
|
-
export declare const pkgVersion = "2.41.0
|
|
8
|
+
export declare const pkgVersion = "2.41.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,WAAW,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tool-utils\";\nexport const pkgVersion = \"2.41.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tool-utils",
|
|
3
|
-
"version": "2.41.0
|
|
3
|
+
"version": "2.41.0",
|
|
4
4
|
"description": "Common utilities for Fluid tools",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"temp-directory": "nyc/.nyc_output"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@fluidframework/core-utils": "2.41.0
|
|
63
|
-
"@fluidframework/driver-definitions": "2.41.0
|
|
64
|
-
"@fluidframework/driver-utils": "2.41.0
|
|
65
|
-
"@fluidframework/odsp-doclib-utils": "2.41.0
|
|
62
|
+
"@fluidframework/core-utils": "~2.41.0",
|
|
63
|
+
"@fluidframework/driver-definitions": "~2.41.0",
|
|
64
|
+
"@fluidframework/driver-utils": "~2.41.0",
|
|
65
|
+
"@fluidframework/odsp-doclib-utils": "~2.41.0",
|
|
66
66
|
"async-mutex": "^0.3.1",
|
|
67
67
|
"debug": "^4.3.4",
|
|
68
68
|
"jwt-decode": "^4.0.0",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
73
73
|
"@biomejs/biome": "~1.9.3",
|
|
74
|
-
"@fluid-internal/mocha-test-setup": "2.41.0
|
|
74
|
+
"@fluid-internal/mocha-test-setup": "~2.41.0",
|
|
75
75
|
"@fluid-tools/build-cli": "^0.55.0",
|
|
76
76
|
"@fluidframework/build-common": "^2.0.3",
|
|
77
77
|
"@fluidframework/build-tools": "^0.55.0",
|
|
78
|
-
"@fluidframework/eslint-config-fluid": "^5.7.
|
|
78
|
+
"@fluidframework/eslint-config-fluid": "^5.7.4",
|
|
79
79
|
"@fluidframework/tool-utils-previous": "npm:@fluidframework/tool-utils@2.40.0",
|
|
80
80
|
"@microsoft/api-extractor": "7.52.8",
|
|
81
81
|
"@types/debug": "^4.1.5",
|
package/src/httpHelpers.ts
CHANGED
|
@@ -20,9 +20,7 @@ export function createTrackedServer(
|
|
|
20
20
|
port: number,
|
|
21
21
|
requestListener: http.RequestListener,
|
|
22
22
|
): ITrackedHttpServer {
|
|
23
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
24
23
|
const server = http.createServer(requestListener).listen(port);
|
|
25
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
26
24
|
const sockets = new Set<Socket>();
|
|
27
25
|
|
|
28
26
|
server.on("connection", (socket) => {
|
|
@@ -35,7 +33,6 @@ export function createTrackedServer(
|
|
|
35
33
|
sockets,
|
|
36
34
|
fullyClose(): void {
|
|
37
35
|
server.close();
|
|
38
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
39
36
|
for (const socket of sockets) {
|
|
40
37
|
socket.destroy();
|
|
41
38
|
}
|
|
@@ -62,9 +59,7 @@ export const serverListenAndHandle = async <T>(
|
|
|
62
59
|
): OnceListenerResult<T> =>
|
|
63
60
|
// eslint-disable-next-line promise/param-names
|
|
64
61
|
new Promise((outerResolve, outerReject) => {
|
|
65
|
-
// eslint-disable-next-line promise/param-names, jsdoc/require-jsdoc
|
|
66
62
|
const innerP = new Promise<T>((innerResolve, innerReject) => {
|
|
67
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
68
63
|
const httpServer = createTrackedServer(port, (req, res) => {
|
|
69
64
|
// ignore favicon
|
|
70
65
|
if (req.url === "/favicon.ico") {
|
package/src/packageVersion.ts
CHANGED