444 Commits

Author SHA1 Message Date
Charles Lyding
bd16cbc98d refactor(@angular-devkit/build-angular): use webpack config utilities in browser builder 2019-04-12 12:17:21 -07:00
Filipe Silva
323c8838ff feat(@angular-devkit/build-angular): support web workers in karma builder
Followup to https://github.com/angular/angular-cli/pull/13700, the karma builder did not get the same support but it should.
2019-04-10 08:43:14 -07:00
Charles Lyding
c8e0c35e60 feat(@angular-devkit/build-angular): support karma builder webpack transformation 2019-04-10 08:40:20 -07:00
Charles Lyding
a063e26e86 refactor(@angular-devkit/build-angular): minor cleanup of karma builder 2019-04-10 08:40:20 -07:00
Alan Agius
0baa9c879e feat(@angular-devkit/build-angular): improve handling of nomodules and modules in index generation
Since when having differential loading we already know which files originated from which build. We shouldn't need to merge and transform this data.

With this change, the index generator accepts a couple of new inputs.
1. `files` - used for Js and CSS files which require nomodule nor module attributes
2. `moduleFiles` - Js files that need to have a `module` attribute
3. `noModuleFiles`  - Js files that need to have a `nomodule` attribute
4. `entrypoints` - used to sort the insertion of files in the HTML file
2019-04-10 08:34:33 -07:00
ManfredSteyer
32a096f3f0 feat(@angular-devkit/build-angular): differential loading
This PR adds differential loading to the browser builder. First, it checks if differential loading is needed. This is the case if the compilation target is ES2015 while the browserslist points to ES5 browsers.

For providing differential loading, it calls the methods for creating the webpack config for each compilation target (e. g. ES5 and ES2015). The needed differences between those configurations are defined using parameters also added by this PR. Then it calls webpack for each of them and merges the results

This feature is currently hidden behind a flag. To activate it, set the differentialLoading flag in browser/index.ts.
2019-04-09 09:25:37 -07:00
Sam Thorogood
9aefe8371c feat(@angular-devkit/build-angular): add safari-nomodule snippet 2019-04-04 19:52:33 -07:00
Charles Lyding
246abb3935 feat(@angular-devkit/build-angular): update to core-js 3
Fixes  #13954
2019-04-04 09:28:02 -07:00
Charles Lyding
76492141d2 refactor(@angular-devkit/build-angular): cleanup architect imports 2019-04-03 16:28:16 +02:00
Charles Lyding
01b53a92e6 fix(@angular-devkit/build-angular): update utility function output type 2019-04-02 10:31:24 -07:00
Charles Lyding
3d9200a3c8 refactor(@angular-devkit/build-angular): use build-webpack stable API module imports 2019-04-02 04:50:08 -07:00
Filipe Silva
ed0e6aab57 feat(@angular-devkit/build-angular): support TS web workers 2019-04-02 04:49:34 -07:00
Filipe Silva
1810394c3a test(@angular-devkit/build-angular): test worker bundling 2019-04-02 04:49:34 -07:00
Jason Miller
c630d5f811 feat(@angular-devkit/build-angular): support module web workers.
Supports new Worker(...,{type:module}) using github.com/googlechromelabs/worker-plugin
2019-04-02 04:49:34 -07:00
ManfredSteyer
a5364a43c2 feat(@angular-devkit/build-angular): write index.html for differential loading
Currently, the IndexHtmlWebpackPlugin generates the index.html file *during* bundling. However, to support differential loading the builder must do this *after* bundling because only then we know the produced files for ES5, ES2015, etc.
Hence, this extracts the IndexHtmlWebpackPlugin logic to a helper function which can still be called by IndexHtmlWebpackPlugin for use cases not affected by differential loading (e. g. ng serve) as well as directly by the builder.
https://docs.google.com/document/d/13k84oGwrEjwPyAiAjUgaaM7YHJrzYXz7Cbt6CwRp9N4/edit?ts=5c652052
2019-04-02 04:46:15 -07:00
Andriy Pyvovarchuk
50cce668cc refactor: replace deprecated package opn with open 2019-04-01 10:53:12 -07:00
Charles Lyding
36d78debdb fix(@angular-devkit/build-angular): ensure correct dev server path with public host option
If a custom path is provided the webpack dev server client drops the sockjs-node segment. This adds it back so that behavior is consistent when using a custom URL path.

Fixes #13627
2019-03-29 16:36:50 -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
Charles Lyding
ba21c855c0 refactor(@angular-devkit/build-angular): cleanup stable architect API builder file names 2019-03-29 14:37:35 -07:00
Charles Lyding
dd058a2cc3 refactor(@angular-devkit/build-angular): remove experimental architect builders 2019-03-29 14:37:35 -07:00
Hans Larsen
00fb4cea4f feat(@angular-devkit/build-angular): use builder name for category
So we can differentiate between dev-server, browser, karma, etc.
2019-03-28 13:28:41 -07:00
Hans Larsen
a2ff62e2b0 feat(@angular-devkit/build-angular): add analytics for build
Add a few metrics that we want to capture in the build.
2019-03-28 13:28:41 -07:00
Charles Lyding
7b1bb478b5 fix(@angular-devkit/build-angular): use package import for build-webpack in server builder 2019-03-27 16:33:39 -07:00
Charles Lyding
a011863477 feat(@angular-devkit/build-angular): implement stable architect API for extract-i18n 2019-03-25 12:39:05 -07:00
Hans Larsen
872799e174 feat(@angular-devkit/build-angular): add AppShell new API builder
This is fully compatible with the new API. The tests have been moved 1:1.
The cleanup in general is noticable.
2019-03-25 10:38:42 -07:00
Hans Larsen
69e4103cef feat(@angular-devkit/build-angular): add server output path 2019-03-25 10:38:42 -07:00
Hans Larsen
818bf32d68 refactor(@angular-devkit/build-angular): use quicktype of app-shell schema 2019-03-25 10:38:42 -07:00
Charles Lyding
2f791395d2 feat(@angular-devkit/build-angular): implement stable architect API for karma 2019-03-22 07:13:51 -07:00
Alan Agius
ce15899020 feat(@angular-devkit/build-angular): use sass instead of node-sass
BREAKING CHANGE: we no longer use `node-sass` by default, instead we use `sass` (dart-sass).

While in most cases this should not have an impact the generated code, dart sass has some differences from Ruby Sass. See https://github.com/sass/dart-sass#behavioral-differences-from-ruby-sass for more details

If you wish to use `node-sass` instead of `sass` you need to install node-sass as a dev dependency.

npm users
```
npm install node-sass --save-dev
```

yarn users
```
yarn add node-sass --dev
```

**Note:** for larger Sass projects to avoid this performance hit you might want to install `fibers`. See: https://www.npmjs.com/package/fibers

Ref: TOOL-748
2019-03-20 15:12:18 -07:00
Hans Larsen
2e9dc3d252 docs: add analytics dimensions for schematics flags and internal doc
The analytics.md should be kept up to date with the flags.
2019-03-20 15:08:07 -07:00
Hans Larsen
5500ad2504 feat(@angular-devkit/build-angular): add Server Builder v2
Using the new Architect API. Including moving the tests.
2019-03-19 10:07:46 -07:00
Hans Larsen
53f6b5ccfe refactor: extract the deleteOutputPath logic from the builder 2019-03-19 10:07:46 -07:00
Hans Larsen
230f491343 refactor: use quicktype for the server schema generation 2019-03-19 10:07:46 -07:00
Alan Agius
f71896874e feat(@angular-devkit/build-angular): enable webpack profile when using stats-json flag
More information about what `profile` does can be found here: https://webpack.js.org/api/stats

Closes #13907
2019-03-19 09:25:28 -07:00
Alan Agius
20a644ec4b fix(@angular-devkit/build-angular): passing port 0 when using serve will not find a suitable port
At the moment, when passing port `0` it will default to `4200` which is incorrect. `4200` should be used a baseport.
2019-03-19 09:23:08 -07:00
Charles Lyding
a49d278baa feat(@angular-devkit/build-angular): implement stable architect API for protractor 2019-03-19 09:17:15 -07:00
Alan Agius
330e56ed6d feat(@angular-devkit/build-angular): deprecate profile option in build
This flag has been deprecated in favor of the `NG_BUILD_PROFILING`  environment variable. This is mainly due not to expose debugging flag in our API.
2019-03-15 16:06:15 -07:00
Charles Lyding
ebf90b3d6a refactor(@angular-devkit/build-angular): remove unused host parameter from typescript webpack methods 2019-03-13 13:55:26 -07:00
Charles Lyding
8644608987 refactor(@angular-devkit/build-angular): remove redundant getNonAotTestConfig function
The `getNonAotConfig` and `getNonAotTestConfig` functions are equivalent in regards to behavior.  The `extract` optional parameter for `_createAotPlugin` is false by default.
2019-03-13 13:55:26 -07:00
Olivier Combe
3d8064bb64 feat(@angular-devkit/build-angular): remove Closure compiler i18n code for ivy
For runtime i18n with ivy we generate code for both Closure compiler (used at Google) and for external people that don't use Closure compiler.
We added a new global flag named `ngI18nClosureMode` that allows uglify (and Closure compiler) to effectively tree-shake all of the code that isn't used in the current setup.
By default we remove all of the Closure compiler code because we assume that it won't be used.
2019-03-13 13:55:07 -07:00
Alan Agius
f70b9060d0 fix(@angular-devkit/build-angular): don't show warning when font shorthand is used
At the moment when `font` shorthand property is used a warning is emitted when using this syntax
```
font: 10px "Font Awesome";
```

This should be addressed by clean-css

Fixes #9648
2019-03-13 13:54:09 -07:00
Alan Agius
8d09594874 fix(@angular-devkit/build-angular): resolve fonts with space in filename
At the moment the uri of the font instead of spaced it will be `%20`, hence we need to decode it first before trying to resolve it.

Fixes #9648
2019-03-13 13:54:09 -07:00
Hans Larsen
cf5e3b19b6 feat(@angular-devkit/build-angular): move dev-server to new API
Includes moving all the tests.
2019-03-13 13:51:22 -07:00
Hans Larsen
6a0b3fe6b2 feat(@angular-devkit/build-angular): re-export schemas
When we moved to using QuickType to generate those we removed those
exports. That was an unfortunate breaking change.
2019-03-11 13:48:01 -07:00
Hans Larsen
78a4149384 feat(@angular-devkit/build-angular): browserTarget should match target pattern 2019-03-11 13:48:01 -07:00
Hans Larsen
890cfbe7c7 fix(@angular-devkit/build-angular): fail the build if service worker fails
Its the sensible thing to do.
2019-03-11 13:48:01 -07:00
Alan Agius
1e3c6e3ca5 fix(@angular-devkit/build-angular): fix base href insertion when HTML is in a single line
When HTML is in a single line using offset + 1 will cause the insertion of the base href tag in the wrong possition.

Fixes #13851
2019-03-11 13:43:54 -07:00
Alan
901042d95b fix(@angular-devkit/build-angular): fix check for absolute paths in windows in server config
This changes fixes `Error: You must pass in a NgModule or NgModuleFactory to be bootstrapped`.

At the moment the check for absolute path is not correct for windows.

Fixes #13865 and fixes https://github.com/angular/universal/issues/1139
2019-03-11 13:40:38 -07:00
Alan
309b4838c3 fix(@angular-devkit/build-angular): don't bundle linked modules when bundleDependencies in none in server builder
Fixes #13817
2019-03-06 11:29:51 -08:00