Skip to content

Commit ba424e8

Browse files
authored
release(package): v1.0.0 (#17)
2 parents f1b2e48 + 536e31d commit ba424e8

File tree

13 files changed

+1398
-963
lines changed

13 files changed

+1398
-963
lines changed

.changeset/tired-cougars-do.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@simpleanalytics/next": major
3+
---
4+
5+
# 1.0.0
6+
7+
Initial release of the Simple Analytics for Next.js package.

apps/docs/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@
99
"postinstall": "fumadocs-mdx"
1010
},
1111
"dependencies": {
12+
"@simpleanalytics/next": "workspace:*",
1213
"clsx": "^2.1.1",
1314
"fumadocs-core": "14.7.7",
1415
"fumadocs-docgen": "^1.3.5",
15-
"fumadocs-mdx": "11.3.1",
16-
"fumadocs-typescript": "^3.0.3",
16+
"fumadocs-mdx": "11.5.7",
17+
"fumadocs-typescript": "^3.1.0",
1718
"fumadocs-ui": "14.7.7",
18-
"lucide-react": "^0.474.0",
19-
"next": "15.1.5",
19+
"lucide-react": "^0.483.0",
20+
"next": "15.2.3",
2021
"react": "^19.0.0",
2122
"react-dom": "^19.0.0",
2223
"source-map-support": "^0.5.21",
23-
"tailwind-merge": "^2.6.0",
24-
"@simpleanalytics/next": "workspace:*"
24+
"tailwind-merge": "^3.0.2"
2525
},
2626
"devDependencies": {
2727
"@types/mdx": "^2.0.13",
28-
"@types/node": "22.10.7",
29-
"@types/react": "^19.0.7",
30-
"@types/react-dom": "^19.0.3",
31-
"autoprefixer": "^10.4.20",
28+
"@types/node": "22.13.11",
29+
"@types/react": "^19.0.12",
30+
"@types/react-dom": "^19.0.4",
31+
"autoprefixer": "^10.4.21",
3232
"eslint": "^8",
33-
"eslint-config-next": "15.1.5",
34-
"postcss": "^8.5.1",
33+
"eslint-config-next": "15.2.3",
34+
"postcss": "^8.5.3",
3535
"tailwindcss": "^3.4.17",
36-
"typescript": "^5.7.3"
36+
"typescript": "^5.8.2"
3737
}
3838
}

examples/nextjs/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
},
1212
"dependencies": {
1313
"@simpleanalytics/next": "workspace:*",
14-
"next": "15.1.5",
14+
"next": "15.2.3",
1515
"react": "^19.0.0",
1616
"react-dom": "^19.0.0"
1717
},
1818
"devDependencies": {
19-
"@types/node": "^22.10.7",
20-
"@types/react": "^19.0.7",
21-
"@types/react-dom": "^19.0.3",
22-
"postcss": "^8.5.1",
19+
"@types/node": "^22.13.11",
20+
"@types/react": "^19.0.12",
21+
"@types/react-dom": "^19.0.4",
22+
"postcss": "^8.5.3",
2323
"tailwindcss": "^3.4.1",
24-
"typescript": "^5.7.3"
24+
"typescript": "^5.8.2"
2525
}
2626
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"format": "prettier --write \"**/*.{ts,tsx,md}\""
99
},
1010
"devDependencies": {
11-
"turbo": "latest"
11+
"turbo": "^2.4.4"
1212
},
1313
"packageManager": "pnpm@9.15.0"
1414
}

packages/analytics/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simpleanalytics/next",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "Simple Analytics for Next.js",
55
"keywords": [
66
"analytics",
@@ -33,12 +33,12 @@
3333
"server-only": "^0.0.1"
3434
},
3535
"devDependencies": {
36-
"@types/node": "^22.10.7",
37-
"@types/react": "^19.0.7",
36+
"@types/node": "^22.13.11",
37+
"@types/react": "^19.0.12",
3838
"esbuild-plugin-preserve-directives": "^0.0.11",
39-
"prettier": "3.4.2",
40-
"tsup": "^8.3.5",
41-
"webpack": "latest"
39+
"prettier": "3.5.3",
40+
"tsup": "^8.4.0",
41+
"webpack": "^5.98.0"
4242
},
4343
"peerDependencies": {
4444
"next": ">= 13",

packages/analytics/src/client/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export function parseDataProps(settings?: SimpleAnalyticsProps) {
3232
}
3333

3434
if (!isProduction()) {
35-
console.log("Simple Analytics is disabled by default in development and preview environments, enable it by setting NEXT_PUBLIC_ENABLE_ANALYTICS_IN_DEV=1 in your environment");
35+
console.log(
36+
"Simple Analytics is disabled by default in development and preview environments, enable it by setting NEXT_PUBLIC_ENABLE_ANALYTICS_IN_DEV=1 in your environment",
37+
);
3638
return {};
3739
}
3840

packages/analytics/src/middleware/routes.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ interface RoutesModule {
44

55
const INTERNAL_ANALYTICS_PATHS = /^\/(proxy\.js|auto-events\.js|simple\/.*)$/;
66

7-
export async function isIndexedRoute(path: string) {
7+
export async function isValidPageview(path: string) {
88
if (INTERNAL_ANALYTICS_PATHS.test(path)) {
99
return false;
1010
}
1111

12-
// @ts-expect-error
13-
const { pattern }: RoutesModule = await import("DO_NOT_USE_OR_JEAN_WILL_GET_FIRED");
12+
const { pattern }: RoutesModule = await import(
13+
// @ts-expect-error
14+
"DO_NOT_USE_OR_JEAN_WILL_GET_FIRED"
15+
);
1416

1517
return pattern.test(path);
1618
}

packages/analytics/src/middleware/track-pageview.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ import type {
44
ServerContext,
55
TrackingOptions,
66
} from "../server/interfaces";
7-
import { isBuildTime, isDoNotTrackEnabled, isProduction, parseRequest, isEnhancedBotDetectionEnabled } from "../server/utils";
7+
import {
8+
isBuildTime,
9+
isDoNotTrackEnabled,
10+
isProduction,
11+
parseRequest,
12+
isEnhancedBotDetectionEnabled,
13+
} from "../server/utils";
814
import { parseUtmParameters } from "../server/utm";
9-
import { isIndexedRoute } from "./routes";
15+
import { isValidPageview } from "./routes";
1016

1117
type TrackPageviewOptions = TrackingOptions & ServerContext;
1218

@@ -43,11 +49,13 @@ export async function trackPageview(options: TrackPageviewOptions) {
4349
}
4450

4551
if (!isProduction()) {
46-
console.log("Simple Analytics is disabled by default in development and preview environments, enable it by setting ENABLE_ANALYTICS_IN_DEV=1 in your environment");
52+
console.log(
53+
"Simple Analytics is disabled by default in development and preview environments, enable it by setting ENABLE_ANALYTICS_IN_DEV=1 in your environment",
54+
);
4755
return;
4856
}
4957

50-
if (!(await isIndexedRoute(path))) {
58+
if (!(await isValidPageview(path))) {
5159
return;
5260
}
5361

@@ -68,7 +76,10 @@ export async function trackPageview(options: TrackPageviewOptions) {
6876
method: "POST",
6977
headers: {
7078
"Content-Type": "application/json",
71-
...(headers.has("X-Forwarded-For") && isEnhancedBotDetectionEnabled(options) && { "X-Forwarded-For": headers.get("X-Forwarded-For")! }),
79+
...(headers.has("X-Forwarded-For") &&
80+
isEnhancedBotDetectionEnabled(options) && {
81+
"X-Forwarded-For": headers.get("X-Forwarded-For")!,
82+
}),
7283
},
7384
body: JSON.stringify(payload),
7485
});

packages/analytics/src/plugin/routes.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,5 +316,7 @@ export function resolveRoutes(options = { useAbsolutePath: false }): string {
316316
// Write collected routes to file
317317
writeRoutesToFile(process.cwd(), routes);
318318

319-
return options.useAbsolutePath ? resolve(resolve(process.cwd(), ".simpleanalytics"), "routes.js") : "./.simpleanalytics/routes.js";
320-
}
319+
return options.useAbsolutePath
320+
? resolve(resolve(process.cwd(), ".simpleanalytics"), "routes.js")
321+
: "./.simpleanalytics/routes.js";
322+
}

packages/analytics/src/plugin/with-simple-analytics.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export function withSimpleAnalytics(
5353
...nextConfig?.experimental?.turbo?.resolveAlias,
5454
// Turbo aliases don't work with absolute
5555
// paths (see error handling above)
56-
"DO_NOT_USE_OR_JEAN_WILL_GET_FIRED": resolveRoutes()
57-
}
58-
}
56+
DO_NOT_USE_OR_JEAN_WILL_GET_FIRED: resolveRoutes(),
57+
},
58+
},
5959
},
6060
webpack(config: Configuration, options: WebpackConfigContext) {
6161
config = {
@@ -64,11 +64,13 @@ export function withSimpleAnalytics(
6464
...config.resolve,
6565
alias: {
6666
...config.resolve?.alias,
67-
"DO_NOT_USE_OR_JEAN_WILL_GET_FIRED": resolveRoutes({ useAbsolutePath: true })
68-
}
69-
}
67+
DO_NOT_USE_OR_JEAN_WILL_GET_FIRED: resolveRoutes({
68+
useAbsolutePath: true,
69+
}),
70+
},
71+
},
7072
};
71-
73+
7274
return nextConfig.webpack?.(config, options) ?? config;
7375
},
7476
}),

0 commit comments

Comments
 (0)