Skip to content

Commit

Permalink
Support "super" in class fields (#3511)
Browse files Browse the repository at this point in the history
* Update changelog

* Support "super" in class fields
  • Loading branch information
lukastaegert committed Apr 22, 2020
1 parent f65bae1 commit 0d352bf
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 257 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,14 @@
# rollup changelog

## 2.7.2
*2020-04-22*

### Bug Fixes
* Prevent an infinite loop when creating separate manual chunks with circular dependencies (#3510)

### Pull Requests
* [#3510](https://github.com/rollup/rollup/pull/3510): Do not fail for circular imports between manual chunks (@lukastaegert)

## 2.7.1
*2020-04-21*

Expand Down
2 changes: 1 addition & 1 deletion cli/run/loadConfigFile.ts
Expand Up @@ -83,7 +83,7 @@ async function getDefaultFromTranspiledConfigFile(

async function loadConfigFromBundledFile(fileName: string, bundledCode: string) {
const extension = path.extname(fileName);
const defaultLoader = require.extensions[extension];
const defaultLoader = require.extensions[extension]!;
require.extensions[extension] = (module: NodeModule, filename: string) => {
if (filename === fileName) {
(module as NodeModuleWithCompile)._compile(bundledCode, filename);
Expand Down
355 changes: 125 additions & 230 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions package.json
Expand Up @@ -64,29 +64,29 @@
"fsevents": "~2.1.2"
},
"devDependencies": {
"@rollup/plugin-alias": "^3.0.1",
"@rollup/plugin-buble": "^0.21.1",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-replace": "^2.3.1",
"@rollup/plugin-alias": "^3.1.0",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-json": "^4.0.3",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-replace": "^2.3.2",
"@types/micromatch": "^4.0.1",
"@types/node": "^13.11.1",
"@types/node": "^13.13.2",
"@types/require-relative": "^0.8.0",
"@types/signal-exit": "^3.0.0",
"@types/yargs-parser": "^15.0.0",
"acorn": "^7.1.1",
"acorn-class-fields": "github:guybedford/acorn-class-fields#acorn-update",
"acorn-export-ns-from": "^0.1.0",
"acorn-import-meta": "^1.0.0",
"acorn-import-meta": "^1.1.0",
"acorn-jsx": "^5.2.0",
"acorn-static-class-features": "github:guybedford/acorn-static-class-features#patch-1",
"acorn-walk": "^7.1.1",
"buble": "^0.20.0",
"chokidar": "^3.3.1",
"codecov": "^3.6.5",
"colorette": "^1.1.0",
"core-js": "^3.6.4",
"core-js": "^3.6.5",
"cross-os": "^1.3.0",
"date-time": "^3.1.0",
"es5-shim": "^4.5.14",
Expand All @@ -96,22 +96,22 @@
"execa": "^4.0.0",
"fixturify": "^2.1.0",
"hash.js": "^1.1.7",
"husky": "^4.2.3",
"husky": "^4.2.5",
"is-reference": "^1.1.4",
"lint-staged": "^10.1.2",
"lint-staged": "^10.1.7",
"locate-character": "^2.0.5",
"magic-string": "^0.25.7",
"markdownlint-cli": "^0.22.0",
"micromatch": "^4.0.2",
"mocha": "^7.1.1",
"node-fetch": "^2.6.0",
"nyc": "^15.0.1",
"prettier": "^2.0.4",
"prettier": "^2.0.5",
"pretty-bytes": "^5.3.0",
"pretty-ms": "^6.0.1",
"require-relative": "^0.8.7",
"requirejs": "^2.3.6",
"rollup": "^2.3.4",
"rollup": "^2.7.1",
"rollup-plugin-license": "^2.0.0",
"rollup-plugin-string": "^3.0.0",
"rollup-plugin-terser": "^5.3.0",
Expand All @@ -122,15 +122,15 @@
"shx": "^0.3.2",
"signal-exit": "^3.0.3",
"source-map": "^0.7.3",
"source-map-support": "^0.5.16",
"source-map-support": "^0.5.18",
"sourcemap-codec": "^1.4.8",
"systemjs": "^6.2.6",
"systemjs": "^6.3.1",
"terser": "^4.6.11",
"tslib": "^1.11.1",
"tslint": "^6.1.1",
"typescript": "^3.8.3",
"url-parse": "^1.4.7",
"yargs-parser": "^18.1.2"
"yargs-parser": "^18.1.3"
},
"files": [
"dist/**/*.js",
Expand Down
17 changes: 14 additions & 3 deletions rollup.config.js
Expand Up @@ -14,7 +14,7 @@ import esmDynamicImport from './build-plugins/esm-dynamic-import.js';
import getLicenseHandler from './build-plugins/generate-license-file';
import pkg from './package.json';

const commitHash = (function() {
const commitHash = (function () {
try {
return fs.readFileSync('.commithash', 'utf-8');
} catch (err) {
Expand Down Expand Up @@ -77,7 +77,12 @@ export default command => {
'loadConfigFile.js': 'cli/run/loadConfigFile.ts'
},
onwarn,
plugins: [...nodePlugins, addCliEntry(), esmDynamicImport(), !command.configTest && collectLicenses()],
plugins: [
...nodePlugins,
addCliEntry(),
esmDynamicImport(),
!command.configTest && collectLicenses()
],
// fsevents is a dependency of chokidar that cannot be bundled as it contains binary code
external: [
'assert',
Expand Down Expand Up @@ -116,7 +121,13 @@ export default command => {
...commonJSBuild,
input: { 'rollup.js': 'src/node-entry.ts' },
plugins: [...nodePlugins, emitModulePackageFile(), collectLicenses()],
output: { ...commonJSBuild.output, dir: 'dist/es', format: 'es', sourcemap: false }
output: {
...commonJSBuild.output,
dir: 'dist/es',
format: 'es',
sourcemap: false,
minifyInternalExports: false
}
};

const browserBuilds = {
Expand Down
4 changes: 2 additions & 2 deletions test/form/samples/class-fields/_expected.js
@@ -1,6 +1,6 @@
class Example {
class Example extends SomeClass {
firstPublicField = 1;
secondPublicField = this.firstPublicField + 1;
secondPublicField = this.firstPublicField + super.someField;

#privateField = () => {
};
Expand Down
4 changes: 2 additions & 2 deletions test/form/samples/class-fields/main.js
@@ -1,6 +1,6 @@
class Example {
class Example extends SomeClass {
firstPublicField = 1;
secondPublicField = this.firstPublicField + 1;
secondPublicField = this.firstPublicField + super.someField;

#privateField = () => {
const foo = 'tree-shaken';
Expand Down
12 changes: 9 additions & 3 deletions test/form/samples/supports-core-js/_expected.js
Expand Up @@ -211,7 +211,7 @@ var shared = createCommonjsModule(function (module) {
(module.exports = function (key, value) {
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.6.4',
version: '3.6.5',
mode: 'global',
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
});
Expand Down Expand Up @@ -4975,7 +4975,13 @@ if (!set$1 || !clear) {
defer = functionBindContext(port.postMessage, port, 1);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && !fails(post)) {
} else if (
global_1.addEventListener &&
typeof postMessage == 'function' &&
!global_1.importScripts &&
!fails(post) &&
location.protocol !== 'file:'
) {
defer = post;
global_1.addEventListener('message', listener, false);
// IE8-
Expand Down Expand Up @@ -8345,7 +8351,7 @@ var INVALID_HOST = 'Invalid host';
var INVALID_PORT = 'Invalid port';

var ALPHA = /[A-Za-z]/;
var ALPHANUMERIC = /[\d+\-.A-Za-z]/;
var ALPHANUMERIC = /[\d+-.A-Za-z]/;
var DIGIT = /\d/;
var HEX_START = /^(0x|0X)/;
var OCT = /^[0-7]+$/;
Expand Down

0 comments on commit 0d352bf

Please sign in to comment.