Add transpile with babel if needed
Bastien Roucariès
5 years ago
|
0 |
node-rollup-plugin-commonjs (9.2.0-2) unstable; urgency=medium
|
|
1 |
|
|
2 |
* Team upload
|
|
3 |
* Fix parse error. Note that this patch should be reverted
|
|
4 |
with node-rollup (>= 0.56).
|
|
5 |
* Transpile with babel if needed
|
|
6 |
|
|
7 |
-- Bastien Roucariès <rouca@debian.org> Mon, 31 Dec 2018 00:06:06 +0100
|
|
8 |
|
0 | 9 |
node-rollup-plugin-commonjs (9.2.0-1) unstable; urgency=medium
|
1 | 10 |
|
2 | 11 |
* New upstream release.
|
45 | 45 |
} catch (err) {
|
46 | 46 |
err.message += ` in ${id}`;
|
47 | 47 |
throw err;
|
|
48 |
Index: node-rollup-plugin-commonjs/package.json
|
|
49 |
===================================================================
|
|
50 |
--- node-rollup-plugin-commonjs.orig/package.json
|
|
51 |
+++ node-rollup-plugin-commonjs/package.json
|
|
52 |
@@ -27,7 +27,8 @@
|
|
53 |
"estree-walker": "^0.5.2",
|
|
54 |
"magic-string": "^0.25.1",
|
|
55 |
"resolve": "^1.8.1",
|
|
56 |
- "rollup-pluginutils": "^2.3.3"
|
|
57 |
+ "rollup-pluginutils": "^2.3.3",
|
|
58 |
+ "acorn" : ">5"
|
|
59 |
},
|
|
60 |
"devDependencies": {
|
|
61 |
"acorn": "^6.0.2",
|
|
0 |
Index: node-rollup-plugin-commonjs/rollup.config.js
|
|
1 |
===================================================================
|
|
2 |
--- node-rollup-plugin-commonjs.orig/rollup.config.js
|
|
3 |
+++ node-rollup-plugin-commonjs/rollup.config.js
|
|
4 |
@@ -1,13 +1,37 @@
|
|
5 |
-import buble from 'rollup-plugin-buble';
|
|
6 |
import pkg from './package.json';
|
|
7 |
|
|
8 |
+var plugins = [];
|
|
9 |
+
|
|
10 |
+switch(process.env.TRANSPILE) {
|
|
11 |
+case 'babel6':
|
|
12 |
+ var babel=require('rollup-plugin-babel');
|
|
13 |
+ const plugins_babel6 = [
|
|
14 |
+ babel({
|
|
15 |
+ babelrc: false,
|
|
16 |
+ presets: [[process.env.BABEL_PRESET, { modules: false }]],
|
|
17 |
+ }),
|
|
18 |
+ ];
|
|
19 |
+ plugins = plugins_babel6; break;
|
|
20 |
+case 'babel7':
|
|
21 |
+ var babel=require('rollup-plugin-babel');
|
|
22 |
+ const plugins_babel7 = [
|
|
23 |
+ babel(),
|
|
24 |
+ ];
|
|
25 |
+ plugins = plugins_babel7; break;
|
|
26 |
+case 'none':
|
|
27 |
+ plugins = []; break;
|
|
28 |
+default:
|
|
29 |
+ var buble=require('rollup-plugin-buble');
|
|
30 |
+ const plugins_buble = [
|
|
31 |
+ buble({transforms: {dangerousForOf: true}})
|
|
32 |
+ ];
|
|
33 |
+ plugins = plugins_buble;
|
|
34 |
+}
|
|
35 |
+
|
|
36 |
+
|
|
37 |
export default {
|
|
38 |
input: 'src/index.js',
|
|
39 |
- plugins: [
|
|
40 |
- buble({
|
|
41 |
- transforms: { dangerousForOf: true }
|
|
42 |
- })
|
|
43 |
- ],
|
|
44 |
+ plugins: plugins,
|
|
45 |
external: Object.keys( pkg.dependencies ).concat([ 'fs', 'path' ]),
|
|
46 |
output: [
|
|
47 |
{
|
|
0 |
0001-remove-parse.patch
|
|
1 |
0002-use-babel-if-needed.patch
|
26 | 26 |
"estree-walker": "^0.5.2",
|
27 | 27 |
"magic-string": "^0.25.1",
|
28 | 28 |
"resolve": "^1.8.1",
|
29 | |
"rollup-pluginutils": "^2.3.3"
|
|
29 |
"rollup-pluginutils": "^2.3.3",
|
|
30 |
"acorn" : ">5"
|
30 | 31 |
},
|
31 | 32 |
"devDependencies": {
|
32 | 33 |
"acorn": "^6.0.2",
|
0 | |
import buble from 'rollup-plugin-buble';
|
1 | 0 |
import pkg from './package.json';
|
|
1 |
|
|
2 |
var plugins = [];
|
|
3 |
|
|
4 |
switch(process.env.TRANSPILE) {
|
|
5 |
case 'babel6':
|
|
6 |
var babel=require('rollup-plugin-babel');
|
|
7 |
const plugins_babel6 = [
|
|
8 |
babel({
|
|
9 |
babelrc: false,
|
|
10 |
presets: [[process.env.BABEL_PRESET, { modules: false }]],
|
|
11 |
}),
|
|
12 |
];
|
|
13 |
plugins = plugins_babel6; break;
|
|
14 |
case 'babel7':
|
|
15 |
var babel=require('rollup-plugin-babel');
|
|
16 |
const plugins_babel7 = [
|
|
17 |
babel(),
|
|
18 |
];
|
|
19 |
plugins = plugins_babel7; break;
|
|
20 |
case 'none':
|
|
21 |
plugins = []; break;
|
|
22 |
default:
|
|
23 |
var buble=require('rollup-plugin-buble');
|
|
24 |
const plugins_buble = [
|
|
25 |
buble({transforms: {dangerousForOf: true}})
|
|
26 |
];
|
|
27 |
plugins = plugins_buble;
|
|
28 |
}
|
|
29 |
|
2 | 30 |
|
3 | 31 |
export default {
|
4 | 32 |
input: 'src/index.js',
|
5 | |
plugins: [
|
6 | |
buble({
|
7 | |
transforms: { dangerousForOf: true }
|
8 | |
})
|
9 | |
],
|
|
33 |
plugins: plugins,
|
10 | 34 |
external: Object.keys( pkg.dependencies ).concat([ 'fs', 'path' ]),
|
11 | 35 |
output: [
|
12 | 36 |
{
|
100 | 100 |
|
101 | 101 |
const transformPromise = entryModuleIdsPromise
|
102 | 102 |
.then(entryModuleIds => {
|
103 | |
const { isEsModule, hasDefaultExport, ast } = checkEsModule(this.parse, code, id);
|
|
103 |
const { isEsModule, hasDefaultExport, ast } = checkEsModule(this, code, id);
|
104 | 104 |
if (isEsModule) {
|
105 | 105 |
(hasDefaultExport ? esModulesWithDefaultExport : esModulesWithoutDefaultExport)[id] = true;
|
106 | 106 |
return null;
|
|
113 | 113 |
}
|
114 | 114 |
|
115 | 115 |
const transformed = transformCommonjs(
|
116 | |
this.parse,
|
|
116 |
this,
|
117 | 117 |
code,
|
118 | 118 |
id,
|
119 | 119 |
entryModuleIds.indexOf(id) !== -1,
|
|
0 |
import acorn from 'acorn';
|
0 | 1 |
import { walk } from 'estree-walker';
|
1 | 2 |
import MagicString from 'magic-string';
|
2 | 3 |
import { attachScopes, makeLegalIdentifier } from 'rollup-pluginutils';
|
|
30 | 31 |
|
31 | 32 |
function tryParse(parse, code, id) {
|
32 | 33 |
try {
|
33 | |
return parse(code, { allowReturnOutsideFunction: true });
|
|
34 |
return acorn.parse(code, { allowReturnOutsideFunction: true });
|
34 | 35 |
} catch (err) {
|
35 | 36 |
err.message += ` in ${id}`;
|
36 | 37 |
throw err;
|