Skip to content

Commit

Permalink
Use beta @derbyjs scoped racer
Browse files Browse the repository at this point in the history
  • Loading branch information
craigbeck committed Jan 17, 2024
1 parent e542d37 commit eb1a5e0
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
"test-browser": "node test/server.js"
},
"dependencies": {
"@derbyjs/racer": "^2.0.0-beta.1",
"chokidar": "^3.5.3",
"esprima-derby": "^0.1.0",
"html-util": "^0.2.3",
"qs": "^6.11.0",
"racer": "git+ssh://[email protected]/derbyjs/racer.git#racer-2",
"resolve": "^1.22.1",
"serialize-object": "^1.0.0",
"tracks": "^0.5.8"
Expand Down
4 changes: 2 additions & 2 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { EventEmitter } from 'events';
import { basename } from 'path';

import { type Model } from 'racer';
import { util } from 'racer';
import { type Model } from '@derbyjs/racer';
import { util } from '@derbyjs/racer';

import components = require('./components');
import { type ComponentConstructor, type SingletonComponentConstructor } from './components';
Expand Down
2 changes: 1 addition & 1 deletion src/AppForServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
*/

import * as racer from 'racer';
import * as racer from '@derbyjs/racer';

const util = racer.util;
import { AppBase } from './App';
Expand Down
2 changes: 1 addition & 1 deletion src/Controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventEmitter } from 'events';

import { type Model } from 'racer';
import { type Model } from '@derbyjs/racer';

import { type AppBase } from './App';
import { type ComponentModelData } from './components';
Expand Down
19 changes: 4 additions & 15 deletions src/Derby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
*
*/

import { Racer, util, type Model} from '@derbyjs/racer';

import { App, type AppBase } from './App';
import { Component } from './components';
import { Page } from './Page';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const racer = require('racer');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Racer = require('racer/lib/Racer');

export abstract class DerbyBase extends Racer {
Component = Component;
abstract createApp(name: string, filename: string, options): AppBase
Expand All @@ -21,21 +18,13 @@ export abstract class DerbyBase extends Racer {
export class Derby extends DerbyBase {
App = App;
Page = Page;
Model: typeof racer.Model;
Model: typeof Model;

createApp(name: string, filename: string, options) {
return new this.App(this, name, filename, options);
}

use(plugin, options) {
return racer.util.use.call(this, plugin, options);
}

serverUse(plugin, options) {
return racer.util.serverUse.call(this, plugin, options);
}
}

if (!racer.util.isServer) {
if (!util.isServer) {
module.require('./documentListeners').add(document);
}
4 changes: 2 additions & 2 deletions src/DerbyStandalone.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import Model = require('racer/lib/Model/ModelStandalone');
// import util = require('racer/lib/util');
// import Model = require('@derbyjs/racer/lib/Model/ModelStandalone');
// import util = require('@derbyjs/racer/lib/util');

// import { App } from './App';
// import * as components from './components';
Expand Down
2 changes: 1 addition & 1 deletion src/Page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Model, util } from 'racer';
import { type Model, util } from '@derbyjs/racer';

import { type AppBase, type App } from './App';
import components = require('./components');
Expand Down
2 changes: 1 addition & 1 deletion src/PageForServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Model } from '@derbyjs/racer';
import type { Request, Response } from 'express';
import { type Model } from 'racer';

import { type AppForServer } from './AppForServer';
import { PageBase } from './Page';
Expand Down
2 changes: 1 addition & 1 deletion src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

import { type ChildModel, type ModelData, util } from 'racer';
import { type ChildModel, type ModelData, util } from '@derbyjs/racer';

import { Controller } from './Controller';
import { PageBase } from './Page';
Expand Down
5 changes: 3 additions & 2 deletions src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
*
*/

import * as racer from '@derbyjs/racer';

var fs = require('fs');
var path = require('path');
var util = require('racer/lib/util');
var resolve = require('resolve');
var parsing = require('./parsing');

Expand Down Expand Up @@ -55,7 +56,7 @@ function loadViewsSync(app, sourceFilename, namespace) {

function loadStylesSync(app, sourceFilename, options) {
if (options == null) {
options = { compress: util.isProduction };
options = { compress: racer.util.isProduction };
}
var resolved = resolve.sync(sourceFilename, {
extensions: app.styleExtensions,
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { util } from '@derbyjs/racer';

import { Derby } from './Derby';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const util = require('racer').util;

const DerbyClass = util.isServer
? util.serverRequire(module, './DerbyForServer').DerbyForServer
Expand Down
2 changes: 1 addition & 1 deletion src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Model } from 'racer';
import { type Model } from '@derbyjs/racer';
import tracks = require('tracks');

import { type AppBase } from './App';
Expand Down
8 changes: 4 additions & 4 deletions src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'racer';
import '@derbyjs/racer';

declare module 'racer' {
declare module '@derbyjs/racer' {
interface util {
isProduction: boolean;
}
interface Model {
hasErrored: boolean;
hasErrored?: boolean;
}
}

declare module 'racer/lib/util' {
declare module '@derbyjs/racer/lib/util' {
export let isProduction: boolean;
}
2 changes: 1 addition & 1 deletion test-utils/domTestRunner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var util = require('racer').util;
var util = require('@derbyjs/racer').util;
var registerAssertions = require('./assertions');
var ComponentHarness = require('./ComponentHarness');

Expand Down

0 comments on commit eb1a5e0

Please sign in to comment.