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",
|
||||
"tinymce": "~6.8.5",
|
||||
"tooltipster": "^4.2.8",
|
||||
"ts-transformer-keys": "^0.4.4",
|
||||
"tslib": "^2.7.0",
|
||||
"tv4": "^1.3.0",
|
||||
"typeface-roboto": "^1.1.13",
|
||||
|
||||
@ -12,7 +12,7 @@ index 625c621..4fc8bd8 100755
|
||||
}
|
||||
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
|
||||
index b1bb6ea..e946fd1 100755
|
||||
index b1bb6ea..c76b4c6 100755
|
||||
--- a/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) {
|
||||
@ -24,3 +24,20 @@ index b1bb6ea..e946fd1 100755
|
||||
}, environment_options_1.maxWorkers, cacheStore?.createCache('jstransformer'));
|
||||
// Setup defines based on the values used by the Angular compiler-cli
|
||||
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));
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.differ = new aceDiff.default(
|
||||
this.differ = new aceDiff(
|
||||
{
|
||||
element: this.diffViewerElmRef.nativeElement,
|
||||
mode: 'ace/mode/json',
|
||||
|
||||
@ -29,6 +29,10 @@ import { Store } from '@ngrx/store';
|
||||
import { AppState } from '@core/core.state';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import {
|
||||
defaultGoogleMapProviderSettings,
|
||||
defaultHereMapProviderSettings,
|
||||
defaultImageMapProviderSettings,
|
||||
defaultOpenStreetMapProviderSettings, defaultTencentMapProviderSettings,
|
||||
GoogleMapProviderSettings,
|
||||
HereMapProviderSettings,
|
||||
ImageMapProviderSettings,
|
||||
@ -39,7 +43,6 @@ import {
|
||||
TencentMapProviderSettings
|
||||
} from '@home/components/widget/lib/maps/map-models';
|
||||
import { extractType } from '@core/utils';
|
||||
//import { keys } from 'ts-transformer-keys';
|
||||
import { IAliasController } from '@core/api/widget-api.models';
|
||||
|
||||
@Component({
|
||||
@ -128,13 +131,11 @@ export class MapProviderSettingsComponent extends PageComponent implements OnIni
|
||||
writeValue(value: MapProviderSettings): void {
|
||||
this.modelValue = value;
|
||||
const provider = value?.provider;
|
||||
// TODO: ts-transformer
|
||||
|
||||
/*const googleProviderSettings = extractType<GoogleMapProviderSettings>(value, keys<GoogleMapProviderSettings>());
|
||||
const openstreetProviderSettings = extractType<OpenStreetMapProviderSettings>(value, keys<OpenStreetMapProviderSettings>());
|
||||
const hereProviderSettings = extractType<HereMapProviderSettings>(value, keys<HereMapProviderSettings>());
|
||||
const imageMapProviderSettings = extractType<ImageMapProviderSettings>(value, keys<ImageMapProviderSettings>());
|
||||
const tencentMapProviderSettings = extractType<TencentMapProviderSettings>(value, keys<TencentMapProviderSettings>());
|
||||
const googleProviderSettings = extractType<GoogleMapProviderSettings>(value, Object.keys(defaultGoogleMapProviderSettings) as (keyof GoogleMapProviderSettings)[]);
|
||||
const openstreetProviderSettings = extractType<OpenStreetMapProviderSettings>(value, Object.keys(defaultOpenStreetMapProviderSettings) as (keyof OpenStreetMapProviderSettings)[]);
|
||||
const hereProviderSettings = extractType<HereMapProviderSettings>(value, Object.keys(defaultHereMapProviderSettings) as (keyof HereMapProviderSettings)[]);
|
||||
const imageMapProviderSettings = extractType<ImageMapProviderSettings>(value, Object.keys(defaultImageMapProviderSettings) as (keyof ImageMapProviderSettings)[]);
|
||||
const tencentMapProviderSettings = extractType<TencentMapProviderSettings>(value, Object.keys(defaultTencentMapProviderSettings) as (keyof TencentMapProviderSettings)[]);
|
||||
this.providerSettingsFormGroup.patchValue(
|
||||
{
|
||||
provider,
|
||||
@ -144,7 +145,7 @@ export class MapProviderSettingsComponent extends PageComponent implements OnIni
|
||||
imageMapProviderSettings,
|
||||
tencentMapProviderSettings
|
||||
}, {emitEvent: false}
|
||||
);*/
|
||||
);
|
||||
this.updateValidators(false);
|
||||
}
|
||||
|
||||
|
||||
@ -17,11 +17,11 @@
|
||||
import { Component, forwardRef, Input, OnInit } from '@angular/core';
|
||||
import {
|
||||
ControlValueAccessor,
|
||||
NG_VALIDATORS,
|
||||
NG_VALUE_ACCESSOR,
|
||||
UntypedFormBuilder,
|
||||
UntypedFormControl,
|
||||
UntypedFormGroup,
|
||||
NG_VALIDATORS,
|
||||
NG_VALUE_ACCESSOR,
|
||||
Validator
|
||||
} from '@angular/forms';
|
||||
import { PageComponent } from '@shared/components/page.component';
|
||||
@ -31,6 +31,13 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import {
|
||||
CircleSettings,
|
||||
CommonMapSettings,
|
||||
defaultCircleSettings,
|
||||
defaultCommonMapSettings,
|
||||
defaultMapEditorSettings,
|
||||
defaultMapProviderSettings,
|
||||
defaultMarkerClusteringSettings,
|
||||
defaultMarkersSettings,
|
||||
defaultPolygonSettings,
|
||||
MapEditorSettings,
|
||||
MapProviders,
|
||||
MapProviderSettings,
|
||||
@ -41,7 +48,6 @@ import {
|
||||
UnitedMapSettings
|
||||
} from '@home/components/widget/lib/maps/map-models';
|
||||
import { extractType } from '@core/utils';
|
||||
// import { keys } from 'ts-transformer-keys';
|
||||
import { IAliasController } from '@core/api/widget-api.models';
|
||||
import { Widget } from '@shared/models/widget.models';
|
||||
|
||||
@ -140,13 +146,12 @@ export class MapSettingsComponent extends PageComponent implements OnInit, Contr
|
||||
|
||||
writeValue(value: UnitedMapSettings): void {
|
||||
this.modelValue = value;
|
||||
// TODO: ts-transformer
|
||||
/* const mapProviderSettings = extractType<MapProviderSettings>(value, keys<MapProviderSettings>());
|
||||
const commonMapSettings = extractType<CommonMapSettings>(value, keys<CommonMapSettings>());
|
||||
const markersSettings = extractType<MarkersSettings>(value, keys<MarkersSettings>());
|
||||
const polygonSettings = extractType<PolygonSettings>(value, keys<PolygonSettings>());
|
||||
const circleSettings = extractType<CircleSettings>(value, keys<CircleSettings>());
|
||||
const mapEditorSettings = extractType<MapEditorSettings>(value, keys<MapEditorSettings>());
|
||||
const mapProviderSettings = extractType<MapProviderSettings>(value, Object.keys(defaultMapProviderSettings) as (keyof MapProviderSettings)[]);
|
||||
const commonMapSettings = extractType<CommonMapSettings>(value, Object.keys(defaultCommonMapSettings) as (keyof CommonMapSettings)[]);
|
||||
const markersSettings = extractType<MarkersSettings>(value, Object.keys(defaultMarkersSettings) as (keyof MarkersSettings)[]);
|
||||
const polygonSettings = extractType<PolygonSettings>(value, Object.keys(defaultPolygonSettings) as (keyof PolygonSettings)[]);
|
||||
const circleSettings = extractType<CircleSettings>(value, Object.keys(defaultCircleSettings) as (keyof CircleSettings)[]);
|
||||
const mapEditorSettings = extractType<MapEditorSettings>(value, Object.keys(defaultMapEditorSettings) as (keyof MapEditorSettings)[]);
|
||||
const formValue = {
|
||||
mapProviderSettings,
|
||||
commonMapSettings,
|
||||
@ -158,9 +163,9 @@ export class MapSettingsComponent extends PageComponent implements OnInit, Contr
|
||||
if (this.routeMap) {
|
||||
formValue.routeMapSettings = extractType<PolylineSettings>(value, ['strokeWeight', 'strokeOpacity']);
|
||||
} 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);
|
||||
}
|
||||
|
||||
|
||||
@ -21,16 +21,22 @@ import { Store } from '@ngrx/store';
|
||||
import { AppState } from '@core/core.state';
|
||||
import {
|
||||
CircleSettings,
|
||||
CommonMapSettings,
|
||||
defaultCircleSettings,
|
||||
defaultCommonMapSettings,
|
||||
defaultMapProviderSettings,
|
||||
defaultMarkersSettings,
|
||||
defaultPolygonSettings,
|
||||
defaultTripAnimationPathSettings,
|
||||
defaultTripAnimationPointSettings,
|
||||
defaultTripAnimationSettings,
|
||||
MapProviderSettings,
|
||||
MarkersSettings,
|
||||
PointsSettings,
|
||||
PolygonSettings,
|
||||
PolylineSettings,
|
||||
TripAnimationCommonSettings,
|
||||
TripAnimationMarkerSettings
|
||||
PolylineSettings
|
||||
} from 'src/app/modules/home/components/widget/lib/maps/map-models';
|
||||
import { extractType } from '@core/utils';
|
||||
// import { keys } from 'ts-transformer-keys';
|
||||
|
||||
@Component({
|
||||
selector: 'tb-trip-animation-widget-settings',
|
||||
@ -69,22 +75,21 @@ export class TripAnimationWidgetSettingsComponent extends WidgetSettingsComponen
|
||||
}
|
||||
|
||||
protected prepareInputSettings(settings: WidgetSettings): WidgetSettings {
|
||||
// TODO: ts-transformer
|
||||
/*const mapProviderSettings = extractType<MapProviderSettings>(settings, keys<MapProviderSettings>());
|
||||
const commonMapSettings = extractType<TripAnimationCommonSettings>(settings, keys<TripAnimationCommonSettings>());
|
||||
const markersSettings = extractType<TripAnimationMarkerSettings>(settings, keys<TripAnimationMarkerSettings>());
|
||||
const pathSettings = extractType<PolylineSettings>(settings, keys<PolylineSettings>());
|
||||
const pointSettings = extractType<PointsSettings>(settings, keys<PointsSettings>());
|
||||
const polygonSettings = extractType<PolygonSettings>(settings, keys<PolygonSettings>());
|
||||
const circleSettings = extractType<CircleSettings>(settings, keys<CircleSettings>());*/
|
||||
const mapProviderSettings = extractType<MapProviderSettings>(settings, Object.keys(defaultMapProviderSettings) as (keyof MapProviderSettings)[]);
|
||||
const commonMapSettings = extractType<CommonMapSettings>(settings, Object.keys(defaultCommonMapSettings) as (keyof CommonMapSettings)[]);
|
||||
const markersSettings = extractType<MarkersSettings>(settings, Object.keys(defaultMarkersSettings) as (keyof MarkersSettings)[]);
|
||||
const pathSettings = extractType<PolylineSettings>(settings, Object.keys(defaultTripAnimationPathSettings) as (keyof PolylineSettings)[]);
|
||||
const pointSettings = extractType<PointsSettings>(settings, Object.keys(defaultTripAnimationPointSettings) as (keyof PointsSettings)[]);
|
||||
const polygonSettings = extractType<PolygonSettings>(settings, Object.keys(defaultPolygonSettings) as (keyof PolygonSettings)[]);
|
||||
const circleSettings = extractType<CircleSettings>(settings, Object.keys(defaultCircleSettings) as (keyof CircleSettings)[]);
|
||||
return {
|
||||
/*mapProviderSettings,
|
||||
mapProviderSettings,
|
||||
commonMapSettings,
|
||||
markersSettings,
|
||||
pathSettings,
|
||||
pointSettings,
|
||||
polygonSettings,
|
||||
circleSettings*/
|
||||
circleSettings
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -272,7 +272,7 @@ export class JsonFormComponent implements ControlValueAccessor, Validator, OnCha
|
||||
(modules) => {
|
||||
const react = unwrapModule(modules[0]);
|
||||
const reactDomClient = unwrapModule(modules[2]);
|
||||
const jsonFormReact = modules[3].default;
|
||||
const jsonFormReact = unwrapModule(modules[3]);
|
||||
this.reactRoot = reactDomClient.createRoot(this.reactRootElmRef.nativeElement);
|
||||
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"
|
||||
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:
|
||||
version "3.15.0"
|
||||
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user