From 734422642a7e29438633a4917091151de9fc06bf Mon Sep 17 00:00:00 2001 From: LJNeon Date: Sat, 4 Jul 2020 23:00:29 -0700 Subject: [PATCH 1/2] feat(esm): add initial support --- package.json | 12 +++++++++++- toml-esm.mjs | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 toml-esm.mjs diff --git a/package.json b/package.json index e593536..975d3bf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,17 @@ { "name": "@iarna/toml", "version": "3.0.0", - "main": "toml.js", + "main": "./toml.js", + "exports": { + ".": [ + { + "require": "./toml.js", + "import": "./toml-esm.mjs" + }, + "./toml.js" + ], + "./esm": "./toml-esm.mjs" + }, "scripts": { "test": "tap -J --100 test/*.js test/toml-stream/*.js", "benchmark": "node benchmark.js && node benchmark-per-file.js && node results2table.js", diff --git a/toml-esm.mjs b/toml-esm.mjs new file mode 100644 index 0000000..c25f41e --- /dev/null +++ b/toml-esm.mjs @@ -0,0 +1,2 @@ +export {default as parse} from './parse.js'; +export {default as stringify} from './stringify.js'; From 1677ff4c0c15c7f1c39859428feb1295ecae112e Mon Sep 17 00:00:00 2001 From: LJNeon Date: Wed, 15 Jul 2020 02:12:29 -0700 Subject: [PATCH 2/2] fix(esm) minor improvements --- package.json | 1 + toml-esm.mjs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 975d3bf..0d8a6f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@iarna/toml", "version": "3.0.0", + "type": "commonjs", "main": "./toml.js", "exports": { ".": [ diff --git a/toml-esm.mjs b/toml-esm.mjs index c25f41e..29627d1 100644 --- a/toml-esm.mjs +++ b/toml-esm.mjs @@ -1,2 +1,2 @@ -export {default as parse} from './parse.js'; -export {default as stringify} from './stringify.js'; +export {default as parse} from './parse.js' +export {default as stringify} from './stringify.js'