@fluid-internal/client-utils 2.20.0 → 2.22.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 (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api-report/client-utils.beta.api.md +0 -2
  3. package/api-report/client-utils.public.api.md +0 -2
  4. package/dist/indexBrowser.d.ts +2 -2
  5. package/dist/indexBrowser.d.ts.map +1 -1
  6. package/dist/indexBrowser.js +5 -3
  7. package/dist/indexBrowser.js.map +1 -1
  8. package/dist/indexNode.d.ts +2 -2
  9. package/dist/indexNode.d.ts.map +1 -1
  10. package/dist/indexNode.js +5 -3
  11. package/dist/indexNode.js.map +1 -1
  12. package/dist/layerCompat.d.ts +84 -0
  13. package/dist/layerCompat.d.ts.map +1 -0
  14. package/dist/layerCompat.js +56 -0
  15. package/dist/layerCompat.js.map +1 -0
  16. package/dist/performanceIsomorphic.d.ts +7 -11
  17. package/dist/performanceIsomorphic.d.ts.map +1 -1
  18. package/dist/performanceIsomorphic.js +10 -6
  19. package/dist/performanceIsomorphic.js.map +1 -1
  20. package/dist/trace.js +2 -2
  21. package/dist/trace.js.map +1 -1
  22. package/lib/indexBrowser.d.ts +2 -2
  23. package/lib/indexBrowser.d.ts.map +1 -1
  24. package/lib/indexBrowser.js +2 -1
  25. package/lib/indexBrowser.js.map +1 -1
  26. package/lib/indexNode.d.ts +2 -2
  27. package/lib/indexNode.d.ts.map +1 -1
  28. package/lib/indexNode.js +2 -1
  29. package/lib/indexNode.js.map +1 -1
  30. package/lib/layerCompat.d.ts +84 -0
  31. package/lib/layerCompat.d.ts.map +1 -0
  32. package/lib/layerCompat.js +52 -0
  33. package/lib/layerCompat.js.map +1 -0
  34. package/lib/performanceIsomorphic.d.ts +7 -11
  35. package/lib/performanceIsomorphic.d.ts.map +1 -1
  36. package/lib/performanceIsomorphic.js +8 -5
  37. package/lib/performanceIsomorphic.js.map +1 -1
  38. package/lib/trace.js +3 -3
  39. package/lib/trace.js.map +1 -1
  40. package/package.json +11 -11
  41. package/src/indexBrowser.ts +9 -2
  42. package/src/indexNode.ts +9 -2
  43. package/src/layerCompat.ts +125 -0
  44. package/src/performanceIsomorphic.ts +7 -13
  45. package/src/trace.ts +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fluid-internal/client-utils
2
2
 
3
+ ## 2.22.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.21.0
8
+
9
+ Dependency updates only.
10
+
3
11
  ## 2.20.0
4
12
 
5
13
  Dependency updates only.
@@ -6,8 +6,6 @@
6
6
 
7
7
  export { EventEmitter }
8
8
 
9
- export { performance_2 as performance }
10
-
11
9
  // (No @packageDocumentation comment for this package)
12
10
 
13
11
  ```
@@ -6,8 +6,6 @@
6
6
 
7
7
  export { EventEmitter }
8
8
 
9
- export { performance_2 as performance }
10
-
11
9
  // (No @packageDocumentation comment for this package)
12
10
 
13
11
  ```
@@ -4,12 +4,12 @@
4
4
  */
5
5
  export { bufferToString, isArrayBuffer, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferBrowser.js";
6
6
  export { gitHashFile, hashFile } from "./hashFileBrowser.js";
7
- export { performance } from "./performanceIsomorphic.js";
8
7
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
9
8
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
10
9
  export { EventEmitter } from "./eventEmitter.cjs";
11
- export { type IsomorphicPerformance } from "./performanceIsomorphic.js";
10
+ export { performanceNow } from "./performanceIsomorphic.js";
12
11
  export { type ITraceEvent, Trace } from "./trace.js";
13
12
  export { type EventEmitterEventType, TypedEventEmitter, type TypedEventTransform, } from "./typedEventEmitter.js";
14
13
  export { createEmitter } from "./events/index.js";
14
+ export { checkLayerCompatibility, type LayerCompatCheckResult, type ILayerCompatDetails, type IProvideLayerCompatDetails, type ILayerCompatSupportRequirements, } from "./layerCompat.js";
15
15
  //# sourceMappingURL=indexBrowser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACN,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,GACpC,MAAM,kBAAkB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createEmitter = exports.TypedEventEmitter = exports.Trace = exports.EventEmitter = 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;
7
+ exports.checkLayerCompatibility = exports.createEmitter = exports.TypedEventEmitter = exports.Trace = exports.performanceNow = exports.EventEmitter = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = exports.hashFile = exports.gitHashFile = exports.Uint8ArrayToString = exports.stringToBuffer = exports.IsoBuffer = exports.isArrayBuffer = exports.bufferToString = void 0;
8
8
  // Entrypoint for browser-specific code in the package.
9
9
  // (See 'Isomorphic Code' section in the package README.md.)
10
10
  var bufferBrowser_js_1 = require("./bufferBrowser.js");
@@ -16,8 +16,6 @@ Object.defineProperty(exports, "Uint8ArrayToString", { enumerable: true, get: fu
16
16
  var hashFileBrowser_js_1 = require("./hashFileBrowser.js");
17
17
  Object.defineProperty(exports, "gitHashFile", { enumerable: true, get: function () { return hashFileBrowser_js_1.gitHashFile; } });
18
18
  Object.defineProperty(exports, "hashFile", { enumerable: true, get: function () { return hashFileBrowser_js_1.hashFile; } });
19
- var performanceIsomorphic_js_1 = require("./performanceIsomorphic.js");
20
- Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_js_1.performance; } });
21
19
  var base64EncodingBrowser_js_1 = require("./base64EncodingBrowser.js");
22
20
  Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64EncodingBrowser_js_1.fromBase64ToUtf8; } });
23
21
  Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64EncodingBrowser_js_1.fromUtf8ToBase64; } });
@@ -26,10 +24,14 @@ var bufferShared_js_1 = require("./bufferShared.js");
26
24
  Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_js_1.Uint8ArrayToArrayBuffer; } });
27
25
  var eventEmitter_cjs_1 = require("./eventEmitter.cjs");
28
26
  Object.defineProperty(exports, "EventEmitter", { enumerable: true, get: function () { return eventEmitter_cjs_1.EventEmitter; } });
27
+ var performanceIsomorphic_js_1 = require("./performanceIsomorphic.js");
28
+ Object.defineProperty(exports, "performanceNow", { enumerable: true, get: function () { return performanceIsomorphic_js_1.performanceNow; } });
29
29
  var trace_js_1 = require("./trace.js");
30
30
  Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return trace_js_1.Trace; } });
31
31
  var typedEventEmitter_js_1 = require("./typedEventEmitter.js");
32
32
  Object.defineProperty(exports, "TypedEventEmitter", { enumerable: true, get: function () { return typedEventEmitter_js_1.TypedEventEmitter; } });
33
33
  var index_js_1 = require("./events/index.js");
34
34
  Object.defineProperty(exports, "createEmitter", { enumerable: true, get: function () { return index_js_1.createEmitter; } });
35
+ var layerCompat_js_1 = require("./layerCompat.js");
36
+ Object.defineProperty(exports, "checkLayerCompatibility", { enumerable: true, get: function () { return layerCompat_js_1.checkLayerCompatibility; } });
35
37
  //# sourceMappingURL=indexBrowser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexBrowser.js","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAuD;AACvD,4DAA4D;AAE5D,uDAM4B;AAL3B,kHAAA,cAAc,OAAA;AACd,iHAAA,aAAa,OAAA;AACb,6GAAA,SAAS,OAAA;AACT,kHAAA,cAAc,OAAA;AACd,sHAAA,kBAAkB,OAAA;AAEnB,2DAA6D;AAApD,iHAAA,WAAW,OAAA;AAAE,8GAAA,QAAQ,OAAA;AAC9B,uEAAyD;AAAhD,uHAAA,WAAW,OAAA;AAEpB,uEAAwF;AAA/E,4HAAA,gBAAgB,OAAA;AAAE,4HAAA,gBAAgB,OAAA;AAAE,kHAAA,MAAM,OAAA;AACnD,qDAA4D;AAAnD,0HAAA,uBAAuB,OAAA;AAChC,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AAErB,uCAAqD;AAA1B,iGAAA,KAAK,OAAA;AAChC,+DAIgC;AAF/B,yHAAA,iBAAiB,OAAA;AAIlB,8CAAkD;AAAzC,yGAAA,aAAa,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for browser-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport {\n\tbufferToString,\n\tisArrayBuffer,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferBrowser.js\";\nexport { gitHashFile, hashFile } from \"./hashFileBrowser.js\";\nexport { performance } from \"./performanceIsomorphic.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingBrowser.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport { type IsomorphicPerformance } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n"]}
1
+ {"version":3,"file":"indexBrowser.js","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAuD;AACvD,4DAA4D;AAE5D,uDAM4B;AAL3B,kHAAA,cAAc,OAAA;AACd,iHAAA,aAAa,OAAA;AACb,6GAAA,SAAS,OAAA;AACT,kHAAA,cAAc,OAAA;AACd,sHAAA,kBAAkB,OAAA;AAEnB,2DAA6D;AAApD,iHAAA,WAAW,OAAA;AAAE,8GAAA,QAAQ,OAAA;AAE9B,uEAAwF;AAA/E,4HAAA,gBAAgB,OAAA;AAAE,4HAAA,gBAAgB,OAAA;AAAE,kHAAA,MAAM,OAAA;AACnD,qDAA4D;AAAnD,0HAAA,uBAAuB,OAAA;AAChC,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,uEAA4D;AAAnD,0HAAA,cAAc,OAAA;AACvB,uCAAqD;AAA1B,iGAAA,KAAK,OAAA;AAChC,+DAIgC;AAF/B,yHAAA,iBAAiB,OAAA;AAIlB,8CAAkD;AAAzC,yGAAA,aAAa,OAAA;AAEtB,mDAM0B;AALzB,yHAAA,uBAAuB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for browser-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport {\n\tbufferToString,\n\tisArrayBuffer,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferBrowser.js\";\nexport { gitHashFile, hashFile } from \"./hashFileBrowser.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingBrowser.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport { performanceNow } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n\nexport {\n\tcheckLayerCompatibility,\n\ttype LayerCompatCheckResult,\n\ttype ILayerCompatDetails,\n\ttype IProvideLayerCompatDetails,\n\ttype ILayerCompatSupportRequirements,\n} from \"./layerCompat.js\";\n"]}
@@ -5,12 +5,12 @@
5
5
  export { type Buffer } from "./bufferNode.js";
6
6
  export { bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferNode.js";
7
7
  export { gitHashFile, hashFile } from "./hashFileNode.js";
8
- export { performance } from "./performanceIsomorphic.js";
9
8
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
10
9
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
11
10
  export { EventEmitter } from "./eventEmitter.cjs";
12
- export type { IsomorphicPerformance } from "./performanceIsomorphic.js";
11
+ export { performanceNow } from "./performanceIsomorphic.js";
13
12
  export { type ITraceEvent, Trace } from "./trace.js";
14
13
  export { type EventEmitterEventType, TypedEventEmitter, type TypedEventTransform, } from "./typedEventEmitter.js";
15
14
  export { createEmitter } from "./events/index.js";
15
+ export { checkLayerCompatibility, type LayerCompatCheckResult, type ILayerCompatDetails, type IProvideLayerCompatDetails, type ILayerCompatSupportRequirements, } from "./layerCompat.js";
16
16
  //# sourceMappingURL=indexNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexNode.d.ts","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,cAAc,EACd,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,4BAA4B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"indexNode.d.ts","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,cAAc,EACd,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACN,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,GACpC,MAAM,kBAAkB,CAAC"}
package/dist/indexNode.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createEmitter = exports.TypedEventEmitter = exports.Trace = exports.EventEmitter = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = exports.performance = exports.hashFile = exports.gitHashFile = exports.Uint8ArrayToString = exports.stringToBuffer = exports.IsoBuffer = exports.bufferToString = void 0;
7
+ exports.checkLayerCompatibility = exports.createEmitter = exports.TypedEventEmitter = exports.Trace = exports.performanceNow = exports.EventEmitter = exports.Uint8ArrayToArrayBuffer = exports.toUtf8 = exports.fromUtf8ToBase64 = exports.fromBase64ToUtf8 = exports.hashFile = exports.gitHashFile = exports.Uint8ArrayToString = exports.stringToBuffer = exports.IsoBuffer = exports.bufferToString = void 0;
8
8
  var bufferNode_js_1 = require("./bufferNode.js");
9
9
  Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return bufferNode_js_1.bufferToString; } });
10
10
  Object.defineProperty(exports, "IsoBuffer", { enumerable: true, get: function () { return bufferNode_js_1.IsoBuffer; } });
@@ -13,8 +13,6 @@ Object.defineProperty(exports, "Uint8ArrayToString", { enumerable: true, get: fu
13
13
  var hashFileNode_js_1 = require("./hashFileNode.js");
14
14
  Object.defineProperty(exports, "gitHashFile", { enumerable: true, get: function () { return hashFileNode_js_1.gitHashFile; } });
15
15
  Object.defineProperty(exports, "hashFile", { enumerable: true, get: function () { return hashFileNode_js_1.hashFile; } });
16
- var performanceIsomorphic_js_1 = require("./performanceIsomorphic.js");
17
- Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_js_1.performance; } });
18
16
  var base64EncodingNode_js_1 = require("./base64EncodingNode.js");
19
17
  Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64EncodingNode_js_1.fromBase64ToUtf8; } });
20
18
  Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64EncodingNode_js_1.fromUtf8ToBase64; } });
@@ -23,10 +21,14 @@ var bufferShared_js_1 = require("./bufferShared.js");
23
21
  Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_js_1.Uint8ArrayToArrayBuffer; } });
24
22
  var eventEmitter_cjs_1 = require("./eventEmitter.cjs");
25
23
  Object.defineProperty(exports, "EventEmitter", { enumerable: true, get: function () { return eventEmitter_cjs_1.EventEmitter; } });
24
+ var performanceIsomorphic_js_1 = require("./performanceIsomorphic.js");
25
+ Object.defineProperty(exports, "performanceNow", { enumerable: true, get: function () { return performanceIsomorphic_js_1.performanceNow; } });
26
26
  var trace_js_1 = require("./trace.js");
27
27
  Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return trace_js_1.Trace; } });
28
28
  var typedEventEmitter_js_1 = require("./typedEventEmitter.js");
29
29
  Object.defineProperty(exports, "TypedEventEmitter", { enumerable: true, get: function () { return typedEventEmitter_js_1.TypedEventEmitter; } });
30
30
  var index_js_1 = require("./events/index.js");
31
31
  Object.defineProperty(exports, "createEmitter", { enumerable: true, get: function () { return index_js_1.createEmitter; } });
32
+ var layerCompat_js_1 = require("./layerCompat.js");
33
+ Object.defineProperty(exports, "checkLayerCompatibility", { enumerable: true, get: function () { return layerCompat_js_1.checkLayerCompatibility; } });
32
34
  //# sourceMappingURL=indexNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexNode.js","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,iDAKyB;AAJxB,+GAAA,cAAc,OAAA;AACd,0GAAA,SAAS,OAAA;AACT,+GAAA,cAAc,OAAA;AACd,mHAAA,kBAAkB,OAAA;AAEnB,qDAA0D;AAAjD,8GAAA,WAAW,OAAA;AAAE,2GAAA,QAAQ,OAAA;AAC9B,uEAAyD;AAAhD,uHAAA,WAAW,OAAA;AAEpB,iEAAqF;AAA5E,yHAAA,gBAAgB,OAAA;AAAE,yHAAA,gBAAgB,OAAA;AAAE,+GAAA,MAAM,OAAA;AACnD,qDAA4D;AAAnD,0HAAA,uBAAuB,OAAA;AAChC,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AAErB,uCAAqD;AAA1B,iGAAA,KAAK,OAAA;AAChC,+DAIgC;AAF/B,yHAAA,iBAAiB,OAAA;AAIlB,8CAAkD;AAAzC,yGAAA,aAAa,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for Node.js-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport { type Buffer } from \"./bufferNode.js\";\nexport {\n\tbufferToString,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferNode.js\";\nexport { gitHashFile, hashFile } from \"./hashFileNode.js\";\nexport { performance } from \"./performanceIsomorphic.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingNode.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport type { IsomorphicPerformance } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n"]}
1
+ {"version":3,"file":"indexNode.js","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,iDAKyB;AAJxB,+GAAA,cAAc,OAAA;AACd,0GAAA,SAAS,OAAA;AACT,+GAAA,cAAc,OAAA;AACd,mHAAA,kBAAkB,OAAA;AAEnB,qDAA0D;AAAjD,8GAAA,WAAW,OAAA;AAAE,2GAAA,QAAQ,OAAA;AAE9B,iEAAqF;AAA5E,yHAAA,gBAAgB,OAAA;AAAE,yHAAA,gBAAgB,OAAA;AAAE,+GAAA,MAAM,OAAA;AACnD,qDAA4D;AAAnD,0HAAA,uBAAuB,OAAA;AAChC,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,uEAA4D;AAAnD,0HAAA,cAAc,OAAA;AACvB,uCAAqD;AAA1B,iGAAA,KAAK,OAAA;AAChC,+DAIgC;AAF/B,yHAAA,iBAAiB,OAAA;AAIlB,8CAAkD;AAAzC,yGAAA,aAAa,OAAA;AAEtB,mDAM0B;AALzB,yHAAA,uBAAuB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for Node.js-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport { type Buffer } from \"./bufferNode.js\";\nexport {\n\tbufferToString,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferNode.js\";\nexport { gitHashFile, hashFile } from \"./hashFileNode.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingNode.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport { performanceNow } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n\nexport {\n\tcheckLayerCompatibility,\n\ttype LayerCompatCheckResult,\n\ttype ILayerCompatDetails,\n\ttype IProvideLayerCompatDetails,\n\ttype ILayerCompatSupportRequirements,\n} from \"./layerCompat.js\";\n"]}
@@ -0,0 +1,84 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Result of a layer compatibility check - whether a layer is compatible with another layer.
7
+ * @internal
8
+ */
9
+ export type LayerCompatCheckResult = {
10
+ readonly isCompatible: true;
11
+ } | {
12
+ readonly isCompatible: false;
13
+ /**
14
+ * Whether the generation of the layer is compatible with the other layer.
15
+ */
16
+ readonly isGenerationCompatible: boolean;
17
+ /**
18
+ * The features that are required by the layer but are not supported by the other layer. This will only
19
+ * be set if there are unsupported features.
20
+ */
21
+ readonly unsupportedFeatures: readonly string[] | undefined;
22
+ };
23
+ /**
24
+ * @internal
25
+ */
26
+ export declare const ILayerCompatDetails: keyof IProvideLayerCompatDetails;
27
+ /**
28
+ * @internal
29
+ */
30
+ export interface IProvideLayerCompatDetails {
31
+ readonly ILayerCompatDetails: ILayerCompatDetails;
32
+ }
33
+ /**
34
+ * This interface is used to communicate the compatibility details of a layer to another layer.
35
+ * @internal
36
+ */
37
+ export interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails> {
38
+ /**
39
+ * A list of features supported by the layer at a particular layer boundary. This is used to check if these
40
+ * set of features satisfy the requirements of another layer.
41
+ */
42
+ readonly supportedFeatures: ReadonlySet<string>;
43
+ /**
44
+ * The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies
45
+ * the minimum generation it requires to be compatible.
46
+ */
47
+ readonly generation: number;
48
+ /**
49
+ * The package version of the layer. When an incompatibility is detected, this is used to provide more context
50
+ * on what the versions of the incompatible layers are.
51
+ */
52
+ readonly pkgVersion: string;
53
+ }
54
+ /**
55
+ * This is the default compat details for a layer when it doesn't provide any compat details. This is used for
56
+ * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.
57
+ * @internal
58
+ */
59
+ export declare const defaultLayerCompatDetails: ILayerCompatDetails;
60
+ /**
61
+ * The requirements that a layer needs another layer to support for them to be compatible.
62
+ * @internal
63
+ */
64
+ export interface ILayerCompatSupportRequirements {
65
+ /**
66
+ * The minimum supported generation the other layer needs to be at.
67
+ */
68
+ readonly minSupportedGeneration: number;
69
+ /**
70
+ * The features that the other layer needs to support.
71
+ */
72
+ readonly requiredFeatures: readonly string[];
73
+ }
74
+ /**
75
+ * Checks compatibility of a layer (layer1) with another layer (layer2).
76
+ * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.
77
+ * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the
78
+ * default compatibility details are used for backwards compatibility.
79
+ * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.
80
+ *
81
+ * @internal
82
+ */
83
+ export declare function checkLayerCompatibility(compatSupportRequirementsLayer1: ILayerCompatSupportRequirements, compatDetailsLayer2: ILayerCompatDetails | undefined): LayerCompatCheckResult;
84
+ //# sourceMappingURL=layerCompat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerCompat.d.ts","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC/B;IAAE,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;CAAE,GAC/B;IACA,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,0BAAkD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC/E;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAIvC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACtC,+BAA+B,EAAE,+BAA+B,EAChE,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,GAClD,sBAAsB,CA4BxB"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.checkLayerCompatibility = exports.defaultLayerCompatDetails = exports.ILayerCompatDetails = void 0;
8
+ /**
9
+ * @internal
10
+ */
11
+ exports.ILayerCompatDetails = "ILayerCompatDetails";
12
+ /**
13
+ * This is the default compat details for a layer when it doesn't provide any compat details. This is used for
14
+ * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.
15
+ * @internal
16
+ */
17
+ exports.defaultLayerCompatDetails = {
18
+ supportedFeatures: new Set(),
19
+ generation: 0, // 0 is reserved for layers before compatibility enforcement was introduced.
20
+ pkgVersion: "unknown",
21
+ };
22
+ /**
23
+ * Checks compatibility of a layer (layer1) with another layer (layer2).
24
+ * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.
25
+ * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the
26
+ * default compatibility details are used for backwards compatibility.
27
+ * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.
28
+ *
29
+ * @internal
30
+ */
31
+ function checkLayerCompatibility(compatSupportRequirementsLayer1, compatDetailsLayer2) {
32
+ const compatDetailsLayer2ToUse = compatDetailsLayer2 ?? exports.defaultLayerCompatDetails;
33
+ let isGenerationCompatible = true;
34
+ const unsupportedFeatures = [];
35
+ // If layer2's generation is less than the required minimum supported generation of layer1,
36
+ // then it is not compatible.
37
+ if (compatDetailsLayer2ToUse.generation <
38
+ compatSupportRequirementsLayer1.minSupportedGeneration) {
39
+ isGenerationCompatible = false;
40
+ }
41
+ // All features required by layer1 must be supported by layer2 to be compatible.
42
+ for (const feature of compatSupportRequirementsLayer1.requiredFeatures) {
43
+ if (!compatDetailsLayer2ToUse.supportedFeatures.has(feature)) {
44
+ unsupportedFeatures.push(feature);
45
+ }
46
+ }
47
+ return isGenerationCompatible && unsupportedFeatures.length === 0
48
+ ? { isCompatible: true }
49
+ : {
50
+ isCompatible: false,
51
+ isGenerationCompatible,
52
+ unsupportedFeatures: unsupportedFeatures.length > 0 ? unsupportedFeatures : undefined,
53
+ };
54
+ }
55
+ exports.checkLayerCompatibility = checkLayerCompatibility;
56
+ //# sourceMappingURL=layerCompat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerCompat.js","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAqBH;;GAEG;AACU,QAAA,mBAAmB,GAAqC,qBAAqB,CAAC;AA+B3F;;;;GAIG;AACU,QAAA,yBAAyB,GAAwB;IAC7D,iBAAiB,EAAE,IAAI,GAAG,EAAE;IAC5B,UAAU,EAAE,CAAC,EAAE,4EAA4E;IAC3F,UAAU,EAAE,SAAS;CACrB,CAAC;AAiBF;;;;;;;;GAQG;AACH,SAAgB,uBAAuB,CACtC,+BAAgE,EAChE,mBAAoD;IAEpD,MAAM,wBAAwB,GAAG,mBAAmB,IAAI,iCAAyB,CAAC;IAClF,IAAI,sBAAsB,GAAG,IAAI,CAAC;IAClC,MAAM,mBAAmB,GAAa,EAAE,CAAC;IAEzC,2FAA2F;IAC3F,6BAA6B;IAC7B,IACC,wBAAwB,CAAC,UAAU;QACnC,+BAA+B,CAAC,sBAAsB,EACrD,CAAC;QACF,sBAAsB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,gFAAgF;IAChF,KAAK,MAAM,OAAO,IAAI,+BAA+B,CAAC,gBAAgB,EAAE,CAAC;QACxE,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IAED,OAAO,sBAAsB,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;QAChE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE;QACxB,CAAC,CAAC;YACA,YAAY,EAAE,KAAK;YACnB,sBAAsB;YACtB,mBAAmB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS;SACrF,CAAC;AACL,CAAC;AA/BD,0DA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Result of a layer compatibility check - whether a layer is compatible with another layer.\n * @internal\n */\nexport type LayerCompatCheckResult =\n\t| { readonly isCompatible: true }\n\t| {\n\t\t\treadonly isCompatible: false;\n\t\t\t/**\n\t\t\t * Whether the generation of the layer is compatible with the other layer.\n\t\t\t */\n\t\t\treadonly isGenerationCompatible: boolean;\n\t\t\t/**\n\t\t\t * The features that are required by the layer but are not supported by the other layer. This will only\n\t\t\t * be set if there are unsupported features.\n\t\t\t */\n\t\t\treadonly unsupportedFeatures: readonly string[] | undefined;\n\t };\n\n/**\n * @internal\n */\nexport const ILayerCompatDetails: keyof IProvideLayerCompatDetails = \"ILayerCompatDetails\";\n\n/**\n * @internal\n */\nexport interface IProvideLayerCompatDetails {\n\treadonly ILayerCompatDetails: ILayerCompatDetails;\n}\n\n/**\n * This interface is used to communicate the compatibility details of a layer to another layer.\n * @internal\n */\nexport interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails> {\n\t/**\n\t * A list of features supported by the layer at a particular layer boundary. This is used to check if these\n\t * set of features satisfy the requirements of another layer.\n\t */\n\treadonly supportedFeatures: ReadonlySet<string>;\n\t/**\n\t * The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies\n\t * the minimum generation it requires to be compatible.\n\t */\n\treadonly generation: number;\n\t/**\n\t * The package version of the layer. When an incompatibility is detected, this is used to provide more context\n\t * on what the versions of the incompatible layers are.\n\t */\n\treadonly pkgVersion: string;\n}\n\n/**\n * This is the default compat details for a layer when it doesn't provide any compat details. This is used for\n * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.\n * @internal\n */\nexport const defaultLayerCompatDetails: ILayerCompatDetails = {\n\tsupportedFeatures: new Set(),\n\tgeneration: 0, // 0 is reserved for layers before compatibility enforcement was introduced.\n\tpkgVersion: \"unknown\",\n};\n\n/**\n * The requirements that a layer needs another layer to support for them to be compatible.\n * @internal\n */\nexport interface ILayerCompatSupportRequirements {\n\t/**\n\t * The minimum supported generation the other layer needs to be at.\n\t */\n\treadonly minSupportedGeneration: number;\n\t/**\n\t * The features that the other layer needs to support.\n\t */\n\treadonly requiredFeatures: readonly string[];\n}\n\n/**\n * Checks compatibility of a layer (layer1) with another layer (layer2).\n * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.\n * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the\n * default compatibility details are used for backwards compatibility.\n * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.\n *\n * @internal\n */\nexport function checkLayerCompatibility(\n\tcompatSupportRequirementsLayer1: ILayerCompatSupportRequirements,\n\tcompatDetailsLayer2: ILayerCompatDetails | undefined,\n): LayerCompatCheckResult {\n\tconst compatDetailsLayer2ToUse = compatDetailsLayer2 ?? defaultLayerCompatDetails;\n\tlet isGenerationCompatible = true;\n\tconst unsupportedFeatures: string[] = [];\n\n\t// If layer2's generation is less than the required minimum supported generation of layer1,\n\t// then it is not compatible.\n\tif (\n\t\tcompatDetailsLayer2ToUse.generation <\n\t\tcompatSupportRequirementsLayer1.minSupportedGeneration\n\t) {\n\t\tisGenerationCompatible = false;\n\t}\n\n\t// All features required by layer1 must be supported by layer2 to be compatible.\n\tfor (const feature of compatSupportRequirementsLayer1.requiredFeatures) {\n\t\tif (!compatDetailsLayer2ToUse.supportedFeatures.has(feature)) {\n\t\t\tunsupportedFeatures.push(feature);\n\t\t}\n\t}\n\n\treturn isGenerationCompatible && unsupportedFeatures.length === 0\n\t\t? { isCompatible: true }\n\t\t: {\n\t\t\t\tisCompatible: false,\n\t\t\t\tisGenerationCompatible,\n\t\t\t\tunsupportedFeatures: unsupportedFeatures.length > 0 ? unsupportedFeatures : undefined,\n\t\t\t};\n}\n"]}
@@ -3,19 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /**
6
- * This type contains all browser performance properties as optional, and some
7
- * of the intersecting properties of node and browser performance as required.
6
+ * Exposes `Performance.now()` in both Node and browser environments.
8
7
  *
9
- * @internal
10
- */
11
- export type IsomorphicPerformance = Partial<Performance> & Pick<Performance, "clearMarks" | "mark" | "measure" | "now">;
12
- /**
13
- * This exported "performance" member masks the built-in globalThis.performance object
14
- * as an IsomorphicPerformance, which hides all of its features that aren't compatible
15
- * between Node and browser implementations. Anything exposed on this performance object
16
- * is considered safe to use regarless of the environment it runs in.
8
+ * @remarks
9
+ *
10
+ * The performance API is available as an attribute on the `WindowOrWorkerGlobalScope` object which `globalThis` points to.
11
+ * - The [global `performance` attribute](https://w3c.github.io/hr-time/#the-performance-attribute)
12
+ * - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)
17
13
  *
18
14
  * @internal
19
15
  */
20
- export declare const performance: IsomorphicPerformance;
16
+ export declare const performanceNow: () => number;
21
17
  //# sourceMappingURL=performanceIsomorphic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"performanceIsomorphic.d.ts","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,GACvD,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,qBAA8C,CAAC"}
1
+ {"version":3,"file":"performanceIsomorphic.d.ts","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,MAA2C,CAAC"}
@@ -4,14 +4,18 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.performance = void 0;
7
+ exports.performanceNow = void 0;
8
8
  /**
9
- * This exported "performance" member masks the built-in globalThis.performance object
10
- * as an IsomorphicPerformance, which hides all of its features that aren't compatible
11
- * between Node and browser implementations. Anything exposed on this performance object
12
- * is considered safe to use regarless of the environment it runs in.
9
+ * Exposes `Performance.now()` in both Node and browser environments.
10
+ *
11
+ * @remarks
12
+ *
13
+ * The performance API is available as an attribute on the `WindowOrWorkerGlobalScope` object which `globalThis` points to.
14
+ * - The [global `performance` attribute](https://w3c.github.io/hr-time/#the-performance-attribute)
15
+ * - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)
13
16
  *
14
17
  * @internal
15
18
  */
16
- exports.performance = globalThis.performance;
19
+ const performanceNow = () => globalThis.performance.now();
20
+ exports.performanceNow = performanceNow;
17
21
  //# sourceMappingURL=performanceIsomorphic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"performanceIsomorphic.js","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH;;;;;;;GAOG;AACU,QAAA,WAAW,GAA0B,UAAU,CAAC,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This type contains all browser performance properties as optional, and some\n * of the intersecting properties of node and browser performance as required.\n *\n * @internal\n */\nexport type IsomorphicPerformance = Partial<Performance> &\n\tPick<Performance, \"clearMarks\" | \"mark\" | \"measure\" | \"now\">;\n\n/**\n * This exported \"performance\" member masks the built-in globalThis.performance object\n * as an IsomorphicPerformance, which hides all of its features that aren't compatible\n * between Node and browser implementations. Anything exposed on this performance object\n * is considered safe to use regarless of the environment it runs in.\n *\n * @internal\n */\nexport const performance: IsomorphicPerformance = globalThis.performance;\n"]}
1
+ {"version":3,"file":"performanceIsomorphic.js","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;GAUG;AACI,MAAM,cAAc,GAAiB,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;AAAlE,QAAA,cAAc,kBAAoD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Exposes `Performance.now()` in both Node and browser environments.\n *\n * @remarks\n *\n * The performance API is available as an attribute on the `WindowOrWorkerGlobalScope` object which `globalThis` points to.\n * - The [global `performance` attribute](https://w3c.github.io/hr-time/#the-performance-attribute)\n * - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)\n *\n * @internal\n */\nexport const performanceNow: () => number = () => globalThis.performance.now();\n"]}
package/dist/trace.js CHANGED
@@ -14,7 +14,7 @@ const performanceIsomorphic_js_1 = require("./performanceIsomorphic.js");
14
14
  */
15
15
  class Trace {
16
16
  static start() {
17
- const startTick = performanceIsomorphic_js_1.performance.now();
17
+ const startTick = (0, performanceIsomorphic_js_1.performanceNow)();
18
18
  return new Trace(startTick);
19
19
  }
20
20
  constructor(startTick) {
@@ -22,7 +22,7 @@ class Trace {
22
22
  this.lastTick = startTick;
23
23
  }
24
24
  trace() {
25
- const tick = performanceIsomorphic_js_1.performance.now();
25
+ const tick = (0, performanceIsomorphic_js_1.performanceNow)();
26
26
  const event = {
27
27
  totalTimeElapsed: tick - this.startTick,
28
28
  duration: tick - this.lastTick,
package/dist/trace.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAAyD;AAEzD;;;;;GAKG;AACH,MAAa,KAAK;IACV,MAAM,CAAC,KAAK;QAClB,MAAM,SAAS,GAAG,sCAAW,CAAC,GAAG,EAAE,CAAC;QACpC,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAGD,YAAsC,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QACtD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC3B,CAAC;IAEM,KAAK;QACX,MAAM,IAAI,GAAG,sCAAW,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG;YACb,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC,SAAS;YACvC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC,QAAQ;YAC9B,IAAI;SACJ,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AArBD,sBAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"./performanceIsomorphic.js\";\n\n/**\n * Helper class for tracing performance of events\n * Time measurements are in milliseconds as a floating point with a decimal\n *\n * @internal\n */\nexport class Trace {\n\tpublic static start(): Trace {\n\t\tconst startTick = performance.now();\n\t\treturn new Trace(startTick);\n\t}\n\n\tprotected lastTick: number;\n\tprotected constructor(public readonly startTick: number) {\n\t\tthis.lastTick = startTick;\n\t}\n\n\tpublic trace(): ITraceEvent {\n\t\tconst tick = performance.now();\n\t\tconst event = {\n\t\t\ttotalTimeElapsed: tick - this.startTick,\n\t\t\tduration: tick - this.lastTick,\n\t\t\ttick,\n\t\t};\n\t\tthis.lastTick = tick;\n\t\treturn event;\n\t}\n}\n\n/**\n * Event in a performance trace including time elapsed.\n *\n * @internal\n */\nexport interface ITraceEvent {\n\t/**\n\t * Total time elapsed since the start of the Trace.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly totalTimeElapsed: number;\n\t/**\n\t * Time elapsed since the last trace event.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly duration: number;\n\t/**\n\t * This number represents a relative time which should\n\t * be consistent for all trace ticks.\n\t */\n\treadonly tick: number;\n}\n"]}
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAA4D;AAE5D;;;;;GAKG;AACH,MAAa,KAAK;IACV,MAAM,CAAC,KAAK;QAClB,MAAM,SAAS,GAAG,IAAA,yCAAc,GAAE,CAAC;QACnC,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAGD,YAAsC,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QACtD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC3B,CAAC;IAEM,KAAK;QACX,MAAM,IAAI,GAAG,IAAA,yCAAc,GAAE,CAAC;QAC9B,MAAM,KAAK,GAAG;YACb,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC,SAAS;YACvC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC,QAAQ;YAC9B,IAAI;SACJ,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AArBD,sBAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"./performanceIsomorphic.js\";\n\n/**\n * Helper class for tracing performance of events\n * Time measurements are in milliseconds as a floating point with a decimal\n *\n * @internal\n */\nexport class Trace {\n\tpublic static start(): Trace {\n\t\tconst startTick = performanceNow();\n\t\treturn new Trace(startTick);\n\t}\n\n\tprotected lastTick: number;\n\tprotected constructor(public readonly startTick: number) {\n\t\tthis.lastTick = startTick;\n\t}\n\n\tpublic trace(): ITraceEvent {\n\t\tconst tick = performanceNow();\n\t\tconst event = {\n\t\t\ttotalTimeElapsed: tick - this.startTick,\n\t\t\tduration: tick - this.lastTick,\n\t\t\ttick,\n\t\t};\n\t\tthis.lastTick = tick;\n\t\treturn event;\n\t}\n}\n\n/**\n * Event in a performance trace including time elapsed.\n *\n * @internal\n */\nexport interface ITraceEvent {\n\t/**\n\t * Total time elapsed since the start of the Trace.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly totalTimeElapsed: number;\n\t/**\n\t * Time elapsed since the last trace event.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly duration: number;\n\t/**\n\t * This number represents a relative time which should\n\t * be consistent for all trace ticks.\n\t */\n\treadonly tick: number;\n}\n"]}
@@ -4,12 +4,12 @@
4
4
  */
5
5
  export { bufferToString, isArrayBuffer, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferBrowser.js";
6
6
  export { gitHashFile, hashFile } from "./hashFileBrowser.js";
7
- export { performance } from "./performanceIsomorphic.js";
8
7
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
9
8
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
10
9
  export { EventEmitter } from "./eventEmitter.cjs";
11
- export { type IsomorphicPerformance } from "./performanceIsomorphic.js";
10
+ export { performanceNow } from "./performanceIsomorphic.js";
12
11
  export { type ITraceEvent, Trace } from "./trace.js";
13
12
  export { type EventEmitterEventType, TypedEventEmitter, type TypedEventTransform, } from "./typedEventEmitter.js";
14
13
  export { createEmitter } from "./events/index.js";
14
+ export { checkLayerCompatibility, type LayerCompatCheckResult, type ILayerCompatDetails, type IProvideLayerCompatDetails, type ILayerCompatSupportRequirements, } from "./layerCompat.js";
15
15
  //# sourceMappingURL=indexBrowser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACN,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,GACpC,MAAM,kBAAkB,CAAC"}
@@ -6,11 +6,12 @@
6
6
  // (See 'Isomorphic Code' section in the package README.md.)
7
7
  export { bufferToString, isArrayBuffer, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferBrowser.js";
8
8
  export { gitHashFile, hashFile } from "./hashFileBrowser.js";
9
- export { performance } from "./performanceIsomorphic.js";
10
9
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
11
10
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
12
11
  export { EventEmitter } from "./eventEmitter.cjs";
12
+ export { performanceNow } from "./performanceIsomorphic.js";
13
13
  export { Trace } from "./trace.js";
14
14
  export { TypedEventEmitter, } from "./typedEventEmitter.js";
15
15
  export { createEmitter } from "./events/index.js";
16
+ export { checkLayerCompatibility, } from "./layerCompat.js";
16
17
  //# sourceMappingURL=indexBrowser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexBrowser.js","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uDAAuD;AACvD,4DAA4D;AAE5D,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAoB,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAEN,iBAAiB,GAEjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for browser-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport {\n\tbufferToString,\n\tisArrayBuffer,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferBrowser.js\";\nexport { gitHashFile, hashFile } from \"./hashFileBrowser.js\";\nexport { performance } from \"./performanceIsomorphic.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingBrowser.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport { type IsomorphicPerformance } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n"]}
1
+ {"version":3,"file":"indexBrowser.js","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uDAAuD;AACvD,4DAA4D;AAE5D,OAAO,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAoB,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAEN,iBAAiB,GAEjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACN,uBAAuB,GAKvB,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for browser-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport {\n\tbufferToString,\n\tisArrayBuffer,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferBrowser.js\";\nexport { gitHashFile, hashFile } from \"./hashFileBrowser.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingBrowser.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport { performanceNow } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n\nexport {\n\tcheckLayerCompatibility,\n\ttype LayerCompatCheckResult,\n\ttype ILayerCompatDetails,\n\ttype IProvideLayerCompatDetails,\n\ttype ILayerCompatSupportRequirements,\n} from \"./layerCompat.js\";\n"]}
@@ -5,12 +5,12 @@
5
5
  export { type Buffer } from "./bufferNode.js";
6
6
  export { bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferNode.js";
7
7
  export { gitHashFile, hashFile } from "./hashFileNode.js";
8
- export { performance } from "./performanceIsomorphic.js";
9
8
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
10
9
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
11
10
  export { EventEmitter } from "./eventEmitter.cjs";
12
- export type { IsomorphicPerformance } from "./performanceIsomorphic.js";
11
+ export { performanceNow } from "./performanceIsomorphic.js";
13
12
  export { type ITraceEvent, Trace } from "./trace.js";
14
13
  export { type EventEmitterEventType, TypedEventEmitter, type TypedEventTransform, } from "./typedEventEmitter.js";
15
14
  export { createEmitter } from "./events/index.js";
15
+ export { checkLayerCompatibility, type LayerCompatCheckResult, type ILayerCompatDetails, type IProvideLayerCompatDetails, type ILayerCompatSupportRequirements, } from "./layerCompat.js";
16
16
  //# sourceMappingURL=indexNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexNode.d.ts","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,cAAc,EACd,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,4BAA4B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"indexNode.d.ts","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,cAAc,EACd,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACN,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACN,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,GACpC,MAAM,kBAAkB,CAAC"}
package/lib/indexNode.js CHANGED
@@ -4,11 +4,12 @@
4
4
  */
5
5
  export { bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferNode.js";
6
6
  export { gitHashFile, hashFile } from "./hashFileNode.js";
7
- export { performance } from "./performanceIsomorphic.js";
8
7
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
9
8
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
10
9
  export { EventEmitter } from "./eventEmitter.cjs";
10
+ export { performanceNow } from "./performanceIsomorphic.js";
11
11
  export { Trace } from "./trace.js";
12
12
  export { TypedEventEmitter, } from "./typedEventEmitter.js";
13
13
  export { createEmitter } from "./events/index.js";
14
+ export { checkLayerCompatibility, } from "./layerCompat.js";
14
15
  //# sourceMappingURL=indexNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexNode.js","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,cAAc,EACd,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,4BAA4B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAoB,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAEN,iBAAiB,GAEjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for Node.js-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport { type Buffer } from \"./bufferNode.js\";\nexport {\n\tbufferToString,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferNode.js\";\nexport { gitHashFile, hashFile } from \"./hashFileNode.js\";\nexport { performance } from \"./performanceIsomorphic.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingNode.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport type { IsomorphicPerformance } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n"]}
1
+ {"version":3,"file":"indexNode.js","sourceRoot":"","sources":["../src/indexNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,cAAc,EACd,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAoB,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAEN,iBAAiB,GAEjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACN,uBAAuB,GAKvB,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Entrypoint for Node.js-specific code in the package.\n// (See 'Isomorphic Code' section in the package README.md.)\n\nexport { type Buffer } from \"./bufferNode.js\";\nexport {\n\tbufferToString,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"./bufferNode.js\";\nexport { gitHashFile, hashFile } from \"./hashFileNode.js\";\n\nexport { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from \"./base64EncodingNode.js\";\nexport { Uint8ArrayToArrayBuffer } from \"./bufferShared.js\";\nexport { EventEmitter } from \"./eventEmitter.cjs\";\nexport { performanceNow } from \"./performanceIsomorphic.js\";\nexport { type ITraceEvent, Trace } from \"./trace.js\";\nexport {\n\ttype EventEmitterEventType,\n\tTypedEventEmitter,\n\ttype TypedEventTransform,\n} from \"./typedEventEmitter.js\";\n\nexport { createEmitter } from \"./events/index.js\";\n\nexport {\n\tcheckLayerCompatibility,\n\ttype LayerCompatCheckResult,\n\ttype ILayerCompatDetails,\n\ttype IProvideLayerCompatDetails,\n\ttype ILayerCompatSupportRequirements,\n} from \"./layerCompat.js\";\n"]}
@@ -0,0 +1,84 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Result of a layer compatibility check - whether a layer is compatible with another layer.
7
+ * @internal
8
+ */
9
+ export type LayerCompatCheckResult = {
10
+ readonly isCompatible: true;
11
+ } | {
12
+ readonly isCompatible: false;
13
+ /**
14
+ * Whether the generation of the layer is compatible with the other layer.
15
+ */
16
+ readonly isGenerationCompatible: boolean;
17
+ /**
18
+ * The features that are required by the layer but are not supported by the other layer. This will only
19
+ * be set if there are unsupported features.
20
+ */
21
+ readonly unsupportedFeatures: readonly string[] | undefined;
22
+ };
23
+ /**
24
+ * @internal
25
+ */
26
+ export declare const ILayerCompatDetails: keyof IProvideLayerCompatDetails;
27
+ /**
28
+ * @internal
29
+ */
30
+ export interface IProvideLayerCompatDetails {
31
+ readonly ILayerCompatDetails: ILayerCompatDetails;
32
+ }
33
+ /**
34
+ * This interface is used to communicate the compatibility details of a layer to another layer.
35
+ * @internal
36
+ */
37
+ export interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails> {
38
+ /**
39
+ * A list of features supported by the layer at a particular layer boundary. This is used to check if these
40
+ * set of features satisfy the requirements of another layer.
41
+ */
42
+ readonly supportedFeatures: ReadonlySet<string>;
43
+ /**
44
+ * The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies
45
+ * the minimum generation it requires to be compatible.
46
+ */
47
+ readonly generation: number;
48
+ /**
49
+ * The package version of the layer. When an incompatibility is detected, this is used to provide more context
50
+ * on what the versions of the incompatible layers are.
51
+ */
52
+ readonly pkgVersion: string;
53
+ }
54
+ /**
55
+ * This is the default compat details for a layer when it doesn't provide any compat details. This is used for
56
+ * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.
57
+ * @internal
58
+ */
59
+ export declare const defaultLayerCompatDetails: ILayerCompatDetails;
60
+ /**
61
+ * The requirements that a layer needs another layer to support for them to be compatible.
62
+ * @internal
63
+ */
64
+ export interface ILayerCompatSupportRequirements {
65
+ /**
66
+ * The minimum supported generation the other layer needs to be at.
67
+ */
68
+ readonly minSupportedGeneration: number;
69
+ /**
70
+ * The features that the other layer needs to support.
71
+ */
72
+ readonly requiredFeatures: readonly string[];
73
+ }
74
+ /**
75
+ * Checks compatibility of a layer (layer1) with another layer (layer2).
76
+ * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.
77
+ * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the
78
+ * default compatibility details are used for backwards compatibility.
79
+ * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.
80
+ *
81
+ * @internal
82
+ */
83
+ export declare function checkLayerCompatibility(compatSupportRequirementsLayer1: ILayerCompatSupportRequirements, compatDetailsLayer2: ILayerCompatDetails | undefined): LayerCompatCheckResult;
84
+ //# sourceMappingURL=layerCompat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerCompat.d.ts","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC/B;IAAE,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;CAAE,GAC/B;IACA,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,0BAAkD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC/E;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAIvC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACtC,+BAA+B,EAAE,+BAA+B,EAChE,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,GAClD,sBAAsB,CA4BxB"}
@@ -0,0 +1,52 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * @internal
7
+ */
8
+ export const ILayerCompatDetails = "ILayerCompatDetails";
9
+ /**
10
+ * This is the default compat details for a layer when it doesn't provide any compat details. This is used for
11
+ * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.
12
+ * @internal
13
+ */
14
+ export const defaultLayerCompatDetails = {
15
+ supportedFeatures: new Set(),
16
+ generation: 0, // 0 is reserved for layers before compatibility enforcement was introduced.
17
+ pkgVersion: "unknown",
18
+ };
19
+ /**
20
+ * Checks compatibility of a layer (layer1) with another layer (layer2).
21
+ * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.
22
+ * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the
23
+ * default compatibility details are used for backwards compatibility.
24
+ * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.
25
+ *
26
+ * @internal
27
+ */
28
+ export function checkLayerCompatibility(compatSupportRequirementsLayer1, compatDetailsLayer2) {
29
+ const compatDetailsLayer2ToUse = compatDetailsLayer2 ?? defaultLayerCompatDetails;
30
+ let isGenerationCompatible = true;
31
+ const unsupportedFeatures = [];
32
+ // If layer2's generation is less than the required minimum supported generation of layer1,
33
+ // then it is not compatible.
34
+ if (compatDetailsLayer2ToUse.generation <
35
+ compatSupportRequirementsLayer1.minSupportedGeneration) {
36
+ isGenerationCompatible = false;
37
+ }
38
+ // All features required by layer1 must be supported by layer2 to be compatible.
39
+ for (const feature of compatSupportRequirementsLayer1.requiredFeatures) {
40
+ if (!compatDetailsLayer2ToUse.supportedFeatures.has(feature)) {
41
+ unsupportedFeatures.push(feature);
42
+ }
43
+ }
44
+ return isGenerationCompatible && unsupportedFeatures.length === 0
45
+ ? { isCompatible: true }
46
+ : {
47
+ isCompatible: false,
48
+ isGenerationCompatible,
49
+ unsupportedFeatures: unsupportedFeatures.length > 0 ? unsupportedFeatures : undefined,
50
+ };
51
+ }
52
+ //# sourceMappingURL=layerCompat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layerCompat.js","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqC,qBAAqB,CAAC;AA+B3F;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB;IAC7D,iBAAiB,EAAE,IAAI,GAAG,EAAE;IAC5B,UAAU,EAAE,CAAC,EAAE,4EAA4E;IAC3F,UAAU,EAAE,SAAS;CACrB,CAAC;AAiBF;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACtC,+BAAgE,EAChE,mBAAoD;IAEpD,MAAM,wBAAwB,GAAG,mBAAmB,IAAI,yBAAyB,CAAC;IAClF,IAAI,sBAAsB,GAAG,IAAI,CAAC;IAClC,MAAM,mBAAmB,GAAa,EAAE,CAAC;IAEzC,2FAA2F;IAC3F,6BAA6B;IAC7B,IACC,wBAAwB,CAAC,UAAU;QACnC,+BAA+B,CAAC,sBAAsB,EACrD,CAAC;QACF,sBAAsB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,gFAAgF;IAChF,KAAK,MAAM,OAAO,IAAI,+BAA+B,CAAC,gBAAgB,EAAE,CAAC;QACxE,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IAED,OAAO,sBAAsB,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;QAChE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE;QACxB,CAAC,CAAC;YACA,YAAY,EAAE,KAAK;YACnB,sBAAsB;YACtB,mBAAmB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS;SACrF,CAAC;AACL,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Result of a layer compatibility check - whether a layer is compatible with another layer.\n * @internal\n */\nexport type LayerCompatCheckResult =\n\t| { readonly isCompatible: true }\n\t| {\n\t\t\treadonly isCompatible: false;\n\t\t\t/**\n\t\t\t * Whether the generation of the layer is compatible with the other layer.\n\t\t\t */\n\t\t\treadonly isGenerationCompatible: boolean;\n\t\t\t/**\n\t\t\t * The features that are required by the layer but are not supported by the other layer. This will only\n\t\t\t * be set if there are unsupported features.\n\t\t\t */\n\t\t\treadonly unsupportedFeatures: readonly string[] | undefined;\n\t };\n\n/**\n * @internal\n */\nexport const ILayerCompatDetails: keyof IProvideLayerCompatDetails = \"ILayerCompatDetails\";\n\n/**\n * @internal\n */\nexport interface IProvideLayerCompatDetails {\n\treadonly ILayerCompatDetails: ILayerCompatDetails;\n}\n\n/**\n * This interface is used to communicate the compatibility details of a layer to another layer.\n * @internal\n */\nexport interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails> {\n\t/**\n\t * A list of features supported by the layer at a particular layer boundary. This is used to check if these\n\t * set of features satisfy the requirements of another layer.\n\t */\n\treadonly supportedFeatures: ReadonlySet<string>;\n\t/**\n\t * The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies\n\t * the minimum generation it requires to be compatible.\n\t */\n\treadonly generation: number;\n\t/**\n\t * The package version of the layer. When an incompatibility is detected, this is used to provide more context\n\t * on what the versions of the incompatible layers are.\n\t */\n\treadonly pkgVersion: string;\n}\n\n/**\n * This is the default compat details for a layer when it doesn't provide any compat details. This is used for\n * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.\n * @internal\n */\nexport const defaultLayerCompatDetails: ILayerCompatDetails = {\n\tsupportedFeatures: new Set(),\n\tgeneration: 0, // 0 is reserved for layers before compatibility enforcement was introduced.\n\tpkgVersion: \"unknown\",\n};\n\n/**\n * The requirements that a layer needs another layer to support for them to be compatible.\n * @internal\n */\nexport interface ILayerCompatSupportRequirements {\n\t/**\n\t * The minimum supported generation the other layer needs to be at.\n\t */\n\treadonly minSupportedGeneration: number;\n\t/**\n\t * The features that the other layer needs to support.\n\t */\n\treadonly requiredFeatures: readonly string[];\n}\n\n/**\n * Checks compatibility of a layer (layer1) with another layer (layer2).\n * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.\n * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the\n * default compatibility details are used for backwards compatibility.\n * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.\n *\n * @internal\n */\nexport function checkLayerCompatibility(\n\tcompatSupportRequirementsLayer1: ILayerCompatSupportRequirements,\n\tcompatDetailsLayer2: ILayerCompatDetails | undefined,\n): LayerCompatCheckResult {\n\tconst compatDetailsLayer2ToUse = compatDetailsLayer2 ?? defaultLayerCompatDetails;\n\tlet isGenerationCompatible = true;\n\tconst unsupportedFeatures: string[] = [];\n\n\t// If layer2's generation is less than the required minimum supported generation of layer1,\n\t// then it is not compatible.\n\tif (\n\t\tcompatDetailsLayer2ToUse.generation <\n\t\tcompatSupportRequirementsLayer1.minSupportedGeneration\n\t) {\n\t\tisGenerationCompatible = false;\n\t}\n\n\t// All features required by layer1 must be supported by layer2 to be compatible.\n\tfor (const feature of compatSupportRequirementsLayer1.requiredFeatures) {\n\t\tif (!compatDetailsLayer2ToUse.supportedFeatures.has(feature)) {\n\t\t\tunsupportedFeatures.push(feature);\n\t\t}\n\t}\n\n\treturn isGenerationCompatible && unsupportedFeatures.length === 0\n\t\t? { isCompatible: true }\n\t\t: {\n\t\t\t\tisCompatible: false,\n\t\t\t\tisGenerationCompatible,\n\t\t\t\tunsupportedFeatures: unsupportedFeatures.length > 0 ? unsupportedFeatures : undefined,\n\t\t\t};\n}\n"]}
@@ -3,19 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /**
6
- * This type contains all browser performance properties as optional, and some
7
- * of the intersecting properties of node and browser performance as required.
6
+ * Exposes `Performance.now()` in both Node and browser environments.
8
7
  *
9
- * @internal
10
- */
11
- export type IsomorphicPerformance = Partial<Performance> & Pick<Performance, "clearMarks" | "mark" | "measure" | "now">;
12
- /**
13
- * This exported "performance" member masks the built-in globalThis.performance object
14
- * as an IsomorphicPerformance, which hides all of its features that aren't compatible
15
- * between Node and browser implementations. Anything exposed on this performance object
16
- * is considered safe to use regarless of the environment it runs in.
8
+ * @remarks
9
+ *
10
+ * The performance API is available as an attribute on the `WindowOrWorkerGlobalScope` object which `globalThis` points to.
11
+ * - The [global `performance` attribute](https://w3c.github.io/hr-time/#the-performance-attribute)
12
+ * - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)
17
13
  *
18
14
  * @internal
19
15
  */
20
- export declare const performance: IsomorphicPerformance;
16
+ export declare const performanceNow: () => number;
21
17
  //# sourceMappingURL=performanceIsomorphic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"performanceIsomorphic.d.ts","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,GACvD,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,qBAA8C,CAAC"}
1
+ {"version":3,"file":"performanceIsomorphic.d.ts","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,MAA2C,CAAC"}
@@ -3,12 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /**
6
- * This exported "performance" member masks the built-in globalThis.performance object
7
- * as an IsomorphicPerformance, which hides all of its features that aren't compatible
8
- * between Node and browser implementations. Anything exposed on this performance object
9
- * is considered safe to use regarless of the environment it runs in.
6
+ * Exposes `Performance.now()` in both Node and browser environments.
7
+ *
8
+ * @remarks
9
+ *
10
+ * The performance API is available as an attribute on the `WindowOrWorkerGlobalScope` object which `globalThis` points to.
11
+ * - The [global `performance` attribute](https://w3c.github.io/hr-time/#the-performance-attribute)
12
+ * - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)
10
13
  *
11
14
  * @internal
12
15
  */
13
- export const performance = globalThis.performance;
16
+ export const performanceNow = () => globalThis.performance.now();
14
17
  //# sourceMappingURL=performanceIsomorphic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"performanceIsomorphic.js","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAA0B,UAAU,CAAC,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This type contains all browser performance properties as optional, and some\n * of the intersecting properties of node and browser performance as required.\n *\n * @internal\n */\nexport type IsomorphicPerformance = Partial<Performance> &\n\tPick<Performance, \"clearMarks\" | \"mark\" | \"measure\" | \"now\">;\n\n/**\n * This exported \"performance\" member masks the built-in globalThis.performance object\n * as an IsomorphicPerformance, which hides all of its features that aren't compatible\n * between Node and browser implementations. Anything exposed on this performance object\n * is considered safe to use regarless of the environment it runs in.\n *\n * @internal\n */\nexport const performance: IsomorphicPerformance = globalThis.performance;\n"]}
1
+ {"version":3,"file":"performanceIsomorphic.js","sourceRoot":"","sources":["../src/performanceIsomorphic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAiB,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Exposes `Performance.now()` in both Node and browser environments.\n *\n * @remarks\n *\n * The performance API is available as an attribute on the `WindowOrWorkerGlobalScope` object which `globalThis` points to.\n * - The [global `performance` attribute](https://w3c.github.io/hr-time/#the-performance-attribute)\n * - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)\n *\n * @internal\n */\nexport const performanceNow: () => number = () => globalThis.performance.now();\n"]}
package/lib/trace.js CHANGED
@@ -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 { performance } from "./performanceIsomorphic.js";
5
+ import { performanceNow } from "./performanceIsomorphic.js";
6
6
  /**
7
7
  * Helper class for tracing performance of events
8
8
  * Time measurements are in milliseconds as a floating point with a decimal
@@ -11,7 +11,7 @@ import { performance } from "./performanceIsomorphic.js";
11
11
  */
12
12
  export class Trace {
13
13
  static start() {
14
- const startTick = performance.now();
14
+ const startTick = performanceNow();
15
15
  return new Trace(startTick);
16
16
  }
17
17
  constructor(startTick) {
@@ -19,7 +19,7 @@ export class Trace {
19
19
  this.lastTick = startTick;
20
20
  }
21
21
  trace() {
22
- const tick = performance.now();
22
+ const tick = performanceNow();
23
23
  const event = {
24
24
  totalTimeElapsed: tick - this.startTick,
25
25
  duration: tick - this.lastTick,
package/lib/trace.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,OAAO,KAAK;IACV,MAAM,CAAC,KAAK;QAClB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QACpC,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAGD,YAAsC,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QACtD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC3B,CAAC;IAEM,KAAK;QACX,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG;YACb,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC,SAAS;YACvC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC,QAAQ;YAC9B,IAAI;SACJ,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"./performanceIsomorphic.js\";\n\n/**\n * Helper class for tracing performance of events\n * Time measurements are in milliseconds as a floating point with a decimal\n *\n * @internal\n */\nexport class Trace {\n\tpublic static start(): Trace {\n\t\tconst startTick = performance.now();\n\t\treturn new Trace(startTick);\n\t}\n\n\tprotected lastTick: number;\n\tprotected constructor(public readonly startTick: number) {\n\t\tthis.lastTick = startTick;\n\t}\n\n\tpublic trace(): ITraceEvent {\n\t\tconst tick = performance.now();\n\t\tconst event = {\n\t\t\ttotalTimeElapsed: tick - this.startTick,\n\t\t\tduration: tick - this.lastTick,\n\t\t\ttick,\n\t\t};\n\t\tthis.lastTick = tick;\n\t\treturn event;\n\t}\n}\n\n/**\n * Event in a performance trace including time elapsed.\n *\n * @internal\n */\nexport interface ITraceEvent {\n\t/**\n\t * Total time elapsed since the start of the Trace.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly totalTimeElapsed: number;\n\t/**\n\t * Time elapsed since the last trace event.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly duration: number;\n\t/**\n\t * This number represents a relative time which should\n\t * be consistent for all trace ticks.\n\t */\n\treadonly tick: number;\n}\n"]}
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,OAAO,KAAK;IACV,MAAM,CAAC,KAAK;QAClB,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;QACnC,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAGD,YAAsC,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;QACtD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC3B,CAAC;IAEM,KAAK;QACX,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG;YACb,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC,SAAS;YACvC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC,QAAQ;YAC9B,IAAI;SACJ,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"./performanceIsomorphic.js\";\n\n/**\n * Helper class for tracing performance of events\n * Time measurements are in milliseconds as a floating point with a decimal\n *\n * @internal\n */\nexport class Trace {\n\tpublic static start(): Trace {\n\t\tconst startTick = performanceNow();\n\t\treturn new Trace(startTick);\n\t}\n\n\tprotected lastTick: number;\n\tprotected constructor(public readonly startTick: number) {\n\t\tthis.lastTick = startTick;\n\t}\n\n\tpublic trace(): ITraceEvent {\n\t\tconst tick = performanceNow();\n\t\tconst event = {\n\t\t\ttotalTimeElapsed: tick - this.startTick,\n\t\t\tduration: tick - this.lastTick,\n\t\t\ttick,\n\t\t};\n\t\tthis.lastTick = tick;\n\t\treturn event;\n\t}\n}\n\n/**\n * Event in a performance trace including time elapsed.\n *\n * @internal\n */\nexport interface ITraceEvent {\n\t/**\n\t * Total time elapsed since the start of the Trace.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly totalTimeElapsed: number;\n\t/**\n\t * Time elapsed since the last trace event.\n\t * Measured in milliseconds as a floating point with a decimal\n\t */\n\treadonly duration: number;\n\t/**\n\t * This number represents a relative time which should\n\t * be consistent for all trace ticks.\n\t */\n\treadonly tick: number;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-internal/client-utils",
3
- "version": "2.20.0",
3
+ "version": "2.22.0",
4
4
  "description": "Not intended for use outside the Fluid Framework.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,8 +69,8 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluidframework/core-interfaces": "~2.20.0",
73
- "@fluidframework/core-utils": "~2.20.0",
72
+ "@fluidframework/core-interfaces": "~2.22.0",
73
+ "@fluidframework/core-utils": "~2.22.0",
74
74
  "@types/events_pkg": "npm:@types/events@^3.0.0",
75
75
  "base64-js": "^1.5.1",
76
76
  "buffer": "^6.0.3",
@@ -80,16 +80,16 @@
80
80
  "devDependencies": {
81
81
  "@arethetypeswrong/cli": "^0.17.1",
82
82
  "@biomejs/biome": "~1.9.3",
83
- "@fluid-internal/client-utils-previous": "npm:@fluid-internal/client-utils@2.13.0",
84
- "@fluid-internal/mocha-test-setup": "~2.20.0",
83
+ "@fluid-internal/client-utils-previous": "npm:@fluid-internal/client-utils@2.21.0",
84
+ "@fluid-internal/mocha-test-setup": "~2.22.0",
85
85
  "@fluid-tools/build-cli": "^0.51.0",
86
86
  "@fluidframework/build-common": "^2.0.3",
87
87
  "@fluidframework/build-tools": "^0.51.0",
88
- "@fluidframework/eslint-config-fluid": "^5.6.0",
88
+ "@fluidframework/eslint-config-fluid": "^5.7.3",
89
89
  "@microsoft/api-extractor": "7.47.8",
90
90
  "@types/base64-js": "^1.3.0",
91
91
  "@types/jest": "29.5.3",
92
- "@types/jest-environment-puppeteer": "~2.20.0",
92
+ "@types/jest-environment-puppeteer": "~2.22.0",
93
93
  "@types/mocha": "^10.0.10",
94
94
  "@types/node": "^18.19.0",
95
95
  "@types/rewire": "^2.5.28",
@@ -103,7 +103,7 @@
103
103
  "eslint-config-prettier": "~9.0.0",
104
104
  "jest": "^29.6.2",
105
105
  "jest-environment-puppeteer": "^10.1.3",
106
- "jest-junit": "^10.0.0",
106
+ "jest-junit": "^16.0.0",
107
107
  "jest-puppeteer": "^10.1.3",
108
108
  "mocha": "^10.2.0",
109
109
  "mocha-multi-reporters": "^1.5.1",
@@ -239,10 +239,10 @@
239
239
  "lint:fix": "fluid-build . --task eslint:fix --task format",
240
240
  "test": "npm run test:mocha && npm run test:jest",
241
241
  "test:coverage": "c8 npm test",
242
- "test:jest": "jest",
242
+ "test:jest": "jest --ci",
243
243
  "test:mocha": "npm run test:mocha:esm && npm run test:mocha:cjs",
244
- "test:mocha:cjs": "mocha --recursive \"dist/test/mocha/**/*.spec.*js\" --exit",
245
- "test:mocha:esm": "mocha --recursive \"lib/test/mocha/**/*.spec.*js\" --exit",
244
+ "test:mocha:cjs": "mocha --recursive \"dist/test/mocha/**/*.spec.*js\"",
245
+ "test:mocha:esm": "mocha --recursive \"lib/test/mocha/**/*.spec.*js\"",
246
246
  "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
247
247
  "typetests:gen": "flub generate typetests --dir . -v",
248
248
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
@@ -14,12 +14,11 @@ export {
14
14
  Uint8ArrayToString,
15
15
  } from "./bufferBrowser.js";
16
16
  export { gitHashFile, hashFile } from "./hashFileBrowser.js";
17
- export { performance } from "./performanceIsomorphic.js";
18
17
 
19
18
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
20
19
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
21
20
  export { EventEmitter } from "./eventEmitter.cjs";
22
- export { type IsomorphicPerformance } from "./performanceIsomorphic.js";
21
+ export { performanceNow } from "./performanceIsomorphic.js";
23
22
  export { type ITraceEvent, Trace } from "./trace.js";
24
23
  export {
25
24
  type EventEmitterEventType,
@@ -28,3 +27,11 @@ export {
28
27
  } from "./typedEventEmitter.js";
29
28
 
30
29
  export { createEmitter } from "./events/index.js";
30
+
31
+ export {
32
+ checkLayerCompatibility,
33
+ type LayerCompatCheckResult,
34
+ type ILayerCompatDetails,
35
+ type IProvideLayerCompatDetails,
36
+ type ILayerCompatSupportRequirements,
37
+ } from "./layerCompat.js";
package/src/indexNode.ts CHANGED
@@ -14,12 +14,11 @@ export {
14
14
  Uint8ArrayToString,
15
15
  } from "./bufferNode.js";
16
16
  export { gitHashFile, hashFile } from "./hashFileNode.js";
17
- export { performance } from "./performanceIsomorphic.js";
18
17
 
19
18
  export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
20
19
  export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";
21
20
  export { EventEmitter } from "./eventEmitter.cjs";
22
- export type { IsomorphicPerformance } from "./performanceIsomorphic.js";
21
+ export { performanceNow } from "./performanceIsomorphic.js";
23
22
  export { type ITraceEvent, Trace } from "./trace.js";
24
23
  export {
25
24
  type EventEmitterEventType,
@@ -28,3 +27,11 @@ export {
28
27
  } from "./typedEventEmitter.js";
29
28
 
30
29
  export { createEmitter } from "./events/index.js";
30
+
31
+ export {
32
+ checkLayerCompatibility,
33
+ type LayerCompatCheckResult,
34
+ type ILayerCompatDetails,
35
+ type IProvideLayerCompatDetails,
36
+ type ILayerCompatSupportRequirements,
37
+ } from "./layerCompat.js";
@@ -0,0 +1,125 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Result of a layer compatibility check - whether a layer is compatible with another layer.
8
+ * @internal
9
+ */
10
+ export type LayerCompatCheckResult =
11
+ | { readonly isCompatible: true }
12
+ | {
13
+ readonly isCompatible: false;
14
+ /**
15
+ * Whether the generation of the layer is compatible with the other layer.
16
+ */
17
+ readonly isGenerationCompatible: boolean;
18
+ /**
19
+ * The features that are required by the layer but are not supported by the other layer. This will only
20
+ * be set if there are unsupported features.
21
+ */
22
+ readonly unsupportedFeatures: readonly string[] | undefined;
23
+ };
24
+
25
+ /**
26
+ * @internal
27
+ */
28
+ export const ILayerCompatDetails: keyof IProvideLayerCompatDetails = "ILayerCompatDetails";
29
+
30
+ /**
31
+ * @internal
32
+ */
33
+ export interface IProvideLayerCompatDetails {
34
+ readonly ILayerCompatDetails: ILayerCompatDetails;
35
+ }
36
+
37
+ /**
38
+ * This interface is used to communicate the compatibility details of a layer to another layer.
39
+ * @internal
40
+ */
41
+ export interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails> {
42
+ /**
43
+ * A list of features supported by the layer at a particular layer boundary. This is used to check if these
44
+ * set of features satisfy the requirements of another layer.
45
+ */
46
+ readonly supportedFeatures: ReadonlySet<string>;
47
+ /**
48
+ * The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies
49
+ * the minimum generation it requires to be compatible.
50
+ */
51
+ readonly generation: number;
52
+ /**
53
+ * The package version of the layer. When an incompatibility is detected, this is used to provide more context
54
+ * on what the versions of the incompatible layers are.
55
+ */
56
+ readonly pkgVersion: string;
57
+ }
58
+
59
+ /**
60
+ * This is the default compat details for a layer when it doesn't provide any compat details. This is used for
61
+ * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.
62
+ * @internal
63
+ */
64
+ export const defaultLayerCompatDetails: ILayerCompatDetails = {
65
+ supportedFeatures: new Set(),
66
+ generation: 0, // 0 is reserved for layers before compatibility enforcement was introduced.
67
+ pkgVersion: "unknown",
68
+ };
69
+
70
+ /**
71
+ * The requirements that a layer needs another layer to support for them to be compatible.
72
+ * @internal
73
+ */
74
+ export interface ILayerCompatSupportRequirements {
75
+ /**
76
+ * The minimum supported generation the other layer needs to be at.
77
+ */
78
+ readonly minSupportedGeneration: number;
79
+ /**
80
+ * The features that the other layer needs to support.
81
+ */
82
+ readonly requiredFeatures: readonly string[];
83
+ }
84
+
85
+ /**
86
+ * Checks compatibility of a layer (layer1) with another layer (layer2).
87
+ * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.
88
+ * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the
89
+ * default compatibility details are used for backwards compatibility.
90
+ * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.
91
+ *
92
+ * @internal
93
+ */
94
+ export function checkLayerCompatibility(
95
+ compatSupportRequirementsLayer1: ILayerCompatSupportRequirements,
96
+ compatDetailsLayer2: ILayerCompatDetails | undefined,
97
+ ): LayerCompatCheckResult {
98
+ const compatDetailsLayer2ToUse = compatDetailsLayer2 ?? defaultLayerCompatDetails;
99
+ let isGenerationCompatible = true;
100
+ const unsupportedFeatures: string[] = [];
101
+
102
+ // If layer2's generation is less than the required minimum supported generation of layer1,
103
+ // then it is not compatible.
104
+ if (
105
+ compatDetailsLayer2ToUse.generation <
106
+ compatSupportRequirementsLayer1.minSupportedGeneration
107
+ ) {
108
+ isGenerationCompatible = false;
109
+ }
110
+
111
+ // All features required by layer1 must be supported by layer2 to be compatible.
112
+ for (const feature of compatSupportRequirementsLayer1.requiredFeatures) {
113
+ if (!compatDetailsLayer2ToUse.supportedFeatures.has(feature)) {
114
+ unsupportedFeatures.push(feature);
115
+ }
116
+ }
117
+
118
+ return isGenerationCompatible && unsupportedFeatures.length === 0
119
+ ? { isCompatible: true }
120
+ : {
121
+ isCompatible: false,
122
+ isGenerationCompatible,
123
+ unsupportedFeatures: unsupportedFeatures.length > 0 ? unsupportedFeatures : undefined,
124
+ };
125
+ }
@@ -4,20 +4,14 @@
4
4
  */
5
5
 
6
6
  /**
7
- * This type contains all browser performance properties as optional, and some
8
- * of the intersecting properties of node and browser performance as required.
7
+ * Exposes `Performance.now()` in both Node and browser environments.
9
8
  *
10
- * @internal
11
- */
12
- export type IsomorphicPerformance = Partial<Performance> &
13
- Pick<Performance, "clearMarks" | "mark" | "measure" | "now">;
14
-
15
- /**
16
- * This exported "performance" member masks the built-in globalThis.performance object
17
- * as an IsomorphicPerformance, which hides all of its features that aren't compatible
18
- * between Node and browser implementations. Anything exposed on this performance object
19
- * is considered safe to use regarless of the environment it runs in.
9
+ * @remarks
10
+ *
11
+ * The performance API is available as an attribute on the `WindowOrWorkerGlobalScope` object which `globalThis` points to.
12
+ * - The [global `performance` attribute](https://w3c.github.io/hr-time/#the-performance-attribute)
13
+ * - [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis)
20
14
  *
21
15
  * @internal
22
16
  */
23
- export const performance: IsomorphicPerformance = globalThis.performance;
17
+ export const performanceNow: () => number = () => globalThis.performance.now();
package/src/trace.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { performance } from "./performanceIsomorphic.js";
6
+ import { performanceNow } from "./performanceIsomorphic.js";
7
7
 
8
8
  /**
9
9
  * Helper class for tracing performance of events
@@ -13,7 +13,7 @@ import { performance } from "./performanceIsomorphic.js";
13
13
  */
14
14
  export class Trace {
15
15
  public static start(): Trace {
16
- const startTick = performance.now();
16
+ const startTick = performanceNow();
17
17
  return new Trace(startTick);
18
18
  }
19
19
 
@@ -23,7 +23,7 @@ export class Trace {
23
23
  }
24
24
 
25
25
  public trace(): ITraceEvent {
26
- const tick = performance.now();
26
+ const tick = performanceNow();
27
27
  const event = {
28
28
  totalTimeElapsed: tick - this.startTick,
29
29
  duration: tick - this.lastTick,