drop support for commonjs

This commit is contained in:
cupcakearmy 2022-10-18 15:48:27 +02:00
parent dbc5bf97d9
commit 91605aa434
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
10 changed files with 11 additions and 35 deletions

View File

@ -7,7 +7,7 @@ module.exports = function (config) {
basePath: '', basePath: '',
files: [ files: [
{ pattern: 'node_modules/chai/chai.js', type: 'module' }, { pattern: 'node_modules/chai/chai.js', type: 'module' },
{ pattern: 'dist/esm/**/*.js', type: 'module' }, { pattern: 'dist/**/*.js', type: 'module' },
{ pattern: 'test/**/*.js', type: 'module' }, { pattern: 'test/**/*.js', type: 'module' },
], ],

View File

@ -21,12 +21,11 @@
"pnpm": "7" "pnpm": "7"
}, },
"type": "module", "type": "module",
"types": "./dist/esm/index.d.ts", "types": "./dist/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./dist/esm/index.d.ts", "types": "./dist/index.d.ts",
"import": "./dist/esm/index.js", "import": "./dist/index.js"
"require": "./dist/cjs/index.cjs"
} }
}, },
"files": [ "files": [
@ -37,12 +36,10 @@
"test:node": "mocha", "test:node": "mocha",
"test:browser": "karma start .karma.cjs --single-run", "test:browser": "karma start .karma.cjs --single-run",
"test": "run-s build test:*", "test": "run-s build test:*",
"build:esm": "tsc -p tsconfig.esm.json", "build": "tsc",
"build:cjs": "tsc -p tsconfig.cjs.json && ./rename.sh",
"build": "run-s clean build:*",
"clean": "rm -rf ./dist", "clean": "rm -rf ./dist",
"dev": "run-p -ln dev:*", "dev": "run-p -ln dev:*",
"dev:build": "tsc -w -p tsconfig.esm.json", "dev:build": "tsc -w",
"dev:test:node": "mocha --parallel --watch", "dev:test:node": "mocha --parallel --watch",
"dev:test:browser": "karma start .karma.cjs", "dev:test:browser": "karma start .karma.cjs",
"prepublishOnly": "run-s clean build" "prepublishOnly": "run-s clean build"

View File

@ -1,5 +0,0 @@
#!/bin/sh
# Rename .js files to .cjs
rename -S .js .cjs dist/cjs/**/*
sed -i '' 's/\.js"/\.cjs"/g' dist/cjs/**/*.cjs

View File

@ -1,4 +1,4 @@
import { AES, Bytes, Hashes, Hex } from '../dist/esm/index.js' import { AES, Bytes, Hashes, Hex } from '../dist/index.js'
import { Precomputed } from './values.js' import { Precomputed } from './values.js'
describe('AES', () => { describe('AES', () => {

View File

@ -1,4 +1,4 @@
import { Base64, Bytes } from '../dist/esm/index.js' import { Base64, Bytes } from '../dist/index.js'
import { Precomputed } from './values.js' import { Precomputed } from './values.js'
describe('Encoding', () => { describe('Encoding', () => {

View File

@ -1,4 +1,4 @@
import { Bytes, Hash, Hashes, Hex } from '../dist/esm/index.js' import { Bytes, Hash, Hashes, Hex } from '../dist/index.js'
import { Precomputed } from './values.js' import { Precomputed } from './values.js'
describe('Hash', () => { describe('Hash', () => {

View File

@ -1,4 +1,4 @@
import { getRandomBytes } from '../dist/esm/index.js' import { getRandomBytes } from '../dist/index.js'
import { Promises } from './utils.js' import { Promises } from './utils.js'
describe('Random', () => { describe('Random', () => {

View File

@ -1,4 +1,4 @@
import { Bytes, RSA } from '../dist/esm/index.js' import { Bytes, RSA } from '../dist/index.js'
import { Promises } from './utils.js' import { Promises } from './utils.js'
import { Precomputed } from './values.js' import { Precomputed } from './values.js'

View File

@ -1,8 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"target": "ES2015",
"outDir": "dist/cjs"
}
}

View File

@ -1,8 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ES2015",
"target": "ES2015",
"outDir": "dist/esm"
}
}