Commit 985510b51d187c98b35790ab062ec5375dcb6f0e

Authored by Igor Kulikov
1 parent e72c689e

Fix commonJs import warnings

... ... @@ -89,7 +89,17 @@
89 89 ],
90 90 "customWebpackConfig": {
91 91 "path": "./extra-webpack.config.js"
92   - }
  92 + },
  93 + "allowedCommonJsDependencies": [
  94 + "hammerjs",
  95 + "react",
  96 + "react-dom",
  97 + "reactcss",
  98 + "react-ace",
  99 + "schema-inspector",
  100 + "@flowjs/flow.js",
  101 + "mousetrap"
  102 + ]
93 103 },
94 104 "configurations": {
95 105 "production": {
... ...
... ... @@ -1943,11 +1943,11 @@
1943 1943 }
1944 1944 },
1945 1945 "@auth0/angular-jwt": {
1946   - "version": "4.0.0",
1947   - "resolved": "https://registry.npmjs.org/@auth0/angular-jwt/-/angular-jwt-4.0.0.tgz",
1948   - "integrity": "sha512-CHvk1zJ9jpQupl0f5y7EmTvYAwugyFvC4ztLsZKr7ZC7anNVaDd1+pDFJYS+ZEU9jLWzE74+AfVKfigImADJuw==",
  1946 + "version": "5.0.1",
  1947 + "resolved": "https://registry.npmjs.org/@auth0/angular-jwt/-/angular-jwt-5.0.1.tgz",
  1948 + "integrity": "sha512-djllMh6rthPscEj5n5T9zF223q8t+sDqnUuAYTJjdKoHvMAzYwwi2yP67HbojqjODG4ZLFAcPtRuzGgp+r7nDQ==",
1949 1949 "requires": {
1950   - "url": "^0.11.0"
  1950 + "tslib": "^2.0.0"
1951 1951 }
1952 1952 },
1953 1953 "@babel/code-frame": {
... ... @@ -5357,9 +5357,12 @@
5357 5357 "dev": true
5358 5358 },
5359 5359 "async": {
5360   - "version": "1.5.2",
5361   - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
5362   - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
  5360 + "version": "2.6.3",
  5361 + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
  5362 + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
  5363 + "requires": {
  5364 + "lodash": "^4.17.14"
  5365 + }
5363 5366 },
5364 5367 "async-each": {
5365 5368 "version": "1.0.3",
... ... @@ -13144,7 +13147,8 @@
13144 13147 "punycode": {
13145 13148 "version": "1.3.2",
13146 13149 "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
13147   - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
  13150 + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=",
  13151 + "dev": true
13148 13152 },
13149 13153 "q": {
13150 13154 "version": "1.5.1",
... ... @@ -13177,7 +13181,8 @@
13177 13181 "querystring": {
13178 13182 "version": "0.2.0",
13179 13183 "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
13180   - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
  13184 + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=",
  13185 + "dev": true
13181 13186 },
13182 13187 "querystring-es3": {
13183 13188 "version": "0.2.1",
... ... @@ -13992,11 +13997,11 @@
13992 13997 }
13993 13998 },
13994 13999 "schema-inspector": {
13995   - "version": "1.6.8",
13996   - "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.6.8.tgz",
13997   - "integrity": "sha1-ueU5g8xV/y29e2Xj2+CF2dEoXyo=",
  14000 + "version": "1.7.0",
  14001 + "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.7.0.tgz",
  14002 + "integrity": "sha512-Cj4XP6O3QfDhOq7bIPpz3Ev+sjR++nqFsIggBVIk/8axqFc2p+XSwNBWih9Ut/p8k36f1uCyXB+TzumZUsxVBQ==",
13998 14003 "requires": {
13999   - "async": "^1.5.0"
  14004 + "async": "~2.6.3"
14000 14005 }
14001 14006 },
14002 14007 "schema-utils": {
... ... @@ -15851,6 +15856,7 @@
15851 15856 "version": "0.11.0",
15852 15857 "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz",
15853 15858 "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=",
  15859 + "dev": true,
15854 15860 "requires": {
15855 15861 "punycode": "1.3.2",
15856 15862 "querystring": "0.2.0"
... ...
... ... @@ -23,7 +23,7 @@
23 23 "@angular/platform-browser": "^10.0.9",
24 24 "@angular/platform-browser-dynamic": "^10.0.9",
25 25 "@angular/router": "^10.0.9",
26   - "@auth0/angular-jwt": "^4.0.0",
  26 + "@auth0/angular-jwt": "^5.0.1",
27 27 "@date-io/date-fns": "^2.6.1",
28 28 "@flowjs/flow.js": "^2.14.1",
29 29 "@flowjs/ngx-flow": "^0.4.4",
... ... @@ -81,7 +81,7 @@
81 81 "react-dropzone": "^11.0.3",
82 82 "reactcss": "^1.2.3",
83 83 "rxjs": "^6.6.2",
84   - "schema-inspector": "1.6.8",
  84 + "schema-inspector": "^1.7.0",
85 85 "screenfull": "^5.0.2",
86 86 "split.js": "^1.6.2",
87 87 "systemjs": "0.21.5",
... ...
... ... @@ -28,8 +28,7 @@ import { AuthService } from '@core/auth/auth.service';
28 28 import { Constants } from '@shared/models/constants';
29 29 import { InterceptorHttpParams } from './interceptor-http-params';
30 30 import { catchError, delay, mergeMap, switchMap, tap } from 'rxjs/operators';
31   -import { throwError } from 'rxjs/internal/observable/throwError';
32   -import { of } from 'rxjs/internal/observable/of';
  31 +import { throwError, of } from 'rxjs';
33 32 import { InterceptorConfig } from './interceptor-config';
34 33 import { Store } from '@ngrx/store';
35 34 import { AppState } from '@core/core.state';
... ...
... ... @@ -20,8 +20,7 @@ import {
20 20 TranslateMessageFormatCompiler
21 21 } from 'ngx-translate-messageformat-compiler';
22 22 import { Inject, Injectable, Optional } from '@angular/core';
23   -
24   -const parse = require('messageformat-parser').parse;
  23 +import messageFormatParser from 'messageformat-parser';
25 24
26 25 @Injectable({ providedIn: 'root' })
27 26 export class TranslateDefaultCompiler extends TranslateMessageFormatCompiler {
... ... @@ -61,7 +60,7 @@ export class TranslateDefaultCompiler extends TranslateMessageFormatCompiler {
61 60 private checkIsPlural(src: string): boolean {
62 61 let tokens: any[];
63 62 try {
64   - tokens = parse(src.replace(/\{\{/g, '{').replace(/\}\}/g, '}'),
  63 + tokens = messageFormatParser.parse(src.replace(/\{\{/g, '{').replace(/\}\}/g, '}'),
65 64 {cardinal: [], ordinal: []});
66 65 } catch (e) {
67 66 console.warn(`Failed to parse source: ${src}`);
... ...
... ... @@ -34,7 +34,6 @@ import { AppState } from '@core/core.state';
34 34 import { CustomActionDescriptor } from '@shared/models/widget.models';
35 35 import * as ace from 'ace-builds';
36 36 import { CancelAnimationFrame, RafService } from '@core/services/raf.service';
37   -import { css_beautify, html_beautify } from 'js-beautify';
38 37 import { ResizeObserver } from '@juggle/resize-observer';
39 38 import { CustomPrettyActionEditorCompleter } from '@home/components/widget/action/custom-action.models';
40 39
... ... @@ -93,7 +92,6 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl
93 92
94 93 ngOnChanges(changes: SimpleChanges): void {
95 94 for (const propName of Object.keys(changes)) {
96   - const change = changes[propName];
97 95 if (propName === 'action') {
98 96 if (this.aceEditors.length) {
99 97 this.setAceEditorValues();
... ... @@ -136,7 +134,7 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl
136 134 }
137 135
138 136 public beautifyCss(): void {
139   - const res = css_beautify(this.action.customCss, {indent_size: 4});
  137 + const res = js_beautify.css_beautify(this.action.customCss, {indent_size: 4});
140 138 if (this.action.customCss !== res) {
141 139 this.action.customCss = res;
142 140 this.cssEditor.setValue(this.action.customCss ? this.action.customCss : '', -1);
... ... @@ -145,7 +143,7 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl
145 143 }
146 144
147 145 public beautifyHtml(): void {
148   - const res = html_beautify(this.action.customHtml, {indent_size: 4, wrap_line_length: 60});
  146 + const res = js_beautify.html_beautify(this.action.customHtml, {indent_size: 4, wrap_line_length: 60});
149 147 if (this.action.customHtml !== res) {
150 148 this.action.customHtml = res;
151 149 this.htmlEditor.setValue(this.action.customHtml ? this.action.customHtml : '', -1);
... ... @@ -158,7 +156,7 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl
158 156 entries.forEach((entry) => {
159 157 const editor = this.aceEditors.find(aceEditor => aceEditor.container === entry.target);
160 158 this.onAceEditorResize(editor);
161   - })
  159 + });
162 160 });
163 161 this.htmlEditor = this.createAceEditor(this.htmlInputElmRef, 'html');
164 162 this.htmlEditor.on('input', () => {
... ...
... ... @@ -30,6 +30,7 @@ import { MatSidenav } from '@angular/material/sidenav';
30 30 import { AuthState } from '@core/auth/auth.models';
31 31 import { WINDOW } from '@core/services/window.service';
32 32 import { instanceOfSearchableComponent, ISearchableComponent } from '@home/models/searchable-component.models';
  33 +import logo from '../../../assets/logo_title_white.svg';
33 34
34 35 const screenfull = _screenfull as _screenfull.Screenfull;
35 36
... ... @@ -50,7 +51,7 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
50 51 sidenavMode: 'over' | 'push' | 'side' = 'side';
51 52 sidenavOpened = true;
52 53
53   - logo = require('../../../assets/logo_title_white.svg').default;
  54 + logo = logo;
54 55
55 56 @ViewChild('sidenav')
56 57 sidenav: MatSidenav;
... ...
... ... @@ -33,7 +33,6 @@ import { Hotkey } from 'angular2-hotkeys';
33 33 import { TranslateService } from '@ngx-translate/core';
34 34 import { getCurrentIsLoading } from '@app/core/interceptors/load.selectors';
35 35 import * as ace from 'ace-builds';
36   -import { css_beautify, html_beautify } from 'js-beautify';
37 36 import { CancelAnimationFrame, RafService } from '@core/services/raf.service';
38 37 import { WINDOW } from '@core/services/window.service';
39 38 import { WindowMessage } from '@shared/models/window-message.model';
... ... @@ -275,7 +274,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
275 274 entries.forEach((entry) => {
276 275 const editor = this.aceEditors.find(aceEditor => aceEditor.container === entry.target);
277 276 this.onAceEditorResize(editor);
278   - })
  277 + });
279 278 });
280 279 this.htmlEditor = this.createAceEditor(this.htmlInputElmRef, 'html');
281 280 this.htmlEditor.on('input', () => {
... ... @@ -577,7 +576,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
577 576 }
578 577
579 578 beautifyCss(): void {
580   - const res = css_beautify(this.widget.templateCss, {indent_size: 4});
  579 + const res = js_beautify.css_beautify(this.widget.templateCss, {indent_size: 4});
581 580 if (this.widget.templateCss !== res) {
582 581 this.isDirty = true;
583 582 this.widget.templateCss = res;
... ... @@ -586,7 +585,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
586 585 }
587 586
588 587 beautifyHtml(): void {
589   - const res = html_beautify(this.widget.templateHtml, {indent_size: 4, wrap_line_length: 60});
  588 + const res = js_beautify.html_beautify(this.widget.templateHtml, {indent_size: 4, wrap_line_length: 60});
590 589 if (this.widget.templateHtml !== res) {
591 590 this.isDirty = true;
592 591 this.widget.templateHtml = res;
... ...
... ... @@ -16,6 +16,7 @@
16 16
17 17 import { Component } from '@angular/core';
18 18 import { MatDialogRef } from '@angular/material/dialog';
  19 +import comingSoon from '../../../../assets/coming-soon.jpg';
19 20
20 21 @Component({
21 22 selector: 'tb-todo-dialog',
... ... @@ -24,7 +25,7 @@ import { MatDialogRef } from '@angular/material/dialog';
24 25 })
25 26 export class TodoDialogComponent {
26 27
27   - comingSoon = require('../../../../assets/coming-soon.jpg').default;
  28 + comingSoon = comingSoon;
28 29
29 30 constructor(public dialogRef: MatDialogRef<TodoDialogComponent>) {
30 31 }
... ...
... ... @@ -19,8 +19,7 @@ import ThingsboardBaseComponent from './json-form-base-component';
19 19 import Button from '@material-ui/core/Button';
20 20 import _ from 'lodash';
21 21 import IconButton from '@material-ui/core/IconButton';
22   -import ClearIcon from '@material-ui/icons/Clear';
23   -import AddIcon from '@material-ui/icons/Add';
  22 +import { Clear, Add } from '@material-ui/icons';
24 23 import Tooltip from '@material-ui/core/Tooltip';
25 24 import {
26 25 JsonFormData,
... ... @@ -138,7 +137,7 @@ class ThingsboardArray extends React.Component<JsonFormFieldProps, ThingsboardAr
138 137 let removeButton: JSX.Element = null;
139 138 if (!this.props.form.readonly) {
140 139 const boundOnDelete = this.onDelete.bind(this, i);
141   - removeButton = <Tooltip title='Remove'><IconButton onClick={boundOnDelete}><ClearIcon/></IconButton></Tooltip>;
  140 + removeButton = <Tooltip title='Remove'><IconButton onClick={boundOnDelete}><Clear/></IconButton></Tooltip>;
142 141 }
143 142 const forms = (this.props.form.items as JsonFormData[]).map((form, index) => {
144 143 const copy = this.copyWithIndex(form, i);
... ... @@ -156,7 +155,7 @@ class ThingsboardArray extends React.Component<JsonFormFieldProps, ThingsboardAr
156 155 if (!this.props.form.readonly) {
157 156 addButton = <Button variant='contained'
158 157 color='primary'
159   - startIcon={<AddIcon/>}
  158 + startIcon={<Add/>}
160 159 style={{marginBottom: '8px'}}
161 160 onClick={this.onAppend}>{this.props.form.add || 'New'}</Button>;
162 161 }
... ...
... ... @@ -21,7 +21,7 @@ import * as tinycolor_ from 'tinycolor2';
21 21 import TextField from '@material-ui/core/TextField';
22 22 import { JsonFormFieldProps, JsonFormFieldState } from '@shared/components/json-form/react/json-form.models';
23 23 import IconButton from '@material-ui/core/IconButton';
24   -import ClearIcon from '@material-ui/icons/Clear';
  24 +import { Clear } from '@material-ui/icons';
25 25 import Tooltip from '@material-ui/core/Tooltip';
26 26
27 27 const tinycolor = tinycolor_;
... ... @@ -177,7 +177,7 @@ class ThingsboardColor extends React.Component<JsonFormFieldProps, ThingsboardCo
177 177 onBlur={this.onBlur}
178 178 style={ styles.swatchText }/>
179 179 </div>
180   - <Tooltip title='Clear' placement='top'><IconButton onClick={this.onClear}><ClearIcon/></IconButton></Tooltip>
  180 + <Tooltip title='Clear' placement='top'><IconButton onClick={this.onClear}><Clear/></IconButton></Tooltip>
181 181 </div>
182 182 );
183 183 }
... ...
... ... @@ -16,7 +16,6 @@
16 16 import * as React from 'react';
17 17 import ThingsboardAceEditor from './json-form-ace-editor';
18 18 import { JsonFormFieldProps, JsonFormFieldState } from '@shared/components/json-form/react/json-form.models';
19   -import { css_beautify } from 'js-beautify';
20 19
21 20 class ThingsboardCss extends React.Component<JsonFormFieldProps, JsonFormFieldState> {
22 21
... ... @@ -26,7 +25,7 @@ class ThingsboardCss extends React.Component<JsonFormFieldProps, JsonFormFieldSt
26 25 }
27 26
28 27 onTidyCss(css: string): string {
29   - return css_beautify(css, {indent_size: 4});
  28 + return js_beautify.css_beautify(css, {indent_size: 4});
30 29 }
31 30
32 31 render() {
... ...
... ... @@ -15,7 +15,6 @@
15 15 */
16 16 import * as React from 'react';
17 17 import ThingsboardAceEditor from './json-form-ace-editor';
18   -import { html_beautify } from 'js-beautify';
19 18 import { JsonFormFieldProps, JsonFormFieldState } from '@shared/components/json-form/react/json-form.models';
20 19
21 20 class ThingsboardHtml extends React.Component<JsonFormFieldProps, JsonFormFieldState> {
... ... @@ -26,7 +25,7 @@ class ThingsboardHtml extends React.Component<JsonFormFieldProps, JsonFormFieldS
26 25 }
27 26
28 27 onTidyHtml(html: string): string {
29   - return html_beautify(html, {indent_size: 4});
  28 + return js_beautify.html_beautify(html, {indent_size: 4});
30 29 }
31 30
32 31 render() {
... ...
... ... @@ -20,7 +20,7 @@ import reactCSS from 'reactcss';
20 20 import TextField from '@material-ui/core/TextField';
21 21 import IconButton from '@material-ui/core/IconButton';
22 22 import { JsonFormFieldProps, JsonFormFieldState } from '@shared/components/json-form/react/json-form.models';
23   -import ClearIcon from '@material-ui/icons/Clear';
  23 +import { Clear } from '@material-ui/icons';
24 24 import Icon from '@material-ui/core/Icon';
25 25 import Tooltip from '@material-ui/core/Tooltip';
26 26
... ... @@ -63,7 +63,7 @@ class ThingsboardIcon extends React.Component<JsonFormFieldProps, ThingsboardIco
63 63 });
64 64 }
65 65
66   - componentWillUnmount () {
  66 + componentWillUnmount() {
67 67 const node = ReactDOM.findDOMNode(this);
68 68 const iconContainer = $(node).children('#icon-container');
69 69 iconContainer.off( 'click' );
... ... @@ -150,7 +150,7 @@ class ThingsboardIcon extends React.Component<JsonFormFieldProps, ThingsboardIco
150 150 onBlur={this.onBlur}
151 151 style={ styles.iconText } />
152 152 </div>
153   - <Tooltip title='Clear' placement='top'><IconButton onClick={this.onClear}><ClearIcon/></IconButton></Tooltip>
  153 + <Tooltip title='Clear' placement='top'><IconButton onClick={this.onClear}><Clear/></IconButton></Tooltip>
154 154 </div>
155 155 );
156 156 }
... ...
... ... @@ -18,7 +18,7 @@ import Dropzone from 'react-dropzone';
18 18 import ThingsboardBaseComponent from './json-form-base-component';
19 19 import { JsonFormFieldProps, JsonFormFieldState } from '@shared/components/json-form/react/json-form.models';
20 20 import IconButton from '@material-ui/core/IconButton';
21   -import ClearIcon from '@material-ui/icons/Clear';
  21 +import { Clear } from '@material-ui/icons';
22 22 import Tooltip from '@material-ui/core/Tooltip';
23 23
24 24 interface ThingsboardImageState extends JsonFormFieldState {
... ... @@ -87,7 +87,7 @@ class ThingsboardImage extends React.Component<JsonFormFieldProps, ThingsboardIm
87 87 <div className='tb-image-preview-container'>{previewComponent}</div>
88 88 <div className='tb-image-clear-container'>
89 89 <Tooltip title='Clear' placement='top'>
90   - <IconButton className='tb-image-clear-btn' onClick={this.onClear}><ClearIcon/></IconButton>
  90 + <IconButton className='tb-image-clear-btn' onClick={this.onClear}><Clear/></IconButton>
91 91 </Tooltip>
92 92 </div>
93 93 <Dropzone onDrop={this.onDrop}
... ...
  1 +declare module '*.png' {
  2 + const value: any;
  3 + export = value;
  4 +}
  5 +
  6 +declare module '*.jpg' {
  7 + const value: any;
  8 + export = value;
  9 +}
  10 +
  11 +declare module '*.svg' {
  12 + const value: any;
  13 + export = value;
  14 +}
... ...