0.3.0 • Published 2 years ago

@prpl/plugin-cache v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@prpl/plugin-cache (WIP)

NOTE - This plugin is experimental. It may change significantly in the future. Not recommended for use at present.

A plugin for PRPL for cache manipulation. Useful for defining cache partitions that subsequent plugins may access.

Dependencies

@prpl/plugin-cache has zero dependencies.

Usage

For example, you may want to pre-define a partition that reads all HTML and CSS files in dist so that those files can be accessed in memory:

import { resolve } from 'path';
import { interpolate, PRPLCachePartitionKey } from '@prpl/core';
import { createCachePartition } from '@prpl/plugin-cache';
import { resolveHTMLImports } from '@prpl/plugin-html-imports';
import { resolveCSSImports } from '@prpl/plugin-css-imports';

await interpolate();

// Pre-define dist partition and use for subsequent plugins
await createCachePartition({
  entityPath: resolve('dist'),
  partitionKey: PRPLCachePartitionKey.dist,
  readFileRegExp: new RegExp(`.html|.css`)
});

await resolveHTMLImports({
  cachePartitionKey: PRPLCachePartitionKey.dist
});

await resolveCSSImports({
  cachePartitionKey: PRPLCachePartitionKey.dist
});

By doing this, we save each plugin from generating its own partition that reads from the file system. All plugins that interact with the cache should return the cache as an artifact that can be conveniently inspected.

0.3.0

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago