Skip to content

Commit 0d448dc

Browse files
author
Angular Builds
committed
687a6c7 feat(@angular/build): add --inspect option to the dev-server
1 parent f8e0d60 commit 0d448dc

File tree

7 files changed

+58
-8
lines changed

7 files changed

+58
-8
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "@angular-devkit/build-angular",
3-
"version": "18.1.0-next.0+sha-cd1c181",
3+
"version": "18.1.0-next.0+sha-687a6c7",
44
"description": "Angular Webpack Build Facade",
55
"main": "src/index.js",
66
"typings": "src/index.d.ts",
77
"builders": "builders.json",
88
"dependencies": {
99
"@ampproject/remapping": "2.3.0",
10-
"@angular/build": "github:angular/angular-build-builds#cd1c181",
11-
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#cd1c181",
12-
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#cd1c181",
13-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#cd1c181",
10+
"@angular/build": "github:angular/angular-build-builds#687a6c7",
11+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#687a6c7",
12+
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#687a6c7",
13+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#687a6c7",
1414
"@babel/core": "7.24.6",
1515
"@babel/generator": "7.24.6",
1616
"@babel/helper-annotate-as-pure": "7.24.6",
@@ -21,7 +21,7 @@
2121
"@babel/preset-env": "7.24.6",
2222
"@babel/runtime": "7.24.6",
2323
"@discoveryjs/json-ext": "0.5.7",
24-
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#cd1c181",
24+
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#687a6c7",
2525
"@vitejs/plugin-basic-ssl": "1.1.0",
2626
"ansi-colors": "4.1.3",
2727
"autoprefixer": "10.4.19",

src/builders/dev-server/options.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ export declare function normalizeOptions(context: BuilderContext, projectName: s
4444
sslKey: string | undefined;
4545
forceEsbuild: boolean | undefined;
4646
prebundle: import("./schema").PrebundleUnion;
47+
inspect: boolean | {
48+
host?: string;
49+
port?: number;
50+
};
4751
}>;

src/builders/dev-server/options.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,30 @@ async function normalizeOptions(context, projectName, options) {
5050
logger.warn('Prebundling has been configured but will not be used because scripts optimization is enabled.');
5151
}
5252
}
53+
let inspect = false;
54+
const inspectRaw = options.inspect;
55+
if (inspectRaw === true || inspectRaw === '' || inspectRaw === 'true') {
56+
inspect = {
57+
host: undefined,
58+
port: undefined,
59+
};
60+
}
61+
else if (typeof inspectRaw === 'string' && inspectRaw !== 'false') {
62+
const port = +inspectRaw;
63+
if (isFinite(port)) {
64+
inspect = {
65+
host: undefined,
66+
port,
67+
};
68+
}
69+
else {
70+
const [host, port] = inspectRaw.split(':');
71+
inspect = {
72+
host,
73+
port: isNaN(+port) ? undefined : +port,
74+
};
75+
}
76+
}
5377
// Initial options to keep
5478
const { host, port, poll, open, verbose, watch, allowedHosts, disableHostCheck, liveReload, hmr, headers, proxyConfig, servePath, publicHost, ssl, sslCert, sslKey, forceEsbuild, prebundle, } = options;
5579
// Return all the normalized options
@@ -78,5 +102,6 @@ async function normalizeOptions(context, projectName, options) {
78102
forceEsbuild,
79103
// Prebundling defaults to true but requires caching to function
80104
prebundle: cacheOptions.enabled && !optimization.scripts && (prebundle ?? true),
105+
inspect,
81106
};
82107
}

src/builders/dev-server/schema.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export interface Schema {
4444
* Host to listen on.
4545
*/
4646
host?: string;
47+
/**
48+
* Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are
49+
* enabled.
50+
*/
51+
inspect?: Inspect;
4752
/**
4853
* Whether to reload the page on change, using live-reload.
4954
*/
@@ -103,6 +108,11 @@ export interface Schema {
103108
*/
104109
watch?: boolean;
105110
}
111+
/**
112+
* Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are
113+
* enabled.
114+
*/
115+
export type Inspect = boolean | string;
106116
/**
107117
* Enable and control the Vite-based development server's prebundling capabilities. To
108118
* enable prebundling, the Angular CLI cache must also be enabled. This option has no effect

src/builders/dev-server/schema.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@
102102
"type": "number",
103103
"description": "Enable and define the file watching poll time period in milliseconds."
104104
},
105+
"inspect": {
106+
"default": false,
107+
"description": "Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are enabled.",
108+
"oneOf": [
109+
{
110+
"type": "string",
111+
"description": "Activate the inspector on host and port in the format of `[[host:]port]`. See the security warning in https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure regarding the host parameter usage."
112+
},
113+
{ "type": "boolean" }
114+
]
115+
},
105116
"forceEsbuild": {
106117
"type": "boolean",
107118
"description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system.",

src/utils/normalize-cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
1010
exports.normalizeCacheOptions = normalizeCacheOptions;
1111
const node_path_1 = require("node:path");
1212
/** Version placeholder is replaced during the build process with actual package version */
13-
const VERSION = '18.1.0-next.0+sha-cd1c181';
13+
const VERSION = '18.1.0-next.0+sha-687a6c7';
1414
function hasCacheMetadata(value) {
1515
return (!!value &&
1616
typeof value === 'object' &&

uniqueId

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Wed Jun 05 2024 14:10:24 GMT+0000 (Coordinated Universal Time)
1+
Wed Jun 05 2024 15:16:54 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)