innetjs 1.12.0 → 2.0.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.
Files changed (38) hide show
  1. package/README.md +0 -3
  2. package/bin/innet +144 -68
  3. package/declaration.d.ts +39 -0
  4. package/extract.d.ts +1 -0
  5. package/index.d.ts +6 -2
  6. package/index.es6.js +165 -91
  7. package/index.js +143 -67
  8. package/package.json +17 -14
  9. package/templates/be/.env +0 -1
  10. package/templates/be/README.md +0 -15
  11. package/templates/be/package.json +0 -13
  12. package/templates/be/src/controller/index.tsx +0 -7
  13. package/templates/be/src/declaration.d.ts +0 -4
  14. package/templates/be/src/index.tsx +0 -6
  15. package/templates/be/src/view/App/App.css +0 -12
  16. package/templates/be/src/view/App/App.tsx +0 -15
  17. package/templates/be/src/view/App/index.ts +0 -1
  18. package/templates/be/src/view/Page/Page.css +0 -7
  19. package/templates/be/src/view/Page/Page.tsx +0 -24
  20. package/templates/be/src/view/Page/index.ts +0 -1
  21. package/templates/be/src/view/index.ts +0 -2
  22. package/templates/be/tsconfig.json +0 -31
  23. package/templates/fe/.env +0 -1
  24. package/templates/fe/README.md +0 -84
  25. package/templates/fe/package.json +0 -16
  26. package/templates/fe/public/favicon.ico +0 -0
  27. package/templates/fe/public/index.html +0 -14
  28. package/templates/fe/src/App.scss +0 -48
  29. package/templates/fe/src/App.tsx +0 -36
  30. package/templates/fe/src/componenst/Page/Page.scss +0 -22
  31. package/templates/fe/src/componenst/Page/Page.tsx +0 -18
  32. package/templates/fe/src/componenst/Page/index.ts +0 -1
  33. package/templates/fe/src/declaration.d.ts +0 -9
  34. package/templates/fe/src/index.tsx +0 -6
  35. package/templates/fe/src/pages/HomePage/HomePage.scss +0 -25
  36. package/templates/fe/src/pages/HomePage/HomePage.tsx +0 -24
  37. package/templates/fe/src/pages/HomePage/index.ts +0 -1
  38. package/templates/fe/tsconfig.json +0 -30
package/index.es6.js CHANGED
@@ -1,16 +1,17 @@
1
- import path from 'path';
2
- import fs from 'fs-extra';
1
+ import path$1 from 'path';
2
+ import fs, { promises } from 'fs-extra';
3
3
  import http from 'http';
4
4
  import https from 'https';
5
+ import { promisify } from 'util';
6
+ import axios from 'axios';
5
7
  import logger from '@cantinc/logger';
6
8
  import chalk from 'chalk';
7
- import { promisify } from 'util';
8
9
  import rollup from 'rollup';
9
10
  import commonjs from '@rollup/plugin-commonjs';
10
11
  import { nodeResolve } from '@rollup/plugin-node-resolve';
11
12
  import { terser } from 'rollup-plugin-terser';
12
13
  import typescript from 'rollup-plugin-typescript2';
13
- import postcss from 'rollup-plugin-postcss';
14
+ import styles from 'rollup-plugin-styles';
14
15
  import autoprefixer from 'autoprefixer';
15
16
  import express from 'express';
16
17
  import json from '@rollup/plugin-json';
@@ -19,8 +20,10 @@ import proxy from 'express-http-proxy';
19
20
  import selector from 'cli-select';
20
21
  import jsx from 'rollup-plugin-innet-jsx';
21
22
  import filesize from 'rollup-plugin-filesize';
23
+ import image from '@rollup/plugin-image';
24
+ import { Parse } from 'unzipper';
22
25
 
23
- /*! *****************************************************************************
26
+ /******************************************************************************
24
27
  Copyright (c) Microsoft Corporation.
25
28
 
26
29
  Permission to use, copy, modify, and/or distribute this software for any
@@ -45,22 +48,65 @@ function __awaiter(thisArg, _arguments, P, generator) {
45
48
  });
46
49
  }
47
50
 
51
+ const Writer = require('fstream').Writer;
52
+ const path = require('path');
53
+ const stream = require('stream');
54
+ const duplexer2 = require('duplexer2');
55
+ const Promise$1 = require('bluebird');
56
+ function Extract(opts, template) {
57
+ const reduceCount = 19 + template.length;
58
+ // make sure path is normalized before using it
59
+ opts.path = path.resolve(path.normalize(opts.path));
60
+ // @ts-ignore
61
+ const parser = new Parse(opts);
62
+ const outStream = new stream.Writable({ objectMode: true });
63
+ outStream._write = function (entry, encoding, cb) {
64
+ if (entry.type === 'Directory')
65
+ return cb();
66
+ const extractPath = path.join(opts.path, entry.path.slice(reduceCount));
67
+ if (extractPath.indexOf(opts.path) !== 0) {
68
+ return cb();
69
+ }
70
+ const writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
71
+ entry.pipe(writer)
72
+ .on('error', cb)
73
+ .on('close', cb);
74
+ };
75
+ const extract = duplexer2(parser, outStream);
76
+ parser.once('crx-header', function (crxHeader) {
77
+ extract.crxHeader = crxHeader;
78
+ });
79
+ parser
80
+ .pipe(outStream)
81
+ .on('finish', function () {
82
+ extract.emit('close');
83
+ });
84
+ extract.promise = function () {
85
+ return new Promise$1(function (resolve, reject) {
86
+ extract.on('close', resolve);
87
+ extract.on('error', reject);
88
+ });
89
+ };
90
+ return extract;
91
+ }
92
+
48
93
  const livereload = require('rollup-plugin-livereload');
49
94
  const { string } = require('rollup-plugin-string');
50
95
  const { exec, spawn } = require('child_process');
51
96
  const readline = require('readline');
52
97
  const execAsync = promisify(exec);
98
+ const copyFiles = promisify(fs.copy);
53
99
  require('dotenv').config();
54
100
  function getFile(file) {
55
- file = path.resolve(file);
101
+ file = path$1.resolve(file);
56
102
  if (!fs.existsSync(file)) {
57
103
  throw Error('Cannot find the file: ' + file);
58
104
  }
59
105
  if (fs.lstatSync(file).isDirectory()) {
60
106
  let tmpFile = file;
61
- if (!fs.existsSync(tmpFile = path.join(file, 'index.ts')) &&
62
- !fs.existsSync(tmpFile = path.join(file, 'index.tsx')) &&
63
- !fs.existsSync(tmpFile = path.join(file, 'index.js'))) {
107
+ if (!fs.existsSync(tmpFile = path$1.join(file, 'index.ts')) &&
108
+ !fs.existsSync(tmpFile = path$1.join(file, 'index.tsx')) &&
109
+ !fs.existsSync(tmpFile = path$1.join(file, 'index.js'))) {
64
110
  throw Error('Cannot find index file in: ' + file);
65
111
  }
66
112
  file = tmpFile;
@@ -73,16 +119,49 @@ function getFile(file) {
73
119
  }
74
120
  return file;
75
121
  }
122
+ function convertIndexFile(data, version) {
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ return data
125
+ .toString()
126
+ .replace('</head>', `<script type="module" defer src="index.js${version ? `?v=${version}` : ''}"></script></head>`);
127
+ });
128
+ }
76
129
  const reporter = (options, outputOptions, info) => {
77
130
  logger.log(`${chalk.yellow(info.fileName)} ${chalk.green(info.bundleSize)} [ gzip: ${chalk.green(info.gzipSize)} ]`);
78
131
  return '';
79
132
  };
133
+ const stringExcludeDom = [
134
+ '**/*.ts',
135
+ '**/*.tsx',
136
+ '**/*.js',
137
+ '**/*.jsx',
138
+ '**/*.json',
139
+ '**/*.css',
140
+ '**/*.scss',
141
+ '**/*.webp',
142
+ '**/*.gif',
143
+ '**/*.png',
144
+ '**/*.jpeg',
145
+ '**/*.jpg',
146
+ '**/*.svg',
147
+ ];
148
+ const stringExcludeNode = [
149
+ '**/*.ts',
150
+ '**/*.tsx',
151
+ '**/*.js',
152
+ '**/*.jsx',
153
+ '**/*.json',
154
+ ];
80
155
  class InnetJS {
81
- constructor({ projectFolder = process.env.PROJECT_FOLDER || '', publicFolder = process.env.PUBLIC_FOLDER || 'public', buildFolder = process.env.BUILD_FOLDER || path.join('public', 'build'), srcFolder = process.env.SRC_FOLDER || 'src', sourcemap = process.env.SOURCEMAP ? process.env.SOURCEMAP === 'true' : false, cssModules = process.env.CSS_MODULES ? process.env.CSS_MODULES === 'true' : false, cssInJs = process.env.CSS_IN_JS ? process.env.CSS_IN_JS === 'true' : false, sslKey = process.env.SSL_KEY || 'localhost.key', sslCrt = process.env.SSL_CRT || 'localhost.crt', proxy = process.env.PROXY || '', port = process.env.PORT ? +process.env.PORT : 3000, api = process.env.API || '*', } = {}) {
82
- this.projectFolder = path.resolve(projectFolder);
83
- this.publicFolder = path.resolve(publicFolder);
84
- this.buildFolder = path.resolve(buildFolder);
85
- this.srcFolder = path.resolve(srcFolder);
156
+ constructor({ projectFolder = process.env.PROJECT_FOLDER || '', publicFolder = process.env.PUBLIC_FOLDER || 'public', buildFolder = process.env.BUILD_FOLDER || 'build', srcFolder = process.env.SRC_FOLDER || 'src', sourcemap = process.env.SOURCEMAP ? process.env.SOURCEMAP === 'true' : false, cssModules = process.env.CSS_MODULES ? process.env.CSS_MODULES === 'true' : true, cssInJs = process.env.CSS_IN_JS ? process.env.CSS_IN_JS === 'true' : true, sslKey = process.env.SSL_KEY || 'localhost.key', sslCrt = process.env.SSL_CRT || 'localhost.crt', proxy = process.env.PROXY || '', port = process.env.PORT ? +process.env.PORT : 3000, api = process.env.API || '*', } = {}) {
157
+ this.projectFolder = path$1.resolve(projectFolder);
158
+ this.publicFolder = path$1.resolve(publicFolder);
159
+ this.buildFolder = path$1.resolve(buildFolder);
160
+ this.srcFolder = path$1.resolve(srcFolder);
161
+ this.publicIndexFile = path$1.join(publicFolder, 'index.html');
162
+ this.buildIndexFile = path$1.join(buildFolder, 'index.html');
163
+ this.devBuildFolder = path$1.resolve(projectFolder, 'node_modules', '.cache', 'innetjs', 'build');
164
+ this.devBuildIndexFile = path$1.join(this.devBuildFolder, 'index.html');
86
165
  this.sourcemap = sourcemap;
87
166
  this.cssModules = cssModules;
88
167
  this.cssInJs = cssInJs;
@@ -95,15 +174,19 @@ class InnetJS {
95
174
  // Methods
96
175
  init(appName, { template, force = false } = {}) {
97
176
  return __awaiter(this, void 0, void 0, function* () {
98
- const appPath = path.resolve(appName);
99
- if (!template) {
177
+ const appPath = path$1.resolve(appName);
178
+ const { data } = yield logger.start('Get templates list', () => __awaiter(this, void 0, void 0, function* () { return yield axios.get('https://api.github.com/repos/d8corp/innetjs-templates/branches'); }));
179
+ const templates = data.map(({ name }) => name).filter(name => name !== 'main');
180
+ if (!template || !templates.includes(template)) {
100
181
  logger.log(chalk.green(`Select one of those templates`));
101
182
  const { value } = yield selector({
102
- values: ['fe', 'be']
183
+ values: templates
103
184
  });
104
185
  template = value;
105
186
  readline.moveCursor(process.stdout, 0, -1);
106
- logger.log(`Selected ${value} template`);
187
+ const text = `Selected template: ${chalk.white(value)}`;
188
+ logger.start(text);
189
+ logger.end(text);
107
190
  }
108
191
  if (!force) {
109
192
  yield logger.start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
@@ -123,14 +206,16 @@ class InnetJS {
123
206
  }
124
207
  }));
125
208
  }
126
- const libPath = path.resolve(__dirname, '..');
127
- const templatePath = path.resolve(libPath, 'templates', template);
128
- yield logger.start('Check if the template exists', () => __awaiter(this, void 0, void 0, function* () {
129
- if (!fs.existsSync(templatePath)) {
130
- throw Error(`The template '${template}' is not exist`);
131
- }
209
+ yield logger.start('Download template', () => __awaiter(this, void 0, void 0, function* () {
210
+ const { data } = yield axios.get(`https://github.com/d8corp/innetjs-templates/archive/refs/heads/${template}.zip`, {
211
+ responseType: 'stream'
212
+ });
213
+ yield new Promise((resolve, reject) => {
214
+ data.pipe(Extract({
215
+ path: appPath,
216
+ }, template)).on('finish', resolve).on('error', reject);
217
+ });
132
218
  }));
133
- yield logger.start('Copy files', () => fs.copy(templatePath, appPath));
134
219
  yield logger.start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
135
220
  });
136
221
  }
@@ -140,7 +225,8 @@ class InnetJS {
140
225
  yield logger.start('Remove build', () => fs.remove(this.buildFolder));
141
226
  const pkg = node && (yield this.getPackage());
142
227
  const inputOptions = {
143
- input: path.resolve(this.srcFolder, `index.${indexExtension}`),
228
+ input: path$1.resolve(this.srcFolder, `index.${indexExtension}`),
229
+ preserveEntrySignatures: 'strict',
144
230
  plugins: [
145
231
  commonjs(),
146
232
  json(),
@@ -156,36 +242,23 @@ class InnetJS {
156
242
  outputOptions.format = 'cjs';
157
243
  inputOptions.external = Object.keys((pkg === null || pkg === void 0 ? void 0 : pkg.dependencies) || {});
158
244
  inputOptions.plugins.push(nodeResolve({
159
- moduleDirectories: [path.resolve(this.buildFolder, 'node_modules')]
245
+ moduleDirectories: [path$1.resolve(this.buildFolder, 'node_modules')]
160
246
  }), string({
161
247
  include: '**/*.*',
162
- exclude: [
163
- '**/*.ts',
164
- '**/*.tsx',
165
- '**/*.js',
166
- '**/*.jsx',
167
- '**/*.json',
168
- ]
248
+ exclude: stringExcludeNode,
169
249
  }));
170
250
  }
171
251
  else {
172
- inputOptions.plugins.push(nodeResolve(), string({
252
+ inputOptions.plugins.push(nodeResolve(), image(), string({
173
253
  include: '**/*.*',
174
- exclude: [
175
- '**/*.ts',
176
- '**/*.tsx',
177
- '**/*.js',
178
- '**/*.jsx',
179
- '**/*.json',
180
- '**/*.css',
181
- '**/*.scss',
182
- ]
183
- }), postcss({
254
+ exclude: stringExcludeDom,
255
+ }), styles({
256
+ mode: this.cssInJs ? 'inject' : 'extract',
257
+ url: true,
184
258
  plugins: [autoprefixer()],
185
- extract: !this.cssInJs,
186
259
  modules: this.cssModules,
187
260
  sourceMap: this.sourcemap,
188
- minimize: true
261
+ minimize: true,
189
262
  }));
190
263
  outputOptions.format = 'es';
191
264
  outputOptions.plugins = [
@@ -199,18 +272,24 @@ class InnetJS {
199
272
  const bundle = yield rollup.rollup(inputOptions);
200
273
  yield bundle.write(outputOptions);
201
274
  yield bundle.close();
275
+ if (!node) {
276
+ yield copyFiles(this.publicFolder, this.buildFolder);
277
+ const data = yield promises.readFile(this.publicIndexFile);
278
+ const pkg = yield this.getPackage();
279
+ yield promises.writeFile(this.buildIndexFile, yield convertIndexFile(data, pkg.version));
280
+ }
202
281
  }));
203
282
  if (pkg) {
204
283
  yield logger.start('Copy package.json', () => __awaiter(this, void 0, void 0, function* () {
205
284
  const data = Object.assign({}, pkg);
206
285
  delete data.private;
207
286
  delete data.devDependencies;
208
- yield fs.writeFile(path.resolve(this.buildFolder, 'package.json'), JSON.stringify(data, undefined, 2), 'UTF-8');
287
+ yield fs.writeFile(path$1.resolve(this.buildFolder, 'package.json'), JSON.stringify(data, undefined, 2), 'UTF-8');
209
288
  }));
210
- const pkgLockPath = path.resolve(this.projectFolder, 'package-lock.json');
289
+ const pkgLockPath = path$1.resolve(this.projectFolder, 'package-lock.json');
211
290
  if (fs.existsSync(pkgLockPath)) {
212
291
  yield logger.start('Copy package-lock.json', () => {
213
- return fs.copy(pkgLockPath, path.resolve(this.buildFolder, 'package-lock.json'));
292
+ return fs.copy(pkgLockPath, path$1.resolve(this.buildFolder, 'package-lock.json'));
214
293
  });
215
294
  }
216
295
  }
@@ -219,12 +298,13 @@ class InnetJS {
219
298
  start({ node = false, error = false } = {}) {
220
299
  return __awaiter(this, void 0, void 0, function* () {
221
300
  const indexExtension = yield this.getProjectExtension();
222
- const pkg = node && (yield this.getPackage());
223
- yield logger.start('Remove build', () => fs.remove(this.buildFolder));
301
+ const pkg = yield this.getPackage();
302
+ yield logger.start('Remove build', () => fs.remove(this.devBuildFolder));
224
303
  const options = {
225
- input: path.resolve(this.srcFolder, `index.${indexExtension}`),
304
+ input: path$1.resolve(this.srcFolder, `index.${indexExtension}`),
305
+ preserveEntrySignatures: 'strict',
226
306
  output: {
227
- dir: this.buildFolder,
307
+ dir: this.devBuildFolder,
228
308
  sourcemap: true
229
309
  },
230
310
  plugins: [
@@ -244,50 +324,37 @@ class InnetJS {
244
324
  options.output.format = 'cjs';
245
325
  options.external = Object.keys((pkg === null || pkg === void 0 ? void 0 : pkg.dependencies) || {});
246
326
  options.plugins.push(nodeResolve({
247
- moduleDirectories: [path.resolve(this.srcFolder, 'node_modules')]
327
+ moduleDirectories: [path$1.resolve(this.srcFolder, 'node_modules')]
248
328
  }), string({
249
329
  include: '**/*.*',
250
- exclude: [
251
- '**/*.ts',
252
- '**/*.tsx',
253
- '**/*.js',
254
- '**/*.jsx',
255
- '**/*.json',
256
- ]
330
+ exclude: stringExcludeNode,
257
331
  }), this.createServer(options.external));
258
332
  }
259
333
  else {
260
- const key = path.basename(this.sslKey) !== this.sslKey
334
+ const key = path$1.basename(this.sslKey) !== this.sslKey
261
335
  ? this.sslKey
262
336
  : fs.existsSync(this.sslKey)
263
337
  ? fs.readFileSync(this.sslKey)
264
338
  : undefined;
265
- const cert = path.basename(this.sslCrt) !== this.sslCrt
339
+ const cert = path$1.basename(this.sslCrt) !== this.sslCrt
266
340
  ? this.sslCrt
267
341
  : fs.existsSync(this.sslCrt)
268
342
  ? fs.readFileSync(this.sslCrt)
269
343
  : undefined;
270
344
  options.output.format = 'es';
271
- options.plugins.push(nodeResolve(), string({
345
+ options.plugins.push(nodeResolve(), image(), string({
272
346
  include: '**/*.*',
273
- exclude: [
274
- '**/*.ts',
275
- '**/*.tsx',
276
- '**/*.js',
277
- '**/*.jsx',
278
- '**/*.json',
279
- '**/*.css',
280
- '**/*.scss',
281
- ]
282
- }), postcss({
347
+ exclude: stringExcludeDom,
348
+ }), styles({
349
+ mode: this.cssInJs ? 'inject' : 'extract',
350
+ url: true,
283
351
  plugins: [autoprefixer()],
284
352
  modules: this.cssModules,
285
353
  sourceMap: true,
286
- extract: !this.cssInJs,
287
- }), this.createClient(key, cert), livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
354
+ }), this.createClient(key, cert, pkg), livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
288
355
  }
289
356
  const watcher = rollup.watch(options);
290
- watcher.on('event', e => {
357
+ watcher.on('event', (e) => __awaiter(this, void 0, void 0, function* () {
291
358
  if (e.code == 'ERROR') {
292
359
  logger.end('Bundling', error ? e.error.stack : e.error.message);
293
360
  }
@@ -297,7 +364,7 @@ class InnetJS {
297
364
  else if (e.code === 'BUNDLE_END') {
298
365
  logger.end('Bundling');
299
366
  }
300
- });
367
+ }));
301
368
  });
302
369
  }
303
370
  run(file) {
@@ -356,16 +423,16 @@ class InnetJS {
356
423
  }
357
424
  });
358
425
  yield logger.start('Detection of index file', () => {
359
- if (fs.existsSync(path.join(this.srcFolder, 'index.js'))) {
426
+ if (fs.existsSync(path$1.join(this.srcFolder, 'index.js'))) {
360
427
  this.projectExtension = 'js';
361
428
  }
362
- else if (fs.existsSync(path.join(this.srcFolder, 'index.ts'))) {
429
+ else if (fs.existsSync(path$1.join(this.srcFolder, 'index.ts'))) {
363
430
  this.projectExtension = 'ts';
364
431
  }
365
- else if (fs.existsSync(path.join(this.srcFolder, 'index.tsx'))) {
432
+ else if (fs.existsSync(path$1.join(this.srcFolder, 'index.tsx'))) {
366
433
  this.projectExtension = 'tsx';
367
434
  }
368
- else if (fs.existsSync(path.join(this.srcFolder, 'index.jsx'))) {
435
+ else if (fs.existsSync(path$1.join(this.srcFolder, 'index.jsx'))) {
369
436
  this.projectExtension = 'jsx';
370
437
  }
371
438
  else {
@@ -380,7 +447,7 @@ class InnetJS {
380
447
  if (this.package) {
381
448
  return this.package;
382
449
  }
383
- const packageFolder = path.resolve(this.projectFolder, 'package.json');
450
+ const packageFolder = path$1.resolve(this.projectFolder, 'package.json');
384
451
  yield logger.start('Check package.json', () => __awaiter(this, void 0, void 0, function* () {
385
452
  if (fs.existsSync(packageFolder)) {
386
453
  this.package = yield fs.readJson(packageFolder);
@@ -389,14 +456,21 @@ class InnetJS {
389
456
  return this.package;
390
457
  });
391
458
  }
392
- createClient(key, cert) {
459
+ createClient(key, cert, pkg) {
393
460
  let app;
394
461
  return {
395
- writeBundle: () => {
462
+ writeBundle: () => __awaiter(this, void 0, void 0, function* () {
396
463
  var _a;
397
464
  if (!app) {
398
- const httpsUsing = !!(cert && key);
399
465
  app = express();
466
+ const update = () => __awaiter(this, void 0, void 0, function* () {
467
+ const data = yield promises.readFile(this.publicIndexFile);
468
+ yield promises.writeFile(this.devBuildIndexFile, yield convertIndexFile(data, pkg.version));
469
+ });
470
+ fs.watch(this.publicIndexFile, update);
471
+ yield update();
472
+ const httpsUsing = !!(cert && key);
473
+ app.use(express.static(this.devBuildFolder));
400
474
  app.use(express.static(this.publicFolder));
401
475
  if ((_a = this.proxy) === null || _a === void 0 ? void 0 : _a.startsWith('http')) {
402
476
  app.use(this.api, proxy(this.proxy, {
@@ -405,14 +479,14 @@ class InnetJS {
405
479
  }));
406
480
  }
407
481
  app.use(/^[^.]+$/, (req, res) => {
408
- res.sendFile(this.publicFolder + '/index.html');
482
+ res.sendFile(this.devBuildFolder + '/index.html');
409
483
  });
410
484
  const server = httpsUsing ? https.createServer({ key, cert }, app) : http.createServer(app);
411
485
  server.listen(this.port, () => {
412
486
  console.log(`${chalk.green('➤')} Server started on http${httpsUsing ? 's' : ''}://localhost:${this.port}`);
413
487
  });
414
488
  }
415
- }
489
+ })
416
490
  };
417
491
  }
418
492
  createServer(external) {
@@ -420,10 +494,10 @@ class InnetJS {
420
494
  return {
421
495
  writeBundle: () => __awaiter(this, void 0, void 0, function* () {
422
496
  app === null || app === void 0 ? void 0 : app.kill();
423
- const filePath = path.resolve(this.buildFolder, 'index.js');
497
+ const filePath = path$1.resolve(this.buildFolder, 'index.js');
424
498
  let data = yield fs.readFile(filePath, 'UTF-8');
425
499
  const regExp = new RegExp(`require\\('(${external.join('|')})'\\)`, 'g');
426
- data = data.replace(regExp, `require('${path.resolve(this.projectFolder, 'node_modules', '$1')}')`);
500
+ data = data.replace(regExp, `require('${path$1.resolve(this.projectFolder, 'node_modules', '$1')}')`);
427
501
  yield fs.writeFile(filePath, data);
428
502
  app = spawn('node', ['-r', 'source-map-support/register', filePath], { stdio: 'inherit' });
429
503
  })