Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -30,4 +29,3 @@ const userAgentParser: UserAgentParser = {
export function getUserAgentParser(): UserAgentParser {
return userAgentParser;
}

23 changes: 0 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -146,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": {
Expand All @@ -160,6 +165,9 @@
},
"fast-text-encoding": {
"optional": true
},
"ua-parser-js": {
"optional": true
}
},
"publishConfig": {
Expand Down
47 changes: 47 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down Expand Up @@ -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,
};

Expand Down
Loading