-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore hot reload functionality (#1138)
- Loading branch information
1 parent
453f833
commit 21fa88a
Showing
5 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import {bootstrapApp} from '../../shell/shell'; | ||
import {bootstrapApp} from '../../editor/editor'; | ||
|
||
bootstrapApp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("//build_defs:defaults.bzl", "ANGULAR_CDK_TS_DEPS", "ANGULAR_CORE_DEPS", "ANGULAR_MATERIAL_TS_DEPS", "ng_module") | ||
|
||
package( | ||
default_visibility = ["//build_defs:mesop_internal"], | ||
) | ||
|
||
ng_module( | ||
name = "editor", | ||
srcs = glob([ | ||
"*.ts", | ||
]), | ||
deps = [ | ||
"//mesop/protos:ui_jspb_proto", | ||
"//mesop/web/src/component_renderer", | ||
"//mesop/web/src/error", | ||
"//mesop/web/src/services", | ||
"//mesop/web/src/shell", | ||
"//mesop/web/src/utils", | ||
] + ANGULAR_CORE_DEPS + ANGULAR_CDK_TS_DEPS + ANGULAR_MATERIAL_TS_DEPS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import {Component} from '@angular/core'; | ||
import { | ||
DefaultHotReloadWatcher, | ||
HotReloadWatcher, | ||
} from '../services/hot_reload_watcher'; | ||
import {bootstrapApplication} from '@angular/platform-browser'; | ||
import {provideAnimations} from '@angular/platform-browser/animations'; | ||
import {RouterOutlet, Routes, provideRouter} from '@angular/router'; | ||
import { | ||
DebugErrorDialogService, | ||
ErrorDialogService, | ||
} from '../services/error_dialog_service'; | ||
import {Shell, registerComponentRendererElement} from '../shell/shell'; | ||
// Keep the following comment to ensure there's a hook for adding TS imports in the downstream sync. | ||
// ADD_TS_IMPORT_HERE | ||
|
||
@Component({ | ||
selector: 'mesop-editor', | ||
template: '<mesop-shell></mesop-shell>', | ||
standalone: true, | ||
imports: [Shell], | ||
providers: [{provide: HotReloadWatcher, useClass: DefaultHotReloadWatcher}], | ||
}) | ||
class Editor { | ||
constructor( | ||
private readonly hotReloadWatcher: HotReloadWatcher /* Inject hotReloadWatcher to ensure it's instantiated. */, | ||
) {} | ||
} | ||
|
||
const routes: Routes = [{path: '**', component: Editor}]; | ||
|
||
@Component({ | ||
selector: 'mesop-editor-app', | ||
template: '<router-outlet></router-outlet>', | ||
imports: [Editor, RouterOutlet], | ||
standalone: true, | ||
}) | ||
class MesopEditorApp {} | ||
|
||
export async function bootstrapApp() { | ||
const app = await bootstrapApplication(MesopEditorApp, { | ||
providers: [ | ||
provideAnimations(), | ||
provideRouter(routes), | ||
{provide: ErrorDialogService, useClass: DebugErrorDialogService}, | ||
], | ||
}); | ||
registerComponentRendererElement(app); | ||
} |