@muonic/muon 0.0.2-experimental-186-333208e.0 → 0.0.2-experimental-187-647c5c4.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.
@@ -1,4 +1,7 @@
1
1
  import { AsyncDirective, directive, html, unsafeSVG, until } from '@muonic/muon';
2
+ import {
3
+ SVG_CONFIG_CACHE
4
+ } from '@muon/tokens';
2
5
 
3
6
  export class SVGLoaderDirective extends AsyncDirective {
4
7
  constructor(partInfo) {
@@ -20,7 +23,7 @@ export class SVGLoaderDirective extends AsyncDirective {
20
23
 
21
24
  try {
22
25
  cacheAvailable = 'caches' in self;
23
- cache = cacheAvailable && await caches?.open('muon');
26
+ cache = cacheAvailable && await caches?.open(SVG_CONFIG_CACHE);
24
27
  const cacheData = await cache.match(url);
25
28
 
26
29
  response = cache && cacheData ? cacheData : undefined;
@@ -30,10 +33,9 @@ export class SVGLoaderDirective extends AsyncDirective {
30
33
  }
31
34
 
32
35
  if (!response) {
33
- response = await window.fetch(url);
34
-
35
- response = new Response(response.body, response);
36
- response.headers.append('Cache-Control', 'max-age=100000');
36
+ response = await window.fetch(url, {
37
+ cache: 'no-store'
38
+ });
37
39
 
38
40
  if (cache && response.body) {
39
41
  cache.put(url, response.clone())
@@ -0,0 +1,9 @@
1
+ {
2
+ "svg": {
3
+ "config": {
4
+ "cache": {
5
+ "value": "muon"
6
+ }
7
+ }
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muonic/muon",
3
- "version": "0.0.2-experimental-186-333208e.0",
3
+ "version": "0.0.2-experimental-187-647c5c4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@ const root = path.join(__filename, '..', '..');
9
9
  const buildPath = path.join(root, 'build', 'tokens');
10
10
 
11
11
  export default {
12
- include: [root + '/tokens/**/*.js', root + '/tokens/**/*.json', root + '/tokens/*.json', root + '/components/**/**/config-tokens.json', root + '/components/**/**/design-tokens.json'],
12
+ include: [root + '/tokens/**/*.js', root + '/tokens/**/*.json', root + '/tokens/*.json', root + '/components/**/**/config-tokens.json', root + '/components/**/**/design-tokens.json', root + '/directives/tokens.json'],
13
13
  platforms: {
14
14
  js: {
15
15
  buildPath: path.join(buildPath, 'es6/'),