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
|
@@ -16,14 +16,7 @@ const _client = require("react-server-dom-webpack/client");
|
|
|
16
16
|
const _assignlocation = require("../../../assign-location");
|
|
17
17
|
const _createhreffromurl = require("../create-href-from-url");
|
|
18
18
|
const _navigatereducer = require("./navigate-reducer");
|
|
19
|
-
const _applyrouterstatepatchtotree = require("../apply-router-state-patch-to-tree");
|
|
20
|
-
const _isnavigatingtonewrootlayout = require("../is-navigating-to-new-root-layout");
|
|
21
|
-
const _handlemutable = require("../handle-mutable");
|
|
22
|
-
const _filllazyitemstillleafwithhead = require("../fill-lazy-items-till-leaf-with-head");
|
|
23
|
-
const _approuter = require("../../app-router");
|
|
24
19
|
const _hasinterceptionrouteincurrenttree = require("./has-interception-route-in-current-tree");
|
|
25
|
-
const _handlesegmentmismatch = require("../handle-segment-mismatch");
|
|
26
|
-
const _refetchinactiveparallelsegments = require("../refetch-inactive-parallel-segments");
|
|
27
20
|
const _flightdatahelpers = require("../../../flight-data-helpers");
|
|
28
21
|
const _redirect = require("../../redirect");
|
|
29
22
|
const _redirecterror = require("../../redirect-error");
|
|
@@ -31,6 +24,11 @@ const _removebasepath = require("../../../remove-base-path");
|
|
|
31
24
|
const _hasbasepath = require("../../../has-base-path");
|
|
32
25
|
const _serverreferenceinfo = require("../../../../shared/lib/server-reference-info");
|
|
33
26
|
const _cache = require("../../segment-cache/cache");
|
|
27
|
+
const _deploymentid = require("../../../../shared/lib/deployment-id");
|
|
28
|
+
const _navigation = require("../../segment-cache/navigation");
|
|
29
|
+
const _actionrevalidationkind = require("../../../../shared/lib/action-revalidation-kind");
|
|
30
|
+
const _approuterutils = require("../../app-router-utils");
|
|
31
|
+
const _pprnavigations = require("../ppr-navigations");
|
|
34
32
|
const createFromFetch = _client.createFromFetch;
|
|
35
33
|
let createDebugChannel;
|
|
36
34
|
if (process.env.NODE_ENV !== 'production' && process.env.__NEXT_REACT_DEBUG_CHANNEL) {
|
|
@@ -51,8 +49,9 @@ async function fetchServerAction(state, nextUrl, { actionId, actionArgs }) {
|
|
|
51
49
|
[_approuterheaders.ACTION_HEADER]: actionId,
|
|
52
50
|
[_approuterheaders.NEXT_ROUTER_STATE_TREE_HEADER]: (0, _flightdatahelpers.prepareFlightRouterStateForRequest)(state.tree)
|
|
53
51
|
};
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const deploymentId = (0, _deploymentid.getDeploymentId)();
|
|
53
|
+
if (deploymentId) {
|
|
54
|
+
headers['x-deployment-id'] = deploymentId;
|
|
56
55
|
}
|
|
57
56
|
if (nextUrl) {
|
|
58
57
|
headers[_approuterheaders.NEXT_URL] = nextUrl;
|
|
@@ -81,7 +80,7 @@ async function fetchServerAction(state, nextUrl, { actionId, actionArgs }) {
|
|
|
81
80
|
});
|
|
82
81
|
}
|
|
83
82
|
const redirectHeader = res.headers.get('x-action-redirect');
|
|
84
|
-
const [
|
|
83
|
+
const [location1, _redirectType] = redirectHeader?.split(';') || [];
|
|
85
84
|
let redirectType;
|
|
86
85
|
switch(_redirectType){
|
|
87
86
|
case 'push':
|
|
@@ -94,18 +93,17 @@ async function fetchServerAction(state, nextUrl, { actionId, actionArgs }) {
|
|
|
94
93
|
redirectType = undefined;
|
|
95
94
|
}
|
|
96
95
|
const isPrerender = !!res.headers.get(_approuterheaders.NEXT_IS_PRERENDER_HEADER);
|
|
97
|
-
let
|
|
96
|
+
let revalidationKind = _actionrevalidationkind.ActionDidNotRevalidate;
|
|
98
97
|
try {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const redirectLocation = location ? (0, _assignlocation.assignLocation)(location, new URL(state.canonicalUrl, window.location.href)) : undefined;
|
|
98
|
+
const revalidationHeader = res.headers.get('x-action-revalidated');
|
|
99
|
+
if (revalidationHeader) {
|
|
100
|
+
const parsedKind = JSON.parse(revalidationHeader);
|
|
101
|
+
if (parsedKind === _actionrevalidationkind.ActionDidRevalidateStaticAndDynamic || parsedKind === _actionrevalidationkind.ActionDidRevalidateDynamicOnly) {
|
|
102
|
+
revalidationKind = parsedKind;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} catch {}
|
|
106
|
+
const redirectLocation = location1 ? (0, _assignlocation.assignLocation)(location1, new URL(state.canonicalUrl, window.location.href)) : undefined;
|
|
109
107
|
const contentType = res.headers.get('content-type');
|
|
110
108
|
const isRscResponse = !!(contentType && contentType.startsWith(_approuterheaders.RSC_CONTENT_TYPE_HEADER));
|
|
111
109
|
// Handle invalid server action responses.
|
|
@@ -123,6 +121,8 @@ async function fetchServerAction(state, nextUrl, { actionId, actionArgs }) {
|
|
|
123
121
|
}
|
|
124
122
|
let actionResult;
|
|
125
123
|
let actionFlightData;
|
|
124
|
+
let actionFlightDataRenderedSearch;
|
|
125
|
+
let actionFlightDataCouldBeIntercepted;
|
|
126
126
|
if (isRscResponse) {
|
|
127
127
|
const response = await createFromFetch(Promise.resolve(res), {
|
|
128
128
|
callServer: _appcallserver.callServer,
|
|
@@ -132,30 +132,33 @@ async function fetchServerAction(state, nextUrl, { actionId, actionArgs }) {
|
|
|
132
132
|
});
|
|
133
133
|
// An internal redirect can send an RSC response, but does not have a useful `actionResult`.
|
|
134
134
|
actionResult = redirectLocation ? undefined : response.a;
|
|
135
|
-
|
|
135
|
+
const maybeFlightData = (0, _flightdatahelpers.normalizeFlightData)(response.f);
|
|
136
|
+
if (maybeFlightData !== '') {
|
|
137
|
+
actionFlightData = maybeFlightData;
|
|
138
|
+
actionFlightDataRenderedSearch = response.q;
|
|
139
|
+
actionFlightDataCouldBeIntercepted = response.i;
|
|
140
|
+
}
|
|
136
141
|
} else {
|
|
137
142
|
// An external redirect doesn't contain RSC data.
|
|
138
143
|
actionResult = undefined;
|
|
139
144
|
actionFlightData = undefined;
|
|
145
|
+
actionFlightDataRenderedSearch = undefined;
|
|
146
|
+
actionFlightDataCouldBeIntercepted = undefined;
|
|
140
147
|
}
|
|
141
148
|
return {
|
|
142
149
|
actionResult,
|
|
143
150
|
actionFlightData,
|
|
151
|
+
actionFlightDataRenderedSearch,
|
|
152
|
+
actionFlightDataCouldBeIntercepted,
|
|
144
153
|
redirectLocation,
|
|
145
154
|
redirectType,
|
|
146
|
-
|
|
155
|
+
revalidationKind,
|
|
147
156
|
isPrerender
|
|
148
157
|
};
|
|
149
158
|
}
|
|
150
|
-
const NO_REVALIDATED_PARTS = {
|
|
151
|
-
paths: [],
|
|
152
|
-
tag: false,
|
|
153
|
-
cookie: false
|
|
154
|
-
};
|
|
155
159
|
function serverActionReducer(state, action) {
|
|
156
160
|
const { resolve, reject } = action;
|
|
157
161
|
const mutable = {};
|
|
158
|
-
let currentTree = state.tree;
|
|
159
162
|
mutable.preserveCustomHistoryState = false;
|
|
160
163
|
// only pass along the `nextUrl` param (used for interception routes) if the current route was intercepted.
|
|
161
164
|
// If the route has been intercepted, the action should be as well.
|
|
@@ -167,108 +170,118 @@ function serverActionReducer(state, action) {
|
|
|
167
170
|
// interception route to be matched that used the last
|
|
168
171
|
// next-url.
|
|
169
172
|
(state.previousNextUrl || state.nextUrl) && (0, _hasinterceptionrouteincurrenttree.hasInterceptionRouteInCurrentTree)(state.tree) ? state.previousNextUrl || state.nextUrl : null;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
state.pushRef.pendingPush = false;
|
|
177
|
-
mutable.pendingPush = false;
|
|
178
|
-
} else {
|
|
179
|
-
state.pushRef.pendingPush = true;
|
|
180
|
-
mutable.pendingPush = true;
|
|
181
|
-
}
|
|
182
|
-
redirectHref = (0, _createhreffromurl.createHrefFromUrl)(redirectLocation, false);
|
|
183
|
-
mutable.canonicalUrl = redirectHref;
|
|
184
|
-
}
|
|
185
|
-
if (!flightData) {
|
|
186
|
-
resolve(actionResult);
|
|
187
|
-
// If there is a redirect but no flight data we need to do a mpaNavigation.
|
|
188
|
-
if (redirectLocation) {
|
|
189
|
-
return (0, _navigatereducer.handleExternalUrl)(state, mutable, redirectLocation.href, state.pushRef.pendingPush);
|
|
190
|
-
}
|
|
191
|
-
return state;
|
|
192
|
-
}
|
|
193
|
-
if (typeof flightData === 'string') {
|
|
194
|
-
// Handle case when navigating to page in `pages` from `app`
|
|
195
|
-
resolve(actionResult);
|
|
196
|
-
return (0, _navigatereducer.handleExternalUrl)(state, mutable, flightData, state.pushRef.pendingPush);
|
|
197
|
-
}
|
|
198
|
-
const actionRevalidated = revalidatedParts.paths.length > 0 || revalidatedParts.tag || revalidatedParts.cookie;
|
|
199
|
-
// Store whether this action triggered any revalidation
|
|
200
|
-
// The action queue will use this information to potentially
|
|
201
|
-
// trigger a refresh action if the action was discarded
|
|
202
|
-
// (ie, due to a navigation, before the action completed)
|
|
203
|
-
if (actionRevalidated) {
|
|
173
|
+
return fetchServerAction(state, nextUrl, action).then(async ({ revalidationKind, actionResult, actionFlightData: flightData, actionFlightDataRenderedSearch: flightDataRenderedSearch, actionFlightDataCouldBeIntercepted: flightDataCouldBeIntercepted, redirectLocation, redirectType })=>{
|
|
174
|
+
if (revalidationKind !== _actionrevalidationkind.ActionDidNotRevalidate) {
|
|
175
|
+
// Store whether this action triggered any revalidation
|
|
176
|
+
// The action queue will use this information to potentially
|
|
177
|
+
// trigger a refresh action if the action was discarded
|
|
178
|
+
// (ie, due to a navigation, before the action completed)
|
|
204
179
|
action.didRevalidate = true;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// TODO-APP: handle this case better
|
|
210
|
-
console.log('SERVER ACTION APPLY FAILED');
|
|
211
|
-
resolve(actionResult);
|
|
212
|
-
return state;
|
|
213
|
-
}
|
|
214
|
-
// Given the path can only have two items the items are only the router state and rsc for the root.
|
|
215
|
-
const newTree = (0, _applyrouterstatepatchtotree.applyRouterStatePatchToTree)(// TODO-APP: remove ''
|
|
216
|
-
[
|
|
217
|
-
''
|
|
218
|
-
], currentTree, treePatch, redirectHref ? redirectHref : state.canonicalUrl);
|
|
219
|
-
if (newTree === null) {
|
|
220
|
-
resolve(actionResult);
|
|
221
|
-
return (0, _handlesegmentmismatch.handleSegmentMismatch)(state, action, treePatch);
|
|
222
|
-
}
|
|
223
|
-
if ((0, _isnavigatingtonewrootlayout.isNavigatingToNewRootLayout)(currentTree, newTree)) {
|
|
224
|
-
resolve(actionResult);
|
|
225
|
-
return (0, _navigatereducer.handleExternalUrl)(state, mutable, redirectHref || state.canonicalUrl, state.pushRef.pendingPush);
|
|
226
|
-
}
|
|
227
|
-
// The server sent back RSC data for the server action, so we need to apply it to the cache.
|
|
228
|
-
if (cacheNodeSeedData !== null) {
|
|
229
|
-
const rsc = cacheNodeSeedData[0];
|
|
230
|
-
const cache = (0, _approuter.createEmptyCacheNode)();
|
|
231
|
-
cache.rsc = rsc;
|
|
232
|
-
cache.prefetchRsc = null;
|
|
233
|
-
cache.loading = cacheNodeSeedData[2];
|
|
234
|
-
(0, _filllazyitemstillleafwithhead.fillLazyItemsTillLeafWithHead)(navigatedAt, cache, // Existing cache is not passed in as server actions have to invalidate the entire cache.
|
|
235
|
-
undefined, treePatch, cacheNodeSeedData, head);
|
|
236
|
-
mutable.cache = cache;
|
|
237
|
-
(0, _cache.revalidateEntireCache)(state.nextUrl, newTree);
|
|
238
|
-
if (actionRevalidated) {
|
|
239
|
-
await (0, _refetchinactiveparallelsegments.refreshInactiveParallelSegments)({
|
|
240
|
-
navigatedAt,
|
|
241
|
-
state,
|
|
242
|
-
updatedTree: newTree,
|
|
243
|
-
updatedCache: cache,
|
|
244
|
-
includeNextUrl: Boolean(nextUrl),
|
|
245
|
-
canonicalUrl: mutable.canonicalUrl || state.canonicalUrl
|
|
246
|
-
});
|
|
247
|
-
}
|
|
180
|
+
// If there was a revalidation, evict the entire prefetch cache.
|
|
181
|
+
// TODO: Evict only segments with matching tags and/or paths.
|
|
182
|
+
if (revalidationKind === _actionrevalidationkind.ActionDidRevalidateStaticAndDynamic) {
|
|
183
|
+
(0, _cache.revalidateEntireCache)(nextUrl, state.tree);
|
|
248
184
|
}
|
|
249
|
-
mutable.patchedTree = newTree;
|
|
250
|
-
currentTree = newTree;
|
|
251
185
|
}
|
|
252
|
-
|
|
186
|
+
const pendingPush = redirectType !== _redirecterror.RedirectType.replace;
|
|
187
|
+
state.pushRef.pendingPush = pendingPush;
|
|
188
|
+
mutable.pendingPush = pendingPush;
|
|
189
|
+
if (redirectLocation !== undefined) {
|
|
253
190
|
// If the action triggered a redirect, the action promise will be rejected with
|
|
254
191
|
// a redirect so that it's handled by RedirectBoundary as we won't have a valid
|
|
255
192
|
// action result to resolve the promise with. This will effectively reset the state of
|
|
256
193
|
// the component that called the action as the error boundary will remount the tree.
|
|
257
194
|
// The status code doesn't matter here as the action handler will have already sent
|
|
258
195
|
// a response with the correct status code.
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
196
|
+
const resolvedRedirectType = redirectType || _redirecterror.RedirectType.push;
|
|
197
|
+
if ((0, _approuterutils.isExternalURL)(redirectLocation)) {
|
|
198
|
+
// External redirect. Triggers an MPA navigation.
|
|
199
|
+
const redirectHref = redirectLocation.href;
|
|
200
|
+
const redirectError = createRedirectErrorForAction(redirectHref, resolvedRedirectType);
|
|
201
|
+
reject(redirectError);
|
|
202
|
+
return (0, _navigatereducer.handleExternalUrl)(state, mutable, redirectHref, pendingPush);
|
|
203
|
+
} else {
|
|
204
|
+
// Internal redirect. Triggers an SPA navigation.
|
|
205
|
+
const redirectWithBasepath = (0, _createhreffromurl.createHrefFromUrl)(redirectLocation, false);
|
|
206
|
+
const redirectHref = (0, _hasbasepath.hasBasePath)(redirectWithBasepath) ? (0, _removebasepath.removeBasePath)(redirectWithBasepath) : redirectWithBasepath;
|
|
207
|
+
const redirectError = createRedirectErrorForAction(redirectHref, resolvedRedirectType);
|
|
208
|
+
reject(redirectError);
|
|
209
|
+
}
|
|
262
210
|
} else {
|
|
211
|
+
// If there's no redirect, resolve the action with the result.
|
|
263
212
|
resolve(actionResult);
|
|
264
213
|
}
|
|
265
|
-
|
|
214
|
+
// Check if we can bail out without updating any state.
|
|
215
|
+
if (// Did the action trigger a redirect?
|
|
216
|
+
redirectLocation === undefined && // Did the action revalidate any data?
|
|
217
|
+
revalidationKind === _actionrevalidationkind.ActionDidNotRevalidate && // Did the server render new data?
|
|
218
|
+
flightData === undefined) {
|
|
219
|
+
// The action did not trigger any revalidations or redirects. No
|
|
220
|
+
// navigation is required.
|
|
221
|
+
return state;
|
|
222
|
+
}
|
|
223
|
+
if (flightData === undefined && redirectLocation !== undefined) {
|
|
224
|
+
// The server redirected, but did not send any Flight data. This implies
|
|
225
|
+
// an external redirect.
|
|
226
|
+
// TODO: We should refactor the action response type to be more explicit
|
|
227
|
+
// about the various response types.
|
|
228
|
+
return (0, _navigatereducer.handleExternalUrl)(state, mutable, redirectLocation.href, pendingPush);
|
|
229
|
+
}
|
|
230
|
+
if (typeof flightData === 'string') {
|
|
231
|
+
// If the flight data is just a string, something earlier in the
|
|
232
|
+
// response handling triggered an external redirect.
|
|
233
|
+
return (0, _navigatereducer.handleExternalUrl)(state, mutable, flightData, pendingPush);
|
|
234
|
+
}
|
|
235
|
+
// The action triggered a navigation — either a redirect, a revalidation,
|
|
236
|
+
// or both.
|
|
237
|
+
// If there was no redirect, then the target URL is the same as the
|
|
238
|
+
// current URL.
|
|
239
|
+
const currentUrl = new URL(state.canonicalUrl, location.origin);
|
|
240
|
+
const redirectUrl = redirectLocation !== undefined ? redirectLocation : currentUrl;
|
|
241
|
+
const currentFlightRouterState = state.tree;
|
|
242
|
+
const shouldScroll = true;
|
|
243
|
+
// If the action triggered a revalidation of the cache, we should also
|
|
244
|
+
// refresh all the dynamic data.
|
|
245
|
+
const freshnessPolicy = revalidationKind === _actionrevalidationkind.ActionDidNotRevalidate ? _pprnavigations.FreshnessPolicy.Default : _pprnavigations.FreshnessPolicy.RefreshAll;
|
|
246
|
+
// The server may have sent back new data. If so, we will perform a
|
|
247
|
+
// "seeded" navigation that uses the data from the response.
|
|
248
|
+
if (flightData !== undefined) {
|
|
249
|
+
const normalizedFlightData = flightData[0];
|
|
250
|
+
if (normalizedFlightData !== undefined && // TODO: Currently the server always renders from the root in
|
|
251
|
+
// response to a Server Action. In the case of a normal redirect
|
|
252
|
+
// with no revalidation, it should skip over the shared layouts.
|
|
253
|
+
normalizedFlightData.isRootRender && flightDataRenderedSearch !== undefined && flightDataCouldBeIntercepted !== undefined) {
|
|
254
|
+
// The server sent back new route data as part of the response. We
|
|
255
|
+
// will use this to render the new page. If this happens to be only a
|
|
256
|
+
// subset of the data needed to render the new page, we'll initiate a
|
|
257
|
+
// new fetch, like we would for a normal navigation.
|
|
258
|
+
const redirectCanonicalUrl = (0, _createhreffromurl.createHrefFromUrl)(redirectUrl);
|
|
259
|
+
const navigationSeed = {
|
|
260
|
+
tree: normalizedFlightData.tree,
|
|
261
|
+
renderedSearch: flightDataRenderedSearch,
|
|
262
|
+
data: normalizedFlightData.seedData,
|
|
263
|
+
head: normalizedFlightData.head
|
|
264
|
+
};
|
|
265
|
+
const now = Date.now();
|
|
266
|
+
const result = (0, _navigation.navigateToSeededRoute)(now, redirectUrl, redirectCanonicalUrl, navigationSeed, currentUrl, state.cache, currentFlightRouterState, freshnessPolicy, nextUrl, shouldScroll);
|
|
267
|
+
return (0, _navigatereducer.handleNavigationResult)(redirectUrl, state, mutable, pendingPush, result);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// The server did not send back new data. We'll perform a regular, non-
|
|
271
|
+
// seeded navigation — effectively the same as <Link> or router.push().
|
|
272
|
+
const result = (0, _navigation.navigate)(redirectUrl, currentUrl, state.cache, currentFlightRouterState, nextUrl, freshnessPolicy, shouldScroll, mutable);
|
|
273
|
+
return (0, _navigatereducer.handleNavigationResult)(redirectUrl, state, mutable, pendingPush, result);
|
|
266
274
|
}, (e)=>{
|
|
267
275
|
// When the server action is rejected we don't update the state and instead call the reject handler of the promise.
|
|
268
276
|
reject(e);
|
|
269
277
|
return state;
|
|
270
278
|
});
|
|
271
279
|
}
|
|
280
|
+
function createRedirectErrorForAction(redirectHref, resolvedRedirectType) {
|
|
281
|
+
const redirectError = (0, _redirect.getRedirectError)(redirectHref, resolvedRedirectType);
|
|
282
|
+
redirectError.handled = true;
|
|
283
|
+
return redirectError;
|
|
284
|
+
}
|
|
272
285
|
|
|
273
286
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
274
287
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
@@ -9,51 +9,42 @@ Object.defineProperty(exports, "serverPatchReducer", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _createhreffromurl = require("../create-href-from-url");
|
|
12
|
-
const _applyrouterstatepatchtotree = require("../apply-router-state-patch-to-tree");
|
|
13
|
-
const _isnavigatingtonewrootlayout = require("../is-navigating-to-new-root-layout");
|
|
14
12
|
const _navigatereducer = require("./navigate-reducer");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
13
|
+
const _navigation = require("../../segment-cache/navigation");
|
|
14
|
+
const _refreshreducer = require("./refresh-reducer");
|
|
15
|
+
const _pprnavigations = require("../ppr-navigations");
|
|
18
16
|
function serverPatchReducer(state, action) {
|
|
19
|
-
const { serverResponse, navigatedAt } = action;
|
|
20
17
|
const mutable = {};
|
|
21
18
|
mutable.preserveCustomHistoryState = false;
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
// A "retry" is a navigation that happens due to a route mismatch. It's
|
|
20
|
+
// similar to a refresh, because we will omit any existing dynamic data on
|
|
21
|
+
// the page. But we seed the retry navigation with the exact tree that the
|
|
22
|
+
// server just responded with.
|
|
23
|
+
const retryMpa = action.mpa;
|
|
24
|
+
const retryUrl = new URL(action.url, location.origin);
|
|
25
|
+
const retrySeed = action.seed;
|
|
26
|
+
if (retryMpa || retrySeed === null) {
|
|
27
|
+
// If the server did not send back data during the mismatch, fall back to
|
|
28
|
+
// an MPA navigation.
|
|
29
|
+
return (0, _navigatereducer.handleExternalUrl)(state, mutable, retryUrl.href, false);
|
|
25
30
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
[
|
|
33
|
-
'',
|
|
34
|
-
...flightSegmentPath
|
|
35
|
-
], currentTree, treePatch, state.canonicalUrl);
|
|
36
|
-
// `applyRouterStatePatchToTree` returns `null` when it determined that the server response is not applicable to the current tree.
|
|
37
|
-
// In other words, the server responded with a tree that doesn't match what the client is currently rendering.
|
|
38
|
-
// This can happen if the server patch action took longer to resolve than a subsequent navigation which would have changed the tree.
|
|
39
|
-
// Previously this case triggered an MPA navigation but it should be safe to simply discard the server response rather than forcing
|
|
40
|
-
// the entire page to reload.
|
|
41
|
-
if (newTree === null) {
|
|
42
|
-
return state;
|
|
43
|
-
}
|
|
44
|
-
if ((0, _isnavigatingtonewrootlayout.isNavigatingToNewRootLayout)(currentTree, newTree)) {
|
|
45
|
-
return (0, _navigatereducer.handleExternalUrl)(state, mutable, state.canonicalUrl, state.pushRef.pendingPush);
|
|
46
|
-
}
|
|
47
|
-
mutable.canonicalUrl = (0, _createhreffromurl.createHrefFromUrl)(canonicalUrl);
|
|
48
|
-
const cache = (0, _approuter.createEmptyCacheNode)();
|
|
49
|
-
(0, _applyflightdata.applyFlightData)(navigatedAt, currentCache, cache, normalizedFlightData);
|
|
50
|
-
mutable.patchedTree = newTree;
|
|
51
|
-
mutable.renderedSearch = renderedSearch;
|
|
52
|
-
mutable.cache = cache;
|
|
53
|
-
currentCache = cache;
|
|
54
|
-
currentTree = newTree;
|
|
31
|
+
const currentUrl = new URL(state.canonicalUrl, location.origin);
|
|
32
|
+
if (action.previousTree !== state.tree) {
|
|
33
|
+
// There was another, more recent navigation since the once that
|
|
34
|
+
// mismatched. We can abort the retry, but we still need to refresh the
|
|
35
|
+
// page to evict any stale dynamic data.
|
|
36
|
+
return (0, _refreshreducer.refreshReducer)(state);
|
|
55
37
|
}
|
|
56
|
-
|
|
38
|
+
// There have been no new navigations since the mismatched one. Refresh,
|
|
39
|
+
// using the tree we just received from the server.
|
|
40
|
+
const retryCanonicalUrl = (0, _createhreffromurl.createHrefFromUrl)(retryUrl);
|
|
41
|
+
const retryNextUrl = action.nextUrl;
|
|
42
|
+
// A retry should not create a new history entry.
|
|
43
|
+
const pendingPush = false;
|
|
44
|
+
const shouldScroll = true;
|
|
45
|
+
const now = Date.now();
|
|
46
|
+
const result = (0, _navigation.navigateToSeededRoute)(now, retryUrl, retryCanonicalUrl, retrySeed, currentUrl, state.cache, state.tree, _pprnavigations.FreshnessPolicy.RefreshAll, retryNextUrl, shouldScroll);
|
|
47
|
+
return (0, _navigatereducer.handleNavigationResult)(retryUrl, state, mutable, pendingPush, result);
|
|
57
48
|
}
|
|
58
49
|
|
|
59
50
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
@@ -33,11 +33,11 @@ const _serveractionreducer = require("./reducers/server-action-reducer");
|
|
|
33
33
|
}
|
|
34
34
|
case _routerreducertypes.ACTION_REFRESH:
|
|
35
35
|
{
|
|
36
|
-
return (0, _refreshreducer.refreshReducer)(state
|
|
36
|
+
return (0, _refreshreducer.refreshReducer)(state);
|
|
37
37
|
}
|
|
38
38
|
case _routerreducertypes.ACTION_HMR_REFRESH:
|
|
39
39
|
{
|
|
40
|
-
return (0, _hmrrefreshreducer.hmrRefreshReducer)(state
|
|
40
|
+
return (0, _hmrrefreshreducer.hmrRefreshReducer)(state);
|
|
41
41
|
}
|
|
42
42
|
case _routerreducertypes.ACTION_SERVER_ACTION:
|
|
43
43
|
{
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Fallback: null,
|
|
7
7
|
createCacheMap: null,
|
|
8
8
|
deleteFromCacheMap: null,
|
|
9
|
+
deleteMapEntry: null,
|
|
9
10
|
getFromCacheMap: null,
|
|
10
11
|
isValueExpired: null,
|
|
11
12
|
setInCacheMap: null,
|
|
@@ -27,6 +28,9 @@ _export(exports, {
|
|
|
27
28
|
deleteFromCacheMap: function() {
|
|
28
29
|
return deleteFromCacheMap;
|
|
29
30
|
},
|
|
31
|
+
deleteMapEntry: function() {
|
|
32
|
+
return deleteMapEntry;
|
|
33
|
+
},
|
|
30
34
|
getFromCacheMap: function() {
|
|
31
35
|
return getFromCacheMap;
|
|
32
36
|
},
|
|
@@ -205,22 +209,14 @@ function setMapEntryValue(entry, value) {
|
|
|
205
209
|
// from the map. We're not calling `deleteMapEntry` here because the
|
|
206
210
|
// entry itself is still in the map. We just want to overwrite its value.
|
|
207
211
|
dropRef(entry.value);
|
|
208
|
-
|
|
209
|
-
const emptyEntry = entry;
|
|
210
|
-
emptyEntry.value = null;
|
|
211
|
-
fillEmptyReference(emptyEntry, value);
|
|
212
|
-
} else {
|
|
213
|
-
fillEmptyReference(entry, value);
|
|
212
|
+
entry.value = null;
|
|
214
213
|
}
|
|
215
|
-
}
|
|
216
|
-
function fillEmptyReference(entry, value) {
|
|
217
214
|
// This value may already be in the map at a different keypath.
|
|
218
215
|
// Grab a reference before we overwrite it.
|
|
219
216
|
const oldEntry = value.ref;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
value.
|
|
223
|
-
(0, _lru.updateLruSize)(fullEntry, value.size);
|
|
217
|
+
entry.value = value;
|
|
218
|
+
value.ref = entry;
|
|
219
|
+
(0, _lru.updateLruSize)(entry, value.size);
|
|
224
220
|
if (oldEntry !== null && oldEntry !== entry && oldEntry.value === value) {
|
|
225
221
|
// This value is already in the map at a different keypath in the map.
|
|
226
222
|
// Values only exist at a single keypath at a time. Remove it from the
|
|
@@ -250,17 +246,16 @@ function dropRef(value) {
|
|
|
250
246
|
}
|
|
251
247
|
function deleteMapEntry(entry) {
|
|
252
248
|
// Delete the entry from the cache.
|
|
253
|
-
|
|
254
|
-
emptyEntry.value = null;
|
|
249
|
+
entry.value = null;
|
|
255
250
|
(0, _lru.deleteFromLru)(entry);
|
|
256
251
|
// Check if we can garbage collect the entry.
|
|
257
|
-
const map =
|
|
252
|
+
const map = entry.map;
|
|
258
253
|
if (map === null) {
|
|
259
254
|
// Since this entry has no value, and also no child entries, we can
|
|
260
255
|
// garbage collect it. Remove it from its parent, and keep garbage
|
|
261
256
|
// collecting the parents until we reach a non-empty entry.
|
|
262
|
-
let parent =
|
|
263
|
-
let key =
|
|
257
|
+
let parent = entry.parent;
|
|
258
|
+
let key = entry.key;
|
|
264
259
|
while(parent !== null){
|
|
265
260
|
const parentMap = parent.map;
|
|
266
261
|
if (parentMap !== null) {
|
|
@@ -284,7 +279,7 @@ function deleteMapEntry(entry) {
|
|
|
284
279
|
// "normal" entry, since the normal one was just deleted.
|
|
285
280
|
const revalidatingEntry = map.get(Revalidation);
|
|
286
281
|
if (revalidatingEntry !== undefined && revalidatingEntry.value !== null) {
|
|
287
|
-
setMapEntryValue(
|
|
282
|
+
setMapEntryValue(entry, revalidatingEntry.value);
|
|
288
283
|
}
|
|
289
284
|
}
|
|
290
285
|
}
|
|
@@ -111,7 +111,6 @@ const _flightdatahelpers = require("../../flight-data-helpers");
|
|
|
111
111
|
const _navigatereducer = require("../router-reducer/reducers/navigate-reducer");
|
|
112
112
|
const _links = require("../links");
|
|
113
113
|
const _segment = require("../../../shared/lib/segment");
|
|
114
|
-
const _outputexportprefetchencoding = require("../../../shared/lib/segment-cache/output-export-prefetch-encoding");
|
|
115
114
|
const _types = require("./types");
|
|
116
115
|
const _promisewithresolvers = require("../../../shared/lib/promise-with-resolvers");
|
|
117
116
|
function getStaleTimeMs(staleTimeSeconds) {
|
|
@@ -504,6 +503,12 @@ function upgradeToPendingSegment(emptyEntry, fetchStrategy) {
|
|
|
504
503
|
const pendingEntry = emptyEntry;
|
|
505
504
|
pendingEntry.status = 1;
|
|
506
505
|
pendingEntry.fetchStrategy = fetchStrategy;
|
|
506
|
+
if (fetchStrategy === _types.FetchStrategy.Full) {
|
|
507
|
+
// We can assume the response will contain the full segment data. Set this
|
|
508
|
+
// to false so we know it's OK to omit this segment from any navigation
|
|
509
|
+
// requests that may happen while the data is still pending.
|
|
510
|
+
pendingEntry.isPartial = false;
|
|
511
|
+
}
|
|
507
512
|
// Set the version here, since this is right before the request is initiated.
|
|
508
513
|
// The next time the global cache version is incremented, the entry will
|
|
509
514
|
// effectively be evicted. This happens before initiating the request, rather
|
|
@@ -830,28 +835,36 @@ async function fetchRouteOnCacheMiss(entry, task, key) {
|
|
|
830
835
|
// location, but we shouldn't assume or expect that they also redirect all
|
|
831
836
|
// the segment files, too.
|
|
832
837
|
//
|
|
833
|
-
// To check whether the page is redirected, we perform a range
|
|
834
|
-
//
|
|
835
|
-
//
|
|
838
|
+
// To check whether the page is redirected, previously we perform a range
|
|
839
|
+
// request of 64 bytes of the HTML document to check if the target page
|
|
840
|
+
// is part of this app (by checking if build id matches). Only if the target
|
|
841
|
+
// page is part of this app do we determine the final canonical URL.
|
|
842
|
+
//
|
|
843
|
+
// However, as mentioned in https://github.com/vercel/next.js/pull/85903,
|
|
844
|
+
// some popular static hosting providers (like Cloudflare Pages or Render.com)
|
|
845
|
+
// do not support range requests, in the worst case, the entire HTML instead
|
|
846
|
+
// of 64 bytes could be returned, which is wasteful.
|
|
836
847
|
//
|
|
837
|
-
//
|
|
848
|
+
// So instead, we drops the check for build id here, and simply perform
|
|
849
|
+
// a HEAD request to rejects 1xx/4xx/5xx responses, and then determine the
|
|
850
|
+
// final URL after redirects.
|
|
838
851
|
//
|
|
839
852
|
// NOTE: We could embed the route tree into the HTML document, to avoid
|
|
840
853
|
// a second request. We're not doing that currently because it would make
|
|
841
854
|
// the HTML document larger and affect normal page loads.
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
Range: _outputexportprefetchencoding.DOC_PREFETCH_RANGE_HEADER_VALUE
|
|
845
|
-
}
|
|
855
|
+
const headResponse = await fetch(url, {
|
|
856
|
+
method: 'HEAD'
|
|
846
857
|
});
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
//
|
|
850
|
-
//
|
|
858
|
+
if (headResponse.status < 200 || headResponse.status >= 400) {
|
|
859
|
+
// The target page responded w/o a successful status code
|
|
860
|
+
// Could be a WAF serving a 403, or a 5xx from a backend
|
|
861
|
+
//
|
|
862
|
+
// Note that we can't use headResponse.ok here, because
|
|
863
|
+
// Response#ok returns `false` with 3xx responses.
|
|
851
864
|
rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
|
|
852
865
|
return null;
|
|
853
866
|
}
|
|
854
|
-
urlAfterRedirects =
|
|
867
|
+
urlAfterRedirects = headResponse.redirected ? new URL(headResponse.url) : url;
|
|
855
868
|
response = await fetchPrefetchResponse(addSegmentPathToUrlInOutputExportMode(urlAfterRedirects, segmentPath), headers);
|
|
856
869
|
} else {
|
|
857
870
|
// "Server" mode. We can use request headers instead of the pathname.
|
|
@@ -25,6 +25,8 @@ _export(exports, {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
const _cachemap = require("./cache-map");
|
|
28
|
+
// We use an LRU for memory management. We must update this whenever we add or
|
|
29
|
+
// remove a new cache entry, or when an entry changes size.
|
|
28
30
|
let head = null;
|
|
29
31
|
let didScheduleCleanup = false;
|
|
30
32
|
let lruSize = 0;
|
|
@@ -126,7 +128,7 @@ function cleanup() {
|
|
|
126
128
|
if (tail !== null) {
|
|
127
129
|
// Delete the entry from the map. In turn, this will remove it from
|
|
128
130
|
// the LRU.
|
|
129
|
-
(0, _cachemap.
|
|
131
|
+
(0, _cachemap.deleteMapEntry)(tail);
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
}
|