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

feat: add custom parameter names for wrapper args #86

Conversation

anuragkalia
Copy link
Contributor

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

I wanted to create a wrapper like this: https://github.com/google/shaka-player/blob/master/build/wrapper.template.js where it should be possible for me where arguments and parameters have different names.

The current loader is perfect for the use case: it has hook for additionalCode as well as wrapper. This PR adds the only missing functionality: differing names.

Breaking Changes

None.

Additional Info

None.

@jsf-clabot
Copy link

jsf-clabot commented Jul 14, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jul 14, 2020

Codecov Report

Merging #86 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #86   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          183       189    +6     
  Branches        67        68    +1     
=========================================
+ Hits           183       189    +6     
Impacted Files Coverage Δ
src/index.js 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 f71a9fb...86162a7. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Please update docs

@anuragkalia
Copy link
Contributor Author

Hi @evilebottnawi . Updated the README.

@@ -1169,7 +1169,7 @@ exports[`loader should work with the "wrapper" options as an object notation: er
exports[`loader should work with the "wrapper" options as an object notation: module 1`] = `
"/*** IMPORTS FROM imports-loader ***/

(function(myGlobalVariable, myOtherGlobalVariable) {
(function() {
Copy link
Member

Choose a reason for hiding this comment

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

Why it was changed? We should not change other tests, otherwise it is the breaking change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it. It was a bug. 😅

@@ -56,19 +56,29 @@ export default function loader(content, sourceMap) {
if (typeof options.wrapper !== 'undefined') {
let thisArg;
let args;
let params;
Copy link
Member

Choose a reason for hiding this comment

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

let params = '';

And remove params = ''; from boolean/string

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

sorry for delay, let's merge as is

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