Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/angular/angular.git. Pull mirroring updated .
  1. Apr 16, 2020
    • atscott's avatar
      release: cut the v9.1.2 release · 793a001d
      atscott authored
      9.1.2
      793a001d
    • Andrew Scott's avatar
      Revert "fix(common): `locales/global/*.js` are not ES5 compliant (#36342)" (#36648) · 5c3774cf
      Andrew Scott authored
      This reverts commit c8f3fa9f.
      
      PR Close #36648
      5c3774cf
    • George Kalpakas's avatar
      fix(ngcc): display output from the unlocker process on Windows (#36569) · 12266b20
      George Kalpakas authored
      On Windows, the output of a detached process (such as the unlocker
      process used by `LockFileWithChildProcess`) is not shown in the parent
      process' stdout.
      
      This commit addresses this by piping the spawned process' stdin/stdout
      and manually writing to the parent process' stdout.
      
      PR Close #36569
      12266b20
    • George Kalpakas's avatar
      fix(ngcc): do not spawn unlocker processes on cluster workers (#36569) · e385abc8
      George Kalpakas authored
      The current ngcc lock-file strategy spawns a new process in order to
      capture a potential `SIGINT` and remove the lock-file. For more
      information see #35861.
      
      Previously, this unlocker process was spawned as soon as the `LockFile`
      was instantiated in order to have it available as soon as possible
      (given that spawning a process is an asynchronous operation). Since the
      `LockFile` was instantiated and passed to the `Executor`, this meant
      that an unlocker process was spawned for each cluster worker, when
      running ngcc in parallel mode. These processes were not needed, since
      the `LockFile` was not used in cluster workers, but we still had to pay
      the overhead of each process' own memory and V8 instance.
      (NOTE: This overhead was small compared to the memory consumed by ngcc's
      normal operations, but still unnecessary.)
      
      This commit avoids the extra processes by only spawning an unlocker
      process when running on the cluster master process and not on worker
      processes.
      
      PR Close #36569
      e385abc8
    • Pete Bacon Darwin's avatar
      fix(ngcc): force ngcc to exit on error (#36622) · 933cbfb8
      Pete Bacon Darwin authored
      For some reason (possibly related to async/await promises)
      the ngcc process is not exiting when spawned from the CLI
      when there has been an error (such as when it timesout waiting
      for a lockfile to become free).
      
      Calling `process.exit()` directly fixes this.
      
      Fixes #36616
      
      PR Close #36622
      933cbfb8
  2. Apr 15, 2020
  3. Apr 14, 2020
  4. Apr 13, 2020
  5. Apr 11, 2020
    • Paul Gschwendtner's avatar
      fix(core): undecorated-classes-with-decorated-fields migration should avoid... · 3992341d
      Paul Gschwendtner authored
      fix(core): undecorated-classes-with-decorated-fields migration should avoid error if base class has no value declaration (#36543)
      
      The undecorated-classes-with-decorated-fields migration relies on
      the type checker to resolve base classes of individual classes.
      
      It could happen that resolved base classes have no value declaration.
      e.g. if they are declared through an interface in the default types.
      Currently the migration will throw in such situations because it assumes
      that `ts.Symbol#valueDeclaration` is always present. This is not the
      case, but we don't get good type-checking here due to a bug in the
      TypeScript types. See:
      https://github.com/microsoft/TypeScript/issues/24706.
      
      Fixes #36522.
      
      PR Close #36543
      3992341d
    • George Kalpakas's avatar
      fix(ngcc): correctly detect external files from nested `node_modules/` (#36559) · 8c559ef1
      George Kalpakas authored
      Previously, when we needed to detect whether a file is external to a
      package, we only checked whether the relative path to the file from the
      package's root started with `..`. This would detect external imports
      when the packages were siblings (e.g. peer dependencies or hoisted to
      the top of `node_modules/` by the package manager), but would fail to
      detect imports from packages located in nested `node_modules/` as
      external. For example, importing `node_modules/foo/node_modules/bar`
      from a file in `node_modules/foo/` would be considered internal to the
      `foo` package.
      
      This could result in processing/analyzing more files than necessary.
      More importantly it could lead to errors due to trying to analyze
      non-Angular packages that were direct dependencies of Angular packages.
      
      This commit fixes it by also verifying that the relative path to a file
      does not start with `node_modules/`.
      
      Jira issue: [FW-2068](https://angular-team.atlassian.net/browse/FW-2068)
      
      Fixes #36526
      
      PR Close #36559
      8c559ef1
  6. Apr 10, 2020
    • Andrew Kushnir's avatar
      build: update `REQUIRED_BASE_SHA` in merge script to clang 1.4.0 upgrade commit (#36547) · 0bac2b06
      Andrew Kushnir authored
      Updating `REQUIRED_BASE_SHA` for master and patch branches to make sure PRs that we merge are rebased after clang 1.4.0 upgrade.
      
      PR Close #36547
      0bac2b06
    • George Kalpakas's avatar
      fix(docs-infra): fix `elements` example when used with ES5 (#36536) · 58d02817
      George Kalpakas authored
      Previously, the `elements` docs example only worked in browsers that
      natively supported Custom Elements and ES2015 modules. Furthermore, it
      didn't work on StackBlitz, because StackBlitz ignores the specified
      `target` in `tsconfig.json` and uses the UMD bundles (i.e. ES5 code)
      even on browsers that do support ES2015.
      (NOTE: In the past, this was not a problem, because we explicitly did
      not provide a StackBlitz example. This has changed in #36067.)
      
      This commit ensures the example works on all browsers and also on
      StackBlitz by providing the necessary Custom Elements polyfills.
      
      Fixes #36532
      
      PR Close #36536
      58d02817
    • Pete Bacon Darwin's avatar
      perf(ngcc): only load if it is needed (#36486) · e06512b2
      Pete Bacon Darwin authored
      PR Close #36486
      e06512b2
    • Pete Bacon Darwin's avatar
      perf(ngcc): reduce the size of the entry-point manifest file (#36486) · 603b0944
      Pete Bacon Darwin authored
      The base path for package and entry-points is known so there is
      no need to store these in the file. Also this commit avoids storing
      empty arrays unnecessarily.
      
      PR Close #36486
      603b0944
    • Pete Bacon Darwin's avatar
      perf(ngcc): read dependencies from entry-point manifest (#36486) · 918e628f
      Pete Bacon Darwin authored
      Previously, even if an entry-point did not need to be processed,
      ngcc would always parse the files of the entry-point to compute
      its dependencies. This can take a lot of time for large node_modules.
      
      Now these dependencies are cached in the entry-point manifest,
      and read from there rather than computing them every time.
      
      See https://github.com/angular/angular/issues/36414\#issuecomment-608401834
      FW-2047
      
      PR Close #36486
      918e628f
    • JoostK's avatar
      fix(compiler): handle type references to namespaced symbols correctly (#36106) · 468cf69c
      JoostK authored
      When the compiler needs to convert a type reference to a value
      expression, it may encounter a type that refers to a namespaced symbol.
      Such namespaces need to be handled specially as there's various forms
      available. Consider a namespace named "ns":
      
      1. One can refer to a namespace by itself: `ns`. A namespace is only
         allowed to be used in a type position if it has been merged with a
         class, but even if this is the case it may not be possible to convert
         that type into a value expression depending on the import form. More
         on this later (case a below)
      2. One can refer to a type within the namespace: `ns.Foo`. An import
         needs to be generated to `ns`, from which the `Foo` property can then
         be read.
      3. One can refer to a type in a nested namespace within `ns`:
         `ns.Foo.Bar` and possibly even deeper nested. The value
         representation is similar to case 2, but includes additional property
         accesses.
      
      The exact strategy of how to deal with these cases depends on the type
      of import used. There's two flavors available:
      
      a. A namespaced import like `import * as ns from 'ns';` that creates
         a local namespace that is irrelevant to the import that needs to be
         generated (as said import would be used instead of the original
         import).
      
         If the local namespace "ns" itself is referred to in a type position,
         it is invalid to convert it into a value expression. Some JavaScript
         libraries publish a value as default export using `export = MyClass;`
         syntax, however it is illegal to refer to that value using "ns".
         Consequently, such usage in a type position *must* be accompanied by
         an `@Inject` decorator to provide an explicit token.
      
      b. An explicit namespace declaration within a module, that can be
         imported using a named import like `import {ns} from 'ns';` where the
         "ns" module declares a namespace using `declare namespace ns {}`.
         In this case, it's the namespace itself that needs to be imported,
         after which any qualified references into the namespace are converted
         into property accesses.
      
      Before this change, support for namespaces in the type-to-value
      conversion was limited and only worked  correctly for a single qualified
      name using a namespace import (case 2a). All other cases were either
      producing incorrect code or would crash the compiler (case 1a).
      
      Crashing the compiler is not desirable as it does not indicate where
      the issue is. Moreover, the result of a type-to-value conversion is
      irrelevant when an explicit injection token is provided using `@Inject`,
      so referring to a namespace in a type position (case 1) could still be
      valid.
      
      This commit introduces logic to the type-to-value conversion to be able
      to properly deal with all type references to namespaced symbols.
      
      Fixes #36006
      Resolves FW-1995
      
      PR Close #36106
      468cf69c
    • Terence D. Honles's avatar
      fix(common): `locales/global/*.js` are not ES5 compliant (#36342) · c8f3fa9f
      Terence D. Honles authored
      Although this code has been part of Angular 9.x I only noticed this
      error when upgrading to Angular 9.1.x because historically the source
      locale data was not injected when localizing, but as of
      angular/angular-cli#16394 (9.1.0) it is now included. This tipped me off
      that my other bundles were not being built properly, and this change
      allows me to build a valid ES5 bundle (I have also added a verification
      step to my build pipeline to alert me if this error appears again in any
      of my bundles).
      
      I found the `locales/global/*.js` file paths being referenced by the
      `I18nOptions` in
      @angular-devkit/build-angular/src/utils/i18n-options.ts,
      and following that it looks like it is actually loaded and used in
      @angular-devkit/build-angular/src/utils/process-bundle.ts. I saw the
      function `terserMangle` does appear that it is likely aware of the build
      being ES5, but I'm not sure why this is not producing a valid ES5
      bundle.
      
      This change updates `tools/gulp-tasks/cldr/extract.js` to produce ES5
      compliant `locales/global/*.js` and that fixes my issue. However, I am
      not sure if @angular-devkit/build-angular should be modified to produce
      a valid ES5 bundle instead or if the files could be TypeScript rather
      than JavaScript files.
      
      A test that a valid ES5 bundle is produced would be helpful, and I hope
      this is reproducible and not some issue with my config.
      
      PR Close #36342
      c8f3fa9f
    • Andrew Scott's avatar
      style: format forms validators to fix lint error (#36546) · 78136cc3
      Andrew Scott authored
      PR Close #36546
      78136cc3
    • Sonu Kapoor's avatar
      docs(forms): clarify the description of `minLength` and `maxLength` (#36297) · 66724fd1
      Sonu Kapoor authored
      Previously, it was not clear that the `minLength` and `maxLength` validators
      can only be used with objects that contain a `length` property. This commit
      clarifies this.
      
      PR Close #36297
      66724fd1
    • Martin Sikora's avatar
      fix(router): pass correct component to canDeactivate checks when using two or... · 8e7f9033
      Martin Sikora authored
      fix(router): pass correct component to canDeactivate checks when using two or more sibling router-outlets (#36302)
      
      fixes #34614
      
      There's an edge case where if I use two (or more) sibling <router-outlet>s in two (or more) child routes where their parent route doesn't have a component then preactivation will trigger all canDeactivate checks with the same component because it will use wrong OutletContext.
      
      PR Close #36302
      8e7f9033
    • George Kalpakas's avatar
      fix(dev-infra): fix commit message validation in git worktrees (#36507) · c8f90923
      George Kalpakas authored
      Previously, the `pre-commit-validate` command (used in the `commit-msg`
      git hook) assumed that the commit message was stored in
      `.git/COMMIT_EDITMSG` file. This is usually true, but not when using
      [git worktrees](https://git-scm.com/docs/git-worktree), where `.git` is
      a file containing the path to the actual git directory.
      
      This commit fixes it by taking advantage of the fact that git passes the
      actual path of the file holding the commit message to the `commit-msg`
      hook and husky exposes the arguments passed by git as
      `$HUSKY_GIT_PARAMS`.
      
      NOTE:
      We cannot use the environment variable directly in the `commit-msg` hook
      command, because environment variables need to be referenced differently
      on Windows (`%VAR_NAME%`) vs macOS/Linux (`$VAR_NAME`). Instead, we pass
      the name of the environment variable and the validation script reads the
      variable's value off of `process.env`.
      
      PR Close #36507
      c8f90923
    • Pete Bacon Darwin's avatar
      refactor(compiler): create a new root `BindingScope` for each template (#36362) · bc995835
      Pete Bacon Darwin authored
      Previously we had a singleton `ROOT_SCOPE` object, from
      which all `BindingScope`s derived. But this caused ngcc to
      produce non-deterministic output when running multiple workers
      in parallel, since each process had its own `ROOT_SCOPE`.
      
      In reality there is no need for `BindingScope` reference names
      to be unique across an entire application (or in the case of ngcc
      across all the libraries). Instead we just need uniqueness within
      a template.
      
      This commit changes the compiler to create a new root `BindingScope`
      each time it compiles a component's template.
      
      Resolves #35180
      
      PR Close #36362
      bc995835
  7. Apr 09, 2020