From 396afdec2655fca980bfa4ee60c6d7e9b2effde1 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Tue, 30 Apr 2024 18:06:29 +0200 Subject: [PATCH 1/7] fix(module): remove `serialize-to-js` --- build.config.js | 1 - package-lock.json | 9 --------- package.json | 1 - src/utils/browser.js | 12 +++++++----- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/build.config.js b/build.config.js index 9f1efc8719..4b87aef1a0 100644 --- a/build.config.js +++ b/build.config.js @@ -18,7 +18,6 @@ export default { 'htmlparser2', 'image-meta', 'pathe', - 'serialize-to-js', 'sort-css-media-queries', 'vue3-lazy-hydration', 'mime-types', diff --git a/package-lock.json b/package-lock.json index 66981c5e57..febcf3b65b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,6 @@ "htmlparser2": "9.1.0", "image-meta": "0.2.0", "pathe": "1.1.2", - "serialize-to-js": "3.1.2", "sort-css-media-queries": "2.2.0", "vue3-lazy-hydration": "1.2.1" }, @@ -19624,14 +19623,6 @@ "randombytes": "^2.1.0" } }, - "node_modules/serialize-to-js": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/serialize-to-js/-/serialize-to-js-3.1.2.tgz", - "integrity": "sha512-owllqNuDDEimQat7EPG0tH7JjO090xKNzUtYz6X+Sk2BXDnOCilDdNLwjWeFywG9xkJul1ULvtUQa9O4pUaY0w==", - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/serve-placeholder": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/serve-placeholder/-/serve-placeholder-2.0.1.tgz", diff --git a/package.json b/package.json index fc05dd1ca0..277067da71 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "htmlparser2": "9.1.0", "image-meta": "0.2.0", "pathe": "1.1.2", - "serialize-to-js": "3.1.2", "sort-css-media-queries": "2.2.0", "vue3-lazy-hydration": "1.2.1" }, diff --git a/src/utils/browser.js b/src/utils/browser.js index adc0318f22..d95d51feff 100644 --- a/src/utils/browser.js +++ b/src/utils/browser.js @@ -1,16 +1,18 @@ -import serialize from 'serialize-to-js'; import { getUserAgentRegex } from 'browserslist-useragent-regexp'; function getSupportedBrowserDetector(ignore) { if (ignore) { return JSON.stringify({ regex: '' }); } else { - return serialize({ - regex: getUserAgentRegex({ + return JSON.stringify({ + regex: 'value' + }).replace( + '"value"', + `new RegExp(${getUserAgentRegex({ allowHigherVersions: true, allowZeroSubversions: true - }) - }); + })})` + ); } } From d8796c667353d065611c6d1ae66f650cad8628c2 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Tue, 30 Apr 2024 18:17:41 +0200 Subject: [PATCH 2/7] fix(composables): fix rollup warnings --- src/module.js | 15 ++------------- src/runtime/components/BoosterIframe.vue | 2 -- src/runtime/composables/index.js | 5 ----- ...Observer.js => useBoosterComponentObserver.js} | 0 .../{config.js => useBoosterConfig.js} | 0 .../{critical.js => useBoosterCritical.js} | 0 .../composables/{fonts.js => useBoosterFonts.js} | 0 .../composables/{head.js => useBoosterHead.js} | 0 8 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 src/runtime/composables/index.js rename src/runtime/composables/{componentObserver.js => useBoosterComponentObserver.js} (100%) rename src/runtime/composables/{config.js => useBoosterConfig.js} (100%) rename src/runtime/composables/{critical.js => useBoosterCritical.js} (100%) rename src/runtime/composables/{fonts.js => useBoosterFonts.js} (100%) rename src/runtime/composables/{head.js => useBoosterHead.js} (100%) diff --git a/src/module.js b/src/module.js index d71d2d346b..af9a5ca2a0 100644 --- a/src/module.js +++ b/src/module.js @@ -1,7 +1,7 @@ import { resolve, join } from 'pathe'; import { - addImports, + addImportsDir, createResolver, defineNuxtModule, addPluginTemplate, @@ -83,18 +83,7 @@ export default defineNuxtModule({ await addBuildTemplates(nuxt, moduleOptions); - addImports( - [ - 'useBoosterComponentObserver', - 'useBoosterCritical', - 'useBoosterConfig', - 'useBoosterFonts', - 'useBoosterHead' - ].map(name => ({ - name, - from: resolve(runtimeDir, 'composables/index') - })) - ); + addImportsDir(resolve(runtimeDir, 'composables')); } }); diff --git a/src/runtime/components/BoosterIframe.vue b/src/runtime/components/BoosterIframe.vue index 9e417fc306..ee536aaacc 100644 --- a/src/runtime/components/BoosterIframe.vue +++ b/src/runtime/components/BoosterIframe.vue @@ -12,8 +12,6 @@