mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
DEV: Drop unused shims for Ember 3 deprecations (#26563)
These deprecation shims are no-ops under Ember 5.
This commit is contained in:
parent
2a5d4ede6d
commit
a601813a6c
@ -1,5 +1,5 @@
|
||||
import { DEBUG } from "@glimmer/env";
|
||||
import runloop from "@ember/runloop";
|
||||
import { _backburner } from "@ember/runloop";
|
||||
import RSVP from "rsvp";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
import { setURLContainer } from "discourse/lib/url";
|
||||
@ -19,7 +19,7 @@ export default {
|
||||
// The very first initializer to run
|
||||
initialize(app) {
|
||||
if (DEBUG) {
|
||||
runloop._backburner.ASYNC_STACKS = true;
|
||||
_backburner.ASYNC_STACKS = true;
|
||||
}
|
||||
|
||||
setURLContainer(app.__container__);
|
||||
|
@ -33,142 +33,6 @@ define("discourse/lib/deprecate-shim", ["exports"], function (exports) {
|
||||
console.warn(`DEPRECATION: ${updatedMessage}`);
|
||||
}
|
||||
);
|
||||
|
||||
const deprecate = require("@ember/debug").deprecate;
|
||||
|
||||
// Patch ember-global deprecation
|
||||
["Ember", "Em"].forEach((key) => {
|
||||
if (window.hasOwnProperty(key)) {
|
||||
Object.defineProperty(window, key, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get() {
|
||||
deprecate(
|
||||
`Usage of the ${key} Global is deprecated. You should import the Ember module or the specific API instead.`,
|
||||
false,
|
||||
{
|
||||
id: "ember-global",
|
||||
until: "4.0.0",
|
||||
url: "https://deprecations.emberjs.com/v3.x/#toc_ember-global",
|
||||
for: "ember-source",
|
||||
since: {
|
||||
enabled: "3.27.0",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return require("ember").default;
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Patch run.blah deprecations
|
||||
// https://github.com/emberjs/ember.js/blob/007fc9eba1/packages/%40ember/runloop/index.js#L748-L808
|
||||
const deprecatedRunloopFunctions = [
|
||||
"backburner",
|
||||
"begin",
|
||||
"bind",
|
||||
"cancel",
|
||||
"debounce",
|
||||
"end",
|
||||
"hasScheduledTimers",
|
||||
"join",
|
||||
"later",
|
||||
"next",
|
||||
"once",
|
||||
"schedule",
|
||||
"scheduleOnce",
|
||||
"throttle",
|
||||
"cancelTimers",
|
||||
];
|
||||
|
||||
const run = require("@ember/runloop").run;
|
||||
for (const name of deprecatedRunloopFunctions) {
|
||||
const currentDescriptor = Object.getOwnPropertyDescriptor(run, name);
|
||||
if (currentDescriptor?.value) {
|
||||
Object.defineProperty(run, name, {
|
||||
get() {
|
||||
deprecate(
|
||||
`Using \`run.${name}\` has been deprecated. Instead, import the value directly.`,
|
||||
false,
|
||||
{
|
||||
id: "deprecated-run-loop-and-computed-dot-access",
|
||||
until: "4.0.0",
|
||||
for: "ember-source",
|
||||
since: {
|
||||
enabled: "3.27.0",
|
||||
},
|
||||
url: "https://deprecations.emberjs.com/v3.x/#toc_deprecated-run-loop-and-computed-dot-access",
|
||||
}
|
||||
);
|
||||
return currentDescriptor.value;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Patch computed.blah deprecations
|
||||
// https://github.com/emberjs/ember.js/blob/v3.28.12/packages/%40ember/object/index.js#L60-L118
|
||||
const deprecatedComputedFunctions = [
|
||||
"alias",
|
||||
"and",
|
||||
"bool",
|
||||
"collect",
|
||||
"deprecatingAlias",
|
||||
"empty",
|
||||
"equal",
|
||||
"filterBy",
|
||||
"filter",
|
||||
"gte",
|
||||
"gt",
|
||||
"intersect",
|
||||
"lte",
|
||||
"lt",
|
||||
"mapBy",
|
||||
"map",
|
||||
"match",
|
||||
"max",
|
||||
"min",
|
||||
"none",
|
||||
"notEmpty",
|
||||
"not",
|
||||
"oneWay",
|
||||
"reads",
|
||||
"or",
|
||||
"readOnly",
|
||||
"setDiff",
|
||||
"sort",
|
||||
"sum",
|
||||
"union",
|
||||
"uniqBy",
|
||||
"uniq",
|
||||
];
|
||||
|
||||
const computed = require("@ember/object").computed;
|
||||
for (const name of deprecatedComputedFunctions) {
|
||||
const currentDescriptor = Object.getOwnPropertyDescriptor(computed, name);
|
||||
if (currentDescriptor?.value) {
|
||||
Object.defineProperty(computed, name, {
|
||||
get() {
|
||||
deprecate(
|
||||
`Using \`computed.${name}\` has been deprecated. Instead, import the value directly.`,
|
||||
false,
|
||||
{
|
||||
id: "deprecated-run-loop-and-computed-dot-access",
|
||||
until: "4.0.0",
|
||||
for: "ember-source",
|
||||
since: {
|
||||
enabled: "3.27.0",
|
||||
},
|
||||
url: "https://deprecations.emberjs.com/v3.x/#toc_deprecated-run-loop-and-computed-dot-access",
|
||||
}
|
||||
);
|
||||
return currentDescriptor.value;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user