502 Commits

Author SHA1 Message Date
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
Charles Lyding
a0312c6c09 refactor(@angular-devkit/build-angular): support ES5 target with ES2015 APF 2020-05-06 11:41:38 -07:00
Alan Agius
08062e9a11 refactor(@angular-devkit/build-angular): remove unused server builder options
BREAKING CHANGE: options `commonChunk` and `vendorChunk` have been removed from the server builder.

Note: this change only effects direct @angular-devkit/build-angular users and not the application developers as users will be migrated automatically off these options.
2020-05-05 10:50:15 -07:00
Charles Lyding
6089835fb6 refactor(@angular-devkit/build-angular): remove unused rxjs path mapping
This path mapping was used during the transition to rxjs 5 via the use of rxjs-compat package during the Angular 5.x timeframe.  Now that the minimum version is 6.x and this transition is complete, these mappings are no longer necessary.
2020-05-04 10:54:05 -07:00
Alan Agius
a723af4271 feat(@schematics/angular): evergreen new applications
By default, we now generate new applications which support only evergreen browsers, as a result differential loading is now opt-in.

A new flag `--legacy-browsers`, was added to generate applications which support non evergreen browsers such as Internet Explorer 11.

**Note**: After an application is generated opting in and out of differential loading is still possible through the supported browsers configuration in the browserslist configuration file  defaulted to `.browserslistrc`.
2020-05-04 10:53:48 -07:00
Alan Agius
e2eed2c8f8 build: update several packages 2020-05-04 10:51:49 -07:00
Filipe Silva
ef7a07050a test(@angular-devkit/build-angular): build and test with Bazel 2020-04-30 15:12:46 -07:00
Alan Agius
a93f4f0a9f fix(@angular-devkit/build-angular): disable inline svg optimizations
SVGO can cause optimizations which are not compatible in all browsers.

FIxes: #17564
2020-04-29 10:16:16 -07:00
Pete Bacon Darwin
b3792deaae fix(@angular-devkit/build-angular): the path to source_file_utils changed in v10.0.0 2020-04-29 10:15:59 -07:00
Alan Agius
8fb7e586cc refactor(@angular-devkit/build-angular): remove deprecated evalSourceMap, vendorSourceMap, profile and skipAppShell options
BREAKING CHANGE:

The following deprecated devkit builders options have been removed:
- `skipAppShell:` This has no effect
- `evalSourceMap`: This done to improve performance in older versions of the CLI and is no longer needed
- `vendorSourceMap`: Use `sourceMap.vendor` instead
- `profile`: Use `NG_BUILD_PROFILING` environment variable instead
2020-04-27 15:08:15 -07:00
Charles Lyding
254994db85 fix(@angular-devkit/build-angular): ensure webpack tilde resolve behavior for stylesheet resources 2020-04-27 11:07:58 -07:00
Charles Lyding
c034477dc5 feat(@angular-devkit/build-angular): rebase relative stylesheet assets when using preprocessors
Previously, when using a preprocessor, resources (e.g., `url(./my-image.jpg)`) referenced in a stylesheet that was imported into another stylesheet would retain the exact URL.  This would be problematic as the resource would not be at the relative location within the new combined stylesheet.  With this change the resource URLs will now be adjusted to reference the origin location of the resource.  This allows the resources to be found without any additional changes to the application or build process.
CSS and Less already functioned in this manner. This change brings Sass and Stylus to parity.

Fixes: #12797
2020-04-27 11:07:58 -07:00
Alan Agius
69aa460335 refactor(@angular-devkit/build-angular): remove deprecated es5BrowserSupport build option
BREAKING CHANGE
Deprecated browser builder option `es5BrowserSupport` has been removed. The inclusion for ES5 polyfills will be determined from the browsers listed in the browserslist configuration.
2020-04-22 10:38:19 -07:00
Alan Agius
710cf5656e fix(@angular-devkit/build-angular): retain css declarations order when using extractCss and @import rule
Relevant code:
239e43d1f3/src/plugins/postcss-import-parser.js (L9)

239e43d1f3/src/index.js (L132-L150)

Fixes #9475
2020-04-10 09:56:55 -07:00
Doug Parker
863067cbd8 revert: "fix(@angular-devkit/build-angular): suppress duplicate 3rdpartylicenses.txt warning"
This reverts commit 59c9802d2667db71ef44aa78c7d56b4caa6ff065.

No longer necessary to suppress this log, now that the root cause has been fixed.
2020-04-08 13:16:54 -07:00
Renovate Bot
bd582591dc build: update rollup to version 2.3.4 2020-04-08 13:16:54 -07:00
Charles Lyding
44b3cc7c89 feat(@angular-devkit/build-angular): provide webpack support for resolving via Yarn PnP 2020-04-07 19:42:00 -07:00
Charles Lyding
8a3e655845 fix(@angular-devkit/build-angular): avoid overwriting localize sourcemaps 2020-04-06 10:00:00 -07:00
Alan Agius
10e7eb2c24 test: change browserslist file name to .browserslistrc 2020-04-06 09:58:42 -07:00
Alan Agius
bd789f5dd6 refactor(@angular-devkit/build-angular): remove deprecation of namedChunks
Previusly this option didn't have an effect on platform server because when targetting commonjs all chunks will be concatenated into main.js.

We now changed the module to esnext, which enables us to have lazy loading on the server.
2020-04-02 10:25:04 -07:00
Alan Agius
a75f5dbc71 fix(@angular-devkit/build-angular): don't show commonjs usage for webpack-dev-server utils 2020-03-30 10:23:52 -07:00
Alan Agius
cad8154ba3 feat(@angular-devkit/build-angular): change tslint default formatter to stylish
Change the default tslint formatter  to stylish as offers a better output
2020-03-23 17:27:35 -07:00