DEV: Migrate to Ember CLI (#11932)

This encompasses a lot of work done over the last year, much of which
has already been merged into master. This is the final set of changes
required to get Ember CLI running locally for development.

From here on it will be bug fixes / enhancements.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: romanrizzi <rizziromanalejandro@gmail.com>

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: romanrizzi <rizziromanalejandro@gmail.com>
This commit is contained in:
Robin Ward
2021-02-03 14:22:20 -05:00
committed by GitHub
parent 8ad5284cf7
commit 61f5d501cb
25 changed files with 23103 additions and 1247 deletions
+14 -5
View File
@@ -279,9 +279,13 @@ class Compiler {
}
}
function compile(template) {
const preprocessor = Ember.__loader.require("@glimmer/syntax");
const compiled = preprocessor.preprocess(template);
const loader = typeof Ember !== "undefined" ? Ember.__loader.require : require;
function compile(template, glimmer) {
if (!glimmer) {
glimmer = loader("@glimmer/syntax");
}
const compiled = glimmer.preprocess(template);
const compiler = new Compiler(compiled);
let code = compiler.compile();
@@ -305,7 +309,7 @@ function error(path, state, msg) {
);
}
exports.WidgetHbsCompiler = function (babel) {
const WidgetHbsCompiler = function (babel) {
let t = babel.types;
return {
visitor: {
@@ -353,11 +357,16 @@ exports.WidgetHbsCompiler = function (babel) {
.join("");
try {
path.replaceWithSourceString(compile(template));
path.replaceWithSourceString(
compile(template, WidgetHbsCompiler.glimmer)
);
} catch (e) {
console.error("widget hbs error", e.toString());
return error(path, state, e.toString());
}
},
},
};
};
exports.WidgetHbsCompiler = WidgetHbsCompiler;