Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-05-19 21:04:13 +0300
committerLuke Karrys <luke@lukekarrys.com>2022-05-20 00:14:58 +0300
commit0df3011ec59ba76c12fb8fbfb29ff4d601cc4bdb (patch)
tree241b65d6d4b999b481adaa736433dbdf2e0614cb /node_modules
parentf3b0a2407c7e213b1660ef7024c861dcb0eacb50 (diff)
deps: ssri@9.0.1
* store emitted events and re-emit them for late listeners
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/ssri/lib/index.js27
-rw-r--r--node_modules/ssri/package.json6
2 files changed, 29 insertions, 4 deletions
diff --git a/node_modules/ssri/lib/index.js b/node_modules/ssri/lib/index.js
index e2732fd07..1443137cb 100644
--- a/node_modules/ssri/lib/index.js
+++ b/node_modules/ssri/lib/index.js
@@ -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()
@@ -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]()
@@ -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)
+ }
}
}
}
diff --git a/node_modules/ssri/package.json b/node_modules/ssri/package.json
index 84448afc3..91c1f9197 100644
--- a/node_modules/ssri/package.json
+++ b/node_modules/ssri/package.json
@@ -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": [
@@ -50,7 +50,7 @@
},
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
- "@npmcli/template-oss": "3.2.2",
+ "@npmcli/template-oss": "3.5.0",
"tap": "^16.0.1"
},
"engines": {
@@ -58,6 +58,6 @@
},
"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"
}
}