Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 6b9dc28

Browse files
committed
Rename 'mainscript' to 'main'
1 parent fce5a9a commit 6b9dc28

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

framework/react/init.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { Aleph } from '../../types.ts'
44
export async function init(aleph: Aleph) {
55
if (aleph.mode === 'development') {
66
const alephPkgUri = getAlephPkgUri()
7-
const alephPkgPath = alephPkgUri.replace('https://', '').replace('http://localhost:', 'http_localhost_')
87
const refreshModule = await aleph.addModule(`${alephPkgUri}/framework/react/refresh.ts`, `
98
import runtime from 'https://esm.sh/[email protected]/runtime'
109
import util from '../../shared/util.ts'
@@ -19,7 +18,7 @@ export async function init(aleph: Aleph) {
1918
__REACT_REFRESH__: util.debounce(runtime.performReactRefresh, 30)
2019
})
2120
`)
22-
aleph.onTransform('mainscript', ({ code }) => ({
21+
aleph.onTransform('main', ({ code }) => ({
2322
code: [
2423
`import ".${refreshModule.jsFile}";`,
2524
code

server/aleph.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ type LoadListener = {
7676
}
7777

7878
type TransformListener = {
79-
test: RegExp | 'hmr' | 'mainscript',
79+
test: RegExp | 'hmr' | 'main',
8080
transform(input: TransformInput): TransformOutput,
8181
}
8282

@@ -515,7 +515,7 @@ export class Aleph implements IAleph {
515515
this.#loadListeners.push({ test, load: callback })
516516
}
517517

518-
onTransform(test: RegExp | 'hmr' | 'mainscript', callback: (input: TransformInput) => TransformOutput): void {
518+
onTransform(test: RegExp | 'hmr' | 'main', callback: (input: TransformInput) => TransformOutput): void {
519519
this.#transformListeners.push({ test, transform: callback })
520520
}
521521

@@ -691,7 +691,7 @@ export class Aleph implements IAleph {
691691
`bootstrap(${JSON.stringify(config, undefined, this.isDev ? 2 : undefined)});`
692692
].filter(Boolean).join('\n')
693693
this.#transformListeners.forEach(({ test, transform }) => {
694-
if (test === 'mainscript') {
694+
if (test === 'main') {
695695
const ret = transform({ specifier: '/main.js', code })
696696
code = ret.code
697697
}

0 commit comments

Comments
 (0)