Rust-based platform for the Web
Go to file
OJ Kwon ac5ab607c9
refactor(plugin/runner): Revise cache, module loading (#7408)
**Description:**

One of the oversight around design of `TransformExecutor` is
encapsulating plugin module logic. It has access to the cache and do its
own loading & storing. This means consumer of plugin runner have tricky
challenge to control its caching system. First, there is no way to
escape how swc_plugin_runner controls cache and cannot synchronize into
their own, also depends on the usecases cannot control the features they
want to opt in: for example, there's no way one interface uses in-memory
cache, and another uses filesystem since it is compile time configured
singleton.

PR revisits overall design of TransformExecutor: now it accepts a tratir
`PluginModuleBytes`, which abstracts any kind of bytes we are dealing
with, such as raw file slice or serialized `wasmer::Module`. Cache
instantiation and managing is now bubbled up to the application level
(`swc` in here), so if someone wants non-singleton caching or integrate
into their own caching system it can be customized.

Lastly, deprecated `memory_cache` feature and only exposes
`filesystem_cache`. Cache implementation uses in-memory is always
available, and can opt in filesystem cache where it's supported.


**BREAKING CHANGE:**

This is clearly breaking changes for the consumers of swc_core. for the
@swc/core, this PR takes care of necessary changes. I'll work on
next-swc changes later once we have new @swc/core version with this
changes.
2023-05-18 07:05:39 +00:00
.cargo fix(es/plugin): Disable SIMD (#6163) 2022-10-15 05:18:19 +00:00
.github chore: Update issue template to prevent useless issues (#7303) 2023-04-20 15:37:30 +09:00
.husky fix(es): Remove wrong debug assertion (#4445) 2022-04-26 14:16:38 +00:00
.vscode fix(plugin): Make span_to_source use dedicated function (#6853) 2023-01-26 02:09:36 +00:00
bindings refactor(plugin/runner): Revise cache, module loading (#7408) 2023-05-18 07:05:39 +00:00
crates refactor(plugin/runner): Revise cache, module loading (#7408) 2023-05-18 07:05:39 +00:00
docs/adr feat(visit): Add path-aware variants (#5073) 2022-07-05 04:38:27 +00:00
node-swc feat(es/module): Add export_interop_annotation flag (#7330) 2023-04-25 10:04:28 +00:00
packages/swc-helpers chore: Publish @swc/helpers@v0.5.1 2023-04-25 12:43:09 +09:00
scripts refactor(plugin): Remove bytecheck flag (#7256) 2023-04-13 05:49:58 +00:00
.gitattributes feat(html): Prepare processing system (#4358) 2022-04-22 20:20:47 +09:00
.gitignore chore: Publish v1.2.219 2022-07-27 14:45:02 +09:00
.gitmodules fix(html/parser): Fix bugs (#4502) 2022-05-03 02:49:06 +00:00
.kodiak.toml refactor(common): Cleanup & rustfmt (#3495) 2022-02-09 06:33:32 +00:00
.mocha.setup.js chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
.mocharc.js chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
.prettierignore fix(es/minifier): Don't inline into arrow heads (#7099) 2023-03-22 02:24:13 +00:00
.prettierrc chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
.rustfmt.toml feat(wasm): Expose async facade interfaces (#5352) 2022-08-01 03:00:28 +00:00
.taplo.toml chore: Update toml formatting (#5368) 2022-08-03 03:07:28 +00:00
.yarnrc.yml chore: Publish v1.2.219 2022-07-27 14:45:02 +09:00
ARCHITECTURE.md feat(swc): Add IsModule (#2601) 2021-11-16 10:31:02 +00:00
Cargo.lock chore: Publish crates 2023-05-18 01:21:08 +00:00
Cargo.toml chore(ci): Merge CI scripts (#5999) 2022-09-30 16:57:15 +09:00
CHANGELOG.md chore: Publish crates 2023-05-18 01:21:08 +00:00
cliff.toml feat(node-swc): Add libc field in Linux platform packages (#4046) 2022-03-16 18:58:24 +09:00
clippy.toml build(cargo): Update rustc to nightly-2023-03-20 (#7170) 2023-03-30 08:06:02 +00:00
CONTRIBUTING.md doc(contributing): Change feature flags for running all tests (#6396) 2022-11-10 09:39:26 +00:00
cspell.json feat(css/ast): Make AST intuitive (#6606) 2022-12-09 02:27:19 +00:00
deny.toml feat(plugin/runner): Update wasmer to v3 (#7197) 2023-04-10 03:40:25 +00:00
LICENSE chore(node): Publish v1.2.121 2021-12-19 14:14:12 +09:00
MAINTENANCE.md doc(repo): Document maintenance (#6145) 2022-10-14 03:29:55 +00:00
package.json chore: Publish v1.3.58 with swc_core v0.76.7 (#7393) 2023-05-15 13:17:25 +09:00
postinstall.js feat(es/typescript): Support TS 4.9 (#5938) 2022-09-23 16:41:56 +09:00
README.md doc: MSRV 2023-03-09 22:38:05 +09:00
rust-toolchain build(cargo): Update rustc to nightly-2023-03-20 (#7170) 2023-03-30 08:06:02 +00:00
tsconfig.json chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
yarn.lock feat(plugin): Add versioned wrapper struct (#7382) 2023-05-15 03:17:31 +00:00

swc

Make the web (development) faster.

downloads (@swc/core) downloads (3rd party)

undefined GitHub release (latest SemVer)

GitHub code size in bytes node-current (scoped)

Discord

SWC (stands for Speedy Web Compiler) is a super-fast TypeScript / JavaScript compiler written in Rust. It's a library for Rust and JavaScript at the same time. If you are using SWC from Rust, see rustdoc and for most users, your entry point for using the library will be parser.

Also, SWC tries to ensure that

If you select the latest version of each crates, it will work

for rust users.

MSRV of crates is currently nightly, but we will support stable rustc again in the future.


If you are using SWC from JavaScript, please refer to docs on the website.

Documentation

Check out the documentation in the website.

Features

Please see comparison with babel.

Performance

Please see benchmark results on the website.

Supporting swc

Sponsors

SWC is a community-driven project, and is maintained by a group of volunteers. If you'd like to help support the future of the project, please consider:

Contributing

See CONTRIBUTING.md. You may also find the architecture documentation useful (ARCHITECTURE.md).

License

SWC is primarily distributed under the terms of the Apache License (Version 2.0).

See LICENSE for details.