UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

23 lines (22 loc) 885 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getStyleScopeHash = void 0; var _BuildInfo = require("../../shared/build-info/BuildInfo.js"); const slugify = s => String(s).toLowerCase().replace(/[^a-z0-9-]/g, '_'); const getStyleScopeHash = (opts = 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