@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
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
#ifndef AUG_RUNTIME_H
|
|
2
|
+
#define AUG_RUNTIME_H
|
|
3
|
+
|
|
4
|
+
#include <stdbool.h>
|
|
5
|
+
#include <stddef.h>
|
|
6
|
+
#include <stdint.h>
|
|
7
|
+
#include <string.h>
|
|
8
|
+
|
|
9
|
+
typedef struct AugObject AugObject;
|
|
10
|
+
typedef struct AugValue AugValue;
|
|
11
|
+
typedef AugValue (*AugMethod)(AugValue self, AugValue *args, int count);
|
|
12
|
+
|
|
13
|
+
enum { AUG_NULL, AUG_INT, AUG_FLOAT, AUG_BOOL, AUG_STRING, AUG_OBJECT };
|
|
14
|
+
enum { AUG_LIST_KIND = 6, AUG_MAP_KIND, AUG_SET_KIND, AUG_TUPLE_KIND, AUG_RECORD_KIND, AUG_BYTES_KIND, AUG_PRIVATE_KEY_KIND, AUG_PUBLIC_KEY_KIND, AUG_JSON_KIND, AUG_HTTP_REQUEST_KIND, AUG_HTTP_RESPONSE_KIND, AUG_HEADERS_KIND, AUG_HTML_KIND, AUG_TASK_KIND, AUG_HTTP_ACTION_KIND };
|
|
15
|
+
|
|
16
|
+
struct AugValue {
|
|
17
|
+
int tag;
|
|
18
|
+
union { int64_t integer; double floating; bool boolean; AugObject *object; } as;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
typedef struct {
|
|
22
|
+
const char *name;
|
|
23
|
+
AugMethod function;
|
|
24
|
+
} AugMethodEntry;
|
|
25
|
+
|
|
26
|
+
struct AugObject {
|
|
27
|
+
AugObject *next;
|
|
28
|
+
bool marked;
|
|
29
|
+
bool dropped;
|
|
30
|
+
bool frozen;
|
|
31
|
+
bool html_actions;
|
|
32
|
+
int kind;
|
|
33
|
+
const char *type_name;
|
|
34
|
+
char *text;
|
|
35
|
+
size_t text_length;
|
|
36
|
+
AugValue *fields;
|
|
37
|
+
size_t field_count;
|
|
38
|
+
size_t capacity;
|
|
39
|
+
size_t *buckets;
|
|
40
|
+
size_t bucket_count;
|
|
41
|
+
const unsigned char *owned_fields;
|
|
42
|
+
const char *const *field_names;
|
|
43
|
+
const AugMethodEntry *methods;
|
|
44
|
+
size_t method_count;
|
|
45
|
+
void *native;
|
|
46
|
+
void (*finalize)(void *native);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
typedef struct AugFrame {
|
|
50
|
+
AugValue *slots;
|
|
51
|
+
size_t count;
|
|
52
|
+
struct AugFrame *previous;
|
|
53
|
+
} AugFrame;
|
|
54
|
+
typedef struct AugRetained { AugValue *values; size_t count; struct AugRetained *next; } AugRetained;
|
|
55
|
+
void aug_retain(AugRetained *root, AugValue *values, size_t count);
|
|
56
|
+
void aug_release(AugRetained *root);
|
|
57
|
+
|
|
58
|
+
typedef struct AugScope {
|
|
59
|
+
struct AugScope *previous; AugValue *values; const unsigned char *mask; void *tasks;
|
|
60
|
+
} AugScope;
|
|
61
|
+
typedef struct AugExecution {
|
|
62
|
+
AugFrame *root_frames; AugScope *scope_stack; size_t scope_depth;
|
|
63
|
+
AugValue error; bool has_error; bool cancelled; void *fiber;
|
|
64
|
+
struct AugExecution *next;
|
|
65
|
+
void *held_locks; size_t lock_depth;
|
|
66
|
+
void *http_job;
|
|
67
|
+
} AugExecution;
|
|
68
|
+
AugExecution *aug_execution_current(void);
|
|
69
|
+
AugExecution *aug_execution_switch(AugExecution *execution);
|
|
70
|
+
void aug_execution_init(AugExecution *execution);
|
|
71
|
+
void aug_execution_dispose(AugExecution *execution);
|
|
72
|
+
#define aug_error (aug_execution_current()->error)
|
|
73
|
+
#define aug_has_error (aug_execution_current()->has_error)
|
|
74
|
+
#define aug_cancelled (aug_execution_current()->cancelled)
|
|
75
|
+
typedef void (*AugScopeJoin)(AugScope *scope);
|
|
76
|
+
extern AugScopeJoin aug_scope_join_hook;
|
|
77
|
+
AugValue aug_binding_get(size_t index);
|
|
78
|
+
void aug_binding_set(size_t index, AugValue value);
|
|
79
|
+
AugValue aug_shared_new(AugValue value);
|
|
80
|
+
AugValue aug_shared_lock(AugValue value);
|
|
81
|
+
size_t aug_lock_depth(void);
|
|
82
|
+
void aug_lock_leave(void);
|
|
83
|
+
void aug_lock_restore(size_t depth);
|
|
84
|
+
extern void (*aug_mutex_wait_hook)(void);
|
|
85
|
+
typedef struct AugTask AugTask;
|
|
86
|
+
typedef void (*AugTaskCompletion)(AugValue task, void *data);
|
|
87
|
+
AugValue aug_task_start(AugMethod function, AugValue receiver, AugValue *args, int count);
|
|
88
|
+
AugValue aug_task_spawn(AugMethod function, AugValue receiver, AugValue *args, int count, AugTaskCompletion completion, void *data);
|
|
89
|
+
AugValue aug_task_wait(AugValue *tasks, int count);
|
|
90
|
+
AugTask *aug_task_current(void);
|
|
91
|
+
bool aug_task_finished(AugValue task);
|
|
92
|
+
void aug_task_cancel(AugValue task);
|
|
93
|
+
void aug_task_release(AugValue task);
|
|
94
|
+
void aug_task_suspend(void);
|
|
95
|
+
void aug_task_wake(AugTask *task);
|
|
96
|
+
void aug_task_checkpoint(void);
|
|
97
|
+
extern void (*aug_task_checkpoint_hook)(void);
|
|
98
|
+
bool aug_scheduler_step(void);
|
|
99
|
+
extern void (*aug_scheduler_io)(bool wait);
|
|
100
|
+
extern void (*aug_scheduler_notify)(void);
|
|
101
|
+
extern bool aug_test_failed;
|
|
102
|
+
extern size_t aug_test_assertions;
|
|
103
|
+
|
|
104
|
+
AugValue aug_null(void);
|
|
105
|
+
AugValue aug_int(int64_t value);
|
|
106
|
+
AugValue aug_float(double value);
|
|
107
|
+
AugValue aug_bool(bool value);
|
|
108
|
+
/* The checker proves these operand types. Keep scalar arithmetic visible to
|
|
109
|
+
the C optimizer while preserving August's wrapping and checked semantics. */
|
|
110
|
+
static inline AugValue aug_scalar_int(int64_t value) { return (AugValue){.tag=AUG_INT, .as.integer=value}; }
|
|
111
|
+
static inline AugValue aug_scalar_float(double value) { return (AugValue){.tag=AUG_FLOAT, .as.floating=value}; }
|
|
112
|
+
static inline AugValue aug_scalar_bool(bool value) { return (AugValue){.tag=AUG_BOOL, .as.boolean=value}; }
|
|
113
|
+
static inline AugValue aug_scalar_null(void) { return (AugValue){.tag=AUG_NULL}; }
|
|
114
|
+
static inline int64_t aug_signed_bits(uint64_t bits) {
|
|
115
|
+
/* Unsigned-to-signed casts are implementation-defined above INT64_MAX. */
|
|
116
|
+
int64_t value; memcpy(&value, &bits, sizeof(value)); return value;
|
|
117
|
+
}
|
|
118
|
+
AugValue aug_error_named(const char *name);
|
|
119
|
+
static inline AugValue aug_scalar_int_divide(int64_t left, int64_t right) {
|
|
120
|
+
if (!right) return aug_error_named("ArithmeticError");
|
|
121
|
+
return aug_scalar_int(left == INT64_MIN && right == -1 ? INT64_MIN : left / right);
|
|
122
|
+
}
|
|
123
|
+
static inline AugValue aug_scalar_float_divide(double left, double right) {
|
|
124
|
+
if (right == 0) return aug_error_named("ArithmeticError");
|
|
125
|
+
return aug_scalar_float(left / right);
|
|
126
|
+
}
|
|
127
|
+
AugValue aug_string(const char *value);
|
|
128
|
+
AugValue aug_string_n(const void *value, size_t length);
|
|
129
|
+
AugValue aug_bytes(const void *value, size_t length, int kind);
|
|
130
|
+
int64_t aug_string_length(AugValue value);
|
|
131
|
+
AugValue aug_string_bytes(AugValue value);
|
|
132
|
+
AugValue aug_string_split(AugValue value, AugValue separator);
|
|
133
|
+
bool aug_string_starts_with(AugValue value, AugValue prefix);
|
|
134
|
+
bool aug_string_is_token(AugValue value, int64_t minimum, int64_t maximum);
|
|
135
|
+
int64_t aug_bytes_length(AugValue value);
|
|
136
|
+
AugValue aug_bytes_text(AugValue value);
|
|
137
|
+
AugValue aug_bytes_base64url(AugValue value);
|
|
138
|
+
AugValue aug_base64url_decode(AugValue value);
|
|
139
|
+
|
|
140
|
+
typedef struct AugSchema AugSchema;
|
|
141
|
+
typedef AugValue (*AugFunction)(AugValue *args, int count);
|
|
142
|
+
enum { AUG_SCHEMA_INT, AUG_SCHEMA_C_INT, AUG_SCHEMA_FLOAT, AUG_SCHEMA_BOOL, AUG_SCHEMA_STRING,
|
|
143
|
+
AUG_SCHEMA_LIST, AUG_SCHEMA_MAP, AUG_SCHEMA_SET, AUG_SCHEMA_TUPLE, AUG_SCHEMA_RECORD, AUG_SCHEMA_JSON };
|
|
144
|
+
struct AugSchema {
|
|
145
|
+
int kind; bool nullable; bool optional; size_t count;
|
|
146
|
+
const AugSchema *const *fields; const char *const *names; AugFunction make;
|
|
147
|
+
};
|
|
148
|
+
AugValue aug_json_decode(AugValue value, const AugSchema *schema);
|
|
149
|
+
AugValue aug_json_stringify(AugValue value);
|
|
150
|
+
AugValue aug_json_get(AugValue value, AugValue name);
|
|
151
|
+
AugValue aug_json_require(AugValue value, AugValue name);
|
|
152
|
+
AugValue aug_json_string(AugValue value);
|
|
153
|
+
int64_t aug_json_integer(AugValue value);
|
|
154
|
+
bool aug_json_boolean(AugValue value);
|
|
155
|
+
AugValue aug_json_items(AugValue value);
|
|
156
|
+
AugValue aug_json_wrap(AugValue value);
|
|
157
|
+
AugValue _aug_json_parse(AugValue input);
|
|
158
|
+
typedef enum {
|
|
159
|
+
AUG_HTTP_POLICY_REQUIRE_LOGIN=1, AUG_HTTP_POLICY_REQUIRE_PERMISSION,
|
|
160
|
+
AUG_HTTP_POLICY_LOG_REQUEST, AUG_HTTP_POLICY_RATE_LIMIT, AUG_HTTP_POLICY_TIMEOUT,
|
|
161
|
+
AUG_HTTP_POLICY_CORS, AUG_HTTP_POLICY_COMPRESS
|
|
162
|
+
} AugHttpPolicyKind;
|
|
163
|
+
typedef struct {AugHttpPolicyKind kind;const char *permission;int64_t amount,seconds;bool credentials;const char *origins,*headers;} AugHttpPolicy;
|
|
164
|
+
typedef struct { const char *method; const char *path; AugFunction handler; int stream; int status; const AugHttpPolicy *policies;size_t policy_count; } AugRoute;
|
|
165
|
+
void aug_http_policy(const AugHttpPolicy *policy, AugValue request, AugValue dependency, AugValue second);
|
|
166
|
+
AugValue aug_http_finish(AugValue response);
|
|
167
|
+
AugValue aug_http_bind(AugValue request, const char *source, const char *name, const AugSchema *schema);
|
|
168
|
+
AugValue aug_httprequest_form(AugValue request, const AugSchema *schema);
|
|
169
|
+
AugValue aug_http_response(AugValue body, int status);
|
|
170
|
+
AugValue aug_http_response_full(AugValue body, AugValue status, AugValue headers);
|
|
171
|
+
AugValue aug_headers_new(void);
|
|
172
|
+
AugValue aug_headers_with(AugValue headers, AugValue name, AugValue value);
|
|
173
|
+
AugValue aug_headers_get(AugValue headers, AugValue name);
|
|
174
|
+
AugValue aug_headers_all(AugValue headers, AugValue name);
|
|
175
|
+
AugValue aug_html_element(const char *tag, AugValue *attributes, size_t count, AugValue *children, size_t child_count);
|
|
176
|
+
AugValue aug_http_action(const char *route, AugValue *values, size_t count);
|
|
177
|
+
AugValue aug_http_event(AugValue data, AugValue id, AugValue event, AugValue retry);
|
|
178
|
+
void aug_http_yield(AugValue value);
|
|
179
|
+
AugValue aug_http_test_client(const AugRoute *routes, size_t count);
|
|
180
|
+
AugValue aug_httptestclient_request(AugValue client, AugValue method, AugValue path, AugValue headers, AugValue body);
|
|
181
|
+
AugValue aug_html_transport(AugValue html);
|
|
182
|
+
AugValue aug_http_problem(int status);
|
|
183
|
+
int aug_http_error_status(void);
|
|
184
|
+
void aug_http_serve(const AugRoute *routes, size_t count, int64_t port);
|
|
185
|
+
void aug_http_configure(const char *host, const char *certificate, const char *private_key, const char *ca, size_t request_limit, size_t result_limit, bool http3);
|
|
186
|
+
AugValue aug_new_object(const char *name, size_t field_count,
|
|
187
|
+
const unsigned char *owned_fields,
|
|
188
|
+
const AugMethodEntry *methods, size_t method_count);
|
|
189
|
+
AugValue aug_list_new(AugValue *items, size_t count);
|
|
190
|
+
void aug_list_append(AugValue list, AugValue item);
|
|
191
|
+
AugValue aug_list_get(AugValue list, int64_t index);
|
|
192
|
+
AugValue aug_list_at(AugValue list, int64_t index);
|
|
193
|
+
AugValue aug_iter_snapshot(AugValue collection);
|
|
194
|
+
AugValue aug_map_entries_snapshot(AugValue map);
|
|
195
|
+
int64_t aug_list_length(AugValue list);
|
|
196
|
+
AugValue aug_tuple_new(AugValue *items, size_t count);
|
|
197
|
+
AugValue aug_tuple_get(AugValue tuple, int64_t index);
|
|
198
|
+
int64_t aug_tuple_length(AugValue tuple);
|
|
199
|
+
AugValue aug_set_new(AugValue *items, size_t count);
|
|
200
|
+
void aug_set_add(AugValue set, AugValue item);
|
|
201
|
+
bool aug_set_contains(AugValue set, AugValue item);
|
|
202
|
+
int64_t aug_set_length(AugValue set);
|
|
203
|
+
AugValue aug_map_new(void);
|
|
204
|
+
void aug_map_set(AugValue map, AugValue key, AugValue value);
|
|
205
|
+
AugValue aug_map_get(AugValue map, AugValue key);
|
|
206
|
+
AugValue aug_map_take(AugValue map, AugValue key);
|
|
207
|
+
bool aug_map_contains(AugValue map, AugValue key);
|
|
208
|
+
int64_t aug_map_length(AugValue map);
|
|
209
|
+
void aug_set_cli_args(int argc, char **argv);
|
|
210
|
+
AugValue aug_arguments(void);
|
|
211
|
+
AugValue aug_read_file(AugValue path);
|
|
212
|
+
AugValue aug_write_file(AugValue path, AugValue content);
|
|
213
|
+
AugValue aug_field(AugValue object, size_t index);
|
|
214
|
+
void aug_set_field(AugValue object, size_t index, AugValue value);
|
|
215
|
+
AugValue aug_call_method(AugValue object, const char *name, AugValue *args, int count);
|
|
216
|
+
void aug_print(AugValue value);
|
|
217
|
+
void aug_assert(AugValue condition, const char *expression, const char *file, int line);
|
|
218
|
+
AugValue aug_binary(const char *op, AugValue left, AugValue right);
|
|
219
|
+
AugValue aug_unary(const char *op, AugValue value);
|
|
220
|
+
bool aug_truthy(AugValue value);
|
|
221
|
+
const char *aug_cstring(AugValue value);
|
|
222
|
+
int64_t aug_cint(AugValue value);
|
|
223
|
+
AugValue aug_to_c_int(AugValue value);
|
|
224
|
+
void aug_coverage_register(const char *file, size_t line);
|
|
225
|
+
void aug_cover(const char *file, size_t line);
|
|
226
|
+
double aug_cfloat(AugValue value);
|
|
227
|
+
|
|
228
|
+
void aug_frame_enter(AugFrame *frame, AugValue *slots, size_t count);
|
|
229
|
+
void aug_frame_leave(AugFrame *frame);
|
|
230
|
+
void aug_register_globals(AugValue *values, size_t count);
|
|
231
|
+
size_t aug_scope_depth(void);
|
|
232
|
+
void aug_scope_enter(const unsigned char *mask);
|
|
233
|
+
void aug_scope_leave(void);
|
|
234
|
+
void aug_scope_join_to(size_t depth);
|
|
235
|
+
void aug_scope_restore(size_t depth);
|
|
236
|
+
void aug_collect(void);
|
|
237
|
+
void aug_freeze(AugValue value);
|
|
238
|
+
void aug_drop(AugValue value);
|
|
239
|
+
void aug_throw(AugValue value);
|
|
240
|
+
AugValue aug_take_error(void);
|
|
241
|
+
bool aug_error_is(const char *name);
|
|
242
|
+
void aug_report_error(void);
|
|
243
|
+
void aug_shutdown(void);
|
|
244
|
+
|
|
245
|
+
#endif
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#include "aug_runtime.h"
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
#include <string.h>
|
|
4
|
+
#include <stdio.h>
|
|
5
|
+
#define MINICORO_IMPL
|
|
6
|
+
#include "minicoro.h"
|
|
7
|
+
|
|
8
|
+
/* C stack suspension preserves ordinary August calls and their precise GC frames. */
|
|
9
|
+
struct AugTask {
|
|
10
|
+
mco_coro *coroutine; AugExecution execution; AugMethod function;
|
|
11
|
+
AugValue value; AugRetained retained; bool retained_active, queued, complete, observed;
|
|
12
|
+
size_t base_depth; struct AugTask *ready_next, *sibling; AugScope *owner;
|
|
13
|
+
AugTaskCompletion completion; void *completion_data; unsigned ticks;
|
|
14
|
+
};
|
|
15
|
+
static AugTask *ready_first, *ready_last;
|
|
16
|
+
void (*aug_scheduler_io)(bool wait);
|
|
17
|
+
void (*aug_scheduler_notify)(void);
|
|
18
|
+
|
|
19
|
+
static void fatal(const char *message) { fprintf(stderr, "August scheduler: %s\n", message); abort(); }
|
|
20
|
+
static AugTask *task_of(AugValue value) {
|
|
21
|
+
return value.tag == AUG_OBJECT && value.as.object->kind == AUG_TASK_KIND ? value.as.object->native : NULL;
|
|
22
|
+
}
|
|
23
|
+
AugTask *aug_task_current(void) { return aug_execution_current()->fiber; }
|
|
24
|
+
bool aug_task_finished(AugValue value) { AugTask *task = task_of(value); return task && task->complete; }
|
|
25
|
+
void aug_task_wake(AugTask *task) {
|
|
26
|
+
if (!task || task->complete || task->queued) return;
|
|
27
|
+
task->queued = true; task->ready_next = NULL;
|
|
28
|
+
if (ready_last) ready_last->ready_next = task; else ready_first = task;
|
|
29
|
+
ready_last = task;
|
|
30
|
+
if(aug_scheduler_notify)aug_scheduler_notify();
|
|
31
|
+
}
|
|
32
|
+
static void destroy_task(void *native) {
|
|
33
|
+
AugTask *task = native;
|
|
34
|
+
if (!task->complete) fatal("collected an unfinished task");
|
|
35
|
+
mco_destroy(task->coroutine); free(task);
|
|
36
|
+
}
|
|
37
|
+
void aug_task_release(AugValue value) {
|
|
38
|
+
AugTask *task = task_of(value);
|
|
39
|
+
if (task && task->retained_active) { aug_release(&task->retained); task->retained_active = false; }
|
|
40
|
+
}
|
|
41
|
+
void aug_task_cancel(AugValue value) {
|
|
42
|
+
AugTask *task = task_of(value);
|
|
43
|
+
if (!task || task->complete) return;
|
|
44
|
+
task->execution.cancelled = true; aug_task_wake(task);
|
|
45
|
+
}
|
|
46
|
+
static void cancel_group(AugTask *failed) {
|
|
47
|
+
if (!failed->owner) return;
|
|
48
|
+
for (AugTask *task = failed->owner->tasks; task; task = task->sibling)
|
|
49
|
+
if (task != failed) aug_task_cancel(task->value);
|
|
50
|
+
}
|
|
51
|
+
static void run_task(mco_coro *coroutine) {
|
|
52
|
+
AugTask *task = mco_get_user_data(coroutine);
|
|
53
|
+
AugValue arguments = aug_field(task->value, 1);
|
|
54
|
+
if (!aug_cancelled) {
|
|
55
|
+
AugValue result = task->function(aug_field(task->value, 0), arguments.as.object->fields, (int)arguments.as.object->field_count);
|
|
56
|
+
aug_set_field(task->value, 2, result);
|
|
57
|
+
}
|
|
58
|
+
aug_scope_restore(task->base_depth);
|
|
59
|
+
if (aug_has_error) { aug_set_field(task->value, 3, aug_take_error()); cancel_group(task); }
|
|
60
|
+
task->complete = true;
|
|
61
|
+
}
|
|
62
|
+
bool aug_scheduler_step(void) {
|
|
63
|
+
AugTask *task = ready_first;
|
|
64
|
+
if (!task) return false;
|
|
65
|
+
ready_first = task->ready_next; if (!ready_first) ready_last = NULL;
|
|
66
|
+
task->queued = false; task->ready_next = NULL;
|
|
67
|
+
if (task->complete) return true;
|
|
68
|
+
AugExecution *previous = aug_execution_switch(&task->execution);
|
|
69
|
+
if (mco_resume(task->coroutine) != MCO_SUCCESS) fatal("cannot resume task");
|
|
70
|
+
aug_execution_switch(previous);
|
|
71
|
+
if (task->complete) {
|
|
72
|
+
aug_execution_dispose(&task->execution);
|
|
73
|
+
if (task->completion) task->completion(task->value, task->completion_data);
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
void aug_task_suspend(void) {
|
|
78
|
+
AugTask *task = aug_task_current();
|
|
79
|
+
if (!task || mco_yield(task->coroutine) != MCO_SUCCESS) fatal("suspension outside a task");
|
|
80
|
+
}
|
|
81
|
+
void aug_task_checkpoint(void) {
|
|
82
|
+
if(aug_task_checkpoint_hook)aug_task_checkpoint_hook();
|
|
83
|
+
AugTask *task = aug_task_current();
|
|
84
|
+
if (task && !aug_lock_depth() && ++task->ticks % 128 == 0) { aug_task_wake(task); aug_task_suspend(); }
|
|
85
|
+
}
|
|
86
|
+
static void await_task(AugTask *task) {
|
|
87
|
+
while (!task->complete) {
|
|
88
|
+
if (aug_cancelled) aug_task_cancel(task->value);
|
|
89
|
+
if (aug_task_current()) { aug_task_wake(aug_task_current()); aug_task_suspend(); }
|
|
90
|
+
else if (!aug_scheduler_step()) {
|
|
91
|
+
if (!aug_scheduler_io) fatal("task deadlock: every child is suspended");
|
|
92
|
+
aug_scheduler_io(true);
|
|
93
|
+
}
|
|
94
|
+
if (aug_scheduler_io && !aug_task_current()) aug_scheduler_io(false);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static void join_scope(AugScope *scope) {
|
|
98
|
+
bool cancelling = aug_has_error || aug_cancelled;
|
|
99
|
+
AugValue first_error = aug_null(); AugFrame frame; aug_frame_enter(&frame, &first_error, 1);
|
|
100
|
+
for (AugTask *task = scope->tasks; task; task = task->sibling) {
|
|
101
|
+
if (cancelling) aug_task_cancel(task->value);
|
|
102
|
+
await_task(task);
|
|
103
|
+
AugValue error = aug_field(task->value, 3);
|
|
104
|
+
if (!task->observed && error.tag != AUG_NULL && first_error.tag == AUG_NULL) first_error = error;
|
|
105
|
+
}
|
|
106
|
+
for (AugTask *task = scope->tasks; task;) {
|
|
107
|
+
AugTask *next = task->sibling; task->owner = NULL; aug_task_release(task->value); task = next;
|
|
108
|
+
}
|
|
109
|
+
scope->tasks = NULL;
|
|
110
|
+
if (!aug_has_error && first_error.tag != AUG_NULL) aug_throw(first_error);
|
|
111
|
+
aug_frame_leave(&frame);
|
|
112
|
+
}
|
|
113
|
+
AugValue aug_task_spawn(AugMethod function, AugValue receiver, AugValue *args, int count, AugTaskCompletion completion, void *data) {
|
|
114
|
+
aug_scope_join_hook = join_scope;
|
|
115
|
+
AugValue roots[3] = {receiver, aug_null(), aug_null()}; AugFrame frame; aug_frame_enter(&frame, roots, 3);
|
|
116
|
+
roots[1] = aug_list_new(args, (size_t)count);
|
|
117
|
+
roots[2] = aug_new_object("Task", 4, NULL, NULL, 0); roots[2].as.object->kind = AUG_TASK_KIND;
|
|
118
|
+
aug_set_field(roots[2], 0, receiver); aug_set_field(roots[2], 1, roots[1]);
|
|
119
|
+
AugTask *task = calloc(1, sizeof(*task)); if (!task) fatal("out of memory");
|
|
120
|
+
task->function = function; task->value = roots[2]; task->completion = completion; task->completion_data = data;
|
|
121
|
+
aug_execution_init(&task->execution); task->execution.fiber = task;
|
|
122
|
+
AugExecution *parent = aug_execution_current();
|
|
123
|
+
task->execution.scope_stack = parent->scope_stack; task->execution.scope_depth = parent->scope_depth; task->base_depth = parent->scope_depth;
|
|
124
|
+
task->execution.http_job = parent->http_job; task->execution.cancelled = parent->cancelled;
|
|
125
|
+
task->retained_active = true; aug_retain(&task->retained, &task->value, 1);
|
|
126
|
+
roots[2].as.object->native = task; roots[2].as.object->finalize = destroy_task;
|
|
127
|
+
mco_desc description = mco_desc_init(run_task, 1024 * 1024); description.user_data = task;
|
|
128
|
+
if (mco_create(&task->coroutine, &description) != MCO_SUCCESS) fatal("cannot allocate coroutine stack");
|
|
129
|
+
aug_task_wake(task); AugValue result = roots[2]; aug_frame_leave(&frame); return result;
|
|
130
|
+
}
|
|
131
|
+
AugValue aug_task_start(AugMethod function, AugValue receiver, AugValue *args, int count) {
|
|
132
|
+
AugScope *scope = aug_execution_current()->scope_stack;
|
|
133
|
+
if (!scope) return aug_error_named("ConcurrencyError");
|
|
134
|
+
AugValue value = aug_task_spawn(function, receiver, args, count, NULL, NULL); AugTask *task = task_of(value);
|
|
135
|
+
task->owner = scope; task->sibling = scope->tasks; scope->tasks = task; return value;
|
|
136
|
+
}
|
|
137
|
+
static AugValue wait_one(AugValue value) {
|
|
138
|
+
AugTask *task = task_of(value); if (!task) return aug_error_named("ConcurrencyError");
|
|
139
|
+
await_task(task); AugValue error = aug_field(value, 3);
|
|
140
|
+
if (error.tag != AUG_NULL) { task->observed = true; aug_throw(error); return aug_null(); }
|
|
141
|
+
if (task->execution.cancelled) {
|
|
142
|
+
if (!aug_cancelled && task->owner) for (AugTask *sibling = task->owner->tasks; sibling; sibling = sibling->sibling) {
|
|
143
|
+
error = aug_field(sibling->value, 3);
|
|
144
|
+
if (!sibling->observed && error.tag != AUG_NULL) {
|
|
145
|
+
sibling->observed = true; aug_throw(error); return aug_null();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
aug_cancelled = true;
|
|
149
|
+
}
|
|
150
|
+
return aug_field(value, 2);
|
|
151
|
+
}
|
|
152
|
+
AugValue aug_task_wait(AugValue *tasks, int count) {
|
|
153
|
+
if (count == 1 && task_of(tasks[0])) return wait_one(tasks[0]);
|
|
154
|
+
AugValue *items = tasks; size_t size = (size_t)count; bool list = false;
|
|
155
|
+
if (count == 1 && tasks[0].tag == AUG_OBJECT && tasks[0].as.object->kind == AUG_LIST_KIND) {
|
|
156
|
+
items = tasks[0].as.object->fields; size = tasks[0].as.object->field_count; list = true;
|
|
157
|
+
}
|
|
158
|
+
AugValue roots[2] = {aug_list_new(NULL, 0), aug_null()}; AugFrame frame; aug_frame_enter(&frame, roots, 2);
|
|
159
|
+
for (size_t i = 0; i < size; i++) {
|
|
160
|
+
AugTask *task = task_of(items[i]);
|
|
161
|
+
if (task && (roots[1].tag != AUG_NULL || aug_cancelled)) {
|
|
162
|
+
aug_task_cancel(task->value); await_task(task); task->observed = true;
|
|
163
|
+
} else {
|
|
164
|
+
AugValue value = wait_one(items[i]);
|
|
165
|
+
if (aug_has_error) {AugValue error = aug_take_error(); if (roots[1].tag == AUG_NULL) roots[1] = error;}
|
|
166
|
+
else if (!aug_cancelled) aug_list_append(roots[0], value);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!list) roots[0].as.object->kind = AUG_TUPLE_KIND;
|
|
170
|
+
if (roots[1].tag != AUG_NULL) aug_throw(roots[1]);
|
|
171
|
+
AugValue result = roots[0]; aug_frame_leave(&frame); return result;
|
|
172
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#include "aug_runtime.h"
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
#include <string.h>
|
|
4
|
+
|
|
5
|
+
int64_t aug_string_length(AugValue value) { return (int64_t)value.as.object->text_length; }
|
|
6
|
+
AugValue aug_string_bytes(AugValue value) { return aug_bytes(value.as.object->text, value.as.object->text_length, AUG_BYTES_KIND); }
|
|
7
|
+
bool aug_string_starts_with(AugValue value, AugValue prefix) {
|
|
8
|
+
return prefix.as.object->text_length <= value.as.object->text_length &&
|
|
9
|
+
!memcmp(value.as.object->text, prefix.as.object->text, prefix.as.object->text_length);
|
|
10
|
+
}
|
|
11
|
+
AugValue aug_string_split(AugValue value, AugValue separator) {
|
|
12
|
+
AugValue roots[2] = {value, aug_null()}; AugFrame frame; aug_frame_enter(&frame, roots, 2);
|
|
13
|
+
roots[1] = aug_list_new(NULL, 0);
|
|
14
|
+
size_t size = value.as.object->text_length, step = separator.as.object->text_length, begin = 0;
|
|
15
|
+
if (!step) { aug_list_append(roots[1], value); }
|
|
16
|
+
else {
|
|
17
|
+
for (size_t i = 0; i + step <= size;) {
|
|
18
|
+
if (!memcmp(value.as.object->text + i, separator.as.object->text, step)) {
|
|
19
|
+
AugValue part = aug_string_n(value.as.object->text + begin, i - begin);
|
|
20
|
+
aug_list_append(roots[1], part); i += step; begin = i;
|
|
21
|
+
} else i++;
|
|
22
|
+
}
|
|
23
|
+
aug_list_append(roots[1], aug_string_n(value.as.object->text + begin, size - begin));
|
|
24
|
+
}
|
|
25
|
+
AugValue result = roots[1]; aug_frame_leave(&frame); return result;
|
|
26
|
+
}
|
|
27
|
+
int64_t aug_bytes_length(AugValue value) { return (int64_t)value.as.object->text_length; }
|
|
28
|
+
AugValue aug_bytes_text(AugValue value) {
|
|
29
|
+
const unsigned char *text = (const unsigned char *)value.as.object->text;
|
|
30
|
+
size_t size = value.as.object->text_length;
|
|
31
|
+
for (size_t i = 0; i < size;) {
|
|
32
|
+
unsigned char first = text[i++];
|
|
33
|
+
if (first < 0x80) continue;
|
|
34
|
+
int extra = first >= 0xc2 && first <= 0xdf ? 1 : first >= 0xe0 && first <= 0xef ? 2 : first >= 0xf0 && first <= 0xf4 ? 3 : -1;
|
|
35
|
+
if (extra < 0 || i + (size_t)extra > size) return aug_error_named("ConversionError");
|
|
36
|
+
uint32_t code = first & (extra == 1 ? 0x1f : extra == 2 ? 0x0f : 0x07);
|
|
37
|
+
for (int j = 0; j < extra; j++) {
|
|
38
|
+
unsigned char next = text[i++];
|
|
39
|
+
if ((next & 0xc0) != 0x80) return aug_error_named("ConversionError");
|
|
40
|
+
code = (code << 6) | (next & 0x3f);
|
|
41
|
+
}
|
|
42
|
+
if (code < (extra == 1 ? 0x80u : extra == 2 ? 0x800u : 0x10000u) || code > 0x10ffff || (code >= 0xd800 && code <= 0xdfff)) return aug_error_named("ConversionError");
|
|
43
|
+
}
|
|
44
|
+
return aug_string_n(text, size);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
48
|
+
AugValue aug_bytes_base64url(AugValue value) {
|
|
49
|
+
const unsigned char *bytes = (const unsigned char *)value.as.object->text;
|
|
50
|
+
size_t size = value.as.object->text_length, length = (size * 8 + 5) / 6;
|
|
51
|
+
char *text = malloc(length + 1); if (!text) abort();
|
|
52
|
+
uint32_t bits = 0; int count = 0; size_t next = 0;
|
|
53
|
+
for (size_t i = 0; i < size; i++) {
|
|
54
|
+
bits = (bits << 8) | bytes[i]; count += 8;
|
|
55
|
+
while (count >= 6) { count -= 6; text[next++] = alphabet[(bits >> count) & 63]; }
|
|
56
|
+
}
|
|
57
|
+
if (count) text[next++] = alphabet[(bits << (6 - count)) & 63];
|
|
58
|
+
AugValue result = aug_string_n(text, next); free(text); return result;
|
|
59
|
+
}
|
|
60
|
+
AugValue aug_base64url_decode(AugValue value) {
|
|
61
|
+
size_t length = value.as.object->text_length;
|
|
62
|
+
if (length % 4 == 1) return aug_error_named("CryptoError");
|
|
63
|
+
unsigned char *output = malloc(length * 3 / 4 + 1); if (!output) abort();
|
|
64
|
+
uint32_t bits = 0; int count = 0; size_t next = 0;
|
|
65
|
+
for (size_t i = 0; i < length; i++) {
|
|
66
|
+
unsigned char c = (unsigned char)value.as.object->text[i];
|
|
67
|
+
const char *found = c ? strchr(alphabet, c) : NULL;
|
|
68
|
+
if (!found) { free(output); return aug_error_named("CryptoError"); }
|
|
69
|
+
bits = (bits << 6) | (uint32_t)(found - alphabet); count += 6;
|
|
70
|
+
if (count >= 8) { count -= 8; output[next++] = (unsigned char)(bits >> count); }
|
|
71
|
+
}
|
|
72
|
+
if (count && (bits & ((1u << count) - 1))) { free(output); return aug_error_named("CryptoError"); }
|
|
73
|
+
AugValue result = aug_bytes(output, next, AUG_BYTES_KIND); free(output); return result;
|
|
74
|
+
}
|
|
75
|
+
bool aug_string_is_token(AugValue value, int64_t minimum, int64_t maximum) {
|
|
76
|
+
size_t size = value.as.object->text_length; if (minimum < 0 || maximum < minimum || size < (uint64_t)minimum || size > (uint64_t)maximum) return false;
|
|
77
|
+
for (size_t i = 0; i < size; i++) {unsigned char c = (unsigned char)value.as.object->text[i];
|
|
78
|
+
if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == '~')) return false;
|
|
79
|
+
} return true;
|
|
80
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** Build the pinned C dependencies privately; never install into system directories. */
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, openSync, closeSync } from 'node:fs';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
import { availableParallelism } from 'node:os';
|
|
8
|
+
import { nativeHome } from './native-home.mjs';
|
|
9
|
+
|
|
10
|
+
const root = resolve(import.meta.dirname, '..');
|
|
11
|
+
const lock = JSON.parse(readFileSync(join(import.meta.dirname, 'native-dependencies.lock.json'), 'utf8'));
|
|
12
|
+
const extractOnly = process.argv.includes('--extract-only');
|
|
13
|
+
const onlyIndex = process.argv.indexOf('--only');
|
|
14
|
+
const selected = onlyIndex >= 0 ? process.argv[onlyIndex + 1]?.split(',') : undefined;
|
|
15
|
+
if (onlyIndex >= 0 && (!extractOnly || !selected?.length || selected.some(name => !lock.dependencies.some(dependency => dependency.name === name))))
|
|
16
|
+
throw new Error('--only requires --extract-only and comma-separated names from native-dependencies.lock.json.');
|
|
17
|
+
const directory = nativeHome(root);
|
|
18
|
+
const prefix = join(directory, 'prefix');
|
|
19
|
+
const downloads = join(directory, 'downloads');
|
|
20
|
+
const sources = join(directory, 'sources');
|
|
21
|
+
const logs = join(directory, 'logs');
|
|
22
|
+
for (const path of [prefix, downloads, sources, logs]) mkdirSync(path, { recursive: true });
|
|
23
|
+
if (!extractOnly && !lock.platforms.includes(process.platform)) throw new Error(`Full native bootstrap supports ${lock.platforms.join(' and ')}; this host is ${process.platform}. Use --extract-only --only minicoro,yyjson for portable source dependencies.`);
|
|
24
|
+
|
|
25
|
+
function run(command, args, cwd, label, env = process.env) {
|
|
26
|
+
const path = join(logs, label + '.log');
|
|
27
|
+
const descriptor = openSync(path, 'w');
|
|
28
|
+
let result;
|
|
29
|
+
try { result = spawnSync(command, args, { cwd, env, stdio: ['ignore', descriptor, descriptor] }); }
|
|
30
|
+
finally { closeSync(descriptor); }
|
|
31
|
+
if (result.error || result.status !== 0) throw new Error(`${label} failed: ${result.error?.message ?? result.status}. See ${path}\n` + readFileSync(path, 'utf8').split('\n').slice(-24).join('\n'));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const dependencies = lock.dependencies.filter(dependency => (!dependency.platforms || dependency.platforms.includes(process.platform)) && (!selected || selected.includes(dependency.name)));
|
|
35
|
+
if (selected?.some(name => !dependencies.some(dependency => dependency.name === name)))
|
|
36
|
+
throw new Error(`One or more selected dependencies do not support ${process.platform}.`);
|
|
37
|
+
for (const dependency of dependencies) {
|
|
38
|
+
const archive = join(downloads, dependency.archive);
|
|
39
|
+
if (!existsSync(archive)) {
|
|
40
|
+
process.stdout.write(`Downloading ${dependency.name} ${dependency.version}\n`);
|
|
41
|
+
const response = await fetch(dependency.url);
|
|
42
|
+
if (!response.ok) throw new Error(`${dependency.name}: HTTP ${response.status}`);
|
|
43
|
+
writeFileSync(archive, Buffer.from(await response.arrayBuffer()));
|
|
44
|
+
}
|
|
45
|
+
const hash = createHash('sha256').update(readFileSync(archive)).digest('hex');
|
|
46
|
+
if (hash !== dependency.sha256) throw new Error(`${dependency.name}: archive checksum mismatch`);
|
|
47
|
+
const source = join(sources, dependency.name);
|
|
48
|
+
if (!existsSync(join(source, '.archive-sha256'))) {
|
|
49
|
+
mkdirSync(source, { recursive: true });
|
|
50
|
+
run('/usr/bin/tar', ['-xf', archive, '-C', source, '--strip-components=1'], directory, 'extract-' + dependency.name);
|
|
51
|
+
writeFileSync(join(source, '.archive-sha256'), hash + '\n');
|
|
52
|
+
} else if (readFileSync(join(source, '.archive-sha256'), 'utf8').trim() !== hash) {
|
|
53
|
+
throw new Error(`${dependency.name}: source tree differs from the dependency lock; choose a new build directory.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (extractOnly) process.exit(0);
|
|
57
|
+
|
|
58
|
+
const sdk = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk';
|
|
59
|
+
const mac = process.platform === 'darwin';
|
|
60
|
+
const cc = process.env.CC ?? (mac ? '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' : 'clang');
|
|
61
|
+
const sysroot = mac && existsSync(sdk) ? ' -isysroot ' + sdk : '';
|
|
62
|
+
const environment = { ...process.env, ...(mac ? { SDKROOT: sdk } : {}), CC: cc, CC_FOR_BUILD: cc, CXX: process.env.CXX ?? cc.replace(/clang$/, 'clang++'),
|
|
63
|
+
CFLAGS: `-O2 -fPIC${sysroot}`,
|
|
64
|
+
CXXFLAGS: `-O2 -fPIC${sysroot}`,
|
|
65
|
+
CPPFLAGS: `-I${prefix}/include${sysroot}`, LDFLAGS: `-L${prefix}/lib -Wl,-rpath,${prefix}/lib`,
|
|
66
|
+
PKG_CONFIG: join(prefix, 'bin', 'pkgconf'), PKG_CONFIG_PATH: join(prefix, 'lib', 'pkgconfig'),
|
|
67
|
+
LD_LIBRARY_PATH: `${prefix}/lib${process.env.LD_LIBRARY_PATH ? ':' + process.env.LD_LIBRARY_PATH : ''}`,
|
|
68
|
+
PATH: join(prefix, 'bin') + ':' + process.env.PATH,
|
|
69
|
+
};
|
|
70
|
+
const parallel = String(Math.min(8, availableParallelism()));
|
|
71
|
+
for (const name of ['pkgconf', 'gmp', 'nettle', 'gnutls']) {
|
|
72
|
+
const marker = join(prefix, '.built-' + name);
|
|
73
|
+
const checksum = lock.dependencies.find(dependency => dependency.name === name).sha256;
|
|
74
|
+
if (existsSync(marker)) {
|
|
75
|
+
if (readFileSync(marker, 'utf8').trim() !== checksum) throw new Error(`${name}: installed build differs from the dependency lock; choose a new build directory.`);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const source = join(sources, name);
|
|
79
|
+
const extra = name === 'gmp' ? ['--disable-cxx', '--with-pic'] : name === 'nettle' ? ['--disable-documentation'] : name === 'gnutls' ? [
|
|
80
|
+
'--disable-doc', '--disable-tests', '--disable-tools', '--disable-cxx', '--disable-guile',
|
|
81
|
+
'--disable-nls', '--disable-idn', '--without-p11-kit', '--without-brotli', '--without-zstd',
|
|
82
|
+
'--with-included-libtasn1', '--with-included-unistring', '--disable-libdane',
|
|
83
|
+
] : [];
|
|
84
|
+
// GnuTLS 3.8.13's audit header does not define this diagnostic-only macro
|
|
85
|
+
// when Clang 14 reports __has_c_attribute but lacks [[maybe_unused]].
|
|
86
|
+
const buildEnvironment = name === 'gnutls' && !mac ?
|
|
87
|
+
{...environment, CFLAGS: environment.CFLAGS + ' -DCRAU_MAYBE_UNUSED='} : environment;
|
|
88
|
+
process.stdout.write(`Building ${name}; logs: ${logs}\n`);
|
|
89
|
+
run(join(source, 'configure'), ['--prefix=' + prefix, '--libdir=' + join(prefix, 'lib'), '--enable-shared', '--disable-static', ...extra], source, name + '-configure', buildEnvironment);
|
|
90
|
+
run('/usr/bin/make', ['-j' + parallel], source, name + '-build', buildEnvironment);
|
|
91
|
+
run('/usr/bin/make', ['install'], source, name + '-install', buildEnvironment);
|
|
92
|
+
if (name === 'nettle') run(join(prefix, 'bin', 'pkgconf'), ['--modversion', 'nettle', 'hogweed'], root, 'nettle-pkgconf', environment);
|
|
93
|
+
writeFileSync(marker, checksum + '\n');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const cmake = mac ? join(sources, 'cmake', 'CMake.app', 'Contents', 'bin', 'cmake') : 'cmake';
|
|
97
|
+
const build = join(directory, 'build-libwebsockets');
|
|
98
|
+
const webMarker = join(prefix, '.built-libwebsockets');
|
|
99
|
+
const webChecksum = lock.dependencies.find(dependency => dependency.name === 'libwebsockets').sha256;
|
|
100
|
+
if (existsSync(webMarker) && readFileSync(webMarker, 'utf8').trim() !== webChecksum)
|
|
101
|
+
throw new Error('libwebsockets: installed build differs from the dependency lock; choose a new build directory.');
|
|
102
|
+
if (!existsSync(webMarker)) {
|
|
103
|
+
process.stdout.write(`Building libwebsockets with GnuTLS, HTTP/2 and HTTP/3\n`);
|
|
104
|
+
run(cmake, ['-S', join(sources, 'libwebsockets'), '-B', build,
|
|
105
|
+
'-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_INSTALL_PREFIX=' + prefix, '-DCMAKE_INSTALL_LIBDIR=lib', '-DCMAKE_PREFIX_PATH=' + prefix,
|
|
106
|
+
'-DCMAKE_C_COMPILER=' + cc, ...(mac ? ['-DCMAKE_OSX_SYSROOT=' + sdk] : []),
|
|
107
|
+
'-DLWS_GNUTLS_LIBRARIES=' + join(prefix, 'lib', mac ? 'libgnutls.dylib' : 'libgnutls.so'),
|
|
108
|
+
'-DLWS_GNUTLS_INCLUDE_DIRS=' + join(prefix, 'include'),
|
|
109
|
+
'-DLWS_WITH_GNUTLS=ON', '-DLWS_WITH_HTTP2=ON', '-DLWS_WITH_HTTP3=ON',
|
|
110
|
+
'-DLWS_WITH_STATIC=ON', '-DLWS_WITH_SHARED=OFF', '-DLWS_WITHOUT_TESTAPPS=ON',
|
|
111
|
+
'-DLWS_WITHOUT_TEST_SERVER=ON', '-DLWS_WITHOUT_TEST_CLIENT=ON',
|
|
112
|
+
'-DLWS_WITH_LIBUV=OFF', '-DLWS_WITH_LIBEVENT=OFF', '-DLWS_WITH_LIBEV=OFF',
|
|
113
|
+
'-DLWS_WITH_GLIB=OFF', '-DLWS_WITHOUT_EXTENSIONS=ON', '-DLWS_WITH_ZLIB=OFF',
|
|
114
|
+
], root, 'libwebsockets-configure', environment);
|
|
115
|
+
run(cmake, ['--build', build, '--parallel', parallel], root, 'libwebsockets-build', environment);
|
|
116
|
+
run(cmake, ['--install', build], root, 'libwebsockets-install', environment);
|
|
117
|
+
writeFileSync(webMarker, webChecksum + '\n');
|
|
118
|
+
}
|
|
119
|
+
writeFileSync(join(prefix, 'aug-native-manifest.json'), JSON.stringify({ platform: process.platform, architecture: process.arch,
|
|
120
|
+
dependencies: dependencies.map(({name, version, revision, sha256}) => ({name, version, revision, sha256})) }, null, 2) + '\n');
|
|
121
|
+
process.stdout.write(`Native dependencies ready at ${prefix}\n`);
|