angular-cn/packages/compiler-cli/test/ngtsc
Paul Gschwendtner 4f7c971ee7 fix(ivy): ngtsc throws if "flatModuleOutFile" is set to null (#32235)
In ngc is was valid to set the "flatModuleOutFile" option to "null". This is sometimes
necessary if a tsconfig extends from another one but the "fatModuleOutFile" option
needs to be unset (note that "undefined" does not exist as value in JSON)

Now if ngtsc is used to compile the project, ngtsc will fail with an error because it
tries to do string manipulation on the "flatModuleOutFile". This happens because
ngtsc only skips flat module indices if the option is set to "undefined".

Since this is not compatible with what was supported in ngc and such exceptions
should be avoided, the flat module check is now aligned with ngc.

```
TypeError: Cannot read property 'replace' of null
    at Object.normalizeSeparators (/home/circleci/project/node_modules/@angular/compiler-cli/src/ngtsc/util/src/path.js:35:21)
    at new NgtscProgram (/home/circleci/project/node_modules/@angular/compiler-cli/src/ngtsc/program.js:126:52)
```

Additionally setting the `flatModuleOutFile` option to an empty string
currently results in unexpected behavior. No errors is thrown, but the
flat module index file will be `.ts` (no file name; just extension).

This is now also fixed by treating an empty string similarly to
`null`.

PR Close #32235
2019-08-22 10:14:38 -07:00
..
fake_core feat(ivy): use the schema registry to check DOM bindings (#32171) 2019-08-22 10:12:45 -07:00
BUILD.bazel build: remove redundant `@types/source-map` dependency (#31468) 2019-07-11 17:18:12 -04:00
component_indexing_spec.ts feat(ivy): index template references, variables, bound attributes/events (#31535) 2019-07-25 13:09:10 -07:00
env.ts fix(ivy): ngtsc throws if "flatModuleOutFile" is set to null (#32235) 2019-08-22 10:14:38 -07:00
incremental_spec.ts fix(ivy): reuse compilation scope for incremental template changes. (#31932) 2019-08-09 10:50:40 -07:00
ngtsc_spec.ts fix(ivy): ngtsc throws if "flatModuleOutFile" is set to null (#32235) 2019-08-22 10:14:38 -07:00
scope_spec.ts feat(ivy): translate type-check diagnostics to their original source (#30181) 2019-07-25 16:36:32 -07:00
sourcemap_utils.ts refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
template_mapping_spec.ts refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
template_typecheck_spec.ts feat(ivy): use the schema registry to check DOM bindings (#32171) 2019-08-22 10:12:45 -07:00