Skip to content

Commit

Permalink
Merge pull request #228 from dargmuesli/feat/polyfills/reenable
Browse files Browse the repository at this point in the history
feat(polyfills): reenable
  • Loading branch information
dargmuesli committed Sep 13, 2024
2 parents b9e95ae + 788ac5f commit c6eff13
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/components/vio/_/VioApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ defineOgImageComponent(
)
useAppLayout()
useFavicons()
// usePolyfills() // hijacked ⚠️
usePolyfills()
useSchemaOrg([
defineWebSite({
description: siteConfig.description,
Expand Down
1 change: 0 additions & 1 deletion src/composables/useAppLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const useAppLayout = () => {
},
})

// TODO: convert to `useServerHeadSafe` (https://github.com/unjs/unhead/issues/221)
// adding `Server` leads incorrect title template on hydration
useSeoMeta({
titleTemplate: (title) =>
Expand Down
3 changes: 1 addition & 2 deletions src/composables/usePolyfills.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { POLYFILLS } from '../utils/constants'

export const usePolyfills = () => {
return // hijacked ⚠️
if (!POLYFILLS.length) return

const polyfillsUrl = `https://polyfill.io/v3/polyfill.min.js?features=${POLYFILLS.join(
const polyfillsUrl = `https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=${POLYFILLS.join(
'%2C',
)}&flags=gated`

Expand Down
8 changes: 4 additions & 4 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export const GET_CSP = (siteUrl: string) =>
{
// vio
'manifest-src': [`${siteUrl}/site.webmanifest`],
// 'script-src-elem': [
// 'https://polyfill.io/v3/polyfill.min.js', // ESLint plugin compat
// ],
'script-src-elem': [
'https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js', // ESLint plugin compat
],
},
// {
// // nuxt-link-checker
Expand Down Expand Up @@ -155,7 +155,7 @@ export const I18N_VUE_CONFIG = {
export const JWT_NAME = () =>
`${process.env.NODE_ENV === 'production' ? '__Secure-' : ''}jwt`
export const POLYFILLS = [
// 'Promise', // op_mini
'Promise', // op_mini
]
export const REGEX_UUID =
/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
base-uri 'none'; default-src 'none'; connect-src https://cloudflareinsights.com https://*.analytics.google.com https://*.google-analytics.com https://*.googletagmanager.com 'self'; form-action 'none'; frame-ancestors 'none'; img-src https://*.google-analytics.com https://*.googletagmanager.com 'self' data:; manifest-src http://localhost:3001/site.webmanifest 'self'; style-src 'unsafe-inline' 'self'; report-to csp-endpoint; report-uri https://o4507259039973376.ingest.de.sentry.io/api/4507260561653840/security/?sentry_key=1e53178c1dba9b39147de4a21853a3e3; script-src-elem https://static.cloudflareinsights.com http://localhost:3001/cdn-cgi/scripts/ https://*.googletagmanager.com 'nonce' http://localhost:3001/_nuxt/;
base-uri 'none'; default-src 'none'; connect-src https://cloudflareinsights.com https://*.analytics.google.com https://*.google-analytics.com https://*.googletagmanager.com 'self'; form-action 'none'; frame-ancestors 'none'; img-src https://*.google-analytics.com https://*.googletagmanager.com 'self' data:; manifest-src http://localhost:3001/site.webmanifest 'self'; style-src 'unsafe-inline' 'self'; report-to csp-endpoint; report-uri https://o4507259039973376.ingest.de.sentry.io/api/4507260561653840/security/?sentry_key=1e53178c1dba9b39147de4a21853a3e3; script-src-elem https://static.cloudflareinsights.com http://localhost:3001/cdn-cgi/scripts/ https://*.googletagmanager.com https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js 'nonce' http://localhost:3001/_nuxt/;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
base-uri 'none'; default-src 'none'; connect-src https://cloudflareinsights.com https://*.analytics.google.com https://*.google-analytics.com https://*.googletagmanager.com 'self'; form-action 'none'; frame-ancestors 'none'; img-src https://*.google-analytics.com https://*.googletagmanager.com 'self' data:; manifest-src http://localhost:3001/site.webmanifest 'self'; style-src 'unsafe-inline' 'self'; report-to csp-endpoint; report-uri https://o4507259039973376.ingest.de.sentry.io/api/4507260561653840/security/?sentry_key=1e53178c1dba9b39147de4a21853a3e3; script-src-elem https://static.cloudflareinsights.com http://localhost:3001/cdn-cgi/scripts/ https://*.googletagmanager.com 'nonce' http://localhost:3001/_nuxt/;
base-uri 'none'; default-src 'none'; connect-src https://cloudflareinsights.com https://*.analytics.google.com https://*.google-analytics.com https://*.googletagmanager.com 'self'; form-action 'none'; frame-ancestors 'none'; img-src https://*.google-analytics.com https://*.googletagmanager.com 'self' data:; manifest-src http://localhost:3001/site.webmanifest 'self'; style-src 'unsafe-inline' 'self'; report-to csp-endpoint; report-uri https://o4507259039973376.ingest.de.sentry.io/api/4507260561653840/security/?sentry_key=1e53178c1dba9b39147de4a21853a3e3; script-src-elem https://static.cloudflareinsights.com http://localhost:3001/cdn-cgi/scripts/ https://*.googletagmanager.com https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js 'nonce' http://localhost:3001/_nuxt/;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
base-uri 'none'; default-src 'none'; connect-src https://cloudflareinsights.com https://*.analytics.google.com https://*.google-analytics.com https://*.googletagmanager.com 'self'; form-action 'none'; frame-ancestors 'none'; img-src https://*.google-analytics.com https://*.googletagmanager.com 'self' data:; manifest-src http://localhost:3001/site.webmanifest 'self'; style-src 'unsafe-inline' 'self'; report-to csp-endpoint; report-uri https://o4507259039973376.ingest.de.sentry.io/api/4507260561653840/security/?sentry_key=1e53178c1dba9b39147de4a21853a3e3; script-src-elem https://static.cloudflareinsights.com http://localhost:3001/cdn-cgi/scripts/ https://*.googletagmanager.com 'nonce' http://localhost:3001/_nuxt/;
base-uri 'none'; default-src 'none'; connect-src https://cloudflareinsights.com https://*.analytics.google.com https://*.google-analytics.com https://*.googletagmanager.com 'self'; form-action 'none'; frame-ancestors 'none'; img-src https://*.google-analytics.com https://*.googletagmanager.com 'self' data:; manifest-src http://localhost:3001/site.webmanifest 'self'; style-src 'unsafe-inline' 'self'; report-to csp-endpoint; report-uri https://o4507259039973376.ingest.de.sentry.io/api/4507260561653840/security/?sentry_key=1e53178c1dba9b39147de4a21853a3e3; script-src-elem https://static.cloudflareinsights.com http://localhost:3001/cdn-cgi/scripts/ https://*.googletagmanager.com https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js 'nonce' http://localhost:3001/_nuxt/;
46 changes: 23 additions & 23 deletions tests/e2e/utils/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@ export const testMetadata = async ({
{ key: 'lang', value: 'en' },
],
},
// {
// tag: 'link',
// attributes: [
// {
// key: 'data-testid',
// value: 'polyfill-preload',
// },
// { key: 'rel', value: 'preload' },
// {
// key: 'href',
// value:
// 'https://polyfill.io/v3/polyfill.min.js?features=Promise&flags=gated',
// },
// {
// key: 'crossorigin',
// value: 'anonymous',
// },
// {
// key: 'as',
// value: 'script',
// },
// ],
// },
{
tag: 'link',
attributes: [
{
key: 'data-testid',
value: 'polyfill-preload',
},
{ key: 'rel', value: 'preload' },
{
key: 'href',
value:
'https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=Promise&flags=gated',
},
{
key: 'crossorigin',
value: 'anonymous',
},
{
key: 'as',
value: 'script',
},
],
},
{
tag: 'meta',
attributes: [
Expand Down

0 comments on commit c6eff13

Please sign in to comment.