Skip to content

Commit

Permalink
deps: ssri@9.0.1
Browse files Browse the repository at this point in the history
* store emitted events and re-emit them for late listeners
  • Loading branch information
wraithgar committed May 19, 2022
1 parent 743b48f commit 8bf728e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
27 changes: 26 additions & 1 deletion node_modules/ssri/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const getOptString = options => !options || !options.length

const _onEnd = Symbol('_onEnd')
const _getOptions = Symbol('_getOptions')
const _emittedSize = Symbol('_emittedSize')
const _emittedIntegrity = Symbol('_emittedIntegrity')
const _emittedVerified = Symbol('_emittedVerified')

class IntegrityStream extends MiniPass {
constructor (opts) {
super()
Expand Down Expand Up @@ -63,6 +67,22 @@ class IntegrityStream extends MiniPass {
this.optString = getOptString(options)
}

on (ev, handler) {
if (ev === 'size' && this[_emittedSize]) {
return handler(this[_emittedSize])
}

if (ev === 'integrity' && this[_emittedIntegrity]) {
return handler(this[_emittedIntegrity])
}

if (ev === 'verified' && this[_emittedVerified]) {
return handler(this[_emittedVerified])
}

return super.on(ev, handler)
}

emit (ev, data) {
if (ev === 'end') {
this[_onEnd]()
Expand Down Expand Up @@ -103,9 +123,14 @@ class IntegrityStream extends MiniPass {
err.sri = this.sri
this.emit('error', err)
} else {
this[_emittedSize] = this.size
this.emit('size', this.size)
this[_emittedIntegrity] = newSri
this.emit('integrity', newSri)
match && this.emit('verified', match)
if (match) {
this[_emittedVerified] = match
this.emit('verified', match)
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions node_modules/ssri/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ssri",
"version": "9.0.0",
"version": "9.0.1",
"description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.",
"main": "lib/index.js",
"files": [
Expand Down Expand Up @@ -50,14 +50,14 @@
},
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.2.2",
"@npmcli/template-oss": "3.5.0",
"tap": "^16.0.1"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.2.2"
"version": "3.5.0"
}
}
14 changes: 7 additions & 7 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"readdir-scoped-modules": "^1.1.0",
"rimraf": "^3.0.2",
"semver": "^7.3.7",
"ssri": "^9.0.0",
"ssri": "^9.0.1",
"tar": "^6.1.11",
"text-table": "~0.2.0",
"tiny-relative-date": "^1.3.0",
Expand Down Expand Up @@ -6793,9 +6793,9 @@
}
},
"node_modules/ssri": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.0.tgz",
"integrity": "sha512-Y1Z6J8UYnexKFN1R/hxUaYoY2LVdKEzziPmVAFKiKX8fiwvCJTVzn/xYE9TEWod5OVyNfIHHuVfIEuBClL/uJQ==",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz",
"integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==",
"inBundle": true,
"dependencies": {
"minipass": "^3.1.1"
Expand Down Expand Up @@ -14720,9 +14720,9 @@
}
},
"ssri": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.0.tgz",
"integrity": "sha512-Y1Z6J8UYnexKFN1R/hxUaYoY2LVdKEzziPmVAFKiKX8fiwvCJTVzn/xYE9TEWod5OVyNfIHHuVfIEuBClL/uJQ==",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz",
"integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==",
"requires": {
"minipass": "^3.1.1"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"readdir-scoped-modules": "^1.1.0",
"rimraf": "^3.0.2",
"semver": "^7.3.7",
"ssri": "^9.0.0",
"ssri": "^9.0.1",
"tar": "^6.1.11",
"text-table": "~0.2.0",
"tiny-relative-date": "^1.3.0",
Expand Down

0 comments on commit 8bf728e

Please sign in to comment.