@angular-devkit/build-angular 0.1000.2 → 0.1000.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "0.1000.
|
|
3
|
+
"version": "0.1000.3",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"experimental": true,
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"typings": "src/index.d.ts",
|
|
8
8
|
"builders": "builders.json",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@angular-devkit/architect": "0.1000.
|
|
11
|
-
"@angular-devkit/build-optimizer": "0.1000.
|
|
12
|
-
"@angular-devkit/build-webpack": "0.1000.
|
|
13
|
-
"@angular-devkit/core": "10.0.
|
|
10
|
+
"@angular-devkit/architect": "0.1000.3",
|
|
11
|
+
"@angular-devkit/build-optimizer": "0.1000.3",
|
|
12
|
+
"@angular-devkit/build-webpack": "0.1000.3",
|
|
13
|
+
"@angular-devkit/core": "10.0.3",
|
|
14
14
|
"@babel/core": "7.9.6",
|
|
15
15
|
"@babel/generator": "7.9.6",
|
|
16
16
|
"@babel/plugin-transform-runtime": "7.9.6",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@babel/runtime": "7.9.6",
|
|
19
19
|
"@babel/template": "7.8.6",
|
|
20
20
|
"@jsdevtools/coverage-istanbul-loader": "3.0.3",
|
|
21
|
-
"@ngtools/webpack": "10.0.
|
|
21
|
+
"@ngtools/webpack": "10.0.3",
|
|
22
22
|
"ajv": "6.12.2",
|
|
23
23
|
"autoprefixer": "9.8.0",
|
|
24
24
|
"babel-loader": "8.1.0",
|
|
@@ -12,6 +12,7 @@ const path_1 = require("path");
|
|
|
12
12
|
// Webpack doesn't export these so the deep imports can potentially break.
|
|
13
13
|
const CommonJsRequireDependency = require('webpack/lib/dependencies/CommonJsRequireDependency');
|
|
14
14
|
const AMDDefineDependency = require('webpack/lib/dependencies/AMDDefineDependency');
|
|
15
|
+
const STYLES_TEMPLATE_URL_REGEXP = /\.(html|svg|css|sass|less|styl|scss)$/;
|
|
15
16
|
class CommonJsUsageWarnPlugin {
|
|
16
17
|
constructor(options = {}) {
|
|
17
18
|
var _a;
|
|
@@ -42,7 +43,7 @@ class CommonJsUsageWarnPlugin {
|
|
|
42
43
|
*/
|
|
43
44
|
continue;
|
|
44
45
|
}
|
|
45
|
-
if (this.hasCommonJsDependencies(dependencies)) {
|
|
46
|
+
if (this.hasCommonJsDependencies(dependencies, true)) {
|
|
46
47
|
// Dependency is CommonsJS or AMD.
|
|
47
48
|
// Check if it's parent issuer is also a CommonJS dependency.
|
|
48
49
|
// In case it is skip as an warning will be show for the parent CommonJS dependency.
|
|
@@ -73,8 +74,20 @@ class CommonJsUsageWarnPlugin {
|
|
|
73
74
|
});
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
|
-
hasCommonJsDependencies(dependencies) {
|
|
77
|
-
|
|
77
|
+
hasCommonJsDependencies(dependencies, checkForStylesAndTemplatesCJS = false) {
|
|
78
|
+
for (const dep of dependencies) {
|
|
79
|
+
if (dep instanceof CommonJsRequireDependency) {
|
|
80
|
+
if (checkForStylesAndTemplatesCJS && STYLES_TEMPLATE_URL_REGEXP.test(dep.request)) {
|
|
81
|
+
// Skip in case it's a template or stylesheet
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
if (dep instanceof AMDDefineDependency) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
78
91
|
}
|
|
79
92
|
rawRequestToPackageName(rawRequest) {
|
|
80
93
|
return rawRequest.startsWith('@')
|
|
@@ -82,6 +82,7 @@ function statsWarningsToString(json, statsConfig) {
|
|
|
82
82
|
warnings.push(...json.children.map((c) => c.warnings));
|
|
83
83
|
}
|
|
84
84
|
return rs('\n' + warnings
|
|
85
|
+
.filter(m => !!m)
|
|
85
86
|
.map((warning) => `${warning}`)
|
|
86
87
|
.filter((warning) => !ERRONEOUS_WARNINGS.some((erroneous) => erroneous.test(warning)))
|
|
87
88
|
.map((warning) => y(`WARNING in ${warning}`))
|
|
@@ -96,7 +97,10 @@ function statsErrorsToString(json, statsConfig) {
|
|
|
96
97
|
if (json.children) {
|
|
97
98
|
errors.push(...json.children.map((c) => c.errors));
|
|
98
99
|
}
|
|
99
|
-
return rs('\n' + errors
|
|
100
|
+
return rs('\n' + errors
|
|
101
|
+
.filter(m => !!m)
|
|
102
|
+
.map((error) => r(`ERROR in ${error}`))
|
|
103
|
+
.join('\n\n'));
|
|
100
104
|
}
|
|
101
105
|
exports.statsErrorsToString = statsErrorsToString;
|
|
102
106
|
function statsHasErrors(json) {
|
|
@@ -91,7 +91,10 @@ async function process(options) {
|
|
|
91
91
|
exclude: ['transform-typeof-symbol'],
|
|
92
92
|
},
|
|
93
93
|
]],
|
|
94
|
-
plugins:
|
|
94
|
+
plugins: [
|
|
95
|
+
createIifeWrapperPlugin(),
|
|
96
|
+
...(options.replacements ? [createReplacePlugin(options.replacements)] : []),
|
|
97
|
+
],
|
|
95
98
|
minified: environment_options_1.allowMinify && !!options.optimize,
|
|
96
99
|
compact: !environment_options_1.shouldBeautify && !!options.optimize,
|
|
97
100
|
sourceMaps: !!sourceMap,
|
|
@@ -335,6 +338,25 @@ function createReplacePlugin(replacements) {
|
|
|
335
338
|
},
|
|
336
339
|
};
|
|
337
340
|
}
|
|
341
|
+
function createIifeWrapperPlugin() {
|
|
342
|
+
return {
|
|
343
|
+
visitor: {
|
|
344
|
+
Program: {
|
|
345
|
+
exit(path) {
|
|
346
|
+
// Save existing body and directives
|
|
347
|
+
const { body, directives } = path.node;
|
|
348
|
+
// Clear out body and directives for wrapper
|
|
349
|
+
path.node.body = [];
|
|
350
|
+
path.node.directives = [];
|
|
351
|
+
// Create the wrapper - "(function() { ... })();"
|
|
352
|
+
const wrapper = core_1.types.expressionStatement(core_1.types.callExpression(core_1.types.parenthesizedExpression(core_1.types.functionExpression(undefined, [], core_1.types.blockStatement(body, directives))), []));
|
|
353
|
+
// Insert the wrapper
|
|
354
|
+
path.pushContainer('body', wrapper);
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
}
|
|
338
360
|
const USE_LOCALIZE_PLUGINS = false;
|
|
339
361
|
async function createI18nPlugins(locale, translation, missingTranslation, localeDataContent) {
|
|
340
362
|
const plugins = [];
|