Skip to content

Commit

Permalink
feat: add uuid utility function
Browse files Browse the repository at this point in the history
fix: replace uuid with uuid-random for better node support
  • Loading branch information
Rapid0o committed Mar 30, 2022
1 parent 51f9219 commit 413bcd9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@afosto/instant-search-client",
"version": "1.0.5",
"version": "1.0.6",
"private": false,
"description": "The Afosto InstantSearch client",
"main": "./dist/afosto-instant-search.min.js",
Expand Down Expand Up @@ -54,7 +54,7 @@
"webpack-dev-server": "^4.6.0"
},
"dependencies": {
"uuid": "^8.3.2"
"uuid-random": "^1.3.2"
},
"browserslist": [
">0.2%",
Expand Down
3 changes: 3 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ module.exports = [
{
input: INPUT,
plugins: [nodeResolve()],
external: [
'uuid-random',
],
output: [
{
dir: 'dist/esm',
Expand Down
2 changes: 1 addition & 1 deletion src/afostoInstantSearch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { v4 as uuid } from 'uuid';
import { SearchResponseAdapter, SearchRequestAdapter } from './adapters';
import { DEFAULT_OPTIONS } from './constants';
import getSessionID from './utils/getSessionID';
import uuid from './utils/uuid';

/**
* Afosto instant search client
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getSessionID.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { v4 as uuid } from 'uuid';
import { SESSION_KEY } from '../constants';
import uuid from '../utils/uuid';

const getSessionID = () => {
const isBrowser = typeof window !== 'undefined';
Expand Down
5 changes: 5 additions & 0 deletions src/utils/uuid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import uuidv4 from 'uuid-random';

const uuid = () => uuidv4();

export default uuid;
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3916,6 +3916,11 @@ utils-merge@1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=

uuid-random@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/uuid-random/-/uuid-random-1.3.2.tgz#96715edbaef4e84b1dcf5024b00d16f30220e2d0"
integrity sha512-UOzej0Le/UgkbWEO8flm+0y+G+ljUon1QWTEZOq1rnMAsxo2+SckbiZdKzAHHlVh6gJqI1TjC/xwgR50MuCrBQ==

uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
Expand Down

0 comments on commit 413bcd9

Please sign in to comment.