diff --git a/configs/test-utils/package.json b/configs/test-utils/package.json index 3b73d1d89..27914cd1c 100644 --- a/configs/test-utils/package.json +++ b/configs/test-utils/package.json @@ -13,34 +13,12 @@ }, "sideEffects": false, "type": "module", - "exports": { - ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - }, - "./package.json": "./package.json" - }, - "main": "dist/index.cjs", - "types": "dist/index.d.ts", + "main": "src/index.ts", "scripts": { - "build": "tsup", - "build:watch": "tsup --watch", - "clean": "rimraf ./dist", "lint": "eslint \"**/*.ts*\"", - "lint:attw": "attw --pack", - "lint:pub": "publint --strict", - "prepack": "pnpm build", "type:check": "tsc --noEmit" }, "devDependencies": { - "@suspensive/tsup": "workspace:*", - "@types/node": "^18.16.2", "@types/react": "^18.2.0", "react": "^18.2.0" }, diff --git a/configs/test-utils/src/Suspend.tsx b/configs/test-utils/src/Suspend.tsx new file mode 100644 index 000000000..c1b0a2042 --- /dev/null +++ b/configs/test-utils/src/Suspend.tsx @@ -0,0 +1,18 @@ +import type { ReactNode } from 'react' + +const suspendIsNeed = { current: true } +type SuspendProps = { during: number; toShow?: ReactNode } +export const Suspend = ({ during, toShow }: SuspendProps) => { + if (suspendIsNeed.current) { + throw new Promise((resolve) => + setTimeout(() => { + suspendIsNeed.current = false + resolve('resolved') + }, during) + ) + } + return <>{toShow} +} +Suspend.reset = () => { + suspendIsNeed.current = true +} diff --git a/configs/test-utils/src/index.tsx b/configs/test-utils/src/ThrowError.tsx similarity index 58% rename from configs/test-utils/src/index.tsx rename to configs/test-utils/src/ThrowError.tsx index 97f12a967..5e919c2b5 100644 --- a/configs/test-utils/src/index.tsx +++ b/configs/test-utils/src/ThrowError.tsx @@ -1,4 +1,4 @@ -import type { PropsWithChildren, ReactNode } from 'react' +import type { PropsWithChildren } from 'react' import { useEffect, useState } from 'react' const useSetTimeout = (fn: (...args: []) => void, delay: number) => @@ -7,23 +7,6 @@ const useSetTimeout = (fn: (...args: []) => void, delay: number) => return () => clearTimeout(timeout) }, [fn, delay]) -const suspendIsNeed = { current: true } -type SuspendProps = { during: number; toShow?: ReactNode } -export const Suspend = ({ during, toShow }: SuspendProps) => { - if (suspendIsNeed.current) { - throw new Promise((resolve) => - setTimeout(() => { - suspendIsNeed.current = false - resolve('resolved') - }, during) - ) - } - return <>{toShow} -} -Suspend.reset = () => { - suspendIsNeed.current = true -} - const throwErrorIsNeed = { current: false } type ThrowErrorProps = PropsWithChildren<{ message: string; after?: number }> export const ThrowError = ({ message, after = 0, children }: ThrowErrorProps) => { @@ -48,10 +31,3 @@ export const ThrowNull = ({ after, children }: ThrowNullProps) => { ThrowError.reset = () => { throwErrorIsNeed.current = false } - -export const delay = (ms: number) => new Promise((resolve) => setTimeout(() => resolve('done'), ms)) - -export const TEXT = 'TEXT' as const -export const ERROR_MESSAGE = 'ERROR_MESSAGE' as const -export const FALLBACK = 'FALLBACK' as const -export const MS_100 = 100 as const diff --git a/configs/test-utils/src/delay.ts b/configs/test-utils/src/delay.ts new file mode 100644 index 000000000..de834c18e --- /dev/null +++ b/configs/test-utils/src/delay.ts @@ -0,0 +1 @@ +export const delay = (ms: number) => new Promise((resolve) => setTimeout(() => resolve('done'), ms)) diff --git a/configs/test-utils/src/index.ts b/configs/test-utils/src/index.ts new file mode 100644 index 000000000..d4b8e7837 --- /dev/null +++ b/configs/test-utils/src/index.ts @@ -0,0 +1,7 @@ +export { Suspend } from './Suspend' +export { ThrowError, ThrowNull } from './ThrowError' +export { delay } from './delay' +export const TEXT = 'TEXT' as const +export const ERROR_MESSAGE = 'ERROR_MESSAGE' as const +export const FALLBACK = 'FALLBACK' as const +export const MS_100 = 100 as const diff --git a/configs/test-utils/tsup.config.ts b/configs/test-utils/tsup.config.ts deleted file mode 100644 index 9560a461a..000000000 --- a/configs/test-utils/tsup.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { options } from '@suspensive/tsup' -import { defineConfig } from 'tsup' - -export default defineConfig(options) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0a531f331..c10f5f666 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,7 +81,7 @@ importers: version: 7.1.0(ts-node@10.9.1)(typescript@5.1.6) turbo: specifier: latest - version: 1.10.16 + version: 1.10.15 typescript: specifier: ^5.1.6 version: 5.1.6 @@ -166,12 +166,6 @@ importers: configs/test-utils: devDependencies: - '@suspensive/tsup': - specifier: workspace:* - version: link:../tsup - '@types/node': - specifier: ^18.16.2 - version: 18.16.2 '@types/react': specifier: ^18.2.0 version: 18.2.0 @@ -9610,64 +9604,64 @@ packages: yargs: 17.7.2 dev: true - /turbo-darwin-64@1.10.16: - resolution: {integrity: sha512-+Jk91FNcp9e9NCLYlvDDlp2HwEDp14F9N42IoW3dmHI5ZkGSXzalbhVcrx3DOox3QfiNUHxzWg4d7CnVNCuuMg==} + /turbo-darwin-64@1.10.15: + resolution: {integrity: sha512-Sik5uogjkRTe1XVP9TC2GryEMOJCaKE2pM/O9uLn4koQDnWKGcLQv+mDU+H+9DXvKLnJnKCD18OVRkwK5tdpoA==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-darwin-arm64@1.10.16: - resolution: {integrity: sha512-jqGpFZipIivkRp/i+jnL8npX0VssE6IAVNKtu573LXtssZdV/S+fRGYA16tI46xJGxSAivrZ/IcgZrV6Jk80bw==} + /turbo-darwin-arm64@1.10.15: + resolution: {integrity: sha512-xwqyFDYUcl2xwXyGPmHkmgnNm4Cy0oNzMpMOBGRr5x64SErS7QQLR4VHb0ubiR+VAb8M+ECPklU6vD1Gm+wekg==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-linux-64@1.10.16: - resolution: {integrity: sha512-PpqEZHwLoizQ6sTUvmImcRmACyRk9EWLXGlqceogPZsJ1jTRK3sfcF9fC2W56zkSIzuLEP07k5kl+ZxJd8JMcg==} + /turbo-linux-64@1.10.15: + resolution: {integrity: sha512-dM07SiO3RMAJ09Z+uB2LNUSkPp3I1IMF8goH5eLj+d8Kkwoxd/+qbUZOj9RvInyxU/IhlnO9w3PGd3Hp14m/nA==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-linux-arm64@1.10.16: - resolution: {integrity: sha512-TMjFYz8to1QE0fKVXCIvG/4giyfnmqcQIwjdNfJvKjBxn22PpbjeuFuQ5kNXshUTRaTJihFbuuCcb5OYFNx4uw==} + /turbo-linux-arm64@1.10.15: + resolution: {integrity: sha512-MkzKLkKYKyrz4lwfjNXH8aTny5+Hmiu4SFBZbx+5C0vOlyp6fV5jZANDBvLXWiDDL4DSEAuCEK/2cmN6FVH1ow==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-windows-64@1.10.16: - resolution: {integrity: sha512-+jsf68krs0N66FfC4/zZvioUap/Tq3sPFumnMV+EBo8jFdqs4yehd6+MxIwYTjSQLIcpH8KoNMB0gQYhJRLZzw==} + /turbo-windows-64@1.10.15: + resolution: {integrity: sha512-3TdVU+WEH9ThvQGwV3ieX/XHebtYNHv9HARHauPwmVj3kakoALkpGxLclkHFBLdLKkqDvmHmXtcsfs6cXXRHJg==} cpu: [x64] os: [win32] requiresBuild: true dev: true optional: true - /turbo-windows-arm64@1.10.16: - resolution: {integrity: sha512-sKm3hcMM1bl0B3PLG4ifidicOGfoJmOEacM5JtgBkYM48ncMHjkHfFY7HrJHZHUnXM4l05RQTpLFoOl/uIo2HQ==} + /turbo-windows-arm64@1.10.15: + resolution: {integrity: sha512-l+7UOBCbfadvPMYsX08hyLD+UIoAkg6ojfH+E8aud3gcA1padpjCJTh9gMpm3QdMbKwZteT5uUM+wyi6Rbbyww==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /turbo@1.10.16: - resolution: {integrity: sha512-2CEaK4FIuSZiP83iFa9GqMTQhroW2QryckVqUydmg4tx78baftTOS0O+oDAhvo9r9Nit4xUEtC1RAHoqs6ZEtg==} + /turbo@1.10.15: + resolution: {integrity: sha512-mKKkqsuDAQy1wCCIjCdG+jOCwUflhckDMSRoeBPcIL/CnCl7c5yRDFe7SyaXloUUkt4tUR0rvNIhVCcT7YeQpg==} hasBin: true optionalDependencies: - turbo-darwin-64: 1.10.16 - turbo-darwin-arm64: 1.10.16 - turbo-linux-64: 1.10.16 - turbo-linux-arm64: 1.10.16 - turbo-windows-64: 1.10.16 - turbo-windows-arm64: 1.10.16 + turbo-darwin-64: 1.10.15 + turbo-darwin-arm64: 1.10.15 + turbo-linux-64: 1.10.15 + turbo-linux-arm64: 1.10.15 + turbo-windows-64: 1.10.15 + turbo-windows-arm64: 1.10.15 dev: true /typanion@3.12.1: