swc_plugin_proxy/comments/host_comments_storage.rs
1/// A struct to internally store current file's comments for the
2/// transform plugins.
3///
4/// This storage is introduced to conform with existing design to the comments,
5/// specifically `SingleThreadedComments`. It doesn't support thread-safety
6/// which does not allow to be passed into wasmerEnv (HostEnvironment). A scoped
7/// tls holds inner comments as global, per each transform execution. Refer
8/// `swc_plugin::transform_execytor::TransformExecutor::transform` for the
9/// responsibility to manage actual data.
10///
11/// Should never attempt to use this other than plugin_runner.
12// TODO: This storage does not support mutable yet
13#[cfg(feature = "__plugin_rt")]
14pub struct HostCommentsStorage {
15 pub inner: Option<swc_common::comments::SingleThreadedComments>,
16}
17
18#[cfg(feature = "__plugin_rt")]
19better_scoped_tls::scoped_tls!(
20 pub static COMMENTS: HostCommentsStorage
21);