@dargmuesli/nuxt-vio 9.0.0-beta.2 → 9.0.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ const copy = async (string: string) => {
25
25
  if (typeof window === 'undefined') return
26
26
 
27
27
  try {
28
- await navigator.clipboard.writeText(string)
28
+ await copyText(string)
29
29
  showToast({ title: t('donationUrlCopySuccess') })
30
30
  } catch (error: any) {
31
31
  alert(t('donationUrlCopyError'))
package/nuxt.config.ts CHANGED
@@ -18,7 +18,6 @@ export default defineNuxtConfig(
18
18
  defu(
19
19
  {
20
20
  alias: {
21
- clipboard: 'clipboard',
22
21
  dayjs: 'dayjs',
23
22
  sweetalert2: 'sweetalert2',
24
23
  }, // TODO: remove (https://github.com/nuxt/nuxt/issues/19426)
@@ -49,8 +48,9 @@ export default defineNuxtConfig(
49
48
  '@nuxtjs/html-validator',
50
49
  '@nuxtjs/i18n',
51
50
  '@nuxtjs/tailwindcss',
51
+ '@nuxtseo/module',
52
52
  '@pinia/nuxt',
53
- // nuxt-security: remove invalid `'none'`s
53
+ // nuxt-security: remove invalid `'none'`s and duplicates
54
54
  (_options, nuxt) => {
55
55
  const nuxtConfigSecurity = nuxt.options.security
56
56
 
@@ -74,16 +74,18 @@ export default defineNuxtConfig(
74
74
  string,
75
75
  any
76
76
  >
77
- )[key] = valueFiltered
77
+ )[key] = [...new Set(valueFiltered)]
78
78
  }
79
79
  }
80
80
  }
81
81
  },
82
82
  'nuxt-security',
83
- '@nuxtseo/module',
84
83
  ],
85
84
  nitro: {
86
85
  compressPublicAssets: true,
86
+ experimental: {
87
+ openAPI: process.env.NODE_ENV === 'development',
88
+ },
87
89
  },
88
90
  runtimeConfig: {
89
91
  public: {
@@ -177,7 +179,7 @@ export default defineNuxtConfig(
177
179
  // Cloudflare
178
180
  ...(process.env.NODE_ENV === 'production'
179
181
  ? {
180
- 'connect-src': [`${SITE_URL}/cdn-cgi/rum`],
182
+ 'connect-src': ["'self'"], // `${SITE_URL}/cdn-cgi/rum`
181
183
  'script-src-elem': [
182
184
  'https://static.cloudflareinsights.com',
183
185
  ],
@@ -199,6 +201,7 @@ export default defineNuxtConfig(
199
201
  },
200
202
  {
201
203
  // vio
204
+ 'connect-src': ["'self'"], // `${SITE_URL}/api/healthcheck`
202
205
  'manifest-src': [`${SITE_URL}/site.webmanifest`],
203
206
  'script-src-elem': [
204
207
  'https://polyfill.io/v3/polyfill.min.js', // ESLint plugin compat
@@ -206,19 +209,21 @@ export default defineNuxtConfig(
206
209
  },
207
210
  {
208
211
  // @nuxt/devtools
209
- 'frame-src': [
210
- ...(process.env.NODE_ENV === 'development'
211
- ? ['http://localhost:3000/__nuxt_devtools__/client/']
212
- : []),
213
- ],
212
+ ...(process.env.NODE_ENV === 'development'
213
+ ? {
214
+ 'frame-src': [
215
+ 'http://localhost:3000/__nuxt_devtools__/client/',
216
+ ],
217
+ }
218
+ : {}),
214
219
  },
215
220
  {
216
221
  // nuxt-link-checker
217
- 'connect-src': [
218
- ...(process.env.NODE_ENV === 'development'
219
- ? ['http://localhost:3000/api/__link_checker__/inspect']
220
- : []),
221
- ],
222
+ ...(process.env.NODE_ENV === 'development'
223
+ ? {
224
+ 'connect-src': ["'self'"], // 'http://localhost:3000/api/__link_checker__/inspect'
225
+ }
226
+ : {}),
222
227
  },
223
228
  {
224
229
  // nuxt-og-image
@@ -244,12 +249,12 @@ export default defineNuxtConfig(
244
249
  'connect-src': [
245
250
  ...(process.env.NODE_ENV === 'development'
246
251
  ? [
247
- 'http://localhost:3000/_nuxt/', // Nuxt development
248
- 'https://localhost:3000/_nuxt/', // Nuxt development
249
- 'ws://localhost:3000/_nuxt/', // Nuxt development
250
- 'wss://localhost:3000/_nuxt/', // Nuxt development
252
+ 'http://localhost:3000/_nuxt/', // hot reload
253
+ 'https://localhost:3000/_nuxt/', // hot reload
254
+ 'ws://localhost:3000/_nuxt/', // hot reload
255
+ 'wss://localhost:3000/_nuxt/', // hot reload
251
256
  ]
252
- : ["'self'"]), // Nuxt build metadata and payloads
257
+ : ["'self'"]), // build metadata and payloads
253
258
  ],
254
259
  'img-src': [
255
260
  "'self'", // TODO: replace with `"'nonce-{{nonce}}'",`
@@ -262,6 +267,18 @@ export default defineNuxtConfig(
262
267
  "'unsafe-inline'", // TODO: replace with `"'nonce-{{nonce}}'",` (https://github.com/vitejs/vite/pull/11864)
263
268
  ],
264
269
  },
270
+ {
271
+ // nitro
272
+ 'connect-src': ["'self'"] /* swagger
273
+ 'http://localhost:3000/_nitro/openapi.json',
274
+ 'http://localhost:3000/_nitro/swagger', */,
275
+ 'script-src-elem': [
276
+ 'https://cdn.jsdelivr.net/npm/', // swagger // TODO: increase precision (https://github.com/unjs/nitro/issues/1757)
277
+ ],
278
+ 'style-src': [
279
+ 'https://cdn.jsdelivr.net/npm/', // swagger // TODO: increase precision (https://github.com/unjs/nitro/issues/1757)
280
+ ],
281
+ },
265
282
  {
266
283
  // base
267
284
  'base-uri': ["'none'"], // does not fallback to `default-src`
@@ -325,6 +342,14 @@ export default defineNuxtConfig(
325
342
  tailwindcss: {
326
343
  cssPath: join(currentDir, './assets/css/tailwind.css'),
327
344
  },
345
+
346
+ // environments
347
+ $development: {
348
+ // modules
349
+ security: {
350
+ rateLimiter: false, // TODO: enable when nuxt-link-checker bundles requests (https://github.com/harlan-zw/nuxt-link-checker/issues/21)
351
+ },
352
+ },
328
353
  },
329
354
  VIO_NUXT_BASE_CONFIG({
330
355
  defaultLocale: 'en',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "9.0.0-beta.2",
3
+ "version": "9.0.0-beta.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dargmuesli/vio.git"
@@ -12,7 +12,7 @@
12
12
  "engines": {
13
13
  "node": "20"
14
14
  },
15
- "packageManager": "pnpm@8.9.2",
15
+ "packageManager": "pnpm@8.10.2",
16
16
  "files": [
17
17
  "assets",
18
18
  "components",
@@ -33,85 +33,55 @@
33
33
  "tailwind.config.ts"
34
34
  ],
35
35
  "main": "nuxt.config.ts",
36
- "scripts": {
37
- "build": "pnpm run build:node",
38
- "build:node": "nuxt build .playground",
39
- "build:static": "nuxt generate .playground",
40
- "build:static:test": "cross-env NODE_ENV=production SITE_URL=http://localhost:3002 pnpm run build:static",
41
- "dev": "pnpm run start:dev",
42
- "generate": "pnpm run build:static",
43
- "lint:fix": "pnpm run lint:js --fix && pnpm run lint:ts --fix && pnpm run lint:style --fix",
44
- "lint:js": "eslint --cache --ext .js,.ts,.vue --ignore-path .gitignore .",
45
- "lint:staged": "lint-staged",
46
- "lint:style": "stylelint --cache \"**/*.{vue,css}\" --ignore-path .gitignore",
47
- "lint:ts": "nuxt typecheck",
48
- "lint": "pnpm run lint:js && pnpm run lint:ts && pnpm run lint:style",
49
- "prepare": "nuxt prepare .playground",
50
- "preview": "nuxt preview .playground",
51
- "start:dev": "nuxt dev .playground",
52
- "start:node": "node .playground/.output/server/index.mjs",
53
- "start:static": "serve .playground/.output/public",
54
- "start:static:test": "cross-env NODE_ENV=production PORT=3002 SITE_URL=http://localhost:3002 pnpm run start:static",
55
- "test:e2e:docker:br": "pnpm run test:e2e:docker:build && pnpm run test:e2e:docker:run",
56
- "test:e2e:docker:build": "docker build -t test-e2e_base --build-arg UID=$(id -u) --build-arg GID=$(id -g) --target test-e2e_base ..",
57
- "test:e2e:docker:run": "docker run --rm -v \"$PWD/..:/srv/app\" -v \"$(pnpm store path):/srv/.pnpm-store\" test-e2e_base",
58
- "test:e2e:docker:server:dev:update": "pnpm run test:e2e:docker:server:dev --update-snapshots",
59
- "test:e2e:docker:server:dev": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:dev",
60
- "test:e2e:docker:server:node:update": "pnpm run test:e2e:docker:server:node --update-snapshots",
61
- "test:e2e:docker:server:node": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:node",
62
- "test:e2e:docker:server:static:update": "pnpm run test:e2e:docker:server:static --update-snapshots",
63
- "test:e2e:docker:server:static": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:static",
64
- "test:e2e:server:dev": "cross-env PORT=3000 SITE_URL=http://localhost:3000 VIO_SERVER=dev pnpm run test:e2e",
65
- "test:e2e:server:node": "cross-env NODE_ENV=production NUXT_PUBLIC_I18N_BASE_URL=http://localhost:3001 NUXT_PUBLIC_SITE_URL=http://localhost:3001 PORT=3001 VIO_SERVER=node pnpm run test:e2e",
66
- "test:e2e:server:static": "cross-env NODE_ENV=production PORT=3002 SITE_URL=http://localhost:3002 VIO_SERVER=static pnpm run test:e2e",
67
- "test:e2e": "playwright test"
68
- },
69
36
  "dependencies": {
70
- "@axe-core/playwright": "4.8.1",
71
- "@dargmuesli/nuxt-cookie-control": "7.0.1",
37
+ "@dargmuesli/nuxt-cookie-control": "7.1.1",
72
38
  "@heroicons/vue": "2.0.18",
73
39
  "@http-util/status-i18n": "0.8.1",
74
- "@intlify/eslint-plugin-vue-i18n": "3.0.0-next.4",
75
40
  "@nuxt/devtools": "1.0.0",
76
41
  "@nuxt/image": "1.0.0",
77
42
  "@nuxtjs/color-mode": "3.3.0",
78
- "@nuxtjs/eslint-config-typescript": "12.1.0",
79
43
  "@nuxtjs/html-validator": "1.5.2",
80
- "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge@8.0.0-rc.5-28296269.d5d5540",
81
- "@nuxtjs/tailwindcss": "6.8.0",
44
+ "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge@8.0.0-rc.5-28319130.4a511e8",
45
+ "@nuxtjs/tailwindcss": "6.9.4",
82
46
  "@nuxtseo/module": "2.0.0-beta.39",
83
47
  "@pinia/nuxt": "0.5.1",
84
- "@playwright/test": "1.39.0",
85
48
  "@tailwindcss/forms": "0.5.6",
86
49
  "@tailwindcss/typography": "0.5.10",
87
50
  "@types/lodash-es": "4.17.10",
88
- "@unhead/vue": "1.7.4",
51
+ "@vuelidate/core": "2.0.3",
52
+ "@vuelidate/validators": "2.0.4",
53
+ "clipboardy": "4.0.0",
54
+ "dayjs": "2.0.0-alpha.4",
55
+ "jose": "5.1.0",
56
+ "nuxt-security": "1.0.0-rc.2",
57
+ "sweetalert2": "11.9.0",
58
+ "vue-gtag": "2.0.1"
59
+ },
60
+ "devDependencies": {
61
+ "@axe-core/playwright": "4.8.1",
62
+ "@intlify/eslint-plugin-vue-i18n": "3.0.0-next.4",
63
+ "@nuxtjs/eslint-config-typescript": "12.1.0",
64
+ "@playwright/test": "1.39.0",
65
+ "@unhead/vue": "1.8.3",
89
66
  "@urql/core": "4.1.4",
90
67
  "@urql/devtools": "2.0.3",
91
68
  "@urql/exchange-graphcache": "6.3.3",
92
69
  "@urql/vue": "1.1.2",
93
- "@vuelidate/core": "2.0.3",
94
- "@vuelidate/validators": "2.0.4",
95
- "clipboard": "2.0.11",
96
70
  "consola": "3.2.3",
97
71
  "cookie-es": "1.0.0",
98
72
  "cross-env": "7.0.3",
99
- "dayjs": "2.0.0-alpha.4",
100
- "defu": "6.1.2",
101
- "eslint": "8.52.0",
73
+ "defu": "6.1.3",
74
+ "eslint": "8.53.0",
102
75
  "eslint-config-prettier": "9.0.0",
103
76
  "eslint-plugin-compat": "4.2.0",
104
77
  "eslint-plugin-nuxt": "4.0.0",
105
78
  "eslint-plugin-prettier": "5.0.1",
106
79
  "eslint-plugin-yml": "1.10.0",
107
80
  "h3": "1.8.2",
108
- "is-https": "4.0.0",
109
- "jiti": "1.20.0",
110
- "jose": "4.15.4",
81
+ "jiti": "1.21.0",
111
82
  "lint-staged": "15.0.2",
112
83
  "lodash-es": "4.17.21",
113
- "nuxt": "3.8.0",
114
- "nuxt-security": "1.0.0-rc.2",
84
+ "nuxt": "3.8.1",
115
85
  "ofetch": "1.3.3",
116
86
  "pinia": "2.1.7",
117
87
  "prettier": "3.0.3",
@@ -121,16 +91,50 @@
121
91
  "stylelint-config-recommended-vue": "1.5.0",
122
92
  "stylelint-config-standard": "34.0.0",
123
93
  "stylelint-no-unsupported-browser-features": "7.0.0",
124
- "sweetalert2": "11.7.32",
125
- "tailwindcss": "3.3.3",
94
+ "tailwindcss": "3.3.5",
126
95
  "ufo": "1.3.1",
127
- "unhead": "1.7.4",
128
- "vue": "3.3.6",
129
- "vue-gtag": "2.0.1",
96
+ "unhead": "1.8.0-beta.2",
97
+ "vue": "3.3.8",
130
98
  "vue-router": "4.2.5",
131
- "vue-tsc": "1.8.19"
99
+ "vue-tsc": "1.8.22"
132
100
  },
133
101
  "peerDependencies": {
134
- "playwright-core": "1.39.0"
102
+ "playwright-core": "1.39.0",
103
+ "nuxt": "3.8.1",
104
+ "vue": "3.3.8",
105
+ "vue-router": "4.2.5"
106
+ },
107
+ "scripts": {
108
+ "build": "pnpm run build:node",
109
+ "build:node": "nuxt build .playground",
110
+ "build:static": "nuxt generate .playground",
111
+ "build:static:test": "cross-env NODE_ENV=production SITE_URL=http://localhost:3002 pnpm run build:static",
112
+ "dev": "pnpm run start:dev",
113
+ "generate": "pnpm run build:static",
114
+ "lint:fix": "pnpm run lint:js --fix && pnpm run lint:ts --fix && pnpm run lint:style --fix",
115
+ "lint:js": "eslint --cache --ext .js,.ts,.vue --ignore-path .gitignore .",
116
+ "lint:staged": "lint-staged",
117
+ "lint:style": "stylelint --cache \"**/*.{vue,css}\" --ignore-path .gitignore",
118
+ "lint:ts": "nuxt typecheck",
119
+ "lint": "pnpm run lint:js && pnpm run lint:ts && pnpm run lint:style",
120
+ "prepare": "nuxt prepare .playground",
121
+ "preview": "nuxt preview .playground",
122
+ "start:dev": "nuxt dev .playground",
123
+ "start:node": "node .playground/.output/server/index.mjs",
124
+ "start:static": "serve .playground/.output/public",
125
+ "start:static:test": "cross-env NODE_ENV=production PORT=3002 SITE_URL=http://localhost:3002 pnpm run start:static",
126
+ "test:e2e:docker:br": "pnpm run test:e2e:docker:build && pnpm run test:e2e:docker:run",
127
+ "test:e2e:docker:build": "docker build -t test-e2e_base --build-arg UID=$(id -u) --build-arg GID=$(id -g) --target test-e2e_base ..",
128
+ "test:e2e:docker:run": "docker run --rm -v \"$PWD/..:/srv/app\" -v \"$(pnpm store path):/srv/.pnpm-store\" test-e2e_base",
129
+ "test:e2e:docker:server:dev:update": "pnpm run test:e2e:docker:server:dev --update-snapshots",
130
+ "test:e2e:docker:server:dev": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:dev",
131
+ "test:e2e:docker:server:node:update": "pnpm run test:e2e:docker:server:node --update-snapshots",
132
+ "test:e2e:docker:server:node": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:node",
133
+ "test:e2e:docker:server:static:update": "pnpm run test:e2e:docker:server:static --update-snapshots",
134
+ "test:e2e:docker:server:static": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:static",
135
+ "test:e2e:server:dev": "cross-env PORT=3000 SITE_URL=http://localhost:3000 VIO_SERVER=dev pnpm run test:e2e",
136
+ "test:e2e:server:node": "cross-env NODE_ENV=production NUXT_PUBLIC_I18N_BASE_URL=http://localhost:3001 NUXT_PUBLIC_SITE_URL=http://localhost:3001 PORT=3001 VIO_SERVER=node pnpm run test:e2e",
137
+ "test:e2e:server:static": "cross-env NODE_ENV=production PORT=3002 SITE_URL=http://localhost:3002 VIO_SERVER=static pnpm run test:e2e",
138
+ "test:e2e": "playwright test"
135
139
  }
136
140
  }
@@ -1,5 +1,3 @@
1
- import { defineEventHandler } from 'h3'
2
-
3
1
  export default defineEventHandler((event) => {
4
2
  const { res } = event.node
5
3
  res.setHeader('Content-Type', 'text/plain')
@@ -1,10 +1,6 @@
1
- import { appendHeader, defineEventHandler } from 'h3'
2
1
  import type { H3Event } from 'h3'
3
2
  import type { AppConfig } from 'nuxt/schema'
4
3
 
5
- import { TIMEZONE_HEADER_KEY } from '../../utils/constants'
6
- import { getTimezone } from '../../utils/networking'
7
-
8
4
  export default defineEventHandler(async (event) => {
9
5
  setRequestHeader(event, TIMEZONE_HEADER_KEY, await getTimezone(event))
10
6
  setResponseHeaders(event)
@@ -0,0 +1,2 @@
1
+ export { TIMEZONE_HEADER_KEY } from '../../utils/constants'
2
+ export { getTimezone } from '../../utils/networking'
package/utils/text.ts CHANGED
@@ -1,20 +1,3 @@
1
- import Clipboard from 'clipboard'
1
+ import clipboard from 'clipboardy'
2
2
 
3
- export const copyText = (text: string) =>
4
- new Promise((resolve, reject) => {
5
- const fakeElement = document.createElement('button')
6
- const clipboard = new Clipboard(fakeElement, {
7
- text: () => text,
8
- action: () => 'copy',
9
- container: document.body,
10
- })
11
- clipboard.on('success', (e) => {
12
- clipboard.destroy()
13
- resolve(e)
14
- })
15
- clipboard.on('error', (e) => {
16
- clipboard.destroy()
17
- reject(e)
18
- })
19
- fakeElement.click()
20
- })
3
+ export const copyText = async (text: string) => await clipboard.write(text)