diff -Nru node-rollup-2.38.1/build-plugins/conditional-fsevents-import.js node-rollup-2.38.4/build-plugins/conditional-fsevents-import.js --- node-rollup-2.38.1/build-plugins/conditional-fsevents-import.js 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/build-plugins/conditional-fsevents-import.js 2021-02-02 05:41:07.000000000 +0000 @@ -23,8 +23,8 @@ return { code: magicString.toString(), map: magicString.generateMap({ hires: true }) }; } }, - buildEnd() { - if (!transformed) { + buildEnd(error) { + if (!(error || transformed)) { throw new Error('Could not find "fsevents-handler.js", was the file renamed?'); } } diff -Nru node-rollup-2.38.1/CHANGELOG.md node-rollup-2.38.4/CHANGELOG.md --- node-rollup-2.38.1/CHANGELOG.md 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/CHANGELOG.md 2021-02-02 05:41:07.000000000 +0000 @@ -1,5 +1,35 @@ # rollup changelog +## 2.38.4 +*2021-02-02* + +### Bug Fixes +* Do not change logic when tree-shaking declarations in if statements or loops (#3947) + +### Pull Requests +* [#3947](https://github.com/rollup/rollup/pull/3947): Do not tear apart declarations in loop or if bodies (@lukastaegert) + +## 2.38.3 +*2021-02-01* + +### Bug Fixes +* Prevent an unexpected live-binding when default exporting a synthetic named export (#3946) + +### Pull Requests +* [#3945](https://github.com/rollup/rollup/pull/3945): Upgrade chokidar and fsevents for Apple M1 compatibility (@threepointone) +* [#3946](https://github.com/rollup/rollup/pull/3946): Make sure default exports snapshot synthetic named exports (@lukastaegert) + +## 2.38.2 +*2021-01-31* + +### Bug Fixes +* Do not generate invalid code for partially tree-shaken declarations in for loops (#3943) +* Always include function bodies of functions in side-effect-free modules (#3944) + +### Pull Requests +* [#3943](https://github.com/rollup/rollup/pull/3943): Do not partially tree-shake unused declarations in for loops (@lukastaegert) +* [#3944](https://github.com/rollup/rollup/pull/3944): Correctly include functions with side effects from side-effect-free modules (@lukastaegert) + ## 2.38.1 *2021-01-28* diff -Nru node-rollup-2.38.1/debian/changelog node-rollup-2.38.4/debian/changelog --- node-rollup-2.38.1/debian/changelog 2021-01-29 07:17:34.000000000 +0000 +++ node-rollup-2.38.4/debian/changelog 2021-02-02 14:00:27.000000000 +0000 @@ -1,3 +1,11 @@ +node-rollup (2.38.4-1) unstable; urgency=medium + + * Team upload + * New upstream version 2.38.4 + * Refresh patches + + -- Xavier Guimard Tue, 02 Feb 2021 15:00:27 +0100 + node-rollup (2.38.1-1) unstable; urgency=medium * Team upload diff -Nru node-rollup-2.38.1/debian/patches/hardcode-version.patch node-rollup-2.38.4/debian/patches/hardcode-version.patch --- node-rollup-2.38.1/debian/patches/hardcode-version.patch 2021-01-29 07:11:15.000000000 +0000 +++ node-rollup-2.38.4/debian/patches/hardcode-version.patch 2021-02-02 13:56:25.000000000 +0000 @@ -10,7 +10,7 @@ +++ b/src/rollup/rollup.ts @@ -1,4 +1,4 @@ -import { version as rollupVersion } from 'package.json'; -+const rollupVersion = '2.38.1'; ++const rollupVersion = '2.38.4'; import Bundle from '../Bundle'; import Graph from '../Graph'; import { ensureArray } from '../utils/ensureArray'; @@ -18,7 +18,7 @@ +++ b/src/utils/PluginContext.ts @@ -1,4 +1,4 @@ -import { version as rollupVersion } from 'package.json'; -+const rollupVersion = '2.38.1'; ++const rollupVersion = '2.38.4'; import Graph from '../Graph'; import { NormalizedInputOptions, diff -Nru node-rollup-2.38.1/package.json node-rollup-2.38.4/package.json --- node-rollup-2.38.1/package.json 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/package.json 2021-02-02 05:41:07.000000000 +0000 @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.38.1", + "version": "2.38.4", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", @@ -55,7 +55,7 @@ }, "homepage": "https://rollupjs.org/", "optionalDependencies": { - "fsevents": "~2.1.2" + "fsevents": "~2.3.1" }, "devDependencies": { "@rollup/plugin-alias": "^3.1.1", @@ -75,7 +75,7 @@ "acorn-static-class-features": "^0.2.4", "acorn-walk": "^8.0.1", "buble": "^0.20.0", - "chokidar": "^3.4.3", + "chokidar": "^3.5.1", "codecov": "^3.8.1", "colorette": "^1.2.1", "core-js": "^3.8.2", diff -Nru node-rollup-2.38.1/package-lock.json node-rollup-2.38.4/package-lock.json --- node-rollup-2.38.1/package-lock.json 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/package-lock.json 2021-02-02 05:41:07.000000000 +0000 @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "2.38.1", + "version": "2.38.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -873,14 +873,14 @@ } }, "chokidar": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", - "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", @@ -1881,9 +1881,9 @@ "dev": true }, "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.1.tgz", + "integrity": "sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==", "optional": true }, "function-bind": { @@ -3195,6 +3195,15 @@ "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.5.0" + }, + "dependencies": { + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + } } }, "debug": { @@ -3990,6 +3999,15 @@ "dev": true, "requires": { "fsevents": "~2.1.2" + }, + "dependencies": { + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + } } }, "rollup-plugin-license": { diff -Nru node-rollup-2.38.1/src/ast/nodes/DoWhileStatement.ts node-rollup-2.38.4/src/ast/nodes/DoWhileStatement.ts --- node-rollup-2.38.1/src/ast/nodes/DoWhileStatement.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/DoWhileStatement.ts 2021-02-02 05:41:07.000000000 +0000 @@ -26,7 +26,7 @@ this.included = true; this.test.include(context, includeChildrenRecursively); const { brokenFlow } = context; - this.body.include(context, includeChildrenRecursively); + this.body.includeAsSingleStatement(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } } diff -Nru node-rollup-2.38.1/src/ast/nodes/ForInStatement.ts node-rollup-2.38.4/src/ast/nodes/ForInStatement.ts --- node-rollup-2.38.1/src/ast/nodes/ForInStatement.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/ForInStatement.ts 2021-02-02 05:41:07.000000000 +0000 @@ -49,11 +49,11 @@ include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { this.included = true; - this.left.includeAllDeclaredVariables(context, includeChildrenRecursively); + this.left.include(context, includeChildrenRecursively || true); this.left.deoptimizePath(EMPTY_PATH); this.right.include(context, includeChildrenRecursively); const { brokenFlow } = context; - this.body.include(context, includeChildrenRecursively); + this.body.includeAsSingleStatement(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } diff -Nru node-rollup-2.38.1/src/ast/nodes/ForOfStatement.ts node-rollup-2.38.4/src/ast/nodes/ForOfStatement.ts --- node-rollup-2.38.1/src/ast/nodes/ForOfStatement.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/ForOfStatement.ts 2021-02-02 05:41:07.000000000 +0000 @@ -34,11 +34,11 @@ include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { this.included = true; - this.left.includeAllDeclaredVariables(context, includeChildrenRecursively); + this.left.include(context, includeChildrenRecursively || true); this.left.deoptimizePath(EMPTY_PATH); this.right.include(context, includeChildrenRecursively); const { brokenFlow } = context; - this.body.include(context, includeChildrenRecursively); + this.body.includeAsSingleStatement(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } diff -Nru node-rollup-2.38.1/src/ast/nodes/ForStatement.ts node-rollup-2.38.4/src/ast/nodes/ForStatement.ts --- node-rollup-2.38.1/src/ast/nodes/ForStatement.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/ForStatement.ts 2021-02-02 05:41:07.000000000 +0000 @@ -40,11 +40,11 @@ include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { this.included = true; - if (this.init) this.init.include(context, includeChildrenRecursively); + if (this.init) this.init.includeAsSingleStatement(context, includeChildrenRecursively); if (this.test) this.test.include(context, includeChildrenRecursively); const { brokenFlow } = context; if (this.update) this.update.include(context, includeChildrenRecursively); - this.body.include(context, includeChildrenRecursively); + this.body.includeAsSingleStatement(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } diff -Nru node-rollup-2.38.1/src/ast/nodes/IfStatement.ts node-rollup-2.38.4/src/ast/nodes/IfStatement.ts --- node-rollup-2.38.1/src/ast/nodes/IfStatement.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/IfStatement.ts 2021-02-02 05:41:07.000000000 +0000 @@ -136,10 +136,10 @@ this.test.include(context, false); } if (testValue && this.consequent.shouldBeIncluded(context)) { - this.consequent.include(context, false); + this.consequent.includeAsSingleStatement(context, false); } if (this.alternate !== null && !testValue && this.alternate.shouldBeIncluded(context)) { - this.alternate.include(context, false); + this.alternate.includeAsSingleStatement(context, false); } } @@ -159,12 +159,12 @@ const { brokenFlow } = context; let consequentBrokenFlow = BROKEN_FLOW_NONE; if (this.consequent.shouldBeIncluded(context)) { - this.consequent.include(context, false); + this.consequent.includeAsSingleStatement(context, false); consequentBrokenFlow = context.brokenFlow; context.brokenFlow = brokenFlow; } if (this.alternate !== null && this.alternate.shouldBeIncluded(context)) { - this.alternate.include(context, false); + this.alternate.includeAsSingleStatement(context, false); context.brokenFlow = context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow; } diff -Nru node-rollup-2.38.1/src/ast/nodes/shared/Node.ts node-rollup-2.38.4/src/ast/nodes/shared/Node.ts --- node-rollup-2.38.1/src/ast/nodes/shared/Node.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/shared/Node.ts 2021-02-02 05:41:07.000000000 +0000 @@ -65,10 +65,9 @@ /** * Alternative version of include to override the default behaviour of - * declarations to only include nodes for declarators that have an effect. Necessary - * for for-loops that do not use a declared loop variable. + * declarations to not include the id by default if the declarator has an effect. */ - includeAllDeclaredVariables( + includeAsSingleStatement( context: InclusionContext, includeChildrenRecursively: IncludeChildren ): void; @@ -207,10 +206,7 @@ } } - includeAllDeclaredVariables( - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + includeAsSingleStatement(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { this.include(context, includeChildrenRecursively); } @@ -286,5 +282,5 @@ } export function logNode(node: Node) { - console.log(node.context.code.slice(node.start, node.end)); + return node.context.code.slice(node.start, node.end); } diff -Nru node-rollup-2.38.1/src/ast/nodes/VariableDeclaration.ts node-rollup-2.38.4/src/ast/nodes/VariableDeclaration.ts --- node-rollup-2.38.1/src/ast/nodes/VariableDeclaration.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/VariableDeclaration.ts 2021-02-02 05:41:07.000000000 +0000 @@ -68,14 +68,13 @@ } } - includeAllDeclaredVariables( - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + includeAsSingleStatement(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { this.included = true; for (const declarator of this.declarations) { - declarator.id.included = true; - declarator.includeAllDeclaredVariables(context, includeChildrenRecursively); + if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) { + declarator.include(context, includeChildrenRecursively); + declarator.id.include(context, includeChildrenRecursively); + } } } @@ -110,12 +109,15 @@ actualContentEnd: number, renderedContentEnd: number, systemPatternExports: Variable[], - options: RenderOptions + options: RenderOptions, + isNoStatement: boolean | undefined ): void { if (code.original.charCodeAt(this.end - 1) === 59 /*";"*/) { code.remove(this.end - 1, this.end); } - separatorString += ';'; + if (!isNoStatement) { + separatorString += ';'; + } if (lastSeparatorPos !== null) { if ( code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ && @@ -147,7 +149,7 @@ private renderReplacedDeclarations( code: MagicString, options: RenderOptions, - { start = this.start, end = this.end }: NodeRenderOptions + { start = this.start, end = this.end, isNoStatement }: NodeRenderOptions ): void { const separatedNodes = getCommaSeparatedNodesWithBoundaries( this.declarations, @@ -246,7 +248,8 @@ actualContentEnd!, renderedContentEnd, systemPatternExports, - options + options, + isNoStatement ); } else { code.remove(start, end); diff -Nru node-rollup-2.38.1/src/ast/nodes/VariableDeclarator.ts node-rollup-2.38.4/src/ast/nodes/VariableDeclarator.ts --- node-rollup-2.38.1/src/ast/nodes/VariableDeclarator.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/VariableDeclarator.ts 2021-02-02 05:41:07.000000000 +0000 @@ -39,14 +39,6 @@ } } - includeAllDeclaredVariables( - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.id.include(context, includeChildrenRecursively); - } - render(code: MagicString, options: RenderOptions) { const renderId = this.id.included; if (renderId) { diff -Nru node-rollup-2.38.1/src/ast/nodes/WhileStatement.ts node-rollup-2.38.4/src/ast/nodes/WhileStatement.ts --- node-rollup-2.38.1/src/ast/nodes/WhileStatement.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/nodes/WhileStatement.ts 2021-02-02 05:41:07.000000000 +0000 @@ -26,7 +26,7 @@ this.included = true; this.test.include(context, includeChildrenRecursively); const { brokenFlow } = context; - this.body.include(context, includeChildrenRecursively); + this.body.includeAsSingleStatement(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } } diff -Nru node-rollup-2.38.1/src/ast/variables/ExportDefaultVariable.ts node-rollup-2.38.4/src/ast/variables/ExportDefaultVariable.ts --- node-rollup-2.38.1/src/ast/variables/ExportDefaultVariable.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/variables/ExportDefaultVariable.ts 2021-02-02 05:41:07.000000000 +0000 @@ -55,7 +55,9 @@ (this.hasId || !( this.originalId.variable.isReassigned || - this.originalId.variable instanceof UndefinedVariable + this.originalId.variable instanceof UndefinedVariable || + // this avoids a circular dependency + 'syntheticNamespace' in this.originalId.variable )) ? this.originalId.variable : null; diff -Nru node-rollup-2.38.1/src/ast/variables/SyntheticNamedExportVariable.ts node-rollup-2.38.4/src/ast/variables/SyntheticNamedExportVariable.ts --- node-rollup-2.38.1/src/ast/variables/SyntheticNamedExportVariable.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/ast/variables/SyntheticNamedExportVariable.ts 2021-02-02 05:41:07.000000000 +0000 @@ -1,5 +1,4 @@ import Module, { AstContext } from '../../Module'; -import { error, errSyntheticNamedExportsNeedNamespaceExport } from '../../utils/error'; import { RESERVED_NAMES } from '../../utils/reservedNames'; import ExportDefaultVariable from './ExportDefaultVariable'; import Variable from './Variable'; @@ -21,12 +20,10 @@ getBaseVariable(): Variable { if (this.baseVariable) return this.baseVariable; let baseVariable = this.syntheticNamespace; - const checkedVariables = new Set(); while ( baseVariable instanceof ExportDefaultVariable || baseVariable instanceof SyntheticNamedExportVariable ) { - checkedVariables.add(baseVariable); if (baseVariable instanceof ExportDefaultVariable) { const original = baseVariable.getOriginalVariable(); if (original === baseVariable) break; @@ -35,14 +32,6 @@ if (baseVariable instanceof SyntheticNamedExportVariable) { baseVariable = baseVariable.syntheticNamespace; } - if (checkedVariables.has(baseVariable)) { - return error( - errSyntheticNamedExportsNeedNamespaceExport( - this.module.id, - this.module.info.syntheticNamedExports - ) - ); - } } return (this.baseVariable = baseVariable); } diff -Nru node-rollup-2.38.1/src/Module.ts node-rollup-2.38.4/src/Module.ts --- node-rollup-2.38.1/src/Module.ts 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/src/Module.ts 2021-02-02 05:41:07.000000000 +0000 @@ -199,7 +199,7 @@ if (!currentVariable || referencedVariables.has(currentVariable)) { break; } - referencedVariables.add(variable); + referencedVariables.add(currentVariable); sideEffectModules.add(importingModule); const originalSideEffects = importingModule.sideEffectDependenciesByVariable.get( currentVariable @@ -1061,14 +1061,16 @@ variable.include(); this.graph.needsTreeshakingPass = true; const variableModule = variable.module; - if (variableModule && variableModule !== this && variableModule instanceof Module) { + if (variableModule && variableModule instanceof Module) { if (!variableModule.isExecuted) { markModuleAndImpureDependenciesAsExecuted(variableModule); } - const sideEffectModules = getAndExtendSideEffectModules(variable, this); - for (const module of sideEffectModules) { - if (!module.isExecuted) { - markModuleAndImpureDependenciesAsExecuted(module); + if (variableModule !== this) { + const sideEffectModules = getAndExtendSideEffectModules(variable, this); + for (const module of sideEffectModules) { + if (!module.isExecuted) { + markModuleAndImpureDependenciesAsExecuted(module); + } } } } diff -Nru node-rollup-2.38.1/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport2.js node-rollup-2.38.4/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport2.js --- node-rollup-2.38.1/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport2.js 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport2.js 2021-02-02 05:41:07.000000000 +0000 @@ -1,3 +1,3 @@ import { named } from './lib.js'; console.log('side-effect', named); -export default named; +export { named as default }; diff -Nru node-rollup-2.38.1/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport.js node-rollup-2.38.4/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport.js --- node-rollup-2.38.1/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport.js 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport.js 2021-02-02 05:41:07.000000000 +0000 @@ -1,3 +1,3 @@ import { named } from './lib-reexport2.js'; console.log('side-effect', named); -export default named; +export { named as default }; diff -Nru node-rollup-2.38.1/test/function/samples/side-effect-free-module-function/_config.js node-rollup-2.38.4/test/function/samples/side-effect-free-module-function/_config.js --- node-rollup-2.38.1/test/function/samples/side-effect-free-module-function/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/side-effect-free-module-function/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,11 @@ +module.exports = { + description: + 'correctly include functions with side effects from side-effect-free modules (#3942)', + options: { + plugins: { + transform() { + return { moduleSideEffects: false }; + } + } + } +}; diff -Nru node-rollup-2.38.1/test/function/samples/side-effect-free-module-function/curry.js node-rollup-2.38.4/test/function/samples/side-effect-free-module-function/curry.js --- node-rollup-2.38.1/test/function/samples/side-effect-free-module-function/curry.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/side-effect-free-module-function/curry.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,4 @@ +export function curry(fn, args = []) { + return (..._args) => + (rest => (rest.length >= fn.length ? fn(...rest) : curry(fn, rest)))([...args, ..._args]); +} diff -Nru node-rollup-2.38.1/test/function/samples/side-effect-free-module-function/main.js node-rollup-2.38.4/test/function/samples/side-effect-free-module-function/main.js --- node-rollup-2.38.1/test/function/samples/side-effect-free-module-function/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/side-effect-free-module-function/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,11 @@ +import { curry } from './curry'; +let result; + +function foo() { + result = 'foo'; +} + +var fooc = curry(foo); +fooc(); + +assert.strictEqual(result, 'foo'); diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -12,9 +12,10 @@ } ] }, - generateError: { + error: { code: 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', id: path.join(__dirname, 'main.js'), - message: `Module "main.js" that is marked with 'syntheticNamedExports: "__synthetic"' needs an export named "__synthetic" that does not reexport an unresolved named export of the same module.` + message: `Module "main.js" that is marked with 'syntheticNamedExports: "__synthetic"' needs an export named "__synthetic" that does not reexport an unresolved named export of the same module.`, + watchFiles: [path.join(__dirname, 'main.js'), path.join(__dirname, 'dep.js')] } }; diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports/dep.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports/dep.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports/dep.js 2021-01-28 14:15:11.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports/dep.js 2021-02-02 05:41:07.000000000 +0000 @@ -1,2 +1 @@ -import { foo } from './main.js'; -export default foo; +export { foo as default } from './main.js'; diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,11 @@ +module.exports = { + description: 'handles circular synthetic exports', + warnings: [ + { + code: 'CIRCULAR_DEPENDENCY', + cycle: ['dep1.js', 'dep2.js', 'dep1.js'], + importer: 'dep1.js', + message: 'Circular dependency: dep1.js -> dep2.js -> dep1.js' + } + ] +}; diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep1.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep1.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep1.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep1.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,2 @@ +import dep2 from './dep2'; +export default dep2; \ No newline at end of file diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep2.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep2.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep2.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep2.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,2 @@ +import dep1 from './dep1'; +export default dep1; diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/main.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/main.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/circular-synthetic-exports2/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,2 @@ +import dep1 from './dep1'; +assert.strictEqual(dep1, undefined); diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,10 @@ +module.exports = { + description: 'makes sure default exports of synthetic named exports are snapshots', + options: { + plugins: { + transform() { + return { syntheticNamedExports: '__synthetic' }; + } + } + } +}; diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/dep.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/dep.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/dep.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/dep.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,2 @@ +import { foo } from './synthetic'; +export default foo; diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/main.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/main.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,6 @@ +import foo from './dep'; +import { update } from './synthetic'; + +assert.strictEqual(foo, 'original'); +update(); +assert.strictEqual(foo, 'original'); diff -Nru node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/synthetic.js node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/synthetic.js --- node-rollup-2.38.1/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/synthetic.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/synthetic.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,2 @@ +export const __synthetic = { foo: 'original' }; +export const update = () => (__synthetic.foo = 'reassigned'); diff -Nru node-rollup-2.38.1/test/function/samples/unused-do-while-loop-declaration/_config.js node-rollup-2.38.4/test/function/samples/unused-do-while-loop-declaration/_config.js --- node-rollup-2.38.1/test/function/samples/unused-do-while-loop-declaration/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-do-while-loop-declaration/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,4 @@ +module.exports = { + description: + 'does not partially tree-shake unused declarations with side-effects in do-while loop bodies' +}; diff -Nru node-rollup-2.38.1/test/function/samples/unused-do-while-loop-declaration/main.js node-rollup-2.38.4/test/function/samples/unused-do-while-loop-declaration/main.js --- node-rollup-2.38.1/test/function/samples/unused-do-while-loop-declaration/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-do-while-loop-declaration/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,8 @@ +let result = 3; +var b = 3; + +do var b = b - 1, unused = result--, unused2 = 0; +while (b > 0); + +assert.strictEqual(b, 0); +assert.strictEqual(result, 0); diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-in-loop-declaration/_config.js node-rollup-2.38.4/test/function/samples/unused-for-in-loop-declaration/_config.js --- node-rollup-2.38.1/test/function/samples/unused-for-in-loop-declaration/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-in-loop-declaration/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,4 @@ +module.exports = { + description: + 'does not partially tree-shake unused declarations with side-effects in for-in loop bodies' +}; diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-in-loop-declaration/main.js node-rollup-2.38.4/test/function/samples/unused-for-in-loop-declaration/main.js --- node-rollup-2.38.1/test/function/samples/unused-for-in-loop-declaration/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-in-loop-declaration/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,7 @@ +let result = 3; +var b = 3; + +for (var x in {foo: 1, bar: 2}) var b = b - 1, unused = result--, unused2 = 0; + +assert.strictEqual(b, 1); +assert.strictEqual(result, 1); diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-loop-body-declaration/_config.js node-rollup-2.38.4/test/function/samples/unused-for-loop-body-declaration/_config.js --- node-rollup-2.38.1/test/function/samples/unused-for-loop-body-declaration/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-loop-body-declaration/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,4 @@ +module.exports = { + description: + 'does not partially tree-shake unused declarations with side-effects in for loop bodies' +}; diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-loop-body-declaration/main.js node-rollup-2.38.4/test/function/samples/unused-for-loop-body-declaration/main.js --- node-rollup-2.38.1/test/function/samples/unused-for-loop-body-declaration/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-loop-body-declaration/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,6 @@ +let result = 3; + +for (var a = 0; a < 3; a++) var b = a, unused = result--; + +assert.strictEqual(b, 2); +assert.strictEqual(result, 0); diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-loop-init-declaration/_config.js node-rollup-2.38.4/test/function/samples/unused-for-loop-init-declaration/_config.js --- node-rollup-2.38.1/test/function/samples/unused-for-loop-init-declaration/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-loop-init-declaration/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,3 @@ +module.exports = { + description: 'does not partially tree-shake unused declarations with side-effects in for loops' +}; diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-loop-init-declaration/main.js node-rollup-2.38.4/test/function/samples/unused-for-loop-init-declaration/main.js --- node-rollup-2.38.1/test/function/samples/unused-for-loop-init-declaration/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-loop-init-declaration/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,9 @@ +let result; +let reassigned; + +for (var a = (reassigned = 'reassigned'), b = 0, unused = 3; b < 2; b++) { + result = b; +} + +assert.strictEqual(result, 1); +assert.strictEqual(reassigned, 'reassigned'); diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-of-loop-declaration/_config.js node-rollup-2.38.4/test/function/samples/unused-for-of-loop-declaration/_config.js --- node-rollup-2.38.1/test/function/samples/unused-for-of-loop-declaration/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-of-loop-declaration/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,4 @@ +module.exports = { + description: + 'does not partially tree-shake unused declarations with side-effects in for-of loop bodies' +}; diff -Nru node-rollup-2.38.1/test/function/samples/unused-for-of-loop-declaration/main.js node-rollup-2.38.4/test/function/samples/unused-for-of-loop-declaration/main.js --- node-rollup-2.38.1/test/function/samples/unused-for-of-loop-declaration/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-for-of-loop-declaration/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,7 @@ +let result = 3; +var b = 3; + +for (var x of [1, 2]) var b = b - 1, unused = result--, unused2 = 0; + +assert.strictEqual(b, 1); +assert.strictEqual(result, 1); diff -Nru node-rollup-2.38.1/test/function/samples/unused-if-statement-declaration/_config.js node-rollup-2.38.4/test/function/samples/unused-if-statement-declaration/_config.js --- node-rollup-2.38.1/test/function/samples/unused-if-statement-declaration/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-if-statement-declaration/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,3 @@ +module.exports = { + description: 'does not partially tree-shake unused declarations with side-effects in for loops' +}; diff -Nru node-rollup-2.38.1/test/function/samples/unused-if-statement-declaration/main.js node-rollup-2.38.4/test/function/samples/unused-if-statement-declaration/main.js --- node-rollup-2.38.1/test/function/samples/unused-if-statement-declaration/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-if-statement-declaration/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,12 @@ +let result; + +export function testStatement(condition) { + if (condition) var a = 1, b = result = 1, unused1 = 3; + else var a = 2, c = result = 2, unused2 = 3; + return a; +} + +assert.strictEqual(testStatement(true), 1); +assert.strictEqual(result, 1); +assert.strictEqual(testStatement(false), 2); +assert.strictEqual(result, 2); diff -Nru node-rollup-2.38.1/test/function/samples/unused-while-loop-declaration/_config.js node-rollup-2.38.4/test/function/samples/unused-while-loop-declaration/_config.js --- node-rollup-2.38.1/test/function/samples/unused-while-loop-declaration/_config.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-while-loop-declaration/_config.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,4 @@ +module.exports = { + description: + 'does not partially tree-shake unused declarations with side-effects in while loop bodies' +}; diff -Nru node-rollup-2.38.1/test/function/samples/unused-while-loop-declaration/main.js node-rollup-2.38.4/test/function/samples/unused-while-loop-declaration/main.js --- node-rollup-2.38.1/test/function/samples/unused-while-loop-declaration/main.js 1970-01-01 00:00:00.000000000 +0000 +++ node-rollup-2.38.4/test/function/samples/unused-while-loop-declaration/main.js 2021-02-02 05:41:07.000000000 +0000 @@ -0,0 +1,8 @@ +let result = 3; +var b = 3; + +while (b > 0) +var b = b - 1, unused = result--, unused2 = 0; + +assert.strictEqual(b, 0); +assert.strictEqual(result, 0);