Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/angular/angular.git. Pull mirroring updated .
  1. Aug 27, 2020
  2. Aug 26, 2020
  3. Aug 25, 2020
    • Misko Hevery's avatar
      release: cut the v10.0.12 release · 81db6a31
      Misko Hevery authored
      10.0.12
      81db6a31
    • windmichael's avatar
      docs(localize): fix angular.json syntax (#38553) · 8224e65e
      windmichael authored
      In chapter internationalization (i18n) at section "Deploy multiple locales" the syntax for angular.json is wrong.
      This commit fixes the angular.json, when specifying the translation file and the baseHref for a locale.
      
      PR Close #38553
      8224e65e
    • Keen Yee Liau's avatar
      test(language-service): [Ivy] return cursor position in overwritten template (#38552) · 9e50cef5
      Keen Yee Liau authored
      In many testing scenarios, there is a common pattern:
      
      1. Overwrite template (inline or external)
      2. Find cursor position
      3. Call one of language service APIs
      4. Inspect spans in result
      
      In order to faciliate this pattern, this commit refactors
      `MockHost.overwrite()` and `MockHost.overwriteInlineTemplate()` to
      allow a faux cursor symbol `¦` to be injected into the template, and
      the methods will automatically remove it before updating the script snapshot.
      Both methods will return the cursor position and the new text without
      the cursor symbol.
      
      This makes testing very convenient. Here's a typical example:
      
      ```ts
      const {position, text} = mockHost.overwrite('template.html', `{{ ti¦tle }}`);
      const quickInfo = ngLS.getQuickInfoAtPosition('template.html', position);
      const {start, length} = quickInfo!.textSpan;
      expect(text.substring(start, start + length)).toBe('title');
      ```
      
      PR Close #38552
      9e50cef5
    • Keen Yee Liau's avatar
      feat(language-service): introduce hybrid visitor to locate AST node (#38540) · 66d8c223
      Keen Yee Liau authored
      This commit introduces two visitors, one for Template AST and the other
      for Expression AST to allow us to easily find the node that most closely
      corresponds to a given cursor position.
      
      This is crucial because many language service APIs take in a `position`
      parameter, and the information returned depends on how well we can find
      a good candidate node.
      
      In View Engine implementation of language service, the search for the node
      and the processing of information to return the result are strongly coupled.
      This makes the code hard to understand and hard to debug because the stack
      trace is often littered with layers of visitor calls.
      
      With this new feature, we could test the "searching" part separately and
      colocate all the logic (aka hacks) that's required to retrieve an accurate
      span for a given node.
      
      Right now, only the most "narrow" node is returned by the main exported
      function `findNodeAtPosition`. If needed, we could expose the entire AST
      path, or expose other methods to provide more context for a node.
      
      Note that due to limitations in the template AST interface, there are
      a few known cases where microsyntax spans are not recorded properly.
      This will be dealt with in a follow-up PR.
      
      PR Close #38540
      66d8c223
  4. Aug 22, 2020
    • crisbeto's avatar
      fix(compiler-cli): adding references to const enums in runtime code (#38542) · 814b4364
      crisbeto authored
      We had a couple of places where we were assuming that if a particular
      symbol has a value, then it will exist at runtime. This is true in most cases,
      but it breaks down for `const` enums.
      
      Fixes #38513.
      
      PR Close #38542
      814b4364
    • George Kalpakas's avatar
      fix(dev-infra): ignore comments when validating commit messages (#38438) · 6b98567b
      George Kalpakas authored
      When creating a commit with the git cli, git pre-populates the editor
      used to enter the commit message with some comments (i.e. lines starting
      with `#`). These comments contain helpful instructions or information
      regarding the changes that are part of the commit. As happens with all
      commit message comments, they are removed by git and do not end up in
      the final commit message.
      
      However, the file that is passed to the `commit-msg` to be validated
      still contains these comments. This may affect the outcome of the commit
      message validation. In such cases, the author will not realize that the
      commit message is not in the desired format until the linting checks
      fail on CI (which validates the final commit messages and is not
      affected by this issue), usually several minutes later.
      
      Possible ways in which the commit message validation outcome can be
      affected:
      - The minimum body length check may pass incorrectly, even if there is
        no actual body, because the comments are counted as part of the body.
      - The maximum line length check may fail incorrectly due to a very long
        line in the comments.
      
      This commit fixes the problem by removing comment lines before
      validating a commit message.
      
      Fixes #37865
      
      PR Close #38438
      6b98567b
  5. Aug 21, 2020
  6. Aug 20, 2020
  7. Aug 19, 2020
  8. Aug 18, 2020
    • atscott's avatar
      release: cut the v10.0.10 release · 3e80f0e5
      atscott authored
      10.0.10
      3e80f0e5
    • Paul Gschwendtner's avatar
      fix(ngcc): detect synthesized delegate constructors for downleveled ES2015 classes (#38500) · f3dd6c22
      Paul Gschwendtner authored
      Similarly to the change we landed in the `@angular/core` reflection
      capabilities, we need to make sure that ngcc can detect pass-through
      delegate constructors for classes using downleveled ES2015 output.
      
      More details can be found in the preceding commit, and in the issue
      outlining the problem: #38453.
      
      Fixes #38453.
      
      PR Close #38500
      f3dd6c22
    • Paul Gschwendtner's avatar
      fix(core): detect DI parameters in JIT mode for downleveled ES2015 classes (#38500) · 863acb6c
      Paul Gschwendtner authored
      In the Angular Package Format, we always shipped UMD bundles and previously even ES5 module output.
      With V10, we removed the ES5 module output but kept the UMD ES5 output.
      
      For this, we were able to remove our second TypeScript transpilation. Instead we started only
      building ES2015 output and then downleveled it to ES5 UMD for the NPM packages. This worked
      as expected but unveiled an issue in the `@angular/core` reflection capabilities.
      
      In JIT mode, Angular determines constructor parameters (for DI) using the `ReflectionCapabilities`. The
      reflection capabilities basically read runtime metadata of classes to determine the DI parameters. Such
      metadata can be either stored in static class properties like `ctorParameters` or within TypeScript's `design:params`.
      
      If Angular comes across a class that does not have any parameter metadata, it tries to detect if the
      given class is actually delegating to an inherited class. It does this naively in JIT by checking if the
      stringified class (function in ES5) matches a certain pattern. e.g.
      
      ```js
      function MatTable() {
        var _this = _super.apply(this, arguments) || this;
      ```
      
      These patterns are reluctant to changes of the class output. If a class is not recognized properly, the
      DI parameters will be assumed empty and the class is **incorrectly** constructed without arguments.
      
      This actually happened as part of v10 now. Since we downlevel ES2015 to ES5 (instead of previously
      compiling sources directly to ES5), the class output changed slightly so that Angular no longer detects
      it. e.g.
      
      ```js
      var _this = _super.apply(this, __spread(arguments)) || this;
      ```
      
      This happens because the ES2015 output will receive an auto-generated constructor if the class
      defines class properties. This constructor is then already containing an explicit `super` call.
      
      ```js
      export class MatTable extends CdkTable {
          constructor() {
              super(...arguments);
              this.disabled = true;
          }
      }
      ```
      
      If we then downlevel this file to ES5 with `--downlevelIteration`, TypeScript adjusts the `super` call so that
      the spread operator is no longer used (not supported in ES5). The resulting super call is different to the
      super call that would have been emitted if we would directly transpile to ES5. Ultimately, Angular no
      longer detects such classes as having an delegate constructor -> and DI breaks.
      
      We fix this by expanding the rather naive RegExp patterns used for the reflection capabilities
      so that downleveled pass-through/delegate constructors are properly detected. There is a risk
      of a false-positive as we cannot detect whether `__spread` is actually the TypeScript spread
      helper, but given the reflection patterns already make lots of assumptions (e.g. that `super` is
      actually the superclass, we should be fine making this assumption too. The false-positive would
      not result in a broken app, but rather in unnecessary providers being injected (as a noop).
      
      Fixes #38453
      
      PR Close #38500
      863acb6c
    • Andrew Scott's avatar
      fix(router): ensure routerLinkActive updates when associated routerLinks change (#38349) · 989e8a1f
      Andrew Scott authored
      This commit introduces a new subscription in the `routerLinkActive` directive which triggers an update
      when any of its associated routerLinks have changes. `RouterLinkActive` not only needs to know when
      links are added or removed, but it also needs to know about if a link it already knows about
      changes in some way.
      
      Quick note that `from...mergeAll` is used instead of just a simple
      `merge` (or `scheduled...mergeAll`) to avoid introducing new rxjs
      operators in order to keep bundle size down.
      
      Fixes #18469
      
      PR Close #38349
      989e8a1f
    • Keen Yee Liau's avatar
      refactor(language-service): [Ivy] remove temporary compiler (#38310) · 84d1ba79
      Keen Yee Liau authored
      Now that Ivy compiler has a proper `TemplateTypeChecker` interface
      (see https://github.com/angular/angular/pull/38105) we no longer need to
      keep the temporary compiler implementation.
      
      The temporary compiler was created to enable testing infrastructure to
      be developed for the Ivy language service.
      
      This commit removes the whole `ivy/compiler` directory and moves two
      functions `createTypeCheckingProgramStrategy` and
      `getOrCreateTypeCheckScriptInfo` to the `LanguageService` class.
      
      Also re-enable the Ivy LS test since it's no longer blocking development.
      
      PR Close #38310
      84d1ba79
  9. Aug 15, 2020
    • Andrew Scott's avatar
      fix(common): Allow scrolling when browser supports scrollTo (#38468) · b32126c3
      Andrew Scott authored
      This commit fixes a regression from "fix(common): ensure
      scrollRestoration is writable (#30630)" that caused scrolling to not
      happen at all in browsers that do not support scroll restoration. The
      issue was that `supportScrollRestoration` was updated to return `false`
      if a browser did not have a writable `scrollRestoration`. However, the
      previous behavior was that the function would return `true` if
      `window.scrollTo` was defined. Every scrolling function in the
      `ViewportScroller` used `supportScrollRestoration` and, with the update
      in bb88c9fa, no scrolling would be
      performed if a browser did not have writable `scrollRestoration` but
      _did_ have `window.scrollTo`.
      
      Note, that this failure was detected in the saucelabs tests. IE does not
      support scroll restoration so IE tests were failing.
      
      PR Close #38468
      b32126c3
  10. Aug 14, 2020