@fluid-internal/client-utils 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.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/CHANGELOG.md +23 -0
- package/bufferBrowser.d.ts +16 -0
- package/dist/base64Encoding.d.ts.map +1 -1
- package/dist/base64Encoding.js +5 -4
- package/dist/base64Encoding.js.map +1 -1
- package/dist/hashFileBrowser.d.ts.map +1 -1
- package/dist/hashFileBrowser.js.map +1 -1
- package/dist/typedEventEmitter.d.ts +1 -1
- package/dist/typedEventEmitter.d.ts.map +1 -1
- package/dist/typedEventEmitter.js.map +1 -1
- package/lib/base64Encoding.d.ts.map +1 -1
- package/lib/base64Encoding.js +2 -1
- package/lib/base64Encoding.js.map +1 -1
- package/lib/hashFileBrowser.d.ts.map +1 -1
- package/lib/hashFileBrowser.js.map +1 -1
- package/lib/typedEventEmitter.d.ts +1 -1
- package/lib/typedEventEmitter.d.ts.map +1 -1
- package/lib/typedEventEmitter.js.map +1 -1
- package/package.json +59 -41
- package/src/base64Encoding.ts +2 -1
- package/src/hashFileBrowser.ts +1 -0
- package/src/typedEventEmitter.ts +3 -2
- package/api-extractor-cjs.json +0 -8
- package/dist/client-utils-alpha.d.ts +0 -77
- package/dist/client-utils-beta.d.ts +0 -67
- package/dist/client-utils-public.d.ts +0 -67
- package/dist/client-utils-untrimmed.d.ts +0 -217
- package/lib/client-utils-alpha.d.ts +0 -77
- package/lib/client-utils-beta.d.ts +0 -67
- package/lib/client-utils-public.d.ts +0 -67
- package/lib/client-utils-untrimmed.d.ts +0 -217
- package/lib/test/mocha/typedEventEmitter.spec.js +0 -43
- package/lib/test/mocha/typedEventEmitter.spec.js.map +0 -1
- package/lib/test/types/validateClientUtilsPrevious.generated.js +0 -42
- package/lib/test/types/validateClientUtilsPrevious.generated.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @fluid-internal/client-utils
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
8
|
+
|
|
9
|
+
Fluid Framework packages have been updated to use the [package.json "exports"
|
|
10
|
+
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
|
|
11
|
+
TypeScript types and implementation code.
|
|
12
|
+
|
|
13
|
+
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
14
|
+
|
|
15
|
+
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
16
|
+
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
17
|
+
|
|
18
|
+
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
|
|
19
|
+
for use with modern versions of Node.js _and_ Bundlers.
|
|
20
|
+
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
|
|
21
|
+
regarding the module and moduleResolution options.
|
|
22
|
+
|
|
23
|
+
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
|
|
24
|
+
to distinguish stable APIs from those that are in development.**
|
|
25
|
+
|
|
3
26
|
## 2.0.0-rc.2.0.0
|
|
4
27
|
|
|
5
28
|
Dependency updates only.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS FILE SHOULD NOT BE DELETED.
|
|
8
|
+
*
|
|
9
|
+
* This file is needed for compatibility with TypeScript's Node10 module resolution. In most other packages it is
|
|
10
|
+
* auto-generated by `flub generate entrypoints` in @fluid-tools/build-cli, and is thus gitignored in most packages.
|
|
11
|
+
*
|
|
12
|
+
* However, this package is unique in that it does not need to use API trimming or `flub generate entrypoints`,
|
|
13
|
+
* but instead uses conditional exports to isomorphically support both Node and browser environments.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export * from "./lib/bufferBrowser.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64Encoding.d.ts","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"base64Encoding.d.ts","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;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"}
|
package/dist/base64Encoding.js
CHANGED
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = void 0;
|
|
8
|
-
|
|
8
|
+
// Note: The exports map in package.json will correct this import to "./bufferNode.js" in node environments
|
|
9
|
+
const bufferBrowser_js_1 = require("./bufferBrowser.js");
|
|
9
10
|
/**
|
|
10
11
|
* Converts the provided {@link https://en.wikipedia.org/wiki/Base64 | base64}-encoded string
|
|
11
12
|
* to {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}.
|
|
12
13
|
*
|
|
13
14
|
* @internal
|
|
14
15
|
*/
|
|
15
|
-
const fromBase64ToUtf8 = (input) =>
|
|
16
|
+
const fromBase64ToUtf8 = (input) => bufferBrowser_js_1.IsoBuffer.from(input, "base64").toString("utf8");
|
|
16
17
|
exports.fromBase64ToUtf8 = fromBase64ToUtf8;
|
|
17
18
|
/**
|
|
18
19
|
* Converts the provided {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}-encoded string
|
|
@@ -20,7 +21,7 @@ exports.fromBase64ToUtf8 = fromBase64ToUtf8;
|
|
|
20
21
|
*
|
|
21
22
|
* @internal
|
|
22
23
|
*/
|
|
23
|
-
const fromUtf8ToBase64 = (input) =>
|
|
24
|
+
const fromUtf8ToBase64 = (input) => bufferBrowser_js_1.IsoBuffer.from(input, "utf8").toString("base64");
|
|
24
25
|
exports.fromUtf8ToBase64 = fromUtf8ToBase64;
|
|
25
26
|
/**
|
|
26
27
|
* Convenience function to convert unknown encoding to utf8 that avoids
|
|
@@ -38,7 +39,7 @@ const toUtf8 = (input, encoding) => {
|
|
|
38
39
|
return input;
|
|
39
40
|
}
|
|
40
41
|
default: {
|
|
41
|
-
return
|
|
42
|
+
return bufferBrowser_js_1.IsoBuffer.from(input, encoding).toString();
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64Encoding.js","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"base64Encoding.js","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2GAA2G;AAC3G,yDAA+C;AAE/C;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE,CACzD,4BAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AADrC,QAAA,gBAAgB,oBACqB;AAElD;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE,CACzD,4BAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AADrC,QAAA,gBAAgB,oBACqB;AAElD;;;;;;;GAOG;AACI,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,4BAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;SAClD;KACD;AACF,CAAC,CAAC;AAXW,QAAA,MAAM,UAWjB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Note: The exports map in package.json will correct this import to \"./bufferNode.js\" in node environments\nimport { IsoBuffer } from \"./bufferBrowser.js\";\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashFileBrowser.d.ts","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"hashFileBrowser.d.ts","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyB/C;;;;;;;;;;;;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,CAQlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashFileBrowser.js","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;
|
|
1
|
+
{"version":3,"file":"hashFileBrowser.js","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC,yDAA+C;AAE/C,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;I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AAE,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,MAAM,UAAU,GAAG,4BAAS,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEhE,mEAAmE;IACnE,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AARD,kCAQC","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\";\n\nimport { IsoBuffer } from \"./bufferBrowser.js\";\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\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.js\"\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\t// eslint-disable-next-line unicorn/prefer-code-point\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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IEvent,
|
|
5
|
+
import { IEvent, IEventProvider, IEventTransformer, TransformedEvent } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { EventEmitter } from "./eventEmitter.cjs";
|
|
7
7
|
/**
|
|
8
8
|
* The event emitter polyfill and the node event emitter have different event types:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedEventEmitter.d.ts","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;A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AAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;CAChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedEventEmitter.js","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"typedEventEmitter.js","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,yDAAkD;AA+BlD;;;GAGG;AACH,MAAa,iBACZ,SAAQ,+BAAY;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\nimport {\n\tIEvent,\n\tIEventProvider,\n\tIEventTransformer,\n\tTransformedEvent,\n} from \"@fluidframework/core-interfaces\";\n\nimport { EventEmitter } from \"./eventEmitter.cjs\";\n\n/**\n * The event emitter polyfill and the node event emitter have different event types:\n * string | symbol vs. string | number\n *\n * The polyfill is now always used, but string is the only event type preferred.\n * @public\n */\nexport type EventEmitterEventType = string;\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64Encoding.d.ts","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"base64Encoding.d.ts","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;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"}
|
package/lib/base64Encoding.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
// Note: The exports map in package.json will correct this import to "./bufferNode.js" in node environments
|
|
6
|
+
import { IsoBuffer } from "./bufferBrowser.js";
|
|
6
7
|
/**
|
|
7
8
|
* Converts the provided {@link https://en.wikipedia.org/wiki/Base64 | base64}-encoded string
|
|
8
9
|
* to {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64Encoding.js","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"base64Encoding.js","sourceRoot":"","sources":["../src/base64Encoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,2GAA2G;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;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\n// Note: The exports map in package.json will correct this import to \"./bufferNode.js\" in node environments\nimport { IsoBuffer } from \"./bufferBrowser.js\";\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashFileBrowser.d.ts","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"hashFileBrowser.d.ts","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyB/C;;;;;;;;;;;;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,CAQlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashFileBrowser.js","sourceRoot":"","sources":["../src/hashFileBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"hashFileBrowser.js","source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,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;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAe;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;IAC7B,qDAAqD;IACrD,MAAM,UAAU,GAAG,QAAQ,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEhE,mEAAmE;IACnE,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC","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\";\n\nimport { IsoBuffer } from \"./bufferBrowser.js\";\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\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.js\"\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\t// eslint-disable-next-line unicorn/prefer-code-point\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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IEvent,
|
|
5
|
+
import { IEvent, IEventProvider, IEventTransformer, TransformedEvent } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { EventEmitter } from "./eventEmitter.cjs";
|
|
7
7
|
/**
|
|
8
8
|
* The event emitter polyfill and the node event emitter have different event types:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedEventEmitter.d.ts","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"typedEventEmitter.d.ts","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C;;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedEventEmitter.js","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"typedEventEmitter.js","sourceRoot":"","sources":["../src/typedEventEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA+BlD;;;GAGG;AACH,MAAM,OAAO,iBACZ,SAAQ,YAAY;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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIEvent,\n\tIEventProvider,\n\tIEventTransformer,\n\tTransformedEvent,\n} from \"@fluidframework/core-interfaces\";\n\nimport { EventEmitter } from \"./eventEmitter.cjs\";\n\n/**\n * The event emitter polyfill and the node event emitter have different event types:\n * string | symbol vs. string | number\n *\n * The polyfill is now always used, but string is the only event type preferred.\n * @public\n */\nexport type EventEmitterEventType = string;\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-internal/client-utils",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.3.0.1",
|
|
4
4
|
"description": "Not intended for use outside the Fluid Framework.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -14,24 +14,52 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
17
|
+
"node": {
|
|
18
|
+
"import": {
|
|
19
|
+
"types": "./lib/indexNode.d.ts",
|
|
20
|
+
"default": "./lib/indexNode.js"
|
|
21
|
+
},
|
|
22
|
+
"require": {
|
|
23
|
+
"types": "./dist/indexNode.d.ts",
|
|
24
|
+
"default": "./dist/indexNode.js"
|
|
25
|
+
}
|
|
20
26
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
27
|
+
"default": {
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./lib/indexBrowser.d.ts",
|
|
30
|
+
"default": "./lib/indexBrowser.js"
|
|
31
|
+
},
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./dist/indexBrowser.d.ts",
|
|
34
|
+
"default": "./dist/indexBrowser.js"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"./bufferBrowser.js": {
|
|
39
|
+
"node": {
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./lib/bufferNode.d.ts",
|
|
42
|
+
"default": "./lib/bufferNode.js"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/bufferNode.d.ts",
|
|
46
|
+
"default": "./dist/bufferNode.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"default": {
|
|
50
|
+
"import": {
|
|
51
|
+
"types": "./lib/bufferBrowser.d.ts",
|
|
52
|
+
"default": "./lib/bufferBrowser.js"
|
|
53
|
+
},
|
|
54
|
+
"require": {
|
|
55
|
+
"types": "./dist/bufferBrowser.d.ts",
|
|
56
|
+
"default": "./dist/bufferBrowser.js"
|
|
57
|
+
}
|
|
24
58
|
}
|
|
25
59
|
}
|
|
26
60
|
},
|
|
27
|
-
"main": "
|
|
28
|
-
"
|
|
29
|
-
"./dist/indexNode.js": "./dist/indexBrowser.js",
|
|
30
|
-
"./dist/indexNode.d.ts": "./dist/indexBrowser.d.ts",
|
|
31
|
-
"./lib/indexNode.js": "./lib/indexBrowser.js",
|
|
32
|
-
"./lib/indexNode.d.ts": "./lib/indexBrowser.d.ts"
|
|
33
|
-
},
|
|
34
|
-
"types": "dist/indexNode.d.ts",
|
|
61
|
+
"main": "lib/indexNode.js",
|
|
62
|
+
"types": "lib/indexNode.d.ts",
|
|
35
63
|
"c8": {
|
|
36
64
|
"all": true,
|
|
37
65
|
"cache-dir": "nyc/.cache",
|
|
@@ -53,8 +81,8 @@
|
|
|
53
81
|
"temp-directory": "nyc/.nyc_output"
|
|
54
82
|
},
|
|
55
83
|
"dependencies": {
|
|
56
|
-
"@fluidframework/core-interfaces": ">=2.0.0-rc.
|
|
57
|
-
"@fluidframework/core-utils": ">=2.0.0-rc.
|
|
84
|
+
"@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
|
|
85
|
+
"@fluidframework/core-utils": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
|
|
58
86
|
"@types/events_pkg": "npm:@types/events@^3.0.0",
|
|
59
87
|
"base64-js": "^1.5.1",
|
|
60
88
|
"buffer": "^6.0.3",
|
|
@@ -63,17 +91,18 @@
|
|
|
63
91
|
"sha.js": "^2.4.11"
|
|
64
92
|
},
|
|
65
93
|
"devDependencies": {
|
|
66
|
-
"@arethetypeswrong/cli": "^0.
|
|
94
|
+
"@arethetypeswrong/cli": "^0.15.2",
|
|
95
|
+
"@biomejs/biome": "^1.6.2",
|
|
67
96
|
"@fluid-internal/client-utils-previous": "npm:@fluid-internal/client-utils@2.0.0-internal.8.0.0",
|
|
68
|
-
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.
|
|
69
|
-
"@fluid-tools/build-cli": "^0.
|
|
97
|
+
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
|
|
98
|
+
"@fluid-tools/build-cli": "^0.37.0",
|
|
70
99
|
"@fluidframework/build-common": "^2.0.3",
|
|
71
|
-
"@fluidframework/build-tools": "^0.
|
|
72
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
100
|
+
"@fluidframework/build-tools": "^0.37.0",
|
|
101
|
+
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
73
102
|
"@microsoft/api-extractor": "^7.42.3",
|
|
74
103
|
"@types/base64-js": "^1.3.0",
|
|
75
104
|
"@types/jest": "29.5.3",
|
|
76
|
-
"@types/jest-environment-puppeteer": ">=2.0.0-rc.
|
|
105
|
+
"@types/jest-environment-puppeteer": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
|
|
77
106
|
"@types/mocha": "^9.1.1",
|
|
78
107
|
"@types/node": "^18.19.0",
|
|
79
108
|
"@types/rewire": "^2.5.28",
|
|
@@ -111,14 +140,6 @@
|
|
|
111
140
|
"build:test:jest",
|
|
112
141
|
"build:test:types"
|
|
113
142
|
],
|
|
114
|
-
"build:docs": {
|
|
115
|
-
"dependsOn": [
|
|
116
|
-
"...",
|
|
117
|
-
"api-extractor:commonjs",
|
|
118
|
-
"api-extractor:esnext"
|
|
119
|
-
],
|
|
120
|
-
"script": false
|
|
121
|
-
},
|
|
122
143
|
"build:test:jest": [
|
|
123
144
|
"tsc"
|
|
124
145
|
],
|
|
@@ -145,13 +166,10 @@
|
|
|
145
166
|
}
|
|
146
167
|
},
|
|
147
168
|
"scripts": {
|
|
148
|
-
"api": "fluid-build . --task api",
|
|
149
|
-
"api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
|
|
150
|
-
"api-extractor:esnext": "api-extractor run --local",
|
|
151
169
|
"build": "fluid-build . --task build",
|
|
152
170
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
153
171
|
"build:compile": "fluid-build . --task compile",
|
|
154
|
-
"build:docs": "
|
|
172
|
+
"build:docs": "api-extractor run --local",
|
|
155
173
|
"build:esnext": "tsc --project ./tsconfig.json",
|
|
156
174
|
"build:test": "concurrently npm:build:test:mocha npm:build:test:jest npm:build:test:types",
|
|
157
175
|
"build:test:jest": "fluid-tsc commonjs --project ./src/test/jest/tsconfig.cjs.json",
|
|
@@ -159,17 +177,17 @@
|
|
|
159
177
|
"build:test:mocha:cjs": "fluid-tsc commonjs --project ./src/test/mocha/tsconfig.cjs.json",
|
|
160
178
|
"build:test:mocha:esm": "tsc --project ./src/test/mocha/tsconfig.json",
|
|
161
179
|
"build:test:types": "tsc --project ./src/test/types/tsconfig.json",
|
|
162
|
-
"check:are-the-types-wrong": "attw --pack .
|
|
180
|
+
"check:are-the-types-wrong": "attw --pack .",
|
|
181
|
+
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
163
182
|
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
164
183
|
"ci:build:docs": "api-extractor run",
|
|
165
184
|
"clean": "rimraf --glob _api-extractor-temp dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" nyc",
|
|
166
185
|
"eslint": "eslint --format stylish src",
|
|
167
186
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
168
|
-
"format": "
|
|
169
|
-
"
|
|
170
|
-
"lint
|
|
171
|
-
"
|
|
172
|
-
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
187
|
+
"format": "fluid-build --task format .",
|
|
188
|
+
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
189
|
+
"lint": "fluid-build . --task lint",
|
|
190
|
+
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
173
191
|
"test": "npm run test:mocha && npm run test:jest",
|
|
174
192
|
"test:coverage": "c8 npm test",
|
|
175
193
|
"test:jest": "jest",
|
package/src/base64Encoding.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// Note: The exports map in package.json will correct this import to "./bufferNode.js" in node environments
|
|
7
|
+
import { IsoBuffer } from "./bufferBrowser.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Converts the provided {@link https://en.wikipedia.org/wiki/Base64 | base64}-encoded string
|
package/src/hashFileBrowser.ts
CHANGED
package/src/typedEventEmitter.ts
CHANGED
package/api-extractor-cjs.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
|
|
4
|
-
// CJS is actually secondary; so, no report.
|
|
5
|
-
"apiReport": {
|
|
6
|
-
"enabled": false
|
|
7
|
-
}
|
|
8
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events_pkg';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IEventTransformer } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { TransformedEvent } from '@fluidframework/core-interfaces';
|
|
6
|
-
|
|
7
|
-
/* Excluded from this release type: Buffer */
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Convert binary blob to string format
|
|
11
|
-
*
|
|
12
|
-
* @param blob - The binary blob
|
|
13
|
-
* @param encoding - Output string's encoding
|
|
14
|
-
* @returns The blob in string format
|
|
15
|
-
*
|
|
16
|
-
* @alpha
|
|
17
|
-
*/
|
|
18
|
-
export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
|
|
19
|
-
|
|
20
|
-
export { EventEmitter }
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The event emitter polyfill and the node event emitter have different event types:
|
|
24
|
-
* string | symbol vs. string | number
|
|
25
|
-
*
|
|
26
|
-
* The polyfill is now always used, but string is the only event type preferred.
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export declare type EventEmitterEventType = string;
|
|
30
|
-
|
|
31
|
-
/* Excluded from this release type: fromBase64ToUtf8 */
|
|
32
|
-
|
|
33
|
-
/* Excluded from this release type: fromUtf8ToBase64 */
|
|
34
|
-
|
|
35
|
-
/* Excluded from this release type: gitHashFile */
|
|
36
|
-
|
|
37
|
-
/* Excluded from this release type: hashFile */
|
|
38
|
-
|
|
39
|
-
/* Excluded from this release type: IsoBuffer */
|
|
40
|
-
|
|
41
|
-
/* Excluded from this release type: IsomorphicPerformance */
|
|
42
|
-
|
|
43
|
-
/* Excluded from this release type: ITraceEvent */
|
|
44
|
-
|
|
45
|
-
/* Excluded from this release type: performance_2 */
|
|
46
|
-
|
|
47
|
-
/* Excluded from this release type: stringToBuffer */
|
|
48
|
-
|
|
49
|
-
/* Excluded from this release type: toUtf8 */
|
|
50
|
-
|
|
51
|
-
/* Excluded from this release type: Trace */
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Event Emitter helper class the supports emitting typed events
|
|
55
|
-
* @public
|
|
56
|
-
*/
|
|
57
|
-
export declare class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
|
|
58
|
-
constructor();
|
|
59
|
-
readonly addListener: TypedEventTransform<this, TEvent>;
|
|
60
|
-
readonly on: TypedEventTransform<this, TEvent>;
|
|
61
|
-
readonly once: TypedEventTransform<this, TEvent>;
|
|
62
|
-
readonly prependListener: TypedEventTransform<this, TEvent>;
|
|
63
|
-
readonly prependOnceListener: TypedEventTransform<this, TEvent>;
|
|
64
|
-
readonly removeListener: TypedEventTransform<this, TEvent>;
|
|
65
|
-
readonly off: TypedEventTransform<this, TEvent>;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
|
-
export declare type TypedEventTransform<TThis, TEvent> = TransformedEvent<TThis, "newListener" | "removeListener", Parameters<(event: string, listener: (...args: any[]) => void) => void>> & IEventTransformer<TThis, TEvent & IEvent> & TransformedEvent<TThis, EventEmitterEventType, any[]>;
|
|
72
|
-
|
|
73
|
-
/* Excluded from this release type: Uint8ArrayToArrayBuffer */
|
|
74
|
-
|
|
75
|
-
/* Excluded from this release type: Uint8ArrayToString */
|
|
76
|
-
|
|
77
|
-
export { }
|