@marko/run 0.6.5 → 0.7.0

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.
@@ -528,7 +528,7 @@ function logInfoBox(address, explorer) {
528
528
  const color = !!supporsColor.stdout;
529
529
  let message = kleur2.bold("Marko Run");
530
530
  if (true) {
531
- message += ` v${"0.6.5"}`;
531
+ message += ` v${"0.7.0"}`;
532
532
  }
533
533
  message += "\n\n";
534
534
  message += kleur2.dim("Server listening at");
@@ -777,6 +777,7 @@ function createErrorMiddleware(devServer) {
777
777
  ])
778
778
  );
779
779
  }
780
+ const preparedError = prepareError(error);
780
781
  res.statusCode = 500;
781
782
  res.end(`
782
783
  <!DOCTYPE html>
@@ -785,32 +786,29 @@ function createErrorMiddleware(devServer) {
785
786
  <meta charset="UTF-8" />
786
787
  <title>Error</title>
787
788
  <script type="module">
788
- const error = ${JSON.stringify(prepareError(error)).replace(
789
- /</g,
790
- "\\u003c"
791
- )}
789
+ const error = ${stripHtml(JSON.stringify(preparedError))}
792
790
  try {
793
791
  const { ErrorOverlay } = await import(${JSON.stringify(path.posix.join(devServer.config.base, "/@vite/client"))})
794
792
  document.body.appendChild(new ErrorOverlay(error))
795
793
  } catch {
796
- const h = (tag, text) => {
797
- const el = document.createElement(tag)
798
- el.textContent = text
799
- return el
800
- }
801
- document.body.appendChild(h('h1', 'Internal Server Error'))
802
- document.body.appendChild(h('h2', error.message))
803
- document.body.appendChild(h('pre', error.stack))
804
- document.body.appendChild(h('p', '(Error overlay failed to load)'))
794
+ const p = document.createElement('p')
795
+ p.textContent = 'Error overlay failed to load'
796
+ document.body.appendChild(p);
805
797
  }
806
798
  </script>
807
799
  </head>
808
800
  <body>
801
+ <h1>Internal Server Error</h1>
802
+ <h2>${stripHtml(preparedError.message)}</h2>
803
+ <pre>${stripHtml(preparedError.stack)}</pre>
809
804
  </body>
810
805
  </html>
811
806
  `);
812
807
  };
813
808
  }
809
+ function stripHtml(string) {
810
+ return string.replace(/</g, "\\u003c");
811
+ }
814
812
 
815
813
  // src/adapter/index.ts
816
814
  import parseNodeArgs from "parse-node-args";
@@ -829,7 +827,7 @@ function adapter() {
829
827
  async getEntryFile() {
830
828
  return defaultEntry;
831
829
  },
832
- async startDev(entry, config2, options) {
830
+ async startDev({ entry, config: config2, options }) {
833
831
  const { port = 3e3, envFile } = options;
834
832
  globalThis.__marko_run_vite_config__ = config2;
835
833
  const explorerPromise = startExplorer();
@@ -901,7 +899,7 @@ function adapter() {
901
899
  }
902
900
  };
903
901
  },
904
- async startPreview(entry, options) {
902
+ async startPreview({ entry, options }) {
905
903
  const { port = 3e3, envFile } = options;
906
904
  const { nodeArgs } = parseNodeArgs(options.args);
907
905
  const args = [...nodeArgs, entry];
@@ -922,7 +920,7 @@ function adapter() {
922
920
  }
923
921
  } : server;
924
922
  },
925
- async routesGenerated(routes, virtualFiles, meta) {
923
+ async routesGenerated({ routes, virtualFiles, meta }) {
926
924
  if (process.env.MR_EXPLORER === "false") {
927
925
  return;
928
926
  }