Skip to content

Commit

Permalink
Revert "update how buffer is polyfilled to match approach taken by ot…
Browse files Browse the repository at this point in the history
…her packages in this repo"

This reverts commit e886df7.
  • Loading branch information
mistermoe committed Oct 13, 2023
1 parent ea581ae commit e57a79a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/dids/build/buffer-polyfill.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { Buffer } = require('buffer');
global.Buffer = Buffer;
18 changes: 1 addition & 17 deletions packages/dids/build/esbuild-browser-config.cjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const polyfillProviderPlugin = require('node-stdlib-browser/helpers/esbuild/plugin');
const stdLibBrowser = require('node-stdlib-browser');

const requiredPolyfills = new Set(['buffer']);

// populate object containing lib -> polyfill path
const polyfills = {};
for (let lib in stdLibBrowser) {
if (requiredPolyfills.has(lib)) {
const polyfill = stdLibBrowser[lib];
polyfills[lib] = polyfill;
}
}

/** @type {import('esbuild').BuildOptions} */
module.exports = {
entryPoints : ['./src/index.ts'],
Expand All @@ -22,8 +7,7 @@ module.exports = {
minify : true,
platform : 'browser',
target : ['chrome101', 'firefox108', 'safari16'],
inject : [require.resolve('node-stdlib-browser/helpers/esbuild/shim')],
plugins : [polyfillProviderPlugin(polyfills)],
inject : ['./build/buffer-polyfill.cjs'],
define : {
'global': 'globalThis',
},
Expand Down
1 change: 0 additions & 1 deletion packages/dids/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"eslint": "8.47.0",
"karma": "6.4.1",
"mocha": "10.2.0",
"node-stdlib-browser": "1.2.0",
"rimraf": "4.4.0",
"sinon": "15.0.2",
"typescript": "5.1.6"
Expand Down

0 comments on commit e57a79a

Please sign in to comment.