Skip to content

Commit 3bd4362

Browse files
alan-agius4kirjs
authored andcommitted
docs: update APF docs for new .d.ts layout (angular#64168)
The Angular Package Format has been updated to group all TypeScript declaration files (`.d.ts`) under a single `types/` directory within the package. Previously, these files were located at the package root or within entry-point specific directories. This commit updates the APF documentation to reflect this new structure, including: - The example file layout. - The file purpose description table. - The `package.json` exports field example. - The legacy typings field example. This brings the documentation in line with the current package structure, providing accurate guidance for library authors and tool developers. PR Close angular#64168
1 parent 1cb16fd commit 3bd4362

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

adev/src/content/tools/libraries/angular-package-format.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ The following example shows a simplified version of the `@angular/core` package'
2828
node_modules/@angular/core
2929
├── README.md
3030
├── package.json
31-
├── index.d.ts
3231
├── fesm2022
3332
│ ├── core.mjs
3433
│ ├── core.mjs.map
3534
│ ├── testing.mjs
3635
│ └── testing.mjs.map
37-
└── testing
38-
└── index.d.ts
36+
└── types
37+
│ ├── core.d.ts
38+
│ ├── testing.d.ts
3939
```
4040

4141
This table describes the file layout under `node_modules/@angular/core` annotated to describe the purpose of files and directories:
@@ -44,10 +44,8 @@ This table describes the file layout under `node_modules/@angular/core` annotate
4444
|:--- |:--- |
4545
| `README.md` | Package README, used by npmjs web UI. |
4646
| `package.json` | Primary `package.json`, describing the package itself as well as all available entrypoints and code formats. This file contains the "exports" mapping used by runtimes and tools to perform module resolution. |
47-
| `index.d.ts` | Bundled `.d.ts` for the primary entrypoint `@angular/core`. |
4847
| `fesm2022/` <br /> &nbsp;&nbsp;`core.mjs` <br /> &nbsp;&nbsp;`core.mjs.map` <br /> &nbsp;&nbsp;`testing.mjs` <br /> &nbsp;&nbsp;`testing.mjs.map` | Code for all entrypoints in flattened \(FESM\) ES2022 format, along with source maps. |
49-
| `testing/` | Directory representing the "testing" entrypoint. |
50-
| `testing/index.d.ts` | Bundled `.d.ts` for the `@angular/core/testing` entrypoint. |
48+
| `types/` <br /> &nbsp;&nbsp;`core.d.ts` <br /> &nbsp;&nbsp;`testing.d.ts` | Bundled TypeScript type definitions for all public entrypoints. |
5149

5250
## `package.json`
5351

@@ -88,11 +86,11 @@ The `"exports"` field has the following structure:
8886
"default": "./package.json"
8987
},
9088
".": {
91-
"types": "./core.d.ts",
89+
"types": "./types/core.d.ts",
9290
"default": "./fesm2022/core.mjs"
9391
},
9492
"./testing": {
95-
"types": "./testing/testing.d.ts",
93+
"types": "./types/testing.d.ts",
9694
"default": "./fesm2022/testing.mjs"
9795
}
9896
}
@@ -122,7 +120,7 @@ For `@angular/core` these are:
122120

123121
{
124122
"module": "./fesm2022/core.mjs",
125-
"typings": "./core.d.ts",
123+
"typings": "./types/core.d.ts",
126124
}
127125

128126
</docs-code>

0 commit comments

Comments
 (0)