@vercube/devkit 0.0.33 → 0.0.35
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/README.md +30 -24
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +27 -6
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<
|
|
2
|
+
<img src="https://raw.githubusercontent.com/vercube/vercube/refs/heads/main/.github/assets/cover.png" width="100%" alt="Vercube - Unleash your server development." />
|
|
3
3
|
<br>
|
|
4
4
|
<br>
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<a href="https://codecov.io/gh/vercube/vercube" target="_blank">
|
|
20
|
-
<img src="https://img.shields.io/codecov/c/github/vercube/vercube?style=for-the-badge&color=%23767eff" alt="Coverage"/>
|
|
21
|
-
</a>
|
|
22
|
-
<br/>
|
|
23
|
-
<br/>
|
|
6
|
+
# @vercube/devkit
|
|
7
|
+
|
|
8
|
+
### Build tools for Vercube
|
|
9
|
+
|
|
10
|
+
[&labelColor=%23000&color=%232f2f2f>)](https://deepwiki.com/vercube/vercube)
|
|
11
|
+
&labelColor=%23000&color=%232e2e2e&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40vercube%2Fdevkit>)
|
|
12
|
+
&labelColor=%23000&color=%232f2f2f>)
|
|
13
|
+
&labelColor=%23000&color=%232f2f2f>)
|
|
14
|
+
|
|
15
|
+
**The engine behind `@vercube/cli` - bundling, dev server, config loading. You probably don't need this directly, but it's here if you do.**
|
|
16
|
+
|
|
17
|
+
[Website](https://vercube.dev) • [Documentation](https://vercube.dev/docs/getting-started)
|
|
18
|
+
|
|
24
19
|
</div>
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
## ✨ Features
|
|
22
|
+
|
|
23
|
+
- **Rolldown bundler** - fast builds with tree-shaking
|
|
24
|
+
- **Dev server** - hot-reload for development
|
|
25
|
+
- **TypeScript** - full compilation support
|
|
26
|
+
- **Config merging** - loads and merges `vercube.config.ts`
|
|
27
|
+
|
|
28
|
+
## 📦 Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add @vercube/devkit
|
|
32
|
+
```
|
|
27
33
|
|
|
28
|
-
##
|
|
34
|
+
## 📖 Usage
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
Check out the full docs at **[vercube.dev](https://vercube.dev)**
|
|
31
37
|
|
|
32
|
-
##
|
|
38
|
+
## 📜 License
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
[MIT](https://github.com/vercube/vercube/blob/main/LICENSE)
|
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,7 @@ declare namespace DevKitTypes {
|
|
|
12
12
|
'bundler-watch:init': () => HookResult;
|
|
13
13
|
'bundler-watch:start': () => HookResult;
|
|
14
14
|
'bundler-watch:end': () => HookResult;
|
|
15
|
+
'bundler-watch:restart': () => HookResult;
|
|
15
16
|
'bundler-watch:error': (_error: Error) => HookResult;
|
|
16
17
|
}
|
|
17
18
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { createHooks } from "hookable";
|
|
|
4
4
|
import { rolldown, watch as watch$1 } from "rolldown";
|
|
5
5
|
import { resolve } from "pathe";
|
|
6
6
|
import UnpluginIsolatedDecl from "unplugin-isolated-decl/rolldown";
|
|
7
|
+
import { watch as watch$2 } from "chokidar";
|
|
7
8
|
import consola from "consola";
|
|
8
9
|
import { fork } from "node:child_process";
|
|
9
10
|
import { resolve as resolve$1 } from "node:path";
|
|
@@ -84,9 +85,9 @@ async function getRolldownConfig(ctx) {
|
|
|
84
85
|
*/
|
|
85
86
|
async function build$1(ctx) {
|
|
86
87
|
const bundlerConfig = await getRolldownConfig(ctx);
|
|
87
|
-
const build
|
|
88
|
+
const build = await rolldown({ ...bundlerConfig });
|
|
88
89
|
const outputs = Array.isArray(bundlerConfig.output) ? bundlerConfig.output : [bundlerConfig.output];
|
|
89
|
-
for (const output of outputs) await build
|
|
90
|
+
for (const output of outputs) await build.write(output);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
//#endregion
|
|
@@ -97,11 +98,23 @@ async function build$1(ctx) {
|
|
|
97
98
|
* This file is highly inspired by Nitro
|
|
98
99
|
* @see https://github.com/nitrojs/nitro/blob/v2/src/core/build/dev.ts
|
|
99
100
|
*/
|
|
100
|
-
async function watch$
|
|
101
|
-
watch$1({
|
|
101
|
+
async function watch$3(app) {
|
|
102
|
+
const watcher = watch$1({
|
|
102
103
|
...await getRolldownConfig(app.config.build),
|
|
103
104
|
onwarn: () => {}
|
|
104
|
-
})
|
|
105
|
+
});
|
|
106
|
+
const extraWatcher = watch$2([
|
|
107
|
+
resolve(app.config.build?.root ?? process.cwd(), (app.config?.c12?.dotenv)?.fileName?.[0] ?? ".env"),
|
|
108
|
+
resolve(app.config.build?.root ?? process.cwd(), "vercube.config.ts"),
|
|
109
|
+
resolve(app.config.build?.root ?? process.cwd(), app.config.build?.tsconfig ?? "tsconfig.json")
|
|
110
|
+
], { ignoreInitial: true });
|
|
111
|
+
extraWatcher.on("all", () => {
|
|
112
|
+
app.hooks.callHook("bundler-watch:restart");
|
|
113
|
+
});
|
|
114
|
+
watcher.on("close", () => {
|
|
115
|
+
extraWatcher.close();
|
|
116
|
+
});
|
|
117
|
+
watcher.on("event", (event) => {
|
|
105
118
|
switch (event.code) {
|
|
106
119
|
case "START":
|
|
107
120
|
app.hooks.callHook("bundler-watch:init");
|
|
@@ -135,7 +148,7 @@ function getBuildFunc(bundler) {
|
|
|
135
148
|
* @returns {DevKitTypes.WatchFunc} The watch function for the specified bundler
|
|
136
149
|
*/
|
|
137
150
|
function getWatchFunc(bundler) {
|
|
138
|
-
return watch$
|
|
151
|
+
return watch$3;
|
|
139
152
|
}
|
|
140
153
|
|
|
141
154
|
//#endregion
|
|
@@ -175,6 +188,14 @@ async function watch(app) {
|
|
|
175
188
|
});
|
|
176
189
|
app.hooks.callHook("dev:reload");
|
|
177
190
|
});
|
|
191
|
+
app.hooks.hook("bundler-watch:restart", () => {
|
|
192
|
+
console.clear();
|
|
193
|
+
consola.info({
|
|
194
|
+
tag: "build",
|
|
195
|
+
message: "Configuration changed, reloading..."
|
|
196
|
+
});
|
|
197
|
+
app.hooks.callHook("dev:reload");
|
|
198
|
+
});
|
|
178
199
|
app.hooks.hook("bundler-watch:error", (error) => {
|
|
179
200
|
console.log(error);
|
|
180
201
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/devkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "Devkit module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,16 +22,18 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@oxc-project/runtime": "0.
|
|
25
|
+
"@oxc-project/runtime": "0.111.0",
|
|
26
|
+
"c12": "3.3.3",
|
|
27
|
+
"chokidar": "5.0.0",
|
|
26
28
|
"consola": "3.4.2",
|
|
27
29
|
"dotenv": "17.2.3",
|
|
28
|
-
"hookable": "
|
|
29
|
-
"oxc-parser": "0.
|
|
30
|
-
"oxc-transform": "0.
|
|
30
|
+
"hookable": "6.0.1",
|
|
31
|
+
"oxc-parser": "0.111.0",
|
|
32
|
+
"oxc-transform": "0.111.0",
|
|
31
33
|
"pathe": "2.0.3",
|
|
32
|
-
"rolldown": "1.0.0-
|
|
33
|
-
"unplugin-isolated-decl": "0.15.
|
|
34
|
-
"@vercube/core": "0.0.
|
|
34
|
+
"rolldown": "1.0.0-rc.1",
|
|
35
|
+
"unplugin-isolated-decl": "0.15.7",
|
|
36
|
+
"@vercube/core": "0.0.35"
|
|
35
37
|
},
|
|
36
38
|
"publishConfig": {
|
|
37
39
|
"access": "public"
|