107 Commits

Author SHA1 Message Date
Alan Agius
4595d9c598 build: update angular packages to 8.0.0-beta.10 2019-04-01 02:54:41 -07:00
Alan Agius
d2e22e9781 feat(@ngtools/webpack): add NGCC as part of the workflow
When add module is resolved, it will try to convert the module using the `NGCC` API.

NGCC will be run hooked to the compiler during the module resolution, using the Compiler Host methods 'resolveTypeReferenceDirectives' and 'resolveModuleNames'. It will process a single entry for each module and is based on the first match from the Webpack mainFields.

When Ivy is enabled we also append the '_ivy_ngcc' suffixed properties
to the mainFields so that Webpack resolver will resolve ngcc processed
modules first.
2019-04-01 02:54:41 -07:00
Alan Agius
655626c284 refactor(@ngtools/webpack): move interfaces to separate file
This is to avoid circular imports
2019-04-01 02:54:41 -07:00
Alan
7915a582cf fix(@ngtools/webpack): changes in non module code are not picked up when using barrel files
Fixes #13975
2019-03-29 14:47:03 -07:00
Alan
871eb69c3b fix(@ngtools/webpack): replace resources should return class node when modified
This is also the root cause of spec large fail occasionally as we keep checking the child class nodes
2019-03-29 14:45:06 -07:00
Alan
54d2be9497 fix(@ngtools/webpack): don't invalidate cache after first run
At the moment, since there are no old files in the compilation it will cause all source files to be invalidate after the first run. This shouldn't be done as it will slow down the 2nd recompilation.
2019-03-29 14:45:06 -07:00
Filipe Silva
8d82e9812d refactor(@ngtools/webpack): simplify a call using await 2019-03-29 14:39:48 -07:00
Filipe Silva
8e3e755995 feat(@angular-devkit/build-angular): add experimentalImportFactories option 2019-03-29 14:39:48 -07:00
Filipe Silva
bc7da5d076 feat(@ngtools/webpack): support import syntax for loadChildren with ViewEngine
This feature ONLY matches the format below:
```
loadChildren: () => import('IMPORT_STRING').then(m => m.EXPORT_NAME)
```

It will not match nor alter variations, for instance:
- not using arrow functions
- not using `m` as the module argument
- using `await` instead of `then`
- using a default export (https://github.com/angular/angular/issues/11402)

The only parts that can change are the ones in caps: IMPORT_STRING and EXPORT_NAME.
2019-03-29 14:39:48 -07:00
Filipe Silva
b54a9379a6 feat(@ngtools/webpack): add option to control lazy route discovery 2019-03-29 14:39:48 -07:00
Renovate Bot
4782b1b3a4 build: update typescript to version 3.3.4000 2019-03-22 15:32:04 -07:00
Filipe Silva
6e3d2e0c4d feat(@ngtools/webpack): support Angular 8
This requires updating projects to TypeScript 3.3
2019-03-20 12:29:01 -07:00
Alan
345ab4817a fix(@ngtools/webpack): getCurrentDirectory should not return a devkit path
At the moment we are leaking devkit paths as `getCurrentDirectory` is used by the ngtsc compiler if no `rootDir` directories is provided.

`getCurrentDirectory` is also used to contruct the `rootDirs` option which is causing this to be incorrect as under Windows as `rootDirs` will be have an invalid value example: `/c/foo/bar`

This PR complements https://github.com/angular/angular/pull/29151

**Note** that this currently works because we are normalizing paths with posix seperators and is mimicking the behaviour of the logical file system used by the ngtsc.

Fixes: #13849
2019-03-07 16:02:53 -08:00
Mathias Raacke
dfb08b95b7 feat(@ngtools/webpack): allow .svg files as templates
With directTemplateLoading enabled, components
can now use .svg files as templates. For AOT builds,
the Angular compiler host now reads .svg files
directly when reading component templates.
For JIT builds, replaceResources creates a require call
that directly uses raw-loader instead of using the
loader provided by the current webpack configuration.

Closes #10567
2019-03-05 10:16:41 -08:00
Renovate Bot
ef523d0d41 build: update webpack to version 4.29.6 2019-03-04 09:34:41 -08:00
Alan Agius
ae13974f1d build: update to rxjs 6.4 2019-02-26 08:33:48 -08:00
Renovate Bot
9efa933937 build: update webpack to version 4.29.5 2019-02-19 13:51:53 -08:00
Renovate Bot
1bba17fa0d build: update webpack to version 4.29.4 2019-02-17 11:29:17 -08:00
Filipe Silva
91f5be769d fix(@ngtools/webpack): don't load ngfactories for lazy routes with Ivy
Supersedes https://github.com/angular/angular-cli/pull/13524
2019-02-15 15:10:55 -08:00
Renovate Bot
4ecd232733 build: update webpack to version 4.29.3 (#13608) 2019-02-07 08:24:43 -08:00
Renovate Bot
37b4714b97 build: update webpack to version 4.29.1 2019-02-05 21:28:52 -08:00
clydin
fa6795a847 Fully resolve correct @ngtools/webpack loader (#13549)
* refactor(@ngtools/webpack): support import-based loader resolution

* fix(@angular-devkit/build-angular): ensure correct ngtools loader version

By using the the direct import approach, the loader will be guaranteed to originate from the same package version/location as the other `@ngtools/webpack` imports.

Fixes #13539
2019-02-05 21:12:31 -08:00
Filipe Silva
08e24837a0 fix(@ngtools/webpack): provide a TS-like path to ngProgram.listLazyRoutes
The webpack plugin was leaking our internal Path abstraction to the Angular compiler via the `ngProgram.listLazyRoutes` call.

This Path abstraction is provided by `@angular-devkit/core` and shouldn't leak. Instead a TS-like path should be provided to the Angular program.

Fix #13531
2019-01-30 11:23:34 -08:00
Filipe Silva
d536df95f2 feat(@angular-devkit/build-angular): update webpack to 4.29
This version (https://github.com/webpack/webpack/releases/tag/v4.29.0) includes a memory leak fix for assets (https://github.com/webpack/webpack/pull/8609, https://github.com/webpack/webpack/pull/8642).

Thanks to @meligy for pinging about this!
2019-01-22 09:39:19 -08:00
Alan Agius
a6102b2d50 build: pin typescript and webpack
Pin these two dependencies so that Renovate can succesfully update all these within the monorepo at once without the need of any manual interventation
2019-01-18 11:56:33 -08:00
Alex Eagle
4f358f48f8 fix(@schematics/angular): stop offering SASS option for ng new
The old Sass language referred to as "SASS" here is no longer relevant. This was denoted with the file extension ".sass"
Any new projects should use the modern Sass language which is expressed in ".scss" files.
This change does not remove any support for projects which were already created with ".sass" files, we simply stop offering
this option when creating new projects.

Also correct the capitalization of Less based on how they spell it on their website.
2019-01-15 14:49:58 -08:00
Alan Agius
7347d88192 feat(@ngtools/webpack): add support for Ivy compatible solution
Ivy compatible solution still uses the 'standard' bootstrapping code, however the difference is that there are no factories.

Using a similar approach for `ngc` but without factories and instead of `bootstrapModuleFactory` it uses `bootstrapModule`.
2019-01-11 14:04:01 -08:00
Alan Agius
36c2423042 revert: fix(@ngtools/webpack): emit lazy routes errors on rebuilds
This reverts commit edb84b340ff996df2ca6a2aaf765304cc64fef3e

The team has decided to bring back the faster but potentially less accurate method of detecting lazy routes upon JIT rebuilds (first builds will always use the more complete Angular compiler method). Applications that do not have lazy routes within libraries and that only use direct string literals with loadChildren should not be affected by the potential of less accurate detection. Note that the function overload of loadChildren also does not apply to this situation.

For those projects where correctness of lazy route detection outweighs rebuild speed, please consider using AOT mode for development. AOT mode will also provide a full set of template errors as well which JIT mode is not capable of doing.

Fixes #13102
2019-01-08 13:38:13 -08:00
Alan Agius
b071d1cd1d build: update several dependencies
This is so that renovate won't trigger for these dependencies
2018-12-21 09:31:20 -08:00
Alan
3bc347cf47 refactor: use getExportSpecifierLocalTargetSymbol and getShorthandAssignmentValueSymbol to handle symbols lookups
Use typechecker methods to handle special cases for `ExportSpecifier` and `ShorthandPropertyAssignment`
2018-12-20 11:38:01 -08:00
Alan
5e294ec7e0 fix(@ngtools/webpack): drop only unused default import when used with named imports
At the moment when having a default import together with a named import example:
```
import abc, { def } from './foo';
```

And the default import becomes unused it will drop the entire node which will caused used named imports to be dropped as well.
2018-12-20 11:38:01 -08:00
Alan
5e6b42c5e3 test: add tests for elide imports
This also adds the option to provide addition files when using `createTypescriptContext` this is paramount for the elide imports tests as without this certain symbols won't have the full details.

Which will cause tests to be false positive and re-surface issues like #13212
2018-12-20 11:38:01 -08:00
Renovate Bot
bdef022ea2 build: update tree-kill to version 1.2.1 2018-12-20 11:35:35 -08:00
Alan Agius
8bded93d8a fix(@ngtools/webpack): import as results in the alias being undefined with Typescript 3.2
When using the `specifier.propertyName` with `typeChecker.getSymbolAtLocation` it will return a more detailed symbol then we originally have in the `usedSymbols` set.

We should probably use `symbol.id` to actually check if the symbols are the same, however the `id` is not exposed in the Symbol interface.

Using `node.name` will return the same symbol that we have stored in the set.

Fixes #13212
2018-12-19 10:55:05 -08:00
Alan Agius
5111d15ff2 build: update to TypeScript 3.2 and Angular 7.2 RC 2018-12-19 10:55:05 -08:00
Alan Agius
603e6f40e1 refactor: add time logs in _listLazyRoutesFromProgram
Add these time logs as at the moment we are not logging anything for the discovery lazy loaded modules
2018-12-11 11:59:10 -08:00
Charles Lyding
ea65cc220b fix(@ngtools/webpack): avoid checking watchMode in environment hook 2018-12-06 11:47:40 -08:00
Alan Agius
8bc6e79d89 fix(@ngtools/webpack): files are not being updated when using allowJs or resolveJsonModule (#13089)
* fix(@ngtools/webpack): files are not being updated when using `allowJs` or `resolveJsonModule`

Fixes #13076 and Fixes #12964

* test: add tests for allowJs and resolveJsonModule in watch mode

* test: improve tests for `allowJs`

When not using `allowJs` js files are not processed by the tsc compiler, but still processed by webpack.

So a correct test should be to check that the JS is transpiled down to ES5 syntax.
2018-11-30 14:10:18 -08:00
clydin
1ad42db285 fix(@ngtools/webpack): cleanup resources after modules are loaded (#12994) 2018-11-30 11:55:29 -08:00
Alan Agius
508d4df482 choreUpdate angular and tsickle dependencies (#13034)
* build: update `@angular/packages` to `7.1.0`

* feat(@schematics/angular): use tsickle `>=0.34.0` when creating a library

This is the official version that supports 3.1+

* feat(@schematics/angular): use angular version `7.1.0`
2018-11-27 14:02:23 -08:00
Charles Lyding
1e7cf9bcf8 feat(@ngtools/webpack): support directly loading component templates 2018-11-18 10:41:47 -08:00
Charles Lyding
c631c1852f test: update angular test dependencies 2018-11-15 17:07:59 -08:00
Alan Agius
1dbd574714 fix(@ngtools/webpack): Fix lazy loading (#12945)
* revert: fix(@ngtools/webpack): output consistent filename

This reverts commit df172bdc8af4caa1a908592a8b9400d31c81eeb0.

* refactor(@ngtools/webpack): remove RegExp for ngfactory

This RegExp is not needed as if it actually works it will break lazy loading as in case of AOT, the name should always be suffixed with ngfactory

4c2ce4e8ba/packages/core/src/linker/system_js_ng_module_factory_loader.ts (L83)
2018-11-14 12:41:27 -08:00
Charles Lyding
1bd1889bac refactor(@ngtools/webpack): cleanup/optimize emit logic 2018-11-14 12:35:31 -08:00
Alan Agius
747b751987 fix(@ngtools/webpack): update error message to reference templateUrl
Fixes #12693
2018-11-14 12:35:13 -08:00
Charles Lyding
f848d08a1a feat(@ngtools/webpack): disable sourcefile cache when not in watch mode
Requires Webpack 4.23.0+
2018-11-09 15:48:16 -08:00
Filipe Silva
5150f82762 feat(@ngtools/webpack): allow custom lazy module resource (#12593) 2018-11-08 10:32:28 -08:00
Alan Agius
96606b3d1e fix(@ngtools/webpack): replace resources should effect only class decorators (#12503)
At the moment we are processing all property assignments in object literals irrespective if they are in a decorator or not. With this change we will process only property assignments found under in a component decorator.

Fixes #12488, Fixes #6007, Fixes: #6498 and Fixes: #8295
2018-11-08 10:31:14 -08:00
Alan Agius
53118c6224 build: update typescript to 3.1.6 (#12849)
* fix(@angular-devkit/build-optimizer): update typescript to 3.1.6

* build: update typescript to 3.1.6
2018-11-06 22:46:37 -08:00
Filipe Silva
9b26f9ba49 feat(@ngtools/webpack): only do type checking on forked type checker
Syntactic errors were only being reported in the type checker when it was running. This caused rebuilds to finish successfully if they had syntactic errors, which could lead to very weird behaviour on rebuilds.
2018-11-01 10:31:50 -07:00