Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "2"
members = ["crates/cli", "crates/diagnostics", "crates/project-resolver", "crates/ts-transform", "crates/bundler", "crates/template-compiler", "crates/npm-resolver", "crates/linker", "crates/watch", "crates/dev-server"]

[workspace.package]
version = "0.10.17"
version = "0.10.18"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["lukekania"]
Expand Down
4 changes: 4 additions & 0 deletions packages/builder/schemas/dev-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
"type": "object",
"additionalProperties": { "type": "string" },
"description": "Custom HTTP response headers emitted on every served response (static assets, the SPA-fallback index.html, and the SSE live-reload stream). Use this to serve production-like security headers (CSP, Cross-Origin-Opener-Policy), CORS headers, or cache-control overrides in dev. Headers the dev server sets itself (Content-Type, Cache-Control) are not overridden. Headers are not added to proxy-forwarded responses, which keep their upstream headers."
},
"hmr": {
"type": "boolean",
"description": "Enable Hot Module Replacement: edits to component templates and styles (and global stylesheets) are applied in place without a full page reload, preserving component and form state. TypeScript edits still trigger a full reload. When unset, the spawned binary falls back to `architect.serve.options.hmr` in angular.json (default false, matching today's full-reload behavior)."
}
},
"additionalProperties": false
Expand Down
18 changes: 18 additions & 0 deletions packages/builder/src/serve/__tests__/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@ describe('translateOptions', () => {
).not.toContain('--headers');
expect(translateOptions(base, '/ws').args).not.toContain('--headers');
});

it('forwards hmr: true as --hmr', () => {
const t = translateOptions({ ...base, hmr: true }, '/ws');
expect(t.args).toContain('--hmr');
expect(t.args).not.toContain('--no-hmr');
});

it('forwards hmr: false as --no-hmr', () => {
const t = translateOptions({ ...base, hmr: false }, '/ws');
expect(t.args).toContain('--no-hmr');
expect(t.args).not.toContain('--hmr');
});

it('omits both hmr flags when hmr is unset so the binary inherits angular.json', () => {
const args = translateOptions(base, '/ws').args;
expect(args).not.toContain('--hmr');
expect(args).not.toContain('--no-hmr');
});
});

describe('formatUrl', () => {
Expand Down
9 changes: 9 additions & 0 deletions packages/builder/src/serve/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface DevServerOptions extends json.JsonObject {
servePath: string | null;
allowedHosts: string[] | null;
headers: { [key: string]: string } | null;
hmr: boolean | null;
}

export interface TranslatedServeArgs {
Expand Down Expand Up @@ -95,6 +96,14 @@ export function translateOptions(
if (headers !== null) {
args.push('--headers', headers);
}
// `hmr` is tri-state: an explicit true/false becomes `--hmr`/`--no-hmr`
// (the CLI override flags), while unset forwards nothing so the binary
// falls back to `architect.serve.options.hmr` in angular.json.
if (raw.hmr === true) {
args.push('--hmr');
} else if (raw.hmr === false) {
args.push('--no-hmr');
}
args.push(...sslArgs);

return {
Expand Down