sunpeak 0.20.15 → 0.20.16

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.
@@ -4,7 +4,7 @@ import * as path from 'path';
4
4
  const { existsSync, readFileSync, watch: fsWatch } = fs;
5
5
  const { join, resolve, basename, dirname } = path;
6
6
  import { createRequire } from 'module';
7
- import { pathToFileURL } from 'url';
7
+ import { fileURLToPath, pathToFileURL } from 'url';
8
8
  import { spawn } from 'child_process';
9
9
  import { getPort } from '../lib/get-port.mjs';
10
10
  import { startSandboxServer } from '../lib/sandbox-server.mjs';
@@ -68,7 +68,7 @@ async function importFromProject(require, moduleName) {
68
68
  */
69
69
  function startBuildWatcher(projectRoot, resourcesDir, mcpHandle, { skipInitialBuild = false } = {}) {
70
70
  let activeChild = null;
71
- const sunpeakBin = join(dirname(new URL(import.meta.url).pathname), '..', 'sunpeak.js');
71
+ const sunpeakBin = join(dirname(fileURLToPath(import.meta.url)), '..', 'sunpeak.js');
72
72
 
73
73
  const runBuild = () => {
74
74
  // Kill any in-progress build and start fresh
@@ -205,7 +205,7 @@ export async function dev(projectRoot = process.cwd(), args = []) {
205
205
  // --prod-resources: Run initial production build so dist/ is ready before server starts
206
206
  if (isProdResources) {
207
207
  console.log('Building production resources...');
208
- const sunpeakBin = join(dirname(new URL(import.meta.url).pathname), '..', 'sunpeak.js');
208
+ const sunpeakBin = join(dirname(fileURLToPath(import.meta.url)), '..', 'sunpeak.js');
209
209
  const { execSync } = await import('child_process');
210
210
  try {
211
211
  execSync(`${process.execPath} ${sunpeakBin} build`, {
package/bin/sunpeak.js CHANGED
@@ -2,12 +2,17 @@
2
2
 
3
3
  import { existsSync, readFileSync } from 'fs';
4
4
  import { join, dirname } from 'path';
5
- import { fileURLToPath } from 'url';
5
+ import { fileURLToPath, pathToFileURL } from 'url';
6
6
  import { discoverResources } from './lib/patterns.mjs';
7
7
 
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
  const COMMANDS_DIR = join(__dirname, 'commands');
10
10
 
11
+ // On Windows, absolute paths like "C:\..." can't be passed directly to dynamic
12
+ // import() — Node's ESM loader parses "C:" as a URL scheme and rejects it.
13
+ // Wrap with pathToFileURL().href to produce a valid file:// URL.
14
+ const commandUrl = (file) => pathToFileURL(join(COMMANDS_DIR, file)).href;
15
+
11
16
  function checkPackageJson() {
12
17
  const pkgPath = join(process.cwd(), 'package.json');
13
18
  if (!existsSync(pkgPath)) {
@@ -46,49 +51,49 @@ function getVersion() {
46
51
  switch (command) {
47
52
  case 'new':
48
53
  {
49
- const { init } = await import(join(COMMANDS_DIR, 'new.mjs'));
54
+ const { init } = await import(commandUrl('new.mjs'));
50
55
  await init(args[0], args[1]);
51
56
  }
52
57
  break;
53
58
 
54
59
  case 'dev':
55
60
  {
56
- const { dev } = await import(join(COMMANDS_DIR, 'dev.mjs'));
61
+ const { dev } = await import(commandUrl('dev.mjs'));
57
62
  await dev(process.cwd(), args);
58
63
  }
59
64
  break;
60
65
 
61
66
  case 'build':
62
67
  {
63
- const { build } = await import(join(COMMANDS_DIR, 'build.mjs'));
68
+ const { build } = await import(commandUrl('build.mjs'));
64
69
  await build(process.cwd());
65
70
  }
66
71
  break;
67
72
 
68
73
  case 'start':
69
74
  {
70
- const { start } = await import(join(COMMANDS_DIR, 'start.mjs'));
75
+ const { start } = await import(commandUrl('start.mjs'));
71
76
  await start(process.cwd(), args);
72
77
  }
73
78
  break;
74
79
 
75
80
  case 'inspect':
76
81
  {
77
- const { inspect } = await import(join(COMMANDS_DIR, 'inspect.mjs'));
82
+ const { inspect } = await import(commandUrl('inspect.mjs'));
78
83
  await inspect(args);
79
84
  }
80
85
  break;
81
86
 
82
87
  case 'test':
83
88
  {
84
- const { runTest } = await import(join(COMMANDS_DIR, 'test.mjs'));
89
+ const { runTest } = await import(commandUrl('test.mjs'));
85
90
  await runTest(args);
86
91
  }
87
92
  break;
88
93
 
89
94
  case 'upgrade':
90
95
  {
91
- const { upgrade } = await import(join(COMMANDS_DIR, 'upgrade.mjs'));
96
+ const { upgrade } = await import(commandUrl('upgrade.mjs'));
92
97
  const options = {
93
98
  check: args.includes('--check') || args.includes('-c'),
94
99
  help: args.includes('--help') || args.includes('-h'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sunpeak",
3
- "version": "0.20.15",
3
+ "version": "0.20.16",
4
4
  "description": "App framework, testing framework, and inspector for MCP Apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "albums",
15
- "uri": "ui://albums-monr4ibp"
15
+ "uri": "ui://albums-mopo2z1z"
16
16
  }
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "carousel",
15
- "uri": "ui://carousel-monr4ibp"
15
+ "uri": "ui://carousel-mopo2z1z"
16
16
  }
@@ -18,5 +18,5 @@
18
18
  }
19
19
  },
20
20
  "name": "map",
21
- "uri": "ui://map-monr4ibp"
21
+ "uri": "ui://map-mopo2z1z"
22
22
  }
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "review",
15
- "uri": "ui://review-monr4ibp"
15
+ "uri": "ui://review-mopo2z1z"
16
16
  }