Skip to content

Commit

Permalink
feat!: unify the importModule behavior of cjs and esm (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
chizukicn authored Oct 1, 2023
1 parent 5e0ba79 commit 60a1239
Show file tree
Hide file tree
Showing 12 changed files with 2,467 additions and 2,033 deletions.
15 changes: 15 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/index',
'src/shared',
],
clean: true,
declaration: true,
rollup: {
emitCJS: true,
inlineDependencies: true,
},
failOnWarn: false,
})
109 changes: 0 additions & 109 deletions index.cjs

This file was deleted.

29 changes: 0 additions & 29 deletions index.d.ts

This file was deleted.

101 changes: 0 additions & 101 deletions index.mjs

This file was deleted.

54 changes: 31 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "local-pkg",
"type": "module",
"version": "0.4.3",
"packageManager": "[email protected]",
"description": "Get information on local packages.",
Expand All @@ -20,42 +21,49 @@
"sideEffects": false,
"exports": {
".": {
"types": "./index.d.ts",
"require": "./index.cjs",
"import": "./index.mjs"
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./shared": {
"types": "./dist/shared.d.ts",
"import": "./dist/shared.mjs",
"require": "./dist/shared.cjs"
}
},
"main": "index.cjs",
"module": "index.mjs",
"types": "index.d.ts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist",
"index.cjs",
"index.mjs",
"index.d.ts"
"dist"
],
"engines": {
"node": ">=14"
},
"scripts": {
"prepublishOnly": "nr build",
"build": "tsup shared.ts --format esm,cjs --dts && esno scripts/postbuild.ts",
"build": "unbuild",
"lint": "eslint .",
"release": "bumpp && npm publish",
"test": "node test/cjs.cjs && node test/esm.mjs"
"test": "vitest run && node ./test/cjs.cjs && node ./test/esm.mjs"
},
"dependencies": {
"mlly": "^1.4.2",
"pkg-types": "^1.0.3"
},
"devDependencies": {
"@antfu/eslint-config": "^0.34.1",
"@antfu/ni": "^0.18.8",
"@antfu/utils": "^0.7.2",
"@types/chai": "^4.3.4",
"@types/node": "^18.11.18",
"bumpp": "^8.2.1",
"chai": "^4.3.7",
"eslint": "^8.32.0",
"esno": "^0.16.3",
"@antfu/eslint-config": "^0.43.1",
"@antfu/ni": "^0.21.8",
"@antfu/utils": "^0.7.6",
"@types/chai": "^4.3.6",
"@types/node": "^20.8.0",
"bumpp": "^9.2.0",
"chai": "^4.3.10",
"eslint": "^8.50.0",
"esno": "^0.17.0",
"find-up": "^6.3.0",
"tsup": "^6.5.0",
"typescript": "^4.9.4"
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"vitest": "^0.34.6"
}
}
Loading

0 comments on commit 60a1239

Please sign in to comment.