@greenpandastudios/aug-cli 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/bin/aug.mjs +3 -0
- package/docs/api/crypto.md +351 -0
- package/docs/api/io.md +207 -0
- package/docs/api/json.md +21 -0
- package/docs/api/memory.md +109 -0
- package/docs/api/time.md +54 -0
- package/docs/api/web.md +184 -0
- package/docs/assets/benchmarks/execution.svg +2978 -0
- package/docs/assets/benchmarks/http.svg +1674 -0
- package/docs/assets/benchmarks/improvements.svg +2315 -0
- package/docs/assets/benchmarks/memory.svg +1891 -0
- package/docs/benchmark-baseline.json +1087 -0
- package/docs/benchmark-results.json +91123 -0
- package/docs/benchmarks.json +38 -0
- package/docs/compatibility.md +42 -0
- package/docs/concurrency-implementation.md +18 -0
- package/docs/diagnostics.md +97 -0
- package/docs/docker.md +35 -0
- package/docs/example-projects.json +26 -0
- package/docs/examples/approved-design/counters.md +253 -0
- package/docs/examples/approved-design/dependencies/august/0.19.0/io/contracts.md +395 -0
- package/docs/examples/approved-design/domain/app.md +165 -0
- package/docs/examples/approved-design/domain/export.md +83 -0
- package/docs/examples/approved-design/domain/models.md +80 -0
- package/docs/examples/approved-design/domain/numbers.md +248 -0
- package/docs/examples/approved-design/index.md +39 -0
- package/docs/examples/approved-design/main-yaml.md +24 -0
- package/docs/examples/approved-design/main.md +215 -0
- package/docs/examples/benchmark/index.md +33 -0
- package/docs/examples/benchmark/main-yaml.md +17 -0
- package/docs/examples/benchmark/main.md +117 -0
- package/docs/examples/cli-args/index.md +32 -0
- package/docs/examples/cli-args/main.md +107 -0
- package/docs/examples/collections/index.md +32 -0
- package/docs/examples/collections/main.md +118 -0
- package/docs/examples/collections-benchmark/index.md +34 -0
- package/docs/examples/collections-benchmark/main.md +115 -0
- package/docs/examples/cpu-benchmark/index.md +34 -0
- package/docs/examples/cpu-benchmark/main.md +90 -0
- package/docs/examples/developer-workflow/calculator.md +357 -0
- package/docs/examples/developer-workflow/dependencies/august/0.19.0/io/contracts.md +395 -0
- package/docs/examples/developer-workflow/index.md +37 -0
- package/docs/examples/developer-workflow/logging/console.md +124 -0
- package/docs/examples/developer-workflow/logging/export.md +70 -0
- package/docs/examples/developer-workflow/logging/logger.md +111 -0
- package/docs/examples/developer-workflow/main.md +172 -0
- package/docs/examples/drop/index.md +33 -0
- package/docs/examples/drop/main.md +85 -0
- package/docs/examples/drop/resource.md +95 -0
- package/docs/examples/errors/errors.md +85 -0
- package/docs/examples/errors/index.md +33 -0
- package/docs/examples/errors/main.md +92 -0
- package/docs/examples/ffi/index.md +33 -0
- package/docs/examples/ffi/main.md +75 -0
- package/docs/examples/ffi/native.md +93 -0
- package/docs/examples/generic-di/dependencies/august/0.19.0/io/contracts.md +395 -0
- package/docs/examples/generic-di/index.md +33 -0
- package/docs/examples/generic-di/main.md +111 -0
- package/docs/examples/generic-di/types.md +180 -0
- package/docs/examples/generics/index.md +33 -0
- package/docs/examples/generics/main.md +120 -0
- package/docs/examples/generics/types.md +189 -0
- package/docs/examples/hello/app/export.md +67 -0
- package/docs/examples/hello/app/greeter.md +190 -0
- package/docs/examples/hello/dependencies/august/0.19.0/io/contracts.md +395 -0
- package/docs/examples/hello/index.md +37 -0
- package/docs/examples/hello/logging/console.md +121 -0
- package/docs/examples/hello/logging/export.md +71 -0
- package/docs/examples/hello/logging/logger.md +120 -0
- package/docs/examples/hello/main.md +115 -0
- package/docs/examples/http-benchmark/index.md +35 -0
- package/docs/examples/http-benchmark/main.md +79 -0
- package/docs/examples/http-benchmark/routes.md +88 -0
- package/docs/examples/index.md +60 -0
- package/docs/examples/interceptors/app.md +250 -0
- package/docs/examples/interceptors/dependencies/august/0.19.0/io/contracts.md +395 -0
- package/docs/examples/interceptors/index.md +35 -0
- package/docs/examples/interceptors/interceptors.md +284 -0
- package/docs/examples/interceptors/logging.md +155 -0
- package/docs/examples/interceptors/main.md +162 -0
- package/docs/examples/json-benchmark/data.md +71 -0
- package/docs/examples/json-benchmark/dependencies/august/0.19.0/json/contracts.md +103 -0
- package/docs/examples/json-benchmark/index.md +35 -0
- package/docs/examples/json-benchmark/main.md +131 -0
- package/docs/examples/new-syntax/console.md +118 -0
- package/docs/examples/new-syntax/dependencies/august/0.19.0/io/contracts.md +395 -0
- package/docs/examples/new-syntax/greeter.md +145 -0
- package/docs/examples/new-syntax/index.md +36 -0
- package/docs/examples/new-syntax/logger.md +111 -0
- package/docs/examples/new-syntax/main.md +135 -0
- package/docs/examples/new-syntax/math.md +79 -0
- package/docs/examples/oidc-login/client/contracts.md +151 -0
- package/docs/examples/oidc-login/client/endpoints.md +263 -0
- package/docs/examples/oidc-login/client/export.md +107 -0
- package/docs/examples/oidc-login/client/login.md +515 -0
- package/docs/examples/oidc-login/client/logout.md +249 -0
- package/docs/examples/oidc-login/client/protocol.md +595 -0
- package/docs/examples/oidc-login/client/session.md +297 -0
- package/docs/examples/oidc-login/client/views.md +144 -0
- package/docs/examples/oidc-login/common/export.md +115 -0
- package/docs/examples/oidc-login/common/headers.md +162 -0
- package/docs/examples/oidc-login/common/keys.md +336 -0
- package/docs/examples/oidc-login/common/settings.md +116 -0
- package/docs/examples/oidc-login/common/views.md +103 -0
- package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/contracts.md +925 -0
- package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/jose.md +434 -0
- package/docs/examples/oidc-login/dependencies/august/0.19.0/json/contracts.md +103 -0
- package/docs/examples/oidc-login/dependencies/august/0.19.0/memory/store.md +374 -0
- package/docs/examples/oidc-login/dependencies/august/0.19.0/time/contracts.md +150 -0
- package/docs/examples/oidc-login/dependencies/august/0.19.0/web/contracts.md +532 -0
- package/docs/examples/oidc-login/index.md +57 -0
- package/docs/examples/oidc-login/main-yaml.md +28 -0
- package/docs/examples/oidc-login/main.md +283 -0
- package/docs/examples/oidc-login/provider/authorization.md +457 -0
- package/docs/examples/oidc-login/provider/contracts.md +267 -0
- package/docs/examples/oidc-login/provider/credentials.md +148 -0
- package/docs/examples/oidc-login/provider/discovery.md +215 -0
- package/docs/examples/oidc-login/provider/export.md +131 -0
- package/docs/examples/oidc-login/provider/token.md +364 -0
- package/docs/examples/oidc-login/provider/userinfo.md +228 -0
- package/docs/examples/oidc-login/provider/views.md +137 -0
- package/docs/examples/ownership/counter.md +140 -0
- package/docs/examples/ownership/index.md +33 -0
- package/docs/examples/ownership/main.md +90 -0
- package/docs/examples/ownership-transfer/dependencies/august/0.19.0/io/contracts.md +395 -0
- package/docs/examples/ownership-transfer/index.md +33 -0
- package/docs/examples/ownership-transfer/main.md +125 -0
- package/docs/examples/ownership-transfer/resource.md +150 -0
- package/docs/examples/packages-app/dependencies/packages/@example/aug-math/0.1.0/arithmetic.md +117 -0
- package/docs/examples/packages-app/index.md +34 -0
- package/docs/examples/packages-app/main-yaml.md +18 -0
- package/docs/examples/packages-app/main.md +80 -0
- package/docs/examples/packages-math/aug-package-json.md +24 -0
- package/docs/examples/packages-math/index.md +36 -0
- package/docs/examples/packages-math/package-json.md +25 -0
- package/docs/examples/packages-math/src/arithmetic.md +121 -0
- package/docs/examples/packages-math/src/export.md +63 -0
- package/docs/examples/startup-benchmark/index.md +34 -0
- package/docs/examples/startup-benchmark/main.md +68 -0
- package/docs/examples/visibility/counter.md +142 -0
- package/docs/examples/visibility/index.md +33 -0
- package/docs/examples/visibility/main.md +96 -0
- package/docs/examples.json +47 -0
- package/docs/getting-started.md +5 -0
- package/docs/grammar.md +136 -0
- package/docs/implementation-map.md +106 -0
- package/docs/index.md +46 -0
- package/docs/language-conformance.md +30 -0
- package/docs/language-constructs.md +1461 -0
- package/docs/language-design-audit.md +147 -0
- package/docs/maintaining-docs.md +43 -0
- package/docs/packages.md +184 -0
- package/docs/performance.md +535 -0
- package/docs/production-readiness.md +39 -0
- package/docs/reference.md +361 -0
- package/docs/release-review.md +23 -0
- package/docs/releasing.md +79 -0
- package/docs/roadmap.md +13 -0
- package/docs/specifications.md +86 -0
- package/docs/testing.md +120 -0
- package/docs/tooling.md +197 -0
- package/docs/web-implementation-plan.md +39 -0
- package/docs/web-library-gaps.md +27 -0
- package/docs/web.md +197 -0
- package/examples/approved-design/.aug-spec/august/0.19.0/io/contracts.aug +36 -0
- package/examples/approved-design/.aug-spec/august/0.19.0/io/contracts.aug.md +316 -0
- package/examples/approved-design/.aug-spec/manifest.json +14 -0
- package/examples/approved-design/counters.aug +22 -0
- package/examples/approved-design/counters.aug.md +177 -0
- package/examples/approved-design/domain/app.aug +12 -0
- package/examples/approved-design/domain/app.aug.md +97 -0
- package/examples/approved-design/domain/export.aug +5 -0
- package/examples/approved-design/domain/export.aug.md +25 -0
- package/examples/approved-design/domain/models.aug +2 -0
- package/examples/approved-design/domain/models.aug.md +30 -0
- package/examples/approved-design/domain/numbers.aug +29 -0
- package/examples/approved-design/domain/numbers.aug.md +141 -0
- package/examples/approved-design/main.aug +26 -0
- package/examples/approved-design/main.aug.md +108 -0
- package/examples/approved-design/main.yaml +8 -0
- package/examples/benchmark/.aug-spec/manifest.json +7 -0
- package/examples/benchmark/main.aug +17 -0
- package/examples/benchmark/main.aug.md +43 -0
- package/examples/benchmark/main.yaml +1 -0
- package/examples/cli-args/.aug-spec/manifest.json +7 -0
- package/examples/cli-args/main.aug +15 -0
- package/examples/cli-args/main.aug.md +38 -0
- package/examples/collections/.aug-spec/manifest.json +7 -0
- package/examples/collections/main.aug +18 -0
- package/examples/collections/main.aug.md +43 -0
- package/examples/developer-workflow/.aug-spec/august/0.19.0/io/contracts.aug +36 -0
- package/examples/developer-workflow/.aug-spec/august/0.19.0/io/contracts.aug.md +316 -0
- package/examples/developer-workflow/.aug-spec/manifest.json +13 -0
- package/examples/developer-workflow/calculator.aug +55 -0
- package/examples/developer-workflow/calculator.aug.md +228 -0
- package/examples/developer-workflow/logging/console.aug +8 -0
- package/examples/developer-workflow/logging/console.aug.md +67 -0
- package/examples/developer-workflow/logging/export.aug +2 -0
- package/examples/developer-workflow/logging/export.aug.md +19 -0
- package/examples/developer-workflow/logging/logger.aug +6 -0
- package/examples/developer-workflow/logging/logger.aug.md +57 -0
- package/examples/developer-workflow/main.aug +25 -0
- package/examples/developer-workflow/main.aug.md +79 -0
- package/examples/drop/.aug-spec/manifest.json +8 -0
- package/examples/drop/main.aug +3 -0
- package/examples/drop/main.aug.md +35 -0
- package/examples/drop/resource.aug +8 -0
- package/examples/drop/resource.aug.md +44 -0
- package/examples/errors/.aug-spec/manifest.json +8 -0
- package/examples/errors/errors.aug +6 -0
- package/examples/errors/errors.aug.md +33 -0
- package/examples/errors/main.aug +7 -0
- package/examples/errors/main.aug.md +36 -0
- package/examples/ffi/.aug-spec/manifest.json +8 -0
- package/examples/ffi/main.aug +2 -0
- package/examples/ffi/main.aug.md +27 -0
- package/examples/ffi/native.aug +6 -0
- package/examples/ffi/native.aug.md +43 -0
- package/examples/generic-di/.aug-spec/august/0.19.0/io/contracts.aug +36 -0
- package/examples/generic-di/.aug-spec/august/0.19.0/io/contracts.aug.md +316 -0
- package/examples/generic-di/.aug-spec/manifest.json +10 -0
- package/examples/generic-di/main.aug +9 -0
- package/examples/generic-di/main.aug.md +49 -0
- package/examples/generic-di/types.aug +17 -0
- package/examples/generic-di/types.aug.md +124 -0
- package/examples/generics/.aug-spec/manifest.json +8 -0
- package/examples/generics/main.aug +9 -0
- package/examples/generics/main.aug.md +58 -0
- package/examples/generics/types.aug +19 -0
- package/examples/generics/types.aug.md +132 -0
- package/examples/hello/.aug-spec/august/0.19.0/io/contracts.aug +36 -0
- package/examples/hello/.aug-spec/august/0.19.0/io/contracts.aug.md +316 -0
- package/examples/hello/.aug-spec/manifest.json +14 -0
- package/examples/hello/app/export.aug +1 -0
- package/examples/hello/app/export.aug.md +17 -0
- package/examples/hello/app/greeter.aug +22 -0
- package/examples/hello/app/greeter.aug.md +109 -0
- package/examples/hello/logging/console.aug +7 -0
- package/examples/hello/logging/console.aug.md +65 -0
- package/examples/hello/logging/export.aug +2 -0
- package/examples/hello/logging/export.aug.md +19 -0
- package/examples/hello/logging/logger.aug +9 -0
- package/examples/hello/logging/logger.aug.md +59 -0
- package/examples/hello/main.aug +9 -0
- package/examples/hello/main.aug.md +49 -0
- package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug +36 -0
- package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug.md +316 -0
- package/examples/interceptors/.aug-spec/manifest.json +12 -0
- package/examples/interceptors/app.aug +28 -0
- package/examples/interceptors/app.aug.md +162 -0
- package/examples/interceptors/interceptors.aug +40 -0
- package/examples/interceptors/interceptors.aug.md +180 -0
- package/examples/interceptors/logging.aug +12 -0
- package/examples/interceptors/logging.aug.md +96 -0
- package/examples/interceptors/main.aug +22 -0
- package/examples/interceptors/main.aug.md +76 -0
- package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug +36 -0
- package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug.md +316 -0
- package/examples/new-syntax/.aug-spec/manifest.json +13 -0
- package/examples/new-syntax/console.aug +7 -0
- package/examples/new-syntax/console.aug.md +63 -0
- package/examples/new-syntax/greeter.aug +10 -0
- package/examples/new-syntax/greeter.aug.md +89 -0
- package/examples/new-syntax/logger.aug +6 -0
- package/examples/new-syntax/logger.aug.md +57 -0
- package/examples/new-syntax/main.aug +12 -0
- package/examples/new-syntax/main.aug.md +64 -0
- package/examples/new-syntax/math.aug +3 -0
- package/examples/new-syntax/math.aug.md +29 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/contracts.aug +73 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/contracts.aug.md +791 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/jose.aug +68 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/jose.aug.md +266 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/json/contracts.aug +6 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/json/contracts.aug.md +55 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/memory/store.aug +45 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/memory/store.aug.md +250 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/time/contracts.aug +11 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/time/contracts.aug.md +96 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/web/contracts.aug +58 -0
- package/examples/oidc-login/.aug-spec/august/0.19.0/web/contracts.aug.md +420 -0
- package/examples/oidc-login/.aug-spec/manifest.json +40 -0
- package/examples/oidc-login/README.md +29 -0
- package/examples/oidc-login/client/contracts.aug +7 -0
- package/examples/oidc-login/client/contracts.aug.md +80 -0
- package/examples/oidc-login/client/endpoints.aug +21 -0
- package/examples/oidc-login/client/endpoints.aug.md +161 -0
- package/examples/oidc-login/client/export.aug +7 -0
- package/examples/oidc-login/client/export.aug.md +29 -0
- package/examples/oidc-login/client/login.aug +58 -0
- package/examples/oidc-login/client/login.aug.md +331 -0
- package/examples/oidc-login/client/logout.aug +18 -0
- package/examples/oidc-login/client/logout.aug.md +150 -0
- package/examples/oidc-login/client/protocol.aug +106 -0
- package/examples/oidc-login/client/protocol.aug.md +326 -0
- package/examples/oidc-login/client/session.aug +34 -0
- package/examples/oidc-login/client/session.aug.md +155 -0
- package/examples/oidc-login/client/views.aug +21 -0
- package/examples/oidc-login/client/views.aug.md +68 -0
- package/examples/oidc-login/common/export.aug +9 -0
- package/examples/oidc-login/common/export.aug.md +33 -0
- package/examples/oidc-login/common/headers.aug +11 -0
- package/examples/oidc-login/common/headers.aug.md +79 -0
- package/examples/oidc-login/common/keys.aug +37 -0
- package/examples/oidc-login/common/keys.aug.md +207 -0
- package/examples/oidc-login/common/settings.aug +4 -0
- package/examples/oidc-login/common/settings.aug.md +47 -0
- package/examples/oidc-login/common/views.aug +16 -0
- package/examples/oidc-login/common/views.aug.md +34 -0
- package/examples/oidc-login/main.aug +39 -0
- package/examples/oidc-login/main.aug.md +166 -0
- package/examples/oidc-login/main.yaml +12 -0
- package/examples/oidc-login/provider/authorization.aug +59 -0
- package/examples/oidc-login/provider/authorization.aug.md +264 -0
- package/examples/oidc-login/provider/contracts.aug +15 -0
- package/examples/oidc-login/provider/contracts.aug.md +193 -0
- package/examples/oidc-login/provider/credentials.aug +10 -0
- package/examples/oidc-login/provider/credentials.aug.md +64 -0
- package/examples/oidc-login/provider/discovery.aug +13 -0
- package/examples/oidc-login/provider/discovery.aug.md +133 -0
- package/examples/oidc-login/provider/export.aug +13 -0
- package/examples/oidc-login/provider/export.aug.md +41 -0
- package/examples/oidc-login/provider/token.aug +37 -0
- package/examples/oidc-login/provider/token.aug.md +223 -0
- package/examples/oidc-login/provider/userinfo.aug +26 -0
- package/examples/oidc-login/provider/userinfo.aug.md +104 -0
- package/examples/oidc-login/provider/views.aug +18 -0
- package/examples/oidc-login/provider/views.aug.md +63 -0
- package/examples/ownership/.aug-spec/manifest.json +8 -0
- package/examples/ownership/counter.aug +14 -0
- package/examples/ownership/counter.aug.md +85 -0
- package/examples/ownership/main.aug +4 -0
- package/examples/ownership/main.aug.md +38 -0
- package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug +36 -0
- package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug.md +316 -0
- package/examples/ownership-transfer/.aug-spec/manifest.json +10 -0
- package/examples/ownership-transfer/main.aug +9 -0
- package/examples/ownership-transfer/main.aug.md +63 -0
- package/examples/ownership-transfer/resource.aug +16 -0
- package/examples/ownership-transfer/resource.aug.md +89 -0
- package/examples/packages/README.md +15 -0
- package/examples/packages/app/.aug-spec/manifest.json +9 -0
- package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug +9 -0
- package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug.md +63 -0
- package/examples/packages/app/main.aug +2 -0
- package/examples/packages/app/main.aug.md +33 -0
- package/examples/packages/app/main.yaml +2 -0
- package/examples/packages/math/.aug-spec/manifest.json +8 -0
- package/examples/packages/math/README.md +3 -0
- package/examples/packages/math/aug-package.json +8 -0
- package/examples/packages/math/package.json +9 -0
- package/examples/packages/math/src/arithmetic.aug +8 -0
- package/examples/packages/math/src/arithmetic.aug.md +63 -0
- package/examples/packages/math/src/export.aug +1 -0
- package/examples/packages/math/src/export.aug.md +17 -0
- package/examples/visibility/.aug-spec/manifest.json +8 -0
- package/examples/visibility/counter.aug +14 -0
- package/examples/visibility/counter.aug.md +87 -0
- package/examples/visibility/main.aug +7 -0
- package/examples/visibility/main.aug.md +39 -0
- package/package.json +50 -0
- package/runtime/aug_crypto.c +121 -0
- package/runtime/aug_html.c +93 -0
- package/runtime/aug_http.c +829 -0
- package/runtime/aug_json.c +165 -0
- package/runtime/aug_runtime.c +792 -0
- package/runtime/aug_runtime.h +245 -0
- package/runtime/aug_tasks.c +172 -0
- package/runtime/aug_time.c +5 -0
- package/runtime/aug_values.c +80 -0
- package/scripts/bootstrap-native.mjs +121 -0
- package/scripts/native-dependencies.lock.json +65 -0
- package/scripts/native-home.mjs +11 -0
- package/src/actions.js +109 -0
- package/src/ast.js +19 -0
- package/src/builtins.js +93 -0
- package/src/checker.js +2896 -0
- package/src/cli.js +344 -0
- package/src/codegen.js +1159 -0
- package/src/config.js +149 -0
- package/src/continuation.js +110 -0
- package/src/di.js +24 -0
- package/src/documentation.js +27 -0
- package/src/editor.js +782 -0
- package/src/effects.js +29 -0
- package/src/fixes.js +222 -0
- package/src/formatter.js +296 -0
- package/src/freshness.js +154 -0
- package/src/help.js +212 -0
- package/src/html.js +27 -0
- package/src/http-policies.js +90 -0
- package/src/inference.js +16 -0
- package/src/interceptors.js +70 -0
- package/src/javadoc.js +67 -0
- package/src/lexer.js +199 -0
- package/src/libraries.js +31 -0
- package/src/lsp.js +180 -0
- package/src/native.js +144 -0
- package/src/navigation.js +162 -0
- package/src/openapi.js +220 -0
- package/src/ownership.js +232 -0
- package/src/package-manager.js +299 -0
- package/src/parser.js +1155 -0
- package/src/policies.js +130 -0
- package/src/project-init.js +19 -0
- package/src/project.js +292 -0
- package/src/schemas.js +62 -0
- package/src/semantic.js +255 -0
- package/src/spec.js +738 -0
- package/src/testing.js +186 -0
- package/src/types.js +10 -0
package/src/config.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
export const lintRules = ['wildcard_imports', 'public_helpers', 'public_docs', 'broad_errors', 'discarded_errors', 'architecture'];
|
|
4
|
+
export function loadConfig(root) {
|
|
5
|
+
const config = { optimization: 'debug', libraries: [], library_paths: [], assignment: 'equals', block_style: 'braces',
|
|
6
|
+
indentation: 'spaces', lint: [], strict_modules: false, max_public_symbols: 12, max_dependencies: 8, module_dependencies: [], packages: {}, spec: { require_comments: 'none' },
|
|
7
|
+
web: { host: '127.0.0.1', body_limit: 1048576, response_limit: 4194304, tls: { certificate: '', private_key: '', ca: '' }, http3: false },
|
|
8
|
+
openapi: { enabled: false, title: 'August API', version: '0.1.0', path: '/openapi.json', docs: '/docs', output: '.aug-build/openapi.json' } };
|
|
9
|
+
const file = join(root, 'main.yaml');
|
|
10
|
+
const diagnostics = [];
|
|
11
|
+
if (!existsSync(file))
|
|
12
|
+
return { config, diagnostics };
|
|
13
|
+
const report = (line, message) => diagnostics.push({ file, line, column: 1, code: 'CONFIG', message });
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const sections = [];
|
|
16
|
+
let list;
|
|
17
|
+
for (const [index, raw] of readFileSync(file, 'utf8').split(/\r?\n/).entries()) {
|
|
18
|
+
const line = raw.replace(/\s+#.*$/, '').trim();
|
|
19
|
+
if (!line || line.startsWith('#'))
|
|
20
|
+
continue;
|
|
21
|
+
const item = /^-\s+(.+)$/.exec(line);
|
|
22
|
+
if (item && list) {
|
|
23
|
+
const value = item[1].replace(/^(['"])(.*)\1$/, '$2');
|
|
24
|
+
if (list === 'lint' && !lintRules.includes(value))
|
|
25
|
+
report(index + 1, `Unknown lint rule ${value}`);
|
|
26
|
+
else if (list === 'module_dependencies' && !/^[\w./*-]+\s*:\s*[\w./*, -]*$/.test(value))
|
|
27
|
+
report(index + 1, 'Use module_dependencies entries such as "domain: shared, contracts"');
|
|
28
|
+
else if (list === 'libraries' && !/^[A-Za-z0-9_.+-]+$/.test(value))
|
|
29
|
+
report(index + 1, 'Library names contain only letters, numbers, _, ., + and -');
|
|
30
|
+
else
|
|
31
|
+
config[list].push(value);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
list = undefined;
|
|
35
|
+
const entry = /^([a-z_][a-z_0-9]*):(?:\s*(.*))?$/.exec(line);
|
|
36
|
+
const indentation = raw.length - raw.trimStart().length;
|
|
37
|
+
while (sections.length && sections.at(-1).indentation >= indentation)
|
|
38
|
+
sections.pop();
|
|
39
|
+
const path = [...sections.map(section => section.name), entry?.[1]].join('.');
|
|
40
|
+
if (entry && (path === 'web' || path === 'openapi' || path === 'web.tls' || path === 'packages' || path === 'spec')) {
|
|
41
|
+
if (entry[2])
|
|
42
|
+
report(index + 1, `${path} must be a configuration block`);
|
|
43
|
+
if (seen.has(path))
|
|
44
|
+
report(index + 1, `Duplicate configuration key ${path}`);
|
|
45
|
+
seen.add(path);
|
|
46
|
+
sections.push({ name: entry[1], indentation });
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (entry && sections.length) {
|
|
50
|
+
const value = (entry[2] ?? '').replace(/^(['"])(.*)\1$/, '$2');
|
|
51
|
+
if (seen.has(path)) {
|
|
52
|
+
report(index + 1, `Duplicate configuration key ${path}`);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
seen.add(path);
|
|
56
|
+
if (path.startsWith('packages.')) {
|
|
57
|
+
if (!/^[a-z][a-z0-9_]*$/.test(entry[1]) || entry[1] === 'august' || !value)
|
|
58
|
+
report(index + 1, 'Packages map lowercase public aliases to local paths or npm:name@exact-version');
|
|
59
|
+
else
|
|
60
|
+
config.packages[entry[1]] = value;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (path === 'spec.require_comments') {
|
|
64
|
+
if (!['none', 'public', 'all'].includes(value))
|
|
65
|
+
report(index + 1, 'spec.require_comments must be none, public, or all');
|
|
66
|
+
else
|
|
67
|
+
config.spec.require_comments = value;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const known = ['web.host', 'web.body_limit', 'web.response_limit', 'web.http3', 'web.tls.certificate', 'web.tls.private_key', 'web.tls.ca',
|
|
71
|
+
'openapi.enabled', 'openapi.title', 'openapi.version', 'openapi.path', 'openapi.docs', 'openapi.output'];
|
|
72
|
+
if (!known.includes(path)) {
|
|
73
|
+
report(index + 1, `Unknown configuration key ${path}`);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (path === 'web.http3' || path === 'openapi.enabled') {
|
|
77
|
+
if (!['true', 'false'].includes(value))
|
|
78
|
+
report(index + 1, `${path} must be true or false`);
|
|
79
|
+
else if (path === 'web.http3')
|
|
80
|
+
config.web.http3 = value === 'true';
|
|
81
|
+
else
|
|
82
|
+
config.openapi.enabled = value === 'true';
|
|
83
|
+
}
|
|
84
|
+
else if (path === 'web.body_limit' || path === 'web.response_limit') {
|
|
85
|
+
if (!/^[1-9]\d*$/.test(value) || Number(value) > 67108864)
|
|
86
|
+
report(index + 1, `${path} must be from 1 to 67108864 bytes`);
|
|
87
|
+
else
|
|
88
|
+
config.web[path.endsWith('body_limit') ? 'body_limit' : 'response_limit'] = Number(value);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (!value || /[\x00-\x1f]/.test(value) || ['openapi.path', 'openapi.docs'].includes(path) && (!value.startsWith('/') || /[?#]/.test(value))) {
|
|
92
|
+
report(index + 1, `${path} needs a valid nonempty value`);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (path.startsWith('web.tls.'))
|
|
96
|
+
Object.assign(config.web.tls, { [entry[1]]: value });
|
|
97
|
+
else if (path === 'web.host')
|
|
98
|
+
config.web.host = value;
|
|
99
|
+
else
|
|
100
|
+
Object.assign(config.openapi, { [entry[1]]: value });
|
|
101
|
+
}
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (!entry || !(entry[1] in config || entry[1] === 'output')) {
|
|
105
|
+
report(index + 1, `Unsupported configuration line ${JSON.stringify(raw)}`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const key = entry[1];
|
|
109
|
+
const value = (entry[2] ?? '').replace(/^(['"])(.*)\1$/, '$2');
|
|
110
|
+
if (seen.has(key)) {
|
|
111
|
+
report(index + 1, `Duplicate configuration key ${key}`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
seen.add(key);
|
|
115
|
+
if (['libraries', 'library_paths', 'lint', 'module_dependencies'].includes(key)) {
|
|
116
|
+
if (value)
|
|
117
|
+
report(index + 1, `${key} must be a YAML list`);
|
|
118
|
+
else
|
|
119
|
+
list = key;
|
|
120
|
+
}
|
|
121
|
+
else if (key === 'strict_modules') {
|
|
122
|
+
if (!['true', 'false'].includes(value))
|
|
123
|
+
report(index + 1, 'strict_modules must be true or false');
|
|
124
|
+
else
|
|
125
|
+
config.strict_modules = value === 'true';
|
|
126
|
+
}
|
|
127
|
+
else if (key === 'max_dependencies' || key === 'max_public_symbols') {
|
|
128
|
+
if (!/^[1-9]\d*$/.test(value))
|
|
129
|
+
report(index + 1, `${key} must be a positive integer`);
|
|
130
|
+
else
|
|
131
|
+
config[key] = Number(value);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const choices = { optimization: ['debug', 'release'], assignment: ['equals', 'to'],
|
|
135
|
+
block_style: ['braces', 'indent'], indentation: ['spaces', 'tabs'] };
|
|
136
|
+
if (!value || choices[key] && !choices[key].includes(value))
|
|
137
|
+
report(index + 1, `${key} needs ${choices[key]?.join(' or ') ?? 'a value'}`);
|
|
138
|
+
else
|
|
139
|
+
Object.assign(config, { [key]: value });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (!!config.web.tls.certificate !== !!config.web.tls.private_key)
|
|
143
|
+
report(1, 'TLS requires both certificate and private_key');
|
|
144
|
+
if (config.web.http3 && !config.web.tls.certificate)
|
|
145
|
+
report(1, 'HTTP/3 requires a TLS certificate and private_key');
|
|
146
|
+
if (config.openapi.path === config.openapi.docs)
|
|
147
|
+
report(1, 'OpenAPI path and docs must be distinct');
|
|
148
|
+
return { config, diagnostics };
|
|
149
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const add = (left, right) => Math.min(2, left + right);
|
|
2
|
+
const maximum = (...values) => {
|
|
3
|
+
const present = values.filter((value) => value !== undefined);
|
|
4
|
+
return present.length ? Math.max(...present) : undefined;
|
|
5
|
+
};
|
|
6
|
+
function calls(expr) {
|
|
7
|
+
if (expr.kind === 'handle' && expr.call.kind === 'call')
|
|
8
|
+
return Math.min(2, expr.call.args.reduce((sum, arg) => sum + calls(arg), 0));
|
|
9
|
+
if (expr.kind === 'markup')
|
|
10
|
+
return Math.min(2, [...expr.attributes.map(attribute => attribute.value), ...expr.children].reduce((sum, child) => sum + calls(child), 0));
|
|
11
|
+
if (expr.kind === 'start')
|
|
12
|
+
return calls(expr.call);
|
|
13
|
+
if (expr.kind === 'wait')
|
|
14
|
+
return Math.min(2, expr.tasks.reduce((sum, task) => sum + calls(task), 0));
|
|
15
|
+
if (expr.kind === 'collection')
|
|
16
|
+
return Math.min(2, expr.items.reduce((count, item) => count + calls(item), 0));
|
|
17
|
+
if (expr.kind === 'call')
|
|
18
|
+
return Math.min(2, (expr.callee.kind === 'name' && expr.callee.name === 'next' ? 1 : calls(expr.callee)) +
|
|
19
|
+
expr.args.reduce((count, arg) => count + calls(arg), 0));
|
|
20
|
+
if (expr.kind === 'member')
|
|
21
|
+
return calls(expr.object);
|
|
22
|
+
if (expr.kind === 'binary') {
|
|
23
|
+
if (expr.left.kind === 'literal' && ((expr.op === '&&' && expr.left.value === false) ||
|
|
24
|
+
(expr.op === '||' && expr.left.value === true)))
|
|
25
|
+
return calls(expr.left);
|
|
26
|
+
return add(calls(expr.left), calls(expr.right));
|
|
27
|
+
}
|
|
28
|
+
if (expr.kind === 'unary')
|
|
29
|
+
return calls(expr.value);
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
function block(body, initial = 0) {
|
|
33
|
+
let flow = { normal: initial, exited: 0, thrown: undefined };
|
|
34
|
+
for (const stmt of body) {
|
|
35
|
+
if (flow.normal === undefined)
|
|
36
|
+
break;
|
|
37
|
+
const inside = statement(stmt, flow.normal);
|
|
38
|
+
flow = { normal: inside.normal, exited: Math.max(flow.exited, inside.exited),
|
|
39
|
+
thrown: maximum(flow.thrown, inside.thrown) };
|
|
40
|
+
}
|
|
41
|
+
return flow;
|
|
42
|
+
}
|
|
43
|
+
function statement(stmt, initial) {
|
|
44
|
+
if (stmt.kind === 'serve')
|
|
45
|
+
return { normal: add(initial, calls(stmt.port)), exited: 0, thrown: initial };
|
|
46
|
+
if (stmt.kind === 'unsafe' || stmt.kind === 'borrow' || stmt.kind === 'scope' || stmt.kind === 'lock')
|
|
47
|
+
return block(stmt.body, initial);
|
|
48
|
+
if (stmt.kind === 'for') {
|
|
49
|
+
const count = add(initial, calls(stmt.iterable));
|
|
50
|
+
const body = block(stmt.body, count);
|
|
51
|
+
const repeated = body.normal !== undefined && body.normal > count;
|
|
52
|
+
return { normal: maximum(count, repeated ? 2 : body.normal), exited: body.exited,
|
|
53
|
+
thrown: maximum(count, body.thrown, repeated ? 2 : undefined) };
|
|
54
|
+
}
|
|
55
|
+
if (stmt.kind === 'match') {
|
|
56
|
+
const count = add(initial, calls(stmt.value));
|
|
57
|
+
const cases = stmt.cases.map(clause => block(clause.body, count));
|
|
58
|
+
return { normal: maximum(...cases.map(flow => flow.normal)), exited: Math.max(0, ...cases.map(flow => flow.exited)),
|
|
59
|
+
thrown: maximum(count, ...cases.map(flow => flow.thrown)) };
|
|
60
|
+
}
|
|
61
|
+
if (stmt.kind === 'if') {
|
|
62
|
+
const count = add(initial, calls(stmt.test));
|
|
63
|
+
if (stmt.test.kind === 'literal' && typeof stmt.test.value === 'boolean')
|
|
64
|
+
return block(stmt.test.value ? stmt.then : stmt.otherwise, count);
|
|
65
|
+
const left = block(stmt.then, count);
|
|
66
|
+
const right = block(stmt.otherwise, count);
|
|
67
|
+
return { normal: maximum(left.normal, right.normal), exited: Math.max(left.exited, right.exited),
|
|
68
|
+
thrown: maximum(count, left.thrown, right.thrown) };
|
|
69
|
+
}
|
|
70
|
+
if (stmt.kind === 'while') {
|
|
71
|
+
const test = calls(stmt.test);
|
|
72
|
+
const count = add(initial, test);
|
|
73
|
+
if (stmt.test.kind === 'literal' && stmt.test.value === false)
|
|
74
|
+
return { normal: count, exited: 0, thrown: undefined };
|
|
75
|
+
const body = block(stmt.body, count);
|
|
76
|
+
// A fallthrough edge feeds the condition again. If either the condition or
|
|
77
|
+
// body invokes next, an arbitrary second iteration can repeat the call.
|
|
78
|
+
const repeated = body.normal !== undefined && (test > 0 || body.normal > initial);
|
|
79
|
+
return { normal: stmt.test.kind === 'literal' && stmt.test.value === true ? undefined : maximum(count, repeated ? 2 : body.normal),
|
|
80
|
+
exited: body.exited, thrown: maximum(count, body.thrown, repeated ? 2 : undefined) };
|
|
81
|
+
}
|
|
82
|
+
if (stmt.kind === 'try') {
|
|
83
|
+
const inside = block(stmt.body, initial);
|
|
84
|
+
const catches = inside.thrown === undefined ? [] :
|
|
85
|
+
stmt.catches.map(clause => block(clause.body, inside.thrown));
|
|
86
|
+
const flow = { normal: maximum(inside.normal, ...catches.map(flow => flow.normal)),
|
|
87
|
+
exited: Math.max(inside.exited, ...catches.map(flow => flow.exited)),
|
|
88
|
+
thrown: maximum(inside.thrown, ...catches.map(flow => flow.thrown)) };
|
|
89
|
+
if (!stmt.always)
|
|
90
|
+
return flow;
|
|
91
|
+
const normal = flow.normal === undefined ? undefined : block(stmt.always, flow.normal);
|
|
92
|
+
const exited = block(stmt.always, flow.exited);
|
|
93
|
+
const thrown = flow.thrown === undefined ? undefined : block(stmt.always, flow.thrown);
|
|
94
|
+
return { normal: normal?.normal, exited: Math.max(normal?.exited ?? 0, exited.normal ?? 0, exited.exited),
|
|
95
|
+
thrown: maximum(normal?.thrown, exited.thrown, thrown?.normal, thrown?.thrown) };
|
|
96
|
+
}
|
|
97
|
+
const count = add(initial, stmt.kind === 'assign' ? add(calls(stmt.value), calls(stmt.target)) :
|
|
98
|
+
stmt.kind === 'return' ? stmt.value ? calls(stmt.value) : 0 :
|
|
99
|
+
calls(stmt.kind === 'expr' ? stmt.expr : stmt.value));
|
|
100
|
+
return { normal: stmt.kind === 'return' || stmt.kind === 'throw' ? undefined : count,
|
|
101
|
+
exited: stmt.kind === 'return' ? count : 0,
|
|
102
|
+
// Calls can fail after next has run. Catch paths therefore inherit the
|
|
103
|
+
// consumed continuation, including failures during a return expression.
|
|
104
|
+
thrown: count };
|
|
105
|
+
}
|
|
106
|
+
export function canRepeatNext(body) {
|
|
107
|
+
const flow = block(body);
|
|
108
|
+
return maximum(flow.normal, flow.exited, flow.thrown) === 2;
|
|
109
|
+
}
|
|
110
|
+
export function canFallThrough(body) { return block(body).normal !== undefined; }
|
package/src/di.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The same bounded graph traversal serves composition and module checking. */
|
|
2
|
+
export function orderGraph(nodes, cycle) {
|
|
3
|
+
const byKey = new Map(nodes.map(node => [node.key, node]));
|
|
4
|
+
const state = new Map();
|
|
5
|
+
const ordered = [];
|
|
6
|
+
const visit = (node, path) => {
|
|
7
|
+
if (state.get(node.key) === 2)
|
|
8
|
+
return;
|
|
9
|
+
if (state.get(node.key) === 1) {
|
|
10
|
+
cycle(node, [...path.slice(path.indexOf(node.key)), node.key]);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
state.set(node.key, 1);
|
|
14
|
+
for (const key of node.dependencies) {
|
|
15
|
+
const dependency = byKey.get(key);
|
|
16
|
+
if (dependency)
|
|
17
|
+
visit(dependency, [...path, node.key]);
|
|
18
|
+
}
|
|
19
|
+
state.set(node.key, 2);
|
|
20
|
+
ordered.push(node);
|
|
21
|
+
};
|
|
22
|
+
nodes.forEach(node => visit(node, []));
|
|
23
|
+
return ordered;
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { javadocBefore } from "./javadoc.js";
|
|
2
|
+
/** One documentation resolution path for checking, editor help, and context. */
|
|
3
|
+
export function callableDocumentation(project, method, owner) {
|
|
4
|
+
const read = (method) => javadocBefore(project.files.get(method.span.file)?.source ?? '', method.annotations?.[0]?.span.start ?? method.span.start);
|
|
5
|
+
const direct = read(method);
|
|
6
|
+
if (direct && !direct.markdown.includes('{@inheritDoc}'))
|
|
7
|
+
return direct;
|
|
8
|
+
const seen = new Set();
|
|
9
|
+
const inherited = (file, refs) => {
|
|
10
|
+
for (const ref of refs) {
|
|
11
|
+
const def = project.scopes.get(file)?.get(ref.name);
|
|
12
|
+
if (!def || def.node.kind !== 'interface' || seen.has(def.id))
|
|
13
|
+
continue;
|
|
14
|
+
seen.add(def.id);
|
|
15
|
+
const target = def.node.methods.find(target => target.name === method.name);
|
|
16
|
+
const doc = target && read(target) || inherited(def.file, def.node.extends);
|
|
17
|
+
if (doc)
|
|
18
|
+
return doc;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const doc = owner && inherited(owner.file, owner.node.kind === 'class' ? owner.node.implements :
|
|
22
|
+
owner.node.kind === 'interface' ? owner.node.extends : []);
|
|
23
|
+
if (!direct)
|
|
24
|
+
return doc || undefined;
|
|
25
|
+
return doc ? { ...direct, markdown: direct.markdown.replaceAll('{@inheritDoc}', doc.markdown),
|
|
26
|
+
parameters: new Map([...doc.parameters, ...direct.parameters]) } : direct;
|
|
27
|
+
}
|