next 15.2.2-canary.7 → 15.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.
Files changed (75) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/handle-entrypoints.d.ts +23 -3
  3. package/dist/build/handle-entrypoints.js +149 -36
  4. package/dist/build/handle-entrypoints.js.map +1 -1
  5. package/dist/build/index.js +2 -2
  6. package/dist/build/swc/generated-native.d.ts +0 -4
  7. package/dist/build/swc/index.js +68 -77
  8. package/dist/build/swc/index.js.map +1 -1
  9. package/dist/build/swc/types.d.ts +0 -1
  10. package/dist/build/turbopack-build/impl.js +160 -33
  11. package/dist/build/turbopack-build/impl.js.map +1 -1
  12. package/dist/build/webpack-config.js +2 -2
  13. package/dist/client/app-bootstrap.js +1 -1
  14. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +5 -3
  15. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
  16. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.d.ts +1 -1
  17. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.d.ts +1 -1
  18. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js +1 -1
  19. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
  20. package/dist/client/components/react-dev-overlay/ui/styles/base.js +1 -1
  21. package/dist/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  22. package/dist/client/index.js +1 -1
  23. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
  24. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  25. package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
  26. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  27. package/dist/esm/build/handle-entrypoints.js +140 -31
  28. package/dist/esm/build/handle-entrypoints.js.map +1 -1
  29. package/dist/esm/build/index.js +2 -2
  30. package/dist/esm/build/swc/generated-native.d.ts +0 -4
  31. package/dist/esm/build/swc/index.js +68 -77
  32. package/dist/esm/build/swc/index.js.map +1 -1
  33. package/dist/esm/build/swc/types.js.map +1 -1
  34. package/dist/esm/build/turbopack-build/impl.js +120 -34
  35. package/dist/esm/build/turbopack-build/impl.js.map +1 -1
  36. package/dist/esm/build/webpack-config.js +2 -2
  37. package/dist/esm/client/app-bootstrap.js +1 -1
  38. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +5 -3
  39. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
  40. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js +1 -1
  41. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
  42. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js +1 -1
  43. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  44. package/dist/esm/client/index.js +1 -1
  45. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  46. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  47. package/dist/esm/server/lib/app-info-log.js +1 -1
  48. package/dist/esm/server/lib/start-server.js +1 -1
  49. package/dist/esm/shared/lib/canary-only.js +1 -1
  50. package/dist/esm/shared/lib/get-img-props.js +1 -11
  51. package/dist/esm/shared/lib/get-img-props.js.map +1 -1
  52. package/dist/esm/shared/lib/turbopack/manifest-loader.js +14 -24
  53. package/dist/esm/shared/lib/turbopack/manifest-loader.js.map +1 -1
  54. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  55. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  56. package/dist/server/lib/app-info-log.js +1 -1
  57. package/dist/server/lib/start-server.js +1 -1
  58. package/dist/shared/lib/canary-only.js +1 -1
  59. package/dist/shared/lib/get-img-props.d.ts +1 -2
  60. package/dist/shared/lib/get-img-props.js +1 -11
  61. package/dist/shared/lib/get-img-props.js.map +1 -1
  62. package/dist/shared/lib/turbopack/manifest-loader.d.ts +1 -4
  63. package/dist/shared/lib/turbopack/manifest-loader.js +14 -24
  64. package/dist/shared/lib/turbopack/manifest-loader.js.map +1 -1
  65. package/dist/telemetry/anonymous-meta.js +1 -1
  66. package/dist/telemetry/events/build.d.ts +1 -2
  67. package/dist/telemetry/events/build.js +1 -2
  68. package/dist/telemetry/events/build.js.map +1 -1
  69. package/dist/telemetry/events/session-stopped.d.ts +1 -2
  70. package/dist/telemetry/events/session-stopped.js +3 -4
  71. package/dist/telemetry/events/session-stopped.js.map +1 -1
  72. package/dist/telemetry/events/version.d.ts +1 -2
  73. package/dist/telemetry/events/version.js +2 -3
  74. package/dist/telemetry/events/version.js.map +1 -1
  75. package/package.json +15 -15
@@ -1,27 +1,32 @@
1
- import { getEntryKey } from '../shared/lib/turbopack/entry-key';
2
1
  import * as Log from './output/log';
3
- export async function rawEntrypointsToEntrypoints(entrypointsOp) {
4
- const page = new Map();
5
- const app = new Map();
6
- for (const [pathname, route] of entrypointsOp.routes){
2
+ import { getEntryKey } from '../shared/lib/turbopack/entry-key';
3
+ import { processIssues } from '../shared/lib/turbopack/utils';
4
+ export async function handleEntrypoints({ entrypoints, currentEntrypoints, currentEntryIssues, manifestLoader, productionRewrites, logErrors }) {
5
+ currentEntrypoints.global.app = entrypoints.pagesAppEndpoint;
6
+ currentEntrypoints.global.document = entrypoints.pagesDocumentEndpoint;
7
+ currentEntrypoints.global.error = entrypoints.pagesErrorEndpoint;
8
+ currentEntrypoints.global.instrumentation = entrypoints.instrumentation;
9
+ currentEntrypoints.page.clear();
10
+ currentEntrypoints.app.clear();
11
+ for (const [pathname, route] of entrypoints.routes){
7
12
  switch(route.type){
8
13
  case 'page':
9
14
  case 'page-api':
10
- page.set(pathname, route);
15
+ currentEntrypoints.page.set(pathname, route);
11
16
  break;
12
17
  case 'app-page':
13
18
  {
14
- for (const p of route.pages){
15
- app.set(p.originalName, {
19
+ route.pages.forEach((page)=>{
20
+ currentEntrypoints.app.set(page.originalName, {
16
21
  type: 'app-page',
17
- ...p
22
+ ...page
18
23
  });
19
- }
24
+ });
20
25
  break;
21
26
  }
22
27
  case 'app-route':
23
28
  {
24
- app.set(route.originalName, route);
29
+ currentEntrypoints.app.set(route.originalName, route);
25
30
  break;
26
31
  }
27
32
  default:
@@ -29,28 +34,99 @@ export async function rawEntrypointsToEntrypoints(entrypointsOp) {
29
34
  break;
30
35
  }
31
36
  }
32
- return {
33
- global: {
34
- app: entrypointsOp.pagesAppEndpoint,
35
- document: entrypointsOp.pagesDocumentEndpoint,
36
- error: entrypointsOp.pagesErrorEndpoint,
37
- instrumentation: entrypointsOp.instrumentation,
38
- middleware: entrypointsOp.middleware
39
- },
40
- page,
41
- app
42
- };
37
+ const { middleware, instrumentation } = entrypoints;
38
+ // We check for explicit true/false, since it's initialized to
39
+ // undefined during the first loop (middlewareChanges event is
40
+ // unnecessary during the first serve)
41
+ if (currentEntrypoints.global.middleware && !middleware) {
42
+ const key = getEntryKey('root', 'server', 'middleware');
43
+ // Went from middleware to no middleware
44
+ currentEntryIssues.delete(key);
45
+ }
46
+ currentEntrypoints.global.middleware = middleware;
47
+ if (instrumentation) {
48
+ const processInstrumentation = async (name, prop)=>{
49
+ const key = getEntryKey('root', 'server', name);
50
+ const writtenEndpoint = await instrumentation[prop].writeToDisk();
51
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
52
+ };
53
+ await processInstrumentation('instrumentation.nodeJs', 'nodeJs');
54
+ await processInstrumentation('instrumentation.edge', 'edge');
55
+ await manifestLoader.loadMiddlewareManifest('instrumentation', 'instrumentation');
56
+ await manifestLoader.writeManifests({
57
+ devRewrites: undefined,
58
+ productionRewrites,
59
+ entrypoints: currentEntrypoints
60
+ });
61
+ }
62
+ if (middleware) {
63
+ const key = getEntryKey('root', 'server', 'middleware');
64
+ const endpoint = middleware.endpoint;
65
+ async function processMiddleware() {
66
+ const writtenEndpoint = await endpoint.writeToDisk();
67
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
68
+ await manifestLoader.loadMiddlewareManifest('middleware', 'middleware');
69
+ }
70
+ await processMiddleware();
71
+ } else {
72
+ manifestLoader.deleteMiddlewareManifest(getEntryKey('root', 'server', 'middleware'));
73
+ }
74
+ }
75
+ export async function handlePagesErrorRoute({ currentEntryIssues, entrypoints, manifestLoader, productionRewrites, logErrors }) {
76
+ if (entrypoints.global.app) {
77
+ const key = getEntryKey('pages', 'server', '_app');
78
+ const writtenEndpoint = await entrypoints.global.app.writeToDisk();
79
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
80
+ }
81
+ await manifestLoader.loadBuildManifest('_app');
82
+ await manifestLoader.loadPagesManifest('_app');
83
+ await manifestLoader.loadFontManifest('_app');
84
+ if (entrypoints.global.document) {
85
+ const key = getEntryKey('pages', 'server', '_document');
86
+ const writtenEndpoint = await entrypoints.global.document.writeToDisk();
87
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
88
+ }
89
+ await manifestLoader.loadPagesManifest('_document');
90
+ if (entrypoints.global.error) {
91
+ const key = getEntryKey('pages', 'server', '_error');
92
+ const writtenEndpoint = await entrypoints.global.error.writeToDisk();
93
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
94
+ }
95
+ await manifestLoader.loadBuildManifest('_error');
96
+ await manifestLoader.loadPagesManifest('_error');
97
+ await manifestLoader.loadFontManifest('_error');
98
+ await manifestLoader.writeManifests({
99
+ devRewrites: undefined,
100
+ productionRewrites,
101
+ entrypoints
102
+ });
43
103
  }
44
- export async function handleRouteType({ page, route, manifestLoader }) {
104
+ export async function handleRouteType({ page, route, currentEntryIssues, entrypoints, manifestLoader, productionRewrites, logErrors }) {
45
105
  const shouldCreateWebpackStats = process.env.TURBOPACK_STATS != null;
46
106
  switch(route.type){
47
107
  case 'page':
48
108
  {
49
109
  const serverKey = getEntryKey('pages', 'server', page);
110
+ if (entrypoints.global.app) {
111
+ const key = getEntryKey('pages', 'server', '_app');
112
+ const writtenEndpoint = await entrypoints.global.app.writeToDisk();
113
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
114
+ }
115
+ await manifestLoader.loadBuildManifest('_app');
116
+ await manifestLoader.loadPagesManifest('_app');
117
+ if (entrypoints.global.document) {
118
+ const key = getEntryKey('pages', 'server', '_document');
119
+ const writtenEndpoint = await entrypoints.global.document.writeToDisk();
120
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
121
+ }
122
+ await manifestLoader.loadPagesManifest('_document');
123
+ const writtenEndpoint = await route.htmlEndpoint.writeToDisk();
124
+ const type = writtenEndpoint == null ? void 0 : writtenEndpoint.type;
50
125
  await manifestLoader.loadBuildManifest(page);
51
126
  await manifestLoader.loadPagesManifest(page);
52
- const middlewareManifestWritten = await manifestLoader.loadMiddlewareManifest(page, 'pages');
53
- if (!middlewareManifestWritten) {
127
+ if (type === 'edge') {
128
+ await manifestLoader.loadMiddlewareManifest(page, 'pages');
129
+ } else {
54
130
  manifestLoader.deleteMiddlewareManifest(serverKey);
55
131
  }
56
132
  await manifestLoader.loadFontManifest('/_app', 'pages');
@@ -58,23 +134,41 @@ export async function handleRouteType({ page, route, manifestLoader }) {
58
134
  if (shouldCreateWebpackStats) {
59
135
  await manifestLoader.loadWebpackStats(page, 'pages');
60
136
  }
137
+ await manifestLoader.writeManifests({
138
+ devRewrites: undefined,
139
+ productionRewrites,
140
+ entrypoints
141
+ });
142
+ processIssues(currentEntryIssues, serverKey, writtenEndpoint, false, logErrors);
61
143
  break;
62
144
  }
63
145
  case 'page-api':
64
146
  {
65
147
  const key = getEntryKey('pages', 'server', page);
148
+ const writtenEndpoint = await route.endpoint.writeToDisk();
149
+ const type = writtenEndpoint.type;
66
150
  await manifestLoader.loadPagesManifest(page);
67
- const middlewareManifestWritten = await manifestLoader.loadMiddlewareManifest(page, 'pages');
68
- if (!middlewareManifestWritten) {
151
+ if (type === 'edge') {
152
+ await manifestLoader.loadMiddlewareManifest(page, 'pages');
153
+ } else {
69
154
  manifestLoader.deleteMiddlewareManifest(key);
70
155
  }
156
+ await manifestLoader.writeManifests({
157
+ devRewrites: undefined,
158
+ productionRewrites,
159
+ entrypoints
160
+ });
161
+ processIssues(currentEntryIssues, key, writtenEndpoint, true, logErrors);
71
162
  break;
72
163
  }
73
164
  case 'app-page':
74
165
  {
75
166
  const key = getEntryKey('app', 'server', page);
76
- const middlewareManifestWritten = await manifestLoader.loadMiddlewareManifest(page, 'app');
77
- if (!middlewareManifestWritten) {
167
+ const writtenEndpoint = await route.htmlEndpoint.writeToDisk();
168
+ const type = writtenEndpoint.type;
169
+ if (type === 'edge') {
170
+ await manifestLoader.loadMiddlewareManifest(page, 'app');
171
+ } else {
78
172
  manifestLoader.deleteMiddlewareManifest(key);
79
173
  }
80
174
  await manifestLoader.loadAppBuildManifest(page);
@@ -85,16 +179,31 @@ export async function handleRouteType({ page, route, manifestLoader }) {
85
179
  if (shouldCreateWebpackStats) {
86
180
  await manifestLoader.loadWebpackStats(page, 'app');
87
181
  }
182
+ await manifestLoader.writeManifests({
183
+ devRewrites: undefined,
184
+ productionRewrites,
185
+ entrypoints
186
+ });
187
+ processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors);
88
188
  break;
89
189
  }
90
190
  case 'app-route':
91
191
  {
92
192
  const key = getEntryKey('app', 'server', page);
193
+ const writtenEndpoint = await route.endpoint.writeToDisk();
194
+ const type = writtenEndpoint.type;
93
195
  await manifestLoader.loadAppPathsManifest(page);
94
- const middlewareManifestWritten = await manifestLoader.loadMiddlewareManifest(page, 'app');
95
- if (!middlewareManifestWritten) {
196
+ if (type === 'edge') {
197
+ await manifestLoader.loadMiddlewareManifest(page, 'app');
198
+ } else {
96
199
  manifestLoader.deleteMiddlewareManifest(key);
97
200
  }
201
+ await manifestLoader.writeManifests({
202
+ devRewrites: undefined,
203
+ productionRewrites,
204
+ entrypoints
205
+ });
206
+ processIssues(currentEntryIssues, key, writtenEndpoint, true, logErrors);
98
207
  break;
99
208
  }
100
209
  default:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/build/handle-entrypoints.ts"],"sourcesContent":["import type { TurbopackManifestLoader } from '../shared/lib/turbopack/manifest-loader'\nimport type {\n Entrypoints,\n PageRoute,\n AppRoute,\n RawEntrypoints,\n} from './swc/types'\nimport { getEntryKey } from '../shared/lib/turbopack/entry-key'\nimport * as Log from './output/log'\n\nexport async function rawEntrypointsToEntrypoints(\n entrypointsOp: RawEntrypoints\n): Promise<Entrypoints> {\n const page = new Map()\n const app = new Map()\n\n for (const [pathname, route] of entrypointsOp.routes) {\n switch (route.type) {\n case 'page':\n case 'page-api':\n page.set(pathname, route)\n break\n case 'app-page': {\n for (const p of route.pages) {\n app.set(p.originalName, {\n type: 'app-page',\n ...p,\n })\n }\n break\n }\n case 'app-route': {\n app.set(route.originalName, route)\n break\n }\n default:\n Log.info(`skipping ${pathname} (${route.type})`)\n break\n }\n }\n\n return {\n global: {\n app: entrypointsOp.pagesAppEndpoint,\n document: entrypointsOp.pagesDocumentEndpoint,\n error: entrypointsOp.pagesErrorEndpoint,\n instrumentation: entrypointsOp.instrumentation,\n middleware: entrypointsOp.middleware,\n },\n page,\n app,\n }\n}\n\nexport async function handleRouteType({\n page,\n route,\n manifestLoader,\n}: {\n page: string\n route: PageRoute | AppRoute\n manifestLoader: TurbopackManifestLoader\n}) {\n const shouldCreateWebpackStats = process.env.TURBOPACK_STATS != null\n\n switch (route.type) {\n case 'page': {\n const serverKey = getEntryKey('pages', 'server', page)\n\n await manifestLoader.loadBuildManifest(page)\n await manifestLoader.loadPagesManifest(page)\n\n const middlewareManifestWritten =\n await manifestLoader.loadMiddlewareManifest(page, 'pages')\n if (!middlewareManifestWritten) {\n manifestLoader.deleteMiddlewareManifest(serverKey)\n }\n\n await manifestLoader.loadFontManifest('/_app', 'pages')\n await manifestLoader.loadFontManifest(page, 'pages')\n\n if (shouldCreateWebpackStats) {\n await manifestLoader.loadWebpackStats(page, 'pages')\n }\n\n break\n }\n case 'page-api': {\n const key = getEntryKey('pages', 'server', page)\n\n await manifestLoader.loadPagesManifest(page)\n const middlewareManifestWritten =\n await manifestLoader.loadMiddlewareManifest(page, 'pages')\n if (!middlewareManifestWritten) {\n manifestLoader.deleteMiddlewareManifest(key)\n }\n\n break\n }\n case 'app-page': {\n const key = getEntryKey('app', 'server', page)\n\n const middlewareManifestWritten =\n await manifestLoader.loadMiddlewareManifest(page, 'app')\n if (!middlewareManifestWritten) {\n manifestLoader.deleteMiddlewareManifest(key)\n }\n\n await manifestLoader.loadAppBuildManifest(page)\n await manifestLoader.loadBuildManifest(page, 'app')\n await manifestLoader.loadAppPathsManifest(page)\n await manifestLoader.loadActionManifest(page)\n await manifestLoader.loadFontManifest(page, 'app')\n\n if (shouldCreateWebpackStats) {\n await manifestLoader.loadWebpackStats(page, 'app')\n }\n\n break\n }\n case 'app-route': {\n const key = getEntryKey('app', 'server', page)\n\n await manifestLoader.loadAppPathsManifest(page)\n\n const middlewareManifestWritten =\n await manifestLoader.loadMiddlewareManifest(page, 'app')\n\n if (!middlewareManifestWritten) {\n manifestLoader.deleteMiddlewareManifest(key)\n }\n\n break\n }\n default: {\n throw new Error(`unknown route type ${(route as any).type} for ${page}`)\n }\n }\n}\n"],"names":["getEntryKey","Log","rawEntrypointsToEntrypoints","entrypointsOp","page","Map","app","pathname","route","routes","type","set","p","pages","originalName","info","global","pagesAppEndpoint","document","pagesDocumentEndpoint","error","pagesErrorEndpoint","instrumentation","middleware","handleRouteType","manifestLoader","shouldCreateWebpackStats","process","env","TURBOPACK_STATS","serverKey","loadBuildManifest","loadPagesManifest","middlewareManifestWritten","loadMiddlewareManifest","deleteMiddlewareManifest","loadFontManifest","loadWebpackStats","key","loadAppBuildManifest","loadAppPathsManifest","loadActionManifest","Error"],"mappings":"AAOA,SAASA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MAAM,qBAAkE,CAAlE,IAAII,MAAM,CAAC,mBAAmB,EAAE,AAAClC,MAAcE,IAAI,CAAC,KAAK,EAAEN,MAAM,GAAjE,qBAAA;2BAAA;gCAAA;kCAAA;gBAAiE;YACzE;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/build/handle-entrypoints.ts"],"sourcesContent":["import type { CustomRoutes } from '../lib/load-custom-routes'\nimport type { TurbopackManifestLoader } from '../shared/lib/turbopack/manifest-loader'\nimport type {\n TurbopackResult,\n RawEntrypoints,\n Entrypoints,\n PageRoute,\n AppRoute,\n} from './swc/types'\nimport * as Log from './output/log'\nimport { getEntryKey } from '../shared/lib/turbopack/entry-key'\nimport {\n processIssues,\n type EntryIssuesMap,\n} from '../shared/lib/turbopack/utils'\n\nexport async function handleEntrypoints({\n entrypoints,\n currentEntrypoints,\n currentEntryIssues,\n manifestLoader,\n productionRewrites,\n logErrors,\n}: {\n entrypoints: TurbopackResult<RawEntrypoints>\n currentEntrypoints: Entrypoints\n currentEntryIssues: EntryIssuesMap\n manifestLoader: TurbopackManifestLoader\n productionRewrites: CustomRoutes['rewrites'] | undefined\n logErrors: boolean\n}) {\n currentEntrypoints.global.app = entrypoints.pagesAppEndpoint\n currentEntrypoints.global.document = entrypoints.pagesDocumentEndpoint\n currentEntrypoints.global.error = entrypoints.pagesErrorEndpoint\n\n currentEntrypoints.global.instrumentation = entrypoints.instrumentation\n\n currentEntrypoints.page.clear()\n currentEntrypoints.app.clear()\n\n for (const [pathname, route] of entrypoints.routes) {\n switch (route.type) {\n case 'page':\n case 'page-api':\n currentEntrypoints.page.set(pathname, route)\n break\n case 'app-page': {\n route.pages.forEach((page) => {\n currentEntrypoints.app.set(page.originalName, {\n type: 'app-page',\n ...page,\n })\n })\n break\n }\n case 'app-route': {\n currentEntrypoints.app.set(route.originalName, route)\n break\n }\n default:\n Log.info(`skipping ${pathname} (${route.type})`)\n break\n }\n }\n\n const { middleware, instrumentation } = entrypoints\n\n // We check for explicit true/false, since it's initialized to\n // undefined during the first loop (middlewareChanges event is\n // unnecessary during the first serve)\n if (currentEntrypoints.global.middleware && !middleware) {\n const key = getEntryKey('root', 'server', 'middleware')\n // Went from middleware to no middleware\n currentEntryIssues.delete(key)\n }\n\n currentEntrypoints.global.middleware = middleware\n\n if (instrumentation) {\n const processInstrumentation = async (\n name: string,\n prop: 'nodeJs' | 'edge'\n ) => {\n const key = getEntryKey('root', 'server', name)\n\n const writtenEndpoint = await instrumentation[prop].writeToDisk()\n processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)\n }\n await processInstrumentation('instrumentation.nodeJs', 'nodeJs')\n await processInstrumentation('instrumentation.edge', 'edge')\n await manifestLoader.loadMiddlewareManifest(\n 'instrumentation',\n 'instrumentation'\n )\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites,\n entrypoints: currentEntrypoints,\n })\n }\n\n if (middleware) {\n const key = getEntryKey('root', 'server', 'middleware')\n\n const endpoint = middleware.endpoint\n\n async function processMiddleware() {\n const writtenEndpoint = await endpoint.writeToDisk()\n processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)\n await manifestLoader.loadMiddlewareManifest('middleware', 'middleware')\n }\n await processMiddleware()\n } else {\n manifestLoader.deleteMiddlewareManifest(\n getEntryKey('root', 'server', 'middleware')\n )\n }\n}\n\nexport async function handlePagesErrorRoute({\n currentEntryIssues,\n entrypoints,\n manifestLoader,\n productionRewrites,\n logErrors,\n}: {\n currentEntryIssues: EntryIssuesMap\n entrypoints: Entrypoints\n manifestLoader: TurbopackManifestLoader\n productionRewrites: CustomRoutes['rewrites'] | undefined\n logErrors: boolean\n}) {\n if (entrypoints.global.app) {\n const key = getEntryKey('pages', 'server', '_app')\n const writtenEndpoint = await entrypoints.global.app.writeToDisk()\n processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)\n }\n await manifestLoader.loadBuildManifest('_app')\n await manifestLoader.loadPagesManifest('_app')\n await manifestLoader.loadFontManifest('_app')\n\n if (entrypoints.global.document) {\n const key = getEntryKey('pages', 'server', '_document')\n const writtenEndpoint = await entrypoints.global.document.writeToDisk()\n processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)\n }\n await manifestLoader.loadPagesManifest('_document')\n\n if (entrypoints.global.error) {\n const key = getEntryKey('pages', 'server', '_error')\n const writtenEndpoint = await entrypoints.global.error.writeToDisk()\n processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)\n }\n\n await manifestLoader.loadBuildManifest('_error')\n await manifestLoader.loadPagesManifest('_error')\n await manifestLoader.loadFontManifest('_error')\n\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites,\n entrypoints,\n })\n}\n\nexport async function handleRouteType({\n page,\n route,\n currentEntryIssues,\n entrypoints,\n manifestLoader,\n productionRewrites,\n logErrors,\n}: {\n page: string\n route: PageRoute | AppRoute\n\n currentEntryIssues: EntryIssuesMap\n entrypoints: Entrypoints\n manifestLoader: TurbopackManifestLoader\n productionRewrites: CustomRoutes['rewrites'] | undefined\n logErrors: boolean\n}) {\n const shouldCreateWebpackStats = process.env.TURBOPACK_STATS != null\n\n switch (route.type) {\n case 'page': {\n const serverKey = getEntryKey('pages', 'server', page)\n\n if (entrypoints.global.app) {\n const key = getEntryKey('pages', 'server', '_app')\n\n const writtenEndpoint = await entrypoints.global.app.writeToDisk()\n processIssues(\n currentEntryIssues,\n key,\n writtenEndpoint,\n false,\n logErrors\n )\n }\n await manifestLoader.loadBuildManifest('_app')\n await manifestLoader.loadPagesManifest('_app')\n\n if (entrypoints.global.document) {\n const key = getEntryKey('pages', 'server', '_document')\n\n const writtenEndpoint = await entrypoints.global.document.writeToDisk()\n processIssues(\n currentEntryIssues,\n key,\n writtenEndpoint,\n false,\n logErrors\n )\n }\n await manifestLoader.loadPagesManifest('_document')\n\n const writtenEndpoint = await route.htmlEndpoint.writeToDisk()\n\n const type = writtenEndpoint?.type\n\n await manifestLoader.loadBuildManifest(page)\n await manifestLoader.loadPagesManifest(page)\n if (type === 'edge') {\n await manifestLoader.loadMiddlewareManifest(page, 'pages')\n } else {\n manifestLoader.deleteMiddlewareManifest(serverKey)\n }\n await manifestLoader.loadFontManifest('/_app', 'pages')\n await manifestLoader.loadFontManifest(page, 'pages')\n\n if (shouldCreateWebpackStats) {\n await manifestLoader.loadWebpackStats(page, 'pages')\n }\n\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites,\n entrypoints,\n })\n\n processIssues(\n currentEntryIssues,\n serverKey,\n writtenEndpoint,\n false,\n logErrors\n )\n\n break\n }\n case 'page-api': {\n const key = getEntryKey('pages', 'server', page)\n\n const writtenEndpoint = await route.endpoint.writeToDisk()\n\n const type = writtenEndpoint.type\n\n await manifestLoader.loadPagesManifest(page)\n if (type === 'edge') {\n await manifestLoader.loadMiddlewareManifest(page, 'pages')\n } else {\n manifestLoader.deleteMiddlewareManifest(key)\n }\n\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites,\n entrypoints,\n })\n\n processIssues(currentEntryIssues, key, writtenEndpoint, true, logErrors)\n\n break\n }\n case 'app-page': {\n const key = getEntryKey('app', 'server', page)\n const writtenEndpoint = await route.htmlEndpoint.writeToDisk()\n const type = writtenEndpoint.type\n\n if (type === 'edge') {\n await manifestLoader.loadMiddlewareManifest(page, 'app')\n } else {\n manifestLoader.deleteMiddlewareManifest(key)\n }\n\n await manifestLoader.loadAppBuildManifest(page)\n await manifestLoader.loadBuildManifest(page, 'app')\n await manifestLoader.loadAppPathsManifest(page)\n await manifestLoader.loadActionManifest(page)\n await manifestLoader.loadFontManifest(page, 'app')\n\n if (shouldCreateWebpackStats) {\n await manifestLoader.loadWebpackStats(page, 'app')\n }\n\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites,\n entrypoints,\n })\n\n processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)\n\n break\n }\n case 'app-route': {\n const key = getEntryKey('app', 'server', page)\n const writtenEndpoint = await route.endpoint.writeToDisk()\n const type = writtenEndpoint.type\n\n await manifestLoader.loadAppPathsManifest(page)\n\n if (type === 'edge') {\n await manifestLoader.loadMiddlewareManifest(page, 'app')\n } else {\n manifestLoader.deleteMiddlewareManifest(key)\n }\n\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites,\n entrypoints,\n })\n processIssues(currentEntryIssues, key, writtenEndpoint, true, logErrors)\n\n break\n }\n default: {\n throw new Error(`unknown route type ${(route as any).type} for ${page}`)\n }\n }\n}\n"],"names":["Log","getEntryKey","processIssues","handleEntrypoints","entrypoints","currentEntrypoints","currentEntryIssues","manifestLoader","productionRewrites","logErrors","global","app","pagesAppEndpoint","document","pagesDocumentEndpoint","error","pagesErrorEndpoint","instrumentation","page","clear","pathname","route","routes","type","set","pages","forEach","originalName","info","middleware","key","delete","processInstrumentation","name","prop","writtenEndpoint","writeToDisk","loadMiddlewareManifest","writeManifests","devRewrites","undefined","endpoint","processMiddleware","deleteMiddlewareManifest","handlePagesErrorRoute","loadBuildManifest","loadPagesManifest","loadFontManifest","handleRouteType","shouldCreateWebpackStats","process","env","TURBOPACK_STATS","serverKey","htmlEndpoint","loadWebpackStats","loadAppBuildManifest","loadAppPathsManifest","loadActionManifest","Error"],"mappings":"AASA,YAAYA,SAAS,eAAc;AACnC,SAASC,WAAW,QAAQ,oCAAmC;AAC/D,SACEC,aAAa,QAER,gCAA+B;AAEtC,OAAO,eAAeC,kBAAkB,EACtCC,WAAW,EACXC,kBAAkB,EAClBC,kBAAkB,EAClBC,cAAc,EACdC,kBAAkB,EAClBC,SAAS,EAQV;IACCJ,mBAAmBK,MAAM,CAACC,GAAG,GAAGP,YAAYQ,gBAAgB;IAC5DP,mBAAmBK,MAAM,CAACG,QAAQ,GAAGT,YAAYU,qBAAqB;IACtET,mBAAmBK,MAAM,CAACK,KAAK,GAAGX,YAAYY,kBAAkB;IAEhEX,mBAAmBK,MAAM,CAACO,eAAe,GAAGb,YAAYa,eAAe;IAEvEZ,mBAAmBa,IAAI,CAACC,KAAK;IAC7Bd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;gBAC1C,MAAMX,eAAesC,iBAAiB,CAAC3B,MAAM;gBAC7C,MAAMX,eAAekD,oBAAoB,CAACvC;gBAC1C,MAAMX,eAAemD,kBAAkB,CAACxC;gBACxC,MAAMX,eAAewC,gBAAgB,CAAC7B,MAAM;gBAE5C,IAAI+B,0BAA0B;oBAC5B,MAAM1C,eAAegD,gBAAgB,CAACrC,MAAM;gBAC9C;gBAEA,MAAMX,eAAe+B,cAAc,CAAC;oBAClCC,aAAaC;oBACbhC;oBACAJ;gBACF;gBAEAF,cAAcI,oBAAoBwB,KAAKK,iBAAiB,OAAO1B;gBAE/D;YACF;QACA,KAAK;YAAa;gBAChB,MAAMqB,MAAM7B,YAAY,OAAO,UAAUiB;gBACzC,MAAMiB,kBAAkB,MAAMd,MAAMoB,QAAQ,CAACL,WAAW;gBACxD,MAAMb,OAAOY,gBAAgBZ,IAAI;gBAEjC,MAAMhB,eAAekD,oBAAoB,CAACvC;gBAE1C,IAAIK,SAAS,QAAQ;oBACnB,MAAMhB,eAAe8B,sBAAsB,CAACnB,MAAM;gBACpD,OAAO;oBACLX,eAAeoC,wBAAwB,CAACb;gBAC1C;gBAEA,MAAMvB,eAAe+B,cAAc,CAAC;oBAClCC,aAAaC;oBACbhC;oBACAJ;gBACF;gBACAF,cAAcI,oBAAoBwB,KAAKK,iBAAiB,MAAM1B;gBAE9D;YACF;QACA;YAAS;gBACP,MAAM,qBAAkE,CAAlE,IAAIkD,MAAM,CAAC,mBAAmB,EAAE,AAACtC,MAAcE,IAAI,CAAC,KAAK,EAAEL,MAAM,GAAjE,qBAAA;2BAAA;gCAAA;kCAAA;gBAAiE;YACzE;IACF;AACF"}
@@ -296,7 +296,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
296
296
  const nextBuildSpan = trace('next-build', undefined, {
297
297
  buildMode: experimentalBuildMode,
298
298
  isTurboBuild: String(turboNextBuild),
299
- version: "15.2.2-canary.7"
299
+ version: "15.2.2"
300
300
  });
301
301
  NextBuildContext.nextBuildSpan = nextBuildSpan;
302
302
  NextBuildContext.dir = dir;
@@ -655,7 +655,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
655
655
  // Files outside of the distDir can be "type": "module"
656
656
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
657
657
  // These are written to distDir, so they need to come after creating and cleaning distDr.
658
- await recordFrameworkVersion("15.2.2-canary.7");
658
+ await recordFrameworkVersion("15.2.2");
659
659
  await updateBuildDiagnostics({
660
660
  buildStage: 'start'
661
661
  });
@@ -254,10 +254,6 @@ export interface NapiEntrypoints {
254
254
  pagesAppEndpoint: ExternalObject<ExternalEndpoint>
255
255
  pagesErrorEndpoint: ExternalObject<ExternalEndpoint>
256
256
  }
257
- export declare function projectWriteAllEntrypointsToDisk(
258
- project: { __napiType: 'Project' },
259
- appDirOnly: boolean
260
- ): Promise<TurbopackResult>
261
257
  export declare function projectEntrypointsSubscribe(
262
258
  project: { __napiType: 'Project' },
263
259
  func: (...args: any[]) => any
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
11
11
  import { getDefineEnv } from '../webpack/plugins/define-env-plugin';
12
12
  import { getReactCompilerLoader } from '../get-babel-loader-config';
13
13
  import { TurbopackInternalError } from '../../shared/lib/turbopack/utils';
14
- const nextVersion = "15.2.2-canary.7";
14
+ const nextVersion = "15.2.2";
15
15
  const ArchName = arch();
16
16
  const PlatformName = platform();
17
17
  function infoLog(...args) {
@@ -410,17 +410,77 @@ function bindingToApi(binding, _wasm) {
410
410
  async update(options) {
411
411
  await withErrorCause(async ()=>binding.projectUpdate(this._nativeProject, await rustifyPartialProjectOptions(options)));
412
412
  }
413
- async writeAllEntrypointsToDisk(appDirOnly) {
414
- return await withErrorCause(async ()=>{
415
- const napiEndpoints = await binding.projectWriteAllEntrypointsToDisk(this._nativeProject, appDirOnly);
416
- return napiEntrypointsToRawEntrypoints(napiEndpoints);
417
- });
418
- }
419
413
  entrypointsSubscribe() {
420
414
  const subscription = subscribe(false, async (callback)=>binding.projectEntrypointsSubscribe(this._nativeProject, callback));
421
415
  return async function*() {
422
416
  for await (const entrypoints of subscription){
423
- yield napiEntrypointsToRawEntrypoints(entrypoints);
417
+ const routes = new Map();
418
+ for (const { pathname, ...nativeRoute } of entrypoints.routes){
419
+ let route;
420
+ const routeType = nativeRoute.type;
421
+ switch(routeType){
422
+ case 'page':
423
+ route = {
424
+ type: 'page',
425
+ htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),
426
+ dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint)
427
+ };
428
+ break;
429
+ case 'page-api':
430
+ route = {
431
+ type: 'page-api',
432
+ endpoint: new EndpointImpl(nativeRoute.endpoint)
433
+ };
434
+ break;
435
+ case 'app-page':
436
+ route = {
437
+ type: 'app-page',
438
+ pages: nativeRoute.pages.map((page)=>({
439
+ originalName: page.originalName,
440
+ htmlEndpoint: new EndpointImpl(page.htmlEndpoint),
441
+ rscEndpoint: new EndpointImpl(page.rscEndpoint)
442
+ }))
443
+ };
444
+ break;
445
+ case 'app-route':
446
+ route = {
447
+ type: 'app-route',
448
+ originalName: nativeRoute.originalName,
449
+ endpoint: new EndpointImpl(nativeRoute.endpoint)
450
+ };
451
+ break;
452
+ case 'conflict':
453
+ route = {
454
+ type: 'conflict'
455
+ };
456
+ break;
457
+ default:
458
+ const _exhaustiveCheck = routeType;
459
+ invariant(nativeRoute, ()=>`Unknown route type: ${_exhaustiveCheck}`);
460
+ }
461
+ routes.set(pathname, route);
462
+ }
463
+ const napiMiddlewareToMiddleware = (middleware)=>({
464
+ endpoint: new EndpointImpl(middleware.endpoint),
465
+ runtime: middleware.runtime,
466
+ matcher: middleware.matcher
467
+ });
468
+ const middleware = entrypoints.middleware ? napiMiddlewareToMiddleware(entrypoints.middleware) : undefined;
469
+ const napiInstrumentationToInstrumentation = (instrumentation)=>({
470
+ nodeJs: new EndpointImpl(instrumentation.nodeJs),
471
+ edge: new EndpointImpl(instrumentation.edge)
472
+ });
473
+ const instrumentation = entrypoints.instrumentation ? napiInstrumentationToInstrumentation(entrypoints.instrumentation) : undefined;
474
+ yield {
475
+ routes,
476
+ middleware,
477
+ instrumentation,
478
+ pagesDocumentEndpoint: new EndpointImpl(entrypoints.pagesDocumentEndpoint),
479
+ pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),
480
+ pagesErrorEndpoint: new EndpointImpl(entrypoints.pagesErrorEndpoint),
481
+ issues: entrypoints.issues,
482
+ diagnostics: entrypoints.diagnostics
483
+ };
424
484
  }
425
485
  }();
426
486
  }
@@ -583,75 +643,6 @@ function bindingToApi(binding, _wasm) {
583
643
  }
584
644
  }
585
645
  }
586
- function napiEntrypointsToRawEntrypoints(entrypoints) {
587
- const routes = new Map();
588
- for (const { pathname, ...nativeRoute } of entrypoints.routes){
589
- let route;
590
- const routeType = nativeRoute.type;
591
- switch(routeType){
592
- case 'page':
593
- route = {
594
- type: 'page',
595
- htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),
596
- dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint)
597
- };
598
- break;
599
- case 'page-api':
600
- route = {
601
- type: 'page-api',
602
- endpoint: new EndpointImpl(nativeRoute.endpoint)
603
- };
604
- break;
605
- case 'app-page':
606
- route = {
607
- type: 'app-page',
608
- pages: nativeRoute.pages.map((page)=>({
609
- originalName: page.originalName,
610
- htmlEndpoint: new EndpointImpl(page.htmlEndpoint),
611
- rscEndpoint: new EndpointImpl(page.rscEndpoint)
612
- }))
613
- };
614
- break;
615
- case 'app-route':
616
- route = {
617
- type: 'app-route',
618
- originalName: nativeRoute.originalName,
619
- endpoint: new EndpointImpl(nativeRoute.endpoint)
620
- };
621
- break;
622
- case 'conflict':
623
- route = {
624
- type: 'conflict'
625
- };
626
- break;
627
- default:
628
- const _exhaustiveCheck = routeType;
629
- invariant(nativeRoute, ()=>`Unknown route type: ${_exhaustiveCheck}`);
630
- }
631
- routes.set(pathname, route);
632
- }
633
- const napiMiddlewareToMiddleware = (middleware)=>({
634
- endpoint: new EndpointImpl(middleware.endpoint),
635
- runtime: middleware.runtime,
636
- matcher: middleware.matcher
637
- });
638
- const middleware = entrypoints.middleware ? napiMiddlewareToMiddleware(entrypoints.middleware) : undefined;
639
- const napiInstrumentationToInstrumentation = (instrumentation)=>({
640
- nodeJs: new EndpointImpl(instrumentation.nodeJs),
641
- edge: new EndpointImpl(instrumentation.edge)
642
- });
643
- const instrumentation = entrypoints.instrumentation ? napiInstrumentationToInstrumentation(entrypoints.instrumentation) : undefined;
644
- return {
645
- routes,
646
- middleware,
647
- instrumentation,
648
- pagesDocumentEndpoint: new EndpointImpl(entrypoints.pagesDocumentEndpoint),
649
- pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),
650
- pagesErrorEndpoint: new EndpointImpl(entrypoints.pagesErrorEndpoint),
651
- issues: entrypoints.issues,
652
- diagnostics: entrypoints.diagnostics
653
- };
654
- }
655
646
  return async function createProject(options, turboEngineOptions) {
656
647
  return new ProjectImpl(await binding.projectNew(await rustifyProjectOptions(options), turboEngineOptions || {}));
657
648
  };