-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
125 lines (125 loc) · 8.41 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{
"_args": [
[
{
"raw": "caching-transform@^1.0.0",
"scope": null,
"escapedName": "caching-transform",
"name": "caching-transform",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"/Users/benjamincoe/bcoe/nyc"
],
[
{
"raw": "caching-transform@1.0.1",
"scope": null,
"escapedName": "caching-transform",
"name": "caching-transform",
"rawSpec": "1.0.1",
"spec": "1.0.1",
"type": "version"
},
"/Users/jennyphan/AngularToolingSamples/Angular4/aboutMe-app/functions/node_modules/firebase-admin"
]
],
"_from": "caching-transform@>=1.0.0 <2.0.0",
"_id": "caching-transform@1.0.1",
"_inCache": true,
"_location": "/firebase-admin/nyc/caching-transform",
"_nodeVersion": "5.3.0",
"_npmUser": {
"name": "jamestalmage",
"email": "james@talmage.io"
},
"_npmVersion": "3.3.12",
"_phantomChildren": {},
"_requested": {
"raw": "caching-transform@1.0.1",
"scope": null,
"escapedName": "caching-transform",
"name": "caching-transform",
"rawSpec": "1.0.1",
"spec": "1.0.1",
"type": "version"
},
"_requiredBy": [
"/firebase-admin/nyc"
],
"_resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-1.0.1.tgz",
"_shasum": "6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1",
"_shrinkwrap": null,
"_spec": "caching-transform@1.0.1",
"_where": "/Users/jennyphan/AngularToolingSamples/Angular4/aboutMe-app/functions/node_modules/firebase-admin",
"author": {
"name": "James Talmage",
"email": "james@talmage.io",
"url": "github.com/jamestalmage"
},
"bugs": {
"url": "https://github.com/jamestalmage/caching-transform/issues"
},
"dependencies": {
"md5-hex": "^1.2.0",
"mkdirp": "^0.5.1",
"write-file-atomic": "^1.1.4"
},
"description": "Wraps a transform and provides caching",
"devDependencies": {
"ava": "^0.8.0",
"coveralls": "^2.11.6",
"mock-fs": "^3.5.0",
"nyc": "5.0.1",
"proxyquire": "^1.7.3",
"sinon": "^1.17.2",
"xo": "^0.12.1"
},
"directories": {},
"dist": {
"shasum": "6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1",
"tarball": "https://registry.npmjs.org/caching-transform/-/caching-transform-1.0.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "508395eb3e785c5010d091fc05d93b7024201414",
"homepage": "https://github.com/jamestalmage/caching-transform#readme",
"keywords": [
"transform",
"cache",
"require",
"transpile",
"fast",
"speed",
"hash"
],
"license": "MIT",
"maintainers": [
{
"name": "jamestalmage",
"email": "james@talmage.io"
}
],
"name": "caching-transform",
"optionalDependencies": {},
"readme": "# caching-transform [![Build Status](https://travis-ci.org/jamestalmage/caching-transform.svg?branch=master)](https://travis-ci.org/jamestalmage/caching-transform) [![Coverage Status](https://coveralls.io/repos/jamestalmage/caching-transform/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamestalmage/caching-transform?branch=master)\n\n> Wraps a transform and provides caching.\n\nCaching transform results can greatly improve performance. `nyc` saw [dramatic performance increases](https://github.com/bcoe/nyc/pull/101#issuecomment-165716069) when we implemented caching. \n\n\n## Install\n\n```\n$ npm install --save caching-transform\n```\n\n\n## Usage\n\n```js\nconst cachingTransform = require('caching-transform');\n\nconst transform = cachingTransform({\n cacheDir: '/path/to/cache/directory',\n salt: 'hash-salt',\n transform: (input, metadata, hash) => {\n // ... expensive operations ...\n return transformedResult;\n }\n});\n\ntransform('some input for transpilation')\n// => fetch from the cache,\n// or run the transform and save to the cache if not found there\n```\n\n\n## API\n\n### cachingTransform(options)\n\nReturns a transform callback that takes two arguments:\n\n - `input` a string to be transformed\n - `metadata` an arbitrary data object.\n\nBoth arguments are passed to the wrapped transform. Results are cached in the cache directory using an `md5` hash of `input` and an optional `salt` value. If a cache entry already exist for `input`, the wrapped transform function will never be called.\n\n#### options\n \n##### salt\n\nType: `string`, or `buffer`\nDefault: `empty string`\n\nA value that uniquely identifies your transform:\n\n```js\n const pkg = require('my-transform/package.json');\n const salt = pkg.name + ':' + pkg.version;\n```\n\nIncluding the version in the salt ensures existing cache entries will be automatically invalidated when you bump the version of your transform. If your transform relies on additional dependencies, and the transform output might change as those dependencies update, then your salt should incorporate the versions of those dependencies as well.\n\n##### transform\n\nType: `Function(input: string|buffer, metadata: *, hash: string): string|buffer` \n\n - `input`: The value to be transformed. It is passed through from the wrapper.\n - `metadata`: An arbitrary data object passed through from the wrapper. A typical value might be a string filename.\n - `hash`: The salted hash of `input`. Useful if you intend to create additional cache entries beyond the transform result (i.e. `nyc` also creates cache entries for source-map data). This value is not available if the cache is disabled, if you still need it, the default can be computed via [`md5Hex([input, salt])`](https://www.npmjs.com/package/md5-hex).\n\nThe transform function will return a `string` (or Buffer if `encoding === 'buffer'`) containing the result of transforming `input`.\n\n##### factory\n\nType: `Function(cacheDir: string): transformFunction`\n\nIf the `transform` function is expensive to create, and it is reasonable to expect that it may never be called during the life of the process, you may supply a `factory` function that will be used to create the `transform` function the first time it is needed.\n\nA typical usage would be to prevent eagerly `require`ing expensive dependencies like Babel:\n\n```js\nfunction factory() {\n // Using the factory function, you can avoid loading Babel until you are sure it is needed. \n var babel = require('babel-core');\n \n return function (code, metadata) {\n return babel.transform(code, {filename: metadata.filename, plugins: [/* ... */]});\n };\n}\n```\n\n##### cacheDir\n\nType: `string` \n*Required unless caching is disabled*\n\nThe directory where cached transform results will be stored. The directory is automatically created with [`mkdirp`](https://www.npmjs.com/package/mkdirp). You can set `options.createCacheDir = false` if you are certain the directory already exists. \n\n##### ext\n\nType: `string`\nDefault: `empty string`\n\nAn extension that will be appended to the salted hash to create the filename inside your cache directory. It is not required, but recommended if you know the file type. Appending the extension allows you to easily inspect the contents of the cache directory with your file browser.\n\n##### shouldTransform\n\nType: `Function(input: string|buffer, additonalData: *)`\nDefault: `always transform`\n\nA function that examines `input` and `metadata` to determine whether the transform should be applied. Returning `false` means the transform will not be applied and `input` will be returned unmodified.\n \n##### disableCache\n\nType: `boolean`\nDefault: `false`\n\nIf `true`, the cache is ignored and the transform is used every time regardless of cache contents.\n \n##### hash\n\nType: `Function(input: string|buffer, metadata: *, salt: string): string`\n\nProvide a custom hashing function for the given input. The default hashing function does not take the `metadata` into account:\n\n> [`md5Hex([input, salt])`](https://www.npmjs.com/package/md5-hex)\n\n##### encoding\n\nType: `string`\nDefault: `utf8`\n\nThe encoding to use when writing to / reading from the filesystem. If set to `\"buffer\"`, then buffers will be returned from the cache instead of strings.\n\n## License\n\nMIT © [James Talmage](http://github.com/jamestalmage)\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/jamestalmage/caching-transform.git"
},
"scripts": {
"test": "xo && nyc --reporter=lcov --reporter=text ava"
},
"version": "1.0.1",
"xo": {
"ignores": [
"test.js"
]
}
}