language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/glimmer/tests/integration/syntax/each-test.js
@@ -2,7 +2,6 @@ import { moduleFor, RenderingTestCase, applyMixins, strip, runTask } from 'inter import { get, set, notifyPropertyChange, computed, on } from '@ember/-internals/metal'; import { A as emberA, ArrayProxy, RSVP } from '@ember/-internals/runtime'; -import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils'; import { Component, htmlSafe } from '../../utils/helpers'; import { @@ -136,13 +135,11 @@ class ForEachable extends ArrayDelegate { let ArrayIterable; -if (HAS_NATIVE_SYMBOL) { - ArrayIterable = class extends ArrayDelegate { - [Symbol.iterator]() { - return this._array[Symbol.iterator](); - } - }; -} +ArrayIterable = class extends ArrayDelegate { + [Symbol.iterator]() { + return this._array[Symbol.iterator](); + } +}; class TogglingEachTest extends TogglingSyntaxConditionalsTest { get truthyValue() { @@ -162,6 +159,7 @@ const TRUTHY_CASES = [ new ForEachable(['hello']), ArrayProxy.create({ content: ['hello'] }), ArrayProxy.create({ content: emberA(['hello']) }), + new ArrayIterable(['hello']), ]; const FALSY_CASES = [ @@ -176,13 +174,9 @@ const FALSY_CASES = [ new ForEachable([]), ArrayProxy.create({ content: [] }), ArrayProxy.create({ content: emberA([]) }), + new ArrayIterable([]), ]; -if (HAS_NATIVE_SYMBOL) { - TRUTHY_CASES.push(new ArrayIterable(['hello'])); - FALSY_CASES.push(new ArrayIterable([])); -} - applyMixins( BasicEachTest, new TruthyGenerator(TRUTHY_CASES), @@ -1079,17 +1073,15 @@ moduleFor( } ); -if (HAS_NATIVE_SYMBOL) { - moduleFor( - 'Syntax test: {{#each}} with array-like objects implementing Symbol.iterator', - class extends EachTest { - createList(items) { - let iterable = new ArrayIterable(items); - return { list: iterable, delegate: iterable }; - } +moduleFor( + 'Syntax test: {{#each}} with array-like objects implementing Symbol.iterator', + class extends EachTest { + createList(items) { + let iterable = new ArrayIterable(items); + return { list: iterable, delegate: iterable }; } - ); -} + } +); moduleFor( 'Syntax test: {{#each}} with array proxies, modifying itself',
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/routing/lib/services/router.ts
@@ -10,7 +10,7 @@ import Route from '../system/route'; import EmberRouter, { QueryParam } from '../system/router'; import { extractRouteArgs, resemblesURL, shallowEqual } from '../utils'; -const ROUTER = symbol('ROUTER') as string; +const ROUTER = (symbol('ROUTER') as unknown) as string; function cleanURL(url: string, rootURL: string) { if (rootURL === '/') {
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/routing/lib/services/routing.ts
@@ -9,7 +9,7 @@ import Service from '@ember/service'; import EmberRouter, { QueryParam } from '../system/router'; import RouterState from '../system/router_state'; -const ROUTER = symbol('ROUTER') as string; +const ROUTER = (symbol('ROUTER') as unknown) as string; /** The Routing service is used by LinkComponent, and provides facilities for
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/routing/lib/system/route.ts
@@ -48,7 +48,7 @@ import generateController from './generate_controller'; import EmberRouter, { QueryParam } from './router'; export const ROUTE_CONNECTIONS = new WeakMap(); -const RENDER = symbol('render') as string; +const RENDER = (symbol('render') as unknown) as string; export function defaultSerialize( model: {},
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/runtime/lib/system/core_object.js
@@ -2,15 +2,14 @@ @module @ember/object */ -import { getFactoryFor, setFactoryFor, INIT_FACTORY } from '@ember/-internals/container'; +import { getFactoryFor, setFactoryFor } from '@ember/-internals/container'; import { getOwner, LEGACY_OWNER } from '@ember/-internals/owner'; import { guidFor, lookupDescriptor, inspect, makeArray, HAS_NATIVE_PROXY, - HAS_NATIVE_SYMBOL, isInternalSymbol, } from '@ember/-internals/utils'; import { meta } from '@ember/-internals/meta'; @@ -1192,44 +1191,6 @@ if (DEBUG) { }; } -if (!HAS_NATIVE_SYMBOL) { - // Allows OWNER and INIT_FACTORY to be non-enumerable in IE11 - let instanceOwner = new WeakMap(); - let instanceFactory = new WeakMap(); - - Object.defineProperty(CoreObject.prototype, OWNER, { - get() { - return instanceOwner.get(this); - }, - - set(value) { - instanceOwner.set(this, value); - }, - }); - - Object.defineProperty(CoreObject.prototype, INIT_FACTORY, { - get() { - return instanceFactory.get(this); - }, - - set(value) { - instanceFactory.set(this, value); - }, - }); - - Object.defineProperty(CoreObject, INIT_FACTORY, { - get() { - return instanceFactory.get(this); - }, - - set(value) { - instanceFactory.set(this, value); - }, - - enumerable: false, - }); -} - function implicitInjectionDeprecation(keyName, msg = null) { deprecate(msg, false, { id: 'implicit-injections',
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/utils/index.ts
@@ -28,7 +28,6 @@ export { default as makeArray } from './lib/make-array'; export { getName, setName } from './lib/name'; export { default as toString } from './lib/to-string'; export { isObject } from './lib/spec'; -export { HAS_NATIVE_SYMBOL } from './lib/symbol-utils'; export { HAS_NATIVE_PROXY } from './lib/proxy-utils'; export { isProxy, setProxy } from './lib/is_proxy'; export { default as Cache } from './lib/cache';
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/utils/lib/symbol-utils.ts
@@ -1,7 +0,0 @@ -export const HAS_NATIVE_SYMBOL = (function () { - if (typeof Symbol !== 'function') { - return false; - } - - return typeof Symbol() === 'symbol'; -})();
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/utils/lib/symbol.ts
@@ -1,7 +1,6 @@ import { DEBUG } from '@glimmer/env'; import { GUID_KEY } from './guid'; import intern from './intern'; -import { HAS_NATIVE_SYMBOL } from './symbol-utils'; const GENERATED_SYMBOLS: string[] = []; @@ -26,4 +25,4 @@ export function enumerableSymbol(debugName: string): string { return symbol; } -export const symbol = HAS_NATIVE_SYMBOL ? Symbol : enumerableSymbol; +export const symbol = Symbol;
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/utils/tests/guid_for_test.js
@@ -1,5 +1,5 @@ -import { guidFor, HAS_NATIVE_SYMBOL } from '..'; -import { moduleFor, AbstractTestCase as TestCase } from 'internal-test-helpers'; +import { guidFor } from '..'; +import { AbstractTestCase as TestCase, moduleFor } from 'internal-test-helpers'; function sameGuid(assert, a, b, message) { assert.equal(guidFor(a), guidFor(b), message); @@ -49,11 +49,6 @@ moduleFor( } ['@test symbols'](assert) { - if (HAS_NATIVE_SYMBOL) { - assert.ok(true, 'symbols are not supported on this browser'); - return; - } - let a = Symbol('a'); let b = Symbol('b');
true
Other
emberjs
ember.js
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
Remove HAS_NATIVE_SYMBOL flag After dropping IE11 support, all supported browsers support symbols natively.
packages/@ember/-internals/utils/tests/inspect_test.js
@@ -1,5 +1,5 @@ -import { HAS_NATIVE_SYMBOL, inspect } from '..'; -import { moduleFor, AbstractTestCase as TestCase } from 'internal-test-helpers'; +import { inspect } from '..'; +import { AbstractTestCase as TestCase, moduleFor } from 'internal-test-helpers'; moduleFor( 'Ember.inspect', @@ -130,12 +130,8 @@ How are you?`]: 1, } ['@test inspect outputs the toString() representation of Symbols'](assert) { - if (HAS_NATIVE_SYMBOL) { - let symbol = Symbol('test'); - assert.equal(inspect(symbol), 'Symbol(test)'); - } else { - assert.expect(0); - } + let symbol = Symbol('test'); + assert.equal(inspect(symbol), 'Symbol(test)'); } } );
true
Other
emberjs
ember.js
840e681eb50b219fd686859d7e39bb987a65ac94.json
Remove IE11 Object polyfills
packages/@ember/-internals/glimmer/lib/components/abstract-input.ts
@@ -15,8 +15,6 @@ import InternalComponent, { handleDeprecatedEventArguments, InternalComponentConstructor, jQueryEventShim, - ObjectEntries, - ObjectValues, } from './internal'; const UNINITIALIZED: unknown = Object.freeze({}); @@ -304,7 +302,7 @@ export function handleDeprecatedFeatures( handleDeprecatedAttributeArguments(target, attributeBindings); - handleDeprecatedEventArguments(target, ObjectEntries(virtualEvents)); + handleDeprecatedEventArguments(target, Object.entries(virtualEvents)); { let superIsVirtualEventListener = prototype['isVirtualEventListener']; @@ -318,7 +316,7 @@ export function handleDeprecatedFeatures( listener: Function ): listener is VirtualEventListener { return ( - ObjectValues(virtualEvents).indexOf(name) !== -1 || + Object.values(virtualEvents).indexOf(name) !== -1 || superIsVirtualEventListener.call(this, name, listener) ); },
true
Other
emberjs
ember.js
840e681eb50b219fd686859d7e39bb987a65ac94.json
Remove IE11 Object polyfills
packages/@ember/-internals/glimmer/lib/components/internal.ts
@@ -28,24 +28,6 @@ import InternalModifier, { InternalModifierManager } from '../modifiers/internal function NOOP(): void {} -// TODO: remove me when IE11 support is EOL -export let ObjectEntries = ((): typeof Object['entries'] => { - if (typeof Object.entries === 'function') { - return Object.entries; - } else { - return (obj: {}) => Object.keys(obj).map((key) => [key, obj[key]] as [string, unknown]); - } -})(); - -// TODO: remove me when IE11 support is EOL -export let ObjectValues = ((): typeof Object['values'] => { - if (typeof Object.values === 'function') { - return Object.values; - } else { - return (obj: {}) => Object.keys(obj).map((key) => obj[key]); - } -})(); - export type EventListener = (event: Event) => void; export default class InternalComponent { @@ -444,7 +426,7 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) { name: string ): boolean { let events = [ - ...ObjectValues(getEventsMap(this.owner)), + ...Object.values(getEventsMap(this.owner)), 'focus-in', 'focus-out', 'key-press', @@ -470,7 +452,7 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) { let { element, component, listenerFor, listeners } = this; let entries: [event: string, argument: string][] = [ - ...ObjectEntries(getEventsMap(this.owner)), + ...Object.entries(getEventsMap(this.owner)), ...extraEvents, ]; @@ -489,7 +471,7 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) { remove(): void { let { element, listeners } = this; - for (let [event, listener] of ObjectEntries(listeners)) { + for (let [event, listener] of Object.entries(listeners)) { element.removeEventListener(event, listener); }
true
Other
emberjs
ember.js
273619f59945e691a3f06462e6e8bd43d4f24729.json
Use WeakSet for lazy events
packages/@ember/-internals/glimmer/lib/component.ts
@@ -29,9 +29,7 @@ import { } from './component-managers/curly'; // Keep track of which component classes have already been processed for lazy event setup. -// Using a WeakSet would be more appropriate here, but this can only be used when IE11 support is dropped. -// Thus the workaround using a WeakMap<object, true> -let lazyEventsProcessed = new WeakMap<EventDispatcher, WeakMap<object, true>>(); +let lazyEventsProcessed = new WeakMap<EventDispatcher, WeakSet<object>>(); /** @module @ember/component @@ -671,7 +669,7 @@ const Component = CoreView.extend( if (eventDispatcher) { let lazyEventsProcessedForComponentClass = lazyEventsProcessed.get(eventDispatcher); if (!lazyEventsProcessedForComponentClass) { - lazyEventsProcessedForComponentClass = new WeakMap<object, true>(); + lazyEventsProcessedForComponentClass = new WeakSet<object>(); lazyEventsProcessed.set(eventDispatcher, lazyEventsProcessedForComponentClass); } @@ -685,7 +683,7 @@ const Component = CoreView.extend( } }); - lazyEventsProcessedForComponentClass.set(proto, true); + lazyEventsProcessedForComponentClass.add(proto); } }
false
Other
emberjs
ember.js
ca3d81c42d9596da48295a70c192cf32f02c3dda.json
Remove IE11 check in index.html
tests/index.html
@@ -67,13 +67,7 @@ EmberENV.ENABLE_OPTIONAL_FEATURES = true; } - var isIE = Boolean(window.MSInputMethodContext) && Boolean(document.documentMode); - - // ignore deprecations for IE11 specifically (due to browser support - // policy deprecation, which happens before we can `expectDeprecation`) - if (!isIE) { - EmberENV['RAISE_ON_DEPRECATION'] = true; - } + EmberENV['RAISE_ON_DEPRECATION'] = true; if (QUnit.urlParams.debugrendertree) { EmberENV['_DEBUG_RENDER_TREE'] = true;
false
Other
emberjs
ember.js
d3f916ac9e3b9ad54c4c7e90e97ca8c76ff7fa38.json
Remove Ember.$() jQuery integration
packages/ember/index.js
@@ -99,7 +99,7 @@ import ApplicationInstance from '@ember/application/instance'; import Engine from '@ember/engine'; import EngineInstance from '@ember/engine/instance'; import { assign } from '@ember/polyfills'; -import { EMBER_EXTEND_PROTOTYPES, JQUERY_INTEGRATION } from '@ember/deprecated-features'; +import { EMBER_EXTEND_PROTOTYPES } from '@ember/deprecated-features'; import { templateOnlyComponent, @@ -609,32 +609,6 @@ Object.defineProperty(Ember, 'TEMPLATES', { */ Ember.VERSION = VERSION; -// ****@ember/-internals/views**** -if (JQUERY_INTEGRATION && !views.jQueryDisabled) { - Object.defineProperty(Ember, '$', { - get() { - deprecate( - "Using Ember.$() has been deprecated, use `import jQuery from 'jquery';` instead", - false, - { - id: 'ember-views.curly-components.jquery-element', - until: '4.0.0', - url: 'https://deprecations.emberjs.com/v3.x#toc_jquery-apis', - for: 'ember-source', - since: { - enabled: '3.9.0', - }, - } - ); - - return views.jQuery; - }, - - configurable: true, - enumerable: true, - }); -} - Ember.ViewUtils = { isSimpleClick: views.isSimpleClick, getElementView: views.getElementView, @@ -772,12 +746,3 @@ export default Ember; @public @static */ - -/** - Alias for jQuery - - @for jquery - @method $ - @static - @public -*/
true
Other
emberjs
ember.js
d3f916ac9e3b9ad54c4c7e90e97ca8c76ff7fa38.json
Remove Ember.$() jQuery integration
packages/ember/tests/reexports_test.js
@@ -1,9 +1,7 @@ import Ember from '../index'; import require from 'require'; -import { FEATURES, EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features'; -import { confirmExport } from 'internal-test-helpers'; -import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; -import { jQueryDisabled, jQuery } from '@ember/-internals/views'; +import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS, FEATURES } from '@ember/canary-features'; +import { AbstractTestCase, confirmExport, moduleFor } from 'internal-test-helpers'; import Resolver from '@ember/application/globals-resolver'; import { DEBUG } from '@glimmer/env'; import { ENV } from '@ember/-internals/environment'; @@ -136,26 +134,6 @@ moduleFor( } ); -if (!jQueryDisabled) { - moduleFor( - 'ember reexports: jQuery enabled', - class extends AbstractTestCase { - [`@test Ember.$ is exported`](assert) { - expectDeprecation(() => { - let body = Ember.$('body').get(0); - assert.equal(body, document.body, 'Ember.$ exports working jQuery instance'); - }, "Using Ember.$() has been deprecated, use `import jQuery from 'jquery';` instead"); - } - - '@test Ember.$ _**is**_ window.jQuery'(assert) { - expectDeprecation(() => { - assert.strictEqual(Ember.$, jQuery); - }, "Using Ember.$() has been deprecated, use `import jQuery from 'jquery';` instead"); - } - } - ); -} - let allExports = [ // @ember/application ['Application', '@ember/application', 'default'],
true
Other
emberjs
ember.js
26145d2899658102cf9681a4341edcaffe814311.json
Remove this.$() jQuery integration
packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js
@@ -14,7 +14,6 @@ import { DEBUG } from '@glimmer/env'; import { alias, set, get, observer, on, computed, tracked } from '@ember/-internals/metal'; import Service, { inject as injectService } from '@ember/service'; import { Object as EmberObject, A as emberA } from '@ember/-internals/runtime'; -import { jQueryDisabled } from '@ember/-internals/views'; import { Component, compile, htmlSafe } from '../../utils/helpers'; import { backtrackingMessageFor } from '../../utils/debug-stack'; @@ -3882,108 +3881,3 @@ moduleFor( } } ); - -if (jQueryDisabled) { - moduleFor( - 'Components test: curly components: jQuery disabled', - class extends RenderingTestCase { - ['@test jQuery proxy is not available without jQuery']() { - let instance; - - let FooBarComponent = Component.extend({ - init() { - this._super(); - instance = this; - }, - }); - - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template: 'hello', - }); - - this.render('{{foo-bar}}'); - - expectAssertion(() => { - instance.$()[0]; - }, 'You cannot access this.$() with `jQuery` disabled.'); - } - } - ); -} else { - moduleFor( - 'Components test: curly components: jQuery enabled', - class extends RenderingTestCase { - ['@test it has a jQuery proxy to the element']() { - let instance; - let element1; - let element2; - - let FooBarComponent = Component.extend({ - init() { - this._super(); - instance = this; - }, - }); - - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template: 'hello', - }); - - this.render('{{foo-bar}}'); - - expectDeprecation(() => { - element1 = instance.$()[0]; - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - this.assertComponentElement(element1, { content: 'hello' }); - - runTask(() => this.rerender()); - - expectDeprecation(() => { - element2 = instance.$()[0]; - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - this.assertComponentElement(element2, { content: 'hello' }); - - this.assertSameNode(element2, element1); - } - - ['@test it scopes the jQuery proxy to the component element'](assert) { - let instance; - let $span; - - let FooBarComponent = Component.extend({ - init() { - this._super(); - instance = this; - }, - }); - - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template: '<span class="inner">inner</span>', - }); - - this.render('<span class="outer">outer</span>{{foo-bar}}'); - - expectDeprecation(() => { - $span = instance.$('span'); - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - assert.equal($span.length, 1); - assert.equal($span.attr('class'), 'inner'); - - runTask(() => this.rerender()); - - expectDeprecation(() => { - $span = instance.$('span'); - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - assert.equal($span.length, 1); - assert.equal($span.attr('class'), 'inner'); - } - } - ); -}
true
Other
emberjs
ember.js
26145d2899658102cf9681a4341edcaffe814311.json
Remove this.$() jQuery integration
packages/@ember/-internals/glimmer/tests/integration/components/dynamic-components-test.js
@@ -2,7 +2,6 @@ import { DEBUG } from '@glimmer/env'; import { moduleFor, RenderingTestCase, strip, runTask } from 'internal-test-helpers'; import { set, computed } from '@ember/-internals/metal'; -import { jQueryDisabled } from '@ember/-internals/views'; import { Component } from '../../utils/helpers'; import { backtrackingMessageFor } from '../../utils/debug-stack'; @@ -806,108 +805,3 @@ moduleFor( } } ); - -if (jQueryDisabled) { - moduleFor( - 'Components test: dynamic components: jQuery disabled', - class extends RenderingTestCase { - ['@test jQuery proxy is not available without jQuery']() { - let instance; - - let FooBarComponent = Component.extend({ - init() { - this._super(); - instance = this; - }, - }); - - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template: 'hello', - }); - - this.render('{{component "foo-bar"}}'); - - expectAssertion(() => { - instance.$()[0]; - }, 'You cannot access this.$() with `jQuery` disabled.'); - } - } - ); -} else { - moduleFor( - 'Components test: dynamic components : jQuery enabled', - class extends RenderingTestCase { - ['@test it has a jQuery proxy to the element']() { - let instance; - let element1; - let element2; - - let FooBarComponent = Component.extend({ - init() { - this._super(); - instance = this; - }, - }); - - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template: 'hello', - }); - - this.render('{{component "foo-bar"}}'); - - expectDeprecation(() => { - element1 = instance.$()[0]; - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - this.assertComponentElement(element1, { content: 'hello' }); - - runTask(() => this.rerender()); - - expectDeprecation(() => { - element2 = instance.$()[0]; - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - this.assertComponentElement(element2, { content: 'hello' }); - - this.assertSameNode(element2, element1); - } - - ['@test it scopes the jQuery proxy to the component element'](assert) { - let instance; - let $span; - - let FooBarComponent = Component.extend({ - init() { - this._super(); - instance = this; - }, - }); - - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template: '<span class="inner">inner</span>', - }); - - this.render('<span class="outer">outer</span>{{component "foo-bar"}}'); - - expectDeprecation(() => { - $span = instance.$('span'); - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - assert.equal($span.length, 1); - assert.equal($span.attr('class'), 'inner'); - - runTask(() => this.rerender()); - - expectDeprecation(() => { - $span = instance.$('span'); - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - - assert.equal($span.length, 1); - assert.equal($span.attr('class'), 'inner'); - } - } - ); -}
true
Other
emberjs
ember.js
26145d2899658102cf9681a4341edcaffe814311.json
Remove this.$() jQuery integration
packages/@ember/-internals/glimmer/tests/integration/components/fragment-components-test.js
@@ -227,26 +227,6 @@ moduleFor( this.assertText('baz'); } - ['@test throws an error if when $() is accessed on component where `tagName` is an empty string']() { - let template = `hit dem folks`; - let FooBarComponent = Component.extend({ - tagName: '', - init() { - this._super(); - this.$(); - }, - }); - - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template, - }); - - expectAssertion(() => { - this.render(`{{#foo-bar}}{{/foo-bar}}`); - }, /You cannot access this.\$\(\) on a component with `tagName: ''` specified/); - } - ['@test renders a contained view with omitted start tag and tagless parent view context']() { this.registerComponent('root-component', { ComponentClass: Component.extend({
true
Other
emberjs
ember.js
26145d2899658102cf9681a4341edcaffe814311.json
Remove this.$() jQuery integration
packages/@ember/-internals/glimmer/tests/integration/components/life-cycle-test.js
@@ -1,16 +1,9 @@ -import { - moduleFor, - RenderingTestCase, - classes, - strip, - runAppend, - runTask, -} from 'internal-test-helpers'; +import { classes, moduleFor, RenderingTestCase, runTask, strip } from 'internal-test-helpers'; import { schedule } from '@ember/runloop'; import { set, setProperties } from '@ember/-internals/metal'; import { A as emberA } from '@ember/-internals/runtime'; -import { getViewId, getViewElement, jQueryDisabled } from '@ember/-internals/views'; +import { getViewElement, getViewId } from '@ember/-internals/views'; import { Component } from '../../utils/helpers'; @@ -1604,54 +1597,6 @@ moduleFor( } ); -if (!jQueryDisabled) { - moduleFor( - 'Run loop and lifecycle hooks - jQuery only', - class extends RenderingTestCase { - ['@test lifecycle hooks have proper access to this.$()'](assert) { - assert.expect(7); - let component; - let FooBarComponent = Component.extend({ - tagName: 'div', - init() { - assert.notOk(this.$(), 'no access to element via this.$() on init() enter'); - this._super(...arguments); - assert.notOk(this.$(), 'no access to element via this.$() after init() finished'); - }, - willInsertElement() { - component = this; - assert.ok(this.$(), 'willInsertElement has access to element via this.$()'); - }, - didInsertElement() { - assert.ok(this.$(), 'didInsertElement has access to element via this.$()'); - }, - willDestroyElement() { - assert.ok(this.$(), 'willDestroyElement has access to element via this.$()'); - }, - didDestroyElement() { - assert.notOk( - this.$(), - 'didDestroyElement does not have access to element via this.$()' - ); - }, - }); - this.registerComponent('foo-bar', { - ComponentClass: FooBarComponent, - template: 'hello', - }); - let { owner } = this; - - expectDeprecation(() => { - let comp = owner.lookup('component:foo-bar'); - runAppend(comp); - runTask(() => component.destroy?.()); - }, 'Using this.$() in a component has been deprecated, consider using this.element'); - runTask(() => component.destroy?.()); - } - } - ); -} - function assertDestroyHooks(assert, _actual, _expected) { _expected.forEach((expected, i) => { let name = expected.name;
true
Other
emberjs
ember.js
26145d2899658102cf9681a4341edcaffe814311.json
Remove this.$() jQuery integration
packages/@ember/-internals/views/lib/mixins/view_support.js
@@ -3,9 +3,6 @@ import { descriptorForProperty, Mixin, nativeDescDecorator } from '@ember/-inter import { assert } from '@ember/debug'; import { hasDOM } from '@ember/-internals/browser-environment'; import { matches } from '../system/utils'; -import { jQuery, jQueryDisabled } from '../system/jquery'; -import { deprecate } from '@ember/debug'; -import { JQUERY_INTEGRATION } from '@ember/deprecated-features'; function K() { return this; @@ -422,46 +419,6 @@ let mixin = { }, }; -if (JQUERY_INTEGRATION) { - /** - Returns a jQuery object for this view's element. If you pass in a selector - string, this method will return a jQuery object, using the current element - as its buffer. - - For example, calling `view.$('li')` will return a jQuery object containing - all of the `li` elements inside the DOM element of this view. - - @method $ - @param {String} [selector] a jQuery-compatible selector string - @return {jQuery} the jQuery object for the DOM node - @public - @deprecated - */ - mixin.$ = function $(sel) { - assert( - "You cannot access this.$() on a component with `tagName: ''` specified.", - this.tagName !== '' - ); - assert('You cannot access this.$() with `jQuery` disabled.', !jQueryDisabled); - deprecate( - 'Using this.$() in a component has been deprecated, consider using this.element', - false, - { - id: 'ember-views.curly-components.jquery-element', - until: '4.0.0', - url: 'https://deprecations.emberjs.com/v3.x#toc_jquery-apis', - for: 'ember-source', - since: { - enabled: '3.9.0', - }, - } - ); - if (this.element) { - return sel ? jQuery(sel, this.element) : jQuery(this.element); - } - }; -} - /** @class ViewMixin @namespace Ember
true
Other
emberjs
ember.js
55618960d68394dcec06ed29e2873082d6a5b1ea.json
Remove hasBlock and hasBlockParams In favor of (has-block) and (has-block-params)
packages/@ember/-internals/glimmer/index.ts
@@ -150,7 +150,7 @@ */ /** - `{{has-block}}` indicates if the component was invoked with a block. + `{{(has-block)}}` indicates if the component was invoked with a block. This component is invoked with a block: @@ -187,15 +187,15 @@ {{/if}} ``` - @method hasBlock + @method has-block @for Ember.Templates.helpers @param {String} the name of the block. The name (at the moment) is either "main" or "inverse" (though only curly components support inverse) @return {Boolean} `true` if the component was invoked with a block @public */ /** - `{{has-block-params}}` indicates if the component was invoked with block params. + `{{(has-block-params)}}` indicates if the component was invoked with block params. This component is invoked with block params: @@ -242,7 +242,7 @@ {{/if}} ``` - @method hasBlockParams + @method has-block-params @for Ember.Templates.helpers @param {String} the name of the block. The name (at the moment) is either "main" or "inverse" (though only curly components support inverse) @return {Boolean} `true` if the component was invoked with block params
true
Other
emberjs
ember.js
55618960d68394dcec06ed29e2873082d6a5b1ea.json
Remove hasBlock and hasBlockParams In favor of (has-block) and (has-block-params)
packages/@ember/-internals/glimmer/tests/integration/components/contextual-components-test.js
@@ -1357,13 +1357,10 @@ moduleFor( this.assertStableRerender(); } - ['@test GH#18732 hasBlock works within a yielded curried component invoked within mustaches']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/component-with-has-block.hbs' @ L1:C5) ` - ); + ['@test GH#18732 (has-block) works within a yielded curried component invoked within mustaches']() { this.registerComponent('component-with-has-block', { ComponentClass: Component.extend(), - template: '<div>{{hasBlock}}</div>', + template: '<div>{{(has-block)}}</div>', }); this.registerComponent('yielding-component', { @@ -1382,14 +1379,10 @@ moduleFor( this.assertText('false'); } - ['@test GH#18732 has-block works within a yielded curried component invoked with angle bracket invocation (falsy)']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/component-with-has-block.hbs' @ L1:C5) ` - ); - + ['@test GH#18732 (has-block) works within a yielded curried component invoked with angle bracket invocation (falsy)']() { this.registerComponent('component-with-has-block', { ComponentClass: Component.extend(), - template: '<div>{{hasBlock}}</div>', + template: '<div>{{(has-block)}}</div>', }); this.registerComponent('yielding-component', { @@ -1408,14 +1401,10 @@ moduleFor( this.assertText('false'); } - ['@test GH#18732 has-block works within a yielded curried component invoked with angle bracket invocation (truthy)']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/component-with-has-block.hbs' @ L1:C5) ` - ); - + ['@test GH#18732 (has-block) works within a yielded curried component invoked with angle bracket invocation (truthy)']() { this.registerComponent('component-with-has-block', { ComponentClass: Component.extend(), - template: '<div>{{hasBlock}}</div>', + template: '<div>{{(has-block)}}</div>', }); this.registerComponent('yielding-component', {
true
Other
emberjs
ember.js
55618960d68394dcec06ed29e2873082d6a5b1ea.json
Remove hasBlock and hasBlockParams In favor of (has-block) and (has-block-params)
packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js
@@ -1950,14 +1950,10 @@ moduleFor( ); } - ['@test hasBlock is true when block supplied']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/with-block.hbs' @ L1:C6) ` - ); - + ['@test (has-block) is true when block supplied']() { this.registerComponent('with-block', { template: strip` - {{#if hasBlock}} + {{#if (has-block)}} {{yield}} {{else}} No Block! @@ -1976,14 +1972,10 @@ moduleFor( this.assertText('In template'); } - ['@test hasBlock is false when no block supplied']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/with-block.hbs' @ L1:C6) ` - ); - + ['@test (has-block) is false when no block supplied']() { this.registerComponent('with-block', { template: strip` - {{#if hasBlock}} + {{#if (has-block)}} {{yield}} {{else}} No Block! @@ -1999,14 +1991,10 @@ moduleFor( this.assertText('No Block!'); } - ['@test hasBlockParams is true when block param supplied']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/with-block.hbs' @ L1:C6) ` - ); - + ['@test (has-block-params) is true when block param supplied']() { this.registerComponent('with-block', { template: strip` - {{#if hasBlockParams}} + {{#if (has-block-params)}} {{yield this}} - In Component {{else}} {{yield}} No Block! @@ -2025,14 +2013,10 @@ moduleFor( this.assertText('In template - In Component'); } - ['@test hasBlockParams is false when no block param supplied']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/with-block.hbs' @ L1:C6) ` - ); - + ['@test (has-block-params) is false when no block param supplied']() { this.registerComponent('with-block', { template: strip` - {{#if hasBlockParams}} + {{#if (has-block-params)}} {{yield this}} {{else}} {{yield}} No Block Param! @@ -2156,14 +2140,10 @@ moduleFor( this.assertText('Yes:Hello42'); } - ['@test expression hasBlock inverse']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-inverse.hbs' @ L1:C6) ` - ); - + ['@test expression (has-block) inverse']() { this.registerComponent('check-inverse', { template: strip` - {{#if (hasBlock "inverse")}} + {{#if (has-block "inverse")}} Yes {{else}} No @@ -2180,14 +2160,10 @@ moduleFor( this.assertStableRerender(); } - ['@test expression hasBlock default']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-block.hbs' @ L1:C6) ` - ); - + ['@test expression (has-block) default']() { this.registerComponent('check-block', { template: strip` - {{#if (hasBlock)}} + {{#if (has-block)}} Yes {{else}} No @@ -2204,14 +2180,10 @@ moduleFor( this.assertStableRerender(); } - ['@test expression hasBlockParams inverse']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-inverse.hbs' @ L1:C6) ` - ); - + ['@test expression (has-block-params) inverse']() { this.registerComponent('check-inverse', { template: strip` - {{#if (hasBlockParams "inverse")}} + {{#if (has-block-params "inverse")}} Yes {{else}} No @@ -2228,14 +2200,10 @@ moduleFor( this.assertStableRerender(); } - ['@test expression hasBlockParams default']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-block.hbs' @ L1:C6) ` - ); - + ['@test expression (has-block-params) default']() { this.registerComponent('check-block', { template: strip` - {{#if (hasBlockParams)}} + {{#if (has-block-params)}} Yes {{else}} No @@ -2252,85 +2220,9 @@ moduleFor( this.assertStableRerender(); } - ['@test non-expression hasBlock']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-block.hbs' @ L1:C6) ` - ); - - this.registerComponent('check-block', { - template: strip` - {{#if hasBlock}} - Yes - {{else}} - No - {{/if}}`, - }); - - this.render(strip` - {{check-block}} - {{#check-block}}{{/check-block}}`); - - this.assertComponentElement(this.firstChild, { content: 'No' }); - this.assertComponentElement(this.nthChild(1), { content: 'Yes' }); - - this.assertStableRerender(); - } - - ['@test expression hasBlockParams']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-params.hbs' @ L1:C6) ` - ); - - this.registerComponent('check-params', { - template: strip` - {{#if (hasBlockParams)}} - Yes - {{else}} - No - {{/if}}`, - }); - - this.render(strip` - {{#check-params}}{{/check-params}} - {{#check-params as |foo|}}{{/check-params}}`); - - this.assertComponentElement(this.firstChild, { content: 'No' }); - this.assertComponentElement(this.nthChild(1), { content: 'Yes' }); - - this.assertStableRerender(); - } - - ['@test non-expression hasBlockParams']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-params.hbs' @ L1:C6) ` - ); - - this.registerComponent('check-params', { - template: strip` - {{#if hasBlockParams}} - Yes - {{else}} - No - {{/if}}`, - }); - - this.render(strip` - {{#check-params}}{{/check-params}} - {{#check-params as |foo|}}{{/check-params}}`); - - this.assertComponentElement(this.firstChild, { content: 'No' }); - this.assertComponentElement(this.nthChild(1), { content: 'Yes' }); - - this.assertStableRerender(); - } - - ['@test hasBlock expression in an attribute'](assert) { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-attr.hbs' @ L1:C13) ` - ); - + ['@test (has-block) expression in an attribute'](assert) { this.registerComponent('check-attr', { - template: '<button name={{hasBlock}}></button>', + template: '<button name={{(has-block)}}></button>', }); this.render(strip` @@ -2343,15 +2235,11 @@ moduleFor( this.assertStableRerender(); } - ['@test hasBlock inverse expression in an attribute'](assert) { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-attr.hbs' @ L1:C13) ` - ); - + ['@test (has-block) inverse expression in an attribute'](assert) { this.registerComponent( 'check-attr', { - template: '<button name={{hasBlock "inverse"}}></button>', + template: '<button name={{(has-block "inverse")}}></button>', }, '' ); @@ -2366,13 +2254,9 @@ moduleFor( this.assertStableRerender(); } - ['@test hasBlockParams expression in an attribute'](assert) { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-attr.hbs' @ L1:C13) ` - ); - + ['@test (has-block-params) expression in an attribute'](assert) { this.registerComponent('check-attr', { - template: '<button name={{hasBlockParams}}></button>', + template: '<button name={{(has-block-params)}}></button>', }); this.render(strip` @@ -2385,15 +2269,11 @@ moduleFor( this.assertStableRerender(); } - ['@test hasBlockParams inverse expression in an attribute'](assert) { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-attr.hbs' @ L1:C13) ` - ); - + ['@test (has-block-params) inverse expression in an attribute'](assert) { this.registerComponent( 'check-attr', { - template: '<button name={{hasBlockParams "inverse"}}></button>', + template: '<button name={{(has-block-params "inverse")}}></button>', }, '' ); @@ -2408,32 +2288,9 @@ moduleFor( this.assertStableRerender(); } - ['@test hasBlock as a param to a helper']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-helper.hbs' @ L1:C5) ` - ); - - this.registerComponent('check-helper', { - template: '{{if hasBlock "true" "false"}}', - }); - - this.render(strip` - {{check-helper}} - {{#check-helper}}{{/check-helper}}`); - - this.assertComponentElement(this.firstChild, { content: 'false' }); - this.assertComponentElement(this.nthChild(1), { content: 'true' }); - - this.assertStableRerender(); - } - - ['@test hasBlock as an expression param to a helper']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-helper.hbs' @ L1:C5) ` - ); - + ['@test (has-block) as a param to a helper']() { this.registerComponent('check-helper', { - template: '{{if (hasBlock) "true" "false"}}', + template: '{{if (has-block) "true" "false"}}', }); this.render(strip` @@ -2446,13 +2303,9 @@ moduleFor( this.assertStableRerender(); } - ['@test hasBlock inverse as a param to a helper']() { - expectDeprecation( - `\`hasBlock\` is deprecated. Use \`has-block\` instead. ('my-app/templates/components/check-helper.hbs' @ L1:C5) ` - ); - + ['@test (has-block) inverse as a param to a helper']() { this.registerComponent('check-helper', { - template: '{{if (hasBlock "inverse") "true" "false"}}', + template: '{{if (has-block "inverse") "true" "false"}}', }); this.render(strip` @@ -2465,32 +2318,9 @@ moduleFor( this.assertStableRerender(); } - ['@test hasBlockParams as a param to a helper']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-helper.hbs' @ L1:C5) ` - ); - - this.registerComponent('check-helper', { - template: '{{if hasBlockParams "true" "false"}}', - }); - - this.render(strip` - {{#check-helper}}{{/check-helper}} - {{#check-helper as |something|}}{{/check-helper}}`); - - this.assertComponentElement(this.firstChild, { content: 'false' }); - this.assertComponentElement(this.nthChild(1), { content: 'true' }); - - this.assertStableRerender(); - } - - ['@test hasBlockParams as an expression param to a helper']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-helper.hbs' @ L1:C5) ` - ); - + ['@test (has-block-params) as a param to a helper']() { this.registerComponent('check-helper', { - template: '{{if (hasBlockParams) "true" "false"}}', + template: '{{if (has-block-params) "true" "false"}}', }); this.render(strip` @@ -2503,13 +2333,9 @@ moduleFor( this.assertStableRerender(); } - ['@test hasBlockParams inverse as a param to a helper']() { - expectDeprecation( - `\`hasBlockParams\` is deprecated. Use \`has-block-params\` instead. ('my-app/templates/components/check-helper.hbs' @ L1:C5) ` - ); - + ['@test (has-block-params) inverse as a param to a helper']() { this.registerComponent('check-helper', { - template: '{{if (hasBlockParams "inverse") "true" "false"}}', + template: '{{if (has-block-params "inverse") "true" "false"}}', }); this.render(strip`
true
Other
emberjs
ember.js
55618960d68394dcec06ed29e2873082d6a5b1ea.json
Remove hasBlock and hasBlockParams In favor of (has-block) and (has-block-params)
packages/ember-template-compiler/lib/plugins/index.ts
@@ -8,7 +8,6 @@ import TransformActionSyntax from './transform-action-syntax'; import TransformAttrsIntoArgs from './transform-attrs-into-args'; import TransformEachInIntoEach from './transform-each-in-into-each'; import TransformEachTrackArray from './transform-each-track-array'; -import TransformHasBlockSyntax from './transform-has-block-syntax'; import TransformInElement from './transform-in-element'; import TransformLinkTo from './transform-link-to'; import TransformOldClassBindingSyntax from './transform-old-class-binding-syntax'; @@ -28,7 +27,6 @@ export const RESOLUTION_MODE_TRANSFORMS = Object.freeze( TransformActionSyntax, TransformAttrsIntoArgs, TransformEachInIntoEach, - TransformHasBlockSyntax, TransformLinkTo, AssertInputHelperWithoutBlock, TransformInElement,
true
Other
emberjs
ember.js
55618960d68394dcec06ed29e2873082d6a5b1ea.json
Remove hasBlock and hasBlockParams In favor of (has-block) and (has-block-params)
packages/ember-template-compiler/lib/plugins/transform-has-block-syntax.ts
@@ -1,84 +0,0 @@ -import { deprecate } from '@ember/debug'; -import { AST, ASTPlugin } from '@glimmer/syntax'; -import calculateLocationDisplay from '../system/calculate-location-display'; -import { EmberASTPluginEnvironment } from '../types'; -import { isPath } from './utils'; - -/** - @module ember -*/ - -/** - A Glimmer2 AST transformation that replaces all instances of - - ```handlebars - {{hasBlock}} - ``` - - with - - ```handlebars - {{has-block}} - ``` - - @private - @class TransformHasBlockSyntax -*/ - -const TRANSFORMATIONS: { [key: string]: string } = { - hasBlock: 'has-block', - hasBlockParams: 'has-block-params', -}; - -export default function transformHasBlockSyntax(env: EmberASTPluginEnvironment): ASTPlugin { - let { builders: b } = env.syntax; - let moduleName = env.meta?.moduleName; - - function emitDeprecationMessage(node: AST.Node, name: string) { - let sourceInformation = calculateLocationDisplay(moduleName, node.loc); - deprecate( - `\`${name}\` is deprecated. Use \`${TRANSFORMATIONS[name]}\` instead. ${sourceInformation}`, - false, - { - id: 'has-block-and-has-block-params', - until: '4.0.0', - url: 'https://deprecations.emberjs.com/v3.x#toc_has-block-and-has-block-params', - for: 'ember-source', - since: { - enabled: '3.25.0', - }, - } - ); - } - - return { - name: 'transform-has-block-syntax', - - visitor: { - PathExpression(node: AST.PathExpression): AST.Node | void { - if (TRANSFORMATIONS[node.original]) { - emitDeprecationMessage(node, node.original); - return b.sexpr(b.path(TRANSFORMATIONS[node.original])); - } - }, - MustacheStatement(node: AST.MustacheStatement): AST.Node | void { - if (isPath(node.path) && TRANSFORMATIONS[node.path.original]) { - emitDeprecationMessage(node, node.path.original); - return b.mustache( - b.path(TRANSFORMATIONS[node.path.original]), - node.params, - node.hash, - undefined, - node.loc - ); - } - }, - SubExpression(node: AST.SubExpression): AST.Node | void { - if (isPath(node.path) && TRANSFORMATIONS[node.path.original]) { - emitDeprecationMessage(node, node.path.original); - return b.sexpr(b.path(TRANSFORMATIONS[node.path.original]), node.params, node.hash); - } - }, - }, - }; -}
true
Other
emberjs
ember.js
55618960d68394dcec06ed29e2873082d6a5b1ea.json
Remove hasBlock and hasBlockParams In favor of (has-block) and (has-block-params)
tests/docs/expected.js
@@ -271,8 +271,8 @@ module.exports = { 'handleURL', 'has', 'hasArrayObservers', - 'hasBlock', - 'hasBlockParams', + 'has-block', + 'has-block-params', 'hash', 'hashSettled', 'hasListeners',
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/@ember/-internals/runtime/index.js
@@ -1,7 +1,6 @@ export { default as Object, FrameworkObject } from './lib/system/object'; export { default as RegistryProxyMixin } from './lib/mixins/registry_proxy'; export { default as ContainerProxyMixin } from './lib/mixins/container_proxy'; -export { default as copy } from './lib/copy'; export { default as compare } from './lib/compare'; export { default as isEqual } from './lib/is-equal'; export { @@ -19,7 +18,6 @@ export { default as ArrayProxy } from './lib/system/array_proxy'; export { default as ObjectProxy } from './lib/system/object_proxy'; export { default as CoreObject } from './lib/system/core_object'; export { default as ActionHandler } from './lib/mixins/action_handler'; -export { default as Copyable } from './lib/mixins/copyable'; export { default as Enumerable } from './lib/mixins/enumerable'; export { default as _ProxyMixin, contentFor as _contentFor } from './lib/mixins/-proxy'; export { default as Observable } from './lib/mixins/observable';
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/@ember/-internals/runtime/lib/copy.js
@@ -1,120 +0,0 @@ -import { assert, deprecate } from '@ember/debug'; -import EmberObject from './system/object'; -import Copyable from './mixins/copyable'; - -/** - @module @ember/object -*/ -function _copy(obj, deep, seen, copies) { - // primitive data types are immutable, just return them. - if (typeof obj !== 'object' || obj === null) { - return obj; - } - - let ret, loc; - - // avoid cyclical loops - if (deep && (loc = seen.indexOf(obj)) >= 0) { - return copies[loc]; - } - - if (deep) { - seen.push(obj); - } - - // IMPORTANT: this specific test will detect a native array only. Any other - // object will need to implement Copyable. - if (Array.isArray(obj)) { - ret = obj.slice(); - - if (deep) { - copies.push(ret); - loc = ret.length; - - while (--loc >= 0) { - ret[loc] = _copy(ret[loc], deep, seen, copies); - } - } - } else if (Copyable.detect(obj)) { - ret = obj.copy(deep, seen, copies); - if (deep) { - copies.push(ret); - } - } else if (obj instanceof Date) { - ret = new Date(obj.getTime()); - if (deep) { - copies.push(ret); - } - } else { - assert( - 'Cannot clone an EmberObject that does not implement Copyable', - !(obj instanceof EmberObject) || Copyable.detect(obj) - ); - - ret = {}; - if (deep) { - copies.push(ret); - } - - let key; - for (key in obj) { - // support Null prototype - if (!Object.prototype.hasOwnProperty.call(obj, key)) { - continue; - } - - // Prevents browsers that don't respect non-enumerability from - // copying internal Ember properties - if (key.substring(0, 2) === '__') { - continue; - } - - ret[key] = deep ? _copy(obj[key], deep, seen, copies) : obj[key]; - } - } - - return ret; -} - -/** - Creates a shallow copy of the passed object. A deep copy of the object is - returned if the optional `deep` argument is `true`. - - If the passed object implements the `Copyable` interface, then this - function will delegate to the object's `copy()` method and return the - result. See `Copyable` for further details. - - For primitive values (which are immutable in JavaScript), the passed object - is simply returned. - - @method copy - @deprecated Use 'ember-copy' addon instead - @static - @for @ember/object/internals - @param {Object} obj The object to clone - @param {Boolean} [deep=false] If true, a deep copy of the object is made. - @return {Object} The copied object - @public -*/ -export default function copy(obj, deep) { - deprecate('Use ember-copy addon instead of copy method and Copyable mixin.', false, { - id: 'ember-runtime.deprecate-copy-copyable', - until: '4.0.0', - url: 'https://deprecations.emberjs.com/v3.x/#toc_ember-runtime-deprecate-copy-copyable', - for: 'ember-source', - since: { - enabled: '3.3.0', - }, - }); - - // fast paths - if ('object' !== typeof obj || obj === null) { - return obj; // can't copy primitives - } - - if (!Array.isArray(obj) && Copyable.detect(obj)) { - return obj.copy(deep); - } - - return _copy(obj, deep, deep ? [] : null, deep ? [] : null); -}
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/@ember/-internals/runtime/lib/mixins/copyable.js
@@ -1,34 +0,0 @@ -/** -@module ember -*/ - -import { Mixin } from '@ember/-internals/metal'; - -/** - Implements some standard methods for copying an object. Add this mixin to - any object you create that can create a copy of itself. This mixin is - added automatically to the built-in array. - - You should generally implement the `copy()` method to return a copy of the - receiver. - - @class Copyable - @namespace Ember - @since Ember 0.9 - @deprecated Use 'ember-copy' addon instead - @private -*/ -export default Mixin.create({ - /** - __Required.__ You must implement this method to apply this mixin. - - Override to return a copy of the receiver. Default implementation raises - an exception. - - @method copy - @param {Boolean} deep if `true`, a deep copy of the object should be made - @return {Object} copy of receiver - @private - */ - copy: null, -});
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/@ember/-internals/runtime/tests/copyable-array/copy-test.js
@@ -1,12 +0,0 @@ -import { AbstractTestCase } from 'internal-test-helpers'; -import { runArrayTests } from '../helpers/array'; - -class CopyTest extends AbstractTestCase { - '@test should return an equivalent copy'() { - let obj = this.newObject(); - let copy = obj.copy(); - this.assert.ok(this.isEqual(obj, copy), 'old object and new object should be equivalent'); - } -} - -runArrayTests('copy', CopyTest, 'CopyableNativeArray', 'CopyableArray');
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/@ember/-internals/runtime/tests/core/copy_test.js
@@ -1,64 +0,0 @@ -import copy from '../../lib/copy'; -import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; - -moduleFor( - 'Ember Copy Method', - class extends AbstractTestCase { - ['@test Ember.copy null'](assert) { - let obj = { field: null }; - let copied = null; - expectDeprecation(() => { - copied = copy(obj, true); - }, 'Use ember-copy addon instead of copy method and Copyable mixin.'); - assert.equal(copied.field, null, 'null should still be null'); - } - - ['@test Ember.copy date'](assert) { - let date = new Date(2014, 7, 22); - let dateCopy = null; - expectDeprecation(() => { - dateCopy = copy(date); - }, 'Use ember-copy addon instead of copy method and Copyable mixin.'); - assert.equal(date.getTime(), dateCopy.getTime(), 'dates should be equivalent'); - } - - ['@test Ember.copy null prototype object'](assert) { - let obj = Object.create(null); - - obj.foo = 'bar'; - let copied = null; - expectDeprecation(() => { - copied = copy(obj); - }, 'Use ember-copy addon instead of copy method and Copyable mixin.'); - - assert.equal(copied.foo, 'bar', 'bar should still be bar'); - } - - ['@test Ember.copy Array'](assert) { - let array = [1, null, new Date(2015, 9, 9), 'four']; - let arrayCopy = null; - expectDeprecation(() => { - arrayCopy = copy(array); - }, 'Use ember-copy addon instead of copy method and Copyable mixin.'); - - assert.deepEqual(array, arrayCopy, 'array content cloned successfully in new array'); - } - - ['@test Ember.copy cycle detection'](assert) { - let obj = { - foo: { - bar: 'bar', - }, - }; - obj.foo.foo = obj.foo; - let cycleCopy = null; - expectDeprecation(() => { - cycleCopy = copy(obj, true); - }, 'Use ember-copy addon instead of copy method and Copyable mixin.'); - - assert.equal(cycleCopy.foo.bar, 'bar'); - assert.notEqual(cycleCopy.foo.foo, obj.foo.foo); - assert.strictEqual(cycleCopy.foo.foo, cycleCopy.foo.foo); - } - } -);
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/@ember/-internals/runtime/tests/helpers/array.js
@@ -3,15 +3,13 @@ import EmberArray, { A as emberA, MutableArray } from '../../lib/mixins/array'; import { generateGuid, guidFor } from '@ember/-internals/utils'; import { get, - set, computed, addArrayObserver, removeArrayObserver, arrayContentWillChange, arrayContentDidChange, } from '@ember/-internals/metal'; import EmberObject from '../../lib/system/object'; -import Copyable from '../../lib/mixins/copyable'; import { moduleFor } from 'internal-test-helpers'; export function newFixture(cnt) { @@ -147,42 +145,6 @@ class NativeArrayHelpers extends AbstractArrayHelper { } } -class CopyableNativeArray extends AbstractArrayHelper { - newObject() { - return emberA([generateGuid()]); - } - - isEqual(a, b) { - if (!(a instanceof Array)) { - return false; - } - - if (!(b instanceof Array)) { - return false; - } - - if (a.length !== b.length) { - return false; - } - - return a[0] === b[0]; - } -} - -class CopyableArray extends AbstractArrayHelper { - newObject() { - return CopyableObject.create(); - } - - isEqual(a, b) { - if (!(a instanceof CopyableObject) || !(b instanceof CopyableObject)) { - return false; - } - - return get(a, 'id') === get(b, 'id'); - } -} - class ArrayProxyHelpers extends AbstractArrayHelper { newObject(ary) { return ArrayProxy.create({ content: emberA(super.newObject(ary)) }); @@ -271,21 +233,6 @@ const TestMutableArray = EmberObject.extend(MutableArray, { }, }); -const CopyableObject = EmberObject.extend(Copyable, { - id: null, - - init() { - this._super(...arguments); - set(this, 'id', generateGuid()); - }, - - copy() { - let ret = CopyableObject.create(); - set(ret, 'id', get(this, 'id')); - return ret; - }, -}); - class MutableArrayHelpers extends NativeArrayHelpers { newObject(ary) { return TestMutableArray.create(super.newObject(ary)); @@ -316,15 +263,11 @@ export function runArrayTests(name, Tests, ...types) { case 'MutableArray': moduleFor(`MutableArray: ${name}`, Tests, MutableArrayHelpers); break; - case 'CopyableArray': - moduleFor(`CopyableArray: ${name}`, Tests, CopyableArray); - break; - case 'CopyableNativeArray': - moduleFor(`CopyableNativeArray: ${name}`, Tests, CopyableNativeArray); - break; case 'NativeArray': moduleFor(`NativeArray: ${name}`, Tests, NativeArrayHelpers); break; + default: + throw new Error(`runArrayTests passed unexpected type ${type}`); } }); } else {
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/@ember/object/internals.js
@@ -1,3 +1,2 @@ export { getCachedValueFor as cacheFor } from '@ember/-internals/metal'; -export { copy } from '@ember/-internals/runtime'; export { guidFor } from '@ember/-internals/utils';
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/ember/index.js
@@ -40,10 +40,8 @@ import { RegistryProxyMixin, ContainerProxyMixin, compare, - copy, isEqual, Array as EmberArray, - Copyable, MutableEnumerable, MutableArray, TargetActionSupport, @@ -375,7 +373,6 @@ Ember.Object = EmberObject; Ember._RegistryProxyMixin = RegistryProxyMixin; Ember._ContainerProxyMixin = ContainerProxyMixin; Ember.compare = compare; -Ember.copy = copy; Ember.isEqual = isEqual; /** @@ -408,7 +405,6 @@ Ember.ObjectProxy = ObjectProxy; Ember.ActionHandler = ActionHandler; Ember.CoreObject = CoreObject; Ember.NativeArray = NativeArray; -Ember.Copyable = Copyable; Ember.MutableEnumerable = MutableEnumerable; Ember.MutableArray = MutableArray; Ember.Evented = Evented;
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
packages/ember/tests/reexports_test.js
@@ -351,7 +351,6 @@ let allExports = [ // @ember/object/internals ['cacheFor', '@ember/object/internals', 'cacheFor'], - ['copy', '@ember/object/internals', 'copy'], ['guidFor', '@ember/object/internals', 'guidFor'], // @ember/object/mixin @@ -543,7 +542,6 @@ let allExports = [ ['Comparable', '@ember/-internals/runtime'], ['ActionHandler', '@ember/-internals/runtime'], ['NativeArray', '@ember/-internals/runtime'], - ['Copyable', '@ember/-internals/runtime'], ['MutableEnumerable', '@ember/-internals/runtime'], EMBER_MODERNIZED_BUILT_IN_COMPONENTS ? null
true
Other
emberjs
ember.js
f6cb99ee41910d06a6f1edea420947e5f89712ce.json
Remove copy & Copyable Part of https://github.com/emberjs/ember.js/issues/19617
tests/docs/expected.js
@@ -149,7 +149,6 @@ module.exports = { 'controller', 'controllerFor', 'controllerName', - 'copy', 'create', 'createCache', 'current-when',
true
Other
emberjs
ember.js
02e1bfdf910e14abdb212033b8400a6da0f8e71d.json
Remove old deprecations path
packages/@ember/application/deprecations.ts
@@ -1,39 +0,0 @@ -import { - deprecate as _deprecate, - deprecateFunc as _deprecateFunc, - DeprecationOptions, -} from '@ember/debug'; - -export function deprecate(message: string, condition: boolean, options: DeprecationOptions): void { - _deprecate( - "`import { deprecate } from '@ember/application/deprecations';` has been deprecated, please update to `import { deprecate } from '@ember/debug';`", - false, - { - id: 'old-deprecate-method-paths', - until: '4.0.0', - for: 'ember-source', - since: { - enabled: '3.0.0', - }, - } - ); - - _deprecate(message, condition, options); -} - -export function deprecateFunc(message: string, options: DeprecationOptions, func: Function): void { - _deprecate( - "`import { deprecateFunc } from '@ember/application/deprecations';` has been deprecated, please update to `import { deprecateFunc } from '@ember/debug';`", - false, - { - id: 'old-deprecate-method-paths', - until: '4.0.0', - for: 'ember-source', - since: { - enabled: '3.0.0', - }, - } - ); - - _deprecateFunc(message, options, func); -}
true
Other
emberjs
ember.js
02e1bfdf910e14abdb212033b8400a6da0f8e71d.json
Remove old deprecations path
packages/ember/tests/reexports_test.js
@@ -164,10 +164,6 @@ let allExports = [ ['runLoadHooks', '@ember/application', 'runLoadHooks'], ['setOwner', '@ember/application', 'setOwner'], - // @ember/application/deprecations - [null, '@ember/application/deprecations', 'deprecate'], - [null, '@ember/application/deprecations', 'deprecateFunc'], - // @ember/application/instance ['ApplicationInstance', '@ember/application/instance', 'default'],
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
packages/@ember/-internals/metal/index.ts
@@ -50,7 +50,7 @@ export { removeObserver, flushAsyncObservers, } from './lib/observer'; -export { Mixin, aliasMethod, mixin, observer, applyMixin } from './lib/mixin'; +export { Mixin, mixin, observer, applyMixin } from './lib/mixin'; export { default as inject, DEBUG_INJECTION_FUNCTIONS } from './lib/injected_property'; export { tagForProperty, tagForObject, markObjectAsDirty } from './lib/tags'; export { tracked, TrackedDescriptor } from './lib/tracked';
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
packages/@ember/-internals/metal/lib/mixin.ts
@@ -13,8 +13,7 @@ import { wrap, } from '@ember/-internals/utils'; import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features'; -import { assert, deprecate } from '@ember/debug'; -import { ALIAS_METHOD } from '@ember/deprecated-features'; +import { assert } from '@ember/debug'; import { DEBUG } from '@glimmer/env'; import { _WeakSet } from '@glimmer/util'; import { @@ -26,7 +25,6 @@ import { import { ComputedDescriptor, descriptorForDecorator, - descriptorForProperty, makeComputedDecorator, nativeDescDecorator, } from './decorator'; @@ -366,39 +364,6 @@ function mergeProps( } } -let followMethodAlias: ( - obj: object, - alias: Alias, - descs: { [key: string]: any }, - values: { [key: string]: any } -) => { desc: any; value: any }; - -if (ALIAS_METHOD) { - followMethodAlias = function ( - obj: object, - alias: Alias, - descs: { [key: string]: any }, - values: { [key: string]: any } - ) { - let altKey = alias.methodName; - let possibleDesc; - let desc = descs[altKey]; - let value = values[altKey]; - - if (desc !== undefined || value !== undefined) { - // do nothing - } else if ((possibleDesc = descriptorForProperty(obj, altKey)) !== undefined) { - desc = possibleDesc; - value = undefined; - } else { - desc = undefined; - value = obj[altKey]; - } - - return { desc, value }; - }; -} - function updateObserversAndListeners(obj: object, key: string, fn: Function, add: boolean) { let meta = observerListenerMetaFor(fn); @@ -446,14 +411,6 @@ export function applyMixin(obj: { [key: string]: any }, mixins: Mixin[], _hideKe let value = values[key]; let desc = descs[key]; - if (ALIAS_METHOD) { - while (value !== undefined && isAlias(value)) { - let followed = followMethodAlias(obj, value, descs, values); - desc = followed.desc; - value = followed.value; - } - } - if (value !== undefined) { if (typeof value === 'function') { updateObserversAndListeners(obj, key, value, true); @@ -785,80 +742,6 @@ function _keys(mixin: Mixin, ret = new Set(), seen = new Set()) { return ret; } -declare class Alias { - public methodName: string; - constructor(methodName: string); -} - -let AliasImpl: typeof Alias; - -let isAlias: (alias: any) => alias is Alias; - -if (ALIAS_METHOD) { - const ALIASES = new _WeakSet(); - - isAlias = (alias: any): alias is Alias => { - return ALIASES.has(alias); - }; - - AliasImpl = class AliasImpl { - constructor(public methodName: string) { - ALIASES.add(this); - } - } as typeof Alias; -} - -/** - Makes a method available via an additional name. - - ```app/utils/person.js - import EmberObject, { - aliasMethod - } from '@ember/object'; - - export default EmberObject.extend({ - name() { - return 'Tomhuda Katzdale'; - }, - moniker: aliasMethod('name') - }); - ``` - - ```javascript - let goodGuy = Person.create(); - - goodGuy.name(); // 'Tomhuda Katzdale' - goodGuy.moniker(); // 'Tomhuda Katzdale' - ``` - - @method aliasMethod - @static - @deprecated Use a shared utility method instead - @for @ember/object - @param {String} methodName name of the method to alias - @public -*/ -export let aliasMethod: (methodName: string) => any; - -if (ALIAS_METHOD) { - aliasMethod = function aliasMethod(methodName: string): Alias { - deprecate( - `You attempted to alias '${methodName}, but aliasMethod has been deprecated. Consider extracting the method into a shared utility function.`, - false, - { - id: 'object.alias-method', - until: '4.0.0', - url: 'https://deprecations.emberjs.com/v3.x#toc_object-alias-method', - for: 'ember-source', - since: { - enabled: '3.9.0', - }, - } - ); - return new AliasImpl(methodName); - }; -} - // .......................................................... // OBSERVER HELPER //
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
packages/@ember/-internals/metal/tests/mixin/alias_method_test.js
@@ -1,101 +0,0 @@ -import { get, Mixin, mixin, aliasMethod } from '../..'; -import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; - -function validateAliasMethod(assert, obj) { - assert.equal(obj.fooMethod(), 'FOO', 'obj.fooMethod()'); - assert.equal(obj.barMethod(), 'FOO', 'obj.barMethod should be a copy of foo'); -} - -moduleFor( - 'aliasMethod', - class extends AbstractTestCase { - ['@test methods of another name are aliased when the mixin is applied'](assert) { - expectDeprecation(() => { - let MyMixin = Mixin.create({ - fooMethod() { - return 'FOO'; - }, - barMethod: aliasMethod('fooMethod'), - }); - - let obj = MyMixin.apply({}); - validateAliasMethod(assert, obj); - }, /aliasMethod has been deprecated. Consider extracting the method into a shared utility function/); - } - - ['@test should follow aliasMethods all the way down'](assert) { - expectDeprecation(() => { - let MyMixin = Mixin.create({ - bar: aliasMethod('foo'), // put first to break ordered iteration - baz() { - return 'baz'; - }, - foo: aliasMethod('baz'), - }); - - let obj = MyMixin.apply({}); - assert.equal(get(obj, 'bar')(), 'baz', 'should have followed aliasMethods'); - }, /aliasMethod has been deprecated. Consider extracting the method into a shared utility function/); - } - - ['@test should alias methods from other dependent mixins'](assert) { - expectDeprecation(() => { - let BaseMixin = Mixin.create({ - fooMethod() { - return 'FOO'; - }, - }); - - let MyMixin = Mixin.create(BaseMixin, { - barMethod: aliasMethod('fooMethod'), - }); - - let obj = MyMixin.apply({}); - validateAliasMethod(assert, obj); - }, /aliasMethod has been deprecated. Consider extracting the method into a shared utility function/); - } - - ['@test should alias methods from other mixins applied at same time'](assert) { - expectDeprecation(() => { - let BaseMixin = Mixin.create({ - fooMethod() { - return 'FOO'; - }, - }); - - let MyMixin = Mixin.create({ - barMethod: aliasMethod('fooMethod'), - }); - - let obj = mixin({}, BaseMixin, MyMixin); - validateAliasMethod(assert, obj); - }, /aliasMethod has been deprecated. Consider extracting the method into a shared utility function/); - } - - ['@test should alias methods from mixins already applied on object'](assert) { - expectDeprecation(() => { - let BaseMixin = Mixin.create({ - quxMethod() { - return 'qux'; - }, - }); - - let MyMixin = Mixin.create({ - bar: aliasMethod('foo'), - barMethod: aliasMethod('fooMethod'), - }); - - let obj = { - fooMethod() { - return 'FOO'; - }, - }; - - BaseMixin.apply(obj); - MyMixin.apply(obj); - - validateAliasMethod(assert, obj); - }, /aliasMethod has been deprecated. Consider extracting the method into a shared utility function/); - } - } -);
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
packages/@ember/deprecated-features/index.ts
@@ -9,7 +9,6 @@ export const MERGE = !!'3.6.0-beta.1'; export const ROUTER_EVENTS = !!'4.0.0'; export const COMPONENT_MANAGER_STRING_LOOKUP = !!'3.8.0'; export const JQUERY_INTEGRATION = !!'3.9.0'; -export const ALIAS_METHOD = !!'3.9.0'; export const APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1'; export const FUNCTION_PROTOTYPE_EXTENSIONS = !!'3.11.0-beta.1'; export const MOUSE_ENTER_LEAVE_MOVE_EVENTS = !!'3.13.0-beta.1';
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
packages/@ember/object/index.js
@@ -15,7 +15,6 @@ export { observer, computed, trySet, - aliasMethod, } from '@ember/-internals/metal'; import { computed } from '@ember/-internals/metal';
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
packages/ember/index.js
@@ -305,7 +305,6 @@ Ember.setProperties = metal.setProperties; Ember.expandProperties = metal.expandProperties; Ember.addObserver = metal.addObserver; Ember.removeObserver = metal.removeObserver; -Ember.aliasMethod = metal.aliasMethod; Ember.observer = metal.observer; Ember.mixin = metal.mixin; Ember.Mixin = metal.Mixin;
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
packages/ember/tests/reexports_test.js
@@ -286,7 +286,6 @@ let allExports = [ // @ember/object ['Object', '@ember/object', 'default'], ['_action', '@ember/object', 'action'], - ['aliasMethod', '@ember/object', 'aliasMethod'], ['computed', '@ember/object', 'computed'], ['defineProperty', '@ember/object', 'defineProperty'], ['get', '@ember/object', 'get'],
true
Other
emberjs
ember.js
39aeba2bef0f672bcea17454879a16d878898e2c.json
Remove deprecated aliasMethod
tests/docs/expected.js
@@ -75,7 +75,6 @@ module.exports = { 'advanceReadiness', 'afterModel', 'alias', - 'aliasMethod', 'all', 'allSettled', 'and',
true
Other
emberjs
ember.js
d08dde55001e6a08f486fc0ef595b48f67e44b5c.json
Remove deprecated tryInvoke for v4.0
packages/@ember/-internals/utils/index.ts
@@ -23,7 +23,7 @@ export { } from './lib/super'; export { default as inspect } from './lib/inspect'; export { default as lookupDescriptor } from './lib/lookup-descriptor'; -export { canInvoke, tryInvoke } from './lib/invoke'; +export { canInvoke } from './lib/invoke'; export { default as makeArray } from './lib/make-array'; export { getName, setName } from './lib/name'; export { default as toString } from './lib/to-string';
true
Other
emberjs
ember.js
d08dde55001e6a08f486fc0ef595b48f67e44b5c.json
Remove deprecated tryInvoke for v4.0
packages/@ember/-internals/utils/lib/invoke.ts
@@ -1,5 +1,3 @@ -import { deprecate } from '@ember/debug'; - /** Checks to see if the `methodName` exists on the `obj`. @@ -25,52 +23,3 @@ export function canInvoke(obj: any | null | undefined, methodName: string): obj /** @module @ember/utils */ - -/** - Checks to see if the `methodName` exists on the `obj`, - and if it does, invokes it with the arguments passed. - - ```javascript - import { tryInvoke } from '@ember/utils'; - - let d = new Date('03/15/2013'); - - tryInvoke(d, 'getTime'); // 1363320000000 - tryInvoke(d, 'setFullYear', [2014]); // 1394856000000 - tryInvoke(d, 'noSuchMethod', [2014]); // undefined - ``` - - @method tryInvoke - @for @ember/utils - @static - @param {Object} obj The object to check for the method - @param {String} methodName The method name to check for - @param {Array} [args] The arguments to pass to the method - @return {*} the return value of the invoked method or undefined if it cannot be invoked - @public - @deprecated Use Javascript's optional chaining instead. -*/ -export function tryInvoke( - obj: any | undefined | null, - methodName: string, - args: Array<any | undefined | null> -) { - deprecate( - `Use of tryInvoke is deprecated. Instead, consider using JavaScript's optional chaining.`, - false, - { - id: 'ember-utils.try-invoke', - until: '4.0.0', - for: 'ember-source', - since: { - enabled: '3.24.0', - }, - url: 'https://deprecations.emberjs.com/v3.x#toc_ember-utils-try-invoke', - } - ); - - if (canInvoke(obj, methodName)) { - let method = obj[methodName]; - return method.apply(obj, args); - } -}
true
Other
emberjs
ember.js
d08dde55001e6a08f486fc0ef595b48f67e44b5c.json
Remove deprecated tryInvoke for v4.0
packages/@ember/-internals/utils/tests/try_invoke_test.js
@@ -1,60 +0,0 @@ -import { tryInvoke } from '..'; -import { moduleFor, AbstractTestCase as TestCase } from 'internal-test-helpers'; - -let obj; - -moduleFor( - 'Ember.tryInvoke', - class extends TestCase { - constructor() { - super(); - - obj = { - aMethodThatExists() { - return true; - }, - aMethodThatTakesArguments(arg1, arg2) { - return arg1 === arg2; - }, - }; - } - - teardown() { - obj = undefined; - } - - ["@test should return undefined when the object doesn't exist"](assert) { - expectDeprecation( - () => assert.equal(tryInvoke(undefined, 'aMethodThatDoesNotExist'), undefined), - /Use of tryInvoke is deprecated/ - ); - } - - ["@test should return undefined when asked to perform a method that doesn't exist on the object"]( - assert - ) { - expectDeprecation( - () => assert.equal(tryInvoke(obj, 'aMethodThatDoesNotExist'), undefined), - /Use of tryInvoke is deprecated/ - ); - } - - ['@test should return what the method returns when asked to perform a method that exists on the object']( - assert - ) { - expectDeprecation( - () => assert.equal(tryInvoke(obj, 'aMethodThatExists'), true), - /Use of tryInvoke is deprecated/ - ); - } - - ['@test should return what the method returns when asked to perform a method that takes arguments and exists on the object']( - assert - ) { - expectDeprecation( - () => assert.equal(tryInvoke(obj, 'aMethodThatTakesArguments', [true, true]), true), - /Use of tryInvoke is deprecated/ - ); - } - } -);
true
Other
emberjs
ember.js
d08dde55001e6a08f486fc0ef595b48f67e44b5c.json
Remove deprecated tryInvoke for v4.0
packages/@ember/utils/index.js
@@ -1,3 +1,2 @@ export { isNone, isBlank, isEmpty, isPresent } from '@ember/-internals/metal'; -export { tryInvoke } from '@ember/-internals/utils'; export { compare, isEqual, typeOf } from '@ember/-internals/runtime';
true
Other
emberjs
ember.js
d08dde55001e6a08f486fc0ef595b48f67e44b5c.json
Remove deprecated tryInvoke for v4.0
packages/ember/index.js
@@ -220,7 +220,6 @@ Ember.guidFor = utils.guidFor; Ember.inspect = utils.inspect; Ember.makeArray = utils.makeArray; Ember.canInvoke = utils.canInvoke; -Ember.tryInvoke = utils.tryInvoke; Ember.wrap = utils.wrap; Ember.uuid = utils.uuid;
true
Other
emberjs
ember.js
d08dde55001e6a08f486fc0ef595b48f67e44b5c.json
Remove deprecated tryInvoke for v4.0
packages/ember/tests/reexports_test.js
@@ -468,7 +468,6 @@ let allExports = [ ['isEqual', '@ember/utils', 'isEqual'], ['isNone', '@ember/utils', 'isNone'], ['isPresent', '@ember/utils', 'isPresent'], - ['tryInvoke', '@ember/utils', 'tryInvoke'], ['typeOf', '@ember/utils', 'typeOf'], // @ember/version
true
Other
emberjs
ember.js
d08dde55001e6a08f486fc0ef595b48f67e44b5c.json
Remove deprecated tryInvoke for v4.0
tests/docs/expected.js
@@ -573,7 +573,6 @@ module.exports = { 'trigger', 'triggerAction', 'triggerEvent', - 'tryInvoke', 'trySet', 'type', 'typeInjection',
true
Other
emberjs
ember.js
cfdb781faf69ff2a8b6e904c3f91322f72ef22d5.json
Fix more lint issues
packages/@ember/-internals/metal/tests/accessors/get_test.js
@@ -1,10 +1,9 @@ import { ENV } from '@ember/-internals/environment'; import { Object as EmberObject } from '@ember/-internals/runtime'; -import { get, set, Mixin, observer, computed } from '../..'; +import { get, Mixin, observer } from '../..'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; import { run } from '@ember/runloop'; import { destroy } from '@glimmer/destroyable'; -import { track } from '@glimmer/validator'; function aget(x, y) { return x[y];
false
Other
emberjs
ember.js
297ab0e771409d61dcb014a9a40144cd7fdd5ee8.json
Add 3.28.0-beta.6 to CHANGELOG (cherry picked from commit a01e11de7ba0dd36134bc591c02b5d08d929b0e8)
CHANGELOG.md
@@ -1,5 +1,9 @@ # Ember Changelog +### v3.28.0-beta.6 (June 21, 2021) + +- [#19584](https://github.com/emberjs/ember.js/pull/19584) [BUGFIX] Ensure hash objects correctly entangle as dependencies + ### v3.28.0-beta.5 (June 14, 2021) - [#19597](https://github.com/emberjs/ember.js/pull/19597) [BUGFIX] Fix `<LinkTo>` with nested children
false
Other
emberjs
ember.js
55d012c49bb6af87b9f0841457c1380f0006292d.json
Add v3.28.0-beta.5 to CHANGELOG (cherry picked from commit 7de1e204dc72da3198ad6324039291b94154eeeb)
CHANGELOG.md
@@ -1,5 +1,9 @@ # Ember Changelog +### v3.28.0-beta.5 (June 14, 2021) + +- [#19597](https://github.com/emberjs/ember.js/pull/19597) [BUGFIX] Fix `<LinkTo>` with nested children + ### v3.28.0-beta.4 (June 7, 2021) - [#19586](https://github.com/emberjs/ember.js/pull/19586) [BUGFIX] Fix Embroider compatibility
false
Other
emberjs
ember.js
1a6c9640001f319fffbcf77fbd934738dfa4ff87.json
Fix Changelog formatting The different heading levels are causing issues for services that are trying to read and filter the changelog
CHANGELOG.md
@@ -24,16 +24,16 @@ - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs` -## v3.27.5 (June 10, 2021) +### v3.27.5 (June 10, 2021) - [#19597](https://github.com/emberjs/ember.js/pull/19597) [BIGFIX] Fix `<LinkTo>` with nested children -## v3.27.4 (June 9, 2021) +### v3.27.4 (June 9, 2021) - [#19594](https://github.com/emberjs/ember.js/pull/19594) [BUGFIX] Revert lazy hash changes - [#19596](https://github.com/emberjs/ember.js/pull/19596) [DOC] Fix "Dormant" addon warning typo -## v3.27.3 (June 3, 2021) +### v3.27.3 (June 3, 2021) - [#19565](https://github.com/emberjs/ember.js/pull/19565) [BUGFIX] Ensures that `computed` can depend on dynamic `(hash` keys - [#19571](https://github.com/emberjs/ember.js/pull/19571) [BUGFIX] Extend `Route.prototype.transitionTo` deprecation until 5.0.0
false
Other
emberjs
ember.js
c47d6287c335b07d5425f3cab0b95bdde9811af8.json
Add CHANGELOG for 3.27.5 (cherry picked from commit 428e7a05233e0c508dfbf339ae2f241a71109380)
CHANGELOG.md
@@ -24,6 +24,10 @@ - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs` +## v3.27.5 (June 10, 2021) + +- [#19597](https://github.com/emberjs/ember.js/pull/19597) [BIGFIX] Fix `<LinkTo>` with nested children + ## v3.27.4 (June 9, 2021) - [#19594](https://github.com/emberjs/ember.js/pull/19594) [BUGFIX] Revert lazy hash changes
false
Other
emberjs
ember.js
ea322a34a9e7b4654c009f27ce81582a96825daf.json
Add CHANGELOG for v3.27.4 (cherry picked from commit fe32020e181de85b4b2e480792f8ad1db3e5eee1) (cherry picked from commit 2392417347f151457c16792541e3da2b78c5e6dc)
CHANGELOG.md
@@ -24,11 +24,16 @@ - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs` +## v3.27.4 (June 9, 2021) + +- [#19594](https://github.com/emberjs/ember.js/pull/19594) [BUGFIX] Revert lazy hash changes +- [#19596](https://github.com/emberjs/ember.js/pull/19596) [DOC] Fix "Dormant" addon warning typo + ## v3.27.3 (June 3, 2021) - [#19565](https://github.com/emberjs/ember.js/pull/19565) [BUGFIX] Ensures that `computed` can depend on dynamic `(hash` keys - [#19571](https://github.com/emberjs/ember.js/pull/19571) [BUGFIX] Extend `Route.prototype.transitionTo` deprecation until 5.0.0 -- [#19586](https://github.com/emberjs/ember.js/pull/19586) [BUGFIX] Fix Embroider compatibility +- [#19586](https://github.com/emberjs/ember.js/pull/19586) [BUGFIX] Fix Embroider compatibility ### v3.27.2 (May 27, 2021)
false
Other
emberjs
ember.js
b6948fbe9dc2d1cc148b7d859bb43cc024f43312.json
Add v3.28.0-beta.4 to CHANGELOG (cherry picked from commit e31720c3a4cc218d5ec2f92e67e145920e9f311b)
CHANGELOG.md
@@ -1,5 +1,9 @@ # Ember Changelog +### v3.28.0-beta.4 (June 7, 2021) + +- [#19586](https://github.com/emberjs/ember.js/pull/19586) [BUGFIX] Fix Embroider compatibility + ### v3.28.0-beta.3 (June 1, 2021) - [#19565](https://github.com/emberjs/ember.js/pull/19565) [BUGFIX] Ensures that computed can depend on dynamic hash keys
false
Other
emberjs
ember.js
c445e04b6add358e92a42f311b8ed6e9f6cb6134.json
Correct typo in optionalFeatures warning
lib/index.js
@@ -142,7 +142,7 @@ module.exports = { } } else { this.ui.writeWarnLine( - 'The Ember Classic edition has been deprecated. Speciying "classic" in your package.json, or not specifying a value at all, will no longer be supported. You must explicitly set the "ember.edition" property to "octane". This warning will become an error in Ember 4.0.0.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_editions-classic' + 'The Ember Classic edition has been deprecated. Specifying "classic" in your package.json, or not specifying a value at all, will no longer be supported. You must explicitly set the "ember.edition" property to "octane". This warning will become an error in Ember 4.0.0.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_editions-classic' ); if (
false
Other
emberjs
ember.js
c35fc14727330214d8c3e51fac18f4253613c37c.json
Add v3.27.3 to CHANGELOG.md.
CHANGELOG.md
@@ -20,6 +20,12 @@ - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs` +## v3.27.3 (June 3, 2021) + +- [#19565](https://github.com/emberjs/ember.js/pull/19565) [BUGFIX] Ensures that `computed` can depend on dynamic `(hash` keys +- [#19571](https://github.com/emberjs/ember.js/pull/19571) [BUGFIX] Extend `Route.prototype.transitionTo` deprecation until 5.0.0 +- [#19586](https://github.com/emberjs/ember.js/pull/19586) [BUGFIX] Fix Embroider compatibility + ### v3.27.2 (May 27, 2021) - [#19511](https://github.com/emberjs/ember.js/pull/19511) / [#19548](https://github.com/emberjs/ember.js/pull/19548) [BUGFIX] Makes the (hash) helper lazy
false
Other
emberjs
ember.js
540fafaff2eb33f89e3935d39ff1c93933e3f5a1.json
Add some basic tests Co-authored-by: Stefan Penner <[email protected]>
lib/global-deprecation-utils.js
@@ -1,4 +1,7 @@ +'use strict'; + const semver = require('semver'); +const validSemverRange = require('semver/ranges/valid'); function* walkAddonTree(project, pathToAddon = []) { for (let addon of project.addons) { @@ -11,19 +14,17 @@ function requirementFor(pkg, deps = {}) { return deps[pkg]; } -module.exports = function (project) { - if (process.env.EMBER_ENV === 'production') { - return; - } +const DEFAULT_RESULT = Object.freeze({ + globalMessage: '', + hasActionableSuggestions: false, + shouldIssueSingleDeprecation: false, + bootstrap: `require('@ember/-internals/bootstrap').default()`, +}); - let isYarnProject = ((root) => { - try { - // eslint-disable-next-line node/no-unpublished-require - return require('ember-cli/lib/utilities/is-yarn-project')(root); - } catch { - return undefined; - } - })(project.root); +module.exports = function (project, env = process.env) { + if (env.EMBER_ENV === 'production') { + return DEFAULT_RESULT; + } let groupedByTopLevelAddon = Object.create(null); let groupedByVersion = Object.create(null); @@ -36,8 +37,12 @@ module.exports = function (project) { let info; if (addon.parent === project) { - let requirement = requirementFor('ember-cli-babel', project.pkg.devDependencies); - let compatible = semver.satisfies('7.26.6', requirement); + let requirement = + requirementFor('ember-cli-babel', project.pkg.dependencies) || + requirementFor('ember-cli-babel', project.pkg.devDependencies); + + let validRange = validSemverRange(requirement); + let compatible = validRange ? semver.satisfies('7.26.6', requirement) : true; info = projectInfo = { parent: `${project.name()} (your app)`, @@ -49,7 +54,8 @@ module.exports = function (project) { }; } else { let requirement = requirementFor('ember-cli-babel', addon.parent.pkg.dependencies); - let compatible = semver.satisfies('7.26.6', requirement); + let validRange = validSemverRange(requirement); + let compatible = validRange ? semver.satisfies('7.26.6', requirement) : true; let dormant = addon.parent._fileSystemInfo ? addon.parent._fileSystemInfo().hasJSFiles === false : false; @@ -82,7 +88,7 @@ module.exports = function (project) { } if (Object.keys(groupedByVersion).length === 0) { - return; + return DEFAULT_RESULT; } let dormantTopLevelAddons = []; @@ -112,16 +118,9 @@ module.exports = function (project) { // Only show the compatible addons if the project itself is up-to-date, because updating the // project's own dependency on ember-cli-babel to latest may also get these addons to use it // as well. Otherwise, there is an unnecessary copy in the tree and it needs to be deduped. - if (isYarnProject === true) { - suggestions += - '* Run `npx yarn-deduplicate --packages ember-cli-babel` followed by `yarn install`.\n'; - } else if (isYarnProject === false) { - suggestions += '* Run `npm dedupe`.\n'; - } else { - suggestions += - '* If using yarn, run `npx yarn-deduplicate --packages ember-cli-babel` followed by `yarn install`.\n' + - '* If using npm, run `npm dedupe`.\n'; - } + suggestions += + '* If using yarn, run `npx yarn-deduplicate --packages ember-cli-babel` followed by `yarn install`.\n' + + '* If using npm, run `npm dedupe`.\n'; hasActionableSuggestions = true; } @@ -203,16 +202,9 @@ module.exports = function (project) { if (projectInfo) { details += 'Try upgrading your `devDependencies` on `ember-cli-babel` to `^7.26.6`.\n'; } else { - if (isYarnProject === true) { - details += - 'Try running `npx yarn-deduplicate --packages ember-cli-babel` followed by `yarn install`.\n'; - } else if (isYarnProject === false) { - details += 'Try running `npm dedupe`.\n'; - } else { - details += - 'If using yarn, try running `npx yarn-deduplicate --packages ember-cli-babel` followed by `yarn install`.' + - 'If using npm, try running `npm dedupe`.\n'; - } + details += + 'If using yarn, try running `npx yarn-deduplicate --packages ember-cli-babel` followed by `yarn install`.' + + 'If using npm, try running `npm dedupe`.\n'; } }
true
Other
emberjs
ember.js
540fafaff2eb33f89e3935d39ff1c93933e3f5a1.json
Add some basic tests Co-authored-by: Stefan Penner <[email protected]>
tests/node/global-deprecation-info-test.js
@@ -0,0 +1,207 @@ +'use strict'; + +const globalDeprecationInfo = require('../../lib/global-deprecation-utils'); + +QUnit.module('globalDeprecationInfo', function (hooks) { + let project, env; + + function buildBabel(parent, version) { + return { + name: 'ember-cli-babel', + parent, + pkg: { + version, + }, + addons: [], + }; + } + + hooks.beforeEach(function () { + project = { + name() { + return 'fake-project'; + }, + pkg: { + dependencies: {}, + devDependencies: {}, + }, + addons: [], + }; + env = Object.create(null); + }); + + hooks.afterEach(function () {}); + + QUnit.test('when in production, does nothing', function (assert) { + env.EMBER_ENV = 'production'; + + let result = globalDeprecationInfo(project, env); + + assert.deepEqual(result, { + globalMessage: '', + hasActionableSuggestions: false, + shouldIssueSingleDeprecation: false, + bootstrap: `require('@ember/-internals/bootstrap').default()`, + }); + }); + + QUnit.test('without addons, does nothing', function (assert) { + project.addons = []; + let result = globalDeprecationInfo(project, env); + + assert.deepEqual(result, { + globalMessage: '', + hasActionableSuggestions: false, + shouldIssueSingleDeprecation: false, + bootstrap: `require('@ember/-internals/bootstrap').default()`, + }); + }); + + QUnit.test('projects own ember-cli-babel is too old', function (assert) { + project.pkg.devDependencies = { + 'ember-cli-babel': '^7.26.0', + }; + + project.addons.push({ + name: 'ember-cli-babel', + parent: project, + pkg: { + version: '7.26.5', + }, + addons: [], + }); + + let result = globalDeprecationInfo(project, env); + assert.strictEqual(result.shouldIssueSingleDeprecation, true); + assert.strictEqual(result.hasActionableSuggestions, true); + assert.ok( + result.globalMessage.includes( + '* Upgrade your `devDependencies` on `ember-cli-babel` to `^7.26.6`' + ) + ); + }); + + QUnit.test('projects has ember-cli-babel in dependencies', function (assert) { + project.pkg.dependencies = { + 'ember-cli-babel': '^7.25.0', + }; + + project.addons.push({ + name: 'ember-cli-babel', + parent: project, + pkg: { + version: '7.26.5', + }, + addons: [], + }); + + let result = globalDeprecationInfo(project, env); + assert.strictEqual(result.shouldIssueSingleDeprecation, true); + assert.strictEqual(result.hasActionableSuggestions, true); + assert.ok( + result.globalMessage.includes( + '* Upgrade your `devDependencies` on `ember-cli-babel` to `^7.26.6`' + ) + ); + }); + QUnit.test( + 'projects has no devDependencies, but old ember-cli-babel found in addons array', + function (assert) { + project.pkg.devDependencies = {}; + + project.addons.push({ + name: 'ember-cli-babel', + parent: project, + pkg: { + version: '7.26.5', + }, + addons: [], + }); + + let result = globalDeprecationInfo(project, env); + assert.strictEqual(result.shouldIssueSingleDeprecation, true); + assert.strictEqual(result.hasActionableSuggestions, true); + assert.ok( + result.globalMessage.includes( + '* Upgrade your `devDependencies` on `ember-cli-babel` to `^7.26.6`' + ) + ); + } + ); + + QUnit.test('projects uses linked ember-cli-babel', function (assert) { + project.pkg.devDependencies = { + 'ember-cli-babel': 'link:./some/path/here', + }; + + let otherAddon = { + name: 'other-thing-here', + parent: project, + pkg: {}, + addons: [], + }; + + otherAddon.addons.push(buildBabel(otherAddon, '7.26.5')); + project.addons.push(buildBabel(project, '7.26.6'), otherAddon); + + let result = globalDeprecationInfo(project, env); + assert.strictEqual(result.shouldIssueSingleDeprecation, true); + assert.strictEqual(result.hasActionableSuggestions, true); + + assert.ok( + result.globalMessage.includes( + '* If using yarn, run `npx yarn-deduplicate --packages ember-cli-babel`' + ) + ); + assert.ok(result.globalMessage.includes('* If using npm, run `npm dedupe`')); + }); + + QUnit.test('projects own ember-cli-babel is up to date', function (assert) { + project.pkg.devDependencies = { + 'ember-cli-babel': '^7.26.0', + }; + + project.addons.push({ + name: 'ember-cli-babel', + parent: project, + pkg: { + version: '7.26.6', + }, + addons: [], + }); + + let result = globalDeprecationInfo(project, env); + assert.strictEqual(result.shouldIssueSingleDeprecation, false); + assert.strictEqual(result.hasActionableSuggestions, false); + assert.notOk( + result.globalMessage.includes( + '* Upgrade your `devDependencies` on `ember-cli-babel` to `^7.26.6`' + ) + ); + }); + + QUnit.test('transient babel that is out of date', function (assert) { + project.pkg.devDependencies = { + 'ember-cli-babel': '^7.26.0', + }; + + let otherAddon = { + name: 'other-thing-here', + parent: project, + pkg: { + dependencies: { + 'ember-cli-babel': '^7.25.0', + }, + }, + addons: [], + }; + + otherAddon.addons.push(buildBabel(otherAddon, '7.26.5')); + project.addons.push(buildBabel(project, '7.26.6'), otherAddon); + + let result = globalDeprecationInfo(project, env); + assert.strictEqual(result.shouldIssueSingleDeprecation, true); + assert.strictEqual(result.hasActionableSuggestions, true); + assert.ok(result.globalMessage.includes('* [email protected] (Compatible)')); + }); +});
true
Other
emberjs
ember.js
42bd258a026fb6652ae7cb991b01c9738d2ab032.json
Add v3.28.0-beta.3 to CHANGELOG
CHANGELOG.md
@@ -1,5 +1,10 @@ # Ember Changelog +### v3.28.0-beta.3 (June 1, 2021) + +- [#19565](https://github.com/emberjs/ember.js/pull/19565) [BUGFIX] Ensures that computed can depend on dynamic hash keys +- [#19571](https://github.com/emberjs/ember.js/pull/19571) [BUGFIX] Delay until: 5.0.0 the removal of the deprecated transition methods of controller and route from [RFC #674](https://github.com/emberjs/rfcs/blob/master/text/0674-deprecate-transition-methods-of-controller-and-route.md). + ### v3.28.0-beta.2 (May 27, 2021) - [#19511](https://github.com/emberjs/ember.js/pull/19511) / [#19548](https://github.com/emberjs/ember.js/pull/19548) [BUGFIX] Makes the (hash) helper lazy
false
Other
emberjs
ember.js
926452f531fb70eddea0fe85ff73843603d39de7.json
Extend transition deprecation
packages/@ember/-internals/routing/lib/utils.ts
@@ -254,7 +254,7 @@ export function deprecateTransitionMethods(frameworkClass: string, methodName: s since: { enabled: '3.26.0', }, - until: '4.0.0', + until: '5.0.0', url: 'https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods', } );
false
Other
emberjs
ember.js
8cc453f21d243b37137e092087620db8e0a21e3d.json
Use latest Safari in BrowserStack tests
testem.browserstack.js
@@ -7,7 +7,7 @@ const BrowserStackLaunchers = { '--os', 'OS X', '--osv', - 'Mojave', + 'Big Sur', '--b', 'safari', '--bv',
false
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
.github/workflows/ci.yml
@@ -65,7 +65,7 @@ jobs: run: yarn test browserstack-test: - name: Browserstack Tests (Safari, Edge, IE11) + name: Browserstack Tests (Safari, Edge) runs-on: ubuntu-latest needs: [basic-test, lint] steps:
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
config/browserlists.js
@@ -3,7 +3,6 @@ const allSupportedBrowsers = [ 'last 2 Firefox versions', 'last 2 Safari versions', 'last 2 Edge versions', - 'ie 11', ]; const modernBrowsers = [
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
lib/index.js
@@ -294,12 +294,6 @@ module.exports = { let targets = (this.project && this.project.targets && this.project.targets.browsers) || []; let targetNode = (this.project && this.project.targets && this.project.targets.node) || false; - if (targets.includes('ie 11')) { - this.ui.writeWarnLine( - 'Internet Explorer 11 is listed in your compilation targets, but it will no longer be supported in the next major version of Ember. Please update your targets to remove IE 11 and include new targets that are within the updated support policy. For details on the new browser support policy, see:\n\n - The official documentation: http://emberjs.com/browser-support\n - the deprecation guide: https://deprecations.emberjs.com/v3.x#toc_3-0-browser-support-policy\n' - ); - } - const isProduction = process.env.EMBER_ENV === 'production'; if (
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/@ember/-internals/glimmer/lib/modifiers/on.ts
@@ -2,19 +2,6 @@ @module ember */ -/* - Internet Explorer 11 does not support `once` and also does not support - passing `eventOptions`. In some situations it then throws a weird script - error, like: - - ``` - Could not complete the operation due to error 80020101 - ``` - - This flag determines, whether `{ once: true }` and thus also event options in - general are supported. -*/ - /** The `{{on}}` modifier lets you easily add event listeners (it uses [EventTarget.addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/@ember/-internals/glimmer/tests/integration/helpers/element-action-test.js
@@ -32,8 +32,6 @@ function getActionIds(element) { ); } -const isIE11 = !window.ActiveXObject && 'ActiveXObject' in window; - if (EMBER_IMPROVED_INSTRUMENTATION) { moduleFor( 'Helpers test: element action instrumentation', @@ -1144,11 +1142,7 @@ moduleFor( .trigger('click', { [prop]: value })[0]; if (expected) { assert.ok(showCalled, `should call action with ${prop}:${value}`); - - // IE11 does not allow simulated events to have a valid `defaultPrevented` - if (!isIE11) { - assert.ok(event.defaultPrevented, 'should prevent default'); - } + assert.ok(event.defaultPrevented, 'should prevent default'); } else { assert.notOk(showCalled, `should not call action with ${prop}:${value}`); assert.notOk(event.defaultPrevented, 'should not prevent default'); @@ -1486,10 +1480,7 @@ moduleFor( event = this.$('a').trigger('click')[0]; }); - // IE11 does not allow simulated events to have a valid `defaultPrevented` - if (!isIE11) { - this.assert.equal(event.defaultPrevented, true, 'should preventDefault'); - } + this.assert.equal(event.defaultPrevented, true, 'should preventDefault'); } ['@test it should target the proper component when `action` is in yielded block [GH #12409]']() {
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/@ember/-internals/glimmer/tests/integration/modifiers/on-test.js
@@ -5,8 +5,6 @@ import { on } from '@glimmer/runtime'; import { Component } from '../../utils/helpers'; -const isIE11 = !window.ActiveXObject && 'ActiveXObject' in window; - moduleFor( '{{on}} Modifier', class extends RenderingTestCase { @@ -41,8 +39,6 @@ moduleFor( if (isChrome || isFirefox) { assert.strictEqual(SUPPORTS_EVENT_OPTIONS, true, 'is true in chrome and firefox'); - } else if (isIE11) { - assert.strictEqual(SUPPORTS_EVENT_OPTIONS, false, 'is false in IE11'); } else { assert.expect(0); } @@ -136,11 +132,7 @@ moduleFor( runTask(() => this.$('button').click()); assert.equal(count, 1, 'has been called 1 times'); - if (isIE11) { - this.assertCounts({ adds: 1, removes: 1 }); - } else { - this.assertCounts({ adds: 1, removes: 0 }); - } + this.assertCounts({ adds: 1, removes: 0 }); } '@test changing from `once=false` to `once=true` ensures the callback can only be called once'( @@ -169,11 +161,7 @@ moduleFor( runTask(() => this.$('button').click()); assert.equal(count, 3, 'is not called again'); - if (isIE11) { - this.assertCounts({ adds: 2, removes: 2 }); - } else { - this.assertCounts({ adds: 2, removes: 1 }); - } + this.assertCounts({ adds: 2, removes: 1 }); } '@test by default bubbling is used (capture: false)'(assert) {
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/@ember/-internals/utils/tests/inspect_test.js
@@ -36,12 +36,7 @@ moduleFor( return this; }, }; - // IE 11 doesn't have function name - if (obj.foo.name) { - assert.equal(inspect(obj), `{ foo: [Function:foo] }`); - } else { - assert.equal(inspect(obj), `{ foo: [Function] }`); - } + assert.equal(inspect(obj), `{ foo: [Function:foo] }`); } ['@test objects without a prototype'](assert) {
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/ember-testing/tests/helpers_test.js
@@ -1,4 +1,4 @@ -import { moduleFor, AutobootApplicationTestCase, isIE11, runTask } from 'internal-test-helpers'; +import { moduleFor, AutobootApplicationTestCase, runTask } from 'internal-test-helpers'; import { Route } from '@ember/-internals/routing'; import Controller from '@ember/controller'; @@ -343,20 +343,7 @@ if (!jQueryDisabled) { wrapper.addEventListener('mousedown', (e) => events.push(e.type)); wrapper.addEventListener('mouseup', (e) => events.push(e.type)); wrapper.addEventListener('click', (e) => events.push(e.type)); - wrapper.addEventListener('focusin', (e) => { - // IE11 _sometimes_ triggers focusin **twice** in a row - // (we believe this is when it is under higher load) - // - // the goal here is to only push a single focusin when running on - // IE11 - if (isIE11) { - if (events[events.length - 1] !== 'focusin') { - events.push(e.type); - } - } else { - events.push(e.type); - } - }); + wrapper.addEventListener('focusin', (e) => events.push(e.type)); }, }) );
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/ember/index.js
@@ -135,22 +135,6 @@ import { const Ember = {}; -import { isIE } from '@ember/-internals/browser-environment'; - -deprecate( - 'Internet Explorer 11 will no longer be supported in the next major version of Ember. For details on the new browser support policy, see the official documentation: http://emberjs.com/browser-support', - !isIE, - { - id: '3-0-browser-support-policy', - url: 'https://deprecations.emberjs.com/v3.x#toc_3-0-browser-support-policy', - until: '4.0.0', - for: 'ember-source', - since: { - enabled: '3.26.0', - }, - } -); - Ember.isNamespace = true; Ember.toString = function () { return 'Ember';
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/internal-test-helpers/index.js
@@ -38,5 +38,5 @@ export { ModuleBasedResolver as ModuleBasedTestResolver, } from './lib/test-resolver'; -export { isIE11, isEdge } from './lib/browser-detect'; +export { isEdge } from './lib/browser-detect'; export { verifyInjection, verifyRegistration } from './lib/registry-check';
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
packages/internal-test-helpers/lib/browser-detect.ts
@@ -1,11 +1 @@ -// `window.ActiveXObject` is "falsey" in IE11 (but not `undefined` or `false`) -// `"ActiveXObject" in window` returns `true` in all IE versions -// only IE11 will pass _both_ of these conditions - -declare global { - interface Window { - ActiveXObject: any; - } -} -export const isIE11 = !window.ActiveXObject && 'ActiveXObject' in window; export const isEdge = /Edge/.test(navigator.userAgent);
true
Other
emberjs
ember.js
0d68d64fb8407ff0b42215fa6ce988a0a8b539de.json
Remove IE11 support (deprecations + testing)
testem.browserstack.js
@@ -37,24 +37,6 @@ const BrowserStackLaunchers = { ], protocol: 'browser', }, - BS_IE_11: { - exe: 'node_modules/.bin/browserstack-launch', - args: [ - '--os', - 'Windows', - '--osv', - '10', - '--b', - 'ie', - '--bv', - '11.0', - '-t', - '1500', - '--u', - '<url>', - ], - protocol: 'browser', - }, }; module.exports = {
true
Other
emberjs
ember.js
455fdb2d8d3f3f7941169468c48fe19985aedc32.json
Add v3.28.0-beta.2 to CHANGELOG.md.
CHANGELOG.md
@@ -1,5 +1,16 @@ # Ember Changelog +### v3.28.0-beta.2 (May 27, 2021) + +- [#19511](https://github.com/emberjs/ember.js/pull/19511) / [#19548](https://github.com/emberjs/ember.js/pull/19548) [BUGFIX] Makes the (hash) helper lazy +- [#19530](https://github.com/emberjs/ember.js/pull/19530) [DOC] fix passing params to named blocks examples +- [#19536](https://github.com/emberjs/ember.js/pull/19536) [BUGFIX] Fix `computed.*` deprecation message to include the correct import path +- [#19544](https://github.com/emberjs/ember.js/pull/19544) [BUGFIX] Use explicit this in helper test blueprints +- [#19555](https://github.com/emberjs/ember.js/pull/19555) [BUGFIX] Improve class based tranform deprecation message +- [#19557](https://github.com/emberjs/ember.js/pull/19557) [BUGFIX] Refine Ember Global deprecation message +- [#19564](https://github.com/emberjs/ember.js/pull/19564) [BUGFIX] Improve computed.* and run.* deprecation message (IE11) +- [#19491](https://github.com/emberjs/ember.js/pull/19491) [BUGFIX] Fix `owner.lookup` `owner.register` behavior with `singleton: true` option + ### v3.28.0-beta.1 (May 3, 2021) - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs`
false
Other
emberjs
ember.js
d252b96f36d1faf2844df3776697467d0a6789f4.json
Add v3.27.2 to CHANGELOG.md.
CHANGELOG.md
@@ -4,6 +4,16 @@ - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs` +### v3.27.2 (May 27, 2021) + +- [#19511](https://github.com/emberjs/ember.js/pull/19511) / [#19548](https://github.com/emberjs/ember.js/pull/19548) [BUGFIX] Makes the (hash) helper lazy +- [#19530](https://github.com/emberjs/ember.js/pull/19530) [DOC] fix passing params to named blocks examples +- [#19536](https://github.com/emberjs/ember.js/pull/19536) [BUGFIX] Fix `computed.*` deprecation message to include the correct import path +- [#19544](https://github.com/emberjs/ember.js/pull/19544) [BUGFIX] Use explicit this in helper test blueprints +- [#19555](https://github.com/emberjs/ember.js/pull/19555) [BUGFIX] Improve class based tranform deprecation message +- [#19557](https://github.com/emberjs/ember.js/pull/19557) [BUGFIX] Refine Ember Global deprecation message +- [#19564](https://github.com/emberjs/ember.js/pull/19564) [BUGFIX] Improve computed.* and run.* deprecation message (IE11) + ### v3.27.1 (May 13, 2021) - [#19540](https://github.com/emberjs/ember.js/pull/19540) [BUGFIX] Ensure ember-testing is loaded lazily
false
Other
emberjs
ember.js
7985ddb9eedcd775ccd68981c8e2ce3c24cdd54b.json
Add test for @ember/object/compat types
packages/@ember/object/type-tests/compat.test.ts
@@ -0,0 +1,4 @@ +import { dependentKeyCompat } from '@ember/object/compat'; +import { expectTypeOf } from 'expect-type'; + +expectTypeOf(dependentKeyCompat).toMatchTypeOf<Function>();
false
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
package.json
@@ -125,6 +125,7 @@ "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-qunit": "^4.0.0", "execa": "^2.0.4", + "expect-type": "^0.11.0", "express": "^4.17.1", "finalhandler": "^1.1.2", "fs-extra": "^9.0.1", @@ -147,7 +148,8 @@ "simple-dom": "^1.4.0", "testem": "^3.1.0", "testem-failure-only-reporter": "^0.0.1", - "tslint": "^5.20.1" + "tslint": "^5.20.1", + "typescript": "^4.2.4" }, "engines": { "node": "10.* || >= 12.*"
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/glimmer/tests/integration/components/angle-bracket-invocation-test.js
@@ -550,10 +550,13 @@ moduleFor( } '@test positional parameters are not allowed'() { + let TestComponent = class extends Component {}; + TestComponent.reopenClass({ + positionalParams: ['first', 'second'], + }); + this.registerComponent('sample-component', { - ComponentClass: Component.extend().reopenClass({ - positionalParams: ['first', 'second'], - }), + ComponentClass: TestComponent, template: '{{this.first}}{{this.second}}', });
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/metal/lib/mixin.ts
@@ -273,7 +273,15 @@ function mergeMixins( } } } else { - mergeProps(meta, currentMixin, descs, values, base, keys, keysWithSuper); + mergeProps( + meta, + currentMixin as { [key: string]: any }, + descs, + values, + base, + keys, + keysWithSuper + ); } } }
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/routing/lib/location/api.ts
@@ -10,6 +10,7 @@ export interface EmberLocation { formatURL(url: string): string; detect?(): void; initState?(): void; + destroy(): void; } export type UpdateCallback = (url: string) => void;
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/routing/lib/location/auto_location.ts
@@ -62,13 +62,94 @@ import { @protected */ export default class AutoLocation extends EmberObject implements EmberLocation { - cancelRouterSetup?: boolean | undefined; getURL!: () => string; setURL!: (url: string) => void; onUpdateURL!: (callback: UpdateCallback) => void; formatURL!: (url: string) => string; + concreteImplementation?: EmberLocation; + implementation = 'auto'; + + // FIXME: This is never set + // See https://github.com/emberjs/ember.js/issues/19515 + documentMode: number | undefined; + + /** + @private + + Will be pre-pended to path upon state change. + + @since 1.5.1 + @property rootURL + @default '/' + */ + // Added in reopen to allow overriding via extend + rootURL!: string; + + /** + @private + + The browser's `location` object. This is typically equivalent to + `window.location`, but may be overridden for testing. + + @property location + @default environment.location + */ + // Added in reopen to allow overriding via extend + location!: any; + + /** + @private + + The browser's `history` object. This is typically equivalent to + `window.history`, but may be overridden for testing. + + @since 1.5.1 + @property history + @default environment.history + */ + // Added in reopen to allow overriding via extend + history!: any; + + /** + @private + + The user agent's global variable. In browsers, this will be `window`. + + @since 1.11 + @property global + @default window + */ + // Added in reopen to allow overriding via extend + global!: any; + + /** + @private + + The browser's `userAgent`. This is typically equivalent to + `navigator.userAgent`, but may be overridden for testing. + + @since 1.5.1 + @property userAgent + @default environment.history + */ + // Added in reopen to allow overriding via extend + userAgent!: any; + + /** + @private + + This property is used by the router to know whether to cancel the routing + setup process, which is needed while we redirect the browser. + + @since 1.5.1 + @property cancelRouterSetup + @default false + */ + // Added in reopen to allow overriding via extend + cancelRouterSetup!: boolean | undefined; + /** Called by the router to instruct the location to do any feature detection necessary. In the case of AutoLocation, we detect whether to use history @@ -115,79 +196,23 @@ export default class AutoLocation extends EmberObject implements EmberLocation { } AutoLocation.reopen({ - /** - @private - - Will be pre-pended to path upon state change. - - @since 1.5.1 - @property rootURL - @default '/' - */ rootURL: '/', + initState: delegateToConcreteImplementation('initState'), getURL: delegateToConcreteImplementation('getURL'), setURL: delegateToConcreteImplementation('setURL'), replaceURL: delegateToConcreteImplementation('replaceURL'), onUpdateURL: delegateToConcreteImplementation('onUpdateURL'), formatURL: delegateToConcreteImplementation('formatURL'), - /** - @private - - The browser's `location` object. This is typically equivalent to - `window.location`, but may be overridden for testing. - - @property location - @default environment.location - */ location: location, - /** - @private - - The browser's `history` object. This is typically equivalent to - `window.history`, but may be overridden for testing. - - @since 1.5.1 - @property history - @default environment.history - */ history: history, - /** - @private - - The user agent's global variable. In browsers, this will be `window`. - - @since 1.11 - @property global - @default window - */ global: window, - /** - @private - - The browser's `userAgent`. This is typically equivalent to - `navigator.userAgent`, but may be overridden for testing. - - @since 1.5.1 - @property userAgent - @default environment.history - */ userAgent: userAgent, - /** - @private - - This property is used by the router to know whether to cancel the routing - setup process, which is needed while we redirect the browser. - - @since 1.5.1 - @property cancelRouterSetup - @default false - */ cancelRouterSetup: false, }); @@ -196,7 +221,7 @@ function delegateToConcreteImplementation(methodName: string) { let { concreteImplementation } = this; assert( "AutoLocation's detect() method should be called before calling any other hooks.", - Boolean(concreteImplementation) + concreteImplementation ); return concreteImplementation[methodName]?.(...args); };
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/routing/lib/location/hash_location.ts
@@ -40,6 +40,9 @@ export default class HashLocation extends EmberObject implements EmberLocation { implementation = 'hash'; _hashchangeHandler?: EventListener; + private _location?: any; + declare location: any; + init(): void { set(this, 'location', this._location || window.location); this._hashchangeHandler = undefined; @@ -114,6 +117,8 @@ export default class HashLocation extends EmberObject implements EmberLocation { set(this, 'lastSetURL', path); } + lastSetURL: string | null = null; + /** Register a callback to be invoked when the hash changes. These callbacks will execute when the user presses the back or forward
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/routing/lib/location/history_location.ts
@@ -59,6 +59,11 @@ function _uuid() { @protected */ export default class HistoryLocation extends EmberObject implements EmberLocation { + location!: any; + baseURL!: string; + + history?: any; + implementation = 'history'; _previousURL?: string; _popstateHandler?: EventListener; @@ -86,9 +91,9 @@ export default class HistoryLocation extends EmberObject implements EmberLocatio this._super(...arguments); let base = document.querySelector('base'); - let baseURL: string | null = ''; + let baseURL = ''; if (base !== null && base.hasAttribute('href')) { - baseURL = base.getAttribute('href'); + baseURL = base.getAttribute('href') ?? ''; } set(this, 'baseURL', baseURL);
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/routing/lib/location/none_location.ts
@@ -25,6 +25,19 @@ export default class NoneLocation extends EmberObject implements EmberLocation { updateCallback!: UpdateCallback; implementation = 'none'; + // Set in reopen so it can be overwritten with extend + path!: string; + + /** + Will be pre-pended to path. + + @private + @property rootURL + @default '/' + */ + // Set in reopen so it can be overwritten with extend + rootURL!: string; + detect(): void { let { rootURL } = this; @@ -114,13 +127,5 @@ export default class NoneLocation extends EmberObject implements EmberLocation { NoneLocation.reopen({ path: '', - - /** - Will be pre-pended to path. - - @private - @property rootURL - @default '/' - */ rootURL: '/', });
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/routing/lib/system/route.ts
@@ -96,19 +96,20 @@ export function hasDefaultSerialize(route: Route): boolean { @public */ -class Route extends EmberObject implements IRoute { +class Route extends EmberObject.extend(ActionHandler, Evented) implements IRoute, Evented { static isRouteFactory = true; - routeName!: string; - fullRouteName!: string; context: {} = {}; - controller!: Controller; currentModel: unknown; _bucketCache!: BucketCache; _internalName!: string; - _names: unknown; + + private _names: unknown; + _router!: EmberRouter; + _topLevelViewTemplate!: any; + _environment!: any; constructor(owner: Owner) { super(...arguments); @@ -129,6 +130,13 @@ class Route extends EmberObject implements IRoute { } } + // Implement Evented + on!: (name: string, method: ((...args: any[]) => void) | string) => this; + one!: (name: string, method: string | ((...args: any[]) => void)) => this; + trigger!: (name: string, ...args: any[]) => any; + off!: (name: string, method: string | ((...args: any[]) => void)) => this; + has!: (name: string) => boolean; + serialize!: ( model: {}, params: string[] @@ -138,6 +146,139 @@ class Route extends EmberObject implements IRoute { } | undefined; + /** + Configuration hash for this route's queryParams. The possible + configuration options and their defaults are as follows + (assuming a query param whose controller property is `page`): + + ```javascript + queryParams: { + page: { + // By default, controller query param properties don't + // cause a full transition when they are changed, but + // rather only cause the URL to update. Setting + // `refreshModel` to true will cause an "in-place" + // transition to occur, whereby the model hooks for + // this route (and any child routes) will re-fire, allowing + // you to reload models (e.g., from the server) using the + // updated query param values. + refreshModel: false, + + // By default, changes to controller query param properties + // cause the URL to update via `pushState`, which means an + // item will be added to the browser's history, allowing + // you to use the back button to restore the app to the + // previous state before the query param property was changed. + // Setting `replace` to true will use `replaceState` (or its + // hash location equivalent), which causes no browser history + // item to be added. This options name and default value are + // the same as the `link-to` helper's `replace` option. + replace: false, + + // By default, the query param URL key is the same name as + // the controller property name. Use `as` to specify a + // different URL key. + as: 'page' + } + } + ``` + + @property queryParams + @for Route + @type Object + @since 1.6.0 + @public + */ + // Set in reopen so it can be overriden with extend + queryParams!: any; + + /** + The name of the template to use by default when rendering this routes + template. + + ```app/routes/posts/list.js + import Route from '@ember/routing/route'; + + export default class extends Route { + templateName = 'posts/list' + }); + ``` + + ```app/routes/posts/index.js + import PostsList from '../posts/list'; + + export default class extends PostsList {}; + ``` + + ```app/routes/posts/archived.js + import PostsList from '../posts/list'; + + export default class extends PostsList {}; + ``` + + @property templateName + @type String + @default null + @since 1.4.0 + @public + */ + // Set in reopen so it can be overriden with extend + templateName!: string | null; + + /** + The name of the controller to associate with this route. + + By default, Ember will lookup a route's controller that matches the name + of the route (i.e. `posts.new`). However, + if you would like to define a specific controller to use, you can do so + using this property. + + This is useful in many ways, as the controller specified will be: + + * passed to the `setupController` method. + * used as the controller for the template being rendered by the route. + * returned from a call to `controllerFor` for the route. + + @property controllerName + @type String + @default null + @since 1.4.0 + @public + */ + // Set in reopen so it can be overriden with extend + controllerName!: string | null; + + /** + The controller associated with this route. + + Example + + ```app/routes/form.js + import Route from '@ember/routing/route'; + import { action } from '@ember/object'; + + export default class FormRoute extends Route { + @action + willTransition(transition) { + if (this.controller.get('userHasEnteredData') && + !confirm('Are you sure you want to abandon progress?')) { + transition.abort(); + } else { + // Bubble the `willTransition` action so that + // parent routes can decide whether or not to abort. + return true; + } + } + } + ``` + + @property controller + @type Controller + @since 1.6.0 + @public + */ + controller!: Controller; + /** The name of the route, dot-delimited. @@ -150,6 +291,7 @@ class Route extends EmberObject implements IRoute { @since 1.0.0 @public */ + routeName!: string; /** The name of the route, dot-delimited, including the engine prefix @@ -164,6 +306,7 @@ class Route extends EmberObject implements IRoute { @since 2.10.0 @public */ + fullRouteName!: string; /** Sets the name for this route, including a fully resolved name for routes @@ -1879,11 +2022,7 @@ class Route extends EmberObject implements IRoute { */ buildRouteInfoMetadata() {} - /** - * @method _paramsFor - * @private - */ - _paramsFor(routeName: string, params: {}) { + private _paramsFor(routeName: string, params: {}) { let transition = this._router._routerMicrolib.activeTransition; if (transition !== undefined) { return this.paramsFor(routeName); @@ -1892,7 +2031,6 @@ class Route extends EmberObject implements IRoute { return params; } - /** Store property provides a hook for data persistence libraries to inject themselves. @@ -1930,10 +2068,7 @@ class Route extends EmberObject implements IRoute { modelClass = modelClass.class; - assert( - `${classify(name)} has no method \`find\`.`, - typeof modelClass.find === 'function' - ); + assert(`${classify(name)} has no method \`find\`.`, typeof modelClass.find === 'function'); return modelClass.find(value); }, @@ -2070,6 +2205,60 @@ class Route extends EmberObject implements IRoute { }, }; } + + // Set in reopen + actions!: Record<string, Function>; + + /** + Sends an action to the router, which will delegate it to the currently + active route hierarchy per the bubbling rules explained under `actions`. + + Example + + ```app/router.js + // ... + + Router.map(function() { + this.route('index'); + }); + + export default Router; + ``` + + ```app/routes/application.js + import Route from '@ember/routing/route'; + import { action } from '@ember/object'; + + export default class ApplicationRoute extends Route { + @action + track(arg) { + console.log(arg, 'was clicked'); + } + } + ``` + + ```app/routes/index.js + import Route from '@ember/routing/route'; + import { action } from '@ember/object'; + + export default class IndexRoute extends Route { + @action + trackIfDebug(arg) { + if (debug) { + this.send('track', arg); + } + } + } + ``` + + @method send + @param {String} name the name of the action to trigger + @param {...*} args + @since 1.0.0 + @public + */ + // Set with reopen to override parent behavior + send!: (name: string, ...args: any[]) => unknown; } function parentRoute(route: Route) { @@ -2133,7 +2322,7 @@ function buildRenderOptions( name = route.routeName; templateName = route.templateName || name; } else { - name = _name.replace(/\//g, '.'); + name = _name!.replace(/\//g, '.'); templateName = name; } @@ -2387,156 +2576,13 @@ function getEngineRouteName(engine: Owner, routeName: string) { */ Route.prototype.serialize = defaultSerialize; -Route.reopen(ActionHandler, Evented, { +// Set these here so they can be overridden with extend +Route.reopen({ mergedProperties: ['queryParams'], - - /** - Configuration hash for this route's queryParams. The possible - configuration options and their defaults are as follows - (assuming a query param whose controller property is `page`): - - ```javascript - queryParams: { - page: { - // By default, controller query param properties don't - // cause a full transition when they are changed, but - // rather only cause the URL to update. Setting - // `refreshModel` to true will cause an "in-place" - // transition to occur, whereby the model hooks for - // this route (and any child routes) will re-fire, allowing - // you to reload models (e.g., from the server) using the - // updated query param values. - refreshModel: false, - - // By default, changes to controller query param properties - // cause the URL to update via `pushState`, which means an - // item will be added to the browser's history, allowing - // you to use the back button to restore the app to the - // previous state before the query param property was changed. - // Setting `replace` to true will use `replaceState` (or its - // hash location equivalent), which causes no browser history - // item to be added. This options name and default value are - // the same as the `link-to` helper's `replace` option. - replace: false, - - // By default, the query param URL key is the same name as - // the controller property name. Use `as` to specify a - // different URL key. - as: 'page' - } - } - ``` - - @property queryParams - @for Route - @type Object - @since 1.6.0 - @public - */ queryParams: {}, - - /** - The name of the template to use by default when rendering this routes - template. - - ```app/routes/posts/list.js - import Route from '@ember/routing/route'; - - export default class extends Route { - templateName = 'posts/list' - }); - ``` - - ```app/routes/posts/index.js - import PostsList from '../posts/list'; - - export default class extends PostsList {}; - ``` - - ```app/routes/posts/archived.js - import PostsList from '../posts/list'; - - export default class extends PostsList {}; - ``` - - @property templateName - @type String - @default null - @since 1.4.0 - @public - */ templateName: null, - - /** - The name of the controller to associate with this route. - - By default, Ember will lookup a route's controller that matches the name - of the route (i.e. `posts.new`). However, - if you would like to define a specific controller to use, you can do so - using this property. - - This is useful in many ways, as the controller specified will be: - - * passed to the `setupController` method. - * used as the controller for the template being rendered by the route. - * returned from a call to `controllerFor` for the route. - - @property controllerName - @type String - @default null - @since 1.4.0 - @public - */ controllerName: null, - /** - Sends an action to the router, which will delegate it to the currently - active route hierarchy per the bubbling rules explained under `actions`. - - Example - - ```app/router.js - // ... - - Router.map(function() { - this.route('index'); - }); - - export default Router; - ``` - - ```app/routes/application.js - import Route from '@ember/routing/route'; - import { action } from '@ember/object'; - - export default class ApplicationRoute extends Route { - @action - track(arg) { - console.log(arg, 'was clicked'); - } - } - ``` - - ```app/routes/index.js - import Route from '@ember/routing/route'; - import { action } from '@ember/object'; - - export default class IndexRoute extends Route { - @action - trackIfDebug(arg) { - if (debug) { - this.send('track', arg); - } - } - } - ``` - - @method send - @param {String} name the name of the action to trigger - @param {...*} args - @since 1.0.0 - @public - */ send(...args: any[]) { assert( `Attempted to call .send() with the action '${args[0]}' on the destroyed route '${this.routeName}'.`,
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/routing/lib/system/router.ts
@@ -53,6 +53,7 @@ function defaultDidTransition(this: EmberRouter, infos: PrivateRouteInfo[]) { once(this, this.trigger, 'didTransition'); if (DEBUG) { + // @ts-expect-error namespace isn't public if (this.namespace.LOG_TRANSITIONS) { // eslint-disable-next-line no-console console.log(`Transitioned into '${EmberRouter._routePath(infos)}'`); @@ -69,6 +70,7 @@ function defaultWillTransition( once(this, this.trigger, 'willTransition', transition); if (DEBUG) { + // @ts-expect-error namespace isn't public if (this.namespace.LOG_TRANSITIONS) { // eslint-disable-next-line no-console console.log( @@ -140,9 +142,39 @@ const { slice } = Array.prototype; @uses Evented @public */ -class EmberRouter extends EmberObject { - location!: string | IEmberLocation; +class EmberRouter extends EmberObject.extend(Evented) implements Evented { + /** + Represents the URL of the root of the application, often '/'. This prefix is + assumed on all routes defined on this router. + + @property rootURL + @default '/' + @public + */ + // Set with reopen to allow overriding via extend rootURL!: string; + + /** + The `location` property determines the type of URL's that your + application will use. + + The following location types are currently available: + + * `history` - use the browser's history API to make the URLs look just like any standard URL + * `hash` - use `#` to separate the server part of the URL from the Ember part: `/blog/#/posts/new` + * `none` - do not store the Ember URL in the actual browser URL (mainly used for testing) + * `auto` - use the best option based on browser capabilities: `history` if possible, then `hash` if possible, otherwise `none` + + This value is defaulted to `auto` by the `locationType` setting of `/config/environment.js` + + @property location + @default 'hash' + @see {Location} + @public + */ + // Set with reopen to allow overriding via extend + location!: string | IEmberLocation; + _routerMicrolib!: Router<Route>; _didSetupRouter = false; _initialTransitionStarted = false; @@ -165,6 +197,104 @@ class EmberRouter extends EmberObject { _slowTransitionTimer: unknown; + private namespace: any; + + // Begin Evented + on!: (name: string, method: ((...args: any[]) => void) | string) => this; + one!: (name: string, method: string | ((...args: any[]) => void)) => this; + trigger!: (name: string, ...args: any[]) => any; + off!: (name: string, method: string | ((...args: any[]) => void)) => this; + has!: (name: string) => boolean; + // End Evented + + // Set with reopenClass + private static dslCallbacks?: MatchCallback[]; + + /** + The `Router.map` function allows you to define mappings from URLs to routes + in your application. These mappings are defined within the + supplied callback function using `this.route`. + + The first parameter is the name of the route which is used by default as the + path name as well. + + The second parameter is the optional options hash. Available options are: + + * `path`: allows you to provide your own path as well as mark dynamic + segments. + * `resetNamespace`: false by default; when nesting routes, ember will + combine the route names to form the fully-qualified route name, which is + used with `{{link-to}}` or manually transitioning to routes. Setting + `resetNamespace: true` will cause the route not to inherit from its + parent route's names. This is handy for preventing extremely long route names. + Keep in mind that the actual URL path behavior is still retained. + + The third parameter is a function, which can be used to nest routes. + Nested routes, by default, will have the parent route tree's route name and + path prepended to it's own. + + ```app/router.js + Router.map(function(){ + this.route('post', { path: '/post/:post_id' }, function() { + this.route('edit'); + this.route('comments', { resetNamespace: true }, function() { + this.route('new'); + }); + }); + }); + ``` + + @method map + @param callback + @public + */ + static map(callback: MatchCallback) { + if (!this.dslCallbacks) { + this.dslCallbacks = []; + // FIXME: Can we remove this? + this.reopenClass({ dslCallbacks: this.dslCallbacks }); + } + + this.dslCallbacks.push(callback); + + return this; + } + + static _routePath(routeInfos: PrivateRouteInfo[]) { + let path: string[] = []; + + // We have to handle coalescing resource names that + // are prefixed with their parent's names, e.g. + // ['foo', 'foo.bar.baz'] => 'foo.bar.baz', not 'foo.foo.bar.baz' + + function intersectionMatches(a1: string[], a2: string[]) { + for (let i = 0; i < a1.length; ++i) { + if (a1[i] !== a2[i]) { + return false; + } + } + return true; + } + + let name, nameParts, oldNameParts; + for (let i = 1; i < routeInfos.length; i++) { + name = routeInfos[i].name; + nameParts = name.split('.'); + oldNameParts = slice.call(path); + + while (oldNameParts.length) { + if (intersectionMatches(oldNameParts, nameParts)) { + break; + } + oldNameParts.shift(); + } + + path.push(...nameParts.slice(oldNameParts.length)); + } + + return path.join('.'); + } + constructor(owner: Owner) { super(...arguments); @@ -180,7 +310,7 @@ class EmberRouter extends EmberObject { this._routerService = routerService; } - _initRouterJs() { + _initRouterJs(): void { let location = get(this, 'location'); let router = this; let owner = getOwner(this); @@ -204,7 +334,8 @@ class EmberRouter extends EmberObject { let route = routeOwner.lookup<Route>(fullRouteName); if (seen[name]) { - return route!; + assert('seen routes should exist', route); + return route; } seen[name] = true; @@ -589,6 +720,7 @@ class EmberRouter extends EmberObject { let infos = this._routerMicrolib.currentRouteInfos; if (this.namespace.LOG_TRANSITIONS) { // eslint-disable-next-line no-console + assert('expected infos to be set', infos); console.log(`Intermediate-transitioned into '${EmberRouter._routePath(infos)}'`); } } @@ -600,7 +732,8 @@ class EmberRouter extends EmberObject { generate(name: string, ...args: any[]) { let url = this._routerMicrolib.generate(name, ...args); - return (this.location as IEmberLocation).formatURL(url); + assert('expected non-string location', typeof this.location !== 'string'); + return this.location.formatURL(url); } /** @@ -1239,6 +1372,66 @@ class EmberRouter extends EmberObject { return engineInstance; } + + /** + Handles updating the paths and notifying any listeners of the URL + change. + + Triggers the router level `didTransition` hook. + + For example, to notify google analytics when the route changes, + you could use this hook. (Note: requires also including GA scripts, etc.) + + ```javascript + import config from './config/environment'; + import EmberRouter from '@ember/routing/router'; + import { inject as service } from '@ember/service'; + + let Router = EmberRouter.extend({ + location: config.locationType, + + router: service(), + + didTransition: function() { + this._super(...arguments); + + ga('send', 'pageview', { + page: this.router.currentURL, + title: this.router.currentRouteName, + }); + } + }); + ``` + + @method didTransition + @public + @since 1.2.0 + */ + // Set with reopen to allow overriding via extend + didTransition!: typeof defaultDidTransition; + + /** + Handles notifying any listeners of an impending URL + change. + + Triggers the router level `willTransition` hook. + + @method willTransition + @public + @since 1.11.0 + */ + // Set with reopen to allow overriding via extend + willTransition!: typeof defaultWillTransition; + + /** + Represents the current URL. + + @property url + @type {String} + @private + */ + // Set with reopen to allow overriding via extend + url!: string; } /* @@ -1527,7 +1720,9 @@ function updatePaths(router: EmberRouter) { let path = EmberRouter._routePath(infos); let currentRouteName = infos[infos.length - 1].name; - let currentURL = router.get('location').getURL(); + let location = router.location; + assert('expected location to not be a string', typeof location !== 'string'); + let currentURL = location.getURL(); set(router, 'currentPath', path); set(router, 'currentRouteName', currentRouteName); @@ -1590,92 +1785,6 @@ function updatePaths(router: EmberRouter) { } } -EmberRouter.reopenClass({ - /** - The `Router.map` function allows you to define mappings from URLs to routes - in your application. These mappings are defined within the - supplied callback function using `this.route`. - - The first parameter is the name of the route which is used by default as the - path name as well. - - The second parameter is the optional options hash. Available options are: - - * `path`: allows you to provide your own path as well as mark dynamic - segments. - * `resetNamespace`: false by default; when nesting routes, ember will - combine the route names to form the fully-qualified route name, which is - used with `{{link-to}}` or manually transitioning to routes. Setting - `resetNamespace: true` will cause the route not to inherit from its - parent route's names. This is handy for preventing extremely long route names. - Keep in mind that the actual URL path behavior is still retained. - - The third parameter is a function, which can be used to nest routes. - Nested routes, by default, will have the parent route tree's route name and - path prepended to it's own. - - ```app/router.js - Router.map(function(){ - this.route('post', { path: '/post/:post_id' }, function() { - this.route('edit'); - this.route('comments', { resetNamespace: true }, function() { - this.route('new'); - }); - }); - }); - ``` - - @method map - @param callback - @public - */ - map(callback: MatchCallback) { - if (!this.dslCallbacks) { - this.dslCallbacks = []; - this.reopenClass({ dslCallbacks: this.dslCallbacks }); - } - - this.dslCallbacks.push(callback); - - return this; - }, - - _routePath(routeInfos: PrivateRouteInfo[]) { - let path: string[] = []; - - // We have to handle coalescing resource names that - // are prefixed with their parent's names, e.g. - // ['foo', 'foo.bar.baz'] => 'foo.bar.baz', not 'foo.foo.bar.baz' - - function intersectionMatches(a1: string[], a2: string[]) { - for (let i = 0; i < a1.length; ++i) { - if (a1[i] !== a2[i]) { - return false; - } - } - return true; - } - - let name, nameParts, oldNameParts; - for (let i = 1; i < routeInfos.length; i++) { - name = routeInfos[i].name; - nameParts = name.split('.'); - oldNameParts = slice.call(path); - - while (oldNameParts.length) { - if (intersectionMatches(oldNameParts, nameParts)) { - break; - } - oldNameParts.shift(); - } - - path.push(...nameParts.slice(oldNameParts.length)); - } - - return path.join('.'); - }, -}); - function didBeginTransition(transition: Transition, router: EmberRouter) { let routerState = new RouterState(router, router._routerMicrolib, transition[STATE_SYMBOL]!); @@ -1786,91 +1895,13 @@ function representEmptyRoute( } } -EmberRouter.reopen(Evented, { - /** - Handles updating the paths and notifying any listeners of the URL - change. - - Triggers the router level `didTransition` hook. - - For example, to notify google analytics when the route changes, - you could use this hook. (Note: requires also including GA scripts, etc.) - - ```javascript - import config from './config/environment'; - import EmberRouter from '@ember/routing/router'; - import { inject as service } from '@ember/service'; - - let Router = EmberRouter.extend({ - location: config.locationType, - - router: service(), - - didTransition: function() { - this._super(...arguments); - - ga('send', 'pageview', { - page: this.router.currentURL, - title: this.router.currentRouteName, - }); - } - }); - ``` - - @method didTransition - @public - @since 1.2.0 - */ +EmberRouter.reopen({ didTransition: defaultDidTransition, - - /** - Handles notifying any listeners of an impending URL - change. - - Triggers the router level `willTransition` hook. - - @method willTransition - @public - @since 1.11.0 - */ willTransition: defaultWillTransition, - /** - Represents the URL of the root of the application, often '/'. This prefix is - assumed on all routes defined on this router. - - @property rootURL - @default '/' - @public - */ rootURL: '/', - - /** - The `location` property determines the type of URL's that your - application will use. - - The following location types are currently available: - - * `history` - use the browser's history API to make the URLs look just like any standard URL - * `hash` - use `#` to separate the server part of the URL from the Ember part: `/blog/#/posts/new` - * `none` - do not store the Ember URL in the actual browser URL (mainly used for testing) - * `auto` - use the best option based on browser capabilities: `history` if possible, then `hash` if possible, otherwise `none` - - This value is defaulted to `auto` by the `locationType` setting of `/config/environment.js` - - @property location - @default 'hash' - @see {Location} - @public - */ location: 'hash', - /** - Represents the current URL. - - @property url - @type {String} - @private - */ + // FIXME: Does this need to be overrideable via extend? url: computed(function (this: Router<Route>) { let location = get(this, 'location');
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/runtime/index.d.ts
@@ -1,3 +1,8 @@ +import { EmberClassConstructor, Objectify, ObserverMethod } from './types/-private/types'; +import PublicCoreObject from './types/core'; +import Evented from './types/evented'; +import Observable from './types/observable'; + export const TargetActionSupport: any; export function isArray(arr: any): boolean; export const ControllerMixin: any; @@ -10,13 +15,50 @@ export function deprecatingAlias( } ): any; -export const CoreObject: any; +// The public version doesn't export some deprecated methods. +// However, these are still used internally. Returning `any` is +// very loose, but it's essentially what was here before. +export class CoreObject extends PublicCoreObject { + static extend<Statics, Instance>( + this: Statics & EmberClassConstructor<Instance>, + ...args: any[] + ): Objectify<Statics> & EmberClassConstructor<Instance>; + static reopen(...args: any[]): any; + static reopenClass(...args: any[]): any; +} + export const FrameworkObject: any; -export const Object: any; + +export class Object extends CoreObject implements Observable { + get<K extends keyof this>(key: K): unknown; + getProperties<K extends keyof this>(list: K[]): Record<K, unknown>; + getProperties<K extends keyof this>(...list: K[]): Record<K, unknown>; + set<K extends keyof this>(key: K, value: this[K]): this[K]; + set<T>(key: keyof this, value: T): T; + setProperties<K extends keyof this>(hash: Pick<this, K>): Record<K, unknown>; + setProperties<K extends keyof this>( + // tslint:disable-next-line:unified-signatures + hash: { [KK in K]: any } + ): Record<K, unknown>; + notifyPropertyChange(keyName: string): this; + addObserver<Target>(key: keyof this, target: Target, method: ObserverMethod<Target, this>): this; + addObserver(key: keyof this, method: ObserverMethod<this, this>): this; + removeObserver<Target>( + key: keyof this, + target: Target, + method: ObserverMethod<Target, this> + ): this; + removeObserver(key: keyof this, method: ObserverMethod<this, this>): this; + getWithDefault<K extends keyof this>(key: K, defaultValue: any): unknown; + incrementProperty(keyName: keyof this, increment?: number): number; + decrementProperty(keyName: keyof this, decrement?: number): number; + toggleProperty(keyName: keyof this): boolean; + cacheFor<K extends keyof this>(key: K): unknown; +} export function _contentFor(proxy: any): any; export const A: any; export const ActionHandler: any; -export const Evented: any; +export { Evented }; export function typeOf(obj: any): string;
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/runtime/type-tests/core.test.ts
@@ -0,0 +1,25 @@ +import { expectTypeOf } from 'expect-type'; +import CoreObject from '../types/core'; + +/** Newable tests */ +const co1 = new CoreObject(); + +expectTypeOf(co1.concatenatedProperties).toEqualTypeOf<string[]>(); +expectTypeOf(co1.isDestroyed).toEqualTypeOf<boolean>(); +expectTypeOf(co1.isDestroying).toEqualTypeOf<boolean>(); +expectTypeOf(co1.destroy()).toEqualTypeOf<CoreObject>(); +expectTypeOf(co1.toString()).toEqualTypeOf<string>(); + +/** .create tests */ +const co2 = CoreObject.create(); +expectTypeOf(co2.concatenatedProperties).toEqualTypeOf<string[]>(); +expectTypeOf(co2.isDestroyed).toEqualTypeOf<boolean>(); +expectTypeOf(co2.isDestroying).toEqualTypeOf<boolean>(); +expectTypeOf(co2.destroy()).toEqualTypeOf<CoreObject>(); +expectTypeOf(co2.toString()).toEqualTypeOf<string>(); + +/** .create tests w/ initial instance data passed in */ +const co3 = CoreObject.create({ foo: '123', bar: 456 }); + +expectTypeOf(co3.foo).toEqualTypeOf<string>(); +expectTypeOf(co3.bar).toEqualTypeOf<number>();
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/runtime/types/-private/types.d.ts
@@ -0,0 +1,41 @@ +/** + * Map type `T` to a plain object hash with the identity mapping. + * + * Discards any additional object identity like the ability to `new()` up the class. + * The `new()` capability is added back later by merging `EmberClassConstructor<T>` + * + * Implementation is carefully chosen for the reasons described in + * https://github.com/typed-ember/ember-typings/pull/29 + */ +export type Objectify<T> = Readonly<T>; + +export type ExtractPropertyNamesOfType<T, S> = { + [K in keyof T]: T[K] extends S ? K : never; +}[keyof T]; + +/** + * Used to infer the type of ember classes of type `T`. + * + * Generally you would use `EmberClass.create()` instead of `new EmberClass()`. + * + * The single-arg constructor is required by the typescript compiler. + * The multi-arg constructor is included for better ergonomics. + * + * Implementation is carefully chosen for the reasons described in + * https://github.com/typed-ember/ember-typings/pull/29 + */ +export type EmberClassConstructor<T> = (new (properties?: object) => T) & + (new (...args: any[]) => T); + +/** + * Check that any arguments to `create()` match the type's properties. + * + * Accept any additional properties and add merge them into the instance. + */ +export type EmberInstanceArguments<T> = Partial<T> & { + [key: string]: any; +}; + +export type ObserverMethod<Target, Sender> = + | keyof Target + | ((this: Target, sender: Sender, key: string, value: any, rev: number) => void);
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/runtime/types/core.d.ts
@@ -0,0 +1,87 @@ +import { EmberClassConstructor, EmberInstanceArguments, Objectify } from './-private/types'; + +type MergeArray<Arr extends any[]> = Arr extends [infer T, ...infer Rest] + ? T & MergeArray<Rest> + : unknown; // TODO: Is this correct? + +export default class CoreObject { + /** + * CoreObject constructor takes initial object properties as an argument. + */ + constructor(properties?: object); + + _super(...args: any[]): any; + + /** + * An overridable method called when objects are instantiated. By default, + * does nothing unless it is overridden during class definition. + */ + init(): void; + + /** + * Defines the properties that will be concatenated from the superclass (instead of overridden). + * @default null + */ + concatenatedProperties: string[]; + + /** + * Destroyed object property flag. If this property is true the observers and bindings were + * already removed by the effect of calling the destroy() method. + * @default false + */ + isDestroyed: boolean; + /** + * Destruction scheduled flag. The destroy() method has been called. The object stays intact + * until the end of the run loop at which point the isDestroyed flag is set. + * @default false + */ + isDestroying: boolean; + + /** + * Destroys an object by setting the `isDestroyed` flag and removing its + * metadata, which effectively destroys observers and bindings. + * If you try to set a property on a destroyed object, an exception will be + * raised. + * Note that destruction is scheduled for the end of the run loop and does not + * happen immediately. It will set an isDestroying flag immediately. + * @return receiver + */ + destroy(): CoreObject; + + /** + * Override to implement teardown. + */ + willDestroy(): void; + + /** + * Returns a string representation which attempts to provide more information than Javascript's toString + * typically does, in a generic way for all Ember objects (e.g., "<App.Person:ember1024>"). + * @return string representation + */ + toString(): string; + + static create<Class extends typeof CoreObject, Args extends Array<Record<string, any>>>( + this: Class, + ...args: Args + ): InstanceType<Class> & MergeArray<Args>; + + static detect<Statics, Instance>( + this: Statics & EmberClassConstructor<Instance>, + obj: any + ): obj is Objectify<Statics> & EmberClassConstructor<Instance>; + + static detectInstance<Instance>(this: EmberClassConstructor<Instance>, obj: any): obj is Instance; + + /** + * Iterate over each computed property for the class, passing its name and any + * associated metadata (see metaForProperty) to the callback. + */ + static eachComputedProperty(callback: (...args: any[]) => any, binding: {}): void; + /** + * Returns the original hash that was passed to meta(). + * @param key property name + */ + static metaForProperty(key: string): {}; + static isClass: boolean; + static isMethod: boolean; +}
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/runtime/types/evented.d.ts
@@ -0,0 +1,48 @@ +import Mixin from '../../metal/lib/mixin'; + +/** + * This mixin allows for Ember objects to subscribe to and emit events. + */ +interface Evented { + /** + * Subscribes to a named event with given function. + */ + on<Target>( + name: string, + target: Target, + method: string | ((this: Target, ...args: any[]) => void) + ): this; + on(name: string, method: ((...args: any[]) => void) | string): this; + /** + * Subscribes a function to a named event and then cancels the subscription + * after the first time the event is triggered. It is good to use ``one`` when + * you only care about the first time an event has taken place. + */ + one<Target>( + name: string, + target: Target, + method: string | ((this: Target, ...args: any[]) => void) + ): this; + one(name: string, method: string | ((...args: any[]) => void)): this; + /** + * Triggers a named event for the object. Any additional arguments + * will be passed as parameters to the functions that are subscribed to the + * event. + */ + trigger(name: string, ...args: any[]): any; + /** + * Cancels subscription for given name, target, and method. + */ + off<Target>( + name: string, + target: Target, + method: string | ((this: Target, ...args: any[]) => void) + ): this; + off(name: string, method: string | ((...args: any[]) => void)): this; + /** + * Checks to see if object has any subscriptions for named event. + */ + has(name: string): boolean; +} +declare const Evented: Mixin; +export default Evented;
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/runtime/types/mixin.d.ts
@@ -0,0 +1,3 @@ +import { Mixin } from '../../metal/lib/mixin'; + +export default Mixin;
true
Other
emberjs
ember.js
d8f28f42043f077e1b81290d9903c4dd13dca163.json
Improve types for @ember/object Includes: - Object, { action } from '@ember/object' - CoreObject from '@ember/object/core' - Observable from '@ember/object/observable' Note that types for `extend`, `reopen`, and `reopenClass` are not exported. Also, `get` and `set` have naive types. All of these will be deprecated in future releases.
packages/@ember/-internals/runtime/types/observable.d.ts
@@ -0,0 +1,81 @@ +import { ObserverMethod } from './-private/types'; + +/** + * This mixin provides properties and property observing functionality, core features of the Ember object model. + */ +interface Observable { + /** + * Retrieves the value of a property from the object. + */ + get<K extends keyof this>(key: K): unknown; + // get<K extends keyof this>(key: K): UnwrapComputedPropertyGetter<this[K]>; + /** + * To get the values of multiple properties at once, call `getProperties` + * with a list of strings or an array: + */ + getProperties<K extends keyof this>(list: K[]): Record<K, unknown>; + getProperties<K extends keyof this>(...list: K[]): Record<K, unknown>; + /** + * Sets the provided key or path to the value. + */ + set<K extends keyof this>(key: K, value: this[K]): this[K]; + set<T>(key: keyof this, value: T): T; + /** + * Sets a list of properties at once. These properties are set inside + * a single `beginPropertyChanges` and `endPropertyChanges` batch, so + * observers will be buffered. + */ + setProperties<K extends keyof this>(hash: Pick<this, K>): Record<K, unknown>; + setProperties<K extends keyof this>( + // tslint:disable-next-line:unified-signatures + hash: { [KK in K]: any } + ): Record<K, unknown>; + /** + * Convenience method to call `propertyWillChange` and `propertyDidChange` in + * succession. + */ + notifyPropertyChange(keyName: string): this; + /** + * Adds an observer on a property. + */ + addObserver<Target>(key: keyof this, target: Target, method: ObserverMethod<Target, this>): this; + addObserver(key: keyof this, method: ObserverMethod<this, this>): this; + /** + * Remove an observer you have previously registered on this object. Pass + * the same key, target, and method you passed to `addObserver()` and your + * target will no longer receive notifications. + */ + removeObserver<Target>( + key: keyof this, + target: Target, + method: ObserverMethod<Target, this> + ): this; + removeObserver(key: keyof this, method: ObserverMethod<this, this>): this; + /** + * Retrieves the value of a property, or a default value in the case that the + * property returns `undefined`. + */ + getWithDefault<K extends keyof this>(key: K, defaultValue: any): unknown; + /** + * Set the value of a property to the current value plus some amount. + */ + incrementProperty(keyName: keyof this, increment?: number): number; + /** + * Set the value of a property to the current value minus some amount. + */ + decrementProperty(keyName: keyof this, decrement?: number): number; + /** + * Set the value of a boolean property to the opposite of its + * current value. + */ + toggleProperty(keyName: keyof this): boolean; + /** + * Returns the cached value of a computed property, if it exists. + * This allows you to inspect the value of a computed property + * without accidentally invoking it if it is intended to be + * generated lazily. + */ + cacheFor<K extends keyof this>(key: K): unknown; +} +// declare const Observable: Mixin<Observable, CoreObject>; +export default Observable;
true