@nuxt/scripts 1.0.0-beta.26 → 1.0.0-beta.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/client/200.html +1 -1
  2. package/dist/client/404.html +1 -1
  3. package/dist/client/_nuxt/{C-7nRtzO.js → AwAKM0sG.js} +1 -1
  4. package/dist/client/_nuxt/{DjhmCJlE.js → Bl23o3st.js} +18 -18
  5. package/dist/client/_nuxt/{TJ5JFHov.js → CYlYSSNW.js} +1 -1
  6. package/dist/client/_nuxt/{D5k4eN9O.js → D5FIkDae.js} +1 -1
  7. package/dist/client/_nuxt/builds/latest.json +1 -1
  8. package/dist/client/_nuxt/builds/meta/3ca2fe82-918c-4528-826c-0bf9ff54a5fa.json +1 -0
  9. package/dist/client/_nuxt/error-404.1K8v8Su2.css +1 -0
  10. package/dist/client/_nuxt/error-500.B9qvKpQm.css +1 -0
  11. package/dist/client/index.html +1 -1
  12. package/dist/module.d.mts +1 -1
  13. package/dist/module.d.ts +1 -1
  14. package/dist/module.json +1 -1
  15. package/dist/module.mjs +50 -9
  16. package/dist/registry.mjs +6 -3
  17. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +13 -3
  18. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +12 -7
  19. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +13 -3
  20. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +4 -34
  21. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +41 -38
  22. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +4 -34
  23. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +5 -9
  24. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.d.vue.ts +35 -0
  25. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue +68 -0
  26. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue.d.ts +35 -0
  27. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.d.vue.ts +4 -4
  28. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +2 -6
  29. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +4 -4
  30. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +6 -4
  31. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +18 -10
  32. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +6 -4
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +40 -0
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +168 -0
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +40 -0
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +4 -9
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +4 -9
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +5 -9
  39. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +13 -0
  40. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +8 -0
  41. package/dist/runtime/registry/gravatar.d.ts +1 -0
  42. package/dist/runtime/registry/gravatar.js +1 -0
  43. package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
  44. package/dist/runtime/server/gravatar-proxy.js +0 -1
  45. package/dist/stats.d.mts +82 -11
  46. package/dist/stats.d.ts +82 -11
  47. package/dist/stats.mjs +763 -351
  48. package/dist/types-source.mjs +1247 -67
  49. package/package.json +6 -4
  50. package/dist/client/_nuxt/builds/meta/33e1ac0e-aba1-4856-8beb-775c426be236.json +0 -1
  51. package/dist/client/_nuxt/error-404.C_3_IG5y.css +0 -1
  52. package/dist/client/_nuxt/error-500.DSv6YikH.css +0 -1
@@ -0,0 +1,40 @@
1
+ type OverlayAnchor = 'center' | 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left-center' | 'right-center';
2
+ type OverlayPane = 'mapPane' | 'overlayLayer' | 'markerLayer' | 'overlayMouseTarget' | 'floatPane';
3
+ type __VLS_Props = {
4
+ position?: google.maps.LatLngLiteral;
5
+ anchor?: OverlayAnchor;
6
+ offset?: {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ pane?: OverlayPane;
11
+ zIndex?: number;
12
+ blockMapInteraction?: boolean;
13
+ };
14
+ type __VLS_ModelProps = {
15
+ 'open'?: boolean;
16
+ };
17
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
18
+ declare var __VLS_1: {};
19
+ type __VLS_Slots = {} & {
20
+ default?: (props: typeof __VLS_1) => any;
21
+ };
22
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
23
+ overlay: import("vue").ShallowRef<google.maps.OverlayView | undefined>;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ "update:open": (value: boolean | undefined) => any;
26
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
+ "onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
28
+ }>, {
29
+ anchor: OverlayAnchor;
30
+ pane: OverlayPane;
31
+ blockMapInteraction: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,168 @@
1
+ <script setup>
2
+ import { inject, useTemplateRef, watch } from "vue";
3
+ import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY, MARKER_INJECTION_KEY } from "./injectionKeys";
4
+ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
+ const props = defineProps({
6
+ position: { type: null, required: false },
7
+ anchor: { type: String, required: false, default: "bottom-center" },
8
+ offset: { type: Object, required: false },
9
+ pane: { type: String, required: false, default: "floatPane" },
10
+ zIndex: { type: Number, required: false },
11
+ blockMapInteraction: { type: Boolean, required: false, default: true }
12
+ });
13
+ const open = defineModel("open", { type: Boolean });
14
+ const markerContext = inject(MARKER_INJECTION_KEY, void 0);
15
+ const advancedMarkerElementContext = inject(ADVANCED_MARKER_ELEMENT_INJECTION_KEY, void 0);
16
+ function getResolvedPosition() {
17
+ if (props.position)
18
+ return props.position;
19
+ if (markerContext?.marker.value) {
20
+ const pos = markerContext.marker.value.getPosition();
21
+ if (pos)
22
+ return { lat: pos.lat(), lng: pos.lng() };
23
+ }
24
+ if (advancedMarkerElementContext?.advancedMarkerElement.value) {
25
+ const pos = advancedMarkerElementContext.advancedMarkerElement.value.position;
26
+ if (pos) {
27
+ if ("lat" in pos && typeof pos.lat === "function")
28
+ return { lat: pos.lat(), lng: pos.lng() };
29
+ return pos;
30
+ }
31
+ }
32
+ return void 0;
33
+ }
34
+ const ANCHOR_TRANSFORMS = {
35
+ "center": "translate(-50%, -50%)",
36
+ "top-left": "translate(0, 0)",
37
+ "top-center": "translate(-50%, 0)",
38
+ "top-right": "translate(-100%, 0)",
39
+ "bottom-left": "translate(0, -100%)",
40
+ "bottom-center": "translate(-50%, -100%)",
41
+ "bottom-right": "translate(-100%, -100%)",
42
+ "left-center": "translate(0, -50%)",
43
+ "right-center": "translate(-100%, -50%)"
44
+ };
45
+ const overlayContent = useTemplateRef("overlay-content");
46
+ const listeners = [];
47
+ const overlay = useGoogleMapsResource({
48
+ // ready condition accesses .value on ShallowRefs — tracked by whenever() in useGoogleMapsResource
49
+ ready: () => !!overlayContent.value && !!(props.position || markerContext?.marker.value || advancedMarkerElementContext?.advancedMarkerElement.value),
50
+ create({ mapsApi, map }) {
51
+ const el = overlayContent.value;
52
+ class CustomOverlay extends mapsApi.OverlayView {
53
+ onAdd() {
54
+ const panes = this.getPanes();
55
+ if (panes) {
56
+ panes[props.pane].appendChild(el);
57
+ if (props.blockMapInteraction)
58
+ mapsApi.OverlayView.preventMapHitsAndGesturesFrom(el);
59
+ }
60
+ }
61
+ draw() {
62
+ if (open.value === false) {
63
+ el.style.visibility = "hidden";
64
+ return;
65
+ }
66
+ const position = getResolvedPosition();
67
+ if (!position) {
68
+ el.style.visibility = "hidden";
69
+ return;
70
+ }
71
+ const projection = this.getProjection();
72
+ if (!projection) {
73
+ el.style.visibility = "hidden";
74
+ return;
75
+ }
76
+ const pos = projection.fromLatLngToDivPixel(
77
+ new mapsApi.LatLng(position.lat, position.lng)
78
+ );
79
+ if (!pos) {
80
+ el.style.visibility = "hidden";
81
+ return;
82
+ }
83
+ el.style.position = "absolute";
84
+ el.style.left = `${pos.x + (props.offset?.x ?? 0)}px`;
85
+ el.style.top = `${pos.y + (props.offset?.y ?? 0)}px`;
86
+ el.style.transform = ANCHOR_TRANSFORMS[props.anchor];
87
+ if (props.zIndex !== void 0)
88
+ el.style.zIndex = String(props.zIndex);
89
+ el.style.visibility = "visible";
90
+ }
91
+ onRemove() {
92
+ el.parentNode?.removeChild(el);
93
+ }
94
+ }
95
+ el.style.visibility = "hidden";
96
+ const ov = new CustomOverlay();
97
+ ov.setMap(map);
98
+ if (markerContext?.marker.value) {
99
+ listeners.push(
100
+ markerContext.marker.value.addListener("position_changed", () => ov.draw())
101
+ );
102
+ } else if (advancedMarkerElementContext?.advancedMarkerElement.value) {
103
+ const ame = advancedMarkerElementContext.advancedMarkerElement.value;
104
+ listeners.push(
105
+ ame.addListener("drag", () => ov.draw()),
106
+ ame.addListener("dragend", () => ov.draw())
107
+ );
108
+ }
109
+ return ov;
110
+ },
111
+ cleanup(ov) {
112
+ listeners.forEach((l) => l.remove());
113
+ listeners.length = 0;
114
+ ov.setMap(null);
115
+ }
116
+ });
117
+ if (advancedMarkerElementContext) {
118
+ watch(
119
+ () => {
120
+ const pos = advancedMarkerElementContext.advancedMarkerElement.value?.position;
121
+ if (!pos)
122
+ return void 0;
123
+ if ("lat" in pos && typeof pos.lat === "function")
124
+ return { lat: pos.lat(), lng: pos.lng() };
125
+ return pos;
126
+ },
127
+ () => {
128
+ overlay.value?.draw();
129
+ }
130
+ );
131
+ }
132
+ watch(
133
+ () => [props.position?.lat, props.position?.lng, props.offset?.x, props.offset?.y, props.zIndex, props.anchor],
134
+ () => {
135
+ overlay.value?.draw();
136
+ }
137
+ );
138
+ watch(() => open.value, () => {
139
+ if (!overlay.value)
140
+ return;
141
+ overlay.value.draw();
142
+ });
143
+ watch(() => props.pane, () => {
144
+ if (overlay.value) {
145
+ const map = overlay.value.getMap();
146
+ overlay.value.setMap(null);
147
+ if (map)
148
+ overlay.value.setMap(map);
149
+ }
150
+ });
151
+ watch(() => props.blockMapInteraction, () => {
152
+ if (overlay.value) {
153
+ const map = overlay.value.getMap();
154
+ overlay.value.setMap(null);
155
+ if (map)
156
+ overlay.value.setMap(map);
157
+ }
158
+ });
159
+ defineExpose({ overlay });
160
+ </script>
161
+
162
+ <template>
163
+ <div style="display: none;">
164
+ <div ref="overlay-content">
165
+ <slot />
166
+ </div>
167
+ </div>
168
+ </template>
@@ -0,0 +1,40 @@
1
+ type OverlayAnchor = 'center' | 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left-center' | 'right-center';
2
+ type OverlayPane = 'mapPane' | 'overlayLayer' | 'markerLayer' | 'overlayMouseTarget' | 'floatPane';
3
+ type __VLS_Props = {
4
+ position?: google.maps.LatLngLiteral;
5
+ anchor?: OverlayAnchor;
6
+ offset?: {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ pane?: OverlayPane;
11
+ zIndex?: number;
12
+ blockMapInteraction?: boolean;
13
+ };
14
+ type __VLS_ModelProps = {
15
+ 'open'?: boolean;
16
+ };
17
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
18
+ declare var __VLS_1: {};
19
+ type __VLS_Slots = {} & {
20
+ default?: (props: typeof __VLS_1) => any;
21
+ };
22
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
23
+ overlay: import("vue").ShallowRef<google.maps.OverlayView | undefined>;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ "update:open": (value: boolean | undefined) => any;
26
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
+ "onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
28
+ }>, {
29
+ anchor: OverlayAnchor;
30
+ pane: OverlayPane;
31
+ blockMapInteraction: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { watch } from "vue";
3
+ import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
3
4
  import { useGoogleMapsResource } from "./useGoogleMapsResource";
4
5
  const props = defineProps({
5
6
  options: { type: Object, required: false }
@@ -23,7 +24,9 @@ const eventsWithMapMouseEventPayload = [
23
24
  const polygon = useGoogleMapsResource({
24
25
  create({ mapsApi, map }) {
25
26
  const p = new mapsApi.Polygon({ map, ...props.options });
26
- setupEventListeners(p);
27
+ bindGoogleMapsEvents(p, emit, {
28
+ withPayload: [...eventsWithPolyMouseEventPayload, ...eventsWithMapMouseEventPayload]
29
+ });
27
30
  return p;
28
31
  },
29
32
  cleanup(p, { mapsApi }) {
@@ -36,14 +39,6 @@ watch(() => props.options, (options) => {
36
39
  polygon.value.setOptions(options);
37
40
  }
38
41
  }, { deep: true });
39
- function setupEventListeners(p) {
40
- eventsWithPolyMouseEventPayload.forEach((event) => {
41
- p.addListener(event, (payload) => emit(event, payload));
42
- });
43
- eventsWithMapMouseEventPayload.forEach((event) => {
44
- p.addListener(event, (payload) => emit(event, payload));
45
- });
46
- }
47
42
  </script>
48
43
 
49
44
  <template>
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { watch } from "vue";
3
+ import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
3
4
  import { useGoogleMapsResource } from "./useGoogleMapsResource";
4
5
  const props = defineProps({
5
6
  options: { type: Object, required: false }
@@ -23,7 +24,9 @@ const eventsWithMapMouseEventPayload = [
23
24
  const polyline = useGoogleMapsResource({
24
25
  create({ mapsApi, map }) {
25
26
  const p = new mapsApi.Polyline({ map, ...props.options });
26
- setupEventListeners(p);
27
+ bindGoogleMapsEvents(p, emit, {
28
+ withPayload: [...eventsWithPolyMouseEventPayload, ...eventsWithMapMouseEventPayload]
29
+ });
27
30
  return p;
28
31
  },
29
32
  cleanup(p, { mapsApi }) {
@@ -36,14 +39,6 @@ watch(() => props.options, (options) => {
36
39
  polyline.value.setOptions(options);
37
40
  }
38
41
  }, { deep: true });
39
- function setupEventListeners(p) {
40
- eventsWithPolyMouseEventPayload.forEach((event) => {
41
- p.addListener(event, (payload) => emit(event, payload));
42
- });
43
- eventsWithMapMouseEventPayload.forEach((event) => {
44
- p.addListener(event, (payload) => emit(event, payload));
45
- });
46
- }
47
42
  </script>
48
43
 
49
44
  <template>
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { watch } from "vue";
3
+ import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
3
4
  import { useGoogleMapsResource } from "./useGoogleMapsResource";
4
5
  const props = defineProps({
5
6
  options: { type: Object, required: false }
@@ -24,7 +25,10 @@ const eventsWithMapMouseEventPayload = [
24
25
  const rectangle = useGoogleMapsResource({
25
26
  create({ mapsApi, map }) {
26
27
  const r = new mapsApi.Rectangle({ map, ...props.options });
27
- setupEventListeners(r);
28
+ bindGoogleMapsEvents(r, emit, {
29
+ noPayload: eventsWithoutPayload,
30
+ withPayload: eventsWithMapMouseEventPayload
31
+ });
28
32
  return r;
29
33
  },
30
34
  cleanup(r, { mapsApi }) {
@@ -37,14 +41,6 @@ watch(() => props.options, (options) => {
37
41
  rectangle.value.setOptions(options);
38
42
  }
39
43
  }, { deep: true });
40
- function setupEventListeners(r) {
41
- eventsWithoutPayload.forEach((event) => {
42
- r.addListener(event, () => emit(event));
43
- });
44
- eventsWithMapMouseEventPayload.forEach((event) => {
45
- r.addListener(event, (payload) => emit(event, payload));
46
- });
47
- }
48
44
  </script>
49
45
 
50
46
  <template>
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Bind Google Maps event listeners that forward to Vue emit.
3
+ *
4
+ * Two categories:
5
+ * - `noPayload`: emits with no arguments (state-change events like `position_changed`)
6
+ * - `withPayload`: forwards the first argument from the listener (mouse events, etc.)
7
+ */
8
+ export declare function bindGoogleMapsEvents(instance: {
9
+ addListener: (event: string, handler: (...args: any[]) => void) => void;
10
+ }, emit: (...args: any[]) => void, config: {
11
+ noPayload?: readonly string[];
12
+ withPayload?: readonly string[];
13
+ }): void;
@@ -0,0 +1,8 @@
1
+ export function bindGoogleMapsEvents(instance, emit, config) {
2
+ config.noPayload?.forEach((event) => {
3
+ instance.addListener(event, () => emit(event));
4
+ });
5
+ config.withPayload?.forEach((event) => {
6
+ instance.addListener(event, (payload) => emit(event, payload));
7
+ });
8
+ }
@@ -1,5 +1,6 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
2
  import { GravatarOptions } from './schemas.js';
3
+ export { GravatarOptions } from './schemas.js';
3
4
  export type GravatarInput = RegistryScriptInput<typeof GravatarOptions>;
4
5
  export interface GravatarApi {
5
6
  /**
@@ -1,5 +1,6 @@
1
1
  import { useRegistryScript } from "#nuxt-scripts/utils";
2
2
  import { GravatarOptions } from "./schemas.js";
3
+ export { GravatarOptions } from "./schemas.js";
3
4
  export function useScriptGravatar(_options) {
4
5
  return useRegistryScript(_options?.key || "gravatar", (options) => {
5
6
  const size = options?.size ?? 80;
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<ArrayBuffer | undefined>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
2
2
  export default _default;
@@ -29,7 +29,6 @@ export default defineEventHandler(async (event) => {
29
29
  r: rating
30
30
  });
31
31
  const response = await $fetch.raw(gravatarUrl, {
32
- responseType: "arrayBuffer",
33
32
  headers: {
34
33
  "User-Agent": "Nuxt Scripts Gravatar Proxy"
35
34
  }
package/dist/stats.d.mts CHANGED
@@ -54,17 +54,49 @@ interface ScriptApis {
54
54
  performanceObserver: boolean;
55
55
  intersectionObserver: boolean;
56
56
  }
57
- interface ApiPrivacyScore {
57
+ type PrivacyGrade = 'A+' | 'A' | 'B' | 'C' | 'D' | 'F';
58
+ interface PrivacyRating {
59
+ /** Overall letter grade */
60
+ grade: PrivacyGrade;
58
61
  /** 0–100, higher = more invasive */
59
62
  score: number;
60
- /** Persistence APIs used (cookies, localStorage, sessionStorage, indexedDB) */
61
- persistence: number;
62
- /** Fingerprinting APIs used (canvas, webgl, audioContext, deviceMemory, hardwareConcurrency, plugins, screen, userAgent, languages, timezone, platform, vendor, connection, maxTouchPoints, devicePixelRatio, mediaDevices, getBattery) */
63
- fingerprinting: number;
64
- /** Tracking APIs used (referrer, windowName, rtcPeerConnection, geolocation, serviceWorker, cacheApi) */
65
- tracking: number;
66
- /** Behavioral monitoring APIs used (mutationObserver, intersectionObserver) */
67
- monitoring: number;
63
+ /** Breakdown by privacy concern category */
64
+ breakdown: {
65
+ /** Browser fingerprinting APIs entropy-weighted per AmIUnique/Panopticlick research (0–30) */
66
+ fingerprinting: {
67
+ score: number;
68
+ apis: string[];
69
+ };
70
+ /** Persistent storage + cookie tracking (0–25) */
71
+ persistence: {
72
+ score: number;
73
+ thirdPartyCookies: number;
74
+ longLivedCookies: number;
75
+ storageApis: string[];
76
+ };
77
+ /** Cross-domain data exfiltration & tracking network (0–25) */
78
+ network: {
79
+ score: number;
80
+ domains: number;
81
+ outboundBytes: number;
82
+ trackingPixels: number;
83
+ };
84
+ /** Behavioral observation APIs (0–10) */
85
+ monitoring: {
86
+ score: number;
87
+ apis: string[];
88
+ };
89
+ /** Data collection scope — what types of data are tracked (0–10) */
90
+ dataScope: {
91
+ score: number;
92
+ types: string[];
93
+ };
94
+ /** Fingerprint exfiltration — heavy FP APIs combined with outbound channels (0–25) */
95
+ fpExfiltration: {
96
+ score: number;
97
+ heavyApis: string[];
98
+ };
99
+ };
68
100
  }
69
101
  interface ScriptCookie {
70
102
  name: string;
@@ -102,6 +134,44 @@ interface PerformanceSummary {
102
134
  scriptDurationMs: number;
103
135
  heapDeltaKb: number;
104
136
  }
137
+ type PerformanceGrade = 'A+' | 'A' | 'B' | 'C' | 'D' | 'F';
138
+ interface PerformanceRating {
139
+ /** Overall letter grade */
140
+ grade: PerformanceGrade;
141
+ /** 0–100, higher = worse performance impact */
142
+ score: number;
143
+ /** Breakdown by impact area */
144
+ breakdown: {
145
+ /** Network cost — transfer size relative to performance budgets (0–30) */
146
+ networkCost: {
147
+ score: number;
148
+ transferKb: number;
149
+ };
150
+ /** Main thread blocking — task duration that delays interactivity (0–30) */
151
+ mainThread: {
152
+ score: number;
153
+ taskDurationMs: number;
154
+ scriptDurationMs: number;
155
+ };
156
+ /** Memory pressure — heap allocation impact (0–20) */
157
+ memory: {
158
+ score: number;
159
+ heapDeltaKb: number;
160
+ };
161
+ /** Connection overhead — additional HTTP requests (0–10) */
162
+ connections: {
163
+ score: number;
164
+ requestCount: number;
165
+ };
166
+ /** CWV risk — estimated Core Web Vitals impact (0–10) */
167
+ cwvRisk: {
168
+ score: number;
169
+ lcpImpactMs: number;
170
+ clsRisk: boolean;
171
+ inpRiskLevel: string;
172
+ };
173
+ };
174
+ }
105
175
  interface ScriptStats {
106
176
  id: string;
107
177
  label: string;
@@ -112,10 +182,11 @@ interface ScriptStats {
112
182
  trackedData: TrackedDataType[];
113
183
  collectsWebVitals: boolean;
114
184
  apis: ScriptApis;
115
- apiPrivacyScore: ApiPrivacyScore;
185
+ privacyRating: PrivacyRating;
116
186
  cookies: ScriptCookie[];
117
187
  network: NetworkSummary;
118
188
  performance: PerformanceSummary;
189
+ performanceRating: PerformanceRating;
119
190
  cwvEstimate: CwvEstimate;
120
191
  hasBundling: boolean;
121
192
  hasProxy: boolean;
@@ -128,4 +199,4 @@ interface ScriptStats {
128
199
  declare function getScriptStats(): Promise<ScriptStats[]>;
129
200
 
130
201
  export { getScriptStats };
131
- export type { ApiPrivacyScore, CwvEstimate, NetworkSummary, PerformanceSummary, ScriptApis, ScriptCookie, ScriptPrivacy, ScriptSizeDetail, ScriptStats, TrackedDataType };
202
+ export type { CwvEstimate, NetworkSummary, PerformanceGrade, PerformanceRating, PerformanceSummary, PrivacyGrade, PrivacyRating, ScriptApis, ScriptCookie, ScriptPrivacy, ScriptSizeDetail, ScriptStats, TrackedDataType };
package/dist/stats.d.ts CHANGED
@@ -54,17 +54,49 @@ interface ScriptApis {
54
54
  performanceObserver: boolean;
55
55
  intersectionObserver: boolean;
56
56
  }
57
- interface ApiPrivacyScore {
57
+ type PrivacyGrade = 'A+' | 'A' | 'B' | 'C' | 'D' | 'F';
58
+ interface PrivacyRating {
59
+ /** Overall letter grade */
60
+ grade: PrivacyGrade;
58
61
  /** 0–100, higher = more invasive */
59
62
  score: number;
60
- /** Persistence APIs used (cookies, localStorage, sessionStorage, indexedDB) */
61
- persistence: number;
62
- /** Fingerprinting APIs used (canvas, webgl, audioContext, deviceMemory, hardwareConcurrency, plugins, screen, userAgent, languages, timezone, platform, vendor, connection, maxTouchPoints, devicePixelRatio, mediaDevices, getBattery) */
63
- fingerprinting: number;
64
- /** Tracking APIs used (referrer, windowName, rtcPeerConnection, geolocation, serviceWorker, cacheApi) */
65
- tracking: number;
66
- /** Behavioral monitoring APIs used (mutationObserver, intersectionObserver) */
67
- monitoring: number;
63
+ /** Breakdown by privacy concern category */
64
+ breakdown: {
65
+ /** Browser fingerprinting APIs entropy-weighted per AmIUnique/Panopticlick research (0–30) */
66
+ fingerprinting: {
67
+ score: number;
68
+ apis: string[];
69
+ };
70
+ /** Persistent storage + cookie tracking (0–25) */
71
+ persistence: {
72
+ score: number;
73
+ thirdPartyCookies: number;
74
+ longLivedCookies: number;
75
+ storageApis: string[];
76
+ };
77
+ /** Cross-domain data exfiltration & tracking network (0–25) */
78
+ network: {
79
+ score: number;
80
+ domains: number;
81
+ outboundBytes: number;
82
+ trackingPixels: number;
83
+ };
84
+ /** Behavioral observation APIs (0–10) */
85
+ monitoring: {
86
+ score: number;
87
+ apis: string[];
88
+ };
89
+ /** Data collection scope — what types of data are tracked (0–10) */
90
+ dataScope: {
91
+ score: number;
92
+ types: string[];
93
+ };
94
+ /** Fingerprint exfiltration — heavy FP APIs combined with outbound channels (0–25) */
95
+ fpExfiltration: {
96
+ score: number;
97
+ heavyApis: string[];
98
+ };
99
+ };
68
100
  }
69
101
  interface ScriptCookie {
70
102
  name: string;
@@ -102,6 +134,44 @@ interface PerformanceSummary {
102
134
  scriptDurationMs: number;
103
135
  heapDeltaKb: number;
104
136
  }
137
+ type PerformanceGrade = 'A+' | 'A' | 'B' | 'C' | 'D' | 'F';
138
+ interface PerformanceRating {
139
+ /** Overall letter grade */
140
+ grade: PerformanceGrade;
141
+ /** 0–100, higher = worse performance impact */
142
+ score: number;
143
+ /** Breakdown by impact area */
144
+ breakdown: {
145
+ /** Network cost — transfer size relative to performance budgets (0–30) */
146
+ networkCost: {
147
+ score: number;
148
+ transferKb: number;
149
+ };
150
+ /** Main thread blocking — task duration that delays interactivity (0–30) */
151
+ mainThread: {
152
+ score: number;
153
+ taskDurationMs: number;
154
+ scriptDurationMs: number;
155
+ };
156
+ /** Memory pressure — heap allocation impact (0–20) */
157
+ memory: {
158
+ score: number;
159
+ heapDeltaKb: number;
160
+ };
161
+ /** Connection overhead — additional HTTP requests (0–10) */
162
+ connections: {
163
+ score: number;
164
+ requestCount: number;
165
+ };
166
+ /** CWV risk — estimated Core Web Vitals impact (0–10) */
167
+ cwvRisk: {
168
+ score: number;
169
+ lcpImpactMs: number;
170
+ clsRisk: boolean;
171
+ inpRiskLevel: string;
172
+ };
173
+ };
174
+ }
105
175
  interface ScriptStats {
106
176
  id: string;
107
177
  label: string;
@@ -112,10 +182,11 @@ interface ScriptStats {
112
182
  trackedData: TrackedDataType[];
113
183
  collectsWebVitals: boolean;
114
184
  apis: ScriptApis;
115
- apiPrivacyScore: ApiPrivacyScore;
185
+ privacyRating: PrivacyRating;
116
186
  cookies: ScriptCookie[];
117
187
  network: NetworkSummary;
118
188
  performance: PerformanceSummary;
189
+ performanceRating: PerformanceRating;
119
190
  cwvEstimate: CwvEstimate;
120
191
  hasBundling: boolean;
121
192
  hasProxy: boolean;
@@ -128,4 +199,4 @@ interface ScriptStats {
128
199
  declare function getScriptStats(): Promise<ScriptStats[]>;
129
200
 
130
201
  export { getScriptStats };
131
- export type { ApiPrivacyScore, CwvEstimate, NetworkSummary, PerformanceSummary, ScriptApis, ScriptCookie, ScriptPrivacy, ScriptSizeDetail, ScriptStats, TrackedDataType };
202
+ export type { CwvEstimate, NetworkSummary, PerformanceGrade, PerformanceRating, PerformanceSummary, PrivacyGrade, PrivacyRating, ScriptApis, ScriptCookie, ScriptPrivacy, ScriptSizeDetail, ScriptStats, TrackedDataType };