chore(6.0): remove esbuild package
diff --git a/.bazelrc b/.bazelrc index 6bce536..6650196 100644 --- a/.bazelrc +++ b/.bazelrc
@@ -5,8 +5,8 @@ # 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=e2e/bazel_managed_deps,e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,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/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/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/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 +build --deleted_packages=e2e/bazel_managed_deps,e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,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/webapp,examples/angular,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/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/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/webapp,examples/angular,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/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"
diff --git a/.gitattributes b/.gitattributes index b991f7c..41ccfeb 100644 --- a/.gitattributes +++ b/.gitattributes
@@ -1,6 +1,5 @@ docs/Built-ins.md linguist-generated=true docs/Cypress.md linguist-generated=true -docs/esbuild.md linguist-generated=true docs/Jasmine.md linguist-generated=true docs/Providers.md linguist-generated=true docs/Rollup.md linguist-generated=true
diff --git a/.github/BUILD.bazel b/.github/BUILD.bazel index 9a7493b..3ad6354 100644 --- a/.github/BUILD.bazel +++ b/.github/BUILD.bazel
@@ -9,11 +9,9 @@ owners = [ "//:OWNERS", "//packages/rollup:OWNERS", - "//packages/esbuild:OWNERS", "//packages/cypress:OWNERS", "//examples:OWNERS.examples_jest", "//examples:OWNERS.examples_nestjs", - "//examples:OWNERS.examples_esbuild", "//examples:OWNERS.examples_cypress", "//examples:OWNERS.examples_angular", "//examples:OWNERS.examples_angular_bazel_architect",
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f9677e4..93ab34f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS
@@ -4,11 +4,9 @@ * @mattem @gregmagolan @alexeagle /packages/rollup/** @jbedard @alexeagle @gregmagolan @mattem -/packages/esbuild/** @mattem @alexeagle @gregmagolan /packages/cypress/** @mrmeku @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 @jbedard @alexeagle @gregmagolan @mattem /examples/angular_bazel_architect/** @alan-agius4 @jbedard @alexeagle @gregmagolan @mattem
diff --git a/BUILD.bazel b/BUILD.bazel index 8f050e8..2e5f1a4 100644 --- a/BUILD.bazel +++ b/BUILD.bazel
@@ -112,7 +112,6 @@ "//third_party/npm/node_modules/ieee754:package_contents", "//third_party/npm/node_modules/named-amd:package_contents", "//toolchains/cypress:package_contents", - "//toolchains/esbuild:package_contents", ], )
diff --git a/WORKSPACE b/WORKSPACE index f123796..d66e48d 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -25,11 +25,6 @@ path = ".", ) -local_repository( - name = "internal_npm_package_test_vendored_external", - path = "internal/pkg_npm/test/vendored_external", -) - # # Install rules_nodejs dev dependencies # @@ -106,14 +101,6 @@ firefox = True, ) -# Setup esbuild dependencies -load("//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories") - -esbuild_repositories( - node_repository = "node16", - npm_repository = "npm", -) - # # Dependencies to run stardoc & generating documentation #
diff --git a/commitlint.config.js b/commitlint.config.js index ae50e71..253b39f 100644 --- a/commitlint.config.js +++ b/commitlint.config.js
@@ -9,7 +9,6 @@ 'builtin', 'create', 'cypress', - 'esbuild', 'examples', 'jasmine', 'rollup',
diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index f9c85fc..a1cc99a 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel
@@ -69,7 +69,6 @@ "Terser": "//packages/terser:README.md", "Toolchains": "//toolchains:README.md", "TypeScript": "//packages/typescript:README.md", - "esbuild": "//packages/esbuild:README.md", } [
diff --git a/docs/Toolchains.md b/docs/Toolchains.md index b7626f7..7a67195 100644 --- a/docs/Toolchains.md +++ b/docs/Toolchains.md
@@ -94,32 +94,6 @@ Defaults to `None` -## configure_esbuild_toolchains - -**USAGE** - -<pre> -configure_esbuild_toolchains(<a href="#configure_esbuild_toolchains-name">name</a>, <a href="#configure_esbuild_toolchains-platforms">platforms</a>) -</pre> - -Configures esbuild toolchains for a list of supported platforms - -**PARAMETERS** - - -<h4 id="configure_esbuild_toolchains-name">name</h4> - -unused - -Defaults to `""` - -<h4 id="configure_esbuild_toolchains-platforms">platforms</h4> - -dict of platforms to configure toolchains for - -Defaults to `{}` - - ## cypress_repositories **USAGE** @@ -193,59 +167,3 @@ (Optional) SHA-256 of the windows cypress binary Defaults to `""` - - -## esbuild_repositories - -**USAGE** - -<pre> -esbuild_repositories(<a href="#esbuild_repositories-npm_repository">npm_repository</a>, <a href="#esbuild_repositories-name">name</a>, <a href="#esbuild_repositories-npm_args">npm_args</a>, <a href="#esbuild_repositories-kwargs">kwargs</a>) -</pre> - -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** - - -<h4 id="esbuild_repositories-npm_repository">npm_repository</h4> - -the name of the repository where the @bazel/esbuild package is installed -by npm_install or yarn_install. - - - -<h4 id="esbuild_repositories-name">name</h4> - -currently unused - -Defaults to `""` - -<h4 id="esbuild_repositories-npm_args">npm_args</h4> - -additional args to pass to the npm install rule - -Defaults to `[]` - -<h4 id="esbuild_repositories-kwargs">kwargs</h4> - -additional named parameters to the npm_install rule - - - -
diff --git a/docs/esbuild.md b/docs/esbuild.md deleted file mode 100755 index 21c7900..0000000 --- a/docs/esbuild.md +++ /dev/null
@@ -1,485 +0,0 @@ -<!-- ********************* - DO NOT EDIT THIS FILE - It is a generated build output from Stardoc. - Instead you must edit the .bzl file where the rules are declared, - or possibly a markdown file next to the .bzl file - ********************* --> - -# 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`. - -``` -npm install --save-dev @bazel/esbuild -``` -or using yarn -``` -yarn add -D @bazel/esbuild -``` - -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 -npm_install( - name = "npm", - # @bazel/esbuild is a dependency in this package.json - package_json = "//:package.json", - package_lock_json = "//:package-lock.json", -) - -load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories") - -esbuild_repositories(npm_repository = "npm") -``` - -> 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. - -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. - -## 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_project") - -ts_project( - 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. - -```python -load("@npm//@bazel/esbuild:index.bzl", "esbuild") -load("@npm//@bazel/typescript:index.bzl", "ts_project") - -ts_project( - 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** - -<pre> -esbuild(<a href="#esbuild-name">name</a>, <a href="#esbuild-args">args</a>, <a href="#esbuild-args_json">args_json</a>, <a href="#esbuild-config">config</a>, <a href="#esbuild-define">define</a>, <a href="#esbuild-define_settings">define_settings</a>, <a href="#esbuild-deps">deps</a>, <a href="#esbuild-entry_point">entry_point</a>, <a href="#esbuild-entry_points">entry_points</a>, - <a href="#esbuild-external">external</a>, <a href="#esbuild-format">format</a>, <a href="#esbuild-launcher">launcher</a>, <a href="#esbuild-link_workspace_root">link_workspace_root</a>, <a href="#esbuild-max_threads">max_threads</a>, <a href="#esbuild-metafile">metafile</a>, <a href="#esbuild-minify">minify</a>, <a href="#esbuild-output">output</a>, - <a href="#esbuild-output_css">output_css</a>, <a href="#esbuild-output_dir">output_dir</a>, <a href="#esbuild-output_map">output_map</a>, <a href="#esbuild-platform">platform</a>, <a href="#esbuild-sourcemap">sourcemap</a>, <a href="#esbuild-sources_content">sources_content</a>, <a href="#esbuild-splitting">splitting</a>, <a href="#esbuild-srcs">srcs</a>, - <a href="#esbuild-stamp">stamp</a>, <a href="#esbuild-target">target</a>) -</pre> - -Runs the esbuild bundler under Bazel - -For further information about esbuild, see https://esbuild.github.io/ - - -**ATTRIBUTES** - - -<h4 id="esbuild-name">name</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#name">Name</a>, mandatory*): A unique name for this target. - - -<h4 id="esbuild-args">args</h4> - -(*<a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a>*): 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 `{}` - -<h4 id="esbuild-args_json">args_json</h4> - -(*String*): Internal use only - -Defaults to `""` - -<h4 id="esbuild-config">config</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): 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` - -<h4 id="esbuild-define">define</h4> - -(*<a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a>*): A dict of global identifier replacements. Values are subject to $(location ...) expansion. -Example: -```python -esbuild( - name = "bundle", - define = { - "process.env.NODE_ENV": "production" - }, -) -``` - -See https://esbuild.github.io/api/#define for more details - -Defaults to `{}` - -<h4 id="esbuild-define_settings">define_settings</h4> - -(*<a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: Label -> String</a>*): 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 `{}` - -<h4 id="esbuild-deps">deps</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a>*): A list of direct dependencies that are required to build the bundle - -Defaults to `[]` - -<h4 id="esbuild-entry_point">entry_point</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): 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` - -<h4 id="esbuild-entry_points">entry_points</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a>*): 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 `[]` - -<h4 id="esbuild-external">external</h4> - -(*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 `[]` - -<h4 id="esbuild-format">format</h4> - -(*String*): The output format of the bundle, defaults to iife when platform is browser -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 - -Defaults to `""` - -<h4 id="esbuild-launcher">launcher</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>, mandatory*): Internal use only - - -<h4 id="esbuild-link_workspace_root">link_workspace_root</h4> - -(*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` - -<h4 id="esbuild-max_threads">max_threads</h4> - -(*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` - -<h4 id="esbuild-metafile">metafile</h4> - -(*Boolean*): if true, esbuild creates a metafile along the output - -Defaults to `True` - -<h4 id="esbuild-minify">minify</h4> - -(*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` - -<h4 id="esbuild-output">output</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): Name of the output file when bundling - - -<h4 id="esbuild-output_css">output_css</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): 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'. - - -<h4 id="esbuild-output_dir">output_dir</h4> - -(*Boolean*): If true, esbuild produces an output directory containing all output files - -Defaults to `False` - -<h4 id="esbuild-output_map">output_map</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): Name of the output source map when bundling - - -<h4 id="esbuild-platform">platform</h4> - -(*String*): The platform to bundle for. - -See https://esbuild.github.io/api/#platform for more details - -Defaults to `"browser"` - -<h4 id="esbuild-sourcemap">sourcemap</h4> - -(*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 `""` - -<h4 id="esbuild-sources_content">sources_content</h4> - -(*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` - -<h4 id="esbuild-splitting">splitting</h4> - -(*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` - -<h4 id="esbuild-srcs">srcs</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a>*): Source files to be made available to esbuild - -Defaults to `[]` - -<h4 id="esbuild-stamp">stamp</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): 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` - -<h4 id="esbuild-target">target</h4> - -(*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"` - - -## configure_esbuild_toolchain - -**USAGE** - -<pre> -configure_esbuild_toolchain(<a href="#configure_esbuild_toolchain-name">name</a>, <a href="#configure_esbuild_toolchain-binary">binary</a>, <a href="#configure_esbuild_toolchain-exec_compatible_with">exec_compatible_with</a>) -</pre> - -Defines a toolchain for esbuild given the binary path and platform constraints - -**PARAMETERS** - - -<h4 id="configure_esbuild_toolchain-name">name</h4> - -unique name for this toolchain, generally in the form "esbuild_platform_arch" - - - -<h4 id="configure_esbuild_toolchain-binary">binary</h4> - -label for the esbuild binary - - - -<h4 id="configure_esbuild_toolchain-exec_compatible_with">exec_compatible_with</h4> - -list of platform constraints - - - - -## esbuild_config - -**USAGE** - -<pre> -esbuild_config(<a href="#esbuild_config-name">name</a>, <a href="#esbuild_config-config_file">config_file</a>, <a href="#esbuild_config-srcs">srcs</a>, <a href="#esbuild_config-deps">deps</a>, <a href="#esbuild_config-kwargs">kwargs</a>) -</pre> - -Macro for an esbuild configuration file and its assoicated dependencies - -**PARAMETERS** - - -<h4 id="esbuild_config-name">name</h4> - -Unique name for this rule - - - -<h4 id="esbuild_config-config_file">config_file</h4> - -The configuration file / entrypoint - - - -<h4 id="esbuild_config-srcs">srcs</h4> - -List of source files referenced by the configuration - -Defaults to `[]` - -<h4 id="esbuild_config-deps">deps</h4> - -List of dependencies required for this configuration - -Defaults to `[]` - -<h4 id="esbuild_config-kwargs">kwargs</h4> - -Any other common attributes - - - - -## esbuild_repositories - -**USAGE** - -<pre> -esbuild_repositories(<a href="#esbuild_repositories-npm_repository">npm_repository</a>, <a href="#esbuild_repositories-name">name</a>, <a href="#esbuild_repositories-npm_args">npm_args</a>, <a href="#esbuild_repositories-kwargs">kwargs</a>) -</pre> - -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** - - -<h4 id="esbuild_repositories-npm_repository">npm_repository</h4> - -the name of the repository where the @bazel/esbuild package is installed -by npm_install or yarn_install. - - - -<h4 id="esbuild_repositories-name">name</h4> - -currently unused - -Defaults to `""` - -<h4 id="esbuild_repositories-npm_args">npm_args</h4> - -additional args to pass to the npm install rule - -Defaults to `[]` - -<h4 id="esbuild_repositories-kwargs">kwargs</h4> - -additional named parameters to the npm_install rule - - - -
diff --git a/docs/index.md b/docs/index.md index 137ba4d..20823e0 100644 --- a/docs/index.md +++ b/docs/index.md
@@ -45,7 +45,6 @@ since the node resolution algorithm requires the callsite of `require` to be in the node_modules tree. - [Cypress](Cypress.md) - - [esbuild](esbuild.md) - [Jasmine](Jasmine.md) - [Labs](Labs.md) - [Rollup](Rollup.md)
diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index 118a205..e7a9b94 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel
@@ -18,7 +18,6 @@ name = "examples_angular", timeout = "long", npm_packages = { - "//packages/esbuild:npm_package": "@bazel/esbuild", "//packages/rollup:npm_package": "@bazel/rollup", "//packages/terser:npm_package": "@bazel/terser", "//packages/typescript:npm_package": "@bazel/typescript", @@ -250,13 +249,3 @@ "manual", ], ) - -example_integration_test( - name = "examples_esbuild", - timeout = "long", - npm_packages = { - "//packages/esbuild:npm_package": "@bazel/esbuild", - "//packages/typescript:npm_package": "@bazel/typescript", - }, - owners = ["@mattem"], -)
diff --git a/examples/angular/WORKSPACE b/examples/angular/WORKSPACE index d552c06..ba38d9a 100644 --- a/examples/angular/WORKSPACE +++ b/examples/angular/WORKSPACE
@@ -85,13 +85,6 @@ firefox = True, ) -# Setup esbuild repositories -load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories") - -esbuild_repositories( - npm_repository = "npm", -) - # Setup the rules_sass toolchain load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
diff --git a/examples/angular/src/app/hello-world/BUILD.bazel b/examples/angular/src/app/hello-world/BUILD.bazel index fa42706..ddf15c9 100644 --- a/examples/angular/src/app/hello-world/BUILD.bazel +++ b/examples/angular/src/app/hello-world/BUILD.bazel
@@ -1,6 +1,5 @@ load("@io_bazel_rules_sass//:defs.bzl", "multi_sass_binary") load("//tools:angular_ts_project.bzl", "ng_ts_project") -load("//tools:karma.bzl", "karma_web_test_suite") load("//tools:typescript.bzl", "ts_test_project") package(default_visibility = ["//:__subpackages__"]) @@ -44,24 +43,3 @@ "@npm//@angular/platform-browser", ], ) - -karma_web_test_suite( - name = "test", - # do not sort - bootstrap = [ - "@npm//:node_modules/zone.js/dist/zone-testing-bundle.js", - "@npm//:node_modules/reflect-metadata/Reflect.js", - ], - browsers = [ - "@io_bazel_rules_webtesting//browsers:chromium-local", - "@io_bazel_rules_webtesting//browsers:firefox-local", - ], - specs = [ - "//src:initialize_testbed.js", - ":test_lib", - ], - deps = [ - ":test_lib", - "//src:initialize_testbed", - ], -)
diff --git a/examples/angular/tools/karma.bzl b/examples/angular/tools/karma.bzl deleted file mode 100644 index 501b2db..0000000 --- a/examples/angular/tools/karma.bzl +++ /dev/null
@@ -1,140 +0,0 @@ -"""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 <script> *before* the specs""", - allow_files = [".js"], - ), - "bundle": attr.label( - doc = """The label producing the bundle directory containing the specs""", - mandatory = True, - ), - - # https://github.com/bazelbuild/rules_nodejs/blob/3.3.0/packages/concatjs/web_test/karma_web_test.bzl#L81-L87 - "static_files": attr.label_list( - doc = """Arbitrary files which are available to be served on request""", - allow_files = True, - ), - - # https://github.com/bazelbuild/rules_nodejs/blob/3.3.0/packages/concatjs/web_test/karma_web_test.bzl#L88-L91 - "_conf_tmpl": attr.label( - doc = """the karma config template""", - cfg = "exec", - allow_single_file = True, - default = Label("//tools:karma.conf.js"), - ), - }, - outputs = { - "configuration": "%{name}.js", - }, -) - -# Macro to convert a set of files into a web_test_suite -def karma_web_test_suite(name, browsers, specs, deps = [], bootstrap = [], static_files = []): - """Run the given specs. - - Args: - name: primary karma target rule name - browsers: browsers to test - specs: spec files containing tests - deps: dependencies of the specs - bootstrap: files loaded in <script> tags up front - static_files: files available to download - """ - bundle_name = "%s.bundle" % name - suite_name = "%s.suite" % name - karma_config_name = "%s.conf" % name - karma_name = name - - # Bundle the spec files - _esbuild( - name = bundle_name, - entry_points = [spec.replace(".ts", ".js") for spec in specs], - output_dir = True, - splitting = True, - deps = deps, - testonly = 1, - ) - - _generate_karma_config( - name = karma_config_name, - bundle = ":%s" % bundle_name, - bootstrap = bootstrap, - static_files = static_files, - testonly = 1, - ) - - _karma( - name = karma_name, - testonly = 1, - data = KARMA_PEER_DEPS + bootstrap + static_files + [ - # generated config + specs-bundle - ":%s" % karma_config_name, - ":%s" % bundle_name, - ], - templated_args = [ - "start", - "$(rootpath %s)" % karma_config_name, - ], - ) - - # Create a rules_webtesting web_test_suite wrapping the karma runner - _web_test_suite( - name = suite_name, - test = ":" + karma_name, - launcher = ":" + karma_name, - testonly = 1, - tags = ["native"], - browsers = browsers, - )
diff --git a/examples/esbuild/.bazelignore b/examples/esbuild/.bazelignore deleted file mode 100644 index 3c3629e..0000000 --- a/examples/esbuild/.bazelignore +++ /dev/null
@@ -1 +0,0 @@ -node_modules
diff --git a/examples/esbuild/.bazelrc b/examples/esbuild/.bazelrc deleted file mode 100644 index 3431057..0000000 --- a/examples/esbuild/.bazelrc +++ /dev/null
@@ -1 +0,0 @@ -import %workspace%/../../common.bazelrc
diff --git a/examples/esbuild/BUILD.bazel b/examples/esbuild/BUILD.bazel deleted file mode 100644 index e69de29..0000000 --- a/examples/esbuild/BUILD.bazel +++ /dev/null
diff --git a/examples/esbuild/WORKSPACE b/examples/esbuild/WORKSPACE deleted file mode 100644 index 2635e88..0000000 --- a/examples/esbuild/WORKSPACE +++ /dev/null
@@ -1,41 +0,0 @@ -# Copyright 2019 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -workspace(name = "examples_esbuild") - -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", "yarn_install") - -yarn_install( - name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", -) - -load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories") - -esbuild_repositories( - npm_repository = "npm", -)
diff --git a/examples/esbuild/package.json b/examples/esbuild/package.json deleted file mode 100644 index 4b66246..0000000 --- a/examples/esbuild/package.json +++ /dev/null
@@ -1,16 +0,0 @@ -{ - "private": true, - "devDependencies": { - "@bazel/esbuild": "^5.8.1", - "@bazel/typescript": "^5.8.1", - "@types/node": "12.6.3", - "tslib": "1.9.0", - "typescript": "3.5.3" - }, - "dependencies": { - "chalk": "4.1.0" - }, - "scripts": { - "test": "bazel test //..." - } -}
diff --git a/examples/esbuild/src/BUILD.bazel b/examples/esbuild/src/BUILD.bazel deleted file mode 100644 index d2de5a2..0000000 --- a/examples/esbuild/src/BUILD.bazel +++ /dev/null
@@ -1,55 +0,0 @@ -load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test", "nodejs_binary", "npm_package_bin") -load("@npm//@bazel/esbuild:index.bzl", "esbuild") -load("@npm//@bazel/typescript:index.bzl", "ts_project") - -# build the Typescript to JS with ts_project -ts_project( - name = "lib", - srcs = [ - "main.ts", - "name.ts", - ], - tsconfig = { - "compilerOptions": { - "esModuleInterop": True, - }, - }, - deps = [ - "@npm//chalk", - ], -) - -# create a single bundle of the JS sources -esbuild( - name = "bundle", - entry_point = "main.ts", - minify = True, - # setting node as the platform will default us to CJS - platform = "node", - deps = [ - ":lib", - ], -) - -# binary for running our tool -nodejs_binary( - name = "bin", - data = [ - ":bundle", - ], - entry_point = "bundle.js", -) - -# run the built tool, capturing the stdout to the text file -npm_package_bin( - name = "greeter", - stdout = "greeting.txt", - tool = ":bin", -) - -# ensure our text file is what we are expecting -generated_file_test( - name = "test", - src = "greeting.golden.txt", - generated = "greeting.txt", -)
diff --git a/examples/esbuild/src/greeting.golden.txt b/examples/esbuild/src/greeting.golden.txt deleted file mode 100644 index bf71272..0000000 --- a/examples/esbuild/src/greeting.golden.txt +++ /dev/null
@@ -1 +0,0 @@ -Hello rules_nodejs!
diff --git a/examples/esbuild/src/main.ts b/examples/esbuild/src/main.ts deleted file mode 100644 index 39a82a1..0000000 --- a/examples/esbuild/src/main.ts +++ /dev/null
@@ -1,10 +0,0 @@ -import chalk from 'chalk'; - -import {NAME} from './name'; - -export function greeting(name: string): string { - return `Hello ${chalk.bold(name)}!`; -} - -const sentence = greeting(NAME); -console.log(sentence);
diff --git a/examples/esbuild/src/name.ts b/examples/esbuild/src/name.ts deleted file mode 100644 index c18ea6b..0000000 --- a/examples/esbuild/src/name.ts +++ /dev/null
@@ -1 +0,0 @@ -export const NAME = 'rules_nodejs';
diff --git a/examples/esbuild/yarn.lock b/examples/esbuild/yarn.lock deleted file mode 100644 index 5368af2..0000000 --- a/examples/esbuild/yarn.lock +++ /dev/null
@@ -1,119 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@bazel/esbuild@^5.8.1": - version "5.8.1" - resolved "https://registry.yarnpkg.com/@bazel/esbuild/-/esbuild-5.8.1.tgz#74668d33bfb29652cbe8e2852aa8dca5e0839e73" - integrity sha512-8k4LL8P3ivCnFeBOcjiFxL8U+M5VtEGuOyIqm2hfEiP8xDWsZLS7YQ7KhshKJy7Elh2dlK9oGgMtl0D/x9kxxg== - -"@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: - "@bazel/worker" "5.8.1" - semver "5.6.0" - source-map-support "0.5.9" - 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" - -"@types/node@12.6.3": - version "12.6.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.3.tgz#44d507c5634f85e7164707ca36bba21b5213d487" - integrity sha512-7TEYTQT1/6PP53NftXXabIZDaZfaoBdeBm8Md/i7zsWRoBe0YwOXguyK8vhHs8ehgB/w9U4K/6EWuTyp0W6nIA== - -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" - -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -chalk@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -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.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== - -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== - -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== - -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== - -source-map-support@0.5.9: - version "0.5.9" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" - integrity sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -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" - -tslib@1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" - integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ== - -tslib@^1.8.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -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.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==
diff --git a/internal/pkg_npm/test/BUILD.bazel b/internal/pkg_npm/test/BUILD.bazel index f4cea04..24ea29f 100644 --- a/internal/pkg_npm/test/BUILD.bazel +++ b/internal/pkg_npm/test/BUILD.bazel
@@ -37,7 +37,6 @@ srcs = [ "package.json", "some_file", - "@internal_npm_package_test_vendored_external//:vendored_external_file", ], nested_packages = [":dependent_pkg"], stamp = "@rules_nodejs//nodejs/stamp:always", @@ -45,16 +44,12 @@ "0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}", "replace_me": "replaced", }, - vendor_external = [ - "internal_npm_package_test_vendored_external", - ], deps = [ ":bundle.min.js", ":produces_files", ":rollup/bundle/subdirectory", ":ts_project", "//internal/pkg_npm/test/transition:test_lib", - "@internal_npm_package_test_vendored_external//:ts_project", ], )
diff --git a/packages/esbuild/BUILD.bazel b/packages/esbuild/BUILD.bazel deleted file mode 100644 index 14a6d8f..0000000 --- a/packages/esbuild/BUILD.bazel +++ /dev/null
@@ -1,83 +0,0 @@ -# Copyright 2020 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@build_bazel_rules_nodejs//:tools/defaults.bzl", "codeowners", "pkg_npm") -load("@build_bazel_rules_nodejs//tools/stardoc:index.bzl", "stardoc") -load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") - -package(default_visibility = ["//visibility:public"]) - -exports_files(["launcher.js"]) - -codeowners( - teams = ["@mattem"], -) - -bzl_library( - name = "bzl", - srcs = glob(["**/*.bzl"]) + [ - "@bazel_tools//tools:bzl_srcs", - ], - deps = [ - "@bazel_skylib//lib:types", - "@bazel_skylib//rules:common_settings", - "@build_bazel_rules_nodejs//:bzl", - "@build_bazel_rules_nodejs//internal/common:bzl", - "@build_bazel_rules_nodejs//internal/node:bzl", - "@build_bazel_rules_nodejs//toolchains/esbuild:bzl", - "@rules_nodejs//nodejs:bzl", - ], -) - -stardoc( - name = "docs", - testonly = True, - out = "README.md", - input = "index.docs.bzl", - tags = ["fix-windows"], - deps = [":bzl"], -) - -copy_file( - name = "npm_version_check", - src = "//internal:npm_version_check.js", - out = ":npm_version_check.js", -) - -filegroup( - name = "srcs", - srcs = [ - "esbuild.bzl", - "esbuild_config.bzl", - "helpers.bzl", - "index.bzl", - "launcher.js", - "package.json", - ], -) - -pkg_npm( - name = "npm_package", - package_name = "@bazel/esbuild", - srcs = [":srcs"], - build_file_content = """exports_files(["launcher.js"])""", - substitutions = { - "@build_bazel_rules_nodejs//packages/esbuild": "//@bazel/esbuild", - }, - deps = [ - ":README.md", - ":npm_version_check", - ], -)
diff --git a/packages/esbuild/esbuild.bzl b/packages/esbuild/esbuild.bzl deleted file mode 100644 index a02b9cd..0000000 --- a/packages/esbuild/esbuild.bzl +++ /dev/null
@@ -1,477 +0,0 @@ -""" -esbuild rule -""" - -load("@rules_nodejs//nodejs:providers.bzl", "JSModuleInfo", "STAMP_ATTR") -load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") -load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") -load("@build_bazel_rules_nodejs//:providers.bzl", "ExternalNpmPackageInfo", "JSEcmaScriptModuleInfo", "node_modules_aspect", "run_node") -load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "LinkerPackageMappingInfo", "module_mappings_aspect") -load("@build_bazel_rules_nodejs//internal/common:expand_variables.bzl", "expand_variables") -load("@build_bazel_rules_nodejs//toolchains/esbuild:toolchain.bzl", "TOOLCHAIN") -load(":helpers.bzl", "desugar_entry_point_names", "filter_files", "generate_path_mapping", "resolve_entry_point", "write_args_file", "write_jsconfig_file") - -def _esbuild_impl(ctx): - # For each dep, JSEcmaScriptModuleInfo is used if found, then JSModuleInfo and finally - # the DefaultInfo files are used if the former providers are not found. - deps_depsets = [] - - # Path alias mapings are used to create a jsconfig with mappings so that esbuild - # how to resolve custom package or module names - path_alias_mappings = dict() - - for dep in ctx.attr.deps: - if JSEcmaScriptModuleInfo in dep: - deps_depsets.append(dep[JSEcmaScriptModuleInfo].sources) - - if JSModuleInfo in dep: - deps_depsets.append(dep[JSModuleInfo].sources) - elif hasattr(dep, "files"): - deps_depsets.append(dep.files) - - if DefaultInfo in dep: - deps_depsets.append(dep[DefaultInfo].data_runfiles.files) - - if ExternalNpmPackageInfo in dep: - deps_depsets.append(dep[ExternalNpmPackageInfo].sources) - - # Collect the path alias mapping to resolve packages correctly - if LinkerPackageMappingInfo in dep: - for mapping in dep[LinkerPackageMappingInfo].mappings.to_list(): - path_alias_mappings.update( - generate_path_mapping( - mapping.package_name, - mapping.link_path.replace(ctx.bin_dir.path + "/", ""), - ), - ) - - entry_points = desugar_entry_point_names(ctx.file.entry_point, ctx.files.entry_points) - - deps_inputs = depset(transitive = deps_depsets).to_list() - - inputs = deps_inputs + ctx.files.srcs + filter_files(entry_points) - - inputs = [d for d in inputs if not (d.path.endswith(".d.ts") or d.path.endswith(".tsbuildinfo"))] - - outputs = [] - args = dict({ - "bundle": True, - "define": dict([ - [ - k, - expand_variables(ctx, ctx.expand_location(v), attribute_name = "define"), - ] - for k, v in ctx.attr.define.items() - ] + [ - [ - placeholder, - json.encode(setting[BuildSettingInfo].value), - ] - for setting, placeholder in ctx.attr.define_settings.items() - ]), - # the entry point files to bundle - "entryPoints": [ - resolve_entry_point(entry_point, inputs, ctx.files.srcs).path - for entry_point in entry_points - ], - "external": ctx.attr.external, - # by default the log level is "info" and includes an output file summary - # under bazel this is slightly redundant and may lead to spammy logs - # Also disable the log limit and show all logs - "logLevel": "warning", - "logLimit": 0, - "metafile": ctx.attr.metafile, - "platform": ctx.attr.platform, - "preserveSymlinks": True, - "sourcesContent": ctx.attr.sources_content, - "target": ctx.attr.target, - }) - - if len(ctx.attr.sourcemap) > 0: - args.update({"sourcemap": ctx.attr.sourcemap}) - else: - args.update({"sourcemap": True}) - - if ctx.attr.minify: - args.update({"minify": True}) - - if ctx.attr.splitting: - if not ctx.attr.output_dir: - fail("output_dir must be set to True when splitting is set to True") - args.update({ - "format": "esm", - "splitting": True, - }) - - if ctx.attr.format: - args.update({"format": ctx.attr.format}) - - if ctx.attr.output_dir: - js_out = ctx.actions.declare_directory("%s" % ctx.attr.name) - outputs.append(js_out) - - # disable the log limit and show all logs - args.update({ - "outdir": js_out.path, - }) - else: - js_out = ctx.outputs.output - outputs.append(js_out) - - js_out_map = ctx.outputs.output_map - if ctx.attr.sourcemap != "inline": - if js_out_map == None: - fail("output_map must be specified if sourcemap is not set to 'inline'") - outputs.append(js_out_map) - - if ctx.outputs.output_css: - outputs.append(ctx.outputs.output_css) - - args.update({"outfile": js_out.path}) - - jsconfig_file = write_jsconfig_file(ctx, path_alias_mappings) - inputs.append(jsconfig_file) - args.update({"tsconfig": jsconfig_file.path}) - - env = { - "ESBUILD_BINARY_PATH": ctx.toolchains[TOOLCHAIN].binary.path, - } - - if ctx.attr.max_threads > 0: - env["GOMAXPROCS"] = str(ctx.attr.max_threads) - - execution_requirements = {} - if "no-remote-exec" in ctx.attr.tags: - execution_requirements = {"no-remote-exec": "1"} - - # setup the args passed to the launcher - launcher_args = ctx.actions.args() - - args_file = write_args_file(ctx, args) - inputs.append(args_file) - launcher_args.add("--esbuild_args=%s" % args_file.path) - - # add metafile - if ctx.attr.metafile: - meta_file = ctx.actions.declare_file("%s_metadata.json" % ctx.attr.name) - outputs.append(meta_file) - launcher_args.add("--metafile=%s" % meta_file.path) - - # add reference to the users args file, these are merged within the launcher - if ctx.attr.args_json: - user_args_file = ctx.actions.declare_file("%s.user.args.json" % ctx.attr.name) - inputs.append(user_args_file) - ctx.actions.write( - output = user_args_file, - content = ctx.expand_location(ctx.attr.args_json), - ) - launcher_args.add("--user_args=%s" % user_args_file.path) - - if ctx.attr.config: - configs = ctx.attr.config[JSEcmaScriptModuleInfo].sources.to_list() - if len(configs) != 1: - fail("Expected only one source file: the configuration entrypoint") - - inputs.append(configs[0]) - launcher_args.add("--config_file=%s" % configs[0].path) - - run_node( - ctx = ctx, - inputs = depset(inputs), - outputs = outputs, - arguments = [launcher_args], - progress_message = "%s Javascript %s [esbuild]" % ("Bundling" if not ctx.attr.output_dir else "Splitting", " ".join([entry_point.short_path for entry_point in entry_points])), - execution_requirements = execution_requirements, - mnemonic = "esbuild", - env = env, - executable = "launcher", - link_workspace_root = ctx.attr.link_workspace_root, - tools = [ctx.toolchains[TOOLCHAIN].binary], - ) - - outputs_depset = depset(outputs) - - return [ - DefaultInfo( - files = outputs_depset, - ), - JSModuleInfo( - direct_sources = outputs_depset, - sources = outputs_depset, - ), - ] - -esbuild = rule( - attrs = { - "args": attr.string_dict( - default = {}, - doc = """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""", - ), - "args_json": attr.string( - mandatory = False, - doc = "Internal use only", - ), - "define": attr.string_dict( - default = {}, - doc = """A dict of global identifier replacements. Values are subject to $(location ...) expansion. -Example: -```python -esbuild( - name = "bundle", - define = { - "process.env.NODE_ENV": "production" - }, -) -``` - -See https://esbuild.github.io/api/#define for more details - """, - ), - "define_settings": attr.label_keyed_string_dict( - default = {}, - doc = """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.""", - providers = [BuildSettingInfo], - ), - "deps": attr.label_list( - default = [], - aspects = [module_mappings_aspect, node_modules_aspect], - doc = "A list of direct dependencies that are required to build the bundle", - ), - "entry_point": attr.label( - allow_single_file = True, - doc = """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. -""", - ), - "entry_points": attr.label_list( - allow_files = True, - doc = """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. -""", - ), - "external": attr.string_list( - default = [], - doc = """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 - """, - ), - "format": attr.string( - values = ["iife", "cjs", "esm", ""], - mandatory = False, - doc = """The output format of the bundle, defaults to iife when platform is browser -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 - """, - ), - "launcher": attr.label( - mandatory = True, - executable = True, - doc = "Internal use only", - cfg = "exec", - ), - "link_workspace_root": attr.bool( - doc = """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.""", - ), - "max_threads": attr.int( - mandatory = False, - doc = """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. - """, - ), - "metafile": attr.bool( - default = True, - doc = "if true, esbuild creates a metafile along the output", - mandatory = False, - ), - "minify": attr.bool( - default = False, - doc = """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 - """, - ), - "output": attr.output( - mandatory = False, - doc = "Name of the output file when bundling", - ), - "output_css": attr.output( - mandatory = False, - doc = """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": attr.bool( - default = False, - doc = """If true, esbuild produces an output directory containing all output files""", - ), - "output_map": attr.output( - mandatory = False, - doc = "Name of the output source map when bundling", - ), - "platform": attr.string( - default = "browser", - values = ["node", "browser", "neutral", ""], - doc = """The platform to bundle for. - -See https://esbuild.github.io/api/#platform for more details - """, - ), - "sourcemap": attr.string( - values = ["external", "inline", "both", ""], - mandatory = False, - doc = """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 - """, - ), - "sources_content": attr.bool( - mandatory = False, - default = False, - doc = """If False, omits the `sourcesContent` field from generated source maps - -See https://esbuild.github.io/api/#sources-content for more details - """, - ), - "splitting": attr.bool( - default = False, - doc = """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 - """, - ), - "srcs": attr.label_list( - allow_files = True, - default = [], - doc = """Source files to be made available to esbuild""", - ), - "stamp": STAMP_ATTR, - "target": attr.string( - default = "es2015", - doc = """Environment target (e.g. es2017, chrome58, firefox57, safari11, -edge16, node10, esnext). Default es2015. - -See https://esbuild.github.io/api/#target for more details - """, - ), - "config": attr.label( - providers = [JSEcmaScriptModuleInfo], - mandatory = False, - doc = """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. - """, - ), - }, - implementation = _esbuild_impl, - toolchains = [ - str(TOOLCHAIN), - ], - doc = """Runs the esbuild bundler under Bazel - -For further information about esbuild, see https://esbuild.github.io/ - """, -) - -def esbuild_macro(name, output_dir = False, splitting = False, **kwargs): - """esbuild helper macro around the `esbuild_bundle` rule - - For a full list of attributes, see the `esbuild_bundle` rule - - Args: - name: The name used for this rule and output files - output_dir: If `True`, produce an output directory - splitting: If `True`, produce a code split bundle in the output directory - **kwargs: All other args from `esbuild_bundle` - """ - - kwargs.pop("launcher", None) - _launcher = "_%s_esbuild_launcher" % name - nodejs_binary( - name = _launcher, - entry_point = Label("@build_bazel_rules_nodejs//packages/esbuild:launcher.js"), - ) - - srcs = kwargs.pop("srcs", []) - deps = kwargs.pop("deps", []) + ["@esbuild_npm//esbuild"] - entry_points = kwargs.get("entry_points", None) - - # TODO(mattem): remove `args` and `args_json` in 5.x and everything can go via `config` - args_json = kwargs.pop("args_json", None) - if args_json: - fail("Setting 'args_json' is not supported, set 'config' instead") - - args = kwargs.pop("args", {}) - if args: - if type(args) != type(dict()): - fail("Expected 'args' to be of type dict") - - args_json = json.encode(args) - - config = kwargs.pop("config", None) - if config: - kwargs.setdefault("config", config) - deps.append("%s_deps" % config) - - if output_dir == True or entry_points or splitting == True: - esbuild( - name = name, - srcs = srcs, - splitting = splitting, - output_dir = True, - args_json = args_json, - launcher = _launcher, - deps = deps, - **kwargs - ) - else: - output = "%s.js" % name - if "output" in kwargs: - output = kwargs.pop("output") - - output_map = None - sourcemap = kwargs.get("sourcemap", None) - if sourcemap != "inline": - output_map = "%s.map" % output - - esbuild( - name = name, - srcs = srcs, - args_json = args_json, - output = output, - output_map = output_map, - launcher = _launcher, - deps = deps, - **kwargs - )
diff --git a/packages/esbuild/esbuild_config.bzl b/packages/esbuild/esbuild_config.bzl deleted file mode 100644 index a19948e..0000000 --- a/packages/esbuild/esbuild_config.bzl +++ /dev/null
@@ -1,27 +0,0 @@ -"esbuild configuration file helper macro" - -load("@build_bazel_rules_nodejs//:index.bzl", _js_library = "js_library") - -def esbuild_config(name, config_file, srcs = [], deps = [], **kwargs): - """Macro for an esbuild configuration file and its assoicated dependencies - - Args: - name: Unique name for this rule - config_file: The configuration file / entrypoint - srcs: List of source files referenced by the configuration - deps: List of dependencies required for this configuration - **kwargs: Any other common attributes - """ - - _js_library( - name = name, - srcs = [config_file], - **kwargs - ) - - _js_library( - name = "%s_deps" % name, - srcs = srcs, - deps = deps, - **kwargs - )
diff --git a/packages/esbuild/helpers.bzl b/packages/esbuild/helpers.bzl deleted file mode 100644 index db8286b..0000000 --- a/packages/esbuild/helpers.bzl +++ /dev/null
@@ -1,159 +0,0 @@ -""" -Utility helper functions for the esbuild rule -""" - -load("@bazel_skylib//lib:paths.bzl", "paths") - -TS_EXTENSIONS = ["ts", "tsx"] -JS_EXTENSIONS = ["js", "jsx", "mjs"] -ALLOWED_EXTENSIONS = JS_EXTENSIONS + TS_EXTENSIONS - -def strip_ext(f): - "Strips the extension of a file." - return f.short_path[:-len(f.extension) - 1] - -def resolve_entry_point(f, inputs, srcs): - """Find a corresponding entrypoint for a provided file - - Args: - f: The file where its basename is used to match the entrypoint - inputs: The list of all inputs - srcs: List of direct src files to check - - Returns: - Returns the file that is the corresponding entrypoint - """ - - no_ext = strip_ext(f) - - for i in inputs: - if i.extension in ALLOWED_EXTENSIONS: - if strip_ext(i) == no_ext: - return i - - for i in srcs: - if i.extension in ALLOWED_EXTENSIONS: - if strip_ext(i) == no_ext: - return i - - fail("Could not find corresponding entry point for %s. Add the %s.js to your deps or %s.ts to your srcs" % (f.path, no_ext, no_ext)) - -def desugar_entry_point_names(entry_point, entry_points): - """Users can specify entry_point (sugar) or entry_points (long form). - - This function allows our code to treat it like they always used the long form. - - It also validates that exactly one of these attributes should be specified. - - Args: - entry_point: the simple argument for specifying a single entry - entry_points: the long form argument for specifing one or more entry points - - Returns: - the array of entry poitns - """ - if entry_point and entry_points: - fail("Cannot specify both entry_point and entry_points") - if not entry_point and not entry_points: - fail("One of entry_point or entry_points must be specified") - if entry_point: - return [entry_point] - return entry_points - -def filter_files(input, endings = ALLOWED_EXTENSIONS): - """Filters a list of files for specific endings - - Args: - input: The depset or list of files - endings: The list of endings that should be filtered for - - Returns: - Returns the filtered list of files - """ - - # Convert input into list regardles of being a depset or list - input_list = input.to_list() if type(input) == "depset" else input - filtered = [] - - for file in input_list: - for ending in endings: - if file.path.endswith("." + ending): - filtered.append(file) - continue - - return filtered - -def generate_path_mapping(package_name, path): - """Generate a path alias mapping for a jsconfig.json - - For example: {"@my-alias/*": [ "path/to/my-alias/*" ]}, - - Args: - package_name: The module name - path: The base path of the package - """ - - pkg = {} - - # entry for the barrel files favor mjs over normal as it results - # in smaller bundles - pkg[package_name] = [ - path + "/index.mjs", - path, - ] - - # A glob import for deep package imports - pkg[package_name + "/*"] = [path + "/*"] - - return pkg - -def write_jsconfig_file(ctx, path_alias_mappings): - """Writes the js config file for the path alias mappings. - - Args: - ctx: The rule context - path_alias_mappings: Dict with the mappings - - Returns: - File object reference for the jsconfig file - """ - - # The package path, including an "external/repo_name/" prefix if the package is in - # an external repo. - rule_path = paths.join(ctx.label.workspace_root, paths.dirname(ctx.build_file_path)) - - # Replace all segments in the path with .. join them with "/" and postfix - # it with another / to get a relative path from the build file dir - # to the workspace root. - if len(rule_path) == 0: - base_url_path = "." - else: - base_url_path = "/".join([".." for segment in rule_path.split("/")]) + "/" - - # declare the jsconfig_file - jsconfig_file = ctx.actions.declare_file("%s.config.json" % ctx.attr.name) - - jsconfig = struct( - compilerOptions = struct( - rootDirs = ["."], - baseUrl = base_url_path, - paths = path_alias_mappings, - ), - ) - - # write the config file - ctx.actions.write( - output = jsconfig_file, - content = json.encode(jsconfig), - ) - - return jsconfig_file - -def write_args_file(ctx, args): - args_file = ctx.actions.declare_file("%s.args.json" % ctx.attr.name) - ctx.actions.write( - output = args_file, - content = json.encode(args), - ) - - return args_file
diff --git a/packages/esbuild/index.bzl b/packages/esbuild/index.bzl deleted file mode 100644 index e9f5b7a..0000000 --- a/packages/esbuild/index.bzl +++ /dev/null
@@ -1,33 +0,0 @@ -# Copyright 2020 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Public API surface is re-exported here. -""" - -load( - "@build_bazel_rules_nodejs//packages/esbuild:esbuild.bzl", - _esbuild_macro = "esbuild_macro", -) -load( - "@build_bazel_rules_nodejs//packages/esbuild:esbuild_config.bzl", - _esbuild_config = "esbuild_config", -) -load( - "@build_bazel_rules_nodejs//toolchains/esbuild:toolchain.bzl", - _configure_esbuild_toolchain = "configure_esbuild_toolchain", -) - -esbuild = _esbuild_macro -esbuild_config = _esbuild_config -configure_esbuild_toolchain = _configure_esbuild_toolchain
diff --git a/packages/esbuild/index.docs.bzl b/packages/esbuild/index.docs.bzl deleted file mode 100644 index a259277..0000000 --- a/packages/esbuild/index.docs.bzl +++ /dev/null
@@ -1,114 +0,0 @@ -""" -# 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`. - -``` -npm install --save-dev @bazel/esbuild -``` -or using yarn -``` -yarn add -D @bazel/esbuild -``` - -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 -npm_install( - name = "npm", - # @bazel/esbuild is a dependency in this package.json - package_json = "//:package.json", - package_lock_json = "//:package-lock.json", -) - -load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories") - -esbuild_repositories(npm_repository = "npm") -``` - -> 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. - -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. - -## 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("//packages/esbuild:index.bzl", "esbuild") -load("//packages/typescript:index.bzl", "ts_project") - -ts_project( - 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. - -```python -load("//packages/esbuild:index.bzl", "esbuild") -load("//packages/typescript:index.bzl", "ts_project") - -ts_project( - 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 -""" - -load( - "@build_bazel_rules_nodejs//packages/esbuild:esbuild.bzl", - _esbuild = "esbuild", -) -load( - "@build_bazel_rules_nodejs//packages/esbuild:esbuild_config.bzl", - _esbuild_config = "esbuild_config", -) -load( - "@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", - _esbuild_repositories = "esbuild_repositories", -) -load( - "@build_bazel_rules_nodejs//toolchains/esbuild:toolchain.bzl", - _configure_esbuild_toolchain = "configure_esbuild_toolchain", -) - -esbuild = _esbuild -esbuild_config = _esbuild_config -esbuild_repositories = _esbuild_repositories -configure_esbuild_toolchain = _configure_esbuild_toolchain
diff --git a/packages/esbuild/launcher.js b/packages/esbuild/launcher.js deleted file mode 100755 index cd0e606..0000000 --- a/packages/esbuild/launcher.js +++ /dev/null
@@ -1,127 +0,0 @@ -const {readFileSync, writeFileSync} = require('fs'); -const {pathToFileURL} = require('url'); -const {join} = require('path'); -const esbuild = require('esbuild'); - -function getFlag(flag, required = true) { - const argvFlag = process.argv.find(arg => arg.startsWith(`${flag}=`)); - if (!argvFlag) { - if (required) { - console.error(`Expected flag '${flag}' passed to launcher, but not found`); - process.exit(1); - } - return - } - return argvFlag.split('=')[1]; -} - -function getEsbuildArgs(paramsFilePath) { - try { - return JSON.parse(readFileSync(paramsFilePath, {encoding: 'utf8'})); - } catch (e) { - console.error('Error while reading esbuild flags param file', e); - process.exit(1); - } -} - -async function processConfigFile(configFilePath, existingArgs = {}) { - const fullConfigFileUrl = pathToFileURL(join(process.cwd(), configFilePath)); - let config; - try { - config = await import(fullConfigFileUrl); - } catch (e) { - console.error(`Error while loading configuration '${fullConfigFileUrl}':\n`, e); - process.exit(1); - } - - if (!config.default) { - console.error(`Config file '${configFilePath}' was loaded, but did not export a configuration object as default`); - process.exit(1); - } - - config = config.default; - - // These keys of the config can not be overriden - const IGNORED_CONFIG_KEYS = [ - 'bundle', - 'entryPoints', - 'external', - 'metafile', - 'outdir', - 'outfile', - 'preserveSymlinks', - 'sourcemap', - 'splitting', - 'tsconfig', - ]; - - const MERGE_CONFIG_KEYS = [ - 'define', - ]; - - return Object.entries(config).reduce((prev, [key, value]) => { - if (value === null || value === void 0) { - return prev; - } - - if (IGNORED_CONFIG_KEYS.includes(key)) { - console.error(`[WARNING] esbuild configuration property '${key}' from '${configFilePath}' will be ignored and overriden`); - } else if (MERGE_CONFIG_KEYS.includes(key) && existingArgs.hasOwnProperty(key)) { - // values from the rule override the config file - // perform a naive merge - if (Array.isArray(value)) { - prev[key] = [...value, ...existingArgs[key]]; - } else if (typeof value === 'object') { - prev[key] = { - ...value, - ...existingArgs[key], - } - } else { - // can't merge - console.error(`[WARNING] esbuild configuration property '${key}' from '${configFilePath}' could not be merged`); - } - } else { - prev[key] = value; - } - return prev; - }, {}); -} - -if (!process.env.ESBUILD_BINARY_PATH) { - console.error('Expected enviournment variable ESBUILD_BINARY_PATH to be set', e); - process.exit(1); -} - -async function runOneBuild(args, userArgsFilePath, configFilePath) { - if (userArgsFilePath) { - args = { - ...args, - ...getEsbuildArgs(userArgsFilePath) - } - } - - if (configFilePath) { - const config = await processConfigFile(configFilePath, args); - args = { - ...args, - ...config - }; - } - - try { - const result = await esbuild.build(args); - if (result.metafile) { - const metafile = getFlag('--metafile'); - writeFileSync(metafile, JSON.stringify(result.metafile)); - } - } catch (e) { - console.error(e); - process.exit(1); - } -} - -runOneBuild( - getEsbuildArgs(getFlag("--esbuild_args")), - getFlag("--user_args", false), - getFlag("--config_file", false) -);
diff --git a/packages/esbuild/package.json b/packages/esbuild/package.json deleted file mode 100644 index 88ed00a..0000000 --- a/packages/esbuild/package.json +++ /dev/null
@@ -1,20 +0,0 @@ -{ - "name": "@bazel/esbuild", - "description": "esbuild rules for Bazel", - "license": "Apache-2.0", - "version": "0.0.0-PLACEHOLDER", - "repository": { - "type": "git", - "url": "https://github.com/bazelbuild/rules_nodejs.git", - "directory": "packages/esbuild" - }, - "bugs": { - "url": "https://github.com/bazelbuild/rules_nodejs/issues" - }, - "keywords": [ - "bazel" - ], - "scripts": { - "postinstall": "node npm_version_check.js" - } -}
diff --git a/packages/esbuild/test/BUILD.bazel b/packages/esbuild/test/BUILD.bazel deleted file mode 100644 index e69de29..0000000 --- a/packages/esbuild/test/BUILD.bazel +++ /dev/null
diff --git a/packages/esbuild/test/alias-mapping/BUILD.bazel b/packages/esbuild/test/alias-mapping/BUILD.bazel deleted file mode 100644 index 1e1e6a1..0000000 --- a/packages/esbuild/test/alias-mapping/BUILD.bazel +++ /dev/null
@@ -1,32 +0,0 @@ -load("//:index.bzl", "generated_file_test") -load("//packages/esbuild:index.bzl", "esbuild") - -esbuild( - name = "bundle", - args = { - "keepNames": True, - }, - entry_point = "main.js", - format = "esm", - deps = [ - "//packages/esbuild/test/alias-mapping/module-one", - "//packages/esbuild/test/alias-mapping/module-two", - ], -) - -# esbuild will put the filepath in a comment within the non-minified file, -# on different platforms this will cause the golden test to differ -# strip them here -# note that this regex doesn't strip the sourcemap URI comment -genrule( - name = "strip_bundle_comments", - srcs = ["bundle.js"], - outs = ["bundle.stripped.js"], - cmd = "cat $(location :bundle.js) | sed \"s#// .*##\" > $@", -) - -generated_file_test( - name = "bundle_test", - src = "bundle.golden.txt", - generated = "bundle.stripped.js", -)
diff --git a/packages/esbuild/test/alias-mapping/bundle.golden.txt b/packages/esbuild/test/alias-mapping/bundle.golden.txt deleted file mode 100644 index a5c937b..0000000 --- a/packages/esbuild/test/alias-mapping/bundle.golden.txt +++ /dev/null
@@ -1,15 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); - - -var getId = /* @__PURE__ */ __name(() => "module-one", "getId"); - - -var getId2 = /* @__PURE__ */ __name(() => "module-two", "getId"); - - -var main_default = `Full ID: ${getId} - ${getId2}`; -export { - main_default as default -}; -//# sourceMappingURL=bundle.js.map
diff --git a/packages/esbuild/test/alias-mapping/main.js b/packages/esbuild/test/alias-mapping/main.js deleted file mode 100644 index 21a284e..0000000 --- a/packages/esbuild/test/alias-mapping/main.js +++ /dev/null
@@ -1,4 +0,0 @@ -import {getId as m1Id} from '@alias-mapping/module-one'; -import {getId as m2Id} from '@alias-mapping/module-two'; - -export default `Full ID: ${m1Id} - ${m2Id}`;
diff --git a/packages/esbuild/test/alias-mapping/module-one/BUILD.bazel b/packages/esbuild/test/alias-mapping/module-one/BUILD.bazel deleted file mode 100644 index 1ecff9c..0000000 --- a/packages/esbuild/test/alias-mapping/module-one/BUILD.bazel +++ /dev/null
@@ -1,9 +0,0 @@ -load("//internal/js_library:js_library.bzl", "js_library") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -js_library( - name = "module-one", - package_name = "@alias-mapping/module-one", - srcs = [":index.js"], -)
diff --git a/packages/esbuild/test/alias-mapping/module-one/index.js b/packages/esbuild/test/alias-mapping/module-one/index.js deleted file mode 100644 index be8c740..0000000 --- a/packages/esbuild/test/alias-mapping/module-one/index.js +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'module-one';
diff --git a/packages/esbuild/test/alias-mapping/module-two/BUILD.bazel b/packages/esbuild/test/alias-mapping/module-two/BUILD.bazel deleted file mode 100644 index 6927d4c..0000000 --- a/packages/esbuild/test/alias-mapping/module-two/BUILD.bazel +++ /dev/null
@@ -1,9 +0,0 @@ -load("//internal/js_library:js_library.bzl", "js_library") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -js_library( - name = "module-two", - package_name = "@alias-mapping/module-two", - srcs = [":index.js"], -)
diff --git a/packages/esbuild/test/alias-mapping/module-two/index.js b/packages/esbuild/test/alias-mapping/module-two/index.js deleted file mode 100644 index 4fa9280..0000000 --- a/packages/esbuild/test/alias-mapping/module-two/index.js +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'module-two';
diff --git a/packages/esbuild/test/banner/BUILD.bazel b/packages/esbuild/test/banner/BUILD.bazel deleted file mode 100644 index 44156a5..0000000 --- a/packages/esbuild/test/banner/BUILD.bazel +++ /dev/null
@@ -1,66 +0,0 @@ -load("//:index.bzl", "generated_file_test") -load("//packages/esbuild:index.bzl", "esbuild") - -esbuild( - name = "banner", - args = { - "banner": { - "js": "//hello", - }, - }, - entry_point = "main.js", -) - -esbuild( - name = "banner_newline", - args = { - "banner": { - "js": "//header\n//comments", - }, - }, - entry_point = "main.js", -) - -esbuild( - name = "banner_quotes", - args = { - "banner": { - "js": "\"use strict\"", - }, - }, - entry_point = "main.js", -) - -esbuild( - name = "banner_spaces", - args = { - "banner": { - "js": "#!/usr/bin/env node", - }, - }, - entry_point = "main.js", -) - -generated_file_test( - name = "banner_test", - src = "banner.golden.txt", - generated = "banner.js", -) - -generated_file_test( - name = "banner_newline_test", - src = "banner.newline.golden.txt", - generated = "banner_newline.js", -) - -generated_file_test( - name = "banner_quotes_test", - src = "banner.quotes.golden.txt", - generated = "banner_quotes.js", -) - -generated_file_test( - name = "banner_spaces_test", - src = "banner.spaces.golden.txt", - generated = "banner_spaces.js", -)
diff --git a/packages/esbuild/test/banner/banner.golden.txt b/packages/esbuild/test/banner/banner.golden.txt deleted file mode 100644 index 2df842e..0000000 --- a/packages/esbuild/test/banner/banner.golden.txt +++ /dev/null
@@ -1,6 +0,0 @@ -//hello -(() => { - // packages/esbuild/test/banner/main.js - console.log("a script"); -})(); -//# sourceMappingURL=banner.js.map
diff --git a/packages/esbuild/test/banner/banner.newline.golden.txt b/packages/esbuild/test/banner/banner.newline.golden.txt deleted file mode 100644 index 6bb0218..0000000 --- a/packages/esbuild/test/banner/banner.newline.golden.txt +++ /dev/null
@@ -1,7 +0,0 @@ -//header -//comments -(() => { - // packages/esbuild/test/banner/main.js - console.log("a script"); -})(); -//# sourceMappingURL=banner_newline.js.map
diff --git a/packages/esbuild/test/banner/banner.quotes.golden.txt b/packages/esbuild/test/banner/banner.quotes.golden.txt deleted file mode 100644 index b4290b5..0000000 --- a/packages/esbuild/test/banner/banner.quotes.golden.txt +++ /dev/null
@@ -1,6 +0,0 @@ -"use strict" -(() => { - // packages/esbuild/test/banner/main.js - console.log("a script"); -})(); -//# sourceMappingURL=banner_quotes.js.map
diff --git a/packages/esbuild/test/banner/banner.spaces.golden.txt b/packages/esbuild/test/banner/banner.spaces.golden.txt deleted file mode 100644 index c4b4a2d..0000000 --- a/packages/esbuild/test/banner/banner.spaces.golden.txt +++ /dev/null
@@ -1,6 +0,0 @@ -#!/usr/bin/env node -(() => { - // packages/esbuild/test/banner/main.js - console.log("a script"); -})(); -//# sourceMappingURL=banner_spaces.js.map
diff --git a/packages/esbuild/test/banner/main.js b/packages/esbuild/test/banner/main.js deleted file mode 100644 index 0e273ec..0000000 --- a/packages/esbuild/test/banner/main.js +++ /dev/null
@@ -1 +0,0 @@ -console.log("a script"); \ No newline at end of file
diff --git a/packages/esbuild/test/js-library/BUILD.bazel b/packages/esbuild/test/js-library/BUILD.bazel deleted file mode 100644 index 9550962..0000000 --- a/packages/esbuild/test/js-library/BUILD.bazel +++ /dev/null
@@ -1,41 +0,0 @@ -load("//:index.bzl", "generated_file_test", "js_library", "nodejs_binary", "npm_package_bin") -load("//packages/esbuild:index.bzl", "esbuild") - -js_library( - name = "lib", - srcs = ["lib.jsx"], -) - -js_library( - name = "main", - srcs = ["main.js"], - deps = [":lib"], -) - -esbuild( - name = "bundle", - entry_point = "main.js", - deps = [ - ":main", - ], -) - -nodejs_binary( - name = "bin", - data = [ - ":bundle", - ], - entry_point = "bundle.js", -) - -npm_package_bin( - name = "runner", - stdout = "out.txt", - tool = ":bin", -) - -generated_file_test( - name = "test", - src = "out.golden.txt", - generated = "out.txt", -)
diff --git a/packages/esbuild/test/js-library/lib.jsx b/packages/esbuild/test/js-library/lib.jsx deleted file mode 100644 index df4f3fb..0000000 --- a/packages/esbuild/test/js-library/lib.jsx +++ /dev/null
@@ -1 +0,0 @@ -export const NAME = 'rules_nodejs'; \ No newline at end of file
diff --git a/packages/esbuild/test/js-library/main.js b/packages/esbuild/test/js-library/main.js deleted file mode 100644 index c3648e3..0000000 --- a/packages/esbuild/test/js-library/main.js +++ /dev/null
@@ -1,3 +0,0 @@ -import {NAME as name} from './lib'; - -console.log(name); \ No newline at end of file
diff --git a/packages/esbuild/test/js-library/out.golden.txt b/packages/esbuild/test/js-library/out.golden.txt deleted file mode 100644 index 0c23e83..0000000 --- a/packages/esbuild/test/js-library/out.golden.txt +++ /dev/null
@@ -1 +0,0 @@ -rules_nodejs
diff --git a/packages/esbuild/test/metafile/BUILD.bazel b/packages/esbuild/test/metafile/BUILD.bazel deleted file mode 100644 index 79c679e..0000000 --- a/packages/esbuild/test/metafile/BUILD.bazel +++ /dev/null
@@ -1,24 +0,0 @@ -load("//packages/esbuild:index.bzl", "esbuild") - -esbuild( - name = "lib", - srcs = [ - ":main.js", - ], - entry_point = "main.js", - metafile = False, -) - -sh_test( - name = "test", - size = "small", - srcs = [ - "test.sh", - ], - args = [ - "$(locations :lib)", - ], - data = [ - ":lib", - ], -)
diff --git a/packages/esbuild/test/metafile/main.js b/packages/esbuild/test/metafile/main.js deleted file mode 100644 index e69de29..0000000 --- a/packages/esbuild/test/metafile/main.js +++ /dev/null
diff --git a/packages/esbuild/test/metafile/test.sh b/packages/esbuild/test/metafile/test.sh deleted file mode 100755 index fc39fd9..0000000 --- a/packages/esbuild/test/metafile/test.sh +++ /dev/null
@@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -uo pipefail; - -while [ "$#" -ne 0 ]; do - [[ "lib_metadata.json" == "$(basename $1)" ]] && exit 1; - shift; -done
diff --git a/packages/esbuild/test/node/BUILD.bazel b/packages/esbuild/test/node/BUILD.bazel deleted file mode 100644 index b2a25e7..0000000 --- a/packages/esbuild/test/node/BUILD.bazel +++ /dev/null
@@ -1,39 +0,0 @@ -load("//:index.bzl", "generated_file_test", "nodejs_binary", "npm_package_bin") -load("//packages/esbuild:index.bzl", "esbuild") - -esbuild( - name = "bundle", - # JS sources can be set directly on the esbuild rule - srcs = [ - "env.js", - "main.js", - ], - entry_point = "main.js", - # Setting this to test the code path - # This isn't needed for this bundle to run - max_threads = 1, - platform = "node", -) - -nodejs_binary( - name = "bin", - data = [ - ":bundle", - ], - entry_point = "bundle.js", -) - -npm_package_bin( - name = "runner", - env = { - "ESBUILD_TEST": "YES", - }, - stdout = "out.txt", - tool = ":bin", -) - -generated_file_test( - name = "test", - src = "out.golden.txt", - generated = "out.txt", -)
diff --git a/packages/esbuild/test/node/env.js b/packages/esbuild/test/node/env.js deleted file mode 100644 index bb1a68e..0000000 --- a/packages/esbuild/test/node/env.js +++ /dev/null
@@ -1,3 +0,0 @@ -export function getEnvVars() { - return process.env; -}
diff --git a/packages/esbuild/test/node/main.js b/packages/esbuild/test/node/main.js deleted file mode 100644 index 6960524..0000000 --- a/packages/esbuild/test/node/main.js +++ /dev/null
@@ -1,6 +0,0 @@ -const {get} = require('https'); -const {getEnvVars} = require('./env'); - -const ESBUILD_TEST = getEnvVars().ESBUILD_TEST; - -console.log(`ESBUILD_TEST=${ESBUILD_TEST}`); \ No newline at end of file
diff --git a/packages/esbuild/test/node/out.golden.txt b/packages/esbuild/test/node/out.golden.txt deleted file mode 100644 index 4814c8a..0000000 --- a/packages/esbuild/test/node/out.golden.txt +++ /dev/null
@@ -1 +0,0 @@ -ESBUILD_TEST=YES
diff --git a/packages/esbuild/test/plugins/BUILD.bazel b/packages/esbuild/test/plugins/BUILD.bazel deleted file mode 100644 index d2d8b16..0000000 --- a/packages/esbuild/test/plugins/BUILD.bazel +++ /dev/null
@@ -1,57 +0,0 @@ -load("//:index.bzl", "generated_file_test", "js_library", "nodejs_binary", "npm_package_bin") -load("//packages/esbuild:index.bzl", "esbuild") -load("//packages/esbuild:esbuild_config.bzl", "esbuild_config") - -js_library( - name = "main", - srcs = [ - "logo.svg", - "main.js", - "words.txt", - ], -) - -js_library( - name = "txt_array_plugin", - srcs = [ - "txt-array-plugin.js", - ], -) - -esbuild_config( - name = "esbuild_config", - config_file = "esbuild.config.mjs", - deps = [ - ":txt_array_plugin", - "@npm//esbuild-plugin-svg", - ], -) - -esbuild( - name = "bundle", - config = ":esbuild_config", - entry_point = "main.js", - deps = [ - ":main", - ], -) - -nodejs_binary( - name = "bin", - data = [ - ":bundle", - ], - entry_point = "bundle.js", -) - -npm_package_bin( - name = "runner", - stdout = "out.txt", - tool = ":bin", -) - -generated_file_test( - name = "test", - src = "out.golden.txt", - generated = "out.txt", -)
diff --git a/packages/esbuild/test/plugins/esbuild.config.mjs b/packages/esbuild/test/plugins/esbuild.config.mjs deleted file mode 100644 index 7284434..0000000 --- a/packages/esbuild/test/plugins/esbuild.config.mjs +++ /dev/null
@@ -1,9 +0,0 @@ -import { default as txtArrayPlugin } from './txt-array-plugin.js'; -import { default as svgPlugin } from 'esbuild-plugin-svg'; - -export default { - plugins: [ - txtArrayPlugin, - svgPlugin(), - ], -}
diff --git a/packages/esbuild/test/plugins/logo.svg b/packages/esbuild/test/plugins/logo.svg deleted file mode 100644 index 2f64936..0000000 --- a/packages/esbuild/test/plugins/logo.svg +++ /dev/null
@@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> - <g> - <circle fill="#FFCF00" cx="128" cy="128" r="128"></circle> - <path d="M69.2852814,58.7147186 L138.570563,128 L69.2852814,197.285281 L52.3147186,180.314719 L104.629,128 L52.3147186,75.6852814 L69.2852814,58.7147186 Z M146.085281,58.7147186 L215.370563,128 L146.085281,197.285281 L129.114719,180.314719 L181.429,128 L129.114719,75.6852814 L146.085281,58.7147186 Z" fill="#191919"></path> - </g> -</svg> \ No newline at end of file
diff --git a/packages/esbuild/test/plugins/main.js b/packages/esbuild/test/plugins/main.js deleted file mode 100644 index a2f858e..0000000 --- a/packages/esbuild/test/plugins/main.js +++ /dev/null
@@ -1,10 +0,0 @@ -// The example esbuild plugin loads the txt file and splits on each word. -// 'words' results in an array of the words from the txt file. -import { default as words } from './words.txt'; - -// The SVG plugin loads the svg and sets the file contents to the 'logo' symbol -import logo from './logo.svg'; - -console.log(words); - -console.log(logo);
diff --git a/packages/esbuild/test/plugins/out.golden.txt b/packages/esbuild/test/plugins/out.golden.txt deleted file mode 100644 index bc45595..0000000 --- a/packages/esbuild/test/plugins/out.golden.txt +++ /dev/null
@@ -1,8 +0,0 @@ -[ 'foo', 'bar', 'rules_nodejs' ] -<?xml version="1.0" encoding="UTF-8"?> -<svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> - <g> - <circle fill="#FFCF00" cx="128" cy="128" r="128"></circle> - <path d="M69.2852814,58.7147186 L138.570563,128 L69.2852814,197.285281 L52.3147186,180.314719 L104.629,128 L52.3147186,75.6852814 L69.2852814,58.7147186 Z M146.085281,58.7147186 L215.370563,128 L146.085281,197.285281 L129.114719,180.314719 L181.429,128 L129.114719,75.6852814 L146.085281,58.7147186 Z" fill="#191919"></path> - </g> -</svg>
diff --git a/packages/esbuild/test/plugins/txt-array-plugin.js b/packages/esbuild/test/plugins/txt-array-plugin.js deleted file mode 100644 index 3bd85a8..0000000 --- a/packages/esbuild/test/plugins/txt-array-plugin.js +++ /dev/null
@@ -1,15 +0,0 @@ -const fs = require('fs'); - -module.exports = { - name: 'txt', - setup(build) { - // Load ".txt" files and return an array of words - build.onLoad({ filter: /\.txt$/ }, async (args) => { - const text = await fs.promises.readFile(args.path, 'utf8'); - return { - contents: JSON.stringify(text.split(/\s+/)), - loader: 'json', - } - }); - }, -};
diff --git a/packages/esbuild/test/plugins/words.txt b/packages/esbuild/test/plugins/words.txt deleted file mode 100644 index 969afa9..0000000 --- a/packages/esbuild/test/plugins/words.txt +++ /dev/null
@@ -1 +0,0 @@ -foo bar rules_nodejs \ No newline at end of file
diff --git a/packages/esbuild/test/sourcemap/BUILD.bazel b/packages/esbuild/test/sourcemap/BUILD.bazel deleted file mode 100644 index 698f16c..0000000 --- a/packages/esbuild/test/sourcemap/BUILD.bazel +++ /dev/null
@@ -1,82 +0,0 @@ -load("//packages/esbuild:index.bzl", "esbuild") -load("//packages/jasmine:index.bzl", "jasmine_node_test") -load("//packages/typescript:index.bzl", "ts_project") - -ts_project( - name = "main", - srcs = [ - "main.ts", - ], - tsconfig = { - "compilerOptions": { - "sourceMap": True, - "inlineSourceMap": False, - "inlineSources": True, - }, - }, - deps = [ - "@npm//@types/node", - ], -) - -esbuild( - name = "bundle_default", - args = { - "keepNames": True, - }, - entry_point = "main.ts", - deps = [":main"], -) - -esbuild( - name = "bundle_sources_content", - args = { - "keepNames": True, - }, - entry_point = "main.ts", - sourcemap = "", - sources_content = True, - deps = [":main"], -) - -esbuild( - name = "bundle_inline", - args = { - "keepNames": True, - }, - entry_point = "main.ts", - sourcemap = "inline", - deps = [":main"], -) - -esbuild( - name = "bundle_external", - args = { - "keepNames": True, - }, - entry_point = "main.ts", - sourcemap = "external", - deps = [":main"], -) - -esbuild( - name = "bundle_both", - args = { - "keepNames": True, - }, - entry_point = "main.ts", - sourcemap = "both", - deps = [":main"], -) - -jasmine_node_test( - name = "bundle_test", - srcs = ["bundle_test.js"], - data = [ - ":bundle_both", - ":bundle_default", - ":bundle_external", - ":bundle_inline", - ":bundle_sources_content", - ], -)
diff --git a/packages/esbuild/test/sourcemap/bundle_test.js b/packages/esbuild/test/sourcemap/bundle_test.js deleted file mode 100644 index 04e56b2..0000000 --- a/packages/esbuild/test/sourcemap/bundle_test.js +++ /dev/null
@@ -1,73 +0,0 @@ -const {readFileSync, exists} = require('fs'); -const path = require('path'); - -const helper = require(process.env.BAZEL_NODE_RUNFILES_HELPER); -const locationBase = 'build_bazel_rules_nodejs/packages/esbuild/test/sourcemap/'; - -// Location for :bundle_default -const bundleDefaultLocation = helper.resolve(path.join(locationBase, 'bundle_default.js')); -const bundleDefaultSourcemapLocation = - helper.resolve(path.join(locationBase, 'bundle_default.js.map')); - -// Location for :bundle_sources_content -const bundleSourcesContentLocation = - helper.resolve(path.join(locationBase, 'bundle_sources_content.js.map')); - -// Location for :bundle_inline -const bundleInlineLocation = helper.resolve(path.join(locationBase, 'bundle_inline.js')); - -// Location for :bundle_external -const bundleExternalLocation = helper.resolve(path.join(locationBase, 'bundle_external.js')); -const bundleExternalSourcemapLocation = - helper.resolve(path.join(locationBase, 'bundle_external.js.map')); - -// Location for :bundle_both -const bundleBothLocation = helper.resolve(path.join(locationBase, 'bundle_both.js')); -const bundleBothSourcemapLocation = helper.resolve(path.join(locationBase, 'bundle_both.js.map')); - -describe('esbuild sourcemap', () => { - it('creates an external sourcemap by default', () => { - const sourcemap = readFileSync(bundleDefaultSourcemapLocation, {encoding: 'utf8'}); - expect(sourcemap).toContain( - '"sources": ["../../../../../../../packages/esbuild/test/sourcemap/main.ts"]'); - }); - - it('does not inline the sourcemap by default', () => { - const bundle = readFileSync(bundleDefaultLocation, {encoding: 'utf8'}); - expect(bundle).toContain('//# sourceMappingURL=bundle_default.js.map'); - }); - - it('inlines source in sourcemap when sources_content = True', () => { - const sourcemap = readFileSync(bundleSourcesContentLocation, {encoding: 'utf8'}); - expect(sourcemap).toContain( - '"sources": ["../../../../../../../packages/esbuild/test/sourcemap/main.ts"]'); - expect(sourcemap).toContain("foo: Foo"); - }); - - it('inlines the sourcemap when set to \'inline\'', () => { - const bundle = readFileSync(bundleInlineLocation, {encoding: 'utf8'}); - expect(bundle).toContain('//# sourceMappingURL=data:application/json;base64'); - }); - - it('has no sourcemap comment when set to \'external\'', () => { - const bundle = readFileSync(bundleExternalLocation, {encoding: 'utf8'}); - expect(bundle).not.toContain('//# sourceMappingURL='); - }); - - it('creates an external sourcemap when set to \'external\'', () => { - const sourcemap = readFileSync(bundleExternalSourcemapLocation, {encoding: 'utf8'}); - expect(sourcemap).toContain( - '"sources": ["../../../../../../../packages/esbuild/test/sourcemap/main.ts"]'); - }); - - it('inlines the sourcemap when set to \'both\'', () => { - const bundle = readFileSync(bundleBothLocation, {encoding: 'utf8'}); - expect(bundle).toContain('//# sourceMappingURL=data:application/json;base64'); - }); - - it('creates an external sourcemap when set to \'both\'', () => { - const sourcemap = readFileSync(bundleBothSourcemapLocation, {encoding: 'utf8'}); - expect(sourcemap).toContain( - '"sources": ["../../../../../../../packages/esbuild/test/sourcemap/main.ts"]'); - }); -})
diff --git a/packages/esbuild/test/sourcemap/main.ts b/packages/esbuild/test/sourcemap/main.ts deleted file mode 100644 index 7dabd31..0000000 --- a/packages/esbuild/test/sourcemap/main.ts +++ /dev/null
@@ -1,8 +0,0 @@ -export interface Foo { - x: number, y: string, -} - -export const foo: Foo = { - x: 123, - y: 'hello', -}
diff --git a/packages/esbuild/test/testonly/BUILD.bazel b/packages/esbuild/test/testonly/BUILD.bazel deleted file mode 100644 index a42e73b..0000000 --- a/packages/esbuild/test/testonly/BUILD.bazel +++ /dev/null
@@ -1,48 +0,0 @@ -load("//:index.bzl", "generated_file_test", "js_library", "nodejs_binary", "npm_package_bin") -load("//packages/esbuild:index.bzl", "esbuild") - -js_library( - name = "lib", - srcs = ["lib.jsx"], -) - -js_library( - name = "main", - testonly = True, - srcs = ["main.js"], - deps = [":lib"], -) - -esbuild( - name = "bundle", - testonly = True, - args = { - "keepNames": True, - }, - entry_point = "main.js", - deps = [ - ":main", - ], -) - -nodejs_binary( - name = "bin", - testonly = True, - data = [ - ":bundle", - ], - entry_point = "bundle.js", -) - -npm_package_bin( - name = "runner", - testonly = True, - stdout = "out.txt", - tool = ":bin", -) - -generated_file_test( - name = "test", - src = "out.golden.txt", - generated = "out.txt", -)
diff --git a/packages/esbuild/test/testonly/lib.jsx b/packages/esbuild/test/testonly/lib.jsx deleted file mode 100644 index df4f3fb..0000000 --- a/packages/esbuild/test/testonly/lib.jsx +++ /dev/null
@@ -1 +0,0 @@ -export const NAME = 'rules_nodejs'; \ No newline at end of file
diff --git a/packages/esbuild/test/testonly/main.js b/packages/esbuild/test/testonly/main.js deleted file mode 100644 index c3648e3..0000000 --- a/packages/esbuild/test/testonly/main.js +++ /dev/null
@@ -1,3 +0,0 @@ -import {NAME as name} from './lib'; - -console.log(name); \ No newline at end of file
diff --git a/packages/esbuild/test/testonly/out.golden.txt b/packages/esbuild/test/testonly/out.golden.txt deleted file mode 100644 index 0c23e83..0000000 --- a/packages/esbuild/test/testonly/out.golden.txt +++ /dev/null
@@ -1 +0,0 @@ -rules_nodejs
diff --git a/packages/esbuild/test/ts_project/BUILD.bazel b/packages/esbuild/test/ts_project/BUILD.bazel deleted file mode 100644 index 87b3283..0000000 --- a/packages/esbuild/test/ts_project/BUILD.bazel +++ /dev/null
@@ -1,42 +0,0 @@ -load("//:index.bzl", "generated_file_test") -load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin") -load("//packages/esbuild:index.bzl", "esbuild") - -exports_files(["tsconfig.json"]) - -copy_to_bin( - name = "main-bin", - srcs = ["main.js"], -) - -esbuild( - name = "bundle", - args = { - "keepNames": True, - "resolveExtensions": [ - ".mjs", - ".js", - ], - }, - entry_point = "main-bin", - format = "esm", - deps = [ - "//packages/esbuild/test/ts_project/module-dynamic", - "//packages/esbuild/test/ts_project/module-one", - "//packages/esbuild/test/ts_project/module-two", - "//packages/esbuild/test/ts_project/relative-module", - ], -) - -genrule( - name = "strip_bundle_comments", - srcs = ["bundle.js"], - outs = ["bundle.stripped.js"], - cmd = "cat $(location :bundle.js) | sed \"s#// .*##\" > $@", -) - -generated_file_test( - name = "bundle_test", - src = "bundle.golden.txt", - generated = ":bundle.stripped.js", -)
diff --git a/packages/esbuild/test/ts_project/bundle.golden.txt b/packages/esbuild/test/ts_project/bundle.golden.txt deleted file mode 100644 index c516b2c..0000000 --- a/packages/esbuild/test/ts_project/bundle.golden.txt +++ /dev/null
@@ -1,22 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); - - -var getId = /* @__PURE__ */ __name(() => "dynamic-id", "getId"); - - -var getId2 = /* @__PURE__ */ __name(() => "module-one", "getId"); - - -var getId3 = /* @__PURE__ */ __name(() => "module-two", "getId"); - - -var getId4 = /* @__PURE__ */ __name(() => "relative-module", "getId"); - - -var ID = `Full ID: ${getId2()} - ${getId3()} - ${getId()} - ${getId4()}`; -console.log(ID); -export { - ID -}; -//# sourceMappingURL=bundle.js.map
diff --git a/packages/esbuild/test/ts_project/main.js b/packages/esbuild/test/ts_project/main.js deleted file mode 100644 index f8f27dc..0000000 --- a/packages/esbuild/test/ts_project/main.js +++ /dev/null
@@ -1,9 +0,0 @@ -import {getId as mdyn} from '@typescript/module-dynamic'; -import {getId as m1Id} from '@typescript/module-one'; -import {getId as m2Id} from '@typescript/module-two'; - -import {getId as mRelId} from './relative-module/lib'; - -export const ID = `Full ID: ${m1Id()} - ${m2Id()} - ${mdyn()} - ${mRelId()}`; - -console.log(ID);
diff --git a/packages/esbuild/test/ts_project/module-dynamic/BUILD.bazel b/packages/esbuild/test/ts_project/module-dynamic/BUILD.bazel deleted file mode 100644 index f700cf6..0000000 --- a/packages/esbuild/test/ts_project/module-dynamic/BUILD.bazel +++ /dev/null
@@ -1,19 +0,0 @@ -load("//internal/js_library:js_library.bzl", "js_library") -load("//packages/typescript:index.bzl", "ts_project") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -ts_project( - name = "compile", - srcs = [":index.ts"], - declaration = True, - extends = "//packages/esbuild/test/ts_project:tsconfig.json", - tsconfig = {}, -) - -js_library( - name = "module-dynamic", - package_name = "@typescript/module-dynamic", - srcs = [":random-file.css"], - deps = [":compile"], -)
diff --git a/packages/esbuild/test/ts_project/module-dynamic/index.ts b/packages/esbuild/test/ts_project/module-dynamic/index.ts deleted file mode 100644 index b6fec9e..0000000 --- a/packages/esbuild/test/ts_project/module-dynamic/index.ts +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'dynamic-id';
diff --git a/packages/esbuild/test/ts_project/module-dynamic/random-file.css b/packages/esbuild/test/ts_project/module-dynamic/random-file.css deleted file mode 100644 index da0e4c7..0000000 --- a/packages/esbuild/test/ts_project/module-dynamic/random-file.css +++ /dev/null
@@ -1,3 +0,0 @@ -.some-random { - font-family: 'Comic Sans'; -}
diff --git a/packages/esbuild/test/ts_project/module-one/BUILD.bazel b/packages/esbuild/test/ts_project/module-one/BUILD.bazel deleted file mode 100644 index f32464c..0000000 --- a/packages/esbuild/test/ts_project/module-one/BUILD.bazel +++ /dev/null
@@ -1,18 +0,0 @@ -load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("//packages/typescript:index.bzl", "ts_project") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -ts_project( - name = "project", - srcs = [":index.ts"], - declaration = True, - extends = "//packages/esbuild/test/ts_project:tsconfig.json", - tsconfig = {}, -) - -js_library( - name = "module-one", - package_name = "@typescript/module-one", - deps = [":project"], -)
diff --git a/packages/esbuild/test/ts_project/module-one/index.ts b/packages/esbuild/test/ts_project/module-one/index.ts deleted file mode 100644 index be8c740..0000000 --- a/packages/esbuild/test/ts_project/module-one/index.ts +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'module-one';
diff --git a/packages/esbuild/test/ts_project/module-two/BUILD.bazel b/packages/esbuild/test/ts_project/module-two/BUILD.bazel deleted file mode 100644 index 3cb024f..0000000 --- a/packages/esbuild/test/ts_project/module-two/BUILD.bazel +++ /dev/null
@@ -1,18 +0,0 @@ -load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("//packages/typescript:index.bzl", "ts_project") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -ts_project( - name = "project", - srcs = [":index.ts"], - declaration = True, - extends = "//packages/esbuild/test/ts_project:tsconfig.json", - tsconfig = {}, -) - -js_library( - name = "module-two", - package_name = "@typescript/module-two", - deps = [":project"], -)
diff --git a/packages/esbuild/test/ts_project/module-two/index.ts b/packages/esbuild/test/ts_project/module-two/index.ts deleted file mode 100644 index 4fa9280..0000000 --- a/packages/esbuild/test/ts_project/module-two/index.ts +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'module-two';
diff --git a/packages/esbuild/test/ts_project/relative-module/BUILD.bazel b/packages/esbuild/test/ts_project/relative-module/BUILD.bazel deleted file mode 100644 index 98ffcd7..0000000 --- a/packages/esbuild/test/ts_project/relative-module/BUILD.bazel +++ /dev/null
@@ -1,11 +0,0 @@ -load("//packages/typescript:index.bzl", "ts_project") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -ts_project( - name = "relative-module", - srcs = ["lib.ts"], - declaration = True, - extends = "//packages/esbuild/test/ts_project:tsconfig.json", - tsconfig = {}, -)
diff --git a/packages/esbuild/test/ts_project/relative-module/lib.ts b/packages/esbuild/test/ts_project/relative-module/lib.ts deleted file mode 100644 index 61fbbee..0000000 --- a/packages/esbuild/test/ts_project/relative-module/lib.ts +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'relative-module';
diff --git a/packages/esbuild/test/ts_project/tsconfig.json b/packages/esbuild/test/ts_project/tsconfig.json deleted file mode 100644 index 03d564d..0000000 --- a/packages/esbuild/test/ts_project/tsconfig.json +++ /dev/null
@@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "declaration": true, - "module": "esnext", - "moduleResolution": "node", - "esModuleInterop": true, - "skipLibCheck": true, - - "types": [], - - // Help TypeScript locate the a.d.ts file from previous compilation. Needed when running in a sandbox or remote. - "rootDirs": [ - ".", - "../../../../bazel-out/darwin-fastbuild/bin/packages/esbuild/test/ts_project", - "../../../../bazel-out/darwin_arm64-fastbuild/bin/packages/esbuild/test/ts_project", - "../../../../bazel-out/k8-fastbuild/bin/packages/esbuild/test/ts_project", - "../../../../bazel-out/x64_windows-fastbuild/bin/packages/esbuild/test/ts_project", - "../../../../bazel-out/darwin-dbg/bin/packages/esbuild/test/ts_project", - "../../../../bazel-out/k8-dbg/bin/packages/esbuild/test/ts_project", - "../../../../bazel-out/x64_windows-dbg/bin/packages/esbuild/test/ts_project", - ], - } -}
diff --git a/packages/esbuild/test/vanilla_js/BUILD.bazel b/packages/esbuild/test/vanilla_js/BUILD.bazel deleted file mode 100644 index e414ae7..0000000 --- a/packages/esbuild/test/vanilla_js/BUILD.bazel +++ /dev/null
@@ -1,32 +0,0 @@ -load("//:index.bzl", "generated_file_test", "nodejs_binary", "npm_package_bin") -load("//packages/esbuild:index.bzl", "esbuild") - -esbuild( - name = "lib", - srcs = [ - "main.js", - "name.js", - ], - entry_point = "main.js", - deps = [ - "@npm//date-fns", - ], -) - -nodejs_binary( - name = "bin", - data = [":lib"], - entry_point = ":lib.js", -) - -npm_package_bin( - name = "runner", - stdout = "output.txt", - tool = ":bin", -) - -generated_file_test( - name = "vanilla_js_test", - src = "output.golden.txt", - generated = ":output.txt", -)
diff --git a/packages/esbuild/test/vanilla_js/main.js b/packages/esbuild/test/vanilla_js/main.js deleted file mode 100644 index 0bf26e9..0000000 --- a/packages/esbuild/test/vanilla_js/main.js +++ /dev/null
@@ -1,5 +0,0 @@ -const NAME = require('./name').NAME; -const {isDate} = require('date-fns'); - -console.log(isDate(NAME)); -console.log(NAME);
diff --git a/packages/esbuild/test/vanilla_js/name.js b/packages/esbuild/test/vanilla_js/name.js deleted file mode 100644 index 7558dcb..0000000 --- a/packages/esbuild/test/vanilla_js/name.js +++ /dev/null
@@ -1 +0,0 @@ -exports.NAME = 'rules_nodejs'
diff --git a/packages/esbuild/test/vanilla_js/output.golden.txt b/packages/esbuild/test/vanilla_js/output.golden.txt deleted file mode 100644 index 15db084..0000000 --- a/packages/esbuild/test/vanilla_js/output.golden.txt +++ /dev/null
@@ -1,2 +0,0 @@ -false -rules_nodejs
diff --git a/packages/esbuild/test/workspace-mapping/BUILD.bazel b/packages/esbuild/test/workspace-mapping/BUILD.bazel deleted file mode 100644 index 71f718b..0000000 --- a/packages/esbuild/test/workspace-mapping/BUILD.bazel +++ /dev/null
@@ -1,33 +0,0 @@ -load("//:index.bzl", "generated_file_test") -load("//packages/esbuild:index.bzl", "esbuild") - -esbuild( - name = "bundle", - args = { - "keepNames": True, - }, - entry_point = "main.js", - format = "esm", - link_workspace_root = True, - deps = [ - "//packages/esbuild/test/workspace-mapping/module-one", - "//packages/esbuild/test/workspace-mapping/module-two", - ], -) - -# esbuild will put the filepath in a comment within the non-minified file, -# on different platforms this will cause the golden test to differ -# strip them here -# note that this regex doesn't strip the sourcemap URI comment -genrule( - name = "strip_bundle_comments", - srcs = ["bundle.js"], - outs = ["bundle.stripped.js"], - cmd = "cat $(location :bundle.js) | sed \"s#// .*##\" > $@", -) - -generated_file_test( - name = "bundle_test", - src = "bundle.golden.txt", - generated = "bundle.stripped.js", -)
diff --git a/packages/esbuild/test/workspace-mapping/bundle.golden.txt b/packages/esbuild/test/workspace-mapping/bundle.golden.txt deleted file mode 100644 index a5c937b..0000000 --- a/packages/esbuild/test/workspace-mapping/bundle.golden.txt +++ /dev/null
@@ -1,15 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); - - -var getId = /* @__PURE__ */ __name(() => "module-one", "getId"); - - -var getId2 = /* @__PURE__ */ __name(() => "module-two", "getId"); - - -var main_default = `Full ID: ${getId} - ${getId2}`; -export { - main_default as default -}; -//# sourceMappingURL=bundle.js.map
diff --git a/packages/esbuild/test/workspace-mapping/main.js b/packages/esbuild/test/workspace-mapping/main.js deleted file mode 100644 index 48a2e7a..0000000 --- a/packages/esbuild/test/workspace-mapping/main.js +++ /dev/null
@@ -1,4 +0,0 @@ -import {getId as m1Id} from 'build_bazel_rules_nodejs/packages/esbuild/test/workspace-mapping/module-one'; -import {getId as m2Id} from 'build_bazel_rules_nodejs/packages/esbuild/test/workspace-mapping/module-two'; - -export default `Full ID: ${m1Id} - ${m2Id}`;
diff --git a/packages/esbuild/test/workspace-mapping/module-one/BUILD.bazel b/packages/esbuild/test/workspace-mapping/module-one/BUILD.bazel deleted file mode 100644 index b2ce25f..0000000 --- a/packages/esbuild/test/workspace-mapping/module-one/BUILD.bazel +++ /dev/null
@@ -1,8 +0,0 @@ -load("//internal/js_library:js_library.bzl", "js_library") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -js_library( - name = "module-one", - srcs = [":index.js"], -)
diff --git a/packages/esbuild/test/workspace-mapping/module-one/index.js b/packages/esbuild/test/workspace-mapping/module-one/index.js deleted file mode 100644 index be8c740..0000000 --- a/packages/esbuild/test/workspace-mapping/module-one/index.js +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'module-one';
diff --git a/packages/esbuild/test/workspace-mapping/module-two/BUILD.bazel b/packages/esbuild/test/workspace-mapping/module-two/BUILD.bazel deleted file mode 100644 index b581804..0000000 --- a/packages/esbuild/test/workspace-mapping/module-two/BUILD.bazel +++ /dev/null
@@ -1,8 +0,0 @@ -load("//internal/js_library:js_library.bzl", "js_library") - -package(default_visibility = ["//packages/esbuild/test:__subpackages__"]) - -js_library( - name = "module-two", - srcs = [":index.js"], -)
diff --git a/packages/esbuild/test/workspace-mapping/module-two/index.js b/packages/esbuild/test/workspace-mapping/module-two/index.js deleted file mode 100644 index 4fa9280..0000000 --- a/packages/esbuild/test/workspace-mapping/module-two/index.js +++ /dev/null
@@ -1 +0,0 @@ -export const getId = () => 'module-two';
diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel index 738d31f..02595ef 100644 --- a/toolchains/BUILD.bazel +++ b/toolchains/BUILD.bazel
@@ -8,7 +8,6 @@ visibility = ["//docs:__pkg__"], deps = [ "//toolchains/cypress:bzl", - "//toolchains/esbuild:bzl", "@bazel_skylib//lib:types", "@rules_nodejs//nodejs:bzl", ],
diff --git a/toolchains/esbuild/BUILD.bazel b/toolchains/esbuild/BUILD.bazel deleted file mode 100644 index ea8de99..0000000 --- a/toolchains/esbuild/BUILD.bazel +++ /dev/null
@@ -1,36 +0,0 @@ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_packages.bzl", "ESBUILD_PACKAGES") -load(":toolchain.bzl", "configure_esbuild_toolchains") - -filegroup( - name = "package_contents", - srcs = glob(["*"]), - visibility = ["//:__pkg__"], -) - -exports_files([ - "package.json", - "package-lock.json", -]) - -toolchain_type( - name = "toolchain_type", - visibility = ["//visibility:public"], -) - -configure_esbuild_toolchains( - platforms = ESBUILD_PACKAGES.platforms, -) - -bzl_library( - name = "bzl", - srcs = [ - "esbuild_packages.bzl", - "esbuild_repositories.bzl", - "toolchain.bzl", - ], - visibility = ["//visibility:public"], - deps = [ - "//:bzl", - ], -)
diff --git a/toolchains/esbuild/esbuild_packages.bzl b/toolchains/esbuild/esbuild_packages.bzl deleted file mode 100644 index 59e0ab4..0000000 --- a/toolchains/esbuild/esbuild_packages.bzl +++ /dev/null
@@ -1,93 +0,0 @@ -"""Info for the esbuild packages used""" - -_VERSION = "0.15.17" -_DARWIN_AMD64_SHA = "bdb4b1b6d57469f8f6f11b5df85b29524842b24c185b501995a1522f0497d26c" -_DARWIN_ARM64_SHA = "4a12abe17bc6d0438f8353862173d65570c70967f804ff383d6828b53befd4cc" -_LINUX_AMD64_SHA = "4a8bad6e2d13e7edfef1351e4725f65a8828093b0d63bba3237fcab5e530afa2" -_LINUX_ARM64_SHA = "893fb422f0c2759998a125cb23c3055712d5f3f4414ca75f3ec9dd55b03fcc8c" -_WINDOWS_AMD64_SHA = "00eb7f0b81591c2d842c8824cb9a948089566ffb629882298b640b425de45f2f" -_LINUX_PPC64LE_SHA = "c6703bc387c5ad86073135d3837a4a1d47909737b7169b509c4f636bb492fd9f" -_LINUX_S390X_SHA = "f27128ae64e19eae5c73c3b43ae11abbc4b0757c36e61df3cc043b7126fe9069" - -ESBUILD_PACKAGES = struct( - version = _VERSION, - platforms = dict({ - "darwin_amd64": struct( - sha = _DARWIN_AMD64_SHA, - urls = [ - "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-%s.tgz" % _VERSION, - ], - binary_path = "bin/esbuild", - exec_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:x86_64", - ], - ), - "darwin_arm64": struct( - sha = _DARWIN_ARM64_SHA, - urls = [ - "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-%s.tgz" % _VERSION, - ], - binary_path = "bin/esbuild", - exec_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:arm64", - ], - ), - "linux_amd64": struct( - sha = _LINUX_AMD64_SHA, - urls = [ - "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-%s.tgz" % _VERSION, - ], - binary_path = "bin/esbuild", - exec_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], - ), - "linux_arm64": struct( - sha = _LINUX_ARM64_SHA, - urls = [ - "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-%s.tgz" % _VERSION, - ], - binary_path = "bin/esbuild", - exec_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:arm64", - ], - ), - "windows_amd64": struct( - sha = _WINDOWS_AMD64_SHA, - urls = [ - "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-%s.tgz" % _VERSION, - ], - binary_path = "esbuild.exe", - exec_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:x86_64", - ], - ), - "linux_ppc64le": struct( - sha = _LINUX_PPC64LE_SHA, - urls = [ - "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-%s.tgz" % _VERSION, - ], - binary_path = "bin/esbuild", - exec_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:ppc", - ], - ), - "linux_s390x": struct( - sha = _LINUX_S390X_SHA, - urls = [ - "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-%s.tgz" % _VERSION, - ], - binary_path = "bin/esbuild", - exec_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:s390x", - ], - ), - }), -)
diff --git a/toolchains/esbuild/esbuild_repositories.bzl b/toolchains/esbuild/esbuild_repositories.bzl deleted file mode 100644 index 840a5f9..0000000 --- a/toolchains/esbuild/esbuild_repositories.bzl +++ /dev/null
@@ -1,83 +0,0 @@ -""" -Helper macro for fetching esbuild versions -""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -load("@build_bazel_rules_nodejs//:index.bzl", "npm_install") -load(":esbuild_packages.bzl", "ESBUILD_PACKAGES") - -def 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 - - Args: - npm_repository: the name of the repository where the @bazel/esbuild package is installed - by npm_install or yarn_install. - name: currently unused - npm_args: additional args to pass to the npm install rule - **kwargs: additional named parameters to the npm_install rule - """ - - maybe( - http_archive, - name = "bazel_skylib", - sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d", - urls = [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz", - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz", - ], - ) - - for name, meta in ESBUILD_PACKAGES.platforms.items(): - maybe( - http_archive, - name = "esbuild_%s" % name, - urls = meta.urls, - strip_prefix = "package", - build_file_content = """exports_files(["%s"])""" % meta.binary_path, - sha256 = meta.sha, - ) - - toolchain_label = Label("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_%s_toolchain" % name) - native.register_toolchains("@%s//%s:%s" % (toolchain_label.workspace_name, toolchain_label.package, toolchain_label.name)) - - # When used from our distribution, the toolchain in rules_nodejs needs to point out to the - # @bazel/esbuild package where it was installed by npm_install so that our launcher.js can - # require('esbuild') via the multi-linker. - pkg_label = Label("@%s//packages/esbuild:esbuild.bzl" % npm_repository) - package_path = "external/" + pkg_label.workspace_name + "/@bazel/esbuild" - - # BEGIN-INTERNAL - # But when used within rules_nodejs locally from source, it's linked next to the launcher.js source - package_path = "packages/esbuild" - - # END-INTERNAL - npm_install( - name = "esbuild_npm", - package_json = Label("@build_bazel_rules_nodejs//toolchains/esbuild:package.json"), - package_lock_json = Label("@build_bazel_rules_nodejs//toolchains/esbuild:package-lock.json"), - args = [ - # Install is run with no-optional so that esbuild's optional dependencies are not installed. - # We never use the downloaded binary anyway and instead set 'ESBUILD_BINARY_PATH' to the toolchains path. - # This allows us to deal with --platform - "--no-optional", - # Disable scripts as we don't need the javascript shim replaced wit the binary. - "--ignore-scripts", - ] + npm_args, - package_path = package_path, - **kwargs - )
diff --git a/toolchains/esbuild/package-lock.json b/toolchains/esbuild/package-lock.json deleted file mode 100644 index 3dd9fb7..0000000 --- a/toolchains/esbuild/package-lock.json +++ /dev/null
@@ -1,168 +0,0 @@ -{ - "version": "0.0.0-PLACEHOLDER", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@esbuild/android-arm": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.17.tgz", - "integrity": "sha512-ay6Ken4u+JStjYmqIgh71jMT0bs/rXpCCDKaMfl78B20QYWJglT5P6Ejfm4hWf6Zi+uUWNe7ZmqakRs2BQYIeg==", - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.17.tgz", - "integrity": "sha512-IA1O7f7qxw2DX8oqTpugHElr926phs7Rq8ULXleBMk4go5K05BU0mI8BfCkWcYAvcmVaMc13bv5W3LIUlU6Y9w==", - "optional": true - }, - "esbuild": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.17.tgz", - "integrity": "sha512-8MbkDX+kh0kaeYGd6klMbn1uTOXHoDw7UYMd1dQYA5cqBZivf5+pzfaXZSL1RNamJfXW/uWC5+9wX5ejDgpSqg==", - "requires": { - "@esbuild/android-arm": "0.15.17", - "@esbuild/linux-loong64": "0.15.17", - "esbuild-android-64": "0.15.17", - "esbuild-android-arm64": "0.15.17", - "esbuild-darwin-64": "0.15.17", - "esbuild-darwin-arm64": "0.15.17", - "esbuild-freebsd-64": "0.15.17", - "esbuild-freebsd-arm64": "0.15.17", - "esbuild-linux-32": "0.15.17", - "esbuild-linux-64": "0.15.17", - "esbuild-linux-arm": "0.15.17", - "esbuild-linux-arm64": "0.15.17", - "esbuild-linux-mips64le": "0.15.17", - "esbuild-linux-ppc64le": "0.15.17", - "esbuild-linux-riscv64": "0.15.17", - "esbuild-linux-s390x": "0.15.17", - "esbuild-netbsd-64": "0.15.17", - "esbuild-openbsd-64": "0.15.17", - "esbuild-sunos-64": "0.15.17", - "esbuild-windows-32": "0.15.17", - "esbuild-windows-64": "0.15.17", - "esbuild-windows-arm64": "0.15.17" - } - }, - "esbuild-android-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.17.tgz", - "integrity": "sha512-sUs6cKMAuAyWnJ/66ezWVr9SMRGFSwoMagxzdhXYggSA12zF7krXSuc1Y9JwxHq56wtv/gFAVo97TFm7RBc1Ig==", - "optional": true - }, - "esbuild-android-arm64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.17.tgz", - "integrity": "sha512-RLZuCgIx1rexwxwsXTEW40ZiZzdBI1MBphwDRFyms/iiJGwLxqCH7v75iSJk5s6AF6oa80KC6r/RmzyaX/uJNg==", - "optional": true - }, - "esbuild-darwin-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.17.tgz", - "integrity": "sha512-+6RTCZ0hfAb+RqTNq1uVsBcP441yZOSi6CyV9BIBryGGVg8RM3Bc6L45e5b68jdRloddN92ekS50e4ElI+cHQA==", - "optional": true - }, - "esbuild-darwin-arm64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.17.tgz", - "integrity": "sha512-ne4UWUHEKWLgYSE5SLr0/TBcID3k9LPnrzzRXzFLTfD+ygjnW1pMEgdMfmOKIe8jYBUYv8x/YoksriTdQb9r/Q==", - "optional": true - }, - "esbuild-freebsd-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.17.tgz", - "integrity": "sha512-6my3DrwLOe1zhR8UzVRKeo9AFM9XkApJBcx0IE+qKaEbKKBxYAiDBtd2ZMtRA2agqIwRP0kuHofTiDEzpfA+ZA==", - "optional": true - }, - "esbuild-freebsd-arm64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.17.tgz", - "integrity": "sha512-LQL7+f+bz+xmAu1FcDBB304Wm2CjONUcOeF4f3TqG7wYXMxjjYQZBFv+0OVapNXyYrM2vy9JMDbps+SheuOnHg==", - "optional": true - }, - "esbuild-linux-32": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.17.tgz", - "integrity": "sha512-7E9vZXMZhINQ4/KcxBxioJ2ao5gbXJ6Pa4/LEUd102g3gadSalpg0LrityFgw7ao6qmjcNWwdEYrXaDnOzyyYA==", - "optional": true - }, - "esbuild-linux-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.17.tgz", - "integrity": "sha512-TnedHtFQSUVlc0J0D4ZMMalYaQ0Zbt7HSwGy4sav7BlXVqDVc/rchJ/a9dathK51apzLgRyXQMseLf6bkloaSQ==", - "optional": true - }, - "esbuild-linux-arm": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.17.tgz", - "integrity": "sha512-+ugCmBTTDIlh+UuC7E/GvyJqjGTX2pNOA+g3isG78aYcfgswrHjvstTtIfljaU95AS30qrVNLgI5h/8TsRWTrg==", - "optional": true - }, - "esbuild-linux-arm64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.17.tgz", - "integrity": "sha512-oupYfh0lTHg+F/2ZoTNrioB+KLd6x0Zlhjz2Oa1jhl8wCGkNvwe25RytR2/SGPYpoNVcvCeoayWQRwwRuWGgfQ==", - "optional": true - }, - "esbuild-linux-mips64le": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.17.tgz", - "integrity": "sha512-aUVyHwUXJF1hi9jsAT+At+cBxZh2yGICi/e757N6d/zzOD+eVK3PKQj68tAvIflx6/ZpnuCTKol1GpgGYrzERg==", - "optional": true - }, - "esbuild-linux-ppc64le": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.17.tgz", - "integrity": "sha512-i7789iFTLfLccHPNADCbaZPx9CuQblsBqv2j4XqIBN1jKIJbpQ8iqCkWoHep4PLqqKLtBLtTWh919GsrFGdeJA==", - "optional": true - }, - "esbuild-linux-riscv64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.17.tgz", - "integrity": "sha512-fEQ/8tnZ2sDniBlPfTXEdg+0OP1olps96HvYdwl8ywJdAlD7AK761EL3lRbRdfMHNOId2N6+CVca43/Fiu/0AQ==", - "optional": true - }, - "esbuild-linux-s390x": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.17.tgz", - "integrity": "sha512-ZBQekST4gYgTKHAvUJtR1kFFulHTDlRZSE8T0wRQCmQqydNkC1teWxlR31xS6MZevjZGfa7OMVJD24bBhei/2Q==", - "optional": true - }, - "esbuild-netbsd-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.17.tgz", - "integrity": "sha512-onNBFaZVN9GzGJMm3aZJJv74n/Q8FjW20G9OfSDhHjvamqJ5vbd42hNk6igQX4lgBCHTZvvBlWDJAMy+tbJAAw==", - "optional": true - }, - "esbuild-openbsd-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.17.tgz", - "integrity": "sha512-QFxHmvjaRrmTCvH/A3EmzqKUSZHRQ7/pbrJeATsb/Q6qckCeL9e7zg/1A3HiZqDXeBUV3yNeBeV1GJBjY6yVyA==", - "optional": true - }, - "esbuild-sunos-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.17.tgz", - "integrity": "sha512-7dHZA8Kc6U8rBTKojJatXtzHTUKJ3CRYimvOGIQQ1yUDOqGx/zZkCH/HkEi3Zg5SWyDj/57E5e1YJPo4ySSw/w==", - "optional": true - }, - "esbuild-windows-32": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.17.tgz", - "integrity": "sha512-yDrNrwQ/0k4N3OZItZ6k6YnBUch8+of06YRYc3hFI8VDm7X1rkNZwhttZNAzF6+TtbnK4cIz7H2/EwdSoaGZ3g==", - "optional": true - }, - "esbuild-windows-64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.17.tgz", - "integrity": "sha512-jPnXvB4zMMToNPpCBdt+OEQiYFVs9wlQ5G8vMoJkrYJBp1aEt070MRpBFa6pfBFrgXquqgUiNAohMcTdy+JVFg==", - "optional": true - }, - "esbuild-windows-arm64": { - "version": "0.15.17", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.17.tgz", - "integrity": "sha512-I5QeSsz0X66V8rxVhmw03Wzn8Tz63H3L9GrsA7C5wvBXMk3qahLWuEL+l7SZ2DleKkFeZZMu1dPxOak9f1TZ4A==", - "optional": true - } - } -}
diff --git a/toolchains/esbuild/package.json b/toolchains/esbuild/package.json deleted file mode 100644 index 0fbc4d3..0000000 --- a/toolchains/esbuild/package.json +++ /dev/null
@@ -1,18 +0,0 @@ -{ - "version": "0.0.0-PLACEHOLDER", - "private": true, - "repository": { - "type": "git", - "url": "https://github.com/bazelbuild/rules_nodejs.git", - "directory": "packages/esbuild" - }, - "bugs": { - "url": "https://github.com/bazelbuild/rules_nodejs/issues" - }, - "keywords": [ - "bazel" - ], - "dependencies": { - "esbuild": "0.15.17" - } -}
diff --git a/toolchains/esbuild/toolchain.bzl b/toolchains/esbuild/toolchain.bzl deleted file mode 100644 index fd8d2fa..0000000 --- a/toolchains/esbuild/toolchain.bzl +++ /dev/null
@@ -1,61 +0,0 @@ -"""Toolchain and helper definitions for esbuild""" - -def _esbuild_toolchain_impl(ctx): - return [ - platform_common.ToolchainInfo( - binary = ctx.executable.binary, - ), - platform_common.TemplateVariableInfo({ - "ESBUILD_PATH": ctx.executable.binary.path, - }), - ] - -_esbuild_toolchain = rule( - implementation = _esbuild_toolchain_impl, - attrs = { - "binary": attr.label( - allow_single_file = True, - executable = True, - cfg = "exec", - ), - }, -) - -TOOLCHAIN = Label("@build_bazel_rules_nodejs//toolchains/esbuild:toolchain_type") - -def configure_esbuild_toolchain(name, binary, exec_compatible_with): - """Defines a toolchain for esbuild given the binary path and platform constraints - - Args: - 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_toolchain( - name = name, - binary = binary, - ) - - native.toolchain( - name = "%s_toolchain" % name, - exec_compatible_with = exec_compatible_with, - toolchain = name, - toolchain_type = TOOLCHAIN, - ) - -def configure_esbuild_toolchains(name = "", platforms = {}): - """Configures esbuild toolchains for a list of supported platforms - - Args: - name: unused - platforms: dict of platforms to configure toolchains for - """ - - for name, meta in platforms.items(): - repo = "esbuild_%s" % name - configure_esbuild_toolchain( - name = repo, - binary = "@%s//:%s" % (repo, meta.binary_path), - exec_compatible_with = meta.exec_compatible_with, - )
diff --git a/toolchains/index.for_docs.bzl b/toolchains/index.for_docs.bzl index 9c1e2a1..9f23767 100644 --- a/toolchains/index.for_docs.bzl +++ b/toolchains/index.for_docs.bzl
@@ -50,10 +50,6 @@ load("//toolchains/cypress:cypress_repositories.bzl", _cypress_repositories = "cypress_repositories") load("//toolchains/cypress:cypress_toolchain.bzl", _cypress_toolchain = "cypress_toolchain") -load("//toolchains/esbuild:esbuild_repositories.bzl", _esbuild_repositories = "esbuild_repositories") -load("//toolchains/esbuild:toolchain.bzl", _configure_esbuild_toolchains = "configure_esbuild_toolchains") cypress_repositories = _cypress_repositories cypress_toolchain = _cypress_toolchain -esbuild_repositories = _esbuild_repositories -configure_esbuild_toolchains = _configure_esbuild_toolchains