| 
									
										
										
										
											2018-10-03 17:00:05 +01:00
										 |  |  | #!/usr/bin/env bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-15 11:02:38 +01:00
										 |  |  | ##### Test Debug Utility ##### | 
					
						
							|  |  |  | ############################## | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Use this script to run the ngcc integration test locally | 
					
						
							|  |  |  | # in isolation from the other integration tests. | 
					
						
							|  |  |  | # This is useful when debugging the ngcc code-base. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-03 17:00:05 +01:00
										 |  |  | set -u -e -o pipefail | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | cd "$(dirname "$0")" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-15 02:56:55 +02:00
										 |  |  | node $(pwd)/../../scripts/build-packages-dist.js | 
					
						
							| 
									
										
										
										
											2018-10-03 17:00:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Workaround https://github.com/yarnpkg/yarn/issues/2165 | 
					
						
							|  |  |  | # Yarn will cache file://dist URIs and not update Angular code | 
					
						
							| 
									
										
											  
											
												fix(ngcc): do not collect private declarations from external packages (#34811)
Previously, while trying to build an `NgccReflectionHost`'s
`privateDtsDeclarationMap`, `computePrivateDtsDeclarationMap()` would
try to collect exported declarations from all source files of the
program (i.e. without checking whether they were within the target
package, as happens for declarations in `.d.ts` files).
Most of the time, that would not be a problem, because external packages
would be represented as `.d.ts` files in the program. But when an
external package had no typings, the JS files would be used instead. As
a result, the `ReflectionHost` would try to (unnecessarilly) parse the
file in order to extract exported declarations, which in turn would be
harmless in most cases.
There are certain cases, though, where the `ReflectionHost` would throw
an error, because it cannot parse the external package's JS file. This
could happen, for example, in `UmdReflectionHost`, which expects the
file to contain exactly one statement. See #34544 for more details on a
real-world failure.
This commit fixes the issue by ensuring that
`computePrivateDtsDeclarationMap()` will only collect exported
declarations from files within the target package.
Jira issue: [FW-1794](https://angular-team.atlassian.net/browse/FW-1794)
Fixes #34544
PR Close #34811
											
										 
											2020-01-15 21:54:36 +02:00
										 |  |  | export readonly cache=../.yarn_local_cache | 
					
						
							| 
									
										
										
										
											2018-10-03 17:00:05 +01:00
										 |  |  | function rm_cache { | 
					
						
							|  |  |  |   rm -rf $cache | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | rm_cache | 
					
						
							|  |  |  | mkdir $cache | 
					
						
							|  |  |  | trap rm_cache EXIT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rm -rf dist | 
					
						
							|  |  |  | rm -rf node_modules | 
					
						
							|  |  |  | yarn install --cache-folder $cache | 
					
						
							| 
									
										
										
										
											2019-11-15 02:56:55 +02:00
										 |  |  | yarn test |