@vercube/devkit 0.0.23 → 0.0.25
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 -23
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -15,14 +15,12 @@ import { resolve as resolve$1 } from "node:path";
|
|
|
15
15
|
* @returns {DevKitTypes.App} The development server application instance.
|
|
16
16
|
*/
|
|
17
17
|
async function createVercube(cfg) {
|
|
18
|
-
const hooks = createHooks();
|
|
19
|
-
const config = await loadVercubeConfig({
|
|
20
|
-
...cfg,
|
|
21
|
-
dev: true
|
|
22
|
-
});
|
|
23
18
|
return {
|
|
24
|
-
hooks,
|
|
25
|
-
config
|
|
19
|
+
hooks: createHooks(),
|
|
20
|
+
config: await loadVercubeConfig({
|
|
21
|
+
...cfg,
|
|
22
|
+
dev: true
|
|
23
|
+
})
|
|
26
24
|
};
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -39,9 +37,17 @@ async function getRolldownConfig(ctx) {
|
|
|
39
37
|
const pkg = (await import(resolve(root, "package.json"), { with: { type: "json" } })).default;
|
|
40
38
|
const input = ctx?.entry ?? "src/index.ts";
|
|
41
39
|
const output = ctx?.output?.dir ?? "dist";
|
|
40
|
+
const tsconfig = ctx?.tsconfig ?? "tsconfig.json";
|
|
41
|
+
const dts = ctx?.dts ?? true;
|
|
42
|
+
const customPlugins = ctx?.plugins ?? [];
|
|
43
|
+
const defaultPlugins = [];
|
|
44
|
+
if (dts) defaultPlugins.push(UnpluginIsolatedDecl({
|
|
45
|
+
transformer: "oxc",
|
|
46
|
+
patchCjsDefaultExport: true
|
|
47
|
+
}));
|
|
42
48
|
return {
|
|
43
|
-
input: { index: input },
|
|
44
|
-
tsconfig: resolve(root,
|
|
49
|
+
input: typeof input === "string" ? { index: input } : input,
|
|
50
|
+
tsconfig: resolve(root, tsconfig),
|
|
45
51
|
define: { ...ctx?.define },
|
|
46
52
|
external: [
|
|
47
53
|
...builtinModules,
|
|
@@ -60,10 +66,7 @@ async function getRolldownConfig(ctx) {
|
|
|
60
66
|
onwarn: (warning, warn) => {
|
|
61
67
|
if (!warning.code || !["CIRCULAR_DEPENDENCY"].includes(warning.code)) warn(warning);
|
|
62
68
|
},
|
|
63
|
-
plugins: [
|
|
64
|
-
transformer: "oxc",
|
|
65
|
-
patchCjsDefaultExport: true
|
|
66
|
-
})]
|
|
69
|
+
plugins: [...defaultPlugins, ...customPlugins]
|
|
67
70
|
};
|
|
68
71
|
}
|
|
69
72
|
|
|
@@ -95,12 +98,10 @@ async function build$1(ctx) {
|
|
|
95
98
|
* @see https://github.com/nitrojs/nitro/blob/v2/src/core/build/dev.ts
|
|
96
99
|
*/
|
|
97
100
|
async function watch$2(app) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
...bundlerConfig,
|
|
101
|
+
watch$1({
|
|
102
|
+
...await getRolldownConfig(app.config.build),
|
|
101
103
|
onwarn: () => {}
|
|
102
|
-
})
|
|
103
|
-
watcher.on("event", (event) => {
|
|
104
|
+
}).on("event", (event) => {
|
|
104
105
|
switch (event.code) {
|
|
105
106
|
case "START":
|
|
106
107
|
app.hooks.callHook("bundler-watch:init");
|
|
@@ -145,9 +146,7 @@ function getWatchFunc(bundler) {
|
|
|
145
146
|
* @returns {Promise<void>} A promise that resolves when the build is complete.
|
|
146
147
|
*/
|
|
147
148
|
async function build(app) {
|
|
148
|
-
|
|
149
|
-
const build$2 = getBuildFunc(bundler);
|
|
150
|
-
await build$2(app?.config?.build);
|
|
149
|
+
await getBuildFunc(app?.config?.build?.bundler ?? "rolldown")(app?.config?.build);
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
//#endregion
|
|
@@ -159,8 +158,7 @@ async function build(app) {
|
|
|
159
158
|
* @see https://github.com/nitrojs/nitro/blob/v2/src/core/build/dev.ts
|
|
160
159
|
*/
|
|
161
160
|
async function watch(app) {
|
|
162
|
-
const
|
|
163
|
-
const watcher = getWatchFunc(bundler);
|
|
161
|
+
const watcher = getWatchFunc(app?.config?.build?.bundler ?? "rolldown");
|
|
164
162
|
let start;
|
|
165
163
|
app.hooks.hook("bundler-watch:start", () => {
|
|
166
164
|
console.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/devkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "Devkit module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@oxc-project/runtime": "0.
|
|
25
|
+
"@oxc-project/runtime": "0.94.0",
|
|
26
26
|
"consola": "3.4.2",
|
|
27
|
-
"dotenv": "17.2.
|
|
27
|
+
"dotenv": "17.2.3",
|
|
28
28
|
"hookable": "5.5.3",
|
|
29
|
-
"oxc-parser": "0.
|
|
30
|
-
"oxc-transform": "0.
|
|
29
|
+
"oxc-parser": "0.94.0",
|
|
30
|
+
"oxc-transform": "0.94.0",
|
|
31
31
|
"pathe": "2.0.3",
|
|
32
|
-
"rolldown": "1.0.0-beta.
|
|
33
|
-
"unplugin-isolated-decl": "0.15.
|
|
34
|
-
"@vercube/core": "0.0.
|
|
32
|
+
"rolldown": "1.0.0-beta.42",
|
|
33
|
+
"unplugin-isolated-decl": "0.15.2",
|
|
34
|
+
"@vercube/core": "0.0.25"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|