@fougere/next 0.5.0-alpha.1 → 0.7.0-alpha.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,wBAAgB,WAAW,CAAC,MAAM,GAAE,UAAe,GAAG,UAAU,CAkC/D"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,wBAAgB,WAAW,CAAC,MAAM,GAAE,UAAe,GAAG,UAAU,CAkC/D"}
package/dist/config.js CHANGED
@@ -1,36 +1,4 @@
1
- /**
2
- * `withFougere(config)` — what Next has to be told so a Fougere app builds.
3
- *
4
- * ```ts
5
- * // next.config.ts
6
- * import { withFougere } from '@fougere/next/config';
7
- *
8
- * export default withFougere({ reactStrictMode: true });
9
- * ```
10
- *
11
- * The adapter owns the host's quirks. Nothing here leaks into the framework, and
12
- * nothing here asks the developer to write anything twice — a Next-specific
13
- * problem gets a Next-specific answer, in the Next package.
14
- *
15
- * Two things are set, both measured against a real production build:
16
- *
17
- * 1. **Class names survive minification.** Designation is class + verb, so
18
- * `invoke(Post, 'list')` and `useQuery(Post, 'list')` read `Post.name`. Next's
19
- * minifier renames it, and the call goes looking for an entity nobody hosts —
20
- * `Entity 'j' is not hosted here. Hosted here: post`. Next's own knob
21
- * (`noMangling`) is internal and all-or-nothing, so the minimizer is replaced by
22
- * terser with `keep_classnames`, which keeps mangling everything else.
23
- * Verified: the production browser chunk contains `class Post extends`.
24
- *
25
- * 2. **The scan's dependencies stay out of the bundle.** A boot reads frond
26
- * sources off disk through jiti, so those packages must be loaded at runtime
27
- * rather than compiled in.
28
- *
29
- * **Limit, stated rather than discovered later:** this rides Next's `webpack()`
30
- * hook, which Turbopack ignores. Next 16 builds with Turbopack by default, so an
31
- * app on 16 needs `next build --webpack` until Turbopack exposes a minifier option.
32
- * Next also documents its webpack config as outside semver.
33
- */
1
+ /** `withFougere(config)` — what Next has to be told so a Fougere app builds. */
34
2
  import TerserPlugin from 'terser-webpack-plugin';
35
3
  import { RUNTIME_PACKAGES } from '@fougere/core/node';
36
4
  export function withFougere(config = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,UAAU,WAAW,CAAC,MAAM,GAAe,EAAE;IACjD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;IAEnC,OAAO;QACL,GAAG,MAAM;QACT,qDAAqD;QACrD,sBAAsB,EAAE;YACtB,mFAAmF;YACnF,yFAAyF;YACzF,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,sBAAsB,IAAI,EAAE,CAAC,EAAE,GAAG,gBAAgB,EAAE,eAAe,CAAC,CAAC;SAC7F;QACD,OAAO,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,4EAA4E;YAC5E,gDAAgD;YAChD,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;YAE/E,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YACzB,+EAA+E;YAC/E,6EAA6E;YAC7E,gFAAgF;YAChF,gFAAgF;YAChF,yDAAyD;YACzD,MAAM,YAAY,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC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DAAyD;YACzD,MAAM,YAAY,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;YACjF,IAAI,CAAC,YAAY,CAAC,SAAS,GAAG;gBAC5B,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC/E,2EAA2E;gBAC3E,0EAA0E;gBAC1E,+DAA+D;gBAC/D,IAAI,YAAY,CAAC,EAAE,aAAa,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC;aAC/D,CAAC;YAEF,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,28 +1,4 @@
1
- /**
2
- * `@fougere/next` — what is Next about hosting a Fougere app, and nothing else.
3
- *
4
- * The package is deliberately thin, and its thinness is the measurement: the three
5
- * doors are Web-standard handlers living in `@fougere/app/web`, the four primitives
6
- * are React hooks living in `@fougere/react`, and neither imports Next. What is
7
- * left here is mounting (Next has no module API, so routes are three one-line files
8
- * under `app/`) and `next/headers`, the one import that is genuinely Next's.
9
- *
10
- * ```ts
11
- * // app/%5Ffougere/call/[[...surface]]/route.ts ← %5F, not _, see routes/call.ts
12
- * export { POST } from '@fougere/next/call';
13
- * // app/%5Ffougere/session/route.ts
14
- * export { GET } from '@fougere/next/session';
15
- * // app/api/[...fougere]/route.ts
16
- * export { GET, POST, PUT, PATCH, DELETE } from '@fougere/next/rest';
17
- * ```
18
- *
19
- * Nothing else in the app moves: pages, layouts, existing route handlers and an
20
- * existing auth setup are untouched. The scan runs on the first request that needs
21
- * the app (`useFougereApp` is lazy and memoized), so there is no build hook to
22
- * install and no generated file to keep in sync.
23
- *
24
- * Client primitives: `@fougere/react`.
25
- */
1
+ /** `@fougere/next` — what is Next about hosting a Fougere app, and nothing else. */
26
2
  export { invoke, getSession } from './invoke.js';
27
3
  export { configureFougere, useFougereApp, useFougereAuth, sessionViewOf, stateFor, type FougereServerConfig, type SessionView, } from '@fougere/app';
28
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAUjD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,aAAa,EACb,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAUjD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,aAAa,EACb,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,28 +1,4 @@
1
- /**
2
- * `@fougere/next` — what is Next about hosting a Fougere app, and nothing else.
3
- *
4
- * The package is deliberately thin, and its thinness is the measurement: the three
5
- * doors are Web-standard handlers living in `@fougere/app/web`, the four primitives
6
- * are React hooks living in `@fougere/react`, and neither imports Next. What is
7
- * left here is mounting (Next has no module API, so routes are three one-line files
8
- * under `app/`) and `next/headers`, the one import that is genuinely Next's.
9
- *
10
- * ```ts
11
- * // app/%5Ffougere/call/[[...surface]]/route.ts ← %5F, not _, see routes/call.ts
12
- * export { POST } from '@fougere/next/call';
13
- * // app/%5Ffougere/session/route.ts
14
- * export { GET } from '@fougere/next/session';
15
- * // app/api/[...fougere]/route.ts
16
- * export { GET, POST, PUT, PATCH, DELETE } from '@fougere/next/rest';
17
- * ```
18
- *
19
- * Nothing else in the app moves: pages, layouts, existing route handlers and an
20
- * existing auth setup are untouched. The scan runs on the first request that needs
21
- * the app (`useFougereApp` is lazy and memoized), so there is no build hook to
22
- * install and no generated file to keep in sync.
23
- *
24
- * Client primitives: `@fougere/react`.
25
- */
1
+ /** `@fougere/next` — what is Next about hosting a Fougere app, and nothing else. */
26
2
  export { invoke, getSession } from './invoke.js';
27
3
  // `withFougere` is deliberately NOT re-exported here. It is build-time config and
28
4
  // it pulls terser in; the root entry is imported by pages, so re-exporting it sent
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjD,kFAAkF;AAClF,mFAAmF;AACnF,iFAAiF;AACjF,4EAA4E;AAC5E,0BAA0B;AAE1B,oFAAoF;AACpF,uCAAuC;AACvC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,aAAa,EACb,QAAQ,GAGT,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjD,kFAAkF;AAClF,mFAAmF;AACnF,iFAAiF;AACjF,4EAA4E;AAC5E,0BAA0B;AAE1B,oFAAoF;AACpF,uCAAuC;AACvC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,aAAa,EACb,QAAQ,GAGT,MAAM,cAAc,CAAC"}
package/dist/invoke.d.ts CHANGED
@@ -1,15 +1,6 @@
1
1
  /**
2
- * The server dual of the couple, in Next — for server components, server actions
3
- * and route handlers.
4
- *
5
- * Same designation as the browser side (class + verb), same return, same errors.
6
- * `invokeOn` places the call: a local façade executes in memory, a frond listed in
7
- * `remotes:` goes over JSON-RPC, and the caller never learns which.
8
- *
9
- * `next/headers` is the ONLY Next-specific import in this package — measured, and
10
- * it is what a host actually owns: how to find the current request. It answers
11
- * inside a request scope and throws outside one, so a call from a script or a test
12
- * is simply anonymous, the same fallback Nitro's `useEvent()` gets.
2
+ * The server dual of the couple, in Next — for server components, server actions and route
3
+ * handlers.
13
4
  */
14
5
  import { type SessionView } from '@fougere/app';
15
6
  import type { FrondCall, InvocationContext } from '@fougere/core';
@@ -1 +1 @@
1
- {"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAoD,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElE,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACpC,KAAK,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE5C,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1G,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAU1F,gGAAgG;AAChG,wBAAsB,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,CAEvD"}
1
+ {"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAoD,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElE,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACpC,KAAK,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE5C,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1G,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAU1F,gGAAgG;AAChG,wBAAsB,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,CAEvD"}
package/dist/invoke.js CHANGED
@@ -1,15 +1,6 @@
1
1
  /**
2
- * The server dual of the couple, in Next — for server components, server actions
3
- * and route handlers.
4
- *
5
- * Same designation as the browser side (class + verb), same return, same errors.
6
- * `invokeOn` places the call: a local façade executes in memory, a frond listed in
7
- * `remotes:` goes over JSON-RPC, and the caller never learns which.
8
- *
9
- * `next/headers` is the ONLY Next-specific import in this package — measured, and
10
- * it is what a host actually owns: how to find the current request. It answers
11
- * inside a request scope and throws outside one, so a call from a script or a test
12
- * is simply anonymous, the same fallback Nitro's `useEvent()` gets.
2
+ * The server dual of the couple, in Next — for server components, server actions and route
3
+ * handlers.
13
4
  */
14
5
  import { invokeOn, useFougereApp, sessionViewOf, stateFor } from '@fougere/app';
15
6
  export async function invoke(target, opOrInput, input) {
@@ -1 +1 @@
1
- {"version":3,"file":"invoke.js","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAQlG,MAAM,CAAC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G,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;QACjD,OAAO,MAAM,QAAQ,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -1,16 +1,7 @@
1
1
  /**
2
- * ```ts
3
- * // app/%5Ffougere/call/[[...surface]]/route.ts
4
- * export { POST } from '@fougere/next/call';
5
- * ```
6
- *
7
- * The folder is `%5Ffougere`, not `_fougere`: the App Router treats a leading
8
- * underscore as a PRIVATE folder and excludes it from routing, and `%5F` is Next's
9
- * own escape for a literal one. Measured the hard way — the door 404'd while every
10
- * other route answered.
11
- *
12
- * The optional catch-all is what serves a named surface: `/_fougere/call/public`
13
- * selects the `public` audience.
2
+ * ```ts // app/%5Ffougere/call/[[...surface]]/route.ts export { POST } from '@fougere/next/call';
3
+ * ``` The folder is `%5Ffougere`, not `_fougere`: the App Router treats a leading underscore as a
4
+ * PRIVATE folder and excludes it from routing, and `%5F` is Next's own escape for a literal one.
14
5
  */
15
6
  export { fougereCall as POST } from '@fougere/app/web';
16
7
  //# sourceMappingURL=call.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/routes/call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,WAAW,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/routes/call.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,16 +1,7 @@
1
1
  /**
2
- * ```ts
3
- * // app/%5Ffougere/call/[[...surface]]/route.ts
4
- * export { POST } from '@fougere/next/call';
5
- * ```
6
- *
7
- * The folder is `%5Ffougere`, not `_fougere`: the App Router treats a leading
8
- * underscore as a PRIVATE folder and excludes it from routing, and `%5F` is Next's
9
- * own escape for a literal one. Measured the hard way — the door 404'd while every
10
- * other route answered.
11
- *
12
- * The optional catch-all is what serves a named surface: `/_fougere/call/public`
13
- * selects the `public` audience.
2
+ * ```ts // app/%5Ffougere/call/[[...surface]]/route.ts export { POST } from '@fougere/next/call';
3
+ * ``` The folder is `%5Ffougere`, not `_fougere`: the App Router treats a leading underscore as a
4
+ * PRIVATE folder and excludes it from routing, and `%5F` is Next's own escape for a literal one.
14
5
  */
15
6
  export { fougereCall as POST } from '@fougere/app/web';
16
7
  //# sourceMappingURL=call.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/routes/call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,WAAW,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/routes/call.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,15 +1,7 @@
1
1
  /**
2
- * ```ts
3
- * // app/api/[...fougere]/route.ts
4
- * export { GET, POST, PUT, PATCH, DELETE } from '@fougere/next/rest';
5
- * ```
6
- *
7
- * Five names for one handler, because Next decides which verbs a route accepts by
8
- * which names it exports. Which verb reaches which OPERATION is decided elsewhere,
9
- * off the table `schema-rest` generates — this file does not narrow it.
10
- *
11
- * Next resolves a static segment (`app/api/health/route.ts`) before a catch-all, so
12
- * mounting this takes nothing away from an app that already serves `/api/*`.
2
+ * ```ts // app/api/[...fougere]/route.ts export { GET, POST, PUT, PATCH, DELETE } from
3
+ * '@fougere/next/rest'; ``` Five names for one handler, because Next decides which verbs a route
4
+ * accepts by which names it exports.
13
5
  */
14
6
  import { fougereRest } from '@fougere/app/web';
15
7
  export declare const GET: typeof fougereRest;
@@ -1 +1 @@
1
- {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../src/routes/rest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,eAAO,MAAM,GAAG,oBAAc,CAAC;AAC/B,eAAO,MAAM,IAAI,oBAAc,CAAC;AAChC,eAAO,MAAM,GAAG,oBAAc,CAAC;AAC/B,eAAO,MAAM,KAAK,oBAAc,CAAC;AACjC,eAAO,MAAM,MAAM,oBAAc,CAAC"}
1
+ {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../src/routes/rest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,eAAO,MAAM,GAAG,oBAAc,CAAC;AAC/B,eAAO,MAAM,IAAI,oBAAc,CAAC;AAChC,eAAO,MAAM,GAAG,oBAAc,CAAC;AAC/B,eAAO,MAAM,KAAK,oBAAc,CAAC;AACjC,eAAO,MAAM,MAAM,oBAAc,CAAC"}
@@ -1,15 +1,7 @@
1
1
  /**
2
- * ```ts
3
- * // app/api/[...fougere]/route.ts
4
- * export { GET, POST, PUT, PATCH, DELETE } from '@fougere/next/rest';
5
- * ```
6
- *
7
- * Five names for one handler, because Next decides which verbs a route accepts by
8
- * which names it exports. Which verb reaches which OPERATION is decided elsewhere,
9
- * off the table `schema-rest` generates — this file does not narrow it.
10
- *
11
- * Next resolves a static segment (`app/api/health/route.ts`) before a catch-all, so
12
- * mounting this takes nothing away from an app that already serves `/api/*`.
2
+ * ```ts // app/api/[...fougere]/route.ts export { GET, POST, PUT, PATCH, DELETE } from
3
+ * '@fougere/next/rest'; ``` Five names for one handler, because Next decides which verbs a route
4
+ * accepts by which names it exports.
13
5
  */
14
6
  import { fougereRest } from '@fougere/app/web';
15
7
  export const GET = fougereRest;
@@ -1 +1 @@
1
- {"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/routes/rest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,CAAC;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,CAAC;AAC/B,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;AACjC,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAAC"}
1
+ {"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/routes/rest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,CAAC;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,CAAC;AAC/B,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;AACjC,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAAC"}
@@ -1,8 +1,3 @@
1
- /**
2
- * ```ts
3
- * // app/%5Ffougere/session/route.ts
4
- * export { GET } from '@fougere/next/session';
5
- * ```
6
- */
1
+ /** ```ts // app/%5Ffougere/session/route.ts export { GET } from '@fougere/next/session'; ``` */
7
2
  export { fougereSession as GET } from '@fougere/app/web';
8
3
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/routes/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/routes/session.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAAE,cAAc,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,8 +1,3 @@
1
- /**
2
- * ```ts
3
- * // app/%5Ffougere/session/route.ts
4
- * export { GET } from '@fougere/next/session';
5
- * ```
6
- */
1
+ /** ```ts // app/%5Ffougere/session/route.ts export { GET } from '@fougere/next/session'; ``` */
7
2
  export { fougereSession as GET } from '@fougere/app/web';
8
3
  //# sourceMappingURL=session.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/routes/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/routes/session.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAAE,cAAc,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fougere/next",
3
- "version": "0.5.0-alpha.1",
3
+ "version": "0.7.0-alpha.0",
4
4
  "description": "The Next.js adapter: mounting, and the one import that is genuinely Next.",
5
5
  "keywords": [
6
6
  "fougere",
@@ -48,8 +48,8 @@
48
48
  ],
49
49
  "dependencies": {
50
50
  "terser-webpack-plugin": "^5.3.14",
51
- "@fougere/app": "0.5.0-alpha.1",
52
- "@fougere/core": "0.5.0-alpha.1"
51
+ "@fougere/app": "0.7.0-alpha.0",
52
+ "@fougere/core": "0.7.0-alpha.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "next": "^15.5.7",
package/src/config.ts CHANGED
@@ -1,36 +1,4 @@
1
- /**
2
- * `withFougere(config)` — what Next has to be told so a Fougere app builds.
3
- *
4
- * ```ts
5
- * // next.config.ts
6
- * import { withFougere } from '@fougere/next/config';
7
- *
8
- * export default withFougere({ reactStrictMode: true });
9
- * ```
10
- *
11
- * The adapter owns the host's quirks. Nothing here leaks into the framework, and
12
- * nothing here asks the developer to write anything twice — a Next-specific
13
- * problem gets a Next-specific answer, in the Next package.
14
- *
15
- * Two things are set, both measured against a real production build:
16
- *
17
- * 1. **Class names survive minification.** Designation is class + verb, so
18
- * `invoke(Post, 'list')` and `useQuery(Post, 'list')` read `Post.name`. Next's
19
- * minifier renames it, and the call goes looking for an entity nobody hosts —
20
- * `Entity 'j' is not hosted here. Hosted here: post`. Next's own knob
21
- * (`noMangling`) is internal and all-or-nothing, so the minimizer is replaced by
22
- * terser with `keep_classnames`, which keeps mangling everything else.
23
- * Verified: the production browser chunk contains `class Post extends`.
24
- *
25
- * 2. **The scan's dependencies stay out of the bundle.** A boot reads frond
26
- * sources off disk through jiti, so those packages must be loaded at runtime
27
- * rather than compiled in.
28
- *
29
- * **Limit, stated rather than discovered later:** this rides Next's `webpack()`
30
- * hook, which Turbopack ignores. Next 16 builds with Turbopack by default, so an
31
- * app on 16 needs `next build --webpack` until Turbopack exposes a minifier option.
32
- * Next also documents its webpack config as outside semver.
33
- */
1
+ /** `withFougere(config)` — what Next has to be told so a Fougere app builds. */
34
2
  import TerserPlugin from 'terser-webpack-plugin';
35
3
  import type { NextConfig } from 'next';
36
4
 
package/src/index.ts CHANGED
@@ -1,28 +1,4 @@
1
- /**
2
- * `@fougere/next` — what is Next about hosting a Fougere app, and nothing else.
3
- *
4
- * The package is deliberately thin, and its thinness is the measurement: the three
5
- * doors are Web-standard handlers living in `@fougere/app/web`, the four primitives
6
- * are React hooks living in `@fougere/react`, and neither imports Next. What is
7
- * left here is mounting (Next has no module API, so routes are three one-line files
8
- * under `app/`) and `next/headers`, the one import that is genuinely Next's.
9
- *
10
- * ```ts
11
- * // app/%5Ffougere/call/[[...surface]]/route.ts ← %5F, not _, see routes/call.ts
12
- * export { POST } from '@fougere/next/call';
13
- * // app/%5Ffougere/session/route.ts
14
- * export { GET } from '@fougere/next/session';
15
- * // app/api/[...fougere]/route.ts
16
- * export { GET, POST, PUT, PATCH, DELETE } from '@fougere/next/rest';
17
- * ```
18
- *
19
- * Nothing else in the app moves: pages, layouts, existing route handlers and an
20
- * existing auth setup are untouched. The scan runs on the first request that needs
21
- * the app (`useFougereApp` is lazy and memoized), so there is no build hook to
22
- * install and no generated file to keep in sync.
23
- *
24
- * Client primitives: `@fougere/react`.
25
- */
1
+ /** `@fougere/next` — what is Next about hosting a Fougere app, and nothing else. */
26
2
  export { invoke, getSession } from './invoke.js';
27
3
 
28
4
  // `withFougere` is deliberately NOT re-exported here. It is build-time config and
package/src/invoke.ts CHANGED
@@ -1,15 +1,6 @@
1
1
  /**
2
- * The server dual of the couple, in Next — for server components, server actions
3
- * and route handlers.
4
- *
5
- * Same designation as the browser side (class + verb), same return, same errors.
6
- * `invokeOn` places the call: a local façade executes in memory, a frond listed in
7
- * `remotes:` goes over JSON-RPC, and the caller never learns which.
8
- *
9
- * `next/headers` is the ONLY Next-specific import in this package — measured, and
10
- * it is what a host actually owns: how to find the current request. It answers
11
- * inside a request scope and throws outside one, so a call from a script or a test
12
- * is simply anonymous, the same fallback Nitro's `useEvent()` gets.
2
+ * The server dual of the couple, in Next — for server components, server actions and route
3
+ * handlers.
13
4
  */
14
5
  import { invokeOn, useFougereApp, sessionViewOf, stateFor, type SessionView } from '@fougere/app';
15
6
  import type { FrondCall, InvocationContext } from '@fougere/core';
@@ -1,15 +1,6 @@
1
1
  /**
2
- * ```ts
3
- * // app/%5Ffougere/call/[[...surface]]/route.ts
4
- * export { POST } from '@fougere/next/call';
5
- * ```
6
- *
7
- * The folder is `%5Ffougere`, not `_fougere`: the App Router treats a leading
8
- * underscore as a PRIVATE folder and excludes it from routing, and `%5F` is Next's
9
- * own escape for a literal one. Measured the hard way — the door 404'd while every
10
- * other route answered.
11
- *
12
- * The optional catch-all is what serves a named surface: `/_fougere/call/public`
13
- * selects the `public` audience.
2
+ * ```ts // app/%5Ffougere/call/[[...surface]]/route.ts export { POST } from '@fougere/next/call';
3
+ * ``` The folder is `%5Ffougere`, not `_fougere`: the App Router treats a leading underscore as a
4
+ * PRIVATE folder and excludes it from routing, and `%5F` is Next's own escape for a literal one.
14
5
  */
15
6
  export { fougereCall as POST } from '@fougere/app/web';
@@ -1,15 +1,7 @@
1
1
  /**
2
- * ```ts
3
- * // app/api/[...fougere]/route.ts
4
- * export { GET, POST, PUT, PATCH, DELETE } from '@fougere/next/rest';
5
- * ```
6
- *
7
- * Five names for one handler, because Next decides which verbs a route accepts by
8
- * which names it exports. Which verb reaches which OPERATION is decided elsewhere,
9
- * off the table `schema-rest` generates — this file does not narrow it.
10
- *
11
- * Next resolves a static segment (`app/api/health/route.ts`) before a catch-all, so
12
- * mounting this takes nothing away from an app that already serves `/api/*`.
2
+ * ```ts // app/api/[...fougere]/route.ts export { GET, POST, PUT, PATCH, DELETE } from
3
+ * '@fougere/next/rest'; ``` Five names for one handler, because Next decides which verbs a route
4
+ * accepts by which names it exports.
13
5
  */
14
6
  import { fougereRest } from '@fougere/app/web';
15
7
 
@@ -1,7 +1,2 @@
1
- /**
2
- * ```ts
3
- * // app/%5Ffougere/session/route.ts
4
- * export { GET } from '@fougere/next/session';
5
- * ```
6
- */
1
+ /** ```ts // app/%5Ffougere/session/route.ts export { GET } from '@fougere/next/session'; ``` */
7
2
  export { fougereSession as GET } from '@fougere/app/web';