Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MacrosConfig.shared().packageMoved(origApp.root, this.appDestDir);
for (let originalPkg of movedSet.packages) {
// Update our rootCache so we don't need to rediscover moved packages
let movedPkg;
if (originalPkg === origApp) {
// this wraps the original app package with one that will use moved
// dependencies. The app itself hasn't moved yet, which is why a proxy
// is needed at this level.
movedPkg = packageProxy(origApp, (pkg: Package) => this.moved.get(pkg) || pkg);
this.app = movedPkg;
rootCache.set(movedPkg.root, movedPkg);
} else {
movedPkg = this.movedPackage(originalPkg);
this.moved.set(originalPkg, movedPkg);
MacrosConfig.shared().packageMoved(originalPkg.root, movedPkg.root);
}
// Update our resolutionCache so we still know as much about the moved
// packages as we did before we moved them, without redoing package
// resolution.
let resolutions = new Map();
for (let dep of originalPkg.dependencies) {
if (movedSet.packages.has(dep)) {
resolutions.set(dep.name, this.movedPackage(dep));
} else {
resolutions.set(dep.name, dep);
}
}
resolutionCache.set(movedPkg, resolutions);
}
this.rootCache = rootCache;
if (!babel.plugins) {
babel.plugins = [];
}
// Our stage3 code is always allowed to use dynamic import. We may emit it
// ourself when splitting routes.
babel.plugins.push(
require.resolve(
this.adapter.babelMajorVersion() === 6
? 'babel-plugin-syntax-dynamic-import'
: '@babel/plugin-syntax-dynamic-import'
)
);
// this is @embroider/macros configured for full stage3 resolution
babel.plugins.push(MacrosConfig.shared().babelPluginConfig());
// this is our built-in support for the inline hbs macro
babel.plugins.push([
join(__dirname, 'babel-plugin-inline-hbs.js'),
{
templateCompiler,
stage: 3,
},
]);
babel.plugins.push(this.adjustImportsPlugin(appFiles));
return new PortableBabelConfig(babel, { basedir: this.root });
}
module.exports = function(defaults) {
let app = new EmberApp(defaults, {});
MacrosConfig.shared().setOwnConfig(__filename, {
isClassic: Boolean(process.env.CLASSIC),
});
if (process.env.CLASSIC) {
return app.toTree();
}
const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack, {
workspaceDir: process.env.WORKSPACE_DIR,
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticComponents: true,
staticHelpers: true,
packageRules: [
{
private templateCompiler(config: EmberENV) {
let plugins = this.adapter.htmlbarsPlugins();
if (!plugins.ast) {
plugins.ast = [];
}
for (let macroPlugin of MacrosConfig.shared().astPlugins()) {
plugins.ast.push(macroPlugin);
}
return new TemplateCompiler({
plugins,
compilerPath: resolve.sync(this.adapter.templateCompilerPath(), { basedir: this.root }),
resolver: this.adapter.templateResolver(),
EmberENV: config,
});
}
constructor(
private root: string,
private app: Package,
private adapter: AppAdapter,
private options: Required
) {
MacrosConfig.shared().setOwnConfig(__filename, { active: true });
}