@pixelbyte-software/pixcode 1.50.8 → 1.50.9

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.
@@ -0,0 +1 @@
1
+ import{loader as r}from"./index-ak1p_4ew.js";import"./vendor-react-DB6V5Fl1.js";const e="/vendor/monaco-editor/min/vs";let o=!1;function i(){o||(r.config({paths:{vs:e}}),o=!0)}export{e as LOCAL_MONACO_BASE_PATH,i as ensureLocalMonaco};
package/dist/index.html CHANGED
@@ -35,7 +35,7 @@
35
35
 
36
36
  <!-- Prevent zoom on iOS -->
37
37
  <meta name="format-detection" content="telephone=no" />
38
- <script type="module" crossorigin src="/assets/index-gecaamTl.js"></script>
38
+ <script type="module" crossorigin src="/assets/index-CXTCtUku.js"></script>
39
39
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-DB6V5Fl1.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-CIYNS698.js">
41
41
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-C7tpxJl7.js">
@@ -7,6 +7,7 @@ import path from 'path';
7
7
  import os from 'os';
8
8
  import http from 'http';
9
9
  import net from 'node:net';
10
+ import { createRequire } from 'node:module';
10
11
  import { spawn } from 'child_process';
11
12
  import express from 'express';
12
13
  import { WebSocketServer, WebSocket } from 'ws';
@@ -17,6 +18,8 @@ const __dirname = getModuleDir(import.meta.url);
17
18
  // The server source runs from /server, while the compiled output runs from /dist-server/server.
18
19
  // Resolving the app root once keeps every repo-level lookup below aligned across both layouts.
19
20
  const APP_ROOT = findAppRoot(__dirname);
21
+ const require = createRequire(import.meta.url);
22
+ const MONACO_ASSETS_ROUTE = '/vendor/monaco-editor/min/vs';
20
23
  const installMode = fs.existsSync(path.join(APP_ROOT, '.git')) ? 'git' : 'npm';
21
24
  const SERVER_VERSION = (() => {
22
25
  try {
@@ -32,6 +35,21 @@ const DAEMON_COMMAND_CONTEXT = {
32
35
  cliEntry: path.join(APP_ROOT, 'server', 'cli.js'),
33
36
  nodeExecPath: process.execPath,
34
37
  };
38
+ function resolveMonacoAssetsPath() {
39
+ const candidates = [
40
+ path.join(APP_ROOT, 'node_modules', 'monaco-editor', 'min', 'vs'),
41
+ ];
42
+ try {
43
+ const monacoPackagePath = require.resolve('monaco-editor/package.json', {
44
+ paths: [APP_ROOT, __dirname],
45
+ });
46
+ candidates.push(path.join(path.dirname(monacoPackagePath), 'min', 'vs'));
47
+ }
48
+ catch {
49
+ // The editor will show its normal load failure if the dependency is unavailable.
50
+ }
51
+ return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'loader.js'))) || null;
52
+ }
35
53
  import { c } from './utils/colors.js';
36
54
  console.log('SERVER_PORT from env:', process.env.SERVER_PORT);
37
55
  import pty from 'node-pty';
@@ -732,6 +750,18 @@ app.use('/api/agent', agentRoutes);
732
750
  // Static app files served after API routes. Keep dist before public so
733
751
  // / and /index.html always resolve to the Pixcode app, not the GitHub Pages
734
752
  // landing page that also lives in public/index.html.
753
+ const monacoAssetsPath = resolveMonacoAssetsPath();
754
+ if (monacoAssetsPath) {
755
+ app.use(MONACO_ASSETS_ROUTE, express.static(monacoAssetsPath, {
756
+ index: false,
757
+ setHeaders: (res) => {
758
+ res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
759
+ },
760
+ }));
761
+ }
762
+ else {
763
+ console.warn('[monaco] Local Monaco assets not found; code editor loader may fail.');
764
+ }
735
765
  app.use(express.static(path.join(APP_ROOT, 'dist'), {
736
766
  setHeaders: (res, filePath) => {
737
767
  if (filePath.endsWith('.html')) {