Deno can store and check subresource integrity for modules using a small JSON file. Use the --lock=lock.json
to enable and specify lock file checking. To update or create a lock use . The --lock=lock.json
tells Deno what the lock file to use is, while the --lock-write
is used to output dependency hashes to the lock file (--lock-write
must be used in conjunction with --lock
).
A might look like this, storing a hash of the file against the dependency:
`
`
A typical workflow will look like this:
`
`
Then:
`
`
`
`
Like caching above, you can also use the --lock=lock.json
option during use of the deno run
sub command, validating the integrity of any locked modules during the run. Remember that this only validates against dependencies previously added to the lock.json
file. New dependencies will be cached but not validated.
You can take this a step further as well by using the --cached-only
flag to require that remote dependencies are already cached.
`
This will fail if there are any dependencies in the dependency tree for mod.ts which are not yet cached.