@@ -6,6 +6,9 @@ import { createTemplateFactory } from '@ember/template-factory';
66const { getTemplateLocals } = importSync ( '@glimmer/syntax' ) ;
77const { precompileJSON } = importSync ( '@glimmer/compiler' ) ;
88
9+ import DynamicTemplateError from './dynamic-template-error' ;
10+ import ColorPallet from './color-pallet' ;
11+
912let templateOwnerMap = new Map ( ) ;
1013
1114export default class DynamicTemplateComponent extends Component {
@@ -75,11 +78,11 @@ export default class DynamicTemplateComponent extends Component {
7578
7679// copied from https://github.com/NullVoxPopuli/limber/blob/main/packages/ember-repl/addon/src/compile/formats/hbs.ts
7780function compileTemplate ( source , { moduleName, scope = { } } ) {
78- let localScope = { ...scope } ;
81+ let localScope = { DynamicTemplateError , ColorPallet , ...scope } ;
7982 let locals = getTemplateLocals ( source ) ;
8083
8184 let options = {
82- strictMode : true ,
85+ strictMode : false ,
8386 moduleName,
8487 locals,
8588 isProduction : false ,
@@ -91,14 +94,6 @@ function compileTemplate(source, { moduleName, scope = {} }) {
9194
9295 let usedScope = usedLocals . map ( ( key ) => {
9396 let value = localScope [ key ] ;
94-
95- if ( ! value ) {
96- throw new Error (
97- `Attempt to use ${ key } in compiled hbs, but it was not available in scope. ` +
98- `Available scope includes: ${ Object . keys ( localScope ) } ` ,
99- ) ;
100- }
101-
10297 return value ;
10398 } ) ;
10499
@@ -108,7 +103,7 @@ function compileTemplate(source, { moduleName, scope = {} }) {
108103 block : blockJSON ,
109104 moduleName : moduleName ?? '(dynamically compiled component)' ,
110105 scope : ( ) => usedScope ,
111- isStrictMode : true ,
106+ isStrictMode : false ,
112107 } ;
113108
114109 let factory = createTemplateFactory ( templateJSONObject ) ;
0 commit comments