next-hybrid 16.1.1-hybrid.3 → 16.1.1-hybrid.5
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 +54 -3
- package/dist/.build-commit +1 -1
- package/dist/bin/next +2 -2
- package/dist/build/index.js +3 -3
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack-config.js +3 -3
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-turbo.runtime.prod.js +4 -4
- package/dist/compiled/next-server/app-page-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/app-route-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/app-route-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +1 -1
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack-config.js +3 -3
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
# next-hybrid
|
|
2
2
|
|
|
3
3
|
Hybrid routing build of Next.js with support for hybrid route segments in the
|
|
4
|
-
App Router (for example `/house-in-[city]`)
|
|
4
|
+
App Router (for example `/house-in-[city]`) and **experimental AI Content Negotiation**.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Features
|
|
7
7
|
|
|
8
|
+
### Hybrid Routing
|
|
8
9
|
- Hybrid segments combine static and dynamic parts in a single segment.
|
|
9
10
|
- Routing priority remains: static > hybrid > dynamic > catch-all.
|
|
10
11
|
- Works with the App Router layouts and params API.
|
|
11
12
|
|
|
13
|
+
### AI Content Negotiation (Experimental)
|
|
14
|
+
- Serve Markdown, JSON, or LLM-optimized payloads from the same route.
|
|
15
|
+
- Negotiate content via file extension (e.g. `.md`, `.json`, `.llm`) or `Accept` header.
|
|
16
|
+
- Define `experimentalGenerateAI` in your page to produce these formats.
|
|
17
|
+
|
|
12
18
|
## Create a new app (floating latest)
|
|
13
19
|
|
|
14
20
|
### npm
|
|
@@ -50,7 +56,7 @@ bun run dev
|
|
|
50
56
|
}
|
|
51
57
|
```
|
|
52
58
|
|
|
53
|
-
## Example
|
|
59
|
+
## Hybrid Routing Example
|
|
54
60
|
|
|
55
61
|
```txt
|
|
56
62
|
/house-in-nyc -> static
|
|
@@ -68,6 +74,51 @@ export default async function Page({ params }) {
|
|
|
68
74
|
}
|
|
69
75
|
```
|
|
70
76
|
|
|
77
|
+
## AI Content Negotiation Example
|
|
78
|
+
|
|
79
|
+
Define a page that exports `experimentalGenerateAI`:
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
// app/ai/[slug]/page.tsx
|
|
83
|
+
import type { ExperimentalAIContent, ExperimentalAIContentContext } from 'next/experimental'
|
|
84
|
+
|
|
85
|
+
export const experimentalAIFormats = ['markdown', 'json'] as const
|
|
86
|
+
|
|
87
|
+
export default function Page({ params }) {
|
|
88
|
+
return <h1>HTML View</h1>
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export async function experimentalGenerateAI(ctx: ExperimentalAIContentContext): Promise<ExperimentalAIContent> {
|
|
92
|
+
const { slug } = ctx.params as { slug: string }
|
|
93
|
+
return {
|
|
94
|
+
markdown: `# Content for ${slug}`,
|
|
95
|
+
json: { slug, type: 'generated' }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Access via File Extensions
|
|
101
|
+
|
|
102
|
+
- `/ai/foo` -> HTML
|
|
103
|
+
- `/ai/foo.md` -> Markdown
|
|
104
|
+
- `/ai/foo.json` -> JSON
|
|
105
|
+
- `/ai/foo.llm` -> LLM JSON (if supported)
|
|
106
|
+
|
|
107
|
+
### Access via Accept Headers
|
|
108
|
+
|
|
109
|
+
You can also specify the `Accept` header to negotiate the content type:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Get Markdown content
|
|
113
|
+
curl -H "Accept: text/markdown" http://localhost:3000/ai/foo
|
|
114
|
+
|
|
115
|
+
# Get JSON content
|
|
116
|
+
curl -H "Accept: application/json" http://localhost:3000/ai/foo
|
|
117
|
+
|
|
118
|
+
# Get LLM-optimized JSON content
|
|
119
|
+
curl -H "Accept: application/llm+json" http://localhost:3000/ai/foo
|
|
120
|
+
```
|
|
121
|
+
|
|
71
122
|
## Repository
|
|
72
123
|
|
|
73
124
|
https://github.com/pablofdezr/next.js
|
package/dist/.build-commit
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
bbbdb5e19ba01d358dfee1b816e38f26e8245da5
|
package/dist/bin/next
CHANGED
|
@@ -84,7 +84,7 @@ const program = new NextRootCommand();
|
|
|
84
84
|
program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
|
|
85
85
|
formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
|
|
86
86
|
subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
|
|
87
|
-
}).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"16.1.1-hybrid.
|
|
87
|
+
}).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"16.1.1-hybrid.5"}`, '-v, --version', 'Outputs the Next.js version.');
|
|
88
88
|
program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('--experimental-analyze', 'Analyze bundle output. Only compatible with Turbopack.').option('-d, --debug', 'Enables a more verbose build output.').option('--debug-prerender', 'Enables debug mode for prerendering. Not for production use!').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Builds using Turbopack.').option('--turbopack', 'Builds using Turbopack.').option('--webpack', 'Builds using webpack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
|
|
89
89
|
'compile',
|
|
90
90
|
'generate',
|
|
@@ -162,7 +162,7 @@ program.command('telemetry').description(`Allows you to enable or disable Next.j
|
|
|
162
162
|
program.command('typegen').description('Generate TypeScript definitions for routes, pages, and layouts without running a full build.').argument('[directory]', `A directory on which to generate types. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).action((directory, options)=>// ensure process exits after typegen completes so open handles/connections
|
|
163
163
|
// don't cause process to hang
|
|
164
164
|
import('../cli/next-typegen.js').then((mod)=>mod.nextTypegen(options, directory).then(()=>process.exit(0)))).usage('[directory] [options]');
|
|
165
|
-
const nextVersion = "16.1.1-hybrid.
|
|
165
|
+
const nextVersion = "16.1.1-hybrid.5" || 'unknown';
|
|
166
166
|
program.command('upgrade').description('Upgrade Next.js apps to desired versions with a single command.').argument('[directory]', `A Next.js project directory to upgrade. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).usage('[directory] [options]').option('--revision <revision>', 'Specify the target Next.js version using an NPM dist tag (e.g. "latest", "canary", "rc", "beta") or an exact version number (e.g. "15.0.0").', nextVersion.includes('-canary.') ? 'canary' : nextVersion.includes('-rc.') ? 'rc' : nextVersion.includes('-beta.') ? 'beta' : 'latest').option('--verbose', 'Verbose output', false).action(async (directory, options)=>{
|
|
167
167
|
const mod = await import('../cli/next-upgrade.js');
|
|
168
168
|
mod.spawnNextUpgrade(directory, options);
|
package/dist/build/index.js
CHANGED
|
@@ -471,7 +471,7 @@ async function build(dir, experimentalAnalyze = false, reactProductionProfiling
|
|
|
471
471
|
try {
|
|
472
472
|
const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
|
|
473
473
|
buildMode: experimentalBuildMode,
|
|
474
|
-
version: "16.1.1-hybrid.
|
|
474
|
+
version: "16.1.1-hybrid.5"
|
|
475
475
|
});
|
|
476
476
|
_buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
477
477
|
_buildcontext.NextBuildContext.dir = dir;
|
|
@@ -971,7 +971,7 @@ async function build(dir, experimentalAnalyze = false, reactProductionProfiling
|
|
|
971
971
|
// Files outside of the distDir can be "type": "module"
|
|
972
972
|
await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
973
973
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
974
|
-
await (0, _builddiagnostics.recordFrameworkVersion)("16.1.1-hybrid.
|
|
974
|
+
await (0, _builddiagnostics.recordFrameworkVersion)("16.1.1-hybrid.5");
|
|
975
975
|
await (0, _builddiagnostics.updateBuildDiagnostics)({
|
|
976
976
|
buildStage: 'start'
|
|
977
977
|
});
|
|
@@ -2666,7 +2666,7 @@ async function build(dir, experimentalAnalyze = false, reactProductionProfiling
|
|
|
2666
2666
|
configOutDir: _path.default.join(dir, configOutDir),
|
|
2667
2667
|
staticPages,
|
|
2668
2668
|
serverPropsPages,
|
|
2669
|
-
nextVersion: "16.1.1-hybrid.
|
|
2669
|
+
nextVersion: "16.1.1-hybrid.5",
|
|
2670
2670
|
tracingRoot: outputFileTracingRoot,
|
|
2671
2671
|
hasNodeMiddleware,
|
|
2672
2672
|
hasInstrumentationHook,
|
package/dist/build/swc/index.js
CHANGED
|
@@ -130,7 +130,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
130
130
|
}
|
|
131
131
|
return newObj;
|
|
132
132
|
}
|
|
133
|
-
const nextVersion = "16.1.1-hybrid.
|
|
133
|
+
const nextVersion = "16.1.1-hybrid.5";
|
|
134
134
|
const ArchName = (0, _os.arch)();
|
|
135
135
|
const PlatformName = (0, _os.platform)();
|
|
136
136
|
function infoLog(...args) {
|
|
@@ -1725,7 +1725,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1725
1725
|
isClient && new _copyfileplugin.CopyFilePlugin({
|
|
1726
1726
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1727
1727
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1728
|
-
cacheKey: "16.1.1-hybrid.
|
|
1728
|
+
cacheKey: "16.1.1-hybrid.5",
|
|
1729
1729
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1730
1730
|
minimize: false,
|
|
1731
1731
|
info: {
|
|
@@ -1919,7 +1919,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1919
1919
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1920
1920
|
// - Next.js version
|
|
1921
1921
|
// - next.config.js keys that affect compilation
|
|
1922
|
-
version: `${__dirname}|${"16.1.1-hybrid.
|
|
1922
|
+
version: `${__dirname}|${"16.1.1-hybrid.5"}|${configVars}`,
|
|
1923
1923
|
cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
|
|
1924
1924
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1925
1925
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -1975,7 +1975,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1975
1975
|
type: 'filesystem',
|
|
1976
1976
|
directory: cache.cacheDirectory
|
|
1977
1977
|
},
|
|
1978
|
-
version: `${__dirname}|${"16.1.1-hybrid.
|
|
1978
|
+
version: `${__dirname}|${"16.1.1-hybrid.5"}|${configVars}`
|
|
1979
1979
|
};
|
|
1980
1980
|
}
|
|
1981
1981
|
if (process.env.NEXT_WEBPACK_LOGGING) {
|
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "appBootstrap", {
|
|
|
15
15
|
});
|
|
16
16
|
const _assetprefix = require("./asset-prefix");
|
|
17
17
|
const _setattributesfromprops = require("./set-attributes-from-props");
|
|
18
|
-
const version = "16.1.1-hybrid.
|
|
18
|
+
const version = "16.1.1-hybrid.5";
|
|
19
19
|
window.next = {
|
|
20
20
|
version,
|
|
21
21
|
appDir: true
|
package/dist/client/index.js
CHANGED
|
@@ -60,7 +60,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
|
|
|
60
60
|
const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error");
|
|
61
61
|
const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
|
|
62
62
|
const _isnextroutererror = require("./components/is-next-router-error");
|
|
63
|
-
const version = "16.1.1-hybrid.
|
|
63
|
+
const version = "16.1.1-hybrid.5";
|
|
64
64
|
let router;
|
|
65
65
|
const emitter = (0, _mitt.default)();
|
|
66
66
|
const looseToArray = (input)=>[].slice.call(input);
|