1843 Commits

Author SHA1 Message Date
Hari G
61701ab259 fix(@angular-devkit/build-angular): handle base tag endOffset in index.html generation
* fix endOffset if the base tag is already present
* add test case for this

Closes #18381
2020-08-25 12:52:38 -04:00
Charles Lyding
0d7e0f5eb5 style(@angular-devkit/build-angular): remove duplicate license header 2020-08-24 07:50:01 -04:00
Charles Lyding
a5293fe747 feat(@angular-devkit/build-angular): support i18n message extraction with Ivy
This change adds support for extracting i18n translation messages with an Ivy enabled application. This is accomplished by using the new extraction capabilities present in the `@angular/localize` package and will require version 10.1 or later of the package.  Since this change uses an new extraction method, it currently must be enabled during extraction by using the `--ivy` flag. The flag is a precaution to prevent unintentional breakage for existing applications but will become the default behavior for all Ivy enabled applications in a future release.

Closes #18275
2020-08-18 16:49:45 +02:00
Alan Agius
60a42c28f6 refactor(@angular-devkit/build-angular): remove JIT mode styles and templates workaround 2020-08-17 19:17:46 +02:00
Alan Agius
bbe83ae377 fix(@angular-devkit/build-angular): don't warn on transitive CommonJS dependencies in AOT mode
At the moment in AOT mode if a CommonJS dependency has transitive CommonJS dependency we are issue warning for both.

With this change we align the behaviour with JIT mode, where we issue warnings only for direct CommonJS dependencies or ES dependencies which have CommonJS dependencies.

Closes #18526
2020-08-14 16:21:49 +02:00
Alan Agius
e5b29ac756 feat(@angular-devkit/build-angular): add ng-packagr builder in @angular-devkit/build-angular
With this change we add the `ng-packagr` builder in `@angular-devkit/build-angular`
2020-08-14 15:38:12 +02:00
Alan Agius
155707a1ba fix(@angular-devkit/build-angular): don't log blank warnings in console
Closes #18524
2020-08-14 14:41:18 +02:00
Alan Agius
60e8ac2b1e refactor(@angular-devkit/build-angular): improve HMR warning 2020-08-13 20:53:54 +02:00
Alan Agius
24fedb268c feat(@angular-devkit/build-angular): enable HMR for extracted CSS
The latest versions of mini-css-extract-plugin support HMR, see: https://github.com/webpack-contrib/mini-css-extract-plugin#hot-module-reloading-hmr for more details
2020-08-13 20:53:54 +02:00
Charles Lyding
9cd796b124 feat(@angular-devkit/build-angular): support multiple translation files per locale
This change implements the capability to specify multiple translation files per locale. The specified translation files for each locale will be merged prior to localization. The Angular configuration file has been updated to allow for both a single path string or an array of path strings when specifying the translations for each locale. If the same message identifier is present in multiple translation files, a warning will currently be issued and the last file with the duplicate message identifier will take precedence.

Closes #18276
2020-08-13 12:23:59 +02:00
Charles Lyding
8cca8ab961 refactor(@angular-devkit/build-angular): cleanup server webpack configuration 2020-08-12 19:29:25 +01:00
Alan Agius
0ba5664525 refactor(@angular-devkit/build-angular): update bundle calculator make it strict compliant 2020-08-12 19:28:17 +01:00
Alan Agius
5085da3417 refactor(@angular-devkit/build-angular): update postcss-cli-resources plugin to make it strict compliant 2020-08-12 19:28:17 +01:00
Alan Agius
0ac6def35c test(@angular-devkit/build-angular): update allow js test plugin to make it strict compliant 2020-08-12 19:28:17 +01:00
Alan Agius
2dada50774 refactor(@angular-devkit/build-angular): change allEquivalent parameter type of generic iterable
Co-authored-by: Charles <19598772+clydin@users.noreply.github.com>
2020-08-12 19:27:19 +01:00
Alan Agius
0da7f79ab3 refactor(@angular-devkit/build-angular): simplify budgets allEquivalent method 2020-08-12 19:27:19 +01:00
Charles Lyding
4116dddb65 refactor(@angular-devkit/build-angular): cleanup Webpack type usage
These changes simplify type usage in several places as well as cover more usage scenarios with alternate configuration option structures (for example, options that can be arrays or object literals)..
2020-08-12 19:27:00 +01:00
Charles Lyding
155215d60a refactor(@angular-devkit/build-angular): support Webpack assets as string or Buffer
Webpack 5 allows an asset's source to be either a string or a Buffer.
2020-08-12 19:27:00 +01:00
Alan Agius
fc5d2b3ff2 test: remove tsconfig.base.json from test cases 2020-08-12 19:26:12 +01:00
Alexey Makhrov
042c33cfd2 fix(@angular-devkit/build-angular): better handle relative paths with bundleDependencies=false
When `bundleDependencies` is turned off, webpack only bundles modules imported via relative path.
Existing check works well for import paths like `'./some/file'`,
but fails for imports traversing the dir structure up, like `'../some/file'`.
2020-08-10 09:46:47 +01:00
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