An open source design system that's fully customizable and agent ready
TypeScript
fix(cli): swizzle carries another Astryx package's internal modules, except exported StyleX modules (#10595)
Cindy Zhang72968acd8272
diff --git a/.changeset/swizzle-cross-package-internals.md b/.changeset/swizzle-cross-package-internals.mdnew file mode 100644index 0000000000..9cdda1e546--- /dev/null+++ b/.changeset/swizzle-cross-package-internals.md@@ -0,0 +1,7 @@+---+'@astryxdesign/cli': patch+---++[fix] A swizzled component whose source imports another Astryx package's internal module, such as a Lab component that uses Core's gesture primitives, no longer imports that private path, except a StyleX module that package exports, which the copy keeps importing by that path because its identity is its path. Swizzle carries every other such module, and what it reaches, into the copy under a folder named after its package (for example `components/astryx/core/internal/touch.ts`); that package's public names are still imported from the package.++@cixzhangdiff --git a/docs/architecture/public-component-api.md b/docs/architecture/public-component-api.mdindex 71826820eb..406d4306c9 100644--- a/docs/architecture/public-component-api.md+++ b/docs/architecture/public-component-api.md@@ -170,7 +170,9 @@ guidance owns the process used to propose and test APIs.calls it internal. Privacy requires removing the export or moving the capabilitybehind a non-exported boundary. Core's `./internal/*` subpaths are the oneexception: reachable, but reserved for Core and Lab, undocumented, versioned- in lockstep with Core, limited by lint to those two packages, and outside+ in lockstep with Core, limited by lint to those two packages, and imported+ by a swizzled copy only for an exported StyleX module whose identity is its+ path (`spec:AST-110` FR1), and outsidethe compatibility promise (`spec:AST-017` FR21).- **INV13 — Public deltas route to their authority owner.** Every public API updateand every public behavior change follows the result and disposition defined bydiff --git a/docs/specs/AST-017/spec.md b/docs/specs/AST-017/spec.mdindex cdb9eed671..29a6d44ab1 100644--- a/docs/specs/AST-017/spec.md+++ b/docs/specs/AST-017/spec.md@@ -396,7 +396,7 @@ one removal merged ahead of the decision to allow it.never exported, as experimental or otherwise, except through Core's`./internal/*` subpaths, which are reserved for Astryx's own packages,undocumented, outside the compatibility promise, versioned in lockstep with- Core, and limited by lint to Core and Lab (`architecture:react-component-runtime` INV13). In Core, an experimental public+ Core, and limited by lint to Core and Lab (`architecture:react-component-runtime` INV13); a swizzled copy of a Lab component also keeps importing a StyleX module Core exports there, since its identity is its path (`spec:AST-110` FR1). In Core, an experimental publicAPI's status isvisible at the call site where it is used, carried by the name the callerwrites, not only in docs, declarations, or a file path; a component's@@ -927,35 +927,35 @@ lands, maintainers apply its requirement in review and release approval.## Verification-| Contract | Verification | Representative states | Mutation or failure expectation |-| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| FR1–FR3 | PR compatibility statement plus latest stable package inspection | released export, narrowed type, changed interaction default; unreleased and private surface; visual-only spacing, typography, layout styling, or default appearance; a new touch presentation or open-surface touch mode as a default | A change is labeled from diff size or possibility alone, a functional contract loss is hidden as visual-only, or a pixel-only change is tagged `[breaking]` even though callers need no source or configuration change, or such a touch default names no `presentation` value that restores the previous surface and mode |-| FR4–FR6 | Old-usage type/runtime/CLI regression test | alias retained, deprecation warning, broad rewrite, low-adoption caller | Contractual old usage fails despite a nonbreaking label, or risk is substituted for compatibility |-| FR7–FR8 | `pnpm check:changesets` (tag, bump, contributors, declared tier) plus FR8 migration review of `[breaking]` text | existing `[fix]`, `[feat]`, `[breaking]`, and `[experimental]` tags paired with compatible, deprecation, planned-removal, or incompatible-fix metadata | A new lifecycle replaces an established tag, tag/metadata/bump diverge, an incompatible correction uses bare `[fix]`, or migration is unusable |-| FR9–FR13 | CLI contract tests, response-schema/type snapshots, text projections, generated consumer docs, and template catalog/output tests | slug rename, metadata edit, source rebuild, optional field addition, command or schema change | Catalog data is frozen as API, a command/schema incompatibility is mislabeled as catalog-only, or a response field lacks a complete projection |-| FR12 | Minimum and representative supported-version tests plus manifest and release-note review | retained range, narrowed range, adapter, coordinated upgrade | An in-range combination breaks under a nonbreaking label, or release coordination hides the affected package or migration |-| FR14 | Help/manifest snapshots, public API and consumer docs, and focused contract tests | command, option, API/config, private rollout/test hook | Supported behavior is hidden, an environment variable changes behavior, or automation lacks a documented API |-| FR15 | Full manifest-derived command matrix, supported-consumer evidence, and scope-specific contract tests | global invariant, scoped command group, single command, programmatic API | A global control is a no-op for any command, has different meanings, or replaces a narrower owning surface |-| FR16–FR18 | Boundary inventory, hostile side-effect probes, response snapshots, and concurrent API tests | known and new extension, partial result, text/JSON/API parity, independent concurrent calls | A route bypasses the guarantee, omitted work looks complete, or one invocation changes another |-| FR19–FR20 | Proposal evidence with a regression fixture for the detection failure, plus composition and provenance tests | convention covers the case, detection fails, app plus two integrations, refusal, failing contribution, repeated load | A key ships without a reproduced detection failure, a contribution displaces the app or applies twice, a part of the effective value has no inspectable source, or a failure silently weakens protection |-| FR21–FR24 | Published-surface comparison, declaration/doc metadata checks, import-boundary checks, and Changeset classification review | experimental prop object, experimental subpath, patch evolution, promotion, unpublished adjacent field, stable warning behavior, integration theme; a component or module `/experimental` subpath; an `_experimental` export; a behavior module; an `./internal/*` subpath imported from Core, from Lab, and from another package | A prose-only marker excludes a stable API, adjacency falsely publishes a new field, an experimental export leaks through a stable path, a patch changes stable behavior, or a promoted API remains unprotected, a file path or subpath alone marks a surface experimental, a behavior, utility, or internal module without a public contract is exported other than through `./internal/*`, an `./internal/*` subpath is documented or imported outside Core and Lab, or an experimental public API in Core does not show its status at the call site in the name the caller writes |-| FR25–FR27 | Stable-surface inventory and experimental-boundary matrix | package/API, CSS/token, CLI/config, persistence, build tooling, docs, whole Lab component | An unmarked experiment changes stable defaults or a stable surface bypasses compatibility review |-| FR28–FR31 | Declared-tier check: on a minor, the `[breaking]` Changeset describes the change (old usage, replacement, migration); on a patch, a breaking Changeset is refused and the deprecation ships instead; declaration/doc/build/CLI warning projections; old/new fixtures; dry-run/idempotence/migration tests; maintained-source and latest-stable upgrade evidence | whole component, prop/value, theme field/helper/token/target/source, CLI command, CLI option; old-only, new-only, both, static/dynamic/uncertain migration, text/JSON, development/production | A warning has no usable modernization route, production runtime changes for deprecation, maintained guidance teaches the old surface, a migration guesses, old behavior degrades early, cadence invents a wait, or one cleanup id covers multiple incompatible deltas |-| FR32–FR35 | Latest-stable victim fixture, pre-existing authority named in the Changeset or pull request, owner review, declared-tier check, and emergency attestation | victim-free `[fix]`, `[fix]` plus incompatible-fix metadata, coexistence, cleanup transition, critical-harm emergency | A released victim uses bare `[fix]`, a new Changeset tag replaces metadata, a correction record disagrees with its public-surface state, or urgency bypasses migration |-| FR36–FR40 | Owner-declared target, locked final-patch receipt, three-way delta classification against the merged `[breaking]` Changesets, and separated release notes | ordinary cadence, immediate pair, cleanup, release metadata, pre/post-lock compatible fix | Cadence becomes eligibility, the final patch is recut for bookkeeping, a feature or incompatible fix enters the incidental-fix lane, or release notes merge cleanup with fixes |-| FR41–FR44 | Schema validation, PR declaration, semantic stable/base/head comparisons, exact-main gate, and immutable publish/rollback receipt | duplicate ids, missing evidence, route/schema removal, old-client metadata, partial publish, safe rollback | A label passes without semantics, a delta maps zero or multiple times, fixed-group membership drifts, or a release rebuilds under one identity |-| FR45 | Docs route inventory, repository-reference checks, and Changeset review | catalog entry rename, former-route miss, stable command and JSON schema | Catalog routing is frozen as API, or a rename silently changes the contractual command or response schema |-| FR46–FR47 | Declared-tier Changeset admission, canary publication ordering and cadence, and release-versioning fixtures | owner increase/decrease, above/equal/below stable, split group, `[breaking]` on patch and minor plans, hourly, on-demand and already-published canary runs | Pending Changesets derive the plan, `[breaking]` passes on a patch or fails on a minor, equality publishes a canary, a lower/split declaration publishes instead of failing, a canary publishes on every push, or a tip whose canaries are all published publishes again |-| FR48 | Category and classification admission under each declared tier | patch release with `[breaking]`, patch release with a deprecation, minor release with `[breaking]` | Incompatible work passes in a patch release, or a deprecation is refused in one |-| FR49 | Malformed and inconsistent declaration fixtures | disagreeing group versions, canary identifier, release version unlike the cut manifest, already-released version, skipped version, no stable tag | An untrustworthy or mismatched declaration is released |-| FR50 | Three-way squash merge-back fixtures bound to the immutable tag, branch head, and plan digest | exact branch outputs, frozen deletion, branch-only marker exclusion, post-cut Changeset/manifest edit, newer main declaration, merge conflict, regenerated output | Merge-back differs from release bytes, lands lifecycle files, consumes post-cut work, overwrites a newer main declaration or unrelated field, or chooses a version |-| FR51 | Cut-time successor-plan preparation plus manifest/pin/lockfile/compatibility-asset and lifecycle fixtures | default patch successor, explicitly named minor, abort before any tag or publication, immutable tag before merge-back, pre-advanced main plan, unrelated main work during equality | The plan merges before the cut version is non-reusable, survives a terminal cut with neither an immutable tag nor stable publication, skips the default patch, derives a minor from pending Changesets, splits pins/assets, or the prepared plan or merge-back lowers or duplicates an existing newer plan |-| FR52 | Promotion fixtures plus every checked-in source consumer run before and after codemod promotion | staged transform, promoted transform, missing source, ambiguous candidates, changed entry identity | Evidence hardcodes only `next/`, keeps a duplicate source, silently chooses among candidates, or passes when the promoted transform no longer exposes the same identity and entries |-| FR53 | Changeset classification review against the governing component record's accessibility evidence | a fix that replaces documented keyboard or focus behavior to meet an adopted APG pattern's required parts; a fix that changes a role, state, or accessible name to meet WCAG 2.2 A/AA; a fix that adds an optional prop | An accessibility fix is held for a minor, given a coexistence path, or classified `[breaking]`; or a change that needs an app-layer code edit, or that removes, renames, or narrows public surface, ships as an accessibility `[fix]` |-| FR54 | Changeset classification review against the surface's current record, then the same tier admission every Changeset receives | a CLI correction the CLI record classifies as `[fix]`; a CLI change the CLI record leaves undecided; a CLI change the CLI record classifies as `[breaking]` on a patch plan; a component change | A non-component change is classified by a rule this record restates instead of its surface record, a surface rule turns on risk or adoption, a surface-classified `[breaking]` change ships in a patch or a surface rule makes it patch-eligible, or a component change is classified by a surface record |-| FR59 | Pull request review of fine-pointer before-and-after evidence | a touch change that also fixes a defect fine-pointer users hit; a deliberate cross-device consistency change; a touch-only change; a new fine-pointer look proposed with touch work | A touch change alters fine-pointer behavior or appearance with neither reason, shows no fine-pointer before-and-after evidence, or ships a new fine-pointer look without its own owner decision |-| FR60 | Element counts per story at rest and open, fine and coarse pointer, against architecture INV7 | a surface component at rest; an open layer; a DOM reduction; a recorded exception; an open layer under touch with extra elements | An element beyond INV7's budgets with no recorded owner exception, a hidden twin or second presentation, or a DOM reduction that removes a theme target or documented anatomy, or that is classified as breaking; an open layer more than 5 elements over its fine-pointer count, an added element that is themeable, a new anatomy part, or without a job in its record, or a closed layer, trigger, or repeated component above its fine-pointer count |-| FR3 | Current component contract, latest-stable inspection, and coarse/non-coarse browser evidence | Auxiliary numeric steppers hidden with accessible direct entry and keyboard stepping retained; lost entry path; removed public prop or essential action | A qualifying numeric-stepper adaptation is labeled breaking, or the narrow rule is used to excuse a lost API, essential action, value/validation/callback contract, or accessible entry path |+| Contract | Verification | Representative states | Mutation or failure expectation |+| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| FR1–FR3 | PR compatibility statement plus latest stable package inspection | released export, narrowed type, changed interaction default; unreleased and private surface; visual-only spacing, typography, layout styling, or default appearance; a new touch presentation or open-surface touch mode as a default | A change is labeled from diff size or possibility alone, a functional contract loss is hidden as visual-only, or a pixel-only change is tagged `[breaking]` even though callers need no source or configuration change, or such a touch default names no `presentation` value that restores the previous surface and mode |+| FR4–FR6 | Old-usage type/runtime/CLI regression test | alias retained, deprecation warning, broad rewrite, low-adoption caller | Contractual old usage fails despite a nonbreaking label, or risk is substituted for compatibility |+| FR7–FR8 | `pnpm check:changesets` (tag, bump, contributors, declared tier) plus FR8 migration review of `[breaking]` text | existing `[fix]`, `[feat]`, `[breaking]`, and `[experimental]` tags paired with compatible, deprecation, planned-removal, or incompatible-fix metadata | A new lifecycle replaces an established tag, tag/metadata/bump diverge, an incompatible correction uses bare `[fix]`, or migration is unusable |+| FR9–FR13 | CLI contract tests, response-schema/type snapshots, text projections, generated consumer docs, and template catalog/output tests | slug rename, metadata edit, source rebuild, optional field addition, command or schema change | Catalog data is frozen as API, a command/schema incompatibility is mislabeled as catalog-only, or a response field lacks a complete projection |+| FR12 | Minimum and representative supported-version tests plus manifest and release-note review | retained range, narrowed range, adapter, coordinated upgrade | An in-range combination breaks under a nonbreaking label, or release coordination hides the affected package or migration |+| FR14 | Help/manifest snapshots, public API and consumer docs, and focused contract tests | command, option, API/config, private rollout/test hook | Supported behavior is hidden, an environment variable changes behavior, or automation lacks a documented API |+| FR15 | Full manifest-derived command matrix, supported-consumer evidence, and scope-specific contract tests | global invariant, scoped command group, single command, programmatic API | A global control is a no-op for any command, has different meanings, or replaces a narrower owning surface |+| FR16–FR18 | Boundary inventory, hostile side-effect probes, response snapshots, and concurrent API tests | known and new extension, partial result, text/JSON/API parity, independent concurrent calls | A route bypasses the guarantee, omitted work looks complete, or one invocation changes another |+| FR19–FR20 | Proposal evidence with a regression fixture for the detection failure, plus composition and provenance tests | convention covers the case, detection fails, app plus two integrations, refusal, failing contribution, repeated load | A key ships without a reproduced detection failure, a contribution displaces the app or applies twice, a part of the effective value has no inspectable source, or a failure silently weakens protection |+| FR21–FR24 | Published-surface comparison, declaration/doc metadata checks, import-boundary checks, and Changeset classification review | experimental prop object, experimental subpath, patch evolution, promotion, unpublished adjacent field, stable warning behavior, integration theme; a component or module `/experimental` subpath; an `_experimental` export; a behavior module; an `./internal/*` subpath imported from Core, from Lab, and from another package; a swizzled copy's import of an exported `./internal/*.stylex` module | A prose-only marker excludes a stable API, adjacency falsely publishes a new field, an experimental export leaks through a stable path, a patch changes stable behavior, or a promoted API remains unprotected, a file path or subpath alone marks a surface experimental, a behavior, utility, or internal module without a public contract is exported other than through `./internal/*`, an `./internal/*` subpath is documented or imported outside Core and Lab other than a swizzled copy's exported StyleX module (FR21), or an experimental public API in Core does not show its status at the call site in the name the caller writes |+| FR25–FR27 | Stable-surface inventory and experimental-boundary matrix | package/API, CSS/token, CLI/config, persistence, build tooling, docs, whole Lab component | An unmarked experiment changes stable defaults or a stable surface bypasses compatibility review |+| FR28–FR31 | Declared-tier check: on a minor, the `[breaking]` Changeset describes the change (old usage, replacement, migration); on a patch, a breaking Changeset is refused and the deprecation ships instead; declaration/doc/build/CLI warning projections; old/new fixtures; dry-run/idempotence/migration tests; maintained-source and latest-stable upgrade evidence | whole component, prop/value, theme field/helper/token/target/source, CLI command, CLI option; old-only, new-only, both, static/dynamic/uncertain migration, text/JSON, development/production | A warning has no usable modernization route, production runtime changes for deprecation, maintained guidance teaches the old surface, a migration guesses, old behavior degrades early, cadence invents a wait, or one cleanup id covers multiple incompatible deltas |+| FR32–FR35 | Latest-stable victim fixture, pre-existing authority named in the Changeset or pull request, owner review, declared-tier check, and emergency attestation | victim-free `[fix]`, `[fix]` plus incompatible-fix metadata, coexistence, cleanup transition, critical-harm emergency | A released victim uses bare `[fix]`, a new Changeset tag replaces metadata, a correction record disagrees with its public-surface state, or urgency bypasses migration |+| FR36–FR40 | Owner-declared target, locked final-patch receipt, three-way delta classification against the merged `[breaking]` Changesets, and separated release notes | ordinary cadence, immediate pair, cleanup, release metadata, pre/post-lock compatible fix | Cadence becomes eligibility, the final patch is recut for bookkeeping, a feature or incompatible fix enters the incidental-fix lane, or release notes merge cleanup with fixes |+| FR41–FR44 | Schema validation, PR declaration, semantic stable/base/head comparisons, exact-main gate, and immutable publish/rollback receipt | duplicate ids, missing evidence, route/schema removal, old-client metadata, partial publish, safe rollback | A label passes without semantics, a delta maps zero or multiple times, fixed-group membership drifts, or a release rebuilds under one identity |+| FR45 | Docs route inventory, repository-reference checks, and Changeset review | catalog entry rename, former-route miss, stable command and JSON schema | Catalog routing is frozen as API, or a rename silently changes the contractual command or response schema |+| FR46–FR47 | Declared-tier Changeset admission, canary publication ordering and cadence, and release-versioning fixtures | owner increase/decrease, above/equal/below stable, split group, `[breaking]` on patch and minor plans, hourly, on-demand and already-published canary runs | Pending Changesets derive the plan, `[breaking]` passes on a patch or fails on a minor, equality publishes a canary, a lower/split declaration publishes instead of failing, a canary publishes on every push, or a tip whose canaries are all published publishes again |+| FR48 | Category and classification admission under each declared tier | patch release with `[breaking]`, patch release with a deprecation, minor release with `[breaking]` | Incompatible work passes in a patch release, or a deprecation is refused in one |+| FR49 | Malformed and inconsistent declaration fixtures | disagreeing group versions, canary identifier, release version unlike the cut manifest, already-released version, skipped version, no stable tag | An untrustworthy or mismatched declaration is released |+| FR50 | Three-way squash merge-back fixtures bound to the immutable tag, branch head, and plan digest | exact branch outputs, frozen deletion, branch-only marker exclusion, post-cut Changeset/manifest edit, newer main declaration, merge conflict, regenerated output | Merge-back differs from release bytes, lands lifecycle files, consumes post-cut work, overwrites a newer main declaration or unrelated field, or chooses a version |+| FR51 | Cut-time successor-plan preparation plus manifest/pin/lockfile/compatibility-asset and lifecycle fixtures | default patch successor, explicitly named minor, abort before any tag or publication, immutable tag before merge-back, pre-advanced main plan, unrelated main work during equality | The plan merges before the cut version is non-reusable, survives a terminal cut with neither an immutable tag nor stable publication, skips the default patch, derives a minor from pending Changesets, splits pins/assets, or the prepared plan or merge-back lowers or duplicates an existing newer plan |+| FR52 | Promotion fixtures plus every checked-in source consumer run before and after codemod promotion | staged transform, promoted transform, missing source, ambiguous candidates, changed entry identity | Evidence hardcodes only `next/`, keeps a duplicate source, silently chooses among candidates, or passes when the promoted transform no longer exposes the same identity and entries |+| FR53 | Changeset classification review against the governing component record's accessibility evidence | a fix that replaces documented keyboard or focus behavior to meet an adopted APG pattern's required parts; a fix that changes a role, state, or accessible name to meet WCAG 2.2 A/AA; a fix that adds an optional prop | An accessibility fix is held for a minor, given a coexistence path, or classified `[breaking]`; or a change that needs an app-layer code edit, or that removes, renames, or narrows public surface, ships as an accessibility `[fix]` |+| FR54 | Changeset classification review against the surface's current record, then the same tier admission every Changeset receives | a CLI correction the CLI record classifies as `[fix]`; a CLI change the CLI record leaves undecided; a CLI change the CLI record classifies as `[breaking]` on a patch plan; a component change | A non-component change is classified by a rule this record restates instead of its surface record, a surface rule turns on risk or adoption, a surface-classified `[breaking]` change ships in a patch or a surface rule makes it patch-eligible, or a component change is classified by a surface record |+| FR59 | Pull request review of fine-pointer before-and-after evidence | a touch change that also fixes a defect fine-pointer users hit; a deliberate cross-device consistency change; a touch-only change; a new fine-pointer look proposed with touch work | A touch change alters fine-pointer behavior or appearance with neither reason, shows no fine-pointer before-and-after evidence, or ships a new fine-pointer look without its own owner decision |+| FR60 | Element counts per story at rest and open, fine and coarse pointer, against architecture INV7 | a surface component at rest; an open layer; a DOM reduction; a recorded exception; an open layer under touch with extra elements | An element beyond INV7's budgets with no recorded owner exception, a hidden twin or second presentation, or a DOM reduction that removes a theme target or documented anatomy, or that is classified as breaking; an open layer more than 5 elements over its fine-pointer count, an added element that is themeable, a new anatomy part, or without a job in its record, or a closed layer, trigger, or repeated component above its fine-pointer count |+| FR3 | Current component contract, latest-stable inspection, and coarse/non-coarse browser evidence | Auxiliary numeric steppers hidden with accessible direct entry and keyboard stepping retained; lost entry path; removed public prop or essential action | A qualifying numeric-stepper adaptation is labeled breaking, or the narrow rule is used to excuse a lost API, essential action, value/validation/callback contract, or accessible entry path |## Decision logdiff --git a/docs/specs/AST-110-swizzle-output/spec.md b/docs/specs/AST-110-swizzle-output/spec.mdindex a245f6f7ca..65aeb87218 100644--- a/docs/specs/AST-110-swizzle-output/spec.md+++ b/docs/specs/AST-110-swizzle-output/spec.md@@ -64,13 +64,17 @@ and the repository proves it before a change that could break it merges.Core version and a StyleX compiler, the output of`astryx swizzle <Name>` type-checks and bundles with no edits. It imports fromits owner package only paths that package's `exports` lists, and never a- `./internal/*` path. The npm packages the copied files import are the owner+ `./internal/*` path, except a StyleX module that another Astryx package+ exports under `./internal/` in its package exports, which the copy keeps+ importing by that exported path, since its identity is its path. The npm packages the copied files import are the ownerpackage's own dependencies; swizzle reports each one with the version range theowner package declares, and the copy builds once the product installs them.- **FR2 — The helpers it needs come with it.** Every module the componentreaches that is not reachable through a public export is copied into theoutput, keeping its folder layout relative to the component, and copied files- import each other by relative path. A symbol the owner package exports publicly+ import each other by relative path. A module from another Astryx package goes+ under a folder named after that package, at its path in that package's+ source. A symbol the owner package exports publiclyis imported from that public path. Nested folders the component imports arecopied with it. The output holds only source the component runs: tests,stories, spec records, and component docs are not copied. When a helper the@@ -216,7 +220,7 @@ and the repository proves it before a change that could break it merges.| Contract | Verification | Representative states | Mutation or failure expectation || -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| FR1 | Eject every offered component into a clean project; type-check and bundle | Every component in `swizzle --list`; Core, Lab, Charts, RichText, Vega; a component that imports an npm dependency | A type or resolve error, or an import of a path the owner's `exports` lacks or of `./internal/*`, fails, or a dependency the copy imports goes unreported |+| FR1 | Eject every offered component into a clean project; type-check and bundle | Every component in `swizzle --list`; Core, Lab, Charts, RichText, Vega; a component that imports an npm dependency | A type or resolve error, or an import of a path the owner's `exports` lacks or of `./internal/*`, other than a StyleX module another Astryx package exports there (FR1), fails, or a dependency the copy imports goes unreported || FR2 | Import graph of each output | Helpers in `utils`, `hooks`, `Layer`; nested folders; colocated tests and docs; a helper an earlier swizzle wrote, identical and different | A copied file imports a module that is neither in the output nor a public export, or a test, story, spec, or doc is copied, or an existing helper other than an owner module (FR4) is overwritten || FR3 | Render a copied and a package layer component together; inspect stores; open, stack, and Escape | Dialog over package Popover; BottomSheet over package Dialog; modality; a copied `useToast` under the package `LayerProvider`; a symbol-branded object passed between copy and package; a copied Dialog announcing beside a package component; a package picker inside a copied Dialog announcing a result count; a package grouped control inside a copied overlay | In either direction (copy under package, package under copy): two stores of one protocol version exist in a document, Escape and focus return differ from the package alone, a copied consumer misses the package provider, a brand check fails, a second live region appears instead of one announcer (`spec:AST-086` FR9), an announcement escapes the open modal (`spec:AST-086` FR14), or group context crosses the layer boundary (`spec:AST-038` FR7) || FR3 | `sharedContexts.test.tsx` "gives each React its own context under a key, and one per React": a second React instance loads a copy of the shared-context module | Two copies on one React; a copy on a second React in the same process | Two copies on one React getting different contexts, or a copy on a second React getting the same context object, fails |diff --git a/packages/cli/api/swizzle/_moduleGraph.mjs b/packages/cli/api/swizzle/_moduleGraph.mjsindex 7d4794a624..d2b2ea6804 100644--- a/packages/cli/api/swizzle/_moduleGraph.mjs+++ b/packages/cli/api/swizzle/_moduleGraph.mjs@@ -14,6 +14,7 @@ import * as fs from 'node:fs';import * as path from 'node:path';import {isBuiltin} from 'node:module';import {packageOf} from '../../foundation/render/served-packages.mjs';+import {resolveInstalledPackageDir} from '../../foundation/integrations/installed-package.mjs';import {parse} from '@babel/parser';import {inspectPackageExport,@@ -390,6 +391,8 @@ function publicSurfaceOf(packageDir, srcRoot, originsOf) {* file the copy holds (absolute source path), with the edits its imports need* @property {Map<string, Set<string>>} dependsOn file -> carried files its* computed specifiers point at+ * @property {Map<string, string>} otherPackages the source root of each other+ * Astryx package the copy carries modules from, with its package name* @property {Record<string, string>} dependencies each npm package the copied* files import, other than the owner package and Node's built-in modules,* with the range the owner package declares@@ -429,19 +432,6 @@ export function planCopy({});/** @param {string} file @param {string} name */const originOf = (file, name) => originsOf(file, 'type').get(name) ?? null;- /**- * The subpaths that export a module's export: as a value when the import- * takes a value, since a type-only export is erased at runtime.- * @param {string} file- * @param {string} name- * @param {boolean} typeOnly- */- const exportersOf = (file, name, typeOnly) => {- const origin = originOf(file, name);- if (!origin) return [];- const kind = typeOnly ? 'type' : 'value';- return surface.byOrigin[kind].get(`${origin.file}#${origin.name}`) ?? [];- };/*** The name a module exports one of its own bindings under, or null.* @param {{file: string, name: string}} origin@@ -454,7 +444,6 @@ export function planCopy({};/** @type {Map<string, string|null>} */const resolutions = new Map();- const surface = publicSurfaceOf(packageDir, srcRoot, originsOf);/** @type {CopyPlan['files']} */const files = new Map();/** @type {CopyPlan['dependsOn']} */@@ -472,73 +461,162 @@ export function planCopy({};/** @param {string} file */const inComponent = file => file.startsWith(componentDir + path.sep);- /** @param {string} file */- const inSource = file => file.startsWith(srcRoot + path.sep);/**- * The subpath that exports every name a module exports, with the same- * definition. An exactly exported file is its own subpath.- * @param {string} file- * @returns {string|null}+ * @typedef {ReturnType<typeof makeContext>} PackageContext*/- const subpathCoveringModule = file => {- const exact = surface.byFile.get(file);- if (exact) return exact;- const names = [...originsOf(file, 'type').keys()];- if (names.length === 0) return null;- const values = originsOf(file, 'value');- const options = names.map(name =>- exportersOf(file, name, !values.has(name))- .filter(o => o.name === name)- .map(o => o.subpath),- );- const common = options.reduce((acc, list) =>- acc.filter(s => list.includes(s)),- );- return STYLEX_FILE.test(file) ? null : pickSubpath(common, file);- };/**- * The public subpath to take a name from. A StyleX module is imported by- * its own exported path, because the StyleX compiler resolves styles and- * variables from the real module; when that path is not exported, there is- * no public import.- * @param {string[]} subpaths subpaths that export the name- * @param {string} target the module the import names- * @param {string} [originFile] the module that defines the name- * @returns {string|null}+ * How references inside one package's source are planned: its public+ * surface and the subpaths a name or module is imported from.+ * @param {{packageDir: string, srcRoot: string, ownerPackage: string}} pkg*/- const choosePublic = (subpaths, target, originFile) => {- const exact = originFile ? surface.byFile.get(originFile) : undefined;- if (exact && subpaths.includes(exact)) return exact;- if (- STYLEX_FILE.test(target) ||- (originFile && STYLEX_FILE.test(originFile))- )- return null;- return pickSubpath(subpaths, target);+ function makeContext({packageDir, srcRoot, ownerPackage}) {+ const surface = publicSurfaceOf(packageDir, srcRoot, originsOf);+ /** @param {string} file */+ const inSource = file => file.startsWith(srcRoot + path.sep);+ /**+ * The subpaths that export a module's export: as a value when the import+ * takes a value, since a type-only export is erased at runtime.+ * @param {string} file+ * @param {string} name+ * @param {boolean} typeOnly+ */+ const exportersOf = (file, name, typeOnly) => {+ const origin = originOf(file, name);+ if (!origin) return [];+ const kind = typeOnly ? 'type' : 'value';+ return surface.byOrigin[kind].get(`${origin.file}#${origin.name}`) ?? [];+ };+ /**+ * The subpath that exports every name a module exports, with the same+ * definition. An exactly exported file is its own subpath.+ * @param {string} file+ * @returns {string|null}+ */+ const subpathCoveringModule = file => {+ const exact = surface.byFile.get(file);+ if (exact) return exact;+ const names = [...originsOf(file, 'type').keys()];+ if (names.length === 0) return null;+ const values = originsOf(file, 'value');+ const options = names.map(name =>+ exportersOf(file, name, !values.has(name))+ .filter(o => o.name === name)+ .map(o => o.subpath),+ );+ const common = options.reduce((acc, list) =>+ acc.filter(s => list.includes(s)),+ );+ return STYLEX_FILE.test(file) ? null : pickSubpath(common, file);+ };++ /**+ * The public subpath to take a name from. A StyleX module is imported by+ * its own exported path, because the StyleX compiler resolves styles and+ * variables from the real module; when that path is not exported, there is+ * no public import.+ * @param {string[]} subpaths subpaths that export the name+ * @param {string} target the module the import names+ * @param {string} [originFile] the module that defines the name+ * @returns {string|null}+ */+ const choosePublic = (subpaths, target, originFile) => {+ const exact = originFile ? surface.byFile.get(originFile) : undefined;+ if (exact && subpaths.includes(exact)) return exact;+ if (+ STYLEX_FILE.test(target) ||+ (originFile && STYLEX_FILE.test(originFile))+ )+ return null;+ return pickSubpath(subpaths, target);+ };++ /**+ * Prefer the subpath of the module's top folder, then the package root.+ * @param {string[]} subpaths+ * @param {string} file+ * @returns {string|null}+ */+ const pickSubpath = (subpaths, file) => {+ if (subpaths.length === 0) return null;+ const top = `./${toPosix(path.relative(srcRoot, file)).split('/')[0]}`;+ return (+ subpaths.find(s => s === top) ??+ subpaths.find(s => s === '.') ??+ [...subpaths].sort((a, b) => a.length - b.length)[0]+ );+ };++ /** @param {string} subpath */+ const publicSpecifier = subpath =>+ subpath === '.' ? ownerPackage : `${ownerPackage}/${subpath.slice(2)}`;++ return {+ packageDir,+ srcRoot,+ ownerPackage,+ surface,+ inSource,+ exportersOf,+ subpathCoveringModule,+ choosePublic,+ publicSpecifier,+ };+ }+ const owner = makeContext({packageDir, srcRoot, ownerPackage});+ /** @type {Map<string, PackageContext>} other packages' contexts, by source root */+ const others = new Map();+ /** @param {string} file */+ const contextOf = file => {+ if (file.startsWith(srcRoot + path.sep)) return owner;+ for (const [root, context] of others) {+ if (file.startsWith(root + path.sep)) return context;+ }+ return owner;};/**- * Prefer the subpath of the module's top folder, then the package root.- * @param {string[]} subpaths+ * The source module a bare import of another Astryx package's+ * `./internal/*` path names, or null. That module is carried, and its+ * package gets a context of its own.* @param {string} file+ * @param {string} specifier* @returns {string|null}*/- const pickSubpath = (subpaths, file) => {- if (subpaths.length === 0) return null;- const top = `./${toPosix(path.relative(srcRoot, file)).split('/')[0]}`;- return (- subpaths.find(s => s === top) ??- subpaths.find(s => s === '.') ??- [...subpaths].sort((a, b) => a.length - b.length)[0]- );+ const internalModuleOf = (file, specifier) => {+ const name = packageOf(specifier);+ const sub = specifier.slice(name.length + 1);+ if (!name.startsWith('@astryxdesign/') || name === ownerPackage)+ return null;+ if (!/^internal(\/|$)/.test(sub)) return null;+ const installed = resolveInstalledPackageDir(name, path.dirname(file));+ if (!installed) return null;+ const dir = fs.realpathSync(installed.packageDir);+ /** @type {{exports?: unknown}} */+ let pkg;+ try {+ pkg = JSON.parse(+ fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'),+ );+ } catch {+ return null;+ }+ const target = sourceExportTarget(pkg, dir, `./${sub}`);+ // A StyleX module's identity is its path, so the copy keeps importing it+ // by its exported path and agrees with the package on it.+ if (!target || STYLEX_FILE.test(target)) return null;+ const src = path.join(dir, 'src');+ const root = target.startsWith(src + path.sep) ? src : dir;+ if (!others.has(root)) {+ others.set(+ root,+ makeContext({packageDir: dir, srcRoot: root, ownerPackage: name}),+ );+ }+ return target;};- /** @param {string} subpath */- const publicSpecifier = subpath =>- subpath === '.' ? ownerPackage : `${ownerPackage}/${subpath.slice(2)}`;-/*** Carry a module in the copy.* @param {string} from@@ -560,8 +638,14 @@ export function planCopy({const edits = [];files.set(file, {code: parsed.code, edits});if (!CODE_FILE.test(file)) continue;+ const context = contextOf(file);for (const ref of parsed.references) {if (!ref.source.startsWith('.')) {+ const internal = internalModuleOf(file, ref.source);+ if (internal) {+ edits.push(sourceEdit(parsed.code, ref, carry(file, internal)));+ continue;+ }const builtin = ref.source.startsWith('node:') || isBuiltin(ref.source);const name = packageOf(ref.source);if (!builtin && name !== ownerPackage) packages.add(name);@@ -576,44 +660,61 @@ export function planCopy({else edits.push(sourceEdit(parsed.code, ref, carry(file, target)));continue;}- if (!CODE_FILE.test(target) || !inSource(target)) {+ if (!CODE_FILE.test(target) || !context.inSource(target)) {// An asset, such as `../../locales/en.json` or a stylesheet, that the// package exports by its own path is imported from the package.- const subpath = `./${toPosix(path.relative(packageDir, target))}`;+ const subpath = `./${toPosix(path.relative(context.packageDir, target))}`;if (- subpathDeclaration(surface.exportsField, subpath).state === 'declared'+ subpathDeclaration(context.surface.exportsField, subpath).state ===+ 'declared') {+ if (context !== owner) packages.add(context.ownerPackage);edits.push(- sourceEdit(parsed.code, ref, `${ownerPackage}/${subpath.slice(2)}`),+ sourceEdit(+ parsed.code,+ ref,+ `${context.ownerPackage}/${subpath.slice(2)}`,+ ),);continue;}// An unexported asset in the source is carried; one outside it is// left for the build to report.- if (!inSource(target)) continue;+ if (!context.inSource(target)) continue;edits.push(sourceEdit(parsed.code, ref, carry(file, target)));continue;}- edits.push(planReference(file, parsed.code, ref, target));+ edits.push(planReference(context, file, parsed.code, ref, target));}}- return {files, dependsOn, dependencies: declaredRanges(packageDir, packages)};+ return {+ files,+ dependsOn,+ dependencies: declaredRanges(packageDir, packages),+ otherPackages: new Map(+ [...others].map(([root, c]) => [root, c.ownerPackage]),+ ),+ };/*** Decide one reference that leaves the component folder.+ * @param {PackageContext} context the package the importing file is in* @param {string} file* @param {string} code* @param {ModuleReference} ref* @param {string} target* @returns {PlannedEdit}*/- function planReference(file, code, ref, target) {+ function planReference(context, file, code, ref, target) {+ // A carried module of another package imports that package's public names+ // from it, so the copy depends on it.+ if (context !== owner) packages.add(context.ownerPackage);if (ref.kind !== 'named' && ref.kind !== 'reexportNamed') {- const covering = subpathCoveringModule(target);+ const covering = context.subpathCoveringModule(target);return sourceEdit(code,ref,- covering ? publicSpecifier(covering) : carry(file, target),+ covering ? context.publicSpecifier(covering) : carry(file, target),);}/** @type {Array<{choice: SpecifierChoice, specs: ImportSpecifier[]}>} */@@ -630,13 +731,20 @@ export function planCopy({};for (const spec of ref.specifiers) {if (spec.imported === '*') {- const covering = subpathCoveringModule(target);- add(covering ? publicSpecifier(covering) : carry(file, target), spec);+ const covering = context.subpathCoveringModule(target);+ add(+ covering ? context.publicSpecifier(covering) : carry(file, target),+ spec,+ );continue;}const origin = originOf(target, spec.imported);- const publicOptions = exportersOf(target, spec.imported, spec.typeOnly);- const chosen = choosePublic(+ const publicOptions = context.exportersOf(+ target,+ spec.imported,+ spec.typeOnly,+ );+ const chosen = context.choosePublic(publicOptions.map(o => o.subpath),target,origin?.file,@@ -645,7 +753,7 @@ export function planCopy({const exported = /** @type {{name: string}} */ (publicOptions.find(o => o.subpath === chosen)).name;- add(publicSpecifier(chosen), {...spec, imported: exported});+ add(context.publicSpecifier(chosen), {...spec, imported: exported});} else {// Take the name from the module that defines it, so the copy carries// that module and not a whole barrel. An origin names a binding, so@@ -654,7 +762,7 @@ export function planCopy({const definingExport =origin &&origin.file !== target &&- inSource(origin.file) &&+ context.inSource(origin.file) &&!parseModule(target).declares.has(spec.imported)? exportNameOf(origin): null;diff --git a/packages/cli/api/swizzle/copy/copy.mjs b/packages/cli/api/swizzle/copy/copy.mjsindex 4b42ecf3ad..cd9fe1cce6 100644--- a/packages/cli/api/swizzle/copy/copy.mjs+++ b/packages/cli/api/swizzle/copy/copy.mjs@@ -361,12 +361,32 @@ export async function swizzleCopy(component, options = {}) {);/** @type {Map<string, string>} */const rootDests = new Map();+ // A module from another Astryx package goes under a folder named after that+ // package, at its path in that package's source.+ /** @param {string} file */+ const otherPackageOf = file => {+ for (const [root, name] of plan.otherPackages) {+ if (file.startsWith(root + path.sep)) return {root, folder: name.split('/').pop() ?? name};+ }+ return null;+ };+ /** @param {string} file the version of the package a helper comes from */+ const versionOf = file => {+ const other = otherPackageOf(file);+ return other+ ? packageVersionOf(findPackageRoot(other.root) ?? other.root)+ : ownerVersion;+ };for (const file of [...allFiles].sort()) {if (layoutDestOf(file) != null) continue;- const packagePath = path.relative(graphRoot, file);- let dest = path.join(outputBase, packagePath);+ const other = otherPackageOf(file);+ const base = other ? other.folder : path.basename(packageDir);+ const packagePath = path.relative(other ? other.root : graphRoot, file);+ let dest = other+ ? path.join(outputBase, base, packagePath)+ : path.join(outputBase, packagePath);for (let n = 1; takenDests.has(dest); n++) {- const folder = n === 1 ? path.basename(packageDir) : `${path.basename(packageDir)}-${n}`;+ const folder = n === 1 && !other ? base : `${base}-${n}`;dest = path.join(outputBase, folder, packagePath);}takenDests.add(dest);@@ -381,15 +401,17 @@ export async function swizzleCopy(component, options = {}) {// A private attribute owner module and the unexported style modules it// imports travel whole and are replaced only with --overwrite.const ownerGroup = new Set();+ /** @param {string} file the source root a carried module sits under */+ const rootOf = file => otherPackageOf(file)?.root ?? srcRoot;const ownerQueue = helpers.filter(f =>- OWNER_MODULE.test(toModulePath(srcRoot, f)),+ OWNER_MODULE.test(toModulePath(rootOf(f), f)),);while (ownerQueue.length > 0) {const file = /** @type {string} */ (ownerQueue.shift());if (ownerGroup.has(file)) continue;ownerGroup.add(file);for (const dep of plan.dependsOn.get(file) ?? []) {- if (!isComponentFile(dep) && STYLEX_MODULE.test(toModulePath(srcRoot, dep))) {+ if (!isComponentFile(dep) && STYLEX_MODULE.test(toModulePath(rootOf(dep), dep))) {ownerQueue.push(dep);}}@@ -431,7 +453,7 @@ export async function swizzleCopy(component, options = {}) {attempts.set(file, attempt);redirected.set(file,- versionedPath(baseDestOf(file), ownerVersion, attempt),+ versionedPath(baseDestOf(file), versionOf(file), attempt),);moved = true;}diff --git a/packages/cli/clients/cli/commands/swizzle.routing.test.mjs b/packages/cli/clients/cli/commands/swizzle.routing.test.mjsindex 07348bc407..3768e6305c 100644--- a/packages/cli/clients/cli/commands/swizzle.routing.test.mjs+++ b/packages/cli/clients/cli/commands/swizzle.routing.test.mjs@@ -476,6 +476,153 @@ describe('swizzle — integration-owned components', () => {expect(out).toContain(`from '../Bar`);});+ it("carries another Astryx package's internal module under a folder named after that package", async () => {+ const core = buildFakeCore(project);+ writeProjectPackageJson(project);+ const {compDir} = buildIntegration(project, {+ issuesUrl: 'https://example.com/meta/issues',+ });+ const manifest = JSON.parse(+ fs.readFileSync(path.join(core, 'package.json'), 'utf-8'),+ );+ manifest.exports['.'] = {+ source: './src/index.ts',+ default: './dist/index.js',+ };+ manifest.exports['./internal/*'] = {+ source: './src/internal/*.ts',+ default: './dist/internal/*.js',+ };+ fs.writeFileSync(path.join(core, 'package.json'), JSON.stringify(manifest));+ fs.mkdirSync(path.join(core, 'src', 'internal'), {recursive: true});+ fs.mkdirSync(path.join(core, 'src', 'utils'), {recursive: true});+ fs.writeFileSync(+ path.join(core, 'src', 'index.ts'),+ `export {publicName} from './utils/pub';\n`,+ );+ fs.writeFileSync(+ path.join(core, 'src', 'utils', 'pub.ts'),+ `export const publicName = 1;\n`,+ );+ fs.writeFileSync(+ path.join(core, 'src', 'utils', 'priv.ts'),+ `export const priv = 2;\n`,+ );+ fs.writeFileSync(+ path.join(core, 'src', 'internal', 'touch.ts'),+ `import {publicName} from '../utils/pub';\nimport {priv} from '../utils/priv';\nexport const touch = publicName + priv;\n`,+ );+ // A StyleX identity module Core exports under internal/.+ fs.writeFileSync(+ path.join(core, 'src', 'internal', 'press.stylex.ts'),+ `export const pressScope = {};\n`,+ );+ manifest.exports['./internal/press.stylex'] = {+ source: './src/internal/press.stylex.ts',+ default: './dist/internal/press.stylex.js',+ };+ fs.writeFileSync(path.join(core, 'package.json'), JSON.stringify(manifest));+ fs.writeFileSync(+ path.join(project, 'node_modules', '@test', 'meta', 'package.json'),+ JSON.stringify({+ name: '@test/meta',+ version: '1.2.3',+ peerDependencies: {'@astryxdesign/core': '>=0.0.13'},+ }),+ );+ fs.writeFileSync(+ path.join(compDir, 'MetaAppShell.tsx'),+ `import {touch} from '@astryxdesign/core/internal/touch';\nimport {pressScope} from '@astryxdesign/core/internal/press.stylex';\nexport function MetaAppShell() { return [touch, pressScope]; }\n`,+ );++ const result = await runCli(+ ['--json', 'swizzle', 'MetaAppShell', '-f'],+ project,+ );+ expect(result.code).toBe(0);+ const env = JSON.parse(result.stdout);+ const output = path.join(project, 'components', 'astryx');+ const read = rel => fs.readFileSync(path.join(output, rel), 'utf-8');+ expect(read('MetaAppShell/MetaAppShell.tsx')).toContain(+ `from '../core/internal/touch'`,+ );+ // Its identity is its path, so the StyleX module keeps the package import.+ expect(read('MetaAppShell/MetaAppShell.tsx')).toContain(+ `from '@astryxdesign/core/internal/press.stylex'`,+ );+ expect(env.data.dependencies).toEqual({'@astryxdesign/core': '>=0.0.13'});+ expect(read('core/internal/touch.ts')).toContain(+ `import {publicName} from '@astryxdesign/core';`,+ );+ expect(read('core/internal/touch.ts')).toContain(`from '../utils/priv'`);+ expect(read('core/utils/priv.ts')).toBe(`export const priv = 2;\n`);+ expect(env.data.files).toEqual(+ expect.arrayContaining([+ '../core/internal/touch.ts',+ '../core/utils/priv.ts',+ ]),+ );+ for (const rel of env.data.files) {+ expect(read(path.join('MetaAppShell', rel)), rel).not.toMatch(+ /@astryxdesign\/core\/internal\/(?!press\.stylex)/,+ );+ }+ });++ it('refuses to replace a changed owner module carried from another package without --overwrite', async () => {+ const core = buildFakeCore(project);+ writeProjectPackageJson(project);+ const {compDir} = buildIntegration(project, {+ issuesUrl: 'https://example.com/meta/issues',+ });+ const manifest = JSON.parse(+ fs.readFileSync(path.join(core, 'package.json'), 'utf-8'),+ );+ manifest.exports['./internal/*'] = {+ source: './src/internal/*.ts',+ default: './dist/internal/*.js',+ };+ fs.writeFileSync(path.join(core, 'package.json'), JSON.stringify(manifest));+ fs.mkdirSync(path.join(core, 'src', 'internal'), {recursive: true});+ fs.mkdirSync(path.join(core, 'src', 'privateAttributes'), {+ recursive: true,+ });+ fs.writeFileSync(+ path.join(core, 'src', 'privateAttributes', 'group.stylex.ts'),+ `export const group = 1;\n`,+ );+ fs.writeFileSync(+ path.join(core, 'src', 'internal', 'grouping.ts'),+ `import {group} from '../privateAttributes/group.stylex';\nexport const grouping = group;\n`,+ );+ fs.writeFileSync(+ path.join(compDir, 'MetaAppShell.tsx'),+ `import {grouping} from '@astryxdesign/core/internal/grouping';\nexport function MetaAppShell() { return grouping; }\n`,+ );++ expect(+ (await runCli(['--json', 'swizzle', 'MetaAppShell'], project)).code,+ ).toBe(0);+ const owner = path.join(+ project,+ 'components',+ 'astryx',+ 'core',+ 'privateAttributes',+ 'group.stylex.ts',+ );+ fs.appendFileSync(owner, '// edited\n');+ fs.rmSync(path.join(project, 'components', 'astryx', 'MetaAppShell'), {+ recursive: true,+ force: true,+ });++ const again = await runCli(['--json', 'swizzle', 'MetaAppShell'], project);+ expect(again.code).not.toBe(0);+ expect(JSON.parse(again.stdout).code).toBe('ERR_FILE_EXISTS');+ expect(fs.readFileSync(owner, 'utf-8')).toContain('// edited');+ });+it('omits the feedback note when the integration ships no issuesUrl', async () => {buildFakeCore(project);writeProjectPackageJson(project);