Improve angular esbuild in production mode by removing slow performance sideEffects check code. Remove ts-transformer-keys -> replace with object.keys().
This commit is contained in:
parent
d91ebeb1e9
commit
393a231858
@ -105,7 +105,6 @@
|
|||||||
"tinycolor2": "^1.6.0",
|
"tinycolor2": "^1.6.0",
|
||||||
"tinymce": "~6.8.5",
|
"tinymce": "~6.8.5",
|
||||||
"tooltipster": "^4.2.8",
|
"tooltipster": "^4.2.8",
|
||||||
"ts-transformer-keys": "^0.4.4",
|
|
||||||
"tslib": "^2.7.0",
|
"tslib": "^2.7.0",
|
||||||
"tv4": "^1.3.0",
|
"tv4": "^1.3.0",
|
||||||
"typeface-roboto": "^1.1.13",
|
"typeface-roboto": "^1.1.13",
|
||||||
|
|||||||
@ -12,7 +12,7 @@ index 625c621..4fc8bd8 100755
|
|||||||
}
|
}
|
||||||
async diagnoseFiles(modes = DiagnosticModes.All) {
|
async diagnoseFiles(modes = DiagnosticModes.All) {
|
||||||
diff --git a/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js b/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js
|
diff --git a/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js b/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js
|
||||||
index b1bb6ea..e946fd1 100755
|
index b1bb6ea..c76b4c6 100755
|
||||||
--- a/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js
|
--- a/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js
|
||||||
+++ b/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js
|
+++ b/node_modules/@angular/build/src/tools/esbuild/angular/compiler-plugin.js
|
||||||
@@ -79,7 +79,7 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
@@ -79,7 +79,7 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
||||||
@ -24,3 +24,20 @@ index b1bb6ea..e946fd1 100755
|
|||||||
}, environment_options_1.maxWorkers, cacheStore?.createCache('jstransformer'));
|
}, environment_options_1.maxWorkers, cacheStore?.createCache('jstransformer'));
|
||||||
// Setup defines based on the values used by the Angular compiler-cli
|
// Setup defines based on the values used by the Angular compiler-cli
|
||||||
build.initialOptions.define ??= {};
|
build.initialOptions.define ??= {};
|
||||||
|
@@ -377,12 +377,14 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
||||||
|
async function hasSideEffects(path) {
|
||||||
|
if (!pluginOptions.advancedOptimizations) {
|
||||||
|
return undefined;
|
||||||
|
+ } else {
|
||||||
|
+ return true;
|
||||||
|
}
|
||||||
|
- const { sideEffects } = await build.resolve(path, {
|
||||||
|
+ /*const { sideEffects } = await build.resolve(path, {
|
||||||
|
kind: 'import-statement',
|
||||||
|
resolveDir: build.initialOptions.absWorkingDir ?? '',
|
||||||
|
});
|
||||||
|
- return sideEffects;
|
||||||
|
+ return sideEffects;*/
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
@ -895,4 +895,10 @@ export const convertKeysToCamelCase = (obj: Record<string, any>): Record<string,
|
|||||||
return _.mapKeys(obj, (value, key) => _.camelCase(key));
|
return _.mapKeys(obj, (value, key) => _.camelCase(key));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const unwrapModule = (module: any) : any => 'default' in module ? module.default : module;
|
export const unwrapModule = (module: any) : any => {
|
||||||
|
if ('default' in module && Object.keys(module).length === 1) {
|
||||||
|
return module.default;
|
||||||
|
} else {
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@ -121,7 +121,7 @@ export class EntityVersionDiffComponent extends PageComponent implements OnInit,
|
|||||||
this.popoverComponent.updatePosition();
|
this.popoverComponent.updatePosition();
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.differ = new aceDiff.default(
|
this.differ = new aceDiff(
|
||||||
{
|
{
|
||||||
element: this.diffViewerElmRef.nativeElement,
|
element: this.diffViewerElmRef.nativeElement,
|
||||||
mode: 'ace/mode/json',
|
mode: 'ace/mode/json',
|
||||||
|
|||||||
@ -29,6 +29,10 @@ import { Store } from '@ngrx/store';
|
|||||||
import { AppState } from '@core/core.state';
|
import { AppState } from '@core/core.state';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
|
defaultGoogleMapProviderSettings,
|
||||||
|
defaultHereMapProviderSettings,
|
||||||
|
defaultImageMapProviderSettings,
|
||||||
|
defaultOpenStreetMapProviderSettings, defaultTencentMapProviderSettings,
|
||||||
GoogleMapProviderSettings,
|
GoogleMapProviderSettings,
|
||||||
HereMapProviderSettings,
|
HereMapProviderSettings,
|
||||||
ImageMapProviderSettings,
|
ImageMapProviderSettings,
|
||||||
@ -39,7 +43,6 @@ import {
|
|||||||
TencentMapProviderSettings
|
TencentMapProviderSettings
|
||||||
} from '@home/components/widget/lib/maps/map-models';
|
} from '@home/components/widget/lib/maps/map-models';
|
||||||
import { extractType } from '@core/utils';
|
import { extractType } from '@core/utils';
|
||||||
//import { keys } from 'ts-transformer-keys';
|
|
||||||
import { IAliasController } from '@core/api/widget-api.models';
|
import { IAliasController } from '@core/api/widget-api.models';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -128,13 +131,11 @@ export class MapProviderSettingsComponent extends PageComponent implements OnIni
|
|||||||
writeValue(value: MapProviderSettings): void {
|
writeValue(value: MapProviderSettings): void {
|
||||||
this.modelValue = value;
|
this.modelValue = value;
|
||||||
const provider = value?.provider;
|
const provider = value?.provider;
|
||||||
// TODO: ts-transformer
|
const googleProviderSettings = extractType<GoogleMapProviderSettings>(value, Object.keys(defaultGoogleMapProviderSettings) as (keyof GoogleMapProviderSettings)[]);
|
||||||
|
const openstreetProviderSettings = extractType<OpenStreetMapProviderSettings>(value, Object.keys(defaultOpenStreetMapProviderSettings) as (keyof OpenStreetMapProviderSettings)[]);
|
||||||
/*const googleProviderSettings = extractType<GoogleMapProviderSettings>(value, keys<GoogleMapProviderSettings>());
|
const hereProviderSettings = extractType<HereMapProviderSettings>(value, Object.keys(defaultHereMapProviderSettings) as (keyof HereMapProviderSettings)[]);
|
||||||
const openstreetProviderSettings = extractType<OpenStreetMapProviderSettings>(value, keys<OpenStreetMapProviderSettings>());
|
const imageMapProviderSettings = extractType<ImageMapProviderSettings>(value, Object.keys(defaultImageMapProviderSettings) as (keyof ImageMapProviderSettings)[]);
|
||||||
const hereProviderSettings = extractType<HereMapProviderSettings>(value, keys<HereMapProviderSettings>());
|
const tencentMapProviderSettings = extractType<TencentMapProviderSettings>(value, Object.keys(defaultTencentMapProviderSettings) as (keyof TencentMapProviderSettings)[]);
|
||||||
const imageMapProviderSettings = extractType<ImageMapProviderSettings>(value, keys<ImageMapProviderSettings>());
|
|
||||||
const tencentMapProviderSettings = extractType<TencentMapProviderSettings>(value, keys<TencentMapProviderSettings>());
|
|
||||||
this.providerSettingsFormGroup.patchValue(
|
this.providerSettingsFormGroup.patchValue(
|
||||||
{
|
{
|
||||||
provider,
|
provider,
|
||||||
@ -144,7 +145,7 @@ export class MapProviderSettingsComponent extends PageComponent implements OnIni
|
|||||||
imageMapProviderSettings,
|
imageMapProviderSettings,
|
||||||
tencentMapProviderSettings
|
tencentMapProviderSettings
|
||||||
}, {emitEvent: false}
|
}, {emitEvent: false}
|
||||||
);*/
|
);
|
||||||
this.updateValidators(false);
|
this.updateValidators(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,11 +17,11 @@
|
|||||||
import { Component, forwardRef, Input, OnInit } from '@angular/core';
|
import { Component, forwardRef, Input, OnInit } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ControlValueAccessor,
|
ControlValueAccessor,
|
||||||
|
NG_VALIDATORS,
|
||||||
|
NG_VALUE_ACCESSOR,
|
||||||
UntypedFormBuilder,
|
UntypedFormBuilder,
|
||||||
UntypedFormControl,
|
UntypedFormControl,
|
||||||
UntypedFormGroup,
|
UntypedFormGroup,
|
||||||
NG_VALIDATORS,
|
|
||||||
NG_VALUE_ACCESSOR,
|
|
||||||
Validator
|
Validator
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
@ -31,6 +31,13 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import {
|
import {
|
||||||
CircleSettings,
|
CircleSettings,
|
||||||
CommonMapSettings,
|
CommonMapSettings,
|
||||||
|
defaultCircleSettings,
|
||||||
|
defaultCommonMapSettings,
|
||||||
|
defaultMapEditorSettings,
|
||||||
|
defaultMapProviderSettings,
|
||||||
|
defaultMarkerClusteringSettings,
|
||||||
|
defaultMarkersSettings,
|
||||||
|
defaultPolygonSettings,
|
||||||
MapEditorSettings,
|
MapEditorSettings,
|
||||||
MapProviders,
|
MapProviders,
|
||||||
MapProviderSettings,
|
MapProviderSettings,
|
||||||
@ -41,7 +48,6 @@ import {
|
|||||||
UnitedMapSettings
|
UnitedMapSettings
|
||||||
} from '@home/components/widget/lib/maps/map-models';
|
} from '@home/components/widget/lib/maps/map-models';
|
||||||
import { extractType } from '@core/utils';
|
import { extractType } from '@core/utils';
|
||||||
// import { keys } from 'ts-transformer-keys';
|
|
||||||
import { IAliasController } from '@core/api/widget-api.models';
|
import { IAliasController } from '@core/api/widget-api.models';
|
||||||
import { Widget } from '@shared/models/widget.models';
|
import { Widget } from '@shared/models/widget.models';
|
||||||
|
|
||||||
@ -140,13 +146,12 @@ export class MapSettingsComponent extends PageComponent implements OnInit, Contr
|
|||||||
|
|
||||||
writeValue(value: UnitedMapSettings): void {
|
writeValue(value: UnitedMapSettings): void {
|
||||||
this.modelValue = value;
|
this.modelValue = value;
|
||||||
// TODO: ts-transformer
|
const mapProviderSettings = extractType<MapProviderSettings>(value, Object.keys(defaultMapProviderSettings) as (keyof MapProviderSettings)[]);
|
||||||
/* const mapProviderSettings = extractType<MapProviderSettings>(value, keys<MapProviderSettings>());
|
const commonMapSettings = extractType<CommonMapSettings>(value, Object.keys(defaultCommonMapSettings) as (keyof CommonMapSettings)[]);
|
||||||
const commonMapSettings = extractType<CommonMapSettings>(value, keys<CommonMapSettings>());
|
const markersSettings = extractType<MarkersSettings>(value, Object.keys(defaultMarkersSettings) as (keyof MarkersSettings)[]);
|
||||||
const markersSettings = extractType<MarkersSettings>(value, keys<MarkersSettings>());
|
const polygonSettings = extractType<PolygonSettings>(value, Object.keys(defaultPolygonSettings) as (keyof PolygonSettings)[]);
|
||||||
const polygonSettings = extractType<PolygonSettings>(value, keys<PolygonSettings>());
|
const circleSettings = extractType<CircleSettings>(value, Object.keys(defaultCircleSettings) as (keyof CircleSettings)[]);
|
||||||
const circleSettings = extractType<CircleSettings>(value, keys<CircleSettings>());
|
const mapEditorSettings = extractType<MapEditorSettings>(value, Object.keys(defaultMapEditorSettings) as (keyof MapEditorSettings)[]);
|
||||||
const mapEditorSettings = extractType<MapEditorSettings>(value, keys<MapEditorSettings>());
|
|
||||||
const formValue = {
|
const formValue = {
|
||||||
mapProviderSettings,
|
mapProviderSettings,
|
||||||
commonMapSettings,
|
commonMapSettings,
|
||||||
@ -158,9 +163,9 @@ export class MapSettingsComponent extends PageComponent implements OnInit, Contr
|
|||||||
if (this.routeMap) {
|
if (this.routeMap) {
|
||||||
formValue.routeMapSettings = extractType<PolylineSettings>(value, ['strokeWeight', 'strokeOpacity']);
|
formValue.routeMapSettings = extractType<PolylineSettings>(value, ['strokeWeight', 'strokeOpacity']);
|
||||||
} else {
|
} else {
|
||||||
formValue.markerClusteringSettings = extractType<MarkerClusteringSettings>(value, keys<MarkerClusteringSettings>());
|
formValue.markerClusteringSettings = extractType<MarkerClusteringSettings>(value, Object.keys(defaultMarkerClusteringSettings) as (keyof MarkerClusteringSettings)[]);
|
||||||
}
|
}
|
||||||
this.mapSettingsFormGroup.patchValue( formValue, {emitEvent: false} ); */
|
this.mapSettingsFormGroup.patchValue( formValue, {emitEvent: false} );
|
||||||
this.updateValidators(false);
|
this.updateValidators(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,22 @@ import { Store } from '@ngrx/store';
|
|||||||
import { AppState } from '@core/core.state';
|
import { AppState } from '@core/core.state';
|
||||||
import {
|
import {
|
||||||
CircleSettings,
|
CircleSettings,
|
||||||
|
CommonMapSettings,
|
||||||
|
defaultCircleSettings,
|
||||||
|
defaultCommonMapSettings,
|
||||||
|
defaultMapProviderSettings,
|
||||||
|
defaultMarkersSettings,
|
||||||
|
defaultPolygonSettings,
|
||||||
|
defaultTripAnimationPathSettings,
|
||||||
|
defaultTripAnimationPointSettings,
|
||||||
defaultTripAnimationSettings,
|
defaultTripAnimationSettings,
|
||||||
MapProviderSettings,
|
MapProviderSettings,
|
||||||
|
MarkersSettings,
|
||||||
PointsSettings,
|
PointsSettings,
|
||||||
PolygonSettings,
|
PolygonSettings,
|
||||||
PolylineSettings,
|
PolylineSettings
|
||||||
TripAnimationCommonSettings,
|
|
||||||
TripAnimationMarkerSettings
|
|
||||||
} from 'src/app/modules/home/components/widget/lib/maps/map-models';
|
} from 'src/app/modules/home/components/widget/lib/maps/map-models';
|
||||||
import { extractType } from '@core/utils';
|
import { extractType } from '@core/utils';
|
||||||
// import { keys } from 'ts-transformer-keys';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-trip-animation-widget-settings',
|
selector: 'tb-trip-animation-widget-settings',
|
||||||
@ -69,22 +75,21 @@ export class TripAnimationWidgetSettingsComponent extends WidgetSettingsComponen
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected prepareInputSettings(settings: WidgetSettings): WidgetSettings {
|
protected prepareInputSettings(settings: WidgetSettings): WidgetSettings {
|
||||||
// TODO: ts-transformer
|
const mapProviderSettings = extractType<MapProviderSettings>(settings, Object.keys(defaultMapProviderSettings) as (keyof MapProviderSettings)[]);
|
||||||
/*const mapProviderSettings = extractType<MapProviderSettings>(settings, keys<MapProviderSettings>());
|
const commonMapSettings = extractType<CommonMapSettings>(settings, Object.keys(defaultCommonMapSettings) as (keyof CommonMapSettings)[]);
|
||||||
const commonMapSettings = extractType<TripAnimationCommonSettings>(settings, keys<TripAnimationCommonSettings>());
|
const markersSettings = extractType<MarkersSettings>(settings, Object.keys(defaultMarkersSettings) as (keyof MarkersSettings)[]);
|
||||||
const markersSettings = extractType<TripAnimationMarkerSettings>(settings, keys<TripAnimationMarkerSettings>());
|
const pathSettings = extractType<PolylineSettings>(settings, Object.keys(defaultTripAnimationPathSettings) as (keyof PolylineSettings)[]);
|
||||||
const pathSettings = extractType<PolylineSettings>(settings, keys<PolylineSettings>());
|
const pointSettings = extractType<PointsSettings>(settings, Object.keys(defaultTripAnimationPointSettings) as (keyof PointsSettings)[]);
|
||||||
const pointSettings = extractType<PointsSettings>(settings, keys<PointsSettings>());
|
const polygonSettings = extractType<PolygonSettings>(settings, Object.keys(defaultPolygonSettings) as (keyof PolygonSettings)[]);
|
||||||
const polygonSettings = extractType<PolygonSettings>(settings, keys<PolygonSettings>());
|
const circleSettings = extractType<CircleSettings>(settings, Object.keys(defaultCircleSettings) as (keyof CircleSettings)[]);
|
||||||
const circleSettings = extractType<CircleSettings>(settings, keys<CircleSettings>());*/
|
|
||||||
return {
|
return {
|
||||||
/*mapProviderSettings,
|
mapProviderSettings,
|
||||||
commonMapSettings,
|
commonMapSettings,
|
||||||
markersSettings,
|
markersSettings,
|
||||||
pathSettings,
|
pathSettings,
|
||||||
pointSettings,
|
pointSettings,
|
||||||
polygonSettings,
|
polygonSettings,
|
||||||
circleSettings*/
|
circleSettings
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -272,7 +272,7 @@ export class JsonFormComponent implements ControlValueAccessor, Validator, OnCha
|
|||||||
(modules) => {
|
(modules) => {
|
||||||
const react = unwrapModule(modules[0]);
|
const react = unwrapModule(modules[0]);
|
||||||
const reactDomClient = unwrapModule(modules[2]);
|
const reactDomClient = unwrapModule(modules[2]);
|
||||||
const jsonFormReact = modules[3].default;
|
const jsonFormReact = unwrapModule(modules[3]);
|
||||||
this.reactRoot = reactDomClient.createRoot(this.reactRootElmRef.nativeElement);
|
this.reactRoot = reactDomClient.createRoot(this.reactRootElmRef.nativeElement);
|
||||||
this.reactRoot.render(react.createElement(jsonFormReact, this.formProps));
|
this.reactRoot.render(react.createElement(jsonFormReact, this.formProps));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10239,11 +10239,6 @@ ts-node@^10.0.0, ts-node@^10.9.2:
|
|||||||
v8-compile-cache-lib "^3.0.1"
|
v8-compile-cache-lib "^3.0.1"
|
||||||
yn "3.1.1"
|
yn "3.1.1"
|
||||||
|
|
||||||
ts-transformer-keys@^0.4.4:
|
|
||||||
version "0.4.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/ts-transformer-keys/-/ts-transformer-keys-0.4.4.tgz#c185508b3ae9b79236aac58f788c85ca3ac807d7"
|
|
||||||
integrity sha512-LrqgvaFvar01/5mbunRyeLTSIkqoC2xfcpL/90aDY6vR07DGyH+UaYGdIEsUudnlAw2Sr0pxFgdZvE0QIyI4qA==
|
|
||||||
|
|
||||||
tsconfig-paths@^3.15.0:
|
tsconfig-paths@^3.15.0:
|
||||||
version "3.15.0"
|
version "3.15.0"
|
||||||
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
|
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user