tmcsplit 0.0.1 → 0.0.2
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/AUTHORS.rst +1 -1
- package/README.md +36 -238
- package/eslint.config.mjs +67 -25
- package/fs-worker.js +1 -0
- package/fs-worker.webpack.config.cjs +1 -1
- package/libtmcsplit +98 -0
- package/libtmcsplit.webpack.config.cjs +96 -0
- package/package.json +16 -9
- package/tmcsplit +215 -125
- package/tmcsplit.js +2 -0
- package/webpack.config.cjs +64 -4
package/AUTHORS.rst
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
3
|
|
|
4
4
|
----------------------------------------------------------------------
|
|
5
|
-
Copyright © 2024, 2025 Pellegrino Prevete
|
|
5
|
+
Copyright © 2024, 2025, 2026 Pellegrino Prevete
|
|
6
6
|
|
|
7
7
|
All rights reserved
|
|
8
8
|
----------------------------------------------------------------------
|
package/README.md
CHANGED
|
@@ -22,10 +22,18 @@
|
|
|
22
22
|
|
|
23
23
|
# The Martian Company's Split (`tmcsplit`)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Javascript GNU Split rewrite.
|
|
26
|
+
|
|
26
27
|
Splittable with number of parts or maximum bytes per part.
|
|
27
28
|
|
|
28
|
-
It works both in Node.js and in web browsers
|
|
29
|
+
It works both in Node.js and in web browsers
|
|
30
|
+
using the
|
|
31
|
+
[Crash Javacript](
|
|
32
|
+
https://github.com/themartiancompany/crash-js)
|
|
33
|
+
and
|
|
34
|
+
[Split File](
|
|
35
|
+
https://github.com/themartiancompany/node-split-file)
|
|
36
|
+
modules.
|
|
29
37
|
|
|
30
38
|
### Installation
|
|
31
39
|
|
|
@@ -36,197 +44,21 @@ with the following command:
|
|
|
36
44
|
npm \
|
|
37
45
|
install \
|
|
38
46
|
--save \
|
|
39
|
-
@themartiancompany/
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Usage
|
|
43
|
-
|
|
44
|
-
All methods return a `Promise` (`bluebird`)
|
|
45
|
-
which results in some respose if some.
|
|
46
|
-
|
|
47
|
-
#### Splitting file with number of parts
|
|
48
|
-
|
|
49
|
-
```javascript
|
|
50
|
-
_split_file(
|
|
51
|
-
_input_file,
|
|
52
|
-
_output_dir?) => Promise<string[]>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Consumes**:
|
|
56
|
-
- `_input_file`:
|
|
57
|
-
Path to the file to split.
|
|
58
|
-
- `_output_dir`:
|
|
59
|
-
Folder for output, defaults to `.` (current folder)
|
|
60
|
-
|
|
61
|
-
**Produces**:
|
|
62
|
-
- `Promise<string[]>`:
|
|
63
|
-
Promise with results in an array of part
|
|
64
|
-
names (full paths) of the splitted files.
|
|
65
|
-
|
|
66
|
-
#### Example
|
|
67
|
-
|
|
68
|
-
```javascript
|
|
69
|
-
const
|
|
70
|
-
_split_file_module =
|
|
71
|
-
require(
|
|
72
|
-
'split-file');
|
|
73
|
-
_split_file =
|
|
74
|
-
_split_file_module._split_file;
|
|
75
|
-
const
|
|
76
|
-
_input_file =
|
|
77
|
-
__dirname +
|
|
78
|
-
'/testfile.bin';
|
|
79
|
-
const
|
|
80
|
-
_parts_amount =
|
|
81
|
-
3;
|
|
82
|
-
const
|
|
83
|
-
_error_callback =
|
|
84
|
-
function (
|
|
85
|
-
_error) {
|
|
86
|
-
const
|
|
87
|
-
_log =
|
|
88
|
-
console.log;
|
|
89
|
-
_log(
|
|
90
|
-
'Error: ',
|
|
91
|
-
_error);
|
|
92
|
-
};
|
|
93
|
-
_split_file(
|
|
94
|
-
_input_file,
|
|
95
|
-
_parts_amount)
|
|
96
|
-
.then(
|
|
97
|
-
(_output_files) => {
|
|
98
|
-
console.log(
|
|
99
|
-
_output_files);
|
|
100
|
-
})
|
|
101
|
-
.catch(
|
|
102
|
-
_error_callback);
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
#### Splitting file with maximum bytes per part
|
|
106
|
-
|
|
107
|
-
```javascript
|
|
108
|
-
_split_file_by_size(
|
|
109
|
-
_input_file,
|
|
110
|
-
_size_max,
|
|
111
|
-
_output_dir?) => Promise<string[]>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**Consumes**:
|
|
115
|
-
- `_input_file`:
|
|
116
|
-
Path to the file to split.
|
|
117
|
-
- `_size_max`:
|
|
118
|
-
Max size of the splitted parts. (bytes)
|
|
119
|
-
- `_output_dir`:
|
|
120
|
-
Folder for output, defaults to `.` (current folder)
|
|
121
|
-
|
|
122
|
-
**Produces**:
|
|
123
|
-
- `Promise<string[]>`:
|
|
124
|
-
Promise with results in an array of part
|
|
125
|
-
names (full paths) of the splitted files.
|
|
126
|
-
|
|
127
|
-
##### Example
|
|
128
|
-
|
|
129
|
-
```javascript
|
|
130
|
-
const
|
|
131
|
-
_split_file_module =
|
|
132
|
-
require(
|
|
133
|
-
'split-file');
|
|
134
|
-
_split_file_by_size =
|
|
135
|
-
_split_file_module._split_file_by_size;
|
|
136
|
-
const
|
|
137
|
-
_input_file =
|
|
138
|
-
__dirname +
|
|
139
|
-
'/testfile.bin';
|
|
140
|
-
_size_max =
|
|
141
|
-
457000;
|
|
142
|
-
const
|
|
143
|
-
_error_callback =
|
|
144
|
-
function (
|
|
145
|
-
_error) {
|
|
146
|
-
const
|
|
147
|
-
_log =
|
|
148
|
-
console.log;
|
|
149
|
-
_log(
|
|
150
|
-
'Error: ',
|
|
151
|
-
_error);
|
|
152
|
-
};
|
|
153
|
-
_split_file_by_size(
|
|
154
|
-
_input_file,
|
|
155
|
-
_size_max)
|
|
156
|
-
.then(
|
|
157
|
-
(_output_files) => {
|
|
158
|
-
console.log(
|
|
159
|
-
_output_files);
|
|
160
|
-
})
|
|
161
|
-
.catch(
|
|
162
|
-
_error_callback);
|
|
47
|
+
@themartiancompany/tmcsplit
|
|
163
48
|
```
|
|
164
49
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
```javascript
|
|
168
|
-
_merge_files(
|
|
169
|
-
_input_files,
|
|
170
|
-
_output_file) => Promise<>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**Consumes**:
|
|
174
|
-
- `_input_files`:
|
|
175
|
-
Input files, array with full part paths.
|
|
176
|
-
- `_output_file`:
|
|
177
|
-
Full path of the output file.
|
|
178
|
-
|
|
179
|
-
**Produces**:
|
|
180
|
-
- `Promise<>`:
|
|
181
|
-
Promise that results in an empty resolving.
|
|
50
|
+
You can then run the program with
|
|
182
51
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
_split_file_module =
|
|
188
|
-
require(
|
|
189
|
-
'split-file');
|
|
190
|
-
_merge_files =
|
|
191
|
-
_split_file_module._merge_files;
|
|
192
|
-
const
|
|
193
|
-
_input_files = [
|
|
194
|
-
__dirname + '/file_a',
|
|
195
|
-
__dirname + '/file_b'
|
|
196
|
-
];
|
|
197
|
-
const
|
|
198
|
-
_output_file =
|
|
199
|
-
__dirname +
|
|
200
|
-
'/testfile-output.bin';
|
|
201
|
-
const
|
|
202
|
-
_error_callback =
|
|
203
|
-
function (
|
|
204
|
-
_error) {
|
|
205
|
-
const
|
|
206
|
-
_log =
|
|
207
|
-
console.log;
|
|
208
|
-
_log(
|
|
209
|
-
'Error: ',
|
|
210
|
-
_error);
|
|
211
|
-
};
|
|
212
|
-
_merge_files(
|
|
213
|
-
_input_files,
|
|
214
|
-
_output_file)
|
|
215
|
-
.then(
|
|
216
|
-
() => {
|
|
217
|
-
console.log(
|
|
218
|
-
'Done!');
|
|
219
|
-
})
|
|
220
|
-
.catch(
|
|
221
|
-
_error_callback);
|
|
52
|
+
```bash
|
|
53
|
+
npx \
|
|
54
|
+
"tmcsplit"
|
|
222
55
|
```
|
|
223
56
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
either use npm and install this package in your global context
|
|
57
|
+
or just with `tmcsplit` if you install
|
|
58
|
+
the program system-wide using npm from this source
|
|
59
|
+
repository or from the
|
|
60
|
+
[NPM Registry](
|
|
61
|
+
https://www.npmjs.com/package/tmcsplit)
|
|
230
62
|
|
|
231
63
|
```
|
|
232
64
|
npm \
|
|
@@ -235,7 +67,7 @@ npm \
|
|
|
235
67
|
"split-file"
|
|
236
68
|
```
|
|
237
69
|
|
|
238
|
-
or
|
|
70
|
+
or if using GNU make in this repository
|
|
239
71
|
|
|
240
72
|
```bash
|
|
241
73
|
make \
|
|
@@ -245,61 +77,27 @@ make \
|
|
|
245
77
|
**Note:** You may need admin rights (`sudo`,
|
|
246
78
|
`su -c` or on Windows `Run as administrator`).
|
|
247
79
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
80
|
+
or if you install it as a
|
|
81
|
+
[DogeOS](
|
|
82
|
+
https://github.com/themartiancompany/dogeos)
|
|
83
|
+
package from the
|
|
84
|
+
[Ur](
|
|
85
|
+
https://github.com/themartiancompany/ur)
|
|
253
86
|
|
|
254
87
|
```bash
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
Usage:
|
|
259
|
-
|
|
260
|
-
split-file
|
|
261
|
-
<option>
|
|
262
|
-
[arguments]
|
|
263
|
-
|
|
264
|
-
options:
|
|
265
|
-
|
|
266
|
-
-s Split the input file in
|
|
267
|
-
<input> the given number of parts.
|
|
268
|
-
<num_parts>
|
|
88
|
+
ur \
|
|
89
|
+
tmcsplit
|
|
90
|
+
```
|
|
269
91
|
|
|
270
|
-
|
|
271
|
-
<input>
|
|
272
|
-
<max_size> Split the input file into
|
|
273
|
-
multiple parts with maximum
|
|
274
|
-
file size of max_size bytes.
|
|
92
|
+
### Documentation
|
|
275
93
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
examples:
|
|
282
|
-
|
|
283
|
-
split-file \
|
|
284
|
-
-s \
|
|
285
|
-
"input.bin" \
|
|
286
|
-
5
|
|
287
|
-
|
|
288
|
-
split-file \
|
|
289
|
-
-x \
|
|
290
|
-
"input.bin" \
|
|
291
|
-
457000
|
|
292
|
-
|
|
293
|
-
split-file \
|
|
294
|
-
-m \
|
|
295
|
-
"output.bin" \
|
|
296
|
-
"part1" "part2" ...
|
|
297
|
-
```
|
|
94
|
+
Upon installation the manual can be accessed with
|
|
95
|
+
`man tmcsplit` but really it's the same as
|
|
96
|
+
GNU Split, so you can also refer to `man split`
|
|
97
|
+
for what is it implemented.
|
|
298
98
|
|
|
299
99
|
# License
|
|
300
100
|
|
|
301
|
-
|
|
302
|
-
of the MIT license;
|
|
303
|
-
work authored by Pellegrino Prevete is released
|
|
101
|
+
This software by Pellegrino Prevete is released
|
|
304
102
|
under the terms of the GNU Affero General Public License
|
|
305
103
|
version 3.
|
package/eslint.config.mjs
CHANGED
|
@@ -1,38 +1,80 @@
|
|
|
1
|
-
|
|
2
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
/** ----------------------------------------------------------------------
|
|
4
|
+
* Copyright ©
|
|
5
|
+
* Pellegrino Prevete
|
|
6
|
+
* 2024, 2025, 2026
|
|
7
|
+
*
|
|
8
|
+
* All rights reserved
|
|
9
|
+
* ----------------------------------------------------------------------
|
|
10
|
+
*
|
|
11
|
+
* This program is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
25
|
|
|
26
|
+
import js from "@eslint/js";
|
|
27
|
+
import globals from "globals";
|
|
26
28
|
import { defineConfig } from "eslint/config";
|
|
27
29
|
|
|
30
|
+
const
|
|
31
|
+
_project =
|
|
32
|
+
"tmcsplit";
|
|
33
|
+
|
|
28
34
|
export default defineConfig([
|
|
29
|
-
{
|
|
35
|
+
{
|
|
36
|
+
ignores: [
|
|
37
|
+
"build/**",
|
|
38
|
+
"node_modules/**",
|
|
39
|
+
"eslint.config.js",
|
|
40
|
+
"man/**"
|
|
41
|
+
],
|
|
42
|
+
rules:
|
|
43
|
+
{ semi:
|
|
44
|
+
"error",
|
|
45
|
+
"prefer-const":
|
|
46
|
+
"error" },
|
|
47
|
+
files:
|
|
48
|
+
[ "**/*js,mjs,cjs}",
|
|
49
|
+
`**/${_project}*`,
|
|
50
|
+
`**/lib${_project}`
|
|
51
|
+
],
|
|
52
|
+
plugins:
|
|
53
|
+
{ js },
|
|
54
|
+
extends:
|
|
55
|
+
[ "js/recommended" ],
|
|
56
|
+
languageOptions:
|
|
57
|
+
{ globals:
|
|
58
|
+
{ ...globals.browser,
|
|
59
|
+
...globals.node } } },
|
|
60
|
+
{
|
|
61
|
+
ignores: [
|
|
30
62
|
"build/**",
|
|
31
|
-
"eslint.config.js"
|
|
63
|
+
"eslint.config.js",
|
|
64
|
+
"node_modules/**",
|
|
65
|
+
"man/**"
|
|
32
66
|
],
|
|
33
67
|
rules:
|
|
34
68
|
{ semi:
|
|
35
69
|
"error",
|
|
36
70
|
"prefer-const":
|
|
37
|
-
"error" }
|
|
71
|
+
"error" },
|
|
72
|
+
files:
|
|
73
|
+
[ "**/*.js",
|
|
74
|
+
`**/${_project}*`,
|
|
75
|
+
`**/lib${_project}`,
|
|
76
|
+
],
|
|
77
|
+
languageOptions:
|
|
78
|
+
{ sourceType:
|
|
79
|
+
"commonjs" } },
|
|
38
80
|
]);
|
package/fs-worker.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var e={816(e,o,n){function t(){let e;return"undefined"==typeof window&&void 0!==n.g&&n.g.global===n.g&&"function"!=typeof n||(e=function(){let e;try{e=n(816)}catch(e){console.log(e);const o="Error importing the '@themartiancompany/opfs' module as 'opfs'. If you got this error while bundling a webpack for a project depending on this module double check its 'webpack.config.js' file or whether the 'opfs' module is listed in developer dependencies and install them.I'm sorry for this inconvenience but Node packagement system does not currently distinguish 'development' from 'build' dependencies.";throw console.error(o),e}return e}()),e}const r=t();e.exports=r,e.exports.getModule=function(e){let o;if(""==_module_name||"undefined"==typeof _module_name)o=t();else if("opfs"==_module_name)o=n(816);else{if("fs"!=_module_name){const e="Unknown file system module "+`'${_module_name}'.`.const;throw _error={msg:e},console.error(e),_error}o=n(816)}return o}},314(e,o,n){const t=n(816);_sync_agent=t.startSyncAgent,e.exports={_sync_agent},_sync_agent()}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(314)})();
|
package/libtmcsplit
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
/** ----------------------------------------------------------------------
|
|
6
|
+
* libtmcsplit
|
|
7
|
+
* ----------------------------------------------------------------------
|
|
8
|
+
* Copyright ©
|
|
9
|
+
* Pellegrino Prevete
|
|
10
|
+
* 2024, 2025, 2026
|
|
11
|
+
*
|
|
12
|
+
* All rights reserved
|
|
13
|
+
* ----------------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* This program is free software: you can redistribute it and/or modify
|
|
16
|
+
* it under the terms of the GNU General Public License as published by
|
|
17
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
18
|
+
* (at your option) any later version.
|
|
19
|
+
*
|
|
20
|
+
* This program is distributed in the hope that it will be useful,
|
|
21
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
* GNU General Public License for more details.
|
|
24
|
+
*
|
|
25
|
+
* You should have received a copy of the GNU General Public License
|
|
26
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/* eslint
|
|
30
|
+
no-unused-vars: [
|
|
31
|
+
"error",
|
|
32
|
+
{ "vars":
|
|
33
|
+
"local" } ] */
|
|
34
|
+
|
|
35
|
+
const
|
|
36
|
+
_split_file_module =
|
|
37
|
+
require(
|
|
38
|
+
'split-file');
|
|
39
|
+
const
|
|
40
|
+
_split_file =
|
|
41
|
+
_split_file_module._split_file;
|
|
42
|
+
const
|
|
43
|
+
_split_file_by_size =
|
|
44
|
+
_split_file_module._split_file_by_size;
|
|
45
|
+
const
|
|
46
|
+
_libcrash =
|
|
47
|
+
require(
|
|
48
|
+
'crash-js');
|
|
49
|
+
const
|
|
50
|
+
_msg_info =
|
|
51
|
+
_libcrash._msg_info;
|
|
52
|
+
const
|
|
53
|
+
_msg_error =
|
|
54
|
+
_libcrash._msg_error;
|
|
55
|
+
|
|
56
|
+
async function
|
|
57
|
+
_split(
|
|
58
|
+
_input_file,
|
|
59
|
+
_output_prefix,
|
|
60
|
+
_chunks_amount,
|
|
61
|
+
_size_max) {
|
|
62
|
+
let
|
|
63
|
+
_msg;
|
|
64
|
+
const
|
|
65
|
+
_chunks_amount_not_number =
|
|
66
|
+
isNaN(_chunks_amount);
|
|
67
|
+
if ( _chunks_amount_not_number ) {
|
|
68
|
+
_msg =
|
|
69
|
+
"Chunks amount must be a number.";
|
|
70
|
+
_msg_error(
|
|
71
|
+
_msg,
|
|
72
|
+
1);
|
|
73
|
+
}
|
|
74
|
+
_msg =
|
|
75
|
+
`Splitting '${_input_file}' ` +
|
|
76
|
+
`into '${_chunks_amount}' of size '${_size_max}' ` +
|
|
77
|
+
`into files with prefix '${_output_prefix}':`;
|
|
78
|
+
_msg_info(
|
|
79
|
+
_msg);
|
|
80
|
+
_size_max =
|
|
81
|
+
Number(
|
|
82
|
+
_size_max);
|
|
83
|
+
if ( _chunks_amount > 0 ) {
|
|
84
|
+
_split_file(
|
|
85
|
+
_input_file,
|
|
86
|
+
_chunks_amount);
|
|
87
|
+
}
|
|
88
|
+
else if ( _size_max > 0 ) {
|
|
89
|
+
await _split_file_by_size(
|
|
90
|
+
_input_file,
|
|
91
|
+
_size_max);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports = {
|
|
96
|
+
_split:
|
|
97
|
+
_split
|
|
98
|
+
};
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/** ----------------------------------------------------------------------
|
|
2
|
+
* libtmcsplit.webpack.config.cjs
|
|
3
|
+
* ----------------------------------------------------------------------
|
|
4
|
+
* Copyright ©
|
|
5
|
+
* Pellegrino Prevete
|
|
6
|
+
* 2025, 2026
|
|
7
|
+
*
|
|
8
|
+
* All rights reserved
|
|
9
|
+
* ----------------------------------------------------------------------
|
|
10
|
+
*
|
|
11
|
+
* This program is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
|
|
1
25
|
const
|
|
2
26
|
_path =
|
|
3
27
|
require(
|
|
@@ -22,6 +46,45 @@ const
|
|
|
22
46
|
filename:
|
|
23
47
|
_output_file_name
|
|
24
48
|
};
|
|
49
|
+
const
|
|
50
|
+
_utils_ignore =
|
|
51
|
+
{ resourceRegExp:
|
|
52
|
+
/^utils$/ };
|
|
53
|
+
const
|
|
54
|
+
_web_worker_ignore =
|
|
55
|
+
{ resourceRegExp:
|
|
56
|
+
/^web-worker$/ };
|
|
57
|
+
const
|
|
58
|
+
_yargs_ignore =
|
|
59
|
+
{ resourceRegExp:
|
|
60
|
+
/^yargs$/ };
|
|
61
|
+
const
|
|
62
|
+
_yargs_helpers_ignore =
|
|
63
|
+
{ resourceRegExp:
|
|
64
|
+
/^yargs\/helpers$/ };
|
|
65
|
+
const
|
|
66
|
+
_webpack =
|
|
67
|
+
require(
|
|
68
|
+
"webpack");
|
|
69
|
+
const
|
|
70
|
+
_ignore_plugin =
|
|
71
|
+
_webpack.IgnorePlugin;
|
|
72
|
+
const
|
|
73
|
+
_utils_ignore_plugin =
|
|
74
|
+
new _ignore_plugin(
|
|
75
|
+
_utils_ignore);
|
|
76
|
+
const
|
|
77
|
+
_web_worker_ignore_plugin =
|
|
78
|
+
new _ignore_plugin(
|
|
79
|
+
_web_worker_ignore);
|
|
80
|
+
const
|
|
81
|
+
_yargs_ignore_plugin =
|
|
82
|
+
new _ignore_plugin(
|
|
83
|
+
_yargs_ignore);
|
|
84
|
+
const
|
|
85
|
+
_yargs_helpers_ignore_plugin =
|
|
86
|
+
new _ignore_plugin(
|
|
87
|
+
_yargs_helpers_ignore);
|
|
25
88
|
module.exports = {
|
|
26
89
|
entry:
|
|
27
90
|
_input_file_path,
|
|
@@ -40,6 +103,39 @@ module.exports = {
|
|
|
40
103
|
_path.resolve(
|
|
41
104
|
__dirname,
|
|
42
105
|
'node_modules/path/mod.js'),
|
|
106
|
+
"web-worker":
|
|
107
|
+
_path.resolve(
|
|
108
|
+
__dirname,
|
|
109
|
+
'node_modules/web-worker/mod.js'),
|
|
110
|
+
"yargs":
|
|
111
|
+
_path.resolve(
|
|
112
|
+
__dirname,
|
|
113
|
+
'node_modules/yargs/browser.mjs'),
|
|
114
|
+
"yargs/helpers":
|
|
115
|
+
_path.resolve(
|
|
116
|
+
__dirname,
|
|
117
|
+
'node_modules/yargs/helpers/helpers.mjs'),
|
|
118
|
+
"yargs-parser":
|
|
119
|
+
_path.resolve(
|
|
120
|
+
__dirname,
|
|
121
|
+
'node_modules/yargs-parser/browser.mjs'),
|
|
43
122
|
},
|
|
123
|
+
fallback: {
|
|
124
|
+
"utils":
|
|
125
|
+
false,
|
|
126
|
+
"web-worker":
|
|
127
|
+
false,
|
|
128
|
+
"yargs":
|
|
129
|
+
false,
|
|
130
|
+
"yargs/helpers":
|
|
131
|
+
false,
|
|
132
|
+
}
|
|
44
133
|
},
|
|
134
|
+
externals:
|
|
135
|
+
{ yargs:
|
|
136
|
+
'yargs' },
|
|
137
|
+
plugins: [
|
|
138
|
+
_yargs_ignore_plugin,
|
|
139
|
+
_yargs_helpers_ignore_plugin
|
|
140
|
+
]
|
|
45
141
|
};
|