Codebase list node-rollup-plugin-commonjs / 641ae07
Add transpile with babel if needed Bastien Roucariès 5 years ago
8 changed file(s) with 109 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
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
09 node-rollup-plugin-commonjs (9.2.0-1) unstable; urgency=medium
110
211 * New upstream release.
4545 } catch (err) {
4646 err.message += ` in ${id}`;
4747 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
2626 "estree-walker": "^0.5.2",
2727 "magic-string": "^0.25.1",
2828 "resolve": "^1.8.1",
29 "rollup-pluginutils": "^2.3.3"
29 "rollup-pluginutils": "^2.3.3",
30 "acorn" : ">5"
3031 },
3132 "devDependencies": {
3233 "acorn": "^6.0.2",
0 import buble from 'rollup-plugin-buble';
10 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
230
331 export default {
432 input: 'src/index.js',
5 plugins: [
6 buble({
7 transforms: { dangerousForOf: true }
8 })
9 ],
33 plugins: plugins,
1034 external: Object.keys( pkg.dependencies ).concat([ 'fs', 'path' ]),
1135 output: [
1236 {
100100
101101 const transformPromise = entryModuleIdsPromise
102102 .then(entryModuleIds => {
103 const { isEsModule, hasDefaultExport, ast } = checkEsModule(this.parse, code, id);
103 const { isEsModule, hasDefaultExport, ast } = checkEsModule(this, code, id);
104104 if (isEsModule) {
105105 (hasDefaultExport ? esModulesWithDefaultExport : esModulesWithoutDefaultExport)[id] = true;
106106 return null;
113113 }
114114
115115 const transformed = transformCommonjs(
116 this.parse,
116 this,
117117 code,
118118 id,
119119 entryModuleIds.indexOf(id) !== -1,
0 import acorn from 'acorn';
01 import { walk } from 'estree-walker';
12 import MagicString from 'magic-string';
23 import { attachScopes, makeLegalIdentifier } from 'rollup-pluginutils';
3031
3132 function tryParse(parse, code, id) {
3233 try {
33 return parse(code, { allowReturnOutsideFunction: true });
34 return acorn.parse(code, { allowReturnOutsideFunction: true });
3435 } catch (err) {
3536 err.message += ` in ${id}`;
3637 throw err;