diff --git a/package.json b/package.json index dd94e32..06ae050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tap-sdk-js", - "version": "1.0.3", + "version": "1.1.3", "description": "", "scripts": { "build": "tsc", @@ -11,13 +11,13 @@ "files": [ "dist" ], - "main": "./dist/index.js", - "types": "./dist/index.d.ts", + "main": "./dist/src/index.js", + "types": "./dist/src/index.d.ts", "exports": { ".": { - "import": "./dist/index.js", - "require": "./dist/index.js", - "types": "./dist/index.d.ts" + "import": "./dist/src/index.js", + "require": "./dist/src/index.js", + "types": "./dist/src/index.d.ts" } }, "keywords": [], diff --git a/src/core/client.ts b/src/core/client.ts index cb1dc19..b65949d 100644 --- a/src/core/client.ts +++ b/src/core/client.ts @@ -1,13 +1,11 @@ -import { createEmitter, TapEvents } from "./events.js"; +import type { TapEvents } from "./events.js"; +import { createEmitter } from "./events.js"; import { createWebSocketManager } from "../api/websocket.js"; -import { - audioReqSchema, - AudioReq, - helloResSchema, - HelloRes, -} from "./schema.js"; -import { AudioRequestHandle } from "./request.js"; -import { StreamResolvable, intoReadable } from "../util/stream.js"; +import type { AudioReq, HelloRes } from "./schema.js"; +import { helloResSchema, audioReqSchema } from "./schema.js"; +import type { AudioRequestHandle } from "./request.js"; +import type { StreamResolvable } from "../util/stream.js"; +import { intoReadable } from "../util/stream.js"; import { VERSION } from "../util/constant.js"; import got from "got"; import { EventEmitter } from "eventemitter3"; diff --git a/src/core/events.ts b/src/core/events.ts index f74166a..b54f7da 100644 --- a/src/core/events.ts +++ b/src/core/events.ts @@ -1,4 +1,4 @@ -import { AudioRequestHandle } from "./request.js"; +import type { AudioRequestHandle } from "./request.js"; import { EventEmitter } from "eventemitter3"; /** diff --git a/src/core/request.ts b/src/core/request.ts index 086d7a1..db422f4 100644 --- a/src/core/request.ts +++ b/src/core/request.ts @@ -1,4 +1,4 @@ -import { StreamResolvable } from "../util/stream.js"; +import type { StreamResolvable } from "../util/stream.js"; export type AudioRequestPayload = { data: string; diff --git a/src/index.ts b/src/index.ts index 69618a7..5a258c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ export * from "./core/client.js"; -export { TapEvents } from "./core/events.js"; -export { AudioRequestHandle } from "./core/request.js"; +export type { TapEvents } from "./core/events.js"; +export type { AudioRequestHandle } from "./core/request.js"; diff --git a/tsconfig.json b/tsconfig.json index 71d2950..8fbf2d4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "libReplacement": true, /* Enable lib replacement. */ @@ -23,9 +23,9 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "node16" /* Specify what module code is generated. */, + "module": "nodenext" /* Specify what module code is generated. */, // "rootDir": "./src" /* Specify the root folder within your source files. */, - // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "nodenext" /* Specify how TypeScript looks up a file from a given module specifier. */, // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ "rootDirs": [ @@ -36,7 +36,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + "allowImportingTsExtensions": false /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */, // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ @@ -52,7 +52,7 @@ /* Emit */ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "emitDeclarationOnly": false /* Only output d.ts files and not JavaScript files. */, // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "noEmit": true, /* Disable emitting files from a compilation. */ @@ -73,10 +73,10 @@ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + "verbatimModuleSyntax": true /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */, // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */, "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,