Skip to content

Commit

Permalink
fix a case resulting in 500 from jsenv on specific type of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dmail committed Nov 12, 2024
1 parent 09ba33f commit 3acf02f
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jsenv/core",
"version": "39.5.20",
"version": "39.5.21",
"description": "Tool to develop, test and build js projects",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -78,7 +78,7 @@
"@jsenv/node-esm-resolution": "1.0.6",
"@jsenv/plugin-bundling": "2.7.16",
"@jsenv/plugin-minification": "1.5.10",
"@jsenv/plugin-supervisor": "1.5.25",
"@jsenv/plugin-supervisor": "1.5.26",
"@jsenv/plugin-transpilation": "1.4.84",
"@jsenv/runtime-compat": "1.3.1",
"@jsenv/server": "15.3.2",
Expand Down
11 changes: 11 additions & 0 deletions packages/internal/plugin-supervisor/dist/js/supervisor.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,17 @@ window.__supervisor__ = (() => {
stackFrames = [];
for (const callSite of callSites) {
const url = callSite.getFileName() || callSite.getScriptNameOrSourceURL();
if (!url) {
// thinks like Array.forEach can generate this
const stackFrame = {
raw: " at ".concat(String(callSite)),
url: null,
line: null,
column: null
};
stackFrames.push(stackFrame);
continue;
}
const line = callSite.getLineNumber();
const column = callSite.getColumnNumber();
const site = resolveUrlSite({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,9 @@ const jsenvPluginSupervisor = ({
}
};
}
if (!urlInfo.originalContent) {
await urlInfo.fetchContent();
}
const remap = searchParams.has("remap");
if (remap) {
const sourcemap = urlInfo.sourcemap;
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/plugin-supervisor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jsenv/plugin-supervisor",
"version": "1.5.25",
"version": "1.5.26",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions packages/internal/plugin-supervisor/src/client/supervisor.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,17 @@ window.__supervisor__ = (() => {
for (const callSite of callSites) {
const url =
callSite.getFileName() || callSite.getScriptNameOrSourceURL();
if (!url) {
// thinks like Array.forEach can generate this
const stackFrame = {
raw: ` at ${String(callSite)}`,
url: null,
line: null,
column: null,
};
stackFrames.push(stackFrame);
continue;
}
const line = callSite.getLineNumber();
const column = callSite.getColumnNumber();
const site = resolveUrlSite({ url, line, column });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export const jsenvPluginSupervisor = ({
},
};
}
if (!urlInfo.originalContent) {
await urlInfo.fetchContent();
}
const remap = searchParams.has("remap");
if (remap) {
const sourcemap = urlInfo.sourcemap;
Expand Down
2 changes: 1 addition & 1 deletion packages/related/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jsenv/cli",
"version": "0.2.4",
"version": "0.2.5",
"description": "Command Line Interface for jsenv",
"license": "MIT",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/related/cli/template-node-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"devDependencies": {
"@jsenv/assert": "4.4.2",
"@jsenv/core": "39.5.20",
"@jsenv/core": "39.5.21",
"@jsenv/eslint-config-relax": "1.2.12",
"@jsenv/test": "3.5.23",
"@jsenv/test": "3.5.24",
"eslint": "9.14.0",
"prettier": "3.3.3"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/related/cli/template-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"@babel/plugin-syntax-import-attributes": "7.26.0",
"@jsenv/custom-elements-redefine": "0.0.1",
"@jsenv/assert": "4.4.2",
"@jsenv/core": "39.5.20",
"@jsenv/core": "39.5.21",
"@jsenv/plugin-bundling": "2.7.16",
"@jsenv/plugin-minification": "1.5.10",
"@jsenv/eslint-config-relax": "1.2.12",
"@jsenv/test": "3.5.23",
"@jsenv/test": "3.5.24",
"eslint": "9.14.0",
"open": "10.1.0",
"@playwright/browser-chromium": "1.48.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/related/cli/template-web-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"@babel/plugin-syntax-import-attributes": "7.26.0",
"@babel/plugin-transform-react-jsx": "7.25.9",
"@jsenv/assert": "4.4.2",
"@jsenv/core": "39.5.20",
"@jsenv/core": "39.5.21",
"@jsenv/plugin-preact": "1.6.25",
"@jsenv/plugin-bundling": "2.7.16",
"@jsenv/plugin-minification": "1.5.10",
"@jsenv/eslint-config-relax": "1.2.12",
"@jsenv/test": "3.5.23",
"@jsenv/test": "3.5.24",
"eslint": "9.14.0",
"open": "10.1.0",
"@playwright/browser-chromium": "1.48.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/related/cli/template-web-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"@babel/plugin-syntax-import-attributes": "7.26.0",
"@babel/plugin-transform-react-jsx": "7.25.9",
"@jsenv/assert": "4.4.2",
"@jsenv/core": "39.5.20",
"@jsenv/core": "39.5.21",
"@jsenv/plugin-react": "1.5.44",
"@jsenv/plugin-bundling": "2.7.16",
"@jsenv/plugin-minification": "1.5.10",
"@jsenv/eslint-config-relax": "1.2.12",
"@jsenv/test": "3.5.23",
"@jsenv/test": "3.5.24",
"eslint": "9.14.0",
"open": "10.1.0",
"@playwright/browser-chromium": "1.48.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/related/cli/template-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"devDependencies": {
"@babel/plugin-syntax-import-attributes": "7.26.0",
"@jsenv/assert": "4.4.2",
"@jsenv/core": "39.5.20",
"@jsenv/core": "39.5.21",
"@jsenv/eslint-config-relax": "1.2.12",
"@jsenv/plugin-bundling": "2.7.16",
"@jsenv/plugin-minification": "1.5.10",
"@jsenv/test": "3.5.23",
"@jsenv/test": "3.5.24",
"eslint": "9.14.0",
"open": "10.1.0",
"@playwright/browser-chromium": "1.48.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/related/test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jsenv/test",
"version": "3.5.23",
"version": "3.5.24",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -43,7 +43,7 @@
"@jsenv/github-check-run": "0.2.2",
"@jsenv/node-esm-resolution": "1.0.6",
"@jsenv/humanize": "1.2.8",
"@jsenv/plugin-supervisor": "1.5.25",
"@jsenv/plugin-supervisor": "1.5.26",
"@jsenv/sourcemap": "1.2.25",
"@jsenv/url-meta": "8.5.2",
"@jsenv/urls": "2.5.2",
Expand Down

0 comments on commit 3acf02f

Please sign in to comment.