You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/plugin-system/overview.md
+11-4
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,12 @@ summary: A high-level overview over the plugin system
19
19
Even if you aren't doing anything that complex, if you are going to use Parcel
20
20
a lot it makes sense to take some time and understand how it works.
21
21
22
+
### Entities
23
+
24
+
- Asset: In the simplest case, an asset corresponds to a source file (e.g. a TypeScript file on disk). However, a transformer can not only modify (transform) an asset, but can also return more than one asset for a single input asset.
25
+
- Dependency: A dependency models an asset requesting some other asset (e.g. a `import "foo";` declaration in JavaScript, or a `<link rel="stylesheet">` in HTML). They are explicitly added by a transformer (and sometimes called outgoing dependencies). Additionally Parcel also tracks which assets these dependencies point to and exposes this information as the incoming dependencies of an asset (thus listing the importers of some asset).
26
+
- Bundle: A bundle is a grouping of assets that will be written into a single file for browsers to load. Async bundles are bundles created for lazy dependencies (e.g. for `import()` calls), and shared bundles contain assets used by multiple other bundles and were separated for improved load performance.
27
+
22
28
### Phases of Parcel
23
29
24
30
At a high level Parcel runs through several phases:
@@ -34,7 +40,7 @@ At a high level Parcel runs through several phases:
34
40
The **resolving** and **transforming** phases work together in parallel to
35
41
build a graph of all your assets.
36
42
37
-
The asset graph gets translated into bundles in the **bundling** phase. The output filename of each bundle is determined in the **naming** phase.
43
+
The assets are grouped into bundles in the **bundling** phase. The output filename of each bundle is determined in the **naming** phase.
38
44
39
45
Then, the **packaging**, **optimizing**, and **compressing** phases work together to generate the final contents of every bundle, in parallel.
40
46
@@ -55,9 +61,10 @@ on one another is called the "Asset Graph".
55
61
56
62
### Bundle Graph
57
63
58
-
Once Parcel has built the entire Asset Graph, it begins turning it into
59
-
"bundles". These bundles are groupings of assets that get placed together in a
60
-
single file. Bundles will (generally) contain only assets in the same language.
64
+
Once Parcel has built the entire Asset Graph, it converts it into
65
+
the Bundle Graph, which contains the Asset Graph and additionally describes
66
+
which assets should be grouped together into bundles (and what the relationship
67
+
between these bundles is).
61
68
62
69
Some assets are considered "entry" points into your app, and will stay as
63
70
separate bundles. For example, if your `index.html` file links to an
0 commit comments