rollup-plugin-node-globals

WebJar for rollup-plugin-node-globals

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

rollup-plugin-node-globals
Последняя версия

Последняя версия

1.2.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

rollup-plugin-node-globals
WebJar for rollup-plugin-node-globals
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/calvinmetcalf/rollup-plugin-node-globals

Скачать rollup-plugin-node-globals

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/rollup-plugin-node-globals/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>rollup-plugin-node-globals</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/rollup-plugin-node-globals/
implementation 'org.webjars.npm:rollup-plugin-node-globals:1.2.1'
// https://jarcasting.com/artifacts/org.webjars.npm/rollup-plugin-node-globals/
implementation ("org.webjars.npm:rollup-plugin-node-globals:1.2.1")
'org.webjars.npm:rollup-plugin-node-globals:jar:1.2.1'
<dependency org="org.webjars.npm" name="rollup-plugin-node-globals" rev="1.2.1">
  <artifact name="rollup-plugin-node-globals" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='rollup-plugin-node-globals', version='1.2.1')
)
libraryDependencies += "org.webjars.npm" % "rollup-plugin-node-globals" % "1.2.1"
[org.webjars.npm/rollup-plugin-node-globals "1.2.1"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.webjars.npm : magic-string jar [0.22.4,0.23)
org.webjars.npm : acorn jar [5.5.0,6)
org.webjars.npm : process-es6 jar [0.11.6,0.12)
org.webjars.npm : buffer-es6 jar [4.9.3,5)
org.webjars.npm : estree-walker jar [0.5.1,0.6)
org.webjars.npm : rollup-pluginutils jar [2.0.1,3)

Модули Проекта

Данный проект не имеет модулей.

rollup-plugin-node-globals

Plugin to insert node globals including so code that works with browserify should work even if it uses process or buffers. This is based on rollup-plugin-inject .

  • process
  • global
  • Buffer
  • __dirname
  • __filename

Plus process.nextTick and process.browser are optimized to only pull in themselves and __dirname and __filename point to the file on disk

There are a few options to control output

  • process - pass false to disable process polyfilling
  • global - pass false to disable global polyfilling
  • buffer - pass false to disable Buffer polyfilling
  • dirname - pass false to disable __dirname polyfilling
  • filename - pass false to disable __filename polyfilling
  • baseDir which is used for resolving __dirname and __filename.

examples

var foo;
if (process.browser) {
  foo = 'bar';
} else {
  foo = 'baz';
}

turns into

import {browser} from 'path/to/process';
var foo;
if (browser) {
  foo = 'bar';
} else {
  foo = 'baz';
}

but with rollup that ends up being

var browser = true;
var foo;
if (browser) {
  foo = 'bar';
} else {
  foo = 'baz';
}

or

var timeout;
if (global.setImmediate) {
  timeout = global.setImmediate;
} else {
  timeout = global.setTimeout;
}
export default timeout;

turns into

import {_global} from 'path/to/global.js';
var timeout;
if (_global.setImmediate) {
  timeout = _global.setImmediate;
} else {
  timeout = _global.setTimeout;
}
export default timeout;

which rollup turns into

var _global = typeof global !== "undefined" ? global :
            typeof self !== "undefined" ? self :
            typeof window !== "undefined" ? window : {}

var timeout;
if (_global.setImmediate) {
  timeout = _global.setImmediate;
} else {
  timeout = _global.setTimeout;
}
var timeout$1 = timeout;

export default timeout$1;

With that top piece only showing up once no matter how many times global was used.

Версии библиотеки

Версия
1.2.1