Skip to content

Commit

Permalink
fix(cli): fix version import
Browse files Browse the repository at this point in the history
close #9
  • Loading branch information
shigma committed Feb 7, 2024
1 parent 957e74d commit f58cb36
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions packages/cordis/src/bin/cordis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { cac } from 'cac'
import kleur from 'kleur'
import { start } from '../cli.js'
import { Dict, hyphenate } from 'cosmokit'
// @ts-ignore
import { version } from '../../package.json'
import { createRequire } from 'module'

const require = createRequire(import.meta.url)
const { version } = require('../../package.json')

function isInteger(source: any) {
return typeof source === 'number' && Math.floor(source) === source
Expand Down
2 changes: 1 addition & 1 deletion packages/hmr/src/error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Logger } from 'cordis/logger'
import { Logger } from 'cordis'
import { BuildFailure } from 'esbuild'
import { codeFrameColumns } from '@babel/code-frame'
import { readFileSync } from 'fs'
Expand Down
5 changes: 2 additions & 3 deletions packages/hmr/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Context, ForkScope, MainScope, Plugin } from 'cordis'
import { Context, ForkScope, Logger, MainScope, Plugin } from 'cordis'
import { Dict, makeArray } from 'cosmokit'
import { ModuleJob } from 'cordis/worker'
import Schema from 'schemastery'
import { FSWatcher, watch, WatchOptions } from 'chokidar'
import { relative, resolve } from 'path'
import { handleError } from './error.js'
import { Logger } from 'cordis/logger'
import {} from '@cordisjs/timer'
import { fileURLToPath, pathToFileURL } from 'url'

Expand Down Expand Up @@ -37,7 +36,7 @@ interface Reload {
}

class Watcher {
static inject = ['loader']
static inject = ['loader', 'timer']

private base: string
private watcher!: FSWatcher
Expand Down

0 comments on commit f58cb36

Please sign in to comment.