npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@invisiburu/gulp-memoize

v1.0.0

Published

A task memoize plugin for Gulp

Downloads

4

Readme

gulp-memoize

NPM version Node version Dependencies status Build status Coverage status

Based on the gulp-cache

A task memoize proxy task for gulp.

Install

npm i -D gulp-memoize
# or
yarn add -D gulp-memoize

Usage

import gulp from 'gulp';
import favicons from 'gulp-favicons';
import srcset from 'gulp-srcset';
import memoize from 'gulp-memoize';

gulp.task('favicon', () =>
    gulp.src('src/favicon.svg')
        .pipe(memoize(
            // Target plugin, the output of which will be memoized.
            favicons(faviconsConfig),
            // Options for `gulp-memoize` plugin.
            {
                // Report on every restored file
                verbose: true
            }
        ))
        .pipe(gulp.dest('./favicons'))
);

gulp.task('images', () =>
    gulp.src('src/**/*.{jpg,png,svg}')
        .pipe(memoize(srcset(srcsetRules)))
        .pipe(gulp.dest('./images'))
);
import fs from 'fs';
import gulp from 'gulp';
import jshint from 'gulp-jshint';
import memoize from 'gulp-memoize';

const jsHintVersion = '2.4.1';
const jshintOptions = fs.readFileSync('.jshintrc');

function makeHashKey(file) {
    // Key off the file contents, jshint version and options
    return `${file.contents.toString('utf8')}${jshintVersion}${jshintOptions}`;
}

gulp.task('lint', () =>
    gulp.src('src/**/*.js')
        .pipe(memoize(
            // Target plugin, the output of which will be memoized.
            jshint('.jshintrc'),
            // Options for `gulp-memoize` plugin.
            {
                key: makeHashKey,
                verbose: true
            }
        ))
        .pipe(jshint.reporter('default'))
});

API

memoize(pluginToMemoize [, options])

pluginToMemoize

Target task, the output of which will be memoized.

options

Options for gulp-memoize plugin.

options.verbose

[Optional] Should the plugin report on every restored file

  • Defaults to false
options.key

[Optional] What to use to determine the uniqueness of an input file for this task.

  • Can return a string or a Promise that resolves to a string.

  • The result of this method is converted to a unique MD5 hash automatically; no need to do this yourself.

  • Defaults to file.contents if a Buffer, or undefined if a Stream.

options.memo

[Optional] Custom Memo instance. Default is new Map<string, Vinyl[]>().

  • Should implement the Map interface

  • Keys of the Memo are strings, values are arrays of Vinyl files

options.clearMemoOnFlush

[Optional] Should the memo be cleared after the task execution

  • Defaults to true

License

The MIT License (MIT)

Copyright (c) 2021 - present Maksym Nesterov Copyright (c) 2014 - present Jacob Gable