From 396afdec2655fca980bfa4ee60c6d7e9b2effde1 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Tue, 30 Apr 2024 18:06:29 +0200 Subject: [PATCH] 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 - }) - }); + })})` + ); } }