rollup 0.55.1 → 0.55.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +40 -4
  3. package/bin/rollup +13 -4
  4. package/dist/rollup.browser.js +134 -79
  5. package/dist/rollup.es.js +135 -80
  6. package/dist/rollup.js +136 -81
  7. package/dist/typings/Chunk.d.ts +4 -0
  8. package/dist/typings/Graph.d.ts +1 -2
  9. package/dist/typings/rollup/index.d.ts +1 -0
  10. package/dist/typings/utils/defaults.d.ts +2 -1
  11. package/dist/typings/utils/renderHelpers.d.ts +12 -0
  12. package/dist/typings/watch/index.d.ts +1 -1
  13. package/package.json +10 -5
  14. package/dist/typings/Bundle.d.ts +0 -29
  15. package/dist/typings/ast/Node.d.ts +0 -185
  16. package/dist/typings/ast/nodes/Declaration.d.ts +0 -8
  17. package/dist/typings/ast/nodes/Expression.d.ts +0 -46
  18. package/dist/typings/ast/nodes/Pattern.d.ts +0 -12
  19. package/dist/typings/ast/nodes/Statement.d.ts +0 -10
  20. package/dist/typings/ast/nodes/shared/VirtualObjectExpression.d.ts +0 -7
  21. package/dist/typings/ast/nodes/shared/disallowIllegalReassignment.d.ts +0 -6
  22. package/dist/typings/bin/src/index.d.ts +0 -1
  23. package/dist/typings/bin/src/logging.d.ts +0 -3
  24. package/dist/typings/bin/src/run/alternateScreen.d.ts +0 -8
  25. package/dist/typings/bin/src/run/batchWarnings.d.ts +0 -11
  26. package/dist/typings/bin/src/run/build.d.ts +0 -9
  27. package/dist/typings/bin/src/run/index.d.ts +0 -1
  28. package/dist/typings/bin/src/run/loadConfigFile.d.ts +0 -6
  29. package/dist/typings/bin/src/run/watch.d.ts +0 -8
  30. package/dist/typings/bin/src/sourceMappingUrl.d.ts +0 -2
  31. package/dist/typings/bin/src/utils/sequence.d.ts +0 -4
  32. package/dist/typings/browser/fs.d.ts +0 -5
  33. package/dist/typings/browser/path.d.ts +0 -10
  34. package/dist/typings/src/Bundle.d.ts +0 -29
  35. package/dist/typings/src/ExternalModule.d.ts +0 -23
  36. package/dist/typings/src/Graph.d.ts +0 -60
  37. package/dist/typings/src/Module.d.ts +0 -137
  38. package/dist/typings/src/ast/CallOptions.d.ts +0 -24
  39. package/dist/typings/src/ast/Entity.d.ts +0 -19
  40. package/dist/typings/src/ast/ExecutionPathOptions.d.ts +0 -97
  41. package/dist/typings/src/ast/Node.d.ts +0 -186
  42. package/dist/typings/src/ast/clone.d.ts +0 -1
  43. package/dist/typings/src/ast/comment.d.ts +0 -4
  44. package/dist/typings/src/ast/enhance.d.ts +0 -7
  45. package/dist/typings/src/ast/keys.d.ts +0 -4
  46. package/dist/typings/src/ast/nodes/ArrayExpression.d.ts +0 -9
  47. package/dist/typings/src/ast/nodes/ArrayPattern.d.ts +0 -21
  48. package/dist/typings/src/ast/nodes/ArrowFunctionExpression.d.ts +0 -48
  49. package/dist/typings/src/ast/nodes/AssignmentExpression.d.ts +0 -16
  50. package/dist/typings/src/ast/nodes/AssignmentPattern.d.ts +0 -23
  51. package/dist/typings/src/ast/nodes/AssignmentProperty.d.ts +0 -10
  52. package/dist/typings/src/ast/nodes/AwaitExpression.d.ts +0 -8
  53. package/dist/typings/src/ast/nodes/BinaryExpression.d.ts +0 -38
  54. package/dist/typings/src/ast/nodes/BlockStatement.d.ts +0 -19
  55. package/dist/typings/src/ast/nodes/BreakStatement.d.ts +0 -9
  56. package/dist/typings/src/ast/nodes/CallExpression.d.ts +0 -45
  57. package/dist/typings/src/ast/nodes/CatchClause.d.ts +0 -14
  58. package/dist/typings/src/ast/nodes/ClassBody.d.ts +0 -17
  59. package/dist/typings/src/ast/nodes/ClassDeclaration.d.ts +0 -11
  60. package/dist/typings/src/ast/nodes/ClassExpression.d.ts +0 -10
  61. package/dist/typings/src/ast/nodes/ConditionalExpression.d.ts +0 -50
  62. package/dist/typings/src/ast/nodes/Declaration.d.ts +0 -8
  63. package/dist/typings/src/ast/nodes/DoWhileStatement.d.ts +0 -10
  64. package/dist/typings/src/ast/nodes/EmptyStatement.d.ts +0 -7
  65. package/dist/typings/src/ast/nodes/ExportAllDeclaration.d.ts +0 -11
  66. package/dist/typings/src/ast/nodes/ExportDefaultDeclaration.d.ts +0 -18
  67. package/dist/typings/src/ast/nodes/ExportNamedDeclaration.d.ts +0 -24
  68. package/dist/typings/src/ast/nodes/ExportSpecifier.d.ts +0 -8
  69. package/dist/typings/src/ast/nodes/Expression.d.ts +0 -46
  70. package/dist/typings/src/ast/nodes/ExpressionStatement.d.ts +0 -5
  71. package/dist/typings/src/ast/nodes/ForInStatement.d.ts +0 -17
  72. package/dist/typings/src/ast/nodes/ForOfStatement.d.ts +0 -18
  73. package/dist/typings/src/ast/nodes/ForStatement.d.ts +0 -16
  74. package/dist/typings/src/ast/nodes/FunctionDeclaration.d.ts +0 -9
  75. package/dist/typings/src/ast/nodes/FunctionExpression.d.ts +0 -6
  76. package/dist/typings/src/ast/nodes/Identifier.d.ts +0 -56
  77. package/dist/typings/src/ast/nodes/IfStatement.d.ts +0 -15
  78. package/dist/typings/src/ast/nodes/Import.d.ts +0 -20
  79. package/dist/typings/src/ast/nodes/ImportDeclaration.d.ts +0 -19
  80. package/dist/typings/src/ast/nodes/ImportDefaultSpecifier.d.ts +0 -7
  81. package/dist/typings/src/ast/nodes/ImportNamespaceSpecifier.d.ts +0 -7
  82. package/dist/typings/src/ast/nodes/ImportSpecifier.d.ts +0 -8
  83. package/dist/typings/src/ast/nodes/LabeledStatement.d.ts +0 -10
  84. package/dist/typings/src/ast/nodes/Literal.d.ts +0 -22
  85. package/dist/typings/src/ast/nodes/LogicalExpression.d.ts +0 -47
  86. package/dist/typings/src/ast/nodes/MemberExpression.d.ts +0 -61
  87. package/dist/typings/src/ast/nodes/MethodDefinition.d.ts +0 -20
  88. package/dist/typings/src/ast/nodes/NewExpression.d.ts +0 -17
  89. package/dist/typings/src/ast/nodes/ObjectExpression.d.ts +0 -52
  90. package/dist/typings/src/ast/nodes/ObjectPattern.d.ts +0 -22
  91. package/dist/typings/src/ast/nodes/Pattern.d.ts +0 -12
  92. package/dist/typings/src/ast/nodes/Program.d.ts +0 -7
  93. package/dist/typings/src/ast/nodes/Property.d.ts +0 -57
  94. package/dist/typings/src/ast/nodes/RestElement.d.ts +0 -21
  95. package/dist/typings/src/ast/nodes/ReturnStatement.d.ts +0 -10
  96. package/dist/typings/src/ast/nodes/SequenceExpression.d.ts +0 -12
  97. package/dist/typings/src/ast/nodes/SpreadElement.d.ts +0 -6
  98. package/dist/typings/src/ast/nodes/Statement.d.ts +0 -10
  99. package/dist/typings/src/ast/nodes/SwitchCase.d.ts +0 -9
  100. package/dist/typings/src/ast/nodes/SwitchStatement.d.ts +0 -13
  101. package/dist/typings/src/ast/nodes/TaggedTemplateExpression.d.ts +0 -13
  102. package/dist/typings/src/ast/nodes/TemplateElement.d.ts +0 -12
  103. package/dist/typings/src/ast/nodes/TemplateLiteral.d.ts +0 -10
  104. package/dist/typings/src/ast/nodes/ThisExpression.d.ts +0 -22
  105. package/dist/typings/src/ast/nodes/ThrowStatement.d.ts +0 -9
  106. package/dist/typings/src/ast/nodes/UnaryExpression.d.ts +0 -19
  107. package/dist/typings/src/ast/nodes/UnknownNode.d.ts +0 -5
  108. package/dist/typings/src/ast/nodes/UpdateExpression.d.ts +0 -16
  109. package/dist/typings/src/ast/nodes/VariableDeclaration.d.ts +0 -23
  110. package/dist/typings/src/ast/nodes/VariableDeclarator.d.ts +0 -15
  111. package/dist/typings/src/ast/nodes/WhileStatement.d.ts +0 -10
  112. package/dist/typings/src/ast/nodes/YieldExpression.d.ts +0 -9
  113. package/dist/typings/src/ast/nodes/index.d.ts +0 -69
  114. package/dist/typings/src/ast/nodes/shared/ClassNode.d.ts +0 -27
  115. package/dist/typings/src/ast/nodes/shared/Expression.d.ts +0 -42
  116. package/dist/typings/src/ast/nodes/shared/FunctionNode.d.ts +0 -42
  117. package/dist/typings/src/ast/nodes/shared/Node.d.ts +0 -169
  118. package/dist/typings/src/ast/nodes/shared/Pattern.d.ts +0 -3
  119. package/dist/typings/src/ast/nodes/shared/Statement.d.ts +0 -6
  120. package/dist/typings/src/ast/nodes/shared/VirtualObjectExpression.d.ts +0 -7
  121. package/dist/typings/src/ast/nodes/shared/disallowIllegalReassignment.d.ts +0 -6
  122. package/dist/typings/src/ast/nodes/shared/pureFunctions.d.ts +0 -4
  123. package/dist/typings/src/ast/scopes/BlockScope.d.ts +0 -12
  124. package/dist/typings/src/ast/scopes/CatchScope.d.ts +0 -13
  125. package/dist/typings/src/ast/scopes/FunctionScope.d.ts +0 -27
  126. package/dist/typings/src/ast/scopes/GlobalScope.d.ts +0 -6
  127. package/dist/typings/src/ast/scopes/ModuleScope.d.ts +0 -11
  128. package/dist/typings/src/ast/scopes/ParameterScope.d.ts +0 -16
  129. package/dist/typings/src/ast/scopes/ReturnValueScope.d.ts +0 -24
  130. package/dist/typings/src/ast/scopes/Scope.d.ts +0 -49
  131. package/dist/typings/src/ast/utils/extractNames.d.ts +0 -2
  132. package/dist/typings/src/ast/values.d.ts +0 -5
  133. package/dist/typings/src/ast/variables/ArgumentsVariable.d.ts +0 -30
  134. package/dist/typings/src/ast/variables/ExportDefaultVariable.d.ts +0 -19
  135. package/dist/typings/src/ast/variables/ExternalVariable.d.ts +0 -17
  136. package/dist/typings/src/ast/variables/GlobalVariable.d.ts +0 -12
  137. package/dist/typings/src/ast/variables/LocalVariable.d.ts +0 -51
  138. package/dist/typings/src/ast/variables/NamespaceVariable.d.ts +0 -23
  139. package/dist/typings/src/ast/variables/ParameterVariable.d.ts +0 -6
  140. package/dist/typings/src/ast/variables/ReplaceableInitializationVariable.d.ts +0 -33
  141. package/dist/typings/src/ast/variables/ThisVariable.d.ts +0 -4
  142. package/dist/typings/src/ast/variables/Variable.d.ts +0 -63
  143. package/dist/typings/src/ast/variables/VariableReassignmentTracker.d.ts +0 -25
  144. package/dist/typings/src/banner.d.ts +0 -0
  145. package/dist/typings/src/browser-entry.d.ts +0 -2
  146. package/dist/typings/src/finalisers/amd.d.ts +0 -21
  147. package/dist/typings/src/finalisers/cjs.d.ts +0 -20
  148. package/dist/typings/src/finalisers/es.d.ts +0 -17
  149. package/dist/typings/src/finalisers/iife.d.ts +0 -20
  150. package/dist/typings/src/finalisers/index.d.ts +0 -25
  151. package/dist/typings/src/finalisers/shared/esModuleExport.d.ts +0 -2
  152. package/dist/typings/src/finalisers/shared/getExportBlock.d.ts +0 -6
  153. package/dist/typings/src/finalisers/shared/getGlobalNameMaker.d.ts +0 -9
  154. package/dist/typings/src/finalisers/shared/getInteropBlock.d.ts +0 -6
  155. package/dist/typings/src/finalisers/shared/sanitize.d.ts +0 -2
  156. package/dist/typings/src/finalisers/shared/setupNamespace.d.ts +0 -7
  157. package/dist/typings/src/finalisers/shared/trimEmptyImports.d.ts +0 -5
  158. package/dist/typings/src/finalisers/shared/warnOnBuiltins.d.ts +0 -2
  159. package/dist/typings/src/finalisers/umd.d.ts +0 -21
  160. package/dist/typings/src/node-entry.d.ts +0 -5
  161. package/dist/typings/src/rollup/index.d.ts +0 -172
  162. package/dist/typings/src/utils/array.d.ts +0 -4
  163. package/dist/typings/src/utils/callIfFunction.d.ts +0 -1
  164. package/dist/typings/src/utils/collapseSourcemaps.d.ts +0 -11
  165. package/dist/typings/src/utils/defaults.d.ts +0 -6
  166. package/dist/typings/src/utils/deprecateOptions.d.ts +0 -9
  167. package/dist/typings/src/utils/dynamic-import-plugin.d.ts +0 -8
  168. package/dist/typings/src/utils/ensureArray.d.ts +0 -2
  169. package/dist/typings/src/utils/error.d.ts +0 -18
  170. package/dist/typings/src/utils/first.d.ts +0 -3
  171. package/dist/typings/src/utils/flushTime.d.ts +0 -5
  172. package/dist/typings/src/utils/fs.d.ts +0 -6
  173. package/dist/typings/src/utils/getCodeFrame.d.ts +0 -5
  174. package/dist/typings/src/utils/getExportMode.d.ts +0 -6
  175. package/dist/typings/src/utils/getIndentString.d.ts +0 -7
  176. package/dist/typings/src/utils/identifierHelpers.d.ts +0 -3
  177. package/dist/typings/src/utils/mergeOptions.d.ts +0 -21
  178. package/dist/typings/src/utils/object.d.ts +0 -9
  179. package/dist/typings/src/utils/path.d.ts +0 -6
  180. package/dist/typings/src/utils/promise.d.ts +0 -5
  181. package/dist/typings/src/utils/relativeId.d.ts +0 -1
  182. package/dist/typings/src/utils/sourceMappingURL.d.ts +0 -3
  183. package/dist/typings/src/utils/transform.d.ts +0 -16
  184. package/dist/typings/src/utils/transformBundle.d.ts +0 -8
  185. package/dist/typings/src/watch/chokidar.d.ts +0 -4
  186. package/dist/typings/src/watch/fileWatchers.d.ts +0 -23
  187. package/dist/typings/src/watch/index.d.ts +0 -48
  188. package/dist/typings/utils/array.d.ts +0 -4
  189. package/dist/typings/utils/dynamic-import-plugin.d.ts +0 -13
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- Rollup.js v0.55.1
3
- Fri Jan 26 2018 08:02:56 GMT+0100 (CET) - commit a45e870d2d0f3bf4c8c6dbc3bfa0d8660a2c34c3
2
+ Rollup.js v0.55.5
3
+ Sat Feb 10 2018 08:50:44 GMT+0100 (CET) - commit 82fe34dfe39d6c2aea9ca32444ea4a68e3afe814
4
4
 
5
5
 
6
6
  https://github.com/rollup/rollup
@@ -16,7 +16,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
16
16
  var path = require('path');
17
17
  var path__default = _interopDefault(path);
18
18
  var fs = require('fs');
19
- var EventEmitter = _interopDefault(require('events'));
19
+ var events = require('events');
20
20
  var module$1 = _interopDefault(require('module'));
21
21
 
22
22
  function __extends(d, b) {
@@ -354,7 +354,8 @@ function mergeOptions(_a) {
354
354
  cache: getInputOption('cache'),
355
355
  preferConst: getInputOption('preferConst'),
356
356
  experimentalDynamicImport: getInputOption('experimentalDynamicImport'),
357
- experimentalCodeSplitting: getInputOption('experimentalCodeSplitting')
357
+ experimentalCodeSplitting: getInputOption('experimentalCodeSplitting'),
358
+ preserveSymlinks: getInputOption('preserveSymlinks')
358
359
  };
359
360
  // legacy, to ensure e.g. commonjs plugin still works
360
361
  inputOptions.entry = inputOptions.input;
@@ -17403,12 +17404,12 @@ var ExternalModule = /** @class */ (function () {
17403
17404
  function load(id) {
17404
17405
  return fs.readFileSync(id, 'utf-8');
17405
17406
  }
17406
- function findFile(file) {
17407
+ function findFile(file, preserveSymlinks) {
17407
17408
  try {
17408
17409
  var stats = fs.lstatSync(file);
17409
- if (stats.isSymbolicLink())
17410
- return findFile(fs.realpathSync(file));
17411
- if (stats.isFile()) {
17410
+ if (!preserveSymlinks && stats.isSymbolicLink())
17411
+ return findFile(fs.realpathSync(file), preserveSymlinks);
17412
+ if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
17412
17413
  // check case
17413
17414
  var name = path.basename(file);
17414
17415
  var files = fs.readdirSync(path.dirname(file));
@@ -17420,26 +17421,28 @@ function findFile(file) {
17420
17421
  // suppress
17421
17422
  }
17422
17423
  }
17423
- function addJsExtensionIfNecessary(file) {
17424
- return findFile(file) || findFile(file + '.js');
17424
+ function addJsExtensionIfNecessary(file, preserveSymlinks) {
17425
+ return findFile(file, preserveSymlinks) || findFile(file + '.js', preserveSymlinks);
17425
17426
  }
17426
- function resolveId(importee, importer) {
17427
- if (typeof process === 'undefined') {
17428
- error({
17429
- code: 'MISSING_PROCESS',
17430
- message: "It looks like you're using Rollup in a non-Node.js environment. This means you must supply a plugin with custom resolveId and load functions",
17431
- url: 'https://github.com/rollup/rollup/wiki/Plugins'
17432
- });
17433
- }
17434
- // external modules (non-entry modules that start with neither '.' or '/')
17435
- // are skipped at this stage.
17436
- if (importer !== undefined && !isAbsolute(importee) && importee[0] !== '.')
17437
- return null;
17438
- // `resolve` processes paths from right to left, prepending them until an
17439
- // absolute path is created. Absolute importees therefore shortcircuit the
17440
- // resolve call and require no special handing on our part.
17441
- // See https://nodejs.org/api/path.html#path_path_resolve_paths
17442
- return addJsExtensionIfNecessary(path.resolve(importer ? path.dirname(importer) : path.resolve(), importee));
17427
+ function resolveId(options) {
17428
+ return function (importee, importer) {
17429
+ if (typeof process === 'undefined') {
17430
+ error({
17431
+ code: 'MISSING_PROCESS',
17432
+ message: "It looks like you're using Rollup in a non-Node.js environment. This means you must supply a plugin with custom resolveId and load functions",
17433
+ url: 'https://github.com/rollup/rollup/wiki/Plugins'
17434
+ });
17435
+ }
17436
+ // external modules (non-entry modules that start with neither '.' or '/')
17437
+ // are skipped at this stage.
17438
+ if (importer !== undefined && !isAbsolute(importee) && importee[0] !== '.')
17439
+ return null;
17440
+ // `resolve` processes paths from right to left, prepending them until an
17441
+ // absolute path is created. Absolute importees therefore shortcircuit the
17442
+ // resolve call and require no special handing on our part.
17443
+ // See https://nodejs.org/api/path.html#path_path_resolve_paths
17444
+ return addJsExtensionIfNecessary(path.resolve(importer ? path.dirname(importer) : path.resolve(), importee), options.preserveSymlinks);
17445
+ };
17443
17446
  }
17444
17447
  function makeOnwarn() {
17445
17448
  var warned = blank();
@@ -17690,23 +17693,38 @@ function getExportBlock(exports, dependencies, exportMode, mechanism) {
17690
17693
  return mechanism + " " + local_1 + ";";
17691
17694
  }
17692
17695
  var exportBlock = '';
17696
+ // star exports must always output first for precedence
17693
17697
  dependencies.forEach(function (_a) {
17694
17698
  var name = _a.name, reexports = _a.reexports;
17695
17699
  if (reexports && exportMode !== 'default') {
17696
17700
  reexports.forEach(function (specifier) {
17697
- if (specifier.imported === '*') {
17701
+ if (specifier.reexported === '*') {
17698
17702
  exportBlock += (exportBlock ? '\n' : '') + "Object.keys(" + name + ").forEach(function (key) { exports[key] = " + name + "[key]; });";
17699
17703
  }
17700
17704
  });
17701
17705
  }
17702
17706
  });
17703
17707
  dependencies.forEach(function (_a) {
17704
- var name = _a.name, reexports = _a.reexports;
17708
+ var name = _a.name, imports = _a.imports, reexports = _a.reexports;
17705
17709
  if (reexports && exportMode !== 'default') {
17706
17710
  reexports.forEach(function (specifier) {
17707
- if (specifier.imported !== '*') {
17711
+ if (specifier.imported === 'default') {
17712
+ var exportsNamesOrNamespace = imports &&
17713
+ imports.some(function (specifier) { return specifier.imported === '*' || specifier.imported !== 'default'; }) ||
17714
+ reexports && reexports.some(function (specifier) { return specifier.imported !== 'default' && specifier.imported !== '*'; });
17715
+ if (exportsNamesOrNamespace) {
17716
+ exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + "__default;";
17717
+ }
17718
+ else {
17719
+ exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + ";";
17720
+ }
17721
+ }
17722
+ else if (specifier.imported !== '*') {
17708
17723
  exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + "." + specifier.imported + ";";
17709
17724
  }
17725
+ else if (specifier.reexported !== '*') {
17726
+ exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + ";";
17727
+ }
17710
17728
  });
17711
17729
  }
17712
17730
  });
@@ -17835,7 +17853,7 @@ function cjs(chunk, magicString, _a, options) {
17835
17853
  }
17836
17854
  needsInterop = true;
17837
17855
  var exportsNames = imports && imports.some(function (specifier) { return specifier.imported !== 'default' && specifier.imported !== '*'; }) ||
17838
- reexports && reexports.some(function (specifier) { return specifier.imported === 'default'; });
17856
+ reexports && reexports.some(function (specifier) { return specifier.imported !== 'default' && specifier.imported !== '*'; });
17839
17857
  if (exportsNames) {
17840
17858
  return varOrConst + " " + name + " = require('" + getPath(id) + "');" +
17841
17859
  ("\n" + varOrConst + " " + name + "__default = _interopDefault(" + name + ");");
@@ -17861,23 +17879,25 @@ function es(chunk, magicString, _a) {
17861
17879
  var getPath = _a.getPath, intro = _a.intro, outro = _a.outro;
17862
17880
  var _b = chunk.getModuleDeclarations(), dependencies = _b.dependencies, exports = _b.exports;
17863
17881
  var importBlock = dependencies.map(function (_a) {
17864
- var id = _a.id, reexports = _a.reexports, imports = _a.imports;
17882
+ var id = _a.id, reexports = _a.reexports, imports = _a.imports, name = _a.name;
17865
17883
  if (!reexports && !imports) {
17866
17884
  return "import '" + getPath(id) + "';";
17867
17885
  }
17868
17886
  var output = '';
17869
17887
  if (imports) {
17870
17888
  var defaultImport_1 = imports.find(function (specifier) { return specifier.imported === 'default'; });
17871
- var starImport = imports.find(function (specifier) { return specifier.imported === '*'; });
17872
- if (starImport) {
17873
- output += "import * as " + starImport.local + " from '" + getPath(id) + "';";
17889
+ var starImport_1 = imports.find(function (specifier) { return specifier.imported === '*'; });
17890
+ if (starImport_1) {
17891
+ output += "import * as " + starImport_1.local + " from '" + getPath(id) + "';";
17892
+ if (imports.length > 1)
17893
+ output += '\n';
17874
17894
  }
17875
- else if (defaultImport_1 && imports.length === 1) {
17895
+ if (defaultImport_1 && imports.length === 1) {
17876
17896
  output += "import " + defaultImport_1.local + " from '" + getPath(id) + "';";
17877
17897
  }
17878
- else {
17898
+ else if (!starImport_1 || imports.length > 1) {
17879
17899
  output += "import " + (defaultImport_1 ? defaultImport_1.local + ", " : '') + "{ " + imports
17880
- .filter(function (specifier) { return specifier !== defaultImport_1; })
17900
+ .filter(function (specifier) { return specifier !== defaultImport_1 && specifier !== starImport_1; })
17881
17901
  .map(function (specifier) {
17882
17902
  if (specifier.imported === specifier.local) {
17883
17903
  return specifier.imported;
@@ -17890,16 +17910,27 @@ function es(chunk, magicString, _a) {
17890
17910
  }
17891
17911
  }
17892
17912
  if (reexports) {
17913
+ if (imports)
17914
+ output += '\n';
17893
17915
  var starExport_1 = reexports.find(function (specifier) { return specifier.reexported === '*'; });
17916
+ var namespaceReexport_1 = reexports.find(function (specifier) { return specifier.imported === '*' && specifier.reexported !== '*'; });
17894
17917
  if (starExport_1) {
17895
- output += "export * from '" + id + "';";
17918
+ output += "export * from '" + getPath(id) + "';";
17896
17919
  if (reexports.length === 1) {
17897
17920
  return output;
17898
17921
  }
17899
17922
  output += '\n';
17900
17923
  }
17924
+ if (namespaceReexport_1) {
17925
+ output += "import * as " + name + " from '" + getPath(id) + "';\n";
17926
+ output += "export { " + (name === namespaceReexport_1.reexported ? name : name + " as " + namespaceReexport_1.reexported) + " };";
17927
+ if (reexports.length === (starExport_1 ? 2 : 1)) {
17928
+ return output;
17929
+ }
17930
+ output += '\n';
17931
+ }
17901
17932
  output += "export { " + reexports
17902
- .filter(function (specifier) { return specifier !== starExport_1; })
17933
+ .filter(function (specifier) { return specifier !== starExport_1 && specifier !== namespaceReexport_1; })
17903
17934
  .map(function (specifier) {
17904
17935
  if (specifier.imported === specifier.reexported) {
17905
17936
  return specifier.imported;
@@ -18524,21 +18555,7 @@ var Chunk$1 = /** @class */ (function () {
18524
18555
  this.orderedModules.forEach(function (module) {
18525
18556
  Object.keys(module.imports).forEach(function (importName) {
18526
18557
  var declaration = module.imports[importName];
18527
- var tracedExport = _this.traceExport(declaration.module, declaration.name);
18528
- // ignore imports to modules already in this chunk
18529
- if (!tracedExport || tracedExport.module.chunk === _this) {
18530
- return;
18531
- }
18532
- var variable = tracedExport.module.traceExport(tracedExport.name);
18533
- // namespace variable can indicate multiple imports
18534
- if (tracedExport.name === '*') {
18535
- Object.keys(variable.originals || variable.module.declarations).forEach(function (importName) {
18536
- var original = (variable.originals || variable.module.declarations)[importName];
18537
- _this.populateImport(original, tracedExport);
18538
- });
18539
- return;
18540
- }
18541
- _this.populateImport(variable, tracedExport);
18558
+ _this.traceImport(declaration.module, declaration.name);
18542
18559
  });
18543
18560
  });
18544
18561
  };
@@ -18579,6 +18596,25 @@ var Chunk$1 = /** @class */ (function () {
18579
18596
  Chunk.prototype.getJsonModules = function () {
18580
18597
  return this.orderedModules.map(function (module) { return module.toJSON(); });
18581
18598
  };
18599
+ Chunk.prototype.traceImport = function (module, exportName) {
18600
+ var _this = this;
18601
+ var tracedExport = this.traceExport(module, exportName);
18602
+ // ignore imports to modules already in this chunk
18603
+ if (!tracedExport || tracedExport.module.chunk === this) {
18604
+ return tracedExport;
18605
+ }
18606
+ var variable = tracedExport.module.traceExport(tracedExport.name);
18607
+ // namespace variable can indicate multiple imports
18608
+ if (tracedExport.name === '*') {
18609
+ Object.keys(variable.originals || variable.module.declarations).forEach(function (importName) {
18610
+ var original = (variable.originals || variable.module.declarations)[importName];
18611
+ _this.populateImport(original, tracedExport);
18612
+ });
18613
+ return tracedExport;
18614
+ }
18615
+ this.populateImport(variable, tracedExport);
18616
+ return tracedExport;
18617
+ };
18582
18618
  // trace a module export to its exposed chunk module export
18583
18619
  // either in this chunk or in another
18584
18620
  // we follow reexports if they are not entry points in the hope
@@ -18594,7 +18630,12 @@ var Chunk$1 = /** @class */ (function () {
18594
18630
  if (module.chunk !== this && module.isEntryPoint) {
18595
18631
  return { name: name, module: module };
18596
18632
  }
18597
- if (module.exports[name]) {
18633
+ var exportDeclaration = module.exports[name];
18634
+ if (exportDeclaration) {
18635
+ // if export binding is itself an import binding then continue tracing
18636
+ var importDeclaration = module.imports[exportDeclaration.localName];
18637
+ if (importDeclaration)
18638
+ return this.traceImport(importDeclaration.module, importDeclaration.name);
18598
18639
  return { name: name, module: module };
18599
18640
  }
18600
18641
  var reexportDeclaration = module.reexports[name];
@@ -18720,13 +18761,13 @@ var Chunk$1 = /** @class */ (function () {
18720
18761
  used['_setter'] = used['_starExcludes'] = used['_$p'] = 1;
18721
18762
  }
18722
18763
  var toDeshadow = new Set();
18723
- this.externalModules.forEach(function (module) {
18724
- if (!es || module.exportsNamespace) {
18764
+ if (!es) {
18765
+ this.externalModules.forEach(function (module) {
18725
18766
  var safeName = getSafeName(module.name);
18726
18767
  toDeshadow.add(safeName);
18727
18768
  module.name = safeName;
18728
- }
18729
- });
18769
+ });
18770
+ }
18730
18771
  this.imports.forEach(function (impt) {
18731
18772
  impt.variables.forEach(function (_a) {
18732
18773
  var name = _a.name, module = _a.module, variable = _a.variable;
@@ -18744,9 +18785,10 @@ var Chunk$1 = /** @class */ (function () {
18744
18785
  }
18745
18786
  }
18746
18787
  else {
18747
- safeName = (es || system) ? getSafeName(variable.name) : module.name + "." + name;
18788
+ safeName = (es || system) ? variable.name : module.name + "." + name;
18748
18789
  }
18749
18790
  if (es || system) {
18791
+ safeName = getSafeName(safeName);
18750
18792
  toDeshadow.add(safeName);
18751
18793
  }
18752
18794
  }
@@ -19030,7 +19072,6 @@ function firstSync(candidates) {
19030
19072
  };
19031
19073
  }
19032
19074
 
19033
- /// <reference path="./Graph.d.ts" />
19034
19075
  function generateChunkName(id, chunkNames, startAtTwo) {
19035
19076
  if (startAtTwo === void 0) { startAtTwo = false; }
19036
19077
  var name = path.basename(id);
@@ -19095,7 +19136,7 @@ var Graph = /** @class */ (function () {
19095
19136
  }
19096
19137
  this.resolveId = first([(function (id, parentId) { return (_this.isExternal(id, parentId, false) ? false : null); })]
19097
19138
  .concat(this.plugins.map(function (plugin) { return plugin.resolveId; }).filter(Boolean))
19098
- .concat(resolveId));
19139
+ .concat(resolveId(options)));
19099
19140
  var loaders = this.plugins.map(function (plugin) { return plugin.load; }).filter(Boolean);
19100
19141
  this.hasLoaders = loaders.length !== 0;
19101
19142
  this.load = first(loaders.concat(load));
@@ -19208,10 +19249,7 @@ var Graph = /** @class */ (function () {
19208
19249
  // determine the topological execution order for the bundle
19209
19250
  timeStart('phase 2');
19210
19251
  _this.link();
19211
- var _a = _this.analyseExecution([entryModule]), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports, hasCycles = _a.hasCycles;
19212
- if (hasCycles) {
19213
- _this.warnCycle(entryModule, orderedModules);
19214
- }
19252
+ var _a = _this.analyseExecution([entryModule]), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
19215
19253
  timeEnd('phase 2');
19216
19254
  // Phase 3 – marking. We include all statements that should be included
19217
19255
  timeStart('phase 3');
@@ -19341,17 +19379,12 @@ var Graph = /** @class */ (function () {
19341
19379
  };
19342
19380
  Graph.prototype.analyseExecution = function (entryModules) {
19343
19381
  var _this = this;
19344
- var hasCycles = false, curEntry, curEntryHash;
19382
+ var curEntry, curEntryHash;
19345
19383
  var allSeen = {};
19346
19384
  var ordered = [];
19347
19385
  var dynamicImports = [];
19348
- var visit = function (module, seen) {
19349
- if (seen === void 0) { seen = {}; }
19350
- if (seen[module.id]) {
19351
- hasCycles = true;
19352
- return;
19353
- }
19354
- seen[module.id] = true;
19386
+ var visit = function (module, parents) {
19387
+ if (parents === void 0) { parents = (_a = {}, _a[module.id] = null, _a); }
19355
19388
  if (module.isEntryPoint && module !== curEntry)
19356
19389
  return;
19357
19390
  // Track entry point graph colouring by tracing all modules loaded by a given
@@ -19361,7 +19394,14 @@ var Graph = /** @class */ (function () {
19361
19394
  Uint8ArrayXor(module.entryPointsHash, curEntryHash);
19362
19395
  module.dependencies.forEach(function (depModule) {
19363
19396
  if (!depModule.isExternal) {
19364
- visit(depModule, seen);
19397
+ if (depModule.id in parents) {
19398
+ if (!allSeen[depModule.id]) {
19399
+ _this.warnCycle(depModule.id, module.id, parents);
19400
+ }
19401
+ return;
19402
+ }
19403
+ parents[depModule.id] = module.id;
19404
+ visit(depModule, parents);
19365
19405
  }
19366
19406
  });
19367
19407
  if (_this.dynamicImport) {
@@ -19378,6 +19418,7 @@ var Graph = /** @class */ (function () {
19378
19418
  allSeen[module.id] = true;
19379
19419
  module.execIndex = ordered.length;
19380
19420
  ordered.push(module);
19421
+ var _a;
19381
19422
  };
19382
19423
  for (var i = 0; i < entryModules.length; i++) {
19383
19424
  curEntry = entryModules[i];
@@ -19392,10 +19433,24 @@ var Graph = /** @class */ (function () {
19392
19433
  curEntryHash = randomUint8Array(10);
19393
19434
  visit(curEntry);
19394
19435
  }
19395
- return { orderedModules: ordered, dynamicImports: dynamicImports, hasCycles: hasCycles };
19436
+ return { orderedModules: ordered, dynamicImports: dynamicImports };
19396
19437
  };
19397
- Graph.prototype.warnCycle = function (_entryModule, _ordered) {
19398
- // TODO: reinstate
19438
+ Graph.prototype.warnCycle = function (id, parentId, parents) {
19439
+ var path$$1 = [relativeId(id)];
19440
+ var curId = parentId;
19441
+ while (curId !== id) {
19442
+ path$$1.push(relativeId(curId));
19443
+ curId = parents[curId];
19444
+ if (!curId)
19445
+ break;
19446
+ }
19447
+ path$$1.push(path$$1[0]);
19448
+ path$$1.reverse();
19449
+ this.warn({
19450
+ code: 'CIRCULAR_DEPENDENCY',
19451
+ importer: path$$1[0],
19452
+ message: "Circular dependency: " + path$$1.join(' -> ')
19453
+ });
19399
19454
  };
19400
19455
  Graph.prototype.fetchModule = function (id, importer) {
19401
19456
  var _this = this;
@@ -23486,7 +23541,7 @@ var Watcher = /** @class */ (function (_super) {
23486
23541
  });
23487
23542
  };
23488
23543
  return Watcher;
23489
- }(EventEmitter));
23544
+ }(events.EventEmitter));
23490
23545
  var Task = /** @class */ (function () {
23491
23546
  function Task(watcher, config) {
23492
23547
  this.cache = null;
@@ -23608,7 +23663,7 @@ function watch$1(configs) {
23608
23663
  return new Watcher(configs);
23609
23664
  }
23610
23665
 
23611
- var version$1 = "0.55.1";
23666
+ var version$1 = "0.55.5";
23612
23667
 
23613
23668
  /// <reference path="../typings/package.json.d.ts" />
23614
23669
 
@@ -77,6 +77,10 @@ export default class Chunk {
77
77
  getImportIds(): string[];
78
78
  getExportNames(): string[];
79
79
  getJsonModules(): ModuleJSON[];
80
+ traceImport(module: Module | ExternalModule, exportName: string): {
81
+ name: string;
82
+ module: Module | ExternalModule;
83
+ };
80
84
  traceExport(module: Module | ExternalModule, name: string): {
81
85
  name: string;
82
86
  module: Module | ExternalModule;
@@ -1,4 +1,3 @@
1
- /// <reference path="../../src/Graph.d.ts" />
2
1
  /// <reference types="acorn" />
3
2
  import * as acorn from 'acorn';
4
3
  import Module, { ModuleJSON } from './Module';
@@ -42,7 +41,7 @@ export default class Graph {
42
41
  [name: string]: Chunk;
43
42
  }>;
44
43
  private analyseExecution(entryModules);
45
- private warnCycle(_entryModule, _ordered);
44
+ private warnCycle(id, parentId, parents);
46
45
  private fetchModule(id, importer);
47
46
  private fetchAllDependencies(module);
48
47
  warn(warning: RollupWarning): void;
@@ -61,6 +61,7 @@ export interface InputOptions {
61
61
  watch?: WatcherOptions;
62
62
  experimentalDynamicImport?: boolean;
63
63
  experimentalCodeSplitting?: boolean;
64
+ preserveSymlinks?: boolean;
64
65
  pureExternalModules?: boolean;
65
66
  preferConst?: boolean;
66
67
  entry?: string;
@@ -1,6 +1,7 @@
1
1
  import Module from '../Module';
2
2
  import ExternalModule from '../ExternalModule';
3
+ import { InputOptions } from '../rollup';
3
4
  export declare function load(id: string): string;
4
- export declare function resolveId(importee: string, importer: string): string | void;
5
+ export declare function resolveId(options: InputOptions): (importee: string, importer: string) => string | void;
5
6
  export declare function makeOnwarn(): (warning: any) => void;
6
7
  export declare function handleMissingExport(module: Module, name: string, otherModule: Module | ExternalModule, start?: number): void;
@@ -0,0 +1,12 @@
1
+ import { Node } from '../ast/nodes/shared/Node';
2
+ import MagicString from 'magic-string';
3
+ import { RenderOptions } from '../Module';
4
+ export declare function findFirstOccurrenceOutsideComment(code: string, searchString: string): number;
5
+ export declare function findFirstLineBreakOutsideComment(code: string): number;
6
+ export declare function renderStatementList(statements: Node[], code: MagicString, start: number, end: number, options: RenderOptions): void;
7
+ export declare function getCommaSeparatedNodesWithSeparators<N extends Node>(nodes: N[], code: MagicString, start: number, end: number): ({
8
+ node: N;
9
+ start: number;
10
+ separator: number | null;
11
+ end: number;
12
+ })[];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import EventEmitter from 'events';
2
+ import { EventEmitter } from 'events';
3
3
  import { InputOptions, OutputOptions, OutputChunk } from '../rollup/index';
4
4
  import { WatchOptions } from 'chokidar';
5
5
  export interface WatcherOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "0.55.1",
3
+ "version": "0.55.5",
4
4
  "description": "Next-generation ES6 module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/rollup.es.js",
@@ -11,17 +11,20 @@
11
11
  },
12
12
  "scripts": {
13
13
  "pretest": "npm run build",
14
- "test": "npm run test:only",
14
+ "test": "npm run test:only && npm run test:typescript",
15
15
  "test:only": "mocha",
16
16
  "test:leak": "node --expose-gc test/leak/index.js",
17
- "test:quick": "rollup -c && mocha -b",
17
+ "test:quick": "mocha -b",
18
+ "pretest:typescript": "rm -rf test/typescript/dist && rm -rf test/typescript/typings && cp -r dist test/typescript/ && cp -r typings test/typescript/",
19
+ "test:typescript": "tsc -p test/typescript",
18
20
  "pretest-coverage": "npm run build",
19
21
  "test-coverage": "rm -rf coverage/* && istanbul cover --report json node_modules/.bin/_mocha -- -u exports -R spec test/test.js",
20
22
  "posttest-coverage": "remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped.json -b dist && remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped.lcov -t lcovonly -b dist && remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped -t html -b dist",
21
23
  "ci": "npm run test-coverage && codecov < coverage/coverage-remapped.lcov",
24
+ "prebuild": "rm -rf dist",
22
25
  "build": "git rev-parse HEAD > .commithash && rollup -c && tsc -p tsconfig-types.json && chmod a+x bin/rollup",
23
26
  "watch": "rollup -cw",
24
- "prepublishOnly": "npm run lint && npm run test:only && npm run test:leak",
27
+ "prepublishOnly": "npm run lint && npm run test && npm run test:leak",
25
28
  "prepare": "npm run build",
26
29
  "lint": "eslint src browser bin test/test.js test/*/index.js test/utils test/**/_config.js"
27
30
  },
@@ -53,13 +56,15 @@
53
56
  "acorn-dynamic-import": "^3.0.0",
54
57
  "ansi-escapes": "^3.0.0",
55
58
  "buble": "^0.18.0",
56
- "buffer-xor": "^2.0.2",
59
+ "cash-cp": "^0.2.0",
60
+ "cash-rm": "^0.2.0",
57
61
  "chalk": "^2.3.0",
58
62
  "codecov.io": "^0.1.6",
59
63
  "console-group": "^0.3.1",
60
64
  "date-time": "^2.1.0",
61
65
  "eslint": "^4.11.0",
62
66
  "eslint-plugin-import": "^2.8.0",
67
+ "fixturify": "^0.3.4",
63
68
  "immutable": "^3.8.2",
64
69
  "is-reference": "^1.0.0",
65
70
  "istanbul": "^0.4.3",
@@ -1,29 +0,0 @@
1
- import Module from "./Module";
2
- import { OutputOptions } from "./rollup/index";
3
- import Graph from "./Graph";
4
- import ExternalModule from "./ExternalModule";
5
- export default class Bundle {
6
- graph: Graph;
7
- orderedModules: Module[];
8
- externalModules: ExternalModule[];
9
- entryModule: Module;
10
- constructor(graph: Graph, orderedModules: Module[]);
11
- bind(): void;
12
- includeMarked(treeshake: boolean): void;
13
- setOutputFacade(entryModule: Module): void;
14
- processExternals(): void;
15
- collectAddon(
16
- initialAddon: string,
17
- addonName: "banner" | "footer" | "intro" | "outro",
18
- sep?: string
19
- ): Promise<string>;
20
- getPathRelativeToEntryDirname(resolvedId: string): string;
21
- deconflict(): void;
22
- private setIdentifierRenderResolutions(options);
23
- render(
24
- options: OutputOptions
25
- ): Promise<{
26
- code: string;
27
- map: any;
28
- }>;
29
- }