Skip to content

Commit

Permalink
Merge pull request #647 from derbyjs/fix-app-options-type
Browse files Browse the repository at this point in the history
Update AppOptions to include script* attributes
  • Loading branch information
craigbeck authored Oct 24, 2024
2 parents bcdbeac + 5e73279 commit 4705b33
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
21 changes: 20 additions & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,26 @@ export function createAppPage(derby): typeof Page {

export interface AppOptions {
appMetadata?: Record<string, string>,
scriptHash?: string,
/**
* Base URL that the JS bundles are served from, with no trailing slash.
* Used by bundler plugins such as derby-webpack and derby-browserify.
*/
scriptBaseUrl?: string,
/**
* If true, then Derby's <script> tags have the `crossorigin` attribute set by the bundler plugin.
*/
scriptCrossOrigin?: boolean,
/**
* If set, this is used for auto-refresh in development to determine whether the browser
* should auto-refresh due to running different code than the server. Some bundler plugins,
* such as derby-webpack, do their own hot reload and don't use this mechanism.
*/
scriptHash?: string;
/**
* Base URL for js.map files, if different from scriptBaseUrl.
*/
scriptMapBaseUrl?: string,
[key: string]: unknown,
}

type OnRouteCallback = (this: Page, page: Page, model: Model, params: PageParams, done?: () => void) => void;
Expand Down
4 changes: 2 additions & 2 deletions src/AppForServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import * as racer from 'racer';

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

constructor(derby: Derby, name: string, filename: string, options) {
constructor(derby: Derby, name: string, filename: string, options?: AppOptions) {
super(derby, name, filename, options);
this._init(options);
}
Expand Down

0 comments on commit 4705b33

Please sign in to comment.