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.es.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
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import path, { basename, dirname, extname, relative, resolve, sep } from 'path';
11
11
  import { lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, watch, writeFile } from 'fs';
12
- import EventEmitter from 'events';
12
+ import { EventEmitter } from 'events';
13
13
  import module$1 from 'module';
14
14
 
15
15
  function __extends(d, b) {
@@ -347,7 +347,8 @@ function mergeOptions(_a) {
347
347
  cache: getInputOption('cache'),
348
348
  preferConst: getInputOption('preferConst'),
349
349
  experimentalDynamicImport: getInputOption('experimentalDynamicImport'),
350
- experimentalCodeSplitting: getInputOption('experimentalCodeSplitting')
350
+ experimentalCodeSplitting: getInputOption('experimentalCodeSplitting'),
351
+ preserveSymlinks: getInputOption('preserveSymlinks')
351
352
  };
352
353
  // legacy, to ensure e.g. commonjs plugin still works
353
354
  inputOptions.entry = inputOptions.input;
@@ -17396,12 +17397,12 @@ var ExternalModule = /** @class */ (function () {
17396
17397
  function load(id) {
17397
17398
  return readFileSync(id, 'utf-8');
17398
17399
  }
17399
- function findFile(file) {
17400
+ function findFile(file, preserveSymlinks) {
17400
17401
  try {
17401
17402
  var stats = lstatSync(file);
17402
- if (stats.isSymbolicLink())
17403
- return findFile(realpathSync(file));
17404
- if (stats.isFile()) {
17403
+ if (!preserveSymlinks && stats.isSymbolicLink())
17404
+ return findFile(realpathSync(file), preserveSymlinks);
17405
+ if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
17405
17406
  // check case
17406
17407
  var name = basename(file);
17407
17408
  var files = readdirSync(dirname(file));
@@ -17413,26 +17414,28 @@ function findFile(file) {
17413
17414
  // suppress
17414
17415
  }
17415
17416
  }
17416
- function addJsExtensionIfNecessary(file) {
17417
- return findFile(file) || findFile(file + '.js');
17417
+ function addJsExtensionIfNecessary(file, preserveSymlinks) {
17418
+ return findFile(file, preserveSymlinks) || findFile(file + '.js', preserveSymlinks);
17418
17419
  }
17419
- function resolveId(importee, importer) {
17420
- if (typeof process === 'undefined') {
17421
- error({
17422
- code: 'MISSING_PROCESS',
17423
- 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",
17424
- url: 'https://github.com/rollup/rollup/wiki/Plugins'
17425
- });
17426
- }
17427
- // external modules (non-entry modules that start with neither '.' or '/')
17428
- // are skipped at this stage.
17429
- if (importer !== undefined && !isAbsolute(importee) && importee[0] !== '.')
17430
- return null;
17431
- // `resolve` processes paths from right to left, prepending them until an
17432
- // absolute path is created. Absolute importees therefore shortcircuit the
17433
- // resolve call and require no special handing on our part.
17434
- // See https://nodejs.org/api/path.html#path_path_resolve_paths
17435
- return addJsExtensionIfNecessary(resolve(importer ? dirname(importer) : resolve(), importee));
17420
+ function resolveId(options) {
17421
+ return function (importee, importer) {
17422
+ if (typeof process === 'undefined') {
17423
+ error({
17424
+ code: 'MISSING_PROCESS',
17425
+ 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",
17426
+ url: 'https://github.com/rollup/rollup/wiki/Plugins'
17427
+ });
17428
+ }
17429
+ // external modules (non-entry modules that start with neither '.' or '/')
17430
+ // are skipped at this stage.
17431
+ if (importer !== undefined && !isAbsolute(importee) && importee[0] !== '.')
17432
+ return null;
17433
+ // `resolve` processes paths from right to left, prepending them until an
17434
+ // absolute path is created. Absolute importees therefore shortcircuit the
17435
+ // resolve call and require no special handing on our part.
17436
+ // See https://nodejs.org/api/path.html#path_path_resolve_paths
17437
+ return addJsExtensionIfNecessary(resolve(importer ? dirname(importer) : resolve(), importee), options.preserveSymlinks);
17438
+ };
17436
17439
  }
17437
17440
  function makeOnwarn() {
17438
17441
  var warned = blank();
@@ -17683,23 +17686,38 @@ function getExportBlock(exports, dependencies, exportMode, mechanism) {
17683
17686
  return mechanism + " " + local_1 + ";";
17684
17687
  }
17685
17688
  var exportBlock = '';
17689
+ // star exports must always output first for precedence
17686
17690
  dependencies.forEach(function (_a) {
17687
17691
  var name = _a.name, reexports = _a.reexports;
17688
17692
  if (reexports && exportMode !== 'default') {
17689
17693
  reexports.forEach(function (specifier) {
17690
- if (specifier.imported === '*') {
17694
+ if (specifier.reexported === '*') {
17691
17695
  exportBlock += (exportBlock ? '\n' : '') + "Object.keys(" + name + ").forEach(function (key) { exports[key] = " + name + "[key]; });";
17692
17696
  }
17693
17697
  });
17694
17698
  }
17695
17699
  });
17696
17700
  dependencies.forEach(function (_a) {
17697
- var name = _a.name, reexports = _a.reexports;
17701
+ var name = _a.name, imports = _a.imports, reexports = _a.reexports;
17698
17702
  if (reexports && exportMode !== 'default') {
17699
17703
  reexports.forEach(function (specifier) {
17700
- if (specifier.imported !== '*') {
17704
+ if (specifier.imported === 'default') {
17705
+ var exportsNamesOrNamespace = imports &&
17706
+ imports.some(function (specifier) { return specifier.imported === '*' || specifier.imported !== 'default'; }) ||
17707
+ reexports && reexports.some(function (specifier) { return specifier.imported !== 'default' && specifier.imported !== '*'; });
17708
+ if (exportsNamesOrNamespace) {
17709
+ exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + "__default;";
17710
+ }
17711
+ else {
17712
+ exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + ";";
17713
+ }
17714
+ }
17715
+ else if (specifier.imported !== '*') {
17701
17716
  exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + "." + specifier.imported + ";";
17702
17717
  }
17718
+ else if (specifier.reexported !== '*') {
17719
+ exportBlock += (exportBlock ? '\n' : '') + "exports." + specifier.reexported + " = " + name + ";";
17720
+ }
17703
17721
  });
17704
17722
  }
17705
17723
  });
@@ -17828,7 +17846,7 @@ function cjs(chunk, magicString, _a, options) {
17828
17846
  }
17829
17847
  needsInterop = true;
17830
17848
  var exportsNames = imports && imports.some(function (specifier) { return specifier.imported !== 'default' && specifier.imported !== '*'; }) ||
17831
- reexports && reexports.some(function (specifier) { return specifier.imported === 'default'; });
17849
+ reexports && reexports.some(function (specifier) { return specifier.imported !== 'default' && specifier.imported !== '*'; });
17832
17850
  if (exportsNames) {
17833
17851
  return varOrConst + " " + name + " = require('" + getPath(id) + "');" +
17834
17852
  ("\n" + varOrConst + " " + name + "__default = _interopDefault(" + name + ");");
@@ -17854,23 +17872,25 @@ function es(chunk, magicString, _a) {
17854
17872
  var getPath = _a.getPath, intro = _a.intro, outro = _a.outro;
17855
17873
  var _b = chunk.getModuleDeclarations(), dependencies = _b.dependencies, exports = _b.exports;
17856
17874
  var importBlock = dependencies.map(function (_a) {
17857
- var id = _a.id, reexports = _a.reexports, imports = _a.imports;
17875
+ var id = _a.id, reexports = _a.reexports, imports = _a.imports, name = _a.name;
17858
17876
  if (!reexports && !imports) {
17859
17877
  return "import '" + getPath(id) + "';";
17860
17878
  }
17861
17879
  var output = '';
17862
17880
  if (imports) {
17863
17881
  var defaultImport_1 = imports.find(function (specifier) { return specifier.imported === 'default'; });
17864
- var starImport = imports.find(function (specifier) { return specifier.imported === '*'; });
17865
- if (starImport) {
17866
- output += "import * as " + starImport.local + " from '" + getPath(id) + "';";
17882
+ var starImport_1 = imports.find(function (specifier) { return specifier.imported === '*'; });
17883
+ if (starImport_1) {
17884
+ output += "import * as " + starImport_1.local + " from '" + getPath(id) + "';";
17885
+ if (imports.length > 1)
17886
+ output += '\n';
17867
17887
  }
17868
- else if (defaultImport_1 && imports.length === 1) {
17888
+ if (defaultImport_1 && imports.length === 1) {
17869
17889
  output += "import " + defaultImport_1.local + " from '" + getPath(id) + "';";
17870
17890
  }
17871
- else {
17891
+ else if (!starImport_1 || imports.length > 1) {
17872
17892
  output += "import " + (defaultImport_1 ? defaultImport_1.local + ", " : '') + "{ " + imports
17873
- .filter(function (specifier) { return specifier !== defaultImport_1; })
17893
+ .filter(function (specifier) { return specifier !== defaultImport_1 && specifier !== starImport_1; })
17874
17894
  .map(function (specifier) {
17875
17895
  if (specifier.imported === specifier.local) {
17876
17896
  return specifier.imported;
@@ -17883,16 +17903,27 @@ function es(chunk, magicString, _a) {
17883
17903
  }
17884
17904
  }
17885
17905
  if (reexports) {
17906
+ if (imports)
17907
+ output += '\n';
17886
17908
  var starExport_1 = reexports.find(function (specifier) { return specifier.reexported === '*'; });
17909
+ var namespaceReexport_1 = reexports.find(function (specifier) { return specifier.imported === '*' && specifier.reexported !== '*'; });
17887
17910
  if (starExport_1) {
17888
- output += "export * from '" + id + "';";
17911
+ output += "export * from '" + getPath(id) + "';";
17889
17912
  if (reexports.length === 1) {
17890
17913
  return output;
17891
17914
  }
17892
17915
  output += '\n';
17893
17916
  }
17917
+ if (namespaceReexport_1) {
17918
+ output += "import * as " + name + " from '" + getPath(id) + "';\n";
17919
+ output += "export { " + (name === namespaceReexport_1.reexported ? name : name + " as " + namespaceReexport_1.reexported) + " };";
17920
+ if (reexports.length === (starExport_1 ? 2 : 1)) {
17921
+ return output;
17922
+ }
17923
+ output += '\n';
17924
+ }
17894
17925
  output += "export { " + reexports
17895
- .filter(function (specifier) { return specifier !== starExport_1; })
17926
+ .filter(function (specifier) { return specifier !== starExport_1 && specifier !== namespaceReexport_1; })
17896
17927
  .map(function (specifier) {
17897
17928
  if (specifier.imported === specifier.reexported) {
17898
17929
  return specifier.imported;
@@ -18517,21 +18548,7 @@ var Chunk$1 = /** @class */ (function () {
18517
18548
  this.orderedModules.forEach(function (module) {
18518
18549
  Object.keys(module.imports).forEach(function (importName) {
18519
18550
  var declaration = module.imports[importName];
18520
- var tracedExport = _this.traceExport(declaration.module, declaration.name);
18521
- // ignore imports to modules already in this chunk
18522
- if (!tracedExport || tracedExport.module.chunk === _this) {
18523
- return;
18524
- }
18525
- var variable = tracedExport.module.traceExport(tracedExport.name);
18526
- // namespace variable can indicate multiple imports
18527
- if (tracedExport.name === '*') {
18528
- Object.keys(variable.originals || variable.module.declarations).forEach(function (importName) {
18529
- var original = (variable.originals || variable.module.declarations)[importName];
18530
- _this.populateImport(original, tracedExport);
18531
- });
18532
- return;
18533
- }
18534
- _this.populateImport(variable, tracedExport);
18551
+ _this.traceImport(declaration.module, declaration.name);
18535
18552
  });
18536
18553
  });
18537
18554
  };
@@ -18572,6 +18589,25 @@ var Chunk$1 = /** @class */ (function () {
18572
18589
  Chunk.prototype.getJsonModules = function () {
18573
18590
  return this.orderedModules.map(function (module) { return module.toJSON(); });
18574
18591
  };
18592
+ Chunk.prototype.traceImport = function (module, exportName) {
18593
+ var _this = this;
18594
+ var tracedExport = this.traceExport(module, exportName);
18595
+ // ignore imports to modules already in this chunk
18596
+ if (!tracedExport || tracedExport.module.chunk === this) {
18597
+ return tracedExport;
18598
+ }
18599
+ var variable = tracedExport.module.traceExport(tracedExport.name);
18600
+ // namespace variable can indicate multiple imports
18601
+ if (tracedExport.name === '*') {
18602
+ Object.keys(variable.originals || variable.module.declarations).forEach(function (importName) {
18603
+ var original = (variable.originals || variable.module.declarations)[importName];
18604
+ _this.populateImport(original, tracedExport);
18605
+ });
18606
+ return tracedExport;
18607
+ }
18608
+ this.populateImport(variable, tracedExport);
18609
+ return tracedExport;
18610
+ };
18575
18611
  // trace a module export to its exposed chunk module export
18576
18612
  // either in this chunk or in another
18577
18613
  // we follow reexports if they are not entry points in the hope
@@ -18587,7 +18623,12 @@ var Chunk$1 = /** @class */ (function () {
18587
18623
  if (module.chunk !== this && module.isEntryPoint) {
18588
18624
  return { name: name, module: module };
18589
18625
  }
18590
- if (module.exports[name]) {
18626
+ var exportDeclaration = module.exports[name];
18627
+ if (exportDeclaration) {
18628
+ // if export binding is itself an import binding then continue tracing
18629
+ var importDeclaration = module.imports[exportDeclaration.localName];
18630
+ if (importDeclaration)
18631
+ return this.traceImport(importDeclaration.module, importDeclaration.name);
18591
18632
  return { name: name, module: module };
18592
18633
  }
18593
18634
  var reexportDeclaration = module.reexports[name];
@@ -18713,13 +18754,13 @@ var Chunk$1 = /** @class */ (function () {
18713
18754
  used['_setter'] = used['_starExcludes'] = used['_$p'] = 1;
18714
18755
  }
18715
18756
  var toDeshadow = new Set();
18716
- this.externalModules.forEach(function (module) {
18717
- if (!es || module.exportsNamespace) {
18757
+ if (!es) {
18758
+ this.externalModules.forEach(function (module) {
18718
18759
  var safeName = getSafeName(module.name);
18719
18760
  toDeshadow.add(safeName);
18720
18761
  module.name = safeName;
18721
- }
18722
- });
18762
+ });
18763
+ }
18723
18764
  this.imports.forEach(function (impt) {
18724
18765
  impt.variables.forEach(function (_a) {
18725
18766
  var name = _a.name, module = _a.module, variable = _a.variable;
@@ -18737,9 +18778,10 @@ var Chunk$1 = /** @class */ (function () {
18737
18778
  }
18738
18779
  }
18739
18780
  else {
18740
- safeName = (es || system) ? getSafeName(variable.name) : module.name + "." + name;
18781
+ safeName = (es || system) ? variable.name : module.name + "." + name;
18741
18782
  }
18742
18783
  if (es || system) {
18784
+ safeName = getSafeName(safeName);
18743
18785
  toDeshadow.add(safeName);
18744
18786
  }
18745
18787
  }
@@ -19023,7 +19065,6 @@ function firstSync(candidates) {
19023
19065
  };
19024
19066
  }
19025
19067
 
19026
- /// <reference path="./Graph.d.ts" />
19027
19068
  function generateChunkName(id, chunkNames, startAtTwo) {
19028
19069
  if (startAtTwo === void 0) { startAtTwo = false; }
19029
19070
  var name = basename(id);
@@ -19088,7 +19129,7 @@ var Graph = /** @class */ (function () {
19088
19129
  }
19089
19130
  this.resolveId = first([(function (id, parentId) { return (_this.isExternal(id, parentId, false) ? false : null); })]
19090
19131
  .concat(this.plugins.map(function (plugin) { return plugin.resolveId; }).filter(Boolean))
19091
- .concat(resolveId));
19132
+ .concat(resolveId(options)));
19092
19133
  var loaders = this.plugins.map(function (plugin) { return plugin.load; }).filter(Boolean);
19093
19134
  this.hasLoaders = loaders.length !== 0;
19094
19135
  this.load = first(loaders.concat(load));
@@ -19201,10 +19242,7 @@ var Graph = /** @class */ (function () {
19201
19242
  // determine the topological execution order for the bundle
19202
19243
  timeStart('phase 2');
19203
19244
  _this.link();
19204
- var _a = _this.analyseExecution([entryModule]), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports, hasCycles = _a.hasCycles;
19205
- if (hasCycles) {
19206
- _this.warnCycle(entryModule, orderedModules);
19207
- }
19245
+ var _a = _this.analyseExecution([entryModule]), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
19208
19246
  timeEnd('phase 2');
19209
19247
  // Phase 3 – marking. We include all statements that should be included
19210
19248
  timeStart('phase 3');
@@ -19334,17 +19372,12 @@ var Graph = /** @class */ (function () {
19334
19372
  };
19335
19373
  Graph.prototype.analyseExecution = function (entryModules) {
19336
19374
  var _this = this;
19337
- var hasCycles = false, curEntry, curEntryHash;
19375
+ var curEntry, curEntryHash;
19338
19376
  var allSeen = {};
19339
19377
  var ordered = [];
19340
19378
  var dynamicImports = [];
19341
- var visit = function (module, seen) {
19342
- if (seen === void 0) { seen = {}; }
19343
- if (seen[module.id]) {
19344
- hasCycles = true;
19345
- return;
19346
- }
19347
- seen[module.id] = true;
19379
+ var visit = function (module, parents) {
19380
+ if (parents === void 0) { parents = (_a = {}, _a[module.id] = null, _a); }
19348
19381
  if (module.isEntryPoint && module !== curEntry)
19349
19382
  return;
19350
19383
  // Track entry point graph colouring by tracing all modules loaded by a given
@@ -19354,7 +19387,14 @@ var Graph = /** @class */ (function () {
19354
19387
  Uint8ArrayXor(module.entryPointsHash, curEntryHash);
19355
19388
  module.dependencies.forEach(function (depModule) {
19356
19389
  if (!depModule.isExternal) {
19357
- visit(depModule, seen);
19390
+ if (depModule.id in parents) {
19391
+ if (!allSeen[depModule.id]) {
19392
+ _this.warnCycle(depModule.id, module.id, parents);
19393
+ }
19394
+ return;
19395
+ }
19396
+ parents[depModule.id] = module.id;
19397
+ visit(depModule, parents);
19358
19398
  }
19359
19399
  });
19360
19400
  if (_this.dynamicImport) {
@@ -19371,6 +19411,7 @@ var Graph = /** @class */ (function () {
19371
19411
  allSeen[module.id] = true;
19372
19412
  module.execIndex = ordered.length;
19373
19413
  ordered.push(module);
19414
+ var _a;
19374
19415
  };
19375
19416
  for (var i = 0; i < entryModules.length; i++) {
19376
19417
  curEntry = entryModules[i];
@@ -19385,10 +19426,24 @@ var Graph = /** @class */ (function () {
19385
19426
  curEntryHash = randomUint8Array(10);
19386
19427
  visit(curEntry);
19387
19428
  }
19388
- return { orderedModules: ordered, dynamicImports: dynamicImports, hasCycles: hasCycles };
19429
+ return { orderedModules: ordered, dynamicImports: dynamicImports };
19389
19430
  };
19390
- Graph.prototype.warnCycle = function (_entryModule, _ordered) {
19391
- // TODO: reinstate
19431
+ Graph.prototype.warnCycle = function (id, parentId, parents) {
19432
+ var path$$1 = [relativeId(id)];
19433
+ var curId = parentId;
19434
+ while (curId !== id) {
19435
+ path$$1.push(relativeId(curId));
19436
+ curId = parents[curId];
19437
+ if (!curId)
19438
+ break;
19439
+ }
19440
+ path$$1.push(path$$1[0]);
19441
+ path$$1.reverse();
19442
+ this.warn({
19443
+ code: 'CIRCULAR_DEPENDENCY',
19444
+ importer: path$$1[0],
19445
+ message: "Circular dependency: " + path$$1.join(' -> ')
19446
+ });
19392
19447
  };
19393
19448
  Graph.prototype.fetchModule = function (id, importer) {
19394
19449
  var _this = this;
@@ -23601,7 +23656,7 @@ function watch$1(configs) {
23601
23656
  return new Watcher(configs);
23602
23657
  }
23603
23658
 
23604
- var version$1 = "0.55.1";
23659
+ var version$1 = "0.55.5";
23605
23660
 
23606
23661
  /// <reference path="../typings/package.json.d.ts" />
23607
23662