Skip to content

Commit

Permalink
chore: use absolute imports
Browse files Browse the repository at this point in the history
  • Loading branch information
vuolter committed Nov 18, 2024
1 parent e33149b commit 6f00ea4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { COMPRESSIBLE_CONTENT_TYPE_REGEX } from 'hono/utils/compress'
import {
CACHECONTROL_NOTRANSFORM_REGEXP,
CLOUDFLARE_WORKERS_NAVIGATOR,
} from './constants'
} from '~/constants'

export const isCloudflareWorkers =
globalThis.navigator?.userAgent === CLOUDFLARE_WORKERS_NAVIGATOR
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { compress, compress as default } from './middleware'
export * from './streams'
export * from './types'
export { compress, compress as default } from '~/middleware'
export * from '~/streams'
export * from '~/types'
8 changes: 4 additions & 4 deletions src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import type { Context, MiddlewareHandler } from 'hono'

import type { CompressionEncoding, CompressionFilter, CompressOptions } from './types'
import type { CompressionEncoding, CompressionFilter, CompressOptions } from '~/types'

import {
ACCEPTED_ENCODINGS,
BROTLI_LEVEL,
THRESHOLD_SIZE,
ZLIB_LEVEL,
ZSTD_LEVEL,
} from './constants'
} from '~/constants'
import {
isCloudflareWorkers,
isDenoDeploy,
shouldCompress,
shouldTransform,
zlib,
} from './helpers'
} from '~/helpers'
import {
BrotliCompressionStream,
ZlibCompressionStream,
ZstdCompressionStream,
} from './streams'
} from '~/streams'

function checkCompressEncodings(encodings: CompressionEncoding[]) {
const unsupportedEncoding: string | undefined = encodings.find(
Expand Down
4 changes: 2 additions & 2 deletions src/streams.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import zstd from '@mongodb-js/zstd'

import type { NodeCompressionEncoding, NodeCompressionOptions } from './types'
import type { NodeCompressionEncoding, NodeCompressionOptions } from '~/types'

import { brotli, zlib } from './helpers'
import { brotli, zlib } from '~/helpers'

export class ZstdCompressionStream extends TransformStream {
constructor(level?: number) {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Context } from 'hono'
import type { BrotliOptions, ZlibOptions } from 'node:zlib'

import type { ACCEPTED_ENCODINGS, NODE_ENCODINGS } from './constants'
import type { ACCEPTED_ENCODINGS, NODE_ENCODINGS } from '~/constants'

export type CompressionEncoding = (typeof ACCEPTED_ENCODINGS)[number]

Expand Down
4 changes: 2 additions & 2 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, expect, it } from 'bun:test'
import { type Context, Hono } from 'hono'

import type { CompressionEncoding } from '../src/types'
import type { CompressionEncoding } from '~/types'

import { compress } from '../src'
import { compress } from '~/middleware'

const TEXT = `
もしも願いが一つ叶うなら
Expand Down

0 comments on commit 6f00ea4

Please sign in to comment.