Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected buildBytecodeLoader(resolver: Resolver) {
let delegate = new CompilerDelegate(resolver);
let compiler = new BundleCompiler(delegate);
let mainLocator = locatorFor('template:mainTemplate', 'default');
mainLocator.meta.module = 'template:mainTemplate';
let block = JSON.parse(mainTemplate.block);
let compilableTemplate = compilable({
block,
referrer: mainLocator.meta,
});
compiler.addCompilableTemplate(mainLocator, compilableTemplate);
for (let module in this.templates) {
compiler.addTemplateSource(locatorFor(module, 'default'), this.templates[module]);
}
let { heap, pool, table } = compiler.compile();
let resolverTable: unknown[] = [];
let meta: Dict = {};
build() {
this.createBundleCompiler();
let { outputPath } = this;
let locator = this.delegate.templateLocatorFor({
module: '@glimmer/application',
name: 'mainLayout',
});
let block = JSON.parse(mainTemplate.block);
let compilableTemplate = compilable({
block,
referrer: locator.meta,
asPartial: false,
});
this.compiler.addCompilableTemplate(locator, compilableTemplate);
let [projectPath] = this.inputPaths;
this.listEntries().forEach((entry: WalkSyncEntry) => {
let { relativePath } = entry;
if (entry.isDirectory()) {
mkdirSync(join(outputPath, relativePath));
} else {
let content = this._readFile(relativePath);
if (extname(relativePath) === '.hbs') {
addTemplateSource(_locator: ModuleLocator, templateSource: string): SerializedTemplateBlock {
let locator = normalizeLocator(_locator);
let block = this.preprocess(locator, templateSource);
this.context.compiledBlocks.set(locator, block);
let layout = {
block,
referrer: locator,
asPartial: false,
};
let template = compilable(layout);
this.addCompilableTemplate(locator, template);
return block;
}