Skip to content

Commit

Permalink
Merge pull request #20685 from emberjs/cleanup-template-only-feature
Browse files Browse the repository at this point in the history
Remove support for non-glimmer template-only components
  • Loading branch information
ef4 authored Apr 22, 2024
2 parents f9cfada + ddb78c0 commit aa91346
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 307 deletions.
15 changes: 0 additions & 15 deletions packages/@ember/-internals/environment/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,6 @@ export const ENV = {

STRUCTURED_PROFILE: false,

/**
Whether to use Glimmer Component semantics (as opposed to the classic "Curly"
components semantics) for template-only components. See RFC #278.
This is not intended to be set directly, as the implementation may change in
the future. Use `@ember/optional-features` instead.
@property _TEMPLATE_ONLY_GLIMMER_COMPONENTS
@for EmberENV
@type Boolean
@default false
@private
*/
_TEMPLATE_ONLY_GLIMMER_COMPONENTS: false,

/**
Whether to perform extra bookkeeping needed to make the `captureRenderTree`
API work.
Expand Down
23 changes: 5 additions & 18 deletions packages/@ember/-internals/glimmer/lib/resolver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { privatize as P } from '@ember/-internals/container';
import { ENV } from '@ember/-internals/environment';
import type { InternalFactory, InternalOwner, RegisterOptions } from '@ember/-internals/owner';
import { isFactory } from '@ember/-internals/owner';
import { assert } from '@ember/debug';
Expand Down Expand Up @@ -274,22 +272,11 @@ export default class ResolverImpl
let definition: Nullable<ResolvedComponentDefinition> = null;

if (pair.component === null) {
if (ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS) {
definition = {
state: templateOnlyComponent(undefined, name),
manager: TEMPLATE_ONLY_COMPONENT_MANAGER,
template,
};
} else {
let factory = owner.factoryFor(P`component:-default`)!;
let manager = getInternalComponentManager(factory.class as object);

definition = {
state: factory,
manager,
template,
};
}
definition = {
state: templateOnlyComponent(undefined, name),
manager: TEMPLATE_ONLY_COMPONENT_MANAGER,
template,
};
} else {
let factory = pair.component;
assert(`missing component class ${name}`, factory.class !== undefined);
Expand Down
6 changes: 0 additions & 6 deletions packages/@ember/-internals/glimmer/lib/setup-registry.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { Registry } from '@ember/-internals/container';
import { privatize as P } from '@ember/-internals/container';
import { ENV } from '@ember/-internals/environment';
import { getOwner } from '@ember/-internals/owner';
import { assert } from '@ember/debug';
import Component from './component';
import Input from './components/input';
import LinkTo from './components/link-to';
import Textarea from './components/textarea';
Expand Down Expand Up @@ -53,8 +51,4 @@ export function setupEngineRegistry(registry: Registry): void {

registry.register('component:link-to', LinkTo);
registry.register('component:textarea', Textarea);

if (!ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS) {
registry.register(P`component:-default`, Component);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,6 @@ if (ENV._DEBUG_RENDER_TREE) {
moduleFor(
'Application test: debug render tree',
class extends ApplicationTestCase {
_TEMPLATE_ONLY_GLIMMER_COMPONENTS: boolean;

constructor(assert: QUnit['assert']) {
super(assert);
this._TEMPLATE_ONLY_GLIMMER_COMPONENTS = ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS;
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;
}

teardown() {
super.teardown();
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = this._TEMPLATE_ONLY_GLIMMER_COMPONENTS;
}

async '@test routes'() {
this.addTemplate('index', 'Index');
this.addTemplate('foo', 'Foo {{outlet}}');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { moduleFor, ApplicationTestCase, strip, runTask } from 'internal-test-helpers';

import { ENV } from '@ember/-internals/environment';
import Service, { service } from '@ember/service';
import { Component, Helper } from '@ember/-internals/glimmer';
import { expect } from '@glimmer/util';
Expand All @@ -13,9 +12,6 @@ moduleFor(
class extends ApplicationTestCase {
constructor() {
super(...arguments);
this._TEMPLATE_ONLY_GLIMMER_COMPONENTS = ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS;

ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;

let didCreateReloader = (reloader) => {
this.reloader = reloader;
Expand Down Expand Up @@ -77,11 +73,6 @@ moduleFor(
);
}

teardown() {
super.teardown();
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = this._TEMPLATE_ONLY_GLIMMER_COMPONENTS;
}

hotReload(name, template) {
let reloader = expect(this.reloader);
let revision = (reloader.revisionFor(name) || 0) + 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { moduleFor, RenderingTestCase, strip, classes, runTask } from 'internal-test-helpers';
import { setModifierManager, modifierCapabilities } from '@glimmer/manager';
import { ENV } from '@ember/-internals/environment';
import EmberObject from '@ember/object';

import { set, setProperties } from '@ember/object';
Expand Down Expand Up @@ -1166,17 +1165,6 @@ moduleFor(
moduleFor(
'AngleBracket Invocation (splattributes)',
class extends RenderingTestCase {
constructor() {
super(...arguments);
this._TEMPLATE_ONLY_GLIMMER_COMPONENTS = ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS;
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;
}

teardown() {
super.teardown();
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = this._TEMPLATE_ONLY_GLIMMER_COMPONENTS;
}

registerComponent(name, template) {
super.registerComponent(name, { template, ComponentClass: null });
}
Expand Down
Loading

0 comments on commit aa91346

Please sign in to comment.