Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/vaadin-usage-statistics

Package Overview
Dependencies
Maintainers
9
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/vaadin-usage-statistics - npm Package Compare versions

Comparing version 2.0.0-alpha4 to 2.0.0-beta1

bin/disable

11

package.json

@@ -9,6 +9,10 @@ {

"name": "@vaadin/vaadin-usage-statistics",
"version": "2.0.0-alpha4",
"version": "2.0.0-beta1",
"directories": {
"test": "test"
},
"bin": {
"disable": "./bin/disable",
"enable": "./bin/enable"
},
"browserslist": [

@@ -27,2 +31,5 @@ "last 2 Chrome major versions",

"license": "Apache-2.0",
"scripts": {
"postinstall": "node check.js"
},
"bugs": {

@@ -39,3 +46,3 @@ "url": "https://github.com/vaadin/vaadin-usage-statistics/issues"

"dependencies": {
"@vaadin/vaadin-development-mode-detector": "^2.0.0-alpha2"
"@vaadin/vaadin-development-mode-detector": "^1.1.0-alpha2"
},

@@ -42,0 +49,0 @@ "devDependencies": {

@@ -21,2 +21,5 @@ # Gathers usage statistics for components used during application development

## Opting out
### Bower
To opt-out from statistics, install the no-op version of the `vaadin-usage-statistics` package using

@@ -28,2 +31,12 @@ ```

### npm
If you are using npm, run the following command:
```
npx @vaadin/vaadin-usage-statistics disable
````
You can verify this by checking that `vaadin-usage-statistics.js` contains empty function.
### Java
If you are using Java, add to your pom.xml:

@@ -30,0 +43,0 @@ ```

7

rollup.config.js

@@ -5,4 +5,5 @@ import babel from 'rollup-plugin-babel';

const config = [
// UMD bundle, transpiled (for the browsers that do not support ES modules).
// Also works in Node.
// Bundle and transpile the sources so that they can be executed
// in any supported browser. The IIFE format makes it easy to wrap the output
// into vaadin-dev-mode comments.
{

@@ -12,3 +13,3 @@ input: 'src/vaadin-usage-statistics.js',

format: 'iife',
file: 'vaadin-usage-statistics.js',
file: 'vaadin-usage-statistics.es5.js',
},

@@ -15,0 +16,0 @@ plugins: [

@@ -0,1 +1,3 @@

const getPolymerVersion = () => window.Polymer && window.Polymer.version;
class StatisticsGatherer {

@@ -69,4 +71,5 @@ constructor(logger) {

'Polymer': function () {
if (window.Polymer && window.Polymer.version) {
return window.Polymer.version;
const version = getPolymerVersion();
if (version) {
return version;
}

@@ -81,37 +84,2 @@ },

};
get knownVaadinElementNames() {
if (!this._knownVaadinElementNames) {
const names = [
'vaadin-button',
'vaadin-checkbox',
'vaadin-combo-box',
'vaadin-context-menu',
'vaadin-date-picker',
'vaadin-dialog',
'vaadin-dropdown-menu',
'vaadin-form-layout',
'vaadin-grid',
'vaadin-horizontal-layout',
'vaadin-icons',
'vaadin-item',
'vaadin-list-box',
'vaadin-notification',
'vaadin-password-field',
'vaadin-progress-bar',
'vaadin-radio-button',
'vaadin-router-meta',
'vaadin-split-layout',
'vaadin-tab',
'vaadin-tabs',
'vaadin-text-area',
'vaadin-text-field',
'vaadin-upload',
'vaadin-vertical-layout'
];
this._knownVaadinElementNames = names;
}
return this._knownVaadinElementNames;
}
getUsedVaadinElementVersion(elementName) {

@@ -124,7 +92,14 @@ const klass = customElements.get(elementName);

getUsedVaadinElements(elements) {
this.knownVaadinElementNames.forEach(elementName => {
const version = this.getUsedVaadinElementVersion(elementName);
if (version) {
elements[elementName] = {version};
}
const version = getPolymerVersion();
let elementClasses;
if (version && version.indexOf('2') === 0) {
// Polymer 2: components classes are stored in window.Vaadin
elementClasses = Object.keys(window.Vaadin).map(c => window.Vaadin[c]).filter(c => c.is);
} else {
// Polymer 3: components classes are stored in window.Vaadin.registrations
elementClasses = window.Vaadin.registrations || [];
}
elementClasses.forEach(klass => {
const version = klass.version ? klass.version : "0.0.0";
elements[klass.is] = {version};
});

@@ -134,3 +109,4 @@ }

[
'Lumo'
'Lumo',
'Material'
].forEach(themeName => {

@@ -375,2 +351,2 @@ const elementName = `vaadin-${themeName.toLowerCase()}-styles`;

// Intentionally ignored as this is not a problem in the app being developed
}
}

@@ -1,2 +0,2 @@

import { runIfDevelopmentMode } from '@vaadin/vaadin-development-mode-detector/vaadin-development-mode-detector.js';
import { runIfDevelopmentMode } from '../../@vaadin/vaadin-development-mode-detector/vaadin-development-mode-detector.js';
function maybeGatherAndSendStats() {

@@ -37,2 +37,6 @@ /** vaadin-dev-mode:start

var getPolymerVersion = function getPolymerVersion() {
return window.Polymer && window.Polymer.version;
};
var StatisticsGatherer = function () {

@@ -125,4 +129,5 @@ function StatisticsGatherer(logger) {

'Polymer': function Polymer() {
if (window.Polymer && window.Polymer.version) {
return window.Polymer.version;
var version = getPolymerVersion();
if (version) {
return version;
}

@@ -148,9 +153,18 @@ },

value: function getUsedVaadinElements(elements) {
var _this = this;
this.knownVaadinElementNames.forEach(function (elementName) {
var version = _this.getUsedVaadinElementVersion(elementName);
if (version) {
elements[elementName] = { version: version };
}
var version = getPolymerVersion();
var elementClasses = void 0;
if (version && version.indexOf('2') === 0) {
// Polymer 2: components classes are stored in window.Vaadin
elementClasses = Object.keys(window.Vaadin).map(function (c) {
return window.Vaadin[c];
}).filter(function (c) {
return c.is;
});
} else {
// Polymer 3: components classes are stored in window.Vaadin.registrations
elementClasses = window.Vaadin.registrations || [];
}
elementClasses.forEach(function (klass) {
var version = klass.version ? klass.version : "0.0.0";
elements[klass.is] = { version: version };
});

@@ -161,7 +175,7 @@ }

value: function getUsedVaadinThemes(themes) {
var _this2 = this;
var _this = this;
['Lumo'].forEach(function (themeName) {
['Lumo', 'Material'].forEach(function (themeName) {
var elementName = 'vaadin-' + themeName.toLowerCase() + '-styles';
var version = _this2.getUsedVaadinElementVersion(elementName);
var version = _this.getUsedVaadinElementVersion(elementName);
if (version) {

@@ -225,12 +239,2 @@ themes[themeName] = { version: version };

}
}, {
key: 'knownVaadinElementNames',
get: function get$1() {
if (!this._knownVaadinElementNames) {
var names = ['vaadin-button', 'vaadin-checkbox', 'vaadin-combo-box', 'vaadin-context-menu', 'vaadin-date-picker', 'vaadin-dialog', 'vaadin-dropdown-menu', 'vaadin-form-layout', 'vaadin-grid', 'vaadin-horizontal-layout', 'vaadin-icons', 'vaadin-item', 'vaadin-list-box', 'vaadin-notification', 'vaadin-password-field', 'vaadin-progress-bar', 'vaadin-radio-button', 'vaadin-router-meta', 'vaadin-split-layout', 'vaadin-tab', 'vaadin-tabs', 'vaadin-text-area', 'vaadin-text-field', 'vaadin-upload', 'vaadin-vertical-layout'];
this._knownVaadinElementNames = names;
}
return this._knownVaadinElementNames;
}
}]);

@@ -367,3 +371,3 @@ return StatisticsGatherer;

value: function maybeGatherAndSend() {
var _this3 = this;
var _this2 = this;

@@ -375,3 +379,3 @@ if (localStorage.getItem(UsageStatistics.optOutKey)) {

setTimeout(function () {
_this3.maybeSend();
_this2.maybeSend();
}, this.gatherDelay * 1000);

@@ -473,3 +477,5 @@ }

export const usageStatistics = function() {
return runIfDevelopmentMode(maybeGatherAndSendStats);
if (typeof runIfDevelopmentMode === 'function') {
return runIfDevelopmentMode(maybeGatherAndSendStats);
}
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc