Skip to content

Commit 3085bb7

Browse files
author
Angular Builds
committed
2908985 fix(@angular/cli): prevent nested schematic execution from generating analytics
1 parent 275a321 commit 3085bb7

File tree

8 files changed

+53
-35
lines changed

8 files changed

+53
-35
lines changed

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "@angular-devkit/build-angular",
3-
"version": "0.800.0-beta.18+102.56d6dc8",
3+
"version": "0.800.0-beta.18+100.2908985",
44
"description": "Angular Webpack Build Facade",
55
"experimental": true,
66
"main": "src/index.js",
77
"typings": "src/index.d.ts",
88
"builders": "builders.json",
99
"dependencies": {
10-
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#56d6dc8",
11-
"@angular-devkit/build-optimizer": "github:angular/angular-devkit-build-optimizer-builds#56d6dc8",
12-
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#56d6dc8",
13-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#56d6dc8",
14-
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#56d6dc8",
10+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#2908985",
11+
"@angular-devkit/build-optimizer": "github:angular/angular-devkit-build-optimizer-builds#2908985",
12+
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#2908985",
13+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#2908985",
14+
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#2908985",
1515
"ajv": "6.10.0",
1616
"autoprefixer": "9.5.1",
1717
"browserslist": "4.6.0",
@@ -43,6 +43,7 @@
4343
"source-map-support": "0.5.12",
4444
"source-map-loader": "0.2.4",
4545
"speed-measure-webpack-plugin": "1.3.1",
46+
"stats-webpack-plugin": "0.7.0",
4647
"style-loader": "0.23.1",
4748
"stylus": "0.54.5",
4849
"stylus-loader": "3.0.2",

src/angular-cli-files/models/webpack-configs/common.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
1212
const path = require("path");
1313
const typescript_1 = require("typescript");
1414
const webpack_1 = require("webpack");
15-
const webpack_sources_1 = require("webpack-sources");
1615
const differential_loading_1 = require("../../../utils/differential-loading");
1716
const bundle_budget_1 = require("../../plugins/bundle-budget");
1817
const cleancss_webpack_plugin_1 = require("../../plugins/cleancss-webpack-plugin");
1918
const named_chunks_plugin_1 = require("../../plugins/named-chunks-plugin");
2019
const scripts_webpack_plugin_1 = require("../../plugins/scripts-webpack-plugin");
2120
const find_up_1 = require("../../utilities/find-up");
21+
const require_project_module_1 = require("../../utilities/require-project-module");
2222
const utils_1 = require("./utils");
2323
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
2424
const CircularDependencyPlugin = require('circular-dependency-plugin');
2525
const TerserPlugin = require('terser-webpack-plugin');
26+
const StatsPlugin = require('stats-webpack-plugin');
2627
// tslint:disable-next-line:no-any
2728
const g = typeof global !== 'undefined' ? global : {};
2829
exports.buildOptimizerLoader = g['_DevKitIsLocal']
@@ -159,14 +160,7 @@ function getCommonConfig(wco) {
159160
}));
160161
}
161162
if (buildOptions.statsJson) {
162-
extraPlugins.push(new class {
163-
apply(compiler) {
164-
compiler.hooks.emit.tap('angular-cli-stats', compilation => {
165-
const data = JSON.stringify(compilation.getStats().toJson('verbose'));
166-
compilation.assets[`stats${targetInFileName}.json`] = new webpack_sources_1.RawSource(data);
167-
});
168-
}
169-
});
163+
extraPlugins.push(new StatsPlugin(`stats${targetInFileName}.json`, 'verbose'));
170164
}
171165
if (buildOptions.namedChunks) {
172166
extraPlugins.push(new named_chunks_plugin_1.NamedLazyChunksPlugin());
@@ -198,13 +192,13 @@ function getCommonConfig(wco) {
198192
const loaderNodeModules = find_up_1.findAllNodeModules(__dirname, projectRoot);
199193
loaderNodeModules.unshift('node_modules');
200194
// Load rxjs path aliases.
201-
// https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#build-and-treeshaking
195+
// https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md#build-and-treeshaking
202196
let alias = {};
203197
try {
204198
const rxjsPathMappingImport = wco.supportES2015
205199
? 'rxjs/_esm2015/path-mapping'
206200
: 'rxjs/_esm5/path-mapping';
207-
const rxPaths = require(require.resolve(rxjsPathMappingImport, { paths: [projectRoot] }));
201+
const rxPaths = require_project_module_1.requireProjectModule(projectRoot, rxjsPathMappingImport);
208202
alias = rxPaths(nodeModules);
209203
}
210204
catch (_a) { }
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
export declare function readTsconfig(tsconfigPath: string): import("typescript").ParsedCommandLine;
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import * as ts from 'typescript';
9+
export declare function readTsconfig(tsconfigPath: string): ts.ParsedCommandLine;

src/angular-cli-files/utilities/read-tsconfig.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
/**
4-
* @license
5-
* Copyright Google Inc. All Rights Reserved.
6-
*
7-
* Use of this source code is governed by an MIT-style license that can be
8-
* found in the LICENSE file at https://angular.io/license
9-
*/
10-
// TODO: cleanup this file, it's copied as is from Angular CLI.
113
const path = require("path");
4+
const require_project_module_1 = require("../utilities/require-project-module");
125
function readTsconfig(tsconfigPath) {
13-
// build-angular has a peer dependency on typescript
14-
const projectTs = require('typescript');
6+
const projectTs = require_project_module_1.requireProjectModule(path.dirname(tsconfigPath), 'typescript');
157
const configResult = projectTs.readConfigFile(tsconfigPath, projectTs.sys.readFile);
168
const tsConfig = projectTs.parseJsonConfigFileContent(configResult.config, projectTs.sys, path.dirname(tsconfigPath), undefined, tsconfigPath);
179
if (tsConfig.errors.length > 0) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export declare function resolveProjectModule(root: string, moduleName: string): string;
2+
export declare function requireProjectModule(root: string, moduleName: string): any;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
/**
4+
* @license
5+
* Copyright Google Inc. All Rights Reserved.
6+
*
7+
* Use of this source code is governed by an MIT-style license that can be
8+
* found in the LICENSE file at https://angular.io/license
9+
*/
10+
const node_1 = require("@angular-devkit/core/node");
11+
// Resolve dependencies within the target project.
12+
function resolveProjectModule(root, moduleName) {
13+
return node_1.resolve(moduleName, {
14+
basedir: root,
15+
checkGlobal: false,
16+
checkLocal: true,
17+
});
18+
}
19+
exports.resolveProjectModule = resolveProjectModule;
20+
// Require dependencies within the target project.
21+
function requireProjectModule(root, moduleName) {
22+
return require(resolveProjectModule(root, moduleName));
23+
}
24+
exports.requireProjectModule = requireProjectModule;

src/app-shell/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ const core_1 = require("@angular-devkit/core");
1212
const node_1 = require("@angular-devkit/core/node");
1313
const fs = require("fs");
1414
const path = require("path");
15+
const require_project_module_1 = require("../angular-cli-files/utilities/require-project-module");
1516
const service_worker_1 = require("../angular-cli-files/utilities/service-worker");
1617
async function _renderUniversal(options, context, browserResult, serverResult) {
1718
const browserIndexOutputPath = path.join(browserResult.outputPath || '', 'index.html');
1819
const indexHtml = fs.readFileSync(browserIndexOutputPath, 'utf8');
1920
const serverBundlePath = await _getServerModuleBundlePath(options, context, serverResult);
2021
const root = context.workspaceRoot;
21-
// Initialize zone.js
22-
const zonePackage = require.resolve('zone.js', { paths: [root] });
23-
await Promise.resolve().then(() => require(zonePackage));
24-
// Load platform server module renderer
25-
const platformServerPackage = require.resolve('@angular/platform-server', { paths: [root] });
26-
const renderModuleFactory = await Promise.resolve().then(() => require(platformServerPackage)).then((m) => m.renderModuleFactory);
22+
require_project_module_1.requireProjectModule(root, 'zone.js/dist/zone-node');
23+
const renderModuleFactory = require_project_module_1.requireProjectModule(root, '@angular/platform-server').renderModuleFactory;
2724
const AppServerModuleNgFactory = require(serverBundlePath).AppServerModuleNgFactory;
2825
const outputIndexPath = options.outputIndexPath
2926
? path.join(root, options.outputIndexPath)

uniqueId

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Wed May 15 2019 21:44:28 GMT+0000 (Coordinated Universal Time)
1+
Wed May 15 2019 21:47:13 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)