From ec8a87495d2f9b635246c1ad255ac8fdd09b0980 Mon Sep 17 00:00:00 2001 From: Ralf Sternberg Date: Sun, 18 Feb 2024 22:21:10 +0100 Subject: [PATCH] Use ts imports, update eslint config With esbuild, we can finally import `.ts` files as `.ts`, which is more natural. The ESLint config is updated to check imports for this extension. Some outdated ESLint rules are removed. --- .eslintrc.cjs | 11 ++--------- src/api/content.ts | 6 +++--- src/api/make-pdf.test.ts | 2 +- src/api/make-pdf.ts | 14 +++++++------- src/binary-data.test.ts | 2 +- src/binary-data.ts | 2 +- src/box.test.ts | 2 +- src/box.ts | 2 +- src/font-loader.test.ts | 6 +++--- src/font-loader.ts | 6 +++--- src/fonts.test.ts | 2 +- src/fonts.ts | 8 ++++---- src/frame.ts | 8 ++++---- src/guides.ts | 8 ++++---- src/image-loader.test.ts | 4 ++-- src/image-loader.ts | 6 +++--- src/images.test.ts | 4 ++-- src/images.ts | 4 ++-- src/images/jpeg.test.ts | 2 +- src/images/png.test.ts | 2 +- src/index.ts | 4 ++-- src/layout/layout-columns.test.ts | 12 ++++++------ src/layout/layout-columns.ts | 10 +++++----- src/layout/layout-image.test.ts | 14 +++++++------- src/layout/layout-image.ts | 12 ++++++------ src/layout/layout-rows.test.ts | 14 +++++++------- src/layout/layout-rows.ts | 12 ++++++------ src/layout/layout-text.test.ts | 12 ++++++------ src/layout/layout-text.ts | 18 +++++++++--------- src/layout/layout.test.ts | 16 ++++++++-------- src/layout/layout.ts | 28 ++++++++++++++-------------- src/maker-ctx.ts | 4 ++-- src/page.test.ts | 6 +++--- src/page.ts | 8 ++++---- src/print-value.test.ts | 2 +- src/read-block.test.ts | 2 +- src/read-block.ts | 12 ++++++------ src/read-color.ts | 4 ++-- src/read-colors.test.ts | 2 +- src/read-document.test.ts | 2 +- src/read-document.ts | 12 ++++++------ src/read-graphics.test.ts | 4 ++-- src/read-graphics.ts | 10 +++++----- src/read-page-size.test.ts | 4 ++-- src/read-page-size.ts | 6 +++--- src/render/render-annotations.ts | 6 +++--- src/render/render-document.test.ts | 2 +- src/render/render-document.ts | 6 +++--- src/render/render-graphics.test.ts | 10 +++++----- src/render/render-graphics.ts | 12 ++++++------ src/render/render-image.test.ts | 12 ++++++------ src/render/render-image.ts | 8 ++++---- src/render/render-page.test.ts | 12 ++++++------ src/render/render-page.ts | 14 +++++++------- src/render/render-text.test.ts | 12 ++++++------ src/render/render-text.ts | 8 ++++---- src/svg-paths.test.ts | 2 +- src/svg-paths.ts | 2 +- src/test/test-utils.ts | 10 +++++----- src/text.test.ts | 8 ++++---- src/text.ts | 12 ++++++------ src/types.test.ts | 2 +- src/types.ts | 2 +- src/utils.test.ts | 2 +- 64 files changed, 233 insertions(+), 240 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index a901294..ad3c03b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -8,26 +8,19 @@ module.exports = { mocha: true, }, parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 2021, sourceType: 'module', }, extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], plugins: ['@typescript-eslint', 'import', 'simple-import-sort'], rules: { eqeqeq: ['error', 'always', { null: 'ignore' }], - // TODO disable console again, only the CLI should print to the console - 'no-console': ['error', { allow: ['warn', 'error'] }], 'object-shorthand': 'error', 'prefer-const': ['error', { destructuring: 'all' }], 'simple-import-sort/imports': 'error', - // no-unresolved cannot resolve modules due to different extension - 'import/no-unresolved': 'off', - 'import/extensions': ['error', 'ignorePackages', { js: 'always' }], + 'import/extensions': ['error', 'ignorePackages', { js: 'never', ts: 'always' }], 'import/no-default-export': 'error', // TODO temporarily disabled to support legacy code, re-enable - '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }], - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], }, }; diff --git a/src/api/content.ts b/src/api/content.ts index 4eb3873..40b4dce 100644 --- a/src/api/content.ts +++ b/src/api/content.ts @@ -1,6 +1,6 @@ -import { Color } from './colors.js'; -import { Length } from './sizes.js'; -import { Orientation, PaperSize } from './sizes.js'; +import { Color } from './colors.ts'; +import { Length } from './sizes.ts'; +import { Orientation, PaperSize } from './sizes.ts'; /** * The complete definition of a document to create. diff --git a/src/api/make-pdf.test.ts b/src/api/make-pdf.test.ts index 4a7ff3f..00c9ce1 100644 --- a/src/api/make-pdf.test.ts +++ b/src/api/make-pdf.test.ts @@ -2,7 +2,7 @@ import crypto from 'node:crypto'; import { describe, expect, it } from 'vitest'; -import { makePdf } from './make-pdf.js'; +import { makePdf } from './make-pdf.ts'; global.crypto ??= (crypto as any).webcrypto; diff --git a/src/api/make-pdf.ts b/src/api/make-pdf.ts index 557827b..70f835e 100644 --- a/src/api/make-pdf.ts +++ b/src/api/make-pdf.ts @@ -1,10 +1,10 @@ -import { createFontLoader, createFontStore } from '../font-loader.js'; -import { createImageLoader, createImageStore } from '../image-loader.js'; -import { layoutPages } from '../layout/layout.js'; -import { readDocumentDefinition } from '../read-document.js'; -import { renderDocument } from '../render/render-document.js'; -import { readAs } from '../types.js'; -import { DocumentDefinition } from './content.js'; +import { createFontLoader, createFontStore } from '../font-loader.ts'; +import { createImageLoader, createImageStore } from '../image-loader.ts'; +import { layoutPages } from '../layout/layout.ts'; +import { readDocumentDefinition } from '../read-document.ts'; +import { renderDocument } from '../render/render-document.ts'; +import { readAs } from '../types.ts'; +import { DocumentDefinition } from './content.ts'; /** * Generates a PDF from the given document definition. diff --git a/src/binary-data.test.ts b/src/binary-data.test.ts index 7696f0f..9fb401b 100644 --- a/src/binary-data.test.ts +++ b/src/binary-data.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { parseBinaryData } from './binary-data.js'; +import { parseBinaryData } from './binary-data.ts'; describe('binary-data', () => { const data = Uint8Array.of(1, 183, 0); diff --git a/src/binary-data.ts b/src/binary-data.ts index 30d94a8..19bdd8f 100644 --- a/src/binary-data.ts +++ b/src/binary-data.ts @@ -1,6 +1,6 @@ import { decodeFromBase64DataUri } from 'pdf-lib'; -import { typeError } from './types.js'; +import { typeError } from './types.ts'; export function parseBinaryData(input: unknown): Uint8Array { if (input instanceof Uint8Array) return input; diff --git a/src/box.test.ts b/src/box.test.ts index 6441395..da37400 100644 --- a/src/box.test.ts +++ b/src/box.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { parseEdges, parseLength, subtractEdges } from './box.js'; +import { parseEdges, parseLength, subtractEdges } from './box.ts'; describe('box', () => { describe('subtractEdges', () => { diff --git a/src/box.ts b/src/box.ts index 63fda37..d275b97 100644 --- a/src/box.ts +++ b/src/box.ts @@ -1,4 +1,4 @@ -import { isObject, Obj, typeError } from './types.js'; +import { isObject, Obj, typeError } from './types.ts'; export type Pos = { x: number; y: number }; export type Size = { width: number; height: number }; diff --git a/src/font-loader.test.ts b/src/font-loader.test.ts index 60c7efd..ed039cf 100644 --- a/src/font-loader.test.ts +++ b/src/font-loader.test.ts @@ -1,9 +1,9 @@ import fontkit from '@pdf-lib/fontkit'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { createFontLoader, createFontStore, FontLoader } from './font-loader.js'; -import { Font, FontDef, FontSelector } from './fonts.js'; -import { fakeFont, mkData } from './test/test-utils.js'; +import { createFontLoader, createFontStore, FontLoader } from './font-loader.ts'; +import { Font, FontDef, FontSelector } from './fonts.ts'; +import { fakeFont, mkData } from './test/test-utils.ts'; describe('font-loader', () => { let normalFont: FontDef; diff --git a/src/font-loader.ts b/src/font-loader.ts index 6cf882c..2f0de15 100644 --- a/src/font-loader.ts +++ b/src/font-loader.ts @@ -1,9 +1,9 @@ import fontkit from '@pdf-lib/fontkit'; import { toUint8Array } from 'pdf-lib'; -import { FontWeight } from './api/content.js'; -import { Font, FontDef, FontSelector, weightToNumber } from './fonts.js'; -import { pickDefined } from './types.js'; +import { FontWeight } from './api/content.ts'; +import { Font, FontDef, FontSelector, weightToNumber } from './fonts.ts'; +import { pickDefined } from './types.ts'; export type LoadedFont = { name: string; diff --git a/src/fonts.test.ts b/src/fonts.test.ts index 43414de..619ec76 100644 --- a/src/fonts.test.ts +++ b/src/fonts.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { readFonts, weightToNumber } from './fonts.js'; +import { readFonts, weightToNumber } from './fonts.ts'; describe('fonts', () => { describe('readFonts', () => { diff --git a/src/fonts.ts b/src/fonts.ts index bd0c9f5..4e52f01 100644 --- a/src/fonts.ts +++ b/src/fonts.ts @@ -1,10 +1,10 @@ import fontkit from '@pdf-lib/fontkit'; import { CustomFontSubsetEmbedder, PDFDocument, PDFFont, PDFRef } from 'pdf-lib'; -import { FontStyle, FontWeight } from './api/content.js'; -import { parseBinaryData } from './binary-data.js'; -import { printValue } from './print-value.js'; -import { optional, readAs, readBoolean, readObject, required, types } from './types.js'; +import { FontStyle, FontWeight } from './api/content.ts'; +import { parseBinaryData } from './binary-data.ts'; +import { printValue } from './print-value.ts'; +import { optional, readAs, readBoolean, readObject, required, types } from './types.ts'; /** * The resolved definition of a font. diff --git a/src/frame.ts b/src/frame.ts index bbcba47..fcd1ad2 100644 --- a/src/frame.ts +++ b/src/frame.ts @@ -1,7 +1,7 @@ -import { Font } from './fonts.js'; -import { Image } from './images.js'; -import { Color } from './read-color.js'; -import { PathCommand } from './svg-paths.js'; +import { Font } from './fonts.ts'; +import { Image } from './images.ts'; +import { Color } from './read-color.ts'; +import { PathCommand } from './svg-paths.ts'; /** * Frames are created during the layout process. They have a position diff --git a/src/guides.ts b/src/guides.ts index 5498579..06d5f5c 100644 --- a/src/guides.ts +++ b/src/guides.ts @@ -1,6 +1,6 @@ import { rgb } from 'pdf-lib'; -import { ZERO_EDGES } from './box.js'; +import { ZERO_EDGES } from './box.ts'; import { CircleObject, Frame, @@ -8,9 +8,9 @@ import { LineObject, RectObject, TextRowObject, -} from './frame.js'; -import { Block } from './read-block.js'; -import { compact } from './utils.js'; +} from './frame.ts'; +import { Block } from './read-block.ts'; +import { compact } from './utils.ts'; export function createFrameGuides( frame: Frame, diff --git a/src/image-loader.test.ts b/src/image-loader.test.ts index c85f4b8..b9e4eb7 100644 --- a/src/image-loader.test.ts +++ b/src/image-loader.test.ts @@ -4,8 +4,8 @@ import { join } from 'node:path'; import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; -import { createImageLoader, createImageStore, ImageLoader } from './image-loader.js'; -import { ImageSelector } from './images.js'; +import { createImageLoader, createImageStore, ImageLoader } from './image-loader.ts'; +import { ImageSelector } from './images.ts'; global.crypto ??= (crypto as any).webcrypto; diff --git a/src/image-loader.ts b/src/image-loader.ts index d32128f..d825e3d 100644 --- a/src/image-loader.ts +++ b/src/image-loader.ts @@ -2,9 +2,9 @@ import { readFile } from 'node:fs/promises'; import { toUint8Array } from 'pdf-lib'; -import { Image, ImageDef, ImageFormat, ImageSelector } from './images.js'; -import { isJpeg, readJpegInfo } from './images/jpeg.js'; -import { isPng, readPngInfo } from './images/png.js'; +import { Image, ImageDef, ImageFormat, ImageSelector } from './images.ts'; +import { isJpeg, readJpegInfo } from './images/jpeg.ts'; +import { isPng, readPngInfo } from './images/png.ts'; export type LoadedImage = { data: Uint8Array; diff --git a/src/images.test.ts b/src/images.test.ts index 4c786e2..45ff001 100644 --- a/src/images.test.ts +++ b/src/images.test.ts @@ -4,8 +4,8 @@ import { join } from 'node:path'; import { describe, expect, it } from 'vitest'; -import { Image, readImages, registerImage } from './images.js'; -import { fakePDFDocument, mkData } from './test/test-utils.js'; +import { Image, readImages, registerImage } from './images.ts'; +import { fakePDFDocument, mkData } from './test/test-utils.ts'; global.crypto ??= (crypto as any).webcrypto; diff --git a/src/images.ts b/src/images.ts index ceb3a51..84057f5 100644 --- a/src/images.ts +++ b/src/images.ts @@ -1,7 +1,7 @@ import { JpegEmbedder, PDFDocument, PDFRef, PngEmbedder } from 'pdf-lib'; -import { parseBinaryData } from './binary-data.js'; -import { optional, readAs, readObject, required, types } from './types.js'; +import { parseBinaryData } from './binary-data.ts'; +import { optional, readAs, readObject, required, types } from './types.ts'; const imageFormats = ['jpeg', 'png']; export type ImageFormat = (typeof imageFormats)[number]; diff --git a/src/images/jpeg.test.ts b/src/images/jpeg.test.ts index ba7e113..78b1b42 100644 --- a/src/images/jpeg.test.ts +++ b/src/images/jpeg.test.ts @@ -3,7 +3,7 @@ import { join } from 'node:path'; import { describe, expect, it } from 'vitest'; -import { isJpeg, readJpegInfo } from './jpeg.js'; +import { isJpeg, readJpegInfo } from './jpeg.ts'; describe('jpeg', () => { describe('isJpeg', () => { diff --git a/src/images/png.test.ts b/src/images/png.test.ts index 437ca45..64ea234 100644 --- a/src/images/png.test.ts +++ b/src/images/png.test.ts @@ -3,7 +3,7 @@ import { join } from 'node:path'; import { describe, expect, it } from 'vitest'; -import { isPng, readPngInfo } from './png.js'; +import { isPng, readPngInfo } from './png.ts'; describe('png', () => { describe('isPng', () => { diff --git a/src/index.ts b/src/index.ts index 343bfdb..3449092 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,2 @@ -export * from './api/content.js'; -export { makePdf } from './api/make-pdf.js'; +export * from './api/content.ts'; +export { makePdf } from './api/make-pdf.ts'; diff --git a/src/layout/layout-columns.test.ts b/src/layout/layout-columns.test.ts index 783984a..b55a9ea 100644 --- a/src/layout/layout-columns.test.ts +++ b/src/layout/layout-columns.test.ts @@ -1,11 +1,11 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { Box } from '../box.js'; -import { FontStore } from '../font-loader.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { Block } from '../read-block.js'; -import { fakeFont, span } from '../test/test-utils.js'; -import { layoutColumnsContent } from './layout-columns.js'; +import { Box } from '../box.ts'; +import { FontStore } from '../font-loader.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { Block } from '../read-block.ts'; +import { fakeFont, span } from '../test/test-utils.ts'; +import { layoutColumnsContent } from './layout-columns.ts'; const { objectContaining } = expect; diff --git a/src/layout/layout-columns.ts b/src/layout/layout-columns.ts index 100753e..f9b77a8 100644 --- a/src/layout/layout-columns.ts +++ b/src/layout/layout-columns.ts @@ -1,8 +1,8 @@ -import { Box } from '../box.js'; -import { Frame } from '../frame.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { Block, ColumnsBlock } from '../read-block.js'; -import { layoutBlock, LayoutContent } from './layout.js'; +import { Box } from '../box.ts'; +import { Frame } from '../frame.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { Block, ColumnsBlock } from '../read-block.ts'; +import { layoutBlock, LayoutContent } from './layout.ts'; export async function layoutColumnsContent( block: ColumnsBlock, diff --git a/src/layout/layout-image.test.ts b/src/layout/layout-image.test.ts index 3e6eef3..c964477 100644 --- a/src/layout/layout-image.test.ts +++ b/src/layout/layout-image.test.ts @@ -1,12 +1,12 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { Box } from '../box.js'; -import { ImageStore } from '../image-loader.js'; -import { ImageSelector } from '../images.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { ImageBlock } from '../read-block.js'; -import { fakeImage } from '../test/test-utils.js'; -import { layoutImageContent } from './layout-image.js'; +import { Box } from '../box.ts'; +import { ImageStore } from '../image-loader.ts'; +import { ImageSelector } from '../images.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { ImageBlock } from '../read-block.ts'; +import { fakeImage } from '../test/test-utils.ts'; +import { layoutImageContent } from './layout-image.ts'; const { objectContaining } = expect; diff --git a/src/layout/layout-image.ts b/src/layout/layout-image.ts index 9eab8f1..c6d3ee6 100644 --- a/src/layout/layout-image.ts +++ b/src/layout/layout-image.ts @@ -1,9 +1,9 @@ -import { Box, Pos, Size } from '../box.js'; -import { ImageObject, RenderObject } from '../frame.js'; -import { Image } from '../images.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { ImageBlock } from '../read-block.js'; -import { LayoutContent } from './layout.js'; +import { Box, Pos, Size } from '../box.ts'; +import { ImageObject, RenderObject } from '../frame.ts'; +import { Image } from '../images.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { ImageBlock } from '../read-block.ts'; +import { LayoutContent } from './layout.ts'; export async function layoutImageContent( block: ImageBlock, diff --git a/src/layout/layout-rows.test.ts b/src/layout/layout-rows.test.ts index d2de15a..c81cc46 100644 --- a/src/layout/layout-rows.test.ts +++ b/src/layout/layout-rows.test.ts @@ -1,12 +1,12 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { Box } from '../box.js'; -import { FontStore } from '../font-loader.js'; -import { Frame } from '../frame.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { Block } from '../read-block.js'; -import { extractTextRows, fakeFont, range, span } from '../test/test-utils.js'; -import { layoutRowsContent } from './layout-rows.js'; +import { Box } from '../box.ts'; +import { FontStore } from '../font-loader.ts'; +import { Frame } from '../frame.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { Block } from '../read-block.ts'; +import { extractTextRows, fakeFont, range, span } from '../test/test-utils.ts'; +import { layoutRowsContent } from './layout-rows.ts'; describe('layout-rows', () => { let ctx: MakerCtx, box: Box; diff --git a/src/layout/layout-rows.ts b/src/layout/layout-rows.ts index 9631eea..1b2bf8e 100644 --- a/src/layout/layout-rows.ts +++ b/src/layout/layout-rows.ts @@ -1,9 +1,9 @@ -import { Box, ZERO_EDGES } from '../box.js'; -import { Frame } from '../frame.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { Block, RowsBlock } from '../read-block.js'; -import { compact, omit } from '../utils.js'; -import { isBreakPossible, layoutBlock, LayoutContent } from './layout.js'; +import { Box, ZERO_EDGES } from '../box.ts'; +import { Frame } from '../frame.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { Block, RowsBlock } from '../read-block.ts'; +import { compact, omit } from '../utils.ts'; +import { isBreakPossible, layoutBlock, LayoutContent } from './layout.ts'; export async function layoutRowsContent( block: RowsBlock, diff --git a/src/layout/layout-text.test.ts b/src/layout/layout-text.test.ts index 0afca4a..9ec24bd 100644 --- a/src/layout/layout-text.test.ts +++ b/src/layout/layout-text.test.ts @@ -1,12 +1,12 @@ import { rgb } from 'pdf-lib'; import { beforeEach, describe, expect, it } from 'vitest'; -import { Box } from '../box.js'; -import { FontStore } from '../font-loader.js'; -import { Font, FontSelector } from '../fonts.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { extractTextRows, fakeFont, range, span } from '../test/test-utils.js'; -import { layoutTextContent } from './layout-text.js'; +import { Box } from '../box.ts'; +import { FontStore } from '../font-loader.ts'; +import { Font, FontSelector } from '../fonts.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { extractTextRows, fakeFont, range, span } from '../test/test-utils.ts'; +import { layoutTextContent } from './layout-text.ts'; const { objectContaining } = expect; diff --git a/src/layout/layout-text.ts b/src/layout/layout-text.ts index 624d785..f4cda61 100644 --- a/src/layout/layout-text.ts +++ b/src/layout/layout-text.ts @@ -1,18 +1,18 @@ -import { Box, Size } from '../box.js'; -import { Font } from '../fonts.js'; -import { LinkObject, RenderObject, TextRowObject, TextSegmentObject } from '../frame.js'; -import { createRowGuides } from '../guides.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { TextBlock } from '../read-block.js'; +import { Box, Size } from '../box.ts'; +import { Font } from '../fonts.ts'; +import { LinkObject, RenderObject, TextRowObject, TextSegmentObject } from '../frame.ts'; +import { createRowGuides } from '../guides.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { TextBlock } from '../read-block.ts'; import { breakLine, convertToTextSpan, extractTextSegments, flattenTextSegments, TextSegment, -} from '../text.js'; -import { omit } from '../utils.js'; -import { LayoutContent } from './layout.js'; +} from '../text.ts'; +import { omit } from '../utils.ts'; +import { LayoutContent } from './layout.ts'; export async function layoutTextContent( block: TextBlock, diff --git a/src/layout/layout.test.ts b/src/layout/layout.test.ts index 86564c2..3feb0fd 100644 --- a/src/layout/layout.test.ts +++ b/src/layout/layout.test.ts @@ -1,13 +1,13 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { paperSizes } from '../api/sizes.js'; -import { Box } from '../box.js'; -import { FontStore } from '../font-loader.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { Block, TextAttrs, TextSpan } from '../read-block.js'; -import { PageInfo, readDocumentDefinition } from '../read-document.js'; -import { fakeFont, p, range } from '../test/test-utils.js'; -import { isBreakPossible, layoutBlock, layoutPages } from './layout.js'; +import { paperSizes } from '../api/sizes.ts'; +import { Box } from '../box.ts'; +import { FontStore } from '../font-loader.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { Block, TextAttrs, TextSpan } from '../read-block.ts'; +import { PageInfo, readDocumentDefinition } from '../read-document.ts'; +import { fakeFont, p, range } from '../test/test-utils.ts'; +import { isBreakPossible, layoutBlock, layoutPages } from './layout.ts'; const { objectContaining } = expect; diff --git a/src/layout/layout.ts b/src/layout/layout.ts index 64b37c9..d9308e6 100644 --- a/src/layout/layout.ts +++ b/src/layout/layout.ts @@ -1,17 +1,17 @@ -import { paperSizes } from '../api/sizes.js'; -import { Box, parseEdges, Size, subtractEdges, ZERO_EDGES } from '../box.js'; -import { AnchorObject, Frame } from '../frame.js'; -import { createFrameGuides } from '../guides.js'; -import { MakerCtx } from '../maker-ctx.js'; -import { Page } from '../page.js'; -import { Block, RowsBlock } from '../read-block.js'; -import { DocumentDefinition } from '../read-document.js'; -import { applyOrientation } from '../read-page-size.js'; -import { pickDefined } from '../types.js'; -import { layoutColumnsContent } from './layout-columns.js'; -import { layoutImageContent } from './layout-image.js'; -import { layoutRowsContent } from './layout-rows.js'; -import { layoutTextContent } from './layout-text.js'; +import { paperSizes } from '../api/sizes.ts'; +import { Box, parseEdges, Size, subtractEdges, ZERO_EDGES } from '../box.ts'; +import { AnchorObject, Frame } from '../frame.ts'; +import { createFrameGuides } from '../guides.ts'; +import { MakerCtx } from '../maker-ctx.ts'; +import { Page } from '../page.ts'; +import { Block, RowsBlock } from '../read-block.ts'; +import { DocumentDefinition } from '../read-document.ts'; +import { applyOrientation } from '../read-page-size.ts'; +import { pickDefined } from '../types.ts'; +import { layoutColumnsContent } from './layout-columns.ts'; +import { layoutImageContent } from './layout-image.ts'; +import { layoutRowsContent } from './layout-rows.ts'; +import { layoutTextContent } from './layout-text.ts'; const defaultPageMargin = parseEdges('2cm'); diff --git a/src/maker-ctx.ts b/src/maker-ctx.ts index 12a4734..dc3bd39 100644 --- a/src/maker-ctx.ts +++ b/src/maker-ctx.ts @@ -1,5 +1,5 @@ -import { FontStore } from './font-loader.js'; -import { ImageStore } from './image-loader.js'; +import { FontStore } from './font-loader.ts'; +import { ImageStore } from './image-loader.ts'; export type MakerCtx = { fontStore: FontStore; diff --git a/src/page.test.ts b/src/page.test.ts index 3ec28c0..f73f610 100644 --- a/src/page.test.ts +++ b/src/page.test.ts @@ -1,9 +1,9 @@ import { PDFPage } from 'pdf-lib'; import { beforeEach, describe, expect, it } from 'vitest'; -import { Font } from './fonts.js'; -import { addPageFont, getExtGraphicsState, Page } from './page.js'; -import { fakeFont, fakePDFPage } from './test/test-utils.js'; +import { Font } from './fonts.ts'; +import { addPageFont, getExtGraphicsState, Page } from './page.ts'; +import { fakeFont, fakePDFPage } from './test/test-utils.ts'; describe('page', () => { let page: Page, pdfPage: PDFPage; diff --git a/src/page.ts b/src/page.ts index 4b8beff..1f8500d 100644 --- a/src/page.ts +++ b/src/page.ts @@ -1,9 +1,9 @@ import { Color, PDFName, PDFPage } from 'pdf-lib'; -import { Size } from './box.js'; -import { Font, registerFont } from './fonts.js'; -import { Frame } from './frame.js'; -import { Image, registerImage } from './images.js'; +import { Size } from './box.ts'; +import { Font, registerFont } from './fonts.ts'; +import { Frame } from './frame.ts'; +import { Image, registerImage } from './images.ts'; export type TextState = { color?: Color; diff --git a/src/print-value.test.ts b/src/print-value.test.ts index 77c517d..253d310 100644 --- a/src/print-value.test.ts +++ b/src/print-value.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { printValue } from './print-value.js'; +import { printValue } from './print-value.ts'; describe('print-value', () => { describe('printValue', () => { diff --git a/src/read-block.test.ts b/src/read-block.test.ts index cf88566..3a8a0dd 100644 --- a/src/read-block.test.ts +++ b/src/read-block.test.ts @@ -6,7 +6,7 @@ import { readRowsBlock, readText, readTextBlock, -} from './read-block.js'; +} from './read-block.ts'; describe('read-block', () => { describe('readBlock', () => { diff --git a/src/read-block.ts b/src/read-block.ts index 2136062..fc243a0 100644 --- a/src/read-block.ts +++ b/src/read-block.ts @@ -1,8 +1,8 @@ -import { Alignment, FontStyle, FontWeight } from './api/content.js'; -import { BoxEdges, parseEdges, parseLength } from './box.js'; -import { Shape } from './frame.js'; -import { Color, readColor } from './read-color.js'; -import { readShape } from './read-graphics.js'; +import { Alignment, FontStyle, FontWeight } from './api/content.ts'; +import { BoxEdges, parseEdges, parseLength } from './box.ts'; +import { Shape } from './frame.ts'; +import { Color, readColor } from './read-color.ts'; +import { readShape } from './read-graphics.ts'; import { dynamic, isObject, @@ -15,7 +15,7 @@ import { TypeDef, typeError, types, -} from './types.js'; +} from './types.ts'; export type Block = TextBlock | ImageBlock | ColumnsBlock | RowsBlock | EmptyBlock; diff --git a/src/read-color.ts b/src/read-color.ts index c5809ef..f12e19c 100644 --- a/src/read-color.ts +++ b/src/read-color.ts @@ -1,7 +1,7 @@ import { Color, rgb } from 'pdf-lib'; -import { namedColors } from './api/colors.js'; -import { typeError } from './types.js'; +import { namedColors } from './api/colors.ts'; +import { typeError } from './types.ts'; export { Color }; diff --git a/src/read-colors.test.ts b/src/read-colors.test.ts index ef74b11..4854c55 100644 --- a/src/read-colors.test.ts +++ b/src/read-colors.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { readColor } from './read-color.js'; +import { readColor } from './read-color.ts'; const { closeTo } = expect; diff --git a/src/read-document.test.ts b/src/read-document.test.ts index 2cbbaa1..23f2919 100644 --- a/src/read-document.test.ts +++ b/src/read-document.test.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { PageInfo, readDocumentDefinition } from './read-document.js'; +import { PageInfo, readDocumentDefinition } from './read-document.ts'; describe('read-document', () => { describe('readDocumentDefinition', () => { diff --git a/src/read-document.ts b/src/read-document.ts index ca5bc71..28ec730 100644 --- a/src/read-document.ts +++ b/src/read-document.ts @@ -1,9 +1,9 @@ -import { BoxEdges, parseEdges, Size } from './box.js'; -import { FontDef, readFonts } from './fonts.js'; -import { ImageDef, readImages } from './images.js'; -import { Block, readBlock, readInheritableAttrs, TextAttrs } from './read-block.js'; -import { parseOrientation, readPageSize } from './read-page-size.js'; -import { dynamic, Obj, optional, readAs, readObject, required, typeError, types } from './types.js'; +import { BoxEdges, parseEdges, Size } from './box.ts'; +import { FontDef, readFonts } from './fonts.ts'; +import { ImageDef, readImages } from './images.ts'; +import { Block, readBlock, readInheritableAttrs, TextAttrs } from './read-block.ts'; +import { parseOrientation, readPageSize } from './read-page-size.ts'; +import { dynamic, Obj, optional, readAs, readObject, required, typeError, types } from './types.ts'; export type DocumentDefinition = { fonts?: FontDef[]; diff --git a/src/read-graphics.test.ts b/src/read-graphics.test.ts index df3ca0f..08ce47d 100644 --- a/src/read-graphics.test.ts +++ b/src/read-graphics.test.ts @@ -1,8 +1,8 @@ import { rgb } from 'pdf-lib'; import { describe, expect, it } from 'vitest'; -import { readShape } from './read-graphics.js'; -import { p } from './test/test-utils.js'; +import { readShape } from './read-graphics.ts'; +import { p } from './test/test-utils.ts'; const transformAttrs = { translate: { x: 1, y: 2 }, diff --git a/src/read-graphics.ts b/src/read-graphics.ts index 0224114..47e5240 100644 --- a/src/read-graphics.ts +++ b/src/read-graphics.ts @@ -5,11 +5,11 @@ import { PolylineObject, RectObject, Shape, -} from './frame.js'; -import { readColor } from './read-color.js'; -import { parseSvgPath } from './svg-paths.js'; -import { Obj, optional, readFrom, readObject, required, types } from './types.js'; -import { omit } from './utils.js'; +} from './frame.ts'; +import { readColor } from './read-color.ts'; +import { parseSvgPath } from './svg-paths.ts'; +import { Obj, optional, readFrom, readObject, required, types } from './types.ts'; +import { omit } from './utils.ts'; const tLineCap = types.string({ enum: ['butt', 'round', 'square'] }); const tLineJoin = types.string({ enum: ['miter', 'round', 'bevel'] }); diff --git a/src/read-page-size.test.ts b/src/read-page-size.test.ts index 3aad974..15b2a7f 100644 --- a/src/read-page-size.test.ts +++ b/src/read-page-size.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { paperSizes } from './api/sizes.js'; -import { applyOrientation, parseOrientation, readPageSize } from './read-page-size.js'; +import { paperSizes } from './api/sizes.ts'; +import { applyOrientation, parseOrientation, readPageSize } from './read-page-size.ts'; describe('read-page-sizes', () => { describe('readPageSize', () => { diff --git a/src/read-page-size.ts b/src/read-page-size.ts index 4dc47c0..3ed0c57 100644 --- a/src/read-page-size.ts +++ b/src/read-page-size.ts @@ -1,6 +1,6 @@ -import { paperSizes } from './api/sizes.js'; -import { parseLength, Size } from './box.js'; -import { isObject, readFrom, required, typeError } from './types.js'; +import { paperSizes } from './api/sizes.ts'; +import { parseLength, Size } from './box.ts'; +import { isObject, readFrom, required, typeError } from './types.ts'; export function readPageSize(def?: unknown): Size { if (typeof def === 'string') { diff --git a/src/render/render-annotations.ts b/src/render/render-annotations.ts index 9bc388f..be4f468 100644 --- a/src/render/render-annotations.ts +++ b/src/render/render-annotations.ts @@ -1,8 +1,8 @@ import { PDFArray, PDFDict, PDFName, PDFPage, PDFString } from 'pdf-lib'; -import { Box, Pos } from '../box.js'; -import { AnchorObject, LinkObject } from '../frame.js'; -import { Page } from '../page.js'; +import { Box, Pos } from '../box.ts'; +import { AnchorObject, LinkObject } from '../frame.ts'; +import { Page } from '../page.ts'; export function renderAnchor(obj: AnchorObject, page: Page, base: Pos) { const x = base.x + obj.x; diff --git a/src/render/render-document.test.ts b/src/render/render-document.test.ts index cc42b2e..a0c6eca 100644 --- a/src/render/render-document.test.ts +++ b/src/render/render-document.test.ts @@ -3,7 +3,7 @@ import crypto from 'node:crypto'; import { PDFDict, PDFDocument, PDFHexString, PDFName, PDFStream, PDFString } from 'pdf-lib'; import { describe, expect, it } from 'vitest'; -import { renderDocument } from './render-document.js'; +import { renderDocument } from './render-document.ts'; global.crypto ??= (crypto as any).webcrypto; diff --git a/src/render/render-document.ts b/src/render/render-document.ts index d8087ff..190b639 100644 --- a/src/render/render-document.ts +++ b/src/render/render-document.ts @@ -1,8 +1,8 @@ import { PDFDict, PDFDocument, PDFHexString, PDFName } from 'pdf-lib'; -import { Page } from '../page.js'; -import { DocumentDefinition, Metadata } from '../read-document.js'; -import { renderPage } from './render-page.js'; +import { Page } from '../page.ts'; +import { DocumentDefinition, Metadata } from '../read-document.ts'; +import { renderPage } from './render-page.ts'; export async function renderDocument(def: DocumentDefinition, pages: Page[]): Promise { const pdfDoc = await PDFDocument.create({ updateMetadata: false }); diff --git a/src/render/render-graphics.test.ts b/src/render/render-graphics.test.ts index 310ccd8..dfebed5 100644 --- a/src/render/render-graphics.test.ts +++ b/src/render/render-graphics.test.ts @@ -1,11 +1,11 @@ import { rgb } from 'pdf-lib'; import { beforeEach, describe, expect, it } from 'vitest'; -import { Size } from '../box.js'; -import { CircleObject, LineObject, PathObject, PolylineObject, RectObject } from '../frame.js'; -import { Page } from '../page.js'; -import { fakePDFPage, getContentStream, p } from '../test/test-utils.js'; -import { renderGraphics } from './render-graphics.js'; +import { Size } from '../box.ts'; +import { CircleObject, LineObject, PathObject, PolylineObject, RectObject } from '../frame.ts'; +import { Page } from '../page.ts'; +import { fakePDFPage, getContentStream, p } from '../test/test-utils.ts'; +import { renderGraphics } from './render-graphics.ts'; describe('render-graphics', () => { let page: Page, size: Size; diff --git a/src/render/render-graphics.ts b/src/render/render-graphics.ts index 4085333..9e1911b 100644 --- a/src/render/render-graphics.ts +++ b/src/render/render-graphics.ts @@ -23,8 +23,8 @@ import { stroke, } from 'pdf-lib'; -import { LineCap, LineJoin } from '../api/content.js'; -import { Pos } from '../box.js'; +import { LineCap, LineJoin } from '../api/content.ts'; +import { Pos } from '../box.ts'; import { CircleObject, FillAttrs, @@ -35,10 +35,10 @@ import { PolylineObject, RectObject, Shape, -} from '../frame.js'; -import { getExtGraphicsState, Page } from '../page.js'; -import { svgPathToPdfOps } from '../svg-paths.js'; -import { compact, multiplyMatrices, round } from '../utils.js'; +} from '../frame.ts'; +import { getExtGraphicsState, Page } from '../page.ts'; +import { svgPathToPdfOps } from '../svg-paths.ts'; +import { compact, multiplyMatrices, round } from '../utils.ts'; // See https://stackoverflow.com/a/27863181/247159 const KAPPA = (4 * (Math.sqrt(2) - 1)) / 3; diff --git a/src/render/render-image.test.ts b/src/render/render-image.test.ts index 4e5a8db..b09fa01 100644 --- a/src/render/render-image.test.ts +++ b/src/render/render-image.test.ts @@ -1,11 +1,11 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { Size } from '../box.js'; -import { ImageObject } from '../frame.js'; -import { Image } from '../images.js'; -import { Page } from '../page.js'; -import { fakePDFPage, getContentStream } from '../test/test-utils.js'; -import { renderImage } from './render-image.js'; +import { Size } from '../box.ts'; +import { ImageObject } from '../frame.ts'; +import { Image } from '../images.ts'; +import { Page } from '../page.ts'; +import { fakePDFPage, getContentStream } from '../test/test-utils.ts'; +import { renderImage } from './render-image.ts'; describe('render-image', () => { let page: Page, size: Size, image: Image; diff --git a/src/render/render-image.ts b/src/render/render-image.ts index b446e73..b5481e6 100644 --- a/src/render/render-image.ts +++ b/src/render/render-image.ts @@ -7,10 +7,10 @@ import { translate, } from 'pdf-lib'; -import { Pos } from '../box.js'; -import { ImageObject } from '../frame.js'; -import { addPageImage, Page } from '../page.js'; -import { compact } from '../utils.js'; +import { Pos } from '../box.ts'; +import { ImageObject } from '../frame.ts'; +import { addPageImage, Page } from '../page.ts'; +import { compact } from '../utils.ts'; export function renderImage(object: ImageObject, page: Page, base: Pos) { const x = base.x + object.x; diff --git a/src/render/render-page.test.ts b/src/render/render-page.test.ts index 409d574..90c13a2 100644 --- a/src/render/render-page.test.ts +++ b/src/render/render-page.test.ts @@ -1,12 +1,12 @@ import { PDFArray, PDFDict, PDFDocument, PDFName, PDFPage, PDFRef } from 'pdf-lib'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { Size } from '../box.js'; -import { Font } from '../fonts.js'; -import { Frame } from '../frame.js'; -import { Page } from '../page.js'; -import { fakeFont, fakePDFPage, getContentStream } from '../test/test-utils.js'; -import { renderFrame, renderPage } from './render-page.js'; +import { Size } from '../box.ts'; +import { Font } from '../fonts.ts'; +import { Frame } from '../frame.ts'; +import { Page } from '../page.ts'; +import { fakeFont, fakePDFPage, getContentStream } from '../test/test-utils.ts'; +import { renderFrame, renderPage } from './render-page.ts'; describe('render-page', () => { let pdfPage: PDFPage; diff --git a/src/render/render-page.ts b/src/render/render-page.ts index fa2f2fa..72bbf0c 100644 --- a/src/render/render-page.ts +++ b/src/render/render-page.ts @@ -1,12 +1,12 @@ import { PDFDocument } from 'pdf-lib'; -import { Pos } from '../box.js'; -import { Frame } from '../frame.js'; -import { Page } from '../page.js'; -import { renderAnchor, renderLink } from './render-annotations.js'; -import { renderGraphics } from './render-graphics.js'; -import { renderImage } from './render-image.js'; -import { renderText } from './render-text.js'; +import { Pos } from '../box.ts'; +import { Frame } from '../frame.ts'; +import { Page } from '../page.ts'; +import { renderAnchor, renderLink } from './render-annotations.ts'; +import { renderGraphics } from './render-graphics.ts'; +import { renderImage } from './render-image.ts'; +import { renderText } from './render-text.ts'; export function renderPage(page: Page, pdfDoc: PDFDocument) { page.pdfPage = pdfDoc.addPage([page.size.width, page.size.height]); diff --git a/src/render/render-text.test.ts b/src/render/render-text.test.ts index eeb4b91..b24f152 100644 --- a/src/render/render-text.test.ts +++ b/src/render/render-text.test.ts @@ -1,11 +1,11 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { Size } from '../box.js'; -import { Font } from '../fonts.js'; -import { TextObject } from '../frame.js'; -import { Page } from '../page.js'; -import { fakeFont, fakePDFPage, getContentStream } from '../test/test-utils.js'; -import { renderText } from './render-text.js'; +import { Size } from '../box.ts'; +import { Font } from '../fonts.ts'; +import { TextObject } from '../frame.ts'; +import { Page } from '../page.ts'; +import { fakeFont, fakePDFPage, getContentStream } from '../test/test-utils.ts'; +import { renderText } from './render-text.ts'; describe('render-text', () => { let page: Page, size: Size, font: Font; diff --git a/src/render/render-text.ts b/src/render/render-text.ts index 5499304..58d3515 100644 --- a/src/render/render-text.ts +++ b/src/render/render-text.ts @@ -15,10 +15,10 @@ import { showText, } from 'pdf-lib'; -import { Pos } from '../box.js'; -import { TextObject } from '../frame.js'; -import { addPageFont, Page, TextState } from '../page.js'; -import { compact } from '../utils.js'; +import { Pos } from '../box.ts'; +import { TextObject } from '../frame.ts'; +import { addPageFont, Page, TextState } from '../page.ts'; +import { compact } from '../utils.ts'; export function renderText(object: TextObject, page: Page, base: Pos) { const contentStream: PDFContentStream = (page.pdfPage as any).getContentStream(); diff --git a/src/svg-paths.test.ts b/src/svg-paths.test.ts index 3c7f8d7..2205bf8 100644 --- a/src/svg-paths.test.ts +++ b/src/svg-paths.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { parseSvgPath, svgPathToPdfOps, tokenizeSvgPath } from './svg-paths.js'; +import { parseSvgPath, svgPathToPdfOps, tokenizeSvgPath } from './svg-paths.ts'; describe('svg-paths', () => { describe('tokenize', () => { diff --git a/src/svg-paths.ts b/src/svg-paths.ts index 36b1885..6230173 100644 --- a/src/svg-paths.ts +++ b/src/svg-paths.ts @@ -7,7 +7,7 @@ import { PDFOperator, } from 'pdf-lib'; -import { arcToSegments, segmentToBezier } from './arcs.js'; +import { arcToSegments, segmentToBezier } from './arcs.ts'; const svgOpsParams = { M: 2, diff --git a/src/test/test-utils.ts b/src/test/test-utils.ts index a5222dd..c1c0a79 100644 --- a/src/test/test-utils.ts +++ b/src/test/test-utils.ts @@ -1,10 +1,10 @@ import { PDFContext, PDFDocument, PDFFont, PDFName, PDFPage, PDFRef } from 'pdf-lib'; -import { Font, weightToNumber } from '../fonts.js'; -import { Frame } from '../frame.js'; -import { Image } from '../images.js'; -import { Page } from '../page.js'; -import { TextAttrs, TextSpan } from '../read-block.js'; +import { Font, weightToNumber } from '../fonts.ts'; +import { Frame } from '../frame.ts'; +import { Image } from '../images.ts'; +import { Page } from '../page.ts'; +import { TextAttrs, TextSpan } from '../read-block.ts'; export function fakeFont( name: string, diff --git a/src/text.test.ts b/src/text.test.ts index 484efe0..7df2bc6 100644 --- a/src/text.test.ts +++ b/src/text.test.ts @@ -1,9 +1,9 @@ import { rgb } from 'pdf-lib'; import { beforeEach, describe, expect, it } from 'vitest'; -import { FontStore } from './font-loader.js'; -import { Font } from './fonts.js'; -import { fakeFont } from './test/test-utils.js'; +import { FontStore } from './font-loader.ts'; +import { Font } from './fonts.ts'; +import { fakeFont } from './test/test-utils.ts'; import { breakLine, extractTextSegments, @@ -11,7 +11,7 @@ import { flattenTextSegments, splitChunks, TextSegment, -} from './text.js'; +} from './text.ts'; const { objectContaining } = expect; diff --git a/src/text.ts b/src/text.ts index b60b352..d1a8764 100644 --- a/src/text.ts +++ b/src/text.ts @@ -1,9 +1,9 @@ -import { FontStyle, FontWeight } from './api/content.js'; -import { FontStore } from './font-loader.js'; -import { getTextHeight, getTextWidth } from './font-metrics.js'; -import { Font } from './fonts.js'; -import { TextSpan } from './read-block.js'; -import { Color } from './read-color.js'; +import { FontStyle, FontWeight } from './api/content.ts'; +import { FontStore } from './font-loader.ts'; +import { getTextHeight, getTextWidth } from './font-metrics.ts'; +import { Font } from './fonts.ts'; +import { TextSpan } from './read-block.ts'; +import { Color } from './read-color.ts'; const defaultFontSize = 18; const defaultLineHeight = 1.2; diff --git a/src/types.test.ts b/src/types.test.ts index 2ef4ca2..8278672 100644 --- a/src/types.test.ts +++ b/src/types.test.ts @@ -15,7 +15,7 @@ import { readString, required, types, -} from './types.js'; +} from './types.ts'; describe('types', () => { describe('pickDefined', () => { diff --git a/src/types.ts b/src/types.ts index 97c5c88..3a182fa 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,4 @@ -import { printValue } from './print-value.js'; +import { printValue } from './print-value.ts'; export type Obj = Record; diff --git a/src/utils.test.ts b/src/utils.test.ts index 913fa43..ac2a4df 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { round } from './utils.js'; +import { round } from './utils.ts'; describe('utils', () => { describe('round', () => {