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

nuxt-umami

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-umami - npm Package Compare versions

Comparing version 2.5.1 to 2.5.2-beta.1

7

app.config.ts

@@ -69,5 +69,10 @@ export default defineAppConfig({

useDirective?: boolean
/**
* Enable warning and error logs in prod
*
* @default false
*/
debug?: boolean
}
}
}

22

internal/debug.ts

@@ -25,13 +25,13 @@ import type { PreflightResult } from './types';

const helloDebugger = process.env.NODE_ENV === 'production'
// eslint-disable-next-line unused-imports/no-unused-vars
? (id: ErrorId, raw?: any) => {}
: (id: ErrorId, raw?: any) => {
const { level, text } = warnings[id];
// eslint-disable-next-line no-console
console[level](`[UMAMI]: ${text}`, '\n');
// eslint-disable-next-line no-console
raw && (console[level](raw));
};
// eslint-disable-next-line n/prefer-global/process
const envIsProd = process.env.NODE_ENV === 'production';
export { helloDebugger };
function detective(id: ErrorId, raw?: any) {
const { level, text } = warnings[id];
// eslint-disable-next-line no-console
console[level](`[UMAMI]: ${text}`, '\n');
// eslint-disable-next-line no-console
raw && (console[level](raw));
}
export { detective, envIsProd };
import type { Directive } from 'vue';
import { helloDebugger } from '../internal/debug';
import { helloDebugger } from '../internal/utils';
import { umTrackEvent } from '../utils/umami';

@@ -35,3 +35,3 @@

} catch (err) {
helloDebugger('err-directive', `Provided ${typeof value}: ${value}`);
helloDebugger.value('err-directive', `Provided ${typeof value}: ${value}`);
}

@@ -38,0 +38,0 @@ }

import { useTitle } from '@vueuse/core';
import type {

@@ -8,3 +9,3 @@ GetPayloadReturn,

} from './types';
import { helloDebugger } from './debug';
import { detective, envIsProd } from './debug';

@@ -41,2 +42,3 @@ function isValidString(str: unknown): str is string {

useDirective = false,
debug = false,
} = {},

@@ -67,5 +69,18 @@ } = useAppConfig();

useDirective,
debug: !!debug,
};
});
const helloDebugger = computed(() => {
const enabled = envIsProd ? umConfig.value.debug : true;
type DetectiveParams = Parameters<typeof detective>;
return enabled
? function (...params: DetectiveParams) {
detective(...params);
}
: function (..._args: DetectiveParams) {};
});
const domainList = computed(() => {

@@ -174,10 +189,10 @@ const domains = umConfig.value.domains;

if (res && !res.ok) {
helloDebugger('err-collect', res);
helloDebugger.value('err-collect', res);
}
})
.catch((err) => {
helloDebugger('err-collect', err);
helloDebugger.value('err-collect', err);
});
}
export { isValidString, preflight, getPayload, collect, umConfig };
export { isValidString, preflight, getPayload, collect, umConfig, helloDebugger };

@@ -8,2 +8,3 @@ export default defineNuxtConfig({

domains: '',
debug: false,
autoTrack: true,

@@ -10,0 +11,0 @@ ignoreDnt: true,

{
"name": "nuxt-umami",
"type": "module",
"version": "2.5.1",
"version": "2.5.2-beta.1",
"description": "Integrate Umami Analytics into Nuxt",

@@ -40,13 +40,13 @@ "author": "ML <me.mlaure@gmail.com>",

"dependencies": {
"@vueuse/core": "^10.1.2"
"@vueuse/core": "^10.2.1"
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.5",
"@types/node": "^20.3.0",
"@antfu/eslint-config": "^0.39.8",
"@types/node": "^20.4.2",
"bumpp": "^9.1.1",
"eslint": "^8.42.0",
"eslint-plugin-vue": "^9.14.1",
"nuxt": "^3.5.3",
"typescript": "^5.1.3"
"eslint": "^8.45.0",
"eslint-plugin-vue": "^9.15.1",
"nuxt": "^3.6.3",
"typescript": "^5.1.6"
}
}

@@ -139,2 +139,3 @@ # Nuxt Umami

| useDirective | `boolean` | Option to enable the `v-umami` directive. See below. | no | `false` |
| debug | `boolean` | Option to enable error logs (in production), useful for testing in prod :) | no | `false` |

@@ -178,5 +179,5 @@ ## Usage

## Wait, there's more...
## Setup guide
Learn how to host your own Umami instance and set up your Nuxt app, check out [this straightforward guide by Miracle Onyenma](https://miracleio.me/blog/set-up-analytics-for-your-nuxt-3-app-with-umami).
Learn how to host your own Umami instance and set up your Nuxt app using [Miracle Onyenma's simple guide](https://miracleio.me/blog/set-up-analytics-for-your-nuxt-3-app-with-umami).

@@ -183,0 +184,0 @@ ## Issues, Bugs, Ideas?

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

import { collect, getPayload, isValidString, preflight, umConfig } from '../internal/utils';
import { collect, getPayload, helloDebugger, isValidString, preflight, umConfig } from '../internal/utils';
import type { EventData, EventPayload, ViewPayload } from '../internal/types';
import { helloDebugger } from '../internal/debug';

@@ -20,3 +19,3 @@ /**

if (check !== true) {
helloDebugger(`err-${check}`);
helloDebugger.value(`err-${check}`);
return;

@@ -56,3 +55,3 @@ }

if (check !== true) {
helloDebugger(`err-${check}`);
helloDebugger.value(`err-${check}`);
return;

@@ -67,3 +66,3 @@ }

if (!isValidString(eventName)) {
helloDebugger('err-event-name');
helloDebugger.value('err-event-name');
name = '#unknown-event';

@@ -70,0 +69,0 @@ }

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