@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,586 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Where does this platform keep its backend modules?" — one derivation, and it
|
|
3
|
+
* answers with a **list** (feature 080, T040a).
|
|
4
|
+
*
|
|
5
|
+
* ## Why a list
|
|
6
|
+
*
|
|
7
|
+
* Wave 1 (issue #215) made every module walk refuse a tree that had moved:
|
|
8
|
+
* `lib/module-population.ts` derives the expected population from the generated
|
|
9
|
+
* manifest index, per module, so a walk that comes back *short* is exit 2
|
|
10
|
+
* rather than `violations=0`. That worked, and
|
|
11
|
+
* `test/unit/scripts/moved-module-tree.test.ts` proves it over sixteen checks.
|
|
12
|
+
*
|
|
13
|
+
* Refusing a moved tree is not the same as **following** one, and the
|
|
14
|
+
* difference decides how F4's layout move can be sequenced. Because the floor
|
|
15
|
+
* is per module, the *first* module that leaves the application's own source
|
|
16
|
+
* tree turns all sixteen checks red: the index still registers it, and no walk
|
|
17
|
+
* produces a file for it. Before this file, the move was therefore one commit
|
|
18
|
+
* or nothing. After it, the walk covers every root a module can live in, the
|
|
19
|
+
* union satisfies the floor at each intermediate state, and modules move one at
|
|
20
|
+
* a time.
|
|
21
|
+
*
|
|
22
|
+
* ## The derivation, and why it is shaped this way
|
|
23
|
+
*
|
|
24
|
+
* Nothing here is a path written down. Three facts are read, in this order,
|
|
25
|
+
* each from the artefact that owns it:
|
|
26
|
+
*
|
|
27
|
+
* 1. **The generated manifest index, by search.** It used to be
|
|
28
|
+
* `join(srcRoot, 'modules/_lifecycle/manifest-index.generated.ts')`,
|
|
29
|
+
* which is the module tree's location spelled out inside the derivation that
|
|
30
|
+
* exists to avoid spelling it. It is now found by walking this
|
|
31
|
+
* repository's own workspace members for a file of that name — so it is
|
|
32
|
+
* found where it is today, and equally where the owner's ruling of
|
|
33
|
+
* 2026-08-22 puts it after the move (`backend/src/`, host-owned: the index
|
|
34
|
+
* is bare core by D-104 and it enumerates *other* packages, and a
|
|
35
|
+
* publishable package naming all of its siblings is a cycle waiting to be
|
|
36
|
+
* declared). Two refusals are kept from the shell twin: no index is exit 2,
|
|
37
|
+
* and more than one index is exit 2 — an ambiguous root silently narrows
|
|
38
|
+
* every scan to whichever one sorted first.
|
|
39
|
+
* 2. **The application's source root**, as the index's own ancestor that is an
|
|
40
|
+
* immediate child of the workspace member holding it — `backend/src` under
|
|
41
|
+
* both layouts above. That is what `src` means here; the name is never
|
|
42
|
+
* matched.
|
|
43
|
+
* 3. **The roots themselves**, from the registered ids:
|
|
44
|
+
*
|
|
45
|
+
* * an **application** root is the parent of any directory under the
|
|
46
|
+
* source root whose name is a registered module id and which holds a
|
|
47
|
+
* `manifest.ts`. Today that resolves to exactly one, `backend/src/modules`.
|
|
48
|
+
* A per-deployment overlay tree is *not* one of them — an overlay module
|
|
49
|
+
* is discovered at runtime and is absent from the bare-core index
|
|
50
|
+
* (D-104) — so it is carried separately, as {@link ModuleTreeLayout.overlayRoot}.
|
|
51
|
+
* * a **package** root is a workspace member whose manifest declares
|
|
52
|
+
* `endora.type === 'module'` with a registered `endora.id`. The
|
|
53
|
+
* declaration is the package's own statement about itself, the same one
|
|
54
|
+
* `src/packages/installed-packages.ts` reads at boot, so a module package
|
|
55
|
+
* is recognised wherever the workspace globs put it and whatever its
|
|
56
|
+
* directory is called.
|
|
57
|
+
*
|
|
58
|
+
* The package half is deliberately keyed on the **declared id** rather than on
|
|
59
|
+
* a `modules/<id>/` path segment. A path segment would work for
|
|
60
|
+
* `packages/modules/<id>/…` and silently stop working for any other layout,
|
|
61
|
+
* which is the failure this file exists to end rather than to relocate.
|
|
62
|
+
*
|
|
63
|
+
* ## Keys
|
|
64
|
+
*
|
|
65
|
+
* Every check turns an absolute path into a string for a message or a ledger
|
|
66
|
+
* key, and two shapes exist in the tree. Both are preserved exactly:
|
|
67
|
+
* {@link ModuleTreeLayout.keyOf} is `relative(srcRoot, …)` (`modules/blog/x.ts`)
|
|
68
|
+
* and {@link ModuleTreeLayout.displayOf} keeps the application's own prefix
|
|
69
|
+
* (`src/modules/blog/x.ts`). A file that is **not** under the source root — a
|
|
70
|
+
* package's — is keyed relative to the repository root
|
|
71
|
+
* (`packages/modules/blog/src/x.ts`) by both, because there is no application
|
|
72
|
+
* prefix that would be true of it. So on a tree with no module package, every
|
|
73
|
+
* key this file produces is byte-for-byte the one produced before it existed.
|
|
74
|
+
*/
|
|
75
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
76
|
+
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
77
|
+
import { declaredModuleId, nodeWorkspaceFs, workspaceMembers, } from './workspace-packages.js';
|
|
78
|
+
import { loadManifestActivations, loadManifestLocations, ManifestIndexUnreadableError, } from './switchable-modules.js';
|
|
79
|
+
import { moduleIdOf } from './module-population.js';
|
|
80
|
+
import { platformPackageNameOf, platformSourceRootOf } from './platform-root.js';
|
|
81
|
+
/** The file the composer generates and every module walk derives its floor from. */
|
|
82
|
+
export const MANIFEST_INDEX_FILENAME = 'manifest-index.generated.ts';
|
|
83
|
+
/**
|
|
84
|
+
* Directories that are not this repository's own source and would either slow
|
|
85
|
+
* the search to no purpose or answer it with somebody else's copy.
|
|
86
|
+
*
|
|
87
|
+
* The same list the shell twin (`scripts/lib/module-root.sh`) prunes, kept in
|
|
88
|
+
* step with it by `test/unit/scripts/module-roots.test.ts`.
|
|
89
|
+
*/
|
|
90
|
+
export const PRUNED_DIRECTORIES = [
|
|
91
|
+
'node_modules',
|
|
92
|
+
'.git',
|
|
93
|
+
'dist',
|
|
94
|
+
'build',
|
|
95
|
+
'.next',
|
|
96
|
+
'.docusaurus',
|
|
97
|
+
];
|
|
98
|
+
/** Raised when the module layout cannot be resolved; a caller turns it into exit 2. */
|
|
99
|
+
export class ModuleLayoutUnresolvableError extends Error {
|
|
100
|
+
name = 'ModuleLayoutUnresolvableError';
|
|
101
|
+
}
|
|
102
|
+
function isUnder(child, parent) {
|
|
103
|
+
if (child === parent)
|
|
104
|
+
return true;
|
|
105
|
+
return child.startsWith(parent.endsWith(sep) ? parent : parent + sep);
|
|
106
|
+
}
|
|
107
|
+
/** Every file of that name under `dir`, with {@link PRUNED_DIRECTORIES} skipped. */
|
|
108
|
+
function findByName(dir, filename, out = []) {
|
|
109
|
+
let entries;
|
|
110
|
+
try {
|
|
111
|
+
entries = readdirSync(dir);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
for (const entry of entries) {
|
|
117
|
+
const full = join(dir, entry);
|
|
118
|
+
let directory;
|
|
119
|
+
try {
|
|
120
|
+
directory = statSync(full).isDirectory();
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (directory) {
|
|
126
|
+
if (PRUNED_DIRECTORIES.includes(entry))
|
|
127
|
+
continue;
|
|
128
|
+
findByName(full, filename, out);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (entry === filename)
|
|
132
|
+
out.push(full);
|
|
133
|
+
}
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The nearest ancestor of `from` that declares a pnpm workspace.
|
|
138
|
+
*
|
|
139
|
+
* Nearest, so a worktree parked *inside* the main tree — which is where this
|
|
140
|
+
* repository's agents work — answers with itself rather than with its host.
|
|
141
|
+
* This is the same judgement `scripts/workspace-resolution.ts` makes, and the
|
|
142
|
+
* shell twin makes it through the `.git` marker instead, because a sourced
|
|
143
|
+
* library cannot assume a node toolchain.
|
|
144
|
+
*/
|
|
145
|
+
export function findRepoRoot(from) {
|
|
146
|
+
let dir = resolve(from);
|
|
147
|
+
for (;;) {
|
|
148
|
+
if (existsSync(join(dir, 'pnpm-workspace.yaml')))
|
|
149
|
+
return dir;
|
|
150
|
+
const parent = resolve(dir, '..');
|
|
151
|
+
if (parent === dir)
|
|
152
|
+
return null;
|
|
153
|
+
dir = parent;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The one manifest index this repository owns.
|
|
158
|
+
*
|
|
159
|
+
* Searched over the workspace members rather than under a named source root: a
|
|
160
|
+
* search rooted at `backend/src` would answer "gone" for an index that merely
|
|
161
|
+
* moved one level up, which is the event this whole file exists for.
|
|
162
|
+
*/
|
|
163
|
+
export function findManifestIndex(repoRoot, fs = nodeWorkspaceFs()) {
|
|
164
|
+
const members = workspaceMembers(repoRoot, fs);
|
|
165
|
+
if (members.length === 0) {
|
|
166
|
+
throw new ModuleLayoutUnresolvableError(`${join(repoRoot, 'pnpm-workspace.yaml')} declares no workspace member — the module ` +
|
|
167
|
+
'roots are derived from them, so there is nothing to search');
|
|
168
|
+
}
|
|
169
|
+
const found = new Set();
|
|
170
|
+
for (const member of members) {
|
|
171
|
+
for (const hit of findByName(member.dir, MANIFEST_INDEX_FILENAME))
|
|
172
|
+
found.add(hit);
|
|
173
|
+
}
|
|
174
|
+
const indexes = [...found].sort();
|
|
175
|
+
if (indexes.length === 0) {
|
|
176
|
+
throw new ModuleLayoutUnresolvableError(`no ${MANIFEST_INDEX_FILENAME} under any workspace member of ${repoRoot} — the module ` +
|
|
177
|
+
'tree is not where anything can find it');
|
|
178
|
+
}
|
|
179
|
+
if (indexes.length > 1) {
|
|
180
|
+
throw new ModuleLayoutUnresolvableError(`more than one ${MANIFEST_INDEX_FILENAME} under the workspace members of ${repoRoot}:\n` +
|
|
181
|
+
`${indexes.map((path) => ` ${path}`).join('\n')}\n` +
|
|
182
|
+
'the module root is ambiguous, and picking one narrows every scan to it without ' +
|
|
183
|
+
'saying so');
|
|
184
|
+
}
|
|
185
|
+
return indexes[0];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The application's source root: the index's ancestor that is an immediate
|
|
189
|
+
* child of the workspace member holding it.
|
|
190
|
+
*
|
|
191
|
+
* `backend/src/modules/_lifecycle/<index>` and `backend/src/<index>` both
|
|
192
|
+
* answer `backend/src`, which is what makes the owner's ruling about where the
|
|
193
|
+
* index lives a change this derivation does not have to be told about.
|
|
194
|
+
*/
|
|
195
|
+
export function sourceRootOfIndex(indexPath, memberDir) {
|
|
196
|
+
let cursor = dirname(indexPath);
|
|
197
|
+
for (;;) {
|
|
198
|
+
const parent = dirname(cursor);
|
|
199
|
+
if (parent === cursor)
|
|
200
|
+
return cursor;
|
|
201
|
+
if (parent === memberDir)
|
|
202
|
+
return cursor;
|
|
203
|
+
cursor = parent;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Application module roots: the parents of registered-id directories that hold
|
|
208
|
+
* a `manifest.ts`.
|
|
209
|
+
*
|
|
210
|
+
* Both halves of that predicate are load-bearing. The id filter is what keeps
|
|
211
|
+
* an overlay tree (`src/apps/<deployment>/modules/<id>`) and the test
|
|
212
|
+
* fixtures' module-shaped directories out — neither is in the bare-core index.
|
|
213
|
+
* The `manifest.ts` filter is what keeps a directory that merely shares a
|
|
214
|
+
* module's name out: `test/unit/orders` is not a module root's child, and a
|
|
215
|
+
* derivation that took the name alone would say it was.
|
|
216
|
+
*/
|
|
217
|
+
export function applicationModuleRoots(srcRoot, registered) {
|
|
218
|
+
const roots = new Set();
|
|
219
|
+
const visit = (dir) => {
|
|
220
|
+
let entries;
|
|
221
|
+
try {
|
|
222
|
+
entries = readdirSync(dir);
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
for (const entry of entries) {
|
|
228
|
+
if (PRUNED_DIRECTORIES.includes(entry))
|
|
229
|
+
continue;
|
|
230
|
+
const full = join(dir, entry);
|
|
231
|
+
let directory;
|
|
232
|
+
try {
|
|
233
|
+
directory = statSync(full).isDirectory();
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
if (!directory)
|
|
239
|
+
continue;
|
|
240
|
+
if (registered.has(entry) && existsSync(join(full, 'manifest.ts'))) {
|
|
241
|
+
roots.add(dir);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
visit(full);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
visit(srcRoot);
|
|
248
|
+
return [...roots].sort();
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The module roots the two derivations above cannot see: a module whose sources
|
|
252
|
+
* the **host application** owns (feature 080, T040b).
|
|
253
|
+
*
|
|
254
|
+
* There is one, `_lifecycle`, and it is one by D-160.11 — the lifecycle
|
|
255
|
+
* subsystem is the platform's operator half, so it never became a package the
|
|
256
|
+
* way the other 66 modules did. It is still a registered module with a
|
|
257
|
+
* manifest, permissions, an activation declaration and its own i18n bundles, so
|
|
258
|
+
* every module walk has to keep reading it; what changed is only where its
|
|
259
|
+
* directory sits.
|
|
260
|
+
*
|
|
261
|
+
* It cannot be found the way {@link applicationModuleRoots} finds a module,
|
|
262
|
+
* because that predicate is *"a directory named after a registered id"* and
|
|
263
|
+
* this directory is deliberately **not**: a `src/_lifecycle/` would make
|
|
264
|
+
* `backend/src` itself a module root, and every kernel, `db/` and `http/` file
|
|
265
|
+
* under it a module's source with no module to attribute it to. So it is read
|
|
266
|
+
* from the index's own `manifestPath` — the artefact that already records where
|
|
267
|
+
* each module's manifest is, for all three origins — and a module whose
|
|
268
|
+
* manifest sits under the application source root but is not an immediate child
|
|
269
|
+
* of a module root is one of these.
|
|
270
|
+
*
|
|
271
|
+
* Nothing is written down and the derivation fails closed in both directions
|
|
272
|
+
* (D-100, issue #215). A module whose directory disappeared cannot arrive here
|
|
273
|
+
* as "host-resident": its manifest specifier would resolve to nothing and the
|
|
274
|
+
* index would not import at all, which is exit 2 at the reader. And a candidate
|
|
275
|
+
* that is the source root itself, or an ancestor of a root already found, is
|
|
276
|
+
* refused rather than walked — a root that swallows the tree reports every file
|
|
277
|
+
* in it as one module's.
|
|
278
|
+
*/
|
|
279
|
+
export function hostResidentModuleRoots(srcRoot, found, manifestPaths) {
|
|
280
|
+
return residentModuleRoots(srcRoot, found, manifestPaths, 'host-resident');
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Module roots inside the **platform package** (feature 080, D-160.11's second
|
|
284
|
+
* half).
|
|
285
|
+
*
|
|
286
|
+
* `_lifecycle` moved from `backend/src/lifecycle/` into
|
|
287
|
+
* `packages/platform/src/lifecycle/`, which is neither an application module
|
|
288
|
+
* root nor a module package: the platform declares `endora.type: "platform"`,
|
|
289
|
+
* so `declaredModuleId` answers `null` for it and the package half of the
|
|
290
|
+
* derivation never sees the module inside. Without this the one registered
|
|
291
|
+
* module living there produces no file for any module walk and the #215 floor
|
|
292
|
+
* refuses all sixteen of them — the correct failure, and not a useful one.
|
|
293
|
+
*
|
|
294
|
+
* **It cannot be derived from the index's `manifestPath` the way
|
|
295
|
+
* {@link hostResidentModuleRoots} is**, and that is a fact about the package
|
|
296
|
+
* rather than a shortcut taken here. A platform-resident module is imported by
|
|
297
|
+
* the generated index at the package's **built** file — the host publishes five
|
|
298
|
+
* subpaths and no more (D-160.7), and naming the source would evaluate the
|
|
299
|
+
* platform twice — so `manifestPath` resolves under `dist/`, which is where the
|
|
300
|
+
* module's i18n bundles are and is not where its sources are. Mapping one to
|
|
301
|
+
* the other would be a `dist`↔`src` convention written into a derivation
|
|
302
|
+
* (D-100), and the package's own emit layout is free to change it.
|
|
303
|
+
*
|
|
304
|
+
* So the module is found by the **same marker core discovery uses** — a
|
|
305
|
+
* directory holding a `manifest.ts` that declares a registered id — with the id
|
|
306
|
+
* read out of the manifest rather than off the directory name, because
|
|
307
|
+
* `_lifecycle` deliberately lives in `lifecycle/`: a directory named after a
|
|
308
|
+
* registered id makes its *parent* a module root, and `src/_lifecycle/` would
|
|
309
|
+
* make the whole platform source root one.
|
|
310
|
+
*/
|
|
311
|
+
export function platformResidentModuleRoots(platformRoot, found, registered) {
|
|
312
|
+
if (platformRoot === null)
|
|
313
|
+
return [];
|
|
314
|
+
const roots = [];
|
|
315
|
+
const visit = (dir) => {
|
|
316
|
+
let entries;
|
|
317
|
+
try {
|
|
318
|
+
entries = readdirSync(dir);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
for (const entry of entries) {
|
|
324
|
+
if (PRUNED_DIRECTORIES.includes(entry))
|
|
325
|
+
continue;
|
|
326
|
+
const full = join(dir, entry);
|
|
327
|
+
let directory;
|
|
328
|
+
try {
|
|
329
|
+
directory = statSync(full).isDirectory();
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
if (!directory)
|
|
335
|
+
continue;
|
|
336
|
+
const moduleId = declaredManifestId(join(full, 'manifest.ts'));
|
|
337
|
+
if (moduleId !== null && registered.has(moduleId)) {
|
|
338
|
+
if (found.some((root) => isUnder(full, root.directory)))
|
|
339
|
+
continue;
|
|
340
|
+
roots.push({ directory: full, moduleId, origin: 'platform-resident' });
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
visit(full);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
visit(platformRoot);
|
|
347
|
+
return roots.sort((a, b) => a.directory.localeCompare(b.directory));
|
|
348
|
+
}
|
|
349
|
+
/** The id a lifecycle-shape `manifest.ts` declares about itself, or `null`. */
|
|
350
|
+
function declaredManifestId(manifestPath) {
|
|
351
|
+
if (!existsSync(manifestPath))
|
|
352
|
+
return null;
|
|
353
|
+
let source;
|
|
354
|
+
try {
|
|
355
|
+
source = readFileSync(manifestPath, 'utf8');
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
return /defineModuleManifest\(\{[\s\S]*?\bid:\s*'([^']+)'/.exec(source)?.[1] ?? null;
|
|
361
|
+
}
|
|
362
|
+
function residentModuleRoots(containingRoot, found, manifestPaths, origin) {
|
|
363
|
+
const roots = [];
|
|
364
|
+
for (const [moduleId, manifestPath] of manifestPaths) {
|
|
365
|
+
const directory = dirname(resolve(manifestPath));
|
|
366
|
+
if (!isUnder(directory, containingRoot) || directory === containingRoot)
|
|
367
|
+
continue;
|
|
368
|
+
if (found.some((root) => isUnder(directory, root.directory)))
|
|
369
|
+
continue;
|
|
370
|
+
if (found.some((root) => isUnder(root.directory, directory)))
|
|
371
|
+
continue;
|
|
372
|
+
roots.push({ directory, moduleId, origin });
|
|
373
|
+
}
|
|
374
|
+
return roots.sort((a, b) => a.directory.localeCompare(b.directory));
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The whole layout, resolved once.
|
|
378
|
+
*
|
|
379
|
+
* Async because the registered ids come out of the generated index, which is a
|
|
380
|
+
* TypeScript module the checks import rather than a file they parse — the same
|
|
381
|
+
* reader `lib/switchable-modules.ts` uses, so the two derivations cannot
|
|
382
|
+
* disagree about which modules exist.
|
|
383
|
+
*/
|
|
384
|
+
export async function resolveModuleLayout(from = process.cwd(), fs = nodeWorkspaceFs()) {
|
|
385
|
+
const repoRoot = findRepoRoot(from);
|
|
386
|
+
if (repoRoot === null) {
|
|
387
|
+
throw new ModuleLayoutUnresolvableError(`no pnpm-workspace.yaml at or above ${resolve(from)} — this is not a checkout of a ` +
|
|
388
|
+
'workspace whose module roots can be derived');
|
|
389
|
+
}
|
|
390
|
+
const members = workspaceMembers(repoRoot, fs);
|
|
391
|
+
const manifestIndexPath = findManifestIndex(repoRoot, fs);
|
|
392
|
+
const applicationMember = members.find((member) => isUnder(manifestIndexPath, member.dir));
|
|
393
|
+
if (applicationMember === undefined) {
|
|
394
|
+
throw new ModuleLayoutUnresolvableError(`${manifestIndexPath} is under no workspace member of ${repoRoot}`);
|
|
395
|
+
}
|
|
396
|
+
const srcRoot = sourceRootOfIndex(manifestIndexPath, applicationMember.dir);
|
|
397
|
+
const registeredIds = (await loadManifestActivations(manifestIndexPath)).map((manifest) => manifest.id);
|
|
398
|
+
const registered = new Set(registeredIds);
|
|
399
|
+
const moduleRoots = applicationModuleRoots(srcRoot, registered).map((directory) => ({ directory, moduleId: null, origin: 'application' }));
|
|
400
|
+
const modulePackageNames = new Map();
|
|
401
|
+
for (const member of members) {
|
|
402
|
+
const declared = declaredModuleId(member);
|
|
403
|
+
if (declared === null || !registered.has(declared))
|
|
404
|
+
continue;
|
|
405
|
+
moduleRoots.push({
|
|
406
|
+
directory: member.dir,
|
|
407
|
+
moduleId: declared,
|
|
408
|
+
origin: 'workspace-package',
|
|
409
|
+
});
|
|
410
|
+
modulePackageNames.set(member.name, declared);
|
|
411
|
+
}
|
|
412
|
+
const manifestLocations = await loadManifestLocations(manifestIndexPath);
|
|
413
|
+
for (const root of hostResidentModuleRoots(srcRoot, moduleRoots, manifestLocations)) {
|
|
414
|
+
moduleRoots.push(root);
|
|
415
|
+
}
|
|
416
|
+
const overlayRoot = join(srcRoot, 'apps');
|
|
417
|
+
const packageRoots = moduleRoots
|
|
418
|
+
.filter((root) => root.origin === 'workspace-package')
|
|
419
|
+
.map((root) => root.directory);
|
|
420
|
+
const platformRoot = platformSourceRootOf(members);
|
|
421
|
+
const platformPackageName = platformPackageNameOf(members);
|
|
422
|
+
for (const root of platformResidentModuleRoots(platformRoot, moduleRoots, registered)) {
|
|
423
|
+
moduleRoots.push(root);
|
|
424
|
+
}
|
|
425
|
+
// A workspace with no frontend answers `null` rather than throwing: every
|
|
426
|
+
// fixture tree in `backend/test/helpers/` is one, and a throw here would take
|
|
427
|
+
// out every check that resolves the layout for a reason that has nothing to
|
|
428
|
+
// do with the module tree. The refusal belongs to the one check whose
|
|
429
|
+
// population this is, where it can be reconciled against the ledger.
|
|
430
|
+
let admin;
|
|
431
|
+
let adminRefusal = null;
|
|
432
|
+
const adminSurfaces = async () => {
|
|
433
|
+
if (admin !== undefined)
|
|
434
|
+
return admin;
|
|
435
|
+
const { AdminLayoutUnresolvableError, resolveAdminSurfaces } = await import('./admin-surfaces.js');
|
|
436
|
+
try {
|
|
437
|
+
admin = resolveAdminSurfaces(members, registered);
|
|
438
|
+
adminRefusal = null;
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
if (!(error instanceof AdminLayoutUnresolvableError))
|
|
442
|
+
throw error;
|
|
443
|
+
admin = null;
|
|
444
|
+
// Set on the same call that produced the `null`, so the two accessors
|
|
445
|
+
// are one derivation and a caller cannot print a stale sentence.
|
|
446
|
+
adminRefusal = error.message;
|
|
447
|
+
}
|
|
448
|
+
return admin;
|
|
449
|
+
};
|
|
450
|
+
const adminSurfacesRefusal = async () => {
|
|
451
|
+
await adminSurfaces();
|
|
452
|
+
return adminRefusal;
|
|
453
|
+
};
|
|
454
|
+
const keyOf = (absolutePath) => {
|
|
455
|
+
const path = resolve(absolutePath);
|
|
456
|
+
const base = isUnder(path, srcRoot) ? srcRoot : repoRoot;
|
|
457
|
+
return relative(base, path).split('\\').join('/');
|
|
458
|
+
};
|
|
459
|
+
const displayOf = (absolutePath) => {
|
|
460
|
+
const path = resolve(absolutePath);
|
|
461
|
+
const base = isUnder(path, srcRoot) ? applicationMember.dir : repoRoot;
|
|
462
|
+
return relative(base, path).split('\\').join('/');
|
|
463
|
+
};
|
|
464
|
+
const absolutePathOf = (key) => {
|
|
465
|
+
const withinApplication = join(srcRoot, key);
|
|
466
|
+
return existsSync(withinApplication) ? withinApplication : join(repoRoot, key);
|
|
467
|
+
};
|
|
468
|
+
const moduleIdOfPath = (absolutePath) => {
|
|
469
|
+
const path = resolve(absolutePath);
|
|
470
|
+
for (const root of moduleRoots) {
|
|
471
|
+
if (root.moduleId !== null && isUnder(path, root.directory))
|
|
472
|
+
return root.moduleId;
|
|
473
|
+
}
|
|
474
|
+
return moduleIdOf(keyOf(path));
|
|
475
|
+
};
|
|
476
|
+
const moduleDirectories = new Map();
|
|
477
|
+
for (const root of moduleRoots) {
|
|
478
|
+
if (root.moduleId !== null) {
|
|
479
|
+
moduleDirectories.set(root.moduleId, root.directory);
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
for (const id of registeredIds) {
|
|
483
|
+
const candidate = join(root.directory, id);
|
|
484
|
+
if (!moduleDirectories.has(id) && existsSync(candidate))
|
|
485
|
+
moduleDirectories.set(id, candidate);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
const moduleDirectoryOf = (moduleId) => moduleDirectories.get(moduleId) ?? null;
|
|
489
|
+
return {
|
|
490
|
+
repoRoot,
|
|
491
|
+
applicationRoot: applicationMember.dir,
|
|
492
|
+
srcRoot,
|
|
493
|
+
manifestIndexPath,
|
|
494
|
+
registeredIds,
|
|
495
|
+
moduleRoots,
|
|
496
|
+
overlayRoot,
|
|
497
|
+
platformRoot,
|
|
498
|
+
platformPackageName,
|
|
499
|
+
sourceRoots: platformRoot === null ? [srcRoot, ...packageRoots] : [srcRoot, platformRoot, ...packageRoots],
|
|
500
|
+
moduleWalkRoots: [
|
|
501
|
+
...moduleRoots
|
|
502
|
+
.filter((root) => root.origin !== 'workspace-package')
|
|
503
|
+
.map((root) => root.directory),
|
|
504
|
+
overlayRoot,
|
|
505
|
+
...packageRoots,
|
|
506
|
+
],
|
|
507
|
+
keyOf,
|
|
508
|
+
displayOf,
|
|
509
|
+
absolutePathOf,
|
|
510
|
+
moduleIdOfPath,
|
|
511
|
+
moduleDirectories,
|
|
512
|
+
moduleDirectoryOf,
|
|
513
|
+
modulePackageNames,
|
|
514
|
+
adminSurfaces,
|
|
515
|
+
adminSurfacesRefusal,
|
|
516
|
+
hostResidentModules: new Map(moduleRoots
|
|
517
|
+
.filter((root) => (root.origin === 'host-resident' || root.origin === 'platform-resident') &&
|
|
518
|
+
root.moduleId !== null)
|
|
519
|
+
// Keyed relative to the source root the module sits in, which for both
|
|
520
|
+
// origins is the tail `moduleIdOf` compares against — it cuts at the
|
|
521
|
+
// **last** `/src/`, so `packages/platform/src/lifecycle/x.ts` and
|
|
522
|
+
// `backend/src/lifecycle/x.ts` both present as `lifecycle/x.ts`. That
|
|
523
|
+
// collision is the module, not an accident: `_lifecycle`'s host half
|
|
524
|
+
// (its manifest registry and the five `module:*` commands) stayed in
|
|
525
|
+
// `backend/src/lifecycle/` by D-160.11 and belongs to the same module.
|
|
526
|
+
.map((root) => [
|
|
527
|
+
relative(root.origin === 'platform-resident' ? platformRoot : srcRoot, root.directory)
|
|
528
|
+
.split('\\')
|
|
529
|
+
.join('/'),
|
|
530
|
+
root.moduleId,
|
|
531
|
+
])),
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* The CLI half: resolve the layout, or print the refusal and exit 2.
|
|
536
|
+
*
|
|
537
|
+
* One function rather than a copy per check, for the reason
|
|
538
|
+
* `refuseVacuousModulePopulation` is one function: a copy per check is a chance
|
|
539
|
+
* per check to write the one that returns instead of exiting, and a check whose
|
|
540
|
+
* guard is subtly wrong is invisible by construction.
|
|
541
|
+
*/
|
|
542
|
+
export async function requireModuleLayout(prefix) {
|
|
543
|
+
try {
|
|
544
|
+
return await resolveModuleLayout();
|
|
545
|
+
}
|
|
546
|
+
catch (error) {
|
|
547
|
+
const detail = error instanceof ModuleLayoutUnresolvableError || error instanceof ManifestIndexUnreadableError
|
|
548
|
+
? error.message
|
|
549
|
+
: String(error);
|
|
550
|
+
console.error(`${prefix} the module layout could not be resolved (${detail}) — every root this ` +
|
|
551
|
+
'check walks and the population it reconciles them against are derived from it; ' +
|
|
552
|
+
'refusing to report a vacuous pass');
|
|
553
|
+
process.exit(2);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Does this source file compose a module — i.e. is it the module's entry point?
|
|
558
|
+
*
|
|
559
|
+
* **The marker, never a filename** (feature 080, T040b). A module in the
|
|
560
|
+
* application's tree keeps `registerModule` in `backend.ts`; a module package
|
|
561
|
+
* keeps it wherever its `exports` map's `./backend` subpath leads, which for
|
|
562
|
+
* both packages in this repository is `src/backend/index.ts`. A predicate
|
|
563
|
+
* spelled as a filename therefore answers `false` for a packaged module, and
|
|
564
|
+
* the answer is not merely incomplete — it is fail-*open* at the place it is
|
|
565
|
+
* asked. `check-port-dependencies` matched `'/backend.ts'` and so could not see
|
|
566
|
+
* a packaged module's `di.providePort` calls: every consumer of one of those
|
|
567
|
+
* ports read as *resolving an ungated registration*, and was told to write an
|
|
568
|
+
* absent-owner policy for a gate that was right there. `blog` hid it by owning
|
|
569
|
+
* no port another module resolves; `quote_requests` owns two, resolved by six
|
|
570
|
+
* modules, and reported six findings the moment it moved.
|
|
571
|
+
*
|
|
572
|
+
* One expression, shared by `generate-composer.ts` — which locates a module's
|
|
573
|
+
* entry point this way for both origins — and by every check that needs the
|
|
574
|
+
* same file. A check whose decision exists in two places can go half-missing
|
|
575
|
+
* without either red proof noticing.
|
|
576
|
+
*
|
|
577
|
+
* It reads the **export**, not an import or a call, so a file that merely
|
|
578
|
+
* mentions `registerModule` is not one; and it does not follow a re-export, so
|
|
579
|
+
* a barrel that forwards `registerModule` from a neighbour is not recognised
|
|
580
|
+
* here. The composer refuses a package with zero or two such files with a
|
|
581
|
+
* message that says so, which is where that shape is caught.
|
|
582
|
+
*/
|
|
583
|
+
export function declaresRegisterModule(source) {
|
|
584
|
+
return /export\s+(?:function|const|let|async\s+function)\s+registerModule\b/.test(source);
|
|
585
|
+
}
|
|
586
|
+
//# sourceMappingURL=module-roots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-roots.js","sourceRoot":"","sources":["../../src/lib/module-roots.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QACpB,OAAO,CAAC,KAAK,CACX,GAAG,MAAM,6CAA6C,MAAM,sBAAsB;YAChF,iFAAiF;YACjF,mCAAmC,CACtC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,OAAO,qEAAqE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entry whose presence makes a directory the root of a checkout.
|
|
3
|
+
*
|
|
4
|
+
* A constant rather than a literal in three places, because the whole rule
|
|
5
|
+
* rests on this one name and a reader has to be able to find every use of it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CHECKOUT_MARKER = ".git";
|
|
8
|
+
/**
|
|
9
|
+
* The root of every checkout nested inside `repoRoot`, repo-relative, sorted.
|
|
10
|
+
*
|
|
11
|
+
* The checkout's **own** marker is stepped over by name: the walk starts at the
|
|
12
|
+
* repository root, so the marker there says nothing about a nested tree. A rule
|
|
13
|
+
* that pruned any directory carrying a `.git` would prune the repository and
|
|
14
|
+
* answer "nothing here", which is the vacuous pass in its purest form — the
|
|
15
|
+
* fixture in `test/unit/scripts/nested-checkouts.test.ts` carries an outer
|
|
16
|
+
* marker for exactly that reason.
|
|
17
|
+
*
|
|
18
|
+
* The walk does not descend into a nested checkout: everything under it belongs
|
|
19
|
+
* to that checkout, and a worktree of this repository holds a full copy of
|
|
20
|
+
* `node_modules`-free source that would otherwise be walked in its entirety.
|
|
21
|
+
*/
|
|
22
|
+
export declare function nestedCheckoutRoots(repoRoot: string): readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether a repo-relative path names a nested checkout or something inside one.
|
|
25
|
+
*
|
|
26
|
+
* The roots are literal paths, so the comparison is a literal prefix test with
|
|
27
|
+
* the separator appended — that is what makes `vendor/fork` not match
|
|
28
|
+
* `vendor/fork-of-ours`, and it is why the shell twin uses `index(…) == 1`
|
|
29
|
+
* rather than a regex built from a path holding unescaped dots. The root itself
|
|
30
|
+
* matches: a listing that names the directory is naming another checkout.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isInsideNestedCheckout(relativePath: string, roots: readonly string[]): boolean;
|
|
33
|
+
//# sourceMappingURL=nested-checkouts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-checkouts.d.ts","sourceRoot":"","sources":["../../src/lib/nested-checkouts.ts"],"names":[],"mappings":"AAyFA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SAAS,CAAC;AActC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CA0BvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,OAAO,CAGT"}
|