@@ -30,6 +30,7 @@ const makeDir = require("make-dir");
30
30
*
31
31
* @async
32
32
* @params {String} filename
33
+ * @params {Boolean} compress
33
34
*/
34
35
const read = async function ( filename , compress ) {
35
36
const data = await readFile ( filename + ( compress ? ".gz" : "" ) ) ;
@@ -43,6 +44,7 @@ const read = async function(filename, compress) {
43
44
*
44
45
* @async
45
46
* @params {String} filename
47
+ * @params {Boolean} compress
46
48
* @params {String} result
47
49
*/
48
50
const write = async function ( filename , compress , result ) {
@@ -130,31 +132,23 @@ const handleCache = async function(directory, params) {
130
132
*
131
133
* @async
132
134
* @param {Object } params
133
- * @param {String } params.directory Directory to store cached files
134
- * @param {String } params.identifier Unique identifier to bust cache
135
+ * @param {String } params.cacheDirectory Directory to store cached files
136
+ * @param {String } params.cacheIdentifier Unique identifier to bust cache
137
+ * @param {Boolean } params.cacheCompression Whether compressing cached files
135
138
* @param {String } params.source Original contents of the file to be cached
136
139
* @param {Object } params.options Options to be given to the transform fn
137
- * @param {Function } params.transform Function that will transform the
138
- * original file and whose result will be
139
- * cached
140
140
*
141
141
* @example
142
142
*
143
- * cache({
144
- * directory : '.tmp/cache',
145
- * identifier : 'babel-loader-cachefile',
143
+ * const result = await cache({
144
+ * cacheDirectory : '.tmp/cache',
145
+ * cacheIdentifier : 'babel-loader-cachefile',
146
146
* cacheCompression: false,
147
147
* source: *source code from file*,
148
148
* options: {
149
149
* experimental: true,
150
150
* runtime: true
151
151
* },
152
- * transform: function(source, options) {
153
- * var content = *do what you need with the source*
154
- * return content;
155
- * }
156
- * }, function(err, result) {
157
- *
158
152
* });
159
153
*/
160
154
0 commit comments