build(language-service): Remove ls_rollup_bundle (#38086)

`ls_rollup_bundle` is no longer needed since we could invoke `ng_rollup_bundle`
directly.

Background: language service runs rollup to produce a single file to reduce
startup time in the editor. However, due to the need to load dynamic versions
of typescript at runtime (think the case where users can change typescript
version in their editor), we hack the "banner" to export a CommonJS default function,
so that we could dynamically load the typescript module provided at runtime via AMD
and use it throughout the implementation.

PR Close #38086
This commit is contained in:
Keen Yee Liau 2020-07-15 13:58:03 -07:00 committed by Andrew Kushnir
parent e0b35bfc18
commit bd71f10234
4 changed files with 10 additions and 31 deletions

View File

@ -46,7 +46,7 @@ pkg_npm(
deps = [
":language-service",
# min bundle is not used at the moment; omit from package to speed up build
"//packages/language-service/bundles:language-service.umd.js",
"//packages/language-service/bundles:ivy.umd.js",
"//packages/language-service/bundles:language-service.js",
"//packages/language-service/bundles:ivy.js",
],
)

View File

@ -1,8 +1,10 @@
load("//packages/language-service/bundles:index.bzl", "ls_rollup_bundle")
load("//dev-infra/benchmark/ng_rollup_bundle:ng_rollup_bundle.bzl", "ng_rollup_bundle")
ls_rollup_bundle(
ng_rollup_bundle(
name = "language-service",
build_optimizer = False,
entry_point = "//packages/language-service:index.ts",
format = "amd",
globals = {
"fs": "fs",
"path": "path",
@ -18,9 +20,11 @@ ls_rollup_bundle(
],
)
ls_rollup_bundle(
ng_rollup_bundle(
name = "ivy",
build_optimizer = False,
entry_point = "//packages/language-service/ivy:ts_plugin.ts",
format = "amd",
globals = {
"fs": "fs",
"path": "path",

View File

@ -1,25 +0,0 @@
load("//dev-infra/benchmark/ng_rollup_bundle:ng_rollup_bundle.bzl", "ng_rollup_bundle")
def ls_rollup_bundle(name, **kwargs):
"""
A variant of ng_rollup_bundle for the language-service bundle that
outputs in AMD format.
"""
visibility = kwargs.pop("visibility", None)
# Note: the output file is called "umd.js" because of historical reasons.
# The format is actually AMD and not UMD, but we are afraid to rename
# the file because that would likely break the IDE and other integrations that
# have the path hardcoded in them.
ng_rollup_bundle(
name = name + ".umd",
build_optimizer = False,
format = "amd",
visibility = visibility,
**kwargs
)
native.alias(
name = name,
actual = name + ".umd",
visibility = visibility,
)

View File

@ -2,7 +2,7 @@
"name": "@angular/language-service",
"version": "0.0.0-PLACEHOLDER",
"description": "Angular - language services",
"main": "./bundles/language-service.umd.js",
"main": "./bundles/language-service.js",
"typings": "./index.d.ts",
"author": "angular",
"license": "MIT",