@vcmap/ui 6.1.4 → 6.1.5

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/build/build.js CHANGED
@@ -206,8 +206,23 @@ indexHTMLContent = indexHTMLContent.replace(
206
206
  /<link[^>]*href=".*materialdesignicons\.min\.css"[^>]*>/,
207
207
  '',
208
208
  );
209
- // replace @vcmap/ui with './assets/ui.js'
210
- indexHTMLContent = indexHTMLContent.replace(/@vcmap\/ui/, './assets/ui.js');
209
+
210
+ // replace @vcmap/ui with './assets/ui.js' and outsource to start.js
211
+ // We do not want to have a script tag in the index.html, because of CSP Policies.
212
+ // see https://content-security-policy.com/unsafe-inline/
213
+ const scriptRegex = /<script type="module">([\s\S]*?)<\/script>/;
214
+ const match = indexHTMLContent.match(scriptRegex);
215
+ if (match && match[1]) {
216
+ let scriptContent = match[1].trim();
217
+ scriptContent = scriptContent.replace(/@vcmap\/ui/, './ui.js');
218
+ await writeFile(path.join(assetsFolder, 'start.js'), scriptContent, {
219
+ encoding: 'utf8',
220
+ });
221
+ indexHTMLContent = indexHTMLContent.replace(
222
+ scriptRegex,
223
+ '<script src="./assets/start.js" type="module"></script>',
224
+ );
225
+ }
211
226
  await writeFile(path.join(distFolder, 'index.html'), indexHTMLContent, {
212
227
  encoding: 'utf8',
213
228
  });
@@ -215,7 +230,7 @@ const htaccessContent = `
215
230
  <FilesMatch "-[\\w\\d]{8}\\.(js|css)$">
216
231
  Header set Cache-Control "public, max-age=31540000, immutable"
217
232
  </FilesMatch>
218
- <FilesMatch "(index\\.html|config\\.json|ui\\.js|vue\\.js|vuetify\\.js|ol\\.js|cesium\\.js|core\\.js)$">
233
+ <FilesMatch "(index\\.html|start\\.js|ui\\.js|vue\\.js|vuetify\\.js|ol\\.js|cesium\\.js|core\\.js)$">
219
234
  Header set Cache-Control "no-store, max-age=0"
220
235
  </FilesMatch>
221
236
  `;
package/dist/.htaccess CHANGED
@@ -2,6 +2,6 @@
2
2
  <FilesMatch "-[\w\d]{8}\.(js|css)$">
3
3
  Header set Cache-Control "public, max-age=31540000, immutable"
4
4
  </FilesMatch>
5
- <FilesMatch "(index\.html|config\.json|ui\.js|vue\.js|vuetify\.js|ol\.js|cesium\.js|core\.js)$">
5
+ <FilesMatch "(index\.html|start\.js|ui\.js|vue\.js|vuetify\.js|ol\.js|cesium\.js|core\.js)$">
6
6
  Header set Cache-Control "no-store, max-age=0"
7
7
  </FilesMatch>
@@ -1 +1 @@
1
- export * from "./cesium-b1e1b462.js";
1
+ export * from "./cesium-0a40465b.js";