@vercube/devkit 0.0.32 → 0.0.34
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/index.d.mts +1 -0
- package/dist/index.mjs +25 -4
- package/package.json +9 -7
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";
|
|
@@ -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.34",
|
|
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.99.0",
|
|
26
|
+
"chokidar": "5.0.0",
|
|
27
|
+
"c12": "3.3.2",
|
|
26
28
|
"consola": "3.4.2",
|
|
27
29
|
"dotenv": "17.2.3",
|
|
28
30
|
"hookable": "5.5.3",
|
|
29
|
-
"oxc-parser": "0.
|
|
30
|
-
"oxc-transform": "0.
|
|
31
|
+
"oxc-parser": "0.99.0",
|
|
32
|
+
"oxc-transform": "0.99.0",
|
|
31
33
|
"pathe": "2.0.3",
|
|
32
|
-
"rolldown": "1.0.0-beta.
|
|
33
|
-
"unplugin-isolated-decl": "0.15.
|
|
34
|
-
"@vercube/core": "0.0.
|
|
34
|
+
"rolldown": "1.0.0-beta.52",
|
|
35
|
+
"unplugin-isolated-decl": "0.15.6",
|
|
36
|
+
"@vercube/core": "0.0.34"
|
|
35
37
|
},
|
|
36
38
|
"publishConfig": {
|
|
37
39
|
"access": "public"
|