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 optional importer parameter to this.emitFile #3442

Merged
merged 5 commits into from Mar 18, 2020

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Mar 13, 2020

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:
Resolves #3436

Description

This adds the possibility to specify an importing file when using this.emitFile so that relative ids can be resolved correctly. Also cleans up documentation and types to specify that importer can actually be undefined, in which case the current working directory is used as reference.

@rollup-bot
Copy link
Collaborator

rollup-bot commented Mar 13, 2020

Thank you for your contribution! ❤️

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

npm install rollup/rollup#add-importer-emitfile

or load it into the REPL:
https://rollupjs.org/repl/?circleci=9973

@codecov
Copy link

codecov bot commented Mar 13, 2020

Codecov Report

Merging #3442 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3442   +/-   ##
=======================================
  Coverage   95.01%   95.01%           
=======================================
  Files         171      171           
  Lines        5841     5843    +2     
  Branches     1723     1724    +1     
=======================================
+ Hits         5550     5552    +2     
  Misses        157      157           
  Partials      134      134           
Impacted Files Coverage Δ
src/rollup/rollup.ts 100.00% <ø> (ø)
src/utils/FileEmitter.ts 100.00% <ø> (ø)
src/Graph.ts 97.35% <100.00%> (ø)
src/ModuleLoader.ts 98.53% <100.00%> (+0.01%) ⬆️
src/utils/PluginContext.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e019ea0...a7b80f3. Read the comment docs.

@jakearchibald
Copy link
Contributor

I haven't tested it, but at a glance this is exactly what I was asking for!

Copy link
Contributor

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

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

Docs LGTM

docs/05-plugin-development.md Outdated Show resolved Hide resolved
lukastaegert and others added 2 commits March 18, 2020 05:37
Co-Authored-By: Jake Archibald <jaffathecake@gmail.com>
@lukastaegert lukastaegert merged commit 60ed91f into master Mar 18, 2020
@lukastaegert lukastaegert deleted the add-importer-emitfile branch March 18, 2020 05:03
sthagen added a commit to sthagen/rollup-rollup that referenced this pull request Mar 18, 2020
Add optional `importer` parameter to `this.emitFile` (rollup#3442)
@jakearchibald
Copy link
Contributor

Thank you for this!

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.

Should emitFile take an importer?
3 participants