Skip to content

Commit 20c143b

Browse files
feat: add option to cache pattern.transform (pattern.cache) (#176)
2 parents a89f8ec + 48c19ff commit 20c143b

File tree

7 files changed

+535
-108
lines changed

7 files changed

+535
-108
lines changed

.eslintrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"env": {
33
"es6": true,
4-
"node": true
4+
"node": true,
5+
"mocha": true
56
},
67
"extends": "eslint:recommended",
78
"parserOptions": {
@@ -25,4 +26,4 @@
2526
"always"
2627
]
2728
}
28-
}
29+
}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ Or, in the simple case of just a `from` with the default destination, you can us
3434

3535
| Name | Required | Default | Details |
3636
|------|----------|------------ |---------------------------------------------------------|
37-
| `from` | Y | | _examples:_<br>'relative/file.txt'<br>'/absolute/file.txt'<br>'relative/dir'<br>'/absolute/dir'<br>'\*\*/\*'<br>{glob:'\*\*/\*', dot: true}<br><br>Globs accept [minimatch options](https://github.com/isaacs/minimatch) |
38-
| `to` | N | output root if `from` is file or dir<br><br>resolved glob path if `from` is glob | _examples:_<br>'relative/file.txt'<br>'/absolute/file.txt'<br>'relative/dir'<br>'/absolute/dir'<br>'relative/[name].[ext]'<br>'/absolute/[name].[ext]'<br><br>Templates are [file-loader patterns](https://github.com/webpack/file-loader) |
37+
| `from` | Y | | _examples:_<br>'relative/file.txt'<br>'/absolute/file.txt'<br>'relative/dir'<br>'/absolute/dir'<br>'\*\*/\*'<br>{glob:'\*\*/\*', dot: true}<br><br>Globs accept [minimatch options](https://github.com/isaacs/minimatch) |
38+
| `to` | N | output root if `from` is file or dir<br><br>resolved glob path if `from` is glob | _examples:_<br>'relative/file.txt'<br>'/absolute/file.txt'<br>'relative/dir'<br>'/absolute/dir'<br>'relative/[name].[ext]'<br>'/absolute/[name].[ext]'<br><br>Templates are [file-loader patterns](https://github.com/webpack/file-loader) |
3939
| `toType` | N | **'file'** if `to` has extension or `from` is file<br><br>**'dir'** if `from` is directory, `to` has no extension or ends in '/'<br><br>**'template'** if `to` contains [a template pattern](https://github.com/webpack/file-loader) | |
4040
| `context` | N | options.context \|\| compiler.options.context | A path that determines how to interpret the `from` path |
4141
| `flatten` | N | false | Removes all directory references and only copies file names<br><br>If files have the same name, the result is non-deterministic |
4242
| `ignore` | N | [] | Additional globs to ignore for this pattern |
4343
| `transform` | N | function(content, path) {<br>&nbsp;&nbsp;return content;<br>} | Function that modifies file contents before writing to webpack |
4444
| `force` | N | false | Overwrites files already in compilation.assets (usually added by other plugins) |
45+
| `cache` | N | false | Enable `transform` caching. You can use `{ cache: { key: 'my-cache-key'} }` to invalidate cache. |
4546

4647
#### Available options:
4748

0 commit comments

Comments
 (0)