@wpnuxt/core 2.0.0-alpha.14 → 2.0.0-alpha.15

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/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpnuxt/core",
3
- "version": "2.0.0-alpha.14",
3
+ "version": "2.0.0-alpha.15",
4
4
  "configKey": "wpNuxt",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0"
package/dist/module.mjs CHANGED
@@ -9,7 +9,7 @@ import { ref } from 'vue';
9
9
  import { parse, GraphQLError } from 'graphql';
10
10
  import { execSync } from 'node:child_process';
11
11
 
12
- const version = "2.0.0-alpha.14";
12
+ const version = "2.0.0-alpha.15";
13
13
 
14
14
  function createModuleError(module, message) {
15
15
  return new Error(formatErrorMessage(module, message));
@@ -819,6 +819,7 @@ const module$1 = defineNuxtModule({
819
819
  nuxt.options.runtimeConfig.public.buildHash = randHashGenerator();
820
820
  addPlugin(resolver.resolve("./runtime/plugins/graphqlConfig"));
821
821
  addPlugin(resolver.resolve("./runtime/plugins/graphqlErrors"));
822
+ addPlugin(resolver.resolve("./runtime/plugins/sanitizeHtml"));
822
823
  configureTrailingSlash(nuxt, logger);
823
824
  const mergedQueriesFolder = await mergeQueries(nuxt, wpNuxtConfig, resolver);
824
825
  await setupServerOptions(nuxt, resolver, logger);
@@ -1220,7 +1221,6 @@ async function registerModules(nuxt, resolver, wpNuxtConfig, mergedQueriesFolder
1220
1221
  improvedQueryParamEncoding: true
1221
1222
  }
1222
1223
  });
1223
- await registerModule("@radya/nuxt-dompurify", "dompurify", {});
1224
1224
  }
1225
1225
 
1226
1226
  export { module$1 as default };
File without changes
@@ -0,0 +1,29 @@
1
+ import { defineNuxtPlugin } from "#imports";
2
+ export default defineNuxtPlugin((nuxtApp) => {
3
+ let sanitize;
4
+ if (import.meta.server) {
5
+ sanitize = (html) => html;
6
+ } else {
7
+ let purify = null;
8
+ sanitize = (html) => {
9
+ if (purify) {
10
+ return purify.sanitize(html);
11
+ }
12
+ return html;
13
+ };
14
+ import("dompurify").then((DOMPurify) => {
15
+ purify = DOMPurify.default(window);
16
+ });
17
+ }
18
+ nuxtApp.vueApp.directive("sanitize-html", {
19
+ created(el, binding) {
20
+ el.innerHTML = sanitize(binding.value);
21
+ },
22
+ updated(el, binding) {
23
+ el.innerHTML = sanitize(binding.value);
24
+ },
25
+ getSSRProps(binding) {
26
+ return { innerHTML: sanitize(binding.value) };
27
+ }
28
+ });
29
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpnuxt/core",
3
- "version": "2.0.0-alpha.14",
3
+ "version": "2.0.0-alpha.15",
4
4
  "description": "Nuxt module for WordPress integration via GraphQL (WPGraphQL)",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@nuxt/kit": "4.3.1",
47
- "@radya/nuxt-dompurify": "^1.0.5",
47
+ "dompurify": "^3.1.7",
48
48
  "consola": "^3.4.0",
49
49
  "defu": "^6.1.4",
50
50
  "graphql": "^16.12.0",