remove nanoid, use crypto.randomUUID()

removes a dependency, and resolves an ESM require error
This commit is contained in:
itsMapleLeaf
2022-07-23 13:34:33 -05:00
committed by Darius
parent 35d7f0b33f
commit df9bdfaf77
5 changed files with 8 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
import { nanoid } from "nanoid"
import { randomUUID } from "node:crypto"
import React from "react"
import { ReacordElement } from "../../internal/element.js"
import type { ComponentInteraction } from "../../internal/interaction"
@@ -43,7 +43,7 @@ export function Button(props: ButtonProps) {
}
class ButtonNode extends Node<ButtonProps> {
private customId = nanoid()
private customId = randomUUID()
// this has text children, but buttons themselves shouldn't yield text
// eslint-disable-next-line class-methods-use-this

View File

@@ -1,4 +1,4 @@
import { nanoid } from "nanoid"
import { randomUUID } from "node:crypto"
import type { ReactNode } from "react"
import React from "react"
import { isInstanceOf } from "../../../helpers/is-instance-of"
@@ -89,7 +89,7 @@ export function Select(props: SelectProps) {
}
class SelectNode extends Node<SelectProps> {
readonly customId = nanoid()
readonly customId = randomUUID()
override modifyMessageOptions(message: MessageOptions): void {
const actionRow: ActionRow = []

View File

@@ -48,7 +48,6 @@
"@types/node": "*",
"@types/react": "*",
"@types/react-reconciler": "^0.28.0",
"nanoid": "^4.0.0",
"react-reconciler": "^0.29.0",
"rxjs": "^7.5.6"
},

View File

@@ -1,6 +1,6 @@
/* eslint-disable class-methods-use-this */
/* eslint-disable require-await */
import { nanoid } from "nanoid"
import { randomUUID } from "node:crypto"
import { setTimeout } from "node:timers/promises"
import type { ReactNode } from "react"
import { expect } from "vitest"
@@ -194,7 +194,7 @@ class TestCommandInteraction implements CommandInteraction {
}
class TestInteraction {
readonly id = nanoid()
readonly id = randomUUID()
readonly channelId = "test-channel-id"
constructor(

12
pnpm-lock.yaml generated
View File

@@ -35,7 +35,6 @@ importers:
discord.js: ^14.0.3
dotenv: ^16.0.1
lodash-es: ^4.17.21
nanoid: ^4.0.0
nodemon: ^2.0.19
prettier: ^2.7.1
pretty-ms: ^8.0.0
@@ -53,7 +52,6 @@ importers:
'@types/node': 18.0.6
'@types/react': 18.0.15
'@types/react-reconciler': 0.28.0
nanoid: 4.0.0
react-reconciler: 0.29.0_react@18.2.0
rxjs: 7.5.6
devDependencies:
@@ -88,7 +86,7 @@ importers:
'@types/node': '*'
'@types/react': ^18.0.15
'@types/react-dom': ^18.0.6
'@types/tailwindcss': ^3.1.0
'@types/tailwindcss': ^3.0.11
'@types/wait-on': ^5.3.1
autoprefixer: ^10.4.7
clsx: ^1.2.1
@@ -98,7 +96,7 @@ importers:
fast-glob: ^3.2.11
gray-matter: ^4.0.3
postcss: ^8.4.14
reacord: workspace:0.5.0
reacord: workspace:*
react: ^18.2.0
react-dom: ^18.2.0
react-focus-on: ^3.6.0
@@ -7766,12 +7764,6 @@ packages:
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
/nanoid/4.0.0:
resolution: {integrity: sha512-IgBP8piMxe/gf73RTQx7hmnhwz0aaEXYakvqZyE302IXW3HyVNhdNGC+O2MwMAVhLEnvXlvKtGbtJf6wvHihCg==}
engines: {node: ^14 || ^16 || >=18}
hasBin: true
dev: false
/nanomatch/1.2.13:
resolution: {integrity: sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==}
engines: {node: '>=0.10.0'}