@nuxtjs/color-mode
Advanced tools
Comparing version 2.0.10 to 2.1.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [2.1.0](https://github.com/nuxt-community/color-mode-module/compare/v2.0.10...v2.1.0) (2021-08-02) | ||
### Features | ||
* add csp hash for color script ([#94](https://github.com/nuxt-community/color-mode-module/issues/94)) ([e2f1ffc](https://github.com/nuxt-community/color-mode-module/commit/e2f1ffc2a64dd22d7ed5b40fc6bc78562e47c9d0)) | ||
### [2.0.10](https://github.com/nuxt-community/color-mode-module/compare/v2.0.9...v2.0.10) (2021-06-11) | ||
@@ -7,0 +14,0 @@ |
import { resolve } from 'path' | ||
import { promises as fsp } from 'fs' | ||
import crypto from 'crypto' | ||
import defu from 'defu' | ||
@@ -45,2 +46,9 @@ import template from 'lodash.template' | ||
this.nuxt.hook('vue-renderer:ssr:csp', (cspScriptSrcHashes) => { | ||
const { csp } = this.options.render | ||
const hash = crypto.createHash(csp.hashAlgorithm) | ||
hash.update(options.script) | ||
cspScriptSrcHashes.push(`'${csp.hashAlgorithm}-${hash.digest('base64')}'`) | ||
}) | ||
// Add all templates | ||
@@ -47,0 +55,0 @@ const templatesDir = resolve(__dirname, 'templates') |
{ | ||
"name": "@nuxtjs/color-mode", | ||
"version": "2.0.10", | ||
"version": "2.1.0", | ||
"description": "Dark and Light mode for NuxtJS with auto detection", | ||
@@ -35,5 +35,5 @@ "repository": "nuxt-community/color-mode-module", | ||
"@commitlint/config-conventional": "^12.0.1", | ||
"@nuxt/test-utils": "^0.2.2", | ||
"@nuxt/types": "^2.15.3", | ||
"@nuxtjs/eslint-config": "^6.0.0", | ||
"@nuxtjs/module-test-utils": "^1.6.3", | ||
"@nuxtjs/svg": "^0.1.12", | ||
@@ -40,0 +40,0 @@ "babel-eslint": "latest", |
23409
361