diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index e692a85a52..a35d5fda03 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -1,112 +1,22 @@ --- -bazel: 4.0.0 +bazel: 5.0.0 +# Note, this will tell the user to do the wrong thing (manually run buildifer) +# See https://github.com/bazelbuild/continuous-integration/issues/1161 +buildifier: + version: 4.0.1 + # Keep this in sync with the list in .pre-commit-config.yaml + # https://github.com/bazelbuild/buildtools/issues/479 should fix this by giving us a config file + warnings: "-bzl-visibility,-function-docstring-args,-function-docstring-return,-print,-unnamed-macro,-provider-params,-function-docstring-header,-no-effect,-uninitialized,-rule-impl-return" + # Note, we ought to be able to exclude third_party from this check, but currently cannot: + # https://github.com/bazelbuild/continuous-integration/issues/1162 tasks: - ubuntu1604: - name: ubuntu1604 - platform: ubuntu1604 - run_targets: - - "@nodejs//:yarn_node_repositories" - - "@nodejs//:yarn" - # Regression test for #1493 - - "//packages/create:npm_package.pack" - - "//internal/node/test:no_deps" - - "//internal/node/test:has_deps_legacy" - - "//internal/node/test:has_deps" - - "//internal/node/test:has_deps_hybrid" - - "//internal/npm_install/test:index" - # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 - #- "@fine_grained_deps_yarn//typescript/bin:tsc" - build_targets: - - "//..." - build_flags: - # TODO(gregmagolan): figure out how to install missing shared libs - # Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs. - - "--build_tag_filters=-cypress" - test_flags: - # Both chrome & firefox are missing shared libs on bazelci ubuntu. - # On circleci we have the same issue but we can work around it using apt-get. - # on bazelci apt-get fails with permission denied and there is no sudo - # command to switch to root. - # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_tag_filters=-e2e,-examples,-manual,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome,-cypress" - test_targets: - - "//..." - # //internal/node/test:nodejs_toolchain_linux_amd64_test is a "manual" test that must be run - # explicitly; it should pass when running on Linux with no --platform set. - - "//internal/node/test:nodejs_toolchain_linux_amd64_test" - ubuntu1604_e2e: - name: ubuntu1604_e2e - platform: ubuntu1604 - # We need to reduce the memory & CPU usage of the top-level - # bazel process for bazel-in-bazel tests to not - # deplete the system memory completely. - # - startup JVM memory reduced - # - top-level bazel process should use as little memory as possible and only 1 core - # - nested bazel process should use a limited number of cores - shell_commands: - - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc - build_flags: - - "--build_tag_filters=e2e,-cypress" - build_targets: - - "//..." - # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. - skip_use_bazel_version_for_test: true - test_flags: - - "--test_tag_filters=e2e" - - "--local_ram_resources=792" - # test_args will be passed to the nested bazel process - - "--test_arg=--local_ram_resources=13288" - - "--test_arg=--local_cpu_resources=7" - # Both chrome & firefox are missing shared libs on bazelci ubuntu. - # On circleci we have the same issue but we can work around it using apt-get. - # on bazelci apt-get fails with permission denied and there is no sudo - # command to switch to root. - # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_arg=--test_tag_filters=-manual,-browser:chromium-local,-browser:firefox-local,-cypress" - test_targets: - - "//..." - ubuntu1604_examples: - name: ubuntu1604_examples - platform: ubuntu1604 - # We need to reduce the memory & CPU usage of the top-level - # bazel process for bazel-in-bazel tests to not - # deplete the system memory completely. - # - startup JVM memory reduced - # - top-level bazel process should use as little memory as possible and only 1 core - # - nested bazel process should use a limited number of cores - shell_commands: - - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc - build_flags: - - "--build_tag_filters=examples,-cypress" - build_targets: - - "//..." - # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. - skip_use_bazel_version_for_test: true - test_flags: - - "--test_tag_filters=examples,-cypress" - - "--local_ram_resources=792" - # test_args will be passed to the nested bazel process - - "--test_arg=--local_ram_resources=13288" - - "--test_arg=--local_cpu_resources=7" - # Both chrome & firefox are missing shared libs on bazelci ubuntu. - # On circleci we have the same issue but we can work around it using apt-get. - # on bazelci apt-get fails with permission denied and there is no sudo - # command to switch to root. - # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_arg=--test_tag_filters=-manual,-browser:chromium-local,-browser:firefox-local,-cypress" - test_targets: - - "//..." - # The following examples only works on linux as it downloads the linux node distribution - # It is tagged "manual" so we run it explicitly here - # TODO(gregmagolan): make node_repositories acccept different archives for different platforms - - "//examples:examples_vendored_node" - - "//examples:examples_vendored_node_and_yarn" ubuntu1804: name: ubuntu1804 platform: ubuntu1804 run_targets: - - "@nodejs//:yarn_node_repositories" - - "@nodejs//:yarn" + - "@yarn//:yarn" + # Regression test for #1493 + - "//packages/create:npm_package.pack" - "//internal/node/test:no_deps" - "//internal/node/test:has_deps_legacy" - "//internal/node/test:has_deps" @@ -120,21 +30,15 @@ tasks: # TODO(gregmagolan): figure out how to install missing shared libs # Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs. - "--build_tag_filters=-cypress" - # Build the docs up to the point of running Jekyll as this requires some locally installed deps - # Building the stardoc targets provides a little test coverage in formatting etc - - "//docs:builtins_md" test_flags: # Both chrome & firefox are missing shared libs on bazelci ubuntu. # On circleci we have the same issue but we can work around it using apt-get. # on bazelci apt-get fails with permission denied and there is no sudo # command to switch to root. # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_tag_filters=-e2e,-examples,-manual,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome,-cypress" + - "--test_tag_filters=-e2e,-examples,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome,-cypress" test_targets: - "//..." - # //internal/node/test:nodejs_toolchain_linux_amd64_test is a "manual" test that must be run - # explicitly; it should pass when running on Linux with no --platform set. - - "//internal/node/test:nodejs_toolchain_linux_amd64_test" ubuntu1804_debug: name: ubuntu1804_debug platform: ubuntu1804 @@ -150,7 +54,7 @@ tasks: # on bazelci apt-get fails with permission denied and there is no sudo # command to switch to root. # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_tag_filters=-e2e,-examples,-manual,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome,-cypress" + - "--test_tag_filters=-e2e,-examples,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome,-cypress" test_targets: - "//..." ubuntu1804_e2e: @@ -181,7 +85,7 @@ tasks: # on bazelci apt-get fails with permission denied and there is no sudo # command to switch to root. # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_arg=--test_tag_filters=-manual,-browser:chromium-local,-browser:firefox-local,-cypress" + - "--test_arg=--test_tag_filters=-browser:chromium-local,-browser:firefox-local,-cypress" test_targets: - "//..." ubuntu1804_examples: @@ -212,144 +116,89 @@ tasks: # on bazelci apt-get fails with permission denied and there is no sudo # command to switch to root. # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_arg=--test_tag_filters=-manual,-browser:chromium-local,-browser:firefox-local,-cypress" - test_targets: - - "//..." - # The following examples only works on linux as it downloads the linux node distribution - # It is tagged "manual" so we run it explicitly here - # TODO(gregmagolan): make node_repositories acccept different archives for different platforms - - "//examples:examples_vendored_node" - - "//examples:examples_vendored_node_and_yarn" - ubuntu1804_cross_compile_darwin: - name: ubuntu1804_cross_compile_darwin - platform: ubuntu1804 - # Build on linux with the node --platform set to darwin - build_flags: - - "--platforms=@build_bazel_rules_nodejs//toolchains/node:darwin_amd64" - # TODO(gregmagolan): figure out how to install missing shared libs - # Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs. - - "--build_tag_filters=-cypress" - build_targets: - - "//internal/..." - test_flags: - - "--platforms=@build_bazel_rules_nodejs//toolchains/node:darwin_amd64" - test_targets: - # //internal/node/test:nodejs_toolchain_darwin_amd64_test is a "manual" test that must be run - # explicitly with --platforms=@build_bazel_rules_nodejs//toolchains/node:darwin_amd64 set - - "//internal/node/test:nodejs_toolchain_darwin_amd64_test" - ubuntu1804_cross_compile_windows: - name: ubuntu1804_cross_compile_windows - platform: ubuntu1804 - # Build on linux with the node --platform set to Windows - build_flags: - - "--platforms=@build_bazel_rules_nodejs//toolchains/node:windows_amd64" - # TODO(gregmagolan): figure out how to install missing shared libs - # Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs. - - "--build_tag_filters=-cypress" - build_targets: - - "//internal/..." - test_flags: - - "--platforms=@build_bazel_rules_nodejs//toolchains/node:windows_amd64" - test_targets: - # //internal/node/test:nodejs_toolchain_windows_amd64_test is a "manual" test that must be run - # explicitly with --platforms=@build_bazel_rules_nodejs//toolchains/node:windows_amd64 set - - "//internal/node/test:nodejs_toolchain_windows_amd64_test" - macos: - name: macos - platform: macos - run_targets: - - "@nodejs//:yarn_node_repositories" - - "@nodejs//:yarn" - # Regression test for #1493 - - "//packages/create:npm_package.pack" - - "//internal/node/test:no_deps" - - "//internal/node/test:has_deps_legacy" - - "//internal/node/test:has_deps" - - "//internal/node/test:has_deps_hybrid" - - "//internal/npm_install/test:index" - # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 - #- "@fine_grained_deps_yarn//typescript/bin:tsc" - build_targets: - - "//..." - test_flags: - # Firefox are missing shared libs on bazelci mac - # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_tag_filters=-e2e,-examples,-manual,-browser:firefox-local" - test_targets: - - "//..." - # //internal/node/test:nodejs_toolchain_darwin_amd64_test is a "manual" test that must be run - # explicitly; it should pass when running on OSX with no --platform set. - - "//internal/node/test:nodejs_toolchain_darwin_amd64_test" - macos_e2e: - name: macos_e2e - platform: macos - # We need to reduce the memory & CPU usage of the top-level - # bazel process for bazel-in-bazel tests to not - # deplete the system memory completely. - # - startup JVM memory reduced - # - top-level bazel process should use as little memory as possible and only 1 core - # - nested bazel process should use a limited number of cores - shell_commands: - - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc - build_flags: - - "--build_tag_filters=e2e" - build_targets: - - "//..." - # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. - skip_use_bazel_version_for_test: true - test_flags: - - "--test_tag_filters=e2e,-no-bazelci-mac" - - "--local_ram_resources=792" - # test_args will be passed to the nested bazel process - # TODO(gregmagolan): fix frequent flake with multiple cores in nested bazel (osx buildkite & local) - - "--test_arg=--local_ram_resources=13288" - # Firefox are missing shared libs on bazelci mac - # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_arg=--test_tag_filters=-manual,-browser:firefox-local" + - "--test_arg=--test_tag_filters=-browser:chromium-local,-browser:firefox-local,-cypress" + - "--test_output=streamed" test_targets: - "//..." - macos_examples: - name: macos_examples - platform: macos - # We need to reduce the memory & CPU usage of the top-level - # bazel process for bazel-in-bazel tests to not - # deplete the system memory completely. - # - startup JVM memory reduced - # - top-level bazel process should use as little memory as possible and only 1 core - # - nested bazel process should use a limited number of cores - shell_commands: - - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc - build_flags: - - "--build_tag_filters=examples" - build_targets: - - "//..." - # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. - skip_use_bazel_version_for_test: true - test_flags: - - "--test_tag_filters=examples,-manual" - - "--local_ram_resources=792" - # test_args will be passed to the nested bazel process - # TODO(gregmagolan): fix frequent flake with multiple cores in nested bazel (osx buildkite & local) - - "--test_arg=--local_ram_resources=13288" - # Firefox are missing shared libs on bazelci mac - # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_arg=--test_tag_filters=-no-bazelci-mac,-manual,-browser:firefox-local" - test_targets: - - "//..." - macos_cross_compile_linux: - name: macos_cross_compile_linux - platform: macos - # Build on mac with the node --platform set to linux - build_flags: - - "--platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64" - build_targets: - - "//internal/..." - test_flags: - - "--platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64" - test_targets: - # //internal/node/test:nodejs_toolchain_linux_amd64_test is a "manual" test that must be run - # explicitly with --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 set - - "//internal/node/test:nodejs_toolchain_linux_amd64_test" + # Temporarily disabled MacOS tests until pre-existing failure can be investigated. + # macos: + # name: macos + # platform: macos + # run_targets: + # - "@yarn//:yarn" + # # Regression test for #1493 + # - "//packages/create:npm_package.pack" + # - "//internal/node/test:no_deps" + # - "//internal/node/test:has_deps_legacy" + # - "//internal/node/test:has_deps" + # - "//internal/node/test:has_deps_hybrid" + # - "//internal/npm_install/test:index" + # # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 + # #- "@fine_grained_deps_yarn//typescript/bin:tsc" + # build_targets: + # - "//..." + # test_flags: + # # Firefox are missing shared libs on bazelci mac + # # TODO(gregmagolan): figure out how to install missing shared libs + # - "--test_tag_filters=-e2e,-examples,-browser:firefox-local" + # test_targets: + # - "//..." + # macos_e2e: + # name: macos_e2e + # platform: macos + # # We need to reduce the memory & CPU usage of the top-level + # # bazel process for bazel-in-bazel tests to not + # # deplete the system memory completely. + # # - startup JVM memory reduced + # # - top-level bazel process should use as little memory as possible and only 1 core + # # - nested bazel process should use a limited number of cores + # shell_commands: + # - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc + # build_flags: + # - "--build_tag_filters=e2e" + # build_targets: + # - "//..." + # # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. + # skip_use_bazel_version_for_test: true + # test_flags: + # - "--test_tag_filters=e2e,-no-bazelci-mac" + # - "--local_ram_resources=792" + # # test_args will be passed to the nested bazel process + # # TODO(gregmagolan): fix frequent flake with multiple cores in nested bazel (osx buildkite & local) + # - "--test_arg=--local_ram_resources=13288" + # # Firefox are missing shared libs on bazelci mac + # # TODO(gregmagolan): figure out how to install missing shared libs + # - "--test_arg=--test_tag_filters=-browser:firefox-local" + # test_targets: + # - "//..." + # macos_examples: + # name: macos_examples + # platform: macos + # # We need to reduce the memory & CPU usage of the top-level + # # bazel process for bazel-in-bazel tests to not + # # deplete the system memory completely. + # # - startup JVM memory reduced + # # - top-level bazel process should use as little memory as possible and only 1 core + # # - nested bazel process should use a limited number of cores + # shell_commands: + # - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc + # build_flags: + # - "--build_tag_filters=examples" + # build_targets: + # - "//..." + # # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. + # skip_use_bazel_version_for_test: true + # test_flags: + # - "--test_tag_filters=examples" + # - "--local_ram_resources=792" + # # test_args will be passed to the nested bazel process + # # TODO(gregmagolan): fix frequent flake with multiple cores in nested bazel (osx buildkite & local) + # - "--test_arg=--local_ram_resources=13288" + # # Firefox are missing shared libs on bazelci mac + # # TODO(gregmagolan): figure out how to install missing shared libs + # - "--test_arg=--test_tag_filters=-no-bazelci-mac,-browser:firefox-local" + # test_targets: + # - "//..." # TODO(gregmagolan): fix platform configuraiton for this test job for Bazel 2.0 # macos_fake_rbe: # name: macos_fake_rbe @@ -366,8 +215,7 @@ tasks: name: windows platform: windows run_targets: - - "@nodejs//:yarn_node_repositories" - - "@nodejs//:yarn" + - "@yarn//:yarn" - "//internal/node/test:no_deps" - "//internal/node/test:has_deps_legacy" - "//internal/node/test:has_deps" @@ -376,29 +224,34 @@ tasks: # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 #- "@fine_grained_deps_yarn//typescript/bin:tsc" build_flags: - - "--build_tag_filters=-e2e,-examples,-fix-windows,-manual" + - "--build_tag_filters=-e2e,-examples,-fix-windows,-no-bazelci-windows,-requires-runfiles" build_targets: - "//..." test_flags: # Firefox not supported on Windows with rules_webtesting (if run it exit with success) # See https://github.com/bazelbuild/rules_webtesting/blob/0.3.3/browsers/BUILD.bazel#L66. - - "--test_tag_filters=-e2e,-examples,-fix-windows,-manual,-browser:firefox-local,-cypress" + - "--test_tag_filters=-e2e,-examples,-fix-windows,-no-bazelci-windows,-requires-runfiles,-browser:firefox-local,-cypress" + test_targets: + - "//..." + windows_runfiles_enabled: + name: windows_runfiles_enabled + platform: windows + test_flags: + - "--test_tag_filters=requires-runfiles,-fix-windows,-no-bazelci-windows" + - "--enable_runfiles" test_targets: - "//..." - # //internal/node/test:nodejs_toolchain_windows_amd64_test is a "manual" test that must be run - # explicitly; it should pass when running on Windows with no --platform set. - - "//internal/node/test:nodejs_toolchain_windows_amd64_test" windows_e2e: name: windows_e2e platform: windows build_flags: - - "--build_tag_filters=e2e,-fix-windows" + - "--build_tag_filters=e2e,-fix-windows,-no-bazelci-windows,-requires-runfiles" build_targets: - "//..." # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. skip_use_bazel_version_for_test: true test_flags: - - "--test_tag_filters=e2e,-fix-windows,-no-bazelci-windows" + - "--test_tag_filters=e2e,-fix-windows,-no-bazelci-windows,-requires-runfiles" - "--local_ram_resources=792" # test_args will be passed to the nested bazel process - "--test_arg=--local_ram_resources=13288" @@ -406,20 +259,20 @@ tasks: # See https://github.com/bazelbuild/rules_webtesting/blob/0.3.3/browsers/BUILD.bazel#L66. # Chrome fails to launch on Windows inside bazel-in-bazel with: [17:12:04] E/launcher - # spawn D:\...\external\io_bazel_rules_webtesting\third_party\chromedriver\chromedriver.out\chromedriver_win32\chromedriver.exe ENOENT - - "--test_arg=--test_tag_filters=-fix-windows,-manual,-browser:chromium-local,-browser:firefox-local" + - "--test_arg=--test_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles,-browser:chromium-local,-browser:firefox-local" test_targets: - "//..." windows_examples: name: windows_examples platform: windows build_flags: - - "--build_tag_filters=examples,-fix-windows" + - "--build_tag_filters=examples,-fix-windows,-no-bazelci-windows,-requires-runfiles" build_targets: - "//..." # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests. skip_use_bazel_version_for_test: true test_flags: - - "--test_tag_filters=examples,-manual,-fix-windows,-no-bazelci-windows,-cypress" + - "--test_tag_filters=examples,-fix-windows,-no-bazelci-windows,-requires-runfiles,-cypress" - "--local_ram_resources=792" # test_args will be passed to the nested bazel process - "--test_arg=--local_ram_resources=13288" @@ -427,17 +280,9 @@ tasks: # See https://github.com/bazelbuild/rules_webtesting/blob/0.3.3/browsers/BUILD.bazel#L66. # Chrome fails to launch on Windows inside bazel-in-bazel with: [17:12:04] E/launcher - # spawn D:\...\external\io_bazel_rules_webtesting\third_party\chromedriver\chromedriver.out\chromedriver_win32\chromedriver.exe ENOENT - - "--test_arg=--test_tag_filters=-no-bazelci-windows,-fix-windows,-manual,-browser:chromium-local,-browser:firefox-local,-cypress" + - "--test_arg=--test_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles,-browser:chromium-local,-browser:firefox-local,-cypress" test_targets: - "//..." - windows_cross_compile_linux: - name: windows_cross_compile_linux - platform: windows - # Build on windows with the node --platform set to linux - build_flags: - - "--platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64" - build_targets: - - "//internal/..." rbe_ubuntu1604: name: rbe_ubuntu1604 platform: rbe_ubuntu1604 @@ -446,7 +291,9 @@ tasks: build_flags: # TODO(gregmagolan): figure out how to install missing shared libs # Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs. - - "--build_tag_filters=-cypress,-pkg_npm.pack" + - "--build_tag_filters=-cypress,-examples,-e2e,-no-rbe,-browser:chromium-local,-browser:firefox-local" test_flags: # TODO(gregmagolan): figure out how to install missing shared libs - - "--test_arg=-cypress" + - "--test_tag_filters=-cypress,-examples,-e2e,-no-rbe,-browser:chromium-local,-browser:firefox-local" + test_targets: + - "//..." diff --git a/.bazelignore b/.bazelignore index 25ad38ec1c..3a2c18fff2 100644 --- a/.bazelignore +++ b/.bazelignore @@ -7,10 +7,7 @@ bazel-out node_modules e2e/symlinked_node_modules_yarn/node_modules e2e/symlinked_node_modules_npm/node_modules -packages/angular/node_modules examples/angular/node_modules -examples/user_managed_deps/node_modules # **/dist dist -examples/user_managed_deps/dist diff --git a/.bazelrc b/.bazelrc index 00ce0e3bcb..cf340bd952 100644 --- a/.bazelrc +++ b/.bazelrc @@ -5,8 +5,8 @@ import %workspace%/common.bazelrc # This lets us glob() up all the files inside the examples to make them inputs to tests # To update these lines, just run `yarn bazel:update-deleted-packages` # (Note, we cannot use common --deleted_packages because the bazel version command doesn't support it) -build --deleted_packages=examples/angular,examples/angular/e2e,examples/angular/src/app/home,examples/angular/src/app/hello-world,examples/angular/src/app,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/shared/material,examples/angular/src/lib/shorten,examples/angular/src,examples/angular/src/assets,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/angular_view_engine,examples/angular_view_engine/e2e,examples/angular_view_engine/src/app/home,examples/angular_view_engine/src/app/hello-world,examples/angular_view_engine/src/app,examples/angular_view_engine/src/app/todos,examples/angular_view_engine/src/app/todos/reducers,examples/angular_view_engine/src/shared/material,examples/angular_view_engine/src/lib/typography,examples/angular_view_engine/src/lib/shorten,examples/angular_view_engine/src,examples/angular_view_engine/src/assets,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/create-react-app,examples/cypress,examples/esbuild,examples/esbuild/src,examples/from_source,examples/jest,examples/jest/ts/test,examples/jest/ts,examples/jest/ts/src,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protobufjs,examples/protocol_buffers,examples/react_webpack,examples/user_managed_deps,examples/vendored_node,examples/vendored_node_and_yarn,examples/vue,examples/vue/src,examples/web_testing,examples/webapp,examples/worker,e2e/bazel_managed_deps,e2e/concatjs_devserver,e2e/concatjs_devserver/genrule,e2e/concatjs_devserver/subpackage,e2e/coverage,e2e/fine_grained_symlinks,e2e/jasmine,e2e/node_loader_no_preserve_symlinks,e2e/node_loader_preserve_symlinks,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/typescript,e2e/webapp -query --deleted_packages=examples/angular,examples/angular/e2e,examples/angular/src/app/home,examples/angular/src/app/hello-world,examples/angular/src/app,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/shared/material,examples/angular/src/lib/shorten,examples/angular/src,examples/angular/src/assets,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/angular_view_engine,examples/angular_view_engine/e2e,examples/angular_view_engine/src/app/home,examples/angular_view_engine/src/app/hello-world,examples/angular_view_engine/src/app,examples/angular_view_engine/src/app/todos,examples/angular_view_engine/src/app/todos/reducers,examples/angular_view_engine/src/shared/material,examples/angular_view_engine/src/lib/typography,examples/angular_view_engine/src/lib/shorten,examples/angular_view_engine/src,examples/angular_view_engine/src/assets,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/create-react-app,examples/cypress,examples/esbuild,examples/esbuild/src,examples/from_source,examples/jest,examples/jest/ts/test,examples/jest/ts,examples/jest/ts/src,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protobufjs,examples/protocol_buffers,examples/react_webpack,examples/user_managed_deps,examples/vendored_node,examples/vendored_node_and_yarn,examples/vue,examples/vue/src,examples/web_testing,examples/webapp,examples/worker,e2e/bazel_managed_deps,e2e/concatjs_devserver,e2e/concatjs_devserver/genrule,e2e/concatjs_devserver/subpackage,e2e/coverage,e2e/fine_grained_symlinks,e2e/jasmine,e2e/node_loader_no_preserve_symlinks,e2e/node_loader_preserve_symlinks,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/typescript,e2e/webapp +build --deleted_packages=e2e/bazel_managed_deps,e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,e2e/concatjs_devserver,e2e/concatjs_devserver/genrule,e2e/concatjs_devserver/subpackage,e2e/coverage,e2e/fine_grained_symlinks,e2e/jasmine,e2e/linker_disabled_regression,e2e/linker_disabled_regression/subdir,e2e/node_loader_preserve_symlinks,e2e/nodejs_host,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/typescript,e2e/webapp,examples/angular,examples/angular/e2e,examples/angular/src,examples/angular/src/app,examples/angular/src/app/hello-world,examples/angular/src/app/home,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/assets,examples/angular/src/lib/shorten,examples/angular/src/shared/material,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/create-react-app,examples/cypress,examples/esbuild,examples/esbuild/src,examples/from_source,examples/jest,examples/jest/ts,examples/jest/ts/src,examples/jest/ts/test,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protobufjs,examples/react_webpack,examples/toolchain,examples/vendored_node_and_yarn,examples/vendored_node_and_yarn/toolchains,examples/vue,examples/vue/src,examples/vue/src/components/HelloWorld,examples/web_testing,examples/webapp,examples/worker +query --deleted_packages=e2e/bazel_managed_deps,e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,e2e/concatjs_devserver,e2e/concatjs_devserver/genrule,e2e/concatjs_devserver/subpackage,e2e/coverage,e2e/fine_grained_symlinks,e2e/jasmine,e2e/linker_disabled_regression,e2e/linker_disabled_regression/subdir,e2e/node_loader_preserve_symlinks,e2e/nodejs_host,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/typescript,e2e/webapp,examples/angular,examples/angular/e2e,examples/angular/src,examples/angular/src/app,examples/angular/src/app/hello-world,examples/angular/src/app/home,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/assets,examples/angular/src/lib/shorten,examples/angular/src/shared/material,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/create-react-app,examples/cypress,examples/esbuild,examples/esbuild/src,examples/from_source,examples/jest,examples/jest/ts,examples/jest/ts/src,examples/jest/ts/test,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protobufjs,examples/react_webpack,examples/toolchain,examples/vendored_node_and_yarn,examples/vendored_node_and_yarn/toolchains,examples/vue,examples/vue/src,examples/vue/src/components/HelloWorld,examples/web_testing,examples/webapp,examples/worker # Mock versioning command to test the --stamp behavior build --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3" @@ -17,7 +17,6 @@ build:release --stamp --workspace_status_command=./scripts/current_version.sh build --define=SOME_TEST_ENV=some_value test --define=SOME_TEST_ENV=some_value build --action_env=SOME_OTHER_ENV=some_other_value -build --experimental_inprocess_symlink_creation ############################### # Remote Build Execution support @@ -26,7 +25,7 @@ build --experimental_inprocess_symlink_creation ############################### # Load default settings for Remote Build Execution. -import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.28.0.bazelrc +import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-4.1.0.bazelrc # Remote instance, borrow the one used by Angular devs build:remote --remote_instance_name=projects/internal-200822/instances/default_instance @@ -51,6 +50,10 @@ build:docker-sandbox --experimental_docker_image=gcr.io/cloud-marketplace/google # Incompatible flags to run with build --incompatible_no_implicit_file_export -build --incompatible_restrict_string_escapes +# TODO(mattem): flip this when dependencies allow +# build --incompatible_struct_has_no_methods # TODO(alexeagle): turn on this flag when dependencies allow # build --incompatible_use_platforms_repo_for_constraints + +# Allow exclusive tests to run in a sandbox +test --incompatible_exclusive_test_sandboxed diff --git a/.bazelversion b/.bazelversion index fcdb2e109f..0062ac9718 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.0.0 +5.0.0 diff --git a/.circleci/bazel.rc b/.circleci/bazel.rc deleted file mode 100644 index a2c3a1779b..0000000000 --- a/.circleci/bazel.rc +++ /dev/null @@ -1,25 +0,0 @@ -# These options are enabled when running on CI -# We do this by copying this file to /etc/bazel.bazelrc at the start of the build. - -# Don't be spammy in the logs -build --noshow_progress - -# Print all the options that apply to the build. -# This helps us diagnose which options override others -# (e.g. /etc/bazel.bazelrc vs. tools/bazel.rc) -build --announce_rc - -# Workaround https://github.com/bazelbuild/bazel/issues/3645 -# Bazel doesn't calculate the memory ceiling correctly when running under Docker. -# Limit Bazel to consuming resources that fit in CircleCI "xlarge" class -# https://circleci.com/docs/2.0/configuration-reference/#resource_class -build --local_ram_resources=14336 -build --local_cpu_resources=8 - -# Our integration tests rely on accessing public registries which can fail -# Let's give all failing tests a second try to mostly paper over flakiness -test --flaky_test_attempts=2 - -# Expose the SSH_AUTH_SOCK variable to integration tests that need to run git_repository repository rules -# This is needed by the CircleCI git-over-ssh environment -test --test_env=SSH_AUTH_SOCK diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 460d9ec1be..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,209 +0,0 @@ -# Configuration file for https://circleci.com/gh/bazelbuild/rules_nodejs - -# Note: YAML anchors allow an object to be re-used, reducing duplication. -# The ampersand declares an alias for an object, then later the `<<: *name` -# syntax dereferences it. -# See http://blog.daemonl.com/2016/02/yaml.html -# To validate changes, use an online parser, eg. -# http://yaml-online-parser.appspot.com/ - -## IMPORTANT -# If you change the `default_docker_image` version, also change the `cache_key` version -var_1: &default_docker_image circleci/node:12.18.3 -var_2: &browsers_docker_image circleci/node:12.18.3-browsers -var_3: &cache_key node-12.18.3-{{ checksum "yarn.lock" }} - -var_4: &init_environment - run: - name: Initializing environment (setting up variables, overwriting Yarn) - command: | - # Setup circleci environment - ./.circleci/env.sh - - sudo apt-get update - # Install GTK+ graphical user interface (libgtk-3-0), advanced linux sound architecture (libasound2) - # and network security service libraries (libnss3) & X11 Screen Saver extension library (libssx1) - # which are dependendies of chrome & needed for karma & protractor headless chrome tests. - # This is a very small install with the whole init_environment step taking less than 8 seconds. - # TODO(gregmagolan): switch rules_webtesting to use a chrome headless_shell binary which does - # not depend on any dynamically linked libs - sudo apt-get -y install libgtk-3-0 libasound2 libnss3 libxss1 - # Also install libraries required for firefox - sudo apt-get -y install libdbus-glib-1-2 - - # Overwrite the yarn installed in the docker container with our own version. - pathToYarn=$(realpath ./third_party/github.com/yarnpkg/yarn/releases/download/v1.13.0/bin/yarn.js) - sudo chmod a+x $pathToYarn - sudo ln -fs $pathToYarn /usr/local/bin/yarn - echo "Yarn version: $(yarn --version)" - - # Add GitHub to known hosts. - mkdir -p ~/.ssh - echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts - - # Use git+ssh instead of https - git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true - git config --global gc.auto 0 || true - - # Setup /etc/bazel.bazelrc - sudo cp .circleci/bazel.rc /etc/bazel.bazelrc - -var_5: &yarn_install - run: - name: Run yarn install - command: yarn install - -var_6: &init_bazel - run: - name: Initializing Bazel - command: | - # Symlink fetched bazelisk to /usr/local/bin/bazel - pathToBazel=$(realpath ./node_modules/@bazel/bazelisk/bazelisk-linux_amd64) - sudo ln -fs $pathToBazel /usr/local/bin/bazel - echo "Bazel version:" - bazel version - -var_7: &hide_node_and_yarn_local_binaries - run: - name: Hide node, npm, and yarn binaries - command: | - # Hide node binaries to enforce that Bazel uses only the hermetic ones it downloads - sudo mv /usr/local/bin/node /usr/local/bin/node_ - sudo mv /usr/local/bin/npm /usr/local/bin/npm_ - sudo mv /usr/local/bin/yarn /usr/local/bin/yarn_ - -var_9: &job_defaults - working_directory: ~/rules_nodejs - docker: - - image: *default_docker_image - -var_10: &restore_cache - restore_cache: - keys: - - *cache_key - -var_11: &attach_workspace - attach_workspace: - at: ~/ - -# Opt-in to the new goodness -version: 2 - -# These jobs will run in parallel, and report separate statuses to GitHub PRs -jobs: - setup: - <<: *job_defaults - steps: - - checkout - - *restore_cache - - *init_environment - - *yarn_install - - *init_bazel - - # Run yarn - - run: bazel run @nodejs//:yarn - - # Save all node_modules to the cache - - save_cache: - key: *cache_key - paths: - - "node_modules" - - # Persist any changes at this point to be reused by further jobs. - - persist_to_workspace: - root: ~/ - paths: - - ./rules_nodejs - - # Cannot be run on BuildKite (BazelCI), see - # https://github.com/bazelbuild/continuous-integration/issues/338 - lint: - <<: *job_defaults - steps: - - *attach_workspace - - *init_environment - - *init_bazel - - # Run the Buildifier to check our Bazel rules for format issues. - - run: 'yarn bazel:format-check || - (echo "BUILD files not formatted. Please run ''yarn bazel:format --mode=fix''" ; exit 1)' - - # Run the Buildifier to check our Bazel rules for lint issues. - # Note: The `--lint=warn` will auto fixe (re-write) the affected files. - - run: 'yarn bazel:lint || - (echo "BUILD files contain unresolved lint errors. Please fix manually the remaining errors." ; exit 1)' - - # Overlaps with testing we do on BuildKite. This is still here because: - # - BuildKite doesn't have a public results UI; failures here let contributors fix their changes - # - We hide the node,yarn,npm binaries here which we don't do on BuildKite - # TODO: port these assertions to BuildKite - test: - <<: *job_defaults - resource_class: xlarge - steps: - - *attach_workspace - - *init_environment - - *init_bazel - - *hide_node_and_yarn_local_binaries - - - run: bazel test --test_tag_filters=-e2e,-examples,-manual ... - - - store_artifacts: - path: dist/bin/release.tar.gz - destination: release.tar.gz - - test_integration: - <<: *job_defaults - docker: - # Needed because some tests such as examples/angular_bazel_architect - # require local chrome - - image: *browsers_docker_image - resource_class: xlarge - # We need to reduce the memory & CPU usage of the top-level - # bazel process for this large bazel-in-bazel test to not - # deplete the system memory completely. - # - startup JVM memory reduced - # - top-level bazel process should use as little memory as possible and only 1 core - # - nested bazel process should have its memory & core optimally capped as well - parallelism: 8 - steps: - - *attach_workspace - - *init_environment - - run: - name: Tune top-level bazel JVM memory usage - command: echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1280m' >> .bazelrc - - *init_bazel - - *hide_node_and_yarn_local_binaries - - run: - command: ./.circleci/run_integration_tests.sh ${CIRCLE_NODE_INDEX} ${CIRCLE_NODE_TOTAL} - no_output_timeout: 30m - - test_integration_manual: - <<: *job_defaults - steps: - - *attach_workspace - - *init_environment - - *init_bazel - # Additional integration assertions that can only be done manually - - run: cd e2e/symlinked_node_modules_npm && yarn test && bazel clean - - run: cd e2e/symlinked_node_modules_yarn && yarn test && bazel clean - - run: cd examples/user_managed_deps && yarn install && bazel test ... - - run: cd examples/from_source && bazel test //... - -workflows: - version: 2 - default_workflow: - jobs: - - setup - - lint: - requires: - - setup - - test: - requires: - - setup - - test_integration: - requires: - - setup - - test_integration_manual: - requires: - - setup diff --git a/.circleci/env-helpers.inc.sh b/.circleci/env-helpers.inc.sh deleted file mode 100644 index ff21eb9ea0..0000000000 --- a/.circleci/env-helpers.inc.sh +++ /dev/null @@ -1,38 +0,0 @@ -#################################################################################################### -# Helpers for defining environment variables for CircleCI. -# -# In CircleCI, each step runs in a new shell. The way to share ENV variables across steps is to -# export them from `$BASH_ENV`, which is automatically sourced at the beginning of every step (for -# the default `bash` shell). -# -# See also https://circleci.com/docs/2.0/env-vars/#using-bash_env-to-set-environment-variables. -#################################################################################################### - -# Set and print an environment variable. -# -# Use this function for setting environment variables that are public, i.e. it is OK for them to be -# visible to anyone through the CI logs. -# -# Usage: `setPublicVar ` -function setPublicVar() { - setSecretVar $1 "$2"; - echo "$1=$2"; -} - -# Set (without printing) an environment variable. -# -# Use this function for setting environment variables that are secret, i.e. should not be visible to -# everyone through the CI logs. -# -# Usage: `setSecretVar ` -function setSecretVar() { - # WARNING: Secrets (e.g. passwords, access tokens) should NOT be printed. - # (Keep original shell options to restore at the end.) - local -r originalShellOptions=$(set +o); - set +x -eu -o pipefail; - - echo "export $1=\"${2:-}\";" >> $BASH_ENV; - - # Restore original shell options. - eval "$originalShellOptions"; -} diff --git a/.circleci/env.sh b/.circleci/env.sh deleted file mode 100755 index a9e24c2e8b..0000000000 --- a/.circleci/env.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# Variables -readonly projectDir=$(realpath "$(dirname ${BASH_SOURCE[0]})/..") -readonly envHelpersPath="$projectDir/.circleci/env-helpers.inc.sh"; - -# Load helpers and make them available everywhere (through `$BASH_ENV`). -source $envHelpersPath; -echo "source $envHelpersPath;" >> $BASH_ENV; - -#################################################################################################### -# Define PUBLIC environment variables for CircleCI. -#################################################################################################### -# ChromeDriver version compatible with the Chrome version included in the docker image used in -# `.circleci/config.yml`. See http://chromedriver.chromium.org/downloads for a list of versions. -# This variable is intended to be passed as an arg to the `webdriver-manager update` command (e.g. -# `"postinstall": "webdriver-manager update $CHROMEDRIVER_VERSION_ARG"`). -setPublicVar CHROMEDRIVER_VERSION_ARG "--versions.chrome 75.0.3770.90"; - -# Source `$BASH_ENV` to make the variables available immediately. -source $BASH_ENV; diff --git a/.circleci/run_integration_tests.sh b/.circleci/run_integration_tests.sh deleted file mode 100755 index 00bf0b23ad..0000000000 --- a/.circleci/run_integration_tests.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -set -eu -o pipefail -# -e: exits if a command fails -# -u: errors if an variable is referenced before being set -# -o pipefail: causes a pipeline to produce a failure return code if any command errors - -readonly SHARD_INDEX=${1:-0} -readonly MAX_SHARDS=${2:-1} - -# Get a sorted list of all test targets. We sort to ensure that each shard gets the same list -# incase there is any inconstencies with bazel query on different shards. -readonly QUERY_RESULT=$(bazel query 'kind("bazel_integration_test", //examples/... union //e2e/...) except attr("tags", "no-circleci", //examples/... union //e2e/...)') -declare TEST_TARGETS_ARRAY=() -for target in ${QUERY_RESULT}; do - TEST_TARGETS_ARRAY+=("${target}") -done -IFS=$'\n' -TEST_TARGETS=($(sort <<<"${TEST_TARGETS_ARRAY[*]}")) -unset IFS - -# Get the list of test targets for this shard -declare s=${SHARD_INDEX} -declare SHARD_TARGETS=() -for target in ${TEST_TARGETS[@]:-}; do - if (( ${s} % ${MAX_SHARDS} == 0 )); then - SHARD_TARGETS+=("${target}") - fi - ((s=s+1)) -done - -# Run integration tests -echo "Shard index ${SHARD_INDEX} of ${MAX_SHARDS} shards" -echo "Targets: ${SHARD_TARGETS[@]:-}" -echo -bazel test --local_ram_resources=792 --test_arg=--local_ram_resources=13312 --test_arg=--local_cpu_resources=7 ${SHARD_TARGETS[@]:-} --test_output=streamed diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..aed9ec381f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +docs/Built-ins.md linguist-generated=true +docs/Concatjs.md linguist-generated=true +docs/Cypress.md linguist-generated=true +docs/esbuild.md linguist-generated=true +docs/Jasmine.md linguist-generated=true +docs/Karma.md linguist-generated=true +docs/Protractor.md linguist-generated=true +docs/Providers.md linguist-generated=true +docs/Rollup.md linguist-generated=true +docs/Terser.md linguist-generated=true +docs/Toolchains.md linguist-generated=true +docs/TypeScript.md linguist-generated=true diff --git a/.github/BUILD.bazel b/.github/BUILD.bazel index 707962f30c..9a7493bd17 100644 --- a/.github/BUILD.bazel +++ b/.github/BUILD.bazel @@ -8,15 +8,14 @@ generate_codeowners( # do not sort owners = [ "//:OWNERS", - "//packages/labs:OWNERS", "//packages/rollup:OWNERS", + "//packages/esbuild:OWNERS", "//packages/cypress:OWNERS", - "//packages/angular:OWNERS", "//examples:OWNERS.examples_jest", "//examples:OWNERS.examples_nestjs", + "//examples:OWNERS.examples_esbuild", "//examples:OWNERS.examples_cypress", "//examples:OWNERS.examples_angular", - "//examples:OWNERS.examples_protocol_buffers", "//examples:OWNERS.examples_angular_bazel_architect", ], ) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3b0dafa7f2..f9677e46bf 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,14 +2,13 @@ # To update, run: # yarn update-codeowners -* @mattem @gregmagolan @soldair @alexeagle -/packages/labs/** @mrmeku @alexeagle @gregmagolan @mattem +* @mattem @gregmagolan @alexeagle /packages/rollup/** @jbedard @alexeagle @gregmagolan @mattem +/packages/esbuild/** @mattem @alexeagle @gregmagolan /packages/cypress/** @mrmeku @alexeagle @gregmagolan @mattem -/packages/angular/** @alan-agius4 @alexeagle @gregmagolan @mattem /examples/jest/** @mrmeku @alexeagle @gregmagolan @mattem /examples/nestjs/** @zachgrayio @zMotivat0r @rayman1104 @siberex @alexeagle @gregmagolan @mattem +/examples/esbuild/** @mattem @alexeagle @gregmagolan /examples/cypress/** @mrmeku @alexeagle @gregmagolan @mattem -/examples/angular/** @alan-agius4 @alexeagle @gregmagolan @mattem -/examples/protocol_buffers/** @mrmeku @alexeagle @gregmagolan @mattem -/examples/angular_bazel_architect/** @alan-agius4 @alexeagle @gregmagolan @mattem +/examples/angular/** @alan-agius4 @jbedard @alexeagle @gregmagolan @mattem +/examples/angular_bazel_architect/** @alan-agius4 @jbedard @alexeagle @gregmagolan @mattem diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml new file mode 100644 index 0000000000..983c835b03 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml @@ -0,0 +1,56 @@ +name: Bug Report +description: File a bug report to help us improve +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + **rules_nodejs is mostly unmaintained!** + + Only the "core" module (code under the /nodejs folder) is maintained by volunteers from Aspect.dev. + This includes only the nodejs toolchain and a few Provider types. + + If you're having an issue with anything else, you can still file it but you shouldn't expect any help. + + If you're looking for support, try the `#javascript` channel on [Bazel slack](https://slack.bazel.build). + + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + validations: + required: true + + - type: textarea + id: version + attributes: + label: Version + description: Please tell us about your environment + value: | + Development (host) and target OS/architectures: + + Output of `bazel --version`: + + Version of rules_nodejs, or other relevant rules from your + `WORKSPACE` or `MODULE.bazel` file: + + Language(s) and/or frameworks involved: + validations: + required: true + + - type: textarea + id: repro + attributes: + label: How to reproduce + description: Your bug is more likely to be resolved if you provide the steps to reproduce, and if possible a minimal demo of the problem. + render: shell + + - type: textarea + id: other + attributes: + label: Any other information? + description: | + (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, things you've tried, links for us to have context, eg. stackoverflow, gitter, etc) diff --git a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml new file mode 100644 index 0000000000..9c446fefb9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml @@ -0,0 +1,29 @@ +name: Feature Request +description: Suggest an idea for the rules_nodejs toolchain +title: "[FR]: " +labels: ["enhancement"] +body: + + - type: markdown + attributes: + value: | + **rules_nodejs is mostly unmaintained!** + + Only the "core" module (code under the /nodejs folder) is maintained by volunteers from Aspect.dev. + This includes only the nodejs toolchain and a few Provider types. + + Features outside that module are probably never going to be built or accepted. + + - type: textarea + id: current + attributes: + label: What is the current behavior? + description: To make sure we agree on this. + + - type: textarea + id: idea + attributes: + label: Describe the feature + description: What is the motivation / use case for changing the behavior? + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 9af40c31eb..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -name: "\U0001F41EBug report" -about: Report a bug in rules_nodejs ---- - - - -# 🐞 bug report - -### Affected Rule - - - The issue is caused by the rule: - - -### Is this a regression? - - - Yes, the previous version in which this bug was not present was: .... - - -### Description - - A clear and concise description of the problem... - - -## πŸ”¬ Minimal Reproduction - - - -## πŸ”₯ Exception or Error - -

-
-
-
-
-
- - -## 🌍 Your Environment - -**Operating System:** - -
-  
-
-  
-
- -**Output of `bazel version`:** - -
-  
-
-  
-
- -**Rules_nodejs version:** - -(Please check that you have matching versions between WORKSPACE file and `@bazel/*` npm packages.) - -
-  
-
-  
-
- -**Anything else relevant?** - diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 817af88720..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -name: "\U0001F680Feature request" -about: Suggest a feature for rules_nodejs - ---- - - - -# πŸš€ feature request - -### Relevant Rules - - - - - -### Description - - A clear and concise description of the problem or missing capability... - - -### Describe the solution you'd like - - If you have a solution in mind, please describe it. - - -### Describe alternatives you've considered - - Have you considered any alternative solutions or workarounds? - diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fb65d362e2..7095015afc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,8 +7,14 @@ on: # run at 01:30 UTC daily - cron: "30 1 * * *" +permissions: + contents: read + jobs: stale: + permissions: + issues: write # for actions/stale to close stale issues + pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-latest steps: @@ -17,9 +23,9 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} # The number of days old an issue can be before marking it stale. - days-before-stale: 90 + days-before-stale: 183 # Number of days of inactivity before a stale issue is closed - days-before-close: 14 + days-before-close: 30 # If an issue/PR is assigned, trust the assignee to stay involved # Can revisit if these get stale @@ -33,22 +39,22 @@ jobs: stale-issue-message: > This issue has been automatically marked as stale because it has not had - any activity for 90 days. - It will be closed if no further activity occurs in two weeks. + any activity for 6 months. + It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! stale-pr-message: > This Pull Request has been automatically marked as stale because it has not had - any activity for 90 days. - It will be closed if no further activity occurs in two weeks. + any activity for 6 months. + It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! close-issue-message: > - This issue was automatically closed because it went two weeks without a reply + This issue was automatically closed because it went 30 days without any activity since it was labeled "Can Close?" close-pr-message: > - This PR was automatically closed because it went two weeks without a reply + This PR was automatically closed because it went 30 days without any activity since it was labeled "Can Close?" diff --git a/.github/workflows/update-nodejs-versions.yml b/.github/workflows/update-nodejs-versions.yml index 2d7d951a62..5107713392 100644 --- a/.github/workflows/update-nodejs-versions.yml +++ b/.github/workflows/update-nodejs-versions.yml @@ -5,6 +5,9 @@ on: # run at 01:30 UTC daily - cron: '30 1 * * *' +permissions: + contents: read + jobs: updateNodejsVersions: runs-on: ubuntu-latest diff --git a/.github/workflows/update-yarn-versions.yml b/.github/workflows/update-yarn-versions.yml new file mode 100644 index 0000000000..f6bfec104b --- /dev/null +++ b/.github/workflows/update-yarn-versions.yml @@ -0,0 +1,44 @@ +name: Update yarn versions + +on: + schedule: + # run at 01:30 UTC daily + - cron: '30 1 * * *' + +permissions: + contents: read + +jobs: + updateNodejsVersions: + runs-on: ubuntu-latest + + # Skip this on forks + if: github.repository == 'bazelbuild/rules_nodejs' + + steps: + - name: Git Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup NodeJS + uses: actions/setup-node@v2 + with: + node-version: '14.x' + + - name: Run yarn update-yarn-versions + run: yarn run update-yarn-versions + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.PAT }} + commit-message: Update yarn versions + title: Update yarn versions + body: | + - Updated yarn versions using `yarn run update-yarn-versions` + + Auto-generated by [create-pull-request][1] + + [1]: https://github.com/peter-evans/create-pull-request + branch: update-yarn-versions diff --git a/.npmrc b/.npmrc index 615ae5d971..f6d27a33fa 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,3 @@ tag-version-prefix="" message="chore(release): %s" +registry=https://registry.npmjs.org \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..ee1b667c13 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +# See CONTRIBUTING.md for instructions. +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/keith/pre-commit-buildifier + rev: 4.0.1.1 + hooks: + - id: buildifier + args: &args + # Keep this argument in sync with .bazelci/presubmit.yml + - --warnings=-bzl-visibility,-function-docstring-args,-function-docstring-return,-print,-unnamed-macro,-provider-params,-function-docstring-header,-no-effect,-uninitialized,-rule-impl-return + - id: buildifier-lint + args: *args diff --git a/BUILD.bazel b/BUILD.bazel index 2621330cc5..8f050e8b5d 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -40,9 +40,12 @@ bzl_library( name = "bzl", srcs = [ "index.bzl", - "index.for_docs.bzl", "providers.bzl", "version.bzl", + # BEGIN-INTERNAL + ] + [ + "index.for_docs.bzl", + # END-INTERNAL ], visibility = ["//visibility:public"], deps = [ @@ -50,10 +53,11 @@ bzl_library( "//internal/generated_file_test:bzl", "//internal/js_library:bzl", "//internal/linker:bzl", + "//internal/node:bzl", "//internal/pkg_npm:bzl", "//internal/pkg_web:bzl", "//internal/providers:bzl", - "//toolchains/node:bzl", + "@rules_nodejs//nodejs/private/providers:bzl", ], ) @@ -63,15 +67,18 @@ codeowners( teams = [ "@mattem", "@gregmagolan", - "@soldair", ], ) pkg_npm( name = "rules_nodejs_package", - srcs = glob(["*.bzl"]) + [ + srcs = [ "BUILD.bazel", "LICENSE", + "index.bzl", + "providers.bzl", + "repositories.bzl", + "version.bzl", ], substitutions = COMMON_REPLACEMENTS, deps = [ @@ -104,7 +111,8 @@ pkg_npm( "//third_party/npm/node_modules/browserify:package_contents", "//third_party/npm/node_modules/ieee754:package_contents", "//third_party/npm/node_modules/named-amd:package_contents", - "//toolchains/node:package_contents", + "//toolchains/cypress:package_contents", + "//toolchains/esbuild:package_contents", ], ) @@ -116,4 +124,18 @@ pkg_tar( strip_prefix = "./rules_nodejs_package", tags = ["manual"], ) + +pkg_tar( + name = "release-core", + srcs = [ + "LICENSE", + "README.md", + "version.bzl", + "//nodejs:package_contents", + # TODO(5.0) remove this and depend on real skylib + "//third_party/github.com/bazelbuild/bazel-skylib:package_contents", + ], + extension = "tar.gz", + strip_prefix = ".", +) # END-INTERNAL diff --git a/CHANGELOG.md b/CHANGELOG.md index eaddb1477a..faf1518ecf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,681 @@ +## [5.8.2](https://github.com/bazelbuild/rules_nodejs/compare/5.8.1...5.8.2) (2023-02-24) + + +### Bug Fixes + +* allow root repositories to override node toolchain version under ([ce13837](https://github.com/bazelbuild/rules_nodejs/commit/ce13837)) + + + +## [5.8.1](https://github.com/bazelbuild/rules_nodejs/compare/5.7.3...5.8.1) (2023-02-16) + + +### Bug Fixes + +* **builtin:** convert pkg_web to use cjs instead of js ([#3500](https://github.com/bazelbuild/rules_nodejs/issues/3500)) ([d36a73a](https://github.com/bazelbuild/rules_nodejs/commit/d36a73a)) +* **concatjs:** resolve error with TypeScript 5.0 ([e073e18](https://github.com/bazelbuild/rules_nodejs/commit/e073e18)) + + +### Features + +* provide [@nodejs](https://github.com/nodejs) repository ([a5755eb](https://github.com/bazelbuild/rules_nodejs/commit/a5755eb)), closes [#3375](https://github.com/bazelbuild/rules_nodejs/issues/3375) + + + +## [5.7.3](https://github.com/bazelbuild/rules_nodejs/compare/5.7.2...5.7.3) (2022-12-09) + + +### Bug Fixes + +* **builtin:** entry point from sources used when used as tool ([#3605](https://github.com/bazelbuild/rules_nodejs/issues/3605)) ([417711d](https://github.com/bazelbuild/rules_nodejs/commit/417711d)) + + + +## [5.7.2](https://github.com/bazelbuild/rules_nodejs/compare/5.7.1...5.7.2) (2022-11-27) + + +### Bug Fixes + +* check RUNFILES env variable in @bazel/runfiles helper ([#3602](https://github.com/bazelbuild/rules_nodejs/issues/3602)) ([11395ea](https://github.com/bazelbuild/rules_nodejs/commit/11395ea)) +* yarn binary is now run from separate [@yarn](https://github.com/yarn) repo ([dafc2db](https://github.com/bazelbuild/rules_nodejs/commit/dafc2db)), closes [#3530](https://github.com/bazelbuild/rules_nodejs/issues/3530) + + + +## [5.7.1](https://github.com/bazelbuild/rules_nodejs/compare/5.7.0...5.7.1) (2022-10-26) + + + +# [5.7.0](https://github.com/bazelbuild/rules_nodejs/compare/5.6.0...5.7.0) (2022-10-06) + + +### Bug Fixes + +* **builtin:** fix a bug where the launcher produces incorrect runfiles path on windows ([#3562](https://github.com/bazelbuild/rules_nodejs/issues/3562)) ([b02128b](https://github.com/bazelbuild/rules_nodejs/commit/b02128b)) +* **builtin:** use updated rules_js launcher logic to source RUNFILES ([#3557](https://github.com/bazelbuild/rules_nodejs/issues/3557)) ([c725169](https://github.com/bazelbuild/rules_nodejs/commit/c725169)) + + +### Features + +* add npm binary & files to toolchain provider ([#3570](https://github.com/bazelbuild/rules_nodejs/issues/3570)) ([7ca0688](https://github.com/bazelbuild/rules_nodejs/commit/7ca0688)) + + + +# [5.6.0](https://github.com/bazelbuild/rules_nodejs/compare/5.5.4...5.6.0) (2022-09-27) + + +### Bug Fixes + +* **builtin:** properly quote env vars passed to nodejs_binary ([#3553](https://github.com/bazelbuild/rules_nodejs/issues/3553)) ([ffa3ffb](https://github.com/bazelbuild/rules_nodejs/commit/ffa3ffb)) +* **typescript:** include all .json in js_library DeclarationInfo ([#3556](https://github.com/bazelbuild/rules_nodejs/issues/3556)) ([f297e81](https://github.com/bazelbuild/rules_nodejs/commit/f297e81)), closes [#3551](https://github.com/bazelbuild/rules_nodejs/issues/3551) +* canonicalize @platforms//cpu:aarch64 ([#3555](https://github.com/bazelbuild/rules_nodejs/issues/3555)) ([b341421](https://github.com/bazelbuild/rules_nodejs/commit/b341421)), closes [/github.com/bazelbuild/platforms/blob/212a486d66569b29c95b00364e2584e80fd08614/cpu/BUILD#L16-L20](https://github.com//github.com/bazelbuild/platforms/blob/212a486d66569b29c95b00364e2584e80fd08614/cpu/BUILD/issues/L16-L20) + + +### Features + +* **create:** introduce `--workspaceDir` flag ([3a28a02](https://github.com/bazelbuild/rules_nodejs/commit/3a28a02)) +* add support for darwin arm for concatjs ([#3554](https://github.com/bazelbuild/rules_nodejs/issues/3554)) ([acf88a1](https://github.com/bazelbuild/rules_nodejs/commit/acf88a1)) + + + +## [5.5.4](https://github.com/bazelbuild/rules_nodejs/compare/5.5.3...5.5.4) (2022-09-10) + + +### Bug Fixes + +* `ts_project` fail if `root_dir` used deep in source tree ([#3535](https://github.com/bazelbuild/rules_nodejs/issues/3535)) ([dccbb63](https://github.com/bazelbuild/rules_nodejs/commit/dccbb63)) +* make catch-all node_modules target name configurable in yarn_install and npm_install ([#3538](https://github.com/bazelbuild/rules_nodejs/issues/3538)) ([6c462c4](https://github.com/bazelbuild/rules_nodejs/commit/6c462c4)) + + + +## [5.5.3](https://github.com/bazelbuild/rules_nodejs/compare/5.5.2...5.5.3) (2022-08-01) + + +### Bug Fixes + +* delete ngrx from README. Currently not used ([#3513](https://github.com/bazelbuild/rules_nodejs/issues/3513)) ([828d77c](https://github.com/bazelbuild/rules_nodejs/commit/828d77c)) +* **concatjs:** sync with internal change to ensure it works with `tsickle` host ([#3510](https://github.com/bazelbuild/rules_nodejs/issues/3510)) ([78a0528](https://github.com/bazelbuild/rules_nodejs/commit/78a0528)) +* limit concurrency when generating BUILD files in npm_install and yarn_install ([#3509](https://github.com/bazelbuild/rules_nodejs/issues/3509)) ([4001716](https://github.com/bazelbuild/rules_nodejs/commit/4001716)) + + + +## [5.5.2](https://github.com/bazelbuild/rules_nodejs/compare/5.5.1...5.5.2) (2022-07-10) + + +### Bug Fixes + +* **builtin:** remove unnecessary loader script ([#3495](https://github.com/bazelbuild/rules_nodejs/issues/3495)) ([1641136](https://github.com/bazelbuild/rules_nodejs/commit/1641136)) +* **create:** make `--packageManager` flag work ([#3498](https://github.com/bazelbuild/rules_nodejs/issues/3498)) ([cd3db48](https://github.com/bazelbuild/rules_nodejs/commit/cd3db48)) + + + +## [5.5.1](https://github.com/bazelbuild/rules_nodejs/compare/5.5.0...5.5.1) (2022-06-24) + + +### Bug Fixes + +* **builtin:** fix an bug where a nodejs_binary would fail to resolve an npm package when the linker is disabled ([#3492](https://github.com/bazelbuild/rules_nodejs/issues/3492)) ([8a2dfc8](https://github.com/bazelbuild/rules_nodejs/commit/8a2dfc8)) +* **typescript:** remove protobufjs dependency ([#3491](https://github.com/bazelbuild/rules_nodejs/issues/3491)) ([d46502d](https://github.com/bazelbuild/rules_nodejs/commit/d46502d)) +* deterministic output from ts_options_validator ([#3462](https://github.com/bazelbuild/rules_nodejs/issues/3462)) ([d69c646](https://github.com/bazelbuild/rules_nodejs/commit/d69c646)), closes [#3461](https://github.com/bazelbuild/rules_nodejs/issues/3461) + + + +# [5.5.0](https://github.com/bazelbuild/rules_nodejs/compare/5.4.1...5.5.0) (2022-05-18) + + +### Bug Fixes + +* **docs:** stray text in npm_install docs ([#3450](https://github.com/bazelbuild/rules_nodejs/issues/3450)) ([6d519eb](https://github.com/bazelbuild/rules_nodejs/commit/6d519eb)) +* **examples:** fix architect example on m1 ([#3447](https://github.com/bazelbuild/rules_nodejs/issues/3447)) ([d234328](https://github.com/bazelbuild/rules_nodejs/commit/d234328)) +* **typescript:** correctly process diagnostics in worker mode ([#3441](https://github.com/bazelbuild/rules_nodejs/issues/3441)) ([e4842c1](https://github.com/bazelbuild/rules_nodejs/commit/e4842c1)) +* set correct linking location for yarn_install using package.json from external repository ([#3442](https://github.com/bazelbuild/rules_nodejs/issues/3442)) ([55a84d1](https://github.com/bazelbuild/rules_nodejs/commit/55a84d1)) +* **concatjs:** adding devmode to BazelOpts ([#3433](https://github.com/bazelbuild/rules_nodejs/issues/3433)) ([5afaab8](https://github.com/bazelbuild/rules_nodejs/commit/5afaab8)) + + +### Features + +* **builtin:** expand make vars in nodejs_binary/test env attr ([#3456](https://github.com/bazelbuild/rules_nodejs/issues/3456)) ([353593c](https://github.com/bazelbuild/rules_nodejs/commit/353593c)) +* **rollup:** support esm configurations to be provided ([#3435](https://github.com/bazelbuild/rules_nodejs/issues/3435)) ([7bac805](https://github.com/bazelbuild/rules_nodejs/commit/7bac805)) +* expose [@nodejs](https://github.com/nodejs)_host//:bin/node without using alias ([#3434](https://github.com/bazelbuild/rules_nodejs/issues/3434)) ([506eebc](https://github.com/bazelbuild/rules_nodejs/commit/506eebc)) + + + +## [5.4.2](https://github.com/bazelbuild/rules_nodejs/compare/5.4.1...5.4.2) (2022-04-29) + + +### Bug Fixes + +* **concatjs:** adding devmode to BazelOpts ([#3433](https://github.com/bazelbuild/rules_nodejs/issues/3433)) ([5afaab8](https://github.com/bazelbuild/rules_nodejs/commit/5afaab8)) + + +### Features + +* expose [@nodejs](https://github.com/nodejs)_host//:bin/node without using alias ([7d338cb](https://github.com/bazelbuild/rules_nodejs/commit/7d338cb)) + + + +## [5.4.1](https://github.com/bazelbuild/rules_nodejs/compare/5.4.0...5.4.1) (2022-04-25) + + +### Bug Fixes + +* **concatjs:** resolve error with TypeScript 4.7 ([#3420](https://github.com/bazelbuild/rules_nodejs/issues/3420)) ([1074231](https://github.com/bazelbuild/rules_nodejs/commit/1074231)) +* enable stardoc generation for rules that depend on ts in core ([#3394](https://github.com/bazelbuild/rules_nodejs/issues/3394)) ([5d1c2ad](https://github.com/bazelbuild/rules_nodejs/commit/5d1c2ad)) +* **builtin:** fix a bug where mjs entry points were not added to ([#3406](https://github.com/bazelbuild/rules_nodejs/issues/3406)) ([e24473c](https://github.com/bazelbuild/rules_nodejs/commit/e24473c)) +* **builtin:** improve execution requirements for copy file operations ([#3413](https://github.com/bazelbuild/rules_nodejs/issues/3413)) ([43e478d](https://github.com/bazelbuild/rules_nodejs/commit/43e478d)) +* **jasmine:** allow cjs specs + add cjs/mjs tests ([#3401](https://github.com/bazelbuild/rules_nodejs/issues/3401)) ([dd7e778](https://github.com/bazelbuild/rules_nodejs/commit/dd7e778)) + + + +# [5.4.0](https://github.com/bazelbuild/rules_nodejs/compare/5.3.1...5.4.0) (2022-04-06) + + +### Bug Fixes + +* exports_directories_only causes node to resolve from runfiles/node_modules ([#3380](https://github.com/bazelbuild/rules_nodejs/issues/3380)) ([5bf3782](https://github.com/bazelbuild/rules_nodejs/commit/5bf3782)) +* use -R in copy_file(is_dir=True) so macos & linux behavior are the same ([#3383](https://github.com/bazelbuild/rules_nodejs/issues/3383)) ([2fd97fb](https://github.com/bazelbuild/rules_nodejs/commit/2fd97fb)) +* use python3 instead of python in unittest.bash ([#3382](https://github.com/bazelbuild/rules_nodejs/issues/3382)) ([b74d12d](https://github.com/bazelbuild/rules_nodejs/commit/b74d12d)) + + +### Features + +* **builtin:** add basic ESM support ([bc62f37](https://github.com/bazelbuild/rules_nodejs/commit/bc62f37)) +* **jasmine:** add basic ESM support ([b4b2c74](https://github.com/bazelbuild/rules_nodejs/commit/b4b2c74)) + + + +## [5.3.1](https://github.com/bazelbuild/rules_nodejs/compare/5.3.0...5.3.1) (2022-03-29) + + +### Bug Fixes + +* condition on target instead of exec ([#3373](https://github.com/bazelbuild/rules_nodejs/issues/3373)) ([43159a5](https://github.com/bazelbuild/rules_nodejs/commit/43159a5)) +* **builtin:** require correct runfiles path to chdir script ([#3374](https://github.com/bazelbuild/rules_nodejs/issues/3374)) ([9ed16c0](https://github.com/bazelbuild/rules_nodejs/commit/9ed16c0)) + + + +# [5.3.0](https://github.com/bazelbuild/rules_nodejs/compare/5.2.0...5.3.0) (2022-03-20) + + +### Bug Fixes + +* **builtin:** `yarn_install` with vendored yarn `.cjs` file breaks ([#3350](https://github.com/bazelbuild/rules_nodejs/issues/3350)) ([4a025c0](https://github.com/bazelbuild/rules_nodejs/commit/4a025c0)) +* **builtin:** default STDOUT_CAPTURE_IS_NOT_AN_OUTPUT to falsey ([#3364](https://github.com/bazelbuild/rules_nodejs/issues/3364)) ([11952b1](https://github.com/bazelbuild/rules_nodejs/commit/11952b1)) +* **concatjs:** tsc-wrapped compilation workers are subject to linker race-conditions ([#3370](https://github.com/bazelbuild/rules_nodejs/issues/3370)) ([d907eb5](https://github.com/bazelbuild/rules_nodejs/commit/d907eb5)) +* **jasmine:** sharded test never fail when using Jasmine < 4 ([#3360](https://github.com/bazelbuild/rules_nodejs/issues/3360)) ([add1452](https://github.com/bazelbuild/rules_nodejs/commit/add1452)) +* update source for generated docs ([#3354](https://github.com/bazelbuild/rules_nodejs/issues/3354)) ([097732b](https://github.com/bazelbuild/rules_nodejs/commit/097732b)) +* **runfiles:** use normalized paths when guarding runfiles root and node_modules on Windows ([#3331](https://github.com/bazelbuild/rules_nodejs/issues/3331)) ([7993296](https://github.com/bazelbuild/rules_nodejs/commit/7993296)) + + +### Features + +* **builtin:** add silent_on_success option to npm_package_bin ([#3336](https://github.com/bazelbuild/rules_nodejs/issues/3336)) ([78aefa3](https://github.com/bazelbuild/rules_nodejs/commit/78aefa3)) + + + +# [5.2.0](https://github.com/bazelbuild/rules_nodejs/compare/5.1.0...5.2.0) (2022-03-01) + + +### Bug Fixes + +* **builtin:** avoid unnecessary chdir to prevent worker threads from failing ([550673f](https://github.com/bazelbuild/rules_nodejs/commit/550673f)) +* **builtin:** take custom node_repositories value into account when checking if Node version exists for the platform ([#3339](https://github.com/bazelbuild/rules_nodejs/issues/3339)) ([5a1cbfa](https://github.com/bazelbuild/rules_nodejs/commit/5a1cbfa)) +* **builtin:** use srcs on genrule to not build tool for host ([#3344](https://github.com/bazelbuild/rules_nodejs/issues/3344)) ([17e3e2b](https://github.com/bazelbuild/rules_nodejs/commit/17e3e2b)) +* **typescript:** account for rootDir when predicting json output paths ([#3348](https://github.com/bazelbuild/rules_nodejs/issues/3348)) ([bd36cd0](https://github.com/bazelbuild/rules_nodejs/commit/bd36cd0)), closes [#3330](https://github.com/bazelbuild/rules_nodejs/issues/3330) + + +### Features + +* **builtin:** perform make variable substitution in npm_package_bin env vars ([#3343](https://github.com/bazelbuild/rules_nodejs/issues/3343)) ([dfe4392](https://github.com/bazelbuild/rules_nodejs/commit/dfe4392)) +* **examples:** example jest add junit reporter ([#3338](https://github.com/bazelbuild/rules_nodejs/issues/3338)) ([840395f](https://github.com/bazelbuild/rules_nodejs/commit/840395f)) +* **typescript:** warn the user when rootDirs looks wrong in ts_proje… ([#3126](https://github.com/bazelbuild/rules_nodejs/issues/3126)) ([8df86cc](https://github.com/bazelbuild/rules_nodejs/commit/8df86cc)) + + + +# [5.1.0](https://github.com/bazelbuild/rules_nodejs/compare/5.0.2...5.1.0) (2022-02-02) + + +### Bug Fixes + +* **builtin:** make linker aspect run in constant time per target ([522fd7c](https://github.com/bazelbuild/rules_nodejs/commit/522fd7c)) +* **builtin:** reduce linker debug string allocations ([#3309](https://github.com/bazelbuild/rules_nodejs/issues/3309)) ([fb2eeac](https://github.com/bazelbuild/rules_nodejs/commit/fb2eeac)) +* **typescript:** include workspace name in relativize helper ([f78a2b8](https://github.com/bazelbuild/rules_nodejs/commit/f78a2b8)) + + +### Features + +* **typescript:** added support for using non-file targets in srcs of ts_project ([96d37b6](https://github.com/bazelbuild/rules_nodejs/commit/96d37b6)) +* **typescript:** moved file functions to tslb.bzl ([20c5c58](https://github.com/bazelbuild/rules_nodejs/commit/20c5c58)) + + + +## [5.0.2](https://github.com/bazelbuild/rules_nodejs/compare/5.0.1...5.0.2) (2022-01-27) + + +### Bug Fixes + +* **jasmine:** can not reference runner when exports_directories_only=… ([#3293](https://github.com/bazelbuild/rules_nodejs/issues/3293)) ([0be0eeb](https://github.com/bazelbuild/rules_nodejs/commit/0be0eeb)) +* use robocopy in copy_file#is_directory so we don't hit 254 file path limit of xcopy ([#3295](https://github.com/bazelbuild/rules_nodejs/issues/3295)) ([ed0249b](https://github.com/bazelbuild/rules_nodejs/commit/ed0249b)) +* **builtin:** pass kwargs from node_repositories helper ([#3287](https://github.com/bazelbuild/rules_nodejs/issues/3287)) ([b446fa1](https://github.com/bazelbuild/rules_nodejs/commit/b446fa1)) +* **jasmine:** replace deprecated Jasmine APIs that have been removed in version 4 ([#3283](https://github.com/bazelbuild/rules_nodejs/issues/3283)) ([bde750b](https://github.com/bazelbuild/rules_nodejs/commit/bde750b)), closes [#3289](https://github.com/bazelbuild/rules_nodejs/issues/3289) + + + +## [5.0.1](https://github.com/bazelbuild/rules_nodejs/compare/5.0.0...5.0.1) (2022-01-24) + + +### Bug Fixes + +* **builtin:** prevent usage with InputArtifact directories ([553ef27](https://github.com/bazelbuild/rules_nodejs/commit/553ef27)) +* **create:** add missing workspace dependency call ([d15c3dd](https://github.com/bazelbuild/rules_nodejs/commit/d15c3dd)) + + + +# [5.0.0](https://github.com/bazelbuild/rules_nodejs/compare/5.0.0-rc.2...5.0.0) (2022-01-20) + + +### Bug Fixes + +* **builtin:** npm_package_bin include runfiles in DefaultInfo ([#3261](https://github.com/bazelbuild/rules_nodejs/issues/3261)) ([e915877](https://github.com/bazelbuild/rules_nodejs/commit/e915877)) +* **cypress:** use depsets for runfiles and data ([#3240](https://github.com/bazelbuild/rules_nodejs/issues/3240)) ([4889a1a](https://github.com/bazelbuild/rules_nodejs/commit/4889a1a)) +* **typescript:** propagate tags to validate_options ([#3260](https://github.com/bazelbuild/rules_nodejs/issues/3260)) ([4615198](https://github.com/bazelbuild/rules_nodejs/commit/4615198)) + + + +# [5.0.0-rc.2](https://github.com/bazelbuild/rules_nodejs/compare/5.0.0-rc.1...5.0.0-rc.2) (2022-01-17) + + +### Bug Fixes + +* **builtin:** when running vendored yarn, prefix command with path to node ([#3255](https://github.com/bazelbuild/rules_nodejs/issues/3255)) ([ccbf739](https://github.com/bazelbuild/rules_nodejs/commit/ccbf739)) +* angular example needs bump for 5.0 ([#3245](https://github.com/bazelbuild/rules_nodejs/issues/3245)) ([4fd864c](https://github.com/bazelbuild/rules_nodejs/commit/4fd864c)) +* guard node_modules roots for dynamic multi-linked npm deps ([#3248](https://github.com/bazelbuild/rules_nodejs/issues/3248)) ([5ad9753](https://github.com/bazelbuild/rules_nodejs/commit/5ad9753)) +* warning logic for yarn berry attrs ([eaf70f2](https://github.com/bazelbuild/rules_nodejs/commit/eaf70f2)) + + + +# [5.0.0-rc.1](https://github.com/bazelbuild/rules_nodejs/compare/5.0.0-rc.0...5.0.0-rc.1) (2022-01-14) + + + +# [5.0.0-rc.0](https://github.com/bazelbuild/rules_nodejs/compare/4.4.0...5.0.0-rc.0) (2022-01-14) + + +### Bug Fixes + +* allow cypress to run on m1 macs ([#3088](https://github.com/bazelbuild/rules_nodejs/issues/3088)) ([ac96783](https://github.com/bazelbuild/rules_nodejs/commit/ac96783)) +* create a bazel-out node_modules tree using copy_file in the external repo when exports_directories_only is True ([#3241](https://github.com/bazelbuild/rules_nodejs/issues/3241)) ([f5eed08](https://github.com/bazelbuild/rules_nodejs/commit/f5eed08)) +* filter out .d.ts before passing srcs to transpiler ([#3238](https://github.com/bazelbuild/rules_nodejs/issues/3238)) ([11460e8](https://github.com/bazelbuild/rules_nodejs/commit/11460e8)) +* **typescript:** better error when transpiler is used and no declarations are emitted ([72c3662](https://github.com/bazelbuild/rules_nodejs/commit/72c3662)), closes [#3209](https://github.com/bazelbuild/rules_nodejs/issues/3209) +* add arm64 as a platform to //packages/concatjs:docs_scrub_platform ([#3089](https://github.com/bazelbuild/rules_nodejs/issues/3089)) ([8161dcc](https://github.com/bazelbuild/rules_nodejs/commit/8161dcc)) +* bump jasmine-reporters to 2.5.0 ([#3180](https://github.com/bazelbuild/rules_nodejs/issues/3180)) ([efbc33b](https://github.com/bazelbuild/rules_nodejs/commit/efbc33b)) +* change all cfg=host and cfg=target executable attributes to cfg=exec ([9fd3fb9](https://github.com/bazelbuild/rules_nodejs/commit/9fd3fb9)) +* don't symlink execroot node_modules when under bazel run ([d19e20b](https://github.com/bazelbuild/rules_nodejs/commit/d19e20b)) +* merge conflict on 5.x branch ([c91f5b6](https://github.com/bazelbuild/rules_nodejs/commit/c91f5b6)) +* normalize module path passed to runfiles helper for robustness ([#3094](https://github.com/bazelbuild/rules_nodejs/issues/3094)) ([20e121b](https://github.com/bazelbuild/rules_nodejs/commit/20e121b)) +* remove _repository_args from nodejs_binary ([90c7fe0](https://github.com/bazelbuild/rules_nodejs/commit/90c7fe0)) +* remove node and use toolchain ([#3144](https://github.com/bazelbuild/rules_nodejs/issues/3144)) ([cb83746](https://github.com/bazelbuild/rules_nodejs/commit/cb83746)) +* remove trailing forward slash when resolving workspace root link in runfiles MANIFEST ([#3093](https://github.com/bazelbuild/rules_nodejs/issues/3093)) ([bcff217](https://github.com/bazelbuild/rules_nodejs/commit/bcff217)) +* turn off preserve_symlinks in e2e/node_loader_no_preserve_symlinks test ([5410ab2](https://github.com/bazelbuild/rules_nodejs/commit/5410ab2)) +* update linker to be tolerant to linking to different output trees ([0d93719](https://github.com/bazelbuild/rules_nodejs/commit/0d93719)) +* **builtin:** detect yarn 2+ berry and adjust CLI args ([#3195](https://github.com/bazelbuild/rules_nodejs/issues/3195)) ([9b2c08b](https://github.com/bazelbuild/rules_nodejs/commit/9b2c08b)), closes [#3071](https://github.com/bazelbuild/rules_nodejs/issues/3071) [#1599](https://github.com/bazelbuild/rules_nodejs/issues/1599) +* **builtin:** don't use local:1 spawn ([#3084](https://github.com/bazelbuild/rules_nodejs/issues/3084)) ([f77e9fd](https://github.com/bazelbuild/rules_nodejs/commit/f77e9fd)) +* **builtin:** fixed missing dist targets ([#3068](https://github.com/bazelbuild/rules_nodejs/issues/3068)) ([6c13dac](https://github.com/bazelbuild/rules_nodejs/commit/6c13dac)) +* **builtin:** handle external repository file paths in js_library strip_prefix check ([08c75a2](https://github.com/bazelbuild/rules_nodejs/commit/08c75a2)) +* **builtin:** js_library: propagate all default_runfiles ([#3183](https://github.com/bazelbuild/rules_nodejs/issues/3183)) ([d07b104](https://github.com/bazelbuild/rules_nodejs/commit/d07b104)), closes [#3182](https://github.com/bazelbuild/rules_nodejs/issues/3182) +* **builtin:** pkg_npm shouldn't assume the name of the nodejs toolchain ([#3129](https://github.com/bazelbuild/rules_nodejs/issues/3129)) ([552178e](https://github.com/bazelbuild/rules_nodejs/commit/552178e)) +* **builtin:** provide a DeclarationInfo from js_library is any input files are directories (TreeArtifacts) ([a1d49ae](https://github.com/bazelbuild/rules_nodejs/commit/a1d49ae)) +* **builtin:** retrieve yarn shasums from Github releases, rather than npm registry ([88ce34d](https://github.com/bazelbuild/rules_nodejs/commit/88ce34d)) +* **builtin:** support mjs/cjs files as javascript files in `js_library` ([9e9bf01](https://github.com/bazelbuild/rules_nodejs/commit/9e9bf01)) +* **create:** relocate help argument evaluation ([441e3b8](https://github.com/bazelbuild/rules_nodejs/commit/441e3b8)) +* **esbuild:** allow passing additional args to the npm install for esbuild ([#3063](https://github.com/bazelbuild/rules_nodejs/issues/3063)) ([fb2165c](https://github.com/bazelbuild/rules_nodejs/commit/fb2165c)) +* **esbuild:** allow whitespace within args ([#2998](https://github.com/bazelbuild/rules_nodejs/issues/2998)) ([181b55d](https://github.com/bazelbuild/rules_nodejs/commit/181b55d)), closes [#2997](https://github.com/bazelbuild/rules_nodejs/issues/2997) +* **esbuild:** do not ignore annotations when the `minify` shorthand attribute is disabled ([#3106](https://github.com/bazelbuild/rules_nodejs/issues/3106)) ([b1275c5](https://github.com/bazelbuild/rules_nodejs/commit/b1275c5)) +* **esbuild:** format attribute not working with multiple entry points ([#3103](https://github.com/bazelbuild/rules_nodejs/issues/3103)) ([1000e2b](https://github.com/bazelbuild/rules_nodejs/commit/1000e2b)) +* **examples:** run jest updateSnapshot in the workspace ([#3041](https://github.com/bazelbuild/rules_nodejs/issues/3041)) ([e005d82](https://github.com/bazelbuild/rules_nodejs/commit/e005d82)) +* **typescript:** add build_test to ensure typecheck is run under --build_tests_only ([#3196](https://github.com/bazelbuild/rules_nodejs/issues/3196)) ([9622443](https://github.com/bazelbuild/rules_nodejs/commit/9622443)) +* **typescript:** don't set resolveJsonModule in generated tsconfig if tsconfig is dict and resolve_json_module is unset ([19cd74e](https://github.com/bazelbuild/rules_nodejs/commit/19cd74e)) +* **typescript:** ts_project transpiler produces js_library ([#3187](https://github.com/bazelbuild/rules_nodejs/issues/3187)) ([c9a66e0](https://github.com/bazelbuild/rules_nodejs/commit/c9a66e0)) +* [#3054](https://github.com/bazelbuild/rules_nodejs/issues/3054) regression in linker behavior in 4.4.2 ([#3059](https://github.com/bazelbuild/rules_nodejs/issues/3059)) ([92965b2](https://github.com/bazelbuild/rules_nodejs/commit/92965b2)) +* correct bzl_library target graph ([#3049](https://github.com/bazelbuild/rules_nodejs/issues/3049)) ([07df333](https://github.com/bazelbuild/rules_nodejs/commit/07df333)) +* don't link runfiles node_modules to execroot node_modules if there is an external workspace node_modules ([#3060](https://github.com/bazelbuild/rules_nodejs/issues/3060)) ([1d5defa](https://github.com/bazelbuild/rules_nodejs/commit/1d5defa)) +* terser semver compatibility range ([da7399e](https://github.com/bazelbuild/rules_nodejs/commit/da7399e)) +* unset INIT_CWD and npm_config_registry before calling yarn in yarn_install ([b62e1e8](https://github.com/bazelbuild/rules_nodejs/commit/b62e1e8)) +* update tsconfigs to include darwin_arm64-fastbuild in rootDirs ([#3087](https://github.com/bazelbuild/rules_nodejs/issues/3087)) ([1f75f40](https://github.com/bazelbuild/rules_nodejs/commit/1f75f40)) +* **typescript:** don't declare outputs that collide with inputs ([#3046](https://github.com/bazelbuild/rules_nodejs/issues/3046)) ([9b47df1](https://github.com/bazelbuild/rules_nodejs/commit/9b47df1)) +* **typescript:** give better error when noEmit is set ([#3047](https://github.com/bazelbuild/rules_nodejs/issues/3047)) ([74dd86e](https://github.com/bazelbuild/rules_nodejs/commit/74dd86e)) +* simplify portion of linker and fix case where runfiles node_modules symlinks are missing under bazel run ([8c1f26c](https://github.com/bazelbuild/rules_nodejs/commit/8c1f26c)) + + +### chore + +* update default nodejs version to 16 ([#3107](https://github.com/bazelbuild/rules_nodejs/issues/3107)) ([b0930fb](https://github.com/bazelbuild/rules_nodejs/commit/b0930fb)), closes [#3101](https://github.com/bazelbuild/rules_nodejs/issues/3101) + + +### Code Refactoring + +* depend on bazel-skylib at runtime ([#3056](https://github.com/bazelbuild/rules_nodejs/issues/3056)) ([e5d4803](https://github.com/bazelbuild/rules_nodejs/commit/e5d4803)) +* move yarn fetch to a separate external repo ([975ae9b](https://github.com/bazelbuild/rules_nodejs/commit/975ae9b)) +* **builtin:** npm_umd_bundle no longer allows directory sources ([c87ec6b](https://github.com/bazelbuild/rules_nodejs/commit/c87ec6b)) + + +### Features + +* add bzlmod extension ([#3146](https://github.com/bazelbuild/rules_nodejs/issues/3146)) ([878ece2](https://github.com/bazelbuild/rules_nodejs/commit/878ece2)) +* add src patch being copied to progress message of vendored copy_file ([7aafe15](https://github.com/bazelbuild/rules_nodejs/commit/7aafe15)) +* add src patch being copied to progress message of vendored copy_file ([#3206](https://github.com/bazelbuild/rules_nodejs/issues/3206)) ([ddc985c](https://github.com/bazelbuild/rules_nodejs/commit/ddc985c)) +* default package_path to the directory of the package.json file in yarn_install and npm_install ([#3233](https://github.com/bazelbuild/rules_nodejs/issues/3233)) ([dcbad88](https://github.com/bazelbuild/rules_nodejs/commit/dcbad88)) +* macros nodejs_binary_toolchains nodejs_test_toolchains input multiple toolchains nodejs_binary or nodejs_test ([#3132](https://github.com/bazelbuild/rules_nodejs/issues/3132)) ([55a7521](https://github.com/bazelbuild/rules_nodejs/commit/55a7521)) +* set exports_directories_only default to True in yarn_install & npm_install repository rules ([ee0e507](https://github.com/bazelbuild/rules_nodejs/commit/ee0e507)) +* use tree artifacts via copy_directory with exports_directories_only ([91fa0ae](https://github.com/bazelbuild/rules_nodejs/commit/91fa0ae)) +* **builtin:** npm_install/yarn_install node repo ([#3164](https://github.com/bazelbuild/rules_nodejs/issues/3164)) ([8e277e4](https://github.com/bazelbuild/rules_nodejs/commit/8e277e4)) +* **esbuild:** add option to disable metafile generation ([#3066](https://github.com/bazelbuild/rules_nodejs/issues/3066)) ([837cb23](https://github.com/bazelbuild/rules_nodejs/commit/837cb23)) +* **esbuild:** make Starlark build settings usable as defines ([#3122](https://github.com/bazelbuild/rules_nodejs/issues/3122)) ([f22502d](https://github.com/bazelbuild/rules_nodejs/commit/f22502d)) +* **typescript:** allow alternative transpilers ([#3134](https://github.com/bazelbuild/rules_nodejs/issues/3134)) ([507ec3d](https://github.com/bazelbuild/rules_nodejs/commit/507ec3d)), closes [#3133](https://github.com/bazelbuild/rules_nodejs/issues/3133) +* support --stamp env vars in npm_package_bin ([#3162](https://github.com/bazelbuild/rules_nodejs/issues/3162)) ([38fee32](https://github.com/bazelbuild/rules_nodejs/commit/38fee32)) +* **node:** use multiple versions of node, can run old and new toolchains and default behaviour is not broken ([#3125](https://github.com/bazelbuild/rules_nodejs/issues/3125)) ([12a521d](https://github.com/bazelbuild/rules_nodejs/commit/12a521d)) + + +### BREAKING CHANGES + +* vendored_yarn attribute is removed +* The default nodejs version is now 16.12.0. +To go back to the previous default, put this in your WORKSPACE: + +```starlark +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") + +node_repositories( + node_version = "14.17.5", +) +``` +* build_bazel_rules_nodejs now depends on bazel_skylib. +You can install it in your WORKSPACE directly, or use our helper macro like so: +* **builtin:** npm_umd_bundle users cannot use exports_directories_only + + + +# [4.4.0](https://github.com/bazelbuild/rules_nodejs/compare/4.3.0...4.4.0) (2021-10-11) + + +### Bug Fixes + +* ts_proto_library: use correct output path for external protos ([#3002](https://github.com/bazelbuild/rules_nodejs/issues/3002)) ([b48176f](https://github.com/bazelbuild/rules_nodejs/commit/b48176f)) +* **typescript:** typescript downleveling breaking ESM variant of Angular v13 compiler ([#2987](https://github.com/bazelbuild/rules_nodejs/issues/2987)) ([5e4d17d](https://github.com/bazelbuild/rules_nodejs/commit/5e4d17d)) +* update jasmine-reporters to v2.5.0 to fix xmldom vulnerability ([#2994](https://github.com/bazelbuild/rules_nodejs/issues/2994)) ([8ca234b](https://github.com/bazelbuild/rules_nodejs/commit/8ca234b)) + + +### Features + +* **core:** patch bazel-skylib; core can use npm ([#3008](https://github.com/bazelbuild/rules_nodejs/issues/3008)) ([e6ead39](https://github.com/bazelbuild/rules_nodejs/commit/e6ead39)) +* **examples:** change angular example to ts_project ([#2209](https://github.com/bazelbuild/rules_nodejs/issues/2209)) ([73e625a](https://github.com/bazelbuild/rules_nodejs/commit/73e625a)) + + + +# [4.3.0](https://github.com/bazelbuild/rules_nodejs/compare/4.2.0...4.3.0) (2021-09-28) + + +### Bug Fixes + +* **cypress:** use correct label to reference plugins/base.js ([#2977](https://github.com/bazelbuild/rules_nodejs/issues/2977)) ([6acec9d](https://github.com/bazelbuild/rules_nodejs/commit/6acec9d)), closes [#2976](https://github.com/bazelbuild/rules_nodejs/issues/2976) +* **esbuild:** fix depending on testonly targets ([#2984](https://github.com/bazelbuild/rules_nodejs/issues/2984)) ([4278ef1](https://github.com/bazelbuild/rules_nodejs/commit/4278ef1)) +* **runfiles:** don't use false as a no-error value ([#2974](https://github.com/bazelbuild/rules_nodejs/issues/2974)) ([de1eaf6](https://github.com/bazelbuild/rules_nodejs/commit/de1eaf6)) + + +### Features + +* **builtin:** expose a concrete toolchain for rules that don't under… ([#2960](https://github.com/bazelbuild/rules_nodejs/issues/2960)) ([64ad805](https://github.com/bazelbuild/rules_nodejs/commit/64ad805)) +* **esbuild:** bump version of esbuild to 0.13.2 ([#2985](https://github.com/bazelbuild/rules_nodejs/issues/2985)) ([4bb25bf](https://github.com/bazelbuild/rules_nodejs/commit/4bb25bf)) +* **typescript:** support for ESM variant of the Angular compiler plugin ([#2982](https://github.com/bazelbuild/rules_nodejs/issues/2982)) ([6f97a7c](https://github.com/bazelbuild/rules_nodejs/commit/6f97a7c)) + + + +# [4.2.0](https://github.com/bazelbuild/rules_nodejs/compare/4.1.0...4.2.0) (2021-09-17) + + +### Bug Fixes + +* **builtin:** pkg_npm unable to copy files from transitioned actions ([#2942](https://github.com/bazelbuild/rules_nodejs/issues/2942)) ([4291e20](https://github.com/bazelbuild/rules_nodejs/commit/4291e20)) +* **typescript:** exclude package(-lock).json from default ts_project srcs ([0245b6d](https://github.com/bazelbuild/rules_nodejs/commit/0245b6d)) +* **worker:** check if the input digest present ([b43c594](https://github.com/bazelbuild/rules_nodejs/commit/b43c594)) + + +### Features + +* **builtin:** add a toolchain to new core that exposes the node for any platform ([20f4a8f](https://github.com/bazelbuild/rules_nodejs/commit/20f4a8f)) +* **builtin:** add support for stopping propagation of `link_node_modules` aspect ([dedc982](https://github.com/bazelbuild/rules_nodejs/commit/dedc982)) +* introduce "core" package at /nodejs ([a32cf5c](https://github.com/bazelbuild/rules_nodejs/commit/a32cf5c)) + + + +# [4.1.0](https://github.com/bazelbuild/rules_nodejs/compare/4.0.0...4.1.0) (2021-09-10) + + +### Bug Fixes + +* **typescript:** write json srcs to generated tsconfig for resolveJsonModule+composite projects ([c70a07b](https://github.com/bazelbuild/rules_nodejs/commit/c70a07b)) +* readme ([52ee4ef](https://github.com/bazelbuild/rules_nodejs/commit/52ee4ef)) +* remove dependency on shelljs in esbuild-update script ([0f17126](https://github.com/bazelbuild/rules_nodejs/commit/0f17126)) +* update `tsutils` to version `3.21.0` ([bba5494](https://github.com/bazelbuild/rules_nodejs/commit/bba5494)), closes [/github.com/bazelbuild/rules_nodejs/blob/9b454e38f7e2bbc64f75ee9a7dcb6ff45f1c7a12/third_party/github.com/bazelbuild/rules_typescript/internal/tsetse/rules/check_return_value_rule.ts#L60-L62](https://github.com//github.com/bazelbuild/rules_nodejs/blob/9b454e38f7e2bbc64f75ee9a7dcb6ff45f1c7a12/third_party/github.com/bazelbuild/rules_typescript/internal/tsetse/rules/check_return_value_rule.ts/issues/L60-L62) +* use execSync to call npm ([acc64f9](https://github.com/bazelbuild/rules_nodejs/commit/acc64f9)) + + +### Features + +* **builtin:** add support for using a local .nvmrc file for providing a node version ([#2911](https://github.com/bazelbuild/rules_nodejs/issues/2911)) ([44740df](https://github.com/bazelbuild/rules_nodejs/commit/44740df)) +* decouple @bazel/worker from rules_typescript ([#2918](https://github.com/bazelbuild/rules_nodejs/issues/2918)) ([bda0472](https://github.com/bazelbuild/rules_nodejs/commit/bda0472)) + + + +# [4.0.0](https://github.com/bazelbuild/rules_nodejs/compare/4.0.0-rc.1...4.0.0) (2021-08-24) + + +### Bug Fixes + +* **create:** remove skylib install ([0125a46](https://github.com/bazelbuild/rules_nodejs/commit/0125a46)) +* update Skylib hash ([010d12f](https://github.com/bazelbuild/rules_nodejs/commit/010d12f)) +* **cypress:** add js files from JSModuleInfo to plugin wrapper sources if available ([1274c59](https://github.com/bazelbuild/rules_nodejs/commit/1274c59)) +* update usages of `ExternalNpmPackageInfo.path` to be safe and default to empty string ([eacbcf7](https://github.com/bazelbuild/rules_nodejs/commit/eacbcf7)), closes [/github.com/bazelbuild/rules_postcss/blob/2bd16fda40cd4bf4fbf0b477b968366ec1602103/internal/plugin.bzl#L30-L41](https://github.com//github.com/bazelbuild/rules_postcss/blob/2bd16fda40cd4bf4fbf0b477b968366ec1602103/internal/plugin.bzl/issues/L30-L41) + + + +# [4.0.0-rc.1](https://github.com/bazelbuild/rules_nodejs/compare/4.0.0-rc.0...4.0.0-rc.1) (2021-08-19) + + +### Bug Fixes + +* **cypress:** don't eager-fetch the npm repository just to get the cypress toolchain ([e661da6](https://github.com/bazelbuild/rules_nodejs/commit/e661da6)) +* **esbuild:** distribute esbuild_repositories function in the built-in, not the @bazel/esbuild package ([c164c6d](https://github.com/bazelbuild/rules_nodejs/commit/c164c6d)) + +### Features + +* **builtin:** added support of linux ppc64le ([582ecc1](https://github.com/bazelbuild/rules_nodejs/commit/582ecc1)) + + + +# [4.0.0-rc.0](https://github.com/bazelbuild/rules_nodejs/compare/4.0.0-beta.1...4.0.0-rc.0) (2021-08-13) + + +### Bug Fixes + +* remove current directory prefix when running from execroot ([9771b74](https://github.com/bazelbuild/rules_nodejs/commit/9771b74)) +* **builtin:** correctly calculate pkg._directDependency when a mapped node_module is used ([32551a5](https://github.com/bazelbuild/rules_nodejs/commit/32551a5)) +* **typescript:** do not re-declare .json output files in srcs if they are already generated files ([38a9584](https://github.com/bazelbuild/rules_nodejs/commit/38a9584)) +* **typescript:** document tsc_test for typecheck-only ([20f90c5](https://github.com/bazelbuild/rules_nodejs/commit/20f90c5)) +* version script should replace beta versions ([e8f5f06](https://github.com/bazelbuild/rules_nodejs/commit/e8f5f06)) + + +### Features + +* **esbuild:** add support for plugins via supplying a configuration file ([5551bff](https://github.com/bazelbuild/rules_nodejs/commit/5551bff)) +* **esbuild:** add support for plugins via supplying a configuration file ([#2840](https://github.com/bazelbuild/rules_nodejs/issues/2840)) ([c95d9ca](https://github.com/bazelbuild/rules_nodejs/commit/c95d9ca)) +* **esbuild:** support stamping via config file ([413f73d](https://github.com/bazelbuild/rules_nodejs/commit/413f73d)) + + + +# [4.0.0-beta.1](https://github.com/bazelbuild/rules_nodejs/compare/4.0.0-beta.0...4.0.0-beta.1) (2021-07-27) + + +### Bug Fixes + +* add missing SHA for rules_proto ([#2830](https://github.com/bazelbuild/rules_nodejs/issues/2830)) ([e822b95](https://github.com/bazelbuild/rules_nodejs/commit/e822b95)) +* **esbuild:** generate correct path mappings as mappings aspect no longer produces an array ([#2834](https://github.com/bazelbuild/rules_nodejs/issues/2834)) ([b79e3f4](https://github.com/bazelbuild/rules_nodejs/commit/b79e3f4)) +* **typescript:** fix bug in ts_project (write_tsconfig_rule) when extending from a generated tsconfig in same folder ([4e396eb](https://github.com/bazelbuild/rules_nodejs/commit/4e396eb)) + + +### Features + +* **builtin:** add package_json_remove and package_json_replace attributes to yarn_install & npm_install ([b68be36](https://github.com/bazelbuild/rules_nodejs/commit/b68be36)) + + + +# [4.0.0-beta.0](https://github.com/bazelbuild/rules_nodejs/compare/3.5.0...4.0.0-beta.0) (2021-07-02) + + +### Bug Fixes + +* **builtin:** don't expose any darwin_arm64 repo or toolchains if not supported by the node version ([6748383](https://github.com/bazelbuild/rules_nodejs/commit/6748383)), closes [#2779](https://github.com/bazelbuild/rules_nodejs/issues/2779) +* **builtin:** fix npm_install & yarn_install post_install_patches when symlink_node_modules is enabled ([5fce733](https://github.com/bazelbuild/rules_nodejs/commit/5fce733)) +* **builtin:** generated nodejs repository for windows references non-existent file ([4487698](https://github.com/bazelbuild/rules_nodejs/commit/4487698)) +* **builtin:** propogate tags to both generated targets in generated_file_test ([e980107](https://github.com/bazelbuild/rules_nodejs/commit/e980107)) +* **builtin:** runfile resolution incorrect if entry starts similarly ([3be2902](https://github.com/bazelbuild/rules_nodejs/commit/3be2902)) +* **builtin:** write stdout/stderr to correct path under chdir ([#2681](https://github.com/bazelbuild/rules_nodejs/issues/2681)) ([99760a5](https://github.com/bazelbuild/rules_nodejs/commit/99760a5)), closes [#2680](https://github.com/bazelbuild/rules_nodejs/issues/2680) +* **esbuild:** prefer finding entry_point files in deps rather than srcs ([#2692](https://github.com/bazelbuild/rules_nodejs/issues/2692)) ([5f4bb15](https://github.com/bazelbuild/rules_nodejs/commit/5f4bb15)) +* **esbuild:** provide JSModuleInfo of output bundle ([#2685](https://github.com/bazelbuild/rules_nodejs/issues/2685)) ([82ef1a1](https://github.com/bazelbuild/rules_nodejs/commit/82ef1a1)) +* **esbuild:** update update script file paths after removal of _README.md ([#2695](https://github.com/bazelbuild/rules_nodejs/issues/2695)) ([f320ef0](https://github.com/bazelbuild/rules_nodejs/commit/f320ef0)) +* **jasmine:** don't assume entry_point is a label as it may now be a dict ([3fa2e5f](https://github.com/bazelbuild/rules_nodejs/commit/3fa2e5f)) +* **jasmine:** unhanded promise rejection causes tests suit to pass ([a511f3d](https://github.com/bazelbuild/rules_nodejs/commit/a511f3d)), closes [3.7.0/lib/jasmine.js#L267](https://github.com/3.7.0/lib/jasmine.js/issues/L267) [#2688](https://github.com/bazelbuild/rules_nodejs/issues/2688) +* **terser:** make terser resolve more robust by not assuming a single /terser/ segment in the path ([95fc9ba](https://github.com/bazelbuild/rules_nodejs/commit/95fc9ba)) +* **typescript:** collect coverage in ts_project ([8e7bc1c](https://github.com/bazelbuild/rules_nodejs/commit/8e7bc1c)), closes [#2762](https://github.com/bazelbuild/rules_nodejs/issues/2762) +* allow for only stderr to be set on npm_package_bin ([a04a7ef](https://github.com/bazelbuild/rules_nodejs/commit/a04a7ef)) +* **builtin:** add two missing locations where Mac M1 support needs to be declared ([ad20275](https://github.com/bazelbuild/rules_nodejs/commit/ad20275)), closes [#2733](https://github.com/bazelbuild/rules_nodejs/issues/2733) +* **builtin:** support directory_file_path entry_point in nodejs_binary & nodejs_test when --bazel_patch_module_resolver is set ([50e6d1d](https://github.com/bazelbuild/rules_nodejs/commit/50e6d1d)) +* **typescript:** fixed "output was not created" error for ts_project with supports_workers ([9a3e5c9](https://github.com/bazelbuild/rules_nodejs/commit/9a3e5c9)) +* **typescript:** repair error reporting when a ts_project is missing declaration=True ([5f0be65](https://github.com/bazelbuild/rules_nodejs/commit/5f0be65)) +* make generated_file_test `.update`'s visibility same as test rule ([#2677](https://github.com/bazelbuild/rules_nodejs/issues/2677)) ([1ce9dce](https://github.com/bazelbuild/rules_nodejs/commit/1ce9dce)) + + +### chore + +* update Bazel minimum version to LTS ([a9c5966](https://github.com/bazelbuild/rules_nodejs/commit/a9c5966)) +* **builtin:** flip default for pkg_npm#validate ([16a099e](https://github.com/bazelbuild/rules_nodejs/commit/16a099e)) + + +### Code Refactoring + +* **typescript:** tsconfig default to tsconfig.json ([c6ae95c](https://github.com/bazelbuild/rules_nodejs/commit/c6ae95c)) + + +### Features + +* **esbuild:** allow for .ts, .tsx and .jsx entry points ([e3edb28](https://github.com/bazelbuild/rules_nodejs/commit/e3edb28)) +* **labs:** ts_proto_library directly exports commonjs ([5f26d0f](https://github.com/bazelbuild/rules_nodejs/commit/5f26d0f)) +* add package_name to ts_library ([d2d4d16](https://github.com/bazelbuild/rules_nodejs/commit/d2d4d16)) +* **builtin:** add validate attribute on pkg_npm ([39eea25](https://github.com/bazelbuild/rules_nodejs/commit/39eea25)), closes [#2782](https://github.com/bazelbuild/rules_nodejs/issues/2782) +* **builtin:** document how nodejs_binary#entry_point can use a direc… ([#2579](https://github.com/bazelbuild/rules_nodejs/issues/2579)) ([fcdcf63](https://github.com/bazelbuild/rules_nodejs/commit/fcdcf63)) +* **cypress:** cypress executable toolchain ([#2668](https://github.com/bazelbuild/rules_nodejs/issues/2668)) ([f1f5ee6](https://github.com/bazelbuild/rules_nodejs/commit/f1f5ee6)) +* **esbuild:** add support for toolchains ([#2704](https://github.com/bazelbuild/rules_nodejs/issues/2704)) ([ae011bf](https://github.com/bazelbuild/rules_nodejs/commit/ae011bf)) +* **esbuild:** filter ts declaration files by default ([f83cf48](https://github.com/bazelbuild/rules_nodejs/commit/f83cf48)) +* **typescript:** support typescript 4.3 ([e576acd](https://github.com/bazelbuild/rules_nodejs/commit/e576acd)) +* add opt-in exports_directories_only mode to yarn_install and npm_install (defaults to False) ([a7200aa](https://github.com/bazelbuild/rules_nodejs/commit/a7200aa)) +* support dict style directory_file_path entry_point in nodejs_binary, nodejs_test & jasmine_node_test ([5fafe19](https://github.com/bazelbuild/rules_nodejs/commit/5fafe19)) +* support directory_file_path entry_point in npm_umd_bundle ([8bee1b3](https://github.com/bazelbuild/rules_nodejs/commit/8bee1b3)) + + +### Performance Improvements + +* **cypress:** export cypress as a directory symlink ([8ea7ff4](https://github.com/bazelbuild/rules_nodejs/commit/8ea7ff4)) + + +### BREAKING CHANGES + +* **builtin:** The `@bazel/runfiles` `lookupDirectory` method has been +removed. Use the `resolve` method instead +* for our 4.0, rules_nodejs requires the current LTS of Bazel. This is a policy restriction to save us time tracking down support issues on older versions of Bazel, not a technical one. You can patch this check out locally if you really need to continue using older Bazel, but this puts you on unsupported track. +* **builtin:** Just follow the printed instructions to either set the right package_name or disable the validation +* **typescript:** ts_project tsconfig attribute now defaults to just 'tsconfig.json' rather than '[name].json' + + + +# [3.6.0](https://github.com/bazelbuild/rules_nodejs/compare/3.5.1...3.6.0) (2021-06-09) + + +### Bug Fixes + +* allow for only stderr to be set on npm_package_bin ([fa8f5b1](https://github.com/bazelbuild/rules_nodejs/commit/fa8f5b1)) +* **builtin:** add two missing locations where Mac M1 support needs to be declared ([2ad950f](https://github.com/bazelbuild/rules_nodejs/commit/2ad950f)), closes [#2733](https://github.com/bazelbuild/rules_nodejs/issues/2733) +* **builtin:** propogate tags to both generated targets in generated_file_test ([c4403fc](https://github.com/bazelbuild/rules_nodejs/commit/c4403fc)) +* **builtin:** support directory_file_path entry_point in nodejs_binary & nodejs_test when --bazel_patch_module_resolver is set ([51676ef](https://github.com/bazelbuild/rules_nodejs/commit/51676ef)) +* **jasmine:** don't assume entry_point is a label as it may now be a dict ([3683466](https://github.com/bazelbuild/rules_nodejs/commit/3683466)) +* **jasmine:** unhanded promise rejection causes tests suit to pass ([3c4ef58](https://github.com/bazelbuild/rules_nodejs/commit/3c4ef58)), closes [3.7.0/lib/jasmine.js#L267](https://github.com/3.7.0/lib/jasmine.js/issues/L267) [#2688](https://github.com/bazelbuild/rules_nodejs/issues/2688) +* **terser:** make terser resolve more robust by not assuming a single /terser/ segment in the path ([4709ffb](https://github.com/bazelbuild/rules_nodejs/commit/4709ffb)) +* **typescript:** fixed "output was not created" error for ts_project with supports_workers ([807b07b](https://github.com/bazelbuild/rules_nodejs/commit/807b07b)) +* **typescript:** repair error reporting when a ts_project is missing declaration=True ([cd08efe](https://github.com/bazelbuild/rules_nodejs/commit/cd08efe)) + + +### Features + +* add opt-in exports_directories_only mode to yarn_install and npm_install (defaults to False) ([3d182cf](https://github.com/bazelbuild/rules_nodejs/commit/3d182cf)) +* support dict style directory_file_path entry_point in nodejs_binary, nodejs_test & jasmine_node_test ([737674f](https://github.com/bazelbuild/rules_nodejs/commit/737674f)) +* support directory_file_path entry_point in npm_umd_bundle ([4e44178](https://github.com/bazelbuild/rules_nodejs/commit/4e44178)) + + + +## [3.5.1](https://github.com/bazelbuild/rules_nodejs/compare/3.5.0...3.5.1) (2021-05-25) + + +### Bug Fixes + +* **builtin:** generated nodejs repository for windows references non-existent file ([c1663c5](https://github.com/bazelbuild/rules_nodejs/commit/c1663c5)) +* **builtin:** write stdout/stderr to correct path under chdir ([#2681](https://github.com/bazelbuild/rules_nodejs/issues/2681)) ([36311bb](https://github.com/bazelbuild/rules_nodejs/commit/36311bb)), closes [#2680](https://github.com/bazelbuild/rules_nodejs/issues/2680) +* **esbuild:** prefer finding entry_point files in deps rather than srcs ([#2692](https://github.com/bazelbuild/rules_nodejs/issues/2692)) ([dd4c4f3](https://github.com/bazelbuild/rules_nodejs/commit/dd4c4f3)) +* **esbuild:** provide JSModuleInfo of output bundle ([#2685](https://github.com/bazelbuild/rules_nodejs/issues/2685)) ([233254d](https://github.com/bazelbuild/rules_nodejs/commit/233254d)) +* **esbuild:** update update script file paths after removal of _README.md ([#2695](https://github.com/bazelbuild/rules_nodejs/issues/2695)) ([25a5ac4](https://github.com/bazelbuild/rules_nodejs/commit/25a5ac4)) +* make generated_file_test `.update`'s visibility same as test rule ([#2677](https://github.com/bazelbuild/rules_nodejs/issues/2677)) ([30bc86c](https://github.com/bazelbuild/rules_nodejs/commit/30bc86c)) + + +### Features + +* **builtin:** document how nodejs_binary#entry_point can use a direc… ([#2579](https://github.com/bazelbuild/rules_nodejs/issues/2579)) ([ceddd1d](https://github.com/bazelbuild/rules_nodejs/commit/ceddd1d)) + + + +# [3.5.0](https://github.com/bazelbuild/rules_nodejs/compare/3.4.2...3.5.0) (2021-05-11) + + +### Bug Fixes + +* **builtin:** account for racy deletion of symlink in linker ([#2662](https://github.com/bazelbuild/rules_nodejs/issues/2662)) ([e9a683d](https://github.com/bazelbuild/rules_nodejs/commit/e9a683d)) +* **builtin:** include optionalDependencies in strictly visible packages ([#2657](https://github.com/bazelbuild/rules_nodejs/issues/2657)) ([2a1ed31](https://github.com/bazelbuild/rules_nodejs/commit/2a1ed31)) +* **builtin:** linker incorrectly resolves workspace `node_modules` for windows ([#2659](https://github.com/bazelbuild/rules_nodejs/issues/2659)) ([7cf7d73](https://github.com/bazelbuild/rules_nodejs/commit/7cf7d73)) +* **concatjs:** devserver not passing through tags to all targets ([#2646](https://github.com/bazelbuild/rules_nodejs/issues/2646)) ([8abc8e0](https://github.com/bazelbuild/rules_nodejs/commit/8abc8e0)) +* **docs:** correct title of stamping docs ([4bea5b2](https://github.com/bazelbuild/rules_nodejs/commit/4bea5b2)) +* **protractor:** unable to specify `server` as configurable attribute ([#2643](https://github.com/bazelbuild/rules_nodejs/issues/2643)) ([4965db6](https://github.com/bazelbuild/rules_nodejs/commit/4965db6)) + + +### Features + +* **builtin:** add js_library JSEcmaScriptModuleInfo support ([#2658](https://github.com/bazelbuild/rules_nodejs/issues/2658)) ([5ad1596](https://github.com/bazelbuild/rules_nodejs/commit/5ad1596)) +* **builtin:** allow bundling ESM output with the pkg_npm rule ([#2648](https://github.com/bazelbuild/rules_nodejs/issues/2648)) ([911529f](https://github.com/bazelbuild/rules_nodejs/commit/911529f)) +* **concatjs:** enable junit report for karma_web_test ([#2630](https://github.com/bazelbuild/rules_nodejs/issues/2630)) ([28e8d23](https://github.com/bazelbuild/rules_nodejs/commit/28e8d23)) +* **esbuild:** add support for multiple entry points ([#2663](https://github.com/bazelbuild/rules_nodejs/issues/2663)) ([b4f322a](https://github.com/bazelbuild/rules_nodejs/commit/b4f322a)) +* **esbuild:** default log-level flag to warning, unless overridden ([#2664](https://github.com/bazelbuild/rules_nodejs/issues/2664)) ([8ffea3e](https://github.com/bazelbuild/rules_nodejs/commit/8ffea3e)) + + + +## [3.4.2](https://github.com/bazelbuild/rules_nodejs/compare/3.4.1...3.4.2) (2021-04-28) + + +### Bug Fixes + +* **builtin:** allow bazel version to have semver build metadata ([#2624](https://github.com/bazelbuild/rules_nodejs/issues/2624)) ([6a2e136](https://github.com/bazelbuild/rules_nodejs/commit/6a2e136)) + + +### Features + +* **builtin:** add version 16.x.x versions of NodeJS ([#2626](https://github.com/bazelbuild/rules_nodejs/issues/2626)) ([fc34588](https://github.com/bazelbuild/rules_nodejs/commit/fc34588)) + + + ## [3.4.1](https://github.com/bazelbuild/rules_nodejs/compare/3.4.0...3.4.1) (2021-04-22) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8a67e517ab..64fc5fbeb9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,18 @@ Want to contribute? Great! First, read this page (including the small print at the end). +## Formatting + +Starlark files should be formatted by buildifier. +We suggest using a pre-commit hook to automate this. +First [install pre-commit](https://pre-commit.com/#installation), +then run + +```shell +pre-commit install +``` + +Otherwise the Buildkite CI will yell at you about formatting/linting violations. + ### Before you contribute **Before we can use your code, you must sign the diff --git a/DEVELOPING.md b/DEVELOPING.md index 12b5448cc5..f28ec58f9e 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -1,6 +1,10 @@ # For Developers -We strongly encourage you to review the project's scope described in the `README.md` file before working on new features. For large changes, consider writing a design document using [this template](https://goo.gl/YCQttR). +After cloning the repo, run `pre-commit install` so that your commits are automatically formatted for you. Otherwise you'll get yelled at later by our CI. + +> See https://pre-commit.com/#installation if you don't have `pre-commit` installed. + +It's a lot of work for us to review and accept Pull Requests. Sometimes things can't merge simply because it's too hard to determine if you change is breaking something else, or because the system you're touching is already being refactored by someone else. Before working on new features, we strongly encourage you to review the project's scope described in the `README.md` file. For large changes, consider writing a design document using [this template](https://goo.gl/YCQttR). ## Architecture @@ -94,17 +98,16 @@ Googlers: you should npm login using the go/npm-publish service: `$ npm login -- Check if there are any breaking changes since the last tag - if so, this will be a major. Check if there were new features added since the last tag - if so, this will be a minor. -1. Re-generate the API docs: `yarn stardoc` -1. `git add docs/` (in case new files were created) -1. `git commit -a -m 'docs: update docs for release'` 1. `npm version [major|minor|patch]` (`major` if there are breaking changes, `minor` if there are new features, otherwise `patch`) 1. Manually update the CHANGELOG.md based on the commits since the last release. Look for breaking changes that weren't documented. 1. If publishing from inside Google, set NPM_REGISTRY="--registry https://wombat-dressing-room.appspot.com" in your environment 1. Build npm packages and publish them: `./scripts/publish_release.sh` (for a release candidate, add arguments `publish next`) 1. Run `./scripts/update_nested_lock_files.sh` to update the lock files in all nested workspaces to new release 1. `git commit -a -m 'chore: update lock files for release'` -1. `git push upstream && git push upstream --tags` +1. `git push && git push --tags` 1. (Manual for now): go to the [releases] page, edit the release with rough changelog (especially note any breaking changes!) and upload the release artifact from `rules_nodejs-[version].tar.gz`. Also copy the release notes from CHANGELOG.md -1. Announce the release on Bazel slack in `#javascript` +1. Re-deprecate npm packages, since publishing causes them to become un-deprecated: + - `npm --otp=123456 deprecate @bazel/typescript 'No longer maintained, https://github.com/aspect-build/rules_ts is the recommended replacement'` +1. Announce the release on Bazel slack in `#javascript [releases]: https://github.com/bazelbuild/rules_nodejs/releases diff --git a/README.md b/README.md index 03a0518d83..f4e163ecb0 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,25 @@ # JavaScript rules for Bazel +## Maintenance Update + +As of [this announcement](https://blog.aspect.dev/rulesjs-launch), +the maintainers of rules_nodejs have all moved to a faster, more compatible alternative: +[rules_js](https://github.com/aspect-build/rules_js/). + +`rules_js` has a dependency on the "core" module in rules_nodejs, just supplying the nodejs toolchain. +We'll continue to maintain that code (the /nodejs folder under this repo, essentially). + +However, unless some new maintainers want to step up for this repository, the remainder of the code (the build_bazel_rules_nodejs starlark module and npm packages like @bazel/typescript) will be unmaintained and effectively deprecated. (We'll still accept small PRs and push patch/minor releases). + +If you want to sign up as a maintainer, DM Alex Eagle or Jason Dobies on [bazel slack](http://slack.bazel.build). + +At this point we expect there will never be another major (6.x) of rules_nodejs. If there is, it would include only the core, with the rest of the code removed. + + Circle CI | Bazel CI :---: | :---: -[![CircleCI](https://circleci.com/gh/bazelbuild/rules_nodejs/tree/stable.svg?style=svg)](https://circleci.com/gh/bazelbuild/rules_nodejs/tree/stable) | [![Build status](https://badge.buildkite.com/af1a592b39b11923ef0f523cbb223dd3dbd61629f8bc813c07.svg?branch=master)](https://buildkite.com/bazel/nodejs-rules-nodejs-postsubmit) +[![CircleCI](https://circleci.com/gh/bazelbuild/rules_nodejs/tree/stable.svg?style=svg)](https://circleci.com/gh/bazelbuild/rules_nodejs/tree/stable) | [![Build status](https://badge.buildkite.com/af1a592b39b11923ef0f523cbb223dd3dbd61629f8bc813c07.svg?branch=stable)](https://buildkite.com/bazel/nodejs-rules-nodejs-postsubmit) The nodejs rules integrate NodeJS development toolchain and runtime with Bazel. @@ -12,10 +28,10 @@ so this repo can be thought of as "JavaScript rules for Bazel" as well. (We woul This repository is maintained by volunteers in the Bazel community. Neither Google, nor the Bazel team, provides support for the code. However, this repository is part of the test suite used to vet new Bazel releases. -We follow semantic versioning. Patch releases have bugfixes, minor releases have new features. Only major releases (1.x, 2.x) have breaking changes. We support the last two major releases of Bazel, see `SUPPORTED_BAZEL_VERSIONS` in our `/index.bzl` for the list we test against. +We follow semantic versioning. Patch releases have bugfixes, minor releases have new features. Only major releases (1.x, 2.x) have breaking changes. We support [LTS releases](https://blog.bazel.build/2020/11/10/long-term-support-release.html) of Bazel (starting at 4.x), see `SUPPORTED_BAZEL_VERSIONS` in our `/index.bzl` for the list we test against. We strive to give you an easy upgrade path when we do introduce a breaking change by documenting a migration path. -If you use code from an `/internal` path, or the labs package, these are not subject to our support policy and may have breaking changes or removals with no warning or migration path. +If you use code from an `/internal` path, these are not subject to our support policy and may have breaking changes or removals with no warning or migration path. ## Documentation @@ -45,7 +61,6 @@ Open-source repositories: - Angular: [Angular monorepo](https://github.com/angular/angular), [CLI](https://github.com/angular/angular-cli), [Components](https://github.com/angular/components), [Universal](https://github.com/angular/universal) - Tensorflow: [tf.js](https://github.com/tensorflow/tfjs) and [tensorboard](https://github.com/tensorflow/tensorboard) - [Selenium](https://github.com/SeleniumHQ/selenium) -- [NgRX](https://github.com/ngrx/platform) - [tsickle](https://github.com/angular/tsickle) - [incremental-dom](https://github.com/google/incremental-dom) - [dataform](https://github.com/dataform-co/dataform) @@ -62,6 +77,10 @@ Organizations: - [LogiOcean](https://www.logiocean.com) - [Spica](https://spicaengine.com) - [Domino Data Lab](https://www.dominodatalab.com/) +- [Cookies](https://cookies.co/) +- [Glean](https://www.glean.com/) +- [FasterCI](https://fasterci.com/) +- [Code Intelligence](https://www.code-intelligence.com/) Not on this list? [Send a PR](https://github.com/bazelbuild/rules_nodejs/edit/stable/README.md) to add your repo or organization! diff --git a/WORKSPACE b/WORKSPACE index fdaa5dcaf6..be46a5f379 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -14,192 +14,58 @@ workspace( name = "build_bazel_rules_nodejs", - managed_directories = { - "@angular_deps": ["packages/angular/node_modules"], - # cypress_deps must be a managed directory to ensure it is downloaded before cypress_repository is run. - "@cypress_deps": ["packages/cypress/test/node_modules"], - "@internal_test_multi_linker_sub_deps": ["internal/linker/test/multi_linker/sub/node_modules"], - "@npm": ["node_modules"], - "@npm_node_patches": ["packages/node-patches/node_modules"], - }, ) -load("//:index.bzl", "BAZEL_VERSION", "SUPPORTED_BAZEL_VERSIONS") - # -# Install rules_nodejs dev dependencies +# Setup local respositories # -load("//:package.bzl", "rules_nodejs_dev_dependencies") - -rules_nodejs_dev_dependencies() +local_repository( + name = "rules_nodejs", + path = ".", +) local_repository( - name = "build_bazel_rules_typescript", - path = "third_party/github.com/bazelbuild/rules_typescript", + name = "internal_npm_package_test_vendored_external", + path = "internal/pkg_npm/test/vendored_external", ) # -# Setup rules_nodejs npm dependencies +# Install rules_nodejs dev dependencies # -load("@build_bazel_rules_nodejs//:index.bzl", "npm_install", "yarn_install") - -yarn_install( - name = "npm", - data = [ - "//:patches/jest-haste-map+25.3.0.patch", - "//internal/npm_install/test:postinstall.js", - ], - environment = { - "SOME_USER_ENV": "yarn is great!", - }, - links = { - "@test_multi_linker/lib-a": "//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-a2": "//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-b": "@//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-b2": "@//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-c": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-c2": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-d": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_d", - "@test_multi_linker/lib-d2": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_d", - }, - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", -) - -yarn_install( - name = "internal_test_multi_linker_deps", - links = { - "@test_multi_linker/lib-a": "@//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-a2": "@//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-b": "@//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-b2": "@//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-c": "@//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-c2": "@//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-d": "@//internal/linker/test/multi_linker/lib_d", - "@test_multi_linker/lib-d2": "@//internal/linker/test/multi_linker/lib_d", - }, - package_json = "//internal/linker/test/multi_linker:package.json", - package_path = "internal/linker/test/multi_linker", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker:yarn.lock", -) - -yarn_install( - name = "internal_test_multi_linker_test_a_deps", - links = { - "@test_multi_linker/lib-a": "@//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-a2": "@//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-b": "@//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-b2": "@//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-c": "@//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-c2": "@//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-d": "@//internal/linker/test/multi_linker/lib_d", - "@test_multi_linker/lib-d2": "@//internal/linker/test/multi_linker/lib_d", - }, - package_json = "//internal/linker/test/multi_linker/test_a:package.json", - package_path = "internal/linker/test/multi_linker/test_a", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/test_a:yarn.lock", -) +load("//:repositories.bzl", "build_bazel_rules_nodejs_dev_dependencies") -yarn_install( - name = "internal_test_multi_linker_test_b_deps", - package_json = "//internal/linker/test/multi_linker/test_b:package.json", - package_path = "internal/linker/test/multi_linker/test_b", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/test_b:yarn.lock", -) +build_bazel_rules_nodejs_dev_dependencies() -yarn_install( - name = "internal_test_multi_linker_test_c_deps", - package_json = "//internal/linker/test/multi_linker/test_c:package.json", - package_path = "internal/linker/test/multi_linker/test_c", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/test_c:yarn.lock", -) +# +# Setup rules_nodejs npm dependencies +# -yarn_install( - name = "internal_test_multi_linker_test_d_deps", - package_json = "//internal/linker/test/multi_linker/test_d:package.json", - package_path = "internal/linker/test/multi_linker/test_d", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/test_d:yarn.lock", -) +load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") -yarn_install( - name = "internal_test_multi_linker_lib_b_deps", - # transitive deps for this first party lib should not include dev dependencies - args = ["--production"], - package_json = "//internal/linker/test/multi_linker/lib_b:package.json", - package_path = "internal/linker/test/multi_linker/lib_b", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/lib_b:yarn.lock", +# The order matters because Bazel will provide the first registered toolchain when a rule asks Bazel to select it +# This applies to the resolved_toolchain +nodejs_register_toolchains( + name = "node16", + node_version = "16.5.0", ) -yarn_install( - name = "internal_test_multi_linker_lib_c_deps", - # transitive deps for this first party lib should not include dev dependencies - args = ["--production"], - package_json = "//internal/linker/test/multi_linker/lib_c:lib/package.json", - package_path = "internal/linker/test/multi_linker/lib_c/lib", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/lib_c:lib/yarn.lock", +nodejs_register_toolchains( + name = "node15", + node_version = "15.14.0", ) -yarn_install( - name = "internal_test_multi_linker_sub_dev_deps", - links = { - "@test_multi_linker/lib-a": "//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-a2": "//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-b": "//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-b2": "//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-c": "//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-c2": "//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-d": "//internal/linker/test/multi_linker/lib_d", - "@test_multi_linker/lib-d2": "//internal/linker/test/multi_linker/lib_d", - }, - package_json = "//internal/linker/test/multi_linker/sub:package.json", - package_path = "internal/linker/test/multi_linker/sub/dev", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/sub:yarn.lock", -) +load("@rules_nodejs//nodejs:yarn_repositories.bzl", "yarn_repositories") -yarn_install( - name = "internal_test_multi_linker_sub_deps", - # transitive deps for this first party lib should not include dev dependencies - args = ["--production"], - links = { - "@test_multi_linker/lib-a": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-a2": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_a", - "@test_multi_linker/lib-b": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-b2": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_b", - "@test_multi_linker/lib-c": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-c2": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_c", - "@test_multi_linker/lib-d": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_d", - "@test_multi_linker/lib-d2": "@build_bazel_rules_nodejs//internal/linker/test/multi_linker/lib_d", - }, - package_json = "//internal/linker/test/multi_linker/sub:package.json", - package_path = "internal/linker/test/multi_linker/sub", - yarn_lock = "//internal/linker/test/multi_linker/sub:yarn.lock", +yarn_repositories( + name = "yarn", + node_repository = "node16", ) -yarn_install( - name = "internal_test_multi_linker_onep_a_deps", - # transitive deps for this first party lib should not include dev dependencies - args = ["--production"], - package_json = "//internal/linker/test/multi_linker/onep_a:package.json", - package_path = "internal/linker/test/multi_linker/onep_a", - symlink_node_modules = False, - yarn_lock = "//internal/linker/test/multi_linker/onep_a:yarn.lock", -) +load("@build_bazel_rules_nodejs//:npm_deps.bzl", "npm_deps") -npm_install( - name = "npm_node_patches", - package_json = "//packages/node-patches:package.json", - package_lock_json = "//packages/node-patches:package-lock.json", -) +npm_deps() load("@build_bazel_rules_nodejs//internal/npm_tarballs:translate_package_lock.bzl", "translate_package_lock") @@ -211,69 +77,43 @@ translate_package_lock( load("@npm_node_patches_lock//:index.bzl", _npm_patches_repositories = "npm_repositories") -# # Declare an external repository for each npm package fetchable by the lock file +# Declare an external repository for each npm package fetchable by the lock file _npm_patches_repositories() -npm_install( - name = "angular_deps", - package_json = "//packages/angular:package.json", - package_lock_json = "//packages/angular:package-lock.json", -) - -yarn_install( - name = "cypress_deps", - package_json = "//packages/cypress/test:package.json", - yarn_lock = "//packages/cypress/test:yarn.lock", -) - -yarn_install( - name = "rollup_test_multi_linker_deps", - package_json = "//packages/rollup/test/multi_linker:package.json", - package_path = "packages/rollup/test/multi_linker", - symlink_node_modules = False, - yarn_lock = "//packages/rollup/test/multi_linker:yarn.lock", -) - -# We have a source dependency on build_bazel_rules_typescript -# so we must repeat its transitive toolchain deps -load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dev_dependencies") +load("//packages/concatjs:package.bzl", "rules_typescript_dev_dependencies") rules_typescript_dev_dependencies() -# Install labs dependencies -load("//packages/labs:package.bzl", "npm_bazel_labs_dependencies") - -npm_bazel_labs_dependencies() - -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") - -rules_proto_dependencies() - -rules_proto_toolchains() +local_repository( + name = "devserver_test_workspace", + path = "packages/concatjs/devserver/devserver/test/test-workspace", +) -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") - -gazelle_dependencies() +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") go_rules_dependencies() -go_register_toolchains() +go_register_toolchains(version = "1.16") + +gazelle_dependencies() -load("@build_bazel_rules_typescript//internal:ts_repositories.bzl", "ts_setup_dev_workspace") +load("//packages/concatjs/internal:ts_repositories.bzl", "ts_setup_dev_workspace") ts_setup_dev_workspace() # # Install @bazel/cypress dependencies # -load("//packages/cypress:index.bzl", "cypress_repository") +load("//packages/cypress:index.bzl", "cypress_repositories") -cypress_repository( +cypress_repositories( name = "cypress", - cypress_bin = "@cypress_deps//:node_modules/cypress/bin/cypress", - # Currently cypress cannot be installed on our Linux/Windows CI machines - fail_on_error = False, + darwin_arm64_sha256 = "101a0ced77fb74b356800cb3a3919f5288d23cc63fdd39a0c500673159e954fc", + darwin_sha256 = "101a0ced77fb74b356800cb3a3919f5288d23cc63fdd39a0c500673159e954fc", + linux_sha256 = "d8ea8d16fed33fdae8f17178bcae076aaf532fa7ccb48f377df1f143e60abd59", + version = "7.3.0", + windows_sha256 = "8a8809e4fd22fe7bfc3103c39df3f4fce9db0964450ce927558e9a09558cb26c", ) # Setup the rules_webtesting toolchain @@ -281,7 +121,7 @@ load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories" web_test_repositories() -load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories") +load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories") browser_repositories( chromium = True, @@ -289,9 +129,12 @@ browser_repositories( ) # Setup esbuild dependencies -load("//packages/esbuild:esbuild_repo.bzl", "esbuild_dependencies") +load("//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories") -esbuild_dependencies() +esbuild_repositories( + node_repository = "node16", + npm_repository = "npm", +) # # Dependencies to run stardoc & generating documentation @@ -318,209 +161,23 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() -# -# Setup local respositories & install npm dependencies for tests -# - -local_repository( - name = "internal_npm_package_test_vendored_external", - path = "internal/pkg_npm/test/vendored_external", -) - -yarn_install( - name = "fine_grained_deps_yarn", - data = [ - "//:tools/npm_packages/local_module/yarn/BUILD.bazel", - "//:tools/npm_packages/local_module/yarn/index.js", - "//:tools/npm_packages/local_module/yarn/package.json", - "//internal/npm_install/test:postinstall.js", - ], - environment = { - "SOME_USER_ENV": "yarn is great!", - }, - generate_local_modules_build_files = False, - included_files = [ - "", - ".js", - ".d.ts", - ".json", - ".proto", - ], - package_json = "//:tools/fine_grained_deps_yarn/package.json", - symlink_node_modules = False, - yarn_lock = "//:tools/fine_grained_deps_yarn/yarn.lock", -) - -npm_install( - name = "fine_grained_deps_npm", - data = [ - "//:tools/npm_packages/local_module/npm/BUILD.bazel", - "//:tools/npm_packages/local_module/npm/index.js", - "//:tools/npm_packages/local_module/npm/package.json", - "//internal/npm_install/test:postinstall.js", - ], - environment = { - "SOME_USER_ENV": "npm is cool!", - }, - generate_local_modules_build_files = False, - included_files = [ - "", - ".js", - ".d.ts", - ".json", - ".proto", - ], - npm_command = "install", - package_json = "//:tools/fine_grained_deps_npm/package.json", - package_lock_json = "//:tools/fine_grained_deps_npm/package-lock.json", - symlink_node_modules = False, -) - -yarn_install( - name = "fine_grained_no_bin", - package_json = "//:tools/fine_grained_no_bin/package.json", - symlink_node_modules = False, - yarn_lock = "//:tools/fine_grained_no_bin/yarn.lock", -) - -yarn_install( - name = "fine_grained_goldens", - included_files = [ - "", - ".js", - ".jst", - ".ts", - ".map", - ".d.ts", - ".json", - ".proto", - ], - links = { - "@some-scope/some-target-b": "@//some/target/b", - "@some-scope/some-target-b2": "@//some/target/b", - "some-target-a": "//some/target/a", - "some-target-a2": "//some/target/a", - }, - manual_build_file_contents = """ -filegroup( - name = "golden_files", - srcs = [ - "//:BUILD.bazel", - "//:manual_build_file_contents", - "//:WORKSPACE", - "//@angular/core:BUILD.bazel", - "//@gregmagolan:BUILD.bazel", - "//@gregmagolan/test-a/bin:BUILD.bazel", - "//@gregmagolan/test-a:BUILD.bazel", - "//@gregmagolan/test-a:index.bzl", - "//@gregmagolan/test-b:BUILD.bazel", - "//ajv:BUILD.bazel", - "//jasmine/bin:BUILD.bazel", - "//jasmine:BUILD.bazel", - "//jasmine:index.bzl", - "//rxjs:BUILD.bazel", - "//unidiff:BUILD.bazel", - "//zone.js:BUILD.bazel", - "//some-target-a:BUILD.bazel", - "//some-target-a2:BUILD.bazel", - "//@some-scope/some-target-b:BUILD.bazel", - "//@some-scope/some-target-b2:BUILD.bazel", - ], -)""", - package_json = "//:tools/fine_grained_goldens/package.json", - symlink_node_modules = False, - yarn_lock = "//:tools/fine_grained_goldens/yarn.lock", -) - -yarn_install( - name = "internal_npm_install_test_patches_yarn", - package_json = "//internal/npm_install/test/patches_yarn:package.json", - package_path = "internal/npm_install/test/patches_yarn", - patch_args = ["-p0"], - patch_tool = "patch", - post_install_patches = ["//internal/npm_install/test/patches_yarn:semver+1.0.0.patch"], - pre_install_patches = ["//internal/npm_install/test/patches_yarn:package_json.patch"], - symlink_node_modules = False, - yarn_lock = "//internal/npm_install/test/patches_yarn:yarn.lock", -) - -npm_install( - name = "internal_npm_install_test_patches_npm", - package_json = "//internal/npm_install/test/patches_npm:package.json", - package_lock_json = "//internal/npm_install/test/patches_npm:package-lock.json", - package_path = "internal/npm_install/test/patches_npm", - patch_args = ["-p0"], - patch_tool = "patch", - post_install_patches = ["//internal/npm_install/test/patches_npm:semver+1.0.0.patch"], - pre_install_patches = ["//internal/npm_install/test/patches_npm:package_json.patch"], - symlink_node_modules = False, -) - -yarn_install( - name = "fine_grained_goldens_multi_linked", - included_files = [ - "", - ".js", - ".jst", - ".ts", - ".map", - ".d.ts", - ".json", - ".proto", - ], - links = { - "@some-scope/some-target-b": "@//some/target/b", - "@some-scope/some-target-b2": "@//some/target/b", - "some-target-a": "@build_bazel_rules_nodejs//some/target/a", - "some-target-a2": "@build_bazel_rules_nodejs//some/target/a", - }, - manual_build_file_contents = """ -filegroup( - name = "golden_files", - srcs = [ - "//:BUILD.bazel", - "//:manual_build_file_contents", - "//:WORKSPACE", - "//@angular/core:BUILD.bazel", - "//@gregmagolan:BUILD.bazel", - "//@gregmagolan/test-a/bin:BUILD.bazel", - "//@gregmagolan/test-a:BUILD.bazel", - "//@gregmagolan/test-a:index.bzl", - "//@gregmagolan/test-b:BUILD.bazel", - "//ajv:BUILD.bazel", - "//jasmine/bin:BUILD.bazel", - "//jasmine:BUILD.bazel", - "//jasmine:index.bzl", - "//rxjs:BUILD.bazel", - "//unidiff:BUILD.bazel", - "//zone.js:BUILD.bazel", - "//some-target-a:BUILD.bazel", - "//some-target-a2:BUILD.bazel", - "//@some-scope/some-target-b:BUILD.bazel", - "//@some-scope/some-target-b2:BUILD.bazel", - ], -)""", - package_json = "//:tools/fine_grained_goldens/package.json", - package_path = "tools/fine_grained_goldens", - symlink_node_modules = False, - yarn_lock = "//:tools/fine_grained_goldens/yarn.lock", -) - # # RBE configuration # -load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig") +load("//:index.bzl", "SUPPORTED_BAZEL_VERSIONS") +load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig") # Creates toolchain configuration for remote execution with BuildKite CI # for rbe_ubuntu1604 -rbe_autoconfig( +rbe_preconfig( name = "buildkite_config", + toolchain = "ubuntu1804-bazel-java11", ) -rbe_autoconfig( +rbe_preconfig( name = "rbe_default", - bazel_version = BAZEL_VERSION, + toolchain = "ubuntu1804-bazel-java11", ) load("@build_bazel_integration_testing//tools:repositories.bzl", "bazel_binaries") diff --git a/commitlint.config.js b/commitlint.config.js index 647f900263..11d2f3bd97 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -6,7 +6,6 @@ module.exports = { 2, 'always', [ - 'angular', 'builtin', 'concatjs', 'create', @@ -14,7 +13,6 @@ module.exports = { 'esbuild', 'examples', 'jasmine', - 'labs', 'protractor', 'rollup', 'runfiles', diff --git a/common.bazelrc b/common.bazelrc index 37c3e66b0a..46f44c145c 100644 --- a/common.bazelrc +++ b/common.bazelrc @@ -7,6 +7,9 @@ # Cache action outputs on disk so they persist across output_base and bazel shutdown (eg. changing branches) build --disk_cache=~/.cache/bazel-disk-cache +# Bazel picks up host-OS-specific config lines from bazelrc files +build --enable_platform_specific_config + # Bazel will create symlinks from the workspace directory to output artifacts. # Build results will be placed in a directory called "dist/bin" # Other directories will be created like "dist/testlogs" @@ -61,6 +64,12 @@ build:debug --compilation_mode=dbg # This prevents accidentally depending on this feature, which Bazel will remove. build --nolegacy_external_runfiles +# Workaround for: https://github.com/bazelbuild/bazel/issues/4327. +# The Chromium browser archive for macOS and Windows contain files with spaces that +# will break runfile tree creation for browser tests relying on `rules_webtesting`. +build:macos --experimental_inprocess_symlink_creation +build:windows --experimental_inprocess_symlink_creation + # Turn on --incompatible_strict_action_env which was on by default # in Bazel 0.21.0 but turned off again in 0.22.0. Follow # https://github.com/bazelbuild/bazel/issues/7026 for more details. diff --git a/docs/.gitattributes b/docs/.gitattributes deleted file mode 100644 index f632f8095c..0000000000 --- a/docs/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# Tell GitHub code review that the .html files aren't interesting -# See https://github.com/github/linguist#generated-code -*.html linguist-generated diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index bc64e0798e..0000000000 --- a/docs/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.jekyll-metadata -Gemfile* -production/ -_site/ \ No newline at end of file diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 8df81d8e6b..183958677e 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -12,79 +12,107 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//tools/stardoc:index.bzl", "rules_nodejs_docs", "stardoc") +load("@bazel_skylib//rules:diff_test.bzl", "diff_test") +load("@bazel_skylib//rules:write_file.bzl", "write_file") +load("//tools/stardoc:index.bzl", "stardoc") + +stardoc( + name = "core", + out = "core.md_", + input = "//nodejs:index.for_docs.bzl", + deps = ["//nodejs:bzl"], +) stardoc( name = "builtins", - out = "builtins.api", + out = "builtins.md_", input = "//:index.for_docs.bzl", tags = ["fix-windows"], deps = [ "//:bzl", "//internal/node:bzl", + "@bazel_skylib//lib:types", + "@rules_nodejs//nodejs:bzl", ], ) stardoc( name = "providers", - out = "providers.api", + out = "providers.md_", input = "//:providers.bzl", + symbol_names = [ + "ExternalNpmPackageInfo", + "js_ecma_script_module_info", + "js_named_module_info", + "JSEcmaScriptModuleInfo", + "JSNamedModuleInfo", + "node_modules_aspect", + "NodeRuntimeDepsInfo", + "run_node", + "NpmPackageInfo", + ], tags = ["fix-windows"], deps = [ "//:bzl", + "@bazel_skylib//lib:types", + "@rules_nodejs//nodejs:bzl", ], ) -_BUILTINS_README = "# Built-in rules\n\nThese rules are available without any npm installation, via the `WORKSPACE` install of the `build_bazel_rules_nodejs` workspace. This is necessary to bootstrap Bazel to run the package manager to download other rules from NPM.\n\n" +_READMES = { + "Built-ins": "//docs:builtins.md_", + "Concatjs": "//packages/concatjs:README.md", + "Core": "//docs:core.md_", + "Cypress": "//packages/cypress:README.md", + "Jasmine": "//packages/jasmine:README.md", + "Protractor": "//packages/protractor:README.md", + "Providers": "//docs:providers.md_", + "Rollup": "//packages/rollup:README.md", + "Terser": "//packages/terser:README.md", + "Toolchains": "//toolchains:README.md", + "TypeScript": "//packages/typescript:README.md", + "esbuild": "//packages/esbuild:README.md", +} -# Ugly genrule depending on local linux environment to build the README out of skylark doc generation. -# Only referenced when we do a release. -# TODO: This ought to be possible with stardoc alone. Need to coordinate with Chris Parsons. -genrule( - name = "builtins_md", - srcs = [ - ":builtins.api", - ":providers.api", +[ + diff_test( + name = "check_" + k.lower(), + failure_message = "Please run: bazel run //docs:update", + file1 = k + ".md", + file2 = v, + tags = [ + # no need to run on more than one platform + "no-bazelci-windows", + # diff_test has line endings issues on Windows + "fix-windows", + ], + ) + for [ + k, + v, + ] in _READMES.items() +] + +write_file( + name = "gen_update", + out = "update.sh", + content = [ + "#!/usr/bin/env bash", + "cd $BUILD_WORKSPACE_DIRECTORY", + ] + [ + "cp -fv dist/bin/{1} docs/{0}.md".format( + k, + v.replace(":", "/"), + ) + for [ + k, + v, + ] in _READMES.items() ], - outs = ["builtins.doc"], - cmd = "echo '%s' > $@;" % _BUILTINS_README + - "cat $(location :builtins.api) | sed 's/^##/\\\n##/' >> $@ &&" + - "cat $(location :providers.api) | sed 's/^##/\\\n##/' >> $@", - tags = ["fix-windows"], ) -rules_nodejs_docs( - name = "docs", - assets = glob(["images/*"]), - config = "_config.yml", - css = "//docs/css", - docs = [ - "search.md", - "install.md", - "repositories.md", - "debugging.md", - "dependencies.md", - "stamping.md", - "index.md", - "examples.md", - "changing-rules.md", - ], - includes = glob(["_includes/*"]), - layouts = glob(["_layouts/*"]), - readmes = { - "Built-ins": ":builtins.doc", - "Concatjs": "//packages/concatjs:README.md", - "Cypress": "//packages/cypress:README.md", - "Jasmine": "//packages/jasmine:README.md", - "Labs": "//packages/labs:README.md", - "Protractor": "//packages/protractor:README.md", - "Rollup": "//packages/rollup:README.md", - "Terser": "//packages/terser:README.md", - "TypeScript": "//packages/typescript:README.md", - "esbuild": "//packages/esbuild:README.md", - }, - tags = [ - "fix-windows", - "manual", - ], +sh_binary( + name = "update", + srcs = ["update.sh"], + data = _READMES.values(), ) diff --git a/docs/Built-ins.html b/docs/Built-ins.html deleted file mode 100755 index 9c3417720c..0000000000 --- a/docs/Built-ins.html +++ /dev/null @@ -1,2700 +0,0 @@ - - - - - - - - - - rules_nodejs - Built-ins - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

Built-in rules

- -

These rules are available without any npm installation, via the WORKSPACE install of the build_bazel_rules_nodejs workspace. This is necessary to bootstrap Bazel to run the package manager to download other rules from NPM.

- -

node_repositories

- -

USAGE

- -
-node_repositories(name, node_download_auth, node_repositories, node_urls, node_version,
-                  package_json, preserve_symlinks, repo_mapping, vendored_node, vendored_yarn,
-                  yarn_download_auth, yarn_repositories, yarn_urls, yarn_version)
-
- -

To be run in user’s WORKSPACE to install rules_nodejs dependencies.

- -

This rule sets up node, npm, and yarn. The versions of these tools can be specified in one of three ways

- -

Simplest Usage

- -

Specify no explicit versions. This will download and use the latest NodeJS & Yarn that were available when the -version of rules_nodejs you’re using was released. -Note that you can skip calling node_repositories in your WORKSPACE file - if you later try to yarn_install or npm_install, -we’ll automatically select this simple usage for you.

- -

Forced version(s)

- -

You can select the version of NodeJS and/or Yarn to download & use by specifying it when you call node_repositories, -using a value that matches a known version (see the default values)

- -

Using a custom version

- -

You can pass in a custom list of NodeJS and/or Yarn repositories and URLs for node_resositories to use.

- -

Custom NodeJS versions

- -

To specify custom NodeJS versions, use the node_repositories attribute

- -
node_repositories(
-    node_repositories = {
-        "10.10.0-darwin_amd64": ("node-v10.10.0-darwin-x64.tar.gz", "node-v10.10.0-darwin-x64", "00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e"),
-        "10.10.0-linux_amd64": ("node-v10.10.0-linux-x64.tar.xz", "node-v10.10.0-linux-x64", "686d2c7b7698097e67bcd68edc3d6b5d28d81f62436c7cf9e7779d134ec262a9"),
-        "10.10.0-windows_amd64": ("node-v10.10.0-win-x64.zip", "node-v10.10.0-win-x64", "70c46e6451798be9d052b700ce5dadccb75cf917f6bf0d6ed54344c856830cfb"),
-    },
-)
-
- -

These can be mapped to a custom download URL, using node_urls

- -
node_repositories(
-    node_version = "10.10.0",
-    node_repositories = {"10.10.0-darwin_amd64": ("node-v10.10.0-darwin-x64.tar.gz", "node-v10.10.0-darwin-x64", "00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e")},
-    node_urls = ["https://mycorpproxy/mirror/node/v{version}/{filename}"],
-)
-
- -

A Mac client will try to download node from https://mycorpproxy/mirror/node/v10.10.0/node-v10.10.0-darwin-x64.tar.gz -and expect that file to have sha256sum 00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e

- -

Custom Yarn versions

- -

To specify custom Yarn versions, use the yarn_repositories attribute

- -
node_repositories(
-    yarn_repositories = {
-        "1.12.1": ("yarn-v1.12.1.tar.gz", "yarn-v1.12.1", "09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d"),
-    },
-)
-
- -

Like node_urls, the yarn_urls attribute can be used to provide a list of custom URLs to use to download yarn

- -
node_repositories(
-    yarn_repositories = {
-        "1.12.1": ("yarn-v1.12.1.tar.gz", "yarn-v1.12.1", "09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d"),
-    },
-    yarn_version = "1.12.1",
-    yarn_urls = [
-        "https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}",
-    ],
-)
-
- -

Will download yarn from https://github.com/yarnpkg/yarn/releases/download/v1.2.1/yarn-v1.12.1.tar.gz -and expect the file to have sha256sum 09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d.

- -

If you don’t use Yarn at all, you can skip downloading it by setting yarn_urls = [].

- -

Using a local version

- -

To avoid downloads, you can check in vendored copies of NodeJS and/or Yarn and set vendored_node and or vendored_yarn -to point to those before calling node_repositories. You can also point to a location where node is installed on your computer, -but we don’t recommend this because it leads to version skew between you, your coworkers, and your Continuous Integration environment. -It also ties your build to a single platform, preventing you from cross-compiling into a Linux docker image on Mac for example.

- -

See the the repositories documentation for how to use the resulting repositories.

- -

Manual install

- -

You can optionally pass a package_json array to node_repositories. This lets you use Bazel’s version of yarn or npm, yet always run the package manager yourself. -This is an advanced scenario you can use in place of the npm_install or yarn_install rules, but we don’t recommend it, and might remove it in the future.

- -
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
-node_repositories(package_json = ["//:package.json", "//subpkg:package.json"])
-
- -

Running bazel run @nodejs//:yarn_node_repositories in this repo would create /node_modules and /subpkg/node_modules.

- -

Note that the dependency installation scripts will run in each subpackage indicated by the package_json attribute.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this repository.

- -

node_download_auth

- -

(Dictionary: String -> String): auth to use for all url requests -Example: {β€œtype”: β€œbasic”, β€œlogin”: β€œ", "password": "" }

- -

Defaults to {}

- -

node_repositories

- -

(Dictionary: String -> List of strings): Custom list of node repositories to use

- -

A dictionary mapping NodeJS versions to sets of hosts and their corresponding (filename, strip_prefix, sha256) tuples. -You should list a node binary for every platform users have, likely Mac, Windows, and Linux.

- -

By default, if this attribute has no items, we’ll use a list of all public NodeJS releases.

- -

Defaults to {}

- -

node_urls

- -

(List of strings): custom list of URLs to use to download NodeJS

- -

Each entry is a template for downloading a node distribution.

- -

The {version} parameter is substituted with the node_version attribute, -and {filename} with the matching entry from the node_repositories attribute.

- -

Defaults to ["https://nodejs.org/dist/v{version}/{filename}"]

- -

node_version

- -

(String): the specific version of NodeJS to install or, if vendored_node is specified, the vendored version of node

- -

Defaults to "12.13.0"

- -

package_json

- -

(List of labels): (ADVANCED, not recommended) - a list of labels, which indicate the package.json files that will be installed - when you manually run the package manager, e.g. with - bazel run @nodejs//:yarn_node_repositories or bazel run @nodejs//:npm_node_repositories install. - If you use bazel-managed dependencies, you should omit this attribute.

- -

Defaults to []

- - - -

(Boolean): Turn on –node_options=–preserve-symlinks for nodejs_binary and nodejs_test rules.

- -

When this option is turned on, node will preserve the symlinked path for resolves instead of the default -behavior of resolving to the real path. This means that all required files must be in be included in your -runfiles as it prevents the default behavior of potentially resolving outside of the runfiles. For example, -all required files need to be included in your node_modules filegroup. This option is desirable as it gives -a stronger guarantee of hermeticity which is required for remote execution.

- -

Defaults to True

- -

repo_mapping

- -

(Dictionary: String -> String, mandatory): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

- -

vendored_node

- -

(Label): the local path to a pre-installed NodeJS runtime.

- -

If set then also set node_version to the version that of node that is vendored.

- -

Defaults to None

- -

vendored_yarn

- -

(Label): the local path to a pre-installed yarn tool

- -

Defaults to None

- -

yarn_download_auth

- -

(Dictionary: String -> String): auth to use for all url requests -Example: {β€œtype”: β€œbasic”, β€œlogin”: β€œ", "password": "" }

- -

Defaults to {}

- -

yarn_repositories

- -

(Dictionary: String -> List of strings): Custom list of yarn repositories to use.

- -

Dictionary mapping Yarn versions to their corresponding (filename, strip_prefix, sha256) tuples.

- -

By default, if this attribute has no items, we’ll use a list of all public NodeJS releases.

- -

Defaults to {}

- -

yarn_urls

- -

(List of strings): custom list of URLs to use to download Yarn

- -

Each entry is a template, similar to the node_urls attribute, using yarn_version and yarn_repositories in the substitutions.

- -

If this list is empty, we won’t download yarn at all.

- -

Defaults to ["https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}"]

- -

yarn_version

- -

(String): the specific version of Yarn to install

- -

Defaults to "1.19.1"

- -

nodejs_binary

- -

USAGE

- -
-nodejs_binary(name, chdir, configuration_env_vars, data, default_env_vars, entry_point, env,
-              link_workspace_root, templated_args)
-
- -

Runs some JavaScript code in NodeJS.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

chdir

- -

(String): Working directory to run the binary or test in, relative to the workspace. -By default, Bazel always runs in the workspace root. -Due to implementation details, this argument must be underneath this package directory.

- -

To run in the directory containing the nodejs_binary / nodejs_test, use

- -
chdir = package_name()
-
- -

(or if you’re in a macro, use native.package_name())

- -

WARNING: this will affect other paths passed to the program, either as arguments or in configuration files, -which are workspace-relative. -You may need ../../ segments to re-relativize such paths to the new working directory.

- -

Defaults to ""

- -

configuration_env_vars

- -

(List of strings): Pass these configuration environment variables to the resulting binary. -Chooses a subset of the configuration environment variables (taken from ctx.var), which also -includes anything specified via the –define flag. -Note, this can lead to different outputs produced by this rule.

- -

Defaults to []

- -

data

- -

(List of labels): Runtime dependencies which may be loaded during execution.

- -

Defaults to []

- -

default_env_vars

- -

(List of strings): Default environment variables that are added to configuration_env_vars.

- -

This is separate from the default of configuration_env_vars so that a user can set configuration_env_vars -without losing the defaults that should be set in most cases.

- -

The set of default environment variables is:

- -
    -
  • VERBOSE_LOGS: use by some rules & tools to turn on debug output in their logs
  • -
  • NODE_DEBUG: used by node.js itself to print more logs
  • -
  • RUNFILES_LIB_DEBUG: print diagnostic message from Bazel runfiles.bash helper
  • -
- -

Defaults to ["VERBOSE_LOGS", "NODE_DEBUG", "RUNFILES_LIB_DEBUG"]

- -

entry_point

- -

(Label, mandatory): The script which should be executed first, usually containing a main function.

- -

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:

- -
nodejs_binary(
-    name = "my_binary",
-    ...
-    entry_point = ":file.js",
-)
-
- -

You can specify the entry point as a typescript file so long as you also include -the ts_library target in data:

- -
ts_library(
-    name = "main",
-    srcs = ["main.ts"],
-)
-
-nodejs_binary(
-    name = "bin",
-    data = [":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"],
-)
-
-nodejs_binary(
-    name = "my_binary",
-    entry_point = ":entry_file",
-)
-
- -

The entry_point can also be a label in another workspace:

- -
nodejs_binary(
-    name = "history-server",
-    entry_point = "@npm//:node_modules/history-server/modules/cli.js",
-    data = ["@npm//history-server"],
-)
-
- -

env

- -

(Dictionary: String -> String): Specifies additional environment variables to set when the target is executed, subject to location -expansion.

- -

Defaults to {}

- - - -

(Boolean): Link the workspace root to the bin_dir to support absolute requires like β€˜my_wksp/path/to/file’. -If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

- -

Defaults to False

- -

templated_args

- -

(List of strings): Arguments which are passed to every execution of the program. - To pass a node startup option, prepend it with --node_options=, e.g. - --node_options=--preserve-symlinks.

- -

Subject to β€˜Make variable’ substitution. See https://docs.bazel.build/versions/master/be/make-variables.html.

- -
    -
  1. Subject to predefined source/output path variables substitutions.
  2. -
- -

The predefined variables execpath, execpaths, rootpath, rootpaths, location, and locations take -label parameters (e.g. $(execpath //foo:bar)) and substitute the file paths denoted by that label.

- -

See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables for more info.

- -

NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test -args and genrule bazel substitions. This will be fixed in a future major release. -See docs string of expand_location_into_runfiles macro in internal/common/expand_into_runfiles.bzl -for more info.

- -

The recommended approach is to now use $(rootpath) where you previously used $(location).

- -

To get from a $(rootpath) to the absolute path that $$(rlocation $(location)) returned you can either use -$$(rlocation $(rootpath)) if you are in the templated_args of a nodejs_binary or nodejs_test:

- -

BUILD.bazel:

-
nodejs_test(
-    name = "my_test",
-    data = [":bootstrap.js"],
-    templated_args = ["--node_options=--require=$$(rlocation $(rootpath :bootstrap.js))"],
-)
-
- -

or if you’re in the context of a .js script you can pass the $(rootpath) as an argument to the script -and use the javascript runfiles helper to resolve to the absolute path:

- -

BUILD.bazel:

-
nodejs_test(
-    name = "my_test",
-    data = [":some_file"],
-    entry_point = ":my_test.js",
-    templated_args = ["$(rootpath :some_file)"],
-)
-
- -

my_test.js

-
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']);
-const args = process.argv.slice(2);
-const some_file = runfiles.resolveWorkspaceRelative(args[0]);
-
- -

NB: Bazel will error if it sees the single dollar sign $(rlocation path) in templated_args as it will try to -expand $(rlocation) since we now expand predefined & custom β€œmake” variables such as $(COMPILATION_MODE), -$(BINDIR) & $(TARGET_CPU) using ctx.expand_make_variables. See https://docs.bazel.build/versions/master/be/make-variables.html.

- -

To prevent expansion of $(rlocation) write it as $$(rlocation). Bazel understands $$ to be -the string literal $ and the expansion results in $(rlocation) being passed as an arg instead -of being expanded. $(rlocation) is then evaluated by the bash node launcher script and it calls -the rlocation function in the runfiles.bash helper. For example, the templated arg -$$(rlocation $(rootpath //:some_file)) is expanded by Bazel to $(rlocation ./some_file) which -is then converted in bash to the absolute path of //:some_file in runfiles by the runfiles.bash helper -before being passed as an argument to the program.

- -

NB: nodejs_binary and nodejs_test will preserve the legacy behavior of $(rlocation) so users don’t -need to update to $$(rlocation). This may be changed in the future.

- -
    -
  1. Subject to predefined variables & custom variable substitutions.
  2. -
- -

Predefined β€œMake” variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables.

- -

Custom variables are also expanded including variables set through the Bazel CLI with –define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables.

- -

Predefined genrule variables are not supported in this context.

- -

Defaults to []

- -

nodejs_test

- -

USAGE

- -
-nodejs_test(name, chdir, configuration_env_vars, data, default_env_vars, entry_point, env,
-            expected_exit_code, link_workspace_root, templated_args)
-
- -

Identical to nodejs_binary, except this can be used with bazel test as well. -When the binary returns zero exit code, the test passes; otherwise it fails.

- -

nodejs_test is a convenient way to write a novel kind of test based on running -your own test runner. For example, the ts-api-guardian library has a way to -assert the public API of a TypeScript program, and uses nodejs_test here: -https://github.com/angular/angular/blob/master/tools/ts-api-guardian/index.bzl

- -

If you just want to run a standard test using a test runner from npm, use the generated -*_test target created by npm_install/yarn_install, such as mocha_test. -Some test runners like Karma and Jasmine have custom rules with added features, e.g. jasmine_node_test.

- -

By default, Bazel runs tests with a working directory set to your workspace root. -Use the chdir attribute to change the working directory before the program starts.

- -

To debug a Node.js test, we recommend saving a group of flags together in a β€œconfig”. -Put this in your tools/bazel.rc so it’s shared with your team:

-
# Enable debugging tests with --config=debug
-test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
-
- -

Now you can add --config=debug to any bazel test command line. -The runtime will pause before executing the program, allowing you to connect a -remote debugger.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

chdir

- -

(String): Working directory to run the binary or test in, relative to the workspace. -By default, Bazel always runs in the workspace root. -Due to implementation details, this argument must be underneath this package directory.

- -

To run in the directory containing the nodejs_binary / nodejs_test, use

- -
chdir = package_name()
-
- -

(or if you’re in a macro, use native.package_name())

- -

WARNING: this will affect other paths passed to the program, either as arguments or in configuration files, -which are workspace-relative. -You may need ../../ segments to re-relativize such paths to the new working directory.

- -

Defaults to ""

- -

configuration_env_vars

- -

(List of strings): Pass these configuration environment variables to the resulting binary. -Chooses a subset of the configuration environment variables (taken from ctx.var), which also -includes anything specified via the –define flag. -Note, this can lead to different outputs produced by this rule.

- -

Defaults to []

- -

data

- -

(List of labels): Runtime dependencies which may be loaded during execution.

- -

Defaults to []

- -

default_env_vars

- -

(List of strings): Default environment variables that are added to configuration_env_vars.

- -

This is separate from the default of configuration_env_vars so that a user can set configuration_env_vars -without losing the defaults that should be set in most cases.

- -

The set of default environment variables is:

- -
    -
  • VERBOSE_LOGS: use by some rules & tools to turn on debug output in their logs
  • -
  • NODE_DEBUG: used by node.js itself to print more logs
  • -
  • RUNFILES_LIB_DEBUG: print diagnostic message from Bazel runfiles.bash helper
  • -
- -

Defaults to ["VERBOSE_LOGS", "NODE_DEBUG", "RUNFILES_LIB_DEBUG"]

- -

entry_point

- -

(Label, mandatory): The script which should be executed first, usually containing a main function.

- -

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:

- -
nodejs_binary(
-    name = "my_binary",
-    ...
-    entry_point = ":file.js",
-)
-
- -

You can specify the entry point as a typescript file so long as you also include -the ts_library target in data:

- -
ts_library(
-    name = "main",
-    srcs = ["main.ts"],
-)
-
-nodejs_binary(
-    name = "bin",
-    data = [":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"],
-)
-
-nodejs_binary(
-    name = "my_binary",
-    entry_point = ":entry_file",
-)
-
- -

The entry_point can also be a label in another workspace:

- -
nodejs_binary(
-    name = "history-server",
-    entry_point = "@npm//:node_modules/history-server/modules/cli.js",
-    data = ["@npm//history-server"],
-)
-
- -

env

- -

(Dictionary: String -> String): Specifies additional environment variables to set when the target is executed, subject to location -expansion.

- -

Defaults to {}

- -

expected_exit_code

- -

(Integer): The expected exit code for the test. Defaults to 0.

- -

Defaults to 0

- - - -

(Boolean): Link the workspace root to the bin_dir to support absolute requires like β€˜my_wksp/path/to/file’. -If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

- -

Defaults to False

- -

templated_args

- -

(List of strings): Arguments which are passed to every execution of the program. - To pass a node startup option, prepend it with --node_options=, e.g. - --node_options=--preserve-symlinks.

- -

Subject to β€˜Make variable’ substitution. See https://docs.bazel.build/versions/master/be/make-variables.html.

- -
    -
  1. Subject to predefined source/output path variables substitutions.
  2. -
- -

The predefined variables execpath, execpaths, rootpath, rootpaths, location, and locations take -label parameters (e.g. $(execpath //foo:bar)) and substitute the file paths denoted by that label.

- -

See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables for more info.

- -

NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test -args and genrule bazel substitions. This will be fixed in a future major release. -See docs string of expand_location_into_runfiles macro in internal/common/expand_into_runfiles.bzl -for more info.

- -

The recommended approach is to now use $(rootpath) where you previously used $(location).

- -

To get from a $(rootpath) to the absolute path that $$(rlocation $(location)) returned you can either use -$$(rlocation $(rootpath)) if you are in the templated_args of a nodejs_binary or nodejs_test:

- -

BUILD.bazel:

-
nodejs_test(
-    name = "my_test",
-    data = [":bootstrap.js"],
-    templated_args = ["--node_options=--require=$$(rlocation $(rootpath :bootstrap.js))"],
-)
-
- -

or if you’re in the context of a .js script you can pass the $(rootpath) as an argument to the script -and use the javascript runfiles helper to resolve to the absolute path:

- -

BUILD.bazel:

-
nodejs_test(
-    name = "my_test",
-    data = [":some_file"],
-    entry_point = ":my_test.js",
-    templated_args = ["$(rootpath :some_file)"],
-)
-
- -

my_test.js

-
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']);
-const args = process.argv.slice(2);
-const some_file = runfiles.resolveWorkspaceRelative(args[0]);
-
- -

NB: Bazel will error if it sees the single dollar sign $(rlocation path) in templated_args as it will try to -expand $(rlocation) since we now expand predefined & custom β€œmake” variables such as $(COMPILATION_MODE), -$(BINDIR) & $(TARGET_CPU) using ctx.expand_make_variables. See https://docs.bazel.build/versions/master/be/make-variables.html.

- -

To prevent expansion of $(rlocation) write it as $$(rlocation). Bazel understands $$ to be -the string literal $ and the expansion results in $(rlocation) being passed as an arg instead -of being expanded. $(rlocation) is then evaluated by the bash node launcher script and it calls -the rlocation function in the runfiles.bash helper. For example, the templated arg -$$(rlocation $(rootpath //:some_file)) is expanded by Bazel to $(rlocation ./some_file) which -is then converted in bash to the absolute path of //:some_file in runfiles by the runfiles.bash helper -before being passed as an argument to the program.

- -

NB: nodejs_binary and nodejs_test will preserve the legacy behavior of $(rlocation) so users don’t -need to update to $$(rlocation). This may be changed in the future.

- -
    -
  1. Subject to predefined variables & custom variable substitutions.
  2. -
- -

Predefined β€œMake” variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables.

- -

Custom variables are also expanded including variables set through the Bazel CLI with –define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables.

- -

Predefined genrule variables are not supported in this context.

- -

Defaults to []

- -

npm_install

- -

USAGE

- -
-npm_install(name, args, data, environment, generate_local_modules_build_files, included_files,
-            links, manual_build_file_contents, npm_command, package_json, package_lock_json,
-            package_path, patch_args, patch_tool, post_install_patches, pre_install_patches, quiet,
-            repo_mapping, strict_visibility, symlink_node_modules, timeout)
-
- -

Runs npm install during workspace setup.

- -

This rule will set the environment variable BAZEL_NPM_INSTALL to β€˜1’ (unless it -set to another value in the environment attribute). Scripts may use to this to -check if yarn is being run by the npm_install repository rule.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this repository.

- -

args

- -

(List of strings): Arguments passed to npm install.

- -

See npm CLI docs https://docs.npmjs.com/cli/install.html for complete list of supported arguments.

- -

Defaults to []

- -

data

- -

(List of labels): Data files required by this rule.

- -

If symlink_node_modules is True, this attribute is optional since the package manager -will run in your workspace folder. It is recommended, however, that all files that the -package manager depends on, such as .rc files or files used in postinstall, are added -symlink_node_modules is True so that the repository rule is rerun when any of these files -change.

- -

If symlink_node_modules is False, the package manager is run in the bazel external -repository so all files that the package manager depends on must be listed.

- -

Defaults to []

- -

environment

- -

(Dictionary: String -> String): Environment variables to set before calling the package manager.

- -

Defaults to {}

- -

generate_local_modules_build_files

- -

(Boolean): Enables the BUILD files auto generation for local modules installed with file: (npm) or link: (yarn)

- -

When using a monorepo it’s common to have modules that we want to use locally and -publish to an external package repository. This can be achieved using a js_library rule -with a package_name attribute defined inside the local package BUILD file. However, -if the project relies on the local package dependency with file: (npm) or link: (yarn) to be used outside Bazel, this -could introduce a race condition with both npm_install or yarn_install rules.

- -

In order to overcome it, a link could be created to the package BUILD file from the -npm external Bazel repository (so we can use a local BUILD file instead of an auto generated one), -which require us to set generate_local_modules_build_files = False and complete a last step which is writing the -expected targets on that same BUILD file to be later used both by npm_install or yarn_install -rules, which are: <package_name__files>, <package_name__nested_node_modules>, -<package_name__contents>, <package_name__typings> and the last one just <package_name>. If you doubt what those targets -should look like, check the generated BUILD file for a given node module.

- -

When true, the rule will follow the default behaviour of auto generating BUILD files for each node_module at install time.

- -

When False, the rule will not auto generate BUILD files for node_modules that are installed as symlinks for local modules.

- -

Defaults to True

- -

included_files

- -

(List of strings): List of file extensions to be included in the npm package targets.

- -

For example, [β€œ.js”, β€œ.d.ts”, β€œ.proto”, β€œ.json”, β€œβ€].

- -

This option is useful to limit the number of files that are inputs -to actions that depend on npm package targets. See -https://github.com/bazelbuild/bazel/issues/5153.

- -

If set to an empty list then all files are included in the package targets. -If set to a list of extensions, only files with matching extensions are -included in the package targets. An empty string in the list is a special -string that denotes that files with no extensions such as README should -be included in the package targets.

- -

This attribute applies to both the coarse @wksp//:node_modules target -as well as the fine grained targets such as @wksp//foo.

- -

Defaults to []

- - - -

(Dictionary: String -> String): Targets to link as npm packages.

- -

A mapping of npm package names to bazel targets to linked into node_modules.

- -

If package_path is also set, the bazel target will be linked to the node_modules at package_path -along with other 3rd party npm packages from this rule.

- -

For example,

- -
yarn_install(
-    name = "npm",
-    package_json = "//web:package.json",
-    yarn_lock = "//web:yarn.lock",
-    package_path = "web",
-    links = {
-        "@scope/target": "//some/scoped/target",
-        "target": "//some/target",
-    },
-)
-
- -

creates targets in the @npm external workspace that can be used by other rules which -are linked into web/node_modules along side the 3rd party deps since the project_path is web.

- -

The above links will create the targets,

- -
@npm//@scope/target
-@npm//target
-
- -

that can be referenced as data or deps by other rules such as nodejs_binary and ts_project -and can be required as @scope/target and target with standard node_modules resolution at runtime,

- -
nodejs_binary(
-    name = "bin",
-    entry_point = "bin.js",
-    deps = [
-        "@npm//@scope/target",
-        "@npm//target"
-        "@npm//other/dep"
-    ],
-)
-
-ts_project(
-    name = "test",
-    srcs = [...],
-    deps = [
-        "@npm//@scope/target",
-        "@npm//target"
-        "@npm//other/dep"
-    ],
-)
-
- -

Defaults to {}

- -

manual_build_file_contents

- -

(String): Experimental attribute that can be used to override the generated BUILD.bazel file and set its contents manually.

- -

Can be used to work-around a bazel performance issue if the -default @wksp//:node_modules target has too many files in it. -See https://github.com/bazelbuild/bazel/issues/5153. If -you are running into performance issues due to a large -node_modules target it is recommended to switch to using -fine grained npm dependencies.

- -

Defaults to ""

- -

npm_command

- -

(String): The npm command to run, to install dependencies.

- -
        See npm docs <https://docs.npmjs.com/cli/v6/commands>
-
-        In particular, for "ci" it says:
-        > If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
-
- -

Defaults to "ci"

- -

package_json

- -

(Label, mandatory)

- -

package_lock_json

- -

(Label, mandatory)

- -

package_path

- -

(String): If set, link the 3rd party node_modules dependencies under the package path specified.

- -

In most cases, this should be the directory of the package.json file so that the linker links the node_modules -in the same location they are found in the source tree. In a future release, this will default to the package.json -directory. This is planned for 4.0: https://github.com/bazelbuild/rules_nodejs/issues/2451

- -

Defaults to ""

- -

patch_args

- -

(List of strings): The arguments given to the patch tool. Defaults to -p0, however -p1 will usually be needed for patches generated by git. If multiple -p arguments are specified, the last one will take effect.If arguments other than -p are specified, Bazel will fall back to use patch command line tool instead of the Bazel-native patch implementation. When falling back to patch command line tool and patch_tool attribute is not specified, patch will be used.

- -

Defaults to ["-p0"]

- -

patch_tool

- -

(String): The patch(1) utility to use. If this is specified, Bazel will use the specifed patch tool instead of the Bazel-native patch implementation.

- -

Defaults to ""

- -

post_install_patches

- -

(List of labels): Patch files to apply after running package manager.

- -

This can be used to make changes to installed packages after the package manager runs.

- -

File paths in patches should be relative to workspace root.

- -

Defaults to []

- -

pre_install_patches

- -

(List of labels): Patch files to apply before running package manager.

- -

This can be used to make changes to package.json or other data files passed in before running the -package manager.

- -

File paths in patches should be relative to workspace root.

- -

Defaults to []

- -

quiet

- -

(Boolean): If stdout and stderr should be printed to the terminal.

- -

Defaults to True

- -

repo_mapping

- -

(Dictionary: String -> String, mandatory): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

- -

strict_visibility

- -

(Boolean): Turn on stricter visibility for generated BUILD.bazel files

- -

When enabled, only dependencies within the given package.json file are given public visibility. -All transitive dependencies are given limited visibility, enforcing that all direct dependencies are -listed in the package.json file.

- -

Defaults to True

- - - -

(Boolean): Turn symlinking of node_modules on

- -

This requires the use of Bazel 0.26.0 and the experimental -managed_directories feature.

- -

When true, the package manager will run in the package.json folder -and the resulting node_modules folder will be symlinked into the -external repository create by this rule.

- -

When false, the package manager will run in the external repository -created by this rule and any files other than the package.json file and -the lock file that are required for it to run should be listed in the -data attribute.

- -

Defaults to True

- -

timeout

- -

(Integer): Maximum duration of the package manager execution in seconds.

- -

Defaults to 3600

- -

pkg_npm

- -

USAGE

- -
-pkg_npm(name, deps, nested_packages, node_context_data, package_name, package_path, srcs,
-        substitutions, tgz, vendor_external)
-
- -

The pkg_npm rule creates a directory containing a publishable npm artifact.

- -

Example:

- -
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
-
-pkg_npm(
-    name = "my_package",
-    srcs = ["package.json"],
-    deps = [":my_typescript_lib"],
-    substitutions = {"//internal/": "//"},
-)
-
- -

You can use a pair of // BEGIN-INTERNAL ... // END-INTERNAL comments to mark regions of files that should be elided during publishing. -For example:

- -
function doThing() {
-    // BEGIN-INTERNAL
-    // This is a secret internal-only comment
-    doInternalOnlyThing();
-    // END-INTERNAL
-}
-
- -

With the Bazel stamping feature, pkg_npm will replace any placeholder version in your package with the actual version control tag. -See the stamping documentation

- -

Usage:

- -

pkg_npm yields four labels. Build the package directory using the default label:

- -
$ bazel build :my_package
-Target //:my_package up-to-date:
-  bazel-out/fastbuild/bin/my_package
-$ ls -R bazel-out/fastbuild/bin/my_package
-
- -

Dry-run of publishing to npm, calling npm pack (it builds the package first if needed):

- -
$ bazel run :my_package.pack
-INFO: Running command line: bazel-out/fastbuild/bin/my_package.pack
-my-package-name-1.2.3.tgz
-$ tar -tzf my-package-name-1.2.3.tgz
-
- -

Actually publish the package with npm publish (also builds first):

- -
# Check login credentials
-$ bazel run @nodejs//:npm_node_repositories who
-# Publishes the package
-$ bazel run :my_package.publish
-
- -

You can pass arguments to npm by escaping them from Bazel using a double-hyphen, for example:

- -

bazel run my_package.publish -- --tag=next

- -

It is also possible to use the resulting tar file file from the .pack as an action input via the .tar label. -To make use of this label, the tgz attribute must be set, and the generating pkg_npm rule must have a valid package.json file -as part of its sources:

- -
pkg_npm(
-    name = "my_package",
-    srcs = ["package.json"],
-    deps = [":my_typescript_lib"],
-    tgz = "my_package.tgz",
-)
-
-my_rule(
-    name = "foo",
-    srcs = [
-        "//:my_package.tar",
-    ],
-)
-
- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

deps

- -

(List of labels): Other targets which produce files that should be included in the package, such as rollup_bundle

- -

Defaults to []

- -

nested_packages

- -

(List of labels): Other pkg_npm rules whose content is copied into this package.

- -

Defaults to []

- -

node_context_data

- -

(Label): Provides info about the build context, such as stamping.

- -

By default it reads from the bazel command line, such as the --stamp argument. -Use this to override values for this target, such as enabling or disabling stamping. -You can use the node_context_data rule in @build_bazel_rules_nodejs//internal/node:context.bzl -to create a NodeContextInfo. The dependencies of this attribute must provide: NodeContextInfo

- -

Defaults to @build_bazel_rules_nodejs//internal:node_context_data

- -

package_name

- -

(String): Optional package_name that this npm package may be imported as.

- -

Defaults to ""

- -

package_path

- -

(String): The directory in the workspace to link to. -If set, link this pkg_npm to the node_modules under the package path specified. -If unset, the default is to link to the node_modules root of the workspace.

- -

Defaults to ""

- -

srcs

- -

(List of labels): Files inside this directory which are simply copied into the package.

- -

Defaults to []

- -

substitutions

- -

(Dictionary: String -> String): Key-value pairs which are replaced in all the files while building the package.

- -

You can use values from the workspace status command using curly braces, for example -{"0.0.0-PLACEHOLDER": "{STABLE_GIT_VERSION}"}.

- -

See the section on stamping in the README

- -

Defaults to {}

- -

tgz

- -

(String): If set, will create a .tgz file that can be used as an input to another rule, the tar will be given the name assigned to this attribute.

- -
    NOTE: If this attribute is set, a valid `package.json` file must be included in the sources of this target
-
- -

Defaults to ""

- -

vendor_external

- -

(List of strings): External workspaces whose contents should be vendored into this workspace. - Avoids external/foo path segments in the resulting package.

- -

Defaults to []

- -

pkg_web

- -

USAGE

- -
-pkg_web(name, additional_root_paths, node_context_data, srcs, substitutions)
-
- -

Assembles a web application from source files.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

additional_root_paths

- -

(List of strings): Path prefixes to strip off all srcs relative to the root of the repo, in addition to the current package. Longest wins.

- -

Defaults to []

- -

node_context_data

- -

(Label): Provides info about the build context, such as stamping.

- -

By default it reads from the bazel command line, such as the --stamp argument. -Use this to override values for this target, such as enabling or disabling stamping. -You can use the node_context_data rule in @build_bazel_rules_nodejs//internal/node:context.bzl -to create a NodeContextInfo. The dependencies of this attribute must provide: NodeContextInfo

- -

Defaults to @build_bazel_rules_nodejs//internal:node_context_data

- -

srcs

- -

(List of labels): Files which should be copied into the package

- -

Defaults to []

- -

substitutions

- -

(Dictionary: String -> String): Key-value pairs which are replaced in all the files while building the package.

- -

You can use values from the workspace status command using curly braces, for example -{"0.0.0-PLACEHOLDER": "{STABLE_GIT_VERSION}"}. -See the section on stamping in the README.

- -

Defaults to {}

- -

yarn_install

- -

USAGE

- -
-yarn_install(name, args, data, environment, frozen_lockfile, generate_local_modules_build_files,
-             included_files, links, manual_build_file_contents, package_json, package_path,
-             patch_args, patch_tool, post_install_patches, pre_install_patches, quiet, repo_mapping,
-             strict_visibility, symlink_node_modules, timeout, use_global_yarn_cache, yarn_lock)
-
- -

Runs yarn install during workspace setup.

- -

This rule will set the environment variable BAZEL_YARN_INSTALL to β€˜1’ (unless it -set to another value in the environment attribute). Scripts may use to this to -check if yarn is being run by the yarn_install repository rule.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this repository.

- -

args

- -

(List of strings): Arguments passed to yarn install.

- -

See yarn CLI docs https://yarnpkg.com/en/docs/cli/install for complete list of supported arguments.

- -

Defaults to []

- -

data

- -

(List of labels): Data files required by this rule.

- -

If symlink_node_modules is True, this attribute is optional since the package manager -will run in your workspace folder. It is recommended, however, that all files that the -package manager depends on, such as .rc files or files used in postinstall, are added -symlink_node_modules is True so that the repository rule is rerun when any of these files -change.

- -

If symlink_node_modules is False, the package manager is run in the bazel external -repository so all files that the package manager depends on must be listed.

- -

Defaults to []

- -

environment

- -

(Dictionary: String -> String): Environment variables to set before calling the package manager.

- -

Defaults to {}

- -

frozen_lockfile

- -

(Boolean): Use the --frozen-lockfile flag for yarn.

- -

Don’t generate a yarn.lock lockfile and fail if an update is needed.

- -

This flag enables an exact install of the version that is specified in the yarn.lock -file. This helps to have reproducible builds across builds.

- -

To update a dependency or install a new one run the yarn install command with the -vendored yarn binary. bazel run @nodejs//:yarn install. You can pass the options like -bazel run @nodejs//:yarn install -- -D <dep-name>.

- -

Defaults to True

- -

generate_local_modules_build_files

- -

(Boolean): Enables the BUILD files auto generation for local modules installed with file: (npm) or link: (yarn)

- -

When using a monorepo it’s common to have modules that we want to use locally and -publish to an external package repository. This can be achieved using a js_library rule -with a package_name attribute defined inside the local package BUILD file. However, -if the project relies on the local package dependency with file: (npm) or link: (yarn) to be used outside Bazel, this -could introduce a race condition with both npm_install or yarn_install rules.

- -

In order to overcome it, a link could be created to the package BUILD file from the -npm external Bazel repository (so we can use a local BUILD file instead of an auto generated one), -which require us to set generate_local_modules_build_files = False and complete a last step which is writing the -expected targets on that same BUILD file to be later used both by npm_install or yarn_install -rules, which are: <package_name__files>, <package_name__nested_node_modules>, -<package_name__contents>, <package_name__typings> and the last one just <package_name>. If you doubt what those targets -should look like, check the generated BUILD file for a given node module.

- -

When true, the rule will follow the default behaviour of auto generating BUILD files for each node_module at install time.

- -

When False, the rule will not auto generate BUILD files for node_modules that are installed as symlinks for local modules.

- -

Defaults to True

- -

included_files

- -

(List of strings): List of file extensions to be included in the npm package targets.

- -

For example, [β€œ.js”, β€œ.d.ts”, β€œ.proto”, β€œ.json”, β€œβ€].

- -

This option is useful to limit the number of files that are inputs -to actions that depend on npm package targets. See -https://github.com/bazelbuild/bazel/issues/5153.

- -

If set to an empty list then all files are included in the package targets. -If set to a list of extensions, only files with matching extensions are -included in the package targets. An empty string in the list is a special -string that denotes that files with no extensions such as README should -be included in the package targets.

- -

This attribute applies to both the coarse @wksp//:node_modules target -as well as the fine grained targets such as @wksp//foo.

- -

Defaults to []

- - - -

(Dictionary: String -> String): Targets to link as npm packages.

- -

A mapping of npm package names to bazel targets to linked into node_modules.

- -

If package_path is also set, the bazel target will be linked to the node_modules at package_path -along with other 3rd party npm packages from this rule.

- -

For example,

- -
yarn_install(
-    name = "npm",
-    package_json = "//web:package.json",
-    yarn_lock = "//web:yarn.lock",
-    package_path = "web",
-    links = {
-        "@scope/target": "//some/scoped/target",
-        "target": "//some/target",
-    },
-)
-
- -

creates targets in the @npm external workspace that can be used by other rules which -are linked into web/node_modules along side the 3rd party deps since the project_path is web.

- -

The above links will create the targets,

- -
@npm//@scope/target
-@npm//target
-
- -

that can be referenced as data or deps by other rules such as nodejs_binary and ts_project -and can be required as @scope/target and target with standard node_modules resolution at runtime,

- -
nodejs_binary(
-    name = "bin",
-    entry_point = "bin.js",
-    deps = [
-        "@npm//@scope/target",
-        "@npm//target"
-        "@npm//other/dep"
-    ],
-)
-
-ts_project(
-    name = "test",
-    srcs = [...],
-    deps = [
-        "@npm//@scope/target",
-        "@npm//target"
-        "@npm//other/dep"
-    ],
-)
-
- -

Defaults to {}

- -

manual_build_file_contents

- -

(String): Experimental attribute that can be used to override the generated BUILD.bazel file and set its contents manually.

- -

Can be used to work-around a bazel performance issue if the -default @wksp//:node_modules target has too many files in it. -See https://github.com/bazelbuild/bazel/issues/5153. If -you are running into performance issues due to a large -node_modules target it is recommended to switch to using -fine grained npm dependencies.

- -

Defaults to ""

- -

package_json

- -

(Label, mandatory)

- -

package_path

- -

(String): If set, link the 3rd party node_modules dependencies under the package path specified.

- -

In most cases, this should be the directory of the package.json file so that the linker links the node_modules -in the same location they are found in the source tree. In a future release, this will default to the package.json -directory. This is planned for 4.0: https://github.com/bazelbuild/rules_nodejs/issues/2451

- -

Defaults to ""

- -

patch_args

- -

(List of strings): The arguments given to the patch tool. Defaults to -p0, however -p1 will usually be needed for patches generated by git. If multiple -p arguments are specified, the last one will take effect.If arguments other than -p are specified, Bazel will fall back to use patch command line tool instead of the Bazel-native patch implementation. When falling back to patch command line tool and patch_tool attribute is not specified, patch will be used.

- -

Defaults to ["-p0"]

- -

patch_tool

- -

(String): The patch(1) utility to use. If this is specified, Bazel will use the specifed patch tool instead of the Bazel-native patch implementation.

- -

Defaults to ""

- -

post_install_patches

- -

(List of labels): Patch files to apply after running package manager.

- -

This can be used to make changes to installed packages after the package manager runs.

- -

File paths in patches should be relative to workspace root.

- -

Defaults to []

- -

pre_install_patches

- -

(List of labels): Patch files to apply before running package manager.

- -

This can be used to make changes to package.json or other data files passed in before running the -package manager.

- -

File paths in patches should be relative to workspace root.

- -

Defaults to []

- -

quiet

- -

(Boolean): If stdout and stderr should be printed to the terminal.

- -

Defaults to True

- -

repo_mapping

- -

(Dictionary: String -> String, mandatory): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

- -

strict_visibility

- -

(Boolean): Turn on stricter visibility for generated BUILD.bazel files

- -

When enabled, only dependencies within the given package.json file are given public visibility. -All transitive dependencies are given limited visibility, enforcing that all direct dependencies are -listed in the package.json file.

- -

Defaults to True

- - - -

(Boolean): Turn symlinking of node_modules on

- -

This requires the use of Bazel 0.26.0 and the experimental -managed_directories feature.

- -

When true, the package manager will run in the package.json folder -and the resulting node_modules folder will be symlinked into the -external repository create by this rule.

- -

When false, the package manager will run in the external repository -created by this rule and any files other than the package.json file and -the lock file that are required for it to run should be listed in the -data attribute.

- -

Defaults to True

- -

timeout

- -

(Integer): Maximum duration of the package manager execution in seconds.

- -

Defaults to 3600

- -

use_global_yarn_cache

- -

(Boolean): Use the global yarn cache on the system.

- -

The cache lets you avoid downloading packages multiple times. -However, it can introduce non-hermeticity, and the yarn cache can -have bugs.

- -

Disabling this attribute causes every run of yarn to have a unique -cache_directory.

- -

If True, this rule will pass --mutex network to yarn to ensure that -the global cache can be shared by parallelized yarn_install rules.

- -

If False, this rule will pass --cache-folder /path/to/external/repository/__yarn_cache -to yarn so that the local cache is contained within the external repository.

- -

Defaults to True

- -

yarn_lock

- -

(Label, mandatory)

- -

check_bazel_version

- -

USAGE

- -
-check_bazel_version(minimum_bazel_version, message)
-
- -
Verify the users Bazel version is at least the given one.
-
- -

This can be used in rule implementations that depend on changes in Bazel, -to warn users about a mismatch between the rule and their installed Bazel -version.

- -

This should not be used in users WORKSPACE files. To locally pin your -Bazel version, just create the .bazelversion file in your workspace.

- -

PARAMETERS

- -

minimum_bazel_version

- -

a string indicating the minimum version

- -

message

- -

optional string to print to your users, could be used to help them update

- -

Defaults to ""

- -

copy_to_bin

- -

USAGE

- -
-copy_to_bin(name, srcs, kwargs)
-
- -

Copies a source file to bazel-bin at the same workspace-relative path.

- -

e.g. <workspace_root>/foo/bar/a.txt -> <bazel-bin>/foo/bar/a.txt

- -

This is useful to populate the output folder with all files needed at runtime, even -those which aren’t outputs of a Bazel rule.

- -

This way you can run a binary in the output folder (execroot or runfiles_root) -without that program needing to rely on a runfiles helper library or be aware that -files are divided between the source tree and the output tree.

- -

PARAMETERS

- -

name

- -

Name of the rule.

- -

srcs

- -

A List of Labels. File(s) to to copy.

- -

kwargs

- -

further keyword arguments, e.g. visibility

- -

generated_file_test

- -

USAGE

- -
-generated_file_test(name, generated, src, substring_search, src_dbg, kwargs)
-
- -

Tests that a file generated by Bazel has identical content to a file in the workspace.

- -

This is useful for testing, where a β€œsnapshot” or β€œgolden” file is checked in, -so that you can code review changes to the generated output.

- -

PARAMETERS

- -

name

- -

Name of the rule.

- -

generated

- -

a Label of the output file generated by another rule

- -

src

- -

Label of the source file in the workspace

- - - -

When true, creates a test that will fail only if the golden file is not found -anywhere within the generated file. Note that the .update rule is not generated in substring mode.

- -

Defaults to False

- -

src_dbg

- -

if the build uses --compilation_mode dbg then some rules will produce different output. -In this case you can specify what the dbg version of the output should look like

- -

Defaults to None

- -

kwargs

- -

extra arguments passed to the underlying nodejs_test

- -

js_library

- -

USAGE

- -
-js_library(name, srcs, package_name, package_path, deps, kwargs)
-
- -

Groups JavaScript code so that it can be depended on like an npm package.

- -

js_library is intended to be used internally within Bazel, such as between two libraries in your monorepo. -This rule doesn’t perform any build steps (β€œactions”) so it is similar to a filegroup. -However it provides several Bazel β€œProviders” for interop with other rules.

- -
-

Compare this to pkg_npm which just produces a directory output, and therefore can’t expose individual -files to downstream targets and causes a cascading re-build of all transitive dependencies when any file -changes. Also pkg_npm is intended to publish your code for external usage outside of Bazel, like -by publishing to npm or artifactory, while js_library is for internal dependencies within your repo.

-
- -

js_library also copies any source files into the bazel-out folder. -This is the same behavior as the copy_to_bin rule. -By copying the complete package to the output tree, we ensure that the linker (our npm link equivalent) -will make your source files available in the node_modules tree where resolvers expect them. -It also means you can have relative imports between the files -rather than being forced to use Bazel’s β€œRunfiles” semantics where any program might need a helper library -to resolve files between the logical union of the source tree and the output tree.

- -

Example

- -

A typical example usage of js_library is to expose some sources with a package name:

- -
ts_project(
-    name = "compile_ts",
-    srcs = glob(["*.ts"]),
-)
-
-js_library(
-    name = "my_pkg",
-    # Code that depends on this target can import from "@myco/mypkg"
-    package_name = "@myco/mypkg",
-    # Consumers might need fields like "main" or "typings"
-    srcs = ["package.json"],
-    # The .js and .d.ts outputs from above will be part of the package
-    deps = [":compile_ts"],
-)
-
- -
-

To help work with β€œnamed AMD” modules as required by concatjs_devserver and other Google-style β€œconcatjs” rules, -js_library has some undocumented advanced features you can find in the source code or in our examples. -These should not be considered a public API and aren’t subject to our usual support and semver guarantees.

-
- -

Outputs

- -

Like all Bazel rules it produces a default output by providing DefaultInfo. -You’ll get these outputs if you include this in the srcs of a typical rule like filegroup, -and these will be the printed result when you bazel build //some:js_library_target. -The default outputs are all of:

-
    -
  • DefaultInfo produced by targets in deps
  • -
  • A copy of all sources (InputArtifacts from your source tree) in the bazel-out directory
  • -
- -

When there are TypeScript typings files, js_library provides DeclarationInfo -so this target can be a dependency of a TypeScript rule. This includes any .d.ts files in srcs as well -as transitive ones from deps. -It will also provide OutputGroupInfo with a β€œtypes” field, so you can select the typings outputs with -bazel build //some:js_library_target --output_groups=types or with a filegroup rule using the -output_group attribute.

- -

In order to work with the linker (similar to npm link for first-party monorepo deps), js_library provides -LinkablePackageInfo for use with our β€œlinker” that makes this package importable.

- -

It also provides:

- - -

PARAMETERS

- -

name

- -

The name for the target

- -

srcs

- -

The list of files that comprise the package

- -

Defaults to []

- -

package_name

- -

The name it will be imported by. Should match the β€œname” field in the package.json file.

- -

If package_name == β€œ$node_modules$” this indictates that this js_library target is one or more external npm -packages in node_modules. This is a special case that used be covered by the internal only -external_npm_package attribute. NB: β€˜$’ is an illegal character -for npm packages names so this reserved name will not conflict with any valid package_name values

- -

This is used by the yarn_install & npm_install repository rules for npm dependencies installed by -yarn & npm. When true, js_library will provide ExternalNpmPackageInfo.

- -

It can also be used for user-managed npm dependencies if node_modules is layed out outside of bazel. -For example,

- -

js_library( - name = β€œnode_modules”, - srcs = glob( - include = [ - β€œnode_modules//.js”, - β€œnode_modules/**/.d.ts”, - β€œnode_modules//.json”, - β€œnode_modules/.bin/”, - ], - exclude = [ - # Files under test & docs may contain file names that - # are not legal Bazel labels (e.g., - # node_modules/ecstatic/test/public/À¸­æ–‡/Γ¦ΒͺΒ”Γ¦Β‘Βˆ.html) - β€œnode_modules//test/”, - β€œnode_modules//docs/”, - # Files with spaces in the name are not legal Bazel labels - β€œnode_modules/*/ /”, - β€œnode_modules// *”, - ], - ), - # Special value to provide ExternalNpmPackageInfo which is used by downstream - # rules that use these npm dependencies - package_name = β€œ$node_modules$”, -)

- -

See examples/user_managed_deps for a working example of user-managed npm dependencies.

- -

Defaults to None

- -

package_path

- -

The directory in the workspace to link to. -If set, link this js_library to the node_modules under the package path specified. -If unset, the default is to link to the node_modules root of the workspace.

- -

Defaults to ""

- -

deps

- -

Other targets that provide JavaScript code

- -

Defaults to []

- -

kwargs

- -

Other attributes

- -

npm_package_bin

- -

USAGE

- -
-npm_package_bin(tool, package, package_bin, data, env, outs, args, stderr, stdout, exit_code_out,
-                output_dir, link_workspace_root, chdir, kwargs)
-
- -

Run an arbitrary npm package binary (e.g. a program under node_modules/.bin/*) under Bazel.

- -

It must produce outputs. If you just want to run a program with bazel run, use the nodejs_binary rule.

- -

This is like a genrule() except that it runs our launcher script that first -links the node_modules tree before running the program.

- -

By default, Bazel runs actions with a working directory set to your workspace root. -Use the chdir attribute to change the working directory before the program runs.

- -

This is a great candidate to wrap with a macro, as documented: -https://docs.bazel.build/versions/master/skylark/macros.html#full-example

- -

PARAMETERS

- -

tool

- -

a label for a binary to run, like @npm//terser/bin:terser. This is the longer form of package/package_bin. -Note that you can also refer to a binary in your local workspace.

- -

Defaults to None

- -

package

- -

an npm package whose binary to run, like β€œterser”. Assumes your node_modules are installed in a workspace called β€œnpm”

- -

Defaults to None

- -

package_bin

- -

the β€œbin” entry from package that should be run. By default package_bin is the same string as package

- -

Defaults to None

- -

data

- -

similar to genrule.srcs -may also include targets that produce or reference npm packages which are needed by the tool

- -

Defaults to []

- -

env

- -

specifies additional environment variables to set when the target is executed

- -

Defaults to {}

- -

outs

- -

similar to genrule.outs

- -

Defaults to []

- -

args

- -

Command-line arguments to the tool.

- -

Subject to β€˜Make variable’ substitution. See https://docs.bazel.build/versions/master/be/make-variables.html.

- -
    -
  1. Predefined source/output path substitions is applied first:
  2. -
- -

See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables.

- -

Use $(execpath) $(execpaths) to expand labels to the execroot (where Bazel runs build actions).

- -

Use $(rootpath) $(rootpaths) to expand labels to the runfiles path that a built binary can use -to find its dependencies.

- -

Since npm_package_bin is used primarily for build actions, in most cases you’ll want to -use $(execpath) or $(execpaths) to expand locations.

- -

Using $(location) and $(locations) expansions is not recommended as these are a synonyms -for either $(execpath) or $(rootpath) depending on the context.

- -
    -
  1. β€œMake” variables are expanded second:
  2. -
- -

Predefined β€œMake” variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables.

- -

Like genrule, you may also use some syntax sugar for locations.

- -
    -
  • $@: if you have only one output file, the location of the output
  • -
  • $(@D): The output directory. If output_dir=False and there is only one file name in outs, this expands to the directory - containing that file. If there are multiple files, this instead expands to the package’s root directory in the genfiles - tree, even if all generated files belong to the same subdirectory! If output_dir=True then this corresponds - to the output directory which is the $(RULEDIR)/{target_name}.
  • -
  • $(RULEDIR): the root output directory of the rule, corresponding with its package - (can be used with output_dir=True or False)
  • -
- -

See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_genrule_variables.

- -

Custom variables are also expanded including variables set through the Bazel CLI with –define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables.

- -

Defaults to []

- -

stderr

- -

set to capture the stderr of the binary to a file, which can later be used as an input to another target -subject to the same semantics as outs

- -

Defaults to None

- -

stdout

- -

set to capture the stdout of the binary to a file, which can later be used as an input to another target -subject to the same semantics as outs

- -

Defaults to None

- -

exit_code_out

- -

set to capture the exit code of the binary to a file, which can later be used as an input to another target -subject to the same semantics as outs. Note that setting this will force the binary to exit 0. -If the binary creates outputs and these are declared, they must still be created

- -

Defaults to None

- -

output_dir

- -

set to True if you want the output to be a directory -Exactly one of outs, output_dir may be used. -If you output a directory, there can only be one output, which will be a directory named the same as the target.

- -

Defaults to False

- - - -

Link the workspace root to the bin_dir to support absolute requires like β€˜my_wksp/path/to/file’. -If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

- -

Defaults to False

- -

chdir

- -

Working directory to run the binary or test in, relative to the workspace.

- -

By default, Bazel always runs in the workspace root.

- -

To run in the directory containing the npm_package_bin under the source tree, use -chdir = package_name() -(or if you’re in a macro, use native.package_name()).

- -

To run in the output directory where the npm_package_bin writes outputs, use -chdir = "$(RULEDIR)"

- -

WARNING: this will affect other paths passed to the program, either as arguments or in configuration files, -which are workspace-relative. -You may need ../../ segments to re-relativize such paths to the new working directory. -In a BUILD file you could do something like this to point to the output path:

- -
_package_segments = len(package_name().split("/"))
-npm_package_bin(
-    ...
-    chdir = package_name(),
-    # ../.. segments to re-relative paths from the chdir back to workspace
-    args = ["/".join([".."] * _package_segments + ["$@"])],
-)
-
- -

Defaults to None

- -

kwargs

- -

additional undocumented keyword args

- -

params_file

- -

USAGE

- -
-params_file(name, out, args, data, newline, kwargs)
-
- -

Generates a UTF-8 encoded params file from a list of arguments.

- -

Handles variable substitutions for args.

- -

PARAMETERS

- -

name

- -

Name of the rule.

- -

out

- -

Path of the output file, relative to this package.

- -

args

- -

Arguments to concatenate into a params file.

- -

Subject to β€˜Make variable’ substitution. See https://docs.bazel.build/versions/master/be/make-variables.html.

- -
    -
  1. Subject to predefined source/output path variables substitutions.
  2. -
- -

The predefined variables execpath, execpaths, rootpath, rootpaths, location, and locations take -label parameters (e.g. $(execpath //foo:bar)) and substitute the file paths denoted by that label.

- -

See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables for more info.

- -

NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test -args and genrule bazel substitions. This will be fixed in a future major release. -See docs string of expand_location_into_runfiles macro in internal/common/expand_into_runfiles.bzl -for more info.

- -
    -
  1. Subject to predefined variables & custom variable substitutions.
  2. -
- -

Predefined β€œMake” variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables.

- -

Custom variables are also expanded including variables set through the Bazel CLI with –define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables.

- -

Predefined genrule variables are not supported in this context.

- -

Defaults to []

- -

data

- -

Data for $(location) expansions in args.

- -

Defaults to []

- -

newline

- -

Line endings to use. One of [β€œauto”, β€œunix”, β€œwindows”].

- -

β€œauto” for platform-determined -β€œunix” for LF -β€œwindows” for CRLF

- -

Defaults to "auto"

- -

kwargs

- -

DeclarationInfo

- -

USAGE

- -
-DeclarationInfo(declarations, transitive_declarations, type_blacklisted_declarations)
-
- -

The DeclarationInfo provider allows JS rules to communicate typing information. -TypeScript’s .d.ts files are used as the interop format for describing types. -package.json files are included as well, as TypeScript needs to read the β€œtypings” property.

- -

Do not create DeclarationInfo instances directly, instead use the declaration_info factory function.

- -

Note: historically this was a subset of the string-typed β€œtypescript” provider.

- -

FIELDS

- -

declarations

- -

A depset of typings files produced by this rule

-

transitive_declarations

- -

A depset of typings files produced by this rule and all its transitive dependencies. -This prevents needing an aspect in rules that consume the typings, which improves performance.

-

type_blacklisted_declarations

- -

A depset of .d.ts files that we should not use to infer JSCompiler types (via tsickle)

- -

ExternalNpmPackageInfo

- -

USAGE

- -
-ExternalNpmPackageInfo(direct_sources, path, sources, workspace)
-
- -

Provides information about one or more external npm packages

- -

FIELDS

- -

direct_sources

- -

Depset of direct source files in these external npm package(s)

-

path

- -

The local workspace path that these external npm deps should be linked at. If empty, they will be linked at the root.

-

sources

- -

Depset of direct & transitive source files in these external npm package(s) and transitive dependencies

-

workspace

- -

The workspace name that these external npm package(s) are provided from

- -

JSEcmaScriptModuleInfo

- -

USAGE

- -
-JSEcmaScriptModuleInfo(direct_sources, sources)
-
- -

JavaScript files (and sourcemaps) that are intended to be consumed by downstream tooling.

- -

They should use modern syntax and ESModules. -These files should typically be named β€œfoo.mjs”

- -

Historical note: this was the typescript.es6_sources output

- -

FIELDS

- -

direct_sources

- -

Depset of direct JavaScript files and sourcemaps

-

sources

- -

Depset of direct and transitive JavaScript files and sourcemaps

- -

JSModuleInfo

- -

USAGE

- -
-JSModuleInfo(direct_sources, sources)
-
- -

JavaScript files and sourcemaps.

- -

FIELDS

- -

direct_sources

- -

Depset of direct JavaScript files and sourcemaps

-

sources

- -

Depset of direct and transitive JavaScript files and sourcemaps

- -

JSNamedModuleInfo

- -

USAGE

- -
-JSNamedModuleInfo(direct_sources, sources)
-
- -

JavaScript files whose module name is self-contained.

- -

For example named AMD/UMD or goog.module format. -These files can be efficiently served with the concatjs bundler. -These outputs should be named β€œfoo.umd.js” -(note that renaming it from β€œfoo.js” doesn’t affect the module id)

- -

Historical note: this was the typescript.es5_sources output.

- -

FIELDS

- -

direct_sources

- -

Depset of direct JavaScript files and sourcemaps

-

sources

- -

Depset of direct and transitive JavaScript files and sourcemaps

- -

LinkablePackageInfo

- -

USAGE

- -
-LinkablePackageInfo(files, package_name, package_path, path, _tslibrary)
-
- -

The LinkablePackageInfo provider provides information to the linker for linking pkg_npm built packages

- -

FIELDS

- -

files

- -

Depset of files in this package (must all be contained within path)

-

package_name

- -

The package name.

- -

This field is optional. If not set, the target can be made linkable to a package_name with the npm_link rule.

-

package_path

- -

The directory in the workspace to link to.

- -

If set, link the 1st party dependencies to the node_modules under the package path specified. -If unset, the default is to link to the node_modules root of the workspace.

-

path

- -

The path to link to.

- -

Path must be relative to execroot/wksp. It can either an output dir path such as,

- -

bazel-out/<platform>-<build>/bin/path/to/package or -bazel-out/<platform>-<build>/bin/external/external_wksp>/path/to/package

- -

or a source file path such as,

- -

path/to/package or -external/<external_wksp>/path/to/package

-

_tslibrary

- -

For internal use only

- -

NodeContextInfo

- -

USAGE

- -
-NodeContextInfo(stamp)
-
- -

Provides data about the build context, like config_setting’s

- -

FIELDS

- -

stamp

- -

If stamping is enabled

- -

NodeRuntimeDepsInfo

- -

USAGE

- -
-NodeRuntimeDepsInfo(deps, pkgs)
-
- -

Stores runtime dependencies of a nodejs_binary or nodejs_test

- -

These are files that need to be found by the node module resolver at runtime.

- -

Historically these files were passed using the Runfiles mechanism. -However runfiles has a big performance penalty of creating a symlink forest -with FS API calls for every file in node_modules. -It also causes there to be separate node_modules trees under each binary. This -prevents user-contributed modules passed as deps[] to a particular action from -being found by node module resolver, which expects everything in one tree.

- -

In node, this resolution is done dynamically by assuming a node_modules -tree will exist on disk, so we assume node actions/binary/test executions will -do the same.

- -

FIELDS

- -

deps

- -

depset of runtime dependency labels

-

pkgs

- -

list of labels of packages that provide ExternalNpmPackageInfo

- -

NpmPackageInfo

- -

USAGE

- -
-NpmPackageInfo(direct_sources, path, sources, workspace)
-
- -

Provides information about one or more external npm packages

- -

FIELDS

- -

direct_sources

- -

Depset of direct source files in these external npm package(s)

-

path

- -

The local workspace path that these external npm deps should be linked at. If empty, they will be linked at the root.

-

sources

- -

Depset of direct & transitive source files in these external npm package(s) and transitive dependencies

-

workspace

- -

The workspace name that these external npm package(s) are provided from

- -

declaration_info

- -

USAGE

- -
-declaration_info(declarations, deps)
-
- -

Constructs a DeclarationInfo including all transitive files needed to type-check from DeclarationInfo providers in a list of deps.

- -

PARAMETERS

- -

declarations

- -

list of typings files

- -

deps

- -

list of labels of dependencies where we should collect their DeclarationInfo to pass transitively

- -

Defaults to []

- -

js_ecma_script_module_info

- -

USAGE

- -
-js_ecma_script_module_info(sources, deps)
-
- -

Constructs a JSEcmaScriptModuleInfo including all transitive sources from JSEcmaScriptModuleInfo providers in a list of deps.

- -

Returns a single JSEcmaScriptModuleInfo.

- -

PARAMETERS

- -

sources

- -

deps

- -

Defaults to []

- -

js_module_info

- -

USAGE

- -
-js_module_info(sources, deps)
-
- -

Constructs a JSModuleInfo including all transitive sources from JSModuleInfo providers in a list of deps.

- -

Returns a single JSModuleInfo.

- -

PARAMETERS

- -

sources

- -

deps

- -

Defaults to []

- -

js_named_module_info

- -

USAGE

- -
-js_named_module_info(sources, deps)
-
- -

Constructs a JSNamedModuleInfo including all transitive sources from JSNamedModuleInfo providers in a list of deps.

- -

Returns a single JSNamedModuleInfo.

- -

PARAMETERS

- -

sources

- -

deps

- -

Defaults to []

- -

run_node

- -

USAGE

- -
-run_node(ctx, inputs, arguments, executable, chdir, kwargs)
-
- -

Helper to replace ctx.actions.run

- -

This calls node programs with a node_modules directory in place

- -

PARAMETERS

- -

ctx

- -

rule context from the calling rule implementation function

- -

inputs

- -

list or depset of inputs to the action

- -

arguments

- -

list or ctx.actions.Args object containing arguments to pass to the executable

- -

executable

- -

stringy representation of the executable this action will run, eg eg. β€œmy_executable” rather than ctx.executable.my_executable

- -

chdir

- -

directory we should change to be the working dir

- -

Defaults to None

- -

kwargs

- -

all other args accepted by ctx.actions.run

- -

node_modules_aspect

- -

USAGE

- -
-node_modules_aspect(name)
-
- -

ASPECT ATTRIBUTES

- -

deps

- -

ATTRIBUTES

- -

name

- -

(Name, {util.mandatoryString(name: β€œname” -doc_string: β€œA unique name for this target.” -type: NAME -mandatory: true -)}) - A unique name for this target.

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Built-ins.md b/docs/Built-ins.md index e1849298c5..fcbfd1201b 100755 --- a/docs/Built-ins.md +++ b/docs/Built-ins.md @@ -1,258 +1,16 @@ ---- -title: Built-ins -layout: default -toc: true -nav: rule ---- -# Built-in rules - -These rules are available without any npm installation, via the `WORKSPACE` install of the `build_bazel_rules_nodejs` workspace. This is necessary to bootstrap Bazel to run the package manager to download other rules from NPM. - - - - -## node_repositories - -**USAGE** - -
-node_repositories(name, node_download_auth, node_repositories, node_urls, node_version,
-                  package_json, preserve_symlinks, repo_mapping, vendored_node, vendored_yarn,
-                  yarn_download_auth, yarn_repositories, yarn_urls, yarn_version)
-
- -To be run in user's WORKSPACE to install rules_nodejs dependencies. - -This rule sets up node, npm, and yarn. The versions of these tools can be specified in one of three ways - - -### Simplest Usage - -Specify no explicit versions. This will download and use the latest NodeJS & Yarn that were available when the -version of rules_nodejs you're using was released. -Note that you can skip calling `node_repositories` in your WORKSPACE file - if you later try to `yarn_install` or `npm_install`, -we'll automatically select this simple usage for you. - - -### Forced version(s) - -You can select the version of NodeJS and/or Yarn to download & use by specifying it when you call node_repositories, -using a value that matches a known version (see the default values) - - -### Using a custom version - -You can pass in a custom list of NodeJS and/or Yarn repositories and URLs for node_resositories to use. - - -#### Custom NodeJS versions - -To specify custom NodeJS versions, use the `node_repositories` attribute - -```python -node_repositories( - node_repositories = { - "10.10.0-darwin_amd64": ("node-v10.10.0-darwin-x64.tar.gz", "node-v10.10.0-darwin-x64", "00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e"), - "10.10.0-linux_amd64": ("node-v10.10.0-linux-x64.tar.xz", "node-v10.10.0-linux-x64", "686d2c7b7698097e67bcd68edc3d6b5d28d81f62436c7cf9e7779d134ec262a9"), - "10.10.0-windows_amd64": ("node-v10.10.0-win-x64.zip", "node-v10.10.0-win-x64", "70c46e6451798be9d052b700ce5dadccb75cf917f6bf0d6ed54344c856830cfb"), - }, -) -``` - -These can be mapped to a custom download URL, using `node_urls` - -```python -node_repositories( - node_version = "10.10.0", - node_repositories = {"10.10.0-darwin_amd64": ("node-v10.10.0-darwin-x64.tar.gz", "node-v10.10.0-darwin-x64", "00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e")}, - node_urls = ["https://mycorpproxy/mirror/node/v{version}/{filename}"], -) -``` - -A Mac client will try to download node from `https://mycorpproxy/mirror/node/v10.10.0/node-v10.10.0-darwin-x64.tar.gz` -and expect that file to have sha256sum `00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e` - - -#### Custom Yarn versions - -To specify custom Yarn versions, use the `yarn_repositories` attribute - -```python -node_repositories( - yarn_repositories = { - "1.12.1": ("yarn-v1.12.1.tar.gz", "yarn-v1.12.1", "09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d"), - }, -) -``` - -Like `node_urls`, the `yarn_urls` attribute can be used to provide a list of custom URLs to use to download yarn - -```python -node_repositories( - yarn_repositories = { - "1.12.1": ("yarn-v1.12.1.tar.gz", "yarn-v1.12.1", "09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d"), - }, - yarn_version = "1.12.1", - yarn_urls = [ - "https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}", - ], -) -``` - -Will download yarn from https://github.com/yarnpkg/yarn/releases/download/v1.2.1/yarn-v1.12.1.tar.gz -and expect the file to have sha256sum `09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d`. - -If you don't use Yarn at all, you can skip downloading it by setting `yarn_urls = []`. - - -### Using a local version - -To avoid downloads, you can check in vendored copies of NodeJS and/or Yarn and set vendored_node and or vendored_yarn -to point to those before calling node_repositories. You can also point to a location where node is installed on your computer, -but we don't recommend this because it leads to version skew between you, your coworkers, and your Continuous Integration environment. -It also ties your build to a single platform, preventing you from cross-compiling into a Linux docker image on Mac for example. - -See the [the repositories documentation](repositories.html) for how to use the resulting repositories. - - -### Manual install - -You can optionally pass a `package_json` array to node_repositories. This lets you use Bazel's version of yarn or npm, yet always run the package manager yourself. -This is an advanced scenario you can use in place of the `npm_install` or `yarn_install` rules, but we don't recommend it, and might remove it in the future. - -``` -load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") -node_repositories(package_json = ["//:package.json", "//subpkg:package.json"]) -``` - -Running `bazel run @nodejs//:yarn_node_repositories` in this repo would create `/node_modules` and `/subpkg/node_modules`. - -Note that the dependency installation scripts will run in each subpackage indicated by the `package_json` attribute. - - -**ATTRIBUTES** - - -

name

- -(*Name, mandatory*): A unique name for this repository. - - -

node_download_auth

- -(*Dictionary: String -> String*): auth to use for all url requests -Example: {"type": "basic", "login": "", "password": "" } - -Defaults to `{}` - -

node_repositories

- -(*Dictionary: String -> List of strings*): Custom list of node repositories to use - -A dictionary mapping NodeJS versions to sets of hosts and their corresponding (filename, strip_prefix, sha256) tuples. -You should list a node binary for every platform users have, likely Mac, Windows, and Linux. - -By default, if this attribute has no items, we'll use a list of all public NodeJS releases. - -Defaults to `{}` - -

node_urls

- -(*List of strings*): custom list of URLs to use to download NodeJS - -Each entry is a template for downloading a node distribution. - -The `{version}` parameter is substituted with the `node_version` attribute, -and `{filename}` with the matching entry from the `node_repositories` attribute. - -Defaults to `["https://nodejs.org/dist/v{version}/{filename}"]` - -

node_version

- -(*String*): the specific version of NodeJS to install or, if vendored_node is specified, the vendored version of node - -Defaults to `"12.13.0"` - -

package_json

- -(*List of labels*): (ADVANCED, not recommended) - a list of labels, which indicate the package.json files that will be installed - when you manually run the package manager, e.g. with - `bazel run @nodejs//:yarn_node_repositories` or `bazel run @nodejs//:npm_node_repositories install`. - If you use bazel-managed dependencies, you should omit this attribute. - -Defaults to `[]` - - - -(*Boolean*): Turn on --node_options=--preserve-symlinks for nodejs_binary and nodejs_test rules. - -When this option is turned on, node will preserve the symlinked path for resolves instead of the default -behavior of resolving to the real path. This means that all required files must be in be included in your -runfiles as it prevents the default behavior of potentially resolving outside of the runfiles. For example, -all required files need to be included in your node_modules filegroup. This option is desirable as it gives -a stronger guarantee of hermeticity which is required for remote execution. - -Defaults to `True` - -

repo_mapping

- -(*Dictionary: String -> String, mandatory*): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`). - - -

vendored_node

- -(*Label*): the local path to a pre-installed NodeJS runtime. - -If set then also set node_version to the version that of node that is vendored. - -Defaults to `None` - -

vendored_yarn

- -(*Label*): the local path to a pre-installed yarn tool - -Defaults to `None` - -

yarn_download_auth

- -(*Dictionary: String -> String*): auth to use for all url requests -Example: {"type": "basic", "login": "", "password": "" } - -Defaults to `{}` - -

yarn_repositories

- -(*Dictionary: String -> List of strings*): Custom list of yarn repositories to use. - -Dictionary mapping Yarn versions to their corresponding (filename, strip_prefix, sha256) tuples. - -By default, if this attribute has no items, we'll use a list of all public NodeJS releases. - -Defaults to `{}` - -

yarn_urls

- -(*List of strings*): custom list of URLs to use to download Yarn - -Each entry is a template, similar to the `node_urls` attribute, using `yarn_version` and `yarn_repositories` in the substitutions. - -If this list is empty, we won't download yarn at all. - -Defaults to `["https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}"]` -

yarn_version

- -(*String*): the specific version of Yarn to install +# Built-in rules -Defaults to `"1.19.1"` +These rules are available without any npm installation, +via the `WORKSPACE` install of the `build_bazel_rules_nodejs` workspace. +This is necessary to bootstrap Bazel to run the package manager to download other rules from NPM. ## nodejs_binary @@ -261,10 +19,12 @@ Defaults to `"1.19.1"`
 nodejs_binary(name, chdir, configuration_env_vars, data, default_env_vars, entry_point, env,
-              link_workspace_root, templated_args)
+              link_workspace_root, templated_args, toolchain)
 
-Runs some JavaScript code in NodeJS. +Runs some JavaScript code in NodeJS. You can also change the default args that are sent to nodejs. This can be done through a flag. The default is --preserve-symlinks while anything +can be passed. The flag is --@rules_nodejs//nodejs:default_args="" ex: bazel build --@rules_nodejs//nodejs:default_args="--preserve-symlinks --no-warnings" //:target. +This will pass --preserve-symlinks and --no-warnings flags to nodejs. Available node flags can be found here: https://nodejs.org/api/cli.html. **ATTRIBUTES** @@ -384,7 +144,7 @@ nodejs_binary(

env

(*Dictionary: String -> String*): Specifies additional environment variables to set when the target is executed, subject to location -expansion. +and make variable expansion. Defaults to `{}` @@ -401,14 +161,14 @@ Defaults to `False` To pass a node startup option, prepend it with `--node_options=`, e.g. `--node_options=--preserve-symlinks`. -Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/master/be/make-variables.html. +Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html. 1. Subject to predefined source/output path variables substitutions. The predefined variables `execpath`, `execpaths`, `rootpath`, `rootpaths`, `location`, and `locations` take label parameters (e.g. `$(execpath //foo:bar)`) and substitute the file paths denoted by that label. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables for more info. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info. NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test args and genrule bazel substitions. This will be fixed in a future major release. @@ -451,7 +211,7 @@ const some_file = runfiles.resolveWorkspaceRelative(args[0]); NB: Bazel will error if it sees the single dollar sign $(rlocation path) in `templated_args` as it will try to expand `$(rlocation)` since we now expand predefined & custom "make" variables such as `$(COMPILATION_MODE)`, -`$(BINDIR)` & `$(TARGET_CPU)` using `ctx.expand_make_variables`. See https://docs.bazel.build/versions/master/be/make-variables.html. +`$(BINDIR)` & `$(TARGET_CPU)` using `ctx.expand_make_variables`. See https://docs.bazel.build/versions/main/be/make-variables.html. To prevent expansion of `$(rlocation)` write it as `$$(rlocation)`. Bazel understands `$$` to be the string literal `$` and the expansion results in `$(rlocation)` being passed as an arg instead @@ -467,15 +227,20 @@ need to update to `$$(rlocation)`. This may be changed in the future. 2. Subject to predefined variables & custom variable substitutions. Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables. Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables. Predefined genrule variables are not supported in this context. Defaults to `[]` +

toolchain

+ +(*Label*) + +Defaults to `None` ## nodejs_test @@ -484,7 +249,7 @@ Defaults to `[]`
 nodejs_test(name, chdir, configuration_env_vars, data, default_env_vars, entry_point, env,
-            expected_exit_code, link_workspace_root, templated_args)
+            expected_exit_code, link_workspace_root, templated_args, toolchain)
 
@@ -514,6 +279,10 @@ Now you can add `--config=debug` to any `bazel test` command line. The runtime will pause before executing the program, allowing you to connect a remote debugger. +You can also change the default args that are sent to nodejs. This can be done through a flag. The default is --preserve-symlinks while anything +can be passed. The flag is --@rules_nodejs//nodejs:default_args="" ex: bazel test --@rules_nodejs//nodejs:default_args="--preserve-symlinks --no-warnings" //:target. +This will pass --preserve-symlinks and --no-warnings flags to nodejs. Available node flags can be found here: https://nodejs.org/api/cli.html. + **ATTRIBUTES** @@ -633,7 +402,7 @@ nodejs_binary(

env

(*Dictionary: String -> String*): Specifies additional environment variables to set when the target is executed, subject to location -expansion. +and make variable expansion. Defaults to `{}` @@ -656,14 +425,14 @@ Defaults to `False` To pass a node startup option, prepend it with `--node_options=`, e.g. `--node_options=--preserve-symlinks`. -Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/master/be/make-variables.html. +Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html. 1. Subject to predefined source/output path variables substitutions. The predefined variables `execpath`, `execpaths`, `rootpath`, `rootpaths`, `location`, and `locations` take label parameters (e.g. `$(execpath //foo:bar)`) and substitute the file paths denoted by that label. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables for more info. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info. NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test args and genrule bazel substitions. This will be fixed in a future major release. @@ -706,7 +475,7 @@ const some_file = runfiles.resolveWorkspaceRelative(args[0]); NB: Bazel will error if it sees the single dollar sign $(rlocation path) in `templated_args` as it will try to expand `$(rlocation)` since we now expand predefined & custom "make" variables such as `$(COMPILATION_MODE)`, -`$(BINDIR)` & `$(TARGET_CPU)` using `ctx.expand_make_variables`. See https://docs.bazel.build/versions/master/be/make-variables.html. +`$(BINDIR)` & `$(TARGET_CPU)` using `ctx.expand_make_variables`. See https://docs.bazel.build/versions/main/be/make-variables.html. To prevent expansion of `$(rlocation)` write it as `$$(rlocation)`. Bazel understands `$$` to be the string literal `$` and the expansion results in `$(rlocation)` being passed as an arg instead @@ -722,15 +491,20 @@ need to update to `$$(rlocation)`. This may be changed in the future. 2. Subject to predefined variables & custom variable substitutions. Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables. Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables. Predefined genrule variables are not supported in this context. Defaults to `[]` +

toolchain

+ +(*Label*) + +Defaults to `None` ## npm_install @@ -738,10 +512,12 @@ Defaults to `[]` **USAGE**
-npm_install(name, args, data, environment, generate_local_modules_build_files, included_files,
-            links, manual_build_file_contents, npm_command, package_json, package_lock_json,
-            package_path, patch_args, patch_tool, post_install_patches, pre_install_patches, quiet,
-            repo_mapping, strict_visibility, symlink_node_modules, timeout)
+npm_install(name, all_node_modules_target_name, args, data, environment, exports_directories_only,
+            generate_build_files_concurrency_limit, generate_local_modules_build_files,
+            included_files, links, manual_build_file_contents, node_repository, npm_command,
+            package_json, package_json_remove, package_json_replace, package_lock_json, package_path,
+            patch_args, patch_tool, post_install_patches, pre_install_patches, quiet, repo_mapping,
+            strict_visibility, symlink_node_modules, timeout)
 
Runs npm install during workspace setup. @@ -758,6 +534,16 @@ check if yarn is being run by the `npm_install` repository rule. (*Name, mandatory*): A unique name for this repository. +

all_node_modules_target_name

+ +(*String*): The name used for the generated all node_modules js_library target. + + This can be used to name the all node_modules target something other than `//:node_modules`, + such as `//:node_modules_all`, so you can use the `//:node_modules` label to reference the + `node_modules` source directory in `manual_build_file_contents` for custom use cases. + +Defaults to `"node_modules"` +

args

(*List of strings*): Arguments passed to npm install. @@ -773,8 +559,7 @@ Defaults to `[]` If symlink_node_modules is True, this attribute is optional since the package manager will run in your workspace folder. It is recommended, however, that all files that the package manager depends on, such as `.rc` files or files used in `postinstall`, are added -symlink_node_modules is True so that the repository rule is rerun when any of these files -change. +so that the repository rule is rerun when any of these files change. If symlink_node_modules is False, the package manager is run in the bazel external repository so all files that the package manager depends on must be listed. @@ -787,6 +572,57 @@ Defaults to `[]` Defaults to `{}` +

exports_directories_only

+ +(*Boolean*): Export only top-level package directory artifacts from node_modules. + +Set to `False` to export all individual files from node_modules. + +When enabled, this decreases the time it takes for Bazel to setup runfiles and sandboxing when +there are a large number of npm dependencies as inputs to an action. + +To reference files within npm packages, you can use the `directory_file_path` rule and/or `DirectoryFilePathInfo` provider. +Note, some rules still need upgrading to support consuming `DirectoryFilePathInfo` where needed. + +NB: This feature requires runfiles be enabled due to an issue in Bazel which we are still investigating. + On Windows runfiles are off by default and must be enabled with the `--enable_runfiles` flag when + using this feature. + +NB: `ts_library` does not support directory npm deps due to internal dependency on having all input sources files explicitly specified. + +NB: `protractor_web_test` and `protractor_web_test_suite` do not support directory npm deps. + +For the `nodejs_binary` & `nodejs_test` `entry_point` attribute (which often needs to reference a file within +an npm package) you can set the entry_point to a dict with a single entry, where the key corresponds to the directory +label and the value corresponds to the path within that directory to the entry point, e.g. + +``` +nodejs_binary( + name = "prettier", + data = ["@npm//prettier"], + entry_point = { "@npm//:node_modules/prettier": "bin-prettier.js" }, +) +``` + +For labels that are passed to `$(rootpath)`, `$(execpath)`, or `$(location)` you can simply break these apart into +the directory label that gets passed to the expander & path part to follows it, e.g. + +``` +$(rootpath @npm///:node_modules/prettier)/bin-prettier.js +``` + +Defaults to `True` + +

generate_build_files_concurrency_limit

+ +(*Integer*): Limit the maximum concurrency of npm package processing when generating + BUILD files from the node_modules tree. Unlimited concurrency can lead to too many + open files errors (https://github.com/bazelbuild/rules_nodejs/issues/3507). + + Set to 0 or negative for unlimited concurrency. + +Defaults to `64` +

generate_local_modules_build_files

(*Boolean*): Enables the BUILD files auto generation for local modules installed with `file:` (npm) or `link:` (yarn) @@ -815,6 +651,9 @@ Defaults to `True` (*List of strings*): List of file extensions to be included in the npm package targets. +NB: This option has no effect when exports_directories_only is True as all files are +automatically included in the exported directory for each npm package. + For example, [".js", ".d.ts", ".proto", ".json", ""]. This option is useful to limit the number of files that are inputs @@ -838,9 +677,6 @@ Defaults to `[]` A mapping of npm package names to bazel targets to linked into node_modules. -If `package_path` is also set, the bazel target will be linked to the node_modules at `package_path` -along with other 3rd party npm packages from this rule. - For example, ``` @@ -848,7 +684,6 @@ yarn_install( name = "npm", package_json = "//web:package.json", yarn_lock = "//web:yarn.lock", - package_path = "web", links = { "@scope/target": "//some/scoped/target", "target": "//some/target", @@ -906,6 +741,13 @@ fine grained npm dependencies. Defaults to `""` +

node_repository

+ +(*String*): The basename for a nodejs toolchain to use for running npm. + Usually this is the value of the `name` attribute given to a nodejs_register_toolchains call in WORKSPACE + +Defaults to `"nodejs"` +

npm_command

(*String*): The npm command to run, to install dependencies. @@ -922,6 +764,52 @@ Defaults to `"ci"` (*Label, mandatory*) +

package_json_remove

+ +(*List of strings*): List of `package.json` keys to remove before running the package manager. + +Keys are '.' separated. For example, a key of `dependencies.my-dep` in the list corresponds to the `package.json` +entry, + +``` +{ + "dependencies": { + "my-dep": "..." + } +} +``` + +This can be used, for example, during a migration to remove first party file: deps that are required +for the non-bazel build but should not be installed via the package manager in the bazel build since +they will be reference as bazel targets instead. + +NB: removals specified are performed after preinstall_patches so if you are using both then the patch file should be relative +to the source `package.json`. Non-existant keys are silently ignored. + +Defaults to `[]` + +

package_json_replace

+ +(*Dictionary: String -> String*): Map of `package.json` keys to values to replace or create before running the package mangager. + +Keys are '.' separated. For example, a key of `scripts.postinstall` corresponds to the `package.json` +entry, + +``` +{ + "scripts": { + "postinstall": "..." + } +} +``` + +This can be used, for example, during a migration to override npm scripts such as preinstall & postinstall. + +NB: replaces specified are performed after preinstall_patches so if you are using both then the patch file should be relative +to the source `package.json`. + +Defaults to `{}` +

package_lock_json

(*Label, mandatory*) @@ -929,11 +817,10 @@ Defaults to `"ci"`

package_path

-(*String*): If set, link the 3rd party node_modules dependencies under the package path specified. +(*String*): The directory to link `node_modules` to in the execroot and in runfiles. -In most cases, this should be the directory of the package.json file so that the linker links the node_modules -in the same location they are found in the source tree. In a future release, this will default to the package.json -directory. This is planned for 4.0: https://github.com/bazelbuild/rules_nodejs/issues/2451 +If unset, link `node_modules` to the directory of the `package.json` file specified in the +`package_json` attribute. Set to "/" to link to the root directory. Defaults to `""` @@ -957,6 +844,16 @@ This can be used to make changes to installed packages after the package manager File paths in patches should be relative to workspace root. +Use with caution when `symlink_node_modules` enabled as the patches will run in your workspace and +will modify files in your workspace. + +NB: If `symlink_node_modules` is enabled, the node_modules folder is re-used between executions of the + repository rule. Patches may be re-applied to files in this case and fail to apply. A marker file + `node_modules/.bazel-post-install-patches` is left in this mode when patches are applied. When the + marker file is detected, patch file failures are treated as WARNINGS. For this reason, it is recommended + to patch npm packages with an npm tool such as https://www.npmjs.com/package/patch-package when + `symlink_node_modules` is enabled which handles re-apply patching logic more robustly. + Defaults to `[]`

pre_install_patches

@@ -968,6 +865,8 @@ package manager. File paths in patches should be relative to workspace root. +Not supported with `symlink_node_modules` enabled. + Defaults to `[]`

quiet

@@ -993,21 +892,51 @@ Defaults to `True` -(*Boolean*): Turn symlinking of node_modules on - -This requires the use of Bazel 0.26.0 and the experimental -managed_directories feature. +(*Boolean*): Turn symlinking of node_modules on. + +**Use of this feature is not recommended, as Bazel is removing `managed_directories`. +See https://github.com/bazelbuild/bazel/issues/15463 + +When False, the package manager will run in the external repository +created by this rule. +This requires that any files required for it to run should be listed in the +`data` attribute. These files would include things like patch files that are +read by a postinstall lifecycle hook such as the `patch-package` package uses. +`package.json` and the lock file are already specified in dedicated attributes +of this rule and do not need to be included in the `data`. + +When True, we run the package manager (npm or yarn) with the working directory +set in your source tree, in the folder containing the package.json file. +The resulting `node_modules` folder in the source tree will be symlinked to the +external repository created by this rule. + +This gives the user experience of running `bazel build` in a clean clone, +and the `node_modules` folder is created as if you had run `npm install` yourself. +It avoids installing the dependencies twice in a typical developer workflow, where you'd +need to `npm install` for tooling like formatters or editors, and then Bazel installs +a second copy in its external repository. This can save some time. +It also means you can patch the source files in the `node_modules` folder and these changes +will be reflected in subsequent Bazel executions. + +WARNING: we suspect there are some hard-to-reproduce bugs when this feature is used, +because any corruption in the node_modules tree won't be corrected by Bazel. +When repairing this with `bazel clean --expunge` you'll also have to `rm -rf node_modules` +or else the next Bazel run will re-use the same corrupted `node_modules` folder by restoring +the symlink to it. + +When using symlink_node_modules, we recommend also enabling Bazel's `managed_directories` +for the node_modules folder. This is documented in the +[workspace global](https://docs.bazel.build/versions/main/skylark/lib/globals.html#workspace) +Be sure to include the `node_modules` path in the `.bazelignore` file. + +Using managed_directories will mean that + +1. changes to files under `node_modules` are tracked by Bazel as if they were located + in the external repository folder, and +2. if the `node_modules` folder is deleted from the source tree, Bazel will re-run the + repository rule that creates it again on the next run. -When true, the package manager will run in the package.json folder -and the resulting node_modules folder will be symlinked into the -external repository create by this rule. - -When false, the package manager will run in the external repository -created by this rule and any files other than the package.json file and -the lock file that are required for it to run should be listed in the -data attribute. - -Defaults to `True` +Defaults to `False`

timeout

@@ -1016,14 +945,13 @@ Defaults to `True` Defaults to `3600` - ## pkg_npm **USAGE**
-pkg_npm(name, deps, nested_packages, node_context_data, package_name, package_path, srcs,
-        substitutions, tgz, vendor_external)
+pkg_npm(name, deps, nested_packages, package_name, package_path, srcs, stamp, substitutions, tgz,
+        validate, vendor_external)
 
The pkg_npm rule creates a directory containing a publishable npm artifact. @@ -1080,7 +1008,7 @@ Actually publish the package with `npm publish` (also builds first): ```sh # Check login credentials -$ bazel run @nodejs//:npm_node_repositories who +$ bazel run @nodejs_host//:npm who # Publishes the package $ bazel run :my_package.publish ``` @@ -1130,29 +1058,21 @@ Defaults to `[]` Defaults to `[]` -

node_context_data

- -(*Label*): Provides info about the build context, such as stamping. - -By default it reads from the bazel command line, such as the `--stamp` argument. -Use this to override values for this target, such as enabling or disabling stamping. -You can use the `node_context_data` rule in `@build_bazel_rules_nodejs//internal/node:context.bzl` -to create a NodeContextInfo. The dependencies of this attribute must provide: NodeContextInfo - - -Defaults to `@build_bazel_rules_nodejs//internal:node_context_data` -

package_name

-(*String*): Optional package_name that this npm package may be imported as. +(*String*): The package name that the linker will link this npm package as. + +If package_path is set, the linker will link this package under /node_modules/. +If package_path is not set the this will be the root node_modules of the workspace. Defaults to `""`

package_path

-(*String*): The directory in the workspace to link to. -If set, link this pkg_npm to the node_modules under the package path specified. -If unset, the default is to link to the node_modules root of the workspace. +(*String*): The package path in the workspace that the linker will link this npm package to. + +If package_path is set, the linker will link this package under /node_modules/. +If package_path is not set the this will be the root node_modules of the workspace. Defaults to `""` @@ -1162,10 +1082,27 @@ Defaults to `""` Defaults to `[]` +

stamp

+ +(*Label*): Whether to encode build information into the output. Possible values: + - `@rules_nodejs//nodejs/stamp:always`: + Always stamp the build information into the output, even in [--nostamp][stamp] builds. + This setting should be avoided, since it potentially causes cache misses remote caching for + any downstream actions that depend on it. + - `@rules_nodejs//nodejs/stamp:never`: + Always replace build information by constant values. This gives good build result caching. + - `@rules_nodejs//nodejs/stamp:use_stamp_flag`: + Embedding of build information is controlled by the [--[no]stamp][stamp] flag. + Stamped binaries are not rebuilt unless their dependencies change. + [stamp]: https://docs.bazel.build/versions/main/user-manual.html#flag--stamp The dependencies of this attribute must provide: StampSettingInfo + + +Defaults to `@rules_nodejs//nodejs/stamp:use_stamp_flag` +

substitutions

(*Dictionary: String -> String*): Key-value pairs which are replaced in all the files while building the package. - + You can use values from the workspace status command using curly braces, for example `{"0.0.0-PLACEHOLDER": "{STABLE_GIT_VERSION}"}`. @@ -1181,6 +1118,12 @@ Defaults to `{}` Defaults to `""` +

validate

+ +(*Boolean*): Whether to check that the attributes match the package.json + +Defaults to `True` +

vendor_external

(*List of strings*): External workspaces whose contents should be vendored into this workspace. @@ -1189,13 +1132,12 @@ Defaults to `""` Defaults to `[]` - ## pkg_web **USAGE**
-pkg_web(name, additional_root_paths, node_context_data, srcs, substitutions)
+pkg_web(name, additional_root_paths, srcs, stamp, substitutions)
 
Assembles a web application from source files. @@ -1214,23 +1156,28 @@ Assembles a web application from source files. Defaults to `[]` -

node_context_data

+

srcs

-(*Label*): Provides info about the build context, such as stamping. - -By default it reads from the bazel command line, such as the `--stamp` argument. -Use this to override values for this target, such as enabling or disabling stamping. -You can use the `node_context_data` rule in `@build_bazel_rules_nodejs//internal/node:context.bzl` -to create a NodeContextInfo. The dependencies of this attribute must provide: NodeContextInfo +(*List of labels*): Files which should be copied into the package +Defaults to `[]` -Defaults to `@build_bazel_rules_nodejs//internal:node_context_data` +

stamp

-

srcs

+(*Label*): Whether to encode build information into the output. Possible values: + - `@rules_nodejs//nodejs/stamp:always`: + Always stamp the build information into the output, even in [--nostamp][stamp] builds. + This setting should be avoided, since it potentially causes cache misses remote caching for + any downstream actions that depend on it. + - `@rules_nodejs//nodejs/stamp:never`: + Always replace build information by constant values. This gives good build result caching. + - `@rules_nodejs//nodejs/stamp:use_stamp_flag`: + Embedding of build information is controlled by the [--[no]stamp][stamp] flag. + Stamped binaries are not rebuilt unless their dependencies change. + [stamp]: https://docs.bazel.build/versions/main/user-manual.html#flag--stamp The dependencies of this attribute must provide: StampSettingInfo -(*List of labels*): Files which should be copied into the package -Defaults to `[]` +Defaults to `@rules_nodejs//nodejs/stamp:use_stamp_flag`

substitutions

@@ -1243,16 +1190,17 @@ See the section on stamping in the README. Defaults to `{}` - ## yarn_install **USAGE**
-yarn_install(name, args, data, environment, frozen_lockfile, generate_local_modules_build_files,
-             included_files, links, manual_build_file_contents, package_json, package_path,
+yarn_install(name, all_node_modules_target_name, args, data, environment, exports_directories_only,
+             frozen_lockfile, generate_build_files_concurrency_limit,
+             generate_local_modules_build_files, included_files, links, manual_build_file_contents,
+             node_repository, package_json, package_json_remove, package_json_replace, package_path,
              patch_args, patch_tool, post_install_patches, pre_install_patches, quiet, repo_mapping,
-             strict_visibility, symlink_node_modules, timeout, use_global_yarn_cache, yarn_lock)
+             strict_visibility, symlink_node_modules, timeout, use_global_yarn_cache, yarn, yarn_lock)
 
Runs yarn install during workspace setup. @@ -1269,11 +1217,26 @@ check if yarn is being run by the `yarn_install` repository rule. (*Name, mandatory*): A unique name for this repository. +

all_node_modules_target_name

+ +(*String*): The name used for the generated all node_modules js_library target. + + This can be used to name the all node_modules target something other than `//:node_modules`, + such as `//:node_modules_all`, so you can use the `//:node_modules` label to reference the + `node_modules` source directory in `manual_build_file_contents` for custom use cases. + +Defaults to `"node_modules"` +

args

(*List of strings*): Arguments passed to yarn install. -See yarn CLI docs https://yarnpkg.com/en/docs/cli/install for complete list of supported arguments. +See yarn CLI docs for complete list of supported arguments. +Yarn 1: https://yarnpkg.com/en/docs/cli/install +Yarn 2+ (Berry): https://yarnpkg.com/cli/install + +Note that Yarn Berry PnP is *not* supported, follow +https://github.com/bazelbuild/rules_nodejs/issues/1599 Defaults to `[]` @@ -1284,8 +1247,7 @@ Defaults to `[]` If symlink_node_modules is True, this attribute is optional since the package manager will run in your workspace folder. It is recommended, however, that all files that the package manager depends on, such as `.rc` files or files used in `postinstall`, are added -symlink_node_modules is True so that the repository rule is rerun when any of these files -change. +so that the repository rule is rerun when any of these files change. If symlink_node_modules is False, the package manager is run in the bazel external repository so all files that the package manager depends on must be listed. @@ -1298,9 +1260,52 @@ Defaults to `[]` Defaults to `{}` +

exports_directories_only

+ +(*Boolean*): Export only top-level package directory artifacts from node_modules. + +Set to `False` to export all individual files from node_modules. + +When enabled, this decreases the time it takes for Bazel to setup runfiles and sandboxing when +there are a large number of npm dependencies as inputs to an action. + +To reference files within npm packages, you can use the `directory_file_path` rule and/or `DirectoryFilePathInfo` provider. +Note, some rules still need upgrading to support consuming `DirectoryFilePathInfo` where needed. + +NB: This feature requires runfiles be enabled due to an issue in Bazel which we are still investigating. + On Windows runfiles are off by default and must be enabled with the `--enable_runfiles` flag when + using this feature. + +NB: `ts_library` does not support directory npm deps due to internal dependency on having all input sources files explicitly specified. + +NB: `protractor_web_test` and `protractor_web_test_suite` do not support directory npm deps. + +For the `nodejs_binary` & `nodejs_test` `entry_point` attribute (which often needs to reference a file within +an npm package) you can set the entry_point to a dict with a single entry, where the key corresponds to the directory +label and the value corresponds to the path within that directory to the entry point, e.g. + +``` +nodejs_binary( + name = "prettier", + data = ["@npm//prettier"], + entry_point = { "@npm//:node_modules/prettier": "bin-prettier.js" }, +) +``` + +For labels that are passed to `$(rootpath)`, `$(execpath)`, or `$(location)` you can simply break these apart into +the directory label that gets passed to the expander & path part to follows it, e.g. + +``` +$(rootpath @npm///:node_modules/prettier)/bin-prettier.js +``` + +Defaults to `True` +

frozen_lockfile

-(*Boolean*): Use the `--frozen-lockfile` flag for yarn. +(*Boolean*): Use the `--frozen-lockfile` flag for yarn 1 + +Users of Yarn 2+ (Berry) should just pass `--immutable` to the `args` attribute. Don't generate a `yarn.lock` lockfile and fail if an update is needed. @@ -1308,11 +1313,21 @@ This flag enables an exact install of the version that is specified in the `yarn file. This helps to have reproducible builds across builds. To update a dependency or install a new one run the `yarn install` command with the -vendored yarn binary. `bazel run @nodejs//:yarn install`. You can pass the options like -`bazel run @nodejs//:yarn install -- -D `. +vendored yarn binary. `bazel run @yarn//:yarn install`. You can pass the options like +`bazel run @yarn//:yarn install -- -D `. Defaults to `True` +

generate_build_files_concurrency_limit

+ +(*Integer*): Limit the maximum concurrency of npm package processing when generating + BUILD files from the node_modules tree. Unlimited concurrency can lead to too many + open files errors (https://github.com/bazelbuild/rules_nodejs/issues/3507). + + Set to 0 or negative for unlimited concurrency. + +Defaults to `64` +

generate_local_modules_build_files

(*Boolean*): Enables the BUILD files auto generation for local modules installed with `file:` (npm) or `link:` (yarn) @@ -1341,6 +1356,9 @@ Defaults to `True` (*List of strings*): List of file extensions to be included in the npm package targets. +NB: This option has no effect when exports_directories_only is True as all files are +automatically included in the exported directory for each npm package. + For example, [".js", ".d.ts", ".proto", ".json", ""]. This option is useful to limit the number of files that are inputs @@ -1364,9 +1382,6 @@ Defaults to `[]` A mapping of npm package names to bazel targets to linked into node_modules. -If `package_path` is also set, the bazel target will be linked to the node_modules at `package_path` -along with other 3rd party npm packages from this rule. - For example, ``` @@ -1374,7 +1389,6 @@ yarn_install( name = "npm", package_json = "//web:package.json", yarn_lock = "//web:yarn.lock", - package_path = "web", links = { "@scope/target": "//some/scoped/target", "target": "//some/target", @@ -1432,18 +1446,70 @@ fine grained npm dependencies. Defaults to `""` +

node_repository

+ +(*String*): The basename for a nodejs toolchain to use for running npm. + Usually this is the value of the `name` attribute given to a nodejs_register_toolchains call in WORKSPACE + +Defaults to `"nodejs"` +

package_json

(*Label, mandatory*) +

package_json_remove

+ +(*List of strings*): List of `package.json` keys to remove before running the package manager. + +Keys are '.' separated. For example, a key of `dependencies.my-dep` in the list corresponds to the `package.json` +entry, + +``` +{ + "dependencies": { + "my-dep": "..." + } +} +``` + +This can be used, for example, during a migration to remove first party file: deps that are required +for the non-bazel build but should not be installed via the package manager in the bazel build since +they will be reference as bazel targets instead. + +NB: removals specified are performed after preinstall_patches so if you are using both then the patch file should be relative +to the source `package.json`. Non-existant keys are silently ignored. + +Defaults to `[]` + +

package_json_replace

+ +(*Dictionary: String -> String*): Map of `package.json` keys to values to replace or create before running the package mangager. + +Keys are '.' separated. For example, a key of `scripts.postinstall` corresponds to the `package.json` +entry, + +``` +{ + "scripts": { + "postinstall": "..." + } +} +``` + +This can be used, for example, during a migration to override npm scripts such as preinstall & postinstall. + +NB: replaces specified are performed after preinstall_patches so if you are using both then the patch file should be relative +to the source `package.json`. + +Defaults to `{}` +

package_path

-(*String*): If set, link the 3rd party node_modules dependencies under the package path specified. +(*String*): The directory to link `node_modules` to in the execroot and in runfiles. -In most cases, this should be the directory of the package.json file so that the linker links the node_modules -in the same location they are found in the source tree. In a future release, this will default to the package.json -directory. This is planned for 4.0: https://github.com/bazelbuild/rules_nodejs/issues/2451 +If unset, link `node_modules` to the directory of the `package.json` file specified in the +`package_json` attribute. Set to "/" to link to the root directory. Defaults to `""` @@ -1467,6 +1533,16 @@ This can be used to make changes to installed packages after the package manager File paths in patches should be relative to workspace root. +Use with caution when `symlink_node_modules` enabled as the patches will run in your workspace and +will modify files in your workspace. + +NB: If `symlink_node_modules` is enabled, the node_modules folder is re-used between executions of the + repository rule. Patches may be re-applied to files in this case and fail to apply. A marker file + `node_modules/.bazel-post-install-patches` is left in this mode when patches are applied. When the + marker file is detected, patch file failures are treated as WARNINGS. For this reason, it is recommended + to patch npm packages with an npm tool such as https://www.npmjs.com/package/patch-package when + `symlink_node_modules` is enabled which handles re-apply patching logic more robustly. + Defaults to `[]`

pre_install_patches

@@ -1478,6 +1554,8 @@ package manager. File paths in patches should be relative to workspace root. +Not supported with `symlink_node_modules` enabled. + Defaults to `[]`

quiet

@@ -1503,21 +1581,51 @@ Defaults to `True` -(*Boolean*): Turn symlinking of node_modules on +(*Boolean*): Turn symlinking of node_modules on. + +**Use of this feature is not recommended, as Bazel is removing `managed_directories`. +See https://github.com/bazelbuild/bazel/issues/15463 + +When False, the package manager will run in the external repository +created by this rule. +This requires that any files required for it to run should be listed in the +`data` attribute. These files would include things like patch files that are +read by a postinstall lifecycle hook such as the `patch-package` package uses. +`package.json` and the lock file are already specified in dedicated attributes +of this rule and do not need to be included in the `data`. + +When True, we run the package manager (npm or yarn) with the working directory +set in your source tree, in the folder containing the package.json file. +The resulting `node_modules` folder in the source tree will be symlinked to the +external repository created by this rule. + +This gives the user experience of running `bazel build` in a clean clone, +and the `node_modules` folder is created as if you had run `npm install` yourself. +It avoids installing the dependencies twice in a typical developer workflow, where you'd +need to `npm install` for tooling like formatters or editors, and then Bazel installs +a second copy in its external repository. This can save some time. +It also means you can patch the source files in the `node_modules` folder and these changes +will be reflected in subsequent Bazel executions. + +WARNING: we suspect there are some hard-to-reproduce bugs when this feature is used, +because any corruption in the node_modules tree won't be corrected by Bazel. +When repairing this with `bazel clean --expunge` you'll also have to `rm -rf node_modules` +or else the next Bazel run will re-use the same corrupted `node_modules` folder by restoring +the symlink to it. + +When using symlink_node_modules, we recommend also enabling Bazel's `managed_directories` +for the node_modules folder. This is documented in the +[workspace global](https://docs.bazel.build/versions/main/skylark/lib/globals.html#workspace) +Be sure to include the `node_modules` path in the `.bazelignore` file. + +Using managed_directories will mean that + +1. changes to files under `node_modules` are tracked by Bazel as if they were located + in the external repository folder, and +2. if the `node_modules` folder is deleted from the source tree, Bazel will re-run the + repository rule that creates it again on the next run. -This requires the use of Bazel 0.26.0 and the experimental -managed_directories feature. - -When true, the package manager will run in the package.json folder -and the resulting node_modules folder will be symlinked into the -external repository create by this rule. - -When false, the package manager will run in the external repository -created by this rule and any files other than the package.json file and -the lock file that are required for it to run should be listed in the -data attribute. - -Defaults to `True` +Defaults to `False`

timeout

@@ -1536,53 +1644,25 @@ have bugs. Disabling this attribute causes every run of yarn to have a unique cache_directory. -If True, this rule will pass `--mutex network` to yarn to ensure that +If True and using Yarn 1, this rule will pass `--mutex network` to yarn to ensure that the global cache can be shared by parallelized yarn_install rules. +The True value has no effect on Yarn 2+ (Berry). + If False, this rule will pass `--cache-folder /path/to/external/repository/__yarn_cache` to yarn so that the local cache is contained within the external repository. Defaults to `True` -

yarn_lock

- -(*Label, mandatory*) - - - +

yarn

-## check_bazel_version - -**USAGE** - -
-check_bazel_version(minimum_bazel_version, message)
-
+(*Label*): The yarn.js entry point to execute - Verify the users Bazel version is at least the given one. +Defaults to `@yarn//:bin/yarn` -This can be used in rule implementations that depend on changes in Bazel, -to warn users about a mismatch between the rule and their installed Bazel -version. - -This should *not* be used in users WORKSPACE files. To locally pin your -Bazel version, just create the .bazelversion file in your workspace. - - -**PARAMETERS** - - -

minimum_bazel_version

- -a string indicating the minimum version - - - -

message

- -optional string to print to your users, could be used to help them update +

yarn_lock

-Defaults to `""` +(*Label, mandatory*) @@ -1628,13 +1708,12 @@ further keyword arguments, e.g. `visibility` - ## generated_file_test **USAGE**
-generated_file_test(name, generated, src, substring_search, src_dbg, kwargs)
+generated_file_test(name, generated, src, substring_search, src_dbg, visibility, kwargs)
 
Tests that a file generated by Bazel has identical content to a file in the workspace. @@ -1642,6 +1721,10 @@ Tests that a file generated by Bazel has identical content to a file in the work This is useful for testing, where a "snapshot" or "golden" file is checked in, so that you can code review changes to the generated output. +Note, for binary files you can just use the `diff_test` rule from bazel-skylib. +See https://github.com/bazelbuild/bazel-skylib/blob/main/docs/diff_test_doc.md +and https://blog.aspect.dev/bazel-can-write-to-the-source-folder + **PARAMETERS** @@ -1678,6 +1761,12 @@ In this case you can specify what the dbg version of the output should look like Defaults to `None` +

visibility

+ +visibility for both test target & update target + +Defaults to `None` +

kwargs

extra arguments passed to the underlying nodejs_test @@ -1685,7 +1774,6 @@ extra arguments passed to the underlying nodejs_test - ## js_library **USAGE** @@ -1713,7 +1801,6 @@ It also means you can have relative imports between the files rather than being forced to use Bazel's "Runfiles" semantics where any program might need a helper library to resolve files between the logical union of the source tree and the output tree. - ### Example A typical example usage of `js_library` is to expose some sources with a package name: @@ -1739,7 +1826,6 @@ js_library( > `js_library` has some undocumented advanced features you can find in the source code or in our examples. > These should not be considered a public API and aren't subject to our usual support and semver guarantees. - ### Outputs Like all Bazel rules it produces a default output by providing [DefaultInfo]. @@ -1764,9 +1850,9 @@ It also provides: - [JSModuleInfo](#jsmoduleinfo) so rules like bundlers can collect the transitive set of .js files - [JSNamedModuleInfo](#jsnamedmoduleinfo) for rules that expect named AMD or `goog.module` format JS -[OutputGroupInfo]: https://docs.bazel.build/versions/master/skylark/lib/OutputGroupInfo.html -[DefaultInfo]: https://docs.bazel.build/versions/master/skylark/lib/DefaultInfo.html -[output_group]: https://docs.bazel.build/versions/master/be/general.html#filegroup.output_group +[OutputGroupInfo]: https://docs.bazel.build/versions/main/skylark/lib/OutputGroupInfo.html +[DefaultInfo]: https://docs.bazel.build/versions/main/skylark/lib/DefaultInfo.html +[output_group]: https://docs.bazel.build/versions/main/be/general.html#filegroup.output_group **PARAMETERS** @@ -1786,45 +1872,8 @@ Defaults to `[]`

package_name

-The name it will be imported by. Should match the "name" field in the package.json file. - -If package_name == "$node_modules$" this indictates that this js_library target is one or more external npm -packages in node_modules. This is a special case that used be covered by the internal only -`external_npm_package` attribute. NB: '$' is an illegal character -for npm packages names so this reserved name will not conflict with any valid package_name values - -This is used by the yarn_install & npm_install repository rules for npm dependencies installed by -yarn & npm. When true, js_library will provide ExternalNpmPackageInfo. - -It can also be used for user-managed npm dependencies if node_modules is layed out outside of bazel. -For example, - -js_library( - name = "node_modules", - srcs = glob( - include = [ - "node_modules/**/*.js", - "node_modules/**/*.d.ts", - "node_modules/**/*.json", - "node_modules/.bin/*", - ], - exclude = [ - # Files under test & docs may contain file names that - # are not legal Bazel labels (e.g., - # node_modules/ecstatic/test/public/À¸­æ–‡/Γ¦ΒͺΒ”Γ¦Β‘Βˆ.html) - "node_modules/**/test/**", - "node_modules/**/docs/**", - # Files with spaces in the name are not legal Bazel labels - "node_modules/**/* */**", - "node_modules/**/* *", - ], - ), - # Special value to provide ExternalNpmPackageInfo which is used by downstream - # rules that use these npm dependencies - package_name = "$node_modules$", -) - -See `examples/user_managed_deps` for a working example of user-managed npm dependencies. +The name it will be imported by. +Should match the "name" field in the package.json file if one is included. Defaults to `None` @@ -1849,14 +1898,13 @@ Other attributes - ## npm_package_bin **USAGE**
 npm_package_bin(tool, package, package_bin, data, env, outs, args, stderr, stdout, exit_code_out,
-                output_dir, link_workspace_root, chdir, kwargs)
+                output_dir, link_workspace_root, chdir, silent_on_success, kwargs)
 
Run an arbitrary npm package binary (e.g. a program under node_modules/.bin/*) under Bazel. @@ -1870,7 +1918,7 @@ By default, Bazel runs actions with a working directory set to your workspace ro Use the `chdir` attribute to change the working directory before the program runs. This is a great candidate to wrap with a macro, as documented: -https://docs.bazel.build/versions/master/skylark/macros.html#full-example +https://docs.bazel.build/versions/main/skylark/macros.html#full-example **PARAMETERS** @@ -1897,20 +1945,21 @@ Defaults to `None`

data

-similar to [genrule.srcs](https://docs.bazel.build/versions/master/be/general.html#genrule.srcs) +similar to [genrule.srcs](https://docs.bazel.build/versions/main/be/general.html#genrule.srcs) may also include targets that produce or reference npm packages which are needed by the tool Defaults to `[]`

env

-specifies additional environment variables to set when the target is executed +specifies additional environment variables to set when the target is executed. The values of environment variables +are subject to 'Make variable' substitution (see [args](#npm_package_bin-args)). Defaults to `{}`

outs

-similar to [genrule.outs](https://docs.bazel.build/versions/master/be/general.html#genrule.outs) +similar to [genrule.outs](https://docs.bazel.build/versions/main/be/general.html#genrule.outs) Defaults to `[]` @@ -1918,11 +1967,11 @@ Defaults to `[]` Command-line arguments to the tool. -Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/master/be/make-variables.html. +Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html. 1. Predefined source/output path substitions is applied first: -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables. Use $(execpath) $(execpaths) to expand labels to the execroot (where Bazel runs build actions). @@ -1938,7 +1987,7 @@ for either $(execpath) or $(rootpath) depending on the context. 2. "Make" variables are expanded second: Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables. Like genrule, you may also use some syntax sugar for locations. @@ -1950,10 +1999,10 @@ Like genrule, you may also use some syntax sugar for locations. - `$(RULEDIR)`: the root output directory of the rule, corresponding with its package (can be used with output_dir=True or False) -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_genrule_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_genrule_variables. Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables. Defaults to `[]` @@ -2024,6 +2073,13 @@ npm_package_bin( Defaults to `None` +

silent_on_success

+ +produce no output on stdout nor stderr when program exits with status code 0. +This makes node binaries match the expected bazel paradigm. + +Defaults to `False` +

kwargs

additional undocumented keyword args @@ -2031,7 +2087,6 @@ additional undocumented keyword args - ## params_file **USAGE** @@ -2064,14 +2119,14 @@ Path of the output file, relative to this package. Arguments to concatenate into a params file. -Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/master/be/make-variables.html. +Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html. 1. Subject to predefined source/output path variables substitutions. The predefined variables `execpath`, `execpaths`, `rootpath`, `rootpaths`, `location`, and `locations` take label parameters (e.g. `$(execpath //foo:bar)`) and substitute the file paths denoted by that label. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_label_variables for more info. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info. NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test args and genrule bazel substitions. This will be fixed in a future major release. @@ -2081,10 +2136,10 @@ for more info. 2. Subject to predefined variables & custom variable substitutions. Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. -See https://docs.bazel.build/versions/master/be/make-variables.html#predefined_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables. Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. -See https://docs.bazel.build/versions/master/be/make-variables.html#custom_variables. +See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables. Predefined genrule variables are not supported in this context. @@ -2112,454 +2167,3 @@ Defaults to `"auto"` - - -## DeclarationInfo - -**USAGE** - -
-DeclarationInfo(declarations, transitive_declarations, type_blacklisted_declarations)
-
- -The DeclarationInfo provider allows JS rules to communicate typing information. -TypeScript's .d.ts files are used as the interop format for describing types. -package.json files are included as well, as TypeScript needs to read the "typings" property. - -Do not create DeclarationInfo instances directly, instead use the declaration_info factory function. - -Note: historically this was a subset of the string-typed "typescript" provider. - - -**FIELDS** - -

declarations

- - A depset of typings files produced by this rule -

transitive_declarations

- - A depset of typings files produced by this rule and all its transitive dependencies. -This prevents needing an aspect in rules that consume the typings, which improves performance. -

type_blacklisted_declarations

- - A depset of .d.ts files that we should not use to infer JSCompiler types (via tsickle) - - - -## ExternalNpmPackageInfo - -**USAGE** - -
-ExternalNpmPackageInfo(direct_sources, path, sources, workspace)
-
- -Provides information about one or more external npm packages - -**FIELDS** - -

direct_sources

- - Depset of direct source files in these external npm package(s) -

path

- - The local workspace path that these external npm deps should be linked at. If empty, they will be linked at the root. -

sources

- - Depset of direct & transitive source files in these external npm package(s) and transitive dependencies -

workspace

- - The workspace name that these external npm package(s) are provided from - - - -## JSEcmaScriptModuleInfo - -**USAGE** - -
-JSEcmaScriptModuleInfo(direct_sources, sources)
-
- -JavaScript files (and sourcemaps) that are intended to be consumed by downstream tooling. - -They should use modern syntax and ESModules. -These files should typically be named "foo.mjs" - -Historical note: this was the typescript.es6_sources output - -**FIELDS** - -

direct_sources

- - Depset of direct JavaScript files and sourcemaps -

sources

- - Depset of direct and transitive JavaScript files and sourcemaps - - - -## JSModuleInfo - -**USAGE** - -
-JSModuleInfo(direct_sources, sources)
-
- -JavaScript files and sourcemaps. - -**FIELDS** - -

direct_sources

- - Depset of direct JavaScript files and sourcemaps -

sources

- - Depset of direct and transitive JavaScript files and sourcemaps - - - -## JSNamedModuleInfo - -**USAGE** - -
-JSNamedModuleInfo(direct_sources, sources)
-
- -JavaScript files whose module name is self-contained. - -For example named AMD/UMD or goog.module format. -These files can be efficiently served with the concatjs bundler. -These outputs should be named "foo.umd.js" -(note that renaming it from "foo.js" doesn't affect the module id) - -Historical note: this was the typescript.es5_sources output. - - -**FIELDS** - -

direct_sources

- - Depset of direct JavaScript files and sourcemaps -

sources

- - Depset of direct and transitive JavaScript files and sourcemaps - - - -## LinkablePackageInfo - -**USAGE** - -
-LinkablePackageInfo(files, package_name, package_path, path, _tslibrary)
-
- -The LinkablePackageInfo provider provides information to the linker for linking pkg_npm built packages - -**FIELDS** - -

files

- - Depset of files in this package (must all be contained within path) -

package_name

- - The package name. - -This field is optional. If not set, the target can be made linkable to a package_name with the npm_link rule. -

package_path

- - The directory in the workspace to link to. - -If set, link the 1st party dependencies to the node_modules under the package path specified. -If unset, the default is to link to the node_modules root of the workspace. -

path

- - The path to link to. - -Path must be relative to execroot/wksp. It can either an output dir path such as, - -`bazel-out/-/bin/path/to/package` or -`bazel-out/-/bin/external/external_wksp>/path/to/package` - -or a source file path such as, - -`path/to/package` or -`external//path/to/package` -

_tslibrary

- - For internal use only - - - -## NodeContextInfo - -**USAGE** - -
-NodeContextInfo(stamp)
-
- -Provides data about the build context, like config_setting's - -**FIELDS** - -

stamp

- - If stamping is enabled - - - -## NodeRuntimeDepsInfo - -**USAGE** - -
-NodeRuntimeDepsInfo(deps, pkgs)
-
- -Stores runtime dependencies of a nodejs_binary or nodejs_test - -These are files that need to be found by the node module resolver at runtime. - -Historically these files were passed using the Runfiles mechanism. -However runfiles has a big performance penalty of creating a symlink forest -with FS API calls for every file in node_modules. -It also causes there to be separate node_modules trees under each binary. This -prevents user-contributed modules passed as deps[] to a particular action from -being found by node module resolver, which expects everything in one tree. - -In node, this resolution is done dynamically by assuming a node_modules -tree will exist on disk, so we assume node actions/binary/test executions will -do the same. - - -**FIELDS** - -

deps

- - depset of runtime dependency labels -

pkgs

- - list of labels of packages that provide ExternalNpmPackageInfo - - - -## NpmPackageInfo - -**USAGE** - -
-NpmPackageInfo(direct_sources, path, sources, workspace)
-
- -Provides information about one or more external npm packages - -**FIELDS** - -

direct_sources

- - Depset of direct source files in these external npm package(s) -

path

- - The local workspace path that these external npm deps should be linked at. If empty, they will be linked at the root. -

sources

- - Depset of direct & transitive source files in these external npm package(s) and transitive dependencies -

workspace

- - The workspace name that these external npm package(s) are provided from - - - -## declaration_info - -**USAGE** - -
-declaration_info(declarations, deps)
-
- -Constructs a DeclarationInfo including all transitive files needed to type-check from DeclarationInfo providers in a list of deps. - -**PARAMETERS** - - -

declarations

- -list of typings files - - - -

deps

- -list of labels of dependencies where we should collect their DeclarationInfo to pass transitively - -Defaults to `[]` - - - -## js_ecma_script_module_info - -**USAGE** - -
-js_ecma_script_module_info(sources, deps)
-
- -Constructs a JSEcmaScriptModuleInfo including all transitive sources from JSEcmaScriptModuleInfo providers in a list of deps. - -Returns a single JSEcmaScriptModuleInfo. - -**PARAMETERS** - - -

sources

- - - - -

deps

- - -Defaults to `[]` - - - -## js_module_info - -**USAGE** - -
-js_module_info(sources, deps)
-
- -Constructs a JSModuleInfo including all transitive sources from JSModuleInfo providers in a list of deps. - -Returns a single JSModuleInfo. - -**PARAMETERS** - - -

sources

- - - - -

deps

- - -Defaults to `[]` - - - -## js_named_module_info - -**USAGE** - -
-js_named_module_info(sources, deps)
-
- -Constructs a JSNamedModuleInfo including all transitive sources from JSNamedModuleInfo providers in a list of deps. - -Returns a single JSNamedModuleInfo. - -**PARAMETERS** - - -

sources

- - - - -

deps

- - -Defaults to `[]` - - - -## run_node - -**USAGE** - -
-run_node(ctx, inputs, arguments, executable, chdir, kwargs)
-
- -Helper to replace ctx.actions.run - -This calls node programs with a node_modules directory in place - - -**PARAMETERS** - - -

ctx

- -rule context from the calling rule implementation function - - - -

inputs

- -list or depset of inputs to the action - - - -

arguments

- -list or ctx.actions.Args object containing arguments to pass to the executable - - - -

executable

- -stringy representation of the executable this action will run, eg eg. "my_executable" rather than ctx.executable.my_executable - - - -

chdir

- -directory we should change to be the working dir - -Defaults to `None` - -

kwargs

- -all other args accepted by ctx.actions.run - - - - - -## node_modules_aspect - -**USAGE** - -
-node_modules_aspect(name)
-
- - - -**ASPECT ATTRIBUTES** - -

deps

- -**ATTRIBUTES** - -

name

- -(*Name, {util.mandatoryString(name: "name" -doc_string: "A unique name for this target." -type: NAME -mandatory: true -)}*) - A unique name for this target. - - - diff --git a/docs/Concatjs.html b/docs/Concatjs.html deleted file mode 100755 index 65d42183b9..0000000000 --- a/docs/Concatjs.html +++ /dev/null @@ -1,700 +0,0 @@ - - - - - - - - - - rules_nodejs - Concatjs - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

@bazel/concatjs

- -

Concatjs is a JavaScript bundler, in a trivial sense: the UNIX cat command is a basic implementation:

- -
$ cat one.js two.js > bundle.js
-
- -

Clearly self-evident is that this bundler is super-fast and simple. -A performant implementation adds some in-memory caching, and for developer ergonomics you add a simple IIFE wrapper -around each file so that the Chrome DevTools shows the files in the tree as if they had been independently loaded.

- -

However at its core, concatjs requires a big tradeoff of a migration cost to buy-in, to get this incredible performance. -The path of the JavaScript files is lost in the bundling process, so they must contain their module ID internally.

- -

Named AMD/UMD modules and goog.module are the two JS module formats that are compatible with concatjs. -Most packages do not ship with this format, so in order to use concatjs tooling, you have to shim your code and dependencies. See the Compatibility section below.

- -

This is at the core of how Google does JavaScript development. -So Bazel rules that originated in Google’s codebase have affordances for concatjs. -For example ts_library produces named AMD modules in its β€œdevmode” output, and -karma_web_test expects to bundle inputs using concatjs.

- -

Compatibility

- -

First-party code

- -

First-party code has to be authored as named AMD/UMD modules. -This is also historically referred to as β€œRequireJS” modules since that’s the -JS loader that is typically used with them.

- -

If you write TypeScript, you can do this following their documentation.

- -

There is an example in this repository: we have an index.ts file that wants -to be used with require.js require("@bazel/concatjs"). -So it -declares -that module name -using the TS triple-slash syntax:

- -
///<amd-module name="@bazel/concatjs"/>
-
- -

it is also compiled with -the "compilerOptions": { "module": "umd" } TypeScript setting.

- -

Third-party code

- -

To make it easier to produce a UMD version of a third-party npm package, we automatically generate a target that uses Browserify to build one, using the main entry from the package’s package.json. -In most cases this will make the package loadable under concatjs. -This target has a __umd suffix. For example, if your library is at @npm//foo then the UMD target is @npm//foo:foo__umd.

- -

An example where this fixes a users issue: https://github.com/bazelbuild/rules_nodejs/issues/2317#issuecomment-735921318

- -

In some cases, the generated UMD bundle is not sufficient, and in others it fails to build because it requires some special Browserify configuration. -You can always write your own shim that grabs a symbol from a package you use, and exposes it in an AMD/require.js-compatible way. -For example, even though RxJS ships with a UMD bundle, it contains multiple entry points and uses anonymous modules, not named modules. So our Angular/concatjs example has a rxjs_shims.js file that exposes some RxJS operators, then at https://github.com/bazelbuild/rules_nodejs/blob/2.3.1/examples/angular/src/BUILD.bazel#L65-L71 this is combined in a filegroup with the rxjs.umd.js file. Now we use this filegroup target when depending on RxJS in a concatjs_* rule.

- -

Ultimately by using concatjs, you’re signing up for at least a superficial understanding of these shims and may need to update them when you change your dependencies.

- -

Serving JS in development mode under Bazel

- -

There are two choices for development mode:

- -
    -
  1. Use the concatjs_devserver rule to bring up our simple, fast development server. -This is intentionally very simple, to help you get started quickly. However, -since there are many development servers available, we do not want to mirror -their features in yet another server we maintain.
  2. -
  3. Teach your real frontend server to serve files from Bazel’s output directory. -This is not yet documented. Choose this option if you have an existing server -used in development mode, or if your requirements exceed what the -concatjs_devserver supports. Be careful that your development round-trip stays -fast (should be under two seconds).
  4. -
- -

To use concatjs_devserver, you simply load the rule, and call it with deps that -point to your ts_library target(s):

- -
load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver")
-load("@npm//@bazel/typescript:index.bzl", "ts_library")
-
-ts_library(
-    name = "app",
-    srcs = ["app.ts"],
-)
-
-concatjs_devserver(
-    name = "devserver",
-    # We'll collect all the devmode JS sources from these TypeScript libraries
-    deps = [":app"],
-    # This is the path we'll request from the browser, see index.html
-    serving_path = "/bundle.js",
-    # The devserver can serve our static files too
-    static_files = ["index.html"],
-)
-
- -

The index.html should be the same one you use for production, and it should -load the JavaScript bundle from the path indicated in serving_path.

- -

If you don’t have an index.html file, a simple one will be generated by the -concatjs_devserver.

- -

See examples/app in this repository for a working example. To run the -devserver, we recommend you use ibazel:

- -
$ ibazel run examples/app:devserver
-
- -

ibazel will keep the devserver program running, and provides a LiveReload -server so the browser refreshes the application automatically when each build -finishes.

- -

Testing with Karma

- -

The karma_web_test rule runs karma tests with Bazel.

- -

It depends on rules_webtesting, so you need to add this to your WORKSPACE -if you use the web testing rules in @bazel/concatjs:

- -
# Fetch transitive Bazel dependencies of karma_web_test
-http_archive(
-    name = "io_bazel_rules_webtesting",
-    sha256 = "9bb461d5ef08e850025480bab185fd269242d4e533bca75bfb748001ceb343c3",
-    urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.3/rules_webtesting.tar.gz"],
-)
-
-# Set up web testing, choose browsers we can test on
-load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
-
-web_test_repositories()
-
-load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories")
-
-browser_repositories(
-    chromium = True,
-    firefox = True,
-)
-
- -

Installing with user-managed dependencies

- -

If you didn’t use the yarn_install or npm_install rule to create an npm workspace, you’ll have to declare a rule in your root BUILD.bazel file to execute karma:

- -
# Create a karma rule to use in karma_web_test_suite karma
-# attribute when using user-managed dependencies
-nodejs_binary(
-    name = "karma/karma",
-    entry_point = "//:node_modules/karma/bin/karma",
-    # Point bazel to your node_modules to find the entry point
-    data = ["//:node_modules"],
-)
-
- -

concatjs_devserver

- -

USAGE

- -
-concatjs_devserver(name, additional_root_paths, bootstrap, deps, devserver, devserver_host,
-                   entry_module, port, scripts, serving_path, static_files)
-
- -

concatjs_devserver is a simple development server intended for a quick β€œgetting started” experience.

- -

Additional documentation here

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

additional_root_paths

- -

(List of strings): Additional root paths to serve static_files from. - Paths should include the workspace name such as ["__main__/resources"]

- -

Defaults to []

- -

bootstrap

- -

(List of labels): Scripts to include in the JS bundle before the module loader (require.js)

- -

Defaults to []

- -

deps

- -

(List of labels): Targets that produce JavaScript, such as ts_library

- -

Defaults to []

- -

devserver

- -

(Label): Go based devserver executable.

- -
        With cross-platform RBE for OSX & Windows ctx.executable.devserver will be linux as --cpu and
-        --host_cpu must be overridden to k8. However, we still want to be able to run the devserver on the host
-        machine so we need to include the host devserver binary, which is ctx.executable.devserver_host, in the
-        runfiles. For non-RBE and for RBE with a linux host, ctx.executable.devserver & ctx.executable.devserver_host
-        will be the same binary.
-
-        Defaults to precompiled go binary setup by @bazel/typescript npm package
-
- -

Defaults to @npm//@bazel/concatjs/devserver:devserver

- -

devserver_host

- -

(Label): Go based devserver executable for the host platform. - Defaults to precompiled go binary setup by @bazel/typescript npm package

- -

Defaults to @npm//@bazel/concatjs/devserver:devserver_darwin_amd64

- -

entry_module

- -

(String): The entry_module should be the AMD module name of the entry module such as "__main__/src/index". - concatjs_devserver concats the following snippet after the bundle to load the application: - require(["entry_module"]);

- -

Defaults to ""

- -

port

- -

(Integer): The port that the devserver will listen on.

- -

Defaults to 5432

- -

scripts

- -

(List of labels): User scripts to include in the JS bundle before the application sources

- -

Defaults to []

- -

serving_path

- -

(String): The path you can request from the client HTML which serves the JavaScript bundle. - If you don’t specify one, the JavaScript can be loaded at /_/ts_scripts.js

- -

Defaults to "/_/ts_scripts.js"

- -

static_files

- -

(List of labels): Arbitrary files which to be served, such as index.html. - They are served relative to the package where this rule is declared.

- -

Defaults to []

- -

karma_web_test

- -

USAGE

- -
-karma_web_test(srcs, deps, data, configuration_env_vars, bootstrap, runtime_deps, static_files,
-               config_file, tags, peer_deps, kwargs)
-
- -

Runs unit tests in a browser with Karma.

- -

When executed under bazel test, this uses a headless browser for speed. -This is also because bazel test allows multiple targets to be tested together, -and we don’t want to open a Chrome window on your machine for each one. Also, -under bazel test the test will execute and immediately terminate.

- -

Running under ibazel test gives you a β€œwatch mode” for your tests. The rule is -optimized for this case - the test runner server will stay running and just -re-serve the up-to-date JavaScript source bundle.

- -

To debug a single test target, run it with bazel run instead. This will open a -browser window on your computer. Also you can use any other browser by opening -the URL printed when the test starts up. The test will remain running until you -cancel the bazel run command.

- -

This rule will use your system Chrome by default. In the default case, your -environment must specify CHROME_BIN so that the rule will know which Chrome binary to run. -Other browsers and customLaunchers may be set using the a base Karma configuration -specified in the config_file attribute.

- -

By default we open a headless Chrome. To use a real Chrome browser window, you can pass ---define DISPLAY=true to Bazel, along with configuration_env_vars = ["DISPLAY"] on -karma_web_test.

- -

PARAMETERS

- -

srcs

- -

A list of JavaScript test files

- -

Defaults to []

- -

deps

- -

Other targets which produce JavaScript such as ts_library

- -

Defaults to []

- -

data

- -

Runtime dependencies

- -

Defaults to []

- -

configuration_env_vars

- -

Pass these configuration environment variables to the resulting binary. -Chooses a subset of the configuration environment variables (taken from ctx.var), which also -includes anything specified via the –define flag. -Note, this can lead to different outputs produced by this rule.

- -

Defaults to []

- -

bootstrap

- -

JavaScript files to include before the module loader (require.js). -For example, you can include Reflect,js for TypeScript decorator metadata reflection, -or UMD bundles for third-party libraries.

- -

Defaults to []

- -

runtime_deps

- -

Dependencies which should be loaded after the module loader but before the srcs and deps. -These should be a list of targets which produce JavaScript such as ts_library. -The files will be loaded in the same order they are declared by that rule.

- -

Defaults to []

- -

static_files

- -

Arbitrary files which are available to be served on request. -Files are served at: -/base/&lt;WORKSPACE_NAME&gt;/&lt;path-to-file&gt;, e.g. -/base/npm_bazel_typescript/examples/testing/static_script.js

- -

Defaults to []

- -

config_file

- -

User supplied Karma configuration file. Bazel will override -certain attributes of this configuration file. Attributes that are -overridden will be outputted to the test log.

- -

Defaults to None

- -

tags

- -

Standard Bazel tags, this macro adds tags for ibazel support

- -

Defaults to []

- -

peer_deps

- -

list of peer npm deps required by karma_web_test

- -

Defaults to ["@npm//karma", "@npm//karma-chrome-launcher", "@npm//karma-firefox-launcher", "@npm//karma-jasmine", "@npm//karma-requirejs", "@npm//karma-sourcemap-loader", "@npm//requirejs"]

- -

kwargs

- -

Passed through to karma_web_test

- -

karma_web_test_suite

- -

USAGE

- -
-karma_web_test_suite(name, browsers, web_test_data, wrapped_test_tags, kwargs)
-
- -

Defines a test_suite of web_test targets that wrap a karma_web_test target.

- -

This macro accepts all parameters in karma_web_test and adds additional parameters -for the suite. See karma_web_test docs for all karma_web_test.

- -

The wrapping macro is web_test_suite which comes from rules_websting: -https://github.com/bazelbuild/rules_webtesting/blob/master/web/web.bzl.

- -

PARAMETERS

- -

name

- -

The base name of the test

- -

browsers

- -

A sequence of labels specifying the browsers to use.

- -

Defaults to None

- -

web_test_data

- -

Data dependencies for the wrapper web_test targets.

- -

Defaults to []

- -

wrapped_test_tags

- -

A list of test tag strings to use for the wrapped -karma_web_test target.

- -

Defaults to ["manual", "noci"]

- -

kwargs

- -

Arguments for the wrapped karma_web_test target.

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Concatjs.md b/docs/Concatjs.md index 338b25aa6b..9b89b28509 100755 --- a/docs/Concatjs.md +++ b/docs/Concatjs.md @@ -1,15 +1,10 @@ ---- -title: Concatjs -layout: default -toc: true -nav: rule ---- + # @bazel/concatjs Concatjs is a JavaScript bundler, in a trivial sense: the UNIX `cat` command is a basic implementation: @@ -33,10 +28,8 @@ So Bazel rules that originated in Google's codebase have affordances for concatj For example `ts_library` produces named AMD modules in its "devmode" output, and `karma_web_test` expects to bundle inputs using concatjs. - ## Compatibility - ### First-party code First-party code has to be authored as named AMD/UMD modules. @@ -59,7 +52,6 @@ using the TS triple-slash syntax: it is [also compiled with](https://github.com/bazelbuild/rules_nodejs/blob/bd53eb524ea3bd56b46b7a5f2eff700443e281ec/packages/concatjs/BUILD.bazel#L28) the `"compilerOptions": { "module": "umd" }` TypeScript setting. - ### Third-party code To make it easier to produce a UMD version of a third-party npm package, we automatically generate a target that uses Browserify to build one, using the `main` entry from the package's `package.json`. @@ -74,7 +66,6 @@ For example, even though RxJS ships with a UMD bundle, it contains multiple entr Ultimately by using concatjs, you're signing up for at least a superficial understanding of these shims and may need to update them when you change your dependencies. - ## Serving JS in development mode under Bazel There are two choices for development mode: @@ -93,8 +84,7 @@ To use `concatjs_devserver`, you simply `load` the rule, and call it with `deps` point to your `ts_library` target(s): ```python -load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver") -load("@npm//@bazel/typescript:index.bzl", "ts_library") +load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver", "ts_library") ts_library( name = "app", @@ -131,7 +121,6 @@ finishes. [ibazel]: https://github.com/bazelbuild/bazel-watcher - ## Testing with Karma The `karma_web_test` rule runs karma tests with Bazel. @@ -143,8 +132,8 @@ if you use the web testing rules in `@bazel/concatjs`: # Fetch transitive Bazel dependencies of karma_web_test http_archive( name = "io_bazel_rules_webtesting", - sha256 = "9bb461d5ef08e850025480bab185fd269242d4e533bca75bfb748001ceb343c3", - urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.3/rules_webtesting.tar.gz"], + sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a", + urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"], ) # Set up web testing, choose browsers we can test on @@ -152,7 +141,7 @@ load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories" web_test_repositories() -load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories") +load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories") browser_repositories( chromium = True, @@ -160,6 +149,13 @@ browser_repositories( ) ``` +## Known issues with running Chromium for macOS/Windows in Bazel + +For macOS and Windows, Chromium comes with files that contain spaces in their file names. This breaks runfile tree +creation within Bazel due to a bug. There are various workarounds that allow for Chromium on these platforms: + +* Instruct Bazel to automatically disable runfile tree creation if not needed. [More details here](https://github.com/bazelbuild/bazel/issues/4327#issuecomment-922106293) +* Instruct Bazel to use an alternative experimental approach for creating runfile trees. [More details here](https://github.com/bazelbuild/bazel/issues/4327#issuecomment-627422865) ## Installing with user-managed dependencies @@ -237,7 +233,7 @@ Defaults to `@npm//@bazel/concatjs/devserver:devserver` (*Label*): Go based devserver executable for the host platform. Defaults to precompiled go binary setup by @bazel/typescript npm package -Defaults to `@npm//@bazel/concatjs/devserver:devserver_darwin_amd64` +Defaults to `@npm//@bazel/concatjs/devserver:devserver`

entry_module

@@ -274,6 +270,276 @@ Defaults to `"/_/ts_scripts.js"` Defaults to `[]` +## ts_library + +**USAGE** + +
+ts_library(name, angular_assets, compiler, data, deps, devmode_module, devmode_target,
+           expected_diagnostics, generate_externs, internal_testing_type_check_dependencies,
+           link_workspace_root, module_name, module_root, package_name, package_path, prodmode_module,
+           prodmode_target, runtime, runtime_deps, srcs, supports_workers, tsconfig, tsickle_typed,
+           use_angular_plugin)
+
+ +type-check and compile a set of TypeScript sources to JavaScript. + +It produces declarations files (`.d.ts`) which are used for compiling downstream +TypeScript targets and JavaScript for the browser and Closure compiler. + +By default, `ts_library` uses the `tsconfig.json` file in the workspace root +directory. See the notes about the `tsconfig` attribute below. + +## Serving TypeScript for development + +`ts_library` is typically served by the concatjs_devserver rule, documented in the `@bazel/concatjs` package. + +## Accessing JavaScript outputs + +The default output of the `ts_library` rule is the `.d.ts` files. +This is for a couple reasons: + +- help ensure that downstream rules which access default outputs will not require + a cascading re-build when only the implementation changes but not the types +- make you think about whether you want the `devmode` (named `UMD`) or `prodmode` outputs + +You can access the JS output by adding a `filegroup` rule after the `ts_library`, +for example + +```python +ts_library( + name = "compile", + srcs = ["thing.ts"], +) + +filegroup( + name = "thing.js", + srcs = ["compile"], + # Change to es6_sources to get the 'prodmode' JS + output_group = "es5_sources", +) + +my_rule( + name = "uses_js", + deps = ["thing.js"], +) +``` + + + +**ATTRIBUTES** + + +

name

+ +(*Name, mandatory*): A unique name for this target. + + +

angular_assets

+ +(*List of labels*): Additional files the Angular compiler will need to read as inputs. + Includes .css and .html files + +Defaults to `[]` + +

compiler

+ +(*Label*): Sets a different TypeScript compiler binary to use for this library. +For example, we use the vanilla TypeScript tsc.js for bootstrapping, +and Angular compilations can replace this with `ngc`. + +The default ts_library compiler depends on the `//@bazel/typescript` +target which is setup for projects that use bazel managed npm deps and +install the @bazel/typescript npm package. + +You can also use a custom compiler to increase the NodeJS heap size used for compilations. + +To do this, declare your own binary for running `tsc_wrapped`, e.g.: + +```python +nodejs_binary( + name = "tsc_wrapped_bin", + entry_point = "@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js", + templated_args = [ + "--node_options=--max-old-space-size=2048", + ], + data = [ + "@npm//protobufjs", + "@npm//source-map-support", + "@npm//tsutils", + "@npm//typescript", + "@npm//@bazel/typescript", + ], +) +``` + +then refer to that target in the `compiler` attribute. + +Note that `nodejs_binary` targets generated by `npm_install`/`yarn_install` can include data dependencies +on packages which aren't declared as dependencies. +For example, if you use [tsickle](https://github.com/angular/tsickle) to generate Closure Compiler-compatible JS, +then it needs to be a data dependency of `tsc_wrapped` so that it can be loaded at runtime. + +Defaults to `@npm//@bazel/concatjs/internal:tsc_wrapped_bin` + +

data

+ +(*List of labels*) + +Defaults to `[]` + +

deps

+ +(*List of labels*): Compile-time dependencies, typically other ts_library targets + +Defaults to `[]` + +

devmode_module

+ +(*String*): Set the typescript `module` compiler option for devmode output. + +This value will override the `module` option in the user supplied tsconfig. + +Defaults to `"umd"` + +

devmode_target

+ +(*String*): Set the typescript `target` compiler option for devmode output. + +This value will override the `target` option in the user supplied tsconfig. + +Defaults to `"es2015"` + +

expected_diagnostics

+ +(*List of strings*) + +Defaults to `[]` + +

generate_externs

+ +(*Boolean*) + +Defaults to `True` + +

internal_testing_type_check_dependencies

+ +(*Boolean*): Testing only, whether to type check inputs that aren't srcs. + +Defaults to `False` + + + +(*Boolean*): Link the workspace root to the bin_dir to support absolute requires like 'my_wksp/path/to/file'. + +If source files need to be required then they can be copied to the bin_dir with copy_to_bin. + +Defaults to `False` + +

module_name

+ +(*String*) + +Defaults to `""` + +

module_root

+ +(*String*) + +Defaults to `""` + +

package_name

+ +(*String*): The package name that the linker will link this ts_library output as. + +If package_path is set, the linker will link this package under /node_modules/. +If package_path is not set the this will be the root node_modules of the workspace. + +Defaults to `""` + +

package_path

+ +(*String*): The package path in the workspace that the linker will link this ts_library output to. + +If package_path is set, the linker will link this package under /node_modules/. +If package_path is not set the this will be the root node_modules of the workspace. + +Defaults to `""` + +

prodmode_module

+ +(*String*): Set the typescript `module` compiler option for prodmode output. + +This value will override the `module` option in the user supplied tsconfig. + +Defaults to `"esnext"` + +

prodmode_target

+ +(*String*): Set the typescript `target` compiler option for prodmode output. + +This value will override the `target` option in the user supplied tsconfig. + +Defaults to `"es2015"` + +

runtime

+ +(*String*) + +Defaults to `"browser"` + +

runtime_deps

+ +(*List of labels*) The dependencies of this attribute must provide: JsInfo + + +Defaults to `[]` + +

srcs

+ +(*List of labels, mandatory*): The TypeScript source files to compile. + + +

supports_workers

+ +(*Boolean*): Intended for internal use only. + +Allows you to disable the Bazel Worker strategy for this library. +Typically used together with the "compiler" setting when using a +non-worker aware compiler binary. + +Defaults to `True` + +

tsconfig

+ +(*Label*): A tsconfig.json file containing settings for TypeScript compilation. +Note that some properties in the tsconfig are governed by Bazel and will be +overridden, such as `target` and `module`. + +The default value is set to `//:tsconfig.json` by a macro. This means you must +either: + +- Have your `tsconfig.json` file in the workspace root directory +- Use an alias in the root BUILD.bazel file to point to the location of tsconfig: + `alias(name="tsconfig.json", actual="//path/to:tsconfig-something.json")` + and also make the tsconfig.json file visible to other Bazel packages: + `exports_files(["tsconfig.json"], visibility = ["//visibility:public"])` +- Give an explicit `tsconfig` attribute to all `ts_library` targets + +Defaults to `None` + +

tsickle_typed

+ +(*Boolean*): If using tsickle, instruct it to translate types to ClosureJS format + +Defaults to `True` + +

use_angular_plugin

+ +(*Boolean*): Run the Angular ngtsc compiler under ts_library + +Defaults to `False` + ## karma_web_test @@ -392,7 +658,6 @@ Passed through to `karma_web_test` - ## karma_web_test_suite **USAGE** diff --git a/docs/Core.md b/docs/Core.md new file mode 100644 index 0000000000..372292a008 --- /dev/null +++ b/docs/Core.md @@ -0,0 +1,562 @@ + +# rules_nodejs Bazel module + +This is the "core" module, and is used internally by `build_bazel_rules_nodejs`. +Most users should continue to use only the latter, and ignore this "core" module. + +The dependency graph is: +`build_bazel_rules_nodejs -> rules_nodejs -> bazel_skylib` + +Features: +- A [Toolchain](https://docs.bazel.build/versions/main/toolchains.html) + that fetches a hermetic copy of node, npm, and yarn - independent of what's on the developer's machine. +- Core [Providers](https://docs.bazel.build/versions/main/skylark/rules.html#providers) to allow interop between JS rules. + +Most features, such as `npm_install` and `nodejs_binary` are still in the `build_bazel_rules_nodejs` module. +We plan to clean these up and port into `rules_nodejs` in a future major release. + + +## directory_file_path + +**USAGE** + +
+directory_file_path(name, directory, path)
+
+ +Provide DirectoryFilePathInfo to reference some file within a directory. + + Otherwise there is no way to give a Bazel label for it. + +**ATTRIBUTES** + + +

name

+ +(*Name, mandatory*): A unique name for this target. + + +

directory

+ +(*Label, mandatory*): a directory + + +

path

+ +(*String, mandatory*): a path within that directory + + + +## node_repositories + +**USAGE** + +
+node_repositories(name, node_download_auth, node_repositories, node_urls, node_version, platform,
+                  repo_mapping, use_nvmrc)
+
+ +To be run in user's WORKSPACE to install rules_nodejs dependencies. + +This rule sets up node, npm, and npx. The versions of these tools can be specified in one of three ways + +### Simplest Usage + +Specify no explicit versions. This will download and use the latest NodeJS that was available when the +version of rules_nodejs you're using was released. +Note that you can skip calling `node_repositories` in your WORKSPACE file - if you later try to `yarn_install` or `npm_install`, +we'll automatically select this simple usage for you. + +### Forced version(s) + +You can select the version of NodeJS to download & use by specifying it when you call node_repositories, +using a value that matches a known version (see the default values) + +### Using a custom version + +You can pass in a custom list of NodeJS repositories and URLs for node_repositories to use. + +#### Custom NodeJS versions + +To specify custom NodeJS versions, use the `node_repositories` attribute + +```python +node_repositories( + node_repositories = { + "10.10.0-darwin_amd64": ("node-v10.10.0-darwin-x64.tar.gz", "node-v10.10.0-darwin-x64", "00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e"), + "10.10.0-linux_amd64": ("node-v10.10.0-linux-x64.tar.xz", "node-v10.10.0-linux-x64", "686d2c7b7698097e67bcd68edc3d6b5d28d81f62436c7cf9e7779d134ec262a9"), + "10.10.0-windows_amd64": ("node-v10.10.0-win-x64.zip", "node-v10.10.0-win-x64", "70c46e6451798be9d052b700ce5dadccb75cf917f6bf0d6ed54344c856830cfb"), + }, +) +``` + +These can be mapped to a custom download URL, using `node_urls` + +```python +node_repositories( + node_version = "10.10.0", + node_repositories = {"10.10.0-darwin_amd64": ("node-v10.10.0-darwin-x64.tar.gz", "node-v10.10.0-darwin-x64", "00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e")}, + node_urls = ["https://mycorpproxy/mirror/node/v{version}/{filename}"], +) +``` + +A Mac client will try to download node from `https://mycorpproxy/mirror/node/v10.10.0/node-v10.10.0-darwin-x64.tar.gz` +and expect that file to have sha256sum `00b7a8426e076e9bf9d12ba2d571312e833fe962c70afafd10ad3682fdeeaa5e` + +See the [the repositories documentation](repositories.html) for how to use the resulting repositories. + +### Using a custom node.js. + +To avoid downloads, you can check in a vendored node.js binary or can build one from source. +See [toolchains](./toolchains.md) and `examples/vendored_node_and_yarn`. + + + +**ATTRIBUTES** + + +

name

+ +(*Name, mandatory*): A unique name for this repository. + + +

node_download_auth

+ +(*Dictionary: String -> String*): auth to use for all url requests +Example: {"type": "basic", "login": "", "password": "" } + +Defaults to `{}` + +

node_repositories

+ +(*Dictionary: String -> List of strings*): Custom list of node repositories to use + +A dictionary mapping NodeJS versions to sets of hosts and their corresponding (filename, strip_prefix, sha256) tuples. +You should list a node binary for every platform users have, likely Mac, Windows, and Linux. + +By default, if this attribute has no items, we'll use a list of all public NodeJS releases. + +Defaults to `{}` + +

node_urls

+ +(*List of strings*): custom list of URLs to use to download NodeJS + +Each entry is a template for downloading a node distribution. + +The `{version}` parameter is substituted with the `node_version` attribute, +and `{filename}` with the matching entry from the `node_repositories` attribute. + +Defaults to `["https://nodejs.org/dist/v{version}/{filename}"]` + +

node_version

+ +(*String*): the specific version of NodeJS to install + +Defaults to `"16.20.0"` + +

platform

+ +(*String*): Internal use only. Which platform to install as a toolchain. If unset, we assume the repository is named nodejs_[platform] + +Defaults to `""` + +

repo_mapping

+ +(*Dictionary: String -> String, mandatory*): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`). + + +

use_nvmrc

+ +(*Label*): the local path of the .nvmrc file containing the version of node + +If set then also set node_version to the version found in the .nvmrc file. + +Defaults to `None` + + +## node_toolchain + +**USAGE** + +
+node_toolchain(name, npm, npm_files, npm_path, run_npm, target_tool, target_tool_path)
+
+ +Defines a node toolchain for a platform. + +You can use this to refer to a vendored nodejs binary in your repository, +or even to compile nodejs from sources using rules_foreign_cc or other rules. + +First, in a BUILD.bazel file, create a node_toolchain definition: + +```starlark +load("@rules_nodejs//nodejs:toolchain.bzl", "node_toolchain") + +node_toolchain( + name = "node_toolchain", + target_tool = "//some/path/bin/node", +) +``` + +Next, declare which execution platforms or target platforms the toolchain should be selected for +based on constraints. + +```starlark +toolchain( + name = "my_nodejs", + exec_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], + toolchain = ":node_toolchain", + toolchain_type = "@rules_nodejs//nodejs:toolchain_type", +) +``` + +See https://bazel.build/extending/toolchains#toolchain-resolution for more information on toolchain +resolution. + +Finally in your `WORKSPACE`, register it with `register_toolchains("//:my_nodejs")` + +For usage see https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains. +You can use the `--toolchain_resolution_debug` flag to `bazel` to help diagnose which toolchain is selected. + + +**ATTRIBUTES** + + +

name

+ +(*Name, mandatory*): A unique name for this target. + + +

npm

+ +(*Label*): A hermetically downloaded npm executable target for this target's platform. + +Defaults to `None` + +

npm_files

+ +(*List of labels*): Files required in runfiles to run npm. + +Defaults to `[]` + +

npm_path

+ +(*String*): Path to an existing npm executable for this target's platform. + +Defaults to `""` + +

run_npm

+ +(*Label*): A template file that allows us to execute npm + +Defaults to `None` + +

target_tool

+ +(*Label*): A hermetically downloaded nodejs executable target for this target's platform. + +Defaults to `None` + +

target_tool_path

+ +(*String*): Path to an existing nodejs executable for this target's platform. + +Defaults to `""` + + +## yarn_repositories + +**USAGE** + +
+yarn_repositories(name, node_repository, repo_mapping, yarn_download_auth, yarn_releases, yarn_urls,
+                  yarn_version)
+
+ +Repository rule to fetch the yarnpkg.com package manager. + +Note, the recommended name is "yarn". If you choose a different name, you'll have to override the +`yarn` attribute in your `yarn_install` rule to point to your `yarn.js` file. + +## Custom Yarn versions + +To specify custom Yarn versions, use the `yarn_releases` attribute + +```python +yarn_repositories( + yarn_releases = { + "1.12.1": ("yarn-v1.12.1.tar.gz", "yarn-v1.12.1", "09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d"), + }, +) +``` + +Like `node_urls`, the `yarn_urls` attribute can be used to provide a list of custom URLs to use to download yarn + +```python +yarn_repositories( + yarn_releases = { + "1.12.1": ("yarn-v1.12.1.tar.gz", "yarn-v1.12.1", "09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d"), + }, + yarn_version = "1.12.1", + yarn_urls = [ + "https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}", + ], +) +``` + +Will download yarn from https://github.com/yarnpkg/yarn/releases/download/v1.2.1/yarn-v1.12.1.tar.gz +and expect the file to have sha256sum `09bea8f4ec41e9079fa03093d3b2db7ac5c5331852236d63815f8df42b3ba88d`. + +If you don't use Yarn at all, you can skip downloading it by setting `yarn_urls = []`. + +## Vendored yarn + +You can vendor the `yarn.js` file into your repo. In this case, don't call `yarn_repositories` at all. +Just pass the label of your vendored file to the `yarn` attribute of `yarn_install`. + + +**ATTRIBUTES** + + +

name

+ +(*Name, mandatory*): A unique name for this repository. + + +

node_repository

+ +(*String*): The basename for a nodejs toolchain to use for running yarn. + Usually this is the value of the `name` attribute given to a nodejs_register_toolchains call in WORKSPACE + +Defaults to `"nodejs"` + +

repo_mapping

+ +(*Dictionary: String -> String, mandatory*): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`). + + +

yarn_download_auth

+ +(*Dictionary: String -> String*): auth to use for all url requests + Example: {"type": "basic", "login": "", "password": "" } + +Defaults to `{}` + +

yarn_releases

+ +(*Dictionary: String -> List of strings*): Custom list of yarn releases to use. + + Dictionary mapping Yarn versions to their corresponding (filename, strip_prefix, sha256) tuples. + + By default, if this attribute has no items, we'll use a list of all public releases which + is periodically mirrored to rules_nodejs. + +Defaults to `{}` + +

yarn_urls

+ +(*List of strings*): custom list of URLs to use to download Yarn + + Each entry is a template using `yarn_version` and `yarn_releases` in the substitutions. + + If this list is empty, we won't download yarn at all. + +Defaults to `["https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}"]` + +

yarn_version

+ +(*String*): the specific version of Yarn to install + +Defaults to `"1.22.11"` + + +## DeclarationInfo + +**USAGE** + +
+DeclarationInfo(declarations, transitive_declarations, type_blocklisted_declarations)
+
+ +The DeclarationInfo provider allows JS rules to communicate typing information. +TypeScript's .d.ts files are used as the interop format for describing types. +package.json files are included as well, as TypeScript needs to read the "typings" property. + +Do not create DeclarationInfo instances directly, instead use the declaration_info factory function. + +Note: historically this was a subset of the string-typed "typescript" provider. + + +**FIELDS** + +

declarations

+ + A depset of typings files produced by this rule +

transitive_declarations

+ + A depset of typings files produced by this rule and all its transitive dependencies. +This prevents needing an aspect in rules that consume the typings, which improves performance. +

type_blocklisted_declarations

+ + A depset of .d.ts files that we should not use to infer JSCompiler types (via tsickle) + + +## DirectoryFilePathInfo + +**USAGE** + +
+DirectoryFilePathInfo(directory, path)
+
+ +Joins a label pointing to a TreeArtifact with a path nested within that directory. + +**FIELDS** + +

directory

+ + a TreeArtifact (ctx.actions.declare_directory) +

path

+ + path relative to the directory + + +## JSModuleInfo + +**USAGE** + +
+JSModuleInfo(direct_sources, sources)
+
+ +JavaScript files and sourcemaps. + +**FIELDS** + +

direct_sources

+ + Depset of direct JavaScript files and sourcemaps +

sources

+ + Depset of direct and transitive JavaScript files and sourcemaps + + +## LinkablePackageInfo + +**USAGE** + +
+LinkablePackageInfo(files, package_name, package_path, path)
+
+ +The LinkablePackageInfo provider provides information to the linker for linking pkg_npm built packages + +**FIELDS** + +

files

+ + Depset of files in this package (must all be contained within path) +

package_name

+ + The package name. + +This field is optional. If not set, the target can be made linkable to a package_name with the npm_link rule. +

package_path

+ + The directory in the workspace to link to. + +If set, link the 1st party dependencies to the node_modules under the package path specified. +If unset, the default is to link to the node_modules root of the workspace. +

path

+ + The path to link to. + +Path must be relative to execroot/wksp. It can either an output dir path such as, + +`bazel-out/-/bin/path/to/package` or +`bazel-out/-/bin/external/external_wksp>/path/to/package` + +or a source file path such as, + +`path/to/package` or +`external//path/to/package` + + +## UserBuildSettingInfo + +**USAGE** + +
+UserBuildSettingInfo(value)
+
+ + + +**FIELDS** + +

value

+ + (Undocumented) + + +## declaration_info + +**USAGE** + +
+declaration_info(declarations, deps)
+
+ +Constructs a DeclarationInfo including all transitive files needed to type-check from DeclarationInfo providers in a list of deps. + +**PARAMETERS** + + +

declarations

+ +list of typings files + + + +

deps

+ +list of labels of dependencies where we should collect their DeclarationInfo to pass transitively + +Defaults to `[]` + + +## js_module_info + +**USAGE** + +
+js_module_info(sources, deps)
+
+ +Constructs a JSModuleInfo including all transitive sources from JSModuleInfo providers in a list of deps. + +**PARAMETERS** + + +

sources

+ +direct JS files + + + +

deps

+ +other targets that provide JSModuleInfo, typically from the deps attribute + +Defaults to `[]` + + diff --git a/docs/Cypress.html b/docs/Cypress.html deleted file mode 100755 index 849a083228..0000000000 --- a/docs/Cypress.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - - - - - rules_nodejs - Cypress - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

Cypress rules for Bazel

- -

The Cypress rules run tests under the Cypress e2e testing framework with Bazel.

- -

Installation

- -

Add @bazel/cypress and cypress npm packages to your devDependencies in package.json.

- -
npm install --save-dev @bazel/cypress cypress
-
-

or using yarn

-
yarn add -D @bazel/cypress cypress
-
- -

Then, load and invoke cypress_repository within your WORKSPACE file.

- -
# Assuming your external repository for node_modules is named @npm
-
-load("@npm//@bazel/cypress:index.bzl", "cypress_repository")
-
-# The name you pass here names the external repository you can load cypress_web_test from
-cypress_repository(name = "cypress")
-
- -

macOS install requirements

-

On macOS, cypress_repository generates an external repository containing files whose names contain spaces. In order to make these files compatible with bazel you will need to add the following flag to your .bazelrc file:

-
# Required for cypress_repository on macOS
-build --experimental_inprocess_symlink_creation
-
- -

windows install requirements

-

At this point in time, cypress_repository is incompatible with bazel sandboxing on Windows. This may change in the future, but for now using cypress on windows requires windows sandboxing be disabled (it is disabled by default)

- -

Example use of cypress_web_test

-

This example assumes you’ve named your external repository for node_modules as npm and for cypress as cypress

-
load("@cypress//:index.bzl", "cypress_web_test")
-load("@npm//@bazel/typescript:index.bzl", "ts_library")
-
-# You must create a cypress plugin in order to boot a server to serve your application. It can be written as a javascript file or in typescript using ts_library or ts_project.
-ts_library(
-    name = "plugins_file",
-    testonly = True,
-    srcs = ["plugin.ts"],
-    tsconfig = ":tsconfig.json",
-    deps = [
-        "@npm//@types/node",
-        "@npm//express",
-    ],
-)
-
-# You can write your cypress tests a javascript files or in typescript using ts_library or ts_project.
-ts_library(
-    name = "hello_spec",
-    testonly = True,
-    srcs = ["hello.spec.ts"],
-    tsconfig = ":tsconfig.json",
-    deps = [
-        "@npm//cypress",
-    ],
-)
-
-cypress_web_test(
-    # The name of your test target
-    name = "test",
-    srcs = [
-        # Load javascript test files directly as sources
-        "world.spec.js",
-        # Load ts_library tests as a target to srcs
-        ":hello_spec",
-    ],
-    # A cypress config file is required
-    config_file = "cypress.json",
-    # Any runtime dependencies you need to boot your server or run your tests
-    data = [],
-    # Your cypress plugin used to configure cypress and boot your server
-    plugins_file = ":plugins_file",
-)
-
- -

cypress_repository

- -

USAGE

- -
-cypress_repository(name, cypress_bin, fail_on_error, quiet, repo_mapping)
-
- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this repository.

- -

cypress_bin

- -

(Label): bazel target of the cypress binary

- -

Defaults to @npm//:node_modules/cypress/bin/cypress

- -

fail_on_error

- -

(Boolean): If the repository rule should allow errors

- -

Defaults to True

- -

quiet

- -

(Boolean): If stdout and stderr should be printed to the terminal

- -

Defaults to True

- -

repo_mapping

- -

(Dictionary: String -> String, mandatory): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Cypress.md b/docs/Cypress.md index 6b2114ec53..d8a197b20b 100755 --- a/docs/Cypress.md +++ b/docs/Cypress.md @@ -1,20 +1,14 @@ ---- -title: Cypress -layout: default -toc: true -nav: rule ---- + # Cypress rules for Bazel The Cypress rules run tests under the Cypress e2e testing framework with Bazel. - ## Installation Add `@bazel/cypress` and `cypress` npm packages to your `devDependencies` in `package.json`. @@ -27,39 +21,25 @@ or using yarn yarn add -D @bazel/cypress cypress ``` -Then, load and invoke `cypress_repository` within your `WORKSPACE` file. +Then, load and invoke `cypress_repositories` within your `WORKSPACE` file. ```python -# Assuming your external repository for node_modules is named @npm - -load("@npm//@bazel/cypress:index.bzl", "cypress_repository") +load("@build_bazel_rules_nodejs//toolchains/cypress:cypress_repositories.bzl", "cypress_repositories") # The name you pass here names the external repository you can load cypress_web_test from -cypress_repository(name = "cypress") -``` - - -### macOS install requirements -On macOS, `cypress_repository` generates an external repository containing files whose names contain spaces. In order to make these files compatible with bazel you will need to add the following flag to your `.bazelrc` file: -```python -# Required for cypress_repository on macOS -build --experimental_inprocess_symlink_creation +cypress_repositories(name = "cypress", version = "MATCH_VERSION_IN_PACKAGE_JSON") ``` -### windows install requirements -At this point in time, `cypress_repository` is incompatible with bazel sandboxing on Windows. This may change in the future, but for now using cypress on windows requires windows sandboxing be disabled (it is disabled by default) - - ## Example use of cypress_web_test This example assumes you've named your external repository for node_modules as `npm` and for cypress as `cypress` ```python -load("@cypress//:index.bzl", "cypress_web_test") -load("@npm//@bazel/typescript:index.bzl", "ts_library") +load("@npm//@bazel/concatjs:index.bzl", "ts_library") +load("@npm//@bazel/cypress:index.bzl", "cypress_web_test") # You must create a cypress plugin in order to boot a server to serve your application. It can be written as a javascript file or in typescript using ts_library or ts_project. ts_library( - name = "plugins_file", + name = "plugin_file", testonly = True, srcs = ["plugin.ts"], tsconfig = ":tsconfig.json", @@ -94,50 +74,358 @@ cypress_web_test( # Any runtime dependencies you need to boot your server or run your tests data = [], # Your cypress plugin used to configure cypress and boot your server - plugins_file = ":plugins_file", + plugin_file = ":plugin_file", ) ``` -## cypress_repository +## cypress_toolchain **USAGE**
-cypress_repository(name, cypress_bin, fail_on_error, quiet, repo_mapping)
+cypress_toolchain(name, cypress_bin, cypress_bin_path, cypress_files)
 
+Defines a cypress toolchain. + +For usage see https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains. + + +**ATTRIBUTES** + + +

name

+ +(*Name, mandatory*): A unique name for this target. + + +

cypress_bin

+ +(*Label*): A hermetically downloaded cypress executable binary for the target platform. + +Defaults to `None` + +

cypress_bin_path

+ +(*String*): Path to an existing cypress executable for the target platform. + +Defaults to `""` + +

cypress_files

+ +(*Label*): A hermetically downloaded cypress filegroup of all cypress binary files for the target platform. Must be set when cypress_bin is set. + +Defaults to `None` + + +## cypress_web_test + +**USAGE** + +
+cypress_web_test(name, chdir, config_file, configuration_env_vars, cypress_npm_package, data,
+                 default_env_vars, entry_point, env, expected_exit_code, link_workspace_root,
+                 plugin_file, srcs, templated_args, toolchain)
+
+ + +Identical to `nodejs_binary`, except this can be used with `bazel test` as well. +When the binary returns zero exit code, the test passes; otherwise it fails. + +`nodejs_test` is a convenient way to write a novel kind of test based on running +your own test runner. For example, the `ts-api-guardian` library has a way to +assert the public API of a TypeScript program, and uses `nodejs_test` here: +https://github.com/angular/angular/blob/master/tools/ts-api-guardian/index.bzl + +If you just want to run a standard test using a test runner from npm, use the generated +*_test target created by npm_install/yarn_install, such as `mocha_test`. +Some test runners like Karma and Jasmine have custom rules with added features, e.g. `jasmine_node_test`. + +By default, Bazel runs tests with a working directory set to your workspace root. +Use the `chdir` attribute to change the working directory before the program starts. + +To debug a Node.js test, we recommend saving a group of flags together in a "config". +Put this in your `tools/bazel.rc` so it's shared with your team: +```python +# Enable debugging tests with --config=debug +test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results +``` + +Now you can add `--config=debug` to any `bazel test` command line. +The runtime will pause before executing the program, allowing you to connect a +remote debugger. + +You can also change the default args that are sent to nodejs. This can be done through a flag. The default is --preserve-symlinks while anything +can be passed. The flag is --@rules_nodejs//nodejs:default_args="" ex: bazel test --@rules_nodejs//nodejs:default_args="--preserve-symlinks --no-warnings" //:target. +This will pass --preserve-symlinks and --no-warnings flags to nodejs. Available node flags can be found here: https://nodejs.org/api/cli.html. **ATTRIBUTES** -

name

+

name

+ +(*Name, mandatory*): A unique name for this target. + + +

chdir

+ +(*String*): Working directory to run the binary or test in, relative to the workspace. +By default, Bazel always runs in the workspace root. +Due to implementation details, this argument must be underneath this package directory. + +To run in the directory containing the `nodejs_binary` / `nodejs_test`, use + + chdir = package_name() + +(or if you're in a macro, use `native.package_name()`) + +WARNING: this will affect other paths passed to the program, either as arguments or in configuration files, +which are workspace-relative. +You may need `../../` segments to re-relativize such paths to the new working directory. + +Defaults to `""` + +

config_file

+ +(*Label, mandatory*): cypress.json configuration file. See https://docs.cypress.io/guides/references/configuration + + +

configuration_env_vars

+ +(*List of strings*): Pass these configuration environment variables to the resulting binary. +Chooses a subset of the configuration environment variables (taken from `ctx.var`), which also +includes anything specified via the --define flag. +Note, this can lead to different outputs produced by this rule. + +Defaults to `[]` + +

cypress_npm_package

+ +(*Label*): The cypress npm package. If you installed cypress as a peer dependency, this should not need to be set. + +Defaults to `//cypress:cypress` + +

data

+ +(*List of labels*): Runtime dependencies which may be loaded during execution. + +Defaults to `[]` + +

default_env_vars

+ +(*List of strings*): Default environment variables that are added to `configuration_env_vars`. + +This is separate from the default of `configuration_env_vars` so that a user can set `configuration_env_vars` +without losing the defaults that should be set in most cases. + +The set of default environment variables is: + +- `VERBOSE_LOGS`: use by some rules & tools to turn on debug output in their logs +- `NODE_DEBUG`: used by node.js itself to print more logs +- `RUNFILES_LIB_DEBUG`: print diagnostic message from Bazel runfiles.bash helper + +Defaults to `["VERBOSE_LOGS", "NODE_DEBUG", "RUNFILES_LIB_DEBUG"]` + +

entry_point

+ +(*Label*): Entry point JS file which bootstraps the cypress cli + +Defaults to `@npm//@bazel/cypress/internal:run-cypress.js` + +

env

+ +(*Dictionary: String -> String*): Specifies additional environment variables to set when the target is executed, subject to location +and make variable expansion. + +Defaults to `{}` + +

expected_exit_code

+ +(*Integer*): The expected exit code for the test. Defaults to 0. + +Defaults to `0` + + + +(*Boolean*): Link the workspace root to the bin_dir to support absolute requires like 'my_wksp/path/to/file'. +If source files need to be required then they can be copied to the bin_dir with copy_to_bin. + +Defaults to `False` + +

plugin_file

+ +(*Label*): Your cypress plugin file. See https://docs.cypress.io/guides/tooling/plugins-guide + +Defaults to `@npm//@bazel/cypress/internal:plugins/base.js` + +

srcs

+ +(*List of labels*): A list of test files. See https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests#Test-files + +Defaults to `[]` + +

templated_args

+ +(*List of strings*): Arguments which are passed to every execution of the program. + To pass a node startup option, prepend it with `--node_options=`, e.g. + `--node_options=--preserve-symlinks`. + +Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html. + +1. Subject to predefined source/output path variables substitutions. + +The predefined variables `execpath`, `execpaths`, `rootpath`, `rootpaths`, `location`, and `locations` take +label parameters (e.g. `$(execpath //foo:bar)`) and substitute the file paths denoted by that label. + +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info. + +NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test +args and genrule bazel substitions. This will be fixed in a future major release. +See docs string of `expand_location_into_runfiles` macro in `internal/common/expand_into_runfiles.bzl` +for more info. + +The recommended approach is to now use `$(rootpath)` where you previously used $(location). + +To get from a `$(rootpath)` to the absolute path that `$$(rlocation $(location))` returned you can either use +`$$(rlocation $(rootpath))` if you are in the `templated_args` of a `nodejs_binary` or `nodejs_test`: + +BUILD.bazel: +```python +nodejs_test( + name = "my_test", + data = [":bootstrap.js"], + templated_args = ["--node_options=--require=$$(rlocation $(rootpath :bootstrap.js))"], +) +``` + +or if you're in the context of a .js script you can pass the $(rootpath) as an argument to the script +and use the javascript runfiles helper to resolve to the absolute path: + +BUILD.bazel: +```python +nodejs_test( + name = "my_test", + data = [":some_file"], + entry_point = ":my_test.js", + templated_args = ["$(rootpath :some_file)"], +) +``` + +my_test.js +```python +const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']); +const args = process.argv.slice(2); +const some_file = runfiles.resolveWorkspaceRelative(args[0]); +``` + +NB: Bazel will error if it sees the single dollar sign $(rlocation path) in `templated_args` as it will try to +expand `$(rlocation)` since we now expand predefined & custom "make" variables such as `$(COMPILATION_MODE)`, +`$(BINDIR)` & `$(TARGET_CPU)` using `ctx.expand_make_variables`. See https://docs.bazel.build/versions/main/be/make-variables.html. + +To prevent expansion of `$(rlocation)` write it as `$$(rlocation)`. Bazel understands `$$` to be +the string literal `$` and the expansion results in `$(rlocation)` being passed as an arg instead +of being expanded. `$(rlocation)` is then evaluated by the bash node launcher script and it calls +the `rlocation` function in the runfiles.bash helper. For example, the templated arg +`$$(rlocation $(rootpath //:some_file))` is expanded by Bazel to `$(rlocation ./some_file)` which +is then converted in bash to the absolute path of `//:some_file` in runfiles by the runfiles.bash helper +before being passed as an argument to the program. + +NB: nodejs_binary and nodejs_test will preserve the legacy behavior of `$(rlocation)` so users don't +need to update to `$$(rlocation)`. This may be changed in the future. + +2. Subject to predefined variables & custom variable substitutions. + +Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. +See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables. + +Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. +See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables. + +Predefined genrule variables are not supported in this context. + +Defaults to `[]` + +

toolchain

+ +(*Label*) + +Defaults to `None` + + +## cypress_repositories + +**USAGE** + +
+cypress_repositories(name, version, linux_urls, linux_sha256, darwin_urls, darwin_sha256,
+                     darwin_arm64_urls, darwin_arm64_sha256, windows_urls, windows_sha256)
+
+ + Repository rule used to install cypress binary. + +**PARAMETERS** + + +

name

+ +Name of the external workspace where the cypress binary lives + + + +

version

+ +Version of cypress binary to use. Should match package.json + + + +

linux_urls

+ +(Optional) URLs at which the cypress binary for linux distros of linux can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used. + +Defaults to `[]` + +

linux_sha256

+ +(Optional) SHA-256 of the linux cypress binary + +Defaults to `""` + +

darwin_urls

+ +(Optional) URLs at which the cypress binary for darwin can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used. + +Defaults to `[]` + +

darwin_sha256

-(*Name, mandatory*): A unique name for this repository. +(Optional) SHA-256 of the darwin cypress binary +Defaults to `""` -

cypress_bin

+

darwin_arm64_urls

-(*Label*): bazel target of the cypress binary +(Optional) URLs at which the cypress binary for darwin arm64 can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used (note: as of this writing (11/2021), Cypress does not have native arm64 builds, and this URL will link to the x86_64 build to run under Rosetta). -Defaults to `@npm//:node_modules/cypress/bin/cypress` +Defaults to `[]` -

fail_on_error

+

darwin_arm64_sha256

-(*Boolean*): If the repository rule should allow errors +(Optional) SHA-256 of the darwin arm64 cypress binary -Defaults to `True` +Defaults to `""` -

quiet

+

windows_urls

-(*Boolean*): If stdout and stderr should be printed to the terminal +(Optional) URLs at which the cypress binary for windows distros of linux can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used. -Defaults to `True` +Defaults to `[]` -

repo_mapping

+

windows_sha256

-(*Dictionary: String -> String, mandatory*): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`). +(Optional) SHA-256 of the windows cypress binary +Defaults to `""` diff --git a/docs/Jasmine.html b/docs/Jasmine.html deleted file mode 100755 index 1b17280215..0000000000 --- a/docs/Jasmine.html +++ /dev/null @@ -1,386 +0,0 @@ - - - - - - - - - - rules_nodejs - Jasmine - - - - - - - - - - - - - - - - - - - - - - - -

- - -
-
-
- - - -
- - -
-
- -

Jasmine rules for Bazel

- -

The Jasmine rules run tests under the Jasmine framework with Bazel.

- -

Installation

- -

Add the @bazel/jasmine npm package to your devDependencies in package.json.

- -

jasmine_node_test

- -

USAGE

- -
-jasmine_node_test(name, srcs, data, deps, expected_exit_code, tags, config_file, use_direct_specs,
-                  jasmine, jasmine_entry_point, kwargs)
-
- -

Runs tests in NodeJS using the Jasmine test runner.

- -

Detailed XML test results are found in the standard bazel-testlogs -directory. This may be symlinked in your workspace. -See https://docs.bazel.build/versions/master/output_directories.html

- -

To debug the test, see debugging notes in nodejs_test.

- -

PARAMETERS

- -

name

- -

Name of the resulting label

- -

srcs

- -

JavaScript source files containing Jasmine specs

- -

Defaults to []

- -

data

- -

Runtime dependencies which will be loaded while the test executes

- -

Defaults to []

- -

deps

- -

Other targets which produce JavaScript, such as ts_library

- -

Defaults to []

- -

expected_exit_code

- -

The expected exit code for the test.

- -

Defaults to 0

- -

tags

- -

Bazel tags applied to test

- -

Defaults to []

- -

config_file

- -

(experimental) label of a file containing Jasmine JSON config.

- -

Note that not all configuration options are honored, and -we expect some strange feature interations. -For example, the filter for which files are instrumented for -code coverage doesn’t understand the spec_files setting in the config.

- -

See https://jasmine.github.io/setup/nodejs.html#configuration

- -

Defaults to None

- -

use_direct_specs

- -

Limits the list of specs added to the execution (test suite) to direct sources.

- -

Note that this is a bug fix opt-in flag, which will be the default -behavior in the next major release.

- -

More info: https://github.com/bazelbuild/rules_nodejs/pull/2576

- -

Defaults to None

- -

jasmine

- -

A label providing the @bazel/jasmine npm dependency.

- -

Defaults to "@npm//@bazel/jasmine"

- -

jasmine_entry_point

- -

A label providing the @bazel/jasmine entry point.

- -

Defaults to "@npm//@bazel/jasmine:jasmine_runner.js"

- -

kwargs

- -

Remaining arguments are passed to the test rule

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Jasmine.md b/docs/Jasmine.md index 9f8b58e334..bf4a4b8048 100755 --- a/docs/Jasmine.md +++ b/docs/Jasmine.md @@ -1,20 +1,14 @@ ---- -title: Jasmine -layout: default -toc: true -nav: rule ---- + # Jasmine rules for Bazel The Jasmine rules run tests under the Jasmine framework with Bazel. - ## Installation Add the `@bazel/jasmine` npm package to your `devDependencies` in `package.json`. @@ -33,7 +27,7 @@ Runs tests in NodeJS using the Jasmine test runner. Detailed XML test results are found in the standard `bazel-testlogs` directory. This may be symlinked in your workspace. -See https://docs.bazel.build/versions/master/output_directories.html +See https://docs.bazel.build/versions/main/output_directories.html To debug the test, see debugging notes in `nodejs_test`. @@ -61,7 +55,7 @@ Defaults to `[]`

deps

-Other targets which produce JavaScript, such as ts_library +Other targets which produce JavaScript, such as ts_project Defaults to `[]` @@ -104,14 +98,17 @@ Defaults to `None`

jasmine

A label providing the `@bazel/jasmine` npm dependency. +Intended for internal use only. -Defaults to `"@npm//@bazel/jasmine"` +Defaults to `None`

jasmine_entry_point

A label providing the `@bazel/jasmine` entry point. +This is a custom wrapper which adds features like sharding and ibazel support. +Intended for internal use only. -Defaults to `"@npm//@bazel/jasmine:jasmine_runner.js"` +Defaults to `None`

kwargs

diff --git a/docs/Karma.md b/docs/Karma.md index b389b8f411..a580f9cac1 100755 --- a/docs/Karma.md +++ b/docs/Karma.md @@ -1,9 +1,3 @@ ---- -title: Karma -layout: default -toc: true -nav: rule ---- - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

Bazel nodejs Labs

- -

This package contains experimental code which isn’t at the same quality or stability standard as our main packages.

- -

By using code in Labs, we trust that you understand:

- -
    -
  • It might be deleted at any time
  • -
  • We offer no support guarantees for using it
  • -
  • Breaking changes can happen in any release
  • -
  • We could release with bugs or other brokenness
  • -
  • Documentation is sparse
  • -
- -

ts_proto_library

- -

USAGE

- -
-ts_proto_library(name, proto)
-
- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

proto

- -

(Label, mandatory) The dependencies of this attribute must provide: ProtoInfo

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Labs.md b/docs/Labs.md deleted file mode 100755 index 406664c4ac..0000000000 --- a/docs/Labs.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Labs -layout: default -toc: true -nav: rule ---- - -# Bazel nodejs Labs - -This package contains experimental code which isn't at the same quality or stability standard as our main packages. - -By using code in Labs, we trust that you understand: - -- It might be deleted at any time -- We offer no support guarantees for using it -- Breaking changes can happen in any release -- We could release with bugs or other brokenness -- Documentation is sparse - - -## ts_proto_library - -**USAGE** - -
-ts_proto_library(name, proto)
-
- - - -**ATTRIBUTES** - - -

name

- -(*Name, mandatory*): A unique name for this target. - - -

proto

- -(*Label, mandatory*) The dependencies of this attribute must provide: ProtoInfo - - - - diff --git a/docs/Protractor.html b/docs/Protractor.html deleted file mode 100755 index 55314e5334..0000000000 --- a/docs/Protractor.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - - - - - rules_nodejs - Protractor - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

Protractor rules for Bazel

- -

The Protractor rules run tests under the Protractor framework with Bazel.

- -

Installation

- -

Add the @bazel/protractor npm package to your devDependencies in package.json.

- -

protractor_web_test

- -

USAGE

- -
-protractor_web_test(name, configuration, on_prepare, srcs, deps, data, server, tags, peer_deps,
-                    protractor_entry_point, kwargs)
-
- -

Runs a protractor test in a browser.

- -

PARAMETERS

- -

name

- -

The name of the test

- -

configuration

- -

Protractor configuration file.

- -

Defaults to None

- -

on_prepare

- -

A file with a node.js script to run once before all tests run. -If the script exports a function which returns a promise, protractor -will wait for the promise to resolve before beginning tests.

- -

Defaults to None

- -

srcs

- -

JavaScript source files

- -

Defaults to []

- -

deps

- -

Other targets which produce JavaScript such as ts_library

- -

Defaults to []

- -

data

- -

Runtime dependencies

- -

Defaults to []

- -

server

- -

Optional server executable target

- -

Defaults to None

- -

tags

- -

Standard Bazel tags, this macro adds one for ibazel

- -

Defaults to []

- -

peer_deps

- -

List of peer npm deps required by protractor_web_test

- -

Defaults to ["@npm//@bazel/protractor", "@npm//protractor"]

- -

protractor_entry_point

- -

A label providing the protractor entry point -Default to :node_modules/protractor/bin/protractor.

- -

Defaults to "@npm//:node_modules/protractor/bin/protractor"

- -

kwargs

- -

passed through to protractor_web_test

- -

protractor_web_test_suite

- -

USAGE

- -
-protractor_web_test_suite(name, browsers, web_test_data, wrapped_test_tags, kwargs)
-
- -

Defines a test_suite of web_test targets that wrap a protractor_web_test target.

- -

PARAMETERS

- -

name

- -

The base name of the test

- -

browsers

- -

A sequence of labels specifying the browsers to use.

- -

Defaults to None

- -

web_test_data

- -

Data dependencies for the wrapper web_test targets.

- -

Defaults to []

- -

wrapped_test_tags

- -

A list of test tag strings to use for the wrapped -karma_web_test target.

- -

Defaults to ["manual", "noci"]

- -

kwargs

- -

Arguments for the wrapped karma_web_test target.

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Protractor.md b/docs/Protractor.md index c4a72ff353..6b1bf5835a 100755 --- a/docs/Protractor.md +++ b/docs/Protractor.md @@ -1,24 +1,25 @@ ---- -title: Protractor -layout: default -toc: true -nav: rule ---- + # Protractor rules for Bazel The Protractor rules run tests under the Protractor framework with Bazel. - ## Installation Add the `@bazel/protractor` npm package to your `devDependencies` in `package.json`. +## Known issues with running Chromium for macOS/Windows in Bazel + +For macOS and Windows, Chromium comes with files that contain spaces in their file names. This breaks runfile tree +creation within Bazel due to a bug. There are various workarounds that allow for Chromium on these platforms: + +* Instruct Bazel to automatically disable runfile tree creation if not needed. [More details here](https://github.com/bazelbuild/bazel/issues/4327#issuecomment-922106293) +* Instruct Bazel to use an alternative experimental approach for creating runfile trees. [More details here](https://github.com/bazelbuild/bazel/issues/4327#issuecomment-627422865) ## protractor_web_test @@ -96,7 +97,7 @@ Defaults to `["@npm//@bazel/protractor", "@npm//protractor"]` A label providing the protractor entry point Default to `:node_modules/protractor/bin/protractor`. -Defaults to `"@npm//:node_modules/protractor/bin/protractor"` +Defaults to `Label("@npm//:node_modules/protractor/bin/protractor")`

kwargs

@@ -105,7 +106,6 @@ passed through to `protractor_web_test` - ## protractor_web_test_suite **USAGE** diff --git a/docs/Providers.md b/docs/Providers.md new file mode 100755 index 0000000000..047a0ff3c9 --- /dev/null +++ b/docs/Providers.md @@ -0,0 +1,285 @@ + + +Public providers, aspects and helpers that are shipped in the built-in build_bazel_rules_nodejs repository. + +Note that many providers have moved to the rules_nodejs "core" package. See [Core API doc](./Core.md) + +Users should not load files under "/internal" + + +## ExternalNpmPackageInfo + +**USAGE** + +
+ExternalNpmPackageInfo(direct_sources, path, sources, workspace)
+
+ +Provides information about one or more external npm packages + +**FIELDS** + +

direct_sources

+ + Depset of direct source files in these external npm package(s) +

path

+ + The local workspace path that these external npm deps should be linked at. If empty, they will be linked at the root. +

sources

+ + Depset of direct & transitive source files in these external npm package(s) and transitive dependencies +

workspace

+ + The workspace name that these external npm package(s) are provided from + + +## JSEcmaScriptModuleInfo + +**USAGE** + +
+JSEcmaScriptModuleInfo(direct_sources, sources)
+
+ +JavaScript files (and sourcemaps) that are intended to be consumed by downstream tooling. + +They should use modern syntax and ESModules. +These files should typically be named "foo.mjs" + +Historical note: this was the typescript.es6_sources output + +**FIELDS** + +

direct_sources

+ + Depset of direct JavaScript files and sourcemaps +

sources

+ + Depset of direct and transitive JavaScript files and sourcemaps + + +## JSNamedModuleInfo + +**USAGE** + +
+JSNamedModuleInfo(direct_sources, sources)
+
+ +JavaScript files whose module name is self-contained. + +For example named AMD/UMD or goog.module format. +These files can be efficiently served with the concatjs bundler. +These outputs should be named "foo.umd.js" +(note that renaming it from "foo.js" doesn't affect the module id) + +Historical note: this was the typescript.es5_sources output. + + +**FIELDS** + +

direct_sources

+ + Depset of direct JavaScript files and sourcemaps +

sources

+ + Depset of direct and transitive JavaScript files and sourcemaps + + +## NodeRuntimeDepsInfo + +**USAGE** + +
+NodeRuntimeDepsInfo(deps, pkgs)
+
+ +Stores runtime dependencies of a nodejs_binary or nodejs_test + +These are files that need to be found by the node module resolver at runtime. + +Historically these files were passed using the Runfiles mechanism. +However runfiles has a big performance penalty of creating a symlink forest +with FS API calls for every file in node_modules. +It also causes there to be separate node_modules trees under each binary. This +prevents user-contributed modules passed as deps[] to a particular action from +being found by node module resolver, which expects everything in one tree. + +In node, this resolution is done dynamically by assuming a node_modules +tree will exist on disk, so we assume node actions/binary/test executions will +do the same. + + +**FIELDS** + +

deps

+ + depset of runtime dependency labels +

pkgs

+ + list of labels of packages that provide ExternalNpmPackageInfo + + +## NpmPackageInfo + +**USAGE** + +
+NpmPackageInfo(direct_sources, path, sources, workspace)
+
+ +Provides information about one or more external npm packages + +**FIELDS** + +

direct_sources

+ + Depset of direct source files in these external npm package(s) +

path

+ + The local workspace path that these external npm deps should be linked at. If empty, they will be linked at the root. +

sources

+ + Depset of direct & transitive source files in these external npm package(s) and transitive dependencies +

workspace

+ + The workspace name that these external npm package(s) are provided from + + +## js_ecma_script_module_info + +**USAGE** + +
+js_ecma_script_module_info(sources, deps)
+
+ +Constructs a JSEcmaScriptModuleInfo including all transitive sources from JSEcmaScriptModuleInfo providers in a list of deps. + +Returns a single JSEcmaScriptModuleInfo. + +**PARAMETERS** + + +

sources

+ + + + +

deps

+ + +Defaults to `[]` + + +## js_named_module_info + +**USAGE** + +
+js_named_module_info(sources, deps)
+
+ +Constructs a JSNamedModuleInfo including all transitive sources from JSNamedModuleInfo providers in a list of deps. + +Returns a single JSNamedModuleInfo. + +**PARAMETERS** + + +

sources

+ + + + +

deps

+ + +Defaults to `[]` + + +## run_node + +**USAGE** + +
+run_node(ctx, inputs, arguments, executable, chdir, kwargs)
+
+ +Helper to replace ctx.actions.run + +This calls node programs with a node_modules directory in place + + +**PARAMETERS** + + +

ctx

+ +rule context from the calling rule implementation function + + + +

inputs

+ +list or depset of inputs to the action + + + +

arguments

+ +list or ctx.actions.Args object containing arguments to pass to the executable + + + +

executable

+ +stringy representation of the executable this action will run, eg eg. "my_executable" rather than ctx.executable.my_executable + + + +

chdir

+ +directory we should change to be the working dir + +Defaults to `None` + +

kwargs

+ +all other args accepted by ctx.actions.run + + + + +## node_modules_aspect + +**USAGE** + +
+node_modules_aspect(name)
+
+ + + +**ASPECT ATTRIBUTES** + +

deps

+ +**ATTRIBUTES** + +

name

+ +(*Name, {util.mandatoryString(name: "name" +doc_string: "A unique name for this target." +type: NAME +mandatory: true +)}*) + A unique name for this target. + + + diff --git a/docs/README.md b/docs/README.md index 6bde22ba32..8c0174266c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,21 +1,3 @@ -# Developing on the docsite - -Running locally can be done with Jekyll via bazel. -Follow setup instructions at https://help.github.com/en/articles/setting-up-your-github-pages-site-locally-with-jekyll - -You'll also need the `jekyll-toc` gem installed - -To build and update the docs in the `/docs` folder, run - -```sh -$ yarn stardoc -``` - -To serve the docsite locally, use -```sh -$ bazel run --noincompatible_strict_action_env //docs -``` - # Authoring the docsite The docsite is a mix of stardoc generated markdown and hand written markdown. @@ -30,5 +12,3 @@ The files marked with ``` Should be edited by modifying the docs in the source `.bzl` files. -If updating css, then the `scss` in `/docs/css` should be edited. -The HTML files in `/docs` are also generated and should not be edited directly, other files can be freely edited. diff --git a/docs/Rollup.html b/docs/Rollup.html deleted file mode 100755 index c38ab04493..0000000000 --- a/docs/Rollup.html +++ /dev/null @@ -1,675 +0,0 @@ - - - - - - - - - - rules_nodejs - Rollup - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

Rollup rules for Bazel

- -

The Rollup rules run the rollup.js bundler with Bazel.

- -

Installation

- -

Add the @bazel/rollup npm package to your devDependencies in package.json. (rollup itself should also be included in devDependencies, unless you plan on providing it via a custom target.)

- -

Installing with user-managed dependencies

- -

If you didn’t use the yarn_install or npm_install rule, you’ll have to declare a rule in your root BUILD.bazel file to execute rollup:

- -
# Create a rollup rule to use in rollup_bundle#rollup_bin
-# attribute when using user-managed dependencies
-nodejs_binary(
-    name = "rollup_bin",
-    entry_point = "//:node_modules/rollup/bin/rollup",
-    # Point bazel to your node_modules to find the entry point
-    data = ["//:node_modules"],
-)
-
- -

Usage

- -

The rollup_bundle rule is used to invoke Rollup on some JavaScript inputs. -The API docs appear below.

- -

Typical example:

-
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
-
-rollup_bundle(
-    name = "bundle",
-    srcs = ["dependency.js"],
-    entry_point = "input.js",
-    config_file = "rollup.config.js",
-)
-
- -

Note that the command-line options set by Bazel override what appears in the rollup config file. -This means that typically a single rollup.config.js can contain settings for your whole repo, -and multiple rollup_bundle rules can share the configuration.

- -

Thus, setting options that Bazel controls will have no effect, e.g.

- -
module.exports = {
-    output: { file: 'this_is_ignored.js' },
-}
-
- -

Output types

- -

You must determine ahead of time whether Rollup will write a single file or a directory. -Rollup’s CLI has the same behavior, forcing you to pick --output.file or --output.dir.

- -

Writing a directory is used when you have dynamic imports which cause code-splitting, or if you -provide multiple entry points. Use the output_dir attribute to specify that you want a -directory output.

- -

Each rollup_bundle rule produces only one output by running the rollup CLI a single time. -To get multiple output formats, you can wrap the rule with a macro or list comprehension, e.g.

- -
[
-    rollup_bundle(
-        name = "bundle.%s" % format,
-        entry_point = "foo.js",
-        format = format,
-    )
-    for format in [
-        "cjs",
-        "umd",
-    ]
-]
-
- -

This will produce one output per requested format.

- -

Stamping

- -

You can stamp the current version control info into the output by writing some code in your rollup config. -See the stamping documentation.

- -

By passing the --stamp option to Bazel, two additional input files will be readable by Rollup.

- -
    -
  1. The variable bazel_version_file will point to bazel-out/volatile-status.txt which contains -statuses that change frequently; such changes do not cause a re-build of the rollup_bundle.
  2. -
  3. The variable bazel_info_file will point to bazel-out/stable-status.txt file which contains -statuses that stay the same; any changed values will cause rollup_bundle to rebuild.
  4. -
- -

Both bazel_version_file and bazel_info_file will be undefined if the build is run without --stamp.

- -
-

Note that under --stamp, only the bundle is re-built, but not the compilation steps that produced the inputs. -This avoids a slow cascading re-build of a whole tree of actions.

-
- -

To use these files, you write JS code in your rollup.config.js to read from the status files and parse the lines. -Each line is a space-separated key/value pair.

- -
/**
-* The status files are expected to look like
-* BUILD_SCM_HASH 83c699db39cfd74526cdf9bebb75aa6f122908bb
-* BUILD_SCM_LOCAL_CHANGES true
-* STABLE_BUILD_SCM_VERSION 6.0.0-beta.6+12.sha-83c699d.with-local-changes
-* BUILD_TIMESTAMP 1520021990506
-*
-* Parsing regex is created based on Bazel's documentation describing the status file schema:
-*   The key names can be anything but they may only use upper case letters and underscores. The
-*   first space after the key name separates it from the value. The value is the rest of the line
-*   (including additional whitespaces).
-*
-* @param {string} p the path to the status file
-* @returns a two-dimensional array of key/value pairs
-*/
-function parseStatusFile(p) {
-  if (!p) return [];
-  const results = {};
-  const statusFile = require('fs').readFileSync(p, {encoding: 'utf-8'});
-  for (const match of `\n${statusFile}`.matchAll(/^([A-Z_]+) (.*)/gm)) {
-    // Lines which go unmatched define an index value of `0` and should be skipped.
-    if (match.index === 0) {
-      continue;
-    }
-    results[match[1]] = match[2];
-  }
-  return results;
-}
-
-const statuses = parseStatusFile(bazel_version_file);
-// Parse the stamp file produced by Bazel from the version control system
-let version = '<unknown>';
-// Don't assume BUILD_SCM_VERSION exists
-if (statuses['BUILD_SCM_VERSION']) {
-  version = 'v' + statuses['BUILD_SCM_VERSION'];
-  if (DEBUG) {
-    version += '_debug';
-  }
-}
-
- -

Debug and Opt builds

- -

When you use --compilation_mode=dbg, Bazel produces a distinct output-tree in bazel-out/[arch]-dbg/bin. -Code in your rollup.config.js can look in the environment to detect if a debug build is being performed, -and include extra developer information in the bundle that you wouldn’t normally ship to production.

- -

Similarly, --compilation_mode=opt is Bazel’s signal to perform extra optimizations. -You could use this value to perform extra production-only optimizations.

- -

For example you could define a constant for enabling Debug:

- -
const DEBUG = process.env['COMPILATION_MODE'] === 'dbg';
-
- -

and configure Rollup differently when DEBUG is true or false.

- -

Increasing Heap memory for rollup

- -

The rollup_bin attribute allows you to customize the rollup.js program we execute, -so you can use nodejs_binary to construct your own.

- -
-

You can always call bazel query --output=build [default rollup_bin] to see what -the default definition looks like, then copy-paste from there to be sure yours -matches.

-
- -
nodejs_binary(
-    name = "rollup_more_mem",
-    data = ["@npm//rollup:rollup"],
-    entry_point = "@npm//:node_modules/rollup/dist/bin/rollup",
-    templated_args = [
-        "--node_options=--max-old-space-size=<SOME_SIZE>",
-    ],
-)
-
-rollup_bundle(
-    ...
-    rollup_bin = ":rollup_more_mem",
-)
-
- -

rollup_bundle

- -

USAGE

- -
-rollup_bundle(name, args, config_file, deps, entry_point, entry_points, format, link_workspace_root,
-              node_context_data, output_dir, rollup_bin, rollup_worker_bin, silent, sourcemap, srcs,
-              supports_workers)
-
- -

Runs the rollup.js CLI under Bazel.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

args

- -

(List of strings): Command line arguments to pass to Rollup. Can be used to override config file settings.

- -

These argument passed on the command line before arguments that are added by the rule. -Run bazel with --subcommands to see what Rollup CLI command line was invoked.

- -

See the Rollup CLI docs for a complete list of supported arguments.

- -

Defaults to []

- -

config_file

- -

(Label): A rollup.config.js file

- -

Passed to the --config option, see the config doc

- -

If not set, a default basic Rollup config is used.

- -

Defaults to @npm//@bazel/rollup:rollup.config.js

- -

deps

- -

(List of labels): Other libraries that are required by the code, or by the rollup.config.js

- -

Defaults to []

- -

entry_point

- -

(Label): The bundle’s entry point (e.g. your main.js or app.js or index.js).

- -

This is just a shortcut for the entry_points attribute with a single output chunk named the same as the rule.

- -

For example, these are equivalent:

- -
rollup_bundle(
-    name = "bundle",
-    entry_point = "index.js",
-)
-
- -
rollup_bundle(
-    name = "bundle",
-    entry_points = {
-        "index.js": "bundle"
-    }
-)
-
- -

If rollup_bundle is used on a ts_library, the rollup_bundle rule handles selecting the correct outputs from ts_library. -In this case, entry_point can be specified as the .ts file and rollup_bundle will handle the mapping to the .mjs output file.

- -

For example:

- -
ts_library(
-    name = "foo",
-    srcs = [
-        "foo.ts",
-        "index.ts",
-    ],
-)
-
-rollup_bundle(
-    name = "bundle",
-    deps = [ "foo" ],
-    entry_point = "index.ts",
-)
-
- -

Defaults to None

- -

entry_points

- -

(Dictionary: Label -> String): The bundle’s entry points (e.g. your main.js or app.js or index.js).

- -

Passed to the --input option in Rollup.

- -

Keys in this dictionary are labels pointing to .js entry point files. -Values are the name to be given to the corresponding output chunk.

- -

Either this attribute or entry_point must be specified, but not both.

- -

Defaults to {}

- -

format

- -

(String): 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
  • -
- -

Defaults to "esm"

- - - -

(Boolean): Link the workspace root to the bin_dir to support absolute requires like β€˜my_wksp/path/to/file’. -If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

- -

Defaults to False

- -

node_context_data

- -

(Label): Provides info about the build context, such as stamping.

- -

By default it reads from the bazel command line, such as the --stamp argument. -Use this to override values for this target, such as enabling or disabling stamping. -You can use the node_context_data rule in @build_bazel_rules_nodejs//internal/node:context.bzl -to create a NodeContextInfo. The dependencies of this attribute must provide: NodeContextInfo

- -

Defaults to @build_bazel_rules_nodejs//internal:node_context_data

- -

output_dir

- -

(Boolean): Whether to produce a directory output.

- -

We will use the --output.dir option in rollup -rather than --output.file.

- -

If the program produces multiple chunks, you must specify this attribute. -Otherwise, the outputs are assumed to be a single file.

- -

Defaults to False

- -

rollup_bin

- -

(Label): Target that executes the rollup binary

- -

Defaults to @npm//rollup/bin:rollup

- -

rollup_worker_bin

- -

(Label): Internal use only

- -

Defaults to @npm//@bazel/rollup/bin:rollup-worker

- -

silent

- -

(Boolean): Whether to execute the rollup binary with the –silent flag, defaults to False.

- -

Using –silent can cause rollup to ignore errors/warnings -which are only surfaced via logging. Since bazel expects printing nothing on success, setting silent to True -is a more Bazel-idiomatic experience, however could cause rollup to drop important warnings.

- -

Defaults to False

- -

sourcemap

- -

(String): Whether to produce sourcemaps.

- -

Passed to the --sourcemap option in Rollup

- -

Defaults to "inline"

- -

srcs

- -

(List of labels): Non-entry point JavaScript source files from the workspace.

- -

You must not repeat file(s) passed to entry_point/entry_points.

- -

Defaults to []

- -

supports_workers

- -

(Boolean): Experimental! Use only with caution.

- -

Allows you to enable the Bazel Worker strategy for this library. -When enabled, this rule invokes the β€œrollup_worker_bin” -worker aware binary rather than β€œrollup_bin”.

- -

Defaults to False

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Rollup.md b/docs/Rollup.md index a6ac5d56ad..ef03f252a4 100755 --- a/docs/Rollup.md +++ b/docs/Rollup.md @@ -1,25 +1,18 @@ ---- -title: Rollup -layout: default -toc: true -nav: rule ---- + # Rollup rules for Bazel The Rollup rules run the [rollup.js](https://rollupjs.org/) bundler with Bazel. - ## Installation Add the `@bazel/rollup` npm package to your `devDependencies` in `package.json`. (`rollup` itself should also be included in `devDependencies`, unless you plan on providing it via a custom target.) - ### Installing with user-managed dependencies If you didn't use the `yarn_install` or `npm_install` rule, you'll have to declare a rule in your root `BUILD.bazel` file to execute rollup: @@ -35,7 +28,6 @@ nodejs_binary( ) ``` - ## Usage The `rollup_bundle` rule is used to invoke Rollup on some JavaScript inputs. @@ -65,7 +57,6 @@ module.exports = { } ``` - ### Output types You must determine ahead of time whether Rollup will write a single file or a directory. @@ -94,7 +85,6 @@ To get multiple output formats, you can wrap the rule with a macro or list compr This will produce one output per requested format. - ### Stamping You can stamp the current version control info into the output by writing some code in your rollup config. @@ -135,7 +125,8 @@ function parseStatusFile(p) { if (!p) return []; const results = {}; const statusFile = require('fs').readFileSync(p, {encoding: 'utf-8'}); - for (const match of `\n${statusFile}`.matchAll(/^([A-Z_]+) (.*)/gm)) { + for (const match of ` +${statusFile}`.matchAll(/^([A-Z_]+) (.*)/gm)) { // Lines which go unmatched define an index value of `0` and should be skipped. if (match.index === 0) { continue; @@ -145,6 +136,7 @@ function parseStatusFile(p) { return results; } +// This undefined variable will be replaced with the full path during the build. const statuses = parseStatusFile(bazel_version_file); // Parse the stamp file produced by Bazel from the version control system let version = ''; @@ -157,7 +149,6 @@ if (statuses['BUILD_SCM_VERSION']) { } ``` - ### Debug and Opt builds When you use `--compilation_mode=dbg`, Bazel produces a distinct output-tree in `bazel-out/[arch]-dbg/bin`. @@ -175,7 +166,6 @@ const DEBUG = process.env['COMPILATION_MODE'] === 'dbg'; and configure Rollup differently when `DEBUG` is `true` or `false`. - ### Increasing Heap memory for rollup The `rollup_bin` attribute allows you to customize the rollup.js program we execute, @@ -208,8 +198,8 @@ rollup_bundle(
 rollup_bundle(name, args, config_file, deps, entry_point, entry_points, format, link_workspace_root,
-              node_context_data, output_dir, rollup_bin, rollup_worker_bin, silent, sourcemap, srcs,
-              supports_workers)
+              output_dir, rollup_bin, rollup_worker_bin, silent, silent_on_success, sourcemap, srcs,
+              stamp, supports_workers)
 
Runs the rollup.js CLI under Bazel. @@ -329,18 +319,6 @@ If source files need to be required then they can be copied to the bin_dir with Defaults to `False` -

node_context_data

- -(*Label*): Provides info about the build context, such as stamping. - -By default it reads from the bazel command line, such as the `--stamp` argument. -Use this to override values for this target, such as enabling or disabling stamping. -You can use the `node_context_data` rule in `@build_bazel_rules_nodejs//internal/node:context.bzl` -to create a NodeContextInfo. The dependencies of this attribute must provide: NodeContextInfo - - -Defaults to `@build_bazel_rules_nodejs//internal:node_context_data` -

output_dir

(*Boolean*): Whether to produce a directory output. @@ -369,12 +347,21 @@ Defaults to `@npm//@bazel/rollup/bin:rollup-worker` (*Boolean*): Whether to execute the rollup binary with the --silent flag, defaults to False. -Using --silent can cause rollup to [ignore errors/warnings](https://github.com/rollup/rollup/blob/master/docs/999-big-list-of-options.md#onwarn) +Using --silent can cause rollup to [ignore errors/warnings](https://github.com/rollup/rollup/blob/master/docs/999-big-list-of-options.md#onwarn) which are only surfaced via logging. Since bazel expects printing nothing on success, setting silent to True is a more Bazel-idiomatic experience, however could cause rollup to drop important warnings. Defaults to `False` +

silent_on_success

+ +(*Boolean*): Even stronger than --silent, defaults to False. + +Since the build still emits some texted, even when passed --silent, this uses the same flag as npm_package_bin to +supress all output on sucess. + +Defaults to `False` +

sourcemap

(*String*): Whether to produce sourcemaps. @@ -391,6 +378,23 @@ You must not repeat file(s) passed to entry_point/entry_points. Defaults to `[]` +

stamp

+ +(*Label*): Whether to encode build information into the output. Possible values: + - `@rules_nodejs//nodejs/stamp:always`: + Always stamp the build information into the output, even in [--nostamp][stamp] builds. + This setting should be avoided, since it potentially causes cache misses remote caching for + any downstream actions that depend on it. + - `@rules_nodejs//nodejs/stamp:never`: + Always replace build information by constant values. This gives good build result caching. + - `@rules_nodejs//nodejs/stamp:use_stamp_flag`: + Embedding of build information is controlled by the [--[no]stamp][stamp] flag. + Stamped binaries are not rebuilt unless their dependencies change. + [stamp]: https://docs.bazel.build/versions/main/user-manual.html#flag--stamp The dependencies of this attribute must provide: StampSettingInfo + + +Defaults to `@rules_nodejs//nodejs/stamp:use_stamp_flag` +

supports_workers

(*Boolean*): Experimental! Use only with caution. diff --git a/docs/Terser.html b/docs/Terser.html deleted file mode 100755 index 22abc373c5..0000000000 --- a/docs/Terser.html +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - - - rules_nodejs - Terser - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

Terser rules for Bazel

- -

The Terser rules run the Terser JS minifier with Bazel.

- -

Wraps the Terser CLI documented at https://github.com/terser-js/terser#command-line-usage

- -

Installation

- -

Add the @bazel/terser npm package to your devDependencies in package.json.

- -

Installing with user-managed dependencies

- -

If you didn’t use the yarn_install or npm_install rule, you’ll have to declare a rule in your root BUILD.bazel file to execute terser:

- -
# Create a terser rule to use in terser_minified#terser_bin
-# attribute when using user-managed dependencies
-nodejs_binary(
-    name = "terser_bin",
-    entry_point = "//:node_modules/terser/bin/uglifyjs",
-    # Point bazel to your node_modules to find the entry point
-    data = ["//:node_modules"],
-)
-
- -

terser_minified

- -

USAGE

- -
-terser_minified(name, args, config_file, debug, sourcemap, src, terser_bin)
-
- -

Run the terser minifier.

- -

Typical example:

-
load("@npm//@bazel/terser:index.bzl", "terser_minified")
-
-terser_minified(
-    name = "out.min",
-    src = "input.js",
-    config_file = "terser_config.json",
-)
-
- -

Note that the name attribute determines what the resulting files will be called. -So the example above will output out.min.js and out.min.js.map (since sourcemap defaults to true). -If the input is a directory, then the output will also be a directory, named after the name attribute. -Note that this rule is NOT recursive. It assumes a flat file structure. Passing in a folder with nested folder -will result in an empty output directory.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

args

- -

(List of strings): Additional command line arguments to pass to terser.

- -

Terser only parses minify() args from the config file so additional arguments such as --comments may -be passed to the rule using this attribute. See https://github.com/terser/terser#command-line-usage for the -full list of terser CLI options.

- -

Defaults to []

- -

config_file

- -

(Label): 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.

- -

Bazel will make a copy of your config file, treating it as a template.

- -

Run bazel with --subcommands to see the path to the copied file.

- -

If you use the magic strings "bazel_debug" or "bazel_no_debug", these will be -replaced with true and false respecting the value of the debug attribute -or the --compilation_mode=dbg bazel flag.

- -

For example

- -
{
-    "compress": {
-        "arrows": "bazel_no_debug"
-    }
-}
-
- -

Will disable the arrows compression setting when debugging.

- -

If config_file isn’t supplied, Bazel will use a default config file.

- -

Defaults to @npm//@bazel/terser:terser_config.default.json

- -

debug

- -

(Boolean): Configure terser to produce more readable output.

- -

Instead of setting this attribute, consider using debugging compilation mode instead -bazel build –compilation_mode=dbg //my/terser:target -so that it only affects the current build.

- -

Defaults to False

- -

sourcemap

- -

(Boolean): Whether to produce a .js.map output

- -

Defaults to True

- -

src

- -

(Label, mandatory): File(s) to minify.

- -

Can be a .js file, a rule producing .js files as its default output, or a rule producing a directory of .js files.

- -

Note that you can pass multiple files to terser, which it will bundle together. -If you want to do this, you can pass a filegroup here.

- -

terser_bin

- -

(Label): An executable target that runs Terser

- -

Defaults to @npm//@bazel/terser/bin:terser

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/Terser.md b/docs/Terser.md index d44a882f48..edbbe945e5 100755 --- a/docs/Terser.md +++ b/docs/Terser.md @@ -1,27 +1,20 @@ ---- -title: Terser -layout: default -toc: true -nav: rule ---- + # Terser rules for Bazel The Terser rules run the Terser JS minifier with Bazel. Wraps the Terser CLI documented at https://github.com/terser-js/terser#command-line-usage - ## Installation Add the `@bazel/terser` npm package to your `devDependencies` in `package.json`. - ## Installing with user-managed dependencies If you didn't use the `yarn_install` or `npm_install` rule, you'll have to declare a rule in your root `BUILD.bazel` file to execute terser: @@ -38,7 +31,6 @@ nodejs_binary( ``` - ## terser_minified **USAGE** diff --git a/docs/Toolchains.md b/docs/Toolchains.md new file mode 100644 index 0000000000..b7626f7eca --- /dev/null +++ b/docs/Toolchains.md @@ -0,0 +1,251 @@ + +# Toolchains + +API docs for [Toolchain](https://docs.bazel.build/versions/main/toolchains.html) support. + +When you call `nodejs_register_toolchains()` in your `WORKSPACE` file it will setup a node toolchain for executing tools on all currently supported platforms. + +If you have an advanced use-case and want to use a version of node not supported by this repository, you can also register your own toolchains. + +## Node.js binary for the target platform + +Sometimes your target platform (where your software runs) is different from the host platform (where you run Bazel) or execution platform (where Bazel actions run). +The most common case is developing a docker image on MacOS, which will execute in a Linux container. + +Our toolchain support is conditional on the execution platform, as it's meant for running nodejs tools during the build. +It is not needed for this use case. Instead, simply select the nodejs you want to include in the runtime. + +For example, rules_docker has a `nodejs_image` rule, which takes a `node_repository_name` attribute indicating +which nodejs binary you want to include in the image. `nodejs_linux_amd64` is the value you'd use. + +## Cross-compilation + +Bazel Toolchains are intended to support cross-compilation, e.g. building a linux binary from mac or windows. +Most JavaScript use cases produce platform-independent code, +but the exception is native modules which use [node-gyp](https://github.com/nodejs/node-gyp). +Any native modules will still be fetched and built, by npm/yarn, for your host platform, +so they will not work on the target platform. +The workaround is to perform the npm_install inside a docker container so that it produces modules for the target platform. + +Follow https://github.com/bazelbuild/rules_nodejs/issues/506 for updates on support for node-gyp cross-compilation. + +## Registering a custom toolchain + +To run a custom toolchain (i.e., to run a node binary not supported by the built-in toolchains), you'll need four things: + +1) A rule which can build or load a node binary from your repository + (a checked-in binary or a build using a relevant [`rules_foreign_cc` build rule](https://bazelbuild.github.io/rules_foreign_cc/) will do nicely). +2) A [`node_toolchain` rule](Core.html#node_toolchain) which depends on your binary defined in step 1 as its `target_tool`. +3) A [`toolchain` rule](https://bazel.build/reference/be/platform#toolchain) that depends on your `node_toolchain` rule defined in step 2 as its `toolchain` + and on `@rules_nodejs//nodejs:toolchain_type` as its `toolchain_type`. Make sure to define appropriate platform restrictions as described in the + documentation for the `toolchain` rule. +4) A call to [the `register_toolchains` function](https://bazel.build/rules/lib/globals#register_toolchains) in your `WORKSPACE` + that refers to the `toolchain` rule defined in step 3. + +Examples of steps 2-4 can be found in the [documentation for `node_toolchain`](Core.html#node_toolchain). + +If necessary, you can substitute building the node binary as part of the build with using a locally installed version by skipping step 1 and replacing step 2 with: + +2) A `node_toolchain` rule which has the path of the system binary as its `target_tool_path` + + +## cypress_toolchain + +**USAGE** + +
+cypress_toolchain(name, cypress_bin, cypress_bin_path, cypress_files)
+
+ +Defines a cypress toolchain. + +For usage see https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains. + + +**ATTRIBUTES** + + +

name

+ +(*Name, mandatory*): A unique name for this target. + + +

cypress_bin

+ +(*Label*): A hermetically downloaded cypress executable binary for the target platform. + +Defaults to `None` + +

cypress_bin_path

+ +(*String*): Path to an existing cypress executable for the target platform. + +Defaults to `""` + +

cypress_files

+ +(*Label*): A hermetically downloaded cypress filegroup of all cypress binary files for the target platform. Must be set when cypress_bin is set. + +Defaults to `None` + + +## configure_esbuild_toolchains + +**USAGE** + +
+configure_esbuild_toolchains(name, platforms)
+
+ +Configures esbuild toolchains for a list of supported platforms + +**PARAMETERS** + + +

name

+ +unused + +Defaults to `""` + +

platforms

+ +dict of platforms to configure toolchains for + +Defaults to `{}` + + +## cypress_repositories + +**USAGE** + +
+cypress_repositories(name, version, linux_urls, linux_sha256, darwin_urls, darwin_sha256,
+                     darwin_arm64_urls, darwin_arm64_sha256, windows_urls, windows_sha256)
+
+ + Repository rule used to install cypress binary. + +**PARAMETERS** + + +

name

+ +Name of the external workspace where the cypress binary lives + + + +

version

+ +Version of cypress binary to use. Should match package.json + + + +

linux_urls

+ +(Optional) URLs at which the cypress binary for linux distros of linux can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used. + +Defaults to `[]` + +

linux_sha256

+ +(Optional) SHA-256 of the linux cypress binary + +Defaults to `""` + +

darwin_urls

+ +(Optional) URLs at which the cypress binary for darwin can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used. + +Defaults to `[]` + +

darwin_sha256

+ +(Optional) SHA-256 of the darwin cypress binary + +Defaults to `""` + +

darwin_arm64_urls

+ +(Optional) URLs at which the cypress binary for darwin arm64 can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used (note: as of this writing (11/2021), Cypress does not have native arm64 builds, and this URL will link to the x86_64 build to run under Rosetta). + +Defaults to `[]` + +

darwin_arm64_sha256

+ +(Optional) SHA-256 of the darwin arm64 cypress binary + +Defaults to `""` + +

windows_urls

+ +(Optional) URLs at which the cypress binary for windows distros of linux can be downloaded. If omitted, https://cdn.cypress.io/desktop will be used. + +Defaults to `[]` + +

windows_sha256

+ +(Optional) SHA-256 of the windows cypress binary + +Defaults to `""` + + +## esbuild_repositories + +**USAGE** + +
+esbuild_repositories(npm_repository, name, npm_args, kwargs)
+
+ +Helper for fetching and setting up the esbuild versions and toolchains + +This uses Bazel's downloader (via `http_archive`) to fetch the esbuild package +from npm, separately from any `npm_install`/`yarn_install` in your WORKSPACE. +To configure where the download is from, you make a file containing a rewrite rule like + + rewrite (registry.nodejs.org)/(.*) artifactory.build.internal.net/artifactory/$1/$2 + +You can find some documentation on the rewrite patterns in the Bazel sources: +[UrlRewriterConfig.java](https://github.com/bazelbuild/bazel/blob/4.2.1/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/UrlRewriterConfig.java#L66) + +Then use the `--experimental_downloader_config` Bazel option to point to your file. +For example if you created `.bazel_downloader_config` you might add to your `.bazelrc` file: + + common --experimental_downloader_config=.bazel_downloader_config + + +**PARAMETERS** + + +

npm_repository

+ +the name of the repository where the @bazel/esbuild package is installed +by npm_install or yarn_install. + + + +

name

+ +currently unused + +Defaults to `""` + +

npm_args

+ +additional args to pass to the npm install rule + +Defaults to `[]` + +

kwargs

+ +additional named parameters to the npm_install rule + + + + diff --git a/docs/TypeScript.html b/docs/TypeScript.html deleted file mode 100755 index de352fa5ab..0000000000 --- a/docs/TypeScript.html +++ /dev/null @@ -1,1051 +0,0 @@ - - - - - - - - - - rules_nodejs - TypeScript - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

TypeScript rules for Bazel

- -

The TypeScript rules integrate the TypeScript compiler with Bazel.

- -

Alternatives

- -

This package provides Bazel wrappers around the TypeScript compiler.

- -

At a high level, there are three alternatives provided: tsc, ts_project, ts_library. -This section describes the trade-offs between these rules.

- -

tsc

- -

tsc is the TypeScript compiler published by the team at Microsoft. -You can call it without any custom Bazel rules.

- -

To use this option, you do not need to install the @bazel/typescript package.

- -

The only reason to use raw tsc is if you want to compile a directory of .ts files and cannot enumerate them ahead-of-time in your BUILD file so that Bazel can predict all the output files. -(For example if the .ts files are generated by some tool). -This will produce an opaque directory of .js file outputs, which you won’t be able to individually reference.

- -

Any other use case for tsc is better served by using ts_project, see below.

- -

Like we do for any npm package that exposes a binary, rules_nodejs will see your dependency on -typescript and will generate an index.bzl file allowing you to run tsc. -To use it, add the load statement load("@npm//typescript:index.bzl", "tsc") to your BUILD file. -(Possibly replacing @npm with the name of the repository where you installed dependencies)

- -

Then call it, using the npm_package_bin documentation.

- -

Here is an example: -https://github.com/bazelbuild/rules_nodejs/blob/3.2.2/internal/node/test/BUILD.bazel#L491-L507

- -

ts_project

- -

ts_project simply runs tsc --project, with Bazel knowing which outputs to expect based on the TypeScript compiler options, -and with interoperability with other TypeScript rules via the DeclarationInfo Provider that transmits the type information.

- -

It is intended as an easy on-boarding for existing TypeScript code and should be familiar if your background is in frontend ecosystem idioms.

- -

Any behavior of ts_project should be reproducible outside of Bazel, with a couple of caveats noted in the rule documentation below.

- -

ts_project is recommended for all new code.

- -

Exhaustive examples of calling ts_project are in the test suite: -https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project

- -

And there are also many uses of it in our

- -

ts_library

- -

ts_library should not be used for new code, and may be deprecated in the future.

- -

ts_library is an open-sourced version of the rule used to compile TS code at Google. -However there is no support from the team that maintains that internal version. -It is very complex, involving code generation of the tsconfig.json file, a custom compiler binary, and a lot of extra features.

- -

It is also opinionated, and may not work with existing TypeScript code. For example:

- -
    -
  • Your TS code must compile under the --declaration flag so that downstream libraries depend only on types, not implementation. This makes Bazel faster by avoiding cascading rebuilds in cases where the types aren’t changed.
  • -
  • We control the output format and module syntax so that downstream rules can rely on them.
  • -
  • Some other options are incompatible. For example you cannot use the --noEmit compiler option in tsconfig.json.
  • -
- -

The only reason to use ts_library for new code is if you are bought-in to using a concatjs bundler, which requires the named AMD module format. This may be faster than other tooling, and this format can be consumed by the Closure Compiler (via integration with tsickle). -However it is very challenging to configure and there is little available support for problems you’ll run into.

- -

Installation

- -

Add a devDependency on @bazel/typescript

- -
$ yarn add -D @bazel/typescript
-# or
-$ npm install --save-dev @bazel/typescript
-
- -

Watch for any peerDependency warnings - we assume you have already installed the typescript package from npm.

- -

Typical Usage

- -

The ts_project rule invokes the TypeScript compiler on one compilation unit, -or β€œlibrary” (generally one directory of source files). In TypeScript terms, this is one β€œProject” -which can use β€œProject References” to break up a large application.

- -

Create a BUILD file next to your sources:

- -
load("@npm//@bazel/typescript:index.bzl", "ts_project")
-
-ts_project(
-    name = "my_code",
-    # glob is a quick way to select all the code,
-    # but has performance penalty in that Bazel must evaluate it.
-    srcs = glob(["*.ts"]),
-    deps = ["//path/to/other:library"],
-)
-
- -

Here, //path/to/other:library is another target in your repo that produces TypeScript typings (for example, another ts_project rule). -Be sure to set the rootDirs in your tsconfig.json as noted below, so that TypeScript can find the .d.ts files produced by that other target.

- -

To use third-party libraries from npm, first install them (likely using npm_install or yarn_install rules) then add those to the deps as well:

- -
ts_project(
-    name = "my_code",
-    srcs = glob(["*.ts"]),
-    deps = [
-      "@npm//@types/node",
-      "@npm//@types/foo",
-      "@npm//somelib",
-      "//path/to/other:library",
-    ],
-)
-
- -

You can also use the @npm//@types grouping target which will include all -packages in the @types scope as dependencies.

- -

To build a ts_library target run:

- -

bazel build //path/to/package:target

- -

Note that the tsconfig.json file used for compilation should be the same one -your editor references, or extends from it, to keep consistent settings for the TypeScript compiler.

- -

Anything you do with TypeScript is possible with ts_project, including json imports, type-checking only, -transpile only, outdir, rootdir, and so on. -See many examples in our test cases: -https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project

- -

ts_config

- -

USAGE

- -
-ts_config(name, deps, src)
-
- -

Allows a tsconfig.json file to extend another file.

- -

Normally, you just give a single tsconfig.json file as the tsconfig attribute -of a ts_library or ts_project rule. However, if your tsconfig.json uses the extends -feature from TypeScript, then the Bazel implementation needs to know about that -extended configuration file as well, to pass them both to the TypeScript compiler.

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

deps

- -

(List of labels): Additional tsconfig.json files referenced via extends

- -

Defaults to []

- -

src

- -

(Label, mandatory): The tsconfig.json file passed to the TypeScript compiler

- -

ts_library

- -

USAGE

- -
-ts_library(name, angular_assets, compiler, data, deps, devmode_module, devmode_target,
-           expected_diagnostics, generate_externs, internal_testing_type_check_dependencies,
-           link_workspace_root, module_name, module_root, prodmode_module, prodmode_target, runtime,
-           runtime_deps, srcs, supports_workers, tsconfig, tsickle_typed, use_angular_plugin)
-
- -

type-check and compile a set of TypeScript sources to JavaScript.

- -

It produces declarations files (.d.ts) which are used for compiling downstream -TypeScript targets and JavaScript for the browser and Closure compiler.

- -

By default, ts_library uses the tsconfig.json file in the workspace root -directory. See the notes about the tsconfig attribute below.

- -

Serving TypeScript for development

- -

ts_library is typically served by the concatjs_devserver rule, documented in the @bazel/concatjs package.

- -

Accessing JavaScript outputs

- -

The default output of the ts_library rule is the .d.ts files. -This is for a couple reasons:

- -
    -
  • help ensure that downstream rules which access default outputs will not require -a cascading re-build when only the implementation changes but not the types
  • -
  • make you think about whether you want the devmode (named UMD) or prodmode outputs
  • -
- -

You can access the JS output by adding a filegroup rule after the ts_library, -for example

- -
ts_library(
-    name = "compile",
-    srcs = ["thing.ts"],
-)
-
-filegroup(
-    name = "thing.js",
-    srcs = ["compile"],
-    # Change to es6_sources to get the 'prodmode' JS
-    output_group = "es5_sources",
-)
-
-my_rule(
-    name = "uses_js",
-    deps = ["thing.js"],
-)
-
- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

angular_assets

- -

(List of labels): Additional files the Angular compiler will need to read as inputs. - Includes .css and .html files

- -

Defaults to []

- -

compiler

- -

(Label): Sets a different TypeScript compiler binary to use for this library. -For example, we use the vanilla TypeScript tsc.js for bootstrapping, -and Angular compilations can replace this with ngc.

- -

The default ts_library compiler depends on the //@bazel/typescript -target which is setup for projects that use bazel managed npm deps and -install the @bazel/typescript npm package.

- -

You can also use a custom compiler to increase the NodeJS heap size used for compilations.

- -

To do this, declare your own binary for running tsc_wrapped, e.g.:

- -
nodejs_binary(
-    name = "tsc_wrapped_bin",
-    entry_point = "@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js",
-    templated_args = [
-        "--node_options=--max-old-space-size=2048",
-    ],
-    data = [
-        "@npm//protobufjs",
-        "@npm//source-map-support",
-        "@npm//tsutils",
-        "@npm//typescript",
-        "@npm//@bazel/typescript",
-    ],
-)
-
- -

then refer to that target in the compiler attribute.

- -

Note that nodejs_binary targets generated by npm_install/yarn_install can include data dependencies -on packages which aren’t declared as dependencies. -For example, if you use tsickle to generate Closure Compiler-compatible JS, -then it needs to be a data dependency of tsc_wrapped so that it can be loaded at runtime.

- -

Defaults to @build_bazel_rules_typescript//internal:tsc_wrapped_bin

- -

data

- -

(List of labels)

- -

Defaults to []

- -

deps

- -

(List of labels): Compile-time dependencies, typically other ts_library targets

- -

Defaults to []

- -

devmode_module

- -

(String): Set the typescript module compiler option for devmode output.

- -

This value will override the module option in the user supplied tsconfig.

- -

Defaults to "umd"

- -

devmode_target

- -

(String): Set the typescript target compiler option for devmode output.

- -

This value will override the target option in the user supplied tsconfig.

- -

Defaults to "es2015"

- -

expected_diagnostics

- -

(List of strings)

- -

Defaults to []

- -

generate_externs

- -

(Boolean)

- -

Defaults to True

- -

internal_testing_type_check_dependencies

- -

(Boolean): Testing only, whether to type check inputs that aren’t srcs.

- -

Defaults to False

- - - -

(Boolean): Link the workspace root to the bin_dir to support absolute requires like β€˜my_wksp/path/to/file’. - If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

- -

Defaults to False

- -

module_name

- -

(String)

- -

Defaults to ""

- -

module_root

- -

(String)

- -

Defaults to ""

- -

prodmode_module

- -

(String): Set the typescript module compiler option for prodmode output.

- -

This value will override the module option in the user supplied tsconfig.

- -

Defaults to "esnext"

- -

prodmode_target

- -

(String): Set the typescript target compiler option for prodmode output.

- -

This value will override the target option in the user supplied tsconfig.

- -

Defaults to "es2015"

- -

runtime

- -

(String)

- -

Defaults to "browser"

- -

runtime_deps

- -

(List of labels) The dependencies of this attribute must provide: JsInfo

- -

Defaults to []

- -

srcs

- -

(List of labels, mandatory): The TypeScript source files to compile.

- -

supports_workers

- -

(Boolean): Intended for internal use only.

- -

Allows you to disable the Bazel Worker strategy for this library. -Typically used together with the β€œcompiler” setting when using a -non-worker aware compiler binary.

- -

Defaults to True

- -

tsconfig

- -

(Label): A tsconfig.json file containing settings for TypeScript compilation. -Note that some properties in the tsconfig are governed by Bazel and will be -overridden, such as target and module.

- -

The default value is set to //:tsconfig.json by a macro. This means you must -either:

- -
    -
  • Have your tsconfig.json file in the workspace root directory
  • -
  • Use an alias in the root BUILD.bazel file to point to the location of tsconfig: - alias(name="tsconfig.json", actual="//path/to:tsconfig-something.json") - and also make the tsconfig.json file visible to other Bazel packages: - exports_files(["tsconfig.json"], visibility = ["//visibility:public"])
  • -
  • Give an explicit tsconfig attribute to all ts_library targets
  • -
- -

Defaults to None

- -

tsickle_typed

- -

(Boolean): If using tsickle, instruct it to translate types to ClosureJS format

- -

Defaults to True

- -

use_angular_plugin

- -

(Boolean): Run the Angular ngtsc compiler under ts_library

- -

Defaults to False

- -

ts_project

- -

USAGE

- -
-ts_project(name, tsconfig, srcs, args, deps, extends, allow_js, declaration, source_map,
-           declaration_map, preserve_jsx, composite, incremental, emit_declaration_only,
-           ts_build_info_file, tsc, typescript_package, typescript_require_path, validate,
-           supports_workers, declaration_dir, out_dir, root_dir, link_workspace_root, kwargs)
-
- -

Compiles one TypeScript project using tsc --project

- -

This is a drop-in replacement for the tsc rule automatically generated for the β€œtypescript” -package, typically loaded from @npm//typescript:index.bzl. Unlike bare tsc, this rule understands -the Bazel interop mechanism (Providers) so that this rule works with others that produce or consume -TypeScript typings (.d.ts files).

- -

Unlike ts_library, this rule is the thinnest possible layer of Bazel interoperability on top -of the TypeScript compiler. It shifts the burden of configuring TypeScript into the tsconfig.json file. -See https://github.com/bazelbuild/rules_nodejs/blob/master/docs/TypeScript.md#alternatives -for more details about the trade-offs between the two rules.

- -

Some TypeScript options affect which files are emitted, and Bazel wants to know these ahead-of-time. -So several options from the tsconfig file must be mirrored as attributes to ts_project. -See https://www.typescriptlang.org/v2/en/tsconfig for a listing of the TypeScript options.

- -

Any code that works with tsc should work with ts_project with a few caveats:

- -
    -
  • Bazel requires that the outDir (and declarationDir) be set to -bazel-out/[target architecture]/bin/path/to/package -so we override whatever settings appear in your tsconfig.
  • -
  • Bazel expects that each output is produced by a single rule. -Thus if you have two ts_project rules with overlapping sources (the same .ts file -appears in more than one) then you get an error about conflicting .js output -files if you try to build both together. -Worse, if you build them separately then the output directory will contain whichever -one you happened to build most recently. This is highly discouraged.
  • -
- -
-

Note: in order for TypeScript to resolve relative references to the bazel-out folder, -we recommend that the base tsconfig contain a rootDirs section that includes all -possible locations they may appear.

- -

We hope this will not be needed in some future release of TypeScript. -Follow https://github.com/microsoft/TypeScript/issues/37257 for more info.

- -

For example, if the base tsconfig file relative to the workspace root is -path/to/tsconfig.json then you should configure like:

- -
"compilerOptions": {
-    "rootDirs": [
-        ".",
-        "../../bazel-out/host/bin/path/to",
-        "../../bazel-out/darwin-fastbuild/bin/path/to",
-        "../../bazel-out/k8-fastbuild/bin/path/to",
-        "../../bazel-out/x64_windows-fastbuild/bin/path/to",
-        "../../bazel-out/darwin-dbg/bin/path/to",
-        "../../bazel-out/k8-dbg/bin/path/to",
-        "../../bazel-out/x64_windows-dbg/bin/path/to",
-    ]
-}
-
- -

See some related discussion including both β€œrootDirs” and β€œpaths” for a monorepo setup -using custom import paths: -https://github.com/bazelbuild/rules_nodejs/issues/2298

-
- -

Issues when running non-sandboxed

- -

When using a non-sandboxed spawn strategy (which is the default on Windows), you may -observe these problems which require workarounds:

- -

1) Bazel deletes outputs from the previous execution before running tsc. - This causes a problem with TypeScript’s incremental mode: if the .tsbuildinfo file - is not known to be an output of the rule, then Bazel will leave it in the output - directory, and when tsc runs, it may see that the outputs written by the prior - invocation are up-to-date and skip the emit of these files. This will cause Bazel - to intermittently fail with an error that some outputs were not written. - This is why we depend on composite and/or incremental attributes to be provided, - so we can tell Bazel to expect a .tsbuildinfo output to ensure it is deleted before a - subsequent compilation. - At present, we don’t do anything useful with the .tsbuildinfo output, and this rule - does not actually have incremental behavior. Deleting the file is actually - counter-productive in terms of TypeScript compile performance. - Follow https://github.com/bazelbuild/rules_nodejs/issues/1726

- -

2) When using Project References, TypeScript will expect to verify that the outputs of referenced - projects are up-to-date with respect to their inputs. - (This is true even without using the --build option). - When using a non-sandboxed spawn strategy, tsc can read the sources from other ts_project - rules in your project, and will expect that the tsconfig.json file for those references will - indicate where the outputs were written. However the outDir is determined by this Bazel rule so - it cannot be known from reading the tsconfig.json file. - This problem is manifested as a TypeScript diagnostic like - error TS6305: Output file '/path/to/execroot/a.d.ts' has not been built from source file '/path/to/execroot/a.ts'. - As a workaround, you can give the Windows β€œfastbuild” output directory as the outDir in your tsconfig file. - On other platforms, the value isn’t read so it does no harm. - See https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project as an example. - We hope this will be fixed in a future release of TypeScript; - follow https://github.com/microsoft/TypeScript/issues/37378

- -

3) When TypeScript encounters an import statement, it adds the source file resolved by that reference - to the program. However you may have included that source file in a different project, so this causes - the problem mentioned above where a source file is in multiple programs. - (Note, if you use Project References this is not the case, TS will know the referenced - file is part of the other program.) - This will result in duplicate emit for the same file, which produces an error - since the files written to the output tree are read-only. - Workarounds include using using Project References, or simply grouping the whole compilation - into one program (if this doesn’t exceed your time budget).

- -

PARAMETERS

- -

name

- -

A name for the target.

- -

We recommend you use the basename (no .json extension) of the tsconfig file that should be compiled.

- -

Defaults to "tsconfig"

- -

tsconfig

- -

Label of the tsconfig.json file to use for the compilation

- -

To support β€œchaining” of more than one extended config, this label could be a target that -provdes TsConfigInfo such as ts_config.

- -

By default, we assume the tsconfig file is named by adding .json to the name attribute.

- -

EXPERIMENTAL: generated tsconfig

- -

Instead of a label, you can pass a dictionary of tsconfig keys.

- -

In this case, a tsconfig.json file will be generated for this compilation, in the following way:

-
    -
  • all top-level keys will be copied by converting the dict to json. -So tsconfig = {"compilerOptions": {"declaration": True}} -will result in a generated tsconfig.json with {"compilerOptions": {"declaration": true}}
  • -
  • each file in srcs will be converted to a relative path in the files section.
  • -
  • the extends attribute will be converted to a relative path
  • -
- -

Note that you can mix and match attributes and compilerOptions properties, so these are equivalent:

- -
ts_project(
-    tsconfig = {
-        "compilerOptions": {
-            "declaration": True,
-        },
-    },
-)
-
-

and

-
ts_project(
-    declaration = True,
-)
-
- -

Defaults to None

- -

srcs

- -

List of labels of TypeScript source files to be provided to the compiler.

- -

If absent, defaults to **/*.ts[x] (all TypeScript files in the package).

- -

Defaults to None

- -

args

- -

List of strings of additional command-line arguments to pass to tsc.

- -

Defaults to []

- -

deps

- -

List of labels of other rules that produce TypeScript typings (.d.ts files)

- -

Defaults to []

- -

extends

- -

Label of the tsconfig file referenced in the extends section of tsconfig

- -

To support β€œchaining” of more than one extended config, this label could be a target that -provdes TsConfigInfo such as ts_config.

- -

Defaults to None

- -

allow_js

- -

boolean; Specifies whether TypeScript will read .js and .jsx files. When used with declaration, -TypeScript will generate .d.ts files from .js files.

- -

Defaults to False

- -

declaration

- -

if the declaration bit is set in the tsconfig. -Instructs Bazel to expect a .d.ts output for each .ts source.

- -

Defaults to False

- -

source_map

- -

if the sourceMap bit is set in the tsconfig. -Instructs Bazel to expect a .js.map output for each .ts source.

- -

Defaults to False

- -

declaration_map

- -

if the declarationMap bit is set in the tsconfig. -Instructs Bazel to expect a .d.ts.map output for each .ts source.

- -

Defaults to False

- -

preserve_jsx

- -

if the jsx value is set to β€œpreserve” in the tsconfig. -Instructs Bazel to expect a .jsx or .jsx.map output for each .tsx source.

- -

Defaults to False

- -

composite

- -

if the composite bit is set in the tsconfig. -Instructs Bazel to expect a .tsbuildinfo output and a .d.ts output for each .ts source.

- -

Defaults to False

- -

incremental

- -

if the incremental bit is set in the tsconfig. -Instructs Bazel to expect a .tsbuildinfo output.

- -

Defaults to False

- -

emit_declaration_only

- -

if the emitDeclarationOnly bit is set in the tsconfig. -Instructs Bazel not to expect .js or .js.map outputs for .ts sources.

- -

Defaults to False

- -

ts_build_info_file

- -

the user-specified value of tsBuildInfoFile from the tsconfig. -Helps Bazel to predict the path where the .tsbuildinfo output is written.

- -

Defaults to None

- -

tsc

- -

Label of the TypeScript compiler binary to run.

- -

For example, tsc = "@my_deps//typescript/bin:tsc" -Or you can pass a custom compiler binary instead.

- -

Defaults to None

- -

typescript_package

- -

Label of the package containing all data deps of tsc.

- -

For example, typescript_package = "@my_deps//typescript"

- -

Defaults to "@npm//typescript"

- -

typescript_require_path

- -

Module name which resolves to typescript_package when required

- -

For example, typescript_require_path = "typescript"

- -

Defaults to "typescript"

- -

validate

- -

boolean; whether to check that the tsconfig settings match the attributes.

- -

Defaults to True

- -

supports_workers

- -

Experimental! Use only with caution.

- -

Allows you to enable the Bazel Persistent Workers strategy for this project. -See https://docs.bazel.build/versions/master/persistent-workers.html

- -

This requires that the tsc binary support a --watch option.

- -

NOTE: this does not work on Windows yet. -We will silently fallback to non-worker mode on Windows regardless of the value of this attribute. -Follow https://github.com/bazelbuild/rules_nodejs/issues/2277 for progress on this feature.

- -

Defaults to False

- -

declaration_dir

- -

a string specifying a subdirectory under the bazel-out folder where generated declaration -outputs are written. Equivalent to the TypeScript –declarationDir option. -By default declarations are written to the out_dir.

- -

Defaults to None

- -

out_dir

- -

a string specifying a subdirectory under the bazel-out folder where outputs are written. -Equivalent to the TypeScript –outDir option. -Note that Bazel always requires outputs be written under a subdirectory matching the input package, -so if your rule appears in path/to/my/package/BUILD.bazel and out_dir = β€œfoo” then the .js files -will appear in bazel-out/[arch]/bin/path/to/my/package/foo/*.js. -By default the out_dir is β€˜.’, meaning the packages folder in bazel-out.

- -

Defaults to None

- -

root_dir

- -

a string specifying a subdirectory under the input package which should be consider the -root directory of all the input files. -Equivalent to the TypeScript –rootDir option. -By default it is β€˜.’, meaning the source directory where the BUILD file lives.

- -

Defaults to None

- - - -

Link the workspace root to the bin_dir to support absolute requires like β€˜my_wksp/path/to/file’. -If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

- -

Defaults to False

- -

kwargs

- -

passed through to underlying rule, allows eg. visibility, tags

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/TypeScript.md b/docs/TypeScript.md index c751f93808..e95dcd9b9d 100755 --- a/docs/TypeScript.md +++ b/docs/TypeScript.md @@ -1,29 +1,22 @@ ---- -title: TypeScript -layout: default -toc: true -nav: rule ---- + # TypeScript rules for Bazel The TypeScript rules integrate the TypeScript compiler with Bazel. - ## Alternatives This package provides Bazel wrappers around the TypeScript compiler. -At a high level, there are three alternatives provided: `tsc`, `ts_project`, `ts_library`. +At a high level, there are four alternatives provided. This section describes the trade-offs between these rules. - -### tsc +### Option 1: tsc `tsc` is the TypeScript compiler published by the team at Microsoft. You can call it without any custom Bazel rules. @@ -44,10 +37,32 @@ To use it, add the load statement `load("@npm//typescript:index.bzl", "tsc")` to Then call it, using the [`npm_package_bin`](Built-ins#npm_package_bin) documentation. Here is an example: -https://github.com/bazelbuild/rules_nodejs/blob/3.2.2/internal/node/test/BUILD.bazel#L491-L507 + + +### Option 2: tsc_test + +`tsc_test` is generated alongside `tsc`. +It is identical, except that Bazel treats it as a test target, producing only an exit code +rather than files to be consumed by other steps in the build. + +This can be used for a build with `--noEmit`, so that TypeScript is purely used for +type-checking and not for producing any build outputs. +To use it, add the load statement `load("@npm//typescript:index.bzl", "tsc_test")` to your BUILD file. +(Possibly replacing `@npm` with the name of the repository where you installed dependencies) + +To get the typings available in the test (as "runfiles"), you may need to gather them from dependencies if they +are not included as default outputs of those dependencies, like so: + +```starlark +filegroup(name = "types", srcs = ["//some:js_library"], output_group = "types") +``` -### ts_project +And then include the `:types` target in the `data` of the `tsc_test`. + +See example in + +### Option 3: ts_project `ts_project` simply runs `tsc --project`, with Bazel knowing which outputs to expect based on the TypeScript compiler options, and with interoperability with other TypeScript rules via the [DeclarationInfo] Provider that transmits the type information. @@ -59,14 +74,13 @@ Any behavior of `ts_project` should be reproducible outside of Bazel, with a cou `ts_project` is recommended for all new code. Exhaustive examples of calling `ts_project` are in the test suite: -https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project + -And there are also many uses of it in our +And there are also many uses of it in our [examples](https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project). [DeclarationInfo]: Built-ins#declarationinfo - -### ts_library +### Option 4: ts_library `ts_library` should not be used for new code, and may be deprecated in the future. @@ -85,7 +99,6 @@ However it is very challenging to configure and there is little available suppor [concatjs]: https://www.npmjs.com/package/@bazel/concatjs - ## Installation Add a `devDependency` on `@bazel/typescript` @@ -98,7 +111,6 @@ $ npm install --save-dev @bazel/typescript Watch for any `peerDependency` warnings - we assume you have already installed the `typescript` package from npm. - ## Typical Usage The `ts_project` rule invokes the TypeScript compiler on one compilation unit, @@ -149,8 +161,12 @@ your editor references, or `extends` from it, to keep consistent settings for th Anything you do with TypeScript is possible with `ts_project`, including json imports, type-checking only, transpile only, outdir, rootdir, and so on. + +> To use `ts_project` for typecheck-only, you'll still need to use --declaration so that .d.ts files are produced. +> Alternatively, see the `tsc_test` rule documented above. + See many examples in our test cases: -https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project + ## ts_config @@ -189,270 +205,16 @@ Defaults to `[]` - -## ts_library - -**USAGE** - -
-ts_library(name, angular_assets, compiler, data, deps, devmode_module, devmode_target,
-           expected_diagnostics, generate_externs, internal_testing_type_check_dependencies,
-           link_workspace_root, module_name, module_root, prodmode_module, prodmode_target, runtime,
-           runtime_deps, srcs, supports_workers, tsconfig, tsickle_typed, use_angular_plugin)
-
- -type-check and compile a set of TypeScript sources to JavaScript. - -It produces declarations files (`.d.ts`) which are used for compiling downstream -TypeScript targets and JavaScript for the browser and Closure compiler. - -By default, `ts_library` uses the `tsconfig.json` file in the workspace root -directory. See the notes about the `tsconfig` attribute below. - - -## Serving TypeScript for development - -`ts_library` is typically served by the concatjs_devserver rule, documented in the `@bazel/concatjs` package. - - -## Accessing JavaScript outputs - -The default output of the `ts_library` rule is the `.d.ts` files. -This is for a couple reasons: - -- help ensure that downstream rules which access default outputs will not require - a cascading re-build when only the implementation changes but not the types -- make you think about whether you want the `devmode` (named `UMD`) or `prodmode` outputs - -You can access the JS output by adding a `filegroup` rule after the `ts_library`, -for example - -```python -ts_library( - name = "compile", - srcs = ["thing.ts"], -) - -filegroup( - name = "thing.js", - srcs = ["compile"], - # Change to es6_sources to get the 'prodmode' JS - output_group = "es5_sources", -) - -my_rule( - name = "uses_js", - deps = ["thing.js"], -) -``` - - - -**ATTRIBUTES** - - -

name

- -(*Name, mandatory*): A unique name for this target. - - -

angular_assets

- -(*List of labels*): Additional files the Angular compiler will need to read as inputs. - Includes .css and .html files - -Defaults to `[]` - -

compiler

- -(*Label*): Sets a different TypeScript compiler binary to use for this library. -For example, we use the vanilla TypeScript tsc.js for bootstrapping, -and Angular compilations can replace this with `ngc`. - -The default ts_library compiler depends on the `//@bazel/typescript` -target which is setup for projects that use bazel managed npm deps and -install the @bazel/typescript npm package. - -You can also use a custom compiler to increase the NodeJS heap size used for compilations. - -To do this, declare your own binary for running `tsc_wrapped`, e.g.: - -```python -nodejs_binary( - name = "tsc_wrapped_bin", - entry_point = "@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js", - templated_args = [ - "--node_options=--max-old-space-size=2048", - ], - data = [ - "@npm//protobufjs", - "@npm//source-map-support", - "@npm//tsutils", - "@npm//typescript", - "@npm//@bazel/typescript", - ], -) -``` - -then refer to that target in the `compiler` attribute. - -Note that `nodejs_binary` targets generated by `npm_install`/`yarn_install` can include data dependencies -on packages which aren't declared as dependencies. -For example, if you use [tsickle](https://github.com/angular/tsickle) to generate Closure Compiler-compatible JS, -then it needs to be a data dependency of `tsc_wrapped` so that it can be loaded at runtime. - -Defaults to `@build_bazel_rules_typescript//internal:tsc_wrapped_bin` - -

data

- -(*List of labels*) - -Defaults to `[]` - -

deps

- -(*List of labels*): Compile-time dependencies, typically other ts_library targets - -Defaults to `[]` - -

devmode_module

- -(*String*): Set the typescript `module` compiler option for devmode output. - -This value will override the `module` option in the user supplied tsconfig. - -Defaults to `"umd"` - -

devmode_target

- -(*String*): Set the typescript `target` compiler option for devmode output. - -This value will override the `target` option in the user supplied tsconfig. - -Defaults to `"es2015"` - -

expected_diagnostics

- -(*List of strings*) - -Defaults to `[]` - -

generate_externs

- -(*Boolean*) - -Defaults to `True` - -

internal_testing_type_check_dependencies

- -(*Boolean*): Testing only, whether to type check inputs that aren't srcs. - -Defaults to `False` - - - -(*Boolean*): Link the workspace root to the bin_dir to support absolute requires like 'my_wksp/path/to/file'. - If source files need to be required then they can be copied to the bin_dir with copy_to_bin. - -Defaults to `False` - -

module_name

- -(*String*) - -Defaults to `""` - -

module_root

- -(*String*) - -Defaults to `""` - -

prodmode_module

- -(*String*): Set the typescript `module` compiler option for prodmode output. - -This value will override the `module` option in the user supplied tsconfig. - -Defaults to `"esnext"` - -

prodmode_target

- -(*String*): Set the typescript `target` compiler option for prodmode output. - -This value will override the `target` option in the user supplied tsconfig. - -Defaults to `"es2015"` - -

runtime

- -(*String*) - -Defaults to `"browser"` - -

runtime_deps

- -(*List of labels*) The dependencies of this attribute must provide: JsInfo - - -Defaults to `[]` - -

srcs

- -(*List of labels, mandatory*): The TypeScript source files to compile. - - -

supports_workers

- -(*Boolean*): Intended for internal use only. - -Allows you to disable the Bazel Worker strategy for this library. -Typically used together with the "compiler" setting when using a -non-worker aware compiler binary. - -Defaults to `True` - -

tsconfig

- -(*Label*): A tsconfig.json file containing settings for TypeScript compilation. -Note that some properties in the tsconfig are governed by Bazel and will be -overridden, such as `target` and `module`. - -The default value is set to `//:tsconfig.json` by a macro. This means you must -either: - -- Have your `tsconfig.json` file in the workspace root directory -- Use an alias in the root BUILD.bazel file to point to the location of tsconfig: - `alias(name="tsconfig.json", actual="//path/to:tsconfig-something.json")` - and also make the tsconfig.json file visible to other Bazel packages: - `exports_files(["tsconfig.json"], visibility = ["//visibility:public"])` -- Give an explicit `tsconfig` attribute to all `ts_library` targets - -Defaults to `None` - -

tsickle_typed

- -(*Boolean*): If using tsickle, instruct it to translate types to ClosureJS format - -Defaults to `True` - -

use_angular_plugin

- -(*Boolean*): Run the Angular ngtsc compiler under ts_library - -Defaults to `False` - - - ## ts_project **USAGE**
-ts_project(name, tsconfig, srcs, args, deps, extends, allow_js, declaration, source_map,
-           declaration_map, preserve_jsx, composite, incremental, emit_declaration_only,
-           ts_build_info_file, tsc, typescript_package, typescript_require_path, validate,
-           supports_workers, declaration_dir, out_dir, root_dir, link_workspace_root, kwargs)
+ts_project(name, tsconfig, srcs, args, data, deps, extends, allow_js, declaration, source_map,
+           declaration_map, resolve_json_module, preserve_jsx, composite, incremental,
+           emit_declaration_only, transpiler, ts_build_info_file, tsc, typescript_package,
+           typescript_require_path, validate, supports_workers, declaration_dir, out_dir, root_dir,
+           link_workspace_root, kwargs)
 
Compiles one TypeScript project using `tsc --project` @@ -469,10 +231,13 @@ for more details about the trade-offs between the two rules. Some TypeScript options affect which files are emitted, and Bazel wants to know these ahead-of-time. So several options from the tsconfig file must be mirrored as attributes to ts_project. -See https://www.typescriptlang.org/v2/en/tsconfig for a listing of the TypeScript options. +See https://www.typescriptlang.org/tsconfig for a listing of the TypeScript options. Any code that works with `tsc` should work with `ts_project` with a few caveats: +- `ts_project` always produces some output files, or else Bazel would never run it. + Therefore you shouldn't use it with TypeScript's `noEmit` option. + See `tsc_test` under the Alternatives section above. - Bazel requires that the `outDir` (and `declarationDir`) be set to `bazel-out/[target architecture]/bin/path/to/package` so we override whatever settings appear in your tsconfig. @@ -483,12 +248,16 @@ Any code that works with `tsc` should work with `ts_project` with a few caveats: Worse, if you build them separately then the output directory will contain whichever one you happened to build most recently. This is highly discouraged. +As a thin wrapper, this rule doesn't try to compensate for behavior of the TypeScript compiler. +See https://github.com/bazelbuild/rules_nodejs/wiki/Debugging-problems-with-ts_project for notes +that may help you debug issues. + > Note: in order for TypeScript to resolve relative references to the bazel-out folder, > we recommend that the base tsconfig contain a rootDirs section that includes all > possible locations they may appear. > > We hope this will not be needed in some future release of TypeScript. -> Follow https://github.com/microsoft/TypeScript/issues/37257 for more info. +> Follow https://github.com/microsoft/TypeScript/issues/37378 for more info. > > For example, if the base tsconfig file relative to the workspace root is > `path/to/tsconfig.json` then you should configure like: @@ -499,6 +268,7 @@ Any code that works with `tsc` should work with `ts_project` with a few caveats: > ".", > "../../bazel-out/host/bin/path/to", > "../../bazel-out/darwin-fastbuild/bin/path/to", +> "../../bazel-out/darwin_arm64-fastbuild/bin/path/to", > "../../bazel-out/k8-fastbuild/bin/path/to", > "../../bazel-out/x64_windows-fastbuild/bin/path/to", > "../../bazel-out/darwin-dbg/bin/path/to", @@ -512,7 +282,6 @@ Any code that works with `tsc` should work with `ts_project` with a few caveats: > using custom import paths: > https://github.com/bazelbuild/rules_nodejs/issues/2298 - ### Issues when running non-sandboxed When using a non-sandboxed spawn strategy (which is the default on Windows), you may @@ -574,9 +343,9 @@ Defaults to `"tsconfig"` Label of the tsconfig.json file to use for the compilation To support "chaining" of more than one extended config, this label could be a target that -provdes `TsConfigInfo` such as `ts_config`. +provides `TsConfigInfo` such as `ts_config`. -By default, we assume the tsconfig file is named by adding `.json` to the `name` attribute. +By default, we assume the tsconfig file is "tsconfig.json" in the same folder as the ts_project rule. EXPERIMENTAL: generated tsconfig @@ -613,7 +382,10 @@ Defaults to `None` List of labels of TypeScript source files to be provided to the compiler. -If absent, defaults to `**/*.ts[x]` (all TypeScript files in the package). +If absent, the default is set as follows: +- Include `**/*.ts[x]` (all TypeScript files in the package). +- If `allow_js` is set, include `**/*.js[x]` (all JavaScript files in the package). +- If `resolve_json_module` is set, include `**/*.json` (all JSON files in the package), but exclude `**/package.json`, `**/package-lock.json`, and `**/tsconfig*.json`. Defaults to `None` @@ -623,6 +395,14 @@ List of strings of additional command-line arguments to pass to tsc. Defaults to `[]` +

data

+ +files needed at runtime by binaries or tests that transitively depend on this target. + +See https://bazel.build/reference/be/common-definitions#typical-attributes + +Defaults to `[]` +

deps

List of labels of other rules that produce TypeScript typings (.d.ts files) @@ -666,6 +446,15 @@ Instructs Bazel to expect a `.d.ts.map` output for each `.ts` source. Defaults to `False` +

resolve_json_module

+ +None | boolean; Specifies whether TypeScript will read .json files. Defaults to None. +If set to True or False and tsconfig is a dict, resolveJsonModule is set in the generated config file. +If set to None and tsconfig is a dict, resolveJsonModule is unset in the generated config and typescript +default or extended tsconfig value will be load bearing. + +Defaults to `None` +

preserve_jsx

if the `jsx` value is set to "preserve" in the tsconfig. @@ -694,6 +483,51 @@ Instructs Bazel *not* to expect `.js` or `.js.map` outputs for `.ts` sources. Defaults to `False` +

transpiler

+ +A custom transpiler tool to run that produces the JavaScript outputs instead of `tsc`. + +This attribute accepts a rule or macro with this signature: +`name, srcs, js_outs, map_outs, **kwargs` +where the `**kwargs` attribute propagates the tags, visibility, and testonly attributes from `ts_project`. + +If you need to pass additional attributes to the transpiler rule, you can use a +[partial](https://github.com/bazelbuild/bazel-skylib/blob/main/lib/partial.bzl) +to bind those arguments at the "make site", then pass that partial to this attribute where it +will be called with the remaining arguments. +See the packages/typescript/test/ts_project/swc directory for an example. + +When a custom transpiler is used, then the `ts_project` macro expands to these targets: + +- `[name]` - the default target is a `js_library` which can be included in the `deps` of downstream rules. + Note that it will successfully build *even if there are typecheck failures* because the `tsc` binary + is not needed to produce the default outputs. + This is considered a feature, as it allows you to have a faster development mode where type-checking + is not on the critical path. +- `[name]_typecheck` - provides typings (`.d.ts` files) as the default output, + therefore building this target always causes the typechecker to run. +- `[name]_typecheck_test` - a + [`build_test`](https://github.com/bazelbuild/bazel-skylib/blob/main/rules/build_test.bzl) + target which simply depends on the `[name]_typecheck` target. + This ensures that typechecking will be run under `bazel test` with + [`--build_tests_only`](https://docs.bazel.build/versions/main/user-manual.html#flag--build_tests_only). +- `[name]_typings` - internal target which runs the binary from the `tsc` attribute +- Any additional target(s) the custom transpiler rule/macro produces. + Some rules produce one target per TypeScript input file. + +By default, `ts_project` expects `.js` outputs to be written in the same action +that does the type-checking to produce `.d.ts` outputs. +This is the simplest configuration, however `tsc` is slower than alternatives. +It also means developers must wait for the type-checking in the developer loop. + +In theory, Persistent Workers (via the `supports_workers` attribute) remedies the +slow compilation time, however it adds additional complexity because the worker process +can only see one set of dependencies, and so it cannot be shared between different +`ts_project` rules. That attribute is documented as experimental, and may never graduate +to a better support contract. + +Defaults to `None` +

ts_build_info_file

the user-specified value of `tsBuildInfoFile` from the tsconfig. @@ -708,7 +542,20 @@ Label of the TypeScript compiler binary to run. For example, `tsc = "@my_deps//typescript/bin:tsc"` Or you can pass a custom compiler binary instead. -Defaults to `None` +One possible compiler is the Angular compiler, provided by the +`@angular/compiler-cli` package as the `ngc` binary, which can be set typically with +`tsc = "@npm//@angular/compiler-cli/bin:ngc"` +Note that you'll also need to pass `.html` and `.css` files to the `srcs` of the `ts_project` +so that they're declared as inputs for the Angular compiler to read them. + +An example can be found in the rules_nodejs repo under `packages/typescript/test/ts_project/ngc`. + +> To use the `ngc` program from Angular versions prior to 11, you'll need a fix for +> https://github.com/angular/angular/issues/36290 +> To apply the fix, you can use the patch-package package to apply this patch: +> https://gist.github.com/alexeagle/ba44b2601bd7c953d29c6e8ec44d1ef9 + +Defaults to `Label("@npm//typescript/bin:tsc")`

typescript_package

@@ -728,7 +575,10 @@ Defaults to `"typescript"`

validate

-boolean; whether to check that the tsconfig settings match the attributes. +boolean; whether to check that the tsconfig JSON settings match the attributes on this target. + +Set this to `False` to skip running our validator, in case you have a legitimate reason for these to differ, +e.g. you have a setting enabled just for the editor but you want different behavior when Bazel runs `tsc`. Defaults to `True` @@ -737,7 +587,7 @@ Defaults to `True` Experimental! Use only with caution. Allows you to enable the Bazel Persistent Workers strategy for this project. -See https://docs.bazel.build/versions/master/persistent-workers.html +See https://docs.bazel.build/versions/main/persistent-workers.html This requires that the tsc binary support a `--watch` option. diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 9b83b406a3..0000000000 --- a/docs/_config.yml +++ /dev/null @@ -1,17 +0,0 @@ -repository: bazelbuild/rules_nodejs -plugins: - - "jekyll-toc" - -# jekyll-toc settings -toc: - min_level: 2 - max_level: 3 - -defaults: - - - values: - # Enable table of contents for every page - toc: true - -highlighter: rouge -baseurl: /rules_nodejs diff --git a/docs/_includes/footer-content.html b/docs/_includes/footer-content.html deleted file mode 100644 index 4a0a279aea..0000000000 --- a/docs/_includes/footer-content.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
-
-

© {{ 'now' | date: "%Y" }} The rules_nodejs authors

-
-
-
diff --git a/docs/_includes/footer.html b/docs/_includes/footer.html deleted file mode 100644 index 9d932ae6fd..0000000000 --- a/docs/_includes/footer.html +++ /dev/null @@ -1,70 +0,0 @@ -
- {% include footer-content.html %} -
- - - - - - - - - - - diff --git a/docs/_includes/head.html b/docs/_includes/head.html deleted file mode 100644 index 09ef090dc2..0000000000 --- a/docs/_includes/head.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - rules_nodejs - {{ page.title }} - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/_includes/header.html b/docs/_includes/header.html deleted file mode 100644 index 17fa5edfa6..0000000000 --- a/docs/_includes/header.html +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/docs/_includes/sidenav.html b/docs/_includes/sidenav.html deleted file mode 100644 index e0d95b612c..0000000000 --- a/docs/_includes/sidenav.html +++ /dev/null @@ -1,46 +0,0 @@ -
- - - -
diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html deleted file mode 100644 index cfa020852f..0000000000 --- a/docs/_layouts/default.html +++ /dev/null @@ -1,42 +0,0 @@ - - -{% include head.html %} - -{% include header.html %} - -
-
- {% include sidenav.html %} - -
-
- {{ content }} -
-
- - -
-
- -{% include footer.html %} - - - diff --git a/docs/_layouts/search.html b/docs/_layouts/search.html deleted file mode 100644 index 390c582b01..0000000000 --- a/docs/_layouts/search.html +++ /dev/null @@ -1,21 +0,0 @@ - - -{% include head.html %} - -{% include header.html %} - -
- {{ content }} -
-
- - {% include footer.html %} - - - - - - diff --git a/docs/changing-rules.html b/docs/changing-rules.html deleted file mode 100755 index 2de53afc65..0000000000 --- a/docs/changing-rules.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - rules_nodejs - Making changes to rules_nodejs - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Making changes to rules_nodejs

- -

One advantage of open-source software is that you can make your own changes that suit your needs.

- -

The packages published to npm and GitHub differ from the sources in this repo. The packages have only runtime bazel dependencies, but the sources depend on development dependencies. For example, the @bazel_skylib library is a development-time transitive dependency, while an npm package would have that dependency statically linked in.

- -
-

This differs from much of the Bazel ecosystem, where you are expected to build the whole transitive toolchain from sources.

-
- -

If you have a small change, it’s easiest to just patch the distributed artifacts rather than build from source. However if you’re doing active development in rules_nodejs or have a policy of not depending on release artifacts, it’s possible to depend directly on sources. This is not yet documented; file an issue on our repo if you think you need this.

- -

Patching the npm packages

- -

The pattern we use most commonly is to use patch-package. To store your local changes to the npm packages follow the steps:

- -
    -
  1. npm i -D patch-package
  2. -
  3. Edit the target package in your node_modules
  4. -
  5. Run npx patch-package <npm package>. This will store the patch in the patches/ directory in the root of the workspace
  6. -
  7. Add "postinstall": "patch-package" to the package.json in your repo to apply the patches when building dependencies (aka at npm install)
  8. -
- -

Patching the built-in release

- -

rules_nodejs has a distribution format which is a tgz published to GitHub, and this can make it tricky to make casual changes without forking the project and building your own release artifacts.

- -

Bazel has a handy patching mechanism that lets you easily apply a local patch to the release artifact for built-in rules: the patches attribute to http_archive.

- -

First, make your changes in a clone of the rules_nodejs repo. Export a patch file simply using git diff:

- -
git diff > my.patch
-
- -

Then copy the patch file somewhere in your repo and point to it from your WORKSPACE file:

- -
http_archive(
-    name = "build_bazel_rules_nodejs",
-    patch_args = ["-p1"],
-    patches = ["//path/to/my.patch"],
-    sha256 = "6d4edbf28ff6720aedf5f97f9b9a7679401bf7fca9d14a0fff80f644a99992b4",
-    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.32.2/rules_nodejs-0.32.2.tar.gz"],
-)
-
- -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/changing-rules.md b/docs/changing-rules.md index 9824d19772..f34fe27eea 100644 --- a/docs/changing-rules.md +++ b/docs/changing-rules.md @@ -1,16 +1,39 @@ --- -title: Making changes to rules_nodejs +title: Patching changes to rules_nodejs layout: default toc: true --- -# Making changes to rules_nodejs +# Patching changes One advantage of open-source software is that you can make your own changes that suit your needs. -The packages published to npm and GitHub differ from the sources in this repo. The packages have only runtime bazel dependencies, but the sources depend on development dependencies. For example, the `@bazel_skylib` library is a development-time transitive dependency, while an npm package would have that dependency statically linked in. +The `@rules_nodejs` module can simply be fetched from sources in place of the published distribution. +For example, in place of -> This differs from much of the Bazel ecosystem, where you are expected to build the whole transitive toolchain from sources. +```starlark +http_archive( + name = "rules_nodejs", + sha256 = "...", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.0.0/rules_nodejs-core-5.0.0.tar.gz"], +) +``` + +you can just use a commit from your fork: + +```starlark +http_archive( + name = "rules_nodejs", + sha256 = "...", + strip_prefix = "rules_nodejs-abcd123", + url = "https://github.com/my-org/rules_nodejs/archive/abcd123.tar.gz", +) +``` + +The `@build_bazel_rules_nodejs` module distributed on GitHub releases is harder to work with. +It has different content from the sources in this repo. +This is true for packages published to `@bazel/` on npm as well. +These packages have only runtime bazel dependencies, but the sources depend on development dependencies. For example, the `@bazel_skylib` library is a development-time transitive dependency, while an npm package would have that dependency statically linked in. If you have a small change, it's easiest to just patch the distributed artifacts rather than build from source. However if you're doing active development in rules_nodejs or have a policy of not depending on release artifacts, it's possible to depend directly on sources. This is not yet documented; file an issue on our repo if you think you need this. @@ -25,9 +48,9 @@ The pattern we use most commonly is to use [patch-package]. To store your local [patch-package]: https://www.npmjs.com/package/patch-package -## Patching the built-in release +## Patching the build_bazel_rules_nodejs release -rules_nodejs has a distribution format which is a tgz published to GitHub, and this can make it tricky to make casual changes without forking the project and building your own release artifacts. +`build_bazel_rules_nodejs` has a distribution format which is a tgz published to GitHub, and this can make it tricky to make casual changes without forking the project and building your own release artifacts. Bazel has a handy patching mechanism that lets you easily apply a local patch to the release artifact for built-in rules: [the `patches` attribute to `http_archive`](https://docs.bazel.build/versions/master/repo/http.html#attributes). diff --git a/docs/css/BUILD.bazel b/docs/css/BUILD.bazel deleted file mode 100644 index 89602d3b46..0000000000 --- a/docs/css/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library") - -sass_library( - name = "scss", - srcs = glob(["_*.scss"]), -) - -sass_binary( - name = "css", - src = "main.scss", - visibility = ["//docs:__pkg__"], - deps = [ - ":scss", - ], -) diff --git a/docs/css/_be.scss b/docs/css/_be.scss deleted file mode 100644 index 875c603ef2..0000000000 --- a/docs/css/_be.scss +++ /dev/null @@ -1,93 +0,0 @@ -// Build Encyclopedia and Starlark Library - -pre.rule-signature { - white-space: normal; - word-wrap: break-word; - word-break: normal; -} - -colgroup { - .col-param { - width: 25%; - } - - .col-description { - width: 75%; - } -} - -$table-params-border-color: #81c784; -$table-params-head-color: #fff; -$table-params-body-bg-color: #e8f5e9; - -.table-params { - border: 1px solid $table-params-border-color; - - thead > tr > th { - color: $table-params-head-color; - border: 1px solid $table-params-border-color; - background-color: $table-params-border-color; - } - - tbody > tr > td { - background-color: $table-params-body-bg-color; - border: 1px solid $table-params-border-color; - } -} - -$table-implicit-border-color: #c0c0c0; -$table-implicit-head-color: #fff; -$table-implicit-body-bg-color: #f0f0f0; - -.table-implicit { - border: 1px solid $table-implicit-border-color; - - thead > tr > th { - color: $table-implicit-head-color; - border: 1px solid $table-implicit-border-color; - background-color: $table-implicit-border-color; - } - - tbody > tr > td { - background-color: $table-implicit-body-bg-color; - border: 1px solid $table-implicit-border-color; - } -} - - -$toc-border-color: #c8e6c9; -$toc-color: #757575; - -.toc { - border-left: 4px solid $toc-border-color; - padding-left: 18px; - margin-bottom: 20px; - - h1, - h2 { - font-size: 24px; - color: $toc-color; - margin-bottom: 12px; - } - - ul { - list-style: none; - padding-left: 0; - margin-top: 0; - - li { - line-height: 36px; - font-size: 16px; - font-weight: 400; - } - } -} - -// Command-line Reference -dt { - margin-top: .5em; -} - -dd { - margin-left: 2em; -} diff --git a/docs/css/_docs.scss b/docs/css/_docs.scss deleted file mode 100644 index ba92b4808f..0000000000 --- a/docs/css/_docs.scss +++ /dev/null @@ -1,7 +0,0 @@ -.gh-edit { - padding-top: 0px; -} - -.gh-edit.default-hidden { - visibility: hidden; -} diff --git a/docs/css/_footer.scss b/docs/css/_footer.scss deleted file mode 100644 index 26e6319a8d..0000000000 --- a/docs/css/_footer.scss +++ /dev/null @@ -1,25 +0,0 @@ -// Footer styles - -$footer-background: #424242; -$footer-color: #fff; -$footer-link-color: #e0e0e0; - -.footer { - background-color: $footer-background; - color: $footer-color; - padding: 20px; - - .text-muted { - color: $footer-link-color; - } - - a { - color: $footer-link-color; - - &:hover, - &:focus { - color: $footer-color; - text-decoration: none; - } - } -} diff --git a/docs/css/_navbar.scss b/docs/css/_navbar.scss deleted file mode 100644 index 42be12e0e1..0000000000 --- a/docs/css/_navbar.scss +++ /dev/null @@ -1,96 +0,0 @@ -// Navbar styles -$navbar-bg-color: $bazel-green; -$navbar-hover-bg-color: $bazel-green-light; -$navbar-color: $color-on-bazel-green; -$navbar-hover-color: #444; -$navbar-input-bg-color: $bazel-green-light; -$navbar-input-focus-bg-color: $color-on-bazel-green; -$navbar-input-border-color: $bazel-green; - -.navbar-inverse { - margin-bottom: 0; - background-color: $navbar-bg-color; - border-bottom: 1px solid $navbar-bg-color; - - .navbar-brand { - .navbar-logo { - height: 22px; - } - } - - a.navbar-brand { - color: $navbar-color; - - &:focus, - &:hover { - color: $navbar-hover-color; - background-color: $navbar-bg-color; - } - } - - .navbar-nav > li > a { - color: $navbar-color; - - &:focus, - &:hover { - color: $navbar-hover-color; - background-color: $navbar-hover-bg-color; - } - - &.nav-icon { - font-size: 18px; - } - } - - .navbar-nav > li.active > a { - background-color: $navbar-hover-bg-color; - - &:focus, - &:hover { - background-color: $navbar-hover-bg-color; - } - } - - .navbar-form { - border-color: $navbar-bg-color; - - .input-sm { - margin-top: 2px; - } - - input[type="search"] { - background-color: $navbar-input-bg-color; - border-color: $navbar-input-border-color; - - &::placeholder { - color: $navbar-color; - } - - &:focus, - &:active { - background-color: $navbar-input-focus-bg-color; - } - } - } - - .navbar-toggle { - border: 1px solid $navbar-bg-color; - - &.active, - &:focus, - &:hover { - background-color: $navbar-hover-bg-color; - } - } - - .navbar-collapse { - border-color: $navbar-bg-color; - } -} - -@media (max-width: 768px) { - #cse-search-box { - margin-top: 0; - margin-bottom: 0; - } -} diff --git a/docs/css/_sidebar.scss b/docs/css/_sidebar.scss deleted file mode 100644 index cc863fd0be..0000000000 --- a/docs/css/_sidebar.scss +++ /dev/null @@ -1,163 +0,0 @@ -$sidebar-border-color: #dee2e6; - -$sidebar-hover-border-color: #66bb6a; - -.sidebar { - height: 99.9%; - border-right: 1px solid $sidebar-border-color; - background-color: rgba(67,160,71,.03); - padding-top: 40px; - padding-left: 1.5rem; - - // override parent row padding-left. bootstrap's default is 15px. - margin-left: -15px; - - li { - font-size: $font-size-base * .95; - } - - h4 { - padding-right: 1rem; - } - - ul.sidebar-nav { - list-style-type: none; - padding: 0; - - li { - &.sidebar-nav-heading { - padding: 10px 0; - margin: 0; - display: block; - font-size: 16px; - font-weight: $font-weight-light; - } - - ul { - li { - a { - color: #495057; - } - } - } - - a { - padding: 4px 1rem 4px 0; - display: block; - color: #222; - font-weight: $font-weight-normal; - - &:focus { - text-decoration: none; - } - - &:active, - &:hover { - border-right: 4px solid $sidebar-hover-border-color; - text-decoration: none; - } - - .caret { - float: right; - margin-top: 8px; - margin-right: 0px; - } - - } - - &.active { - a { - border-right: 4px solid $sidebar-hover-border-color; - font-weight: $font-weight-bold; - } - } - } - - ul.sidebar-nav { - padding-left: 10px; - } - } - - select { - padding: 3px 4px; - border: 2px solid $sidebar-border-color; - border-radius: 3px; - width: 80%; - } -} - -.sidebar-toggle { - margin-top: 50px; -} - -@media (max-width: 991px) { - .right-sidebar { - display: none; - } -} - -@media (min-width: 992px) { - .sidebar-toggle { - display: none; - } - - .sidebar { - &.collapse { - display: block; - } - } - - .sticky-sidebar { - @supports (position: sticky) { - position: sticky; - top: 50px; // equals height of navbar. - height: 100vh; - overflow-y: auto; - } - } -} - -.right-sidebar { - border-left: 1px solid $sidebar-border-color; - padding-top: 40px; - padding-bottom: 1rem; - - .gh-links { - padding-left: 22px; - list-style-type: none; - li { - padding-bottom: .4rem; - } - } - - a { - font-weight: $font-weight-normal; - } - - .toc-h2 { - padding-left: 0; - list-style-type: none; - - margin-top: .3rem; - line-height: 1.7; - font-size: $font-size-base * .95; - - a { - color: #444; - } - - ul { - padding-left: 0; - } - } - - .toc-h3 { - padding-left: 1em; - list-style-type: none; - line-height: 1.7; - - a { - color: #666; - } - } -} diff --git a/docs/css/_styles.scss b/docs/css/_styles.scss deleted file mode 100644 index 47161b46fa..0000000000 --- a/docs/css/_styles.scss +++ /dev/null @@ -1,254 +0,0 @@ -// Base styles for all Bazel web assets. -// -// For consistency, this file should be identical across docs.bazel.build, -// blog.bazel.build and www.bazel.build. -// TODO(https://github.com/bazelbuild/bazel/issues/10793): Extract into single source of truth. - -// Heading sizes - -$font-size-base: 14px !default; - -$h1-font-size: $font-size-base * 2.25 !default; -$h2-font-size: $font-size-base * 2 !default; -$h3-font-size: $font-size-base * 1.5 !default; -$h4-font-size: $font-size-base * 1.35 !default; -$h5-font-size: $font-size-base * 1.15 !default; -$h6-font-size: $font-size-base !default; - -// Font weights - -$font-weight-light: 300 !default; -$font-weight-normal: 400 !default; -$font-weight-medium: 500 !default; -$font-weight-bold: 700 !default; - -$font-weight-body-text: $font-weight-normal !default; -$headings-font-weight: $font-weight-medium !default; - -// Bazel logo colors -$bazel-green: #43a047; -$bazel-green-light: #76d275; -$bazel-green-dark-left: #00701a; -$bazel-green-dark-right: #004300; -$color-on-bazel-green: #fff; - -$body-font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, -sans-serif; -$code-font-family: 'Monaco', 'Source Code Pro', monospace; - -$link-color: $bazel-green-dark-left; -$link-hover-color: lighten($link-color, 20%); -$well-color: #eee; -$code-color: #000; -$text-color: #000; - -$vpad: 0px; - -$table-bg: #fff; -$table-cell-padding: 5px; -$table-border-color: $bazel-green; -$text-muted: $color-on-bazel-green; -$line-height-base: 1.5; -$line-height-computed: 1.5; - -html { - position: relative; - min-height: 100%; - font-size: 100%; -} - -body { - padding-top: 50px; - color: $text-color; - font-family: $body-font-family; - line-height: $line-height-base; -} - -a { - color: $link-color; - font-weight: $font-weight-medium; - - &:hover, - &:focus { - color: $link-hover-color; - } - - code { - color: $link-color; - } -} - -h1, -h2, -h3, -h4, -h5, -h6 { - color: $text-color; - margin-top: 2rem; - margin-bottom: 1rem; -} - -h1 code, -h2 code, -h3 code, -h4 code, -h5 code, -h6 code { - color: $text-color; - background: transparent; -} - -h1 { - font-size: $h1-font-size; - font-weight: $font-weight-bold; -} - -h2 { - font-size: $h2-font-size; - - code { - font-size: 24px; - } -} - -h3 { - font-size: $h3-font-size; - - code { - font-size: 20px; - } -} - -h4 { - font-size: $h4-font-size; - - code { - font-size: 18px; - } -} - -h5 { - font-size: $h5-font-size; -} - -h6 { - font-size: $h6-font-size; -} - -p, -li { - font-size: $font-size-base; - line-height: $line-height-base; -} - -pre { - padding: 8px 16px; - margin: 8px 0; - font-family: $code-font-family; - background-color: $well-color; - border: 0; - font-size: 100%; - line-height: 20px; - color: $code-color; - border-radius: 6px; - box-shadow: 1px 1px 5px #aaa; -} - -code { - font-family: $code-font-family; - font-size: 13px; - background-color: $well-color; - color: $code-color; -} - - -// Imitate material design buttons -.btn-lg { - font-size: 14px; - text-transform: uppercase; -} - -$md-shadow-1: rgba(0, 0, 0, .14); -$md-shadow-2: rgba(0, 0, 0, .2); -$md-shadow-3: rgba(0, 0, 0, .12); - - -@media (min-width: 768px) { - .container { - width: 100%; - max-width: 100%; - } -} - -@media (min-width: 992px) { - .content { - max-width: 100%; - width: 100%; - } -} - -.content { - overflow: auto; - padding: 40px 10px; - p { - line-height: 22px; - margin-bottom: 1rem; - } -} - -.btn-success { - border-radius: 2px; - box-shadow: 0 2px 2px 0 $md-shadow-1, 0 3px 1px -2px $md-shadow-2, 0 1px 5px 0 $md-shadow-3; - border: 0; -} - -.well { - background-color: $well-color; - border-color: $well-color; - box-shadow: none; -} - -// Shared -.vpad { - padding-top: $vpad; -} - -.page-title-bar { - background-color: $bazel-green-light; - padding-top: 20px; - padding-bottom: 20px; - - h1, - h2, - h3, - h4, - h5, - h6 { - margin: 8px 0 4px; - color: $color-on-bazel-green; - } -} - -.gsc-control-cse { - *, - *::before, - *::after { - -webkit-box-sizing: content-box !important; - -moz-box-sizing: content-box !important; - box-sizing: content-box !important; - } -} - -// Used for the Command-line Reference flag anchors. Linkifying the flag name -// causes it to turn $link-color (green), but we turn it red here to be consistent -// with the rest of the code block. -dd > code > a, -dl > dt > code > a { - color: $code-color; -} - -dl > dt { - margin-top: 1.5rem; - margin-bottom: .5rem; -} diff --git a/docs/css/_syntax.scss b/docs/css/_syntax.scss deleted file mode 100644 index 56f2c787a1..0000000000 --- a/docs/css/_syntax.scss +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright 2015 Google -// -// Generated using Base16 Builder -// (https://github.com/chriskempson/base16-builder) - -$base00: #212121; // ---- -$base01: #424242; // --- -$base02: #616161; // -- -$base03: #757575; // - -$base04: #9e9e9e; // + -$base05: #bdbdbd; // ++ -$base06: #e0e0e0; // +++ -$base07: #eee; // ++++ - -$base08: #f44336; // red -$base09: #ff9800; // orange -$base0A: #ffc107; // yellow -$base0B: #4caf50; // green -$base0C: #009688; // aqua -$base0D: #2196f3; // blue -$base0E: #9c27b0; // purple -$base0F: #795548; // brown - -.highlight .hll { background-color: $base06 } -.highlight { background: $base07; color: $base00 } -.highlight .c { color: $base04 } // Comment -.highlight .err { color: $base08 } // Error -.highlight .k { color: $base0E } // Keyword -.highlight .l { color: $base09 } // Literal -.highlight .n { color: $base00 } // Name -.highlight .o { color: $base0C } // Operator -.highlight .p { color: $base00 } // Punctuation -.highlight .cm { color: $base04 } // Comment.Multiline -.highlight .cp { color: $base04 } // Comment.Preproc -.highlight .c1 { color: $base04 } // Comment.Single -.highlight .cs { color: $base04 } // Comment.Special -.highlight .gd { color: $base08 } // Generic.Deleted -.highlight .ge { font-style: italic } // Generic.Emph -.highlight .gh { color: $base00; font-weight: bold } // Generic.Heading -.highlight .gi { color: $base0B } // Generic.Inserted -.highlight .gp { color: $base04; font-weight: bold } // Generic.Prompt -.highlight .gs { font-weight: bold } // Generic.Strong -.highlight .gu { color: $base0C; font-weight: bold } // Generic.Subheading -.highlight .kc { color: $base0E } // Keyword.Constant -.highlight .kd { color: $base0E } // Keyword.Declaration -.highlight .kn { color: $base0C } // Keyword.Namespace -.highlight .kp { color: $base0E } // Keyword.Pseudo -.highlight .kr { color: $base0E } // Keyword.Reserved -.highlight .kt { color: $base0A } // Keyword.Type -.highlight .ld { color: $base0B } // Literal.Date -.highlight .m { color: $base09 } // Literal.Number -.highlight .s { color: $base0B } // Literal.String -.highlight .na { color: $base0D } // Name.Attribute -.highlight .nb { color: $base00 } // Name.Builtin -.highlight .nc { color: $base0A } // Name.Class -.highlight .no { color: $base08 } // Name.Constant -.highlight .nd { color: $base0C } // Name.Decorator -.highlight .ni { color: $base00 } // Name.Entity -.highlight .ne { color: $base08 } // Name.Exception -.highlight .nf { color: $base0D } // Name.Function -.highlight .nl { color: $base00 } // Name.Label -.highlight .nn { color: $base0A } // Name.Namespace -.highlight .nx { color: $base0D } // Name.Other -.highlight .py { color: $base00 } // Name.Property -.highlight .nt { color: $base0C } // Name.Tag -.highlight .nv { color: $base08 } // Name.Variable -.highlight .ow { color: $base0C } // Operator.Word -.highlight .w { color: $base00 } // Text.Whitespace -.highlight .mf { color: $base09 } // Literal.Number.Float -.highlight .mh { color: $base09 } // Literal.Number.Hex -.highlight .mi { color: $base09 } // Literal.Number.Integer -.highlight .mo { color: $base09 } // Literal.Number.Oct -.highlight .sb { color: $base0B } // Literal.String.Backtick -.highlight .sc { color: $base00 } // Literal.String.Char -.highlight .sd { color: $base04 } // Literal.String.Doc -.highlight .s2 { color: $base0B } // Literal.String.Double -.highlight .se { color: $base09 } // Literal.String.Escape -.highlight .sh { color: $base0B } // Literal.String.Heredoc -.highlight .si { color: $base09 } // Literal.String.Interpol -.highlight .sx { color: $base0B } // Literal.String.Other -.highlight .sr { color: $base0B } // Literal.String.Regex -.highlight .s1 { color: $base0B } // Literal.String.Single -.highlight .ss { color: $base0B } // Literal.String.Symbol -.highlight .bp { color: $base00 } // Name.Builtin.Pseudo -.highlight .vc { color: $base08 } // Name.Variable.Class -.highlight .vg { color: $base08 } // Name.Variable.Global -.highlight .vi { color: $base08 } // Name.Variable.Instance -.highlight .il { color: $base09 } // Literal.Number.Integer.Long diff --git a/docs/css/_tables.scss b/docs/css/_tables.scss deleted file mode 100644 index fe4edd7cf0..0000000000 --- a/docs/css/_tables.scss +++ /dev/null @@ -1,63 +0,0 @@ -// Bootstrap requires tables to carry a .table class in order for styling to -// be applied. However, redcarpet emits table elements without the class and -// it is not possible to customize it. -// -// Ideally, we would use a SASS directive to make the table element inherit -// the formatting defined by the bootstrap templates... but we cannot do so -// at the moment because we don't build bootstrap ourselves from its SASS -// sources. Therefore, this file just borrows the minimal amount of code -// from bootstrap 3.3.7 to render tables nicely. - -caption { - padding-top: $table-cell-padding; - padding-bottom: $table-cell-padding; - color: $text-muted; - text-align: left; -} - -th { - text-align: left; -} - -// Baseline styles - -table { - background-color: $table-bg; - width: 100%; - max-width: 100%; - margin-bottom: $line-height-computed; - // Cells - > thead, - > tbody, - > tfoot { - > tr { - > th, - > td { - padding: $table-cell-padding; - line-height: $line-height-base; - vertical-align: top; - border-top: 1px solid $table-border-color; - } - } - } - // Bottom align for column headings - > thead > tr > th { - vertical-align: bottom; - border-bottom: 2px solid $table-border-color; - } - // Remove top border from thead by default - > caption + thead, - > colgroup + thead, - > thead:first-child { - > tr:first-child { - > th, - > td { - border-top: 0; - } - } - } - // Account for multiple tbody instances - > tbody + tbody { - border-top: 2px solid $table-border-color; - } -} diff --git a/docs/css/main.css b/docs/css/main.css deleted file mode 100755 index 5398c8f6b0..0000000000 --- a/docs/css/main.css +++ /dev/null @@ -1 +0,0 @@ -html{position:relative;min-height:100%;font-size:100%}body{padding-top:50px;color:#000;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;line-height:1.5}a{color:#00701a;font-weight:500}a:hover,a:focus{color:#00d632}a code{color:#00701a}h1,h2,h3,h4,h5,h6{color:#000;margin-top:2rem;margin-bottom:1rem}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{color:#000;background:transparent}h1{font-size:31.5px;font-weight:700}h2{font-size:28px}h2 code{font-size:24px}h3{font-size:21px}h3 code{font-size:20px}h4{font-size:18.9px}h4 code{font-size:18px}h5{font-size:16.1px}h6{font-size:14px}p,li{font-size:14px;line-height:1.5}pre{padding:8px 16px;margin:8px 0;font-family:"Monaco","Source Code Pro",monospace;background-color:#eee;border:0;font-size:100%;line-height:20px;color:#000;border-radius:6px;box-shadow:1px 1px 5px #aaa}code{font-family:"Monaco","Source Code Pro",monospace;font-size:13px;background-color:#eee;color:#000}.btn-lg{font-size:14px;text-transform:uppercase}@media(min-width: 768px){.container{width:100%;max-width:100%}}@media(min-width: 992px){.content{max-width:100%;width:100%}}.content{overflow:auto;padding:40px 10px}.content p{line-height:22px;margin-bottom:1rem}.btn-success{border-radius:2px;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);border:0}.well{background-color:#eee;border-color:#eee;box-shadow:none}.vpad{padding-top:0px}.page-title-bar{background-color:#76d275;padding-top:20px;padding-bottom:20px}.page-title-bar h1,.page-title-bar h2,.page-title-bar h3,.page-title-bar h4,.page-title-bar h5,.page-title-bar h6{margin:8px 0 4px;color:#fff}.gsc-control-cse *,.gsc-control-cse *::before,.gsc-control-cse *::after{-webkit-box-sizing:content-box !important;-moz-box-sizing:content-box !important;box-sizing:content-box !important}dd>code>a,dl>dt>code>a{color:#000}dl>dt{margin-top:1.5rem;margin-bottom:.5rem}.footer{background-color:#424242;color:#fff;padding:20px}.footer .text-muted{color:#e0e0e0}.footer a{color:#e0e0e0}.footer a:hover,.footer a:focus{color:#fff;text-decoration:none}.navbar-inverse{margin-bottom:0;background-color:#43a047;border-bottom:1px solid #43a047}.navbar-inverse .navbar-brand .navbar-logo{height:22px}.navbar-inverse a.navbar-brand{color:#fff}.navbar-inverse a.navbar-brand:focus,.navbar-inverse a.navbar-brand:hover{color:#444;background-color:#43a047}.navbar-inverse .navbar-nav>li>a{color:#fff}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#444;background-color:#76d275}.navbar-inverse .navbar-nav>li>a.nav-icon{font-size:18px}.navbar-inverse .navbar-nav>li.active>a{background-color:#76d275}.navbar-inverse .navbar-nav>li.active>a:focus,.navbar-inverse .navbar-nav>li.active>a:hover{background-color:#76d275}.navbar-inverse .navbar-form{border-color:#43a047}.navbar-inverse .navbar-form .input-sm{margin-top:2px}.navbar-inverse .navbar-form input[type=search]{background-color:#76d275;border-color:#43a047}.navbar-inverse .navbar-form input[type=search]::placeholder{color:#fff}.navbar-inverse .navbar-form input[type=search]:focus,.navbar-inverse .navbar-form input[type=search]:active{background-color:#fff}.navbar-inverse .navbar-toggle{border:1px solid #43a047}.navbar-inverse .navbar-toggle.active,.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#76d275}.navbar-inverse .navbar-collapse{border-color:#43a047}@media(max-width: 768px){#cse-search-box{margin-top:0;margin-bottom:0}}.sidebar{height:99.9%;border-right:1px solid #dee2e6;background-color:rgba(67,160,71,.03);padding-top:40px;padding-left:1.5rem;margin-left:-15px}.sidebar li{font-size:13.3px}.sidebar h4{padding-right:1rem}.sidebar ul.sidebar-nav{list-style-type:none;padding:0}.sidebar ul.sidebar-nav li.sidebar-nav-heading{padding:10px 0;margin:0;display:block;font-size:16px;font-weight:300}.sidebar ul.sidebar-nav li ul li a{color:#495057}.sidebar ul.sidebar-nav li a{padding:4px 1rem 4px 0;display:block;color:#222;font-weight:400}.sidebar ul.sidebar-nav li a:focus{text-decoration:none}.sidebar ul.sidebar-nav li a:active,.sidebar ul.sidebar-nav li a:hover{border-right:4px solid #66bb6a;text-decoration:none}.sidebar ul.sidebar-nav li a .caret{float:right;margin-top:8px;margin-right:0px}.sidebar ul.sidebar-nav li.active a{border-right:4px solid #66bb6a;font-weight:700}.sidebar ul.sidebar-nav ul.sidebar-nav{padding-left:10px}.sidebar select{padding:3px 4px;border:2px solid #dee2e6;border-radius:3px;width:80%}.sidebar-toggle{margin-top:50px}@media(max-width: 991px){.right-sidebar{display:none}}@media(min-width: 992px){.sidebar-toggle{display:none}.sidebar.collapse{display:block}@supports(position: sticky){.sticky-sidebar{position:sticky;top:50px;height:100vh;overflow-y:auto}}}.right-sidebar{border-left:1px solid #dee2e6;padding-top:40px;padding-bottom:1rem}.right-sidebar .gh-links{padding-left:22px;list-style-type:none}.right-sidebar .gh-links li{padding-bottom:.4rem}.right-sidebar a{font-weight:400}.right-sidebar .toc-h2{padding-left:0;list-style-type:none;margin-top:.3rem;line-height:1.7;font-size:13.3px}.right-sidebar .toc-h2 a{color:#444}.right-sidebar .toc-h2 ul{padding-left:0}.right-sidebar .toc-h3{padding-left:1em;list-style-type:none;line-height:1.7}.right-sidebar .toc-h3 a{color:#666}.gh-edit{padding-top:0px}.gh-edit.default-hidden{visibility:hidden}caption{padding-top:5px;padding-bottom:5px;color:#fff;text-align:left}th{text-align:left}table{background-color:#fff;width:100%;max-width:100%;margin-bottom:1.5}table>thead>tr>th,table>thead>tr>td,table>tbody>tr>th,table>tbody>tr>td,table>tfoot>tr>th,table>tfoot>tr>td{padding:5px;line-height:1.5;vertical-align:top;border-top:1px solid #43a047}table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #43a047}table>caption+thead>tr:first-child>th,table>caption+thead>tr:first-child>td,table>colgroup+thead>tr:first-child>th,table>colgroup+thead>tr:first-child>td,table>thead:first-child>tr:first-child>th,table>thead:first-child>tr:first-child>td{border-top:0}table>tbody+tbody{border-top:2px solid #43a047}pre.rule-signature{white-space:normal;word-wrap:break-word;word-break:normal}colgroup .col-param{width:25%}colgroup .col-description{width:75%}.table-params{border:1px solid #81c784}.table-params thead>tr>th{color:#fff;border:1px solid #81c784;background-color:#81c784}.table-params tbody>tr>td{background-color:#e8f5e9;border:1px solid #81c784}.table-implicit{border:1px solid silver}.table-implicit thead>tr>th{color:#fff;border:1px solid silver;background-color:silver}.table-implicit tbody>tr>td{background-color:#f0f0f0;border:1px solid silver}.toc{border-left:4px solid #c8e6c9;padding-left:18px;margin-bottom:20px}.toc h1,.toc h2{font-size:24px;color:#757575;margin-bottom:12px}.toc ul{list-style:none;padding-left:0;margin-top:0}.toc ul li{line-height:36px;font-size:16px;font-weight:400}dt{margin-top:.5em}dd{margin-left:2em}.highlight .hll{background-color:#e0e0e0}.highlight{background:#eee;color:#212121}.highlight .c{color:#9e9e9e}.highlight .err{color:#f44336}.highlight .k{color:#9c27b0}.highlight .l{color:#ff9800}.highlight .n{color:#212121}.highlight .o{color:#009688}.highlight .p{color:#212121}.highlight .cm{color:#9e9e9e}.highlight .cp{color:#9e9e9e}.highlight .c1{color:#9e9e9e}.highlight .cs{color:#9e9e9e}.highlight .gd{color:#f44336}.highlight .ge{font-style:italic}.highlight .gh{color:#212121;font-weight:bold}.highlight .gi{color:#4caf50}.highlight .gp{color:#9e9e9e;font-weight:bold}.highlight .gs{font-weight:bold}.highlight .gu{color:#009688;font-weight:bold}.highlight .kc{color:#9c27b0}.highlight .kd{color:#9c27b0}.highlight .kn{color:#009688}.highlight .kp{color:#9c27b0}.highlight .kr{color:#9c27b0}.highlight .kt{color:#ffc107}.highlight .ld{color:#4caf50}.highlight .m{color:#ff9800}.highlight .s{color:#4caf50}.highlight .na{color:#2196f3}.highlight .nb{color:#212121}.highlight .nc{color:#ffc107}.highlight .no{color:#f44336}.highlight .nd{color:#009688}.highlight .ni{color:#212121}.highlight .ne{color:#f44336}.highlight .nf{color:#2196f3}.highlight .nl{color:#212121}.highlight .nn{color:#ffc107}.highlight .nx{color:#2196f3}.highlight .py{color:#212121}.highlight .nt{color:#009688}.highlight .nv{color:#f44336}.highlight .ow{color:#009688}.highlight .w{color:#212121}.highlight .mf{color:#ff9800}.highlight .mh{color:#ff9800}.highlight .mi{color:#ff9800}.highlight .mo{color:#ff9800}.highlight .sb{color:#4caf50}.highlight .sc{color:#212121}.highlight .sd{color:#9e9e9e}.highlight .s2{color:#4caf50}.highlight .se{color:#ff9800}.highlight .sh{color:#4caf50}.highlight .si{color:#ff9800}.highlight .sx{color:#4caf50}.highlight .sr{color:#4caf50}.highlight .s1{color:#4caf50}.highlight .ss{color:#4caf50}.highlight .bp{color:#212121}.highlight .vc{color:#f44336}.highlight .vg{color:#f44336}.highlight .vi{color:#f44336}.highlight .il{color:#ff9800}/*# sourceMappingURL=main.css.map */ diff --git a/docs/css/main.scss b/docs/css/main.scss deleted file mode 100644 index dbbbc40dcf..0000000000 --- a/docs/css/main.scss +++ /dev/null @@ -1,11 +0,0 @@ -// these styles are based on the main bazel.build site docs, with a few tweaks -// https://github.com/bazelbuild/bazel/tree/master/site/_sass - -@import "styles"; -@import "footer"; -@import "navbar"; -@import "sidebar"; -@import "docs"; -@import "tables"; -@import "be"; -@import "syntax"; diff --git a/docs/debugging.html b/docs/debugging.html deleted file mode 100755 index 04c81e9282..0000000000 --- a/docs/debugging.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - - - rules_nodejs - Debugging - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Debugging

- -

Add the options in the Support for debugging NodeJS tests section from https://github.com/bazelbuild/rules_nodejs/blob/master/common.bazelrc to your project’s .bazelrc file to add support for debugging NodeJS programs.

- -

Using the --config=debug command line option with bazel will set a number of flags that are specified there are useful for debugging. See the comments under Support for debugging NodeJS tests for details on the flags that are set.

- -

Use --config=debug with bazel test as follow,

- -
bazel test --config=debug //test:...
-
- -

or with bazel run,

- -
bazel run --config=debug //test:test1
-
- -

to also turn on the NodeJS inspector agent which will break before any user code starts. You should then see,

- -
Executing tests from //test:test1
------------------------------------------------------------------------------
-Debugger listening on ws://127.0.0.1:9229/3f20777a-242c-4d18-b88b-5ed4b3fed61c
-For help, see: https://nodejs.org/en/docs/inspector
-
- -

when the test is run.

- -

To inspect with Chrome DevTools 55+, open chrome://inspect in a Chromium-based browser and attach to the waiting process. -A Chrome DevTools window should open and you should see Debugger attached. in the console.

- -

See https://nodejs.org/en/docs/guides/debugging-getting-started/ for more details.

- -

Debugging with VS Code

- -

With the above configuration you can use VS Code as your debugger. -You will first need to configure your .vscode/launch.json:

- -
{
-      "type": "node",
-      "request": "attach",
-      "name": "Attach nodejs_binary",
-      "internalConsoleOptions": "neverOpen",
-      "sourceMapPathOverrides": {
-        "../*": "${workspaceRoot}/*",
-        "../../*": "${workspaceRoot}/*",
-        "../../../*": "${workspaceRoot}/*",
-        "../../../../*": "${workspaceRoot}/*",
-        "../../../../../*": "${workspaceRoot}/*",
-        // do as many levels here as needed for your project
-      }
-
-

We use sourceMapPathOverrides here to rewrite the source maps produced by ts_library so that breakpoints line up with the source maps. -Once configured start your process with

-
bazel run --config=debug //test:test1
-
-

Then hit F5 which will start the VS Code debugger with the Attach nodejs_binary configuration. -VS Code will immediatenly hit a breakpoint to which you can continue and debug using all the normal debug features provided.

- -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/debugging.md b/docs/debugging.md index 0cc6490ab2..d05f28df15 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -49,6 +49,7 @@ You will first need to configure your `.vscode/launch.json`: "request": "attach", "name": "Attach nodejs_binary", "internalConsoleOptions": "neverOpen", + "resolveSourceMapLocations": null, "sourceMapPathOverrides": { "../*": "${workspaceRoot}/*", "../../*": "${workspaceRoot}/*", diff --git a/docs/dependencies.html b/docs/dependencies.html deleted file mode 100755 index 9c658f02cd..0000000000 --- a/docs/dependencies.html +++ /dev/null @@ -1,558 +0,0 @@ - - - - - - - - - - rules_nodejs - Dependencies - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Dependencies

- -

Bazel works alongside your existing package manager, either npm or yarn. -You manage your package.json file, editing by hand or by running commands like npm install or yarn add. -The package manager will also write a lock file, indicating exact versions for all transitive dependencies, which keeps your build hermetic and reproducible. -Bazel will run the package manager when the package.json or *lock.json files change, but you can also run the package manager yourself.

- -

Bazel-managed vs self-managed dependencies

- -

You have two options for managing your node_modules dependencies: Bazel-managed or self-managed.

- -

With the Bazel-managed dependencies approach, Bazel is responsible for making sure that node_modules is -up to date with your package[-lock].json or yarn.lock files. This means Bazel will set it up when the -repository is first cloned, and rebuild it whenever it changes. With the yarn_install or npm_install -repository rules, Bazel will setup your node_modules for you in an external workspace named after the -repository rule. For example, a yarn_install(name = "npm", ...) will setup an external -workspace named @npm with the node_modules folder inside of it as well as generating targets for each -root npm package in node_modules for use as dependencies to other rules.

- -

For Bazel to provide the strongest guarantees about reproducibility and the -fidelity of your build, it is recommended that you use Bazel-managed dependencies. -This approach also allows you to use the generated fine-grained npm package dependencies -which can significantly reduce the number of inputs to actions, making Bazel sand-boxing and -remote-execution faster if there are a large number of files under node_modules.

- -
-

Note that as of Bazel 0.26, and with the recommended managed_directories attribute on the workspace rule in /WORKSPACE, -the Bazel-managed node_modules directory is placed in your workspace root in the standard location used by npm or yarn.

-
- -

Using Bazel-managed dependencies

- -

To have Bazel manage its own copy of node_modules, which is useful to avoid -juggling multiple toolchains, you can add one of the following to your WORKSPACE -file:

- -

Using Yarn (preferred):

- -
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
-
-yarn_install(
-    name = "npm",
-    package_json = "//:package.json",
-    yarn_lock = "//:yarn.lock",
-)
-
- -

Using NPM:

- -
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
-
-npm_install(
-    name = "npm",
-    package_json = "//:package.json",
-    package_lock_json = "//:package-lock.json",
-)
-
- -
-

If you don’t need to pass any arguments to node_repositories, - you can skip calling that function. yarn_install and npm_install will do it by default.

-
- -

You should now add the @npm workspace to the managed_directories option in the workspace rule at the top of the file. This tells Bazel that the node_modules directory is special and is managed by the package manager. -Add the workspace rule if it isn’t already in your /WORKSPACE file.

- -
workspace(
-    name = "my_wksp",
-    managed_directories = {"@npm": ["node_modules"]},
-)
-
- -

As of Bazel 0.26 this feature is still experimental, so also add this line to the .bazelrc to opt-in:

- -
common --experimental_allow_incremental_repository_updates
-
- -

yarn_install vs. npm_install

- -

yarn_install is the preferred rule for setting up Bazel-managed dependencies for a number of reasons:

- -
    -
  • yarn_install will use the global yarn cache by default which will improve your build performance (this can be turned off with the use_global_yarn_cache attribute)
  • -
  • npm has a known peer dependency hoisting issue that can lead to missing peer dependencies in some cases (see https://github.com/bazelbuild/rules_nodejs/issues/416)
  • -
- -

Fine-grained npm package dependencies

- -

You can then reference individual npm packages in your BUILD rules via:

- -
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
-
-nodejs_binary(
-    name = "bar",
-    data = [
-      "@npm//foo",
-      "@npm//baz",
-    ]
-    ...
-)
-
- -

In this case, the bar nodejs_binary depends only the foo and baz npm packages -and all of their transitive deps.

- -

For other rules such as jasmine_node_test, fine grained -npm dependencies are specified in the deps attribute:

- -
jasmine_node_test(
-    name = "test",
-    ...
-    deps = [
-        "@npm//jasmine",
-        "@npm//foo",
-        "@npm//baz",
-        ...
-    ],
-)
-
- -

Multiple sets of npm dependencies

- -

If your workspace has multiple applications, each with their own package.json -and npm deps, yarn_install (or npm_install) can be called separately for -each.

- -
workspace(
-    name = "my_wksp",
-    managed_directories = {
-        "@app1_npm": ["app1/node_modules"],
-        "@app2_npm": ["app2/node_modules"],
-    },
-)
-
-yarn_install(
-    name = "app1_npm",
-    package_json = "//app1:package.json",
-    yarn_lock = "//app1:yarn.lock",
-)
-
-yarn_install(
-    name = "app2_npm",
-    package_json = "//app2:package.json",
-    yarn_lock = "//app2:yarn.lock",
-)
-
- -

Your application would then reference its deps as (for example) @app1_npm//lodash, or @app2_npm//jquery.

- -

Fine-grained npm package nodejs_binary targets

- -

If an npm package lists one or more bin entry points in its package.json, -nodejs_binary targets will be generated for these.

- -

For example, the protractor package has two bin entries in its package.json:

- -
  "bin": {
-    "protractor": "bin/protractor",
-    "webdriver-manager": "bin/webdriver-manager"
-  },
-
- -

These will result in two generated nodejs_binary targets in the @npm//protractor/bin -package (if your npm deps workspace is @npm):

- -
    -
  • @npm//protractor/bin:protractor
  • -
  • @npm//protractor/bin:webdriver-manager
  • -
- -

These targets can be used as executables for actions in custom rules or can -be run by Bazel directly. For example, you can run protractor with the -following:

- -
$ bazel run @npm//protractor/bin:protractor
-
- -

Note: These targets are in the protractor/bin package so they don’t -conflict with the targets to use in deps[]. For example, @npm//protractor:protractor -is target to use in deps[] while @npm//protractor/bin:protractor is the binary target.

- -

Coarse node_modules dependencies

- -

Using fine grained npm dependencies is recommended to minimize -the number of inputs to your rules. However, for backward compatibility -there are also filegroups defined by yarn_install and npm_install -that include all packages under node_modules and which can be used -with the node_modules attribute of nodejs rules.

- -
    -
  • @npm//:node_modules includes all packages under node_modules as well as the .bin folder
  • -
- -
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
-
-nodejs_binary(
-    name = "bar",
-    node_modules = "@npm//:node_modules",
-)
-
- -

Using self-managed dependencies

- -

If you’d like to have Bazel use the node_modules directory you are managing, -then next you will create a BUILD.bazel file in your project root containing:

- -
package(default_visibility = ["//visibility:public"])
-
-filegroup(
-    name = "node_modules",
-    srcs = glob(
-        include = ["node_modules/**/*"],
-        exclude = [
-          # Files under test & docs may contain file names that
-          # are not legal Bazel labels (e.g.,
-          # node_modules/ecstatic/test/public/δΈ­ζ–‡/ζͺ”ζ‘ˆ.html)
-          "node_modules/test/**",
-          "node_modules/docs/**",
-          # Files with spaces are not allowed in Bazel runfiles
-          # See https://github.com/bazelbuild/bazel/issues/4327
-          "node_modules/**/* */**",
-          "node_modules/**/* *",
-        ],
-    ),
-)
-
- -

The example in examples/user_managed_deps uses self-managed dependencies.

- -

To use the Yarn package manager, which we recommend for its built-in -verification command, you can run:

- -
$ bazel run @nodejs//:yarn_node_repositories
-
- -

If you use npm instead, run:

- -
$ bazel run @nodejs//:npm_node_repositories install
-
- -

The @nodejs//:yarn_node_repositories and @nodejs//:npm_node_repositories targets will run yarn/npm on all of the -package.json contexts listed package_json attribute of the node_repositories -repository rule in your WORKSPACE file (node_repositories(package_json = [...])).

- -

If there are multiple package.json contexts in this rule but you would like to -run the bazel managed yarn or npm on a single context this can be done -using the following targets:

- -
$ bazel run @nodejs//:yarn -- <arguments passed to yarn>
-
- -

If you use npm instead, run:

- -
$ bazel run @nodejs//:npm -- <arguments passed to npm>
-
- -

This will run yarn/npm in the current working directory. To add a package with the yarn add command, -for example, you would use:

- -
$ bazel run @nodejs//:yarn -- add <package>
-
- -

Note: the arguments passed to bazel run after -- are forwarded to the executable being run.

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/dependencies.md b/docs/dependencies.md index 582e5cb3b3..34f7a75e15 100644 --- a/docs/dependencies.md +++ b/docs/dependencies.md @@ -29,9 +29,6 @@ This approach also allows you to use the generated fine-grained npm package depe which can significantly reduce the number of inputs to actions, making Bazel sand-boxing and remote-execution faster if there are a large number of files under `node_modules`. -> Note that as of Bazel 0.26, and with the recommended `managed_directories` attribute on the `workspace` rule in `/WORKSPACE`, -> the Bazel-managed `node_modules` directory is placed in your workspace root in the standard location used by npm or yarn. - ## Using Bazel-managed dependencies To have Bazel manage its own copy of `node_modules`, which is useful to avoid @@ -65,20 +62,50 @@ npm_install( > If you don't need to pass any arguments to `node_repositories`, you can skip calling that function. `yarn_install` and `npm_install` will do it by default. -You should now add the `@npm` workspace to the `managed_directories` option in the `workspace` rule at the top of the file. This tells Bazel that the `node_modules` directory is special and is managed by the package manager. -Add the `workspace` rule if it isn't already in your `/WORKSPACE` file. +### symlink_node_modules and managed_directories + +**The `managed_directories` feature is being removed from Bazel.** +See https://github.com/bazelbuild/bazel/issues/15463. +Using `managed_directories` is not recommended. + +Furthermore, as of rules_nodejs 5.0, `symlink_node_modules` defaults to `False`. We've found that the benefits of using +`symlink_node_modules`, which allows Bazel to use a `node_modules` directory +that is in the user workspace, do not outweigh the downsides of the repository +rule not defining all of their inputs and of having to re-run the repository rule +if the user's `node_modules` folder is deleted. On persistent CI machines, that +will delete the `node_modules` folder when cleaning the clone between jobs, the +repository rule will run for every job when `symlink_node_modules` is enabled. +With `symlink_node_modules` disabled, the repository rule will only re-run if +its inputs change between jobs. + +The remaining documentation in this section is for legacy usage only. + +Set `symlink_node_modules` to `True` to configure `npm_install` and/or +`yarn_install` to install `node_modules` inside the user workspace and have +Bazel use the `node_modules` folder in the user workspace for the build via a +symlink to the user's `node_modules` in the external repository it creates. ```python -workspace( - name = "my_wksp", - managed_directories = {"@npm": ["node_modules"]}, +load("@build_bazel_rules_nodejs//:index.bzl", "npm_install") + +npm_install( + name = "npm", + package_json = "//:package.json", + package_lock_json = "//:package-lock.json", + symlink_node_modules = True, ) ``` -As of Bazel 0.26 this feature is still experimental, so also add this line to the `.bazelrc` to opt-in: +You should now add the `@npm` workspace to the `managed_directories` option in +the `workspace` rule at the top of the file. This tells Bazel that the +`node_modules` directory is special and is managed by the package manager. Add +the `workspace` rule if it isn't already in your `/WORKSPACE` file. -``` -common --experimental_allow_incremental_repository_updates +```python +workspace( + name = "my_wksp", + managed_directories = {"@npm": ["node_modules"]}, +) ``` ### yarn_install vs. npm_install @@ -131,13 +158,7 @@ and npm deps, `yarn_install` (or `npm_install`) can be called separately for each. ```python -workspace( - name = "my_wksp", - managed_directories = { - "@app1_npm": ["app1/node_modules"], - "@app2_npm": ["app2/node_modules"], - }, -) +workspace(name = "my_wksp") yarn_install( name = "app1_npm", @@ -205,71 +226,37 @@ nodejs_binary( ) ``` -## Using self-managed dependencies - -If you'd like to have Bazel use the `node_modules` directory you are managing, -then next you will create a `BUILD.bazel` file in your project root containing: - -```python -package(default_visibility = ["//visibility:public"]) - -filegroup( - name = "node_modules", - srcs = glob( - include = ["node_modules/**/*"], - exclude = [ - # Files under test & docs may contain file names that - # are not legal Bazel labels (e.g., - # node_modules/ecstatic/test/public/δΈ­ζ–‡/ζͺ”ζ‘ˆ.html) - "node_modules/test/**", - "node_modules/docs/**", - # Files with spaces are not allowed in Bazel runfiles - # See https://github.com/bazelbuild/bazel/issues/4327 - "node_modules/**/* */**", - "node_modules/**/* *", - ], - ), -) -``` - -The example in `examples/user_managed_deps` uses self-managed dependencies. +## Using Bazel provisioned node, npm & yarn -To use the Yarn package manager, which we recommend for its built-in -verification command, you can run: +To run the version of node fetched by Bazel which defined in your WORKSPACE you +can use: ```sh -$ bazel run @nodejs//:yarn_node_repositories +$ bazel run @nodejs//:node -- ``` -If you use npm instead, run: +For example, -```sh -$ bazel run @nodejs//:npm_node_repositories install ``` - -The `@nodejs//:yarn_node_repositories` and `@nodejs//:npm_node_repositories` targets will run yarn/npm on all of the -package.json contexts listed `package_json` attribute of the `node_repositories` -repository rule in your WORKSPACE file (`node_repositories(package_json = [...])`). - -If there are multiple package.json contexts in this rule but you would like to -run the bazel managed yarn or npm on a single context this can be done -using the following targets: - -```sh -$ bazel run @nodejs//:yarn -- +$ bazel run @nodejs//:node -- --version +v16.12.0 ``` -If you use npm instead, run: +This will run node in the current working directory. + +To run the Bazel fetched npm and/or yarn you can use: ```sh +$ bazel run @yarn//:yarn -- $ bazel run @nodejs//:npm -- ``` -This will run yarn/npm in the current working directory. To add a package with the `yarn add` command, -for example, you would use: +This will run yarn/npm in the current working directory. + +For example, to add a package with the `yarn add` command you would run: ```sh -$ bazel run @nodejs//:yarn -- add +$ bazel run @yarn//:yarn -- add ``` Note: the arguments passed to `bazel run` after `--` are forwarded to the executable being run. diff --git a/docs/esbuild.html b/docs/esbuild.html deleted file mode 100755 index de02b583e3..0000000000 --- a/docs/esbuild.html +++ /dev/null @@ -1,558 +0,0 @@ - - - - - - - - - - rules_nodejs - esbuild - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
- -

esbuild rules for Bazel

- -

The esbuild rules runs the esbuild bundler tool with Bazel. -esbuild is an extremely fast JavaScript bundler written in Go, its current benchmarks show it can be 320x faster that other bundlers

- -

Installation

- -

Add the @bazel/esbuild npm packages to your devDependencies in package.json.

- -
npm install --save-dev @bazel/esbuild
-
-

or using yarn

-
yarn add -D @bazel/esbuild
-
- -

Add an http_archive fetching the esbuild binary for each platform that you need to support.

- -
_ESBUILD_VERSION = "0.11.6"  # reminder: update SHAs below when changing this value
-http_archive(
-    name = "esbuild_darwin",
-    urls = [
-        "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-%s.tgz" % _ESBUILD_VERSION,
-    ],
-    strip_prefix = "package",
-    build_file_content = """exports_files(["bin/esbuild"])""",
-    sha256 = "2b06365b075b854654fc9ed26fcd48a0c38947e1c8d5151ce400cd1e173bb138",
-)
-
-http_archive(
-    name = "esbuild_windows",
-    urls = [
-        "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-%s.tgz" % _ESBUILD_VERSION,
-    ],
-    strip_prefix = "package",
-    build_file_content = """exports_files(["esbuild.exe"])""",
-    sha256 = "ddab1121833f0a12ca4fb3e288231e058f5526310671e84c0a9aa575340bb20b",
-)
-
-http_archive(
-    name = "esbuild_linux",
-    urls = [
-        "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-%s.tgz" % _ESBUILD_VERSION,
-    ],
-    strip_prefix = "package",
-    build_file_content = """exports_files(["bin/esbuild"])""",
-    sha256 = "34612e3e15e6c31d9d742d3fd677bd5208b7e5c0ee9c93809999138c6c5c1039",
-)
-
- -

These can then be referenced on the tool attribute of the esbuild rule.

- -
esbuild(
-    name = "bundle",
-    ...
-    tool = select({
-        "@bazel_tools//src/conditions:darwin": "@esbuild_darwin//:bin/esbuild",
-        "@bazel_tools//src/conditions:windows": "@esbuild_windows//:esbuild.exe",
-        "@bazel_tools//src/conditions:linux_x86_64": "@esbuild_linux//:bin/esbuild",
-    }),
-)
-
- -

It might be useful to wrap this locally in a macro for better reuseability, see packages/esbuild/test/tests.bzl for an example.

- -

The esbuild rule can take a JS or TS dependency tree and bundle it to a single file, or split across multiple files, outputting a directory.

- -
load("@npm//@bazel/esbuild:index.bzl", "esbuild")
-load("@npm//@bazel/typescript:index.bzl", "ts_library")
-
-ts_library(
-    name = "lib",
-    srcs = ["a.ts"],
-)
-
-esbuild(
-    name = "bundle",
-    entry_point = "a.ts",
-    deps = [":lib"],
-)
-
- -

The above will create three output files, bundle.js, bundle.js.map and bundle_metadata.json which contains the bundle metadata to aid in debugging and resoloution tracing.

- -

To create a code split bundle, set splitting = True on the esbuild rule.

- -
load("@npm//@bazel/esbuild:index.bzl", "esbuild")
-load("@npm//@bazel/typescript:index.bzl", "ts_library")
-
-ts_library(
-    name = "lib",
-    srcs = ["a.ts"],
-    deps = [
-        "@npm//foo",
-    ],
-)
-
-esbuild(
-    name = "bundle",
-    entry_point = "a.ts",
-    deps = [":lib"],
-    splitting = True,
-)
-
- -

This will create an output directory containing all the code split chunks, along with their sourcemaps files

- -

esbuild

- -

USAGE

- -
-esbuild(name, args, define, deps, entry_point, external, format, launcher, link_workspace_root,
-        max_threads, minify, output, output_css, output_dir, output_map, platform, sourcemap,
-        sources_content, srcs, target, tool)
-
- -

Runs the esbuild bundler under Bazel

- -

For further information about esbuild, see https://esbuild.github.io/

- -

ATTRIBUTES

- -

name

- -

(Name, mandatory): A unique name for this target.

- -

args

- -

(List of strings): A list of extra arguments that are included in the call to esbuild. - $(location …) can be used to resolve the path to a Bazel target.

- -

Defaults to []

- -

define

- -

(List of strings): A list of global identifier replacements. -Example:

-
esbuild(
-    name = "bundle",
-    define = [
-        "process.env.NODE_ENV=\"production\""
-    ],
-)
-
- -

See https://esbuild.github.io/api/#define for more details

- -

Defaults to []

- -

deps

- -

(List of labels): A list of direct dependencies that are required to build the bundle

- -

Defaults to []

- -

entry_point

- -

(Label, mandatory): The bundle’s entry point (e.g. your main.js or app.js or index.js)

- -

external

- -

(List of strings): A list of module names that are treated as external and not included in the resulting bundle

- -

See https://esbuild.github.io/api/#external for more details

- -

Defaults to []

- -

format

- -

(String): The output format of the bundle, defaults to iife when platform is browser -and cjs when platform is node. If performing code splitting, defaults to esm.

- -

See https://esbuild.github.io/api/#format for more details

- -

Defaults to ""

- -

launcher

- -

(Label, mandatory): Internal use only

- - - -

(Boolean): Link the workspace root to the bin_dir to support absolute requires like β€˜my_wksp/path/to/file’. - If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

- -

Defaults to False

- -

max_threads

- -

(Integer): Sets the GOMAXPROCS variable to limit the number of threads that esbuild can run with. -This can be useful if running many esbuild rule invocations in parallel, which has the potential to cause slowdown. -For general use, leave this attribute unset.

- -

Defaults to 0

- -

minify

- -

(Boolean): Minifies the bundle with the built in minification. -Removes whitespace, shortens identifieres and uses equivalent but shorter syntax.

- -

Sets all –minify-* flags

- -

See https://esbuild.github.io/api/#minify for more details

- -

Defaults to False

- -

output

- -

(Label): Name of the output file when bundling

- -

output_css

- -

(Label): Declare a .css file will be output next to output bundle.

- -

If your JS code contains import statements that import .css files, esbuild will place the -content in a file next to the main output file, which you’ll need to declare. If your output -file is named β€˜foo.js’, you should set this to β€˜foo.css’.

- -

output_dir

- -

(Boolean): If true, esbuild produces an output directory containing all the output files from code splitting

- -

See https://esbuild.github.io/api/#splitting for more details

- -

Defaults to False

- -

output_map

- -

(Label): Name of the output source map when bundling

- -

platform

- -

(String): The platform to bundle for.

- -

See https://esbuild.github.io/api/#platform for more details

- -

Defaults to "browser"

- -

sourcemap

- -

(String): Defines where sourcemaps are output and how they are included in the bundle. By default, a separate .js.map file is generated and referenced by the bundle. If β€˜external’, a separate .js.map file is generated but not referenced by the bundle. If β€˜inline’, a sourcemap is generated and its contents are inlined into the bundle (and no external sourcemap file is created). If β€˜both’, a sourcemap is inlined and a .js.map file is created.

- -

See https://esbuild.github.io/api/#sourcemap for more details

- -

Defaults to ""

- -

sources_content

- -

(Boolean): If False, omits the sourcesContent field from generated source maps

- -

See https://esbuild.github.io/api/#sources-content for more details

- -

Defaults to False

- -

srcs

- -

(List of labels): Source files to be made available to esbuild

- -

Defaults to []

- -

target

- -

(String): Environment target (e.g. es2017, chrome58, firefox57, safari11, -edge16, node10, esnext). Default es2015.

- -

See https://esbuild.github.io/api/#target for more details

- -

Defaults to "es2015"

- -

tool

- -

(Label, mandatory): An executable for the esbuild binary

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/esbuild.md b/docs/esbuild.md index 5f69c99308..21c7900afd 100755 --- a/docs/esbuild.md +++ b/docs/esbuild.md @@ -1,21 +1,15 @@ ---- -title: esbuild -layout: default -toc: true -nav: rule ---- + # esbuild rules for Bazel The esbuild rules runs the [esbuild](https://github.com/evanw/esbuild) bundler tool with Bazel. esbuild is an extremely fast JavaScript bundler written in Go, its [current benchmarks](https://esbuild.github.io/faq/#benchmark-details) show it can be 320x faster that other bundlers - ## Installation Add the `@bazel/esbuild` npm packages to your `devDependencies` in `package.json`. @@ -28,64 +22,43 @@ or using yarn yarn add -D @bazel/esbuild ``` -Add an `http_archive` fetching the esbuild binary for each platform that you need to support. +The esbuild binary is fetched automatically for your platform and is exposed via Bazel toolchains. +To do this, add the `esbuild_repositories` rule to your `WORKSPACE`. +You'll need to point it to the repository created by npm_install or yarn_install where the `@bazel/esbuild` +package is fetched. (Typically, this is `npm`). +Set the `npm_repository` attribute to the name of that repository. ```python -_ESBUILD_VERSION = "0.11.6" # reminder: update SHAs below when changing this value -http_archive( - name = "esbuild_darwin", - urls = [ - "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-%s.tgz" % _ESBUILD_VERSION, - ], - strip_prefix = "package", - build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "2b06365b075b854654fc9ed26fcd48a0c38947e1c8d5151ce400cd1e173bb138", +npm_install( + name = "npm", + # @bazel/esbuild is a dependency in this package.json + package_json = "//:package.json", + package_lock_json = "//:package-lock.json", ) -http_archive( - name = "esbuild_windows", - urls = [ - "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-%s.tgz" % _ESBUILD_VERSION, - ], - strip_prefix = "package", - build_file_content = """exports_files(["esbuild.exe"])""", - sha256 = "ddab1121833f0a12ca4fb3e288231e058f5526310671e84c0a9aa575340bb20b", -) +load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories") -http_archive( - name = "esbuild_linux", - urls = [ - "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-%s.tgz" % _ESBUILD_VERSION, - ], - strip_prefix = "package", - build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "34612e3e15e6c31d9d742d3fd677bd5208b7e5c0ee9c93809999138c6c5c1039", -) +esbuild_repositories(npm_repository = "npm") ``` -These can then be referenced on the `tool` attribute of the `esbuild` rule. +> To avoid eagerly fetching all the npm dependencies, this load statement comes from the "Built-in" +> `@build_bazel_rules_nodejs` repository rather than from `@npm`. +> In rules_nodejs 5.0 we intend to fix this layering violation by having the whole esbuild support +> distributed independently of rules_nodejs, and not require any package to be installed from npm. -```python -esbuild( - name = "bundle", - ... - tool = select({ - "@bazel_tools//src/conditions:darwin": "@esbuild_darwin//:bin/esbuild", - "@bazel_tools//src/conditions:windows": "@esbuild_windows//:esbuild.exe", - "@bazel_tools//src/conditions:linux_x86_64": "@esbuild_linux//:bin/esbuild", - }), -) -``` +See the API docs for `esbuild_repositories` for ways to customize how Bazel downloads the esbuild package +from npm. Alternatively, advanced users can override the download altogether by defining the esbuild repository +earlier in your WORKSPACE file, so that the `maybe` inside `esbuild_repositories` is skipped. -It might be useful to wrap this locally in a macro for better reuseability, see `packages/esbuild/test/tests.bzl` for an example. +## Overview The `esbuild` rule can take a JS or TS dependency tree and bundle it to a single file, or split across multiple files, outputting a directory. ```python load("@npm//@bazel/esbuild:index.bzl", "esbuild") -load("@npm//@bazel/typescript:index.bzl", "ts_library") +load("@npm//@bazel/typescript:index.bzl", "ts_project") -ts_library( +ts_project( name = "lib", srcs = ["a.ts"], ) @@ -103,9 +76,9 @@ To create a code split bundle, set `splitting = True` on the `esbuild` rule. ```python load("@npm//@bazel/esbuild:index.bzl", "esbuild") -load("@npm//@bazel/typescript:index.bzl", "ts_library") +load("@npm//@bazel/typescript:index.bzl", "ts_project") -ts_library( +ts_project( name = "lib", srcs = ["a.ts"], deps = [ @@ -129,9 +102,10 @@ This will create an output directory containing all the code split chunks, along **USAGE**
-esbuild(name, args, define, deps, entry_point, external, format, launcher, link_workspace_root,
-        max_threads, minify, output, output_css, output_dir, output_map, platform, sourcemap,
-        sources_content, srcs, target, tool)
+esbuild(name, args, args_json, config, define, define_settings, deps, entry_point, entry_points,
+        external, format, launcher, link_workspace_root, max_threads, metafile, minify, output,
+        output_css, output_dir, output_map, platform, sourcemap, sources_content, splitting, srcs,
+        stamp, target)
 
Runs the esbuild bundler under Bazel @@ -149,27 +123,68 @@ For further information about esbuild, see https://esbuild.github.io/

args

-(*List of strings*): A list of extra arguments that are included in the call to esbuild. - $(location ...) can be used to resolve the path to a Bazel target. +(*Dictionary: String -> String*): A dict of extra arguments that are included in the call to esbuild, where the key is the argument name. +Values are subject to $(location ...) expansion -Defaults to `[]` +Defaults to `{}` + +

args_json

+ +(*String*): Internal use only + +Defaults to `""` + +

config

+ +(*Label*): Configuration file used for esbuild, from the esbuild_config macro. Note that options set in this file may get overwritten. +See https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/esbuild/test/plugins/BUILD.bazel for examples of using esbuild_config and plugins. The dependencies of this attribute must provide: Unknown Provider + + +Defaults to `None`

define

-(*List of strings*): A list of global identifier replacements. +(*Dictionary: String -> String*): A dict of global identifier replacements. Values are subject to $(location ...) expansion. Example: ```python esbuild( name = "bundle", - define = [ - "process.env.NODE_ENV=\"production\"" - ], + define = { + "process.env.NODE_ENV": "production" + }, ) ``` See https://esbuild.github.io/api/#define for more details -Defaults to `[]` +Defaults to `{}` + +

define_settings

+ +(*Dictionary: Label -> String*): A dict of labels of Starlark build settings and identifiers to be replaced with their values. +Example: +```python +load("@bazel_skylib//rules:common_settings.bzl", "string_flag") + +string_flag( + name = "api_endpoint", + build_setting_default = "https://example.com/v1", +) + +esbuild( + name = "bundle", + define_settings = { + ":api_endpoint": "API_ENDPOINT", + }, +) +``` + +The build setting has to provide [`BuildSettingInfo`](https://github.com/bazelbuild/bazel-skylib/blob/6e30a77347071ab22ce346b6d20cf8912919f644/rules/common_settings.bzl#L24). +The value is automatically converted to a JS literal. +See https://docs.bazel.build/versions/main/skylark/config.html#predefined-settings for more details on Starlark build settings. The dependencies of this attribute must provide: Unknown Provider + + +Defaults to `{}`

deps

@@ -179,8 +194,20 @@ Defaults to `[]`

entry_point

-(*Label, mandatory*): The bundle's entry point (e.g. your main.js or app.js or index.js) +(*Label*): The bundle's entry point (e.g. your main.js or app.js or index.js) + +This is a shortcut for the `entry_points` attribute with a single entry. +Specify either this attribute or `entry_point`, but not both. + +Defaults to `None` + +

entry_points

+(*List of labels*): The bundle's entry points (e.g. your main.js or app.js or index.js) + +Specify either this attribute or `entry_point`, but not both. + +Defaults to `[]`

external

@@ -193,7 +220,7 @@ Defaults to `[]`

format

(*String*): The output format of the bundle, defaults to iife when platform is browser -and cjs when platform is node. If performing code splitting, defaults to esm. +and cjs when platform is node. If performing code splitting or multiple entry_points are specified, defaults to esm. See https://esbuild.github.io/api/#format for more details @@ -219,6 +246,12 @@ For general use, leave this attribute unset. Defaults to `0` +

metafile

+ +(*Boolean*): if true, esbuild creates a metafile along the output + +Defaults to `True` +

minify

(*Boolean*): Minifies the bundle with the built in minification. @@ -246,9 +279,7 @@ file is named 'foo.js', you should set this to 'foo.css'.

output_dir

-(*Boolean*): If true, esbuild produces an output directory containing all the output files from code splitting - -See https://esbuild.github.io/api/#splitting for more details +(*Boolean*): If true, esbuild produces an output directory containing all output files Defaults to `False` @@ -281,24 +312,174 @@ See https://esbuild.github.io/api/#sources-content for more details Defaults to `False` +

splitting

+ +(*Boolean*): If true, esbuild produces an output directory containing all the output files from code splitting for multiple entry points + +See https://esbuild.github.io/api/#splitting and https://esbuild.github.io/api/#entry-points for more details + +Defaults to `False` +

srcs

(*List of labels*): Source files to be made available to esbuild Defaults to `[]` +

stamp

+ +(*Label*): Whether to encode build information into the output. Possible values: + - `@rules_nodejs//nodejs/stamp:always`: + Always stamp the build information into the output, even in [--nostamp][stamp] builds. + This setting should be avoided, since it potentially causes cache misses remote caching for + any downstream actions that depend on it. + - `@rules_nodejs//nodejs/stamp:never`: + Always replace build information by constant values. This gives good build result caching. + - `@rules_nodejs//nodejs/stamp:use_stamp_flag`: + Embedding of build information is controlled by the [--[no]stamp][stamp] flag. + Stamped binaries are not rebuilt unless their dependencies change. + [stamp]: https://docs.bazel.build/versions/main/user-manual.html#flag--stamp The dependencies of this attribute must provide: StampSettingInfo + + +Defaults to `@rules_nodejs//nodejs/stamp:use_stamp_flag` +

target

-(*String*): Environment target (e.g. es2017, chrome58, firefox57, safari11, +(*String*): Environment target (e.g. es2017, chrome58, firefox57, safari11, edge16, node10, esnext). Default es2015. See https://esbuild.github.io/api/#target for more details Defaults to `"es2015"` -

tool

-(*Label, mandatory*): An executable for the esbuild binary +## configure_esbuild_toolchain + +**USAGE** + +
+configure_esbuild_toolchain(name, binary, exec_compatible_with)
+
+ +Defines a toolchain for esbuild given the binary path and platform constraints + +**PARAMETERS** + + +

name

+ +unique name for this toolchain, generally in the form "esbuild_platform_arch" + + + +

binary

+ +label for the esbuild binary + + + +

exec_compatible_with

+ +list of platform constraints + + + + +## esbuild_config + +**USAGE** + +
+esbuild_config(name, config_file, srcs, deps, kwargs)
+
+ +Macro for an esbuild configuration file and its assoicated dependencies + +**PARAMETERS** + + +

name

+ +Unique name for this rule + + + +

config_file

+ +The configuration file / entrypoint + + + +

srcs

+ +List of source files referenced by the configuration + +Defaults to `[]` + +

deps

+ +List of dependencies required for this configuration + +Defaults to `[]` + +

kwargs

+ +Any other common attributes + + + + +## esbuild_repositories + +**USAGE** + +
+esbuild_repositories(npm_repository, name, npm_args, kwargs)
+
+ +Helper for fetching and setting up the esbuild versions and toolchains + +This uses Bazel's downloader (via `http_archive`) to fetch the esbuild package +from npm, separately from any `npm_install`/`yarn_install` in your WORKSPACE. +To configure where the download is from, you make a file containing a rewrite rule like + + rewrite (registry.nodejs.org)/(.*) artifactory.build.internal.net/artifactory/$1/$2 + +You can find some documentation on the rewrite patterns in the Bazel sources: +[UrlRewriterConfig.java](https://github.com/bazelbuild/bazel/blob/4.2.1/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/UrlRewriterConfig.java#L66) + +Then use the `--experimental_downloader_config` Bazel option to point to your file. +For example if you created `.bazel_downloader_config` you might add to your `.bazelrc` file: + + common --experimental_downloader_config=.bazel_downloader_config + + +**PARAMETERS** + + +

npm_repository

+ +the name of the repository where the @bazel/esbuild package is installed +by npm_install or yarn_install. + + + +

name

+ +currently unused + +Defaults to `""` + +

npm_args

+ +additional args to pass to the npm install rule + +Defaults to `[]` + +

kwargs

+ +additional named parameters to the npm_install rule + diff --git a/docs/examples.html b/docs/examples.html deleted file mode 100755 index ad8ed835e0..0000000000 --- a/docs/examples.html +++ /dev/null @@ -1,467 +0,0 @@ - - - - - - - - - - rules_nodejs - Examples - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Examples

- -

Frameworks

- -

Angular

- -

Bazel can run any toolchain you want, so there is more than one way to use it with Angular. -See Alex’s post Angular ❀️ Bazel update for a longer explanation.

- -

Architect: The first approach is the simplest: use Architect (aka. Angular CLI Builders). This is the build tool inside of Angular CLI, so your existing application will continue to work the same way, and you can still get support from the Angular team. This may be a good choice if your goal is just to include an Angular app in a full-stack Bazel build that includes your backend, and making the Angular build&test faster is not important for you.

- -

However, it has the worst performance because the level of incrementality is only as fine as how many libs your application is composed from. -Bazel can only make a build more parallel and incremental if you express a wider dependency graph to it.

- -

Example: examples/angular_bazel_architect

- -

Google: This toolchain is what we originally advertised as β€œAngular Buildtools Convergence” (ABC). It is based on Google’s internal toolchain for building Angular, and has good performance characteristics. However it is harder to migrate to, because it doesn’t have good compatibility for existing applications.

- -

The example has its own guide: examples/angular

- -

View Engine: If you’re stuck on the older Angular compiler/runtime before Ivy, called View Engine, then your options are more limited. We don’t support Angular 9 + View Engine + Bazel.

- -

Example: examples/angular_view_engine

- -

Custom: Bazel is excellent for advanced use cases where you need to customize your toolchain. -Take any off-the-shelf tools, follow their README’s to call their CLI, and assemble them together in a custom way. -This lets you take advantage of the latest JS ecosystem innovations without waiting for tooling vendors to -assemble it all together for you.

- -

React

- -

Similar to the explanation above for Angular, Bazel is agnostic to what tools you choose to run on your project. -However, the benefits of using Bazel are unlocked as you adopt it as your build system. -We think the following examples show a typical migration of adopting Bazel:

- -

create-react-app: If you run create-react-app, it will install a build system called react-scripts. -As a first step into Bazel, you can simply ask Bazel to wrap the existing build system. -This guarantees compatibility with your current code, and if your objective is just to include a frontend app into -a bigger full-stack Bazel build, this might be the final step in the migration. -However it will run react-scripts as a single Bazel action, which means that you gain no incrementality benefit. -So we expect for most applications this is just a first step.

- -

The create-react-app example -shows how this will look. We suggest reading the README in that example, and also look at the commit history to that -directory as an illustration of how we started from create-react-app and added Bazel bits.

- -

react-scripts-like: As a next step to make our Build more incremental and performant, we can replace the react-scripts build system with Bazel, but preserve compatibility as much as possible by having Bazel run -mostly the same tools with mostly identical configuration. We continue to transpile TS to JS using Babel, for example, -but we do it in a build step before invoking Webpack, just using the Babel CLI.

- -

This is a good middle ground to get some benefits from Bazel while staying on the same supported tools as react-scripts.

- -

TODO(alexeagle): build an example illustrating how this looks

- -

custom: If you really know your JS build tools, Bazel is the perfect way to assemble all the myriad individual tools -into a custom toolchain. This allows you to unlock any part of the JS ecosystem without waiting for it to be integrated -for you by maintainers of a project like create-react-app, who have a very high bar for adding features since the -maintenance and support burden falls on them. However you’ll need to understand both the tools as well as Bazel to -successfully build your own toolchain.

- -

There is a basic example at examples/react_webpack but it needs a lot more work to show everything that is possible!

- -

Vue

- -

We don’t have a dedicated example yet, but Vue has been known to work. Follow https://github.com/bazelbuild/rules_nodejs/issues/1840 for an example.

- -

Svelte

- -

None yet, please file an issue if you need this.

- -

Test Runners

- -

Jest

- -

There is a dedicated example for Jest: examples/jest

- -

Cypress

- -

We have done some early work to run Cypress under Bazel. Follow https://github.com/bazelbuild/rules_nodejs/issues/1904 for an example.

- -

Mocha

- -

Example at examples/webapp has a simple mocha_test

- -

Karma and Protractor

- -

See Protractor usage in examples/app

- -

Bundlers

- -

Webpack

- -

See examples/react_webpack

- -

Rollup

- -

The example at examples/webapp uses Rollup, and produces an app with ES5 and ES2015 variants (β€œdifferential loading”) that gives faster loading in modern browsers without dropping support for legacy ones.

- -

Parcel

- -

The example in examples/parcel shows how to write a custom rule, it happens to use the parcel binary to build. It’s a very minimal example but might be enough to get you started.

- -

Language tooling

- -

LESS, Sass, Stylus

- -

See styles directory inside the examples/app example.

- -

TypeScript

- -

Most of the examples show TypeScript usage. Also look in packages/typescript/test for lots of handling of edge cases.

- -

Kotlin

- -

The Kotlin language can compile to JS. The result has a very large stdlib JS payload, so we don’t recommend this for most uses.

- -

Example at examples/kotlin

- -

Google Closure Compiler

- -

rules_closure is a whole-cloth approach to using Bazel if you’re fully bought-into the Closure ecosystem.

- -

examples/closure shows a very simple way to call the closure compiler without jumping into that ecosystem.

- -

Protocol Buffers and gRPC

- -

Note: this is under active development. Come chat in the #javascript channel on Slack to get the latest. -Support and stability are not great but expected to improve.

- -

There are many alternative implementations for protobuf and RPC. -We generally intend to support all of them, with a small layer in rules_nodejs that allows you to build around any of those tools.

- -

https://github.com/rules-proto-grpc/rules_proto_grpc is an excellent, broad ruleset based on the tooling from http://grpc.io. We may point to this as the canonical example in the future.

- -

The @bazel/labs package has an experimental ts_proto_library rule. -It integrates with the β€œconcatjs” bundler and is suitable for projects using ts_library. -However it’s not clear whether this will be promoted to a stable API. -See the example in examples/protocol_buffers

- -

protobuf.js from https://github.com/dcodeIO is a simple alternative. -See the example in examples/protobufjs

- -

Bazel-specific

- -

Bazel Persistent Workers

- -

If you want to speed up Bazel by keeping some tools running warm in the background as daemons, there’s a good readme in the examples/worker

- -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/examples.md b/docs/examples.md index 8944c5e59b..a6ed4ee35f 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -5,6 +5,10 @@ toc: true --- # Examples +> 🚨 rules_nodejs is now mostly unmaintained! 🚨 +> +> See the Maintenance Update in the [root README](https://github.com/bazelbuild/rules_nodejs#maintenance-update) + ## Frameworks ### Angular @@ -23,10 +27,6 @@ Example: [examples/angular_bazel_architect](https://github.com/bazelbuild/rules_ The example has its own guide: [examples/angular](https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular) -**View Engine**: If you're stuck on the older Angular compiler/runtime before Ivy, called View Engine, then your options are more limited. We don't support Angular 9 + View Engine + Bazel. - -Example: [examples/angular_view_engine](https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular_view_engine) - **Custom**: Bazel is excellent for advanced use cases where you need to customize your toolchain. Take any off-the-shelf tools, follow their README's to call their CLI, and assemble them together in a custom way. This lets you take advantage of the latest JS ecosystem innovations without waiting for tooling vendors to @@ -67,7 +67,7 @@ There is a basic example at [examples/react_webpack](https://github.com/bazelbui ### Vue -We don't have a dedicated example yet, but Vue has been known to work. Follow https://github.com/bazelbuild/rules_nodejs/issues/1840 for an example. +We don't have a dedicated example yet, but Vue has been known to work. Follow for an example. ### Svelte @@ -81,7 +81,7 @@ There is a dedicated example for Jest: [examples/jest](https://github.com/bazelb ### Cypress -We have done some early work to run Cypress under Bazel. Follow https://github.com/bazelbuild/rules_nodejs/issues/1904 for an example. +We have done some early work to run Cypress under Bazel. Follow for an example. ### Mocha @@ -129,20 +129,21 @@ Example at [examples/kotlin](https://github.com/bazelbuild/rules_nodejs/tree/sta ### Protocol Buffers and gRPC -Note: this is under active development. Come chat in the #javascript channel on Slack to get the latest. -Support and stability are not great but expected to improve. +rules_nodejs doesn't provide any support for protos or gRPC. +Even outside Bazel, there are many alternative implementations for them, all the way from protoc plugins, code generation, type-checking, and runtime support. +Under Bazel there are many options for each of these, and they don't have good compatibility with each other. + +Sadly Google isn't driving the ecosystem to shared solutions, so there is tremendous fragmentation. This isn't a problem rules_nodejs can solve with the resources we have. +We can't even provide useful guidance about which alternatives to use. -There are many alternative implementations for protobuf and RPC. -We generally intend to support all of them, with a small layer in rules_nodejs that allows you to build around any of those tools. + is undergoing a rewrite to version 2. +Check for a BazelCon 2021 talk by @pcj about it. - is an excellent, broad ruleset based on the tooling from . We may point to this as the canonical example in the future. + is a fork of stackb/rules_proto that has become popular. -The `@bazel/labs` package has an experimental `ts_proto_library` rule. -It integrates with the "concatjs" bundler and is suitable for projects using `ts_library`. -However it's not clear whether this will be promoted to a stable API. -See the example in [examples/protocol_buffers](https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/protocol_buffers) + seems promising. -[protobuf.js](https://github.com/protobufjs/protobuf.js) from https://github.com/dcodeIO is a simple alternative. +[protobuf.js](https://github.com/protobufjs/protobuf.js) from is a simple alternative. See the example in [examples/protobufjs](https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/protobufjs) ## Bazel-specific diff --git a/docs/images/bazel-icon.png b/docs/images/bazel-icon.png deleted file mode 100644 index ac74e82c44..0000000000 Binary files a/docs/images/bazel-icon.png and /dev/null differ diff --git a/docs/images/bazel-icon.svg b/docs/images/bazel-icon.svg deleted file mode 100755 index aab543e929..0000000000 --- a/docs/images/bazel-icon.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/docs/images/bazel-logo.png b/docs/images/bazel-logo.png deleted file mode 100644 index e43cfd0cea..0000000000 Binary files a/docs/images/bazel-logo.png and /dev/null differ diff --git a/docs/images/bazel-logo.svg b/docs/images/bazel-logo.svg deleted file mode 100644 index 3e6799a049..0000000000 --- a/docs/images/bazel-logo.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/docs/images/bazel-navbar.svg b/docs/images/bazel-navbar.svg deleted file mode 100644 index 8a0f6db853..0000000000 --- a/docs/images/bazel-navbar.svg +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/images/bazel-og-image.png b/docs/images/bazel-og-image.png deleted file mode 100644 index 25b634945d..0000000000 Binary files a/docs/images/bazel-og-image.png and /dev/null differ diff --git a/docs/images/favicon-16x16.png b/docs/images/favicon-16x16.png deleted file mode 100644 index 587a8aa320..0000000000 Binary files a/docs/images/favicon-16x16.png and /dev/null differ diff --git a/docs/images/favicon-32x32.png b/docs/images/favicon-32x32.png deleted file mode 100644 index a0fc9448e9..0000000000 Binary files a/docs/images/favicon-32x32.png and /dev/null differ diff --git a/docs/images/favicon.ico b/docs/images/favicon.ico deleted file mode 100755 index 507f14faec..0000000000 Binary files a/docs/images/favicon.ico and /dev/null differ diff --git a/docs/index.html b/docs/index.html deleted file mode 100755 index bcce701c2b..0000000000 --- a/docs/index.html +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - - - - - rules_nodejs - Home - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Bazel JavaScript rules

- -

Bazel is Google’s build system. -It powers our development at large scale by caching intermediate build artifacts, -allowing build and test to be incremental and massively parallelizable. -Read more at https://bazel.build

- -

This JavaScript support lets you build and test code that targets a JavaScript runtime, including NodeJS and browsers.

- -

Scope of the project

- -

This repository contains an orthogonal set of rules which covers an opinionated toolchain for JavaScript development. If you would like to request a new rule, please open a feature request, describe your use case, why it’s important, and why you can’t do it within the existing rules. Then the maintainers can decide if it is within the scope of the project and will have a large enough impact to warrant the time required to implement.

- -

If you would like to write a rule outside the scope of the projects we recommend hosting them in your GitHub account or the one of your organization.

- -

Design

- -

Most bazel rules include package management. That is, the WORKSPACE file installs both your dependencies and toolchain at the same time. For example, in Java, Gradle and Maven they each install both a build tool and a package at the same time.

- -

In nodejs, there are a variety of package managers and build tools which can interoperate. Also, there is a well-known package installation location (node_modules directory in your project). Command-line and other tools look in this directory to find packages. So we must either download packages twice (risking version skew between them) or point all tools to Bazel’s external directory with NODE_PATH which would be very inconvenient.

- -

Instead, our philosophy is: in the NodeJS ecosystem, Bazel is only a build tool. It is up to the user to install packages into their node_modules directory, though the build tool can verify the contents.

- -

Hermeticity and reproducibility

- -

Bazel generally guarantees builds are correct with respect to their inputs. For example, this means that given the same source tree, you can re-build the same artifacts as an earlier release of your program. In the nodejs rules, Bazel is not the package manager, so some responsibility falls to the developer to avoid builds that use the wrong dependencies. This problem exists with any build system in the JavaScript ecosystem.

- -

Both NPM and Yarn have a lockfile, which ensures that dependencies only change when the lockfile changes. Users are strongly encouraged to use the locking mechanism in their package manager.

- -

References:

- - - -

Note that https://github.com/bazelbuild/rules_nodejs/issues/1 will take the guarantee further: by using the lockfile as an input to Bazel, the nodejs rules can verify the integrity of the dependencies. This would make it impossible for a build to be non-reproducible, so long as you have the same lockfile.

- -

Quickstart

- -

First we create a new workspace, which will be in a new directory. -We can use the @bazel/create npm package to do this in one command. -This is the fastest way to get started for most use cases.

- -
-

See the installation page for details and alternative methods.

-
- -
$ npm init @bazel my_workspace
-$ cd my_workspace
-
- -
-

You could do the same thing with yarn:

-
$ yarn create @bazel my_workspace
-$ cd my_workspace
-
-

Both of these commands are equivalent to npx @bazel/create which downloads the latest version of the @bazel/create package from npm and runs the program it contains. -Run the tool with no arguments for command-line options and next steps.

-
- -

Next we install some development tools. -For this example, we’ll use Babel to transpile our JavaScript, Mocha for running tests, and http-server to serve our app. -These are arbitrary choices, you may use whatever are your favorites.

- -
$ npm install @babel/core @babel/cli @babel/preset-env http-server mocha domino
-
- -

Let’s run these tools with Bazel. There are two ways to run tools:

- -
    -
  • Use an auto-generated Bazel rule by importing from an index.bzl file in the npm package
  • -
  • Use a custom rule in rules_nodejs or write one yourself
  • -
- -

In this example we use the auto-generated rules. -First we need to import them, using a load statement. -So edit BUILD.bazel and add:

- -
load("@npm//@babel/cli:index.bzl", "babel")
-load("@npm//mocha:index.bzl", "mocha_test")
-load("@npm//http-server:index.bzl", "http_server")
-
- -
-

This shows us that rules_nodejs has told Bazel that a workspace named @npm is available -(think of the at-sign like a scoped package for Bazel). -rules_nodejs will add index.bzl files exposing all the binaries the package manager installed -(the same as the content of the node_modules/.bin folder). -The three tools we installed are in this @npm scope and each has an index file with a .bzl extension.

-
- -

Next we teach Bazel how to transform our JavaScript inputs into transpiled outputs. -Here we assume that you have app.js and es5.babelrc in your project. See our example webapp for an example of what those files might look like. -Now we want Babel to produce app.es5.js so we add to BUILD.bazel:

- -
babel(
-    name = "compile",
-    data = [
-        "app.js",
-        "es5.babelrc",
-        "@npm//@babel/preset-env",
-    ],
-    outs = ["app.es5.js"],
-    args = [
-        "app.js",
-        "--config-file",
-        "./$(execpath es5.babelrc)",
-        "--out-file",
-        "$(execpath app.es5.js)",
-    ],
-)
-
- -
-

This just calls the Babel CLI, so you can see their documentation for what arguments to pass. -We use the $(execpath) helper in Bazel so we don’t need to hardcode paths to the inputs or outputs.

-
- -

We can now build the application: npm run build

- -

and we see the .js outputs from babel appear in the dist/bin folder.

- -

Let’s serve the app to see how it looks, by adding to BUILD.bazel:

- -
http_server(
-    name = "server",
-    data = [
-        "index.html",
-        "app.es5.js",
-    ],
-    args = ["."],
-)
-
- -

Add a serve entry to the scripts in package.json:

- -
{
-  "scripts": {
-    "serve": "ibazel run :server"
-  }
-}
-
- -
-

ibazel is the watch mode for bazel.

- -

Note that on Windows, you need to pass --enable_runfiles flag to Bazel. -That’s because Bazel creates a directory where inputs and outputs both conveniently appear together.

-
- -

Now we can serve the app: npm run serve

- -

Finally we’ll add a test using Mocha, and the domino package so we don’t need a browser. Add to BUILD.bazel:

- -
mocha_test(
-    name = "unit_tests",
-    args = ["*.spec.js"],
-    data = glob(["*.spec.js"]) + [
-        "@npm//domino",
-        "app.es5.js",
-    ],
-)
-
- -

Run the tests: npm test

- -

Next steps

- -

Look through the /examples directory in this repo for many examples of running tools under Bazel.

- -

You might want to look through the API docs for custom rules such as TypeScript, Rollup, and Terser which add support beyond what you get from calling the CLI of those tools.

- -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/index.md b/docs/index.md index 88567b538b..6889df988d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,41 +6,70 @@ toc: true # Bazel JavaScript rules -Bazel is Google's build system. -It powers our development at large scale by caching intermediate build artifacts, -allowing build and test to be incremental and massively parallelizable. -Read more at [https://bazel.build](https://bazel.build) - -This JavaScript support lets you build and test code that targets a JavaScript runtime, including NodeJS and browsers. +Bazel rules to build and test code that targets a JavaScript runtime, including NodeJS and browsers. +> 🚨 rules_nodejs is now mostly unmaintained! 🚨 +> +> See the Maintenance Update in the [root README](https://github.com/bazelbuild/rules_nodejs#maintenance-update) ## Scope of the project -This repository contains an orthogonal set of rules which covers an opinionated toolchain for JavaScript development. If you would like to request a new rule, please open a [feature request](https://github.com/bazelbuild/rules_nodejs/issues/new), describe your use case, why it's important, and why you can't do it within the existing rules. Then the maintainers can decide if it is within the scope of the project and will have a large enough impact to warrant the time required to implement. +This repository contains three layers: + +1. The `@rules_nodejs` Bazel module, also referred to as the "core". +This contains a toolchain that fetches a hermetic node, npm, and yarn (independent of what's on the developer's machine), +and Bazel Providers to allow interop between JS rules. +It is currently useful for Bazel Rules developers who want to make their own JavaScript support, and +is maintained by community volunteers from [Aspect](https://aspect.dev). + - [Install and setup](install.md) + - [Rules API](Core.md) + - [Toolchains](Toolchains.md) + +2. The `@build_bazel_rules_nodejs` Bazel module depends on the `@rules_nodejs` module. +**There are currently no maintainers of this module, so it is effectively deprecated.** +See the notes in the repository's main README.md. +This module gives the ability to install third-party dependencies using npm or yarn. +`BUILD` files are generated so that Bazel can load the third-party dependency graph and can call the CLI of installed tools. +It also supports running Node.js programs and has a number of useful rules. + - [Rules API](Built-ins.md) + - [Managing npm dependencies](dependencies.md) + - [Providers](Providers.md) + - [Debugging](debugging.md) + - [Stamping release builds](stamping.md) + - [Patching build_bazel_rules_nodejs](changing-rules.md) + +3. Custom rules that are distributed under the `@bazel` scope on [npm](http://npmjs.com/~bazel). + **There are currently no maintainers of these npm packages, so they are effectively deprecated.** + See the notes in the repository's main README.md. + This is required when rules have JavaScript code which wants to `require` from peerDependency packages, + since the node resolution algorithm requires the callsite of `require` to be in the node_modules tree. + + - [Concatjs](Concatjs.md) + - [Cypress](Cypress.md) + - [esbuild](esbuild.md) + - [Jasmine](Jasmine.md) + - [Karma](Karma.md) + - [Labs](Labs.md) + - [Protractor](Protractor.md) + - [Rollup](Rollup.md) + - [Terser](Terser.md) + - [TypeScript](TypeScript.md) + +There are also numerous [examples](examples.md) If you would like to write a rule outside the scope of the projects we recommend hosting them in your GitHub account or the one of your organization. ## Design -Most bazel rules include package management. That is, the `WORKSPACE` file installs both your dependencies and toolchain at the same time. For example, in Java, Gradle and Maven they each install both a build tool and a package at the same time. - -In nodejs, there are a variety of package managers and build tools which can interoperate. Also, there is a well-known package installation location (`node_modules` directory in your project). Command-line and other tools look in this directory to find packages. So we must either download packages twice (risking version skew between them) or point all tools to Bazel's `external` directory with `NODE_PATH` which would be very inconvenient. - -Instead, our philosophy is: in the NodeJS ecosystem, Bazel is only a build tool. It is up to the user to install packages into their `node_modules` directory, though the build tool can verify the contents. - -## Hermeticity and reproducibility - -Bazel generally guarantees builds are correct with respect to their inputs. For example, this means that given the same source tree, you can re-build the same artifacts as an earlier release of your program. In the nodejs rules, Bazel is not the package manager, so some responsibility falls to the developer to avoid builds that use the wrong dependencies. This problem exists with any build system in the JavaScript ecosystem. - -Both NPM and Yarn have a lockfile, which ensures that dependencies only change when the lockfile changes. Users are *strongly encouraged* to use the locking mechanism in their package manager. - -References: +Our goal is to make Bazel be a minimal layering on top of existing npm tooling, and to have maximal compatibility with those tools. -- npm: -- yarn: +This means you won't find a "Webpack vs. Rollup" debate here. You can run whatever tools you like under Bazel. In fact, we recommend running the same tools you're currently using, so that your Bazel migration only changes one thing at a time. -Note that will take the guarantee further: by using the lockfile as an input to Bazel, the nodejs rules can verify the integrity of the dependencies. This would make it impossible for a build to be non-reproducible, so long as you have the same lockfile. +In many cases, there are trade-offs. We try not to make these decisions for you, so instead of paving one "best" way to do things like many JS tooling options, we provide multiple ways. This increases complexity in understanding and using these rules, but also avoids choosing a wrong "winner". For example, you could install the dependencies yourself, or have Bazel manage its own copy of the dependencies, or have Bazel symlink to the ones in the project. +The JS ecosystem is also full of false equivalence arguments. The first question we often get is "What's better, Webpack or Bazel?". +This is understandable, since most JS tooling is forced to provide a single turn-key experience with an isolated ecosystem of plugins, and humans love a head-to-head competition. +Instead Bazel just orchestrates calling these tools. ## Quickstart diff --git a/docs/install.html b/docs/install.html deleted file mode 100755 index c7a655c535..0000000000 --- a/docs/install.html +++ /dev/null @@ -1,466 +0,0 @@ - - - - - - - - - - rules_nodejs - Installation - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Custom installation

- -

First, you need Bazel. -We recommend using Bazelisk, which is a version-selection wrapper, similar to -the nvm tool managing your version of Node. This is available on npm. -We also recommend installing ibazel which is the β€œwatch mode” for Bazel.

- -
$ yarn add -D @bazel/bazelisk @bazel/ibazel
-# or
-$ npm install --save-dev @bazel/bazelisk @bazel/ibazel
-
- -

You could install a current bazel distribution, following the [bazel instructions].

- -

If you use Bazelisk, see this workaround to get working command-line completion.

- -

It’s reasonable to globally-install bazelisk so you get a bazel command in your $PATH. -We don’t recommend this with ibazel as the version is frequently changing.

- -

Next, create a WORKSPACE file in your project root (or edit the existing one) -containing:

- -
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-http_archive(
-    name = "build_bazel_rules_nodejs",
-    sha256 = "1134ec9b7baee008f1d54f0483049a97e53a57cd3913ec9d6db625549c98395a",
-    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.0/rules_nodejs-3.4.0.tar.gz"],
-)
-
-load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
-
- -

Now you can choose from a few options to finish installation.

- -

To choose a version of Node.js:

- -
    -
  1. (Simplest) use the version of Node.js that comes with these rules by default
  2. -
  3. Choose from one of the versions we support natively
  4. -
  5. Tell Bazel where to download a specific version you require
  6. -
  7. Check Node.js into your repository and don’t download anything
  8. -
- -

These are described in more detail in the following sections.

- -

Simple usage

- -

Add this to your WORKSPACE file. It only tells Bazel how to find your -package.json file. It will use default versions of Node.js and npm.

- -
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
-# your npm dependencies into your node_modules folder.
-# You must still run the package manager to do this.
-node_repositories(package_json = ["//:package.json"])
-
-

Installation with a specific supported version of Node.js and Yarn

- -

You can choose a specific version of Node.js that’s built into these rules. -You can also choose a specific version of Yarn. -Note that some of our packages have started to use features from Node 12, so you may see warnings if you use an older version.

- -
-

Now that Node 12 is LTS (Long-term support) we encourage you to upgrade, and don’t intend to fix bugs which are only observed in Node 10 or lower.

-
- -

The available versions are documented on the node_repositories rule in the Built-ins.

- -

Add to WORKSPACE:

- -
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
-# your npm dependencies into your node_modules folder.
-# You must still run the package manager to do this.
-node_repositories(
-    package_json = ["//:package.json"],
-    node_version = "8.11.1",
-    yarn_version = "1.5.1",
-)
-
- -

Installation with a manually specified version of NodeJS and Yarn

- -

If you’d like to use a version of NodeJS and/or Yarn that are not currently supported here, you can manually -specify those in your WORKSPACE:

- -
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
-
-# NOTE: this rule does NOT install your npm dependencies into your node_modules folder.
-# You must still run the package manager to do this.
-node_repositories(
-  node_version = "8.10.0",
-  yarn_version = "1.5.1",
-  node_repositories = {
-    "8.10.0-darwin_amd64": ("node-v8.10.0-darwin-x64.tar.gz", "node-v8.10.0-darwin-x64", "7d77bd35bc781f02ba7383779da30bd529f21849b86f14d87e097497671b0271"),
-    "8.10.0-linux_amd64": ("node-v8.10.0-linux-x64.tar.xz", "node-v8.10.0-linux-x64", "92220638d661a43bd0fee2bf478cb283ead6524f231aabccf14c549ebc2bc338"),
-    "8.10.0-windows_amd64": ("node-v8.10.0-win-x64.zip", "node-v8.10.0-win-x64", "936ada36cb6f09a5565571e15eb8006e45c5a513529c19e21d070acf0e50321b"),
-  },
-  yarn_repositories = {
-    "1.5.1": ("yarn-v1.5.1.tar.gz", "yarn-v1.5.1", "cd31657232cf48d57fdbff55f38bfa058d2fb4950450bd34af72dac796af4de1"),
-  },
-  node_urls = ["https://nodejs.org/dist/v{version}/{filename}"],
-  yarn_urls = ["https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}"],
-  package_json = ["//:package.json"])
-
- -

Specifying node_urls and yarn_urls is optional. If omitted, the default values will be used. You may also use a custom NodeJS version and the default Yarn version or vice-versa.

- -

Installation with local vendored versions of NodeJS and Yarn

- -

Finally, you could check Node.js and Yarn into your repository, and not fetch -them from the internet. This is what we do internally at Google.

- -
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
-
-# Point node_repositories to use locally installed versions of Node.js and Yarn.
-# The vendored_node and vendored_yarn labels point to the extracted contents of
-# https://nodejs.org/dist/v10.12.0/node-v10.12.0-linux-x64.tar.xz and
-# https://github.com/yarnpkg/yarn/releases/download/v1.10.0/yarn-v1.10.0.tar.gz
-# respectively. NOTE: node-v10.12.0-linux-x64 will only work on Linux.
-node_repositories(
-  vendored_node = "@wksp//:third_party/node-v10.12.0-linux-x64",
-  vendored_yarn = "@wksp//:third_party/yarn-v1.10.0",
-  package_json = ["//:package.json"])
-
- -

In this case, the locally installed Node.js and Yarn are located in the wksp workspace in -the third_party/node-v10.12.0-linux-x64 and third_party/yarn-v1.10.0 folders. When using -vendored_node, you will be restricted to a single platform. vendored_yarn on the other hand, -is platform independent. See /examples/vendored_node in this repository for an example of this -in use.

- -

NOTE: Vendored Node.js and Yarn are not compatible with Remote Bazel Execution.

- -

Toolchains

- -

When you add node_repositories() to your WORKSPACE file it will setup a node toolchain for all currently supported platforms, Linux, macOS and Windows. Amongst other things this adds support for cross-compilations as well as Remote Build Execution support. For more detailed information also see Bazel Toolchains.

- -

If you have an advanced use-case you can also register your own toolchains and call node_toolchain_configure directly to manually setup a toolchain.

- -

Cross-compilation

- -

Toolchains allow us to support cross-compilation, e.g. building a linux binary from mac or windows. To tell Bazel to provide a toolchain for a different platform you have to pass in the --platforms flag. Currently supported values are:

- -
    -
  • @build_bazel_rules_nodejs//toolchains/node:linux_amd64
  • -
  • @build_bazel_rules_nodejs//toolchains/node:linux_arm64
  • -
  • @build_bazel_rules_nodejs//toolchains/node:linux_s390x
  • -
  • @build_bazel_rules_nodejs//toolchains/node:darwin_amd64
  • -
  • @build_bazel_rules_nodejs//toolchains/node:windows_amd64
  • -
- -

So if for example you want to build a docker image from a non-linux platform you would run bazel build --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //app, which will ensure that the linux nodejs binary is downloaded and provided to the nodejs_binary target.

- -

Note: The toolchain currently only provides a platform-specific nodejs binary. Any native modules will still be fetched/built, by npm/yarn, for your host platform, so they will not work on the target platform. Support for cross-compilation with native dependencies will follow.

- -

Because these rules use the target platform to decide which node binary to use, you will run into trouble if you are trying to invoke these rules as part of a cross-compilation -to a platform that is not supported by the default node repositories, eg when trying to bundle some js products into a binary targeting Android or iOS. You can work around this -by defining your own toolchain, and specifying the host platform as an execution requirement instead. For example, if you are building on a Mac, you could add the following -to your workspace:

- -
register_toolchains("//node_toolchain")
-
- -

And the following in node_toolchain/BUILD.bazel:

- -
toolchain(
-    name = "node_toolchain",
-    exec_compatible_with = [
-        "@platforms//os:osx",
-        "@platforms//cpu:x86_64",
-    ],
-    toolchain = "@nodejs_darwin_amd64_config//:toolchain",
-    toolchain_type = "@build_bazel_rules_nodejs//toolchains/node:toolchain_type",
-)
-
- -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/install.md b/docs/install.md index f644e84382..87b6ea66d6 100644 --- a/docs/install.md +++ b/docs/install.md @@ -4,25 +4,30 @@ layout: default toc: true --- -# Custom installation +# Installation + +> 🚨 rules_nodejs is now mostly unmaintained! 🚨 +> +> See the Maintenance Update in the [root README](https://github.com/bazelbuild/rules_nodejs#maintenance-update) First, you need Bazel. We recommend using Bazelisk, which is a version-selection wrapper, similar to -the `nvm` tool managing your version of Node. This is available on npm. -We also recommend installing `ibazel` which is the "watch mode" for Bazel. +the `nvm` tool managing your version of Node. + +It's reasonable to globally-install bazelisk so you get a `bazel` command in your PATH. +(We don't recommend this with ibazel as the version is frequently changing.) ```sh -$ yarn add -D @bazel/bazelisk @bazel/ibazel -# or -$ npm install --save-dev @bazel/bazelisk @bazel/ibazel +$ npm install -g @bazel/bazelisk ``` -You could install a current bazel distribution, following the [bazel instructions]. +We also recommend installing `ibazel` which is the "watch mode" for Bazel. -If you use Bazelisk, see [this workaround](https://github.com/bazelbuild/bazelisk/issues/29#issuecomment-478062147) to get working command-line completion. +```sh +$ npm install --save-dev @bazel/ibazel +``` -It's reasonable to globally-install bazelisk so you get a `bazel` command in your $PATH. -We don't recommend this with ibazel as the version is frequently changing. +> If you use Bazelisk, see [this workaround](https://github.com/bazelbuild/bazelisk/issues/29#issuecomment-478062147) to get working command-line completion. Next, create a `WORKSPACE` file in your project root (or edit the existing one) containing: @@ -31,11 +36,13 @@ containing: load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) -load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() ``` Now you can choose from a few options to finish installation. @@ -45,39 +52,31 @@ To choose a version of Node.js: 1. (Simplest) use the version of Node.js that comes with these rules by default 1. Choose from one of the versions we support natively 1. Tell Bazel where to download a specific version you require -1. Check Node.js into your repository and don't download anything +1. Vendor Node.js into your repository or build it from sources, using a custom toolchain. These are described in more detail in the following sections. ## Simple usage -Add this to your `WORKSPACE` file. It only tells Bazel how to find your -`package.json` file. It will use default versions of Node.js and npm. +Add this to your `WORKSPACE` file to use default versions of Node.js and npm. ```python -# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install -# your npm dependencies into your node_modules folder. -# You must still run the package manager to do this. -node_repositories(package_json = ["//:package.json"]) +# fetches nodejs, npm, and yarn +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") +node_repositories() ``` -## Installation with a specific supported version of Node.js and Yarn -You can choose a specific version of Node.js that's built into these rules. -You can also choose a specific version of Yarn. -Note that some of our packages have started to use features from Node 12, so you may see warnings if you use an older version. +## Installation with a specific version of Node.js and Yarn -> Now that Node 12 is LTS (Long-term support) we encourage you to upgrade, and don't intend to fix bugs which are only observed in Node 10 or lower. +You can choose a specific version of Node.js and a specific version of Yarn. We mirror all published versions, which you can see in this repo at `/nodejs/private/yarn_versions.bzl` and `/nodejs/private/node_versions.bzl`. -The available versions are documented on the `node_repositories` rule in the [Built-ins](Built-ins). +> Now that Node 12 is LTS (Long-term support) we encourage you to upgrade, and don't intend to fix bugs which are only observed in Node 10 or lower. +> Some of our packages have started to use features from Node 12, so you may see warnings if you use an older version. Add to `WORKSPACE`: ```python -# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install -# your npm dependencies into your node_modules folder. -# You must still run the package manager to do this. node_repositories( - package_json = ["//:package.json"], node_version = "8.11.1", yarn_version = "1.5.1", ) @@ -85,14 +84,12 @@ node_repositories( ## Installation with a manually specified version of NodeJS and Yarn -If you'd like to use a version of NodeJS and/or Yarn that are not currently supported here, you can manually -specify those in your `WORKSPACE`: +If you'd like to use a version of NodeJS and/or Yarn that are not currently supported here, +for example one that you host within your org, you can manually specify those in your `WORKSPACE`: ```python load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") -# NOTE: this rule does NOT install your npm dependencies into your node_modules folder. -# You must still run the package manager to do this. node_repositories( node_version = "8.10.0", yarn_version = "1.5.1", @@ -106,73 +103,16 @@ node_repositories( }, node_urls = ["https://nodejs.org/dist/v{version}/{filename}"], yarn_urls = ["https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}"], - package_json = ["//:package.json"]) ``` Specifying `node_urls` and `yarn_urls` is optional. If omitted, the default values will be used. You may also use a custom NodeJS version and the default Yarn version or vice-versa. ## Installation with local vendored versions of NodeJS and Yarn -Finally, you could check Node.js and Yarn into your repository, and not fetch -them from the internet. This is what we do internally at Google. - -```python -load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") - -# Point node_repositories to use locally installed versions of Node.js and Yarn. -# The vendored_node and vendored_yarn labels point to the extracted contents of -# https://nodejs.org/dist/v10.12.0/node-v10.12.0-linux-x64.tar.xz and -# https://github.com/yarnpkg/yarn/releases/download/v1.10.0/yarn-v1.10.0.tar.gz -# respectively. NOTE: node-v10.12.0-linux-x64 will only work on Linux. -node_repositories( - vendored_node = "@wksp//:third_party/node-v10.12.0-linux-x64", - vendored_yarn = "@wksp//:third_party/yarn-v1.10.0", - package_json = ["//:package.json"]) -``` - -In this case, the locally installed Node.js and Yarn are located in the `wksp` workspace in -the `third_party/node-v10.12.0-linux-x64` and `third_party/yarn-v1.10.0` folders. When using -`vendored_node`, you will be restricted to a single platform. `vendored_yarn` on the other hand, -is platform independent. See `/examples/vendored_node` in this repository for an example of this -in use. - -NOTE: Vendored Node.js and Yarn are not compatible with Remote Bazel Execution. - -## Toolchains - -When you add `node_repositories()` to your `WORKSPACE` file it will setup a node toolchain for all currently supported platforms, Linux, macOS and Windows. Amongst other things this adds support for cross-compilations as well as Remote Build Execution support. For more detailed information also see [Bazel Toolchains](https://docs.bazel.build/versions/master/toolchains.html). - -If you have an advanced use-case you can also register your own toolchains and call `node_toolchain_configure` directly to manually setup a toolchain. - -### Cross-compilation - -Toolchains allow us to support cross-compilation, e.g. building a linux binary from mac or windows. To tell Bazel to provide a toolchain for a different platform you have to pass in the `--platforms` flag. Currently supported values are: - -- `@build_bazel_rules_nodejs//toolchains/node:linux_amd64` -- `@build_bazel_rules_nodejs//toolchains/node:linux_arm64` -- `@build_bazel_rules_nodejs//toolchains/node:linux_s390x` -- `@build_bazel_rules_nodejs//toolchains/node:darwin_amd64` -- `@build_bazel_rules_nodejs//toolchains/node:windows_amd64` - -So if for example you want to build a docker image from a non-linux platform you would run `bazel build --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //app`, which will ensure that the linux nodejs binary is downloaded and provided to the nodejs_binary target. - -Note: The toolchain currently only provides a platform-specific nodejs binary. Any native modules will still be fetched/built, by npm/yarn, for your host platform, so they will not work on the target platform. Support for cross-compilation with native dependencies will follow. - -Because these rules use the target platform to decide which node binary to use, you will run into trouble if you are trying to invoke these rules as part of a cross-compilation -to a platform that is not supported by the default node repositories, eg when trying to bundle some js products into a binary targeting Android or iOS. You can work around this -by defining your own toolchain, and specifying the host platform as an execution requirement instead. For example, if you are building on a Mac, you could add the following -to your workspace: - - register_toolchains("//node_toolchain") +You can use your own Node.js binary rather than fetching from the internet. +You could check in a binary file, or build Node.js from sources. +To use See [`node_toolchain`](./Core.md#node_toolchain) for docs. -And the following in node_toolchain/BUILD.bazel: +To use a locally vendored Yarn, use the `vendored_yarn` attribute of [`node_repositories`](./Core.md#node_repositories) - toolchain( - name = "node_toolchain", - exec_compatible_with = [ - "@platforms//os:osx", - "@platforms//cpu:x86_64", - ], - toolchain = "@nodejs_darwin_amd64_config//:toolchain", - toolchain_type = "@build_bazel_rules_nodejs//toolchains/node:toolchain_type", - ) +See `/examples/vendored_node_and_yarn` in this repository for an example of this in use. diff --git a/docs/repositories.html b/docs/repositories.html deleted file mode 100755 index 162b7a3506..0000000000 --- a/docs/repositories.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - - - rules_nodejs - Generated Repositories - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Generated Repositories

- -

rules_nodejs produces several repositories for you to reference. -Bazel represents your workspace as one repository, and code fetched or installed from outside your workspace lives in other repositories. -These are referenced with the @repo// syntax in your BUILD files.

- -

@nodejs

- -

This repository is created by calling the node_repositories function in your WORKSPACE file. -It contains the node, npm, and yarn programs.

- -

As always, bazel query is useful for learning about what targets are available.

- -
$ bazel query @nodejs//...
-@nodejs//:node
-...
-
- -

You don’t typically need to reference the @nodejs repository from your BUILD files because it’s used behind the scenes -to run node and fetch dependencies.

- -

Some ways you can use this:

- -
    -
  • Run the Bazel-managed version of node: bazel run @nodejs//:node path/to/program.js
  • -
  • Run the Bazel-managed version of npm: bazel run @nodejs//:npm
  • -
  • Run the Bazel-managed version of yarn: bazel run @nodejs//:yarn
  • -
  • Install dependencies from nested package.json file(s) which were passed to node_repositories#package.json -
      -
    • using npm: bazel run @nodejs//:npm_node_repositories install
    • -
    • using yarn: bazel run @nodejs//:yarn_node_repositories
    • -
    -
  • -
- -

@npm

- -

This repository is created by calling the npm_install or yarn_install function in your WORKSPACE file.

- -

The name @npm is recommended in the simple case that you install only a single package.json file. -If you have multiple, call the npm_install or yarn_install multiple times, and give each one a unique name. -This results in multiple repositories, named whatever you chose, rather than β€œnpm”. -The following applies to any repository created by npm_install , or yarn_install, just replace @npm with the name you chose.

- -

Again, use bazel query @npm//... to learn about all the targets declared in this repository.

- -

Our philosophy is to mirror the installed npm dependencies in a way that’s idiomatic to reference them in Bazel.

- -

Commonly used ones are:

- -
    -
  • Every file that was installed from npm: @npm//:node_modules. This target can have a very large number of files and slow down your build, however it’s a simple way to skip having to declare more fine-grained inputs to your BUILD targets.
  • -
  • If you had a dependency on the foo package, you can reference @npm//foo to get all the files. We mirror the npm dependency graph, so if foo declares a dependency on another package dep, Bazel will include that dependency when foo is used.
  • -
  • If the foo package has an executable program bar, then @npm//foo/bin:bar is a nodejs_binary that you can call with bazel run or can pass as the executable to your own rules.
  • -
  • Sometimes you need a UMD bundle, but a package doesn’t ship one. For example, the concatjs_devserver rule depends on third-party libraries having a named UMD entry point. The @npm//foo:foo__umd target will automatically run Browserify to convert the package’s main entry into UMD.
  • -
- -
-

One convenient (maybe also confusing) way to understand what BUILD files are generated is to look at our integration test at https://github.com/bazelbuild/rules_nodejs/tree/stable/internal/npm_install/test/golden - this directory looks similar to the content of an @npm repository.

-
- -

Generated macros for npm packages with bin entries

- -

Any installed package that has one or more bin entries in the package.json get convenient macros generated. -These are the Bazel equivalent of the ./node_modules/.bin/* files in your project which the package manager created.

- -

For a package foo with some bin entries, we will create a .bzl file where you can load rules, at @npm//foo:index.bzl

- -

If the foo package contains a bin entry bar, the index.bzl file will contain bar and bar_test macros. You can load these two generated rules in your BUILD file:

- -

load("@npm//foo:index.bzl", "bar", "bar_test")

- -

The bar macro can be called in two ways. If you pass outs or output_dir, it produces an npm_package_bin rule that invokes the tool to transform some inputs to outputs, useful as a dependency of another rule, or with bazel build. If you don’t pass outs or output_dir, then it will produce a nodejs_binary rule intended for use with bazel run. (The latter is identical to the @npm//foo/bin:bar target, just giving you a convenient way to alias it with a different label and pass it arguments).

- -

See examples in rules_nodejs. A typical tool to use with outs is Babel, while a typical rule with no outputs is http_server.

- -

The bar_test macro produces a nodejs_test that assumes the tool is a test runner, and produces a zero or one exit code, useful as a target with bazel test. See the examples of mocha_test in rules_nodejs.

- -

You can also read https://dev.to/bazel/layering-in-bazel-for-web-389h to see an end-to-end example of using the generated bin macros.

- -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/repositories.md b/docs/repositories.md index d503ba73e8..dc524ad6f6 100644 --- a/docs/repositories.md +++ b/docs/repositories.md @@ -1,8 +1,3 @@ ---- -title: Generated Repositories -layout: default -toc: true ---- # Generated Repositories rules_nodejs produces several repositories for you to reference. @@ -12,7 +7,7 @@ These are referenced with the `@repo//` syntax in your BUILD files. ## @nodejs This repository is created by calling the `node_repositories` function in your `WORKSPACE` file. -It contains the node, npm, and yarn programs. +It contains the node, npm, and npx programs. As always, `bazel query` is useful for learning about what targets are available. @@ -22,17 +17,20 @@ $ bazel query @nodejs//... ... ``` -You don't typically need to reference the `@nodejs` repository from your BUILD files because it's used behind the scenes -to run node and fetch dependencies. +You don't typically need to reference the `@nodejs` repository from your BUILD files because it's used behind the scenes to run node and fetch dependencies. Some ways you can use this: - Run the Bazel-managed version of node: `bazel run @nodejs//:node path/to/program.js` - Run the Bazel-managed version of npm: `bazel run @nodejs//:npm` -- Run the Bazel-managed version of yarn: `bazel run @nodejs//:yarn` -- Install dependencies from nested package.json file(s) which were passed to `node_repositories#package.json` - - using npm: `bazel run @nodejs//:npm_node_repositories install` - - using yarn: `bazel run @nodejs//:yarn_node_repositories` + +(Note: for backward-compatibility, the `@nodejs` repository can also be referenced as `@nodejs_host`). + +## @yarn + +This repository is created by calling the `yarn_repositories` function in your `WORKSPACE` file. + +- Run the Bazel-managed version of yarn: `bazel run @yarn//:yarn` ## @npm diff --git a/docs/search.html b/docs/search.html deleted file mode 100755 index 8e266a2d1b..0000000000 --- a/docs/search.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - rules_nodejs - Search - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - - - - diff --git a/docs/search.md b/docs/search.md deleted file mode 100644 index 88defcbb68..0000000000 --- a/docs/search.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Search -layout: search -toc: false ---- diff --git a/docs/stamping.html b/docs/stamping.html deleted file mode 100755 index 5799e5b13f..0000000000 --- a/docs/stamping.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - - - rules_nodejs - Home - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - -
-
-

Stamping

- -

Bazel is generally only a build tool, and is unaware of your version control system. -However, when publishing releases, you may want to embed version information in the resulting distribution. -Bazel supports this with the concept of a β€œWorkspace status” which is evaluated before each build. -See the Bazel workspace status docs

- -

To stamp a build, you must pass the --stamp argument to Bazel.

- -

Stamping is typically performed on a later action in the graph, like on a packaging rule (pkg_*). This means that -a changed status variable only causes re-packaging, not re-compilation and thus does not cause cascading re-builds.

- -

Bazel provides a couple of statuses by default, such as BUILD_EMBED_LABEL which is the value of the --embed_label -argument, as well as BUILD_HOST and BUILD_USER. You can supply more with the workspace status script, see below.

- -

Some rules accept an attribute that uses the status variables.

- -

Substitutions attribute

- -

In a pkg_npm or pkg_web you can use the substitutions attribute like:

- -
pkg_npm(
-    name = "npm_package",
-    substitutions = {"0.0.0-PLACEHOLDER": "{STABLE_GIT_COMMIT}"},
-)
-
- -

In a --stamp build, this will replace the string β€œ0.0.0-PLACEHOLDER” in any file included in the package with the current value of the STABLE_GIT_COMMIT variable. -However without stamping the placeholder will be left as-is.

- -

Read the status files

- -

The rollup_bundle rule just exposes the Bazel status files so that your custom rollup.config.js can read it. -See Rollup.

- -

Stamping with a Workspace status script

- -

To define additional statuses, pass the --workspace_status_command argument to bazel. -The value of this flag is a path to a script that prints space-separated key/value pairs, one per line, such as

- -
#!/usr/bin/env bash
-echo STABLE_GIT_COMMIT $(git rev-parse HEAD)
-
-
-

For a more full-featured script, take a look at the bazel_stamp_vars in Angular

-
- -

Make sure you set the executable bit, eg. chmod 755 tools/bazel_stamp_vars.sh.

- -
-

NOTE keys start start with STABLE_ will cause a re-build when they change. -Other keys will NOT cause a re-build, so stale values can appear in your app. -Non-stable (volatile) keys should typically be things like timestamps that always vary between builds.

-
- -

You might like to encode your setup using an entry in .bazelrc such as:

- -
# This tells Bazel how to interact with the version control system
-# Enable this with --config=release
-build:release --stamp --workspace_status_command=./tools/bazel_stamp_vars.sh
-
- -

Release script

- -

If you publish more than one package from your workspace, you might want a release script around Bazel. -A nice pattern is to do a bazel query to find publishable targets, build them in parallel, then publish in a loop. -Here is a template to get you started:

- -
#!/usr/bin/env bash
-
-set -u -e -o pipefail
-
-# Call the script with argument "pack" or "publish"
-readonly NPM_COMMAND=${1:-publish}
-# Don't rely on $PATH to have the right version
-readonly BAZEL=./node_modules/.bin/bazel
-# Find all the npm packages in the repo
-readonly PKG_NPM_LABELS=`$BAZEL query --output=label 'kind("pkg_npm", //...)'`
-# Build them in one command to maximize parallelism
-$BAZEL build --config=release $PKG_NPM_LABELS
-# publish one package at a time to make it easier to spot any errors or warnings
-for pkg in $PKG_NPM_LABELS ; do
-  $BAZEL run --config=release -- ${pkg}.${NPM_COMMAND} --access public --tag latest
-done
-
- -

See https://www.kchodorow.com/blog/2017/03/27/stamping-your-builds/ for more background. -Make sure you use a β€œSTABLE_” status key, or else Bazel may use a cached npm artifact rather than -building a new one with your current version info.

- - -
-
- - -
-
- -
-
-
-
-

© 2021 The rules_nodejs authors

-
-
-
- -
- - - - - - - - - - - - - - - diff --git a/docs/stamping.md b/docs/stamping.md index 605a8d9ed2..206e635818 100644 --- a/docs/stamping.md +++ b/docs/stamping.md @@ -1,9 +1,3 @@ ---- -title: Home -layout: default -toc: true ---- - # Stamping Bazel is generally only a build tool, and is unaware of your version control system. @@ -53,7 +47,7 @@ echo STABLE_GIT_COMMIT $(git rev-parse HEAD) Make sure you set the executable bit, eg. `chmod 755 tools/bazel_stamp_vars.sh`. -> **NOTE** keys start start with `STABLE_` will cause a re-build when they change. +> **NOTE** keys that start with `STABLE_` will cause a re-build when they change. > Other keys will NOT cause a re-build, so stale values can appear in your app. > Non-stable (volatile) keys should typically be things like timestamps that always vary between builds. diff --git a/e2e/BUILD.bazel b/e2e/BUILD.bazel index 0fb5a0b531..724d1c7fc7 100644 --- a/e2e/BUILD.bazel +++ b/e2e/BUILD.bazel @@ -19,6 +19,9 @@ e2e_integration_test( npm_packages = { "//packages/jasmine:npm_package": "@bazel/jasmine", }, + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) e2e_integration_test( @@ -29,7 +32,7 @@ e2e_integration_test( ], npm_packages = { "//packages/jasmine:npm_package": "@bazel/jasmine", - "//packages/typescript:npm_package": "@bazel/typescript", + "//packages/concatjs:npm_package": "@bazel/concatjs", }, # Coverage not working on Windows. Looks like a bazel issue. # ==================== Test output for //:coverage_test: @@ -43,21 +46,40 @@ e2e_integration_test( e2e_integration_test( name = "e2e_fine_grained_symlinks", + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) -e2e_integration_test( - name = "e2e_jasmine", +[e2e_integration_test( + name = "e2e_jasmine_%s" % jasmine_version.replace(".", "_"), npm_packages = { "//packages/jasmine:npm_package": "@bazel/jasmine", }, -) - -e2e_integration_test( - name = "e2e_node_loader_no_preserve_symlinks", -) + # use these package.json packages instead + package_json_substitutions = { + "jasmine": jasmine_version, + "jasmine-core": jasmine_version, + }, + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], + workspace_root = "jasmine", +) for jasmine_version in [ + # TODO(6.0): remove old API tests + # Old API + "2.99.x", + "3.9.x", + "3.10.x", + # New API + "4.0.x", +]] e2e_integration_test( name = "e2e_node_loader_preserve_symlinks", + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) e2e_integration_test( @@ -65,7 +87,7 @@ e2e_integration_test( bazel_commands = [ "info", "test ...", - "run --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //:nodejs_image", + "run --platforms=@rules_nodejs//nodejs:linux_amd64 //:nodejs_image", ], # Only run on buildkite linux as other CI platforms have no docker available tags = [ @@ -75,6 +97,10 @@ e2e_integration_test( ], ) +e2e_integration_test( + name = "e2e_nodejs_host", +) + e2e_integration_test( name = "e2e_packages", # TODO(alex): figure out why this is broken by turning on linker @@ -83,10 +109,16 @@ e2e_integration_test( e2e_integration_test( name = "e2e_symlinked_node_modules_npm", + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) e2e_integration_test( name = "e2e_symlinked_node_modules_yarn", + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) # terser rules are tested in the e2e_webapp @@ -118,11 +150,13 @@ e2e_integration_test( }, ) +# tsc_wrapped uses unstable APIs in typescript, so it's wise +# to test it against all the versions we might need to support [e2e_integration_test( name = "e2e_typescript_%s" % tsc_version.replace(".", "_"), npm_packages = { "//packages/jasmine:npm_package": "@bazel/jasmine", - "//packages/typescript:npm_package": "@bazel/typescript", + "//packages/concatjs:npm_package": "@bazel/concatjs", }, # use these package.json packages instead package_json_substitutions = { @@ -130,16 +164,27 @@ e2e_integration_test( }, workspace_root = "typescript", ) for tsc_version in [ - "3.0.x", - "3.1.x", - "3.2.x", - "3.3.x", - "3.4.x", - "3.5.x", - "3.6.x", - "3.7.x", - "3.8.x", - "3.9.x", "4.0.x", "4.1.x", + "4.2.x", + "4.3.x", ]] + +e2e_integration_test( + name = "e2e_bazel_run_chdir", + bazel_commands = [ + "run //subfolder:chdir-test", + ], + # TODO: figure out why this fails on Windows + tags = ["no-bazelci-windows"], +) + +e2e_integration_test( + name = "e2e_linker_disabled_regression", + bazel_commands = [ + "build //...", + "run //subdir:binary", + ], + # TODO: figure out why this fails on Windows + tags = ["no-bazelci-windows"], +) diff --git a/e2e/bazel_managed_deps/WORKSPACE b/e2e/bazel_managed_deps/WORKSPACE index 4ed9acbfa6..29363db144 100644 --- a/e2e/bazel_managed_deps/WORKSPACE +++ b/e2e/bazel_managed_deps/WORKSPACE @@ -12,23 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace( - name = "e2e_bazel_managed_deps", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_bazel_managed_deps") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( name = "npm", + exports_directories_only = False, manual_build_file_contents = """ filegroup( name = "bin_files", diff --git a/e2e/bazel_managed_deps/package.json b/e2e/bazel_managed_deps/package.json index 56ad16284c..6a7a66e30e 100644 --- a/e2e/bazel_managed_deps/package.json +++ b/e2e/bazel_managed_deps/package.json @@ -1,7 +1,7 @@ { "description": "runtime dependencies for bazel_managed_deps example", "devDependencies": { - "@bazel/jasmine": "^3.4.1", + "@bazel/jasmine": "^5.8.1", "jasmine": "^3.5.0", "typescript": "^3.0.1" }, diff --git a/e2e/bazel_managed_deps/yarn.lock b/e2e/bazel_managed_deps/yarn.lock index 33d389fe09..bda6262157 100644 --- a/e2e/bazel_managed_deps/yarn.lock +++ b/e2e/bazel_managed_deps/yarn.lock @@ -2,13 +2,13 @@ # yarn lockfile v1 -"@bazel/jasmine@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.4.1.tgz#0f9f4fbf973e4c8b8411c2bf3086a6d2398ffcab" - integrity sha512-nbyg5+6m+KUEmxQX5N65gfV+zTUbIjXYq/m3zYFr/hx1Ql/n2tVBBHcxRO4pAbjDhnpuFQgFoAJPzKe5sIL2iA== +"@bazel/jasmine@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-5.8.1.tgz#c549f10806474ff742f37544733fbfdccf78ba66" + integrity sha512-052veW5EbJRH+5hL4l9Sf99bTmdKQ5WXXMF0QiBOZcA3ZHYMAaKfYNO+brutiWoX6FrBloiskLrMzF8OiHBqyw== dependencies: c8 "~7.5.0" - jasmine-reporters "~2.4.0" + jasmine-reporters "~2.5.0" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" @@ -35,6 +35,11 @@ resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== +"@xmldom/xmldom@^0.7.3": + version "0.7.5" + resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.5.tgz#09fa51e356d07d0be200642b0e4f91d8e6dd408d" + integrity sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A== + ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" @@ -255,13 +260,13 @@ jasmine-core@~3.5.0: resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.5.0.tgz#132c23e645af96d85c8bca13c8758b18429fc1e4" integrity sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA== -jasmine-reporters@~2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.4.0.tgz#708c17ae70ba6671e3a930bb1b202aab80a31409" - integrity sha512-jxONSrBLN1vz/8zCx5YNWQSS8iyDAlXQ5yk1LuqITe4C6iXCDx5u6Q0jfNtkKhL4qLZPe69fL+AWvXFt9/x38w== +jasmine-reporters@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.5.0.tgz#f9e2e0f82aaa2e07e8d553be56457efe0fd8b39e" + integrity sha512-J69peyTR8j6SzvIPP6aO1Y00wwCqXuIvhwTYvE/di14roCf6X3wDZ4/cKGZ2fGgufjhP2FKjpgrUIKjwau4e/Q== dependencies: - mkdirp "^0.5.1" - xmldom "^0.5.0" + "@xmldom/xmldom" "^0.7.3" + mkdirp "^1.0.4" jasmine@^3.5.0: version "3.5.0" @@ -292,17 +297,10 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== once@^1.3.0: version "1.4.0" @@ -450,11 +448,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -xmldom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.5.0.tgz#193cb96b84aa3486127ea6272c4596354cb4962e" - integrity sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA== - y18n@^5.0.5: version "5.0.5" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18" diff --git a/examples/angular_view_engine/.bazelrc b/e2e/bazel_run_chdir/.bazelrc similarity index 62% rename from examples/angular_view_engine/.bazelrc rename to e2e/bazel_run_chdir/.bazelrc index 3431057af6..c9c5723166 100644 --- a/examples/angular_view_engine/.bazelrc +++ b/e2e/bazel_run_chdir/.bazelrc @@ -1 +1,3 @@ import %workspace%/../../common.bazelrc + +build --enable_runfiles \ No newline at end of file diff --git a/tools/mock_rules_typescript/BUILD.bazel b/e2e/bazel_run_chdir/BUILD.bazel similarity index 100% rename from tools/mock_rules_typescript/BUILD.bazel rename to e2e/bazel_run_chdir/BUILD.bazel diff --git a/e2e/bazel_run_chdir/WORKSPACE b/e2e/bazel_run_chdir/WORKSPACE new file mode 100644 index 0000000000..c8f2899d3a --- /dev/null +++ b/e2e/bazel_run_chdir/WORKSPACE @@ -0,0 +1,17 @@ +workspace(name = "e2e_bazel_run_chdir") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "build_bazel_rules_nodejs", + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], +) + +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") + +node_repositories() diff --git a/e2e/bazel_run_chdir/subfolder/BUILD.bazel b/e2e/bazel_run_chdir/subfolder/BUILD.bazel new file mode 100644 index 0000000000..7e91182e87 --- /dev/null +++ b/e2e/bazel_run_chdir/subfolder/BUILD.bazel @@ -0,0 +1,10 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") + +# Test that a runfile can be loaded in a subdirectory +# when chdir is used with nodejs_binary. +nodejs_binary( + name = "chdir-test", + chdir = package_name(), + data = ["file.json"], + entry_point = "reader.js", +) diff --git a/e2e/bazel_run_chdir/subfolder/file.json b/e2e/bazel_run_chdir/subfolder/file.json new file mode 100644 index 0000000000..18d7acf586 --- /dev/null +++ b/e2e/bazel_run_chdir/subfolder/file.json @@ -0,0 +1 @@ +{"foo": "bar"} \ No newline at end of file diff --git a/e2e/bazel_run_chdir/subfolder/reader.js b/e2e/bazel_run_chdir/subfolder/reader.js new file mode 100644 index 0000000000..b85afa3de3 --- /dev/null +++ b/e2e/bazel_run_chdir/subfolder/reader.js @@ -0,0 +1,2 @@ +const fs = require("fs"); +fs.readFileSync("./file.json", {encoding: "utf-8"}); \ No newline at end of file diff --git a/e2e/concatjs_devserver/BUILD.bazel b/e2e/concatjs_devserver/BUILD.bazel index b8b0bc0daf..67d7589c3c 100644 --- a/e2e/concatjs_devserver/BUILD.bazel +++ b/e2e/concatjs_devserver/BUILD.bazel @@ -13,9 +13,8 @@ # limitations under the License. load("@build_bazel_rules_nodejs//internal/npm_install:npm_umd_bundle.bzl", "npm_umd_bundle") -load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver") +load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver", "ts_library") load("@npm//@bazel/protractor:index.bzl", "protractor_web_test_suite") -load("@npm//@bazel/typescript:index.bzl", "ts_library") exports_files([ "red-body-style.css", diff --git a/e2e/concatjs_devserver/WORKSPACE b/e2e/concatjs_devserver/WORKSPACE index 1b87ac40e3..3f7977e03e 100644 --- a/e2e/concatjs_devserver/WORKSPACE +++ b/e2e/concatjs_devserver/WORKSPACE @@ -12,23 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace( - name = "e2e_concatjs_devserver", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_concatjs_devserver") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( name = "npm", + exports_directories_only = False, package_json = "//:package.json", yarn_lock = "//:yarn.lock", ) @@ -42,7 +44,7 @@ load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories" web_test_repositories() -load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories") +load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories") browser_repositories( chromium = True, diff --git a/e2e/concatjs_devserver/genrule/BUILD.bazel b/e2e/concatjs_devserver/genrule/BUILD.bazel index a3bf350375..80521b8349 100644 --- a/e2e/concatjs_devserver/genrule/BUILD.bazel +++ b/e2e/concatjs_devserver/genrule/BUILD.bazel @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver") +load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver", "ts_library") load("@npm//@bazel/protractor:index.bzl", "protractor_web_test_suite") -load("@npm//@bazel/typescript:index.bzl", "ts_library") ts_library( name = "app", diff --git a/e2e/concatjs_devserver/package.json b/e2e/concatjs_devserver/package.json index 9f8704c156..f34a37f282 100644 --- a/e2e/concatjs_devserver/package.json +++ b/e2e/concatjs_devserver/package.json @@ -1,8 +1,8 @@ { "dependencies": { - "@bazel/concatjs": "^3.4.1", - "@bazel/protractor": "^3.4.1", - "@bazel/typescript": "^3.4.1", + "@bazel/concatjs": "^5.8.1", + "@bazel/protractor": "^5.8.1", + "@bazel/typescript": "^5.8.1", "@types/jasmine": "2.8.2", "@types/node": "7.0.18", "date-fns": "1.30.1", @@ -11,8 +11,8 @@ "protractor": "^5.4.2", "rxjs": "^6.5.2", "tslib": "^1.9.0", - "typeorm": "^0.2.17", - "typescript": "2.7.x" + "typeorm": "0.2.17", + "typescript": "4.3.2" }, "scripts": { "test": "bazel test ..." diff --git a/e2e/concatjs_devserver/subpackage/BUILD.bazel b/e2e/concatjs_devserver/subpackage/BUILD.bazel index 6b48120a73..03877b2520 100644 --- a/e2e/concatjs_devserver/subpackage/BUILD.bazel +++ b/e2e/concatjs_devserver/subpackage/BUILD.bazel @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver") +load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver", "ts_library") load("@npm//@bazel/protractor:index.bzl", "protractor_web_test_suite") -load("@npm//@bazel/typescript:index.bzl", "ts_library") load("@npm//html-insert-assets:index.bzl", "html_insert_assets") html_insert_assets( diff --git a/e2e/concatjs_devserver/yarn.lock b/e2e/concatjs_devserver/yarn.lock index 02c627d34e..e3a6d69283 100644 --- a/e2e/concatjs_devserver/yarn.lock +++ b/e2e/concatjs_devserver/yarn.lock @@ -2,29 +2,36 @@ # yarn lockfile v1 -"@bazel/concatjs@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-3.4.1.tgz#5a07102a841eea3841ef1b2b9b2df5c3dde378b7" - integrity sha512-dBsu5AR3ClDodz4BxCJJTmEevpfgo2c7QOuIPjiskQRvVZNH+rL+vjEh1GOLZC6RrXPSHj/F6ULsJ53RbCTlvA== +"@bazel/concatjs@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-5.8.1.tgz#dd20882429e382cae79c08cbd3238dfc680d2d67" + integrity sha512-TkARsNUxgi3bjFeGwIGlffmQglNhuR9qK9uE7uKhdBZvQE5caAWVCjYiMTzo3viKDhwKn5QNRcHY5huuJMVFfA== dependencies: protobufjs "6.8.8" source-map-support "0.5.9" - tsutils "2.27.2" + tsutils "3.21.0" -"@bazel/protractor@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-3.4.1.tgz#4c9860045fe00bce7d6d6ba692b7f3cb8804db19" - integrity sha512-GmVBCBL+DXlla5qHsVfzxGfSQ2abGrJTPNSflaCdD8XGX/yvE/zeXFNuav/6bkdRpRZnOEksKH5TED3OP59KiQ== +"@bazel/protractor@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-5.8.1.tgz#d006187e132721e607e8f49a49eb160511554be5" + integrity sha512-6JpP4uQLVRu3m0GrpexDjICKK8YJW/9voc8rZFQxVf3sm8yNjapUVN/b/PBAwua+nDY3uMe3W9aHgStZFOST0A== -"@bazel/typescript@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.4.1.tgz#ec52292b240157cd2d874ff7ea7857da8416c00c" - integrity sha512-OKpfjFRhudsaUBL3xH1oAbat+bwdRyfAOTn2qgMQSO3vR4ZBBVYk7GVMJzWamLkbDS0aY5ws5wLfDScJSKD2ww== +"@bazel/typescript@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-5.8.1.tgz#74a76af434fad7930893cf3e98b4cc201e52dc65" + integrity sha512-NAJ8WQHZL1WE1YmRoCrq/1hhG15Mvy/viWh6TkvFnBeEhNUiQUsA5GYyhU1ztnBIYW03nATO3vwhAEfO7Q0U5g== dependencies: - protobufjs "6.8.8" + "@bazel/worker" "5.8.1" semver "5.6.0" source-map-support "0.5.9" - tsutils "2.27.2" + tsutils "3.21.0" + +"@bazel/worker@5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/worker/-/worker-5.8.1.tgz#65af7a70dd2f1aaedd6c19330abd9a198f96e7b2" + integrity sha512-GMyZSNW3F34f9GjbJqvs1aHyed5BNrNeiDzNJhC1fIizo/UeBM21oBBONIYLBDoBtq936U85VyPZ76JaP/83hw== + dependencies: + google-protobuf "^3.6.1" "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" @@ -141,6 +148,11 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -153,6 +165,13 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + any-promise@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -219,10 +238,10 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base64-js@^1.0.2: - version "1.3.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" - integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== bcrypt-pbkdf@^1.0.0: version "1.0.2" @@ -259,12 +278,12 @@ buffer-from@^1.0.0: integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== buffer@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6" - integrity sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg== + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" + base64-js "^1.3.1" + ieee754 "^1.1.13" camelcase@^5.0.0: version "5.3.1" @@ -287,7 +306,7 @@ chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.3.0, chalk@^2.4.2: +chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -296,16 +315,25 @@ chalk@^2.3.0, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" + integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + cli-highlight@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.1.tgz#2180223d51618b112f4509cf96e4a6c750b07e97" - integrity sha512-0y0VlNmdD99GXZHYnvrQcmHxP8Bi6T00qucGgBgGv4kJ0RyDthNnnFPupHV7PYv/OXSVk+azFbOeaW6+vGmx9A== + version "2.1.11" + resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf" + integrity sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg== dependencies: - chalk "^2.3.0" - highlight.js "^9.6.0" + chalk "^4.0.0" + highlight.js "^10.7.1" mz "^2.4.0" - parse5 "^4.0.0" - yargs "^13.0.0" + parse5 "^5.1.1" + parse5-htmlparser2-tree-adapter "^6.0.0" + yargs "^16.0.0" cliui@^5.0.0: version "5.0.0" @@ -316,6 +344,15 @@ cliui@^5.0.0: strip-ansi "^5.2.0" wrap-ansi "^5.1.0" +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -323,11 +360,23 @@ color-convert@^1.9.0: dependencies: color-name "1.1.3" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -365,11 +414,11 @@ debug@^3.1.0: ms "^2.1.1" debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + version "4.3.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== dependencies: - ms "^2.1.1" + ms "2.1.2" decamelize@^1.2.0: version "1.2.0" @@ -419,6 +468,11 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + es-abstract@^1.5.1: version "1.15.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.15.0.tgz#8884928ec7e40a79e3c9bc812d37d10c8b24cc57" @@ -456,6 +510,11 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -532,7 +591,7 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -get-caller-file@^2.0.1: +get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== @@ -544,7 +603,7 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob@^7.0.3, glob@^7.0.6, glob@^7.1.2, glob@^7.1.3: +glob@^7.0.3, glob@^7.0.6, glob@^7.1.3: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -556,6 +615,18 @@ glob@^7.0.3, glob@^7.0.6, glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.2: + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" @@ -568,6 +639,11 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +google-protobuf@^3.6.1: + version "3.17.3" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.17.3.tgz#f87595073545a77946c8f0b67c302c5f7646d700" + integrity sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg== + har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -593,6 +669,11 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" @@ -605,10 +686,10 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" -highlight.js@^9.6.0: - version "9.15.9" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.9.tgz#865257da1dbb4a58c4552d46c4b3854f77f0e6d5" - integrity sha512-M0zZvfLr5p0keDMCAhNBp03XJbKBxUx5AfyfufMdFMEP4N/Xj6dh0IqC75ys7BAzceR34NgcvXjupRVaHBPPVQ== +highlight.js@^10.7.1: + version "10.7.2" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.2.tgz#89319b861edc66c48854ed1e6da21ea89f847360" + integrity sha512-oFLl873u4usRM9K63j4ME9u3etNF0PLiJhSQ8rdfuL51Wn3zkD6drf9ZW0dOzjnZI22YYG24z30JcmfCZjMgYg== html-insert-assets@^0.6.0: version "0.6.0" @@ -635,10 +716,10 @@ https-proxy-agent@^2.2.1: agent-base "^4.3.0" debug "^3.1.0" -ieee754@^1.1.4: - version "1.1.13" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" - integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== immediate@~3.0.5: version "3.0.6" @@ -678,6 +759,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -746,9 +832,9 @@ jasminewd2@^2.1.0: integrity sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4= js-yaml@^3.13.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" - integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -832,34 +918,34 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= +minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: - minimist "0.0.8" + minimist "^1.2.5" mkdirp@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.3.tgz#4cf2e30ad45959dddea53ad97d518b6c8205e1ea" integrity sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g== -ms@^2.1.1: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== @@ -922,9 +1008,9 @@ os-tmpdir@~1.0.1: integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= p-limit@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" - integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== dependencies: p-try "^2.0.0" @@ -950,16 +1036,23 @@ parent-require@^1.0.0: resolved "https://registry.yarnpkg.com/parent-require/-/parent-require-1.0.0.tgz#746a167638083a860b0eef6732cb27ed46c32977" integrity sha1-dGoWdjgIOoYLDu9nMssn7UbDKXc= -parse5@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" - integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== +parse5-htmlparser2-tree-adapter@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" parse5@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== +parse5@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -1251,6 +1344,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + string.prototype.trimleft@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" @@ -1288,6 +1390,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -1300,6 +1409,13 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + thenify-all@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" @@ -1334,10 +1450,10 @@ tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tsutils@2.27.2: - version "2.27.2" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.27.2.tgz#60ba88a23d6f785ec4b89c6e8179cac9b431f1c7" - integrity sha512-qf6rmT84TFMuxAKez2pIfR8UCai49iQsfB7YWVjV1bKpy/d0PWT5rEOSM6La9PiHZ0k1RRZQiwVdVJfQ3BPHgg== +tsutils@3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== dependencies: tslib "^1.8.1" @@ -1353,10 +1469,10 @@ 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= -typeorm@^0.2.17: - version "0.2.18" - resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.18.tgz#8ae1d21104117724af41ddc11035c40a705e1de8" - integrity sha512-S553GwtG5ab268+VmaLCN7gKDqFPIzUw0eGMTobJ9yr0Np62Ojfx8j1Oa9bIeh5p7Pz1/kmGabAHoP1MYK05pA== +typeorm@0.2.17: + version "0.2.17" + resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.17.tgz#eb98e9eeb2ce0dfc884620f49de0aeca3dc4e027" + integrity sha512-a2Yi6aG7qcSQNyYHjAZtRwhuMKt/ZPmNQg8PvpgF52Z3AgJ4LL4T5mtpfTzKgNzM4o4wP0JQcZNoGGlaRovKpw== dependencies: app-root-path "^2.0.1" buffer "^5.1.0" @@ -1373,10 +1489,10 @@ typeorm@^0.2.17: yargonaut "^1.1.2" yargs "^13.2.1" -typescript@2.7.x: - version "2.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" - integrity sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw== +typescript@4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== uri-js@^4.2.2: version "4.2.2" @@ -1456,6 +1572,15 @@ wrap-ansi@^5.1.0: string-width "^3.0.0" strip-ansi "^5.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -1476,9 +1601,14 @@ xmlbuilder@~11.0.0: integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== y18n@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + version "4.0.3" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== yargonaut@^1.1.2: version "1.1.4" @@ -1489,7 +1619,7 @@ yargonaut@^1.1.2: figlet "^1.1.1" parent-require "^1.0.0" -yargs-parser@^13.1.1: +yargs-parser@^13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== @@ -1497,10 +1627,15 @@ yargs-parser@^13.1.1: camelcase "^5.0.0" decamelize "^1.2.0" -yargs@^13.0.0, yargs@^13.2.1: - version "13.3.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" - integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== +yargs-parser@^20.2.2: + version "20.2.7" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a" + integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw== + +yargs@^13.2.1: + version "13.3.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== dependencies: cliui "^5.0.0" find-up "^3.0.0" @@ -1511,4 +1646,17 @@ yargs@^13.0.0, yargs@^13.2.1: string-width "^3.0.0" which-module "^2.0.0" y18n "^4.0.0" - yargs-parser "^13.1.1" + yargs-parser "^13.1.2" + +yargs@^16.0.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" diff --git a/e2e/coverage/BUILD.bazel b/e2e/coverage/BUILD.bazel index 29b6d6564d..e98d47a443 100644 --- a/e2e/coverage/BUILD.bazel +++ b/e2e/coverage/BUILD.bazel @@ -1,5 +1,5 @@ load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test") -load("@npm//@bazel/typescript:index.bzl", "ts_library") +load("@npm//@bazel/concatjs:index.bzl", "ts_library") ts_library( name = "coverage_test_srcs", diff --git a/e2e/coverage/WORKSPACE b/e2e/coverage/WORKSPACE index be7a7ff23d..90797f489c 100644 --- a/e2e/coverage/WORKSPACE +++ b/e2e/coverage/WORKSPACE @@ -12,23 +12,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace( - name = "e2e_coverage", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_coverage") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], +) + +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + +# Load web_test_suite +http_archive( + name = "io_bazel_rules_webtesting", + sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a", + urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"], ) load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( name = "npm", + exports_directories_only = False, package_json = "//:package.json", yarn_lock = "//:yarn.lock", ) diff --git a/e2e/coverage/package.json b/e2e/coverage/package.json index 1206f227d1..4cb26a5d94 100644 --- a/e2e/coverage/package.json +++ b/e2e/coverage/package.json @@ -1,10 +1,10 @@ { "name": "e2e-coverage", "dependencies": { - "@bazel/jasmine": "^3.4.1", - "@bazel/typescript": "^3.4.1", + "@bazel/concatjs": "^5.8.1", + "@bazel/jasmine": "^5.8.1", "jasmine": "3.6.1", - "typescript": "3.9.7" + "typescript": "4.3.2" }, "scripts": { "test": "bazel coverage ..." diff --git a/e2e/coverage/yarn.lock b/e2e/coverage/yarn.lock index d09ba843c8..b01c1d53dc 100644 --- a/e2e/coverage/yarn.lock +++ b/e2e/coverage/yarn.lock @@ -2,23 +2,22 @@ # yarn lockfile v1 -"@bazel/jasmine@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.4.1.tgz#0f9f4fbf973e4c8b8411c2bf3086a6d2398ffcab" - integrity sha512-nbyg5+6m+KUEmxQX5N65gfV+zTUbIjXYq/m3zYFr/hx1Ql/n2tVBBHcxRO4pAbjDhnpuFQgFoAJPzKe5sIL2iA== - dependencies: - c8 "~7.5.0" - jasmine-reporters "~2.4.0" - -"@bazel/typescript@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.4.1.tgz#ec52292b240157cd2d874ff7ea7857da8416c00c" - integrity sha512-OKpfjFRhudsaUBL3xH1oAbat+bwdRyfAOTn2qgMQSO3vR4ZBBVYk7GVMJzWamLkbDS0aY5ws5wLfDScJSKD2ww== +"@bazel/concatjs@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-5.8.1.tgz#dd20882429e382cae79c08cbd3238dfc680d2d67" + integrity sha512-TkARsNUxgi3bjFeGwIGlffmQglNhuR9qK9uE7uKhdBZvQE5caAWVCjYiMTzo3viKDhwKn5QNRcHY5huuJMVFfA== dependencies: protobufjs "6.8.8" - semver "5.6.0" source-map-support "0.5.9" - tsutils "2.27.2" + tsutils "3.21.0" + +"@bazel/jasmine@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-5.8.1.tgz#c549f10806474ff742f37544733fbfdccf78ba66" + integrity sha512-052veW5EbJRH+5hL4l9Sf99bTmdKQ5WXXMF0QiBOZcA3ZHYMAaKfYNO+brutiWoX6FrBloiskLrMzF8OiHBqyw== + dependencies: + c8 "~7.5.0" + jasmine-reporters "~2.5.0" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" @@ -121,6 +120,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.28.tgz#0e36d718a29355ee51cec83b42d921299200f6d9" integrity sha512-dzjES1Egb4c1a89C7lKwQh8pwjYmlOAG9dW1pBgxEk57tMrLnssOfEthz8kdkNaBd7lIqQx7APm5+mZ619IiCQ== +"@xmldom/xmldom@^0.7.3": + version "0.7.5" + resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.5.tgz#09fa51e356d07d0be200642b0e4f91d8e6dd408d" + integrity sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A== + ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" @@ -725,13 +729,13 @@ jasmine-core@~3.6.0: resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.6.0.tgz#491f3bb23941799c353ceb7a45b38a950ebc5a20" integrity sha512-8uQYa7zJN8hq9z+g8z1bqCfdC8eoDAeVnM5sfqs7KHv9/ifoJ500m018fpFc7RDaO6SWCLCXwo/wPSNcdYTgcw== -jasmine-reporters@~2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.4.0.tgz#708c17ae70ba6671e3a930bb1b202aab80a31409" - integrity sha512-jxONSrBLN1vz/8zCx5YNWQSS8iyDAlXQ5yk1LuqITe4C6iXCDx5u6Q0jfNtkKhL4qLZPe69fL+AWvXFt9/x38w== +jasmine-reporters@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.5.0.tgz#f9e2e0f82aaa2e07e8d553be56457efe0fd8b39e" + integrity sha512-J69peyTR8j6SzvIPP6aO1Y00wwCqXuIvhwTYvE/di14roCf6X3wDZ4/cKGZ2fGgufjhP2FKjpgrUIKjwau4e/Q== dependencies: - mkdirp "^0.5.1" - xmldom "^0.5.0" + "@xmldom/xmldom" "^0.7.3" + mkdirp "^1.0.4" jasmine@3.6.1: version "3.6.1" @@ -827,11 +831,6 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - mixin-deep@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" @@ -840,12 +839,10 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== ms@2.0.0: version "2.0.0" @@ -1014,11 +1011,6 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -semver@5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" - integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== - semver@^6.0.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" @@ -1197,17 +1189,17 @@ tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== -tsutils@2.27.2: - version "2.27.2" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.27.2.tgz#60ba88a23d6f785ec4b89c6e8179cac9b431f1c7" - integrity sha512-qf6rmT84TFMuxAKez2pIfR8UCai49iQsfB7YWVjV1bKpy/d0PWT5rEOSM6La9PiHZ0k1RRZQiwVdVJfQ3BPHgg== +tsutils@3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== dependencies: tslib "^1.8.1" -typescript@3.9.7: - version "3.9.7" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" - integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== +typescript@4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== union-value@^1.0.0: version "1.0.1" @@ -1267,11 +1259,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -xmldom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.5.0.tgz#193cb96b84aa3486127ea6272c4596354cb4962e" - integrity sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA== - y18n@^5.0.5: version "5.0.5" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18" diff --git a/e2e/fine_grained_symlinks/WORKSPACE b/e2e/fine_grained_symlinks/WORKSPACE index 05f2ed530f..7615e8b865 100644 --- a/e2e/fine_grained_symlinks/WORKSPACE +++ b/e2e/fine_grained_symlinks/WORKSPACE @@ -1,23 +1,23 @@ -workspace( - name = "e2e_fine_grained_symlinks", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_fine_grained_symlinks") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") # This test needs to run with yarn 1.9.2 to test the fix for # https://github.com/bazelbuild/rules_nodejs/issues/438 and # https://github.com/bazelbuild/rules_nodejs/issues/428 node_repositories( - node_version = "10.3.0", yarn_version = "1.9.2", ) diff --git a/e2e/fine_grained_symlinks/package.json b/e2e/fine_grained_symlinks/package.json index 320958f969..a11af87a1b 100644 --- a/e2e/fine_grained_symlinks/package.json +++ b/e2e/fine_grained_symlinks/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "webpack": "4.26.1" + "webpack": "5.38.1" }, "scripts": { "test": "bazel test ..." diff --git a/e2e/fine_grained_symlinks/yarn.lock b/e2e/fine_grained_symlinks/yarn.lock index e7c8e64f9e..aa5c6b4a23 100644 --- a/e2e/fine_grained_symlinks/yarn.lock +++ b/e2e/fine_grained_symlinks/yarn.lock @@ -2,1090 +2,315 @@ # yarn lockfile v1 -"@webassemblyjs/ast@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.7.11.tgz#b988582cafbb2b095e8b556526f30c90d057cace" - dependencies: - "@webassemblyjs/helper-module-context" "1.7.11" - "@webassemblyjs/helper-wasm-bytecode" "1.7.11" - "@webassemblyjs/wast-parser" "1.7.11" - -"@webassemblyjs/floating-point-hex-parser@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.11.tgz#a69f0af6502eb9a3c045555b1a6129d3d3f2e313" - -"@webassemblyjs/helper-api-error@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.11.tgz#c7b6bb8105f84039511a2b39ce494f193818a32a" - -"@webassemblyjs/helper-buffer@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.11.tgz#3122d48dcc6c9456ed982debe16c8f37101df39b" - -"@webassemblyjs/helper-code-frame@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.11.tgz#cf8f106e746662a0da29bdef635fcd3d1248364b" - dependencies: - "@webassemblyjs/wast-printer" "1.7.11" - -"@webassemblyjs/helper-fsm@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.11.tgz#df38882a624080d03f7503f93e3f17ac5ac01181" - -"@webassemblyjs/helper-module-context@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.11.tgz#d874d722e51e62ac202476935d649c802fa0e209" - -"@webassemblyjs/helper-wasm-bytecode@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.11.tgz#dd9a1e817f1c2eb105b4cf1013093cb9f3c9cb06" - -"@webassemblyjs/helper-wasm-section@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.11.tgz#9c9ac41ecf9fbcfffc96f6d2675e2de33811e68a" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/helper-buffer" "1.7.11" - "@webassemblyjs/helper-wasm-bytecode" "1.7.11" - "@webassemblyjs/wasm-gen" "1.7.11" - -"@webassemblyjs/ieee754@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.7.11.tgz#c95839eb63757a31880aaec7b6512d4191ac640b" +"@types/eslint-scope@^3.7.0": + version "3.7.0" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.0.tgz#4792816e31119ebd506902a482caec4951fabd86" + integrity sha512-O/ql2+rrCUe2W2rs7wMR+GqPRcgB6UiqN5RhrR5xruFlY7l9YLMn0ZkDzjoHLeiFkR8MCQZVudUuuvQ2BLC9Qw== + dependencies: + "@types/eslint" "*" + "@types/estree" "*" + +"@types/eslint@*": + version "7.2.13" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.2.13.tgz#e0ca7219ba5ded402062ad6f926d491ebb29dd53" + integrity sha512-LKmQCWAlnVHvvXq4oasNUMTJJb2GwSyTY8+1C7OH5ILR8mPLaljv1jxL1bXW3xB3jFbQxTKxJAvI8PyjB09aBg== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*": + version "0.0.48" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.48.tgz#18dc8091b285df90db2f25aa7d906cfc394b7f74" + integrity sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew== + +"@types/estree@^0.0.47": + version "0.0.47" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.47.tgz#d7a51db20f0650efec24cd04994f523d93172ed4" + integrity sha512-c5ciR06jK8u9BstrmJyO97m+klJrrhCf9u3rLu3DEAJBirxRqSCvDQoYKmxuYwQI5SZChAWu+tq9oVlGRuzPAg== + +"@types/json-schema@*", "@types/json-schema@^7.0.6": + version "7.0.7" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" + integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== + +"@types/node@*": + version "15.6.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-15.6.2.tgz#c61d49f38af70da32424b5322eee21f97e627175" + integrity sha512-dxcOx8801kMo3KlU+C+/ctWrzREAH7YvoF3aoVpRdqgs+Kf7flp+PJDN/EX5bME3suDUZHsxes9hpvBmzYlWbA== + +"@webassemblyjs/ast@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.0.tgz#a5aa679efdc9e51707a4207139da57920555961f" + integrity sha512-kX2W49LWsbthrmIRMbQZuQDhGtjyqXfEmmHyEi4XWnSZtPmxY0+3anPIzsnRb45VH/J55zlOfWvZuY47aJZTJg== + dependencies: + "@webassemblyjs/helper-numbers" "1.11.0" + "@webassemblyjs/helper-wasm-bytecode" "1.11.0" + +"@webassemblyjs/floating-point-hex-parser@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.0.tgz#34d62052f453cd43101d72eab4966a022587947c" + integrity sha512-Q/aVYs/VnPDVYvsCBL/gSgwmfjeCb4LW8+TMrO3cSzJImgv8lxxEPM2JA5jMrivE7LSz3V+PFqtMbls3m1exDA== + +"@webassemblyjs/helper-api-error@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.0.tgz#aaea8fb3b923f4aaa9b512ff541b013ffb68d2d4" + integrity sha512-baT/va95eXiXb2QflSx95QGT5ClzWpGaa8L7JnJbgzoYeaA27FCvuBXU758l+KXWRndEmUXjP0Q5fibhavIn8w== + +"@webassemblyjs/helper-buffer@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.0.tgz#d026c25d175e388a7dbda9694e91e743cbe9b642" + integrity sha512-u9HPBEl4DS+vA8qLQdEQ6N/eJQ7gT7aNvMIo8AAWvAl/xMrcOSiI2M0MAnMCy3jIFke7bEee/JwdX1nUpCtdyA== + +"@webassemblyjs/helper-numbers@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.0.tgz#7ab04172d54e312cc6ea4286d7d9fa27c88cd4f9" + integrity sha512-DhRQKelIj01s5IgdsOJMKLppI+4zpmcMQ3XboFPLwCpSNH6Hqo1ritgHgD0nqHeSYqofA6aBN/NmXuGjM1jEfQ== + dependencies: + "@webassemblyjs/floating-point-hex-parser" "1.11.0" + "@webassemblyjs/helper-api-error" "1.11.0" + "@xtuc/long" "4.2.2" + +"@webassemblyjs/helper-wasm-bytecode@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.0.tgz#85fdcda4129902fe86f81abf7e7236953ec5a4e1" + integrity sha512-MbmhvxXExm542tWREgSFnOVo07fDpsBJg3sIl6fSp9xuu75eGz5lz31q7wTLffwL3Za7XNRCMZy210+tnsUSEA== + +"@webassemblyjs/helper-wasm-section@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.0.tgz#9ce2cc89300262509c801b4af113d1ca25c1a75b" + integrity sha512-3Eb88hcbfY/FCukrg6i3EH8H2UsD7x8Vy47iVJrP967A9JGqgBVL9aH71SETPx1JrGsOUVLo0c7vMCN22ytJew== + dependencies: + "@webassemblyjs/ast" "1.11.0" + "@webassemblyjs/helper-buffer" "1.11.0" + "@webassemblyjs/helper-wasm-bytecode" "1.11.0" + "@webassemblyjs/wasm-gen" "1.11.0" + +"@webassemblyjs/ieee754@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.0.tgz#46975d583f9828f5d094ac210e219441c4e6f5cf" + integrity sha512-KXzOqpcYQwAfeQ6WbF6HXo+0udBNmw0iXDmEK5sFlmQdmND+tr773Ti8/5T/M6Tl/413ArSJErATd8In3B+WBA== dependencies: "@xtuc/ieee754" "^1.2.0" -"@webassemblyjs/leb128@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.7.11.tgz#d7267a1ee9c4594fd3f7e37298818ec65687db63" - dependencies: - "@xtuc/long" "4.2.1" - -"@webassemblyjs/utf8@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.7.11.tgz#06d7218ea9fdc94a6793aa92208160db3d26ee82" - -"@webassemblyjs/wasm-edit@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.11.tgz#8c74ca474d4f951d01dbae9bd70814ee22a82005" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/helper-buffer" "1.7.11" - "@webassemblyjs/helper-wasm-bytecode" "1.7.11" - "@webassemblyjs/helper-wasm-section" "1.7.11" - "@webassemblyjs/wasm-gen" "1.7.11" - "@webassemblyjs/wasm-opt" "1.7.11" - "@webassemblyjs/wasm-parser" "1.7.11" - "@webassemblyjs/wast-printer" "1.7.11" - -"@webassemblyjs/wasm-gen@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.11.tgz#9bbba942f22375686a6fb759afcd7ac9c45da1a8" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/helper-wasm-bytecode" "1.7.11" - "@webassemblyjs/ieee754" "1.7.11" - "@webassemblyjs/leb128" "1.7.11" - "@webassemblyjs/utf8" "1.7.11" - -"@webassemblyjs/wasm-opt@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.11.tgz#b331e8e7cef8f8e2f007d42c3a36a0580a7d6ca7" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/helper-buffer" "1.7.11" - "@webassemblyjs/wasm-gen" "1.7.11" - "@webassemblyjs/wasm-parser" "1.7.11" - -"@webassemblyjs/wasm-parser@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.11.tgz#6e3d20fa6a3519f6b084ef9391ad58211efb0a1a" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/helper-api-error" "1.7.11" - "@webassemblyjs/helper-wasm-bytecode" "1.7.11" - "@webassemblyjs/ieee754" "1.7.11" - "@webassemblyjs/leb128" "1.7.11" - "@webassemblyjs/utf8" "1.7.11" - -"@webassemblyjs/wast-parser@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.7.11.tgz#25bd117562ca8c002720ff8116ef9072d9ca869c" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/floating-point-hex-parser" "1.7.11" - "@webassemblyjs/helper-api-error" "1.7.11" - "@webassemblyjs/helper-code-frame" "1.7.11" - "@webassemblyjs/helper-fsm" "1.7.11" - "@xtuc/long" "4.2.1" - -"@webassemblyjs/wast-printer@1.7.11": - version "1.7.11" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.7.11.tgz#c4245b6de242cb50a2cc950174fdbf65c78d7813" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/wast-parser" "1.7.11" - "@xtuc/long" "4.2.1" +"@webassemblyjs/leb128@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.0.tgz#f7353de1df38aa201cba9fb88b43f41f75ff403b" + integrity sha512-aqbsHa1mSQAbeeNcl38un6qVY++hh8OpCOzxhixSYgbRfNWcxJNJQwe2rezK9XEcssJbbWIkblaJRwGMS9zp+g== + dependencies: + "@xtuc/long" "4.2.2" + +"@webassemblyjs/utf8@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.0.tgz#86e48f959cf49e0e5091f069a709b862f5a2cadf" + integrity sha512-A/lclGxH6SpSLSyFowMzO/+aDEPU4hvEiooCMXQPcQFPPJaYcPQNKGOCLUySJsYJ4trbpr+Fs08n4jelkVTGVw== + +"@webassemblyjs/wasm-edit@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.0.tgz#ee4a5c9f677046a210542ae63897094c2027cb78" + integrity sha512-JHQ0damXy0G6J9ucyKVXO2j08JVJ2ntkdJlq1UTiUrIgfGMmA7Ik5VdC/L8hBK46kVJgujkBIoMtT8yVr+yVOQ== + dependencies: + "@webassemblyjs/ast" "1.11.0" + "@webassemblyjs/helper-buffer" "1.11.0" + "@webassemblyjs/helper-wasm-bytecode" "1.11.0" + "@webassemblyjs/helper-wasm-section" "1.11.0" + "@webassemblyjs/wasm-gen" "1.11.0" + "@webassemblyjs/wasm-opt" "1.11.0" + "@webassemblyjs/wasm-parser" "1.11.0" + "@webassemblyjs/wast-printer" "1.11.0" + +"@webassemblyjs/wasm-gen@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.0.tgz#3cdb35e70082d42a35166988dda64f24ceb97abe" + integrity sha512-BEUv1aj0WptCZ9kIS30th5ILASUnAPEvE3tVMTrItnZRT9tXCLW2LEXT8ezLw59rqPP9klh9LPmpU+WmRQmCPQ== + dependencies: + "@webassemblyjs/ast" "1.11.0" + "@webassemblyjs/helper-wasm-bytecode" "1.11.0" + "@webassemblyjs/ieee754" "1.11.0" + "@webassemblyjs/leb128" "1.11.0" + "@webassemblyjs/utf8" "1.11.0" + +"@webassemblyjs/wasm-opt@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.0.tgz#1638ae188137f4bb031f568a413cd24d32f92978" + integrity sha512-tHUSP5F4ywyh3hZ0+fDQuWxKx3mJiPeFufg+9gwTpYp324mPCQgnuVKwzLTZVqj0duRDovnPaZqDwoyhIO8kYg== + dependencies: + "@webassemblyjs/ast" "1.11.0" + "@webassemblyjs/helper-buffer" "1.11.0" + "@webassemblyjs/wasm-gen" "1.11.0" + "@webassemblyjs/wasm-parser" "1.11.0" + +"@webassemblyjs/wasm-parser@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.0.tgz#3e680b8830d5b13d1ec86cc42f38f3d4a7700754" + integrity sha512-6L285Sgu9gphrcpDXINvm0M9BskznnzJTE7gYkjDbxET28shDqp27wpruyx3C2S/dvEwiigBwLA1cz7lNUi0kw== + dependencies: + "@webassemblyjs/ast" "1.11.0" + "@webassemblyjs/helper-api-error" "1.11.0" + "@webassemblyjs/helper-wasm-bytecode" "1.11.0" + "@webassemblyjs/ieee754" "1.11.0" + "@webassemblyjs/leb128" "1.11.0" + "@webassemblyjs/utf8" "1.11.0" + +"@webassemblyjs/wast-printer@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.11.0.tgz#680d1f6a5365d6d401974a8e949e05474e1fab7e" + integrity sha512-Fg5OX46pRdTgB7rKIUojkh9vXaVN6sGYCnEiJN1GYkb0RPwShZXp6KTDqmoMdQPKhcroOXh3fEzmkWmCYaKYhQ== + dependencies: + "@webassemblyjs/ast" "1.11.0" + "@xtuc/long" "4.2.2" "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" -"@xtuc/long@4.2.1": - version "4.2.1" - resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.1.tgz#5c85d662f76fa1d34575766c5dcd6615abcd30d8" - -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - -acorn-dynamic-import@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz#901ceee4c7faaef7e07ad2a47e890675da50a278" - dependencies: - acorn "^5.0.0" - -acorn@^5.0.0, acorn@^5.6.2: - version "5.7.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" +"@xtuc/long@4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" + integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== -ajv-errors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.0.tgz#ecf021fa108fd17dfb5e6b383f2dd233e31ffc59" +acorn@^8.2.1: + version "8.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.3.0.tgz#1193f9b96c4e8232f00b11a9edff81b2c8b98b88" + integrity sha512-tqPKHZ5CaBJw0Xmy0ZZvLs1qTV+BNFSyvn77ASXkpBNfIRk8ev26fKrD9iLGwGA9zedPao52GSHzq8lyZG0NUw== -ajv-keywords@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" +ajv-keywords@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== -ajv@^6.1.0: - version "6.5.5" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.5.tgz#cf97cdade71c6399a92c6d6c4177381291b781a1" +ajv@^6.12.5: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: - fast-deep-equal "^2.0.1" + fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - -anymatch@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" - dependencies: - micromatch "^3.1.4" - normalize-path "^2.1.1" - -aproba@^1.0.3, aproba@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -arr-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - -arr-flatten@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - -arr-union@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - -array-unique@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - -asn1.js@^4.0.0: - version "4.10.1" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -assert@^1.1.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" - dependencies: - util "0.10.3" - -assign-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - -async-each@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" - -atob@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -base64-js@^1.0.2: - version "1.3.0" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" - -base@^0.11.1: - version "0.11.2" - resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" - dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" - -big.js@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" - -binary-extensions@^1.0.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14" - -bluebird@^3.5.1: - version "3.5.3" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" - -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.9" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^2.3.0, braces@^2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - -brorand@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - -browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.2.0" - resolved "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - -browserify-cipher@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" - dependencies: - browserify-aes "^1.0.4" - browserify-des "^1.0.0" - evp_bytestokey "^1.0.0" - -browserify-des@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" - dependencies: - cipher-base "^1.0.1" - des.js "^1.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -browserify-rsa@^4.0.0: - version "4.0.1" - resolved "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" +browserslist@^4.14.5: + version "4.16.6" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.6.tgz#d7901277a5a88e554ed305b183ec9b0c08f66fa2" + integrity sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ== dependencies: - bn.js "^4.1.0" - randombytes "^2.0.1" - -browserify-sign@^4.0.0: - version "4.0.4" - resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" - dependencies: - bn.js "^4.1.1" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.2" - elliptic "^6.0.0" - inherits "^2.0.1" - parse-asn1 "^5.0.0" - -browserify-zlib@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" - dependencies: - pako "~1.0.5" + caniuse-lite "^1.0.30001219" + colorette "^1.2.2" + electron-to-chromium "^1.3.723" + escalade "^3.1.1" + node-releases "^1.1.71" buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" -buffer-xor@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - -buffer@^4.3.0: - version "4.9.1" - resolved "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - isarray "^1.0.0" - -builtin-status-codes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" - -cacache@^11.0.2: - version "11.3.1" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.1.tgz#d09d25f6c4aca7a6d305d141ae332613aa1d515f" - dependencies: - bluebird "^3.5.1" - chownr "^1.0.1" - figgy-pudding "^3.1.0" - glob "^7.1.2" - graceful-fs "^4.1.11" - lru-cache "^4.1.3" - mississippi "^3.0.0" - mkdirp "^0.5.1" - move-concurrently "^1.0.1" - promise-inflight "^1.0.1" - rimraf "^2.6.2" - ssri "^6.0.0" - unique-filename "^1.1.0" - y18n "^4.0.0" - -cache-base@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" - -chokidar@^2.0.2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" - dependencies: - anymatch "^2.0.0" - async-each "^1.0.0" - braces "^2.3.0" - glob-parent "^3.1.0" - inherits "^2.0.1" - is-binary-path "^1.0.0" - is-glob "^4.0.0" - lodash.debounce "^4.0.8" - normalize-path "^2.1.1" - path-is-absolute "^1.0.0" - readdirp "^2.0.0" - upath "^1.0.5" - optionalDependencies: - fsevents "^1.2.2" - -chownr@^1.0.1, chownr@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" - -chrome-trace-event@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz#45a91bd2c20c9411f0963b5aaeb9a1b95e09cc48" - dependencies: - tslib "^1.9.0" - -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -class-utils@^0.3.5: - version "0.3.6" - resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -collection-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" - -commander@~2.17.1: - version "2.17.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" - -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - -component-emitter@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -concat-stream@^1.5.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -console-browserify@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" - dependencies: - date-now "^0.1.4" - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - -constants-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" +caniuse-lite@^1.0.30001219: + version "1.0.30001233" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001233.tgz#b7cb4a377a4b12ed240d2fa5c792951a06e5f2c4" + integrity sha512-BmkbxLfStqiPA7IEzQpIk0UFZFf3A4E6fzjPJ6OR+bFC2L8ES9J8zGA/asoi47p8XDVkev+WJo2I2Nc8c/34Yg== -copy-concurrently@^1.0.0: - version "1.0.5" - resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" - dependencies: - aproba "^1.1.1" - fs-write-stream-atomic "^1.0.8" - iferr "^0.1.5" - mkdirp "^0.5.1" - rimraf "^2.5.4" - run-queue "^1.0.0" - -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - -core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -create-ecdh@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" - dependencies: - bn.js "^4.1.0" - elliptic "^6.0.0" - -create-hash@^1.1.0, create-hash@^1.1.2: - version "1.2.0" - resolved "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: - version "1.1.7" - resolved "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -crypto-browserify@^3.11.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" - dependencies: - browserify-cipher "^1.0.0" - browserify-sign "^4.0.0" - create-ecdh "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.0" - diffie-hellman "^5.0.0" - inherits "^2.0.1" - pbkdf2 "^3.0.3" - public-encrypt "^4.0.0" - randombytes "^2.0.0" - randomfill "^1.0.3" - -cyclist@~0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" - -date-now@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" - -debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - dependencies: - ms "2.0.0" - -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - -define-property@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - dependencies: - is-descriptor "^0.1.0" - -define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - dependencies: - is-descriptor "^1.0.0" - -define-property@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" - dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" - -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - -des.js@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" - dependencies: - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -detect-libc@^1.0.2: +chrome-trace-event@^1.0.2: version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" + integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== -diffie-hellman@^5.0.0: - version "5.0.3" - resolved "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" - dependencies: - bn.js "^4.1.0" - miller-rabin "^4.0.0" - randombytes "^2.0.0" +colorette@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" + integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== -domain-browser@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" +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== -duplexify@^3.4.2, duplexify@^3.6.0: - version "3.6.1" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.6.1.tgz#b1a7a29c4abfd639585efaecce80d666b1e34125" - dependencies: - end-of-stream "^1.0.0" - inherits "^2.0.1" - readable-stream "^2.0.0" - stream-shift "^1.0.0" - -elliptic@^6.0.0: - version "6.5.3" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" - dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" - hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" - -emojis-list@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" +electron-to-chromium@^1.3.723: + version "1.3.743" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.743.tgz#fcec24d6d647cb84fd796b42caa1b4039a180894" + integrity sha512-K2wXfo9iZQzNJNx67+Pld0DRF+9bYinj62gXCdgPhcu1vidwVuLPHQPPFnCdO55njWigXXpfBiT90jGUPbw8Zg== -end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" +enhanced-resolve@^5.8.0: + version "5.8.2" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz#15ddc779345cbb73e97c611cd00c01c1e7bf4d8b" + integrity sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA== dependencies: - once "^1.4.0" + graceful-fs "^4.2.4" + tapable "^2.2.0" -enhanced-resolve@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.4.0" - tapable "^1.0.0" +es-module-lexer@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.4.1.tgz#dda8c6a14d8f340a24e34331e0fab0cb50438e0e" + integrity sha512-ooYciCUtfw6/d2w56UVeqHPcoCFAiJdz5XOkYpv/Txl1HMUozpXjz/2RIQgqwKdXNDPSF1W7mJCFse3G+HDyAA== -errno@^0.1.3, errno@~0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" - dependencies: - prr "~1.0.1" +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -eslint-scope@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" +eslint-scope@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== dependencies: - esrecurse "^4.1.0" + esrecurse "^4.3.0" estraverse "^4.1.1" -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: - estraverse "^4.1.0" + estraverse "^5.2.0" -estraverse@^4.1.0, estraverse@^4.1.1: +estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" -events@^1.0.0: - version "1.1.1" - resolved "https://registry.npmjs.org/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" - -evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - -expand-brackets@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - dependencies: - is-extendable "^0.1.0" +estraverse@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" + integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" +events@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== -extglob@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" -figgy-pudding@^3.1.0, figgy-pudding@^3.5.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" - -fill-range@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" - -find-cache-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.0.0.tgz#4c1faed59f45184530fb9d7fa123a4d04a98472d" - dependencies: - commondir "^1.0.1" - make-dir "^1.0.0" - pkg-dir "^3.0.0" - -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" - dependencies: - locate-path "^3.0.0" - -flush-write-stream@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd" - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.4" - -for-in@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - -fragment-cache@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - dependencies: - map-cache "^0.2.2" - -from2@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.0" - -fs-minipass@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" - dependencies: - minipass "^2.2.1" - -fs-write-stream-atomic@^1.0.8: - version "1.0.10" - resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" - dependencies: - graceful-fs "^4.1.2" - iferr "^0.1.5" - imurmurhash "^0.1.4" - readable-stream "1 || 2" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -fsevents@^1.2.2: - version "1.2.4" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" - dependencies: - nan "^2.9.2" - node-pre-gyp "^0.10.0" - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - -glob-parent@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" - dependencies: - is-glob "^3.1.0" - path-dirname "^1.0.0" +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@^7.0.5, glob@^7.1.2: - version "7.1.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2: +graceful-fs@^4.1.2: version "4.1.15" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - -has-value@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" - -has-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" - -has-values@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - -has-values@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - -hash-base@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hmac-drbg@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -https-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" +graceful-fs@^4.2.4: + version "4.2.6" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" + integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== -iconv-lite@^0.4.4: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - dependencies: - safer-buffer ">= 2.1.2 < 3" - -ieee754@^1.1.4: - version "1.1.12" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b" - -iferr@^0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" - -ignore-walk@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" - dependencies: - minimatch "^3.0.4" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -indexof@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -ini@~1.3.0: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" - -is-accessor-descriptor@^0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - dependencies: - kind-of "^3.0.2" - -is-accessor-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" - dependencies: - kind-of "^6.0.0" - -is-binary-path@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" - dependencies: - binary-extensions "^1.0.0" - -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - -is-data-descriptor@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" - dependencies: - kind-of "^3.0.2" - -is-data-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" - dependencies: - kind-of "^6.0.0" - -is-descriptor@^0.1.0: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" - dependencies: - is-accessor-descriptor "^0.1.6" - is-data-descriptor "^0.1.4" - kind-of "^5.0.0" - -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" - dependencies: - is-accessor-descriptor "^1.0.0" - is-data-descriptor "^1.0.0" - kind-of "^6.0.2" - -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - -is-extendable@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" - dependencies: - is-plain-object "^2.0.4" - -is-extglob@^2.1.0, is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-glob@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" - dependencies: - is-extglob "^2.1.0" - -is-glob@^4.0.0: +has-flag@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" - dependencies: - is-extglob "^2.1.1" - -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - dependencies: - kind-of "^3.0.2" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" +jest-worker@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.0.2.tgz#4ebeb56cef48b3e7514552f80d0d80c0129f0b05" + integrity sha512-EoBdilOTTyOgmHXtw/cPc+ZrCA0KJMrkXzkrPGNwLmnvvlN1nj7MPrxpT7m+otSv2e1TLaVffzDnE/LB14zJMg== dependencies: - isobject "^3.0.1" - -is-windows@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" json-parse-better-errors@^1.0.2: version "1.0.2" @@ -1095,939 +320,130 @@ json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" -json5@^0.5.0: - version "0.5.1" - resolved "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" - -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - dependencies: - is-buffer "^1.1.5" - -kind-of@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" - -kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" - -loader-runner@^2.3.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.1.tgz#026f12fe7c3115992896ac02ba022ba92971b979" - -loader-utils@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" - dependencies: - big.js "^3.1.3" - emojis-list "^2.0.0" - json5 "^0.5.0" - -locate-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.0" - -lodash.debounce@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" - -lru-cache@^4.1.3: - version "4.1.4" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.4.tgz#51cc46e8e6d9530771c857e24ccc720ecdbcc031" - dependencies: - pseudomap "^1.0.2" - yallist "^3.0.2" - -make-dir@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" - dependencies: - pify "^3.0.0" - -map-cache@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - -map-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - dependencies: - object-visit "^1.0.0" - -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -memory-fs@^0.4.0, memory-fs@~0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" - dependencies: - errno "^0.1.3" - readable-stream "^2.0.1" - -micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: - version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - -miller-rabin@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -minipass@^2.2.1, minipass@^2.3.4: - version "2.3.5" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minizlib@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.1.1.tgz#6734acc045a46e61d596a43bb9d9cd326e19cc42" - dependencies: - minipass "^2.2.1" - -mississippi@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" - dependencies: - concat-stream "^1.5.0" - duplexify "^3.4.2" - end-of-stream "^1.1.0" - flush-write-stream "^1.0.0" - from2 "^2.1.0" - parallel-transform "^1.1.0" - pump "^3.0.0" - pumpify "^1.3.3" - stream-each "^1.1.0" - through2 "^2.0.0" - -mixin-deep@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" - dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" - -mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: - version "0.5.1" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -move-concurrently@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" - dependencies: - aproba "^1.1.1" - copy-concurrently "^1.0.0" - fs-write-stream-atomic "^1.0.8" - mkdirp "^0.5.1" - rimraf "^2.5.4" - run-queue "^1.0.3" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -nan@^2.9.2: - version "2.11.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.1.tgz#90e22bccb8ca57ea4cd37cc83d3819b52eea6766" - -nanomatch@^1.2.9: - version "1.2.13" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -needle@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" - dependencies: - debug "^2.1.2" - iconv-lite "^0.4.4" - sax "^1.2.4" - -neo-async@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" - -node-libs-browser@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.1.0.tgz#5f94263d404f6e44767d726901fff05478d600df" - dependencies: - assert "^1.1.1" - browserify-zlib "^0.2.0" - buffer "^4.3.0" - console-browserify "^1.1.0" - constants-browserify "^1.0.0" - crypto-browserify "^3.11.0" - domain-browser "^1.1.1" - events "^1.0.0" - https-browserify "^1.0.0" - os-browserify "^0.3.0" - path-browserify "0.0.0" - process "^0.11.10" - punycode "^1.2.4" - querystring-es3 "^0.2.0" - readable-stream "^2.3.3" - stream-browserify "^2.0.1" - stream-http "^2.7.2" - string_decoder "^1.0.0" - timers-browserify "^2.0.4" - tty-browserify "0.0.0" - url "^0.11.0" - util "^0.10.3" - vm-browserify "0.0.4" - -node-pre-gyp@^0.10.0: - version "0.10.3" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4" - -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - dependencies: - abbrev "1" - osenv "^0.1.4" - -normalize-path@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - dependencies: - remove-trailing-separator "^1.0.1" - -npm-bundled@^1.0.1: - version "1.0.5" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" - -npm-packlist@^1.1.6: - version "1.1.12" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.1.12.tgz#22bde2ebc12e72ca482abd67afc51eb49377243a" - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - -npmlog@^4.0.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - -object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -object-copy@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" - -object-visit@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - dependencies: - isobject "^3.0.0" - -object.pick@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - dependencies: - isobject "^3.0.1" - -once@^1.3.0, once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -os-browserify@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - -os-tmpdir@^1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - -p-limit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" - dependencies: - p-try "^2.0.0" - -p-locate@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" - dependencies: - p-limit "^2.0.0" +loader-runner@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.2.0.tgz#d7022380d66d14c5fb1d496b89864ebcfd478384" + integrity sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw== -p-try@^2.0.0: +merge-stream@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" - -pako@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" - -parallel-transform@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06" - dependencies: - cyclist "~0.2.2" - inherits "^2.0.3" - readable-stream "^2.1.5" - -parse-asn1@^5.0.0: - version "5.1.1" - resolved "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz#f6bf293818332bd0dab54efb16087724745e6ca8" - dependencies: - asn1.js "^4.0.0" - browserify-aes "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.0" - pbkdf2 "^3.0.3" - -pascalcase@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - -path-browserify@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -path-dirname@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" - -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -pbkdf2@^3.0.3: - version "3.0.17" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" +mime-db@1.48.0: + version "1.48.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d" + integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ== -pkg-dir@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" +mime-types@^2.1.27: + version "2.1.31" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.31.tgz#a00d76b74317c61f9c2db2218b8e9f8e9c5c9e6b" + integrity sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg== dependencies: - find-up "^3.0.0" - -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - -process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + mime-db "1.48.0" -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - -promise-inflight@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" - -prr@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -public-encrypt@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" - dependencies: - bn.js "^4.1.0" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - parse-asn1 "^5.0.0" - randombytes "^2.0.1" - safe-buffer "^5.1.2" - -pump@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" +neo-async@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" +node-releases@^1.1.71: + version "1.1.72" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.72.tgz#14802ab6b1039a79a0c7d662b610a5bbd76eacbe" + integrity sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw== -pumpify@^1.3.3: - version "1.5.1" - resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" +p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: - duplexify "^3.6.0" - inherits "^2.0.3" - pump "^2.0.0" - -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - -punycode@^1.2.4: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + yocto-queue "^0.1.0" punycode@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" -querystring-es3@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - -querystring@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" - dependencies: - safe-buffer "^5.1.0" - -randomfill@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: - randombytes "^2.0.5" safe-buffer "^5.1.0" -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: - version "2.3.6" - resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readdirp@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" - dependencies: - graceful-fs "^4.1.11" - micromatch "^3.1.10" - readable-stream "^2.0.2" - -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" - dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - -repeat-element@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" - -repeat-string@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - -resolve-url@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - -ret@~0.1.10: - version "0.1.15" - resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" - -rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -run-queue@^1.0.0, run-queue@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" - dependencies: - aproba "^1.1.1" - -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@^5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" -safe-regex@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - dependencies: - ret "~0.1.10" - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - -sax@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - -schema-utils@^0.4.4: - version "0.4.7" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187" - dependencies: - ajv "^6.1.0" - ajv-keywords "^3.1.0" - -schema-utils@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" - dependencies: - ajv "^6.1.0" - ajv-errors "^1.0.0" - ajv-keywords "^3.1.0" - -semver@^5.3.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" - -serialize-javascript@^1.4.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.5.0.tgz#1aa336162c88a890ddad5384baebc93a655161fe" - -set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" - -set-value@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" - -setimmediate@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - -sha.js@^2.4.0, sha.js@^2.4.8: - version "2.4.11" - resolved "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -signal-exit@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" +schema-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.0.0.tgz#67502f6aa2b66a2d4032b4279a2944978a0913ef" + integrity sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA== dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" + "@types/json-schema" "^7.0.6" + ajv "^6.12.5" + ajv-keywords "^3.5.2" -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" +serialize-javascript@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== dependencies: - kind-of "^3.2.0" + randombytes "^2.1.0" -snapdragon@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" - dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" - -source-list-map@^2.0.0: +source-list-map@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" + integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== -source-map-resolve@^0.5.0: - version "0.5.2" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" - dependencies: - atob "^2.1.1" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" - -source-map-support@~0.5.6: - version "0.5.9" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" +source-map-support@~0.5.19: + version "0.5.19" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== 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" - -source-map@^0.5.6: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" - dependencies: - extend-shallow "^3.0.0" - -ssri@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" - dependencies: - figgy-pudding "^3.5.1" - -static-extend@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" - -stream-browserify@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" - dependencies: - inherits "~2.0.1" - readable-stream "^2.0.2" - -stream-each@^1.1.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" - dependencies: - end-of-stream "^1.1.0" - stream-shift "^1.0.0" - -stream-http@^2.7.2: - version "2.8.3" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.3.tgz#b2d242469288a5a27ec4fe8933acf623de6514fc" - dependencies: - builtin-status-codes "^3.0.0" - inherits "^2.0.1" - readable-stream "^2.3.6" - to-arraybuffer "^1.0.0" - xtend "^4.0.0" - -stream-shift@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" - -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -"string-width@^1.0.2 || 2": - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string_decoder@^1.0.0, string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" +source-map@~0.7.2: + version "0.7.3" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" + integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: - ansi-regex "^3.0.0" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + has-flag "^4.0.0" -tapable@^1.0.0, tapable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.0.tgz#0d076a172e3d9ba088fd2272b2668fb8d194b78c" +tapable@^2.1.1, tapable@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.0.tgz#5c373d281d9c672848213d0e037d1c4165ab426b" + integrity sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw== -tar@^4: - version "4.4.8" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" +terser-webpack-plugin@^5.1.1: + version "5.1.3" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.1.3.tgz#30033e955ca28b55664f1e4b30a1347e61aa23af" + integrity sha512-cxGbMqr6+A2hrIB5ehFIF+F/iST5ZOxvOmy9zih9ySbP1C2oEWQSOUS+2SNBTjzx5xLKO4xnod9eywdfq1Nb9A== dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.3.4" - minizlib "^1.1.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.2" - -terser-webpack-plugin@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.1.0.tgz#cf7c25a1eee25bf121f4a587bb9e004e3f80e528" - dependencies: - cacache "^11.0.2" - find-cache-dir "^2.0.0" - schema-utils "^1.0.0" - serialize-javascript "^1.4.0" + jest-worker "^27.0.2" + p-limit "^3.1.0" + schema-utils "^3.0.0" + serialize-javascript "^5.0.1" source-map "^0.6.1" - terser "^3.8.1" - webpack-sources "^1.1.0" - worker-farm "^1.5.2" - -terser@^3.8.1: - version "3.10.12" - resolved "https://registry.yarnpkg.com/terser/-/terser-3.10.12.tgz#06d40765e40b33fd97977c0896c75b2b5d42142d" - dependencies: - commander "~2.17.1" - source-map "~0.6.1" - source-map-support "~0.5.6" - -through2@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" - dependencies: - readable-stream "~2.3.6" - xtend "~4.0.1" - -timers-browserify@^2.0.4: - version "2.0.10" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.10.tgz#1d28e3d2aadf1d5a5996c4e9f95601cd053480ae" - dependencies: - setimmediate "^1.0.4" - -to-arraybuffer@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - -to-object-path@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - dependencies: - kind-of "^3.0.2" - -to-regex-range@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" - -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" - dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" - -tslib@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - -tty-browserify@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - -union-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" - dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^0.4.3" - -unique-filename@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" - dependencies: - unique-slug "^2.0.0" + terser "^5.7.0" -unique-slug@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.1.tgz#5e9edc6d1ce8fb264db18a507ef9bd8544451ca6" - dependencies: - imurmurhash "^0.1.4" - -unset-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" +terser@^5.7.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.0.tgz#a761eeec206bc87b605ab13029876ead938ae693" + integrity sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g== dependencies: - has-value "^0.3.1" - isobject "^3.0.0" - -upath@^1.0.5: - version "1.1.0" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" + commander "^2.20.0" + source-map "~0.7.2" + source-map-support "~0.5.19" uri-js@^4.2.2: version "4.2.2" @@ -2035,111 +451,52 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -urix@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - -url@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - dependencies: - punycode "1.3.2" - querystring "0.2.0" - -use@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -util@0.10.3: - version "0.10.3" - resolved "https://registry.npmjs.org/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - dependencies: - inherits "2.0.1" - -util@^0.10.3: - version "0.10.4" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" - dependencies: - inherits "2.0.3" - -vm-browserify@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" +watchpack@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.2.0.tgz#47d78f5415fe550ecd740f99fe2882323a58b1ce" + integrity sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA== dependencies: - indexof "0.0.1" - -watchpack@^1.5.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" - dependencies: - chokidar "^2.0.2" + glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" - neo-async "^2.5.0" -webpack-sources@^1.1.0, webpack-sources@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.3.0.tgz#2a28dcb9f1f45fe960d8f1493252b5ee6530fa85" +webpack-sources@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.0.tgz#9ed2de69b25143a4c18847586ad9eccb19278cfa" + integrity sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ== dependencies: - source-list-map "^2.0.0" - source-map "~0.6.1" + source-list-map "^2.0.1" + source-map "^0.6.1" -webpack@4.26.1: - version "4.26.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.26.1.tgz#ff3a9283d363c07b3494dfa702d08f4f2ef6cb39" - dependencies: - "@webassemblyjs/ast" "1.7.11" - "@webassemblyjs/helper-module-context" "1.7.11" - "@webassemblyjs/wasm-edit" "1.7.11" - "@webassemblyjs/wasm-parser" "1.7.11" - acorn "^5.6.2" - acorn-dynamic-import "^3.0.0" - ajv "^6.1.0" - ajv-keywords "^3.1.0" - chrome-trace-event "^1.0.0" - enhanced-resolve "^4.1.0" - eslint-scope "^4.0.0" +webpack@5.38.1: + version "5.38.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.38.1.tgz#5224c7f24c18e729268d3e3bc97240d6e880258e" + integrity sha512-OqRmYD1OJbHZph6RUMD93GcCZy4Z4wC0ele4FXyYF0J6AxO1vOSuIlU1hkS/lDlR9CDYBz64MZRmdbdnFFoT2g== + dependencies: + "@types/eslint-scope" "^3.7.0" + "@types/estree" "^0.0.47" + "@webassemblyjs/ast" "1.11.0" + "@webassemblyjs/wasm-edit" "1.11.0" + "@webassemblyjs/wasm-parser" "1.11.0" + acorn "^8.2.1" + browserslist "^4.14.5" + chrome-trace-event "^1.0.2" + enhanced-resolve "^5.8.0" + es-module-lexer "^0.4.0" + eslint-scope "5.1.1" + events "^3.2.0" + glob-to-regexp "^0.4.1" + graceful-fs "^4.2.4" json-parse-better-errors "^1.0.2" - loader-runner "^2.3.0" - loader-utils "^1.1.0" - memory-fs "~0.4.1" - micromatch "^3.1.8" - mkdirp "~0.5.0" - neo-async "^2.5.0" - node-libs-browser "^2.0.0" - schema-utils "^0.4.4" - tapable "^1.1.0" - terser-webpack-plugin "^1.1.0" - watchpack "^1.5.0" - webpack-sources "^1.3.0" - -wide-align@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - dependencies: - string-width "^1.0.2 || 2" - -worker-farm@^1.5.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0" - dependencies: - errno "~0.1.7" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -xtend@^4.0.0, xtend@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - -y18n@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - -yallist@^3.0.0, yallist@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" + loader-runner "^4.2.0" + mime-types "^2.1.27" + neo-async "^2.6.2" + schema-utils "^3.0.0" + tapable "^2.1.1" + terser-webpack-plugin "^5.1.1" + watchpack "^2.2.0" + webpack-sources "^2.3.0" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== diff --git a/e2e/jasmine/WORKSPACE b/e2e/jasmine/WORKSPACE index 87e8978fe0..1ce38f1dc8 100644 --- a/e2e/jasmine/WORKSPACE +++ b/e2e/jasmine/WORKSPACE @@ -12,23 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace( - name = "e2e_jasmine", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_jasmine") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( name = "npm", + exports_directories_only = False, package_json = "//:package.json", yarn_lock = "//:yarn.lock", ) diff --git a/e2e/jasmine/package.json b/e2e/jasmine/package.json index 3b0e4d8f8d..35ef80e662 100644 --- a/e2e/jasmine/package.json +++ b/e2e/jasmine/package.json @@ -1,7 +1,7 @@ { "name": "e2e-jasmine", "dependencies": { - "@bazel/jasmine": "^3.4.1", + "@bazel/jasmine": "^5.8.1", "zone.js": "0.8.29" }, "//": "Include an incompatible jasmine as a devDependency to verify that jasmine_node_test works regardless", diff --git a/e2e/jasmine/yarn.lock b/e2e/jasmine/yarn.lock index c76096a3a0..788ad9566b 100644 --- a/e2e/jasmine/yarn.lock +++ b/e2e/jasmine/yarn.lock @@ -2,13 +2,13 @@ # yarn lockfile v1 -"@bazel/jasmine@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.4.1.tgz#0f9f4fbf973e4c8b8411c2bf3086a6d2398ffcab" - integrity sha512-nbyg5+6m+KUEmxQX5N65gfV+zTUbIjXYq/m3zYFr/hx1Ql/n2tVBBHcxRO4pAbjDhnpuFQgFoAJPzKe5sIL2iA== +"@bazel/jasmine@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-5.8.1.tgz#c549f10806474ff742f37544733fbfdccf78ba66" + integrity sha512-052veW5EbJRH+5hL4l9Sf99bTmdKQ5WXXMF0QiBOZcA3ZHYMAaKfYNO+brutiWoX6FrBloiskLrMzF8OiHBqyw== dependencies: c8 "~7.5.0" - jasmine-reporters "~2.4.0" + jasmine-reporters "~2.5.0" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" @@ -35,6 +35,11 @@ resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== +"@xmldom/xmldom@^0.7.3": + version "0.7.5" + resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.5.tgz#09fa51e356d07d0be200642b0e4f91d8e6dd408d" + integrity sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A== + ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" @@ -265,13 +270,13 @@ jasmine-core@~2.99.0: resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.99.1.tgz#e6400df1e6b56e130b61c4bcd093daa7f6e8ca15" integrity sha1-5kAN8ea1bhMLYcS80JPap/boyhU= -jasmine-reporters@~2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.4.0.tgz#708c17ae70ba6671e3a930bb1b202aab80a31409" - integrity sha512-jxONSrBLN1vz/8zCx5YNWQSS8iyDAlXQ5yk1LuqITe4C6iXCDx5u6Q0jfNtkKhL4qLZPe69fL+AWvXFt9/x38w== +jasmine-reporters@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.5.0.tgz#f9e2e0f82aaa2e07e8d553be56457efe0fd8b39e" + integrity sha512-J69peyTR8j6SzvIPP6aO1Y00wwCqXuIvhwTYvE/di14roCf6X3wDZ4/cKGZ2fGgufjhP2FKjpgrUIKjwau4e/Q== dependencies: - mkdirp "^0.5.1" - xmldom "^0.5.0" + "@xmldom/xmldom" "^0.7.3" + mkdirp "^1.0.4" jasmine@2.99.0: version "2.99.0" @@ -303,17 +308,10 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== once@^1.3.0: version "1.4.0" @@ -457,11 +455,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -xmldom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.5.0.tgz#193cb96b84aa3486127ea6272c4596354cb4962e" - integrity sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA== - y18n@^5.0.5: version "5.0.5" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18" diff --git a/e2e/linker_disabled_regression/.bazelignore b/e2e/linker_disabled_regression/.bazelignore new file mode 100644 index 0000000000..27de919bd4 --- /dev/null +++ b/e2e/linker_disabled_regression/.bazelignore @@ -0,0 +1,2 @@ +node_modules +subdir/node_modules \ No newline at end of file diff --git a/examples/vendored_node/.bazelrc b/e2e/linker_disabled_regression/.bazelrc similarity index 62% rename from examples/vendored_node/.bazelrc rename to e2e/linker_disabled_regression/.bazelrc index 3431057af6..c9c5723166 100644 --- a/examples/vendored_node/.bazelrc +++ b/e2e/linker_disabled_regression/.bazelrc @@ -1 +1,3 @@ import %workspace%/../../common.bazelrc + +build --enable_runfiles \ No newline at end of file diff --git a/e2e/linker_disabled_regression/BUILD.bazel b/e2e/linker_disabled_regression/BUILD.bazel new file mode 100644 index 0000000000..e559653cb9 --- /dev/null +++ b/e2e/linker_disabled_regression/BUILD.bazel @@ -0,0 +1,8 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") + +nodejs_binary( + name = "binary", + data = ["@npm//acorn"], + entry_point = "main.cjs", + templated_args = ["--nobazel_run_linker"], +) diff --git a/e2e/linker_disabled_regression/README.md b/e2e/linker_disabled_regression/README.md new file mode 100644 index 0000000000..d6446e1c7a --- /dev/null +++ b/e2e/linker_disabled_regression/README.md @@ -0,0 +1,8 @@ +This e2e tests a regression that occurred under the following conditions: + +1. Two `yarn_install`s with in a subdirectory. +2. `export_directories_only = False` +3. The linker is disabled with `templated_args = ["--nobazel_run_linker"]` + +A binary that depends on an npm package declared in the subdirectory's package.json +could not be resolved. \ No newline at end of file diff --git a/e2e/linker_disabled_regression/WORKSPACE b/e2e/linker_disabled_regression/WORKSPACE new file mode 100644 index 0000000000..467a783dbe --- /dev/null +++ b/e2e/linker_disabled_regression/WORKSPACE @@ -0,0 +1,34 @@ +workspace( + name = "e2e_linker_disabled_regression", + managed_directories = { + "@npm": ["node_modules"], + "@subdir_npm": ["subdir/node_modules"], + }, +) + +local_repository( + name = "build_bazel_rules_nodejs", + path = "../..", +) + +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") + +node_repositories() + +yarn_install( + name = "npm", + exports_directories_only = False, + package_json = "//:package.json", + yarn_lock = "//:yarn.lock", +) + +yarn_install( + name = "subdir_npm", + exports_directories_only = False, + package_json = "//subdir:package.json", + yarn_lock = "//subdir:yarn.lock", +) diff --git a/e2e/linker_disabled_regression/main.cjs b/e2e/linker_disabled_regression/main.cjs new file mode 100644 index 0000000000..72bfe5f213 --- /dev/null +++ b/e2e/linker_disabled_regression/main.cjs @@ -0,0 +1 @@ +require("acorn"); \ No newline at end of file diff --git a/e2e/linker_disabled_regression/package.json b/e2e/linker_disabled_regression/package.json new file mode 100644 index 0000000000..681dca58e6 --- /dev/null +++ b/e2e/linker_disabled_regression/package.json @@ -0,0 +1,7 @@ +{ + "name": "root", + "private": true, + "dependencies": { + "acorn": "8.7.1" + } +} \ No newline at end of file diff --git a/e2e/linker_disabled_regression/subdir/BUILD.bazel b/e2e/linker_disabled_regression/subdir/BUILD.bazel new file mode 100644 index 0000000000..a7014d32d2 --- /dev/null +++ b/e2e/linker_disabled_regression/subdir/BUILD.bazel @@ -0,0 +1,8 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") + +nodejs_binary( + name = "binary", + data = ["@subdir_npm//acorn"], + entry_point = "main.cjs", + templated_args = ["--nobazel_run_linker"], +) diff --git a/e2e/linker_disabled_regression/subdir/main.cjs b/e2e/linker_disabled_regression/subdir/main.cjs new file mode 100644 index 0000000000..3806faf0e0 --- /dev/null +++ b/e2e/linker_disabled_regression/subdir/main.cjs @@ -0,0 +1 @@ +require("acorn"); diff --git a/e2e/linker_disabled_regression/subdir/package.json b/e2e/linker_disabled_regression/subdir/package.json new file mode 100644 index 0000000000..71f9b34d55 --- /dev/null +++ b/e2e/linker_disabled_regression/subdir/package.json @@ -0,0 +1,7 @@ +{ + "name": "subdir", + "private": true, + "dependencies": { + "acorn": "8.7.1" + } +} \ No newline at end of file diff --git a/e2e/linker_disabled_regression/subdir/yarn.lock b/e2e/linker_disabled_regression/subdir/yarn.lock new file mode 100644 index 0000000000..f9d7b7928b --- /dev/null +++ b/e2e/linker_disabled_regression/subdir/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +acorn@8.7.1: + version "8.7.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" + integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== diff --git a/e2e/linker_disabled_regression/yarn.lock b/e2e/linker_disabled_regression/yarn.lock new file mode 100644 index 0000000000..f9d7b7928b --- /dev/null +++ b/e2e/linker_disabled_regression/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +acorn@8.7.1: + version "8.7.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" + integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== diff --git a/e2e/node_loader_no_preserve_symlinks/BUILD.bazel b/e2e/node_loader_no_preserve_symlinks/BUILD.bazel deleted file mode 100644 index 26d3bb8155..0000000000 --- a/e2e/node_loader_no_preserve_symlinks/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test") - -package(default_visibility = ["//visibility:public"]) - -nodejs_test( - name = "test", - data = [ - "node_loader_test.spec.js", - "@npm//:node_modules", - ], - entry_point = ":node_loader_test.spec.js", - templated_args = ["--nobazel_node_patches"], -) diff --git a/e2e/node_loader_no_preserve_symlinks/WORKSPACE b/e2e/node_loader_no_preserve_symlinks/WORKSPACE deleted file mode 100644 index ad105947fd..0000000000 --- a/e2e/node_loader_no_preserve_symlinks/WORKSPACE +++ /dev/null @@ -1,24 +0,0 @@ -workspace( - name = "e2e_node_loader_no_preserve_symlinks", - managed_directories = { - "@npm": ["node_modules"], - }, -) - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], -) - -load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") - -node_repositories(preserve_symlinks = False) - -yarn_install( - name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", -) diff --git a/e2e/node_loader_no_preserve_symlinks/node_loader_test.spec.js b/e2e/node_loader_no_preserve_symlinks/node_loader_test.spec.js deleted file mode 100644 index 5cea4532e7..0000000000 --- a/e2e/node_loader_no_preserve_symlinks/node_loader_test.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -try { - require('minimist'); - console.error('should fail to resolve minimist'); - process.exitCode = 1; -} catch { -} - - -// should resolve tmp -require('tmp'); - -const testA = require('@gregmagolan/test-a'); -if (testA !== 'test-a-0.0.2') { - console.error('should resolve @gregmagolan/test-a to version 0.0.2 but was', testA); - process.exitCode = 1; -} - -const testB = require('@gregmagolan/test-b'); -if (testB !== 'test-b-0.0.2/test-a-0.0.1') { - console.error( - 'should resolve @gregmagolan/test-b to version 0.0.2 with a @gregmagolan/test-a dependency of 0.0.1 but was', - testB); - process.exitCode = 1; -} diff --git a/e2e/node_loader_no_preserve_symlinks/package.json b/e2e/node_loader_no_preserve_symlinks/package.json deleted file mode 100644 index 15554a6fad..0000000000 --- a/e2e/node_loader_no_preserve_symlinks/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "e2e node_loader testing dependencies", - "devDependencies": {}, - "dependencies": { - "@gregmagolan/test-a": "0.0.2", - "@gregmagolan/test-b": "0.0.2", - "tmp": "0.0.33" - }, - "scripts": { - "test": "bazel test ..." - } -} diff --git a/e2e/node_loader_no_preserve_symlinks/yarn.lock b/e2e/node_loader_no_preserve_symlinks/yarn.lock deleted file mode 100644 index d1c15d0801..0000000000 --- a/e2e/node_loader_no_preserve_symlinks/yarn.lock +++ /dev/null @@ -1,32 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@gregmagolan/test-a@0.0.1": - version "0.0.1" - resolved "https://registry.yarnpkg.com/@gregmagolan/test-a/-/test-a-0.0.1.tgz#c90ebc0676f13b34400da8d1e55ffe5aa76655b4" - integrity sha512-nMZ3MKkXZ+uYbrm8R3dfdt3v1gOOLtf88CdDciWxMYGLr29oVjQG11y2fz4IRBR6R7hI2Gj+G9sHZ69wLTnjfA== - -"@gregmagolan/test-a@0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@gregmagolan/test-a/-/test-a-0.0.2.tgz#86ab79a55f44860b02d8275e22d282a1f82b8768" - integrity sha512-u8pW4cm5Xk58fQeA1tGER3KwCfHZ1sBEx0YDWs5Spdi7tiw/21DN7btDvGqx4sG3d2UnUdAnvXPsdwArjNGdmg== - -"@gregmagolan/test-b@0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@gregmagolan/test-b/-/test-b-0.0.2.tgz#7549fb9f39895c0d744c2c24c98b0e5817e46bd7" - integrity sha512-h+LeJUbUued9XyQwxKMUdklGiGxPYJ1RvTAK9612ctCiMS2Fn0wu/Au5kHsMHxm8l4bOfpgAWmQ0OQQy7wUBCg== - dependencies: - "@gregmagolan/test-a" "0.0.1" - -os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= - -tmp@0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== - dependencies: - os-tmpdir "~1.0.2" diff --git a/e2e/node_loader_preserve_symlinks/WORKSPACE b/e2e/node_loader_preserve_symlinks/WORKSPACE index ce2d43729f..9280b4900f 100644 --- a/e2e/node_loader_preserve_symlinks/WORKSPACE +++ b/e2e/node_loader_preserve_symlinks/WORKSPACE @@ -1,18 +1,17 @@ -workspace( - name = "e2e_node_loader_preserve_symlinks", - managed_directories = { - "@npm": ["node_modules"], - }, -) +workspace(name = "e2e_node_loader_preserve_symlinks") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( diff --git a/e2e/node_loader_no_preserve_symlinks/.bazelignore b/e2e/nodejs_host/.bazelignore similarity index 100% rename from e2e/node_loader_no_preserve_symlinks/.bazelignore rename to e2e/nodejs_host/.bazelignore diff --git a/e2e/node_loader_no_preserve_symlinks/.bazelrc b/e2e/nodejs_host/.bazelrc similarity index 100% rename from e2e/node_loader_no_preserve_symlinks/.bazelrc rename to e2e/nodejs_host/.bazelrc diff --git a/e2e/nodejs_host/.nvmrc b/e2e/nodejs_host/.nvmrc new file mode 100644 index 0000000000..23d9c36a11 --- /dev/null +++ b/e2e/nodejs_host/.nvmrc @@ -0,0 +1 @@ +16.13.2 diff --git a/e2e/nodejs_host/BUILD.bazel b/e2e/nodejs_host/BUILD.bazel new file mode 100644 index 0000000000..c1c7cb2f1e --- /dev/null +++ b/e2e/nodejs_host/BUILD.bazel @@ -0,0 +1,55 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test") + +# Dummy test target that imports various targets from the +# "@nodejs" repository. If a target of the repository is +# misconfigured, Bazel will complain about missing input files. +nodejs_test( + name = "test_default", + data = [ + "index.spec.js", + "@nodejs//:node", + "@nodejs//:node_bin", + "@nodejs//:node_files", + "@nodejs//:npm", + "@nodejs//:npm_bin", + "@nodejs//:npm_files", + # Use the old name for one of the labels, as a test that it still works + "@nodejs_host//:npx_bin", + "@npm//:node_modules", + "@yarn", + "@yarn//:yarn_bin", + "@yarn//:yarn_files", + ], + entry_point = ":index.spec.js", +) + +# Additional targets to test the use of parallel node toolchains +[ + nodejs_test( + name = "test_" + id, + data = [ + "index.spec.js", + "@%s_host//:node" % id, + "@%s_host//:node_bin" % id, + "@%s_host//:node_files" % id, + "@%s_host//:npm" % id, + "@%s_host//:npm_bin" % id, + "@%s_host//:npm_files" % id, + "@%s_host//:npx_bin" % id, + "@npm_%s//:node_modules" % id, + "@yarn_%s//:yarn" % id, + "@yarn_%s//:yarn_bin" % id, + "@yarn_%s//:yarn_files" % id, + ], + entry_point = ":index.spec.js", + toolchain = select({ + "@bazel_tools//src/conditions:linux_x86_64": "@%s_linux_amd64//:node_toolchain" % id, + "@bazel_tools//src/conditions:darwin": "@%s_darwin_amd64//:node_toolchain" % id, + "@bazel_tools//src/conditions:windows": "@%s_windows_amd64//:node_toolchain" % id, + }), + ) + for id in [ + "node14", + "node16_nvmrc", + ] +] diff --git a/e2e/nodejs_host/WORKSPACE b/e2e/nodejs_host/WORKSPACE new file mode 100644 index 0000000000..771f3e45a6 --- /dev/null +++ b/e2e/nodejs_host/WORKSPACE @@ -0,0 +1,74 @@ +workspace(name = "e2e_nodejs_host") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "build_bazel_rules_nodejs", + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], +) + +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") +load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") +load("@rules_nodejs//nodejs:yarn_repositories.bzl", "yarn_repositories") + +# Create the default node toolchain using node_repositories +node_repositories( + node_version = "12.12.0", +) + +# Create additional parallel toolchains using explicit nodejs_register_toolchains targets +nodejs_register_toolchains( + name = "node14", + node_version = "14.19.0", +) + +nodejs_register_toolchains( + name = "node16_nvmrc", + use_nvmrc = "//:.nvmrc", +) + +yarn_repositories( + name = "yarn_node14", + node_repository = "node14", +) + +yarn_repositories( + name = "yarn_node16_nvmrc", + node_repository = "node16_nvmrc", +) + +yarn_install( + name = "npm", + package_json = "//:package.json", + package_json_replace = { + "scripts.postinstall": "node -e \"require('assert').equal(process.version, 'v12.12.0')\"", + }, + yarn_lock = "//:yarn.lock", +) + +yarn_install( + name = "npm_node14", + node_repository = "node14", + package_json = "//:package.json", + package_json_replace = { + "scripts.postinstall": "node -e \"require('assert').equal(process.version, 'v14.19.0')\"", + }, + yarn = "@yarn_node14//:bin/yarn", + yarn_lock = "//:yarn.lock", +) + +yarn_install( + name = "npm_node16_nvmrc", + node_repository = "node16_nvmrc", + package_json = "//:package.json", + package_json_replace = { + "scripts.postinstall": "node -e \"require('assert').equal(process.version, 'v16.13.2')\"", + }, + yarn = "@yarn_node16_nvmrc//:bin/yarn", + yarn_lock = "//:yarn.lock", +) diff --git a/e2e/nodejs_host/index.spec.js b/e2e/nodejs_host/index.spec.js new file mode 100644 index 0000000000..c6786e2740 --- /dev/null +++ b/e2e/nodejs_host/index.spec.js @@ -0,0 +1,2 @@ +// Empty test file. The test target primarily exists to ensure +// that Bazel targets are not misconfigured. See BUILD.bazel. \ No newline at end of file diff --git a/e2e/nodejs_host/package.json b/e2e/nodejs_host/package.json new file mode 100644 index 0000000000..8e2d76fba8 --- /dev/null +++ b/e2e/nodejs_host/package.json @@ -0,0 +1,7 @@ +{ + "dependencies": {}, + "scripts": { + "postinstall": "REPLACED DURING YARN_INSTALL", + "test": "bazel test ..." + } +} diff --git a/e2e/nodejs_host/yarn.lock b/e2e/nodejs_host/yarn.lock new file mode 100644 index 0000000000..fb57ccd13a --- /dev/null +++ b/e2e/nodejs_host/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + diff --git a/e2e/nodejs_image/BUILD.bazel b/e2e/nodejs_image/BUILD.bazel index 88ce171dde..b3fa09bf8c 100644 --- a/e2e/nodejs_image/BUILD.bazel +++ b/e2e/nodejs_image/BUILD.bazel @@ -1,20 +1,30 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") load("@io_bazel_rules_docker//contrib:test.bzl", "container_test") load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image") +load("@bazel_skylib//rules:write_file.bzl", "write_file") + +SHARP = select({ + # When the target platform is Linux, request the copy of the package + # which downloaded linux executables in its post-install + "@bazel_tools//src/conditions:linux_x86_64": ["@npm_linux//sharp"], + # Otherwise just use it for the host platform. + "//conditions:default": ["@npm//sharp"], +}) nodejs_binary( name = "main", data = [ "//foolib", - "@npm//date-fns", - ], + ] + SHARP, entry_point = "main.js", ) -# bazel run --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //:nodejs_image +# bazel run --platforms=@rules_nodejs//:linux_amd64 //:nodejs_image nodejs_image( name = "nodejs_image", binary = ":main", + include_node_repo_args = False, + node_repository_name = "node16_linux_amd64", ) container_test( @@ -22,3 +32,53 @@ container_test( configs = [":nodejs_image.yaml"], image = ":nodejs_image", ) + +# this creates: +# bazel run main_node15_linux_amd64 +# bazel run main_node16_linux_amd64 +# bazel run nodejs_image_node15_linux_amd64 +# bazel run nodejs_image_node16_linux_amd64 +# bazel test nodejs_image_test_node15_linux_amd64 +# bazel test nodejs_image_test_node16_linux_amd64 +[ + [ + # Trivial test fixture: a nodejs program that writes to a file + write_file( + name = "test_" + id, + out = "image_%s.yaml" % id, + content = [ + "schemaVersion: 2.0.0", + "metadataTest:", + " entrypoint: ['/app//main_%s']" % id, + """ workdir: "/app//main_%s.runfiles/e2e_nodejs_image" """ % id, + ], + ), + nodejs_binary( + name = "main_" + id, + data = ["//foolib"], + entry_point = "binary_version.js", + toolchain = toolchain, + ), + nodejs_image( + name = "nodejs_image_" + id, + binary = ":main_" + id, + include_node_repo_args = False, + node_repository_name = id, + ), + container_test( + name = "nodejs_image_test_" + id, + configs = ["test_" + id], + image = ":nodejs_image_" + id, + ), + ] + for id, toolchain in zip( + [ + "node15_linux_amd64", + "node16_linux_amd64", + ], + [ + "@node15_linux_amd64//:node_toolchain", + "@node16_linux_amd64//:node_toolchain", + ], + ) +] diff --git a/e2e/nodejs_image/WORKSPACE b/e2e/nodejs_image/WORKSPACE index edfc034734..008eddf599 100644 --- a/e2e/nodejs_image/WORKSPACE +++ b/e2e/nodejs_image/WORKSPACE @@ -12,32 +12,47 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace( - name = "e2e_nodejs_image", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_nodejs_image") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( name = "npm", + node_repository = "node16", + package_json = "//:package.json", + yarn_lock = "//:yarn.lock", +) + +yarn_install( + name = "npm_linux", + # The `sharp` package from npm looks for these in a post-install script + # and determines which native code package to download. + # See https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules#using-npm + environment = { + "npm_config_arch": "x64", + "npm_config_platform": "linux", + }, package_json = "//:package.json", yarn_lock = "//:yarn.lock", ) http_archive( name = "io_bazel_rules_docker", - sha256 = "20dfc1d9bc6a251455c4f306d3dea030b323ea3f22e0600698fab9665eb273b8", - strip_prefix = "rules_docker-0086a29d19b124b04a864e3913cfa7a2cba46349", - urls = ["https://github.com/bazelbuild/rules_docker/archive/0086a29d19b124b04a864e3913cfa7a2cba46349.tar.gz"], + sha256 = "db427107e4c36a3713c24daf5fcdf7719fe664e0c36e089b5b16d15cf331ce60", + strip_prefix = "rules_docker-8a4f73fb29a64ba813087220b200f49a1ca10faa", + urls = ["https://github.com/bazelbuild/rules_docker/archive/8a4f73fb29a64ba813087220b200f49a1ca10faa.tar.gz"], ) load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories") @@ -51,3 +66,17 @@ container_deps() load("@io_bazel_rules_docker//nodejs:image.bzl", nodejs_image_repositories = "repositories") nodejs_image_repositories() + +load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") + +# The order matters because Bazel will provide the first registered toolchain when a rule asks Bazel to select it +# This applies to the resolved_toolchain +nodejs_register_toolchains( + name = "node16", + node_version = "16.5.0", +) + +nodejs_register_toolchains( + name = "node15", + node_version = "15.14.0", +) diff --git a/e2e/nodejs_image/binary_version.js b/e2e/nodejs_image/binary_version.js new file mode 100644 index 0000000000..bf96b9dbe5 --- /dev/null +++ b/e2e/nodejs_image/binary_version.js @@ -0,0 +1 @@ +console.log(process.version) \ No newline at end of file diff --git a/e2e/nodejs_image/foolib/index.js b/e2e/nodejs_image/foolib/index.js index 5b264e52d8..b38a2c0937 100644 --- a/e2e/nodejs_image/foolib/index.js +++ b/e2e/nodejs_image/foolib/index.js @@ -1,5 +1 @@ -function foo(str) { - return `foo_${str}`; -} - -exports.foo = foo; \ No newline at end of file +exports.drawing = {width:1,height:1,channels:4,background:{r:0,g:0,b:0}} \ No newline at end of file diff --git a/e2e/nodejs_image/main.js b/e2e/nodejs_image/main.js index 441b92cdb2..4543de7acc 100644 --- a/e2e/nodejs_image/main.js +++ b/e2e/nodejs_image/main.js @@ -1,5 +1,7 @@ -const format = require('date-fns').format; -const foo = require('@foo/lib').foo; +const create = require('@foo/lib').drawing; +const sharp = require('sharp'); -const date = format(new Date(2019, 4, 7), 'MMMM d, yyyy'); -console.log(foo('lib'), date); \ No newline at end of file +(async () => { + const data = await sharp({create}).png().toBuffer(); + console.log(data.toString('base64')) +})() \ No newline at end of file diff --git a/e2e/nodejs_image/nodejs_image.yaml b/e2e/nodejs_image/nodejs_image.yaml index 203e93a968..76de02e058 100644 --- a/e2e/nodejs_image/nodejs_image.yaml +++ b/e2e/nodejs_image/nodejs_image.yaml @@ -1,5 +1,12 @@ +# See https://github.com/GoogleContainerTools/container-structure-test schemaVersion: 2.0.0 metadataTest: entrypoint: ['/app//main'] workdir: "/app//main.runfiles/e2e_nodejs_image" + + +commandTests: + - name: "sharp" + command: "/app/main" + expectedOutput: ["iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAADUlEQVQImWNgYGD4DwABBAEAfbLI3wAAAABJRU5ErkJggg=="] diff --git a/e2e/nodejs_image/package.json b/e2e/nodejs_image/package.json index e654f2f21f..72758f06c9 100644 --- a/e2e/nodejs_image/package.json +++ b/e2e/nodejs_image/package.json @@ -1,9 +1,9 @@ { "private": true, "devDependencies": { - "date-fns": "2.14.0" + "sharp": "^0.30.3" }, "scripts": { - "test": "bazel test ... && bazel un --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //:nodejs_image" + "test": "bazel test ... && bazel run --platforms=@rules_nodejs//nodejs:linux_amd64 //:nodejs_image" } } diff --git a/e2e/nodejs_image/yarn.lock b/e2e/nodejs_image/yarn.lock index a5723f4881..11c1268826 100644 --- a/e2e/nodejs_image/yarn.lock +++ b/e2e/nodejs_image/yarn.lock @@ -2,7 +2,486 @@ # yarn lockfile v1 -date-fns@2.14.0: - version "2.14.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.14.0.tgz#359a87a265bb34ef2e38f93ecf63ac453f9bc7ba" - integrity sha512-1zD+68jhFgDIM0rF05rcwYO8cExdNqxjq4xP1QKM60Q45mnO6zaMWB4tOzrIr4M4GSLntsKeE4c9Bdl2jhL/yw== +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.7" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz#b15474a932adab4ff8a50d9adfa7e4e926f21146" + integrity sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bl@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + +buffer@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@^1.0.0, color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +color-string@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.0.tgz#63b6ebd1bec11999d1df3a79a7569451ac2be8aa" + integrity sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ== + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + +color@^4.2.1: + version "4.2.3" + resolved "https://registry.yarnpkg.com/color/-/color-4.2.3.tgz#d781ecb5e57224ee43ea9627560107c0e0c6463a" + integrity sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A== + dependencies: + color-convert "^2.0.1" + color-string "^1.9.0" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +detect-libc@^2.0.0, detect-libc@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.1.tgz#e1897aa88fa6ad197862937fbc0441ef352ee0cd" + integrity sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +end-of-stream@^1.1.0, end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@~1.3.0: + version "1.3.8" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + +is-arrayish@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" + integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +lru-cache@^7.4.0: + version "7.8.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.8.1.tgz#68ee3f4807a57d2ba185b7fd90827d5c21ce82bb" + integrity sha512-E1v547OCgJvbvevfjgK9sNKIVXO96NnsTsFPBlg4ZxjhsJSODoH9lk8Bm0OxvHNm6Vm5Yqkl/1fErDxhYL8Skg== + +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + +minimist@^1.2.0, minimist@^1.2.3: + version "1.2.6" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" + integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== + +mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + +napi-build-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" + integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== + +node-abi@^3.3.0: + version "3.8.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.8.0.tgz#679957dc8e7aa47b0a02589dbfde4f77b29ccb32" + integrity sha512-tzua9qWWi7iW4I42vUPKM+SfaF0vQSLAm4yO5J83mSwB7GeoWrDKC/K+8YCnYNwqP5duwazbw2X9l4m8SC2cUw== + dependencies: + semver "^7.3.5" + +node-addon-api@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f" + integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ== + +npmlog@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +prebuild-install@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.0.1.tgz#c10075727c318efe72412f333e0ef625beaf3870" + integrity sha512-QBSab31WqkyxpnMWQxubYAHR5S9B2+r81ucocew34Fkl98FhvKIF50jIJnNOBmAZfyNV7vE5T6gd3hTVWgY6tg== + dependencies: + detect-libc "^2.0.0" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.3" + mkdirp-classic "^0.5.3" + napi-build-utils "^1.0.1" + node-abi "^3.3.0" + npmlog "^4.0.1" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^4.0.0" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +readable-stream@^2.0.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.1.1, readable-stream@^3.4.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +safe-buffer@^5.0.1, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +semver@^7.3.5: + version "7.3.6" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.6.tgz#5d73886fb9c0c6602e79440b97165c29581cbb2b" + integrity sha512-HZWqcgwLsjaX1HBD31msI/rXktuIhS+lWvdE4kN9z+8IVT4Itc7vqU2WvYsyD6/sjYCt4dEKH/m1M3dwI9CC5w== + dependencies: + lru-cache "^7.4.0" + +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +sharp@^0.30.3: + version "0.30.3" + resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.30.3.tgz#315a1817423a4d1cde5119a21c99c234a7a6fb37" + integrity sha512-rjpfJFK58ZOFSG8sxYSo3/JQb4ej095HjXp9X7gVu7gEn1aqSG8TCW29h/Rr31+PXrFADo1H/vKfw0uhMQWFtg== + dependencies: + color "^4.2.1" + detect-libc "^2.0.1" + node-addon-api "^4.3.0" + prebuild-install "^7.0.1" + semver "^7.3.5" + simple-get "^4.0.1" + tar-fs "^2.1.1" + tunnel-agent "^0.6.0" + +signal-exit@^3.0.0: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^4.0.0, simple-get@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543" + integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== + dependencies: + decompress-response "^6.0.0" + once "^1.3.1" + simple-concat "^1.0.0" + +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo= + dependencies: + is-arrayish "^0.3.1" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2 || 3 || 4": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +tar-fs@^2.0.0, tar-fs@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" + integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== + dependencies: + chownr "^1.1.1" + mkdirp-classic "^0.5.2" + pump "^3.0.0" + tar-stream "^2.1.4" + +tar-stream@^2.1.4: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" + integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== + dependencies: + bl "^4.0.3" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +wide-align@^1.1.0: + version "1.1.5" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" + integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== + dependencies: + string-width "^1.0.2 || 2 || 3 || 4" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= diff --git a/e2e/packages/WORKSPACE b/e2e/packages/WORKSPACE index 78633141f7..5ff13188bd 100644 --- a/e2e/packages/WORKSPACE +++ b/e2e/packages/WORKSPACE @@ -4,14 +4,18 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) -load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "npm_install", "yarn_install") +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") -# Test that check_rules_nodejs_version works as expected -check_rules_nodejs_version(minimum_version_string = "0.11.2") +build_bazel_rules_nodejs_dependencies() + +load("@build_bazel_rules_nodejs//:index.bzl", "check_build_bazel_rules_nodejs_version", "node_repositories", "npm_install", "yarn_install") + +# Test that check_build_bazel_rules_nodejs_version works as expected +check_build_bazel_rules_nodejs_version(minimum_version_string = "4.4.0") node_repositories() @@ -19,26 +23,29 @@ npm_install( name = "e2e_packages_npm_install", args = ["--production"], data = ["//:postinstall.js"], + exports_directories_only = False, package_json = "//:npm1/package.json", package_lock_json = "//:npm1/package-lock.json", - symlink_node_modules = False, + package_path = "/", ) npm_install( name = "e2e_packages_npm_install_duplicate_for_determinism_testing", args = ["--production"], data = ["//:postinstall.js"], + exports_directories_only = False, package_json = "//:npm2/package.json", package_lock_json = "//:npm2/package-lock.json", - symlink_node_modules = False, + package_path = "/", ) yarn_install( name = "e2e_packages_yarn_install", args = ["--prod"], data = ["//:postinstall.js"], + exports_directories_only = False, package_json = "//:yarn1/package.json", - symlink_node_modules = False, + package_path = "/", yarn_lock = "//:yarn1/yarn.lock", ) @@ -46,7 +53,8 @@ yarn_install( name = "e2e_packages_yarn_install_duplicate_for_determinism_testing", args = ["--prod"], data = ["//:postinstall.js"], + exports_directories_only = False, package_json = "//:yarn2/package.json", - symlink_node_modules = False, + package_path = "/", yarn_lock = "//:yarn2/yarn.lock", ) diff --git a/e2e/symlinked_node_modules_npm/WORKSPACE b/e2e/symlinked_node_modules_npm/WORKSPACE index f7f3439b77..1a6473c850 100644 --- a/e2e/symlinked_node_modules_npm/WORKSPACE +++ b/e2e/symlinked_node_modules_npm/WORKSPACE @@ -1,7 +1,4 @@ -workspace( - name = "e2e_symlinked_node_modules_yarn", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_symlinked_node_modules_yarn") # There are some assertions that can only by made by running tests from within # this nested repository folder. These assertions are run in CI so we use @@ -11,23 +8,28 @@ local_repository( path = "../..", ) -# We don't really need to run TypeScript rules, but we'll encounter some during -# the loading phase because some built-in code uses TypeScript local_repository( - name = "build_bazel_rules_typescript", - path = "../../tools/mock_rules_typescript", + name = "rules_nodejs", + path = "../..", ) -# rules_nodejs_dev_dependencies() required since we're using local_repository for -# build_bazel_rules_nodejs above. -load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dev_dependencies") +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies", "build_bazel_rules_nodejs_dev_dependencies") + +build_bazel_rules_nodejs_dependencies() + +load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") + +_NODE_REPO = "node" + +nodejs_register_toolchains(name = _NODE_REPO) -rules_nodejs_dev_dependencies() +build_bazel_rules_nodejs_dev_dependencies() load("@build_bazel_rules_nodejs//:index.bzl", "npm_install") npm_install( name = "npm", + node_repository = _NODE_REPO, package_json = "//:package.json", package_lock_json = "//:package-lock.json", quiet = False, diff --git a/e2e/symlinked_node_modules_yarn/WORKSPACE b/e2e/symlinked_node_modules_yarn/WORKSPACE index bcd6afae41..581dc2150b 100644 --- a/e2e/symlinked_node_modules_yarn/WORKSPACE +++ b/e2e/symlinked_node_modules_yarn/WORKSPACE @@ -1,7 +1,4 @@ -workspace( - name = "e2e_symlinked_node_modules_yarn", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_symlinked_node_modules_yarn") # There are some assertions that can only by made by running tests from within # this nested repository folder. These assertions are run in CI so we use @@ -11,23 +8,28 @@ local_repository( path = "../..", ) -# We don't really need to run TypeScript rules, but we'll encounter some during -# the loading phase because some built-in code uses TypeScript local_repository( - name = "build_bazel_rules_typescript", - path = "../../tools/mock_rules_typescript", + name = "rules_nodejs", + path = "../..", ) -# rules_nodejs_dev_dependencies() required since we're using local_repository for -# build_bazel_rules_nodejs above. -load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dev_dependencies") +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies", "build_bazel_rules_nodejs_dev_dependencies") + +build_bazel_rules_nodejs_dependencies() + +load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") + +_NODE_REPO = "node" + +nodejs_register_toolchains(name = _NODE_REPO) -rules_nodejs_dev_dependencies() +build_bazel_rules_nodejs_dev_dependencies() load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( name = "npm", + node_repository = _NODE_REPO, package_json = "//:package.json", quiet = False, yarn_lock = "//:yarn.lock", diff --git a/e2e/test.bzl b/e2e/test.bzl index f64713ac3a..5bfb9f0a0c 100644 --- a/e2e/test.bzl +++ b/e2e/test.bzl @@ -21,5 +21,6 @@ def e2e_integration_test(name, **kwargs): name = name, tags = kwargs.pop("tags", []) + ["e2e"], workspace_files = kwargs.pop("workspace_files", "_%s_sources" % name), + resolutions = {"//packages/worker:npm_package": "@bazel/worker"}, **kwargs ) diff --git a/e2e/typescript/BUILD.bazel b/e2e/typescript/BUILD.bazel index 9f225bd1ca..b539b92962 100644 --- a/e2e/typescript/BUILD.bazel +++ b/e2e/typescript/BUILD.bazel @@ -13,7 +13,7 @@ # limitations under the License. load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test") -load("@npm//@bazel/typescript:index.bzl", "ts_library") +load("@npm//@bazel/concatjs:index.bzl", "ts_library") ts_library( name = "lib", @@ -38,7 +38,7 @@ ts_library( srcs = glob(["*.spec.ts"]), deps = [ ":main", - "@npm//@bazel/typescript", + "@npm//@bazel/concatjs", "@npm//@types/jasmine", "@npm//@types/node", "@npm//typescript", @@ -49,7 +49,7 @@ jasmine_node_test( name = "test", data = [ # Verify that worker_protocol.proto can be referenced as a target in the generated npm bazel workspace - "@npm//@bazel/typescript/third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto", + "@npm//@bazel/concatjs/third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto", ], templated_args = [ # ts_library produces named AMD output with repo name in the require statement diff --git a/e2e/typescript/WORKSPACE b/e2e/typescript/WORKSPACE index 90fca9e34a..dcc4188458 100644 --- a/e2e/typescript/WORKSPACE +++ b/e2e/typescript/WORKSPACE @@ -12,23 +12,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace( - name = "e2e_typescript", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_typescript") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], +) + +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + +# Load web_test_suite +http_archive( + name = "io_bazel_rules_webtesting", + sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a", + urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"], ) load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( name = "npm", + exports_directories_only = False, package_json = "//:package.json", yarn_lock = "//:yarn.lock", ) diff --git a/e2e/typescript/main.spec.ts b/e2e/typescript/main.spec.ts index 08bab90f93..46f1b10df1 100644 --- a/e2e/typescript/main.spec.ts +++ b/e2e/typescript/main.spec.ts @@ -7,17 +7,16 @@ describe('main', () => { expect(main.test()).toEqual('test hello 02/Tu/2014'); }); - it('should successfully require @bazel/typescript', () => { + it('should successfully require @bazel/concatjs', () => { try { - const {debug} = require('@bazel/typescript'); - debug('test'); + require('@bazel/concatjs/internal/tsc_wrapped'); } catch (e) { fail(e.toString()) } }); it('runtime version of typescript should be correct', () => { - expect(ts.version).toEqual('3.1.6'); + expect(ts.version).toEqual('4.3.2'); }); it('should successfully require built-in node module \'os\'', () => { diff --git a/e2e/typescript/package.json b/e2e/typescript/package.json index 6afbb26f27..396ed83211 100644 --- a/e2e/typescript/package.json +++ b/e2e/typescript/package.json @@ -1,13 +1,13 @@ { "dependencies": { - "@bazel/jasmine": "^3.4.1", - "@bazel/typescript": "^3.4.1", + "@bazel/concatjs": "^5.8.1", + "@bazel/jasmine": "^5.8.1", "@types/jasmine": "2.8.2", "@types/node": "7.0.18", "date-fns": "^1.30.1", "jasmine": "^3.5.0", "source-map-support": "^0.5.10", - "typescript": "3.1.x" + "typescript": "~4.3.2" }, "scripts": { "test": "bazel test ..." diff --git a/e2e/typescript/tsconfig.json b/e2e/typescript/tsconfig.json index e69de29bb2..dbcca1416b 100644 --- a/e2e/typescript/tsconfig.json +++ b/e2e/typescript/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "declaration": true, + "rootDirs": [ + ".", + "bazel-out/k8-fastbuild/bin", + "bazel-out/windows-fastbuild/bin", + "bazel-out/linux-fastbuild/bin", + ] + } +} \ No newline at end of file diff --git a/e2e/typescript/yarn.lock b/e2e/typescript/yarn.lock index d0510c3b9b..0c139e4712 100644 --- a/e2e/typescript/yarn.lock +++ b/e2e/typescript/yarn.lock @@ -2,23 +2,22 @@ # yarn lockfile v1 -"@bazel/jasmine@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.4.1.tgz#0f9f4fbf973e4c8b8411c2bf3086a6d2398ffcab" - integrity sha512-nbyg5+6m+KUEmxQX5N65gfV+zTUbIjXYq/m3zYFr/hx1Ql/n2tVBBHcxRO4pAbjDhnpuFQgFoAJPzKe5sIL2iA== - dependencies: - c8 "~7.5.0" - jasmine-reporters "~2.4.0" - -"@bazel/typescript@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.4.1.tgz#ec52292b240157cd2d874ff7ea7857da8416c00c" - integrity sha512-OKpfjFRhudsaUBL3xH1oAbat+bwdRyfAOTn2qgMQSO3vR4ZBBVYk7GVMJzWamLkbDS0aY5ws5wLfDScJSKD2ww== +"@bazel/concatjs@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-5.8.1.tgz#dd20882429e382cae79c08cbd3238dfc680d2d67" + integrity sha512-TkARsNUxgi3bjFeGwIGlffmQglNhuR9qK9uE7uKhdBZvQE5caAWVCjYiMTzo3viKDhwKn5QNRcHY5huuJMVFfA== dependencies: protobufjs "6.8.8" - semver "5.6.0" source-map-support "0.5.9" - tsutils "2.27.2" + tsutils "3.21.0" + +"@bazel/jasmine@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-5.8.1.tgz#c549f10806474ff742f37544733fbfdccf78ba66" + integrity sha512-052veW5EbJRH+5hL4l9Sf99bTmdKQ5WXXMF0QiBOZcA3ZHYMAaKfYNO+brutiWoX6FrBloiskLrMzF8OiHBqyw== + dependencies: + c8 "~7.5.0" + jasmine-reporters "~2.5.0" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" @@ -118,6 +117,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.21.tgz#4a9db7ef1d1671c0015e632c5fa3d46c86c58c1e" integrity sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ== +"@xmldom/xmldom@^0.7.3": + version "0.7.5" + resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.5.tgz#09fa51e356d07d0be200642b0e4f91d8e6dd408d" + integrity sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A== + ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" @@ -348,13 +352,13 @@ jasmine-core@~3.5.0: resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.5.0.tgz#132c23e645af96d85c8bca13c8758b18429fc1e4" integrity sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA== -jasmine-reporters@~2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.4.0.tgz#708c17ae70ba6671e3a930bb1b202aab80a31409" - integrity sha512-jxONSrBLN1vz/8zCx5YNWQSS8iyDAlXQ5yk1LuqITe4C6iXCDx5u6Q0jfNtkKhL4qLZPe69fL+AWvXFt9/x38w== +jasmine-reporters@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-2.5.0.tgz#f9e2e0f82aaa2e07e8d553be56457efe0fd8b39e" + integrity sha512-J69peyTR8j6SzvIPP6aO1Y00wwCqXuIvhwTYvE/di14roCf6X3wDZ4/cKGZ2fGgufjhP2FKjpgrUIKjwau4e/Q== dependencies: - mkdirp "^0.5.1" - xmldom "^0.5.0" + "@xmldom/xmldom" "^0.7.3" + mkdirp "^1.0.4" jasmine@^3.5.0: version "3.5.0" @@ -390,17 +394,10 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== once@^1.3.0: version "1.4.0" @@ -474,11 +471,6 @@ safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -semver@5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" - integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== - semver@^6.0.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" @@ -564,17 +556,17 @@ tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tsutils@2.27.2: - version "2.27.2" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.27.2.tgz#60ba88a23d6f785ec4b89c6e8179cac9b431f1c7" - integrity sha512-qf6rmT84TFMuxAKez2pIfR8UCai49iQsfB7YWVjV1bKpy/d0PWT5rEOSM6La9PiHZ0k1RRZQiwVdVJfQ3BPHgg== +tsutils@3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== dependencies: tslib "^1.8.1" -typescript@3.1.x: - version "3.1.6" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.6.tgz#b6543a83cfc8c2befb3f4c8fba6896f5b0c9be68" - integrity sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA== +typescript@~4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== v8-to-istanbul@^7.1.0: version "7.1.0" @@ -606,11 +598,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -xmldom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.5.0.tgz#193cb96b84aa3486127ea6272c4596354cb4962e" - integrity sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA== - y18n@^5.0.5: version "5.0.5" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18" diff --git a/e2e/webapp/WORKSPACE b/e2e/webapp/WORKSPACE index 980a60fde3..74811fb279 100644 --- a/e2e/webapp/WORKSPACE +++ b/e2e/webapp/WORKSPACE @@ -12,19 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace( - name = "e2e_webapp", - managed_directories = {"@npm": ["node_modules"]}, -) +workspace(name = "e2e_webapp") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_nodejs", - sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], + sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"], ) +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") yarn_install( diff --git a/e2e/webapp/package.json b/e2e/webapp/package.json index 69d3c3295a..e3c14214bb 100644 --- a/e2e/webapp/package.json +++ b/e2e/webapp/package.json @@ -2,8 +2,8 @@ "name": "e2e-terser", "private": true, "devDependencies": { - "@bazel/rollup": "^3.4.1", - "@bazel/terser": "^3.4.1", + "@bazel/rollup": "^5.8.1", + "@bazel/terser": "^5.8.1", "rollup": "2.3.0", "terser": "4.3.1" }, diff --git a/e2e/webapp/yarn.lock b/e2e/webapp/yarn.lock index fbf5edb3e0..c51bfb00cf 100644 --- a/e2e/webapp/yarn.lock +++ b/e2e/webapp/yarn.lock @@ -2,15 +2,24 @@ # yarn lockfile v1 -"@bazel/rollup@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-3.4.1.tgz#4ffdf93433a268f3c4a4a8c914e71b1fc876ad4a" - integrity sha512-E5iNbL4r6FDo8UhhZ/PFTtN6VAjbSx+nwrvwHw580uBjQCUiApBdluabIXfhBFChHKrVBpL1du5eekQD+GqKLQ== +"@bazel/rollup@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-5.8.1.tgz#ee876c35595b456f700d258385412e4f0dd57c15" + integrity sha512-Ys+UWbRp1TY2j+z15N+SZgID/nuqAtJTgJDsz0NZVjm8F8KzmgXxLDnBb/cUKFVk83pNOAi84G/bq1tINjMSNA== + dependencies: + "@bazel/worker" "5.8.1" + +"@bazel/terser@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-5.8.1.tgz#729a0ec6dcc83e99c4f6d3f2bebb0ff254c10c48" + integrity sha512-TPjSDhw1pSZt9P2hd/22IJwl8KCZiJL+u2gB5mghBTCFDVdC5Dgsx135pFtvlqc6LjjOvd3s6dzcQr0YJo2HSg== -"@bazel/terser@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-3.4.1.tgz#cc1c8c91924f305bfdffbde83be5b7bb515a67e5" - integrity sha512-kKVCi0CnH0+EzU1nDXsS2Am2XL7ZgITC210cDgt5o7jtmZj3usXtNEET3mogo5Lj7sEUvqw58VS5Ty05z57+VQ== +"@bazel/worker@5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@bazel/worker/-/worker-5.8.1.tgz#65af7a70dd2f1aaedd6c19330abd9a198f96e7b2" + integrity sha512-GMyZSNW3F34f9GjbJqvs1aHyed5BNrNeiDzNJhC1fIizo/UeBM21oBBONIYLBDoBtq936U85VyPZ76JaP/83hw== + dependencies: + google-protobuf "^3.6.1" buffer-from@^1.0.0: version "1.1.1" @@ -27,6 +36,11 @@ fsevents@~2.1.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== +google-protobuf@^3.6.1: + version "3.17.3" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.17.3.tgz#f87595073545a77946c8f0b67c302c5f7646d700" + integrity sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg== + rollup@2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.3.0.tgz#0b9e1c19bea22464958854dae646b8b40d2d3ed5" diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index af969f564c..ac52416985 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel @@ -18,14 +18,16 @@ example_integration_test( name = "examples_angular", timeout = "long", npm_packages = { - "//packages/angular:npm_package": "@bazel/angular", - "//packages/concatjs:npm_package": "@bazel/concatjs", + "//packages/esbuild:npm_package": "@bazel/esbuild", "//packages/protractor:npm_package": "@bazel/protractor", "//packages/rollup:npm_package": "@bazel/rollup", "//packages/terser:npm_package": "@bazel/terser", "//packages/typescript:npm_package": "@bazel/typescript", }, - owners = ["@alan-agius4"], + owners = [ + "@alan-agius4", + "@jbedard", + ], # bazel-in-bazel examples_angular fails on Windows on bazelci cloning a git repo: # ``` @@ -40,34 +42,14 @@ example_integration_test( tags = ["no-bazelci-windows"], ) -example_integration_test( - name = "examples_angular_view_engine", - timeout = "long", - npm_packages = { - "//packages/concatjs:npm_package": "@bazel/concatjs", - "//packages/protractor:npm_package": "@bazel/protractor", - "//packages/rollup:npm_package": "@bazel/rollup", - "//packages/terser:npm_package": "@bazel/terser", - "//packages/typescript:npm_package": "@bazel/typescript", - }, - # bazel-in-bazel examples_angular_view_engine fails on Windows on bazelci cloning a git repo: - # ``` - # ERROR: no such package '@io_bazel_rules_k8s//k8s': Traceback (most recent call last): - # File "D:/b/ftxm343s/execroot/build_bazel_rules_nodejs/_tmp/3726d3573001cb4068a18af89eb255de/_bazel_b/ktluxf26/external/bazel_tools/tools/build_defs/repo/git.bzl", line 163 - # _clone_or_update(ctx) - # File "D:/b/ftxm343s/execroot/build_bazel_rules_nodejs/_tmp/3726d3573001cb4068a18af89eb255de/_bazel_b/ktluxf26/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, in _clone_or_update - # git_repo(ctx, directory) - # ``` - # This is most likely due to a memory issue with this large bazel-in-bazel test. - # TODO(gregmagolan): figure out what is broken with the above - tags = ["no-bazelci-windows"], -) - example_integration_test( name = "examples_create-react-app", npm_packages = { "//packages/runfiles:npm_package": "@bazel/runfiles", }, + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) example_integration_test( @@ -93,11 +75,19 @@ example_integration_test( }, ) +example_integration_test( + name = "examples_toolchain", + repositories = {"//:release-core": "rules_nodejs"}, +) + example_integration_test( name = "examples_closure", npm_packages = { "//packages/runfiles:npm_package": "@bazel/runfiles", }, + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) example_integration_test( @@ -110,12 +100,15 @@ example_integration_test( example_integration_test( name = "examples_cypress", + bazel_commands = ["test //..."], npm_packages = { "//packages/cypress:npm_package": "@bazel/cypress", "//packages/typescript:npm_package": "@bazel/typescript", }, owners = ["@mrmeku"], - tags = ["cypress"], + tags = [ + "cypress", + ], ) example_integration_test( @@ -124,6 +117,11 @@ example_integration_test( "//packages/typescript:npm_package": "@bazel/typescript", }, owners = ["@mrmeku"], + tags = [ + # ERROR: C:/users/b/_bazel_b/sbb5tpjc/external/npm/BUILD.bazel:5053:10: Copying directory external/npm/_/node_modules/jest-snapshot failed: (Exit 4): cmd.exe failed: error executing command cmd.exe /C bazel-out\x64_windows-fastbuild\bin\external\npm\node_modules\jest-snapshot--603629912-cmd.bat + # Insufficient memory + "no-bazelci-windows", + ], ) example_integration_test( @@ -133,14 +131,21 @@ example_integration_test( "//packages/rollup:npm_package": "@bazel/rollup", "//packages/terser:npm_package": "@bazel/terser", }, - # Kotlin's kt_js_import relies on a helper written in Python - # https://github.com/bazelbuild/rules_kotlin/blob/master/kotlin/internal/js/importer.py - # but python isn't installed on BazelCI windows machines. - # Failure looks like - # [0 / 57] [Prepa] Expanding template external/io_bazel_rules_kotlin/kotlin/internal/js/importer.temp [for host] - # ERROR: D:/temp/tmp-67520fayqgbwmbgd/BUILD.bazel:10:1: Action kotlinx-html-js.js failed (Exit 2) - # LAUNCHER ERROR: Cannot launch process: "python.exe" - tags = ["no-bazelci-windows"], + tags = [ + # Bintray was removed from the internet, and the version of + # kotlinx-html-js we depend on isn't mirrored anywhere else. + # See https://github.com/bazelbuild/rules_nodejs/issues/2747 + "manual", + "no-circleci", + # Kotlin's kt_js_import relies on a helper written in Python + # https://github.com/bazelbuild/rules_kotlin/blob/master/kotlin/internal/js/importer.py + # but python isn't installed on BazelCI windows machines. + # Failure looks like + # [0 / 57] [Prepa] Expanding template external/io_bazel_rules_kotlin/kotlin/internal/js/importer.temp [for host] + # ERROR: D:/temp/tmp-67520fayqgbwmbgd/BUILD.bazel:10:1: Action kotlinx-html-js.js failed (Exit 2) + # LAUNCHER ERROR: Cannot launch process: "python.exe" + "no-bazelci-windows", + ], ) example_integration_test( @@ -153,6 +158,12 @@ example_integration_test( example_integration_test( name = "examples_webapp", + bazel_commands = [ + "info", + # enable runfiles explicitly so it is on for Windows since directory + # artifacts requires runfiles + "test ... --enable_runfiles", + ], npm_packages = { "//packages/protractor:npm_package": "@bazel/protractor", "//packages/rollup:npm_package": "@bazel/rollup", @@ -166,7 +177,7 @@ example_integration_test( bazel_commands = [ "test ...", # Test cross-platform build - "build --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //src:docker", + "build --platforms=@rules_nodejs//nodejs:linux_amd64 //src:docker", ], npm_packages = { "//packages/jasmine:npm_package": "@bazel/jasmine", @@ -189,23 +200,6 @@ example_integration_test( tags = ["no-bazelci-windows"], ) -example_integration_test( - name = "examples_protocol_buffers", - timeout = "long", - npm_packages = { - "//packages/concatjs:npm_package": "@bazel/concatjs", - "//packages/labs:npm_package": "@bazel/labs", - "//packages/protractor:npm_package": "@bazel/protractor", - "//packages/rollup:npm_package": "@bazel/rollup", - "//packages/terser:npm_package": "@bazel/terser", - "//packages/typescript:npm_package": "@bazel/typescript", - }, - owners = ["@mrmeku"], - # Runs out of memory on bazelci windows - # TODO(gregmagolan): fix on bazelci windows - tags = ["no-bazelci-windows"], -) - example_integration_test( name = "examples_protobufjs", npm_packages = { @@ -217,29 +211,21 @@ example_integration_test( tags = ["no-bazelci-windows"], ) -example_integration_test( - name = "examples_vendored_node", - npm_packages = { - "//packages/jasmine:npm_package": "@bazel/jasmine", - }, - # This example only works on linux as it downloads the linux node distribution - # TODO(gregmagolan): make node_repositories acccept different archives for different platforms - tags = ["manual"], -) - example_integration_test( name = "examples_vendored_node_and_yarn", npm_packages = { "//packages/jasmine:npm_package": "@bazel/jasmine", }, - # This example only works on linux as it downloads the linux node distribution - # TODO(gregmagolan): make node_repositories acccept different archives for different platforms - tags = ["manual"], + # TODO: make it find node.exe rather than rely on us writing a .cmd wrapper + tags = ["no-bazelci-windows"], ) example_integration_test( name = "examples_vue", npm_packages = {}, + # TODO: figure out why this fails on Windows since setting + # symlink_node_modules to False in the test WORKSPACE + tags = ["no-bazelci-windows"], ) example_integration_test( @@ -260,7 +246,14 @@ example_integration_test( bazel_commands = [ "test ...", ], - owners = ["@alan-agius4"], + owners = [ + "@alan-agius4", + "@jbedard", + ], + tags = [ + # TODO(alexeagle): re-enable when it stops timing out on 4.x branch + "manual", + ], ) example_integration_test( diff --git a/examples/angular/BUILD.bazel b/examples/angular/BUILD.bazel index 6d239c07e2..f6a2551d5d 100644 --- a/examples/angular/BUILD.bazel +++ b/examples/angular/BUILD.bazel @@ -4,14 +4,6 @@ package(default_visibility = ["//:__subpackages__"]) exports_files(["favicon.ico"]) -# ts_library uses the `//:tsconfig.json` target -# by default. This alias allows omitting explicit tsconfig -# attribute. -alias( - name = "tsconfig.json", - actual = "//src:tsconfig.json", -) - k8s_deploy( name = "deploy", images = { diff --git a/examples/angular/README.md b/examples/angular/README.md index 3ff844ee47..74f2c145ad 100644 --- a/examples/angular/README.md +++ b/examples/angular/README.md @@ -11,15 +11,18 @@ This example demonstrates the Google-internal toolchain, which is fast but not v This example is a monorepo, meant to show many different features and integrations that we expect are generally useful for enterprise use cases. - **Angular CLI**: you can use the `ng` command to run build, serve, test, and e2e -- **Angular Libraries**: to maximize build incrementality, each Angular module is compiled as a separate step. This lets us re-use Angular libraries without having to publish them as npm packages. See `src/todos` for a typical `NgModule` compiled as a library for use in the application, using the `ts_library` rule in the `BUILD.bazel` file. -- **TypeScript Libraries**: see `src/lib` for a trivial example of a pure-TS library that's consumed in the application, using the `ts_library` rule in the `BUILD.bazel` file. -- **Sass**: we use Sass for all styling. Angular components import Sass files, and these are built by Bazel as independent processes calling the modern Sass compiler (written in Dart). +- **Angular Libraries**: to maximize build incrementality, each Angular module is compiled as a separate step. + This lets us re-use Angular libraries without having to publish them as npm packages. See `src/todos` for a typical `NgModule` compiled as a library for use in the application, using the `ts_project` rule in the `BUILD.bazel` file. +- **TypeScript Libraries**: see `src/lib` for a trivial example of a pure-TS library that's consumed in the application, using the `ts_project` rule in the `BUILD.bazel` file. +- **Sass**: we use Sass for all styling. + Angular components import Sass files, and these are built by Bazel as independent processes calling the modern Sass compiler (written in Dart). - **Material design**: see `src/material` where we collect the material modules we use. - **Redux-style state management**: see `src/reducers` where we use the [NgRx Store](https://ngrx.io/guide/store). -- **Lazy loading**: in production mode, the application is served in chunks. Run `ng serve --prod` -- **Differential loading**: in production mode, we load a pair of ` - - - - - - - diff --git a/examples/angular/src/index.html b/examples/angular/src/index.html deleted file mode 100644 index 79f3ffe445..0000000000 --- a/examples/angular/src/index.html +++ /dev/null @@ -1,767 +0,0 @@ - - - - - - - - ABC: Angular Buildtools Convergence - - - - - - - - - - - - -
-
-
-

Angular and Bazel

-

- Build and test Angular applications at scale like Google -

-
- -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

Incremental re-builds

-

- A small change to your app should require a small re-build. -

-
-
-
-
- - - - - cli - - - - - - - - - - -
-
-

Works with Angular CLI

-

- Use the same ng commands you're used to. -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
-

Cloud Ready

-

- Expand your build and test to run in parallel on a cluster of - workers. -

-
-
-
-
- - - - - labs - - - - - - - - - - - - -
-
-

Part of Angular Labs

-

- Not a stable, supported API, so use Bazel with caution in - production applications. We expect to promote it to stable for - Angular version 9. -

-
-
-
-

πŸ“š Resources

-

Projects

- - -

Talks

-
    -
  • - Building Large Angular applications with Bazel - Slides - Video - (AngularToronto, Feb 2020) -
  • -
  • - The Bazel Opt-in Preview is Here! - Slides - Video - (NgConf, May 2019) -
  • -
  • - Building Apps Like Google with Angular, Bazel, and GCP - Video - (Google Cloud Next, April 2019) -
  • - -
  • - Layering in JS tooling - Slides - Video - (ModernWeb Meetup, March 2019) -
  • - -
  • - Angular, Bazel, and CLI - Slides - (AngularSF Meetup, January 2019) -
  • - -
  • - Bazel in Angular CLI - Video - Slides - (AngularNYC Meetup, January 2019) -
  • - -
  • - The CLI Roadmap - Video - (AngularConnect, November 2018) -
  • - -
  • - Develop Angular like Google Does - Slides - (AngularMIX, October 2018) -
  • - -
  • - Building large Angular apps with Bazel - Slides - Video - (BazelCon, October 2018) -
  • - -
  • - How I love being ejected - Slides - Video - (ng-conf, April 2018) -
  • -
  • - Angular Libraries in Bazel - Slides - (AngularSF Meetup, April 2018) -
  • - -
  • - Bazel for building Angular Applications - Video - (St. Louis Angular Lunch, February 2018) -
  • - -
  • - Building Angular Applications like Google - Slides - Video - (AngularConnect, November 2017) -
  • - -
  • - Bazel for Web Frontends - Slides - Video - (BazelCon November 2017) -
  • - -
  • - Angular with Bazel and Closure - Slides - Video - (AngularMIX October 2017) -
  • -
-

Articles

- - -

Trainings

-
    -
  • - LiveCoding a Bazel rule for Stylus - Video - (July 2019) -
  • - -
  • - Bazel Training for Angular Team - Slides - (January 2019) -
  • - -
  • - Full Stack development with Nx and Bazel - Slides - Video - (ng-conf, April 2018) -
  • - -
  • - ABC Deep Dive tech talk - Slides - Video - (February 2018) -
  • -
- -

Examples

- -
-
-
- -
- - diff --git a/examples/angular/src/lib/shorten/BUILD.bazel b/examples/angular/src/lib/shorten/BUILD.bazel index 75746e8a65..a9e81e5ac4 100644 --- a/examples/angular/src/lib/shorten/BUILD.bazel +++ b/examples/angular/src/lib/shorten/BUILD.bazel @@ -1,13 +1,19 @@ -load("@npm//@bazel/typescript:index.bzl", "ts_library") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//tools:typescript.bzl", "ts_project") package(default_visibility = ["//:__subpackages__"]) # TODO: change entry to something other than index.js & add a package.json here # with a main field to show how to create a first-party npm lib with a package.json -ts_library( - name = "shorten", +ts_project( + name = "shorten-ts", srcs = ["index.ts"], - module_name = "@bazel/shorten", +) + +js_library( + name = "shorten", + package_name = "@bazel/shorten", + deps = [":shorten-ts"], ) # TODO(alexeagle): show how it can be deployed to npm diff --git a/examples/angular/src/main.ts b/examples/angular/src/main.ts deleted file mode 100644 index ea9cd273de..0000000000 --- a/examples/angular/src/main.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This main entry point is used to launch the app under the - * @angular-devkit/build-angular, which is the default CLI - * builder. Note that for AOT, the CLI will magically replace - * the bootstrap by switching platform-browser-dynamic with - * platform-browser. - * This file is completely unused in the Bazel build. - */ -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; - -import {AppModule} from './app.module'; - -platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.log(err)); \ No newline at end of file diff --git a/examples/angular/src/prerender-spec.ts b/examples/angular/src/prerender-spec.ts deleted file mode 100644 index efb4006c2c..0000000000 --- a/examples/angular/src/prerender-spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { readFileSync } from 'fs'; - -const indexPathFlagIdx = process.argv.findIndex(arg => arg === '--index'); -const indexPath = process.argv[indexPathFlagIdx + 1]; - -const routeFlagIdx = process.argv.findIndex(arg => arg === '--route'); -const route = process.argv[routeFlagIdx + 1]; - -const expectedElementsFlagIdx = process.argv.findIndex(arg => arg === '--expected'); -const elements = process.argv.slice(expectedElementsFlagIdx + 1); - -const index = readFileSync(indexPath.substring(indexPath.indexOf('/') + 1), { encoding: 'utf8' }); - -// check the index has the route stamped as a comment at the start -if (!index.trim().startsWith(``)) { - console.error(`Expected index ${indexPath} to start with '', but this was not found`); - process.exit(1); -} - -if (!elements) { - // no elements to check for, and no errors above, all is good - process.exit(0); -} - -// check index contains the expected elements -elements - .forEach(element => { - const position = index.indexOf(`<${element}`); - if (position === -1) { - console.error(`Expected index to contain element ${element}, but this was not found`); - process.exit(1); - } - }); diff --git a/examples/angular/src/prerender.ts b/examples/angular/src/prerender.ts deleted file mode 100644 index eb8bf51056..0000000000 --- a/examples/angular/src/prerender.ts +++ /dev/null @@ -1,50 +0,0 @@ -import 'zone.js/dist/zone-node'; -import 'reflect-metadata'; - -import { readFileSync, writeFileSync } from 'fs'; -import { renderModule } from '@angular/platform-server'; -import * as domino from 'domino'; - -const rootIndexPathFlagIdx = process.argv.findIndex(arg => arg === '--index'); -const rootIndexPath = process.argv[rootIndexPathFlagIdx + 1]; - -const routesFlagIdx = process.argv.findIndex(arg => arg === '--routes'); -const routes = process.argv.slice(routesFlagIdx + 1, process.argv.length); - -const outsFlagIdx = process.argv.findIndex(arg => arg === '--outs'); -const outs = process.argv.slice(outsFlagIdx + 1, routesFlagIdx); - -const document = readFileSync(rootIndexPath, {encoding: 'utf8'}) - // Replace the timestamp placeholder for cache busting. - // This is done per build and not per request, so the timestamp - // remains the same, until the app (or more precisely the prerender - // target) is rebuilt. - .replace(/TIMESTAMP-VARIABLE/g, `${Date.now()}`); - -const win: any = domino.createWindow(document); -declare const global: any; - -global.window = win; -global.Node = win.Node; -global.navigator = win.navigator; -global.Event = win.Event; -global.KeyboardEvent = win.Event; -global.MouseEvent = win.Event; -global.Event.prototype = win.Event.prototype; -global.document = win.document; -global.HTMLInputElement = win.HTMLInputElement; -global.HTMLDocument = win.HTMLDocument; - -import { AppServerModule } from './app/app.server.module'; - -const renderProcesses: Array> = routes.map((url, i) => { - return renderModule(AppServerModule, { url, document }) - .then((html: string) => writeFileSync(outs[i], `\n${html}`, { encoding: 'utf8' })) - .catch((err: Error) => { - console.error(err); - process.exit(1); - }); -}); - -Promise.all(renderProcesses) - .then(() => process.exit()); diff --git a/examples/angular/src/rxjs_shims.js b/examples/angular/src/rxjs_shims.js deleted file mode 100644 index 3c26bf2851..0000000000 --- a/examples/angular/src/rxjs_shims.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @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 - */ - -/** - * @fileoverview these provide named UMD modules so that we can bundle - * the application along with rxjs using the concatjs bundler. - */ - -// rxjs/operators -(function(factory) { -if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); - if (v !== undefined) module.exports = v; -} else if (typeof define === 'function' && define.amd) { - define('rxjs/operators', ['exports', 'rxjs'], factory); -} -})(function(exports, rxjs) { -'use strict'; -Object.keys(rxjs.operators).forEach(function(key) { - exports[key] = rxjs.operators[key]; -}); -Object.defineProperty(exports, '__esModule', {value: true}); -}); - -// rxjs/testing -(function(factory) { -if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); - if (v !== undefined) module.exports = v; -} else if (typeof define === 'function' && define.amd) { - define('rxjs/testing', ['exports', 'rxjs'], factory); -} -})(function(exports, rxjs) { -'use strict'; -Object.keys(rxjs.testing).forEach(function(key) { - exports[key] = rxjs.testing[key]; -}); -Object.defineProperty(exports, '__esModule', {value: true}); -}); diff --git a/examples/angular/src/server.ts b/examples/angular/src/server.ts deleted file mode 100644 index 35b5dd8d00..0000000000 --- a/examples/angular/src/server.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// -import 'zone.js/dist/zone-node'; - -import { ngExpressEngine } from '@nguniversal/express-engine'; -import * as express from 'express'; -import { join } from 'path'; - -import { AppServerModule } from './app/app.server.module'; - -const app = express(); -const port = process.env.PORT || 4000; -const DIST_FOLDER = join(process.cwd(), 'src/pwa'); - -app.engine('html', ngExpressEngine({ bootstrap: AppServerModule }) as any); -app.set('view engine', 'html'); -app.set('views', DIST_FOLDER); - -app.get('*.*', express.static(DIST_FOLDER, { maxAge: '1y' })); -app.get('*', (req, res) => res.render('example/index', { req })); -app.listen(port, () => console.log(`Server listening http://localhost:${port}`)); diff --git a/examples/angular/src/shared/material/BUILD.bazel b/examples/angular/src/shared/material/BUILD.bazel index a54e13f2ac..882503cfa0 100644 --- a/examples/angular/src/shared/material/BUILD.bazel +++ b/examples/angular/src/shared/material/BUILD.bazel @@ -1,11 +1,10 @@ -load("//tools:angular_ts_library.bzl", "ng_ts_library") +load("//tools:angular_ts_project.bzl", "ng_ts_project") -package(default_visibility = ["//:__subpackages__"]) +package(default_visibility = ["//visibility:public"]) -ng_ts_library( +ng_ts_project( name = "material", srcs = glob(["*.ts"]), - tsconfig = "//src:tsconfig.json", deps = [ "@npm//@angular/core", "@npm//@angular/material", diff --git a/examples/angular/src/tsconfig-test.json b/examples/angular/src/tsconfig-test.json index f4a586e476..3c91aff719 100644 --- a/examples/angular/src/tsconfig-test.json +++ b/examples/angular/src/tsconfig-test.json @@ -1,6 +1,6 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "types": ["jasmine"] + "types": ["jasmine", "node"] } } \ No newline at end of file diff --git a/examples/angular/src/tsconfig.json b/examples/angular/src/tsconfig.json index c1d7f69c95..54abaf5852 100644 --- a/examples/angular/src/tsconfig.json +++ b/examples/angular/src/tsconfig.json @@ -1,5 +1,8 @@ { "compilerOptions": { + "module": "es2020", + "moduleResolution": "node", + // Allow uses of these JS APIs "lib": [ "dom", @@ -8,13 +11,30 @@ "es2015.iterable", "es2015.promise" ], + // Permit decorator syntax "experimentalDecorators": true, - // Don't scan the node_modules/@types folder for ambient types. - // This would force us to have all the types in the dependencies of - // each library. - // Instead we'll be explicit about declaring ambient type dependencies - // using the /// syntax. - "types": [] + "declaration": true, + "declarationMap": true, + + // No @types by default. Will be added as-needed by extensions + "types": [], + + "rootDirs": [ + ".", + + // Add all possible bazel-out directories + // See https://github.com/microsoft/TypeScript/issues/37257 + "../bazel-out/darwin_arm64-fastbuild/bin/src", + "../bazel-out/darwin-dbg/bin/src", + "../bazel-out/darwin-fastbuild/bin/src", + "../bazel-out/darwin-opt-exec-2B5CBBC6/bin/src", + "../bazel-out/k8-dbg/bin/src", + "../bazel-out/k8-fastbuild/bin/src", + "../bazel-out/k8-opt-exec-2B5CBBC6/bin/src", + "../bazel-out/x64_windows-dbg/bin/src", + "../bazel-out/x64_windows-fastbuild/bin/src", + "../bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/src" + ] } -} \ No newline at end of file +} diff --git a/examples/angular/src/tsconfig.server.json b/examples/angular/src/tsconfig.server.json deleted file mode 100644 index 76adec1cf3..0000000000 --- a/examples/angular/src/tsconfig.server.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./out-tsc/app-server", - "module": "commonjs", - "types": ["node"] - }, - "files": ["src/main.server.ts", "server.ts"], - "angularCompilerOptions": { - "entryModule": "./src/app/app.server.module#AppServerModule" - } -} diff --git a/examples/angular/tools/BUILD.bazel b/examples/angular/tools/BUILD.bazel index 43fc2cdc90..2252032a08 100644 --- a/examples/angular/tools/BUILD.bazel +++ b/examples/angular/tools/BUILD.bazel @@ -1,17 +1,3 @@ -load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") - -# Custom ts_library compiler that runs tsc_wrapped with angular/compiler-cli statically linked -# This can be used with worker mode because we don't need the linker at runtime to make -# the angular plugin loadable -# Just a clone of @npm//@bazel/typescript/bin:tsc_wrapped with added deps -nodejs_binary( - name = "tsc_wrapped_with_angular", - data = [ - "@npm//@angular/compiler-cli", - "@npm//@bazel/typescript", - ], - entry_point = "@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js", - # TODO: turn on --worker_sandboxing and remove this flag to see failure to load the plugin - templated_args = ["--bazel_patch_module_resolver"], - visibility = ["//:__subpackages__"], -) +exports_files([ + "karma.conf.js", +]) diff --git a/examples/angular/tools/angular_prerender.bzl b/examples/angular/tools/angular_prerender.bzl deleted file mode 100644 index 080758fc95..0000000000 --- a/examples/angular/tools/angular_prerender.bzl +++ /dev/null @@ -1,117 +0,0 @@ -"""Helper macros for rendering parts of an Angular application at build time""" - -load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _nodejs_test = "nodejs_test") -load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library") - -def _get_output_path(route, root_at): - return root_at + "/" + route + "/index.html" - -def ng_prerender(name, index, prerender_roots = [], **kwargs): - """ - Helper macro for prerendering Angular routes to index files as part of the build - - The outputs of this macro are: - %name% - all the rendered roots, plus the root route / - %name%.root - an alias referencing just the root index file - %name%.%route% - an alias referencing each rendered route, with / replaced by underscores - - Args: - name: Rule name for the main output genrule - index: Label for the production index.html file with which to render into - prerender_roots: A list of roots that will be prerendered as part of this macro, the root route / is always rendered - """ - - renderer_lib = "%s_renderer_lib" % name - _ts_library( - name = renderer_lib, - srcs = ["//src:prerender.ts"], - deps = [ - "//src/app:app_server", - "@npm//@angular/platform-server", - "@npm//zone.js", - "@npm//domino", - "@npm//reflect-metadata", - "@npm//@types/node", - ], - ) - - bin = "%s_bin" % renderer_lib - _nodejs_binary( - name = bin, - data = [ - ":%s" % renderer_lib, - "@npm//@angular/platform-server", - "@npm//zone.js", - "@npm//domino", - "@npm//reflect-metadata", - ], - entry_point = "//src:prerender.ts", - templated_args = ["--nobazel_run_linker"], - ) - - root_at = "_prerender/" + native.package_name() - - # we can't output "foo/index.html" since that collides with source files and will likely cross a package boundary - # so we output "_prerender/pkg_name/route/index.html" - prerender_root_outs = [_get_output_path(route, root_at) for route in prerender_roots] - root_index = "%s/index.html" % root_at - - visibility = kwargs.pop("visibility", []) - - native.genrule( - name = name, - srcs = [index], - outs = [root_index] + prerender_root_outs, - cmd = "$(location :%s) --index $(location %s) --outs $(OUTS) --routes / %s" % (bin, index, " ".join(prerender_roots)), - tools = [":%s" % bin], - message = "Prerendering Angular", - visibility = visibility, - tags = kwargs.pop("tags", []), - ) - - # convenience "output groups" from macro - native.alias( - name = "%s.root" % name, - actual = root_index, - visibility = visibility, - ) - - [ - native.alias( - name = "%s.%s" % (name, route.replace("/", "_")), - actual = _get_output_path(route, root_at), - visibility = visibility, - ) - for route in prerender_roots - ] - -def ng_prerender_test(name, index, route, expected_elements = [], **kwargs): - """ - Simple smoke test for a prerendered index file, as generated by ng_prerender - - Args: - name: Rule name for the test - index: Label of the index file under test - route: The route that this index file belongs to - expected_elements: An optional array of expected elements that should appear in the index file - """ - - _ts_library( - name = "%s_render_spec" % name, - srcs = ["//src:prerender-spec.ts"], - deps = [ - "@npm//@types/node", - ], - testonly = 1, - ) - - _nodejs_test( - name = name, - data = [ - ":%s_render_spec" % name, - index, - ], - templated_args = ["--index $(location %s)" % index, "--route %s" % route, "--expected %s" % (" ".join(expected_elements))], - entry_point = "//src:prerender-spec.ts", - tags = kwargs.pop("tags", []), - ) diff --git a/examples/angular/tools/angular_ts_library.bzl b/examples/angular/tools/angular_ts_library.bzl deleted file mode 100644 index c17dc40c0d..0000000000 --- a/examples/angular/tools/angular_ts_library.bzl +++ /dev/null @@ -1,11 +0,0 @@ -"Shows how to enable both worker mode and use_angular_plugin to make a drop-in replacement for ng_module" - -load("@npm//@bazel/typescript:index.bzl", "ts_library") - -def ng_ts_library(**kwargs): - ts_library( - compiler = "//tools:tsc_wrapped_with_angular", - supports_workers = True, - use_angular_plugin = True, - **kwargs - ) diff --git a/examples/angular/tools/angular_ts_project.bzl b/examples/angular/tools/angular_ts_project.bzl new file mode 100644 index 0000000000..0cce628fb7 --- /dev/null +++ b/examples/angular/tools/angular_ts_project.bzl @@ -0,0 +1,12 @@ +"Shows how to use ts_project(tsc=ngc) to make a drop-in replacement for ng_module/ts_library(use_angular_plugin)" + +load("//tools:typescript.bzl", "ts_project") + +def ng_ts_project(name, tsconfig = "//src:tsconfig", srcs = [], angular_assets = [], **kwargs): + ts_project( + name = name, + tsconfig = tsconfig, + tsc = "@npm//@angular/compiler-cli/bin:ngc", + srcs = srcs + angular_assets, + **kwargs + ) diff --git a/examples/angular/tools/karma.bzl b/examples/angular/tools/karma.bzl new file mode 100644 index 0000000000..501b2dbe7f --- /dev/null +++ b/examples/angular/tools/karma.bzl @@ -0,0 +1,140 @@ +"""Helper macros for running jasmine specs via karma""" + +# Inspirect by: +# rules_nodejs concatjs: https://github.com/bazelbuild/rules_nodejs/blob/3.3.0/packages/concatjs/web_test/karma.conf.js +# esbuild: https://gist.github.com/mattem/f6e85437b0dbcca661013a19247889a9 + +load("@io_bazel_rules_webtesting//web:web.bzl", _web_test_suite = "web_test_suite") +load("@npm//@bazel/esbuild:index.bzl", _esbuild = "esbuild") +load("@npm//karma:index.bzl", _karma = "karma") + +KARMA_PEER_DEPS = [ + "@npm//karma-chrome-launcher", + "@npm//karma-firefox-launcher", + "@npm//karma-jasmine", + "@npm//karma-sourcemap-loader", + "@npm//karma-junit-reporter", +] + +# https://github.com/bazelbuild/rules_nodejs/blob/3.3.0/packages/concatjs/web_test/karma_web_test.bzl#L94-L99 +# 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.replace(".ts", ".js") + +# Generate a karma.config.js file to: +# - run the given bundle containing specs +# - serve the given assets via http +# - bootstrap a set of js files before the bundle +def _generate_karma_config_impl(ctx): + configuration = ctx.outputs.configuration + + # root-relative (runfiles) path to the directory containing karma.conf + config_segments = len(configuration.short_path.split("/")) + + # Extract the bundle directory out of the bundle target files + bundle_dir = [f for f in ctx.attr.bundle[DefaultInfo].files.to_list() if f.is_directory][0] + + ctx.actions.expand_template( + template = ctx.file._conf_tmpl, + output = configuration, + substitutions = { + "TMPL_bootstrap_files": "\n ".join(["'%s'," % _to_manifest_path(ctx, e) for e in ctx.files.bootstrap]), + "TMPL_runfiles_path": "/".join([".."] * config_segments), + "TMPL_static_files": "\n ".join(["'%s'," % _to_manifest_path(ctx, e) for e in ctx.files.static_files]), + "TMPL_test_bundle_dir": _to_manifest_path(ctx, bundle_dir), + }, + ) + +_generate_karma_config = rule( + implementation = _generate_karma_config_impl, + attrs = { + # https://github.com/bazelbuild/rules_nodejs/blob/3.3.0/packages/concatjs/web_test/karma_web_test.bzl#L34-L39 + "bootstrap": attr.label_list( + doc = """JavaScript files to load via -- -+ - - --
-+
-
-
-- Package Angular libraries for npm distribution -+ Package Angular libraries for npm distribution -
-
- -@@ -62,120 +83,187 @@ Documentation generated by Skydoc -
-

Package Angular libraries for npm distribution

- -- --
-+ -+
-

Overview

--

If all users of an Angular library use Bazel (e.g. internal usage in your company) --then you should simply add your library to the deps of the consuming application.

--

These rules exist for compatibility with non-Bazel consumers of your library.

--

It packages your library following the Angular Package Format, see the --specification of this format at https://goo.gl/jB3GVv

-- --
-+

-+ If all users of an Angular library use Bazel (e.g. internal usage in -+ your company) then you should simply add your library to the -+ deps of the consuming application. -+

-+

-+ These rules exist for compatibility with non-Bazel consumers of your -+ library. -+

-+

-+ It packages your library following the Angular Package Format, see -+ the specification of this format at -+ https://goo.gl/jB3GVv -+

-+ -+
- -

primary_entry_point_name

- -
primary_entry_point_name(name, entry_point, entry_point_name)
- -

This is not a public API.

--

Compute the name of the primary entry point in the library.

--

Returns: -- name of the entry point, which will appear in the name of generated bundles

-- -+

Compute the name of the primary entry point in the library.

-+

-+ Returns: name of the entry point, which will appear in the name of -+ generated bundles -+

- -

Attributes

- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
name --

Name; Required

--

the name of the ng_package rule, as a fallback.

--
entry_point --

Unknown; Required

--

The starting point of the application, see rollup_bundle.

--
entry_point_name --

Unknown; Required

--

if set, this is the returned value.

--
--
-+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+
name -+

-+ Name; Required -+

-+

-+ the name of the ng_package rule, as a fallback. -+

-+
entry_point -+

Unknown; Required

-+

-+ The starting point of the application, see rollup_bundle. -+

-+
entry_point_name -+

Unknown; Required

-+

if set, this is the returned value.

-+
-+
- -

ng_package

- -
ng_package(name, deps, data, srcs, entry_point, entry_point_name, globals, include_devmode_srcs, license_banner, ng_packager, readme_md, rollup, rollup_config_tmpl, terser, terser_config_file)
- --

ng_package produces an npm-ready package from an Angular library.

-- -+

-+ ng_package produces an npm-ready package from an Angular library. -+

- -

Attributes

- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+
name --

Name; Required

--

A unique name for this rule.

--
deps --

List of labels; Optional; Default is []

--

Other rules that produce JavaScript outputs, such as ts_library.

--
data --

List of labels; Optional; Default is []

--

Additional, non-Angular files to be added to the package, e.g. global CSS assets.

--
srcs --

List of labels; Optional; Default is []

--

JavaScript source files from the workspace. -- These can use ES2015 syntax and ES Modules (import/export)

--
entry_point --

Label; Required

--

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),
-+          
-+            -+              -+              -+            
-+            
-+              
-+                
-+                
-+              
-+              
-+                
-+                
-+              
-+              
-+                
-+                
-+              
-+              
-+                
-+                
-+              
-+              
-+                
-+                
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--    
--      
--      
--    
--  
--
name -+

-+ Name; Required -+

-+

A unique name for this rule.

-+
deps -+

-+ List of -+ labels; Optional; Default is [] -+

-+

-+ Other rules that produce JavaScript outputs, such as -+ ts_library. -+

-+
data -+

-+ List of -+ labels; Optional; Default is [] -+

-+

-+ Additional, non-Angular files to be added to the package, -+ e.g. global CSS assets. -+

-+
srcs -+

-+ List of -+ labels; Optional; Default is [] -+

-+

-+ JavaScript source files from the workspace. These can use -+ ES2015 syntax and ES Modules (import/export) -+

-+
entry_point -+

-+ Label; Required -+

-+

-+ 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:
- 
-     ```
-@@ -218,93 +306,155 @@ specification of this format at https://goo.gl/j
-     )
-     ```
- 
--
entry_point_name --

String; Optional; Default is ''

--

Name to use when generating bundle files for the primary entry-point.

--
globals --

Dictionary mapping strings to string; Optional; Default is {}

--

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.

--
include_devmode_srcs --

Boolean; Optional; Default is False

-- --
license_banner --

Label; Optional

--

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 9.0.5. See the section on stamping in the README.

--
ng_packager --

Label; Optional; Default is @npm//@angular/bazel/bin:packager

-- --
readme_md --

Label; Optional

-- --
rollup --

Label; Optional; Default is @npm_angular_bazel//src/ng_package:rollup_for_ng_package

-- --
rollup_config_tmpl --

Label; Optional; Default is @npm_angular_bazel//src/ng_package:rollup.config.js

-- --
terser --

Label; Optional; Default is @npm//terser/bin:terser

-- --
terser_config_file --

Label; Optional; Default is @npm_angular_bazel//src/ng_package:terser_config.default.json

--

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.

--
-- -- -+
entry_point_name -+

String; Optional; Default is ''

-+

-+ Name to use when generating bundle files for the primary -+ entry-point. -+

-+
globals -+

-+ Dictionary mapping strings to string; Optional; Default -+ is {} -+

-+

-+ 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. -+

-+
include_devmode_srcs -+

Boolean; Optional; Default is False

-+
license_banner -+

-+ Label; Optional -+

-+

-+ 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 9.0.5. See the section on -+ stamping in the README. -+

-+
ng_packager -+

-+ Label; Optional; Default is -+ @npm//@angular/bazel/bin:packager -+

-+
readme_md -+

-+ Label; Optional -+

-+
rollup -+

-+ Label; Optional; Default is -+ @npm_angular_bazel//@angular/bazel/src/ng_package:rollup_for_ng_package -+

-+
rollup_config_tmpl -+

-+ Label; Optional; Default is -+ @npm_angular_bazel//@angular/bazel/src/ng_package:rollup.config.js -+

-+
terser -+

-+ Label; Optional; Default is @npm//terser/bin:terser -+

-+
terser_config_file -+

-+ Label; Optional; Default is -+ @npm_angular_bazel//@angular/bazel/src/ng_package:terser_config.default.json -+

-+

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. -+

-+
-
- -