Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run(builderConfig) {
const options = builderConfig.options;
const root = this.context.workspace.root;
const projectRoot = core_1.resolve(root, builderConfig.root);
const host = new core_1.virtualFs.AliasHost(this.context.host);
const webpackDevServerBuilder = new build_webpack_1.WebpackDevServerBuilder(Object.assign({}, this.context, { host }));
let browserOptions;
let first = true;
let opnAddress;
return check_port_1.checkPort(options.port, options.host).pipe(operators_1.tap((port) => options.port = port), operators_1.concatMap(() => this._getBrowserOptions(options)), operators_1.tap(opts => browserOptions = utils_1.normalizeBuilderSchema(host, root, opts)), operators_1.concatMap(() => {
const webpackConfig = this.buildWebpackConfig(root, projectRoot, host, browserOptions);
let webpackDevServerConfig;
try {
webpackDevServerConfig = this._buildServerConfig(root, options, browserOptions);
}
catch (err) {
return rxjs_1.throwError(err);
}
// Resolve public host and client address.
let clientAddress = `${options.ssl ? 'https' : 'http'}://0.0.0.0:0`;
if (options.publicHost) {
let publicHost = options.publicHost;
run(builderConfig) {
const options = builderConfig.options;
const root = this.context.workspace.root;
const projectRoot = core_1.resolve(root, builderConfig.root);
const host = new core_1.virtualFs.AliasHost(this.context.host);
const webpackDevServerBuilder = new build_webpack_1.WebpackDevServerBuilder(Object.assign({}, this.context, { host }));
let browserOptions;
let first = true;
let opnAddress;
return check_port_1.checkPort(options.port, options.host).pipe(operators_1.tap((port) => options.port = port), operators_1.concatMap(() => this._getBrowserOptions(options)), operators_1.tap((opts) => browserOptions = opts), operators_1.concatMap(() => utils_1.normalizeFileReplacements(browserOptions.fileReplacements, host, root)), operators_1.tap(fileReplacements => browserOptions.fileReplacements = fileReplacements), operators_1.concatMap(() => utils_1.normalizeAssetPatterns(browserOptions.assets, host, root, projectRoot, builderConfig.sourceRoot)),
// Replace the assets in options with the normalized version.
operators_1.tap((assetPatternObjects => browserOptions.assets = assetPatternObjects)), operators_1.concatMap(() => {
const webpackConfig = this.buildWebpackConfig(root, projectRoot, host, browserOptions);
let webpackDevServerConfig;
try {
webpackDevServerConfig = this._buildServerConfig(root, projectRoot, options, browserOptions);
}
catch (err) {
return rxjs_1.throwError(err);
}
// Resolve public host and client address.
let clientAddress = `${options.ssl ? 'https' : 'http'}://0.0.0.0:0`;
run(builderConfig: BuilderConfiguration): Observable {
const options = builderConfig.options;
const root = this.context.workspace.root;
const projectRoot = resolve(root, builderConfig.root);
const host = new virtualFs.AliasHost(this.context.host as virtualFs.Host);
const webpackDevServerBuilder = new WebpackDevServerBuilder({ ...this.context, host });
let browserOptions: NormalizedBrowserBuilderSchema;
let first = true;
let opnAddress: string;
return from(checkPort(options.port || 0, options.host || 'localhost', 4200)).pipe(
tap((port) => options.port = port),
concatMap(() => this._getBrowserOptions(options)),
tap(opts => browserOptions = normalizeBrowserSchema(
host,
root,
resolve(root, builderConfig.root),
builderConfig.sourceRoot,
opts.options,
)),
concatMap(() => {
const webpackConfig = this.buildWebpackConfig(root, projectRoot, host, browserOptions);