innetjs 2.0.1 → 2.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/bin/innet CHANGED
@@ -24,6 +24,8 @@ var selector = require('cli-select');
24
24
  var jsx = require('rollup-plugin-innet-jsx');
25
25
  var filesize = require('rollup-plugin-filesize');
26
26
  var image = require('@rollup/plugin-image');
27
+ var eslint = require('@rollup/plugin-eslint');
28
+ var linesAndColumns = require('lines-and-columns');
27
29
  var unzipper = require('unzipper');
28
30
  var commander = require('commander');
29
31
 
@@ -49,6 +51,7 @@ var selector__default = /*#__PURE__*/_interopDefaultLegacy(selector);
49
51
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
50
52
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
51
53
  var image__default = /*#__PURE__*/_interopDefaultLegacy(image);
54
+ var eslint__default = /*#__PURE__*/_interopDefaultLegacy(eslint);
52
55
 
53
56
  /******************************************************************************
54
57
  Copyright (c) Microsoft Corporation.
@@ -117,13 +120,35 @@ function Extract(opts, template) {
117
120
  return extract;
118
121
  }
119
122
 
120
- const livereload = require('rollup-plugin-livereload');
121
- const { string } = require('rollup-plugin-string');
122
- const { exec, spawn } = require('child_process');
123
- const readline = require('readline');
124
- const execAsync = util.promisify(exec);
125
- const copyFiles = util.promisify(fs__default["default"].copy);
126
- require('dotenv').config();
123
+ const lintIncludeDom = [
124
+ '**/*.ts',
125
+ '**/*.tsx',
126
+ '**/*.js',
127
+ '**/*.jsx',
128
+ ];
129
+ const stringExcludeDom = [
130
+ '**/*.ts',
131
+ '**/*.tsx',
132
+ '**/*.js',
133
+ '**/*.jsx',
134
+ '**/*.json',
135
+ '**/*.css',
136
+ '**/*.scss',
137
+ '**/*.webp',
138
+ '**/*.gif',
139
+ '**/*.png',
140
+ '**/*.jpeg',
141
+ '**/*.jpg',
142
+ '**/*.svg',
143
+ ];
144
+ const stringExcludeNode = [
145
+ '**/*.ts',
146
+ '**/*.tsx',
147
+ '**/*.js',
148
+ '**/*.jsx',
149
+ '**/*.json',
150
+ ];
151
+
127
152
  function getFile(file) {
128
153
  file = path__default["default"].resolve(file);
129
154
  if (!fs__default["default"].existsSync(file)) {
@@ -156,29 +181,15 @@ function convertIndexFile(data, version) {
156
181
  const reporter = (options, outputOptions, info) => {
157
182
  logger__default["default"].log(`${chalk__default["default"].yellow(info.fileName)} ${chalk__default["default"].green(info.bundleSize)} [ gzip: ${chalk__default["default"].green(info.gzipSize)} ]`);
158
183
  return '';
159
- };
160
- const stringExcludeDom = [
161
- '**/*.ts',
162
- '**/*.tsx',
163
- '**/*.js',
164
- '**/*.jsx',
165
- '**/*.json',
166
- '**/*.css',
167
- '**/*.scss',
168
- '**/*.webp',
169
- '**/*.gif',
170
- '**/*.png',
171
- '**/*.jpeg',
172
- '**/*.jpg',
173
- '**/*.svg',
174
- ];
175
- const stringExcludeNode = [
176
- '**/*.ts',
177
- '**/*.tsx',
178
- '**/*.js',
179
- '**/*.jsx',
180
- '**/*.json',
181
- ];
184
+ };
185
+
186
+ const livereload = require('rollup-plugin-livereload');
187
+ const { string } = require('rollup-plugin-string');
188
+ const { exec, spawn } = require('child_process');
189
+ const readline = require('readline');
190
+ const execAsync = util.promisify(exec);
191
+ const copyFiles = util.promisify(fs__default["default"].copy);
192
+ require('dotenv').config();
182
193
  class InnetJS {
183
194
  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 || '*', } = {}) {
184
195
  this.projectFolder = path__default["default"].resolve(projectFolder);
@@ -276,17 +287,26 @@ class InnetJS {
276
287
  }));
277
288
  }
278
289
  else {
279
- inputOptions.plugins.push(pluginNodeResolve.nodeResolve(), image__default["default"](), string({
280
- include: '**/*.*',
281
- exclude: stringExcludeDom,
282
- }), styles__default["default"]({
283
- mode: this.cssInJs ? 'inject' : 'extract',
284
- url: true,
285
- plugins: [autoprefixer__default["default"]()],
286
- modules: this.cssModules,
287
- sourceMap: this.sourcemap,
288
- minimize: true,
289
- }));
290
+ inputOptions.plugins = [
291
+ eslint__default["default"]({
292
+ include: lintIncludeDom,
293
+ }),
294
+ ...inputOptions.plugins,
295
+ pluginNodeResolve.nodeResolve(),
296
+ image__default["default"](),
297
+ styles__default["default"]({
298
+ mode: this.cssInJs ? 'inject' : 'extract',
299
+ url: true,
300
+ plugins: [autoprefixer__default["default"]()],
301
+ modules: this.cssModules,
302
+ sourceMap: this.sourcemap,
303
+ minimize: true,
304
+ }),
305
+ string({
306
+ include: '**/*.*',
307
+ exclude: stringExcludeDom,
308
+ }),
309
+ ];
290
310
  outputOptions.format = 'es';
291
311
  outputOptions.plugins = [
292
312
  rollupPluginTerser.terser(),
@@ -369,21 +389,42 @@ class InnetJS {
369
389
  ? fs__default["default"].readFileSync(this.sslCrt)
370
390
  : undefined;
371
391
  options.output.format = 'es';
372
- options.plugins.push(pluginNodeResolve.nodeResolve(), image__default["default"](), string({
373
- include: '**/*.*',
374
- exclude: stringExcludeDom,
375
- }), styles__default["default"]({
376
- mode: this.cssInJs ? 'inject' : 'extract',
377
- url: true,
378
- plugins: [autoprefixer__default["default"]()],
379
- modules: this.cssModules,
380
- sourceMap: true,
381
- }), this.createClient(key, cert, pkg), livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
392
+ options.plugins = [
393
+ eslint__default["default"]({
394
+ include: lintIncludeDom,
395
+ }),
396
+ ...options.plugins,
397
+ pluginNodeResolve.nodeResolve(),
398
+ image__default["default"](),
399
+ styles__default["default"]({
400
+ mode: this.cssInJs ? 'inject' : 'extract',
401
+ url: true,
402
+ plugins: [autoprefixer__default["default"]()],
403
+ modules: this.cssModules,
404
+ sourceMap: true,
405
+ }),
406
+ string({
407
+ include: '**/*.*',
408
+ exclude: stringExcludeDom,
409
+ }),
410
+ this.createClient(key, cert, pkg),
411
+ livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {})))
412
+ ];
382
413
  }
383
414
  const watcher = rollup__default["default"].watch(options);
384
415
  watcher.on('event', (e) => __awaiter(this, void 0, void 0, function* () {
385
416
  if (e.code == 'ERROR') {
386
- logger__default["default"].end('Bundling', error ? e.error.stack : e.error.message);
417
+ if (e.error.code === 'UNRESOLVED_IMPORT') {
418
+ const [, importer, file] = e.error.message.match(/^Could not resolve '(.+)' from (.+)$/);
419
+ const text = (yield fs__default["default"].readFile(file)).toString();
420
+ const lines = new linesAndColumns.LinesAndColumns(text);
421
+ const { line, column } = lines.locationForIndex(text.indexOf(importer));
422
+ logger__default["default"].end('Bundling', e.error.message);
423
+ console.log(`ERROR in ${file}:${line + 1}:${column + 1}`);
424
+ }
425
+ else {
426
+ logger__default["default"].end('Bundling', error ? e.error.stack : e.error.message);
427
+ }
387
428
  }
388
429
  else if (e.code === 'BUNDLE_START') {
389
430
  logger__default["default"].start('Bundling');
@@ -532,7 +573,7 @@ class InnetJS {
532
573
  }
533
574
  }
534
575
 
535
- var version = "2.0.1";
576
+ var version = "2.0.2";
536
577
 
537
578
  require('dotenv').config();
538
579
  const innetJS = new InnetJS();
package/constants.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const lintIncludeDom: string[];
2
+ export declare const stringExcludeDom: string[];
3
+ export declare const stringExcludeNode: string[];
package/helpers.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { FileSizeRender } from 'rollup-plugin-filesize';
3
+ export declare function getFile(file: any): any;
4
+ export declare function convertIndexFile(data: Buffer, version: string): Promise<string>;
5
+ export declare const reporter: FileSizeRender<string | Promise<string>>;
package/index.es6.js CHANGED
@@ -21,6 +21,8 @@ import selector from 'cli-select';
21
21
  import jsx from 'rollup-plugin-innet-jsx';
22
22
  import filesize from 'rollup-plugin-filesize';
23
23
  import image from '@rollup/plugin-image';
24
+ import eslint from '@rollup/plugin-eslint';
25
+ import { LinesAndColumns } from 'lines-and-columns';
24
26
  import { Parse } from 'unzipper';
25
27
 
26
28
  /******************************************************************************
@@ -90,13 +92,35 @@ function Extract(opts, template) {
90
92
  return extract;
91
93
  }
92
94
 
93
- const livereload = require('rollup-plugin-livereload');
94
- const { string } = require('rollup-plugin-string');
95
- const { exec, spawn } = require('child_process');
96
- const readline = require('readline');
97
- const execAsync = promisify(exec);
98
- const copyFiles = promisify(fs.copy);
99
- require('dotenv').config();
95
+ const lintIncludeDom = [
96
+ '**/*.ts',
97
+ '**/*.tsx',
98
+ '**/*.js',
99
+ '**/*.jsx',
100
+ ];
101
+ const stringExcludeDom = [
102
+ '**/*.ts',
103
+ '**/*.tsx',
104
+ '**/*.js',
105
+ '**/*.jsx',
106
+ '**/*.json',
107
+ '**/*.css',
108
+ '**/*.scss',
109
+ '**/*.webp',
110
+ '**/*.gif',
111
+ '**/*.png',
112
+ '**/*.jpeg',
113
+ '**/*.jpg',
114
+ '**/*.svg',
115
+ ];
116
+ const stringExcludeNode = [
117
+ '**/*.ts',
118
+ '**/*.tsx',
119
+ '**/*.js',
120
+ '**/*.jsx',
121
+ '**/*.json',
122
+ ];
123
+
100
124
  function getFile(file) {
101
125
  file = path$1.resolve(file);
102
126
  if (!fs.existsSync(file)) {
@@ -129,29 +153,15 @@ function convertIndexFile(data, version) {
129
153
  const reporter = (options, outputOptions, info) => {
130
154
  logger.log(`${chalk.yellow(info.fileName)} ${chalk.green(info.bundleSize)} [ gzip: ${chalk.green(info.gzipSize)} ]`);
131
155
  return '';
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
- ];
156
+ };
157
+
158
+ const livereload = require('rollup-plugin-livereload');
159
+ const { string } = require('rollup-plugin-string');
160
+ const { exec, spawn } = require('child_process');
161
+ const readline = require('readline');
162
+ const execAsync = promisify(exec);
163
+ const copyFiles = promisify(fs.copy);
164
+ require('dotenv').config();
155
165
  class InnetJS {
156
166
  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
167
  this.projectFolder = path$1.resolve(projectFolder);
@@ -249,17 +259,26 @@ class InnetJS {
249
259
  }));
250
260
  }
251
261
  else {
252
- inputOptions.plugins.push(nodeResolve(), image(), string({
253
- include: '**/*.*',
254
- exclude: stringExcludeDom,
255
- }), styles({
256
- mode: this.cssInJs ? 'inject' : 'extract',
257
- url: true,
258
- plugins: [autoprefixer()],
259
- modules: this.cssModules,
260
- sourceMap: this.sourcemap,
261
- minimize: true,
262
- }));
262
+ inputOptions.plugins = [
263
+ eslint({
264
+ include: lintIncludeDom,
265
+ }),
266
+ ...inputOptions.plugins,
267
+ nodeResolve(),
268
+ image(),
269
+ styles({
270
+ mode: this.cssInJs ? 'inject' : 'extract',
271
+ url: true,
272
+ plugins: [autoprefixer()],
273
+ modules: this.cssModules,
274
+ sourceMap: this.sourcemap,
275
+ minimize: true,
276
+ }),
277
+ string({
278
+ include: '**/*.*',
279
+ exclude: stringExcludeDom,
280
+ }),
281
+ ];
263
282
  outputOptions.format = 'es';
264
283
  outputOptions.plugins = [
265
284
  terser(),
@@ -342,21 +361,42 @@ class InnetJS {
342
361
  ? fs.readFileSync(this.sslCrt)
343
362
  : undefined;
344
363
  options.output.format = 'es';
345
- options.plugins.push(nodeResolve(), image(), string({
346
- include: '**/*.*',
347
- exclude: stringExcludeDom,
348
- }), styles({
349
- mode: this.cssInJs ? 'inject' : 'extract',
350
- url: true,
351
- plugins: [autoprefixer()],
352
- modules: this.cssModules,
353
- sourceMap: true,
354
- }), this.createClient(key, cert, pkg), livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
364
+ options.plugins = [
365
+ eslint({
366
+ include: lintIncludeDom,
367
+ }),
368
+ ...options.plugins,
369
+ nodeResolve(),
370
+ image(),
371
+ styles({
372
+ mode: this.cssInJs ? 'inject' : 'extract',
373
+ url: true,
374
+ plugins: [autoprefixer()],
375
+ modules: this.cssModules,
376
+ sourceMap: true,
377
+ }),
378
+ string({
379
+ include: '**/*.*',
380
+ exclude: stringExcludeDom,
381
+ }),
382
+ this.createClient(key, cert, pkg),
383
+ livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {})))
384
+ ];
355
385
  }
356
386
  const watcher = rollup.watch(options);
357
387
  watcher.on('event', (e) => __awaiter(this, void 0, void 0, function* () {
358
388
  if (e.code == 'ERROR') {
359
- logger.end('Bundling', error ? e.error.stack : e.error.message);
389
+ if (e.error.code === 'UNRESOLVED_IMPORT') {
390
+ const [, importer, file] = e.error.message.match(/^Could not resolve '(.+)' from (.+)$/);
391
+ const text = (yield fs.readFile(file)).toString();
392
+ const lines = new LinesAndColumns(text);
393
+ const { line, column } = lines.locationForIndex(text.indexOf(importer));
394
+ logger.end('Bundling', e.error.message);
395
+ console.log(`ERROR in ${file}:${line + 1}:${column + 1}`);
396
+ }
397
+ else {
398
+ logger.end('Bundling', error ? e.error.stack : e.error.message);
399
+ }
360
400
  }
361
401
  else if (e.code === 'BUNDLE_START') {
362
402
  logger.start('Bundling');
package/index.js CHANGED
@@ -23,6 +23,8 @@ var selector = require('cli-select');
23
23
  var jsx = require('rollup-plugin-innet-jsx');
24
24
  var filesize = require('rollup-plugin-filesize');
25
25
  var image = require('@rollup/plugin-image');
26
+ var eslint = require('@rollup/plugin-eslint');
27
+ var linesAndColumns = require('lines-and-columns');
26
28
  var unzipper = require('unzipper');
27
29
 
28
30
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -47,6 +49,7 @@ var selector__default = /*#__PURE__*/_interopDefaultLegacy(selector);
47
49
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
48
50
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
49
51
  var image__default = /*#__PURE__*/_interopDefaultLegacy(image);
52
+ var eslint__default = /*#__PURE__*/_interopDefaultLegacy(eslint);
50
53
 
51
54
  /******************************************************************************
52
55
  Copyright (c) Microsoft Corporation.
@@ -115,13 +118,35 @@ function Extract(opts, template) {
115
118
  return extract;
116
119
  }
117
120
 
118
- const livereload = require('rollup-plugin-livereload');
119
- const { string } = require('rollup-plugin-string');
120
- const { exec, spawn } = require('child_process');
121
- const readline = require('readline');
122
- const execAsync = util.promisify(exec);
123
- const copyFiles = util.promisify(fs__default["default"].copy);
124
- require('dotenv').config();
121
+ const lintIncludeDom = [
122
+ '**/*.ts',
123
+ '**/*.tsx',
124
+ '**/*.js',
125
+ '**/*.jsx',
126
+ ];
127
+ const stringExcludeDom = [
128
+ '**/*.ts',
129
+ '**/*.tsx',
130
+ '**/*.js',
131
+ '**/*.jsx',
132
+ '**/*.json',
133
+ '**/*.css',
134
+ '**/*.scss',
135
+ '**/*.webp',
136
+ '**/*.gif',
137
+ '**/*.png',
138
+ '**/*.jpeg',
139
+ '**/*.jpg',
140
+ '**/*.svg',
141
+ ];
142
+ const stringExcludeNode = [
143
+ '**/*.ts',
144
+ '**/*.tsx',
145
+ '**/*.js',
146
+ '**/*.jsx',
147
+ '**/*.json',
148
+ ];
149
+
125
150
  function getFile(file) {
126
151
  file = path__default["default"].resolve(file);
127
152
  if (!fs__default["default"].existsSync(file)) {
@@ -154,29 +179,15 @@ function convertIndexFile(data, version) {
154
179
  const reporter = (options, outputOptions, info) => {
155
180
  logger__default["default"].log(`${chalk__default["default"].yellow(info.fileName)} ${chalk__default["default"].green(info.bundleSize)} [ gzip: ${chalk__default["default"].green(info.gzipSize)} ]`);
156
181
  return '';
157
- };
158
- const stringExcludeDom = [
159
- '**/*.ts',
160
- '**/*.tsx',
161
- '**/*.js',
162
- '**/*.jsx',
163
- '**/*.json',
164
- '**/*.css',
165
- '**/*.scss',
166
- '**/*.webp',
167
- '**/*.gif',
168
- '**/*.png',
169
- '**/*.jpeg',
170
- '**/*.jpg',
171
- '**/*.svg',
172
- ];
173
- const stringExcludeNode = [
174
- '**/*.ts',
175
- '**/*.tsx',
176
- '**/*.js',
177
- '**/*.jsx',
178
- '**/*.json',
179
- ];
182
+ };
183
+
184
+ const livereload = require('rollup-plugin-livereload');
185
+ const { string } = require('rollup-plugin-string');
186
+ const { exec, spawn } = require('child_process');
187
+ const readline = require('readline');
188
+ const execAsync = util.promisify(exec);
189
+ const copyFiles = util.promisify(fs__default["default"].copy);
190
+ require('dotenv').config();
180
191
  class InnetJS {
181
192
  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 || '*', } = {}) {
182
193
  this.projectFolder = path__default["default"].resolve(projectFolder);
@@ -274,17 +285,26 @@ class InnetJS {
274
285
  }));
275
286
  }
276
287
  else {
277
- inputOptions.plugins.push(pluginNodeResolve.nodeResolve(), image__default["default"](), string({
278
- include: '**/*.*',
279
- exclude: stringExcludeDom,
280
- }), styles__default["default"]({
281
- mode: this.cssInJs ? 'inject' : 'extract',
282
- url: true,
283
- plugins: [autoprefixer__default["default"]()],
284
- modules: this.cssModules,
285
- sourceMap: this.sourcemap,
286
- minimize: true,
287
- }));
288
+ inputOptions.plugins = [
289
+ eslint__default["default"]({
290
+ include: lintIncludeDom,
291
+ }),
292
+ ...inputOptions.plugins,
293
+ pluginNodeResolve.nodeResolve(),
294
+ image__default["default"](),
295
+ styles__default["default"]({
296
+ mode: this.cssInJs ? 'inject' : 'extract',
297
+ url: true,
298
+ plugins: [autoprefixer__default["default"]()],
299
+ modules: this.cssModules,
300
+ sourceMap: this.sourcemap,
301
+ minimize: true,
302
+ }),
303
+ string({
304
+ include: '**/*.*',
305
+ exclude: stringExcludeDom,
306
+ }),
307
+ ];
288
308
  outputOptions.format = 'es';
289
309
  outputOptions.plugins = [
290
310
  rollupPluginTerser.terser(),
@@ -367,21 +387,42 @@ class InnetJS {
367
387
  ? fs__default["default"].readFileSync(this.sslCrt)
368
388
  : undefined;
369
389
  options.output.format = 'es';
370
- options.plugins.push(pluginNodeResolve.nodeResolve(), image__default["default"](), string({
371
- include: '**/*.*',
372
- exclude: stringExcludeDom,
373
- }), styles__default["default"]({
374
- mode: this.cssInJs ? 'inject' : 'extract',
375
- url: true,
376
- plugins: [autoprefixer__default["default"]()],
377
- modules: this.cssModules,
378
- sourceMap: true,
379
- }), this.createClient(key, cert, pkg), livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
390
+ options.plugins = [
391
+ eslint__default["default"]({
392
+ include: lintIncludeDom,
393
+ }),
394
+ ...options.plugins,
395
+ pluginNodeResolve.nodeResolve(),
396
+ image__default["default"](),
397
+ styles__default["default"]({
398
+ mode: this.cssInJs ? 'inject' : 'extract',
399
+ url: true,
400
+ plugins: [autoprefixer__default["default"]()],
401
+ modules: this.cssModules,
402
+ sourceMap: true,
403
+ }),
404
+ string({
405
+ include: '**/*.*',
406
+ exclude: stringExcludeDom,
407
+ }),
408
+ this.createClient(key, cert, pkg),
409
+ livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {})))
410
+ ];
380
411
  }
381
412
  const watcher = rollup__default["default"].watch(options);
382
413
  watcher.on('event', (e) => __awaiter(this, void 0, void 0, function* () {
383
414
  if (e.code == 'ERROR') {
384
- logger__default["default"].end('Bundling', error ? e.error.stack : e.error.message);
415
+ if (e.error.code === 'UNRESOLVED_IMPORT') {
416
+ const [, importer, file] = e.error.message.match(/^Could not resolve '(.+)' from (.+)$/);
417
+ const text = (yield fs__default["default"].readFile(file)).toString();
418
+ const lines = new linesAndColumns.LinesAndColumns(text);
419
+ const { line, column } = lines.locationForIndex(text.indexOf(importer));
420
+ logger__default["default"].end('Bundling', e.error.message);
421
+ console.log(`ERROR in ${file}:${line + 1}:${column + 1}`);
422
+ }
423
+ else {
424
+ logger__default["default"].end('Bundling', error ? e.error.stack : e.error.message);
425
+ }
385
426
  }
386
427
  else if (e.code === 'BUNDLE_START') {
387
428
  logger__default["default"].start('Bundling');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innetjs",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "CLI for innet boilerplate",
5
5
  "homepage": "https://github.com/d8corp/innetjs",
6
6
  "author": "Mikhail Lysikov <d8corp@mail.ru>",
@@ -33,6 +33,7 @@
33
33
  "dependencies": {
34
34
  "@cantinc/logger": "^1.1.0",
35
35
  "@rollup/plugin-commonjs": "^22.0.2",
36
+ "@rollup/plugin-eslint": "^8.0.2",
36
37
  "@rollup/plugin-image": "^2.1.1",
37
38
  "@rollup/plugin-json": "^4.1.0",
38
39
  "@rollup/plugin-node-resolve": "^13.3.0",
@@ -45,6 +46,7 @@
45
46
  "express": "^4.18.1",
46
47
  "express-http-proxy": "^1.6.3",
47
48
  "fs-extra": "^10.1.0",
49
+ "lines-and-columns": "^2.0.3",
48
50
  "node-sass": "^7.0.1",
49
51
  "postcss": "^8.4.16",
50
52
  "rollup": "^2.77.2",