@noego/wood 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -0
- package/bin/axe.js +202 -0
- package/bin/stick.js +96 -0
- package/bin/wood.js +572 -0
- package/dist/bridge/backend_bridge.cjs +186 -0
- package/dist/bridge/backend_bridge.cjs.map +1 -0
- package/dist/bridge/backend_bridge.d.cts +32 -0
- package/dist/bridge/backend_bridge.d.ts +32 -0
- package/dist/bridge/backend_bridge.js +152 -0
- package/dist/bridge/backend_bridge.js.map +1 -0
- package/dist/bridge/backend_entry.cjs +64 -0
- package/dist/bridge/backend_entry.cjs.map +1 -0
- package/dist/bridge/backend_entry.d.cts +14 -0
- package/dist/bridge/backend_entry.d.ts +14 -0
- package/dist/bridge/backend_entry.js +39 -0
- package/dist/bridge/backend_entry.js.map +1 -0
- package/dist/bridge/index.cjs +34 -0
- package/dist/bridge/index.cjs.map +1 -0
- package/dist/bridge/index.d.cts +2 -0
- package/dist/bridge/index.d.ts +2 -0
- package/dist/bridge/index.js +8 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/client/controller_contract.cjs +17 -0
- package/dist/client/controller_contract.cjs.map +1 -0
- package/dist/client/controller_contract.d.cts +15 -0
- package/dist/client/controller_contract.d.ts +15 -0
- package/dist/client/controller_contract.js +1 -0
- package/dist/client/controller_contract.js.map +1 -0
- package/dist/client/global_polyfill.cjs +6 -0
- package/dist/client/global_polyfill.cjs.map +1 -0
- package/dist/client/global_polyfill.d.cts +2 -0
- package/dist/client/global_polyfill.d.ts +2 -0
- package/dist/client/global_polyfill.js +5 -0
- package/dist/client/global_polyfill.js.map +1 -0
- package/dist/client/index.cjs +451 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +75 -0
- package/dist/client/index.d.ts +75 -0
- package/dist/client/index.js +414 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/wood_controller.svelte.cjs +110 -0
- package/dist/client/wood_controller.svelte.cjs.map +1 -0
- package/dist/client/wood_controller.svelte.d.cts +30 -0
- package/dist/client/wood_controller.svelte.d.ts +30 -0
- package/dist/client/wood_controller.svelte.js +86 -0
- package/dist/client/wood_controller.svelte.js.map +1 -0
- package/dist/codegen/controller_registration_generator.cjs +138 -0
- package/dist/codegen/controller_registration_generator.cjs.map +1 -0
- package/dist/codegen/controller_registration_generator.d.cts +18 -0
- package/dist/codegen/controller_registration_generator.d.ts +18 -0
- package/dist/codegen/controller_registration_generator.js +104 -0
- package/dist/codegen/controller_registration_generator.js.map +1 -0
- package/dist/codegen/index.cjs +50 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.d.cts +10 -0
- package/dist/codegen/index.d.ts +10 -0
- package/dist/codegen/index.js +19 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/preload_generator.cjs +151 -0
- package/dist/codegen/preload_generator.cjs.map +1 -0
- package/dist/codegen/preload_generator.d.cts +8 -0
- package/dist/codegen/preload_generator.d.ts +8 -0
- package/dist/codegen/preload_generator.js +127 -0
- package/dist/codegen/preload_generator.js.map +1 -0
- package/dist/codegen/renderer_app_generator.cjs +397 -0
- package/dist/codegen/renderer_app_generator.cjs.map +1 -0
- package/dist/codegen/renderer_app_generator.d.cts +13 -0
- package/dist/codegen/renderer_app_generator.d.ts +13 -0
- package/dist/codegen/renderer_app_generator.js +363 -0
- package/dist/codegen/renderer_app_generator.js.map +1 -0
- package/dist/codegen/renderer_controller_registration_generator.cjs +122 -0
- package/dist/codegen/renderer_controller_registration_generator.cjs.map +1 -0
- package/dist/codegen/renderer_controller_registration_generator.d.cts +9 -0
- package/dist/codegen/renderer_controller_registration_generator.d.ts +9 -0
- package/dist/codegen/renderer_controller_registration_generator.js +88 -0
- package/dist/codegen/renderer_controller_registration_generator.js.map +1 -0
- package/dist/codegen/renderer_view_manifest_generator.cjs +126 -0
- package/dist/codegen/renderer_view_manifest_generator.cjs.map +1 -0
- package/dist/codegen/renderer_view_manifest_generator.d.cts +11 -0
- package/dist/codegen/renderer_view_manifest_generator.d.ts +11 -0
- package/dist/codegen/renderer_view_manifest_generator.js +92 -0
- package/dist/codegen/renderer_view_manifest_generator.js.map +1 -0
- package/dist/codegen/runtime_generator.cjs +156 -0
- package/dist/codegen/runtime_generator.cjs.map +1 -0
- package/dist/codegen/runtime_generator.d.cts +14 -0
- package/dist/codegen/runtime_generator.d.ts +14 -0
- package/dist/codegen/runtime_generator.js +122 -0
- package/dist/codegen/runtime_generator.js.map +1 -0
- package/dist/codegen/test_mock_generator.cjs +98 -0
- package/dist/codegen/test_mock_generator.cjs.map +1 -0
- package/dist/codegen/test_mock_generator.d.cts +5 -0
- package/dist/codegen/test_mock_generator.d.ts +5 -0
- package/dist/codegen/test_mock_generator.js +74 -0
- package/dist/codegen/test_mock_generator.js.map +1 -0
- package/dist/codegen/type_generator.cjs +203 -0
- package/dist/codegen/type_generator.cjs.map +1 -0
- package/dist/codegen/type_generator.d.cts +5 -0
- package/dist/codegen/type_generator.d.ts +5 -0
- package/dist/codegen/type_generator.js +179 -0
- package/dist/codegen/type_generator.js.map +1 -0
- package/dist/components/contextMenu.cjs +163 -0
- package/dist/components/contextMenu.cjs.map +1 -0
- package/dist/components/contextMenu.d.cts +43 -0
- package/dist/components/contextMenu.d.ts +43 -0
- package/dist/components/contextMenu.js +138 -0
- package/dist/components/contextMenu.js.map +1 -0
- package/dist/config/config_parser.cjs +176 -0
- package/dist/config/config_parser.cjs.map +1 -0
- package/dist/config/config_parser.d.cts +9 -0
- package/dist/config/config_parser.d.ts +9 -0
- package/dist/config/config_parser.js +142 -0
- package/dist/config/config_parser.js.map +1 -0
- package/dist/config/index.cjs +29 -0
- package/dist/config/index.cjs.map +1 -0
- package/dist/config/index.d.cts +2 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/chat.cjs +32 -0
- package/dist/controller/__fixtures__/controllers/chat.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/chat.d.cts +11 -0
- package/dist/controller/__fixtures__/controllers/chat.d.ts +11 -0
- package/dist/controller/__fixtures__/controllers/chat.js +12 -0
- package/dist/controller/__fixtures__/controllers/chat.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.cjs +29 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.d.cts +3 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.d.ts +3 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.js +5 -0
- package/dist/controller/__fixtures__/controllers/not_a_class.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.cjs +32 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.d.cts +12 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.d.ts +12 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.js +12 -0
- package/dist/controller/__fixtures__/controllers/settings.controller.js.map +1 -0
- package/dist/controller/__fixtures__/controllers/test.cjs +29 -0
- package/dist/controller/__fixtures__/controllers/test.cjs.map +1 -0
- package/dist/controller/__fixtures__/controllers/test.d.cts +7 -0
- package/dist/controller/__fixtures__/controllers/test.d.ts +7 -0
- package/dist/controller/__fixtures__/controllers/test.js +9 -0
- package/dist/controller/__fixtures__/controllers/test.js.map +1 -0
- package/dist/controller/controller_resolver.cjs +180 -0
- package/dist/controller/controller_resolver.cjs.map +1 -0
- package/dist/controller/controller_resolver.d.cts +51 -0
- package/dist/controller/controller_resolver.d.ts +51 -0
- package/dist/controller/controller_resolver.js +145 -0
- package/dist/controller/controller_resolver.js.map +1 -0
- package/dist/controller/index.cjs +31 -0
- package/dist/controller/index.cjs.map +1 -0
- package/dist/controller/index.d.cts +2 -0
- package/dist/controller/index.d.ts +2 -0
- package/dist/controller/index.js +6 -0
- package/dist/controller/index.js.map +1 -0
- package/dist/dev/backend_watcher.cjs +108 -0
- package/dist/dev/backend_watcher.cjs.map +1 -0
- package/dist/dev/backend_watcher.d.cts +22 -0
- package/dist/dev/backend_watcher.d.ts +22 -0
- package/dist/dev/backend_watcher.js +84 -0
- package/dist/dev/backend_watcher.js.map +1 -0
- package/dist/dev/dev_metadata.cjs +94 -0
- package/dist/dev/dev_metadata.cjs.map +1 -0
- package/dist/dev/dev_metadata.d.cts +20 -0
- package/dist/dev/dev_metadata.d.ts +20 -0
- package/dist/dev/dev_metadata.js +52 -0
- package/dist/dev/dev_metadata.js.map +1 -0
- package/dist/dev/esbuild_backend.cjs +124 -0
- package/dist/dev/esbuild_backend.cjs.map +1 -0
- package/dist/dev/esbuild_backend.d.cts +30 -0
- package/dist/dev/esbuild_backend.d.ts +30 -0
- package/dist/dev/esbuild_backend.js +90 -0
- package/dist/dev/esbuild_backend.js.map +1 -0
- package/dist/dev/index.cjs +57 -0
- package/dist/dev/index.cjs.map +1 -0
- package/dist/dev/index.d.cts +8 -0
- package/dist/dev/index.d.ts +8 -0
- package/dist/dev/index.js +31 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/dev/wood_dev_server.cjs +220 -0
- package/dist/dev/wood_dev_server.cjs.map +1 -0
- package/dist/dev/wood_dev_server.d.cts +39 -0
- package/dist/dev/wood_dev_server.d.ts +39 -0
- package/dist/dev/wood_dev_server.js +186 -0
- package/dist/dev/wood_dev_server.js.map +1 -0
- package/dist/dev/yaml_watcher.cjs +142 -0
- package/dist/dev/yaml_watcher.cjs.map +1 -0
- package/dist/dev/yaml_watcher.d.cts +22 -0
- package/dist/dev/yaml_watcher.d.ts +22 -0
- package/dist/dev/yaml_watcher.js +108 -0
- package/dist/dev/yaml_watcher.js.map +1 -0
- package/dist/electron/index.cjs +176 -0
- package/dist/electron/index.cjs.map +1 -0
- package/dist/electron/index.d.cts +29 -0
- package/dist/electron/index.d.ts +29 -0
- package/dist/electron/index.js +140 -0
- package/dist/electron/index.js.map +1 -0
- package/dist/index.cjs +178 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/index.cjs +80 -0
- package/dist/ipc/index.cjs.map +1 -0
- package/dist/ipc/index.d.cts +12 -0
- package/dist/ipc/index.d.ts +12 -0
- package/dist/ipc/index.js +57 -0
- package/dist/ipc/index.js.map +1 -0
- package/dist/ipc/shared.cjs +50 -0
- package/dist/ipc/shared.cjs.map +1 -0
- package/dist/ipc/shared.d.cts +10 -0
- package/dist/ipc/shared.d.ts +10 -0
- package/dist/ipc/shared.js +23 -0
- package/dist/ipc/shared.js.map +1 -0
- package/dist/loader/__fixtures__/layouts/app.load.cjs +27 -0
- package/dist/loader/__fixtures__/layouts/app.load.cjs.map +1 -0
- package/dist/loader/__fixtures__/layouts/app.load.d.cts +5 -0
- package/dist/loader/__fixtures__/layouts/app.load.d.ts +5 -0
- package/dist/loader/__fixtures__/layouts/app.load.js +7 -0
- package/dist/loader/__fixtures__/layouts/app.load.js.map +1 -0
- package/dist/loader/__fixtures__/views/test/page.load.cjs +27 -0
- package/dist/loader/__fixtures__/views/test/page.load.cjs.map +1 -0
- package/dist/loader/__fixtures__/views/test/page.load.d.cts +6 -0
- package/dist/loader/__fixtures__/views/test/page.load.d.ts +6 -0
- package/dist/loader/__fixtures__/views/test/page.load.js +7 -0
- package/dist/loader/__fixtures__/views/test/page.load.js.map +1 -0
- package/dist/loader/index.cjs +29 -0
- package/dist/loader/index.cjs.map +1 -0
- package/dist/loader/index.d.cts +3 -0
- package/dist/loader/index.d.ts +3 -0
- package/dist/loader/index.js +5 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/loader_runner.cjs +109 -0
- package/dist/loader/loader_runner.cjs.map +1 -0
- package/dist/loader/loader_runner.d.cts +27 -0
- package/dist/loader/loader_runner.d.ts +27 -0
- package/dist/loader/loader_runner.js +75 -0
- package/dist/loader/loader_runner.js.map +1 -0
- package/dist/main/index.cjs +500 -0
- package/dist/main/index.cjs.map +1 -0
- package/dist/main/index.d.cts +98 -0
- package/dist/main/index.d.ts +98 -0
- package/dist/main/index.js +475 -0
- package/dist/main/index.js.map +1 -0
- package/dist/middleware/__fixtures__/middleware/auth.cjs +44 -0
- package/dist/middleware/__fixtures__/middleware/auth.cjs.map +1 -0
- package/dist/middleware/__fixtures__/middleware/auth.d.cts +6 -0
- package/dist/middleware/__fixtures__/middleware/auth.d.ts +6 -0
- package/dist/middleware/__fixtures__/middleware/auth.js +19 -0
- package/dist/middleware/__fixtures__/middleware/auth.js.map +1 -0
- package/dist/middleware/__fixtures__/middleware/sequence.cjs +47 -0
- package/dist/middleware/__fixtures__/middleware/sequence.cjs.map +1 -0
- package/dist/middleware/__fixtures__/middleware/sequence.d.cts +7 -0
- package/dist/middleware/__fixtures__/middleware/sequence.d.ts +7 -0
- package/dist/middleware/__fixtures__/middleware/sequence.js +21 -0
- package/dist/middleware/__fixtures__/middleware/sequence.js.map +1 -0
- package/dist/middleware/index.cjs +34 -0
- package/dist/middleware/index.cjs.map +1 -0
- package/dist/middleware/index.d.cts +3 -0
- package/dist/middleware/index.d.ts +3 -0
- package/dist/middleware/index.js +8 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/middleware_pipeline.cjs +55 -0
- package/dist/middleware/middleware_pipeline.cjs.map +1 -0
- package/dist/middleware/middleware_pipeline.d.cts +13 -0
- package/dist/middleware/middleware_pipeline.d.ts +13 -0
- package/dist/middleware/middleware_pipeline.js +30 -0
- package/dist/middleware/middleware_pipeline.js.map +1 -0
- package/dist/middleware/middleware_resolver.cjs +91 -0
- package/dist/middleware/middleware_resolver.cjs.map +1 -0
- package/dist/middleware/middleware_resolver.d.cts +19 -0
- package/dist/middleware/middleware_resolver.d.ts +19 -0
- package/dist/middleware/middleware_resolver.js +57 -0
- package/dist/middleware/middleware_resolver.js.map +1 -0
- package/dist/navigation/index.cjs +205 -0
- package/dist/navigation/index.cjs.map +1 -0
- package/dist/navigation/index.d.cts +34 -0
- package/dist/navigation/index.d.ts +34 -0
- package/dist/navigation/index.js +176 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/parser/index.cjs +36 -0
- package/dist/parser/index.cjs.map +1 -0
- package/dist/parser/index.d.cts +4 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/index.js +9 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/operations_parser.cjs +94 -0
- package/dist/parser/operations_parser.cjs.map +1 -0
- package/dist/parser/operations_parser.d.cts +7 -0
- package/dist/parser/operations_parser.d.ts +7 -0
- package/dist/parser/operations_parser.js +59 -0
- package/dist/parser/operations_parser.js.map +1 -0
- package/dist/parser/views_parser.cjs +153 -0
- package/dist/parser/views_parser.cjs.map +1 -0
- package/dist/parser/views_parser.d.cts +11 -0
- package/dist/parser/views_parser.d.ts +11 -0
- package/dist/parser/views_parser.js +118 -0
- package/dist/parser/views_parser.js.map +1 -0
- package/dist/router/index.cjs +31 -0
- package/dist/router/index.cjs.map +1 -0
- package/dist/router/index.d.cts +2 -0
- package/dist/router/index.d.ts +2 -0
- package/dist/router/index.js +6 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/wood_router.cjs +246 -0
- package/dist/router/wood_router.cjs.map +1 -0
- package/dist/router/wood_router.d.cts +70 -0
- package/dist/router/wood_router.d.ts +70 -0
- package/dist/router/wood_router.js +221 -0
- package/dist/router/wood_router.js.map +1 -0
- package/dist/runtime/application_root.cjs +98 -0
- package/dist/runtime/application_root.cjs.map +1 -0
- package/dist/runtime/application_root.d.cts +5 -0
- package/dist/runtime/application_root.d.ts +5 -0
- package/dist/runtime/application_root.js +61 -0
- package/dist/runtime/application_root.js.map +1 -0
- package/dist/runtime/get_container.cjs +96 -0
- package/dist/runtime/get_container.cjs.map +1 -0
- package/dist/runtime/get_container.d.cts +16 -0
- package/dist/runtime/get_container.d.ts +16 -0
- package/dist/runtime/get_container.js +60 -0
- package/dist/runtime/get_container.js.map +1 -0
- package/dist/runtime/index.cjs +49 -0
- package/dist/runtime/index.cjs.map +1 -0
- package/dist/runtime/index.d.cts +8 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.js +24 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/renderer_log_dispatcher.cjs +79 -0
- package/dist/runtime/renderer_log_dispatcher.cjs.map +1 -0
- package/dist/runtime/renderer_log_dispatcher.d.cts +27 -0
- package/dist/runtime/renderer_log_dispatcher.d.ts +27 -0
- package/dist/runtime/renderer_log_dispatcher.js +54 -0
- package/dist/runtime/renderer_log_dispatcher.js.map +1 -0
- package/dist/runtime/runtime.cjs +158 -0
- package/dist/runtime/runtime.cjs.map +1 -0
- package/dist/runtime/runtime.d.cts +35 -0
- package/dist/runtime/runtime.d.ts +35 -0
- package/dist/runtime/runtime.js +136 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/stick/allow_cli.cjs +39 -0
- package/dist/stick/allow_cli.cjs.map +1 -0
- package/dist/stick/allow_cli.d.cts +6 -0
- package/dist/stick/allow_cli.d.ts +6 -0
- package/dist/stick/allow_cli.js +15 -0
- package/dist/stick/allow_cli.js.map +1 -0
- package/dist/stick/index.cjs +276 -0
- package/dist/stick/index.cjs.map +1 -0
- package/dist/stick/index.d.cts +111 -0
- package/dist/stick/index.d.ts +111 -0
- package/dist/stick/index.js +237 -0
- package/dist/stick/index.js.map +1 -0
- package/dist/stick/static_renderer.cjs +144 -0
- package/dist/stick/static_renderer.cjs.map +1 -0
- package/dist/stick/static_renderer.d.cts +51 -0
- package/dist/stick/static_renderer.d.ts +51 -0
- package/dist/stick/static_renderer.js +119 -0
- package/dist/stick/static_renderer.js.map +1 -0
- package/dist/stick/template_resolver.cjs +156 -0
- package/dist/stick/template_resolver.cjs.map +1 -0
- package/dist/stick/template_resolver.d.cts +7 -0
- package/dist/stick/template_resolver.d.ts +7 -0
- package/dist/stick/template_resolver.js +122 -0
- package/dist/stick/template_resolver.js.map +1 -0
- package/dist/testing/create_controller_harness.cjs +175 -0
- package/dist/testing/create_controller_harness.cjs.map +1 -0
- package/dist/testing/create_controller_harness.d.cts +37 -0
- package/dist/testing/create_controller_harness.d.ts +37 -0
- package/dist/testing/create_controller_harness.js +162 -0
- package/dist/testing/create_controller_harness.js.map +1 -0
- package/dist/testing/create_router_bridge.cjs +103 -0
- package/dist/testing/create_router_bridge.cjs.map +1 -0
- package/dist/testing/create_router_bridge.d.cts +71 -0
- package/dist/testing/create_router_bridge.d.ts +71 -0
- package/dist/testing/create_router_bridge.js +78 -0
- package/dist/testing/create_router_bridge.js.map +1 -0
- package/dist/testing/create_test_container.cjs +72 -0
- package/dist/testing/create_test_container.cjs.map +1 -0
- package/dist/testing/create_test_container.d.cts +14 -0
- package/dist/testing/create_test_container.d.ts +14 -0
- package/dist/testing/create_test_container.js +48 -0
- package/dist/testing/create_test_container.js.map +1 -0
- package/dist/testing/create_test_router.cjs +57 -0
- package/dist/testing/create_test_router.cjs.map +1 -0
- package/dist/testing/create_test_router.d.cts +19 -0
- package/dist/testing/create_test_router.d.ts +19 -0
- package/dist/testing/create_test_router.js +33 -0
- package/dist/testing/create_test_router.js.map +1 -0
- package/dist/testing/index.cjs +48 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +12 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.js +22 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock_electron.cjs +100 -0
- package/dist/testing/mock_electron.cjs.map +1 -0
- package/dist/testing/mock_electron.d.cts +12 -0
- package/dist/testing/mock_electron.d.ts +12 -0
- package/dist/testing/mock_electron.js +75 -0
- package/dist/testing/mock_electron.js.map +1 -0
- package/dist/tracing/index.cjs +56 -0
- package/dist/tracing/index.cjs.map +1 -0
- package/dist/tracing/index.d.cts +4 -0
- package/dist/tracing/index.d.ts +4 -0
- package/dist/tracing/index.js +35 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/tracing/trace_hub.cjs +213 -0
- package/dist/tracing/trace_hub.cjs.map +1 -0
- package/dist/tracing/trace_hub.d.cts +47 -0
- package/dist/tracing/trace_hub.d.ts +47 -0
- package/dist/tracing/trace_hub.js +172 -0
- package/dist/tracing/trace_hub.js.map +1 -0
- package/dist/tracing/trace_provider.cjs +200 -0
- package/dist/tracing/trace_provider.cjs.map +1 -0
- package/dist/tracing/trace_provider.d.cts +69 -0
- package/dist/tracing/trace_provider.d.ts +69 -0
- package/dist/tracing/trace_provider.js +179 -0
- package/dist/tracing/trace_provider.js.map +1 -0
- package/dist/types/bridge.cjs +51 -0
- package/dist/types/bridge.cjs.map +1 -0
- package/dist/types/bridge.d.cts +56 -0
- package/dist/types/bridge.d.ts +56 -0
- package/dist/types/bridge.js +25 -0
- package/dist/types/bridge.js.map +1 -0
- package/dist/types/config.cjs +17 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +74 -0
- package/dist/types/config.d.ts +74 -0
- package/dist/types/config.js +1 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/context.cjs +17 -0
- package/dist/types/context.cjs.map +1 -0
- package/dist/types/context.d.cts +61 -0
- package/dist/types/context.d.ts +61 -0
- package/dist/types/context.js +1 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/context_menu.cjs +17 -0
- package/dist/types/context_menu.cjs.map +1 -0
- package/dist/types/context_menu.d.cts +30 -0
- package/dist/types/context_menu.d.ts +30 -0
- package/dist/types/context_menu.js +1 -0
- package/dist/types/context_menu.js.map +1 -0
- package/dist/types/index.cjs +33 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +6 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/operations.cjs +17 -0
- package/dist/types/operations.cjs.map +1 -0
- package/dist/types/operations.d.cts +39 -0
- package/dist/types/operations.d.ts +39 -0
- package/dist/types/operations.js +1 -0
- package/dist/types/operations.js.map +1 -0
- package/dist/types/views.cjs +17 -0
- package/dist/types/views.cjs.map +1 -0
- package/dist/types/views.d.cts +44 -0
- package/dist/types/views.d.ts +44 -0
- package/dist/types/views.js +1 -0
- package/dist/types/views.js.map +1 -0
- package/dist/validation/index.cjs +29 -0
- package/dist/validation/index.cjs.map +1 -0
- package/dist/validation/index.d.cts +1 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +5 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/schema_validator.cjs +86 -0
- package/dist/validation/schema_validator.cjs.map +1 -0
- package/dist/validation/schema_validator.d.cts +24 -0
- package/dist/validation/schema_validator.d.ts +24 -0
- package/dist/validation/schema_validator.js +52 -0
- package/dist/validation/schema_validator.js.map +1 -0
- package/dist/window/index.cjs +32 -0
- package/dist/window/index.cjs.map +1 -0
- package/dist/window/index.d.cts +4 -0
- package/dist/window/index.d.ts +4 -0
- package/dist/window/index.js +7 -0
- package/dist/window/index.js.map +1 -0
- package/dist/window/window_manager.cjs +354 -0
- package/dist/window/window_manager.cjs.map +1 -0
- package/dist/window/window_manager.d.cts +172 -0
- package/dist/window/window_manager.d.ts +172 -0
- package/dist/window/window_manager.js +330 -0
- package/dist/window/window_manager.js.map +1 -0
- package/dist/window/window_state_store.cjs +129 -0
- package/dist/window/window_state_store.cjs.map +1 -0
- package/dist/window/window_state_store.d.cts +39 -0
- package/dist/window/window_state_store.d.ts +39 -0
- package/dist/window/window_state_store.js +105 -0
- package/dist/window/window_state_store.js.map +1 -0
- package/loaders/loader.mjs +46 -0
- package/package.json +119 -0
- package/src/components/ContextMenuProvider.svelte +145 -0
- package/src/components/NavigationShell.svelte +204 -0
- package/src/components/WoodRecursiveRender.svelte +91 -0
- package/src/components/contextMenu.ts +228 -0
- package/src/components/index.d.ts +14 -0
- package/src/components/index.js +2 -0
- package/src/stick/WoodRecursiveRender.svelte +74 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var operations_parser_exports = {};
|
|
30
|
+
__export(operations_parser_exports, {
|
|
31
|
+
parseOperations: () => parseOperations,
|
|
32
|
+
parseOperationsFile: () => parseOperationsFile
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(operations_parser_exports);
|
|
35
|
+
var import_js_yaml = __toESM(require("js-yaml"), 1);
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
function parseOperations(yamlContent) {
|
|
38
|
+
const doc = import_js_yaml.default.load(yamlContent);
|
|
39
|
+
const operations = /* @__PURE__ */ new Map();
|
|
40
|
+
if (doc.operations) {
|
|
41
|
+
for (const [channel, entry] of Object.entries(doc.operations)) {
|
|
42
|
+
operations.set(channel, {
|
|
43
|
+
channel,
|
|
44
|
+
controller: entry.controller,
|
|
45
|
+
action: entry.action,
|
|
46
|
+
middleware: entry.middleware ?? [],
|
|
47
|
+
inputSchema: entry.input,
|
|
48
|
+
outputSchema: entry.output
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (doc.module) {
|
|
53
|
+
for (const [moduleName, moduleDef] of Object.entries(doc.module)) {
|
|
54
|
+
const moduleController = moduleDef.controller;
|
|
55
|
+
const moduleMiddleware = moduleDef.middleware ?? [];
|
|
56
|
+
for (const [opName, opEntry] of Object.entries(moduleDef.operations)) {
|
|
57
|
+
const channel = `${moduleName}.${opName}`;
|
|
58
|
+
let middleware;
|
|
59
|
+
if (opEntry.middleware === null || Array.isArray(opEntry.middleware) && opEntry.middleware.length === 0) {
|
|
60
|
+
middleware = [];
|
|
61
|
+
} else {
|
|
62
|
+
middleware = [...moduleMiddleware, ...opEntry.middleware ?? []];
|
|
63
|
+
}
|
|
64
|
+
operations.set(channel, {
|
|
65
|
+
channel,
|
|
66
|
+
controller: opEntry.controller ?? moduleController ?? "",
|
|
67
|
+
action: opEntry.action,
|
|
68
|
+
middleware,
|
|
69
|
+
inputSchema: opEntry.input,
|
|
70
|
+
outputSchema: opEntry.output
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for (const [channel, op] of operations) {
|
|
76
|
+
if (!op.controller) {
|
|
77
|
+
throw new Error(`Operation "${channel}" has no controller defined`);
|
|
78
|
+
}
|
|
79
|
+
if (!op.action) {
|
|
80
|
+
throw new Error(`Operation "${channel}" has no action defined`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return operations;
|
|
84
|
+
}
|
|
85
|
+
function parseOperationsFile(filePath) {
|
|
86
|
+
const content = (0, import_fs.readFileSync)(filePath, "utf-8");
|
|
87
|
+
return parseOperations(content);
|
|
88
|
+
}
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
parseOperations,
|
|
92
|
+
parseOperationsFile
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=operations_parser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/parser/operations_parser.ts"],"sourcesContent":["import yaml from 'js-yaml';\nimport { readFileSync } from 'fs';\nimport type { OperationDef, RawOperationsDocument, RawModuleDef, RawOperationEntry, RawModuleOperationEntry } from '../types/index.cjs';\n\nexport function parseOperations(yamlContent: string): Map<string, OperationDef> {\n const doc = yaml.load(yamlContent) as RawOperationsDocument;\n const operations = new Map<string, OperationDef>();\n\n // 1. Parse flat operations (top-level `operations:` key)\n if (doc.operations) {\n for (const [channel, entry] of Object.entries(doc.operations)) {\n operations.set(channel, {\n channel,\n controller: entry.controller,\n action: entry.action,\n middleware: entry.middleware ?? [],\n inputSchema: entry.input,\n outputSchema: entry.output,\n });\n }\n }\n\n // 2. Parse module operations (`module:` key)\n if (doc.module) {\n for (const [moduleName, moduleDef] of Object.entries(doc.module)) {\n const moduleController = moduleDef.controller;\n const moduleMiddleware = moduleDef.middleware ?? [];\n\n for (const [opName, opEntry] of Object.entries(moduleDef.operations)) {\n const channel = `${moduleName}.${opName}`;\n\n // Middleware: if operation explicitly sets middleware to [] or null, clear inherited\n // Otherwise, prepend module middleware to operation middleware\n let middleware: string[];\n if (opEntry.middleware === null || (Array.isArray(opEntry.middleware) && opEntry.middleware.length === 0)) {\n middleware = [];\n } else {\n middleware = [...moduleMiddleware, ...(opEntry.middleware ?? [])];\n }\n\n operations.set(channel, {\n channel,\n controller: opEntry.controller ?? moduleController ?? '',\n action: opEntry.action,\n middleware,\n inputSchema: opEntry.input,\n outputSchema: opEntry.output,\n });\n }\n }\n }\n\n // 3. Validate: every operation must have a controller and action\n for (const [channel, op] of operations) {\n if (!op.controller) {\n throw new Error(`Operation \"${channel}\" has no controller defined`);\n }\n if (!op.action) {\n throw new Error(`Operation \"${channel}\" has no action defined`);\n }\n }\n\n return operations;\n}\n\n/** Parse from file path */\nexport function parseOperationsFile(filePath: string): Map<string, OperationDef> {\n const content = readFileSync(filePath, 'utf-8');\n return parseOperations(content);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiB;AACjB,gBAA6B;AAGtB,SAAS,gBAAgB,aAAgD;AAC9E,QAAM,MAAM,eAAAA,QAAK,KAAK,WAAW;AACjC,QAAM,aAAa,oBAAI,IAA0B;AAGjD,MAAI,IAAI,YAAY;AAClB,eAAW,CAAC,SAAS,KAAK,KAAK,OAAO,QAAQ,IAAI,UAAU,GAAG;AAC7D,iBAAW,IAAI,SAAS;AAAA,QACtB;AAAA,QACA,YAAY,MAAM;AAAA,QAClB,QAAQ,MAAM;AAAA,QACd,YAAY,MAAM,cAAc,CAAC;AAAA,QACjC,aAAa,MAAM;AAAA,QACnB,cAAc,MAAM;AAAA,MACtB,CAAC;AAAA,IACH;AAAA,EACF;AAGA,MAAI,IAAI,QAAQ;AACd,eAAW,CAAC,YAAY,SAAS,KAAK,OAAO,QAAQ,IAAI,MAAM,GAAG;AAChE,YAAM,mBAAmB,UAAU;AACnC,YAAM,mBAAmB,UAAU,cAAc,CAAC;AAElD,iBAAW,CAAC,QAAQ,OAAO,KAAK,OAAO,QAAQ,UAAU,UAAU,GAAG;AACpE,cAAM,UAAU,GAAG,UAAU,IAAI,MAAM;AAIvC,YAAI;AACJ,YAAI,QAAQ,eAAe,QAAS,MAAM,QAAQ,QAAQ,UAAU,KAAK,QAAQ,WAAW,WAAW,GAAI;AACzG,uBAAa,CAAC;AAAA,QAChB,OAAO;AACL,uBAAa,CAAC,GAAG,kBAAkB,GAAI,QAAQ,cAAc,CAAC,CAAE;AAAA,QAClE;AAEA,mBAAW,IAAI,SAAS;AAAA,UACtB;AAAA,UACA,YAAY,QAAQ,cAAc,oBAAoB;AAAA,UACtD,QAAQ,QAAQ;AAAA,UAChB;AAAA,UACA,aAAa,QAAQ;AAAA,UACrB,cAAc,QAAQ;AAAA,QACxB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAGA,aAAW,CAAC,SAAS,EAAE,KAAK,YAAY;AACtC,QAAI,CAAC,GAAG,YAAY;AAClB,YAAM,IAAI,MAAM,cAAc,OAAO,6BAA6B;AAAA,IACpE;AACA,QAAI,CAAC,GAAG,QAAQ;AACd,YAAM,IAAI,MAAM,cAAc,OAAO,yBAAyB;AAAA,IAChE;AAAA,EACF;AAEA,SAAO;AACT;AAGO,SAAS,oBAAoB,UAA6C;AAC/E,QAAM,cAAU,wBAAa,UAAU,OAAO;AAC9C,SAAO,gBAAgB,OAAO;AAChC;","names":["yaml"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OperationDef } from '../types/operations.cjs';
|
|
2
|
+
|
|
3
|
+
declare function parseOperations(yamlContent: string): Map<string, OperationDef>;
|
|
4
|
+
/** Parse from file path */
|
|
5
|
+
declare function parseOperationsFile(filePath: string): Map<string, OperationDef>;
|
|
6
|
+
|
|
7
|
+
export { parseOperations, parseOperationsFile };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OperationDef } from '../types/operations.js';
|
|
2
|
+
|
|
3
|
+
declare function parseOperations(yamlContent: string): Map<string, OperationDef>;
|
|
4
|
+
/** Parse from file path */
|
|
5
|
+
declare function parseOperationsFile(filePath: string): Map<string, OperationDef>;
|
|
6
|
+
|
|
7
|
+
export { parseOperations, parseOperationsFile };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import yaml from "js-yaml";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
function parseOperations(yamlContent) {
|
|
4
|
+
const doc = yaml.load(yamlContent);
|
|
5
|
+
const operations = /* @__PURE__ */ new Map();
|
|
6
|
+
if (doc.operations) {
|
|
7
|
+
for (const [channel, entry] of Object.entries(doc.operations)) {
|
|
8
|
+
operations.set(channel, {
|
|
9
|
+
channel,
|
|
10
|
+
controller: entry.controller,
|
|
11
|
+
action: entry.action,
|
|
12
|
+
middleware: entry.middleware ?? [],
|
|
13
|
+
inputSchema: entry.input,
|
|
14
|
+
outputSchema: entry.output
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (doc.module) {
|
|
19
|
+
for (const [moduleName, moduleDef] of Object.entries(doc.module)) {
|
|
20
|
+
const moduleController = moduleDef.controller;
|
|
21
|
+
const moduleMiddleware = moduleDef.middleware ?? [];
|
|
22
|
+
for (const [opName, opEntry] of Object.entries(moduleDef.operations)) {
|
|
23
|
+
const channel = `${moduleName}.${opName}`;
|
|
24
|
+
let middleware;
|
|
25
|
+
if (opEntry.middleware === null || Array.isArray(opEntry.middleware) && opEntry.middleware.length === 0) {
|
|
26
|
+
middleware = [];
|
|
27
|
+
} else {
|
|
28
|
+
middleware = [...moduleMiddleware, ...opEntry.middleware ?? []];
|
|
29
|
+
}
|
|
30
|
+
operations.set(channel, {
|
|
31
|
+
channel,
|
|
32
|
+
controller: opEntry.controller ?? moduleController ?? "",
|
|
33
|
+
action: opEntry.action,
|
|
34
|
+
middleware,
|
|
35
|
+
inputSchema: opEntry.input,
|
|
36
|
+
outputSchema: opEntry.output
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const [channel, op] of operations) {
|
|
42
|
+
if (!op.controller) {
|
|
43
|
+
throw new Error(`Operation "${channel}" has no controller defined`);
|
|
44
|
+
}
|
|
45
|
+
if (!op.action) {
|
|
46
|
+
throw new Error(`Operation "${channel}" has no action defined`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return operations;
|
|
50
|
+
}
|
|
51
|
+
function parseOperationsFile(filePath) {
|
|
52
|
+
const content = readFileSync(filePath, "utf-8");
|
|
53
|
+
return parseOperations(content);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
parseOperations,
|
|
57
|
+
parseOperationsFile
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=operations_parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/parser/operations_parser.ts"],"sourcesContent":["import yaml from 'js-yaml';\nimport { readFileSync } from 'fs';\nimport type { OperationDef, RawOperationsDocument, RawModuleDef, RawOperationEntry, RawModuleOperationEntry } from '../types/index.js';\n\nexport function parseOperations(yamlContent: string): Map<string, OperationDef> {\n const doc = yaml.load(yamlContent) as RawOperationsDocument;\n const operations = new Map<string, OperationDef>();\n\n // 1. Parse flat operations (top-level `operations:` key)\n if (doc.operations) {\n for (const [channel, entry] of Object.entries(doc.operations)) {\n operations.set(channel, {\n channel,\n controller: entry.controller,\n action: entry.action,\n middleware: entry.middleware ?? [],\n inputSchema: entry.input,\n outputSchema: entry.output,\n });\n }\n }\n\n // 2. Parse module operations (`module:` key)\n if (doc.module) {\n for (const [moduleName, moduleDef] of Object.entries(doc.module)) {\n const moduleController = moduleDef.controller;\n const moduleMiddleware = moduleDef.middleware ?? [];\n\n for (const [opName, opEntry] of Object.entries(moduleDef.operations)) {\n const channel = `${moduleName}.${opName}`;\n\n // Middleware: if operation explicitly sets middleware to [] or null, clear inherited\n // Otherwise, prepend module middleware to operation middleware\n let middleware: string[];\n if (opEntry.middleware === null || (Array.isArray(opEntry.middleware) && opEntry.middleware.length === 0)) {\n middleware = [];\n } else {\n middleware = [...moduleMiddleware, ...(opEntry.middleware ?? [])];\n }\n\n operations.set(channel, {\n channel,\n controller: opEntry.controller ?? moduleController ?? '',\n action: opEntry.action,\n middleware,\n inputSchema: opEntry.input,\n outputSchema: opEntry.output,\n });\n }\n }\n }\n\n // 3. Validate: every operation must have a controller and action\n for (const [channel, op] of operations) {\n if (!op.controller) {\n throw new Error(`Operation \"${channel}\" has no controller defined`);\n }\n if (!op.action) {\n throw new Error(`Operation \"${channel}\" has no action defined`);\n }\n }\n\n return operations;\n}\n\n/** Parse from file path */\nexport function parseOperationsFile(filePath: string): Map<string, OperationDef> {\n const content = readFileSync(filePath, 'utf-8');\n return parseOperations(content);\n}\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAGtB,SAAS,gBAAgB,aAAgD;AAC9E,QAAM,MAAM,KAAK,KAAK,WAAW;AACjC,QAAM,aAAa,oBAAI,IAA0B;AAGjD,MAAI,IAAI,YAAY;AAClB,eAAW,CAAC,SAAS,KAAK,KAAK,OAAO,QAAQ,IAAI,UAAU,GAAG;AAC7D,iBAAW,IAAI,SAAS;AAAA,QACtB;AAAA,QACA,YAAY,MAAM;AAAA,QAClB,QAAQ,MAAM;AAAA,QACd,YAAY,MAAM,cAAc,CAAC;AAAA,QACjC,aAAa,MAAM;AAAA,QACnB,cAAc,MAAM;AAAA,MACtB,CAAC;AAAA,IACH;AAAA,EACF;AAGA,MAAI,IAAI,QAAQ;AACd,eAAW,CAAC,YAAY,SAAS,KAAK,OAAO,QAAQ,IAAI,MAAM,GAAG;AAChE,YAAM,mBAAmB,UAAU;AACnC,YAAM,mBAAmB,UAAU,cAAc,CAAC;AAElD,iBAAW,CAAC,QAAQ,OAAO,KAAK,OAAO,QAAQ,UAAU,UAAU,GAAG;AACpE,cAAM,UAAU,GAAG,UAAU,IAAI,MAAM;AAIvC,YAAI;AACJ,YAAI,QAAQ,eAAe,QAAS,MAAM,QAAQ,QAAQ,UAAU,KAAK,QAAQ,WAAW,WAAW,GAAI;AACzG,uBAAa,CAAC;AAAA,QAChB,OAAO;AACL,uBAAa,CAAC,GAAG,kBAAkB,GAAI,QAAQ,cAAc,CAAC,CAAE;AAAA,QAClE;AAEA,mBAAW,IAAI,SAAS;AAAA,UACtB;AAAA,UACA,YAAY,QAAQ,cAAc,oBAAoB;AAAA,UACtD,QAAQ,QAAQ;AAAA,UAChB;AAAA,UACA,aAAa,QAAQ;AAAA,UACrB,cAAc,QAAQ;AAAA,QACxB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAGA,aAAW,CAAC,SAAS,EAAE,KAAK,YAAY;AACtC,QAAI,CAAC,GAAG,YAAY;AAClB,YAAM,IAAI,MAAM,cAAc,OAAO,6BAA6B;AAAA,IACpE;AACA,QAAI,CAAC,GAAG,QAAQ;AACd,YAAM,IAAI,MAAM,cAAc,OAAO,yBAAyB;AAAA,IAChE;AAAA,EACF;AAEA,SAAO;AACT;AAGO,SAAS,oBAAoB,UAA6C;AAC/E,QAAM,UAAU,aAAa,UAAU,OAAO;AAC9C,SAAO,gBAAgB,OAAO;AAChC;","names":[]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var views_parser_exports = {};
|
|
30
|
+
__export(views_parser_exports, {
|
|
31
|
+
parseViews: () => parseViews,
|
|
32
|
+
parseViewsFile: () => parseViewsFile
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(views_parser_exports);
|
|
35
|
+
var import_js_yaml = __toESM(require("js-yaml"), 1);
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
function validateControllerValue(controller, contextLabel) {
|
|
38
|
+
if (controller === void 0) return void 0;
|
|
39
|
+
if (typeof controller !== "string" || controller.trim().length === 0) {
|
|
40
|
+
throw new Error(`${contextLabel} has invalid controller. Expected a non-empty string.`);
|
|
41
|
+
}
|
|
42
|
+
return controller.trim();
|
|
43
|
+
}
|
|
44
|
+
function parseLayoutEntry(entry, viewKey, index) {
|
|
45
|
+
if (typeof entry === "string") {
|
|
46
|
+
const path = entry.trim();
|
|
47
|
+
if (!path) {
|
|
48
|
+
throw new Error(`View "${viewKey}" has invalid layout entry at index ${index}. Expected a non-empty path string.`);
|
|
49
|
+
}
|
|
50
|
+
return { path };
|
|
51
|
+
}
|
|
52
|
+
const layoutObj = entry;
|
|
53
|
+
const layoutPath = layoutObj.path ?? layoutObj.view ?? layoutObj.layout;
|
|
54
|
+
if (typeof layoutPath !== "string" || layoutPath.trim().length === 0) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`View "${viewKey}" has invalid layout object at index ${index}. Expected one of: path, view, or layout as a non-empty string.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
path: layoutPath.trim(),
|
|
61
|
+
controller: validateControllerValue(layoutObj.controller, `View "${viewKey}" layout[${index}]`)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function isLayoutGroupEntry(entry) {
|
|
65
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
66
|
+
return Object.prototype.hasOwnProperty.call(entry, "views");
|
|
67
|
+
}
|
|
68
|
+
function isLayoutObjectEntry(entry) {
|
|
69
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
70
|
+
return Object.prototype.hasOwnProperty.call(entry, "path") || Object.prototype.hasOwnProperty.call(entry, "view") || Object.prototype.hasOwnProperty.call(entry, "layout") || Object.prototype.hasOwnProperty.call(entry, "controller");
|
|
71
|
+
}
|
|
72
|
+
function normalizeLayouts(rawLayout, viewKey) {
|
|
73
|
+
if (rawLayout === void 0) {
|
|
74
|
+
return { entries: [] };
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(rawLayout)) {
|
|
77
|
+
return { entries: rawLayout };
|
|
78
|
+
}
|
|
79
|
+
if (typeof rawLayout === "string") {
|
|
80
|
+
return { entries: [rawLayout] };
|
|
81
|
+
}
|
|
82
|
+
if (isLayoutGroupEntry(rawLayout)) {
|
|
83
|
+
if (!Array.isArray(rawLayout.views)) {
|
|
84
|
+
throw new Error(`View "${viewKey}" has invalid layout object. "views" must be an array.`);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
entries: rawLayout.views,
|
|
88
|
+
inheritedController: validateControllerValue(rawLayout.controller, `View "${viewKey}" layout`)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (isLayoutObjectEntry(rawLayout)) {
|
|
92
|
+
return { entries: [rawLayout] };
|
|
93
|
+
}
|
|
94
|
+
throw new Error(
|
|
95
|
+
`View "${viewKey}" has invalid layout definition. Expected an array, a string path, or an object with "views".`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
function parseViews(yamlContent) {
|
|
99
|
+
var _a;
|
|
100
|
+
const doc = import_js_yaml.default.load(yamlContent);
|
|
101
|
+
const views = [];
|
|
102
|
+
if (doc.view) {
|
|
103
|
+
for (const [dotPath, entry] of Object.entries(doc.view)) {
|
|
104
|
+
const segments = dotPath.split(".");
|
|
105
|
+
const windowName = segments[0];
|
|
106
|
+
const pageName = segments.slice(1).join(".");
|
|
107
|
+
const normalizedLayouts = normalizeLayouts(entry.layout, dotPath);
|
|
108
|
+
const parsedLayouts = normalizedLayouts.entries.map(
|
|
109
|
+
(layoutEntry, index) => parseLayoutEntry(layoutEntry, dotPath, index)
|
|
110
|
+
);
|
|
111
|
+
if (normalizedLayouts.inheritedController) {
|
|
112
|
+
if (parsedLayouts.length === 0) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
`View "${dotPath}" sets a layout controller but has no layout views. Define at least one layout entry.`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
const firstLayoutController = parsedLayouts[0].controller;
|
|
118
|
+
if (firstLayoutController && firstLayoutController !== normalizedLayouts.inheritedController) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
`View "${dotPath}" has conflicting layout controllers. Use either layout.controller or layout.views[0].controller.`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
(_a = parsedLayouts[0]).controller ?? (_a.controller = normalizedLayouts.inheritedController);
|
|
124
|
+
}
|
|
125
|
+
const layoutPaths = parsedLayouts.map((layout) => layout.path);
|
|
126
|
+
const layoutControllers = parsedLayouts.map((layout) => layout.controller);
|
|
127
|
+
const viewController = validateControllerValue(entry.controller, `View "${dotPath}"`);
|
|
128
|
+
const viewDef = {
|
|
129
|
+
windowName,
|
|
130
|
+
pageName,
|
|
131
|
+
viewPath: entry.view,
|
|
132
|
+
layouts: layoutPaths,
|
|
133
|
+
middleware: entry.middleware,
|
|
134
|
+
controller: viewController
|
|
135
|
+
};
|
|
136
|
+
if (layoutControllers.some((value) => value !== void 0)) {
|
|
137
|
+
viewDef.layoutControllers = layoutControllers;
|
|
138
|
+
}
|
|
139
|
+
views.push(viewDef);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return views;
|
|
143
|
+
}
|
|
144
|
+
function parseViewsFile(filePath) {
|
|
145
|
+
const content = (0, import_fs.readFileSync)(filePath, "utf-8");
|
|
146
|
+
return parseViews(content);
|
|
147
|
+
}
|
|
148
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
+
0 && (module.exports = {
|
|
150
|
+
parseViews,
|
|
151
|
+
parseViewsFile
|
|
152
|
+
});
|
|
153
|
+
//# sourceMappingURL=views_parser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/parser/views_parser.ts"],"sourcesContent":["import yaml from 'js-yaml';\nimport { readFileSync } from 'fs';\nimport type {\n ViewDef,\n RawViewsDocument,\n RawLayoutEntry,\n RawLayoutObjectEntry,\n RawLayoutConfig,\n RawLayoutGroupEntry,\n} from '../types';\n\nfunction validateControllerValue(controller: unknown, contextLabel: string): string | undefined {\n if (controller === undefined) return undefined;\n if (typeof controller !== 'string' || controller.trim().length === 0) {\n throw new Error(`${contextLabel} has invalid controller. Expected a non-empty string.`);\n }\n return controller.trim();\n}\n\nfunction parseLayoutEntry(entry: RawLayoutEntry, viewKey: string, index: number): { path: string; controller?: string } {\n if (typeof entry === 'string') {\n const path = entry.trim();\n if (!path) {\n throw new Error(`View \"${viewKey}\" has invalid layout entry at index ${index}. Expected a non-empty path string.`);\n }\n return { path };\n }\n\n const layoutObj = entry as RawLayoutObjectEntry;\n const layoutPath = layoutObj.path ?? layoutObj.view ?? layoutObj.layout;\n if (typeof layoutPath !== 'string' || layoutPath.trim().length === 0) {\n throw new Error(\n `View \"${viewKey}\" has invalid layout object at index ${index}. ` +\n 'Expected one of: path, view, or layout as a non-empty string.',\n );\n }\n\n return {\n path: layoutPath.trim(),\n controller: validateControllerValue(layoutObj.controller, `View \"${viewKey}\" layout[${index}]`),\n };\n}\n\nfunction isLayoutGroupEntry(entry: unknown): entry is RawLayoutGroupEntry {\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return false;\n return Object.prototype.hasOwnProperty.call(entry, 'views');\n}\n\nfunction isLayoutObjectEntry(entry: unknown): entry is RawLayoutObjectEntry {\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return false;\n return (\n Object.prototype.hasOwnProperty.call(entry, 'path') ||\n Object.prototype.hasOwnProperty.call(entry, 'view') ||\n Object.prototype.hasOwnProperty.call(entry, 'layout') ||\n Object.prototype.hasOwnProperty.call(entry, 'controller')\n );\n}\n\nfunction normalizeLayouts(rawLayout: RawLayoutConfig | undefined, viewKey: string): {\n entries: RawLayoutEntry[];\n inheritedController?: string;\n} {\n if (rawLayout === undefined) {\n return { entries: [] };\n }\n\n if (Array.isArray(rawLayout)) {\n return { entries: rawLayout };\n }\n\n if (typeof rawLayout === 'string') {\n return { entries: [rawLayout] };\n }\n\n if (isLayoutGroupEntry(rawLayout)) {\n if (!Array.isArray(rawLayout.views)) {\n throw new Error(`View \"${viewKey}\" has invalid layout object. \"views\" must be an array.`);\n }\n\n return {\n entries: rawLayout.views,\n inheritedController: validateControllerValue(rawLayout.controller, `View \"${viewKey}\" layout`),\n };\n }\n\n if (isLayoutObjectEntry(rawLayout)) {\n return { entries: [rawLayout] };\n }\n\n throw new Error(\n `View \"${viewKey}\" has invalid layout definition. Expected an array, a string path, or an object with \"views\".`,\n );\n}\n\n/**\n * Parse views YAML content into a flat array of ViewDef.\n * Supports Wood-native `view:` format (dot-path keys).\n */\nexport function parseViews(yamlContent: string): ViewDef[] {\n const doc = yaml.load(yamlContent) as RawViewsDocument;\n const views: ViewDef[] = [];\n\n // Wood-native `view:` format\n // First segment = window name, rest = page name\n if (doc.view) {\n for (const [dotPath, entry] of Object.entries(doc.view)) {\n const segments = dotPath.split('.');\n const windowName = segments[0];\n const pageName = segments.slice(1).join('.');\n\n const normalizedLayouts = normalizeLayouts(entry.layout, dotPath);\n const parsedLayouts = normalizedLayouts.entries.map((layoutEntry, index) =>\n parseLayoutEntry(layoutEntry, dotPath, index),\n );\n if (normalizedLayouts.inheritedController) {\n if (parsedLayouts.length === 0) {\n throw new Error(\n `View \"${dotPath}\" sets a layout controller but has no layout views. Define at least one layout entry.`,\n );\n }\n\n const firstLayoutController = parsedLayouts[0].controller;\n if (firstLayoutController && firstLayoutController !== normalizedLayouts.inheritedController) {\n throw new Error(\n `View \"${dotPath}\" has conflicting layout controllers. Use either layout.controller or layout.views[0].controller.`,\n );\n }\n parsedLayouts[0].controller ??= normalizedLayouts.inheritedController;\n }\n\n const layoutPaths = parsedLayouts.map((layout) => layout.path);\n const layoutControllers = parsedLayouts.map((layout) => layout.controller);\n\n const viewController = validateControllerValue(entry.controller, `View \"${dotPath}\"`);\n\n const viewDef: ViewDef = {\n windowName,\n pageName,\n viewPath: entry.view,\n layouts: layoutPaths,\n middleware: entry.middleware,\n controller: viewController,\n };\n\n if (layoutControllers.some((value) => value !== undefined)) {\n viewDef.layoutControllers = layoutControllers;\n }\n\n views.push(viewDef);\n }\n }\n\n return views;\n}\n\n/** Read a YAML file from disk and parse it into ViewDef[]. */\nexport function parseViewsFile(filePath: string): ViewDef[] {\n const content = readFileSync(filePath, 'utf-8');\n return parseViews(content);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiB;AACjB,gBAA6B;AAU7B,SAAS,wBAAwB,YAAqB,cAA0C;AAC9F,MAAI,eAAe,OAAW,QAAO;AACrC,MAAI,OAAO,eAAe,YAAY,WAAW,KAAK,EAAE,WAAW,GAAG;AACpE,UAAM,IAAI,MAAM,GAAG,YAAY,uDAAuD;AAAA,EACxF;AACA,SAAO,WAAW,KAAK;AACzB;AAEA,SAAS,iBAAiB,OAAuB,SAAiB,OAAsD;AACtH,MAAI,OAAO,UA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CAAC,WAAW,OAAO,IAAI;AAC7D,YAAM,oBAAoB,cAAc,IAAI,CAAC,WAAW,OAAO,UAAU;AAEzE,YAAM,iBAAiB,wBAAwB,MAAM,YAAY,SAAS,OAAO,GAAG;AAEpF,YAAM,UAAmB;AAAA,QACvB;AAAA,QACA;AAAA,QACA,UAAU,MAAM;AAAA,QAChB,SAAS;AAAA,QACT,YAAY,MAAM;AAAA,QAClB,YAAY;AAAA,MACd;AAEA,UAAI,kBAAkB,KAAK,CAAC,UAAU,UAAU,MAAS,GAAG;AAC1D,gBAAQ,oBAAoB;AAAA,MAC9B;AAEA,YAAM,KAAK,OAAO;AAAA,IACpB;AAAA,EACF;AAEA,SAAO;AACT;AAGO,SAAS,eAAe,UAA6B;AAC1D,QAAM,cAAU,wBAAa,UAAU,OAAO;AAC9C,SAAO,WAAW,OAAO;AAC3B;","names":["yaml"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ViewDef } from '../types/views.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse views YAML content into a flat array of ViewDef.
|
|
5
|
+
* Supports Wood-native `view:` format (dot-path keys).
|
|
6
|
+
*/
|
|
7
|
+
declare function parseViews(yamlContent: string): ViewDef[];
|
|
8
|
+
/** Read a YAML file from disk and parse it into ViewDef[]. */
|
|
9
|
+
declare function parseViewsFile(filePath: string): ViewDef[];
|
|
10
|
+
|
|
11
|
+
export { parseViews, parseViewsFile };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ViewDef } from '../types/views.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse views YAML content into a flat array of ViewDef.
|
|
5
|
+
* Supports Wood-native `view:` format (dot-path keys).
|
|
6
|
+
*/
|
|
7
|
+
declare function parseViews(yamlContent: string): ViewDef[];
|
|
8
|
+
/** Read a YAML file from disk and parse it into ViewDef[]. */
|
|
9
|
+
declare function parseViewsFile(filePath: string): ViewDef[];
|
|
10
|
+
|
|
11
|
+
export { parseViews, parseViewsFile };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import yaml from "js-yaml";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
function validateControllerValue(controller, contextLabel) {
|
|
4
|
+
if (controller === void 0) return void 0;
|
|
5
|
+
if (typeof controller !== "string" || controller.trim().length === 0) {
|
|
6
|
+
throw new Error(`${contextLabel} has invalid controller. Expected a non-empty string.`);
|
|
7
|
+
}
|
|
8
|
+
return controller.trim();
|
|
9
|
+
}
|
|
10
|
+
function parseLayoutEntry(entry, viewKey, index) {
|
|
11
|
+
if (typeof entry === "string") {
|
|
12
|
+
const path = entry.trim();
|
|
13
|
+
if (!path) {
|
|
14
|
+
throw new Error(`View "${viewKey}" has invalid layout entry at index ${index}. Expected a non-empty path string.`);
|
|
15
|
+
}
|
|
16
|
+
return { path };
|
|
17
|
+
}
|
|
18
|
+
const layoutObj = entry;
|
|
19
|
+
const layoutPath = layoutObj.path ?? layoutObj.view ?? layoutObj.layout;
|
|
20
|
+
if (typeof layoutPath !== "string" || layoutPath.trim().length === 0) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`View "${viewKey}" has invalid layout object at index ${index}. Expected one of: path, view, or layout as a non-empty string.`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
path: layoutPath.trim(),
|
|
27
|
+
controller: validateControllerValue(layoutObj.controller, `View "${viewKey}" layout[${index}]`)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function isLayoutGroupEntry(entry) {
|
|
31
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
32
|
+
return Object.prototype.hasOwnProperty.call(entry, "views");
|
|
33
|
+
}
|
|
34
|
+
function isLayoutObjectEntry(entry) {
|
|
35
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
36
|
+
return Object.prototype.hasOwnProperty.call(entry, "path") || Object.prototype.hasOwnProperty.call(entry, "view") || Object.prototype.hasOwnProperty.call(entry, "layout") || Object.prototype.hasOwnProperty.call(entry, "controller");
|
|
37
|
+
}
|
|
38
|
+
function normalizeLayouts(rawLayout, viewKey) {
|
|
39
|
+
if (rawLayout === void 0) {
|
|
40
|
+
return { entries: [] };
|
|
41
|
+
}
|
|
42
|
+
if (Array.isArray(rawLayout)) {
|
|
43
|
+
return { entries: rawLayout };
|
|
44
|
+
}
|
|
45
|
+
if (typeof rawLayout === "string") {
|
|
46
|
+
return { entries: [rawLayout] };
|
|
47
|
+
}
|
|
48
|
+
if (isLayoutGroupEntry(rawLayout)) {
|
|
49
|
+
if (!Array.isArray(rawLayout.views)) {
|
|
50
|
+
throw new Error(`View "${viewKey}" has invalid layout object. "views" must be an array.`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
entries: rawLayout.views,
|
|
54
|
+
inheritedController: validateControllerValue(rawLayout.controller, `View "${viewKey}" layout`)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (isLayoutObjectEntry(rawLayout)) {
|
|
58
|
+
return { entries: [rawLayout] };
|
|
59
|
+
}
|
|
60
|
+
throw new Error(
|
|
61
|
+
`View "${viewKey}" has invalid layout definition. Expected an array, a string path, or an object with "views".`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
function parseViews(yamlContent) {
|
|
65
|
+
var _a;
|
|
66
|
+
const doc = yaml.load(yamlContent);
|
|
67
|
+
const views = [];
|
|
68
|
+
if (doc.view) {
|
|
69
|
+
for (const [dotPath, entry] of Object.entries(doc.view)) {
|
|
70
|
+
const segments = dotPath.split(".");
|
|
71
|
+
const windowName = segments[0];
|
|
72
|
+
const pageName = segments.slice(1).join(".");
|
|
73
|
+
const normalizedLayouts = normalizeLayouts(entry.layout, dotPath);
|
|
74
|
+
const parsedLayouts = normalizedLayouts.entries.map(
|
|
75
|
+
(layoutEntry, index) => parseLayoutEntry(layoutEntry, dotPath, index)
|
|
76
|
+
);
|
|
77
|
+
if (normalizedLayouts.inheritedController) {
|
|
78
|
+
if (parsedLayouts.length === 0) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`View "${dotPath}" sets a layout controller but has no layout views. Define at least one layout entry.`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
const firstLayoutController = parsedLayouts[0].controller;
|
|
84
|
+
if (firstLayoutController && firstLayoutController !== normalizedLayouts.inheritedController) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
`View "${dotPath}" has conflicting layout controllers. Use either layout.controller or layout.views[0].controller.`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
(_a = parsedLayouts[0]).controller ?? (_a.controller = normalizedLayouts.inheritedController);
|
|
90
|
+
}
|
|
91
|
+
const layoutPaths = parsedLayouts.map((layout) => layout.path);
|
|
92
|
+
const layoutControllers = parsedLayouts.map((layout) => layout.controller);
|
|
93
|
+
const viewController = validateControllerValue(entry.controller, `View "${dotPath}"`);
|
|
94
|
+
const viewDef = {
|
|
95
|
+
windowName,
|
|
96
|
+
pageName,
|
|
97
|
+
viewPath: entry.view,
|
|
98
|
+
layouts: layoutPaths,
|
|
99
|
+
middleware: entry.middleware,
|
|
100
|
+
controller: viewController
|
|
101
|
+
};
|
|
102
|
+
if (layoutControllers.some((value) => value !== void 0)) {
|
|
103
|
+
viewDef.layoutControllers = layoutControllers;
|
|
104
|
+
}
|
|
105
|
+
views.push(viewDef);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return views;
|
|
109
|
+
}
|
|
110
|
+
function parseViewsFile(filePath) {
|
|
111
|
+
const content = readFileSync(filePath, "utf-8");
|
|
112
|
+
return parseViews(content);
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
parseViews,
|
|
116
|
+
parseViewsFile
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=views_parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/parser/views_parser.ts"],"sourcesContent":["import yaml from 'js-yaml';\nimport { readFileSync } from 'fs';\nimport type {\n ViewDef,\n RawViewsDocument,\n RawLayoutEntry,\n RawLayoutObjectEntry,\n RawLayoutConfig,\n RawLayoutGroupEntry,\n} from '../types';\n\nfunction validateControllerValue(controller: unknown, contextLabel: string): string | undefined {\n if (controller === undefined) return undefined;\n if (typeof controller !== 'string' || controller.trim().length === 0) {\n throw new Error(`${contextLabel} has invalid controller. Expected a non-empty string.`);\n }\n return controller.trim();\n}\n\nfunction parseLayoutEntry(entry: RawLayoutEntry, viewKey: string, index: number): { path: string; controller?: string } {\n if (typeof entry === 'string') {\n const path = entry.trim();\n if (!path) {\n throw new Error(`View \"${viewKey}\" has invalid layout entry at index ${index}. Expected a non-empty path string.`);\n }\n return { path };\n }\n\n const layoutObj = entry as RawLayoutObjectEntry;\n const layoutPath = layoutObj.path ?? layoutObj.view ?? layoutObj.layout;\n if (typeof layoutPath !== 'string' || layoutPath.trim().length === 0) {\n throw new Error(\n `View \"${viewKey}\" has invalid layout object at index ${index}. ` +\n 'Expected one of: path, view, or layout as a non-empty string.',\n );\n }\n\n return {\n path: layoutPath.trim(),\n controller: validateControllerValue(layoutObj.controller, `View \"${viewKey}\" layout[${index}]`),\n };\n}\n\nfunction isLayoutGroupEntry(entry: unknown): entry is RawLayoutGroupEntry {\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return false;\n return Object.prototype.hasOwnProperty.call(entry, 'views');\n}\n\nfunction isLayoutObjectEntry(entry: unknown): entry is RawLayoutObjectEntry {\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return false;\n return (\n Object.prototype.hasOwnProperty.call(entry, 'path') ||\n Object.prototype.hasOwnProperty.call(entry, 'view') ||\n Object.prototype.hasOwnProperty.call(entry, 'layout') ||\n Object.prototype.hasOwnProperty.call(entry, 'controller')\n );\n}\n\nfunction normalizeLayouts(rawLayout: RawLayoutConfig | undefined, viewKey: string): {\n entries: RawLayoutEntry[];\n inheritedController?: string;\n} {\n if (rawLayout === undefined) {\n return { entries: [] };\n }\n\n if (Array.isArray(rawLayout)) {\n return { entries: rawLayout };\n }\n\n if (typeof rawLayout === 'string') {\n return { entries: [rawLayout] };\n }\n\n if (isLayoutGroupEntry(rawLayout)) {\n if (!Array.isArray(rawLayout.views)) {\n throw new Error(`View \"${viewKey}\" has invalid layout object. \"views\" must be an array.`);\n }\n\n return {\n entries: rawLayout.views,\n inheritedController: validateControllerValue(rawLayout.controller, `View \"${viewKey}\" layout`),\n };\n }\n\n if (isLayoutObjectEntry(rawLayout)) {\n return { entries: [rawLayout] };\n }\n\n throw new Error(\n `View \"${viewKey}\" has invalid layout definition. Expected an array, a string path, or an object with \"views\".`,\n );\n}\n\n/**\n * Parse views YAML content into a flat array of ViewDef.\n * Supports Wood-native `view:` format (dot-path keys).\n */\nexport function parseViews(yamlContent: string): ViewDef[] {\n const doc = yaml.load(yamlContent) as RawViewsDocument;\n const views: ViewDef[] = [];\n\n // Wood-native `view:` format\n // First segment = window name, rest = page name\n if (doc.view) {\n for (const [dotPath, entry] of Object.entries(doc.view)) {\n const segments = dotPath.split('.');\n const windowName = segments[0];\n const pageName = segments.slice(1).join('.');\n\n const normalizedLayouts = normalizeLayouts(entry.layout, dotPath);\n const parsedLayouts = normalizedLayouts.entries.map((layoutEntry, index) =>\n parseLayoutEntry(layoutEntry, dotPath, index),\n );\n if (normalizedLayouts.inheritedController) {\n if (parsedLayouts.length === 0) {\n throw new Error(\n `View \"${dotPath}\" sets a layout controller but has no layout views. Define at least one layout entry.`,\n );\n }\n\n const firstLayoutController = parsedLayouts[0].controller;\n if (firstLayoutController && firstLayoutController !== normalizedLayouts.inheritedController) {\n throw new Error(\n `View \"${dotPath}\" has conflicting layout controllers. Use either layout.controller or layout.views[0].controller.`,\n );\n }\n parsedLayouts[0].controller ??= normalizedLayouts.inheritedController;\n }\n\n const layoutPaths = parsedLayouts.map((layout) => layout.path);\n const layoutControllers = parsedLayouts.map((layout) => layout.controller);\n\n const viewController = validateControllerValue(entry.controller, `View \"${dotPath}\"`);\n\n const viewDef: ViewDef = {\n windowName,\n pageName,\n viewPath: entry.view,\n layouts: layoutPaths,\n middleware: entry.middleware,\n controller: viewController,\n };\n\n if (layoutControllers.some((value) => value !== undefined)) {\n viewDef.layoutControllers = layoutControllers;\n }\n\n views.push(viewDef);\n }\n }\n\n return views;\n}\n\n/** Read a YAML file from disk and parse it into ViewDef[]. */\nexport function parseViewsFile(filePath: string): ViewDef[] {\n const content = readFileSync(filePath, 'utf-8');\n return parseViews(content);\n}\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAU7B,SAAS,wBAAwB,YAAqB,cAA0C;AAC9F,MAAI,eAAe,OAAW,QAAO;AACrC,MAAI,OAAO,eAAe,YAAY,WAAW,KAAK,EAAE,WAAW,GAAG;AACpE,UAAM,IAAI,MAAM,GAAG,YAAY,uDAAuD;AAAA,EACxF;AACA,SAAO,WAAW,KAAK;AACzB;AAEA,SAAS,iBAAiB,OAAuB,SAAiB,OAAsD;AACtH,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,OAAO,MAAM,KAAK;AACxB,QAAI,CAAC,MAAM;AACT,YAAM,IAAI,MAAM,SAAS,OAAO,uCAAuC,KAAK,qCAAqC;AAAA,IACnH;AACA,WAAO,EAAE,KAAK;AAAA,EAChB;AAEA,QAAM,YAAY;AAClB,QAAM,aAAa,UAAU,QAAQ,UAAU,QAAQ,UAAU;AACjE,MAAI,OAAO,eAAe,YAAY,WAAW,KAAK,EAAE,WAAW,GAAG;AACpE,UAAM,IAAI;AAAA,MACR,SAAS,OAAO,wCAAwC,KAAK;AAAA,IAE/D;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM,WAAW,KAAK;AAAA,IACtB,YAAY,wBAAwB,UAAU,YAAY,SAAS,OAAO,YAAY,KAAK,GAAG;AAAA,EAChG;AACF;AAEA,SAAS,mBAAmB,OAA8C;AACxE,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,EAAG,QAAO;A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;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var router_exports = {};
|
|
20
|
+
__export(router_exports, {
|
|
21
|
+
RESERVED_CHANNELS: () => import_wood_router.RESERVED_CHANNELS,
|
|
22
|
+
WoodRouter: () => import_wood_router.WoodRouter
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(router_exports);
|
|
25
|
+
var import_wood_router = require("./wood_router.cjs");
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
RESERVED_CHANNELS,
|
|
29
|
+
WoodRouter
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/router/index.ts"],"sourcesContent":["export { WoodRouter, RESERVED_CHANNELS } from './wood_router.cjs';\nexport type { ReservedChannel, ReservedChannelHandler } from './wood_router.cjs';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA8C;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/router/index.ts"],"sourcesContent":["export { WoodRouter, RESERVED_CHANNELS } from './wood_router.js';\nexport type { ReservedChannel, ReservedChannelHandler } from './wood_router.js';\n"],"mappings":"AAAA,SAAS,YAAY,yBAAyB;","names":[]}
|