Skip to content

fix: source-maps - consistent paths to inline content - #39302

Closed
petebacondarwin wants to merge 3 commits into
angular:masterfrom
petebacondarwin:source-maps-relative-paths
Closed

petebacondarwin wants to merge 3 commits into
angular:masterfrom
petebacondarwin:source-maps-relative-paths

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Oct 16, 2020 •

Copy link
Copy Markdown
Contributor

Previously, if a source-map contained inline content, the internal path used for
the source file could be inconsistent depending upon the location of the source-map
file that is referencing the source.

Now inline source is assigned a consistent file path, rather than relying upon the
path provided in the source-map. Since the source content is provided inline
this should have no impact on the use of the flattened source-map by tools.

Fixes #39293

@petebacondarwin petebacondarwin added type: bug/fix action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release area: compiler Issues related to `ngc`, Angular's template compiler labels Oct 16, 2020
@ngbot ngbot Bot added this to the needsTriage milestone Oct 16, 2020
@google-cla google-cla Bot added the cla: yes label Oct 16, 2020
@pullapprove
pullapprove Bot requested a review from AndrewKushnir October 16, 2020 10:12
@petebacondarwin

Copy link
Copy Markdown
Contributor Author

Hmm, CI points out that this does not really work well... I think we need a better solution...

@petebacondarwin petebacondarwin added state: WIP and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 16, 2020
@petebacondarwin
petebacondarwin marked this pull request as draft October 16, 2020 13:24
@petebacondarwin
petebacondarwin force-pushed the source-maps-relative-paths branch from bb7e6aa to 9b96bad Compare May 1, 2021 19:51
… content

Previously, if a source-map contained inline content, the internal path used for
the source file could be inconsistent depending upon the location of the source-map
file that is referencing the source.

Now inline source is assigned a consistent file path, rather than relying upon the
path provided in the source-map. Since the source content is provided inline
this should have no impact on the use of the flattened source-map by tools.

Fixes angular#39293
@petebacondarwin
petebacondarwin force-pushed the source-maps-relative-paths branch from 9b96bad to 22c4e1c Compare May 3, 2021 18:12
@petebacondarwin

petebacondarwin commented May 3, 2021 •

Copy link
Copy Markdown
Contributor Author

I've realised that we cannot fix things this way. By hacking the source path for inline files we end up losing the path to the original source in a way that would break i18n extraction. See the integration test results from this PR:

Error: Expected

<source>Message in <x id="a-file" equiv-text="file"/>!</source>
<context-group purpose="location">
  <context context-type="sourcefile">test_files/dist_es5/a.ts</context>
  <context context-type="linenumber">3,5</context>
</context-group>

to equal

<source>Message in <x id="a-file" equiv-text="file"/>!</source>
<context-group purpose="location">
  <context context-type="sourcefile">../packages/localize/src/tools/test/extract/integration/test_files/src/a.ts</context>
  <context context-type="linenumber">3,5</context>
</context-group>

(Note that the path we would really like is test_files/src/a.ts but this PR results in test_files/dist_es5/a.ts which is confusing because the original source file is not in dist_es5 since this is where the generated file is - i.e. dist_es5/index.js)

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

I'm not sure if we can actually fix the problem from this side. We may need to return to the original cause #14021

@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: compiler Issues related to `ngc`, Angular's template compiler cla: yes state: WIP target: patch This PR is targeted for the next patch release type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NGCC is non-hermetic and produces different output depending on source location in file system

2 participants