innetjs 2.6.0-alpha.5 → 2.6.0-alpha.7
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/_virtual/_rollup-plugin-process-env.js +1 -1
- package/_virtual/_rollup-plugin-process-env.mjs +1 -1
- package/bin/innet +22 -55
- package/index.d.ts +1 -1
- package/index.js +19 -10
- package/index.mjs +18 -10
- package/package.json +1 -1
- package/extract.d.ts +0 -1
- package/extract.js +0 -49
- package/extract.mjs +0 -45
package/bin/innet
CHANGED
|
@@ -22,7 +22,7 @@ var glob = require('glob');
|
|
|
22
22
|
var http = require('node:http');
|
|
23
23
|
var https = require('node:https');
|
|
24
24
|
var linesAndColumns = require('lines-and-columns');
|
|
25
|
-
var path
|
|
25
|
+
var path = require('node:path');
|
|
26
26
|
var prompt = require('prompts');
|
|
27
27
|
var rollup = require('rollup');
|
|
28
28
|
var external = require('rollup-plugin-external-node-modules');
|
|
@@ -34,9 +34,10 @@ var rollupPluginPreserveShebangs = require('rollup-plugin-preserve-shebangs');
|
|
|
34
34
|
var env = require('rollup-plugin-process-env');
|
|
35
35
|
var styles = require('rollup-plugin-styles');
|
|
36
36
|
var rollupPluginTerser = require('rollup-plugin-terser');
|
|
37
|
+
var stream = require('node:stream');
|
|
37
38
|
var tmp = require('tmp');
|
|
38
|
-
var node_util = require('node:util');
|
|
39
39
|
var unzipper = require('unzipper');
|
|
40
|
+
var node_util = require('node:util');
|
|
40
41
|
|
|
41
42
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
42
43
|
|
|
@@ -57,7 +58,7 @@ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
|
57
58
|
var glob__default = /*#__PURE__*/_interopDefaultLegacy(glob);
|
|
58
59
|
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
59
60
|
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
60
|
-
var path__default = /*#__PURE__*/_interopDefaultLegacy(path
|
|
61
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
61
62
|
var prompt__default = /*#__PURE__*/_interopDefaultLegacy(prompt);
|
|
62
63
|
var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
|
|
63
64
|
var external__default = /*#__PURE__*/_interopDefaultLegacy(external);
|
|
@@ -67,6 +68,7 @@ var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
|
|
|
67
68
|
var polyfill__default = /*#__PURE__*/_interopDefaultLegacy(polyfill);
|
|
68
69
|
var env__default = /*#__PURE__*/_interopDefaultLegacy(env);
|
|
69
70
|
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
71
|
+
var stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);
|
|
70
72
|
var tmp__default = /*#__PURE__*/_interopDefaultLegacy(tmp);
|
|
71
73
|
|
|
72
74
|
const lintInclude = [
|
|
@@ -97,48 +99,6 @@ const stringExcludeNode = [
|
|
|
97
99
|
'**/*.json',
|
|
98
100
|
];
|
|
99
101
|
|
|
100
|
-
const Writer = require('fstream').Writer;
|
|
101
|
-
const path = require('path');
|
|
102
|
-
const stream = require('stream');
|
|
103
|
-
const duplexer2 = require('duplexer2');
|
|
104
|
-
const Promise$1 = require('bluebird');
|
|
105
|
-
function Extract(opts, template) {
|
|
106
|
-
const reduceCount = 19 + template.length;
|
|
107
|
-
// make sure path is normalized before using it
|
|
108
|
-
opts.path = path.resolve(path.normalize(opts.path));
|
|
109
|
-
// @ts-expect-error
|
|
110
|
-
const parser = new unzipper.Parse(opts);
|
|
111
|
-
const outStream = new stream.Writable({ objectMode: true });
|
|
112
|
-
outStream._write = function (entry, encoding, cb) {
|
|
113
|
-
if (entry.type === 'Directory')
|
|
114
|
-
return cb();
|
|
115
|
-
const extractPath = path.join(opts.path, entry.path.slice(reduceCount));
|
|
116
|
-
if (extractPath.indexOf(opts.path) !== 0) {
|
|
117
|
-
return cb();
|
|
118
|
-
}
|
|
119
|
-
const writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
|
|
120
|
-
entry.pipe(writer)
|
|
121
|
-
.on('error', cb)
|
|
122
|
-
.on('close', cb);
|
|
123
|
-
};
|
|
124
|
-
const extract = duplexer2(parser, outStream);
|
|
125
|
-
parser.once('crx-header', function (crxHeader) {
|
|
126
|
-
extract.crxHeader = crxHeader;
|
|
127
|
-
});
|
|
128
|
-
parser
|
|
129
|
-
.pipe(outStream)
|
|
130
|
-
.on('finish', function () {
|
|
131
|
-
extract.emit('close');
|
|
132
|
-
});
|
|
133
|
-
extract.promise = function () {
|
|
134
|
-
return new Promise$1(function (resolve, reject) {
|
|
135
|
-
extract.on('close', resolve);
|
|
136
|
-
extract.on('error', reject);
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
return extract;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
102
|
function getFile(file) {
|
|
143
103
|
file = path__default["default"].resolve(file);
|
|
144
104
|
if (!fs__default["default"].existsSync(file)) {
|
|
@@ -194,6 +154,7 @@ const readline = require('readline');
|
|
|
194
154
|
const importAssets = require('rollup-plugin-import-assets');
|
|
195
155
|
const execAsync = node_util.promisify(exec);
|
|
196
156
|
const copyFiles = node_util.promisify(fs__default["default"].copy);
|
|
157
|
+
const pipeline = node_util.promisify(stream__default["default"].pipeline);
|
|
197
158
|
updateDotenv();
|
|
198
159
|
const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
199
160
|
const REG_RPT_ERROR_FILE = /(src[^:]+):(\d+):(\d+)/;
|
|
@@ -266,13 +227,15 @@ class InnetJS {
|
|
|
266
227
|
}));
|
|
267
228
|
}
|
|
268
229
|
yield logger__default["default"].start('Download template', () => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
const zipPath = `${path__default["default"].join(appPath, 'template.zip')}`;
|
|
269
231
|
const { data } = yield axios__default["default"].get(`https://github.com/d8corp/innetjs-templates/archive/refs/heads/${template}.zip`, {
|
|
270
232
|
responseType: 'stream',
|
|
271
233
|
});
|
|
234
|
+
yield pipeline(data, fs__default["default"].createWriteStream(zipPath));
|
|
272
235
|
yield new Promise((resolve, reject) => {
|
|
273
|
-
|
|
274
|
-
path: appPath
|
|
275
|
-
|
|
236
|
+
fs__default["default"].createReadStream(zipPath)
|
|
237
|
+
.pipe(unzipper.Extract({ path: appPath }))
|
|
238
|
+
.on('finish', resolve).on('error', reject);
|
|
276
239
|
});
|
|
277
240
|
}));
|
|
278
241
|
yield logger__default["default"].start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
|
|
@@ -422,7 +385,7 @@ class InnetJS {
|
|
|
422
385
|
options.plugins.push(pluginNodeResolve.nodeResolve(), string({
|
|
423
386
|
include: '**/*.*',
|
|
424
387
|
exclude: stringExcludeNode,
|
|
425
|
-
}), this.createServer());
|
|
388
|
+
}), this.createServer(input));
|
|
426
389
|
}
|
|
427
390
|
else {
|
|
428
391
|
const key = path__default["default"].basename(this.sslKey) !== this.sslKey
|
|
@@ -787,21 +750,25 @@ class InnetJS {
|
|
|
787
750
|
}),
|
|
788
751
|
};
|
|
789
752
|
}
|
|
790
|
-
createServer() {
|
|
791
|
-
|
|
753
|
+
createServer(input) {
|
|
754
|
+
const apps = {};
|
|
792
755
|
return {
|
|
793
756
|
name: 'server',
|
|
794
757
|
writeBundle: () => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
795
|
-
|
|
796
|
-
const
|
|
797
|
-
|
|
758
|
+
var _a;
|
|
759
|
+
for (const file of input) {
|
|
760
|
+
const { name } = path__default["default"].parse(file);
|
|
761
|
+
(_a = apps[name]) === null || _a === void 0 ? void 0 : _a.kill();
|
|
762
|
+
const filePath = path__default["default"].resolve(this.devBuildFolder, `${name}.js`);
|
|
763
|
+
apps[name] = spawn('node', ['-r', 'source-map-support/register', filePath], { stdio: 'inherit' });
|
|
764
|
+
}
|
|
798
765
|
}),
|
|
799
766
|
};
|
|
800
767
|
}
|
|
801
768
|
}
|
|
802
769
|
|
|
803
770
|
(function () {
|
|
804
|
-
const env = {"__INNETJS__PACKAGE_VERSION":"2.6.0-alpha.
|
|
771
|
+
const env = {"__INNETJS__PACKAGE_VERSION":"2.6.0-alpha.7"};
|
|
805
772
|
if (typeof process === 'undefined') {
|
|
806
773
|
globalThis.process = { env: env };
|
|
807
774
|
} else if (process.env) {
|
package/index.d.ts
CHANGED
|
@@ -72,5 +72,5 @@ export declare class InnetJS {
|
|
|
72
72
|
increaseVersion(release: string): Promise<void>;
|
|
73
73
|
getPackage(): Promise<Record<string, any>>;
|
|
74
74
|
createClient(key: any, cert: any, pkg: any, index: string, inject: boolean): rollup.Plugin;
|
|
75
|
-
createServer(): rollup.Plugin;
|
|
75
|
+
createServer(input: string[]): rollup.Plugin;
|
|
76
76
|
}
|
package/index.js
CHANGED
|
@@ -35,10 +35,11 @@ var rollupPluginPreserveShebangs = require('rollup-plugin-preserve-shebangs');
|
|
|
35
35
|
var env = require('rollup-plugin-process-env');
|
|
36
36
|
var styles = require('rollup-plugin-styles');
|
|
37
37
|
var rollupPluginTerser = require('rollup-plugin-terser');
|
|
38
|
+
var stream = require('node:stream');
|
|
38
39
|
var tmp = require('tmp');
|
|
40
|
+
var unzipper = require('unzipper');
|
|
39
41
|
var node_util = require('node:util');
|
|
40
42
|
var constants = require('./constants.js');
|
|
41
|
-
var extract = require('./extract.js');
|
|
42
43
|
var helpers = require('./helpers.js');
|
|
43
44
|
var updateDotenv = require('./updateDotenv.js');
|
|
44
45
|
|
|
@@ -71,6 +72,7 @@ var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
|
|
|
71
72
|
var polyfill__default = /*#__PURE__*/_interopDefaultLegacy(polyfill);
|
|
72
73
|
var env__default = /*#__PURE__*/_interopDefaultLegacy(env);
|
|
73
74
|
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
75
|
+
var stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);
|
|
74
76
|
var tmp__default = /*#__PURE__*/_interopDefaultLegacy(tmp);
|
|
75
77
|
|
|
76
78
|
const livereload = require('rollup-plugin-livereload');
|
|
@@ -80,6 +82,7 @@ const readline = require('readline');
|
|
|
80
82
|
const importAssets = require('rollup-plugin-import-assets');
|
|
81
83
|
const execAsync = node_util.promisify(exec);
|
|
82
84
|
const copyFiles = node_util.promisify(fs__default["default"].copy);
|
|
85
|
+
const pipeline = node_util.promisify(stream__default["default"].pipeline);
|
|
83
86
|
updateDotenv.updateDotenv();
|
|
84
87
|
const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
85
88
|
const REG_RPT_ERROR_FILE = /(src[^:]+):(\d+):(\d+)/;
|
|
@@ -152,13 +155,15 @@ class InnetJS {
|
|
|
152
155
|
}));
|
|
153
156
|
}
|
|
154
157
|
yield logger__default["default"].start('Download template', () => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
const zipPath = `${path__default["default"].join(appPath, 'template.zip')}`;
|
|
155
159
|
const { data } = yield axios__default["default"].get(`https://github.com/d8corp/innetjs-templates/archive/refs/heads/${template}.zip`, {
|
|
156
160
|
responseType: 'stream',
|
|
157
161
|
});
|
|
162
|
+
yield pipeline(data, fs__default["default"].createWriteStream(zipPath));
|
|
158
163
|
yield new Promise((resolve, reject) => {
|
|
159
|
-
|
|
160
|
-
path: appPath
|
|
161
|
-
|
|
164
|
+
fs__default["default"].createReadStream(zipPath)
|
|
165
|
+
.pipe(unzipper.Extract({ path: appPath }))
|
|
166
|
+
.on('finish', resolve).on('error', reject);
|
|
162
167
|
});
|
|
163
168
|
}));
|
|
164
169
|
yield logger__default["default"].start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
|
|
@@ -308,7 +313,7 @@ class InnetJS {
|
|
|
308
313
|
options.plugins.push(pluginNodeResolve.nodeResolve(), string({
|
|
309
314
|
include: '**/*.*',
|
|
310
315
|
exclude: constants.stringExcludeNode,
|
|
311
|
-
}), this.createServer());
|
|
316
|
+
}), this.createServer(input));
|
|
312
317
|
}
|
|
313
318
|
else {
|
|
314
319
|
const key = path__default["default"].basename(this.sslKey) !== this.sslKey
|
|
@@ -673,14 +678,18 @@ class InnetJS {
|
|
|
673
678
|
}),
|
|
674
679
|
};
|
|
675
680
|
}
|
|
676
|
-
createServer() {
|
|
677
|
-
|
|
681
|
+
createServer(input) {
|
|
682
|
+
const apps = {};
|
|
678
683
|
return {
|
|
679
684
|
name: 'server',
|
|
680
685
|
writeBundle: () => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
681
|
-
|
|
682
|
-
const
|
|
683
|
-
|
|
686
|
+
var _a;
|
|
687
|
+
for (const file of input) {
|
|
688
|
+
const { name } = path__default["default"].parse(file);
|
|
689
|
+
(_a = apps[name]) === null || _a === void 0 ? void 0 : _a.kill();
|
|
690
|
+
const filePath = path__default["default"].resolve(this.devBuildFolder, `${name}.js`);
|
|
691
|
+
apps[name] = spawn('node', ['-r', 'source-map-support/register', filePath], { stdio: 'inherit' });
|
|
692
|
+
}
|
|
684
693
|
}),
|
|
685
694
|
};
|
|
686
695
|
}
|
package/index.mjs
CHANGED
|
@@ -31,10 +31,11 @@ import { preserveShebangs } from 'rollup-plugin-preserve-shebangs';
|
|
|
31
31
|
import env from 'rollup-plugin-process-env';
|
|
32
32
|
import styles from 'rollup-plugin-styles';
|
|
33
33
|
import { terser } from 'rollup-plugin-terser';
|
|
34
|
+
import stream from 'node:stream';
|
|
34
35
|
import tmp from 'tmp';
|
|
36
|
+
import { Extract } from 'unzipper';
|
|
35
37
|
import { promisify } from 'node:util';
|
|
36
38
|
import { stringExcludeNode, imageInclude, stringExcludeDom, lintInclude } from './constants.mjs';
|
|
37
|
-
import { Extract } from './extract.mjs';
|
|
38
39
|
import { reporter, convertIndexFile, getFile } from './helpers.mjs';
|
|
39
40
|
import { updateDotenv } from './updateDotenv.mjs';
|
|
40
41
|
|
|
@@ -45,6 +46,7 @@ const readline = require('readline');
|
|
|
45
46
|
const importAssets = require('rollup-plugin-import-assets');
|
|
46
47
|
const execAsync = promisify(exec);
|
|
47
48
|
const copyFiles = promisify(fs.copy);
|
|
49
|
+
const pipeline = promisify(stream.pipeline);
|
|
48
50
|
updateDotenv();
|
|
49
51
|
const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
50
52
|
const REG_RPT_ERROR_FILE = /(src[^:]+):(\d+):(\d+)/;
|
|
@@ -117,13 +119,15 @@ class InnetJS {
|
|
|
117
119
|
}));
|
|
118
120
|
}
|
|
119
121
|
yield logger.start('Download template', () => __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const zipPath = `${path.join(appPath, 'template.zip')}`;
|
|
120
123
|
const { data } = yield axios.get(`https://github.com/d8corp/innetjs-templates/archive/refs/heads/${template}.zip`, {
|
|
121
124
|
responseType: 'stream',
|
|
122
125
|
});
|
|
126
|
+
yield pipeline(data, fs.createWriteStream(zipPath));
|
|
123
127
|
yield new Promise((resolve, reject) => {
|
|
124
|
-
|
|
125
|
-
path: appPath
|
|
126
|
-
|
|
128
|
+
fs.createReadStream(zipPath)
|
|
129
|
+
.pipe(Extract({ path: appPath }))
|
|
130
|
+
.on('finish', resolve).on('error', reject);
|
|
127
131
|
});
|
|
128
132
|
}));
|
|
129
133
|
yield logger.start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
|
|
@@ -273,7 +277,7 @@ class InnetJS {
|
|
|
273
277
|
options.plugins.push(nodeResolve(), string({
|
|
274
278
|
include: '**/*.*',
|
|
275
279
|
exclude: stringExcludeNode,
|
|
276
|
-
}), this.createServer());
|
|
280
|
+
}), this.createServer(input));
|
|
277
281
|
}
|
|
278
282
|
else {
|
|
279
283
|
const key = path.basename(this.sslKey) !== this.sslKey
|
|
@@ -638,14 +642,18 @@ class InnetJS {
|
|
|
638
642
|
}),
|
|
639
643
|
};
|
|
640
644
|
}
|
|
641
|
-
createServer() {
|
|
642
|
-
|
|
645
|
+
createServer(input) {
|
|
646
|
+
const apps = {};
|
|
643
647
|
return {
|
|
644
648
|
name: 'server',
|
|
645
649
|
writeBundle: () => __awaiter(this, void 0, void 0, function* () {
|
|
646
|
-
|
|
647
|
-
const
|
|
648
|
-
|
|
650
|
+
var _a;
|
|
651
|
+
for (const file of input) {
|
|
652
|
+
const { name } = path.parse(file);
|
|
653
|
+
(_a = apps[name]) === null || _a === void 0 ? void 0 : _a.kill();
|
|
654
|
+
const filePath = path.resolve(this.devBuildFolder, `${name}.js`);
|
|
655
|
+
apps[name] = spawn('node', ['-r', 'source-map-support/register', filePath], { stdio: 'inherit' });
|
|
656
|
+
}
|
|
649
657
|
}),
|
|
650
658
|
};
|
|
651
659
|
}
|
package/package.json
CHANGED
package/extract.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function Extract(opts: any, template: any): any;
|
package/extract.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var unzipper = require('unzipper');
|
|
6
|
-
|
|
7
|
-
const Writer = require('fstream').Writer;
|
|
8
|
-
const path = require('path');
|
|
9
|
-
const stream = require('stream');
|
|
10
|
-
const duplexer2 = require('duplexer2');
|
|
11
|
-
const Promise$1 = require('bluebird');
|
|
12
|
-
function Extract(opts, template) {
|
|
13
|
-
const reduceCount = 19 + template.length;
|
|
14
|
-
// make sure path is normalized before using it
|
|
15
|
-
opts.path = path.resolve(path.normalize(opts.path));
|
|
16
|
-
// @ts-expect-error
|
|
17
|
-
const parser = new unzipper.Parse(opts);
|
|
18
|
-
const outStream = new stream.Writable({ objectMode: true });
|
|
19
|
-
outStream._write = function (entry, encoding, cb) {
|
|
20
|
-
if (entry.type === 'Directory')
|
|
21
|
-
return cb();
|
|
22
|
-
const extractPath = path.join(opts.path, entry.path.slice(reduceCount));
|
|
23
|
-
if (extractPath.indexOf(opts.path) !== 0) {
|
|
24
|
-
return cb();
|
|
25
|
-
}
|
|
26
|
-
const writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
|
|
27
|
-
entry.pipe(writer)
|
|
28
|
-
.on('error', cb)
|
|
29
|
-
.on('close', cb);
|
|
30
|
-
};
|
|
31
|
-
const extract = duplexer2(parser, outStream);
|
|
32
|
-
parser.once('crx-header', function (crxHeader) {
|
|
33
|
-
extract.crxHeader = crxHeader;
|
|
34
|
-
});
|
|
35
|
-
parser
|
|
36
|
-
.pipe(outStream)
|
|
37
|
-
.on('finish', function () {
|
|
38
|
-
extract.emit('close');
|
|
39
|
-
});
|
|
40
|
-
extract.promise = function () {
|
|
41
|
-
return new Promise$1(function (resolve, reject) {
|
|
42
|
-
extract.on('close', resolve);
|
|
43
|
-
extract.on('error', reject);
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
return extract;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
exports.Extract = Extract;
|
package/extract.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Parse } from 'unzipper';
|
|
2
|
-
|
|
3
|
-
const Writer = require('fstream').Writer;
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const stream = require('stream');
|
|
6
|
-
const duplexer2 = require('duplexer2');
|
|
7
|
-
const Promise$1 = require('bluebird');
|
|
8
|
-
function Extract(opts, template) {
|
|
9
|
-
const reduceCount = 19 + template.length;
|
|
10
|
-
// make sure path is normalized before using it
|
|
11
|
-
opts.path = path.resolve(path.normalize(opts.path));
|
|
12
|
-
// @ts-expect-error
|
|
13
|
-
const parser = new Parse(opts);
|
|
14
|
-
const outStream = new stream.Writable({ objectMode: true });
|
|
15
|
-
outStream._write = function (entry, encoding, cb) {
|
|
16
|
-
if (entry.type === 'Directory')
|
|
17
|
-
return cb();
|
|
18
|
-
const extractPath = path.join(opts.path, entry.path.slice(reduceCount));
|
|
19
|
-
if (extractPath.indexOf(opts.path) !== 0) {
|
|
20
|
-
return cb();
|
|
21
|
-
}
|
|
22
|
-
const writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
|
|
23
|
-
entry.pipe(writer)
|
|
24
|
-
.on('error', cb)
|
|
25
|
-
.on('close', cb);
|
|
26
|
-
};
|
|
27
|
-
const extract = duplexer2(parser, outStream);
|
|
28
|
-
parser.once('crx-header', function (crxHeader) {
|
|
29
|
-
extract.crxHeader = crxHeader;
|
|
30
|
-
});
|
|
31
|
-
parser
|
|
32
|
-
.pipe(outStream)
|
|
33
|
-
.on('finish', function () {
|
|
34
|
-
extract.emit('close');
|
|
35
|
-
});
|
|
36
|
-
extract.promise = function () {
|
|
37
|
-
return new Promise$1(function (resolve, reject) {
|
|
38
|
-
extract.on('close', resolve);
|
|
39
|
-
extract.on('error', reject);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
return extract;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { Extract };
|