diff --git a/.github/workflows/node-esm.yml b/.github/workflows/node-esm.yml deleted file mode 100644 index 6d387f2..0000000 --- a/.github/workflows/node-esm.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: 'Tests: node.js (ESM)' - -on: [pull_request, push] - -jobs: - tests: - uses: ljharb/actions/.github/workflows/node-esm.yml@main - with: - command: npm run tests-esm \ No newline at end of file diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6121647..0000000 --- a/index.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import callBind from 'call-bind'; -import RequireObjectCoercible from 'es-abstract/2023/RequireObjectCoercible.js'; - -import getPolyfill from 'string.prototype.towellformed/polyfill'; - -const bound = callBind(getPolyfill()); - -export default function toWellFormed(string) { - RequireObjectCoercible(string); - return bound(string); -} - -export { default as getPolyfill } from 'string.prototype.towellformed/polyfill'; -export { default as implementation } from 'string.prototype.towellformed/implementation'; -export { default as shim } from 'string.prototype.towellformed/shim'; diff --git a/package.json b/package.json index c43bde3..b48b4f5 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,7 @@ "description": "An ESnext spec-compliant `String.prototype.toWellFormed` shim/polyfill/replacement that works as far down as ES3.", "main": "index.js", "exports": { - ".": [ - { - "import": "./index.mjs", - "require": "./index.js", - "default": "./index.js" - }, - "./index.js" - ], + ".": "./index.js", "./auto": "./auto.js", "./polyfill": "./polyfill.js", "./implementation": "./implementation.js", @@ -29,8 +22,7 @@ "lint": "eslint --ext=js,mjs .", "postlint": "es-shim-api --bound", "tests-only": "nyc tape 'test/**/*.js'", - "tests-esm": "nyc node test/index.mjs", - "test": "npm run tests-only && npm run tests-esm", + "test": "npm run tests-only", "posttest": "aud --production", "version": "auto-changelog && git add CHANGELOG.md", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" diff --git a/test/index.mjs b/test/index.mjs deleted file mode 100644 index 478a190..0000000 --- a/test/index.mjs +++ /dev/null @@ -1,31 +0,0 @@ -import bound from 'string.prototype.towellformed'; -import * as Module from 'string.prototype.towellformed'; -import test from 'tape'; -import runTests from './tests.js'; - -test('as a function', (t) => { - t.test('bad receiver', (st) => { - st.throws(() => bound(undefined), TypeError, 'undefined is not an object'); - st.throws(() => bound(null), TypeError, 'null is not an object'); - st.end(); - }); - - runTests(bound, t); - - t.end(); -}); - -test('named exports', async (t) => { - t.deepEqual( - Object.keys(Module).sort(), - ['default', 'shim', 'getPolyfill', 'implementation'].sort(), - 'has expected named exports', - ); - - const { shim, getPolyfill, implementation } = Module; - t.equal((await import('string.prototype.towellformed/shim')).default, shim, 'shim named export matches deep export'); - t.equal((await import('string.prototype.towellformed/implementation')).default, implementation, 'implementation named export matches deep export'); - t.equal((await import('string.prototype.towellformed/polyfill')).default, getPolyfill, 'getPolyfill named export matches deep export'); - - t.end(); -});