@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,523 @@
|
|
|
1
|
+
// the Vercel InfraAdapter (v0).
|
|
2
|
+
//
|
|
3
|
+
// Surfaces the Vercel deployment topology from declared config: a `static-site`
|
|
4
|
+
// node for the app/deployment, a `worker` node per serverless/edge function
|
|
5
|
+
// (API routes + middleware), an optional `cdn` node for the Vercel Edge Network,
|
|
6
|
+
// and `calls` edges from cron schedules to their target function nodes.
|
|
7
|
+
//
|
|
8
|
+
// Everything here is `declared` provenance: vercel.json names functions, crons,
|
|
9
|
+
// and regions; the file-walk finds route handlers by path convention; package.json
|
|
10
|
+
// declares the framework; next.config.* reveals the output mode. No LLM is needed
|
|
11
|
+
// (tight static model → `classificationsNeeded: []`).
|
|
12
|
+
//
|
|
13
|
+
// Kind mapping (frozen 8-kind InfraModuleKind enum — we map onto it, never
|
|
14
|
+
// weaken it):
|
|
15
|
+
// Vercel app / deployment → static-site (the CDN-fronted build artefact;
|
|
16
|
+
// even for SSR apps the *deployment unit* as a whole is static-site because
|
|
17
|
+
// the individual function shards are represented separately as `worker` nodes)
|
|
18
|
+
// Serverless / edge function (API route, middleware) → worker
|
|
19
|
+
// Vercel Edge Network (CDN front-door) → cdn
|
|
20
|
+
//
|
|
21
|
+
// Edge verbs used:
|
|
22
|
+
// app → cdn : deploys-to (the app is deployed behind the Edge Network)
|
|
23
|
+
// cdn → function : calls (the CDN routes requests to the function)
|
|
24
|
+
// app → function : calls (cron scheduler invokes the function directly,
|
|
25
|
+
// no CDN indirection — modelled as app→fn)
|
|
26
|
+
//
|
|
27
|
+
// v0 scope notes:
|
|
28
|
+
// * Environment / preview deployments are NOT split; we capture the production
|
|
29
|
+
// topology only.
|
|
30
|
+
// * `next.config.*` is parsed by regex heuristic — we do NOT execute it.
|
|
31
|
+
// * Rewrites / headers are captured as metadata on the app node, not topology.
|
|
32
|
+
// * Monorepo layouts (multiple vercel.json files) are supported by the
|
|
33
|
+
// bounded file-walk; each produces separate app nodes keyed by dir.
|
|
34
|
+
// * `vercel.json` `builds` (legacy Vercel v1/v2) are ignored in v0.
|
|
35
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
36
|
+
import { join, relative, dirname } from 'node:path';
|
|
37
|
+
import { walkRepo } from '../walk.js';
|
|
38
|
+
import { parseVercelJson, parsePackageJson, parseNextConfigOutputMode, routeFileToPath, routePathToLabel, } from './vercel-parse.js';
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// File-walk configuration.
|
|
41
|
+
const VERCEL_SKIP_DIRS = [
|
|
42
|
+
'node_modules',
|
|
43
|
+
'.git',
|
|
44
|
+
'dist',
|
|
45
|
+
'.vercel',
|
|
46
|
+
'.next',
|
|
47
|
+
'build',
|
|
48
|
+
'coverage',
|
|
49
|
+
'.wrangler',
|
|
50
|
+
'out',
|
|
51
|
+
];
|
|
52
|
+
// Files we look for at each directory level.
|
|
53
|
+
const VERCEL_CONFIG_NAME = 'vercel.json';
|
|
54
|
+
const NEXT_CONFIG_NAMES = ['next.config.js', 'next.config.ts', 'next.config.mjs', 'next.config.cjs'];
|
|
55
|
+
const PACKAGE_JSON_NAME = 'package.json';
|
|
56
|
+
// Route files we collect during the fs walk.
|
|
57
|
+
const ROUTE_RE = /^route\.[jt]sx?$/;
|
|
58
|
+
const API_FILE_RE = /\.[jt]sx?$/;
|
|
59
|
+
const MAX_DEPTH = 6;
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Fs helpers.
|
|
62
|
+
function readText(path) {
|
|
63
|
+
try {
|
|
64
|
+
return readFileSync(path, 'utf8');
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
// Config-file discovery.
|
|
72
|
+
/**
|
|
73
|
+
* Locate every directory that contains a vercel.json (signals a deployment
|
|
74
|
+
* root), plus the repo root itself if it has a package.json with a Vercel-
|
|
75
|
+
* deployable framework (so a bare Next.js project with no vercel.json still
|
|
76
|
+
* gets picked up — the deploy-to-Vercel convention doesn't require the file).
|
|
77
|
+
*
|
|
78
|
+
* Returns an array of absolute directory paths deduplicated and sorted.
|
|
79
|
+
*/
|
|
80
|
+
function findProjectRoots(repoDir) {
|
|
81
|
+
const roots = new Set();
|
|
82
|
+
// A directory is a project root if it directly contains a vercel.json or a
|
|
83
|
+
// next.config.* — equivalently, for each such file we found, its parent dir
|
|
84
|
+
// is a root. (The legacy walk added `dir`; dirname(file) is the same dir.)
|
|
85
|
+
walkRepo(repoDir, {
|
|
86
|
+
skipDirs: VERCEL_SKIP_DIRS,
|
|
87
|
+
maxDepth: MAX_DEPTH,
|
|
88
|
+
onFile: (abs, e) => {
|
|
89
|
+
if (!e.isFile())
|
|
90
|
+
return;
|
|
91
|
+
if (e.name === VERCEL_CONFIG_NAME || NEXT_CONFIG_NAMES.includes(e.name)) {
|
|
92
|
+
roots.add(dirname(abs));
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
// Always include the repo root if it carries a package.json with a Vercel
|
|
97
|
+
// framework dep — catches "no vercel.json, no next.config.*" setups.
|
|
98
|
+
if (existsSync(join(repoDir, PACKAGE_JSON_NAME))) {
|
|
99
|
+
const text = readText(join(repoDir, PACKAGE_JSON_NAME));
|
|
100
|
+
if (text) {
|
|
101
|
+
try {
|
|
102
|
+
const info = parsePackageJson(text);
|
|
103
|
+
if (info.detectedFramework || info.hasVercelDep)
|
|
104
|
+
roots.add(repoDir);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// ignore malformed package.json at root for detection
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return [...roots].sort();
|
|
112
|
+
}
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
// API route collector.
|
|
115
|
+
//
|
|
116
|
+
// Walks the `pages/api/` and `app/` directories under the project root looking
|
|
117
|
+
// for route handler files. Returns repo-relative paths.
|
|
118
|
+
function collectRouteFiles(projectDir, repoDir) {
|
|
119
|
+
const files = [];
|
|
120
|
+
// pages/api/** — any .ts/.js/.tsx/.jsx file
|
|
121
|
+
const pagesApi = join(projectDir, 'pages', 'api');
|
|
122
|
+
const srcPagesApi = join(projectDir, 'src', 'pages', 'api');
|
|
123
|
+
for (const apiDir of [pagesApi, srcPagesApi]) {
|
|
124
|
+
if (!existsSync(apiDir))
|
|
125
|
+
continue;
|
|
126
|
+
walkRepo(apiDir, {
|
|
127
|
+
skipDirs: VERCEL_SKIP_DIRS,
|
|
128
|
+
maxDepth: 4,
|
|
129
|
+
onFile: (abs, e) => {
|
|
130
|
+
if (e.isFile() && API_FILE_RE.test(e.name)) {
|
|
131
|
+
files.push(relative(repoDir, abs).replace(/\\/g, '/'));
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
// app/**/route.ts — App Router convention
|
|
137
|
+
const appDir = join(projectDir, 'app');
|
|
138
|
+
const srcAppDir = join(projectDir, 'src', 'app');
|
|
139
|
+
for (const aDir of [appDir, srcAppDir]) {
|
|
140
|
+
if (!existsSync(aDir))
|
|
141
|
+
continue;
|
|
142
|
+
walkRepo(aDir, {
|
|
143
|
+
skipDirs: VERCEL_SKIP_DIRS,
|
|
144
|
+
maxDepth: 8,
|
|
145
|
+
onFile: (abs, e) => {
|
|
146
|
+
if (e.isFile() && ROUTE_RE.test(e.name)) {
|
|
147
|
+
files.push(relative(repoDir, abs).replace(/\\/g, '/'));
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// middleware.ts at project root (and src/ variant)
|
|
153
|
+
for (const middlewarePath of [
|
|
154
|
+
join(projectDir, 'middleware.ts'),
|
|
155
|
+
join(projectDir, 'middleware.js'),
|
|
156
|
+
join(projectDir, 'src', 'middleware.ts'),
|
|
157
|
+
join(projectDir, 'src', 'middleware.js'),
|
|
158
|
+
]) {
|
|
159
|
+
if (existsSync(middlewarePath)) {
|
|
160
|
+
files.push(relative(repoDir, middlewarePath).replace(/\\/g, '/'));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return [...new Set(files)].sort();
|
|
164
|
+
}
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Node-id helpers. Ids are adapter-local (registry prefixes `vercel:`).
|
|
167
|
+
function appId(projectDir, repoDir) {
|
|
168
|
+
const rel = relative(repoDir, projectDir) || '.';
|
|
169
|
+
return `app:${rel}`;
|
|
170
|
+
}
|
|
171
|
+
function fnId(routePath, projectDir, repoDir) {
|
|
172
|
+
// Namespace by project dir so two monorepo projects exposing the same route
|
|
173
|
+
// path produce distinct nodes rather than collapsing into one (which would
|
|
174
|
+
// dangle/misattribute edges). Format: fn:<projectRel>:<routeSegment>
|
|
175
|
+
const projectRel = relative(repoDir, projectDir) || '.';
|
|
176
|
+
const segment = routePath === '/' ? 'middleware' : routePath;
|
|
177
|
+
return `fn:${projectRel}:${segment}`;
|
|
178
|
+
}
|
|
179
|
+
const EDGE_NETWORK_ID = 'edge-network';
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
// Source-root helpers. Repo-relative, normalized — same idiom as
|
|
182
|
+
// netlify.ts / compose.ts.
|
|
183
|
+
/** Normalize a repo-relative path: backslashes→/, collapse `.`/`./`, strip trailing `/`. */
|
|
184
|
+
function normalizeRoot(p) {
|
|
185
|
+
return p.replace(/\\/g, '/').replace(/^\.(?:\/|$)/, '').replace(/\/+$/, '');
|
|
186
|
+
}
|
|
187
|
+
/** The repo-relative directory of a repo-relative file path ('' = repo root). */
|
|
188
|
+
function dirOf(relPath) {
|
|
189
|
+
const i = relPath.lastIndexOf('/');
|
|
190
|
+
return i === -1 ? '' : relPath.slice(0, i);
|
|
191
|
+
}
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
// Glob matching for vercel.json `functions` keys.
|
|
194
|
+
//
|
|
195
|
+
// Keys in vercel.json `functions` are glob patterns (e.g. "app/api/**",
|
|
196
|
+
// "api/*.js"). We need to match a concrete file path against these patterns.
|
|
197
|
+
// Supported glob syntax (covering the Vercel docs examples):
|
|
198
|
+
// ** — matches any number of path segments (including zero)
|
|
199
|
+
// * — matches any characters within a single path segment (not /)
|
|
200
|
+
// No external dep: implemented as a small regex transpiler.
|
|
201
|
+
function globToRegex(pattern) {
|
|
202
|
+
// Escape regex metacharacters except * which we handle specially.
|
|
203
|
+
let re = '';
|
|
204
|
+
let i = 0;
|
|
205
|
+
while (i < pattern.length) {
|
|
206
|
+
if (pattern[i] === '*' && pattern[i + 1] === '*') {
|
|
207
|
+
// `**` matches zero or more path segments.
|
|
208
|
+
re += '.*';
|
|
209
|
+
i += 2;
|
|
210
|
+
// Consume a trailing slash after ** if present so "app/api/**" matches
|
|
211
|
+
// "app/api/foo" (no double-slash in the regex).
|
|
212
|
+
if (pattern[i] === '/')
|
|
213
|
+
i++;
|
|
214
|
+
}
|
|
215
|
+
else if (pattern[i] === '*') {
|
|
216
|
+
// `*` matches anything except a slash.
|
|
217
|
+
re += '[^/]*';
|
|
218
|
+
i++;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
// Escape regex special chars.
|
|
222
|
+
re += pattern[i].replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
223
|
+
i++;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return new RegExp(`^${re}$`);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Find the first vercel.json `functions` entry whose key (a glob) matches
|
|
230
|
+
* the given repo-relative file path. Returns the config or undefined.
|
|
231
|
+
*/
|
|
232
|
+
function matchFunctionConfig(functions, filePath) {
|
|
233
|
+
for (const [pattern, cfg] of Object.entries(functions)) {
|
|
234
|
+
if (globToRegex(pattern).test(filePath))
|
|
235
|
+
return cfg;
|
|
236
|
+
}
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
// Pure builder.
|
|
241
|
+
/**
|
|
242
|
+
* Build an InfraGraph from already-collected Vercel project inputs.
|
|
243
|
+
* Separated from fs IO so it can be unit-tested with synthetic inputs.
|
|
244
|
+
*/
|
|
245
|
+
export function buildVercelGraph(inputs, root) {
|
|
246
|
+
const nodes = new Map();
|
|
247
|
+
const edges = [];
|
|
248
|
+
const addNode = (n) => {
|
|
249
|
+
if (!nodes.has(n.id))
|
|
250
|
+
nodes.set(n.id, n);
|
|
251
|
+
};
|
|
252
|
+
const addEdge = (e) => edges.push(e);
|
|
253
|
+
// Emit the shared CDN node once — only if any project root has a Vercel
|
|
254
|
+
// deployment (not a purely static export, which bypasses the CDN layer).
|
|
255
|
+
let needCdn = false;
|
|
256
|
+
for (const p of inputs) {
|
|
257
|
+
if (p.nextOutputMode !== 'export')
|
|
258
|
+
needCdn = true;
|
|
259
|
+
}
|
|
260
|
+
if (needCdn) {
|
|
261
|
+
addNode({
|
|
262
|
+
id: EDGE_NETWORK_ID,
|
|
263
|
+
label: 'Vercel Edge Network',
|
|
264
|
+
kind: 'cdn',
|
|
265
|
+
provenance: 'declared',
|
|
266
|
+
metadata: { provider: 'vercel' },
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
for (const project of inputs) {
|
|
270
|
+
const aId = appId(project.projectDir, root);
|
|
271
|
+
const cfg = project.vercelConfig ?? {};
|
|
272
|
+
const pkg = project.packageInfo ?? { hasVercelDep: false };
|
|
273
|
+
// Determine a readable label for the app node.
|
|
274
|
+
const appLabel = pkg.name ??
|
|
275
|
+
(relative(root, project.projectDir) || 'app');
|
|
276
|
+
// Build metadata for the app node — keep under ~500 bytes.
|
|
277
|
+
const appMeta = {
|
|
278
|
+
provider: 'vercel',
|
|
279
|
+
...(project.vercelJsonPath ? { config: project.vercelJsonPath } : {}),
|
|
280
|
+
...(cfg.framework ? { framework: cfg.framework } : {}),
|
|
281
|
+
...(pkg.detectedFramework ? { detectedFramework: pkg.detectedFramework } : {}),
|
|
282
|
+
...(project.nextOutputMode ? { outputMode: project.nextOutputMode } : {}),
|
|
283
|
+
...(cfg.regions?.length ? { regions: cfg.regions } : {}),
|
|
284
|
+
};
|
|
285
|
+
// the app's source root: its deployment-root dir (repo-relative).
|
|
286
|
+
// For a monorepo app (apps/web) that's the project dir; for a root project
|
|
287
|
+
// it would be '' (a catch-all that swallows the function units + any sibling
|
|
288
|
+
// provider's code) — so we mirror the netlify base→root guard: fall back to
|
|
289
|
+
// `src/` if it exists, else emit no source root (loose code honestly stays
|
|
290
|
+
// "Other"). Per-function dirs are deeper, so they out-rank this by the
|
|
291
|
+
// longest-prefix rule.
|
|
292
|
+
const projectRel = normalizeRoot(relative(root, project.projectDir));
|
|
293
|
+
let appRoots = [];
|
|
294
|
+
if (projectRel)
|
|
295
|
+
appRoots = [projectRel];
|
|
296
|
+
else if (project.srcExists)
|
|
297
|
+
appRoots = ['src'];
|
|
298
|
+
addNode({
|
|
299
|
+
id: aId,
|
|
300
|
+
label: appLabel,
|
|
301
|
+
kind: 'static-site',
|
|
302
|
+
provenance: 'declared',
|
|
303
|
+
metadata: appMeta,
|
|
304
|
+
...(appRoots.length ? { sourceRoots: appRoots } : {}),
|
|
305
|
+
});
|
|
306
|
+
// The app deploys-to the Edge Network (unless it's a pure static export).
|
|
307
|
+
if (project.nextOutputMode !== 'export' && needCdn) {
|
|
308
|
+
addEdge({
|
|
309
|
+
source: aId,
|
|
310
|
+
target: EDGE_NETWORK_ID,
|
|
311
|
+
kind: 'deploys-to',
|
|
312
|
+
metadata: { provider: 'vercel' },
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
// --- Serverless / edge function nodes from route files ---
|
|
316
|
+
for (const relPath of project.routeFiles) {
|
|
317
|
+
const routePath = routeFileToPath(relPath);
|
|
318
|
+
const isMiddleware = routePath === '/';
|
|
319
|
+
const label = routePathToLabel(routePath, isMiddleware);
|
|
320
|
+
const id = fnId(routePath, project.projectDir, root);
|
|
321
|
+
// Function-level metadata from vercel.json `functions` block (if present).
|
|
322
|
+
// Keys in vercel.json `functions` can be glob patterns — match with the
|
|
323
|
+
// glob helper rather than exact-key lookup.
|
|
324
|
+
const fnCfg = cfg.functions ? matchFunctionConfig(cfg.functions, relPath) : undefined;
|
|
325
|
+
// the function's source root: its route file's dir, for clean
|
|
326
|
+
// per-function attribution (app/api/users/route.ts → app/api/users). A
|
|
327
|
+
// route file at the repo root (dir '') yields none (no catch-all) — e.g.
|
|
328
|
+
// a root middleware.ts must not claim the whole repo.
|
|
329
|
+
const fnDir = normalizeRoot(dirOf(relPath));
|
|
330
|
+
const fnNode = {
|
|
331
|
+
id,
|
|
332
|
+
label,
|
|
333
|
+
kind: 'worker',
|
|
334
|
+
provenance: 'declared',
|
|
335
|
+
metadata: {
|
|
336
|
+
file: relPath,
|
|
337
|
+
routePath,
|
|
338
|
+
...(isMiddleware ? { isMiddleware: true } : {}),
|
|
339
|
+
// Use explicit `!== undefined` guards so that legitimate 0 values
|
|
340
|
+
// (e.g. memory: 0, maxDuration: 0) are not silently dropped.
|
|
341
|
+
...(fnCfg?.runtime !== undefined ? { runtime: fnCfg.runtime } : {}),
|
|
342
|
+
...(fnCfg?.memory !== undefined ? { memory: fnCfg.memory } : {}),
|
|
343
|
+
...(fnCfg?.maxDuration !== undefined ? { maxDuration: fnCfg.maxDuration } : {}),
|
|
344
|
+
...(fnCfg?.regions !== undefined ? { regions: fnCfg.regions } : {}),
|
|
345
|
+
},
|
|
346
|
+
...(fnDir ? { sourceRoots: [fnDir] } : {}),
|
|
347
|
+
};
|
|
348
|
+
addNode(fnNode);
|
|
349
|
+
// CDN routes requests to the function.
|
|
350
|
+
if (needCdn && !isMiddleware) {
|
|
351
|
+
addEdge({
|
|
352
|
+
source: EDGE_NETWORK_ID,
|
|
353
|
+
target: id,
|
|
354
|
+
kind: 'calls',
|
|
355
|
+
metadata: { via: 'vercel-routing', routePath },
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// --- Cron edges: scheduler calls the target function ---
|
|
360
|
+
// vercel.json `crons` entries name a `path`; the scheduler invokes that
|
|
361
|
+
// function on a schedule. Model as: app --calls--> fn (the cron is a
|
|
362
|
+
// Vercel platform mechanism, not a separate node in v0).
|
|
363
|
+
for (const cron of cfg.crons ?? []) {
|
|
364
|
+
const cronRoutePath = cron.path.startsWith('/') ? cron.path : `/${cron.path}`;
|
|
365
|
+
const targetId = fnId(cronRoutePath, project.projectDir, root);
|
|
366
|
+
// Ensure the target function node exists even if not found in the
|
|
367
|
+
// file-walk (e.g., a cron targeting a route not present in the repo
|
|
368
|
+
// snapshot — still emit the node so the edge endpoint resolves).
|
|
369
|
+
if (!nodes.has(targetId)) {
|
|
370
|
+
addNode({
|
|
371
|
+
id: targetId,
|
|
372
|
+
label: routePathToLabel(cronRoutePath),
|
|
373
|
+
kind: 'worker',
|
|
374
|
+
provenance: 'declared',
|
|
375
|
+
metadata: { routePath: cronRoutePath, source: 'vercel.json-cron' },
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
addEdge({
|
|
379
|
+
source: aId,
|
|
380
|
+
target: targetId,
|
|
381
|
+
kind: 'calls',
|
|
382
|
+
metadata: { via: 'vercel-cron', schedule: cron.schedule, path: cron.path },
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
root,
|
|
388
|
+
adapter: 'vercel',
|
|
389
|
+
nodes: [...nodes.values()],
|
|
390
|
+
edges,
|
|
391
|
+
classificationsNeeded: [], // Vercel's model maps statically — no LLM needed
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
// ---------------------------------------------------------------------------
|
|
395
|
+
// Detect + extract helpers.
|
|
396
|
+
function isVercelProject(dir) {
|
|
397
|
+
if (existsSync(join(dir, VERCEL_CONFIG_NAME)))
|
|
398
|
+
return true;
|
|
399
|
+
if (NEXT_CONFIG_NAMES.some((n) => existsSync(join(dir, n))))
|
|
400
|
+
return true;
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
function loadProjectInputs(projectDir, repoDir) {
|
|
404
|
+
const result = { projectDir, routeFiles: [] };
|
|
405
|
+
// vercel.json
|
|
406
|
+
const vercelJsonAbs = join(projectDir, VERCEL_CONFIG_NAME);
|
|
407
|
+
if (existsSync(vercelJsonAbs)) {
|
|
408
|
+
result.vercelJsonPath = relative(repoDir, vercelJsonAbs).replace(/\\/g, '/');
|
|
409
|
+
const text = readText(vercelJsonAbs);
|
|
410
|
+
if (text) {
|
|
411
|
+
try {
|
|
412
|
+
result.vercelConfig = parseVercelJson(text);
|
|
413
|
+
}
|
|
414
|
+
catch (err) {
|
|
415
|
+
console.warn(` [vercel] skipping unparseable ${result.vercelJsonPath}: ${err.message}`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
// package.json
|
|
420
|
+
const pkgAbs = join(projectDir, PACKAGE_JSON_NAME);
|
|
421
|
+
if (existsSync(pkgAbs)) {
|
|
422
|
+
const text = readText(pkgAbs);
|
|
423
|
+
if (text) {
|
|
424
|
+
try {
|
|
425
|
+
result.packageInfo = parsePackageJson(text);
|
|
426
|
+
}
|
|
427
|
+
catch (err) {
|
|
428
|
+
console.warn(` [vercel] skipping unparseable ${relative(repoDir, pkgAbs)}: ${err.message}`);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
// next.config.* — check each candidate, parse the first found
|
|
433
|
+
for (const cfgName of NEXT_CONFIG_NAMES) {
|
|
434
|
+
const abs = join(projectDir, cfgName);
|
|
435
|
+
if (!existsSync(abs))
|
|
436
|
+
continue;
|
|
437
|
+
const text = readText(abs);
|
|
438
|
+
if (text) {
|
|
439
|
+
result.nextOutputMode = parseNextConfigOutputMode(text);
|
|
440
|
+
}
|
|
441
|
+
break; // only read one
|
|
442
|
+
}
|
|
443
|
+
// API route files
|
|
444
|
+
result.routeFiles = collectRouteFiles(projectDir, repoDir);
|
|
445
|
+
// the src/ fallback signal for the app source root (root projects).
|
|
446
|
+
result.srcExists = existsSync(join(projectDir, 'src'));
|
|
447
|
+
return result;
|
|
448
|
+
}
|
|
449
|
+
// ---------------------------------------------------------------------------
|
|
450
|
+
// source-path predicate for the diff-driven hosted walk.
|
|
451
|
+
//
|
|
452
|
+
// This adapter reads ordinary application source — the route-handler files
|
|
453
|
+
// collected by collectRouteFiles (app-router `**/route.[jt]sx?`, `pages/api/**`
|
|
454
|
+
// JS/TS files, and `middleware.[jt]s`, each optionally under a `src/` root and
|
|
455
|
+
// at any monorepo project depth). A change to any of those CAN change the
|
|
456
|
+
// worker-node set / edges, so the carried infra graph would go stale unless we
|
|
457
|
+
// force a re-extract. This predicate mirrors collectRouteFiles' file matchers
|
|
458
|
+
// (kept adjacent so the two don't drift). The framework-detection inputs
|
|
459
|
+
// (package.json / next.config.* / vercel.json) are config — already covered by
|
|
460
|
+
// relevance.ts' diffTouchesInfra + the container's config-invalidator gate — so
|
|
461
|
+
// they're intentionally NOT included here.
|
|
462
|
+
//
|
|
463
|
+
// Matched against a repo-relative POSIX path at any segment depth:
|
|
464
|
+
// - `**/route.{js,jsx,ts,tsx}` (App Router handlers)
|
|
465
|
+
// - `**/pages/api/**/*.{js,jsx,ts,tsx}` (Pages API routes)
|
|
466
|
+
// - `**/middleware.{js,jsx,ts,tsx}` (edge middleware)
|
|
467
|
+
const VERCEL_ROUTE_FILE_RE = /(?:^|\/)route\.[jt]sx?$/;
|
|
468
|
+
const VERCEL_PAGES_API_RE = /(?:^|\/)pages\/api\/.*\.[jt]sx?$/;
|
|
469
|
+
const VERCEL_MIDDLEWARE_RE = /(?:^|\/)middleware\.[jt]sx?$/;
|
|
470
|
+
export function vercelScansSourcePath(path) {
|
|
471
|
+
return (VERCEL_ROUTE_FILE_RE.test(path) ||
|
|
472
|
+
VERCEL_PAGES_API_RE.test(path) ||
|
|
473
|
+
VERCEL_MIDDLEWARE_RE.test(path));
|
|
474
|
+
}
|
|
475
|
+
// ---------------------------------------------------------------------------
|
|
476
|
+
// Exported adapter.
|
|
477
|
+
export const vercelAdapter = {
|
|
478
|
+
name: 'vercel',
|
|
479
|
+
scansSourcePath: vercelScansSourcePath,
|
|
480
|
+
async detect(repoDir) {
|
|
481
|
+
// A real Vercel signal is required: vercel.json, next.config.*, OR a
|
|
482
|
+
// package.json whose parsed deps indicate a Vercel-deployable framework
|
|
483
|
+
// (next/nuxt/sveltekit/astro/remix) or an explicit `vercel`/`@vercel/*`
|
|
484
|
+
// dep. A bare package.json with no framework/Vercel dep must NOT match —
|
|
485
|
+
// this mirrors the CF adapter's gating logic to avoid false-positive fires
|
|
486
|
+
// on plain Express / CLI / library repos.
|
|
487
|
+
const roots = findProjectRoots(repoDir);
|
|
488
|
+
if (roots.some((r) => isVercelProject(r)))
|
|
489
|
+
return true;
|
|
490
|
+
// findProjectRoots already vetted the package.json at repoDir for
|
|
491
|
+
// framework/vercelDep before adding it — so if repoDir is in roots AND
|
|
492
|
+
// is not an isVercelProject hit, it was added because the package.json
|
|
493
|
+
// carried a real Vercel/framework signal.
|
|
494
|
+
if (roots.includes(repoDir)) {
|
|
495
|
+
const text = readText(join(repoDir, PACKAGE_JSON_NAME));
|
|
496
|
+
if (text) {
|
|
497
|
+
try {
|
|
498
|
+
const info = parsePackageJson(text);
|
|
499
|
+
if (info.detectedFramework || info.hasVercelDep)
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
502
|
+
catch {
|
|
503
|
+
// ignore
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return false;
|
|
508
|
+
},
|
|
509
|
+
async extract(repoDir) {
|
|
510
|
+
const roots = findProjectRoots(repoDir);
|
|
511
|
+
const inputs = [];
|
|
512
|
+
for (const dir of roots) {
|
|
513
|
+
try {
|
|
514
|
+
inputs.push(loadProjectInputs(dir, repoDir));
|
|
515
|
+
}
|
|
516
|
+
catch (err) {
|
|
517
|
+
console.warn(` [vercel] skipping project at ${relative(repoDir, dir)}: ${err.message}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return buildVercelGraph(inputs, repoDir);
|
|
521
|
+
},
|
|
522
|
+
};
|
|
523
|
+
//# sourceMappingURL=vercel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel.js","sourceRoot":"","sources":["../../../src/infra/vercel/vercel.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,iFAAiF;AACjF,wEAAwE;AACxE,EAAE;AACF,gFAAgF;AAChF,mFAAmF;AACnF,kFAAkF;AAClF,sDAAsD;AACtD,EAAE;AACF,2EAA2E;AAC3E,cAAc;AACd,4EAA4E;AAC5E,gFAAgF;AAChF,mFAAmF;AACnF,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,mBAAmB;AACnB,iFAAiF;AACjF,6EAA6E;AAC7E,kFAAkF;AAClF,6EAA6E;AAC7E,EAAE;AACF,kBAAkB;AAClB,iFAAiF;AACjF,qBAAqB;AACrB,2EAA2E;AAC3E,iFAAiF;AACjF,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AAEtE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,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AM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;oBACpC,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,YAAY;wBAAE,OAAO,IAAI,CAAC;gBAC/D,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAe;QAC3B,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,MAAM,GAA0B,EAAE,CAAC;QACzC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC;gBACH,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;YAC/C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC,kCAAkC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YACtG,CAAC;QACH,CAAC;QACD,OAAO,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type Dirent } from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* The skip-set shared by the majority of adapters (cloudflare, supabase, fly,
|
|
4
|
+
* render). Adapters needing provider-specific extras (terraform → `.terraform`,
|
|
5
|
+
* vercel → `.vercel`/`out`, pulumi → `.pulumi`, railway → `.nixpacks`, the
|
|
6
|
+
* cloud adapters → `__pycache__`/`.venv`/`vendor`) pass their own `skipDirs`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_SKIP_DIRS: readonly string[];
|
|
9
|
+
export interface WalkRepoOptions {
|
|
10
|
+
/** Directory names pruned from the walk (matched on basename). Defaults to {@link DEFAULT_SKIP_DIRS}. */
|
|
11
|
+
skipDirs?: Iterable<string>;
|
|
12
|
+
/** Maximum recursion depth (root is depth 0). Defaults to 8. */
|
|
13
|
+
maxDepth?: number;
|
|
14
|
+
/** Invoked for every file reached. `dirent` is the file's Dirent (carries `.name`). */
|
|
15
|
+
onFile: (absPath: string, dirent: Dirent) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Walk `repoDir` depth-first, pruning `skipDirs` and stopping past `maxDepth`,
|
|
19
|
+
* invoking `onFile(absPath, dirent)` for each file. Unreadable directories are
|
|
20
|
+
* skipped silently (a permission error on one subtree never aborts the walk).
|
|
21
|
+
*/
|
|
22
|
+
export declare function walkRepo(repoDir: string, opts: WalkRepoOptions): void;
|
|
23
|
+
/**
|
|
24
|
+
* Convenience over {@link walkRepo} for the common "collect every file matching
|
|
25
|
+
* a predicate" case. Returns absolute paths sorted lexicographically (the same
|
|
26
|
+
* `found.sort()` every adapter applied for deterministic output).
|
|
27
|
+
*
|
|
28
|
+
* `match` takes `(absPath, dirent)` — the SAME argument order as
|
|
29
|
+
* {@link WalkRepoOptions.onFile} — so a predicate can move between the two
|
|
30
|
+
* helpers without silently rebinding its parameters.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findFiles(repoDir: string, match: (absPath: string, dirent: Dirent) => boolean, opts?: {
|
|
33
|
+
skipDirs?: Iterable<string>;
|
|
34
|
+
maxDepth?: number;
|
|
35
|
+
}): string[];
|
|
36
|
+
//# sourceMappingURL=walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/infra/walk.ts"],"names":[],"mappings":"AAcA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAGnD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAQ9C,CAAC;AAKF,MAAM,WAAW,eAAe;IAC9B,yGAAyG;IACzG,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,IAAI,CAqBrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EACnD,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD,MAAM,EAAE,CAUV"}
|