@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
25 lines (23 loc) • 902 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
export var getStyleScopeHash = void 0;
require("core-js/modules/es.string.replace.js");
import _BuildInfo from "../../shared/build-info/BuildInfo.js";
const slugify = s => String(s).toLowerCase().replace(/[^a-z0-9-]/g, '_');
const getStyleScopeHash = opts => {
const version = (opts === null || opts === void 0 ? void 0 : opts.version) || (0, _BuildInfo.getVersion)();
const isVersion = String(version).match(/^\d/);
const isBranch = String(version).includes('/');
if (isVersion) {
return slugify(`eufemia-scope--${version}`);
}
if (isBranch) {
const sha = (opts === null || opts === void 0 ? void 0 : opts.sha) || (0, _BuildInfo.getSha)();
return slugify(`eufemia-scope--${sha}`);
}
return 'eufemia-scope--default';
};
export {getStyleScopeHash};
//# sourceMappingURL=plugin-scope-hash.js.map