@videinfra/static-website-builder 1.10.1 → 1.11.1
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.
- package/CHANGELOG.md +8 -0
- package/init/index.js +56 -56
- package/init/test/config/config.js +36 -36
- package/init/test/src/stylesheets/autoprefixer-test.scss +3 -3
- package/init/test/src/stylesheets/ignore-test.scss +4 -4
- package/init/test/src/stylesheets/nested-calc-test.scss +3 -3
- package/init/test/src/stylesheets/sub-folder/import-test.scss +2 -2
- package/lib/camelize-file-name.js +21 -21
- package/lib/get-config.js +157 -157
- package/lib/get-file-names.js +23 -23
- package/lib/get-path.js +109 -109
- package/lib/globs-helper.js +136 -136
- package/lib/log-error.js +15 -15
- package/lib/merge.js +27 -27
- package/package.json +5 -2
- package/plugins/sass-engine/preprocess-config.js +54 -54
- package/plugins/sass.js +38 -38
- package/plugins/twig-engine/preprocess-config.js +47 -47
- package/plugins/twig.js +65 -65
- package/tasks/data/data-loader-js.js +5 -5
- package/tasks/data/get-data.js +87 -87
- package/tasks/html/task.js +91 -91
- package/tasks/icons/config.js +52 -52
- package/tasks/javascripts/preprocess-config.js +21 -5
- package/tasks/javascripts/task.js +1 -1
- package/tasks/stylesheets/config.js +88 -88
- package/tasks/stylesheets/preprocess-config.js +41 -41
- package/tasks/stylesheets/task.js +69 -69
- package/tests/build/build.test.js +101 -101
- package/tests/camelize-file-name.test.js +11 -11
- package/tests/glob-helper.test.js +99 -99
- package/vendor/gulp-twig/LICENSE +20 -20
- package/vendor/gulp-twig/README.md +167 -167
- package/vendor/gulp-twig/index.js +130 -130
- package/vendor/gulp-twig/package.json +43 -43
- package/vendor/webpack-stream/index.js +261 -0
- package/vendor/webpack-stream/package.json +91 -0
- package/vendor/webpack-stream/readme.md +239 -0
package/lib/get-path.js
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const memoize = require('nano-memoize');
|
|
3
|
-
const getConfig = require('./get-config');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Returns builder and project specific path configurations merged
|
|
8
|
-
*
|
|
9
|
-
* @returns {object} Configuration
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const getPathConfig = memoize(function () {
|
|
13
|
-
return getConfig.getConfig().paths;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Returns a path relative to the project folder
|
|
18
|
-
*
|
|
19
|
-
* @param {...any} paths List of paths
|
|
20
|
-
* @returns {string} Path
|
|
21
|
-
*/
|
|
22
|
-
function getProjectPath (...paths) {
|
|
23
|
-
return path.resolve(process.env.INIT_CWD || process.cwd(), ...paths);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns a path relative to the builder folder
|
|
28
|
-
*
|
|
29
|
-
* @param {...any} paths List of paths
|
|
30
|
-
* @returns {string} Path
|
|
31
|
-
*/
|
|
32
|
-
function getBuilderPath (...paths) {
|
|
33
|
-
return path.resolve(__dirname, '../', ...paths);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Returns task source path or paths
|
|
38
|
-
*
|
|
39
|
-
* @param {string} name Task name
|
|
40
|
-
* @param {...string} paths Additional sub paths
|
|
41
|
-
* @returns {string|array} Task source path or list of paths
|
|
42
|
-
*/
|
|
43
|
-
function getSourcePath (name, ...paths) {
|
|
44
|
-
const pathConfig = getPathConfig();
|
|
45
|
-
const path = pathConfig[name].src;
|
|
46
|
-
|
|
47
|
-
if (typeof path === 'string') {
|
|
48
|
-
return getProjectPath(pathConfig.src, path, ...paths);
|
|
49
|
-
} else if (Array.isArray(path)) {
|
|
50
|
-
return path.map((path) => getProjectPath(pathConfig.src, path, ...paths));
|
|
51
|
-
} else {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns task source paths
|
|
58
|
-
*
|
|
59
|
-
* @param {string} name Task name
|
|
60
|
-
* @param {...string} paths Additional sub paths
|
|
61
|
-
* @returns {array} Task source paths
|
|
62
|
-
*/
|
|
63
|
-
function getSourcePaths (name, ...paths) {
|
|
64
|
-
const path = getSourcePath(name, ...paths);
|
|
65
|
-
|
|
66
|
-
if (typeof path === 'string') {
|
|
67
|
-
return [path];
|
|
68
|
-
} else {
|
|
69
|
-
return path;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Returns task destination path
|
|
75
|
-
*
|
|
76
|
-
* @param {string} [name] Task name
|
|
77
|
-
* @param {...string} paths Additional sub paths
|
|
78
|
-
* @returns {string} Task destination path
|
|
79
|
-
*/
|
|
80
|
-
function getDestPath (name, ...paths) {
|
|
81
|
-
const pathConfig = getPathConfig();
|
|
82
|
-
|
|
83
|
-
if (name) {
|
|
84
|
-
return getProjectPath(pathConfig.dest, pathConfig[name].dest || '', ...paths);
|
|
85
|
-
} else {
|
|
86
|
-
return getProjectPath(pathConfig.dest);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Returns public path
|
|
92
|
-
*
|
|
93
|
-
* @param {string} [name] Task name
|
|
94
|
-
* @returns {string} Task public path
|
|
95
|
-
*/
|
|
96
|
-
function getPublicPath (name) {
|
|
97
|
-
const destFullPath = getDestPath(name);
|
|
98
|
-
const destPath = getDestPath();
|
|
99
|
-
return destFullPath.replace(destPath, '') + '/';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
exports.getPathConfig = getPathConfig;
|
|
104
|
-
exports.getSourcePath = getSourcePath;
|
|
105
|
-
exports.getSourcePaths = getSourcePaths;
|
|
106
|
-
exports.getDestPath = getDestPath;
|
|
107
|
-
exports.getProjectPath = getProjectPath;
|
|
108
|
-
exports.getBuilderPath = getBuilderPath;
|
|
109
|
-
exports.getPublicPath = getPublicPath;
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const memoize = require('nano-memoize');
|
|
3
|
+
const getConfig = require('./get-config');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns builder and project specific path configurations merged
|
|
8
|
+
*
|
|
9
|
+
* @returns {object} Configuration
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const getPathConfig = memoize(function () {
|
|
13
|
+
return getConfig.getConfig().paths;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns a path relative to the project folder
|
|
18
|
+
*
|
|
19
|
+
* @param {...any} paths List of paths
|
|
20
|
+
* @returns {string} Path
|
|
21
|
+
*/
|
|
22
|
+
function getProjectPath (...paths) {
|
|
23
|
+
return path.resolve(process.env.INIT_CWD || process.cwd(), ...paths);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns a path relative to the builder folder
|
|
28
|
+
*
|
|
29
|
+
* @param {...any} paths List of paths
|
|
30
|
+
* @returns {string} Path
|
|
31
|
+
*/
|
|
32
|
+
function getBuilderPath (...paths) {
|
|
33
|
+
return path.resolve(__dirname, '../', ...paths);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns task source path or paths
|
|
38
|
+
*
|
|
39
|
+
* @param {string} name Task name
|
|
40
|
+
* @param {...string} paths Additional sub paths
|
|
41
|
+
* @returns {string|array} Task source path or list of paths
|
|
42
|
+
*/
|
|
43
|
+
function getSourcePath (name, ...paths) {
|
|
44
|
+
const pathConfig = getPathConfig();
|
|
45
|
+
const path = pathConfig[name].src;
|
|
46
|
+
|
|
47
|
+
if (typeof path === 'string') {
|
|
48
|
+
return getProjectPath(pathConfig.src, path, ...paths);
|
|
49
|
+
} else if (Array.isArray(path)) {
|
|
50
|
+
return path.map((path) => getProjectPath(pathConfig.src, path, ...paths));
|
|
51
|
+
} else {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns task source paths
|
|
58
|
+
*
|
|
59
|
+
* @param {string} name Task name
|
|
60
|
+
* @param {...string} paths Additional sub paths
|
|
61
|
+
* @returns {array} Task source paths
|
|
62
|
+
*/
|
|
63
|
+
function getSourcePaths (name, ...paths) {
|
|
64
|
+
const path = getSourcePath(name, ...paths);
|
|
65
|
+
|
|
66
|
+
if (typeof path === 'string') {
|
|
67
|
+
return [path];
|
|
68
|
+
} else {
|
|
69
|
+
return path;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns task destination path
|
|
75
|
+
*
|
|
76
|
+
* @param {string} [name] Task name
|
|
77
|
+
* @param {...string} paths Additional sub paths
|
|
78
|
+
* @returns {string} Task destination path
|
|
79
|
+
*/
|
|
80
|
+
function getDestPath (name, ...paths) {
|
|
81
|
+
const pathConfig = getPathConfig();
|
|
82
|
+
|
|
83
|
+
if (name) {
|
|
84
|
+
return getProjectPath(pathConfig.dest, pathConfig[name].dest || '', ...paths);
|
|
85
|
+
} else {
|
|
86
|
+
return getProjectPath(pathConfig.dest);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Returns public path
|
|
92
|
+
*
|
|
93
|
+
* @param {string} [name] Task name
|
|
94
|
+
* @returns {string} Task public path
|
|
95
|
+
*/
|
|
96
|
+
function getPublicPath (name) {
|
|
97
|
+
const destFullPath = getDestPath(name);
|
|
98
|
+
const destPath = getDestPath();
|
|
99
|
+
return destFullPath.replace(destPath, '') + '/';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
exports.getPathConfig = getPathConfig;
|
|
104
|
+
exports.getSourcePath = getSourcePath;
|
|
105
|
+
exports.getSourcePaths = getSourcePaths;
|
|
106
|
+
exports.getDestPath = getDestPath;
|
|
107
|
+
exports.getProjectPath = getProjectPath;
|
|
108
|
+
exports.getBuilderPath = getBuilderPath;
|
|
109
|
+
exports.getPublicPath = getPublicPath;
|
package/lib/globs-helper.js
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const flatten = require('lodash/flatten');
|
|
3
|
-
const map = require('lodash/map');
|
|
4
|
-
const filter = require('lodash/filter');
|
|
5
|
-
|
|
6
|
-
const REGEX_DOT_PREFIX = /^\.+/;
|
|
7
|
-
const REGEX_WINDOWS_BACKSLASH = /\\/g;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class GlobObject {
|
|
11
|
-
constructor () {
|
|
12
|
-
this.hadEmptyPaths = false;
|
|
13
|
-
this.isIgnore = false;
|
|
14
|
-
this.hasExtensions = false;
|
|
15
|
-
this.pathsArr = [];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
paths (paths) {
|
|
19
|
-
const pathsArr = Array.isArray(paths) ? paths : (typeof paths === 'string' ? [paths] : []);
|
|
20
|
-
|
|
21
|
-
if (pathsArr.length) {
|
|
22
|
-
if (this.pathsArr.length) {
|
|
23
|
-
this.map((basePath) => {
|
|
24
|
-
return pathsArr.map((subPath) => {
|
|
25
|
-
// If subpath starts with specia character "!" then prepend that to the begining of full paths
|
|
26
|
-
const negativePath = subPath[0] === '!' ? '!' : '';
|
|
27
|
-
const subPathNormalized = negativePath ? subPath.substr(1) : subPath;
|
|
28
|
-
return negativePath + path.join(basePath, subPathNormalized);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
this.pathsArr = pathsArr;
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
this.hadEmptyPaths = true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Adds extensions to the paths
|
|
43
|
-
*
|
|
44
|
-
* @param {string|array} extensions An extension or list of extensions
|
|
45
|
-
* @returns {object} GlobObject
|
|
46
|
-
*/
|
|
47
|
-
filesWithExtensions (extensions) {
|
|
48
|
-
const extensionsArr = typeof extensions === 'string' ? [extensions] : extensions;
|
|
49
|
-
|
|
50
|
-
if (extensionsArr && extensionsArr.length) {
|
|
51
|
-
let extensionString = '';
|
|
52
|
-
|
|
53
|
-
// Remove dot from the extension name
|
|
54
|
-
let extensionsArrNormalized = map(extensionsArr, (extension) => extension.replace(REGEX_DOT_PREFIX, ''));
|
|
55
|
-
|
|
56
|
-
if (extensionsArrNormalized.length > 1) {
|
|
57
|
-
extensionString = `/**/*.{${ extensionsArrNormalized.join(',') }}`;
|
|
58
|
-
} else {
|
|
59
|
-
extensionString = `/**/*.${ extensionsArrNormalized }`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
this.hasExtensions = true;
|
|
63
|
-
return this.map((path) => `${ path }${ extensionString }`);
|
|
64
|
-
} else {
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Add a wildcard to select all files
|
|
71
|
-
*
|
|
72
|
-
* @returns {object} GlobObject
|
|
73
|
-
*/
|
|
74
|
-
allFiles () {
|
|
75
|
-
return this.map((path) => `${ path }/**`);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Adds all paths to the ignore list
|
|
80
|
-
*
|
|
81
|
-
* @returns {object} GlobObject
|
|
82
|
-
*/
|
|
83
|
-
ignore () {
|
|
84
|
-
this.isIgnore = true;
|
|
85
|
-
return this.map((path) => `!${ path }`);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Itterates through all paths
|
|
90
|
-
*
|
|
91
|
-
* @param {function} fn Itteratee function
|
|
92
|
-
* @returns {object} GlobObject
|
|
93
|
-
*/
|
|
94
|
-
map (fn) {
|
|
95
|
-
this.pathsArr = filter(flatten(map(this.pathsArr, fn)), (path) => !!path);
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Converts paths to an array of normalized glob paths
|
|
101
|
-
*
|
|
102
|
-
* @returns {array} Array of glob paths
|
|
103
|
-
*/
|
|
104
|
-
toArray () {
|
|
105
|
-
if (this.hadEmptyPaths && this.isIgnore) {
|
|
106
|
-
// Since we exclude files / paths, don't return anything if path list was empty
|
|
107
|
-
return [];
|
|
108
|
-
} else {
|
|
109
|
-
return map(this.pathsArr, (path) => {
|
|
110
|
-
return path.replace(REGEX_WINDOWS_BACKSLASH, '/');
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Alias for toArray
|
|
117
|
-
*
|
|
118
|
-
* @returns {array} Array of glob paths
|
|
119
|
-
*/
|
|
120
|
-
generate () {
|
|
121
|
-
return this.toArray();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function paths (paths) {
|
|
126
|
-
return (new GlobObject()).paths(paths);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function generate (...globs) {
|
|
130
|
-
return flatten(map(flatten(globs), (glob) => glob.toArray()));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
module.exports = {
|
|
134
|
-
generate,
|
|
135
|
-
paths,
|
|
136
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const flatten = require('lodash/flatten');
|
|
3
|
+
const map = require('lodash/map');
|
|
4
|
+
const filter = require('lodash/filter');
|
|
5
|
+
|
|
6
|
+
const REGEX_DOT_PREFIX = /^\.+/;
|
|
7
|
+
const REGEX_WINDOWS_BACKSLASH = /\\/g;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GlobObject {
|
|
11
|
+
constructor () {
|
|
12
|
+
this.hadEmptyPaths = false;
|
|
13
|
+
this.isIgnore = false;
|
|
14
|
+
this.hasExtensions = false;
|
|
15
|
+
this.pathsArr = [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
paths (paths) {
|
|
19
|
+
const pathsArr = Array.isArray(paths) ? paths : (typeof paths === 'string' ? [paths] : []);
|
|
20
|
+
|
|
21
|
+
if (pathsArr.length) {
|
|
22
|
+
if (this.pathsArr.length) {
|
|
23
|
+
this.map((basePath) => {
|
|
24
|
+
return pathsArr.map((subPath) => {
|
|
25
|
+
// If subpath starts with specia character "!" then prepend that to the begining of full paths
|
|
26
|
+
const negativePath = subPath[0] === '!' ? '!' : '';
|
|
27
|
+
const subPathNormalized = negativePath ? subPath.substr(1) : subPath;
|
|
28
|
+
return negativePath + path.join(basePath, subPathNormalized);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
this.pathsArr = pathsArr;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
this.hadEmptyPaths = true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Adds extensions to the paths
|
|
43
|
+
*
|
|
44
|
+
* @param {string|array} extensions An extension or list of extensions
|
|
45
|
+
* @returns {object} GlobObject
|
|
46
|
+
*/
|
|
47
|
+
filesWithExtensions (extensions) {
|
|
48
|
+
const extensionsArr = typeof extensions === 'string' ? [extensions] : extensions;
|
|
49
|
+
|
|
50
|
+
if (extensionsArr && extensionsArr.length) {
|
|
51
|
+
let extensionString = '';
|
|
52
|
+
|
|
53
|
+
// Remove dot from the extension name
|
|
54
|
+
let extensionsArrNormalized = map(extensionsArr, (extension) => extension.replace(REGEX_DOT_PREFIX, ''));
|
|
55
|
+
|
|
56
|
+
if (extensionsArrNormalized.length > 1) {
|
|
57
|
+
extensionString = `/**/*.{${ extensionsArrNormalized.join(',') }}`;
|
|
58
|
+
} else {
|
|
59
|
+
extensionString = `/**/*.${ extensionsArrNormalized }`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.hasExtensions = true;
|
|
63
|
+
return this.map((path) => `${ path }${ extensionString }`);
|
|
64
|
+
} else {
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Add a wildcard to select all files
|
|
71
|
+
*
|
|
72
|
+
* @returns {object} GlobObject
|
|
73
|
+
*/
|
|
74
|
+
allFiles () {
|
|
75
|
+
return this.map((path) => `${ path }/**`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Adds all paths to the ignore list
|
|
80
|
+
*
|
|
81
|
+
* @returns {object} GlobObject
|
|
82
|
+
*/
|
|
83
|
+
ignore () {
|
|
84
|
+
this.isIgnore = true;
|
|
85
|
+
return this.map((path) => `!${ path }`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Itterates through all paths
|
|
90
|
+
*
|
|
91
|
+
* @param {function} fn Itteratee function
|
|
92
|
+
* @returns {object} GlobObject
|
|
93
|
+
*/
|
|
94
|
+
map (fn) {
|
|
95
|
+
this.pathsArr = filter(flatten(map(this.pathsArr, fn)), (path) => !!path);
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Converts paths to an array of normalized glob paths
|
|
101
|
+
*
|
|
102
|
+
* @returns {array} Array of glob paths
|
|
103
|
+
*/
|
|
104
|
+
toArray () {
|
|
105
|
+
if (this.hadEmptyPaths && this.isIgnore) {
|
|
106
|
+
// Since we exclude files / paths, don't return anything if path list was empty
|
|
107
|
+
return [];
|
|
108
|
+
} else {
|
|
109
|
+
return map(this.pathsArr, (path) => {
|
|
110
|
+
return path.replace(REGEX_WINDOWS_BACKSLASH, '/');
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Alias for toArray
|
|
117
|
+
*
|
|
118
|
+
* @returns {array} Array of glob paths
|
|
119
|
+
*/
|
|
120
|
+
generate () {
|
|
121
|
+
return this.toArray();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function paths (paths) {
|
|
126
|
+
return (new GlobObject()).paths(paths);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function generate (...globs) {
|
|
130
|
+
return flatten(map(flatten(globs), (glob) => glob.toArray()));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
module.exports = {
|
|
134
|
+
generate,
|
|
135
|
+
paths,
|
|
136
|
+
};
|
package/lib/log-error.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
2
|
-
|
|
3
|
-
module.exports = function (error) {
|
|
4
|
-
if (error.plugin) {
|
|
5
|
-
console.log('Error \'' + chalk.cyan(error.plugin) + '\' ' + chalk.red(error.message));
|
|
6
|
-
|
|
7
|
-
} else {
|
|
8
|
-
console.log(error.toString().split(': ').join(':\n'));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Emit the end event, to properly end the task
|
|
12
|
-
if (typeof this.emit === 'function') {
|
|
13
|
-
this.emit('end');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
|
|
3
|
+
module.exports = function (error) {
|
|
4
|
+
if (error.plugin) {
|
|
5
|
+
console.log('Error \'' + chalk.cyan(error.plugin) + '\' ' + chalk.red(error.message));
|
|
6
|
+
|
|
7
|
+
} else {
|
|
8
|
+
console.log(error.toString().split(': ').join(':\n'));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Emit the end event, to properly end the task
|
|
12
|
+
if (typeof this.emit === 'function') {
|
|
13
|
+
this.emit('end');
|
|
14
|
+
}
|
|
15
|
+
}
|
package/lib/merge.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const isArray = require('lodash/isArray');
|
|
2
|
-
const mergeWith = require('lodash/mergeWith');
|
|
3
|
-
|
|
4
|
-
function customizer (objValue, srcValue, key) {
|
|
5
|
-
if (objValue !== srcValue && isArray(objValue) && isArray(srcValue)) {
|
|
6
|
-
return objValue.concat(srcValue);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Merge multiple objest together, with array concatanation
|
|
12
|
-
* object is mutated
|
|
13
|
-
*
|
|
14
|
-
* @param {object|array} object Object into which to merge into
|
|
15
|
-
* @param {object|array} ...sources List of sources which to merge into object
|
|
16
|
-
* @returns {object|array} Merged object
|
|
17
|
-
*/
|
|
18
|
-
module.exports = function merge (object, ...sources) {
|
|
19
|
-
for (let i = 0; i < sources.length; i++) {
|
|
20
|
-
if (sources[i] && typeof sources[i] === 'object') {
|
|
21
|
-
object = mergeWith(object, sources[i], customizer);
|
|
22
|
-
} else {
|
|
23
|
-
object = sources[i];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return object;
|
|
27
|
-
}
|
|
1
|
+
const isArray = require('lodash/isArray');
|
|
2
|
+
const mergeWith = require('lodash/mergeWith');
|
|
3
|
+
|
|
4
|
+
function customizer (objValue, srcValue, key) {
|
|
5
|
+
if (objValue !== srcValue && isArray(objValue) && isArray(srcValue)) {
|
|
6
|
+
return objValue.concat(srcValue);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Merge multiple objest together, with array concatanation
|
|
12
|
+
* object is mutated
|
|
13
|
+
*
|
|
14
|
+
* @param {object|array} object Object into which to merge into
|
|
15
|
+
* @param {object|array} ...sources List of sources which to merge into object
|
|
16
|
+
* @returns {object|array} Merged object
|
|
17
|
+
*/
|
|
18
|
+
module.exports = function merge (object, ...sources) {
|
|
19
|
+
for (let i = 0; i < sources.length; i++) {
|
|
20
|
+
if (sources[i] && typeof sources[i] === 'object') {
|
|
21
|
+
object = mergeWith(object, sources[i], customizer);
|
|
22
|
+
} else {
|
|
23
|
+
object = sources[i];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return object;
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@videinfra/static-website-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Customizable static site project builder",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -50,14 +50,17 @@
|
|
|
50
50
|
"gulp-sourcemaps": "^3.0.0",
|
|
51
51
|
"gulp-svgmin": "^4.1.0",
|
|
52
52
|
"gulp-svgstore": "^9.0.0",
|
|
53
|
+
"lodash.clone": "^4.3.2",
|
|
54
|
+
"lodash.some": "^4.2.2",
|
|
53
55
|
"map-stream": "^0.1.0",
|
|
54
56
|
"minimist": "^1.2.8",
|
|
55
57
|
"nano-memoize": "1.3.0",
|
|
56
58
|
"node-sass": "^7.0.3",
|
|
57
59
|
"sass": "^1.65.1",
|
|
60
|
+
"through": "^2.3.8",
|
|
58
61
|
"twig": "^1.10.5",
|
|
59
62
|
"webpack": "^4.46.0",
|
|
60
|
-
"webpack-
|
|
63
|
+
"webpack-watch-files-plugin": "^1.2.1"
|
|
61
64
|
},
|
|
62
65
|
"devDependencies": {
|
|
63
66
|
"jest": "^29.6.2"
|