@vectorize-io/hindsight-control-plane 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/standalone/.next/BUILD_ID +1 -1
- package/standalone/.next/app-path-routes-manifest.json +2 -0
- package/standalone/.next/build-manifest.json +7 -8
- package/standalone/.next/prerender-manifest.json +3 -7
- package/standalone/.next/required-server-files.json +40 -193
- package/standalone/.next/routes-manifest.json +17 -1
- package/standalone/.next/server/app/_global-error/page/build-manifest.json +5 -6
- package/standalone/.next/server/app/_global-error/page.js +2 -2
- package/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/_global-error.html +2 -2
- package/standalone/.next/server/app/_global-error.rsc +8 -8
- package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +8 -8
- package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +4 -6
- package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/standalone/.next/server/app/_not-found/page/build-manifest.json +5 -6
- package/standalone/.next/server/app/_not-found/page.js +2 -2
- package/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/_not-found.html +1 -1
- package/standalone/.next/server/app/_not-found.rsc +12 -12
- package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
- package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +5 -7
- package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +6 -6
- package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/api/banks/[bankId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/banks/[bankId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/banks/[bankId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/banks/[bankId]/route.js +7 -0
- package/standalone/.next/server/app/api/banks/[bankId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/banks/[bankId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/banks/[bankId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/banks/route.js +3 -2
- package/standalone/.next/server/app/api/banks/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/chunks/[chunkId]/route.js +3 -2
- package/standalone/.next/server/app/api/chunks/[chunkId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/documents/[documentId]/route.js +3 -2
- package/standalone/.next/server/app/api/documents/[documentId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/documents/route.js +3 -2
- package/standalone/.next/server/app/api/documents/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js +3 -2
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/entities/[entityId]/route.js +3 -2
- package/standalone/.next/server/app/api/entities/[entityId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/entities/route.js +3 -2
- package/standalone/.next/server/app/api/entities/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/graph/route.js +3 -2
- package/standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/health/route.js +2 -1
- package/standalone/.next/server/app/api/health/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/list/route.js +3 -2
- package/standalone/.next/server/app/api/list/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/memories/[memoryId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/memories/[memoryId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/memories/[memoryId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/memories/[memoryId]/route.js +6 -0
- package/standalone/.next/server/app/api/memories/[memoryId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/memories/[memoryId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/memories/[memoryId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/memories/retain/route.js +3 -2
- package/standalone/.next/server/app/api/memories/retain/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/memories/retain_async/route.js +3 -2
- package/standalone/.next/server/app/api/memories/retain_async/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/operations/[agentId]/route.js +3 -2
- package/standalone/.next/server/app/api/operations/[agentId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/profile/[bankId]/route.js +3 -2
- package/standalone/.next/server/app/api/profile/[bankId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/recall/route.js +3 -2
- package/standalone/.next/server/app/api/recall/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/reflect/route.js +3 -2
- package/standalone/.next/server/app/api/reflect/route.js.nft.json +1 -1
- package/standalone/.next/server/app/api/stats/[agentId]/route.js +3 -2
- package/standalone/.next/server/app/api/stats/[agentId]/route.js.nft.json +1 -1
- package/standalone/.next/server/app/banks/[bankId]/page/build-manifest.json +5 -6
- package/standalone/.next/server/app/banks/[bankId]/page.js +2 -2
- package/standalone/.next/server/app/banks/[bankId]/page.js.nft.json +1 -1
- package/standalone/.next/server/app/banks/[bankId]/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/dashboard/page/build-manifest.json +5 -6
- package/standalone/.next/server/app/dashboard/page.js +2 -2
- package/standalone/.next/server/app/dashboard/page.js.nft.json +1 -1
- package/standalone/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app/dashboard.html +1 -1
- package/standalone/.next/server/app/dashboard.rsc +14 -14
- package/standalone/.next/server/app/dashboard.segments/_full.segment.rsc +14 -14
- package/standalone/.next/server/app/dashboard.segments/_head.segment.rsc +5 -7
- package/standalone/.next/server/app/dashboard.segments/_index.segment.rsc +6 -6
- package/standalone/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +4 -4
- package/standalone/.next/server/app/dashboard.segments/dashboard.segment.rsc +3 -3
- package/standalone/.next/server/app/index.html +1 -1
- package/standalone/.next/server/app/index.rsc +12 -12
- package/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/standalone/.next/server/app/index.segments/_full.segment.rsc +12 -12
- package/standalone/.next/server/app/index.segments/_head.segment.rsc +5 -7
- package/standalone/.next/server/app/index.segments/_index.segment.rsc +6 -6
- package/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/standalone/.next/server/app/page/build-manifest.json +5 -6
- package/standalone/.next/server/app/page.js +3 -3
- package/standalone/.next/server/app/page.js.nft.json +1 -1
- package/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/standalone/.next/server/app-paths-manifest.json +2 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__116b0d31._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__296b95db._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__356491b1._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__37560d9a._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__478d7304._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__51072426._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__517fcb62._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__57dac9c2._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__6872cebd._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__687469c1._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__71e0e3b9._.js +21 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__8241ce67._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__85fada80._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__9a7529ab._.js +1 -1
- package/standalone/.next/server/chunks/[root-of-the-server]__9af3dcb2._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__ab5df0f3._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__b9387f6f._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__e4e9fd7e._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__ef34dcbb._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__fd2d4ac3._.js +3 -0
- package/standalone/.next/server/chunks/[turbopack]_runtime.js +32 -7
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_banks_[bankId]_route_actions_e35b026c.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_memories_[memoryId]_route_actions_461fd16c.js +3 -0
- package/standalone/.next/server/chunks/hindsight-clients_typescript_dist_79330c4c._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__3f6f18bb._.js +1 -1
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__655f8d11._.js +6 -2
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__8dd83d7a._.js +1 -1
- package/standalone/.next/server/chunks/ssr/[turbopack]_runtime.js +32 -7
- package/standalone/.next/server/chunks/ssr/_04b70dca._.js +6 -0
- package/standalone/.next/server/chunks/ssr/_26df66d0._.js +2 -2
- package/standalone/.next/server/chunks/ssr/_407ede86._.js +9 -0
- package/standalone/.next/server/chunks/ssr/_53a4aa41._.js +2 -2
- package/standalone/.next/server/chunks/ssr/_6f1a7a53._.js +6 -0
- package/standalone/.next/server/chunks/ssr/_944e56a6._.js +2 -2
- package/standalone/.next/server/chunks/ssr/_e3307836._.js +9 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_fe96d618._.js +1 -1
- package/standalone/.next/server/chunks/ssr/node_modules_256e9ddd._.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_08570d7f._.js +2 -2
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_4b9a0874._.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_89742413.js +2 -2
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_eedfc1fd._.js +6 -0
- package/standalone/.next/server/middleware-build-manifest.js +5 -6
- package/standalone/.next/server/pages/404.html +1 -1
- package/standalone/.next/server/pages/500.html +2 -2
- package/standalone/.next/server/server-reference-manifest.js +1 -1
- package/standalone/.next/server/server-reference-manifest.json +1 -1
- package/standalone/.next/static/chunks/068dff78c3e35897.css +2 -0
- package/standalone/.next/static/chunks/30ea11065999f7ac.js +1 -0
- package/standalone/.next/static/chunks/5777bc08048e2edc.js +4 -0
- package/standalone/.next/static/chunks/5d60d221a60086fb.js +1 -0
- package/standalone/.next/static/chunks/7340adf74ff47ec0.js +1 -0
- package/standalone/.next/static/chunks/8ca05de898c11578.js +1 -0
- package/standalone/.next/static/chunks/9b12d8cc6a26cbbc.js +7 -0
- package/standalone/.next/static/chunks/a6dad97d9634a72d.js.map +1 -0
- package/standalone/.next/static/chunks/c1c4c028479eeb7d.js +7 -0
- package/standalone/.next/static/chunks/eef1ea5ced749e04.js +2 -0
- package/standalone/.next/static/chunks/f37acefc5ba19606.js +1 -0
- package/standalone/.next/static/chunks/turbopack-59d7bb1a28984373.js +4 -0
- package/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +46 -0
- package/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +221 -0
- package/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +1 -0
- package/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +42 -0
- package/standalone/node_modules/@img/sharp-libvips-linux-x64/versions.json +30 -0
- package/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +46 -0
- package/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +221 -0
- package/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +1 -0
- package/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +42 -0
- package/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +30 -0
- package/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/standalone/node_modules/@img/sharp-linux-x64/package.json +46 -0
- package/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
- package/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +46 -0
- package/standalone/node_modules/@next/env/package.json +4 -4
- package/standalone/node_modules/next/dist/build/analyze/index.js +242 -0
- package/standalone/node_modules/next/dist/build/define-env.js +22 -13
- package/standalone/node_modules/next/dist/build/entries.js +5 -5
- package/standalone/node_modules/next/dist/build/generate-routes-manifest.js +91 -0
- package/standalone/node_modules/next/dist/build/index.js +172 -223
- package/standalone/node_modules/next/dist/build/output/log.js +4 -7
- package/standalone/node_modules/next/dist/build/segment-config/app/app-segments.js +23 -99
- package/standalone/node_modules/next/dist/build/segment-config/app/collect-root-param-keys.js +3 -3
- package/standalone/node_modules/next/dist/build/spinner.js +3 -3
- package/standalone/node_modules/next/dist/build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree.js +137 -0
- package/standalone/node_modules/next/dist/build/static-paths/app.js +69 -210
- package/standalone/node_modules/next/dist/build/static-paths/utils.js +83 -11
- package/standalone/node_modules/next/dist/build/swc/index.js +10 -6
- package/standalone/node_modules/next/dist/build/templates/app-page.js +21 -14
- package/standalone/node_modules/next/dist/build/templates/app-route.js +8 -10
- package/standalone/node_modules/next/dist/build/templates/edge-app-route.js +7 -10
- package/standalone/node_modules/next/dist/build/templates/edge-ssr-app.js +16 -20
- package/standalone/node_modules/next/dist/build/templates/edge-ssr.js +20 -14
- package/standalone/node_modules/next/dist/build/templates/edge-wrapper.js +24 -0
- package/standalone/node_modules/next/dist/build/templates/middleware.js +7 -6
- package/standalone/node_modules/next/dist/build/templates/pages-edge-api.js +3 -2
- package/standalone/node_modules/next/dist/build/turbopack-analyze/index.js +116 -0
- package/standalone/node_modules/next/dist/build/turbopack-build/impl.js +2 -1
- package/standalone/node_modules/next/dist/build/type-check.js +7 -8
- package/standalone/node_modules/next/dist/build/utils.js +45 -4
- package/standalone/node_modules/next/dist/build/validate-app-paths.js +242 -0
- package/standalone/node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js +20 -2
- package/standalone/node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js +2 -5
- package/standalone/node_modules/next/dist/build/webpack/loaders/next-edge-ssr-loader/index.js +4 -11
- package/standalone/node_modules/next/dist/build/webpack/loaders/next-root-params-loader.js +1 -1
- package/standalone/node_modules/next/dist/build/webpack/plugins/flight-manifest-plugin.js +1 -1
- package/standalone/node_modules/next/dist/build/webpack/plugins/middleware-plugin.js +3 -0
- package/standalone/node_modules/next/dist/build/webpack-build/impl.js +1 -0
- package/standalone/node_modules/next/dist/build/webpack-config.js +35 -3
- package/standalone/node_modules/next/dist/cli/next-test.js +3 -5
- package/standalone/node_modules/next/dist/client/components/app-router-headers.js +5 -0
- package/standalone/node_modules/next/dist/client/components/app-router-instance.js +3 -11
- package/standalone/node_modules/next/dist/client/components/app-router.js +8 -28
- package/standalone/node_modules/next/dist/client/components/navigation-devtools.js +5 -7
- package/standalone/node_modules/next/dist/client/components/navigation.js +4 -3
- package/standalone/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +3 -22
- package/standalone/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +6 -18
- package/standalone/node_modules/next/dist/client/components/router-reducer/ppr-navigations.js +844 -590
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/hmr-refresh-reducer.js +4 -76
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +21 -18
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +48 -85
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +25 -10
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +126 -113
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +30 -39
- package/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer-types.js +0 -1
- package/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer.js +2 -2
- package/standalone/node_modules/next/dist/client/components/segment-cache/cache-map.js +13 -18
- package/standalone/node_modules/next/dist/client/components/segment-cache/cache.js +27 -14
- package/standalone/node_modules/next/dist/client/components/segment-cache/lru.js +3 -1
- package/standalone/node_modules/next/dist/client/components/segment-cache/navigation.js +176 -133
- package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +12 -12
- package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +12 -12
- package/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +3 -3
- package/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +10 -10
- package/standalone/node_modules/next/dist/compiled/react-is/package.json +1 -1
- package/standalone/node_modules/next/dist/lib/build-custom-route.js +4 -4
- package/standalone/node_modules/next/dist/lib/constants.js +0 -5
- package/standalone/node_modules/next/dist/lib/generate-interception-routes-rewrites.js +0 -1
- package/standalone/node_modules/next/dist/lib/helpers/get-npx-command.js +3 -3
- package/standalone/node_modules/next/dist/lib/inline-static-env.js +1 -1
- package/standalone/node_modules/next/dist/lib/metadata/metadata.js +17 -11
- package/standalone/node_modules/next/dist/lib/needs-experimental-react.js +2 -2
- package/standalone/node_modules/next/dist/lib/resolve-build-paths.js +44 -76
- package/standalone/node_modules/next/dist/lib/server-external-packages.jsonc +103 -0
- package/standalone/node_modules/next/dist/lib/static-env.js +6 -6
- package/standalone/node_modules/next/dist/lib/turbopack-warning.js +3 -5
- package/standalone/node_modules/next/dist/lib/typescript/runTypeCheck.js +61 -5
- package/standalone/node_modules/next/dist/lib/typescript/type-paths.js +56 -0
- package/standalone/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js +6 -17
- package/standalone/node_modules/next/dist/lib/verify-typescript-setup.js +10 -2
- package/standalone/node_modules/next/dist/lib/worker.js +17 -9
- package/standalone/node_modules/next/dist/server/app-render/action-handler.js +113 -77
- package/standalone/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +36 -15
- package/standalone/node_modules/next/dist/server/app-render/app-render-render-utils.js +36 -15
- package/standalone/node_modules/next/dist/server/app-render/app-render-scheduling.js +188 -0
- package/standalone/node_modules/next/dist/server/app-render/app-render.js +804 -748
- package/standalone/node_modules/next/dist/server/app-render/collect-segment-data.js +8 -2
- package/standalone/node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js +1 -1
- package/standalone/node_modules/next/dist/server/app-render/create-error-handler.js +42 -75
- package/standalone/node_modules/next/dist/server/app-render/dynamic-rendering.js +127 -14
- package/standalone/node_modules/next/dist/server/app-render/encryption-utils.js +3 -108
- package/standalone/node_modules/next/dist/server/app-render/encryption.js +4 -3
- package/standalone/node_modules/next/dist/server/app-render/flight-render-result.js +3 -2
- package/standalone/node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js +9 -8
- package/standalone/node_modules/next/dist/server/app-render/get-layer-assets.js +1 -1
- package/standalone/node_modules/next/dist/server/app-render/manifests-singleton.js +257 -0
- package/standalone/node_modules/next/dist/server/app-render/prospective-render-utils.js +25 -8
- package/standalone/node_modules/next/dist/server/app-render/staged-rendering.js +161 -15
- package/standalone/node_modules/next/dist/server/app-render/use-flight-response.js +67 -20
- package/standalone/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +2 -2
- package/standalone/node_modules/next/dist/server/async-storage/work-store.js +2 -1
- package/standalone/node_modules/next/dist/server/base-server.js +32 -23
- package/standalone/node_modules/next/dist/server/config-schema.js +8 -1
- package/standalone/node_modules/next/dist/server/config-shared.js +83 -2
- package/standalone/node_modules/next/dist/server/config.js +24 -17
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-rspack.js +171 -0
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +37 -25
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-types.js +1 -0
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +62 -57
- package/standalone/node_modules/next/dist/server/dev/log-requests.js +11 -3
- package/standalone/node_modules/next/dist/server/dev/messages.js +10 -0
- package/standalone/node_modules/next/dist/server/dev/serialized-errors.js +67 -0
- package/standalone/node_modules/next/dist/server/dev/static-paths-worker.js +10 -0
- package/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/standalone/node_modules/next/dist/server/lib/chrome-devtools-workspace.js +2 -2
- package/standalone/node_modules/next/dist/server/lib/dev-bundler-service.js +6 -10
- package/standalone/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +4 -4
- package/standalone/node_modules/next/dist/server/lib/lazy-result.js +1 -1
- package/standalone/node_modules/next/dist/server/lib/patch-fetch.js +9 -9
- package/standalone/node_modules/next/dist/server/lib/router-server.js +43 -29
- package/standalone/node_modules/next/dist/server/lib/router-utils/build-prefetch-segment-data-route.js +0 -21
- package/standalone/node_modules/next/dist/server/lib/router-utils/filesystem.js +2 -7
- package/standalone/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +8 -4
- package/standalone/node_modules/next/dist/server/lib/start-server.js +3 -3
- package/standalone/node_modules/next/dist/server/lib/trace/tracer.js +4 -0
- package/standalone/node_modules/next/dist/server/load-components.js +3 -9
- package/standalone/node_modules/next/dist/server/next-server.js +19 -18
- package/standalone/node_modules/next/dist/server/next.js +1 -1
- package/standalone/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +570 -0
- package/standalone/node_modules/next/dist/server/node-environment-extensions/utils.js +60 -3
- package/standalone/node_modules/next/dist/server/node-environment.js +1 -0
- package/standalone/node_modules/next/dist/server/patch-error-inspect.js +7 -4
- package/standalone/node_modules/next/dist/server/request/fallback-params.js +23 -66
- package/standalone/node_modules/next/dist/server/route-modules/app-route/module.js +2 -2
- package/standalone/node_modules/next/dist/server/route-modules/pages/pages-handler.js +6 -3
- package/standalone/node_modules/next/dist/server/route-modules/route-module.js +79 -18
- package/standalone/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +28 -4
- package/standalone/node_modules/next/dist/server/typescript/rules/config.js +50 -6
- package/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +68 -23
- package/standalone/node_modules/next/dist/server/web/edge-route-module-wrapper.js +7 -5
- package/standalone/node_modules/next/dist/server/web/sandbox/context.js +8 -9
- package/standalone/node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js +2 -1
- package/standalone/node_modules/next/dist/server/web/spec-extension/revalidate.js +7 -3
- package/standalone/node_modules/next/dist/shared/lib/action-revalidation-kind.js +31 -0
- package/standalone/node_modules/next/dist/shared/lib/constants.js +6 -1
- package/standalone/node_modules/next/dist/shared/lib/deployment-id.js +36 -0
- package/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/standalone/node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js +5 -0
- package/standalone/node_modules/next/dist/shared/lib/router/routes/app.js +122 -0
- package/standalone/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +20 -49
- package/standalone/node_modules/next/dist/shared/lib/router/utils/get-segment-param.js +6 -6
- package/standalone/node_modules/next/dist/shared/lib/router/utils/interception-prefix-from-param-type.js +33 -0
- package/standalone/node_modules/next/dist/shared/lib/router/utils/resolve-param-value.js +116 -0
- package/standalone/node_modules/next/dist/shared/lib/segment-cache/output-export-prefetch-encoding.js +3 -24
- package/standalone/node_modules/next/dist/shared/lib/segment.js +5 -0
- package/standalone/node_modules/next/dist/shared/lib/turbopack/utils.js +6 -5
- package/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/standalone/node_modules/next/dist/telemetry/events/build.js +11 -0
- package/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/standalone/node_modules/next/package.json +20 -18
- package/standalone/node_modules/react/cjs/react.production.js +1 -1
- package/standalone/node_modules/react/package.json +1 -1
- package/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1 -1
- package/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1 -1
- package/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +3 -3
- package/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +3 -3
- package/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +3 -3
- package/standalone/node_modules/react-dom/cjs/react-dom.production.js +1 -1
- package/standalone/node_modules/react-dom/package.json +2 -2
- package/standalone/package.json +1 -1
- package/standalone/server.js +1 -1
- package/standalone/.next/server/chunks/[root-of-the-server]__02a1e7f7._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__0f1b189c._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__228c769f._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__317b54d0._.js +0 -21
- package/standalone/.next/server/chunks/[root-of-the-server]__464d3847._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__5e1d146d._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__6ee44ea3._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__73093267._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__81c0d784._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__9c3dd746._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__bae0f53c._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__be9afc00._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__d2485edb._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__d4b39930._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__d4f9d631._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__e5a6b81d._.js +0 -3
- package/standalone/.next/server/chunks/[root-of-the-server]__f318615b._.js +0 -3
- package/standalone/.next/server/chunks/ssr/_3476210c._.js +0 -6
- package/standalone/.next/server/chunks/ssr/_5e906836._.js +0 -9
- package/standalone/.next/server/chunks/ssr/_8362f37b._.js +0 -6
- package/standalone/.next/server/chunks/ssr/_e8cbc2be._.js +0 -9
- package/standalone/.next/server/chunks/ssr/node_modules_5363a9de._.js +0 -3
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_cc88faaa._.js +0 -3
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_3fe9760a._.js +0 -6
- package/standalone/.next/static/chunks/023d923a37d494fc.js +0 -1
- package/standalone/.next/static/chunks/0e1b9f3295e06ab1.js +0 -1
- package/standalone/.next/static/chunks/0e662c07abb2cacd.js +0 -1
- package/standalone/.next/static/chunks/247eb132b7f7b574.js +0 -1
- package/standalone/.next/static/chunks/497f7b5edc7d3fce.js +0 -1
- package/standalone/.next/static/chunks/4a2e6ca9bc162ffe.js +0 -4
- package/standalone/.next/static/chunks/9bc5002cc495aadf.js +0 -7
- package/standalone/.next/static/chunks/9eef728357965f0b.js +0 -7
- package/standalone/.next/static/chunks/c0409be3e0eda16b.js +0 -1
- package/standalone/.next/static/chunks/d0cdc56d06040c69.js +0 -2
- package/standalone/.next/static/chunks/f3b9062eed4c1661.css +0 -2
- package/standalone/.next/static/chunks/turbopack-030018f439265ea0.js +0 -3
- package/standalone/node_modules/next/dist/build/deployment-id.js +0 -18
- package/standalone/node_modules/next/dist/client/components/router-reducer/apply-flight-data.js +0 -53
- package/standalone/node_modules/next/dist/client/components/router-reducer/apply-router-state-patch-to-tree.js +0 -105
- package/standalone/node_modules/next/dist/client/components/router-reducer/fill-cache-with-new-subtree-data.js +0 -110
- package/standalone/node_modules/next/dist/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.js +0 -131
- package/standalone/node_modules/next/dist/client/components/router-reducer/handle-segment-mismatch.js +0 -25
- package/standalone/node_modules/next/dist/client/components/router-reducer/invalidate-cache-by-router-state.js +0 -32
- package/standalone/node_modules/next/dist/client/components/router-reducer/refetch-inactive-parallel-segments.js +0 -104
- package/standalone/node_modules/next/dist/lib/server-external-packages.json +0 -75
- package/standalone/node_modules/next/dist/server/app-render/action-utils.js +0 -90
- package/standalone/node_modules/next/dist/server/normalizers/request/prefetch-rsc.js +0 -31
- /package/standalone/.next/static/{49bdaGRmDVYO0WSBsNFA3 → FoyZVJhqn8jToZ2jQdT4e}/_buildManifest.js +0 -0
- /package/standalone/.next/static/{49bdaGRmDVYO0WSBsNFA3 → FoyZVJhqn8jToZ2jQdT4e}/_clientMiddlewareManifest.json +0 -0
- /package/standalone/.next/static/{49bdaGRmDVYO0WSBsNFA3 → FoyZVJhqn8jToZ2jQdT4e}/_ssgManifest.js +0 -0
|
@@ -370,13 +370,14 @@ class NextNodeServer extends _baseserver.default {
|
|
|
370
370
|
});
|
|
371
371
|
if (handled) return true;
|
|
372
372
|
} catch (apiError) {
|
|
373
|
+
const silenceLog = false;
|
|
373
374
|
await this.instrumentationOnRequestError(apiError, req, {
|
|
374
375
|
routePath: match.definition.page,
|
|
375
376
|
routerKind: 'Pages Router',
|
|
376
377
|
routeType: 'route',
|
|
377
378
|
// Edge runtime does not support ISR
|
|
378
379
|
revalidateReason: undefined
|
|
379
|
-
});
|
|
380
|
+
}, silenceLog);
|
|
380
381
|
throw apiError;
|
|
381
382
|
}
|
|
382
383
|
}
|
|
@@ -509,7 +510,6 @@ class NextNodeServer extends _baseserver.default {
|
|
|
509
510
|
if (this.renderOpts.nextScriptWorkers) {
|
|
510
511
|
process.env.__NEXT_SCRIPT_WORKERS = JSON.stringify(true);
|
|
511
512
|
}
|
|
512
|
-
process.env.NEXT_DEPLOYMENT_ID = this.nextConfig.experimental.useSkewCookie ? '' : this.nextConfig.deploymentId || '';
|
|
513
513
|
if (!this.minimalMode) {
|
|
514
514
|
this.imageResponseCache = new _responsecache.default(this.minimalMode);
|
|
515
515
|
}
|
|
@@ -551,7 +551,7 @@ class NextNodeServer extends _baseserver.default {
|
|
|
551
551
|
// when using compile mode static env isn't inlined so we
|
|
552
552
|
// need to populate in normal runtime env
|
|
553
553
|
if (this.renderOpts.isExperimentalCompile) {
|
|
554
|
-
(0, _staticenv.populateStaticEnv)(this.nextConfig);
|
|
554
|
+
(0, _staticenv.populateStaticEnv)(this.nextConfig, this.renderOpts.deploymentId || '');
|
|
555
555
|
}
|
|
556
556
|
const shouldRemoveUncaughtErrorAndRejectionListeners = Boolean((_options_conf_experimental1 = options.conf.experimental) == null ? void 0 : _options_conf_experimental1.removeUncaughtErrorAndRejectionListeners);
|
|
557
557
|
installProcessErrorHandlers(shouldRemoveUncaughtErrorAndRejectionListeners);
|
|
@@ -665,9 +665,6 @@ class NextNodeServer extends _baseserver.default {
|
|
|
665
665
|
CurCacheHandler: CacheHandler
|
|
666
666
|
});
|
|
667
667
|
}
|
|
668
|
-
getResponseCache() {
|
|
669
|
-
return new _responsecache.default(this.minimalMode);
|
|
670
|
-
}
|
|
671
668
|
getPublicDir() {
|
|
672
669
|
return (0, _path.join)(/* turbopackIgnore: true */ this.dir, _constants.CLIENT_PUBLIC_FILES_PATH);
|
|
673
670
|
}
|
|
@@ -774,18 +771,19 @@ class NextNodeServer extends _baseserver.default {
|
|
|
774
771
|
null, renderOpts, this.getServerComponentsHmrCache(), {
|
|
775
772
|
buildId: this.buildId
|
|
776
773
|
});
|
|
774
|
+
} else {
|
|
775
|
+
// TODO: re-enable this once we've refactored to use implicit matches
|
|
776
|
+
// throw new Error('Invariant: render should have used routeModule')
|
|
777
|
+
return (0, _modulerender1.lazyRenderPagesPage)(req.originalRequest, res.originalResponse, pathname, query, renderOpts, {
|
|
778
|
+
buildId: this.buildId,
|
|
779
|
+
deploymentId: this.renderOpts.deploymentId,
|
|
780
|
+
customServer: this.serverOptions.customServer || undefined
|
|
781
|
+
}, {
|
|
782
|
+
isFallback: false,
|
|
783
|
+
isDraftMode: renderOpts.isDraftMode,
|
|
784
|
+
developmentNotFoundSourcePage: (0, _requestmeta.getRequestMeta)(req, 'developmentNotFoundSourcePage')
|
|
785
|
+
});
|
|
777
786
|
}
|
|
778
|
-
// TODO: re-enable this once we've refactored to use implicit matches
|
|
779
|
-
// throw new Error('Invariant: render should have used routeModule')
|
|
780
|
-
return (0, _modulerender1.lazyRenderPagesPage)(req.originalRequest, res.originalResponse, pathname, query, renderOpts, {
|
|
781
|
-
buildId: this.buildId,
|
|
782
|
-
deploymentId: this.nextConfig.deploymentId,
|
|
783
|
-
customServer: this.serverOptions.customServer || undefined
|
|
784
|
-
}, {
|
|
785
|
-
isFallback: false,
|
|
786
|
-
isDraftMode: renderOpts.isDraftMode,
|
|
787
|
-
developmentNotFoundSourcePage: (0, _requestmeta.getRequestMeta)(req, 'developmentNotFoundSourcePage')
|
|
788
|
-
});
|
|
789
787
|
}
|
|
790
788
|
}
|
|
791
789
|
async imageOptimizer(req, res, paramsResult, previousCacheEntry) {
|
|
@@ -1425,7 +1423,10 @@ class NextNodeServer extends _baseserver.default {
|
|
|
1425
1423
|
await super.instrumentationOnRequestError(...args);
|
|
1426
1424
|
// For Node.js runtime production logs, in dev it will be overridden by next-dev-server
|
|
1427
1425
|
if (!this.renderOpts.dev) {
|
|
1428
|
-
|
|
1426
|
+
const [err, , , silenceLog] = args;
|
|
1427
|
+
if (!silenceLog) {
|
|
1428
|
+
this.logError(err);
|
|
1429
|
+
}
|
|
1429
1430
|
}
|
|
1430
1431
|
}
|
|
1431
1432
|
onServerClose(listener) {
|
|
@@ -208,7 +208,7 @@ class NextServer {
|
|
|
208
208
|
// check serialized build config when available
|
|
209
209
|
if (!this.options.dev) {
|
|
210
210
|
try {
|
|
211
|
-
const serializedConfig = require(/* turbopackIgnore: true */ _nodepath.default.join(/* turbopackIgnore: true */ dir, config.distDir, _constants1.SERVER_FILES_MANIFEST)).config;
|
|
211
|
+
const serializedConfig = require(/* turbopackIgnore: true */ _nodepath.default.join(/* turbopackIgnore: true */ dir, config.distDir, _constants1.SERVER_FILES_MANIFEST + '.json')).config;
|
|
212
212
|
config.experimental.isExperimentalCompile = serializedConfig.experimental.isExperimentalCompile;
|
|
213
213
|
} catch (_) {
|
|
214
214
|
// if distDir is customized we don't know until we
|
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
DANGEROUSLY_runPendingImmediatesAfterCurrentTask: null,
|
|
7
|
+
expectNoPendingImmediates: null,
|
|
8
|
+
unpatchedSetImmediate: null
|
|
9
|
+
});
|
|
10
|
+
function _export(target, all) {
|
|
11
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: all[name]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
_export(exports, {
|
|
17
|
+
DANGEROUSLY_runPendingImmediatesAfterCurrentTask: function() {
|
|
18
|
+
return DANGEROUSLY_runPendingImmediatesAfterCurrentTask;
|
|
19
|
+
},
|
|
20
|
+
expectNoPendingImmediates: function() {
|
|
21
|
+
return expectNoPendingImmediates;
|
|
22
|
+
},
|
|
23
|
+
unpatchedSetImmediate: function() {
|
|
24
|
+
return originalSetImmediate;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const _nodeutil = require("node:util");
|
|
28
|
+
const _invarianterror = require("../../shared/lib/invariant-error");
|
|
29
|
+
const _asynclocalstorage = require("../app-render/async-local-storage");
|
|
30
|
+
var ExecutionState = /*#__PURE__*/ function(ExecutionState) {
|
|
31
|
+
ExecutionState[ExecutionState["Waiting"] = 1] = "Waiting";
|
|
32
|
+
ExecutionState[ExecutionState["Working"] = 2] = "Working";
|
|
33
|
+
ExecutionState[ExecutionState["Finished"] = 3] = "Finished";
|
|
34
|
+
ExecutionState[ExecutionState["Abandoned"] = 4] = "Abandoned";
|
|
35
|
+
return ExecutionState;
|
|
36
|
+
}(ExecutionState || {});
|
|
37
|
+
let wasEnabledAtLeastOnce = false;
|
|
38
|
+
let pendingNextTicks = 0;
|
|
39
|
+
let currentExecution = null;
|
|
40
|
+
const originalSetImmediate = globalThis.setImmediate;
|
|
41
|
+
const originalClearImmediate = globalThis.clearImmediate;
|
|
42
|
+
const originalNextTick = process.nextTick;
|
|
43
|
+
function install() {
|
|
44
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
45
|
+
// Nothing to patch. The exported functions all error if used in the edge runtime,
|
|
46
|
+
// so we're not going to violate any assumptions by not patching.
|
|
47
|
+
return;
|
|
48
|
+
} else {
|
|
49
|
+
debug == null ? void 0 : debug('installing fast setImmediate patch');
|
|
50
|
+
const nodeTimers = require('node:timers');
|
|
51
|
+
globalThis.setImmediate = nodeTimers.setImmediate = // Workaround for missing __promisify__ which is not a real property
|
|
52
|
+
patchedSetImmediate;
|
|
53
|
+
globalThis.clearImmediate = nodeTimers.clearImmediate = patchedClearImmediate;
|
|
54
|
+
const nodeTimersPromises = require('node:timers/promises');
|
|
55
|
+
nodeTimersPromises.setImmediate = patchedSetImmediatePromise;
|
|
56
|
+
process.nextTick = patchedNextTick;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function DANGEROUSLY_runPendingImmediatesAfterCurrentTask() {
|
|
60
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
61
|
+
throw Object.defineProperty(new _invarianterror.InvariantError('DANGEROUSLY_runPendingImmediatesAfterCurrentTask cannot be called in the edge runtime'), "__NEXT_ERROR_CODE", {
|
|
62
|
+
value: "E960",
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
const execution = startCapturingImmediates();
|
|
68
|
+
try {
|
|
69
|
+
scheduleWorkAfterNextTicksAndMicrotasks(execution);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
// If this error comes from a bail() call, rethrow it.
|
|
72
|
+
if (execution.state === 4) {
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
// Otherwise, bail out here.
|
|
76
|
+
bail(execution, Object.defineProperty(new _invarianterror.InvariantError('An unexpected error occurred while starting to capture immediates', {
|
|
77
|
+
cause: err
|
|
78
|
+
}), "__NEXT_ERROR_CODE", {
|
|
79
|
+
value: "E964",
|
|
80
|
+
enumerable: false,
|
|
81
|
+
configurable: true
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function expectNoPendingImmediates() {
|
|
87
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
88
|
+
throw Object.defineProperty(new _invarianterror.InvariantError('expectNoPendingImmediates cannot be called in the edge runtime'), "__NEXT_ERROR_CODE", {
|
|
89
|
+
value: "E962",
|
|
90
|
+
enumerable: false,
|
|
91
|
+
configurable: true
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
if (currentExecution !== null) {
|
|
95
|
+
bail(currentExecution, Object.defineProperty(new _invarianterror.InvariantError(`Expected all captured immediates to have been executed (state: ${ExecutionState[currentExecution.state]})`), "__NEXT_ERROR_CODE", {
|
|
96
|
+
value: "E958",
|
|
97
|
+
enumerable: false,
|
|
98
|
+
configurable: true
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Wait until all nextTicks and microtasks spawned from the current task are done,
|
|
105
|
+
* then execute any immediates that they queued.
|
|
106
|
+
* */ function scheduleWorkAfterNextTicksAndMicrotasks(execution) {
|
|
107
|
+
if (execution.state !== 1) {
|
|
108
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`scheduleWorkAfterTicksAndMicrotasks can only be called while waiting (state: ${ExecutionState[execution.state]})`), "__NEXT_ERROR_CODE", {
|
|
109
|
+
value: "E959",
|
|
110
|
+
enumerable: false,
|
|
111
|
+
configurable: true
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// We want to execute "fast immediates" after all the nextTicks and microtasks
|
|
115
|
+
// spawned from the current task are done.
|
|
116
|
+
// The ordering here is:
|
|
117
|
+
//
|
|
118
|
+
// 1. sync code
|
|
119
|
+
// 2. process.nextTick (scheduled from sync code, or from one of these nextTicks)
|
|
120
|
+
// 3. microtasks
|
|
121
|
+
// 4. process.nextTick (scheduled from microtasks, e.g. `queueMicrotask(() => process.nextTick(callback))`)
|
|
122
|
+
//
|
|
123
|
+
// We want to run to run in step 4, because that's the latest point before the next tick.
|
|
124
|
+
// However, there might also be other callbacks scheduled to run in that step.
|
|
125
|
+
// But importantly, they had to be scheduled using a `process.nextTick`,
|
|
126
|
+
// so we can detect them by checking if `pendingNextTicks > 0`.
|
|
127
|
+
// In that case, we'll just reschedule ourselves in the same way again to let them run first.
|
|
128
|
+
// (this process can theoretically repeat multiple times, hence the recursion).
|
|
129
|
+
queueMicrotask(()=>{
|
|
130
|
+
// (note that this call won't increment `pendingNextTicks`,
|
|
131
|
+
// only the patched `process.nextTick` does that, so this won't loop infinitely)
|
|
132
|
+
originalNextTick(()=>{
|
|
133
|
+
// We're now in a nextTick, which means that we're executing inside `processTicksAndRejections`:
|
|
134
|
+
// https://github.com/nodejs/node/blob/d546e7fd0bc3cbb4bcc2baae6f3aa44d2e81a413/lib/internal/process/task_queues.js#L84
|
|
135
|
+
// All the work scheduled here will happen within that `processTicksAndRejections` loop.
|
|
136
|
+
// Reading the source of `processTicksAndRejections` can help understand the timing here --
|
|
137
|
+
// All we're really doing is strategically pushing callbacks into the two queues
|
|
138
|
+
// (nextTicks and microtasks) that that function is currently looping over.
|
|
139
|
+
try {
|
|
140
|
+
if (execution.state === 4 || currentExecution !== execution) {
|
|
141
|
+
debug == null ? void 0 : debug(`scheduler :: the execution was abandoned`);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (pendingNextTicks > 0) {
|
|
145
|
+
// Other nextTicks have been scheduled. Let those run first, then try again --
|
|
146
|
+
// we're simulating a event loop task, so all nextTicks should be exhausted before we execute.
|
|
147
|
+
debug == null ? void 0 : debug(`scheduler :: yielding to ${pendingNextTicks} nextTicks`);
|
|
148
|
+
return scheduleWorkAfterNextTicksAndMicrotasks(execution);
|
|
149
|
+
}
|
|
150
|
+
// There's no other nextTicks, we're the last one, so we're about to move on to the next task (likely a timer).
|
|
151
|
+
// Now, we can try and execute any queued immediates.
|
|
152
|
+
return performWork(execution);
|
|
153
|
+
} catch (err) {
|
|
154
|
+
// If this error comes from a bail() call, rethrow it.
|
|
155
|
+
// typescript can't tell that the state might've been mutated
|
|
156
|
+
// and the narrowing from above is no longer valid
|
|
157
|
+
const executionAfterWork = execution;
|
|
158
|
+
if (executionAfterWork.state === 4) {
|
|
159
|
+
throw err;
|
|
160
|
+
}
|
|
161
|
+
// Otherwise, bail out here (which will trigger an uncaught exception)
|
|
162
|
+
// Note that we're using the same microtask trick as `safelyRunNextTickCallback`.
|
|
163
|
+
queueMicrotask(()=>{
|
|
164
|
+
bail(execution, Object.defineProperty(new _invarianterror.InvariantError('An unexpected error occurred while executing immediates', {
|
|
165
|
+
cause: err
|
|
166
|
+
}), "__NEXT_ERROR_CODE", {
|
|
167
|
+
value: "E955",
|
|
168
|
+
enumerable: false,
|
|
169
|
+
configurable: true
|
|
170
|
+
}));
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/** Execute one immediate, and schedule a check for more (in case there's others in the queue) */ function performWork(execution) {
|
|
177
|
+
if (execution.state === 4) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
debug == null ? void 0 : debug(`scheduler :: performing work`);
|
|
181
|
+
if (execution.state !== 1) {
|
|
182
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`performWork can only be called while waiting (state: ${ExecutionState[execution.state]})`), "__NEXT_ERROR_CODE", {
|
|
183
|
+
value: "E956",
|
|
184
|
+
enumerable: false,
|
|
185
|
+
configurable: true
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
execution.state = 2;
|
|
189
|
+
const queueItem = takeNextActiveQueueItem(execution);
|
|
190
|
+
if (queueItem === null) {
|
|
191
|
+
debug == null ? void 0 : debug(`scheduler :: no immediates queued, exiting`);
|
|
192
|
+
stopCapturingImmediates(execution);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
debug == null ? void 0 : debug(`scheduler :: executing queued immediate`);
|
|
196
|
+
const { immediateObject, callback, args } = queueItem;
|
|
197
|
+
immediateObject[INTERNALS].queueItem = null;
|
|
198
|
+
clearQueueItem(queueItem);
|
|
199
|
+
// Execute the immediate.
|
|
200
|
+
// If a sync error was thrown in the immediate, we want to trigger a `uncaughtException`.
|
|
201
|
+
// However, we're executing in a nextTick, and if a nextTick callback errors,
|
|
202
|
+
// It'll break out of `processTicksAndRejections` (note the lack of a `catch` block):
|
|
203
|
+
// https://github.com/nodejs/node/blob/d546e7fd0bc3cbb4bcc2baae6f3aa44d2e81a413/lib/internal/process/task_queues.js#L81-L97
|
|
204
|
+
// Meaning that the event loop will stop executing nextTicks and move on to the next timer
|
|
205
|
+
// (or other phase of the event loop, but we expect to be running in a sequence of timers here).
|
|
206
|
+
// Then, the remaining ticks will run after that timer, since they're still in the queue.
|
|
207
|
+
//
|
|
208
|
+
// This would completely break the timing we're trying to achieve here --
|
|
209
|
+
// The point of this patch is to execute immediates before the next timer!
|
|
210
|
+
// So, we need to work around this behavior. (both here and in our `process.nextTick` patch).
|
|
211
|
+
//
|
|
212
|
+
// We can sidestep this by catching the synchronous error and rethrowing it in a microtask.
|
|
213
|
+
// (NOTE: if we use `queueMicrotask`, it'll trigger `uncaughtException`, not `unhandledRejection`,
|
|
214
|
+
// because there's no promise being rejected.)
|
|
215
|
+
//
|
|
216
|
+
// This will make `uncaughtException` happen:
|
|
217
|
+
// - Before the next fast immediate (`scheduleWorkAfterNextTicksAndMicrotasks` also uses `queueMicrotask`).
|
|
218
|
+
// This is good, and matches usual observable behavior of immediates.
|
|
219
|
+
// - AFTER nextTicks scheduled from the immediate itself.
|
|
220
|
+
// This deviates from native setImmediate, which would call `uncaughtException` first,
|
|
221
|
+
// and skip ahead to the next task as explained above.
|
|
222
|
+
//
|
|
223
|
+
// This is technically an observable difference in behavior, but it seems niche enough that
|
|
224
|
+
// it shouldn't cause problems -- we don't expect user code to use `uncaughtException` for control flow,
|
|
225
|
+
// only error reporting, so subtly changing the timing shouldn't matter.
|
|
226
|
+
let didThrow = false;
|
|
227
|
+
let thrownValue = undefined;
|
|
228
|
+
queueMicrotask(()=>{
|
|
229
|
+
if (didThrow) {
|
|
230
|
+
debug == null ? void 0 : debug('scheduler :: rethrowing sync error from immediate in microtask');
|
|
231
|
+
throw thrownValue;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
try {
|
|
235
|
+
if (args !== null) {
|
|
236
|
+
callback.apply(null, args);
|
|
237
|
+
} else {
|
|
238
|
+
callback();
|
|
239
|
+
}
|
|
240
|
+
} catch (err) {
|
|
241
|
+
// We'll rethrow the error in the microtask above.
|
|
242
|
+
didThrow = true;
|
|
243
|
+
thrownValue = err;
|
|
244
|
+
}
|
|
245
|
+
// Schedule the loop again in case there's more immediates after this one.
|
|
246
|
+
// Note that we can't just check if the queue is empty now, because new immediates
|
|
247
|
+
// might still be scheduled asynchronously, from an upcoming nextTick or microtask.
|
|
248
|
+
execution.state = 1;
|
|
249
|
+
scheduleWorkAfterNextTicksAndMicrotasks(execution);
|
|
250
|
+
}
|
|
251
|
+
function takeNextActiveQueueItem(execution) {
|
|
252
|
+
// Find the first (if any) queued immediate that wasn't cleared.
|
|
253
|
+
// We don't remove immediates from the array when they're cleared,
|
|
254
|
+
// so this requires some legwork to exclude (and possibly drop) cleared items.
|
|
255
|
+
const { queuedImmediates } = execution;
|
|
256
|
+
let firstActiveItem = null;
|
|
257
|
+
let firstActiveItemIndex = -1;
|
|
258
|
+
for(let i = 0; i < queuedImmediates.length; i++){
|
|
259
|
+
const item = queuedImmediates[i];
|
|
260
|
+
if (!item.isCleared) {
|
|
261
|
+
firstActiveItem = item;
|
|
262
|
+
firstActiveItemIndex = i;
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (firstActiveItem === null) {
|
|
267
|
+
// We didn't find an active item.
|
|
268
|
+
// If the queue isn't empty, then it must only contain cleared items. Empty it.
|
|
269
|
+
if (queuedImmediates.length > 0) {
|
|
270
|
+
queuedImmediates.length = 0;
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
// Remove all items up to and including `nextActiveItemIndex` from the queue.
|
|
275
|
+
// (if it's not the first item, then it must be preceded by cleared items, which we want to drop anyway)
|
|
276
|
+
if (firstActiveItemIndex === 0) {
|
|
277
|
+
// Fast path - drop the first item
|
|
278
|
+
// (`splice` creates a result array for the removed items, so this is more efficient)
|
|
279
|
+
queuedImmediates.shift();
|
|
280
|
+
} else {
|
|
281
|
+
queuedImmediates.splice(0, firstActiveItemIndex + 1);
|
|
282
|
+
}
|
|
283
|
+
return firstActiveItem;
|
|
284
|
+
}
|
|
285
|
+
function startCapturingImmediates() {
|
|
286
|
+
if (currentExecution !== null) {
|
|
287
|
+
bail(currentExecution, Object.defineProperty(new _invarianterror.InvariantError(`Cannot start capturing immediates again without finishing the previous task (state: ${ExecutionState[currentExecution.state]})`), "__NEXT_ERROR_CODE", {
|
|
288
|
+
value: "E954",
|
|
289
|
+
enumerable: false,
|
|
290
|
+
configurable: true
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
wasEnabledAtLeastOnce = true;
|
|
294
|
+
const execution = {
|
|
295
|
+
state: 1,
|
|
296
|
+
queuedImmediates: []
|
|
297
|
+
};
|
|
298
|
+
currentExecution = execution;
|
|
299
|
+
return execution;
|
|
300
|
+
}
|
|
301
|
+
function stopCapturingImmediates(execution) {
|
|
302
|
+
if (execution.state === 4) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
// This check enforces that we run performWork at least once before stopping
|
|
306
|
+
// to make sure that we've waited for all the nextTicks and microtasks
|
|
307
|
+
// that might've scheduled some immediates after sync code.
|
|
308
|
+
if (execution.state !== 2) {
|
|
309
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`Cannot stop capturing immediates before execution is finished (state: ${ExecutionState[execution.state]})`), "__NEXT_ERROR_CODE", {
|
|
310
|
+
value: "E957",
|
|
311
|
+
enumerable: false,
|
|
312
|
+
configurable: true
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
execution.state = 3;
|
|
316
|
+
if (currentExecution === execution) {
|
|
317
|
+
currentExecution = null;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function bail(execution, error) {
|
|
321
|
+
// Reset the state as best we can to prevent further crashes.
|
|
322
|
+
// Otherwise, any subsequent call to `DANGEROUSLY_runPendingImmediatesAfterCurrentTask`
|
|
323
|
+
// would error, requiring a server restart to fix.
|
|
324
|
+
if (currentExecution === execution) {
|
|
325
|
+
currentExecution = null;
|
|
326
|
+
}
|
|
327
|
+
execution.state = 4;
|
|
328
|
+
// If we have any queued immediates, schedule them with native `setImmediate` and clear the queue.
|
|
329
|
+
// We don't want to skip running them altogether, because that could lead to
|
|
330
|
+
// e.g. hanging promises (for `new Promise((resolve) => setImmediate(resolve))`),
|
|
331
|
+
// but we're in an inconsistent state and can't run them as fast immediates,
|
|
332
|
+
// so this is the next best thing.
|
|
333
|
+
for (const queueItem of execution.queuedImmediates){
|
|
334
|
+
if (queueItem.isCleared) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
scheduleQueuedImmediateAsNativeImmediate(queueItem);
|
|
338
|
+
}
|
|
339
|
+
execution.queuedImmediates.length = 0;
|
|
340
|
+
// Don't reset `pendingNextTicks` -- it will reset to 0 on its own as the nextTicks execute.
|
|
341
|
+
// If we set it to 0 here while we still have pending ticks, they'd decrement it below 0.
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
function scheduleQueuedImmediateAsNativeImmediate(queueItem) {
|
|
345
|
+
const { callback, args, immediateObject } = queueItem;
|
|
346
|
+
const hasRef = immediateObject[INTERNALS].hasRef;
|
|
347
|
+
clearQueueItem(queueItem);
|
|
348
|
+
const nativeImmediate = args !== null ? originalSetImmediate(callback, ...args) : originalSetImmediate(callback);
|
|
349
|
+
if (!hasRef) {
|
|
350
|
+
nativeImmediate.unref();
|
|
351
|
+
}
|
|
352
|
+
// Make our fake immediate object proxy all relevant operations
|
|
353
|
+
// (clearing, ref(), unref(), hasRef()) to the actual native immediate.
|
|
354
|
+
proxyQueuedImmediateToNativeImmediate(immediateObject, nativeImmediate);
|
|
355
|
+
}
|
|
356
|
+
function clearQueueItem(originalQueueItem) {
|
|
357
|
+
const queueItem = originalQueueItem;
|
|
358
|
+
queueItem.isCleared = true;
|
|
359
|
+
queueItem.callback = null;
|
|
360
|
+
queueItem.args = null;
|
|
361
|
+
queueItem.immediateObject = null;
|
|
362
|
+
}
|
|
363
|
+
function patchedNextTick() {
|
|
364
|
+
if (currentExecution === null) {
|
|
365
|
+
return originalNextTick.apply(null, // @ts-expect-error: this is valid, but typescript doesn't get it
|
|
366
|
+
arguments);
|
|
367
|
+
}
|
|
368
|
+
if (arguments.length === 0 || typeof arguments[0] !== 'function') {
|
|
369
|
+
// Let the original nextTick error for invalid arguments
|
|
370
|
+
// so that we don't have to mirror the error message.
|
|
371
|
+
originalNextTick.apply(null, // @ts-expect-error: explicitly passing arguments that we know are invalid
|
|
372
|
+
arguments);
|
|
373
|
+
// We expect the above call to throw. If it didn't, something's broken.
|
|
374
|
+
bail(currentExecution, Object.defineProperty(new _invarianterror.InvariantError('Expected process.nextTick to reject invalid arguments'), "__NEXT_ERROR_CODE", {
|
|
375
|
+
value: "E966",
|
|
376
|
+
enumerable: false,
|
|
377
|
+
configurable: true
|
|
378
|
+
}));
|
|
379
|
+
}
|
|
380
|
+
debug == null ? void 0 : debug(`scheduler :: process.nextTick called (previous pending: ${pendingNextTicks})`);
|
|
381
|
+
const callback = arguments[0];
|
|
382
|
+
const args = arguments.length > 1 ? Array.prototype.slice.call(arguments, 1) : null;
|
|
383
|
+
pendingNextTicks += 1;
|
|
384
|
+
return originalNextTick(safelyRunNextTickCallback, callback, args);
|
|
385
|
+
}
|
|
386
|
+
function safelyRunNextTickCallback(callback, args) {
|
|
387
|
+
pendingNextTicks -= 1;
|
|
388
|
+
debug == null ? void 0 : debug(`scheduler :: process.nextTick executing (still pending: ${pendingNextTicks})`);
|
|
389
|
+
// Synchronous errors in nextTick break out of `processTicksAndRejections` and cause us
|
|
390
|
+
// to move on to the next timer without having executed the whole nextTick queue,
|
|
391
|
+
// which breaks our entire scheduling mechanism. See `performWork` for more details.
|
|
392
|
+
try {
|
|
393
|
+
if (args !== null) {
|
|
394
|
+
callback.apply(null, args);
|
|
395
|
+
} else {
|
|
396
|
+
callback();
|
|
397
|
+
}
|
|
398
|
+
} catch (err) {
|
|
399
|
+
// We want to make sure `nextTick` is cheap, so unlike `performWork`,
|
|
400
|
+
// we only queue the microtask if an error actually occurs.
|
|
401
|
+
// This (observably) changes the timing of `uncaughtException` even more,
|
|
402
|
+
// because it'll run after microtasks queued from the nextTick,
|
|
403
|
+
// but hopefully this is niche enough to not affect any real world code.
|
|
404
|
+
queueMicrotask(()=>{
|
|
405
|
+
debug == null ? void 0 : debug(`scheduler :: rethrowing sync error from nextTick in a microtask`);
|
|
406
|
+
throw err;
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function patchedSetImmediate() {
|
|
411
|
+
if (currentExecution === null) {
|
|
412
|
+
return originalSetImmediate.apply(null, // @ts-expect-error: this is valid, but typescript doesn't get it
|
|
413
|
+
arguments);
|
|
414
|
+
}
|
|
415
|
+
if (arguments.length === 0 || typeof arguments[0] !== 'function') {
|
|
416
|
+
// Let the original setImmediate error for invalid arguments
|
|
417
|
+
// so that we don't have to mirror the error message.
|
|
418
|
+
originalSetImmediate.apply(null, // @ts-expect-error: explicitly passing arguments that we know are invalid
|
|
419
|
+
arguments);
|
|
420
|
+
// We expect the above call to throw. If it didn't, something's broken.
|
|
421
|
+
bail(currentExecution, Object.defineProperty(new _invarianterror.InvariantError('Expected setImmediate to reject invalid arguments'), "__NEXT_ERROR_CODE", {
|
|
422
|
+
value: "E965",
|
|
423
|
+
enumerable: false,
|
|
424
|
+
configurable: true
|
|
425
|
+
}));
|
|
426
|
+
}
|
|
427
|
+
const callback = arguments[0];
|
|
428
|
+
const args = arguments.length > 1 ? Array.prototype.slice.call(arguments, 1) : null;
|
|
429
|
+
// Normally, Node would capture and propagate the async context to the immediate.
|
|
430
|
+
// We'll be running it on our own queue, so we need to propagate it ourselves.
|
|
431
|
+
const callbackWithAsyncContext = (0, _asynclocalstorage.bindSnapshot)(callback);
|
|
432
|
+
const immediateObject = new NextImmediate();
|
|
433
|
+
const queueItem = {
|
|
434
|
+
isCleared: false,
|
|
435
|
+
callback: callbackWithAsyncContext,
|
|
436
|
+
args,
|
|
437
|
+
immediateObject
|
|
438
|
+
};
|
|
439
|
+
currentExecution.queuedImmediates.push(queueItem);
|
|
440
|
+
immediateObject[INTERNALS].queueItem = queueItem;
|
|
441
|
+
return immediateObject;
|
|
442
|
+
}
|
|
443
|
+
function patchedSetImmediatePromise(value, options) {
|
|
444
|
+
if (currentExecution === null) {
|
|
445
|
+
const originalPromisify = // @ts-expect-error: the types for `promisify.custom` are strange
|
|
446
|
+
originalSetImmediate[_nodeutil.promisify.custom];
|
|
447
|
+
return originalPromisify(value, options);
|
|
448
|
+
}
|
|
449
|
+
return new Promise((resolve, reject)=>{
|
|
450
|
+
// The abort signal makes the promise reject.
|
|
451
|
+
// If it is already aborted, we reject immediately.
|
|
452
|
+
const signal = options == null ? void 0 : options.signal;
|
|
453
|
+
if (signal && signal.aborted) {
|
|
454
|
+
return reject(signal.reason);
|
|
455
|
+
}
|
|
456
|
+
const immediate = patchedSetImmediate(resolve, value);
|
|
457
|
+
// Unref-ing only really has an observable effect if we bail out to a native immediate,
|
|
458
|
+
// but we do it for completeness
|
|
459
|
+
if ((options == null ? void 0 : options.ref) === false) {
|
|
460
|
+
immediate.unref();
|
|
461
|
+
}
|
|
462
|
+
if (signal) {
|
|
463
|
+
signal.addEventListener('abort', ()=>{
|
|
464
|
+
patchedClearImmediate(immediate);
|
|
465
|
+
reject(signal.reason);
|
|
466
|
+
}, {
|
|
467
|
+
once: true
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
patchedSetImmediate[_nodeutil.promisify.custom] = patchedSetImmediatePromise;
|
|
473
|
+
const patchedClearImmediate = (immediateObject)=>{
|
|
474
|
+
// NOTE: we defensively check for patched immediates even if we're not
|
|
475
|
+
// currently capturing immediates, because the objects returned from
|
|
476
|
+
// the patched setImmediate can be kept around for arbitrarily long.
|
|
477
|
+
// As an optimization, we only do this if the patch was enabled at least once --
|
|
478
|
+
// otherwise, no patched objects could've been created.
|
|
479
|
+
if (wasEnabledAtLeastOnce && immediateObject && typeof immediateObject === 'object' && INTERNALS in immediateObject) {
|
|
480
|
+
;
|
|
481
|
+
immediateObject[Symbol.dispose]();
|
|
482
|
+
} else {
|
|
483
|
+
originalClearImmediate(immediateObject);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
//========================================================
|
|
487
|
+
const INTERNALS = Symbol.for('next.Immediate.internals');
|
|
488
|
+
function proxyQueuedImmediateToNativeImmediate(immediateObject, nativeImmediate) {
|
|
489
|
+
immediateObject[INTERNALS].hasRef = null;
|
|
490
|
+
immediateObject[INTERNALS].queueItem = null;
|
|
491
|
+
immediateObject[INTERNALS].nativeImmediate = nativeImmediate;
|
|
492
|
+
}
|
|
493
|
+
/** Implements a shim for the native `Immediate` class returned by `setImmediate` */ class NextImmediate {
|
|
494
|
+
hasRef() {
|
|
495
|
+
const internals = this[INTERNALS];
|
|
496
|
+
if (internals.queueItem) {
|
|
497
|
+
return internals.hasRef;
|
|
498
|
+
} else if (internals.nativeImmediate) {
|
|
499
|
+
return internals.nativeImmediate.hasRef();
|
|
500
|
+
} else {
|
|
501
|
+
// if we're no longer queued (cleared or executed), hasRef is always false
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
ref() {
|
|
506
|
+
const internals = this[INTERNALS];
|
|
507
|
+
if (internals.queueItem) {
|
|
508
|
+
internals.hasRef = true;
|
|
509
|
+
} else if (internals.nativeImmediate) {
|
|
510
|
+
internals.nativeImmediate.ref();
|
|
511
|
+
}
|
|
512
|
+
return this;
|
|
513
|
+
}
|
|
514
|
+
unref() {
|
|
515
|
+
const internals = this[INTERNALS];
|
|
516
|
+
if (internals.queueItem) {
|
|
517
|
+
internals.hasRef = false;
|
|
518
|
+
} else if (internals.nativeImmediate) {
|
|
519
|
+
internals.nativeImmediate.unref();
|
|
520
|
+
}
|
|
521
|
+
return this;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Node invokes `_onImmediate` when an immediate is executed:
|
|
525
|
+
* https://github.com/nodejs/node/blob/42d363205715ffa5a4a6d90f4be1311487053d65/lib/internal/timers.js#L504
|
|
526
|
+
* It's visible on the public types, so we want to have it here for parity, but it's a noop.
|
|
527
|
+
* */ _onImmediate() {}
|
|
528
|
+
[Symbol.dispose]() {
|
|
529
|
+
// This is equivalent to `clearImmediate`.
|
|
530
|
+
const internals = this[INTERNALS];
|
|
531
|
+
if (internals.queueItem) {
|
|
532
|
+
// this is still queued. drop it.
|
|
533
|
+
const queueItem = internals.queueItem;
|
|
534
|
+
internals.queueItem = null;
|
|
535
|
+
clearQueueItem(queueItem);
|
|
536
|
+
} else if (internals.nativeImmediate) {
|
|
537
|
+
internals.nativeImmediate[Symbol.dispose]();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
constructor(){
|
|
541
|
+
this[INTERNALS] = {
|
|
542
|
+
queueItem: null,
|
|
543
|
+
hasRef: true,
|
|
544
|
+
nativeImmediate: null
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
// ==========================================
|
|
549
|
+
const debug = process.env.NEXT_DEBUG_IMMEDIATES !== '1' ? undefined : (...args)=>{
|
|
550
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
551
|
+
throw Object.defineProperty(new _invarianterror.InvariantError('Fast setImmediate is not available in the edge runtime.'), "__NEXT_ERROR_CODE", {
|
|
552
|
+
value: "E963",
|
|
553
|
+
enumerable: false,
|
|
554
|
+
configurable: true
|
|
555
|
+
});
|
|
556
|
+
} else {
|
|
557
|
+
const { inspect } = require('node:util');
|
|
558
|
+
const { writeFileSync } = require('node:fs');
|
|
559
|
+
let logLine = args.map((arg)=>typeof arg === 'string' ? arg : inspect(arg, {
|
|
560
|
+
colors: true
|
|
561
|
+
})).join(' ') + '\n';
|
|
562
|
+
logLine = '\x1B[2m' + logLine + '\x1B[22m' // styleText('dim', logLine)
|
|
563
|
+
;
|
|
564
|
+
writeFileSync(process.stdout.fd, logLine);
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
// ==========================================
|
|
568
|
+
install();
|
|
569
|
+
|
|
570
|
+
//# sourceMappingURL=fast-set-immediate.external.js.map
|