David Taylor d405305456
DEV: Explicitly disable Ember string prototype extensions (#24110)
These have been deprecated for some time, and the vast majority of themes/plugins have already removed their use. The prototype extensions were unexpectedly disabled as a side effect of 895036bd7a057f2430c5c917040319577fcf6b95 (more details in https://github.com/discourse/discourse/pull/24101).

Given that restoring the functionality now involves significant complexity, and would only be delaying the inevitable removal in a matter of months, we've decided to keep them disabled. This commit explicitly sets the flag in the ember environment config to make things clearer.
2023-10-26 11:16:57 +01:00

63 lines
1.7 KiB
JavaScript

"use strict";
module.exports = function (environment) {
const ENV = {
modulePrefix: "discourse",
environment,
rootURL: `${process.env.DISCOURSE_RELATIVE_URL_ROOT ?? ""}/`, // Add a trailing slash (not required by the Rails app in this env variable)
locationType: "history",
historySupportMiddleware: false,
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false,
String: false,
},
},
exportApplicationGlobal: true,
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
};
if (process.env.EMBER_RAISE_ON_DEPRECATION === "1") {
ENV.EmberENV.RAISE_ON_DEPRECATION = true;
} else if (process.env.EMBER_RAISE_ON_DEPRECATION === "0") {
ENV.EmberENV.RAISE_ON_DEPRECATION = false;
} else {
// Default (normally false; true in core qunit runs)
}
if (environment === "development") {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === "test") {
// Testem prefers this...
ENV.locationType = "none";
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = "#ember-testing";
ENV.APP.autoboot = false;
}
if (environment === "production") {
// here you can enable a production-specific feature
}
return ENV;
};