mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
The purpose of the changes is to clean all markdown to match a single pedantic style.
* To ensure all changes in style are properly separated.
* To ensure all styled content aligns to nearest 4-character-tab.
* To ensure all code blocks use the Angular `<code-example>` or `<code-tab>` elements.
* To ensure all markdown exists outside of html tags.
* To ensure all images use the Angular style for `<img>` elements.
* To ensure that all smart punctuation is replaced or removed.
```text
’, ’, “, ”, –, —, …
```
* To ensure all content does not conflict with the following reserved characters.
```text
@, $, *, &, #, |, <, >,
```
* To ensure all content displays using html entities.
The following changes were made to files in the following directory.
```text
aio/content
```
The target files were markdown files.
The list of excluded files:
```text
.browserslistrc, .css, .conf, .editorconfig, .gitignore, .html, .js, .json, .sh, .svg, .ts, .txt, .xlf,
```
PR Close #45325
65 lines
2.2 KiB
Markdown
65 lines
2.2 KiB
Markdown
# `tslib` direct dependency migration
|
|
|
|
## What does this migration do?
|
|
|
|
If you have any libraries within your workspace, this migration will convert `tslib` peer dependencies to direct dependencies for the libraries.
|
|
TypeScript uses the `tslib` package to provide common helper functions used in compiled TypeScript code.
|
|
The `tslib` version is also updated to `2.0.0` to support TypeScript 3.9.
|
|
|
|
Before:
|
|
|
|
<code-example format="json" language="json">
|
|
|
|
{
|
|
"name": "my-lib",
|
|
"version": "0.0.1",
|
|
"peerDependencies": {
|
|
"@angular/common": "^9.0.0",
|
|
"@angular/core": "^9.0.0",
|
|
"tslib": "^1.12.0"
|
|
}
|
|
}
|
|
|
|
</code-example>
|
|
|
|
After:
|
|
|
|
<code-example format="json" language="json">
|
|
|
|
{
|
|
"name": "my-lib",
|
|
"version": "0.0.1",
|
|
"peerDependencies": {
|
|
"@angular/common": "^9.0.0",
|
|
"@angular/core": "^9.0.0"
|
|
},
|
|
"dependencies": {
|
|
"tslib": "^2.0.0"
|
|
}
|
|
}
|
|
|
|
</code-example>
|
|
|
|
## Why is this migration necessary?
|
|
|
|
The [`tslib`](https://github.com/Microsoft/tslib) is a runtime library for Typescript.
|
|
The version of this library is bound to the version of the TypeScript compiler used to compile a library.
|
|
Peer dependencies do not accurately represent this relationship between the runtime and the compiler.
|
|
If `tslib` remained declared as a library peer dependency, it would be possible for some Angular workspaces to get into a state where the workspace could not satisfy `tslib` peer dependency requirements for multiple libraries, resulting in build-time or run-time errors.
|
|
|
|
As of TypeScript 3.9 \(used by Angular v10\), `tslib` version of 2.x is required to build new applications.
|
|
However, older libraries built with previous version of TypeScript and already published to npm might need `tslib` 1.x.
|
|
This migration makes it possible for code depending on incompatible versions of the `tslib` runtime library to remain interoperable.
|
|
|
|
## Do I still need `tslib` as a dependency in my workspace `package.json`?
|
|
|
|
Yes.
|
|
The `tslib` dependency declared in the `package.json` file of the workspace is used to build applications within this workspace, as well as run unit tests for workspace libraries, and is required.
|
|
|
|
<!-- links -->
|
|
|
|
<!-- external links -->
|
|
|
|
<!-- end links -->
|
|
|
|
@reviewed 2022-02-28
|