Documentation / @warp-drive/build-config / deprecations
Deprecations
This guide is intended to help you understand both how to address an active deprecation and how to eliminate the code that supports the deprecation once it has been resolved.
Eliminating the associated code reduces the size of your application, often opts applications into more performant fast-paths, and ensures your application does not revert to using the deprecated behavior in the future.
Active Deprecation IDs
- ember-data:deprecate-non-strict-types
- ember-data:deprecate-non-strict-id
- ember-data:deprecate-legacy-imports
- ember-data:deprecate-non-unique-collection-payloads
- ember-data:deprecate-relationship-remote-update-clearing-local-state
- ember-data:deprecate-many-array-duplicates
- ember-data:deprecate-store-extends-ember-object
- ember-data:schema-service-updates
- warp-drive.ember-inflector
- warp-drive:deprecate-tracking-package
Removing Code for Deprecated Features
WarpDrive enables applications to opt-in to fully eliminating the code for a deprecated feature once the application has taken the necessary steps to ensure that it no longer requires the use of the code which triggers the deprecation.
Each deprecation ID is associated to a deprecation flag which is used to instrument the library for build-time removal of the deprecated code. Some flags have multiple deprecation IDs associated to them, in which case to remove the deprecated code all of the deprecation IDs must be resolved.
There are two modes for opting into deprecated code removal:
- by version
- by deprecation flag
If your app has resolved all deprecations present in a given version, you may specify that version as your "compatWith" version. This will remove the code for all deprecations that were introduced in or before that version.
setConfig(app, __dirname, {
compatWith: '5.0',
});
setConfig(context, {
compatWith: '5.0',
});
For instance, if a deprecation was introduced in 5.3, and the app specifies 5.2 as its minimum version compatibility, any deprecations introduced in or before 5.2 will be removed, but any deprecations introduced in 5.3 will remain.
You may also specify that specific deprecations are resolved. These approaches may be used together.
setConfig(app, __dirname, {
deprecations: {
DEPRECATE_NON_STRICT_TYPES: false,
DEPRECATE_NON_STRICT_ID: false,
}
});
setConfig(context, {
deprecations: {
DEPRECATE_NON_STRICT_TYPES: false,
DEPRECATE_NON_STRICT_ID: false,
}
});
💡 Report Bugs if You Find Them
WarpDrive does not test against permutations of deprecations being stripped, our tests run against "all deprecated code included" and "all deprecated code removed". Unspecified behavior may sometimes occur when removing code for only specific deprecations.
If this happens, we'd like to know 💜
Variables
- DEPRECATE_COMPUTED_CHAINS
- DEPRECATE_EMBER_INFLECTOR
- DEPRECATE_LEGACY_IMPORTS
- DEPRECATE_MANY_ARRAY_DUPLICATES
- DEPRECATE_NON_STRICT_ID
- DEPRECATE_NON_STRICT_TYPES
- DEPRECATE_NON_UNIQUE_PAYLOADS
- DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE
- DEPRECATE_STORE_EXTENDS_EMBER_OBJECT
- DEPRECATE_TRACKING_PACKAGE
- DISABLE_7X_DEPRECATIONS
- ENABLE_LEGACY_SCHEMA_SERVICE