Skip to content

Commit ac2d041

Browse files
committed
refactor: do not use import path
1 parent 57ed42a commit ac2d041

34 files changed

+256
-105
lines changed

benchmark/boringnode/harness.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { setTimeout } from 'node:timers/promises'
22
import { Redis } from 'ioredis'
3-
import { Worker } from '#src/worker'
4-
import { Job } from '#src/job'
5-
import { Locator } from '#src/locator'
6-
import { redis } from '#drivers/redis_adapter'
3+
import { Worker } from '../../src/worker.js'
4+
import { Job } from '../../src/job.js'
5+
import { Locator } from '../../src/locator.js'
6+
import { redis } from '../../src/drivers/redis_adapter.js'
77
import { barrier, type BenchmarkOptions, type BenchmarkResult } from '../helpers.js'
8-
import type { QueueManagerConfig } from '#types/main'
8+
import type { QueueManagerConfig } from '../../src/types/main.js'
99

1010
// Barrier callback and job duration - set before each benchmark run
1111
let onJobComplete: (() => boolean) | null = null

examples/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { config } from './config.js'
2-
import { QueueManager } from '#src/queue_manager'
2+
import { QueueManager } from '../src/queue_manager.js'
33
import SendEmailJob from './jobs/send_email_job.js'
44
import SyncJob from './jobs/sync_job.js'
55

examples/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { redis } from '#drivers/redis_adapter'
2-
import { sync } from '#drivers/sync_adapter'
3-
import { knex } from '#drivers/knex_adapter'
4-
import type { QueueManagerConfig } from '#types/main'
1+
import { redis } from '../src/drivers/redis_adapter.js'
2+
import { sync } from '../src/drivers/sync_adapter.js'
3+
import { knex } from '../src/drivers/knex_adapter.js'
4+
import type { QueueManagerConfig } from '../src/types/main.js'
55

66
export const config: QueueManagerConfig = {
77
default: 'knex',

examples/jobs/send_email_job.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { setTimeout } from 'node:timers/promises'
2-
import { Job } from '#src/job'
3-
import type { JobOptions } from '#types/main'
2+
import { Job } from '../../src/job.js'
3+
import type { JobOptions } from '../../src/types/main.js'
44

55
interface SendEmailPayload {
66
to: string

examples/jobs/sync_job.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { setTimeout } from 'node:timers/promises'
2-
import { Job } from '#src/job'
3-
import type { JobOptions } from '#types/main'
2+
import { Job } from '../../src/job.js'
3+
import type { JobOptions } from '../../src/types/main.js'
44

55
interface SyncJobPayload {
66
source: string

examples/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Worker } from '#src/worker'
1+
import { Worker } from '../src/worker.js'
22
import { config } from './config.js'
33

44
const worker = new Worker(config)

package.json

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,17 @@
1313
"./contracts/*": "./build/src/contracts/*.js",
1414
"./types/*": "./build/src/types/*.js"
1515
},
16-
"imports": {
17-
"#src/*": "./src/*.ts",
18-
"#drivers/*": "./src/drivers/*.ts",
19-
"#lease_managers/*": "./src/lease_managers/*.ts",
20-
"#contracts/*": "./src/contracts/*.ts",
21-
"#strategies/*": "./src/strategies/*.ts",
22-
"#types/*": "./src/types/*.ts"
23-
},
2416
"scripts": {
25-
"benchmark": "node benchmark/run.ts",
26-
"benchmark:quick": "node benchmark/run.ts --quick",
27-
"benchmark:full": "node benchmark/run.ts --full",
17+
"benchmark": "node --import=@poppinss/ts-exec benchmark/run.ts",
18+
"benchmark:quick": "node --import=@poppinss/ts-exec benchmark/run.ts --quick",
19+
"benchmark:full": "node --import=@poppinss/ts-exec benchmark/run.ts --full",
2820
"build": "yarn clean && tsup-node",
2921
"clean": "del-cli build",
3022
"format": "prettier --write .",
3123
"lint": "eslint .",
3224
"prepublishOnly": "yarn build",
3325
"release": "yarn dlx release-it",
34-
"test": "c8 node --enable-source-maps bin/test.ts",
26+
"test": "c8 node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts",
3527
"typecheck": "tsc --noEmit"
3628
},
3729
"dependencies": {
@@ -41,11 +33,12 @@
4133
"devDependencies": {
4234
"@adonisjs/eslint-config": "^2.1.2",
4335
"@adonisjs/prettier-config": "^1.4.5",
44-
"@adonisjs/tsconfig": "^1.4.1",
36+
"@adonisjs/tsconfig": "^2.0.0-next.3",
4537
"@japa/assert": "^4.1.1",
4638
"@japa/expect-type": "^2.0.3",
4739
"@japa/file-system": "^2.3.2",
4840
"@japa/runner": "^4.4.0",
41+
"@poppinss/ts-exec": "^1.4.1",
4942
"@types/better-sqlite3": "^7.6.13",
5043
"@types/node": "^24.3.1",
5144
"@types/pg": "^8",

src/contracts/adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { JobData } from '#types/main'
1+
import type { JobData } from '../types/main.js'
22

33
export interface AcquiredJob extends JobData {
44
acquiredAt: number

src/drivers/knex_adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import KnexPkg from 'knex'
22
import type { Knex } from 'knex'
3-
import type { Adapter, AcquiredJob } from '#contracts/adapter'
4-
import type { JobData } from '#types/main'
3+
import type { Adapter, AcquiredJob } from '../contracts/adapter.js'
4+
import type { JobData } from '../types/main.js'
55

66
export interface KnexAdapterOptions {
77
connection: Knex

src/drivers/redis_adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Redis, type RedisOptions } from 'ioredis'
2-
import type { Adapter, AcquiredJob } from '#contracts/adapter'
3-
import type { JobData } from '#types/main'
2+
import type { Adapter, AcquiredJob } from '../contracts/adapter.js'
3+
import type { JobData } from '../types/main.js'
44

55
const redisKey = 'jobs'
66
type RedisConfig = Redis | RedisOptions

0 commit comments

Comments
 (0)