673 Commits

Author SHA1 Message Date
Alan Agius
8fd98d204e refactor(@angular-devkit/build-angular): use webpack warnings instead of console.warn 2020-08-10 09:44:56 +01:00
Alan Agius
e11d55679e fix(@angular-devkit/build-angular): generate service worker manifest when running build in watch mode
Closes #16883
2020-08-07 00:58:18 +01:00
Ville Lahdenvuo
8a10f2e2b7 refactor(@angular-devkit/build-angular): improve budget warning messages
Make the warnings read more natural and work with vscode link detection.
2020-08-07 00:55:45 +01:00
Alan Agius
eca08cc93f fix(@angular-devkit/build-angular): don't use parent modules while deduping
With this change we change the `DedupeModuleResolvePlugin` to act similar to `NormalModuleReplacementPlugin`

Closes: #18411
2020-08-05 10:26:26 -04:00
Charles Lyding
2f6b81004b refactor(@angular-devkit/build-angular): cleanup Webpack rule generation
This change reduces the number of variables needed as well as reduces type casting.
2020-08-05 08:17:04 -04:00
Alan Agius
520459ed99 refactor: minor cleanup to common webpack configuration 2020-08-04 10:13:28 -04:00
Charles Lyding
98ba784f5c refactor(@angular-devkit/build-angular): simplify Webpack split chunks configuration
By leveraging the chunks function filter option, the test option can be reduced to only a regular expression instead of the more complex function.  This change also provides support for Webpack 5.
2020-08-04 06:50:05 -04:00
Charles Lyding
126919030e refactor(@angular-devkit/build-angular): lazy load several optional webpack plugins
Multiple Webpack plugins are only used when certain options are enabled.  By only requiring them when needed, startup time can be reduced by potentially eliminating large dependency hierarchies from being loaded that will then be unused.  This change currently only applies to plugins that are required.  This limitation is due to the current webpack configuration infrastructure being synchronous which prevents dynamic import usage.
2020-08-04 06:49:24 -04:00
Alan Agius
de253fd78f build: update terser to version 5.0.0 2020-08-03 15:41:15 -04:00
Alan Agius
cee5c31fa1 build: update @types/webpack-sources to version ^1.4.2 2020-08-03 15:40:38 -04:00
Charles Lyding
dd9a396868 refactor(@angular-devkit/build-angular): add webpack diagnostic helpers 2020-07-29 10:53:30 +02:00
Alan Agius
a0804ebcdd refactor(@angular-devkit/build-angular): use parse5 version 6 to augment index 2020-07-28 21:23:32 +02:00
Charles Lyding
378faa7011 refactor(@angular-devkit/build-angular): cleanup webpack type usage 2020-07-28 14:38:21 +02:00
Alan Agius
05588fcee1 refactor: clean up unused code and imports 2020-07-24 08:01:52 +02:00
Alan Agius
44279c9814 refactor: remove no longer needed workaround for AJV 2020-07-22 12:54:54 +01:00
Pete Bacon Darwin
5e46e1a6bc refactor(@angular-devkit/build-angular): display translation-file diagnostics
If no translation parsers could parse a translation-file
we displayed a generic error, which makes it difficult to
track down if there is a problem with the file.

https://github.com/angular/angular/pull/37909 introduces
a new `parser.analyze()` API that allows us to get hold
of the diagnostic messages from trying to parse the
translation-files.

This commit will render these messages if none of the
translation parsers are succcesful.

Note that in order to maintain compatibility with versions
of `@angular/localize` that do not have the `analyze()`
method, the commit includes a polyfill, which can be removed
after a release where we can guarantee that the method
will be available.
2020-07-21 10:24:48 +01:00
Charles Lyding
3d8e474d5d fix(@angular-devkit/build-angular): mark rxjs add imports as having side effects
This change prevents webpack from removing the operator add imports from the rxjs package (for example, `import 'rxjs/add/operator/filter';`).  The entire rxjs package is currently marked as side effect free from within the rxjs `package.json` but the files in the add directory intentionally contain side effects.
2020-07-20 11:48:50 +01:00
Charles Lyding
993b2bd9c7 fix(@angular-devkit/build-angular): avoid ES module assumption for vendor files
This change prevents import statements from being added to commonjs files when downleveling helpers are needed.  These imports would then cause webpack to assume that the file is an ES module and potentially break the commonjs file.

Fixes #18284
2020-07-20 11:48:02 +01:00
Alan Agius
2443fd49bd fix(@angular-devkit/build-angular): flatten child compilation errors and warnings
Closes #18231
2020-07-20 11:47:23 +01:00
Alan Agius
2aedad9a9b fix(@angular-devkit/build-angular): suppress warning for CommonJS templateUrl and styleUrl
Currently, when users use either absolute paths, or path mappings in JIT mode, we issue a warning for templateUrl and styleUrl. With this change we suppress those warning.

Closes: #18057
2020-07-15 13:51:00 -04:00
Charles Lyding
872bd48bbf test: update generated tests to not use async helper function 2020-07-15 12:36:48 -04:00
Alan Agius
0b206766cf fix(@angular-devkit/build-angular): don't emit empty warnings
Closes #18231
2020-07-13 13:27:50 -04:00
Charles Lyding
c75a48dfcc test(@angular-devkit/build-angular): increase rebuild debounce times
CI performance variability can cause test flakes in rebuild tests due to the rebuilds taking longer than expected.  This change increases the 500ms debounce time for the web worker rebuild tests to 1000ms to mitigate these issues.
2020-07-13 12:17:06 -04:00
Charles Lyding
bcb41e3977 fix(@angular-devkit/build-angular): wrap ES5 differential loading bundles
This change ensures that classic (ES5) script's top-level function helpers do not get overwritten by other scripts top-level functions that happen to have the same name.  This is not an issue when using module script types because each module has its own scope.
2020-07-13 12:16:42 -04:00
Alan Agius
0a573e7376 fix(@angular-devkit/build-angular): remove non-global locale import warning
We have not yet deprecated the non-global locale data modules (e.g. `@angular/common/locales/fr`) so we should not be issuing warnings about developers using them.

We recently added warning suggesting that a "global" locale should be used instead, and the previous CommonJS/AMD warning about the format of these non-global modules are just confusing for the developer.

Reference: TOOL-1388
Closes: #18123
2020-07-07 08:56:59 +02:00
Alan Agius
64a2686293 fix(@angular-devkit/build-angular): show child compilation errors
Closes #17565
2020-07-03 09:42:24 +02:00
Alan Agius
c578c73575 fix(@angular-devkit/build-angular): show warning when using non global locale data
When using the `localize` option directly importing locale data from `@angular/common` is not needed because the Angular CLI  will automatically include locale data. When not using the `localize` option, most likely users meant to import the global variant of the local data.

See: https://angular.io/guide/i18n#import-global-variants-of-the-locale-data
2020-07-01 14:04:05 +01:00
Alan Agius
708360e267 fix(@angular-devkit/build-angular): match allowed dependencies against the package name
With this change we add the functionality to also match an allowed dependency against a package name. The package name is retrieved from the rawRequest.

Previously, users needed to add the request path which in some case might be a deep import. Ex: `zone.js/dist/zone-error`. With this change adding the package name example `zone.js` will suffice.

Closes: #18058
2020-07-01 14:04:05 +01:00
Alan Agius
9efc3cd1cd fix(@angular-devkit/build-angular): don't dedupe linked modules
Closes #18021
2020-06-29 11:09:39 +01:00
Alan Agius
6547d15f23 fix(@angular-devkit/build-angular): don't dedupe modules without a name or version
We should not try to dedupe secondary entrypoints, or modules which don't have a name and a version.

Closes #17967
2020-06-29 11:09:39 +01:00
Alan Agius
8442cbf0aa fix(@angular-devkit/build-angular): emit formatted stats.json file 2020-06-29 11:09:20 +01:00
Alan Agius
f66c4bd2b9 docs(@angular-devkit/build-angular): update link for commonjs warning 2020-06-24 15:22:59 -04:00
Charles Lyding
3af3281e05 test(@angular-devkit/build-angular): use async expect in asset tests 2020-06-24 14:42:08 -04:00
Charles Lyding
3c734a89e1 fix(@angular-devkit/build-angular): use copy-on-write asset processing for non-watch builds
Optimized asset processing was only being performed when differential loading was enabled.  This change ensures that the optimized approach is used for non-watch builds.  This does not affect `ng serve` usage since it currently requires all application files to be in memory.
2020-06-24 14:42:08 -04:00
Alan Agius
0fe0da3148 fix(@angular-devkit/build-angular): disable CSS calc optimizations
Disable `calc` optimizations due to several issues.

Closes #16910 closes #16875 and closes #17890
2020-06-10 10:20:30 +01:00
Alan Agius
01a0f1fce8 fix(@angular-devkit/build-angular): update copy-webpack-plugin to version 6
Fixes #17858
2020-06-09 11:36:40 +01:00
Alan Agius
a01e32c7eb refactor(@angular-devkit/build-angular): clean up SingleTestTransformLoader
Minor cleanup of SingleTestTransformLoader and fix interface issue which causes  #17823 to be red.
2020-06-01 14:52:01 -04:00
cexbrayat
03fc4aff00 refactor(@angular-devkit/build-angular): mention how to disable the warning for commonjs dependencies
The current message clearly mentions which dependencies are CommonJS ones, but doesn't point out how to get rid of the warning if nothing can be done. This commit adds a mention of `allowedCommonJsDependencies` in the warning to help developers (as we do for `versionMismatch` for example).
2020-05-28 15:03:37 -04:00
Alan Agius
93e253bc93 refactor: rename tsconfig.json to tsconfig.base.json 2020-05-20 12:12:33 -07:00
Alan Agius
a78d1c3ed1 fix(@angular-devkit/build-angular): dedupe duplicate modules
Webpack relies on package managers to do module hoisting and doesn't have any deduping logic since version 4.

However relaying on package manager has a number of short comings, such as when having the same library with the same version laid out in different parts of the node_modules tree.

Example:
```
/node_modules/tslib@2.0.0
/node_modules/library-1/node_modules/tslib@1.0.0
/node_modules/library-2/node_modules/tslib@1.0.0
```

In the above case, in the final bundle we'll end up with 3 versions of tslib instead of 2, even though 2 of the modules are identical.

Webpack has an open issue for this https://github.com/webpack/webpack/issues/5593 (Duplicate modules - NOT solvable by `npm dedupe`)

With this change we add a custom resolve plugin that dedupes modules with the same name and versions that are laid out in different parts of the node_modules tree.
2020-05-20 11:25:31 +01:00
Charles Lyding
1149b1aa97 revert: fix(@angular-devkit/build-angular): switch to license-checker-webpack-plugin
Partial revert of bd582591dc49569269c63910351fdb4026058842 (squashed commit)
2020-05-20 10:00:01 +01:00
Charles Lyding
515de49961 revert: "revert: "fix(@angular-devkit/build-angular): suppress duplicate 3rdpartylicenses.txt warning""
This reverts commit 863067cbd8d14ce9fddbd29e4a625f0d62a664fd.
2020-05-20 10:00:01 +01:00
Charles Lyding
2ae0300ad5 refactor(@angular-devkit/build-angular): optimize parallel worker shutdown
Stopping the workers can be a potentially lengthy process with a multi-stage approach based on the state of the worker.  This can cause lengthy blocking of the build.  This change allows the shutdown to happen in parallel to the remainder of the build.
2020-05-18 19:30:03 +01:00
Charles Lyding
4048e3c26f test(@angular-devkit/build-angular): improve performance of autoprefixer tests
These tests check the output of the global stylesheet and require a browserslist to target IE but this also triggers differential loading which is unneeded for the test.
2020-05-18 19:30:03 +01:00
Alan Agius
4e4e0e42ec style: fix typo in allowedCommonJsDependencies description 2020-05-18 19:25:41 +01:00
Alan Agius
27ca66ceea fix(@angular-devkit/build-angular): add link when displaying commonJS usage warnings
Add a link to https://web.dev/commonjs-larger-bundles when a commonJS module is used in browsers builds
2020-05-18 19:20:25 +01:00
Alan Agius
5395cecf59 refactor: remove deprecate protractor elementExplorer
Protractor `elementExplorer` debugger and element explorer cannot be used for Node.js 8+ since it relied on `_debugger` module.

In protractor version 5, this resulted in the below error:
```
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.
[10:25:35] I/direct - Using ChromeDriver directly...
[10:25:37] I/protractor -
[10:25:37] I/protractor - ------- Element Explorer -------
[10:25:37] I/protractor - Starting WebDriver debugger in a child process. Element Explorer is still beta, please report issues at github.com/angular/protractor
[10:25:37] I/protractor -
[10:25:37] I/protractor - Type <tab> to see a list of locator strategies.
[10:25:37] I/protractor - Use the `list` helper function to find elements by strategy:
[10:25:37] I/protractor -   e.g., list(by.binding('')) gets all bindings.
[10:25:37] I/protractor -
***********************************************************
* WARNING: _debugger module not available on Node.js 8    *
* and higher.                                             *
*                                                         *
* Use 'debugger' keyword instead:                       *
* https://goo.gl/MvWqFh                                   *
***********************************************************
/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js:14
  throw e;
  ^

Error: Cannot find module '_debugger'
Require stack:
- /Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js
- /Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/clients/explorer.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1042:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js',
    '/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/clients/explorer.js'
  ]
}
```

but in protractor version 7, this logic was removed.

BREAKING CHANGE:
Protractor builder elementExplorer option has been removed. This was not compatable with the Node.Js versions that the Angular CLI supports. See: https://github.com/angular/protractor/blob/master/docs/debugging.md#enabled-control-flow for an alternative debugging methods.
2020-05-15 14:44:45 +01:00
Alan Agius
4d4fc099ff build: udate angular packages to version 10 2020-05-07 10:38:22 -07:00
Charles Lyding
b1af6e8342 fix(@angular-devkit/build-angular): downlevel and optimize locale data
Locale data is now transformed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: #17497
2020-05-06 11:43:04 -07:00
Alan Agius
0fd3c550b5 feat(@schematics/angular): update compiler options target and module settings
With this change we update the target and module settings of various compilation units.

- We replace ES5 target in protractor. Protractor runs on Node.Js which support ES2018
- For applications we now use `ES2020` instead of `ESNext` as a module to avoid unexpected changes in behaviour

This changes also adds a migration to update existing projects and also removes `module` from the Universal tsconfig as per #17352 to enable lazy loading on the server.
2020-05-06 11:42:35 -07:00