Upgrade uuid (#858)

* Upgrade uuid

* Fix: eslint
This commit is contained in:
eight 2020-02-20 20:17:15 +08:00 committed by GitHub
parent 6875cc33b4
commit 8380a674b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 14 deletions

View File

@ -1,6 +1,6 @@
/* eslint no-eq-null: 0, eqeqeq: [2, "smart"] */ /* eslint no-eq-null: 0, eqeqeq: [2, "smart"] */
/* global createCache db calcStyleDigest db tryRegExp styleCodeEmpty /* global createCache db calcStyleDigest db tryRegExp styleCodeEmpty
getStyleWithNoCode msg sync uuid */ getStyleWithNoCode msg sync uuidv4 */
/* exported styleManager */ /* exported styleManager */
'use strict'; 'use strict';
@ -384,7 +384,7 @@ const styleManager = (() => {
delete style.id; delete style.id;
} }
if (!style._id) { if (!style._id) {
style._id = uuid(); style._id = uuidv4();
} }
style._rev = Date.now(); style._rev = Date.now();
fixUsoMd5Issue(style); fixUsoMd5Issue(style);
@ -523,7 +523,7 @@ const styleManager = (() => {
function prepare() { function prepare() {
const ADD_MISSING_PROPS = { const ADD_MISSING_PROPS = {
name: style => `ID: ${style.id}`, name: style => `ID: ${style.id}`,
_id: () => uuid(), _id: () => uuidv4(),
_rev: () => Date.now() _rev: () => Date.now()
}; };

30
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "Stylus", "name": "Stylus",
"version": "1.5.8", "version": "1.5.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -3961,6 +3961,12 @@
"remove-trailing-separator": "^1.0.1" "remove-trailing-separator": "^1.0.1"
} }
}, },
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
},
"zip-stream": { "zip-stream": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz",
@ -6569,6 +6575,14 @@
"tough-cookie": "~2.5.0", "tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0", "tunnel-agent": "^0.6.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
} }
}, },
"require-directory": { "require-directory": {
@ -6945,6 +6959,14 @@
"tough-cookie": "~2.4.3", "tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0", "tunnel-agent": "^0.6.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
} }
}, },
"tough-cookie": { "tough-cookie": {
@ -8025,9 +8047,9 @@
"dev": true "dev": true
}, },
"uuid": { "uuid": {
"version": "3.4.0", "version": "7.0.0-beta.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.0-beta.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "integrity": "sha512-Am22LVM3UXB0DTzQAeDSsZwP5eyqjIhmff330hqkxGvIxX8RRrUYLtKJ0eYxiBgjeQdUaMONpBZbJachMShxBw==",
"dev": true "dev": true
}, },
"v8-compile-cache": { "v8-compile-cache": {

View File

@ -23,7 +23,7 @@
"sync-version": "^1.0.1", "sync-version": "^1.0.1",
"tiny-glob": "^0.2.6", "tiny-glob": "^0.2.6",
"usercss-meta": "^0.9.0", "usercss-meta": "^0.9.0",
"uuid": "^3.4.0", "uuid": "^7.0.0-beta.0",
"web-ext": "^4.1.0", "web-ext": "^4.1.0",
"webext-tx-fix": "^0.3.3" "webext-tx-fix": "^0.3.3"
}, },

View File

@ -61,7 +61,7 @@ const files = {
'dist/db-to-cloud.min.js → db-to-cloud.min.js' 'dist/db-to-cloud.min.js → db-to-cloud.min.js'
], ],
'uuid': [ 'uuid': [
'https://bundle.run/uuid@{VERSION}/v4.js → uuid.min.js' 'dist/umd/uuidv4.min.js → uuid.min.js'
] ]
}; };
@ -120,6 +120,7 @@ async function buildFiles(pkg, patterns) {
await fse.outputFile(`vendor/${pkg}/${dest}`, content); await fse.outputFile(`vendor/${pkg}/${dest}`, content);
fetchedFiles.push([src, dest]); fetchedFiles.push([src, dest]);
} else { } else {
let dirty = false;
for (const file of await glob(`node_modules/${pkg}/${src}`)) { for (const file of await glob(`node_modules/${pkg}/${src}`)) {
if (dest) { if (dest) {
await fse.copy(file, `vendor/${pkg}/${dest}`); await fse.copy(file, `vendor/${pkg}/${dest}`);
@ -127,6 +128,10 @@ async function buildFiles(pkg, patterns) {
await fse.copy(file, path.join('vendor', path.relative('node_modules', file))); await fse.copy(file, path.join('vendor', path.relative('node_modules', file)));
} }
copiedFiles.push([path.relative(`node_modules/${pkg}`, file), dest]); copiedFiles.push([path.relative(`node_modules/${pkg}`, file), dest]);
dirty = true;
}
if (!dirty) {
throw new Error(`Pattern ${src} matches no files`);
} }
} }
} }

View File

@ -1,6 +1,5 @@
## uuid v3.4.0 ## uuid v7.0.0-beta.0
Following files are downloaded from HTTP: Following files are copied from npm (node_modules):
* uuid.min.js: https://bundle.run/uuid@3.4.0/v4.js
* uuid.min.js: dist\umd\uuidv4.min.js

View File

@ -1 +1 @@
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).uuid=n()}}(function(){return function(){return function n(e,r,t){function o(f,u){if(!r[f]){if(!e[f]){var d="function"==typeof require&&require;if(!u&&d)return d(f,!0);if(i)return i(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var p=r[f]={exports:{}};e[f][0].call(p.exports,function(n){return o(e[f][1][n]||n)},p,p.exports,n,e,r,t)}return r[f].exports}for(var i="function"==typeof require&&require,f=0;f<t.length;f++)o(t[f]);return o}}()({1:[function(n,e,r){for(var t=[],o=0;o<256;++o)t[o]=(o+256).toString(16).substr(1);e.exports=function(n,e){var r=e||0,o=t;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]]].join("")}},{}],2:[function(n,e,r){var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var o=new Uint8Array(16);e.exports=function(){return t(o),o}}else{var i=new Array(16);e.exports=function(){for(var n,e=0;e<16;e++)0==(3&e)&&(n=4294967296*Math.random()),i[e]=n>>>((3&e)<<3)&255;return i}}},{}],3:[function(n,e,r){var t=n("./lib/rng"),o=n("./lib/bytesToUuid");e.exports=function(n,e,r){var i=e&&r||0;"string"==typeof n&&(e="binary"===n?new Array(16):null,n=null);var f=(n=n||{}).random||(n.rng||t)();if(f[6]=15&f[6]|64,f[8]=63&f[8]|128,e)for(var u=0;u<16;++u)e[i+u]=f[u];return e||o(f)}},{"./lib/bytesToUuid":1,"./lib/rng":2}]},{},[3])(3)}); !function(o,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(o=o||self).uuidv4=e()}(this,(function(){"use strict";var o="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),e=new Uint8Array(16);function r(){if(!o)throw new Error("uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.");return o(e)}for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);return function(o,e,t){var u=e&&t||0;"string"==typeof o&&(e="binary"===o?new Array(16):null,o=null);var i=(o=o||{}).random||(o.rng||r)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var s=0;s<16;++s)e[u+s]=i[s];return e||function(o,e){var r=e||0,t=n;return[t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]]].join("")}(i)}}));