@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,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reference storefront, and every declaration in it that names something
|
|
3
|
+
* above its own directory.
|
|
4
|
+
*
|
|
5
|
+
* **Nothing here is a list.** `specs/071-modular-packaging/roadmap.md` § *F7*
|
|
6
|
+
* derived the transformation once, on 2026-09-02, and recorded it as *"four
|
|
7
|
+
* `@endora-commerce/*` `workspace:` ranges and three monorepo-relative
|
|
8
|
+
* configuration references"*. Re-derived against the tree on 2026-09-03 that is
|
|
9
|
+
* already wrong in four ways — `@endora-commerce/api-client` has been dropped
|
|
10
|
+
* from the storefront's manifest, the vitest configuration is `.mts` rather than
|
|
11
|
+
* `.ts`, `app/globals.css` has grown a Tailwind `@source` glob into the
|
|
12
|
+
* repository's package tree, and one test file imports a repository script. A
|
|
13
|
+
* tool carrying the list would have copied three of those four out of the
|
|
14
|
+
* repository unchanged and said nothing.
|
|
15
|
+
*
|
|
16
|
+
* So the population is computed on every run, from three sources that are each
|
|
17
|
+
* an independent author of part of the answer:
|
|
18
|
+
*
|
|
19
|
+
* * **`git ls-files`** for which files the reference storefront *is*. Build
|
|
20
|
+
* output, `node_modules` and a stray `.next` are excluded by construction
|
|
21
|
+
* rather than by an ignore list this file would have to keep current.
|
|
22
|
+
* * **the storefront's own `package.json`** for the `workspace:` ranges, in
|
|
23
|
+
* every dependency field rather than only `dependencies`.
|
|
24
|
+
* * **the copied text itself** for every relative reference that resolves
|
|
25
|
+
* outside the storefront directory, in the three shapes a Next application
|
|
26
|
+
* writes one: an ES module specifier, a JSON `extends`, and a CSS `@source`
|
|
27
|
+
* glob.
|
|
28
|
+
*
|
|
29
|
+
* A reference the transformation cannot make standalone is a **refusal**, never
|
|
30
|
+
* a file copied out unchanged: that is the one property that keeps this command
|
|
31
|
+
* from going stale the way the roadmap's own sentence did.
|
|
32
|
+
*/
|
|
33
|
+
import { spawnSync } from 'node:child_process';
|
|
34
|
+
import { builtinModules } from 'node:module';
|
|
35
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
36
|
+
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
37
|
+
import { addressVariablesFor, scopeToMembers, } from '@endora-commerce/contracts';
|
|
38
|
+
import { loadTreeDeclaration } from '../inputs/declaration.js';
|
|
39
|
+
import { isNextApplication } from '../lib/workspace-packages.js';
|
|
40
|
+
/** Raised when the reference storefront cannot be read. Exit 2. */
|
|
41
|
+
export class StorefrontHostError extends Error {
|
|
42
|
+
}
|
|
43
|
+
/** Raised when the author asked for something this command refuses. Exit 1. */
|
|
44
|
+
export class StorefrontInputError extends Error {
|
|
45
|
+
}
|
|
46
|
+
/** The dependency fields a manifest can declare a `workspace:` range in. */
|
|
47
|
+
export const DEPENDENCY_FIELDS = [
|
|
48
|
+
'dependencies',
|
|
49
|
+
'devDependencies',
|
|
50
|
+
'peerDependencies',
|
|
51
|
+
'optionalDependencies',
|
|
52
|
+
];
|
|
53
|
+
/** The nearest ancestor of `start` holding a `pnpm-workspace.yaml`, or `null`. */
|
|
54
|
+
export function findRepoRoot(start) {
|
|
55
|
+
let current = resolve(start);
|
|
56
|
+
for (;;) {
|
|
57
|
+
if (existsSync(join(current, 'pnpm-workspace.yaml')))
|
|
58
|
+
return current;
|
|
59
|
+
const parent = dirname(current);
|
|
60
|
+
if (parent === current)
|
|
61
|
+
return null;
|
|
62
|
+
current = parent;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The reference storefront's files, from git.
|
|
67
|
+
*
|
|
68
|
+
* Git is the independent author here: the alternative is a walk plus an
|
|
69
|
+
* exclusion list, and an exclusion list is a second answer to "what is this
|
|
70
|
+
* application" that goes stale against `.gitignore` in silence. A checkout with
|
|
71
|
+
* no git, or a storefront directory git does not track, is exit 2 — never a
|
|
72
|
+
* partial copy.
|
|
73
|
+
*/
|
|
74
|
+
export function trackedFiles(repoRoot, storefrontDir) {
|
|
75
|
+
const result = spawnSync('git', ['ls-files', '-z', '--', storefrontDir], {
|
|
76
|
+
cwd: repoRoot,
|
|
77
|
+
encoding: 'utf8',
|
|
78
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
79
|
+
});
|
|
80
|
+
if (result.error !== undefined || result.status !== 0) {
|
|
81
|
+
throw new StorefrontHostError(`\`git ls-files\` could not enumerate ${storefrontDir}: ` +
|
|
82
|
+
`${result.error?.message ?? result.stderr}. The copy population is git's answer to ` +
|
|
83
|
+
`"what is this application", so a run that cannot ask it copies nothing rather than ` +
|
|
84
|
+
`walking the directory and guessing which artefacts are build output.`);
|
|
85
|
+
}
|
|
86
|
+
const files = result.stdout
|
|
87
|
+
.split('\0')
|
|
88
|
+
.filter((line) => line.length > 0)
|
|
89
|
+
.map((line) => relative(storefrontDir, join(repoRoot, line)));
|
|
90
|
+
if (files.length === 0) {
|
|
91
|
+
throw new StorefrontHostError(`git tracks no file under ${storefrontDir}. There is no reference storefront to copy.`);
|
|
92
|
+
}
|
|
93
|
+
return files;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Locate the reference storefront.
|
|
97
|
+
*
|
|
98
|
+
* It is found by the **one workspace member that is a Next application**, not by
|
|
99
|
+
* a directory called `storefront`: the member's manifest declares `next` and a
|
|
100
|
+
* `build` script that runs it, and `pnpm-workspace.yaml` says which directories
|
|
101
|
+
* are members. A repository that renames the directory is followed; one that
|
|
102
|
+
* grows a second Next application is exit 2 rather than a run over whichever
|
|
103
|
+
* sorted first.
|
|
104
|
+
*/
|
|
105
|
+
export function resolveReference(cwd) {
|
|
106
|
+
const repoRoot = findRepoRoot(cwd);
|
|
107
|
+
if (repoRoot === null) {
|
|
108
|
+
throw new StorefrontHostError(`no pnpm-workspace.yaml above ${cwd}. \`endora new storefront\` copies the reference ` +
|
|
109
|
+
`storefront out of a checkout of the platform repository, so it has to be run inside ` +
|
|
110
|
+
`one. There is nothing for it to copy anywhere else.`);
|
|
111
|
+
}
|
|
112
|
+
const candidates = nextApplications(repoRoot);
|
|
113
|
+
if (candidates.length === 0) {
|
|
114
|
+
throw new StorefrontHostError(`${repoRoot} declares no workspace member that is a Next application, so this checkout ` +
|
|
115
|
+
`holds no reference storefront. A member qualifies by declaring \`next\` as a ` +
|
|
116
|
+
`dependency and a \`build\` script that runs it.`);
|
|
117
|
+
}
|
|
118
|
+
if (candidates.length > 1) {
|
|
119
|
+
throw new StorefrontHostError(`${repoRoot} holds more than one Next application ` +
|
|
120
|
+
`(${candidates.map((dir) => relative(repoRoot, dir)).join(', ')}). This command will ` +
|
|
121
|
+
`not choose between them, because a run over whichever sorted first is a run whose ` +
|
|
122
|
+
`subject nobody chose.`);
|
|
123
|
+
}
|
|
124
|
+
const dir = candidates[0];
|
|
125
|
+
const manifest = readManifest(join(dir, 'package.json'));
|
|
126
|
+
return { repoRoot, dir, files: trackedFiles(repoRoot, dir), manifest };
|
|
127
|
+
}
|
|
128
|
+
function readManifest(path) {
|
|
129
|
+
try {
|
|
130
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
throw new StorefrontHostError(`${path} could not be read as JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** Workspace member directories, from the `packages:` globs as written. */
|
|
137
|
+
export function memberDirectories(repoRoot) {
|
|
138
|
+
const text = readFileSync(join(repoRoot, 'pnpm-workspace.yaml'), 'utf8');
|
|
139
|
+
const globs = [];
|
|
140
|
+
let inPackages = false;
|
|
141
|
+
for (const raw of text.split('\n')) {
|
|
142
|
+
const line = raw.replace(/#.*$/, '').trimEnd();
|
|
143
|
+
if (/^packages:\s*$/.test(line)) {
|
|
144
|
+
inPackages = true;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (!inPackages)
|
|
148
|
+
continue;
|
|
149
|
+
const entry = /^\s+-\s+['"]?([^'"\s]+)['"]?\s*$/.exec(line);
|
|
150
|
+
if (entry === null) {
|
|
151
|
+
if (line.trim().length > 0 && !line.startsWith(' '))
|
|
152
|
+
inPackages = false;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
globs.push(entry[1]);
|
|
156
|
+
}
|
|
157
|
+
const found = [];
|
|
158
|
+
for (const glob of globs) {
|
|
159
|
+
if (glob.startsWith('!'))
|
|
160
|
+
continue;
|
|
161
|
+
if (!glob.endsWith('/*')) {
|
|
162
|
+
found.push(join(repoRoot, glob));
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
found.push(...expand(join(repoRoot, glob.slice(0, -2))));
|
|
166
|
+
}
|
|
167
|
+
return found;
|
|
168
|
+
}
|
|
169
|
+
function expand(parent) {
|
|
170
|
+
if (!existsSync(parent))
|
|
171
|
+
return [];
|
|
172
|
+
return readdirSync(parent, { withFileTypes: true })
|
|
173
|
+
.filter((entry) => entry.isDirectory())
|
|
174
|
+
.map((entry) => join(parent, entry.name));
|
|
175
|
+
}
|
|
176
|
+
function nextApplications(repoRoot) {
|
|
177
|
+
const found = [];
|
|
178
|
+
for (const dir of memberDirectories(repoRoot)) {
|
|
179
|
+
const manifestPath = join(dir, 'package.json');
|
|
180
|
+
if (!existsSync(manifestPath))
|
|
181
|
+
continue;
|
|
182
|
+
let manifest;
|
|
183
|
+
try {
|
|
184
|
+
manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
// The predicate lives in `lib/workspace-packages.ts` because
|
|
190
|
+
// `check-release-intent.ts` asks the same question of the same population
|
|
191
|
+
// — which member is the reference storefront — and two copies of it are two
|
|
192
|
+
// answers waiting to disagree (feature 104, FR-001).
|
|
193
|
+
if (isNextApplication(manifest))
|
|
194
|
+
found.push(dir);
|
|
195
|
+
}
|
|
196
|
+
return [...found].sort();
|
|
197
|
+
}
|
|
198
|
+
/** Every `workspace:` range the reference storefront declares, in field order. */
|
|
199
|
+
export function workspaceRanges(manifest) {
|
|
200
|
+
const found = [];
|
|
201
|
+
for (const field of DEPENDENCY_FIELDS) {
|
|
202
|
+
const block = manifest[field];
|
|
203
|
+
if (typeof block !== 'object' || block === null)
|
|
204
|
+
continue;
|
|
205
|
+
for (const [name, declared] of Object.entries(block)) {
|
|
206
|
+
if (typeof declared !== 'string' || !declared.startsWith('workspace:'))
|
|
207
|
+
continue;
|
|
208
|
+
found.push({ field, name, declared });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return found;
|
|
212
|
+
}
|
|
213
|
+
/** Files whose text this analysis reads for outward references. */
|
|
214
|
+
const TEXTUAL = /\.(ts|tsx|mts|cts|js|jsx|mjs|cjs|json|css)$/;
|
|
215
|
+
/**
|
|
216
|
+
* Every relative declaration in the reference storefront that resolves outside
|
|
217
|
+
* it, in the three shapes an application writes one.
|
|
218
|
+
*
|
|
219
|
+
* The specifier's own leading `.` is what makes it a candidate: a bare specifier
|
|
220
|
+
* names a package and is resolved by the installer, not by this copy. A glob is
|
|
221
|
+
* resolved up to its first wildcard segment, because that prefix is the part
|
|
222
|
+
* that has to exist.
|
|
223
|
+
*/
|
|
224
|
+
export function outwardReferences(reference) {
|
|
225
|
+
const found = [];
|
|
226
|
+
for (const file of reference.files) {
|
|
227
|
+
if (!TEXTUAL.test(file))
|
|
228
|
+
continue;
|
|
229
|
+
const absolute = join(reference.dir, file);
|
|
230
|
+
if (!existsSync(absolute))
|
|
231
|
+
continue;
|
|
232
|
+
const text = readFileSync(absolute, 'utf8');
|
|
233
|
+
for (const raw of referencesIn(text)) {
|
|
234
|
+
if (!raw.specifier.startsWith('.'))
|
|
235
|
+
continue;
|
|
236
|
+
const target = resolve(dirname(absolute), globPrefix(raw.specifier));
|
|
237
|
+
if (target === reference.dir || target.startsWith(reference.dir + sep))
|
|
238
|
+
continue;
|
|
239
|
+
found.push({ file, kind: raw.kind, specifier: raw.specifier, target });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return found.sort((a, b) => a.file.localeCompare(b.file) || a.specifier.localeCompare(b.specifier));
|
|
243
|
+
}
|
|
244
|
+
/** The path prefix of a glob: everything up to the first wildcard segment. */
|
|
245
|
+
export function globPrefix(specifier) {
|
|
246
|
+
const segments = specifier.split('/');
|
|
247
|
+
const wildcard = segments.findIndex((segment) => /[*?[{]/.test(segment));
|
|
248
|
+
return wildcard === -1 ? specifier : segments.slice(0, wildcard).join('/');
|
|
249
|
+
}
|
|
250
|
+
const MODULE_SPECIFIER = /(?:^|[\s;{(=])(?:import|export)\s[^'"()]*?from\s*['"]([^'"]+)['"]|(?:^|[^\w.])(?:import|require)\(\s*['"]([^'"]+)['"]\s*\)|(?:^|[\s;{(])import\s*['"]([^'"]+)['"]/g;
|
|
251
|
+
const JSON_EXTENDS = /"extends"\s*:\s*"([^"]+)"/g;
|
|
252
|
+
const CSS_SOURCE = /@source\s+(?:not\s+)?['"]([^'"]+)['"]/g;
|
|
253
|
+
function referencesIn(text) {
|
|
254
|
+
const found = [];
|
|
255
|
+
for (const match of text.matchAll(MODULE_SPECIFIER)) {
|
|
256
|
+
const specifier = match[1] ?? match[2] ?? match[3];
|
|
257
|
+
if (specifier !== undefined)
|
|
258
|
+
found.push({ kind: 'module-specifier', specifier });
|
|
259
|
+
}
|
|
260
|
+
for (const match of text.matchAll(JSON_EXTENDS)) {
|
|
261
|
+
found.push({ kind: 'json-extends', specifier: match[1] });
|
|
262
|
+
}
|
|
263
|
+
for (const match of text.matchAll(CSS_SOURCE)) {
|
|
264
|
+
found.push({ kind: 'css-source', specifier: match[1] });
|
|
265
|
+
}
|
|
266
|
+
return found;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Every package a module's **static import and re-export statements** name,
|
|
270
|
+
* reduced to the package: `vitest/config` is `vitest`, `@scope/pkg/sub` is
|
|
271
|
+
* `@scope/pkg`. Relative specifiers and Node's own modules are not packages an
|
|
272
|
+
* installer resolves, so they are not here.
|
|
273
|
+
*
|
|
274
|
+
* Anchored at the start of a line, deliberately narrower than
|
|
275
|
+
* {@link outwardReferences}' pattern: that one looks for a path anywhere a
|
|
276
|
+
* declaration could write one, and over a configuration file it also matches
|
|
277
|
+
* the word "import" inside a rule's message string. Here a false match is a
|
|
278
|
+
* refusal of a correct scaffold, and the statements a configuration file
|
|
279
|
+
* loads its packages with are the static ones this reads.
|
|
280
|
+
*/
|
|
281
|
+
export function importedPackages(text) {
|
|
282
|
+
const found = new Set();
|
|
283
|
+
for (const match of text.matchAll(STATIC_IMPORT)) {
|
|
284
|
+
const specifier = match[1];
|
|
285
|
+
if (specifier.startsWith('.') || specifier.startsWith('/'))
|
|
286
|
+
continue;
|
|
287
|
+
if (specifier.startsWith('node:') || builtinModules.includes(specifier.split('/')[0]))
|
|
288
|
+
continue;
|
|
289
|
+
const parts = specifier.split('/');
|
|
290
|
+
found.add(specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0]);
|
|
291
|
+
}
|
|
292
|
+
return [...found].sort();
|
|
293
|
+
}
|
|
294
|
+
const STATIC_IMPORT = /^[ \t]*(?:import|export)\s+(?:[^'";]*?\sfrom\s*)?['"]([^'"]+)['"]/gm;
|
|
295
|
+
/** Every package name a manifest declares, in any dependency field. */
|
|
296
|
+
export function declaredPackages(manifest) {
|
|
297
|
+
const names = new Set();
|
|
298
|
+
for (const field of DEPENDENCY_FIELDS) {
|
|
299
|
+
const block = manifest[field];
|
|
300
|
+
if (typeof block !== 'object' || block === null)
|
|
301
|
+
continue;
|
|
302
|
+
for (const name of Object.keys(block))
|
|
303
|
+
names.add(name);
|
|
304
|
+
}
|
|
305
|
+
return names;
|
|
306
|
+
}
|
|
307
|
+
/** The file a storefront declares its environment in, and the copy carries verbatim. */
|
|
308
|
+
export const ENV_EXAMPLE_FILE = '.env.example';
|
|
309
|
+
/** The binding a storefront's declaration is exported under. */
|
|
310
|
+
export const STOREFRONT_DECLARATION_EXPORT = 'STOREFRONT_ENVIRONMENT_INPUTS';
|
|
311
|
+
/**
|
|
312
|
+
* Every declaration the file makes, in file order — the copy's own worked
|
|
313
|
+
* example of its environment.
|
|
314
|
+
*
|
|
315
|
+
* One parser, because there are two questions asked of this file and they must
|
|
316
|
+
* not come to disagree about what it says: *which of these names a backend*
|
|
317
|
+
* (below) and *what value does this file give for a name* — the second being how
|
|
318
|
+
* the acceptance criterion configures the instance it boots without carrying a
|
|
319
|
+
* list of variables of its own. A key repeated in the file keeps its last
|
|
320
|
+
* assignment, which is what every reader of a `.env` does.
|
|
321
|
+
*
|
|
322
|
+
* A blank value is **not** a declaration. `NEXT_PUBLIC_SITE_URL=` and no line at
|
|
323
|
+
* all are the same state for whoever has to supply it, and reading the first as
|
|
324
|
+
* an answer would let a consumer pass an empty string to a command whose whole
|
|
325
|
+
* subject is that nothing is invented — `inputs/env-file.ts` makes the same call
|
|
326
|
+
* for the same reason, one directory over.
|
|
327
|
+
*/
|
|
328
|
+
export function envExampleDeclarations(envExampleText) {
|
|
329
|
+
const declared = new Map();
|
|
330
|
+
for (const line of envExampleText.split('\n')) {
|
|
331
|
+
const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(line);
|
|
332
|
+
if (match === null)
|
|
333
|
+
continue;
|
|
334
|
+
const value = match[2].trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
335
|
+
if (value.length === 0) {
|
|
336
|
+
declared.delete(match[1]);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
declared.set(match[1], value);
|
|
340
|
+
}
|
|
341
|
+
return declared;
|
|
342
|
+
}
|
|
343
|
+
/** The same answer, read off a storefront directory. */
|
|
344
|
+
export function envExampleDeclarationsOf(storefrontDir) {
|
|
345
|
+
const path = join(storefrontDir, ENV_EXAMPLE_FILE);
|
|
346
|
+
if (!existsSync(path))
|
|
347
|
+
return new Map();
|
|
348
|
+
return envExampleDeclarations(readFileSync(path, 'utf8'));
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* The variables a storefront sets to name a member of its instance.
|
|
352
|
+
*
|
|
353
|
+
* **Derived from the storefront's own declaration, never written down here.**
|
|
354
|
+
* A sentence carrying the two backend names would be a copy of a fact the
|
|
355
|
+
* storefront already states, going stale the first time one is renamed (D-100),
|
|
356
|
+
* and the guidance this replaces is what that costs: it named
|
|
357
|
+
* `PUBLIC_API_BASE_URL`, which no file in the copy has ever read, so an operator
|
|
358
|
+
* who followed it got a storefront quietly talking to the fallback its fetchers
|
|
359
|
+
* compile in.
|
|
360
|
+
*
|
|
361
|
+
* **The predicate is `addressOf`, and it used to be the shape of the value.**
|
|
362
|
+
* This function read `.env.example` and answered *a declaration whose value is
|
|
363
|
+
* an absolute `http(s)` URL*, on the reasoning that a backend address is one and
|
|
364
|
+
* none of the file's other keys was. The second half stopped being true the
|
|
365
|
+
* moment the file gained the storefront's own public address: `.env.example`
|
|
366
|
+
* would then have swept `NEXT_PUBLIC_SITE_URL` in with the backend's, and
|
|
367
|
+
* `nextSteps` would have told a client — in a file they own outright and nobody
|
|
368
|
+
* revisits — that it "names the backend this storefront talks to". A confident
|
|
369
|
+
* wrong sentence is worse than the silence it replaces, and the criterion would
|
|
370
|
+
* have pointed the shop's canonical origin at its API host at the same time.
|
|
371
|
+
*
|
|
372
|
+
* So the question is asked of the declaration, which says what each value **is**
|
|
373
|
+
* rather than what it looks like. The scoping stays `.env.example`'s job for
|
|
374
|
+
* *values* (`envExampleDeclarations`, above); this is about meaning.
|
|
375
|
+
*
|
|
376
|
+
* Nothing is invented when the declaration names no address: the answer is empty
|
|
377
|
+
* and each caller says so in its own words.
|
|
378
|
+
*/
|
|
379
|
+
export function addressVariables(declared, member) {
|
|
380
|
+
return addressVariablesFor(declared, member);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* The same answer, read off a storefront directory.
|
|
384
|
+
*
|
|
385
|
+
* It loads that directory's own `environment-inputs.mjs` — the copy's, when the
|
|
386
|
+
* caller is holding a copy — through the one loader every other reader uses, so
|
|
387
|
+
* a declaration that will not parse is a refusal here as it is everywhere else.
|
|
388
|
+
* A storefront with no declaration at all is `DeclarationLoadError` and not an
|
|
389
|
+
* empty answer: that was `.env.example`'s rule, and it was right for a file that
|
|
390
|
+
* is a worked example. This one is the tree's statement of what it reads, and
|
|
391
|
+
* "absent" is not "reads nothing" (`loadTreeDeclaration`'s own header).
|
|
392
|
+
*/
|
|
393
|
+
export async function backendAddressVariablesOf(storefrontDir) {
|
|
394
|
+
const declared = await loadTreeDeclaration(storefrontDir, STOREFRONT_DECLARATION_EXPORT);
|
|
395
|
+
return addressVariables(declared, 'backend');
|
|
396
|
+
}
|
|
397
|
+
/** The variables naming the storefront's own public address, off a directory. */
|
|
398
|
+
export async function storefrontAddressVariablesOf(storefrontDir) {
|
|
399
|
+
const declared = await loadTreeDeclaration(storefrontDir, STOREFRONT_DECLARATION_EXPORT);
|
|
400
|
+
return addressVariables(declared, 'storefront');
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Every variable this storefront's own process reads, off a directory.
|
|
404
|
+
*
|
|
405
|
+
* The two functions above answer *which of these names a member* — a subset
|
|
406
|
+
* chosen by `addressOf`. This one is the whole population, scoped to the one
|
|
407
|
+
* member that runs here, and it exists because a caller that **spawns** a
|
|
408
|
+
* storefront's toolchain has to know which names in its own environment belong
|
|
409
|
+
* to the instance rather than to itself.
|
|
410
|
+
*
|
|
411
|
+
* That is not a curiosity. Next loads a `.env` and does **not** override a
|
|
412
|
+
* variable the process already carries, so any of these names present in a
|
|
413
|
+
* parent's environment silently displaces the value written into the copy's own
|
|
414
|
+
* `.env` — and a harness that passed its environment on wholesale would be
|
|
415
|
+
* measuring its own configuration while reporting on the command's. `NODE_ENV`
|
|
416
|
+
* is the case that made this real: this storefront's declaration says in as many
|
|
417
|
+
* words that its toolchain sets it and that *"setting it by hand is how a
|
|
418
|
+
* production build ends up serving development output"*, and a CI job that set
|
|
419
|
+
* it for the **backend** it booted put it on every process in the job, including
|
|
420
|
+
* a `next build` in a scaffolded instance outside the checkout.
|
|
421
|
+
*
|
|
422
|
+
* Scoped with `scopeToMembers` rather than by name, for `storefrontDeclaredInputs`'
|
|
423
|
+
* reason: a declaration may carry an input another member reads, and the question
|
|
424
|
+
* here is what *this* process reads.
|
|
425
|
+
*/
|
|
426
|
+
export async function declaredVariablesOf(storefrontDir) {
|
|
427
|
+
const declared = await loadTreeDeclaration(storefrontDir, STOREFRONT_DECLARATION_EXPORT);
|
|
428
|
+
return scopeToMembers(declared, ['storefront']).map((input) => input.name);
|
|
429
|
+
}
|
|
430
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../src/new-storefront/reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EACL,mBAAmB,EACnB,cA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,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { DEPENDENCY_FIELDS, StorefrontInputError, type OutwardReference, type StorefrontReference } from './reference.js';
|
|
2
|
+
/** An outward reference no rule below classifies. */
|
|
3
|
+
export declare class UnclassifiedReferenceError extends StorefrontInputError {
|
|
4
|
+
}
|
|
5
|
+
/** A vendored configuration imports a package the scaffold's manifest does not declare. */
|
|
6
|
+
export declare class UndeclaredImportError extends StorefrontInputError {
|
|
7
|
+
}
|
|
8
|
+
/** A file the scaffold writes: either copied bytes or rewritten text. */
|
|
9
|
+
export interface PlannedFile {
|
|
10
|
+
/** Where it lands, scaffold-relative, with `/` separators. */
|
|
11
|
+
readonly path: string;
|
|
12
|
+
/** The source it is copied from, absolute, or `null` for authored text. */
|
|
13
|
+
readonly source: string | null;
|
|
14
|
+
/** The text to write, or `null` to copy `source` byte for byte. */
|
|
15
|
+
readonly content: string | null;
|
|
16
|
+
/** What this run did to it, for the report and for `--dry-run`. */
|
|
17
|
+
readonly note: string | null;
|
|
18
|
+
}
|
|
19
|
+
/** One `workspace:` range and what it became. */
|
|
20
|
+
export interface RangeRewrite {
|
|
21
|
+
readonly field: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly from: string;
|
|
24
|
+
readonly to: string;
|
|
25
|
+
}
|
|
26
|
+
/** A file the copy leaves behind, with the reason. */
|
|
27
|
+
export interface OmittedFile {
|
|
28
|
+
readonly path: string;
|
|
29
|
+
readonly reason: string;
|
|
30
|
+
}
|
|
31
|
+
export interface StorefrontPlan {
|
|
32
|
+
readonly files: readonly PlannedFile[];
|
|
33
|
+
readonly ranges: readonly RangeRewrite[];
|
|
34
|
+
/** Every outward reference this run rewrote, with what it became. */
|
|
35
|
+
readonly rewrites: readonly (OutwardReference & {
|
|
36
|
+
readonly to: string;
|
|
37
|
+
})[];
|
|
38
|
+
readonly omitted: readonly OmittedFile[];
|
|
39
|
+
/** The registry the copy installs from, or `null` for the public one. */
|
|
40
|
+
readonly registry: string | null;
|
|
41
|
+
}
|
|
42
|
+
/** What the caller asked for beyond the copy itself. */
|
|
43
|
+
export interface PlanOptions {
|
|
44
|
+
/**
|
|
45
|
+
* The endpoint the scaffolded storefront installs `@endora-commerce/*` from.
|
|
46
|
+
*
|
|
47
|
+
* Absent is the destination and the default: no `.npmrc` at all, which is what
|
|
48
|
+
* an open-source consumer holds (`registry-and-scope.md` R3.4).
|
|
49
|
+
*/
|
|
50
|
+
readonly registry?: string | undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `workspace:<protocol>` as pnpm itself publishes it.
|
|
54
|
+
*
|
|
55
|
+
* The version comes from the named package's own manifest, so a repository that
|
|
56
|
+
* has started versioning its packages produces real ranges with no change here.
|
|
57
|
+
*/
|
|
58
|
+
export declare function publishedRange(declared: string, version: string): string;
|
|
59
|
+
/** The version a workspace member declares, or `null` when it is not a member. */
|
|
60
|
+
export declare function memberVersion(memberDirs: readonly string[], name: string): {
|
|
61
|
+
version: string;
|
|
62
|
+
dir: string;
|
|
63
|
+
} | null;
|
|
64
|
+
/** The single npm scope the workspace's `@`-scoped members publish under. */
|
|
65
|
+
export declare function workspaceScope(memberDirs: readonly string[]): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* The `packageManager` the scaffolded manifest declares.
|
|
68
|
+
*
|
|
69
|
+
* **It is a fact about the client's migration cost, not a formality**
|
|
70
|
+
* (`specs/104-package-publication/` FR-023). Measured in that feature's
|
|
71
|
+
* `research.md` §4: a pnpm lockfile records integrity and no registry, an npm
|
|
72
|
+
* lockfile records a `resolved` URL per package — so a client moving between
|
|
73
|
+
* registries edits one `.npmrc` line or regenerates their whole lockfile, and
|
|
74
|
+
* which of the two applies is decided by a field nobody had written down.
|
|
75
|
+
*
|
|
76
|
+
* The value is the checkout's own: the reference storefront's if it declares
|
|
77
|
+
* one, otherwise the repository root's, because that is the manager this
|
|
78
|
+
* repository builds and tests the reference storefront with. A checkout that
|
|
79
|
+
* declares neither is a refusal — this command invents no version, for
|
|
80
|
+
* {@link rewriteManifest}'s reason one field over: a `packageManager` corepack
|
|
81
|
+
* rejects is worse than the absent field it replaced.
|
|
82
|
+
*/
|
|
83
|
+
export declare function packageManagerFor(reference: StorefrontReference): string;
|
|
84
|
+
/** Rule 1 — the manifest, with every `workspace:` range published. */
|
|
85
|
+
export declare function rewriteManifest(reference: StorefrontReference, memberDirs: readonly string[]): {
|
|
86
|
+
text: string;
|
|
87
|
+
ranges: readonly RangeRewrite[];
|
|
88
|
+
};
|
|
89
|
+
/** What rule 2 does to one vendored configuration file. */
|
|
90
|
+
interface VendorPlan {
|
|
91
|
+
/** Where the vendored copy lands, scaffold-relative. */
|
|
92
|
+
readonly path: string;
|
|
93
|
+
/** Its text, already made standalone. */
|
|
94
|
+
readonly content: string;
|
|
95
|
+
/** What the referring file's specifier becomes. */
|
|
96
|
+
readonly specifier: string;
|
|
97
|
+
readonly note: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Rule 2 — vendor a configuration file the storefront extends, and cut the
|
|
101
|
+
* declarations that cannot come with it.
|
|
102
|
+
*
|
|
103
|
+
* The cut is derived, not listed: each of the vendored file's *own* relative
|
|
104
|
+
* references is resolved, and one whose target is outside the set being vendored
|
|
105
|
+
* is removed together with the declaration that uses it. A JSON `paths` entry
|
|
106
|
+
* and an ES import are the two shapes that occur; anything else is refused, so
|
|
107
|
+
* a base configuration that grows a third shape stops this command rather than
|
|
108
|
+
* being copied out half-rewritten.
|
|
109
|
+
*/
|
|
110
|
+
export declare function vendorConfiguration(reference: OutwardReference, storefrontDir: string, taken?: ReadonlySet<string>): VendorPlan;
|
|
111
|
+
/**
|
|
112
|
+
* Drop every `compilerOptions.paths` entry whose target leaves the scaffold.
|
|
113
|
+
*
|
|
114
|
+
* `paths` is the one declaration in a shared `tsconfig` that is repository
|
|
115
|
+
* geometry rather than compiler policy: its targets are directories under
|
|
116
|
+
* `packages/`, which a standalone storefront replaces with installed packages.
|
|
117
|
+
* Left in place they are dead configuration pointing at nothing; TypeScript
|
|
118
|
+
* falls back to node resolution and the scaffold's author is left reading a
|
|
119
|
+
* block that describes a tree they do not have.
|
|
120
|
+
*/
|
|
121
|
+
export declare function cutForeignJsonPaths(text: string, configDir: string, storefrontDir: string): {
|
|
122
|
+
text: string;
|
|
123
|
+
dropped: readonly string[];
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Drop an ES import whose target leaves the scaffold, and the statements that
|
|
127
|
+
* use what it bound.
|
|
128
|
+
*
|
|
129
|
+
* Deliberately narrow: it removes the import line and any *expression statement*
|
|
130
|
+
* that is a bare call of a removed binding, which is the shape a configuration
|
|
131
|
+
* file's side-effecting guard takes. A removed binding used anywhere else is a
|
|
132
|
+
* refusal — rewriting an expression is not something this command does, and
|
|
133
|
+
* emitting a configuration with a dangling identifier would be worse than
|
|
134
|
+
* stopping.
|
|
135
|
+
*/
|
|
136
|
+
export declare function cutForeignImports(text: string, fileDir: string, storefrontDir: string): {
|
|
137
|
+
text: string;
|
|
138
|
+
dropped: readonly string[];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Rule 3 — a glob naming the workspace's package tree, retargeted at where a
|
|
142
|
+
* standalone application finds those packages.
|
|
143
|
+
*
|
|
144
|
+
* `null` when the glob names something else, so the caller refuses it rather
|
|
145
|
+
* than this function guessing.
|
|
146
|
+
*/
|
|
147
|
+
export declare function retargetPackageGlob(reference: OutwardReference, repoRoot: string, memberDirs: readonly string[], referringFileDir: string, scaffoldDir: string): string | null;
|
|
148
|
+
/**
|
|
149
|
+
* The directories the application's **test** configuration collects from.
|
|
150
|
+
*
|
|
151
|
+
* This is the population rule 4 may omit a file from, and it is derived from the
|
|
152
|
+
* test runner's own `include` globs rather than from a path convention —
|
|
153
|
+
* `test/` is this storefront's name for it and the next one's may not be.
|
|
154
|
+
*
|
|
155
|
+
* **It fails closed on purpose.** An application with no readable test
|
|
156
|
+
* configuration has no test population, so every outward reference rule 4 reaches
|
|
157
|
+
* is a refusal. The other way round — treating "I could not tell" as "not
|
|
158
|
+
* application code" — is how a file that genuinely reaches into the platform
|
|
159
|
+
* repository gets dropped out of a client's storefront in silence, which is the
|
|
160
|
+
* defect this command exists to refuse one layer up.
|
|
161
|
+
*/
|
|
162
|
+
export declare function testRoots(reference: StorefrontReference): readonly string[];
|
|
163
|
+
/**
|
|
164
|
+
* The whole plan: every file the scaffold writes, and what each rewrite did.
|
|
165
|
+
*
|
|
166
|
+
* @param scaffoldDir where the copy will live, used only to express a retargeted
|
|
167
|
+
* glob relative to the file that writes it.
|
|
168
|
+
*/
|
|
169
|
+
export declare function planStorefront(reference: StorefrontReference, memberDirs: readonly string[], scaffoldDir: string, options?: PlanOptions): StorefrontPlan;
|
|
170
|
+
export { DEPENDENCY_FIELDS };
|
|
171
|
+
//# sourceMappingURL=rewrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../src/new-storefront/rewrite.ts"],"names":[],"mappings":"AA4DA,OAAO,EAEL,iBAAiB,EAIjB,oBAAoB,EAEpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,qDAAqD;AACrD,qBAAa,0BAA2B,SAAQ,oBAAoB;CAAG;AAEvE,2FAA2F;AAC3F,qBAAa,qBAAsB,SAAQ,oBAAoB;CAAG;AAElE,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,iDAAiD;AACjD,MA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