remove nanoid, use crypto.randomUUID()
removes a dependency, and resolves an ESM require error
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user