Skip to content

Commit c18fa79

Browse files
rekmarksMakMuftic
andauthored
Fix strip-comments (#189)
### Description Based on the discussion ChainSafe/filsnap#88 and some further investigation, I realized that the problem origin is inside the library used for stripping comments. The problem occurs if there are double quotes inside the comment, and this issue has been created inside `strip-comments` lib (jonschlinkert/strip-comments#49). Unfortunately, this PR with the fix is stale for some time now, so inside our fork of snaps-cli we used a forked version of `strip-comments` library. ### Changes In this PR I replaced `strip-comments` with our [fork](https://github.com/NodeFactoryIo/strip-comments) that: - fixes a bug with double quotes inside the comment - already contains types, so no need for importing them Co-authored-by: Mak Muftic <mak@chainsafe.io>
1 parent cc6fe61 commit c18fa79

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

packages/snap-examples/examples/bls-signer/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps-skunkworks.git"
88
},
99
"source": {
10-
"shasum": "gbEjrhR+Q39xUlngLKJ0w/8q5ucHdKTx7Q8xqmRf8Mk=",
10+
"shasum": "NA9A+E9XmiUC3o3T0ylGM8oLpJM3SdnQC2r9Rk0Gm4g=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/snap-examples/examples/ethers-js/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps-skunkworks.git"
88
},
99
"source": {
10-
"shasum": "dF1UV3/wsSWbOLorgsTxxMfC5VTCvZV+UawSY9VSZCk=",
10+
"shasum": "S1r/EPzzwTLXgIR7Pi1SYtliGu9LuLaFDNWyQKMQUXE=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/snaps-cli/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@metamask/snap-controllers": "^0.6.3",
40+
"@nodefactory/strip-comments": "^1.0.2",
4041
"browserify": "^17.0.0",
4142
"chokidar": "^3.0.2",
4243
"fast-deep-equal": "^2.0.1",
@@ -47,7 +48,6 @@
4748
"serve-handler": "^6.1.1",
4849
"ses": "^0.15.3",
4950
"slash": "^3.0.0",
50-
"strip-comments": "^2.0.1",
5151
"yargs": "^16.2.0",
5252
"yargs-parser": "^20.2.2"
5353
},
@@ -66,7 +66,6 @@
6666
"@types/node": "^14.14.25",
6767
"@types/rimraf": "^3.0.0",
6868
"@types/serve-handler": "^6.1.0",
69-
"@types/strip-comments": "^2.0.0",
7069
"@types/yargs": "^15.0.12",
7170
"@typescript-eslint/eslint-plugin": "^4.28.1",
7271
"@typescript-eslint/parser": "^4.28.1",

packages/snaps-cli/src/cmds/build/bundleUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createWriteStream } from 'fs';
2-
import stripComments from 'strip-comments';
2+
import stripComments from '@nodefactory/strip-comments';
33
import { writeError } from '../../utils/misc';
44
import { Option, YargsArgs } from '../../types/yargs';
55

yarn.lock

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,11 @@
24822482
resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c"
24832483
integrity sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q==
24842484

2485+
"@nodefactory/strip-comments@^1.0.2":
2486+
version "1.0.2"
2487+
resolved "https://registry.yarnpkg.com/@nodefactory/strip-comments/-/strip-comments-1.0.2.tgz#531ee3d53a1d22f14508e200f83f1e54235b1454"
2488+
integrity sha512-dcZC7N0xZfm2wnwnv0xyK+ak6qkonvxDypeFPLUP88kqvWzskOfv53tvEoAUGFeoddjOt2m56mtayb1gM/VY6A==
2489+
24852490
"@nodelib/fs.scandir@2.1.4":
24862491
version "2.1.4"
24872492
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69"
@@ -2822,11 +2827,6 @@
28222827
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff"
28232828
integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==
28242829

2825-
"@types/strip-comments@^2.0.0":
2826-
version "2.0.1"
2827-
resolved "https://registry.yarnpkg.com/@types/strip-comments/-/strip-comments-2.0.1.tgz#0395c848a57e679c221b6bf48f87433dc4389b50"
2828-
integrity sha512-7xjBu+wvKSRHSmgZoRAfUBZMIupd7634b2+uI2qeBDUvfoX+VELjuWCzlL6CF40eG/TGKwU+pqoJfvcvs3fzKA==
2829-
28302830
"@types/tar-stream@^2.2.2":
28312831
version "2.2.2"
28322832
resolved "https://registry.yarnpkg.com/@types/tar-stream/-/tar-stream-2.2.2.tgz#be9d0be9404166e4b114151f93e8442e6ab6fb1d"
@@ -11900,11 +11900,6 @@ strip-bom@^4.0.0:
1190011900
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878"
1190111901
integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==
1190211902

11903-
strip-comments@^2.0.1:
11904-
version "2.0.1"
11905-
resolved "https://registry.yarnpkg.com/strip-comments/-/strip-comments-2.0.1.tgz#4ad11c3fbcac177a67a40ac224ca339ca1c1ba9b"
11906-
integrity sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==
11907-
1190811903
strip-eof@^1.0.0:
1190911904
version "1.0.0"
1191011905
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"

0 commit comments

Comments
 (0)