Skip to content

Commit 04fc9b9

Browse files
committed
Try file-only cache, 4.8.10
1 parent c575783 commit 04fc9b9

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cogs",
3-
"version": "4.8.9",
3+
"version": "4.8.10",
44
"type": "module",
55
"author": "Casey Foster <c@sey.me>",
66
"description": "The fast file transform pipeline.",

src/bust-cache.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ import fileHasDependency from './file-has-dependency.js';
55
export default ({ config, path }) =>
66
Promise.all(
77
_.map(config, async ({ cache }) => {
8-
const { buffers, files } = cache;
9-
delete buffers[path];
10-
delete files[path];
8+
delete cache[path];
119
await Promise.all(
12-
_.map(files, async (file, key) => {
13-
if (fileHasDependency({ file: await file, path })) delete files[key];
10+
_.map(cache, async (file, key) => {
11+
if (fileHasDependency({ file: await file, path })) delete cache[key];
1412
})
1513
);
1614
})

src/get-file.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ import { promises as fs } from 'fs';
33
import applyTransformers from './apply-transformers.js';
44
import getOrSet from './get-or-set.js';
55

6-
const readFile = ({ cache, path }) =>
7-
getOrSet(cache.buffers, path, () => fs.readFile(path));
8-
96
export default ({ env: { cache, transformers }, path }) =>
10-
getOrSet(cache.files, path, async () => {
7+
getOrSet(cache, path, async () => {
118
try {
129
return await applyTransformers({
1310
file: {
14-
buffer: await readFile({ cache, path }),
11+
buffer: await fs.readFile(path),
1512
builds: [],
1613
links: [],
1714
path,

src/normalize-config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ const asyncMapObj = async (obj, fn) =>
1212
);
1313

1414
export default async config => {
15-
const buffers = {};
16-
1715
config = await asyncMapObj(
1816
config,
1917
async ({ builds, transformers, manifestPath, requires }, name) => ({
@@ -23,7 +21,7 @@ export default async config => {
2321
toArray(target.transformers).map(normalizeTransformer)
2422
)
2523
})),
26-
cache: { buffers, files: {} },
24+
cache: {},
2725
manifestPath,
2826
name,
2927
requires: toArray(requires),

0 commit comments

Comments
 (0)