Skip to content

Commit

Permalink
minor refactor: rename onAssertModuleLoad => assertSingleInstance_onA…
Browse files Browse the repository at this point in the history
…ssertModuleLoad
  • Loading branch information
brillout committed Jul 4, 2024
1 parent 5e1e29e commit 584a074
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions vike/utils/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export { overwriteAssertProductionLogger }
export { isBug }
export { setAlwaysShowStackTrace }

import { onAssertModuleLoad } from './assertSingleInstance.js'
import { assertSingleInstance_onAssertModuleLoad } from './assertSingleInstance.js'
import { createErrorWithCleanStackTrace } from './createErrorWithCleanStackTrace.js'
import { getGlobalObject } from './getGlobalObject.js'
import { isObject } from './isObject.js'
Expand All @@ -34,7 +34,7 @@ const globalObject = getGlobalObject<{
showStackTraceList: new WeakSet()
})
type Logger = (msg: string | Error, logType: 'warn' | 'info') => void
onAssertModuleLoad()
assertSingleInstance_onAssertModuleLoad()

const projectTag = `[vike]` as const
const projectTagWithVersion = `[vike@${projectInfo.projectVersion}]` as const
Expand Down
4 changes: 2 additions & 2 deletions vike/utils/assertSingleInstance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { assertSingleInstance_onClientEntryServerRouting }
export { assertSingleInstance_onClientEntryClientRouting }
export { onAssertModuleLoad }
export { assertSingleInstance_onAssertModuleLoad }

// - Throw error if there are two different versions of vike loaded
// - Show warning if entry of Client Routing and entry of Server Routing are both loaded
Expand Down Expand Up @@ -76,7 +76,7 @@ function assertSingleInstance_onClientEntryClientRouting(isProduction: boolean)
}

// Called by utils/assert.ts which is (most certainly) loaded by all entries. That way we don't have to call a callback for every entry. (There are a lot of entries: `client/router/`, `client/`, `node/runtime/`, `node/plugin/`, `node/cli`.)
function onAssertModuleLoad() {
function assertSingleInstance_onAssertModuleLoad() {
globalObject.instances.push(projectInfo.projectVersion)
assertSingleInstance()
}
Expand Down

0 comments on commit 584a074

Please sign in to comment.