Skip to content

Commit

Permalink
Merge pull request #15 from will-stone/3.0.0
Browse files Browse the repository at this point in the history
Fix need to destructure CJS with `default`
  • Loading branch information
grrowl authored Nov 13, 2023
2 parents e07511b + 9aabfc3 commit 3e7f010
Show file tree
Hide file tree
Showing 6 changed files with 920 additions and 179 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 3.0.0

Convert to ESM by default.

Transpile to ES2015.

CommonJS now uses `module.exports` rather than `exports.default`. This
allows for importing in CommonJS without requiring explicit `default`. e.g.
```js
// Previous:
const flattenChildren = require("react-keyed-flatten-children")
flattenChildren.default(children)
// Now:
const flattenChildren = require("react-keyed-flatten-children")
flattenChildren(children)
```



# 2.2.1

Removed invalid key `types` from `package.json` (thanks @imjordanxd)
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "react-keyed-flatten-children",
"version": "2.2.1",
"version": "3.0.0",
"description": "Flattens React children and fragments to an array with predictable and stable keys",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"type": "module",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"homepage": "https://github.com/grrowl/react-keyed-flatten-children",
"repository": {
"type": "git",
"url": "https://github.com/grrowl/react-keyed-flatten-children.git"
},
"scripts": {
"prebuild": "rm -rf ./dist",
"build": "tsc -b tsconfig.cjs.json tsconfig.esm.json",
"test": "ts-node node_modules/tape/bin/tape *.spec.tsx",
"build": "tsup index.ts --format esm,cjs --clean --dts --cjsInterop --splitting",
"test": "tsx index.spec.tsx",
"prepublishOnly": "npm run build"
},
"keywords": [
Expand All @@ -42,8 +42,9 @@
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-test-renderer": "^18.2.0",
"tape": "^5.6.3",
"ts-node": "^10.9.1",
"tape": "^5.7.0",
"tsup": "^7.2.0",
"tsx": "^3.13.0",
"typescript": "^5.0.4"
},
"dependencies": {
Expand Down
7 changes: 0 additions & 7 deletions tsconfig.cjs.json

This file was deleted.

7 changes: 0 additions & 7 deletions tsconfig.esm.json

This file was deleted.

6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2015",
"jsx": "react",
"declaration": true,
"moduleResolution": "node",
"module": "ES2015",
"moduleResolution": "Bundler",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
"include": ["index.ts"],
"exclude": ["*.spec.tsx"]
}
Loading

0 comments on commit 3e7f010

Please sign in to comment.