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

@nuxt/telemetry

Package Overview
Dependencies
Maintainers
4
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxt/telemetry - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

72

bin/nuxt-telemetry.js

@@ -5,10 +5,10 @@ #!/usr/bin/env node

const destr2 = require('destr');
const destr = require('destr');
const nanoid = require('nanoid');
const rc9 = require('rc9');
const fetch = require('node-fetch');
const path2 = require('path');
const path = require('path');
const fs = require('fs');
const createRequire = require('create-require');
const os2 = require('os');
const os = require('os');
const gitUrlParse = require('git-url-parse');

@@ -20,5 +20,5 @@ const parseGitConfig = require('parse-git-config');

const crypto = require('crypto');
const consola2 = require('consola');
const consola = require('consola');
const c = require('chalk');
const inquirer2 = require('inquirer');
const inquirer = require('inquirer');
const stdEnv = require('std-env');

@@ -28,7 +28,7 @@

const destr2__default = /*#__PURE__*/_interopDefaultLegacy(destr2);
const destr__default = /*#__PURE__*/_interopDefaultLegacy(destr);
const fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
const path2__default = /*#__PURE__*/_interopDefaultLegacy(path2);
const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
const createRequire__default = /*#__PURE__*/_interopDefaultLegacy(createRequire);
const os2__default = /*#__PURE__*/_interopDefaultLegacy(os2);
const os__default = /*#__PURE__*/_interopDefaultLegacy(os);
const gitUrlParse__default = /*#__PURE__*/_interopDefaultLegacy(gitUrlParse);

@@ -39,9 +39,9 @@ const parseGitConfig__default = /*#__PURE__*/_interopDefaultLegacy(parseGitConfig);

const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
const consola2__default = /*#__PURE__*/_interopDefaultLegacy(consola2);
const consola__default = /*#__PURE__*/_interopDefaultLegacy(consola);
const c__default = /*#__PURE__*/_interopDefaultLegacy(c);
const inquirer2__default = /*#__PURE__*/_interopDefaultLegacy(inquirer2);
const inquirer__default = /*#__PURE__*/_interopDefaultLegacy(inquirer);
const stdEnv__default = /*#__PURE__*/_interopDefaultLegacy(stdEnv);
var name = "@nuxt/telemetry";
var version = "1.3.4";
var version = "1.3.5";

@@ -152,3 +152,3 @@ function updateUserNuxtRc(key, val) {

function getDependencies(rootDir) {
const pkgPath = path2.join(rootDir, "package.json");
const pkgPath = path.join(rootDir, "package.json");
if (!fs.existsSync(pkgPath)) {

@@ -163,3 +163,3 @@ return [];

try {
const pkg2 = _require(path2.join(name, "package.json"));
const pkg2 = _require(path.join(name, "package.json"));
_deps.push({name, version: pkg2.version, dev});

@@ -218,3 +218,3 @@ } catch (_e) {

for (const file in FILE2PM) {
if (await fs__default['default'].pathExists(path2__default['default'].resolve(rootDir, file))) {
if (await fs__default['default'].pathExists(path__default['default'].resolve(rootDir, file))) {
return FILE2PM[file];

@@ -250,3 +250,3 @@ }

nodeVersion,
os: os2__default['default'].type().toLocaleLowerCase(),
os: os__default['default'].type().toLocaleLowerCase(),
environment: getEnv(),

@@ -329,3 +329,3 @@ packageManager,

const log2 = consola2__default['default'].withScope("@nuxt/telemetry");
const log = consola__default['default'].withScope("@nuxt/telemetry");

@@ -347,3 +347,3 @@ class Telemetry {

if (typeof eventFactory !== "function") {
log2.warn("Unknown event:", name);
log.warn("Unknown event:", name);
return;

@@ -356,12 +356,12 @@ }

try {
const context2 = await this.getContext();
const event = await eventFactory(context2, payload);
const context = await this.getContext();
const event = await eventFactory(context, payload);
event.name = name;
return event;
} catch (err) {
log2.error("Error while running event:", err);
log.error("Error while running event:", err);
}
}
async getPublicContext() {
const context2 = await this.getContext();
const context = await this.getContext();
const eventContext = {};

@@ -378,3 +378,3 @@ for (const key of [

]) {
eventContext[key] = context2[key];
eventContext[key] = context[key];
}

@@ -386,6 +386,6 @@ return eventContext;

this.events = [];
const context2 = await this.getPublicContext();
const context = await this.getPublicContext();
const body = {
timestamp: Date.now(),
context: context2,
context,
events: events2

@@ -396,7 +396,7 @@ };

try {
log2.info("Sending events:", JSON.stringify(body, null, 2));
log.info("Sending events:", JSON.stringify(body, null, 2));
await postEvent(this.options.endpoint, body);
log2.success(`Events sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)`);
log.success(`Events sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)`);
} catch (err) {
log2.error(`Error sending sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)
log.error(`Error sending sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)
`, err);

@@ -426,7 +426,7 @@ }

process.stdout.write("\n");
consola2__default['default'].info(`${c__default['default'].green("NuxtJS")} collects completely anonymous data about usage.
consola__default['default'].info(`${c__default['default'].green("NuxtJS")} collects completely anonymous data about usage.
This will help us improve Nuxt developer experience over time.
Read more on ${c__default['default'].cyan.underline("https://git.io/nuxt-telemetry")}
`);
const {accept} = await inquirer2__default['default'].prompt({
const {accept} = await inquirer__default['default'].prompt({
type: "confirm",

@@ -448,20 +448,20 @@ name: "accept",

const toptions = {
endpoint: destr2__default['default'](process.env.NUXT_TELEMETRY_ENDPOINT) || "https://telemetry.nuxtjs.com",
debug: destr2__default['default'](process.env.NUXT_TELEMETRY_DEBUG),
endpoint: destr__default['default'](process.env.NUXT_TELEMETRY_ENDPOINT) || "https://telemetry.nuxtjs.com",
debug: destr__default['default'](process.env.NUXT_TELEMETRY_DEBUG),
...nuxt.options.telemetry
};
if (!toptions.debug) {
log2.level = -Infinity;
log.level = -Infinity;
}
if (nuxt.options.telemetry !== true) {
if (toptions.enabled === false || nuxt.options.telemetry === false || !await ensureUserconsent(toptions)) {
log2.info("Telemetry disabled");
log.info("Telemetry disabled");
return;
}
}
log2.info("Telemetry enabled");
log.info("Telemetry enabled");
if (!toptions.seed) {
toptions.seed = hash(nanoid.nanoid());
updateUserNuxtRc("telemetry.seed", toptions.seed);
log2.info("Seed generated:", toptions.seed);
log.info("Seed generated:", toptions.seed);
}

@@ -489,3 +489,3 @@ const t = new Telemetry(nuxt, toptions);

} catch (err) {
log2.error(err);
log.error(err);
}

@@ -492,0 +492,0 @@ };

'use strict';
const destr2 = require('destr');
const destr = require('destr');
const nanoid = require('nanoid');
const rc9 = require('rc9');
const fetch = require('node-fetch');
const path2 = require('path');
const path = require('path');
const fs = require('fs');
const createRequire = require('create-require');
const os2 = require('os');
const os = require('os');
const gitUrlParse = require('git-url-parse');

@@ -17,5 +17,5 @@ const parseGitConfig = require('parse-git-config');

const crypto = require('crypto');
const consola2 = require('consola');
const consola = require('consola');
const c = require('chalk');
const inquirer2 = require('inquirer');
const inquirer = require('inquirer');
const stdEnv = require('std-env');

@@ -25,7 +25,7 @@

const destr2__default = /*#__PURE__*/_interopDefaultLegacy(destr2);
const destr__default = /*#__PURE__*/_interopDefaultLegacy(destr);
const fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
const path2__default = /*#__PURE__*/_interopDefaultLegacy(path2);
const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
const createRequire__default = /*#__PURE__*/_interopDefaultLegacy(createRequire);
const os2__default = /*#__PURE__*/_interopDefaultLegacy(os2);
const os__default = /*#__PURE__*/_interopDefaultLegacy(os);
const gitUrlParse__default = /*#__PURE__*/_interopDefaultLegacy(gitUrlParse);

@@ -36,9 +36,9 @@ const parseGitConfig__default = /*#__PURE__*/_interopDefaultLegacy(parseGitConfig);

const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
const consola2__default = /*#__PURE__*/_interopDefaultLegacy(consola2);
const consola__default = /*#__PURE__*/_interopDefaultLegacy(consola);
const c__default = /*#__PURE__*/_interopDefaultLegacy(c);
const inquirer2__default = /*#__PURE__*/_interopDefaultLegacy(inquirer2);
const inquirer__default = /*#__PURE__*/_interopDefaultLegacy(inquirer);
const stdEnv__default = /*#__PURE__*/_interopDefaultLegacy(stdEnv);
var name = "@nuxt/telemetry";
var version = "1.3.4";
var version = "1.3.5";

@@ -149,3 +149,3 @@ function updateUserNuxtRc(key, val) {

function getDependencies(rootDir) {
const pkgPath = path2.join(rootDir, "package.json");
const pkgPath = path.join(rootDir, "package.json");
if (!fs.existsSync(pkgPath)) {

@@ -160,3 +160,3 @@ return [];

try {
const pkg2 = _require(path2.join(name, "package.json"));
const pkg2 = _require(path.join(name, "package.json"));
_deps.push({name, version: pkg2.version, dev});

@@ -215,3 +215,3 @@ } catch (_e) {

for (const file in FILE2PM) {
if (await fs__default['default'].pathExists(path2__default['default'].resolve(rootDir, file))) {
if (await fs__default['default'].pathExists(path__default['default'].resolve(rootDir, file))) {
return FILE2PM[file];

@@ -247,3 +247,3 @@ }

nodeVersion,
os: os2__default['default'].type().toLocaleLowerCase(),
os: os__default['default'].type().toLocaleLowerCase(),
environment: getEnv(),

@@ -326,3 +326,3 @@ packageManager,

const log2 = consola2__default['default'].withScope("@nuxt/telemetry");
const log = consola__default['default'].withScope("@nuxt/telemetry");

@@ -344,3 +344,3 @@ class Telemetry {

if (typeof eventFactory !== "function") {
log2.warn("Unknown event:", name);
log.warn("Unknown event:", name);
return;

@@ -353,12 +353,12 @@ }

try {
const context2 = await this.getContext();
const event = await eventFactory(context2, payload);
const context = await this.getContext();
const event = await eventFactory(context, payload);
event.name = name;
return event;
} catch (err) {
log2.error("Error while running event:", err);
log.error("Error while running event:", err);
}
}
async getPublicContext() {
const context2 = await this.getContext();
const context = await this.getContext();
const eventContext = {};

@@ -375,3 +375,3 @@ for (const key of [

]) {
eventContext[key] = context2[key];
eventContext[key] = context[key];
}

@@ -383,6 +383,6 @@ return eventContext;

this.events = [];
const context2 = await this.getPublicContext();
const context = await this.getPublicContext();
const body = {
timestamp: Date.now(),
context: context2,
context,
events: events2

@@ -393,7 +393,7 @@ };

try {
log2.info("Sending events:", JSON.stringify(body, null, 2));
log.info("Sending events:", JSON.stringify(body, null, 2));
await postEvent(this.options.endpoint, body);
log2.success(`Events sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)`);
log.success(`Events sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)`);
} catch (err) {
log2.error(`Error sending sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)
log.error(`Error sending sent to \`${this.options.endpoint}\` (${Date.now() - start} ms)
`, err);

@@ -423,7 +423,7 @@ }

process.stdout.write("\n");
consola2__default['default'].info(`${c__default['default'].green("NuxtJS")} collects completely anonymous data about usage.
consola__default['default'].info(`${c__default['default'].green("NuxtJS")} collects completely anonymous data about usage.
This will help us improve Nuxt developer experience over time.
Read more on ${c__default['default'].cyan.underline("https://git.io/nuxt-telemetry")}
`);
const {accept} = await inquirer2__default['default'].prompt({
const {accept} = await inquirer__default['default'].prompt({
type: "confirm",

@@ -445,20 +445,20 @@ name: "accept",

const toptions = {
endpoint: destr2__default['default'](process.env.NUXT_TELEMETRY_ENDPOINT) || "https://telemetry.nuxtjs.com",
debug: destr2__default['default'](process.env.NUXT_TELEMETRY_DEBUG),
endpoint: destr__default['default'](process.env.NUXT_TELEMETRY_ENDPOINT) || "https://telemetry.nuxtjs.com",
debug: destr__default['default'](process.env.NUXT_TELEMETRY_DEBUG),
...nuxt.options.telemetry
};
if (!toptions.debug) {
log2.level = -Infinity;
log.level = -Infinity;
}
if (nuxt.options.telemetry !== true) {
if (toptions.enabled === false || nuxt.options.telemetry === false || !await ensureUserconsent(toptions)) {
log2.info("Telemetry disabled");
log.info("Telemetry disabled");
return;
}
}
log2.info("Telemetry enabled");
log.info("Telemetry enabled");
if (!toptions.seed) {
toptions.seed = hash(nanoid.nanoid());
updateUserNuxtRc("telemetry.seed", toptions.seed);
log2.info("Seed generated:", toptions.seed);
log.info("Seed generated:", toptions.seed);
}

@@ -486,3 +486,3 @@ const t = new Telemetry(nuxt, toptions);

} catch (err) {
log2.error(err);
log.error(err);
}

@@ -489,0 +489,0 @@ };

{
"name": "@nuxt/telemetry",
"version": "1.3.4",
"version": "1.3.5",
"repository": "nuxt/telemetry",

@@ -30,19 +30,19 @@ "license": "MIT",

"arg": "^5.0.0",
"chalk": "^4.1.0",
"ci-info": "^2.0.0",
"consola": "^2.15.0",
"chalk": "^4.1.1",
"ci-info": "^3.1.1",
"consola": "^2.15.3",
"create-require": "^1.1.1",
"defu": "^3.2.2",
"defu": "^5.0.0",
"destr": "^1.1.0",
"dotenv": "^8.2.0",
"dotenv": "^9.0.2",
"fs-extra": "^8.1.0",
"git-url-parse": "^11.4.3",
"git-url-parse": "^11.4.4",
"inquirer": "^7.3.3",
"is-docker": "^2.1.1",
"jiti": "^1.3.0",
"nanoid": "^3.1.20",
"is-docker": "^2.2.1",
"jiti": "^1.9.2",
"nanoid": "^3.1.23",
"node-fetch": "^2.6.1",
"parse-git-config": "^3.0.0",
"rc9": "^1.2.0",
"std-env": "^2.2.1"
"std-env": "^2.3.0"
},

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

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