Skip to content

Commit

Permalink
[CLEANUP] Remove deprecated assign polyfill
Browse files Browse the repository at this point in the history
- Remove the polyfill itself.
- Remove the entire `@ember/polyfills` package, which is now empty.
- Remove the `Ember.platform` API, which has loooong been unused.
  • Loading branch information
chriskrycho committed Feb 21, 2023
1 parent 7e48201 commit 48131a9
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 246 deletions.
1 change: 0 additions & 1 deletion ember-cli-build.js
Expand Up @@ -221,7 +221,6 @@ function templateCompilerBundle(emberPackages, transpileTree) {
'@ember/debug/**',
'@ember/deprecated-features/**',
'@ember/error/**',
'@ember/polyfills/**',
'ember/version.js',
'ember-babel.js',
'ember-template-compiler/**',
Expand Down
3 changes: 0 additions & 3 deletions packages/@ember/polyfills/index.ts

This file was deleted.

49 changes: 0 additions & 49 deletions packages/@ember/polyfills/lib/assign.ts

This file was deleted.

57 changes: 0 additions & 57 deletions packages/@ember/polyfills/tests/assign_test.js

This file was deleted.

14 changes: 0 additions & 14 deletions packages/@ember/polyfills/type-tests/assign.test.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/ember/index.ts
Expand Up @@ -92,7 +92,6 @@ import Observable from '@ember/object/observable';
import { addObserver, removeObserver } from '@ember/object/observers';
import ObjectProxy from '@ember/object/proxy';
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
import { assign } from '@ember/polyfills';
import AutoLocation from '@ember/routing/auto-location';
import HashLocation from '@ember/routing/hash-location';
import HistoryLocation from '@ember/routing/history-location';
Expand Down Expand Up @@ -359,9 +358,6 @@ const PartialEmber = {
// ****@ember/object/proxy****
ObjectProxy,

// ****@ember/polyfills****
assign,

// ****@ember/routing/-internals****
RouterDSL,
controllerFor,
Expand Down Expand Up @@ -463,12 +459,6 @@ const PartialEmber = {
// ****@ember/controller, @ember/service****
inject,

// Non-imported
platform: {
defineProperty: true,
hasPropertyAccessors: true,
},

__loader: {
require,
define,
Expand Down
4 changes: 0 additions & 4 deletions packages/ember/tests/reexports_test.js
Expand Up @@ -260,10 +260,6 @@ let allExports = [
// @ember/object/proxy
['ObjectProxy', '@ember/object/proxy', 'default'],

// @ember/polyfills
['assign', '@ember/polyfills', 'assign'],
['platform.hasPropertyAccessors', '@ember/polyfills', 'hasPropertyAccessors'],

// @ember/routing/auto-location
['AutoLocation', '@ember/routing/auto-location', 'default'],

Expand Down
5 changes: 0 additions & 5 deletions tests/docs/expected.js
Expand Up @@ -99,13 +99,11 @@ module.exports = {
'cache',
'cached',
'cacheFor',
'camelize',
'canCatalogEntriesByType',
'cancel',
'cancelRouterSetup',
'canInvoke',
'capabilities',
'capitalize',
'captureRenderTree',
'catalogEntriesByType',
'catch',
Expand Down Expand Up @@ -151,7 +149,6 @@ module.exports = {
'debugCreationStack',
'debugger',
'debugPreviousTransition',
'decamelize',
'decrementProperty',
'defer',
'deferReadiness',
Expand Down Expand Up @@ -519,7 +516,6 @@ module.exports = {
'typeOf',
'typeWatchers',
'unbound',
'underscore',
'union',
'uniq',
'uniqBy',
Expand All @@ -537,7 +533,6 @@ module.exports = {
'userAgent',
'validationCache',
'visit',
'w',
'wait',
'waitForDOMReady',
'warn',
Expand Down
26 changes: 0 additions & 26 deletions type-tests/@ember/polyfills-tests.ts

This file was deleted.

5 changes: 0 additions & 5 deletions type-tests/ember/ember-module-tests.ts
Expand Up @@ -21,11 +21,6 @@ Ember.addObserver({ a: 'foo' }, 'a', {}, () => {});
// assert
Ember.assert('2+2 should always be 4', 2 + 2 === 4);
// assign
const o1 = Ember.assign({ a: 1 }, { b: 2 });
expectTypeOf(o1.a).toBeNumber();
expectTypeOf(o1.b).toBeNumber();
// @ts-expect-error
o1.c;
// Ember.bind // @ts-expect-error
// cacheFor
expectTypeOf(Ember.cacheFor({ a: 123 }, 'a')).toEqualTypeOf<number | undefined>();
Expand Down
26 changes: 0 additions & 26 deletions type-tests/ember/utils.ts
Expand Up @@ -44,14 +44,6 @@ function testIsNone() {
Ember.isNone('', '');
}

function testAssign() {
expectTypeOf(Ember.assign({ first: 'Tom' }, { middle: 'M' }, { last: 'Dale' })).toEqualTypeOf<{
first: string;
middle: string;
last: string;
}>();
}

function testOnError() {
Ember.onerror = (error) => {
fetch('/report-error', {
Expand Down Expand Up @@ -120,21 +112,3 @@ declare const fileList: FileList;
expectTypeOf(Ember.typeOf(new Date() as RegExp | Date)).toEqualTypeOf<'regexp' | 'date'>();
expectTypeOf(Ember.typeOf({ randomObject: true })).toEqualTypeOf<'object'>();
})();

(() => {
/* assign */
Ember.assign({}, { a: 'b' });
expectTypeOf(Ember.assign({}, { a: 'b' }).a).toBeString();
expectTypeOf(Ember.assign({ a: 6 }, { a: 'b' }).a).toBeString();
expectTypeOf(Ember.assign({ a: 6 }, {}).a).toBeNumber();
// @ts-expect-error
Ember.assign({ b: 6 }, {}).a;
expectTypeOf(Ember.assign({}, { b: 6 }, {}).b).toBeNumber();
expectTypeOf(Ember.assign({ a: 'hello' }, { b: 6 }, {}).a).toBeString();
expectTypeOf(Ember.assign({ a: 'hello' }, { b: 6 }, { a: true }).a).toBeBoolean();
// @ts-expect-error
Ember.assign({ a: 'hello' }, '', { a: true }).a;
expectTypeOf(
Ember.assign({ d: ['gobias industries'] }, { a: 'hello' }, { b: 6 }, { a: true }).d
).toEqualTypeOf<string[]>();
})();
23 changes: 0 additions & 23 deletions types/preview/@ember/polyfills/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions types/preview/@ember/polyfills/types.d.ts

This file was deleted.

12 changes: 0 additions & 12 deletions types/preview/ember/index.d.ts
Expand Up @@ -8,7 +8,6 @@ declare module 'ember' {
import type * as EmberTemplateNs from '@ember/template';
import * as EmberTemplateHandlebarsNs from '@ember/template/-private/handlebars';
import type * as EmberServiceNs from '@ember/service';
import type * as EmberPolyfillsNs from '@ember/polyfills';
import type * as EmberUtilsNs from '@ember/utils';
import type * as EmberRunloopNs from '@ember/runloop';
import * as EmberObjectNs from '@ember/object';
Expand Down Expand Up @@ -293,11 +292,6 @@ declare module 'ember' {
interface Run extends RunFn, EmberRunloop {}
const run: Run;

const platform: {
defineProperty: boolean;
hasPropertyAccessors: boolean;
};

/**
* `getEngineParent` retrieves an engine instance's parent instance.
*/
Expand Down Expand Up @@ -339,12 +333,6 @@ declare module 'ember' {
*/
const isEqual: typeof EmberUtilsNs.isEqual;
const typeOf: typeof EmberUtilsNs.typeOf;
/**
* Copy properties from a source object to a target object.
* @deprecated until v5.0. You should replace any calls to `Ember.assign`
* with `Object.assign` or use the object spread operator.
*/
const assign: typeof EmberPolyfillsNs.assign;
const guidFor: typeof EmberObjectInternalsNs.guidFor;

/**
Expand Down
3 changes: 0 additions & 3 deletions types/preview/index.d.ts
Expand Up @@ -89,9 +89,6 @@ import './@ember/object/observers';
import './@ember/object/promise-proxy-mixin';
import './@ember/object/proxy';

import './@ember/polyfills';
import './@ember/polyfills/types';

import './@ember/routing';
import './@ember/routing/-private/router-dsl';
import './@ember/routing/auto-location';
Expand Down
2 changes: 0 additions & 2 deletions types/publish.mjs
Expand Up @@ -254,8 +254,6 @@ const PREVIEW_MODULES = [
'@ember/object/observers.d.ts',
'@ember/object/promise-proxy-mixin.d.ts',
'@ember/object/proxy.d.ts',
'@ember/polyfills/index.d.ts',
'@ember/polyfills/lib/assign.d.ts',
'@ember/renderer/index.d.ts',
'@ember/routing/-internals.d.ts',
'@ember/routing/auto-location.d.ts',
Expand Down

0 comments on commit 48131a9

Please sign in to comment.