Skip to content

Commit

Permalink
Named export only, no default export
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Apr 9, 2023
1 parent 3093d33 commit e4f8633
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 27 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ 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!
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# change log

## 9.0

- No default export, only named exports.

## 8.0

- Recursive descent parser for extglob, allowing correct support
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "git://github.com/isaacs/minimatch.git"
},
"main": "./dist/cjs/index-cjs.js",
"main": "./dist/cjs/index.js",
"module": "./dist/mjs/index.js",
"types": "./dist/cjs/index.d.ts",
"exports": {
Expand All @@ -18,7 +18,7 @@
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index-cjs.js"
"default": "./dist/cjs/index.js"
}
}
},
Expand Down
3 changes: 0 additions & 3 deletions src/index-cjs.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ export const minimatch = (
return new Minimatch(pattern, options).match(p)
}

export default minimatch

// Optimized checking for the most common glob patterns.
const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/
const starDotExtTest = (ext: string) => (f: string) =>
Expand Down
4 changes: 2 additions & 2 deletions test/brace-expand.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var tap = require('tap'),
minimatch = require('../').default
var tap = require('tap')
const { minimatch } = require('../')

tap.test('brace expansion', function (t) {
// [ pattern, [expanded] ]
Expand Down
2 changes: 1 addition & 1 deletion test/class-edge-cases.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const t = require('tap')
const minimatch = require('../').default
const { minimatch } = require('../')

const files = ['a[]b', '[b-a]x', 'a]b', 'a[]]b', 'a[[]b']

Expand Down
2 changes: 1 addition & 1 deletion test/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

const t = require('tap')
const globalBefore = Object.keys(global)
const mm = require('../').default
const { minimatch: mm } = require('../')

const patterns = require('./patterns.js')

Expand Down
2 changes: 1 addition & 1 deletion test/escaping.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var tap = require('tap')
var minimatch = require('../').default
const { minimatch } = require('../')

// test all characters with codes in range [mincc,maxcc]
var mincc = 0x20
Expand Down
2 changes: 1 addition & 1 deletion test/extglob-ending-with-state-char.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var test = require('tap').test
var minimatch = require('../').default
const { minimatch } = require('../')

test('extglob ending with statechar', function (t) {
t.notOk(minimatch('ax', 'a?(b*)'))
Expand Down
2 changes: 1 addition & 1 deletion test/extglob-unfinished.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var t = require('tap')
var mm = require('../').default
const mm = require('../').minimatch

var types = '!?+*@'.split('')

Expand Down
2 changes: 1 addition & 1 deletion test/negative-extglob-anchoring.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const t = require('tap')
const mm = require('../').default
const mm = require('../').minimatch
const pattern = 'a/b/*/!(bar)/*'
const nope = 'a/b/c/bar/x'
const yup = 'a/b/c/baz/x'
Expand Down
2 changes: 1 addition & 1 deletion test/nocase-magic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const t = require('tap')
const { Minimatch } = require('../').default
const { Minimatch } = require('../')

const nomagic = '../1/2/3'
const yesmagic = '../x'
Expand Down
2 changes: 1 addition & 1 deletion test/partial.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const t = require('tap')
const mm = require('../').default
const mm = require('../').minimatch
t.equal(mm('/a/b', '/*/b/x/y/z', { partial: true }), true)
t.equal(mm('/a/b/c', '/*/b/x/y/z', { partial: true }), false)
t.equal(mm('/', 'x', { partial: true }), true)
Expand Down
2 changes: 1 addition & 1 deletion test/redos.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var t = require('tap')

var minimatch = require('../').default
var minimatch = require('../').minimatch

// utility function for generating long strings
var genstr = function (len, chr) {
Expand Down
2 changes: 1 addition & 1 deletion test/tricky-negations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var t = require('tap')
var minimatch = require('../').default
var minimatch = require('../').minimatch
var cases = {
'bar.min.js': {
'*.!(js|css)': true,
Expand Down
6 changes: 3 additions & 3 deletions test/win-path-sep.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const t = require('tap')
t.test('path separator /', t => {
process.env.__MINIMATCH_TESTING_PLATFORM__ = 'posix'
const mm = t.mock('../', {}).default
const mm = t.mock('../', {}).minimatch
t.equal(mm('x/y/z', 'x/y/*/z'), false)
t.equal(mm('x/y/w/z', 'x/y/*/z'), true)
t.end()
})

t.test('path separator \\', t => {
process.env.__MINIMATCH_TESTING_PLATFORM__ = 'win32'
const mm = t.mock('../', {}).default
const mm = t.mock('../', {}).minimatch
t.equal(mm('x\\y\\z', 'x/y/*/z'), false)
t.equal(mm('x\\y\\w\\z', 'x/y/*/z'), true)
t.end()
})

t.test('override with options', t => {
process.env.__MINIMATCH_TESTING_PLATFORM__ = 'win32'
const mm = t.mock('../', {}).default
const mm = t.mock('../', {}).minimatch

t.equal(
mm('c:\\foo\\bar', 'c:\\foo\\*', {
Expand Down

0 comments on commit e4f8633

Please sign in to comment.