ben-ng/sourcemap-validator

Sourcemaps from babel 7.21 and higher are considered invalid

Opened this issue · 1 comments

I'm using this package in my ember app which is using ember-cli which is using fast-sourcemap-concat which depends on this package.

Recently, after updating @babel/* packages to the latest the source maps stopped working.

I was able to localize the issue to @babel/generator's update from 7.20.14 to 7.21.3. Probably after this commit it broke: babel/babel#15022.

When I run the ember-cli build with DEBUG='fast-sourcemap-concat:*' I see the following errors in the output:

Mapping: 30:8→29:6 "init" in @ember/engine/instance.js +0ms
  fast-sourcemap-concat: [ember.js#4665] generating new map: @ember/engine/instance.js +1ms
  fast-sourcemap-concat: [ember.js#4665]  invalid sourcemap for: @ember/engine/lib/engine-parent.js +1ms
  fast-sourcemap-concat: [ember.js#4665]    error:  Warning: mismatched names
Expected: getEngineParent || 'getEngineParent' || 'getEngineParent' || "getEngineParent" || "getEngineParent"
Got: (engine) { || (engine) { || (engine) { || (engine) { || (engine) {
Original Line: export function getEngineParent(engine) {
Mapping: 25:26→17:31 "getEngineParent" in @ember/engine/lib/engine-parent.js +0ms

I have the same problem, here same errorlogs;

 fast-sourcemap-concat: [Concat: App Tests#5135]    error:  Warning: mismatched names
Expected: _templateFactory || '_templateFactory' || '_templateFactory' || "_templateFactory" || "_templateFactory"
Got: (hbs`<Steps />`) || (hbs`<Steps />`); || (hbs`<Steps />`); || (hbs`<Steps />`); || (hbs`<Steps />`);
Original Line:     await render(hbs`<Steps />`);
Mapping: 11:41→13:16 "_templateFactory" in binder/tests/integration/components/steps/component-test.ts +0ms
  fast-sourcemap-concat: [Concat: App Tests#5135]  invalid sourcemap for: binder/tests/integration/components/button/component-test.js +1ms
  fast-sourcemap-concat: [Concat: App Tests#5135]