bundlebee 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,88 +0,0 @@
1
- import globToRegExp from 'glob-to-regexp';
2
-
3
- var babelHelpers = {};
4
-
5
- babelHelpers.classCallCheck = function (instance, Constructor) {
6
- if (!(instance instanceof Constructor)) {
7
- throw new TypeError("Cannot call a class as a function");
8
- }
9
- };
10
-
11
- babelHelpers;
12
-
13
- var writeConfig = function () {
14
- var loaders = this.entry.files.map(function (file) {
15
- return '{\n test: ' + globToRegExp(file.files).toString() + ',\n loader: "' + file.transform + '"\n }';
16
- });
17
-
18
- return 'module.exports = {\n ' + (this.entry.header ? JSON.stringify(this.entry.header) + ', ' : '') + '\n\n entry: "' + this.entry.entryFile + '",\n loaders: [' + loaders.join(', \n') + ']\n\n ' + (this.entry.footer ? ',\n' + JSON.stringify(this.entry.footer) : '') + '\n };';
19
- };
20
-
21
- var WebpackBundle = function () {
22
- function WebpackBundle(entry) {
23
- babelHelpers.classCallCheck(this, WebpackBundle);
24
-
25
- this.entry = entry;
26
- }
27
-
28
- WebpackBundle.prototype.generateConfig = function generateConfig() {
29
- return writeConfig.call(this);
30
- };
31
-
32
- return WebpackBundle;
33
- }();
34
-
35
- var bundle = {
36
- webpack: WebpackBundle
37
- };
38
-
39
- var Entry = function () {
40
- function Entry(entryFile) {
41
- babelHelpers.classCallCheck(this, Entry);
42
-
43
- this.entryFile = entryFile;
44
-
45
- this.header = '';
46
- this.footer = '';
47
- this.files = [];
48
- }
49
-
50
- Entry.prototype.header = function header(_header) {
51
- this.header = _header;
52
- };
53
-
54
- Entry.prototype.footer = function footer(_footer) {
55
- this.footer = _footer;
56
- };
57
-
58
- Entry.prototype.includes = function includes(files, transform) {
59
- this.files.push({
60
- files: files,
61
- transform: transform
62
- });
63
-
64
- return this;
65
- };
66
-
67
- return Entry;
68
- }();
69
-
70
- var entryFn = function (entryFile) {
71
- return new Entry(entryFile);
72
- };
73
-
74
- function bundlebee(descriptor) {
75
- var entry = descriptor.call(null, entryFn);
76
-
77
- return new Promise(function (resolve, reject) {
78
- resolve(function (config) {
79
- if (!Object.hasOwnProperty.call(bundle, config)) {
80
- throw new Error('Configuration ' + config + ' is not available');
81
- }
82
-
83
- return new bundle[config](entry);
84
- });
85
- });
86
- };
87
-
88
- export default bundlebee;
package/dist/bundlebee.js DELETED
@@ -1,91 +0,0 @@
1
- 'use strict';
2
-
3
- var globToRegExp = require('glob-to-regexp');
4
- globToRegExp = 'default' in globToRegExp ? globToRegExp['default'] : globToRegExp;
5
-
6
- var babelHelpers = {};
7
-
8
- babelHelpers.classCallCheck = function (instance, Constructor) {
9
- if (!(instance instanceof Constructor)) {
10
- throw new TypeError("Cannot call a class as a function");
11
- }
12
- };
13
-
14
- babelHelpers;
15
-
16
- var writeConfig = function () {
17
- var loaders = this.entry.files.map(function (file) {
18
- return '{\n test: ' + globToRegExp(file.files).toString() + ',\n loader: "' + file.transform + '"\n }';
19
- });
20
-
21
- return 'module.exports = {\n ' + (this.entry.header ? JSON.stringify(this.entry.header) + ', ' : '') + '\n\n entry: "' + this.entry.entryFile + '",\n loaders: [' + loaders.join(', \n') + ']\n\n ' + (this.entry.footer ? ',\n' + JSON.stringify(this.entry.footer) : '') + '\n };';
22
- };
23
-
24
- var WebpackBundle = function () {
25
- function WebpackBundle(entry) {
26
- babelHelpers.classCallCheck(this, WebpackBundle);
27
-
28
- this.entry = entry;
29
- }
30
-
31
- WebpackBundle.prototype.generateConfig = function generateConfig() {
32
- return writeConfig.call(this);
33
- };
34
-
35
- return WebpackBundle;
36
- }();
37
-
38
- var bundle = {
39
- webpack: WebpackBundle
40
- };
41
-
42
- var Entry = function () {
43
- function Entry(entryFile) {
44
- babelHelpers.classCallCheck(this, Entry);
45
-
46
- this.entryFile = entryFile;
47
-
48
- this.header = '';
49
- this.footer = '';
50
- this.files = [];
51
- }
52
-
53
- Entry.prototype.header = function header(_header) {
54
- this.header = _header;
55
- };
56
-
57
- Entry.prototype.footer = function footer(_footer) {
58
- this.footer = _footer;
59
- };
60
-
61
- Entry.prototype.includes = function includes(files, transform) {
62
- this.files.push({
63
- files: files,
64
- transform: transform
65
- });
66
-
67
- return this;
68
- };
69
-
70
- return Entry;
71
- }();
72
-
73
- var entryFn = function (entryFile) {
74
- return new Entry(entryFile);
75
- };
76
-
77
- function bundlebee(descriptor) {
78
- var entry = descriptor.call(null, entryFn);
79
-
80
- return new Promise(function (resolve, reject) {
81
- resolve(function (config) {
82
- if (!Object.hasOwnProperty.call(bundle, config)) {
83
- throw new Error('Configuration ' + config + ' is not available');
84
- }
85
-
86
- return new bundle[config](entry);
87
- });
88
- });
89
- };
90
-
91
- module.exports = bundlebee;
@@ -1,96 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('glob-to-regexp')) :
3
- typeof define === 'function' && define.amd ? define(['glob-to-regexp'], factory) :
4
- (global.bundlebee = factory(global.globToRegExp));
5
- }(this, function (globToRegExp) { 'use strict';
6
-
7
- globToRegExp = 'default' in globToRegExp ? globToRegExp['default'] : globToRegExp;
8
-
9
- var babelHelpers = {};
10
-
11
- babelHelpers.classCallCheck = function (instance, Constructor) {
12
- if (!(instance instanceof Constructor)) {
13
- throw new TypeError("Cannot call a class as a function");
14
- }
15
- };
16
-
17
- babelHelpers;
18
-
19
- var writeConfig = function () {
20
- var loaders = this.entry.files.map(function (file) {
21
- return '{\n test: ' + globToRegExp(file.files).toString() + ',\n loader: "' + file.transform + '"\n }';
22
- });
23
-
24
- return 'module.exports = {\n ' + (this.entry.header ? JSON.stringify(this.entry.header) + ', ' : '') + '\n\n entry: "' + this.entry.entryFile + '",\n loaders: [' + loaders.join(', \n') + ']\n\n ' + (this.entry.footer ? ',\n' + JSON.stringify(this.entry.footer) : '') + '\n };';
25
- };
26
-
27
- var WebpackBundle = function () {
28
- function WebpackBundle(entry) {
29
- babelHelpers.classCallCheck(this, WebpackBundle);
30
-
31
- this.entry = entry;
32
- }
33
-
34
- WebpackBundle.prototype.generateConfig = function generateConfig() {
35
- return writeConfig.call(this);
36
- };
37
-
38
- return WebpackBundle;
39
- }();
40
-
41
- var bundle = {
42
- webpack: WebpackBundle
43
- };
44
-
45
- var Entry = function () {
46
- function Entry(entryFile) {
47
- babelHelpers.classCallCheck(this, Entry);
48
-
49
- this.entryFile = entryFile;
50
-
51
- this.header = '';
52
- this.footer = '';
53
- this.files = [];
54
- }
55
-
56
- Entry.prototype.header = function header(_header) {
57
- this.header = _header;
58
- };
59
-
60
- Entry.prototype.footer = function footer(_footer) {
61
- this.footer = _footer;
62
- };
63
-
64
- Entry.prototype.includes = function includes(files, transform) {
65
- this.files.push({
66
- files: files,
67
- transform: transform
68
- });
69
-
70
- return this;
71
- };
72
-
73
- return Entry;
74
- }();
75
-
76
- var entryFn = function (entryFile) {
77
- return new Entry(entryFile);
78
- };
79
-
80
- function bundlebee(descriptor) {
81
- var entry = descriptor.call(null, entryFn);
82
-
83
- return new Promise(function (resolve, reject) {
84
- resolve(function (config) {
85
- if (!Object.hasOwnProperty.call(bundle, config)) {
86
- throw new Error('Configuration ' + config + ' is not available');
87
- }
88
-
89
- return new bundle[config](entry);
90
- });
91
- });
92
- };
93
-
94
- return bundlebee;
95
-
96
- }));
package/src/Entry.js DELETED
@@ -1,28 +0,0 @@
1
- class Entry {
2
- constructor(entryFile) {
3
- this.entryFile = entryFile;
4
-
5
- this.header = '';
6
- this.footer = '';
7
- this.files = [];
8
- }
9
-
10
- header(header) {
11
- this.header = header;
12
- }
13
-
14
- footer(footer) {
15
- this.footer = footer;
16
- }
17
-
18
- includes(files, transform) {
19
- this.files.push({
20
- files,
21
- transform,
22
- });
23
-
24
- return this;
25
- }
26
- }
27
-
28
- export default Entry;
@@ -1,31 +0,0 @@
1
- import globToRegExp from 'glob-to-regexp';
2
-
3
- const writeConfig = function() {
4
- const loaders = this.entry.files.map(function(file) {
5
- return `{
6
- test: ${globToRegExp(file.files).toString()},
7
- loader: "${file.transform}"
8
- }`;
9
- });
10
-
11
- return `module.exports = {
12
- ${(this.entry.header) ? (JSON.stringify(this.entry.header) + ', ') : ''}
13
-
14
- entry: "${this.entry.entryFile}",
15
- loaders: [${loaders.join(', \n')}]
16
-
17
- ${(this.entry.footer) ? (',\n' + JSON.stringify(this.entry.footer)) : ''}
18
- };`;
19
- };
20
-
21
- class WebpackBundle {
22
- constructor(entry) {
23
- this.entry = entry;
24
- }
25
-
26
- generateConfig() {
27
- return writeConfig.call(this);
28
- }
29
- }
30
-
31
- export default WebpackBundle;
@@ -1,5 +0,0 @@
1
- import WebpackBundle from './WebpackBundle';
2
-
3
- export default {
4
- webpack: WebpackBundle,
5
- };
package/src/index.js DELETED
@@ -1,20 +0,0 @@
1
- import bundle from './bundle/index';
2
- import Entry from './Entry';
3
-
4
- const entryFn = function(entryFile) {
5
- return new Entry(entryFile);
6
- };
7
-
8
- export default function bundlebee(descriptor) {
9
- const entry = descriptor.call(null, entryFn);
10
-
11
- return new Promise(function(resolve, reject) {
12
- resolve(function(config) {
13
- if (!Object.hasOwnProperty.call(bundle, config)) {
14
- throw new Error(`Configuration ${config} is not available`);
15
- }
16
-
17
- return new (bundle[config])(entry);
18
- });
19
- });
20
- };