@node-minify/core 6.2.0 → 6.4.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Rodolphe Stoclin
3
+ Copyright (c) 2022 Rodolphe Stoclin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/lib/compress.js CHANGED
@@ -13,20 +13,20 @@ var _utils = require("@node-minify/utils");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- /*!
17
- * node-minify
18
- * Copyright(c) 2011-2020 Rodolphe Stoclin
19
- * MIT Licensed
16
+ /*!
17
+ * node-minify
18
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
19
+ * MIT Licensed
20
20
  */
21
21
 
22
- /**
23
- * Module dependencies.
22
+ /**
23
+ * Module dependencies.
24
24
  */
25
25
 
26
- /**
27
- * Run compressor.
28
- *
29
- * @param {Object} settings
26
+ /**
27
+ * Run compressor.
28
+ *
29
+ * @param {Object} settings
30
30
  */
31
31
  const compress = settings => {
32
32
  if (typeof settings.compressor !== 'function') {
@@ -41,10 +41,10 @@ const compress = settings => {
41
41
  return _utils.utils.compressSingleFile(settings);
42
42
  }
43
43
  };
44
- /**
45
- * Compress an array of files in sync.
46
- *
47
- * @param {Object} settings
44
+ /**
45
+ * Compress an array of files in sync.
46
+ *
47
+ * @param {Object} settings
48
48
  */
49
49
 
50
50
 
@@ -61,10 +61,10 @@ const compressArrayOfFilesSync = settings => {
61
61
  });
62
62
  });
63
63
  };
64
- /**
65
- * Compress an array of files in async.
66
- *
67
- * @param {Object} settings
64
+ /**
65
+ * Compress an array of files in async.
66
+ *
67
+ * @param {Object} settings
68
68
  */
69
69
 
70
70
 
@@ -81,10 +81,10 @@ const compressArrayOfFilesAsync = settings => {
81
81
  });
82
82
  return sequence;
83
83
  };
84
- /**
85
- * Create folder of the target file.
86
- *
87
- * @param {String} file - Full path of the file
84
+ /**
85
+ * Create folder of the target file.
86
+ *
87
+ * @param {String} file - Full path of the file
88
88
  */
89
89
 
90
90
 
@@ -93,7 +93,7 @@ const createDirectory = file => {
93
93
  file = file[0];
94
94
  }
95
95
 
96
- const dir = file.substr(0, file.lastIndexOf('/'));
96
+ const dir = file && file.substr(0, file.lastIndexOf('/'));
97
97
 
98
98
  if (!dir) {
99
99
  return;
@@ -103,6 +103,6 @@ const createDirectory = file => {
103
103
  _mkdirp.default.sync(dir);
104
104
  }
105
105
  };
106
- /**
107
- * Expose `compress()`.
106
+ /**
107
+ * Expose `compress()`.
108
108
  */
@@ -9,7 +9,7 @@ var _utils = require("@node-minify/utils");
9
9
 
10
10
  /*!
11
11
  * node-minify
12
- * Copyright(c) 2011-2020 Rodolphe Stoclin
12
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
13
13
  * MIT Licensed
14
14
  */
15
15
 
package/lib/core.js CHANGED
@@ -6,20 +6,20 @@ var _compress = require("./compress");
6
6
 
7
7
  var _compressInMemory = require("./compressInMemory");
8
8
 
9
- /*!
10
- * node-minify
11
- * Copyright(c) 2011-2020 Rodolphe Stoclin
12
- * MIT Licensed
9
+ /*!
10
+ * node-minify
11
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
12
+ * MIT Licensed
13
13
  */
14
14
 
15
- /**
16
- * Module dependencies.
15
+ /**
16
+ * Module dependencies.
17
17
  */
18
18
 
19
- /**
20
- * Run node-minify.
21
- *
22
- * @param {Object} settings - Settings from user input
19
+ /**
20
+ * Run node-minify.
21
+ *
22
+ * @param {Object} settings - Settings from user input
23
23
  */
24
24
  const minify = settings => {
25
25
  return new Promise((resolve, reject) => {
@@ -51,8 +51,8 @@ const minify = settings => {
51
51
  }
52
52
  });
53
53
  };
54
- /**
55
- * Expose `minify()`.
54
+ /**
55
+ * Expose `minify()`.
56
56
  */
57
57
 
58
58
 
package/lib/setup.js CHANGED
@@ -13,18 +13,18 @@ var _utils = require("@node-minify/utils");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- /*!
17
- * node-minify
18
- * Copyright(c) 2011-2020 Rodolphe Stoclin
19
- * MIT Licensed
16
+ /*!
17
+ * node-minify
18
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
19
+ * MIT Licensed
20
20
  */
21
21
 
22
- /**
23
- * Module dependencies.
22
+ /**
23
+ * Module dependencies.
24
24
  */
25
25
 
26
- /**
27
- * Default settings.
26
+ /**
27
+ * Default settings.
28
28
  */
29
29
  const defaultSettings = {
30
30
  sync: false,
@@ -32,11 +32,11 @@ const defaultSettings = {
32
32
  buffer: 1000 * 1024,
33
33
  callback: false
34
34
  };
35
- /**
36
- * Run setup.
37
- *
38
- * @param {Object} inputSettings
39
- * @return {Object}
35
+ /**
36
+ * Run setup.
37
+ *
38
+ * @param {Object} inputSettings
39
+ * @return {Object}
40
40
  */
41
41
 
42
42
  const setup = inputSettings => {
@@ -53,15 +53,15 @@ const setup = inputSettings => {
53
53
  settings = Object.assign(settings, setPublicFolder(settings.input, settings.publicFolder));
54
54
  return settings;
55
55
  };
56
- /**
57
- * Check the output path, searching for $1
58
- * if exist, returns the path remplacing $1 by file name
59
- *
60
- * @param {String|Array} input - Path file
61
- * @param {String} output - Path to the output file
62
- * @param {String} publicFolder - Path to the public folder
63
- * @param {Boolean} replaceInPlace - True to replace file in same folder
64
- * @return {Object}
56
+ /**
57
+ * Check the output path, searching for $1
58
+ * if exist, returns the path remplacing $1 by file name
59
+ *
60
+ * @param {String|Array} input - Path file
61
+ * @param {String} output - Path to the output file
62
+ * @param {String} publicFolder - Path to the public folder
63
+ * @param {Boolean} replaceInPlace - True to replace file in same folder
64
+ * @return {Object}
65
65
  */
66
66
 
67
67
 
@@ -83,12 +83,12 @@ const checkOutput = (input, output, publicFolder, replaceInPlace) => {
83
83
  }
84
84
  }
85
85
  };
86
- /**
87
- * Handle wildcards in a path, get the real path of each files.
88
- *
89
- * @param {String|Array} input - Path with wildcards
90
- * @param {String} publicFolder - Path to the public folder
91
- * @return {Object}
86
+ /**
87
+ * Handle wildcards in a path, get the real path of each files.
88
+ *
89
+ * @param {String|Array} input - Path with wildcards
90
+ * @param {String} publicFolder - Path to the public folder
91
+ * @return {Object}
92
92
  */
93
93
 
94
94
 
@@ -100,12 +100,12 @@ const wildcards = (input, publicFolder) => {
100
100
 
101
101
  return wildcardsArray(input, publicFolder);
102
102
  };
103
- /**
104
- * Handle wildcards in a path (string only), get the real path of each files.
105
- *
106
- * @param {String} input - Path with wildcards
107
- * @param {String} publicFolder - Path to the public folder
108
- * @return {Object}
103
+ /**
104
+ * Handle wildcards in a path (string only), get the real path of each files.
105
+ *
106
+ * @param {String} input - Path with wildcards
107
+ * @param {String} publicFolder - Path to the public folder
108
+ * @return {Object}
109
109
  */
110
110
 
111
111
 
@@ -118,12 +118,12 @@ const wildcardsString = (input, publicFolder) => {
118
118
 
119
119
  return output;
120
120
  };
121
- /**
122
- * Handle wildcards in a path (array only), get the real path of each files.
123
- *
124
- * @param {Array} input - Path with wildcards
125
- * @param {String} publicFolder - Path to the public folder
126
- * @return {Object}
121
+ /**
122
+ * Handle wildcards in a path (array only), get the real path of each files.
123
+ *
124
+ * @param {Array} input - Path with wildcards
125
+ * @param {String} publicFolder - Path to the public folder
126
+ * @return {Object}
127
127
  */
128
128
 
129
129
 
@@ -154,12 +154,12 @@ const wildcardsArray = (input, publicFolder) => {
154
154
 
155
155
  return output;
156
156
  };
157
- /**
158
- * Get the real path of each files.
159
- *
160
- * @param {String} input - Path with wildcards
161
- * @param {String} publicFolder - Path to the public folder
162
- * @return {Object}
157
+ /**
158
+ * Get the real path of each files.
159
+ *
160
+ * @param {String} input - Path with wildcards
161
+ * @param {String} publicFolder - Path to the public folder
162
+ * @return {Object}
163
163
  */
164
164
 
165
165
 
@@ -172,12 +172,12 @@ const getFilesFromWildcards = (input, publicFolder) => {
172
172
 
173
173
  return output;
174
174
  };
175
- /**
176
- * Prepend the public folder to each file.
177
- *
178
- * @param {String|Array} input - Path to file(s)
179
- * @param {String} publicFolder - Path to the public folder
180
- * @return {Object}
175
+ /**
176
+ * Prepend the public folder to each file.
177
+ *
178
+ * @param {String|Array} input - Path to file(s)
179
+ * @param {String} publicFolder - Path to the public folder
180
+ * @return {Object}
181
181
  */
182
182
 
183
183
 
@@ -212,31 +212,31 @@ const setPublicFolder = (input, publicFolder) => {
212
212
  output.input = _path.default.normalize(publicFolder + input);
213
213
  return output;
214
214
  };
215
- /**
216
- * Check if some settings are here.
217
- *
218
- * @param {Object} settings
215
+ /**
216
+ * Check if some settings are here.
217
+ *
218
+ * @param {Object} settings
219
219
  */
220
220
 
221
221
 
222
222
  const checkMandatories = settings => {
223
223
  ['compressor', 'input', 'output'].forEach(item => mandatory(item, settings));
224
224
  };
225
- /**
226
- * Check if some settings are here for memory content.
227
- *
228
- * @param {Object} settings
225
+ /**
226
+ * Check if some settings are here for memory content.
227
+ *
228
+ * @param {Object} settings
229
229
  */
230
230
 
231
231
 
232
232
  const checkMandatoriesMemoryContent = settings => {
233
233
  ['compressor', 'content'].forEach(item => mandatory(item, settings));
234
234
  };
235
- /**
236
- * Check if the setting exist.
237
- *
238
- * @param {String} setting
239
- * @param {Object} settings
235
+ /**
236
+ * Check if the setting exist.
237
+ *
238
+ * @param {String} setting
239
+ * @param {Object} settings
240
240
  */
241
241
 
242
242
 
@@ -245,6 +245,6 @@ const mandatory = (setting, settings) => {
245
245
  throw new Error(setting + ' is mandatory.');
246
246
  }
247
247
  };
248
- /**
249
- * Expose `setup()`.
248
+ /**
249
+ * Expose `setup()`.
250
250
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/core",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "description": "core of @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "main": "lib/core.js",
14
14
  "engines": {
15
- "node": ">=10.0.0"
15
+ "node": ">=12.0.0"
16
16
  },
17
17
  "directories": {
18
18
  "lib": "lib",
@@ -32,9 +32,9 @@
32
32
  "url": "https://github.com/srod/node-minify/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@node-minify/utils": "^6.2.0",
36
- "globby": "11.0.2",
35
+ "@node-minify/utils": "^6.4.0",
36
+ "globby": "11.0.4",
37
37
  "mkdirp": "1.0.4"
38
38
  },
39
- "gitHead": "c191f2da661dafba035f9026a79fca56da76ead0"
39
+ "gitHead": "d529747a661487597e9be510d3d9e2df1bc0f556"
40
40
  }