New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: language-service package built by bazel #23155
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
load(":rollup.bzl", "ls_rollup_bundle") | ||
|
||
ls_rollup_bundle( | ||
name = "language-service", | ||
entry_point = "packages/language-service/index.js", | ||
globals = { | ||
"typescript": "ts", | ||
"path": "path", | ||
"fs": "fs", | ||
}, | ||
license_banner = "banner.js.txt", | ||
visibility = ["//packages/language-service:__pkg__"], | ||
deps = ["//packages/language-service"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @license Angular v0.0.0-PLACEHOLDER | ||
* (c) 2010-2018 Google, Inc. https://angular.io/ | ||
* License: MIT | ||
*/ | ||
|
||
var $reflect = {defineMetadata: function() {}, getOwnMetadata: function(){}}; | ||
((typeof global !== 'undefined' && global)||{})['Reflect'] = $reflect; | ||
var $deferred, $resolved, $provided; | ||
function $getModule(name) { return $provided[name] || require(name); } | ||
function define(modules, cb) { $deferred = { modules: modules, cb: cb }; } | ||
module.exports = function(provided) { | ||
if ($resolved) return $resolved; | ||
var result = {}; | ||
$provided = Object.assign({'reflect-metadata': $reflect}, provided || {}, { exports: result }); | ||
$deferred.cb.apply(this, $deferred.modules.map($getModule)); | ||
$resolved = result; | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""Custom rollup_bundle for language service. | ||
|
||
Overrides format to AMD and produces only umd and min, no FESM. | ||
|
||
We do this so that we bundle all of the dependencies into the bundle | ||
except for typescript, fs and path. | ||
|
||
This allows editors and other tools to easily use the language service bundle | ||
without having to provide all of the angular specific peer dependencies. | ||
""" | ||
|
||
load("@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl", | ||
"ROLLUP_ATTRS", | ||
"rollup_module_mappings_aspect", | ||
"write_rollup_config", | ||
"run_rollup", | ||
"run_uglify" | ||
) | ||
load("//packages/bazel/src:esm5.bzl", "esm5_outputs_aspect", "flatten_esm5", "esm5_root_dir") | ||
|
||
# Note: the file is called "umd.js" and "umd.min.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. | ||
_ROLLUP_OUTPUTS = { | ||
"build_umd": "%{name}.umd.js", | ||
"build_umd_min": "%{name}.umd.min.js", | ||
} | ||
|
||
def _ls_rollup_bundle(ctx): | ||
esm5_sources = flatten_esm5(ctx) | ||
rollup_config = write_rollup_config(ctx, | ||
root_dir = "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]), | ||
output_format = "amd") | ||
run_rollup(ctx, esm5_sources, rollup_config, ctx.outputs.build_umd) | ||
source_map = run_uglify(ctx, ctx.outputs.build_umd, ctx.outputs.build_umd_min) | ||
return DefaultInfo(files=depset([ctx.outputs.build_umd, ctx.outputs.build_umd_min, source_map])) | ||
|
||
ls_rollup_bundle = rule( | ||
implementation = _ls_rollup_bundle, | ||
attrs = dict(ROLLUP_ATTRS, **{ | ||
"deps": attr.label_list(aspects = [ | ||
rollup_module_mappings_aspect, | ||
esm5_outputs_aspect, | ||
]), | ||
}), | ||
outputs = _ROLLUP_OUTPUTS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add more info:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done