-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description
In Umbraco 15, various parts are moved into their respective package, instead of declared centrally in the core, which means many import map/paths are not valid any longer in v.15.
This is done to enable extensions to bring their parts in the same maner as the Core. Enabling Extension Types from Packages to be available for other Packages as long as that Package is declared as a dependency. More on that below.
Imports:
Modal Tokens, Constants, Various TypeScript Types & Extension Manifest Types are moved into their respective package/import map. This means you need to update their import path — Ideally use an IDE that can update this automatically. Remove the import and ask the IDE to import again ( Follow the guide in TypeScript configuration below. This will have a positive effect on how well your IDE can pick up the Import Paths.)
Example for the Link Picker Modal Token:
Before it was imported here:
import { UMB_LINK_PICKER_MODAL } from '@umbraco-cms/backoffice/modal';
Now it will be imported from here:
import { UMB_LINK_PICKER_MODAL } from '@umbraco-cms/backoffice/multi-url-picker';
TypeScript configuration:
To be able to use the new Extension Manifest Types, you will need to update the tsconfig.json to include the extension-types from backoffice.
To do so add "@umbraco-cms/backoffice/extension-types" to compilerOptions->types
{
"compilerOptions": {
...
"types": [
"@umbraco-cms/backoffice/extension-types"
]
}
}
If you want to be using extension types from other packages, they should be included in the same maner.
(Notice if you are a package author, and would like others to extend your Package, you should expose the declared Extension Manifest Types via such import map)
Using Extension Manifest Types:
The use of ManifestTypes, should be replaced with a global type called UmbExtensionManifest (which does not need an import once the TypeScript config includes the backoffice extension types. — The main reasoning for a global type is that this type is not exclusive for Core Extension Types, making it possible for other Packages to declare Manifest Types.
If you are looking for specific types, then they must correct their import path to their respective package/import map.
But notice how the specific types are not knowledgable of the additional Kinds of its type, so to be able to use Kinds you must use the UmbExtensionManifest type.
Example for the Dashboard Extension Manifest Type:
Before it was imported here:
import type { ManifestDashboard } from '@umbraco-cms/backoffice/extension-registry';
Now it will be imported from here:
import type { ManifestDashboard } from '@umbraco-cms/backoffice/dashboard';
Declaring Extension Manifest Types:
When declaring a new Extension Manifest Type, it must be appended to the Global Extension Manifest Type Map. Here is an example:
export interface PrefixAnimalExtentionManifestType extends ManifestBase {
type: 'prefixAnimal';
}
declare global {
interface UmbExtensionManifestMap {
PrefixAnimalExtentionManifestType: PrefixAnimalExtentionManifestType;
}
}
Make sure both your manifest-type and your property-name in the UmbExtensionManifestMap is unique (use a unique Prefix for your extension types.)
Declaring Extension Condition Configuration Types:
When declaring a new Extension Condition Type, you must now ensure to additionally declare a configuration type in a global type map specifically for Condition Configuration Types.
Even if you do not have any configuration properties — otherwise the condition will not show up as a valid option.
Example of a Condition Configuration Type:
export type PrefixAnimalTypeConditionConfig = UmbConditionConfigBase<'Prefix.Condition.AnimalType'> & {
animalType: string;
};
declare global {
interface UmbExtensionConditionConfigMap {
PrefixAnimalTypeConditionConfig: PrefixAnimalTypeConditionConfig;
}
}
Notice 'Prefix.Condition.AnimalType' is the alias of the Condition.
Version
Umbraco 15
Previous behavior
Had collected things in one core package, such imports will change.
New behavior
All Extension Manifest Types via a Global Type called UmbExtensionManifest. Other things from their respective package.
Type of breaking change
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
- Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.
Reason for change
Package developers had near to no good opportunities when declaring their own Extension Manifest Types.
This gives them ability to easily declare such and opens up for Packages to extend Packages.
Recommended action
Use UmbExtensionManifest instead of ManifestTypes. Configure your tsconfig for global types. Update various imports to import from the respective package of the part.
Affected APIs
Extension Registry, Modal Tokens, Constants and TypeScript Types, Import Maps.