bun-dev-server 1.0.1 → 1.0.3
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/dist/buildManager.d.ts +7 -2
- package/dist/bunServeConfig.d.ts +10 -1
- package/dist/configManager.d.ts +3 -2
- package/dist/fileWatcher.d.ts +3 -2
- package/dist/index.css +164 -0
- package/dist/index.js +916 -848
- package/dist/utils/filesystem.d.ts +5 -0
- package/package.json +8 -4
- package/dist/assets/serveOutputStyles.css +0 -166
package/dist/buildManager.d.ts
CHANGED
|
@@ -8,13 +8,18 @@ import { type BunDevServerConfig } from "./bunServeConfig";
|
|
|
8
8
|
* @returns A p-queue instance configured for throttled builds
|
|
9
9
|
*/
|
|
10
10
|
export declare function getThrottledBuildQueue(serverConfig: BunDevServerConfig): pqueue;
|
|
11
|
+
export interface BuildEnvPaths {
|
|
12
|
+
buildDestination: string;
|
|
13
|
+
serveDestination: string;
|
|
14
|
+
watchDestination: string;
|
|
15
|
+
}
|
|
11
16
|
/**
|
|
12
17
|
* Build and notify clients about the build result
|
|
13
18
|
* @param importerMeta - The ImportMeta object from the caller
|
|
14
19
|
* @param finalConfig - The final server configuration
|
|
15
|
-
* @param
|
|
20
|
+
* @param buildDestination - The absolute path to the output directory
|
|
16
21
|
* @param buildCfg - The build configuration
|
|
17
22
|
* @param bunServer - The Bun server instance
|
|
18
23
|
* @param event - The file change event that triggered the build
|
|
19
24
|
*/
|
|
20
|
-
export declare function cleanBuildAndNotify(importerMeta: ImportMeta, finalConfig: BunDevServerConfig,
|
|
25
|
+
export declare function cleanBuildAndNotify(importerMeta: ImportMeta, finalConfig: BunDevServerConfig, paths: BuildEnvPaths, buildCfg: BuildConfig, bunServer: Server<any>, event: FileChangeInfo<string>): Promise<void>;
|
package/dist/bunServeConfig.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import type { FileChangeInfo } from "fs/promises";
|
|
|
3
3
|
export interface BuildEnv {
|
|
4
4
|
importerMeta: ImportMeta;
|
|
5
5
|
finalConfig: BunDevServerConfig;
|
|
6
|
-
|
|
6
|
+
buildDestination: string;
|
|
7
|
+
serveDestination: string;
|
|
8
|
+
watchDestination: string;
|
|
7
9
|
buildCfg: BuildConfig;
|
|
8
10
|
bunServer: Server<any>;
|
|
9
11
|
event: FileChangeInfo<any>;
|
|
@@ -98,6 +100,13 @@ export interface BunDevServerConfig extends Partial<BunServeConfig> {
|
|
|
98
100
|
* Whether to clean the `servePath` before building a new batch.
|
|
99
101
|
*/
|
|
100
102
|
cleanServePath?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Whether to clean the `outdir` before building a new batch.
|
|
105
|
+
*
|
|
106
|
+
* If `outdir` is under `servePath` and `cleanServePath` is true,
|
|
107
|
+
* then `outdir` will be cleaned regardless.
|
|
108
|
+
*/
|
|
109
|
+
cleanBuildPath?: boolean;
|
|
101
110
|
/**
|
|
102
111
|
* The EJS template used for the output of the `/` path on the server.
|
|
103
112
|
* When supplying your own template, the properties that are provided during rendering are `files` and `dirs` both are arrays.
|
package/dist/configManager.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ import { type BuildConfig } from "bun";
|
|
|
5
5
|
import { type BunDevServerConfig } from "./bunServeConfig";
|
|
6
6
|
export interface PreparedConfig {
|
|
7
7
|
finalConfig: BunDevServerConfig;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
serveDestination: string;
|
|
9
|
+
buildDestination: string;
|
|
10
|
+
watchDestination: string;
|
|
10
11
|
buildCfg: BuildConfig;
|
|
11
12
|
}
|
|
12
13
|
/**
|
package/dist/fileWatcher.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type BuildConfig, type Server } from "bun";
|
|
2
2
|
import { type BunDevServerConfig } from "./bunServeConfig";
|
|
3
|
+
import { type BuildEnvPaths } from "./buildManager";
|
|
3
4
|
/**
|
|
4
5
|
* Start watching a directory for changes and trigger builds
|
|
5
6
|
* @param srcWatch - The absolute path to watch for changes
|
|
6
7
|
* @param importMeta - The ImportMeta object from the caller
|
|
7
8
|
* @param finalConfig - The final server configuration
|
|
8
|
-
* @param
|
|
9
|
+
* @param buildDestination - The absolute path to the output directory
|
|
9
10
|
* @param buildCfg - The build configuration
|
|
10
11
|
* @param bunServer - The Bun server instance
|
|
11
12
|
*/
|
|
12
|
-
export declare function startFileWatcher(srcWatch: string, importMeta: ImportMeta, finalConfig: BunDevServerConfig,
|
|
13
|
+
export declare function startFileWatcher(srcWatch: string, importMeta: ImportMeta, finalConfig: BunDevServerConfig, paths: BuildEnvPaths, buildCfg: BuildConfig, bunServer: Server<any>): Promise<void>;
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/* src/static/serveOutputStyles.css */
|
|
2
|
+
:root {
|
|
3
|
+
color-scheme: light dark;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
* {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
body {
|
|
11
|
+
color: #0f172a;
|
|
12
|
+
background: #f8fafc;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 2.5rem 1.5rem 3rem;
|
|
15
|
+
font: 15px / 1.5 Segoe UI, Tahoma, sans-serif;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@media (prefers-color-scheme: dark) {
|
|
19
|
+
body {
|
|
20
|
+
color: #e2e8f0;
|
|
21
|
+
background: #0f172a;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.wrapper {
|
|
26
|
+
-webkit-backdrop-filter: blur(6px);
|
|
27
|
+
backdrop-filter: blur(6px);
|
|
28
|
+
background: #ffffffd9;
|
|
29
|
+
border-radius: 16px;
|
|
30
|
+
max-width: 960px;
|
|
31
|
+
margin: 0 auto;
|
|
32
|
+
padding: 2rem;
|
|
33
|
+
box-shadow: 0 20px 45px #0f172a1f;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (prefers-color-scheme: dark) {
|
|
37
|
+
.wrapper {
|
|
38
|
+
background: #0f172aad;
|
|
39
|
+
box-shadow: 0 20px 45px #0f172aa6;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
header {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: 1rem;
|
|
47
|
+
margin-bottom: 1.75rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
h1 {
|
|
51
|
+
letter-spacing: -.02em;
|
|
52
|
+
margin: 0;
|
|
53
|
+
font-size: 1.75rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.breadcrumbs {
|
|
57
|
+
display: flex;
|
|
58
|
+
color: inherit;
|
|
59
|
+
flex-wrap: wrap;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: .5rem;
|
|
62
|
+
font-size: .95rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.breadcrumbs span {
|
|
66
|
+
opacity: .7;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
a {
|
|
70
|
+
color: #2563eb;
|
|
71
|
+
text-decoration: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
a:hover, a:focus-visible {
|
|
75
|
+
text-decoration: underline;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.listing {
|
|
79
|
+
display: grid;
|
|
80
|
+
gap: .75rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.item {
|
|
84
|
+
display: flex;
|
|
85
|
+
background: #0f172a05;
|
|
86
|
+
border: 1px solid #0f172a14;
|
|
87
|
+
border-radius: 12px;
|
|
88
|
+
align-items: center;
|
|
89
|
+
gap: .9rem;
|
|
90
|
+
padding: .85rem 1rem;
|
|
91
|
+
transition: transform .15s, box-shadow .15s, border-color .15s;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.item:hover, .item:focus-visible {
|
|
95
|
+
background: #2563eb14;
|
|
96
|
+
border-color: #2563eb66;
|
|
97
|
+
transform: translateY(-2px);
|
|
98
|
+
box-shadow: 0 12px 25px #2563eb26;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.item .icon {
|
|
102
|
+
opacity: .85;
|
|
103
|
+
object-fit: contain;
|
|
104
|
+
flex: none;
|
|
105
|
+
width: 28px;
|
|
106
|
+
height: 28px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.item .text {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
gap: .2rem;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.item .name {
|
|
116
|
+
word-break: break-word;
|
|
117
|
+
font-size: 1rem;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.item .meta {
|
|
122
|
+
text-transform: uppercase;
|
|
123
|
+
letter-spacing: .08em;
|
|
124
|
+
opacity: .6;
|
|
125
|
+
font-size: .78rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.empty {
|
|
129
|
+
text-align: center;
|
|
130
|
+
opacity: .7;
|
|
131
|
+
border: 1px dashed #0f172a33;
|
|
132
|
+
border-radius: 12px;
|
|
133
|
+
margin: 0;
|
|
134
|
+
padding: 1.5rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media (prefers-color-scheme: dark) {
|
|
138
|
+
.item {
|
|
139
|
+
background: #94a3b80f;
|
|
140
|
+
border-color: #e2e8f014;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.item:hover, .item:focus-visible {
|
|
144
|
+
background: #3b82f633;
|
|
145
|
+
border-color: #60a5fa73;
|
|
146
|
+
box-shadow: 0 12px 25px #0f172a80;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.empty {
|
|
150
|
+
border-color: #e2e8f02e;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.back-link {
|
|
155
|
+
display: inline-flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
gap: .35rem;
|
|
158
|
+
font-size: .95rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.back-link svg {
|
|
162
|
+
width: 20px;
|
|
163
|
+
height: 20px;
|
|
164
|
+
}
|