Skip to content

Commit

Permalink
Merge pull request #1686 from embroider-build/require-resolve
Browse files Browse the repository at this point in the history
Resolver bugfixes
  • Loading branch information
ef4 authored Dec 9, 2023
2 parents b6c717f + 76b81eb commit b33cb4c
Show file tree
Hide file tree
Showing 15 changed files with 446 additions and 265 deletions.
11 changes: 6 additions & 5 deletions packages/compat/src/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,12 @@ export class Audit {
private async resolveDeps(deps: string[], fromFile: string): Promise<InternalModule['resolved']> {
let resolved = new Map() as NonNullable<InternalModule['resolved']>;
for (let dep of deps) {
if (['@embroider/macros'].includes(dep)) {
// the audit process deliberately removes the @embroider/macros babel
// plugins, so the imports are still present and should be left alone.
continue;
}

let resolution = await this.resolver.nodeResolve(dep, fromFile);
switch (resolution.type) {
case 'virtual':
Expand All @@ -542,11 +548,6 @@ export class Audit {
this.scheduleVisit(resolution.filename, fromFile);
break;
case 'not_found':
if (['@embroider/macros', '@ember/template-factory'].includes(dep)) {
// the audit process deliberately removes the @embroider/macros babel
// plugins, so the imports are still present and should be left alone.
continue;
}
resolved.set(dep, { isResolutionFailure: true as true });
break;
case 'real':
Expand Down
6 changes: 0 additions & 6 deletions packages/compat/src/compat-app-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,6 @@ export class CompatAppBuilder {
let renamePackages = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-packages']));
let renameModules = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-modules']));

let activeAddons: CompatResolverOptions['activeAddons'] = {};
for (let addon of this.allActiveAddons) {
activeAddons[addon.name] = addon.root;
}

let options: CompatResolverOptions['options'] = {
staticHelpers: this.options.staticHelpers,
staticModifiers: this.options.staticModifiers,
Expand All @@ -277,7 +272,6 @@ export class CompatAppBuilder {

let config: CompatResolverOptions = {
// this part is the base ModuleResolverOptions as required by @embroider/core
activeAddons,
renameModules,
renamePackages,
resolvableExtensions: this.resolvableExtensions(),
Expand Down
1 change: 0 additions & 1 deletion packages/compat/tests/audit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('audit', function () {
activePackageRules: [],
renamePackages: {},
renameModules: {},
activeAddons: {},
engines: [
{
packageName: 'audit-this-app',
Expand Down
Loading

0 comments on commit b33cb4c

Please sign in to comment.