Skip to content

Commit

Permalink
Merge branch 'staging/clefairy' into fix/code-block/client-side-sundried
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers authored Sep 23, 2024
2 parents 50ba392 + af5f874 commit c54c82a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions web-dev-server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function resolveLocal(pattern, relativeTo = './') {
* jspm generator doesn't yet support trailing slash
* @param {import('@parse5/tools').Document} document
*/
function injectManuallyResolvedIconsToImportMap(document) {
function injectManuallyResolvedModulesToImportMap(document) {
const importMapNode = query(document, node =>
isElementNode(node)
&& node.tagName === 'script'
Expand All @@ -50,17 +50,17 @@ function injectManuallyResolvedIconsToImportMap(document) {
&& attr.value === 'importmap'));
if (importMapNode && isElementNode(importMapNode)) {
const json = JSON.parse(getTextContent(importMapNode));
json.imports['lit'] = '/node_modules/lit/index.js';
json.imports['lit/'] = '/node_modules/lit/';
json.imports['@patternfly/pfe-core'] = '/node_modules/@patternfly/pfe-core/core.js';
json.imports['@patternfly/pfe-core/'] = '/node_modules/@patternfly/pfe-core/';
json.imports['@rhds/icons/'] = '/node_modules/@rhds/icons/';
json.imports['@rhds/tokens/'] = '/node_modules/@rhds/tokens/js/';
json.imports['@rhds/tokens/css/'] = '/node_modules/@rhds/tokens/css/';
json.imports['@floating-ui/dom'] =
'/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs';
json.imports['@floating-ui/core'] =
'/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs';
Object.assign(json.imports, {
'lit': '/node_modules/lit/index.js',
'lit/': '/node_modules/lit/',
'@patternfly/pfe-core': '/node_modules/@patternfly/pfe-core/core.js',
'@patternfly/pfe-core/': '/node_modules/@patternfly/pfe-core/',
'@rhds/icons/': '/node_modules/@rhds/icons/',
'@rhds/tokens/': '/node_modules/@rhds/tokens/js/',
'@rhds/tokens/css/': '/node_modules/@rhds/tokens/css/',
'@floating-ui/dom': '/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs',
'@floating-ui/core': '/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs',
});
setTextContent(importMapNode, JSON.stringify(json, null, 2));
}
}
Expand Down Expand Up @@ -164,7 +164,7 @@ export default pfeDevServerConfig({
if (ctx.path.endsWith('/') && !ctx.path.includes('.')) {
await next();
const document = parse(ctx.body);
injectManuallyResolvedIconsToImportMap(document);
injectManuallyResolvedModulesToImportMap(document);
transformDevServerHTML(document);
ctx.body = serialize(document);
} else {
Expand Down

0 comments on commit c54c82a

Please sign in to comment.