Add bzlmod support (#51)

diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json
new file mode 100644
index 0000000..770f610
--- /dev/null
+++ b/.bcr/metadata.template.json
@@ -0,0 +1,15 @@
+{
+    "homepage": "https://github.com/keith/buildifier-prebuilt",
+    "maintainers": [
+        {
+            "email": "keithbsmiley@gmail.com",
+            "github": "keith",
+            "name": "Keith Smiley"
+        }
+    ],
+    "repository": [
+        "github:keith/buildifier-prebuilt"
+    ],
+    "versions": [],
+    "yanked_versions": {}
+}
diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml
new file mode 100644
index 0000000..bc149f1
--- /dev/null
+++ b/.bcr/presubmit.yml
@@ -0,0 +1,12 @@
+matrix:
+  platform: ["macos", "ubuntu2004"]
+
+tasks:
+  verify_targets:
+    name: "Verify build targets"
+    platform: ${{ platform }}
+    build_targets:
+      - '@buildifier_prebuilt//:buildifier'
+      - '@buildifier_prebuilt//:buildozer'
+    test_targets:
+      - '@buildifier_prebuilt//tests/...'
diff --git a/.bcr/source.template.json b/.bcr/source.template.json
new file mode 100644
index 0000000..85b3475
--- /dev/null
+++ b/.bcr/source.template.json
@@ -0,0 +1,5 @@
+{
+    "url": "https://github.com/keith/buildifier-prebuilt/archive/refs/tags/{TAG}.tar.gz",
+    "integrity": "",
+    "strip_prefix": ""
+}
diff --git a/.github/actions/build_and_test/action.yml b/.github/actions/build_and_test/action.yml
index 37f9180..76cdb91 100644
--- a/.github/actions/build_and_test/action.yml
+++ b/.github/actions/build_and_test/action.yml
@@ -14,12 +14,8 @@
         # The tests make use of Github-specific functionality (e.g. gh).
         GITHUB_TOKEN: ${{ inputs.github_token }}
       run: |
-        bazelisk test //... 
-
-    - name: Build Anything Not Tested
-      shell: bash
-      run: |
-        bazelisk build //... 
+        bazelisk test //...
+        bazelisk test //... --enable_bzlmod
 
     - name: Execute Integration Tests
       shell: bash
@@ -28,3 +24,4 @@
         GITHUB_TOKEN: ${{ inputs.github_token }}
       run: |
         bazelisk test //:all_integration_tests
+        bazelisk test //:all_integration_tests --enable_bzlmod
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..4c1e9e7
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,16 @@
+module(
+    name = "buildifier_prebuilt",
+    version = "6.0.0.1",
+    compatibility_level = 1,
+)
+
+bazel_dep(name = "bazel_skylib", version = "1.3.0")
+bazel_dep(name = "platforms", version = "0.0.5")
+
+non_module_deps = use_extension("//:defs.bzl", "buildifier_prebuilt_deps_extension")
+use_repo(
+    non_module_deps,
+    "buildifier_prebuilt_toolchains",
+)
+
+register_toolchains("@buildifier_prebuilt_toolchains//:all")
diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod
new file mode 100644
index 0000000..d0b7b97
--- /dev/null
+++ b/WORKSPACE.bzlmod
@@ -0,0 +1,36 @@
+workspace(name = "buildifier_prebuilt")
+
+# MARK: - Test and Release Dependencies
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+    name = "cgrindel_bazel_starlib",
+    sha256 = "75ede4943a0000661cab0a4495bd10ddfc45bc73df83677eb75f49202ea09a34",
+    strip_prefix = "bazel-starlib-0.5.0",
+    urls = [
+        "http://github.com/cgrindel/bazel-starlib/archive/v0.5.0.tar.gz",
+    ],
+)
+
+load("@cgrindel_bazel_starlib//:deps.bzl", "bazel_starlib_dependencies")
+
+bazel_starlib_dependencies()
+
+http_archive(
+    name = "contrib_rules_bazel_integration_test",
+    sha256 = "ab9bbf776b5874f8a02f639fec2fbb3e3eefa4403cf861ae00d7c7e4d757f9ff",
+    strip_prefix = "rules_bazel_integration_test-0.6.2",
+    urls = [
+        "http://github.com/bazel-contrib/rules_bazel_integration_test/archive/v0.6.2.tar.gz",
+    ],
+)
+
+load("@contrib_rules_bazel_integration_test//bazel_integration_test:deps.bzl", "bazel_integration_test_rules_dependencies")
+
+bazel_integration_test_rules_dependencies()
+
+load("@contrib_rules_bazel_integration_test//bazel_integration_test:defs.bzl", "bazel_binaries")
+load("//:bazel_versions.bzl", "SUPPORTED_BAZEL_VERSIONS")
+
+bazel_binaries(versions = SUPPORTED_BAZEL_VERSIONS)
diff --git a/defs.bzl b/defs.bzl
index 72f5116..e966a3a 100644
--- a/defs.bzl
+++ b/defs.bzl
@@ -38,12 +38,14 @@
 
 def buildifier_prebuilt_register_toolchains(
         name = "buildifier_prebuilt_toolchains",
-        assets = buildtools.DEFAULT_ASSETS):
+        assets = buildtools.DEFAULT_ASSETS,
+        register_toolchains = True):
     """Setup the buildifier toolchain and configure downloads
 
     Args:
         name: The name of the repository used for the toolchains.
         assets: The buildozer and buildifier assets to use.
+        register_toolchains: Whether to register the toolchains.
     """
     if len(assets) == 0:
         fail("No assets were specified.")
@@ -77,7 +79,14 @@
         name = name,
         assets_json = buildtools.asset_to_json(assets),
     )
-    native.register_toolchains(*toolchain_names)
+
+    if register_toolchains:
+        native.register_toolchains(*toolchain_names)
 
 buildtools_asset = buildtools.create_asset
 buildtools_assets = buildtools.create_assets
+
+def _impl(_):
+    buildifier_prebuilt_register_toolchains(register_toolchains = False)
+
+buildifier_prebuilt_deps_extension = module_extension(implementation = _impl)