forked from microsoft/TypeScript-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9150ed6
commit 6529346
Showing
31 changed files
with
2,353 additions
and
1,667 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
packages/documentation/copy/en/modules-reference/Introduction.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: Modules - Introduction | ||
short: Introduction | ||
layout: docs | ||
permalink: /docs/handbook/modules/introduction.html | ||
oneline: How TypeScript models JavaScript modules | ||
translatable: true | ||
--- | ||
|
||
This document is divided into four sections: | ||
|
||
1. The first section develops the [**theory**](/docs/handbook/modules/theory.html) behind how TypeScript approaches modules. If you want to be able to write the correct module-related compiler options for any situation, reason about how to integrate TypeScript with other tools, or understand how TypeScript processes dependency packages, this is the place to start. While there are guides and reference pages on these topics, building an understanding of these fundamentals will make reading the guides easier, and give you a mental framework for dealing with real-world problems not specifically covered here. | ||
2. The [**guides**](/docs/handbook/modules/guides/choosing-compiler-options.html) show how to accomplish specific real-world tasks, starting with picking the right compilation settings for a new project. The guides are a good place to start both for beginners who want to get up and running as quickly as possible and for experts who already have a good grasp of the theory but want concrete guidance on a complicated task. | ||
3. The [**reference**](/docs/handbook/modules/reference.html) section provides a more detailed look at the syntaxes and configurations presented in previous sections. | ||
4. The [**appendices**](/docs/handbook/modules/appendices/esm-cjs-interop.html) cover complicated topics that deserve additional explanation in more detail than the theory or reference sections allow. |
1,147 changes: 1,147 additions & 0 deletions
1,147
packages/documentation/copy/en/modules-reference/Reference.md
Large diffs are not rendered by default.
Oops, something went wrong.
367 changes: 367 additions & 0 deletions
367
packages/documentation/copy/en/modules-reference/Theory.md
Large diffs are not rendered by default.
Oops, something went wrong.
351 changes: 351 additions & 0 deletions
351
packages/documentation/copy/en/modules-reference/appendices/ESM-CJS-Interop.md
Large diffs are not rendered by default.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
packages/documentation/copy/en/modules-reference/diagrams/README
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Some of this content uses mermaid diagrams. We could render them as part of the website build with gatsby-remark-mermaid, but that requires puppeteer/Chromium, which has historically caused a lot of cross-platform build issues. These diagrams should not change often, so I’m just going to store the source here and generate the SVGs manually. | ||
|
||
Example: | ||
|
||
```sh | ||
npm install -g @mermaid-js/mermaid-cli | ||
mmdc -i packages/documentation/copy/en/modules-reference/diagrams/esm-cjs-interop.md | ||
``` | ||
|
||
declaration-files.svg is a non-Mermaid replacement for theory.md-4.svg. I made it for a talk one time and it’s better than what Mermaid can do with a flowchart. |
17 changes: 17 additions & 0 deletions
17
packages/documentation/copy/en/modules-reference/diagrams/declaration-files.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions
26
packages/documentation/copy/en/modules-reference/diagrams/esm-cjs-interop.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
```mermaid | ||
graph TB | ||
subgraph Transpiled[ESM transpiled to CJS] | ||
direction TB | ||
C[Importing module] -- designed based on spec --> D[Imported module] | ||
end | ||
subgraph ESM | ||
direction TB | ||
A[Importing module] -- specified behavior --> B[Imported module] | ||
end | ||
``` | ||
|
||
```mermaid | ||
graph TD | ||
subgraph Transpiled[ESM transpiled to CJS] | ||
C[Importing module] -- designed based on spec --> D[Imported module] | ||
end | ||
subgraph CJS[True CJS] | ||
E[Imported module] | ||
end | ||
subgraph ESM | ||
A[Importing module] -- specified behavior --> B[Imported module] | ||
end | ||
A -. unspecified behavior .-> E | ||
C .->|"<span style='font-size: 3em'>❓🤷🏻♂️❓</span>"| E | ||
``` |
1 change: 1 addition & 0 deletions
1
...ages/documentation/copy/en/modules-reference/diagrams/esm-cjs-interop.mmd-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.