afterbefore 0.2.1 → 0.2.2

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.
package/README.md CHANGED
@@ -34,7 +34,7 @@ export default function RootLayout({ children }) {
34
34
  ### 2. Create the API route
35
35
 
36
36
  ```ts
37
- // app/api/__afterbefore/[...path]/route.ts
37
+ // app/api/afterbefore/[...path]/route.ts
38
38
  export { GET, POST } from "afterbefore/server"
39
39
  ```
40
40
 
@@ -51,6 +51,16 @@ export default withAfterBefore({
51
51
 
52
52
  The config wrapper adds a dev-only rewrite from `/__afterbefore/*` to the API route. It does nothing in production.
53
53
 
54
+ > **Next.js 16+ / Turbopack:** If `withAfterBefore` fails to import (`ERR_PACKAGE_PATH_NOT_EXPORTED`), you can inline the rewrite as a workaround:
55
+ >
56
+ > ```ts
57
+ > // Workaround if withAfterBefore import fails with Turbopack:
58
+ > rewrites: process.env.NODE_ENV === "development"
59
+ > ? async () => [{ source: "/__afterbefore/:path*", destination: "/api/afterbefore/:path*" }]
60
+ > : undefined,
61
+ > ```
62
+
63
+
54
64
  ## How it works
55
65
 
56
66
  1. A floating icon appears in the bottom-left corner of your dev server
package/dist/next.js CHANGED
@@ -8,7 +8,7 @@ function withAfterBefore(config = {}) {
8
8
  const rules = [
9
9
  {
10
10
  source: "/__afterbefore/:path*",
11
- destination: "/api/__afterbefore/:path*"
11
+ destination: "/api/afterbefore/:path*"
12
12
  }
13
13
  ];
14
14
  if (Array.isArray(existing)) {
package/dist/next.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/next.ts"],"sourcesContent":["import type { NextConfig } from \"next\";\n\ntype Rewrite = { source: string; destination: string };\n\nexport function withAfterBefore(config: NextConfig = {}): NextConfig {\n if (process.env.NODE_ENV !== \"development\") return config;\n\n return {\n ...config,\n async rewrites() {\n const existing = (await config.rewrites?.()) ?? [];\n const rules: Rewrite[] = [\n {\n source: \"/__afterbefore/:path*\",\n destination: \"/api/__afterbefore/:path*\",\n },\n ];\n\n if (Array.isArray(existing)) {\n return [...rules, ...existing];\n }\n\n return {\n beforeFiles: [...rules, ...(existing.beforeFiles ?? [])],\n afterFiles: existing.afterFiles ?? [],\n fallback: existing.fallback ?? [],\n };\n },\n };\n}\n"],"mappings":";AAIO,SAAS,gBAAgB,SAAqB,CAAC,GAAe;AACnE,MAAI,QAAQ,IAAI,aAAa,cAAe,QAAO;AAEnD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM,WAAW;AACf,YAAM,WAAY,MAAM,OAAO,WAAW,KAAM,CAAC;AACjD,YAAM,QAAmB;AAAA,QACvB;AAAA,UACE,QAAQ;AAAA,UACR,aAAa;AAAA,QACf;AAAA,MACF;AAEA,UAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,eAAO,CAAC,GAAG,OAAO,GAAG,QAAQ;AAAA,MAC/B;AAEA,aAAO;AAAA,QACL,aAAa,CAAC,GAAG,OAAO,GAAI,SAAS,eAAe,CAAC,CAAE;AAAA,QACvD,YAAY,SAAS,cAAc,CAAC;AAAA,QACpC,UAAU,SAAS,YAAY,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/next.ts"],"sourcesContent":["import type { NextConfig } from \"next\";\n\ntype Rewrite = { source: string; destination: string };\n\nexport function withAfterBefore(config: NextConfig = {}): NextConfig {\n if (process.env.NODE_ENV !== \"development\") return config;\n\n return {\n ...config,\n async rewrites() {\n const existing = (await config.rewrites?.()) ?? [];\n const rules: Rewrite[] = [\n {\n source: \"/__afterbefore/:path*\",\n destination: \"/api/afterbefore/:path*\",\n },\n ];\n\n if (Array.isArray(existing)) {\n return [...rules, ...existing];\n }\n\n return {\n beforeFiles: [...rules, ...(existing.beforeFiles ?? [])],\n afterFiles: existing.afterFiles ?? [],\n fallback: existing.fallback ?? [],\n };\n },\n };\n}\n"],"mappings":";AAIO,SAAS,gBAAgB,SAAqB,CAAC,GAAe;AACnE,MAAI,QAAQ,IAAI,aAAa,cAAe,QAAO;AAEnD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM,WAAW;AACf,YAAM,WAAY,MAAM,OAAO,WAAW,KAAM,CAAC;AACjD,YAAM,QAAmB;AAAA,QACvB;AAAA,UACE,QAAQ;AAAA,UACR,aAAa;AAAA,QACf;AAAA,MACF;AAEA,UAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,eAAO,CAAC,GAAG,OAAO,GAAG,QAAQ;AAAA,MAC/B;AAEA,aAAO;AAAA,QACL,aAAa,CAAC,GAAG,OAAO,GAAI,SAAS,eAAe,CAAC,CAAE;AAAA,QACvD,YAAY,SAAS,cAAc,CAAC;AAAA,QACpC,UAAU,SAAS,YAAY,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afterbefore",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Before/after screenshot overlay for Next.js development",
5
5
  "type": "module",
6
6
  "main": "./dist/overlay/index.js",
@@ -12,6 +12,8 @@
12
12
  },
13
13
  "./next": {
14
14
  "import": "./dist/next.js",
15
+ "require": "./dist/next.js",
16
+ "default": "./dist/next.js",
15
17
  "types": "./dist/next.d.ts"
16
18
  },
17
19
  "./server": {