Document that package.json aliases may target only direct subfolders of src
Agents / agent (pull_request) Has been skipped
Check / check (pull_request) Successful in 1m18s

This commit is contained in:
Danny Kim
2026-10-16 21:48:20 +09:00
parent 006bbe6b0c
commit b170f25c7d
4 changed files with 21 additions and 4 deletions
+10 -1
View File
@@ -6,7 +6,16 @@ description: Shared code comes through # aliases in package.json imports, each d
Shared code is imported through Node subpath imports declared in
`package.json` `imports`, never by a relative path that climbs out of a
directory:
directory.
**Targets (user rule, 2026-10-16):** an alias may point ONLY at a direct
subfolder of `src/`: its `index.ts` (`"#helpers": "./src/helpers/index.ts"`)
or a `#x/*` pattern inside that one folder. Never alias anything outside
`src/` (`scripts/`, root files), `src/` itself (no `#plugin` for
`./src/index.ts`), or a deeper folder (`./src/a/b/`). Code that would need
such an alias uses a relative import instead; `scripts/` and
`vite.config.ts` import each other relatively. Layer rules
(`enforce-layer-order`) must still pass, so reorder entries if needed.
```jsonc
"imports": {
+3 -2
View File
@@ -11,8 +11,9 @@ Decided 2026-10-14 for all repos.
config needed. Packages publish only `dist/`, so colocated tests cost nothing
in the tarball.
- **Regression and integration tests** live in the top-level `tests/` folder
and use only the public entry point (an alias like `#plugin`), never
internals. `vp test tests` runs just these.
and use only the public entry point through a relative import
(`../src/index.ts`; no alias may target `src/` itself, see
[[imports-aliases-barrels]]), never internals. `vp test tests` runs just these.
- **No in-source tests** (`import.meta.vitest`).
- **`scripts/` gets no tests** (2026-10-15): it is repo tooling, not
production code (`project-lint.ts`, `decorators.ts`, `lit-check.ts`,