Skip to content

Commit

Permalink
refa: timer as non-builtin plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Nov 2, 2024
1 parent f2804ab commit 6211121
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion packages/cordis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"@cordisjs/loader": "^0.13.1",
"@cordisjs/logger": "^0.3.3",
"@cordisjs/schema": "^0.1.1",
"@cordisjs/timer": "^0.3.2",
"cac": "^6.7.14",
"cosmokit": "^1.6.3",
"kleur": "^4.1.5",
Expand Down
4 changes: 0 additions & 4 deletions packages/cordis/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import * as core from '@cordisjs/core'
import { Logger, LoggerService } from '@cordisjs/logger'
import { SchemaService } from '@cordisjs/schema'
import { TimerService } from '@cordisjs/timer'

export * from '@cordisjs/core'
export { Schema, z } from '@cordisjs/schema'
export { Logger } from '@cordisjs/logger'
export { TimerService } from '@cordisjs/timer'

export interface Events<C extends Context = Context> extends core.Events<C> {}

Expand All @@ -22,10 +20,8 @@ export class Context extends core.Context {
this.baseDir = globalThis.process?.cwd?.() || ''

this.provide('logger', undefined, true)
this.provide('timer', undefined, true)

this.plugin(LoggerService)
this.plugin(TimerService)
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export interface Context {
export class Context {
static readonly store: unique symbol = symbols.store as any
static readonly events: unique symbol = symbols.events as any
static readonly static: unique symbol = symbols.static as any
static readonly filter: unique symbol = symbols.filter as any
static readonly isolate: unique symbol = symbols.isolate as any
static readonly internal: unique symbol = symbols.internal as any
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const symbols = {
// context symbols
store: Symbol.for('cordis.store') as typeof Context.store,
events: Symbol.for('cordis.events') as typeof Context.events,
static: Symbol.for('cordis.static') as typeof Context.static,
filter: Symbol.for('cordis.filter') as typeof Context.filter,
isolate: Symbol.for('cordis.isolate') as typeof Context.isolate,
internal: Symbol.for('cordis.internal') as typeof Context.internal,
Expand Down
7 changes: 7 additions & 0 deletions packages/hmr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,22 @@
"development"
],
"cordis": {
"services": {
"required": [
"timer"
]
},
"description": {
"en": "Hot Module Replacement",
"zh": "模块热替换"
}
},
"peerDependencies": {
"@cordisjs/plugin-timer": "^0.3.2",
"cordis": "^3.18.1"
},
"devDependencies": {
"@cordisjs/plugin-timer": "^0.3.2",
"@types/babel__code-frame": "^7.0.6",
"cordis": "^3.18.1",
"esbuild": "^0.23.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/hmr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ModuleJob, ModuleLoader } from 'cordis/loader'
import { FSWatcher, watch, WatchOptions } from 'chokidar'
import { relative, resolve } from 'path'
import { handleError } from './error.ts'
import {} from '@cordisjs/timer'
import {} from '@cordisjs/plugin-timer'
import { fileURLToPath, pathToFileURL } from 'url'
import enUS from './locales/en-US.yml'
import zhCN from './locales/zh-CN.yml'
Expand Down Expand Up @@ -37,7 +37,7 @@ interface Reload {
}

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

private base: string
private internal: ModuleLoader
Expand Down
2 changes: 1 addition & 1 deletion packages/timer/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@cordisjs/timer",
"name": "@cordisjs/plugin-timer",
"description": "Timer service for cordis",
"version": "0.3.2",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/timer/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# @cordisjs/timer
# @cordisjs/plugin-timer

0 comments on commit 6211121

Please sign in to comment.