rspack_plugin_javascript/
lib.rs

1#![recursion_limit = "256"]
2
3pub mod dependency;
4pub mod parser_and_generator;
5mod parser_plugin;
6mod plugin;
7pub mod runtime;
8pub mod utils;
9pub mod visitors;
10mod webpack_comment;
11pub use parser_plugin::*;
12use rspack_core::rspack_sources::SourceMap;
13
14pub use crate::plugin::{infer_async_modules_plugin::InferAsyncModulesPlugin, *};
15
16#[derive(Debug)]
17pub struct TransformOutput {
18  pub code: String,
19  pub map: Option<SourceMap>,
20}
21
22#[derive(Debug)]
23pub enum SourceMapsConfig {
24  Bool(bool),
25  Str(String),
26}
27
28impl SourceMapsConfig {
29  pub fn enabled(&self) -> bool {
30    match *self {
31      SourceMapsConfig::Bool(b) => b,
32      SourceMapsConfig::Str(ref s) => {
33        assert_eq!(s, "inline", "Source map must be true, false or inline");
34        true
35      }
36    }
37  }
38}
39
40#[derive(Debug)]
41pub enum IsModule {
42  Bool(bool),
43  Unknown,
44}