remove .js in imports for now
pending https://github.com/esbuild-kit/tsx/issues/74
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"library/main.ts"
|
||||
"src/main.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"target": "node16",
|
||||
|
||||
@@ -18,14 +18,14 @@ function isDeclarationPublic(declaration: Node) {
|
||||
|
||||
const project = new Project()
|
||||
|
||||
project.addSourceFilesAtPaths(["library/**/*.{ts,tsx}", "!library/main.ts"])
|
||||
project.addSourceFilesAtPaths(["src/**/*.{ts,tsx}", "!src/main.ts"])
|
||||
|
||||
const exportLines = project
|
||||
.getSourceFiles()
|
||||
.map((file) => {
|
||||
const importPath = relative(
|
||||
"library",
|
||||
join(file.getDirectoryPath(), file.getBaseNameWithoutExtension() + ".js"),
|
||||
"src",
|
||||
join(file.getDirectoryPath(), file.getBaseNameWithoutExtension()),
|
||||
)
|
||||
const exports = file.getExportedDeclarations()
|
||||
|
||||
@@ -48,13 +48,13 @@ const exportLines = project
|
||||
return `export { ${exportNames.join(", ")} } from "./${importPath}"`
|
||||
})
|
||||
|
||||
const resolvedConfig = await prettier.resolveConfig("library/main.ts")
|
||||
const resolvedConfig = await prettier.resolveConfig("src/main.ts")
|
||||
if (!resolvedConfig) {
|
||||
throw new Error("Could not find prettier config")
|
||||
}
|
||||
|
||||
await writeFile(
|
||||
"library/main.ts",
|
||||
"src/main.ts",
|
||||
prettier.format(exportLines.join(";"), {
|
||||
...resolvedConfig,
|
||||
parser: "typescript",
|
||||
|
||||
@@ -2,31 +2,27 @@ export {
|
||||
type ReacordConfig,
|
||||
type InteractionInfo,
|
||||
ReacordClient,
|
||||
} from "./reacord-client.js"
|
||||
export { type ReacordInstance } from "./reacord-instance.js"
|
||||
export { ActionRow, type ActionRowProps } from "./react/action-row.js"
|
||||
export { type ButtonSharedProps } from "./react/button-shared-props.js"
|
||||
export {
|
||||
Button,
|
||||
type ButtonProps,
|
||||
type ButtonClickEvent,
|
||||
} from "./react/button.js"
|
||||
export { type ComponentEvent } from "./react/component-event.js"
|
||||
export { EmbedAuthor, type EmbedAuthorProps } from "./react/embed-author.js"
|
||||
export { EmbedField, type EmbedFieldProps } from "./react/embed-field.js"
|
||||
export { EmbedFooter, type EmbedFooterProps } from "./react/embed-footer.js"
|
||||
export { EmbedImage, type EmbedImageProps } from "./react/embed-image.js"
|
||||
} from "./reacord-client"
|
||||
export { type ReacordInstance } from "./reacord-instance"
|
||||
export { ActionRow, type ActionRowProps } from "./react/action-row"
|
||||
export { type ButtonSharedProps } from "./react/button-shared-props"
|
||||
export { Button, type ButtonProps, type ButtonClickEvent } from "./react/button"
|
||||
export { type ComponentEvent } from "./react/component-event"
|
||||
export { EmbedAuthor, type EmbedAuthorProps } from "./react/embed-author"
|
||||
export { EmbedField, type EmbedFieldProps } from "./react/embed-field"
|
||||
export { EmbedFooter, type EmbedFooterProps } from "./react/embed-footer"
|
||||
export { EmbedImage, type EmbedImageProps } from "./react/embed-image"
|
||||
export {
|
||||
EmbedThumbnail,
|
||||
type EmbedThumbnailProps,
|
||||
} from "./react/embed-thumbnail.js"
|
||||
export { EmbedTitle, type EmbedTitleProps } from "./react/embed-title.js"
|
||||
export { Embed, type EmbedProps } from "./react/embed.js"
|
||||
export { useInstance } from "./react/instance-context.js"
|
||||
export { Link, type LinkProps } from "./react/link.js"
|
||||
export { Option, type OptionProps } from "./react/option.js"
|
||||
} from "./react/embed-thumbnail"
|
||||
export { EmbedTitle, type EmbedTitleProps } from "./react/embed-title"
|
||||
export { Embed, type EmbedProps } from "./react/embed"
|
||||
export { useInstance } from "./react/instance-context"
|
||||
export { Link, type LinkProps } from "./react/link"
|
||||
export { Option, type OptionProps } from "./react/option"
|
||||
export {
|
||||
Select,
|
||||
type SelectProps,
|
||||
type SelectChangeEvent,
|
||||
} from "./react/select.js"
|
||||
} from "./react/select"
|
||||
|
||||
@@ -6,15 +6,10 @@ import {
|
||||
} from "discord.js"
|
||||
import * as React from "react"
|
||||
import { createDiscordClient } from "./create-discord-client"
|
||||
import type { ReacordInstance } from "./reacord-instance.js"
|
||||
import { ReacordInstancePrivate } from "./reacord-instance.js"
|
||||
import type { ReacordInstance } from "./reacord-instance"
|
||||
import { ReacordInstancePrivate } from "./reacord-instance"
|
||||
import { InstanceProvider } from "./react/instance-context"
|
||||
import type { Renderer } from "./renderer.js"
|
||||
import {
|
||||
ChannelMessageRenderer,
|
||||
EphemeralInteractionReplyRenderer,
|
||||
InteractionReplyRenderer,
|
||||
} from "./renderer.js"
|
||||
import { Renderer } from "./renderer"
|
||||
|
||||
/**
|
||||
* @category Core
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ReactNode } from "react"
|
||||
import React from "react"
|
||||
import { Node } from "../node.js"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* Props for an action row
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { APIMessageComponentButtonInteraction } from "discord.js"
|
||||
import { randomUUID } from "node:crypto"
|
||||
import React from "react"
|
||||
import { Node } from "../node.js"
|
||||
import { Node } from "../node"
|
||||
import type { ButtonSharedProps } from "./button-shared-props"
|
||||
import type { ComponentEvent } from "./component-event.js"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import type { ComponentEvent } from "./component-event"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Button
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ReactNode } from "react"
|
||||
import type { ReacordInstance } from "../reacord-instance.js"
|
||||
import type { ReacordInstance } from "../reacord-instance"
|
||||
|
||||
/**
|
||||
* @category Component Event
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ReactNode } from "react"
|
||||
import React from "react"
|
||||
import { Node } from "../node.js"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Embed
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ReactNode } from "react"
|
||||
import React from "react"
|
||||
import { Node } from "../node.js"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Embed
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ReactNode } from "react"
|
||||
import React from "react"
|
||||
import { Node } from "../node.js"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Embed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Embed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Embed
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { ReactNode } from "react"
|
||||
import React from "react"
|
||||
import type { Except } from "type-fest"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Embed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react"
|
||||
import { Node } from "../node.js"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { Node } from "../node"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Embed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { raise } from "@reacord/helpers/raise"
|
||||
import * as React from "react"
|
||||
import type { ReacordInstance } from "../reacord-instance.js"
|
||||
import type { ReacordInstance } from "../reacord-instance"
|
||||
|
||||
const Context = React.createContext<ReacordInstance | undefined>(undefined)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from "react"
|
||||
import type { Except } from "type-fest"
|
||||
import { Node } from "../node.js"
|
||||
import { Node } from "../node"
|
||||
import type { ButtonSharedProps } from "./button-shared-props"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Link
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable unicorn/prefer-modern-dom-apis */
|
||||
import { raise } from "@reacord/helpers/raise.js"
|
||||
import { raise } from "@reacord/helpers/raise"
|
||||
import ReactReconciler from "react-reconciler"
|
||||
import { DefaultEventPriority } from "react-reconciler/constants"
|
||||
import { Node, TextNode } from "../node.js"
|
||||
import type { ReacordInstancePrivate } from "../reacord-instance.js"
|
||||
import { Node, TextNode } from "../node"
|
||||
import type { ReacordInstancePrivate } from "../reacord-instance"
|
||||
|
||||
export const reconciler = ReactReconciler<
|
||||
string, // Type,
|
||||
|
||||
@@ -2,9 +2,9 @@ import type { APIMessageComponentSelectMenuInteraction } from "discord.js"
|
||||
import { randomUUID } from "node:crypto"
|
||||
import type { ReactNode } from "react"
|
||||
import React from "react"
|
||||
import { Node } from "../node.js"
|
||||
import type { ComponentEvent } from "./component-event.js"
|
||||
import { ReacordElement } from "./reacord-element.js"
|
||||
import { Node } from "../node"
|
||||
import type { ComponentEvent } from "./component-event"
|
||||
import { ReacordElement } from "./reacord-element"
|
||||
|
||||
/**
|
||||
* @category Select
|
||||
|
||||
Reference in New Issue
Block a user