@human-synthesis/norns-core 0.0.1 → 0.0.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/uno.js +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@human-synthesis/norns-core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Norns core — Svelte with CoffeeScript, Pug, and UnoCSS preconfigured",
5
5
  "license": "MIT",
6
6
  "author": "Human Synthesis",
package/src/uno.js CHANGED
@@ -3,12 +3,16 @@ import { presetUno, presetAttributify, presetIcons, presetTypography } from 'uno
3
3
 
4
4
  /**
5
5
  * Norns UnoCSS Vite plugin with a sensible preset stack.
6
- * Pass overrides to merge with the defaults.
6
+ *
7
+ * Defaults `hmrTopLevelAwait: false` to avoid a TDZ
8
+ * "Cannot access 'component' before initialization" error in WebKit/Safari
9
+ * when importing 'virtual:uno.css' from a SvelteKit layout/page module.
10
+ * Pass `hmrTopLevelAwait: true` if you've verified your stack handles it.
7
11
  *
8
12
  * @param {import('unocss/vite').VitePluginConfig} [options]
9
13
  */
10
14
  export function nornsUno(options = {}) {
11
- const { presets = [], ...rest } = options;
15
+ const { presets = [], hmrTopLevelAwait = false, ...rest } = options;
12
16
  return UnoCSS({
13
17
  presets: [
14
18
  presetUno(),
@@ -17,6 +21,7 @@ export function nornsUno(options = {}) {
17
21
  presetTypography(),
18
22
  ...presets
19
23
  ],
24
+ hmrTopLevelAwait,
20
25
  ...rest
21
26
  });
22
27
  }