File: plugin.rs

package info (click to toggle)
rust-swc-core 35.0.0~ds-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 62,792 kB
  • sloc: javascript: 873; xml: 538; sh: 358; makefile: 35; python: 5
file content (128 lines) | stat: -rw-r--r-- 3,316 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// #[plugin_transform] macro
#[cfg(any(
    all(
        docsrs,
        any(
            feature = "__common_plugin_transform",
            feature = "__css_plugin_transform"
        )
    ),
    feature = "__common_plugin_transform",
    feature = "__css_plugin_transform",
))]
#[cfg_attr(
    docsrs,
    doc(cfg(any(
        feature = "__common_plugin_transform",
        feature = "__css_plugin_transform"
    )))
)]
pub use swc_plugin_macro::css_plugin_transform;
#[cfg(any(
    all(
        docsrs,
        any(
            feature = "__common_plugin_transform",
            feature = "__css_plugin_transform",
            feature = "__ecma_plugin_transform"
        )
    ),
    feature = "__common_plugin_transform",
    feature = "__css_plugin_transform",
    feature = "__ecma_plugin_transform"
))]
#[cfg_attr(
    docsrs,
    doc(cfg(any(
        feature = "__common_plugin_transform",
        feature = "__css_plugin_transform",
        feature = "__ecma_plugin_transform"
    )))
)]
pub use swc_plugin_macro::plugin_transform;

/// exported __alloc / __free fn for the guest (plugin)
/// allows to allocate memory from the host side.
/// This should not be directly referenced.
#[cfg(all(feature = "__common_plugin_transform", target_arch = "wasm32"))]
pub mod memory {
    pub use swc_plugin::allocation::*;
}

/// Global HANDLER implementation for the plugin
/// for error reporting.
#[cfg(any(
    all(
        docsrs,
        any(
            feature = "__common_plugin_transform",
            feature = "__css_plugin_transform",
            feature = "__ecma_plugin_transform"
        )
    ),
    feature = "__common_plugin_transform",
    feature = "__css_plugin_transform",
    feature = "__ecma_plugin_transform"
))]
#[cfg_attr(
    docsrs,
    doc(cfg(any(
        feature = "__common_plugin_transform",
        feature = "__css_plugin_transform",
        feature = "__ecma_plugin_transform"
    )))
)]
pub mod errors {
    pub use swc_common::errors::HANDLER;
}

/// Plugin's environment metadata context.
#[cfg(any(
    all(
        docsrs,
        any(
            feature = "__common_plugin_transform",
            feature = "__css_plugin_transform",
            feature = "__ecma_plugin_transform"
        )
    ),
    feature = "__common_plugin_transform",
    feature = "__css_plugin_transform",
    feature = "__ecma_plugin_transform"
))]
#[cfg_attr(
    docsrs,
    doc(cfg(any(
        feature = "__common_plugin_transform",
        feature = "__css_plugin_transform",
        feature = "__ecma_plugin_transform"
    )))
)]
pub mod metadata {
    pub use swc_common::plugin::metadata::TransformPluginMetadataContextKind;
    pub use swc_plugin_proxy::TransformPluginProgramMetadata;
}

/// Proxy to the host's data not attached to the AST, like sourcemap / comments.
/// Or interfaces to setup the plugin's environment from the host.
#[cfg(any(
    all(
        docsrs,
        any(
            feature = "__common_plugin_transform",
            feature = "__plugin_transform_host"
        )
    ),
    feature = "__common_plugin_transform",
    feature = "__plugin_transform_host"
))]
#[cfg_attr(
    docsrs,
    doc(cfg(any(
        feature = "__common_plugin_transform",
        feature = "__plugin_transform_host"
    )))
)]
pub mod proxies {
    pub use swc_plugin_proxy::*;
}