@browsersync/bslive 0.0.5 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +32 -18
- package/bin.js +6 -0
- package/bslive/Cargo.toml +35 -0
- package/{build.rs → bslive/build.rs} +1 -1
- package/bslive/src/lib.rs +130 -0
- package/bsnext/Cargo.toml +21 -0
- package/bsnext/src/main.rs +110 -0
- package/crates/bsnext_client/Cargo.toml +8 -0
- package/crates/bsnext_client/build.rs +53 -0
- package/crates/bsnext_client/dist/index.js +6493 -0
- package/crates/bsnext_client/generated/dto.ts +116 -0
- package/crates/bsnext_client/generated/schema.ts +187 -0
- package/crates/bsnext_client/index.html +14 -0
- package/crates/bsnext_client/package-lock.json +2059 -0
- package/crates/bsnext_client/package.json +25 -0
- package/crates/bsnext_client/src/lib.rs +1 -0
- package/crates/bsnext_client/style.css +3 -0
- package/crates/bsnext_client/ts/console.ts +25 -0
- package/crates/bsnext_client/ts/index.ts +73 -0
- package/crates/bsnext_client/tsconfig.json +16 -0
- package/crates/bsnext_core/Cargo.toml +43 -0
- package/crates/bsnext_core/src/dir_loader.rs +230 -0
- package/crates/bsnext_core/src/dto.rs +281 -0
- package/crates/bsnext_core/src/handlers/mod.rs +1 -0
- package/crates/bsnext_core/src/handlers/proxy.rs +95 -0
- package/crates/bsnext_core/src/lib.rs +11 -0
- package/crates/bsnext_core/src/meta/mod.rs +5 -0
- package/crates/bsnext_core/src/not_found/mod.rs +2 -0
- package/crates/bsnext_core/src/not_found/not_found.html +20 -0
- package/crates/bsnext_core/src/not_found/not_found_service.rs +41 -0
- package/crates/bsnext_core/src/not_found/route_list.rs +49 -0
- package/crates/bsnext_core/src/panic_handler.rs +32 -0
- package/crates/bsnext_core/src/raw_loader.rs +226 -0
- package/crates/bsnext_core/src/server/actor.rs +92 -0
- package/crates/bsnext_core/src/server/error.rs +41 -0
- package/crates/bsnext_core/src/server/handler_change.rs +85 -0
- package/crates/bsnext_core/src/server/handler_listen.rs +157 -0
- package/crates/bsnext_core/src/server/handler_patch.rs +42 -0
- package/crates/bsnext_core/src/server/handler_routes_updated.rs +27 -0
- package/crates/bsnext_core/src/server/handler_stop.rs +38 -0
- package/crates/bsnext_core/src/server/mod.rs +10 -0
- package/crates/bsnext_core/src/server/router/mod.rs +112 -0
- package/crates/bsnext_core/src/server/router/tests.rs +204 -0
- package/crates/bsnext_core/src/server/signals.rs +11 -0
- package/crates/bsnext_core/src/server/state.rs +19 -0
- package/crates/bsnext_core/src/servers_supervisor/actor.rs +199 -0
- package/crates/bsnext_core/src/servers_supervisor/file_changed_handler.rs +41 -0
- package/crates/bsnext_core/src/servers_supervisor/get_servers_handler.rs +23 -0
- package/crates/bsnext_core/src/servers_supervisor/input_changed_handler.rs +21 -0
- package/crates/bsnext_core/src/servers_supervisor/mod.rs +6 -0
- package/crates/bsnext_core/src/servers_supervisor/start_handler.rs +82 -0
- package/crates/bsnext_core/src/servers_supervisor/stop_handler.rs +26 -0
- package/crates/bsnext_core/src/ws/mod.rs +164 -0
- package/crates/bsnext_example/Cargo.toml +10 -0
- package/crates/bsnext_example/src/basic.rs +51 -0
- package/crates/bsnext_example/src/lib.rs +26 -0
- package/crates/bsnext_example/src/lit.rs +37 -0
- package/crates/bsnext_example/src/md.rs +18 -0
- package/crates/bsnext_fs/Cargo.toml +22 -0
- package/crates/bsnext_fs/src/actor.rs +122 -0
- package/crates/bsnext_fs/src/buffered_debounce.rs +166 -0
- package/crates/bsnext_fs/src/filter.rs +30 -0
- package/crates/bsnext_fs/src/inner_fs_event_handler.rs +94 -0
- package/crates/bsnext_fs/src/lib.rs +141 -0
- package/crates/bsnext_fs/src/remove_path_handler.rs +46 -0
- package/crates/bsnext_fs/src/stop_handler.rs +15 -0
- package/crates/bsnext_fs/src/stream.rs +167 -0
- package/crates/bsnext_fs/src/test/mod.rs +213 -0
- package/crates/bsnext_fs/src/watch_path_handler.rs +67 -0
- package/crates/bsnext_fs/src/watcher.rs +348 -0
- package/crates/bsnext_input/Cargo.toml +22 -0
- package/crates/bsnext_input/src/input_test/mod.rs +151 -0
- package/crates/bsnext_input/src/lib.rs +153 -0
- package/crates/bsnext_input/src/md.rs +541 -0
- package/crates/bsnext_input/src/paths.rs +64 -0
- package/crates/bsnext_input/src/route.rs +185 -0
- package/crates/bsnext_input/src/route_manifest.rs +186 -0
- package/crates/bsnext_input/src/server_config.rs +88 -0
- package/crates/bsnext_input/src/target.rs +7 -0
- package/crates/bsnext_input/src/watch_opt_test/mod.rs +68 -0
- package/crates/bsnext_input/src/yml.rs +1 -0
- package/crates/bsnext_output/Cargo.toml +16 -0
- package/crates/bsnext_output/src/json.rs +11 -0
- package/crates/bsnext_output/src/lib.rs +25 -0
- package/crates/bsnext_output/src/pretty.rs +147 -0
- package/crates/bsnext_resp/Cargo.toml +13 -0
- package/crates/bsnext_resp/src/js/snippet.html +1 -0
- package/crates/bsnext_resp/src/js/ws.js +1 -0
- package/crates/bsnext_resp/src/lib.rs +79 -0
- package/crates/bsnext_system/Cargo.toml +29 -0
- package/crates/bsnext_system/src/args.rs +43 -0
- package/crates/bsnext_system/src/lib.rs +227 -0
- package/crates/bsnext_system/src/monitor.rs +241 -0
- package/crates/bsnext_system/src/monitor_any_watchables.rs +127 -0
- package/crates/bsnext_system/src/start_kind/snapshots/bsnext_system__start_kind__start_from_paths__test__test-2.snap +11 -0
- package/crates/bsnext_system/src/start_kind/snapshots/bsnext_system__start_kind__start_from_paths__test__test.snap +29 -0
- package/crates/bsnext_system/src/start_kind/start_from_example.rs +49 -0
- package/crates/bsnext_system/src/start_kind/start_from_inputs.rs +67 -0
- package/crates/bsnext_system/src/start_kind/start_from_paths.rs +51 -0
- package/crates/bsnext_system/src/start_kind.rs +56 -0
- package/crates/bsnext_system/src/startup.rs +51 -0
- package/crates/bsnext_tracing/Cargo.toml +10 -0
- package/crates/bsnext_tracing/src/lib.rs +89 -0
- package/examples/basic/input.yml +5 -0
- package/examples/basic/public/index.html +15 -0
- package/examples/basic/public/reset.css +52 -0
- package/examples/basic/public/script.js +1 -0
- package/examples/basic/public/styles.css +3 -0
- package/examples/kitchen-sink/a-file.md +1 -0
- package/examples/kitchen-sink/api/1.json +1 -0
- package/examples/kitchen-sink/api/2.json +3 -0
- package/examples/kitchen-sink/app.js +1 -0
- package/examples/kitchen-sink/input.html +185 -0
- package/examples/kitchen-sink/input.yml +133 -0
- package/examples/kitchen-sink/styles-2.css +3 -0
- package/examples/lit/index.html +21 -0
- package/examples/lit/input.yml +5 -0
- package/examples/lit/lit.js +82 -0
- package/examples/lit/package-lock.json +62 -0
- package/examples/lit/package.json +15 -0
- package/examples/md-single/frontmatter.md +35 -0
- package/examples/md-single/md-single.md +35 -0
- package/examples/openai/.nvm +1 -0
- package/examples/openai/build.mjs +21 -0
- package/examples/openai/index.html +13 -0
- package/examples/openai/input.yml +59 -0
- package/examples/openai/package-lock.json +720 -0
- package/examples/openai/package.json +21 -0
- package/examples/openai/src/index.js +21 -0
- package/examples/openai/sse/01.txt +8 -0
- package/examples/proxy-simple/input.yml +9 -0
- package/examples/single/input.yaml +26 -0
- package/index.d.ts +3 -1
- package/index.js +3 -2
- package/package.json +22 -19
- package/run.sh +6 -0
- package/src/lib.rs +0 -9
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
use std::fmt::{Display, Formatter};
|
|
2
|
+
use tracing_subscriber::layer::SubscriberExt;
|
|
3
|
+
use tracing_subscriber::util::SubscriberInitExt;
|
|
4
|
+
|
|
5
|
+
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
|
|
6
|
+
pub enum LogLevel {
|
|
7
|
+
Info,
|
|
8
|
+
Debug,
|
|
9
|
+
Trace,
|
|
10
|
+
Error,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl Display for LogLevel {
|
|
14
|
+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
15
|
+
match self {
|
|
16
|
+
LogLevel::Info => write!(f, "info"),
|
|
17
|
+
LogLevel::Debug => write!(f, "debug"),
|
|
18
|
+
LogLevel::Trace => write!(f, "trace"),
|
|
19
|
+
LogLevel::Error => write!(f, "error"),
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl Default for LogLevel {
|
|
25
|
+
fn default() -> Self {
|
|
26
|
+
Self::Info
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
|
|
31
|
+
pub enum OutputFormat {
|
|
32
|
+
Json,
|
|
33
|
+
Normal,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
impl Display for OutputFormat {
|
|
37
|
+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
38
|
+
match self {
|
|
39
|
+
OutputFormat::Json => write!(f, "json"),
|
|
40
|
+
OutputFormat::Normal => write!(f, "normal"),
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
impl Default for OutputFormat {
|
|
46
|
+
fn default() -> Self {
|
|
47
|
+
Self::Normal
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
pub fn init_tracing(log_level: Option<LogLevel>, format: Option<OutputFormat>) {
|
|
51
|
+
let log_level = log_level.unwrap_or(LogLevel::Error);
|
|
52
|
+
let level = log_level.to_string();
|
|
53
|
+
let lines = [
|
|
54
|
+
format!("bsnext={level}"),
|
|
55
|
+
format!("bsnext_core={level}"),
|
|
56
|
+
"bsnext_fs::stream=info".to_string(),
|
|
57
|
+
"bsnext_fs::watcher=info".to_string(),
|
|
58
|
+
// "bsnext_core::server_actor=info".to_string(),
|
|
59
|
+
];
|
|
60
|
+
let debug_str = lines.join(",");
|
|
61
|
+
|
|
62
|
+
match format.unwrap_or_default() {
|
|
63
|
+
OutputFormat::Json => {
|
|
64
|
+
let fmt_layer = tracing_subscriber::fmt::layer()
|
|
65
|
+
.without_time()
|
|
66
|
+
.json()
|
|
67
|
+
.with_file(false);
|
|
68
|
+
tracing_subscriber::registry()
|
|
69
|
+
.with(
|
|
70
|
+
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
71
|
+
.unwrap_or_else(|_| debug_str.into()),
|
|
72
|
+
)
|
|
73
|
+
.with(fmt_layer)
|
|
74
|
+
.init();
|
|
75
|
+
}
|
|
76
|
+
OutputFormat::Normal => {
|
|
77
|
+
let fmt_layer = tracing_subscriber::fmt::layer()
|
|
78
|
+
.without_time()
|
|
79
|
+
.with_file(false);
|
|
80
|
+
tracing_subscriber::registry()
|
|
81
|
+
.with(
|
|
82
|
+
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
83
|
+
.unwrap_or_else(|_| debug_str.into()),
|
|
84
|
+
)
|
|
85
|
+
.with(fmt_layer)
|
|
86
|
+
.init();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport"
|
|
6
|
+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
+
<title>Basic</title>
|
|
9
|
+
<link rel="stylesheet" href="styles.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<p>Edit me!</p>
|
|
13
|
+
<script type="module" src="script.js"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
1. Use a more-intuitive box-sizing model.
|
|
3
|
+
*/
|
|
4
|
+
*, *::before, *::after {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
2. Remove default margin
|
|
10
|
+
*/
|
|
11
|
+
* {
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
Typographic tweaks!
|
|
17
|
+
3. Add accessible line-height
|
|
18
|
+
4. Improve text rendering
|
|
19
|
+
*/
|
|
20
|
+
body {
|
|
21
|
+
line-height: 1.5;
|
|
22
|
+
-webkit-font-smoothing: antialiased;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
5. Improve media defaults
|
|
27
|
+
*/
|
|
28
|
+
img, picture, video, canvas, svg {
|
|
29
|
+
display: block;
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
6. Remove built-in form typography styles
|
|
35
|
+
*/
|
|
36
|
+
input, button, textarea, select {
|
|
37
|
+
font: inherit;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
7. Avoid text overflows
|
|
42
|
+
*/
|
|
43
|
+
p, h1, h2, h3, h4, h5, h6 {
|
|
44
|
+
overflow-wrap: break-word;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
8. Create a root stacking context
|
|
49
|
+
*/
|
|
50
|
+
#root, #__next {
|
|
51
|
+
isolation: isolate;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("hello from script.js")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a-file.txt file.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
["1", "2"]
|