every-plugin
Version:
22 lines (21 loc) • 713 B
JavaScript
//#region src/runtime/services/normalize.ts
/**
* Normalizes a package name into the module federation remote name.
* This function must produce identical results in both runtime and build contexts.
*
* Normalization rules:
* - Convert to lowercase
* - Strip a single leading '@' symbol
* - Replace '/' with '_'
* - Preserve hyphens and other characters
*
* Examples:
* - "@scope/my-plugin" → "scope_my-plugin"
* - "@SCOPE/Foo/Bar" → "scope_foo_bar"
* - "foo/bar" → "foo_bar"
* - "simple-plugin" → "simple-plugin"
*/
const getNormalizedRemoteName = (name) => name.toLowerCase().replace(/^@/, "").replace(/\//g, "_");
//#endregion
export { getNormalizedRemoteName };
//# sourceMappingURL=normalize.mjs.map