@muonic/muon 0.0.2-experimental-184-6bbdbaf.0 → 0.0.2-experimental-185-9accacc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muonic/muon",
3
- "version": "0.0.2-experimental-184-6bbdbaf.0",
3
+ "version": "0.0.2-experimental-185-9accacc.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -47,6 +47,7 @@
47
47
  "postcss-preset-env": "8.3.2",
48
48
  "postcss-simple-vars": "7.0.1",
49
49
  "rollup-plugin-lit-css": "4.0.1",
50
+ "rollup-plugin-minify-html-literals": "1.2.6",
50
51
  "rollup-plugin-styles": "4.0.0",
51
52
  "style-dictionary": "3.8.0",
52
53
  "typescript": "5.0.4",
package/rollup.config.mjs CHANGED
@@ -5,6 +5,7 @@ import { createBasicConfig } from '@open-wc/building-rollup';
5
5
  import path from 'path';
6
6
  import { componentDefiner, getDestination } from '@muonic/muon/scripts/utils/index.mjs';
7
7
  import { rollupPlugins } from '@muonic/muon/scripts/rollup-plugins.mjs';
8
+ import minifyHTMLPlugin from 'rollup-plugin-minify-html-literals';
8
9
 
9
10
  const config = createBasicConfig();
10
11
  const input = 'index.js';
@@ -14,6 +15,7 @@ export default merge(config, {
14
15
  input,
15
16
  treeshake: false,
16
17
  plugins: [
18
+ minifyHTMLPlugin.default(),
17
19
  virtual({
18
20
  'component-definitions.js': componentDefiner()
19
21
  }),
@@ -25,6 +27,7 @@ export default merge(config, {
25
27
  dir: undefined,
26
28
  file: path.join(getDestination(), 'index.js'),
27
29
  sourcemap: false,
28
- inlineDynamicImports: true
30
+ inlineDynamicImports: true,
31
+ format: 'iife'
29
32
  }
30
33
  });
@@ -285,17 +285,24 @@ const createTokens = async () => {
285
285
  };
286
286
 
287
287
  const componentDefiner = async () => {
288
- const config = getConfig();
289
288
  const compList = await analyze();
290
- const prefix = getPrefix();
291
289
  let componentDefinition = `import '@webcomponents/scoped-custom-element-registry';`;
292
290
 
293
- componentDefinition += compList.map(({ file, name, exportName, elementName }) => {
291
+ componentDefinition += compList.map(({ file, exportName }) => {
294
292
  return `import { ${exportName} } from '${file}';
295
- customElements.define('${elementName}', ${exportName});
296
293
  `;
297
294
  }).join('');
298
295
 
296
+ const definingCompnents = compList.map(({ exportName, elementName }) => {
297
+ return `customElements.define('${elementName}', ${exportName});`;
298
+ });
299
+
300
+ componentDefinition += `
301
+ document.addEventListener('DOMContentLoaded', () => {
302
+ ${definingCompnents.join('')}
303
+ });
304
+ `;
305
+
299
306
  return componentDefinition;
300
307
  };
301
308