From 5c162218846007ca133968a9b7887ef873aaef34 Mon Sep 17 00:00:00 2001 From: Raju Ahmed Date: Thu, 8 May 2025 19:50:45 +0600 Subject: [PATCH 1/2] [FSSDK-11500] publish ua_parser as a separate bundle --- .../{ua_parser.browser.ts => ua_parser.ts} | 2 - package-lock.json | 23 --------- package.json | 13 +++-- rollup.config.js | 47 +++++++++++++++++++ 4 files changed, 57 insertions(+), 28 deletions(-) rename lib/odp/ua_parser/{ua_parser.browser.ts => ua_parser.ts} (99%) diff --git a/lib/odp/ua_parser/ua_parser.browser.ts b/lib/odp/ua_parser/ua_parser.ts similarity index 99% rename from lib/odp/ua_parser/ua_parser.browser.ts rename to lib/odp/ua_parser/ua_parser.ts index 522c538be..8622b0ade 100644 --- a/lib/odp/ua_parser/ua_parser.browser.ts +++ b/lib/odp/ua_parser/ua_parser.ts @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import { UAParser } from 'ua-parser-js'; import { UserAgentInfo } from './user_agent_info'; import { UserAgentParser } from './user_agent_parser'; @@ -30,4 +29,3 @@ const userAgentParser: UserAgentParser = { export function getUserAgentParser(): UserAgentParser { return userAgentParser; } - diff --git a/package-lock.json b/package-lock.json index 228e10949..331bb0974 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,6 @@ "decompress-response": "^7.0.0", "json-schema": "^0.4.0", "murmurhash": "^2.0.1", - "ua-parser-js": "^1.0.38", "uuid": "^9.0.1" }, "devDependencies": { @@ -15925,28 +15924,6 @@ "node": ">=4.2.0" } }, - "node_modules/ua-parser-js": { - "version": "1.0.38", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.38.tgz", - "integrity": "sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/ua-parser-js" - }, - { - "type": "paypal", - "url": "https://paypal.me/faisalman" - }, - { - "type": "github", - "url": "https://github.com/sponsors/faisalman" - } - ], - "engines": { - "node": "*" - } - }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", diff --git a/package.json b/package.json index 3de7bad9e..9cda5e665 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ }, "./browser": { "types": "./dist/index.d.ts", - "import": "./dist/index.browser.es.min.js", - "require": "./dist/index.browser.min.js" + "import": "./dist/index.browser.es.min.js", + "require": "./dist/index.browser.min.js" }, "./react_native": { "types": "./dist/index.d.ts", @@ -46,6 +46,11 @@ "types": "./dist/index.universal.d.ts", "import": "./dist/index.universal.es.min.js", "require": "./dist/index.universal.min.js" + }, + "./ua_parser": { + "types": "./dist/odp/ua_parser/ua_parser.d.ts", + "import": "./dist/ua_parser.es.min.js", + "require": "./dist/ua_parser.min.js" } }, "scripts": { @@ -89,7 +94,6 @@ "decompress-response": "^7.0.0", "json-schema": "^0.4.0", "murmurhash": "^2.0.1", - "ua-parser-js": "^1.0.38", "uuid": "^9.0.1" }, "devDependencies": { @@ -160,6 +164,9 @@ }, "fast-text-encoding": { "optional": true + }, + "ua-parser-js": { + "optional": true } }, "publishConfig": { diff --git a/rollup.config.js b/rollup.config.js index 2fc077a83..f7cc6c247 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -93,6 +93,51 @@ const esmBundleFor = (platform, opt) => { } }; +const cjsBundleForUAParser = (opt = {}) => { + const { minify, ext } = { + minify: true, + ext: '.js', + ...opt, + }; + + const min = minify ? '.min' : ''; + + return { + plugins: [resolve(), commonjs(), typescript(typescriptPluginOptions)], + external: ['https', 'http', 'url'].concat(Object.keys({ ...dependencies, ...peerDependencies } || {})), + input: `lib/odp/ua_parser/ua_parser.ts`, + output: { + exports: 'named', + format: 'cjs', + file: `dist/ua_parser${min}${ext}`, + plugins: minify ? [terser()] : undefined, + sourcemap: true, + }, + }; +}; + +const esmBundleForUAParser = (opt = {}) => { + const { minify, ext } = { + minify: true, + ext: '.js', + ...opt, + }; + + const min = minify ? '.min' : ''; + + return { + ...cjsBundleForUAParser(), + output: [ + { + format: 'es', + file: `dist/ua_parser.es${min}${ext}`, + plugins: minify ? [terser()] : undefined, + sourcemap: true, + }, + ], + }; +}; + const umdBundle = { plugins: [ resolve({ browser: true }), @@ -147,6 +192,8 @@ const bundles = { 'esm-react-native-min': esmBundleFor('react_native'), 'esm-universal': esmBundleFor('universal'), 'json-schema': jsonSchemaBundle, + 'cjs-ua-parser-min': cjsBundleForUAParser(), + 'esm-ua-parser-min': esmBundleForUAParser(), umd: umdBundle, }; From de5fd39801cab3cd424942940a8eaa6e34363e0e Mon Sep 17 00:00:00 2001 From: Raju Ahmed Date: Thu, 8 May 2025 20:01:15 +0600 Subject: [PATCH 2/2] up --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9cda5e665..6aaac97d4 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,8 @@ "@react-native-async-storage/async-storage": "^1.2.0", "@react-native-community/netinfo": "^11.3.2", "fast-text-encoding": "^1.0.6", - "react-native-get-random-values": "^1.11.0" + "react-native-get-random-values": "^1.11.0", + "ua-parser-js": "^1.0.38" }, "peerDependenciesMeta": { "@react-native-async-storage/async-storage": { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy