@jsenv/core 38.4.16 → 38.4.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "38.4.16",
3
+ "version": "38.4.17",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -66,7 +66,7 @@
66
66
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
67
67
  "@jsenv/abort": "4.3.0",
68
68
  "@jsenv/ast": "6.0.7",
69
- "@jsenv/filesystem": "4.6.9",
69
+ "@jsenv/filesystem": "4.7.0",
70
70
  "@jsenv/humanize": "1.1.3",
71
71
  "@jsenv/importmap": "1.2.1",
72
72
  "@jsenv/integrity": "0.0.1",
@@ -74,7 +74,7 @@
74
74
  "@jsenv/node-esm-resolution": "1.0.2",
75
75
  "@jsenv/plugin-bundling": "2.6.10",
76
76
  "@jsenv/plugin-minification": "1.5.4",
77
- "@jsenv/plugin-supervisor": "1.4.10",
77
+ "@jsenv/plugin-supervisor": "1.4.11",
78
78
  "@jsenv/plugin-transpilation": "1.3.16",
79
79
  "@jsenv/runtime-compat": "1.3.0",
80
80
  "@jsenv/server": "15.2.6",
@@ -1,4 +1,4 @@
1
- import { readFileSync } from "node:fs";
1
+ import { existsSync, readFileSync } from "node:fs";
2
2
  import { URL_META } from "@jsenv/url-meta";
3
3
  import {
4
4
  assertAndNormalizeDirectoryUrl,
@@ -91,6 +91,9 @@ export const startDevServer = async ({
91
91
  sourceDirectoryUrl,
92
92
  "sourceDirectoryUrl",
93
93
  );
94
+ if (!existsSync(new URL(sourceDirectoryUrl))) {
95
+ throw new Error(`ENOENT on sourceDirectoryUrl at ${sourceDirectoryUrl}`);
96
+ }
94
97
  if (typeof sourceMainFilePath !== "string") {
95
98
  throw new TypeError(
96
99
  `sourceMainFilePath must be a string, got ${sourceMainFilePath}`,
@@ -148,9 +148,12 @@ export const createTransformUrlContentError = ({
148
148
  if (code === "PARSE_ERROR") {
149
149
  transformError.reason = `parse error on ${urlInfo.type}`;
150
150
  transformError.cause = error;
151
+ let line = error.line;
152
+ if (urlInfo.type === "js_module") {
153
+ line = line - 1;
154
+ }
151
155
  if (urlInfo.isInline) {
152
- transformError.trace.line =
153
- urlInfo.firstReference.trace.line + error.line - 1;
156
+ transformError.trace.line = urlInfo.firstReference.trace.line + line;
154
157
  transformError.trace.column =
155
158
  urlInfo.firstReference.trace.column + error.column;
156
159
  transformError.trace.codeFrame = generateContentFrame({
@@ -167,16 +170,16 @@ export const createTransformUrlContentError = ({
167
170
  } else {
168
171
  transformError.trace = {
169
172
  url: urlInfo.url,
170
- line: error.line,
173
+ line,
171
174
  column: error.column,
172
175
  codeFrame: generateContentFrame({
173
- line: error.line - 1,
176
+ line,
174
177
  column: error.column,
175
178
  content: urlInfo.content,
176
179
  }),
177
180
  message: stringifyUrlSite({
178
181
  url: urlInfo.url,
179
- line: error.line - 1,
182
+ line,
180
183
  column: error.column,
181
184
  content: urlInfo.content,
182
185
  }),
@@ -72,13 +72,14 @@ export const createDependencies = (ownerUrlInfo) => {
72
72
  const parentContent = isOriginalPosition
73
73
  ? ownerUrlInfo.originalContent
74
74
  : ownerUrlInfo.content;
75
+ const trace = traceFromUrlSite({
76
+ url: parentUrl,
77
+ content: parentContent,
78
+ line: specifierLine,
79
+ column: specifierColumn,
80
+ });
75
81
  const reference = createResolveAndFinalize({
76
- trace: traceFromUrlSite({
77
- url: parentUrl,
78
- content: parentContent,
79
- line: specifierLine,
80
- column: specifierColumn,
81
- }),
82
+ trace,
82
83
  isOriginalPosition,
83
84
  specifierLine,
84
85
  specifierColumn,