Dependency tracing for HTML, CSS, and JS
Last updated a year ago by seb .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @commonshost/sherlock 
SYNC missed versions from official npm registry.

@commonshost/sherlock ????

Dependency tracing tool for HTML, CSS, and JS files. This can be used with HTTP/2 Server Push to serve websites faster.


Provide a directory path to the folder that includes HTML, CSS, and JS files.

Sherlock returns a Promise which resolves with an array of errors and dependency objects.

Each dependency object has the properties type, parent, and path.

Image dependencies may include the loading property, if set in the HTML source.

Each error object has the properties error and parent.

const sherlock = require('@commonshost/sherlock')

const dependencies = await sherlock(dir)
// [
//   {
//     type: 'application/javascript',
//     parent: '/public/app.js',
//     path:'/public/src/lib.js'
//   },
//   ...
// ]


An Error instance containing some information about the problem.


SyntaxError from Acorn with pos and loc properties and a meaningful message string.


A string containing the MIME type of the dependency. Can be a specific MIME type of a wildcard.


  • application/javascript
  • image/png
  • image/*
  • font/*
  • text/css


A string containing the absolute path to the file referencing the dependency.


  • /some/where/index.html
  • /some/where/app.js
  • /some/where/styles.css


A string containing the absolute path to the referenced file, or external URL. Includes any query string (i.e. ?query) or hash fragment (i.e. #hash).


  • /some/where/images/photo.jpeg
  • /some/where/assets/typeface.woff2
  • /some/where/assets/typeface.woff2?query-string
  • /some/where/assets/typeface.woff2#hash-fragment
  • https://example.net/external-resource


A string containing the value of the loading HTML attribute. Should be either lazy or eager, but the actual HTML value is provided even if it differs so the robustness principle applies.

See Also


Made with ❤️ by Sophie Yang and Sebastiaan Deckers for the ???? Commons Host project.

Current Tags

  • 2.2.0                                ...           latest (a year ago)

6 Versions

  • 2.2.0                                ...           a year ago
  • 2.1.1                                ...           a year ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Today 0
This Week 0
This Month 8
Last Day 0
Last Week 6
Last Month 3
Dependencies (6)
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |