From 6ba5a4a4afbdae2165263c7b9d1c4ec3827176c4 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Thu, 22 Feb 2024 11:52:04 +0100 Subject: [PATCH] Fix build errors --- packages/create-snap/src/cmds/init/initHandler.ts | 2 +- packages/examples/packages/bip32/snap.manifest.json | 2 +- packages/examples/packages/bip44/snap.manifest.json | 2 +- .../examples/packages/cronjobs/snap.manifest.json | 2 +- .../examples/packages/dialogs/snap.manifest.json | 2 +- .../examples/packages/ethers-js/snap.manifest.json | 2 +- .../examples/packages/get-entropy/snap.manifest.json | 2 +- .../examples/packages/home-page/snap.manifest.json | 2 +- packages/examples/packages/images/snap.manifest.json | 2 +- .../packages/interactive-ui/snap.manifest.json | 2 +- .../packages/core-signer/snap.manifest.json | 2 +- .../packages/lifecycle-hooks/snap.manifest.json | 2 +- .../packages/signature-insights/snap.manifest.json | 2 +- .../packages/transaction-insights/snap.manifest.json | 2 +- packages/snaps-browserify-plugin/src/plugin.ts | 4 ++-- packages/snaps-cli/src/commands/build/build.ts | 2 +- packages/snaps-cli/src/commands/eval/eval.ts | 2 +- .../snaps-cli/src/commands/eval/implementation.ts | 2 +- .../src/commands/manifest/implementation.ts | 2 +- packages/snaps-cli/src/commands/manifest/manifest.ts | 2 +- packages/snaps-cli/src/commands/watch/watch.ts | 2 +- packages/snaps-cli/src/config.ts | 2 +- packages/snaps-cli/src/webpack/server.ts | 2 +- packages/snaps-controllers/package.json | 12 ++++++------ .../snaps-controllers/src/{index.node.ts => node.ts} | 2 +- .../src/{index.react-native.ts => react-native.ts} | 2 +- .../snaps-controllers/src/services/index.node.ts | 2 -- .../NodeProcessExecutionService.test.ts | 0 .../{node => node-js}/NodeProcessExecutionService.ts | 0 .../NodeThreadExecutionService.test.ts | 0 .../{node => node-js}/NodeThreadExecutionService.ts | 0 .../src/services/{node => node-js}/index.ts | 0 packages/snaps-controllers/src/services/node.ts | 2 ++ .../{index.react-native.ts => react-native.ts} | 0 packages/snaps-jest/src/internals/server.ts | 2 +- .../src/internals/simulation/simulation.ts | 2 +- packages/snaps-rollup-plugin/src/plugin.ts | 4 ++-- packages/snaps-utils/package.json | 6 +++--- packages/snaps-utils/src/fs.ts | 2 +- packages/snaps-utils/src/manifest/manifest.ts | 2 +- .../src/manifest/{index.node.ts => node.ts} | 0 packages/snaps-utils/src/{index.node.ts => node.ts} | 4 ++-- .../src/virtual-file/{index.node.ts => node.ts} | 0 packages/snaps-webpack-plugin/src/plugin.ts | 4 ++-- tsconfig.packages.json | 1 + 45 files changed, 48 insertions(+), 47 deletions(-) rename packages/snaps-controllers/src/{index.node.ts => node.ts} (58%) rename packages/snaps-controllers/src/{index.react-native.ts => react-native.ts} (53%) delete mode 100644 packages/snaps-controllers/src/services/index.node.ts rename packages/snaps-controllers/src/services/{node => node-js}/NodeProcessExecutionService.test.ts (100%) rename packages/snaps-controllers/src/services/{node => node-js}/NodeProcessExecutionService.ts (100%) rename packages/snaps-controllers/src/services/{node => node-js}/NodeThreadExecutionService.test.ts (100%) rename packages/snaps-controllers/src/services/{node => node-js}/NodeThreadExecutionService.ts (100%) rename packages/snaps-controllers/src/services/{node => node-js}/index.ts (100%) create mode 100644 packages/snaps-controllers/src/services/node.ts rename packages/snaps-controllers/src/services/{index.react-native.ts => react-native.ts} (100%) rename packages/snaps-utils/src/manifest/{index.node.ts => node.ts} (100%) rename packages/snaps-utils/src/{index.node.ts => node.ts} (68%) rename packages/snaps-utils/src/virtual-file/{index.node.ts => node.ts} (100%) diff --git a/packages/create-snap/src/cmds/init/initHandler.ts b/packages/create-snap/src/cmds/init/initHandler.ts index 978ff7f256..d1ff620d47 100644 --- a/packages/create-snap/src/cmds/init/initHandler.ts +++ b/packages/create-snap/src/cmds/init/initHandler.ts @@ -4,7 +4,7 @@ import { readJsonFile, createSnapManifest, logInfo, -} from '@metamask/snaps-utils'; +} from '@metamask/snaps-utils/node'; import type { SemVerRange, SemVerVersion } from '@metamask/utils'; import { satisfiesVersionRange } from '@metamask/utils'; import { promises as fs } from 'fs'; diff --git a/packages/examples/packages/bip32/snap.manifest.json b/packages/examples/packages/bip32/snap.manifest.json index 36387471f9..4cc58aa5c5 100644 --- a/packages/examples/packages/bip32/snap.manifest.json +++ b/packages/examples/packages/bip32/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "AaLbshZePKcSV2NORnmd5AjzkX5vNQToD3PaE4YpUUQ=", + "shasum": "GHRzqflZym3SPlVeCxzScAIEaSFxNhjnwa4kpMxFeFg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/bip44/snap.manifest.json b/packages/examples/packages/bip44/snap.manifest.json index e17638fde4..b470ce6951 100644 --- a/packages/examples/packages/bip44/snap.manifest.json +++ b/packages/examples/packages/bip44/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "q5WeZJXrE5mgP2Z6Fo/aJrVuspPsQgsUn3/SmHuwsGY=", + "shasum": "lVRDLNksOgfZVJGjbK+s1LTow+4dMEZqTHGUL9xOw+0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/cronjobs/snap.manifest.json b/packages/examples/packages/cronjobs/snap.manifest.json index 17f81c4262..41ff325d8b 100644 --- a/packages/examples/packages/cronjobs/snap.manifest.json +++ b/packages/examples/packages/cronjobs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "wXAAi/QR4BT1Gp6OiSqCpq+3U7pyRtMQ/LP9LeWwEPk=", + "shasum": "ECHg48b4/C0LiT7ztwfGYRan4QteV6Qudzp2/jQpSRI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/dialogs/snap.manifest.json b/packages/examples/packages/dialogs/snap.manifest.json index 28c14b03ed..16f1aa18eb 100644 --- a/packages/examples/packages/dialogs/snap.manifest.json +++ b/packages/examples/packages/dialogs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "EepV6igtZ0ZCX579Ws6f9u0/kYnp65+6OK1SgzCm9Dg=", + "shasum": "7G6c6lcj4N7eip21R2inwtLZpx+VB62zTtcSZ8pqRl8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethers-js/snap.manifest.json b/packages/examples/packages/ethers-js/snap.manifest.json index eefbaa62cd..080137c566 100644 --- a/packages/examples/packages/ethers-js/snap.manifest.json +++ b/packages/examples/packages/ethers-js/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "AjzlrjmJQTKwGM77EXcpEzjF9bsKK7up36BSA4qhasU=", + "shasum": "6c7lFhYNu3EgLQcnEPEicCYpCGyFTtcourWwPRcTYQo=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-entropy/snap.manifest.json b/packages/examples/packages/get-entropy/snap.manifest.json index e791889b5e..878c6bbabc 100644 --- a/packages/examples/packages/get-entropy/snap.manifest.json +++ b/packages/examples/packages/get-entropy/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "9jRaEw4/0RCp3b3oAI+PK2zcgwupdOnBhaL4zX4pKRg=", + "shasum": "aAeCBgJejxBjXg2v/SVChTxQKpgxY7Jic60HtuJdxlY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/home-page/snap.manifest.json b/packages/examples/packages/home-page/snap.manifest.json index 5c0b5cda2b..4ca2da8421 100644 --- a/packages/examples/packages/home-page/snap.manifest.json +++ b/packages/examples/packages/home-page/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "4LSF+30bmPlizM/wYBrq4dp72wkcca9rwYyqkz7ZPvY=", + "shasum": "rE1Oc5DDk8Z3DDw9SfgLPSVSZO3W4qTjvPYs2qk7jyQ=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/images/snap.manifest.json b/packages/examples/packages/images/snap.manifest.json index e5c384046f..ea093b98b1 100644 --- a/packages/examples/packages/images/snap.manifest.json +++ b/packages/examples/packages/images/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "v2cJ3d1fomwpUzSR+XZCLF88e5k0NOm5aVo8dftKKSU=", + "shasum": "tkZ42aamvqeYMwzCCu5UXgUo4krMU7vNshBQUsbSTmY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/interactive-ui/snap.manifest.json b/packages/examples/packages/interactive-ui/snap.manifest.json index 8f9274d49e..a04095031d 100644 --- a/packages/examples/packages/interactive-ui/snap.manifest.json +++ b/packages/examples/packages/interactive-ui/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "sKqHlIDCKGyzDhV7wlJTv7RR6m6lrJF4KgyoTacwYao=", + "shasum": "/wAEme4fXDW4C2mJ+eqPYvbOpe+oTNP4VO5n4Ku/hC8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json index 405ae93c48..2e1e8dbfeb 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "ojUZu1+nqCNBVoWHAaDkNRqWx+JVQfaKTOcyGDFD2Wg=", + "shasum": "LKYOTI3wR2ARS0zHFBW1h6uF1Fei6iQPUxLr0/86kRs=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/lifecycle-hooks/snap.manifest.json b/packages/examples/packages/lifecycle-hooks/snap.manifest.json index 2e23147114..c58761af93 100644 --- a/packages/examples/packages/lifecycle-hooks/snap.manifest.json +++ b/packages/examples/packages/lifecycle-hooks/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "cyr+aslb2DLAQOj2fs5pBwp3l1WKZU6muxrmhsbAtks=", + "shasum": "n4IS5lq5sO6odkmWV+4wpSn32RSfFRf1lyLtKvJUr2Y=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/signature-insights/snap.manifest.json b/packages/examples/packages/signature-insights/snap.manifest.json index 00dbb027a4..76ec50de9d 100644 --- a/packages/examples/packages/signature-insights/snap.manifest.json +++ b/packages/examples/packages/signature-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "cn53UKSOkd/fFq93Nwl2DBkMartFXwyyeoArG9Zxp8w=", + "shasum": "V4uDvqnGNvhekmL35/vqafgbnYQ3bOincBpaHEYKYaU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/transaction-insights/snap.manifest.json b/packages/examples/packages/transaction-insights/snap.manifest.json index 6216182a30..e19c79e99e 100644 --- a/packages/examples/packages/transaction-insights/snap.manifest.json +++ b/packages/examples/packages/transaction-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "fT6pbcejyNwb8cjgHPXgFWhpzCNYFuWUIrkuqLP70vU=", + "shasum": "yx3LFyPIvjAmf6eoYCIqgWZUiWm0im8CanzD0o3f8uE=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snaps-browserify-plugin/src/plugin.ts b/packages/snaps-browserify-plugin/src/plugin.ts index ea44aeb090..d04ee8fb15 100644 --- a/packages/snaps-browserify-plugin/src/plugin.ts +++ b/packages/snaps-browserify-plugin/src/plugin.ts @@ -1,11 +1,11 @@ -import type { PostProcessOptions } from '@metamask/snaps-utils'; +import type { PostProcessOptions } from '@metamask/snaps-utils/node'; import { checkManifest, evalBundle, logWarning, postProcessBundle, useTemporaryFile, -} from '@metamask/snaps-utils'; +} from '@metamask/snaps-utils/node'; import type { BrowserifyObject } from 'browserify'; import { fromSource } from 'convert-source-map'; import pathUtils from 'path'; diff --git a/packages/snaps-cli/src/commands/build/build.ts b/packages/snaps-cli/src/commands/build/build.ts index 1c43d9e358..e4166f98c2 100644 --- a/packages/snaps-cli/src/commands/build/build.ts +++ b/packages/snaps-cli/src/commands/build/build.ts @@ -1,4 +1,4 @@ -import { isFile } from '@metamask/snaps-utils'; +import { isFile } from '@metamask/snaps-utils/node'; import { resolve as pathResolve } from 'path'; import type { ProcessedConfig, ProcessedWebpackConfig } from '../../config'; diff --git a/packages/snaps-cli/src/commands/eval/eval.ts b/packages/snaps-cli/src/commands/eval/eval.ts index 928761b450..b82f7906a0 100644 --- a/packages/snaps-cli/src/commands/eval/eval.ts +++ b/packages/snaps-cli/src/commands/eval/eval.ts @@ -1,4 +1,4 @@ -import { isFile } from '@metamask/snaps-utils'; +import { isFile } from '@metamask/snaps-utils/node'; import { resolve } from 'path'; import type { ProcessedConfig } from '../../config'; diff --git a/packages/snaps-cli/src/commands/eval/implementation.ts b/packages/snaps-cli/src/commands/eval/implementation.ts index 901dc4c1aa..7db18e2d50 100644 --- a/packages/snaps-cli/src/commands/eval/implementation.ts +++ b/packages/snaps-cli/src/commands/eval/implementation.ts @@ -1,4 +1,4 @@ -import { evalBundle, SnapEvalError, indent } from '@metamask/snaps-utils'; +import { evalBundle, SnapEvalError, indent } from '@metamask/snaps-utils/node'; import { red } from 'chalk'; import { CommandError } from '../../errors'; diff --git a/packages/snaps-cli/src/commands/manifest/implementation.ts b/packages/snaps-cli/src/commands/manifest/implementation.ts index ce7a8d888d..8b98ca3af8 100644 --- a/packages/snaps-cli/src/commands/manifest/implementation.ts +++ b/packages/snaps-cli/src/commands/manifest/implementation.ts @@ -1,4 +1,4 @@ -import { checkManifest, indent } from '@metamask/snaps-utils'; +import { checkManifest, indent } from '@metamask/snaps-utils/node'; import { red, yellow } from 'chalk'; import type { Ora } from 'ora'; import { dirname } from 'path'; diff --git a/packages/snaps-cli/src/commands/manifest/manifest.ts b/packages/snaps-cli/src/commands/manifest/manifest.ts index 926024b5a3..dd9bd7ff4c 100644 --- a/packages/snaps-cli/src/commands/manifest/manifest.ts +++ b/packages/snaps-cli/src/commands/manifest/manifest.ts @@ -1,4 +1,4 @@ -import { isFile } from '@metamask/snaps-utils'; +import { isFile } from '@metamask/snaps-utils/node'; import type { ProcessedConfig } from '../../config'; import { CommandError } from '../../errors'; diff --git a/packages/snaps-cli/src/commands/watch/watch.ts b/packages/snaps-cli/src/commands/watch/watch.ts index fe109bcd18..81ef64cea0 100644 --- a/packages/snaps-cli/src/commands/watch/watch.ts +++ b/packages/snaps-cli/src/commands/watch/watch.ts @@ -1,4 +1,4 @@ -import { isFile } from '@metamask/snaps-utils'; +import { isFile } from '@metamask/snaps-utils/node'; import type { ProcessedConfig, ProcessedWebpackConfig } from '../../config'; import { CommandError } from '../../errors'; diff --git a/packages/snaps-cli/src/config.ts b/packages/snaps-cli/src/config.ts index fbe52f576d..f3e2cf9bc9 100644 --- a/packages/snaps-cli/src/config.ts +++ b/packages/snaps-cli/src/config.ts @@ -5,7 +5,7 @@ import { isFile, SnapsStructError, named, -} from '@metamask/snaps-utils'; +} from '@metamask/snaps-utils/node'; import { hasProperty } from '@metamask/utils'; import { transform } from '@swc/core'; import type { BrowserifyObject } from 'browserify'; diff --git a/packages/snaps-cli/src/webpack/server.ts b/packages/snaps-cli/src/webpack/server.ts index eb01d0e96b..8ca45588d3 100644 --- a/packages/snaps-cli/src/webpack/server.ts +++ b/packages/snaps-cli/src/webpack/server.ts @@ -3,7 +3,7 @@ import { logError, NpmSnapFileNames, readJsonFile, -} from '@metamask/snaps-utils'; +} from '@metamask/snaps-utils/node'; import type { IncomingMessage, Server, ServerResponse } from 'http'; import { createServer } from 'http'; import type { AddressInfo } from 'net'; diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index da8c62eccb..cd9b5c52d4 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -14,14 +14,14 @@ "types": "./dist/types/index.d.ts" }, "./node": { - "import": "./dist/index.node.mjs", - "require": "./dist/index.node.js", - "types": "./dist/types/index.node.d.ts" + "import": "./dist/node.mjs", + "require": "./dist/node.js", + "types": "./dist/types/node.d.ts" }, "./react-native": { - "import": "./dist/index.react-native.mjs", - "require": "./dist/index.react-native.js", - "types": "./dist/types/index.react-native.d.ts" + "import": "./dist/react-native.mjs", + "require": "./dist/react-native.js", + "types": "./dist/types/react-native.d.ts" }, "./package.json": "./package.json" }, diff --git a/packages/snaps-controllers/src/index.node.ts b/packages/snaps-controllers/src/node.ts similarity index 58% rename from packages/snaps-controllers/src/index.node.ts rename to packages/snaps-controllers/src/node.ts index ffa949a8bf..b3c6706f5d 100644 --- a/packages/snaps-controllers/src/index.node.ts +++ b/packages/snaps-controllers/src/node.ts @@ -1,4 +1,4 @@ /* eslint-disable import/export */ export * from '.'; -export * from './services/index.node'; +export * from './services/node'; diff --git a/packages/snaps-controllers/src/index.react-native.ts b/packages/snaps-controllers/src/react-native.ts similarity index 53% rename from packages/snaps-controllers/src/index.react-native.ts rename to packages/snaps-controllers/src/react-native.ts index c3c6866835..7112e72260 100644 --- a/packages/snaps-controllers/src/index.react-native.ts +++ b/packages/snaps-controllers/src/react-native.ts @@ -1,4 +1,4 @@ /* eslint-disable import/export */ export * from '.'; -export * from './services/index.react-native'; +export * from './services/react-native'; diff --git a/packages/snaps-controllers/src/services/index.node.ts b/packages/snaps-controllers/src/services/index.node.ts deleted file mode 100644 index 928efdc501..0000000000 --- a/packages/snaps-controllers/src/services/index.node.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from '.'; -export * from './node'; diff --git a/packages/snaps-controllers/src/services/node/NodeProcessExecutionService.test.ts b/packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.test.ts similarity index 100% rename from packages/snaps-controllers/src/services/node/NodeProcessExecutionService.test.ts rename to packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.test.ts diff --git a/packages/snaps-controllers/src/services/node/NodeProcessExecutionService.ts b/packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.ts similarity index 100% rename from packages/snaps-controllers/src/services/node/NodeProcessExecutionService.ts rename to packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.ts diff --git a/packages/snaps-controllers/src/services/node/NodeThreadExecutionService.test.ts b/packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.test.ts similarity index 100% rename from packages/snaps-controllers/src/services/node/NodeThreadExecutionService.test.ts rename to packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.test.ts diff --git a/packages/snaps-controllers/src/services/node/NodeThreadExecutionService.ts b/packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.ts similarity index 100% rename from packages/snaps-controllers/src/services/node/NodeThreadExecutionService.ts rename to packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.ts diff --git a/packages/snaps-controllers/src/services/node/index.ts b/packages/snaps-controllers/src/services/node-js/index.ts similarity index 100% rename from packages/snaps-controllers/src/services/node/index.ts rename to packages/snaps-controllers/src/services/node-js/index.ts diff --git a/packages/snaps-controllers/src/services/node.ts b/packages/snaps-controllers/src/services/node.ts new file mode 100644 index 0000000000..e88858623f --- /dev/null +++ b/packages/snaps-controllers/src/services/node.ts @@ -0,0 +1,2 @@ +export * from '.'; +export * from './node-js'; diff --git a/packages/snaps-controllers/src/services/index.react-native.ts b/packages/snaps-controllers/src/services/react-native.ts similarity index 100% rename from packages/snaps-controllers/src/services/index.react-native.ts rename to packages/snaps-controllers/src/services/react-native.ts diff --git a/packages/snaps-jest/src/internals/server.ts b/packages/snaps-jest/src/internals/server.ts index 8b66e5dba2..5ce77d2104 100644 --- a/packages/snaps-jest/src/internals/server.ts +++ b/packages/snaps-jest/src/internals/server.ts @@ -3,7 +3,7 @@ import { assertIsSnapManifest, isDirectory, isFile, -} from '@metamask/snaps-utils'; +} from '@metamask/snaps-utils/node'; import { createModuleLogger } from '@metamask/utils'; import express from 'express'; import { promises as fs } from 'fs'; diff --git a/packages/snaps-jest/src/internals/simulation/simulation.ts b/packages/snaps-jest/src/internals/simulation/simulation.ts index 1138451ee5..54e7e6568c 100644 --- a/packages/snaps-jest/src/internals/simulation/simulation.ts +++ b/packages/snaps-jest/src/internals/simulation/simulation.ts @@ -11,7 +11,7 @@ import { detectSnapLocation, NodeThreadExecutionService, setupMultiplex, -} from '@metamask/snaps-controllers'; +} from '@metamask/snaps-controllers/node'; import { getEncryptionKey } from '@metamask/snaps-rpc-methods'; import type { SnapId, diff --git a/packages/snaps-rollup-plugin/src/plugin.ts b/packages/snaps-rollup-plugin/src/plugin.ts index cd8d4fbaaf..a86a6e2c51 100644 --- a/packages/snaps-rollup-plugin/src/plugin.ts +++ b/packages/snaps-rollup-plugin/src/plugin.ts @@ -1,9 +1,9 @@ -import type { PostProcessOptions } from '@metamask/snaps-utils'; +import type { PostProcessOptions } from '@metamask/snaps-utils/node'; import { checkManifest, evalBundle, postProcessBundle, -} from '@metamask/snaps-utils'; +} from '@metamask/snaps-utils/node'; import { promises as fs } from 'fs'; import pathUtils from 'path'; // eslint-disable-next-line @typescript-eslint/no-shadow diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 28f73dfb11..beeb3b00d1 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -13,9 +13,9 @@ "types": "./dist/types/index.d.ts" }, "./node": { - "import": "./dist/index.node.mjs", - "require": "./dist/index.node.js", - "types": "./dist/types/index.node.d.ts" + "import": "./dist/node.mjs", + "require": "./dist/node.js", + "types": "./dist/types/node.d.ts" }, "./test-utils": { "import": "./dist/test-utils/index.mjs", diff --git a/packages/snaps-utils/src/fs.ts b/packages/snaps-utils/src/fs.ts index c4b5e37ce8..fedd52c4b7 100644 --- a/packages/snaps-utils/src/fs.ts +++ b/packages/snaps-utils/src/fs.ts @@ -5,7 +5,7 @@ import pathUtils from 'path'; import { parseJson } from './json'; import type { VirtualFile } from './virtual-file'; -import { readVirtualFile } from './virtual-file'; +import { readVirtualFile } from './virtual-file/node'; /** * Checks whether the given path string resolves to an existing directory, and diff --git a/packages/snaps-utils/src/manifest/manifest.ts b/packages/snaps-utils/src/manifest/manifest.ts index 7eda962004..558fdf4070 100644 --- a/packages/snaps-utils/src/manifest/manifest.ts +++ b/packages/snaps-utils/src/manifest/manifest.ts @@ -16,7 +16,7 @@ import { } from '../snaps'; import type { SnapFiles, UnvalidatedSnapFiles } from '../types'; import { NpmSnapFileNames, SnapValidationFailureReason } from '../types'; -import { readVirtualFile, VirtualFile } from '../virtual-file'; +import { readVirtualFile, VirtualFile } from '../virtual-file/node'; import type { SnapManifest } from './validation'; const MANIFEST_SORT_ORDER: Record = { diff --git a/packages/snaps-utils/src/manifest/index.node.ts b/packages/snaps-utils/src/manifest/node.ts similarity index 100% rename from packages/snaps-utils/src/manifest/index.node.ts rename to packages/snaps-utils/src/manifest/node.ts diff --git a/packages/snaps-utils/src/index.node.ts b/packages/snaps-utils/src/node.ts similarity index 68% rename from packages/snaps-utils/src/index.node.ts rename to packages/snaps-utils/src/node.ts index b4b4cee6b5..d56f0d97ef 100644 --- a/packages/snaps-utils/src/index.node.ts +++ b/packages/snaps-utils/src/node.ts @@ -3,8 +3,8 @@ export * from '.'; export * from './eval'; export * from './fs'; -export * from './manifest/index.node'; +export * from './manifest/node'; export * from './mock'; export * from './npm'; export * from './post-process'; -export * from './virtual-file/index.node'; +export * from './virtual-file/node'; diff --git a/packages/snaps-utils/src/virtual-file/index.node.ts b/packages/snaps-utils/src/virtual-file/node.ts similarity index 100% rename from packages/snaps-utils/src/virtual-file/index.node.ts rename to packages/snaps-utils/src/virtual-file/node.ts diff --git a/packages/snaps-webpack-plugin/src/plugin.ts b/packages/snaps-webpack-plugin/src/plugin.ts index 62c0b71cfd..dec461d9b0 100644 --- a/packages/snaps-webpack-plugin/src/plugin.ts +++ b/packages/snaps-webpack-plugin/src/plugin.ts @@ -1,11 +1,11 @@ import { getErrorMessage } from '@metamask/snaps-sdk'; -import type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils'; import { checkManifest, evalBundle, postProcessBundle, useTemporaryFile, -} from '@metamask/snaps-utils'; +} from '@metamask/snaps-utils/node'; +import type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils/node'; import { assert } from '@metamask/utils'; import pathUtils from 'path'; import { promisify } from 'util'; diff --git a/tsconfig.packages.json b/tsconfig.packages.json index 2d4dd68e4d..69d1a7f431 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -8,6 +8,7 @@ "moduleResolution": "node", "paths": { "@metamask/*/test-utils": ["../*/src/test-utils"], + "@metamask/*/node": ["../*/src/node"], "@metamask/*": ["../*/src"] }, "resolveJsonModule": true,