Skip to content

Commit

Permalink
Update to point browsers to the right entry from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Feb 12, 2021
1 parent 377caa3 commit 61eb319
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
1 change: 1 addition & 0 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports.Decoder = exports.Unpackr
exports.addExtension = require('./pack').addExtension
let packr = new exports.Packr({ useRecords: false })
exports.unpack = packr.unpack
exports.unpackMultiple = packr.unpackMultiple
exports.pack = packr.pack
exports.decode = packr.unpack
exports.encode = packr.pack
Expand Down
22 changes: 22 additions & 0 deletions browser.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import packModule from './pack.js'
import unpackModule from './unpack.js'
import { createRequire } from 'module'

export const Packr = packModule.Packr
export const addExtension = packModule.addExtension
export const Encoder = packModule.Packr
export const Unpackr = unpackModule.Unpackr
export const Decoder = unpackModule.Unpackr
export const C1 = unpackModule.C1
let packr = new packModule.Packr({ useRecords: false })
export const unpack = packr.unpack
export const unpackMultiple = packr.unpackMultiple
export const pack = packr.pack
export const decode = packr.unpack
export const encode = packr.pack
export const useRecords = false
export const mapsAsObjects = true
export const FLOAT32_OPTIONS = unpackModule.FLOAT32_OPTIONS
export const ALWAYS = 1
export const DECIMAL_ROUND = 3
export const DECIMAL_FIT = 4
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "msgpackr",
"author": "Kris Zyp",
"version": "1.2.4",
"version": "1.2.5",
"description": "Ultra-fast MessagePack implementation with extensions for records and structured cloning",
"license": "MIT",
"types": "./index.d.ts",
Expand All @@ -25,8 +25,14 @@
"main": "./index.js",
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.js"
"node": {
"import": "./index.mjs",
"require": "./index.js"
},
"default": {
"import": "./browser.mjs",
"require": "./browser.js"
}
},
"./pack": {
"node": {
Expand Down

0 comments on commit 61eb319

Please sign in to comment.