Skip to content

Commit

Permalink
@ts-ignore private API usage from Ember
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Jun 30, 2023
1 parent a688e53 commit 3e01a8e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,29 @@ export default function buildRegistry(resolver: Resolver) {
},
};

// @ts-ignore: this is private API.
let fallbackRegistry = Application.buildRegistry(namespace);
// TODO: only do this on Ember < 3.13
// @ts-ignore: this is private API.
fallbackRegistry.register('component-lookup:main', Ember.ComponentLookup);

// @ts-ignore: this is private API.
let registry = new Ember.Registry({
fallback: fallbackRegistry,
});

// @ts-ignore: this is private API.
ApplicationInstance.setupRegistry(registry);

// these properties are set on the fallback registry by `buildRegistry`
// and on the primary registry within the ApplicationInstance constructor
// but we need to manually recreate them since ApplicationInstance's are not
// exposed externally
// @ts-ignore: this is private API.
registry.normalizeFullName = fallbackRegistry.normalizeFullName;
// @ts-ignore: this is private API.
registry.makeToString = fallbackRegistry.makeToString;
// @ts-ignore: this is private API.
registry.describe = fallbackRegistry.describe;

let owner = Owner.create({
Expand All @@ -129,7 +136,9 @@ export default function buildRegistry(resolver: Resolver) {
__container__: null,
}) as unknown as Owner;

// @ts-ignore: this is private API.
let container = registry.container({ owner: owner });
// @ts-ignore: this is private API.
owner.__container__ = container;

exposeRegistryMethodsWithoutDeprecations(container);
Expand Down
2 changes: 1 addition & 1 deletion addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator-for-testing": "^1.0.0",
"ember-resolver": "^9.0.1",
"ember-source": "~5.1.0-beta.1",
"ember-source": "~4.12",
"ember-source-channel-url": "^3.0.0",
"ember-try": "^2.0.0",
"eslint": "^7.32.0",
Expand Down
Loading

0 comments on commit 3e01a8e

Please sign in to comment.