@vercube/devkit 0.0.42 → 0.0.43
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.mjs +21 -11
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { builtinModules } from "node:module";
|
|
2
2
|
import { loadVercubeConfig } from "@vercube/core";
|
|
3
3
|
import { createHooks } from "hookable";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
import consola, { consola as consola$1 } from "consola";
|
|
6
|
+
import { colors } from "consola/utils";
|
|
4
7
|
import { rolldown, watch as watch$1 } from "rolldown";
|
|
5
|
-
import { resolve } from "pathe";
|
|
8
|
+
import { resolve as resolve$1 } from "pathe";
|
|
6
9
|
import UnpluginIsolatedDecl from "unplugin-isolated-decl/rolldown";
|
|
7
10
|
import { watch as watch$2 } from "chokidar";
|
|
8
|
-
import consola from "consola";
|
|
9
11
|
import { fork } from "node:child_process";
|
|
10
|
-
import { resolve as resolve$1 } from "node:path";
|
|
11
12
|
|
|
12
13
|
//#region src/Common/App.ts
|
|
13
14
|
/**
|
|
@@ -35,7 +36,7 @@ async function createVercube(cfg) {
|
|
|
35
36
|
*/
|
|
36
37
|
async function getRolldownConfig(ctx) {
|
|
37
38
|
const root = ctx?.root ?? process.cwd();
|
|
38
|
-
const pkg = (await import(resolve(root, "package.json"), { with: { type: "json" } })).default;
|
|
39
|
+
const pkg = (await import(resolve$1(root, "package.json"), { with: { type: "json" } })).default;
|
|
39
40
|
const input = ctx?.entry ?? "src/index.ts";
|
|
40
41
|
const output = ctx?.output?.dir ?? "dist";
|
|
41
42
|
const tsconfig = ctx?.tsconfig ?? "tsconfig.json";
|
|
@@ -48,7 +49,7 @@ async function getRolldownConfig(ctx) {
|
|
|
48
49
|
}));
|
|
49
50
|
return {
|
|
50
51
|
input: typeof input === "string" ? { index: input } : input,
|
|
51
|
-
tsconfig: resolve(root, tsconfig),
|
|
52
|
+
tsconfig: resolve$1(root, tsconfig),
|
|
52
53
|
external: [
|
|
53
54
|
...builtinModules,
|
|
54
55
|
...builtinModules.map((m) => `node:${m}`),
|
|
@@ -57,7 +58,7 @@ async function getRolldownConfig(ctx) {
|
|
|
57
58
|
],
|
|
58
59
|
transform: { define: { ...ctx?.define } },
|
|
59
60
|
output: {
|
|
60
|
-
dir: resolve(root, output),
|
|
61
|
+
dir: resolve$1(root, output),
|
|
61
62
|
entryFileNames: "[name].mjs",
|
|
62
63
|
format: "esm",
|
|
63
64
|
exports: "auto",
|
|
@@ -87,7 +88,16 @@ async function build$1(ctx) {
|
|
|
87
88
|
const bundlerConfig = await getRolldownConfig(ctx);
|
|
88
89
|
const build = await rolldown({ ...bundlerConfig });
|
|
89
90
|
const outputs = Array.isArray(bundlerConfig.output) ? bundlerConfig.output : [bundlerConfig.output];
|
|
90
|
-
|
|
91
|
+
consola$1.info(`📦 Building \`${ctx.entry || "<no name>"}\``);
|
|
92
|
+
let results = [];
|
|
93
|
+
for (const output of outputs) {
|
|
94
|
+
const { output: result } = await build.write(output);
|
|
95
|
+
results.push(...result);
|
|
96
|
+
}
|
|
97
|
+
for (const result of results.filter((o) => o.type === "chunk")) consola$1.success({
|
|
98
|
+
tag: "build",
|
|
99
|
+
message: colors.gray(`Built ${colors.cyan(join(ctx?.output?.dir ?? "", result?.fileName ?? ""))} - ${(Buffer.byteLength(result?.code ?? "") / 1024).toFixed(2)}kb`)
|
|
100
|
+
});
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
//#endregion
|
|
@@ -104,9 +114,9 @@ async function watch$3(app) {
|
|
|
104
114
|
onwarn: () => {}
|
|
105
115
|
});
|
|
106
116
|
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")
|
|
117
|
+
resolve$1(app.config.build?.root ?? process.cwd(), (app.config?.c12?.dotenv)?.fileName?.[0] ?? ".env"),
|
|
118
|
+
resolve$1(app.config.build?.root ?? process.cwd(), "vercube.config.ts"),
|
|
119
|
+
resolve$1(app.config.build?.root ?? process.cwd(), app.config.build?.tsconfig ?? "tsconfig.json")
|
|
110
120
|
], { ignoreInitial: true });
|
|
111
121
|
extraWatcher.on("all", () => {
|
|
112
122
|
app.hooks.callHook("bundler-watch:restart");
|
|
@@ -212,7 +222,7 @@ async function watch(app) {
|
|
|
212
222
|
* @see https://github.com/nitrojs/nitro/blob/v2/src/core/dev-server/server.ts
|
|
213
223
|
*/
|
|
214
224
|
function createDevServer(app) {
|
|
215
|
-
const forkEntry = resolve
|
|
225
|
+
const forkEntry = resolve(process.cwd(), app.config.build?.output?.dir ?? "dist", "index.mjs");
|
|
216
226
|
let reloadPromise;
|
|
217
227
|
let currentFork;
|
|
218
228
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/devkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
4
|
"description": "Devkit module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@oxc-project/runtime": "0.
|
|
25
|
+
"@oxc-project/runtime": "0.112.0",
|
|
26
26
|
"c12": "3.3.3",
|
|
27
27
|
"chokidar": "5.0.0",
|
|
28
28
|
"consola": "3.4.2",
|
|
29
29
|
"dotenv": "17.2.3",
|
|
30
30
|
"hookable": "6.0.1",
|
|
31
|
-
"oxc-parser": "0.
|
|
32
|
-
"oxc-transform": "0.
|
|
31
|
+
"oxc-parser": "0.112.0",
|
|
32
|
+
"oxc-transform": "0.112.0",
|
|
33
33
|
"pathe": "2.0.3",
|
|
34
|
-
"rolldown": "1.0.0-rc.
|
|
34
|
+
"rolldown": "1.0.0-rc.3",
|
|
35
35
|
"unplugin-isolated-decl": "0.15.7",
|
|
36
|
-
"@vercube/core": "0.0.
|
|
36
|
+
"@vercube/core": "0.0.43"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|