File: transpile-configurable.patch

package info (click to toggle)
node-rollup-plugin-replace 2.3.4%2Brepack%2B~2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,820 kB
  • sloc: javascript: 12,560; makefile: 23
file content (95 lines) | stat: -rw-r--r-- 2,216 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Description: Transpile configurable
Author: Bastien Roucariès
Forwarded: not-needed
Reviewed-By: Xavier Guimard <yadd@debian.org>
Last-Update: 2020-09-21

--- a/legacy/rollup.config.js
+++ b/legacy/rollup.config.js
@@ -1,11 +1,40 @@
-import buble from 'rollup-plugin-buble';
 import pkg from './package.json';
 
 var external = Object.keys(pkg.dependencies).concat('path');
 
+
+var plugins = [];
+
+switch(process.env.TRANSPILE) {
+case 'babel6':
+    var babel=require('rollup-plugin-babel');
+    const plugins_babel6 = [
+      babel({
+	babelrc: false,
+	presets: [[process.env.BABEL_PRESET, { modules: false }]],
+    }),
+    ];
+    plugins = plugins_babel6; break;
+case 'babel7':
+    var babel=require('rollup-plugin-babel');
+    const plugins_babel7 = [
+      babel(),
+    ];
+    plugins = plugins_babel7; break;
+case 'none':
+    plugins = []; break;
+default:
+    var buble=require('rollup-plugin-buble');
+    const plugins_buble = [
+    buble()
+    ];
+    plugins = plugins_buble;
+}
+
+
 export default {
 	input: 'src/index.js',
-	plugins: [ buble() ],
+	plugins: plugins,
 	external,
 	output: [
 		{ file: pkg.main, format: 'cjs' },
--- a/packages/replace/rollup.config.js
+++ b/packages/replace/rollup.config.js
@@ -1,12 +1,38 @@
-import buble from '@rollup/plugin-buble';
-
 import pkg from './package.json';
 
 const external = Object.keys(pkg.dependencies).concat('path');
 
+var plugins = [];
+
+switch(process.env.TRANSPILE) {
+case 'babel6':
+    var babel=require('@rollup/plugin-babel');
+    const plugins_babel6 = [
+      babel({
+	babelrc: false,
+	presets: [[process.env.BABEL_PRESET, { modules: false }]],
+    }),
+    ];
+    plugins = plugins_babel6; break;
+case 'babel7':
+    var babel=require('@rollup/plugin-babel');
+    const plugins_babel7 = [
+      babel(),
+    ];
+    plugins = plugins_babel7; break;
+case 'none':
+    plugins = []; break;
+default:
+    var buble=require('@rollup/plugin-buble');
+    const plugins_buble = [
+    buble()
+    ];
+    plugins = plugins_buble;
+}
+
 export default {
   input: 'src/index.js',
-  plugins: [buble()],
+  plugins: plugins,
   external,
   output: [
     { file: pkg.main, format: 'cjs', exports: 'auto' },