diff --git a/jex/build-browser.js b/jex/build-browser.js index bf15c828..d1944a7b 100644 --- a/jex/build-browser.js +++ b/jex/build-browser.js @@ -8,6 +8,7 @@ esbuild platform: 'browser', format: 'esm', outfile: 'dist/index.mjs', + inject: ['shims.js'], plugins: [polyfillNode()] }) .catch(() => process.exit(1)) diff --git a/jex/package.json b/jex/package.json index b6363835..195c94a7 100644 --- a/jex/package.json +++ b/jex/package.json @@ -1,6 +1,6 @@ { "name": "@bpinternal/jex", - "version": "1.2.0", + "version": "1.2.1", "description": "JSON-Extends; JSON Schema type checking library", "main": "dist/index.cjs", "module": "./dist/index.mjs", @@ -26,6 +26,7 @@ "@types/lodash": "^4.14.202", "@vitest/browser": "^2.1.8", "ajv": "^8.12.0", + "buffer": "^6.0.3", "esbuild": "^0.24.0", "esbuild-plugin-polyfill-node": "^0.3.0", "playwright": "^1.49.0", diff --git a/jex/pnpm-lock.yaml b/jex/pnpm-lock.yaml index c30b3019..c1b9e18a 100644 --- a/jex/pnpm-lock.yaml +++ b/jex/pnpm-lock.yaml @@ -28,6 +28,9 @@ devDependencies: ajv: specifier: ^8.12.0 version: 8.17.1 + buffer: + specifier: ^6.0.3 + version: 6.0.3 esbuild: specifier: ^0.24.0 version: 0.24.0 @@ -1010,6 +1013,17 @@ packages: engines: {node: '>=12'} dev: true + /base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + dev: true + + /buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: true + /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -1264,6 +1278,10 @@ packages: resolution: {integrity: sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==} dev: true + /ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + dev: true + /import-meta-resolve@3.1.1: resolution: {integrity: sha512-qeywsE/KC3w9Fd2ORrRDUw6nS/nLwZpXgfrOc2IILvZYnCaEMd+D56Vfg9k4G29gIeVi3XKql1RQatME8iYsiw==} dev: true diff --git a/jex/shims.js b/jex/shims.js new file mode 100644 index 00000000..46780c72 --- /dev/null +++ b/jex/shims.js @@ -0,0 +1,6 @@ +import { Buffer } from 'buffer' + +// Ensure Buffer is available globally +if (typeof globalThis.Buffer === 'undefined') { + globalThis.Buffer = Buffer +}