Skip to content

Commit

Permalink
feat: migrate to esbuild based application builder (#8394)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperLife1119 committed Apr 16, 2024
1 parent 7bcd510 commit 28ff3ac
Show file tree
Hide file tree
Showing 26 changed files with 214 additions and 230 deletions.
163 changes: 58 additions & 105 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/browser",
"index": "./site/doc/index.html",
"main": "./site/doc/main.ts",
"tsConfig": "./site/doc/tsconfig.app.json",
"polyfills": "./site/doc/polyfills.ts",
"outputPath": "dist",
"index": "site/doc/index.html",
"browser": "site/doc/main.ts",
"server": "site/doc/main.server.ts",
"tsConfig": "site/doc/tsconfig.app.json",
"serviceWorker": "ngsw-config.json",
"prerender": {
"routesFile": "scripts/prerender/route-paths.txt"
},
"ssr": {
"entry": "site/doc/server.ts"
},
"polyfills": [
"site/doc/polyfills.ts"
],
"assets": [
"site/doc/assets",
"site/doc/manifest.json",
Expand All @@ -25,12 +35,12 @@
"site/doc/robots.txt",
{
"glob": "**/*",
"input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
"input": "node_modules/@ant-design/icons-angular/src/inline-svg/",
"output": "/assets/"
},
{
"glob": "**/*",
"input": "./node_modules/monaco-editor/min/vs",
"input": "node_modules/monaco-editor/min/vs",
"output": "/assets/vs/"
}
],
Expand All @@ -42,68 +52,38 @@
"codesandbox-import-utils",
"@ant-design/colors",
"cron-parser"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "./site/doc/environments/environment.ts",
"with": "./site/doc/environments/environment.prod.ts"
"replace": "site/doc/environments/environment.ts",
"with": "site/doc/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json"
"outputHashing": "all"
},
"pre-production": {
"fileReplacements": [
{
"replace": "./site/doc/environments/environment.ts",
"with": "./site/doc/environments/environment.pre-prod.ts"
"replace": "site/doc/environments/environment.ts",
"with": "site/doc/environments/environment.pre-prod.ts"
}
],
"serviceWorker": false
"outputHashing": "all"
},
"es5": {
"tsConfig": "./site/doc/tsconfig.es5.json"
}
},
"defaultConfiguration": ""
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "./site/doc/main.server.ts",
"tsConfig": "./site/doc/tsconfig.server.json",
"sourceMap": true,
"optimization": false,
"buildOptimizer": false
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "./site/doc/environments/environment.ts",
"with": "./site/doc/environments/environment.prod.ts"
}
]
"preview": {
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": ""
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
Expand All @@ -115,30 +95,6 @@
"buildTarget": "ng-zorro-antd-doc:build:production"
}
}
},
"serve-ssr": {
"builder": "@angular-devkit/build-angular:ssr-dev-server",
"options": {
"browserTarget": "ng-zorro-antd-doc:build",
"serverTarget": "ng-zorro-antd-doc:server"
},
"configurations": {
"production": {
"browserTarget": "ng-zorro-antd-doc:production",
"serverTarget": "ng-zorro-antd-doc:production"
}
}
},
"prerender": {
"builder": "@angular-devkit/build-angular:prerender",
"options": {
"browserTarget": "ng-zorro-antd-doc:build:production",
"serverTarget": "ng-zorro-antd-doc:server:production",
"routesFile": "scripts/prerender/route-paths.txt"
},
"configurations": {
"production": {}
}
}
}
},
Expand All @@ -148,26 +104,29 @@
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/browser/iframe",
"index": "./site/iframe/index.html",
"main": "./site/iframe/main.ts",
"tsConfig": "./site/iframe/tsconfig.app.json",
"polyfills": "./site/iframe/polyfills.ts",
"outputPath": {
"base": "dist/browser/iframe",
"browser": ""
},
"index": "site/iframe/index.html",
"browser": "site/iframe/main.ts",
"tsConfig": "site/iframe/tsconfig.app.json",
"polyfills": [
"site/iframe/polyfills.ts"
],
"assets": [
{
"glob": "**/*",
"input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
"input": "node_modules/@ant-design/icons-angular/src/inline-svg/",
"output": "/assets/"
}
],
"styles": [
"components/ng-zorro-antd.less"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
Expand All @@ -176,21 +135,20 @@
"production": {
"fileReplacements": [
{
"replace": "./site/iframe/environments/environment.ts",
"with": "./site/iframe/environments/environment.prod.ts"
"replace": "site/iframe/environments/environment.ts",
"with": "site/iframe/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": ""
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
Expand All @@ -205,11 +163,6 @@
}
}
},
"ng-zorro-antd-doc-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application"
},
"ng-zorro-antd-lib": {
"root": "components",
"sourceRoot": "components",
Expand All @@ -235,7 +188,7 @@
"builder": "@angular-builders/custom-webpack:karma",
"options": {
"customWebpackConfig": {
"path": "./custom-webpack-spec.config.js"
"path": "custom-webpack-spec.config.js"
},
"fileReplacements": [
{
Expand All @@ -246,7 +199,7 @@
"assets": [
{
"glob": "**/*",
"input": "./node_modules/monaco-editor/min/vs",
"input": "node_modules/monaco-editor/min/vs",
"output": "/assets/vs/"
}
],
Expand Down
2 changes: 1 addition & 1 deletion components/affix/affix.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class NzAffixComponent implements AfterViewInit, OnChanges, OnDestroy, On
private positionChangeSubscription: Subscription = Subscription.EMPTY;
private offsetChanged$ = new ReplaySubject<void>(1);
private destroy$ = new Subject<boolean>();
private timeout?: number;
private timeout?: ReturnType<typeof setTimeout>;
private document: Document;

private get target(): Element | Window {
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/anchor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class NzAnchorComponent implements OnDestroy, AfterViewInit, OnChanges {
private links: NzAnchorLinkComponent[] = [];
private animating = false;
private destroy$ = new Subject<boolean>();
private handleScrollTimeoutID = -1;
private handleScrollTimeoutID?: ReturnType<typeof setTimeout>;

constructor(
@Inject(DOCUMENT) private doc: NzSafeAny,
Expand Down
6 changes: 3 additions & 3 deletions components/carousel/carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { fromEvent, Subject } from 'rxjs';
import { Subject, fromEvent } from 'rxjs';
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';

import { NzResizeObserver } from 'ng-zorro-antd/cdk/resize-observer';
Expand Down Expand Up @@ -165,7 +165,7 @@ export class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnD
slickTrackEl!: HTMLElement;
strategy?: NzCarouselBaseStrategy;
vertical = false;
transitionInProgress: number | null = null;
transitionInProgress?: ReturnType<typeof setTimeout>;
dir: Direction = 'ltr';

private destroy$ = new Subject<void>();
Expand Down Expand Up @@ -362,7 +362,7 @@ export class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnD
private clearScheduledTransition(): void {
if (this.transitionInProgress) {
clearTimeout(this.transitionInProgress);
this.transitionInProgress = null;
this.transitionInProgress = undefined;
}
}

Expand Down
18 changes: 9 additions & 9 deletions components/cascader/cascader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Component,
ElementRef,
EventEmitter,
forwardRef,
Host,
HostListener,
Input,
Expand All @@ -29,10 +28,11 @@ import {
TemplateRef,
ViewChild,
ViewChildren,
ViewEncapsulation
ViewEncapsulation,
forwardRef
} from '@angular/core';
import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
import { BehaviorSubject, EMPTY, fromEvent, Observable, of as observableOf } from 'rxjs';
import { BehaviorSubject, EMPTY, Observable, fromEvent, of as observableOf } from 'rxjs';
import { distinctUntilChanged, map, startWith, switchMap, takeUntil, withLatestFrom } from 'rxjs/operators';

import { slideMotion } from 'ng-zorro-antd/core/animation';
Expand All @@ -50,7 +50,7 @@ import {
NzStatus,
NzValidateStatus
} from 'ng-zorro-antd/core/types';
import { getStatusClassNames, InputBoolean, toArray } from 'ng-zorro-antd/core/util';
import { InputBoolean, getStatusClassNames, toArray } from 'ng-zorro-antd/core/util';
import { NzEmptyModule } from 'ng-zorro-antd/empty';
import { NzCascaderI18nInterface, NzI18nService } from 'ng-zorro-antd/i18n';
import { NzIconModule } from 'ng-zorro-antd/icon';
Expand Down Expand Up @@ -347,8 +347,8 @@ export class NzCascaderComponent

private inputString = '';
private isOpening = false;
private delayMenuTimer: number | null = null;
private delaySelectTimer: number | null = null;
private delayMenuTimer?: ReturnType<typeof setTimeout>;
private delaySelectTimer?: ReturnType<typeof setTimeout>;
private isNzDisableFirstChange: boolean = true;

get inSearchingMode(): boolean {
Expand Down Expand Up @@ -556,7 +556,7 @@ export class NzCascaderComponent
private clearDelayMenuTimer(): void {
if (this.delayMenuTimer) {
clearTimeout(this.delayMenuTimer);
this.delayMenuTimer = null;
this.delayMenuTimer = undefined;
}
}

Expand Down Expand Up @@ -740,15 +740,15 @@ export class NzCascaderComponent
private clearDelaySelectTimer(): void {
if (this.delaySelectTimer) {
clearTimeout(this.delaySelectTimer);
this.delaySelectTimer = null;
this.delaySelectTimer = undefined;
}
}

private delaySetOptionActivated(option: NzCascaderOption, columnIndex: number, performSelect: boolean): void {
this.clearDelaySelectTimer();
this.delaySelectTimer = setTimeout(() => {
this.cascaderService.setOptionActivated(option, columnIndex, performSelect);
this.delaySelectTimer = null;
this.delaySelectTimer = undefined;
}, 150);
}

Expand Down
2 changes: 1 addition & 1 deletion components/core/polyfill/request-animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function requestAnimationFramePolyfill(): typeof requestAnimationFrame {
return function (callback: FrameRequestCallback): number {
const currTime = new Date().getTime();
const timeToCall = Math.max(0, 16 - (currTime - lastTime));
const id = setTimeout(() => {
const id = window.setTimeout(() => {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
Expand Down
2 changes: 1 addition & 1 deletion components/drawer/drawer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class NzDrawerComponent<T extends {} = NzSafeAny, R = NzSafeAny, D extend
private destroy$ = new Subject<void>();
previouslyFocusedElement?: HTMLElement;
placementChanging = false;
placementChangeTimeoutId = -1;
placementChangeTimeoutId?: ReturnType<typeof setTimeout>;
nzContentParams?: NzSafeAny; // only service
nzData?: D;
overlayRef?: OverlayRef | null;
Expand Down

0 comments on commit 28ff3ac

Please sign in to comment.