Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental logging for side effects #4871

Merged
merged 8 commits into from
Mar 1, 2023

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Feb 22, 2023

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

This will add a new option experimentalLogSideEffects: boolean that will log the first side effect to that console that it finds in every input file. This can be very helpful for debugging. The output will contain a code-frame that roughly looks like this:

First side effect in main.js is at (3:0)
1: import './dep-mapped';
2: import './dep-long-line';
3: console.log('main effect');
   ^
4: console.log('other effect');

In case a transformation with source maps changed the location, the log will be extended to contain that information as well:

First side effect in dep-mapped.js is at (2:26)
1: const removed = true;
2: const alsoRemoved = true; console.log('mapped effect');
                             ^
Original location is at (1:0)
1: console.log('mapped effect');
   ^

This is just an experimental feature as "logging to the console" is probably not what we want in the long run. Once we have a proper logging mechanism that works similar to how warnings are handled at the moment, we can turn this into a proper feature.

@netlify
Copy link

netlify bot commented Feb 22, 2023

Deploy Preview for rollupjs ready!

Name Link
🔨 Latest commit 7aed784
🔍 Latest deploy log https://app.netlify.com/sites/rollupjs/deploys/63fc4bf0af764300089b51bf
😎 Deploy Preview https://deploy-preview-4871--rollupjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Feb 22, 2023

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#fix-min-chunk-size-with-logging

or load it into the REPL:
https://deploy-preview-4871--rollupjs.netlify.app/repl/?pr=4871

@lukastaegert lukastaegert force-pushed the fix-min-chunk-size-with-logging branch 2 times, most recently from 873b226 to b4fddb7 Compare February 22, 2023 06:03
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.17.3-0. Note that this is a pre-release, so to test it, you need to install Rollup via npm install rollup@3.17.3-0 or npm install rollup@beta. It will likely become part of a regular release later.

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #4871 (7aed784) into master (1ab9833) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4871   +/-   ##
=======================================
  Coverage   98.98%   98.98%           
=======================================
  Files         219      219           
  Lines        7948     7967   +19     
  Branches     2189     2193    +4     
=======================================
+ Hits         7867     7886   +19     
  Misses         26       26           
  Partials       55       55           
Impacted Files Coverage Δ
src/ast/nodes/shared/Node.ts 100.00% <ø> (ø)
src/utils/options/mergeOptions.ts 100.00% <ø> (ø)
src/ast/nodes/Program.ts 100.00% <100.00%> (ø)
src/utils/getCodeFrame.ts 100.00% <100.00%> (ø)
src/utils/options/normalizeInputOptions.ts 99.04% <100.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.17.3-1. Note that this is a pre-release, so to test it, you need to install Rollup via npm install rollup@3.17.3-1 or npm install rollup@beta. It will likely become part of a regular release later.

@lukastaegert lukastaegert changed the title (Test) Add logging for side effects Add experimental logging for side effects Feb 27, 2023
@lukastaegert lukastaegert marked this pull request as ready for review February 27, 2023 06:08
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.18.0-0. Note that this is a pre-release, so to test it, you need to install Rollup via npm install rollup@3.18.0-0 or npm install rollup@beta. It will likely become part of a regular release later.

@lukastaegert lukastaegert merged commit 96f2eb1 into master Mar 1, 2023
@lukastaegert lukastaegert deleted the fix-min-chunk-size-with-logging branch March 1, 2023 18:23
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.18.0. You can test it via npm install rollup.

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.

None yet

2 participants