angular-cn/packages/compiler-cli/ngcc/test/dependencies
George Kalpakas cfbb1a1e77 fix(ngcc): correctly detect dependencies in CommonJS (#34528)
Previously, `CommonJsDependencyHost.collectDependencies()` would only
find dependencies via imports of the form `var foo = require('...');` or
`var foo = require('...'), bar = require('...');` However, CommonJS
files can have imports in many different forms. By failing to recognize
other forms of imports, the associated dependencies were missed, which
in turn resulted in entry-points being compiled out-of-order and failing
due to that.

While we cannot easily capture all different types of imports, this
commit enhances `CommonJsDependencyHost` to recognize the following
common forms of imports:

- Imports in property assignments. E.g.:
  `exports.foo = require('...');` or
  `module.exports = {foo: require('...')};`

- Imports for side-effects only. E.g.:
  `require('...');`

- Star re-exports (with both emitted and imported heleprs). E.g.:
  `__export(require('...'));` or
  `tslib_1.__exportStar(require('...'), exports);`

PR Close #34528
2020-01-13 09:48:20 -08:00
..
commonjs_dependency_host_spec.ts fix(ngcc): correctly detect dependencies in CommonJS (#34528) 2020-01-13 09:48:20 -08:00
dependency_resolver_spec.ts fix(ngcc): avoid error due to circular dependency in `EsmDependencyHost` (#34512) 2020-01-08 15:00:50 -08:00
esm_dependency_host_spec.ts fix(ngcc): avoid error due to circular dependency in `EsmDependencyHost` (#34512) 2020-01-08 15:00:50 -08:00
module_resolver_spec.ts fix(ngcc): handle deep imports that already have an extension (#32181) 2019-08-19 10:12:03 -07:00
umd_dependency_host_spec.ts refactor(ngcc): pass dependency info to `collectDependencies()` (#34494) 2020-01-07 10:35:03 -08:00