@endora-commerce/cli 0.100.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 +37 -0
- package/dist/bin/endora.d.ts +28 -0
- package/dist/bin/endora.d.ts.map +1 -0
- package/dist/bin/endora.js +926 -0
- package/dist/bin/endora.js.map +1 -0
- package/dist/check/estate.d.ts +189 -0
- package/dist/check/estate.d.ts.map +1 -0
- package/dist/check/estate.js +1037 -0
- package/dist/check/estate.js.map +1 -0
- package/dist/check/hosts.d.ts +25 -0
- package/dist/check/hosts.d.ts.map +1 -0
- package/dist/check/hosts.js +1347 -0
- package/dist/check/hosts.js.map +1 -0
- package/dist/check/index.d.ts +60 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +111 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/layout.d.ts +136 -0
- package/dist/check/layout.d.ts.map +1 -0
- package/dist/check/layout.js +262 -0
- package/dist/check/layout.js.map +1 -0
- package/dist/check/ledger.d.ts +98 -0
- package/dist/check/ledger.d.ts.map +1 -0
- package/dist/check/ledger.js +173 -0
- package/dist/check/ledger.js.map +1 -0
- package/dist/check/peer-owners.d.ts +116 -0
- package/dist/check/peer-owners.d.ts.map +1 -0
- package/dist/check/peer-owners.js +225 -0
- package/dist/check/peer-owners.js.map +1 -0
- package/dist/check/report.d.ts +33 -0
- package/dist/check/report.d.ts.map +1 -0
- package/dist/check/report.js +107 -0
- package/dist/check/report.js.map +1 -0
- package/dist/check/run.d.ts +147 -0
- package/dist/check/run.d.ts.map +1 -0
- package/dist/check/run.js +111 -0
- package/dist/check/run.js.map +1 -0
- package/dist/checks.d.ts +17 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +17 -0
- package/dist/checks.js.map +1 -0
- package/dist/dev/index.d.ts +83 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +298 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/generate/divergence.d.ts +38 -0
- package/dist/generate/divergence.d.ts.map +1 -0
- package/dist/generate/divergence.js +237 -0
- package/dist/generate/divergence.js.map +1 -0
- package/dist/generate/index.d.ts +90 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +369 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/declaration.d.ts +18 -0
- package/dist/inputs/declaration.d.ts.map +1 -0
- package/dist/inputs/declaration.js +64 -0
- package/dist/inputs/declaration.js.map +1 -0
- package/dist/inputs/env-file.d.ts +73 -0
- package/dist/inputs/env-file.d.ts.map +1 -0
- package/dist/inputs/env-file.js +134 -0
- package/dist/inputs/env-file.js.map +1 -0
- package/dist/inputs/prompt.d.ts +21 -0
- package/dist/inputs/prompt.d.ts.map +1 -0
- package/dist/inputs/prompt.js +59 -0
- package/dist/inputs/prompt.js.map +1 -0
- package/dist/inputs/resolve.d.ts +163 -0
- package/dist/inputs/resolve.d.ts.map +1 -0
- package/dist/inputs/resolve.js +290 -0
- package/dist/inputs/resolve.js.map +1 -0
- package/dist/install/host.d.ts +27 -0
- package/dist/install/host.d.ts.map +1 -0
- package/dist/install/host.js +90 -0
- package/dist/install/host.js.map +1 -0
- package/dist/install/index.d.ts +173 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +793 -0
- package/dist/install/index.js.map +1 -0
- package/dist/install/wizard.d.ts +144 -0
- package/dist/install/wizard.d.ts.map +1 -0
- package/dist/install/wizard.js +362 -0
- package/dist/install/wizard.js.map +1 -0
- package/dist/lib/admin-artefacts.d.ts +70 -0
- package/dist/lib/admin-artefacts.d.ts.map +1 -0
- package/dist/lib/admin-artefacts.js +354 -0
- package/dist/lib/admin-artefacts.js.map +1 -0
- package/dist/lib/admin-surfaces.d.ts +298 -0
- package/dist/lib/admin-surfaces.d.ts.map +1 -0
- package/dist/lib/admin-surfaces.js +669 -0
- package/dist/lib/admin-surfaces.js.map +1 -0
- package/dist/lib/delegated-composer.d.ts +85 -0
- package/dist/lib/delegated-composer.d.ts.map +1 -0
- package/dist/lib/delegated-composer.js +241 -0
- package/dist/lib/delegated-composer.js.map +1 -0
- package/dist/lib/divergence-artefacts.d.ts +305 -0
- package/dist/lib/divergence-artefacts.d.ts.map +1 -0
- package/dist/lib/divergence-artefacts.js +828 -0
- package/dist/lib/divergence-artefacts.js.map +1 -0
- package/dist/lib/divergence.d.ts +337 -0
- package/dist/lib/divergence.d.ts.map +1 -0
- package/dist/lib/divergence.js +1005 -0
- package/dist/lib/divergence.js.map +1 -0
- package/dist/lib/docs-artefacts.d.ts +395 -0
- package/dist/lib/docs-artefacts.d.ts.map +1 -0
- package/dist/lib/docs-artefacts.js +781 -0
- package/dist/lib/docs-artefacts.js.map +1 -0
- package/dist/lib/emitted-exports.d.ts +21 -0
- package/dist/lib/emitted-exports.d.ts.map +1 -0
- package/dist/lib/emitted-exports.js +96 -0
- package/dist/lib/emitted-exports.js.map +1 -0
- package/dist/lib/emitted-freshness.d.ts +112 -0
- package/dist/lib/emitted-freshness.d.ts.map +1 -0
- package/dist/lib/emitted-freshness.js +288 -0
- package/dist/lib/emitted-freshness.js.map +1 -0
- package/dist/lib/entity-index-artefact.d.ts +95 -0
- package/dist/lib/entity-index-artefact.d.ts.map +1 -0
- package/dist/lib/entity-index-artefact.js +210 -0
- package/dist/lib/entity-index-artefact.js.map +1 -0
- package/dist/lib/instance-build-inputs.d.ts +108 -0
- package/dist/lib/instance-build-inputs.d.ts.map +1 -0
- package/dist/lib/instance-build-inputs.js +165 -0
- package/dist/lib/instance-build-inputs.js.map +1 -0
- package/dist/lib/module-docs.d.ts +473 -0
- package/dist/lib/module-docs.d.ts.map +1 -0
- package/dist/lib/module-docs.js +711 -0
- package/dist/lib/module-docs.js.map +1 -0
- package/dist/lib/module-package-subpaths.d.ts +56 -0
- package/dist/lib/module-package-subpaths.d.ts.map +1 -0
- package/dist/lib/module-package-subpaths.js +223 -0
- package/dist/lib/module-package-subpaths.js.map +1 -0
- package/dist/lib/module-packages.d.ts +200 -0
- package/dist/lib/module-packages.d.ts.map +1 -0
- package/dist/lib/module-packages.js +580 -0
- package/dist/lib/module-packages.js.map +1 -0
- package/dist/lib/module-population.d.ts +129 -0
- package/dist/lib/module-population.d.ts.map +1 -0
- package/dist/lib/module-population.js +172 -0
- package/dist/lib/module-population.js.map +1 -0
- package/dist/lib/module-roots.d.ts +337 -0
- package/dist/lib/module-roots.d.ts.map +1 -0
- package/dist/lib/module-roots.js +586 -0
- package/dist/lib/module-roots.js.map +1 -0
- package/dist/lib/nested-checkouts.d.ts +33 -0
- package/dist/lib/nested-checkouts.d.ts.map +1 -0
- package/dist/lib/nested-checkouts.js +160 -0
- package/dist/lib/nested-checkouts.js.map +1 -0
- package/dist/lib/platform-root.d.ts +43 -0
- package/dist/lib/platform-root.d.ts.map +1 -0
- package/dist/lib/platform-root.js +134 -0
- package/dist/lib/platform-root.js.map +1 -0
- package/dist/lib/platform-surface.d.ts +235 -0
- package/dist/lib/platform-surface.d.ts.map +1 -0
- package/dist/lib/platform-surface.js +393 -0
- package/dist/lib/platform-surface.js.map +1 -0
- package/dist/lib/port-registrations.d.ts +223 -0
- package/dist/lib/port-registrations.d.ts.map +1 -0
- package/dist/lib/port-registrations.js +532 -0
- package/dist/lib/port-registrations.js.map +1 -0
- package/dist/lib/read-size.d.ts +154 -0
- package/dist/lib/read-size.d.ts.map +1 -0
- package/dist/lib/read-size.js +182 -0
- package/dist/lib/read-size.js.map +1 -0
- package/dist/lib/registration-owners.d.ts +79 -0
- package/dist/lib/registration-owners.d.ts.map +1 -0
- package/dist/lib/registration-owners.js +77 -0
- package/dist/lib/registration-owners.js.map +1 -0
- package/dist/lib/release-index.d.ts +53 -0
- package/dist/lib/release-index.d.ts.map +1 -0
- package/dist/lib/release-index.js +162 -0
- package/dist/lib/release-index.js.map +1 -0
- package/dist/lib/repeating-timers.d.ts +79 -0
- package/dist/lib/repeating-timers.d.ts.map +1 -0
- package/dist/lib/repeating-timers.js +189 -0
- package/dist/lib/repeating-timers.js.map +1 -0
- package/dist/lib/source-text.d.ts +34 -0
- package/dist/lib/source-text.d.ts.map +1 -0
- package/dist/lib/source-text.js +80 -0
- package/dist/lib/source-text.js.map +1 -0
- package/dist/lib/specifiers.d.ts +20 -0
- package/dist/lib/specifiers.d.ts.map +1 -0
- package/dist/lib/specifiers.js +130 -0
- package/dist/lib/specifiers.js.map +1 -0
- package/dist/lib/sql-tables.d.ts +166 -0
- package/dist/lib/sql-tables.d.ts.map +1 -0
- package/dist/lib/sql-tables.js +464 -0
- package/dist/lib/sql-tables.js.map +1 -0
- package/dist/lib/switchable-modules.d.ts +54 -0
- package/dist/lib/switchable-modules.d.ts.map +1 -0
- package/dist/lib/switchable-modules.js +104 -0
- package/dist/lib/switchable-modules.js.map +1 -0
- package/dist/lib/tailwind-sources.d.ts +136 -0
- package/dist/lib/tailwind-sources.d.ts.map +1 -0
- package/dist/lib/tailwind-sources.js +307 -0
- package/dist/lib/tailwind-sources.js.map +1 -0
- package/dist/lib/ui-layer.d.ts +54 -0
- package/dist/lib/ui-layer.d.ts.map +1 -0
- package/dist/lib/ui-layer.js +57 -0
- package/dist/lib/ui-layer.js.map +1 -0
- package/dist/lib/workspace-packages.d.ts +186 -0
- package/dist/lib/workspace-packages.d.ts.map +1 -0
- package/dist/lib/workspace-packages.js +351 -0
- package/dist/lib/workspace-packages.js.map +1 -0
- package/dist/new-instance/deploy.d.ts +211 -0
- package/dist/new-instance/deploy.d.ts.map +1 -0
- package/dist/new-instance/deploy.js +1381 -0
- package/dist/new-instance/deploy.js.map +1 -0
- package/dist/new-instance/docs-toolchain.d.ts +66 -0
- package/dist/new-instance/docs-toolchain.d.ts.map +1 -0
- package/dist/new-instance/docs-toolchain.js +69 -0
- package/dist/new-instance/docs-toolchain.js.map +1 -0
- package/dist/new-instance/host.d.ts +124 -0
- package/dist/new-instance/host.d.ts.map +1 -0
- package/dist/new-instance/host.js +276 -0
- package/dist/new-instance/host.js.map +1 -0
- package/dist/new-instance/index.d.ts +118 -0
- package/dist/new-instance/index.d.ts.map +1 -0
- package/dist/new-instance/index.js +567 -0
- package/dist/new-instance/index.js.map +1 -0
- package/dist/new-instance/modules.d.ts +188 -0
- package/dist/new-instance/modules.d.ts.map +1 -0
- package/dist/new-instance/modules.js +392 -0
- package/dist/new-instance/modules.js.map +1 -0
- package/dist/new-instance/template.d.ts +505 -0
- package/dist/new-instance/template.d.ts.map +1 -0
- package/dist/new-instance/template.js +1886 -0
- package/dist/new-instance/template.js.map +1 -0
- package/dist/new-module/emit.d.ts +67 -0
- package/dist/new-module/emit.d.ts.map +1 -0
- package/dist/new-module/emit.js +1393 -0
- package/dist/new-module/emit.js.map +1 -0
- package/dist/new-module/host.d.ts +67 -0
- package/dist/new-module/host.d.ts.map +1 -0
- package/dist/new-module/host.js +224 -0
- package/dist/new-module/host.js.map +1 -0
- package/dist/new-module/index.d.ts +32 -0
- package/dist/new-module/index.d.ts.map +1 -0
- package/dist/new-module/index.js +193 -0
- package/dist/new-module/index.js.map +1 -0
- package/dist/new-module/spec.d.ts +188 -0
- package/dist/new-module/spec.d.ts.map +1 -0
- package/dist/new-module/spec.js +404 -0
- package/dist/new-module/spec.js.map +1 -0
- package/dist/new-module/text.d.ts +15 -0
- package/dist/new-module/text.d.ts.map +1 -0
- package/dist/new-module/text.js +22 -0
- package/dist/new-module/text.js.map +1 -0
- package/dist/new-storefront/dockerfile.d.ts +20 -0
- package/dist/new-storefront/dockerfile.d.ts.map +1 -0
- package/dist/new-storefront/dockerfile.js +131 -0
- package/dist/new-storefront/dockerfile.js.map +1 -0
- package/dist/new-storefront/gitignore.d.ts +23 -0
- package/dist/new-storefront/gitignore.d.ts.map +1 -0
- package/dist/new-storefront/gitignore.js +39 -0
- package/dist/new-storefront/gitignore.js.map +1 -0
- package/dist/new-storefront/index.d.ts +93 -0
- package/dist/new-storefront/index.d.ts.map +1 -0
- package/dist/new-storefront/index.js +329 -0
- package/dist/new-storefront/index.js.map +1 -0
- package/dist/new-storefront/npmrc.d.ts +98 -0
- package/dist/new-storefront/npmrc.d.ts.map +1 -0
- package/dist/new-storefront/npmrc.js +217 -0
- package/dist/new-storefront/npmrc.js.map +1 -0
- package/dist/new-storefront/reference.d.ts +189 -0
- package/dist/new-storefront/reference.d.ts.map +1 -0
- package/dist/new-storefront/reference.js +430 -0
- package/dist/new-storefront/reference.js.map +1 -0
- package/dist/new-storefront/rewrite.d.ts +171 -0
- package/dist/new-storefront/rewrite.d.ts.map +1 -0
- package/dist/new-storefront/rewrite.js +701 -0
- package/dist/new-storefront/rewrite.js.map +1 -0
- package/dist/release-index.json +284 -0
- package/dist/rules/action-route-permissions.d.ts +141 -0
- package/dist/rules/action-route-permissions.d.ts.map +1 -0
- package/dist/rules/action-route-permissions.js +556 -0
- package/dist/rules/action-route-permissions.js.map +1 -0
- package/dist/rules/bundle-pairing.d.ts +74 -0
- package/dist/rules/bundle-pairing.d.ts.map +1 -0
- package/dist/rules/bundle-pairing.js +281 -0
- package/dist/rules/bundle-pairing.js.map +1 -0
- package/dist/rules/channel-resolution.d.ts +17 -0
- package/dist/rules/channel-resolution.d.ts.map +1 -0
- package/dist/rules/channel-resolution.js +382 -0
- package/dist/rules/channel-resolution.js.map +1 -0
- package/dist/rules/command-coverage.d.ts +210 -0
- package/dist/rules/command-coverage.d.ts.map +1 -0
- package/dist/rules/command-coverage.js +714 -0
- package/dist/rules/command-coverage.js.map +1 -0
- package/dist/rules/container-imports.d.ts +60 -0
- package/dist/rules/container-imports.d.ts.map +1 -0
- package/dist/rules/container-imports.js +158 -0
- package/dist/rules/container-imports.js.map +1 -0
- package/dist/rules/default-language-prose.d.ts +212 -0
- package/dist/rules/default-language-prose.d.ts.map +1 -0
- package/dist/rules/default-language-prose.js +710 -0
- package/dist/rules/default-language-prose.js.map +1 -0
- package/dist/rules/diacritic-folds.d.ts +238 -0
- package/dist/rules/diacritic-folds.d.ts.map +1 -0
- package/dist/rules/diacritic-folds.js +681 -0
- package/dist/rules/diacritic-folds.js.map +1 -0
- package/dist/rules/entity-tenant-classification.d.ts +171 -0
- package/dist/rules/entity-tenant-classification.d.ts.map +1 -0
- package/dist/rules/entity-tenant-classification.js +323 -0
- package/dist/rules/entity-tenant-classification.js.map +1 -0
- package/dist/rules/entry-presence.d.ts +142 -0
- package/dist/rules/entry-presence.d.ts.map +1 -0
- package/dist/rules/entry-presence.js +339 -0
- package/dist/rules/entry-presence.js.map +1 -0
- package/dist/rules/entry-scope.d.ts +91 -0
- package/dist/rules/entry-scope.d.ts.map +1 -0
- package/dist/rules/entry-scope.js +404 -0
- package/dist/rules/entry-scope.js.map +1 -0
- package/dist/rules/env-inputs.d.ts +222 -0
- package/dist/rules/env-inputs.d.ts.map +1 -0
- package/dist/rules/env-inputs.js +951 -0
- package/dist/rules/env-inputs.js.map +1 -0
- package/dist/rules/kernel-boundary.d.ts +37 -0
- package/dist/rules/kernel-boundary.d.ts.map +1 -0
- package/dist/rules/kernel-boundary.js +195 -0
- package/dist/rules/kernel-boundary.js.map +1 -0
- package/dist/rules/nul-bytes.d.ts +233 -0
- package/dist/rules/nul-bytes.d.ts.map +1 -0
- package/dist/rules/nul-bytes.js +332 -0
- package/dist/rules/nul-bytes.js.map +1 -0
- package/dist/rules/platform-surface.d.ts +479 -0
- package/dist/rules/platform-surface.d.ts.map +1 -0
- package/dist/rules/platform-surface.js +749 -0
- package/dist/rules/platform-surface.js.map +1 -0
- package/dist/rules/port-catches.d.ts +225 -0
- package/dist/rules/port-catches.d.ts.map +1 -0
- package/dist/rules/port-catches.js +1374 -0
- package/dist/rules/port-catches.js.map +1 -0
- package/dist/rules/port-shape.d.ts +213 -0
- package/dist/rules/port-shape.d.ts.map +1 -0
- package/dist/rules/port-shape.js +670 -0
- package/dist/rules/port-shape.js.map +1 -0
- package/dist/rules/queue-names.d.ts +108 -0
- package/dist/rules/queue-names.d.ts.map +1 -0
- package/dist/rules/queue-names.js +395 -0
- package/dist/rules/queue-names.js.map +1 -0
- package/dist/rules/singleton-identity.d.ts +205 -0
- package/dist/rules/singleton-identity.d.ts.map +1 -0
- package/dist/rules/singleton-identity.js +830 -0
- package/dist/rules/singleton-identity.js.map +1 -0
- package/dist/rules/subscribe-seam.d.ts +121 -0
- package/dist/rules/subscribe-seam.d.ts.map +1 -0
- package/dist/rules/subscribe-seam.js +594 -0
- package/dist/rules/subscribe-seam.js.map +1 -0
- package/dist/rules/transaction-context.d.ts +40 -0
- package/dist/rules/transaction-context.d.ts.map +1 -0
- package/dist/rules/transaction-context.js +294 -0
- package/dist/rules/transaction-context.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "What does the platform publish?" — one derivation, read out of the barrels
|
|
3
|
+
* (feature 080, T042d; D-160.8).
|
|
4
|
+
*
|
|
5
|
+
* ## Why the barrel and not a list
|
|
6
|
+
*
|
|
7
|
+
* `specs/080-f4-real-scope/contracts/host-package.md` §1.3 classifies every
|
|
8
|
+
* platform file a module reaches as **P** (published API), **A** (accidental
|
|
9
|
+
* reach) or **O** (the module is reaching for a class where a port exists).
|
|
10
|
+
* §2.1 turns that classification into an `exports` map with five enumerated
|
|
11
|
+
* subpaths, one per publishable directory, each resolving to that directory's
|
|
12
|
+
* barrel (D-160.7). So the barrel *is* the classification, expressed as source
|
|
13
|
+
* the compiler reads rather than as prose.
|
|
14
|
+
*
|
|
15
|
+
* Two consumers need that answer and they must never be able to disagree:
|
|
16
|
+
*
|
|
17
|
+
* * `test/unit/kernel/published-surface.test.ts` holds each barrel to §1.3's
|
|
18
|
+
* symbol column, in both directions (MR !883);
|
|
19
|
+
* * `scripts/check-platform-surface.ts` refuses a module reach into a
|
|
20
|
+
* platform symbol the barrel does not carry.
|
|
21
|
+
*
|
|
22
|
+
* Before this file the first of them parsed the barrel with a regular
|
|
23
|
+
* expression of its own. A second, independently written parse in the check
|
|
24
|
+
* would be two answers to "what does `kernel/index.ts` export" — and the shape
|
|
25
|
+
* one of them forgot would be the shape the next unpublished reach travelled
|
|
26
|
+
* through. There is one parse, it is the TypeScript compiler's, and both read
|
|
27
|
+
* it.
|
|
28
|
+
*
|
|
29
|
+
* ## What a barrel says, and the two things it says
|
|
30
|
+
*
|
|
31
|
+
* A published re-export carries **a name and the file it came from**:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* export { HttpError } from './error-envelope.js';
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* — publishes `HttpError`, and publishes it *of* `http/error-envelope.ts`. Both
|
|
38
|
+
* halves matter. §1.3's verdict is per file and its symbol column is per
|
|
39
|
+
* symbol, and !883 found the gap materially: sixteen symbols of **P** files are
|
|
40
|
+
* reached by nobody and are deliberately not published, so "the file is P" does
|
|
41
|
+
* not license every export of it. Keying the answer on the pair is what lets a
|
|
42
|
+
* consumer ask the question the classification actually answers — *may this
|
|
43
|
+
* module take **this symbol** of **that file***.
|
|
44
|
+
*
|
|
45
|
+
* ## Which directories are published, and why that is declared here
|
|
46
|
+
*
|
|
47
|
+
* {@link PUBLISHED_SUBPATHS} is the one thing in this file that is written down
|
|
48
|
+
* rather than derived, and it is a **ruling** (D-160.7) rather than a fact about
|
|
49
|
+
* the tree: five enumerated subpaths, no root export, no wildcard, with `db`,
|
|
50
|
+
* `overlay` and `packages` deliberately unpublishable (§1.4f, §1.4l). It cannot
|
|
51
|
+
* be derived from "a directory with an `index.ts`", because the platform's own
|
|
52
|
+
* `db/index.ts` exists and is the single hardest **A** in the contract —
|
|
53
|
+
* publishing it would make the host import all 219 module-owned entity
|
|
54
|
+
* references.
|
|
55
|
+
*
|
|
56
|
+
* It stops being written down the day the host `package.json` exists: its
|
|
57
|
+
* `exports` map is the same five subpaths, authored once, and this constant is
|
|
58
|
+
* replaced by a read of it. Until then every *consequence* of the list is
|
|
59
|
+
* derived — which symbols, of which files, and what a reach into a directory
|
|
60
|
+
* that is not on it means — and a directory named here whose barrel is missing
|
|
61
|
+
* or empty is an error rather than a silently narrower surface.
|
|
62
|
+
*/
|
|
63
|
+
import { posix } from 'node:path';
|
|
64
|
+
import ts from 'typescript';
|
|
65
|
+
/**
|
|
66
|
+
* The platform directories the host publishes, in the order §2.1 lists them.
|
|
67
|
+
*
|
|
68
|
+
* A ruling (D-160.7), not a measurement — see the header. `db`, `overlay` and
|
|
69
|
+
* `packages` are absent on purpose and `db`'s absence is the whole of §1.4f: a
|
|
70
|
+
* reach into it is not public API. All three are now **declared and
|
|
71
|
+
* host-internal** (`specs/110-instance-repository/` T113, T114 and T116): the
|
|
72
|
+
* code moved into the package, so the application needed an address for it, and
|
|
73
|
+
* the answer to "may a module name it" is still no — see
|
|
74
|
+
* {@link HOST_INTERNAL_SUBPATHS}, which is where that judgement is recorded.
|
|
75
|
+
*/
|
|
76
|
+
export const PUBLISHED_SUBPATHS = [
|
|
77
|
+
'kernel',
|
|
78
|
+
'http',
|
|
79
|
+
'tenancy',
|
|
80
|
+
'commands',
|
|
81
|
+
'events',
|
|
82
|
+
];
|
|
83
|
+
/**
|
|
84
|
+
* The subpaths the `exports` map declares and **no published barrel carries**
|
|
85
|
+
* (D-160.14), each with the reason it is on this side of the line.
|
|
86
|
+
*
|
|
87
|
+
* A subpath here is declared, so `node` and `tsc` resolve it for the host, the
|
|
88
|
+
* test kit and the composition root — and it is not public API, so
|
|
89
|
+
* {@link resolveHostSpecifier} answers a module's reach into one with
|
|
90
|
+
* `host-internal-subpath` rather than with a pass. **The reason is the member**:
|
|
91
|
+
* a set of bare names is a list somebody grows, and this whole class is a
|
|
92
|
+
* judgement about who may name a surface, which no name records.
|
|
93
|
+
*
|
|
94
|
+
* It is kept apart from {@link PUBLISHED_SUBPATHS} rather than appended to it
|
|
95
|
+
* because the two answer different questions, and `host-package.md` §2.7.5(a) is
|
|
96
|
+
* that merging them is the mistake: the published list is what a **symbol** is
|
|
97
|
+
* judged against, and an entry there would publish `composeModules` out of
|
|
98
|
+
* `kernel/compose.ts` for every reach at that file — a module's relative one
|
|
99
|
+
* included — while changing nothing `check:platform-surface` prints.
|
|
100
|
+
*
|
|
101
|
+
* It lives here rather than in a test because by the time it had two members it
|
|
102
|
+
* had two copies, in two test files, neither carrying a per-member reason. Two
|
|
103
|
+
* independently written answers to "which subpaths are host-internal" are two
|
|
104
|
+
* answers waiting to disagree, in the estate whose own rule that is (D-100).
|
|
105
|
+
*/
|
|
106
|
+
export const HOST_INTERNAL_SUBPATHS = {
|
|
107
|
+
composition: 'the host composition surface (D-160.14, feature 109 T010): the symbols a composition ' +
|
|
108
|
+
'root needs — build the server, open the container, register the ORM, compose the ' +
|
|
109
|
+
'sub-kernels, prime the registry cache, establish a tenant context. Reachable by a ' +
|
|
110
|
+
'package that is not a module and nameable by no module at all, because a module that ' +
|
|
111
|
+
'could name it could compose the platform that composes it.',
|
|
112
|
+
db: 'the ORM configuration, the migration ordering and the bootstrap ' +
|
|
113
|
+
'(`specs/110-instance-repository/` T116, FR-013): the naming strategy Principle VI is ' +
|
|
114
|
+
'enforced by, the order a migration corpus runs in, the two merges that fold an ' +
|
|
115
|
+
"installed package's entities and migrations into the committed core ones, the cached " +
|
|
116
|
+
"`MikroORM` bootstrap and the four migration verbs. Host-internal for `./composition`'s " +
|
|
117
|
+
'own reason one surface over: this is the code that decides which entity classes the ORM ' +
|
|
118
|
+
'registers and which migrations run at all, so a module that could name it could ' +
|
|
119
|
+
"configure — and eventually re-order — its siblings' schema. A module reaches its own " +
|
|
120
|
+
'schema through its own `./migrations` subpath and its entities through `./backend`, and ' +
|
|
121
|
+
'the committed registries it is configured over stay the host\'s (R7.4).',
|
|
122
|
+
migrations: 'the frozen historical prefix an execution order is computed from ' +
|
|
123
|
+
'(`specs/110-instance-repository/contracts/instance-migration-order.md` R1.5). It is the ' +
|
|
124
|
+
"platform's own claim about its schema history, which a client receives by installing " +
|
|
125
|
+
'the platform and corrects by `pnpm update` — never by writing a migration into it.',
|
|
126
|
+
lifecycle: "`_lifecycle`'s operator surface (D115-4, `specs/115-lifecycle-container-move/`): the " +
|
|
127
|
+
'orchestrator, the dependency and gating graphs, the lifecycle lock, the manifest loader ' +
|
|
128
|
+
"and the module plugin. Host-internal for `./composition`'s own reason — this surface " +
|
|
129
|
+
'*drives* the presence axis, so a module that could name it could install, uninstall, ' +
|
|
130
|
+
'enable or disable its siblings. D-160.11 refused to **publish** `_lifecycle`, and that ' +
|
|
131
|
+
'is an argument against publishing a surface rather than against giving it an address: ' +
|
|
132
|
+
'without one the application reaches it by relative path into ' +
|
|
133
|
+
"`packages/platform/dist/`, which resolves in this checkout and in no client's.",
|
|
134
|
+
env: 'the environment-input declaration (feature 117, FR-001): the inputs the host and the ' +
|
|
135
|
+
'platform read, with what each configures, whether it is required and what is lost ' +
|
|
136
|
+
'without it. Its readers are the scaffolding commands, `endora doctor` and the ' +
|
|
137
|
+
"reconciliation check \u2014 none of them a module. Host-internal for `./composition`'s own " +
|
|
138
|
+
'reason, one surface over: a module declares its **own** inputs in its manifest, so a ' +
|
|
139
|
+
'module that could name this one could read, and would eventually copy, a population it ' +
|
|
140
|
+
'does not own. The shape it is written in is public API and lives in ' +
|
|
141
|
+
'`@endora-commerce/contracts`, which is where a module takes it from.',
|
|
142
|
+
packages: 'installed extension-package discovery (`specs/110-instance-repository/` T113, FR-013): the ' +
|
|
143
|
+
'`node_modules` scan, the classification that tells a tarball install from a workspace link, ' +
|
|
144
|
+
'and the manifest, `ModuleEntry` and schema readers a composition root appends to its one ' +
|
|
145
|
+
"`composeModules` call. Host-internal for `./composition`'s own reason one surface over — this " +
|
|
146
|
+
'is the code that decides which packages are composed at all, so a module that could name it ' +
|
|
147
|
+
'could enumerate, and eventually judge, its siblings. What it finds is merged into the ORM ' +
|
|
148
|
+
"configuration by the host, which is where a module's own schema reaches it from.",
|
|
149
|
+
overlay: "the loader that composes a deployment's client-only modules " +
|
|
150
|
+
'(`specs/110-instance-repository/` T114, FR-013): the listing of an overlay root, the ' +
|
|
151
|
+
'unit resolution a compiled tree needs, the id-collision seam both overlay readers go ' +
|
|
152
|
+
'through, and the two loaders a composition root appends to its core list. ' +
|
|
153
|
+
"Host-internal for `./composition`'s own reason — an overlay module is the deployment's " +
|
|
154
|
+
'answer to customising without forking, and the loader that composes one decides which ' +
|
|
155
|
+
'modules a deployment runs at all. It derives no path: the overlay root and the claims ' +
|
|
156
|
+
'already made on a module id are parameters the application supplies.',
|
|
157
|
+
cli: "the host's side of a module-declared operator command " +
|
|
158
|
+
'(`specs/110-instance-repository/` T117, FR-013): the enumeration of every command the ' +
|
|
159
|
+
'resolved manifest set declares, the two refusals a declaration can earn, the ' +
|
|
160
|
+
'`<module id> <command name>` lookup, the `--list` and `--help` renderings, and the ' +
|
|
161
|
+
"find-gate-invoke that ends in the module's own `run`. Host-internal for " +
|
|
162
|
+
"`./composition`'s own reason one surface over: this is the code that decides which " +
|
|
163
|
+
'command runs and whether the module that declared it is present at all, so a module ' +
|
|
164
|
+
"that could name it could enumerate its siblings' operator commands and invoke one. A " +
|
|
165
|
+
'module declares its commands in its own `manifest.ts` and receives a `ModuleContext`; ' +
|
|
166
|
+
'that is the whole of the surface it is entitled to. The process around it — argv, the ' +
|
|
167
|
+
'demo verbs, the system scope over the composed container and the exit code — joined it ' +
|
|
168
|
+
'with `specs/123-oss-install-experience/` G2, because a scaffolded instance needs the same ' +
|
|
169
|
+
'one and rendering ~170 lines of it into a client tree is the copy R7.1 refuses. What ' +
|
|
170
|
+
'stays in an application is what names a path in the tree that installs the platform: its ' +
|
|
171
|
+
'generated core index, its own `composeApp`, its demo-composition probe and the directory ' +
|
|
172
|
+
'holding `apps/` — four parameters of `runCli`, three of them with defaults an instance ' +
|
|
173
|
+
'takes, which is why the file `endora new instance` renders is five lines.',
|
|
174
|
+
demo: 'the demo-data layer (feature 113 Phase 0, D-209; `specs/110-instance-repository/` T119b): ' +
|
|
175
|
+
'the production refusal, the scope reasons a demo run carries, the plan of which modules ' +
|
|
176
|
+
'contribute and in what order, the runner and the report an operator reads. It is the one ' +
|
|
177
|
+
'platform directory that had a barrel and no address at all, so five application consumers ' +
|
|
178
|
+
'reached it by relative path into `packages/platform/dist/`, which resolves in this ' +
|
|
179
|
+
"checkout and in no client's — and a demo an instance cannot run is the whole problem that " +
|
|
180
|
+
"feature exists for. Host-internal for `./composition`'s own reason: a module *declares* " +
|
|
181
|
+
'its demo data through `@endora-commerce/contracts` and never names the runner, while the ' +
|
|
182
|
+
'thing that runs one has already composed the platform, so a module that could name this ' +
|
|
183
|
+
"could seed — and reset — its siblings' data. What the barrel carries is a consequence " +
|
|
184
|
+
'rather than a ruling, so it is held to its consumers and not to a written table.',
|
|
185
|
+
};
|
|
186
|
+
/** The file a published directory's surface is written in. */
|
|
187
|
+
export function barrelKeyOf(subpath) {
|
|
188
|
+
return posix.join(subpath, 'index.ts');
|
|
189
|
+
}
|
|
190
|
+
/** The `.js` → `.ts` rewrite, with no filesystem behind it. */
|
|
191
|
+
export const firstCandidate = (fromKey, specifier) => {
|
|
192
|
+
const joined = resolveRelative(fromKey, specifier);
|
|
193
|
+
if (joined === null)
|
|
194
|
+
return null;
|
|
195
|
+
return resolutionCandidates(joined)[0] ?? null;
|
|
196
|
+
};
|
|
197
|
+
/** The exported name of one `export { … }` element, after any `as` rename. */
|
|
198
|
+
function exportedName(element) {
|
|
199
|
+
return element.name.text;
|
|
200
|
+
}
|
|
201
|
+
/** Names a statement exports by declaring them, or `[]`. */
|
|
202
|
+
function locallyExportedNames(node) {
|
|
203
|
+
const modifiers = ts.canHaveModifiers(node) ? (ts.getModifiers(node) ?? []) : [];
|
|
204
|
+
if (!modifiers.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword))
|
|
205
|
+
return [];
|
|
206
|
+
if (ts.isVariableStatement(node)) {
|
|
207
|
+
return node.declarationList.declarations.flatMap((declaration) => ts.isIdentifier(declaration.name) ? [declaration.name.text] : []);
|
|
208
|
+
}
|
|
209
|
+
if ((ts.isFunctionDeclaration(node) ||
|
|
210
|
+
ts.isClassDeclaration(node) ||
|
|
211
|
+
ts.isEnumDeclaration(node)) &&
|
|
212
|
+
node.name !== undefined) {
|
|
213
|
+
return [node.name.text];
|
|
214
|
+
}
|
|
215
|
+
if (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) {
|
|
216
|
+
return [node.name.text];
|
|
217
|
+
}
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Everything one barrel publishes, and everything about it this parse could not
|
|
222
|
+
* read.
|
|
223
|
+
*
|
|
224
|
+
* Pure over the source text, so both consumers — and every fixture — enter
|
|
225
|
+
* where a real run enters.
|
|
226
|
+
*
|
|
227
|
+
* The three shapes it refuses to guess at are the three that would make the
|
|
228
|
+
* published set come back **short**, which is the direction that turns a
|
|
229
|
+
* correct reach into a finding and, worse, lets an author "repair" it by
|
|
230
|
+
* widening the barrel:
|
|
231
|
+
*
|
|
232
|
+
* * `export * from './x.js'` — the names are in another file;
|
|
233
|
+
* * `export * as ns from './x.js'` — a namespace object, whose members no
|
|
234
|
+
* `exports` map can enumerate;
|
|
235
|
+
* * `export { X }` with no `from` — a re-export of a local binding whose own
|
|
236
|
+
* origin this parse does not follow.
|
|
237
|
+
*
|
|
238
|
+
* None of the three occurs in the five barrels today. Each is reported rather
|
|
239
|
+
* than skipped, because a barrel this file reads *partially* is exactly the
|
|
240
|
+
* "green while not looking" shape issue #113 is about.
|
|
241
|
+
*/
|
|
242
|
+
export function parseBarrel(source, barrel, resolve = firstCandidate) {
|
|
243
|
+
const sf = ts.createSourceFile(barrel, source, ts.ScriptTarget.Latest, true);
|
|
244
|
+
const published = [];
|
|
245
|
+
const unreadable = [];
|
|
246
|
+
const lineOf = (node) => sf.getLineAndCharacterOfPosition(node.getStart(sf)).line + 1;
|
|
247
|
+
sf.forEachChild((node) => {
|
|
248
|
+
if (ts.isExportDeclaration(node)) {
|
|
249
|
+
const specifier = node.moduleSpecifier;
|
|
250
|
+
if (specifier === undefined || !ts.isStringLiteral(specifier)) {
|
|
251
|
+
unreadable.push({
|
|
252
|
+
barrel,
|
|
253
|
+
line: lineOf(node),
|
|
254
|
+
reason: '`export { … }` with no `from` — the names are re-exports of local bindings ' +
|
|
255
|
+
'whose origin this parse does not follow',
|
|
256
|
+
});
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const target = resolve(barrel, specifier.text);
|
|
260
|
+
if (node.exportClause === undefined) {
|
|
261
|
+
unreadable.push({
|
|
262
|
+
barrel,
|
|
263
|
+
line: lineOf(node),
|
|
264
|
+
reason: `\`export * from '${specifier.text}'\` — the published names are in another file`,
|
|
265
|
+
});
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (ts.isNamespaceExport(node.exportClause)) {
|
|
269
|
+
unreadable.push({
|
|
270
|
+
barrel,
|
|
271
|
+
line: lineOf(node),
|
|
272
|
+
reason: `\`export * as ${node.exportClause.name.text} from '${specifier.text}'\` — a ` +
|
|
273
|
+
'namespace object, whose members no `exports` map can enumerate',
|
|
274
|
+
});
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
for (const element of node.exportClause.elements) {
|
|
278
|
+
published.push({ name: exportedName(element), target: target ?? barrel });
|
|
279
|
+
}
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
for (const name of locallyExportedNames(node))
|
|
283
|
+
published.push({ name, target: barrel });
|
|
284
|
+
});
|
|
285
|
+
return { barrel, published, unreadable };
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* A relative specifier from `fromKey`, as a key relative to the same root.
|
|
289
|
+
*
|
|
290
|
+
* The `.js` an ESM specifier carries is rewritten to `.ts`, an extensionless
|
|
291
|
+
* specifier gains one, and a directory specifier gains `/index.ts` — the three
|
|
292
|
+
* shapes this tree writes. `null` for a specifier that is not relative, or that
|
|
293
|
+
* climbs out of the root.
|
|
294
|
+
*/
|
|
295
|
+
export function resolveRelative(fromKey, specifier) {
|
|
296
|
+
if (!specifier.startsWith('.'))
|
|
297
|
+
return null;
|
|
298
|
+
const joined = posix.normalize(posix.join(posix.dirname(fromKey), specifier));
|
|
299
|
+
if (joined.startsWith('..'))
|
|
300
|
+
return null;
|
|
301
|
+
return joined;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The host file a bare specifier names, or `null` when it does not name the
|
|
305
|
+
* host at all.
|
|
306
|
+
*
|
|
307
|
+
* The match is on a **segment boundary**, which is the same care
|
|
308
|
+
* `check-module-boundary`'s `resolveModulePackage` takes and for the same
|
|
309
|
+
* reason: `@endora-commerce/platform-extras` is a different package, and a bare
|
|
310
|
+
* `startsWith` reads it as this one.
|
|
311
|
+
*
|
|
312
|
+
* `null` for a relative specifier, for a third party's, and for every specifier
|
|
313
|
+
* at all when the workspace declares no platform — a fixture workspace
|
|
314
|
+
* legitimately has none, and "no host reach" is the only honest answer there.
|
|
315
|
+
*
|
|
316
|
+
* **Three answers, not two** (D-160.14). A subpath the `exports` map declares
|
|
317
|
+
* and no barrel carries is `host-internal-subpath`, between the published one
|
|
318
|
+
* and the one that does not exist. Collapsing it into either is wrong in a
|
|
319
|
+
* different way: as *published* it would license the reach, and as *undeclared*
|
|
320
|
+
* it would tell the author their specifier does not resolve, which it does.
|
|
321
|
+
*/
|
|
322
|
+
export function resolveHostSpecifier(specifier, host) {
|
|
323
|
+
if (host === null || specifier.startsWith('.'))
|
|
324
|
+
return null;
|
|
325
|
+
if (specifier !== host.name && !specifier.startsWith(`${host.name}/`))
|
|
326
|
+
return null;
|
|
327
|
+
const subpath = specifier.slice(host.name.length).replace(/^\//, '');
|
|
328
|
+
const target = host.subpathTargets.get(subpath);
|
|
329
|
+
if (target !== undefined)
|
|
330
|
+
return { kind: 'published-subpath', subpath, target };
|
|
331
|
+
if (host.declaredSubpaths.has(subpath))
|
|
332
|
+
return { kind: 'host-internal-subpath', subpath };
|
|
333
|
+
return { kind: 'undeclared-subpath', subpath };
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Every candidate file a relative specifier could name, most specific first.
|
|
337
|
+
*
|
|
338
|
+
* `.tsx` is here beside `.ts` because a module's sources are no longer only
|
|
339
|
+
* Node code: a module package's `./admin` layer (feature 091) is React
|
|
340
|
+
* components, and a `./pages/Screen.js` specifier inside one resolves to a
|
|
341
|
+
* `.tsx` file or to nothing. Nothing is the fail-closed answer this check gives
|
|
342
|
+
* an unresolvable reach — correct as a default, and wrong here, where the file
|
|
343
|
+
* is there and the candidate list had never heard of its extension.
|
|
344
|
+
*/
|
|
345
|
+
export function resolutionCandidates(joined) {
|
|
346
|
+
const stem = joined.endsWith('.js') ? joined.slice(0, -'.js'.length) : null;
|
|
347
|
+
const candidates = [
|
|
348
|
+
stem === null ? null : `${stem}.ts`,
|
|
349
|
+
stem === null ? null : `${stem}.tsx`,
|
|
350
|
+
joined.endsWith('.ts') || joined.endsWith('.tsx') ? joined : null,
|
|
351
|
+
`${joined}.ts`,
|
|
352
|
+
`${joined}.tsx`,
|
|
353
|
+
posix.join(joined, 'index.ts'),
|
|
354
|
+
posix.join(joined, 'index.tsx'),
|
|
355
|
+
];
|
|
356
|
+
return candidates.filter((candidate) => candidate !== null);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* The surface, from the barrel sources.
|
|
360
|
+
*
|
|
361
|
+
* `barrels` is keyed by the barrel's own path relative to the source root, so a
|
|
362
|
+
* caller that hands in fewer than {@link PUBLISHED_SUBPATHS} gets a surface that
|
|
363
|
+
* says so through {@link PlatformSurface.barrelsWithExports} rather than a
|
|
364
|
+
* quietly narrower answer.
|
|
365
|
+
*/
|
|
366
|
+
export function publishedSurface(barrels, resolve = firstCandidate) {
|
|
367
|
+
const published = new Map();
|
|
368
|
+
const publishedBy = new Map();
|
|
369
|
+
const unreadable = [];
|
|
370
|
+
let barrelsWithExports = 0;
|
|
371
|
+
for (const [barrel, source] of barrels) {
|
|
372
|
+
const parsed = parseBarrel(source, barrel, resolve);
|
|
373
|
+
unreadable.push(...parsed.unreadable);
|
|
374
|
+
if (parsed.published.length > 0)
|
|
375
|
+
barrelsWithExports += 1;
|
|
376
|
+
for (const symbol of parsed.published) {
|
|
377
|
+
const names = published.get(symbol.target) ?? new Set();
|
|
378
|
+
names.add(symbol.name);
|
|
379
|
+
published.set(symbol.target, names);
|
|
380
|
+
const carriers = publishedBy.get(symbol.target) ?? new Set();
|
|
381
|
+
carriers.add(barrel);
|
|
382
|
+
publishedBy.set(symbol.target, carriers);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
published,
|
|
387
|
+
publishedBy,
|
|
388
|
+
barrels: new Set(barrels.keys()),
|
|
389
|
+
unreadable,
|
|
390
|
+
barrelsWithExports,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=platform-surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-surface.js","sourceRoot":"","sources":["../../src/lib/platform-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,QAAQ;IACR,MAAM;IACN,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAqC;IACtE,WAAW,EACT,uFAAuF;QACvF,mFAAmF;QACnF,oFAAoF;QACpF,uFAAuF;QACvF,4DAA4D;IAC9D,EAAE,EACA,kEAAkE;QAClE,uFAAuF;QACvF,iFAAiF;QACjF,uFAAuF;QACvF,yFAAyF;QACzF,0FAA0F;QAC1F,kFAAkF;QAClF,uFAAuF;QACvF,0FAA0F;QAC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AAK,MAAM,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;YAChE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACvB,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;YACrE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrB,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO;QACL,SAAS;QACT,WAAW;QACX,OAAO,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAChC,UAAU;QACV,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container registrations and port resolutions, read out of TypeScript sources
|
|
3
|
+
* through the compiler API.
|
|
4
|
+
*
|
|
5
|
+
* `check:port-dependencies` and `check:port-shape` both have to answer the same
|
|
6
|
+
* three questions of a module's sources — *which names does it register*, *which
|
|
7
|
+
* ports does it provide* and *which names does it resolve* — and one of those two
|
|
8
|
+
* rules now has two hosts (`specs/101-endora-check/contracts/package-scope-layout.md`
|
|
9
|
+
* §6: `backend/scripts/check-port-shape.ts` over this repository, `endora check`
|
|
10
|
+
* over one module package). A predicate three callers share has to live where
|
|
11
|
+
* all three can reach it, which is the package.
|
|
12
|
+
*
|
|
13
|
+
* Everything here is **syntactic only**, deliberately. Whether a name is owned,
|
|
14
|
+
* whether an edge is declared and whether a capture is allowed are questions
|
|
15
|
+
* about a *composition*, and they stay with the checks that know what a
|
|
16
|
+
* composition is: this file says only what a source text spells.
|
|
17
|
+
*
|
|
18
|
+
* Attribution keys on `/src/apps/<deployment>/modules/<id>/`, then on
|
|
19
|
+
* `/src/modules/<id>/`, then on `lib/module-population.ts`' `moduleIdOf` — the
|
|
20
|
+
* same segment reader the population floor uses, with the `hostResident` map for
|
|
21
|
+
* a module whose sources the host owns. A file the walk reads and cannot name is
|
|
22
|
+
* a file every consumer here judges as nobody's and reports clean about, which
|
|
23
|
+
* is issue #215's failure one layer in.
|
|
24
|
+
*/
|
|
25
|
+
import ts from 'typescript';
|
|
26
|
+
import { type HostResidentModules } from './module-population.js';
|
|
27
|
+
/**
|
|
28
|
+
* Stand-in recorded when a `lazyPort` name is not a string literal. It is owned
|
|
29
|
+
* by nobody on purpose, so it surfaces as an `unowned-name` violation naming the
|
|
30
|
+
* file and line — the same way a genuinely unregistered name does.
|
|
31
|
+
*/
|
|
32
|
+
export declare const NON_LITERAL_PORT_NAME = "<computed>";
|
|
33
|
+
/**
|
|
34
|
+
* *When* a resolution happens, which is what the gated-port rule below keys on
|
|
35
|
+
* (feature 072, D-39).
|
|
36
|
+
*
|
|
37
|
+
* `kind` answers "once or per call"; this answers "before or after the platform
|
|
38
|
+
* serves its first request". They are independent — a boot-hook read is
|
|
39
|
+
* genuinely deferred and still fatal — and only this one sees the failure that
|
|
40
|
+
* took the backend down twice:
|
|
41
|
+
*
|
|
42
|
+
* - `boot` — lexically inside a `ctx.onBoot` hook. `runBootHooks()` does not
|
|
43
|
+
* consult module presence, so the hook runs whatever the module's effective
|
|
44
|
+
* state is.
|
|
45
|
+
* - `wiring` — the body of the `ctx.routes` callback itself. It runs inside
|
|
46
|
+
* `buildServer`, unconditionally: `defineModuleRoutes` gates *requests*, not
|
|
47
|
+
* the registration. A read inside a handler is not this — that is `call`.
|
|
48
|
+
* - `call` — everything else: a request handler, a subscriber, a worker
|
|
49
|
+
* processor, a method on a service.
|
|
50
|
+
*/
|
|
51
|
+
export type ResolutionSite = 'boot' | 'wiring' | 'call';
|
|
52
|
+
export interface PortResolution {
|
|
53
|
+
readonly moduleId: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly file: string;
|
|
56
|
+
readonly line: number;
|
|
57
|
+
/**
|
|
58
|
+
* How the name is read, which is the whole point of the capture rule below.
|
|
59
|
+
*
|
|
60
|
+
* - `captured` — destructured from a factory's cradle parameter, so Awilix
|
|
61
|
+
* resolves it once, when the registration is first constructed.
|
|
62
|
+
* - `deferred` — read through `ctx.cradle<C>()`, so it resolves at the
|
|
63
|
+
* moment of use.
|
|
64
|
+
*/
|
|
65
|
+
readonly kind: 'captured' | 'deferred';
|
|
66
|
+
/** See {@link ResolutionSite}. */
|
|
67
|
+
readonly site: ResolutionSite;
|
|
68
|
+
/**
|
|
69
|
+
* **Which seam the name was written into**, which is a different question
|
|
70
|
+
* from `kind` and from `site` and is the one `check-port-shape`'s third
|
|
71
|
+
* signal keys on (issue #196, D-98.2).
|
|
72
|
+
*
|
|
73
|
+
* - `lazyPort` — `lazyPort<T>(ctx, 'name')`, the shape a module uses to
|
|
74
|
+
* reach a *published* port. The name is a literal a developer copied out
|
|
75
|
+
* of a contract's doc block, which is exactly why it is checkable against
|
|
76
|
+
* one.
|
|
77
|
+
* - `cradle` — every other shape this function reads: a factory's cradle
|
|
78
|
+
* parameter, `ctx.cradle<C>()`, a module-local alias of either. Those are
|
|
79
|
+
* **contribution seams**, where a module reads a name a composition root
|
|
80
|
+
* or the kernel supplies, and where naming a published contract would be
|
|
81
|
+
* the wrong requirement — four of the five names the two populations
|
|
82
|
+
* disagree on are of that kind.
|
|
83
|
+
*
|
|
84
|
+
* Recorded here rather than re-derived by the consumer so that "this
|
|
85
|
+
* resolution is a `lazyPort`" is decided in the one place that already
|
|
86
|
+
* decides it. A predicate that exists twice can go half-missing while the
|
|
87
|
+
* check still prints `violations=0`.
|
|
88
|
+
*/
|
|
89
|
+
readonly via: 'lazyPort' | 'cradle';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The owning module id of a source file, over every root a module can live in.
|
|
93
|
+
*
|
|
94
|
+
* Three shapes, in order. The two anchored regexes answer for the application's
|
|
95
|
+
* own trees — a deployment overlay first, then the core module tree — and both
|
|
96
|
+
* key on `/src/`, so they say nothing about a module that has become a
|
|
97
|
+
* **package** (feature 080, T040a). The third is `lib/module-population.ts`'
|
|
98
|
+
* `moduleIdOf`, the same segment reader the population floor uses, and it is
|
|
99
|
+
* what makes a path like `packages/modules/blog/src/services/x.ts` attribute to
|
|
100
|
+
* `blog` instead of to nobody.
|
|
101
|
+
*
|
|
102
|
+
* That fallback is not cosmetic. Without it a package's files are read by the
|
|
103
|
+
* walk, satisfy the floor, and are then attributed to `null` — which for every
|
|
104
|
+
* consumer here means *not a module*, so the check judges none of them and
|
|
105
|
+
* reports clean. That is issue #215's failure one layer in, and it is why
|
|
106
|
+
* `resolveModuleLayout` refuses a package root whose location the segment
|
|
107
|
+
* reader cannot attribute rather than letting it through unnamed.
|
|
108
|
+
*
|
|
109
|
+
* The fourth answer is `hostResident`, the map the layout derives from the
|
|
110
|
+
* manifest index for a module whose sources the host owns and whose directory
|
|
111
|
+
* therefore carries no `modules/<id>/` segment (feature 080, T040b). It is
|
|
112
|
+
* threaded from `main` rather than left to default, for exactly the reason the
|
|
113
|
+
* third shape exists: a file the walk reads and cannot name is a file this
|
|
114
|
+
* check judges as nobody's and reports clean about.
|
|
115
|
+
*/
|
|
116
|
+
export declare function moduleOf(file: string, hostResident?: HostResidentModules): string | null;
|
|
117
|
+
/** `ctx.di.register` → `di.register`; used to match on the tail, not the receiver name. */
|
|
118
|
+
export declare function calleeTail(node: ts.CallExpression): string;
|
|
119
|
+
/** Every registration name a module claims: `di.register` keys plus `di.providePort`. */
|
|
120
|
+
export declare function registeredNames(source: string, file: string): string[];
|
|
121
|
+
/**
|
|
122
|
+
* The names a module registers as **gated ports** (`di.providePort`), which is
|
|
123
|
+
* the subset a composition root must never re-register.
|
|
124
|
+
*
|
|
125
|
+
* The distinction is the whole of the shadowing rule below. `di.register` is
|
|
126
|
+
* how a module declares a *contribution point* — a name it defaults, expecting
|
|
127
|
+
* a root that has something better to override it — so a root registering one
|
|
128
|
+
* of those is the design working. `di.providePort` wraps the resolver in the
|
|
129
|
+
* presence gate, and a root registration replaces the gate with a plain value.
|
|
130
|
+
*/
|
|
131
|
+
export declare function providedPortNames(source: string, file: string): string[];
|
|
132
|
+
/** One `ctx.di.providePort<T>('name', …)` call, with the contract it names. */
|
|
133
|
+
export interface ProvidedPort {
|
|
134
|
+
/** The container name, always a string literal (a computed one is skipped). */
|
|
135
|
+
readonly name: string;
|
|
136
|
+
/**
|
|
137
|
+
* The published contract the registration is checked against, when the call
|
|
138
|
+
* carries a type argument. `null` for the 53 that do not — those compare
|
|
139
|
+
* nothing (Phase-P unreached-port audit, A12).
|
|
140
|
+
*/
|
|
141
|
+
readonly typeName: string | null;
|
|
142
|
+
readonly line: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Every gated registration a file makes, with its type argument.
|
|
146
|
+
*
|
|
147
|
+
* The single expression of "this call is a `providePort`" in the tree.
|
|
148
|
+
* `providedPortNames` above and `check-port-shape`'s container-name signal both
|
|
149
|
+
* come through here rather than each writing the predicate again: a check whose
|
|
150
|
+
* decision exists in two places can go half-missing without its red proof
|
|
151
|
+
* noticing, which is how `check:nul-bytes` kept printing `violations=0` with its
|
|
152
|
+
* rule mutated.
|
|
153
|
+
*/
|
|
154
|
+
export declare function providedPorts(source: string, file: string): ProvidedPort[];
|
|
155
|
+
/**
|
|
156
|
+
* Where in the module's lifecycle this read happens — see {@link ResolutionSite}.
|
|
157
|
+
*
|
|
158
|
+
* `boot` is lexical and deliberately wide: `lazyPort` defers to the method
|
|
159
|
+
* call, and inside a boot hook that call is two lines down. All seven
|
|
160
|
+
* `emailDefaultsPort` contributors had exactly that shape, and every one of
|
|
161
|
+
* them would have failed the boot had the port stayed gated.
|
|
162
|
+
*
|
|
163
|
+
* `wiring` is narrow on purpose: only the `ctx.routes` callback's own body,
|
|
164
|
+
* because that is what runs during `buildServer`. Anything nested one function
|
|
165
|
+
* deeper — a route handler, an `onRequest` hook, a preHandler — runs per
|
|
166
|
+
* request, where a gate is exactly what should be asked.
|
|
167
|
+
*/
|
|
168
|
+
export declare function siteAt(node: ts.Node): ResolutionSite;
|
|
169
|
+
/**
|
|
170
|
+
* Every registration name a module resolves.
|
|
171
|
+
*
|
|
172
|
+
* Three shapes, because those are the ones the kernel offers: the cradle
|
|
173
|
+
* parameter of a factory (`ctx.asFunction(({ a, b }: C) => …)`, destructured or
|
|
174
|
+
* named), the deferred surface (`ctx.cradle<C>()`) read by destructuring or by
|
|
175
|
+
* property access, and either of those bound to a local first — see
|
|
176
|
+
* {@link collectCradleAliases}.
|
|
177
|
+
*
|
|
178
|
+
* **Each shape is read both ways round.** The alias and the destructuring are
|
|
179
|
+
* independent axes, and the check used to see only five of their six
|
|
180
|
+
* combinations: `cradle().a` yes, `const { a } = ctx.cradle<C>()` yes,
|
|
181
|
+
* `const { a } = cradle()` no. That last one is what `catalog`'s
|
|
182
|
+
* asset-reference boot hook is written as, so its two reads were invisible
|
|
183
|
+
* until issue #127 — the eighth time this scanner's *reach*, rather than the
|
|
184
|
+
* rules under it, turned out to be the defect.
|
|
185
|
+
*/
|
|
186
|
+
export declare function resolvedNames(source: string, file: string, hostResident?: HostResidentModules): PortResolution[];
|
|
187
|
+
/**
|
|
188
|
+
* Every registration name a **composition root** writes into the container.
|
|
189
|
+
*
|
|
190
|
+
* A different spelling from {@link registeredNames} and that is the whole reason
|
|
191
|
+
* it exists: a module writes `ctx.di.register({ … })`, and a root writes
|
|
192
|
+
* `registerValues(container, { … })`, `container.register({ … })` or
|
|
193
|
+
* `composedModules.contribute({ … })` — D-45's contribution window as a method
|
|
194
|
+
* (issue #52). Missing the third would drop nearly every name a root supplies.
|
|
195
|
+
*
|
|
196
|
+
* ## Why the CLI needs it
|
|
197
|
+
*
|
|
198
|
+
* `specs/110-instance-repository/` T138a. The divergence report's second host is
|
|
199
|
+
* a client's instance, where `composeApp` **is** the composition root and comes
|
|
200
|
+
* out of `node_modules`, and `registration-owners.ts`' `rootSuppliedNames` is
|
|
201
|
+
* what tells *"a root registers it"* from *"nobody registers it"*. Its own doc
|
|
202
|
+
* block says what happens without it, and it was measured happening: an overlay
|
|
203
|
+
* module decorating `commandBus` in a real scaffolded instance was reported
|
|
204
|
+
* `unowned-subject` — a finding about the run dressed as one about the tree —
|
|
205
|
+
* because the platform registers it in a root spelling this file did not read.
|
|
206
|
+
*
|
|
207
|
+
* ## It is a **second copy**, knowingly, and here is the whole of that decision
|
|
208
|
+
*
|
|
209
|
+
* `backend/scripts/check-port-dependencies.ts` exports a `rootRegisteredNames`
|
|
210
|
+
* this one is taken from, unchanged. Two derivations of one predicate is the
|
|
211
|
+
* shape this estate refuses, so the copy is **not** the end state: that file's
|
|
212
|
+
* should become an import of this one, which is a one-line change and is
|
|
213
|
+
* deliberately not made in the merge request that adds this, feature 117's
|
|
214
|
+
* Phase 6 holding that file open at the time. Until it is,
|
|
215
|
+
* `backend/test/unit/scripts/check-divergence.test.ts` holds the two to each
|
|
216
|
+
* other over the shapes a root really writes — a divergence between them is red
|
|
217
|
+
* rather than silent, which is what a duplicated predicate otherwise costs.
|
|
218
|
+
*
|
|
219
|
+
* Spread elements are ignored: a name that only exists inside a spread is not a
|
|
220
|
+
* name this analysis can reason about.
|
|
221
|
+
*/
|
|
222
|
+
export declare function rootRegisteredNames(source: string, file: string): string[];
|
|
223
|
+
//# sourceMappingURL=port-registrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"port-registrations.d.ts","sourceRoot":"","sources":["../../src/lib/port-registrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,C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