The legacy nodejs rules rollup_bundle is now deprecated and will be removed in the nodejs rules 1.0 release due in mid-November. This PR brings in the rules_nodejs internal API deps that ng_rollup_bundle, ng_package and ls_rollup_bundle depend on into this repo to break the dependency. In the future these rules should switch to use the new rollup_bundle via a macro as done in https://github.com/angular/angular/pull/33329 but this is not possible right now due to the complication of having esm5 re-rooted ts_library dependencies. The es6 sources now have .mjs extensions so they no longer need to be re-rooted to `{package}.es6`. This eliminates the need for the collect_es6_sources() function. Note: repo has been updated to the newest working version of rollup which is 1.25.2. There is some regression in 1.26.0 which causes the following bundling failure: ``` ERROR: /Users/greg/google/angular/packages/localize/BUILD.bazel:20:1: Optimizing JavaScript packages/localize/localize.umd.min.js [terser] failed (Exit 1) terser.sh failed: error executing command bazel-out/host/bin/external/npm/terser/bin/terser.sh bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.js --output bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.min.js ... (remaining 5 argument(s) skipped) Use --sandbox_debug to see verbose messages from the sandbox Parse error at packages/localize/localize.umd.js:491,4 export * from './src/constants'; ^ ERROR: Export statement may only appear at top level at js_error (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/parse.js:357:11) at Dn.visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/scope.js:347:13) at Dn._visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1207:24) at AST_Export._walk (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:718:17) at walk_body (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:168:17) at AST_Function.call (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:430:13) at descend (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1208:21) at Dn.visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/scope.js:256:13) at Dn._visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1207:24) at AST_Function._walk (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:424:24) [Function] Target //packages/localize:npm_package failed to build Use --verbose_failures to see the command lines of failed build steps. ERROR: /Users/greg/google/angular/packages/localize/BUILD.bazel:20:1 Optimizing JavaScript packages/localize/localize.umd.min.js [terser] failed (Exit 1) terser.sh failed: error executing command bazel-out/host/bin/external/npm/terser/bin/terser.sh bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.js --output bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.min.js ... (remaining 5 argument(s) skipped) ``` Will leave that for another day. Terser also updated to 4.3.3. Updating to 4.3.4 (https://github.com/terser/terser/blob/master/CHANGELOG.md) turns comments preservation on by default which increases the size of the //packages/core/test/bundling/todo:bundle.min.js in CI. After bazelbuild/rules_nodejs#1317 terser can be updated to the latest as passing —comments /a^/ to args can turn off all comments for the //packages/core/test/bundling/todo:bundle.min.js size test. PR Close #33201 PR Close #33607
This commit is contained in:
parent
fe12d0dc78
commit
1c22e464b2
|
@ -30,11 +30,11 @@
|
|||
"@bazel/typescript": "0.39.1",
|
||||
"@types/jasmine": "2.8.8",
|
||||
"http-server": "^0.11.1",
|
||||
"rollup": "^1.21.4",
|
||||
"rollup": "~1.25.0",
|
||||
"rollup-plugin-commonjs": "^10.1.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
"terser": "4.3.1",
|
||||
"terser": "^4.3.9",
|
||||
"typescript": "3.6.4"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -63,29 +63,29 @@
|
|||
"@angular/router@file:../../dist/packages-dist/router":
|
||||
version "9.0.0-next.14"
|
||||
|
||||
"@bazel/bazel-darwin_x64@0.28.1":
|
||||
version "0.28.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.28.1.tgz#415658785e1dbd6f7ab5c8f2b98c1c99c614e1d5"
|
||||
integrity sha512-VDKWmplAfa4uCAbkIQ5nRn04MFQqtsPNuc2HkluJ8OIum773yC2dPR+OlLBKxrlBuKJYB27TtbOwOa6w/uK7aw==
|
||||
"@bazel/bazel-darwin_x64@1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-1.0.0.tgz#8ab7ecba867130d87e3ecd6cfd5757e59ea274ab"
|
||||
integrity sha512-2J8qPpUAhSsuZ1P0kMFLvAQUz8zB8mkKmGL3/8raXUnw9TblsykwAdeg3QlJwTLORn+ZqdAjOYEQIarnTpS1NA==
|
||||
|
||||
"@bazel/bazel-linux_x64@0.28.1":
|
||||
version "0.28.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.28.1.tgz#f78006089e17660261088272a0e04fc886572e34"
|
||||
integrity sha512-n4XfNxagYhejQD32V4XSxT/qzuH1l/2jxslbKSak66/uQ+wad8Ew9rjNb4JUin3xtrfFtzmxx2jpQkybZsRVGA==
|
||||
"@bazel/bazel-linux_x64@1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-1.0.0.tgz#7043cc41eaf7b1d2618766e0759d513873bb9659"
|
||||
integrity sha512-/ZpOrYyDNGqUyAGPHFr4Y1kn8xCG1G4Lg2VMZtfCZzDohzoYFYs8iyQGU2/8PwldH8XX+oJT9atWqSt1EyoeAw==
|
||||
|
||||
"@bazel/bazel-win32_x64@0.28.1":
|
||||
version "0.28.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.28.1.tgz#60a2819618cf7582cc35ac16c01763a5e807b414"
|
||||
integrity sha512-T4xksGfKikaHS4zxnGT6r5R436mz9j2lz//L1vc5sJnaEF/1e2Gv6MLl86vfZW2Xxo6iIEi6ntSzgYxP2Blohw==
|
||||
"@bazel/bazel-win32_x64@1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-1.0.0.tgz#1111e4910c155a1917162ae96fd3737d062d20dd"
|
||||
integrity sha512-p5LpQ/WiijwOS+eBkdD7UewHL8JwK+8gpb4tIKqgh/a2yawgzEQPJDPBUV9ykss5t+s85BL2kEMhduuDewt/MA==
|
||||
|
||||
"@bazel/bazel@file:../../node_modules/@bazel/bazel":
|
||||
version "0.28.1"
|
||||
version "1.0.0"
|
||||
dependencies:
|
||||
"@bazel/hide-bazel-files" latest
|
||||
optionalDependencies:
|
||||
"@bazel/bazel-darwin_x64" "0.28.1"
|
||||
"@bazel/bazel-linux_x64" "0.28.1"
|
||||
"@bazel/bazel-win32_x64" "0.28.1"
|
||||
"@bazel/bazel-darwin_x64" "1.0.0"
|
||||
"@bazel/bazel-linux_x64" "1.0.0"
|
||||
"@bazel/bazel-win32_x64" "1.0.0"
|
||||
|
||||
"@bazel/hide-bazel-files@latest":
|
||||
version "0.38.3"
|
||||
|
@ -2867,10 +2867,10 @@ rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.8.1:
|
|||
dependencies:
|
||||
estree-walker "^0.6.1"
|
||||
|
||||
rollup@^1.21.4:
|
||||
version "1.26.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.26.0.tgz#cf40fd5e1edc4d7f3d4235a0a43f1c2be1cf294b"
|
||||
integrity sha512-5HljNYn9icFvXX+Oe97qY5TWvnWhKqgGT0HGeWWqFPx7w7+Anzg7dfHMtUif7YYy6QxAgynDSwK6uxbgcrVUxw==
|
||||
rollup@~1.25.0:
|
||||
version "1.25.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.25.2.tgz#739f508bd8f7ece52bb6c1fcda83466af82b7f6d"
|
||||
integrity sha512-+7z6Wab/L45QCPcfpuTZKwKiB0tynj05s/+s2U3F2Bi7rOLPr9UcjUwO7/xpjlPNXA/hwnth6jBExFRGyf3tMg==
|
||||
dependencies:
|
||||
"@types/estree" "*"
|
||||
"@types/node" "*"
|
||||
|
@ -3296,10 +3296,10 @@ tar@^4:
|
|||
safe-buffer "^5.1.2"
|
||||
yallist "^3.0.3"
|
||||
|
||||
terser@4.3.1:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.1.tgz#09820bcb3398299c4b48d9a86aefc65127d0ed65"
|
||||
integrity sha512-pnzH6dnFEsR2aa2SJaKb1uSCl3QmIsJ8dEkj0Fky+2AwMMcC9doMqLOQIH6wVTEKaVfKVvLSk5qxPBEZT9mywg==
|
||||
terser@^4.3.9:
|
||||
version "4.3.9"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.9.tgz#e4be37f80553d02645668727777687dad26bbca8"
|
||||
integrity sha512-NFGMpHjlzmyOtPL+fDw3G7+6Ueh/sz4mkaUYa4lJCxOPTNzd0Uj0aZJOmsDYoSQyfuVoWDMSWTPU3huyOm2zdA==
|
||||
dependencies:
|
||||
commander "^2.20.0"
|
||||
source-map "~0.6.1"
|
||||
|
|
10
package.json
10
package.json
|
@ -44,6 +44,7 @@
|
|||
"@bazel/jasmine": "0.39.1",
|
||||
"@bazel/karma": "0.39.1",
|
||||
"@bazel/protractor": "0.39.1",
|
||||
"@bazel/terser": "0.39.1",
|
||||
"@bazel/typescript": "0.39.1",
|
||||
"@microsoft/api-extractor": "^7.3.9",
|
||||
"@schematics/angular": "^8.0.0-beta.15",
|
||||
|
@ -102,11 +103,9 @@
|
|||
"nodejs-websocket": "^1.7.2",
|
||||
"protractor": "^5.4.2",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rollup": "^1.1.0",
|
||||
"rollup-plugin-amd": "^3.0.0",
|
||||
"rollup-plugin-commonjs": "^9.2.1",
|
||||
"rollup-plugin-json": "^4.0.0",
|
||||
"rollup-plugin-node-resolve": "^4.0.0",
|
||||
"rollup": "~1.25.0",
|
||||
"rollup-plugin-commonjs": "^10.1.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
"rxjs": "^6.5.3",
|
||||
"selenium-webdriver": "3.5.0",
|
||||
|
@ -114,6 +113,7 @@
|
|||
"source-map": "^0.6.1",
|
||||
"source-map-support": "0.5.9",
|
||||
"systemjs": "0.18.10",
|
||||
"terser": "4.3.3",
|
||||
"tsickle": "0.37.0",
|
||||
"tslib": "^1.10.0",
|
||||
"tslint": "5.7.0",
|
||||
|
|
|
@ -4,7 +4,6 @@ skylark_doc(
|
|||
name = "docs",
|
||||
srcs = [
|
||||
"//packages/bazel/src:ng_module.bzl",
|
||||
"//packages/bazel/src:ng_rollup_bundle.bzl",
|
||||
"//packages/bazel/src/ng_package:ng_package.bzl",
|
||||
],
|
||||
format = "html",
|
||||
|
|
|
@ -33,10 +33,11 @@
|
|||
"peerDependencies": {
|
||||
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
|
||||
"@bazel/typescript": "0.*",
|
||||
"typescript": ">=3.6 <3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
"typescript": ">=3.6 <3.7",
|
||||
"rollup": ">=1.20.0",
|
||||
"rollup-plugin-commonjs": ">=9.0.0",
|
||||
"rollup-plugin-node-resolve": ">=4.2.0",
|
||||
"rollup-plugin-sourcemaps": ">=0.4.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -10,23 +10,6 @@ exports_files(glob(["*.bzl"]))
|
|||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
|
||||
|
||||
nodejs_binary(
|
||||
name = "rollup_with_build_optimizer",
|
||||
data = [
|
||||
"@npm//@angular-devkit/build-optimizer",
|
||||
"@npm//is-builtin-module",
|
||||
"@npm//rollup",
|
||||
"@npm//rollup-plugin-amd",
|
||||
"@npm//rollup-plugin-commonjs",
|
||||
"@npm//rollup-plugin-json",
|
||||
"@npm//rollup-plugin-node-resolve",
|
||||
"@npm//rollup-plugin-sourcemaps",
|
||||
],
|
||||
entry_point = "@npm//:node_modules/rollup/bin/rollup",
|
||||
install_source_map_support = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "empty_node_modules",
|
||||
srcs = [],
|
||||
|
|
|
@ -27,9 +27,29 @@ nodejs_binary(
|
|||
install_source_map_support = False,
|
||||
)
|
||||
|
||||
exports_files(["ng_package.bzl"])
|
||||
nodejs_binary(
|
||||
name = "rollup_for_ng_package",
|
||||
data = [
|
||||
"@npm//rollup",
|
||||
"@npm//rollup-plugin-commonjs",
|
||||
"@npm//rollup-plugin-node-resolve",
|
||||
"@npm//rollup-plugin-sourcemaps",
|
||||
],
|
||||
entry_point = "@npm//:node_modules/rollup/dist/bin/rollup",
|
||||
install_source_map_support = False,
|
||||
)
|
||||
|
||||
exports_files([
|
||||
"ng_package.bzl",
|
||||
"rollup.config.js",
|
||||
"terser_config.default.json",
|
||||
])
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = glob(["*.bzl"]) + ["BUILD.bazel"],
|
||||
srcs = glob(["*.bzl"]) + [
|
||||
"BUILD.bazel",
|
||||
"rollup.config.js",
|
||||
"terser_config.default.json",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -13,15 +13,7 @@ It packages your library following the Angular Package Format, see the
|
|||
specification of this format at https://goo.gl/jB3GVv
|
||||
"""
|
||||
|
||||
load("@build_bazel_rules_nodejs//internal/common:collect_es6_sources.bzl", "collect_es6_sources")
|
||||
load("@build_bazel_rules_nodejs//:providers.bzl", "JSNamedModuleInfo", "NpmPackageInfo")
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
|
||||
"ROLLUP_ATTRS",
|
||||
"ROLLUP_DEPS_ASPECTS",
|
||||
"run_terser",
|
||||
"write_rollup_config",
|
||||
)
|
||||
load("@build_bazel_rules_nodejs//:providers.bzl", "JSEcmaScriptModuleInfo", "JSNamedModuleInfo", "NpmPackageInfo", "node_modules_aspect")
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//internal/npm_package:npm_package.bzl",
|
||||
"NPM_PACKAGE_ATTRS",
|
||||
|
@ -38,6 +30,47 @@ def _debug(vars, *args):
|
|||
print("[ng_package.bzl]", args)
|
||||
|
||||
_DEFAULT_NG_PACKAGER = "@npm//@angular/bazel/bin:packager"
|
||||
_DEFAULT_ROLLUP_CONFIG_TMPL = "@npm_angular_bazel//src/ng_package:rollup.config.js"
|
||||
_DEFALUT_TERSER_CONFIG_FILE = "@npm_angular_bazel//src/ng_package:terser_config.default.json"
|
||||
_DEFAULT_ROLLUP = "@npm_angular_bazel//src/ng_package:rollup_for_ng_package"
|
||||
_DEFAULT_TERSER = "@npm//terser/bin:terser"
|
||||
|
||||
_NG_PACKAGE_MODULE_MAPPINGS_ATTR = "ng_package_module_mappings"
|
||||
|
||||
def _ng_package_module_mappings_aspect_impl(target, ctx):
|
||||
mappings = dict()
|
||||
for dep in ctx.rule.attr.deps:
|
||||
if hasattr(dep, _NG_PACKAGE_MODULE_MAPPINGS_ATTR):
|
||||
for k, v in getattr(dep, _NG_PACKAGE_MODULE_MAPPINGS_ATTR).items():
|
||||
if k in mappings and mappings[k] != v:
|
||||
fail(("duplicate module mapping at %s: %s maps to both %s and %s" %
|
||||
(target.label, k, mappings[k], v)), "deps")
|
||||
mappings[k] = v
|
||||
if ((hasattr(ctx.rule.attr, "module_name") and ctx.rule.attr.module_name) or
|
||||
(hasattr(ctx.rule.attr, "module_root") and ctx.rule.attr.module_root)):
|
||||
mn = ctx.rule.attr.module_name
|
||||
if not mn:
|
||||
mn = target.label.name
|
||||
mr = target.label.package
|
||||
if target.label.workspace_root:
|
||||
mr = "%s/%s" % (target.label.workspace_root, mr)
|
||||
if ctx.rule.attr.module_root and ctx.rule.attr.module_root != ".":
|
||||
if ctx.rule.attr.module_root.endswith(".ts"):
|
||||
# This is the type-checking module mapping. Strip the trailing .d.ts
|
||||
# as it doesn't belong in TypeScript's path mapping.
|
||||
mr = "%s/%s" % (mr, ctx.rule.attr.module_root.replace(".d.ts", ""))
|
||||
else:
|
||||
mr = "%s/%s" % (mr, ctx.rule.attr.module_root)
|
||||
if mn in mappings and mappings[mn] != mr:
|
||||
fail(("duplicate module mapping at %s: %s maps to both %s and %s" %
|
||||
(target.label, mn, mappings[mn], mr)), "deps")
|
||||
mappings[mn] = mr
|
||||
return struct(ng_package_module_mappings = mappings)
|
||||
|
||||
ng_package_module_mappings_aspect = aspect(
|
||||
_ng_package_module_mappings_aspect_impl,
|
||||
attr_aspects = ["deps"],
|
||||
)
|
||||
|
||||
# Convert from some-dash-case to someCamelCase
|
||||
def _convert_dash_case_to_camel_case(s):
|
||||
|
@ -102,18 +135,122 @@ WELL_KNOWN_GLOBALS = {p: _global_name(p) for p in [
|
|||
# TODO(gregmagolan): clean this up
|
||||
_DEPSET_TYPE = "depset"
|
||||
|
||||
def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, format = "es", module_name = "", include_tslib = False):
|
||||
def _terser(ctx, input, output):
|
||||
"""Runs terser on an input file.
|
||||
|
||||
Args:
|
||||
ctx: Bazel rule execution context
|
||||
input: input file
|
||||
output: output file
|
||||
|
||||
Returns:
|
||||
The sourcemap file
|
||||
"""
|
||||
|
||||
map_output = ctx.actions.declare_file(output.basename + ".map", sibling = output)
|
||||
|
||||
args = ctx.actions.args()
|
||||
|
||||
args.add(input.path)
|
||||
args.add_all(["--output", output.path])
|
||||
|
||||
# Source mapping options are comma-packed into one argv
|
||||
# see https://github.com/terser-js/terser#command-line-usage
|
||||
source_map_opts = ["includeSources", "base=" + ctx.bin_dir.path]
|
||||
|
||||
# This option doesn't work in the config file, only on the CLI
|
||||
args.add_all(["--source-map", ",".join(source_map_opts)])
|
||||
|
||||
args.add("--comments")
|
||||
|
||||
args.add_all(["--config-file", ctx.file.terser_config_file.path])
|
||||
|
||||
ctx.actions.run(
|
||||
progress_message = "Optimizing JavaScript %s [terser]" % output.short_path,
|
||||
executable = ctx.executable.terser,
|
||||
inputs = [input, ctx.file.terser_config_file],
|
||||
outputs = [output, map_output],
|
||||
arguments = [args],
|
||||
)
|
||||
|
||||
return map_output
|
||||
|
||||
def _compute_node_modules_root(ctx):
|
||||
"""Computes the node_modules root from the node_modules and deps attributes.
|
||||
|
||||
Args:
|
||||
ctx: the skylark execution context
|
||||
|
||||
Returns:
|
||||
The node_modules root as a string
|
||||
"""
|
||||
node_modules_root = None
|
||||
for d in ctx.attr.deps:
|
||||
if NpmPackageInfo in d:
|
||||
possible_root = "/".join(["external", d[NpmPackageInfo].workspace, "node_modules"])
|
||||
if not node_modules_root:
|
||||
node_modules_root = possible_root
|
||||
elif node_modules_root != possible_root:
|
||||
fail("All npm dependencies need to come from a single workspace. Found '%s' and '%s'." % (node_modules_root, possible_root))
|
||||
if not node_modules_root:
|
||||
# there are no fine grained deps but we still need a node_modules_root even if its empty
|
||||
node_modules_root = "external/npm/node_modules"
|
||||
return node_modules_root
|
||||
|
||||
def _write_rollup_config(ctx, root_dir, filename = "_%s.rollup.conf.js"):
|
||||
"""Generate a rollup config file.
|
||||
|
||||
Args:
|
||||
ctx: Bazel rule execution context
|
||||
root_dir: root directory for module resolution (defaults to None)
|
||||
filename: output filename pattern (defaults to `_%s.rollup.conf.js`)
|
||||
|
||||
Returns:
|
||||
The rollup config file. See https://rollupjs.org/guide/en#configuration-files
|
||||
"""
|
||||
config = ctx.actions.declare_file(filename % ctx.label.name)
|
||||
|
||||
mappings = dict()
|
||||
all_deps = ctx.attr.deps + ctx.attr.srcs
|
||||
for dep in all_deps:
|
||||
if hasattr(dep, _NG_PACKAGE_MODULE_MAPPINGS_ATTR):
|
||||
for k, v in getattr(dep, _NG_PACKAGE_MODULE_MAPPINGS_ATTR).items():
|
||||
if k in mappings and mappings[k] != v:
|
||||
fail(("duplicate module mapping at %s: %s maps to both %s and %s" %
|
||||
(dep.label, k, mappings[k], v)), "deps")
|
||||
mappings[k] = v
|
||||
|
||||
ctx.actions.expand_template(
|
||||
output = config,
|
||||
template = ctx.file.rollup_config_tmpl,
|
||||
substitutions = {
|
||||
"TMPL_banner_file": "\"%s\"" % ctx.file.license_banner.path if ctx.file.license_banner else "undefined",
|
||||
"TMPL_module_mappings": str(mappings),
|
||||
"TMPL_node_modules_root": _compute_node_modules_root(ctx),
|
||||
"TMPL_root_dir": root_dir,
|
||||
"TMPL_stamp_data": "\"%s\"" % ctx.version_file.path if ctx.version_file else "undefined",
|
||||
"TMPL_workspace_name": ctx.workspace_name,
|
||||
},
|
||||
)
|
||||
|
||||
return config
|
||||
|
||||
def _run_rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, format, module_name = "", include_tslib = False):
|
||||
map_output = ctx.actions.declare_file(js_output.basename + ".map", sibling = js_output)
|
||||
|
||||
args = ctx.actions.args()
|
||||
args.add("--config", rollup_config)
|
||||
|
||||
args.add("--input", entry_point)
|
||||
args.add("--output.file", js_output)
|
||||
args.add("--output.format", format)
|
||||
if module_name:
|
||||
args.add("--output.name", _global_name(module_name))
|
||||
args.add("--amd.id", module_name)
|
||||
elif format == "umd" or format == "iife":
|
||||
# If we're generating UMD or IIFE we need a global name.
|
||||
# See https://risanb.com/posts/bundling-your-javascript-library-with-rollup/#umd-output and
|
||||
# https://risanb.com/posts/bundling-your-javascript-library-with-rollup/#umd-output.
|
||||
args.add("--output.name", ctx.label.name)
|
||||
|
||||
# After updating to build_bazel_rules_nodejs 0.27.0+, rollup has been updated to v1.3.1
|
||||
# which tree shakes @__PURE__ annotations and const variables which are later amended by NGCC.
|
||||
|
@ -129,6 +266,8 @@ def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, for
|
|||
# of command line args
|
||||
args.add("--sourcemap")
|
||||
|
||||
args.add("--preserveSymlinks")
|
||||
|
||||
globals = dict(WELL_KNOWN_GLOBALS, **ctx.attr.globals)
|
||||
external = globals.keys()
|
||||
if not include_tslib:
|
||||
|
@ -141,6 +280,8 @@ def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, for
|
|||
join_with = ",",
|
||||
)
|
||||
|
||||
# We will produce errors as needed. Anything else is spammy: a well-behaved
|
||||
# bazel rule prints nothing on success.
|
||||
args.add("--silent")
|
||||
|
||||
other_inputs = [rollup_config]
|
||||
|
@ -153,8 +294,8 @@ def _rollup(ctx, bundle_name, rollup_config, entry_point, inputs, js_output, for
|
|||
mnemonic = "AngularPackageRollup",
|
||||
inputs = inputs.to_list() + other_inputs,
|
||||
outputs = [js_output, map_output],
|
||||
executable = ctx.executable._rollup,
|
||||
tools = [ctx.executable._rollup],
|
||||
executable = ctx.executable.rollup,
|
||||
tools = [ctx.executable.rollup],
|
||||
arguments = [args],
|
||||
)
|
||||
return struct(
|
||||
|
@ -191,9 +332,6 @@ def _filter_out_generated_files(files, extension, package_path = None):
|
|||
|
||||
return depset(result)
|
||||
|
||||
def _esm2015_root_dir(ctx):
|
||||
return ctx.label.name + ".es6"
|
||||
|
||||
def _filter_js_inputs(all_inputs):
|
||||
all_inputs_list = all_inputs.to_list() if type(all_inputs) == _DEPSET_TYPE else all_inputs
|
||||
return [
|
||||
|
@ -206,7 +344,12 @@ def _filter_js_inputs(all_inputs):
|
|||
def _ng_package_impl(ctx):
|
||||
npm_package_directory = ctx.actions.declare_directory("%s.ng_pkg" % ctx.label.name)
|
||||
|
||||
esm_2015_files = _filter_out_generated_files(collect_es6_sources(ctx), "js")
|
||||
esm_2015_files_depsets = []
|
||||
for dep in ctx.attr.deps:
|
||||
if JSEcmaScriptModuleInfo in dep:
|
||||
esm_2015_files_depsets.append(dep[JSEcmaScriptModuleInfo].sources)
|
||||
|
||||
esm_2015_files = _filter_out_generated_files(depset(transitive = esm_2015_files_depsets), "mjs")
|
||||
esm5_sources = _filter_out_generated_files(flatten_esm5(ctx), "js")
|
||||
|
||||
# These accumulators match the directory names where the files live in the
|
||||
|
@ -225,7 +368,9 @@ def _ng_package_impl(ctx):
|
|||
if f.path.endswith(".js"):
|
||||
esm5.append(struct(js = f, map = None))
|
||||
for f in esm_2015_files.to_list():
|
||||
if f.path.endswith(".js"):
|
||||
# tsickle generated `{module}.externs.js` file will be added to JSEcmaScriptModuleInfo sources
|
||||
# by ng_module so we include both .js and .mjs sources from the JSEcmaScriptModuleInfo provider
|
||||
if f.path.endswith(".js") or f.path.endswith(".mjs"):
|
||||
esm2015.append(struct(js = f, map = None))
|
||||
|
||||
# We infer the entry points to be:
|
||||
|
@ -316,10 +461,8 @@ def _ng_package_impl(ctx):
|
|||
es2015_entry_point = "/".join([p for p in [
|
||||
ctx.bin_dir.path,
|
||||
ctx.label.package,
|
||||
_esm2015_root_dir(ctx),
|
||||
ctx.label.package,
|
||||
entry_point,
|
||||
index_file,
|
||||
index_file.replace(".js", ".mjs"),
|
||||
] if p])
|
||||
|
||||
es5_entry_point = "/".join([p for p in [
|
||||
|
@ -343,23 +486,43 @@ def _ng_package_impl(ctx):
|
|||
umd_output = ctx.outputs.umd
|
||||
min_output = ctx.outputs.umd_min
|
||||
|
||||
node_modules_files = _filter_js_inputs(ctx.files.node_modules)
|
||||
|
||||
# Also include files from npm fine grained deps as inputs.
|
||||
# These deps are identified by the NpmPackageInfo provider.
|
||||
node_modules_files = []
|
||||
for d in ctx.attr.deps:
|
||||
if NpmPackageInfo in d:
|
||||
node_modules_files += _filter_js_inputs(d.files)
|
||||
esm5_rollup_inputs = depset(node_modules_files, transitive = [esm5_sources])
|
||||
|
||||
esm2015_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, _esm2015_root_dir(ctx)]), filename = "_%s.rollup_esm2015.conf.js")
|
||||
esm5_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]), filename = "_%s.rollup_esm5.conf.js")
|
||||
esm2015_config = _write_rollup_config(ctx, ctx.bin_dir.path, filename = "_%s.rollup_esm2015.conf.js")
|
||||
esm5_config = _write_rollup_config(ctx, "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]), filename = "_%s.rollup_esm5.conf.js")
|
||||
|
||||
fesm2015.append(_rollup(ctx, "fesm2015", esm2015_config, es2015_entry_point, depset(node_modules_files, transitive = [esm_2015_files]), fesm2015_output))
|
||||
fesm5.append(_rollup(ctx, "fesm5", esm5_config, es5_entry_point, esm5_rollup_inputs, fesm5_output))
|
||||
fesm2015.append(
|
||||
_run_rollup(
|
||||
ctx,
|
||||
"fesm2015",
|
||||
esm2015_config,
|
||||
es2015_entry_point,
|
||||
depset(node_modules_files, transitive = [esm_2015_files]),
|
||||
fesm2015_output,
|
||||
format = "esm",
|
||||
),
|
||||
)
|
||||
|
||||
fesm5.append(
|
||||
_run_rollup(
|
||||
ctx,
|
||||
"fesm5",
|
||||
esm5_config,
|
||||
es5_entry_point,
|
||||
esm5_rollup_inputs,
|
||||
fesm5_output,
|
||||
format = "esm",
|
||||
),
|
||||
)
|
||||
|
||||
bundles.append(
|
||||
_rollup(
|
||||
_run_rollup(
|
||||
ctx,
|
||||
"umd",
|
||||
esm5_config,
|
||||
|
@ -371,11 +534,10 @@ def _ng_package_impl(ctx):
|
|||
include_tslib = True,
|
||||
),
|
||||
)
|
||||
terser_sourcemap = run_terser(
|
||||
terser_sourcemap = _terser(
|
||||
ctx,
|
||||
umd_output,
|
||||
min_output,
|
||||
config_name = entry_point.replace("/", "_"),
|
||||
)
|
||||
bundles.append(struct(js = min_output, map = terser_sourcemap))
|
||||
|
||||
|
@ -468,21 +630,89 @@ def _ng_package_impl(ctx):
|
|||
files = depset([package_dir]),
|
||||
)]
|
||||
|
||||
DEPS_ASPECTS = [esm5_outputs_aspect]
|
||||
_NG_PACKAGE_DEPS_ASPECTS = [esm5_outputs_aspect, ng_package_module_mappings_aspect, node_modules_aspect]
|
||||
|
||||
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
|
||||
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
|
||||
_NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **{
|
||||
"srcs": attr.label_list(
|
||||
doc = """JavaScript source files from the workspace.
|
||||
These can use ES2015 syntax and ES Modules (import/export)""",
|
||||
allow_files = True,
|
||||
),
|
||||
"entry_point": attr.label(
|
||||
doc = """The starting point of the application, passed as the `--input` flag to rollup.
|
||||
|
||||
NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **dict(ROLLUP_ATTRS, **{
|
||||
"srcs": attr.label_list(allow_files = True),
|
||||
"deps": attr.label_list(aspects = DEPS_ASPECTS),
|
||||
If the entry JavaScript file belongs to the same package (as the BUILD file),
|
||||
you can simply reference it by its relative name to the package directory:
|
||||
|
||||
```
|
||||
ng_package(
|
||||
name = "bundle",
|
||||
entry_point = ":main.js",
|
||||
)
|
||||
```
|
||||
|
||||
You can specify the entry point as a typescript file so long as you also include
|
||||
the ts_library target in deps:
|
||||
|
||||
```
|
||||
ts_library(
|
||||
name = "main",
|
||||
srcs = ["main.ts"],
|
||||
)
|
||||
|
||||
ng_package(
|
||||
name = "bundle",
|
||||
deps = [":main"]
|
||||
entry_point = ":main.ts",
|
||||
)
|
||||
```
|
||||
|
||||
The rule will use the corresponding `.js` output of the ts_library rule as the entry point.
|
||||
|
||||
If the entry point target is a rule, it should produce a single JavaScript entry file that will be passed to the nodejs_binary rule.
|
||||
For example:
|
||||
|
||||
```
|
||||
filegroup(
|
||||
name = "entry_file",
|
||||
srcs = ["main.js"],
|
||||
)
|
||||
|
||||
ng_package(
|
||||
name = "bundle",
|
||||
entry_point = ":entry_file",
|
||||
)
|
||||
```
|
||||
""",
|
||||
mandatory = True,
|
||||
allow_single_file = True,
|
||||
),
|
||||
"globals": attr.string_dict(
|
||||
doc = """A dict of symbols that reference external scripts.
|
||||
The keys are variable names that appear in the program,
|
||||
and the values are the symbol to reference at runtime in a global context (UMD bundles).
|
||||
For example, a program referencing @angular/core should use ng.core
|
||||
as the global reference, so Angular users should include the mapping
|
||||
`"@angular/core":"ng.core"` in the globals.""",
|
||||
default = {},
|
||||
),
|
||||
"license_banner": attr.label(
|
||||
doc = """A .txt file passed to the `banner` config option of rollup.
|
||||
The contents of the file will be copied to the top of the resulting bundles.
|
||||
Note that you can replace a version placeholder in the license file, by using
|
||||
the special version `0.0.0-PLACEHOLDER`. See the section on stamping in the README.""",
|
||||
allow_single_file = [".txt"],
|
||||
),
|
||||
"deps": attr.label_list(
|
||||
doc = """Other rules that produce JavaScript outputs, such as `ts_library`.""",
|
||||
aspects = _NG_PACKAGE_DEPS_ASPECTS,
|
||||
),
|
||||
"data": attr.label_list(
|
||||
doc = "Additional, non-Angular files to be added to the package, e.g. global CSS assets.",
|
||||
allow_files = True,
|
||||
),
|
||||
"include_devmode_srcs": attr.bool(default = False),
|
||||
"readme_md": attr.label(allow_single_file = [".md"]),
|
||||
"globals": attr.string_dict(default = {}),
|
||||
"entry_point_name": attr.string(
|
||||
doc = "Name to use when generating bundle files for the primary entry-point.",
|
||||
),
|
||||
|
@ -491,16 +721,34 @@ NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **dict(ROLLUP_ATTRS, **{
|
|||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
"_rollup": attr.label(
|
||||
default = Label("@build_bazel_rules_nodejs//internal/rollup"),
|
||||
"rollup": attr.label(
|
||||
default = Label(_DEFAULT_ROLLUP),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
"_rollup_config_tmpl": attr.label(
|
||||
default = Label("@build_bazel_rules_nodejs//internal/rollup:rollup.config.js"),
|
||||
"terser": attr.label(
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
default = Label(_DEFAULT_TERSER),
|
||||
),
|
||||
"terser_config_file": attr.label(
|
||||
doc = """A JSON file containing Terser minify() options.
|
||||
|
||||
This is the file you would pass to the --config-file argument in terser's CLI.
|
||||
https://github.com/terser-js/terser#minify-options documents the content of the file.
|
||||
|
||||
If `config_file` isn't supplied, Bazel will use a default config file.
|
||||
""",
|
||||
allow_single_file = True,
|
||||
# These defaults match how terser was run in the legacy built-in rollup_bundle rule.
|
||||
# We keep them the same so it's easier for users to migrate.
|
||||
default = Label(_DEFALUT_TERSER_CONFIG_FILE),
|
||||
),
|
||||
"rollup_config_tmpl": attr.label(
|
||||
default = Label(_DEFAULT_ROLLUP_CONFIG_TMPL),
|
||||
allow_single_file = True,
|
||||
),
|
||||
}))
|
||||
})
|
||||
|
||||
# Angular wants these named after the entry_point,
|
||||
# eg. for //packages/core it looks like "packages/core/index.js", we want
|
||||
|
@ -539,7 +787,7 @@ def primary_entry_point_name(name, entry_point, entry_point_name):
|
|||
# Fall back to the name of the ng_package rule.
|
||||
return name
|
||||
|
||||
def ng_package_outputs(name, entry_point, entry_point_name):
|
||||
def _ng_package_outputs(name, entry_point, entry_point_name):
|
||||
"""This is not a public API.
|
||||
|
||||
This function computes the named outputs for an ng_package rule.
|
||||
|
@ -570,8 +818,8 @@ def ng_package_outputs(name, entry_point, entry_point_name):
|
|||
|
||||
ng_package = rule(
|
||||
implementation = _ng_package_impl,
|
||||
attrs = NG_PACKAGE_ATTRS,
|
||||
outputs = ng_package_outputs,
|
||||
attrs = _NG_PACKAGE_ATTRS,
|
||||
outputs = _ng_package_outputs,
|
||||
)
|
||||
"""
|
||||
ng_package produces an npm-ready package from an Angular library.
|
||||
|
|
|
@ -140,20 +140,28 @@ function main(args: string[]): number {
|
|||
|
||||
/**
|
||||
* Relativize the path where a file is written.
|
||||
* @param file a path containing a re-rooted segment like .esm5 or .es6
|
||||
* @param file a path containing a re-rooted segment like .esm5
|
||||
* @param suffix the re-rooted directory
|
||||
* @param outDir path where we copy the file, relative to the out
|
||||
*/
|
||||
function writeEsmFile(file: string, suffix: string, outDir: string) {
|
||||
// Note that the specified file path is always using the posix path delimiter.
|
||||
const root = file.substr(0, file.lastIndexOf(`${suffix}/`) + suffix.length + 1);
|
||||
const rel = path.dirname(path.relative(path.join(root, srcDir), file));
|
||||
function relPath(file: string, suffix: string) {
|
||||
if (suffix) {
|
||||
// Note that the specified file path is always using the posix path delimiter.
|
||||
const root =
|
||||
suffix ? file.substr(0, file.lastIndexOf(`${suffix}/`) + suffix.length + 1) : binDir;
|
||||
return path.dirname(path.relative(path.join(root, srcDir), file));
|
||||
} else {
|
||||
return path.dirname(path.relative(binDir, file));
|
||||
}
|
||||
}
|
||||
const rel = relPath(file, suffix);
|
||||
if (!rel.startsWith('..')) {
|
||||
copyFile(file, path.join(out, outDir), rel);
|
||||
}
|
||||
}
|
||||
|
||||
esm2015.forEach(file => writeEsmFile(file, '.es6', 'esm2015'));
|
||||
esm2015.forEach(file => writeEsmFile(file, '', 'esm2015'));
|
||||
esm5.forEach(file => writeEsmFile(file, '.esm5', 'esm5'));
|
||||
|
||||
bundles.forEach(bundle => { copyFile(bundle, out, 'bundles'); });
|
||||
|
@ -276,19 +284,22 @@ function main(args: string[]): number {
|
|||
|
||||
function copyFile(file: string, baseDir: string, relative = '.') {
|
||||
const dir = path.join(baseDir, relative);
|
||||
// output file is .js if the input file is .mjs
|
||||
const outFile = path.posix.join(
|
||||
dir, path.basename(file.endsWith('.mjs') ? file.replace(/\.mjs$/, '.js') : file));
|
||||
shx.mkdir('-p', dir);
|
||||
shx.cp(file, dir);
|
||||
shx.cp(file, outFile);
|
||||
// Double-underscore is used to escape forward slash in FESM filenames.
|
||||
// See ng_package.bzl:
|
||||
// fesm_output_filename = entry_point.replace("/", "__")
|
||||
// We need to unescape these.
|
||||
if (file.indexOf('__') >= 0) {
|
||||
const outputPath = path.join(dir, ...path.basename(file).split('__'));
|
||||
if (outFile.indexOf('__') >= 0) {
|
||||
const outputPath = path.join(dir, ...path.basename(outFile).split('__'));
|
||||
shx.mkdir('-p', path.dirname(outputPath));
|
||||
shx.mv(path.join(dir, path.basename(file)), outputPath);
|
||||
|
||||
// if we are renaming the .js file, we'll also need to update the sourceMappingURL in the file
|
||||
if (file.endsWith('.js')) {
|
||||
if (outFile.endsWith('.js')) {
|
||||
shx.chmod('+w', outputPath);
|
||||
shx.sed('-i', `${path.basename(file)}.map`, `${path.basename(outputPath)}.map`, outputPath);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
// Rollup configuration
|
||||
// GENERATED BY Bazel
|
||||
|
||||
const nodeResolve = require('rollup-plugin-node-resolve');
|
||||
const sourcemaps = require('rollup-plugin-sourcemaps');
|
||||
const commonjs = require('rollup-plugin-commonjs');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
function log_verbose(...m) {
|
||||
// This is a template file so we use __filename to output the actual filename
|
||||
if (!!process.env['VERBOSE_LOGS']) console.error(`[${path.basename(__filename)}]`, ...m);
|
||||
}
|
||||
|
||||
const workspaceName = 'TMPL_workspace_name';
|
||||
const rootDir = 'TMPL_root_dir';
|
||||
const bannerFile = TMPL_banner_file;
|
||||
const stampData = TMPL_stamp_data;
|
||||
const moduleMappings = TMPL_module_mappings;
|
||||
const nodeModulesRoot = 'TMPL_node_modules_root';
|
||||
|
||||
log_verbose(`running with
|
||||
cwd: ${process.cwd()}
|
||||
workspaceName: ${workspaceName}
|
||||
rootDir: ${rootDir}
|
||||
bannerFile: ${bannerFile}
|
||||
stampData: ${stampData}
|
||||
moduleMappings: ${JSON.stringify(moduleMappings)}
|
||||
nodeModulesRoot: ${nodeModulesRoot}
|
||||
`);
|
||||
|
||||
function fileExists(filePath) {
|
||||
try {
|
||||
return fs.statSync(filePath).isFile();
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This resolver mimics the TypeScript Path Mapping feature, which lets us resolve
|
||||
// modules based on a mapping of short names to paths.
|
||||
function resolveBazel(
|
||||
importee, importer, baseDir = process.cwd(), resolve = require.resolve, root = rootDir) {
|
||||
log_verbose(`resolving '${importee}' from ${importer}`);
|
||||
|
||||
function resolveInRootDir(importee) {
|
||||
var candidate = path.join(baseDir, root, importee);
|
||||
log_verbose(`try to resolve '${importee}' at '${candidate}'`);
|
||||
try {
|
||||
var result = resolve(candidate);
|
||||
return result;
|
||||
} catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// Since mappings are always in POSIX paths, when comparing the importee to mappings
|
||||
// we should normalize the importee.
|
||||
// Having it normalized is also useful to determine relative paths.
|
||||
const normalizedImportee = importee.replace(/\\/g, '/');
|
||||
|
||||
// If import is fully qualified then resolve it directly
|
||||
if (fileExists(importee)) {
|
||||
log_verbose(`resolved fully qualified '${importee}'`);
|
||||
return importee;
|
||||
}
|
||||
|
||||
var resolved;
|
||||
if (normalizedImportee.startsWith('./') || normalizedImportee.startsWith('../')) {
|
||||
// relative import
|
||||
if (importer) {
|
||||
let importerRootRelative = path.dirname(importer);
|
||||
const relative = path.relative(path.join(baseDir, root), importerRootRelative);
|
||||
if (!relative.startsWith('.')) {
|
||||
importerRootRelative = relative;
|
||||
}
|
||||
resolved = path.join(importerRootRelative, importee);
|
||||
} else {
|
||||
throw new Error('cannot resolve relative paths without an importer');
|
||||
}
|
||||
if (resolved) resolved = resolveInRootDir(resolved);
|
||||
}
|
||||
|
||||
if (!resolved) {
|
||||
// possible workspace import or external import if importee matches a module
|
||||
// mapping
|
||||
for (const k in moduleMappings) {
|
||||
if (normalizedImportee == k || normalizedImportee.startsWith(k + '/')) {
|
||||
// replace the root module name on a mappings match
|
||||
// note that the module_root attribute is intended to be used for type-checking
|
||||
// so it uses eg. "index.d.ts". At runtime, we have only index.js, so we strip the
|
||||
// .d.ts suffix and let node require.resolve do its thing.
|
||||
var v = moduleMappings[k].replace(/\.d\.ts$/, '');
|
||||
const mappedImportee = path.join(v, normalizedImportee.slice(k.length + 1));
|
||||
log_verbose(`module mapped '${importee}' to '${mappedImportee}'`);
|
||||
resolved = resolveInRootDir(mappedImportee);
|
||||
if (resolved) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!resolved) {
|
||||
// workspace import
|
||||
const userWorkspacePath = path.relative(workspaceName, importee);
|
||||
resolved = resolveInRootDir(userWorkspacePath.startsWith('..') ? importee : userWorkspacePath);
|
||||
}
|
||||
|
||||
if (resolved) {
|
||||
log_verbose(`resolved to ${resolved}`);
|
||||
} else {
|
||||
log_verbose(`allowing rollup to resolve '${importee}' with node module resolution`);
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
let banner = '';
|
||||
if (bannerFile) {
|
||||
banner = fs.readFileSync(bannerFile, {encoding: 'utf-8'});
|
||||
if (stampData) {
|
||||
const versionTag = fs.readFileSync(stampData, {encoding: 'utf-8'})
|
||||
.split('\n')
|
||||
.find(s => s.startsWith('BUILD_SCM_VERSION'));
|
||||
// Don't assume BUILD_SCM_VERSION exists
|
||||
if (versionTag) {
|
||||
const version = versionTag.split(' ')[1].trim();
|
||||
banner = banner.replace(/0.0.0-PLACEHOLDER/, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const plugins = [
|
||||
{
|
||||
name: 'resolveBazel',
|
||||
resolveId: resolveBazel,
|
||||
},
|
||||
nodeResolve({
|
||||
mainFields: ['browser', 'es2015', 'module', 'jsnext:main', 'main'],
|
||||
jail: process.cwd(),
|
||||
customResolveOptions: {moduleDirectory: nodeModulesRoot}
|
||||
}),
|
||||
commonjs({ignoreGlobal: true}),
|
||||
sourcemaps(),
|
||||
];
|
||||
|
||||
const config = {
|
||||
plugins,
|
||||
output: {
|
||||
banner,
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = config;
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"compress": {
|
||||
"global_defs": {"ngDevMode": false, "ngI18nClosureMode": false},
|
||||
"keep_fnames": true,
|
||||
"passes": 3,
|
||||
"pure_getters": true,
|
||||
"reduce_funcs": true,
|
||||
"reduce_vars": true,
|
||||
"sequences": true
|
||||
},
|
||||
"mangle": true
|
||||
}
|
|
@ -1,229 +0,0 @@
|
|||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
|
||||
"""Rollup with Build Optimizer
|
||||
|
||||
This provides a variant of the [rollup_bundle] rule that works better for Angular apps.
|
||||
|
||||
It registers `@angular-devkit/build-optimizer` as a rollup plugin, to get
|
||||
better optimization. It also uses ESM5 format inputs, as this is what
|
||||
build-optimizer is hard-coded to look for and transform.
|
||||
|
||||
[rollup_bundle]: https://bazelbuild.github.io/rules_nodejs/rollup/rollup_bundle.html
|
||||
"""
|
||||
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
|
||||
"ROLLUP_ATTRS",
|
||||
"ROLLUP_DEPS_ASPECTS",
|
||||
"run_rollup",
|
||||
"run_sourcemapexplorer",
|
||||
"run_terser",
|
||||
"write_rollup_config",
|
||||
)
|
||||
load("@build_bazel_rules_nodejs//internal/common:collect_es6_sources.bzl", collect_es2015_sources = "collect_es6_sources")
|
||||
load(":esm5.bzl", "esm5_outputs_aspect", "esm5_root_dir", "flatten_esm5")
|
||||
|
||||
ROLLUP_OUTPUTS = {
|
||||
"build_cjs": "%{name}.cjs.js",
|
||||
"build_es2015": "%{name}.es2015.js",
|
||||
"build_es2015_min": "%{name}.min.es2015.js",
|
||||
"build_es2015_min_debug": "%{name}.min_debug.es2015.js",
|
||||
"build_es5": "%{name}.js",
|
||||
"build_es5_min": "%{name}.min.js",
|
||||
"build_es5_min_debug": "%{name}.min_debug.js",
|
||||
"build_umd": "%{name}.umd.js",
|
||||
"explore_html": "%{name}.explore.html",
|
||||
}
|
||||
|
||||
PACKAGES = [
|
||||
# Generated paths when using ng_rollup_bundle outside this monorepo.
|
||||
"external/angular/packages/core/src",
|
||||
"external/angular/packages/common/src",
|
||||
"external/angular/packages/compiler/src",
|
||||
"external/angular/packages/platform-browser/src",
|
||||
"external/rxjs",
|
||||
# Generated paths when using ng_rollup_bundle inside this monorepo.
|
||||
"packages/core/src",
|
||||
"packages/common/src",
|
||||
"packages/compiler/src",
|
||||
"packages/platform-browser/src",
|
||||
]
|
||||
PLUGIN_CONFIG = "{sideEffectFreeModules: [\n%s]}" % ",\n".join(
|
||||
[" '.esm5/{0}'".format(p) for p in PACKAGES],
|
||||
)
|
||||
BO_ROLLUP = "npm/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/rollup-plugin.js"
|
||||
BO_PLUGIN = "require('%s').default(%s)" % (BO_ROLLUP, PLUGIN_CONFIG)
|
||||
|
||||
def _use_plain_rollup(ctx):
|
||||
"""Determine whether to use the Angular or upstream versions of the rollup_bundle rule.
|
||||
|
||||
In most modes, the Angular version of rollup is used. This runs build optimizer as part of its
|
||||
processing, which affects decorators and annotations.
|
||||
|
||||
In JIT modes, an emulation of the upstream rollup_bundle rule is used. This avoids running
|
||||
build optimizer on code which isn't designed to be optimized by it.
|
||||
|
||||
Args:
|
||||
ctx: skylark rule execution context
|
||||
|
||||
Returns:
|
||||
true iff the Angular version of rollup with build optimizer should be used, false otherwise
|
||||
"""
|
||||
|
||||
if "compile" not in ctx.var:
|
||||
return False
|
||||
|
||||
strategy = ctx.var["compile"]
|
||||
return strategy == "jit"
|
||||
|
||||
def run_brotli(ctx, input, output):
|
||||
"""Execute the Brotli compression utility.
|
||||
|
||||
Args:
|
||||
ctx: Bazel's rule execution context
|
||||
input: any file
|
||||
output: the compressed file
|
||||
"""
|
||||
ctx.actions.run(
|
||||
executable = ctx.executable._brotli,
|
||||
inputs = [input],
|
||||
outputs = [output],
|
||||
arguments = ["--output=%s" % output.path, input.path],
|
||||
)
|
||||
|
||||
# Borrowed from bazelbuild/rules_nodejs
|
||||
def _run_tsc(ctx, input, output):
|
||||
args = ctx.actions.args()
|
||||
args.add("--target", "es5")
|
||||
args.add("--allowJS")
|
||||
args.add(input)
|
||||
args.add("--outFile", output)
|
||||
|
||||
ctx.actions.run(
|
||||
executable = ctx.executable._tsc,
|
||||
inputs = [input],
|
||||
outputs = [output],
|
||||
arguments = [args],
|
||||
)
|
||||
|
||||
# Borrowed from bazelbuild/rules_nodejs, with the addition of brotli compression output
|
||||
def _plain_rollup_bundle(ctx):
|
||||
rollup_config = write_rollup_config(ctx)
|
||||
run_rollup(ctx, collect_es2015_sources(ctx), rollup_config, ctx.outputs.build_es2015)
|
||||
run_terser(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es2015_min, config_name = ctx.label.name + "es2015_min")
|
||||
run_terser(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es2015_min_debug, debug = True, config_name = ctx.label.name + "es2015_min_debug")
|
||||
_run_tsc(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es5)
|
||||
source_map = run_terser(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min)
|
||||
run_terser(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min_debug, debug = True)
|
||||
umd_rollup_config = write_rollup_config(ctx, filename = "_%s_umd.rollup.conf.js", output_format = "umd")
|
||||
run_rollup(ctx, collect_es2015_sources(ctx), umd_rollup_config, ctx.outputs.build_umd)
|
||||
cjs_rollup_config = write_rollup_config(ctx, filename = "_%s_cjs.rollup.conf.js", output_format = "cjs")
|
||||
run_rollup(ctx, collect_es2015_sources(ctx), cjs_rollup_config, ctx.outputs.build_cjs)
|
||||
run_sourcemapexplorer(ctx, ctx.outputs.build_es5_min, source_map, ctx.outputs.explore_html)
|
||||
|
||||
run_brotli(ctx, ctx.outputs.build_es5_min, ctx.outputs.build_es5_min_compressed)
|
||||
files = [ctx.outputs.build_es5_min, source_map]
|
||||
return DefaultInfo(files = depset(files), runfiles = ctx.runfiles(files))
|
||||
|
||||
def _ng_rollup_bundle(ctx):
|
||||
# Escape and use the plain rollup rule if the compilation strategy requires it
|
||||
if _use_plain_rollup(ctx):
|
||||
return _plain_rollup_bundle(ctx)
|
||||
|
||||
# We don't expect anyone to make use of this bundle yet, but it makes this rule
|
||||
# compatible with rollup_bundle which allows them to be easily swapped back and
|
||||
# forth.
|
||||
esm2015_rollup_config = write_rollup_config(ctx, filename = "_%s.rollup_es2015.conf.js")
|
||||
esm2015_rollup_sourcemap = run_rollup(ctx, collect_es2015_sources(ctx), esm2015_rollup_config, ctx.outputs.build_es2015)
|
||||
|
||||
run_terser(
|
||||
ctx,
|
||||
ctx.outputs.build_es2015,
|
||||
ctx.outputs.build_es2015_min,
|
||||
config_name = ctx.label.name + "es2015_min",
|
||||
comments = False,
|
||||
in_source_map = esm2015_rollup_sourcemap,
|
||||
)
|
||||
run_terser(
|
||||
ctx,
|
||||
ctx.outputs.build_es2015,
|
||||
ctx.outputs.build_es2015_min_debug,
|
||||
config_name = ctx.label.name + "es2015_min_debug",
|
||||
debug = True,
|
||||
comments = False,
|
||||
)
|
||||
|
||||
esm5_sources = flatten_esm5(ctx)
|
||||
|
||||
rollup_config = write_rollup_config(ctx, [BO_PLUGIN], "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]))
|
||||
rollup_sourcemap = run_rollup(ctx, esm5_sources, rollup_config, ctx.outputs.build_es5)
|
||||
|
||||
sourcemap = run_terser(
|
||||
ctx,
|
||||
ctx.outputs.build_es5,
|
||||
ctx.outputs.build_es5_min,
|
||||
config_name = ctx.label.name + "es5_min",
|
||||
comments = False,
|
||||
in_source_map = rollup_sourcemap,
|
||||
)
|
||||
run_terser(
|
||||
ctx,
|
||||
ctx.outputs.build_es5,
|
||||
ctx.outputs.build_es5_min_debug,
|
||||
config_name = ctx.label.name + "es5_min_debug",
|
||||
debug = True,
|
||||
comments = False,
|
||||
)
|
||||
|
||||
umd_rollup_config = write_rollup_config(ctx, filename = "_%s_umd.rollup.conf.js", output_format = "umd")
|
||||
run_rollup(ctx, collect_es2015_sources(ctx), umd_rollup_config, ctx.outputs.build_umd)
|
||||
cjs_rollup_config = write_rollup_config(ctx, filename = "_%s_cjs.rollup.conf.js", output_format = "cjs")
|
||||
run_rollup(ctx, collect_es2015_sources(ctx), cjs_rollup_config, ctx.outputs.build_cjs)
|
||||
|
||||
run_brotli(ctx, ctx.outputs.build_es5_min, ctx.outputs.build_es5_min_compressed)
|
||||
|
||||
run_sourcemapexplorer(ctx, ctx.outputs.build_es5_min, sourcemap, ctx.outputs.explore_html)
|
||||
|
||||
return DefaultInfo(files = depset([ctx.outputs.build_es5_min, sourcemap]))
|
||||
|
||||
DEPS_ASPECTS = [esm5_outputs_aspect]
|
||||
|
||||
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
|
||||
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
|
||||
|
||||
ng_rollup_bundle = rule(
|
||||
implementation = _ng_rollup_bundle,
|
||||
attrs = dict(ROLLUP_ATTRS, **{
|
||||
"deps": attr.label_list(
|
||||
doc = """Other targets that provide JavaScript files.
|
||||
Typically this will be `ts_library` or `ng_module` targets.""",
|
||||
aspects = DEPS_ASPECTS,
|
||||
),
|
||||
"_brotli": attr.label(
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
default = Label("//tools/brotli-cli"),
|
||||
),
|
||||
"_rollup": attr.label(
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
default = Label("@angular//packages/bazel/src:rollup_with_build_optimizer"),
|
||||
),
|
||||
}),
|
||||
outputs = dict(ROLLUP_OUTPUTS, **{
|
||||
"build_es5_min_compressed": "%{name}.min.js.br",
|
||||
}),
|
||||
)
|
||||
"""
|
||||
Run [Rollup] with the [Build Optimizer] plugin.
|
||||
|
||||
This rule extends from the [rollup_bundle] rule, so attributes and outputs of
|
||||
that rule are used here too.
|
||||
|
||||
[Rollup]: https://rollupjs.org/
|
||||
[Build Optimizer]: https://www.npmjs.com/package/@angular-devkit/build-optimizer
|
||||
[rollup_bundle]: https://bazelbuild.github.io/rules_nodejs/rollup/rollup_bundle.html
|
||||
"""
|
|
@ -96,7 +96,7 @@ Hello
|
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
|
||||
typeof define === 'function' && define.amd ? define('example/secondary', ['exports', '@angular/core'], factory) :
|
||||
(global = global || self, factory((global.example = global.example || {}, global.example.secondary = {}), global.ng.core));
|
||||
}(this, function (exports, core) { 'use strict';
|
||||
}(this, (function (exports, core) { 'use strict';
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -329,7 +329,7 @@ Hello
|
|||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
})));
|
||||
//# sourceMappingURL=waffels-secondary.umd.js.map
|
||||
|
||||
|
||||
|
@ -340,7 +340,7 @@ Hello
|
|||
* (c) 2010-2019 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("example/secondary",["exports","@angular/core"],t):t(((e=e||self).example=e.example||{},e.example.secondary={}),e.ng.core)}(this,function(e,t){"use strict";
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("example/secondary",["exports","@angular/core"],t):t(((e=e||self).example=e.example||{},e.example.secondary={}),e.ng.core)}(this,(function(e,t){"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
@ -348,7 +348,7 @@ Hello
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var o=function(){return function o(e,t,n,r){var c,f=arguments.length,l=f<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(c=e[u])&&(l=(f<3?c(l):f>3?c(t,n,l):c(t,n))||l);return f>3&&l&&Object.defineProperty(t,n,l),l}([t.NgModule({})],function e(){})}();
|
||||
var o=function n(e,t,o,r){var c,f=arguments.length,l=f<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(c=e[a])&&(l=(f<3?c(l):f>3?c(t,o,l):c(t,o))||l);return f>3&&l&&Object.defineProperty(t,o,l),l}([t.NgModule({})],(function o(){}));
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
@ -356,7 +356,7 @@ var o=function(){return function o(e,t,n,r){var c,f=arguments.length,l=f<3?t:nul
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
|
||||
--- bundles/waffels.umd.js ---
|
||||
|
||||
|
@ -370,7 +370,7 @@ e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
|
||||
typeof define === 'function' && define.amd ? define('example', ['exports', '@angular/core'], factory) :
|
||||
(global = global || self, factory(global.example = {}, global.ng.core));
|
||||
}(this, function (exports, core) { 'use strict';
|
||||
}(this, (function (exports, core) { 'use strict';
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -601,7 +601,7 @@ e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
})));
|
||||
//# sourceMappingURL=waffels.umd.js.map
|
||||
|
||||
|
||||
|
@ -612,7 +612,7 @@ e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
* (c) 2010-2019 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("example",["exports","@angular/core"],t):t((e=e||self).example={},e.ng.core)}(this,function(e,t){"use strict";
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("example",["exports","@angular/core"],t):t((e=e||self).example={},e.ng.core)}(this,(function(e,t){"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
@ -620,14 +620,14 @@ e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var o=function(){return function o(e,t,n,r){var f,c=arguments.length,u=c<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var i=e.length-1;i>=0;i--)(f=e[i])&&(u=(c<3?f(u):c>3?f(t,n,u):f(t,n))||u);return c>3&&u&&Object.defineProperty(t,n,u),u}([t.NgModule({})],function e(){})}();
|
||||
var o=function n(e,t,o,r){var f,c=arguments.length,l=c<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var u=e.length-1;u>=0;u--)(f=e[u])&&(l=(c<3?f(l):c>3?f(t,o,l):f(t,o))||l);return c>3&&l&&Object.defineProperty(t,o,l),l}([t.NgModule({})],(function o(){}));
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/e.MyModule=o,Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
*/e.MyModule=o,Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
|
||||
--- esm2015/example.externs.js ---
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ License: MIT
|
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
|
||||
typeof define === 'function' && define.amd ? define('example/portal', ['exports', '@angular/core'], factory) :
|
||||
(global = global || self, factory((global.example = global.example || {}, global.example.portal = {}), global.ng.core));
|
||||
}(this, function (exports, core) { 'use strict';
|
||||
}(this, (function (exports, core) { 'use strict';
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
@ -317,7 +317,7 @@ License: MIT
|
|||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
})));
|
||||
//# sourceMappingURL=example-with-ts-library-portal.umd.js.map
|
||||
|
||||
|
||||
|
@ -328,7 +328,7 @@ License: MIT
|
|||
* (c) 2010-2019 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("example/portal",["exports","@angular/core"],t):t(((e=e||self).example=e.example||{},e.example.portal={}),e.ng.core)}(this,function(e,t){"use strict";
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("example/portal",["exports","@angular/core"],t):t(((e=e||self).example=e.example||{},e.example.portal={}),e.ng.core)}(this,(function(e,t){"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
@ -336,7 +336,7 @@ License: MIT
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var o=function(){return function o(e,t,r,n){var f,l=arguments.length,c=l<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(f=e[u])&&(c=(l<3?f(c):l>3?f(t,r,c):f(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c}([t.NgModule({})],function e(){})}();
|
||||
var o=function r(e,t,o,n){var f,l=arguments.length,c=l<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,n);else for(var a=e.length-1;a>=0;a--)(f=e[a])&&(c=(l<3?f(c):l>3?f(t,o,c):f(t,o))||c);return l>3&&c&&Object.defineProperty(t,o,c),c}([t.NgModule({})],(function o(){}));
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
@ -344,7 +344,7 @@ var o=function(){return function o(e,t,r,n){var f,l=arguments.length,c=l<3?t:nul
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
e.PortalModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
e.PortalModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
|
||||
--- bundles/example-with-ts-library-utils.umd.js ---
|
||||
|
||||
|
@ -358,7 +358,7 @@ e.PortalModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define('example/utils', ['exports'], factory) :
|
||||
(global = global || self, factory((global.example = global.example || {}, global.example.utils = {})));
|
||||
}(this, function (exports) { 'use strict';
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* @license
|
||||
|
@ -383,7 +383,7 @@ e.PortalModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
})));
|
||||
//# sourceMappingURL=example-with-ts-library-utils.umd.js.map
|
||||
|
||||
|
||||
|
@ -394,7 +394,7 @@ e.PortalModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
* (c) 2010-2019 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("example/utils",["exports"],t):t(((e=e||self).example=e.example||{},e.example.utils={}))}(this,function(e){"use strict";
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("example/utils",["exports"],t):t(((e=e||self).example=e.example||{},e.example.utils={}))}(this,(function(e){"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
@ -409,7 +409,7 @@ e.PortalModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
e.dispatchFakeEvent=function t(e,n){e.dispatchEvent(n)},Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
e.dispatchFakeEvent=function t(e,n){e.dispatchEvent(n)},Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
|
||||
--- bundles/example-with-ts-library.umd.js ---
|
||||
|
||||
|
@ -423,7 +423,7 @@ e.dispatchFakeEvent=function t(e,n){e.dispatchEvent(n)},Object.defineProperty(e,
|
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define('example', ['exports'], factory) :
|
||||
(global = global || self, factory(global.example = {}));
|
||||
}(this, function (exports) { 'use strict';
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* @license
|
||||
|
@ -438,7 +438,7 @@ e.dispatchFakeEvent=function t(e,n){e.dispatchEvent(n)},Object.defineProperty(e,
|
|||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
})));
|
||||
//# sourceMappingURL=example-with-ts-library.umd.js.map
|
||||
|
||||
|
||||
|
@ -449,14 +449,14 @@ e.dispatchFakeEvent=function t(e,n){e.dispatchEvent(n)},Object.defineProperty(e,
|
|||
* (c) 2010-2019 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("example",["exports"],t):t((e=e||self).example={})}(this,function(e){"use strict";
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("example",["exports"],t):t((e=e||self).example={})}(this,(function(e){"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/e.VERSION="0.0.0",Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
*/e.VERSION="0.0.0",Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
|
||||
--- esm2015/example.externs.js ---
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ ts_library(
|
|||
jasmine_node_test(
|
||||
name = "test",
|
||||
data = [
|
||||
":bundle",
|
||||
":bundle.js",
|
||||
":bundle.min.js",
|
||||
":bundle.min.js.br",
|
||||
":bundle.min_debug.js",
|
||||
],
|
||||
|
|
|
@ -46,8 +46,8 @@ ts_library(
|
|||
jasmine_node_test(
|
||||
name = "test",
|
||||
data = [
|
||||
":bundle",
|
||||
":bundle.js",
|
||||
":bundle.min.js",
|
||||
":bundle.min.js.br",
|
||||
":bundle.min_debug.js",
|
||||
],
|
||||
|
|
|
@ -31,6 +31,7 @@ npm_package(
|
|||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":language-service",
|
||||
"//packages/language-service/bundles: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",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
load(":rollup.bzl", "ls_rollup_bundle")
|
||||
load("//tools/ng_rollup_bundle:ng_rollup_bundle.bzl", "ls_rollup_bundle")
|
||||
|
||||
ls_rollup_bundle(
|
||||
name = "language-service",
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
"""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_DEPS_ASPECTS",
|
||||
"run_rollup",
|
||||
# "run_terser",
|
||||
"write_rollup_config",
|
||||
)
|
||||
load("//packages/bazel/src:esm5.bzl", "esm5_outputs_aspect", "esm5_root_dir", "flatten_esm5")
|
||||
|
||||
# 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",
|
||||
# min bundle is not used at the moment. Disable to speed up build
|
||||
# "build_umd_min": "%{name}.umd.min.js",
|
||||
}
|
||||
|
||||
DEPS_ASPECTS = [esm5_outputs_aspect]
|
||||
|
||||
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
|
||||
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
|
||||
|
||||
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_terser(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(
|
||||
doc = """Other targets that provide JavaScript files.
|
||||
Typically this will be `ts_library` or `ng_module` targets.""",
|
||||
aspects = DEPS_ASPECTS,
|
||||
),
|
||||
}),
|
||||
outputs = _ROLLUP_OUTPUTS,
|
||||
)
|
|
@ -5,14 +5,17 @@ load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test")
|
|||
load("@npm_bazel_karma//:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite", _ts_web_test = "ts_web_test", _ts_web_test_suite = "ts_web_test_suite")
|
||||
load("@npm_bazel_typescript//:index.bzl", _ts_library = "ts_library")
|
||||
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
|
||||
load("//packages/bazel/src:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle")
|
||||
load("//tools/ng_rollup_bundle:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle")
|
||||
load("//tools:ng_benchmark.bzl", _ng_benchmark = "ng_benchmark")
|
||||
|
||||
_DEFAULT_TSCONFIG_TEST = "//packages:tsconfig-test"
|
||||
_INTERNAL_NG_MODULE_API_EXTRACTOR = "//packages/bazel/src/api-extractor:api_extractor"
|
||||
_INTERNAL_NG_MODULE_COMPILER = "//packages/bazel/src/ngc-wrapped"
|
||||
_INTERNAL_NG_MODULE_XI18N = "//packages/bazel/src/ngc-wrapped:xi18n"
|
||||
_INTERNAL_NG_PACKAGER_PACKAGER = "//packages/bazel/src/ng_package:packager"
|
||||
_INTERNAL_NG_PACKAGE_PACKAGER = "//packages/bazel/src/ng_package:packager"
|
||||
_INTERNAL_NG_PACKAGE_DEFALUT_TERSER_CONFIG_FILE = "//packages/bazel/src/ng_package:terser_config.default.json"
|
||||
_INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP_CONFIG_TMPL = "//packages/bazel/src/ng_package:rollup.config.js"
|
||||
_INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP = "//packages/bazel/src/ng_package:rollup_for_ng_package"
|
||||
|
||||
# Packages which are versioned together on npm
|
||||
ANGULAR_SCOPED_PACKAGES = ["@angular/%s" % p for p in [
|
||||
|
@ -145,7 +148,10 @@ def ng_package(name, readme_md = None, license_banner = None, deps = [], **kwarg
|
|||
readme_md = readme_md,
|
||||
license_banner = license_banner,
|
||||
replacements = PKG_GROUP_REPLACEMENTS,
|
||||
ng_packager = _INTERNAL_NG_PACKAGER_PACKAGER,
|
||||
ng_packager = _INTERNAL_NG_PACKAGE_PACKAGER,
|
||||
terser_config_file = _INTERNAL_NG_PACKAGE_DEFALUT_TERSER_CONFIG_FILE,
|
||||
rollup_config_tmpl = _INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP_CONFIG_TMPL,
|
||||
rollup = _INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
|
||||
|
||||
exports_files(["rollup.config.js"])
|
||||
|
||||
nodejs_binary(
|
||||
name = "rollup_with_build_optimizer",
|
||||
data = [
|
||||
"@npm//@angular-devkit/build-optimizer",
|
||||
"@npm//rollup",
|
||||
"@npm//rollup-plugin-commonjs",
|
||||
"@npm//rollup-plugin-node-resolve",
|
||||
"@npm//rollup-plugin-sourcemaps",
|
||||
],
|
||||
entry_point = "@npm//:node_modules/rollup/dist/bin/rollup",
|
||||
install_source_map_support = False,
|
||||
)
|
|
@ -0,0 +1,457 @@
|
|||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
|
||||
"""Rollup with Build Optimizer
|
||||
|
||||
This provides a variant of the [rollup_bundle] rule that works better for Angular apps.
|
||||
|
||||
It registers `@angular-devkit/build-optimizer` as a rollup plugin, to get
|
||||
better optimization. It also uses ESM5 format inputs, as this is what
|
||||
build-optimizer is hard-coded to look for and transform.
|
||||
|
||||
[rollup_bundle]: https://bazelbuild.github.io/rules_nodejs/rollup/rollup_bundle.html
|
||||
"""
|
||||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "npm_package_bin")
|
||||
load("@build_bazel_rules_nodejs//:providers.bzl", "JSEcmaScriptModuleInfo", "NpmPackageInfo", "node_modules_aspect")
|
||||
load("//packages/bazel/src:esm5.bzl", "esm5_outputs_aspect", "esm5_root_dir", "flatten_esm5")
|
||||
load("@npm_bazel_terser//:index.bzl", "terser_minified")
|
||||
|
||||
_NG_ROLLUP_BUNDLE_OUTPUTS = {
|
||||
"bundle": "%{name}.js",
|
||||
"sourcemap": "%{name}.js.map",
|
||||
}
|
||||
|
||||
_NG_ROLLUP_MODULE_MAPPINGS_ATTR = "ng_rollup_module_mappings"
|
||||
|
||||
def _ng_rollup_module_mappings_aspect_impl(target, ctx):
|
||||
mappings = dict()
|
||||
for dep in ctx.rule.attr.deps:
|
||||
if hasattr(dep, _NG_ROLLUP_MODULE_MAPPINGS_ATTR):
|
||||
for k, v in getattr(dep, _NG_ROLLUP_MODULE_MAPPINGS_ATTR).items():
|
||||
if k in mappings and mappings[k] != v:
|
||||
fail(("duplicate module mapping at %s: %s maps to both %s and %s" %
|
||||
(target.label, k, mappings[k], v)), "deps")
|
||||
mappings[k] = v
|
||||
if ((hasattr(ctx.rule.attr, "module_name") and ctx.rule.attr.module_name) or
|
||||
(hasattr(ctx.rule.attr, "module_root") and ctx.rule.attr.module_root)):
|
||||
mn = ctx.rule.attr.module_name
|
||||
if not mn:
|
||||
mn = target.label.name
|
||||
mr = target.label.package
|
||||
if target.label.workspace_root:
|
||||
mr = "%s/%s" % (target.label.workspace_root, mr)
|
||||
if ctx.rule.attr.module_root and ctx.rule.attr.module_root != ".":
|
||||
if ctx.rule.attr.module_root.endswith(".ts"):
|
||||
# This is the type-checking module mapping. Strip the trailing .d.ts
|
||||
# as it doesn't belong in TypeScript's path mapping.
|
||||
mr = "%s/%s" % (mr, ctx.rule.attr.module_root.replace(".d.ts", ""))
|
||||
else:
|
||||
mr = "%s/%s" % (mr, ctx.rule.attr.module_root)
|
||||
if mn in mappings and mappings[mn] != mr:
|
||||
fail(("duplicate module mapping at %s: %s maps to both %s and %s" %
|
||||
(target.label, mn, mappings[mn], mr)), "deps")
|
||||
mappings[mn] = mr
|
||||
return struct(ng_rollup_module_mappings = mappings)
|
||||
|
||||
ng_rollup_module_mappings_aspect = aspect(
|
||||
_ng_rollup_module_mappings_aspect_impl,
|
||||
attr_aspects = ["deps"],
|
||||
)
|
||||
|
||||
_NG_ROLLUP_BUNDLE_DEPS_ASPECTS = [esm5_outputs_aspect, ng_rollup_module_mappings_aspect, node_modules_aspect]
|
||||
|
||||
_NG_ROLLUP_BUNDLE_ATTRS = {
|
||||
"build_optimizer": attr.bool(
|
||||
doc = """Use build optimizer plugin
|
||||
|
||||
Only used if sources are esm5 which depends on value of esm5_sources.""",
|
||||
default = True,
|
||||
),
|
||||
"esm5_sources": attr.bool(
|
||||
doc = """Use esm5 input sources""",
|
||||
default = True,
|
||||
),
|
||||
"srcs": attr.label_list(
|
||||
doc = """JavaScript source files from the workspace.
|
||||
These can use ES2015 syntax and ES Modules (import/export)""",
|
||||
allow_files = True,
|
||||
),
|
||||
"entry_point": attr.label(
|
||||
doc = """The starting point of the application, passed as the `--input` flag to rollup.
|
||||
|
||||
If the entry JavaScript file belongs to the same package (as the BUILD file),
|
||||
you can simply reference it by its relative name to the package directory:
|
||||
|
||||
```
|
||||
ng_rollup_bundle(
|
||||
name = "bundle",
|
||||
entry_point = ":main.js",
|
||||
)
|
||||
```
|
||||
|
||||
You can specify the entry point as a typescript file so long as you also include
|
||||
the ts_library target in deps:
|
||||
|
||||
```
|
||||
ts_library(
|
||||
name = "main",
|
||||
srcs = ["main.ts"],
|
||||
)
|
||||
|
||||
ng_rollup_bundle(
|
||||
name = "bundle",
|
||||
deps = [":main"]
|
||||
entry_point = ":main.ts",
|
||||
)
|
||||
```
|
||||
|
||||
The rule will use the corresponding `.js` output of the ts_library rule as the entry point.
|
||||
|
||||
If the entry point target is a rule, it should produce a single JavaScript entry file that will be passed to the nodejs_binary rule.
|
||||
For example:
|
||||
|
||||
```
|
||||
filegroup(
|
||||
name = "entry_file",
|
||||
srcs = ["main.js"],
|
||||
)
|
||||
|
||||
ng_rollup_bundle(
|
||||
name = "bundle",
|
||||
entry_point = ":entry_file",
|
||||
)
|
||||
```
|
||||
""",
|
||||
mandatory = True,
|
||||
allow_single_file = True,
|
||||
),
|
||||
"deps": attr.label_list(
|
||||
doc = """Other targets that provide JavaScript files.
|
||||
Typically this will be `ts_library` or `ng_module` targets.""",
|
||||
aspects = _NG_ROLLUP_BUNDLE_DEPS_ASPECTS,
|
||||
),
|
||||
"format": attr.string(
|
||||
doc = """"Specifies the format of the generated bundle. One of the following:
|
||||
|
||||
- `amd`: Asynchronous Module Definition, used with module loaders like RequireJS
|
||||
- `cjs`: CommonJS, suitable for Node and other bundlers
|
||||
- `esm`: Keep the bundle as an ES module file, suitable for other bundlers and inclusion as a `<script type=module>` tag in modern browsers
|
||||
- `iife`: A self-executing function, suitable for inclusion as a `<script>` tag. (If you want to create a bundle for your application, you probably want to use this.)
|
||||
- `umd`: Universal Module Definition, works as amd, cjs and iife all in one
|
||||
- `system`: Native format of the SystemJS loader
|
||||
""",
|
||||
values = ["amd", "cjs", "esm", "iife", "umd", "system"],
|
||||
default = "esm",
|
||||
),
|
||||
"global_name": attr.string(
|
||||
doc = """A name given to this package when referenced as a global variable.
|
||||
This name appears in the bundle module incantation at the beginning of the file,
|
||||
and governs the global symbol added to the global context (e.g. `window`) as a side-
|
||||
effect of loading the UMD/IIFE JS bundle.
|
||||
|
||||
Rollup doc: "The variable name, representing your iife/umd bundle, by which other scripts on the same page can access it."
|
||||
|
||||
This is passed to the `output.name` setting in Rollup.""",
|
||||
),
|
||||
"globals": attr.string_dict(
|
||||
doc = """A dict of symbols that reference external scripts.
|
||||
The keys are variable names that appear in the program,
|
||||
and the values are the symbol to reference at runtime in a global context (UMD bundles).
|
||||
For example, a program referencing @angular/core should use ng.core
|
||||
as the global reference, so Angular users should include the mapping
|
||||
`"@angular/core":"ng.core"` in the globals.""",
|
||||
default = {},
|
||||
),
|
||||
"license_banner": attr.label(
|
||||
doc = """A .txt file passed to the `banner` config option of rollup.
|
||||
The contents of the file will be copied to the top of the resulting bundles.
|
||||
Note that you can replace a version placeholder in the license file, by using
|
||||
the special version `0.0.0-PLACEHOLDER`. See the section on stamping in the README.""",
|
||||
allow_single_file = [".txt"],
|
||||
),
|
||||
"_rollup": attr.label(
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
default = Label("//tools/ng_rollup_bundle:rollup_with_build_optimizer"),
|
||||
),
|
||||
"_rollup_config_tmpl": attr.label(
|
||||
default = Label("//tools/ng_rollup_bundle:rollup.config.js"),
|
||||
allow_single_file = True,
|
||||
),
|
||||
}
|
||||
|
||||
def _compute_node_modules_root(ctx):
|
||||
"""Computes the node_modules root from the node_modules and deps attributes.
|
||||
|
||||
Args:
|
||||
ctx: the skylark execution context
|
||||
|
||||
Returns:
|
||||
The node_modules root as a string
|
||||
"""
|
||||
node_modules_root = None
|
||||
for d in ctx.attr.deps:
|
||||
if NpmPackageInfo in d:
|
||||
possible_root = "/".join(["external", d[NpmPackageInfo].workspace, "node_modules"])
|
||||
if not node_modules_root:
|
||||
node_modules_root = possible_root
|
||||
elif node_modules_root != possible_root:
|
||||
fail("All npm dependencies need to come from a single workspace. Found '%s' and '%s'." % (node_modules_root, possible_root))
|
||||
if not node_modules_root:
|
||||
# there are no fine grained deps but we still need a node_modules_root even if its empty
|
||||
node_modules_root = "external/npm/node_modules"
|
||||
return node_modules_root
|
||||
|
||||
# Avoid using non-normalized paths (workspace/../other_workspace/path)
|
||||
def _to_manifest_path(ctx, file):
|
||||
if file.short_path.startswith("../"):
|
||||
return file.short_path[3:]
|
||||
else:
|
||||
return ctx.workspace_name + "/" + file.short_path
|
||||
|
||||
# Expand entry_point into runfiles and strip the file extension
|
||||
def _esm5_entry_point_path(ctx):
|
||||
return _to_manifest_path(ctx, ctx.file.entry_point)[:-(len(ctx.file.entry_point.extension) + 1)]
|
||||
|
||||
def _no_ext(f):
|
||||
return f.short_path[:-len(f.extension) - 1]
|
||||
|
||||
def _resolve_js_input(f, inputs):
|
||||
if f.extension == "js" or f.extension == "mjs":
|
||||
return f
|
||||
|
||||
# look for corresponding js file in inputs
|
||||
no_ext = _no_ext(f)
|
||||
for i in inputs:
|
||||
if i.extension == "js" or i.extension == "mjs":
|
||||
if _no_ext(i) == no_ext:
|
||||
return i
|
||||
fail("Could not find corresponding javascript entry point for %s. Add the %s.js to your deps." % (f.path, no_ext))
|
||||
|
||||
def _write_rollup_config(ctx, root_dir, build_optimizer, filename = "_%s.rollup.conf.js"):
|
||||
"""Generate a rollup config file.
|
||||
|
||||
Args:
|
||||
ctx: Bazel rule execution context
|
||||
root_dir: root directory for module resolution
|
||||
build_optimizer: whether to enable Build Optimizer plugin
|
||||
filename: output filename pattern (defaults to `_%s.rollup.conf.js`)
|
||||
|
||||
Returns:
|
||||
The rollup config file. See https://rollupjs.org/guide/en#configuration-files
|
||||
"""
|
||||
config = ctx.actions.declare_file(filename % ctx.label.name)
|
||||
|
||||
mappings = dict()
|
||||
all_deps = ctx.attr.deps + ctx.attr.srcs
|
||||
for dep in all_deps:
|
||||
if hasattr(dep, _NG_ROLLUP_MODULE_MAPPINGS_ATTR):
|
||||
for k, v in getattr(dep, _NG_ROLLUP_MODULE_MAPPINGS_ATTR).items():
|
||||
if k in mappings and mappings[k] != v:
|
||||
fail(("duplicate module mapping at %s: %s maps to both %s and %s" %
|
||||
(dep.label, k, mappings[k], v)), "deps")
|
||||
mappings[k] = v
|
||||
|
||||
ctx.actions.expand_template(
|
||||
output = config,
|
||||
template = ctx.file._rollup_config_tmpl,
|
||||
substitutions = {
|
||||
"TMPL_banner_file": "\"%s\"" % ctx.file.license_banner.path if ctx.file.license_banner else "undefined",
|
||||
"TMPL_build_optimizer": "true" if build_optimizer else "false",
|
||||
"TMPL_module_mappings": str(mappings),
|
||||
"TMPL_node_modules_root": _compute_node_modules_root(ctx),
|
||||
"TMPL_root_dir": root_dir,
|
||||
"TMPL_stamp_data": "\"%s\"" % ctx.version_file.path if ctx.version_file else "undefined",
|
||||
"TMPL_workspace_name": ctx.workspace_name,
|
||||
},
|
||||
)
|
||||
|
||||
return config
|
||||
|
||||
def _filter_js_inputs(all_inputs):
|
||||
all_inputs_list = all_inputs.to_list() if type(all_inputs) == type(depset()) else all_inputs
|
||||
return [
|
||||
f
|
||||
for f in all_inputs_list
|
||||
if f.path.endswith(".js") or f.path.endswith(".mjs") or f.path.endswith(".json")
|
||||
]
|
||||
|
||||
def _run_rollup(ctx, entry_point_path, sources, config):
|
||||
args = ctx.actions.args()
|
||||
args.add("--config", config.path)
|
||||
args.add("--input", entry_point_path)
|
||||
args.add("--output.file", ctx.outputs.bundle)
|
||||
args.add("--output.name", ctx.attr.global_name if ctx.attr.global_name else ctx.label.name)
|
||||
args.add("--output.format", ctx.attr.format)
|
||||
args.add("--output.sourcemap")
|
||||
args.add("--output.sourcemapFile", ctx.outputs.sourcemap)
|
||||
|
||||
# We will produce errors as needed. Anything else is spammy: a well-behaved
|
||||
# bazel rule prints nothing on success.
|
||||
args.add("--silent")
|
||||
|
||||
args.add("--preserveSymlinks")
|
||||
|
||||
if ctx.attr.globals:
|
||||
args.add("--external")
|
||||
args.add_joined(ctx.attr.globals.keys(), join_with = ",")
|
||||
args.add("--globals")
|
||||
args.add_joined(["%s:%s" % g for g in ctx.attr.globals.items()], join_with = ",")
|
||||
|
||||
direct_inputs = [config]
|
||||
|
||||
# Also include files from npm fine grained deps as inputs.
|
||||
# These deps are identified by the NpmPackageInfo provider.
|
||||
for d in ctx.attr.deps:
|
||||
if NpmPackageInfo in d:
|
||||
# Note: we can't avoid calling .to_list() on sources
|
||||
direct_inputs.extend(_filter_js_inputs(d[NpmPackageInfo].sources.to_list()))
|
||||
|
||||
if ctx.file.license_banner:
|
||||
direct_inputs.append(ctx.file.license_banner)
|
||||
if ctx.version_file:
|
||||
direct_inputs.append(ctx.version_file)
|
||||
|
||||
ctx.actions.run(
|
||||
progress_message = "Bundling JavaScript %s [rollup]" % ctx.outputs.bundle.short_path,
|
||||
executable = ctx.executable._rollup,
|
||||
inputs = depset(direct_inputs, transitive = [sources]),
|
||||
outputs = [ctx.outputs.bundle, ctx.outputs.sourcemap],
|
||||
arguments = [args],
|
||||
)
|
||||
|
||||
def _ng_rollup_bundle_impl(ctx):
|
||||
if ctx.attr.esm5_sources:
|
||||
# Use esm5 sources and build optimzier if ctx.attr.build_optimizer is set
|
||||
rollup_config = _write_rollup_config(ctx, build_optimizer = ctx.attr.build_optimizer, root_dir = "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]))
|
||||
_run_rollup(ctx, _esm5_entry_point_path(ctx), flatten_esm5(ctx), rollup_config)
|
||||
else:
|
||||
# Use esm2015 sources and no build optimzier
|
||||
rollup_config = _write_rollup_config(ctx, build_optimizer = False, root_dir = ctx.bin_dir.path)
|
||||
esm2015_files_depsets = []
|
||||
for dep in ctx.attr.deps:
|
||||
if JSEcmaScriptModuleInfo in dep:
|
||||
esm2015_files_depsets.append(dep[JSEcmaScriptModuleInfo].sources)
|
||||
esm2015_files = depset(transitive = esm2015_files_depsets)
|
||||
entry_point_path = _to_manifest_path(ctx, _resolve_js_input(ctx.file.entry_point, esm2015_files.to_list()))
|
||||
_run_rollup(ctx, entry_point_path, esm2015_files, rollup_config)
|
||||
|
||||
return DefaultInfo(files = depset([ctx.outputs.bundle, ctx.outputs.sourcemap]))
|
||||
|
||||
_ng_rollup_bundle = rule(
|
||||
implementation = _ng_rollup_bundle_impl,
|
||||
attrs = _NG_ROLLUP_BUNDLE_ATTRS,
|
||||
outputs = _NG_ROLLUP_BUNDLE_OUTPUTS,
|
||||
)
|
||||
"""
|
||||
Run [Rollup] with the [Build Optimizer] plugin and use esm5 inputs.
|
||||
|
||||
[Rollup]: https://rollupjs.org/
|
||||
[Build Optimizer]: https://www.npmjs.com/package/@angular-devkit/build-optimizer
|
||||
"""
|
||||
|
||||
def ng_rollup_bundle(name, **kwargs):
|
||||
"""Rollup with Build Optimizer on esm5 inputs.
|
||||
|
||||
This provides a variant of the [legacy rollup_bundle] rule that works better for Angular apps.
|
||||
|
||||
Runs [rollup], [terser_minified] and [brotli] to produce a number of output bundles.
|
||||
|
||||
es5 : "%{name}.js"
|
||||
es5 minified : "%{name}.min.js"
|
||||
es5 minified (compressed) : "%{name}.min.js.br",
|
||||
es5 minified (debug) : "%{name}.min_debug.js"
|
||||
es2015 : "%{name}.es2015.js"
|
||||
es2015 minified : "%{name}.min.es2015.js"
|
||||
es2015 minified (compressed) : "%{name}.min.js.es2015.br",
|
||||
es2015 minified (debug) : "%{name}.min_debug.es2015.js"
|
||||
|
||||
It registers `@angular-devkit/build-optimizer` as a rollup plugin, to get
|
||||
better optimization. It also uses ESM5 format inputs, as this is what
|
||||
build-optimizer is hard-coded to look for and transform.
|
||||
|
||||
[legacy rollup_bundle]: https://github.com/bazelbuild/rules_nodejs/blob/0.38.3/internal/rollup/rollup_bundle.bzl
|
||||
[rollup]: https://rollupjs.org/guide/en/
|
||||
[terser_minified]: https://bazelbuild.github.io/rules_nodejs/Terser.html
|
||||
[brotli]: https://brotli.org/
|
||||
"""
|
||||
format = kwargs.pop("format", "iife")
|
||||
build_optimizer = kwargs.pop("build_optimizer", True)
|
||||
visibility = kwargs.pop("visibility", None)
|
||||
|
||||
# TODO(gregmagolan): reduce this macro to just use the new @bazel/rollup rollup_bundle
|
||||
# once esm5 inputs are no longer needed. _ng_rollup_bundle is just here for esm5 support
|
||||
# and once that requirement is removed for Angular 10 then there is nothing that rule is doing
|
||||
# that the new @bazel/rollup rollup_bundle rule can't do.
|
||||
_ng_rollup_bundle(
|
||||
name = name,
|
||||
build_optimizer = build_optimizer,
|
||||
format = format,
|
||||
visibility = visibility,
|
||||
**kwargs
|
||||
)
|
||||
terser_minified(name = name + ".min", src = name + "", sourcemap = False, visibility = visibility)
|
||||
native.filegroup(name = name + ".min.js", srcs = [name + ".min"], visibility = visibility)
|
||||
terser_minified(name = name + ".min_debug", src = name + "", sourcemap = False, debug = True, visibility = visibility)
|
||||
native.filegroup(name = name + ".min_debug.js", srcs = [name + ".min_debug"], visibility = visibility)
|
||||
npm_package_bin(
|
||||
name = "_%s_brotli" % name,
|
||||
tool = "//tools/brotli-cli",
|
||||
data = [name + ".min.js"],
|
||||
outs = [name + ".min.js.br"],
|
||||
args = [
|
||||
"--output=$(location %s.min.js.br)" % name,
|
||||
"$(location %s.min.js)" % name,
|
||||
],
|
||||
visibility = visibility,
|
||||
)
|
||||
|
||||
_ng_rollup_bundle(
|
||||
name = name + ".es2015",
|
||||
esm5_sources = False,
|
||||
format = format,
|
||||
visibility = visibility,
|
||||
**kwargs
|
||||
)
|
||||
terser_minified(name = name + ".min.es2015", src = name + "", sourcemap = False, visibility = visibility)
|
||||
native.filegroup(name = name + ".min.es2015.js", srcs = [name + ".min.es2015"], visibility = visibility)
|
||||
terser_minified(name = name + ".min_debug.es2015", src = name + "", sourcemap = False, debug = True, visibility = visibility)
|
||||
native.filegroup(name = name + ".min_debug.es2015.js", srcs = [name + ".min_debug.es2015"], visibility = visibility)
|
||||
npm_package_bin(
|
||||
name = "_%s_es2015_brotli" % name,
|
||||
tool = "//tools/brotli-cli",
|
||||
data = [name + ".min.es2015.js"],
|
||||
outs = [name + ".min.es2015.js.br"],
|
||||
args = [
|
||||
"--output=$(location %s.min.es2015.js.br)" % name,
|
||||
"$(location %s.min.es2015.js)" % name,
|
||||
],
|
||||
visibility = visibility,
|
||||
)
|
||||
|
||||
def ls_rollup_bundle(name, **kwargs):
|
||||
"""A variant of ng_rollup_bundle for the language-service bundle
|
||||
|
||||
ls_rollup_bundle uses esm5 inputs, outputs AMD and does not use the build optimizer.
|
||||
"""
|
||||
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,
|
||||
)
|
|
@ -0,0 +1,182 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
// Rollup configuration
|
||||
// GENERATED BY Bazel
|
||||
|
||||
const buildOptimizer = require(
|
||||
'npm/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/rollup-plugin.js');
|
||||
const nodeResolve = require('rollup-plugin-node-resolve');
|
||||
const sourcemaps = require('rollup-plugin-sourcemaps');
|
||||
const commonjs = require('rollup-plugin-commonjs');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
function log_verbose(...m) {
|
||||
// This is a template file so we use __filename to output the actual filename
|
||||
if (!!process.env['VERBOSE_LOGS']) console.error(`[${path.basename(__filename)}]`, ...m);
|
||||
}
|
||||
|
||||
const workspaceName = 'TMPL_workspace_name';
|
||||
const useBuildOptimzier = TMPL_build_optimizer;
|
||||
const rootDir = 'TMPL_root_dir';
|
||||
const bannerFile = TMPL_banner_file;
|
||||
const stampData = TMPL_stamp_data;
|
||||
const moduleMappings = TMPL_module_mappings;
|
||||
const nodeModulesRoot = 'TMPL_node_modules_root';
|
||||
|
||||
log_verbose(`running with
|
||||
cwd: ${process.cwd()}
|
||||
workspaceName: ${workspaceName}
|
||||
useBuildOptimzier: ${useBuildOptimzier}
|
||||
rootDir: ${rootDir}
|
||||
bannerFile: ${bannerFile}
|
||||
stampData: ${stampData}
|
||||
moduleMappings: ${JSON.stringify(moduleMappings)}
|
||||
nodeModulesRoot: ${nodeModulesRoot}
|
||||
`);
|
||||
|
||||
function fileExists(filePath) {
|
||||
try {
|
||||
return fs.statSync(filePath).isFile();
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This resolver mimics the TypeScript Path Mapping feature, which lets us resolve
|
||||
// modules based on a mapping of short names to paths.
|
||||
function resolveBazel(
|
||||
importee, importer, baseDir = process.cwd(), resolve = require.resolve, root = rootDir) {
|
||||
log_verbose(`resolving '${importee}' from ${importer}`);
|
||||
|
||||
function resolveInRootDir(importee) {
|
||||
var candidate = path.join(baseDir, root, importee);
|
||||
log_verbose(`try to resolve '${importee}' at '${candidate}'`);
|
||||
try {
|
||||
var result = resolve(candidate);
|
||||
return result;
|
||||
} catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// Since mappings are always in POSIX paths, when comparing the importee to mappings
|
||||
// we should normalize the importee.
|
||||
// Having it normalized is also useful to determine relative paths.
|
||||
const normalizedImportee = importee.replace(/\\/g, '/');
|
||||
|
||||
// If import is fully qualified then resolve it directly
|
||||
if (fileExists(importee)) {
|
||||
log_verbose(`resolved fully qualified '${importee}'`);
|
||||
return importee;
|
||||
}
|
||||
|
||||
var resolved;
|
||||
if (normalizedImportee.startsWith('./') || normalizedImportee.startsWith('../')) {
|
||||
// relative import
|
||||
if (importer) {
|
||||
let importerRootRelative = path.dirname(importer);
|
||||
const relative = path.relative(path.join(baseDir, root), importerRootRelative);
|
||||
if (!relative.startsWith('.')) {
|
||||
importerRootRelative = relative;
|
||||
}
|
||||
resolved = path.join(importerRootRelative, importee);
|
||||
} else {
|
||||
throw new Error('cannot resolve relative paths without an importer');
|
||||
}
|
||||
if (resolved) resolved = resolveInRootDir(resolved);
|
||||
}
|
||||
|
||||
if (!resolved) {
|
||||
// possible workspace import or external import if importee matches a module
|
||||
// mapping
|
||||
for (const k in moduleMappings) {
|
||||
if (normalizedImportee == k || normalizedImportee.startsWith(k + '/')) {
|
||||
// replace the root module name on a mappings match
|
||||
// note that the module_root attribute is intended to be used for type-checking
|
||||
// so it uses eg. "index.d.ts". At runtime, we have only index.js, so we strip the
|
||||
// .d.ts suffix and let node require.resolve do its thing.
|
||||
var v = moduleMappings[k].replace(/\.d\.ts$/, '');
|
||||
const mappedImportee = path.join(v, normalizedImportee.slice(k.length + 1));
|
||||
log_verbose(`module mapped '${importee}' to '${mappedImportee}'`);
|
||||
resolved = resolveInRootDir(mappedImportee);
|
||||
if (resolved) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!resolved) {
|
||||
// workspace import
|
||||
const userWorkspacePath = path.relative(workspaceName, importee);
|
||||
resolved = resolveInRootDir(userWorkspacePath.startsWith('..') ? importee : userWorkspacePath);
|
||||
}
|
||||
|
||||
if (resolved) {
|
||||
log_verbose(`resolved to ${resolved}`);
|
||||
} else {
|
||||
log_verbose(`allowing rollup to resolve '${importee}' with node module resolution`);
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
let plugins = [
|
||||
{
|
||||
name: 'resolveBazel',
|
||||
resolveId: resolveBazel,
|
||||
},
|
||||
nodeResolve({
|
||||
// We make mainFields match what was the default for plugin-node-resolve <4.2.0
|
||||
// when mainFields was introduced. Resolving to 'browser' or 'es2015' first breaks
|
||||
// some of the benchmarks such as `//modules/benchmarks/src/expanding_rows:perf_chromium-local`.
|
||||
// See https://app.circleci.com/jobs/github/angular/angular/507444 &&
|
||||
// https://app.circleci.com/jobs/github/angular/angular/507442 for affected tests.
|
||||
mainFields: ['module', 'main'],
|
||||
jail: process.cwd(),
|
||||
customResolveOptions: {moduleDirectory: nodeModulesRoot}
|
||||
}),
|
||||
commonjs({ignoreGlobal: true}),
|
||||
sourcemaps(),
|
||||
];
|
||||
|
||||
if (useBuildOptimzier) {
|
||||
plugins = [
|
||||
buildOptimizer.default({
|
||||
sideEffectFreeModules: [
|
||||
'.esm5/packages/core/src',
|
||||
'.esm5/packages/common/src',
|
||||
'.esm5/packages/compiler/src',
|
||||
'.esm5/packages/platform-browser/src',
|
||||
]
|
||||
}),
|
||||
].concat(plugins);
|
||||
}
|
||||
|
||||
let banner = '';
|
||||
if (bannerFile) {
|
||||
banner = fs.readFileSync(bannerFile, {encoding: 'utf-8'});
|
||||
if (stampData) {
|
||||
const versionTag = fs.readFileSync(stampData, {encoding: 'utf-8'})
|
||||
.split('\n')
|
||||
.find(s => s.startsWith('BUILD_SCM_VERSION'));
|
||||
// Don't assume BUILD_SCM_VERSION exists
|
||||
if (versionTag) {
|
||||
const version = versionTag.split(' ')[1].trim();
|
||||
banner = banner.replace(/0.0.0-PLACEHOLDER/, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const config = {
|
||||
plugins,
|
||||
output: {
|
||||
banner,
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = config;
|
331
yarn.lock
331
yarn.lock
|
@ -315,6 +315,11 @@
|
|||
dependencies:
|
||||
protractor "^5.4.2"
|
||||
|
||||
"@bazel/terser@0.39.1":
|
||||
version "0.39.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-0.39.1.tgz#fa8ad78502d6e953a953dc6ef4e135e6a50aaf3e"
|
||||
integrity sha512-YIfs7uoEQU2xnpfY3bF7GjCaaHTE6e5gUIy0Ua9V1qeLZECUmVQgIfmSEV/JTykzIQpO+l3dX3IcIzkYZGlF/A==
|
||||
|
||||
"@bazel/typescript@0.39.1":
|
||||
version "0.39.1"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.39.1.tgz#fbe3f9e287aa294935987bbbd9f2dce5341a9b02"
|
||||
|
@ -325,37 +330,6 @@
|
|||
source-map-support "0.5.9"
|
||||
tsutils "2.27.2"
|
||||
|
||||
"@buxlabs/amd-to-es6@^0.12.0":
|
||||
version "0.12.5"
|
||||
resolved "https://registry.yarnpkg.com/@buxlabs/amd-to-es6/-/amd-to-es6-0.12.5.tgz#18c12479512ae09106fc6f60ad1b4b9eb8e8eb62"
|
||||
integrity sha512-RaZQrUhSl+IPIn3tBdMlDAb20jcWcBGQpnmUth9Jf9Bx1c7zGPQAxTzuag5UBLGBEBAKGr5fxvwGGdF+C/mDjQ==
|
||||
dependencies:
|
||||
"@buxlabs/ast" "^0.9.5"
|
||||
"@buxlabs/utils" "^2.2.2"
|
||||
array-uniq "^1.0.3"
|
||||
commander "^2.13.0"
|
||||
glob "^7.1.2"
|
||||
mkdirp "^0.5.1"
|
||||
|
||||
"@buxlabs/ast@^0.9.5":
|
||||
version "0.9.6"
|
||||
resolved "https://registry.yarnpkg.com/@buxlabs/ast/-/ast-0.9.6.tgz#e7a14d3fae74cd3d0530fd2cf39afc09272707e7"
|
||||
integrity sha512-1fKAxOU/c3uLa0mQL2jrNqv0QkcMJMnDfze/N5HeIh3DWtl9Q8PfOskuGa+zZb/EZEwLLNACmHbIUTvfM0Ogsw==
|
||||
dependencies:
|
||||
comparify "^0.2.0"
|
||||
escodegen "^1.9.0"
|
||||
espree "^3.5.1"
|
||||
esquery "^1.0.0"
|
||||
estemplate "^0.5.1"
|
||||
estraverse "^4.2.0"
|
||||
prettier "^1.7.4"
|
||||
to-ast "^1.0.0"
|
||||
|
||||
"@buxlabs/utils@^2.2.2":
|
||||
version "2.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@buxlabs/utils/-/utils-2.3.4.tgz#32a3102e5875c4b0f34cac89ec403748b1759249"
|
||||
integrity sha512-XtGxRNCQFf0Ed5aXSsjJWdZfs8o4eFBNqtXyFvyiAQ/8/W+YfkTAgwbBUHECSd4qOxgOXI5iQcYDn21rEN7TMw==
|
||||
|
||||
"@google-cloud/common@^0.17.0":
|
||||
version "0.17.0"
|
||||
resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-0.17.0.tgz#8ef558750db481fc10a13757a49479ab9a1c8c07"
|
||||
|
@ -650,7 +624,7 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/diff/-/diff-3.5.3.tgz#7c6c3721ba454d838790100faf7957116ee7deab"
|
||||
integrity sha512-YrLagYnL+tfrgM7bQ5yW34pi5cg9pmh5Gbq2Lmuuh+zh0ZjmK2fU3896PtlpJT3IDG2rdkoG30biHJepgIsMnw==
|
||||
|
||||
"@types/estree@0.0.39":
|
||||
"@types/estree@*", "@types/estree@0.0.39":
|
||||
version "0.0.39"
|
||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
|
||||
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==
|
||||
|
@ -968,43 +942,26 @@ accepts@~1.3.0, accepts@~1.3.4, accepts@~1.3.5:
|
|||
mime-types "~2.1.18"
|
||||
negotiator "0.6.1"
|
||||
|
||||
acorn-jsx@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b"
|
||||
integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=
|
||||
dependencies:
|
||||
acorn "^3.0.4"
|
||||
|
||||
acorn@^1.0.3:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-1.2.2.tgz#c8ce27de0acc76d896d2b1fad3df588d9e82f014"
|
||||
integrity sha1-yM4n3grMdtiW0rH6099YjZ6C8BQ=
|
||||
|
||||
acorn@^3.0.4:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
|
||||
integrity sha1-ReN/s56No/JbruP/U2niu18iAXo=
|
||||
|
||||
acorn@^5.2.1:
|
||||
version "5.7.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8"
|
||||
integrity sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==
|
||||
|
||||
acorn@^5.5.0:
|
||||
version "5.7.3"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279"
|
||||
integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==
|
||||
|
||||
acorn@^6.0.5:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.0.5.tgz#81730c0815f3f3b34d8efa95cb7430965f4d887a"
|
||||
integrity sha512-i33Zgp3XWtmZBMNvCr4azvOFeWVw1Rk6p3hfi3LUDvIFraOMywb1kAtrbi+med14m4Xfpqm3zRZMT+c0FNE7kg==
|
||||
|
||||
acorn@^6.1.1:
|
||||
version "6.1.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f"
|
||||
integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==
|
||||
|
||||
acorn@^7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
|
||||
integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==
|
||||
|
||||
add-stream@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa"
|
||||
|
@ -1516,11 +1473,6 @@ ast-types@0.9.6:
|
|||
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9"
|
||||
integrity sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=
|
||||
|
||||
ast-types@^0.7.2:
|
||||
version "0.7.8"
|
||||
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.7.8.tgz#902d2e0d60d071bdcd46dc115e1809ed11c138a9"
|
||||
integrity sha1-kC0uDWDQcb3NRtwRXhgJ7RHBOKk=
|
||||
|
||||
async-each@^1.0.0, async-each@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
|
||||
|
@ -2011,11 +1963,6 @@ builtin-modules@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
|
||||
integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=
|
||||
|
||||
builtin-modules@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.0.0.tgz#1e587d44b006620d90286cc7a9238bbc6129cab1"
|
||||
integrity sha512-hMIeU4K2ilbXV6Uv93ZZ0Avg/M91RaKXucQ+4me2Do1txxBDyDZWCBa5bJSLqoNTRpXTLwEzIk1KmloenDDjhg==
|
||||
|
||||
builtin-modules@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
|
||||
|
@ -2619,21 +2566,26 @@ commander@2.9.0:
|
|||
dependencies:
|
||||
graceful-readlink ">= 1.0.0"
|
||||
|
||||
commander@^2.13.0, commander@^2.7.1, commander@^2.8.1, commander@~2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
||||
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
|
||||
|
||||
commander@^2.19.0:
|
||||
version "2.20.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
|
||||
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
|
||||
|
||||
commander@^2.20.0:
|
||||
version "2.20.3"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
|
||||
|
||||
commander@^2.5.0, commander@^2.9.0:
|
||||
version "2.16.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50"
|
||||
integrity sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==
|
||||
|
||||
commander@^2.7.1, commander@^2.8.1, commander@~2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
||||
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
|
||||
|
||||
commondir@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/commondir/-/commondir-0.0.1.tgz#89f00fdcd51b519c578733fec563e6a6da7f5be2"
|
||||
|
@ -2669,11 +2621,6 @@ compare-semver@^1.0.0:
|
|||
dependencies:
|
||||
semver "^5.0.1"
|
||||
|
||||
comparify@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/comparify/-/comparify-0.2.0.tgz#c1fd6aa1e1df222bbf10b0bbf17198397e70c66d"
|
||||
integrity sha1-wf1qoeHfIiu/ELC78XGYOX5wxm0=
|
||||
|
||||
component-bind@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1"
|
||||
|
@ -3377,11 +3324,6 @@ deep-extend@^0.6.0:
|
|||
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
|
||||
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
|
||||
|
||||
deep-is@~0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
||||
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
|
||||
|
||||
deepcopy@0.6.3:
|
||||
version "0.6.3"
|
||||
resolved "https://registry.yarnpkg.com/deepcopy/-/deepcopy-0.6.3.tgz#634780f2f8656ab771af8fa8431ed1ccee55c7b0"
|
||||
|
@ -3915,75 +3857,35 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
|
|||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
||||
|
||||
escodegen@^1.9.0:
|
||||
version "1.11.1"
|
||||
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510"
|
||||
integrity sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw==
|
||||
dependencies:
|
||||
esprima "^3.1.3"
|
||||
estraverse "^4.2.0"
|
||||
esutils "^2.0.2"
|
||||
optionator "^0.8.1"
|
||||
optionalDependencies:
|
||||
source-map "~0.6.1"
|
||||
|
||||
espree@^3.5.1:
|
||||
version "3.5.4"
|
||||
resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7"
|
||||
integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==
|
||||
dependencies:
|
||||
acorn "^5.5.0"
|
||||
acorn-jsx "^3.0.0"
|
||||
|
||||
esprima-fb@8001.1001.0-dev-harmony-fb:
|
||||
version "8001.1001.0-dev-harmony-fb"
|
||||
resolved "https://registry.yarnpkg.com/esprima-fb/-/esprima-fb-8001.1001.0-dev-harmony-fb.tgz#c3190b05341d45643e093af70485ab4988e34d5e"
|
||||
integrity sha1-wxkLBTQdRWQ+CTr3BIWrSYjjTV4=
|
||||
|
||||
esprima@^2.1.0, esprima@^2.5.0, esprima@^2.7.2:
|
||||
esprima@^2.5.0:
|
||||
version "2.7.3"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
|
||||
integrity sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=
|
||||
|
||||
esprima@^3.1.3, esprima@~3.1.0:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
|
||||
integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=
|
||||
|
||||
esprima@~1.2.2:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.2.5.tgz#0993502feaf668138325756f30f9a51feeec11e9"
|
||||
integrity sha1-CZNQL+r2aBODJXVvMPmlH+7sEek=
|
||||
|
||||
esquery@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708"
|
||||
integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==
|
||||
dependencies:
|
||||
estraverse "^4.0.0"
|
||||
|
||||
estemplate@^0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/estemplate/-/estemplate-0.5.1.tgz#1714a9d46190738ac958bcafd49e029cda56a39e"
|
||||
integrity sha1-FxSp1GGQc4rJWLyv1J4CnNpWo54=
|
||||
dependencies:
|
||||
esprima "^2.7.2"
|
||||
estraverse "^4.1.1"
|
||||
|
||||
estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
|
||||
integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=
|
||||
esprima@~3.1.0:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
|
||||
integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=
|
||||
|
||||
estree-walker@^0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39"
|
||||
integrity sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig==
|
||||
|
||||
estree-walker@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.0.tgz#5d865327c44a618dde5699f763891ae31f257dae"
|
||||
integrity sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw==
|
||||
estree-walker@^0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
|
||||
integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
|
||||
|
||||
esutils@^1.1.6:
|
||||
version "1.1.6"
|
||||
|
@ -4290,11 +4192,6 @@ fast-json-stable-stringify@2.0.0, fast-json-stable-stringify@^2.0.0:
|
|||
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
|
||||
integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=
|
||||
|
||||
fast-levenshtein@~2.0.4:
|
||||
version "2.0.6"
|
||||
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
|
||||
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
|
||||
|
||||
fast-url-parser@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d"
|
||||
|
@ -6331,6 +6228,13 @@ is-redirect@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24"
|
||||
integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=
|
||||
|
||||
is-reference@^1.1.2:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427"
|
||||
integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==
|
||||
dependencies:
|
||||
"@types/estree" "0.0.39"
|
||||
|
||||
is-regex@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
||||
|
@ -7068,14 +6972,6 @@ lcid@^2.0.0:
|
|||
dependencies:
|
||||
invert-kv "^2.0.0"
|
||||
|
||||
levn@~0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"
|
||||
integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=
|
||||
dependencies:
|
||||
prelude-ls "~1.1.2"
|
||||
type-check "~0.3.2"
|
||||
|
||||
lie@~3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e"
|
||||
|
@ -7542,14 +7438,14 @@ madge@0.5.0:
|
|||
uglify-js "1.2.6"
|
||||
walkdir "0.0.5"
|
||||
|
||||
magic-string@0.25.2, magic-string@^0.25.1:
|
||||
magic-string@0.25.2:
|
||||
version "0.25.2"
|
||||
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.2.tgz#139c3a729515ec55e96e69e82a11fe890a293ad9"
|
||||
integrity sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg==
|
||||
dependencies:
|
||||
sourcemap-codec "^1.4.4"
|
||||
|
||||
magic-string@0.25.4:
|
||||
magic-string@0.25.4, magic-string@^0.25.2:
|
||||
version "0.25.4"
|
||||
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.4.tgz#325b8a0a79fc423db109b77fd5a19183b7ba5143"
|
||||
integrity sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw==
|
||||
|
@ -8651,18 +8547,6 @@ optimist@0.6.x, optimist@^0.6.1, optimist@~0.6.0:
|
|||
minimist "~0.0.1"
|
||||
wordwrap "~0.0.2"
|
||||
|
||||
optionator@^0.8.1:
|
||||
version "0.8.2"
|
||||
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
|
||||
integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=
|
||||
dependencies:
|
||||
deep-is "~0.1.3"
|
||||
fast-levenshtein "~2.0.4"
|
||||
levn "~0.3.0"
|
||||
prelude-ls "~1.1.2"
|
||||
type-check "~0.3.2"
|
||||
wordwrap "~1.0.0"
|
||||
|
||||
ora@0.2.3:
|
||||
version "0.2.3"
|
||||
resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4"
|
||||
|
@ -9149,11 +9033,6 @@ posix-character-classes@^0.1.0:
|
|||
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
|
||||
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
|
||||
|
||||
prelude-ls@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
|
||||
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
|
||||
|
||||
prepend-http@^1.0.1:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
|
||||
|
@ -9169,11 +9048,6 @@ preserve@^0.2.0:
|
|||
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
||||
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
|
||||
|
||||
prettier@^1.7.4:
|
||||
version "1.16.4"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"
|
||||
integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==
|
||||
|
||||
pretty-hrtime@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1"
|
||||
|
@ -9949,6 +9823,13 @@ resolve@^1.10.0:
|
|||
dependencies:
|
||||
path-parse "^1.0.6"
|
||||
|
||||
resolve@^1.11.0, resolve@^1.11.1:
|
||||
version "1.12.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6"
|
||||
integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==
|
||||
dependencies:
|
||||
path-parse "^1.0.6"
|
||||
|
||||
response-time@~2.3.1:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/response-time/-/response-time-2.3.2.tgz#ffa71bab952d62f7c1d49b7434355fbc68dffc5a"
|
||||
|
@ -10068,39 +9949,27 @@ rndm@1.2.0:
|
|||
resolved "https://registry.yarnpkg.com/rndm/-/rndm-1.2.0.tgz#f33fe9cfb52bbfd520aa18323bc65db110a1b76c"
|
||||
integrity sha1-8z/pz7Urv9UgqhgyO8ZdsRCht2w=
|
||||
|
||||
rollup-plugin-amd@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-amd/-/rollup-plugin-amd-3.0.0.tgz#c09efa5e00ae092cfe581a62fb6f0b01bf788ec1"
|
||||
integrity sha512-nlazscW4UdlCKef12oxlombIWSicuHZDiY8fyU0dhpB7CQFb3JTX/qq17zDccn+K2QBbIvXlGdTusyQi5eMUIQ==
|
||||
rollup-plugin-commonjs@^10.1.0:
|
||||
version "10.1.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz#417af3b54503878e084d127adf4d1caf8beb86fb"
|
||||
integrity sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==
|
||||
dependencies:
|
||||
"@buxlabs/amd-to-es6" "^0.12.0"
|
||||
rollup-pluginutils "^2.0.1"
|
||||
estree-walker "^0.6.1"
|
||||
is-reference "^1.1.2"
|
||||
magic-string "^0.25.2"
|
||||
resolve "^1.11.0"
|
||||
rollup-pluginutils "^2.8.1"
|
||||
|
||||
rollup-plugin-commonjs@^9.2.1:
|
||||
version "9.2.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.2.1.tgz#bb151ca8fa23600c7a03e25f9f0a45b1ee922dac"
|
||||
integrity sha512-X0A/Cp/t+zbONFinBhiTZrfuUaVwRIp4xsbKq/2ohA2CDULa/7ONSJTelqxon+Vds2R2t2qJTqJQucKUC8GKkw==
|
||||
rollup-plugin-node-resolve@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523"
|
||||
integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==
|
||||
dependencies:
|
||||
estree-walker "^0.5.2"
|
||||
magic-string "^0.25.1"
|
||||
resolve "^1.10.0"
|
||||
rollup-pluginutils "^2.3.3"
|
||||
|
||||
rollup-plugin-json@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-json/-/rollup-plugin-json-4.0.0.tgz#a18da0a4b30bf5ca1ee76ddb1422afbb84ae2b9e"
|
||||
integrity sha512-hgb8N7Cgfw5SZAkb3jf0QXii6QX/FOkiIq2M7BAQIEydjHvTyxXHQiIzZaTFgx1GK0cRCHOCBHIyEkkLdWKxow==
|
||||
dependencies:
|
||||
rollup-pluginutils "^2.5.0"
|
||||
|
||||
rollup-plugin-node-resolve@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.0.1.tgz#f95765d174e5daeef9ea6268566141f53aa9d422"
|
||||
integrity sha512-fSS7YDuCe0gYqKsr5OvxMloeZYUSgN43Ypi1WeRZzQcWtHgFayV5tUSPYpxuaioIIWaBXl6NrVk0T2/sKwueLg==
|
||||
dependencies:
|
||||
builtin-modules "^3.0.0"
|
||||
"@types/resolve" "0.0.8"
|
||||
builtin-modules "^3.1.0"
|
||||
is-module "^1.0.0"
|
||||
resolve "^1.10.0"
|
||||
resolve "^1.11.1"
|
||||
rollup-pluginutils "^2.8.1"
|
||||
|
||||
rollup-plugin-node-resolve@~4.2.3:
|
||||
version "4.2.4"
|
||||
|
@ -10138,30 +10007,12 @@ rollup-pluginutils@^2.0.1:
|
|||
estree-walker "^0.5.2"
|
||||
micromatch "^2.3.11"
|
||||
|
||||
rollup-pluginutils@^2.3.3:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.4.1.tgz#de43ab54965bbf47843599a7f3adceb723de38db"
|
||||
integrity sha512-wesMQ9/172IJDIW/lYWm0vW0LiKe5Ekjws481R7z9WTRtmO59cqyM/2uUlxvf6yzm/fElFmHUobeQOYz46dZJw==
|
||||
rollup-pluginutils@^2.8.1:
|
||||
version "2.8.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e"
|
||||
integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==
|
||||
dependencies:
|
||||
estree-walker "^0.6.0"
|
||||
micromatch "^3.1.10"
|
||||
|
||||
rollup-pluginutils@^2.5.0:
|
||||
version "2.6.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.6.0.tgz#203706edd43dfafeaebc355d7351119402fc83ad"
|
||||
integrity sha512-aGQwspEF8oPKvg37u3p7h0cYNwmJR1sCBMZGZ5b9qy8HGtETknqjzcxrDRrcAnJNXN18lBH4Q9vZYth/p4n8jQ==
|
||||
dependencies:
|
||||
estree-walker "^0.6.0"
|
||||
micromatch "^3.1.10"
|
||||
|
||||
rollup@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.1.0.tgz#461a7534b55be48aa4a6e6810a1543a5769e75d1"
|
||||
integrity sha512-NK03gkkOz0CchHBMGomcNqa6U3jLNzHuWK9SI0+1FV475JA6cQxVtjlDcQoKKDNIQ3IwYumIlgoKYDEWUyFBwQ==
|
||||
dependencies:
|
||||
"@types/estree" "0.0.39"
|
||||
"@types/node" "*"
|
||||
acorn "^6.0.5"
|
||||
estree-walker "^0.6.1"
|
||||
|
||||
rollup@~1.11.3:
|
||||
version "1.11.3"
|
||||
|
@ -10172,6 +10023,15 @@ rollup@~1.11.3:
|
|||
"@types/node" "^11.13.9"
|
||||
acorn "^6.1.1"
|
||||
|
||||
rollup@~1.25.0:
|
||||
version "1.25.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.25.2.tgz#739f508bd8f7ece52bb6c1fcda83466af82b7f6d"
|
||||
integrity sha512-+7z6Wab/L45QCPcfpuTZKwKiB0tynj05s/+s2U3F2Bi7rOLPr9UcjUwO7/xpjlPNXA/hwnth6jBExFRGyf3tMg==
|
||||
dependencies:
|
||||
"@types/estree" "*"
|
||||
"@types/node" "*"
|
||||
acorn "^7.1.0"
|
||||
|
||||
router@^1.3.1:
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/router/-/router-1.3.3.tgz#c142f6b5ea4d6b3359022ca95b6580bd217f89cf"
|
||||
|
@ -10738,6 +10598,14 @@ source-map-support@~0.5.10:
|
|||
buffer-from "^1.0.0"
|
||||
source-map "^0.6.0"
|
||||
|
||||
source-map-support@~0.5.12:
|
||||
version "0.5.16"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042"
|
||||
integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==
|
||||
dependencies:
|
||||
buffer-from "^1.0.0"
|
||||
source-map "^0.6.0"
|
||||
|
||||
source-map-url@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
|
||||
|
@ -11343,6 +11211,15 @@ term-size@^1.2.0:
|
|||
dependencies:
|
||||
execa "^0.7.0"
|
||||
|
||||
terser@4.3.3:
|
||||
version "4.3.3"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.3.tgz#f626c6779cadd60a3018e072fedeceabe4769db1"
|
||||
integrity sha512-Nzr7dpRjSzMEUS+z2UYQBtzE0LDm5k0Yy8RgLRPy85QUo1TjU5lIOBwzS5/FVAMaVyHZ3WTTU2BuQcMn8KXnNQ==
|
||||
dependencies:
|
||||
commander "^2.20.0"
|
||||
source-map "~0.6.1"
|
||||
source-map-support "~0.5.12"
|
||||
|
||||
terser@^3.14.1:
|
||||
version "3.17.0"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-3.17.0.tgz#f88ffbeda0deb5637f9d24b0da66f4e15ab10cb2"
|
||||
|
@ -11501,14 +11378,6 @@ to-array@0.1.4:
|
|||
resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890"
|
||||
integrity sha1-F+bBH3PdTz10zaek/zI46a2b+JA=
|
||||
|
||||
to-ast@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/to-ast/-/to-ast-1.0.0.tgz#0c4a31c8c98edfde9aaf0192c794b4c8b11ee287"
|
||||
integrity sha1-DEoxyMmO396arwGSx5S0yLEe4oc=
|
||||
dependencies:
|
||||
ast-types "^0.7.2"
|
||||
esprima "^2.1.0"
|
||||
|
||||
to-buffer@^1.1.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80"
|
||||
|
@ -11713,13 +11582,6 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
|
|||
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
|
||||
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
|
||||
|
||||
type-check@~0.3.2:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"
|
||||
integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=
|
||||
dependencies:
|
||||
prelude-ls "~1.1.2"
|
||||
|
||||
type-detect@^4.0.0, type-detect@^4.0.5:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
|
||||
|
@ -12458,11 +12320,6 @@ wordwrap@~0.0.2:
|
|||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
|
||||
integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc=
|
||||
|
||||
wordwrap@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
|
||||
integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=
|
||||
|
||||
wrap-ansi@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
|
||||
|
|
Loading…
Reference in New Issue