|
0 |
Subject: remove parse and use acorn
|
|
1 |
author: Bastien Roucariès <rouca@debian.org>
|
|
2 |
|
|
3 |
This is a work arround that should be removed when rollup 0.56 hit unstable
|
|
4 |
|
|
5 |
Forwarded: not-needed
|
|
6 |
from: https://github.com/rollup/rollup-plugin-commonjs/commit/4131fb324043855f90009bd5f2cfe1c8a576a127.patch
|
|
7 |
|
|
8 |
Index: node-rollup-plugin-commonjs/src/index.js
|
|
9 |
===================================================================
|
|
10 |
--- node-rollup-plugin-commonjs.orig/src/index.js
|
|
11 |
+++ node-rollup-plugin-commonjs/src/index.js
|
|
12 |
@@ -101,7 +101,7 @@ export default function commonjs(options
|
|
13 |
|
|
14 |
const transformPromise = entryModuleIdsPromise
|
|
15 |
.then(entryModuleIds => {
|
|
16 |
- const { isEsModule, hasDefaultExport, ast } = checkEsModule(this.parse, code, id);
|
|
17 |
+ const { isEsModule, hasDefaultExport, ast } = checkEsModule(this, code, id);
|
|
18 |
if (isEsModule) {
|
|
19 |
(hasDefaultExport ? esModulesWithDefaultExport : esModulesWithoutDefaultExport)[id] = true;
|
|
20 |
return null;
|
|
21 |
@@ -114,7 +114,7 @@ export default function commonjs(options
|
|
22 |
}
|
|
23 |
|
|
24 |
const transformed = transformCommonjs(
|
|
25 |
- this.parse,
|
|
26 |
+ this,
|
|
27 |
code,
|
|
28 |
id,
|
|
29 |
entryModuleIds.indexOf(id) !== -1,
|
|
30 |
Index: node-rollup-plugin-commonjs/src/transform.js
|
|
31 |
===================================================================
|
|
32 |
--- node-rollup-plugin-commonjs.orig/src/transform.js
|
|
33 |
+++ node-rollup-plugin-commonjs/src/transform.js
|
|
34 |
@@ -1,3 +1,4 @@
|
|
35 |
+import acorn from 'acorn';
|
|
36 |
import { walk } from 'estree-walker';
|
|
37 |
import MagicString from 'magic-string';
|
|
38 |
import { attachScopes, makeLegalIdentifier } from 'rollup-pluginutils';
|
|
39 |
@@ -31,7 +32,7 @@ function deconflict(scope, globals, iden
|
|
40 |
|
|
41 |
function tryParse(parse, code, id) {
|
|
42 |
try {
|
|
43 |
- return parse(code, { allowReturnOutsideFunction: true });
|
|
44 |
+ return acorn.parse(code, { allowReturnOutsideFunction: true });
|
|
45 |
} catch (err) {
|
|
46 |
err.message += ` in ${id}`;
|
|
47 |
throw err;
|