Skip to content

Commit

Permalink
Rename AppBase -> App, App -> AppForClient, same for Derby/DerbyForCl…
Browse files Browse the repository at this point in the history
…ient
  • Loading branch information
craigbeck committed Apr 18, 2024
1 parent 8d798ab commit fa3aa28
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { util } from 'racer';

import * as components from './components';
import { type ComponentConstructor, type SingletonComponentConstructor } from './components';
import { type Derby } from './Derby';
import { type DerbyForClient } from './Derby';
import { PageForClient, type Page } from './Page';
import { PageParams, routes } from './routes';
import * as derbyTemplates from './templates';
Expand Down Expand Up @@ -62,7 +62,7 @@ type Routes = [string, string, any][];
*/

export abstract class App extends EventEmitter {
derby: Derby;
derby: DerbyForClient;
name: string;
filename: string;
scriptHash: string;
Expand Down
4 changes: 2 additions & 2 deletions src/AppForServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import * as racer from 'racer';

import { App } from './App';
import { type DerbyBase } from './Derby';
import { type Derby } from './Derby';
import { type StyleCompilerOptions } from './files';
import { PageForServer } from './PageForServer';
import parsing = require('./parsing');
Expand Down Expand Up @@ -79,7 +79,7 @@ export class AppForServer extends App {
watchFiles: boolean;
router: any;

constructor(derby: DerbyBase, name: string, filename: string, options) {
constructor(derby: Derby, name: string, filename: string, options) {
super(derby, name, filename, options);
this._init(options);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Derby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { AppForClient, type App, type AppOptions } from './App';
import { Component } from './components';
import { PageForClient } from './Page';

export abstract class DerbyBase extends Racer {
export abstract class Derby extends Racer {
Component = Component;

abstract createApp(name?: string, filename?: string, options?: AppOptions): App
}

export class Derby extends DerbyBase {
export class DerbyForClient extends Derby {
App = AppForClient;
Page = PageForClient;

Expand Down
4 changes: 2 additions & 2 deletions src/DerbyForServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { util } from 'racer';

import { App } from './App';
import { AppForServer } from './AppForServer';
import { DerbyBase } from './Derby';
import { Derby } from './Derby';
import { PageForServer } from './PageForServer';

util.isProduction = process.env.NODE_ENV === 'production';

export class DerbyForServer extends DerbyBase {
export class DerbyForServer extends Derby {
App = AppForServer;
Page = PageForServer;

Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { util } from 'racer';

import { type AppOptions } from './App';
import { Derby, type DerbyBase } from './Derby';
import { DerbyForClient, type Derby } from './Derby';

export { type AppForClient, type App as AppBase } from './App';
export { type AppForServer } from './AppForServer';
export { AppForClient, App } from './App';
export { AppForServer } from './AppForServer';
export { Dom } from './Dom';
export { Page, PageForClient } from './Page';
export { PageForServer } from './PageForServer';
Expand All @@ -19,8 +19,8 @@ export { type PageParams, type QueryParams } from './routes';

const DerbyClass = util.isServer
? util.serverRequire(module, './DerbyForServer').DerbyForServer
: Derby;
const instance: DerbyBase = new DerbyClass();
: DerbyForClient;
const instance: Derby = new DerbyClass();

export function createApp(name?: string, file?: string, options?: AppOptions) {
return instance.createApp(name, file, options);
Expand All @@ -31,7 +31,7 @@ export function use<T = unknown>(plugin: (derby: Derby, options?: T) => Derby, o
}

export {
Derby,
DerbyForClient as Derby,
instance,
util,
}

0 comments on commit fa3aa28

Please sign in to comment.