Skip to content

hqjs/babel-plugin-expose-global-to-window

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Explicitly expose global variables and functions to window in non module script.

Installation

npm install hqjs@babel-plugin-expose-global-to-window

Transformation

var x = 1, xx = 11, xxx = 111;

if (true) {
  var y = 2;
  function w() {}
}

class A {}

function f() {
  var x = 2;
  var z = 17;
  function f() {}
  
  function g() {}
}

const z = () => 0;

will turn into

var x = 1,
    xx = 11,
    xxx = 111;

if (true) {
  var y = 2;

  function w() {}
}

class A {}

function f() {
  var x = 2;
  var z = 17;

  function f() {}

  function g() {}
}

const z = () => 0;

window.x = x;
window.xx = xx;
window.xxx = xxx;
window.y = y;
window.f = f;

About

Explicitly expose global variables and functions to window in non module script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published