diff --git a/package-lock.json b/package-lock.json index f22f147e..1cd18062 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4658,12 +4658,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4678,17 +4680,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4805,7 +4810,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4817,6 +4823,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4831,6 +4838,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4838,12 +4846,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4862,6 +4872,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4942,7 +4953,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4954,6 +4966,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5075,6 +5088,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/processPattern.js b/src/processPattern.js index 289f0ee2..1b2f5583 100644 --- a/src/processPattern.js +++ b/src/processPattern.js @@ -11,6 +11,7 @@ export default function processPattern(globalRef, pattern) { const globOptions = Object.assign( { cwd: pattern.context, + follow: true, }, pattern.globOptions || {} ); diff --git a/test/CopyPlugin.test.js b/test/CopyPlugin.test.js index a332750f..dd0c1577 100644 --- a/test/CopyPlugin.test.js +++ b/test/CopyPlugin.test.js @@ -85,6 +85,20 @@ describe('apply function', () => { // Get a mock compiler to pass to plugin.apply const compiler = opts.compiler || new MockCompiler(); + const isWin = process.platform === 'win32'; + + if (!opts.symlink || isWin) { + if (!opts.options) { + opts.options = {}; + } + + if (!opts.options.ignore) { + opts.options.ignore = []; + } + + opts.options.ignore.push('symlink/**/*'); + } + new CopyPlugin(opts.patterns, opts.options).apply(compiler); // Call the registered function with a mock compilation and callback @@ -657,6 +671,25 @@ describe('apply function', () => { .then(done) .catch(done); }); + + it('can use a glob to move a file to the root directory with symbolic link', (done) => { + runEmit({ + symlink: true, + expectedAssetKeys: [ + 'symlink/directory-ln/file.txt', + 'symlink/directory-ln/nested-directory/file-in-nested-directory.txt', + 'symlink/directory/file.txt', + 'symlink/directory/nested-directory/file-in-nested-directory.txt', + ], + patterns: [ + { + from: 'symlink/**/*.txt', + }, + ], + }) + .then(done) + .catch(done); + }); }); describe('with file in from', () => { @@ -1180,7 +1213,7 @@ describe('apply function', () => { patterns: [ { from: '**/*', - ignore: ['file.*'], + ignore: ['file.*', 'file-in-nested-directory.*'], }, ], }) diff --git a/test/helpers/symlink/directory-ln b/test/helpers/symlink/directory-ln new file mode 120000 index 00000000..097fc790 --- /dev/null +++ b/test/helpers/symlink/directory-ln @@ -0,0 +1 @@ +./directory/ \ No newline at end of file diff --git a/test/helpers/symlink/directory/file.txt b/test/helpers/symlink/directory/file.txt new file mode 100644 index 00000000..e69de29b diff --git a/test/helpers/symlink/directory/nested-directory/file-in-nested-directory.txt b/test/helpers/symlink/directory/nested-directory/file-in-nested-directory.txt new file mode 100644 index 00000000..e69de29b