periplus-map 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- periplus/__init__.py +70 -0
- periplus/checkmap.py +80 -0
- periplus/cli.py +658 -0
- periplus/contract/schema/map.schema.json +138 -0
- periplus/contract/schema/navigation.schema.json +200 -0
- periplus/contract/schema/pack-file.schema.json +1405 -0
- periplus/contract/schema/pack-manifest.schema.json +245 -0
- periplus/contract/schema/project-settings.schema.json +85 -0
- periplus/contract/spec/engine.md +151 -0
- periplus/contract/spec/rules.md +352 -0
- periplus/detect.py +228 -0
- periplus/engine/__init__.py +5 -0
- periplus/engine/check.py +481 -0
- periplus/engine/emit.py +368 -0
- periplus/engine/packload.py +2321 -0
- periplus/engine/pattern.py +27 -0
- periplus/engine/rules.py +1946 -0
- periplus/engine/select.py +491 -0
- periplus/engine/source.py +172 -0
- periplus/engine/tree.py +424 -0
- periplus/errors.py +332 -0
- periplus/init.py +358 -0
- periplus/layout.py +28 -0
- periplus/manifest.py +498 -0
- periplus/map.py +364 -0
- periplus/navigate/__init__.py +1 -0
- periplus/navigate/find.py +143 -0
- periplus/navigate/ids.py +30 -0
- periplus/navigate/listing.py +42 -0
- periplus/navigate/mapfile.py +189 -0
- periplus/navigate/path.py +175 -0
- periplus/navigate/show.py +175 -0
- periplus/navigate/types.py +83 -0
- periplus/navigate/walk.py +138 -0
- periplus/packs/advancedqueue_basic@0.0.1/pack.yaml +14 -0
- periplus/packs/advancedqueue_basic@0.0.1/queue_job_type/queue_job_type.yaml +9 -0
- periplus/packs/advancedqueue_basic@0.0.1/queue_job_type/queue_job_type_annotation.yaml +43 -0
- periplus/packs/advancedqueue_basic@0.0.1/queue_job_type/queue_job_type_attribute.yaml +43 -0
- periplus/packs/ai_basic@0.0.1/ai_agent/ai_agent.yaml +8 -0
- periplus/packs/ai_basic@0.0.1/ai_agent/ai_agent_attribute.yaml +43 -0
- periplus/packs/ai_basic@0.0.1/ai_function_call/ai_function_call.yaml +8 -0
- periplus/packs/ai_basic@0.0.1/ai_function_call/ai_function_call_attribute.yaml +43 -0
- periplus/packs/ai_basic@0.0.1/pack.yaml +15 -0
- periplus/packs/config_pages_basic@0.0.1/bundle/config_pages_bundle_config.yaml +54 -0
- periplus/packs/config_pages_basic@0.0.1/pack.yaml +11 -0
- periplus/packs/crop_basic@0.0.1/bundle/crop_bundle_config.yaml +54 -0
- periplus/packs/crop_basic@0.0.1/pack.yaml +11 -0
- periplus/packs/drupal@0.1.0/block/block_placement.yaml +25 -0
- periplus/packs/drupal@0.1.0/block/block_placement_code.yaml +58 -0
- periplus/packs/drupal@0.1.0/block/block_placement_config.yaml +53 -0
- periplus/packs/drupal@0.1.0/block/block_plugin.yaml +52 -0
- periplus/packs/drupal@0.1.0/block/block_plugin_altered.yaml +61 -0
- periplus/packs/drupal@0.1.0/block/block_plugin_annotation.yaml +69 -0
- periplus/packs/drupal@0.1.0/block/block_plugin_attribute.yaml +56 -0
- periplus/packs/drupal@0.1.0/block/block_plugin_content.yaml +46 -0
- periplus/packs/drupal@0.1.0/block/block_plugin_derived.yaml +110 -0
- periplus/packs/drupal@0.1.0/block/block_plugin_deriver.yaml +30 -0
- periplus/packs/drupal@0.1.0/block/block_type.yaml +14 -0
- periplus/packs/drupal@0.1.0/block/block_type_code.yaml +43 -0
- periplus/packs/drupal@0.1.0/block/block_type_config.yaml +45 -0
- periplus/packs/drupal@0.1.0/cache/cache.yaml +18 -0
- periplus/packs/drupal@0.1.0/cache/cache_backend.yaml +31 -0
- periplus/packs/drupal@0.1.0/component/sdc.yaml +19 -0
- periplus/packs/drupal@0.1.0/component/sdc_definition.yaml +25 -0
- periplus/packs/drupal@0.1.0/component/sdc_use.yaml +25 -0
- periplus/packs/drupal@0.1.0/config/config_object.yaml +65 -0
- periplus/packs/drupal@0.1.0/display/display.yaml +32 -0
- periplus/packs/drupal@0.1.0/display/display_code.yaml +53 -0
- periplus/packs/drupal@0.1.0/display/display_config.yaml +95 -0
- periplus/packs/drupal@0.1.0/entity/entity.yaml +33 -0
- periplus/packs/drupal@0.1.0/entity/entity_class.yaml +60 -0
- periplus/packs/drupal@0.1.0/entity/entity_save.yaml +27 -0
- periplus/packs/drupal@0.1.0/entity/entity_type_annotation.yaml +85 -0
- periplus/packs/drupal@0.1.0/entity/entity_type_attribute.yaml +76 -0
- periplus/packs/drupal@0.1.0/field/field_instance_code.yaml +40 -0
- periplus/packs/drupal@0.1.0/field/field_instance_config.yaml +58 -0
- periplus/packs/drupal@0.1.0/field/field_storage.yaml +37 -0
- periplus/packs/drupal@0.1.0/field/field_storage_code.yaml +39 -0
- periplus/packs/drupal@0.1.0/field/field_storage_config.yaml +24 -0
- periplus/packs/drupal@0.1.0/form/form.yaml +48 -0
- periplus/packs/drupal@0.1.0/form/form_class.yaml +50 -0
- periplus/packs/drupal@0.1.0/form/form_id.yaml +48 -0
- periplus/packs/drupal@0.1.0/form/form_methods.yaml +39 -0
- periplus/packs/drupal@0.1.0/hook/hook.yaml +8 -0
- periplus/packs/drupal@0.1.0/hook/hook_attribute.yaml +28 -0
- periplus/packs/drupal@0.1.0/module/module.yaml +8 -0
- periplus/packs/drupal@0.1.0/module/module_info.yaml +50 -0
- periplus/packs/drupal@0.1.0/pack.yaml +184 -0
- periplus/packs/drupal@0.1.0/plugin/plugin.yaml +17 -0
- periplus/packs/drupal@0.1.0/plugin/plugin_annotation.yaml +120 -0
- periplus/packs/drupal@0.1.0/recommendations/recommendations.yaml +14 -0
- periplus/packs/drupal@0.1.0/service/service.yaml +19 -0
- periplus/packs/drupal@0.1.0/service/service_autowire.yaml +28 -0
- periplus/packs/drupal@0.1.0/service/service_definition.yaml +24 -0
- periplus/packs/drupal@0.1.0/service/service_use.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/action/action.yaml +9 -0
- periplus/packs/drupal_basic@0.3.0/action/action_annotation.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/action/action_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/block/block_placement.yaml +16 -0
- periplus/packs/drupal_basic@0.3.0/block/block_placement_config.yaml +51 -0
- periplus/packs/drupal_basic@0.3.0/block_plugin/block_plugin.yaml +14 -0
- periplus/packs/drupal_basic@0.3.0/block_plugin/block_plugin_annotation.yaml +47 -0
- periplus/packs/drupal_basic@0.3.0/block_plugin/block_plugin_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/block_type/block_type.yaml +8 -0
- periplus/packs/drupal_basic@0.3.0/block_type/block_type_config.yaml +54 -0
- periplus/packs/drupal_basic@0.3.0/boundary/boundary_types.yaml +19 -0
- periplus/packs/drupal_basic@0.3.0/bundle/bundle.yaml +20 -0
- periplus/packs/drupal_basic@0.3.0/bundle/bundle_config.yaml +393 -0
- periplus/packs/drupal_basic@0.3.0/call/call.yaml +349 -0
- periplus/packs/drupal_basic@0.3.0/component/component.yaml +30 -0
- periplus/packs/drupal_basic@0.3.0/config/config_object.yaml +119 -0
- periplus/packs/drupal_basic@0.3.0/constraint/constraint.yaml +8 -0
- periplus/packs/drupal_basic@0.3.0/constraint/constraint_annotation.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/constraint/constraint_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/display/display.yaml +30 -0
- periplus/packs/drupal_basic@0.3.0/display/display_config.yaml +203 -0
- periplus/packs/drupal_basic@0.3.0/display/display_mode_config.yaml +60 -0
- periplus/packs/drupal_basic@0.3.0/entity_type/config_entity_type_annotation.yaml +46 -0
- periplus/packs/drupal_basic@0.3.0/entity_type/config_entity_type_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/entity_type/content_entity_type_annotation.yaml +46 -0
- periplus/packs/drupal_basic@0.3.0/entity_type/content_entity_type_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/entity_type/entity_type.yaml +16 -0
- periplus/packs/drupal_basic@0.3.0/field/field_instance_config.yaml +116 -0
- periplus/packs/drupal_basic@0.3.0/field/field_storage.yaml +21 -0
- periplus/packs/drupal_basic@0.3.0/field/field_storage_config.yaml +45 -0
- periplus/packs/drupal_basic@0.3.0/field_formatter/field_formatter.yaml +8 -0
- periplus/packs/drupal_basic@0.3.0/field_formatter/field_formatter_annotation.yaml +46 -0
- periplus/packs/drupal_basic@0.3.0/field_formatter/field_formatter_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/field_type/field_type_annotation.yaml +46 -0
- periplus/packs/drupal_basic@0.3.0/field_type/field_type_attribute.yaml +50 -0
- periplus/packs/drupal_basic@0.3.0/field_widget/field_widget_annotation.yaml +46 -0
- periplus/packs/drupal_basic@0.3.0/field_widget/field_widget_attribute.yaml +50 -0
- periplus/packs/drupal_basic@0.3.0/form/form_id.yaml +80 -0
- periplus/packs/drupal_basic@0.3.0/hook/hook.yaml +100 -0
- periplus/packs/drupal_basic@0.3.0/hook/hook_attribute.yaml +64 -0
- periplus/packs/drupal_basic@0.3.0/hook/hook_theme_include.yaml +34 -0
- periplus/packs/drupal_basic@0.3.0/library/library.yaml +12 -0
- periplus/packs/drupal_basic@0.3.0/library/library_definition.yaml +58 -0
- periplus/packs/drupal_basic@0.3.0/local_action/local_action.yaml +12 -0
- periplus/packs/drupal_basic@0.3.0/local_action/local_action_definition.yaml +49 -0
- periplus/packs/drupal_basic@0.3.0/mail/mail.yaml +8 -0
- periplus/packs/drupal_basic@0.3.0/mail/mail_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/media_source/media_source.yaml +8 -0
- periplus/packs/drupal_basic@0.3.0/media_source/media_source_annotation.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/media_source/media_source_attribute.yaml +79 -0
- periplus/packs/drupal_basic@0.3.0/menu_link/menu_link.yaml +18 -0
- periplus/packs/drupal_basic@0.3.0/menu_link/menu_link_definition.yaml +48 -0
- periplus/packs/drupal_basic@0.3.0/module/module.yaml +7 -0
- periplus/packs/drupal_basic@0.3.0/module/module_info.yaml +58 -0
- periplus/packs/drupal_basic@0.3.0/pack.yaml +528 -0
- periplus/packs/drupal_basic@0.3.0/permission/permission.yaml +7 -0
- periplus/packs/drupal_basic@0.3.0/permission/permission_definition.yaml +27 -0
- periplus/packs/drupal_basic@0.3.0/queue_worker/queue_worker.yaml +9 -0
- periplus/packs/drupal_basic@0.3.0/queue_worker/queue_worker_annotation.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/queue_worker/queue_worker_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/rest_resource/rest_resource.yaml +8 -0
- periplus/packs/drupal_basic@0.3.0/rest_resource/rest_resource_annotation.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/rest_resource/rest_resource_attribute.yaml +43 -0
- periplus/packs/drupal_basic@0.3.0/role/role.yaml +14 -0
- periplus/packs/drupal_basic@0.3.0/role/role_config.yaml +44 -0
- periplus/packs/drupal_basic@0.3.0/route/route.yaml +42 -0
- periplus/packs/drupal_basic@0.3.0/route/route_definition.yaml +113 -0
- periplus/packs/drupal_basic@0.3.0/route/route_options.yaml +55 -0
- periplus/packs/drupal_basic@0.3.0/route/route_requirements.yaml +108 -0
- periplus/packs/drupal_basic@0.3.0/service/service.yaml +56 -0
- periplus/packs/drupal_basic@0.3.0/service/service_definition.yaml +181 -0
- periplus/packs/drupal_basic@0.3.0/template/template.yaml +86 -0
- periplus/packs/drupal_basic@0.3.0/template/template_route_link.yaml +30 -0
- periplus/packs/drupal_basic@0.3.0/theme/theme.yaml +15 -0
- periplus/packs/drupal_basic@0.3.0/theme/theme_info.yaml +61 -0
- periplus/packs/drupal_basic@0.3.0/theme_hook/template_suggestion.yaml +29 -0
- periplus/packs/drupal_basic@0.3.0/theme_hook/theme_hook.yaml +87 -0
- periplus/packs/drupal_basic@0.3.0/theme_hook/theme_hook_render.yaml +20 -0
- periplus/packs/drupal_basic@0.3.0/url/url.yaml +88 -0
- periplus/packs/drupal_basic@0.3.0/views_plugin/views_field_attribute.yaml +80 -0
- periplus/packs/drupal_basic@0.3.0/views_plugin/views_filter_attribute.yaml +80 -0
- periplus/packs/drupal_basic@0.3.0/views_plugin/views_plugin.yaml +15 -0
- periplus/packs/drupal_basic@0.3.0/views_plugin/views_style_attribute.yaml +80 -0
- periplus/packs/drupal_js_basic@0.0.1/attachment/attachment.yaml +12 -0
- periplus/packs/drupal_js_basic@0.0.1/attachment/attachment_in_php.yaml +15 -0
- periplus/packs/drupal_js_basic@0.0.1/attachment/attachment_in_php_array.yaml +52 -0
- periplus/packs/drupal_js_basic@0.0.1/attachment/attachment_in_twig.yaml +26 -0
- periplus/packs/drupal_js_basic@0.0.1/attachment/php_function_holder.yaml +13 -0
- periplus/packs/drupal_js_basic@0.0.1/behavior/behavior.yaml +198 -0
- periplus/packs/drupal_js_basic@0.0.1/pack.yaml +153 -0
- periplus/packs/drupal_js_basic@0.0.1/setting/setting.yaml +13 -0
- periplus/packs/drupal_js_basic@0.0.1/setting/setting_in_js.yaml +15 -0
- periplus/packs/drupal_js_basic@0.0.1/setting/setting_in_php.yaml +92 -0
- periplus/packs/drush_basic@0.0.1/command/command.yaml +15 -0
- periplus/packs/drush_basic@0.0.1/command/command_annotation.yaml +60 -0
- periplus/packs/drush_basic@0.0.1/command/command_attribute.yaml +88 -0
- periplus/packs/drush_basic@0.0.1/pack.yaml +29 -0
- periplus/packs/eck_basic@0.0.1/bundle/eck_bundle_config.yaml +56 -0
- periplus/packs/eck_basic@0.0.1/entity_type/eck_entity_type_config.yaml +26 -0
- periplus/packs/eck_basic@0.0.1/pack.yaml +28 -0
- periplus/packs/go@0.0.2/interfaces/satisfies.yaml +47 -0
- periplus/packs/go@0.0.2/pack.yaml +51 -0
- periplus/packs/go@0.0.2/types/find_declarations.yaml +137 -0
- periplus/packs/go@0.0.2/types/node_types.yaml +36 -0
- periplus/packs/go_basic@0.0.3/pack.yaml +104 -0
- periplus/packs/go_basic@0.0.3/rules/calls.yaml +25 -0
- periplus/packs/go_basic@0.0.3/rules/declarations.yaml +40 -0
- periplus/packs/go_basic@0.0.3/rules/imports.yaml +16 -0
- periplus/packs/go_basic@0.0.3/types/node_types.yaml +15 -0
- periplus/packs/js_basic@0.0.1/function/function.yaml +68 -0
- periplus/packs/js_basic@0.0.1/pack.yaml +50 -0
- periplus/packs/laravel_basic@0.0.5/pack.yaml +313 -0
- periplus/packs/laravel_basic@0.0.5/rules/classes.yaml +42 -0
- periplus/packs/laravel_basic@0.0.5/rules/config.yaml +229 -0
- periplus/packs/laravel_basic@0.0.5/rules/routes.yaml +210 -0
- periplus/packs/laravel_basic@0.0.5/rules/types.yaml +50 -0
- periplus/packs/laravel_basic@0.0.5/rules/views.yaml +100 -0
- periplus/packs/paragraphs_basic@0.0.1/bundle/paragraph_bundle_config.yaml +54 -0
- periplus/packs/paragraphs_basic@0.0.1/pack.yaml +12 -0
- periplus/packs/php@0.1.0/edges/edge_kinds.yaml +64 -0
- periplus/packs/php@0.1.0/edges/find_calls.yaml +34 -0
- periplus/packs/php@0.1.0/edges/find_imports.yaml +18 -0
- periplus/packs/php@0.1.0/edges/find_member_access.yaml +22 -0
- periplus/packs/php@0.1.0/edges/find_structure.yaml +38 -0
- periplus/packs/php@0.1.0/embedded/embedded_regions.yaml +19 -0
- periplus/packs/php@0.1.0/imports/imports.yaml +20 -0
- periplus/packs/php@0.1.0/pack.yaml +117 -0
- periplus/packs/php@0.1.0/resolution/excluded_tokens.yaml +23 -0
- periplus/packs/php@0.1.0/resolution/resolution.yaml +35 -0
- periplus/packs/php@0.1.0/types/find_declarations.yaml +102 -0
- periplus/packs/php@0.1.0/types/node_types.yaml +55 -0
- periplus/packs/php_basic@0.2.0/edges/edge_kinds.yaml +48 -0
- periplus/packs/php_basic@0.2.0/edges/find_structure.yaml +750 -0
- periplus/packs/php_basic@0.2.0/imports/imports.yaml +19 -0
- periplus/packs/php_basic@0.2.0/pack.yaml +94 -0
- periplus/packs/php_basic@0.2.0/types/find_declarations.yaml +267 -0
- periplus/packs/php_basic@0.2.0/types/node_types.yaml +55 -0
- periplus/packs/profile_basic@0.0.1/bundle/profile_bundle_config.yaml +54 -0
- periplus/packs/profile_basic@0.0.1/pack.yaml +12 -0
- periplus/packs/salesforce_basic@0.0.1/event/salesforce_event.yaml +36 -0
- periplus/packs/salesforce_basic@0.0.1/pack.yaml +31 -0
- periplus/packs/salesforce_basic@0.0.1/salesforce_mapping/salesforce_mapping.yaml +19 -0
- periplus/packs/salesforce_basic@0.0.1/salesforce_mapping/salesforce_mapping_config.yaml +83 -0
- periplus/packs/salesforce_basic@0.0.1/salesforce_mapping_field/salesforce_mapping_field.yaml +8 -0
- periplus/packs/salesforce_basic@0.0.1/salesforce_mapping_field/salesforce_mapping_field_annotation.yaml +43 -0
- periplus/packs/twig@0.0.1/pack.yaml +26 -0
- periplus/packs/twig@0.0.1/types/template.yaml +57 -0
- periplus/packs/twig_basic@0.1.0/pack.yaml +11 -0
- periplus/packs/twig_tweak_basic@0.0.1/pack.yaml +27 -0
- periplus/packs/twig_tweak_basic@0.0.1/rules/block.yaml +20 -0
- periplus/packs/twig_tweak_basic@0.0.1/rules/entity.yaml +35 -0
- periplus/packs/twig_tweak_basic@0.0.1/rules/field.yaml +21 -0
- periplus/packs/twig_tweak_basic@0.0.1/rules/menu.yaml +21 -0
- periplus/packs/webform_basic@0.0.1/bundle/webform_submission_bundle_config.yaml +54 -0
- periplus/packs/webform_basic@0.0.1/pack.yaml +20 -0
- periplus/packs/webform_basic@0.0.1/webform_handler/webform_handler.yaml +8 -0
- periplus/packs/webform_basic@0.0.1/webform_handler/webform_handler_annotation.yaml +43 -0
- periplus/packs/yaml@0.0.1/pack.yaml +72 -0
- periplus/packs/yaml@0.0.1/types/find_mapping_entry.yaml +21 -0
- periplus/packs/yaml@0.0.1/types/yaml_types.yaml +44 -0
- periplus/packs/yaml_basic@0.1.0/pack.yaml +10 -0
- periplus/packs.py +447 -0
- periplus/preflight.py +102 -0
- periplus/py.typed +0 -0
- periplus/report.py +596 -0
- periplus/resolution.py +355 -0
- periplus/settings.py +617 -0
- periplus/settings.stub.yml +99 -0
- periplus/spec.py +774 -0
- periplus/update.py +197 -0
- periplus/validate.py +655 -0
- periplus_map-0.2.1.dist-info/METADATA +566 -0
- periplus_map-0.2.1.dist-info/RECORD +272 -0
- periplus_map-0.2.1.dist-info/WHEEL +4 -0
- periplus_map-0.2.1.dist-info/entry_points.txt +2 -0
- periplus_map-0.2.1.dist-info/licenses/LICENSE +202 -0
- periplus_map-0.2.1.dist-info/licenses/NOTICE +2 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""``periplus neighbors`` and ``periplus affected``: the items reached along edges."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from collections.abc import Collection, Mapping
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from periplus.errors import ExitCode, HarnessError, Problem
|
|
12
|
+
from periplus.navigate.ids import resolve
|
|
13
|
+
from periplus.navigate.listing import Listing, cut, footer, payload
|
|
14
|
+
from periplus.navigate.mapfile import MapIndex, as_text, load_map, reading_fields
|
|
15
|
+
from periplus.report import _escape
|
|
16
|
+
|
|
17
|
+
__all__ = ["RENDERERS", "WalkReport", "render_json", "render_text", "run"]
|
|
18
|
+
|
|
19
|
+
_NONE = Listing((), 0, 0, False)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True, slots=True)
|
|
23
|
+
class WalkReport:
|
|
24
|
+
"""The items reached from ``start``, as a ``Listing`` of rows, with warnings and problems."""
|
|
25
|
+
|
|
26
|
+
start: str = ""
|
|
27
|
+
direction: str = "out"
|
|
28
|
+
rows: Listing = _NONE
|
|
29
|
+
warnings: tuple[str, ...] = ()
|
|
30
|
+
problems: tuple[Problem, ...] = ()
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def exit_code(self) -> ExitCode:
|
|
34
|
+
"""The lowest code among the problems, or ``OK`` when there were none."""
|
|
35
|
+
return min((problem.code for problem in self.problems), default=ExitCode.OK)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def walk(
|
|
39
|
+
index: MapIndex, start: str, direction: str, depth: int, kinds: Collection[str]
|
|
40
|
+
) -> list[dict[str, Any]]:
|
|
41
|
+
"""Breadth-first rows, each item once at its nearest depth with the first edge that reached it.
|
|
42
|
+
|
|
43
|
+
A layer's items are expanded in id order and each item's edges in (kind, other end) order, so
|
|
44
|
+
the edge that wins a tie is the same on every run.
|
|
45
|
+
"""
|
|
46
|
+
follow, end = (index.outgoing, "to") if direction == "out" else (index.incoming, "from")
|
|
47
|
+
other = "from" if end == "to" else "to"
|
|
48
|
+
seen = {start}
|
|
49
|
+
frontier = [start]
|
|
50
|
+
rows: list[dict[str, Any]] = []
|
|
51
|
+
for level in range(1, depth + 1):
|
|
52
|
+
reached: list[str] = []
|
|
53
|
+
for item in sorted(frontier):
|
|
54
|
+
edges = [e for e in follow(item) if not kinds or e["kind"] in kinds]
|
|
55
|
+
for edge in sorted(edges, key=lambda e: (e["kind"], e[end])):
|
|
56
|
+
target = edge[end]
|
|
57
|
+
if target in seen:
|
|
58
|
+
continue
|
|
59
|
+
seen.add(target)
|
|
60
|
+
reached.append(target)
|
|
61
|
+
# Indexed, not index.node: a dangling end is a damaged map, not an unknown id.
|
|
62
|
+
node = index.nodes[target]
|
|
63
|
+
rows.append(
|
|
64
|
+
{
|
|
65
|
+
"id": as_text(target),
|
|
66
|
+
"type": as_text(node["type"]),
|
|
67
|
+
"state": as_text(node["state"]),
|
|
68
|
+
"depth": level,
|
|
69
|
+
"kind": as_text(edge["kind"]),
|
|
70
|
+
"via": as_text(edge[other]),
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
frontier = reached
|
|
74
|
+
return sorted(rows, key=lambda r: (r["depth"], r["id"]))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def run(
|
|
78
|
+
start: Path,
|
|
79
|
+
env: Mapping[str, str],
|
|
80
|
+
node_id: str,
|
|
81
|
+
direction: str,
|
|
82
|
+
depth: int,
|
|
83
|
+
kinds: Collection[str],
|
|
84
|
+
limit: int,
|
|
85
|
+
map_path: Path | None,
|
|
86
|
+
) -> WalkReport:
|
|
87
|
+
"""Walk from ``node_id`` along edges (``out``) or against them (``in``), ``depth`` levels."""
|
|
88
|
+
try:
|
|
89
|
+
index = load_map(start, env, map_path)
|
|
90
|
+
node_id = resolve(index, node_id)
|
|
91
|
+
with reading_fields(start, map_path):
|
|
92
|
+
index.node(node_id)
|
|
93
|
+
rows = walk(index, node_id, direction, depth, set(kinds))
|
|
94
|
+
held = {edge["kind"] for edge in index.edges}
|
|
95
|
+
except HarnessError as error:
|
|
96
|
+
return WalkReport(problems=(error.problem(),))
|
|
97
|
+
warnings = tuple(
|
|
98
|
+
f"the map holds no edge of kind {kind!r}" for kind in sorted(set(kinds) - held)
|
|
99
|
+
)
|
|
100
|
+
return WalkReport(node_id, direction, cut(rows, limit), warnings)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def render_text(report: WalkReport) -> str:
|
|
104
|
+
"""The report as lines a person reads. Every outside string goes through ``_escape``."""
|
|
105
|
+
verb = "neighbors" if report.direction == "out" else "affected"
|
|
106
|
+
lines = [f"periplus {verb} {_escape(report.start)}" if report.start else f"periplus {verb}"]
|
|
107
|
+
if report.start:
|
|
108
|
+
lines.append(f"{report.rows.total} items")
|
|
109
|
+
for row in report.rows.items:
|
|
110
|
+
lines.append(
|
|
111
|
+
f" {row['depth']} {_escape(row['id'])} {_escape(row['type'])}"
|
|
112
|
+
f" {_escape(row['state'])}"
|
|
113
|
+
f" via {_escape(row['kind'])} from {_escape(row['via'])}"
|
|
114
|
+
)
|
|
115
|
+
note = footer(report.rows)
|
|
116
|
+
if note:
|
|
117
|
+
lines.append(note)
|
|
118
|
+
lines += [f"warning: {_escape(w)}" for w in report.warnings]
|
|
119
|
+
lines += [f"{int(p.code)} {_escape(p.message)}" for p in report.problems]
|
|
120
|
+
return "\n".join(lines) + "\n"
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def render_json(report: WalkReport) -> str:
|
|
124
|
+
"""The report as one JSON document, keys sorted, ``ensure_ascii=True``."""
|
|
125
|
+
document = {
|
|
126
|
+
"start": report.start,
|
|
127
|
+
"direction": report.direction,
|
|
128
|
+
"rows": payload(report.rows),
|
|
129
|
+
"warnings": list(report.warnings),
|
|
130
|
+
"problems": [
|
|
131
|
+
{"code": int(p.code), "message": p.message, "detail": dict(p.detail)}
|
|
132
|
+
for p in report.problems
|
|
133
|
+
],
|
|
134
|
+
}
|
|
135
|
+
return json.dumps(document, sort_keys=True, indent=2, ensure_ascii=True) + "\n"
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
RENDERERS = {"text": render_text, "json": render_json}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-manifest.schema.json"
|
|
2
|
+
|
|
3
|
+
# The Advanced Queue contributed module: its job type plugins, by attribute or by annotation,
|
|
4
|
+
# each joined to its class by plugin_class. Moved out of drupal_basic 0.2.0, which held them
|
|
5
|
+
# against the rule that a contributed module gets its own pack.
|
|
6
|
+
#
|
|
7
|
+
# Known gaps: an id that is not a text literal makes no plugin and is listed under skipped.
|
|
8
|
+
pack: advancedqueue_basic
|
|
9
|
+
version: 0.0.1
|
|
10
|
+
depends: [drupal_basic, php_basic]
|
|
11
|
+
|
|
12
|
+
folders:
|
|
13
|
+
# The folder the job type manager discovers in, below a module's src folder.
|
|
14
|
+
queue_job_type_classes: "{module_root}/src/Plugin/AdvancedQueue/JobType/**"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# An Advanced Queue job type plugin, named by its plugin id; plugin_class joins it to its class. It
|
|
4
|
+
# ends at the same type and id namespace whichever way it is declared.
|
|
5
|
+
|
|
6
|
+
node_types:
|
|
7
|
+
- name: drupal.queue_job_type
|
|
8
|
+
parent: drupal.plugin
|
|
9
|
+
id_namespace: drupal.plugin.advancedqueue_job_type
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# An Advanced Queue job type plugin declared by the AdvancedQueueJobType docblock annotation on its
|
|
4
|
+
# class. Two rules because a rule that emits an edge emits no node. An id that is not text in double
|
|
5
|
+
# quotes makes no plugin and is listed under skipped in the map report.
|
|
6
|
+
|
|
7
|
+
rules:
|
|
8
|
+
- rule: queue_job_type_from_annotation
|
|
9
|
+
reads: file
|
|
10
|
+
in:
|
|
11
|
+
- queue_job_type_classes
|
|
12
|
+
match:
|
|
13
|
+
annotation: AdvancedQueueJobType
|
|
14
|
+
filetype: php
|
|
15
|
+
where:
|
|
16
|
+
- applies_to: class_declaration
|
|
17
|
+
id:
|
|
18
|
+
from:
|
|
19
|
+
annotation_key: id
|
|
20
|
+
must_be: string_literal
|
|
21
|
+
emits:
|
|
22
|
+
- node:
|
|
23
|
+
type: drupal.queue_job_type
|
|
24
|
+
confidence: declared
|
|
25
|
+
- rule: queue_job_type_from_annotation_edges
|
|
26
|
+
reads: file
|
|
27
|
+
in:
|
|
28
|
+
- queue_job_type_classes
|
|
29
|
+
match:
|
|
30
|
+
annotation: AdvancedQueueJobType
|
|
31
|
+
filetype: php
|
|
32
|
+
where:
|
|
33
|
+
- applies_to: class_declaration
|
|
34
|
+
id:
|
|
35
|
+
from:
|
|
36
|
+
annotation_key: id
|
|
37
|
+
must_be: string_literal
|
|
38
|
+
emits:
|
|
39
|
+
- edge:
|
|
40
|
+
kind: plugin_class
|
|
41
|
+
from: this_node
|
|
42
|
+
to: enclosing_class
|
|
43
|
+
confidence: declared
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# An Advanced Queue job type plugin declared by the AdvancedQueueJobType attribute on its class. Two
|
|
4
|
+
# rules because a rule that emits an edge emits no node. An id that is not a text literal makes no
|
|
5
|
+
# plugin and is listed under skipped in the map report.
|
|
6
|
+
|
|
7
|
+
rules:
|
|
8
|
+
- rule: queue_job_type_from_attribute
|
|
9
|
+
reads: file
|
|
10
|
+
in:
|
|
11
|
+
- queue_job_type_classes
|
|
12
|
+
match:
|
|
13
|
+
attribute: Drupal\advancedqueue\Attribute\AdvancedQueueJobType
|
|
14
|
+
filetype: php
|
|
15
|
+
where:
|
|
16
|
+
- applies_to: class_declaration
|
|
17
|
+
id:
|
|
18
|
+
from:
|
|
19
|
+
attribute_argument: id
|
|
20
|
+
must_be: string_literal
|
|
21
|
+
emits:
|
|
22
|
+
- node:
|
|
23
|
+
type: drupal.queue_job_type
|
|
24
|
+
confidence: declared
|
|
25
|
+
- rule: queue_job_type_from_attribute_edges
|
|
26
|
+
reads: file
|
|
27
|
+
in:
|
|
28
|
+
- queue_job_type_classes
|
|
29
|
+
match:
|
|
30
|
+
attribute: Drupal\advancedqueue\Attribute\AdvancedQueueJobType
|
|
31
|
+
filetype: php
|
|
32
|
+
where:
|
|
33
|
+
- applies_to: class_declaration
|
|
34
|
+
id:
|
|
35
|
+
from:
|
|
36
|
+
attribute_argument: id
|
|
37
|
+
must_be: string_literal
|
|
38
|
+
emits:
|
|
39
|
+
- edge:
|
|
40
|
+
kind: plugin_class
|
|
41
|
+
from: this_node
|
|
42
|
+
to: enclosing_class
|
|
43
|
+
confidence: declared
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# An AI agent plugin declared by the AiAgent attribute on its class. Two rules because a rule that
|
|
4
|
+
# emits an edge emits no node. An id that is not a text literal makes no plugin and is listed under
|
|
5
|
+
# skipped in the map report.
|
|
6
|
+
|
|
7
|
+
rules:
|
|
8
|
+
- rule: ai_agent_from_attribute
|
|
9
|
+
reads: file
|
|
10
|
+
in:
|
|
11
|
+
- ai_agent_classes
|
|
12
|
+
match:
|
|
13
|
+
attribute: Drupal\ai_agents\Attribute\AiAgent
|
|
14
|
+
filetype: php
|
|
15
|
+
where:
|
|
16
|
+
- applies_to: class_declaration
|
|
17
|
+
id:
|
|
18
|
+
from:
|
|
19
|
+
attribute_argument: id
|
|
20
|
+
must_be: string_literal
|
|
21
|
+
emits:
|
|
22
|
+
- node:
|
|
23
|
+
type: drupal.ai_agent
|
|
24
|
+
confidence: declared
|
|
25
|
+
- rule: ai_agent_from_attribute_edges
|
|
26
|
+
reads: file
|
|
27
|
+
in:
|
|
28
|
+
- ai_agent_classes
|
|
29
|
+
match:
|
|
30
|
+
attribute: Drupal\ai_agents\Attribute\AiAgent
|
|
31
|
+
filetype: php
|
|
32
|
+
where:
|
|
33
|
+
- applies_to: class_declaration
|
|
34
|
+
id:
|
|
35
|
+
from:
|
|
36
|
+
attribute_argument: id
|
|
37
|
+
must_be: string_literal
|
|
38
|
+
emits:
|
|
39
|
+
- edge:
|
|
40
|
+
kind: plugin_class
|
|
41
|
+
from: this_node
|
|
42
|
+
to: enclosing_class
|
|
43
|
+
confidence: declared
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# An AI function call plugin, named by its plugin id; plugin_class joins it to its class.
|
|
4
|
+
|
|
5
|
+
node_types:
|
|
6
|
+
- name: drupal.ai_function_call
|
|
7
|
+
parent: drupal.plugin
|
|
8
|
+
id_namespace: drupal.plugin.ai_function_call
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# An AI function call plugin declared by the FunctionCall attribute on its class. Two rules because
|
|
4
|
+
# a rule that emits an edge emits no node. An id that is not a text literal makes no plugin and is
|
|
5
|
+
# listed under skipped in the map report.
|
|
6
|
+
|
|
7
|
+
rules:
|
|
8
|
+
- rule: ai_function_call_from_attribute
|
|
9
|
+
reads: file
|
|
10
|
+
in:
|
|
11
|
+
- ai_function_call_classes
|
|
12
|
+
match:
|
|
13
|
+
attribute: Drupal\ai\Attribute\FunctionCall
|
|
14
|
+
filetype: php
|
|
15
|
+
where:
|
|
16
|
+
- applies_to: class_declaration
|
|
17
|
+
id:
|
|
18
|
+
from:
|
|
19
|
+
attribute_argument: id
|
|
20
|
+
must_be: string_literal
|
|
21
|
+
emits:
|
|
22
|
+
- node:
|
|
23
|
+
type: drupal.ai_function_call
|
|
24
|
+
confidence: declared
|
|
25
|
+
- rule: ai_function_call_from_attribute_edges
|
|
26
|
+
reads: file
|
|
27
|
+
in:
|
|
28
|
+
- ai_function_call_classes
|
|
29
|
+
match:
|
|
30
|
+
attribute: Drupal\ai\Attribute\FunctionCall
|
|
31
|
+
filetype: php
|
|
32
|
+
where:
|
|
33
|
+
- applies_to: class_declaration
|
|
34
|
+
id:
|
|
35
|
+
from:
|
|
36
|
+
attribute_argument: id
|
|
37
|
+
must_be: string_literal
|
|
38
|
+
emits:
|
|
39
|
+
- edge:
|
|
40
|
+
kind: plugin_class
|
|
41
|
+
from: this_node
|
|
42
|
+
to: enclosing_class
|
|
43
|
+
confidence: declared
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-manifest.schema.json"
|
|
2
|
+
|
|
3
|
+
# The AI contributed module: its agent plugins and its function call plugins, by attribute, each
|
|
4
|
+
# joined to its class by plugin_class. Moved out of drupal_basic 0.2.0, which held them against
|
|
5
|
+
# the rule that a contributed module gets its own pack.
|
|
6
|
+
#
|
|
7
|
+
# Known gaps: an id that is not a text literal makes no plugin and is listed under skipped.
|
|
8
|
+
pack: ai_basic
|
|
9
|
+
version: 0.0.1
|
|
10
|
+
depends: [drupal_basic, php_basic]
|
|
11
|
+
|
|
12
|
+
folders:
|
|
13
|
+
# The folders the two plugin managers discover in, below a module's src folder.
|
|
14
|
+
ai_agent_classes: "{module_root}/src/Plugin/AiAgent/**"
|
|
15
|
+
ai_function_call_classes: "{module_root}/src/Plugin/AiFunctionCall/**"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# A config page type read from its config file as the bundle config_pages.<id>, the id drupal_basic gives a field or
|
|
4
|
+
# display of it. Two rules: the node with its label, and its edges.
|
|
5
|
+
|
|
6
|
+
rules:
|
|
7
|
+
- rule: bundle_config_pages_from_config
|
|
8
|
+
reads: file
|
|
9
|
+
in:
|
|
10
|
+
- config
|
|
11
|
+
- module_config
|
|
12
|
+
match:
|
|
13
|
+
file: config_pages.type.*
|
|
14
|
+
filetype: yaml
|
|
15
|
+
id:
|
|
16
|
+
from: file_stem
|
|
17
|
+
normalize:
|
|
18
|
+
- {replace: '^config_pages\.type\.', with: 'config_pages.'}
|
|
19
|
+
emits:
|
|
20
|
+
- node:
|
|
21
|
+
type: drupal.bundle
|
|
22
|
+
- attribute:
|
|
23
|
+
name: label
|
|
24
|
+
from:
|
|
25
|
+
key: label
|
|
26
|
+
confidence: declared
|
|
27
|
+
- rule: bundle_config_pages_from_config_edges
|
|
28
|
+
reads: file
|
|
29
|
+
in:
|
|
30
|
+
- config
|
|
31
|
+
- module_config
|
|
32
|
+
match:
|
|
33
|
+
file: config_pages.type.*
|
|
34
|
+
filetype: yaml
|
|
35
|
+
id:
|
|
36
|
+
from: file_stem
|
|
37
|
+
normalize:
|
|
38
|
+
- {replace: '^config_pages\.type\.', with: 'config_pages.'}
|
|
39
|
+
emits:
|
|
40
|
+
- edge:
|
|
41
|
+
kind: configured_by
|
|
42
|
+
from: this_node
|
|
43
|
+
to:
|
|
44
|
+
from:
|
|
45
|
+
key: id
|
|
46
|
+
template: 'config_pages.type.{id}'
|
|
47
|
+
- edge:
|
|
48
|
+
kind: bundle_of
|
|
49
|
+
from: this_node
|
|
50
|
+
to:
|
|
51
|
+
from:
|
|
52
|
+
key: id
|
|
53
|
+
template: 'config_pages'
|
|
54
|
+
confidence: declared
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-manifest.schema.json"
|
|
2
|
+
|
|
3
|
+
# The Config Pages contributed module: each config page type, from its config file, as the bundle
|
|
4
|
+
# config_pages.<id> with its label, a configured_by edge to that file and a bundle_of edge to the
|
|
5
|
+
# entity type config_pages.
|
|
6
|
+
#
|
|
7
|
+
# Known gaps: a type's context, menu and token settings give nothing. The entity type config_pages
|
|
8
|
+
# is declared by the module's PHP, which is not mapped, so it stays referenced.
|
|
9
|
+
pack: config_pages_basic
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
depends: [drupal_basic]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# A crop type read from its config file as the bundle crop.<id>, the id drupal_basic gives a field or
|
|
4
|
+
# display of it. Two rules: the node with its label, and its edges.
|
|
5
|
+
|
|
6
|
+
rules:
|
|
7
|
+
- rule: bundle_crop_from_config
|
|
8
|
+
reads: file
|
|
9
|
+
in:
|
|
10
|
+
- config
|
|
11
|
+
- module_config
|
|
12
|
+
match:
|
|
13
|
+
file: crop.type.*
|
|
14
|
+
filetype: yaml
|
|
15
|
+
id:
|
|
16
|
+
from: file_stem
|
|
17
|
+
normalize:
|
|
18
|
+
- {replace: '^crop\.type\.', with: 'crop.'}
|
|
19
|
+
emits:
|
|
20
|
+
- node:
|
|
21
|
+
type: drupal.bundle
|
|
22
|
+
- attribute:
|
|
23
|
+
name: label
|
|
24
|
+
from:
|
|
25
|
+
key: label
|
|
26
|
+
confidence: declared
|
|
27
|
+
- rule: bundle_crop_from_config_edges
|
|
28
|
+
reads: file
|
|
29
|
+
in:
|
|
30
|
+
- config
|
|
31
|
+
- module_config
|
|
32
|
+
match:
|
|
33
|
+
file: crop.type.*
|
|
34
|
+
filetype: yaml
|
|
35
|
+
id:
|
|
36
|
+
from: file_stem
|
|
37
|
+
normalize:
|
|
38
|
+
- {replace: '^crop\.type\.', with: 'crop.'}
|
|
39
|
+
emits:
|
|
40
|
+
- edge:
|
|
41
|
+
kind: configured_by
|
|
42
|
+
from: this_node
|
|
43
|
+
to:
|
|
44
|
+
from:
|
|
45
|
+
key: id
|
|
46
|
+
template: 'crop.type.{id}'
|
|
47
|
+
- edge:
|
|
48
|
+
kind: bundle_of
|
|
49
|
+
from: this_node
|
|
50
|
+
to:
|
|
51
|
+
from:
|
|
52
|
+
key: id
|
|
53
|
+
template: 'crop'
|
|
54
|
+
confidence: declared
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-manifest.schema.json"
|
|
2
|
+
|
|
3
|
+
# The Crop API contributed module: each crop type, from its config file, as the bundle crop.<id>
|
|
4
|
+
# with its label, a configured_by edge to that file and a bundle_of edge to the entity type crop.
|
|
5
|
+
#
|
|
6
|
+
# Known gaps: a crop type's aspect ratio and size limits give nothing, and an image style's crop
|
|
7
|
+
# effect gives no edge to the crop type it names. The entity type crop is declared by the module's
|
|
8
|
+
# PHP, which is not mapped, so it stays referenced.
|
|
9
|
+
pack: crop_basic
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
depends: [drupal_basic]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# drupal pack — declares the block placement and its edges. Finds nothing.
|
|
4
|
+
#
|
|
5
|
+
# A placement is one instance of a block, in a theme, in a region. It is a config entity, so
|
|
6
|
+
# it is a refinement of drupal.config_object rather than a separate kind of thing — a reader
|
|
7
|
+
# asking for all configuration still gets these.
|
|
8
|
+
#
|
|
9
|
+
# One block, many placements. Verified in the export:
|
|
10
|
+
# block.block.claro_page_title.yml plugin: page_title_block
|
|
11
|
+
# block.block.gin_page_title.yml plugin: page_title_block
|
|
12
|
+
# block.block.olivero_page_title.yml plugin: page_title_block
|
|
13
|
+
# and every block_ways placement now has a _b twin. In block_ways alone each block is placed
|
|
14
|
+
# once, which looks one-to-one and is only the module being small.
|
|
15
|
+
|
|
16
|
+
node_types:
|
|
17
|
+
|
|
18
|
+
- name: drupal.block_placement
|
|
19
|
+
parent: drupal.config_object
|
|
20
|
+
|
|
21
|
+
edge_kinds:
|
|
22
|
+
|
|
23
|
+
- kind: places_plugin
|
|
24
|
+
from: drupal.block_placement
|
|
25
|
+
to: drupal.block_plugin
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# drupal pack — block placement created by PHP. One rule.
|
|
4
|
+
#
|
|
5
|
+
# Supplementary to block_placement_config.yaml, and the pair is the sharpest evidence we
|
|
6
|
+
# have for why both are needed. In block_ways there are seven placements in config/install
|
|
7
|
+
# and an eighth that exists only as PHP:
|
|
8
|
+
#
|
|
9
|
+
# config/install 1 2 3 4 5 7 8
|
|
10
|
+
# block_ways.install 6
|
|
11
|
+
# the export all eight
|
|
12
|
+
#
|
|
13
|
+
# So the config rule alone finds nothing until someone exports, and the code rule alone
|
|
14
|
+
# misses seven. Together they hold whatever state the repository is in.
|
|
15
|
+
|
|
16
|
+
needs:
|
|
17
|
+
types:
|
|
18
|
+
- drupal.block_placement
|
|
19
|
+
- drupal.block_plugin
|
|
20
|
+
rules:
|
|
21
|
+
- rule: block_placement_from_code
|
|
22
|
+
reads: file
|
|
23
|
+
in:
|
|
24
|
+
- custom_module
|
|
25
|
+
match:
|
|
26
|
+
static_call: Drupal\block\Entity\Block::create
|
|
27
|
+
argument: 0
|
|
28
|
+
id: &id001
|
|
29
|
+
from:
|
|
30
|
+
argument_key: id
|
|
31
|
+
must_be: string_literal
|
|
32
|
+
template: block.block.{id}
|
|
33
|
+
on_miss: unresolved
|
|
34
|
+
emits:
|
|
35
|
+
- node:
|
|
36
|
+
type: drupal.block_placement
|
|
37
|
+
confidence: declared
|
|
38
|
+
- rule: block_placement_from_code_edges
|
|
39
|
+
reads: file
|
|
40
|
+
in:
|
|
41
|
+
- custom_module
|
|
42
|
+
match:
|
|
43
|
+
static_call: Drupal\block\Entity\Block::create
|
|
44
|
+
argument: 0
|
|
45
|
+
emits:
|
|
46
|
+
- edge:
|
|
47
|
+
kind: declares
|
|
48
|
+
from: enclosing_callable
|
|
49
|
+
to: this_node
|
|
50
|
+
- edge:
|
|
51
|
+
kind: places_plugin
|
|
52
|
+
from: this_node
|
|
53
|
+
to:
|
|
54
|
+
from:
|
|
55
|
+
argument_key: plugin
|
|
56
|
+
template: drupal.plugin.block::{plugin}
|
|
57
|
+
confidence: declared
|
|
58
|
+
id: *id001
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
$schema: "https://periplus.dev/schema/0/pack-file.schema.json"
|
|
2
|
+
|
|
3
|
+
# drupal pack — block placement from a config file. One rule.
|
|
4
|
+
|
|
5
|
+
needs:
|
|
6
|
+
types:
|
|
7
|
+
- drupal.block_placement
|
|
8
|
+
- drupal.block_plugin
|
|
9
|
+
rules:
|
|
10
|
+
- rule: block_placement_from_config
|
|
11
|
+
reads: file
|
|
12
|
+
in:
|
|
13
|
+
- config
|
|
14
|
+
- module_config
|
|
15
|
+
match:
|
|
16
|
+
file: block.block.*
|
|
17
|
+
filetype: yaml
|
|
18
|
+
id: &id001
|
|
19
|
+
from: file_stem
|
|
20
|
+
emits:
|
|
21
|
+
- node:
|
|
22
|
+
type: drupal.block_placement
|
|
23
|
+
- attribute:
|
|
24
|
+
name: theme
|
|
25
|
+
from:
|
|
26
|
+
key: theme
|
|
27
|
+
- attribute:
|
|
28
|
+
name: region
|
|
29
|
+
from:
|
|
30
|
+
key: region
|
|
31
|
+
- attribute:
|
|
32
|
+
name: weight
|
|
33
|
+
from:
|
|
34
|
+
key: weight
|
|
35
|
+
confidence: declared
|
|
36
|
+
- rule: block_placement_from_config_edges
|
|
37
|
+
reads: file
|
|
38
|
+
in:
|
|
39
|
+
- config
|
|
40
|
+
- module_config
|
|
41
|
+
match:
|
|
42
|
+
file: block.block.*
|
|
43
|
+
filetype: yaml
|
|
44
|
+
emits:
|
|
45
|
+
- edge:
|
|
46
|
+
kind: places_plugin
|
|
47
|
+
from: this_node
|
|
48
|
+
to:
|
|
49
|
+
from:
|
|
50
|
+
key: plugin
|
|
51
|
+
template: drupal.plugin.block::{plugin}
|
|
52
|
+
confidence: declared
|
|
53
|
+
id: *id001
|