@backthread/extractor 0.1.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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/cluster/domain-grouping.d.ts +113 -0
- package/dist/cluster/domain-grouping.d.ts.map +1 -0
- package/dist/cluster/domain-grouping.js +277 -0
- package/dist/cluster/domain-grouping.js.map +1 -0
- package/dist/cluster/grouping-gate.d.ts +54 -0
- package/dist/cluster/grouping-gate.d.ts.map +1 -0
- package/dist/cluster/grouping-gate.js +0 -0
- package/dist/cluster/grouping-gate.js.map +1 -0
- package/dist/cluster/louvain.d.ts +88 -0
- package/dist/cluster/louvain.d.ts.map +1 -0
- package/dist/cluster/louvain.js +674 -0
- package/dist/cluster/louvain.js.map +1 -0
- package/dist/cluster/overrides.d.ts +19 -0
- package/dist/cluster/overrides.d.ts.map +1 -0
- package/dist/cluster/overrides.js +32 -0
- package/dist/cluster/overrides.js.map +1 -0
- package/dist/cluster/subsystem.d.ts +45 -0
- package/dist/cluster/subsystem.d.ts.map +1 -0
- package/dist/cluster/subsystem.js +299 -0
- package/dist/cluster/subsystem.js.map +1 -0
- package/dist/cluster/workspaces.d.ts +64 -0
- package/dist/cluster/workspaces.d.ts.map +1 -0
- package/dist/cluster/workspaces.js +739 -0
- package/dist/cluster/workspaces.js.map +1 -0
- package/dist/extract.d.ts +52 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +48 -0
- package/dist/extract.js.map +1 -0
- package/dist/framework/celery/celery.d.ts +17 -0
- package/dist/framework/celery/celery.d.ts.map +1 -0
- package/dist/framework/celery/celery.js +524 -0
- package/dist/framework/celery/celery.js.map +1 -0
- package/dist/framework/contribute-step.d.ts +38 -0
- package/dist/framework/contribute-step.d.ts.map +1 -0
- package/dist/framework/contribute-step.js +403 -0
- package/dist/framework/contribute-step.js.map +1 -0
- package/dist/framework/detect-step.d.ts +8 -0
- package/dist/framework/detect-step.d.ts.map +1 -0
- package/dist/framework/detect-step.js +54 -0
- package/dist/framework/detect-step.js.map +1 -0
- package/dist/framework/detect-util.d.ts +24 -0
- package/dist/framework/detect-util.d.ts.map +1 -0
- package/dist/framework/detect-util.js +59 -0
- package/dist/framework/detect-util.js.map +1 -0
- package/dist/framework/django/django.d.ts +22 -0
- package/dist/framework/django/django.d.ts.map +1 -0
- package/dist/framework/django/django.js +940 -0
- package/dist/framework/django/django.js.map +1 -0
- package/dist/framework/fastapi/fastapi.d.ts +27 -0
- package/dist/framework/fastapi/fastapi.d.ts.map +1 -0
- package/dist/framework/fastapi/fastapi.js +477 -0
- package/dist/framework/fastapi/fastapi.js.map +1 -0
- package/dist/framework/faststream/faststream.d.ts +19 -0
- package/dist/framework/faststream/faststream.d.ts.map +1 -0
- package/dist/framework/faststream/faststream.js +765 -0
- package/dist/framework/faststream/faststream.js.map +1 -0
- package/dist/framework/flask/flask.d.ts +17 -0
- package/dist/framework/flask/flask.d.ts.map +1 -0
- package/dist/framework/flask/flask.js +507 -0
- package/dist/framework/flask/flask.js.map +1 -0
- package/dist/framework/graphql/graphql.d.ts +17 -0
- package/dist/framework/graphql/graphql.d.ts.map +1 -0
- package/dist/framework/graphql/graphql.js +708 -0
- package/dist/framework/graphql/graphql.js.map +1 -0
- package/dist/framework/grpc/grpc.d.ts +22 -0
- package/dist/framework/grpc/grpc.d.ts.map +1 -0
- package/dist/framework/grpc/grpc.js +618 -0
- package/dist/framework/grpc/grpc.js.map +1 -0
- package/dist/framework/litestar/litestar.d.ts +17 -0
- package/dist/framework/litestar/litestar.d.ts.map +1 -0
- package/dist/framework/litestar/litestar.js +536 -0
- package/dist/framework/litestar/litestar.js.map +1 -0
- package/dist/framework/nest/nest.d.ts +19 -0
- package/dist/framework/nest/nest.d.ts.map +1 -0
- package/dist/framework/nest/nest.js +613 -0
- package/dist/framework/nest/nest.js.map +1 -0
- package/dist/framework/next/next.d.ts +22 -0
- package/dist/framework/next/next.d.ts.map +1 -0
- package/dist/framework/next/next.js +449 -0
- package/dist/framework/next/next.js.map +1 -0
- package/dist/framework/node/node.d.ts +24 -0
- package/dist/framework/node/node.d.ts.map +1 -0
- package/dist/framework/node/node.js +1009 -0
- package/dist/framework/node/node.js.map +1 -0
- package/dist/framework/orchestrator/orchestrator.d.ts +34 -0
- package/dist/framework/orchestrator/orchestrator.d.ts.map +1 -0
- package/dist/framework/orchestrator/orchestrator.js +691 -0
- package/dist/framework/orchestrator/orchestrator.js.map +1 -0
- package/dist/framework/orm/orm.d.ts +61 -0
- package/dist/framework/orm/orm.d.ts.map +1 -0
- package/dist/framework/orm/orm.js +620 -0
- package/dist/framework/orm/orm.js.map +1 -0
- package/dist/framework/python/analyze.d.ts +38 -0
- package/dist/framework/python/analyze.d.ts.map +1 -0
- package/dist/framework/python/analyze.js +98 -0
- package/dist/framework/python/analyze.js.map +1 -0
- package/dist/framework/python/py-ast.d.ts +130 -0
- package/dist/framework/python/py-ast.d.ts.map +1 -0
- package/dist/framework/python/py-ast.js +344 -0
- package/dist/framework/python/py-ast.js.map +1 -0
- package/dist/framework/python-orm/python-orm.d.ts +19 -0
- package/dist/framework/python-orm/python-orm.d.ts.map +1 -0
- package/dist/framework/python-orm/python-orm.js +516 -0
- package/dist/framework/python-orm/python-orm.js.map +1 -0
- package/dist/framework/react-native/react-native.d.ts +35 -0
- package/dist/framework/react-native/react-native.d.ts.map +1 -0
- package/dist/framework/react-native/react-native.js +1181 -0
- package/dist/framework/react-native/react-native.js.map +1 -0
- package/dist/framework/register.d.ts +2 -0
- package/dist/framework/register.d.ts.map +1 -0
- package/dist/framework/register.js +59 -0
- package/dist/framework/register.js.map +1 -0
- package/dist/framework/registry.d.ts +31 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +70 -0
- package/dist/framework/registry.js.map +1 -0
- package/dist/framework/routing/expo-router.d.ts +31 -0
- package/dist/framework/routing/expo-router.d.ts.map +1 -0
- package/dist/framework/routing/expo-router.js +356 -0
- package/dist/framework/routing/expo-router.js.map +1 -0
- package/dist/framework/routing/index.d.ts +4 -0
- package/dist/framework/routing/index.d.ts.map +1 -0
- package/dist/framework/routing/index.js +16 -0
- package/dist/framework/routing/index.js.map +1 -0
- package/dist/framework/routing/next-router.d.ts +45 -0
- package/dist/framework/routing/next-router.d.ts.map +1 -0
- package/dist/framework/routing/next-router.js +378 -0
- package/dist/framework/routing/next-router.js.map +1 -0
- package/dist/framework/routing/route-tree.d.ts +73 -0
- package/dist/framework/routing/route-tree.d.ts.map +1 -0
- package/dist/framework/routing/route-tree.js +120 -0
- package/dist/framework/routing/route-tree.js.map +1 -0
- package/dist/framework/types.d.ts +230 -0
- package/dist/framework/types.d.ts.map +1 -0
- package/dist/framework/types.js +25 -0
- package/dist/framework/types.js.map +1 -0
- package/dist/graph/cross-language.d.ts +11 -0
- package/dist/graph/cross-language.d.ts.map +1 -0
- package/dist/graph/cross-language.js +123 -0
- package/dist/graph/cross-language.js.map +1 -0
- package/dist/graph/extract.d.ts +13 -0
- package/dist/graph/extract.d.ts.map +1 -0
- package/dist/graph/extract.js +79 -0
- package/dist/graph/extract.js.map +1 -0
- package/dist/graph/file-graph.d.ts +186 -0
- package/dist/graph/file-graph.d.ts.map +1 -0
- package/dist/graph/file-graph.js +427 -0
- package/dist/graph/file-graph.js.map +1 -0
- package/dist/graph/http-callsites.d.ts +14 -0
- package/dist/graph/http-callsites.d.ts.map +1 -0
- package/dist/graph/http-callsites.js +107 -0
- package/dist/graph/http-callsites.js.map +1 -0
- package/dist/graph/incremental.d.ts +122 -0
- package/dist/graph/incremental.d.ts.map +1 -0
- package/dist/graph/incremental.js +448 -0
- package/dist/graph/incremental.js.map +1 -0
- package/dist/graph/language.d.ts +31 -0
- package/dist/graph/language.d.ts.map +1 -0
- package/dist/graph/language.js +146 -0
- package/dist/graph/language.js.map +1 -0
- package/dist/graph/noise-filter.d.ts +46 -0
- package/dist/graph/noise-filter.d.ts.map +1 -0
- package/dist/graph/noise-filter.js +199 -0
- package/dist/graph/noise-filter.js.map +1 -0
- package/dist/graph/python-adapter.d.ts +36 -0
- package/dist/graph/python-adapter.d.ts.map +1 -0
- package/dist/graph/python-adapter.js +402 -0
- package/dist/graph/python-adapter.js.map +1 -0
- package/dist/graph/python-manifest.d.ts +22 -0
- package/dist/graph/python-manifest.d.ts.map +1 -0
- package/dist/graph/python-manifest.js +137 -0
- package/dist/graph/python-manifest.js.map +1 -0
- package/dist/graph/python-stdlib.d.ts +2 -0
- package/dist/graph/python-stdlib.d.ts.map +1 -0
- package/dist/graph/python-stdlib.js +53 -0
- package/dist/graph/python-stdlib.js.map +1 -0
- package/dist/graph/ts-morph-adapter.d.ts +65 -0
- package/dist/graph/ts-morph-adapter.d.ts.map +1 -0
- package/dist/graph/ts-morph-adapter.js +265 -0
- package/dist/graph/ts-morph-adapter.js.map +1 -0
- package/dist/graph/types.d.ts +37 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +50 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/aws/aws-parse.d.ts +39 -0
- package/dist/infra/aws/aws-parse.d.ts.map +1 -0
- package/dist/infra/aws/aws-parse.js +149 -0
- package/dist/infra/aws/aws-parse.js.map +1 -0
- package/dist/infra/aws/aws.d.ts +6 -0
- package/dist/infra/aws/aws.d.ts.map +1 -0
- package/dist/infra/aws/aws.js +425 -0
- package/dist/infra/aws/aws.js.map +1 -0
- package/dist/infra/azure/azure-parse.d.ts +73 -0
- package/dist/infra/azure/azure-parse.d.ts.map +1 -0
- package/dist/infra/azure/azure-parse.js +178 -0
- package/dist/infra/azure/azure-parse.js.map +1 -0
- package/dist/infra/azure/azure.d.ts +12 -0
- package/dist/infra/azure/azure.d.ts.map +1 -0
- package/dist/infra/azure/azure.js +673 -0
- package/dist/infra/azure/azure.js.map +1 -0
- package/dist/infra/cloudflare/cloudflare.d.ts +50 -0
- package/dist/infra/cloudflare/cloudflare.d.ts.map +1 -0
- package/dist/infra/cloudflare/cloudflare.js +382 -0
- package/dist/infra/cloudflare/cloudflare.js.map +1 -0
- package/dist/infra/cloudflare/wrangler-parse.d.ts +6 -0
- package/dist/infra/cloudflare/wrangler-parse.d.ts.map +1 -0
- package/dist/infra/cloudflare/wrangler-parse.js +278 -0
- package/dist/infra/cloudflare/wrangler-parse.js.map +1 -0
- package/dist/infra/compose/compose-parse.d.ts +24 -0
- package/dist/infra/compose/compose-parse.d.ts.map +1 -0
- package/dist/infra/compose/compose-parse.js +77 -0
- package/dist/infra/compose/compose-parse.js.map +1 -0
- package/dist/infra/compose/compose.d.ts +12 -0
- package/dist/infra/compose/compose.d.ts.map +1 -0
- package/dist/infra/compose/compose.js +201 -0
- package/dist/infra/compose/compose.js.map +1 -0
- package/dist/infra/convex/convex-parse.d.ts +28 -0
- package/dist/infra/convex/convex-parse.d.ts.map +1 -0
- package/dist/infra/convex/convex-parse.js +74 -0
- package/dist/infra/convex/convex-parse.js.map +1 -0
- package/dist/infra/convex/convex.d.ts +18 -0
- package/dist/infra/convex/convex.d.ts.map +1 -0
- package/dist/infra/convex/convex.js +199 -0
- package/dist/infra/convex/convex.js.map +1 -0
- package/dist/infra/digitalocean/digitalocean.d.ts +33 -0
- package/dist/infra/digitalocean/digitalocean.d.ts.map +1 -0
- package/dist/infra/digitalocean/digitalocean.js +204 -0
- package/dist/infra/digitalocean/digitalocean.js.map +1 -0
- package/dist/infra/firebase/firebase.d.ts +43 -0
- package/dist/infra/firebase/firebase.d.ts.map +1 -0
- package/dist/infra/firebase/firebase.js +271 -0
- package/dist/infra/firebase/firebase.js.map +1 -0
- package/dist/infra/fly/fly-parse.d.ts +52 -0
- package/dist/infra/fly/fly-parse.d.ts.map +1 -0
- package/dist/infra/fly/fly-parse.js +114 -0
- package/dist/infra/fly/fly-parse.js.map +1 -0
- package/dist/infra/fly/fly.d.ts +15 -0
- package/dist/infra/fly/fly.d.ts.map +1 -0
- package/dist/infra/fly/fly.js +265 -0
- package/dist/infra/fly/fly.js.map +1 -0
- package/dist/infra/gcp/gcp-parse.d.ts +24 -0
- package/dist/infra/gcp/gcp-parse.d.ts.map +1 -0
- package/dist/infra/gcp/gcp-parse.js +123 -0
- package/dist/infra/gcp/gcp-parse.js.map +1 -0
- package/dist/infra/gcp/gcp.d.ts +10 -0
- package/dist/infra/gcp/gcp.d.ts.map +1 -0
- package/dist/infra/gcp/gcp.js +502 -0
- package/dist/infra/gcp/gcp.js.map +1 -0
- package/dist/infra/heroku/heroku-parse.d.ts +33 -0
- package/dist/infra/heroku/heroku-parse.d.ts.map +1 -0
- package/dist/infra/heroku/heroku-parse.js +63 -0
- package/dist/infra/heroku/heroku-parse.js.map +1 -0
- package/dist/infra/heroku/heroku.d.ts +24 -0
- package/dist/infra/heroku/heroku.d.ts.map +1 -0
- package/dist/infra/heroku/heroku.js +253 -0
- package/dist/infra/heroku/heroku.js.map +1 -0
- package/dist/infra/image-resolve.d.ts +56 -0
- package/dist/infra/image-resolve.d.ts.map +1 -0
- package/dist/infra/image-resolve.js +229 -0
- package/dist/infra/image-resolve.js.map +1 -0
- package/dist/infra/infra-step.d.ts +39 -0
- package/dist/infra/infra-step.d.ts.map +1 -0
- package/dist/infra/infra-step.js +57 -0
- package/dist/infra/infra-step.js.map +1 -0
- package/dist/infra/k8s/index.d.ts +78 -0
- package/dist/infra/k8s/index.d.ts.map +1 -0
- package/dist/infra/k8s/index.js +251 -0
- package/dist/infra/k8s/index.js.map +1 -0
- package/dist/infra/kamal/kamal-parse.d.ts +23 -0
- package/dist/infra/kamal/kamal-parse.d.ts.map +1 -0
- package/dist/infra/kamal/kamal-parse.js +66 -0
- package/dist/infra/kamal/kamal-parse.js.map +1 -0
- package/dist/infra/kamal/kamal.d.ts +17 -0
- package/dist/infra/kamal/kamal.d.ts.map +1 -0
- package/dist/infra/kamal/kamal.js +162 -0
- package/dist/infra/kamal/kamal.js.map +1 -0
- package/dist/infra/netlify/netlify.d.ts +33 -0
- package/dist/infra/netlify/netlify.d.ts.map +1 -0
- package/dist/infra/netlify/netlify.js +247 -0
- package/dist/infra/netlify/netlify.js.map +1 -0
- package/dist/infra/opentofu/opentofu.d.ts +3 -0
- package/dist/infra/opentofu/opentofu.d.ts.map +1 -0
- package/dist/infra/opentofu/opentofu.js +157 -0
- package/dist/infra/opentofu/opentofu.js.map +1 -0
- package/dist/infra/pulumi/pulumi-parse.d.ts +60 -0
- package/dist/infra/pulumi/pulumi-parse.d.ts.map +1 -0
- package/dist/infra/pulumi/pulumi-parse.js +155 -0
- package/dist/infra/pulumi/pulumi-parse.js.map +1 -0
- package/dist/infra/pulumi/pulumi.d.ts +23 -0
- package/dist/infra/pulumi/pulumi.d.ts.map +1 -0
- package/dist/infra/pulumi/pulumi.js +260 -0
- package/dist/infra/pulumi/pulumi.js.map +1 -0
- package/dist/infra/railway/railway-parse.d.ts +54 -0
- package/dist/infra/railway/railway-parse.d.ts.map +1 -0
- package/dist/infra/railway/railway-parse.js +200 -0
- package/dist/infra/railway/railway-parse.js.map +1 -0
- package/dist/infra/railway/railway.d.ts +19 -0
- package/dist/infra/railway/railway.d.ts.map +1 -0
- package/dist/infra/railway/railway.js +397 -0
- package/dist/infra/railway/railway.js.map +1 -0
- package/dist/infra/register.d.ts +2 -0
- package/dist/infra/register.d.ts.map +1 -0
- package/dist/infra/register.js +81 -0
- package/dist/infra/register.js.map +1 -0
- package/dist/infra/registry.d.ts +64 -0
- package/dist/infra/registry.d.ts.map +1 -0
- package/dist/infra/registry.js +205 -0
- package/dist/infra/registry.js.map +1 -0
- package/dist/infra/relevance.d.ts +16 -0
- package/dist/infra/relevance.d.ts.map +1 -0
- package/dist/infra/relevance.js +132 -0
- package/dist/infra/relevance.js.map +1 -0
- package/dist/infra/render/render-parse.d.ts +76 -0
- package/dist/infra/render/render-parse.d.ts.map +1 -0
- package/dist/infra/render/render-parse.js +155 -0
- package/dist/infra/render/render-parse.js.map +1 -0
- package/dist/infra/render/render.d.ts +11 -0
- package/dist/infra/render/render.d.ts.map +1 -0
- package/dist/infra/render/render.js +303 -0
- package/dist/infra/render/render.js.map +1 -0
- package/dist/infra/sst/sst-parse.d.ts +25 -0
- package/dist/infra/sst/sst-parse.d.ts.map +1 -0
- package/dist/infra/sst/sst-parse.js +45 -0
- package/dist/infra/sst/sst-parse.js.map +1 -0
- package/dist/infra/sst/sst.d.ts +19 -0
- package/dist/infra/sst/sst.d.ts.map +1 -0
- package/dist/infra/sst/sst.js +236 -0
- package/dist/infra/sst/sst.js.map +1 -0
- package/dist/infra/supabase/supabase-parse.d.ts +34 -0
- package/dist/infra/supabase/supabase-parse.d.ts.map +1 -0
- package/dist/infra/supabase/supabase-parse.js +113 -0
- package/dist/infra/supabase/supabase-parse.js.map +1 -0
- package/dist/infra/supabase/supabase.d.ts +15 -0
- package/dist/infra/supabase/supabase.d.ts.map +1 -0
- package/dist/infra/supabase/supabase.js +198 -0
- package/dist/infra/supabase/supabase.js.map +1 -0
- package/dist/infra/terraform/hcl-parse.d.ts +34 -0
- package/dist/infra/terraform/hcl-parse.d.ts.map +1 -0
- package/dist/infra/terraform/hcl-parse.js +203 -0
- package/dist/infra/terraform/hcl-parse.js.map +1 -0
- package/dist/infra/terraform/terraform.d.ts +14 -0
- package/dist/infra/terraform/terraform.d.ts.map +1 -0
- package/dist/infra/terraform/terraform.js +264 -0
- package/dist/infra/terraform/terraform.js.map +1 -0
- package/dist/infra/types.d.ts +151 -0
- package/dist/infra/types.d.ts.map +1 -0
- package/dist/infra/types.js +14 -0
- package/dist/infra/types.js.map +1 -0
- package/dist/infra/vercel/vercel-parse.d.ts +70 -0
- package/dist/infra/vercel/vercel-parse.d.ts.map +1 -0
- package/dist/infra/vercel/vercel-parse.js +194 -0
- package/dist/infra/vercel/vercel-parse.js.map +1 -0
- package/dist/infra/vercel/vercel.d.ts +30 -0
- package/dist/infra/vercel/vercel.d.ts.map +1 -0
- package/dist/infra/vercel/vercel.js +523 -0
- package/dist/infra/vercel/vercel.js.map +1 -0
- package/dist/infra/walk.d.ts +36 -0
- package/dist/infra/walk.d.ts.map +1 -0
- package/dist/infra/walk.js +85 -0
- package/dist/infra/walk.js.map +1 -0
- package/dist/safety.d.ts +13 -0
- package/dist/safety.d.ts.map +1 -0
- package/dist/safety.js +67 -0
- package/dist/safety.js.map +1 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +111 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +35 -0
- package/dist/version.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DetectMatch, FrameworkAdapter } from '../types.js';
|
|
2
|
+
/** The deterministic Next.js signal set read from a repo (or workspace package). */
|
|
3
|
+
export interface NextSignals {
|
|
4
|
+
hasNextDep: boolean;
|
|
5
|
+
hasNextConfig: boolean;
|
|
6
|
+
hasAppDir: boolean;
|
|
7
|
+
hasPagesDir: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Gather the signal set for a single root dir (fs only). */
|
|
10
|
+
export declare function gatherNextSignals(baseDir: string): NextSignals;
|
|
11
|
+
/**
|
|
12
|
+
* Decide Next.js from the signal set. Returns a DetectMatch, or null when the
|
|
13
|
+
* signals are too weak to claim the stack (generic-TS fallthrough intact).
|
|
14
|
+
*
|
|
15
|
+
* SUFFICIENT (match-on-its-own): the `next` dep, OR a next.config.* file — both
|
|
16
|
+
* Next-specific. An app/ or pages/ dir alone is only SUPPORTING (raises
|
|
17
|
+
* confidence) — both names are far too generic to claim the stack on their own.
|
|
18
|
+
*/
|
|
19
|
+
export declare function scoreNext(s: NextSignals, rootPath?: string): DetectMatch | null;
|
|
20
|
+
export type NextRole = 'middleware' | 'route-handler' | 'server-action' | 'page' | 'layout' | 'client-component' | 'server-component';
|
|
21
|
+
export declare const nextAdapter: FrameworkAdapter;
|
|
22
|
+
//# sourceMappingURL=next.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../src/framework/next/next.ts"],"names":[],"mappings":"AAsEA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAOjB,MAAM,aAAa,CAAC;AAKrB,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAQ9D;AAUD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,SAAK,GAAG,WAAW,GAAG,IAAI,CAyB3E;AAoBD,MAAM,MAAM,QAAQ,GAChB,YAAY,GACZ,eAAe,GACf,eAAe,GACf,MAAM,GACN,QAAQ,GACR,kBAAkB,GAClB,kBAAkB,CAAC;AAuVvB,eAAO,MAAM,WAAW,EAAE,gBAqCzB,CAAC"}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
// (Slice 2) — the Next.js FrameworkAdapter DETECTION.
|
|
2
|
+
// the route-segment grouping prior + RSC/client roles + the API/action
|
|
3
|
+
// surface edges (the contribution hooks).
|
|
4
|
+
//
|
|
5
|
+
// DETECTION: decides "is this a Next.js app, and which router (App /
|
|
6
|
+
// Pages)?" from package.json deps + config-file/dir existence — never source
|
|
7
|
+
// content (never-store-source).
|
|
8
|
+
//
|
|
9
|
+
// CONTRIBUTION: a Next app's real structure is route segments + the
|
|
10
|
+
// server/client boundary + its API/action surface — none of which are plain
|
|
11
|
+
// import edges. We recover them with the SHARED file-based-routing convention
|
|
12
|
+
// (routing/next-router.ts, the Next convention) + a static ts-morph scan
|
|
13
|
+
// of the RSC directives (`'use client'` / `'use server'`) + call sites. We read
|
|
14
|
+
// STATICALLY (install-free; never-store-source — read server-side, persist only
|
|
15
|
+
// the derived groups/edges/roles) and contribute in the graph FILE-ID space; the
|
|
16
|
+
// generic contribute-step resolves to MODULE ids.
|
|
17
|
+
//
|
|
18
|
+
// * groupingPrior — one FrameworkGroup per top-level ROUTE SEGMENT (`next:<seg>`)
|
|
19
|
+
// over every file in that segment (page/layout/route + the
|
|
20
|
+
// co-located components/helpers). The contribute-step makes
|
|
21
|
+
// each its own subsystem, AUTHORITATIVE over directory — so a
|
|
22
|
+
// deep `app/dashboard/**` tree renders as ONE "Dashboard"
|
|
23
|
+
// box instead of fragmenting by sub-directory.
|
|
24
|
+
// * roleTags — Page/Layout → frontend · RouteHandler/ServerAction/
|
|
25
|
+
// Middleware → gateway · Client/Server-Component → frontend.
|
|
26
|
+
// The Server↔Client split is carried in `role` (+ `rsc`
|
|
27
|
+
// metadata on routed nodes); NO new Module-kind, NO new verb.
|
|
28
|
+
// * syntheticEdges — `calls` only (8-verb): route nav (from the route tree),
|
|
29
|
+
// client→Server-Action invocation, page→Route-Handler fetch.
|
|
30
|
+
//
|
|
31
|
+
// Dynamic / unresolvable targets (a computed `<Link href>`, an inline
|
|
32
|
+
// function-level `'use server'`) DEGRADE + LOG — no silent caps.
|
|
33
|
+
//
|
|
34
|
+
// Detection signals (manifest + config/dir existence only):
|
|
35
|
+
// * dep: `next` — the authoritative signal
|
|
36
|
+
// * config: next.config.{js,ts,mjs} — Next-specific
|
|
37
|
+
// * router: app/ | src/app/ (App) · pages/ | src/pages/ (Pages)
|
|
38
|
+
//
|
|
39
|
+
// scoreNext is PURE; the adapter gathers the fs signals and calls it.
|
|
40
|
+
import { existsSync } from 'node:fs';
|
|
41
|
+
import { join } from 'node:path';
|
|
42
|
+
import { SyntaxKind, } from 'ts-morph';
|
|
43
|
+
import { addAllSourceFiles, buildExtractionProject, toId, } from '../../graph/ts-morph-adapter.js';
|
|
44
|
+
import { SOURCE_EXTENSIONS } from '../../graph/file-graph.js';
|
|
45
|
+
import { buildHrefResolver, extractNextRouteTree, findNextRouteDirs, nextSegmentKey, walkNextSourceFiles, } from '../routing/index.js';
|
|
46
|
+
import { clampConfidence, existsAny, isDir, readDeps, resolveBase, } from '../detect-util.js';
|
|
47
|
+
const NEXT_CONFIG_NAMES = ['next.config.js', 'next.config.ts', 'next.config.mjs'];
|
|
48
|
+
/** Gather the signal set for a single root dir (fs only). */
|
|
49
|
+
export function gatherNextSignals(baseDir) {
|
|
50
|
+
const deps = readDeps(baseDir);
|
|
51
|
+
return {
|
|
52
|
+
hasNextDep: 'next' in deps,
|
|
53
|
+
hasNextConfig: existsAny(baseDir, NEXT_CONFIG_NAMES),
|
|
54
|
+
hasAppDir: isDir(baseDir, 'app') || isDir(baseDir, 'src/app'),
|
|
55
|
+
hasPagesDir: isDir(baseDir, 'pages') || isDir(baseDir, 'src/pages'),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** App-router / Pages-router / both / unknown, for the metadata + log variant. */
|
|
59
|
+
function routerOf(s) {
|
|
60
|
+
if (s.hasAppDir && s.hasPagesDir)
|
|
61
|
+
return 'app+pages';
|
|
62
|
+
if (s.hasAppDir)
|
|
63
|
+
return 'app';
|
|
64
|
+
if (s.hasPagesDir)
|
|
65
|
+
return 'pages';
|
|
66
|
+
return 'unknown';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Decide Next.js from the signal set. Returns a DetectMatch, or null when the
|
|
70
|
+
* signals are too weak to claim the stack (generic-TS fallthrough intact).
|
|
71
|
+
*
|
|
72
|
+
* SUFFICIENT (match-on-its-own): the `next` dep, OR a next.config.* file — both
|
|
73
|
+
* Next-specific. An app/ or pages/ dir alone is only SUPPORTING (raises
|
|
74
|
+
* confidence) — both names are far too generic to claim the stack on their own.
|
|
75
|
+
*/
|
|
76
|
+
export function scoreNext(s, rootPath = '') {
|
|
77
|
+
if (!s.hasNextDep && !s.hasNextConfig)
|
|
78
|
+
return null;
|
|
79
|
+
let confidence = 0;
|
|
80
|
+
if (s.hasNextDep)
|
|
81
|
+
confidence += 0.6;
|
|
82
|
+
if (s.hasNextConfig)
|
|
83
|
+
confidence += 0.3;
|
|
84
|
+
if (s.hasAppDir)
|
|
85
|
+
confidence += 0.1;
|
|
86
|
+
if (s.hasPagesDir)
|
|
87
|
+
confidence += 0.1;
|
|
88
|
+
const router = routerOf(s);
|
|
89
|
+
return {
|
|
90
|
+
adapter: 'next',
|
|
91
|
+
confidence: clampConfidence(confidence),
|
|
92
|
+
rootPath,
|
|
93
|
+
metadata: {
|
|
94
|
+
variant: router,
|
|
95
|
+
router,
|
|
96
|
+
signals: {
|
|
97
|
+
nextDep: s.hasNextDep,
|
|
98
|
+
nextConfig: s.hasNextConfig,
|
|
99
|
+
appDir: s.hasAppDir,
|
|
100
|
+
pagesDir: s.hasPagesDir,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const ROLE_PRIORITY = {
|
|
106
|
+
middleware: 7,
|
|
107
|
+
'route-handler': 6,
|
|
108
|
+
'server-action': 5,
|
|
109
|
+
page: 4,
|
|
110
|
+
layout: 3,
|
|
111
|
+
'client-component': 2,
|
|
112
|
+
'server-component': 1,
|
|
113
|
+
};
|
|
114
|
+
const ROLE_KIND = {
|
|
115
|
+
middleware: 'gateway',
|
|
116
|
+
'route-handler': 'gateway',
|
|
117
|
+
'server-action': 'gateway',
|
|
118
|
+
page: 'frontend',
|
|
119
|
+
layout: 'frontend',
|
|
120
|
+
'client-component': 'frontend',
|
|
121
|
+
'server-component': 'frontend',
|
|
122
|
+
};
|
|
123
|
+
// The route-tree RouteRole → the adapter's base NextRole.
|
|
124
|
+
const ROUTE_ROLE_TO_NEXT = {
|
|
125
|
+
page: 'page',
|
|
126
|
+
layout: 'layout',
|
|
127
|
+
endpoint: 'route-handler',
|
|
128
|
+
route: 'page', // generic routable — Next never emits it; map defensively
|
|
129
|
+
};
|
|
130
|
+
const SOURCE_EXT_SET = new Set(SOURCE_EXTENSIONS);
|
|
131
|
+
const MIDDLEWARE_NAMES = ['middleware.ts', 'middleware.js', 'middleware.tsx', 'middleware.jsx'];
|
|
132
|
+
// Memoized on the FrameworkContext OBJECT (not repoDir) so groupingPrior +
|
|
133
|
+
// syntheticEdges + roleTags share ONE analysis, while the merge walk's
|
|
134
|
+
// per-checkpoint ctx (same clone.dir, different tree) gets a fresh one — no
|
|
135
|
+
// cross-tree staleness. Mirrors the Nest / RN adapters.
|
|
136
|
+
const ANALYSIS_CACHE = new WeakMap();
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// Static helpers (install-free, deterministic).
|
|
139
|
+
function inScope(fileId, rootPath) {
|
|
140
|
+
if (rootPath === '')
|
|
141
|
+
return true;
|
|
142
|
+
return fileId === rootPath || fileId.startsWith(`${rootPath}/`);
|
|
143
|
+
}
|
|
144
|
+
function under(fileId, rootId) {
|
|
145
|
+
return fileId === rootId || fileId.startsWith(`${rootId}/`);
|
|
146
|
+
}
|
|
147
|
+
// Deterministic slug (camelCase → kebab, drop non-alnum).
|
|
148
|
+
function slugify(s) {
|
|
149
|
+
return s
|
|
150
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
151
|
+
.toLowerCase()
|
|
152
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
153
|
+
.replace(/^-+|-+$/g, '');
|
|
154
|
+
}
|
|
155
|
+
// Humanize a route segment into a subsystem label: drop dynamic/group brackets,
|
|
156
|
+
// split on separators, title-case ('blog' → 'Blog', '[slug]' → 'Slug').
|
|
157
|
+
function humanizeSegment(seg) {
|
|
158
|
+
const base = seg.replace(/[[\]().]/g, '').replace(/^\.\.\.|^\.\.|^\./, '');
|
|
159
|
+
const words = base
|
|
160
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
161
|
+
.replace(/[_-]+/g, ' ')
|
|
162
|
+
.trim()
|
|
163
|
+
.split(/\s+/)
|
|
164
|
+
.filter(Boolean);
|
|
165
|
+
if (words.length === 0)
|
|
166
|
+
return seg || 'Home';
|
|
167
|
+
return words.map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(' ');
|
|
168
|
+
}
|
|
169
|
+
// The module's directive: a top-of-module 'use client' / 'use server' is a
|
|
170
|
+
// directive prologue (the FIRST statement, comments aside — getStatements skips
|
|
171
|
+
// comments). Returns 'client' | 'server' | null.
|
|
172
|
+
function moduleDirective(sf) {
|
|
173
|
+
const first = sf.getStatements()[0];
|
|
174
|
+
if (!first || first.getKind() !== SyntaxKind.ExpressionStatement)
|
|
175
|
+
return null;
|
|
176
|
+
const expr = first.getExpression?.();
|
|
177
|
+
if (!expr || expr.getKind() !== SyntaxKind.StringLiteral)
|
|
178
|
+
return null;
|
|
179
|
+
const v = expr.getLiteralValue();
|
|
180
|
+
if (v === 'use client')
|
|
181
|
+
return 'client';
|
|
182
|
+
if (v === 'use server')
|
|
183
|
+
return 'server';
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
// Count function-level 'use server' directives (inline server actions) — a
|
|
187
|
+
// 'use server' string-literal expression statement whose parent is NOT the
|
|
188
|
+
// SourceFile (it sits inside a function/arrow body). These can't be statically
|
|
189
|
+
// linked across the client/server prop boundary → degrade + log.
|
|
190
|
+
function countInlineServerActions(sf) {
|
|
191
|
+
let n = 0;
|
|
192
|
+
for (const es of sf.getDescendantsOfKind(SyntaxKind.ExpressionStatement)) {
|
|
193
|
+
const expr = es.getExpression();
|
|
194
|
+
if (expr.getKind() !== SyntaxKind.StringLiteral)
|
|
195
|
+
continue;
|
|
196
|
+
if (expr.getLiteralValue() !== 'use server')
|
|
197
|
+
continue;
|
|
198
|
+
if (es.getParent()?.getKind() !== SyntaxKind.SourceFile)
|
|
199
|
+
n++;
|
|
200
|
+
}
|
|
201
|
+
return n;
|
|
202
|
+
}
|
|
203
|
+
function hasJsx(sf) {
|
|
204
|
+
return (sf.getFirstDescendantByKind(SyntaxKind.JsxElement) !== undefined ||
|
|
205
|
+
sf.getFirstDescendantByKind(SyntaxKind.JsxSelfClosingElement) !== undefined ||
|
|
206
|
+
sf.getFirstDescendantByKind(SyntaxKind.JsxFragment) !== undefined);
|
|
207
|
+
}
|
|
208
|
+
// Resolved INTERNAL import target file ids of one source file (install-free —
|
|
209
|
+
// getModuleSpecifierSourceFile is null for a bare external specifier).
|
|
210
|
+
function resolvedImports(sf, repoDir) {
|
|
211
|
+
const out = [];
|
|
212
|
+
for (const decl of sf.getImportDeclarations()) {
|
|
213
|
+
const resolved = decl.getModuleSpecifierSourceFile();
|
|
214
|
+
if (resolved)
|
|
215
|
+
out.push(toId(repoDir, resolved.getFilePath()));
|
|
216
|
+
}
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
219
|
+
// `fetch('/path')` string-literal arguments in one source file.
|
|
220
|
+
function collectFetchTargets(sf) {
|
|
221
|
+
const out = [];
|
|
222
|
+
for (const call of sf.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
223
|
+
const callee = call.getExpression();
|
|
224
|
+
// `fetch(…)` (global) — a `.fetch(…)` method call is out of scope.
|
|
225
|
+
if (callee.getKind() !== SyntaxKind.Identifier || callee.getText() !== 'fetch')
|
|
226
|
+
continue;
|
|
227
|
+
const arg = call.getArguments()[0];
|
|
228
|
+
if (arg && arg.getKind() === SyntaxKind.StringLiteral)
|
|
229
|
+
out.push(arg.getLiteralValue());
|
|
230
|
+
}
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
function keepHigher(map, fileId, role) {
|
|
234
|
+
const cur = map.get(fileId);
|
|
235
|
+
if (cur === undefined ||
|
|
236
|
+
ROLE_PRIORITY[role] > ROLE_PRIORITY[cur] ||
|
|
237
|
+
(ROLE_PRIORITY[role] === ROLE_PRIORITY[cur] && role < cur)) {
|
|
238
|
+
map.set(fileId, role);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function addEdge(edges, from, to, relation) {
|
|
242
|
+
if (from === to)
|
|
243
|
+
return; // intra-file collapses; the step drops self-edges too
|
|
244
|
+
const key = `${from}→${to}`;
|
|
245
|
+
if (!edges.has(key)) {
|
|
246
|
+
edges.set(key, { source: from, target: to, kind: 'calls', metadata: { framework: 'next', relation } });
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
// The full analysis.
|
|
251
|
+
function analyzeNext(ctx) {
|
|
252
|
+
const { repoDir, rootPath } = ctx;
|
|
253
|
+
// The in-scope base dir (a workspace package when rootPath is set).
|
|
254
|
+
const base = rootPath ? join(repoDir, rootPath) : repoDir;
|
|
255
|
+
const { appDirAbs, pagesDirAbs } = findNextRouteDirs(repoDir, rootPath);
|
|
256
|
+
const appRootId = appDirAbs ? toId(repoDir, appDirAbs) : null;
|
|
257
|
+
// --- the shared routing convention (route nodes + nav edges) -------------
|
|
258
|
+
const tree = extractNextRouteTree({ repoDir, rootPath });
|
|
259
|
+
const routeRoleByFile = new Map();
|
|
260
|
+
for (const node of tree?.routes ?? [])
|
|
261
|
+
routeRoleByFile.set(node.fileId, node);
|
|
262
|
+
// --- static directive / call-site scan over every in-scope source file ----
|
|
263
|
+
// Glob only the in-scope `base` (not the whole repo) so a per-package fan-out
|
|
264
|
+
// doesn't parse a whole monorepo per Next package; the project root
|
|
265
|
+
// stays `repoDir` so tsconfig path/baseUrl resolution + the repo-relative file
|
|
266
|
+
// ids are unchanged. `inScope` stays as a defensive filter.
|
|
267
|
+
const project = buildExtractionProject(repoDir);
|
|
268
|
+
addAllSourceFiles(project, base);
|
|
269
|
+
const fileById = new Map();
|
|
270
|
+
for (const sf of project.getSourceFiles()) {
|
|
271
|
+
const id = toId(repoDir, sf.getFilePath());
|
|
272
|
+
if (inScope(id, rootPath))
|
|
273
|
+
fileById.set(id, sf);
|
|
274
|
+
}
|
|
275
|
+
const directiveByFile = new Map();
|
|
276
|
+
let inlineServerActions = 0;
|
|
277
|
+
for (const [fileId, sf] of fileById) {
|
|
278
|
+
const dir = moduleDirective(sf);
|
|
279
|
+
if (dir)
|
|
280
|
+
directiveByFile.set(fileId, dir);
|
|
281
|
+
inlineServerActions += countInlineServerActions(sf);
|
|
282
|
+
}
|
|
283
|
+
// --- roles ---------------------------------------------------------------
|
|
284
|
+
const roleByFile = new Map();
|
|
285
|
+
// (1) route-tree structural roles (page / layout / route-handler).
|
|
286
|
+
for (const [fileId, node] of routeRoleByFile) {
|
|
287
|
+
keepHigher(roleByFile, fileId, ROUTE_ROLE_TO_NEXT[node.role] ?? 'page');
|
|
288
|
+
}
|
|
289
|
+
// (2) middleware.{ts,js} at the route base (root or src/).
|
|
290
|
+
for (const cand of MIDDLEWARE_NAMES) {
|
|
291
|
+
for (const sub of ['', 'src']) {
|
|
292
|
+
const abs = join(base, sub, cand);
|
|
293
|
+
if (existsSync(abs))
|
|
294
|
+
keepHigher(roleByFile, toId(repoDir, abs), 'middleware');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// (3) RSC directives. A module-level 'use server' is a server-actions module;
|
|
298
|
+
// 'use client' marks the client side of the boundary. A server component
|
|
299
|
+
// is the app/-dir default (a JSX component without an explicit directive).
|
|
300
|
+
for (const [fileId, sf] of fileById) {
|
|
301
|
+
const dir = directiveByFile.get(fileId);
|
|
302
|
+
if (dir === 'server')
|
|
303
|
+
keepHigher(roleByFile, fileId, 'server-action');
|
|
304
|
+
else if (dir === 'client')
|
|
305
|
+
keepHigher(roleByFile, fileId, 'client-component');
|
|
306
|
+
else if (appRootId && under(fileId, appRootId) && hasJsx(sf)) {
|
|
307
|
+
keepHigher(roleByFile, fileId, 'server-component');
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// Materialize role tags (carry rsc on routed nodes for the server/client read).
|
|
311
|
+
const roles = new Map();
|
|
312
|
+
for (const [fileId, role] of roleByFile) {
|
|
313
|
+
const node = routeRoleByFile.get(fileId);
|
|
314
|
+
const dir = directiveByFile.get(fileId);
|
|
315
|
+
const metadata = { framework: 'next' };
|
|
316
|
+
if (node) {
|
|
317
|
+
metadata.routePath = node.routePath;
|
|
318
|
+
if (node.parentFileId !== undefined)
|
|
319
|
+
metadata.parentFileId = node.parentFileId;
|
|
320
|
+
}
|
|
321
|
+
// RSC side: an explicit directive wins; else app/ defaults to server.
|
|
322
|
+
if (dir === 'client' || role === 'client-component')
|
|
323
|
+
metadata.rsc = 'client';
|
|
324
|
+
else if (dir === 'server')
|
|
325
|
+
metadata.rsc = 'server';
|
|
326
|
+
else if (appRootId && under(fileId, appRootId))
|
|
327
|
+
metadata.rsc = 'server';
|
|
328
|
+
roles.set(fileId, { role, kind: ROLE_KIND[role], priority: ROLE_PRIORITY[role], metadata });
|
|
329
|
+
}
|
|
330
|
+
// --- edges (kind 'calls' only) -------------------------------------------
|
|
331
|
+
const edges = new Map();
|
|
332
|
+
// (a) route navigation (from the shared route tree).
|
|
333
|
+
for (const e of tree?.navEdges ?? [])
|
|
334
|
+
addEdge(edges, e.fromFileId, e.toFileId, 'navigation');
|
|
335
|
+
// (b) client → Server-Action invocation: a 'use client' file that imports a
|
|
336
|
+
// module-level 'use server' actions module is invoking it across the RPC
|
|
337
|
+
// boundary. Import resolution IS the static evidence (you only import an
|
|
338
|
+
// action to call it).
|
|
339
|
+
for (const [fileId, sf] of fileById) {
|
|
340
|
+
if (directiveByFile.get(fileId) !== 'client')
|
|
341
|
+
continue;
|
|
342
|
+
for (const target of resolvedImports(sf, repoDir)) {
|
|
343
|
+
if (directiveByFile.get(target) === 'server')
|
|
344
|
+
addEdge(edges, fileId, target, 'server-action');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// (c) page → Route-Handler fetch: a statically-resolvable `fetch('/api/…')`
|
|
348
|
+
// whose path matches an endpoint route. Build a resolver over the endpoint
|
|
349
|
+
// nodes (relabelled `page` so the shared resolver — which only resolves
|
|
350
|
+
// page/route — includes them).
|
|
351
|
+
const endpoints = (tree?.routes ?? []).filter((r) => r.role === 'endpoint');
|
|
352
|
+
if (endpoints.length > 0) {
|
|
353
|
+
const resolveEndpoint = buildHrefResolver(endpoints.map((r) => ({ ...r, role: 'page' })));
|
|
354
|
+
for (const [fileId, sf] of fileById) {
|
|
355
|
+
for (const href of collectFetchTargets(sf)) {
|
|
356
|
+
const target = resolveEndpoint(href);
|
|
357
|
+
if (target)
|
|
358
|
+
addEdge(edges, fileId, target, 'route-handler-fetch');
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// --- grouping prior (route segment → group) ------------------------------
|
|
363
|
+
const groups = buildSegmentGroups(repoDir, appDirAbs, pagesDirAbs);
|
|
364
|
+
// Deterministic edge ordering.
|
|
365
|
+
const sortedEdges = [...edges.values()].sort((a, b) => a.source < b.source ? -1 : a.source > b.source ? 1 : a.target < b.target ? -1 : a.target > b.target ? 1 : 0);
|
|
366
|
+
// Positive signal for validation.
|
|
367
|
+
if (groups.length > 0 || roles.size > 0) {
|
|
368
|
+
console.log(` [next] ${tree?.routes.length ?? 0} route(s) → ${groups.length} segment group(s) · ${roles.size} role(s) · ${sortedEdges.length} edge(s)`);
|
|
369
|
+
}
|
|
370
|
+
// No silent caps: inline (function-level) server actions can't be statically
|
|
371
|
+
// linked across the client/server prop boundary.
|
|
372
|
+
if (inlineServerActions > 0) {
|
|
373
|
+
console.log(` [next] degraded: ${inlineServerActions} inline (function-level) server action(s) not statically linkable (logged, not silently dropped)`);
|
|
374
|
+
}
|
|
375
|
+
return { groups, edges: sortedEdges, roles };
|
|
376
|
+
}
|
|
377
|
+
// Build one FrameworkGroup per top-level route segment over EVERY file in the
|
|
378
|
+
// segment (page/layout/route + co-located components/helpers). App + Pages share
|
|
379
|
+
// the URL namespace, so a segment present in both (e.g. `api`) MERGES into one
|
|
380
|
+
// group. Deterministic id (path-slug, never an index) + sorted file ids.
|
|
381
|
+
function buildSegmentGroups(repoDir, appDirAbs, pagesDirAbs) {
|
|
382
|
+
const byId = new Map();
|
|
383
|
+
const add = (dirAbs, router) => {
|
|
384
|
+
if (!dirAbs)
|
|
385
|
+
return;
|
|
386
|
+
const rootId = toId(repoDir, dirAbs);
|
|
387
|
+
for (const fileId of walkNextSourceFiles(dirAbs, repoDir)) {
|
|
388
|
+
const relToRoot = fileId.slice(rootId.length + 1);
|
|
389
|
+
const key = nextSegmentKey(relToRoot, router);
|
|
390
|
+
const id = slugify(key) || 'root';
|
|
391
|
+
const label = key === '' ? 'Home' : humanizeSegment(key);
|
|
392
|
+
let g = byId.get(id);
|
|
393
|
+
if (!g) {
|
|
394
|
+
g = { label, files: new Set() };
|
|
395
|
+
byId.set(id, g);
|
|
396
|
+
}
|
|
397
|
+
g.files.add(fileId);
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
add(appDirAbs, 'app');
|
|
401
|
+
add(pagesDirAbs, 'pages');
|
|
402
|
+
return [...byId.entries()]
|
|
403
|
+
.map(([id, g]) => ({ id, label: g.label, fileIds: [...g.files].sort() }))
|
|
404
|
+
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
405
|
+
}
|
|
406
|
+
function getAnalysis(ctx) {
|
|
407
|
+
let a = ANALYSIS_CACHE.get(ctx);
|
|
408
|
+
if (!a) {
|
|
409
|
+
a = analyzeNext(ctx);
|
|
410
|
+
ANALYSIS_CACHE.set(ctx, a);
|
|
411
|
+
}
|
|
412
|
+
return a;
|
|
413
|
+
}
|
|
414
|
+
// ---------------------------------------------------------------------------
|
|
415
|
+
// The adapter.
|
|
416
|
+
export const nextAdapter = {
|
|
417
|
+
name: 'next',
|
|
418
|
+
async detect(ctx) {
|
|
419
|
+
const { base, rootPath } = resolveBase(ctx);
|
|
420
|
+
return scoreNext(gatherNextSignals(base), rootPath);
|
|
421
|
+
},
|
|
422
|
+
// one grouping prior per top-level route segment. The contribute-step
|
|
423
|
+
// makes each its own subsystem, AUTHORITATIVE over directory. No
|
|
424
|
+
// classificationsNeeded: segments are deterministic from the path (nothing to
|
|
425
|
+
// defer to the LLM classifier).
|
|
426
|
+
async groupingPrior(ctx) {
|
|
427
|
+
return { groups: getAnalysis(ctx).groups };
|
|
428
|
+
},
|
|
429
|
+
// route nav + client→server-action + page→route-handler fetch (file-id
|
|
430
|
+
// space; the step resolves to modules, drops self-edges, dedupes, 8-verb-validates).
|
|
431
|
+
// kind 'calls' only.
|
|
432
|
+
async syntheticEdges(ctx) {
|
|
433
|
+
return getAnalysis(ctx).edges;
|
|
434
|
+
},
|
|
435
|
+
// Page/Layout/Client/Server-Component → frontend; RouteHandler/
|
|
436
|
+
// ServerAction/Middleware → gateway. METADATA; the module's `kind` is unchanged.
|
|
437
|
+
async roleTags(ctx) {
|
|
438
|
+
return getAnalysis(ctx).roles;
|
|
439
|
+
},
|
|
440
|
+
// The hooks READ SOURCE ('use client'/'use server' directives, <Link href>,
|
|
441
|
+
// fetch()/redirect() call sites), so declare the source paths the diff-driven
|
|
442
|
+
// hosted walk must treat as framework-relevant. Never-store-source holds: read
|
|
443
|
+
// server-side, persist only the derived groups/edges/roles.
|
|
444
|
+
scansSourcePath(path) {
|
|
445
|
+
const ext = path.split('.').pop();
|
|
446
|
+
return ext !== undefined && SOURCE_EXT_SET.has(ext);
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
//# sourceMappingURL=next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../../../src/framework/next/next.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,uEAAuE;AACvE,oDAAoD;AACpD,EAAE;AACF,qEAAqE;AACrE,6EAA6E;AAC7E,gCAAgC;AAChC,EAAE;AACF,oEAAoE;AACpE,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,qFAAqF;AACrF,gFAAgF;AAChF,iFAAiF;AACjF,mFAAmF;AACnF,+EAA+E;AAC/E,oEAAoE;AACpE,2EAA2E;AAC3E,kFAAkF;AAClF,6EAA6E;AAC7E,mFAAmF;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24 @@
|
|
|
1
|
+
import type { DetectMatch, FrameworkAdapter } from '../types.js';
|
|
2
|
+
declare const NODE_FRAMEWORKS: readonly ["express", "fastify", "koa", "hono"];
|
|
3
|
+
export type NodeFramework = (typeof NODE_FRAMEWORKS)[number];
|
|
4
|
+
/** The deterministic Node-backend signal set: which server framework deps are present. */
|
|
5
|
+
export interface NodeSignals {
|
|
6
|
+
/** Matched server-framework deps, in NODE_FRAMEWORKS priority order. */
|
|
7
|
+
frameworks: NodeFramework[];
|
|
8
|
+
}
|
|
9
|
+
/** Gather the signal set for a single root dir (fs only). */
|
|
10
|
+
export declare function gatherNodeSignals(baseDir: string): NodeSignals;
|
|
11
|
+
/**
|
|
12
|
+
* Decide Node-backend from the signal set. Returns a DetectMatch, or null when
|
|
13
|
+
* no server-framework dep is present (generic-TS fallthrough intact).
|
|
14
|
+
*
|
|
15
|
+
* Each server-framework dep is SUFFICIENT (authoritative). A single dep scores
|
|
16
|
+
* the base confidence; co-present frameworks (a repo mounting more than one)
|
|
17
|
+
* nudge it up — there's no config file to corroborate, so deps are the whole
|
|
18
|
+
* rubric. `variant` is the priority-primary framework; `frameworks` lists all.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scoreNode(s: NodeSignals, rootPath?: string): DetectMatch | null;
|
|
21
|
+
export type NodeRole = 'entrypoint' | 'route-handler' | 'controller' | 'middleware' | 'service';
|
|
22
|
+
export declare const nodeAdapter: FrameworkAdapter;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/framework/node/node.ts"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAOjB,MAAM,aAAa,CAAC;AAMrB,QAAA,MAAM,eAAe,gDAAiD,CAAC;AACvE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,0FAA0F;AAC1F,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,UAAU,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAG9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,SAAK,GAAG,WAAW,GAAG,IAAI,CAa3E;AAsBD,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;AA+9BhG,eAAO,MAAM,WAAW,EAAE,gBAqCzB,CAAC"}
|