@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.
@@ -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
- // Create a temporary file for bundling
44
- const tempDir = os.tmpdir()
45
- const tempFile = path.join(tempDir, `zenith-bundle-${Date.now()}.js`)
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
@@ -18,6 +18,7 @@
18
18
  #!/usr/bin/env bun
19
19
  #!/usr/bin/env bun
20
20
  #!/usr/bin/env bun
21
+ #!/usr/bin/env bun
21
22
  // @bun
22
23
  var __create = Object.create;
23
24
  var __getProtoOf = Object.getPrototypeOf;
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 = os.tmpdir();
19675
- const tempFile = path8.join(tempDir, `zenith-bundle-${Date.now()}.js`);
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 = os.tmpdir();
19675
- const tempFile = path8.join(tempDir, `zenith-bundle-${Date.now()}.js`);
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({
@@ -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 = os.tmpdir();
19675
- const tempFile = path8.join(tempDir, `zenith-bundle-${Date.now()}.js`);
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 = os.tmpdir();
19675
- const tempFile = path8.join(tempDir, `zenith-bundle-${Date.now()}.js`);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenithbuild/core",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Core library for the Zenith framework",
5
5
  "license": "MIT",
6
6
  "type": "module",