diff --git a/.changeset/long-icons-warn.md b/.changeset/long-icons-warn.md new file mode 100644 index 0000000..204ad25 --- /dev/null +++ b/.changeset/long-icons-warn.md @@ -0,0 +1,5 @@ +--- +"@astrojs/cli-kit": minor +--- + +Fix types not working properly under moduleResolution: 'node16' diff --git a/package.json b/package.json index 00cbcb7..e00996f 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,43 @@ { - "name": "@astrojs/cli-kit", - "type": "module", - "version": "0.2.5", - "license": "MIT", - "types": "./dist/index.d.ts", - "packageManager": "pnpm@7.11.0", - "exports": { - ".": { - "default": "./dist/index.js", - "types": "./dist/index.d.ts" - }, - "./utils": { - "default": "./dist/utils/index.js", - "types": "./dist/utils/index.d.ts" - } + "name": "@astrojs/cli-kit", + "type": "module", + "version": "0.2.5", + "license": "MIT", + "types": "./dist/index.d.ts", + "packageManager": "pnpm@7.11.0", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" }, - "files": [ - "dist", - "types.d.ts", - "utils.d.ts" - ], - "repository": { - "type": "git", - "url": "https://github.com/withastro/cli-kit.git" - }, - "scripts": { - "build": "tsc -p ." - }, - "dependencies": { - "chalk": "^5.0.1", - "log-update": "^5.0.1", - "sisteransi": "^1.0.5" - }, - "devDependencies": { - "@changesets/cli": "^2.24.4", - "@types/node": "^18.7.16", - "typescript": "^4.8.3" - }, - "volta": { - "node": "18.9.0", - "npm": "8.19.1" + "./utils": { + "types": "./dist/utils/index.d.ts", + "default": "./dist/utils/index.js" } + }, + "files": [ + "dist", + "types.d.ts", + "utils.d.ts" + ], + "repository": { + "type": "git", + "url": "https://github.com/withastro/cli-kit.git" + }, + "scripts": { + "build": "tsc -p ." + }, + "dependencies": { + "chalk": "^5.0.1", + "log-update": "^5.0.1", + "sisteransi": "^1.0.5" + }, + "devDependencies": { + "@changesets/cli": "^2.24.4", + "@types/node": "^18.7.16", + "typescript": "^5.2.2" + }, + "engines": { + "node": ">=18.14.1" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 20ba072..6c0b550 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ specifiers: chalk: ^5.0.1 log-update: ^5.0.1 sisteransi: ^1.0.5 - typescript: ^4.8.3 + typescript: ^5.2.2 dependencies: chalk: 5.0.1 @@ -16,7 +16,7 @@ dependencies: devDependencies: '@changesets/cli': 2.24.4 '@types/node': 18.7.16 - typescript: 4.8.3 + typescript: 5.2.2 packages: @@ -1637,9 +1637,9 @@ packages: engines: {node: '>=10'} dev: false - /typescript/4.8.3: - resolution: {integrity: sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==} - engines: {node: '>=4.2.0'} + /typescript/5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + engines: {node: '>=14.17'} hasBin: true dev: true diff --git a/src/prompt/prompt.js b/src/prompt/prompt.js index f72dc30..07e5b97 100644 --- a/src/prompt/prompt.js +++ b/src/prompt/prompt.js @@ -21,7 +21,7 @@ const prompts = { multiselect: (args) => toPrompt("MultiselectPrompt", args), }; -/** @type {import('../../types').default} */ +/** @type {import('../../types.js').default} */ export default async function prompt( questions = [], { onSubmit = noop, onCancel = () => process.exit(0), stdin = process.stdin, stdout = process.stdout } = {} diff --git a/tsconfig.json b/tsconfig.json index 8bdd1ae..e0b34dc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,24 +1,16 @@ { "$schema": "https://json.schemastore.org/tsconfig", + "include": ["src"], "compilerOptions": { - "strict": true, - "outDir": "./dist", "declaration": true, - "declarationDir": "./dist", - // Enable top-level await, and other modern ESM features. - "target": "ESNext", - "module": "ESNext", - // Enable node-style module resolution, for things like npm package imports. - "moduleResolution": "node", - // Enable JSON imports. - "resolveJsonModule": true, - // Enable stricter transpilation for better output. - "isolatedModules": true, - // Report an error when importing a file using a casing different from the casing on disk. - "forceConsistentCasingInFileNames": true, - // Properly support importing CJS modules in ESM + "strict": true, + "allowJs": true, + "moduleResolution": "Node16", + "target": "ES2022", + "module": "Node16", "esModuleInterop": true, - "allowJs": true - }, - "include": ["src"] + "skipLibCheck": true, + "verbatimModuleSyntax": true, + "outDir": "dist" + } } diff --git a/utils.d.ts b/utils.d.ts index ac78442..506b5a4 100644 --- a/utils.d.ts +++ b/utils.d.ts @@ -1 +1 @@ -export * from './dist/utils/index' +export * from './dist/utils/index.d.js';