@fluid-internal/client-utils 2.0.0-internal.6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +20 -0
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +3 -0
- package/LICENSE +21 -0
- package/README.md +70 -0
- package/api-extractor.json +16 -0
- package/dist/base64Encoding.d.ts +28 -0
- package/dist/base64Encoding.d.ts.map +1 -0
- package/dist/base64Encoding.js +43 -0
- package/dist/base64Encoding.js.map +1 -0
- package/dist/bufferBrowser.d.ts +81 -0
- package/dist/bufferBrowser.d.ts.map +1 -0
- package/dist/bufferBrowser.js +195 -0
- package/dist/bufferBrowser.js.map +1 -0
- package/dist/bufferNode.d.ts +58 -0
- package/dist/bufferNode.d.ts.map +1 -0
- package/dist/bufferNode.js +54 -0
- package/dist/bufferNode.js.map +1 -0
- package/dist/bufferShared.d.ts +12 -0
- package/dist/bufferShared.d.ts.map +1 -0
- package/dist/bufferShared.js +21 -0
- package/dist/bufferShared.js.map +1 -0
- package/dist/eventForwarder.d.ts +33 -0
- package/dist/eventForwarder.d.ts.map +1 -0
- package/dist/eventForwarder.js +98 -0
- package/dist/eventForwarder.js.map +1 -0
- package/dist/hashFileBrowser.d.ts +30 -0
- package/dist/hashFileBrowser.d.ts.map +1 -0
- package/dist/hashFileBrowser.js +95 -0
- package/dist/hashFileBrowser.js.map +1 -0
- package/dist/hashFileNode.d.ts +30 -0
- package/dist/hashFileNode.d.ts.map +1 -0
- package/dist/hashFileNode.js +60 -0
- package/dist/hashFileNode.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/indexBrowser.d.ts +8 -0
- package/dist/indexBrowser.d.ts.map +1 -0
- package/dist/indexBrowser.js +19 -0
- package/dist/indexBrowser.js.map +1 -0
- package/dist/indexNode.d.ts +8 -0
- package/dist/indexNode.d.ts.map +1 -0
- package/dist/indexNode.js +19 -0
- package/dist/indexNode.js.map +1 -0
- package/dist/performanceBrowser.d.ts +10 -0
- package/dist/performanceBrowser.d.ts.map +1 -0
- package/dist/performanceBrowser.js +12 -0
- package/dist/performanceBrowser.js.map +1 -0
- package/dist/performanceIsomorphic.d.ts +12 -0
- package/dist/performanceIsomorphic.d.ts.map +1 -0
- package/dist/performanceIsomorphic.js +7 -0
- package/dist/performanceIsomorphic.js.map +1 -0
- package/dist/performanceNode.d.ts +10 -0
- package/dist/performanceNode.d.ts.map +1 -0
- package/dist/performanceNode.js +14 -0
- package/dist/performanceNode.js.map +1 -0
- package/dist/trace.d.ts +40 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +36 -0
- package/dist/trace.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/typedEventEmitter.d.ts +37 -0
- package/dist/typedEventEmitter.d.ts.map +1 -0
- package/dist/typedEventEmitter.js +27 -0
- package/dist/typedEventEmitter.js.map +1 -0
- package/jest-puppeteer.config.js +13 -0
- package/jest.config.js +20 -0
- package/lib/base64Encoding.d.ts +28 -0
- package/lib/base64Encoding.d.ts.map +1 -0
- package/lib/base64Encoding.js +37 -0
- package/lib/base64Encoding.js.map +1 -0
- package/lib/bufferBrowser.d.ts +81 -0
- package/lib/bufferBrowser.d.ts.map +1 -0
- package/lib/bufferBrowser.js +168 -0
- package/lib/bufferBrowser.js.map +1 -0
- package/lib/bufferNode.d.ts +58 -0
- package/lib/bufferNode.d.ts.map +1 -0
- package/lib/bufferNode.js +48 -0
- package/lib/bufferNode.js.map +1 -0
- package/lib/bufferShared.d.ts +12 -0
- package/lib/bufferShared.d.ts.map +1 -0
- package/lib/bufferShared.js +17 -0
- package/lib/bufferShared.js.map +1 -0
- package/lib/eventForwarder.d.ts +33 -0
- package/lib/eventForwarder.d.ts.map +1 -0
- package/lib/eventForwarder.js +94 -0
- package/lib/eventForwarder.js.map +1 -0
- package/lib/hashFileBrowser.d.ts +30 -0
- package/lib/hashFileBrowser.d.ts.map +1 -0
- package/lib/hashFileBrowser.js +71 -0
- package/lib/hashFileBrowser.js.map +1 -0
- package/lib/hashFileNode.d.ts +30 -0
- package/lib/hashFileNode.d.ts.map +1 -0
- package/lib/hashFileNode.js +52 -0
- package/lib/hashFileNode.js.map +1 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/indexBrowser.d.ts +8 -0
- package/lib/indexBrowser.d.ts.map +1 -0
- package/lib/indexBrowser.js +8 -0
- package/lib/indexBrowser.js.map +1 -0
- package/lib/indexNode.d.ts +8 -0
- package/lib/indexNode.d.ts.map +1 -0
- package/lib/indexNode.js +8 -0
- package/lib/indexNode.js.map +1 -0
- package/lib/performanceBrowser.d.ts +10 -0
- package/lib/performanceBrowser.d.ts.map +1 -0
- package/lib/performanceBrowser.js +9 -0
- package/lib/performanceBrowser.js.map +1 -0
- package/lib/performanceIsomorphic.d.ts +12 -0
- package/lib/performanceIsomorphic.d.ts.map +1 -0
- package/lib/performanceIsomorphic.js +6 -0
- package/lib/performanceIsomorphic.js.map +1 -0
- package/lib/performanceNode.d.ts +10 -0
- package/lib/performanceNode.d.ts.map +1 -0
- package/lib/performanceNode.js +11 -0
- package/lib/performanceNode.js.map +1 -0
- package/lib/trace.d.ts +40 -0
- package/lib/trace.d.ts.map +1 -0
- package/lib/trace.js +32 -0
- package/lib/trace.js.map +1 -0
- package/lib/typedEventEmitter.d.ts +37 -0
- package/lib/typedEventEmitter.d.ts.map +1 -0
- package/lib/typedEventEmitter.js +23 -0
- package/lib/typedEventEmitter.js.map +1 -0
- package/package.json +140 -0
- package/prettier.config.cjs +8 -0
- package/src/base64Encoding.ts +42 -0
- package/src/bufferBrowser.ts +188 -0
- package/src/bufferNode.ts +75 -0
- package/src/bufferShared.ts +17 -0
- package/src/eventForwarder.ts +120 -0
- package/src/hashFileBrowser.ts +82 -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/performanceBrowser.ts +11 -0
- package/src/performanceIsomorphic.ts +13 -0
- package/src/performanceNode.ts +13 -0
- package/src/trace.ts +58 -0
- package/src/typedEventEmitter.ts +76 -0
- package/tsconfig.esnext.json +7 -0
- package/tsconfig.json +14 -0
- package/types/perf_hooks.d.ts +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bufferNode.js","sourceRoot":"","sources":["../src/bufferNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoBH;;GAEG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC;AAOhC;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CAAC,GAAe,EAAE,QAAiB;IACpE,wEAAwE;IACxE,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC5F,CAAC;AAHD,gDAGC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,KAAa,EAAE,QAAgB;IAC7D,MAAM,GAAG,GAAG,iBAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5C,0EAA0E;IAC1E,2EAA2E;IAC3E,uDAAuD;IACvD,OAAO,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,MAAM,CAAC,UAAU;QAC9C,CAAC,CAAC,GAAG,CAAC,MAAM;QACZ,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;AACtE,CAAC;AARD,wCAQC;AAED;;;;;;;;GAQG;AACI,MAAM,cAAc,GAAG,CAAC,IAAqB,EAAE,QAAgB,EAAU,EAAE,CACjF,iBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAD5B,QAAA,cAAc,kBACc","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Declare the subset of Buffer functionality we want to make available instead of\n * exposing the entirely of Node's typings. This should match the public interface\n * of the browser implementation, so any changes made in one should be made in both.\n *\n * @internal\n */\nexport declare class Buffer extends Uint8Array {\n\ttoString(encoding?: string): string;\n\t/**\n\t * @param value - (string | ArrayBuffer).\n\t * @param encodingOrOffset - (string | number).\n\t * @param length - (number).\n\t */\n\tstatic from(value, encodingOrOffset?, length?): IsoBuffer;\n\tstatic isBuffer(obj: any): obj is Buffer;\n}\n\n/**\n * @internal\n */\nexport const IsoBuffer = Buffer;\n\n/**\n * @internal\n */\nexport type IsoBuffer = Buffer;\n\n/**\n * Converts a Uint8Array to a string of the provided encoding.\n * @remarks Useful when the array might be an IsoBuffer.\n * @param arr - The array to convert.\n * @param encoding - Optional target encoding; only \"utf8\" and \"base64\" are\n * supported, with \"utf8\" being default.\n * @returns The converted string.\n *\n * @internal\n */\nexport function Uint8ArrayToString(arr: Uint8Array, encoding?: string): string {\n\t// Make this check because Buffer.from(arr) will always do a buffer copy\n\treturn Buffer.isBuffer(arr) ? arr.toString(encoding) : Buffer.from(arr).toString(encoding);\n}\n\n/**\n * Convert base64 or utf8 string to array buffer.\n * @param encoding - The input string's encoding.\n *\n * @internal\n */\nexport function stringToBuffer(input: string, encoding: string): ArrayBufferLike {\n\tconst iso = IsoBuffer.from(input, encoding);\n\t// In a Node environment, IsoBuffer may be a Node.js Buffer. Node.js will\n\t// pool multiple small Buffer instances into a single ArrayBuffer, in which\n\t// case we need to slice the appropriate span of bytes.\n\treturn iso.byteLength === iso.buffer.byteLength\n\t\t? iso.buffer\n\t\t: iso.buffer.slice(iso.byteOffset, iso.byteOffset + iso.byteLength);\n}\n\n/**\n * Convert binary blob to string format\n *\n * @param blob - The binary blob\n * @param encoding - Output string's encoding\n * @returns The blob in string format\n *\n * @internal\n */\nexport const bufferToString = (blob: ArrayBufferLike, encoding: string): string =>\n\tIsoBuffer.from(blob).toString(encoding);\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Converts a Uint8Array array to an ArrayBuffer.
|
|
7
|
+
* @param array - Array to convert to ArrayBuffer.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function Uint8ArrayToArrayBuffer(array: Uint8Array): ArrayBuffer;
|
|
12
|
+
//# sourceMappingURL=bufferShared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bufferShared.d.ts","sourceRoot":"","sources":["../src/bufferShared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAKtE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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.Uint8ArrayToArrayBuffer = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Converts a Uint8Array array to an ArrayBuffer.
|
|
10
|
+
* @param array - Array to convert to ArrayBuffer.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
function Uint8ArrayToArrayBuffer(array) {
|
|
15
|
+
if (array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16
|
+
return array.buffer;
|
|
17
|
+
}
|
|
18
|
+
return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);
|
|
19
|
+
}
|
|
20
|
+
exports.Uint8ArrayToArrayBuffer = Uint8ArrayToArrayBuffer;
|
|
21
|
+
//# sourceMappingURL=bufferShared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bufferShared.js","sourceRoot":"","sources":["../src/bufferShared.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,KAAiB;IACxD,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;QAC3E,OAAO,KAAK,CAAC,MAAM,CAAC;KACpB;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;AAClF,CAAC;AALD,0DAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Converts a Uint8Array array to an ArrayBuffer.\n * @param array - Array to convert to ArrayBuffer.\n *\n * @internal\n */\nexport function Uint8ArrayToArrayBuffer(array: Uint8Array): ArrayBuffer {\n\tif (array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {\n\t\treturn array.buffer;\n\t}\n\treturn array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from "events";
|
|
6
|
+
import { IDisposable, IEvent, IEventProvider } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { TypedEventEmitter } from "./typedEventEmitter";
|
|
8
|
+
/**
|
|
9
|
+
* Base class used for forwarding events from a source EventEmitter.
|
|
10
|
+
* This can be useful when all arbitrary listeners need to be removed,
|
|
11
|
+
* but the primary source needs to stay intact.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare class EventForwarder<TEvent = IEvent> extends TypedEventEmitter<TEvent> implements IDisposable {
|
|
16
|
+
protected static isEmitterEvent(event: string): boolean;
|
|
17
|
+
private static readonly newListenerEvent;
|
|
18
|
+
private static readonly removeListenerEvent;
|
|
19
|
+
/**
|
|
20
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}
|
|
21
|
+
*/
|
|
22
|
+
get disposed(): boolean;
|
|
23
|
+
private isDisposed;
|
|
24
|
+
private readonly forwardingEvents;
|
|
25
|
+
constructor(source?: EventEmitter | IEventProvider<TEvent & IEvent>);
|
|
26
|
+
/**
|
|
27
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}
|
|
28
|
+
*/
|
|
29
|
+
dispose(): void;
|
|
30
|
+
protected forwardEvent(source: EventEmitter | IEventProvider<TEvent & IEvent>, ...events: string[]): void;
|
|
31
|
+
protected unforwardEvent(source: EventEmitter | IEventProvider<TEvent & IEvent>, ...events: string[]): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=eventForwarder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventForwarder.d.ts","sourceRoot":"","sources":["../src/eventForwarder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;GAMG;AACH,qBAAa,cAAc,CAAC,MAAM,GAAG,MAAM,CAC1C,SAAQ,iBAAiB,CAAC,MAAM,CAChC,YAAW,WAAW;IAEtB,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAOvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAiB;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAoB;IAE/D;;OAEG;IACH,IAAW,QAAQ,IAAI,OAAO,CAE7B;IACD,OAAO,CAAC,UAAU,CAAkB;IAEpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAG7B;gBAEQ,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;IAcnE;;OAEG;IACI,OAAO,IAAI,IAAI;IAetB,SAAS,CAAC,YAAY,CACrB,MAAM,EAAE,YAAY,GAAG,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,EACtD,GAAG,MAAM,EAAE,MAAM,EAAE,GACjB,IAAI;IAqBP,SAAS,CAAC,cAAc,CACvB,MAAM,EAAE,YAAY,GAAG,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,EACtD,GAAG,MAAM,EAAE,MAAM,EAAE,GACjB,IAAI;CAiBP"}
|
|
@@ -0,0 +1,98 @@
|
|
|
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.EventForwarder = void 0;
|
|
8
|
+
const typedEventEmitter_1 = require("./typedEventEmitter");
|
|
9
|
+
/**
|
|
10
|
+
* Base class used for forwarding events from a source EventEmitter.
|
|
11
|
+
* This can be useful when all arbitrary listeners need to be removed,
|
|
12
|
+
* but the primary source needs to stay intact.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
class EventForwarder extends typedEventEmitter_1.TypedEventEmitter {
|
|
17
|
+
constructor(source) {
|
|
18
|
+
super();
|
|
19
|
+
this.isDisposed = false;
|
|
20
|
+
this.forwardingEvents = new Map();
|
|
21
|
+
if (source !== undefined) {
|
|
22
|
+
// NewListener event is raised whenever someone starts listening to this events, so
|
|
23
|
+
// we keep track of events being listened to, and start forwarding from the source
|
|
24
|
+
// event emitter per event listened to on this
|
|
25
|
+
const removeListenerHandler = (event) => this.unforwardEvent(source, event);
|
|
26
|
+
const newListenerHandler = (event) => this.forwardEvent(source, event);
|
|
27
|
+
this.on(EventForwarder.removeListenerEvent, removeListenerHandler);
|
|
28
|
+
this.on(EventForwarder.newListenerEvent, newListenerHandler);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
static isEmitterEvent(event) {
|
|
32
|
+
return (event === EventForwarder.newListenerEvent ||
|
|
33
|
+
event === EventForwarder.removeListenerEvent);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}
|
|
37
|
+
*/
|
|
38
|
+
get disposed() {
|
|
39
|
+
return this.isDisposed;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}
|
|
43
|
+
*/
|
|
44
|
+
dispose() {
|
|
45
|
+
this.isDisposed = true;
|
|
46
|
+
for (const listenerRemovers of this.forwardingEvents.values()) {
|
|
47
|
+
for (const listenerRemover of listenerRemovers.values()) {
|
|
48
|
+
try {
|
|
49
|
+
listenerRemover();
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Should be fine because of removeAllListeners below
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
this.removeAllListeners();
|
|
57
|
+
this.forwardingEvents.clear();
|
|
58
|
+
}
|
|
59
|
+
forwardEvent(source, ...events) {
|
|
60
|
+
for (const event of events) {
|
|
61
|
+
if (source !== undefined &&
|
|
62
|
+
event !== undefined &&
|
|
63
|
+
!EventForwarder.isEmitterEvent(event)) {
|
|
64
|
+
let sources = this.forwardingEvents.get(event);
|
|
65
|
+
if (sources === undefined) {
|
|
66
|
+
sources = new Map();
|
|
67
|
+
this.forwardingEvents.set(event, sources);
|
|
68
|
+
}
|
|
69
|
+
if (!sources.has(source)) {
|
|
70
|
+
const listener = (...args) => this.emit(event, ...args);
|
|
71
|
+
sources.set(source, () => source.off(event, listener));
|
|
72
|
+
source.on(event, listener);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
unforwardEvent(source, ...events) {
|
|
78
|
+
for (const event of events) {
|
|
79
|
+
if (event !== undefined && !EventForwarder.isEmitterEvent(event)) {
|
|
80
|
+
const sources = this.forwardingEvents.get(event);
|
|
81
|
+
if (sources?.has(source) === true && this.listenerCount(event) === 0) {
|
|
82
|
+
const listenerRemover = sources.get(source);
|
|
83
|
+
if (listenerRemover !== undefined) {
|
|
84
|
+
listenerRemover();
|
|
85
|
+
}
|
|
86
|
+
sources.delete(source);
|
|
87
|
+
if (sources.size === 0) {
|
|
88
|
+
this.forwardingEvents.delete(event);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.EventForwarder = EventForwarder;
|
|
96
|
+
EventForwarder.newListenerEvent = "newListener";
|
|
97
|
+
EventForwarder.removeListenerEvent = "removeListener";
|
|
98
|
+
//# sourceMappingURL=eventForwarder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventForwarder.js","sourceRoot":"","sources":["../src/eventForwarder.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { EventEmitter } from \"events\";\nimport { IDisposable, IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { TypedEventEmitter } from \"./typedEventEmitter\";\n\n/**\n * Base class used for forwarding events from a source EventEmitter.\n * This can be useful when all arbitrary listeners need to be removed,\n * but the primary source needs to stay intact.\n *\n * @internal\n */\nexport class EventForwarder<TEvent = IEvent>\n\textends TypedEventEmitter<TEvent>\n\timplements IDisposable\n{\n\tprotected static isEmitterEvent(event: string): boolean {\n\t\treturn (\n\t\t\tevent === EventForwarder.newListenerEvent ||\n\t\t\tevent === EventForwarder.removeListenerEvent\n\t\t);\n\t}\n\n\tprivate static readonly newListenerEvent = \"newListener\";\n\tprivate static readonly removeListenerEvent = \"removeListener\";\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this.isDisposed;\n\t}\n\tprivate isDisposed: boolean = false;\n\n\tprivate readonly forwardingEvents = new Map<\n\t\tstring,\n\t\tMap<EventEmitter | IEventProvider<TEvent & IEvent>, () => void>\n\t>();\n\n\tconstructor(source?: EventEmitter | IEventProvider<TEvent & IEvent>) {\n\t\tsuper();\n\t\tif (source !== undefined) {\n\t\t\t// NewListener event is raised whenever someone starts listening to this events, so\n\t\t\t// we keep track of events being listened to, and start forwarding from the source\n\t\t\t// event emitter per event listened to on this\n\t\t\tconst removeListenerHandler = (event: string): void =>\n\t\t\t\tthis.unforwardEvent(source, event);\n\t\t\tconst newListenerHandler = (event: string): void => this.forwardEvent(source, event);\n\t\t\tthis.on(EventForwarder.removeListenerEvent, removeListenerHandler);\n\t\t\tthis.on(EventForwarder.newListenerEvent, newListenerHandler);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tthis.isDisposed = true;\n\t\tfor (const listenerRemovers of this.forwardingEvents.values()) {\n\t\t\tfor (const listenerRemover of listenerRemovers.values()) {\n\t\t\t\ttry {\n\t\t\t\t\tlistenerRemover();\n\t\t\t\t} catch {\n\t\t\t\t\t// Should be fine because of removeAllListeners below\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.removeAllListeners();\n\t\tthis.forwardingEvents.clear();\n\t}\n\n\tprotected forwardEvent(\n\t\tsource: EventEmitter | IEventProvider<TEvent & IEvent>,\n\t\t...events: string[]\n\t): void {\n\t\tfor (const event of events) {\n\t\t\tif (\n\t\t\t\tsource !== undefined &&\n\t\t\t\tevent !== undefined &&\n\t\t\t\t!EventForwarder.isEmitterEvent(event)\n\t\t\t) {\n\t\t\t\tlet sources = this.forwardingEvents.get(event);\n\t\t\t\tif (sources === undefined) {\n\t\t\t\t\tsources = new Map();\n\t\t\t\t\tthis.forwardingEvents.set(event, sources);\n\t\t\t\t}\n\t\t\t\tif (!sources.has(source)) {\n\t\t\t\t\tconst listener = (...args: any[]): boolean => this.emit(event, ...args);\n\t\t\t\t\tsources.set(source, () => source.off(event, listener));\n\t\t\t\t\tsource.on(event, listener);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected unforwardEvent(\n\t\tsource: EventEmitter | IEventProvider<TEvent & IEvent>,\n\t\t...events: string[]\n\t): void {\n\t\tfor (const event of events) {\n\t\t\tif (event !== undefined && !EventForwarder.isEmitterEvent(event)) {\n\t\t\t\tconst sources = this.forwardingEvents.get(event);\n\t\t\t\tif (sources?.has(source) === true && this.listenerCount(event) === 0) {\n\t\t\t\t\tconst listenerRemover = sources.get(source);\n\t\t\t\t\tif (listenerRemover !== undefined) {\n\t\t\t\t\t\tlistenerRemover();\n\t\t\t\t\t}\n\t\t\t\t\tsources.delete(source);\n\t\t\t\t\tif (sources.size === 0) {\n\t\t\t\t\t\tthis.forwardingEvents.delete(event);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IsoBuffer } from "./bufferBrowser";
|
|
6
|
+
/**
|
|
7
|
+
* Hash a file. Consistent within a session, but should not be persisted and
|
|
8
|
+
* is not consistent with git.
|
|
9
|
+
* If called under an insecure context for a browser, this will fallback to
|
|
10
|
+
* using the node implementation.
|
|
11
|
+
*
|
|
12
|
+
* @param file - The contents of the file in a buffer.
|
|
13
|
+
* @param algorithm - The hash algorithm to use, artificially constrained by what is used internally.
|
|
14
|
+
* @param hashEncoding - The encoding of the returned hash, also artificially constrained.
|
|
15
|
+
* @returns The hash of the content of the buffer.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function hashFile(file: IsoBuffer, algorithm?: "SHA-1" | "SHA-256", hashEncoding?: "hex" | "base64"): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a github hash (Github hashes the string with blob and size)
|
|
22
|
+
* Must be called under secure context for browsers
|
|
23
|
+
*
|
|
24
|
+
* @param file - The contents of the file in a buffer
|
|
25
|
+
* @returns The sha1 hash of the content of the buffer with the `blob` prefix and size
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function gitHashFile(file: IsoBuffer): Promise<string>;
|
|
30
|
+
//# sourceMappingURL=hashFileBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashFileBrowser.d.ts","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAwB5C;;;;;;;;;;;;GAYG;AACH,wBAAsB,QAAQ,CAC7B,IAAI,EAAE,SAAS,EACf,SAAS,GAAE,OAAO,GAAG,SAAmB,EACxC,YAAY,GAAE,KAAK,GAAG,QAAgB,GACpC,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAOlE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.gitHashFile = exports.hashFile = void 0;
|
|
27
|
+
const base64js = __importStar(require("base64-js"));
|
|
28
|
+
const bufferBrowser_1 = require("./bufferBrowser");
|
|
29
|
+
async function digestBuffer(file, algorithm) {
|
|
30
|
+
const hash = await crypto.subtle.digest(algorithm, file);
|
|
31
|
+
return new Uint8Array(hash);
|
|
32
|
+
}
|
|
33
|
+
function encodeDigest(hashArray, encoding) {
|
|
34
|
+
// eslint-disable-next-line default-case
|
|
35
|
+
switch (encoding) {
|
|
36
|
+
case "hex": {
|
|
37
|
+
const hashHex = Array.prototype.map
|
|
38
|
+
.call(hashArray, (byte) => {
|
|
39
|
+
return byte.toString(16).padStart(2, "0");
|
|
40
|
+
})
|
|
41
|
+
.join("");
|
|
42
|
+
return hashHex;
|
|
43
|
+
}
|
|
44
|
+
case "base64": {
|
|
45
|
+
return base64js.fromByteArray(hashArray);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Hash a file. Consistent within a session, but should not be persisted and
|
|
51
|
+
* is not consistent with git.
|
|
52
|
+
* If called under an insecure context for a browser, this will fallback to
|
|
53
|
+
* using the node implementation.
|
|
54
|
+
*
|
|
55
|
+
* @param file - The contents of the file in a buffer.
|
|
56
|
+
* @param algorithm - The hash algorithm to use, artificially constrained by what is used internally.
|
|
57
|
+
* @param hashEncoding - The encoding of the returned hash, also artificially constrained.
|
|
58
|
+
* @returns The hash of the content of the buffer.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
async function hashFile(file, algorithm = "SHA-1", hashEncoding = "hex") {
|
|
63
|
+
// Handle insecure contexts (e.g. running with local services)
|
|
64
|
+
// by deferring to Node version, which uses a hash polyfill
|
|
65
|
+
// When packed, this chunk will show as "FluidFramework-HashFallback" separately
|
|
66
|
+
// from the main chunk and will be of non-trivial size. It will not be served
|
|
67
|
+
// under normal circumstances.
|
|
68
|
+
if (crypto.subtle === undefined) {
|
|
69
|
+
return Promise.resolve().then(() => __importStar(require(
|
|
70
|
+
/* webpackChunkName: "FluidFramework-HashFallback" */
|
|
71
|
+
"./hashFileNode"))).then(async (m) => m.hashFile(file, algorithm, hashEncoding));
|
|
72
|
+
}
|
|
73
|
+
// This is split up this way to facilitate testing (see the test for more info)
|
|
74
|
+
const hashArray = await digestBuffer(file, algorithm);
|
|
75
|
+
return encodeDigest(hashArray, hashEncoding);
|
|
76
|
+
}
|
|
77
|
+
exports.hashFile = hashFile;
|
|
78
|
+
/**
|
|
79
|
+
* Create a github hash (Github hashes the string with blob and size)
|
|
80
|
+
* Must be called under secure context for browsers
|
|
81
|
+
*
|
|
82
|
+
* @param file - The contents of the file in a buffer
|
|
83
|
+
* @returns The sha1 hash of the content of the buffer with the `blob` prefix and size
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
async function gitHashFile(file) {
|
|
88
|
+
const size = file.byteLength;
|
|
89
|
+
const filePrefix = `blob ${size.toString()}${String.fromCharCode(0)}`;
|
|
90
|
+
const hashBuffer = bufferBrowser_1.IsoBuffer.from(filePrefix + file.toString());
|
|
91
|
+
// hashFile uses sha1; if that changes this will need to change too
|
|
92
|
+
return hashFile(hashBuffer);
|
|
93
|
+
}
|
|
94
|
+
exports.gitHashFile = gitHashFile;
|
|
95
|
+
//# sourceMappingURL=hashFileBrowser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashFileBrowser.js","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AACtC,mDAA4C;AAE5C,KAAK,UAAU,YAAY,CAAC,IAAe,EAAE,SAA8B;IAC1E,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACzD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,YAAY,CAAC,SAAqB,EAAE,QAA0B;IACtE,wCAAwC;IACxC,QAAQ,QAAQ,EAAE;QACjB,KAAK,KAAK,CAAC,CAAC;YACX,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG;iBACjC,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;gBACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAW,CAAC;YACrD,CAAC,CAAC;iBACD,IAAI,CAAC,EAAE,CAAC,CAAC;YACX,OAAO,OAAO,CAAC;SACf;QACD,KAAK,QAAQ,CAAC,CAAC;YACd,OAAO,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;SACzC;KACD;AACF,CAAC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,QAAQ,CAC7B,IAAe,EACf,YAAiC,OAAO,EACxC,eAAiC,KAAK;IAEtC,8DAA8D;IAC9D,2DAA2D;IAC3D,gFAAgF;IAChF,8EAA8E;IAC9E,8BAA8B;IAC9B,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;QAChC,OAAO;QACN,qDAAqD;QACrD,gBAAgB,IACf,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;KAC/D;IAED,+EAA+E;IAC/E,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACtD,OAAO,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC9C,CAAC;AApBD,4BAoBC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,WAAW,CAAC,IAAe;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;IAC7B,MAAM,UAAU,GAAG,QAAQ,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,MAAM,UAAU,GAAG,yBAAS,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEhE,mEAAmE;IACnE,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AAPD,kCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as base64js from \"base64-js\";\nimport { IsoBuffer } from \"./bufferBrowser\";\n\nasync function digestBuffer(file: IsoBuffer, algorithm: \"SHA-1\" | \"SHA-256\"): Promise<Uint8Array> {\n\tconst hash = await crypto.subtle.digest(algorithm, file);\n\treturn new Uint8Array(hash);\n}\n\nfunction encodeDigest(hashArray: Uint8Array, encoding: \"hex\" | \"base64\"): string {\n\t// eslint-disable-next-line default-case\n\tswitch (encoding) {\n\t\tcase \"hex\": {\n\t\t\tconst hashHex = Array.prototype.map\n\t\t\t\t.call(hashArray, (byte) => {\n\t\t\t\t\treturn byte.toString(16).padStart(2, \"0\") as string;\n\t\t\t\t})\n\t\t\t\t.join(\"\");\n\t\t\treturn hashHex;\n\t\t}\n\t\tcase \"base64\": {\n\t\t\treturn base64js.fromByteArray(hashArray);\n\t\t}\n\t}\n}\n\n/**\n * Hash a file. Consistent within a session, but should not be persisted and\n * is not consistent with git.\n * If called under an insecure context for a browser, this will fallback to\n * using the node implementation.\n *\n * @param file - The contents of the file in a buffer.\n * @param algorithm - The hash algorithm to use, artificially constrained by what is used internally.\n * @param hashEncoding - The encoding of the returned hash, also artificially constrained.\n * @returns The hash of the content of the buffer.\n *\n * @internal\n */\nexport async function hashFile(\n\tfile: IsoBuffer,\n\talgorithm: \"SHA-1\" | \"SHA-256\" = \"SHA-1\",\n\thashEncoding: \"hex\" | \"base64\" = \"hex\",\n): Promise<string> {\n\t// Handle insecure contexts (e.g. running with local services)\n\t// by deferring to Node version, which uses a hash polyfill\n\t// When packed, this chunk will show as \"FluidFramework-HashFallback\" separately\n\t// from the main chunk and will be of non-trivial size. It will not be served\n\t// under normal circumstances.\n\tif (crypto.subtle === undefined) {\n\t\treturn import(\n\t\t\t/* webpackChunkName: \"FluidFramework-HashFallback\" */\n\t\t\t\"./hashFileNode\"\n\t\t).then(async (m) => m.hashFile(file, algorithm, hashEncoding));\n\t}\n\n\t// This is split up this way to facilitate testing (see the test for more info)\n\tconst hashArray = await digestBuffer(file, algorithm);\n\treturn encodeDigest(hashArray, hashEncoding);\n}\n\n/**\n * Create a github hash (Github hashes the string with blob and size)\n * Must be called under secure context for browsers\n *\n * @param file - The contents of the file in a buffer\n * @returns The sha1 hash of the content of the buffer with the `blob` prefix and size\n *\n * @internal\n */\nexport async function gitHashFile(file: IsoBuffer): Promise<string> {\n\tconst size = file.byteLength;\n\tconst filePrefix = `blob ${size.toString()}${String.fromCharCode(0)}`;\n\tconst hashBuffer = IsoBuffer.from(filePrefix + file.toString());\n\n\t// hashFile uses sha1; if that changes this will need to change too\n\treturn hashFile(hashBuffer);\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IsoBuffer } from "./bufferNode";
|
|
6
|
+
/**
|
|
7
|
+
* Hash a file. Consistent within a session, but should not be persisted and
|
|
8
|
+
* is not consistent with git.
|
|
9
|
+
* If called under an insecure context for a browser, this will fallback to
|
|
10
|
+
* using the node implementation.
|
|
11
|
+
*
|
|
12
|
+
* @param file - The contents of the file in a buffer.
|
|
13
|
+
* @param algorithm - The hash algorithm to use, artificially constrained by what is used internally.
|
|
14
|
+
* @param hashEncoding - The encoding of the returned hash, also artificially constrained.
|
|
15
|
+
* @returns The hash of the content of the buffer.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function hashFile(file: IsoBuffer, algorithm?: "SHA-1" | "SHA-256", hashEncoding?: "hex" | "base64"): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a github hash (Github hashes the string with blob and size)
|
|
22
|
+
* Must be called under secure context for browsers
|
|
23
|
+
*
|
|
24
|
+
* @param file - The contents of the file in a buffer
|
|
25
|
+
* @returns The sha1 hash of the content of the buffer with the `blob` prefix and size
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function gitHashFile(file: IsoBuffer): Promise<string>;
|
|
30
|
+
//# sourceMappingURL=hashFileNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashFileNode.d.ts","sourceRoot":"","sources":["../src/hashFileNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,wBAAsB,QAAQ,CAC7B,IAAI,EAAE,SAAS,EACf,SAAS,GAAE,OAAO,GAAG,SAAmB,EACxC,YAAY,GAAE,KAAK,GAAG,QAAgB,GACpC,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAKlE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.gitHashFile = exports.hashFile = void 0;
|
|
11
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
12
|
+
const sha1_1 = __importDefault(require("sha.js/sha1"));
|
|
13
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
14
|
+
const sha256_1 = __importDefault(require("sha.js/sha256"));
|
|
15
|
+
/**
|
|
16
|
+
* Hash a file. Consistent within a session, but should not be persisted and
|
|
17
|
+
* is not consistent with git.
|
|
18
|
+
* If called under an insecure context for a browser, this will fallback to
|
|
19
|
+
* using the node implementation.
|
|
20
|
+
*
|
|
21
|
+
* @param file - The contents of the file in a buffer.
|
|
22
|
+
* @param algorithm - The hash algorithm to use, artificially constrained by what is used internally.
|
|
23
|
+
* @param hashEncoding - The encoding of the returned hash, also artificially constrained.
|
|
24
|
+
* @returns The hash of the content of the buffer.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
async function hashFile(file, algorithm = "SHA-1", hashEncoding = "hex") {
|
|
29
|
+
let engine;
|
|
30
|
+
// eslint-disable-next-line default-case
|
|
31
|
+
switch (algorithm) {
|
|
32
|
+
case "SHA-1": {
|
|
33
|
+
engine = new sha1_1.default();
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case "SHA-256": {
|
|
37
|
+
engine = new sha256_1.default();
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return engine.update(file).digest(hashEncoding);
|
|
42
|
+
}
|
|
43
|
+
exports.hashFile = hashFile;
|
|
44
|
+
/**
|
|
45
|
+
* Create a github hash (Github hashes the string with blob and size)
|
|
46
|
+
* Must be called under secure context for browsers
|
|
47
|
+
*
|
|
48
|
+
* @param file - The contents of the file in a buffer
|
|
49
|
+
* @returns The sha1 hash of the content of the buffer with the `blob` prefix and size
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
async function gitHashFile(file) {
|
|
54
|
+
const size = file.byteLength;
|
|
55
|
+
const filePrefix = `blob ${size.toString()}${String.fromCharCode(0)}`;
|
|
56
|
+
const engine = new sha1_1.default();
|
|
57
|
+
return engine.update(filePrefix).update(file).digest("hex");
|
|
58
|
+
}
|
|
59
|
+
exports.gitHashFile = gitHashFile;
|
|
60
|
+
//# sourceMappingURL=hashFileNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashFileNode.js","sourceRoot":"","sources":["../src/hashFileNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,sDAAsD;AACtD,uDAA+B;AAC/B,sDAAsD;AACtD,2DAAmC;AAGnC;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,QAAQ,CAC7B,IAAe,EACf,YAAiC,OAAO,EACxC,eAAiC,KAAK;IAEtC,IAAI,MAAM,CAAC;IACX,wCAAwC;IACxC,QAAQ,SAAS,EAAE;QAClB,KAAK,OAAO,CAAC,CAAC;YACb,MAAM,GAAG,IAAI,cAAI,EAAE,CAAC;YACpB,MAAM;SACN;QACD,KAAK,SAAS,CAAC,CAAC;YACf,MAAM,GAAG,IAAI,gBAAM,EAAE,CAAC;YACtB,MAAM;SACN;KACD;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,YAAY,CAAW,CAAC;AAC3D,CAAC;AAlBD,4BAkBC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,WAAW,CAAC,IAAe;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;IAC7B,MAAM,UAAU,GAAG,QAAQ,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,MAAM,MAAM,GAAG,IAAI,cAAI,EAAE,CAAC;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAW,CAAC;AACvE,CAAC;AALD,kCAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport sha1 from \"sha.js/sha1\";\n// eslint-disable-next-line import/no-internal-modules\nimport sha256 from \"sha.js/sha256\";\nimport { IsoBuffer } from \"./bufferNode\";\n\n/**\n * Hash a file. Consistent within a session, but should not be persisted and\n * is not consistent with git.\n * If called under an insecure context for a browser, this will fallback to\n * using the node implementation.\n *\n * @param file - The contents of the file in a buffer.\n * @param algorithm - The hash algorithm to use, artificially constrained by what is used internally.\n * @param hashEncoding - The encoding of the returned hash, also artificially constrained.\n * @returns The hash of the content of the buffer.\n *\n * @internal\n */\nexport async function hashFile(\n\tfile: IsoBuffer,\n\talgorithm: \"SHA-1\" | \"SHA-256\" = \"SHA-1\",\n\thashEncoding: \"hex\" | \"base64\" = \"hex\",\n): Promise<string> {\n\tlet engine;\n\t// eslint-disable-next-line default-case\n\tswitch (algorithm) {\n\t\tcase \"SHA-1\": {\n\t\t\tengine = new sha1();\n\t\t\tbreak;\n\t\t}\n\t\tcase \"SHA-256\": {\n\t\t\tengine = new sha256();\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn engine.update(file).digest(hashEncoding) as string;\n}\n\n/**\n * Create a github hash (Github hashes the string with blob and size)\n * Must be called under secure context for browsers\n *\n * @param file - The contents of the file in a buffer\n * @returns The sha1 hash of the content of the buffer with the `blob` prefix and size\n *\n * @internal\n */\nexport async function gitHashFile(file: IsoBuffer): Promise<string> {\n\tconst size = file.byteLength;\n\tconst filePrefix = `blob ${size.toString()}${String.fromCharCode(0)}`;\n\tconst engine = new sha1();\n\treturn engine.update(filePrefix).update(file).digest(\"hex\") as string;\n}\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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.TypedEventEmitter = exports.Trace = exports.EventForwarder = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = void 0;
|
|
18
|
+
var base64Encoding_1 = require("./base64Encoding");
|
|
19
|
+
Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64Encoding_1.fromBase64ToUtf8; } });
|
|
20
|
+
Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64Encoding_1.fromUtf8ToBase64; } });
|
|
21
|
+
Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64Encoding_1.toUtf8; } });
|
|
22
|
+
var bufferShared_1 = require("./bufferShared");
|
|
23
|
+
Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_1.Uint8ArrayToArrayBuffer; } });
|
|
24
|
+
var eventForwarder_1 = require("./eventForwarder");
|
|
25
|
+
Object.defineProperty(exports, "EventForwarder", { enumerable: true, get: function () { return eventForwarder_1.EventForwarder; } });
|
|
26
|
+
/**
|
|
27
|
+
* NOTE: This export is remapped to export from "./indexBrowser" in browser environments via package.json.
|
|
28
|
+
* Because the two files don't have fully isomorphic exports, using named exports for the full API surface
|
|
29
|
+
* is problematic if that named export includes values not in their intersection.
|
|
30
|
+
*
|
|
31
|
+
* In a future breaking change of client-utils, we could use a named export for their intersection if we
|
|
32
|
+
* desired.
|
|
33
|
+
*/
|
|
34
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
35
|
+
__exportStar(require("./indexNode"), exports);
|
|
36
|
+
// export { IRange, IRangeTrackerSnapshot, RangeTracker } from "./rangeTracker";
|
|
37
|
+
var trace_1 = require("./trace");
|
|
38
|
+
Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return trace_1.Trace; } });
|
|
39
|
+
var typedEventEmitter_1 = require("./typedEventEmitter");
|
|
40
|
+
Object.defineProperty(exports, "TypedEventEmitter", { enumerable: true, get: function () { return typedEventEmitter_1.TypedEventEmitter; } });
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;AAEH,mDAA8E;AAArE,kHAAA,gBAAgB,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAAE,wGAAA,MAAM,OAAA;AACnD,+CAAyD;AAAhD,uHAAA,uBAAuB,OAAA;AAChC,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB;;;;;;;GAOG;AACH,gDAAgD;AAChD,8CAA4B;AAE5B,gFAAgF;AAChF,iCAA6C;AAAvB,8FAAA,KAAK,OAAA;AAC3B,yDAAoG;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"]}
|
|
@@ -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 "./performanceBrowser";
|
|
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,sBAAsB,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");
|
|
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");
|
|
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 performanceBrowser_1 = require("./performanceBrowser");
|
|
18
|
+
Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceBrowser_1.performance; } });
|
|
19
|
+
//# sourceMappingURL=indexBrowser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexBrowser.js","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAMyB;AALxB,+GAAA,cAAc,OAAA;AACd,8GAAA,aAAa,OAAA;AACb,0GAAA,SAAS,OAAA;AACT,+GAAA,cAAc,OAAA;AACd,mHAAA,kBAAkB,OAAA;AAEnB,qDAA0D;AAAjD,8GAAA,WAAW,OAAA;AAAE,2GAAA,QAAQ,OAAA;AAC9B,2DAAmD;AAA1C,iHAAA,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 \"./performanceBrowser\";\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 "./performanceNode";
|
|
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,mBAAmB,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");
|
|
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");
|
|
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 performanceNode_1 = require("./performanceNode");
|
|
18
|
+
Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceNode_1.performance; } });
|
|
19
|
+
//# sourceMappingURL=indexNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexNode.js","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAMsB;AALrB,oGAAA,MAAM,OAAA;AACN,4GAAA,cAAc,OAAA;AACd,uGAAA,SAAS,OAAA;AACT,4GAAA,cAAc,OAAA;AACd,gHAAA,kBAAkB,OAAA;AAEnB,+CAAuD;AAA9C,2GAAA,WAAW,OAAA;AAAE,wGAAA,QAAQ,OAAA;AAC9B,qDAAgD;AAAvC,8GAAA,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 \"./performanceNode\";\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IsomorphicPerformance } from "./performanceIsomorphic";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const performance: IsomorphicPerformance;
|
|
10
|
+
//# sourceMappingURL=performanceBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performanceBrowser.d.ts","sourceRoot":"","sources":["../src/performanceBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,qBAA8C,CAAC"}
|