Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"ts-node": "^10.9.1",
"tsx": "^4.19.1",
"typescript": "~5.3.3",
"vite": "^4.3.9"
"vite": "^5.1.8"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "ojW3Hm/UhUzUs35jVfoI9+xEsy0zoVLFzfZGZ3dgZeQ=",
"shasum": "avXYAFNUoZDWNqt3rKZk9Riar2A4CgivhMZ0f9IiJ1o=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "kYRZmgdWbCe5U9mK1DBn4r1eh2VFI6TBolStHsYnwqQ=",
"shasum": "fUSSEUMScCnu/fdxmTababNPi+biQ8GE3wSDGm0K5Rs=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "qHCkTRpYoHUFtt9Dd0nxQyw7Eblv0e5znQ39NszlJOo=",
"shasum": "FvXAB5gp1fAoAMIBcYwLOwXmvTv9nvcx1TTgulBwzck=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "arWIxnocunv/5esPgYG068vzZzyBxg/FcbiDILeyLCs=",
"shasum": "zJkV5uvFKn769KntHD2tyY4PQUWO5mabwm6ShOZHX24=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/cronjobs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "B0eoXOpzU2Cts5d42w11AdvgClmS/une3zXQ9vHnJgU=",
"shasum": "PKjvYA9WssjMiwXeWg8k/Lrk1IHi/xbsQBSb7K7RZP4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "6IGgmJV+Gc1jdmr4M+Gc0SHBfu2Ieuq3QFCIa5t7vYY=",
"shasum": "xs/PkETITma3DfIQxwjW9A4eS9DB0JBGZIlhn6ov9s0=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "T/7hin+Vhg0SdK8RxXvonPhkTRe/luTzGwqfWrH/8MQ=",
"shasum": "3PCb10VNOR84Mqu3Z1Bkkrgg6nklzND+xIVdlEJe6XE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"prettier-plugin-packagejson": "^2.5.2",
"ts-node": "^10.9.1",
"typescript": "~5.3.3",
"webpack": "^5.88.0"
"webpack": "^5.94.0"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "U4iQEpD4FcKBClMoFgESj8aVZy/io4bR3T3xC8D1J/c=",
"shasum": "ZjIxKqXhfxALpgEBAhNICpCxwAQet7keipSQ+/TzatI=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "U5/rIXgTqaoXVudqfJyK1cglKFXyLKKal+hj4mk+i0g=",
"shasum": "61FewSqYVt0K2S9B3iob5V8hX+QXpy8/ooiMrOAE+fE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "vFbFG/f0wOk+xcAypUssW9LJST38Ul9Oq4fZRaHq50E=",
"shasum": "BiysyCmH47rBg16bKg8opbe/H3ik9r8aqkqsssBHb04=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-file/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "IkhZaFe3JhsDGcjO+/2CettMLck0yQUby8I13U2BUpU=",
"shasum": "pppvJ7TRiZpE70okGRkQaze5/NQm2dFozVYpomw12yM=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/home-page/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "Z0ZFlsmVKHo2lrZKpCfrdLUjUe7kuXHUxqd4vm277nI=",
"shasum": "gPLRzm2ZegYyjQi0HiGerPUCpu5FnLHnuRNNcz32DKE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/images/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "qDnkVe1UEihxCX8jKtc5kU6Xsz2mszjC9abLo9gxyqQ=",
"shasum": "rf5e4EY7ilLe8k8aOFJEnx0B8iI+7VXd9e3TNfPGLzg=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "7hLctw66Qa64WB7Y1kdJnqQFIkPt5hYvdNj9l/00E78=",
"shasum": "mC5Jz/a0jlfFTx70E887n/QWiP1wPwiuyEalNlX092w=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "G6qDbbY6gfcNXbwavYeLOcX5dZRXGrzR4OVtIMWizwg=",
"shasum": "h2iZXMs/X6gx+e5CROEoHEBJsvBtZtDNq4wqqRc/QIE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "UMY4+tvOkzhxFhBE7v1hIpSANISaTCM6BcjwniuxKUc=",
"shasum": "fnelgv9DW2nwzGRmbTU/Qnkxj9qZnGD4/4FTiNHY6DA=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/json-rpc/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "4i/96yKvEMlwjGd6BvcuYwwGtol1YZEZTZ2dOcGOtxs=",
"shasum": "KsuzsP4WTmn3Xk6x33I5l7Hft9SQzp2tn7yXTceS8VE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/jsx/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "TN8Dci3rNymh4EFBhXvzqbfzTGIDjemAF1WrqTXbkGQ=",
"shasum": "slar8QQ5YzNRhmdI00ZOdZuZcBI65Hsz6gpDjGz/vv4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "hE4IbH9CWs7QS8JnUWsReyG3TuZG9Z00/K2kCRsfID4=",
"shasum": "qEWdkquU5pMpr+E+ZBdmIu54/qWQovaMmEadOmU8ifg=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "9n3dGpYT/s9CwkwfGTkOgMA8jvrkLg9KVP2Y/KsrWkg=",
"shasum": "fgibIC0dhDC1oQs54ddOGN9PqRk8n6btqM6th0YdJ3c=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "FLqA/O/vfM7Cbv07OMjLbf5wnJ6xiDVOicRc62DN6Dw=",
"shasum": "6ucWBMOUDTSCV/tMaiK2SWJURzhi9mE2SQ+4NxWr/h4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "vgZf2fdTM9fTAFroi78267SHtaEeTJLTNa/hobO22s0=",
"shasum": "R76lfc9SmLclkeHo+FtsX6XMBx6ZE/PMEZErkRDI3P4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "i8jxIqiwe7OvwEP32oFIFKUu3EfnHnbFbyRXeqIKPiY=",
"shasum": "bwCMwGzzYQBIvOYdHlnASxBQcHdpjPvx9ivZ3nrBTbw=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "9kEcCvm7AAgm49TqYDjUdiqLlnNqjfXipUgtI2ndBwQ=",
"shasum": "qbsPqAwsSVu1zv5gJicETzNESOiq0XPF6esXl4Akyeo=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/send-flow/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "ycKXLBkX4carLSIYGnuc+oHDin/2qSUNNQ/cfW0wt4o=",
"shasum": "WALCsYdlHYYttDSkh+QgN8l0PFUBt8FQ0d40FzHdwu4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "AlY+qEYeU/GmMR7tvBEpuFXk6YWdWx+hhszOsnGyQcU=",
"shasum": "rinG6wZIBq2te8bid8lBOfU/BP2k8GIx5aAFJ328w4c=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "lxnpksH+gsCRKZfgDBv66VXlSjbS25gSS/r+hOiO9RQ=",
"shasum": "2o/l002SXe34tA7XscwothuybtqB90fhbYszdVJZBOo=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/wasm/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "ZLNLyIw7vPg+geDBqmngSU6+92UjZPhG6on34Ij3+Nc=",
"shasum": "PYmb1pGNecXkrzR9YkK956Dp1AKaxu0abeJXcCdR9AU=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"terser-webpack-plugin": "^5.3.9",
"ts-node": "^10.9.1",
"typescript": "~5.3.3",
"webpack": "^5.88.0",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "l5ZrPChhTClz9FfuqCVCk95v7zwDzchZpWmHs/4Iji0=",
"shasum": "FW2vWNnyxwjJaXmuAqTf3T5fqKobUwSSPWCDQ7AUggk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"url": "^0.11.1",
"util": "^0.12.5",
"vm-browserify": "^1.1.2",
"webpack": "^5.88.0",
"webpack": "^5.94.0",
"webpack-merge": "^5.9.0",
"yargs": "^17.7.1"
},
Expand Down
20 changes: 13 additions & 7 deletions packages/snaps-cli/src/commands/build/implementation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import normalFs from 'fs';
import { dirname, resolve } from 'path';
import type { Configuration } from 'webpack';
import type webpackModule from 'webpack';

import { getMockConfig } from '../../test-utils';
import { getCompiler } from '../../webpack';
Expand Down Expand Up @@ -36,8 +37,10 @@ jest.mock('../../webpack', () => ({
.requireActual<typeof webpack>('../../webpack')
.getCompiler(...args);

compiler.inputFileSystem = normalFs;
compiler.outputFileSystem = normalFs;
compiler.inputFileSystem =
normalFs as unknown as webpackModule.InputFileSystem;
compiler.outputFileSystem =
normalFs as unknown as webpackModule.OutputFileSystem;

return compiler;
}),
Expand All @@ -48,11 +51,14 @@ jest.mock('../../webpack/utils', () => ({
getDefaultLoader: jest.fn<
ReturnType<typeof utils.getDefaultLoader>,
Parameters<typeof utils.getDefaultLoader>
>(async (config) => {
>(async (config): ReturnType<typeof utils.getDefaultLoader> => {
if (config.legacy) {
return {
loader: BROWSERIFY_LOADER_PATH,
options: config.legacy,
options: {
...config.legacy,
fn: jest.fn(),
},
};
}

Expand Down Expand Up @@ -129,7 +135,7 @@ describe('build', () => {

const output = await fs.readFile('/snap/output.js', 'utf8');
expect(output).toMatchInlineSnapshot(
`"(()=>{var r={67:r=>{r.exports.onRpcRequest=({request:r})=>{console.log("Hello, world!");const{method:e,id:o}=r;return e+o}}},e={};var o=function o(t){var s=e[t];if(void 0!==s)return s.exports;var n=e[t]={exports:{}};return r[t](n,n.exports,o),n.exports}(67);module.exports=o})();"`,
`"(()=>{var r={157:r=>{r.exports.onRpcRequest=({request:r})=>{console.log("Hello, world!");const{method:e,id:o}=r;return e+o}}},e={};var o=function o(t){var s=e[t];if(void 0!==s)return s.exports;var n=e[t]={exports:{}};return r[t](n,n.exports,o),n.exports}(157);module.exports=o})();"`,
);
});

Expand Down Expand Up @@ -165,7 +171,7 @@ describe('build', () => {
expect(output).toMatchInlineSnapshot(`
"(() => {
var __webpack_modules__ = {
67: module => {
157: module => {
module.exports.onRpcRequest = ({
request
}) => {
Expand All @@ -190,7 +196,7 @@ describe('build', () => {
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
return module.exports;
}
var __webpack_exports__ = __webpack_require__(67);
var __webpack_exports__ = __webpack_require__(157);
module.exports = __webpack_exports__;
})();"
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
getSnapManifest,
} from '@metamask/snaps-utils/test-utils';
import normalFs from 'fs';
import type webpackModule from 'webpack';

import { getMockConfig } from '../../test-utils';
import { getCompiler } from '../../webpack';
Expand All @@ -24,8 +25,10 @@ jest.mock('../../webpack', () => ({
.requireActual<typeof webpack>('../../webpack')
.getCompiler(...args);

compiler.inputFileSystem = normalFs;
compiler.outputFileSystem = normalFs;
compiler.inputFileSystem =
normalFs as unknown as webpackModule.InputFileSystem;
compiler.outputFileSystem =
normalFs as unknown as webpackModule.OutputFileSystem;

return compiler;
}),
Expand Down Expand Up @@ -57,6 +60,7 @@ describe('watch', () => {
// @ts-expect-error - Partial mock.
mock.mockImplementationOnce(() => ({
watch: watchMock,
watching: {},
}));

await watch(
Expand Down
Loading
Loading