@zenithbuild/core 0.6.0 → 0.6.1
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/cli/commands/dev.ts +7 -6
- package/dist/cli.js +1 -0
- package/dist/zen-build.js +5 -3
- package/dist/zen-dev.js +5 -3
- package/dist/zen-preview.js +5 -3
- package/dist/zenith.js +5 -3
- package/package.json +1 -1
package/cli/commands/dev.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
import fs from 'fs'
|
|
3
|
-
import os from 'os'
|
|
4
3
|
import { serve, type ServerWebSocket } from 'bun'
|
|
5
4
|
import { requireProject } from '../utils/project'
|
|
6
5
|
import * as logger from '../utils/logger'
|
|
@@ -40,21 +39,23 @@ async function bundlePageScript(script: string, projectRoot: string): Promise<st
|
|
|
40
39
|
return script
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
//
|
|
44
|
-
const tempDir =
|
|
45
|
-
|
|
42
|
+
// Write temp file in PROJECT directory so Bun can find node_modules
|
|
43
|
+
const tempDir = path.join(projectRoot, '.zenith-cache')
|
|
44
|
+
if (!fs.existsSync(tempDir)) {
|
|
45
|
+
fs.mkdirSync(tempDir, { recursive: true })
|
|
46
|
+
}
|
|
47
|
+
const tempFile = path.join(tempDir, `bundle-${Date.now()}.js`)
|
|
46
48
|
|
|
47
49
|
try {
|
|
48
50
|
// Write script to temp file
|
|
49
51
|
fs.writeFileSync(tempFile, script, 'utf-8')
|
|
50
52
|
|
|
51
|
-
// Use Bun.build to bundle with npm resolution
|
|
53
|
+
// Use Bun.build to bundle with npm resolution from project's node_modules
|
|
52
54
|
const result = await Bun.build({
|
|
53
55
|
entrypoints: [tempFile],
|
|
54
56
|
target: 'browser',
|
|
55
57
|
format: 'esm',
|
|
56
58
|
minify: false,
|
|
57
|
-
// Resolve modules from the project's node_modules
|
|
58
59
|
external: [], // Bundle everything
|
|
59
60
|
})
|
|
60
61
|
|
package/dist/cli.js
CHANGED
package/dist/zen-build.js
CHANGED
|
@@ -9285,7 +9285,6 @@ import process2 from "process";
|
|
|
9285
9285
|
// cli/commands/dev.ts
|
|
9286
9286
|
import path8 from "path";
|
|
9287
9287
|
import fs8 from "fs";
|
|
9288
|
-
import os from "os";
|
|
9289
9288
|
var {serve } = globalThis.Bun;
|
|
9290
9289
|
|
|
9291
9290
|
// cli/utils/project.ts
|
|
@@ -19671,8 +19670,11 @@ async function bundlePageScript(script, projectRoot) {
|
|
|
19671
19670
|
if (!script.includes("import ")) {
|
|
19672
19671
|
return script;
|
|
19673
19672
|
}
|
|
19674
|
-
const tempDir =
|
|
19675
|
-
|
|
19673
|
+
const tempDir = path8.join(projectRoot, ".zenith-cache");
|
|
19674
|
+
if (!fs8.existsSync(tempDir)) {
|
|
19675
|
+
fs8.mkdirSync(tempDir, { recursive: true });
|
|
19676
|
+
}
|
|
19677
|
+
const tempFile = path8.join(tempDir, `bundle-${Date.now()}.js`);
|
|
19676
19678
|
try {
|
|
19677
19679
|
fs8.writeFileSync(tempFile, script, "utf-8");
|
|
19678
19680
|
const result = await Bun.build({
|
package/dist/zen-dev.js
CHANGED
|
@@ -9285,7 +9285,6 @@ import process2 from "process";
|
|
|
9285
9285
|
// cli/commands/dev.ts
|
|
9286
9286
|
import path8 from "path";
|
|
9287
9287
|
import fs8 from "fs";
|
|
9288
|
-
import os from "os";
|
|
9289
9288
|
var {serve } = globalThis.Bun;
|
|
9290
9289
|
|
|
9291
9290
|
// cli/utils/project.ts
|
|
@@ -19671,8 +19670,11 @@ async function bundlePageScript(script, projectRoot) {
|
|
|
19671
19670
|
if (!script.includes("import ")) {
|
|
19672
19671
|
return script;
|
|
19673
19672
|
}
|
|
19674
|
-
const tempDir =
|
|
19675
|
-
|
|
19673
|
+
const tempDir = path8.join(projectRoot, ".zenith-cache");
|
|
19674
|
+
if (!fs8.existsSync(tempDir)) {
|
|
19675
|
+
fs8.mkdirSync(tempDir, { recursive: true });
|
|
19676
|
+
}
|
|
19677
|
+
const tempFile = path8.join(tempDir, `bundle-${Date.now()}.js`);
|
|
19676
19678
|
try {
|
|
19677
19679
|
fs8.writeFileSync(tempFile, script, "utf-8");
|
|
19678
19680
|
const result = await Bun.build({
|
package/dist/zen-preview.js
CHANGED
|
@@ -9285,7 +9285,6 @@ import process2 from "process";
|
|
|
9285
9285
|
// cli/commands/dev.ts
|
|
9286
9286
|
import path8 from "path";
|
|
9287
9287
|
import fs8 from "fs";
|
|
9288
|
-
import os from "os";
|
|
9289
9288
|
var {serve } = globalThis.Bun;
|
|
9290
9289
|
|
|
9291
9290
|
// cli/utils/project.ts
|
|
@@ -19671,8 +19670,11 @@ async function bundlePageScript(script, projectRoot) {
|
|
|
19671
19670
|
if (!script.includes("import ")) {
|
|
19672
19671
|
return script;
|
|
19673
19672
|
}
|
|
19674
|
-
const tempDir =
|
|
19675
|
-
|
|
19673
|
+
const tempDir = path8.join(projectRoot, ".zenith-cache");
|
|
19674
|
+
if (!fs8.existsSync(tempDir)) {
|
|
19675
|
+
fs8.mkdirSync(tempDir, { recursive: true });
|
|
19676
|
+
}
|
|
19677
|
+
const tempFile = path8.join(tempDir, `bundle-${Date.now()}.js`);
|
|
19676
19678
|
try {
|
|
19677
19679
|
fs8.writeFileSync(tempFile, script, "utf-8");
|
|
19678
19680
|
const result = await Bun.build({
|
package/dist/zenith.js
CHANGED
|
@@ -9285,7 +9285,6 @@ import process2 from "process";
|
|
|
9285
9285
|
// cli/commands/dev.ts
|
|
9286
9286
|
import path8 from "path";
|
|
9287
9287
|
import fs8 from "fs";
|
|
9288
|
-
import os from "os";
|
|
9289
9288
|
var {serve } = globalThis.Bun;
|
|
9290
9289
|
|
|
9291
9290
|
// cli/utils/project.ts
|
|
@@ -19671,8 +19670,11 @@ async function bundlePageScript(script, projectRoot) {
|
|
|
19671
19670
|
if (!script.includes("import ")) {
|
|
19672
19671
|
return script;
|
|
19673
19672
|
}
|
|
19674
|
-
const tempDir =
|
|
19675
|
-
|
|
19673
|
+
const tempDir = path8.join(projectRoot, ".zenith-cache");
|
|
19674
|
+
if (!fs8.existsSync(tempDir)) {
|
|
19675
|
+
fs8.mkdirSync(tempDir, { recursive: true });
|
|
19676
|
+
}
|
|
19677
|
+
const tempFile = path8.join(tempDir, `bundle-${Date.now()}.js`);
|
|
19676
19678
|
try {
|
|
19677
19679
|
fs8.writeFileSync(tempFile, script, "utf-8");
|
|
19678
19680
|
const result = await Bun.build({
|