Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added cjs support via esbuild #1161

Open
wants to merge 1 commit into
base: explore-new-api
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -21,3 +21,6 @@ node_modules
# Code Coverage
/.nyc_output/
/coverage/

# esbuild
dist
2 changes: 2 additions & 0 deletions cjs-wrapper.cjs
@@ -0,0 +1,2 @@
// <https://github.com/evanw/esbuild/issues/532#issuecomment-1019392638>
module.exports = require('./dist/multer.cjs').default
42 changes: 27 additions & 15 deletions package.json
Expand Up @@ -7,19 +7,6 @@
"Jaret Pfluger <https://github.com/jpfluger>",
"Linus Unneb盲ck <linus@folkdatorn.se>"
],
"license": "MIT",
"repository": "expressjs/multer",
"type": "module",
"exports": "./index.js",
"keywords": [
"form",
"post",
"multipart",
"form-data",
"formdata",
"express",
"middleware"
],
"dependencies": {
"@fastify/busboy": "^1.0.0",
"append-field": "^2.0.0",
Expand All @@ -32,24 +19,49 @@
},
"devDependencies": {
"c8": "^7.7.3",
"esbuild": "^0.15.15",
"express": "^4.16.4",
"form-data": "^4.0.0",
"get-stream": "^6.0.1",
"hasha": "^5.2.0",
"mocha": "^9.0.3",
"recursive-nullify": "^1.0.0",
"rimraf": "^3.0.2",
"standard": "^16.0.3",
"testdata-w3c-json-form": "^1.0.0"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"exports": {
"require": "./cjs-wrapper.cjs",
"import": "./index.js"
},
"files": [
"LICENSE",
"index.js",
"lib/"
"cjs-wrapper.cjs",
"lib/",
"dist/"
],
"keywords": [
"express",
"form",
"form-data",
"formdata",
"middleware",
"multipart",
"post"
],
"license": "MIT",
"type": "module",
"main": "cjs-wrapper.cjs",
"module": "./index.js",
"repository": "expressjs/multer",
"scripts": {
"test": "standard && c8 --check-coverage --statements 100 mocha"
"lint": "standard",
"build": "rimraf dist && esbuild index.js --bundle --platform=node --charset=utf8 --minify --outfile=dist/multer.cjs",
"pretest": "npm run lint && npm run build",
"test": "c8 --check-coverage --statements 100 mocha"
}
}