This is an automated email from the ASF dual-hosted git repository.
Antonio-Maranhao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/main by this push:
new 5e467cec Remove uuid package (#1525)
5e467cec is described below
commit 5e467cec3923715343a4d41c0072e11f1f607dbd
Author: Antonio Maranhao <[email protected]>
AuthorDate: Fri Apr 24 22:59:08 2026 -0400
Remove uuid package (#1525)
Fauxton only uses v4 uuid which can be generated with the built-in
crypto.randomUUID(), so using the external uuid package is no longer
necessary.
Also the uuid package has been ESM only since v11 which causes problems
with the Jest tests.
---
app/addons/components/__tests__/copy.test.js | 10 +++++-----
app/addons/documents/changes/components/ChangeRow.js | 5 ++---
.../documents/designdocinfo/components/DesignDocInfo.js | 3 +--
.../documents/index-results/components/results/TableRow.js | 3 +--
.../notifications/components/NotificationPanelRow.js | 4 ++--
app/core/api.js | 5 +++++
package-lock.json | 14 --------------
package.json | 1 -
8 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/app/addons/components/__tests__/copy.test.js
b/app/addons/components/__tests__/copy.test.js
index fd128df3..ff75abb3 100644
--- a/app/addons/components/__tests__/copy.test.js
+++ b/app/addons/components/__tests__/copy.test.js
@@ -12,27 +12,27 @@
import { Copy } from "../components/copy";
import { mount } from "enzyme";
import React from "react";
-import { v4 as uuidv4 } from 'uuid';
+import FauxtonAPI from "../../../core/api";
describe('Copy', () => {
it('shows a copy icon by default', () => {
- const wrapper = mount(<Copy uniqueKey={uuidv4()} text="copy me"/>);
+ const wrapper = mount(<Copy uniqueKey={FauxtonAPI.uuid()} text="copy
me"/>);
expect(wrapper.find('.fonticon-copy').length).toBe(1);
});
it('shows text if specified', () => {
- const wrapper = mount(<Copy uniqueKey={uuidv4()} text="copy me"
displayType="text" />);
+ const wrapper = mount(<Copy uniqueKey={FauxtonAPI.uuid()} text="copy me"
displayType="text" />);
expect(wrapper.find('.fonticon-copy').length).toBe(0);
});
it('shows custom text if specified', () => {
- const wrapper = mount(<Copy uniqueKey={uuidv4()} displayType="text"
textDisplay="booyah!" text="copy me" />);
+ const wrapper = mount(<Copy uniqueKey={FauxtonAPI.uuid()}
displayType="text" textDisplay="booyah!" text="copy me" />);
expect(wrapper.html()).toMatch(/booyah!/);
});
it('shows an input field and button if specified', () => {
- const wrapper = mount(<Copy uniqueKey={uuidv4()} displayType='input'
text="http://localhost:8000/_all_dbs" />);
+ const wrapper = mount(<Copy uniqueKey={FauxtonAPI.uuid()}
displayType='input' text="http://localhost:8000/_all_dbs" />);
expect(wrapper.find('input').length).toBe(1);
});
});
diff --git a/app/addons/documents/changes/components/ChangeRow.js
b/app/addons/documents/changes/components/ChangeRow.js
index af543bea..d2f11e0d 100644
--- a/app/addons/documents/changes/components/ChangeRow.js
+++ b/app/addons/documents/changes/components/ChangeRow.js
@@ -12,7 +12,6 @@
import PropTypes from 'prop-types';
import React from 'react';
-import { v4 as uuidv4 } from 'uuid';
import FauxtonAPI from '../../../../core/api';
import Components from '../../../fauxton/components';
import ReactComponents from '../../../components/react-components';
@@ -71,7 +70,7 @@ export default class ChangeRow extends React.Component {
<div className="col-8 change-sequence">{change.seq}</div>
<div className="col-2 align-middle text-end">
<Copy
- uniqueKey={uuidv4()}
+ uniqueKey={FauxtonAPI.uuid()}
text={change.seq.toString()}
onClipboardClick={() => this.showCopiedMessage('seq')} />
</div>
@@ -84,7 +83,7 @@ export default class ChangeRow extends React.Component {
</div>
<div className="col-2 text-end">
<Copy
- uniqueKey={uuidv4()}
+ uniqueKey={FauxtonAPI.uuid()}
text={change.id}
onClipboardClick={() => this.showCopiedMessage('id')} />
</div>
diff --git a/app/addons/documents/designdocinfo/components/DesignDocInfo.js
b/app/addons/documents/designdocinfo/components/DesignDocInfo.js
index 26e63656..1bf05701 100644
--- a/app/addons/documents/designdocinfo/components/DesignDocInfo.js
+++ b/app/addons/documents/designdocinfo/components/DesignDocInfo.js
@@ -12,7 +12,6 @@
import PropTypes from 'prop-types';
import React from 'react';
-import { v4 as uuidv4 } from 'uuid';
import FauxtonAPI from '../../../../core/api';
import ReactComponents from '../../../components/react-components';
@@ -128,7 +127,7 @@ export default class DesignDocInfo extends React.Component {
<li>
<span className="item-title">MD5 Signature:</span>
<Copy
- uniqueKey={uuidv4()}
+ uniqueKey={FauxtonAPI.uuid()}
text={viewIndex.signature}
onClipboardClick={this.showCopiedMessage} />
</li>
diff --git a/app/addons/documents/index-results/components/results/TableRow.js
b/app/addons/documents/index-results/components/results/TableRow.js
index 4a7d9627..09e21ce1 100644
--- a/app/addons/documents/index-results/components/results/TableRow.js
+++ b/app/addons/documents/index-results/components/results/TableRow.js
@@ -13,7 +13,6 @@
import classnames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
-import { v4 as uuidv4 } from 'uuid';
import FauxtonAPI from '../../../../../core/api';
import Components from '../../../../components/react-components';
import Constants from '../../../constants';
@@ -119,7 +118,7 @@ export default class TableRow extends React.Component {
<Copy
title={text}
text={text}
- uniqueKey={uuidv4()}
+ uniqueKey={FauxtonAPI.uuid()}
onClipboardClick={this.showCopiedMessage} />
</td>
);
diff --git
a/app/addons/fauxton/notifications/components/NotificationPanelRow.js
b/app/addons/fauxton/notifications/components/NotificationPanelRow.js
index 36e1d6a3..868cd767 100644
--- a/app/addons/fauxton/notifications/components/NotificationPanelRow.js
+++ b/app/addons/fauxton/notifications/components/NotificationPanelRow.js
@@ -12,7 +12,7 @@
import PropTypes from 'prop-types';
import React from 'react';
-import { v4 as uuidv4 } from 'uuid';
+import FauxtonAPI from '../../../../core/api';
import Components from '../../../components/react-components';
const {Copy} = Components;
@@ -50,7 +50,7 @@ export default class NotificationPanelRow extends
React.Component {
<div className="notification-actions">
<span className="time-elapsed">{timeElapsed}</span>
<span className="divider">|</span>
- <Copy uniqueKey={uuidv4()} text={this.props.item.cleanMsg}
displayType="text" />
+ <Copy uniqueKey={FauxtonAPI.uuid()}
text={this.props.item.cleanMsg} displayType="text" />
</div>
</div>
<button type="button" onClick={this.clearNotification}>×</button>
diff --git a/app/core/api.js b/app/core/api.js
index 7927397d..ec1bb6f8 100644
--- a/app/core/api.js
+++ b/app/core/api.js
@@ -120,4 +120,9 @@ FauxtonAPI.getIndexTypePropNames = function () {
return indexTypes;
};
+// Generate a v4 UUID
+FauxtonAPI.uuid = function () {
+ return crypto.randomUUID();
+};
+
export default FauxtonAPI;
diff --git a/package-lock.json b/package-lock.json
index 1795b570..dd175800 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -47,7 +47,6 @@
"send": "^0.19.0",
"url": "^0.11.0",
"urls": "~0.0.3",
- "uuid": "^9.0.0",
"whatwg-fetch": "^3.6.2",
"yargs": "^17.5.1"
},
@@ -19817,14 +19816,6 @@
"node": ">= 0.4.0"
}
},
- "node_modules/uuid": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
- "integrity":
"sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
- "bin": {
- "uuid": "dist/bin/uuid"
- }
- },
"node_modules/v8-to-istanbul": {
"version": "9.3.0",
"resolved":
"https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
@@ -34767,11 +34758,6 @@
"integrity":
"sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
"dev": true
},
- "uuid": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
- "integrity":
"sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg=="
- },
"v8-to-istanbul": {
"version": "9.3.0",
"resolved":
"https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
diff --git a/package.json b/package.json
index afd122c3..e0836369 100644
--- a/package.json
+++ b/package.json
@@ -98,7 +98,6 @@
"send": "^0.19.0",
"url": "^0.11.0",
"urls": "~0.0.3",
- "uuid": "^9.0.0",
"whatwg-fetch": "^3.6.2",
"yargs": "^17.5.1"
},