Skip to content

Fix #8500 by not adding offset to line numbers#8501

Merged
devongovett merged 1 commit into
parcel-bundler:v2from
raileasyuk:fix/8500
Nov 5, 2022
Merged

Fix #8500 by not adding offset to line numbers#8501
devongovett merged 1 commit into
parcel-bundler:v2from
raileasyuk:fix/8500

Conversation

@lol768

@lol768 lol768 commented Sep 23, 2022

Copy link
Copy Markdown
Contributor

Closes #8500

Code snippet previews work after applying this patch, and the line numbers make sense again:

image

@mischnic

Copy link
Copy Markdown
Member

Can you add a test case to https://github.com/parcel-bundler/parcel/blob/v2/packages/core/integration-tests/test/vue.js for this example?

So duplicate https://github.com/parcel-bundler/parcel/tree/v2/packages/core/integration-tests/test/integration/vue-basic and make it fail with an error like in your screenshot, then add an assertion like this one

it('should throw a codeframe for a missing file in serviceWorker.register with URL and import.meta.url', async function () {
let fixture = path.join(
__dirname,
'integration/service-worker-import-meta-url/missing.js',
);
let code = await inputFS.readFileSync(fixture, 'utf8');
await assert.rejects(() => bundle(fixture), {
name: 'BuildError',
diagnostics: [
{
codeFrames: [
{
filePath: fixture,
code,
codeHighlights: [
{
end: {
column: 55,
line: 1,
},
start: {
column: 42,
line: 1,
},
},
],
},
],
message: "Failed to resolve './invalid.js' from './missing.js'",
origin: '@parcel/core',
},
{
hints: ["Did you mean '__./index.js__'?"],
message: "Cannot load file './invalid.js' in './'.",
origin: '@parcel/resolver-default',
},
],
});
});

@devongovett devongovett merged commit cf3a752 into parcel-bundler:v2 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VueTransformer uses nonsensical values for codeFrames.codeHighlights line numbers

3 participants