qalita 2.5.4__py3-none-any.whl → 2.6.1__py3-none-any.whl
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.
- qalita/_frontend/.next/static/_0oyfpC7N2IGDMa04TT9R/_clientMiddlewareManifest.json +6 -0
- qalita/_frontend/.next/static/chunks/236f7e5abd6f09ff.js +4 -0
- qalita/_frontend/.next/static/chunks/30ea11065999f7ac.js +1 -0
- qalita/_frontend/.next/static/chunks/4dd28bc3f722184a.js +2 -0
- qalita/_frontend/.next/static/chunks/711d597b816a80c1.js +1 -0
- qalita/_frontend/.next/static/chunks/7340adf74ff47ec0.js +1 -0
- qalita/_frontend/.next/static/chunks/a6dad97d9634a72d.js.map +1 -0
- qalita/_frontend/.next/static/chunks/{e393fec0d8ba175d.js → ecf559101be0ae12.js} +3 -3
- qalita/_frontend/.next/static/chunks/turbopack-25186fc8e1264445.js +4 -0
- qalita/_frontend/node_modules/@img/sharp-libvips-linux-x64/versions.json +30 -0
- qalita/_frontend/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +30 -0
- qalita/_frontend/node_modules/@next/env/package.json +4 -4
- qalita/_frontend/node_modules/next/dist/build/analyze/index.js +242 -0
- qalita/_frontend/node_modules/next/dist/build/define-env.js +22 -13
- qalita/_frontend/node_modules/next/dist/build/entries.js +5 -5
- qalita/_frontend/node_modules/next/dist/build/generate-routes-manifest.js +91 -0
- qalita/_frontend/node_modules/next/dist/build/index.js +172 -223
- qalita/_frontend/node_modules/next/dist/build/output/log.js +4 -7
- qalita/_frontend/node_modules/next/dist/build/segment-config/app/app-segments.js +23 -99
- qalita/_frontend/node_modules/next/dist/build/segment-config/app/collect-root-param-keys.js +3 -3
- qalita/_frontend/node_modules/next/dist/build/spinner.js +3 -3
- qalita/_frontend/node_modules/next/dist/build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree.js +137 -0
- qalita/_frontend/node_modules/next/dist/build/static-paths/app.js +69 -210
- qalita/_frontend/node_modules/next/dist/build/static-paths/utils.js +83 -11
- qalita/_frontend/node_modules/next/dist/build/swc/index.js +10 -6
- qalita/_frontend/node_modules/next/dist/build/templates/app-page.js +21 -14
- qalita/_frontend/node_modules/next/dist/build/templates/app-route.js +8 -10
- qalita/_frontend/node_modules/next/dist/build/templates/edge-app-route.js +7 -10
- qalita/_frontend/node_modules/next/dist/build/templates/edge-ssr-app.js +16 -20
- qalita/_frontend/node_modules/next/dist/build/templates/edge-ssr.js +20 -14
- qalita/_frontend/node_modules/next/dist/build/templates/edge-wrapper.js +24 -0
- qalita/_frontend/node_modules/next/dist/build/templates/middleware.js +7 -6
- qalita/_frontend/node_modules/next/dist/build/templates/pages-edge-api.js +3 -2
- qalita/_frontend/node_modules/next/dist/build/turbopack-analyze/index.js +116 -0
- qalita/_frontend/node_modules/next/dist/build/turbopack-build/impl.js +2 -1
- qalita/_frontend/node_modules/next/dist/build/type-check.js +7 -8
- qalita/_frontend/node_modules/next/dist/build/utils.js +45 -4
- qalita/_frontend/node_modules/next/dist/build/validate-app-paths.js +242 -0
- qalita/_frontend/node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js +20 -2
- qalita/_frontend/node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js +2 -5
- qalita/_frontend/node_modules/next/dist/build/webpack/loaders/next-edge-ssr-loader/index.js +4 -11
- qalita/_frontend/node_modules/next/dist/build/webpack/loaders/next-root-params-loader.js +1 -1
- qalita/_frontend/node_modules/next/dist/build/webpack/plugins/flight-manifest-plugin.js +1 -1
- qalita/_frontend/node_modules/next/dist/build/webpack/plugins/middleware-plugin.js +3 -0
- qalita/_frontend/node_modules/next/dist/build/webpack-build/impl.js +1 -0
- qalita/_frontend/node_modules/next/dist/build/webpack-config.js +35 -3
- qalita/_frontend/node_modules/next/dist/cli/next-test.js +3 -5
- qalita/_frontend/node_modules/next/dist/client/components/app-router-headers.js +5 -0
- qalita/_frontend/node_modules/next/dist/client/components/app-router-instance.js +3 -11
- qalita/_frontend/node_modules/next/dist/client/components/app-router.js +8 -28
- qalita/_frontend/node_modules/next/dist/client/components/navigation-devtools.js +5 -7
- qalita/_frontend/node_modules/next/dist/client/components/navigation.js +4 -3
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +3 -22
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +6 -18
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/ppr-navigations.js +844 -590
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/reducers/hmr-refresh-reducer.js +4 -76
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +21 -18
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +48 -85
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +25 -10
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +126 -113
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +30 -39
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/router-reducer-types.js +0 -1
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/router-reducer.js +2 -2
- qalita/_frontend/node_modules/next/dist/client/components/segment-cache/cache-map.js +13 -18
- qalita/_frontend/node_modules/next/dist/client/components/segment-cache/cache.js +27 -14
- qalita/_frontend/node_modules/next/dist/client/components/segment-cache/lru.js +3 -1
- qalita/_frontend/node_modules/next/dist/client/components/segment-cache/navigation.js +176 -133
- qalita/_frontend/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +12 -12
- qalita/_frontend/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +12 -12
- qalita/_frontend/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +3 -3
- qalita/_frontend/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +10 -10
- qalita/_frontend/node_modules/next/dist/compiled/react-is/package.json +1 -1
- qalita/_frontend/node_modules/next/dist/lib/build-custom-route.js +4 -4
- qalita/_frontend/node_modules/next/dist/lib/constants.js +0 -5
- qalita/_frontend/node_modules/next/dist/lib/default-transpiled-packages.json +1 -0
- qalita/_frontend/node_modules/next/dist/lib/generate-interception-routes-rewrites.js +0 -1
- qalita/_frontend/node_modules/next/dist/lib/helpers/get-npx-command.js +3 -3
- qalita/_frontend/node_modules/next/dist/lib/inline-static-env.js +1 -1
- qalita/_frontend/node_modules/next/dist/lib/known-edge-safe-packages.json +1 -0
- qalita/_frontend/node_modules/next/dist/lib/metadata/metadata.js +17 -11
- qalita/_frontend/node_modules/next/dist/lib/needs-experimental-react.js +2 -2
- qalita/_frontend/node_modules/next/dist/lib/resolve-build-paths.js +44 -76
- qalita/_frontend/node_modules/next/dist/lib/server-external-packages.jsonc +103 -0
- qalita/_frontend/node_modules/next/dist/lib/static-env.js +6 -6
- qalita/_frontend/node_modules/next/dist/lib/turbopack-warning.js +3 -5
- qalita/_frontend/node_modules/next/dist/lib/typescript/runTypeCheck.js +61 -5
- qalita/_frontend/node_modules/next/dist/lib/typescript/type-paths.js +56 -0
- qalita/_frontend/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js +6 -17
- qalita/_frontend/node_modules/next/dist/lib/verify-typescript-setup.js +10 -2
- qalita/_frontend/node_modules/next/dist/lib/worker.js +17 -9
- qalita/_frontend/node_modules/next/dist/server/app-render/action-handler.js +113 -77
- qalita/_frontend/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +36 -15
- qalita/_frontend/node_modules/next/dist/server/app-render/app-render-render-utils.js +36 -15
- qalita/_frontend/node_modules/next/dist/server/app-render/app-render-scheduling.js +188 -0
- qalita/_frontend/node_modules/next/dist/server/app-render/app-render.js +804 -748
- qalita/_frontend/node_modules/next/dist/server/app-render/collect-segment-data.js +8 -2
- qalita/_frontend/node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js +1 -1
- qalita/_frontend/node_modules/next/dist/server/app-render/create-error-handler.js +42 -75
- qalita/_frontend/node_modules/next/dist/server/app-render/dynamic-rendering.js +127 -14
- qalita/_frontend/node_modules/next/dist/server/app-render/encryption-utils.js +3 -108
- qalita/_frontend/node_modules/next/dist/server/app-render/encryption.js +4 -3
- qalita/_frontend/node_modules/next/dist/server/app-render/flight-render-result.js +3 -2
- qalita/_frontend/node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js +9 -8
- qalita/_frontend/node_modules/next/dist/server/app-render/get-layer-assets.js +1 -1
- qalita/_frontend/node_modules/next/dist/server/app-render/manifests-singleton.js +257 -0
- qalita/_frontend/node_modules/next/dist/server/app-render/prospective-render-utils.js +25 -8
- qalita/_frontend/node_modules/next/dist/server/app-render/staged-rendering.js +161 -15
- qalita/_frontend/node_modules/next/dist/server/app-render/use-flight-response.js +67 -20
- qalita/_frontend/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +2 -2
- qalita/_frontend/node_modules/next/dist/server/async-storage/work-store.js +2 -1
- qalita/_frontend/node_modules/next/dist/server/base-server.js +32 -23
- qalita/_frontend/node_modules/next/dist/server/capsize-font-metrics.json +181516 -0
- qalita/_frontend/node_modules/next/dist/server/config-schema.js +8 -1
- qalita/_frontend/node_modules/next/dist/server/config-shared.js +83 -2
- qalita/_frontend/node_modules/next/dist/server/config.js +24 -17
- qalita/_frontend/node_modules/next/dist/server/dev/hot-reloader-rspack.js +171 -0
- qalita/_frontend/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +37 -25
- qalita/_frontend/node_modules/next/dist/server/dev/hot-reloader-types.js +1 -0
- qalita/_frontend/node_modules/next/dist/server/dev/hot-reloader-webpack.js +62 -57
- qalita/_frontend/node_modules/next/dist/server/dev/log-requests.js +11 -3
- qalita/_frontend/node_modules/next/dist/server/dev/messages.js +10 -0
- qalita/_frontend/node_modules/next/dist/server/dev/serialized-errors.js +67 -0
- qalita/_frontend/node_modules/next/dist/server/dev/static-paths-worker.js +10 -0
- qalita/_frontend/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- qalita/_frontend/node_modules/next/dist/server/lib/chrome-devtools-workspace.js +2 -2
- qalita/_frontend/node_modules/next/dist/server/lib/dev-bundler-service.js +6 -10
- qalita/_frontend/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +4 -4
- qalita/_frontend/node_modules/next/dist/server/lib/lazy-result.js +1 -1
- qalita/_frontend/node_modules/next/dist/server/lib/patch-fetch.js +9 -9
- qalita/_frontend/node_modules/next/dist/server/lib/router-server.js +43 -29
- qalita/_frontend/node_modules/next/dist/server/lib/router-utils/build-prefetch-segment-data-route.js +0 -21
- qalita/_frontend/node_modules/next/dist/server/lib/router-utils/filesystem.js +2 -7
- qalita/_frontend/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +8 -4
- qalita/_frontend/node_modules/next/dist/server/lib/start-server.js +3 -3
- qalita/_frontend/node_modules/next/dist/server/lib/trace/tracer.js +4 -0
- qalita/_frontend/node_modules/next/dist/server/load-components.js +3 -9
- qalita/_frontend/node_modules/next/dist/server/next-server.js +19 -18
- qalita/_frontend/node_modules/next/dist/server/next.js +1 -1
- qalita/_frontend/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +570 -0
- qalita/_frontend/node_modules/next/dist/server/node-environment-extensions/utils.js +60 -3
- qalita/_frontend/node_modules/next/dist/server/node-environment.js +1 -0
- qalita/_frontend/node_modules/next/dist/server/patch-error-inspect.js +7 -4
- qalita/_frontend/node_modules/next/dist/server/request/fallback-params.js +23 -66
- qalita/_frontend/node_modules/next/dist/server/route-modules/app-route/module.js +2 -2
- qalita/_frontend/node_modules/next/dist/server/route-modules/pages/pages-handler.js +6 -3
- qalita/_frontend/node_modules/next/dist/server/route-modules/route-module.js +79 -18
- qalita/_frontend/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +28 -4
- qalita/_frontend/node_modules/next/dist/server/typescript/rules/config.js +50 -6
- qalita/_frontend/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +68 -23
- qalita/_frontend/node_modules/next/dist/server/web/edge-route-module-wrapper.js +7 -5
- qalita/_frontend/node_modules/next/dist/server/web/sandbox/context.js +8 -9
- qalita/_frontend/node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js +2 -1
- qalita/_frontend/node_modules/next/dist/server/web/spec-extension/revalidate.js +7 -3
- qalita/_frontend/node_modules/next/dist/shared/lib/action-revalidation-kind.js +31 -0
- qalita/_frontend/node_modules/next/dist/shared/lib/constants.js +6 -1
- qalita/_frontend/node_modules/next/dist/shared/lib/deployment-id.js +36 -0
- qalita/_frontend/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- qalita/_frontend/node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js +5 -0
- qalita/_frontend/node_modules/next/dist/shared/lib/router/routes/app.js +122 -0
- qalita/_frontend/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +20 -49
- qalita/_frontend/node_modules/next/dist/shared/lib/router/utils/get-segment-param.js +6 -6
- qalita/_frontend/node_modules/next/dist/shared/lib/router/utils/interception-prefix-from-param-type.js +33 -0
- qalita/_frontend/node_modules/next/dist/shared/lib/router/utils/resolve-param-value.js +116 -0
- qalita/_frontend/node_modules/next/dist/shared/lib/segment-cache/output-export-prefetch-encoding.js +3 -24
- qalita/_frontend/node_modules/next/dist/shared/lib/segment.js +5 -0
- qalita/_frontend/node_modules/next/dist/shared/lib/turbopack/utils.js +6 -5
- qalita/_frontend/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- qalita/_frontend/node_modules/next/dist/telemetry/events/build.js +11 -0
- qalita/_frontend/node_modules/next/dist/telemetry/events/version.js +2 -2
- qalita/_frontend/node_modules/next/package.json +20 -18
- qalita/_frontend/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/typesMap.json +497 -0
- qalita/_frontend/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- qalita/_frontend/package.json +3 -3
- qalita/_frontend/server.js +1 -1
- qalita/commands/pack.py +3 -3
- qalita/commands/source.py +1 -1
- qalita/internal/utils.py +11 -7
- qalita/web/app.py +20 -4
- {qalita-2.5.4.dist-info → qalita-2.6.1.dist-info}/METADATA +1 -1
- {qalita-2.5.4.dist-info → qalita-2.6.1.dist-info}/RECORD +197 -168
- qalita/_frontend/.next/static/chunks/023d923a37d494fc.js +0 -1
- qalita/_frontend/.next/static/chunks/247eb132b7f7b574.js +0 -1
- qalita/_frontend/.next/static/chunks/bba035711c7e37a2.js +0 -4
- qalita/_frontend/.next/static/chunks/c903f9580a4b6572.js +0 -2
- qalita/_frontend/.next/static/chunks/cbd55ab9639e1e66.js +0 -1
- qalita/_frontend/.next/static/chunks/turbopack-1ad58da399056f41.js +0 -3
- qalita/_frontend/node_modules/next/dist/build/deployment-id.js +0 -18
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/apply-flight-data.js +0 -53
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/apply-router-state-patch-to-tree.js +0 -105
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/fill-cache-with-new-subtree-data.js +0 -110
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.js +0 -131
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/handle-segment-mismatch.js +0 -25
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/invalidate-cache-by-router-state.js +0 -32
- qalita/_frontend/node_modules/next/dist/client/components/router-reducer/refetch-inactive-parallel-segments.js +0 -104
- qalita/_frontend/node_modules/next/dist/server/app-render/action-utils.js +0 -90
- qalita/_frontend/node_modules/next/dist/server/normalizers/request/prefetch-rsc.js +0 -31
- /qalita/_frontend/.next/static/{X4_AlYMbCyee-ZVLjCYMg → _0oyfpC7N2IGDMa04TT9R}/_buildManifest.js +0 -0
- /qalita/_frontend/.next/static/{X4_AlYMbCyee-ZVLjCYMg → _0oyfpC7N2IGDMa04TT9R}/_ssgManifest.js +0 -0
- {qalita-2.5.4.dist-info → qalita-2.6.1.dist-info}/WHEEL +0 -0
- {qalita-2.5.4.dist-info → qalita-2.6.1.dist-info}/entry_points.txt +0 -0
- {qalita-2.5.4.dist-info → qalita-2.6.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
getDevTypesPath: null,
|
|
7
|
+
getTypeDefinitionGlobPatterns: null
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
getDevTypesPath: function() {
|
|
17
|
+
return getDevTypesPath;
|
|
18
|
+
},
|
|
19
|
+
getTypeDefinitionGlobPatterns: function() {
|
|
20
|
+
return getTypeDefinitionGlobPatterns;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
24
|
+
function _interop_require_default(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function getTypeDefinitionGlobPatterns(distDir, isolatedDevBuild) {
|
|
30
|
+
const distDirPosix = _path.default.win32.sep === _path.default.sep ? distDir.replaceAll(_path.default.win32.sep, _path.default.posix.sep) : distDir;
|
|
31
|
+
const typeGlobPatterns = [
|
|
32
|
+
`${distDirPosix}/types/**/*.ts`
|
|
33
|
+
];
|
|
34
|
+
// When isolatedDevBuild is enabled, include both .next/types and .next/dev/types
|
|
35
|
+
// to avoid tsconfig churn when switching between dev/build modes
|
|
36
|
+
if (isolatedDevBuild) {
|
|
37
|
+
typeGlobPatterns.push(process.env.NODE_ENV === 'development' ? `${distDirPosix.replace(/\/dev$/, '')}/types/**/*.ts` : `${distDirPosix}/dev/types/**/*.ts`);
|
|
38
|
+
// Sort for consistent order
|
|
39
|
+
typeGlobPatterns.sort((a, b)=>a.length - b.length);
|
|
40
|
+
}
|
|
41
|
+
return typeGlobPatterns;
|
|
42
|
+
}
|
|
43
|
+
function getDevTypesPath(baseDir, distDir, isolatedDevBuild) {
|
|
44
|
+
if (!isolatedDevBuild) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
48
|
+
if (isDev) {
|
|
49
|
+
// In dev mode, dev types are the main types, so no need to filter
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
// In build mode, dev types are at "{baseDir}/{distDir}/dev/types" and should be filtered
|
|
53
|
+
return _path.default.join(baseDir, distDir, 'dev', 'types');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=type-paths.js.map
|
|
@@ -21,12 +21,13 @@ _export(exports, {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _fs = require("fs");
|
|
24
|
-
const _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
|
|
25
24
|
const _picocolors = require("../picocolors");
|
|
26
25
|
const _commentjson = /*#__PURE__*/ _interop_require_wildcard(require("next/dist/compiled/comment-json"));
|
|
27
26
|
const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver"));
|
|
28
27
|
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
28
|
+
const _typepaths = require("./type-paths");
|
|
29
29
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log"));
|
|
30
|
+
const _configshared = require("../../server/config-shared");
|
|
30
31
|
function _interop_require_default(obj) {
|
|
31
32
|
return obj && obj.__esModule ? obj : {
|
|
32
33
|
default: obj
|
|
@@ -279,22 +280,10 @@ async function writeConfigurationDefaults(typescriptVersion, tsConfigPath, isFir
|
|
|
279
280
|
const _ = check;
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
// When isolatedDevBuild is enabled, Next.js uses different distDir paths:
|
|
287
|
-
// - Development: "{distDir}/dev"
|
|
288
|
-
// - Production: "{distDir}"
|
|
289
|
-
// To prevent tsconfig updates when switching between dev/build modes,
|
|
290
|
-
// we proactively include both type paths regardless of current environment.
|
|
291
|
-
if (isolatedDevBuild !== false) {
|
|
292
|
-
nextAppTypes.push(process.env.NODE_ENV === 'development' ? // Here we remove "/dev" at the end of distDir for consistency.
|
|
293
|
-
`${distDirPosix.replace(/\/dev$/, '')}/types/**/*.ts` : // Here we add "/dev" at the end of distDir for consistency.
|
|
294
|
-
`${distDirPosix}/dev/types/**/*.ts`);
|
|
295
|
-
// Sort the array to ensure consistent order.
|
|
296
|
-
nextAppTypes.sort((a, b)=>a.length - b.length);
|
|
297
|
-
}
|
|
283
|
+
const resolvedIsolatedDevBuild = isolatedDevBuild === undefined ? _configshared.defaultConfig.experimental.isolatedDevBuild : isolatedDevBuild;
|
|
284
|
+
// Get type definition glob patterns using shared utility to ensure consistency
|
|
285
|
+
// with other TypeScript infrastructure (e.g., runTypeCheck.ts)
|
|
286
|
+
const nextAppTypes = (0, _typepaths.getTypeDefinitionGlobPatterns)(distDir, resolvedIsolatedDevBuild);
|
|
298
287
|
if (!('include' in userTsConfig)) {
|
|
299
288
|
userTsConfig.include = hasAppDir ? [
|
|
300
289
|
'next-env.d.ts',
|
|
@@ -83,9 +83,14 @@ const requiredPackages = [
|
|
|
83
83
|
exportsRestrict: true
|
|
84
84
|
}
|
|
85
85
|
];
|
|
86
|
-
async function verifyTypeScriptSetup({ dir, distDir, cacheDir,
|
|
86
|
+
async function verifyTypeScriptSetup({ dir, distDir, cacheDir, tsconfigPath, typeCheckPreflight, disableStaticImages, hasAppDir, hasPagesDir, isolatedDevBuild, appDir, pagesDir, debugBuildPaths }) {
|
|
87
87
|
const tsConfigFileName = tsconfigPath || 'tsconfig.json';
|
|
88
88
|
const resolvedTsConfigPath = _path.default.join(dir, tsConfigFileName);
|
|
89
|
+
// Construct intentDirs from appDir and pagesDir for getTypeScriptIntent
|
|
90
|
+
const intentDirs = [
|
|
91
|
+
pagesDir,
|
|
92
|
+
appDir
|
|
93
|
+
].filter(Boolean);
|
|
89
94
|
try {
|
|
90
95
|
var _deps_missing;
|
|
91
96
|
// Check if the project uses TypeScript:
|
|
@@ -136,7 +141,10 @@ async function verifyTypeScriptSetup({ dir, distDir, cacheDir, intentDirs, tscon
|
|
|
136
141
|
const tsPath = deps.resolved.get('typescript');
|
|
137
142
|
const typescript = await Promise.resolve(require(tsPath));
|
|
138
143
|
// Verify the project passes type-checking before we go to webpack phase:
|
|
139
|
-
result = await runTypeCheck(typescript, dir, distDir, resolvedTsConfigPath, cacheDir, hasAppDir
|
|
144
|
+
result = await runTypeCheck(typescript, dir, distDir, resolvedTsConfigPath, cacheDir, hasAppDir, isolatedDevBuild, {
|
|
145
|
+
app: appDir,
|
|
146
|
+
pages: pagesDir
|
|
147
|
+
}, debugBuildPaths);
|
|
140
148
|
}
|
|
141
149
|
return {
|
|
142
150
|
result,
|
|
@@ -37,7 +37,9 @@ function getNextBuildDebuggerPortOffset(_) {
|
|
|
37
37
|
}
|
|
38
38
|
class Worker {
|
|
39
39
|
constructor(workerPath, options){
|
|
40
|
-
let { enableSourceMaps, timeout, onRestart, logger = console, debuggerPortOffset, isolatedMemory, ...farmOptions } = options;
|
|
40
|
+
let { enableSourceMaps, timeout, onRestart, logger = console, debuggerPortOffset, isolatedMemory, onActivity, onActivityAbort, ...farmOptions } = options;
|
|
41
|
+
this._onActivity = onActivity;
|
|
42
|
+
this._onActivityAbort = onActivityAbort;
|
|
41
43
|
let restartPromise;
|
|
42
44
|
let resolveRestartPromise;
|
|
43
45
|
let activeTasks = 0;
|
|
@@ -124,22 +126,22 @@ class Worker {
|
|
|
124
126
|
});
|
|
125
127
|
(_worker__child1 = worker._child) == null ? void 0 : _worker__child1.on('message', ([, data])=>{
|
|
126
128
|
if (data && typeof data === 'object' && 'type' in data && data.type === 'activity') {
|
|
127
|
-
|
|
129
|
+
onActivityImpl();
|
|
128
130
|
}
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
let aborted = false;
|
|
133
|
-
const
|
|
135
|
+
const onActivityAbortImpl = ()=>{
|
|
134
136
|
if (!aborted) {
|
|
135
|
-
|
|
137
|
+
this._onActivityAbort == null ? void 0 : this._onActivityAbort.call(this);
|
|
136
138
|
aborted = true;
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
// Listen to the worker's stdout and stderr, if there's any thing logged, abort the activity first
|
|
140
142
|
const abortActivityStreamOnLog = new _stream.Transform({
|
|
141
143
|
transform (_chunk, _encoding, callback) {
|
|
142
|
-
|
|
144
|
+
onActivityAbortImpl();
|
|
143
145
|
callback();
|
|
144
146
|
}
|
|
145
147
|
});
|
|
@@ -162,9 +164,9 @@ class Worker {
|
|
|
162
164
|
});
|
|
163
165
|
};
|
|
164
166
|
let hangingTimer = false;
|
|
165
|
-
const
|
|
167
|
+
const onActivityImpl = ()=>{
|
|
166
168
|
if (hangingTimer) clearTimeout(hangingTimer);
|
|
167
|
-
if (
|
|
169
|
+
if (this._onActivity) this._onActivity();
|
|
168
170
|
hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout);
|
|
169
171
|
};
|
|
170
172
|
for (const method of farmOptions.exposedMethods){
|
|
@@ -174,7 +176,7 @@ class Worker {
|
|
|
174
176
|
try {
|
|
175
177
|
let attempts = 0;
|
|
176
178
|
for(;;){
|
|
177
|
-
|
|
179
|
+
onActivityImpl();
|
|
178
180
|
const result = await Promise.race([
|
|
179
181
|
this._worker[method](...args),
|
|
180
182
|
restartPromise
|
|
@@ -184,11 +186,17 @@ class Worker {
|
|
|
184
186
|
}
|
|
185
187
|
} finally{
|
|
186
188
|
activeTasks--;
|
|
187
|
-
|
|
189
|
+
onActivityImpl();
|
|
188
190
|
}
|
|
189
191
|
} : this._worker[method].bind(this._worker);
|
|
190
192
|
}
|
|
191
193
|
}
|
|
194
|
+
setOnActivity(onActivity) {
|
|
195
|
+
this._onActivity = onActivity;
|
|
196
|
+
}
|
|
197
|
+
setOnActivityAbort(onActivityAbort) {
|
|
198
|
+
this._onActivityAbort = onActivityAbort;
|
|
199
|
+
}
|
|
192
200
|
end() {
|
|
193
201
|
const worker = this._worker;
|
|
194
202
|
if (!worker) {
|
|
@@ -35,7 +35,7 @@ const _log = require("../../build/output/log");
|
|
|
35
35
|
const _cookies = require("../web/spec-extension/cookies");
|
|
36
36
|
const _headers = require("../web/spec-extension/adapters/headers");
|
|
37
37
|
const _utils1 = require("../web/utils");
|
|
38
|
-
const
|
|
38
|
+
const _manifestssingleton = require("./manifests-singleton");
|
|
39
39
|
const _helpers = require("../base-http/helpers");
|
|
40
40
|
const _redirectstatuscode = require("../../client/components/redirect-status-code");
|
|
41
41
|
const _requeststore = require("../async-storage/request-store");
|
|
@@ -44,6 +44,7 @@ const _invarianterror = require("../../shared/lib/invariant-error");
|
|
|
44
44
|
const _revalidationutils = require("../revalidation-utils");
|
|
45
45
|
const _requestmeta = require("../request-meta");
|
|
46
46
|
const _setcachebustingsearchparam = require("../../client/components/router-reducer/set-cache-busting-search-param");
|
|
47
|
+
const _actionrevalidationkind = require("../../shared/lib/action-revalidation-kind");
|
|
47
48
|
function _interop_require_default(obj) {
|
|
48
49
|
return obj && obj.__esModule ? obj : {
|
|
49
50
|
default: obj
|
|
@@ -51,8 +52,9 @@ function _interop_require_default(obj) {
|
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
54
|
* Checks if the app has any server actions defined in any runtime.
|
|
54
|
-
*/ function hasServerActions(
|
|
55
|
-
|
|
55
|
+
*/ function hasServerActions() {
|
|
56
|
+
const serverActionsManifest = (0, _manifestssingleton.getServerActionsManifest)();
|
|
57
|
+
return Object.keys(serverActionsManifest.node).length > 0 || Object.keys(serverActionsManifest.edge).length > 0;
|
|
56
58
|
}
|
|
57
59
|
function nodeHeadersToRecord(headers) {
|
|
58
60
|
const record = {};
|
|
@@ -95,20 +97,23 @@ function addRevalidationHeader(res, { workStore, requestStore }) {
|
|
|
95
97
|
// If a tag was revalidated, the client router needs to invalidate all the
|
|
96
98
|
// client router cache as they may be stale. And if a path was revalidated, the
|
|
97
99
|
// client needs to invalidate all subtrees below that path.
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
100
|
+
// TODO: Currently we don't send the specific tags or paths to the client,
|
|
101
|
+
// we just send a flag indicating that all the static data on the client
|
|
102
|
+
// should be invalidated. In the future, this will likely be a Bloom filter
|
|
103
|
+
// or bitmask of some kind.
|
|
101
104
|
// TODO-APP: Currently the prefetch cache doesn't have subtree information,
|
|
102
105
|
// so we need to invalidate the entire cache if a path was revalidated.
|
|
103
106
|
// TODO-APP: Currently paths are treated as tags, so the second element of the tuple
|
|
104
107
|
// is always empty.
|
|
105
108
|
const isTagRevalidated = ((_workStore_pendingRevalidatedTags = workStore.pendingRevalidatedTags) == null ? void 0 : _workStore_pendingRevalidatedTags.length) ? 1 : 0;
|
|
106
109
|
const isCookieRevalidated = (0, _requestcookies.getModifiedCookieValues)(requestStore.mutableCookies).length ? 1 : 0;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
// First check if a tag, cookie, or path was revalidated.
|
|
111
|
+
if (isTagRevalidated || isCookieRevalidated) {
|
|
112
|
+
res.setHeader(_approuterheaders.NEXT_ACTION_REVALIDATED_HEADER, JSON.stringify(_actionrevalidationkind.ActionDidRevalidateStaticAndDynamic));
|
|
113
|
+
} else if (// Check for refresh() actions. This will invalidate only the dynamic data.
|
|
114
|
+
workStore.pathWasRevalidated !== undefined && workStore.pathWasRevalidated !== _actionrevalidationkind.ActionDidNotRevalidate) {
|
|
115
|
+
res.setHeader(_approuterheaders.NEXT_ACTION_REVALIDATED_HEADER, JSON.stringify(workStore.pathWasRevalidated));
|
|
116
|
+
}
|
|
112
117
|
}
|
|
113
118
|
/**
|
|
114
119
|
* Forwards a server action request to a separate worker. Used when the requested action is not available in the current worker.
|
|
@@ -315,9 +320,10 @@ function parseHostHeader(headers, originDomain) {
|
|
|
315
320
|
value: hostHeader
|
|
316
321
|
} : undefined;
|
|
317
322
|
}
|
|
318
|
-
async function handleAction({ req, res, ComponentMod,
|
|
323
|
+
async function handleAction({ req, res, ComponentMod, generateFlight, workStore, requestStore, serverActions, ctx, metadata }) {
|
|
319
324
|
const contentType = req.headers['content-type'];
|
|
320
|
-
const {
|
|
325
|
+
const { page } = ctx.renderOpts;
|
|
326
|
+
const serverModuleMap = (0, _manifestssingleton.getServerModuleMap)();
|
|
321
327
|
const { actionId, isMultipartAction, isFetchAction, isURLEncodedAction, isPossibleServerAction } = (0, _serveractionrequestmeta.getServerActionRequestMetadata)(req);
|
|
322
328
|
const handleUnrecognizedFetchAction = (err)=>{
|
|
323
329
|
// If the deployment doesn't have skew protection, this is expected to occasionally happen,
|
|
@@ -354,7 +360,7 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
354
360
|
}
|
|
355
361
|
}
|
|
356
362
|
// If the app has no server actions at all, we can 404 early.
|
|
357
|
-
if (!hasServerActions(
|
|
363
|
+
if (!hasServerActions()) {
|
|
358
364
|
return handleUnrecognizedFetchAction(getActionNotFoundError(actionId));
|
|
359
365
|
}
|
|
360
366
|
if (workStore.isStaticGeneration) {
|
|
@@ -418,8 +424,9 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
418
424
|
type: 'done',
|
|
419
425
|
result: await generateFlight(req, ctx, requestStore, {
|
|
420
426
|
actionResult: promise,
|
|
421
|
-
// We didn't execute an action, so no revalidations could have
|
|
422
|
-
|
|
427
|
+
// We didn't execute an action, so no revalidations could have
|
|
428
|
+
// occurred. We can skip rendering the page.
|
|
429
|
+
skipPageRendering: true,
|
|
423
430
|
temporaryReferences
|
|
424
431
|
})
|
|
425
432
|
};
|
|
@@ -432,7 +439,7 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
432
439
|
const { actionAsyncStorage } = ComponentMod;
|
|
433
440
|
const actionWasForwarded = Boolean(req.headers['x-action-forwarded']);
|
|
434
441
|
if (actionId) {
|
|
435
|
-
const forwardedWorker = (0,
|
|
442
|
+
const forwardedWorker = (0, _manifestssingleton.selectWorkerForForwarding)(actionId, page);
|
|
436
443
|
// If forwardedWorker is truthy, it means there isn't a worker for the action
|
|
437
444
|
// in the current handler, so we forward the request to a worker that has the action.
|
|
438
445
|
if (forwardedWorker) {
|
|
@@ -483,7 +490,7 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
483
490
|
// TODO: This can be from skew or manipulated input. We should handle this case
|
|
484
491
|
// more gracefully but this preserves the prior behavior where decodeAction would throw instead.
|
|
485
492
|
throw Object.defineProperty(new Error(`Failed to find Server Action. This request might be from an older or newer deployment.\nRead more: https://nextjs.org/docs/messages/failed-to-find-server-action`), "__NEXT_ERROR_CODE", {
|
|
486
|
-
value: "
|
|
493
|
+
value: "E975",
|
|
487
494
|
enumerable: false,
|
|
488
495
|
configurable: true
|
|
489
496
|
});
|
|
@@ -493,8 +500,8 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
493
500
|
// an MPA action.
|
|
494
501
|
// Only warn if it's a server action, otherwise skip for other post requests
|
|
495
502
|
warnBadServerActionRequest();
|
|
496
|
-
const
|
|
497
|
-
const formState = await decodeFormState(
|
|
503
|
+
const { actionResult } = await executeActionAndPrepareForRender(action, [], workStore, requestStore, actionWasForwarded);
|
|
504
|
+
const formState = await decodeFormState(actionResult, formData, serverModuleMap);
|
|
498
505
|
// Skip the fetch path.
|
|
499
506
|
// We need to render a full HTML version of the page for the response, we'll handle that in app-render.
|
|
500
507
|
return {
|
|
@@ -542,7 +549,8 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
542
549
|
// Use react-server-dom-webpack/server.node which supports streaming
|
|
543
550
|
const { createTemporaryReferenceSet, decodeReply, decodeReplyFromBusboy, decodeAction, decodeFormState } = require(`./react-server.node`);
|
|
544
551
|
temporaryReferences = createTemporaryReferenceSet();
|
|
545
|
-
const {
|
|
552
|
+
const { PassThrough, Readable, Transform } = require('node:stream');
|
|
553
|
+
const { pipeline } = require('node:stream/promises');
|
|
546
554
|
const defaultBodySizeLimit = '1 MB';
|
|
547
555
|
const bodySizeLimit = (serverActions == null ? void 0 : serverActions.bodySizeLimit) ?? defaultBodySizeLimit;
|
|
548
556
|
const bodySizeLimitBytes = bodySizeLimit !== defaultBodySizeLimit ? require('next/dist/compiled/bytes').parse(bodySizeLimit) : 1024 * 1024 // 1 MB
|
|
@@ -563,9 +571,6 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
563
571
|
callback(null, chunk);
|
|
564
572
|
}
|
|
565
573
|
});
|
|
566
|
-
const sizeLimitedBody = pipeline(req.body, sizeLimitTransform, // Avoid unhandled errors from `pipeline()` by passing an empty completion callback.
|
|
567
|
-
// We'll propagate the errors properly when consuming the stream.
|
|
568
|
-
()=>{});
|
|
569
574
|
if (isMultipartAction) {
|
|
570
575
|
if (isFetchAction) {
|
|
571
576
|
// A fetch action with a multipart body.
|
|
@@ -581,16 +586,25 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
581
586
|
fieldSize: bodySizeLimitBytes
|
|
582
587
|
}
|
|
583
588
|
});
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
589
|
+
const abortController = new AbortController();
|
|
590
|
+
try {
|
|
591
|
+
;
|
|
592
|
+
[, boundActionArguments] = await Promise.all([
|
|
593
|
+
pipeline(req.body, sizeLimitTransform, busboy, {
|
|
594
|
+
signal: abortController.signal
|
|
595
|
+
}),
|
|
596
|
+
decodeReplyFromBusboy(busboy, serverModuleMap, {
|
|
597
|
+
temporaryReferences
|
|
598
|
+
})
|
|
599
|
+
]);
|
|
600
|
+
} catch (err) {
|
|
601
|
+
abortController.abort();
|
|
602
|
+
throw err;
|
|
603
|
+
}
|
|
591
604
|
} else {
|
|
592
605
|
// Multipart POST, but not a fetch action.
|
|
593
606
|
// Potentially an MPA action, we have to try decoding it to check.
|
|
607
|
+
const sizeLimitedBody = new PassThrough();
|
|
594
608
|
// React doesn't yet publish a busboy version of decodeAction
|
|
595
609
|
// so we polyfill the parsing of FormData.
|
|
596
610
|
const fakeRequest = new Request('http://localhost', {
|
|
@@ -599,27 +613,28 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
599
613
|
headers: {
|
|
600
614
|
'Content-Type': contentType
|
|
601
615
|
},
|
|
602
|
-
body:
|
|
603
|
-
start: (controller)=>{
|
|
604
|
-
sizeLimitedBody.on('data', (chunk)=>{
|
|
605
|
-
controller.enqueue(new Uint8Array(chunk));
|
|
606
|
-
});
|
|
607
|
-
sizeLimitedBody.on('end', ()=>{
|
|
608
|
-
controller.close();
|
|
609
|
-
});
|
|
610
|
-
sizeLimitedBody.on('error', (err)=>{
|
|
611
|
-
controller.error(err);
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
}),
|
|
616
|
+
body: Readable.toWeb(sizeLimitedBody),
|
|
615
617
|
duplex: 'half'
|
|
616
618
|
});
|
|
617
|
-
|
|
619
|
+
let formData;
|
|
620
|
+
const abortController = new AbortController();
|
|
621
|
+
try {
|
|
622
|
+
;
|
|
623
|
+
[, formData] = await Promise.all([
|
|
624
|
+
pipeline(req.body, sizeLimitTransform, sizeLimitedBody, {
|
|
625
|
+
signal: abortController.signal
|
|
626
|
+
}),
|
|
627
|
+
fakeRequest.formData()
|
|
628
|
+
]);
|
|
629
|
+
} catch (err) {
|
|
630
|
+
abortController.abort();
|
|
631
|
+
throw err;
|
|
632
|
+
}
|
|
618
633
|
if (areAllActionIdsValid(formData, serverModuleMap) === false) {
|
|
619
634
|
// TODO: This can be from skew or manipulated input. We should handle this case
|
|
620
635
|
// more gracefully but this preserves the prior behavior where decodeAction would throw instead.
|
|
621
636
|
throw Object.defineProperty(new Error(`Failed to find Server Action. This request might be from an older or newer deployment.\nRead more: https://nextjs.org/docs/messages/failed-to-find-server-action`), "__NEXT_ERROR_CODE", {
|
|
622
|
-
value: "
|
|
637
|
+
value: "E975",
|
|
623
638
|
enumerable: false,
|
|
624
639
|
configurable: true
|
|
625
640
|
});
|
|
@@ -631,8 +646,8 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
631
646
|
// an MPA action.
|
|
632
647
|
// Only warn if it's a server action, otherwise skip for other post requests
|
|
633
648
|
warnBadServerActionRequest();
|
|
634
|
-
const
|
|
635
|
-
const formState = await decodeFormState(
|
|
649
|
+
const { actionResult } = await executeActionAndPrepareForRender(action, [], workStore, requestStore, actionWasForwarded);
|
|
650
|
+
const formState = await decodeFormState(actionResult, formData, serverModuleMap);
|
|
636
651
|
// Skip the fetch path.
|
|
637
652
|
// We need to render a full HTML version of the page for the response, we'll handle that in app-render.
|
|
638
653
|
return {
|
|
@@ -660,10 +675,16 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
660
675
|
// A fetch action with a non-multipart body.
|
|
661
676
|
// In practice, this happens if `encodeReply` returned a string instead of FormData,
|
|
662
677
|
// which can happen for very simple JSON-like values that don't need multiple flight rows.
|
|
678
|
+
const sizeLimitedBody = new PassThrough();
|
|
663
679
|
const chunks = [];
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
680
|
+
await Promise.all([
|
|
681
|
+
pipeline(req.body, sizeLimitTransform, sizeLimitedBody),
|
|
682
|
+
(async ()=>{
|
|
683
|
+
for await (const chunk of sizeLimitedBody){
|
|
684
|
+
chunks.push(Buffer.from(chunk));
|
|
685
|
+
}
|
|
686
|
+
})()
|
|
687
|
+
]);
|
|
667
688
|
const actionData = Buffer.concat(chunks).toString('utf-8');
|
|
668
689
|
boundActionArguments = await decodeReply(actionData, serverModuleMap, {
|
|
669
690
|
temporaryReferences
|
|
@@ -688,7 +709,7 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
688
709
|
const actionMod = await ComponentMod.__next_app__.require(actionModId);
|
|
689
710
|
const actionHandler = actionMod[// `actionId` must exist if we got here, as otherwise we would have thrown an error above
|
|
690
711
|
actionId];
|
|
691
|
-
const
|
|
712
|
+
const { actionResult, skipPageRendering } = await executeActionAndPrepareForRender(actionHandler, boundActionArguments, workStore, requestStore, actionWasForwarded).finally(()=>{
|
|
692
713
|
addRevalidationHeader(res, {
|
|
693
714
|
workStore,
|
|
694
715
|
requestStore
|
|
@@ -696,15 +717,17 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
696
717
|
});
|
|
697
718
|
// For form actions, we need to continue rendering the page.
|
|
698
719
|
if (isFetchAction) {
|
|
699
|
-
const actionResult = await generateFlight(req, ctx, requestStore, {
|
|
700
|
-
actionResult: Promise.resolve(returnVal),
|
|
701
|
-
// if the page was not revalidated, or if the action was forwarded from another worker, we can skip the rendering the flight tree
|
|
702
|
-
skipFlight: !workStore.pathWasRevalidated || actionWasForwarded,
|
|
703
|
-
temporaryReferences
|
|
704
|
-
});
|
|
705
720
|
return {
|
|
706
721
|
type: 'done',
|
|
707
|
-
result:
|
|
722
|
+
result: await generateFlight(req, ctx, requestStore, {
|
|
723
|
+
actionResult: Promise.resolve(actionResult),
|
|
724
|
+
skipPageRendering,
|
|
725
|
+
temporaryReferences,
|
|
726
|
+
// If we skip page rendering, we need to ensure pending
|
|
727
|
+
// revalidates are awaited before closing the response. Otherwise,
|
|
728
|
+
// this will be done after rendering the page.
|
|
729
|
+
waitUntil: skipPageRendering ? (0, _revalidationutils.executeRevalidates)(workStore) : undefined
|
|
730
|
+
})
|
|
708
731
|
};
|
|
709
732
|
} else {
|
|
710
733
|
// TODO: this shouldn't be reachable, because all non-fetch codepaths return early.
|
|
@@ -749,7 +772,7 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
749
772
|
return {
|
|
750
773
|
type: 'done',
|
|
751
774
|
result: await generateFlight(req, ctx, requestStore, {
|
|
752
|
-
|
|
775
|
+
skipPageRendering: false,
|
|
753
776
|
actionResult: promise,
|
|
754
777
|
temporaryReferences
|
|
755
778
|
})
|
|
@@ -782,8 +805,9 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
782
805
|
type: 'done',
|
|
783
806
|
result: await generateFlight(req, ctx, requestStore, {
|
|
784
807
|
actionResult: promise,
|
|
785
|
-
//
|
|
786
|
-
|
|
808
|
+
// If the page was not revalidated, or if the action was forwarded
|
|
809
|
+
// from another worker, we can skip rendering the page.
|
|
810
|
+
skipPageRendering: workStore.pathWasRevalidated === undefined || workStore.pathWasRevalidated === _actionrevalidationkind.ActionDidNotRevalidate || actionWasForwarded,
|
|
787
811
|
temporaryReferences
|
|
788
812
|
})
|
|
789
813
|
};
|
|
@@ -792,23 +816,35 @@ async function handleAction({ req, res, ComponentMod, serverModuleMap, generateF
|
|
|
792
816
|
throw err;
|
|
793
817
|
}
|
|
794
818
|
}
|
|
795
|
-
async function executeActionAndPrepareForRender(action, args, workStore, requestStore) {
|
|
819
|
+
async function executeActionAndPrepareForRender(action, args, workStore, requestStore, actionWasForwarded) {
|
|
796
820
|
requestStore.phase = 'action';
|
|
821
|
+
let skipPageRendering = actionWasForwarded;
|
|
797
822
|
try {
|
|
798
|
-
|
|
823
|
+
const actionResult = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, ()=>action.apply(null, args));
|
|
824
|
+
// If the page was not revalidated, or if the action was forwarded from
|
|
825
|
+
// another worker, we can skip rendering the page.
|
|
826
|
+
skipPageRendering ||= workStore.pathWasRevalidated === undefined || workStore.pathWasRevalidated === _actionrevalidationkind.ActionDidNotRevalidate;
|
|
827
|
+
return {
|
|
828
|
+
actionResult,
|
|
829
|
+
skipPageRendering
|
|
830
|
+
};
|
|
799
831
|
} finally{
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
832
|
+
if (!skipPageRendering) {
|
|
833
|
+
requestStore.phase = 'render';
|
|
834
|
+
// When we switch to the render phase, cookies() will return
|
|
835
|
+
// `workUnitStore.cookies` instead of
|
|
836
|
+
// `workUnitStore.userspaceMutableCookies`. We want the render to see any
|
|
837
|
+
// cookie writes that we performed during the action, so we need to update
|
|
838
|
+
// the immutable cookies to reflect the changes.
|
|
839
|
+
(0, _requeststore.synchronizeMutableCookies)(requestStore);
|
|
840
|
+
// The server action might have toggled draft mode, so we need to reflect
|
|
841
|
+
// that in the work store to be up-to-date for subsequent rendering.
|
|
842
|
+
workStore.isDraftMode = requestStore.draftMode.isEnabled;
|
|
843
|
+
// If the action called revalidateTag/revalidatePath, then that might
|
|
844
|
+
// affect data used by the subsequent render, so we need to make sure all
|
|
845
|
+
// revalidations are applied before that.
|
|
846
|
+
await (0, _revalidationutils.executeRevalidates)(workStore);
|
|
847
|
+
}
|
|
812
848
|
}
|
|
813
849
|
}
|
|
814
850
|
/**
|
|
@@ -833,7 +869,7 @@ async function executeActionAndPrepareForRender(action, args, workStore, request
|
|
|
833
869
|
}
|
|
834
870
|
function getActionNotFoundError(actionId) {
|
|
835
871
|
return Object.defineProperty(new Error(`Failed to find Server Action${actionId ? ` "${actionId}"` : ''}. This request might be from an older or newer deployment.\nRead more: https://nextjs.org/docs/messages/failed-to-find-server-action`), "__NEXT_ERROR_CODE", {
|
|
836
|
-
value: "
|
|
872
|
+
value: "E974",
|
|
837
873
|
enumerable: false,
|
|
838
874
|
configurable: true
|
|
839
875
|
});
|