@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
25 lines (24 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getStyleScopeHash = void 0;
require("core-js/modules/es.string.replace.js");
var _BuildInfo = require("../../shared/build-info/BuildInfo.js");
const slugify = s => String(s).toLowerCase().replace(/[^a-z0-9-]/g, '_');
const getStyleScopeHash = function () {
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
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';
};
exports.getStyleScopeHash = getStyleScopeHash;
//# sourceMappingURL=plugin-scope-hash.js.map