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 needsCodeReference property to EmittedAsset #4868

Conversation

sapphi-red
Copy link
Contributor

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

#4805 introduced needsCodeReference property. The documentation describes it is intended to be used like:

const referenceId = this.emitFile({
	type: 'asset',
	name: path.basename(id),
	needsCodeReference: true,
	source: fs.readFileSync(id)
});

But because EmittedAsset doesn't have needsCodeReference property, I get a type error.

emitFile: EmitFile;

export type EmitFile = (emittedFile: EmittedFile) => string;

export type EmittedFile = EmittedAsset | EmittedChunk;

export interface EmittedAsset {
fileName?: string;
name?: string;
source?: string | Uint8Array;
type: 'asset';
}

This PR adds needsCodeReference property to EmittedAsset to fix that.

@netlify
Copy link

netlify bot commented Feb 19, 2023

Deploy Preview for rollupjs ready!

Name Link
🔨 Latest commit 80e01af
🔍 Latest deploy log https://app.netlify.com/sites/rollupjs/deploys/63f243ea7807a60008e7fe82
😎 Deploy Preview https://deploy-preview-4868--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.

@codecov
Copy link

codecov bot commented Feb 19, 2023

Codecov Report

Merging #4868 (80e01af) into master (e0701d7) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #4868   +/-   ##
=======================================
  Coverage   98.98%   98.98%           
=======================================
  Files         219      219           
  Lines        7943     7943           
  Branches     2188     2188           
=======================================
  Hits         7862     7862           
  Misses         26       26           
  Partials       55       55           

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

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Good catch, thanks a lot!

@lukastaegert lukastaegert merged commit eb57f5f into rollup:master Feb 20, 2023
@rollup-bot
Copy link
Collaborator

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

@sapphi-red sapphi-red deleted the fix/add-needs-code-reference-property-to-emitted-assets branch February 20, 2023 07:10
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

3 participants