From 88d85d43bd1c164a28d95c28a803c2cd566da4b0 Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Wed, 5 May 2021 16:07:48 -0700 Subject: [PATCH] @metamask/post-message-stream@4.0.0 (#10989) --- app/scripts/contentscript.js | 6 +++--- app/scripts/inpage.js | 4 ++-- package.json | 2 +- yarn.lock | 38 +++++++++++++++++++++++++++--------- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index a404a9cd8..236952f61 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -1,6 +1,6 @@ import querystring from 'querystring'; import pump from 'pump'; -import LocalMessageDuplexStream from 'post-message-stream'; +import { WindowPostMessageStream } from '@metamask/post-message-stream'; import ObjectMultiplex from 'obj-multiplex'; import extension from 'extensionizer'; import PortStream from 'extension-port-stream'; @@ -57,7 +57,7 @@ function injectScript(content) { */ async function setupStreams() { // the transport-specific streams for communication between inpage and background - const pageStream = new LocalMessageDuplexStream({ + const pageStream = new WindowPostMessageStream({ name: CONTENT_SCRIPT, target: INPAGE, }); @@ -89,7 +89,7 @@ async function setupStreams() { // TODO:LegacyProvider: Delete // handle legacy provider - const legacyPageStream = new LocalMessageDuplexStream({ + const legacyPageStream = new WindowPostMessageStream({ name: LEGACY_CONTENT_SCRIPT, target: LEGACY_INPAGE, }); diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index 72bbf7901..498063145 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -32,7 +32,7 @@ cleanContextForImports(); /* eslint-disable import/first */ import log from 'loglevel'; -import LocalMessageDuplexStream from 'post-message-stream'; +import { WindowPostMessageStream } from '@metamask/post-message-stream'; import { initializeProvider } from '@metamask/inpage-provider'; restoreContextAfterImports(); @@ -44,7 +44,7 @@ log.setDefaultLevel(process.env.METAMASK_DEBUG ? 'debug' : 'warn'); // // setup background connection -const metamaskStream = new LocalMessageDuplexStream({ +const metamaskStream = new WindowPostMessageStream({ name: 'metamask-inpage', target: 'metamask-contentscript', }); diff --git a/package.json b/package.json index 9ca5d612f..9abe534f7 100644 --- a/package.json +++ b/package.json @@ -160,7 +160,7 @@ "nonce-tracker": "^1.0.0", "obj-multiplex": "^1.0.0", "pify": "^5.0.0", - "post-message-stream": "^3.0.0", + "@metamask/post-message-stream": "^4.0.0", "promise-to-callback": "^1.0.0", "prop-types": "^15.6.1", "pubnub": "4.27.3", diff --git a/yarn.lock b/yarn.lock index 056b64bc2..8019a5667 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2786,6 +2786,13 @@ readable-stream "^2.2.2" through2 "^2.0.3" +"@metamask/post-message-stream@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@metamask/post-message-stream/-/post-message-stream-4.0.0.tgz#72f120e562346ca86ccc9b3684023ad44265f0df" + integrity sha512-r0JcoWXNuHycProx8ClxiIElJY/GVb/0/WWXTMsZu7qDejLo52VNXlwfydCdVjbMXeoT2nK1Yt3d5gjmHy5BWw== + dependencies: + readable-stream "2.3.3" + "@metamask/safe-event-emitter@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" @@ -20684,13 +20691,6 @@ posix-character-classes@^0.1.0: resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= -post-message-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/post-message-stream/-/post-message-stream-3.0.0.tgz#90d9f54bd209e6b6f5d74795b87588205b547048" - integrity sha1-kNn1S9IJ5rb110eVuHWIIFtUcEg= - dependencies: - readable-stream "^2.1.4" - postcss-flexbugs-fixes@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/postcss-flexbugs-fixes/-/postcss-flexbugs-fixes-4.1.0.tgz#e094a9df1783e2200b7b19f875dcad3b3aff8b20" @@ -21011,7 +21011,7 @@ probe-image-size@5.0.0: request "^2.83.0" stream-parser "~0.3.1" -process-nextick-args@^1.0.6, process-nextick-args@^1.0.7: +process-nextick-args@^1.0.6, process-nextick-args@^1.0.7, process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" integrity sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M= @@ -22232,7 +22232,7 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -"readable-stream@1 || 2", readable-stream@2, readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6, readable-stream@^2.2.8, readable-stream@^2.2.9, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.3, readable-stream@~2.3.5, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@2, readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6, readable-stream@^2.2.8, readable-stream@^2.2.9, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.3, readable-stream@~2.3.5, readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -22264,6 +22264,19 @@ readable-stream@1.1.x, readable-stream@^1.0.33: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readable-stream@2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" + integrity sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + safe-buffer "~5.1.1" + string_decoder "~1.0.3" + util-deprecate "~1.0.1" + readable-stream@~1.0.15: version "1.0.34" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" @@ -24582,6 +24595,13 @@ string_decoder@^1.0.0, string_decoder@^1.1.1: dependencies: safe-buffer "~5.1.0" +string_decoder@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" + integrity sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ== + dependencies: + safe-buffer "~5.1.0" + string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"