Skip to content

Commit

Permalink
fix: TypeScript file extensions (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
that-richan authored Nov 24, 2023
1 parent 960f906 commit e0ba6c0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/two-ears-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'imagetools-core': patch
'vite-imagetools': patch
---

fix: corrected imports to compile with `"moduleResolution": "nodenext"`
2 changes: 1 addition & 1 deletion packages/core/src/lib/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Sharp } from 'sharp'
import { ImageMetadata } from '../types'
import { ImageMetadata } from '../types.js'

export const METADATA = Symbol('image metadata')

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Metadata, Sharp } from 'sharp'
import { kernelValues } from './transforms/kernel'
import { positionValues } from './transforms/position'
import { kernelValues } from './transforms/kernel.js'
import { positionValues } from './transforms/position.js'

export interface ProcessedImageMetadata extends ImageMetadata {
src: string
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { basename, extname } from 'node:path'
import { Plugin, ResolvedConfig } from 'vite'
import type { Plugin, ResolvedConfig } from 'vite'
import {
applyTransforms,
builtins,
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createHash } from 'node:crypto'
import path from 'node:path'
import { stat } from 'node:fs/promises'
import { ImageConfig } from 'imagetools-core'
import { Sharp } from 'sharp'
import type { ImageConfig } from 'imagetools-core'
import type { Sharp } from 'sharp'

export const createBasePath = (base?: string) => {
return (base?.replace(/\/$/, '') || '') + '/@imagetools/'
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"isolatedModules": true
"moduleResolution": "nodenext",
"isolatedModules": true,
"verbatimModuleSyntax": true
},
"exclude": ["node_modules", "**/__tests__/**"]
}

0 comments on commit e0ba6c0

Please sign in to comment.