@fluid-internal/client-utils 2.0.0-internal.8.0.1 → 2.0.0-rc.1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +0 -6
  3. package/api-extractor-esm.json +4 -0
  4. package/api-extractor-lint.json +1 -10
  5. package/api-extractor.json +1 -9
  6. package/api-report/client-utils.api.md +4 -4
  7. package/dist/bufferBrowser.d.ts +1 -1
  8. package/dist/bufferBrowser.js +1 -1
  9. package/dist/bufferBrowser.js.map +1 -1
  10. package/dist/bufferNode.d.ts +1 -1
  11. package/dist/bufferNode.js +1 -1
  12. package/dist/bufferNode.js.map +1 -1
  13. package/dist/client-utils-alpha.d.ts +13 -6
  14. package/dist/client-utils-beta.d.ts +29 -14
  15. package/dist/client-utils-public.d.ts +29 -14
  16. package/dist/client-utils-untrimmed.d.ts +4 -6
  17. package/dist/index.d.ts +0 -14
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +3 -22
  20. package/dist/index.js.map +1 -1
  21. package/dist/indexBrowser.d.ts +6 -0
  22. package/dist/indexBrowser.d.ts.map +1 -1
  23. package/dist/indexBrowser.js +13 -1
  24. package/dist/indexBrowser.js.map +1 -1
  25. package/dist/indexNode.d.ts +8 -1
  26. package/dist/indexNode.d.ts.map +1 -1
  27. package/dist/indexNode.js +13 -2
  28. package/dist/indexNode.js.map +1 -1
  29. package/dist/typedEventEmitter.d.ts +3 -5
  30. package/dist/typedEventEmitter.d.ts.map +1 -1
  31. package/dist/typedEventEmitter.js +1 -2
  32. package/dist/typedEventEmitter.js.map +1 -1
  33. package/jest.config.js +1 -1
  34. package/lib/{base64Encoding.d.ts → base64Encoding.d.mts} +1 -1
  35. package/lib/base64Encoding.d.mts.map +1 -0
  36. package/lib/{base64Encoding.js → base64Encoding.mjs} +6 -12
  37. package/lib/base64Encoding.mjs.map +1 -0
  38. package/lib/{bufferBrowser.d.ts → bufferBrowser.d.mts} +2 -2
  39. package/lib/bufferBrowser.d.mts.map +1 -0
  40. package/lib/{bufferBrowser.js → bufferBrowser.mjs} +8 -39
  41. package/lib/{bufferBrowser.js.map → bufferBrowser.mjs.map} +1 -1
  42. package/lib/{bufferNode.d.ts → bufferNode.d.mts} +2 -2
  43. package/lib/bufferNode.d.mts.map +1 -0
  44. package/lib/{bufferNode.js → bufferNode.mjs} +8 -14
  45. package/lib/bufferNode.mjs.map +1 -0
  46. package/lib/{bufferShared.d.ts → bufferShared.d.mts} +1 -1
  47. package/lib/bufferShared.d.mts.map +1 -0
  48. package/lib/{bufferShared.js → bufferShared.mjs} +2 -6
  49. package/lib/bufferShared.mjs.map +1 -0
  50. package/lib/client-utils-alpha.d.mts +82 -0
  51. package/lib/{client-utils-alpha.d.ts → client-utils-beta.d.mts} +3 -5
  52. package/lib/client-utils-public.d.mts +73 -0
  53. package/lib/{client-utils-untrimmed.d.ts → client-utils-untrimmed.d.mts} +4 -6
  54. package/lib/{eventForwarder.d.ts → eventForwarder.d.mts} +2 -2
  55. package/lib/eventForwarder.d.mts.map +1 -0
  56. package/lib/{eventForwarder.js → eventForwarder.mjs} +3 -7
  57. package/lib/{eventForwarder.js.map → eventForwarder.mjs.map} +1 -1
  58. package/lib/{hashFileNode.d.ts → hashFileBrowser.d.mts} +2 -2
  59. package/lib/hashFileBrowser.d.mts.map +1 -0
  60. package/lib/{hashFileBrowser.js → hashFileBrowser.mjs} +7 -37
  61. package/lib/hashFileBrowser.mjs.map +1 -0
  62. package/lib/{hashFileBrowser.d.ts → hashFileNode.d.mts} +2 -2
  63. package/lib/hashFileNode.d.mts.map +1 -0
  64. package/lib/{hashFileNode.js → hashFileNode.mjs} +7 -12
  65. package/lib/hashFileNode.mjs.map +1 -0
  66. package/lib/index.d.mts +6 -0
  67. package/lib/index.d.mts.map +1 -0
  68. package/lib/index.mjs +6 -0
  69. package/lib/index.mjs.map +1 -0
  70. package/lib/indexBrowser.d.mts +14 -0
  71. package/lib/indexBrowser.d.mts.map +1 -0
  72. package/lib/indexBrowser.mjs +13 -0
  73. package/lib/indexBrowser.mjs.map +1 -0
  74. package/lib/indexNode.d.mts +15 -0
  75. package/lib/indexNode.d.mts.map +1 -0
  76. package/lib/indexNode.mjs +13 -0
  77. package/lib/indexNode.mjs.map +1 -0
  78. package/lib/{performanceIsomorphic.d.ts → performanceIsomorphic.d.mts} +1 -1
  79. package/lib/performanceIsomorphic.d.mts.map +1 -0
  80. package/lib/{performanceIsomorphic.js → performanceIsomorphic.mjs} +2 -5
  81. package/lib/performanceIsomorphic.mjs.map +1 -0
  82. package/lib/{trace.d.ts → trace.d.mts} +1 -1
  83. package/lib/trace.d.mts.map +1 -0
  84. package/lib/{trace.js → trace.mjs} +5 -9
  85. package/lib/trace.mjs.map +1 -0
  86. package/lib/{typedEventEmitter.d.ts → typedEventEmitter.d.mts} +4 -6
  87. package/lib/typedEventEmitter.d.mts.map +1 -0
  88. package/lib/{typedEventEmitter.js → typedEventEmitter.mjs} +4 -11
  89. package/lib/typedEventEmitter.mjs.map +1 -0
  90. package/package.json +35 -20
  91. package/src/bufferBrowser.ts +1 -1
  92. package/src/bufferNode.ts +1 -1
  93. package/src/index.ts +3 -15
  94. package/src/indexBrowser.ts +7 -0
  95. package/src/indexNode.ts +9 -7
  96. package/src/typedEventEmitter.ts +3 -5
  97. package/lib/base64Encoding.d.ts.map +0 -1
  98. package/lib/base64Encoding.js.map +0 -1
  99. package/lib/bufferBrowser.d.ts.map +0 -1
  100. package/lib/bufferNode.d.ts.map +0 -1
  101. package/lib/bufferNode.js.map +0 -1
  102. package/lib/bufferShared.d.ts.map +0 -1
  103. package/lib/bufferShared.js.map +0 -1
  104. package/lib/client-utils-beta.d.ts +0 -58
  105. package/lib/client-utils-public.d.ts +0 -58
  106. package/lib/eventForwarder.d.ts.map +0 -1
  107. package/lib/hashFileBrowser.d.ts.map +0 -1
  108. package/lib/hashFileBrowser.js.map +0 -1
  109. package/lib/hashFileNode.d.ts.map +0 -1
  110. package/lib/hashFileNode.js.map +0 -1
  111. package/lib/index.d.ts +0 -20
  112. package/lib/index.d.ts.map +0 -1
  113. package/lib/index.js +0 -45
  114. package/lib/index.js.map +0 -1
  115. package/lib/indexBrowser.d.ts +0 -8
  116. package/lib/indexBrowser.d.ts.map +0 -1
  117. package/lib/indexBrowser.js +0 -19
  118. package/lib/indexBrowser.js.map +0 -1
  119. package/lib/indexNode.d.ts +0 -8
  120. package/lib/indexNode.d.ts.map +0 -1
  121. package/lib/indexNode.js +0 -19
  122. package/lib/indexNode.js.map +0 -1
  123. package/lib/performanceIsomorphic.d.ts.map +0 -1
  124. package/lib/performanceIsomorphic.js.map +0 -1
  125. package/lib/trace.d.ts.map +0 -1
  126. package/lib/trace.js.map +0 -1
  127. package/lib/typedEventEmitter.d.ts.map +0 -1
  128. package/lib/typedEventEmitter.js.map +0 -1
  129. package/tsconfig.esnext.json +0 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-internal/client-utils
2
2
 
3
+ ## 2.0.0-rc.1.0.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-internal.8.0.0
4
8
 
5
9
  Dependency updates only.
package/README.md CHANGED
@@ -47,12 +47,6 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
47
47
  While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
48
48
  library consumers should always prefer `^`.
49
49
 
50
- Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
51
- you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
52
- Standard `^` and `~` ranges will not work as expected.
53
- See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
54
- package for more information including tools to convert between version schemes.
55
-
56
50
  <!-- prettier-ignore-end -->
57
51
 
58
52
  <!-- AUTO-GENERATED-CONTENT:END -->
@@ -0,0 +1,4 @@
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-esm.json"
4
+ }
@@ -1,13 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-lint.json",
4
- "messages": {
5
- "extractorMessageReporting": {
6
- // TODO: remove once base config has this enabled as an error
7
- "ae-incompatible-release-tags": {
8
- "logLevel": "error",
9
- "addToApiReportFile": false
10
- }
11
- }
12
- }
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.json"
13
4
  }
@@ -1,12 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.json",
4
- "messages": {
5
- "extractorMessageReporting": {
6
- // TODO: Add missing documentation and remove this rule override
7
- "ae-undocumented": {
8
- "logLevel": "none"
9
- }
10
- }
11
- }
3
+ "extends": "../../../common/build/build-common/api-extractor-base.json"
12
4
  }
@@ -23,10 +23,10 @@ class Buffer_2 extends Uint8Array {
23
23
  }
24
24
  export { Buffer_2 as Buffer }
25
25
 
26
- // @internal
26
+ // @alpha
27
27
  export const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
28
28
 
29
- // @alpha
29
+ // @public
30
30
  export type EventEmitterEventType = EventEmitter extends {
31
31
  on(event: infer E, listener: any): any;
32
32
  } ? E : never;
@@ -97,7 +97,7 @@ export class Trace {
97
97
  trace(): ITraceEvent;
98
98
  }
99
99
 
100
- // @alpha
100
+ // @public
101
101
  export class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
102
102
  constructor();
103
103
  // (undocumented)
@@ -116,7 +116,7 @@ export class TypedEventEmitter<TEvent> extends EventEmitter implements IEventPro
116
116
  readonly removeListener: TypedEventTransform<this, TEvent>;
117
117
  }
118
118
 
119
- // @alpha (undocumented)
119
+ // @public (undocumented)
120
120
  export type TypedEventTransform<TThis, TEvent> = TransformedEvent<TThis, "newListener" | "removeListener", Parameters<(event: string, listener: (...args: any[]) => void) => void>> & IEventTransformer<TThis, TEvent & IEvent> & TransformedEvent<TThis, EventEmitterEventType, any[]>;
121
121
 
122
122
  // @internal
@@ -30,7 +30,7 @@ export declare const stringToBuffer: (input: string, encoding: string) => ArrayB
30
30
  * @param encoding - output string's encoding
31
31
  * @returns the blob in string format
32
32
  *
33
- * @internal
33
+ * @alpha
34
34
  */
35
35
  export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
36
36
  /**
@@ -76,7 +76,7 @@ exports.stringToBuffer = stringToBuffer;
76
76
  * @param encoding - output string's encoding
77
77
  * @returns the blob in string format
78
78
  *
79
- * @internal
79
+ * @alpha
80
80
  */
81
81
  const bufferToString = (blob,
82
82
  // eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged
@@ -1 +1 @@
1
- {"version":3,"file":"bufferBrowser.js","sourceRoot":"","sources":["../src/bufferBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CACjC,GAAe;AACf,8GAA8G;AAC9G,QAAsC;IAEtC,QAAQ,QAAQ,EAAE;QACjB,KAAK,QAAQ,CAAC,CAAC;YACd,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;SACnC;QACD,KAAK,MAAM,CAAC;QACZ,8GAA8G;QAC9G,KAAK,OAAO,CAAC;QACb,KAAK,SAAS,CAAC,CAAC;YACf,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACrC;QACD,OAAO,CAAC,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,8BAA8B,CA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,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aACrC;YACD,KAAK,MAAM,CAAC;YACZ,8GAA8G;YAC9G,KAAK,OAAO,CAAC;YACb,KAAK,SAAS,CAAC,CAAC;gBACf,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC9C,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aACrC;YACD,OAAO,CAAC,CAAC;gBACR,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aAChD;SACD;IACF,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,GAAY;QAC3B,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,cAAc,CAAC,GAAW;QACxC,IAAI,YAAY,GAAG,GAAG,CAAC;QACvB,mEAAmE;QACnE,+CAA+C;QAC/C,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1C,oEAAoE;QACpE,2CAA2C;QAC3C,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAErD,oEAAoE;QACpE,6BAA6B;QAC7B,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;YAClC,MAAM,YAAY,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;YAC5C,YAAY,IAAI,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SACtD;QACD,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AA9GD,8BA8GC","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\n/**\n * Converts a Uint8Array to a string of the provided encoding\n * Useful when the array might be an {@link IsoBuffer}.\n *\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(\n\tarr: Uint8Array,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding?: \"utf8\" | \"utf-8\" | \"base64\",\n): string {\n\tswitch (encoding) {\n\t\tcase \"base64\": {\n\t\t\treturn base64js.fromByteArray(arr);\n\t\t}\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\tcase undefined: {\n\t\t\treturn new TextDecoder().decode(arr);\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new Error(\"invalid/unsupported encoding\");\n\t\t}\n\t}\n}\n\n/**\n * Converts a {@link https://en.wikipedia.org/wiki/Base64 | base64} or\n * {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8} string to array buffer.\n *\n * @param encoding - The input string's encoding.\n *\n * @internal\n */\nexport const stringToBuffer = (input: string, encoding: string): ArrayBufferLike =>\n\tIsoBuffer.from(input, encoding).buffer;\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 = (\n\tblob: ArrayBufferLike,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding: \"utf8\" | \"utf-8\" | \"base64\",\n): string => IsoBuffer.from(blob).toString(encoding);\n\n/**\n * Determines if an object is an array buffer.\n *\n * @remarks Will detect and reject TypedArrays, like Uint8Array.\n * Reason - they can be viewport into Array, they can be accepted, but caller has to deal with\n * math properly (i.e. Take into account byteOffset at minimum).\n * For example, construction of new TypedArray can be in the form of new TypedArray(typedArray) or\n * new TypedArray(buffer, byteOffset, length), but passing TypedArray will result in fist path (and\n * ignoring byteOffice, length).\n *\n * @param obj - The object to determine if it is an ArrayBuffer.\n *\n * @internal\n */\nexport function isArrayBuffer(obj: unknown): obj is ArrayBuffer {\n\tconst maybe = obj as (Partial<ArrayBuffer> & Partial<Uint8Array>) | undefined;\n\treturn (\n\t\tobj instanceof ArrayBuffer ||\n\t\t(typeof maybe === \"object\" &&\n\t\t\tmaybe !== null &&\n\t\t\ttypeof maybe.byteLength === \"number\" &&\n\t\t\ttypeof maybe.slice === \"function\" &&\n\t\t\tmaybe.byteOffset === undefined &&\n\t\t\tmaybe.buffer === undefined)\n\t);\n}\n\n/**\n * Minimal implementation of Buffer for our usages in the browser environment.\n *\n * @internal\n */\nexport class IsoBuffer extends Uint8Array {\n\t/**\n\t * Convert the buffer to a string.\n\t * Only supports encoding the whole string (unlike the Node Buffer equivalent)\n\t * and only utf8 and base64 encodings.\n\t *\n\t * @param encoding - The encoding to use.\n\t */\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tpublic toString(encoding?: \"utf8\" | \"utf-8\" | \"base64\"): string {\n\t\treturn Uint8ArrayToString(this, encoding);\n\t}\n\n\t/**\n\t * Static constructor\n\t * @param value - (string | ArrayBuffer)\n\t * @param encodingOrOffset - (string | number)\n\t * @param length - (number)\n\t *\n\t * @privateRemarks TODO: Use actual types\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tstatic from(value: any, encodingOrOffset?: any, length?: any): IsoBuffer {\n\t\tif (typeof value === \"string\") {\n\t\t\treturn IsoBuffer.fromString(value, encodingOrOffset as string | undefined);\n\t\t\t// Capture any typed arrays, including Uint8Array (and thus - IsoBuffer!)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t} else if (value !== null && typeof value === \"object\" && isArrayBuffer(value.buffer)) {\n\t\t\t// The version of the from function for the node buffer, which takes a buffer or typed array\n\t\t\t// as first parameter, does not have any offset or length parameters. Those are just silently\n\t\t\t// ignored and not taken into account\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n\t\t\treturn IsoBuffer.fromArrayBuffer(value.buffer, value.byteOffset, value.byteLength);\n\t\t} else if (isArrayBuffer(value)) {\n\t\t\treturn IsoBuffer.fromArrayBuffer(\n\t\t\t\tvalue,\n\t\t\t\tencodingOrOffset as number | undefined,\n\t\t\t\tlength as number,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new TypeError(\"Input value was neither a string nor an ArrayBuffer.\");\n\t\t}\n\t}\n\n\tstatic fromArrayBuffer(\n\t\tarrayBuffer: ArrayBuffer,\n\t\tbyteOffset?: number,\n\t\tbyteLength?: number,\n\t): IsoBuffer {\n\t\tconst offset = byteOffset ?? 0;\n\t\tconst validLength = byteLength ?? arrayBuffer.byteLength - offset;\n\t\tif (\n\t\t\toffset < 0 ||\n\t\t\toffset > arrayBuffer.byteLength ||\n\t\t\tvalidLength < 0 ||\n\t\t\tvalidLength + offset > arrayBuffer.byteLength\n\t\t) {\n\t\t\tthrow new RangeError(\"Invalid range specified.\");\n\t\t}\n\n\t\treturn new IsoBuffer(arrayBuffer, offset, validLength);\n\t}\n\n\tstatic fromString(str: string, encoding?: string): IsoBuffer {\n\t\tswitch (encoding) {\n\t\t\tcase \"base64\": {\n\t\t\t\tconst sanitizedString = this.sanitizeBase64(str);\n\t\t\t\tconst encoded = base64js.toByteArray(sanitizedString);\n\t\t\t\treturn new IsoBuffer(encoded.buffer);\n\t\t\t}\n\t\t\tcase \"utf8\":\n\t\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\t\t\tcase \"utf-8\":\n\t\t\tcase undefined: {\n\t\t\t\tconst encoded = new TextEncoder().encode(str);\n\t\t\t\treturn new IsoBuffer(encoded.buffer);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"invalid/unsupported encoding\");\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic isBuffer(obj: unknown): boolean {\n\t\tthrow new Error(\"unimplemented\");\n\t}\n\n\t/**\n\t * Sanitize a base64 string to provide to base64-js library.\n\t * {@link https://www.npmjs.com/package/base64-js} is not as tolerant of the same malformed base64 as Node'\n\t * Buffer is.\n\t */\n\tprivate static sanitizeBase64(str: string): string {\n\t\tlet sanitizedStr = str;\n\t\t// Remove everything after padding - Node buffer ignores everything\n\t\t// after any padding whereas base64-js does not\n\t\tsanitizedStr = sanitizedStr.split(\"=\")[0];\n\n\t\t// Remove invalid characters - Node buffer strips invalid characters\n\t\t// whereas base64-js replaces them with \"A\"\n\t\tsanitizedStr = sanitizedStr.replace(/[^\\w+-/]/g, \"\");\n\n\t\t// Check for missing padding - Node buffer tolerates missing padding\n\t\t// whereas base64-js does not\n\t\tif (sanitizedStr.length % 4 !== 0) {\n\t\t\tconst paddingArray = [\"\", \"===\", \"==\", \"=\"];\n\t\t\tsanitizedStr += paddingArray[sanitizedStr.length % 4];\n\t\t}\n\t\treturn sanitizedStr;\n\t}\n}\n"]}
1
+ {"version":3,"file":"bufferBrowser.js","sourceRoot":"","sources":["../src/bufferBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CACjC,GAAe;AACf,8GAA8G;AAC9G,QAAsC;IAEtC,QAAQ,QAAQ,EAAE;QACjB,KAAK,QAAQ,CAAC,CAAC;YACd,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;SACnC;QACD,KAAK,MAAM,CAAC;QACZ,8GAA8G;QAC9G,KAAK,OAAO,CAAC;QACb,KAAK,SAAS,CAAC,CAAC;YACf,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACrC;QACD,OAAO,CAAC,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SAChD;KACD;AACF,CAAC;AA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AC,CAAC;aACrC;YACD,KAAK,MAAM,CAAC;YACZ,8GAA8G;YAC9G,KAAK,OAAO,CAAC;YACb,KAAK,SAAS,CAAC,CAAC;gBACf,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC9C,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aACrC;YACD,OAAO,CAAC,CAAC;gBACR,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aAChD;SACD;IACF,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,GAAY;QAC3B,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,cAAc,CAAC,GAAW;QACxC,IAAI,YAAY,GAAG,GAAG,CAAC;QACvB,mEAAmE;QACnE,+CAA+C;QAC/C,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1C,oEAAoE;QACpE,2CAA2C;QAC3C,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAErD,oEAAoE;QACpE,6BAA6B;QAC7B,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;YAClC,MAAM,YAAY,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;YAC5C,YAAY,IAAI,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SACtD;QACD,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AA9GD,8BA8GC","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\n/**\n * Converts a Uint8Array to a string of the provided encoding\n * Useful when the array might be an {@link IsoBuffer}.\n *\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(\n\tarr: Uint8Array,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding?: \"utf8\" | \"utf-8\" | \"base64\",\n): string {\n\tswitch (encoding) {\n\t\tcase \"base64\": {\n\t\t\treturn base64js.fromByteArray(arr);\n\t\t}\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\tcase undefined: {\n\t\t\treturn new TextDecoder().decode(arr);\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new Error(\"invalid/unsupported encoding\");\n\t\t}\n\t}\n}\n\n/**\n * Converts a {@link https://en.wikipedia.org/wiki/Base64 | base64} or\n * {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8} string to array buffer.\n *\n * @param encoding - The input string's encoding.\n *\n * @internal\n */\nexport const stringToBuffer = (input: string, encoding: string): ArrayBufferLike =>\n\tIsoBuffer.from(input, encoding).buffer;\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 * @alpha\n */\nexport const bufferToString = (\n\tblob: ArrayBufferLike,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding: \"utf8\" | \"utf-8\" | \"base64\",\n): string => IsoBuffer.from(blob).toString(encoding);\n\n/**\n * Determines if an object is an array buffer.\n *\n * @remarks Will detect and reject TypedArrays, like Uint8Array.\n * Reason - they can be viewport into Array, they can be accepted, but caller has to deal with\n * math properly (i.e. Take into account byteOffset at minimum).\n * For example, construction of new TypedArray can be in the form of new TypedArray(typedArray) or\n * new TypedArray(buffer, byteOffset, length), but passing TypedArray will result in fist path (and\n * ignoring byteOffice, length).\n *\n * @param obj - The object to determine if it is an ArrayBuffer.\n *\n * @internal\n */\nexport function isArrayBuffer(obj: unknown): obj is ArrayBuffer {\n\tconst maybe = obj as (Partial<ArrayBuffer> & Partial<Uint8Array>) | undefined;\n\treturn (\n\t\tobj instanceof ArrayBuffer ||\n\t\t(typeof maybe === \"object\" &&\n\t\t\tmaybe !== null &&\n\t\t\ttypeof maybe.byteLength === \"number\" &&\n\t\t\ttypeof maybe.slice === \"function\" &&\n\t\t\tmaybe.byteOffset === undefined &&\n\t\t\tmaybe.buffer === undefined)\n\t);\n}\n\n/**\n * Minimal implementation of Buffer for our usages in the browser environment.\n *\n * @internal\n */\nexport class IsoBuffer extends Uint8Array {\n\t/**\n\t * Convert the buffer to a string.\n\t * Only supports encoding the whole string (unlike the Node Buffer equivalent)\n\t * and only utf8 and base64 encodings.\n\t *\n\t * @param encoding - The encoding to use.\n\t */\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tpublic toString(encoding?: \"utf8\" | \"utf-8\" | \"base64\"): string {\n\t\treturn Uint8ArrayToString(this, encoding);\n\t}\n\n\t/**\n\t * Static constructor\n\t * @param value - (string | ArrayBuffer)\n\t * @param encodingOrOffset - (string | number)\n\t * @param length - (number)\n\t *\n\t * @privateRemarks TODO: Use actual types\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tstatic from(value: any, encodingOrOffset?: any, length?: any): IsoBuffer {\n\t\tif (typeof value === \"string\") {\n\t\t\treturn IsoBuffer.fromString(value, encodingOrOffset as string | undefined);\n\t\t\t// Capture any typed arrays, including Uint8Array (and thus - IsoBuffer!)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t} else if (value !== null && typeof value === \"object\" && isArrayBuffer(value.buffer)) {\n\t\t\t// The version of the from function for the node buffer, which takes a buffer or typed array\n\t\t\t// as first parameter, does not have any offset or length parameters. Those are just silently\n\t\t\t// ignored and not taken into account\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n\t\t\treturn IsoBuffer.fromArrayBuffer(value.buffer, value.byteOffset, value.byteLength);\n\t\t} else if (isArrayBuffer(value)) {\n\t\t\treturn IsoBuffer.fromArrayBuffer(\n\t\t\t\tvalue,\n\t\t\t\tencodingOrOffset as number | undefined,\n\t\t\t\tlength as number,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new TypeError(\"Input value was neither a string nor an ArrayBuffer.\");\n\t\t}\n\t}\n\n\tstatic fromArrayBuffer(\n\t\tarrayBuffer: ArrayBuffer,\n\t\tbyteOffset?: number,\n\t\tbyteLength?: number,\n\t): IsoBuffer {\n\t\tconst offset = byteOffset ?? 0;\n\t\tconst validLength = byteLength ?? arrayBuffer.byteLength - offset;\n\t\tif (\n\t\t\toffset < 0 ||\n\t\t\toffset > arrayBuffer.byteLength ||\n\t\t\tvalidLength < 0 ||\n\t\t\tvalidLength + offset > arrayBuffer.byteLength\n\t\t) {\n\t\t\tthrow new RangeError(\"Invalid range specified.\");\n\t\t}\n\n\t\treturn new IsoBuffer(arrayBuffer, offset, validLength);\n\t}\n\n\tstatic fromString(str: string, encoding?: string): IsoBuffer {\n\t\tswitch (encoding) {\n\t\t\tcase \"base64\": {\n\t\t\t\tconst sanitizedString = this.sanitizeBase64(str);\n\t\t\t\tconst encoded = base64js.toByteArray(sanitizedString);\n\t\t\t\treturn new IsoBuffer(encoded.buffer);\n\t\t\t}\n\t\t\tcase \"utf8\":\n\t\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\t\t\tcase \"utf-8\":\n\t\t\tcase undefined: {\n\t\t\t\tconst encoded = new TextEncoder().encode(str);\n\t\t\t\treturn new IsoBuffer(encoded.buffer);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"invalid/unsupported encoding\");\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic isBuffer(obj: unknown): boolean {\n\t\tthrow new Error(\"unimplemented\");\n\t}\n\n\t/**\n\t * Sanitize a base64 string to provide to base64-js library.\n\t * {@link https://www.npmjs.com/package/base64-js} is not as tolerant of the same malformed base64 as Node'\n\t * Buffer is.\n\t */\n\tprivate static sanitizeBase64(str: string): string {\n\t\tlet sanitizedStr = str;\n\t\t// Remove everything after padding - Node buffer ignores everything\n\t\t// after any padding whereas base64-js does not\n\t\tsanitizedStr = sanitizedStr.split(\"=\")[0];\n\n\t\t// Remove invalid characters - Node buffer strips invalid characters\n\t\t// whereas base64-js replaces them with \"A\"\n\t\tsanitizedStr = sanitizedStr.replace(/[^\\w+-/]/g, \"\");\n\n\t\t// Check for missing padding - Node buffer tolerates missing padding\n\t\t// whereas base64-js does not\n\t\tif (sanitizedStr.length % 4 !== 0) {\n\t\t\tconst paddingArray = [\"\", \"===\", \"==\", \"=\"];\n\t\t\tsanitizedStr += paddingArray[sanitizedStr.length % 4];\n\t\t}\n\t\treturn sanitizedStr;\n\t}\n}\n"]}
@@ -56,7 +56,7 @@ export declare function stringToBuffer(input: string, encoding: string): ArrayBu
56
56
  * @param encoding - Output string's encoding
57
57
  * @returns The blob in string format
58
58
  *
59
- * @internal
59
+ * @alpha
60
60
  */
61
61
  export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
62
62
  //# sourceMappingURL=bufferNode.d.ts.map
@@ -50,7 +50,7 @@ exports.stringToBuffer = stringToBuffer;
50
50
  * @param encoding - Output string's encoding
51
51
  * @returns The blob in string format
52
52
  *
53
- * @internal
53
+ * @alpha
54
54
  */
55
55
  const bufferToString = (blob,
56
56
  // eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged
@@ -1 +1 @@
1
- {"version":3,"file":"bufferNode.js","sourceRoot":"","sources":["../src/bufferNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0BH;;GAEG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC;AAOhC;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CACjC,GAAe;AACf,8GAA8G;AAC9G,QAAsC;IAEtC,2EAA2E;IAC3E,6EAA6E;IAC7E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC3E,CAAC;AARD,gDAQC;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,CAC7B,IAAqB;AACrB,8GAA8G;AAC9G,QAAqC,EAC5B,EAAE,CAAC,iBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAJxC,QAAA,cAAc,kBAI0B","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\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\ttoString(encoding?: \"utf8\" | \"utf-8\" | \"base64\"): string;\n\n\t/**\n\t * Static constructor\n\t *\n\t * @param value - (string | ArrayBuffer).\n\t * @param encodingOrOffset - (string | number).\n\t * @param length - (number).\n\t *\n\t * @privateRemarks TODO: Use actual types\n\t */\n\tstatic from(value: unknown, encodingOrOffset?: unknown, length?: unknown): IsoBuffer;\n\tstatic isBuffer(obj: unknown): 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(\n\tarr: Uint8Array,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding?: \"utf8\" | \"utf-8\" | \"base64\",\n): string {\n\t// Buffer extends Uint8Array. Therefore, 'arr' may already be a Buffer, in\n\t// which case we can avoid copying the Uint8Array into a new Buffer instance.\n\treturn (Buffer.isBuffer(arr) ? arr : 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 = (\n\tblob: ArrayBufferLike,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding: \"utf8\" | \"utf-8\" | \"base64\",\n): string => IsoBuffer.from(blob).toString(encoding);\n"]}
1
+ {"version":3,"file":"bufferNode.js","sourceRoot":"","sources":["../src/bufferNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0BH;;GAEG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC;AAOhC;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CACjC,GAAe;AACf,8GAA8G;AAC9G,QAAsC;IAEtC,2EAA2E;IAC3E,6EAA6E;IAC7E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC3E,CAAC;AARD,gDAQC;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,CAC7B,IAAqB;AACrB,8GAA8G;AAC9G,QAAqC,EAC5B,EAAE,CAAC,iBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAJxC,QAAA,cAAc,kBAI0B","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\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\ttoString(encoding?: \"utf8\" | \"utf-8\" | \"base64\"): string;\n\n\t/**\n\t * Static constructor\n\t *\n\t * @param value - (string | ArrayBuffer).\n\t * @param encodingOrOffset - (string | number).\n\t * @param length - (number).\n\t *\n\t * @privateRemarks TODO: Use actual types\n\t */\n\tstatic from(value: unknown, encodingOrOffset?: unknown, length?: unknown): IsoBuffer;\n\tstatic isBuffer(obj: unknown): 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(\n\tarr: Uint8Array,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding?: \"utf8\" | \"utf-8\" | \"base64\",\n): string {\n\t// Buffer extends Uint8Array. Therefore, 'arr' may already be a Buffer, in\n\t// which case we can avoid copying the Uint8Array into a new Buffer instance.\n\treturn (Buffer.isBuffer(arr) ? arr : 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 * @alpha\n */\nexport const bufferToString = (\n\tblob: ArrayBufferLike,\n\t// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged\n\tencoding: \"utf8\" | \"utf-8\" | \"base64\",\n): string => IsoBuffer.from(blob).toString(encoding);\n"]}
@@ -9,15 +9,23 @@ import { TransformedEvent } from '@fluidframework/core-interfaces';
9
9
 
10
10
  /* Excluded from this release type: Buffer_2 */
11
11
 
12
- /* Excluded from this release type: bufferToString */
12
+ /**
13
+ * Convert binary blob to string format
14
+ *
15
+ * @param blob - The binary blob
16
+ * @param encoding - Output string's encoding
17
+ * @returns The blob in string format
18
+ *
19
+ * @alpha
20
+ */
21
+ export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
13
22
 
14
23
  /**
15
24
  * The event emitter polyfill and the node event emitter have different event types:
16
25
  * string | symbol vs. string | number
17
26
  *
18
27
  * This type allow us to correctly handle either type
19
- *
20
- * @alpha
28
+ * @public
21
29
  */
22
30
  export declare type EventEmitterEventType = EventEmitter extends {
23
31
  on(event: infer E, listener: any): any;
@@ -49,8 +57,7 @@ export declare type EventEmitterEventType = EventEmitter extends {
49
57
 
50
58
  /**
51
59
  * Event Emitter helper class the supports emitting typed events
52
- *
53
- * @alpha
60
+ * @public
54
61
  */
55
62
  export declare class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
56
63
  constructor();
@@ -64,7 +71,7 @@ export declare class TypedEventEmitter<TEvent> extends EventEmitter implements I
64
71
  }
65
72
 
66
73
  /**
67
- * @alpha
74
+ * @public
68
75
  */
69
76
  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[]>;
70
77
 
@@ -11,7 +11,16 @@ import { TransformedEvent } from '@fluidframework/core-interfaces';
11
11
 
12
12
  /* Excluded from this release type: bufferToString */
13
13
 
14
- /* Excluded from this release type: EventEmitterEventType */
14
+ /**
15
+ * The event emitter polyfill and the node event emitter have different event types:
16
+ * string | symbol vs. string | number
17
+ *
18
+ * This type allow us to correctly handle either type
19
+ * @public
20
+ */
21
+ export declare type EventEmitterEventType = EventEmitter extends {
22
+ on(event: infer E, listener: any): any;
23
+ } ? E : never;
15
24
 
16
25
  /* Excluded from this release type: EventForwarder */
17
26
 
@@ -23,14 +32,6 @@ import { TransformedEvent } from '@fluidframework/core-interfaces';
23
32
 
24
33
  /* Excluded from this release type: hashFile */
25
34
 
26
- /* Excluded from this release type: IDisposable */
27
-
28
- /* Excluded from this release type: IEvent */
29
-
30
- /* Excluded from this release type: IEventProvider */
31
-
32
- /* Excluded from this release type: IEventTransformer */
33
-
34
35
  /* Excluded from this release type: IsoBuffer */
35
36
 
36
37
  /* Excluded from this release type: IsomorphicPerformance */
@@ -45,11 +46,25 @@ import { TransformedEvent } from '@fluidframework/core-interfaces';
45
46
 
46
47
  /* Excluded from this release type: Trace */
47
48
 
48
- /* Excluded from this release type: TransformedEvent */
49
-
50
- /* Excluded from this release type: TypedEventEmitter */
51
-
52
- /* Excluded from this release type: TypedEventTransform */
49
+ /**
50
+ * Event Emitter helper class the supports emitting typed events
51
+ * @public
52
+ */
53
+ export declare class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
54
+ constructor();
55
+ readonly addListener: TypedEventTransform<this, TEvent>;
56
+ readonly on: TypedEventTransform<this, TEvent>;
57
+ readonly once: TypedEventTransform<this, TEvent>;
58
+ readonly prependListener: TypedEventTransform<this, TEvent>;
59
+ readonly prependOnceListener: TypedEventTransform<this, TEvent>;
60
+ readonly removeListener: TypedEventTransform<this, TEvent>;
61
+ readonly off: TypedEventTransform<this, TEvent>;
62
+ }
63
+
64
+ /**
65
+ * @public
66
+ */
67
+ 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[]>;
53
68
 
54
69
  /* Excluded from this release type: Uint8ArrayToArrayBuffer */
55
70
 
@@ -11,7 +11,16 @@ import { TransformedEvent } from '@fluidframework/core-interfaces';
11
11
 
12
12
  /* Excluded from this release type: bufferToString */
13
13
 
14
- /* Excluded from this release type: EventEmitterEventType */
14
+ /**
15
+ * The event emitter polyfill and the node event emitter have different event types:
16
+ * string | symbol vs. string | number
17
+ *
18
+ * This type allow us to correctly handle either type
19
+ * @public
20
+ */
21
+ export declare type EventEmitterEventType = EventEmitter extends {
22
+ on(event: infer E, listener: any): any;
23
+ } ? E : never;
15
24
 
16
25
  /* Excluded from this release type: EventForwarder */
17
26
 
@@ -23,14 +32,6 @@ import { TransformedEvent } from '@fluidframework/core-interfaces';
23
32
 
24
33
  /* Excluded from this release type: hashFile */
25
34
 
26
- /* Excluded from this release type: IDisposable */
27
-
28
- /* Excluded from this release type: IEvent */
29
-
30
- /* Excluded from this release type: IEventProvider */
31
-
32
- /* Excluded from this release type: IEventTransformer */
33
-
34
35
  /* Excluded from this release type: IsoBuffer */
35
36
 
36
37
  /* Excluded from this release type: IsomorphicPerformance */
@@ -45,11 +46,25 @@ import { TransformedEvent } from '@fluidframework/core-interfaces';
45
46
 
46
47
  /* Excluded from this release type: Trace */
47
48
 
48
- /* Excluded from this release type: TransformedEvent */
49
-
50
- /* Excluded from this release type: TypedEventEmitter */
51
-
52
- /* Excluded from this release type: TypedEventTransform */
49
+ /**
50
+ * Event Emitter helper class the supports emitting typed events
51
+ * @public
52
+ */
53
+ export declare class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
54
+ constructor();
55
+ readonly addListener: TypedEventTransform<this, TEvent>;
56
+ readonly on: TypedEventTransform<this, TEvent>;
57
+ readonly once: TypedEventTransform<this, TEvent>;
58
+ readonly prependListener: TypedEventTransform<this, TEvent>;
59
+ readonly prependOnceListener: TypedEventTransform<this, TEvent>;
60
+ readonly removeListener: TypedEventTransform<this, TEvent>;
61
+ readonly off: TypedEventTransform<this, TEvent>;
62
+ }
63
+
64
+ /**
65
+ * @public
66
+ */
67
+ 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[]>;
53
68
 
54
69
  /* Excluded from this release type: Uint8ArrayToArrayBuffer */
55
70
 
@@ -37,7 +37,7 @@ export { Buffer_2 as Buffer }
37
37
  * @param encoding - Output string's encoding
38
38
  * @returns The blob in string format
39
39
  *
40
- * @internal
40
+ * @alpha
41
41
  */
42
42
  export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
43
43
 
@@ -46,8 +46,7 @@ export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" |
46
46
  * string | symbol vs. string | number
47
47
  *
48
48
  * This type allow us to correctly handle either type
49
- *
50
- * @alpha
49
+ * @public
51
50
  */
52
51
  export declare type EventEmitterEventType = EventEmitter extends {
53
52
  on(event: infer E, listener: any): any;
@@ -207,8 +206,7 @@ export declare class Trace {
207
206
 
208
207
  /**
209
208
  * Event Emitter helper class the supports emitting typed events
210
- *
211
- * @alpha
209
+ * @public
212
210
  */
213
211
  export declare class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
214
212
  constructor();
@@ -222,7 +220,7 @@ export declare class TypedEventEmitter<TEvent> extends EventEmitter implements I
222
220
  }
223
221
 
224
222
  /**
225
- * @alpha
223
+ * @public
226
224
  */
227
225
  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[]>;
228
226
 
package/dist/index.d.ts CHANGED
@@ -2,19 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
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
5
  export * from "./indexNode";
17
- export { IsomorphicPerformance } from "./performanceIsomorphic";
18
- export { ITraceEvent, Trace } from "./trace";
19
- export { EventEmitterEventType, TypedEventEmitter, TypedEventTransform } from "./typedEventEmitter";
20
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,cAAc,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -18,28 +18,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.TypedEventEmitter = exports.Trace = exports.EventForwarder = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = void 0;
22
- var base64Encoding_1 = require("./base64Encoding");
23
- Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64Encoding_1.fromBase64ToUtf8; } });
24
- Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64Encoding_1.fromUtf8ToBase64; } });
25
- Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64Encoding_1.toUtf8; } });
26
- var bufferShared_1 = require("./bufferShared");
27
- Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_1.Uint8ArrayToArrayBuffer; } });
28
- var eventForwarder_1 = require("./eventForwarder");
29
- Object.defineProperty(exports, "EventForwarder", { enumerable: true, get: function () { return eventForwarder_1.EventForwarder; } });
30
- /**
31
- * NOTE: This export is remapped to export from "./indexBrowser" in browser environments via package.json.
32
- * Because the two files don't have fully isomorphic exports, using named exports for the full API surface
33
- * is problematic if that named export includes values not in their intersection.
34
- *
35
- * In a future breaking change of client-utils, we could use a named export for their intersection if we
36
- * desired.
37
- */
21
+ // THIS FILE IS NOT ACTUALLY USED (see indexBrowser.ts and indexNode.ts for that).
22
+ // It's only here so type-test-generator doesn't fail, until we update it to support packages that don't have an
23
+ // index.ts file.
38
24
  // eslint-disable-next-line no-restricted-syntax
39
25
  __exportStar(require("./indexNode"), exports);
40
- // export { IRange, IRangeTrackerSnapshot, RangeTracker } from "./rangeTracker";
41
- var trace_1 = require("./trace");
42
- Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return trace_1.Trace; } });
43
- var typedEventEmitter_1 = require("./typedEventEmitter");
44
- Object.defineProperty(exports, "TypedEventEmitter", { enumerable: true, get: function () { return typedEventEmitter_1.TypedEventEmitter; } });
45
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,kFAAkF;AAClF,gHAAgH;AAChH,iBAAiB;AACjB,gDAAgD;AAChD,8CAA4B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// THIS FILE IS NOT ACTUALLY USED (see indexBrowser.ts and indexNode.ts for that).\n// It's only here so type-test-generator doesn't fail, until we update it to support packages that don't have an\n// index.ts file.\n// eslint-disable-next-line no-restricted-syntax\nexport * from \"./indexNode\";\n"]}
@@ -5,4 +5,10 @@
5
5
  export { bufferToString, isArrayBuffer, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferBrowser";
6
6
  export { gitHashFile, hashFile } from "./hashFileBrowser";
7
7
  export { performance } from "./performanceIsomorphic";
8
+ export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding";
9
+ export { Uint8ArrayToArrayBuffer } from "./bufferShared";
10
+ export { EventForwarder } from "./eventForwarder";
11
+ export { IsomorphicPerformance } from "./performanceIsomorphic";
12
+ export { ITraceEvent, Trace } from "./trace";
13
+ export { EventEmitterEventType, TypedEventEmitter, TypedEventTransform } from "./typedEventEmitter";
8
14
  //# sourceMappingURL=indexBrowser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,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,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
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;
7
+ exports.TypedEventEmitter = exports.Trace = exports.EventForwarder = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = exports.performance = exports.hashFile = exports.gitHashFile = exports.Uint8ArrayToString = exports.stringToBuffer = exports.IsoBuffer = exports.isArrayBuffer = exports.bufferToString = void 0;
8
8
  var bufferBrowser_1 = require("./bufferBrowser");
9
9
  Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return bufferBrowser_1.bufferToString; } });
10
10
  Object.defineProperty(exports, "isArrayBuffer", { enumerable: true, get: function () { return bufferBrowser_1.isArrayBuffer; } });
@@ -16,4 +16,16 @@ Object.defineProperty(exports, "gitHashFile", { enumerable: true, get: function
16
16
  Object.defineProperty(exports, "hashFile", { enumerable: true, get: function () { return hashFileBrowser_1.hashFile; } });
17
17
  var performanceIsomorphic_1 = require("./performanceIsomorphic");
18
18
  Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_1.performance; } });
19
+ var base64Encoding_1 = require("./base64Encoding");
20
+ Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64Encoding_1.fromBase64ToUtf8; } });
21
+ Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64Encoding_1.fromUtf8ToBase64; } });
22
+ Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64Encoding_1.toUtf8; } });
23
+ var bufferShared_1 = require("./bufferShared");
24
+ Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_1.Uint8ArrayToArrayBuffer; } });
25
+ var eventForwarder_1 = require("./eventForwarder");
26
+ Object.defineProperty(exports, "EventForwarder", { enumerable: true, get: function () { return eventForwarder_1.EventForwarder; } });
27
+ var trace_1 = require("./trace");
28
+ Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return trace_1.Trace; } });
29
+ var typedEventEmitter_1 = require("./typedEventEmitter");
30
+ Object.defineProperty(exports, "TypedEventEmitter", { enumerable: true, get: function () { return typedEventEmitter_1.TypedEventEmitter; } });
19
31
  //# sourceMappingURL=indexBrowser.js.map
@@ -1 +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,iEAAsD;AAA7C,oHAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tbufferToString,\n\tisArrayBuffer,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferBrowser\";\nexport { gitHashFile, hashFile } from \"./hashFileBrowser\";\nexport { performance } from \"./performanceIsomorphic\";\n"]}
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,iEAAsD;AAA7C,oHAAA,WAAW,OAAA;AAEpB,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;AAEvB,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 {\n\tbufferToString,\n\tisArrayBuffer,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferBrowser\";\nexport { gitHashFile, hashFile } from \"./hashFileBrowser\";\nexport { performance } from \"./performanceIsomorphic\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64Encoding\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared\";\nexport { EventForwarder } from \"./eventForwarder\";\nexport { IsomorphicPerformance } from \"./performanceIsomorphic\";\nexport { ITraceEvent, Trace } from \"./trace\";\nexport { EventEmitterEventType, TypedEventEmitter, TypedEventTransform } from \"./typedEventEmitter\";\n"]}
@@ -2,7 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { Buffer, bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferNode";
5
+ export { type Buffer } from "./bufferNode";
6
+ export { bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString } from "./bufferNode";
6
7
  export { gitHashFile, hashFile } from "./hashFileNode";
7
8
  export { performance } from "./performanceIsomorphic";
9
+ export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding";
10
+ export { Uint8ArrayToArrayBuffer } from "./bufferShared";
11
+ export { EventForwarder } from "./eventForwarder";
12
+ export { IsomorphicPerformance } from "./performanceIsomorphic";
13
+ export { ITraceEvent, Trace } from "./trace";
14
+ export { EventEmitterEventType, TypedEventEmitter, TypedEventTransform } from "./typedEventEmitter";
8
15
  //# sourceMappingURL=indexNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexNode.d.ts","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,cAAc,EACd,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"indexNode.d.ts","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,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,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/indexNode.js CHANGED
@@ -4,9 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
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;
7
+ exports.TypedEventEmitter = exports.Trace = exports.EventForwarder = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = exports.performance = exports.hashFile = exports.gitHashFile = exports.Uint8ArrayToString = exports.stringToBuffer = exports.IsoBuffer = exports.bufferToString = void 0;
8
8
  var bufferNode_1 = require("./bufferNode");
9
- Object.defineProperty(exports, "Buffer", { enumerable: true, get: function () { return bufferNode_1.Buffer; } });
10
9
  Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return bufferNode_1.bufferToString; } });
11
10
  Object.defineProperty(exports, "IsoBuffer", { enumerable: true, get: function () { return bufferNode_1.IsoBuffer; } });
12
11
  Object.defineProperty(exports, "stringToBuffer", { enumerable: true, get: function () { return bufferNode_1.stringToBuffer; } });
@@ -16,4 +15,16 @@ Object.defineProperty(exports, "gitHashFile", { enumerable: true, get: function
16
15
  Object.defineProperty(exports, "hashFile", { enumerable: true, get: function () { return hashFileNode_1.hashFile; } });
17
16
  var performanceIsomorphic_1 = require("./performanceIsomorphic");
18
17
  Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_1.performance; } });
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
+ var trace_1 = require("./trace");
27
+ Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return trace_1.Trace; } });
28
+ var typedEventEmitter_1 = require("./typedEventEmitter");
29
+ Object.defineProperty(exports, "TypedEventEmitter", { enumerable: true, get: function () { return typedEventEmitter_1.TypedEventEmitter; } });
19
30
  //# sourceMappingURL=indexNode.js.map
@@ -1 +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,iEAAsD;AAA7C,oHAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tBuffer,\n\tbufferToString,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferNode\";\nexport { gitHashFile, hashFile } from \"./hashFileNode\";\nexport { performance } from \"./performanceIsomorphic\";\n"]}
1
+ {"version":3,"file":"indexNode.js","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2CAA6F;AAApF,4GAAA,cAAc,OAAA;AAAE,uGAAA,SAAS,OAAA;AAAE,4GAAA,cAAc,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AACtE,+CAAuD;AAA9C,2GAAA,WAAW,OAAA;AAAE,wGAAA,QAAQ,OAAA;AAC9B,iEAAsD;AAA7C,oHAAA,WAAW,OAAA;AAEpB,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;AAEvB,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 { type Buffer } from \"./bufferNode\";\nexport { bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString } from \"./bufferNode\";\nexport { gitHashFile, hashFile } from \"./hashFileNode\";\nexport { performance } from \"./performanceIsomorphic\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64Encoding\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared\";\nexport { EventForwarder } from \"./eventForwarder\";\nexport { IsomorphicPerformance } from \"./performanceIsomorphic\";\nexport { ITraceEvent, Trace } from \"./trace\";\nexport { EventEmitterEventType, TypedEventEmitter, TypedEventTransform } from \"./typedEventEmitter\";\n"]}