angular-docs-cn/packages/language-service
Keen Yee Liau e986a9787b fix(language-service): use single entry point for Ivy and View Engine (#40967)
Currently there are two entry points for the `@angular/language-service`
package:

- `@angular/language-service`
  This default entry point is for View Engine LS. Through the redirection
  of `main` field in `package.json`, it resolves to
  `./bundles/language-service.js`.
- `@angular/language-service/bundles/ivy.js`
  This secondary entry point is for Ivy LS.

TypeScript recently changed the behavior of tsserver to allow only package
names as plugin names [1] for security reasons. This means the secondary
entry point for Ivy LS can no longer be used.
We implemented a quick hack in the module resolver (in the extension repo)
to fix this, but the long term fix should be in `@angular/language-service`.

Here, the `main` field in `package.json` is changed to `index.js`, and in the
index file we conditionally load View Engine or Ivy based on the input config.
This eliminates the need for multiple entry points.

As part of this PR, I also removed all source code for View Engine and Ivy
included in the NPM package. Consumers of this package should run the bundled
output and nothing else. This would help us prevent an accidental import that
results in execution of unbundled code.

[1]: https://github.com/microsoft/TypeScript/pull/42713

PR Close #40967
2021-02-24 15:05:44 -08:00
..
bundles fix(language-service): use single entry point for Ivy and View Engine (#40967) 2021-02-24 15:05:44 -08:00
ivy test(language-service): remove circular dependency (#40966) 2021-02-24 08:54:35 -08:00
src feat(language-service): add command for getting components for a template file (#40655) 2021-02-04 10:47:22 -08:00
test fix(language-service): Paths on Windows should be normalized (#40492) 2021-01-20 08:46:03 -08:00
BUILD.bazel fix(language-service): use single entry point for Ivy and View Engine (#40967) 2021-02-24 15:05:44 -08:00
api.ts fix(language-service): use single entry point for Ivy and View Engine (#40967) 2021-02-24 15:05:44 -08:00
build.sh build(language-service): install @angular/language-service in root node_modules (#40058) 2020-12-10 13:48:04 -08:00
index.ts fix(language-service): use single entry point for Ivy and View Engine (#40967) 2021-02-24 15:05:44 -08:00
package.json fix(language-service): use single entry point for Ivy and View Engine (#40967) 2021-02-24 15:05:44 -08:00