Skip to content

Conversation

@nenadvicentic
Copy link
Contributor

Previous pull request #1215 did not take in consideration BundledSource cache, so we would get correct source map only on first au build. Second au build, without source file change, when cache is used, CLI would fallback to original file.sourceMap, because transformed source map was not cached.

Issue is now fixed:

  1. Added _transformedSourceMap property, to differentiate from file.sourceMap.
  2. _transformedSourceMap saved/read from cache.
  3. Two new unit tests added at the bottom bundled-source.spec.js. They are variation on 2 existing cache tests.
  4. Tested in my own projects, with build.options.cache on and off.

Copy link
Member

@3cp 3cp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one small suggestion.

Comment on lines 22 to 24
return this._transformedSourceMap === null
? this.file.sourceMap
: this._transformedSourceMap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do return this._transformedSourceMap || this.file.sourceMap;.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adopted the suggested change and I also added check when caching - if property _transformedSourceMap is null, cache value is set to undefined, so it's skipped in JSON.stringify. No need to cache null values.

@nenadvicentic nenadvicentic requested a review from 3cp August 7, 2025 07:50
@3cp 3cp merged commit 66c5493 into aurelia:master Aug 7, 2025
7 checks passed
@3cp
Copy link
Member

3cp commented Aug 7, 2025

@bigpon another patch release pls.

@bigopon
Copy link
Member

bigopon commented Aug 7, 2025

3.0.7 has been released, thanks @nenadvicentic @3cp 🙏

@nenadvicentic
Copy link
Contributor Author

@bigopon @3cp I've upgraded to 3.0.7 in one of the projects. Now everything works as expected. Thank you both!

nenadvicentic added a commit to nenadvicentic/aurelia-cli that referenced this pull request Aug 7, 2025
…r is outside of project's root folder (aurelia#1213) + fix: `bundled-source.js` - transformed source map is saved to cache. (aurelia#1216)
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.

3 participants