Skip to content

Commit 6dd4a98

Browse files
committed
docs(adr): setting up adr, start to write 00001-plugin
1 parent 59651a1 commit 6dd4a98

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed

docs/adr/00000-whats-the-big-idea.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
### This adr attempts to describe 10,000ft view for the swc project itself. To be filled gradually.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# [Support transform plugin in native rust binaries]
2+
3+
* Status: accepted <!-- optional -->
4+
* Deciders: @kdy1, @kwonoj <!-- optional -->
5+
* Date: 2021-01-01 <!-- optional -->
6+
7+
Technical Story: [Issue](https://github.com/swc-project/swc/issues/2635) <!-- optional -->
8+
9+
## Context and Problem Statement
10+
11+
SWC wants to support load, run plugins in the native binary for the custom transform behavior. SWC already have priliminary support to load plugins in its node.js JS bindings but it has known limitations.
12+
13+
## Decision Drivers <!-- optional -->
14+
15+
* [driver 1, e.g., a force, facing concern, …]
16+
* [driver 2, e.g., a force, facing concern, …]
17+
*<!-- numbers of drivers can vary -->
18+
19+
## Considered Options
20+
21+
* [option 1]
22+
* [option 2]
23+
* [option 3] SWC embeds web assembly runtime (https://wasmer.io/), loads plugin built as web assembly.
24+
*<!-- numbers of options can vary -->
25+
26+
## Decision Outcome
27+
28+
Chosen option: **[option 3] SWC embeds web assembly runtime (https://wasmer.io/), loads plugin built as web assembly.**
29+
30+
This decision is taken because
31+
- It was relatively easy plugin author to generate single binary works across most of platforms SWC's host binary supports, without concern of cross-target compilations.
32+
- It was relatively easy to achieve abi-stable between SWC host to plugin binaries.
33+
- It doesn't require to have separate, specialized AST struct (named `plugin_ast`) to pass into ffi boundary of the plugin.
34+
- Its serialization / deserialization performance is near identical or faster than `abi_stable` based ffi
35+
36+
## Pros and Cons of the Options <!-- optional -->
37+
38+
### [option 1]
39+
40+
[example | description | pointer to more information | …] <!-- optional -->
41+
42+
* Good, because [argument a]
43+
* Good, because [argument b]
44+
* Bad, because [argument c]
45+
*<!-- numbers of pros and cons can vary -->
46+
47+
### [option 2]
48+
49+
[example | description | pointer to more information | …] <!-- optional -->
50+
51+
* Good, because [argument a]
52+
* Good, because [argument b]
53+
* Bad, because [argument c]
54+
*<!-- numbers of pros and cons can vary -->
55+
56+
### [option 3]
57+
58+
[example | description | pointer to more information | …] <!-- optional -->
59+
60+
* Good, because [argument a]
61+
* Good, because [argument b]
62+
* Bad, because [argument c]
63+
*<!-- numbers of pros and cons can vary -->
64+
65+
## Links <!-- optional -->
66+
67+
* [Link type] [Link to ADR] <!-- example: Refined by [ADR-0005](0005-example.md) -->
68+
*<!-- numbers of links can vary -->

docs/adr/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Architectural Decision Records
2+
3+
This directory contains a series of [Architectural Decision Records](https://adr.github.io/)
4+
or "ADRs" for the `swc` project. We're going to try to use it as a kind of collective
5+
memory of the decisions we've made and the path we've taken to get the project to its current
6+
point.
7+
8+
Note that these are *historical references* that do not supersede (but might enhance) the living
9+
documentation of the project itself, which you can find inline in the source code.
10+
11+
Proposing a non-trivial change to the way `swc` works? You might like to start with an ADR
12+
by copying `template.md` into a new file, filling out a first version of the proposal, and
13+
posting it as a PR on the github repo for discussion.

docs/adr/template.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# [short title of solved problem and solution]
2+
3+
* Status: [proposed | rejected | accepted | deprecated | … | superseded by [ADR-0005](0005-example.md)] <!-- optional -->
4+
* Deciders: [list everyone involved in the decision] <!-- optional -->
5+
* Date: [YYYY-MM-DD when the decision was last updated] <!-- optional -->
6+
7+
Technical Story: [description | ticket/issue URL] <!-- optional -->
8+
9+
## Context and Problem Statement
10+
11+
[Describe the context and problem statement, e.g., in free form using two to three sentences. You may want to articulate the problem in form of a question.]
12+
13+
## Decision Drivers <!-- optional -->
14+
15+
* [driver 1, e.g., a force, facing concern, …]
16+
* [driver 2, e.g., a force, facing concern, …]
17+
*<!-- numbers of drivers can vary -->
18+
19+
## Considered Options
20+
21+
* [option 1]
22+
* [option 2]
23+
* [option 3]
24+
*<!-- numbers of options can vary -->
25+
26+
## Decision Outcome
27+
28+
Chosen option: "[option 1]", because [justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force force | … | comes out best (see below)].
29+
30+
### Positive Consequences <!-- optional -->
31+
32+
* [e.g., improvement of quality attribute satisfaction, follow-up decisions required, …]
33+
*
34+
35+
### Negative Consequences <!-- optional -->
36+
37+
* [e.g., compromising quality attribute, follow-up decisions required, …]
38+
*
39+
40+
## Pros and Cons of the Options <!-- optional -->
41+
42+
### [option 1]
43+
44+
[example | description | pointer to more information | …] <!-- optional -->
45+
46+
* Good, because [argument a]
47+
* Good, because [argument b]
48+
* Bad, because [argument c]
49+
*<!-- numbers of pros and cons can vary -->
50+
51+
### [option 2]
52+
53+
[example | description | pointer to more information | …] <!-- optional -->
54+
55+
* Good, because [argument a]
56+
* Good, because [argument b]
57+
* Bad, because [argument c]
58+
*<!-- numbers of pros and cons can vary -->
59+
60+
### [option 3]
61+
62+
[example | description | pointer to more information | …] <!-- optional -->
63+
64+
* Good, because [argument a]
65+
* Good, because [argument b]
66+
* Bad, because [argument c]
67+
*<!-- numbers of pros and cons can vary -->
68+
69+
## Links <!-- optional -->
70+
71+
* [Link type] [Link to ADR] <!-- example: Refined by [ADR-0005](0005-example.md) -->
72+
*<!-- numbers of links can vary -->

0 commit comments

Comments
 (0)