New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ivy): adhere to bootstrap options for JIT compiled components #35534
Changes from all commits
a6525b0
13e592e
89bfefa
ac88d89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import {ViewEncapsulation} from '../../metadata/view'; | ||
|
||
export interface JitCompilerOptions { | ||
defaultEncapsulation?: ViewEncapsulation; | ||
preserveWhitespaces?: boolean; | ||
} | ||
|
||
let jitOptions: JitCompilerOptions|null = null; | ||
|
||
export function setJitOptions(options: JitCompilerOptions): void { | ||
if (jitOptions !== null) { | ||
if (options.defaultEncapsulation !== jitOptions.defaultEncapsulation) { | ||
ngDevMode && | ||
console.error( | ||
'Provided value for `defaultEncapsulation` can not be changed once it has been set.'); | ||
return; | ||
} | ||
if (options.preserveWhitespaces !== jitOptions.preserveWhitespaces) { | ||
ngDevMode && | ||
console.error( | ||
'Provided value for `preserveWhitespaces` can not be changed once it has been set.'); | ||
return; | ||
} | ||
} | ||
jitOptions = options; | ||
} | ||
|
||
export function getJitOptions(): JitCompilerOptions|null { | ||
return jitOptions; | ||
} | ||
|
||
export function resetJitOptions(): void { | ||
jitOptions = null; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
declare global { | ||
const ngJitMode: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm.. we are starting to have too many places where the global is augmented. Could we consolidated this in a follow up PR? Many but possibly not all (e.g. spec?) of these files should be consolidated so that the global namespace type or value mangling happens from one place and is tracked by the ts-api-guardian:
|
||
} | ||
|
||
// Make this an ES module to be able to augment the global scope | ||
export {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct in your assumption -
ng_jit_mode.ts
needs to be side-effectfully imported into this file.