cg-code-graph 0.15.0__tar.gz → 0.16.0__tar.gz
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.
- {cg_code_graph-0.15.0/cg_code_graph.egg-info → cg_code_graph-0.16.0}/PKG-INFO +1 -1
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0/cg_code_graph.egg-info}/PKG-INFO +1 -1
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/cg_code_graph.egg-info/SOURCES.txt +3 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/__init__.py +1 -1
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/blindspots.py +1 -1
- cg_code_graph-0.16.0/codegraph/plugins/astro/content.py +564 -0
- cg_code_graph-0.16.0/codegraph/plugins/astro/plugin.py +512 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/extractor/extract.mjs +263 -25
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_astro.py +179 -7
- cg_code_graph-0.16.0/tests/test_astro_content.py +356 -0
- cg_code_graph-0.16.0/tests/test_astro_server.py +342 -0
- cg_code_graph-0.15.0/codegraph/plugins/astro/plugin.py +0 -126
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/LICENSE +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/MANIFEST.in +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/README.md +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/cg_code_graph.egg-info/dependency_links.txt +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/cg_code_graph.egg-info/entry_points.txt +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/cg_code_graph.egg-info/requires.txt +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/cg_code_graph.egg-info/top_level.txt +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/affected.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/agent_rules.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/agents.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/aitools.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/android_ipc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/apple_ipc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/apps.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/bridges.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/brokers.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/cli.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/concepts.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/config.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/cache.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/detect.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/extractors.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/fsutil.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/generated.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/model.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/paths.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/store.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/core/syntax_errors.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/coverage.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/dart_isolates.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/doctor.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/explore.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/external.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/graphql.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/hooks.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/indexer.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/jobs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/link.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/lint_async.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/local_ipc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/local_sockets.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/mcp_server.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/parity.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/parity_structure.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/payload.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plans.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/platform_scan.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/platforms.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/astro/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/cfamily/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/cfamily/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/cfamily/syntax.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/bridges.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/extractor/bin/extract.dart +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/extractor/pubspec.lock +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/extractor/pubspec.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/http.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/models.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/dart/program.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/django/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/django/extras.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/django/models.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/django/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/django/schemas.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/django/shapes.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/django/urls.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/express/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/express/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/flutter/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/flutter/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/kotlin/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/kotlin/exact.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/kotlin/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/kotlin/reparse.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/laravel/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/laravel/broadcast.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/laravel/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/laravel/tests.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/laravel/values.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/native/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/native/gates.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/native/runner.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/native/scipread.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/native/ts.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/nest/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/nest/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/nextjs/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/nextjs/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/nuxt/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/nuxt/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/external.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/extractor/composer.json +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/extractor/composer.lock +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/extractor/extract.php +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/gating.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/php/strings.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/aitools.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/external.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/fields.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/refs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/roots.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/socketio.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/subproc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/tests.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/python/values.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/pyweb/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/pyweb/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/pyweb/values.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/rust/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/rust/cargo.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/rust/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/rust/syntax.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/scip/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/scip/importer.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/scip/scip.proto +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/scip/scip_pb2.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/stubs/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/stubs/plugins.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/swift/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/swift/baseurl.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/swift/exact.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/swift/indexstore.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/swift/packages.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/swift/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/baseurl.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/extractor/fw.mjs +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/extractor/package-lock.json +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/extractor/package.json +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/nav.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/ts/plugin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/tsweb/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/tsweb/common.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/plugins/tsweb/data.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/c_cpp.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/common.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/dart.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/django-ninja.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/django.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/djangorestframework.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/express.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/kotlin.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/laravel.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/nest.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/nextjs.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/nuxt.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/php.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/python.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/rust.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/swift.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/presets/typescript.yaml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/process_runs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/protocols/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/protocols/builtin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/protocols/matchers.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/protocols/view.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/query.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/realtime.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/realtime_events.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/realtime_native.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/realtime_ws.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/roundtrip.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/routes.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/rpc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/sdk_systems.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/sockets.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/starters.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/tests_index.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/udp_apps.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/__init__.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/graph.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/server.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/app.css +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/app.js +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/index.html +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/layered.js +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/vendor/VERSIONS.txt +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/vendor/cose-base.js +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/vendor/cytoscape-fcose.js +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/vendor/cytoscape.min.js +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/static/vendor/layout-base.js +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/tools/package-lock.json +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/tools/package.json +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/viz/tools/shoot.mjs +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/watch.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/webhooks.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/codegraph/xcode.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/pyproject.toml +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/setup.cfg +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_affected.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_agents_install.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_agents_md.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_ai_tools.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_android_ipc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_apple_ipc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_bridges.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_bridges_pigeon_monorepo.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_brokers.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_cache_clean.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_cache_invalidation.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_channels_tests.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_cli_output.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_completeness.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_config_extras.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_coverage.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_coverage_ts_hint.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_dart_isolates.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_dispatch_interfaces.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_django_flutter.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_docs_links.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_enum_constants.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_explore.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_external.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_gating.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_generated.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_graphql.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_hooks.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_impact_overrides.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_index_isolation.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_inherited_overrides.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_jobs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_js_refs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_js_runtime.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_kotlin.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_kotlin_binding.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_kotlin_exact.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_kotlin_fields.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_kotlin_mixed.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_kotlin_nav_consts.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_kotlin_props.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_laravel_determinism.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_laravel_resources.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_lint_async.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_local_ipc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_local_sockets.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_mcp.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_mcp_index.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_native_cfamily.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_native_concurrency.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_native_rust.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_nuxt_import_dirs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_nuxt_rootsrc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_packaging.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_parity.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_parity_structure.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_php_props.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_plain_js.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_plans.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_platform_gaps.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_platform_type_variants.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_platforms.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_platforms_apple.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_presets_config.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_process_ipc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_process_runs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_protocols.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_app_tests_module.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_collection_chains.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_compat.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_entry_refs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_fields.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_infer_cycles.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_roots.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_subprocess_tests.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_tests.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_web_hosts.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_web_routes.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_python_web_routes_more.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_realtime.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_realtime_native.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_roundtrip.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_route_tables.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_routes_search_explain.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_rpc.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_scip_health.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_sdk_external.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_snippet.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_sockets.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_starters_budget.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_binding.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_exact.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_facts.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_fields.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_modules.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_more.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_nav_values.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_parse_errors.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_props.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_sdk.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_testing.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_swift_values.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_tests_scope.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_ts_fields.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_ts_fields_js_vue.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_ts_file_specs.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_ts_frameworks.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_ts_nuxt.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_ts_src_tsconfig.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_values.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_viz.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_vue_nav.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_watch.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_webhooks.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_websockets.py +0 -0
- {cg_code_graph-0.15.0 → cg_code_graph-0.16.0}/tests/test_workspace_link.py +0 -0
|
@@ -72,6 +72,7 @@ codegraph/core/store.py
|
|
|
72
72
|
codegraph/core/syntax_errors.py
|
|
73
73
|
codegraph/plugins/__init__.py
|
|
74
74
|
codegraph/plugins/astro/__init__.py
|
|
75
|
+
codegraph/plugins/astro/content.py
|
|
75
76
|
codegraph/plugins/astro/plugin.py
|
|
76
77
|
codegraph/plugins/cfamily/__init__.py
|
|
77
78
|
codegraph/plugins/cfamily/plugin.py
|
|
@@ -209,6 +210,8 @@ tests/test_ai_tools.py
|
|
|
209
210
|
tests/test_android_ipc.py
|
|
210
211
|
tests/test_apple_ipc.py
|
|
211
212
|
tests/test_astro.py
|
|
213
|
+
tests/test_astro_content.py
|
|
214
|
+
tests/test_astro_server.py
|
|
212
215
|
tests/test_bridges.py
|
|
213
216
|
tests/test_bridges_pigeon_monorepo.py
|
|
214
217
|
tests/test_brokers.py
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""code-graph: deterministic code knowledge graph (beta)."""
|
|
2
|
-
__version__ = "0.
|
|
2
|
+
__version__ = "0.16.0"
|
|
@@ -34,7 +34,7 @@ KINDS = {
|
|
|
34
34
|
"nuxt_unevaluable_import_dirs": ("handler", "typescript",
|
|
35
35
|
"Nuxt imports.dirs entry that is not a literal path or glob"),
|
|
36
36
|
"vue_unresolved_navigation": ("route", "typescript",
|
|
37
|
-
"Nuxt / Vue navigation target that matches no page or several pages"),
|
|
37
|
+
"Nuxt / Vue / Astro navigation target that matches no page or several pages"),
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
|
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
"""Markdown pages and content collections for the Astro layer.
|
|
2
|
+
|
|
3
|
+
Pages under ``pages/`` ending in ``.md`` / ``.mdx`` / ``.html`` (and the other Markdown
|
|
4
|
+
suffixes) become page nodes. A frontmatter ``layout`` is RENDERS, and MDX imports,
|
|
5
|
+
elements and calls of imported functions are edges. ``content.config.ts`` (or the legacy
|
|
6
|
+
``content/config.ts``) defines ``table`` nodes that ``getCollection`` / ``getEntry`` /
|
|
7
|
+
``render`` read.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import re
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from ...core.plugin import GraphBuilder, Project
|
|
16
|
+
from .plugin import _pages_prefix, astro_route
|
|
17
|
+
|
|
18
|
+
_MD_KIND = {
|
|
19
|
+
".md": "md", ".markdown": "md", ".mdown": "md", ".mkdn": "md", ".mkd": "md", ".mdwn": "md",
|
|
20
|
+
".mdx": "mdx", ".html": "html",
|
|
21
|
+
}
|
|
22
|
+
_ENTRY_EXT = (".md", ".mdx", ".mdoc", ".markdown") # legacy `type: 'content'` entries
|
|
23
|
+
_DATA_EXT = (".json", ".yaml", ".yml", ".toml") # legacy `type: 'data'` entries
|
|
24
|
+
_READ_FNS = ("getCollection", "getEntry", "getEntries", "getLiveCollection", "getLiveEntry")
|
|
25
|
+
_CFG_NAMES = ("content.config.ts", "content.config.mts", "content.config.js", "content.config.mjs")
|
|
26
|
+
_LEGACY_NAMES = ("config.ts", "config.js", "config.mts")
|
|
27
|
+
_KV = re.compile(r"""^(?P<q>['\"]?)(?P<key>[A-Za-z_][\w-]*)(?P=q)\s*:\s*(?P<val>.*?)\s*$""")
|
|
28
|
+
_IMP_BOTH = re.compile(
|
|
29
|
+
r"""^import\s+([A-Za-z_$][\w$]*)\s*,\s*\{([^}]+)\}\s*from\s+['\"]([^'\"]+)['\"]""")
|
|
30
|
+
_IMP_DEF = re.compile(r"""^import\s+([A-Za-z_$][\w$]*)\s+from\s+['\"]([^'\"]+)['\"]""")
|
|
31
|
+
_IMP_NAMED = re.compile(r"""^import\s*\{([^}]+)\}\s*from\s+['\"]([^'\"]+)['\"]""")
|
|
32
|
+
_TOML_KV = re.compile(r"""^(?P<q>['\"]?)(?P<key>[A-Za-z_][\w-]*)(?P=q)\s*=\s*(?P<val>.*?)\s*$""")
|
|
33
|
+
_DEF = re.compile(r"\bconst\s+([A-Za-z_$][\w$]*)\s*=\s*defineCollection\s*\(")
|
|
34
|
+
_COLLECTIONS = re.compile(r"export\s+const\s+collections\s*(?::[^=]+)?=\s*\{")
|
|
35
|
+
_MD_LINK = re.compile(r"""\]\(\s*<?(/[^)\s>]*)|\bhref\s*=\s*['\"](/[^'\"]*)['\"]""")
|
|
36
|
+
_INLINE_CODE = re.compile(r"`[^`]*`")
|
|
37
|
+
_FENCE = re.compile(r"^\s*(```|~~~)")
|
|
38
|
+
_FILE_KINDS = ("page", "layout", "component", "module")
|
|
39
|
+
_RENDER_KINDS = ("component", "layout", "page")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def frontmatter(text: str) -> dict[str, str]:
|
|
43
|
+
"""Top-level ``key: value`` lines of a leading ``---`` (YAML) or ``key = value`` lines of a ``+++`` (TOML)
|
|
44
|
+
block, quotes and trailing comments stripped. No block, or an unclosed one, is ``{}``."""
|
|
45
|
+
return {k: v for k, (v, _n) in frontmatter_lines(text).items()}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def frontmatter_lines(text: str) -> dict[str, tuple[str, int]]:
|
|
49
|
+
lines, _end, toml = _fm_block(text)
|
|
50
|
+
out: dict[str, tuple[str, int]] = {}
|
|
51
|
+
for n, raw in lines:
|
|
52
|
+
if toml and raw.lstrip().startswith("["):
|
|
53
|
+
break # a [table]: the rest is not top level
|
|
54
|
+
if not raw or raw[0] in " \t":
|
|
55
|
+
continue # nested YAML, or a continuation line
|
|
56
|
+
m = (_TOML_KV if toml else _KV).match(raw.rstrip())
|
|
57
|
+
if m:
|
|
58
|
+
out.setdefault(m.group("key"), (_scalar(m.group("val")), n))
|
|
59
|
+
return out
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _fm_block(text: str) -> tuple[list[tuple[int, str]], int, bool]:
|
|
63
|
+
"""(body lines with numbers, closing line, is TOML). Blank lines may precede the opening fence, as in Astro."""
|
|
64
|
+
raw = text.splitlines()
|
|
65
|
+
i = 0
|
|
66
|
+
while i < len(raw) and not raw[i].strip().lstrip("\ufeff"):
|
|
67
|
+
i += 1
|
|
68
|
+
if i >= len(raw):
|
|
69
|
+
return [], 0, False
|
|
70
|
+
m = re.match(r"\ufeff?(---|\+\+\+)\s*$", raw[i])
|
|
71
|
+
if not m:
|
|
72
|
+
return [], 0, False
|
|
73
|
+
fence = m.group(1)
|
|
74
|
+
body = []
|
|
75
|
+
for j in range(i + 1, len(raw)):
|
|
76
|
+
if raw[j].rstrip() == fence:
|
|
77
|
+
return body, j + 1, fence == "+++"
|
|
78
|
+
body.append((j + 1, raw[j]))
|
|
79
|
+
return [], 0, False # unclosed: Astro rejects it, so read nothing
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _fm_lines(text: str) -> tuple[list[tuple[int, str]], int]:
|
|
83
|
+
body, end, _toml = _fm_block(text)
|
|
84
|
+
return body, end
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _scalar(v: str) -> str:
|
|
88
|
+
v = v.strip()
|
|
89
|
+
if v[:1] in ("'", '"'):
|
|
90
|
+
q = v[0]
|
|
91
|
+
close = v.find(q, 1)
|
|
92
|
+
return v[1:close] if close > 0 else v[1:]
|
|
93
|
+
return re.sub(r"\s+#.*$", "", v).strip()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _unquote(v: str) -> str:
|
|
97
|
+
if len(v) >= 2 and v[0] == v[-1] and v[0] in "'\"":
|
|
98
|
+
return v[1:-1]
|
|
99
|
+
return v
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _norm_rel(v: str) -> str:
|
|
103
|
+
s = v.strip().replace("\\", "/")
|
|
104
|
+
while s.startswith("./"):
|
|
105
|
+
s = s[2:]
|
|
106
|
+
return s.strip("/")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _resolve(src_file: str, spec: str) -> str | None:
|
|
110
|
+
spec = _unquote(spec.strip())
|
|
111
|
+
if spec.startswith("/"):
|
|
112
|
+
return _norm_rel(spec)
|
|
113
|
+
if not spec.startswith("."):
|
|
114
|
+
return None
|
|
115
|
+
rel = os.path.normpath(str(Path(src_file).parent / spec)).replace("\\", "/")
|
|
116
|
+
return rel[2:] if rel.startswith("./") else rel
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _file_candidates(rel: str) -> list[str]:
|
|
120
|
+
exts = (".astro", ".ts", ".tsx", ".mts", ".js", ".jsx", ".mjs", ".md", ".mdx", ".html")
|
|
121
|
+
out = [rel]
|
|
122
|
+
for ext in exts:
|
|
123
|
+
out.append(rel + ext)
|
|
124
|
+
out.append(rel + "/index" + ext)
|
|
125
|
+
return out
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _existing(root: Path, rel: str) -> str | None:
|
|
129
|
+
for c in _file_candidates(rel):
|
|
130
|
+
if (root / c).is_file():
|
|
131
|
+
return c
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def _by_file(b: GraphBuilder) -> dict[str, list]:
|
|
136
|
+
out: dict[str, list] = {}
|
|
137
|
+
for n in b.nodes.values():
|
|
138
|
+
if n.file:
|
|
139
|
+
out.setdefault(n.file.replace("\\", "/"), []).append(n)
|
|
140
|
+
return out
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _node_for(b: GraphBuilder, path: str, kinds=_FILE_KINDS) -> str | None:
|
|
144
|
+
for kind in kinds:
|
|
145
|
+
nid = f"{kind}:{path}"
|
|
146
|
+
if b.has(nid):
|
|
147
|
+
return nid
|
|
148
|
+
for n in b.nodes.values():
|
|
149
|
+
if (n.file or "").replace("\\", "/") == path and n.kind in kinds:
|
|
150
|
+
return n.id
|
|
151
|
+
return None
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _expand_braces(pat: str) -> list[str]:
|
|
155
|
+
m = re.search(r"\{([^{}]+)\}", pat)
|
|
156
|
+
if not m:
|
|
157
|
+
return [pat]
|
|
158
|
+
return [x for o in m.group(1).split(",") for x in _expand_braces(pat[:m.start()] + o.strip() + pat[m.end():])]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _glob_re(pat: str) -> str:
|
|
162
|
+
i, out = 0, []
|
|
163
|
+
while i < len(pat):
|
|
164
|
+
if pat.startswith("**/", i):
|
|
165
|
+
out.append("(?:[^/]+/)*")
|
|
166
|
+
i += 3
|
|
167
|
+
elif pat.startswith("**", i):
|
|
168
|
+
out.append(".*")
|
|
169
|
+
i += 2
|
|
170
|
+
elif pat[i] == "*":
|
|
171
|
+
out.append("[^/]*")
|
|
172
|
+
i += 1
|
|
173
|
+
elif pat[i] == "?":
|
|
174
|
+
out.append("[^/]")
|
|
175
|
+
i += 1
|
|
176
|
+
else:
|
|
177
|
+
out.append(re.escape(pat[i]))
|
|
178
|
+
i += 1
|
|
179
|
+
return "".join(out)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def count_glob(root: Path, base: str, pattern: str) -> int:
|
|
183
|
+
folder = root / base if base else root
|
|
184
|
+
if not folder.is_dir():
|
|
185
|
+
return 0
|
|
186
|
+
regs = [re.compile(_glob_re(p)) for p in _expand_braces(pattern)]
|
|
187
|
+
n = 0
|
|
188
|
+
for p in folder.rglob("*"):
|
|
189
|
+
if p.is_file() and any(r.fullmatch(p.relative_to(folder).as_posix()) for r in regs):
|
|
190
|
+
n += 1
|
|
191
|
+
return n
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _matching_paren(src: str, open_at: int) -> int:
|
|
195
|
+
"""Index of the bracket closing the one at ``open_at`` (``(`` or ``{``), skipping strings."""
|
|
196
|
+
opener = src[open_at]
|
|
197
|
+
closer = ")" if opener == "(" else "}"
|
|
198
|
+
depth, i, n = 0, open_at, len(src)
|
|
199
|
+
while i < n:
|
|
200
|
+
c = src[i]
|
|
201
|
+
if c in "'\"`":
|
|
202
|
+
q = c
|
|
203
|
+
i += 1
|
|
204
|
+
while i < n:
|
|
205
|
+
if src[i] == "\\":
|
|
206
|
+
i += 2
|
|
207
|
+
continue
|
|
208
|
+
if src[i] == q:
|
|
209
|
+
break
|
|
210
|
+
i += 1
|
|
211
|
+
elif c == opener:
|
|
212
|
+
depth += 1
|
|
213
|
+
elif c == closer:
|
|
214
|
+
depth -= 1
|
|
215
|
+
if depth == 0:
|
|
216
|
+
return i
|
|
217
|
+
i += 1
|
|
218
|
+
return n - 1
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def _line_at(src: str, idx: int) -> int:
|
|
222
|
+
return src.count("\n", 0, idx) + 1
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def read_collections(root, src_dir: str = "src") -> list[dict]:
|
|
226
|
+
"""Collections declared in ``content.config.*`` or legacy ``content/config.*``."""
|
|
227
|
+
root = Path(root)
|
|
228
|
+
pre = f"{src_dir}/" if src_dir else ""
|
|
229
|
+
path = next((root / (pre + n) for n in _CFG_NAMES if (root / (pre + n)).is_file()), None)
|
|
230
|
+
if path is None:
|
|
231
|
+
legacy = pre + "content/"
|
|
232
|
+
path = next((root / (legacy + n) for n in _LEGACY_NAMES if (root / (legacy + n)).is_file()), None)
|
|
233
|
+
if path is None:
|
|
234
|
+
return []
|
|
235
|
+
try:
|
|
236
|
+
src = path.read_text(encoding="utf-8", errors="replace")
|
|
237
|
+
except OSError:
|
|
238
|
+
return []
|
|
239
|
+
rel_file = path.relative_to(root).as_posix()
|
|
240
|
+
legacy_file = rel_file.endswith(tuple("content/" + n for n in _LEGACY_NAMES))
|
|
241
|
+
src = _blank_comments(src)
|
|
242
|
+
by_var: dict[str, dict] = {}
|
|
243
|
+
for m in _DEF.finditer(src):
|
|
244
|
+
by_var[m.group(1)] = _collection_info(src, m.group(1), m.end() - 1, m.start(), rel_file)
|
|
245
|
+
em = _COLLECTIONS.search(src)
|
|
246
|
+
if not em:
|
|
247
|
+
return []
|
|
248
|
+
obj_close = _matching_paren(src, em.end() - 1)
|
|
249
|
+
out = []
|
|
250
|
+
for part, off in _top_level_parts(src, em.end(), obj_close):
|
|
251
|
+
km = re.match(r"""\s*(?:(['\"])([^'\"]+)\1|([A-Za-z_$][\w$]*))\s*(?::\s*(.*))?$""", part, re.S)
|
|
252
|
+
if not km:
|
|
253
|
+
continue
|
|
254
|
+
name = km.group(2) or km.group(3)
|
|
255
|
+
value = (km.group(4) or "").strip()
|
|
256
|
+
if not value:
|
|
257
|
+
info = by_var.get(km.group(3) or "")
|
|
258
|
+
elif re.fullmatch(r"[A-Za-z_$][\w$]*", value):
|
|
259
|
+
info = by_var.get(value)
|
|
260
|
+
else:
|
|
261
|
+
dm = re.search(r"\bdefineCollection\s*\(", part)
|
|
262
|
+
info = _collection_info(src, name, off + dm.end() - 1, off + dm.start(), rel_file) if dm else None
|
|
263
|
+
if not info:
|
|
264
|
+
continue
|
|
265
|
+
item = dict(info)
|
|
266
|
+
item["name"] = name
|
|
267
|
+
if item["loader"] is None and (item["type"] or legacy_file):
|
|
268
|
+
item["type"] = item["type"] or "content"
|
|
269
|
+
item["base"] = f"{pre}content/{name}"
|
|
270
|
+
if item["loader"] == "glob" and item["pattern"] and item["base"] is not None:
|
|
271
|
+
item["entries"] = count_glob(root, item["base"], item["pattern"])
|
|
272
|
+
elif item["loader"] is None and item["base"]:
|
|
273
|
+
folder = root / item["base"]
|
|
274
|
+
exts = _DATA_EXT if item["type"] == "data" else _ENTRY_EXT
|
|
275
|
+
item["entries"] = sum(1 for p in folder.rglob("*") if p.is_file() and p.suffix.lower() in exts) if folder.is_dir() else 0
|
|
276
|
+
out.append(item)
|
|
277
|
+
return out
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def _top_level_parts(src: str, start: int, end: int):
|
|
281
|
+
"""Comma-separated members of an object literal body, with their offsets."""
|
|
282
|
+
depth, i, part_at = 0, start, start
|
|
283
|
+
while i < end:
|
|
284
|
+
c = src[i]
|
|
285
|
+
if c in "'\"`":
|
|
286
|
+
q = c
|
|
287
|
+
i += 1
|
|
288
|
+
while i < end and src[i] != q:
|
|
289
|
+
i += 2 if src[i] == "\\" else 1
|
|
290
|
+
elif c in "([{":
|
|
291
|
+
depth += 1
|
|
292
|
+
elif c in ")]}":
|
|
293
|
+
depth -= 1
|
|
294
|
+
elif c == "," and depth == 0:
|
|
295
|
+
yield src[part_at:i], part_at
|
|
296
|
+
part_at = i + 1
|
|
297
|
+
i += 1
|
|
298
|
+
if src[part_at:end].strip():
|
|
299
|
+
yield src[part_at:end], part_at
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def _collection_info(src: str, var: str, open_at: int, start: int, rel_file: str) -> dict:
|
|
303
|
+
"""Loader, glob pattern / base, file path, legacy type and reference() targets of one defineCollection(...)."""
|
|
304
|
+
close = _matching_paren(src, open_at)
|
|
305
|
+
span = src[open_at:close]
|
|
306
|
+
info = {
|
|
307
|
+
"var": var, "file": rel_file, "line": _line_at(src, start),
|
|
308
|
+
"loader": None, "pattern": None, "base": None, "path": None,
|
|
309
|
+
"entries": None, "type": None, "relations": [],
|
|
310
|
+
}
|
|
311
|
+
gm = re.search(r"\bglob\s*\(\s*\{", span)
|
|
312
|
+
fm = re.search(r"\bfile\s*\(\s*['\"]([^'\"]+)['\"]", span)
|
|
313
|
+
if gm:
|
|
314
|
+
body = span[gm.end():_matching_paren(span, gm.end() - 1)]
|
|
315
|
+
pm = re.search(r"""\bpattern\s*:\s*['\"]([^'\"]+)['\"]""", body)
|
|
316
|
+
bm = re.search(r"""\bbase\s*:\s*['\"]([^'\"]+)['\"]""", body)
|
|
317
|
+
info["loader"] = "glob"
|
|
318
|
+
if pm:
|
|
319
|
+
info["pattern"] = pm.group(1)
|
|
320
|
+
if bm:
|
|
321
|
+
info["base"] = _norm_rel(bm.group(1))
|
|
322
|
+
elif fm:
|
|
323
|
+
info["loader"] = "file"
|
|
324
|
+
info["path"] = _norm_rel(fm.group(1))
|
|
325
|
+
elif re.search(r"\bloader\s*:", span):
|
|
326
|
+
lm = re.search(r"\bloader\s*:\s*(?!async\b|function\b)([A-Za-z_$][\w$]*)", span)
|
|
327
|
+
info["loader"] = lm.group(1) if lm else "custom"
|
|
328
|
+
tm = re.search(r"""\btype\s*:\s*['\"](content|data)['\"]""", span)
|
|
329
|
+
if tm:
|
|
330
|
+
info["type"] = tm.group(1)
|
|
331
|
+
for rm in re.finditer(r"""\breference\s*\(\s*['\"]([^'\"]+)['\"]""", span):
|
|
332
|
+
info["relations"].append((rm.group(1), _line_at(src, open_at + rm.start())))
|
|
333
|
+
return info
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
def _blank_comments(src: str) -> str:
|
|
337
|
+
"""``//`` and ``/* */`` comments as spaces (newlines kept, so offsets and lines do not move); strings are kept."""
|
|
338
|
+
out, i, n = [], 0, len(src)
|
|
339
|
+
while i < n:
|
|
340
|
+
c = src[i]
|
|
341
|
+
if c in "'\"`":
|
|
342
|
+
j = i + 1
|
|
343
|
+
while j < n and src[j] != c:
|
|
344
|
+
j += 2 if src[j] == "\\" else 1
|
|
345
|
+
out.append(src[i:j + 1])
|
|
346
|
+
i = j + 1
|
|
347
|
+
elif src.startswith("//", i):
|
|
348
|
+
j = src.find("\n", i)
|
|
349
|
+
j = n if j < 0 else j
|
|
350
|
+
out.append(" " * (j - i))
|
|
351
|
+
i = j
|
|
352
|
+
elif src.startswith("/*", i):
|
|
353
|
+
j = src.find("*/", i + 2)
|
|
354
|
+
j = n if j < 0 else j + 2
|
|
355
|
+
out.append(re.sub(r"[^\n]", " ", src[i:j]))
|
|
356
|
+
i = j
|
|
357
|
+
else:
|
|
358
|
+
out.append(c)
|
|
359
|
+
i += 1
|
|
360
|
+
return "".join(out)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def _body_lines(text: str):
|
|
364
|
+
"""(line number, line) outside the frontmatter and fenced code blocks, inline code spans blanked."""
|
|
365
|
+
_fm, fm_end = _fm_lines(text)
|
|
366
|
+
fence = None
|
|
367
|
+
for i, line in enumerate(text.splitlines(), start=1):
|
|
368
|
+
if i <= fm_end:
|
|
369
|
+
continue
|
|
370
|
+
m = _FENCE.match(line)
|
|
371
|
+
if m:
|
|
372
|
+
if fence is None:
|
|
373
|
+
fence = m.group(1)
|
|
374
|
+
elif m.group(1) == fence:
|
|
375
|
+
fence = None
|
|
376
|
+
continue
|
|
377
|
+
if fence is None:
|
|
378
|
+
yield i, _INLINE_CODE.sub(lambda c: " " * len(c.group(0)), line)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def _mdx_imports(lines: list[tuple[int, str]]):
|
|
382
|
+
"""(line, statement) for top-level ESM imports, joining an import that spans several lines."""
|
|
383
|
+
i = 0
|
|
384
|
+
while i < len(lines):
|
|
385
|
+
n, line = lines[i]
|
|
386
|
+
if re.match(r"import\b", line) and not re.match(r"import\s*\(", line):
|
|
387
|
+
stmt, j = line.strip(), i
|
|
388
|
+
while not re.search(r"""\bfrom\s*['\"][^'\"]+['\"]|^import\s*['\"]""", stmt) and j + 1 < len(lines) and j - i < 20:
|
|
389
|
+
j += 1
|
|
390
|
+
stmt += " " + lines[j][1].strip()
|
|
391
|
+
yield n, stmt, range(i, j + 1)
|
|
392
|
+
i = j + 1
|
|
393
|
+
else:
|
|
394
|
+
i += 1
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
def _mdx_edges(project: Project, b: GraphBuilder, rel: str, text: str, page_id: str) -> None:
|
|
398
|
+
lines = list(_body_lines(text))
|
|
399
|
+
defaults: dict[str, str] = {}
|
|
400
|
+
named: dict[str, tuple[str, str]] = {} # local -> (export name, resolved file)
|
|
401
|
+
skip: set[int] = set()
|
|
402
|
+
for i, stmt, idx in _mdx_imports(lines):
|
|
403
|
+
skip.update(idx)
|
|
404
|
+
if re.match(r"import\s+type\b", stmt):
|
|
405
|
+
continue
|
|
406
|
+
spec = None
|
|
407
|
+
default = None
|
|
408
|
+
names = ""
|
|
409
|
+
both = _IMP_BOTH.match(stmt)
|
|
410
|
+
if both:
|
|
411
|
+
default, names, spec = both.group(1), both.group(2), both.group(3)
|
|
412
|
+
else:
|
|
413
|
+
d = _IMP_DEF.match(stmt)
|
|
414
|
+
nm = _IMP_NAMED.match(stmt)
|
|
415
|
+
if d:
|
|
416
|
+
default, spec = d.group(1), d.group(2)
|
|
417
|
+
elif nm:
|
|
418
|
+
names, spec = nm.group(1), nm.group(2)
|
|
419
|
+
if spec is None:
|
|
420
|
+
continue
|
|
421
|
+
resolved_spec = _resolve(rel, spec)
|
|
422
|
+
target = _existing(project.root, resolved_spec) if resolved_spec else None
|
|
423
|
+
nid = _node_for(b, target) if target else None
|
|
424
|
+
if nid:
|
|
425
|
+
b.add_edge(page_id, nid, "IMPORTS", rel, i, "exact")
|
|
426
|
+
if default and target:
|
|
427
|
+
defaults[default] = target
|
|
428
|
+
if target and names:
|
|
429
|
+
for piece in names.split(","):
|
|
430
|
+
am = re.match(r"\s*(?:type\s+)?([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?", piece)
|
|
431
|
+
if am and piece.strip():
|
|
432
|
+
named[am.group(2) or am.group(1)] = (am.group(1), target)
|
|
433
|
+
for k, (i, line) in enumerate(lines):
|
|
434
|
+
if k in skip:
|
|
435
|
+
continue
|
|
436
|
+
for name, target in defaults.items():
|
|
437
|
+
if re.search(r"<" + re.escape(name) + r"[\s/>.]", line + " "):
|
|
438
|
+
nid = _node_for(b, target, _RENDER_KINDS)
|
|
439
|
+
if nid:
|
|
440
|
+
b.add_edge(page_id, nid, "RENDERS", rel, i, "exact", via=["mdx"])
|
|
441
|
+
for local, (exp, target) in named.items():
|
|
442
|
+
if re.search(r"(?<![\w$.])" + re.escape(local) + r"\s*\(", line):
|
|
443
|
+
fid = f"function:{target}#{exp}"
|
|
444
|
+
if b.has(fid):
|
|
445
|
+
b.add_edge(page_id, fid, "CALLS", rel, i, "resolved", via=["mdx"])
|
|
446
|
+
elif re.search(r"<" + re.escape(local) + r"[\s/>.]", line + " "):
|
|
447
|
+
# a named component export (`import { Card } from`): the function when it is one, else the file
|
|
448
|
+
fid = f"function:{target}#{exp}"
|
|
449
|
+
nid = fid if b.has(fid) else _node_for(b, target, _RENDER_KINDS)
|
|
450
|
+
if nid:
|
|
451
|
+
b.add_edge(page_id, nid, "RENDERS", rel, i, "resolved" if nid == fid else "exact", via=["mdx"])
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def _link_sites(text: str, page_id: str, rel: str) -> list[dict]:
|
|
455
|
+
"""Root-relative Markdown links and `href`s outside code, as navigation sites."""
|
|
456
|
+
sites = []
|
|
457
|
+
for i, line in _body_lines(text):
|
|
458
|
+
for m in _MD_LINK.finditer(line):
|
|
459
|
+
value = (m.group(1) or m.group(2) or "").split("#")[0].split("?")[0]
|
|
460
|
+
if value and not value.startswith("//"):
|
|
461
|
+
sites.append({"src": page_id, "file": rel, "line": i, "via": "markdown",
|
|
462
|
+
"locs": [{"kind": "path", "value": value, "conf": "exact"}]})
|
|
463
|
+
return sites
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
def contribute_content(project: Project, b: GraphBuilder, ac: dict, calls: list, sites: list, st: dict) -> None:
|
|
467
|
+
"""Markdown pages (with their links appended to ``sites``) and content collections. ``ac`` is read_astro_config()."""
|
|
468
|
+
from .plugin import _locale_of
|
|
469
|
+
src_dir, base = ac["src_dir"], ac["base"]
|
|
470
|
+
locales = ac.get("locales") or []
|
|
471
|
+
st.setdefault("markdown_pages", 0)
|
|
472
|
+
st.setdefault("mdx_pages", 0)
|
|
473
|
+
st.setdefault("collections", 0)
|
|
474
|
+
st.setdefault("collection_reads", 0)
|
|
475
|
+
prefix = _pages_prefix(src_dir)
|
|
476
|
+
pages = project.root / prefix.rstrip("/")
|
|
477
|
+
if pages.is_dir():
|
|
478
|
+
for path in sorted(pages.rglob("*")):
|
|
479
|
+
ext = path.suffix.lower()
|
|
480
|
+
kind = _MD_KIND.get(ext)
|
|
481
|
+
if not kind or not path.is_file():
|
|
482
|
+
continue
|
|
483
|
+
rel = path.relative_to(project.root).as_posix()
|
|
484
|
+
route = astro_route(rel, src_dir, base)
|
|
485
|
+
if route is None or b.has(f"page:{rel}"):
|
|
486
|
+
continue
|
|
487
|
+
try:
|
|
488
|
+
text = path.read_text(encoding="utf-8", errors="replace")
|
|
489
|
+
except OSError:
|
|
490
|
+
text = ""
|
|
491
|
+
fm = frontmatter_lines(text) if kind != "html" else {}
|
|
492
|
+
attrs = {"route": route, "uri": route, "framework": "astro", "markdown": kind}
|
|
493
|
+
if ac.get("trailing_slash"):
|
|
494
|
+
attrs["trailing_slash"] = ac["trailing_slash"]
|
|
495
|
+
loc = _locale_of(route, base, locales, ac.get("default_locale"), ac.get("prefix_default_locale")) if locales else None
|
|
496
|
+
if loc:
|
|
497
|
+
attrs["locale"] = loc
|
|
498
|
+
if fm.get("title", ("",))[0]:
|
|
499
|
+
attrs["title"] = fm["title"][0]
|
|
500
|
+
layout_rel = _resolve(rel, fm["layout"][0]) if fm.get("layout", ("",))[0] else None
|
|
501
|
+
if layout_rel:
|
|
502
|
+
attrs["layout"] = layout_rel
|
|
503
|
+
nid = b.add_node("page", rel, name=route, fqn=route, file=rel, line=1, lang="ts",
|
|
504
|
+
entry_kind="ui_page", attrs=attrs)
|
|
505
|
+
if layout_rel:
|
|
506
|
+
lid = _node_for(b, layout_rel, ("layout", "component", "page"))
|
|
507
|
+
if lid:
|
|
508
|
+
b.add_edge(nid, lid, "RENDERS", rel, fm["layout"][1], "exact", via=["layout"])
|
|
509
|
+
if kind == "mdx":
|
|
510
|
+
_mdx_edges(project, b, rel, text, nid)
|
|
511
|
+
st["mdx_pages"] += 1
|
|
512
|
+
else:
|
|
513
|
+
st["markdown_pages"] += 1
|
|
514
|
+
if kind != "html":
|
|
515
|
+
sites.extend(_link_sites(text, nid, rel))
|
|
516
|
+
cols = read_collections(project.root, src_dir)
|
|
517
|
+
by_name = {}
|
|
518
|
+
for c in cols:
|
|
519
|
+
attrs = {"collection": True, "framework": "astro"}
|
|
520
|
+
if c["loader"]:
|
|
521
|
+
attrs["loader"] = c["loader"]
|
|
522
|
+
if c["pattern"]:
|
|
523
|
+
attrs["pattern"] = c["pattern"]
|
|
524
|
+
if c["base"] is not None and c["loader"] != "file":
|
|
525
|
+
attrs["base"] = c["base"]
|
|
526
|
+
if c["entries"] is not None:
|
|
527
|
+
attrs["entries"] = c["entries"]
|
|
528
|
+
if c["path"]:
|
|
529
|
+
attrs["path"] = c["path"]
|
|
530
|
+
if c["type"] and not c["loader"]:
|
|
531
|
+
attrs["type"] = c["type"]
|
|
532
|
+
tid = b.add_node("table", f"content:{c['name']}", name=c["name"], fqn=c["name"],
|
|
533
|
+
file=c["file"], line=c["line"], lang="ts", attrs=attrs)
|
|
534
|
+
by_name[c["name"]] = tid
|
|
535
|
+
st["collections"] += 1
|
|
536
|
+
for c in cols:
|
|
537
|
+
for other, line in c["relations"]:
|
|
538
|
+
if other in by_name:
|
|
539
|
+
b.add_edge(by_name[c["name"]], by_name[other], "HAS_RELATION", c["file"], line, "exact", via="reference")
|
|
540
|
+
reads: dict[str, set] = {}
|
|
541
|
+
for call in calls or []:
|
|
542
|
+
fn = call.get("fn")
|
|
543
|
+
args = call.get("args") or []
|
|
544
|
+
name = call.get("collection") or (args[0] if args else None)
|
|
545
|
+
if fn not in _READ_FNS or name not in by_name:
|
|
546
|
+
continue
|
|
547
|
+
src = call.get("src")
|
|
548
|
+
if not src or not b.has(src):
|
|
549
|
+
continue
|
|
550
|
+
b.add_edge(src, by_name[name], "READS_TABLE", call.get("file"), call.get("line"), "exact", via=fn)
|
|
551
|
+
reads.setdefault(call.get("file") or "", set()).add(name)
|
|
552
|
+
st["collection_reads"] += 1
|
|
553
|
+
for call in calls or []:
|
|
554
|
+
if call.get("fn") != "render":
|
|
555
|
+
continue
|
|
556
|
+
names = reads.get(call.get("file") or "") or set()
|
|
557
|
+
if len(names) != 1:
|
|
558
|
+
continue
|
|
559
|
+
fid = _node_for(b, call.get("file") or "", ("page", "layout", "component", "module"))
|
|
560
|
+
if not fid:
|
|
561
|
+
continue
|
|
562
|
+
name = next(iter(names))
|
|
563
|
+
b.add_edge(fid, by_name[name], "READS_TABLE", call.get("file"), call.get("line"), "resolved", via="render")
|
|
564
|
+
st["collection_reads"] += 1
|