Browse Source

Merge pull request #731 from rollup/gh-468

Deprecate `es6` format
semi-dynamic-namespace-imports
Rich Harris 9 years ago
committed by GitHub
parent
commit
04922aee6a
  1. 9
      src/Bundle.js
  2. 10
      src/Declaration.js
  3. 6
      src/Module.js
  4. 2
      src/finalisers/es.js
  5. 4
      src/finalisers/index.js
  6. 2
      test/cli/multiple-targets-shared-config/_expected/es.js
  7. 1
      test/cli/multiple-targets-shared-config/_expected/es.js.map
  8. 1
      test/cli/multiple-targets-shared-config/_expected/es6.js.map
  9. 4
      test/cli/multiple-targets-shared-config/rollup.config.js
  10. 0
      test/cli/multiple-targets/_expected/es.js
  11. 4
      test/cli/multiple-targets/rollup.config.js
  12. 0
      test/form/absolute-path-resolver/_expected/es.js
  13. 0
      test/form/assignment-to-exports-class-declaration/_expected/es.js
  14. 0
      test/form/banner-and-footer-plugin/_expected/es.js
  15. 0
      test/form/banner-and-footer/_expected/es.js
  16. 0
      test/form/block-comments/_expected/es.js
  17. 0
      test/form/computed-properties/_expected/es.js
  18. 0
      test/form/conflicting-imports/_expected/es.js
  19. 0
      test/form/dedupes-external-imports/_expected/es.js
  20. 0
      test/form/erroneous-nested-member-expression/_expected/es.js
  21. 0
      test/form/exclude-unnecessary-modifications/_expected/es.js
  22. 0
      test/form/export-all-from-internal/_expected/es.js
  23. 0
      test/form/export-default-2/_expected/es.js
  24. 0
      test/form/export-default-3/_expected/es.js
  25. 0
      test/form/export-default-import/_expected/es.js
  26. 0
      test/form/export-default/_expected/es.js
  27. 0
      test/form/export-multiple-vars/_expected/es.js
  28. 0
      test/form/exports-at-end-if-possible/_expected/es.js
  29. 0
      test/form/external-import-alias-shadow/_expected/es.js
  30. 0
      test/form/external-imports-custom-names-function/_expected/es.js
  31. 0
      test/form/external-imports-custom-names/_expected/es.js
  32. 0
      test/form/external-imports/_expected/es.js
  33. 0
      test/form/import-external-namespace-and-default/_expected/es.js
  34. 0
      test/form/import-named-exported-global-with-alias/_expected/es.js
  35. 0
      test/form/indent-false/_expected/es.js
  36. 0
      test/form/indent-true-spaces/_expected/es.js
  37. 0
      test/form/indent-true/_expected/es.js
  38. 0
      test/form/internal-conflict-resolution/_expected/es.js
  39. 0
      test/form/intro-and-outro/_expected/es.js
  40. 0
      test/form/multiple-exports/_expected/es.js
  41. 0
      test/form/namespace-optimization-b/_expected/es.js
  42. 0
      test/form/namespace-optimization/_expected/es.js
  43. 0
      test/form/namespaced-default-exports/_expected/es.js
  44. 0
      test/form/namespaced-named-exports/_expected/es.js
  45. 0
      test/form/no-imports-or-exports/_expected/es.js
  46. 0
      test/form/no-treeshake/_expected/es.js
  47. 0
      test/form/object-destructuring-default-values/_expected/es.js
  48. 0
      test/form/prefer-const/_expected/es.js
  49. 0
      test/form/preserve-debugger/_expected/es.js
  50. 0
      test/form/preserves-comments-after-imports/_expected/es.js
  51. 0
      test/form/removes-existing-sourcemap-comments/_expected/es.js
  52. 0
      test/form/self-contained-bundle/_expected/es.js
  53. 0
      test/form/shorthand-properties/_expected/es.js
  54. 0
      test/form/side-effect-b/_expected/es.js
  55. 0
      test/form/side-effect-c/_expected/es.js
  56. 0
      test/form/side-effect-d/_expected/es.js
  57. 0
      test/form/side-effect-e/_expected/es.js
  58. 0
      test/form/side-effect-f/_expected/es.js
  59. 0
      test/form/side-effect-g/_expected/es.js
  60. 0
      test/form/side-effect-h/_expected/es.js
  61. 0
      test/form/side-effect-i/_expected/es.js
  62. 0
      test/form/side-effect-j/_expected/es.js
  63. 0
      test/form/side-effect-k/_expected/es.js
  64. 0
      test/form/side-effect-l/_expected/es.js
  65. 0
      test/form/side-effect-m/_expected/es.js
  66. 0
      test/form/side-effect-n/_expected/es.js
  67. 0
      test/form/side-effect-o/_expected/es.js
  68. 0
      test/form/side-effect/_expected/es.js
  69. 2
      test/form/sourcemaps-external/_expected/es.js
  70. 1
      test/form/sourcemaps-external/_expected/es.js.map
  71. 1
      test/form/sourcemaps-external/_expected/es6.js.map
  72. 13
      test/form/sourcemaps-inline/_expected/es.js
  73. 13
      test/form/sourcemaps-inline/_expected/es6.js
  74. 0
      test/form/spacing-after-function-with-semicolon/_expected/es.js
  75. 0
      test/form/string-indentation-b/_expected/es.js
  76. 0
      test/form/string-indentation/_expected/es.js
  77. 0
      test/form/this-is-undefined/_expected/es.js
  78. 0
      test/form/transform-bundle-plugin/_expected/es.js
  79. 0
      test/form/umd-noconflict/_expected/es.js
  80. 0
      test/form/unmodified-default-exports-function-argument/_expected/es.js
  81. 0
      test/form/unmodified-default-exports/_expected/es.js
  82. 0
      test/form/unused-default-exports/_expected/es.js
  83. 0
      test/form/whitespace-around-namespace-member-expression/_expected/es.js
  84. 32
      test/test.js

9
src/Bundle.js

@ -277,7 +277,12 @@ export default class Bundle {
}
render ( options = {} ) {
const format = options.format || 'es6';
if ( options.format === 'es6' ) {
this.onwarn( 'The es6 format is deprecated – use `es` instead' );
options.format = 'es';
}
const format = options.format || 'es';
// Determine export mode - 'default', 'named', 'none'
const exportMode = getExportMode( this, options.exports, options.moduleName );
@ -286,7 +291,7 @@ export default class Bundle {
let usedModules = [];
this.orderedModules.forEach( module => {
const source = module.render( format === 'es6' );
const source = module.render( format === 'es' );
if ( source.toString().length ) {
magicString.addSource( source );
usedModules.push( module );

10
src/Declaration.js

@ -42,8 +42,8 @@ export default class Declaration {
if ( reference.isReassignment ) this.isReassigned = true;
}
render ( es6 ) {
if ( es6 ) return this.name;
render ( es ) {
if ( es ) return this.name;
if ( !this.isReassigned || !this.exportName ) return this.name;
return `exports.${this.exportName}`;
@ -280,18 +280,18 @@ export class ExternalDeclaration {
}
}
render ( es6 ) {
render ( es ) {
if ( this.name === '*' ) {
return this.module.name;
}
if ( this.name === 'default' ) {
return this.module.exportsNamespace || ( !es6 && this.module.exportsNames ) ?
return this.module.exportsNamespace || ( !es && this.module.exportsNames ) ?
`${this.module.name}__default` :
this.module.name;
}
return es6 ? this.safeName : `${this.module.name}.${this.name}`;
return es ? this.safeName : `${this.module.name}.${this.name}`;
}
run () {

6
src/Module.js

@ -445,7 +445,7 @@ export default class Module {
return statements;
}
render ( es6 ) {
render ( es ) {
let magicString = this.magicString.clone();
this.statements.forEach( statement => {
@ -489,7 +489,7 @@ export default class Module {
const declaration = this.declarations[ name ];
if ( declaration.exportName && declaration.isReassigned ) {
magicString.insertLeft( statement.end, `;\nexports.${name} = ${declaration.render( es6 )}` );
magicString.insertLeft( statement.end, `;\nexports.${name} = ${declaration.render( es )}` );
}
});
}
@ -514,7 +514,7 @@ export default class Module {
const declaration = reference.declaration;
if ( declaration ) {
const name = declaration.render( es6 );
const name = declaration.render( es );
// the second part of this check is necessary because of
// namespace optimisation – name of `foo.bar` could be `bar`

2
src/finalisers/es6.js → src/finalisers/es.js

@ -4,7 +4,7 @@ function notDefault ( name ) {
return name !== 'default';
}
export default function es6 ( bundle, magicString ) {
export default function es ( bundle, magicString ) {
const importBlock = bundle.externalModules
.map( module => {
const specifiers = [];

4
src/finalisers/index.js

@ -1,7 +1,7 @@
import amd from './amd.js';
import cjs from './cjs.js';
import es6 from './es6.js';
import es from './es.js';
import iife from './iife.js';
import umd from './umd.js';
export default { amd, cjs, es6, iife, umd };
export default { amd, cjs, es, iife, umd };

2
test/cli/multiple-targets-shared-config/_expected/es6.js → test/cli/multiple-targets-shared-config/_expected/es.js

@ -1,4 +1,4 @@
var main = 0;
export default main;
//# sourceMappingURL=es6.js.map
//# sourceMappingURL=es.js.map

1
test/cli/multiple-targets-shared-config/_expected/es.js.map

@ -0,0 +1 @@
{"version":3,"file":"es.js","sources":["../main.js"],"sourcesContent":["export default 0;\n"],"names":[],"mappings":"AAAA,WAAe,CAAC,CAAC,;;"}

1
test/cli/multiple-targets-shared-config/_expected/es6.js.map

@ -1 +0,0 @@
{"version":3,"file":"es6.js","sources":["../main.js"],"sourcesContent":["export default 0;\n"],"names":[],"mappings":"AAAA,WAAe,CAAC,CAAC,;;"}

4
test/cli/multiple-targets-shared-config/rollup.config.js

@ -7,8 +7,8 @@ export default {
dest: '_actual/cjs.js'
},
{
format: 'es6',
dest: '_actual/es6.js'
format: 'es',
dest: '_actual/es.js'
}
]
};

0
test/cli/multiple-targets/_expected/es6.js → test/cli/multiple-targets/_expected/es.js

4
test/cli/multiple-targets/rollup.config.js

@ -6,8 +6,8 @@ export default {
dest: '_actual/cjs.js'
},
{
format: 'es6',
dest: '_actual/es6.js'
format: 'es',
dest: '_actual/es.js'
}
]
};

0
test/form/absolute-path-resolver/_expected/es6.js → test/form/absolute-path-resolver/_expected/es.js

0
test/form/assignment-to-exports-class-declaration/_expected/es6.js → test/form/assignment-to-exports-class-declaration/_expected/es.js

0
test/form/banner-and-footer-plugin/_expected/es6.js → test/form/banner-and-footer-plugin/_expected/es.js

0
test/form/banner-and-footer/_expected/es6.js → test/form/banner-and-footer/_expected/es.js

0
test/form/block-comments/_expected/es6.js → test/form/block-comments/_expected/es.js

0
test/form/computed-properties/_expected/es6.js → test/form/computed-properties/_expected/es.js

0
test/form/conflicting-imports/_expected/es6.js → test/form/conflicting-imports/_expected/es.js

0
test/form/dedupes-external-imports/_expected/es6.js → test/form/dedupes-external-imports/_expected/es.js

0
test/form/erroneous-nested-member-expression/_expected/es6.js → test/form/erroneous-nested-member-expression/_expected/es.js

0
test/form/exclude-unnecessary-modifications/_expected/es6.js → test/form/exclude-unnecessary-modifications/_expected/es.js

0
test/form/export-all-from-internal/_expected/es6.js → test/form/export-all-from-internal/_expected/es.js

0
test/form/export-default-2/_expected/es6.js → test/form/export-default-2/_expected/es.js

0
test/form/export-default-3/_expected/es6.js → test/form/export-default-3/_expected/es.js

0
test/form/export-default-import/_expected/es6.js → test/form/export-default-import/_expected/es.js

0
test/form/export-default/_expected/es6.js → test/form/export-default/_expected/es.js

0
test/form/export-multiple-vars/_expected/es6.js → test/form/export-multiple-vars/_expected/es.js

0
test/form/exports-at-end-if-possible/_expected/es6.js → test/form/exports-at-end-if-possible/_expected/es.js

0
test/form/external-import-alias-shadow/_expected/es6.js → test/form/external-import-alias-shadow/_expected/es.js

0
test/form/external-imports-custom-names-function/_expected/es6.js → test/form/external-imports-custom-names-function/_expected/es.js

0
test/form/external-imports-custom-names/_expected/es6.js → test/form/external-imports-custom-names/_expected/es.js

0
test/form/external-imports/_expected/es6.js → test/form/external-imports/_expected/es.js

0
test/form/import-external-namespace-and-default/_expected/es6.js → test/form/import-external-namespace-and-default/_expected/es.js

0
test/form/import-named-exported-global-with-alias/_expected/es6.js → test/form/import-named-exported-global-with-alias/_expected/es.js

0
test/form/indent-false/_expected/es6.js → test/form/indent-false/_expected/es.js

0
test/form/indent-true-spaces/_expected/es6.js → test/form/indent-true-spaces/_expected/es.js

0
test/form/indent-true/_expected/es6.js → test/form/indent-true/_expected/es.js

0
test/form/internal-conflict-resolution/_expected/es6.js → test/form/internal-conflict-resolution/_expected/es.js

0
test/form/intro-and-outro/_expected/es6.js → test/form/intro-and-outro/_expected/es.js

0
test/form/multiple-exports/_expected/es6.js → test/form/multiple-exports/_expected/es.js

0
test/form/namespace-optimization-b/_expected/es6.js → test/form/namespace-optimization-b/_expected/es.js

0
test/form/namespace-optimization/_expected/es6.js → test/form/namespace-optimization/_expected/es.js

0
test/form/namespaced-default-exports/_expected/es6.js → test/form/namespaced-default-exports/_expected/es.js

0
test/form/namespaced-named-exports/_expected/es6.js → test/form/namespaced-named-exports/_expected/es.js

0
test/form/no-imports-or-exports/_expected/es6.js → test/form/no-imports-or-exports/_expected/es.js

0
test/form/no-treeshake/_expected/es6.js → test/form/no-treeshake/_expected/es.js

0
test/form/object-destructuring-default-values/_expected/es6.js → test/form/object-destructuring-default-values/_expected/es.js

0
test/form/prefer-const/_expected/es6.js → test/form/prefer-const/_expected/es.js

0
test/form/preserve-debugger/_expected/es6.js → test/form/preserve-debugger/_expected/es.js

0
test/form/preserves-comments-after-imports/_expected/es6.js → test/form/preserves-comments-after-imports/_expected/es.js

0
test/form/removes-existing-sourcemap-comments/_expected/es6.js → test/form/removes-existing-sourcemap-comments/_expected/es.js

0
test/form/self-contained-bundle/_expected/es6.js → test/form/self-contained-bundle/_expected/es.js

0
test/form/shorthand-properties/_expected/es6.js → test/form/shorthand-properties/_expected/es.js

0
test/form/side-effect-b/_expected/es6.js → test/form/side-effect-b/_expected/es.js

0
test/form/side-effect-c/_expected/es6.js → test/form/side-effect-c/_expected/es.js

0
test/form/side-effect-d/_expected/es6.js → test/form/side-effect-d/_expected/es.js

0
test/form/side-effect-e/_expected/es6.js → test/form/side-effect-e/_expected/es.js

0
test/form/side-effect-f/_expected/es6.js → test/form/side-effect-f/_expected/es.js

0
test/form/side-effect-g/_expected/es6.js → test/form/side-effect-g/_expected/es.js

0
test/form/side-effect-h/_expected/es6.js → test/form/side-effect-h/_expected/es.js

0
test/form/side-effect-i/_expected/es6.js → test/form/side-effect-i/_expected/es.js

0
test/form/side-effect-j/_expected/es6.js → test/form/side-effect-j/_expected/es.js

0
test/form/side-effect-k/_expected/es6.js → test/form/side-effect-k/_expected/es.js

0
test/form/side-effect-l/_expected/es6.js → test/form/side-effect-l/_expected/es.js

0
test/form/side-effect-m/_expected/es6.js → test/form/side-effect-m/_expected/es.js

0
test/form/side-effect-n/_expected/es6.js → test/form/side-effect-n/_expected/es.js

0
test/form/side-effect-o/_expected/es6.js → test/form/side-effect-o/_expected/es.js

0
test/form/side-effect/_expected/es6.js → test/form/side-effect/_expected/es.js

2
test/form/sourcemaps-external/_expected/es6.js → test/form/sourcemaps-external/_expected/es.js

@ -10,4 +10,4 @@ console.log( 'hello from main.js' );
foo();
bar();
//# sourceMappingURL=es6.js.map
//# sourceMappingURL=es.js.map

1
test/form/sourcemaps-external/_expected/es.js.map

@ -0,0 +1 @@
{"version":3,"file":"es.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":"AAAe,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACFc,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACCD,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC;;AAEpC,GAAG,EAAE,CAAC;AACN,GAAG,EAAE,CAAC"}

1
test/form/sourcemaps-external/_expected/es6.js.map

@ -1 +0,0 @@
{"version":3,"file":"es6.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":"AAAe,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACFc,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACCD,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC;;AAEpC,GAAG,EAAE,CAAC;AACN,GAAG,EAAE,CAAC"}

13
test/form/sourcemaps-inline/_expected/es.js

@ -0,0 +1,13 @@
function foo () {
console.log( 'hello from foo.js' );
}
function bar () {
console.log( 'hello from bar.js' );
}
console.log( 'hello from main.js' );
foo();
bar();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXMuanMiLCJzb3VyY2VzIjpbIi4uL2Zvby5qcyIsIi4uL2Jhci5qcyIsIi4uL21haW4uanMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gZm9vICgpIHtcblx0Y29uc29sZS5sb2coICdoZWxsbyBmcm9tIGZvby5qcycgKTtcbn1cbiIsImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGJhciAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBiYXIuanMnICk7XG59XG4iLCJpbXBvcnQgZm9vIGZyb20gJy4vZm9vJztcbmltcG9ydCBiYXIgZnJvbSAnLi9iYXInO1xuXG5jb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gbWFpbi5qcycgKTtcblxuZm9vKCk7XG5iYXIoKTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBZSxTQUFTLEdBQUcsSUFBSTtDQUM5QixPQUFPLENBQUMsR0FBRyxFQUFFLG1CQUFtQixFQUFFLENBQUM7Q0FDbkM7O0FDRmMsU0FBUyxHQUFHLElBQUk7Q0FDOUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRSxDQUFDO0NBQ25DOztBQ0NELE9BQU8sQ0FBQyxHQUFHLEVBQUUsb0JBQW9CLEVBQUUsQ0FBQzs7QUFFcEMsR0FBRyxFQUFFLENBQUM7QUFDTixHQUFHLEVBQUUsQ0FBQyJ9

13
test/form/sourcemaps-inline/_expected/es6.js

@ -1,13 +0,0 @@
function foo () {
console.log( 'hello from foo.js' );
}
function bar () {
console.log( 'hello from bar.js' );
}
console.log( 'hello from main.js' );
foo();
bar();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXM2LmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uanMnICk7XG59XG4iLCJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBiYXIgKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gYmFyLmpzJyApO1xufVxuIiwiaW1wb3J0IGZvbyBmcm9tICcuL2Zvbyc7XG5pbXBvcnQgYmFyIGZyb20gJy4vYmFyJztcblxuY29uc29sZS5sb2coICdoZWxsbyBmcm9tIG1haW4uanMnICk7XG5cbmZvbygpO1xuYmFyKCk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWUsU0FBUyxHQUFHLElBQUk7Q0FDOUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRSxDQUFDO0NBQ25DOztBQ0ZjLFNBQVMsR0FBRyxJQUFJO0NBQzlCLE9BQU8sQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLEVBQUUsQ0FBQztDQUNuQzs7QUNDRCxPQUFPLENBQUMsR0FBRyxFQUFFLG9CQUFvQixFQUFFLENBQUM7O0FBRXBDLEdBQUcsRUFBRSxDQUFDO0FBQ04sR0FBRyxFQUFFLENBQUMifQ==

0
test/form/spacing-after-function-with-semicolon/_expected/es6.js → test/form/spacing-after-function-with-semicolon/_expected/es.js

0
test/form/string-indentation-b/_expected/es6.js → test/form/string-indentation-b/_expected/es.js

0
test/form/string-indentation/_expected/es6.js → test/form/string-indentation/_expected/es.js

0
test/form/this-is-undefined/_expected/es6.js → test/form/this-is-undefined/_expected/es.js

0
test/form/transform-bundle-plugin/_expected/es6.js → test/form/transform-bundle-plugin/_expected/es.js

0
test/form/umd-noconflict/_expected/es6.js → test/form/umd-noconflict/_expected/es.js

0
test/form/unmodified-default-exports-function-argument/_expected/es6.js → test/form/unmodified-default-exports-function-argument/_expected/es.js

0
test/form/unmodified-default-exports/_expected/es6.js → test/form/unmodified-default-exports/_expected/es.js

0
test/form/unused-default-exports/_expected/es6.js → test/form/unused-default-exports/_expected/es.js

0
test/form/whitespace-around-namespace-member-expression/_expected/es6.js → test/form/whitespace-around-namespace-member-expression/_expected/es.js

32
test/test.js

@ -17,7 +17,7 @@ var CLI = path.resolve( __dirname, 'cli' );
var PROFILES = [
{ format: 'amd' },
{ format: 'cjs' },
{ format: 'es6' },
{ format: 'es' },
{ format: 'iife' },
{ format: 'umd' }
];
@ -125,6 +125,26 @@ describe( 'rollup', function () {
}, /You must supply options\.moduleName for IIFE bundles/ );
});
});
it( 'warns on es6 format', function () {
var warned;
return rollup.rollup({
entry: 'x',
plugins: [{
resolveId: function () { return 'test'; },
load: function () {
return '// empty';
}
}],
onwarn: function ( msg ) {
if ( /The es6 format is deprecated/.test( msg ) ) warned = true;
}
}).then( function ( bundle ) {
bundle.generate({ format: 'es6' });
assert.ok( warned );
});
});
});
describe( 'function', function () {
@ -345,15 +365,9 @@ describe( 'rollup', function () {
( config.skip ? it.skip : config.solo ? it.only : it )( dir, function ( done ) {
process.chdir( path.resolve( CLI, dir ) );
if (os.platform() === 'win32') {
config.command = "node " + path.resolve( __dirname, '../bin' ) + path.sep + config.command;
}
const command = 'node ' + path.resolve( __dirname, '../bin' ) + path.sep + config.command;
exec( config.command, {
env: {
PATH: path.resolve( __dirname, '../bin' ) + path.delimiter + process.env.PATH
}
}, function ( err, code, stderr ) {
exec( command, {}, function ( err, code, stderr ) {
if ( err ) {
if ( config.error ) {
config.error( err );

Loading…
Cancel
Save