Skip to content

Commit

Permalink
always disable globbing (#2432)
Browse files Browse the repository at this point in the history
* always disable globbing

* add a test

* Update changelog
  • Loading branch information
Rich-Harris authored and lukastaegert committed Sep 5, 2018
1 parent 4c290b6 commit 28a7be1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# rollup changelog

## 0.65.1
*unreleased*
* Prevent globbing when using chokidar ([#2432](https://github.com/rollup/rollup/pull/2432))

## 0.65.0
*2018-08-25*
* Refactor and unify plugin system ([#2382](https://github.com/rollup/rollup/pull/2382))
Expand Down
3 changes: 2 additions & 1 deletion src/watch/index.ts
Expand Up @@ -130,7 +130,8 @@ export class Task {
if (chokidarOptions) {
chokidarOptions = {
...(chokidarOptions === true ? {} : chokidarOptions),
ignoreInitial: true
ignoreInitial: true,
disableGlobbing: true
};
}

Expand Down
34 changes: 34 additions & 0 deletions test/watch/index.js
Expand Up @@ -954,5 +954,39 @@ describe('rollup.watch', () => {
]);
});
});

it('treats filenames literally, not as globs', () => {
return sander
.copydir('test/watch/samples/non-glob')
.to('test/_tmp/input')
.then(() => {
const watcher = rollup.watch({
input: 'test/_tmp/input/main.js',
output: {
file: 'test/_tmp/output/bundle.js',
format: 'cjs'
},
watch: { chokidar }
});

return sequence(watcher, [
'START',
'BUNDLE_START',
'BUNDLE_END',
'END',
() => {
assert.equal(run('../_tmp/output/bundle.js'), 42);
sander.writeFileSync('test/_tmp/input/[foo]/bar.js', `export const bar = 43;`);
},
'START',
'BUNDLE_START',
'BUNDLE_END',
'END',
() => {
assert.equal(run('../_tmp/output/bundle.js'), 43);
}
]);
});
});
}
});
1 change: 1 addition & 0 deletions test/watch/samples/non-glob/[foo]/bar.js
@@ -0,0 +1 @@
export const bar = 42;
3 changes: 3 additions & 0 deletions test/watch/samples/non-glob/main.js
@@ -0,0 +1,3 @@
import { bar } from './[foo]/bar.js';

export default bar;

0 comments on commit 28a7be1

Please sign in to comment.