Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): replace superstruct imports with @metamask/superstruct #328

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
27dc425
Replace `superstruct` imports with `@metamask/superstruct`
MajorLift May 30, 2024
e2d9e3f
Remove dependency `superstruct` and replace with `@metamask/superstru…
MajorLift May 30, 2024
4917f9b
Bump dependency `@metamask/utils` from `^8.4.0` to `^8.5.0`
MajorLift May 30, 2024
0ff0629
Fix additional `superstruct` imports
MajorLift May 30, 2024
fa686b6
Bump dependency `@metamask/snaps-sdk` from `^4.2.0` to `^4.4.1`
MajorLift Jun 3, 2024
28dc845
Update lockfile
MajorLift Jun 6, 2024
7fb3de6
Linter fixes for import statements
MajorLift Jun 6, 2024
fa209c7
Set tsconfig options `module`, `moduleResolution` to `NodeNext`
MajorLift Jun 6, 2024
09f8f6b
Bump dependency `@metamask/snaps-sdk` to `^4.4.2`
MajorLift Jun 7, 2024
3086d59
Bump `@metamask/superstruct` to `^3.1.0`
MajorLift Jun 27, 2024
12b5454
Bump `@metamask/snaps-sdk` from `^4.4.2` to `^6.0.0`
MajorLift Jun 27, 2024
155384d
Move `@metamask/providers` from devDeps to dependency
MajorLift Jun 27, 2024
3449d87
Fix lockfile
MajorLift Jun 27, 2024
6ec0879
Bump `@metamask/utils` from `^8.5.0` to `^9.0.0`
MajorLift Jun 29, 2024
44b17ff
Merge branch 'main' into replace-superstruct-with-fork
MajorLift Jul 3, 2024
7fb06fe
Fix `@metamask/providers` to `17.0.0`
MajorLift Jul 14, 2024
8755bfc
Merge branch 'main' into replace-superstruct-with-fork
MajorLift Jul 14, 2024
3dcfc81
Set yarn resolution for `@metamask/snaps-sdk` to monorepo pr
MajorLift Jul 14, 2024
d7e849b
Merge branch 'main' into replace-superstruct-with-fork
MajorLift Jul 15, 2024
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
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@
"test:types": "tsd",
"test:watch": "jest --watch"
},
"resolutions": {
"@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6"
},
"dependencies": {
"@metamask/providers": "17.0.0",
"@metamask/snaps-sdk": "^6.0.0",
"@metamask/utils": "^8.4.0",
"@metamask/superstruct": "^3.1.0",
"@metamask/utils": "^9.0.0",
"@types/uuid": "^9.0.8",
"bech32": "^2.0.0",
"superstruct": "^1.0.3",
"uuid": "^9.0.1"
},
"devDependencies": {
Expand All @@ -53,7 +57,6 @@
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/providers": "^17.0.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand All @@ -76,7 +79,7 @@
"ts-node": "^10.9.2",
"tsd": "^0.31.0",
"typedoc": "^0.25.13",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"peerDependencies": {
"@metamask/providers": ">=15 <18"
Expand Down
2 changes: 1 addition & 1 deletion src/JsonRpcRequest.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is } from 'superstruct';
import { is } from '@metamask/superstruct';

import { JsonRpcRequestStruct } from './JsonRpcRequest';

Expand Down
11 changes: 9 additions & 2 deletions src/JsonRpcRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import type { Infer } from '@metamask/superstruct';
import {
array,
literal,
number,
record,
string,
union,
} from '@metamask/superstruct';
import { JsonStruct } from '@metamask/utils';
import type { Infer } from 'superstruct';
import { array, literal, number, record, string, union } from 'superstruct';

import { exactOptional, object } from './superstruct';

Expand Down
2 changes: 1 addition & 1 deletion src/KeyringClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from '@metamask/superstruct';
import type { Json } from '@metamask/utils';
import { assert } from 'superstruct';
import { v4 as uuid } from 'uuid';

import type {
Expand Down
2 changes: 1 addition & 1 deletion src/api/account.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from 'superstruct';
import { assert } from '@metamask/superstruct';

import { KeyringAccountStruct } from './account';

Expand Down
4 changes: 2 additions & 2 deletions src/api/account.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Infer } from '@metamask/superstruct';
import { array, enums, record, string } from '@metamask/superstruct';
import { JsonStruct } from '@metamask/utils';
import type { Infer } from 'superstruct';
import { array, enums, record, string } from 'superstruct';

import { object } from '../superstruct';
import { UuidStruct } from '../utils';
Expand Down
4 changes: 2 additions & 2 deletions src/api/balance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Infer } from 'superstruct';
import { string } from 'superstruct';
import type { Infer } from '@metamask/superstruct';
import { string } from '@metamask/superstruct';

import { object } from '../superstruct';
import { StringNumberStruct } from '../utils';
Expand Down
2 changes: 1 addition & 1 deletion src/api/caip.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is, type Infer } from 'superstruct';
import { is, type Infer } from '@metamask/superstruct';

import { definePattern } from '../superstruct';

Expand Down
4 changes: 2 additions & 2 deletions src/api/export.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Infer } from '@metamask/superstruct';
import { record, string } from '@metamask/superstruct';
import { JsonStruct } from '@metamask/utils';
import type { Infer } from 'superstruct';
import { record, string } from 'superstruct';

export const KeyringAccountDataStruct = record(string(), JsonStruct);

Expand Down
4 changes: 2 additions & 2 deletions src/api/request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Infer } from '@metamask/superstruct';
import { array, record, string, union } from '@metamask/superstruct';
import { JsonStruct } from '@metamask/utils';
import type { Infer } from 'superstruct';
import { array, record, string, union } from 'superstruct';

import { exactOptional, object } from '../superstruct';
import { UuidStruct } from '../utils';
Expand Down
4 changes: 2 additions & 2 deletions src/api/response.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Infer } from '@metamask/superstruct';
import { literal, string, union } from '@metamask/superstruct';
import { JsonStruct } from '@metamask/utils';
import type { Infer } from 'superstruct';
import { literal, string, union } from 'superstruct';

import { exactOptional, object } from '../superstruct';

Expand Down
4 changes: 2 additions & 2 deletions src/btc/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Infer } from '@metamask/superstruct';
import { string, array, enums, refine, literal } from '@metamask/superstruct';
import { bech32 } from 'bech32';
import type { Infer } from 'superstruct';
import { string, array, enums, refine, literal } from 'superstruct';

import { KeyringAccountStruct, BtcAccountType } from '../api';
import { object } from '../superstruct';
Expand Down
2 changes: 1 addition & 1 deletion src/eth/erc4337/types.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from 'superstruct';
import { assert } from '@metamask/superstruct';

import { EthUserOperationStruct, EthBaseUserOperationStruct } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/eth/erc4337/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Infer } from 'superstruct';
import { type Infer } from '@metamask/superstruct';

import { exactOptional, object } from '../../superstruct';
import { UrlStruct } from '../../utils';
Expand Down
4 changes: 2 additions & 2 deletions src/eth/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Infer } from 'superstruct';
import { array, enums, literal } from 'superstruct';
import type { Infer } from '@metamask/superstruct';
import { array, enums, literal } from '@metamask/superstruct';

import { EthAccountType, KeyringAccountStruct } from '../api';
import { object, definePattern } from '../superstruct';
Expand Down
11 changes: 9 additions & 2 deletions src/internal/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import type { Infer } from '@metamask/superstruct';
import {
array,
literal,
number,
record,
string,
union,
} from '@metamask/superstruct';
import { JsonStruct } from '@metamask/utils';
import type { Infer } from 'superstruct';
import { array, literal, number, record, string, union } from 'superstruct';

import {
BalanceStruct,
Expand Down
2 changes: 1 addition & 1 deletion src/internal/events.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is } from 'superstruct';
import { is } from '@metamask/superstruct';

import { EthAccountType } from '../api';
import { KeyringEvent } from '../events';
Expand Down
2 changes: 1 addition & 1 deletion src/internal/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { boolean, literal, string } from '@metamask/superstruct';
import { JsonStruct } from '@metamask/utils';
import { boolean, literal, string } from 'superstruct';

import { KeyringAccountStruct } from '../api';
import { KeyringEvent } from '../events';
Expand Down
2 changes: 1 addition & 1 deletion src/internal/types.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from 'superstruct';
import { assert } from '@metamask/superstruct';

import { InternalAccountStruct } from '.';

Expand Down
4 changes: 2 additions & 2 deletions src/internal/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Infer, Struct } from 'superstruct';
import { boolean, string, number } from 'superstruct';
import type { Infer, Struct } from '@metamask/superstruct';
import { boolean, string, number } from '@metamask/superstruct';

import { BtcAccountType, EthAccountType, KeyringAccountStruct } from '../api';
import { BtcP2wpkhAccountStruct } from '../btc/types';
Expand Down
2 changes: 1 addition & 1 deletion src/rpc-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from '@metamask/superstruct';
import type { Json } from '@metamask/utils';
import { assert } from 'superstruct';

import type { Keyring } from './api';
import {
Expand Down
4 changes: 2 additions & 2 deletions src/superstruct.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Infer } from 'superstruct';
import { boolean, number, optional, string } from 'superstruct';
import type { Infer } from '@metamask/superstruct';
import { boolean, number, optional, string } from '@metamask/superstruct';
import { expectAssignable, expectNotAssignable } from 'tsd';

import { exactOptional, object } from '.';
Expand Down
2 changes: 1 addition & 1 deletion src/superstruct.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is, literal, max, number, string, union } from 'superstruct';
import { is, literal, max, number, string, union } from '@metamask/superstruct';

import { exactOptional, object } from '.';

Expand Down
12 changes: 9 additions & 3 deletions src/superstruct.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import type { Infer, Context } from 'superstruct';
import { Struct, assert, define, object as stObject } from 'superstruct';
import type {
Context,
Infer,
ObjectSchema,
OmitBy,
Optionalize,
PickBy,
Simplify,
} from 'superstruct/dist/utils';
} from '@metamask/superstruct';
import {
Struct,
assert,
define,
object as stObject,
} from '@metamask/superstruct';

declare const ExactOptionalSymbol: unique symbol;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/types.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is } from 'superstruct';
import { is } from '@metamask/superstruct';

import { StringNumberStruct } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { define, type Infer } from 'superstruct';
import { define, type Infer } from '@metamask/superstruct';

import { definePattern } from '../superstruct';

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"lib": ["ES2020", "DOM"],
"module": "CommonJS",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"noErrorTruncation": true,
"noUncheckedIndexedAccess": true,
Expand Down
Loading
Loading