balm-core 3.26.2 → 3.27.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.
- package/lib/balm.js +0 -22
- package/lib/bootstrap/check_config.js +4 -10
- package/lib/bootstrap/index.js +17 -28
- package/lib/bundler/esbuild/build.js +0 -4
- package/lib/bundler/esbuild/index.js +0 -5
- package/lib/bundler/esbuild/transform.js +0 -33
- package/lib/bundler/rollup/build.js +2 -17
- package/lib/bundler/rollup/entry.js +2 -6
- package/lib/bundler/rollup/index.js +0 -32
- package/lib/bundler/rollup/output.js +0 -6
- package/lib/bundler/rollup/plugins.js +0 -11
- package/lib/bundler/webpack/config/common.js +3 -26
- package/lib/bundler/webpack/config/dev.js +2 -6
- package/lib/bundler/webpack/config/index.js +0 -5
- package/lib/bundler/webpack/config/prod.js +2 -17
- package/lib/bundler/webpack/entry.js +12 -23
- package/lib/bundler/webpack/index.js +5 -14
- package/lib/bundler/webpack/loaders.js +0 -10
- package/lib/bundler/webpack/output.js +0 -7
- package/lib/bundler/webpack/rules/babel.js +3 -7
- package/lib/bundler/webpack/rules/css.js +2 -7
- package/lib/bundler/webpack/rules/html.js +0 -3
- package/lib/bundler/webpack/rules/url.js +2 -6
- package/lib/config/assets.js +0 -5
- package/lib/config/env.js +0 -2
- package/lib/config/globals.js +3 -10
- package/lib/config/html.js +0 -1
- package/lib/config/index.js +0 -21
- package/lib/config/logs.js +0 -1
- package/lib/config/paths.js +2 -3
- package/lib/config/pwa.js +0 -3
- package/lib/config/roots.js +0 -3
- package/lib/config/scripts.js +24 -32
- package/lib/config/server.js +4 -11
- package/lib/config/styles.js +2 -10
- package/lib/config/version.js +0 -3
- package/lib/hello.js +0 -5
- package/lib/hooks/index.js +20 -27
- package/lib/hooks/maker.js +2 -22
- package/lib/index.js +0 -5
- package/lib/middlewares/history.js +0 -3
- package/lib/middlewares/index.js +0 -9
- package/lib/middlewares/proxy.js +1 -9
- package/lib/middlewares/webpack.js +0 -6
- package/lib/plugins/htmlmin.js +1 -7
- package/lib/plugins/imagemin.js +1 -29
- package/lib/plugins/index.js +0 -12
- package/lib/plugins/jsmin.js +0 -20
- package/lib/plugins/less.js +7 -19
- package/lib/plugins/plumber.js +5 -24
- package/lib/plugins/postcss-plugins.js +0 -9
- package/lib/plugins/postcss.js +9 -27
- package/lib/plugins/rename.js +3 -16
- package/lib/plugins/replace.js +4 -26
- package/lib/plugins/sass.js +31 -45
- package/lib/plugins/sftp.js +36 -69
- package/lib/tasks/default.js +2 -23
- package/lib/tasks/foundation/balm.js +0 -19
- package/lib/tasks/foundation/balm_style.js +2 -27
- package/lib/tasks/foundation/index.js +0 -5
- package/lib/tasks/index.js +7 -16
- package/lib/tasks/private/build.js +0 -17
- package/lib/tasks/private/cache.js +0 -19
- package/lib/tasks/private/clean.js +0 -33
- package/lib/tasks/private/end.js +0 -23
- package/lib/tasks/private/extra.js +4 -29
- package/lib/tasks/private/font.js +0 -17
- package/lib/tasks/private/image.js +1 -28
- package/lib/tasks/private/lint.js +0 -17
- package/lib/tasks/private/media.js +0 -17
- package/lib/tasks/private/modernizr.js +0 -39
- package/lib/tasks/private/pwa-cache.js +0 -21
- package/lib/tasks/private/script.js +0 -13
- package/lib/tasks/private/sprite.js +3 -37
- package/lib/tasks/private/start.js +0 -23
- package/lib/tasks/private/style.js +0 -14
- package/lib/tasks/private/workbox-sw.js +0 -17
- package/lib/tasks/public/copy.js +0 -17
- package/lib/tasks/public/esbuild.js +0 -19
- package/lib/tasks/public/ftp.js +1 -22
- package/lib/tasks/public/html.js +0 -31
- package/lib/tasks/public/jsmin.js +0 -17
- package/lib/tasks/public/less.js +0 -17
- package/lib/tasks/public/postcss.js +0 -16
- package/lib/tasks/public/publish.js +3 -29
- package/lib/tasks/public/pwa.js +1 -30
- package/lib/tasks/public/remove.js +2 -34
- package/lib/tasks/public/replace.js +0 -18
- package/lib/tasks/public/rollup.js +0 -20
- package/lib/tasks/public/sass.js +0 -17
- package/lib/tasks/public/server.js +5 -44
- package/lib/tasks/public/url.js +0 -24
- package/lib/tasks/public/version.js +0 -17
- package/lib/tasks/public/webpack.js +2 -27
- package/lib/tasks/public/zip.js +0 -18
- package/lib/utilities/address.js +5 -21
- package/lib/utilities/cache-core.js +5 -21
- package/lib/utilities/color.js +0 -8
- package/lib/utilities/compiling.js +0 -15
- package/lib/utilities/detect-port.js +6 -26
- package/lib/utilities/escape-string-regexp.js +3 -5
- package/lib/utilities/file.js +3 -23
- package/lib/utilities/index.js +0 -5
- package/lib/utilities/loading.js +0 -23
- package/lib/utilities/logger.js +0 -21
- package/lib/utilities/merge-stream.js +0 -11
- package/lib/utilities/namespace.js +0 -4
- package/lib/utilities/public-url.js +9 -12
- package/lib/utilities/replacestream.js +5 -31
- package/lib/utilities/typeof.js +0 -2
- package/lib/utilities/utils.js +2 -12
- package/package.json +9 -9
- package/tslib/bundler/esbuild/transform.js +26 -19
- package/tslib/bundler/rollup/index.js +12 -5
package/lib/plugins/sftp.js
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
|
|
12
9
|
// Reference `gulp-sftp@0.1.5`
|
|
13
|
-
var PLUGIN_NAME = 'sftp';
|
|
14
10
|
|
|
11
|
+
var PLUGIN_NAME = 'sftp';
|
|
15
12
|
var normalizePath = function normalizePath(_path) {
|
|
16
13
|
return _path.replace(/\\/g, '/');
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
function resolveHomePath(key) {
|
|
20
16
|
if (key.location) {
|
|
21
17
|
var HOME = process.env.HOME || process.env.USERPROFILE || '';
|
|
22
|
-
|
|
23
18
|
for (var i = 0, len = key.location.length; i < len; i++) {
|
|
24
19
|
if (key.location[i].substr(0, 2) === '~/') {
|
|
25
20
|
key.location[i] = path.resolve(HOME, key.location[i].replace(/^~\//, ''));
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
for (var _i = 0, keyPath; keyPath = key.location[_i++];) {
|
|
30
24
|
if (_fs["default"].existsSync(keyPath)) {
|
|
31
25
|
key.contents = _fs["default"].readFileSync(keyPath);
|
|
@@ -36,67 +30,59 @@ function resolveHomePath(key) {
|
|
|
36
30
|
var rsaKey = key.location.join(', ');
|
|
37
31
|
throw new PluginError(PLUGIN_NAME, "Cannot find RSA key, searched: ".concat(rsaKey));
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
return key;
|
|
41
34
|
}
|
|
35
|
+
|
|
42
36
|
/**
|
|
43
37
|
* Lots of ways to present key info
|
|
44
38
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
39
|
function getKey(options) {
|
|
48
40
|
var key = options.key || options.keyLocation || null;
|
|
49
|
-
|
|
50
41
|
if (key && BalmJS.utils.isString(key)) {
|
|
51
42
|
key = {
|
|
52
43
|
location: key
|
|
53
44
|
};
|
|
54
|
-
}
|
|
55
|
-
|
|
45
|
+
}
|
|
56
46
|
|
|
47
|
+
// Check for other options that imply a key or if there is no password
|
|
57
48
|
if (!key && (options.passphrase || options.keyContents || !options.password)) {
|
|
58
49
|
key = {};
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
if (key) {
|
|
62
52
|
// Aliases
|
|
63
53
|
key.contents = key.contents || options.keyContents;
|
|
64
|
-
key.passphrase = key.passphrase || options.passphrase;
|
|
54
|
+
key.passphrase = key.passphrase || options.passphrase;
|
|
65
55
|
|
|
66
|
-
|
|
56
|
+
// Defaults
|
|
57
|
+
key.location = key.location || ['~/.ssh/id_rsa', '/.ssh/id_rsa', '~/.ssh/id_dsa', '/.ssh/id_dsa'];
|
|
67
58
|
|
|
59
|
+
// Type normalization
|
|
68
60
|
if (!BalmJS.utils.isArray(key.location)) {
|
|
69
61
|
key.location = [key.location];
|
|
70
|
-
}
|
|
71
|
-
|
|
62
|
+
}
|
|
72
63
|
|
|
64
|
+
// Resolve all home paths
|
|
73
65
|
key = resolveHomePath(key);
|
|
74
66
|
}
|
|
75
|
-
|
|
76
67
|
return key;
|
|
77
68
|
}
|
|
78
|
-
|
|
79
69
|
function gulpSftp(options) {
|
|
80
70
|
options = Object.assign({}, options); // Credit sindresorhus
|
|
81
71
|
|
|
82
72
|
if (options.host === undefined) {
|
|
83
73
|
throw new PluginError(PLUGIN_NAME, '`host` required');
|
|
84
74
|
}
|
|
85
|
-
|
|
86
75
|
var fileCount = 0;
|
|
87
76
|
var remotePath = options.remotePath || '/';
|
|
88
77
|
var remotePlatform = options.remotePlatform || options.platform || 'unix';
|
|
89
78
|
options.authKey = options.authKey || options.auth;
|
|
90
79
|
var authFilePath = options.authFile || '.ftppass';
|
|
91
80
|
var authFile = path.join('./', authFilePath);
|
|
92
|
-
|
|
93
81
|
if (options.authKey && _fs["default"].existsSync(authFile)) {
|
|
94
82
|
var auth = JSON.parse(_fs["default"].readFileSync(authFile, 'utf8'))[options.authKey];
|
|
95
|
-
|
|
96
83
|
if (!auth) {
|
|
97
84
|
throw new PluginError(PLUGIN_NAME, 'Could not find authkey in .ftppass');
|
|
98
85
|
}
|
|
99
|
-
|
|
100
86
|
if (BalmJS.utils.isString(auth) && auth.indexOf(':') !== -1) {
|
|
101
87
|
var authparts = auth.split(':');
|
|
102
88
|
auth = {
|
|
@@ -104,26 +90,24 @@ function gulpSftp(options) {
|
|
|
104
90
|
pass: authparts[1]
|
|
105
91
|
};
|
|
106
92
|
}
|
|
107
|
-
|
|
108
93
|
var authKeys = Object.keys(auth);
|
|
109
|
-
|
|
110
94
|
for (var i = 0, len = authKeys.length; i < len; i++) {
|
|
111
95
|
var attr = authKeys[i];
|
|
112
|
-
|
|
113
96
|
if (auth[attr]) {
|
|
114
97
|
options[attr] = auth[attr];
|
|
115
98
|
}
|
|
116
99
|
}
|
|
117
|
-
}
|
|
118
|
-
|
|
100
|
+
}
|
|
119
101
|
|
|
102
|
+
// Option aliases
|
|
120
103
|
var password = options.password;
|
|
121
104
|
var username = options.username || 'anonymous';
|
|
105
|
+
|
|
122
106
|
/*
|
|
123
107
|
* Key info
|
|
124
108
|
*/
|
|
125
|
-
|
|
126
109
|
var key = getKey(options);
|
|
110
|
+
|
|
127
111
|
/*
|
|
128
112
|
* End Key normalization, key should now be of form:
|
|
129
113
|
* {location:Array,passphrase:String,contents:String}
|
|
@@ -133,35 +117,30 @@ function gulpSftp(options) {
|
|
|
133
117
|
var mkDirCache = {};
|
|
134
118
|
var finished = false;
|
|
135
119
|
var sftpCache = null; // SFTP connection cache
|
|
136
|
-
|
|
137
120
|
var connCache = null; // SSH connection cache
|
|
138
121
|
|
|
139
122
|
function _pool(uploader) {
|
|
140
123
|
var _this = this;
|
|
124
|
+
var ssh2 = require('ssh2');
|
|
141
125
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
126
|
+
// Method to get cache or create connection
|
|
145
127
|
if (sftpCache) {
|
|
146
128
|
return uploader(sftpCache);
|
|
147
129
|
}
|
|
148
|
-
|
|
149
130
|
if (password) {
|
|
150
131
|
BalmJS.logger.debug(PLUGIN_NAME, 'Authenticating with password');
|
|
151
132
|
} else if (key) {
|
|
152
133
|
BalmJS.logger.debug(PLUGIN_NAME, 'Authenticating with private key');
|
|
153
134
|
}
|
|
135
|
+
|
|
154
136
|
/*
|
|
155
137
|
* Connection options, may be a key
|
|
156
138
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
139
|
var connectionOptions = {
|
|
160
140
|
host: options.host,
|
|
161
141
|
port: options.port || 22,
|
|
162
142
|
username: username
|
|
163
143
|
};
|
|
164
|
-
|
|
165
144
|
if (password) {
|
|
166
145
|
connectionOptions.password = password;
|
|
167
146
|
} else if (options.agent) {
|
|
@@ -171,11 +150,9 @@ function gulpSftp(options) {
|
|
|
171
150
|
connectionOptions.privateKey = key.contents;
|
|
172
151
|
connectionOptions.passphrase = key.passphrase;
|
|
173
152
|
}
|
|
174
|
-
|
|
175
153
|
if (options.timeout) {
|
|
176
154
|
connectionOptions.readyTimeout = options.timeout;
|
|
177
155
|
}
|
|
178
|
-
|
|
179
156
|
var conn = new ssh2.Client();
|
|
180
157
|
connCache = conn;
|
|
181
158
|
conn.on('ready', function () {
|
|
@@ -184,11 +161,9 @@ function gulpSftp(options) {
|
|
|
184
161
|
if (err) {
|
|
185
162
|
throw err;
|
|
186
163
|
}
|
|
187
|
-
|
|
188
164
|
sftp.on('end', function () {
|
|
189
165
|
BalmJS.logger.debug(PLUGIN_NAME, 'SFTP session closed');
|
|
190
166
|
sftpCache = null;
|
|
191
|
-
|
|
192
167
|
if (!finished) {
|
|
193
168
|
this.emit('error', new PluginError(PLUGIN_NAME, 'SFTP abrupt closure'));
|
|
194
169
|
}
|
|
@@ -207,57 +182,58 @@ function gulpSftp(options) {
|
|
|
207
182
|
if (!finished) {
|
|
208
183
|
_this.emit('error', new PluginError(PLUGIN_NAME, 'SFTP abrupt closure'));
|
|
209
184
|
}
|
|
210
|
-
|
|
211
185
|
if (options.callback) {
|
|
212
186
|
options.callback();
|
|
213
187
|
}
|
|
214
188
|
});
|
|
215
189
|
conn.connect(connectionOptions);
|
|
216
190
|
}
|
|
217
|
-
|
|
218
191
|
function transform(file, encoding, callback) {
|
|
219
192
|
if (file.isNull()) {
|
|
220
193
|
return callback();
|
|
221
|
-
}
|
|
222
|
-
|
|
194
|
+
}
|
|
223
195
|
|
|
224
|
-
|
|
196
|
+
// Have to create a new connection for each file otherwise they conflict, pulled from sindresorhus
|
|
197
|
+
var finalRemotePath = normalizePath(path.join(remotePath, file.relative));
|
|
225
198
|
|
|
199
|
+
// Connection pulled from pool
|
|
226
200
|
_pool.call(this, function (sftp) {
|
|
227
201
|
/*
|
|
228
202
|
* Create Directories
|
|
229
203
|
*/
|
|
204
|
+
|
|
230
205
|
// Get dir name from file path
|
|
231
|
-
var dirname = path.dirname(finalRemotePath);
|
|
206
|
+
var dirname = path.dirname(finalRemotePath);
|
|
207
|
+
// Get parents of the target dir
|
|
232
208
|
|
|
233
209
|
var fileDirs = require('parents')(dirname).map(function (d) {
|
|
234
210
|
return d.replace(/^\/~/, '~');
|
|
235
211
|
}).map(normalizePath);
|
|
236
|
-
|
|
237
212
|
if (dirname.search(/^\//) === 0) {
|
|
238
213
|
fileDirs = fileDirs.map(function (dir) {
|
|
239
214
|
return dir.search(/^\//) === 0 ? dir : "/".concat(dir);
|
|
240
215
|
});
|
|
241
|
-
}
|
|
242
|
-
// also filter out any dirs made during this gulp session
|
|
243
|
-
|
|
216
|
+
}
|
|
244
217
|
|
|
218
|
+
// Get filter out dirs that are closer to root than the base remote path
|
|
219
|
+
// also filter out any dirs made during this gulp session
|
|
245
220
|
fileDirs = fileDirs.filter(function (d) {
|
|
246
221
|
return d.length >= remotePath.length && !mkDirCache[d];
|
|
247
|
-
});
|
|
248
|
-
// https://github.com/caolan/async#whilst - not the most commonly used async control flow
|
|
222
|
+
});
|
|
249
223
|
|
|
250
|
-
|
|
224
|
+
// While there are dirs to create, create them
|
|
225
|
+
// https://github.com/caolan/async#whilst - not the most commonly used async control flow
|
|
226
|
+
require('async').whilst(
|
|
227
|
+
// https://github.com/caolan/async/issues/1668
|
|
251
228
|
function (cb) {
|
|
252
229
|
return cb(null, fileDirs && fileDirs.length);
|
|
253
230
|
}, function (cb) {
|
|
254
231
|
var d = fileDirs.pop();
|
|
255
|
-
mkDirCache[d] = true;
|
|
256
|
-
|
|
232
|
+
mkDirCache[d] = true;
|
|
233
|
+
// Mdrake - TODO: use a default file permission instead of defaulting to 755
|
|
257
234
|
if (remotePlatform && remotePlatform.toLowerCase().indexOf('win') !== -1) {
|
|
258
235
|
d = d.replace('/', '\\');
|
|
259
236
|
}
|
|
260
|
-
|
|
261
237
|
sftp.exists(d, function (exist) {
|
|
262
238
|
if (exist) {
|
|
263
239
|
cb();
|
|
@@ -272,7 +248,6 @@ function gulpSftp(options) {
|
|
|
272
248
|
} else {
|
|
273
249
|
BalmJS.logger.debug(PLUGIN_NAME, "Created: ".concat(d));
|
|
274
250
|
}
|
|
275
|
-
|
|
276
251
|
cb();
|
|
277
252
|
});
|
|
278
253
|
}
|
|
@@ -283,14 +258,14 @@ function gulpSftp(options) {
|
|
|
283
258
|
encoding: null,
|
|
284
259
|
mode: '0666',
|
|
285
260
|
autoClose: true
|
|
286
|
-
});
|
|
261
|
+
});
|
|
287
262
|
|
|
263
|
+
// Start upload
|
|
288
264
|
if (file.isStream()) {
|
|
289
265
|
file.contents.pipe(stream);
|
|
290
266
|
} else if (file.isBuffer()) {
|
|
291
267
|
stream.end(file.contents);
|
|
292
268
|
}
|
|
293
|
-
|
|
294
269
|
stream.on('close', function (error) {
|
|
295
270
|
if (error) {
|
|
296
271
|
this.emit('error', new PluginError(PLUGIN_NAME, error));
|
|
@@ -299,13 +274,11 @@ function gulpSftp(options) {
|
|
|
299
274
|
BalmJS.logger.info(PLUGIN_NAME, "Uploaded: ".concat(fileRelativePath, " => ").concat(finalRemotePath));
|
|
300
275
|
fileCount++;
|
|
301
276
|
}
|
|
302
|
-
|
|
303
277
|
return callback(error);
|
|
304
278
|
});
|
|
305
279
|
});
|
|
306
280
|
});
|
|
307
281
|
}
|
|
308
|
-
|
|
309
282
|
function flush(callback) {
|
|
310
283
|
if (fileCount > 0) {
|
|
311
284
|
var unit = fileCount === 1 ? 'file' : 'files';
|
|
@@ -313,22 +286,16 @@ function gulpSftp(options) {
|
|
|
313
286
|
} else {
|
|
314
287
|
BalmJS.logger.warn(PLUGIN_NAME, 'No files uploaded');
|
|
315
288
|
}
|
|
316
|
-
|
|
317
289
|
finished = true;
|
|
318
|
-
|
|
319
290
|
if (sftpCache) {
|
|
320
291
|
sftpCache.end();
|
|
321
292
|
}
|
|
322
|
-
|
|
323
293
|
if (connCache) {
|
|
324
294
|
connCache.end();
|
|
325
295
|
}
|
|
326
|
-
|
|
327
296
|
callback();
|
|
328
297
|
}
|
|
329
|
-
|
|
330
298
|
return through2.obj(transform, flush);
|
|
331
299
|
}
|
|
332
|
-
|
|
333
300
|
var _default = gulpSftp;
|
|
334
301
|
exports["default"] = _default;
|
package/lib/tasks/default.js
CHANGED
|
@@ -1,67 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
14
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
23
|
-
|
|
24
15
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
|
-
|
|
26
16
|
var DefaultTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
27
17
|
(0, _inherits2["default"])(DefaultTask, _BalmJS$BalmTask);
|
|
28
|
-
|
|
29
18
|
var _super = _createSuper(DefaultTask);
|
|
30
|
-
|
|
31
19
|
function DefaultTask() {
|
|
32
20
|
(0, _classCallCheck2["default"])(this, DefaultTask);
|
|
33
21
|
return _super.call(this, 'default');
|
|
34
22
|
}
|
|
35
|
-
|
|
36
23
|
(0, _createClass2["default"])(DefaultTask, [{
|
|
37
24
|
key: "startTask",
|
|
38
25
|
get: function get() {
|
|
39
26
|
var tasks = BalmJS.toNamespace(['start']);
|
|
40
|
-
|
|
41
27
|
if (BalmJS.utils.isString(BalmJS.beforeTask)) {
|
|
42
28
|
tasks.unshift(BalmJS.beforeTask);
|
|
43
29
|
}
|
|
44
|
-
|
|
45
30
|
return tasks;
|
|
46
31
|
}
|
|
47
32
|
}, {
|
|
48
33
|
key: "mainTasks",
|
|
49
34
|
get: function get() {
|
|
50
|
-
var tasks = ['clean'].concat((0, _toConsumableArray2["default"])(BalmJS.config.styles.sprites.length ? ['sprite'] : []), ['style'], (0, _toConsumableArray2["default"])(BalmJS.config.scripts.lint ? ['lint'] : []), ['script',
|
|
35
|
+
var tasks = ['clean'].concat((0, _toConsumableArray2["default"])(BalmJS.config.styles.sprites.length ? ['sprite'] : []), ['style'], (0, _toConsumableArray2["default"])(BalmJS.config.scripts.lint ? ['lint'] : []), ['script',
|
|
36
|
+
// Templates
|
|
51
37
|
'html'], (0, _toConsumableArray2["default"])(BalmJS.config.env.isProd || !BalmJS.config.inFrontend ? ['image', 'font', 'media'] : []));
|
|
52
|
-
|
|
53
38
|
if (BalmJS.config.env.isProd) {
|
|
54
39
|
tasks = [].concat((0, _toConsumableArray2["default"])(tasks), ['extra', 'build'], (0, _toConsumableArray2["default"])(BalmJS.config.assets.cache ? ['cache'] : []), (0, _toConsumableArray2["default"])(BalmJS.config.pwa.enabled ? ['workbox-sw', 'pwa'] : []));
|
|
55
40
|
} else {
|
|
56
41
|
tasks = [].concat((0, _toConsumableArray2["default"])(tasks), ['modernizr', 'serve']);
|
|
57
42
|
}
|
|
58
|
-
|
|
59
43
|
var defaultMainTasks = BalmJS.config.useDefaults ? BalmJS.toNamespace(tasks) : [];
|
|
60
|
-
|
|
61
44
|
if (BalmJS.config.env.inSSR || BalmJS.config.env.isMP || BalmJS.config.env.inDesktopApp) {
|
|
62
45
|
defaultMainTasks = BalmJS.toNamespace(BalmJS.config.env.isMP ? ['style', 'script'] : ['script']);
|
|
63
46
|
}
|
|
64
|
-
|
|
65
47
|
return defaultMainTasks;
|
|
66
48
|
}
|
|
67
49
|
}, {
|
|
@@ -73,16 +55,13 @@ var DefaultTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
73
55
|
key: "endTask",
|
|
74
56
|
get: function get() {
|
|
75
57
|
var tasks = BalmJS.toNamespace(['end']);
|
|
76
|
-
|
|
77
58
|
if (BalmJS.utils.isString(BalmJS.afterTask)) {
|
|
78
59
|
tasks.push(BalmJS.afterTask);
|
|
79
60
|
}
|
|
80
|
-
|
|
81
61
|
return tasks;
|
|
82
62
|
}
|
|
83
63
|
}]);
|
|
84
64
|
return DefaultTask;
|
|
85
65
|
}(BalmJS.BalmTask);
|
|
86
|
-
|
|
87
66
|
var _default = DefaultTask;
|
|
88
67
|
exports["default"] = _default;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
var BalmTask = /*#__PURE__*/function () {
|
|
17
12
|
function BalmTask(name) {
|
|
18
13
|
(0, _classCallCheck2["default"])(this, BalmTask);
|
|
@@ -27,33 +22,27 @@ var BalmTask = /*#__PURE__*/function () {
|
|
|
27
22
|
this.name = name;
|
|
28
23
|
this.taskName = BalmJS.toNamespace(name);
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
(0, _createClass2["default"])(BalmTask, [{
|
|
32
26
|
key: "styleName",
|
|
33
27
|
get: function get() {
|
|
34
28
|
var name;
|
|
35
|
-
|
|
36
29
|
switch (BalmJS.config.styles.extname) {
|
|
37
30
|
case 'sass':
|
|
38
31
|
case 'scss':
|
|
39
32
|
name = 'sass';
|
|
40
33
|
break;
|
|
41
|
-
|
|
42
34
|
case 'less':
|
|
43
35
|
name = 'less';
|
|
44
36
|
break;
|
|
45
|
-
|
|
46
37
|
default:
|
|
47
38
|
name = 'postcss';
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
return name;
|
|
51
41
|
}
|
|
52
42
|
}, {
|
|
53
43
|
key: "src",
|
|
54
44
|
get: function get() {
|
|
55
45
|
var _this = this;
|
|
56
|
-
|
|
57
46
|
return gulp.src(this.input, Object.assign({
|
|
58
47
|
allowEmpty: true
|
|
59
48
|
}, this.gulpSrcOptions)).pipe(BalmJS.plugins.plumber(function (error) {
|
|
@@ -65,19 +54,15 @@ var BalmTask = /*#__PURE__*/function () {
|
|
|
65
54
|
value: function init(input, output) {
|
|
66
55
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
67
56
|
var key = this.name;
|
|
68
|
-
|
|
69
57
|
switch (key) {
|
|
70
58
|
case 'copy':
|
|
71
59
|
key = 'rename';
|
|
72
60
|
break;
|
|
73
|
-
|
|
74
61
|
case 'jsmin':
|
|
75
62
|
key = 'terser';
|
|
76
63
|
break;
|
|
77
|
-
|
|
78
64
|
default:
|
|
79
65
|
}
|
|
80
|
-
|
|
81
66
|
var useAbsPath = !['webpack', 'rollup', 'esbuild', 'sprite'].includes(key);
|
|
82
67
|
this.input = useAbsPath ? BalmJS.file.absPaths(input || this.defaultInput) : input || this.defaultInput;
|
|
83
68
|
this.output = useAbsPath ? BalmJS.file.absPath(output || this.defaultOutput) : output || this.defaultOutput;
|
|
@@ -86,17 +71,14 @@ var BalmTask = /*#__PURE__*/function () {
|
|
|
86
71
|
input: this.input,
|
|
87
72
|
output: this.output
|
|
88
73
|
};
|
|
89
|
-
|
|
90
74
|
if (options[key]) {
|
|
91
75
|
obj.customOptions = this.customOptions;
|
|
92
76
|
}
|
|
93
|
-
|
|
94
77
|
if (useAbsPath) {
|
|
95
78
|
BalmJS.logger.debug("".concat(this.name, " task"), obj, {
|
|
96
79
|
pre: true
|
|
97
80
|
});
|
|
98
81
|
}
|
|
99
|
-
|
|
100
82
|
if (options.src) {
|
|
101
83
|
this.gulpSrcOptions = options.src;
|
|
102
84
|
}
|
|
@@ -104,6 +86,5 @@ var BalmTask = /*#__PURE__*/function () {
|
|
|
104
86
|
}]);
|
|
105
87
|
return BalmTask;
|
|
106
88
|
}();
|
|
107
|
-
|
|
108
89
|
var _default = BalmTask;
|
|
109
90
|
exports["default"] = _default;
|
|
@@ -1,55 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
20
13
|
var _balm = _interopRequireDefault(require("./balm"));
|
|
21
|
-
|
|
22
14
|
var _constants = require("../../config/constants");
|
|
23
|
-
|
|
24
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
25
|
-
|
|
26
16
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
27
|
-
|
|
28
17
|
var BalmStyleTask = /*#__PURE__*/function (_BalmTask) {
|
|
29
18
|
(0, _inherits2["default"])(BalmStyleTask, _BalmTask);
|
|
30
|
-
|
|
31
19
|
var _super = _createSuper(BalmStyleTask);
|
|
32
|
-
|
|
33
20
|
function BalmStyleTask(name) {
|
|
34
21
|
var _this;
|
|
35
|
-
|
|
36
22
|
(0, _classCallCheck2["default"])(this, BalmStyleTask);
|
|
37
23
|
_this = _super.call(this, name);
|
|
38
24
|
var extname;
|
|
39
|
-
|
|
40
25
|
switch (name) {
|
|
41
26
|
case 'sass':
|
|
42
27
|
extname = '{scss,sass}';
|
|
43
28
|
break;
|
|
44
|
-
|
|
45
29
|
case 'less':
|
|
46
30
|
extname = 'less';
|
|
47
31
|
break;
|
|
48
|
-
|
|
49
32
|
default:
|
|
50
33
|
extname = 'css';
|
|
51
34
|
}
|
|
52
|
-
|
|
53
35
|
if (Array.isArray(BalmJS.config.styles.entry)) {
|
|
54
36
|
_this.defaultInput = BalmJS.config.styles.entry.map(function (styleEntry) {
|
|
55
37
|
return path.join(BalmJS.config.src.css, styleEntry);
|
|
@@ -61,11 +43,9 @@ var BalmStyleTask = /*#__PURE__*/function (_BalmTask) {
|
|
|
61
43
|
_this.defaultInput = path.join(BalmJS.config.src.css, '**', "!(_*).".concat(extname));
|
|
62
44
|
}
|
|
63
45
|
}
|
|
64
|
-
|
|
65
46
|
_this.defaultOutput = BalmJS.config.env.isMP ? path.join(BalmJS.config.dest.base, _constants.MP_ASSETS, BalmJS.config.paths.target.css) : BalmJS.config.dest.css;
|
|
66
47
|
return _this;
|
|
67
48
|
}
|
|
68
|
-
|
|
69
49
|
(0, _createClass2["default"])(BalmStyleTask, [{
|
|
70
50
|
key: "handleStyle",
|
|
71
51
|
value: function handleStyle(style, output, options) {
|
|
@@ -76,27 +56,23 @@ var BalmStyleTask = /*#__PURE__*/function (_BalmTask) {
|
|
|
76
56
|
allowEmpty: true
|
|
77
57
|
}, this.gulpSrcOptions)).pipe(BalmJS.plugins.plumber(function (error) {
|
|
78
58
|
// https://github.com/floatdrop/gulp-plumber/issues/30
|
|
79
|
-
BalmJS.logger.error(taskName, error.message);
|
|
59
|
+
BalmJS.logger.error(taskName, error.message);
|
|
60
|
+
// Must emit end event for any dependent streams to pick up on this. Destroying the stream
|
|
80
61
|
// ensures nothing else in that stream gets done, for example, if we're dealing with five
|
|
81
62
|
// files, after an error in one of them, any other won't carry on. Doing destroy without
|
|
82
63
|
// ending it first will not notify depending streams, tasks like `watch` will hang up.
|
|
83
|
-
|
|
84
64
|
this.emit('end');
|
|
85
65
|
this.destroy();
|
|
86
66
|
}));
|
|
87
|
-
|
|
88
67
|
switch (style) {
|
|
89
68
|
case 'sass':
|
|
90
69
|
stream = stream.pipe(BalmJS.plugins.sass(options));
|
|
91
70
|
break;
|
|
92
|
-
|
|
93
71
|
case 'less':
|
|
94
72
|
stream = stream.pipe(BalmJS.plugins.less(options));
|
|
95
73
|
break;
|
|
96
|
-
|
|
97
74
|
default:
|
|
98
75
|
}
|
|
99
|
-
|
|
100
76
|
return stream.pipe(BalmJS.plugins.postcss(BalmJS.plugins.postcssPlugins(style === 'postcss'))).pipe($["if"](BalmJS.config.env.isMP, BalmJS.plugins.rename({
|
|
101
77
|
extname: '.wxss'
|
|
102
78
|
}))).pipe(gulp.dest(output, {
|
|
@@ -108,6 +84,5 @@ var BalmStyleTask = /*#__PURE__*/function (_BalmTask) {
|
|
|
108
84
|
}]);
|
|
109
85
|
return BalmStyleTask;
|
|
110
86
|
}(_balm["default"]);
|
|
111
|
-
|
|
112
87
|
var _default = BalmStyleTask;
|
|
113
88
|
exports["default"] = _default;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _balm = _interopRequireDefault(require("./balm"));
|
|
6
|
-
|
|
7
5
|
var _balm_style = _interopRequireDefault(require("./balm_style"));
|
|
8
|
-
|
|
9
6
|
BalmJS.BalmTask = _balm["default"];
|
|
10
7
|
BalmJS.BalmStyleTask = _balm_style["default"];
|
|
11
8
|
BalmJS.tasks = new Map(); // Main tasks
|
|
12
|
-
|
|
13
9
|
BalmJS.recipes = []; // Sub tasks
|
|
14
|
-
|
|
15
10
|
BalmJS.recipeIndex = 0;
|
|
16
11
|
BalmJS.server = null;
|
|
17
12
|
BalmJS.watchFtpFile = '';
|