How to use static-module - 1 common examples

To help you get started, we’ve selected a few static-module examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alex-saunders / ecmasyntax.io / src / server / routes.js View on Github external
const input = fs.createReadStream(path.join('src', 'client', 'js', 'sw.js'));

  let precacheassetsToCache = Object.values(manifest).filter((asset) => {
    return !asset.startsWith('/static/icons')});

  const precacheHash  = crypto.createHash('md5');

  for (let asset of precacheassetsToCache) {
    precacheHash.update(asset);
  }    

  const precacheDigest  = precacheHash.digest('hex');

  res.set('Content-Type', 'application/javascript');  
  input.pipe(
    staticModule({
      'static-precache-version': () => JSON.stringify(precacheDigest),
      'static-precache': () => JSON.stringify(precacheassetsToCache),
      'static-runtime': () => JSON.stringify(RUNTIME_CACHE),
    })
  ).pipe(res);
});

static-module

convert module usage to inline expressions

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis

Popular static-module functions