diff --git a/README.md b/README.md index 5a7d5f66..061f909f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,11 @@ import { minimatch } from 'minimatch' // or: const { minimatch } = require('minimatch') +// default export also works +import minimatch from 'minimatch' +// or: +const minimatch = require('minimatch') + minimatch('bar.foo', '*.foo') // true! minimatch('bar.foo', '*.bar') // false! minimatch('bar.foo', '*.+(bar|foo)', { debug: true }) // true, and noisy! diff --git a/package-lock.json b/package-lock.json index 63f4ec6e..5997349e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "minimatch", - "version": "6.1.1", + "version": "6.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "minimatch", - "version": "6.1.1", + "version": "6.1.2", "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" diff --git a/package.json b/package.json index e764a4ec..285c8553 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,12 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me)", "name": "minimatch", "description": "a glob matcher in javascript", - "version": "6.1.1", + "version": "6.1.2", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" }, - "main": "./dist/cjs/index.js", + "main": "./dist/cjs/index-cjs.js", "module": "./dist/mjs/index.js", "types": "./dist/cjs/index.d.ts", "exports": { @@ -30,7 +30,7 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "preprepare": "rm -rf dist", - "prepare": "tsc -p tsconfig-cjs.json && tsc -p tsconfig-esm.json", + "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json", "postprepare": "bash fixup.sh", "pretest": "npm run prepare", "presnap": "npm run prepare", diff --git a/src/index-cjs.ts b/src/index-cjs.ts new file mode 100644 index 00000000..812f3ea5 --- /dev/null +++ b/src/index-cjs.ts @@ -0,0 +1,3 @@ +import minimatch from './index.js' + +export = Object.assign(minimatch, { default: minimatch, minimatch }) diff --git a/tsconfig-esm.json b/tsconfig-esm.json index 9a571575..8df1a6f3 100644 --- a/tsconfig-esm.json +++ b/tsconfig-esm.json @@ -1,5 +1,6 @@ { "extends": "./tsconfig-base.json", + "exclude": ["src/index-cjs.ts"], "compilerOptions": { "module": "esnext", "outDir": "dist/mjs" diff --git a/tsconfig-cjs.json b/tsconfig.json similarity index 100% rename from tsconfig-cjs.json rename to tsconfig.json