New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fluid-internal/client-utils

Package Overview
Dependencies
Maintainers
3
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluid-internal/client-utils - npm Package Compare versions

Comparing version 2.0.0-rc.4.0.4 to 2.0.0-rc.4.0.5

dist/base64EncodingBrowser.d.ts

1

dist/hashFileBrowser.js

@@ -32,2 +32,3 @@ "use strict";

const base64js = __importStar(require("base64-js"));
// Note: See 'Isomorphic Code' section in the package README.md
const bufferBrowser_js_1 = require("./bufferBrowser.js");

@@ -34,0 +35,0 @@ async function digestBuffer(file, algorithm) {

2

dist/indexBrowser.d.ts

@@ -8,3 +8,3 @@ /*!

export { performance } from "./performanceIsomorphic.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -11,0 +11,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -8,2 +8,4 @@ "use strict";

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;
// Entrypoint for browser-specific code in the package.
// (See 'Isomorphic Code' section in the package README.md.)
var bufferBrowser_js_1 = require("./bufferBrowser.js");

@@ -20,6 +22,6 @@ Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return bufferBrowser_js_1.bufferToString; } });

Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_js_1.performance; } });
var base64Encoding_js_1 = require("./base64Encoding.js");
Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64Encoding_js_1.fromBase64ToUtf8; } });
Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64Encoding_js_1.fromUtf8ToBase64; } });
Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64Encoding_js_1.toUtf8; } });
var base64EncodingBrowser_js_1 = require("./base64EncodingBrowser.js");
Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64EncodingBrowser_js_1.fromBase64ToUtf8; } });
Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64EncodingBrowser_js_1.fromUtf8ToBase64; } });
Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64EncodingBrowser_js_1.toUtf8; } });
var bufferShared_js_1 = require("./bufferShared.js");

@@ -26,0 +28,0 @@ Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_js_1.Uint8ArrayToArrayBuffer; } });

@@ -9,3 +9,3 @@ /*!

export { performance } from "./performanceIsomorphic.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -12,0 +12,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -18,6 +18,6 @@ "use strict";

Object.defineProperty(exports, "performance", { enumerable: true, get: function () { return performanceIsomorphic_js_1.performance; } });
var base64Encoding_js_1 = require("./base64Encoding.js");
Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64Encoding_js_1.fromBase64ToUtf8; } });
Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64Encoding_js_1.fromUtf8ToBase64; } });
Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64Encoding_js_1.toUtf8; } });
var base64EncodingNode_js_1 = require("./base64EncodingNode.js");
Object.defineProperty(exports, "fromBase64ToUtf8", { enumerable: true, get: function () { return base64EncodingNode_js_1.fromBase64ToUtf8; } });
Object.defineProperty(exports, "fromUtf8ToBase64", { enumerable: true, get: function () { return base64EncodingNode_js_1.fromUtf8ToBase64; } });
Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function () { return base64EncodingNode_js_1.toUtf8; } });
var bufferShared_js_1 = require("./bufferShared.js");

@@ -24,0 +24,0 @@ Object.defineProperty(exports, "Uint8ArrayToArrayBuffer", { enumerable: true, get: function () { return bufferShared_js_1.Uint8ArrayToArrayBuffer; } });

{
"type": "commonjs",
"browser": {
"./indexNode.js": "./indexBrowser.js",
"./indexNode.d.ts": "./indexBrowser.d.ts"
}
"type": "commonjs"
}

@@ -8,3 +8,3 @@ "use strict";

exports.Trace = void 0;
const indexNode_js_1 = require("./indexNode.js");
const performanceIsomorphic_js_1 = require("./performanceIsomorphic.js");
/**

@@ -18,3 +18,3 @@ * Helper class for tracing performance of events

static start() {
const startTick = indexNode_js_1.performance.now();
const startTick = performanceIsomorphic_js_1.performance.now();
return new Trace(startTick);

@@ -27,3 +27,3 @@ }

trace() {
const tick = indexNode_js_1.performance.now();
const tick = performanceIsomorphic_js_1.performance.now();
const event = {

@@ -30,0 +30,0 @@ totalTimeElapsed: tick - this.startTick,

@@ -6,2 +6,3 @@ /*!

import * as base64js from "base64-js";
// Note: See 'Isomorphic Code' section in the package README.md
import { IsoBuffer } from "./bufferBrowser.js";

@@ -8,0 +9,0 @@ async function digestBuffer(file, algorithm) {

@@ -8,3 +8,3 @@ /*!

export { performance } from "./performanceIsomorphic.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -11,0 +11,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -5,6 +5,8 @@ /*!

*/
// Entrypoint for browser-specific code in the package.
// (See 'Isomorphic Code' section in the package README.md.)
export { bufferToString, isArrayBuffer, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "./bufferBrowser.js";
export { gitHashFile, hashFile } from "./hashFileBrowser.js";
export { performance } from "./performanceIsomorphic.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -11,0 +13,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -9,3 +9,3 @@ /*!

export { performance } from "./performanceIsomorphic.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -12,0 +12,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -8,3 +8,3 @@ /*!

export { performance } from "./performanceIsomorphic.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -11,0 +11,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -5,3 +5,3 @@ /*!

*/
import { performance } from "./indexNode.js";
import { performance } from "./performanceIsomorphic.js";
/**

@@ -8,0 +8,0 @@ * Helper class for tracing performance of events

{
"name": "@fluid-internal/client-utils",
"version": "2.0.0-rc.4.0.4",
"version": "2.0.0-rc.4.0.5",
"description": "Not intended for use outside the Fluid Framework.",

@@ -37,28 +37,6 @@ "homepage": "https://fluidframework.com",

}
},
"./bufferBrowser.js": {
"node": {
"import": {
"types": "./lib/bufferNode.d.ts",
"default": "./lib/bufferNode.js"
},
"require": {
"types": "./dist/bufferNode.d.ts",
"default": "./dist/bufferNode.js"
}
},
"default": {
"import": {
"types": "./lib/bufferBrowser.d.ts",
"default": "./lib/bufferBrowser.js"
},
"require": {
"types": "./dist/bufferBrowser.d.ts",
"default": "./dist/bufferBrowser.js"
}
}
}
},
"main": "lib/indexNode.js",
"types": "lib/indexNode.d.ts",
"main": "lib/indexBrowser.js",
"types": "lib/indexBrowser.d.ts",
"c8": {

@@ -85,4 +63,4 @@ "all": true,

"dependencies": {
"@fluidframework/core-interfaces": ">=2.0.0-rc.4.0.4 <2.0.0-rc.4.1.0",
"@fluidframework/core-utils": ">=2.0.0-rc.4.0.4 <2.0.0-rc.4.1.0",
"@fluidframework/core-interfaces": ">=2.0.0-rc.4.0.5 <2.0.0-rc.4.1.0",
"@fluidframework/core-utils": ">=2.0.0-rc.4.0.5 <2.0.0-rc.4.1.0",
"@types/events_pkg": "npm:@types/events@^3.0.0",

@@ -99,3 +77,3 @@ "base64-js": "^1.5.1",

"@fluid-internal/client-utils-previous": "npm:@fluid-internal/client-utils@2.0.0-rc.3.0.0",
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.4.0.4 <2.0.0-rc.4.1.0",
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.4.0.5 <2.0.0-rc.4.1.0",
"@fluid-tools/build-cli": "^0.38.0",

@@ -108,3 +86,3 @@ "@fluidframework/build-common": "^2.0.3",

"@types/jest": "29.5.3",
"@types/jest-environment-puppeteer": ">=2.0.0-rc.4.0.4 <2.0.0-rc.4.1.0",
"@types/jest-environment-puppeteer": ">=2.0.0-rc.4.0.5 <2.0.0-rc.4.1.0",
"@types/mocha": "^9.1.1",

@@ -193,3 +171,3 @@ "@types/node": "^18.19.0",

"test:mocha:esm": "mocha --recursive \"lib/test/mocha/**/*.spec.*js\" --exit -r node_modules/@fluid-internal/mocha-test-setup",
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ./src/cjs/package.json ./dist",
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
"typetests:gen": "flub generate typetests --dir . -v --level public",

@@ -196,0 +174,0 @@ "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"

@@ -39,2 +39,25 @@ # @fluid-internal/client-utils

## Isomorphic Code
One of the primary reasons for this package's existence is to provide isomorphic implementations of
Buffer and related utilities that work in both browser and Node.js environments.
Our general strategy for this is as follows:
- We use the export map in package.json to provide different entrypoints for browser (indexBrowser.js)
vs. Node.js (indexNode.js).
- Because the browser ecosystem is more complex (bunders, etc.), we improve our odds of success by making
the browser the default. Only Node.js relies on remapping via the export map.
- We further simplify things by only using the export map to resolve the initial entrypoint. We do not
rely on export maps to remap imports within the module. (Basically, the browser / node.js specific
implementations fork at the entrypoint and from that point on explicitly import browser or node
specific files.)
One thing it is important to be aware of is that our CJS support relies on copying a stub package.json
file to dist/package.json to set the module type to commonjs. When resolving internal imports for CJS
packages, module resolution will walk up from the \*.js file and discover this stub package.json. Because
the stub package.json lacks an export map, internal imports will not be remapped.
<!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->

@@ -41,0 +64,0 @@

@@ -8,2 +8,3 @@ /*!

// Note: See 'Isomorphic Code' section in the package README.md
import { IsoBuffer } from "./bufferBrowser.js";

@@ -10,0 +11,0 @@

@@ -8,2 +8,3 @@ /*!

// Note: See 'Isomorphic Code' section in the package README.md
import type { IsoBuffer } from "./bufferNode.js";

@@ -10,0 +11,0 @@

@@ -6,2 +6,5 @@ /*!

// Entrypoint for browser-specific code in the package.
// (See 'Isomorphic Code' section in the package README.md.)
export {

@@ -17,3 +20,3 @@ bufferToString,

export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -20,0 +23,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -6,2 +6,5 @@ /*!

// Entrypoint for Node.js-specific code in the package.
// (See 'Isomorphic Code' section in the package README.md.)
export { type Buffer } from "./bufferNode.js";

@@ -12,3 +15,3 @@ export { bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString } from "./bufferNode.js";

export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64Encoding.js";
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
export { Uint8ArrayToArrayBuffer } from "./bufferShared.js";

@@ -15,0 +18,0 @@ export { EventEmitter } from "./eventEmitter.cjs";

@@ -6,3 +6,3 @@ /*!

import { performance } from "./indexNode.js";
import { performance } from "./performanceIsomorphic.js";

@@ -9,0 +9,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc