@fluid-internal/client-utils 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +16 -0
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +37 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +4 -0
- package/api-report/client-utils.api.md +130 -0
- package/dist/base64Encoding.cjs +46 -0
- package/dist/base64Encoding.cjs.map +1 -0
- package/dist/base64Encoding.d.ts +28 -0
- package/dist/base64Encoding.d.ts.map +1 -0
- package/dist/bufferBrowser.cjs +212 -0
- package/dist/bufferBrowser.cjs.map +1 -0
- package/dist/bufferBrowser.d.ts +84 -0
- package/dist/bufferBrowser.d.ts.map +1 -0
- package/dist/bufferNode.cjs +59 -0
- package/dist/bufferNode.cjs.map +1 -0
- package/dist/bufferNode.d.ts +62 -0
- package/dist/bufferNode.d.ts.map +1 -0
- package/dist/bufferShared.cjs +21 -0
- package/dist/bufferShared.cjs.map +1 -0
- package/dist/bufferShared.d.ts +12 -0
- package/dist/bufferShared.d.ts.map +1 -0
- package/dist/client-utils-alpha.d.ts +82 -0
- package/dist/client-utils-beta.d.ts +73 -0
- package/dist/client-utils-public.d.ts +73 -0
- package/dist/client-utils-untrimmed.d.ts +247 -0
- package/dist/eventForwarder.cjs +98 -0
- package/dist/eventForwarder.cjs.map +1 -0
- package/dist/eventForwarder.d.ts +34 -0
- package/dist/eventForwarder.d.ts.map +1 -0
- package/dist/hashFileBrowser.cjs +99 -0
- package/dist/hashFileBrowser.cjs.map +1 -0
- package/dist/hashFileBrowser.d.ts +30 -0
- package/dist/hashFileBrowser.d.ts.map +1 -0
- package/dist/hashFileNode.cjs +56 -0
- package/dist/hashFileNode.cjs.map +1 -0
- package/dist/hashFileNode.d.ts +30 -0
- package/dist/hashFileNode.d.ts.map +1 -0
- package/dist/index.cjs +45 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/indexBrowser.cjs +19 -0
- package/dist/indexBrowser.cjs.map +1 -0
- package/dist/indexBrowser.d.ts +8 -0
- package/dist/indexBrowser.d.ts.map +1 -0
- package/dist/indexNode.cjs +19 -0
- package/dist/indexNode.cjs.map +1 -0
- package/dist/indexNode.d.ts +8 -0
- package/dist/indexNode.d.ts.map +1 -0
- package/dist/performanceIsomorphic.cjs +17 -0
- package/dist/performanceIsomorphic.cjs.map +1 -0
- package/dist/performanceIsomorphic.d.ts +21 -0
- package/dist/performanceIsomorphic.d.ts.map +1 -0
- package/dist/trace.cjs +36 -0
- package/dist/trace.cjs.map +1 -0
- package/dist/trace.d.ts +40 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/typedEventEmitter.cjs +28 -0
- package/dist/typedEventEmitter.cjs.map +1 -0
- package/dist/typedEventEmitter.d.ts +36 -0
- package/dist/typedEventEmitter.d.ts.map +1 -0
- package/jest-puppeteer.config.js +13 -0
- package/jest.config.js +20 -0
- package/lib/base64Encoding.d.mts +28 -0
- package/lib/base64Encoding.d.mts.map +1 -0
- package/lib/base64Encoding.mjs +40 -0
- package/lib/base64Encoding.mjs.map +1 -0
- package/lib/bufferBrowser.d.mts +84 -0
- package/lib/bufferBrowser.d.mts.map +1 -0
- package/lib/bufferBrowser.mjs +181 -0
- package/lib/bufferBrowser.mjs.map +1 -0
- package/lib/bufferNode.d.mts +62 -0
- package/lib/bufferNode.d.mts.map +1 -0
- package/lib/bufferNode.mjs +53 -0
- package/lib/bufferNode.mjs.map +1 -0
- package/lib/bufferShared.d.mts +12 -0
- package/lib/bufferShared.d.mts.map +1 -0
- package/lib/bufferShared.mjs +17 -0
- package/lib/bufferShared.mjs.map +1 -0
- package/lib/client-utils-alpha.d.mts +82 -0
- package/lib/client-utils-beta.d.mts +73 -0
- package/lib/client-utils-public.d.mts +73 -0
- package/lib/client-utils-untrimmed.d.mts +247 -0
- package/lib/eventForwarder.d.mts +34 -0
- package/lib/eventForwarder.d.mts.map +1 -0
- package/lib/eventForwarder.mjs +94 -0
- package/lib/eventForwarder.mjs.map +1 -0
- package/lib/hashFileBrowser.d.mts +30 -0
- package/lib/hashFileBrowser.d.mts.map +1 -0
- package/lib/hashFileBrowser.mjs +71 -0
- package/lib/hashFileBrowser.mjs.map +1 -0
- package/lib/hashFileNode.d.mts +30 -0
- package/lib/hashFileNode.d.mts.map +1 -0
- package/lib/hashFileNode.mjs +51 -0
- package/lib/hashFileNode.mjs.map +1 -0
- package/lib/index.d.mts +12 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +11 -0
- package/lib/index.mjs.map +1 -0
- package/lib/indexBrowser.d.mts +8 -0
- package/lib/indexBrowser.d.mts.map +1 -0
- package/lib/indexBrowser.mjs +8 -0
- package/lib/indexBrowser.mjs.map +1 -0
- package/lib/indexNode.d.mts +8 -0
- package/lib/indexNode.d.mts.map +1 -0
- package/lib/indexNode.mjs +8 -0
- package/lib/indexNode.mjs.map +1 -0
- package/lib/performanceIsomorphic.d.mts +21 -0
- package/lib/performanceIsomorphic.d.mts.map +1 -0
- package/lib/performanceIsomorphic.mjs +14 -0
- package/lib/performanceIsomorphic.mjs.map +1 -0
- package/lib/trace.d.mts +40 -0
- package/lib/trace.d.mts.map +1 -0
- package/lib/trace.mjs +32 -0
- package/lib/trace.mjs.map +1 -0
- package/lib/typedEventEmitter.d.mts +36 -0
- package/lib/typedEventEmitter.d.mts.map +1 -0
- package/lib/typedEventEmitter.mjs +22 -0
- package/lib/typedEventEmitter.mjs.map +1 -0
- package/package.json +138 -0
- package/prettier.config.cjs +8 -0
- package/src/base64Encoding.ts +45 -0
- package/src/bufferBrowser.ts +208 -0
- package/src/bufferNode.ts +89 -0
- package/src/bufferShared.ts +17 -0
- package/src/eventForwarder.ts +122 -0
- package/src/hashFileBrowser.ts +84 -0
- package/src/hashFileNode.ts +59 -0
- package/src/index.ts +22 -0
- package/src/indexBrowser.ts +14 -0
- package/src/indexNode.ts +14 -0
- package/src/performanceIsomorphic.ts +23 -0
- package/src/trace.ts +58 -0
- package/src/typedEventEmitter.ts +79 -0
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +13 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.TypedEventEmitter = exports.Trace = exports.EventForwarder = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = void 0;
|
|
22
|
+
var base64Encoding_1 = require("./base64Encoding.cjs");
|
|
23
|
+
Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64Encoding_1.fromBase64ToUtf8; } });
|
|
24
|
+
Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64Encoding_1.fromUtf8ToBase64; } });
|
|
25
|
+
Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64Encoding_1.toUtf8; } });
|
|
26
|
+
var bufferShared_1 = require("./bufferShared.cjs");
|
|
27
|
+
Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_1.Uint8ArrayToArrayBuffer; } });
|
|
28
|
+
var eventForwarder_1 = require("./eventForwarder.cjs");
|
|
29
|
+
Object.defineProperty(exports, "EventForwarder", { enumerable: true, get: function () { return eventForwarder_1.EventForwarder; } });
|
|
30
|
+
/**
|
|
31
|
+
* NOTE: This export is remapped to export from "./indexBrowser" in browser environments via package.json.
|
|
32
|
+
* Because the two files don't have fully isomorphic exports, using named exports for the full API surface
|
|
33
|
+
* is problematic if that named export includes values not in their intersection.
|
|
34
|
+
*
|
|
35
|
+
* In a future breaking change of client-utils, we could use a named export for their intersection if we
|
|
36
|
+
* desired.
|
|
37
|
+
*/
|
|
38
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
39
|
+
__exportStar(require("./indexNode.cjs"), exports);
|
|
40
|
+
// export { IRange, IRangeTrackerSnapshot, RangeTracker } from "./rangeTracker";
|
|
41
|
+
var trace_1 = require("./trace.cjs");
|
|
42
|
+
Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return trace_1.Trace; } });
|
|
43
|
+
var typedEventEmitter_1 = require("./typedEventEmitter.cjs");
|
|
44
|
+
Object.defineProperty(exports, "TypedEventEmitter", { enumerable: true, get: function () { return typedEventEmitter_1.TypedEventEmitter; } });
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,uDAA8E;AAArE,kHAAA,gBAAgB,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAAE,wGAAA,MAAM,OAAA;AACnD,mDAAyD;AAAhD,uHAAA,uBAAuB,OAAA;AAChC,uDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB;;;;;;;GAOG;AACH,gDAAgD;AAChD,kDAA4B;AAE5B,gFAAgF;AAChF,qCAA6C;AAAvB,8FAAA,KAAK,OAAA;AAC3B,6DAAoG;AAApE,sHAAA,iBAAiB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64Encoding\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared\";\nexport { EventForwarder } from \"./eventForwarder\";\n/**\n * NOTE: This export is remapped to export from \"./indexBrowser\" in browser environments via package.json.\n * Because the two files don't have fully isomorphic exports, using named exports for the full API surface\n * is problematic if that named export includes values not in their intersection.\n *\n * In a future breaking change of client-utils, we could use a named export for their intersection if we\n * desired.\n */\n// eslint-disable-next-line no-restricted-syntax\nexport * from \"./indexNode\";\nexport { IsomorphicPerformance } from \"./performanceIsomorphic\";\n// export { IRange, IRangeTrackerSnapshot, RangeTracker } from \"./rangeTracker\";\nexport { ITraceEvent, Trace } from \"./trace\";\nexport { EventEmitterEventType, TypedEventEmitter, TypedEventTransform } from \"./typedEventEmitter\";\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding";
|
|
6
|
+
export { Uint8ArrayToArrayBuffer } from "./bufferShared";
|
|
7
|
+
export { EventForwarder } from "./eventForwarder";
|
|
8
|
+
/**
|
|
9
|
+
* NOTE: This export is remapped to export from "./indexBrowser" in browser environments via package.json.
|
|
10
|
+
* Because the two files don't have fully isomorphic exports, using named exports for the full API surface
|
|
11
|
+
* is problematic if that named export includes values not in their intersection.
|
|
12
|
+
*
|
|
13
|
+
* In a future breaking change of client-utils, we could use a named export for their intersection if we
|
|
14
|
+
* desired.
|
|
15
|
+
*/
|
|
16
|
+
export * from "./indexNode";
|
|
17
|
+
export { IsomorphicPerformance } from "./performanceIsomorphic";
|
|
18
|
+
export { ITraceEvent, Trace } from "./trace";
|
|
19
|
+
export { EventEmitterEventType, TypedEventEmitter, TypedEventTransform } from "./typedEventEmitter";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.performance = exports.hashFile = exports.gitHashFile = exports.Uint8ArrayToString = exports.stringToBuffer = exports.IsoBuffer = exports.isArrayBuffer = exports.bufferToString = void 0;
|
|
8
|
+
var bufferBrowser_1 = require("./bufferBrowser.cjs");
|
|
9
|
+
Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return bufferBrowser_1.bufferToString; } });
|
|
10
|
+
Object.defineProperty(exports, "isArrayBuffer", { enumerable: true, get: function () { return bufferBrowser_1.isArrayBuffer; } });
|
|
11
|
+
Object.defineProperty(exports, "IsoBuffer", { enumerable: true, get: function () { return bufferBrowser_1.IsoBuffer; } });
|
|
12
|
+
Object.defineProperty(exports, "stringToBuffer", { enumerable: true, get: function () { return bufferBrowser_1.stringToBuffer; } });
|
|
13
|
+
Object.defineProperty(exports, "Uint8ArrayToString", { enumerable: true, get: function () { return bufferBrowser_1.Uint8ArrayToString; } });
|
|
14
|
+
var hashFileBrowser_1 = require("./hashFileBrowser.cjs");
|
|
15
|
+
Object.defineProperty(exports, "gitHashFile", { enumerable: true, get: function () { return hashFileBrowser_1.gitHashFile; } });
|
|
16
|
+
Object.defineProperty(exports, "hashFile", { enumerable: true, get: function () { return hashFileBrowser_1.hashFile; } });
|
|
17
|
+
var performanceIsomorphic_1 = require("./performanceIsomorphic.cjs");
|
|
18
|
+
Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_1.performance; } });
|
|
19
|
+
//# sourceMappingURL=indexBrowser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexBrowser.cjs","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAMyB;AALxB,+GAAA,cAAc,OAAA;AACd,8GAAA,aAAa,OAAA;AACb,0GAAA,SAAS,OAAA;AACT,+GAAA,cAAc,OAAA;AACd,mHAAA,kBAAkB,OAAA;AAEnB,yDAA0D;AAAjD,8GAAA,WAAW,OAAA;AAAE,2GAAA,QAAQ,OAAA;AAC9B,qEAAsD;AAA7C,oHAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tbufferToString,\n\tisArrayBuffer,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferBrowser\";\nexport { gitHashFile, hashFile } from \"./hashFileBrowser\";\nexport { performance } from \"./performanceIsomorphic\";\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { bufferToString, isArrayBuffer, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferBrowser";
|
|
6
|
+
export { gitHashFile, hashFile } from "./hashFileBrowser";
|
|
7
|
+
export { performance } from "./performanceIsomorphic";
|
|
8
|
+
//# sourceMappingURL=indexBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.performance = exports.hashFile = exports.gitHashFile = exports.Uint8ArrayToString = exports.stringToBuffer = exports.IsoBuffer = exports.bufferToString = exports.Buffer = void 0;
|
|
8
|
+
var bufferNode_1 = require("./bufferNode.cjs");
|
|
9
|
+
Object.defineProperty(exports, "Buffer", { enumerable: true, get: function () { return bufferNode_1.Buffer; } });
|
|
10
|
+
Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return bufferNode_1.bufferToString; } });
|
|
11
|
+
Object.defineProperty(exports, "IsoBuffer", { enumerable: true, get: function () { return bufferNode_1.IsoBuffer; } });
|
|
12
|
+
Object.defineProperty(exports, "stringToBuffer", { enumerable: true, get: function () { return bufferNode_1.stringToBuffer; } });
|
|
13
|
+
Object.defineProperty(exports, "Uint8ArrayToString", { enumerable: true, get: function () { return bufferNode_1.Uint8ArrayToString; } });
|
|
14
|
+
var hashFileNode_1 = require("./hashFileNode.cjs");
|
|
15
|
+
Object.defineProperty(exports, "gitHashFile", { enumerable: true, get: function () { return hashFileNode_1.gitHashFile; } });
|
|
16
|
+
Object.defineProperty(exports, "hashFile", { enumerable: true, get: function () { return hashFileNode_1.hashFile; } });
|
|
17
|
+
var performanceIsomorphic_1 = require("./performanceIsomorphic.cjs");
|
|
18
|
+
Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_1.performance; } });
|
|
19
|
+
//# sourceMappingURL=indexNode.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexNode.cjs","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAMsB;AALrB,oGAAA,MAAM,OAAA;AACN,4GAAA,cAAc,OAAA;AACd,uGAAA,SAAS,OAAA;AACT,4GAAA,cAAc,OAAA;AACd,gHAAA,kBAAkB,OAAA;AAEnB,mDAAuD;AAA9C,2GAAA,WAAW,OAAA;AAAE,wGAAA,QAAQ,OAAA;AAC9B,qEAAsD;AAA7C,oHAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tBuffer,\n\tbufferToString,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferNode\";\nexport { gitHashFile, hashFile } from \"./hashFileNode\";\nexport { performance } from \"./performanceIsomorphic\";\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { Buffer, bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferNode";
|
|
6
|
+
export { gitHashFile, hashFile } from "./hashFileNode";
|
|
7
|
+
export { performance } from "./performanceIsomorphic";
|
|
8
|
+
//# sourceMappingURL=indexNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexNode.d.ts","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,cAAc,EACd,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.performance = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* This exported "performance" member masks the built-in globalThis.performance object
|
|
10
|
+
* as an IsomorphicPerformance, which hides all of its features that aren't compatible
|
|
11
|
+
* between Node and browser implementations. Anything exposed on this performance object
|
|
12
|
+
* is considered safe to use regarless of the environment it runs in.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
exports.performance = globalThis.performance;
|
|
17
|
+
//# sourceMappingURL=performanceIsomorphic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performanceIsomorphic.cjs","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH;;;;;;;GAOG;AACU,QAAA,WAAW,GAA0B,UAAU,CAAC,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This type contains all browser performance properties as optional, and some\n * of the intersecting properties of node and browser performance as required.\n *\n * @internal\n */\nexport type IsomorphicPerformance = Partial<Performance> &\n\tPick<Performance, \"clearMarks\" | \"mark\" | \"measure\" | \"now\">;\n\n/**\n * This exported \"performance\" member masks the built-in globalThis.performance object\n * as an IsomorphicPerformance, which hides all of its features that aren't compatible\n * between Node and browser implementations. Anything exposed on this performance object\n * is considered safe to use regarless of the environment it runs in.\n *\n * @internal\n */\nexport const performance: IsomorphicPerformance = globalThis.performance;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* This type contains all browser performance properties as optional, and some
|
|
7
|
+
* of the intersecting properties of node and browser performance as required.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export type IsomorphicPerformance = Partial<Performance> & Pick<Performance, "clearMarks" | "mark" | "measure" | "now">;
|
|
12
|
+
/**
|
|
13
|
+
* This exported "performance" member masks the built-in globalThis.performance object
|
|
14
|
+
* as an IsomorphicPerformance, which hides all of its features that aren't compatible
|
|
15
|
+
* between Node and browser implementations. Anything exposed on this performance object
|
|
16
|
+
* is considered safe to use regarless of the environment it runs in.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare const performance: IsomorphicPerformance;
|
|
21
|
+
//# sourceMappingURL=performanceIsomorphic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performanceIsomorphic.d.ts","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,GACvD,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,qBAA8C,CAAC"}
|
package/dist/trace.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Trace = void 0;
|
|
8
|
+
const indexNode_1 = require("./indexNode.cjs");
|
|
9
|
+
/**
|
|
10
|
+
* Helper class for tracing performance of events
|
|
11
|
+
* Time measurements are in milliseconds as a floating point with a decimal
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
class Trace {
|
|
16
|
+
static start() {
|
|
17
|
+
const startTick = indexNode_1.performance.now();
|
|
18
|
+
return new Trace(startTick);
|
|
19
|
+
}
|
|
20
|
+
constructor(startTick) {
|
|
21
|
+
this.startTick = startTick;
|
|
22
|
+
this.lastTick = startTick;
|
|
23
|
+
}
|
|
24
|
+
trace() {
|
|
25
|
+
const tick = indexNode_1.performance.now();
|
|
26
|
+
const event = {
|
|
27
|
+
totalTimeElapsed: tick - this.startTick,
|
|
28
|
+
duration: tick - this.lastTick,
|
|
29
|
+
tick,
|
|
30
|
+
};
|
|
31
|
+
this.lastTick = tick;
|
|
32
|
+
return event;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Trace = Trace;
|
|
36
|
+
//# sourceMappingURL=trace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.cjs","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA0C;AAE1C;;;;;GAKG;AACH,MAAa,KAAK;IACV,MAAM,CAAC,KAAK;QAClB,MAAM,SAAS,GAAG,uBAAW,CAAC,GAAG,EAAE,CAAC;QACpC,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAGD,YAAsC,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QACtD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC3B,CAAC;IAEM,KAAK;QACX,MAAM,IAAI,GAAG,uBAAW,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG;YACb,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC,SAAS;YACvC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC,QAAQ;YAC9B,IAAI;SACJ,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AArBD,sBAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"./indexNode\";\n\n/**\n * Helper class for tracing performance of events\n * Time measurements are in milliseconds as a floating point with a decimal\n *\n * @internal\n */\nexport class Trace {\n\tpublic static start(): Trace {\n\t\tconst startTick = performance.now();\n\t\treturn new Trace(startTick);\n\t}\n\n\tprotected lastTick: number;\n\tprotected constructor(public readonly startTick: number) {\n\t\tthis.lastTick = startTick;\n\t}\n\n\tpublic trace(): ITraceEvent {\n\t\tconst tick = performance.now();\n\t\tconst event = {\n\t\t\ttotalTimeElapsed: tick - this.startTick,\n\t\t\tduration: tick - this.lastTick,\n\t\t\ttick,\n\t\t};\n\t\tthis.lastTick = tick;\n\t\treturn event;\n\t}\n}\n\n/**\n * Event in a performance trace including time elapsed.\n *\n * @internal\n */\nexport interface ITraceEvent {\n\t/**\n\t * Total time elapsed since the start of the Trace.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly totalTimeElapsed: number;\n\t/**\n\t * Time elapsed since the last trace event.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly duration: number;\n\t/**\n\t * This number represents a relative time which should\n\t * be consistent for all trace ticks.\n\t */\n\treadonly tick: number;\n}\n"]}
|
package/dist/trace.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Helper class for tracing performance of events
|
|
7
|
+
* Time measurements are in milliseconds as a floating point with a decimal
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class Trace {
|
|
12
|
+
readonly startTick: number;
|
|
13
|
+
static start(): Trace;
|
|
14
|
+
protected lastTick: number;
|
|
15
|
+
protected constructor(startTick: number);
|
|
16
|
+
trace(): ITraceEvent;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Event in a performance trace including time elapsed.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export interface ITraceEvent {
|
|
24
|
+
/**
|
|
25
|
+
* Total time elapsed since the start of the Trace.
|
|
26
|
+
* Measured in milliseconds as a floating point with a decimal
|
|
27
|
+
*/
|
|
28
|
+
readonly totalTimeElapsed: number;
|
|
29
|
+
/**
|
|
30
|
+
* Time elapsed since the last trace event.
|
|
31
|
+
* Measured in milliseconds as a floating point with a decimal
|
|
32
|
+
*/
|
|
33
|
+
readonly duration: number;
|
|
34
|
+
/**
|
|
35
|
+
* This number represents a relative time which should
|
|
36
|
+
* be consistent for all trace ticks.
|
|
37
|
+
*/
|
|
38
|
+
readonly tick: number;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,qBAAa,KAAK;aAOqB,SAAS,EAAE,MAAM;WANzC,KAAK,IAAI,KAAK;IAK5B,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,aAA6B,SAAS,EAAE,MAAM;IAIhD,KAAK,IAAI,WAAW;CAU3B;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.38.3"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TypedEventEmitter = void 0;
|
|
8
|
+
// False positive: this is an import from the `events` package, not from Node.
|
|
9
|
+
// eslint-disable-next-line unicorn/prefer-node-protocol
|
|
10
|
+
const events_1 = require("events");
|
|
11
|
+
/**
|
|
12
|
+
* Event Emitter helper class the supports emitting typed events
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
class TypedEventEmitter extends events_1.EventEmitter {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this.addListener = super.addListener.bind(this);
|
|
19
|
+
this.on = super.on.bind(this);
|
|
20
|
+
this.once = super.once.bind(this);
|
|
21
|
+
this.prependListener = super.prependListener.bind(this);
|
|
22
|
+
this.prependOnceListener = super.prependOnceListener.bind(this);
|
|
23
|
+
this.removeListener = super.removeListener.bind(this);
|
|
24
|
+
this.off = super.off.bind(this);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.TypedEventEmitter = TypedEventEmitter;
|
|
28
|
+
//# sourceMappingURL=typedEventEmitter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typedEventEmitter.cjs","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,8EAA8E;AAC9E,wDAAwD;AACxD,mCAAsC;AAwCtC;;;GAGG;AACH,MAAa,iBACZ,SAAQ,qBAAY;IAGpB;QACC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAsC,CAAC;QACrF,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAsC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAsC,CAAC;QACvE,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAGrD,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAG7D,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAsC,CAAC;QAC3F,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAsC,CAAC;IACtE,CAAC;CAQD;AA3BD,8CA2BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// False positive: this is an import from the `events` package, not from Node.\n// eslint-disable-next-line unicorn/prefer-node-protocol\nimport { EventEmitter } from \"events\";\nimport {\n\tIEvent,\n\tTransformedEvent,\n\tIEventTransformer,\n\tIEventProvider,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * The event emitter polyfill and the node event emitter have different event types:\n * string | symbol vs. string | number\n *\n * This type allow us to correctly handle either type\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type EventEmitterEventType = EventEmitter extends { on(event: infer E, listener: any) }\n\t? E\n\t: never;\n\n/**\n * @public\n */\nexport type TypedEventTransform<TThis, TEvent> =\n\t// Event emitter supports some special events for the emitter itself to use\n\t// this exposes those events for the TypedEventEmitter.\n\t// Since we know what the shape of these events are, we can describe them directly via a TransformedEvent\n\t// which easier than trying to extend TEvent directly\n\tTransformedEvent<\n\t\tTThis,\n\t\t\"newListener\" | \"removeListener\",\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tParameters<(event: string, listener: (...args: any[]) => void) => void>\n\t> &\n\t\t// Expose all the events provides by TEvent\n\t\tIEventTransformer<TThis, TEvent & IEvent> &\n\t\t// Add the default overload so this is covertable to EventEmitter regardless of environment\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tTransformedEvent<TThis, EventEmitterEventType, any[]>;\n\n/**\n * Event Emitter helper class the supports emitting typed events\n * @public\n */\nexport class TypedEventEmitter<TEvent>\n\textends EventEmitter\n\timplements IEventProvider<TEvent & IEvent>\n{\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addListener = super.addListener.bind(this) as TypedEventTransform<this, TEvent>;\n\t\tthis.on = super.on.bind(this) as TypedEventTransform<this, TEvent>;\n\t\tthis.once = super.once.bind(this) as TypedEventTransform<this, TEvent>;\n\t\tthis.prependListener = super.prependListener.bind(this) as TypedEventTransform<\n\t\t\tthis,\n\t\t\tTEvent\n\t\t>;\n\t\tthis.prependOnceListener = super.prependOnceListener.bind(this) as TypedEventTransform<\n\t\t\tthis,\n\t\t\tTEvent\n\t\t>;\n\t\tthis.removeListener = super.removeListener.bind(this) as TypedEventTransform<this, TEvent>;\n\t\tthis.off = super.off.bind(this) as TypedEventTransform<this, TEvent>;\n\t}\n\treadonly addListener: TypedEventTransform<this, TEvent>;\n\treadonly on: TypedEventTransform<this, TEvent>;\n\treadonly once: TypedEventTransform<this, TEvent>;\n\treadonly prependListener: TypedEventTransform<this, TEvent>;\n\treadonly prependOnceListener: TypedEventTransform<this, TEvent>;\n\treadonly removeListener: TypedEventTransform<this, TEvent>;\n\treadonly off: TypedEventTransform<this, TEvent>;\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="node" />
|
|
6
|
+
import { EventEmitter } from "events";
|
|
7
|
+
import { IEvent, TransformedEvent, IEventTransformer, IEventProvider } from "@fluidframework/core-interfaces";
|
|
8
|
+
/**
|
|
9
|
+
* The event emitter polyfill and the node event emitter have different event types:
|
|
10
|
+
* string | symbol vs. string | number
|
|
11
|
+
*
|
|
12
|
+
* This type allow us to correctly handle either type
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export type EventEmitterEventType = EventEmitter extends {
|
|
16
|
+
on(event: infer E, listener: any): any;
|
|
17
|
+
} ? E : never;
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export type TypedEventTransform<TThis, TEvent> = TransformedEvent<TThis, "newListener" | "removeListener", Parameters<(event: string, listener: (...args: any[]) => void) => void>> & IEventTransformer<TThis, TEvent & IEvent> & TransformedEvent<TThis, EventEmitterEventType, any[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Event Emitter helper class the supports emitting typed events
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
|
|
27
|
+
constructor();
|
|
28
|
+
readonly addListener: TypedEventTransform<this, TEvent>;
|
|
29
|
+
readonly on: TypedEventTransform<this, TEvent>;
|
|
30
|
+
readonly once: TypedEventTransform<this, TEvent>;
|
|
31
|
+
readonly prependListener: TypedEventTransform<this, TEvent>;
|
|
32
|
+
readonly prependOnceListener: TypedEventTransform<this, TEvent>;
|
|
33
|
+
readonly removeListener: TypedEventTransform<this, TEvent>;
|
|
34
|
+
readonly off: TypedEventTransform<this, TEvent>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=typedEventEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typedEventEmitter.d.ts","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACN,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,MAAM,iCAAiC,CAAC;AAEzC;;;;;;GAMG;AAEH,MAAM,MAAM,qBAAqB,GAAG,YAAY,SAAS;IAAE,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAC;CAAE,GAC3F,CAAC,GACD,KAAK,CAAC;AAET;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,EAAE,MAAM,IAK5C,gBAAgB,CACf,KAAK,EACL,aAAa,GAAG,gBAAgB,EAEhC,UAAU,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,KAAK,IAAI,CAAC,CACvE,GAEA,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,GAGzC,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC;AAExD;;;GAGG;AACH,qBAAa,iBAAiB,CAAC,MAAM,CACpC,SAAQ,YACR,YAAW,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;;IAkB1C,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxD,QAAQ,CAAC,EAAE,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,eAAe,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5D,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAChE,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;CAChD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
launch: {
|
|
8
|
+
args: ["--no-sandbox", "--disable-setuid-sandbox"], // https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#setting-up-chrome-linux-sandbox
|
|
9
|
+
dumpio: true, // output browser console to cmd line
|
|
10
|
+
// slowMo: 500, // slows down process for easier viewing
|
|
11
|
+
// headless: false, // run in the browser
|
|
12
|
+
},
|
|
13
|
+
};
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
preset: "jest-puppeteer",
|
|
8
|
+
reporters: [
|
|
9
|
+
"default",
|
|
10
|
+
[
|
|
11
|
+
"jest-junit",
|
|
12
|
+
{
|
|
13
|
+
outputDirectory: "nyc",
|
|
14
|
+
outputName: "jest-junit-report.xml",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
],
|
|
18
|
+
testMatch: ["**/dist/test/jest/?(*.)+(spec|test).?js"],
|
|
19
|
+
testPathIgnorePatterns: ["/node_modules/"],
|
|
20
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Converts the provided {@link https://en.wikipedia.org/wiki/Base64 | base64}-encoded string
|
|
7
|
+
* to {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare const fromBase64ToUtf8: (input: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Converts the provided {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}-encoded string
|
|
14
|
+
* to {@link https://en.wikipedia.org/wiki/Base64 | base64}.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const fromUtf8ToBase64: (input: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Convenience function to convert unknown encoding to utf8 that avoids
|
|
21
|
+
* buffer copies/encode ops when no conversion is needed.
|
|
22
|
+
* @param input - The source string to convert.
|
|
23
|
+
* @param encoding - The source string's encoding.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare const toUtf8: (input: string, encoding: string) => string;
|
|
28
|
+
//# sourceMappingURL=base64Encoding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64Encoding.d.ts","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,MACA,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,MACA,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,YAAY,MAAM,KAAG,MAWxD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IsoBuffer } from "./indexNode.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Converts the provided {@link https://en.wikipedia.org/wiki/Base64 | base64}-encoded string
|
|
8
|
+
* to {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export const fromBase64ToUtf8 = (input) => IsoBuffer.from(input, "base64").toString("utf8");
|
|
13
|
+
/**
|
|
14
|
+
* Converts the provided {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}-encoded string
|
|
15
|
+
* to {@link https://en.wikipedia.org/wiki/Base64 | base64}.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export const fromUtf8ToBase64 = (input) => IsoBuffer.from(input, "utf8").toString("base64");
|
|
20
|
+
/**
|
|
21
|
+
* Convenience function to convert unknown encoding to utf8 that avoids
|
|
22
|
+
* buffer copies/encode ops when no conversion is needed.
|
|
23
|
+
* @param input - The source string to convert.
|
|
24
|
+
* @param encoding - The source string's encoding.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export const toUtf8 = (input, encoding) => {
|
|
29
|
+
switch (encoding) {
|
|
30
|
+
case "utf8":
|
|
31
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged
|
|
32
|
+
case "utf-8": {
|
|
33
|
+
return input;
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
return IsoBuffer.from(input, encoding).toString();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=base64Encoding.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64Encoding.mjs","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,SAAS,EAAE;AAEpB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE,CACzD,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE,CACzD,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAU,EAAE;IACjE,QAAQ,QAAQ,EAAE;QACjB,KAAK,MAAM,CAAC;QACZ,8GAA8G;QAC9G,KAAK,OAAO,CAAC,CAAC;YACb,OAAO,KAAK,CAAC;SACb;QACD,OAAO,CAAC,CAAC;YACR,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;SAClD;KACD;AACF,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"./indexNode\";\n\n/**\n * Converts the provided {@link https://en.wikipedia.org/wiki/Base64 | base64}-encoded string\n * to {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}.\n *\n * @internal\n */\nexport const fromBase64ToUtf8 = (input: string): string =>\n\tIsoBuffer.from(input, \"base64\").toString(\"utf8\");\n\n/**\n * Converts the provided {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}-encoded string\n * to {@link https://en.wikipedia.org/wiki/Base64 | base64}.\n *\n * @internal\n */\nexport const fromUtf8ToBase64 = (input: string): string =>\n\tIsoBuffer.from(input, \"utf8\").toString(\"base64\");\n\n/**\n * Convenience function to convert unknown encoding to utf8 that avoids\n * buffer copies/encode ops when no conversion is needed.\n * @param input - The source string to convert.\n * @param encoding - The source string's encoding.\n *\n * @internal\n */\nexport const toUtf8 = (input: string, encoding: string): string => {\n\tswitch (encoding) {\n\t\tcase \"utf8\":\n\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\t\tcase \"utf-8\": {\n\t\t\treturn input;\n\t\t}\n\t\tdefault: {\n\t\t\treturn IsoBuffer.from(input, encoding).toString();\n\t\t}\n\t}\n};\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Converts a Uint8Array to a string of the provided encoding
|
|
7
|
+
* Useful when the array might be an {@link IsoBuffer}.
|
|
8
|
+
*
|
|
9
|
+
* @param arr - The array to convert.
|
|
10
|
+
* @param encoding - Optional target encoding; only "utf8" and "base64" are
|
|
11
|
+
* supported, with "utf8" being default.
|
|
12
|
+
* @returns The converted string.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function Uint8ArrayToString(arr: Uint8Array, encoding?: "utf8" | "utf-8" | "base64"): string;
|
|
17
|
+
/**
|
|
18
|
+
* Converts a {@link https://en.wikipedia.org/wiki/Base64 | base64} or
|
|
19
|
+
* {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8} string to array buffer.
|
|
20
|
+
*
|
|
21
|
+
* @param encoding - The input string's encoding.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const stringToBuffer: (input: string, encoding: string) => ArrayBufferLike;
|
|
26
|
+
/**
|
|
27
|
+
* Convert binary blob to string format
|
|
28
|
+
*
|
|
29
|
+
* @param blob - the binary blob
|
|
30
|
+
* @param encoding - output string's encoding
|
|
31
|
+
* @returns the blob in string format
|
|
32
|
+
*
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
|
|
36
|
+
/**
|
|
37
|
+
* Determines if an object is an array buffer.
|
|
38
|
+
*
|
|
39
|
+
* @remarks Will detect and reject TypedArrays, like Uint8Array.
|
|
40
|
+
* Reason - they can be viewport into Array, they can be accepted, but caller has to deal with
|
|
41
|
+
* math properly (i.e. Take into account byteOffset at minimum).
|
|
42
|
+
* For example, construction of new TypedArray can be in the form of new TypedArray(typedArray) or
|
|
43
|
+
* new TypedArray(buffer, byteOffset, length), but passing TypedArray will result in fist path (and
|
|
44
|
+
* ignoring byteOffice, length).
|
|
45
|
+
*
|
|
46
|
+
* @param obj - The object to determine if it is an ArrayBuffer.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare function isArrayBuffer(obj: unknown): obj is ArrayBuffer;
|
|
51
|
+
/**
|
|
52
|
+
* Minimal implementation of Buffer for our usages in the browser environment.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare class IsoBuffer extends Uint8Array {
|
|
57
|
+
/**
|
|
58
|
+
* Convert the buffer to a string.
|
|
59
|
+
* Only supports encoding the whole string (unlike the Node Buffer equivalent)
|
|
60
|
+
* and only utf8 and base64 encodings.
|
|
61
|
+
*
|
|
62
|
+
* @param encoding - The encoding to use.
|
|
63
|
+
*/
|
|
64
|
+
toString(encoding?: "utf8" | "utf-8" | "base64"): string;
|
|
65
|
+
/**
|
|
66
|
+
* Static constructor
|
|
67
|
+
* @param value - (string | ArrayBuffer)
|
|
68
|
+
* @param encodingOrOffset - (string | number)
|
|
69
|
+
* @param length - (number)
|
|
70
|
+
*
|
|
71
|
+
* @privateRemarks TODO: Use actual types
|
|
72
|
+
*/
|
|
73
|
+
static from(value: any, encodingOrOffset?: any, length?: any): IsoBuffer;
|
|
74
|
+
static fromArrayBuffer(arrayBuffer: ArrayBuffer, byteOffset?: number, byteLength?: number): IsoBuffer;
|
|
75
|
+
static fromString(str: string, encoding?: string): IsoBuffer;
|
|
76
|
+
static isBuffer(obj: unknown): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Sanitize a base64 string to provide to base64-js library.
|
|
79
|
+
* {@link https://www.npmjs.com/package/base64-js} is not as tolerant of the same malformed base64 as Node'
|
|
80
|
+
* Buffer is.
|
|
81
|
+
*/
|
|
82
|
+
private static sanitizeBase64;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=bufferBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bufferBrowser.d.ts","sourceRoot":"","sources":["../src/bufferBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,UAAU,EAEf,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GACpC,MAAM,CAeR;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,YAAY,MAAM,KAAG,eAC1B,CAAC;AAExC;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACpB,eAAe,YAEX,MAAM,GAAG,OAAO,GAAG,QAAQ,KACnC,MAAiD,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW,CAW9D;AAED;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACxC;;;;;;OAMG;IAEI,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM;IAI/D;;;;;;;OAOG;IAEH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,gBAAgB,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,SAAS;IAsBxE,MAAM,CAAC,eAAe,CACrB,WAAW,EAAE,WAAW,EACxB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GACjB,SAAS;IAeZ,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAoB5D,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO;IAItC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;CAkB7B"}
|