4.0.9 • Published 1 month ago

@travetto/compiler v4.0.9

Weekly downloads
158
License
MIT
Repository
github
Last release
1 month ago

Compiler

The compiler infrastructure for the Travetto framework

Install: @travetto/compiler

npm install @travetto/compiler

# or

yarn add @travetto/compiler

This module expands upon the Typescript compiler, with the additional features:

CLI

The compiler cli, trvc is the entry point for compilation-related operations. It has the ability to check for active builds, and ongoing watch operations to ensure only one process is building at a time. Within the framework, regardless of mono-repo or not, the compilation always targets the entire project. With the efficient caching behavior, this leads to generally a minimal overhead but allows for centralization of all operations.

The compiler cli supports the following operations:

  • start|watch - Run the compiler in watch mode
  • stop - Stop the compiler if running
  • restart - Restart the compiler in watch mode
  • build - Ensure the project is built and upto date
  • clean - Clean out the output and compiler caches
  • info - Retrieve the compiler information, if running
  • event <log|progress|state> - Watch events in realtime as newline delimited JSON
  • exec <file> [...args] - Allow for compiling and executing an entrypoint file
  • manifest --prod [output] - Generate the project manifest In addition to the normal output, the compiler supports an environment variable TRV_BUILD that supports the following values: debug, info, warn or none. This provides different level of logging during the build process which is helpful to diagnose any odd behaviors. When invoking an unknown command (e.g. <other> from above), the default level is warn. Otherwise the default logging level is info.

Terminal: Sample trv output with debug logging

$ TRV_BUILD=debug trvc build

2029-03-14T04:00:00.618Z info  [server         ] Starting server http://127.0.0.1:25539
2029-03-14T04:00:00.837Z debug [main           ] Start Server
2029-03-14T04:00:01.510Z debug [event-stream   ] Started event stream
2029-03-14T04:00:02.450Z debug [precompile     ] Started
2029-03-14T04:00:02.762Z debug [precompile     ] Skipped @travetto/manifest
2029-03-14T04:00:02.947Z debug [precompile     ] Skipped @travetto/transformer
2029-03-14T04:00:03.093Z debug [precompile     ] Skipped @travetto/compiler
2029-03-14T04:00:04.003Z debug [precompile     ] Completed
2029-03-14T04:00:04.495Z debug [manifest       ] Started
2029-03-14T04:00:05.066Z debug [manifest       ] Completed
2029-03-14T04:00:05.307Z debug [transformers   ] Started
2029-03-14T04:00:05.952Z debug [transformers   ] Skipped @travetto/base
2029-03-14T04:00:06.859Z debug [transformers   ] Skipped @travetto/cli
2029-03-14T04:00:07.720Z debug [transformers   ] Skipped @travetto/manifest
2029-03-14T04:00:08.179Z debug [transformers   ] Skipped @travetto/registry
2029-03-14T04:00:08.588Z debug [transformers   ] Skipped @travetto/schema
2029-03-14T04:00:09.493Z debug [transformers   ] Completed
2029-03-14T04:00:10.395Z debug [delta          ] Started
2029-03-14T04:00:10.407Z debug [delta          ] Completed
2029-03-14T04:00:10.799Z debug [manifest       ] Started
2029-03-14T04:00:11.013Z debug [manifest       ] Wrote manifest @travetto-doc/compiler
2029-03-14T04:00:11.827Z debug [manifest       ] Completed
2029-03-14T04:00:11.894Z info  [server         ] State changed: compile-end
2029-03-14T04:00:12.133Z debug [compiler-exec  ] Skipped
2029-03-14T04:00:13.123Z debug [event-stream   ] Finished event stream
2029-03-14T04:00:14.014Z info  [server         ] Closing down server
2029-03-14T04:00:14.924Z debug [server         ] Server close event
2029-03-14T04:00:15.690Z info  [server         ] Closed down server
2029-03-14T04:00:15.865Z debug [server         ] Finished processing events
2029-03-14T04:00:16.757Z debug [main           ] End Server

Terminal: Sample trv output with default log level

$ trvc build

Compilation Architecture

The compiler will move through the following phases on a given compilation execution:

  • Bootstrapping - Initial compilation of Compiler's support/*.ts files
  • Compiler Server - Provides a simple HTTP interface to watching compiler file and state changes, and synchronizing multiple processes
  • Build Compiler - Leverages Typescript to build files needed to execute compiler
  • Build Manifest - Produces the manifest for the given execution
  • Build Transformers - Leverages Typescript to compile all transformers defined in the manifest
  • Produce Manifest Delta - Compare the output file system with the manifest to determine what needs to be compiled
  • Clear all output if needed - When the compiler source or transformers change, invalidate the entire output
  • Persist Manifest(s) - Ensure the manifest is available for the compiler to leverage. Multiple will be written if in a monorepo
  • Invoke Compiler - Run Typescript compiler with the aforementioned enhancements

Bootstrapping

Given that the framework is distributed as Typescript only files, there is a bootstrapping problem that needs to be mitigated. The trvc entrypoint, along with a small context utility in Manifest are the only Javascript files needed to run the project. The trvc entry point will compile @travetto/compiler/support/* files as the set that is used at startup. These files are also accessible to the compiler as they get re-compiled after the fact.

4.0.9

1 month ago

4.0.8

1 month ago

4.0.5

1 month ago

4.0.4

1 month ago

4.0.7

1 month ago

4.0.6

1 month ago

4.0.3

2 months ago

4.0.2

2 months ago

4.0.1

2 months ago

4.0.0

2 months ago

4.0.0-rc.7

2 months ago

4.0.0-rc.6

2 months ago

4.0.0-rc.5

2 months ago

4.0.0-rc.4

2 months ago

4.0.0-rc.3

2 months ago

4.0.0-rc.1

2 months ago

4.0.0-rc.2

2 months ago

3.4.4

3 months ago

4.0.0-rc.0

3 months ago

3.4.3

5 months ago

3.2.2

9 months ago

3.4.0-rc.5

5 months ago

3.4.0-rc.6

5 months ago

3.4.0-rc.3

5 months ago

3.4.0-rc.4

5 months ago

3.4.0-rc.1

5 months ago

3.4.0-rc.2

5 months ago

3.4.0-rc.0

6 months ago

3.4.0

5 months ago

3.4.2

5 months ago

3.4.1

5 months ago

3.3.1

8 months ago

3.3.0

8 months ago

3.3.2

7 months ago

3.2.1

10 months ago

3.2.0

10 months ago

3.1.6

10 months ago

3.2.0-rc.0

10 months ago

3.1.3

11 months ago

3.1.5

11 months ago

3.1.4

11 months ago

3.1.2

1 year ago

3.1.0

1 year ago

3.0.3

1 year ago

3.1.0-rc.2

1 year ago

3.1.0-rc.3

1 year ago

3.1.0-rc.0

1 year ago

3.1.0-rc.1

1 year ago

3.1.0-rc.6

1 year ago

3.1.0-rc.4

1 year ago

3.1.0-rc.5

1 year ago

3.0.0-rc.34

1 year ago

3.0.0-rc.33

1 year ago

3.0.2-rc.1

1 year ago

3.0.2-rc.0

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

3.0.1-rc.1

1 year ago

3.0.0-rc.24

1 year ago

3.0.0-rc.23

1 year ago

3.0.0-rc.26

1 year ago

3.0.0-rc.25

1 year ago

3.0.0-rc.28

1 year ago

3.0.0-rc.27

1 year ago

3.0.0-rc.29

1 year ago

3.0.0-rc.20

1 year ago

3.0.0-rc.22

1 year ago

3.0.0-rc.21

1 year ago

3.0.0-rc.31

1 year ago

3.0.0-rc.30

1 year ago

3.0.0-rc.32

1 year ago

3.0.0-rc.15

1 year ago

3.0.0-rc.17

1 year ago

3.0.0-rc.16

1 year ago

3.0.0-rc.19

1 year ago

3.0.0-rc.18

1 year ago

3.0.0-rc.13

1 year ago

3.0.0-rc.12

1 year ago

3.0.0-rc.14

1 year ago

3.0.0-rc.6

1 year ago

3.0.0-rc.11

1 year ago

3.0.0-rc.9

1 year ago

3.0.0-rc.8

1 year ago

3.0.0-rc.7

1 year ago

3.0.0-rc.2

2 years ago

3.0.0-rc.1

2 years ago

3.0.0-rc.0

2 years ago

3.0.0-rc.4

2 years ago

3.0.0-rc.3

2 years ago

2.2.4

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

2.1.2

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-rc.5

3 years ago

2.0.0-alpha.7

3 years ago

2.0.0-alpha.8

3 years ago

2.0.0-alpha.9

3 years ago

2.0.0-alpha.11

3 years ago

2.0.0-alpha.10

3 years ago

2.0.0-alpha.5

3 years ago

2.0.0-alpha.6

3 years ago

2.0.0-rc.2

3 years ago

2.0.0-rc.3

3 years ago

2.0.0-rc.4

3 years ago

2.0.0-rc.0

3 years ago

2.0.0-rc.1

3 years ago

2.0.0-alpha.3

3 years ago

2.0.0-alpha.4

3 years ago

2.0.0-alpha.1

3 years ago

2.0.0-alpha.2

3 years ago

1.1.1

3 years ago

1.1.0-rc.0

4 years ago

1.1.0

4 years ago

1.1.0-alpha.6

4 years ago

1.1.0-alpha.5

4 years ago

1.1.0-alpha.3

4 years ago

1.1.0-alpha.4

4 years ago

1.1.0-alpha.1

4 years ago

1.1.0-alpha.2

4 years ago

1.1.0-alpha.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-rc.10

4 years ago

1.0.0-rc.9

4 years ago

1.0.0-rc.8

4 years ago

1.0.0-rc.7

4 years ago

1.0.0-rc.6

4 years ago

1.0.0-rc.5

4 years ago

1.0.0-rc.4

4 years ago

1.0.0-rc.3

4 years ago

1.0.0-rc.2

4 years ago

1.0.0-rc.1

4 years ago

1.0.0-rc.0

4 years ago

1.0.0-beta.2

5 years ago

1.0.0-beta.1

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.1-alpha.6

5 years ago

0.7.1-alpha.5

5 years ago

0.7.1-alpha.4

5 years ago

0.7.1-alpha.3

5 years ago

0.7.1-alpha.2

5 years ago

0.7.1-alpha.1

5 years ago

0.7.1-alpha.0

5 years ago

0.7.0-alpha.0

5 years ago

0.6.7

5 years ago

0.6.6

5 years ago

0.6.5

5 years ago

0.6.4

5 years ago

0.6.3

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.6.0-rc.10

5 years ago

0.6.0-rc.9

5 years ago

0.6.0-rc.8

5 years ago

0.6.0-rc.7

5 years ago

0.6.0-rc.6

5 years ago

0.6.0-rc.4

5 years ago

0.6.0-rc.3

5 years ago

0.6.0-rc.2

5 years ago

0.6.0-rc.1

5 years ago

0.6.0-rc.0

5 years ago

0.5.8

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.16

6 years ago

0.3.15

6 years ago

0.3.14

6 years ago

0.3.13

6 years ago

0.3.12

6 years ago

0.3.11

6 years ago

0.3.10

6 years ago

0.3.9

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.0

6 years ago

0.2.10

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.0

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.48

6 years ago

0.0.47

6 years ago

0.0.46

6 years ago

0.0.45

6 years ago

0.0.44

6 years ago

0.0.43

6 years ago

0.0.42

6 years ago

0.0.41

6 years ago

0.0.40

6 years ago

0.0.39

6 years ago

0.0.38

6 years ago

0.0.37

6 years ago

0.0.36

6 years ago

0.0.35

6 years ago

0.0.34

6 years ago

0.0.33

6 years ago

0.0.31

6 years ago

0.0.30

6 years ago

0.0.29

6 years ago

0.0.28

6 years ago

0.0.27

6 years ago

0.0.26

6 years ago

0.0.25

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.1

7 years ago