From 05bedd99d2af1323d4483256581bef28d74b093d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E5=B0=98?= Date: Wed, 25 Oct 2023 11:55:25 +0800 Subject: [PATCH 01/18] feat: basic project structure --- .cargo/config.toml | 39 +- .github/workflows/CI.yml | 288 --- .gitignore | 5 +- Cargo.toml | 114 +- README.md | 1 - __test__/index.spec.mjs | 10 - crates/binding_options/Cargo.toml | 59 + crates/binding_options/src/lib.rs | 2 + .../binding_options/src/options/js_loader.rs | 90 + crates/binding_options/src/options/mod.rs | 168 ++ .../binding_options/src/options/raw_module.rs | 40 + crates/loader_compilation/Cargo.toml | 29 + crates/loader_compilation/src/lib.rs | 49 + crates/loader_compilation/tests/fixtures.rs | 96 + .../tests/fixtures/basic/input.js | 1 + .../tests/fixtures/basic/output.js | 3 + crates/node_binding/Cargo.toml | 39 + build.rs => crates/node_binding/build.rs | 0 crates/node_binding/index.d.ts | 1097 +++++++++++ crates/node_binding/index.js | 119 ++ .../node_binding/npm/darwin-arm64/README.md | 3 + .../npm/darwin-arm64/package.json | 18 + crates/node_binding/npm/darwin-x64/README.md | 3 + .../node_binding/npm/darwin-x64/package.json | 18 + .../node_binding/npm/linux-x64-gnu/README.md | 3 + .../npm/linux-x64-gnu/package.json | 21 + .../node_binding/npm/win32-x64-msvc/README.md | 3 + .../npm/win32-x64-msvc/package.json | 18 + crates/node_binding/package.json | 33 + crates/node_binding/src/hook.rs | 89 + crates/node_binding/src/js_values/asset.rs | 106 ++ .../node_binding/src/js_values/chunk_group.rs | 27 + .../node_binding/src/js_values/compilation.rs | 434 +++++ crates/node_binding/src/js_values/hooks.rs | 42 + crates/node_binding/src/js_values/mod.rs | 25 + crates/node_binding/src/js_values/module.rs | 37 + .../src/js_values/normal_module_factory.rs | 105 + .../node_binding/src/js_values/path_data.rs | 42 + crates/node_binding/src/js_values/source.rs | 198 ++ crates/node_binding/src/js_values/stats.rs | 561 ++++++ crates/node_binding/src/lib.rs | 289 +++ crates/node_binding/src/loader.rs | 14 + crates/node_binding/src/plugins/loader.rs | 96 + crates/node_binding/src/plugins/mod.rs | 908 +++++++++ crates/node_binding/src/utils.rs | 203 ++ crates/plugin_manifest/Cargo.toml | 15 + crates/plugin_manifest/src/lib.rs | 2 + crates/plugin_manifest/src/plugin.rs | 58 + crates/plugin_manifest/tests/fixtures.rs | 16 + .../tests/fixtures/basic/index.css | 3 + .../tests/fixtures/basic/index.js | 3 + .../tests/fixtures/basic/snapshot/output.snap | 3 + .../tests/fixtures/basic/test.config.json | 2 + index.d.ts | 6 - index.js | 257 --- npm/darwin-arm64/README.md | 3 - npm/darwin-arm64/package.json | 21 - npm/darwin-universal/README.md | 3 - npm/darwin-universal/package.json | 18 - npm/darwin-x64/README.md | 3 - npm/darwin-x64/package.json | 21 - npm/linux-x64-gnu/README.md | 3 - npm/linux-x64-gnu/package.json | 24 - npm/linux-x64-musl/README.md | 3 - npm/linux-x64-musl/package.json | 24 - npm/win32-arm64-msvc/README.md | 3 - npm/win32-arm64-msvc/package.json | 21 - npm/win32-x64-msvc/README.md | 3 - npm/win32-x64-msvc/package.json | 21 - package.json | 51 +- pnpm-lock.yaml | 1681 +++++++++++++++++ pnpm-workspace.yaml | 2 + rust-toolchain.toml | 3 + rustfmt.toml | 7 +- scripts/clone-rspack.mjs | 49 + src/css_modules.rs | 46 - src/hash.rs | 154 -- src/lib.rs | 21 - src/local_ident_name.rs | 170 -- yarn.lock | 898 --------- 80 files changed, 7075 insertions(+), 2088 deletions(-) delete mode 100644 .github/workflows/CI.yml delete mode 100644 README.md delete mode 100644 __test__/index.spec.mjs create mode 100644 crates/binding_options/Cargo.toml create mode 100644 crates/binding_options/src/lib.rs create mode 100644 crates/binding_options/src/options/js_loader.rs create mode 100644 crates/binding_options/src/options/mod.rs create mode 100644 crates/binding_options/src/options/raw_module.rs create mode 100644 crates/loader_compilation/Cargo.toml create mode 100644 crates/loader_compilation/src/lib.rs create mode 100644 crates/loader_compilation/tests/fixtures.rs create mode 100644 crates/loader_compilation/tests/fixtures/basic/input.js create mode 100644 crates/loader_compilation/tests/fixtures/basic/output.js create mode 100644 crates/node_binding/Cargo.toml rename build.rs => crates/node_binding/build.rs (100%) create mode 100644 crates/node_binding/index.d.ts create mode 100644 crates/node_binding/index.js create mode 100644 crates/node_binding/npm/darwin-arm64/README.md create mode 100644 crates/node_binding/npm/darwin-arm64/package.json create mode 100644 crates/node_binding/npm/darwin-x64/README.md create mode 100644 crates/node_binding/npm/darwin-x64/package.json create mode 100644 crates/node_binding/npm/linux-x64-gnu/README.md create mode 100644 crates/node_binding/npm/linux-x64-gnu/package.json create mode 100644 crates/node_binding/npm/win32-x64-msvc/README.md create mode 100644 crates/node_binding/npm/win32-x64-msvc/package.json create mode 100644 crates/node_binding/package.json create mode 100644 crates/node_binding/src/hook.rs create mode 100644 crates/node_binding/src/js_values/asset.rs create mode 100644 crates/node_binding/src/js_values/chunk_group.rs create mode 100644 crates/node_binding/src/js_values/compilation.rs create mode 100644 crates/node_binding/src/js_values/hooks.rs create mode 100644 crates/node_binding/src/js_values/mod.rs create mode 100644 crates/node_binding/src/js_values/module.rs create mode 100644 crates/node_binding/src/js_values/normal_module_factory.rs create mode 100644 crates/node_binding/src/js_values/path_data.rs create mode 100644 crates/node_binding/src/js_values/source.rs create mode 100644 crates/node_binding/src/js_values/stats.rs create mode 100644 crates/node_binding/src/lib.rs create mode 100644 crates/node_binding/src/loader.rs create mode 100644 crates/node_binding/src/plugins/loader.rs create mode 100644 crates/node_binding/src/plugins/mod.rs create mode 100644 crates/node_binding/src/utils.rs create mode 100644 crates/plugin_manifest/Cargo.toml create mode 100644 crates/plugin_manifest/src/lib.rs create mode 100644 crates/plugin_manifest/src/plugin.rs create mode 100644 crates/plugin_manifest/tests/fixtures.rs create mode 100644 crates/plugin_manifest/tests/fixtures/basic/index.css create mode 100644 crates/plugin_manifest/tests/fixtures/basic/index.js create mode 100644 crates/plugin_manifest/tests/fixtures/basic/snapshot/output.snap create mode 100644 crates/plugin_manifest/tests/fixtures/basic/test.config.json delete mode 100644 index.d.ts delete mode 100644 index.js delete mode 100644 npm/darwin-arm64/README.md delete mode 100644 npm/darwin-arm64/package.json delete mode 100644 npm/darwin-universal/README.md delete mode 100644 npm/darwin-universal/package.json delete mode 100644 npm/darwin-x64/README.md delete mode 100644 npm/darwin-x64/package.json delete mode 100644 npm/linux-x64-gnu/README.md delete mode 100644 npm/linux-x64-gnu/package.json delete mode 100644 npm/linux-x64-musl/README.md delete mode 100644 npm/linux-x64-musl/package.json delete mode 100644 npm/win32-arm64-msvc/README.md delete mode 100644 npm/win32-arm64-msvc/package.json delete mode 100644 npm/win32-x64-msvc/README.md delete mode 100644 npm/win32-x64-msvc/package.json create mode 100644 pnpm-lock.yaml create mode 100644 pnpm-workspace.yaml create mode 100644 rust-toolchain.toml create mode 100644 scripts/clone-rspack.mjs delete mode 100644 src/css_modules.rs delete mode 100644 src/hash.rs delete mode 100644 src/lib.rs delete mode 100644 src/local_ident_name.rs delete mode 100644 yarn.lock diff --git a/.cargo/config.toml b/.cargo/config.toml index f4d1428..6e228bd 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,34 @@ -# To be able to run unit tests on macOS, support compilation to 'x86_64-apple-darwin'. -[target.'cfg(target_vendor = "apple")'] -rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"] +# workaround for getting workspace root dir, reference: https://github.com/rust-lang/cargo/issues/3946 +[env] +CARGO_WORKSPACE_DIR = { value = "", relative = true } + +[alias] +lint = "clippy --workspace --all-targets -- --deny warnings" +# AKA `test-update`, handy cargo rst update without install `cargo-rst` binary +t = "test --no-fail-fast" +tu = "run -p cargo-rst -- update" + +[target.'cfg(all())'] +rustflags = [ + # CLIPPY LINT SETTINGS + # This is a workaround to configure lints for the entire workspace, pending the ability to configure this via TOML. + # See: `https://github.com/rust-lang/cargo/issues/5034` + # `https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395` + "-Wclippy::all", # all lints that are on by default (correctness, suspicious, style, complexity, perf) + + # restriction + "-Wclippy::dbg_macro", + "-Wclippy::unwrap_in_result", + "-Wclippy::unwrap_used", + "-Wclippy::empty_drop", + "-Wclippy::exit", + "-Wclippy::empty_structs_with_brackets", + "-Wclippy::rc_buffer", + "-Wclippy::rc_mutex", + "-Wclippy::same_name_method", + + "-Aclippy::default_constructed_unit_structs", +] # To be able to run unit tests on Linux, support compilation to 'x86_64-unknown-linux-gnu'. [target.'cfg(target_os = "linux")'] @@ -8,4 +36,7 @@ rustflags = ["-C", "link-args=-Wl,--warn-unresolved-symbols"] # To be able to run unit tests on Windows, support compilation to 'x86_64-pc-windows-msvc'. [target.'cfg(target_os = "windows")'] -rustflags = ["-C", "link-args=/FORCE"] \ No newline at end of file +rustflags = ["-C", "link-args=/FORCE"] + +[target.x86_64-apple-darwin] +rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"] diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml deleted file mode 100644 index b2e6c81..0000000 --- a/.github/workflows/CI.yml +++ /dev/null @@ -1,288 +0,0 @@ -name: CI -env: - DEBUG: napi:* - APP_NAME: css-modules-hash - MACOSX_DEPLOYMENT_TARGET: '10.13' -permissions: - contents: write - id-token: write -'on': - push: - branches: - - master - tags-ignore: - - '**' - paths-ignore: - - '**/*.md' - - LICENSE - - '**/*.gitignore' - - .editorconfig - - docs/** - pull_request: null -jobs: - build: - strategy: - fail-fast: false - matrix: - settings: - - host: macos-latest - target: x86_64-apple-darwin - build: | - yarn build - strip -x *.node - - host: windows-latest - build: yarn build - target: x86_64-pc-windows-msvc - - host: ubuntu-latest - target: x86_64-unknown-linux-gnu - docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian - build: |- - set -e && - yarn build --target x86_64-unknown-linux-gnu && - strip *.node - - host: ubuntu-latest - target: x86_64-unknown-linux-musl - docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine - build: set -e && yarn build && strip *.node - - host: macos-latest - target: aarch64-apple-darwin - build: | - yarn build --target aarch64-apple-darwin - strip -x *.node - - host: windows-latest - target: aarch64-pc-windows-msvc - build: yarn build --target aarch64-pc-windows-msvc - name: stable - ${{ matrix.settings.target }} - node@18 - runs-on: ${{ matrix.settings.host }} - steps: - - uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - if: ${{ !matrix.settings.docker }} - with: - node-version: 18 - check-latest: true - cache: yarn - - name: Install - uses: dtolnay/rust-toolchain@stable - if: ${{ !matrix.settings.docker }} - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - .cargo-cache - target/ - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} - - uses: goto-bus-stop/setup-zig@v2 - if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} - with: - version: 0.10.1 - - name: Setup toolchain - run: ${{ matrix.settings.setup }} - if: ${{ matrix.settings.setup }} - shell: bash - - name: Install dependencies - run: yarn install - - name: Build in docker - uses: addnab/docker-run-action@v3 - if: ${{ matrix.settings.docker }} - with: - image: ${{ matrix.settings.docker }} - options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build' - run: ${{ matrix.settings.build }} - - name: Build - run: ${{ matrix.settings.build }} - if: ${{ !matrix.settings.docker }} - shell: bash - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: bindings-${{ matrix.settings.target }} - path: ${{ env.APP_NAME }}.*.node - if-no-files-found: error - test-macOS-windows-binding: - name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} - needs: - - build - strategy: - fail-fast: false - matrix: - settings: - - host: macos-latest - target: x86_64-apple-darwin - - host: windows-latest - target: x86_64-pc-windows-msvc - node: - - '14' - - '16' - - '18' - runs-on: ${{ matrix.settings.host }} - steps: - - uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - check-latest: true - cache: yarn - - name: Install dependencies - run: yarn install - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: bindings-${{ matrix.settings.target }} - path: . - - name: List packages - run: ls -R . - shell: bash - - name: Test bindings - run: yarn test - test-linux-x64-gnu-binding: - name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} - needs: - - build - strategy: - fail-fast: false - matrix: - node: - - '14' - - '16' - - '18' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - check-latest: true - cache: yarn - - name: Install dependencies - run: yarn install - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: bindings-x86_64-unknown-linux-gnu - path: . - - name: List packages - run: ls -R . - shell: bash - - name: Test bindings - run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test - test-linux-x64-musl-binding: - name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} - needs: - - build - strategy: - fail-fast: false - matrix: - node: - - '14' - - '16' - - '18' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - check-latest: true - cache: yarn - - name: Install dependencies - run: | - yarn config set supportedArchitectures.libc "musl" - yarn install - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: bindings-x86_64-unknown-linux-musl - path: . - - name: List packages - run: ls -R . - shell: bash - - name: Test bindings - run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test - universal-macOS: - name: Build universal macOS binary - needs: - - build - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 18 - check-latest: true - cache: yarn - - name: Install dependencies - run: yarn install - - name: Download macOS x64 artifact - uses: actions/download-artifact@v3 - with: - name: bindings-x86_64-apple-darwin - path: artifacts - - name: Download macOS arm64 artifact - uses: actions/download-artifact@v3 - with: - name: bindings-aarch64-apple-darwin - path: artifacts - - name: Combine binaries - run: yarn universal - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: bindings-universal-apple-darwin - path: ${{ env.APP_NAME }}.*.node - if-no-files-found: error - publish: - name: Publish - runs-on: ubuntu-latest - needs: - - test-macOS-windows-binding - - test-linux-x64-gnu-binding - - test-linux-x64-musl-binding - - universal-macOS - steps: - - uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 18 - check-latest: true - cache: yarn - - name: Install dependencies - run: yarn install - - name: Download all artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - name: Move artifacts - run: yarn artifacts - - name: List packages - run: ls -R ./npm - shell: bash - - name: Publish - run: | - npm config set provenance true - if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; - then - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - npm publish --access public - elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+"; - then - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - npm publish --tag next --access public - else - echo "Not a release, skipping publish" - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index a2b5be1..dff4d30 100644 --- a/.gitignore +++ b/.gitignore @@ -121,7 +121,7 @@ dist .AppleDouble .LSOverride -# Icon must end with two +# Icon must end with two Icon @@ -195,3 +195,6 @@ Cargo.lock !.yarn/versions *.node + +.rspack_crates/ +node_modules/ \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 033701c..e8df955 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,25 +1,99 @@ -[package] -edition = "2021" -name = "ice_css-modules-hash" -version = "0.0.0" +[workspace] +members = [ + "crates/.rspack_crates/*", + "crates/binding_options", + "crates/node_binding", + "crates/loader_compilation", + "crates/plugin_manifest" +] +resolver = "2" -[lib] -crate-type = ["cdylib"] - -[dependencies] +[workspace.dependencies] +anyhow = { version = "1.0.75" } +async-trait = { version = "0.1.71" } +better_scoped_tls = { version = "0.1.1" } +derivative = { version = "2.2.0" } +glob = { version = "0.3.1" } # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix -napi = { version = "2.12.2", default-features = false, features = ["napi4"] } -napi-derive = "2.12.2" -data-encoding = { version = "2.4.0" } -md4 = "0.10.2" -smol_str = { version = "*" } -xxhash-rust = { version = "0.8.6", features = ["xxh3"] } -once_cell = { version = "1.18.0" } -regex = { version = "1.9.1" } -swc_atoms = { version = "0.5.8" } +napi = "2.12.2" +napi-derive = "2.12.2" +napi-build = "2.0.1" +rustc-hash = { version = "1.1.0" } +serde = { version = "1.0.171" } +serde_json = { version = "1.0.100" } +tokio = { version = "1.29.1" } +tracing = { version = "0.1.37" } +async-recursion = { version = "1.0.4" } +async-scoped = { version = "0.7.1" } +backtrace = "0.3" +bitflags = { version = "1.3.2" } +colored = { version = "2.0.4" } +concat-string = "1.0.1" +dashmap = { version = "5.5.0" } +derive_builder = { version = "0.11.2" } +futures = { version = "0.3.28" } +futures-util = { version = "0.3.28" } +hashlink = { version = "0.8.3" } +indexmap = { version = "1.9.3" } +insta = { version = "1.30.0" } +itertools = { version = "0.10.5" } +json = { version = "0.12.4" } +linked_hash_set = { version = "0.1.4" } +mimalloc-rust = { version = "0.2" } +mime_guess = { version = "2.0.4" } +once_cell = { version = "1.18.0" } +paste = { version = "1.0" } +pathdiff = { version = "0.2.1" } +preset_env_base = { version = "0.4.5" } +rayon = { version = "1.7.0" } +regex = { version = "1.9.1" } +rkyv = { version = "0.7.42" } +rspack_sources = { version = "0.2.7" } +schemars = { version = "0.8.12" } +similar = { version = "2.2.1" } +sugar_path = { version = "0.0.12" } +testing_macros = { version = "0.2.11" } +tracing-subscriber = { version = "0.3.17" } +url = { version = "2.4.0" } +urlencoding = { version = "2.1.2" } +ustr = { version = "0.9.0" } +xxhash-rust = { version = "0.8.6" } + +napi-sys = { version = "=2.2.3" } +styled_components = { version = "=0.72.0" } +swc_config = { version = "=0.1.7" } +swc_core = { version = "=0.83.1", default-features = false } +swc_css = { version = "=0.155.2" } +swc_ecma_minifier = { version = "=0.187.0", default-features = false } +swc_emotion = { version = "=0.42.0" } +swc_error_reporters = { version = "=0.16.1" } +swc_html = { version = "=0.131.0" } +swc_html_minifier = { version = "=0.128.0" } +swc_node_comments = { version = "=0.19.1" } +tikv-jemallocator = { version = "=0.5.4", features = ["disable_initial_exec_tls"] } + +[patch.crates-io] +swc_config = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_core = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_ecma_minifier = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_error_reporters = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_html = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_html_minifier = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_node_comments = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_common = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_ecma_utils = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_ecma_ast = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_ecma_visit = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_atoms = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +preset_env_base = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -[build-dependencies] -napi-build = "2.0.1" +[profile.dev] +debug = 2 +incremental = true [profile.release] -lto = true +codegen-units = 1 +debug = false +lto = false # disabled by now, because it will significantly increase our compile time. +opt-level = 3 +strip = true diff --git a/README.md b/README.md deleted file mode 100644 index c3dd4b2..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# awesome-ice diff --git a/__test__/index.spec.mjs b/__test__/index.spec.mjs deleted file mode 100644 index 1a95748..0000000 --- a/__test__/index.spec.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import test from 'ava' - -import { getCssModulesLocalIdent } from '../index.js' - -test('template [hash]', (t) => { - t.is(getCssModulesLocalIdent('src/pages/index.module.css', 'test' ,'[hash]'), '_58deea1c54f94c19c993'); -}) -test('template [path][name][ext]__[local]', (t) => { - t.is(getCssModulesLocalIdent('src/pages/index.module.css', 'test' ,'[path][name][ext]__[local]'), 'src-pages-index-module-css__test'); -}) \ No newline at end of file diff --git a/crates/binding_options/Cargo.toml b/crates/binding_options/Cargo.toml new file mode 100644 index 0000000..6f13b5a --- /dev/null +++ b/crates/binding_options/Cargo.toml @@ -0,0 +1,59 @@ +[package] +name = "binding_options" +version = "0.1.0" +edition = "2021" + +[dependencies] +rspack_binding_macros = { path = "../.rspack_crates/rspack_binding_macros" } +rspack_binding_options = { path = "../.rspack_crates/rspack_binding_options" } +rspack_core = { path = "../.rspack_crates/rspack_core" } +rspack_error = { path = "../.rspack_crates/rspack_error" } +rspack_identifier = { path = "../.rspack_crates/rspack_identifier" } +rspack_ids = { path = "../.rspack_crates/rspack_ids" } +rspack_loader_react_refresh = { path = "../.rspack_crates/rspack_loader_react_refresh" } +rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" } +rspack_loader_sass = { path = "../.rspack_crates/rspack_loader_sass" } +rspack_loader_swc = { path = "../.rspack_crates/rspack_loader_swc" } +rspack_napi_shared = { path = "../.rspack_crates/rspack_napi_shared" } +rspack_plugin_asset = { path = "../.rspack_crates/rspack_plugin_asset" } +rspack_plugin_banner = { path = "../.rspack_crates/rspack_plugin_banner" } +rspack_plugin_copy = { path = "../.rspack_crates/rspack_plugin_copy" } +rspack_plugin_css = { path = "../.rspack_crates/rspack_plugin_css" } +rspack_plugin_dev_friendly_split_chunks = { path = "../.rspack_crates/rspack_plugin_dev_friendly_split_chunks" } +rspack_plugin_devtool = { path = "../.rspack_crates/rspack_plugin_devtool" } +rspack_plugin_ensure_chunk_conditions = { path = "../.rspack_crates/rspack_plugin_ensure_chunk_conditions" } +rspack_plugin_entry = { path = "../.rspack_crates/rspack_plugin_entry" } +rspack_plugin_externals = { path = "../.rspack_crates/rspack_plugin_externals" } +rspack_plugin_hmr = { path = "../.rspack_crates/rspack_plugin_hmr" } +rspack_plugin_html = { path = "../.rspack_crates/rspack_plugin_html" } +rspack_plugin_javascript = { path = "../.rspack_crates/rspack_plugin_javascript" } +rspack_plugin_json = { path = "../.rspack_crates/rspack_plugin_json" } +rspack_plugin_library = { path = "../.rspack_crates/rspack_plugin_library" } +rspack_plugin_progress = { path = "../.rspack_crates/rspack_plugin_progress" } +rspack_plugin_real_content_hash = { path = "../.rspack_crates/rspack_plugin_real_content_hash" } +rspack_plugin_remove_empty_chunks = { path = "../.rspack_crates/rspack_plugin_remove_empty_chunks" } +rspack_plugin_runtime = { path = "../.rspack_crates/rspack_plugin_runtime" } +rspack_plugin_schemes = { path = "../.rspack_crates/rspack_plugin_schemes" } +rspack_plugin_split_chunks = { path = "../.rspack_crates/rspack_plugin_split_chunks" } +rspack_plugin_split_chunks_new = { path = "../.rspack_crates/rspack_plugin_split_chunks_new" } +rspack_plugin_swc_css_minimizer = { path = "../.rspack_crates/rspack_plugin_swc_css_minimizer" } +rspack_plugin_swc_js_minimizer = { path = "../.rspack_crates/rspack_plugin_swc_js_minimizer" } +rspack_plugin_wasm = { path = "../.rspack_crates/rspack_plugin_wasm" } +rspack_plugin_worker = { path = "../.rspack_crates/rspack_plugin_worker" } +rspack_regex = { path = "../.rspack_crates/rspack_regex" } +rspack_swc_visitors = { path = "../.rspack_crates/rspack_swc_visitors" } +loader_compilation = { path = "../loader_compilation" } +plugin_manifest = { path = "../plugin_manifest" } + +anyhow = { workspace = true, features = ["backtrace"] } +async-trait = { workspace = true } +better_scoped_tls = { workspace = true } +derivative = { workspace = true } +glob = { workspace = true } +napi = { workspace = true, features = ["async", "tokio_rt", "serde-json", "anyhow"] } +napi-derive = { workspace = true } +rustc-hash = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros", "test-util", "parking_lot"] } +tracing = { workspace = true } diff --git a/crates/binding_options/src/lib.rs b/crates/binding_options/src/lib.rs new file mode 100644 index 0000000..4e0c9dc --- /dev/null +++ b/crates/binding_options/src/lib.rs @@ -0,0 +1,2 @@ +mod options; +pub use options::*; diff --git a/crates/binding_options/src/options/js_loader.rs b/crates/binding_options/src/options/js_loader.rs new file mode 100644 index 0000000..98ee634 --- /dev/null +++ b/crates/binding_options/src/options/js_loader.rs @@ -0,0 +1,90 @@ +use std::{ + path::{Path, PathBuf}, + str::FromStr, +}; +use napi::bindgen_prelude::*; +use rspack_core::{ + rspack_sources::SourceMap, + LoaderContext, Content, ResourceData, +}; +use rustc_hash::FxHashSet as HashSet; +use rspack_binding_options::JsLoaderContext; +use crate::get_builtin_loader; + +pub async fn run_builtin_loader( + builtin: String, + options: Option<&str>, + loader_context: JsLoaderContext, +) -> Result { + use rspack_loader_runner::__private::loader::LoaderItemList; + + let loader = get_builtin_loader(&builtin, options); + let loader_item = loader.clone().into(); + let list = &[loader_item]; + + let mut cx = LoaderContext { + content: loader_context + .content + .map(|c| Content::from(c.as_ref().to_owned())), + resource: &loader_context.resource, + resource_path: Path::new(&loader_context.resource_path), + resource_query: loader_context.resource_query.as_deref(), + resource_fragment: loader_context.resource_fragment.as_deref(), + context: loader_context.context.clone(), + source_map: loader_context + .source_map + .map(|s| SourceMap::from_slice(s.as_ref())) + .transpose() + .map_err(|e| Error::from_reason(e.to_string()))?, + additional_data: loader_context + .additional_data + .map(|b| String::from_utf8_lossy(b.as_ref()).to_string()), + cacheable: loader_context.cacheable, + file_dependencies: HashSet::from_iter( + loader_context + .file_dependencies + .iter() + .map(|m| PathBuf::from_str(m).expect("Should convert to path")), + ), + context_dependencies: HashSet::from_iter( + loader_context + .context_dependencies + .iter() + .map(|m| PathBuf::from_str(m).expect("Should convert to path")), + ), + missing_dependencies: HashSet::from_iter( + loader_context + .missing_dependencies + .iter() + .map(|m| PathBuf::from_str(m).expect("Should convert to path")), + ), + build_dependencies: HashSet::from_iter( + loader_context + .build_dependencies + .iter() + .map(|m| PathBuf::from_str(m).expect("Should convert to path")), + ), + asset_filenames: HashSet::from_iter(loader_context.asset_filenames.into_iter()), + // Initialize with no diagnostic + __diagnostics: vec![], + __resource_data: &ResourceData::new(Default::default(), Default::default()), + __loader_items: LoaderItemList(list), + __loader_index: 0, + __plugins: &[], + }; + if loader_context.is_pitching { + // Run pitching loader + loader + .pitch(&mut cx) + .await + .map_err(|e| Error::from_reason(e.to_string()))?; + } else { + // Run normal loader + loader + .run(&mut cx) + .await + .map_err(|e| Error::from_reason(e.to_string()))?; + } + + JsLoaderContext::try_from(&cx).map_err(|e| Error::from_reason(e.to_string())) +} \ No newline at end of file diff --git a/crates/binding_options/src/options/mod.rs b/crates/binding_options/src/options/mod.rs new file mode 100644 index 0000000..786396a --- /dev/null +++ b/crates/binding_options/src/options/mod.rs @@ -0,0 +1,168 @@ +use napi_derive::napi; +use better_scoped_tls::scoped_tls; +use rspack_core::{ + BoxPlugin, CompilerOptions, Context, DevServerOptions, Devtool, Experiments, IncrementalRebuild, + IncrementalRebuildMakeState, ModuleOptions, ModuleType, OutputOptions, PluginExt, +}; +use rspack_binding_options::{ + RawBuiltins, RawCacheOptions, RawContext, RawDevServer, RawDevtool, RawExperiments, + RawMode, RawNodeOption, RawOptimizationOptions, RawOutputOptions, RawResolveOptions, + RawSnapshotOptions, RawStatsOptions, RawTarget, RawOptionsApply, RawModuleOptions, +}; +use rspack_plugin_javascript::{FlagDependencyExportsPlugin, FlagDependencyUsagePlugin}; +use serde::Deserialize; + +mod raw_module; +mod js_loader; + +pub use raw_module::*; +pub use js_loader::*; + +scoped_tls!(pub(crate) static IS_ENABLE_NEW_SPLIT_CHUNKS: bool); + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +#[napi(object)] +pub struct RSPackRawOptions { + #[napi(ts_type = "undefined | 'production' | 'development' | 'none'")] + pub mode: Option, + #[napi(ts_type = "Array")] + pub target: RawTarget, + #[napi(ts_type = "string")] + pub context: RawContext, + pub output: RawOutputOptions, + pub resolve: RawResolveOptions, + pub resolve_loader: RawResolveOptions, + pub module: RawModuleOptions, + #[napi(ts_type = "string")] + pub devtool: RawDevtool, + pub optimization: RawOptimizationOptions, + pub stats: RawStatsOptions, + pub dev_server: RawDevServer, + pub snapshot: RawSnapshotOptions, + pub cache: RawCacheOptions, + pub experiments: RawExperiments, + pub node: Option, + pub profile: bool, + pub builtins: RawBuiltins, +} + +impl RawOptionsApply for RSPackRawOptions { + type Options = CompilerOptions; + + fn apply(self, plugins: &mut Vec) -> Result { + let context: Context = self.context.into(); + let output: OutputOptions = self.output.apply(plugins)?; + let resolve = self.resolve.try_into()?; + let resolve_loader = self.resolve_loader.try_into()?; + let devtool: Devtool = self.devtool.into(); + let mode = self.mode.unwrap_or_default().into(); + let module: ModuleOptions = self.module.apply(plugins)?; + let target = self.target.apply(plugins)?; + let cache = self.cache.into(); + let experiments = Experiments { + lazy_compilation: self.experiments.lazy_compilation, + incremental_rebuild: IncrementalRebuild { + make: self + .experiments + .incremental_rebuild + .make + .then(IncrementalRebuildMakeState::default), + emit_asset: self.experiments.incremental_rebuild.emit_asset, + }, + async_web_assembly: self.experiments.async_web_assembly, + new_split_chunks: self.experiments.new_split_chunks, + rspack_future: self.experiments.rspack_future.into(), + }; + let optimization = IS_ENABLE_NEW_SPLIT_CHUNKS.set(&experiments.new_split_chunks, || { + self.optimization.apply(plugins) + })?; + let stats = self.stats.into(); + let snapshot = self.snapshot.into(); + let node = self.node.map(|n| n.into()); + let dev_server: DevServerOptions = self.dev_server.into(); + + plugins.push(rspack_plugin_schemes::DataUriPlugin.boxed()); + plugins.push(rspack_plugin_schemes::FileUriPlugin.boxed()); + + plugins.push( + rspack_plugin_asset::AssetPlugin::new(rspack_plugin_asset::AssetConfig { + parse_options: module + .parser + .as_ref() + .and_then(|x| x.get(&ModuleType::Asset)) + .and_then(|x| x.get_asset(&ModuleType::Asset).cloned()), + }) + .boxed(), + ); + plugins.push(rspack_plugin_json::JsonPlugin {}.boxed()); + plugins.push(rspack_plugin_runtime::RuntimePlugin {}.boxed()); + if experiments.lazy_compilation { + plugins.push(rspack_plugin_runtime::LazyCompilationPlugin {}.boxed()); + } + if experiments.async_web_assembly { + plugins.push(rspack_plugin_wasm::AsyncWasmPlugin::new().boxed()); + } + rspack_plugin_worker::worker_plugin( + output.worker_chunk_loading.clone(), + output.worker_wasm_loading.clone(), + plugins, + ); + plugins.push(rspack_plugin_javascript::JsPlugin::new().boxed()); + plugins.push(rspack_plugin_javascript::InferAsyncModulesPlugin {}.boxed()); + + if devtool.source_map() { + plugins.push( + rspack_plugin_devtool::DevtoolPlugin::new(rspack_plugin_devtool::DevtoolPluginOptions { + inline: devtool.inline(), + append: !devtool.hidden(), + namespace: output.unique_name.clone(), + columns: !devtool.cheap(), + no_sources: devtool.no_sources(), + public_path: None, + }) + .boxed(), + ); + } + + plugins.push(rspack_ids::NamedChunkIdsPlugin::new(None, None).boxed()); + + if experiments.rspack_future.new_treeshaking { + if optimization.provided_exports { + plugins.push(FlagDependencyExportsPlugin::default().boxed()); + } + if optimization.used_exports.is_enable() { + plugins.push(FlagDependencyUsagePlugin::default().boxed()); + } + } + + // Notice the plugin need to be placed after SplitChunksPlugin + if optimization.remove_empty_chunks { + plugins.push(rspack_plugin_remove_empty_chunks::RemoveEmptyChunksPlugin.boxed()); + } + + plugins.push(rspack_plugin_ensure_chunk_conditions::EnsureChunkConditionsPlugin.boxed()); + + plugins.push(plugin_manifest::ManifestPlugin::new().boxed()); + + Ok(Self::Options { + context, + mode, + module, + target, + output, + resolve, + resolve_loader, + devtool, + experiments, + stats, + cache, + snapshot, + optimization, + node, + dev_server, + profile: self.profile, + builtins: self.builtins.apply(plugins)?, + }) + } +} diff --git a/crates/binding_options/src/options/raw_module.rs b/crates/binding_options/src/options/raw_module.rs new file mode 100644 index 0000000..4cc8e18 --- /dev/null +++ b/crates/binding_options/src/options/raw_module.rs @@ -0,0 +1,40 @@ +use std::sync::Arc; +use rspack_core::BoxLoader; +use rspack_loader_react_refresh::REACT_REFRESH_LOADER_IDENTIFIER; +use rspack_loader_sass::SASS_LOADER_IDENTIFIER; +use rspack_loader_swc::SWC_LOADER_IDENTIFIER; +use loader_compilation::COMPILATION_LOADER_IDENTIFIER; + +pub fn get_builtin_loader(builtin: &str, options: Option<&str>) -> BoxLoader { + if builtin.starts_with(SASS_LOADER_IDENTIFIER) { + return Arc::new(rspack_loader_sass::SassLoader::new( + serde_json::from_str(options.unwrap_or("{}")).unwrap_or_else(|e| { + panic!("Could not parse builtin:sass-loader options: {options:?}, error: {e:?}") + }), + )); + } + + if builtin.starts_with(SWC_LOADER_IDENTIFIER) { + return Arc::new( + rspack_loader_swc::SwcLoader::new( + serde_json::from_str(options.unwrap_or("{}")).unwrap_or_else(|e| { + panic!("Could not parse builtin:swc-loader options:{options:?},error: {e:?}") + }), + ) + .with_identifier(builtin.into()), + ); + } + if builtin.starts_with(REACT_REFRESH_LOADER_IDENTIFIER) { + return Arc::new( + rspack_loader_react_refresh::ReactRefreshLoader::default().with_identifier(builtin.into()), + ); + } + + if builtin.starts_with(COMPILATION_LOADER_IDENTIFIER) { + return Arc::new( + loader_compilation::CompilationLoader::default().with_identifier(builtin.into()), + ); + } + + unreachable!("Unexpected builtin loader: {builtin}") +} \ No newline at end of file diff --git a/crates/loader_compilation/Cargo.toml b/crates/loader_compilation/Cargo.toml new file mode 100644 index 0000000..44235fd --- /dev/null +++ b/crates/loader_compilation/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "loader_compilation" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow = { workspace = true } +async-trait = { workspace = true } +either = "1" +once_cell = { workspace = true } +rspack_core = { path = "../.rspack_crates/rspack_core" } +rspack_error = { path = "../.rspack_crates/rspack_error" } +rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" } +serde = { workspace = true, features = ["derive"] } +serde_json = "1.0.100" +swc_config = { workspace = true } +swc_core = { workspace = true, features = [ + "base", + "ecma_ast", + "common" +] } +swc_emotion = { workspace = true } +xxhash-rust = { workspace = true, features = ["xxh32"] } + +[dev-dependencies] +indexmap = { workspace = true } +tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros", "test-util", "parking_lot"] } \ No newline at end of file diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs new file mode 100644 index 0000000..34570bc --- /dev/null +++ b/crates/loader_compilation/src/lib.rs @@ -0,0 +1,49 @@ +use rspack_core::{rspack_sources::SourceMap, LoaderRunnerContext, Mode}; +use rspack_loader_runner::{Identifiable, Identifier, Loader, LoaderContext}; +use rspack_error::{ + internal_error, Diagnostic, DiagnosticKind, Error, InternalError, Result, Severity, + TraceableError, +}; + +pub struct CompilationLoader { + identifier: Identifier, +} + +impl Default for CompilationLoader { + fn default() -> Self { + Self { + identifier: COMPILATION_LOADER_IDENTIFIER.into(), + } + } +} + +impl CompilationLoader { + pub fn with_identifier(mut self, identifier: Identifier) -> Self { + assert!(identifier.starts_with(COMPILATION_LOADER_IDENTIFIER)); + self.identifier = identifier; + self + } +} + +#[async_trait::async_trait] +impl Loader for CompilationLoader { + async fn run(&self, loader_context: &mut LoaderContext<'_, LoaderRunnerContext>) -> Result<()> { + let Some(content) = std::mem::take(&mut loader_context.content) else { + return Err(internal_error!("No content found")); + }; + let mut source = content.try_into_string()?; + source += r#" +window.__custom_code__ = true; +"#; + loader_context.content = Some(source.into()); + Ok(()) + } +} + +pub const COMPILATION_LOADER_IDENTIFIER: &str = "builtin:compilation-loader"; + +impl Identifiable for CompilationLoader { + fn identifier(&self) -> Identifier { + self.identifier + } +} \ No newline at end of file diff --git a/crates/loader_compilation/tests/fixtures.rs b/crates/loader_compilation/tests/fixtures.rs new file mode 100644 index 0000000..d99f90b --- /dev/null +++ b/crates/loader_compilation/tests/fixtures.rs @@ -0,0 +1,96 @@ +use std::{str::FromStr,env, fs,path::{Path, PathBuf}, sync::Arc}; +use loader_compilation::CompilationLoader; +use rspack_core::{run_loaders, CompilerContext, CompilerOptions, SideEffectOption}; +use rspack_loader_runner::ResourceData; + +async fn loader_test(actual: impl AsRef, expected: impl AsRef) { + let tests_path = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"))).join("tests"); + let actual_path = tests_path.join(actual); + let expected_path = tests_path.join(expected); + let (result, _) = run_loaders( + &[Arc::new(CompilationLoader::default())], + &ResourceData::new(actual_path.to_string_lossy().to_string(), actual_path), + &[], + CompilerContext { + options: std::sync::Arc::new(CompilerOptions { + context: rspack_core::Context::default(), + dev_server: rspack_core::DevServerOptions::default(), + devtool: rspack_core::Devtool::from("source-map".to_string()), + mode: rspack_core::Mode::None, + output: rspack_core::OutputOptions { + clean: false, + path: Default::default(), + public_path: Default::default(), + filename: rspack_core::Filename::from_str("").expect("TODO:"), + asset_module_filename: rspack_core::Filename::from_str("").expect("TODO:"), + wasm_loading: rspack_core::WasmLoading::Disable, + webassembly_module_filename: rspack_core::Filename::from_str("").expect("TODO:"), + chunk_filename: rspack_core::Filename::from_str("").expect("TODO:"), + cross_origin_loading: rspack_core::CrossOriginLoading::Disable, + unique_name: Default::default(), + chunk_loading: rspack_core::ChunkLoading::Enable(rspack_core::ChunkLoadingType::Jsonp), + chunk_loading_global: "webpackChunkwebpack".to_string(), + css_chunk_filename: rspack_core::Filename::from_str("").expect("TODO:"), + css_filename: rspack_core::Filename::from_str("").expect("TODO:"), + hot_update_chunk_filename: rspack_core::Filename::from_str("").expect("Should exist"), + hot_update_main_filename: rspack_core::Filename::from_str("").expect("Should exist"), + hot_update_global: "webpackHotUpdate".to_string(), + library: None, + enabled_library_types: None, + strict_module_error_handling: false, + global_object: "self".to_string(), + import_function_name: "import".to_string(), + iife: true, + module: false, + trusted_types: None, + source_map_filename: rspack_core::Filename::from_str("./a.map.js").expect("TODO:"), + hash_function: rspack_core::HashFunction::Xxhash64, + hash_digest: rspack_core::HashDigest::Hex, + hash_digest_length: 16, + hash_salt: rspack_core::HashSalt::None, + async_chunks: true, + worker_chunk_loading: rspack_core::ChunkLoading::Enable( + rspack_core::ChunkLoadingType::ImportScripts, + ), + worker_wasm_loading: rspack_core::WasmLoading::Disable, + worker_public_path: String::new(), + }, + target: rspack_core::Target::new(&vec![String::from("web")]).expect("TODO:"), + resolve: rspack_core::Resolve::default(), + resolve_loader: rspack_core::Resolve::default(), + builtins: Default::default(), + module: Default::default(), + stats: Default::default(), + cache: Default::default(), + snapshot: Default::default(), + experiments: Default::default(), + node: Default::default(), + optimization: rspack_core::Optimization { + remove_available_modules: false, + remove_empty_chunks: true, + side_effects: SideEffectOption::False, + provided_exports: Default::default(), + used_exports: Default::default(), + }, + profile: false, + }), + resolver_factory: Default::default(), + } + ) + .await + .expect("TODO:") + .split_into_parts(); + + let result = result.content.try_into_string().expect("TODO:"); + if env::var("UPDATE").is_ok() { + fs::write(expected_path, result).expect("TODO:"); + } else { + let expected = fs::read_to_string(expected_path).expect("TODO:"); + assert_eq!(result, expected); + } +} + +#[tokio::test] +async fn basic() { + loader_test("fixtures/basic/input.js", "fixtures/basic/output.js").await; +} \ No newline at end of file diff --git a/crates/loader_compilation/tests/fixtures/basic/input.js b/crates/loader_compilation/tests/fixtures/basic/input.js new file mode 100644 index 0000000..54b82a0 --- /dev/null +++ b/crates/loader_compilation/tests/fixtures/basic/input.js @@ -0,0 +1 @@ +const a = 1; diff --git a/crates/loader_compilation/tests/fixtures/basic/output.js b/crates/loader_compilation/tests/fixtures/basic/output.js new file mode 100644 index 0000000..5442d74 --- /dev/null +++ b/crates/loader_compilation/tests/fixtures/basic/output.js @@ -0,0 +1,3 @@ +const a = 1; + +window.__custom_code__ = true; diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml new file mode 100644 index 0000000..ee18f30 --- /dev/null +++ b/crates/node_binding/Cargo.toml @@ -0,0 +1,39 @@ +[package] +edition = "2021" +name = "ice_pack_binding" +version = "0.0.0" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +rspack_binding_macros = { path = "../.rspack_crates/rspack_binding_macros" } +binding_options = { path = "../binding_options" } +rspack_binding_options = { path = "../.rspack_crates/rspack_binding_options" } +rspack_core = { path = "../.rspack_crates/rspack_core" } +rspack_error = { path = "../.rspack_crates/rspack_error" } +rspack_fs_node = { path = "../.rspack_crates/rspack_fs_node" } +rspack_identifier = { path = "../.rspack_crates/rspack_identifier" } +rspack_napi_shared = { path = "../.rspack_crates/rspack_napi_shared" } +rspack_tracing = { path = "../.rspack_crates/rspack_tracing" } + +async-trait = { workspace = true } +dashmap = { workspace = true } +futures = { workspace = true } +once_cell = { workspace = true } +rustc-hash = { workspace = true } +tracing = { workspace = true } +serde_json = { workspace = true } + +napi = { workspace = true } +napi-derive = { workspace = true } +napi-sys = { workspace = true } + +[target.'cfg(not(target_os = "linux"))'.dependencies] +mimalloc-rust = { workspace = true } + +[target.'cfg(all(target_os = "linux", target_env = "gnu", any(target_arch = "x86_64", target_arch = "aarch64")))'.dependencies] +tikv-jemallocator = { workspace = true } + +[build-dependencies] +napi-build = { workspace = true } diff --git a/build.rs b/crates/node_binding/build.rs similarity index 100% rename from build.rs rename to crates/node_binding/build.rs diff --git a/crates/node_binding/index.d.ts b/crates/node_binding/index.d.ts new file mode 100644 index 0000000..dc3c717 --- /dev/null +++ b/crates/node_binding/index.d.ts @@ -0,0 +1,1097 @@ +/* auto-generated by NAPI-RS */ +/* eslint-disable */ + + +export class ExternalObject { + readonly '': { + readonly '': unique symbol + [K: symbol]: T + } +} +export class JsCompilation { + updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void + getAssets(): Readonly[] + getAsset(name: string): JsAsset | null + getAssetSource(name: string): JsCompatSource | null + getModules(): Array + getChunks(): Array + getNamedChunk(name: string): JsChunk | null + /** + * Only available for those none Js and Css source, + * return true if set module source successfully, false if failed. + */ + setNoneAstModuleSource(moduleIdentifier: string, source: JsCompatSource): boolean + setAssetSource(name: string, source: JsCompatSource): void + deleteAssetSource(name: string): void + getAssetFilenames(): Array + hasAsset(name: string): boolean + emitAsset(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void + deleteAsset(filename: string): void + get entrypoints(): Record + get hash(): string | null + getFileDependencies(): Array + getContextDependencies(): Array + getMissingDependencies(): Array + getBuildDependencies(): Array + pushDiagnostic(severity: "error" | "warning", title: string, message: string): void + pushNativeDiagnostics(diagnostics: ExternalObject>): void + getStats(): JsStats + getAssetPath(filename: string, data: PathData): string + getAssetPathWithInfo(filename: string, data: PathData): PathWithInfo + getPath(filename: string, data: PathData): string + getPathWithInfo(filename: string, data: PathData): PathWithInfo + addFileDependencies(deps: Array): void + addContextDependencies(deps: Array): void + addMissingDependencies(deps: Array): void + addBuildDependencies(deps: Array): void + rebuildModule(moduleIdentifiers: Array, f: (...args: any[]) => any): void +} + +export class JsStats { + getAssets(): JsStatsGetAssets + getModules(reasons: boolean, moduleAssets: boolean, nestedModules: boolean, source: boolean): Array + getChunks(chunkModules: boolean, chunksRelations: boolean, reasons: boolean, moduleAssets: boolean, nestedModules: boolean, source: boolean): Array + getEntrypoints(): Array + getNamedChunkGroups(): Array + getErrors(): Array + getWarnings(): Array + getLogging(acceptedTypes: number): Array + getHash(): string +} + +export class Rspack { + constructor(options: RSPackRawOptions, builtinPlugins: Array, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any) + unsafe_set_disabled_hooks(hooks: Array): void + /** + * Build with the given option passed to the constructor + * + * Warning: + * Calling this method recursively might cause a deadlock. + */ + unsafe_build(callback: (err: null | Error) => void): void + /** + * Rebuild with the given option passed to the constructor + * + * Warning: + * Calling this method recursively will cause a deadlock. + */ + unsafe_rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void + /** + * Get the last compilation + * + * Warning: + * + * Calling this method under the build or rebuild method might cause a deadlock. + * + * **Note** that this method is not safe if you cache the _JsCompilation_ on the Node side, as it will be invalidated by the next build and accessing a dangling ptr is a UB. + */ + unsafe_last_compilation(f: (arg0: JsCompilation) => void): void + /** + * Destroy the compiler + * + * Warning: + * + * Anything related to this compiler will be invalidated after this method is called. + */ + unsafe_drop(): void +} + +export interface AfterResolveData { + request: string + context: string + fileDependencies: Array + contextDependencies: Array + missingDependencies: Array + factoryMeta: FactoryMeta +} + +export interface BeforeResolveData { + request: string + context: string +} + +export interface BuiltinPlugin { + name: BuiltinPluginName + options: unknown +} + +export const enum BuiltinPluginName { + DefinePlugin = 'DefinePlugin', + ProvidePlugin = 'ProvidePlugin', + BannerPlugin = 'BannerPlugin', + ProgressPlugin = 'ProgressPlugin', + EntryPlugin = 'EntryPlugin', + ExternalsPlugin = 'ExternalsPlugin', + NodeTargetPlugin = 'NodeTargetPlugin', + ElectronTargetPlugin = 'ElectronTargetPlugin', + EnableChunkLoadingPlugin = 'EnableChunkLoadingPlugin', + EnableLibraryPlugin = 'EnableLibraryPlugin', + EnableWasmLoadingPlugin = 'EnableWasmLoadingPlugin', + CommonJsChunkFormatPlugin = 'CommonJsChunkFormatPlugin', + ArrayPushCallbackChunkFormatPlugin = 'ArrayPushCallbackChunkFormatPlugin', + ModuleChunkFormatPlugin = 'ModuleChunkFormatPlugin', + HotModuleReplacementPlugin = 'HotModuleReplacementPlugin', + HttpExternalsRspackPlugin = 'HttpExternalsRspackPlugin', + CopyRspackPlugin = 'CopyRspackPlugin', + HtmlRspackPlugin = 'HtmlRspackPlugin', + SwcJsMinimizerRspackPlugin = 'SwcJsMinimizerRspackPlugin', + SwcCssMinimizerRspackPlugin = 'SwcCssMinimizerRspackPlugin' +} + +export function cleanupGlobalTrace(): void + +export interface FactoryMeta { + sideEffectFree?: boolean +} + +export interface JsAsset { + name: string + source?: JsCompatSource + info: JsAssetInfo +} + +export interface JsAssetEmittedArgs { + filename: string + outputPath: string + targetPath: string +} + +export interface JsAssetInfo { + /** if the asset can be long term cached forever (contains a hash) */ + immutable: boolean + /** whether the asset is minimized */ + minimized: boolean + /** + * the value(s) of the full hash used for this asset + * the value(s) of the chunk hash used for this asset + */ + chunkHash: Array + /** + * the value(s) of the module hash used for this asset + * the value(s) of the content hash used for this asset + */ + contentHash: Array + /** + * when asset was created from a source file (potentially transformed), the original filename relative to compilation context + * size in bytes, only set after asset has been emitted + * when asset is only used for development and doesn't count towards user-facing assets + */ + development: boolean + /** when asset ships data for updating an existing application (HMR) */ + hotModuleReplacement: boolean + /** + * when asset is javascript and an ESM + * related object to other assets, keyed by type of relation (only points from parent to child) + */ + related: JsAssetInfoRelated + /** + * the asset version, emit can be skipped when both filename and version are the same + * An empty string means no version, it will always emit + */ + version: string +} + +export interface JsAssetInfoRelated { + sourceMap?: string +} + +export interface JsChunk { + name?: string + files: Array +} + +export interface JsChunkAssetArgs { + chunk: JsChunk + filename: string +} + +export interface JsChunkGroup { + chunks: Array +} + +export interface JsCompatSource { + /** Whether the underlying data structure is a `RawSource` */ + isRaw: boolean + /** Whether the underlying value is a buffer or string */ + isBuffer: boolean + source: Buffer + map?: Buffer +} + +export interface JsHooks { + processAssetsStageAdditional: (...args: any[]) => any + processAssetsStagePreProcess: (...args: any[]) => any + processAssetsStageDerived: (...args: any[]) => any + processAssetsStageAdditions: (...args: any[]) => any + processAssetsStageNone: (...args: any[]) => any + processAssetsStageOptimize: (...args: any[]) => any + processAssetsStageOptimizeCount: (...args: any[]) => any + processAssetsStageOptimizeCompatibility: (...args: any[]) => any + processAssetsStageOptimizeSize: (...args: any[]) => any + processAssetsStageDevTooling: (...args: any[]) => any + processAssetsStageOptimizeInline: (...args: any[]) => any + processAssetsStageSummarize: (...args: any[]) => any + processAssetsStageOptimizeHash: (...args: any[]) => any + processAssetsStageOptimizeTransfer: (...args: any[]) => any + processAssetsStageAnalyse: (...args: any[]) => any + processAssetsStageReport: (...args: any[]) => any + compilation: (...args: any[]) => any + thisCompilation: (...args: any[]) => any + emit: (...args: any[]) => any + assetEmitted: (...args: any[]) => any + afterEmit: (...args: any[]) => any + make: (...args: any[]) => any + optimizeModules: (...args: any[]) => any + optimizeTree: (...args: any[]) => any + optimizeChunkModule: (...args: any[]) => any + beforeCompile: (...args: any[]) => any + afterCompile: (...args: any[]) => any + finishModules: (...args: any[]) => any + finishMake: (...args: any[]) => any + buildModule: (...args: any[]) => any + beforeResolve: (...args: any[]) => any + afterResolve: (...args: any[]) => any + contextModuleBeforeResolve: (...args: any[]) => any + normalModuleFactoryResolveForScheme: (...args: any[]) => any + chunkAsset: (...args: any[]) => any + succeedModule: (...args: any[]) => any + stillValidModule: (...args: any[]) => any +} + +export interface JsLoaderContext { + /** Content maybe empty in pitching stage */ + content?: Buffer + additionalData?: Buffer + sourceMap?: Buffer + resource: string + resourcePath: string + resourceQuery?: string + resourceFragment?: string + cacheable: boolean + fileDependencies: Array + contextDependencies: Array + missingDependencies: Array + buildDependencies: Array + assetFilenames: Array + currentLoader: string + isPitching: boolean + /** + * Internal loader context + * @internal + */ + context: ExternalObject + /** + * Internal loader diagnostic + * @internal + */ + diagnostics: ExternalObject> +} + +export interface JsLoaderResult { + /** Content in pitching stage can be empty */ + content?: Buffer + fileDependencies: Array + contextDependencies: Array + missingDependencies: Array + buildDependencies: Array + sourceMap?: Buffer + additionalData?: Buffer + cacheable: boolean + /** Used to instruct how rust loaders should execute */ + isPitching: boolean +} + +export interface JsModule { + originalSource?: JsCompatSource + resource: string + moduleIdentifier: string +} + +export interface JsResolveForSchemeInput { + resourceData: JsResourceData + scheme: string +} + +export interface JsResolveForSchemeResult { + resourceData: JsResourceData + stop: boolean +} + +export interface JsResourceData { + /** Resource with absolute path, query and fragment */ + resource: string + /** Absolute resource path only */ + path: string + /** Resource query with `?` prefix */ + query?: string + /** Resource fragment with `#` prefix */ + fragment?: string +} + +export interface JsStatsAsset { + type: string + name: string + size: number + chunks: Array + chunkNames: Array + info: JsStatsAssetInfo + emitted: boolean +} + +export interface JsStatsAssetInfo { + development: boolean + hotModuleReplacement: boolean +} + +export interface JsStatsAssetsByChunkName { + name: string + files: Array +} + +export interface JsStatsChunk { + type: string + files: Array + auxiliaryFiles: Array + id: string + entry: boolean + initial: boolean + names: Array + size: number + modules?: Array + parents?: Array + children?: Array + siblings?: Array +} + +export interface JsStatsChunkGroup { + name: string + assets: Array + chunks: Array + assetsSize: number +} + +export interface JsStatsChunkGroupAsset { + name: string + size: number +} + +export interface JsStatsError { + message: string + formatted: string + title: string +} + +export interface JsStatsGetAssets { + assets: Array + assetsByChunkName: Array +} + +export interface JsStatsLogging { + name: string + type: string + args?: Array + trace?: Array +} + +export interface JsStatsMillisecond { + secs: number + subsecMillis: number +} + +export interface JsStatsModule { + type: string + moduleType: string + identifier: string + name: string + id?: string + chunks: Array + size: number + issuer?: string + issuerName?: string + issuerId?: string + issuerPath: Array + nameForCondition?: string + reasons?: Array + assets?: Array + source?: string | Buffer + profile?: JsStatsModuleProfile +} + +export interface JsStatsModuleIssuer { + identifier: string + name: string + id?: string +} + +export interface JsStatsModuleProfile { + factory: JsStatsMillisecond + integration: JsStatsMillisecond + building: JsStatsMillisecond +} + +export interface JsStatsModuleReason { + moduleIdentifier?: string + moduleName?: string + moduleId?: string + type?: string + userRequest?: string +} + +export interface JsStatsWarning { + message: string + formatted: string +} + +export interface NodeFS { + writeFile: (...args: any[]) => any + removeFile: (...args: any[]) => any + mkdir: (...args: any[]) => any + mkdirp: (...args: any[]) => any +} + +export interface PathData { + filename?: string + hash?: string + contentHash?: string + runtime?: string + url?: string + id?: string +} + +export interface PathWithInfo { + path: string + info: JsAssetInfo +} + +export interface RawAssetGeneratorDataUrl { + type: "options" + options?: RawAssetGeneratorDataUrlOptions +} + +export interface RawAssetGeneratorDataUrlOptions { + encoding?: "base64" | "false" | undefined + mimetype?: string +} + +export interface RawAssetGeneratorOptions { + filename?: string + publicPath?: string + dataUrl?: RawAssetGeneratorDataUrl +} + +export interface RawAssetInlineGeneratorOptions { + dataUrl?: RawAssetGeneratorDataUrl +} + +export interface RawAssetParserDataUrl { + type: "options" + options?: RawAssetParserDataUrlOptions +} + +export interface RawAssetParserDataUrlOptions { + maxSize?: number +} + +export interface RawAssetParserOptions { + dataUrlCondition?: RawAssetParserDataUrl +} + +export interface RawAssetResourceGeneratorOptions { + filename?: string + publicPath?: string +} + +export interface RawBannerContent { + type: "string" | "function" + stringPayload?: string + fnPayload?: (...args: any[]) => any +} + +export interface RawBannerContentFnCtx { + hash: string + chunk: JsChunk + filename: string +} + +export interface RawBannerPluginOptions { + banner: RawBannerContent + entryOnly?: boolean + footer?: boolean + raw?: boolean + test?: RawBannerRules + include?: RawBannerRules + exclude?: RawBannerRules +} + +export interface RawBannerRule { + type: "string" | "regexp" + stringMatcher?: string + regexpMatcher?: string +} + +export interface RawBannerRules { + type: "string" | "regexp" | "array" + stringMatcher?: string + regexpMatcher?: string + arrayMatcher?: Array +} + +export interface RawBuiltins { + css?: RawCssPluginConfig + presetEnv?: RawPresetEnv + treeShaking: string + react: RawReactOptions + decorator?: RawDecoratorOptions + noEmitAssets: boolean + emotion?: string + devFriendlySplitChunks: boolean + pluginImport?: Array + relay?: RawRelayConfig +} + +export interface RawCacheGroupOptions { + priority?: number + test?: RegExp | string + idHint?: string + /** What kind of chunks should be selected. */ + chunks?: RegExp | 'async' | 'initial' | 'all' + type?: RegExp | string + minChunks?: number + minSize?: number + maxSize?: number + maxAsyncSize?: number + maxInitialSize?: number + name?: string + reuseExistingChunk?: boolean + enforce?: boolean +} + +export interface RawCacheOptions { + type: string + maxGenerations: number + maxAge: number + profile: boolean + buildDependencies: Array + cacheDirectory: string + cacheLocation: string + name: string + version: string +} + +export interface RawCopyGlobOptions { + caseSensitiveMatch?: boolean + dot?: boolean + ignore?: Array +} + +export interface RawCopyPattern { + from: string + to?: string + context?: string + toType?: string + noErrorOnMissing: boolean + force: boolean + priority: number + globOptions: RawCopyGlobOptions +} + +export interface RawCopyRspackPluginOptions { + patterns: Array +} + +export interface RawCrossOriginLoading { + type: "bool" | "string" + stringPayload?: string + boolPayload?: boolean +} + +export interface RawCssModulesConfig { + localsConvention: "asIs" | "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" + localIdentName: string + exportsOnly: boolean +} + +export interface RawCssPluginConfig { + modules: RawCssModulesConfig +} + +export interface RawDecoratorOptions { + legacy: boolean + emitMetadata: boolean +} + +export interface RawDevServer { + hot: boolean +} + +export interface RawEntryOptions { + name?: string + runtime?: string + chunkLoading?: string + asyncChunks?: boolean + publicPath?: string + baseUri?: string + filename?: string +} + +export interface RawEntryPluginOptions { + context: string + entry: string + options: RawEntryOptions +} + +export interface RawExperiments { + lazyCompilation: boolean + incrementalRebuild: RawIncrementalRebuild + asyncWebAssembly: boolean + newSplitChunks: boolean + css: boolean + rspackFuture: RawRspackFuture +} + +export interface RawExternalItem { + type: "string" | "regexp" | "object" | "function" + stringPayload?: string + regexpPayload?: string + objectPayload?: Record + fnPayload?: (value: any) => any +} + +export interface RawExternalItemFnCtx { + request: string + context: string + dependencyType: string +} + +export interface RawExternalItemFnResult { + externalType?: string + result?: RawExternalItemValue +} + +export interface RawExternalItemValue { + type: "string" | "bool" | "array" | "object" + stringPayload?: string + boolPayload?: boolean + arrayPayload?: Array + objectPayload?: Record> +} + +export interface RawExternalsPluginOptions { + type: string + externals: Array +} + +export interface RawExternalsPresets { + node: boolean + web: boolean + electron: boolean + electronMain: boolean + electronPreload: boolean + electronRenderer: boolean +} + +export interface RawFallbackCacheGroupOptions { + chunks?: RegExp | 'async' | 'initial' | 'all' + minSize?: number + maxSize?: number + maxAsyncSize?: number + maxInitialSize?: number +} + +export interface RawFuncUseCtx { + resource?: string + realResource?: string + resourceQuery?: string + issuer?: string +} + +export interface RawGeneratorOptions { + type: "asset" | "asset/inline" | "asset/resource" | "unknown" + asset?: RawAssetGeneratorOptions + assetInline?: RawAssetInlineGeneratorOptions + assetResource?: RawAssetResourceGeneratorOptions +} + +export interface RawHtmlRspackPluginOptions { + /** emitted file name in output path */ + filename?: string + /** template html file */ + template?: string + templateContent?: string + templateParameters?: Record + /** "head", "body" or "false" */ + inject: "head" | "body" | "false" + /** path or `auto` */ + publicPath?: string + /** `blocking`, `defer`, or `module` */ + scriptLoading: "blocking" | "defer" | "module" + /** entry_chunk_name (only entry chunks are supported) */ + chunks?: Array + excludedChunks?: Array + sri?: "sha256" | "sha384" | "sha512" + minify?: boolean + title?: string + favicon?: string + meta?: Record> +} + +export interface RawHttpExternalsRspackPluginOptions { + css: boolean + webAsync: boolean +} + +export interface RawIncrementalRebuild { + make: boolean + emitAsset: boolean +} + +export interface RawLibraryAuxiliaryComment { + root?: string + commonjs?: string + commonjs2?: string + amd?: string +} + +export interface RawLibraryName { + amd?: string + commonjs?: string + root?: Array +} + +export interface RawLibraryOptions { + name?: RawLibraryName + export?: Array + libraryType: string + umdNamedDefine?: boolean + auxiliaryComment?: RawLibraryAuxiliaryComment +} + +export interface RawModuleOptions { + rules: Array + parser?: Record + generator?: Record +} + +export interface RawModuleRule { + /** + * A conditional match matching an absolute path + query + fragment. + * Note: + * This is a custom matching rule not initially designed by webpack. + * Only for single-threaded environment interoperation purpose. + */ + rspackResource?: RawRuleSetCondition + /** A condition matcher matching an absolute path. */ + test?: RawRuleSetCondition + include?: RawRuleSetCondition + exclude?: RawRuleSetCondition + /** A condition matcher matching an absolute path. */ + resource?: RawRuleSetCondition + /** A condition matcher against the resource query. */ + resourceQuery?: RawRuleSetCondition + resourceFragment?: RawRuleSetCondition + descriptionData?: Record + sideEffects?: boolean + use?: RawModuleRuleUses + type?: string + parser?: RawParserOptions + generator?: RawGeneratorOptions + resolve?: RawResolveOptions + issuer?: RawRuleSetCondition + dependency?: RawRuleSetCondition + scheme?: RawRuleSetCondition + mimetype?: RawRuleSetCondition + oneOf?: Array + rules?: Array + /** Specifies the category of the loader. No value means normal loader. */ + enforce?: 'pre' | 'post' +} + +/** + * `loader` is for both JS and Rust loaders. + * `options` is + * - a `None` on rust side and handled by js side `getOptions` when + * using with `loader`. + * - a `Some(string)` on rust side, deserialized by `serde_json::from_str` + * and passed to rust side loader in [get_builtin_loader] when using with + * `builtin_loader`. + */ +export interface RawModuleRuleUse { + loader: string + options?: string +} + +export interface RawModuleRuleUses { + type: "array" | "function" + arrayUse?: Array + funcUse?: (...args: any[]) => any +} + +export interface RawNodeOption { + dirname: string + filename: string + global: string +} + +export interface RawOptimizationOptions { + splitChunks?: RawSplitChunksOptions + moduleIds: string + chunkIds: string + removeAvailableModules: boolean + removeEmptyChunks: boolean + sideEffects: string + usedExports: string + providedExports: boolean + realContentHash: boolean +} + +export interface RawOptions { + mode?: undefined | 'production' | 'development' | 'none' + target: Array + context: string + output: RawOutputOptions + resolve: RawResolveOptions + resolveLoader: RawResolveOptions + module: RawModuleOptions + devtool: string + optimization: RawOptimizationOptions + stats: RawStatsOptions + devServer: RawDevServer + snapshot: RawSnapshotOptions + cache: RawCacheOptions + experiments: RawExperiments + node?: RawNodeOption + profile: boolean + builtins: RawBuiltins +} + +export interface RawOutputOptions { + path: string + clean: boolean + publicPath: string + assetModuleFilename: string + wasmLoading: string + enabledWasmLoadingTypes: Array + webassemblyModuleFilename: string + filename: string + chunkFilename: string + crossOriginLoading: RawCrossOriginLoading + cssFilename: string + cssChunkFilename: string + hotUpdateMainFilename: string + hotUpdateChunkFilename: string + hotUpdateGlobal: string + uniqueName: string + chunkLoadingGlobal: string + library?: RawLibraryOptions + strictModuleErrorHandling: boolean + enabledLibraryTypes?: Array + globalObject: string + importFunctionName: string + iife: boolean + module: boolean + chunkLoading: string + enabledChunkLoadingTypes?: Array + trustedTypes?: RawTrustedTypes + sourceMapFilename: string + hashFunction: string + hashDigest: string + hashDigestLength: number + hashSalt?: string + asyncChunks: boolean + workerChunkLoading: string + workerWasmLoading: string + workerPublicPath: string +} + +export interface RawParserOptions { + type: "asset" | "unknown" + asset?: RawAssetParserOptions +} + +export interface RawPluginImportConfig { + libraryName: string + libraryDirectory?: string + customName?: string + customStyleName?: string + style?: RawStyleConfig + camelToDashComponentName?: boolean + transformToDefaultImport?: boolean + ignoreEsComponent?: Array + ignoreStyleComponent?: Array +} + +export interface RawPresetEnv { + targets: Array + mode?: 'usage' | 'entry' + coreJs?: string +} + +export interface RawProgressPluginOptions { + prefix?: string +} + +export interface RawReactOptions { + runtime?: "automatic" | "classic" + importSource?: string + pragma?: string + pragmaFrag?: string + throwIfNamespace?: boolean + development?: boolean + useBuiltins?: boolean + useSpread?: boolean + refresh?: boolean +} + +export interface RawRelayConfig { + artifactDirectory?: string + language: 'javascript' | 'typescript' | 'flow' +} + +export interface RawResolveOptions { + preferRelative?: boolean + extensions?: Array + mainFiles?: Array + mainFields?: Array + browserField?: boolean + conditionNames?: Array + alias?: Record> + fallback?: Record> + symlinks?: boolean + tsConfigPath?: string + modules?: Array + byDependency?: Record + fullySpecified?: boolean + exportsFields?: Array + extensionAlias?: Record> +} + +export interface RawRspackFuture { + newResolver: boolean + newTreeshaking: boolean + disableTransformByDefault: boolean +} + +export interface RawRuleSetCondition { + type: "string" | "regexp" | "logical" | "array" | "function" + stringMatcher?: string + regexpMatcher?: string + logicalMatcher?: Array + arrayMatcher?: Array + funcMatcher?: (value: string) => boolean +} + +export interface RawRuleSetLogicalConditions { + and?: Array + or?: Array + not?: RawRuleSetCondition +} + +export interface RawSnapshotOptions { + resolve: RawSnapshotStrategy + module: RawSnapshotStrategy +} + +export interface RawSnapshotStrategy { + hash: boolean + timestamp: boolean +} + +export interface RawSplitChunksOptions { + fallbackCacheGroup?: RawFallbackCacheGroupOptions + name?: string + cacheGroups?: Record + /** What kind of chunks should be selected. */ + chunks?: RegExp | 'async' | 'initial' | 'all' + maxAsyncRequests?: number + maxInitialRequests?: number + minChunks?: number + minSize?: number + enforceSizeThreshold?: number + minRemainingSize?: number + maxSize?: number + maxAsyncSize?: number + maxInitialSize?: number +} + +export interface RawStatsOptions { + colors: boolean +} + +export interface RawStyleConfig { + styleLibraryDirectory?: string + custom?: string + css?: string + bool?: boolean +} + +export interface RawSwcJsMinimizerRspackPluginOptions { + passes: number + dropConsole: boolean + keepClassNames: boolean + keepFnNames: boolean + comments: "all" | "some" | "false" + asciiOnly: boolean + pureFuncs: Array + extractComments?: string + test?: RawSwcJsMinimizerRules + include?: RawSwcJsMinimizerRules + exclude?: RawSwcJsMinimizerRules +} + +export interface RawSwcJsMinimizerRule { + type: "string" | "regexp" + stringMatcher?: string + regexpMatcher?: string +} + +export interface RawSwcJsMinimizerRules { + type: "string" | "regexp" | "array" + stringMatcher?: string + regexpMatcher?: string + arrayMatcher?: Array +} + +export interface RawTrustedTypes { + policyName?: string +} + +/** + * Some code is modified based on + * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58 + * Apache-2.0 licensed + * Author Donny/강동윤 + * Copyright (c) + */ +export function registerGlobalTrace(filter: string, layer: "chrome" | "logger", output: string): void + +export interface RsPackRawOptions { + mode?: undefined | 'production' | 'development' | 'none' + target: Array + context: string + output: RawOutputOptions + resolve: RawResolveOptions + resolveLoader: RawResolveOptions + module: RawModuleOptions + devtool: string + optimization: RawOptimizationOptions + stats: RawStatsOptions + devServer: RawDevServer + snapshot: RawSnapshotOptions + cache: RawCacheOptions + experiments: RawExperiments + node?: RawNodeOption + profile: boolean + builtins: RawBuiltins +} + +/** Builtin loader runner */ +export function runBuiltinLoader(builtin: string, options: string | undefined | null, loaderContext: JsLoaderContext): Promise + +export interface ThreadsafeNodeFS { + writeFile: (...args: any[]) => any + removeFile: (...args: any[]) => any + mkdir: (...args: any[]) => any + mkdirp: (...args: any[]) => any + removeDirAll: (...args: any[]) => any +} + diff --git a/crates/node_binding/index.js b/crates/node_binding/index.js new file mode 100644 index 0000000..619f766 --- /dev/null +++ b/crates/node_binding/index.js @@ -0,0 +1,119 @@ +function loadNapiModule(binaryName, packageName) { + const { existsSync, readFileSync } = require('fs'); + const { join } = require('path'); + const { platform, arch } = process; + const candidates = []; + function isMusl() { + // For Node 10 + if (!process.report || typeof process.report.getReport !== 'function') { + try { + const lddPath = require('child_process') + .execSync('which ldd') + .toString() + .trim(); + return readFileSync(lddPath, 'utf8').includes('musl'); + } + catch (e) { + return true; + } + } + else { + // @ts-expect-error + const { glibcVersionRuntime } = process.report.getReport().header; + return !glibcVersionRuntime; + } + } + switch (platform) { + case 'android': + switch (arch) { + case 'arm64': + candidates.push('android-arm64'); + break; + case 'arm': + candidates.push('android-arm-eabi'); + break; + } + break; + case 'win32': + switch (arch) { + case 'x64': + candidates.push('win32-x64-msvc'); + break; + case 'ia32': + candidates.push('win32-ia32-msvc'); + break; + case 'arm64': + candidates.push('win32-arm64-msvc'); + break; + } + break; + case 'darwin': + candidates.push('darwin-universal'); + switch (arch) { + case 'x64': + candidates.push('darwin-x64'); + break; + case 'arm64': + candidates.push('darwin-arm64'); + break; + } + break; + case 'freebsd': + if (arch === 'x64') { + candidates.push('freebsd-x64'); + } + break; + case 'linux': + switch (arch) { + case 'x64': + if (isMusl()) { + candidates.push('linux-x64-musl'); + } + else { + candidates.push('linux-x64-gnu'); + } + break; + case 'arm64': + if (isMusl()) { + candidates.push('linux-arm64-musl'); + } + else { + candidates.push('linux-arm64-gnu'); + } + break; + case 'arm': + candidates.push('linux-arm-gnueabihf'); + break; + } + break; + } + let nativeBinding; + let loadError; + for (const suffix of candidates) { + const localPath = join(__dirname, `${binaryName}.${suffix}.node`); + const pkgPath = `${packageName}-${suffix}`; + try { + if (existsSync(localPath)) { + nativeBinding = require(localPath); + } + else { + nativeBinding = require(pkgPath); + } + } + catch (e) { + loadError = e; + continue; + } + loadError = null; + break; + } + if (!nativeBinding) { + if (loadError) { + throw loadError; + } + throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`); + } + return nativeBinding; +} + +module.exports = loadNapiModule('index', '@ice/pack-binding') diff --git a/crates/node_binding/npm/darwin-arm64/README.md b/crates/node_binding/npm/darwin-arm64/README.md new file mode 100644 index 0000000..d69ed01 --- /dev/null +++ b/crates/node_binding/npm/darwin-arm64/README.md @@ -0,0 +1,3 @@ +# `@ice/pack-binding-darwin-arm64` + +This is the **aarch64-apple-darwin** binary for `@ice/pack-binding` diff --git a/crates/node_binding/npm/darwin-arm64/package.json b/crates/node_binding/npm/darwin-arm64/package.json new file mode 100644 index 0000000..272a590 --- /dev/null +++ b/crates/node_binding/npm/darwin-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@ice/pack-binding-darwin-arm64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "main": "pack-binding.darwin-arm64.node", + "files": [ + "pack-binding.darwin-arm64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/crates/node_binding/npm/darwin-x64/README.md b/crates/node_binding/npm/darwin-x64/README.md new file mode 100644 index 0000000..e23c9f3 --- /dev/null +++ b/crates/node_binding/npm/darwin-x64/README.md @@ -0,0 +1,3 @@ +# `@ice/pack-binding-darwin-x64` + +This is the **x86_64-apple-darwin** binary for `@ice/pack-binding` diff --git a/crates/node_binding/npm/darwin-x64/package.json b/crates/node_binding/npm/darwin-x64/package.json new file mode 100644 index 0000000..866c8a6 --- /dev/null +++ b/crates/node_binding/npm/darwin-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@ice/pack-binding-darwin-x64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "main": "pack-binding.darwin-x64.node", + "files": [ + "pack-binding.darwin-x64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/crates/node_binding/npm/linux-x64-gnu/README.md b/crates/node_binding/npm/linux-x64-gnu/README.md new file mode 100644 index 0000000..e67ea9f --- /dev/null +++ b/crates/node_binding/npm/linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@ice/pack-binding-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `@ice/pack-binding` diff --git a/crates/node_binding/npm/linux-x64-gnu/package.json b/crates/node_binding/npm/linux-x64-gnu/package.json new file mode 100644 index 0000000..23d2266 --- /dev/null +++ b/crates/node_binding/npm/linux-x64-gnu/package.json @@ -0,0 +1,21 @@ +{ + "name": "@ice/pack-binding-linux-x64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "pack-binding.linux-x64-gnu.node", + "files": [ + "pack-binding.linux-x64-gnu.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "glibc" + ] +} \ No newline at end of file diff --git a/crates/node_binding/npm/win32-x64-msvc/README.md b/crates/node_binding/npm/win32-x64-msvc/README.md new file mode 100644 index 0000000..6cce126 --- /dev/null +++ b/crates/node_binding/npm/win32-x64-msvc/README.md @@ -0,0 +1,3 @@ +# `@ice/pack-binding-win32-x64-msvc` + +This is the **x86_64-pc-windows-msvc** binary for `@ice/pack-binding` diff --git a/crates/node_binding/npm/win32-x64-msvc/package.json b/crates/node_binding/npm/win32-x64-msvc/package.json new file mode 100644 index 0000000..bdaad45 --- /dev/null +++ b/crates/node_binding/npm/win32-x64-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "@ice/pack-binding-win32-x64-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "main": "pack-binding.win32-x64-msvc.node", + "files": [ + "pack-binding.win32-x64-msvc.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/crates/node_binding/package.json b/crates/node_binding/package.json new file mode 100644 index 0000000..59973f0 --- /dev/null +++ b/crates/node_binding/package.json @@ -0,0 +1,33 @@ +{ + "name": "@ice/pack-binding", + "version": "0.0.0", + "main": "index.js", + "types": "index.d.ts", + "napi": { + "name": "pack-binding", + "triples": { + "additional": [ + "aarch64-apple-darwin" + ] + } + }, + "license": "MIT", + "devDependencies": { + "@napi-rs/cli": "3.0.0-alpha.3", + "call-bind": "1.0.2" + }, + "ava": { + "timeout": "3m" + }, + "engines": { + "node": ">= 10" + }, + "scripts": { + "artifacts": "napi artifacts", + "build": "napi build --platform --release --target aarch64-apple-darwin", + "build:debug": "napi build --platform --target aarch64-apple-darwin", + "prepublishOnly": "napi prepublish -t npm", + "universal": "napi universal", + "version": "napi version" + } +} \ No newline at end of file diff --git a/crates/node_binding/src/hook.rs b/crates/node_binding/src/hook.rs new file mode 100644 index 0000000..38c5649 --- /dev/null +++ b/crates/node_binding/src/hook.rs @@ -0,0 +1,89 @@ +use std::sync::{Arc, RwLock}; + +/// rust support hooks +#[derive(PartialEq)] +pub enum Hook { + Make, + FinishMake, + BuildModule, + Compilation, + ThisCompilation, + ProcessAssetsStageAdditional, + ProcessAssetsStagePreProcess, + ProcessAssetsStageDerived, + ProcessAssetsStageAdditions, + ProcessAssetsStageNone, + ProcessAssetsStageOptimize, + ProcessAssetsStageOptimizeCount, + ProcessAssetsStageOptimizeCompatibility, + ProcessAssetsStageOptimizeSize, + ProcessAssetsStageDevTooling, + ProcessAssetsStageOptimizeInline, + ProcessAssetsStageSummarize, + ProcessAssetsStageOptimizeHash, + ProcessAssetsStageOptimizeTransfer, + ProcessAssetsStageAnalyse, + ProcessAssetsStageReport, + Emit, + AssetEmitted, + AfterEmit, + OptimizeChunkModules, + BeforeCompile, + AfterCompile, + FinishModules, + OptimizeModules, + OptimizeTree, + /// webpack `compilation.hooks.chunkAsset` + ChunkAsset, + NormalModuleFactoryResolveForScheme, + AfterResolve, + BeforeResolve, + SucceedModule, + StillValidModule, +} + +impl From for Hook { + fn from(s: String) -> Self { + match s.as_str() { + "make" => Hook::Make, + "finishMake" => Hook::FinishMake, + "buildModule" => Hook::BuildModule, + "compilation" => Hook::Compilation, + "thisCompilation" => Hook::ThisCompilation, + "processAssetsStageAdditional" => Hook::ProcessAssetsStageAdditional, + "processAssetsStagePreProcess" => Hook::ProcessAssetsStagePreProcess, + "processAssetsStageDerived" => Hook::ProcessAssetsStageDerived, + "processAssetsStageAdditions" => Hook::ProcessAssetsStageAdditions, + "processAssetsStageNone" => Hook::ProcessAssetsStageNone, + "processAssetsStageOptimize" => Hook::ProcessAssetsStageOptimize, + "processAssetsStageOptimizeCount" => Hook::ProcessAssetsStageOptimizeCount, + "processAssetsStageOptimizeCompatibility" => Hook::ProcessAssetsStageOptimizeCompatibility, + "processAssetsStageOptimizeSize" => Hook::ProcessAssetsStageOptimizeSize, + "processAssetsStageDevTooling" => Hook::ProcessAssetsStageDevTooling, + "processAssetsStageOptimizeInline" => Hook::ProcessAssetsStageOptimizeInline, + "processAssetsStageSummarize" => Hook::ProcessAssetsStageSummarize, + "processAssetsStageOptimizeHash" => Hook::ProcessAssetsStageOptimizeHash, + "processAssetsStageOptimizeTransfer" => Hook::ProcessAssetsStageOptimizeTransfer, + "processAssetsStageAnalyse" => Hook::ProcessAssetsStageAnalyse, + "processAssetsStageReport" => Hook::ProcessAssetsStageReport, + "emit" => Hook::Emit, + "assetEmitted" => Hook::AssetEmitted, + "afterEmit" => Hook::AfterEmit, + "optimizeChunkModules" => Hook::OptimizeChunkModules, + "beforeCompile" => Hook::BeforeCompile, + "afterCompile" => Hook::AfterCompile, + "finishModules" => Hook::FinishModules, + "optimizeModules" => Hook::OptimizeModules, + "optimizeTree" => Hook::OptimizeTree, + "chunkAsset" => Hook::ChunkAsset, + "normalModuleFactoryResolveForScheme" => Hook::NormalModuleFactoryResolveForScheme, + "afterResolve" => Hook::AfterResolve, + "beforeResolve" => Hook::BeforeResolve, + "succeedModule" => Hook::SucceedModule, + "stillValidModule" => Hook::StillValidModule, + hook_name => panic!("{hook_name} is an invalid hook name"), + } + } +} + +pub type DisabledHooks = Arc>>; diff --git a/crates/node_binding/src/js_values/asset.rs b/crates/node_binding/src/js_values/asset.rs new file mode 100644 index 0000000..1c27142 --- /dev/null +++ b/crates/node_binding/src/js_values/asset.rs @@ -0,0 +1,106 @@ +use super::JsCompatSource; + +#[napi(object)] +pub struct JsAssetInfoRelated { + pub source_map: Option, +} + +impl From for rspack_core::AssetInfoRelated { + fn from(i: JsAssetInfoRelated) -> Self { + Self { + source_map: i.source_map, + } + } +} +#[napi(object)] +pub struct JsAssetInfo { + /// if the asset can be long term cached forever (contains a hash) + pub immutable: bool, + /// whether the asset is minimized + pub minimized: bool, + /// the value(s) of the full hash used for this asset + // pub full_hash: + /// the value(s) of the chunk hash used for this asset + pub chunk_hash: Vec, + /// the value(s) of the module hash used for this asset + // pub module_hash: + /// the value(s) of the content hash used for this asset + pub content_hash: Vec, + /// when asset was created from a source file (potentially transformed), the original filename relative to compilation context + // pub source_filename: + /// size in bytes, only set after asset has been emitted + // pub size: f64, + /// when asset is only used for development and doesn't count towards user-facing assets + pub development: bool, + /// when asset ships data for updating an existing application (HMR) + pub hot_module_replacement: bool, + /// when asset is javascript and an ESM + // pub javascript_module: + /// related object to other assets, keyed by type of relation (only points from parent to child) + pub related: JsAssetInfoRelated, + /// the asset version, emit can be skipped when both filename and version are the same + /// An empty string means no version, it will always emit + pub version: String, +} + +impl From for rspack_core::AssetInfo { + fn from(i: JsAssetInfo) -> Self { + Self { + immutable: i.immutable, + minimized: i.minimized, + development: i.development, + hot_module_replacement: i.hot_module_replacement, + chunk_hash: i.chunk_hash.into_iter().collect(), + related: i.related.into(), + content_hash: i.content_hash.into_iter().collect(), + version: i.version, + } + } +} + +#[napi(object)] +pub struct JsAsset { + pub name: String, + pub source: Option, + pub info: JsAssetInfo, +} + +impl From for JsAssetInfoRelated { + fn from(related: rspack_core::AssetInfoRelated) -> Self { + Self { + source_map: related.source_map, + } + } +} + +impl From for JsAssetInfo { + fn from(info: rspack_core::AssetInfo) -> Self { + Self { + immutable: info.immutable, + minimized: info.minimized, + development: info.development, + hot_module_replacement: info.hot_module_replacement, + related: info.related.into(), + chunk_hash: info.chunk_hash.into_iter().collect(), + content_hash: info.content_hash.into_iter().collect(), + version: info.version, + } + } +} + +#[napi(object)] +pub struct JsAssetEmittedArgs { + pub filename: String, + pub output_path: String, + pub target_path: String, +} + +impl From<&rspack_core::AssetEmittedArgs<'_>> for JsAssetEmittedArgs { + fn from(args: &rspack_core::AssetEmittedArgs) -> Self { + Self { + filename: args.filename.to_string(), + output_path: args.output_path.to_string_lossy().to_string(), + target_path: args.target_path.to_string_lossy().to_string(), + } + } +} diff --git a/crates/node_binding/src/js_values/chunk_group.rs b/crates/node_binding/src/js_values/chunk_group.rs new file mode 100644 index 0000000..557e72c --- /dev/null +++ b/crates/node_binding/src/js_values/chunk_group.rs @@ -0,0 +1,27 @@ +use crate::js_values::JsChunk; + +#[napi(object)] +pub struct JsChunkGroup { + pub chunks: Vec, +} + +impl JsChunkGroup { + pub fn from_chunk_group( + cg: &rspack_core::ChunkGroup, + compilation: &rspack_core::Compilation, + ) -> Self { + Self { + chunks: cg + .chunks + .iter() + .map(|k| { + JsChunk::from( + compilation.chunk_by_ukey.get(k).unwrap_or_else(|| { + panic!("Could not find Chunk({k:?}) belong to ChunkGroup: {cg:?}",) + }), + ) + }) + .collect(), + } + } +} diff --git a/crates/node_binding/src/js_values/compilation.rs b/crates/node_binding/src/js_values/compilation.rs new file mode 100644 index 0000000..a1203c8 --- /dev/null +++ b/crates/node_binding/src/js_values/compilation.rs @@ -0,0 +1,434 @@ +use std::collections::HashMap; +use std::path::PathBuf; + +use napi::bindgen_prelude::*; +use napi::NapiRaw; +use rspack_core::rspack_sources::BoxSource; +use rspack_core::AssetInfo; +use rspack_core::ModuleIdentifier; +use rspack_core::{rspack_sources::SourceExt, NormalModuleSource}; +use rspack_error::Diagnostic; +use rspack_identifier::Identifier; +use rspack_napi_shared::NapiResultExt; + +use super::module::ToJsModule; +use super::PathWithInfo; +use crate::utils::callbackify; +use crate::{ + js_values::{chunk::JsChunk, module::JsModule, PathData}, + CompatSource, JsAsset, JsAssetInfo, JsChunkGroup, JsCompatSource, JsStats, ToJsCompatSource, +}; + +#[napi] +pub struct JsCompilation { + inner: &'static mut rspack_core::Compilation, +} + +#[napi] +impl JsCompilation { + #[napi( + ts_args_type = r#"filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)"# + )] + pub fn update_asset( + &mut self, + env: Env, + filename: String, + new_source_or_function: Either, + asset_info_update_or_function: Option>, + ) -> Result<()> { + self + .inner + .update_asset(&filename, |original_source, original_info| { + let new_source: napi::Result = try { + let new_source = match new_source_or_function { + Either::A(new_source) => Into::::into(new_source).boxed(), + Either::B(new_source_fn) => { + let js_source = unsafe { + call_js_function_with_napi_objects!( + env, + new_source_fn, + original_source.to_js_compat_source() + ) + }?; + + let compat_source: CompatSource = unsafe { + convert_raw_napi_value_to_napi_value!(env, JsCompatSource, js_source.raw()) + }? + .into(); + + compat_source.boxed() + } + }; + new_source + }; + let new_source = new_source.into_rspack_result()?; + + let new_info: napi::Result> = asset_info_update_or_function + .map( + |asset_info_update_or_function| match asset_info_update_or_function { + Either::A(asset_info) => Ok(asset_info.into()), + Either::B(asset_info_fn) => { + let asset_info = unsafe { + call_js_function_with_napi_objects!( + env, + asset_info_fn, + Into::::into(original_info.clone()) + ) + }?; + + let js_asset_info = unsafe { + convert_raw_napi_value_to_napi_value!(env, JsAssetInfo, asset_info.raw()) + }?; + Ok(js_asset_info.into()) + } + }, + ) + .transpose(); + let new_info = new_info.into_rspack_result()?; + Ok((new_source, new_info.unwrap_or(original_info))) + }) + .map_err(|err| napi::Error::from_reason(err.to_string())) + } + + #[napi(ts_return_type = "Readonly[]")] + pub fn get_assets(&self) -> Result> { + let mut assets = Vec::::with_capacity(self.inner.assets().len()); + + for (filename, asset) in self.inner.assets() { + assets.push(JsAsset { + name: filename.clone(), + source: asset + .source + .as_ref() + .map(|s| s.to_js_compat_source()) + .transpose()?, + info: asset.info.clone().into(), + }); + } + + Ok(assets) + } + + #[napi] + pub fn get_asset(&self, name: String) -> Result> { + match self.inner.assets().get(&name) { + Some(asset) => Ok(Some(JsAsset { + name, + source: asset + .source + .as_ref() + .map(|s| s.to_js_compat_source()) + .transpose()?, + info: asset.info.clone().into(), + })), + None => Ok(None), + } + } + + #[napi] + pub fn get_asset_source(&self, name: String) -> Result> { + self + .inner + .assets() + .get(&name) + .and_then(|v| v.source.as_ref().map(|s| s.to_js_compat_source())) + .transpose() + } + + #[napi] + pub fn get_modules(&self) -> Vec { + self + .inner + .module_graph + .modules() + .values() + .filter_map(|module| module.to_js_module().ok()) + .collect::>() + } + + #[napi] + pub fn get_chunks(&self) -> Vec { + self + .inner + .chunk_by_ukey + .values() + .map(JsChunk::from) + .collect::>() + } + + #[napi] + pub fn get_named_chunk(&self, name: String) -> Option { + self + .inner + .named_chunks + .get(&name) + .and_then(|c| self.inner.chunk_by_ukey.get(c).map(JsChunk::from)) + } + + #[napi] + /// Only available for those none Js and Css source, + /// return true if set module source successfully, false if failed. + pub fn set_none_ast_module_source( + &mut self, + module_identifier: String, + source: JsCompatSource, + ) -> bool { + match self + .inner + .module_graph + .module_by_identifier_mut(&Identifier::from(module_identifier.as_str())) + { + Some(module) => match module.as_normal_module_mut() { + Some(module) => { + let compat_source = CompatSource::from(source).boxed(); + *module.source_mut() = NormalModuleSource::new_built(compat_source, &[]); + true + } + None => false, + }, + None => false, + } + } + + #[napi] + pub fn set_asset_source(&mut self, name: String, source: JsCompatSource) { + let source = CompatSource::from(source).boxed(); + match self.inner.assets_mut().entry(name) { + std::collections::hash_map::Entry::Occupied(mut e) => e.get_mut().set_source(Some(source)), + std::collections::hash_map::Entry::Vacant(e) => { + e.insert(rspack_core::CompilationAsset::from(source)); + } + }; + } + + #[napi] + pub fn delete_asset_source(&mut self, name: String) { + self + .inner + .assets_mut() + .entry(name) + .and_modify(|a| a.set_source(None)); + } + + #[napi] + pub fn get_asset_filenames(&self) -> Result> { + let filenames = self + .inner + .assets() + .iter() + .filter(|(_, asset)| asset.get_source().is_some()) + .map(|(filename, _)| filename) + .cloned() + .collect(); + Ok(filenames) + } + + #[napi] + pub fn has_asset(&self, name: String) -> Result { + Ok(self.inner.assets().contains_key(&name)) + } + + #[napi] + pub fn emit_asset( + &mut self, + filename: String, + source: JsCompatSource, + asset_info: JsAssetInfo, + ) -> Result<()> { + let compat_source: CompatSource = source.into(); + + self.inner.emit_asset( + filename, + rspack_core::CompilationAsset::new(Some(compat_source.boxed()), asset_info.into()), + ); + + Ok(()) + } + + #[napi] + pub fn delete_asset(&mut self, filename: String) { + self.inner.delete_asset(&filename); + } + + #[napi(getter)] + pub fn entrypoints(&self) -> HashMap { + let entrypoints = self.inner.entrypoints(); + entrypoints + .iter() + .map(|(n, _)| { + ( + n.clone(), + JsChunkGroup::from_chunk_group(self.inner.entrypoint_by_name(n), self.inner), + ) + }) + .collect() + } + + #[napi(getter)] + pub fn hash(&self) -> Option { + self.inner.get_hash().map(|hash| hash.to_owned()) + } + + #[napi] + pub fn get_file_dependencies(&self) -> Vec { + self + .inner + .file_dependencies + .iter() + .map(|i| i.to_string_lossy().to_string()) + .collect() + } + + #[napi] + pub fn get_context_dependencies(&self) -> Vec { + self + .inner + .context_dependencies + .iter() + .map(|i| i.to_string_lossy().to_string()) + .collect() + } + + #[napi] + pub fn get_missing_dependencies(&self) -> Vec { + self + .inner + .missing_dependencies + .iter() + .map(|i| i.to_string_lossy().to_string()) + .collect() + } + + #[napi] + pub fn get_build_dependencies(&self) -> Vec { + self + .inner + .build_dependencies + .iter() + .map(|i| i.to_string_lossy().to_string()) + .collect() + } + + #[napi(ts_args_type = r#"severity: "error" | "warning", title: string, message: string"#)] + pub fn push_diagnostic(&mut self, severity: String, title: String, message: String) { + let diagnostic = match severity.as_str() { + "warning" => rspack_error::Diagnostic::warn(title, message, 0, 0), + _ => rspack_error::Diagnostic::error(title, message, 0, 0), + }; + self.inner.push_diagnostic(diagnostic); + } + + #[napi] + pub fn push_native_diagnostics(&mut self, mut diagnostics: External>) { + while let Some(diagnostic) = diagnostics.pop() { + self.inner.push_diagnostic(diagnostic); + } + } + + #[napi] + pub fn get_stats(&self, reference: Reference, env: Env) -> Result { + Ok(JsStats::new(reference.share_with(env, |compilation| { + Ok(compilation.inner.get_stats()) + })?)) + } + + #[napi] + pub fn get_asset_path(&self, filename: String, data: PathData) -> String { + self.inner.get_asset_path( + &rspack_core::Filename::from(filename), + data.as_core_path_data(), + ) + } + + #[napi] + pub fn get_asset_path_with_info(&self, filename: String, data: PathData) -> PathWithInfo { + self + .inner + .get_asset_path_with_info( + &rspack_core::Filename::from(filename), + data.as_core_path_data(), + ) + .into() + } + + #[napi] + pub fn get_path(&self, filename: String, data: PathData) -> String { + self.inner.get_path( + &rspack_core::Filename::from(filename), + data.as_core_path_data(), + ) + } + + #[napi] + pub fn get_path_with_info(&self, filename: String, data: PathData) -> PathWithInfo { + self + .inner + .get_path_with_info( + &rspack_core::Filename::from(filename), + data.as_core_path_data(), + ) + .into() + } + + #[napi] + pub fn add_file_dependencies(&mut self, deps: Vec) { + self + .inner + .file_dependencies + .extend(deps.into_iter().map(PathBuf::from)) + } + + #[napi] + pub fn add_context_dependencies(&mut self, deps: Vec) { + self + .inner + .context_dependencies + .extend(deps.into_iter().map(PathBuf::from)) + } + + #[napi] + pub fn add_missing_dependencies(&mut self, deps: Vec) { + self + .inner + .missing_dependencies + .extend(deps.into_iter().map(PathBuf::from)) + } + + #[napi] + pub fn add_build_dependencies(&mut self, deps: Vec) { + self + .inner + .build_dependencies + .extend(deps.into_iter().map(PathBuf::from)) + } + + #[napi] + pub fn rebuild_module( + &'static mut self, + env: Env, + module_identifiers: Vec, + f: JsFunction, + ) -> Result<()> { + callbackify(env, f, async { + let modules = self + .inner + .rebuild_module(rustc_hash::FxHashSet::from_iter( + module_identifiers.into_iter().map(ModuleIdentifier::from), + )) + .await + .map_err(|e| Error::new(napi::Status::GenericFailure, format!("{e}")))?; + Ok( + modules + .into_iter() + .filter_map(|item| item.to_js_module().ok()) + .collect::>(), + ) + }) + } +} + +impl JsCompilation { + pub fn from_compilation(inner: &'static mut rspack_core::Compilation) -> Self { + Self { inner } + } +} diff --git a/crates/node_binding/src/js_values/hooks.rs b/crates/node_binding/src/js_values/hooks.rs new file mode 100644 index 0000000..3a401a5 --- /dev/null +++ b/crates/node_binding/src/js_values/hooks.rs @@ -0,0 +1,42 @@ +use napi::bindgen_prelude::*; + +#[napi(object)] +pub struct JsHooks { + pub process_assets_stage_additional: JsFunction, + pub process_assets_stage_pre_process: JsFunction, + pub process_assets_stage_derived: JsFunction, + pub process_assets_stage_additions: JsFunction, + pub process_assets_stage_none: JsFunction, + pub process_assets_stage_optimize: JsFunction, + pub process_assets_stage_optimize_count: JsFunction, + pub process_assets_stage_optimize_compatibility: JsFunction, + pub process_assets_stage_optimize_size: JsFunction, + pub process_assets_stage_dev_tooling: JsFunction, + pub process_assets_stage_optimize_inline: JsFunction, + pub process_assets_stage_summarize: JsFunction, + pub process_assets_stage_optimize_hash: JsFunction, + pub process_assets_stage_optimize_transfer: JsFunction, + pub process_assets_stage_analyse: JsFunction, + pub process_assets_stage_report: JsFunction, + pub compilation: JsFunction, + pub this_compilation: JsFunction, + pub emit: JsFunction, + pub asset_emitted: JsFunction, + pub after_emit: JsFunction, + pub make: JsFunction, + pub optimize_modules: JsFunction, + pub optimize_tree: JsFunction, + pub optimize_chunk_module: JsFunction, + pub before_compile: JsFunction, + pub after_compile: JsFunction, + pub finish_modules: JsFunction, + pub finish_make: JsFunction, + pub build_module: JsFunction, + pub before_resolve: JsFunction, + pub after_resolve: JsFunction, + pub context_module_before_resolve: JsFunction, + pub normal_module_factory_resolve_for_scheme: JsFunction, + pub chunk_asset: JsFunction, + pub succeed_module: JsFunction, + pub still_valid_module: JsFunction, +} diff --git a/crates/node_binding/src/js_values/mod.rs b/crates/node_binding/src/js_values/mod.rs new file mode 100644 index 0000000..c2959a4 --- /dev/null +++ b/crates/node_binding/src/js_values/mod.rs @@ -0,0 +1,25 @@ +mod chunk { + // TODO: should we merge rspack_binding_options and node_binding? + pub use rspack_binding_options::chunk::*; +} + +mod asset; +mod chunk_group; +mod compilation; +mod hooks; +mod module; +mod normal_module_factory; +mod path_data; +mod source; +mod stats; + +pub use asset::*; +pub use chunk::*; +pub use chunk_group::*; +pub use compilation::*; +pub use hooks::*; +pub use module::*; +pub use normal_module_factory::*; +pub use path_data::*; +pub use source::*; +pub use stats::*; diff --git a/crates/node_binding/src/js_values/module.rs b/crates/node_binding/src/js_values/module.rs new file mode 100644 index 0000000..8ddf315 --- /dev/null +++ b/crates/node_binding/src/js_values/module.rs @@ -0,0 +1,37 @@ +use napi::bindgen_prelude::*; +use rspack_core::Module; +use rspack_identifier::Identifiable; + +use super::{JsCompatSource, ToJsCompatSource}; + +#[napi(object)] +pub struct JsModule { + pub original_source: Option, + pub resource: String, + pub module_identifier: String, +} + +pub trait ToJsModule { + fn to_js_module(&self) -> Result; +} + +impl ToJsModule for dyn Module + '_ { + fn to_js_module(&self) -> Result { + let original_source = self + .original_source() + .and_then(|source| source.to_js_compat_source().ok()); + self + .try_as_normal_module() + .map(|normal_module| JsModule { + original_source, + + resource: normal_module + .resource_resolved_data() + .resource_path + .to_string_lossy() + .to_string(), + module_identifier: normal_module.identifier().to_string(), + }) + .map_err(|_| napi::Error::from_reason("Failed to convert module to JsModule")) + } +} diff --git a/crates/node_binding/src/js_values/normal_module_factory.rs b/crates/node_binding/src/js_values/normal_module_factory.rs new file mode 100644 index 0000000..feb0296 --- /dev/null +++ b/crates/node_binding/src/js_values/normal_module_factory.rs @@ -0,0 +1,105 @@ +use rspack_core::{NormalModuleAfterResolveArgs, NormalModuleBeforeResolveArgs, ResourceData}; + +#[napi(object)] +pub struct JsResolveForSchemeInput { + pub resource_data: JsResourceData, + pub scheme: String, +} + +#[napi(object)] +pub struct JsResolveForSchemeResult { + pub resource_data: JsResourceData, + pub stop: bool, +} + +#[napi(object)] +pub struct BeforeResolveData { + pub request: String, + pub context: String, +} + +#[napi(object)] +pub struct AfterResolveData { + pub request: String, + pub context: String, + pub file_dependencies: Vec, + pub context_dependencies: Vec, + pub missing_dependencies: Vec, + pub factory_meta: FactoryMeta, +} + +#[napi(object)] +pub struct FactoryMeta { + pub side_effect_free: Option, +} + +#[napi(object)] +pub struct JsResourceData { + /// Resource with absolute path, query and fragment + pub resource: String, + /// Absolute resource path only + pub path: String, + /// Resource query with `?` prefix + pub query: Option, + /// Resource fragment with `#` prefix + pub fragment: Option, +} + +impl From for JsResourceData { + fn from(value: ResourceData) -> Self { + Self { + resource: value.resource, + path: value.resource_path.to_string_lossy().to_string(), + query: value.resource_query, + fragment: value.resource_fragment, + } + } +} + +impl From for JsResolveForSchemeInput { + fn from(value: ResourceData) -> Self { + Self { + scheme: value.get_scheme().to_string(), + resource_data: value.into(), + } + } +} + +impl From for BeforeResolveData { + fn from(value: NormalModuleBeforeResolveArgs) -> Self { + Self { + context: value.context, + request: value.request, + } + } +} + +impl From> for AfterResolveData { + fn from(value: NormalModuleAfterResolveArgs) -> Self { + Self { + context: value.context.to_owned(), + request: value.request.to_string(), + file_dependencies: value + .file_dependencies + .clone() + .into_iter() + .map(|item| item.to_string_lossy().to_string()) + .collect::>(), + context_dependencies: value + .context_dependencies + .clone() + .into_iter() + .map(|item| item.to_string_lossy().to_string()) + .collect::>(), + missing_dependencies: value + .context_dependencies + .clone() + .into_iter() + .map(|item| item.to_string_lossy().to_string()) + .collect::>(), + factory_meta: FactoryMeta { + side_effect_free: value.factory_meta.side_effect_free, + }, + } + } +} diff --git a/crates/node_binding/src/js_values/path_data.rs b/crates/node_binding/src/js_values/path_data.rs new file mode 100644 index 0000000..68d5afc --- /dev/null +++ b/crates/node_binding/src/js_values/path_data.rs @@ -0,0 +1,42 @@ +use super::JsAssetInfo; + +#[napi(object)] +pub struct PathData { + pub filename: Option, + pub hash: Option, + pub content_hash: Option, + pub runtime: Option, + pub url: Option, + pub id: Option, +} + +impl PathData { + pub fn as_core_path_data(&self) -> rspack_core::PathData { + rspack_core::PathData { + filename: self.filename.as_deref(), + chunk: None, + module: None, + hash: self.hash.as_deref(), + content_hash: self.content_hash.as_deref(), + chunk_graph: None, + runtime: self.runtime.as_deref(), + url: self.url.as_deref(), + id: self.id.as_deref(), + } + } +} + +#[napi(object)] +pub struct PathWithInfo { + pub path: String, + pub info: JsAssetInfo, +} + +impl From<(String, rspack_core::AssetInfo)> for PathWithInfo { + fn from(value: (String, rspack_core::AssetInfo)) -> Self { + Self { + path: value.0, + info: value.1.into(), + } + } +} diff --git a/crates/node_binding/src/js_values/source.rs b/crates/node_binding/src/js_values/source.rs new file mode 100644 index 0000000..22d972b --- /dev/null +++ b/crates/node_binding/src/js_values/source.rs @@ -0,0 +1,198 @@ +use std::{borrow::Cow, hash::Hash, sync::Arc}; + +use napi::bindgen_prelude::*; +use rspack_core::rspack_sources::{ + stream_chunks::{stream_chunks_default, GeneratedInfo, OnChunk, OnName, OnSource, StreamChunks}, + CachedSource, ConcatSource, MapOptions, OriginalSource, RawSource, ReplaceSource, Source, + SourceMap, SourceMapSource, +}; + +#[napi(object)] +pub struct JsCompatSource { + /// Whether the underlying data structure is a `RawSource` + pub is_raw: bool, + /// Whether the underlying value is a buffer or string + pub is_buffer: bool, + pub source: Buffer, + pub map: Option, +} + +#[derive(Debug, Clone, Eq)] +pub struct CompatSource { + pub is_raw: bool, + pub is_buffer: bool, + pub source: Vec, + pub map: Option>, +} + +impl std::hash::Hash for CompatSource { + fn hash(&self, state: &mut H) { + "__CompatSource".hash(state); + self.is_raw.hash(state); + self.is_buffer.hash(state); + self.source.hash(state); + self.map.hash(state); + } +} + +impl PartialEq for CompatSource { + fn eq(&self, other: &Self) -> bool { + self.is_raw == other.is_raw + && self.is_buffer == other.is_buffer + && self.source == other.source + && self.map == other.map + } +} + +impl From for CompatSource { + fn from(source: JsCompatSource) -> Self { + Self { + is_raw: source.is_raw, + is_buffer: source.is_buffer, + source: source.source.into(), + map: source.map.map(Into::into), + } + } +} + +impl StreamChunks for CompatSource { + fn stream_chunks( + &self, + options: &MapOptions, + on_chunk: OnChunk, + on_source: OnSource, + on_name: OnName, + ) -> GeneratedInfo { + stream_chunks_default(self, options, on_chunk, on_source, on_name) + } +} + +impl Source for CompatSource { + fn source(&self) -> Cow { + // Use UTF-8 lossy for any sources, including `RawSource` as a workaround for not supporting either `Buffer` or `String` in `Source`. + String::from_utf8_lossy(&self.source) + } + + fn buffer(&self) -> Cow<[u8]> { + Cow::Borrowed(self.source.as_ref()) + } + + fn size(&self) -> usize { + self.source.len() + } + + fn map(&self, _options: &MapOptions) -> Option { + self + .map + .as_ref() + .and_then(|m| SourceMap::from_slice(m).ok()) + } + + fn to_writer(&self, writer: &mut dyn std::io::Write) -> std::io::Result<()> { + writer.write_all(&self.source) + } +} + +pub trait ToJsCompatSource { + fn to_js_compat_source(&self) -> Result; +} + +impl ToJsCompatSource for RawSource { + fn to_js_compat_source(&self) -> Result { + Ok(JsCompatSource { + is_raw: true, + is_buffer: self.is_buffer(), + source: self.buffer().to_vec().into(), + map: to_webpack_map(self)?, + }) + } +} + +impl ToJsCompatSource for ReplaceSource { + fn to_js_compat_source(&self) -> Result { + Ok(JsCompatSource { + is_raw: false, + is_buffer: false, + source: self.buffer().to_vec().into(), + map: to_webpack_map(self)?, + }) + } +} + +impl ToJsCompatSource for CachedSource { + fn to_js_compat_source(&self) -> Result { + self.original().to_js_compat_source() + } +} + +impl ToJsCompatSource for Arc { + fn to_js_compat_source(&self) -> Result { + (**self).to_js_compat_source() + } +} + +impl ToJsCompatSource for Box { + fn to_js_compat_source(&self) -> Result { + (**self).to_js_compat_source() + } +} + +macro_rules! impl_default_to_compat_source { + ($ident:ident) => { + impl ToJsCompatSource for $ident { + fn to_js_compat_source(&self) -> Result { + Ok(JsCompatSource { + is_raw: false, + is_buffer: false, + source: self.buffer().to_vec().into(), + map: to_webpack_map(self)?, + }) + } + } + }; +} + +impl_default_to_compat_source!(SourceMapSource); +impl_default_to_compat_source!(ConcatSource); +impl_default_to_compat_source!(OriginalSource); + +fn to_webpack_map(source: &dyn Source) -> Result> { + let map = source.map(&MapOptions::default()); + + map + .map(|m| m.to_json().map(|inner| inner.into_bytes().into())) + .transpose() + .map_err(|err| napi::Error::from_reason(err.to_string())) +} + +impl ToJsCompatSource for dyn Source + '_ { + fn to_js_compat_source(&self) -> Result { + if let Some(raw_source) = self.as_any().downcast_ref::() { + raw_source.to_js_compat_source() + } else if let Some(cached_source) = self.as_any().downcast_ref::>() { + cached_source.to_js_compat_source() + } else if let Some(cached_source) = self + .as_any() + .downcast_ref::>>() + { + cached_source.to_js_compat_source() + } else if let Some(cached_source) = self + .as_any() + .downcast_ref::>>() + { + cached_source.to_js_compat_source() + } else if let Some(source) = self.as_any().downcast_ref::>() { + source.to_js_compat_source() + } else if let Some(source) = self.as_any().downcast_ref::>() { + source.to_js_compat_source() + } else { + // If it's not a `RawSource` related type, then we regards it as a `Source` type. + Ok(JsCompatSource { + is_raw: false, + is_buffer: false, + source: self.buffer().to_vec().into(), + map: to_webpack_map(self)?, + }) + } + } +} diff --git a/crates/node_binding/src/js_values/stats.rs b/crates/node_binding/src/js_values/stats.rs new file mode 100644 index 0000000..26d97f1 --- /dev/null +++ b/crates/node_binding/src/js_values/stats.rs @@ -0,0 +1,561 @@ +use napi::bindgen_prelude::Buffer; +use napi::{ + bindgen_prelude::{Result, SharedReference}, + Either, +}; +use rspack_core::Stats; + +use super::{JsCompilation, ToJsCompatSource}; + +#[napi(object)] +#[derive(Debug)] +pub struct JsStatsError { + pub message: String, + pub formatted: String, + pub title: String, +} + +impl From for JsStatsError { + fn from(stats: rspack_core::StatsError) -> Self { + Self { + message: stats.message, + formatted: stats.formatted, + title: stats.title, + } + } +} + +#[napi(object)] +pub struct JsStatsWarning { + pub message: String, + pub formatted: String, +} + +impl From for JsStatsWarning { + fn from(stats: rspack_core::StatsWarning) -> Self { + Self { + message: stats.message, + formatted: stats.formatted, + } + } +} + +#[napi(object)] +pub struct JsStatsLogging { + pub name: String, + pub r#type: String, + pub args: Option>, + pub trace: Option>, +} + +impl From<(String, rspack_core::LogType)> for JsStatsLogging { + fn from(value: (String, rspack_core::LogType)) -> Self { + match value.1 { + rspack_core::LogType::Error { message, trace } => Self { + name: value.0, + r#type: "error".to_string(), + args: Some(vec![message]), + trace: Some(trace), + }, + rspack_core::LogType::Warn { message, trace } => Self { + name: value.0, + r#type: "warn".to_string(), + args: Some(vec![message]), + trace: Some(trace), + }, + rspack_core::LogType::Info { message } => Self { + name: value.0, + r#type: "info".to_string(), + args: Some(vec![message]), + trace: None, + }, + rspack_core::LogType::Log { message } => Self { + name: value.0, + r#type: "log".to_string(), + args: Some(vec![message]), + trace: None, + }, + rspack_core::LogType::Debug { message } => Self { + name: value.0, + r#type: "debug".to_string(), + args: Some(vec![message]), + trace: None, + }, + rspack_core::LogType::Trace { message, trace } => Self { + name: value.0, + r#type: "trace".to_string(), + args: Some(vec![message]), + trace: Some(trace), + }, + rspack_core::LogType::Group { message } => Self { + name: value.0, + r#type: "group".to_string(), + args: Some(vec![message]), + trace: None, + }, + rspack_core::LogType::GroupCollapsed { message } => Self { + name: value.0, + r#type: "groupCollapsed".to_string(), + args: Some(vec![message]), + trace: None, + }, + rspack_core::LogType::GroupEnd => Self { + name: value.0, + r#type: "groupEnd".to_string(), + args: None, + trace: None, + }, + rspack_core::LogType::Profile { label } => Self { + name: value.0, + r#type: "profile".to_string(), + args: Some(vec![label.to_string()]), + trace: None, + }, + rspack_core::LogType::ProfileEnd { label } => Self { + name: value.0, + r#type: "profileEnd".to_string(), + args: Some(vec![label.to_string()]), + trace: None, + }, + rspack_core::LogType::Time { + label, + secs, + subsec_nanos, + } => Self { + name: value.0, + r#type: "time".to_string(), + args: Some(vec![format!( + "{}: {} ms", + label, + secs * 1000 + subsec_nanos as u64 / 1000000 + )]), + trace: None, + }, + rspack_core::LogType::Clear => Self { + name: value.0, + r#type: "clear".to_string(), + args: None, + trace: None, + }, + rspack_core::LogType::Status { message } => Self { + name: value.0, + r#type: "status".to_string(), + args: Some(vec![message]), + trace: None, + }, + rspack_core::LogType::Cache { label, hit, total } => Self { + name: value.0, + r#type: "cache".to_string(), + args: Some(vec![format!( + "{}: {:.1}% ({}/{})", + label, + if total == 0 { + 0 as f32 + } else { + hit as f32 / total as f32 * 100_f32 + }, + hit, + total, + )]), + trace: None, + }, + } + } +} + +#[napi(object)] +pub struct JsStatsAsset { + pub r#type: &'static str, + pub name: String, + pub size: f64, + pub chunks: Vec, + pub chunk_names: Vec, + pub info: JsStatsAssetInfo, + pub emitted: bool, +} + +impl From for JsStatsAsset { + fn from(stats: rspack_core::StatsAsset) -> Self { + Self { + r#type: stats.r#type, + name: stats.name, + size: stats.size, + chunks: stats.chunks, + chunk_names: stats.chunk_names, + info: stats.info.into(), + emitted: stats.emitted, + } + } +} + +#[napi(object)] +pub struct JsStatsAssetInfo { + pub development: bool, + pub hot_module_replacement: bool, +} + +impl From for JsStatsAssetInfo { + fn from(stats: rspack_core::StatsAssetInfo) -> Self { + Self { + development: stats.development, + hot_module_replacement: stats.hot_module_replacement, + } + } +} + +type JsStatsModuleSource = Either; +#[napi(object)] +pub struct JsStatsModule { + pub r#type: &'static str, + pub module_type: String, + pub identifier: String, + pub name: String, + pub id: Option, + pub chunks: Vec, + pub size: f64, + pub issuer: Option, + pub issuer_name: Option, + pub issuer_id: Option, + pub issuer_path: Vec, + pub name_for_condition: Option, + pub reasons: Option>, + pub assets: Option>, + pub source: Option>, + pub profile: Option, +} + +impl TryFrom> for JsStatsModule { + type Error = napi::Error; + fn try_from(stats: rspack_core::StatsModule) -> Result { + let source = stats + .source + .map(|source| { + source.to_js_compat_source().map(|js_compat_source| { + if js_compat_source.is_raw && js_compat_source.is_buffer { + JsStatsModuleSource::B(js_compat_source.source) + } else { + let s = String::from_utf8_lossy(js_compat_source.source.as_ref()).to_string(); + JsStatsModuleSource::A(s) + } + }) + }) + .transpose() + .map_err(|e| napi::Error::from_reason(e.to_string()))?; + + Ok(Self { + r#type: stats.r#type, + name: stats.name, + size: stats.size, + chunks: stats.chunks, + module_type: stats.module_type.as_str().to_string(), + identifier: stats.identifier.to_string(), + id: stats.id, + issuer: stats.issuer, + issuer_name: stats.issuer_name, + issuer_id: stats.issuer_id, + name_for_condition: stats.name_for_condition, + issuer_path: stats.issuer_path.into_iter().map(Into::into).collect(), + reasons: stats + .reasons + .map(|i| i.into_iter().map(Into::into).collect()), + assets: stats.assets, + source, + profile: stats.profile.map(|p| p.into()), + }) + } +} + +#[napi(object)] +pub struct JsStatsModuleProfile { + pub factory: JsStatsMillisecond, + pub integration: JsStatsMillisecond, + pub building: JsStatsMillisecond, +} + +impl From for JsStatsModuleProfile { + fn from(value: rspack_core::StatsModuleProfile) -> Self { + Self { + factory: value.factory.into(), + integration: value.integration.into(), + building: value.building.into(), + } + } +} + +#[napi(object)] +pub struct JsStatsMillisecond { + pub secs: u32, + pub subsec_millis: u32, +} + +impl From for JsStatsMillisecond { + fn from(value: rspack_core::StatsMillisecond) -> Self { + Self { + secs: value.secs as u32, + subsec_millis: value.subsec_millis, + } + } +} + +#[napi(object)] +pub struct JsStatsModuleIssuer { + pub identifier: String, + pub name: String, + pub id: Option, +} + +impl From for JsStatsModuleIssuer { + fn from(stats: rspack_core::StatsModuleIssuer) -> Self { + Self { + identifier: stats.identifier, + name: stats.name, + id: stats.id, + } + } +} + +#[napi(object)] +pub struct JsStatsModuleReason { + pub module_identifier: Option, + pub module_name: Option, + pub module_id: Option, + pub r#type: Option, + pub user_request: Option, +} + +impl From for JsStatsModuleReason { + fn from(stats: rspack_core::StatsModuleReason) -> Self { + Self { + module_identifier: stats.module_identifier, + module_name: stats.module_name, + module_id: stats.module_id, + r#type: stats.r#type, + user_request: stats.user_request, + } + } +} + +#[napi(object)] +pub struct JsStatsChunk { + pub r#type: &'static str, + pub files: Vec, + pub auxiliary_files: Vec, + pub id: String, + pub entry: bool, + pub initial: bool, + pub names: Vec, + pub size: f64, + pub modules: Option>, + pub parents: Option>, + pub children: Option>, + pub siblings: Option>, +} + +impl TryFrom> for JsStatsChunk { + type Error = napi::Error; + fn try_from(stats: rspack_core::StatsChunk) -> Result { + Ok(Self { + r#type: stats.r#type, + files: stats.files, + auxiliary_files: stats.auxiliary_files, + id: stats.id, + entry: stats.entry, + initial: stats.initial, + names: stats.names, + size: stats.size, + modules: stats + .modules + .map(|i| i.into_iter().map(|m| m.try_into()).collect::>()) + .transpose()?, + parents: stats.parents, + children: stats.children, + siblings: stats.siblings, + }) + } +} + +#[napi(object)] +pub struct JsStatsChunkGroupAsset { + pub name: String, + pub size: f64, +} + +impl From for JsStatsChunkGroupAsset { + fn from(stats: rspack_core::StatsChunkGroupAsset) -> Self { + Self { + name: stats.name, + size: stats.size, + } + } +} + +#[napi(object)] +pub struct JsStatsChunkGroup { + pub name: String, + pub assets: Vec, + pub chunks: Vec, + pub assets_size: f64, +} + +impl From for JsStatsChunkGroup { + fn from(stats: rspack_core::StatsChunkGroup) -> Self { + Self { + name: stats.name, + assets: stats.assets.into_iter().map(Into::into).collect(), + chunks: stats.chunks, + assets_size: stats.assets_size, + } + } +} + +#[napi(object)] +pub struct JsStatsAssetsByChunkName { + pub name: String, + pub files: Vec, +} + +impl From for JsStatsAssetsByChunkName { + fn from(stats: rspack_core::StatsAssetsByChunkName) -> Self { + Self { + name: stats.name, + files: stats.files, + } + } +} + +#[napi] +pub struct JsStats { + inner: SharedReference>, +} + +impl JsStats { + pub fn new(inner: SharedReference>) -> Self { + Self { inner } + } +} + +#[napi(object)] +pub struct JsStatsGetAssets { + pub assets: Vec, + pub assets_by_chunk_name: Vec, +} + +#[napi] +impl JsStats { + #[napi] + pub fn get_assets(&self) -> JsStatsGetAssets { + let (assets, assets_by_chunk_name) = self.inner.get_assets(); + let assets = assets.into_iter().map(Into::into).collect(); + let assets_by_chunk_name = assets_by_chunk_name.into_iter().map(Into::into).collect(); + JsStatsGetAssets { + assets, + assets_by_chunk_name, + } + } + + #[napi] + pub fn get_modules( + &self, + reasons: bool, + module_assets: bool, + nested_modules: bool, + source: bool, + ) -> Result> { + self + .inner + .get_modules(reasons, module_assets, nested_modules, source) + .map_err(|e| napi::Error::from_reason(e.to_string()))? + .into_iter() + .map(TryInto::try_into) + .collect() + } + + #[napi] + pub fn get_chunks( + &self, + chunk_modules: bool, + chunks_relations: bool, + reasons: bool, + module_assets: bool, + nested_modules: bool, + source: bool, + ) -> Result> { + self + .inner + .get_chunks( + chunk_modules, + chunks_relations, + reasons, + module_assets, + nested_modules, + source, + ) + .map_err(|e| napi::Error::from_reason(e.to_string()))? + .into_iter() + .map(TryInto::try_into) + .collect() + } + + #[napi] + pub fn get_entrypoints(&self) -> Vec { + self + .inner + .get_entrypoints() + .into_iter() + .map(Into::into) + .collect() + } + + #[napi] + pub fn get_named_chunk_groups(&self) -> Vec { + self + .inner + .get_named_chunk_groups() + .into_iter() + .map(Into::into) + .collect() + } + + #[napi] + pub fn get_errors(&self) -> Vec { + self + .inner + .get_errors() + .into_iter() + .map(Into::into) + .collect() + } + + #[napi] + pub fn get_warnings(&self) -> Vec { + self + .inner + .get_warnings() + .into_iter() + .map(Into::into) + .collect() + } + + #[napi] + pub fn get_logging(&self, accepted_types: u32) -> Vec { + self + .inner + .get_logging() + .into_iter() + .filter(|log| { + let bit = log.1.to_bit_flag(); + accepted_types & bit == bit + }) + .map(Into::into) + .collect() + } + + #[napi(catch_unwind)] + pub fn get_hash(&self) -> String { + self + .inner + .get_hash() + .expect("should have hash in stats::get_hash") + .to_string() + } +} diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs new file mode 100644 index 0000000..b3c9180 --- /dev/null +++ b/crates/node_binding/src/lib.rs @@ -0,0 +1,289 @@ +#![recursion_limit = "256"] +#![feature(let_chains)] +#![feature(try_blocks)] +#[macro_use] +extern crate napi_derive; + +#[macro_use] +extern crate rspack_binding_macros; + +use std::collections::HashSet; +use std::pin::Pin; +use std::sync::atomic::{AtomicU32, Ordering}; +use std::sync::Mutex; + +use napi::bindgen_prelude::*; +use once_cell::sync::Lazy; +use binding_options::RSPackRawOptions; +use rspack_core::PluginExt; +use rspack_fs_node::{AsyncNodeWritableFileSystem, ThreadsafeNodeFS}; +use rspack_napi_shared::NAPI_ENV; + +mod hook; +mod js_values; +mod loader; +mod plugins; +mod utils; + +use hook::*; +use js_values::*; + +// Napi macro registered this successfully +#[allow(unused)] +use loader::*; +use plugins::*; +use rspack_binding_options::*; +use rspack_tracing::chrome::FlushGuard; +use utils::*; + +#[cfg(not(target_os = "linux"))] +#[global_allocator] +static GLOBAL: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc; + +#[cfg(all( + target_os = "linux", + target_env = "gnu", + any(target_arch = "x86_64", target_arch = "aarch64") +))] +#[global_allocator] +static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + +static COMPILERS: Lazy< + SingleThreadedHashMap>>>, +> = Lazy::new(Default::default); + +static NEXT_COMPILER_ID: AtomicU32 = AtomicU32::new(0); + +type CompilerId = u32; + +#[napi(custom_finalize)] +pub struct Rspack { + id: CompilerId, + disabled_hooks: DisabledHooks, +} + +#[napi] +impl Rspack { + #[napi(constructor)] + pub fn new( + env: Env, + options: RSPackRawOptions, + builtin_plugins: Vec, + js_hooks: Option, + output_filesystem: ThreadsafeNodeFS, + js_loader_runner: JsFunction, + ) -> Result { + Self::prepare_environment(&env); + tracing::info!("raw_options: {:#?}", &options); + + let disabled_hooks: DisabledHooks = Default::default(); + let mut plugins = Vec::new(); + for bp in builtin_plugins { + bp.apply(&mut plugins) + .map_err(|e| Error::from_reason(format!("{e}")))?; + } + if let Some(js_hooks) = js_hooks { + plugins.push(JsHooksAdapter::from_js_hooks(env, js_hooks, disabled_hooks.clone())?.boxed()); + } + + let js_loader_runner: JsLoaderRunner = JsLoaderRunner::try_from(js_loader_runner)?; + plugins.push(JsLoaderResolver { js_loader_runner }.boxed()); + + let compiler_options = options + .apply(&mut plugins) + .map_err(|e| Error::from_reason(format!("{e}")))?; + + tracing::info!("normalized_options: {:#?}", &compiler_options); + + let rspack = rspack_core::Compiler::new( + compiler_options, + plugins, + AsyncNodeWritableFileSystem::new(env, output_filesystem) + .map_err(|e| Error::from_reason(format!("Failed to create writable filesystem: {e}",)))?, + ); + + let id = NEXT_COMPILER_ID.fetch_add(1, Ordering::SeqCst); + unsafe { COMPILERS.insert_if_vacant(id, Box::pin(rspack)) }?; + + Ok(Self { id, disabled_hooks }) + } + + #[allow(clippy::unwrap_in_result, clippy::unwrap_used)] + #[napi( + catch_unwind, + js_name = "unsafe_set_disabled_hooks", + ts_args_type = "hooks: Array" + )] + pub fn set_disabled_hooks(&self, _env: Env, hooks: Vec) -> Result<()> { + let mut disabled_hooks = self.disabled_hooks.write().unwrap(); + *disabled_hooks = hooks.into_iter().map(Into::into).collect::>(); + Ok(()) + } + + /// Build with the given option passed to the constructor + /// + /// Warning: + /// Calling this method recursively might cause a deadlock. + #[napi( + catch_unwind, + js_name = "unsafe_build", + ts_args_type = "callback: (err: null | Error) => void" + )] + pub fn build(&self, env: Env, f: JsFunction) -> Result<()> { + let handle_build = |compiler: &mut Pin>>| { + // Safety: compiler is stored in a global hashmap, so it's guaranteed to be alive. + let compiler: &'static mut Pin>> = + unsafe { std::mem::transmute::<&'_ mut _, &'static mut _>(compiler) }; + + callbackify(env, f, async move { + compiler + .build() + .await + .map_err(|e| Error::new(napi::Status::GenericFailure, format!("{e}")))?; + tracing::info!("build ok"); + Ok(()) + }) + }; + unsafe { COMPILERS.borrow_mut(&self.id, handle_build) } + } + + /// Rebuild with the given option passed to the constructor + /// + /// Warning: + /// Calling this method recursively will cause a deadlock. + #[napi( + catch_unwind, + js_name = "unsafe_rebuild", + ts_args_type = "changed_files: string[], removed_files: string[], callback: (err: null | Error) => void" + )] + pub fn rebuild( + &self, + env: Env, + changed_files: Vec, + removed_files: Vec, + f: JsFunction, + ) -> Result<()> { + let handle_rebuild = |compiler: &mut Pin>>| { + // Safety: compiler is stored in a global hashmap, so it's guaranteed to be alive. + // The reason why use Box here instead of Compiler itself is that: + // Compilers may expand and change its layout underneath, make Compiler layout change. + // Use Box to make sure the Compiler layout won't change + let compiler: &'static mut Pin>> = + unsafe { std::mem::transmute::<&'_ mut _, &'static mut _>(compiler) }; + + callbackify(env, f, async move { + compiler + .rebuild( + HashSet::from_iter(changed_files.into_iter()), + HashSet::from_iter(removed_files.into_iter()), + ) + .await + .map_err(|e| Error::new(napi::Status::GenericFailure, format!("{e:?}")))?; + tracing::info!("rebuild ok"); + Ok(()) + }) + }; + + unsafe { COMPILERS.borrow_mut(&self.id, handle_rebuild) } + } + + /// Get the last compilation + /// + /// Warning: + /// + /// Calling this method under the build or rebuild method might cause a deadlock. + /// + /// **Note** that this method is not safe if you cache the _JsCompilation_ on the Node side, as it will be invalidated by the next build and accessing a dangling ptr is a UB. + #[napi(catch_unwind, js_name = "unsafe_last_compilation")] + pub fn unsafe_last_compilation Result<()>>(&self, f: F) -> Result<()> { + let handle_last_compilation = |compiler: &mut Pin>>| { + // Safety: compiler is stored in a global hashmap, and compilation is only available in the callback of this function, so it is safe to cast to a static lifetime. See more in the warning part of this method. + // The reason why use Box here instead of Compiler itself is that: + // Compilers may expand and change its layout underneath, make Compiler layout change. + // Use Box to make sure the Compiler layout won't change + let compiler: &'static mut Pin>> = + unsafe { std::mem::transmute::<&'_ mut _, &'static mut _>(compiler) }; + f(JsCompilation::from_compilation(&mut compiler.compilation)) + }; + + unsafe { COMPILERS.borrow_mut(&self.id, handle_last_compilation) } + } + + /// Destroy the compiler + /// + /// Warning: + /// + /// Anything related to this compiler will be invalidated after this method is called. + #[napi(catch_unwind, js_name = "unsafe_drop")] + pub fn drop(&self) -> Result<()> { + unsafe { COMPILERS.remove(&self.id) }; + + Ok(()) + } +} + +impl ObjectFinalize for Rspack { + fn finalize(self, _env: Env) -> Result<()> { + // WARNING: Don't try to destroy the compiler from the finalize method. The background thread may still be working and it's a COMPLETELY unsafe way. + Ok(()) + } +} + +impl Rspack { + fn prepare_environment(env: &Env) { + NAPI_ENV.with(|napi_env| *napi_env.borrow_mut() = Some(env.raw())); + } +} + +#[derive(Default)] +enum TraceState { + On(Option), + #[default] + Off, +} + +static GLOBAL_TRACE_STATE: Lazy> = + Lazy::new(|| Mutex::new(TraceState::default())); + +/** + * Some code is modified based on + * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58 + * Apache-2.0 licensed + * Author Donny/강동윤 + * Copyright (c) + */ +#[napi(catch_unwind)] +pub fn register_global_trace( + filter: String, + #[napi(ts_arg_type = "\"chrome\" | \"logger\"")] layer: String, + output: String, +) { + let mut state = GLOBAL_TRACE_STATE + .lock() + .expect("Failed to lock GLOBAL_TRACE_STATE"); + if matches!(&*state, TraceState::Off) { + let guard = match layer.as_str() { + "chrome" => rspack_tracing::enable_tracing_by_env_with_chrome_layer(&filter, &output), + "logger" => { + rspack_tracing::enable_tracing_by_env(&filter, &output); + None + } + _ => panic!("not supported layer type:{layer}"), + }; + let new_state = TraceState::On(guard); + *state = new_state; + } +} + +#[napi(catch_unwind)] +pub fn cleanup_global_trace() { + let mut state = GLOBAL_TRACE_STATE + .lock() + .expect("Failed to lock GLOBAL_TRACE_STATE"); + if let TraceState::On(guard) = &mut *state && let Some(g) = guard.take() { + g.flush(); + drop(g); + let new_state = TraceState::Off; + *state = new_state; + } +} diff --git a/crates/node_binding/src/loader.rs b/crates/node_binding/src/loader.rs new file mode 100644 index 0000000..03eb3b9 --- /dev/null +++ b/crates/node_binding/src/loader.rs @@ -0,0 +1,14 @@ +use napi::Result; +use rspack_binding_options::JsLoaderContext; +use binding_options::run_builtin_loader as run_builtin; + +/// Builtin loader runner +#[napi(catch_unwind)] +#[allow(unused)] +pub async fn run_builtin_loader( + builtin: String, + options: Option, + loader_context: JsLoaderContext, +) -> Result { + run_builtin(builtin, options.as_deref(), loader_context).await +} diff --git a/crates/node_binding/src/plugins/loader.rs b/crates/node_binding/src/plugins/loader.rs new file mode 100644 index 0000000..1262c4d --- /dev/null +++ b/crates/node_binding/src/plugins/loader.rs @@ -0,0 +1,96 @@ +use std::{fmt::Debug, path::Path, sync::Arc}; + +use rspack_binding_options::{JsLoaderAdapter, JsLoaderRunner}; +use rspack_core::{ + BoxLoader, CompilerOptions, NormalModule, Plugin, ResolveResult, Resolver, BUILTIN_LOADER_PREFIX, +}; +use rspack_error::{internal_error, Result}; +use binding_options::get_builtin_loader; + +pub struct JsLoaderResolver { + pub js_loader_runner: JsLoaderRunner, +} + +impl Debug for JsLoaderResolver { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("JsLoaderResolver") + .field("js_loader_runner", &"..") + .finish() + } +} + +#[async_trait::async_trait] +impl Plugin for JsLoaderResolver { + async fn before_loaders(&self, module: &mut NormalModule) -> Result<()> { + let contains_inline = module.contains_inline_loader(); + let contains_js_loader = module + .loaders() + .iter() + .any(|l| !l.identifier().starts_with(BUILTIN_LOADER_PREFIX)); + + // If there's any JS loader, then we switch to the JS loader runner. + // Else, we run loader on the Rust side using the Rust loader runner. + // Note: If the loaders list contains inline loaders, + // fallback to JS loader runner for passing builtin options(reuse `Compiler.ruleSet`). + if contains_inline || contains_js_loader { + *module.loaders_mut_vec() = vec![Arc::new(JsLoaderAdapter { + runner: self.js_loader_runner.clone(), + identifier: module + .loaders() + .iter() + .map(|l| l.identifier().as_str()) + .collect::>() + .join("$") + .into(), + })]; + } + + Ok(()) + } + + async fn resolve_loader( + &self, + _compiler_options: &CompilerOptions, + context: &Path, + resolver: &Resolver, + loader_request: &str, + loader_options: Option<&str>, + ) -> Result> { + let mut rest = None; + let prev = if let Some(index) = loader_request.find('?') { + rest = Some(&loader_request[index..]); + Path::new(&loader_request[0..index]) + } else { + Path::new(loader_request) + }; + + if loader_request.starts_with(BUILTIN_LOADER_PREFIX) { + return Ok(Some(get_builtin_loader(loader_request, loader_options))); + } + + let resolve_result = resolver + .resolve(context, &prev.to_string_lossy()) + .map_err(|err| { + let loader_request = prev.display(); + let context = context.display(); + internal_error!("Failed to resolve loader: {loader_request} in {context} {err:?}") + })?; + + match resolve_result { + ResolveResult::Resource(resource) => { + // TODO: Should move this logic to `resolver`, since `resolve.alias` may contain query or fragment too. @Boshen + let resource = resource.path.to_string_lossy().to_string() + rest.unwrap_or_default(); + Ok(Some(Arc::new(JsLoaderAdapter { + identifier: resource.into(), + runner: self.js_loader_runner.clone(), + }))) + } + ResolveResult::Ignored => { + let loader_request = prev.display(); + Err(internal_error!( + "Failed to resolve loader: {loader_request}" + )) + } + } + } +} diff --git a/crates/node_binding/src/plugins/mod.rs b/crates/node_binding/src/plugins/mod.rs new file mode 100644 index 0000000..619404e --- /dev/null +++ b/crates/node_binding/src/plugins/mod.rs @@ -0,0 +1,908 @@ +mod loader; +use std::fmt::Debug; +use std::path::PathBuf; + +use async_trait::async_trait; +pub use loader::JsLoaderResolver; +use napi::{Env, Result}; +use rspack_binding_macros::js_fn_into_threadsafe_fn; +use rspack_core::{ + ChunkAssetArgs, NormalModuleAfterResolveArgs, NormalModuleBeforeResolveArgs, + PluginNormalModuleFactoryAfterResolveOutput, PluginNormalModuleFactoryBeforeResolveOutput, + PluginNormalModuleFactoryResolveForSchemeOutput, ResourceData, +}; +use rspack_error::internal_error; +use rspack_napi_shared::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode}; +use rspack_napi_shared::NapiResultExt; + +use crate::js_values::{ + AfterResolveData, BeforeResolveData, JsAssetEmittedArgs, JsChunkAssetArgs, JsModule, + JsResolveForSchemeInput, JsResolveForSchemeResult, ToJsModule, +}; +use crate::{DisabledHooks, Hook, JsCompilation, JsHooks}; + +pub struct JsHooksAdapter { + disabled_hooks: DisabledHooks, + pub make_tsfn: ThreadsafeFunction<(), ()>, + pub compilation_tsfn: ThreadsafeFunction, + pub this_compilation_tsfn: ThreadsafeFunction, + pub process_assets_stage_additional_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_pre_process_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_derived_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_additions_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_none_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_optimize_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_optimize_count_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_optimize_compatibility_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_optimize_size_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_dev_tooling_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_optimize_inline_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_summarize_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_optimize_hash_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_optimize_transfer_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_analyse_tsfn: ThreadsafeFunction<(), ()>, + pub process_assets_stage_report_tsfn: ThreadsafeFunction<(), ()>, + pub emit_tsfn: ThreadsafeFunction<(), ()>, + pub asset_emitted_tsfn: ThreadsafeFunction, + pub after_emit_tsfn: ThreadsafeFunction<(), ()>, + pub optimize_modules_tsfn: ThreadsafeFunction, + pub optimize_tree_tsfn: ThreadsafeFunction<(), ()>, + pub optimize_chunk_modules_tsfn: ThreadsafeFunction, + pub before_compile_tsfn: ThreadsafeFunction<(), ()>, + pub after_compile_tsfn: ThreadsafeFunction, + pub finish_modules_tsfn: ThreadsafeFunction, + pub finish_make_tsfn: ThreadsafeFunction, + pub build_module_tsfn: ThreadsafeFunction, // TODO + pub chunk_asset_tsfn: ThreadsafeFunction, + pub before_resolve: ThreadsafeFunction, BeforeResolveData)>, + pub after_resolve: ThreadsafeFunction>, + pub context_module_before_resolve: ThreadsafeFunction>, + pub normal_module_factory_resolve_for_scheme: + ThreadsafeFunction, + pub succeed_module_tsfn: ThreadsafeFunction, + pub still_valid_module_tsfn: ThreadsafeFunction, +} + +impl Debug for JsHooksAdapter { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "rspack_plugin_js_hooks_adapter") + } +} + +#[async_trait] +impl rspack_core::Plugin for JsHooksAdapter { + fn name(&self) -> &'static str { + "rspack_plugin_js_hooks_adapter" + } + + async fn compilation( + &self, + args: rspack_core::CompilationArgs<'_>, + ) -> rspack_core::PluginCompilationHookOutput { + if self.is_hook_disabled(&Hook::Compilation) { + return Ok(()); + } + + let compilation = JsCompilation::from_compilation(unsafe { + std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( + args.compilation, + ) + }); + + self + .compilation_tsfn + .call(compilation, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call compilation: {err}"))? + } + + async fn this_compilation( + &self, + args: rspack_core::ThisCompilationArgs<'_>, + ) -> rspack_core::PluginThisCompilationHookOutput { + if self.is_hook_disabled(&Hook::ThisCompilation) { + return Ok(()); + } + + let compilation = JsCompilation::from_compilation(unsafe { + std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( + args.this_compilation, + ) + }); + + self + .this_compilation_tsfn + .call(compilation, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call this_compilation: {err}"))? + } + + async fn chunk_asset(&self, args: &ChunkAssetArgs) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::ChunkAsset) { + return Ok(()); + } + + self + .chunk_asset_tsfn + .call( + JsChunkAssetArgs::from(args), + ThreadsafeFunctionCallMode::NonBlocking, + ) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to chunk asset: {err}"))? + } + + #[tracing::instrument(name = "js_hooks_adapter::make", skip_all)] + async fn make( + &self, + _ctx: rspack_core::PluginContext, + _compilation: &mut rspack_core::Compilation, + _param: &mut rspack_core::MakeParam, + ) -> rspack_core::PluginMakeHookOutput { + if self.is_hook_disabled(&Hook::Make) { + return Ok(()); + } + + // We don't need to expose `compilation` to Node as it's already been exposed via `compilation` hook + self + .make_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call make: {err}",))? + } + + async fn before_resolve( + &self, + _ctx: rspack_core::PluginContext, + args: &mut NormalModuleBeforeResolveArgs, + ) -> PluginNormalModuleFactoryBeforeResolveOutput { + if self.is_hook_disabled(&Hook::BeforeResolve) { + return Ok(None); + } + match self + .before_resolve + .call(args.clone().into(), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call this_compilation: {err}"))? + { + Ok((ret, resolve_data)) => { + args.request = resolve_data.request; + args.context = resolve_data.context; + Ok(ret) + } + Err(err) => Err(err), + } + } + + async fn after_resolve( + &self, + _ctx: rspack_core::PluginContext, + args: &NormalModuleAfterResolveArgs, + ) -> PluginNormalModuleFactoryAfterResolveOutput { + if self.is_hook_disabled(&Hook::AfterResolve) { + return Ok(None); + } + self + .after_resolve + .call(args.clone().into(), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call this_compilation: {err}"))? + } + async fn context_module_before_resolve( + &self, + _ctx: rspack_core::PluginContext, + args: &mut NormalModuleBeforeResolveArgs, + ) -> PluginNormalModuleFactoryBeforeResolveOutput { + self + .context_module_before_resolve + .call(args.clone().into(), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call this_compilation: {err}"))? + } + async fn normal_module_factory_resolve_for_scheme( + &self, + _ctx: rspack_core::PluginContext, + args: ResourceData, + ) -> PluginNormalModuleFactoryResolveForSchemeOutput { + if self.is_hook_disabled(&Hook::NormalModuleFactoryResolveForScheme) { + return Ok((args, false)); + } + let res = self + .normal_module_factory_resolve_for_scheme + .call(args.into(), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call this_compilation: {err}"))?; + res.map(|res| { + let JsResolveForSchemeResult { + resource_data, + stop, + } = res; + ( + ResourceData::new(resource_data.resource, PathBuf::from(resource_data.path)) + .query_optional(resource_data.query) + .fragment_optional(resource_data.fragment), + stop, + ) + }) + } + + async fn process_assets_stage_additional( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageAdditional) { + return Ok(()); + } + + self + .process_assets_stage_additional_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage additional: {err}",))? + } + + async fn process_assets_stage_pre_process( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStagePreProcess) { + return Ok(()); + } + + self + .process_assets_stage_pre_process_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage pre-process: {err}",))? + } + + async fn process_assets_stage_derived( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageDerived) { + return Ok(()); + } + + self + .process_assets_stage_derived_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage derived: {err}",))? + } + + async fn process_assets_stage_additions( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageAdditions) { + return Ok(()); + } + + self + .process_assets_stage_additions_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage additions: {err}",))? + } + + async fn process_assets_stage_none( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageNone) { + return Ok(()); + } + + self + .process_assets_stage_none_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets: {err}",))? + } + + async fn process_assets_stage_optimize( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageOptimize) { + return Ok(()); + } + + self + .process_assets_stage_optimize_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage optimize: {err}",))? + } + + async fn process_assets_stage_optimize_count( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageOptimizeCount) { + return Ok(()); + } + + self + .process_assets_stage_optimize_count_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err( + |err| internal_error!("Failed to call process assets stage optimize count: {err}",), + )? + } + + async fn process_assets_stage_optimize_compatibility( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageOptimizeCompatibility) { + return Ok(()); + } + + self + .process_assets_stage_optimize_compatibility_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| { + internal_error!("Failed to call process assets stage optimize compatibility: {err}",) + })? + } + + async fn process_assets_stage_optimize_size( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageOptimizeSize) { + return Ok(()); + } + + self + .process_assets_stage_optimize_size_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage optimize size: {err}",))? + } + + async fn process_assets_stage_dev_tooling( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageDevTooling) { + return Ok(()); + } + + self + .process_assets_stage_dev_tooling_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage dev tooling: {err}",))? + } + + async fn process_assets_stage_optimize_inline( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageOptimizeInline) { + return Ok(()); + } + + self + .process_assets_stage_optimize_inline_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| { + internal_error!("Failed to call process assets stage optimize inline: {err}",) + })? + } + + async fn process_assets_stage_summarize( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageSummarize) { + return Ok(()); + } + + // Directly calling hook processAssets without converting assets to JsAssets, instead, we use APIs to get `Source` lazily on the Node side. + self + .process_assets_stage_summarize_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage summarize: {err}",))? + } + + async fn process_assets_stage_optimize_hash( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageOptimizeHash) { + return Ok(()); + } + + self + .process_assets_stage_optimize_hash_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage summarize: {err}",))? + } + + async fn process_assets_stage_optimize_transfer( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageOptimizeTransfer) { + return Ok(()); + } + + self + .process_assets_stage_optimize_transfer_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| { + internal_error!("Failed to call process assets stage optimize transfer: {err}",) + })? + } + + async fn process_assets_stage_analyse( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageAnalyse) { + return Ok(()); + } + + self + .process_assets_stage_analyse_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage analyse: {err}",))? + } + + async fn process_assets_stage_report( + &self, + _ctx: rspack_core::PluginContext, + _args: rspack_core::ProcessAssetsArgs<'_>, + ) -> rspack_core::PluginProcessAssetsHookOutput { + if self.is_hook_disabled(&Hook::ProcessAssetsStageReport) { + return Ok(()); + } + // Directly calling hook processAssets without converting assets to JsAssets, instead, we use APIs to get `Source` lazily on the Node side. + self + .process_assets_stage_report_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call process assets stage report: {err}",))? + } + + async fn optimize_modules( + &self, + compilation: &mut rspack_core::Compilation, + ) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::OptimizeModules) { + return Ok(()); + } + let compilation = JsCompilation::from_compilation(unsafe { + std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( + compilation, + ) + }); + self + .optimize_modules_tsfn + .call(compilation, ThreadsafeFunctionCallMode::Blocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call optimize modules: {err}"))? + } + + async fn optimize_tree( + &self, + _compilation: &mut rspack_core::Compilation, + ) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::OptimizeTree) { + return Ok(()); + } + self + .optimize_tree_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call optimize tree: {err}",))? + } + + async fn optimize_chunk_modules( + &self, + args: rspack_core::OptimizeChunksArgs<'_>, + ) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::OptimizeChunkModules) { + return Ok(()); + } + + let compilation = JsCompilation::from_compilation(unsafe { + std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( + args.compilation, + ) + }); + + self + .optimize_chunk_modules_tsfn + .call(compilation, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to compilation: {err}"))? + } + + async fn before_compile( + &self, + // args: &mut rspack_core::CompilationArgs<'_> + ) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::BeforeCompile) { + return Ok(()); + } + + self + .before_compile_tsfn + .call({}, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call before compile: {err}",))? + } + + async fn after_compile( + &self, + compilation: &mut rspack_core::Compilation, + ) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::AfterCompile) { + return Ok(()); + } + + let compilation = JsCompilation::from_compilation(unsafe { + std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( + compilation, + ) + }); + + self + .after_compile_tsfn + .call(compilation, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call after compile: {err}"))? + } + + async fn finish_make( + &self, + compilation: &mut rspack_core::Compilation, + ) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::FinishMake) { + return Ok(()); + } + + let compilation = JsCompilation::from_compilation(unsafe { + std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( + compilation, + ) + }); + + self + .finish_make_tsfn + .call(compilation, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call finish make: {err}"))? + } + + async fn build_module(&self, module: &mut dyn rspack_core::Module) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::BuildModule) { + return Ok(()); + } + + self + .build_module_tsfn + .call( + module.to_js_module().expect("Convert to js_module failed."), + ThreadsafeFunctionCallMode::NonBlocking, + ) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call build module: {err}"))? + } + + async fn finish_modules( + &self, + compilation: &mut rspack_core::Compilation, + ) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::FinishModules) { + return Ok(()); + } + + let compilation = JsCompilation::from_compilation(unsafe { + std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( + compilation, + ) + }); + + self + .finish_modules_tsfn + .call(compilation, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to finish modules: {err}"))? + } + + async fn emit(&self, _: &mut rspack_core::Compilation) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::Emit) { + return Ok(()); + } + + self + .emit_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call emit: {err}"))? + } + + async fn asset_emitted(&self, args: &rspack_core::AssetEmittedArgs) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::AssetEmitted) { + return Ok(()); + } + + let args: JsAssetEmittedArgs = args.into(); + self + .asset_emitted_tsfn + .call(args, ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call asset emitted: {err}"))? + } + + async fn after_emit(&self, _: &mut rspack_core::Compilation) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::AfterEmit) { + return Ok(()); + } + + self + .after_emit_tsfn + .call((), ThreadsafeFunctionCallMode::NonBlocking) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call after emit: {err}",))? + } + + async fn succeed_module(&self, args: &dyn rspack_core::Module) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::SucceedModule) { + return Ok(()); + } + + self + .succeed_module_tsfn + .call( + args.to_js_module().expect("Convert to js_module failed."), + ThreadsafeFunctionCallMode::NonBlocking, + ) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call succeed_module hook: {err}"))? + } + + async fn still_valid_module(&self, args: &dyn rspack_core::Module) -> rspack_error::Result<()> { + if self.is_hook_disabled(&Hook::StillValidModule) { + return Ok(()); + } + + self + .still_valid_module_tsfn + .call( + args.to_js_module().expect("Convert to js_module failed."), + ThreadsafeFunctionCallMode::NonBlocking, + ) + .into_rspack_result()? + .await + .map_err(|err| internal_error!("Failed to call still_valid_module hook: {err}"))? + } +} + +impl JsHooksAdapter { + pub fn from_js_hooks(env: Env, js_hooks: JsHooks, disabled_hooks: DisabledHooks) -> Result { + let JsHooks { + make, + process_assets_stage_additional, + process_assets_stage_pre_process, + process_assets_stage_derived, + process_assets_stage_additions, + process_assets_stage_none, + process_assets_stage_optimize, + process_assets_stage_optimize_count, + process_assets_stage_optimize_compatibility, + process_assets_stage_optimize_size, + process_assets_stage_dev_tooling, + process_assets_stage_optimize_inline, + process_assets_stage_summarize, + process_assets_stage_optimize_hash, + process_assets_stage_optimize_transfer, + process_assets_stage_analyse, + process_assets_stage_report, + this_compilation, + compilation, + emit, + asset_emitted, + after_emit, + optimize_modules, + optimize_tree, + optimize_chunk_module, + before_resolve, + after_resolve, + context_module_before_resolve, + normal_module_factory_resolve_for_scheme, + before_compile, + after_compile, + finish_modules, + finish_make, + build_module, + chunk_asset, + succeed_module, + still_valid_module, + } = js_hooks; + + let process_assets_stage_additional_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_additional, env); + let process_assets_stage_pre_process_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_pre_process, env); + let process_assets_stage_derived_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_derived, env); + let process_assets_stage_additions_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_additions, env); + let process_assets_stage_none_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_none, env); + let process_assets_stage_optimize_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_optimize, env); + let process_assets_stage_optimize_count_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_optimize_count, env); + let process_assets_stage_optimize_compatibility_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_optimize_compatibility, env); + let process_assets_stage_optimize_size_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_optimize_size, env); + let process_assets_stage_dev_tooling_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_dev_tooling, env); + let process_assets_stage_optimize_inline_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_optimize_inline, env); + let process_assets_stage_optimize_transfer_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_optimize_transfer, env); + let process_assets_stage_analyse_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_analyse, env); + let process_assets_stage_summarize_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_summarize, env); + let process_assets_stage_optimize_hash_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_optimize_hash, env); + let process_assets_stage_report_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(process_assets_stage_report, env); + let emit_tsfn: ThreadsafeFunction<(), ()> = js_fn_into_threadsafe_fn!(emit, env); + let asset_emitted_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(asset_emitted, env); + let after_emit_tsfn: ThreadsafeFunction<(), ()> = js_fn_into_threadsafe_fn!(after_emit, env); + let this_compilation_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(this_compilation, env); + let compilation_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(compilation, env); + let make_tsfn: ThreadsafeFunction<(), ()> = js_fn_into_threadsafe_fn!(make, env); + let optimize_modules_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(optimize_modules, env); + let optimize_tree_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(optimize_tree, env); + let optimize_chunk_modules_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(optimize_chunk_module, env); + let before_compile_tsfn: ThreadsafeFunction<(), ()> = + js_fn_into_threadsafe_fn!(before_compile, env); + let after_compile_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(after_compile, env); + let finish_make_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(finish_make, env); + let build_module_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(build_module, env); + let finish_modules_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(finish_modules, env); + let context_module_before_resolve: ThreadsafeFunction> = + js_fn_into_threadsafe_fn!(context_module_before_resolve, env); + let before_resolve: ThreadsafeFunction, BeforeResolveData)> = + js_fn_into_threadsafe_fn!(before_resolve, env); + let after_resolve: ThreadsafeFunction> = + js_fn_into_threadsafe_fn!(after_resolve, env); + let normal_module_factory_resolve_for_scheme: ThreadsafeFunction< + JsResolveForSchemeInput, + JsResolveForSchemeResult, + > = js_fn_into_threadsafe_fn!(normal_module_factory_resolve_for_scheme, env); + let chunk_asset_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(chunk_asset, env); + let succeed_module_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(succeed_module, env); + let still_valid_module_tsfn: ThreadsafeFunction = + js_fn_into_threadsafe_fn!(still_valid_module, env); + + Ok(JsHooksAdapter { + disabled_hooks, + make_tsfn, + process_assets_stage_additional_tsfn, + process_assets_stage_pre_process_tsfn, + process_assets_stage_derived_tsfn, + process_assets_stage_additions_tsfn, + process_assets_stage_none_tsfn, + process_assets_stage_optimize_tsfn, + process_assets_stage_optimize_count_tsfn, + process_assets_stage_optimize_compatibility_tsfn, + process_assets_stage_optimize_size_tsfn, + process_assets_stage_dev_tooling_tsfn, + process_assets_stage_optimize_inline_tsfn, + process_assets_stage_summarize_tsfn, + process_assets_stage_optimize_hash_tsfn, + process_assets_stage_optimize_transfer_tsfn, + process_assets_stage_analyse_tsfn, + process_assets_stage_report_tsfn, + compilation_tsfn, + this_compilation_tsfn, + emit_tsfn, + asset_emitted_tsfn, + after_emit_tsfn, + optimize_modules_tsfn, + optimize_tree_tsfn, + optimize_chunk_modules_tsfn, + before_compile_tsfn, + after_compile_tsfn, + before_resolve, + context_module_before_resolve, + normal_module_factory_resolve_for_scheme, + finish_modules_tsfn, + finish_make_tsfn, + build_module_tsfn, + chunk_asset_tsfn, + after_resolve, + succeed_module_tsfn, + still_valid_module_tsfn, + }) + } + + #[allow(clippy::unwrap_used)] + fn is_hook_disabled(&self, hook: &Hook) -> bool { + self.disabled_hooks.read().expect("").contains(hook) + } +} diff --git a/crates/node_binding/src/utils.rs b/crates/node_binding/src/utils.rs new file mode 100644 index 0000000..4e1104a --- /dev/null +++ b/crates/node_binding/src/utils.rs @@ -0,0 +1,203 @@ +use std::ffi::CStr; +use std::io::Write; +use std::ptr; + +use dashmap::DashMap; +use futures::Future; +use napi::bindgen_prelude::*; +use napi::{check_status, Env, Error, JsFunction, JsUnknown, NapiRaw, Result}; +use rspack_error::CatchUnwindFuture; +use rspack_napi_shared::threadsafe_function::{ + ThreadSafeContext, ThreadsafeFunction, ThreadsafeFunctionCallMode, +}; + +/// Try to resolve the string value of a given named property +#[allow(unused)] +pub(crate) fn get_named_property_value_string( + env: Env, + object: T, + property_name: &str, +) -> Result { + let mut bytes_with_nul: Vec = Vec::with_capacity(property_name.len() + 1); + + write!(&mut bytes_with_nul, "{property_name}")?; + write!(&mut bytes_with_nul, "\0")?; + + let mut value_ptr = ptr::null_mut(); + + check_status!( + unsafe { + napi_sys::napi_get_named_property( + env.raw(), + object.raw(), + CStr::from_bytes_with_nul_unchecked(&bytes_with_nul).as_ptr(), + &mut value_ptr, + ) + }, + "failed to get the value" + )?; + + let mut str_len = 0; + check_status!( + unsafe { + napi_sys::napi_get_value_string_utf8(env.raw(), value_ptr, ptr::null_mut(), 0, &mut str_len) + }, + "failed to get the value" + )?; + + str_len += 1; + let mut buf = Vec::with_capacity(str_len); + let mut copied_len = 0; + + check_status!( + unsafe { + napi_sys::napi_get_value_string_utf8( + env.raw(), + value_ptr, + buf.as_mut_ptr(), + str_len, + &mut copied_len, + ) + }, + "failed to get the value" + )?; + + // Vec -> Vec See: https://stackoverflow.com/questions/59707349/cast-vector-of-i8-to-vector-of-u8-in-rust + let mut buf = std::mem::ManuallyDrop::new(buf); + + let buf = unsafe { Vec::from_raw_parts(buf.as_mut_ptr() as *mut u8, copied_len, copied_len) }; + + String::from_utf8(buf).map_err(|_| Error::from_reason("failed to get property")) +} + +pub fn callbackify(env: Env, f: JsFunction, fut: F) -> Result<()> +where + R: 'static + ToNapiValue, + F: 'static + Send + Future>, +{ + let ptr = unsafe { f.raw() }; + + let tsfn = ThreadsafeFunction::, ()>::create(env.raw(), ptr, 0, |ctx| { + let ThreadSafeContext { + value, + env, + callback, + .. + } = ctx; + + let argv = match value { + Ok(value) => { + let val = unsafe { R::to_napi_value(env.raw(), value)? }; + let js_value = unsafe { JsUnknown::from_napi_value(env.raw(), val)? }; + vec![env.get_null()?.into_unknown(), js_value] + } + Err(err) => { + vec![JsError::from(err).into_unknown(env)] + } + }; + + callback.call(None, &argv)?; + + Ok(()) + })?; + + napi::bindgen_prelude::spawn(async move { + let fut = CatchUnwindFuture::create(fut); + let res = fut.await; + match res { + Ok(result) => { + tsfn + .call(result, ThreadsafeFunctionCallMode::NonBlocking) + .expect("Failed to call JS callback"); + } + Err(e) => { + tsfn + .call( + Err(Error::from_reason(format!("{e}"))), + ThreadsafeFunctionCallMode::NonBlocking, + ) + .expect("Failed to send panic info"); + } + } + }); + + Ok(()) +} + +// **Note** that Node's main thread and the worker thread share the same binding context. Using `Mutex` would cause deadlocks if multiple compilers exist. +pub(crate) struct SingleThreadedHashMap(DashMap); + +impl SingleThreadedHashMap +where + K: Eq + std::hash::Hash + std::fmt::Display, +{ + /// Acquire a mutable reference to the inner hashmap. + /// + /// Safety: Mutable reference can almost let you do anything you want, this is intended to be used from the thread where the map was created. + pub(crate) unsafe fn borrow_mut(&self, key: &K, f: F) -> Result + where + F: FnOnce(&mut V) -> Result, + { + let mut inner = self.0.get_mut(key).ok_or_else(|| { + napi::Error::from_reason(format!( + "Failed to find key {key} for single-threaded hashmap", + )) + })?; + + f(&mut inner) + } + + /// Acquire a shared reference to the inner hashmap. + /// + /// Safety: It's not thread-safe if a value is not safe to modify cross thread boundary, so this is intended to be used from the thread where the map was created. + #[allow(unused)] + pub(crate) unsafe fn borrow(&self, key: &K, f: F) -> Result + where + F: FnOnce(&V) -> Result, + { + let inner = self.0.get(key).ok_or_else(|| { + napi::Error::from_reason(format!( + "Failed to find key {key} for single-threaded hashmap", + )) + })?; + + f(&*inner) + } + + /// Insert a value into the map. + /// + /// Safety: It's not thread-safe if a value has thread affinity, so this is intended to be used from the thread where the map was created. + pub(crate) unsafe fn insert_if_vacant(&self, key: K, value: V) -> Result<()> { + if let dashmap::mapref::entry::Entry::Vacant(vacant) = self.0.entry(key) { + vacant.insert(value); + Ok(()) + } else { + Err(napi::Error::from_reason( + "Failed to insert on single-threaded hashmap as it's not vacant", + )) + } + } + + /// Remove a value from the map. + /// + /// See: [DashMap::remove] for more details. https://docs.rs/dashmap/latest/dashmap/struct.DashMap.html#method.remove + /// + /// Safety: It's not thread-safe if a value has thread affinity, so this is intended to be used from the thread where the map was created. + #[allow(unused)] + pub(crate) unsafe fn remove(&self, key: &K) -> Option { + self.0.remove(key).map(|(_, v)| v) + } +} + +impl Default for SingleThreadedHashMap +where + K: Eq + std::hash::Hash, +{ + fn default() -> Self { + Self(Default::default()) + } +} + +// Safety: Methods are already marked as unsafe. +unsafe impl Send for SingleThreadedHashMap {} +unsafe impl Sync for SingleThreadedHashMap {} diff --git a/crates/plugin_manifest/Cargo.toml b/crates/plugin_manifest/Cargo.toml new file mode 100644 index 0000000..f9525ff --- /dev/null +++ b/crates/plugin_manifest/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "plugin_manifest" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +async-trait = { workspace = true } +tracing = { workspace = true } +rspack_core = { path = "../.rspack_crates/rspack_core" } +rspack_error = { path = "../.rspack_crates/rspack_error" } + +[dev-dependencies] +rspack_testing = { path = "../.rspack_crates/rspack_testing" } \ No newline at end of file diff --git a/crates/plugin_manifest/src/lib.rs b/crates/plugin_manifest/src/lib.rs new file mode 100644 index 0000000..a9ef53b --- /dev/null +++ b/crates/plugin_manifest/src/lib.rs @@ -0,0 +1,2 @@ +mod plugin; +pub use plugin::*; \ No newline at end of file diff --git a/crates/plugin_manifest/src/plugin.rs b/crates/plugin_manifest/src/plugin.rs new file mode 100644 index 0000000..e89bfac --- /dev/null +++ b/crates/plugin_manifest/src/plugin.rs @@ -0,0 +1,58 @@ +use rspack_core::{ + Plugin,PluginContext, PluginProcessAssetsOutput,ProcessAssetsArgs, + CompilationAsset, + rspack_sources::{RawSource, SourceExt}, +}; +// use rspack_error::Result; + +#[derive(Debug)] +pub struct ManifestPlugin; + +impl ManifestPlugin { + pub fn new() -> Self { + Self {} + } +} + +fn default_cotent() -> &'static str { + r#"{"assets": []}"# +} + +#[async_trait::async_trait] +impl Plugin for ManifestPlugin { + fn name(&self) -> &'static str { + "ManifestPlugin" + } + + async fn process_assets_stage_additional( + &self, + _ctx: PluginContext, + args: ProcessAssetsArgs<'_>, + )-> PluginProcessAssetsOutput { + let compilation = args.compilation; + let entry_points = &compilation.entrypoints; + println!("entry_points: {:?}", entry_points); + Ok(()) + } + + async fn process_assets_stage_optimize_inline( + &self, + _ctx: PluginContext, + args: ProcessAssetsArgs<'_>, + ) -> PluginProcessAssetsOutput { + let compilation = args.compilation; + + let output_path = compilation + .options + .output + .path + .join("manifest.json".to_string()).to_string_lossy().to_string(); + println!("output_path: {}", output_path); + compilation.emit_asset( + output_path, + CompilationAsset::from(RawSource::from(default_cotent().to_owned()).boxed()), + ); + + Ok(()) + } +} diff --git a/crates/plugin_manifest/tests/fixtures.rs b/crates/plugin_manifest/tests/fixtures.rs new file mode 100644 index 0000000..d28f36b --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures.rs @@ -0,0 +1,16 @@ +use std::path::PathBuf; +use rspack_core::PluginExt; +use rspack_testing::{fixture,test_fixture_insta}; +use plugin_manifest::ManifestPlugin; + +#[fixture("tests/fixtures/*")] +fn manifest(fixture_path: PathBuf) { + test_fixture_insta( + &fixture_path, + // TODO: check the specific file output. + &|_| false, + Box::new(|plugins, _| { + plugins.push(ManifestPlugin::new().boxed()) + }) + ); +} \ No newline at end of file diff --git a/crates/plugin_manifest/tests/fixtures/basic/index.css b/crates/plugin_manifest/tests/fixtures/basic/index.css new file mode 100644 index 0000000..ecf0176 --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/basic/index.css @@ -0,0 +1,3 @@ +html, body { + background-color: green; +} \ No newline at end of file diff --git a/crates/plugin_manifest/tests/fixtures/basic/index.js b/crates/plugin_manifest/tests/fixtures/basic/index.js new file mode 100644 index 0000000..13a10b9 --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/basic/index.js @@ -0,0 +1,3 @@ +import './index.css'; + +console.log('index.js'); diff --git a/crates/plugin_manifest/tests/fixtures/basic/snapshot/output.snap b/crates/plugin_manifest/tests/fixtures/basic/snapshot/output.snap new file mode 100644 index 0000000..7f2f1f4 --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/basic/snapshot/output.snap @@ -0,0 +1,3 @@ +--- +source: crates/.rspack_crates/rspack_testing/src/run_fixture.rs +--- diff --git a/crates/plugin_manifest/tests/fixtures/basic/test.config.json b/crates/plugin_manifest/tests/fixtures/basic/test.config.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/basic/test.config.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 4385a3c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -/* auto-generated by NAPI-RS */ - -export function getCssModulesLocalIdent(filepath: string, local: string, template: string): string diff --git a/index.js b/index.js deleted file mode 100644 index 792a4af..0000000 --- a/index.js +++ /dev/null @@ -1,257 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -/* auto-generated by NAPI-RS */ - -const { existsSync, readFileSync } = require('fs') -const { join } = require('path') - -const { platform, arch } = process - -let nativeBinding = null -let localFileExisted = false -let loadError = null - -function isMusl() { - // For Node 10 - if (!process.report || typeof process.report.getReport !== 'function') { - try { - const lddPath = require('child_process').execSync('which ldd').toString().trim() - return readFileSync(lddPath, 'utf8').includes('musl') - } catch (e) { - return true - } - } else { - const { glibcVersionRuntime } = process.report.getReport().header - return !glibcVersionRuntime - } -} - -switch (platform) { - case 'android': - switch (arch) { - case 'arm64': - localFileExisted = existsSync(join(__dirname, 'css-modules-hash.android-arm64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.android-arm64.node') - } else { - nativeBinding = require('@ice/css-modules-hash-android-arm64') - } - } catch (e) { - loadError = e - } - break - case 'arm': - localFileExisted = existsSync(join(__dirname, 'css-modules-hash.android-arm-eabi.node')) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.android-arm-eabi.node') - } else { - nativeBinding = require('@ice/css-modules-hash-android-arm-eabi') - } - } catch (e) { - loadError = e - } - break - default: - throw new Error(`Unsupported architecture on Android ${arch}`) - } - break - case 'win32': - switch (arch) { - case 'x64': - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.win32-x64-msvc.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.win32-x64-msvc.node') - } else { - nativeBinding = require('@ice/css-modules-hash-win32-x64-msvc') - } - } catch (e) { - loadError = e - } - break - case 'ia32': - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.win32-ia32-msvc.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.win32-ia32-msvc.node') - } else { - nativeBinding = require('@ice/css-modules-hash-win32-ia32-msvc') - } - } catch (e) { - loadError = e - } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.win32-arm64-msvc.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.win32-arm64-msvc.node') - } else { - nativeBinding = require('@ice/css-modules-hash-win32-arm64-msvc') - } - } catch (e) { - loadError = e - } - break - default: - throw new Error(`Unsupported architecture on Windows: ${arch}`) - } - break - case 'darwin': - localFileExisted = existsSync(join(__dirname, 'css-modules-hash.darwin-universal.node')) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.darwin-universal.node') - } else { - nativeBinding = require('@ice/css-modules-hash-darwin-universal') - } - break - } catch {} - switch (arch) { - case 'x64': - localFileExisted = existsSync(join(__dirname, 'css-modules-hash.darwin-x64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.darwin-x64.node') - } else { - nativeBinding = require('@ice/css-modules-hash-darwin-x64') - } - } catch (e) { - loadError = e - } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.darwin-arm64.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.darwin-arm64.node') - } else { - nativeBinding = require('@ice/css-modules-hash-darwin-arm64') - } - } catch (e) { - loadError = e - } - break - default: - throw new Error(`Unsupported architecture on macOS: ${arch}`) - } - break - case 'freebsd': - if (arch !== 'x64') { - throw new Error(`Unsupported architecture on FreeBSD: ${arch}`) - } - localFileExisted = existsSync(join(__dirname, 'css-modules-hash.freebsd-x64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.freebsd-x64.node') - } else { - nativeBinding = require('@ice/css-modules-hash-freebsd-x64') - } - } catch (e) { - loadError = e - } - break - case 'linux': - switch (arch) { - case 'x64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.linux-x64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.linux-x64-musl.node') - } else { - nativeBinding = require('@ice/css-modules-hash-linux-x64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.linux-x64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.linux-x64-gnu.node') - } else { - nativeBinding = require('@ice/css-modules-hash-linux-x64-gnu') - } - } catch (e) { - loadError = e - } - } - break - case 'arm64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.linux-arm64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.linux-arm64-musl.node') - } else { - nativeBinding = require('@ice/css-modules-hash-linux-arm64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.linux-arm64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.linux-arm64-gnu.node') - } else { - nativeBinding = require('@ice/css-modules-hash-linux-arm64-gnu') - } - } catch (e) { - loadError = e - } - } - break - case 'arm': - localFileExisted = existsSync( - join(__dirname, 'css-modules-hash.linux-arm-gnueabihf.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./css-modules-hash.linux-arm-gnueabihf.node') - } else { - nativeBinding = require('@ice/css-modules-hash-linux-arm-gnueabihf') - } - } catch (e) { - loadError = e - } - break - default: - throw new Error(`Unsupported architecture on Linux: ${arch}`) - } - break - default: - throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`) -} - -if (!nativeBinding) { - if (loadError) { - throw loadError - } - throw new Error(`Failed to load native binding`) -} - -const { getCssModulesLocalIdent } = nativeBinding - -module.exports.getCssModulesLocalIdent = getCssModulesLocalIdent diff --git a/npm/darwin-arm64/README.md b/npm/darwin-arm64/README.md deleted file mode 100644 index 5a0a92a..0000000 --- a/npm/darwin-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@ice/css-modules-hash-darwin-arm64` - -This is the **aarch64-apple-darwin** binary for `@ice/css-modules-hash` diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json deleted file mode 100644 index a10f761..0000000 --- a/npm/darwin-arm64/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@ice/css-modules-hash-darwin-arm64", - "version": "0.0.6", - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "main": "css-modules-hash.darwin-arm64.node", - "files": [ - "css-modules-hash.darwin-arm64.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "repository": { - "url": "https://github.com/ice-lab/awesome-ice" - } -} \ No newline at end of file diff --git a/npm/darwin-universal/README.md b/npm/darwin-universal/README.md deleted file mode 100644 index 1b5804a..0000000 --- a/npm/darwin-universal/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@ice/css-modules-hash-darwin-universal` - -This is the **universal-apple-darwin** binary for `@ice/css-modules-hash` diff --git a/npm/darwin-universal/package.json b/npm/darwin-universal/package.json deleted file mode 100644 index 4b5e4ed..0000000 --- a/npm/darwin-universal/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "@ice/css-modules-hash-darwin-universal", - "version": "0.0.6", - "os": [ - "darwin" - ], - "main": "css-modules-hash.darwin-universal.node", - "files": [ - "css-modules-hash.darwin-universal.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "repository": { - "url": "https://github.com/ice-lab/awesome-ice" - } -} \ No newline at end of file diff --git a/npm/darwin-x64/README.md b/npm/darwin-x64/README.md deleted file mode 100644 index 3080f4e..0000000 --- a/npm/darwin-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@ice/css-modules-hash-darwin-x64` - -This is the **x86_64-apple-darwin** binary for `@ice/css-modules-hash` diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json deleted file mode 100644 index e0e6574..0000000 --- a/npm/darwin-x64/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@ice/css-modules-hash-darwin-x64", - "version": "0.0.6", - "os": [ - "darwin" - ], - "cpu": [ - "x64" - ], - "main": "css-modules-hash.darwin-x64.node", - "files": [ - "css-modules-hash.darwin-x64.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "repository": { - "url": "https://github.com/ice-lab/awesome-ice" - } -} \ No newline at end of file diff --git a/npm/linux-x64-gnu/README.md b/npm/linux-x64-gnu/README.md deleted file mode 100644 index 69c9c95..0000000 --- a/npm/linux-x64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@ice/css-modules-hash-linux-x64-gnu` - -This is the **x86_64-unknown-linux-gnu** binary for `@ice/css-modules-hash` diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json deleted file mode 100644 index 10f703f..0000000 --- a/npm/linux-x64-gnu/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@ice/css-modules-hash-linux-x64-gnu", - "version": "0.0.6", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "main": "css-modules-hash.linux-x64-gnu.node", - "files": [ - "css-modules-hash.linux-x64-gnu.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "libc": [ - "glibc" - ], - "repository": { - "url": "https://github.com/ice-lab/awesome-ice" - } -} \ No newline at end of file diff --git a/npm/linux-x64-musl/README.md b/npm/linux-x64-musl/README.md deleted file mode 100644 index b3c1e21..0000000 --- a/npm/linux-x64-musl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@ice/css-modules-hash-linux-x64-musl` - -This is the **x86_64-unknown-linux-musl** binary for `@ice/css-modules-hash` diff --git a/npm/linux-x64-musl/package.json b/npm/linux-x64-musl/package.json deleted file mode 100644 index 41953cb..0000000 --- a/npm/linux-x64-musl/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@ice/css-modules-hash-linux-x64-musl", - "version": "0.0.6", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "main": "css-modules-hash.linux-x64-musl.node", - "files": [ - "css-modules-hash.linux-x64-musl.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "libc": [ - "musl" - ], - "repository": { - "url": "https://github.com/ice-lab/awesome-ice" - } -} \ No newline at end of file diff --git a/npm/win32-arm64-msvc/README.md b/npm/win32-arm64-msvc/README.md deleted file mode 100644 index a568ac9..0000000 --- a/npm/win32-arm64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@ice/css-modules-hash-win32-arm64-msvc` - -This is the **aarch64-pc-windows-msvc** binary for `@ice/css-modules-hash` diff --git a/npm/win32-arm64-msvc/package.json b/npm/win32-arm64-msvc/package.json deleted file mode 100644 index 755684a..0000000 --- a/npm/win32-arm64-msvc/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@ice/css-modules-hash-win32-arm64-msvc", - "version": "0.0.6", - "os": [ - "win32" - ], - "cpu": [ - "arm64" - ], - "main": "css-modules-hash.win32-arm64-msvc.node", - "files": [ - "css-modules-hash.win32-arm64-msvc.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "repository": { - "url": "https://github.com/ice-lab/awesome-ice" - } -} \ No newline at end of file diff --git a/npm/win32-x64-msvc/README.md b/npm/win32-x64-msvc/README.md deleted file mode 100644 index 8949484..0000000 --- a/npm/win32-x64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@ice/css-modules-hash-win32-x64-msvc` - -This is the **x86_64-pc-windows-msvc** binary for `@ice/css-modules-hash` diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json deleted file mode 100644 index 96195aa..0000000 --- a/npm/win32-x64-msvc/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@ice/css-modules-hash-win32-x64-msvc", - "version": "0.0.6", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "main": "css-modules-hash.win32-x64-msvc.node", - "files": [ - "css-modules-hash.win32-x64-msvc.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "repository": { - "url": "https://github.com/ice-lab/awesome-ice" - } -} \ No newline at end of file diff --git a/package.json b/package.json index 20cbcff..2063c07 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,17 @@ { - "name": "@ice/css-modules-hash", - "version": "0.0.6", - "main": "index.js", - "types": "index.d.ts", - "napi": { - "name": "css-modules-hash", - "triples": { - "additional": [ - "aarch64-apple-darwin", - "aarch64-pc-windows-msvc", - "x86_64-unknown-linux-musl", - "universal-apple-darwin" - ] - } - }, - "files": [ - "index.d.ts", - "index.js" - ], - "license": "MIT", + "name": "ice-monorepo", + "version": "0.0.0", + "type": "module", + "homepage": "https://ice.work", + "bugs": "https://github.com/alibaba/ice/issues", "devDependencies": { - "@napi-rs/cli": "^2.16.2", - "ava": "^5.1.1" - }, - "ava": { - "timeout": "3m" - }, - "engines": { - "node": ">= 10" - }, - "scripts": { - "artifacts": "napi artifacts", - "build": "napi build --platform --release", - "build:debug": "napi build --platform", - "prepublishOnly": "napi prepublish -t npm", - "test": "ava", - "universal": "napi universal", - "version": "napi version" + "git-clone": "0.2.0", + "rimraf": "^5.0.5", + "fs-extra": "^11.1.1", + "ora": "^7.0.1" }, "repository": { - "url": "https://github.com/ice-lab/awesome-ice" + "type": "git", + "url": "https://github.com/alibaba/ice" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..2786b92 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,1681 @@ +lockfileVersion: 5.4 + +importers: + + .: + specifiers: + fs-extra: ^11.1.1 + git-clone: 0.2.0 + ora: ^7.0.1 + rimraf: ^5.0.5 + devDependencies: + fs-extra: 11.1.1 + git-clone: 0.2.0 + ora: 7.0.1 + rimraf: 5.0.5 + + crates/node_binding: + specifiers: + '@napi-rs/cli': 3.0.0-alpha.3 + ava: ^5.1.1 + call-bind: 1.0.2 + devDependencies: + '@napi-rs/cli': 3.0.0-alpha.3 + ava: 5.3.1 + call-bind: 1.0.2 + +packages: + + /@isaacs/cliui/8.0.2: + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + dependencies: + string-width: 5.1.2 + string-width-cjs: /string-width/4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: /strip-ansi/6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: /wrap-ansi/7.0.0 + dev: true + + /@ljharb/through/2.3.10: + resolution: {integrity: sha512-NwkQ4+jf4tMpDSlRc1wlttHnC7KfII+SjdqDEwEuQ7W0IaTK5Ab1jxCJrH6pYsLbLXiQgRn+nFQsGmKowbAKkA==} + engines: {node: '>= 0.4'} + dev: true + + /@napi-rs/cli/3.0.0-alpha.3: + resolution: {integrity: sha512-s5RHKqbqUVVfwgr/wO7S/vdqQ9shQzvIETgdz57r1Gg4bRv8kqy2Q1LfJAQJ09Y9Ddao9jKErvz4+11gHZZrWA==} + engines: {node: '>= 16'} + hasBin: true + dependencies: + '@octokit/rest': 19.0.13 + clipanion: 3.2.1 + colorette: 2.0.20 + debug: 4.3.4 + inquirer: 9.2.11 + js-yaml: 4.1.0 + lodash-es: 4.17.21 + typanion: 3.14.0 + transitivePeerDependencies: + - encoding + - supports-color + dev: true + + /@nodelib/fs.scandir/2.1.5: + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + dev: true + + /@nodelib/fs.stat/2.0.5: + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + dev: true + + /@nodelib/fs.walk/1.2.8: + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.15.0 + dev: true + + /@octokit/auth-token/3.0.4: + resolution: {integrity: sha512-TWFX7cZF2LXoCvdmJWY7XVPi74aSY0+FfBZNSXEXFkMpjcqsQwDSYVv5FhRFaI0V1ECnwbz4j59T/G+rXNWaIQ==} + engines: {node: '>= 14'} + dev: true + + /@octokit/core/4.2.4: + resolution: {integrity: sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==} + engines: {node: '>= 14'} + dependencies: + '@octokit/auth-token': 3.0.4 + '@octokit/graphql': 5.0.6 + '@octokit/request': 6.2.8 + '@octokit/request-error': 3.0.3 + '@octokit/types': 9.3.2 + before-after-hook: 2.2.3 + universal-user-agent: 6.0.0 + transitivePeerDependencies: + - encoding + dev: true + + /@octokit/endpoint/7.0.6: + resolution: {integrity: sha512-5L4fseVRUsDFGR00tMWD/Trdeeihn999rTMGRMC1G/Ldi1uWlWJzI98H4Iak5DB/RVvQuyMYKqSK/R6mbSOQyg==} + engines: {node: '>= 14'} + dependencies: + '@octokit/types': 9.3.2 + is-plain-object: 5.0.0 + universal-user-agent: 6.0.0 + dev: true + + /@octokit/graphql/5.0.6: + resolution: {integrity: sha512-Fxyxdy/JH0MnIB5h+UQ3yCoh1FG4kWXfFKkpWqjZHw/p+Kc8Y44Hu/kCgNBT6nU1shNumEchmW/sUO1JuQnPcw==} + engines: {node: '>= 14'} + dependencies: + '@octokit/request': 6.2.8 + '@octokit/types': 9.3.2 + universal-user-agent: 6.0.0 + transitivePeerDependencies: + - encoding + dev: true + + /@octokit/openapi-types/18.1.1: + resolution: {integrity: sha512-VRaeH8nCDtF5aXWnjPuEMIYf1itK/s3JYyJcWFJT8X9pSNnBtriDf7wlEWsGuhPLl4QIH4xM8fqTXDwJ3Mu6sw==} + dev: true + + /@octokit/plugin-paginate-rest/6.1.2_@octokit+core@4.2.4: + resolution: {integrity: sha512-qhrmtQeHU/IivxucOV1bbI/xZyC/iOBhclokv7Sut5vnejAIAEXVcGQeRpQlU39E0WwK9lNvJHphHri/DB6lbQ==} + engines: {node: '>= 14'} + peerDependencies: + '@octokit/core': '>=4' + dependencies: + '@octokit/core': 4.2.4 + '@octokit/tsconfig': 1.0.2 + '@octokit/types': 9.3.2 + dev: true + + /@octokit/plugin-request-log/1.0.4_@octokit+core@4.2.4: + resolution: {integrity: sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==} + peerDependencies: + '@octokit/core': '>=3' + dependencies: + '@octokit/core': 4.2.4 + dev: true + + /@octokit/plugin-rest-endpoint-methods/7.2.3_@octokit+core@4.2.4: + resolution: {integrity: sha512-I5Gml6kTAkzVlN7KCtjOM+Ruwe/rQppp0QU372K1GP7kNOYEKe8Xn5BW4sE62JAHdwpq95OQK/qGNyKQMUzVgA==} + engines: {node: '>= 14'} + peerDependencies: + '@octokit/core': '>=3' + dependencies: + '@octokit/core': 4.2.4 + '@octokit/types': 10.0.0 + dev: true + + /@octokit/request-error/3.0.3: + resolution: {integrity: sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==} + engines: {node: '>= 14'} + dependencies: + '@octokit/types': 9.3.2 + deprecation: 2.3.1 + once: 1.4.0 + dev: true + + /@octokit/request/6.2.8: + resolution: {integrity: sha512-ow4+pkVQ+6XVVsekSYBzJC0VTVvh/FCTUUgTsboGq+DTeWdyIFV8WSCdo0RIxk6wSkBTHqIK1mYuY7nOBXOchw==} + engines: {node: '>= 14'} + dependencies: + '@octokit/endpoint': 7.0.6 + '@octokit/request-error': 3.0.3 + '@octokit/types': 9.3.2 + is-plain-object: 5.0.0 + node-fetch: 2.7.0 + universal-user-agent: 6.0.0 + transitivePeerDependencies: + - encoding + dev: true + + /@octokit/rest/19.0.13: + resolution: {integrity: sha512-/EzVox5V9gYGdbAI+ovYj3nXQT1TtTHRT+0eZPcuC05UFSWO3mdO9UY1C0i2eLF9Un1ONJkAk+IEtYGAC+TahA==} + engines: {node: '>= 14'} + dependencies: + '@octokit/core': 4.2.4 + '@octokit/plugin-paginate-rest': 6.1.2_@octokit+core@4.2.4 + '@octokit/plugin-request-log': 1.0.4_@octokit+core@4.2.4 + '@octokit/plugin-rest-endpoint-methods': 7.2.3_@octokit+core@4.2.4 + transitivePeerDependencies: + - encoding + dev: true + + /@octokit/tsconfig/1.0.2: + resolution: {integrity: sha512-I0vDR0rdtP8p2lGMzvsJzbhdOWy405HcGovrspJ8RRibHnyRgggUSNO5AIox5LmqiwmatHKYsvj6VGFHkqS7lA==} + dev: true + + /@octokit/types/10.0.0: + resolution: {integrity: sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg==} + dependencies: + '@octokit/openapi-types': 18.1.1 + dev: true + + /@octokit/types/9.3.2: + resolution: {integrity: sha512-D4iHGTdAnEEVsB8fl95m1hiz7D5YiRdQ9b/OEb3BYRVwbLsGHcRVPz+u+BgRLNk0Q0/4iZCBqDN96j2XNxfXrA==} + dependencies: + '@octokit/openapi-types': 18.1.1 + dev: true + + /@pkgjs/parseargs/0.11.0: + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + requiresBuild: true + dev: true + optional: true + + /acorn-walk/8.2.0: + resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} + engines: {node: '>=0.4.0'} + dev: true + + /acorn/8.10.0: + resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /aggregate-error/4.0.1: + resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==} + engines: {node: '>=12'} + dependencies: + clean-stack: 4.2.0 + indent-string: 5.0.0 + dev: true + + /ansi-escapes/4.3.2: + resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} + engines: {node: '>=8'} + dependencies: + type-fest: 0.21.3 + dev: true + + /ansi-regex/5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + dev: true + + /ansi-regex/6.0.1: + resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} + engines: {node: '>=12'} + dev: true + + /ansi-styles/4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + dependencies: + color-convert: 2.0.1 + dev: true + + /ansi-styles/6.2.1: + resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} + engines: {node: '>=12'} + dev: true + + /anymatch/3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + + /argparse/1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + dependencies: + sprintf-js: 1.0.3 + dev: true + + /argparse/2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: true + + /array-find-index/1.0.2: + resolution: {integrity: sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==} + engines: {node: '>=0.10.0'} + dev: true + + /arrgv/1.0.2: + resolution: {integrity: sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw==} + engines: {node: '>=8.0.0'} + dev: true + + /arrify/3.0.0: + resolution: {integrity: sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==} + engines: {node: '>=12'} + dev: true + + /ava/5.3.1: + resolution: {integrity: sha512-Scv9a4gMOXB6+ni4toLuhAm9KYWEjsgBglJl+kMGI5+IVDt120CCDZyB5HNU9DjmLI2t4I0GbnxGLmmRfGTJGg==} + engines: {node: '>=14.19 <15 || >=16.15 <17 || >=18'} + hasBin: true + peerDependencies: + '@ava/typescript': '*' + peerDependenciesMeta: + '@ava/typescript': + optional: true + dependencies: + acorn: 8.10.0 + acorn-walk: 8.2.0 + ansi-styles: 6.2.1 + arrgv: 1.0.2 + arrify: 3.0.0 + callsites: 4.1.0 + cbor: 8.1.0 + chalk: 5.3.0 + chokidar: 3.5.3 + chunkd: 2.0.1 + ci-info: 3.9.0 + ci-parallel-vars: 1.0.1 + clean-yaml-object: 0.1.0 + cli-truncate: 3.1.0 + code-excerpt: 4.0.0 + common-path-prefix: 3.0.0 + concordance: 5.0.4 + currently-unhandled: 0.4.1 + debug: 4.3.4 + emittery: 1.0.1 + figures: 5.0.0 + globby: 13.2.2 + ignore-by-default: 2.1.0 + indent-string: 5.0.0 + is-error: 2.2.2 + is-plain-object: 5.0.0 + is-promise: 4.0.0 + matcher: 5.0.0 + mem: 9.0.2 + ms: 2.1.3 + p-event: 5.0.1 + p-map: 5.5.0 + picomatch: 2.3.1 + pkg-conf: 4.0.0 + plur: 5.1.0 + pretty-ms: 8.0.0 + resolve-cwd: 3.0.0 + stack-utils: 2.0.6 + strip-ansi: 7.1.0 + supertap: 3.0.1 + temp-dir: 3.0.0 + write-file-atomic: 5.0.1 + yargs: 17.7.2 + transitivePeerDependencies: + - supports-color + dev: true + + /balanced-match/1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: true + + /base64-js/1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + dev: true + + /before-after-hook/2.2.3: + resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} + dev: true + + /binary-extensions/2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + + /bl/4.1.0: + resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} + dependencies: + buffer: 5.7.1 + inherits: 2.0.4 + readable-stream: 3.6.2 + dev: true + + /bl/5.1.0: + resolution: {integrity: sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==} + dependencies: + buffer: 6.0.3 + inherits: 2.0.4 + readable-stream: 3.6.2 + dev: true + + /blueimp-md5/2.19.0: + resolution: {integrity: sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==} + dev: true + + /brace-expansion/2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + + /braces/3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.0.1 + dev: true + + /buffer/5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: true + + /buffer/6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: true + + /call-bind/1.0.2: + resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} + dependencies: + function-bind: 1.1.1 + get-intrinsic: 1.2.1 + dev: true + + /callsites/4.1.0: + resolution: {integrity: sha512-aBMbD1Xxay75ViYezwT40aQONfr+pSXTHwNKvIXhXD6+LY3F1dLIcceoC5OZKBVHbXcysz1hL9D2w0JJIMXpUw==} + engines: {node: '>=12.20'} + dev: true + + /cbor/8.1.0: + resolution: {integrity: sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==} + engines: {node: '>=12.19'} + dependencies: + nofilter: 3.1.0 + dev: true + + /chalk/4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: true + + /chalk/5.3.0: + resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + dev: true + + /chardet/0.7.0: + resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + dev: true + + /chokidar/3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /chunkd/2.0.1: + resolution: {integrity: sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==} + dev: true + + /ci-info/3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + engines: {node: '>=8'} + dev: true + + /ci-parallel-vars/1.0.1: + resolution: {integrity: sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg==} + dev: true + + /clean-stack/4.2.0: + resolution: {integrity: sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==} + engines: {node: '>=12'} + dependencies: + escape-string-regexp: 5.0.0 + dev: true + + /clean-yaml-object/0.1.0: + resolution: {integrity: sha512-3yONmlN9CSAkzNwnRCiJQ7Q2xK5mWuEfL3PuTZcAUzhObbXsfsnMptJzXwz93nc5zn9V9TwCVMmV7w4xsm43dw==} + engines: {node: '>=0.10.0'} + dev: true + + /cli-cursor/3.1.0: + resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} + engines: {node: '>=8'} + dependencies: + restore-cursor: 3.1.0 + dev: true + + /cli-cursor/4.0.0: + resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + restore-cursor: 4.0.0 + dev: true + + /cli-spinners/2.9.1: + resolution: {integrity: sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==} + engines: {node: '>=6'} + dev: true + + /cli-truncate/3.1.0: + resolution: {integrity: sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + slice-ansi: 5.0.0 + string-width: 5.1.2 + dev: true + + /cli-width/4.1.0: + resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} + engines: {node: '>= 12'} + dev: true + + /clipanion/3.2.1: + resolution: {integrity: sha512-dYFdjLb7y1ajfxQopN05mylEpK9ZX0sO1/RfMXdfmwjlIsPkbh4p7A682x++zFPLDCo1x3p82dtljHf5cW2LKA==} + dependencies: + typanion: 3.14.0 + dev: true + + /cliui/8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + dev: true + + /clone/1.0.4: + resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} + engines: {node: '>=0.8'} + dev: true + + /code-excerpt/4.0.0: + resolution: {integrity: sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + convert-to-spaces: 2.0.1 + dev: true + + /color-convert/2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + dependencies: + color-name: 1.1.4 + dev: true + + /color-name/1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + dev: true + + /colorette/2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + dev: true + + /common-path-prefix/3.0.0: + resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} + dev: true + + /concordance/5.0.4: + resolution: {integrity: sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==} + engines: {node: '>=10.18.0 <11 || >=12.14.0 <13 || >=14'} + dependencies: + date-time: 3.1.0 + esutils: 2.0.3 + fast-diff: 1.3.0 + js-string-escape: 1.0.1 + lodash: 4.17.21 + md5-hex: 3.0.1 + semver: 7.5.4 + well-known-symbols: 2.0.0 + dev: true + + /convert-to-spaces/2.0.1: + resolution: {integrity: sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + + /cross-spawn/7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + + /currently-unhandled/0.4.1: + resolution: {integrity: sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==} + engines: {node: '>=0.10.0'} + dependencies: + array-find-index: 1.0.2 + dev: true + + /date-time/3.1.0: + resolution: {integrity: sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==} + engines: {node: '>=6'} + dependencies: + time-zone: 1.0.0 + dev: true + + /debug/4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: true + + /defaults/1.0.4: + resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} + dependencies: + clone: 1.0.4 + dev: true + + /deprecation/2.3.1: + resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} + dev: true + + /dir-glob/3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + dependencies: + path-type: 4.0.0 + dev: true + + /eastasianwidth/0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + dev: true + + /emittery/1.0.1: + resolution: {integrity: sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ==} + engines: {node: '>=14.16'} + dev: true + + /emoji-regex/10.2.1: + resolution: {integrity: sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==} + dev: true + + /emoji-regex/8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + dev: true + + /emoji-regex/9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + dev: true + + /escalade/3.1.1: + resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} + engines: {node: '>=6'} + dev: true + + /escape-string-regexp/2.0.0: + resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} + engines: {node: '>=8'} + dev: true + + /escape-string-regexp/5.0.0: + resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} + engines: {node: '>=12'} + dev: true + + /esprima/4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + dev: true + + /esutils/2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + dev: true + + /external-editor/3.1.0: + resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} + engines: {node: '>=4'} + dependencies: + chardet: 0.7.0 + iconv-lite: 0.4.24 + tmp: 0.0.33 + dev: true + + /fast-diff/1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + dev: true + + /fast-glob/3.3.1: + resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} + engines: {node: '>=8.6.0'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.5 + dev: true + + /fastq/1.15.0: + resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} + dependencies: + reusify: 1.0.4 + dev: true + + /figures/5.0.0: + resolution: {integrity: sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==} + engines: {node: '>=14'} + dependencies: + escape-string-regexp: 5.0.0 + is-unicode-supported: 1.3.0 + dev: true + + /fill-range/7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + dev: true + + /find-up/6.3.0: + resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + locate-path: 7.2.0 + path-exists: 5.0.0 + dev: true + + /foreground-child/3.1.1: + resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} + engines: {node: '>=14'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + dev: true + + /fs-extra/11.1.1: + resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} + engines: {node: '>=14.14'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.0 + dev: true + + /fsevents/2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /function-bind/1.1.1: + resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} + dev: true + + /get-caller-file/2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + dev: true + + /get-intrinsic/1.2.1: + resolution: {integrity: sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==} + dependencies: + function-bind: 1.1.1 + has: 1.0.4 + has-proto: 1.0.1 + has-symbols: 1.0.3 + dev: true + + /git-clone/0.2.0: + resolution: {integrity: sha512-1UAkEPIFbyjHaddljUKvPhhLRnrKaImT71T7rdvSvWLXw95nLdhdi6Qmlx0KOWoV1qqvHGLq5lMLJEZM0JXk8A==} + dev: true + + /glob-parent/5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + dev: true + + /glob/10.3.10: + resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + dependencies: + foreground-child: 3.1.1 + jackspeak: 2.3.6 + minimatch: 9.0.3 + minipass: 7.0.4 + path-scurry: 1.10.1 + dev: true + + /globby/13.2.2: + resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + dir-glob: 3.0.1 + fast-glob: 3.3.1 + ignore: 5.2.4 + merge2: 1.4.1 + slash: 4.0.0 + dev: true + + /graceful-fs/4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + dev: true + + /has-flag/4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + dev: true + + /has-proto/1.0.1: + resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} + engines: {node: '>= 0.4'} + dev: true + + /has-symbols/1.0.3: + resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} + engines: {node: '>= 0.4'} + dev: true + + /has/1.0.4: + resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} + engines: {node: '>= 0.4.0'} + dev: true + + /iconv-lite/0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: true + + /ieee754/1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + dev: true + + /ignore-by-default/2.1.0: + resolution: {integrity: sha512-yiWd4GVmJp0Q6ghmM2B/V3oZGRmjrKLXvHR3TE1nfoXsmoggllfZUQe74EN0fJdPFZu2NIvNdrMMLm3OsV7Ohw==} + engines: {node: '>=10 <11 || >=12 <13 || >=14'} + dev: true + + /ignore/5.2.4: + resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} + engines: {node: '>= 4'} + dev: true + + /imurmurhash/0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + dev: true + + /indent-string/5.0.0: + resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==} + engines: {node: '>=12'} + dev: true + + /inherits/2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: true + + /inquirer/9.2.11: + resolution: {integrity: sha512-B2LafrnnhbRzCWfAdOXisUzL89Kg8cVJlYmhqoi3flSiV/TveO+nsXwgKr9h9PIo+J1hz7nBSk6gegRIMBBf7g==} + engines: {node: '>=14.18.0'} + dependencies: + '@ljharb/through': 2.3.10 + ansi-escapes: 4.3.2 + chalk: 5.3.0 + cli-cursor: 3.1.0 + cli-width: 4.1.0 + external-editor: 3.1.0 + figures: 5.0.0 + lodash: 4.17.21 + mute-stream: 1.0.0 + ora: 5.4.1 + run-async: 3.0.0 + rxjs: 7.8.1 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 6.2.0 + dev: true + + /irregular-plurals/3.5.0: + resolution: {integrity: sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==} + engines: {node: '>=8'} + dev: true + + /is-binary-path/2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + + /is-error/2.2.2: + resolution: {integrity: sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg==} + dev: true + + /is-extglob/2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true + + /is-fullwidth-code-point/3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + dev: true + + /is-fullwidth-code-point/4.0.0: + resolution: {integrity: sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==} + engines: {node: '>=12'} + dev: true + + /is-glob/4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: true + + /is-interactive/1.0.0: + resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} + engines: {node: '>=8'} + dev: true + + /is-interactive/2.0.0: + resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} + engines: {node: '>=12'} + dev: true + + /is-number/7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true + + /is-plain-object/5.0.0: + resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} + engines: {node: '>=0.10.0'} + dev: true + + /is-promise/4.0.0: + resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + dev: true + + /is-unicode-supported/0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + dev: true + + /is-unicode-supported/1.3.0: + resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} + engines: {node: '>=12'} + dev: true + + /isexe/2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true + + /jackspeak/2.3.6: + resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} + engines: {node: '>=14'} + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + + /js-string-escape/1.0.1: + resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} + engines: {node: '>= 0.8'} + dev: true + + /js-yaml/3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + dev: true + + /js-yaml/4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + dependencies: + argparse: 2.0.1 + dev: true + + /jsonfile/6.1.0: + resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} + dependencies: + universalify: 2.0.0 + optionalDependencies: + graceful-fs: 4.2.11 + dev: true + + /load-json-file/7.0.1: + resolution: {integrity: sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + + /locate-path/7.2.0: + resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-locate: 6.0.0 + dev: true + + /lodash-es/4.17.21: + resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} + dev: true + + /lodash/4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + dev: true + + /log-symbols/4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + dev: true + + /log-symbols/5.1.0: + resolution: {integrity: sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==} + engines: {node: '>=12'} + dependencies: + chalk: 5.3.0 + is-unicode-supported: 1.3.0 + dev: true + + /lru-cache/10.0.1: + resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==} + engines: {node: 14 || >=16.14} + dev: true + + /lru-cache/6.0.0: + resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} + engines: {node: '>=10'} + dependencies: + yallist: 4.0.0 + dev: true + + /map-age-cleaner/0.1.3: + resolution: {integrity: sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==} + engines: {node: '>=6'} + dependencies: + p-defer: 1.0.0 + dev: true + + /matcher/5.0.0: + resolution: {integrity: sha512-s2EMBOWtXFc8dgqvoAzKJXxNHibcdJMV0gwqKUaw9E2JBJuGUK7DrNKrA6g/i+v72TT16+6sVm5mS3thaMLQUw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + escape-string-regexp: 5.0.0 + dev: true + + /md5-hex/3.0.1: + resolution: {integrity: sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==} + engines: {node: '>=8'} + dependencies: + blueimp-md5: 2.19.0 + dev: true + + /mem/9.0.2: + resolution: {integrity: sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==} + engines: {node: '>=12.20'} + dependencies: + map-age-cleaner: 0.1.3 + mimic-fn: 4.0.0 + dev: true + + /merge2/1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + dev: true + + /micromatch/4.0.5: + resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} + engines: {node: '>=8.6'} + dependencies: + braces: 3.0.2 + picomatch: 2.3.1 + dev: true + + /mimic-fn/2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + dev: true + + /mimic-fn/4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + dev: true + + /minimatch/9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + + /minipass/7.0.4: + resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} + engines: {node: '>=16 || 14 >=14.17'} + dev: true + + /ms/2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: true + + /ms/2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + dev: true + + /mute-stream/1.0.0: + resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dev: true + + /node-fetch/2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: true + + /nofilter/3.1.0: + resolution: {integrity: sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==} + engines: {node: '>=12.19'} + dev: true + + /normalize-path/3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + + /once/1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: true + + /onetime/5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + dependencies: + mimic-fn: 2.1.0 + dev: true + + /ora/5.4.1: + resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==} + engines: {node: '>=10'} + dependencies: + bl: 4.1.0 + chalk: 4.1.2 + cli-cursor: 3.1.0 + cli-spinners: 2.9.1 + is-interactive: 1.0.0 + is-unicode-supported: 0.1.0 + log-symbols: 4.1.0 + strip-ansi: 6.0.1 + wcwidth: 1.0.1 + dev: true + + /ora/7.0.1: + resolution: {integrity: sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==} + engines: {node: '>=16'} + dependencies: + chalk: 5.3.0 + cli-cursor: 4.0.0 + cli-spinners: 2.9.1 + is-interactive: 2.0.0 + is-unicode-supported: 1.3.0 + log-symbols: 5.1.0 + stdin-discarder: 0.1.0 + string-width: 6.1.0 + strip-ansi: 7.1.0 + dev: true + + /os-tmpdir/1.0.2: + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} + engines: {node: '>=0.10.0'} + dev: true + + /p-defer/1.0.0: + resolution: {integrity: sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==} + engines: {node: '>=4'} + dev: true + + /p-event/5.0.1: + resolution: {integrity: sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-timeout: 5.1.0 + dev: true + + /p-limit/4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + yocto-queue: 1.0.0 + dev: true + + /p-locate/6.0.0: + resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-limit: 4.0.0 + dev: true + + /p-map/5.5.0: + resolution: {integrity: sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==} + engines: {node: '>=12'} + dependencies: + aggregate-error: 4.0.1 + dev: true + + /p-timeout/5.1.0: + resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} + engines: {node: '>=12'} + dev: true + + /parse-ms/3.0.0: + resolution: {integrity: sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==} + engines: {node: '>=12'} + dev: true + + /path-exists/5.0.0: + resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + + /path-key/3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true + + /path-scurry/1.10.1: + resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + lru-cache: 10.0.1 + minipass: 7.0.4 + dev: true + + /path-type/4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + dev: true + + /picomatch/2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true + + /pkg-conf/4.0.0: + resolution: {integrity: sha512-7dmgi4UY4qk+4mj5Cd8v/GExPo0K+SlY+hulOSdfZ/T6jVH6//y7NtzZo5WrfhDBxuQ0jCa7fLZmNaNh7EWL/w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + find-up: 6.3.0 + load-json-file: 7.0.1 + dev: true + + /plur/5.1.0: + resolution: {integrity: sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + irregular-plurals: 3.5.0 + dev: true + + /pretty-ms/8.0.0: + resolution: {integrity: sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==} + engines: {node: '>=14.16'} + dependencies: + parse-ms: 3.0.0 + dev: true + + /queue-microtask/1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true + + /readable-stream/3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + dev: true + + /readdirp/3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + + /require-directory/2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + dev: true + + /resolve-cwd/3.0.0: + resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} + engines: {node: '>=8'} + dependencies: + resolve-from: 5.0.0 + dev: true + + /resolve-from/5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + dev: true + + /restore-cursor/3.1.0: + resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} + engines: {node: '>=8'} + dependencies: + onetime: 5.1.2 + signal-exit: 3.0.7 + dev: true + + /restore-cursor/4.0.0: + resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + onetime: 5.1.2 + signal-exit: 3.0.7 + dev: true + + /reusify/1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true + + /rimraf/5.0.5: + resolution: {integrity: sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==} + engines: {node: '>=14'} + hasBin: true + dependencies: + glob: 10.3.10 + dev: true + + /run-async/3.0.0: + resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==} + engines: {node: '>=0.12.0'} + dev: true + + /run-parallel/1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + dependencies: + queue-microtask: 1.2.3 + dev: true + + /rxjs/7.8.1: + resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} + dependencies: + tslib: 2.6.2 + dev: true + + /safe-buffer/5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + dev: true + + /safer-buffer/2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + dev: true + + /semver/7.5.4: + resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + + /serialize-error/7.0.1: + resolution: {integrity: sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==} + engines: {node: '>=10'} + dependencies: + type-fest: 0.13.1 + dev: true + + /shebang-command/2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: true + + /shebang-regex/3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true + + /signal-exit/3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + dev: true + + /signal-exit/4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + dev: true + + /slash/4.0.0: + resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} + engines: {node: '>=12'} + dev: true + + /slice-ansi/5.0.0: + resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==} + engines: {node: '>=12'} + dependencies: + ansi-styles: 6.2.1 + is-fullwidth-code-point: 4.0.0 + dev: true + + /sprintf-js/1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + dev: true + + /stack-utils/2.0.6: + resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} + engines: {node: '>=10'} + dependencies: + escape-string-regexp: 2.0.0 + dev: true + + /stdin-discarder/0.1.0: + resolution: {integrity: sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + bl: 5.1.0 + dev: true + + /string-width/4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + dev: true + + /string-width/5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.1.0 + dev: true + + /string-width/6.1.0: + resolution: {integrity: sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==} + engines: {node: '>=16'} + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 10.2.1 + strip-ansi: 7.1.0 + dev: true + + /string_decoder/1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + dependencies: + safe-buffer: 5.2.1 + dev: true + + /strip-ansi/6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + dependencies: + ansi-regex: 5.0.1 + dev: true + + /strip-ansi/7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + dependencies: + ansi-regex: 6.0.1 + dev: true + + /supertap/3.0.1: + resolution: {integrity: sha512-u1ZpIBCawJnO+0QePsEiOknOfCRq0yERxiAchT0i4li0WHNUJbf0evXXSXOcCAR4M8iMDoajXYmstm/qO81Isw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + indent-string: 5.0.0 + js-yaml: 3.14.1 + serialize-error: 7.0.1 + strip-ansi: 7.1.0 + dev: true + + /supports-color/7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + dependencies: + has-flag: 4.0.0 + dev: true + + /temp-dir/3.0.0: + resolution: {integrity: sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==} + engines: {node: '>=14.16'} + dev: true + + /time-zone/1.0.0: + resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==} + engines: {node: '>=4'} + dev: true + + /tmp/0.0.33: + resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} + engines: {node: '>=0.6.0'} + dependencies: + os-tmpdir: 1.0.2 + dev: true + + /to-regex-range/5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + dev: true + + /tr46/0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + dev: true + + /tslib/2.6.2: + resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + dev: true + + /typanion/3.14.0: + resolution: {integrity: sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==} + dev: true + + /type-fest/0.13.1: + resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} + engines: {node: '>=10'} + dev: true + + /type-fest/0.21.3: + resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} + engines: {node: '>=10'} + dev: true + + /universal-user-agent/6.0.0: + resolution: {integrity: sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==} + dev: true + + /universalify/2.0.0: + resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} + engines: {node: '>= 10.0.0'} + dev: true + + /util-deprecate/1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + dev: true + + /wcwidth/1.0.1: + resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + dependencies: + defaults: 1.0.4 + dev: true + + /webidl-conversions/3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + dev: true + + /well-known-symbols/2.0.0: + resolution: {integrity: sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==} + engines: {node: '>=6'} + dev: true + + /whatwg-url/5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + dev: true + + /which/2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + + /wrap-ansi/6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + dev: true + + /wrap-ansi/7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + dev: true + + /wrap-ansi/8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + dependencies: + ansi-styles: 6.2.1 + string-width: 5.1.2 + strip-ansi: 7.1.0 + dev: true + + /wrappy/1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true + + /write-file-atomic/5.0.1: + resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dependencies: + imurmurhash: 0.1.4 + signal-exit: 4.1.0 + dev: true + + /y18n/5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + dev: true + + /yallist/4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + dev: true + + /yargs-parser/21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + dev: true + + /yargs/17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + dependencies: + cliui: 8.0.1 + escalade: 3.1.1 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + dev: true + + /yocto-queue/1.0.0: + resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} + engines: {node: '>=12.20'} + dev: true diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..1b636e0 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - "crates/node_binding" \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..bf354c4 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +profile = "default" +channel = "nightly-2023-06-02" diff --git a/rustfmt.toml b/rustfmt.toml index cab5731..f889dc8 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,5 @@ -tab_spaces = 2 -edition = "2021" +format_code_in_doc_comments = true # https://rust-lang.github.io/rustfmt/?version=v1.5.1&search=#format_code_in_doc_comments +tab_spaces = 2 + +group_imports = "StdExternalCrate" +unstable_features = true diff --git a/scripts/clone-rspack.mjs b/scripts/clone-rspack.mjs new file mode 100644 index 0000000..cdd4d34 --- /dev/null +++ b/scripts/clone-rspack.mjs @@ -0,0 +1,49 @@ +import gitclone from 'git-clone/promise.js'; +import { rimraf } from 'rimraf'; +import ora from 'ora'; +import fse from 'fs-extra'; + +const REPO = 'git@github.com:web-infra-dev/rspack.git'; +const DEST = 'crates/.rspack_crates/'; +const CEHECKOUT = 'v0.3.6'; + +function createSpinner( + text, + options = {}, +) { + const spinner = ora({ + text, + stream: process.stdout, + isEnabled: process.stdout.isTTY, + interval: 200, + ...options, + }); + spinner.start(); + return spinner; +} + +async function getRspackCrates(repo, dest, checkout) { + let cloneError = null; + const cloneDest = `${dest}/.temp`; + const spinner = createSpinner('Cloning rspack repo...'); + // Step 1: remove dir. + await rimraf(dest); + // Step2: clone git repo. + await gitclone(repo, cloneDest, { checkout }).catch((err) => {cloneError = err;}); + if (!cloneError) { + // Step3: only copy crates dir to the dest. + spinner.text = 'Copying crates to the dest...'; + fse.copySync(cloneDest + '/crates', dest); + // Step4: remove useless files. + spinner.text = 'Clean up...'; + await rimraf(cloneDest); + spinner.succeed('Cloning rspack repo succeed.'); + } else { + spinner.fail('Cloning rspack repo failed.'); + // Clean temp dir if clone failed. + await rimraf(cloneDest); + console.log(cloneError); + } +} + +getRspackCrates(REPO, DEST, CEHECKOUT); \ No newline at end of file diff --git a/src/css_modules.rs b/src/css_modules.rs deleted file mode 100644 index 991d9af..0000000 --- a/src/css_modules.rs +++ /dev/null @@ -1,46 +0,0 @@ -use std::{ - path::Path, - hash::Hash, -}; -use swc_atoms::JsWord; -use crate::hash::{HashFunction, HashSalt, CSSHash, HashDigest}; -use crate::local_ident_name::{LocalIdentName, LocalIdentNameRenderOptions, PathData}; - -pub struct CSSModulesLocalIdent<'a> { - filename: &'a Path, - local_ident_name: &'a LocalIdentName, -} - -impl<'a> CSSModulesLocalIdent<'a> { - pub fn new(filename: &'a Path, local_ident_name: &'a LocalIdentName) -> Self { - Self { - filename, - local_ident_name, - } - } - - pub fn get_new_name(&self, local: JsWord) -> String { - let hash = { - let mut hasher = CSSHash::with_salt(&HashFunction::MD4, &HashSalt::None); - self.filename.hash(&mut hasher); - local.hash(&mut hasher); - let hash = hasher.digest(&HashDigest::Hex); - let hash = hash.rendered(20); - if hash.as_bytes()[0].is_ascii_digit() { - format!("_{hash}") - } else { - hash.into() - } - }; - self - .local_ident_name - .render(LocalIdentNameRenderOptions { - path_data: PathData::default() - .filename(&self.filename.to_string_lossy()) - .hash(&hash), - local: &local, - }) - .into() - } -} - diff --git a/src/hash.rs b/src/hash.rs deleted file mode 100644 index d03e359..0000000 --- a/src/hash.rs +++ /dev/null @@ -1,154 +0,0 @@ -use std::{ - fmt, - hash::{Hash, Hasher}, -}; -use data_encoding::HEXLOWER_PERMISSIVE; -use md4::Digest; -use smol_str::SmolStr; -use xxhash_rust::xxh3; - -#[derive(Debug, Clone, Copy)] -pub enum HashFunction { - Xxhash64, - MD4, -} - -impl From<&str> for HashFunction { - fn from(value: &str) -> Self { - match value { - "xxhash64" => HashFunction::Xxhash64, - "md4" => HashFunction::MD4, - _ => unimplemented!("{}", value), - } - } -} - -#[derive(Debug, Clone, Copy)] -pub enum HashDigest { - Hex, -} - -impl From<&str> for HashDigest { - fn from(value: &str) -> Self { - match value { - "hex" => HashDigest::Hex, - _ => unimplemented!(), - } - } -} - -#[derive(Debug, Clone, Hash)] -pub enum HashSalt { - None, - Salt(String), -} - -impl From> for HashSalt { - fn from(value: Option) -> Self { - match value { - Some(salt) => Self::Salt(salt), - None => Self::None, - } - } -} - -#[derive(Clone)] -pub enum CSSHash { - Xxhash64(Box), - MD4(md4::Md4), -} - -impl fmt::Debug for CSSHash { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Xxhash64(_) => write!(f, "CSSHash(Xxhash64)"), - Self::MD4(_) => write!(f, "CSSHash(MD4)"), - } - } -} - -impl CSSHash { - pub fn new(function: &HashFunction) -> Self { - match function { - HashFunction::Xxhash64 => Self::Xxhash64(Box::new(xxh3::Xxh3::new())), - HashFunction::MD4 => Self::MD4(md4::Md4::new()), - } - } - - pub fn with_salt(function: &HashFunction, salt: &HashSalt) -> Self { - let mut this = Self::new(function); - salt.hash(&mut this); - this - } - - pub fn digest(self, digest: &HashDigest) -> CSSHashDigest { - let inner = match self { - CSSHash::Xxhash64(hasher) => hasher.finish().to_le_bytes().to_vec(), - CSSHash::MD4(hash) => hash.finalize().to_vec(), - }; - CSSHashDigest::new(inner, digest) - } -} - -impl Hasher for CSSHash { - fn finish(&self) -> u64 { - match self { - CSSHash::Xxhash64(hasher) => hasher.finish(), - CSSHash::MD4(hasher) => { - // finalize take ownership, so we need to clone it - let hash = hasher.clone().finalize(); - let msb_u64: u64 = ((hash[0] as u64) << 56) - | ((hash[1] as u64) << 48) - | ((hash[2] as u64) << 40) - | ((hash[3] as u64) << 32) - | ((hash[4] as u64) << 24) - | ((hash[5] as u64) << 16) - | ((hash[6] as u64) << 8) - | (hash[7] as u64); - msb_u64 - } - } - } - - fn write(&mut self, bytes: &[u8]) { - match self { - CSSHash::Xxhash64(hasher) => hasher.write(bytes), - CSSHash::MD4(hasher) => hasher.update(bytes), - } - } -} - -#[derive(Debug, Clone, Eq)] -pub struct CSSHashDigest { - encoded: SmolStr, -} - -impl CSSHashDigest { - pub fn new(inner: Vec, digest: &HashDigest) -> Self { - let encoded = match digest { - HashDigest::Hex => HEXLOWER_PERMISSIVE.encode(&inner).into(), - }; - Self { encoded } - } - - pub fn encoded(&self) -> &str { - &self.encoded - } - - pub fn rendered(&self, length: usize) -> &str { - let len = self.encoded.len().min(length); - &self.encoded[..len] - } -} - -impl Hash for CSSHashDigest { - fn hash(&self, state: &mut H) { - self.encoded.hash(state); - } -} - -impl PartialEq for CSSHashDigest { - fn eq(&self, other: &Self) -> bool { - self.encoded == other.encoded - } -} diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index fe6549a..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![deny(clippy::all)] - - -pub mod hash; -pub mod css_modules; -pub mod local_ident_name; -use std::path::Path; -use swc_atoms::JsWord; -use crate::css_modules::CSSModulesLocalIdent; -use crate::local_ident_name::LocalIdentName; - -#[macro_use] -extern crate napi_derive; - -#[napi] -pub fn get_css_modules_local_ident(filepath: String, local: String, template: String) -> String { - let filename = Path::new(&filepath); - let local_ident_name = LocalIdentName::from(template); - let str = CSSModulesLocalIdent::new(filename, &local_ident_name); - str.get_new_name(JsWord::from(local)) -} diff --git a/src/local_ident_name.rs b/src/local_ident_name.rs deleted file mode 100644 index fca2a14..0000000 --- a/src/local_ident_name.rs +++ /dev/null @@ -1,170 +0,0 @@ -use std::{ - str::FromStr, - path::PathBuf, - string::ParseError, -}; -use regex::{Captures, Regex}; -use once_cell::sync::Lazy; - -#[derive(Default, Clone, Copy)] -pub struct PathData<'a> { - pub filename: Option<&'a str>, - pub hash: Option<&'a str>, - pub local: Option<&'a str>, -} - -impl<'a> PathData<'a> { - pub fn filename(mut self, v: &'a str) -> Self { - self.filename = Some(v); - self - } - pub fn hash(mut self, v: &'a str) -> Self { - self.hash = Some(v); - self - } -} - -#[derive(Debug, Clone)] -pub struct LocalIdentName(Filename); - -impl From for LocalIdentName { - fn from(value: String) -> Self { - Self(Filename::from(value)) - } -} -pub struct LocalIdentNameRenderOptions<'a> { - pub path_data: PathData<'a>, - pub local: &'a str, -} - -#[derive(Debug, Clone)] -pub struct Filename { - template: String, -} - -impl FromStr for Filename { - type Err = ParseError; - - fn from_str(s: &str) -> Result { - Ok(Self { - template: s.to_string(), - }) - } -} - -impl From for Filename { - fn from(value: String) -> Self { - Self { template: value } - } -} - -#[derive(Debug)] -pub struct ResourceParsedData { - pub path: PathBuf, - pub query: Option, - pub fragment: Option, -} - -pub const FILE_PLACEHOLDER: &str = "[file]"; -pub const BASE_PLACEHOLDER: &str = "[base]"; -pub const NAME_PLACEHOLDER: &str = "[name]"; -pub const PATH_PLACEHOLDER: &str = "[path]"; -pub const EXT_PLACEHOLDER: &str = "[ext]"; -pub const QUERY_PLACEHOLDER: &str = "[query]"; -pub const FRAGMENT_PLACEHOLDER: &str = "[fragment]"; -pub const RUNTIME_PLACEHOLDER: &str = "[runtime]"; -static PATH_QUERY_FRAGMENT_REGEXP: Lazy = Lazy::new(|| { - Regex::new("^((?:\0.|[^?#\0])*)(\\?(?:\0.|[^#\0])*)?(#.*)?$") - .expect("Failed to initialize `PATH_QUERY_FRAGMENT_REGEXP`") -}); -pub static HASH_PLACEHOLDER: Lazy = - Lazy::new(|| Regex::new(r"\[hash(:(\d*))?]").expect("Invalid regex")); -pub static FULL_HASH_PLACEHOLDER: Lazy = - Lazy::new(|| Regex::new(r"\[fullhash(:(\d*))?]").expect("Invalid regex")); -static ESCAPE_LOCAL_IDENT_REGEX: Lazy = - Lazy::new(|| Regex::new(r#"[<>:"/\\|?*\.]"#).expect("Invalid regex")); - -pub fn parse_resource(resource: &str) -> Option { - let groups = PATH_QUERY_FRAGMENT_REGEXP.captures(resource)?; - - Some(ResourceParsedData { - path: groups.get(1)?.as_str().into(), - query: groups.get(2).map(|q| q.as_str().to_owned()), - fragment: groups.get(3).map(|q| q.as_str().to_owned()), - }) -} - -impl LocalIdentName { - pub fn render(&self, options: LocalIdentNameRenderOptions) -> String { - self.0.render(options.path_data, options.local) - } -} - -impl Filename { - pub fn template(&self) -> &str { - &self.template - } - - pub fn render(&self, options: PathData, local: &str) -> String { - let mut template = self.template.clone(); - if let Some(filename) = options.filename { - if let Some(ResourceParsedData { - path: file, - query, - fragment, - }) = parse_resource(filename) - { - template = template.replace(FILE_PLACEHOLDER, &file.to_string_lossy()); - template = template.replace( - EXT_PLACEHOLDER, - &file - .extension() - .map(|p| format!(".{}", p.to_string_lossy())) - .unwrap_or_default(), - ); - if let Some(base) = file.file_name().map(|p| p.to_string_lossy()) { - template = template.replace(BASE_PLACEHOLDER, &base); - } - if let Some(name) = file.file_stem().map(|p| p.to_string_lossy()) { - template = template.replace(NAME_PLACEHOLDER, &name); - } - template = template.replace( - PATH_PLACEHOLDER, - &file - .parent() - .map(|p| p.to_string_lossy()) - // "" -> "", "folder" -> "folder/" - .filter(|p| !p.is_empty()) - .map(|p| p + "/") - .unwrap_or_default(), - ); - template = template.replace(QUERY_PLACEHOLDER, &query.unwrap_or_default()); - template = template.replace(FRAGMENT_PLACEHOLDER, &fragment.unwrap_or_default()); - } - } - if let Some(hash) = options.hash { - for reg in [&HASH_PLACEHOLDER, &FULL_HASH_PLACEHOLDER] { - template = reg - .replace_all(&template, |caps: &Captures| { - let hash = &hash[..hash_len(hash, caps)]; - hash - }) - .into_owned(); - } - } - template = template.replace("[local]", local); - template = ESCAPE_LOCAL_IDENT_REGEX.replace_all(&template, "-").into_owned(); - - template - } -} - -fn hash_len(hash: &str, caps: &Captures) -> usize { - let hash_len = hash.len(); - caps - .get(2) - .and_then(|m| m.as_str().parse().ok()) - .unwrap_or(hash_len) - .min(hash_len) -} - diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 46ba97e..0000000 --- a/yarn.lock +++ /dev/null @@ -1,898 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@napi-rs/cli@^2.16.2": - version "2.16.2" - resolved "https://registry.yarnpkg.com/@napi-rs/cli/-/cli-2.16.2.tgz#4783ccbf51c39023c2945b3e59aba71b443dc9e1" - integrity sha512-U2aZfnr0s9KkXpZlYC0l5WxWCXL7vJUNpCnWMwq3T9GG9rhYAAUM9CTZsi1Z+0iR2LcHbfq9EfMgoqnuTyUjfg== - -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - -acorn-walk@^8.2.0: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== - -acorn@^8.8.2: - version "8.10.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" - integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== - -aggregate-error@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-4.0.1.tgz#25091fe1573b9e0be892aeda15c7c66a545f758e" - integrity sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w== - dependencies: - clean-stack "^4.0.0" - indent-string "^5.0.0" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-regex@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" - integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== - -ansi-styles@^4.0.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" - -ansi-styles@^6.0.0, ansi-styles@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" - integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== - -anymatch@~3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -array-find-index@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - integrity sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw== - -arrgv@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/arrgv/-/arrgv-1.0.2.tgz#025ed55a6a433cad9b604f8112fc4292715a6ec0" - integrity sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw== - -arrify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-3.0.0.tgz#ccdefb8eaf2a1d2ab0da1ca2ce53118759fd46bc" - integrity sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw== - -ava@^5.1.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/ava/-/ava-5.3.1.tgz#335737dd963b7941b90214836cea2e8de1f4d5f4" - integrity sha512-Scv9a4gMOXB6+ni4toLuhAm9KYWEjsgBglJl+kMGI5+IVDt120CCDZyB5HNU9DjmLI2t4I0GbnxGLmmRfGTJGg== - dependencies: - acorn "^8.8.2" - acorn-walk "^8.2.0" - ansi-styles "^6.2.1" - arrgv "^1.0.2" - arrify "^3.0.0" - callsites "^4.0.0" - cbor "^8.1.0" - chalk "^5.2.0" - chokidar "^3.5.3" - chunkd "^2.0.1" - ci-info "^3.8.0" - ci-parallel-vars "^1.0.1" - clean-yaml-object "^0.1.0" - cli-truncate "^3.1.0" - code-excerpt "^4.0.0" - common-path-prefix "^3.0.0" - concordance "^5.0.4" - currently-unhandled "^0.4.1" - debug "^4.3.4" - emittery "^1.0.1" - figures "^5.0.0" - globby "^13.1.4" - ignore-by-default "^2.1.0" - indent-string "^5.0.0" - is-error "^2.2.2" - is-plain-object "^5.0.0" - is-promise "^4.0.0" - matcher "^5.0.0" - mem "^9.0.2" - ms "^2.1.3" - p-event "^5.0.1" - p-map "^5.5.0" - picomatch "^2.3.1" - pkg-conf "^4.0.0" - plur "^5.1.0" - pretty-ms "^8.0.0" - resolve-cwd "^3.0.0" - stack-utils "^2.0.6" - strip-ansi "^7.0.1" - supertap "^3.0.1" - temp-dir "^3.0.0" - write-file-atomic "^5.0.1" - yargs "^17.7.2" - -binary-extensions@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" - integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== - -blueimp-md5@^2.10.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/blueimp-md5/-/blueimp-md5-2.19.0.tgz#b53feea5498dcb53dc6ec4b823adb84b729c4af0" - integrity sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w== - -braces@^3.0.2, braces@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -callsites@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-4.0.0.tgz#8014cea4fedfe681a30e2f7d2d557dd95808a92a" - integrity sha512-y3jRROutgpKdz5vzEhWM34TidDU8vkJppF8dszITeb1PQmSqV3DTxyV8G/lyO/DNvtE1YTedehmw9MPZsCBHxQ== - -cbor@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/cbor/-/cbor-8.1.0.tgz#cfc56437e770b73417a2ecbfc9caf6b771af60d5" - integrity sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg== - dependencies: - nofilter "^3.1.0" - -chalk@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" - integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== - -chokidar@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" - integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - -chunkd@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/chunkd/-/chunkd-2.0.1.tgz#49cd1d7b06992dc4f7fccd962fe2a101ee7da920" - integrity sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ== - -ci-info@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91" - integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw== - -ci-parallel-vars@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ci-parallel-vars/-/ci-parallel-vars-1.0.1.tgz#e87ff0625ccf9d286985b29b4ada8485ca9ffbc2" - integrity sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg== - -clean-stack@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-4.2.0.tgz#c464e4cde4ac789f4e0735c5d75beb49d7b30b31" - integrity sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg== - dependencies: - escape-string-regexp "5.0.0" - -clean-yaml-object@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz#63fb110dc2ce1a84dc21f6d9334876d010ae8b68" - integrity sha512-3yONmlN9CSAkzNwnRCiJQ7Q2xK5mWuEfL3PuTZcAUzhObbXsfsnMptJzXwz93nc5zn9V9TwCVMmV7w4xsm43dw== - -cli-truncate@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-3.1.0.tgz#3f23ab12535e3d73e839bb43e73c9de487db1389" - integrity sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA== - dependencies: - slice-ansi "^5.0.0" - string-width "^5.0.0" - -cliui@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" - integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.1" - wrap-ansi "^7.0.0" - -code-excerpt@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/code-excerpt/-/code-excerpt-4.0.0.tgz#2de7d46e98514385cb01f7b3b741320115f4c95e" - integrity sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA== - dependencies: - convert-to-spaces "^2.0.1" - -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== - -common-path-prefix@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" - integrity sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w== - -concordance@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/concordance/-/concordance-5.0.4.tgz#9896073261adced72f88d60e4d56f8efc4bbbbd2" - integrity sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw== - dependencies: - date-time "^3.1.0" - esutils "^2.0.3" - fast-diff "^1.2.0" - js-string-escape "^1.0.1" - lodash "^4.17.15" - md5-hex "^3.0.1" - semver "^7.3.2" - well-known-symbols "^2.0.0" - -convert-to-spaces@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz#61a6c98f8aa626c16b296b862a91412a33bceb6b" - integrity sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ== - -currently-unhandled@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" - integrity sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng== - dependencies: - array-find-index "^1.0.1" - -date-time@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/date-time/-/date-time-3.1.0.tgz#0d1e934d170579f481ed8df1e2b8ff70ee845e1e" - integrity sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg== - dependencies: - time-zone "^1.0.0" - -debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - -emittery@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-1.0.1.tgz#e0cf36e2d7eef94dbd025969f642d57ae50a56cd" - integrity sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-string-regexp@5.0.0, escape-string-regexp@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" - integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw== - -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esutils@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -fast-diff@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" - integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== - -fast-glob@^3.3.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" - integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fastq@^1.6.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" - integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== - dependencies: - reusify "^1.0.4" - -figures@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-5.0.0.tgz#126cd055052dea699f8a54e8c9450e6ecfc44d5f" - integrity sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg== - dependencies: - escape-string-regexp "^5.0.0" - is-unicode-supported "^1.2.0" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -find-up@^6.0.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-6.3.0.tgz#2abab3d3280b2dc7ac10199ef324c4e002c8c790" - integrity sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw== - dependencies: - locate-path "^7.1.0" - path-exists "^5.0.0" - -fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -glob-parent@^5.1.2, glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -globby@^13.1.4: - version "13.2.2" - resolved "https://registry.yarnpkg.com/globby/-/globby-13.2.2.tgz#63b90b1bf68619c2135475cbd4e71e66aa090592" - integrity sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w== - dependencies: - dir-glob "^3.0.1" - fast-glob "^3.3.0" - ignore "^5.2.4" - merge2 "^1.4.1" - slash "^4.0.0" - -ignore-by-default@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-2.1.0.tgz#c0e0de1a99b6065bdc93315a6f728867981464db" - integrity sha512-yiWd4GVmJp0Q6ghmM2B/V3oZGRmjrKLXvHR3TE1nfoXsmoggllfZUQe74EN0fJdPFZu2NIvNdrMMLm3OsV7Ohw== - -ignore@^5.2.4: - version "5.2.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" - integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== - -indent-string@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-5.0.0.tgz#4fd2980fccaf8622d14c64d694f4cf33c81951a5" - integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg== - -irregular-plurals@^3.3.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-3.5.0.tgz#0835e6639aa8425bdc8b0d33d0dc4e89d9c01d2b" - integrity sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ== - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-error@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/is-error/-/is-error-2.2.2.tgz#c10ade187b3c93510c5470a5567833ee25649843" - integrity sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg== - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-fullwidth-code-point@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88" - integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== - -is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-plain-object@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" - integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== - -is-promise@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" - integrity sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ== - -is-unicode-supported@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz#d824984b616c292a2e198207d4a609983842f714" - integrity sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ== - -js-string-escape@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef" - integrity sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg== - -js-yaml@^3.14.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -load-json-file@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-7.0.1.tgz#a3c9fde6beffb6bedb5acf104fad6bb1604e1b00" - integrity sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ== - -locate-path@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-7.2.0.tgz#69cb1779bd90b35ab1e771e1f2f89a202c2a8a8a" - integrity sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA== - dependencies: - p-locate "^6.0.0" - -lodash@^4.17.15: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - -map-age-cleaner@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - -matcher@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/matcher/-/matcher-5.0.0.tgz#cd82f1c7ae7ee472a9eeaf8ec7cac45e0fe0da62" - integrity sha512-s2EMBOWtXFc8dgqvoAzKJXxNHibcdJMV0gwqKUaw9E2JBJuGUK7DrNKrA6g/i+v72TT16+6sVm5mS3thaMLQUw== - dependencies: - escape-string-regexp "^5.0.0" - -md5-hex@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-3.0.1.tgz#be3741b510591434b2784d79e556eefc2c9a8e5c" - integrity sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw== - dependencies: - blueimp-md5 "^2.10.0" - -mem@^9.0.2: - version "9.0.2" - resolved "https://registry.yarnpkg.com/mem/-/mem-9.0.2.tgz#bbc2d40be045afe30749681e8f5d554cee0c0354" - integrity sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A== - dependencies: - map-age-cleaner "^0.1.3" - mimic-fn "^4.0.0" - -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - -micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== - dependencies: - braces "^3.0.2" - picomatch "^2.3.1" - -mimic-fn@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" - integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -nofilter@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66" - integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g== - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw== - -p-event@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/p-event/-/p-event-5.0.1.tgz#614624ec02ae7f4f13d09a721c90586184af5b0c" - integrity sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ== - dependencies: - p-timeout "^5.0.2" - -p-limit@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" - integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== - dependencies: - yocto-queue "^1.0.0" - -p-locate@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-6.0.0.tgz#3da9a49d4934b901089dca3302fa65dc5a05c04f" - integrity sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw== - dependencies: - p-limit "^4.0.0" - -p-map@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-5.5.0.tgz#054ca8ca778dfa4cf3f8db6638ccb5b937266715" - integrity sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg== - dependencies: - aggregate-error "^4.0.0" - -p-timeout@^5.0.2: - version "5.1.0" - resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-5.1.0.tgz#b3c691cf4415138ce2d9cfe071dba11f0fee085b" - integrity sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew== - -parse-ms@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-3.0.0.tgz#3ea24a934913345fcc3656deda72df921da3a70e" - integrity sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw== - -path-exists@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" - integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== - -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pkg-conf@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-4.0.0.tgz#63ace00cbacfa94c2226aee133800802d3e3b80c" - integrity sha512-7dmgi4UY4qk+4mj5Cd8v/GExPo0K+SlY+hulOSdfZ/T6jVH6//y7NtzZo5WrfhDBxuQ0jCa7fLZmNaNh7EWL/w== - dependencies: - find-up "^6.0.0" - load-json-file "^7.0.0" - -plur@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/plur/-/plur-5.1.0.tgz#bff58c9f557b9061d60d8ebf93959cf4b08594ae" - integrity sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg== - dependencies: - irregular-plurals "^3.3.0" - -pretty-ms@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-8.0.0.tgz#a35563b2a02df01e595538f86d7de54ca23194a3" - integrity sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q== - dependencies: - parse-ms "^3.0.0" - -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== - dependencies: - resolve-from "^5.0.0" - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -reusify@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - -semver@^7.3.2: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" - -serialize-error@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-7.0.1.tgz#f1360b0447f61ffb483ec4157c737fab7d778e18" - integrity sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw== - dependencies: - type-fest "^0.13.1" - -signal-exit@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -slash@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" - integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== - -slice-ansi@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a" - integrity sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ== - dependencies: - ansi-styles "^6.0.0" - is-fullwidth-code-point "^4.0.0" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== - -stack-utils@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" - integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== - dependencies: - escape-string-regexp "^2.0.0" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^5.0.0: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== - dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" - integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== - dependencies: - ansi-regex "^6.0.1" - -supertap@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/supertap/-/supertap-3.0.1.tgz#aa89e4522104402c6e8fe470a7d2db6dc4037c6a" - integrity sha512-u1ZpIBCawJnO+0QePsEiOknOfCRq0yERxiAchT0i4li0WHNUJbf0evXXSXOcCAR4M8iMDoajXYmstm/qO81Isw== - dependencies: - indent-string "^5.0.0" - js-yaml "^3.14.1" - serialize-error "^7.0.1" - strip-ansi "^7.0.1" - -temp-dir@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-3.0.0.tgz#7f147b42ee41234cc6ba3138cd8e8aa2302acffa" - integrity sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw== - -time-zone@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/time-zone/-/time-zone-1.0.0.tgz#99c5bf55958966af6d06d83bdf3800dc82faec5d" - integrity sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -type-fest@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934" - integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg== - -well-known-symbols@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/well-known-symbols/-/well-known-symbols-2.0.0.tgz#e9c7c07dbd132b7b84212c8174391ec1f9871ba5" - integrity sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q== - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -write-file-atomic@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" - integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== - dependencies: - imurmurhash "^0.1.4" - signal-exit "^4.0.1" - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yargs-parser@^21.1.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - -yargs@^17.7.2: - version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" - integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.1.1" - -yocto-queue@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" - integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== From 3cae4b03a938f103d8e14a54b0d85207d8ba352c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E5=B0=98?= Date: Wed, 25 Oct 2023 14:51:30 +0800 Subject: [PATCH 02/18] fix: add dependencies for test --- crates/loader_compilation/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/loader_compilation/Cargo.toml b/crates/loader_compilation/Cargo.toml index 44235fd..94e1198 100644 --- a/crates/loader_compilation/Cargo.toml +++ b/crates/loader_compilation/Cargo.toml @@ -26,4 +26,5 @@ xxhash-rust = { workspace = true, features = ["xxh32"] } [dev-dependencies] indexmap = { workspace = true } -tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros", "test-util", "parking_lot"] } \ No newline at end of file +tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros", "test-util", "parking_lot"] } +rspack_testing = { path = "../.rspack_crates/rspack_testing" } \ No newline at end of file From 0dd215fb10e69e2abf6ecc53813b7dffb93e6e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E5=B0=98?= Date: Mon, 30 Oct 2023 16:34:33 +0800 Subject: [PATCH 03/18] feat: support built-in loader of compilation --- crates/loader_compilation/src/lib.rs | 57 ++++++++++++++++-- crates/loader_compilation/src/options.rs | 0 .../loader_compilation/src/transform/mod.rs | 60 +++++++++++++++++++ 3 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 crates/loader_compilation/src/options.rs create mode 100644 crates/loader_compilation/src/transform/mod.rs diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index 34570bc..4f61f07 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -1,10 +1,21 @@ +use std::sync::Arc; use rspack_core::{rspack_sources::SourceMap, LoaderRunnerContext, Mode}; use rspack_loader_runner::{Identifiable, Identifier, Loader, LoaderContext}; use rspack_error::{ internal_error, Diagnostic, DiagnosticKind, Error, InternalError, Result, Severity, TraceableError, }; - +use swc_core::{ + base::{ + Compiler, + config::{InputSourceMap, Options}, + try_with_handler + }, + common::{FilePathMapping,GLOBALS, FileName, comments::SingleThreadedComments}, + ecma::transforms::base::pass::noop +}; +mod transform; +use transform::*; pub struct CompilationLoader { identifier: Identifier, } @@ -28,14 +39,48 @@ impl CompilationLoader { #[async_trait::async_trait] impl Loader for CompilationLoader { async fn run(&self, loader_context: &mut LoaderContext<'_, LoaderRunnerContext>) -> Result<()> { + let resource_path = loader_context.resource_path.to_path_buf(); let Some(content) = std::mem::take(&mut loader_context.content) else { return Err(internal_error!("No content found")); }; - let mut source = content.try_into_string()?; - source += r#" -window.__custom_code__ = true; -"#; - loader_context.content = Some(source.into()); + + let compiler = Compiler::new(Arc::from(swc_core::common::SourceMap::new(FilePathMapping::empty()))); + // TODO: init loader with custom options. + let mut swc_options = Options::default(); + + // TODO: merge config with built-in config. + + if let Some(pre_source_map) = std::mem::take(&mut loader_context.source_map) { + if let Ok(source_map) = pre_source_map.to_json() { + swc_options.config.input_source_map = Some(InputSourceMap:: Str(source_map)) + } + } + + GLOBALS.set(&Default::default(), || { + try_with_handler(compiler.cm.clone(), Default::default(), |handler| { + compiler.run(|| { + let content = content.try_into_string()?; + let fm = compiler.cm.new_source_file(FileName::Real(resource_path.clone()), content.clone()); + let comments = SingleThreadedComments::default(); + let transform_options = SwcPluginOptions { + keep_export: None, + remove_export: None, + }; + let out = compiler.process_js_with_custom_pass( + fm, + None, + handler, + &swc_options, + comments, |_| { + transform(transform_options) + }, + |_| noop(), + )?; + Ok(()) + }) + }) + })?; + Ok(()) } } diff --git a/crates/loader_compilation/src/options.rs b/crates/loader_compilation/src/options.rs new file mode 100644 index 0000000..e69de29 diff --git a/crates/loader_compilation/src/transform/mod.rs b/crates/loader_compilation/src/transform/mod.rs new file mode 100644 index 0000000..e0e15f8 --- /dev/null +++ b/crates/loader_compilation/src/transform/mod.rs @@ -0,0 +1,60 @@ +use either::Either; +use swc_core::common::chain; +use swc_core::ecma::{ + transforms::base::pass::noop, + visit::{as_folder, Fold, VisitMut}, + ast::Module, +}; + +macro_rules! either { + ($config:expr, $f:expr) => { + if let Some(config) = &$config { + Either::Left($f(config)) + } else { + Either::Right(noop()) + } + }; + ($config:expr, $f:expr, $enabled:expr) => { + if $enabled { + either!($config, $f) + } else { + Either::Right(noop()) + } + }; +} + +pub struct KeepExportOptions { + export_names: Vec, +} + +pub struct RemoveExport { + remove_names: Vec, +} + +pub struct SwcPluginOptions { + pub keep_export: Option, + pub remove_export: Option, +} + +pub(crate) fn transform<'a>(plugin_options: SwcPluginOptions) -> impl Fold + 'a { + chain!( + either!(plugin_options.keep_export, |_| { + keep_export() + }), + either!(plugin_options.remove_export, |_| { + keep_export() + }), + ) +} + +struct KeepExport; + +impl VisitMut for KeepExport { + fn visit_mut_module(&mut self, module: &mut Module) { + + } +} + +fn keep_export() -> impl Fold { + as_folder(KeepExport) +} \ No newline at end of file From 1cf0af4fc76a4c08d0f6f12d493761c36c2b8b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E5=B0=98?= Date: Mon, 30 Oct 2023 17:47:07 +0800 Subject: [PATCH 04/18] fix: bump rspack_core version --- Cargo.toml | 73 +- .../binding_options/src/options/js_loader.rs | 28 +- crates/binding_options/src/options/mod.rs | 6 +- crates/node_binding/src/lib.rs | 1 - crates/node_binding/src/loader.rs | 3 +- pnpm-lock.yaml | 1071 +++-------------- scripts/clone-rspack.mjs | 2 +- 7 files changed, 229 insertions(+), 955 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e8df955..3930002 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,30 +9,21 @@ members = [ resolver = "2" [workspace.dependencies] -anyhow = { version = "1.0.75" } -async-trait = { version = "0.1.71" } -better_scoped_tls = { version = "0.1.1" } -derivative = { version = "2.2.0" } -glob = { version = "0.3.1" } -# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix -napi = "2.12.2" -napi-derive = "2.12.2" -napi-build = "2.0.1" -rustc-hash = { version = "1.1.0" } -serde = { version = "1.0.171" } -serde_json = { version = "1.0.100" } -tokio = { version = "1.29.1" } -tracing = { version = "0.1.37" } +anyhow = { version = "1.0.71", features = ["backtrace"] } async-recursion = { version = "1.0.4" } async-scoped = { version = "0.7.1" } +async-trait = { version = "0.1.71" } backtrace = "0.3" +better_scoped_tls = { version = "0.1.1" } bitflags = { version = "1.3.2" } colored = { version = "2.0.4" } concat-string = "1.0.1" dashmap = { version = "5.5.0" } +derivative = { version = "2.2.0" } derive_builder = { version = "0.11.2" } futures = { version = "0.3.28" } futures-util = { version = "0.3.28" } +glob = { version = "0.3.1" } hashlink = { version = "0.8.3" } indexmap = { version = "1.9.3" } insta = { version = "1.30.0" } @@ -43,49 +34,59 @@ mimalloc-rust = { version = "0.2" } mime_guess = { version = "2.0.4" } once_cell = { version = "1.18.0" } paste = { version = "1.0" } +path-clean = { version = "1.0.1" } pathdiff = { version = "0.2.1" } preset_env_base = { version = "0.4.5" } rayon = { version = "1.7.0" } regex = { version = "1.9.1" } rkyv = { version = "0.7.42" } rspack_sources = { version = "0.2.7" } +rustc-hash = { version = "1.1.0" } schemars = { version = "0.8.12" } +serde = { version = "1.0.171" } +serde_json = { version = "1.0.100" } similar = { version = "2.2.1" } sugar_path = { version = "0.0.12" } testing_macros = { version = "0.2.11" } +tokio = { version = "1.29.1" } +tracing = { version = "0.1.37" } tracing-subscriber = { version = "0.3.17" } url = { version = "2.4.0" } urlencoding = { version = "2.1.2" } ustr = { version = "0.9.0" } xxhash-rust = { version = "0.8.6" } +# Pinned +napi = { version = "=2.13.3" } +napi-build = { version = "=2.0.1" } +napi-derive = { version = "=2.13.0" } napi-sys = { version = "=2.2.3" } -styled_components = { version = "=0.72.0" } +styled_components = { version = "0.77.0" } swc_config = { version = "=0.1.7" } -swc_core = { version = "=0.83.1", default-features = false } -swc_css = { version = "=0.155.2" } -swc_ecma_minifier = { version = "=0.187.0", default-features = false } -swc_emotion = { version = "=0.42.0" } -swc_error_reporters = { version = "=0.16.1" } -swc_html = { version = "=0.131.0" } -swc_html_minifier = { version = "=0.128.0" } -swc_node_comments = { version = "=0.19.1" } +swc_core = { version = "0.86.9", default-features = false } +swc_css = { version = "0.157.1" } +swc_ecma_minifier = { version = "0.189.9", default-features = false } +swc_emotion = { version = "=0.53.0" } +swc_error_reporters = { version = "=0.17.0" } +swc_html = { version = "=0.134.10" } +swc_html_minifier = { version = "=0.131.9" } +swc_node_comments = { version = "=0.20.0" } tikv-jemallocator = { version = "=0.5.4", features = ["disable_initial_exec_tls"] } [patch.crates-io] -swc_config = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_core = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_minifier = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_error_reporters = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_html = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_html_minifier = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_node_comments = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_common = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_utils = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_ast = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_visit = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_atoms = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -preset_env_base = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_config = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_core = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_ecma_minifier = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_error_reporters = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_html = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_html_minifier = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_node_comments = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_common = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_ecma_utils = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_ecma_ast = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_ecma_visit = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +swc_atoms = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } +preset_env_base = { git = "https://github.com/swc-project/swc.git", rev = "4a1a233" } [profile.dev] debug = 2 diff --git a/crates/binding_options/src/options/js_loader.rs b/crates/binding_options/src/options/js_loader.rs index 98ee634..ae36171 100644 --- a/crates/binding_options/src/options/js_loader.rs +++ b/crates/binding_options/src/options/js_loader.rs @@ -21,6 +21,16 @@ pub async fn run_builtin_loader( let loader = get_builtin_loader(&builtin, options); let loader_item = loader.clone().into(); let list = &[loader_item]; + let additional_data = { + let mut additional_data = loader_context.additional_data_external.clone(); + if let Some(data) = loader_context + .additional_data + .map(|b| String::from_utf8_lossy(b.as_ref()).to_string()) + { + additional_data.insert(data); + } + additional_data + }; let mut cx = LoaderContext { content: loader_context @@ -30,15 +40,13 @@ pub async fn run_builtin_loader( resource_path: Path::new(&loader_context.resource_path), resource_query: loader_context.resource_query.as_deref(), resource_fragment: loader_context.resource_fragment.as_deref(), - context: loader_context.context.clone(), + context: loader_context.context_external.clone(), source_map: loader_context .source_map .map(|s| SourceMap::from_slice(s.as_ref())) .transpose() .map_err(|e| Error::from_reason(e.to_string()))?, - additional_data: loader_context - .additional_data - .map(|b| String::from_utf8_lossy(b.as_ref()).to_string()), + additional_data, cacheable: loader_context.cacheable, file_dependencies: HashSet::from_iter( loader_context @@ -69,21 +77,21 @@ pub async fn run_builtin_loader( __diagnostics: vec![], __resource_data: &ResourceData::new(Default::default(), Default::default()), __loader_items: LoaderItemList(list), - __loader_index: 0, + // This is used an hack to `builtin:swc-loader` in order to determine whether to return AST or source. + __loader_index: loader_context.loader_index_from_js.unwrap_or(0) as usize, __plugins: &[], }; if loader_context.is_pitching { - // Run pitching loader - loader - .pitch(&mut cx) - .await - .map_err(|e| Error::from_reason(e.to_string()))?; + // Builtin loaders dispatched using JS loader-runner does not support pitching. + // This phase is ignored. } else { // Run normal loader loader .run(&mut cx) .await .map_err(|e| Error::from_reason(e.to_string()))?; + // restore the hack + cx.__loader_index = 0; } JsLoaderContext::try_from(&cx).map_err(|e| Error::from_reason(e.to_string())) diff --git a/crates/binding_options/src/options/mod.rs b/crates/binding_options/src/options/mod.rs index 786396a..414bb5a 100644 --- a/crates/binding_options/src/options/mod.rs +++ b/crates/binding_options/src/options/mod.rs @@ -9,7 +9,7 @@ use rspack_binding_options::{ RawMode, RawNodeOption, RawOptimizationOptions, RawOutputOptions, RawResolveOptions, RawSnapshotOptions, RawStatsOptions, RawTarget, RawOptionsApply, RawModuleOptions, }; -use rspack_plugin_javascript::{FlagDependencyExportsPlugin, FlagDependencyUsagePlugin}; +use rspack_plugin_javascript::{FlagDependencyExportsPlugin, FlagDependencyUsagePlugin, SideEffectsFlagPlugin}; use serde::Deserialize; mod raw_module; @@ -72,6 +72,7 @@ impl RawOptionsApply for RSPackRawOptions { }, async_web_assembly: self.experiments.async_web_assembly, new_split_chunks: self.experiments.new_split_chunks, + top_level_await: self.experiments.top_level_await, rspack_future: self.experiments.rspack_future.into(), }; let optimization = IS_ENABLE_NEW_SPLIT_CHUNKS.set(&experiments.new_split_chunks, || { @@ -128,6 +129,9 @@ impl RawOptionsApply for RSPackRawOptions { plugins.push(rspack_ids::NamedChunkIdsPlugin::new(None, None).boxed()); if experiments.rspack_future.new_treeshaking { + if optimization.side_effects.is_enable() { + plugins.push(SideEffectsFlagPlugin::default().boxed()); + } if optimization.provided_exports { plugins.push(FlagDependencyExportsPlugin::default().boxed()); } diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index b3c9180..262a360 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -27,7 +27,6 @@ mod utils; use hook::*; use js_values::*; - // Napi macro registered this successfully #[allow(unused)] use loader::*; diff --git a/crates/node_binding/src/loader.rs b/crates/node_binding/src/loader.rs index 03eb3b9..cc28833 100644 --- a/crates/node_binding/src/loader.rs +++ b/crates/node_binding/src/loader.rs @@ -1,6 +1,5 @@ use napi::Result; use rspack_binding_options::JsLoaderContext; -use binding_options::run_builtin_loader as run_builtin; /// Builtin loader runner #[napi(catch_unwind)] @@ -10,5 +9,5 @@ pub async fn run_builtin_loader( options: Option, loader_context: JsLoaderContext, ) -> Result { - run_builtin(builtin, options.as_deref(), loader_context).await + binding_options::run_builtin_loader(builtin, options.as_deref(), loader_context).await } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2786b92..eccca0c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,55 +1,61 @@ -lockfileVersion: 5.4 +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false importers: .: - specifiers: - fs-extra: ^11.1.1 - git-clone: 0.2.0 - ora: ^7.0.1 - rimraf: ^5.0.5 devDependencies: - fs-extra: 11.1.1 - git-clone: 0.2.0 - ora: 7.0.1 - rimraf: 5.0.5 + fs-extra: + specifier: ^11.1.1 + version: 11.1.1 + git-clone: + specifier: 0.2.0 + version: 0.2.0 + ora: + specifier: ^7.0.1 + version: 7.0.1 + rimraf: + specifier: ^5.0.5 + version: 5.0.5 crates/node_binding: - specifiers: - '@napi-rs/cli': 3.0.0-alpha.3 - ava: ^5.1.1 - call-bind: 1.0.2 devDependencies: - '@napi-rs/cli': 3.0.0-alpha.3 - ava: 5.3.1 - call-bind: 1.0.2 + '@napi-rs/cli': + specifier: 3.0.0-alpha.3 + version: 3.0.0-alpha.3 + call-bind: + specifier: 1.0.2 + version: 1.0.2 packages: - /@isaacs/cliui/8.0.2: + /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} dependencies: string-width: 5.1.2 - string-width-cjs: /string-width/4.2.3 + string-width-cjs: /string-width@4.2.3 strip-ansi: 7.1.0 - strip-ansi-cjs: /strip-ansi/6.0.1 + strip-ansi-cjs: /strip-ansi@6.0.1 wrap-ansi: 8.1.0 - wrap-ansi-cjs: /wrap-ansi/7.0.0 + wrap-ansi-cjs: /wrap-ansi@7.0.0 dev: true - /@ljharb/through/2.3.10: + /@ljharb/through@2.3.10: resolution: {integrity: sha512-NwkQ4+jf4tMpDSlRc1wlttHnC7KfII+SjdqDEwEuQ7W0IaTK5Ab1jxCJrH6pYsLbLXiQgRn+nFQsGmKowbAKkA==} engines: {node: '>= 0.4'} dev: true - /@napi-rs/cli/3.0.0-alpha.3: + /@napi-rs/cli@3.0.0-alpha.3: resolution: {integrity: sha512-s5RHKqbqUVVfwgr/wO7S/vdqQ9shQzvIETgdz57r1Gg4bRv8kqy2Q1LfJAQJ09Y9Ddao9jKErvz4+11gHZZrWA==} engines: {node: '>= 16'} hasBin: true dependencies: '@octokit/rest': 19.0.13 - clipanion: 3.2.1 + clipanion: 3.2.1(typanion@3.14.0) colorette: 2.0.20 debug: 4.3.4 inquirer: 9.2.11 @@ -61,33 +67,12 @@ packages: - supports-color dev: true - /@nodelib/fs.scandir/2.1.5: - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - dev: true - - /@nodelib/fs.stat/2.0.5: - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - dev: true - - /@nodelib/fs.walk/1.2.8: - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.15.0 - dev: true - - /@octokit/auth-token/3.0.4: + /@octokit/auth-token@3.0.4: resolution: {integrity: sha512-TWFX7cZF2LXoCvdmJWY7XVPi74aSY0+FfBZNSXEXFkMpjcqsQwDSYVv5FhRFaI0V1ECnwbz4j59T/G+rXNWaIQ==} engines: {node: '>= 14'} dev: true - /@octokit/core/4.2.4: + /@octokit/core@4.2.4: resolution: {integrity: sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==} engines: {node: '>= 14'} dependencies: @@ -102,7 +87,7 @@ packages: - encoding dev: true - /@octokit/endpoint/7.0.6: + /@octokit/endpoint@7.0.6: resolution: {integrity: sha512-5L4fseVRUsDFGR00tMWD/Trdeeihn999rTMGRMC1G/Ldi1uWlWJzI98H4Iak5DB/RVvQuyMYKqSK/R6mbSOQyg==} engines: {node: '>= 14'} dependencies: @@ -111,7 +96,7 @@ packages: universal-user-agent: 6.0.0 dev: true - /@octokit/graphql/5.0.6: + /@octokit/graphql@5.0.6: resolution: {integrity: sha512-Fxyxdy/JH0MnIB5h+UQ3yCoh1FG4kWXfFKkpWqjZHw/p+Kc8Y44Hu/kCgNBT6nU1shNumEchmW/sUO1JuQnPcw==} engines: {node: '>= 14'} dependencies: @@ -122,11 +107,11 @@ packages: - encoding dev: true - /@octokit/openapi-types/18.1.1: + /@octokit/openapi-types@18.1.1: resolution: {integrity: sha512-VRaeH8nCDtF5aXWnjPuEMIYf1itK/s3JYyJcWFJT8X9pSNnBtriDf7wlEWsGuhPLl4QIH4xM8fqTXDwJ3Mu6sw==} dev: true - /@octokit/plugin-paginate-rest/6.1.2_@octokit+core@4.2.4: + /@octokit/plugin-paginate-rest@6.1.2(@octokit/core@4.2.4): resolution: {integrity: sha512-qhrmtQeHU/IivxucOV1bbI/xZyC/iOBhclokv7Sut5vnejAIAEXVcGQeRpQlU39E0WwK9lNvJHphHri/DB6lbQ==} engines: {node: '>= 14'} peerDependencies: @@ -137,7 +122,7 @@ packages: '@octokit/types': 9.3.2 dev: true - /@octokit/plugin-request-log/1.0.4_@octokit+core@4.2.4: + /@octokit/plugin-request-log@1.0.4(@octokit/core@4.2.4): resolution: {integrity: sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==} peerDependencies: '@octokit/core': '>=3' @@ -145,7 +130,7 @@ packages: '@octokit/core': 4.2.4 dev: true - /@octokit/plugin-rest-endpoint-methods/7.2.3_@octokit+core@4.2.4: + /@octokit/plugin-rest-endpoint-methods@7.2.3(@octokit/core@4.2.4): resolution: {integrity: sha512-I5Gml6kTAkzVlN7KCtjOM+Ruwe/rQppp0QU372K1GP7kNOYEKe8Xn5BW4sE62JAHdwpq95OQK/qGNyKQMUzVgA==} engines: {node: '>= 14'} peerDependencies: @@ -155,7 +140,7 @@ packages: '@octokit/types': 10.0.0 dev: true - /@octokit/request-error/3.0.3: + /@octokit/request-error@3.0.3: resolution: {integrity: sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==} engines: {node: '>= 14'} dependencies: @@ -164,7 +149,7 @@ packages: once: 1.4.0 dev: true - /@octokit/request/6.2.8: + /@octokit/request@6.2.8: resolution: {integrity: sha512-ow4+pkVQ+6XVVsekSYBzJC0VTVvh/FCTUUgTsboGq+DTeWdyIFV8WSCdo0RIxk6wSkBTHqIK1mYuY7nOBXOchw==} engines: {node: '>= 14'} dependencies: @@ -178,197 +163,87 @@ packages: - encoding dev: true - /@octokit/rest/19.0.13: + /@octokit/rest@19.0.13: resolution: {integrity: sha512-/EzVox5V9gYGdbAI+ovYj3nXQT1TtTHRT+0eZPcuC05UFSWO3mdO9UY1C0i2eLF9Un1ONJkAk+IEtYGAC+TahA==} engines: {node: '>= 14'} dependencies: '@octokit/core': 4.2.4 - '@octokit/plugin-paginate-rest': 6.1.2_@octokit+core@4.2.4 - '@octokit/plugin-request-log': 1.0.4_@octokit+core@4.2.4 - '@octokit/plugin-rest-endpoint-methods': 7.2.3_@octokit+core@4.2.4 + '@octokit/plugin-paginate-rest': 6.1.2(@octokit/core@4.2.4) + '@octokit/plugin-request-log': 1.0.4(@octokit/core@4.2.4) + '@octokit/plugin-rest-endpoint-methods': 7.2.3(@octokit/core@4.2.4) transitivePeerDependencies: - encoding dev: true - /@octokit/tsconfig/1.0.2: + /@octokit/tsconfig@1.0.2: resolution: {integrity: sha512-I0vDR0rdtP8p2lGMzvsJzbhdOWy405HcGovrspJ8RRibHnyRgggUSNO5AIox5LmqiwmatHKYsvj6VGFHkqS7lA==} dev: true - /@octokit/types/10.0.0: + /@octokit/types@10.0.0: resolution: {integrity: sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg==} dependencies: '@octokit/openapi-types': 18.1.1 dev: true - /@octokit/types/9.3.2: + /@octokit/types@9.3.2: resolution: {integrity: sha512-D4iHGTdAnEEVsB8fl95m1hiz7D5YiRdQ9b/OEb3BYRVwbLsGHcRVPz+u+BgRLNk0Q0/4iZCBqDN96j2XNxfXrA==} dependencies: '@octokit/openapi-types': 18.1.1 dev: true - /@pkgjs/parseargs/0.11.0: + /@pkgjs/parseargs@0.11.0: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} requiresBuild: true dev: true optional: true - /acorn-walk/8.2.0: - resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} - engines: {node: '>=0.4.0'} - dev: true - - /acorn/8.10.0: - resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - - /aggregate-error/4.0.1: - resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==} - engines: {node: '>=12'} - dependencies: - clean-stack: 4.2.0 - indent-string: 5.0.0 - dev: true - - /ansi-escapes/4.3.2: + /ansi-escapes@4.3.2: resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} engines: {node: '>=8'} dependencies: type-fest: 0.21.3 dev: true - /ansi-regex/5.0.1: + /ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} dev: true - /ansi-regex/6.0.1: + /ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} dev: true - /ansi-styles/4.3.0: + /ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} dependencies: color-convert: 2.0.1 dev: true - /ansi-styles/6.2.1: + /ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} dev: true - /anymatch/3.1.3: - resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} - engines: {node: '>= 8'} - dependencies: - normalize-path: 3.0.0 - picomatch: 2.3.1 - dev: true - - /argparse/1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - dependencies: - sprintf-js: 1.0.3 - dev: true - - /argparse/2.0.1: + /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} dev: true - /array-find-index/1.0.2: - resolution: {integrity: sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==} - engines: {node: '>=0.10.0'} - dev: true - - /arrgv/1.0.2: - resolution: {integrity: sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw==} - engines: {node: '>=8.0.0'} - dev: true - - /arrify/3.0.0: - resolution: {integrity: sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==} - engines: {node: '>=12'} - dev: true - - /ava/5.3.1: - resolution: {integrity: sha512-Scv9a4gMOXB6+ni4toLuhAm9KYWEjsgBglJl+kMGI5+IVDt120CCDZyB5HNU9DjmLI2t4I0GbnxGLmmRfGTJGg==} - engines: {node: '>=14.19 <15 || >=16.15 <17 || >=18'} - hasBin: true - peerDependencies: - '@ava/typescript': '*' - peerDependenciesMeta: - '@ava/typescript': - optional: true - dependencies: - acorn: 8.10.0 - acorn-walk: 8.2.0 - ansi-styles: 6.2.1 - arrgv: 1.0.2 - arrify: 3.0.0 - callsites: 4.1.0 - cbor: 8.1.0 - chalk: 5.3.0 - chokidar: 3.5.3 - chunkd: 2.0.1 - ci-info: 3.9.0 - ci-parallel-vars: 1.0.1 - clean-yaml-object: 0.1.0 - cli-truncate: 3.1.0 - code-excerpt: 4.0.0 - common-path-prefix: 3.0.0 - concordance: 5.0.4 - currently-unhandled: 0.4.1 - debug: 4.3.4 - emittery: 1.0.1 - figures: 5.0.0 - globby: 13.2.2 - ignore-by-default: 2.1.0 - indent-string: 5.0.0 - is-error: 2.2.2 - is-plain-object: 5.0.0 - is-promise: 4.0.0 - matcher: 5.0.0 - mem: 9.0.2 - ms: 2.1.3 - p-event: 5.0.1 - p-map: 5.5.0 - picomatch: 2.3.1 - pkg-conf: 4.0.0 - plur: 5.1.0 - pretty-ms: 8.0.0 - resolve-cwd: 3.0.0 - stack-utils: 2.0.6 - strip-ansi: 7.1.0 - supertap: 3.0.1 - temp-dir: 3.0.0 - write-file-atomic: 5.0.1 - yargs: 17.7.2 - transitivePeerDependencies: - - supports-color - dev: true - - /balanced-match/1.0.2: + /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true - /base64-js/1.5.1: + /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} dev: true - /before-after-hook/2.2.3: + /before-after-hook@2.2.3: resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} dev: true - /binary-extensions/2.2.0: - resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} - engines: {node: '>=8'} - dev: true - - /bl/4.1.0: + /bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} dependencies: buffer: 5.7.1 @@ -376,7 +251,7 @@ packages: readable-stream: 3.6.2 dev: true - /bl/5.1.0: + /bl@5.1.0: resolution: {integrity: sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==} dependencies: buffer: 6.0.3 @@ -384,57 +259,34 @@ packages: readable-stream: 3.6.2 dev: true - /blueimp-md5/2.19.0: - resolution: {integrity: sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==} - dev: true - - /brace-expansion/2.0.1: + /brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} dependencies: balanced-match: 1.0.2 dev: true - /braces/3.0.2: - resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} - engines: {node: '>=8'} - dependencies: - fill-range: 7.0.1 - dev: true - - /buffer/5.7.1: + /buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} dependencies: base64-js: 1.5.1 ieee754: 1.2.1 dev: true - /buffer/6.0.3: + /buffer@6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} dependencies: base64-js: 1.5.1 ieee754: 1.2.1 dev: true - /call-bind/1.0.2: + /call-bind@1.0.2: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: function-bind: 1.1.1 get-intrinsic: 1.2.1 dev: true - /callsites/4.1.0: - resolution: {integrity: sha512-aBMbD1Xxay75ViYezwT40aQONfr+pSXTHwNKvIXhXD6+LY3F1dLIcceoC5OZKBVHbXcysz1hL9D2w0JJIMXpUw==} - engines: {node: '>=12.20'} - dev: true - - /cbor/8.1.0: - resolution: {integrity: sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==} - engines: {node: '>=12.19'} - dependencies: - nofilter: 3.1.0 - dev: true - - /chalk/4.1.2: + /chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} dependencies: @@ -442,153 +294,68 @@ packages: supports-color: 7.2.0 dev: true - /chalk/5.3.0: + /chalk@5.3.0: resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} dev: true - /chardet/0.7.0: + /chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} dev: true - /chokidar/3.5.3: - resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} - engines: {node: '>= 8.10.0'} - dependencies: - anymatch: 3.1.3 - braces: 3.0.2 - glob-parent: 5.1.2 - is-binary-path: 2.1.0 - is-glob: 4.0.3 - normalize-path: 3.0.0 - readdirp: 3.6.0 - optionalDependencies: - fsevents: 2.3.3 - dev: true - - /chunkd/2.0.1: - resolution: {integrity: sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==} - dev: true - - /ci-info/3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} - engines: {node: '>=8'} - dev: true - - /ci-parallel-vars/1.0.1: - resolution: {integrity: sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg==} - dev: true - - /clean-stack/4.2.0: - resolution: {integrity: sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==} - engines: {node: '>=12'} - dependencies: - escape-string-regexp: 5.0.0 - dev: true - - /clean-yaml-object/0.1.0: - resolution: {integrity: sha512-3yONmlN9CSAkzNwnRCiJQ7Q2xK5mWuEfL3PuTZcAUzhObbXsfsnMptJzXwz93nc5zn9V9TwCVMmV7w4xsm43dw==} - engines: {node: '>=0.10.0'} - dev: true - - /cli-cursor/3.1.0: + /cli-cursor@3.1.0: resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} engines: {node: '>=8'} dependencies: restore-cursor: 3.1.0 dev: true - /cli-cursor/4.0.0: + /cli-cursor@4.0.0: resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: restore-cursor: 4.0.0 dev: true - /cli-spinners/2.9.1: + /cli-spinners@2.9.1: resolution: {integrity: sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==} engines: {node: '>=6'} dev: true - /cli-truncate/3.1.0: - resolution: {integrity: sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - slice-ansi: 5.0.0 - string-width: 5.1.2 - dev: true - - /cli-width/4.1.0: + /cli-width@4.1.0: resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} engines: {node: '>= 12'} dev: true - /clipanion/3.2.1: + /clipanion@3.2.1(typanion@3.14.0): resolution: {integrity: sha512-dYFdjLb7y1ajfxQopN05mylEpK9ZX0sO1/RfMXdfmwjlIsPkbh4p7A682x++zFPLDCo1x3p82dtljHf5cW2LKA==} + peerDependencies: + typanion: '*' dependencies: typanion: 3.14.0 dev: true - /cliui/8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - dev: true - - /clone/1.0.4: + /clone@1.0.4: resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} dev: true - /code-excerpt/4.0.0: - resolution: {integrity: sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - convert-to-spaces: 2.0.1 - dev: true - - /color-convert/2.0.1: + /color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} dependencies: color-name: 1.1.4 dev: true - /color-name/1.1.4: + /color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true - /colorette/2.0.20: + /colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} dev: true - /common-path-prefix/3.0.0: - resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} - dev: true - - /concordance/5.0.4: - resolution: {integrity: sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==} - engines: {node: '>=10.18.0 <11 || >=12.14.0 <13 || >=14'} - dependencies: - date-time: 3.1.0 - esutils: 2.0.3 - fast-diff: 1.3.0 - js-string-escape: 1.0.1 - lodash: 4.17.21 - md5-hex: 3.0.1 - semver: 7.5.4 - well-known-symbols: 2.0.0 - dev: true - - /convert-to-spaces/2.0.1: - resolution: {integrity: sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - - /cross-spawn/7.0.3: + /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} dependencies: @@ -597,21 +364,7 @@ packages: which: 2.0.2 dev: true - /currently-unhandled/0.4.1: - resolution: {integrity: sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==} - engines: {node: '>=0.10.0'} - dependencies: - array-find-index: 1.0.2 - dev: true - - /date-time/3.1.0: - resolution: {integrity: sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==} - engines: {node: '>=6'} - dependencies: - time-zone: 1.0.0 - dev: true - - /debug/4.3.4: + /debug@4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: @@ -623,71 +376,38 @@ packages: ms: 2.1.2 dev: true - /defaults/1.0.4: + /defaults@1.0.4: resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} dependencies: clone: 1.0.4 dev: true - /deprecation/2.3.1: + /deprecation@2.3.1: resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} dev: true - /dir-glob/3.0.1: - resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} - engines: {node: '>=8'} - dependencies: - path-type: 4.0.0 - dev: true - - /eastasianwidth/0.2.0: + /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true - /emittery/1.0.1: - resolution: {integrity: sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ==} - engines: {node: '>=14.16'} - dev: true - - /emoji-regex/10.2.1: + /emoji-regex@10.2.1: resolution: {integrity: sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==} dev: true - /emoji-regex/8.0.0: + /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} dev: true - /emoji-regex/9.2.2: + /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} dev: true - /escalade/3.1.1: - resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} - engines: {node: '>=6'} - dev: true - - /escape-string-regexp/2.0.0: - resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} - engines: {node: '>=8'} - dev: true - - /escape-string-regexp/5.0.0: + /escape-string-regexp@5.0.0: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} dev: true - /esprima/4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - dev: true - - /esutils/2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - dev: true - - /external-editor/3.1.0: + /external-editor@3.1.0: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} dependencies: @@ -696,28 +416,7 @@ packages: tmp: 0.0.33 dev: true - /fast-diff/1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - dev: true - - /fast-glob/3.3.1: - resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} - engines: {node: '>=8.6.0'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.5 - dev: true - - /fastq/1.15.0: - resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} - dependencies: - reusify: 1.0.4 - dev: true - - /figures/5.0.0: + /figures@5.0.0: resolution: {integrity: sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==} engines: {node: '>=14'} dependencies: @@ -725,22 +424,7 @@ packages: is-unicode-supported: 1.3.0 dev: true - /fill-range/7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} - engines: {node: '>=8'} - dependencies: - to-regex-range: 5.0.1 - dev: true - - /find-up/6.3.0: - resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - locate-path: 7.2.0 - path-exists: 5.0.0 - dev: true - - /foreground-child/3.1.1: + /foreground-child@3.1.1: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} engines: {node: '>=14'} dependencies: @@ -748,7 +432,7 @@ packages: signal-exit: 4.1.0 dev: true - /fs-extra/11.1.1: + /fs-extra@11.1.1: resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} engines: {node: '>=14.14'} dependencies: @@ -757,24 +441,11 @@ packages: universalify: 2.0.0 dev: true - /fsevents/2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /function-bind/1.1.1: + /function-bind@1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} dev: true - /get-caller-file/2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - dev: true - - /get-intrinsic/1.2.1: + /get-intrinsic@1.2.1: resolution: {integrity: sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==} dependencies: function-bind: 1.1.1 @@ -783,18 +454,11 @@ packages: has-symbols: 1.0.3 dev: true - /git-clone/0.2.0: + /git-clone@0.2.0: resolution: {integrity: sha512-1UAkEPIFbyjHaddljUKvPhhLRnrKaImT71T7rdvSvWLXw95nLdhdi6Qmlx0KOWoV1qqvHGLq5lMLJEZM0JXk8A==} dev: true - /glob-parent/5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - dependencies: - is-glob: 4.0.3 - dev: true - - /glob/10.3.10: + /glob@10.3.10: resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} engines: {node: '>=16 || 14 >=14.17'} hasBin: true @@ -806,77 +470,46 @@ packages: path-scurry: 1.10.1 dev: true - /globby/13.2.2: - resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - dir-glob: 3.0.1 - fast-glob: 3.3.1 - ignore: 5.2.4 - merge2: 1.4.1 - slash: 4.0.0 - dev: true - - /graceful-fs/4.2.11: + /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} dev: true - /has-flag/4.0.0: + /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} dev: true - /has-proto/1.0.1: + /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} dev: true - /has-symbols/1.0.3: + /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} dev: true - /has/1.0.4: + /has@1.0.4: resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} engines: {node: '>= 0.4.0'} dev: true - /iconv-lite/0.4.24: + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} dependencies: safer-buffer: 2.1.2 dev: true - /ieee754/1.2.1: + /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: true - /ignore-by-default/2.1.0: - resolution: {integrity: sha512-yiWd4GVmJp0Q6ghmM2B/V3oZGRmjrKLXvHR3TE1nfoXsmoggllfZUQe74EN0fJdPFZu2NIvNdrMMLm3OsV7Ohw==} - engines: {node: '>=10 <11 || >=12 <13 || >=14'} - dev: true - - /ignore/5.2.4: - resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} - engines: {node: '>= 4'} - dev: true - - /imurmurhash/0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - dev: true - - /indent-string/5.0.0: - resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==} - engines: {node: '>=12'} - dev: true - - /inherits/2.0.4: + /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} dev: true - /inquirer/9.2.11: + /inquirer@9.2.11: resolution: {integrity: sha512-B2LafrnnhbRzCWfAdOXisUzL89Kg8cVJlYmhqoi3flSiV/TveO+nsXwgKr9h9PIo+J1hz7nBSk6gegRIMBBf7g==} engines: {node: '>=14.18.0'} dependencies: @@ -897,83 +530,41 @@ packages: wrap-ansi: 6.2.0 dev: true - /irregular-plurals/3.5.0: - resolution: {integrity: sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==} - engines: {node: '>=8'} - dev: true - - /is-binary-path/2.1.0: - resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} - engines: {node: '>=8'} - dependencies: - binary-extensions: 2.2.0 - dev: true - - /is-error/2.2.2: - resolution: {integrity: sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg==} - dev: true - - /is-extglob/2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - dev: true - - /is-fullwidth-code-point/3.0.0: + /is-fullwidth-code-point@3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} dev: true - /is-fullwidth-code-point/4.0.0: - resolution: {integrity: sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==} - engines: {node: '>=12'} - dev: true - - /is-glob/4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - dependencies: - is-extglob: 2.1.1 - dev: true - - /is-interactive/1.0.0: + /is-interactive@1.0.0: resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} engines: {node: '>=8'} dev: true - /is-interactive/2.0.0: + /is-interactive@2.0.0: resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} engines: {node: '>=12'} dev: true - /is-number/7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - dev: true - - /is-plain-object/5.0.0: + /is-plain-object@5.0.0: resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} engines: {node: '>=0.10.0'} dev: true - /is-promise/4.0.0: - resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} - dev: true - - /is-unicode-supported/0.1.0: + /is-unicode-supported@0.1.0: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} dev: true - /is-unicode-supported/1.3.0: + /is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} engines: {node: '>=12'} dev: true - /isexe/2.0.0: + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true - /jackspeak/2.3.6: + /jackspeak@2.3.6: resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} engines: {node: '>=14'} dependencies: @@ -982,27 +573,14 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true - /js-string-escape/1.0.1: - resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} - engines: {node: '>= 0.8'} - dev: true - - /js-yaml/3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - dev: true - - /js-yaml/4.1.0: + /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true dependencies: argparse: 2.0.1 dev: true - /jsonfile/6.1.0: + /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} dependencies: universalify: 2.0.0 @@ -1010,27 +588,15 @@ packages: graceful-fs: 4.2.11 dev: true - /load-json-file/7.0.1: - resolution: {integrity: sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - - /locate-path/7.2.0: - resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-locate: 6.0.0 - dev: true - - /lodash-es/4.17.21: + /lodash-es@4.17.21: resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} dev: true - /lodash/4.17.21: + /lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} dev: true - /log-symbols/4.1.0: + /log-symbols@4.1.0: resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} engines: {node: '>=10'} dependencies: @@ -1038,7 +604,7 @@ packages: is-unicode-supported: 0.1.0 dev: true - /log-symbols/5.1.0: + /log-symbols@5.1.0: resolution: {integrity: sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==} engines: {node: '>=12'} dependencies: @@ -1046,96 +612,38 @@ packages: is-unicode-supported: 1.3.0 dev: true - /lru-cache/10.0.1: + /lru-cache@10.0.1: resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==} engines: {node: 14 || >=16.14} dev: true - /lru-cache/6.0.0: - resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} - engines: {node: '>=10'} - dependencies: - yallist: 4.0.0 - dev: true - - /map-age-cleaner/0.1.3: - resolution: {integrity: sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==} - engines: {node: '>=6'} - dependencies: - p-defer: 1.0.0 - dev: true - - /matcher/5.0.0: - resolution: {integrity: sha512-s2EMBOWtXFc8dgqvoAzKJXxNHibcdJMV0gwqKUaw9E2JBJuGUK7DrNKrA6g/i+v72TT16+6sVm5mS3thaMLQUw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - escape-string-regexp: 5.0.0 - dev: true - - /md5-hex/3.0.1: - resolution: {integrity: sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==} - engines: {node: '>=8'} - dependencies: - blueimp-md5: 2.19.0 - dev: true - - /mem/9.0.2: - resolution: {integrity: sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==} - engines: {node: '>=12.20'} - dependencies: - map-age-cleaner: 0.1.3 - mimic-fn: 4.0.0 - dev: true - - /merge2/1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - dev: true - - /micromatch/4.0.5: - resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} - engines: {node: '>=8.6'} - dependencies: - braces: 3.0.2 - picomatch: 2.3.1 - dev: true - - /mimic-fn/2.1.0: + /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} dev: true - /mimic-fn/4.0.0: - resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} - engines: {node: '>=12'} - dev: true - - /minimatch/9.0.3: + /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 dev: true - /minipass/7.0.4: + /minipass@7.0.4: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} dev: true - /ms/2.1.2: + /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true - /ms/2.1.3: - resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - dev: true - - /mute-stream/1.0.0: + /mute-stream@1.0.0: resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dev: true - /node-fetch/2.7.0: + /node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} peerDependencies: @@ -1147,30 +655,20 @@ packages: whatwg-url: 5.0.0 dev: true - /nofilter/3.1.0: - resolution: {integrity: sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==} - engines: {node: '>=12.19'} - dev: true - - /normalize-path/3.0.0: - resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} - engines: {node: '>=0.10.0'} - dev: true - - /once/1.4.0: + /once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 dev: true - /onetime/5.1.2: + /onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} dependencies: mimic-fn: 2.1.0 dev: true - /ora/5.4.1: + /ora@5.4.1: resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==} engines: {node: '>=10'} dependencies: @@ -1185,7 +683,7 @@ packages: wcwidth: 1.0.1 dev: true - /ora/7.0.1: + /ora@7.0.1: resolution: {integrity: sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==} engines: {node: '>=16'} dependencies: @@ -1200,65 +698,17 @@ packages: strip-ansi: 7.1.0 dev: true - /os-tmpdir/1.0.2: + /os-tmpdir@1.0.2: resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} engines: {node: '>=0.10.0'} dev: true - /p-defer/1.0.0: - resolution: {integrity: sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==} - engines: {node: '>=4'} - dev: true - - /p-event/5.0.1: - resolution: {integrity: sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-timeout: 5.1.0 - dev: true - - /p-limit/4.0.0: - resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - yocto-queue: 1.0.0 - dev: true - - /p-locate/6.0.0: - resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-limit: 4.0.0 - dev: true - - /p-map/5.5.0: - resolution: {integrity: sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==} - engines: {node: '>=12'} - dependencies: - aggregate-error: 4.0.1 - dev: true - - /p-timeout/5.1.0: - resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} - engines: {node: '>=12'} - dev: true - - /parse-ms/3.0.0: - resolution: {integrity: sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==} - engines: {node: '>=12'} - dev: true - - /path-exists/5.0.0: - resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - - /path-key/3.1.1: + /path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} dev: true - /path-scurry/1.10.1: + /path-scurry@1.10.1: resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} engines: {node: '>=16 || 14 >=14.17'} dependencies: @@ -1266,43 +716,7 @@ packages: minipass: 7.0.4 dev: true - /path-type/4.0.0: - resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} - engines: {node: '>=8'} - dev: true - - /picomatch/2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - dev: true - - /pkg-conf/4.0.0: - resolution: {integrity: sha512-7dmgi4UY4qk+4mj5Cd8v/GExPo0K+SlY+hulOSdfZ/T6jVH6//y7NtzZo5WrfhDBxuQ0jCa7fLZmNaNh7EWL/w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - find-up: 6.3.0 - load-json-file: 7.0.1 - dev: true - - /plur/5.1.0: - resolution: {integrity: sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - irregular-plurals: 3.5.0 - dev: true - - /pretty-ms/8.0.0: - resolution: {integrity: sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==} - engines: {node: '>=14.16'} - dependencies: - parse-ms: 3.0.0 - dev: true - - /queue-microtask/1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - dev: true - - /readable-stream/3.6.2: + /readable-stream@3.6.2: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} dependencies: @@ -1311,31 +725,7 @@ packages: util-deprecate: 1.0.2 dev: true - /readdirp/3.6.0: - resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} - engines: {node: '>=8.10.0'} - dependencies: - picomatch: 2.3.1 - dev: true - - /require-directory/2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - dev: true - - /resolve-cwd/3.0.0: - resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} - engines: {node: '>=8'} - dependencies: - resolve-from: 5.0.0 - dev: true - - /resolve-from/5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - dev: true - - /restore-cursor/3.1.0: + /restore-cursor@3.1.0: resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} engines: {node: '>=8'} dependencies: @@ -1343,7 +733,7 @@ packages: signal-exit: 3.0.7 dev: true - /restore-cursor/4.0.0: + /restore-cursor@4.0.0: resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: @@ -1351,12 +741,7 @@ packages: signal-exit: 3.0.7 dev: true - /reusify/1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - dev: true - - /rimraf/5.0.5: + /rimraf@5.0.5: resolution: {integrity: sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==} engines: {node: '>=14'} hasBin: true @@ -1364,99 +749,54 @@ packages: glob: 10.3.10 dev: true - /run-async/3.0.0: + /run-async@3.0.0: resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==} engines: {node: '>=0.12.0'} dev: true - /run-parallel/1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - dependencies: - queue-microtask: 1.2.3 - dev: true - - /rxjs/7.8.1: + /rxjs@7.8.1: resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} dependencies: tslib: 2.6.2 dev: true - /safe-buffer/5.2.1: + /safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} dev: true - /safer-buffer/2.1.2: + /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: true - /semver/7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - dev: true - - /serialize-error/7.0.1: - resolution: {integrity: sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==} - engines: {node: '>=10'} - dependencies: - type-fest: 0.13.1 - dev: true - - /shebang-command/2.0.0: + /shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} dependencies: shebang-regex: 3.0.0 dev: true - /shebang-regex/3.0.0: + /shebang-regex@3.0.0: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} dev: true - /signal-exit/3.0.7: + /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true - /signal-exit/4.1.0: + /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} dev: true - /slash/4.0.0: - resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} - engines: {node: '>=12'} - dev: true - - /slice-ansi/5.0.0: - resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==} - engines: {node: '>=12'} - dependencies: - ansi-styles: 6.2.1 - is-fullwidth-code-point: 4.0.0 - dev: true - - /sprintf-js/1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - dev: true - - /stack-utils/2.0.6: - resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} - engines: {node: '>=10'} - dependencies: - escape-string-regexp: 2.0.0 - dev: true - - /stdin-discarder/0.1.0: + /stdin-discarder@0.1.0: resolution: {integrity: sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: bl: 5.1.0 dev: true - /string-width/4.2.3: + /string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} dependencies: @@ -1465,7 +805,7 @@ packages: strip-ansi: 6.0.1 dev: true - /string-width/5.1.2: + /string-width@5.1.2: resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} engines: {node: '>=12'} dependencies: @@ -1474,7 +814,7 @@ packages: strip-ansi: 7.1.0 dev: true - /string-width/6.1.0: + /string-width@6.1.0: resolution: {integrity: sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==} engines: {node: '>=16'} dependencies: @@ -1483,125 +823,88 @@ packages: strip-ansi: 7.1.0 dev: true - /string_decoder/1.3.0: + /string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: safe-buffer: 5.2.1 dev: true - /strip-ansi/6.0.1: + /strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} dependencies: ansi-regex: 5.0.1 dev: true - /strip-ansi/7.1.0: + /strip-ansi@7.1.0: resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} engines: {node: '>=12'} dependencies: ansi-regex: 6.0.1 dev: true - /supertap/3.0.1: - resolution: {integrity: sha512-u1ZpIBCawJnO+0QePsEiOknOfCRq0yERxiAchT0i4li0WHNUJbf0evXXSXOcCAR4M8iMDoajXYmstm/qO81Isw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - indent-string: 5.0.0 - js-yaml: 3.14.1 - serialize-error: 7.0.1 - strip-ansi: 7.1.0 - dev: true - - /supports-color/7.2.0: + /supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} dependencies: has-flag: 4.0.0 dev: true - /temp-dir/3.0.0: - resolution: {integrity: sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==} - engines: {node: '>=14.16'} - dev: true - - /time-zone/1.0.0: - resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==} - engines: {node: '>=4'} - dev: true - - /tmp/0.0.33: + /tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} dependencies: os-tmpdir: 1.0.2 dev: true - /to-regex-range/5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - dependencies: - is-number: 7.0.0 - dev: true - - /tr46/0.0.3: + /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: true - /tslib/2.6.2: + /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: true - /typanion/3.14.0: + /typanion@3.14.0: resolution: {integrity: sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==} dev: true - /type-fest/0.13.1: - resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} - engines: {node: '>=10'} - dev: true - - /type-fest/0.21.3: + /type-fest@0.21.3: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} dev: true - /universal-user-agent/6.0.0: + /universal-user-agent@6.0.0: resolution: {integrity: sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==} dev: true - /universalify/2.0.0: + /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} dev: true - /util-deprecate/1.0.2: + /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true - /wcwidth/1.0.1: + /wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} dependencies: defaults: 1.0.4 dev: true - /webidl-conversions/3.0.1: + /webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} dev: true - /well-known-symbols/2.0.0: - resolution: {integrity: sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==} - engines: {node: '>=6'} - dev: true - - /whatwg-url/5.0.0: + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 dev: true - /which/2.0.2: + /which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} hasBin: true @@ -1609,7 +912,7 @@ packages: isexe: 2.0.0 dev: true - /wrap-ansi/6.2.0: + /wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} dependencies: @@ -1618,7 +921,7 @@ packages: strip-ansi: 6.0.1 dev: true - /wrap-ansi/7.0.0: + /wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} dependencies: @@ -1627,7 +930,7 @@ packages: strip-ansi: 6.0.1 dev: true - /wrap-ansi/8.1.0: + /wrap-ansi@8.1.0: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} dependencies: @@ -1636,46 +939,6 @@ packages: strip-ansi: 7.1.0 dev: true - /wrappy/1.0.2: + /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} dev: true - - /write-file-atomic/5.0.1: - resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dependencies: - imurmurhash: 0.1.4 - signal-exit: 4.1.0 - dev: true - - /y18n/5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - dev: true - - /yallist/4.0.0: - resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true - - /yargs-parser/21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - dev: true - - /yargs/17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} - dependencies: - cliui: 8.0.1 - escalade: 3.1.1 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 21.1.1 - dev: true - - /yocto-queue/1.0.0: - resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} - engines: {node: '>=12.20'} - dev: true diff --git a/scripts/clone-rspack.mjs b/scripts/clone-rspack.mjs index cdd4d34..f4c5d9d 100644 --- a/scripts/clone-rspack.mjs +++ b/scripts/clone-rspack.mjs @@ -5,7 +5,7 @@ import fse from 'fs-extra'; const REPO = 'git@github.com:web-infra-dev/rspack.git'; const DEST = 'crates/.rspack_crates/'; -const CEHECKOUT = 'v0.3.6'; +const CEHECKOUT = 'main'; function createSpinner( text, From 0650d4da1c54e1f3ceb4ba33393515e0ea5b8f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E5=B0=98?= Date: Mon, 30 Oct 2023 18:00:50 +0800 Subject: [PATCH 05/18] chore: deprecate built in react refresh --- crates/binding_options/Cargo.toml | 1 - crates/binding_options/src/options/raw_module.rs | 5 ----- 2 files changed, 6 deletions(-) diff --git a/crates/binding_options/Cargo.toml b/crates/binding_options/Cargo.toml index 6f13b5a..d3464bc 100644 --- a/crates/binding_options/Cargo.toml +++ b/crates/binding_options/Cargo.toml @@ -10,7 +10,6 @@ rspack_core = { path = "../.rspack_crates/rspack_cor rspack_error = { path = "../.rspack_crates/rspack_error" } rspack_identifier = { path = "../.rspack_crates/rspack_identifier" } rspack_ids = { path = "../.rspack_crates/rspack_ids" } -rspack_loader_react_refresh = { path = "../.rspack_crates/rspack_loader_react_refresh" } rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" } rspack_loader_sass = { path = "../.rspack_crates/rspack_loader_sass" } rspack_loader_swc = { path = "../.rspack_crates/rspack_loader_swc" } diff --git a/crates/binding_options/src/options/raw_module.rs b/crates/binding_options/src/options/raw_module.rs index 4cc8e18..74ae56b 100644 --- a/crates/binding_options/src/options/raw_module.rs +++ b/crates/binding_options/src/options/raw_module.rs @@ -24,11 +24,6 @@ pub fn get_builtin_loader(builtin: &str, options: Option<&str>) -> BoxLoader { .with_identifier(builtin.into()), ); } - if builtin.starts_with(REACT_REFRESH_LOADER_IDENTIFIER) { - return Arc::new( - rspack_loader_react_refresh::ReactRefreshLoader::default().with_identifier(builtin.into()), - ); - } if builtin.starts_with(COMPILATION_LOADER_IDENTIFIER) { return Arc::new( From e0f374d4ca10f480849c0b093b070382b78cab98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E5=B0=98?= Date: Tue, 31 Oct 2023 17:27:28 +0800 Subject: [PATCH 06/18] feat: loader structure --- crates/loader_compilation/Cargo.toml | 3 + crates/loader_compilation/src/compiler.rs | 262 ++++++++++++++++++ crates/loader_compilation/src/lib.rs | 98 ++++--- .../src/transform/keep_export.rs | 0 .../src/transform/remove_export.rs | 0 5 files changed, 325 insertions(+), 38 deletions(-) create mode 100644 crates/loader_compilation/src/compiler.rs create mode 100644 crates/loader_compilation/src/transform/keep_export.rs create mode 100644 crates/loader_compilation/src/transform/remove_export.rs diff --git a/crates/loader_compilation/Cargo.toml b/crates/loader_compilation/Cargo.toml index 94e1198..7a825a6 100644 --- a/crates/loader_compilation/Cargo.toml +++ b/crates/loader_compilation/Cargo.toml @@ -8,11 +8,14 @@ edition = "2021" [dependencies] anyhow = { workspace = true } async-trait = { workspace = true } +dashmap = { workspace = true } either = "1" once_cell = { workspace = true } +rspack_ast = { path = "../.rspack_crates/rspack_ast" } rspack_core = { path = "../.rspack_crates/rspack_core" } rspack_error = { path = "../.rspack_crates/rspack_error" } rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" } +rspack_plugin_javascript = { path = "../.rspack_crates/rspack_plugin_javascript" } serde = { workspace = true, features = ["derive"] } serde_json = "1.0.100" swc_config = { workspace = true } diff --git a/crates/loader_compilation/src/compiler.rs b/crates/loader_compilation/src/compiler.rs new file mode 100644 index 0000000..f8a91a3 --- /dev/null +++ b/crates/loader_compilation/src/compiler.rs @@ -0,0 +1,262 @@ +use std::env; +use std::{path::PathBuf, sync::Arc}; +use anyhow::{Context, Error}; +use dashmap::DashMap; +use rspack_ast::javascript::{Ast as JsAst, Context as JsAstContext, Program as JsProgram}; +use swc_core:: { + base::{ + config::{Options, JsMinifyCommentOption, BuiltInput, IsModule}, + try_with_handler, SwcComments + }, + common::{ + Globals, SourceFile, SourceMap, GLOBALS, Mark, FileName, FilePathMapping, BytePos, + comments::{SingleThreadedComments, Comments, Comment, CommentKind}, + errors::{Handler, HANDLER}, + }, + ecma::{transforms::base::helpers::{self, Helpers}, ast::{Program, EsVersion}, visit::{Fold, FoldWith}, + parser::{parse_file_as_module, Syntax, parse_file_as_script, parse_file_as_program}}, +}; +use swc_config::config_types::BoolOr; + +fn minify_file_comments( + comments: &SingleThreadedComments, + preserve_comments: BoolOr, +) { + match preserve_comments { + BoolOr::Bool(true) | BoolOr::Data(JsMinifyCommentOption::PreserveAllComments) => {} + + BoolOr::Data(JsMinifyCommentOption::PreserveSomeComments) => { + let preserve_excl = |_: &BytePos, vc: &mut Vec| -> bool { + // Preserve license comments. + // + // See https://github.com/terser/terser/blob/798135e04baddd94fea403cfaab4ba8b22b1b524/lib/output.js#L175-L181 + vc.retain(|c: &Comment| { + c.text.contains("@lic") + || c.text.contains("@preserve") + || c.text.contains("@copyright") + || c.text.contains("@cc_on") + || (c.kind == CommentKind::Block && c.text.starts_with('!')) + }); + !vc.is_empty() + }; + let (mut l, mut t) = comments.borrow_all_mut(); + + l.retain(preserve_excl); + t.retain(preserve_excl); + } + + BoolOr::Bool(false) => { + let (mut l, mut t) = comments.borrow_all_mut(); + l.clear(); + t.clear(); + } + } +} + +pub(crate) struct SwcCompiler { + cm: Arc, + fm: Arc, + comments: SingleThreadedComments, + options: Options, + globals: Globals, + helpers: Helpers, +} + +impl SwcCompiler { + pub fn new(resource_path: PathBuf, source: String, mut options: Options) -> Result { + let cm = Arc::new(SourceMap::new(FilePathMapping::empty())); + let globals = Globals::default(); + GLOBALS.set(&globals, || { + let top_level_mark = Mark::new(); + let unresolved_mark = Mark::new(); + options.top_level_mark = Some(top_level_mark); + options.unresolved_mark = Some(unresolved_mark); + }); + // TODO: support read config of .swcrc. + let fm = cm.new_source_file(FileName::Real(resource_path), source); + let comments = SingleThreadedComments::default(); + let helpers = GLOBALS.set(&globals, || { + let external_helpers = options.config.jsc.external_helpers; + Helpers::new(external_helpers.into()) + }); + + Ok(Self { + cm, + fm, + comments, + options, + globals, + helpers, + }) + } + + pub fn run(&self, op: impl FnOnce() -> R) -> R { + GLOBALS.set(&self.globals, op) + } + + fn parse_js( + &self, + fm: Arc, + handler: &Handler, + target: EsVersion, + syntax: Syntax, + is_module: IsModule, + comments: Option<&dyn Comments>, + ) -> Result { + let mut error = false; + let mut errors = vec![]; + + let program_result = match is_module { + IsModule::Bool(true) => { + parse_file_as_module(&fm, syntax, target, comments, &mut errors).map(Program::Module) + } + IsModule::Bool(false) => { + parse_file_as_script(&fm, syntax, target, comments, &mut errors).map(Program::Script) + } + IsModule::Unknown => parse_file_as_program(&fm, syntax, target, comments, &mut errors), + }; + + for e in errors { + e.into_diagnostic(handler).emit(); + error = true; + } + + let mut res = program_result.map_err(|e| { + e.into_diagnostic(handler).emit(); + Error::msg("Syntax Error") + }); + + if error { + return Err(anyhow::anyhow!("Syntax Error")); + } + + if env::var("SWC_DEBUG").unwrap_or_default() == "1" { + res = res.with_context(|| format!("Parser config: {:?}", syntax)); + } + + res + + } + + pub fn parse<'a, P>( + &'a self, + program: Option, + before_pass: impl FnOnce(&Program) -> P + 'a, + ) -> Result, Error> + where + P: Fold + 'a, + { + let built = self.run(|| { + try_with_handler(self.cm.clone(), Default::default(), |handler| { + let built = self.options.build_as_input( + &self.cm, + &self.fm.name, + move |syntax, target, is_module| match program { + Some(v) => Ok(v), + _ => self.parse_js( + self.fm.clone(), + handler, + target, + syntax, + is_module, + Some(&self.comments), + ), + }, + self.options.output_path.as_deref(), + self.options.source_file_name.clone(), + handler, + // TODO: support config file. + Some(self.options.config.clone()), + Some(&self.comments), + before_pass, + )?; + + Ok(Some(built)) + }) + })?; + + match built { + Some(v) => Ok(v), + None => { + anyhow::bail!("cannot process file because it's ignored by .swcrc") + } + } + } + + pub fn transform(&self, config: BuiltInput) -> Result { + let program = config.program; + let mut pass = config.pass; + + let program = self.run(|| { + helpers::HELPERS.set(&self.helpers, || { + try_with_handler(self.cm.clone(), Default::default(), |handler| { + HANDLER.set(handler, || { + // Fold module + Ok(program.fold_with(&mut pass)) + }) + }) + }) + }); + if let Some(comments) = &config.comments { + minify_file_comments(comments, config.preserve_comments); + }; + + program + } + + pub fn comments(&self) -> &SingleThreadedComments { + &self.comments + } + + pub fn options(&self) -> &Options { + &self.options + } + + pub fn cm(&self) -> &Arc { + &self.cm + } +} + +pub(crate) trait IntoJsAst { + fn into_js_ast(self, program: Program) -> JsAst; +} + +impl IntoJsAst for SwcCompiler { + fn into_js_ast(self, program: Program) -> JsAst { + JsAst::default() + .with_program(JsProgram::new( + program, + Some(self.comments.into_swc_comments()), + )) + .with_context(JsAstContext { + globals: self.globals, + helpers: self.helpers, + source_map: self.cm, + top_level_mark: self + .options + .top_level_mark + .expect("`top_level_mark` should be initialized"), + unresolved_mark: self + .options + .unresolved_mark + .expect("`unresolved_mark` should be initialized"), + }) + } +} + +trait IntoSwcComments { + fn into_swc_comments(self) -> SwcComments; +} + +impl IntoSwcComments for SingleThreadedComments { + fn into_swc_comments(self) -> SwcComments { + let (l, t) = { + let (l, t) = self.take_all(); + (l.take(), t.take()) + }; + SwcComments { + leading: Arc::new(DashMap::from_iter(l.into_iter())), + trailing: Arc::new(DashMap::from_iter(t.into_iter())), + } + } +} \ No newline at end of file diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index 4f61f07..ad1f6f1 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -1,21 +1,19 @@ -use std::sync::Arc; -use rspack_core::{rspack_sources::SourceMap, LoaderRunnerContext, Mode}; +use rspack_ast::RspackAst; +use rspack_core::{rspack_sources::SourceMap, LoaderRunnerContext}; use rspack_loader_runner::{Identifiable, Identifier, Loader, LoaderContext}; use rspack_error::{ - internal_error, Diagnostic, DiagnosticKind, Error, InternalError, Result, Severity, - TraceableError, + internal_error, Result, }; -use swc_core::{ - base::{ - Compiler, - config::{InputSourceMap, Options}, - try_with_handler - }, - common::{FilePathMapping,GLOBALS, FileName, comments::SingleThreadedComments}, - ecma::transforms::base::pass::noop +use swc_core::base::config::{InputSourceMap, Options, OutputCharset}; +use rspack_plugin_javascript::{ + ast::{self, SourceMapConfig}, + TransformOutput, }; +mod compiler; mod transform; + use transform::*; +use compiler::{SwcCompiler, IntoJsAst}; pub struct CompilationLoader { identifier: Identifier, } @@ -43,8 +41,6 @@ impl Loader for CompilationLoader { let Some(content) = std::mem::take(&mut loader_context.content) else { return Err(internal_error!("No content found")); }; - - let compiler = Compiler::new(Arc::from(swc_core::common::SourceMap::new(FilePathMapping::empty()))); // TODO: init loader with custom options. let mut swc_options = Options::default(); @@ -56,31 +52,57 @@ impl Loader for CompilationLoader { } } - GLOBALS.set(&Default::default(), || { - try_with_handler(compiler.cm.clone(), Default::default(), |handler| { - compiler.run(|| { - let content = content.try_into_string()?; - let fm = compiler.cm.new_source_file(FileName::Real(resource_path.clone()), content.clone()); - let comments = SingleThreadedComments::default(); - let transform_options = SwcPluginOptions { - keep_export: None, - remove_export: None, - }; - let out = compiler.process_js_with_custom_pass( - fm, - None, - handler, - &swc_options, - comments, |_| { - transform(transform_options) - }, - |_| noop(), - )?; - Ok(()) - }) - }) + let devtool = &loader_context.context.options.devtool; + let source = content.try_into_string()?; + let compiler = SwcCompiler::new(resource_path.clone(), source.clone(), swc_options)?; + + let transform_options = SwcPluginOptions { + keep_export: None, + remove_export: None, + }; + let built = compiler.parse(None, |_| { + transform(transform_options) })?; - + + let codegen_options = ast::CodegenOptions { + target: Some(built.target), + minify: Some(built.minify), + ascii_only: built + .output + .charset + .as_ref() + .map(|v| matches!(v, OutputCharset::Ascii)), + source_map_config: SourceMapConfig { + enable: devtool.source_map(), + inline_sources_content: true, + emit_columns: !devtool.cheap(), + names: Default::default(), + }, + keep_comments: Some(true), + }; + let program = compiler.transform(built)?; + let ast = compiler.into_js_ast(program); + + // If swc-loader is the latest loader available, + // then loader produces AST, which could be used as an optimization. + if loader_context.loader_index() == 0 + && (loader_context + .current_loader() + .composed_index_by_identifier(&self.identifier) + .map(|idx| idx == 0) + .unwrap_or(true)) + { + loader_context + .additional_data + .insert(RspackAst::JavaScript(ast)); + loader_context.additional_data.insert(codegen_options); + loader_context.content = Some("".to_owned().into()) + } else { + let TransformOutput { code, map } = ast::stringify(&ast, codegen_options)?; + loader_context.content = Some(code.into()); + loader_context.source_map = map.map(|m| SourceMap::from_json(&m)).transpose()?; + } + Ok(()) } } diff --git a/crates/loader_compilation/src/transform/keep_export.rs b/crates/loader_compilation/src/transform/keep_export.rs new file mode 100644 index 0000000..e69de29 diff --git a/crates/loader_compilation/src/transform/remove_export.rs b/crates/loader_compilation/src/transform/remove_export.rs new file mode 100644 index 0000000..e69de29 From f75281009d10b012442a2bb38f4fe2f5cef882ca Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Tue, 31 Oct 2023 17:34:21 +0800 Subject: [PATCH 07/18] fix: update loader test case --- crates/loader_compilation/tests/fixtures.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/loader_compilation/tests/fixtures.rs b/crates/loader_compilation/tests/fixtures.rs index d99f90b..b6c9d18 100644 --- a/crates/loader_compilation/tests/fixtures.rs +++ b/crates/loader_compilation/tests/fixtures.rs @@ -1,14 +1,23 @@ use std::{str::FromStr,env, fs,path::{Path, PathBuf}, sync::Arc}; use loader_compilation::CompilationLoader; -use rspack_core::{run_loaders, CompilerContext, CompilerOptions, SideEffectOption}; -use rspack_loader_runner::ResourceData; +use rspack_core::{ + run_loaders, CompilerContext, CompilerOptions, Loader, LoaderRunnerContext, ResourceData, SideEffectOption, +}; +use serde_json::json; +use swc_core::base::config::{PluginConfig, Config}; async fn loader_test(actual: impl AsRef, expected: impl AsRef) { let tests_path = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"))).join("tests"); - let actual_path = tests_path.join(actual); let expected_path = tests_path.join(expected); + let actual_path = tests_path.join(actual); + let plugin_path = tests_path.join("my_first_plugin.wasm"); + let mut options = Config::default(); + options.jsc.experimental.plugins = Some(vec![PluginConfig( + plugin_path.to_string_lossy().to_string(), + json!(null), + )]); let (result, _) = run_loaders( - &[Arc::new(CompilationLoader::default())], + &[Arc::new(CompilationLoader::new(options)) as Arc>], &ResourceData::new(actual_path.to_string_lossy().to_string(), actual_path), &[], CompilerContext { @@ -71,11 +80,12 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { side_effects: SideEffectOption::False, provided_exports: Default::default(), used_exports: Default::default(), + inner_graph: Default::default(), }, profile: false, }), resolver_factory: Default::default(), - } + }, ) .await .expect("TODO:") From 408a4dae194b5ab009f5e80ad161c97cd5bdaa41 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Tue, 31 Oct 2023 17:55:03 +0800 Subject: [PATCH 08/18] fix: impl new --- crates/binding_options/src/options/raw_module.rs | 2 +- crates/loader_compilation/src/lib.rs | 6 ++---- crates/loader_compilation/tests/fixtures.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/binding_options/src/options/raw_module.rs b/crates/binding_options/src/options/raw_module.rs index 74ae56b..9b909d5 100644 --- a/crates/binding_options/src/options/raw_module.rs +++ b/crates/binding_options/src/options/raw_module.rs @@ -27,7 +27,7 @@ pub fn get_builtin_loader(builtin: &str, options: Option<&str>) -> BoxLoader { if builtin.starts_with(COMPILATION_LOADER_IDENTIFIER) { return Arc::new( - loader_compilation::CompilationLoader::default().with_identifier(builtin.into()), + loader_compilation::CompilationLoader::new().with_identifier(builtin.into()), ); } diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index ad1f6f1..617b2b4 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -18,15 +18,13 @@ pub struct CompilationLoader { identifier: Identifier, } -impl Default for CompilationLoader { - fn default() -> Self { +impl CompilationLoader { + pub fn new() -> Self { Self { identifier: COMPILATION_LOADER_IDENTIFIER.into(), } } -} -impl CompilationLoader { pub fn with_identifier(mut self, identifier: Identifier) -> Self { assert!(identifier.starts_with(COMPILATION_LOADER_IDENTIFIER)); self.identifier = identifier; diff --git a/crates/loader_compilation/tests/fixtures.rs b/crates/loader_compilation/tests/fixtures.rs index b6c9d18..efb3880 100644 --- a/crates/loader_compilation/tests/fixtures.rs +++ b/crates/loader_compilation/tests/fixtures.rs @@ -17,7 +17,7 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { json!(null), )]); let (result, _) = run_loaders( - &[Arc::new(CompilationLoader::new(options)) as Arc>], + &[Arc::new(CompilationLoader::new()) as Arc>], &ResourceData::new(actual_path.to_string_lossy().to_string(), actual_path), &[], CompilerContext { From 6fe41befa86241637559850c30b18eb3c84a7672 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 2 Nov 2023 15:40:45 +0800 Subject: [PATCH 09/18] feat: add tranform chain of remove exports and keep exports --- crates/loader_compilation/Cargo.toml | 1 + crates/loader_compilation/src/lib.rs | 8 +- .../src/transform/keep_export.rs | 589 ++++++++++++++++++ .../loader_compilation/src/transform/mod.rs | 38 +- .../src/transform/remove_export.rs | 586 +++++++++++++++++ crates/loader_compilation/tests/fixtures.rs | 6 +- .../tests/fixtures/basic/input.js | 7 + 7 files changed, 1206 insertions(+), 29 deletions(-) diff --git a/crates/loader_compilation/Cargo.toml b/crates/loader_compilation/Cargo.toml index 7a825a6..4e519ce 100644 --- a/crates/loader_compilation/Cargo.toml +++ b/crates/loader_compilation/Cargo.toml @@ -10,6 +10,7 @@ anyhow = { workspace = true } async-trait = { workspace = true } dashmap = { workspace = true } either = "1" +fxhash= "0.2.1" once_cell = { workspace = true } rspack_ast = { path = "../.rspack_crates/rspack_ast" } rspack_core = { path = "../.rspack_crates/rspack_core" } diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index 617b2b4..fde47b2 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -55,8 +55,12 @@ impl Loader for CompilationLoader { let compiler = SwcCompiler::new(resource_path.clone(), source.clone(), swc_options)?; let transform_options = SwcPluginOptions { - keep_export: None, - remove_export: None, + keep_export: Some(KeepExportOptions { + export_names: vec!["default".to_string()], + }), + remove_export: Some(RemoveExportOptions { + remove_names: vec!["default".to_string()], + }), }; let built = compiler.parse(None, |_| { transform(transform_options) diff --git a/crates/loader_compilation/src/transform/keep_export.rs b/crates/loader_compilation/src/transform/keep_export.rs index e69de29..1d23124 100644 --- a/crates/loader_compilation/src/transform/keep_export.rs +++ b/crates/loader_compilation/src/transform/keep_export.rs @@ -0,0 +1,589 @@ +// transform code is modified based on swc plugin of keep_export: +// https://github.com/ice-lab/swc-plugins/tree/main/packages/keep-export +use fxhash::FxHashSet; +use std::mem::take; +use swc_core::ecma::{ + ast::*, + visit::{Fold, FoldWith, noop_fold_type}, +}; +use swc_core::common::{ + DUMMY_SP, pass::{Repeat, Repeated} +}; + +/// State of the transforms. Shared by the analyzer and the transform. +#[derive(Debug, Default)] +struct State { + /// Identifiers referenced by other functions. + /// + /// Cleared before running each pass, because we drop ast nodes between the + /// passes. + refs_from_other: FxHashSet, + + /// Identifiers referenced by kept functions or derivatives. + /// + /// Preserved between runs, because we should remember derivatives of data + /// functions as the data function itself is already removed. + refs_used: FxHashSet, + + should_run_again: bool, + keep_exports: Vec, +} + +impl State { + fn should_keep_identifier(&mut self, i: &Ident) -> bool { + self.keep_exports.contains(&String::from(&*i.sym)) + } + + fn should_keep_default(&mut self) -> bool { + self.keep_exports.contains(&String::from("default")) + } +} + +struct KeepExport { + pub state: State, + in_lhs_of_var: bool, +} + +impl KeepExport { + fn should_remove(&self, id: Id) -> bool { + !self.state.refs_used.contains(&id) && !self.state.refs_from_other.contains(&id) + } + + /// Mark identifiers in `n` as a candidate for removal. + fn mark_as_candidate(&mut self, n: N) -> N + where + N: for<'a> FoldWith>, + { + // Analyzer never change `in_kept_fn` to false, so all identifiers in `n` will + // be marked as referenced from a data function. + let mut v = Analyzer { + state: &mut self.state, + in_lhs_of_var: false, + in_kept_fn: false, + }; + + let n = n.fold_with(&mut v); + self.state.should_run_again = true; + n + } +} + +impl Repeated for KeepExport { + fn changed(&self) -> bool { + self.state.should_run_again + } + + fn reset(&mut self) { + self.state.refs_from_other.clear(); + self.state.should_run_again = false; + } +} + +impl Fold for KeepExport { + // This is important for reducing binary sizes. + noop_fold_type!(); + + // Remove import expression + fn fold_import_decl(&mut self, mut i: ImportDecl) -> ImportDecl { + // Imports for side effects. + if i.specifiers.is_empty() { + return i; + } + + i.specifiers.retain(|s| match s { + ImportSpecifier::Named(ImportNamedSpecifier { local, .. }) + | ImportSpecifier::Default(ImportDefaultSpecifier { local, .. }) + | ImportSpecifier::Namespace(ImportStarAsSpecifier { local, .. }) => { + if self.should_remove(local.to_id()) { + self.state.should_run_again = true; + false + } else { + true + } + } + }); + + i + } + + fn fold_module(&mut self, mut m: Module) -> Module { + { + // Fill the state. + let mut v = Analyzer { + state: &mut self.state, + in_lhs_of_var: false, + in_kept_fn: false, + }; + m = m.fold_with(&mut v); + } + + m.fold_children_with(self) + } + + fn fold_module_items(&mut self, mut items: Vec) -> Vec { + items = items.fold_children_with(self); + + // Drop nodes. + items.retain(|s| !matches!(s, ModuleItem::Stmt(Stmt::Empty(..)))); + + // If all exports are deleted, return the empty named export. + if items.len() == 0 { + items.push(ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport{ + span: DUMMY_SP, + specifiers: Vec::new(), + src: None, + type_only: false, + with: Default::default(), + }))); + } + + items + } + + fn fold_module_item(&mut self, i: ModuleItem) -> ModuleItem { + if let ModuleItem::ModuleDecl(ModuleDecl::Import(i)) = i { + let i = i.fold_with(self); + + if i.specifiers.is_empty() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + + return ModuleItem::ModuleDecl(ModuleDecl::Import(i)); + } + + let i = i.fold_children_with(self); + + match &i { + ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)) if e.specifiers.is_empty() => { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) + } + _ => {} + } + + i + } + + fn fold_named_export(&mut self, mut n: NamedExport) -> NamedExport { + n.specifiers = n.specifiers.fold_with(self); + + n.specifiers.retain(|s| { + let preserve = match s { + ExportSpecifier::Namespace(ExportNamespaceSpecifier { + name: ModuleExportName::Ident(exported), + .. + }) + | ExportSpecifier::Default(ExportDefaultSpecifier { exported, .. }) + | ExportSpecifier::Named(ExportNamedSpecifier { + exported: Some(ModuleExportName::Ident(exported)), + .. + }) => self + .state + .should_keep_identifier(exported), + ExportSpecifier::Named(ExportNamedSpecifier { + orig: ModuleExportName::Ident(orig), + .. + }) => self + .state + .should_keep_identifier(orig), + _ => false, + }; + + match preserve { + false => { + if let ExportSpecifier::Named(ExportNamedSpecifier { + orig: ModuleExportName::Ident(_orig), + .. + }) = s + { + self.state.should_run_again = true; + } + + false + } + true => true, + } + }); + + n + } + + /// This methods returns [Pat::Invalid] if the pattern should be removed. + fn fold_pat(&mut self, mut p: Pat) -> Pat { + p = p.fold_children_with(self); + + if self.in_lhs_of_var { + match &mut p { + Pat::Ident(name) => { + if self.should_remove(name.id.to_id()) { + self.state.should_run_again = true; + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + Pat::Array(arr) => { + if !arr.elems.is_empty() { + arr.elems.retain(|e| !matches!(e, Some(Pat::Invalid(..)))); + + if arr.elems.is_empty() { + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + } + Pat::Object(obj) => { + if !obj.props.is_empty() { + obj.props = take(&mut obj.props) + .into_iter() + .filter_map(|prop| match prop { + ObjectPatProp::KeyValue(prop) => { + if prop.value.is_invalid() { + None + } else { + Some(ObjectPatProp::KeyValue(prop)) + } + } + ObjectPatProp::Assign(prop) => { + if self.should_remove(prop.key.to_id()) { + self.mark_as_candidate(prop.value); + + None + } else { + Some(ObjectPatProp::Assign(prop)) + } + } + ObjectPatProp::Rest(prop) => { + if prop.arg.is_invalid() { + None + } else { + Some(ObjectPatProp::Rest(prop)) + } + } + }) + .collect(); + + if obj.props.is_empty() { + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + } + Pat::Rest(rest) => { + if rest.arg.is_invalid() { + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + _ => {} + } + } + + p + } + + #[allow(clippy::single_match)] + fn fold_stmt(&mut self, mut s: Stmt) -> Stmt { + match s { + Stmt::Decl(Decl::Fn(f)) => { + if self.should_remove(f.ident.to_id()) { + self.mark_as_candidate(f.function); + return Stmt::Empty(EmptyStmt { span: DUMMY_SP }); + } + + s = Stmt::Decl(Decl::Fn(f)); + } + Stmt::Decl(Decl::Class(c)) => { + if self.should_remove(c.ident.to_id()) { + self.mark_as_candidate(c.class); + return Stmt::Empty(EmptyStmt { span: DUMMY_SP }); + } + + s = Stmt::Decl(Decl::Class(c)); + } + _ => {} + } + + let s = s.fold_children_with(self); + match s { + Stmt::Decl(Decl::Var(v)) if v.decls.is_empty() => { + return Stmt::Empty(EmptyStmt { span: DUMMY_SP }); + } + _ => {} + } + + s + } + + /// This method make `name` of [VarDeclarator] to [Pat::Invalid] if it + /// should be removed. + fn fold_var_declarator(&mut self, mut d: VarDeclarator) -> VarDeclarator { + let old = self.in_lhs_of_var; + self.in_lhs_of_var = true; + let name = d.name.fold_with(self); + + self.in_lhs_of_var = false; + if name.is_invalid() { + d.init = self.mark_as_candidate(d.init); + } + let init = d.init.fold_with(self); + self.in_lhs_of_var = old; + + VarDeclarator { name, init, ..d } + } + + fn fold_var_declarators(&mut self, mut decls: Vec) -> Vec { + decls = decls.fold_children_with(self); + decls.retain(|d| !d.name.is_invalid()); + + decls + } +} + +struct Analyzer<'a> { + state: &'a mut State, + in_lhs_of_var: bool, + in_kept_fn: bool, +} + +impl Analyzer<'_> { + fn add_ref(&mut self, id: Id) { + if self.in_kept_fn { + self.state.refs_used.insert(id); + } else { + self.state.refs_from_other.insert(id); + } + } + + fn check_default>(&mut self, e: T) -> T { + if self.state.should_keep_default() { + let old_in_kept = self.in_kept_fn; + self.in_kept_fn = true; + let e = e.fold_children_with(self); + self.in_kept_fn = old_in_kept; + return e + } + + return e; + } +} + +impl Fold for Analyzer<'_> { + // This is important for reducing binary sizes. + noop_fold_type!(); + + fn fold_binding_ident(&mut self, i: BindingIdent) -> BindingIdent { + if !self.in_lhs_of_var || self.in_kept_fn { + self.add_ref(i.id.to_id()); + } + i + } + + fn fold_export_named_specifier(&mut self, s: ExportNamedSpecifier) -> ExportNamedSpecifier { + if let ModuleExportName::Ident(i) = &s.orig { + match &s.exported { + Some(exported) => { + if let ModuleExportName::Ident(e) = exported { + if self.state.should_keep_identifier(e) { + self.add_ref(i.to_id()); + } + } + } + None => { + if self.state.should_keep_identifier(i) { + self.add_ref(i.to_id()); + } + } + } + } + s + } + + fn fold_export_decl(&mut self, s: ExportDecl) -> ExportDecl { + let old_in_kept = self.in_kept_fn; + + match &s.decl { + Decl::Fn(f) => { + if self.state.should_keep_identifier(&f.ident) { + self.in_kept_fn = true; + self.add_ref(f.ident.to_id()); + } + } + + Decl::Var(d) => { + if d.decls.is_empty() { + return s; + } + if let Pat::Ident(id) = &d.decls[0].name { + if self.state.should_keep_identifier(&id.id) { + self.in_kept_fn = true; + self.add_ref(id.to_id()); + } + } + } + _ => {} + } + let e = s.fold_children_with(self); + self.in_kept_fn = old_in_kept; + e + } + + fn fold_expr(&mut self, e: Expr) -> Expr { + let e = e.fold_children_with(self); + + if let Expr::Ident(i) = &e { + self.add_ref(i.to_id()); + } + e + } + + fn fold_jsx_element(&mut self, jsx: JSXElement) -> JSXElement { + fn get_leftmost_id_member_expr(e: &JSXMemberExpr) -> Id { + match &e.obj { + JSXObject::Ident(i) => i.to_id(), + JSXObject::JSXMemberExpr(e) => get_leftmost_id_member_expr(e), + } + } + + match &jsx.opening.name { + JSXElementName::Ident(i) => { + self.add_ref(i.to_id()); + } + JSXElementName::JSXMemberExpr(e) => { + self.add_ref(get_leftmost_id_member_expr(e)); + } + _ => {} + } + + jsx.fold_children_with(self) + } + + fn fold_fn_decl(&mut self, f: FnDecl) -> FnDecl { + let f = f.fold_children_with(self); + if self.in_kept_fn { + self.add_ref(f.ident.to_id()); + } + f + } + + fn fold_fn_expr(&mut self, f: FnExpr) -> FnExpr { + let f = f.fold_children_with(self); + if let Some(id) = &f.ident { + self.add_ref(id.to_id()); + } + f + } + + /// Drops [ExportDecl] if all specifiers are removed. + fn fold_module_item(&mut self, s: ModuleItem) -> ModuleItem { + match s { + ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)) if !e.specifiers.is_empty() => { + let e = e.fold_with(self); + + if e.specifiers.is_empty() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + + return ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)); + } + + ModuleItem::Stmt(Stmt::Expr(_e)) => { + // remove top expression + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) + } + + ModuleItem::Stmt(Stmt::If(_e)) => { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) + } + + ModuleItem::Stmt(Stmt::DoWhile(_e)) => { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) + } + + ModuleItem::Stmt(Stmt::Try(_e)) => { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) + } + _ => {} + }; + + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(e)) = &s { + match &e.decl { + Decl::Fn(f) => { + if self.state.should_keep_identifier(&f.ident) { + let s = s.fold_children_with(self); + return s; + } else { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + } + + Decl::Var(d) => { + if d.decls.is_empty() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + + if let Pat::Ident(id) = &d.decls[0].name { + if self.state.should_keep_identifier(&id.id) { + let s = s.fold_children_with(self); + return s; + } else { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + } + } + _ => {} + } + } + + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultExpr(_e)) = &s { + if !self.state.should_keep_default() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + } + + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(_e)) = &s { + if !self.state.should_keep_default() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + } + + // Visit children to ensure that all references is added to the scope. + let s = s.fold_children_with(self); + s + } + + fn fold_default_decl(&mut self, d: DefaultDecl) -> DefaultDecl { + return self.check_default(d); + } + + fn fold_export_default_expr(&mut self, e: ExportDefaultExpr) -> ExportDefaultExpr { + return self.check_default(e); + } + + fn fold_prop(&mut self, p: Prop) -> Prop { + let p = p.fold_children_with(self); + + if let Prop::Shorthand(i) = &p { + self.add_ref(i.to_id()); + } + + p + } + + fn fold_var_declarator(&mut self, mut v: VarDeclarator) -> VarDeclarator { + let old_in_lhs_of_var = self.in_lhs_of_var; + + self.in_lhs_of_var = true; + v.name = v.name.fold_with(self); + + self.in_lhs_of_var = false; + v.init = v.init.fold_with(self); + + self.in_lhs_of_var = old_in_lhs_of_var; + v + } +} + +pub fn keep_export(exports: Vec) -> impl Fold { + Repeat::new(KeepExport { + state: State { + keep_exports: exports, + ..Default::default() + }, + in_lhs_of_var: false, + }) +} \ No newline at end of file diff --git a/crates/loader_compilation/src/transform/mod.rs b/crates/loader_compilation/src/transform/mod.rs index e0e15f8..9e08e7e 100644 --- a/crates/loader_compilation/src/transform/mod.rs +++ b/crates/loader_compilation/src/transform/mod.rs @@ -2,13 +2,19 @@ use either::Either; use swc_core::common::chain; use swc_core::ecma::{ transforms::base::pass::noop, - visit::{as_folder, Fold, VisitMut}, + visit::{as_folder, Fold, VisitMut, Visit}, ast::Module, }; +mod keep_export; +mod remove_export; + +use keep_export::keep_export; +use remove_export::remove_export; + macro_rules! either { ($config:expr, $f:expr) => { - if let Some(config) = &$config { + if let Some(config) = $config { Either::Left($f(config)) } else { Either::Right(noop()) @@ -24,37 +30,25 @@ macro_rules! either { } pub struct KeepExportOptions { - export_names: Vec, + pub export_names: Vec, } -pub struct RemoveExport { - remove_names: Vec, +pub struct RemoveExportOptions { + pub remove_names: Vec, } pub struct SwcPluginOptions { pub keep_export: Option, - pub remove_export: Option, + pub remove_export: Option, } pub(crate) fn transform<'a>(plugin_options: SwcPluginOptions) -> impl Fold + 'a { chain!( - either!(plugin_options.keep_export, |_| { - keep_export() + either!(plugin_options.keep_export, |options: KeepExportOptions| { + keep_export(options.export_names) }), - either!(plugin_options.remove_export, |_| { - keep_export() + either!(plugin_options.remove_export, |options: RemoveExportOptions| { + remove_export(options.remove_names) }), ) -} - -struct KeepExport; - -impl VisitMut for KeepExport { - fn visit_mut_module(&mut self, module: &mut Module) { - - } -} - -fn keep_export() -> impl Fold { - as_folder(KeepExport) } \ No newline at end of file diff --git a/crates/loader_compilation/src/transform/remove_export.rs b/crates/loader_compilation/src/transform/remove_export.rs index e69de29..f58b3c1 100644 --- a/crates/loader_compilation/src/transform/remove_export.rs +++ b/crates/loader_compilation/src/transform/remove_export.rs @@ -0,0 +1,586 @@ +// transform code is modified based on swc plugin of remove_export: +// https://github.com/ice-lab/swc-plugins/tree/main/packages/remove-export +use fxhash::FxHashSet; +use std::mem::take; +use swc_core::ecma::{ + ast::*, + visit::{Fold, FoldWith, noop_fold_type}, +}; +use rspack_error::Error; +use swc_core::common::{ + DUMMY_SP, pass::{Repeat, Repeated} +}; + +/// State of the transforms. Shared by the analyzer and the transform. +#[derive(Debug, Default)] +struct State { + /// Identifiers referenced by non-data function codes. + /// + /// Cleared before running each pass, because we drop ast nodes between the + /// passes. + refs_from_other: FxHashSet, + + /// Identifiers referenced by data functions or derivatives. + /// + /// Preserved between runs, because we should remember derivatives of data + /// functions as the data function itself is already removed. + refs_from_data_fn: FxHashSet, + + cur_declaring: FxHashSet, + + should_run_again: bool, + remove_exports: Vec, +} + +impl State { + fn should_remove_identifier(&mut self, i: &Ident) -> Result { + Ok(self.remove_exports.contains(&String::from(&*i.sym))) + } + fn should_remove_default(&mut self) -> bool { + self.remove_exports.contains(&String::from("default")) + } +} + +struct Analyzer<'a> { + state: &'a mut State, + in_lhs_of_var: bool, + in_data_fn: bool, +} + +impl Analyzer<'_> { + fn add_ref(&mut self, id: Id) { + if self.in_data_fn { + self.state.refs_from_data_fn.insert(id); + } else { + if self.state.cur_declaring.contains(&id) { + return; + } + + self.state.refs_from_other.insert(id); + } + } + + fn check_default>(&mut self, e: T) -> T { + if self.state.should_remove_default() { + let old_in_data = self.in_data_fn; + self.in_data_fn = true; + let e = e.fold_children_with(self); + self.in_data_fn = old_in_data; + return e + } + + return e.fold_children_with(self); + } +} + +impl Fold for Analyzer<'_> { + // This is important for reducing binary sizes. + noop_fold_type!(); + + fn fold_binding_ident(&mut self, i: BindingIdent) -> BindingIdent { + if !self.in_lhs_of_var || self.in_data_fn { + self.add_ref(i.id.to_id()); + } + + i + } + + fn fold_export_named_specifier(&mut self, s: ExportNamedSpecifier) -> ExportNamedSpecifier { + if let ModuleExportName::Ident(id) = &s.orig { + if !self.state.remove_exports.contains(&String::from(&*id.sym)) { + self.add_ref(id.to_id()); + } + } + + s + } + + fn fold_export_decl(&mut self, s: ExportDecl) -> ExportDecl { + let old_in_data = self.in_data_fn; + + match &s.decl { + Decl::Fn(f) => { + if let Ok(should_remove_identifier) = self.state.should_remove_identifier(&f.ident) { + if should_remove_identifier { + self.in_data_fn = true; + self.add_ref(f.ident.to_id()); + } + } + } + + Decl::Var(d) => { + if d.decls.is_empty() { + return s; + } + if let Pat::Ident(id) = &d.decls[0].name { + if self.state.remove_exports.contains(&String::from(&*id.id.sym)) { + self.in_data_fn = true; + self.add_ref(id.to_id()); + } + } + } + _ => {} + } + + let e = s.fold_children_with(self); + + self.in_data_fn = old_in_data; + + return e; + } + + fn fold_expr(&mut self, e: Expr) -> Expr { + let e = e.fold_children_with(self); + + if let Expr::Ident(i) = &e { + self.add_ref(i.to_id()); + } + + e + } + + fn fold_jsx_element(&mut self, jsx: JSXElement) -> JSXElement { + fn get_leftmost_id_member_expr(e: &JSXMemberExpr) -> Id { + match &e.obj { + JSXObject::Ident(i) => i.to_id(), + JSXObject::JSXMemberExpr(e) => get_leftmost_id_member_expr(e), + } + } + + match &jsx.opening.name { + JSXElementName::Ident(i) => { + self.add_ref(i.to_id()); + } + JSXElementName::JSXMemberExpr(e) => { + self.add_ref(get_leftmost_id_member_expr(e)); + } + _ => {} + } + + jsx.fold_children_with(self) + } + + fn fold_fn_decl(&mut self, f: FnDecl) -> FnDecl { + let f = f.fold_children_with(self); + if self.in_data_fn { + self.add_ref(f.ident.to_id()); + } + + f + } + + fn fold_fn_expr(&mut self, f: FnExpr) -> FnExpr { + let f = f.fold_children_with(self); + if let Some(id) = &f.ident { + self.add_ref(id.to_id()); + } + + f + } + + /// Drops [ExportDecl] if all specifiers are removed. + fn fold_module_item(&mut self, s: ModuleItem) -> ModuleItem { + match s { + ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)) if !e.specifiers.is_empty() => { + let e = e.fold_with(self); + + if e.specifiers.is_empty() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + + return ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)); + } + _ => {} + }; + + // Visit children to ensure that all references is added to the scope. + let s = s.fold_children_with(self); + + if let ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(e)) = &s { + match &e.decl { + Decl::Fn(f) => { + if let Ok(should_remove_identifier) = self.state.should_remove_identifier(&f.ident) { + if should_remove_identifier { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + } else { + return s; + } + } + + Decl::Var(d) => { + if d.decls.is_empty() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + } + _ => {} + } + } + + s + } + + fn fold_named_export(&mut self, mut n: NamedExport) -> NamedExport { + if n.src.is_some() { + n.specifiers = n.specifiers.fold_with(self); + } + + n + } + + fn fold_default_decl(&mut self, d: DefaultDecl) -> DefaultDecl { + return self.check_default(d); + } + + fn fold_export_default_expr(&mut self, e: ExportDefaultExpr) -> ExportDefaultExpr { + return self.check_default(e); + } + + fn fold_prop(&mut self, p: Prop) -> Prop { + let p = p.fold_children_with(self); + if let Prop::Shorthand(i) = &p { + self.add_ref(i.to_id()); + } + p + } + + fn fold_var_declarator(&mut self, mut v: VarDeclarator) -> VarDeclarator { + let old_in_lhs_of_var = self.in_lhs_of_var; + + self.in_lhs_of_var = true; + v.name = v.name.fold_with(self); + + self.in_lhs_of_var = false; + v.init = v.init.fold_with(self); + + self.in_lhs_of_var = old_in_lhs_of_var; + v + } +} + +struct RemoveExport { + pub state: State, + in_lhs_of_var: bool, +} + +impl RemoveExport { + fn should_remove(&self, id: Id) -> bool { + self.state.refs_from_data_fn.contains(&id) && !self.state.refs_from_other.contains(&id) + } + + /// Mark identifiers in `n` as a candidate for removal. + fn mark_as_candidate(&mut self, n: N) -> N + where + N: for<'a> FoldWith>, + { + // Analyzer never change `in_data_fn` to false, so all identifiers in `n` will + // be marked as referenced from a data function. + let mut v = Analyzer { + state: &mut self.state, + in_lhs_of_var: false, + in_data_fn: true, + }; + + let n = n.fold_with(&mut v); + self.state.should_run_again = true; + n + } + + fn create_empty_fn(&mut self) -> FnExpr { + return FnExpr { + ident: None, + function: Box::new(Function { + params: vec![], + body: Some(BlockStmt { + span: DUMMY_SP, + stmts: vec![] + }), + span: DUMMY_SP, + is_generator: false, + is_async: false, + decorators: vec![], + return_type: None, + type_params: None, + }) + }; + } +} + +impl Repeated for RemoveExport { + fn changed(&self) -> bool { + self.state.should_run_again + } + + fn reset(&mut self) { + self.state.refs_from_other.clear(); + self.state.cur_declaring.clear(); + self.state.should_run_again = false; + } +} + +impl Fold for RemoveExport { + // This is important for reducing binary sizes. + noop_fold_type!(); + + // Remove import expression + fn fold_import_decl(&mut self, mut i: ImportDecl) -> ImportDecl { + // Imports for side effects. + if i.specifiers.is_empty() { + return i; + } + + i.specifiers.retain(|s| match s { + ImportSpecifier::Named(ImportNamedSpecifier { local, .. }) + | ImportSpecifier::Default(ImportDefaultSpecifier { local, .. }) + | ImportSpecifier::Namespace(ImportStarAsSpecifier { local, .. }) => { + if self.should_remove(local.to_id()) { + self.state.should_run_again = true; + false + } else { + true + } + } + }); + + i + } + + fn fold_module(&mut self, mut m: Module) -> Module { + { + // Fill the state. + let mut v = Analyzer { + state: &mut self.state, + in_lhs_of_var: false, + in_data_fn: false, + }; + m = m.fold_with(&mut v); + } + + m.fold_children_with(self) + } + + fn fold_module_items(&mut self, mut items: Vec) -> Vec { + items = items.fold_children_with(self); + // Drop nodes. + items.retain(|s| !matches!(s, ModuleItem::Stmt(Stmt::Empty(..)))); + items + } + + fn fold_module_item(&mut self, i: ModuleItem) -> ModuleItem { + if let ModuleItem::ModuleDecl(ModuleDecl::Import(i)) = i { + let is_for_side_effect = i.specifiers.is_empty(); + let i = i.fold_with(self); + + if !is_for_side_effect && i.specifiers.is_empty() { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + return ModuleItem::ModuleDecl(ModuleDecl::Import(i)); + } + + let i = i.fold_children_with(self); + + match &i { + ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)) if e.specifiers.is_empty() => { + return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) + } + _ => {} + } + + i + } + + fn fold_named_export(&mut self, mut n: NamedExport) -> NamedExport { + n.specifiers = n.specifiers.fold_with(self); + + n.specifiers.retain(|s| { + let preserve = match s { + ExportSpecifier::Namespace(ExportNamespaceSpecifier { + name: ModuleExportName::Ident(exported), + .. + }) + | ExportSpecifier::Default(ExportDefaultSpecifier { exported, .. }) + | ExportSpecifier::Named(ExportNamedSpecifier { + exported: Some(ModuleExportName::Ident(exported)), + .. + }) => self + .state + .should_remove_identifier(exported) + .map(|should_remove_identifier| !should_remove_identifier), + ExportSpecifier::Named(ExportNamedSpecifier { + orig: ModuleExportName::Ident(orig), + .. + }) => self + .state + .should_remove_identifier(orig) + .map(|should_remove_identifier| !should_remove_identifier), + _ => Ok(true), + }; + + match preserve { + Ok(false) => { + if let ExportSpecifier::Named(ExportNamedSpecifier { + orig: ModuleExportName::Ident(orig), + .. + }) = s + { + self.state.should_run_again = true; + self.state.refs_from_data_fn.insert(orig.to_id()); + } + + false + } + Ok(true) => true, + Err(_) => false, + } + }); + + n + } + + fn fold_default_decl(&mut self, d: DefaultDecl) -> DefaultDecl { + if self.state.should_remove_default() { + // Replace with an empty function + return DefaultDecl::Fn(self.create_empty_fn()) + } + d + } + + fn fold_export_default_expr(&mut self, n: ExportDefaultExpr) -> ExportDefaultExpr { + if self.state.should_remove_default() { + // Replace with an empty function + return ExportDefaultExpr { + span: DUMMY_SP, + expr: Box::new(Expr::Fn(self.create_empty_fn())) + }; + } + n + } + + /// This methods returns [Pat::Invalid] if the pattern should be removed. + fn fold_pat(&mut self, mut p: Pat) -> Pat { + p = p.fold_children_with(self); + + if self.in_lhs_of_var { + match &mut p { + Pat::Ident(name) => { + if self.should_remove(name.id.to_id()) { + self.state.should_run_again = true; + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + Pat::Array(arr) => { + if !arr.elems.is_empty() { + arr.elems.retain(|e| !matches!(e, Some(Pat::Invalid(..)))); + + if arr.elems.is_empty() { + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + } + Pat::Object(obj) => { + if !obj.props.is_empty() { + obj.props = take(&mut obj.props) + .into_iter() + .filter_map(|prop| match prop { + ObjectPatProp::KeyValue(prop) => { + if prop.value.is_invalid() { + None + } else { + Some(ObjectPatProp::KeyValue(prop)) + } + } + ObjectPatProp::Assign(prop) => { + if self.should_remove(prop.key.to_id()) { + self.mark_as_candidate(prop.value); + + None + } else { + Some(ObjectPatProp::Assign(prop)) + } + } + ObjectPatProp::Rest(prop) => { + if prop.arg.is_invalid() { + None + } else { + Some(ObjectPatProp::Rest(prop)) + } + } + }) + .collect(); + + if obj.props.is_empty() { + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + } + Pat::Rest(rest) => { + if rest.arg.is_invalid() { + return Pat::Invalid(Invalid { span: DUMMY_SP }); + } + } + _ => {} + } + } + + p + } + + #[allow(clippy::single_match)] + fn fold_stmt(&mut self, mut s: Stmt) -> Stmt { + match s { + Stmt::Decl(Decl::Fn(f)) => { + if self.should_remove(f.ident.to_id()) { + self.mark_as_candidate(f.function); + return Stmt::Empty(EmptyStmt { span: DUMMY_SP }); + } + + s = Stmt::Decl(Decl::Fn(f)); + } + _ => {} + } + + let s = s.fold_children_with(self); + match s { + Stmt::Decl(Decl::Var(v)) if v.decls.is_empty() => { + return Stmt::Empty(EmptyStmt { span: DUMMY_SP }); + } + _ => {} + } + + s + } + + /// This method make `name` of [VarDeclarator] to [Pat::Invalid] if it + /// should be removed. + fn fold_var_declarator(&mut self, mut d: VarDeclarator) -> VarDeclarator { + let old = self.in_lhs_of_var; + self.in_lhs_of_var = true; + let name = d.name.fold_with(self); + + self.in_lhs_of_var = false; + if name.is_invalid() { + d.init = self.mark_as_candidate(d.init); + } + let init = d.init.fold_with(self); + self.in_lhs_of_var = old; + + VarDeclarator { name, init, ..d } + } + + fn fold_var_declarators(&mut self, mut decls: Vec) -> Vec { + decls = decls.fold_children_with(self); + decls.retain(|d| !d.name.is_invalid()); + + decls + } +} + +pub fn remove_export(exports: Vec) -> impl Fold { + Repeat::new(RemoveExport { + state: State { + remove_exports: exports, + ..Default::default() + }, + in_lhs_of_var: false, + }) +} \ No newline at end of file diff --git a/crates/loader_compilation/tests/fixtures.rs b/crates/loader_compilation/tests/fixtures.rs index efb3880..3b78fdb 100644 --- a/crates/loader_compilation/tests/fixtures.rs +++ b/crates/loader_compilation/tests/fixtures.rs @@ -10,12 +10,8 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { let tests_path = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"))).join("tests"); let expected_path = tests_path.join(expected); let actual_path = tests_path.join(actual); - let plugin_path = tests_path.join("my_first_plugin.wasm"); + let mut options = Config::default(); - options.jsc.experimental.plugins = Some(vec![PluginConfig( - plugin_path.to_string_lossy().to_string(), - json!(null), - )]); let (result, _) = run_loaders( &[Arc::new(CompilationLoader::new()) as Arc>], &ResourceData::new(actual_path.to_string_lossy().to_string(), actual_path), diff --git a/crates/loader_compilation/tests/fixtures/basic/input.js b/crates/loader_compilation/tests/fixtures/basic/input.js index 54b82a0..f11cfe5 100644 --- a/crates/loader_compilation/tests/fixtures/basic/input.js +++ b/crates/loader_compilation/tests/fixtures/basic/input.js @@ -1 +1,8 @@ const a = 1; +const b = 2; + +export const dataLoader = { + b, +}; + +export default a; \ No newline at end of file From 133a9f3d005fd938ba3097a82987b51efd6b4fd7 Mon Sep 17 00:00:00 2001 From: libinfs <14896023+libin-code@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:47:58 +0800 Subject: [PATCH 10/18] feat: Finished the specilize module name plugin (#10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Finished the specilize module name plugin * refactor: test and core code --------- Co-authored-by: 空堂 --- Cargo.toml | 3 +- .../plugin_specilize_module_name/Cargo.toml | 15 +++ crates/plugin_specilize_module_name/README.md | 39 ++++++++ .../plugin_specilize_module_name/src/lib.rs | 2 + .../src/plugin.rs | 97 +++++++++++++++++++ .../tests/fixtures/basic/function.js | 11 +++ .../tests/fixtures/basic/index.js | 9 ++ .../tests/fixtures/basic/snapshot/output.snap | 79 +++++++++++++++ .../tests/fixtures/basic/test.config.json | 1 + .../tests/fixtures/basic/util_1.js | 3 + .../tests/fixtures/basic/utils.js | 9 ++ .../tests/plugin.rs | 24 +++++ 12 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 crates/plugin_specilize_module_name/Cargo.toml create mode 100644 crates/plugin_specilize_module_name/README.md create mode 100644 crates/plugin_specilize_module_name/src/lib.rs create mode 100644 crates/plugin_specilize_module_name/src/plugin.rs create mode 100644 crates/plugin_specilize_module_name/tests/fixtures/basic/function.js create mode 100644 crates/plugin_specilize_module_name/tests/fixtures/basic/index.js create mode 100644 crates/plugin_specilize_module_name/tests/fixtures/basic/snapshot/output.snap create mode 100644 crates/plugin_specilize_module_name/tests/fixtures/basic/test.config.json create mode 100644 crates/plugin_specilize_module_name/tests/fixtures/basic/util_1.js create mode 100644 crates/plugin_specilize_module_name/tests/fixtures/basic/utils.js create mode 100644 crates/plugin_specilize_module_name/tests/plugin.rs diff --git a/Cargo.toml b/Cargo.toml index e8df955..e6f98eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ members = [ "crates/binding_options", "crates/node_binding", "crates/loader_compilation", - "crates/plugin_manifest" + "crates/plugin_manifest", + "crates/plugin_specilize_module_name" ] resolver = "2" diff --git a/crates/plugin_specilize_module_name/Cargo.toml b/crates/plugin_specilize_module_name/Cargo.toml new file mode 100644 index 0000000..e7e9cd1 --- /dev/null +++ b/crates/plugin_specilize_module_name/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "plugin_specilize_module_name" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +async-trait = { workspace = true } +tracing = { workspace = true } +rspack_core = { path = "../.rspack_crates/rspack_core" } +rspack_error = { path = "../.rspack_crates/rspack_error" } + +[dev-dependencies] +rspack_testing = { path = "../.rspack_crates/rspack_testing" } \ No newline at end of file diff --git a/crates/plugin_specilize_module_name/README.md b/crates/plugin_specilize_module_name/README.md new file mode 100644 index 0000000..46b6091 --- /dev/null +++ b/crates/plugin_specilize_module_name/README.md @@ -0,0 +1,39 @@ +# plugin_specilize_module_name + +## Introduction + +This is a plugin that specializes the module name of the generated code. It use the rspack `before_resolve` plugin hook to do this. + +## Usage + +1. Add the following configuration to your `Cargo.toml` file + +```toml +[plugins] +plugin_specilize_module_name = { version = "0.1.0", default-features = false } +``` + +2. Add the plugin to rspack-core and pass the argument(the package names you want to specialize) + +```rs +Box::new(SpecilizeModuleNamePlugin::new(Some(vec![]))) +``` + +## Example + +You put the `lodash` as point package name in rspack-core + +```rs +Box::new(SpecilizeModuleNamePlugin::new(Some(vec!["lodash"]))) +``` + +Then you can use it in your code + +```js +const { add } = require("lodash"); +``` + +The package name will be transformed to `lodash.js?id=1`. The `id` is unique for each package. + +## License +MIT \ No newline at end of file diff --git a/crates/plugin_specilize_module_name/src/lib.rs b/crates/plugin_specilize_module_name/src/lib.rs new file mode 100644 index 0000000..a866635 --- /dev/null +++ b/crates/plugin_specilize_module_name/src/lib.rs @@ -0,0 +1,2 @@ +mod plugin; +pub use plugin::*; diff --git a/crates/plugin_specilize_module_name/src/plugin.rs b/crates/plugin_specilize_module_name/src/plugin.rs new file mode 100644 index 0000000..1af5316 --- /dev/null +++ b/crates/plugin_specilize_module_name/src/plugin.rs @@ -0,0 +1,97 @@ +use std::sync::RwLock; +use rspack_core::{ + Plugin, + PluginContext, + NormalModuleBeforeResolveArgs, + PluginNormalModuleFactoryBeforeResolveOutput, +}; + +#[derive(Debug)] +pub struct SpecilizeModuleNamePlugin { + // this value will auto-increase in concurrence situation + uid: RwLock, + target_module_names: Vec, +} + +impl SpecilizeModuleNamePlugin { + pub fn new(target_module_names: Option>) -> Self { + Self { + uid: RwLock::new(0), + target_module_names: match target_module_names { + Some(value) => value, + None => vec![], + }, + } + } + + fn increase_uid(&self) -> i32 { + let mut cur_id = self.uid.write().unwrap(); + *cur_id += 1; + *cur_id + } +} + +#[async_trait::async_trait] +impl Plugin for SpecilizeModuleNamePlugin { + fn name(&self) -> &'static str { + "SpecilizeModuleNamePlugin" + } + + async fn before_resolve( + &self, + _ctx: PluginContext, + _args: &mut NormalModuleBeforeResolveArgs + ) -> PluginNormalModuleFactoryBeforeResolveOutput { + if self.target_module_names.is_empty() { + return Ok(None); + } + for name in &self.target_module_names { + if _args.request.contains(name) { + let uid = self.increase_uid().to_string(); + _args.request.push_str("?id="); + _args.request.push_str(&uid); + break; + } + } + Ok(None) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_create_instance_without_argument() { + let specilize_module_name_plugin = SpecilizeModuleNamePlugin::new(None); + + assert_eq!(*specilize_module_name_plugin.uid.read().unwrap(), 0); + assert_eq!( + specilize_module_name_plugin.target_module_names.as_slice(), + &vec![] as &[&'static str] + ); + } + #[test] + fn test_create_instance_with_argument() { + let target = vec!["a".to_string(), "b".to_string()]; + let specilize_module_name_plugin = SpecilizeModuleNamePlugin::new(Some(target.clone())); + + assert_eq!(*specilize_module_name_plugin.uid.read().unwrap(), 0); + assert_eq!(specilize_module_name_plugin.target_module_names.as_slice(), &target); + } + + #[test] + fn test_increase_uid_method() { + let specilize_module_name_plugin = SpecilizeModuleNamePlugin::new(None); + specilize_module_name_plugin.increase_uid(); + let result_1 = specilize_module_name_plugin.increase_uid(); + assert_eq!(result_1, 2); + assert_eq!(*specilize_module_name_plugin.uid.read().unwrap(), 2); + } + + #[test] + fn test_name_method() { + let specilize_module_name_plugin = SpecilizeModuleNamePlugin::new(None); + assert_eq!(specilize_module_name_plugin.name(), "SpecilizeModuleNamePlugin"); + } +} diff --git a/crates/plugin_specilize_module_name/tests/fixtures/basic/function.js b/crates/plugin_specilize_module_name/tests/fixtures/basic/function.js new file mode 100644 index 0000000..c0196c6 --- /dev/null +++ b/crates/plugin_specilize_module_name/tests/fixtures/basic/function.js @@ -0,0 +1,11 @@ +const { add } = require("./utils"); +const { add_3 } = require("./util_1"); + +export function cal() { + const result = add(2 + 2); + console.log("2 + 2 is %s, it is a %s number", result, isNumber(result)); +} + +export function cal2() { + return add_3(0); +} diff --git a/crates/plugin_specilize_module_name/tests/fixtures/basic/index.js b/crates/plugin_specilize_module_name/tests/fixtures/basic/index.js new file mode 100644 index 0000000..0546c30 --- /dev/null +++ b/crates/plugin_specilize_module_name/tests/fixtures/basic/index.js @@ -0,0 +1,9 @@ +console.log("Hello World!"); + +const { cal } = require("./function") +const { add } = require("./utils"); + +cal(); + +console.log("1 + 1 is %s", add(1, 1)); +console.log("The 'string' is String type is %s", isString('string')); diff --git a/crates/plugin_specilize_module_name/tests/fixtures/basic/snapshot/output.snap b/crates/plugin_specilize_module_name/tests/fixtures/basic/snapshot/output.snap new file mode 100644 index 0000000..f08d066 --- /dev/null +++ b/crates/plugin_specilize_module_name/tests/fixtures/basic/snapshot/output.snap @@ -0,0 +1,79 @@ +--- +source: crates/.rspack_crates/rspack_testing/src/run_fixture.rs +assertion_line: 146 +--- +```js title=main.js +(self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], { +"./function.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { +'use strict'; +__webpack_require__.r(__webpack_exports__); +__webpack_require__.d(__webpack_exports__, { + 'cal': function() { return cal; }, + 'cal2': function() { return cal2; } +}); +const { add } = __webpack_require__(/* ./utils */"./utils.js?id=2"); +const { add_3 } = __webpack_require__(/* ./util_1 */"./util_1.js"); + function cal() { + const result = add(2 + 2); + console.log("2 + 2 is %s, it is a %s number", result, isNumber(result)); +} + function cal2() { + return add_3(0); +} +}, +"./index.js": function (__unused_webpack_module, exports, __webpack_require__) { +console.log("Hello World!"); +const { cal } = __webpack_require__(/* ./function */"./function.js"); +const { add } = __webpack_require__(/* ./utils */"./utils.js?id=1"); +cal(); +console.log("1 + 1 is %s", add(1, 1)); +console.log("The 'string' is String type is %s", isString('string')); +}, +"./util_1.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { +'use strict'; +__webpack_require__.r(__webpack_exports__); +__webpack_require__.d(__webpack_exports__, { + 'add_3': function() { return add_3; } +}); + function add_3(a) { + return a + 3; +} +}, +"./utils.js?id=1": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { +'use strict'; +__webpack_require__.r(__webpack_exports__); +__webpack_require__.d(__webpack_exports__, { + 'add': function() { return add; }, + 'add_3_plus_1': function() { return add_3_plus_1; } +}); +const { add_3 } = __webpack_require__(/* ./util_1 */"./util_1.js"); + function add(x, y) { + return x + y; +} + function add_3_plus_1(x) { + return add_3(x) + 1; +} +}, +"./utils.js?id=2": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { +'use strict'; +__webpack_require__.r(__webpack_exports__); +__webpack_require__.d(__webpack_exports__, { + 'add': function() { return add; }, + 'add_3_plus_1': function() { return add_3_plus_1; } +}); +const { add_3 } = __webpack_require__(/* ./util_1 */"./util_1.js"); + function add(x, y) { + return x + y; +} + function add_3_plus_1(x) { + return add_3(x) + 1; +} +}, + +},function(__webpack_require__) { +var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId) } +var __webpack_exports__ = (__webpack_exec__("./index.js")); + +} +]); +``` diff --git a/crates/plugin_specilize_module_name/tests/fixtures/basic/test.config.json b/crates/plugin_specilize_module_name/tests/fixtures/basic/test.config.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/crates/plugin_specilize_module_name/tests/fixtures/basic/test.config.json @@ -0,0 +1 @@ +{} diff --git a/crates/plugin_specilize_module_name/tests/fixtures/basic/util_1.js b/crates/plugin_specilize_module_name/tests/fixtures/basic/util_1.js new file mode 100644 index 0000000..60f9a3b --- /dev/null +++ b/crates/plugin_specilize_module_name/tests/fixtures/basic/util_1.js @@ -0,0 +1,3 @@ +export function add_3(a) { + return a + 3; +} \ No newline at end of file diff --git a/crates/plugin_specilize_module_name/tests/fixtures/basic/utils.js b/crates/plugin_specilize_module_name/tests/fixtures/basic/utils.js new file mode 100644 index 0000000..0ffb790 --- /dev/null +++ b/crates/plugin_specilize_module_name/tests/fixtures/basic/utils.js @@ -0,0 +1,9 @@ +const { add_3 } = require("./util_1"); + +export function add(x, y) { + return x + y; +} + +export function add_3_plus_1(x) { + return add_3(x) + 1; +} diff --git a/crates/plugin_specilize_module_name/tests/plugin.rs b/crates/plugin_specilize_module_name/tests/plugin.rs new file mode 100644 index 0000000..881c262 --- /dev/null +++ b/crates/plugin_specilize_module_name/tests/plugin.rs @@ -0,0 +1,24 @@ +use std::fs; +use std::process::Command; +use std::path::PathBuf; +use rspack_testing::{ fixture, test_fixture_insta }; +use plugin_specilize_module_name::SpecilizeModuleNamePlugin; + +#[fixture("tests/fixtures/basic")] +fn test_rspack_hook_invoke(fixture_path: PathBuf) { + test_fixture_insta( + &fixture_path, + &(|filename| filename == "main.js"), + Box::new(|plugins, _| { + plugins.push(Box::new(SpecilizeModuleNamePlugin::new(Some(vec!["utils".to_string()])))) + }) + ); + + let target_asset_path = fixture_path.join("./dist/main.js"); + + assert!(target_asset_path.exists()); + + let file_contents = fs::read_to_string(target_asset_path).expect("Failed to read file"); + + assert!(file_contents.contains("utils.js?id=")); +} From fa4b2703484dcb5bc22725ca51969728b27f9561 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Wed, 15 Nov 2023 11:48:32 +0800 Subject: [PATCH 11/18] feat: CI workflows (#7) * feat: add ci workflows * fix: update ci * fix: test ci * fix: test ci * fix: test ci * test: ci * test: ci * test: update path * fix: ci debug * test: ci debug * fix: test ci * fix: update yaml * fix: ref * fix: undefined spinner * fix: ci * feat: add release workflow * fix: toolchain * fix: config * fix: ci * test: ci * fix: test ci * fix: add lock file --- .cargo/config.toml | 8 + .github/actions/clone-crates/action.yml | 37 + .github/actions/pnpm-cache/action.yml | 58 + .github/actions/rustup/action.yml | 86 + .github/workflows/ci.yml | 103 + .github/workflows/release.yml | 169 + .gitignore | 1 - Cargo.lock | 5527 +++++++++++++++++++++++ crates/node_binding/Cargo.toml | 2 +- crates/node_binding/index.d.ts | 1762 ++++---- crates/node_binding/index.js | 356 +- crates/node_binding/package.json | 8 +- package.json | 11 +- pnpm-lock.yaml | 1431 +----- scripts/clean.mjs | 4 + scripts/clone-rspack.mjs | 50 +- scripts/github.mjs | 85 + scripts/test.mjs | 18 + 18 files changed, 7289 insertions(+), 2427 deletions(-) create mode 100644 .github/actions/clone-crates/action.yml create mode 100644 .github/actions/pnpm-cache/action.yml create mode 100644 .github/actions/rustup/action.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 Cargo.lock create mode 100644 scripts/clean.mjs create mode 100644 scripts/github.mjs create mode 100644 scripts/test.mjs diff --git a/.cargo/config.toml b/.cargo/config.toml index 6e228bd..5d02554 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -29,6 +29,9 @@ rustflags = [ "-Aclippy::default_constructed_unit_structs", ] +# To be able to run unit tests on macOS, support compilation to 'x86_64-apple-darwin'. +[target.'cfg(target_vendor = "apple")'] +rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"] # To be able to run unit tests on Linux, support compilation to 'x86_64-unknown-linux-gnu'. [target.'cfg(target_os = "linux")'] @@ -38,5 +41,10 @@ rustflags = ["-C", "link-args=-Wl,--warn-unresolved-symbols"] [target.'cfg(target_os = "windows")'] rustflags = ["-C", "link-args=/FORCE"] +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] +[target.i686-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] + [target.x86_64-apple-darwin] rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"] diff --git a/.github/actions/clone-crates/action.yml b/.github/actions/clone-crates/action.yml new file mode 100644 index 0000000..b8e89dc --- /dev/null +++ b/.github/actions/clone-crates/action.yml @@ -0,0 +1,37 @@ +name: clone crates + +description: clone rspack crates for github + +inputs: + repo: + default: 'web-infra-dev/rspack' + required: false + type: string + dest: + default: 'crates/.rspack_crates' + required: false + type: string + ref: + default: 'v0.3.6' + required: false + type: string + temp: + default: 'crates/.rspack_crates/.temp' + required: false + type: string + +runs: + using: composite + steps: + - name: Clone Repo + uses: actions/checkout@v4 + with: + repository: web-infra-dev/rspack + path: ${{ inputs.temp }} + ref: ${{ inputs.ref }} + + - name: Clean up + shell: bash + run: node scripts/clean.mjs + env: + IS_GITHUB: true diff --git a/.github/actions/pnpm-cache/action.yml b/.github/actions/pnpm-cache/action.yml new file mode 100644 index 0000000..422eace --- /dev/null +++ b/.github/actions/pnpm-cache/action.yml @@ -0,0 +1,58 @@ +name: pnpm cache + +description: Install Node.js with pnpm global cache + +inputs: + node-version: + default: '18' + required: false + type: string + save-if: + default: false + required: false + type: boolean + +env: + IS_GITHUB_RUNNER: startsWith(runner.name, 'GitHub Actions') + +runs: + using: composite + steps: + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + check-latest: true + + # https://pnpm.io/continuous-integration#github-actions + # Uses `packageManagement` field from package.json + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + dest: ${{ runner.tool_cache }}/pnpm + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Restore pnpm cache + id: restore + if: ${{ env.IS_GITHUB_RUNNER }} + uses: actions/cache/restore@v3 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: node-cache-${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + node-cache-${{ runner.os }}-pnpm- + + - name: Install dependencies + shell: bash + run: pnpm install --no-frozen-lockfile + + - name: Save pnpm cache + uses: actions/cache/save@v3 + if: ${{ env.IS_GITHUB_RUNNER && inputs.save-if == 'true' && steps.restore.outputs.cache-hit != 'true' }} + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: node-cache-${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} diff --git a/.github/actions/rustup/action.yml b/.github/actions/rustup/action.yml new file mode 100644 index 0000000..44bd616 --- /dev/null +++ b/.github/actions/rustup/action.yml @@ -0,0 +1,86 @@ +# This action installs the minimal Rust profile and configures Swatinem/rust-cache. +# +# It is needed to install as few Rust components as possbile because +# it takes a few minutes to install some of components on Windows and Mac, especially rust-doc. + +name: Rustup + +description: Install Rust with cache + +inputs: + # See https://rust-lang.github.io/rustup/concepts/components.html + clippy: + default: false + required: false + type: boolean + fmt: + default: false + required: false + type: boolean + docs: + default: false + required: false + type: boolean + save-cache: + default: false + required: false + type: boolean + shared-key: + default: 'check' + required: false + type: string + +env: + IS_GITHUB_RUNNER: startsWith(runner.name, 'GitHub Actions') + +runs: + using: composite + steps: + - name: Print Inputs + shell: bash + run: | + echo 'clippy: ${{ inputs.clippy }}' + echo 'fmt: ${{ inputs.fmt }}' + echo 'docs: ${{ inputs.docs }}' + echo 'save-cache: ${{ inputs.save-cache }}' + echo 'shared-key: ${{ inputs.shared-key }}' + + - name: Remove `profile` line on MacOS + shell: bash + if: runner.os == 'macOS' + run: sed -i '' '/profile/d' rust-toolchain.toml + + - name: Remove `profile` line on non-MacOS + shell: bash + if: runner.os != 'macOS' + run: sed -i '/profile/d' rust-toolchain.toml + + - name: Set minimal + shell: bash + run: rustup set profile minimal + + - name: Add Clippy + shell: bash + if: ${{ inputs.clippy == 'true' }} + run: rustup component add clippy + + - name: Add Rustfmt + shell: bash + if: ${{ inputs.fmt == 'true' }} + run: rustup component add rustfmt + + - name: Add docs + shell: bash + if: ${{ inputs.docs == 'true' }} + run: rustup component add rust-docs + + - name: Install + shell: bash + run: rustup show + + - name: Cache on ${{ github.ref_name }} + uses: Swatinem/rust-cache@v2 + if: ${{ env.IS_GITHUB_RUNNER }} + with: + shared-key: ${{ inputs.shared-key }} + save-if: ${{ inputs.save-cache == 'true' }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d5f8002 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +name: CI + +on: + merge_group: + types: [checks_requested] + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" + required: false + default: false + pull_request: + types: [opened, synchronize] + paths-ignore: + - "**/*.md" + branches-ignore: + - "release-**" + push: + branches: + - main + paths-ignore: + - "**/*.md" + tags-ignore: + - "**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +jobs: + rust_changes: + name: Rust Changes + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.filter.outputs.changed }} + steps: + - uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + changed: + - '.github/workflows/ci.yml' + - 'crates/**' + - 'Cargo.lock' + - 'Cargo.toml' + - 'rust-toolchain.toml' + + # rust_check: + # name: Rust check + # needs: rust_changes + # if: ${{ needs.rust_changes.outputs.changed == 'true' }} + # runs-on: ${{ fromJSON(vars.LINUX_RUNNER_LABELS || '"ubuntu-latest"') }} + # steps: + # - uses: actions/checkout@v4 + + # - name: Pnpm Cache # Required by some tests + # uses: ./.github/actions/pnpm-cache + + # - name: Clone Crates + # uses: ./.github/actions/clone-crates + + # - name: Install Rust Toolchain + # uses: ./.github/actions/rustup + # with: + # clippy: true + # fmt: true + # shared-key: check + + # - name: Run Cargo Check + # run: cargo check --workspace --all-targets # Not using --release because it uses too much cache, and is also slow. + + rust_test: + name: Rust test + needs: rust_changes + if: ${{ needs.rust_changes.outputs.changed == 'true' }} + runs-on: ${{ fromJSON(vars.LINUX_RUNNER_LABELS || '"ubuntu-latest"') }} + steps: + - uses: actions/checkout@v4 + + - name: Pnpm Cache # Required by some tests + uses: ./.github/actions/pnpm-cache + + - name: Clone Crates + uses: ./.github/actions/clone-crates + + - name: Install Rust Toolchain + uses: ./.github/actions/rustup + with: + save-cache: ${{ github.ref_name == 'main' }} + shared-key: check + + # Compile test without debug info for reducing the CI cache size + - name: Change profile.test + shell: bash + run: | + echo '[profile.test]' >> Cargo.toml + echo 'debug = false' >> Cargo.toml + + - name: Run test + run: pnpm test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..14074c0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,169 @@ +name: Release +env: + DEBUG: napi:* + APP_NAME: pack-binding + MACOSX_DEPLOYMENT_TARGET: '10.13' +permissions: + contents: write + id-token: write +on: + push: + branches: + - master + tags-ignore: + - '**' + paths-ignore: + - '**/*.md' + - LICENSE + - '**/*.gitignore' + - .editorconfig + - docs/** +jobs: + build: + strategy: + fail-fast: false + matrix: + settings: + - host: macos-latest + target: x86_64-apple-darwin + build: | + cd crates/node_binding + pnpm build + strip -x *.node + - host: windows-latest + build: cd crates/node_binding && pnpm build + target: x86_64-pc-windows-msvc + - host: ubuntu-latest + target: x86_64-unknown-linux-gnu + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian + build: |- + set -e && + cd crates/node_binding && + unset CC_x86_64_unknown_linux_gnu && unset CC && + pnpm build --target x86_64-unknown-linux-gnu && + strip *.node + - host: ubuntu-latest + target: x86_64-unknown-linux-musl + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine + build: cd crates/node_binding && set -e && pnpm build && strip *.node + - host: macos-latest + target: aarch64-apple-darwin + build: | + cd crates/node_binding + pnpm build --target aarch64-apple-darwin + strip -x *.node + - host: windows-latest + target: aarch64-pc-windows-msvc + build: cd crates/node_binding && pnpm build --target aarch64-pc-windows-msvc + name: stable - ${{ matrix.settings.target }} - node@18 + runs-on: ${{ matrix.settings.host }} + steps: + - uses: actions/checkout@v4 + + - name: Pnpm Cache # Required by some tests + uses: ./.github/actions/pnpm-cache + + - name: Clone Crates + uses: ./.github/actions/clone-crates + + - name: Install + uses: dtolnay/rust-toolchain@stable + if: ${{ !matrix.settings.docker }} + with: + toolchain: nightly-2023-06-02 + targets: ${{ matrix.settings.target }} + + - name: Cache cargo + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + .cargo-cache + target/ + key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} + - uses: goto-bus-stop/setup-zig@v2 + if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} + with: + version: 0.10.1 + + - name: Build in docker + uses: addnab/docker-run-action@v3 + if: ${{ matrix.settings.docker }} + with: + image: ${{ matrix.settings.docker }} + options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build' + run: ${{ matrix.settings.build }} + - name: Build + run: ${{ matrix.settings.build }} + if: ${{ !matrix.settings.docker }} + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: bindings-${{ matrix.settings.target }} + path: crates/node_binding/${{ env.APP_NAME }}.*.node + if-no-files-found: error + universal-macOS: + name: Build universal macOS binary + needs: + - build + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Pnpm Cache # Required by some tests + uses: ./.github/actions/pnpm-cache + - name: Download macOS x64 artifact + uses: actions/download-artifact@v3 + with: + name: bindings-x86_64-apple-darwin + path: crates/node_binding/ + - name: Download macOS arm64 artifact + uses: actions/download-artifact@v3 + with: + name: bindings-aarch64-apple-darwin + path: crates/node_binding/ + - name: Combine binaries + run: cd crates/node_binding && pnpm universal + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: bindings-universal-apple-darwin + path: crates/node_binding/${{ env.APP_NAME }}.*.node + if-no-files-found: error + publish: + name: Publish + runs-on: ubuntu-latest + needs: + - universal-macOS + steps: + - uses: actions/checkout@v4 + - name: Pnpm Cache # Required by some tests + uses: ./.github/actions/pnpm-cache + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: crates/node_binding + - name: Move artifacts + run: cd crates/node_binding && pnpm artifacts + - name: List packages + run: ls -R ./crates/node_binding/npm + shell: bash + - name: Publish + run: | + npm config set provenance true + if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --access public + elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --tag next --access public + else + echo "Not a release, skipping publish" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index dff4d30..fe67a2e 100644 --- a/.gitignore +++ b/.gitignore @@ -184,7 +184,6 @@ $RECYCLE.BIN/ #Added by cargo /target -Cargo.lock .pnp.* .yarn/* diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..45049d5 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,5527 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "serde", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +dependencies = [ + "backtrace", +] + +[[package]] +name = "anymap" +version = "1.0.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1f8f5a6f3d50d89e3797d7593a50f96bb2aaa20ca0cc7be1fb673232c91d72" + +[[package]] +name = "argh" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7af5ba06967ff7214ce4c7419c7d185be7ecd6cc4965a8f6e1d8ce0398aad219" +dependencies = [ + "argh_derive", + "argh_shared", +] + +[[package]] +name = "argh_derive" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56df0aeedf6b7a2fc67d06db35b09684c3e8da0c95f8f27685cb17e08413d87a" +dependencies = [ + "argh_shared", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "argh_shared" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531" +dependencies = [ + "serde", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "ast_node" +version = "0.9.5" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "async-scoped" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7a6a57c8aeb40da1ec037f5d455836852f7a57e69e1b1ad3d8f38ac1d6cadf" +dependencies = [ + "futures", + "pin-project", + "slab", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref", + "vsimd", +] + +[[package]] +name = "bench" +version = "0.1.0" +dependencies = [ + "mimalloc-rust", + "rspack_core", + "rspack_fs", + "rspack_testing", + "rspack_tracing", + "tikv-jemallocator", + "tokio", +] + +[[package]] +name = "better_scoped_tls" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794edcc9b3fb07bb4aecaa11f093fd45663b4feadb782d68303a2268bc2701de" +dependencies = [ + "scoped-tls", +] + +[[package]] +name = "better_scoped_tls" +version = "0.1.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "scoped-tls", +] + +[[package]] +name = "binding_options" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "better_scoped_tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "derivative", + "glob", + "loader_compilation", + "napi", + "napi-derive", + "plugin_manifest", + "rspack_binding_macros", + "rspack_binding_options", + "rspack_core", + "rspack_error", + "rspack_identifier", + "rspack_ids", + "rspack_loader_react_refresh", + "rspack_loader_runner", + "rspack_loader_sass", + "rspack_loader_swc", + "rspack_napi_shared", + "rspack_plugin_asset", + "rspack_plugin_banner", + "rspack_plugin_copy", + "rspack_plugin_css", + "rspack_plugin_dev_friendly_split_chunks", + "rspack_plugin_devtool", + "rspack_plugin_ensure_chunk_conditions", + "rspack_plugin_entry", + "rspack_plugin_externals", + "rspack_plugin_hmr", + "rspack_plugin_html", + "rspack_plugin_javascript", + "rspack_plugin_json", + "rspack_plugin_library", + "rspack_plugin_progress", + "rspack_plugin_real_content_hash", + "rspack_plugin_remove_empty_chunks", + "rspack_plugin_runtime", + "rspack_plugin_schemes", + "rspack_plugin_split_chunks", + "rspack_plugin_split_chunks_new", + "rspack_plugin_swc_css_minimizer", + "rspack_plugin_swc_js_minimizer", + "rspack_plugin_wasm", + "rspack_plugin_worker", + "rspack_regex", + "rspack_swc_visitors", + "rustc-hash", + "serde", + "serde_json", + "tokio", + "tracing", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "browserslist-rs" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9bda9b4595376bf255f68dafb5dcc5b0e2842b38dc2a7b52c4e0bfe9fd1c651" +dependencies = [ + "ahash 0.8.6", + "anyhow", + "chrono", + "either", + "getrandom", + "itertools", + "js-sys", + "nom", + "once_cell", + "quote", + "serde", + "serde-wasm-bindgen", + "serde_json", + "string_cache", + "string_cache_codegen", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata 0.1.10", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cargo-rst" +version = "0.1.0" +dependencies = [ + "colored", + "console", + "derive_builder", + "glob", + "serde", + "serde_json", + "similar", + "testing_macros", +] + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets 0.48.5", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "bitflags 1.3.2", + "textwrap 0.11.0", + "unicode-width", +] + +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "concat-string" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7439becb5fafc780b6f4de382b1a7a3e70234afe783854a4702ee8adbb838609" + +[[package]] +name = "console" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.45.0", +] + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +dependencies = [ + "libc", +] + +[[package]] +name = "criterion" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +dependencies = [ + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "futures", + "itertools", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "tokio", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "csv" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +dependencies = [ + "memchr", +] + +[[package]] +name = "ctor" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" +dependencies = [ + "quote", + "syn 2.0.38", +] + +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + +[[package]] +name = "daachorse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b7ef7a4be509357f4804d0a22e830daddb48f19fd604e4ad32ddce04a94c36" + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.2", + "lock_api", + "once_cell", + "parking_lot_core 0.9.9", +] + +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_builder" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_builder_macro" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" +dependencies = [ + "derive_builder_core", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dojang" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f07994caf710e9d5fc534432b40c4a9c16ed320aa673bb768eec6c7d5cbfbc32" +dependencies = [ + "html-escape", + "serde_json", +] + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "dyn-clone" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "enum-iterator" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7add3873b5dd076766ee79c8e406ad1a472c385476b9e38849f8eec24f1be689" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "from_variant" +version = "0.1.6" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-executor" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" + +[[package]] +name = "futures-macro" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getset" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "glob-match" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985c9503b412198aa4197559e9a318524ebc4519c229bfa05a535828c950b9d" + +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + +[[package]] +name = "handlebars" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.7", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.6", +] + +[[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +dependencies = [ + "ahash 0.8.6", + "allocator-api2", +] + +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown 0.14.2", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hrx-parser" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb741d1d6fce95c065abb032a5f302299520a23928a95e96ab64799b5fd97f3a" + +[[package]] +name = "html-escape" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" +dependencies = [ + "utf8-width", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "rayon", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", + "serde", +] + +[[package]] +name = "indicatif" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +dependencies = [ + "console", + "instant", + "number_prefix", + "portable-atomic", + "unicode-width", +] + +[[package]] +name = "insta" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc" +dependencies = [ + "console", + "lazy_static", + "linked-hash-map", + "serde", + "similar", + "yaml-rust", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "is-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4467ed1321b310c2625c5aa6c1b1ffc5de4d9e42668cf697a08fb033ee8265e" +dependencies = [ + "Inflector", + "pmutil", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.3", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "is_ci" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" + +[[package]] +name = "jsonc-parser" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b56a20e76235284255a09fcd1f45cf55d3c524ea657ebd3854735925c57743d" +dependencies = [ + "serde_json", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lexical" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6" +dependencies = [ + "lexical-core", +] + +[[package]] +name = "lexical-core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linked_hash_set" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "loader_compilation" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "either", + "indexmap 1.9.3", + "once_cell", + "rspack_core", + "rspack_error", + "rspack_loader_runner", + "rspack_testing", + "serde", + "serde_json", + "swc_config", + "swc_core", + "swc_emotion", + "tokio", + "xxhash-rust", +] + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "lru" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" +dependencies = [ + "hashbrown 0.13.2", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "md4" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da5ac363534dce5fabf69949225e174fbf111a498bf0ff794c8ea1fba9f3dda" +dependencies = [ + "digest", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miette" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" +dependencies = [ + "atty", + "backtrace", + "miette-derive", + "once_cell", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap 0.15.2", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "mimalloc-rust" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb726c8298efb4010b2c46d8050e4be36cf807b9d9e98cb112f830914fc9bbe" +dependencies = [ + "cty", + "mimalloc-rust-sys", +] + +[[package]] +name = "mimalloc-rust-sys" +version = "1.7.9-source" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6413e13241a9809f291568133eca6694572cf528c1a6175502d090adce5dd5db" +dependencies = [ + "cc", + "cty", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "napi" +version = "2.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd063c93b900149304e3ba96ce5bf210cd4f81ef5eb80ded0d100df3e85a3ac0" +dependencies = [ + "anyhow", + "bitflags 2.4.1", + "ctor", + "napi-derive", + "napi-sys", + "once_cell", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "napi-build" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a73d9ef23e8dc2ebbffb6a6ae2ef467c0f18ac10711e4cc59c5485d41df0e" + +[[package]] +name = "napi-derive" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da1c6a8fa84d549aa8708fcd062372bf8ec6e849de39016ab921067d21bde367" +dependencies = [ + "cfg-if", + "convert_case", + "napi-derive-backend", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "napi-derive-backend" +version = "1.0.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20bbc7c69168d06a848f925ec5f0e0997f98e8c8d4f2cc30157f0da51c009e17" +dependencies = [ + "convert_case", + "once_cell", + "proc-macro2", + "quote", + "regex", + "semver 1.0.20", + "syn 1.0.109", +] + +[[package]] +name = "napi-sys" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "166b5ef52a3ab5575047a9fe8d4a030cdd0f63c96f071cd6907674453b07bae3" +dependencies = [ + "libloading", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "node_binding" +version = "0.0.0" +dependencies = [ + "async-trait", + "binding_options", + "dashmap", + "futures", + "mimalloc-rust", + "napi", + "napi-build", + "napi-derive", + "napi-sys", + "once_cell", + "rspack_binding_macros", + "rspack_binding_options", + "rspack_core", + "rspack_error", + "rspack_fs_node", + "rspack_identifier", + "rspack_napi_shared", + "rspack_tracing", + "rustc-hash", + "serde_json", + "tikv-jemallocator", + "tracing", +] + +[[package]] +name = "nodejs-resolver" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd06bcc5adab8de32fbbc8e975b364b537fd91e7ae5dfb9ae88fd15980c334b" +dependencies = [ + "daachorse", + "dashmap", + "dunce", + "indexmap 1.9.3", + "jsonc-parser", + "once_cell", + "path-absolutize", + "rustc-hash", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "normpath" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a9da8c9922c35a1033d76f7272dfc2e7ee20392083d75aeea6ced23c6266578" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.3", + "libc", +] + +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "outref" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + +[[package]] +name = "oxc_resolver" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9657cba6ac0894a8acf3aca5b9a4b7668ce8486042588cf2bf0f34eb5f37ebc6" +dependencies = [ + "dashmap", + "dunce", + "indexmap 2.0.2", + "once_cell", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "path-absolutize" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" +dependencies = [ + "path-dedot", +] + +[[package]] +name = "path-clean" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" + +[[package]] +name = "path-dedot" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" +dependencies = [ + "once_cell", +] + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pest" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "pest_meta" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.0.2", + "serde", + "serde_derive", +] + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_macros", + "phf_shared", + "proc-macro-hack", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "plugin_manifest" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", + "rspack_error", + "rspack_testing", + "tracing", +] + +[[package]] +name = "pmutil" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "portable-atomic" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "preset_env_base" +version = "0.4.5" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "ahash 0.8.6", + "anyhow", + "browserslist-rs", + "dashmap", + "from_variant", + "once_cell", + "semver 1.0.20", + "serde", + "st-map", + "tracing", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "radix_fmt" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "regress" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82a9ecfa0cb04d0b04dddb99b8ccf4f66bc8dfd23df694b398570bd8ae3a50fb" +dependencies = [ + "hashbrown 0.13.2", + "memchr", +] + +[[package]] +name = "relative-path" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c707298afce11da2efef2f600116fa93ffa7a032b5d7b628aa17711ec81383ca" + +[[package]] +name = "rend" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "rkyv" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" +dependencies = [ + "bitvec", + "bytecheck", + "hashbrown 0.12.3", + "indexmap 1.9.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ropey" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93411e420bcd1a75ddd1dc3caf18c23155eda2c090631a85af21ba19e97093b5" +dependencies = [ + "smallvec", + "str_indices", +] + +[[package]] +name = "rspack" +version = "0.1.0" +dependencies = [ + "cargo-rst", + "criterion", + "insta", + "mimalloc-rust", + "rspack_binding_options", + "rspack_core", + "rspack_fs", + "rspack_plugin_javascript", + "rspack_testing", + "rspack_tracing", + "serde", + "serde_json", + "testing_macros", + "tikv-jemallocator", + "tokio", + "ustr", + "xshell", +] + +[[package]] +name = "rspack-codespan-reporting" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc53b3a0e58f509a8b55bde278d44c05879f27a66819346e0fef193c6348e9f8" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "rspack_ast_viewer" +version = "0.1.0" +dependencies = [ + "anyhow", + "argh", + "regex", + "swc_core", + "swc_error_reporters", +] + +[[package]] +name = "rspack_base64" +version = "0.1.0" +dependencies = [ + "base64-simd", + "once_cell", + "regex", +] + +[[package]] +name = "rspack_binding_macros" +version = "0.1.0" + +[[package]] +name = "rspack_binding_options" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "better_scoped_tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "derivative", + "glob", + "napi", + "napi-derive", + "rspack_binding_macros", + "rspack_core", + "rspack_error", + "rspack_identifier", + "rspack_ids", + "rspack_loader_react_refresh", + "rspack_loader_runner", + "rspack_loader_sass", + "rspack_loader_swc", + "rspack_napi_shared", + "rspack_plugin_asset", + "rspack_plugin_banner", + "rspack_plugin_copy", + "rspack_plugin_css", + "rspack_plugin_dev_friendly_split_chunks", + "rspack_plugin_devtool", + "rspack_plugin_ensure_chunk_conditions", + "rspack_plugin_entry", + "rspack_plugin_externals", + "rspack_plugin_hmr", + "rspack_plugin_html", + "rspack_plugin_javascript", + "rspack_plugin_json", + "rspack_plugin_library", + "rspack_plugin_progress", + "rspack_plugin_real_content_hash", + "rspack_plugin_remove_empty_chunks", + "rspack_plugin_runtime", + "rspack_plugin_schemes", + "rspack_plugin_split_chunks", + "rspack_plugin_split_chunks_new", + "rspack_plugin_swc_css_minimizer", + "rspack_plugin_swc_js_minimizer", + "rspack_plugin_wasm", + "rspack_plugin_worker", + "rspack_regex", + "rspack_swc_visitors", + "rustc-hash", + "serde", + "serde_json", + "swc_core", + "tokio", + "tracing", +] + +[[package]] +name = "rspack_core" +version = "0.1.0" +dependencies = [ + "anyhow", + "anymap", + "async-recursion", + "async-trait", + "bitflags 1.3.2", + "dashmap", + "derivative", + "dyn-clone", + "futures", + "glob-match", + "hashlink", + "indexmap 1.9.3", + "itertools", + "mime_guess", + "nodejs-resolver", + "once_cell", + "oxc_resolver", + "paste", + "petgraph", + "rayon", + "regex", + "rkyv", + "rspack_database", + "rspack_error", + "rspack_fs", + "rspack_futures", + "rspack_hash", + "rspack_identifier", + "rspack_loader_runner", + "rspack_regex", + "rspack_sources", + "rspack_swc_visitors", + "rspack_util", + "rustc-hash", + "serde", + "serde_json", + "string_cache", + "sugar_path", + "swc_core", + "swc_emotion", + "swc_error_reporters", + "swc_node_comments", + "swc_plugin_import", + "tokio", + "tracing", + "url", + "ustr", +] + +[[package]] +name = "rspack_database" +version = "0.1.0" +dependencies = [ + "dashmap", + "once_cell", + "rayon", + "rustc-hash", +] + +[[package]] +name = "rspack_error" +version = "0.1.0" +dependencies = [ + "anyhow", + "futures", + "insta", + "rspack-codespan-reporting", + "rspack_binding_options", + "rspack_core", + "rspack_fs", + "rspack_testing", + "rspack_tracing", + "rspack_util", + "sugar_path", + "swc_core", + "termcolor", + "tokio", +] + +[[package]] +name = "rspack_fs" +version = "0.1.0" +dependencies = [ + "futures", + "rspack_error", + "tokio", +] + +[[package]] +name = "rspack_fs_node" +version = "0.1.0" +dependencies = [ + "futures", + "napi", + "napi-build", + "napi-derive", + "rspack_fs", + "rspack_napi_shared", +] + +[[package]] +name = "rspack_futures" +version = "0.1.0" +dependencies = [ + "async-scoped", +] + +[[package]] +name = "rspack_hash" +version = "0.1.0" +dependencies = [ + "data-encoding", + "md4", + "smol_str", + "xxhash-rust", +] + +[[package]] +name = "rspack_identifier" +version = "0.1.0" +dependencies = [ + "hashlink", + "serde", + "ustr", +] + +[[package]] +name = "rspack_ids" +version = "0.1.0" +dependencies = [ + "dashmap", + "itertools", + "once_cell", + "rayon", + "regex", + "rspack_core", + "rspack_error", + "rspack_util", + "rustc-hash", +] + +[[package]] +name = "rspack_loader_react_refresh" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", + "rspack_error", + "rspack_loader_runner", +] + +[[package]] +name = "rspack_loader_runner" +version = "0.1.0" +dependencies = [ + "async-recursion", + "async-trait", + "bitflags 1.3.2", + "derivative", + "once_cell", + "regex", + "rspack_error", + "rspack_identifier", + "rspack_sources", + "rustc-hash", + "serde_json", + "similar-asserts", + "tokio", +] + +[[package]] +name = "rspack_loader_sass" +version = "0.1.0" +dependencies = [ + "async-trait", + "indexmap 1.9.3", + "itertools", + "once_cell", + "regex", + "rspack_core", + "rspack_error", + "rspack_loader_runner", + "rspack_testing", + "sass-embedded", + "serde", + "str_indices", + "tokio", +] + +[[package]] +name = "rspack_loader_swc" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "either", + "indexmap 1.9.3", + "rspack_core", + "rspack_error", + "rspack_loader_runner", + "rspack_swc_visitors", + "rspack_testing", + "serde", + "serde_json", + "swc_config", + "swc_core", + "swc_emotion", + "swc_plugin_import", + "xxhash-rust", +] + +[[package]] +name = "rspack_napi_shared" +version = "0.1.0" +dependencies = [ + "napi", + "rspack_error", + "rspack_regex", + "tokio", +] + +[[package]] +name = "rspack_node" +version = "0.1.0" +dependencies = [ + "async-trait", + "dashmap", + "futures", + "mimalloc-rust", + "napi", + "napi-build", + "napi-derive", + "napi-sys", + "once_cell", + "rspack_binding_macros", + "rspack_binding_options", + "rspack_core", + "rspack_error", + "rspack_fs_node", + "rspack_identifier", + "rspack_napi_shared", + "rspack_tracing", + "rustc-hash", + "testing_macros", + "tikv-jemallocator", + "tracing", +] + +[[package]] +name = "rspack_plugin_asset" +version = "0.1.0" +dependencies = [ + "async-trait", + "mime_guess", + "rayon", + "rkyv", + "rspack_base64", + "rspack_core", + "rspack_error", + "rspack_hash", + "rspack_testing", + "rspack_util", + "serde_json", + "urlencoding", +] + +[[package]] +name = "rspack_plugin_banner" +version = "0.1.0" +dependencies = [ + "async-recursion", + "async-trait", + "futures", + "once_cell", + "regex", + "rspack_core", + "rspack_error", + "rspack_regex", + "rspack_util", +] + +[[package]] +name = "rspack_plugin_copy" +version = "0.1.0" +dependencies = [ + "async-trait", + "dashmap", + "glob", + "lazy_static", + "pathdiff", + "regex", + "rspack_core", + "rspack_error", + "rspack_futures", + "rspack_hash", + "rspack_testing", + "sugar_path", + "testing_macros", + "tokio", + "tracing", +] + +[[package]] +name = "rspack_plugin_css" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 1.3.2", + "heck", + "hrx-parser", + "indexmap 1.9.3", + "insta", + "once_cell", + "rayon", + "regex", + "rkyv", + "rspack_core", + "rspack_error", + "rspack_hash", + "rspack_identifier", + "rspack_testing", + "rustc-hash", + "serde", + "serde_json", + "sugar_path", + "swc_core", + "tracing", + "urlencoding", +] + +[[package]] +name = "rspack_plugin_dev_friendly_split_chunks" +version = "0.1.0" +dependencies = [ + "async-trait", + "dashmap", + "rayon", + "rspack_core", + "rspack_identifier", +] + +[[package]] +name = "rspack_plugin_devtool" +version = "0.1.0" +dependencies = [ + "async-trait", + "dashmap", + "once_cell", + "pathdiff", + "rayon", + "regex", + "rspack_base64", + "rspack_core", + "rspack_error", + "rspack_util", + "rustc-hash", + "serde_json", +] + +[[package]] +name = "rspack_plugin_ensure_chunk_conditions" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", + "rspack_error", +] + +[[package]] +name = "rspack_plugin_entry" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", +] + +[[package]] +name = "rspack_plugin_externals" +version = "0.1.0" +dependencies = [ + "async-trait", + "once_cell", + "regex", + "rspack_core", + "rspack_error", + "rspack_regex", +] + +[[package]] +name = "rspack_plugin_hmr" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", + "rspack_error", + "rspack_hash", + "rspack_identifier", + "rspack_plugin_runtime", + "rustc-hash", + "serde_json", +] + +[[package]] +name = "rspack_plugin_html" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "dojang", + "itertools", + "rayon", + "regex", + "rspack_base64", + "rspack_core", + "rspack_error", + "rspack_testing", + "schemars", + "serde", + "serde_json", + "sha2", + "sugar_path", + "swc_core", + "swc_html", + "swc_html_minifier", +] + +[[package]] +name = "rspack_plugin_javascript" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-recursion", + "async-trait", + "either", + "indexmap 1.9.3", + "linked_hash_set", + "once_cell", + "preset_env_base", + "rayon", + "regex", + "rspack_core", + "rspack_error", + "rspack_hash", + "rspack_identifier", + "rspack_regex", + "rspack_swc_visitors", + "rspack_testing", + "rustc-hash", + "serde_json", + "sourcemap", + "sugar_path", + "swc_core", + "swc_emotion", + "swc_node_comments", + "swc_plugin_import", + "url", + "xxhash-rust", +] + +[[package]] +name = "rspack_plugin_json" +version = "0.1.0" +dependencies = [ + "json", + "ropey", + "rspack_core", + "rspack_error", + "rspack_testing", +] + +[[package]] +name = "rspack_plugin_library" +version = "0.1.0" +dependencies = [ + "once_cell", + "regex", + "rspack_core", + "rspack_error", + "rspack_identifier", + "serde_json", +] + +[[package]] +name = "rspack_plugin_progress" +version = "0.1.0" +dependencies = [ + "async-trait", + "indicatif", + "rspack_core", + "rspack_error", +] + +[[package]] +name = "rspack_plugin_real_content_hash" +version = "0.1.0" +dependencies = [ + "async-trait", + "derivative", + "indexmap 1.9.3", + "once_cell", + "rayon", + "regex", + "rspack_core", + "rspack_hash", + "rustc-hash", +] + +[[package]] +name = "rspack_plugin_remove_empty_chunks" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", +] + +[[package]] +name = "rspack_plugin_runtime" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "itertools", + "rayon", + "rspack_core", + "rspack_error", + "rspack_hash", + "rspack_identifier", + "rspack_plugin_javascript", + "rustc-hash", + "serde_json", +] + +[[package]] +name = "rspack_plugin_schemes" +version = "0.1.0" +dependencies = [ + "async-trait", + "once_cell", + "regex", + "rspack_base64", + "rspack_core", + "rspack_error", + "url", + "urlencoding", +] + +[[package]] +name = "rspack_plugin_split_chunks" +version = "0.1.0" +dependencies = [ + "async-trait", + "derivative", + "rspack_core", + "rspack_identifier", + "rspack_util", + "rustc-hash", + "tracing", +] + +[[package]] +name = "rspack_plugin_split_chunks_new" +version = "0.1.0" +dependencies = [ + "async-scoped", + "async-trait", + "dashmap", + "derivative", + "futures-util", + "rayon", + "rspack_core", + "rspack_identifier", + "rspack_regex", + "rspack_util", + "rustc-hash", + "tracing", +] + +[[package]] +name = "rspack_plugin_swc_css_minimizer" +version = "0.1.0" +dependencies = [ + "async-trait", + "rayon", + "rspack_core", + "rspack_error", + "rspack_plugin_css", +] + +[[package]] +name = "rspack_plugin_swc_js_minimizer" +version = "0.1.0" +dependencies = [ + "async-recursion", + "async-trait", + "rayon", + "regex", + "rspack_core", + "rspack_error", + "rspack_plugin_javascript", + "rspack_regex", + "rspack_util", + "swc_config", + "swc_core", + "swc_ecma_minifier", +] + +[[package]] +name = "rspack_plugin_wasm" +version = "0.1.0" +dependencies = [ + "async-trait", + "dashmap", + "indexmap 1.9.3", + "rayon", + "rspack_core", + "rspack_error", + "rspack_identifier", + "rspack_plugin_runtime", + "rspack_testing", + "serde_json", + "swc_core", + "wasmparser", +] + +[[package]] +name = "rspack_plugin_worker" +version = "0.1.0" +dependencies = [ + "rspack_core", + "rspack_plugin_runtime", + "rspack_plugin_wasm", +] + +[[package]] +name = "rspack_regex" +version = "0.1.0" +dependencies = [ + "regex-syntax 0.7.5", + "regress", + "rspack_error", + "swc_core", +] + +[[package]] +name = "rspack_sources" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a741e3d5c1b73996bad4beeefb8aa0bbffad40ba4f0c4b09080265c11bd7bd" +dependencies = [ + "dashmap", + "dyn-clone", + "memchr", + "once_cell", + "parking_lot 0.12.1", + "rustc-hash", + "serde", + "serde_json", + "smallvec", + "str_indices", + "substring", +] + +[[package]] +name = "rspack_swc_visitors" +version = "0.1.0" +dependencies = [ + "indexmap 1.9.3", + "once_cell", + "regex", + "serde", + "swc_core", + "swc_emotion", + "swc_plugin_import", +] + +[[package]] +name = "rspack_testing" +version = "0.1.0" +dependencies = [ + "async-trait", + "cargo-rst", + "insta", + "itertools", + "rspack_binding_options", + "rspack_core", + "rspack_error", + "rspack_fs", + "rspack_ids", + "rspack_loader_runner", + "rspack_loader_sass", + "rspack_loader_swc", + "rspack_plugin_asset", + "rspack_plugin_css", + "rspack_plugin_dev_friendly_split_chunks", + "rspack_plugin_devtool", + "rspack_plugin_entry", + "rspack_plugin_externals", + "rspack_plugin_hmr", + "rspack_plugin_html", + "rspack_plugin_javascript", + "rspack_plugin_json", + "rspack_plugin_library", + "rspack_plugin_remove_empty_chunks", + "rspack_plugin_runtime", + "rspack_plugin_wasm", + "rspack_regex", + "rspack_tracing", + "schemars", + "serde", + "serde_json", + "swc_core", + "testing_macros", + "tokio", +] + +[[package]] +name = "rspack_tracing" +version = "0.1.0" +dependencies = [ + "tracing", + "tracing-chrome", + "tracing-subscriber", +] + +[[package]] +name = "rspack_util" +version = "0.1.0" +dependencies = [ + "concat-string", + "once_cell", + "regex", + "sugar_path", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "ryu-js" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "sass-embedded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043fea16ac00f7132b50dce6094873fee0d328bd43c0f552faeb33d989d97b77" +dependencies = [ + "atty", + "crossbeam-channel", + "dashmap", + "parking_lot 0.12.1", + "prost", + "regex", + "rustc-hash", + "serde", + "serde_json", + "url", + "urlencoding", +] + +[[package]] +name = "schemars" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.109", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +dependencies = [ + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "serde_derive_internals" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "serde_json" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +dependencies = [ + "indexmap 2.0.2", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "similar" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" +dependencies = [ + "bstr", + "unicode-segmentation", +] + +[[package]] +name = "similar-asserts" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e041bb827d1bfca18f213411d51b665309f1afb37a04a5d1464530e13779fc0f" +dependencies = [ + "console", + "similar", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "smartstring" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" +dependencies = [ + "autocfg", + "static_assertions", + "version_check", +] + +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + +[[package]] +name = "smol_str" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" +dependencies = [ + "serde", +] + +[[package]] +name = "sourcemap" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4cbf65ca7dc576cf50e21f8d0712d96d4fcfd797389744b7b222a85cdf5bd90" +dependencies = [ + "data-encoding", + "debugid", + "if_chain", + "rustc_version", + "serde", + "serde_json", + "unicode-id", + "url", +] + +[[package]] +name = "st-map" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f352d5d14be5a1f956d76ae0c8060c3487aaa2a080f10a4b4ff023c7c05a9047" +dependencies = [ + "arrayvec", + "static-map-macro", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + +[[package]] +name = "static-map-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7628ae0bd92555d3de4303da41a5c8b1c5363e892001325f34e4be9ed024d0d7" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "str_indices" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8eeaedde8e50d8a331578c9fa9a288df146ce5e16173ad26ce82f6e263e2be4" + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot 0.12.1", + "phf_shared", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + +[[package]] +name = "string_enum" +version = "0.4.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg", +] + +[[package]] +name = "sugar_path" +version = "0.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c23ada2c5165fc936136721f5f69c8dac6eceb5407de40262f32934510bd7b9" +dependencies = [ + "once_cell", +] + +[[package]] +name = "supports-color" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f" +dependencies = [ + "atty", + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406" +dependencies = [ + "atty", +] + +[[package]] +name = "supports-unicode" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2" +dependencies = [ + "atty", +] + +[[package]] +name = "swc" +version = "0.266.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "anyhow", + "base64", + "dashmap", + "either", + "indexmap 1.9.3", + "jsonc-parser", + "lru", + "once_cell", + "parking_lot 0.12.1", + "pathdiff", + "regex", + "rustc-hash", + "serde", + "serde_json", + "sourcemap", + "swc_atoms", + "swc_cached", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_ext_transforms", + "swc_ecma_lints", + "swc_ecma_loader", + "swc_ecma_minifier", + "swc_ecma_parser", + "swc_ecma_preset_env", + "swc_ecma_transforms", + "swc_ecma_transforms_base", + "swc_ecma_transforms_compat", + "swc_ecma_transforms_optimization", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_error_reporters", + "swc_node_comments", + "swc_timer", + "swc_visit", + "tracing", + "url", +] + +[[package]] +name = "swc_atoms" +version = "0.5.9" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "once_cell", + "rustc-hash", + "serde", + "string_cache", + "string_cache_codegen", + "triomphe", +] + +[[package]] +name = "swc_cached" +version = "0.3.17" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "ahash 0.8.6", + "anyhow", + "dashmap", + "once_cell", + "regex", + "serde", +] + +[[package]] +name = "swc_common" +version = "0.32.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "ahash 0.8.6", + "ast_node", + "atty", + "better_scoped_tls 0.1.1 (git+https://github.com/swc-project/swc.git?rev=5c00525)", + "cfg-if", + "either", + "from_variant", + "new_debug_unreachable", + "num-bigint", + "once_cell", + "parking_lot 0.12.1", + "rustc-hash", + "serde", + "siphasher", + "sourcemap", + "string_cache", + "swc_atoms", + "swc_eq_ignore_macros", + "swc_visit", + "termcolor", + "tracing", + "unicode-width", + "url", +] + +[[package]] +name = "swc_config" +version = "0.1.7" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "indexmap 1.9.3", + "serde", + "serde_json", + "swc_config_macro", +] + +[[package]] +name = "swc_config_macro" +version = "0.1.2" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "swc_core" +version = "0.83.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "swc", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_codegen", + "swc_css_compat", + "swc_css_minifier", + "swc_css_modules", + "swc_css_parser", + "swc_css_prefixer", + "swc_css_utils", + "swc_css_visit", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_parser", + "swc_ecma_preset_env", + "swc_ecma_quote_macros", + "swc_ecma_transforms_base", + "swc_ecma_transforms_compat", + "swc_ecma_transforms_module", + "swc_ecma_transforms_optimization", + "swc_ecma_transforms_proposal", + "swc_ecma_transforms_react", + "swc_ecma_transforms_typescript", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "vergen", +] + +[[package]] +name = "swc_css_ast" +version = "0.139.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "is-macro", + "string_enum", + "swc_atoms", + "swc_common", +] + +[[package]] +name = "swc_css_codegen" +version = "0.149.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "auto_impl", + "bitflags 2.4.1", + "rustc-hash", + "serde", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_codegen_macros", + "swc_css_utils", +] + +[[package]] +name = "swc_css_codegen_macros" +version = "0.2.2" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "swc_css_compat" +version = "0.25.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "bitflags 2.4.1", + "once_cell", + "serde", + "serde_json", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_utils", + "swc_css_visit", +] + +[[package]] +name = "swc_css_minifier" +version = "0.114.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_utils", + "swc_css_visit", +] + +[[package]] +name = "swc_css_modules" +version = "0.27.2" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "rustc-hash", + "serde", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_codegen", + "swc_css_parser", + "swc_css_visit", +] + +[[package]] +name = "swc_css_parser" +version = "0.148.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "lexical", + "serde", + "swc_atoms", + "swc_common", + "swc_css_ast", +] + +[[package]] +name = "swc_css_prefixer" +version = "0.151.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "once_cell", + "preset_env_base", + "serde", + "serde_json", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_utils", + "swc_css_visit", +] + +[[package]] +name = "swc_css_utils" +version = "0.136.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "once_cell", + "serde", + "serde_json", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_visit", +] + +[[package]] +name = "swc_css_visit" +version = "0.138.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_visit", +] + +[[package]] +name = "swc_ecma_ast" +version = "0.109.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "bitflags 2.4.1", + "is-macro", + "num-bigint", + "scoped-tls", + "serde", + "string_enum", + "swc_atoms", + "swc_common", + "unicode-id", +] + +[[package]] +name = "swc_ecma_codegen" +version = "0.145.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "memchr", + "num-bigint", + "once_cell", + "rustc-hash", + "serde", + "sourcemap", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_codegen_macros", + "tracing", +] + +[[package]] +name = "swc_ecma_codegen_macros" +version = "0.7.3" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "swc_ecma_ext_transforms" +version = "0.109.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "phf", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_lints" +version = "0.88.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "auto_impl", + "dashmap", + "parking_lot 0.12.1", + "rayon", + "regex", + "serde", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_loader" +version = "0.44.3" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "anyhow", + "dashmap", + "lru", + "normpath", + "once_cell", + "parking_lot 0.12.1", + "path-clean", + "pathdiff", + "serde", + "serde_json", + "swc_cached", + "swc_common", + "tracing", +] + +[[package]] +name = "swc_ecma_minifier" +version = "0.187.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "arrayvec", + "indexmap 1.9.3", + "num-bigint", + "num_cpus", + "once_cell", + "parking_lot 0.12.1", + "radix_fmt", + "rayon", + "regex", + "rustc-hash", + "ryu-js", + "serde", + "serde_json", + "swc_atoms", + "swc_cached", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_parser", + "swc_ecma_transforms_base", + "swc_ecma_transforms_optimization", + "swc_ecma_usage_analyzer", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_timer", + "tracing", +] + +[[package]] +name = "swc_ecma_parser" +version = "0.140.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "either", + "num-bigint", + "num-traits", + "serde", + "smallvec", + "smartstring", + "stacker", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "tracing", + "typed-arena", +] + +[[package]] +name = "swc_ecma_preset_env" +version = "0.201.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "anyhow", + "dashmap", + "indexmap 1.9.3", + "once_cell", + "preset_env_base", + "rustc-hash", + "semver 1.0.20", + "serde", + "serde_json", + "st-map", + "string_enum", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_quote_macros" +version = "0.51.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "anyhow", + "pmutil", + "proc-macro2", + "quote", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "swc_ecma_transforms" +version = "0.224.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_compat", + "swc_ecma_transforms_module", + "swc_ecma_transforms_optimization", + "swc_ecma_transforms_proposal", + "swc_ecma_transforms_react", + "swc_ecma_transforms_typescript", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_transforms_base" +version = "0.133.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "better_scoped_tls 0.1.1 (git+https://github.com/swc-project/swc.git?rev=5c00525)", + "bitflags 2.4.1", + "indexmap 1.9.3", + "once_cell", + "phf", + "rayon", + "rustc-hash", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_utils", + "swc_ecma_visit", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_classes" +version = "0.122.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_transforms_compat" +version = "0.159.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "arrayvec", + "indexmap 1.9.3", + "is-macro", + "num-bigint", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_macros" +version = "0.5.3" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "swc_ecma_transforms_module" +version = "0.176.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "Inflector", + "anyhow", + "bitflags 2.4.1", + "indexmap 1.9.3", + "is-macro", + "path-clean", + "pathdiff", + "regex", + "serde", + "swc_atoms", + "swc_cached", + "swc_common", + "swc_ecma_ast", + "swc_ecma_loader", + "swc_ecma_parser", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_optimization" +version = "0.193.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "dashmap", + "indexmap 1.9.3", + "once_cell", + "petgraph", + "rayon", + "rustc-hash", + "serde_json", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_fast_graph", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_proposal" +version = "0.167.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "either", + "rustc-hash", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_transforms_react" +version = "0.179.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "base64", + "dashmap", + "indexmap 1.9.3", + "once_cell", + "serde", + "sha-1", + "string_enum", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_transforms_typescript" +version = "0.183.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_react", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_usage_analyzer" +version = "0.19.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "indexmap 1.9.3", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_timer", + "tracing", +] + +[[package]] +name = "swc_ecma_utils" +version = "0.123.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "indexmap 1.9.3", + "num_cpus", + "once_cell", + "rayon", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_visit", + "tracing", + "unicode-id", +] + +[[package]] +name = "swc_ecma_visit" +version = "0.95.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "num-bigint", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_visit", + "tracing", +] + +[[package]] +name = "swc_emotion" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13abda43ddbc94149aca923fb331f13b90e70f7cc2fb54662ee4a2c51cb59b22" +dependencies = [ + "base64", + "byteorder", + "fxhash", + "once_cell", + "radix_fmt", + "regex", + "serde", + "sourcemap", + "swc_core", + "tracing", +] + +[[package]] +name = "swc_eq_ignore_macros" +version = "0.1.2" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "swc_error_reporters" +version = "0.16.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "anyhow", + "miette", + "once_cell", + "parking_lot 0.12.1", + "swc_common", +] + +[[package]] +name = "swc_fast_graph" +version = "0.20.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "indexmap 1.9.3", + "petgraph", + "rustc-hash", + "swc_common", +] + +[[package]] +name = "swc_html" +version = "0.131.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "swc_html_ast", + "swc_html_codegen", + "swc_html_parser", + "swc_html_visit", +] + +[[package]] +name = "swc_html_ast" +version = "0.32.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "is-macro", + "string_enum", + "swc_atoms", + "swc_common", +] + +[[package]] +name = "swc_html_codegen" +version = "0.41.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "auto_impl", + "bitflags 2.4.1", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_html_ast", + "swc_html_codegen_macros", + "swc_html_utils", +] + +[[package]] +name = "swc_html_codegen_macros" +version = "0.2.2" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "swc_html_minifier" +version = "0.128.0" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "once_cell", + "serde", + "serde_json", + "swc_atoms", + "swc_cached", + "swc_common", + "swc_css_ast", + "swc_css_codegen", + "swc_css_minifier", + "swc_css_parser", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_minifier", + "swc_ecma_parser", + "swc_ecma_transforms_base", + "swc_ecma_visit", + "swc_html_ast", + "swc_html_codegen", + "swc_html_parser", + "swc_html_utils", + "swc_html_visit", +] + +[[package]] +name = "swc_html_parser" +version = "0.38.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_html_ast", + "swc_html_utils", +] + +[[package]] +name = "swc_html_utils" +version = "0.17.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "once_cell", + "serde", + "serde_json", + "swc_atoms", + "swc_common", +] + +[[package]] +name = "swc_html_visit" +version = "0.32.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_html_ast", + "swc_visit", +] + +[[package]] +name = "swc_macros_common" +version = "0.3.8" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "swc_node_comments" +version = "0.19.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "dashmap", + "swc_atoms", + "swc_common", +] + +[[package]] +name = "swc_plugin_import" +version = "0.1.5" +dependencies = [ + "handlebars", + "rustc-hash", + "serde", + "swc_core", +] + +[[package]] +name = "swc_timer" +version = "0.20.1" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "tracing", +] + +[[package]] +name = "swc_trace_macro" +version = "0.1.3" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "swc_visit" +version = "0.5.7" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "either", + "swc_visit_macros", +] + +[[package]] +name = "swc_visit_macros" +version = "0.5.8" +source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +dependencies = [ + "Inflector", + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.38", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "termcolor" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "terminal_size" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "testing_macros" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1c15b796025051a07f1ac695ee0cac0883f05a0d510c9d171ef8d31a992e6a5" +dependencies = [ + "anyhow", + "glob", + "once_cell", + "pmutil", + "proc-macro2", + "quote", + "regex", + "relative-path", + "syn 2.0.38", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "textwrap" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tikv-jemalloc-sys" +version = "0.5.4+5.3.0-patched" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +dependencies = [ + "backtrace", + "num_cpus", + "parking_lot 0.12.1", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "tracing-chrome" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "496b3cd5447f7ff527bbbf19b071ad542a000adf297d4127078b4dfdb931f41a" +dependencies = [ + "serde_json", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "triomphe" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee8098afad3fb0c54a9007aab6804558410503ad676d4633f9c2559a00ac0f" +dependencies = [ + "serde", + "stable_deref_trait", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-id" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "ustr" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "371436099f2980de56dc385b615696d3eabbdac9649a72b85f9d75f68474fa9c" +dependencies = [ + "ahash 0.7.7", + "byteorder", + "lazy_static", + "parking_lot 0.11.2", + "serde", +] + +[[package]] +name = "utf8-width" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" + +[[package]] +name = "uuid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vergen" +version = "7.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21b881cd6636ece9735721cf03c1fe1e774fe258683d084bb2812ab67435749" +dependencies = [ + "anyhow", + "cfg-if", + "enum-iterator", + "getset", + "rustversion", + "thiserror", + "time", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "wasmparser" +version = "0.102.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" +dependencies = [ + "indexmap 1.9.3", + "url", +] + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "xshell" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2107fe03e558353b4c71ad7626d58ed82efaf56c54134228608893c77023ad" +dependencies = [ + "xshell-macros", +] + +[[package]] +name = "xshell-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e2c411759b501fb9501aac2b1b2d287a6e93e5bdcf13c25306b23e1b716dd0e" + +[[package]] +name = "xxhash-rust" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "zerocopy" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd66a62464e3ffd4e37bd09950c2b9dd6c4f8767380fabba0d523f9a775bc85a" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "255c4596d41e6916ced49cfafea18727b24d67878fa180ddfd69b9df34fd1726" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index ee18f30..f41687a 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -1,6 +1,6 @@ [package] edition = "2021" -name = "ice_pack_binding" +name = "node_binding" version = "0.0.0" [lib] diff --git a/crates/node_binding/index.d.ts b/crates/node_binding/index.d.ts index dc3c717..591c15f 100644 --- a/crates/node_binding/index.d.ts +++ b/crates/node_binding/index.d.ts @@ -1,6 +1,7 @@ -/* auto-generated by NAPI-RS */ +/* tslint:disable */ /* eslint-disable */ +/* auto-generated by NAPI-RS */ export class ExternalObject { readonly '': { @@ -8,534 +9,173 @@ export class ExternalObject { [K: symbol]: T } } -export class JsCompilation { - updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void - getAssets(): Readonly[] - getAsset(name: string): JsAsset | null - getAssetSource(name: string): JsCompatSource | null - getModules(): Array - getChunks(): Array - getNamedChunk(name: string): JsChunk | null - /** - * Only available for those none Js and Css source, - * return true if set module source successfully, false if failed. - */ - setNoneAstModuleSource(moduleIdentifier: string, source: JsCompatSource): boolean - setAssetSource(name: string, source: JsCompatSource): void - deleteAssetSource(name: string): void - getAssetFilenames(): Array - hasAsset(name: string): boolean - emitAsset(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void - deleteAsset(filename: string): void - get entrypoints(): Record - get hash(): string | null - getFileDependencies(): Array - getContextDependencies(): Array - getMissingDependencies(): Array - getBuildDependencies(): Array - pushDiagnostic(severity: "error" | "warning", title: string, message: string): void - pushNativeDiagnostics(diagnostics: ExternalObject>): void - getStats(): JsStats - getAssetPath(filename: string, data: PathData): string - getAssetPathWithInfo(filename: string, data: PathData): PathWithInfo - getPath(filename: string, data: PathData): string - getPathWithInfo(filename: string, data: PathData): PathWithInfo - addFileDependencies(deps: Array): void - addContextDependencies(deps: Array): void - addMissingDependencies(deps: Array): void - addBuildDependencies(deps: Array): void - rebuildModule(moduleIdentifiers: Array, f: (...args: any[]) => any): void -} - -export class JsStats { - getAssets(): JsStatsGetAssets - getModules(reasons: boolean, moduleAssets: boolean, nestedModules: boolean, source: boolean): Array - getChunks(chunkModules: boolean, chunksRelations: boolean, reasons: boolean, moduleAssets: boolean, nestedModules: boolean, source: boolean): Array - getEntrypoints(): Array - getNamedChunkGroups(): Array - getErrors(): Array - getWarnings(): Array - getLogging(acceptedTypes: number): Array - getHash(): string -} - -export class Rspack { - constructor(options: RSPackRawOptions, builtinPlugins: Array, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any) - unsafe_set_disabled_hooks(hooks: Array): void - /** - * Build with the given option passed to the constructor - * - * Warning: - * Calling this method recursively might cause a deadlock. - */ - unsafe_build(callback: (err: null | Error) => void): void - /** - * Rebuild with the given option passed to the constructor - * - * Warning: - * Calling this method recursively will cause a deadlock. - */ - unsafe_rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void - /** - * Get the last compilation - * - * Warning: - * - * Calling this method under the build or rebuild method might cause a deadlock. - * - * **Note** that this method is not safe if you cache the _JsCompilation_ on the Node side, as it will be invalidated by the next build and accessing a dangling ptr is a UB. - */ - unsafe_last_compilation(f: (arg0: JsCompilation) => void): void - /** - * Destroy the compiler - * - * Warning: - * - * Anything related to this compiler will be invalidated after this method is called. - */ - unsafe_drop(): void -} - -export interface AfterResolveData { - request: string - context: string - fileDependencies: Array - contextDependencies: Array - missingDependencies: Array - factoryMeta: FactoryMeta +export interface NodeFS { + writeFile: (...args: any[]) => any + removeFile: (...args: any[]) => any + mkdir: (...args: any[]) => any + mkdirp: (...args: any[]) => any } - -export interface BeforeResolveData { - request: string - context: string +export interface ThreadsafeNodeFS { + writeFile: (...args: any[]) => any + removeFile: (...args: any[]) => any + mkdir: (...args: any[]) => any + mkdirp: (...args: any[]) => any + removeDirAll: (...args: any[]) => any } - -export interface BuiltinPlugin { - name: BuiltinPluginName - options: unknown +export interface JsChunk { + name?: string + files: Array } - -export const enum BuiltinPluginName { - DefinePlugin = 'DefinePlugin', - ProvidePlugin = 'ProvidePlugin', - BannerPlugin = 'BannerPlugin', - ProgressPlugin = 'ProgressPlugin', - EntryPlugin = 'EntryPlugin', - ExternalsPlugin = 'ExternalsPlugin', - NodeTargetPlugin = 'NodeTargetPlugin', - ElectronTargetPlugin = 'ElectronTargetPlugin', - EnableChunkLoadingPlugin = 'EnableChunkLoadingPlugin', - EnableLibraryPlugin = 'EnableLibraryPlugin', - EnableWasmLoadingPlugin = 'EnableWasmLoadingPlugin', - CommonJsChunkFormatPlugin = 'CommonJsChunkFormatPlugin', - ArrayPushCallbackChunkFormatPlugin = 'ArrayPushCallbackChunkFormatPlugin', - ModuleChunkFormatPlugin = 'ModuleChunkFormatPlugin', - HotModuleReplacementPlugin = 'HotModuleReplacementPlugin', - HttpExternalsRspackPlugin = 'HttpExternalsRspackPlugin', - CopyRspackPlugin = 'CopyRspackPlugin', - HtmlRspackPlugin = 'HtmlRspackPlugin', - SwcJsMinimizerRspackPlugin = 'SwcJsMinimizerRspackPlugin', - SwcCssMinimizerRspackPlugin = 'SwcCssMinimizerRspackPlugin' +export interface JsChunkAssetArgs { + chunk: JsChunk + filename: string } - -export function cleanupGlobalTrace(): void - -export interface FactoryMeta { - sideEffectFree?: boolean +export interface RawBannerRule { + type: "string" | "regexp" + stringMatcher?: string + regexpMatcher?: string } - -export interface JsAsset { - name: string - source?: JsCompatSource - info: JsAssetInfo +export interface RawBannerRules { + type: "string" | "regexp" | "array" + stringMatcher?: string + regexpMatcher?: string + arrayMatcher?: Array } - -export interface JsAssetEmittedArgs { +export interface RawBannerContentFnCtx { + hash: string + chunk: JsChunk filename: string - outputPath: string - targetPath: string -} - -export interface JsAssetInfo { - /** if the asset can be long term cached forever (contains a hash) */ - immutable: boolean - /** whether the asset is minimized */ - minimized: boolean - /** - * the value(s) of the full hash used for this asset - * the value(s) of the chunk hash used for this asset - */ - chunkHash: Array - /** - * the value(s) of the module hash used for this asset - * the value(s) of the content hash used for this asset - */ - contentHash: Array - /** - * when asset was created from a source file (potentially transformed), the original filename relative to compilation context - * size in bytes, only set after asset has been emitted - * when asset is only used for development and doesn't count towards user-facing assets - */ - development: boolean - /** when asset ships data for updating an existing application (HMR) */ - hotModuleReplacement: boolean - /** - * when asset is javascript and an ESM - * related object to other assets, keyed by type of relation (only points from parent to child) - */ - related: JsAssetInfoRelated - /** - * the asset version, emit can be skipped when both filename and version are the same - * An empty string means no version, it will always emit - */ - version: string } - -export interface JsAssetInfoRelated { - sourceMap?: string +export interface RawBannerContent { + type: "string" | "function" + stringPayload?: string + fnPayload?: (...args: any[]) => any } - -export interface JsChunk { - name?: string - files: Array +export interface RawBannerPluginOptions { + banner: RawBannerContent + entryOnly?: boolean + footer?: boolean + raw?: boolean + test?: RawBannerRules + include?: RawBannerRules + exclude?: RawBannerRules } - -export interface JsChunkAssetArgs { - chunk: JsChunk - filename: string +export interface RawCopyPattern { + from: string + to?: string + context?: string + toType?: string + noErrorOnMissing: boolean + force: boolean + priority: number + globOptions: RawCopyGlobOptions } - -export interface JsChunkGroup { - chunks: Array +export interface RawCopyGlobOptions { + caseSensitiveMatch?: boolean + dot?: boolean + ignore?: Array } - -export interface JsCompatSource { - /** Whether the underlying data structure is a `RawSource` */ - isRaw: boolean - /** Whether the underlying value is a buffer or string */ - isBuffer: boolean - source: Buffer - map?: Buffer +export interface RawCopyRspackPluginOptions { + patterns: Array } - -export interface JsHooks { - processAssetsStageAdditional: (...args: any[]) => any - processAssetsStagePreProcess: (...args: any[]) => any - processAssetsStageDerived: (...args: any[]) => any - processAssetsStageAdditions: (...args: any[]) => any - processAssetsStageNone: (...args: any[]) => any - processAssetsStageOptimize: (...args: any[]) => any - processAssetsStageOptimizeCount: (...args: any[]) => any - processAssetsStageOptimizeCompatibility: (...args: any[]) => any - processAssetsStageOptimizeSize: (...args: any[]) => any - processAssetsStageDevTooling: (...args: any[]) => any - processAssetsStageOptimizeInline: (...args: any[]) => any - processAssetsStageSummarize: (...args: any[]) => any - processAssetsStageOptimizeHash: (...args: any[]) => any - processAssetsStageOptimizeTransfer: (...args: any[]) => any - processAssetsStageAnalyse: (...args: any[]) => any - processAssetsStageReport: (...args: any[]) => any - compilation: (...args: any[]) => any - thisCompilation: (...args: any[]) => any - emit: (...args: any[]) => any - assetEmitted: (...args: any[]) => any - afterEmit: (...args: any[]) => any - make: (...args: any[]) => any - optimizeModules: (...args: any[]) => any - optimizeTree: (...args: any[]) => any - optimizeChunkModule: (...args: any[]) => any - beforeCompile: (...args: any[]) => any - afterCompile: (...args: any[]) => any - finishModules: (...args: any[]) => any - finishMake: (...args: any[]) => any - buildModule: (...args: any[]) => any - beforeResolve: (...args: any[]) => any - afterResolve: (...args: any[]) => any - contextModuleBeforeResolve: (...args: any[]) => any - normalModuleFactoryResolveForScheme: (...args: any[]) => any - chunkAsset: (...args: any[]) => any - succeedModule: (...args: any[]) => any - stillValidModule: (...args: any[]) => any -} - -export interface JsLoaderContext { - /** Content maybe empty in pitching stage */ - content?: Buffer - additionalData?: Buffer - sourceMap?: Buffer - resource: string - resourcePath: string - resourceQuery?: string - resourceFragment?: string - cacheable: boolean - fileDependencies: Array - contextDependencies: Array - missingDependencies: Array - buildDependencies: Array - assetFilenames: Array - currentLoader: string - isPitching: boolean - /** - * Internal loader context - * @internal - */ - context: ExternalObject - /** - * Internal loader diagnostic - * @internal - */ - diagnostics: ExternalObject> -} - -export interface JsLoaderResult { - /** Content in pitching stage can be empty */ - content?: Buffer - fileDependencies: Array - contextDependencies: Array - missingDependencies: Array - buildDependencies: Array - sourceMap?: Buffer - additionalData?: Buffer - cacheable: boolean - /** Used to instruct how rust loaders should execute */ - isPitching: boolean -} - -export interface JsModule { - originalSource?: JsCompatSource - resource: string - moduleIdentifier: string -} - -export interface JsResolveForSchemeInput { - resourceData: JsResourceData - scheme: string -} - -export interface JsResolveForSchemeResult { - resourceData: JsResourceData - stop: boolean -} - -export interface JsResourceData { - /** Resource with absolute path, query and fragment */ - resource: string - /** Absolute resource path only */ - path: string - /** Resource query with `?` prefix */ - query?: string - /** Resource fragment with `#` prefix */ - fragment?: string -} - -export interface JsStatsAsset { - type: string - name: string - size: number - chunks: Array - chunkNames: Array - info: JsStatsAssetInfo - emitted: boolean -} - -export interface JsStatsAssetInfo { - development: boolean - hotModuleReplacement: boolean -} - -export interface JsStatsAssetsByChunkName { - name: string - files: Array -} - -export interface JsStatsChunk { - type: string - files: Array - auxiliaryFiles: Array - id: string - entry: boolean - initial: boolean - names: Array - size: number - modules?: Array - parents?: Array - children?: Array - siblings?: Array -} - -export interface JsStatsChunkGroup { - name: string - assets: Array - chunks: Array - assetsSize: number -} - -export interface JsStatsChunkGroupAsset { - name: string - size: number -} - -export interface JsStatsError { - message: string - formatted: string - title: string -} - -export interface JsStatsGetAssets { - assets: Array - assetsByChunkName: Array -} - -export interface JsStatsLogging { - name: string - type: string - args?: Array - trace?: Array -} - -export interface JsStatsMillisecond { - secs: number - subsecMillis: number -} - -export interface JsStatsModule { - type: string - moduleType: string - identifier: string - name: string - id?: string - chunks: Array - size: number - issuer?: string - issuerName?: string - issuerId?: string - issuerPath: Array - nameForCondition?: string - reasons?: Array - assets?: Array - source?: string | Buffer - profile?: JsStatsModuleProfile -} - -export interface JsStatsModuleIssuer { - identifier: string - name: string - id?: string -} - -export interface JsStatsModuleProfile { - factory: JsStatsMillisecond - integration: JsStatsMillisecond - building: JsStatsMillisecond -} - -export interface JsStatsModuleReason { - moduleIdentifier?: string - moduleName?: string - moduleId?: string - type?: string - userRequest?: string -} - -export interface JsStatsWarning { - message: string - formatted: string -} - -export interface NodeFS { - writeFile: (...args: any[]) => any - removeFile: (...args: any[]) => any - mkdir: (...args: any[]) => any - mkdirp: (...args: any[]) => any -} - -export interface PathData { +export interface RawHtmlRspackPluginOptions { + /** emitted file name in output path */ filename?: string - hash?: string - contentHash?: string - runtime?: string - url?: string - id?: string -} - -export interface PathWithInfo { - path: string - info: JsAssetInfo -} - -export interface RawAssetGeneratorDataUrl { - type: "options" - options?: RawAssetGeneratorDataUrlOptions + /** template html file */ + template?: string + templateContent?: string + templateParameters?: Record + /** "head", "body" or "false" */ + inject: "head" | "body" | "false" + /** path or `auto` */ + publicPath?: string + /** `blocking`, `defer`, or `module` */ + scriptLoading: "blocking" | "defer" | "module" + /** entry_chunk_name (only entry chunks are supported) */ + chunks?: Array + excludedChunks?: Array + sri?: "sha256" | "sha384" | "sha512" + minify?: boolean + title?: string + favicon?: string + meta?: Record> } - -export interface RawAssetGeneratorDataUrlOptions { - encoding?: "base64" | "false" | undefined - mimetype?: string +export interface RawProgressPluginOptions { + prefix?: string } - -export interface RawAssetGeneratorOptions { - filename?: string - publicPath?: string - dataUrl?: RawAssetGeneratorDataUrl +export interface RawSwcJsMinimizerRule { + type: "string" | "regexp" + stringMatcher?: string + regexpMatcher?: string } - -export interface RawAssetInlineGeneratorOptions { - dataUrl?: RawAssetGeneratorDataUrl +export interface RawSwcJsMinimizerRules { + type: "string" | "regexp" | "array" + stringMatcher?: string + regexpMatcher?: string + arrayMatcher?: Array } - -export interface RawAssetParserDataUrl { - type: "options" - options?: RawAssetParserDataUrlOptions +export interface RawSwcJsMinimizerRspackPluginOptions { + passes: number + dropConsole: boolean + keepClassNames: boolean + keepFnNames: boolean + comments: "all" | "some" | "false" + asciiOnly: boolean + pureFuncs: Array + extractComments?: string + test?: RawSwcJsMinimizerRules + include?: RawSwcJsMinimizerRules + exclude?: RawSwcJsMinimizerRules } - -export interface RawAssetParserDataUrlOptions { - maxSize?: number +export interface RawDecoratorOptions { + legacy: boolean + emitMetadata: boolean } - -export interface RawAssetParserOptions { - dataUrlCondition?: RawAssetParserDataUrl +export interface RawStyleConfig { + styleLibraryDirectory?: string + custom?: string + css?: string + bool?: boolean } - -export interface RawAssetResourceGeneratorOptions { - filename?: string - publicPath?: string +export interface RawPluginImportConfig { + libraryName: string + libraryDirectory?: string + customName?: string + customStyleName?: string + style?: RawStyleConfig + camelToDashComponentName?: boolean + transformToDefaultImport?: boolean + ignoreEsComponent?: Array + ignoreStyleComponent?: Array } - -export interface RawBannerContent { - type: "string" | "function" - stringPayload?: string - fnPayload?: (...args: any[]) => any +export interface RawPresetEnv { + targets: Array + mode?: 'usage' | 'entry' + coreJs?: string } - -export interface RawBannerContentFnCtx { - hash: string - chunk: JsChunk - filename: string +export interface RawReactOptions { + runtime?: "automatic" | "classic" + importSource?: string + pragma?: string + pragmaFrag?: string + throwIfNamespace?: boolean + development?: boolean + useBuiltins?: boolean + useSpread?: boolean + refresh?: boolean } - -export interface RawBannerPluginOptions { - banner: RawBannerContent - entryOnly?: boolean - footer?: boolean - raw?: boolean - test?: RawBannerRules - include?: RawBannerRules - exclude?: RawBannerRules +export interface RawRelayConfig { + artifactDirectory?: string + language: 'javascript' | 'typescript' | 'flow' } - -export interface RawBannerRule { - type: "string" | "regexp" - stringMatcher?: string - regexpMatcher?: string +export interface RawCssPluginConfig { + modules: RawCssModulesConfig } - -export interface RawBannerRules { - type: "string" | "regexp" | "array" - stringMatcher?: string - regexpMatcher?: string - arrayMatcher?: Array +export interface RawCssModulesConfig { + localsConvention: "asIs" | "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" + localIdentName: string + exportsOnly: boolean } - export interface RawBuiltins { css?: RawCssPluginConfig presetEnv?: RawPresetEnv @@ -548,82 +188,51 @@ export interface RawBuiltins { pluginImport?: Array relay?: RawRelayConfig } - -export interface RawCacheGroupOptions { - priority?: number - test?: RegExp | string - idHint?: string - /** What kind of chunks should be selected. */ - chunks?: RegExp | 'async' | 'initial' | 'all' - type?: RegExp | string - minChunks?: number - minSize?: number - maxSize?: number - maxAsyncSize?: number - maxInitialSize?: number - name?: string - reuseExistingChunk?: boolean - enforce?: boolean -} - -export interface RawCacheOptions { - type: string - maxGenerations: number - maxAge: number - profile: boolean - buildDependencies: Array - cacheDirectory: string - cacheLocation: string - name: string - version: string -} - -export interface RawCopyGlobOptions { - caseSensitiveMatch?: boolean - dot?: boolean - ignore?: Array -} - -export interface RawCopyPattern { - from: string - to?: string - context?: string - toType?: string - noErrorOnMissing: boolean - force: boolean - priority: number - globOptions: RawCopyGlobOptions -} - -export interface RawCopyRspackPluginOptions { - patterns: Array -} - -export interface RawCrossOriginLoading { - type: "bool" | "string" - stringPayload?: string - boolPayload?: boolean -} - -export interface RawCssModulesConfig { - localsConvention: "asIs" | "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" - localIdentName: string - exportsOnly: boolean -} - -export interface RawCssPluginConfig { - modules: RawCssModulesConfig +export const enum BuiltinPluginName { + DefinePlugin = 'DefinePlugin', + ProvidePlugin = 'ProvidePlugin', + BannerPlugin = 'BannerPlugin', + ProgressPlugin = 'ProgressPlugin', + EntryPlugin = 'EntryPlugin', + ExternalsPlugin = 'ExternalsPlugin', + NodeTargetPlugin = 'NodeTargetPlugin', + ElectronTargetPlugin = 'ElectronTargetPlugin', + EnableChunkLoadingPlugin = 'EnableChunkLoadingPlugin', + EnableLibraryPlugin = 'EnableLibraryPlugin', + EnableWasmLoadingPlugin = 'EnableWasmLoadingPlugin', + CommonJsChunkFormatPlugin = 'CommonJsChunkFormatPlugin', + ArrayPushCallbackChunkFormatPlugin = 'ArrayPushCallbackChunkFormatPlugin', + ModuleChunkFormatPlugin = 'ModuleChunkFormatPlugin', + HotModuleReplacementPlugin = 'HotModuleReplacementPlugin', + HttpExternalsRspackPlugin = 'HttpExternalsRspackPlugin', + CopyRspackPlugin = 'CopyRspackPlugin', + HtmlRspackPlugin = 'HtmlRspackPlugin', + SwcJsMinimizerRspackPlugin = 'SwcJsMinimizerRspackPlugin', + SwcCssMinimizerRspackPlugin = 'SwcCssMinimizerRspackPlugin' } - -export interface RawDecoratorOptions { - legacy: boolean - emitMetadata: boolean +export interface BuiltinPlugin { + name: BuiltinPluginName + options: unknown +} +export interface RawCacheOptions { + type: string + maxGenerations: number + maxAge: number + profile: boolean + buildDependencies: Array + cacheDirectory: string + cacheLocation: string + name: string + version: string } - export interface RawDevServer { hot: boolean } - +export interface RawEntryPluginOptions { + context: string + entry: string + options: RawEntryOptions +} export interface RawEntryOptions { name?: string runtime?: string @@ -633,13 +242,15 @@ export interface RawEntryOptions { baseUri?: string filename?: string } - -export interface RawEntryPluginOptions { - context: string - entry: string - options: RawEntryOptions +export interface RawIncrementalRebuild { + make: boolean + emitAsset: boolean +} +export interface RawRspackFuture { + newResolver: boolean + newTreeshaking: boolean + disableTransformByDefault: boolean } - export interface RawExperiments { lazyCompilation: boolean incrementalRebuild: RawIncrementalRebuild @@ -648,7 +259,14 @@ export interface RawExperiments { css: boolean rspackFuture: RawRspackFuture } - +export interface RawHttpExternalsRspackPluginOptions { + css: boolean + webAsync: boolean +} +export interface RawExternalsPluginOptions { + type: string + externals: Array +} export interface RawExternalItem { type: "string" | "regexp" | "object" | "function" stringPayload?: string @@ -656,18 +274,6 @@ export interface RawExternalItem { objectPayload?: Record fnPayload?: (value: any) => any } - -export interface RawExternalItemFnCtx { - request: string - context: string - dependencyType: string -} - -export interface RawExternalItemFnResult { - externalType?: string - result?: RawExternalItemValue -} - export interface RawExternalItemValue { type: "string" | "bool" | "array" | "object" stringPayload?: string @@ -675,12 +281,15 @@ export interface RawExternalItemValue { arrayPayload?: Array objectPayload?: Record> } - -export interface RawExternalsPluginOptions { - type: string - externals: Array +export interface RawExternalItemFnResult { + externalType?: string + result?: RawExternalItemValue +} +export interface RawExternalItemFnCtx { + request: string + context: string + dependencyType: string } - export interface RawExternalsPresets { node: boolean web: boolean @@ -689,75 +298,192 @@ export interface RawExternalsPresets { electronPreload: boolean electronRenderer: boolean } - -export interface RawFallbackCacheGroupOptions { - chunks?: RegExp | 'async' | 'initial' | 'all' - minSize?: number - maxSize?: number - maxAsyncSize?: number - maxInitialSize?: number -} - -export interface RawFuncUseCtx { - resource?: string - realResource?: string +export interface JsLoaderContext { + /** Content maybe empty in pitching stage */ + content?: Buffer + additionalData?: Buffer + sourceMap?: Buffer + resource: string + resourcePath: string resourceQuery?: string - issuer?: string + resourceFragment?: string + cacheable: boolean + fileDependencies: Array + contextDependencies: Array + missingDependencies: Array + buildDependencies: Array + assetFilenames: Array + currentLoader: string + isPitching: boolean + /** + * Internal loader context + * @internal + */ + context: ExternalObject + /** + * Internal loader diagnostic + * @internal + */ + diagnostics: ExternalObject> +} +export interface JsLoaderResult { + /** Content in pitching stage can be empty */ + content?: Buffer + fileDependencies: Array + contextDependencies: Array + missingDependencies: Array + buildDependencies: Array + sourceMap?: Buffer + additionalData?: Buffer + cacheable: boolean + /** Used to instruct how rust loaders should execute */ + isPitching: boolean +} +/** + * `loader` is for both JS and Rust loaders. + * `options` is + * - a `None` on rust side and handled by js side `getOptions` when + * using with `loader`. + * - a `Some(string)` on rust side, deserialized by `serde_json::from_str` + * and passed to rust side loader in [get_builtin_loader] when using with + * `builtin_loader`. + */ +export interface RawModuleRuleUse { + loader: string + options?: string +} +export interface RawModuleRuleUses { + type: "array" | "function" + arrayUse?: Array + funcUse?: (...args: any[]) => any +} +export interface RawRuleSetCondition { + type: "string" | "regexp" | "logical" | "array" | "function" + stringMatcher?: string + regexpMatcher?: string + logicalMatcher?: Array + arrayMatcher?: Array + funcMatcher?: (value: string) => boolean +} +export interface RawRuleSetLogicalConditions { + and?: Array + or?: Array + not?: RawRuleSetCondition +} +export interface RawModuleRule { + /** + * A conditional match matching an absolute path + query + fragment. + * Note: + * This is a custom matching rule not initially designed by webpack. + * Only for single-threaded environment interoperation purpose. + */ + rspackResource?: RawRuleSetCondition + /** A condition matcher matching an absolute path. */ + test?: RawRuleSetCondition + include?: RawRuleSetCondition + exclude?: RawRuleSetCondition + /** A condition matcher matching an absolute path. */ + resource?: RawRuleSetCondition + /** A condition matcher against the resource query. */ + resourceQuery?: RawRuleSetCondition + resourceFragment?: RawRuleSetCondition + descriptionData?: Record + sideEffects?: boolean + use?: RawModuleRuleUses + type?: string + parser?: RawParserOptions + generator?: RawGeneratorOptions + resolve?: RawResolveOptions + issuer?: RawRuleSetCondition + dependency?: RawRuleSetCondition + scheme?: RawRuleSetCondition + mimetype?: RawRuleSetCondition + oneOf?: Array + rules?: Array + /** Specifies the category of the loader. No value means normal loader. */ + enforce?: 'pre' | 'post' +} +export interface RawParserOptions { + type: "asset" | "unknown" + asset?: RawAssetParserOptions +} +export interface RawAssetParserOptions { + dataUrlCondition?: RawAssetParserDataUrl +} +export interface RawAssetParserDataUrl { + type: "options" + options?: RawAssetParserDataUrlOptions +} +export interface RawAssetParserDataUrlOptions { + maxSize?: number } - export interface RawGeneratorOptions { type: "asset" | "asset/inline" | "asset/resource" | "unknown" asset?: RawAssetGeneratorOptions assetInline?: RawAssetInlineGeneratorOptions assetResource?: RawAssetResourceGeneratorOptions } - -export interface RawHtmlRspackPluginOptions { - /** emitted file name in output path */ +export interface RawAssetGeneratorOptions { filename?: string - /** template html file */ - template?: string - templateContent?: string - templateParameters?: Record - /** "head", "body" or "false" */ - inject: "head" | "body" | "false" - /** path or `auto` */ publicPath?: string - /** `blocking`, `defer`, or `module` */ - scriptLoading: "blocking" | "defer" | "module" - /** entry_chunk_name (only entry chunks are supported) */ - chunks?: Array - excludedChunks?: Array - sri?: "sha256" | "sha384" | "sha512" - minify?: boolean - title?: string - favicon?: string - meta?: Record> + dataUrl?: RawAssetGeneratorDataUrl +} +export interface RawAssetInlineGeneratorOptions { + dataUrl?: RawAssetGeneratorDataUrl +} +export interface RawAssetResourceGeneratorOptions { + filename?: string + publicPath?: string +} +export interface RawAssetGeneratorDataUrl { + type: "options" + options?: RawAssetGeneratorDataUrlOptions +} +export interface RawAssetGeneratorDataUrlOptions { + encoding?: "base64" | "false" | undefined + mimetype?: string +} +export interface RawModuleOptions { + rules: Array + parser?: Record + generator?: Record +} +export interface RawFuncUseCtx { + resource?: string + realResource?: string + resourceQuery?: string + issuer?: string +} +export interface RawNodeOption { + dirname: string + filename: string + global: string +} +export interface RawOptimizationOptions { + splitChunks?: RawSplitChunksOptions + moduleIds: string + chunkIds: string + removeAvailableModules: boolean + removeEmptyChunks: boolean + sideEffects: string + usedExports: string + providedExports: boolean + realContentHash: boolean } - -export interface RawHttpExternalsRspackPluginOptions { - css: boolean - webAsync: boolean +export interface RawTrustedTypes { + policyName?: string } - -export interface RawIncrementalRebuild { - make: boolean - emitAsset: boolean +export interface RawLibraryName { + amd?: string + commonjs?: string + root?: Array } - export interface RawLibraryAuxiliaryComment { root?: string commonjs?: string commonjs2?: string amd?: string } - -export interface RawLibraryName { - amd?: string - commonjs?: string - root?: Array -} - export interface RawLibraryOptions { name?: RawLibraryName export?: Array @@ -765,333 +491,493 @@ export interface RawLibraryOptions { umdNamedDefine?: boolean auxiliaryComment?: RawLibraryAuxiliaryComment } - -export interface RawModuleOptions { - rules: Array - parser?: Record - generator?: Record +export interface RawCrossOriginLoading { + type: "bool" | "string" + stringPayload?: string + boolPayload?: boolean } - -export interface RawModuleRule { +export interface RawOutputOptions { + path: string + clean: boolean + publicPath: string + assetModuleFilename: string + wasmLoading: string + enabledWasmLoadingTypes: Array + webassemblyModuleFilename: string + filename: string + chunkFilename: string + crossOriginLoading: RawCrossOriginLoading + cssFilename: string + cssChunkFilename: string + hotUpdateMainFilename: string + hotUpdateChunkFilename: string + hotUpdateGlobal: string + uniqueName: string + chunkLoadingGlobal: string + library?: RawLibraryOptions + strictModuleErrorHandling: boolean + enabledLibraryTypes?: Array + globalObject: string + importFunctionName: string + iife: boolean + module: boolean + chunkLoading: string + enabledChunkLoadingTypes?: Array + trustedTypes?: RawTrustedTypes + sourceMapFilename: string + hashFunction: string + hashDigest: string + hashDigestLength: number + hashSalt?: string + asyncChunks: boolean + workerChunkLoading: string + workerWasmLoading: string + workerPublicPath: string +} +export interface RawResolveOptions { + preferRelative?: boolean + extensions?: Array + mainFiles?: Array + mainFields?: Array + browserField?: boolean + conditionNames?: Array + alias?: Record> + fallback?: Record> + symlinks?: boolean + tsConfigPath?: string + modules?: Array + byDependency?: Record + fullySpecified?: boolean + exportsFields?: Array + extensionAlias?: Record> +} +export interface RawSnapshotStrategy { + hash: boolean + timestamp: boolean +} +export interface RawSnapshotOptions { + resolve: RawSnapshotStrategy + module: RawSnapshotStrategy +} +export interface RawSplitChunksOptions { + fallbackCacheGroup?: RawFallbackCacheGroupOptions + name?: string + cacheGroups?: Record + /** What kind of chunks should be selected. */ + chunks?: RegExp | 'async' | 'initial' | 'all' + maxAsyncRequests?: number + maxInitialRequests?: number + minChunks?: number + minSize?: number + enforceSizeThreshold?: number + minRemainingSize?: number + maxSize?: number + maxAsyncSize?: number + maxInitialSize?: number +} +export interface RawCacheGroupOptions { + priority?: number + test?: RegExp | string + idHint?: string + /** What kind of chunks should be selected. */ + chunks?: RegExp | 'async' | 'initial' | 'all' + type?: RegExp | string + minChunks?: number + minSize?: number + maxSize?: number + maxAsyncSize?: number + maxInitialSize?: number + name?: string + reuseExistingChunk?: boolean + enforce?: boolean +} +export interface RawFallbackCacheGroupOptions { + chunks?: RegExp | 'async' | 'initial' | 'all' + minSize?: number + maxSize?: number + maxAsyncSize?: number + maxInitialSize?: number +} +export interface RawStatsOptions { + colors: boolean +} +export interface RawOptions { + mode?: undefined | 'production' | 'development' | 'none' + target: Array + context: string + output: RawOutputOptions + resolve: RawResolveOptions + resolveLoader: RawResolveOptions + module: RawModuleOptions + devtool: string + optimization: RawOptimizationOptions + stats: RawStatsOptions + devServer: RawDevServer + snapshot: RawSnapshotOptions + cache: RawCacheOptions + experiments: RawExperiments + node?: RawNodeOption + profile: boolean + builtins: RawBuiltins +} +export interface RsPackRawOptions { + mode?: undefined | 'production' | 'development' | 'none' + target: Array + context: string + output: RawOutputOptions + resolve: RawResolveOptions + resolveLoader: RawResolveOptions + module: RawModuleOptions + devtool: string + optimization: RawOptimizationOptions + stats: RawStatsOptions + devServer: RawDevServer + snapshot: RawSnapshotOptions + cache: RawCacheOptions + experiments: RawExperiments + node?: RawNodeOption + profile: boolean + builtins: RawBuiltins +} +export interface JsAssetInfoRelated { + sourceMap?: string +} +export interface JsAssetInfo { + /** if the asset can be long term cached forever (contains a hash) */ + immutable: boolean + /** whether the asset is minimized */ + minimized: boolean /** - * A conditional match matching an absolute path + query + fragment. - * Note: - * This is a custom matching rule not initially designed by webpack. - * Only for single-threaded environment interoperation purpose. + * the value(s) of the full hash used for this asset + * the value(s) of the chunk hash used for this asset */ - rspackResource?: RawRuleSetCondition - /** A condition matcher matching an absolute path. */ - test?: RawRuleSetCondition - include?: RawRuleSetCondition - exclude?: RawRuleSetCondition - /** A condition matcher matching an absolute path. */ - resource?: RawRuleSetCondition - /** A condition matcher against the resource query. */ - resourceQuery?: RawRuleSetCondition - resourceFragment?: RawRuleSetCondition - descriptionData?: Record - sideEffects?: boolean - use?: RawModuleRuleUses - type?: string - parser?: RawParserOptions - generator?: RawGeneratorOptions - resolve?: RawResolveOptions - issuer?: RawRuleSetCondition - dependency?: RawRuleSetCondition - scheme?: RawRuleSetCondition - mimetype?: RawRuleSetCondition - oneOf?: Array - rules?: Array - /** Specifies the category of the loader. No value means normal loader. */ - enforce?: 'pre' | 'post' -} - -/** - * `loader` is for both JS and Rust loaders. - * `options` is - * - a `None` on rust side and handled by js side `getOptions` when - * using with `loader`. - * - a `Some(string)` on rust side, deserialized by `serde_json::from_str` - * and passed to rust side loader in [get_builtin_loader] when using with - * `builtin_loader`. - */ -export interface RawModuleRuleUse { - loader: string - options?: string + chunkHash: Array + /** + * the value(s) of the module hash used for this asset + * the value(s) of the content hash used for this asset + */ + contentHash: Array + /** + * when asset was created from a source file (potentially transformed), the original filename relative to compilation context + * size in bytes, only set after asset has been emitted + * when asset is only used for development and doesn't count towards user-facing assets + */ + development: boolean + /** when asset ships data for updating an existing application (HMR) */ + hotModuleReplacement: boolean + /** + * when asset is javascript and an ESM + * related object to other assets, keyed by type of relation (only points from parent to child) + */ + related: JsAssetInfoRelated + /** + * the asset version, emit can be skipped when both filename and version are the same + * An empty string means no version, it will always emit + */ + version: string } - -export interface RawModuleRuleUses { - type: "array" | "function" - arrayUse?: Array - funcUse?: (...args: any[]) => any +export interface JsAsset { + name: string + source?: JsCompatSource + info: JsAssetInfo } - -export interface RawNodeOption { - dirname: string +export interface JsAssetEmittedArgs { filename: string - global: string + outputPath: string + targetPath: string } - -export interface RawOptimizationOptions { - splitChunks?: RawSplitChunksOptions - moduleIds: string - chunkIds: string - removeAvailableModules: boolean - removeEmptyChunks: boolean - sideEffects: string - usedExports: string - providedExports: boolean - realContentHash: boolean +export interface JsChunkGroup { + chunks: Array } - -export interface RawOptions { - mode?: undefined | 'production' | 'development' | 'none' - target: Array +export interface JsHooks { + processAssetsStageAdditional: (...args: any[]) => any + processAssetsStagePreProcess: (...args: any[]) => any + processAssetsStageDerived: (...args: any[]) => any + processAssetsStageAdditions: (...args: any[]) => any + processAssetsStageNone: (...args: any[]) => any + processAssetsStageOptimize: (...args: any[]) => any + processAssetsStageOptimizeCount: (...args: any[]) => any + processAssetsStageOptimizeCompatibility: (...args: any[]) => any + processAssetsStageOptimizeSize: (...args: any[]) => any + processAssetsStageDevTooling: (...args: any[]) => any + processAssetsStageOptimizeInline: (...args: any[]) => any + processAssetsStageSummarize: (...args: any[]) => any + processAssetsStageOptimizeHash: (...args: any[]) => any + processAssetsStageOptimizeTransfer: (...args: any[]) => any + processAssetsStageAnalyse: (...args: any[]) => any + processAssetsStageReport: (...args: any[]) => any + compilation: (...args: any[]) => any + thisCompilation: (...args: any[]) => any + emit: (...args: any[]) => any + assetEmitted: (...args: any[]) => any + afterEmit: (...args: any[]) => any + make: (...args: any[]) => any + optimizeModules: (...args: any[]) => any + optimizeTree: (...args: any[]) => any + optimizeChunkModule: (...args: any[]) => any + beforeCompile: (...args: any[]) => any + afterCompile: (...args: any[]) => any + finishModules: (...args: any[]) => any + finishMake: (...args: any[]) => any + buildModule: (...args: any[]) => any + beforeResolve: (...args: any[]) => any + afterResolve: (...args: any[]) => any + contextModuleBeforeResolve: (...args: any[]) => any + normalModuleFactoryResolveForScheme: (...args: any[]) => any + chunkAsset: (...args: any[]) => any + succeedModule: (...args: any[]) => any + stillValidModule: (...args: any[]) => any +} +export interface JsModule { + originalSource?: JsCompatSource + resource: string + moduleIdentifier: string +} +export interface JsResolveForSchemeInput { + resourceData: JsResourceData + scheme: string +} +export interface JsResolveForSchemeResult { + resourceData: JsResourceData + stop: boolean +} +export interface BeforeResolveData { + request: string context: string - output: RawOutputOptions - resolve: RawResolveOptions - resolveLoader: RawResolveOptions - module: RawModuleOptions - devtool: string - optimization: RawOptimizationOptions - stats: RawStatsOptions - devServer: RawDevServer - snapshot: RawSnapshotOptions - cache: RawCacheOptions - experiments: RawExperiments - node?: RawNodeOption - profile: boolean - builtins: RawBuiltins } - -export interface RawOutputOptions { - path: string - clean: boolean - publicPath: string - assetModuleFilename: string - wasmLoading: string - enabledWasmLoadingTypes: Array - webassemblyModuleFilename: string - filename: string - chunkFilename: string - crossOriginLoading: RawCrossOriginLoading - cssFilename: string - cssChunkFilename: string - hotUpdateMainFilename: string - hotUpdateChunkFilename: string - hotUpdateGlobal: string - uniqueName: string - chunkLoadingGlobal: string - library?: RawLibraryOptions - strictModuleErrorHandling: boolean - enabledLibraryTypes?: Array - globalObject: string - importFunctionName: string - iife: boolean - module: boolean - chunkLoading: string - enabledChunkLoadingTypes?: Array - trustedTypes?: RawTrustedTypes - sourceMapFilename: string - hashFunction: string - hashDigest: string - hashDigestLength: number - hashSalt?: string - asyncChunks: boolean - workerChunkLoading: string - workerWasmLoading: string - workerPublicPath: string +export interface AfterResolveData { + request: string + context: string + fileDependencies: Array + contextDependencies: Array + missingDependencies: Array + factoryMeta: FactoryMeta } - -export interface RawParserOptions { - type: "asset" | "unknown" - asset?: RawAssetParserOptions +export interface FactoryMeta { + sideEffectFree?: boolean } - -export interface RawPluginImportConfig { - libraryName: string - libraryDirectory?: string - customName?: string - customStyleName?: string - style?: RawStyleConfig - camelToDashComponentName?: boolean - transformToDefaultImport?: boolean - ignoreEsComponent?: Array - ignoreStyleComponent?: Array +export interface JsResourceData { + /** Resource with absolute path, query and fragment */ + resource: string + /** Absolute resource path only */ + path: string + /** Resource query with `?` prefix */ + query?: string + /** Resource fragment with `#` prefix */ + fragment?: string } - -export interface RawPresetEnv { - targets: Array - mode?: 'usage' | 'entry' - coreJs?: string +export interface PathData { + filename?: string + hash?: string + contentHash?: string + runtime?: string + url?: string + id?: string } - -export interface RawProgressPluginOptions { - prefix?: string +export interface PathWithInfo { + path: string + info: JsAssetInfo } - -export interface RawReactOptions { - runtime?: "automatic" | "classic" - importSource?: string - pragma?: string - pragmaFrag?: string - throwIfNamespace?: boolean - development?: boolean - useBuiltins?: boolean - useSpread?: boolean - refresh?: boolean +export interface JsCompatSource { + /** Whether the underlying data structure is a `RawSource` */ + isRaw: boolean + /** Whether the underlying value is a buffer or string */ + isBuffer: boolean + source: Buffer + map?: Buffer } - -export interface RawRelayConfig { - artifactDirectory?: string - language: 'javascript' | 'typescript' | 'flow' +export interface JsStatsError { + message: string + formatted: string + title: string } - -export interface RawResolveOptions { - preferRelative?: boolean - extensions?: Array - mainFiles?: Array - mainFields?: Array - browserField?: boolean - conditionNames?: Array - alias?: Record> - fallback?: Record> - symlinks?: boolean - tsConfigPath?: string - modules?: Array - byDependency?: Record - fullySpecified?: boolean - exportsFields?: Array - extensionAlias?: Record> +export interface JsStatsWarning { + message: string + formatted: string } - -export interface RawRspackFuture { - newResolver: boolean - newTreeshaking: boolean - disableTransformByDefault: boolean +export interface JsStatsLogging { + name: string + type: string + args?: Array + trace?: Array +} +export interface JsStatsAsset { + type: string + name: string + size: number + chunks: Array + chunkNames: Array + info: JsStatsAssetInfo + emitted: boolean } - -export interface RawRuleSetCondition { - type: "string" | "regexp" | "logical" | "array" | "function" - stringMatcher?: string - regexpMatcher?: string - logicalMatcher?: Array - arrayMatcher?: Array - funcMatcher?: (value: string) => boolean +export interface JsStatsAssetInfo { + development: boolean + hotModuleReplacement: boolean } - -export interface RawRuleSetLogicalConditions { - and?: Array - or?: Array - not?: RawRuleSetCondition +export interface JsStatsModule { + type: string + moduleType: string + identifier: string + name: string + id?: string + chunks: Array + size: number + issuer?: string + issuerName?: string + issuerId?: string + issuerPath: Array + nameForCondition?: string + reasons?: Array + assets?: Array + source?: string | Buffer + profile?: JsStatsModuleProfile } - -export interface RawSnapshotOptions { - resolve: RawSnapshotStrategy - module: RawSnapshotStrategy +export interface JsStatsModuleProfile { + factory: JsStatsMillisecond + integration: JsStatsMillisecond + building: JsStatsMillisecond } - -export interface RawSnapshotStrategy { - hash: boolean - timestamp: boolean +export interface JsStatsMillisecond { + secs: number + subsecMillis: number } - -export interface RawSplitChunksOptions { - fallbackCacheGroup?: RawFallbackCacheGroupOptions - name?: string - cacheGroups?: Record - /** What kind of chunks should be selected. */ - chunks?: RegExp | 'async' | 'initial' | 'all' - maxAsyncRequests?: number - maxInitialRequests?: number - minChunks?: number - minSize?: number - enforceSizeThreshold?: number - minRemainingSize?: number - maxSize?: number - maxAsyncSize?: number - maxInitialSize?: number +export interface JsStatsModuleIssuer { + identifier: string + name: string + id?: string } - -export interface RawStatsOptions { - colors: boolean +export interface JsStatsModuleReason { + moduleIdentifier?: string + moduleName?: string + moduleId?: string + type?: string + userRequest?: string } - -export interface RawStyleConfig { - styleLibraryDirectory?: string - custom?: string - css?: string - bool?: boolean +export interface JsStatsChunk { + type: string + files: Array + auxiliaryFiles: Array + id: string + entry: boolean + initial: boolean + names: Array + size: number + modules?: Array + parents?: Array + children?: Array + siblings?: Array } - -export interface RawSwcJsMinimizerRspackPluginOptions { - passes: number - dropConsole: boolean - keepClassNames: boolean - keepFnNames: boolean - comments: "all" | "some" | "false" - asciiOnly: boolean - pureFuncs: Array - extractComments?: string - test?: RawSwcJsMinimizerRules - include?: RawSwcJsMinimizerRules - exclude?: RawSwcJsMinimizerRules +export interface JsStatsChunkGroupAsset { + name: string + size: number } - -export interface RawSwcJsMinimizerRule { - type: "string" | "regexp" - stringMatcher?: string - regexpMatcher?: string +export interface JsStatsChunkGroup { + name: string + assets: Array + chunks: Array + assetsSize: number } - -export interface RawSwcJsMinimizerRules { - type: "string" | "regexp" | "array" - stringMatcher?: string - regexpMatcher?: string - arrayMatcher?: Array +export interface JsStatsAssetsByChunkName { + name: string + files: Array } - -export interface RawTrustedTypes { - policyName?: string +export interface JsStatsGetAssets { + assets: Array + assetsByChunkName: Array } - +/** Builtin loader runner */ +export function runBuiltinLoader(builtin: string, options: string | undefined | null, loaderContext: JsLoaderContext): Promise /** * Some code is modified based on * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58 * Apache-2.0 licensed * Author Donny/강동윤 * Copyright (c) - */ +*/ export function registerGlobalTrace(filter: string, layer: "chrome" | "logger", output: string): void - -export interface RsPackRawOptions { - mode?: undefined | 'production' | 'development' | 'none' - target: Array - context: string - output: RawOutputOptions - resolve: RawResolveOptions - resolveLoader: RawResolveOptions - module: RawModuleOptions - devtool: string - optimization: RawOptimizationOptions - stats: RawStatsOptions - devServer: RawDevServer - snapshot: RawSnapshotOptions - cache: RawCacheOptions - experiments: RawExperiments - node?: RawNodeOption - profile: boolean - builtins: RawBuiltins +export function cleanupGlobalTrace(): void +export class JsCompilation { + updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void + getAssets(): Readonly[] + getAsset(name: string): JsAsset | null + getAssetSource(name: string): JsCompatSource | null + getModules(): Array + getChunks(): Array + getNamedChunk(name: string): JsChunk | null + /** + * Only available for those none Js and Css source, + * return true if set module source successfully, false if failed. + */ + setNoneAstModuleSource(moduleIdentifier: string, source: JsCompatSource): boolean + setAssetSource(name: string, source: JsCompatSource): void + deleteAssetSource(name: string): void + getAssetFilenames(): Array + hasAsset(name: string): boolean + emitAsset(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void + deleteAsset(filename: string): void + get entrypoints(): Record + get hash(): string | null + getFileDependencies(): Array + getContextDependencies(): Array + getMissingDependencies(): Array + getBuildDependencies(): Array + pushDiagnostic(severity: "error" | "warning", title: string, message: string): void + pushNativeDiagnostics(diagnostics: ExternalObject>): void + getStats(): JsStats + getAssetPath(filename: string, data: PathData): string + getAssetPathWithInfo(filename: string, data: PathData): PathWithInfo + getPath(filename: string, data: PathData): string + getPathWithInfo(filename: string, data: PathData): PathWithInfo + addFileDependencies(deps: Array): void + addContextDependencies(deps: Array): void + addMissingDependencies(deps: Array): void + addBuildDependencies(deps: Array): void + rebuildModule(moduleIdentifiers: Array, f: (...args: any[]) => any): void } - -/** Builtin loader runner */ -export function runBuiltinLoader(builtin: string, options: string | undefined | null, loaderContext: JsLoaderContext): Promise - -export interface ThreadsafeNodeFS { - writeFile: (...args: any[]) => any - removeFile: (...args: any[]) => any - mkdir: (...args: any[]) => any - mkdirp: (...args: any[]) => any - removeDirAll: (...args: any[]) => any +export class JsStats { + getAssets(): JsStatsGetAssets + getModules(reasons: boolean, moduleAssets: boolean, nestedModules: boolean, source: boolean): Array + getChunks(chunkModules: boolean, chunksRelations: boolean, reasons: boolean, moduleAssets: boolean, nestedModules: boolean, source: boolean): Array + getEntrypoints(): Array + getNamedChunkGroups(): Array + getErrors(): Array + getWarnings(): Array + getLogging(acceptedTypes: number): Array + getHash(): string +} +export class Rspack { + constructor(options: RSPackRawOptions, builtinPlugins: Array, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any) + unsafe_set_disabled_hooks(hooks: Array): void + /** + * Build with the given option passed to the constructor + * + * Warning: + * Calling this method recursively might cause a deadlock. + */ + unsafe_build(callback: (err: null | Error) => void): void + /** + * Rebuild with the given option passed to the constructor + * + * Warning: + * Calling this method recursively will cause a deadlock. + */ + unsafe_rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void + /** + * Get the last compilation + * + * Warning: + * + * Calling this method under the build or rebuild method might cause a deadlock. + * + * **Note** that this method is not safe if you cache the _JsCompilation_ on the Node side, as it will be invalidated by the next build and accessing a dangling ptr is a UB. + */ + unsafe_last_compilation(f: (arg0: JsCompilation) => void): void + /** + * Destroy the compiler + * + * Warning: + * + * Anything related to this compiler will be invalidated after this method is called. + */ + unsafe_drop(): void } - diff --git a/crates/node_binding/index.js b/crates/node_binding/index.js index 619f766..d7beef2 100644 --- a/crates/node_binding/index.js +++ b/crates/node_binding/index.js @@ -1,119 +1,263 @@ -function loadNapiModule(binaryName, packageName) { - const { existsSync, readFileSync } = require('fs'); - const { join } = require('path'); - const { platform, arch } = process; - const candidates = []; - function isMusl() { - // For Node 10 - if (!process.report || typeof process.report.getReport !== 'function') { - try { - const lddPath = require('child_process') - .execSync('which ldd') - .toString() - .trim(); - return readFileSync(lddPath, 'utf8').includes('musl'); - } - catch (e) { - return true; - } +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +/* auto-generated by NAPI-RS */ + +const { existsSync, readFileSync } = require('fs') +const { join } = require('path') + +const { platform, arch } = process + +let nativeBinding = null +let localFileExisted = false +let loadError = null + +function isMusl() { + // For Node 10 + if (!process.report || typeof process.report.getReport !== 'function') { + try { + const lddPath = require('child_process').execSync('which ldd').toString().trim() + return readFileSync(lddPath, 'utf8').includes('musl') + } catch (e) { + return true + } + } else { + const { glibcVersionRuntime } = process.report.getReport().header + return !glibcVersionRuntime + } +} + +switch (platform) { + case 'android': + switch (arch) { + case 'arm64': + localFileExisted = existsSync(join(__dirname, 'pack-binding.android-arm64.node')) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.android-arm64.node') + } else { + nativeBinding = require('@ice/pack-binding-android-arm64') + } + } catch (e) { + loadError = e } - else { - // @ts-expect-error - const { glibcVersionRuntime } = process.report.getReport().header; - return !glibcVersionRuntime; + break + case 'arm': + localFileExisted = existsSync(join(__dirname, 'pack-binding.android-arm-eabi.node')) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.android-arm-eabi.node') + } else { + nativeBinding = require('@ice/pack-binding-android-arm-eabi') + } + } catch (e) { + loadError = e } + break + default: + throw new Error(`Unsupported architecture on Android ${arch}`) } - switch (platform) { - case 'android': - switch (arch) { - case 'arm64': - candidates.push('android-arm64'); - break; - case 'arm': - candidates.push('android-arm-eabi'); - break; - } - break; - case 'win32': - switch (arch) { - case 'x64': - candidates.push('win32-x64-msvc'); - break; - case 'ia32': - candidates.push('win32-ia32-msvc'); - break; - case 'arm64': - candidates.push('win32-arm64-msvc'); - break; - } - break; - case 'darwin': - candidates.push('darwin-universal'); - switch (arch) { - case 'x64': - candidates.push('darwin-x64'); - break; - case 'arm64': - candidates.push('darwin-arm64'); - break; - } - break; - case 'freebsd': - if (arch === 'x64') { - candidates.push('freebsd-x64'); - } - break; - case 'linux': - switch (arch) { - case 'x64': - if (isMusl()) { - candidates.push('linux-x64-musl'); - } - else { - candidates.push('linux-x64-gnu'); - } - break; - case 'arm64': - if (isMusl()) { - candidates.push('linux-arm64-musl'); - } - else { - candidates.push('linux-arm64-gnu'); - } - break; - case 'arm': - candidates.push('linux-arm-gnueabihf'); - break; - } - break; + break + case 'win32': + switch (arch) { + case 'x64': + localFileExisted = existsSync( + join(__dirname, 'pack-binding.win32-x64-msvc.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.win32-x64-msvc.node') + } else { + nativeBinding = require('@ice/pack-binding-win32-x64-msvc') + } + } catch (e) { + loadError = e + } + break + case 'ia32': + localFileExisted = existsSync( + join(__dirname, 'pack-binding.win32-ia32-msvc.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.win32-ia32-msvc.node') + } else { + nativeBinding = require('@ice/pack-binding-win32-ia32-msvc') + } + } catch (e) { + loadError = e + } + break + case 'arm64': + localFileExisted = existsSync( + join(__dirname, 'pack-binding.win32-arm64-msvc.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.win32-arm64-msvc.node') + } else { + nativeBinding = require('@ice/pack-binding-win32-arm64-msvc') + } + } catch (e) { + loadError = e + } + break + default: + throw new Error(`Unsupported architecture on Windows: ${arch}`) } - let nativeBinding; - let loadError; - for (const suffix of candidates) { - const localPath = join(__dirname, `${binaryName}.${suffix}.node`); - const pkgPath = `${packageName}-${suffix}`; + break + case 'darwin': + localFileExisted = existsSync(join(__dirname, 'pack-binding.darwin-universal.node')) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.darwin-universal.node') + } else { + nativeBinding = require('@ice/pack-binding-darwin-universal') + } + break + } catch {} + switch (arch) { + case 'x64': + localFileExisted = existsSync(join(__dirname, 'pack-binding.darwin-x64.node')) try { - if (existsSync(localPath)) { - nativeBinding = require(localPath); + if (localFileExisted) { + nativeBinding = require('./pack-binding.darwin-x64.node') + } else { + nativeBinding = require('@ice/pack-binding-darwin-x64') + } + } catch (e) { + loadError = e + } + break + case 'arm64': + localFileExisted = existsSync( + join(__dirname, 'pack-binding.darwin-arm64.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.darwin-arm64.node') + } else { + nativeBinding = require('@ice/pack-binding-darwin-arm64') + } + } catch (e) { + loadError = e + } + break + default: + throw new Error(`Unsupported architecture on macOS: ${arch}`) + } + break + case 'freebsd': + if (arch !== 'x64') { + throw new Error(`Unsupported architecture on FreeBSD: ${arch}`) + } + localFileExisted = existsSync(join(__dirname, 'pack-binding.freebsd-x64.node')) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.freebsd-x64.node') + } else { + nativeBinding = require('@ice/pack-binding-freebsd-x64') + } + } catch (e) { + loadError = e + } + break + case 'linux': + switch (arch) { + case 'x64': + if (isMusl()) { + localFileExisted = existsSync( + join(__dirname, 'pack-binding.linux-x64-musl.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.linux-x64-musl.node') + } else { + nativeBinding = require('@ice/pack-binding-linux-x64-musl') } - else { - nativeBinding = require(pkgPath); + } catch (e) { + loadError = e + } + } else { + localFileExisted = existsSync( + join(__dirname, 'pack-binding.linux-x64-gnu.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.linux-x64-gnu.node') + } else { + nativeBinding = require('@ice/pack-binding-linux-x64-gnu') } + } catch (e) { + loadError = e + } } - catch (e) { - loadError = e; - continue; + break + case 'arm64': + if (isMusl()) { + localFileExisted = existsSync( + join(__dirname, 'pack-binding.linux-arm64-musl.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.linux-arm64-musl.node') + } else { + nativeBinding = require('@ice/pack-binding-linux-arm64-musl') + } + } catch (e) { + loadError = e + } + } else { + localFileExisted = existsSync( + join(__dirname, 'pack-binding.linux-arm64-gnu.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.linux-arm64-gnu.node') + } else { + nativeBinding = require('@ice/pack-binding-linux-arm64-gnu') + } + } catch (e) { + loadError = e + } } - loadError = null; - break; - } - if (!nativeBinding) { - if (loadError) { - throw loadError; + break + case 'arm': + localFileExisted = existsSync( + join(__dirname, 'pack-binding.linux-arm-gnueabihf.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./pack-binding.linux-arm-gnueabihf.node') + } else { + nativeBinding = require('@ice/pack-binding-linux-arm-gnueabihf') + } + } catch (e) { + loadError = e } - throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`); + break + default: + throw new Error(`Unsupported architecture on Linux: ${arch}`) } - return nativeBinding; + break + default: + throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`) +} + +if (!nativeBinding) { + if (loadError) { + throw loadError + } + throw new Error(`Failed to load native binding`) } -module.exports = loadNapiModule('index', '@ice/pack-binding') +const { BuiltinPluginName, JsCompilation, JsStats, runBuiltinLoader, Rspack, registerGlobalTrace, cleanupGlobalTrace } = nativeBinding + +module.exports.BuiltinPluginName = BuiltinPluginName +module.exports.JsCompilation = JsCompilation +module.exports.JsStats = JsStats +module.exports.runBuiltinLoader = runBuiltinLoader +module.exports.Rspack = Rspack +module.exports.registerGlobalTrace = registerGlobalTrace +module.exports.cleanupGlobalTrace = cleanupGlobalTrace diff --git a/crates/node_binding/package.json b/crates/node_binding/package.json index 59973f0..70ddf23 100644 --- a/crates/node_binding/package.json +++ b/crates/node_binding/package.json @@ -13,8 +13,7 @@ }, "license": "MIT", "devDependencies": { - "@napi-rs/cli": "3.0.0-alpha.3", - "call-bind": "1.0.2" + "@napi-rs/cli": "^2.16.3" }, "ava": { "timeout": "3m" @@ -24,8 +23,9 @@ }, "scripts": { "artifacts": "napi artifacts", - "build": "napi build --platform --release --target aarch64-apple-darwin", - "build:debug": "napi build --platform --target aarch64-apple-darwin", + "build": "napi build --platform --release", + "build:debug": "napi build --platform", + "build:debug:aarch64": "napi build --platform --target aarch64-apple-darwin", "prepublishOnly": "napi prepublish -t npm", "universal": "napi universal", "version": "napi version" diff --git a/package.json b/package.json index 2063c07..07d88ed 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,21 @@ "type": "module", "homepage": "https://ice.work", "bugs": "https://github.com/alibaba/ice/issues", + "scripts": { + "setup": "rm -rf node_modules packages/*/node_modules && pnpm install && pnpm setup-crates", + "setup-crates": "node scripts/clone-rspack.mjs", + "test": "node scripts/test.mjs" + }, "devDependencies": { "git-clone": "0.2.0", "rimraf": "^5.0.5", "fs-extra": "^11.1.1", - "ora": "^7.0.1" + "ora": "^7.0.1", + "js-yaml": "4.1.0" }, "repository": { "type": "git", "url": "https://github.com/alibaba/ice" - } + }, + "packageManager": "pnpm@8.9.2" } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2786b92..2899f6d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,382 +1,97 @@ -lockfileVersion: 5.4 +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false importers: .: - specifiers: - fs-extra: ^11.1.1 - git-clone: 0.2.0 - ora: ^7.0.1 - rimraf: ^5.0.5 devDependencies: - fs-extra: 11.1.1 - git-clone: 0.2.0 - ora: 7.0.1 - rimraf: 5.0.5 + fs-extra: + specifier: ^11.1.1 + version: 11.1.1 + git-clone: + specifier: 0.2.0 + version: 0.2.0 + js-yaml: + specifier: 4.1.0 + version: 4.1.0 + ora: + specifier: ^7.0.1 + version: 7.0.1 + rimraf: + specifier: ^5.0.5 + version: 5.0.5 crates/node_binding: - specifiers: - '@napi-rs/cli': 3.0.0-alpha.3 - ava: ^5.1.1 - call-bind: 1.0.2 devDependencies: - '@napi-rs/cli': 3.0.0-alpha.3 - ava: 5.3.1 - call-bind: 1.0.2 + '@napi-rs/cli': + specifier: ^2.16.3 + version: 2.16.3 packages: - /@isaacs/cliui/8.0.2: + /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} dependencies: string-width: 5.1.2 - string-width-cjs: /string-width/4.2.3 + string-width-cjs: /string-width@4.2.3 strip-ansi: 7.1.0 - strip-ansi-cjs: /strip-ansi/6.0.1 + strip-ansi-cjs: /strip-ansi@6.0.1 wrap-ansi: 8.1.0 - wrap-ansi-cjs: /wrap-ansi/7.0.0 - dev: true - - /@ljharb/through/2.3.10: - resolution: {integrity: sha512-NwkQ4+jf4tMpDSlRc1wlttHnC7KfII+SjdqDEwEuQ7W0IaTK5Ab1jxCJrH6pYsLbLXiQgRn+nFQsGmKowbAKkA==} - engines: {node: '>= 0.4'} + wrap-ansi-cjs: /wrap-ansi@7.0.0 dev: true - /@napi-rs/cli/3.0.0-alpha.3: - resolution: {integrity: sha512-s5RHKqbqUVVfwgr/wO7S/vdqQ9shQzvIETgdz57r1Gg4bRv8kqy2Q1LfJAQJ09Y9Ddao9jKErvz4+11gHZZrWA==} - engines: {node: '>= 16'} + /@napi-rs/cli@2.16.3: + resolution: {integrity: sha512-3mLNPlbbOhpbIUKicLrJtIearlHXUuXL3UeueYyRRplpVMNkdn8xCyzY6PcYZi3JXR8bmCOiWgkVmLnrSL7DKw==} + engines: {node: '>= 10'} hasBin: true - dependencies: - '@octokit/rest': 19.0.13 - clipanion: 3.2.1 - colorette: 2.0.20 - debug: 4.3.4 - inquirer: 9.2.11 - js-yaml: 4.1.0 - lodash-es: 4.17.21 - typanion: 3.14.0 - transitivePeerDependencies: - - encoding - - supports-color - dev: true - - /@nodelib/fs.scandir/2.1.5: - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - dev: true - - /@nodelib/fs.stat/2.0.5: - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - dev: true - - /@nodelib/fs.walk/1.2.8: - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.15.0 - dev: true - - /@octokit/auth-token/3.0.4: - resolution: {integrity: sha512-TWFX7cZF2LXoCvdmJWY7XVPi74aSY0+FfBZNSXEXFkMpjcqsQwDSYVv5FhRFaI0V1ECnwbz4j59T/G+rXNWaIQ==} - engines: {node: '>= 14'} - dev: true - - /@octokit/core/4.2.4: - resolution: {integrity: sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==} - engines: {node: '>= 14'} - dependencies: - '@octokit/auth-token': 3.0.4 - '@octokit/graphql': 5.0.6 - '@octokit/request': 6.2.8 - '@octokit/request-error': 3.0.3 - '@octokit/types': 9.3.2 - before-after-hook: 2.2.3 - universal-user-agent: 6.0.0 - transitivePeerDependencies: - - encoding - dev: true - - /@octokit/endpoint/7.0.6: - resolution: {integrity: sha512-5L4fseVRUsDFGR00tMWD/Trdeeihn999rTMGRMC1G/Ldi1uWlWJzI98H4Iak5DB/RVvQuyMYKqSK/R6mbSOQyg==} - engines: {node: '>= 14'} - dependencies: - '@octokit/types': 9.3.2 - is-plain-object: 5.0.0 - universal-user-agent: 6.0.0 - dev: true - - /@octokit/graphql/5.0.6: - resolution: {integrity: sha512-Fxyxdy/JH0MnIB5h+UQ3yCoh1FG4kWXfFKkpWqjZHw/p+Kc8Y44Hu/kCgNBT6nU1shNumEchmW/sUO1JuQnPcw==} - engines: {node: '>= 14'} - dependencies: - '@octokit/request': 6.2.8 - '@octokit/types': 9.3.2 - universal-user-agent: 6.0.0 - transitivePeerDependencies: - - encoding - dev: true - - /@octokit/openapi-types/18.1.1: - resolution: {integrity: sha512-VRaeH8nCDtF5aXWnjPuEMIYf1itK/s3JYyJcWFJT8X9pSNnBtriDf7wlEWsGuhPLl4QIH4xM8fqTXDwJ3Mu6sw==} - dev: true - - /@octokit/plugin-paginate-rest/6.1.2_@octokit+core@4.2.4: - resolution: {integrity: sha512-qhrmtQeHU/IivxucOV1bbI/xZyC/iOBhclokv7Sut5vnejAIAEXVcGQeRpQlU39E0WwK9lNvJHphHri/DB6lbQ==} - engines: {node: '>= 14'} - peerDependencies: - '@octokit/core': '>=4' - dependencies: - '@octokit/core': 4.2.4 - '@octokit/tsconfig': 1.0.2 - '@octokit/types': 9.3.2 - dev: true - - /@octokit/plugin-request-log/1.0.4_@octokit+core@4.2.4: - resolution: {integrity: sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==} - peerDependencies: - '@octokit/core': '>=3' - dependencies: - '@octokit/core': 4.2.4 - dev: true - - /@octokit/plugin-rest-endpoint-methods/7.2.3_@octokit+core@4.2.4: - resolution: {integrity: sha512-I5Gml6kTAkzVlN7KCtjOM+Ruwe/rQppp0QU372K1GP7kNOYEKe8Xn5BW4sE62JAHdwpq95OQK/qGNyKQMUzVgA==} - engines: {node: '>= 14'} - peerDependencies: - '@octokit/core': '>=3' - dependencies: - '@octokit/core': 4.2.4 - '@octokit/types': 10.0.0 - dev: true - - /@octokit/request-error/3.0.3: - resolution: {integrity: sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==} - engines: {node: '>= 14'} - dependencies: - '@octokit/types': 9.3.2 - deprecation: 2.3.1 - once: 1.4.0 - dev: true - - /@octokit/request/6.2.8: - resolution: {integrity: sha512-ow4+pkVQ+6XVVsekSYBzJC0VTVvh/FCTUUgTsboGq+DTeWdyIFV8WSCdo0RIxk6wSkBTHqIK1mYuY7nOBXOchw==} - engines: {node: '>= 14'} - dependencies: - '@octokit/endpoint': 7.0.6 - '@octokit/request-error': 3.0.3 - '@octokit/types': 9.3.2 - is-plain-object: 5.0.0 - node-fetch: 2.7.0 - universal-user-agent: 6.0.0 - transitivePeerDependencies: - - encoding - dev: true - - /@octokit/rest/19.0.13: - resolution: {integrity: sha512-/EzVox5V9gYGdbAI+ovYj3nXQT1TtTHRT+0eZPcuC05UFSWO3mdO9UY1C0i2eLF9Un1ONJkAk+IEtYGAC+TahA==} - engines: {node: '>= 14'} - dependencies: - '@octokit/core': 4.2.4 - '@octokit/plugin-paginate-rest': 6.1.2_@octokit+core@4.2.4 - '@octokit/plugin-request-log': 1.0.4_@octokit+core@4.2.4 - '@octokit/plugin-rest-endpoint-methods': 7.2.3_@octokit+core@4.2.4 - transitivePeerDependencies: - - encoding - dev: true - - /@octokit/tsconfig/1.0.2: - resolution: {integrity: sha512-I0vDR0rdtP8p2lGMzvsJzbhdOWy405HcGovrspJ8RRibHnyRgggUSNO5AIox5LmqiwmatHKYsvj6VGFHkqS7lA==} - dev: true - - /@octokit/types/10.0.0: - resolution: {integrity: sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg==} - dependencies: - '@octokit/openapi-types': 18.1.1 dev: true - /@octokit/types/9.3.2: - resolution: {integrity: sha512-D4iHGTdAnEEVsB8fl95m1hiz7D5YiRdQ9b/OEb3BYRVwbLsGHcRVPz+u+BgRLNk0Q0/4iZCBqDN96j2XNxfXrA==} - dependencies: - '@octokit/openapi-types': 18.1.1 - dev: true - - /@pkgjs/parseargs/0.11.0: + /@pkgjs/parseargs@0.11.0: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} requiresBuild: true dev: true optional: true - /acorn-walk/8.2.0: - resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} - engines: {node: '>=0.4.0'} - dev: true - - /acorn/8.10.0: - resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - - /aggregate-error/4.0.1: - resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==} - engines: {node: '>=12'} - dependencies: - clean-stack: 4.2.0 - indent-string: 5.0.0 - dev: true - - /ansi-escapes/4.3.2: - resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} - engines: {node: '>=8'} - dependencies: - type-fest: 0.21.3 - dev: true - - /ansi-regex/5.0.1: + /ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} dev: true - /ansi-regex/6.0.1: + /ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} dev: true - /ansi-styles/4.3.0: + /ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} dependencies: color-convert: 2.0.1 dev: true - /ansi-styles/6.2.1: + /ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} dev: true - /anymatch/3.1.3: - resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} - engines: {node: '>= 8'} - dependencies: - normalize-path: 3.0.0 - picomatch: 2.3.1 - dev: true - - /argparse/1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - dependencies: - sprintf-js: 1.0.3 - dev: true - - /argparse/2.0.1: + /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} dev: true - /array-find-index/1.0.2: - resolution: {integrity: sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==} - engines: {node: '>=0.10.0'} - dev: true - - /arrgv/1.0.2: - resolution: {integrity: sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw==} - engines: {node: '>=8.0.0'} - dev: true - - /arrify/3.0.0: - resolution: {integrity: sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==} - engines: {node: '>=12'} - dev: true - - /ava/5.3.1: - resolution: {integrity: sha512-Scv9a4gMOXB6+ni4toLuhAm9KYWEjsgBglJl+kMGI5+IVDt120CCDZyB5HNU9DjmLI2t4I0GbnxGLmmRfGTJGg==} - engines: {node: '>=14.19 <15 || >=16.15 <17 || >=18'} - hasBin: true - peerDependencies: - '@ava/typescript': '*' - peerDependenciesMeta: - '@ava/typescript': - optional: true - dependencies: - acorn: 8.10.0 - acorn-walk: 8.2.0 - ansi-styles: 6.2.1 - arrgv: 1.0.2 - arrify: 3.0.0 - callsites: 4.1.0 - cbor: 8.1.0 - chalk: 5.3.0 - chokidar: 3.5.3 - chunkd: 2.0.1 - ci-info: 3.9.0 - ci-parallel-vars: 1.0.1 - clean-yaml-object: 0.1.0 - cli-truncate: 3.1.0 - code-excerpt: 4.0.0 - common-path-prefix: 3.0.0 - concordance: 5.0.4 - currently-unhandled: 0.4.1 - debug: 4.3.4 - emittery: 1.0.1 - figures: 5.0.0 - globby: 13.2.2 - ignore-by-default: 2.1.0 - indent-string: 5.0.0 - is-error: 2.2.2 - is-plain-object: 5.0.0 - is-promise: 4.0.0 - matcher: 5.0.0 - mem: 9.0.2 - ms: 2.1.3 - p-event: 5.0.1 - p-map: 5.5.0 - picomatch: 2.3.1 - pkg-conf: 4.0.0 - plur: 5.1.0 - pretty-ms: 8.0.0 - resolve-cwd: 3.0.0 - stack-utils: 2.0.6 - strip-ansi: 7.1.0 - supertap: 3.0.1 - temp-dir: 3.0.0 - write-file-atomic: 5.0.1 - yargs: 17.7.2 - transitivePeerDependencies: - - supports-color - dev: true - - /balanced-match/1.0.2: + /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true - /base64-js/1.5.1: + /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} dev: true - /before-after-hook/2.2.3: - resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} - dev: true - - /binary-extensions/2.2.0: - resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} - engines: {node: '>=8'} - dev: true - - /bl/4.1.0: - resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} - dependencies: - buffer: 5.7.1 - inherits: 2.0.4 - readable-stream: 3.6.2 - dev: true - - /bl/5.1.0: + /bl@5.1.0: resolution: {integrity: sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==} dependencies: buffer: 6.0.3 @@ -384,211 +99,48 @@ packages: readable-stream: 3.6.2 dev: true - /blueimp-md5/2.19.0: - resolution: {integrity: sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==} - dev: true - - /brace-expansion/2.0.1: + /brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} dependencies: balanced-match: 1.0.2 dev: true - /braces/3.0.2: - resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} - engines: {node: '>=8'} - dependencies: - fill-range: 7.0.1 - dev: true - - /buffer/5.7.1: - resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - dev: true - - /buffer/6.0.3: + /buffer@6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} dependencies: base64-js: 1.5.1 ieee754: 1.2.1 dev: true - /call-bind/1.0.2: - resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} - dependencies: - function-bind: 1.1.1 - get-intrinsic: 1.2.1 - dev: true - - /callsites/4.1.0: - resolution: {integrity: sha512-aBMbD1Xxay75ViYezwT40aQONfr+pSXTHwNKvIXhXD6+LY3F1dLIcceoC5OZKBVHbXcysz1hL9D2w0JJIMXpUw==} - engines: {node: '>=12.20'} - dev: true - - /cbor/8.1.0: - resolution: {integrity: sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==} - engines: {node: '>=12.19'} - dependencies: - nofilter: 3.1.0 - dev: true - - /chalk/4.1.2: - resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} - engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: true - - /chalk/5.3.0: + /chalk@5.3.0: resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} dev: true - /chardet/0.7.0: - resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} - dev: true - - /chokidar/3.5.3: - resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} - engines: {node: '>= 8.10.0'} - dependencies: - anymatch: 3.1.3 - braces: 3.0.2 - glob-parent: 5.1.2 - is-binary-path: 2.1.0 - is-glob: 4.0.3 - normalize-path: 3.0.0 - readdirp: 3.6.0 - optionalDependencies: - fsevents: 2.3.3 - dev: true - - /chunkd/2.0.1: - resolution: {integrity: sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==} - dev: true - - /ci-info/3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} - engines: {node: '>=8'} - dev: true - - /ci-parallel-vars/1.0.1: - resolution: {integrity: sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg==} - dev: true - - /clean-stack/4.2.0: - resolution: {integrity: sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==} - engines: {node: '>=12'} - dependencies: - escape-string-regexp: 5.0.0 - dev: true - - /clean-yaml-object/0.1.0: - resolution: {integrity: sha512-3yONmlN9CSAkzNwnRCiJQ7Q2xK5mWuEfL3PuTZcAUzhObbXsfsnMptJzXwz93nc5zn9V9TwCVMmV7w4xsm43dw==} - engines: {node: '>=0.10.0'} - dev: true - - /cli-cursor/3.1.0: - resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} - engines: {node: '>=8'} - dependencies: - restore-cursor: 3.1.0 - dev: true - - /cli-cursor/4.0.0: + /cli-cursor@4.0.0: resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: restore-cursor: 4.0.0 dev: true - /cli-spinners/2.9.1: + /cli-spinners@2.9.1: resolution: {integrity: sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==} engines: {node: '>=6'} dev: true - /cli-truncate/3.1.0: - resolution: {integrity: sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - slice-ansi: 5.0.0 - string-width: 5.1.2 - dev: true - - /cli-width/4.1.0: - resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} - engines: {node: '>= 12'} - dev: true - - /clipanion/3.2.1: - resolution: {integrity: sha512-dYFdjLb7y1ajfxQopN05mylEpK9ZX0sO1/RfMXdfmwjlIsPkbh4p7A682x++zFPLDCo1x3p82dtljHf5cW2LKA==} - dependencies: - typanion: 3.14.0 - dev: true - - /cliui/8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - dev: true - - /clone/1.0.4: - resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} - engines: {node: '>=0.8'} - dev: true - - /code-excerpt/4.0.0: - resolution: {integrity: sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - convert-to-spaces: 2.0.1 - dev: true - - /color-convert/2.0.1: + /color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} dependencies: color-name: 1.1.4 dev: true - /color-name/1.1.4: + /color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true - /colorette/2.0.20: - resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} - dev: true - - /common-path-prefix/3.0.0: - resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} - dev: true - - /concordance/5.0.4: - resolution: {integrity: sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==} - engines: {node: '>=10.18.0 <11 || >=12.14.0 <13 || >=14'} - dependencies: - date-time: 3.1.0 - esutils: 2.0.3 - fast-diff: 1.3.0 - js-string-escape: 1.0.1 - lodash: 4.17.21 - md5-hex: 3.0.1 - semver: 7.5.4 - well-known-symbols: 2.0.0 - dev: true - - /convert-to-spaces/2.0.1: - resolution: {integrity: sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - - /cross-spawn/7.0.3: + /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} dependencies: @@ -597,150 +149,23 @@ packages: which: 2.0.2 dev: true - /currently-unhandled/0.4.1: - resolution: {integrity: sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==} - engines: {node: '>=0.10.0'} - dependencies: - array-find-index: 1.0.2 - dev: true - - /date-time/3.1.0: - resolution: {integrity: sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==} - engines: {node: '>=6'} - dependencies: - time-zone: 1.0.0 - dev: true - - /debug/4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: true - - /defaults/1.0.4: - resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} - dependencies: - clone: 1.0.4 - dev: true - - /deprecation/2.3.1: - resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} - dev: true - - /dir-glob/3.0.1: - resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} - engines: {node: '>=8'} - dependencies: - path-type: 4.0.0 - dev: true - - /eastasianwidth/0.2.0: + /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true - /emittery/1.0.1: - resolution: {integrity: sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ==} - engines: {node: '>=14.16'} - dev: true - - /emoji-regex/10.2.1: + /emoji-regex@10.2.1: resolution: {integrity: sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==} dev: true - /emoji-regex/8.0.0: + /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} dev: true - /emoji-regex/9.2.2: + /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} dev: true - /escalade/3.1.1: - resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} - engines: {node: '>=6'} - dev: true - - /escape-string-regexp/2.0.0: - resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} - engines: {node: '>=8'} - dev: true - - /escape-string-regexp/5.0.0: - resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} - engines: {node: '>=12'} - dev: true - - /esprima/4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - dev: true - - /esutils/2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - dev: true - - /external-editor/3.1.0: - resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} - engines: {node: '>=4'} - dependencies: - chardet: 0.7.0 - iconv-lite: 0.4.24 - tmp: 0.0.33 - dev: true - - /fast-diff/1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - dev: true - - /fast-glob/3.3.1: - resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} - engines: {node: '>=8.6.0'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.5 - dev: true - - /fastq/1.15.0: - resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} - dependencies: - reusify: 1.0.4 - dev: true - - /figures/5.0.0: - resolution: {integrity: sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==} - engines: {node: '>=14'} - dependencies: - escape-string-regexp: 5.0.0 - is-unicode-supported: 1.3.0 - dev: true - - /fill-range/7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} - engines: {node: '>=8'} - dependencies: - to-regex-range: 5.0.1 - dev: true - - /find-up/6.3.0: - resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - locate-path: 7.2.0 - path-exists: 5.0.0 - dev: true - - /foreground-child/3.1.1: + /foreground-child@3.1.1: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} engines: {node: '>=14'} dependencies: @@ -748,7 +173,7 @@ packages: signal-exit: 4.1.0 dev: true - /fs-extra/11.1.1: + /fs-extra@11.1.1: resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} engines: {node: '>=14.14'} dependencies: @@ -757,223 +182,54 @@ packages: universalify: 2.0.0 dev: true - /fsevents/2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /function-bind/1.1.1: - resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} - dev: true - - /get-caller-file/2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - dev: true - - /get-intrinsic/1.2.1: - resolution: {integrity: sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==} - dependencies: - function-bind: 1.1.1 - has: 1.0.4 - has-proto: 1.0.1 - has-symbols: 1.0.3 - dev: true - - /git-clone/0.2.0: + /git-clone@0.2.0: resolution: {integrity: sha512-1UAkEPIFbyjHaddljUKvPhhLRnrKaImT71T7rdvSvWLXw95nLdhdi6Qmlx0KOWoV1qqvHGLq5lMLJEZM0JXk8A==} dev: true - /glob-parent/5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - dependencies: - is-glob: 4.0.3 - dev: true - - /glob/10.3.10: + /glob@10.3.10: resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} engines: {node: '>=16 || 14 >=14.17'} hasBin: true dependencies: foreground-child: 3.1.1 jackspeak: 2.3.6 - minimatch: 9.0.3 - minipass: 7.0.4 - path-scurry: 1.10.1 - dev: true - - /globby/13.2.2: - resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - dir-glob: 3.0.1 - fast-glob: 3.3.1 - ignore: 5.2.4 - merge2: 1.4.1 - slash: 4.0.0 - dev: true - - /graceful-fs/4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - dev: true - - /has-flag/4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - dev: true - - /has-proto/1.0.1: - resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} - engines: {node: '>= 0.4'} - dev: true - - /has-symbols/1.0.3: - resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} - engines: {node: '>= 0.4'} - dev: true - - /has/1.0.4: - resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} - engines: {node: '>= 0.4.0'} - dev: true - - /iconv-lite/0.4.24: - resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: true - - /ieee754/1.2.1: - resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - dev: true - - /ignore-by-default/2.1.0: - resolution: {integrity: sha512-yiWd4GVmJp0Q6ghmM2B/V3oZGRmjrKLXvHR3TE1nfoXsmoggllfZUQe74EN0fJdPFZu2NIvNdrMMLm3OsV7Ohw==} - engines: {node: '>=10 <11 || >=12 <13 || >=14'} - dev: true - - /ignore/5.2.4: - resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} - engines: {node: '>= 4'} - dev: true - - /imurmurhash/0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - dev: true - - /indent-string/5.0.0: - resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==} - engines: {node: '>=12'} - dev: true - - /inherits/2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: true - - /inquirer/9.2.11: - resolution: {integrity: sha512-B2LafrnnhbRzCWfAdOXisUzL89Kg8cVJlYmhqoi3flSiV/TveO+nsXwgKr9h9PIo+J1hz7nBSk6gegRIMBBf7g==} - engines: {node: '>=14.18.0'} - dependencies: - '@ljharb/through': 2.3.10 - ansi-escapes: 4.3.2 - chalk: 5.3.0 - cli-cursor: 3.1.0 - cli-width: 4.1.0 - external-editor: 3.1.0 - figures: 5.0.0 - lodash: 4.17.21 - mute-stream: 1.0.0 - ora: 5.4.1 - run-async: 3.0.0 - rxjs: 7.8.1 - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 6.2.0 - dev: true - - /irregular-plurals/3.5.0: - resolution: {integrity: sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==} - engines: {node: '>=8'} - dev: true - - /is-binary-path/2.1.0: - resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} - engines: {node: '>=8'} - dependencies: - binary-extensions: 2.2.0 - dev: true - - /is-error/2.2.2: - resolution: {integrity: sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg==} - dev: true - - /is-extglob/2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - dev: true - - /is-fullwidth-code-point/3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - dev: true - - /is-fullwidth-code-point/4.0.0: - resolution: {integrity: sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==} - engines: {node: '>=12'} - dev: true - - /is-glob/4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - dependencies: - is-extglob: 2.1.1 - dev: true - - /is-interactive/1.0.0: - resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} - engines: {node: '>=8'} + minimatch: 9.0.3 + minipass: 7.0.4 + path-scurry: 1.10.1 dev: true - /is-interactive/2.0.0: - resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} - engines: {node: '>=12'} + /graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} dev: true - /is-number/7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} + /ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: true - /is-plain-object/5.0.0: - resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} - engines: {node: '>=0.10.0'} + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} dev: true - /is-promise/4.0.0: - resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + /is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} dev: true - /is-unicode-supported/0.1.0: - resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} - engines: {node: '>=10'} + /is-interactive@2.0.0: + resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} + engines: {node: '>=12'} dev: true - /is-unicode-supported/1.3.0: + /is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} engines: {node: '>=12'} dev: true - /isexe/2.0.0: + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true - /jackspeak/2.3.6: + /jackspeak@2.3.6: resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} engines: {node: '>=14'} dependencies: @@ -982,27 +238,14 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true - /js-string-escape/1.0.1: - resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} - engines: {node: '>= 0.8'} - dev: true - - /js-yaml/3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - dev: true - - /js-yaml/4.1.0: + /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true dependencies: argparse: 2.0.1 dev: true - /jsonfile/6.1.0: + /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} dependencies: universalify: 2.0.0 @@ -1010,35 +253,7 @@ packages: graceful-fs: 4.2.11 dev: true - /load-json-file/7.0.1: - resolution: {integrity: sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - - /locate-path/7.2.0: - resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-locate: 6.0.0 - dev: true - - /lodash-es/4.17.21: - resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} - dev: true - - /lodash/4.17.21: - resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - dev: true - - /log-symbols/4.1.0: - resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} - engines: {node: '>=10'} - dependencies: - chalk: 4.1.2 - is-unicode-supported: 0.1.0 - dev: true - - /log-symbols/5.1.0: + /log-symbols@5.1.0: resolution: {integrity: sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==} engines: {node: '>=12'} dependencies: @@ -1046,146 +261,36 @@ packages: is-unicode-supported: 1.3.0 dev: true - /lru-cache/10.0.1: + /lru-cache@10.0.1: resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==} engines: {node: 14 || >=16.14} dev: true - /lru-cache/6.0.0: - resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} - engines: {node: '>=10'} - dependencies: - yallist: 4.0.0 - dev: true - - /map-age-cleaner/0.1.3: - resolution: {integrity: sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==} - engines: {node: '>=6'} - dependencies: - p-defer: 1.0.0 - dev: true - - /matcher/5.0.0: - resolution: {integrity: sha512-s2EMBOWtXFc8dgqvoAzKJXxNHibcdJMV0gwqKUaw9E2JBJuGUK7DrNKrA6g/i+v72TT16+6sVm5mS3thaMLQUw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - escape-string-regexp: 5.0.0 - dev: true - - /md5-hex/3.0.1: - resolution: {integrity: sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==} - engines: {node: '>=8'} - dependencies: - blueimp-md5: 2.19.0 - dev: true - - /mem/9.0.2: - resolution: {integrity: sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==} - engines: {node: '>=12.20'} - dependencies: - map-age-cleaner: 0.1.3 - mimic-fn: 4.0.0 - dev: true - - /merge2/1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - dev: true - - /micromatch/4.0.5: - resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} - engines: {node: '>=8.6'} - dependencies: - braces: 3.0.2 - picomatch: 2.3.1 - dev: true - - /mimic-fn/2.1.0: + /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} dev: true - /mimic-fn/4.0.0: - resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} - engines: {node: '>=12'} - dev: true - - /minimatch/9.0.3: + /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 dev: true - /minipass/7.0.4: + /minipass@7.0.4: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} dev: true - /ms/2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - dev: true - - /ms/2.1.3: - resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - dev: true - - /mute-stream/1.0.0: - resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dev: true - - /node-fetch/2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true - dependencies: - whatwg-url: 5.0.0 - dev: true - - /nofilter/3.1.0: - resolution: {integrity: sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==} - engines: {node: '>=12.19'} - dev: true - - /normalize-path/3.0.0: - resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} - engines: {node: '>=0.10.0'} - dev: true - - /once/1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - dependencies: - wrappy: 1.0.2 - dev: true - - /onetime/5.1.2: + /onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} dependencies: mimic-fn: 2.1.0 dev: true - /ora/5.4.1: - resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==} - engines: {node: '>=10'} - dependencies: - bl: 4.1.0 - chalk: 4.1.2 - cli-cursor: 3.1.0 - cli-spinners: 2.9.1 - is-interactive: 1.0.0 - is-unicode-supported: 0.1.0 - log-symbols: 4.1.0 - strip-ansi: 6.0.1 - wcwidth: 1.0.1 - dev: true - - /ora/7.0.1: + /ora@7.0.1: resolution: {integrity: sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==} engines: {node: '>=16'} dependencies: @@ -1200,65 +305,12 @@ packages: strip-ansi: 7.1.0 dev: true - /os-tmpdir/1.0.2: - resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} - engines: {node: '>=0.10.0'} - dev: true - - /p-defer/1.0.0: - resolution: {integrity: sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==} - engines: {node: '>=4'} - dev: true - - /p-event/5.0.1: - resolution: {integrity: sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-timeout: 5.1.0 - dev: true - - /p-limit/4.0.0: - resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - yocto-queue: 1.0.0 - dev: true - - /p-locate/6.0.0: - resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-limit: 4.0.0 - dev: true - - /p-map/5.5.0: - resolution: {integrity: sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==} - engines: {node: '>=12'} - dependencies: - aggregate-error: 4.0.1 - dev: true - - /p-timeout/5.1.0: - resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} - engines: {node: '>=12'} - dev: true - - /parse-ms/3.0.0: - resolution: {integrity: sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==} - engines: {node: '>=12'} - dev: true - - /path-exists/5.0.0: - resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - - /path-key/3.1.1: + /path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} dev: true - /path-scurry/1.10.1: + /path-scurry@1.10.1: resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} engines: {node: '>=16 || 14 >=14.17'} dependencies: @@ -1266,43 +318,7 @@ packages: minipass: 7.0.4 dev: true - /path-type/4.0.0: - resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} - engines: {node: '>=8'} - dev: true - - /picomatch/2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - dev: true - - /pkg-conf/4.0.0: - resolution: {integrity: sha512-7dmgi4UY4qk+4mj5Cd8v/GExPo0K+SlY+hulOSdfZ/T6jVH6//y7NtzZo5WrfhDBxuQ0jCa7fLZmNaNh7EWL/w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - find-up: 6.3.0 - load-json-file: 7.0.1 - dev: true - - /plur/5.1.0: - resolution: {integrity: sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - irregular-plurals: 3.5.0 - dev: true - - /pretty-ms/8.0.0: - resolution: {integrity: sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==} - engines: {node: '>=14.16'} - dependencies: - parse-ms: 3.0.0 - dev: true - - /queue-microtask/1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - dev: true - - /readable-stream/3.6.2: + /readable-stream@3.6.2: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} dependencies: @@ -1311,39 +327,7 @@ packages: util-deprecate: 1.0.2 dev: true - /readdirp/3.6.0: - resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} - engines: {node: '>=8.10.0'} - dependencies: - picomatch: 2.3.1 - dev: true - - /require-directory/2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - dev: true - - /resolve-cwd/3.0.0: - resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} - engines: {node: '>=8'} - dependencies: - resolve-from: 5.0.0 - dev: true - - /resolve-from/5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - dev: true - - /restore-cursor/3.1.0: - resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} - engines: {node: '>=8'} - dependencies: - onetime: 5.1.2 - signal-exit: 3.0.7 - dev: true - - /restore-cursor/4.0.0: + /restore-cursor@4.0.0: resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: @@ -1351,12 +335,7 @@ packages: signal-exit: 3.0.7 dev: true - /reusify/1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - dev: true - - /rimraf/5.0.5: + /rimraf@5.0.5: resolution: {integrity: sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==} engines: {node: '>=14'} hasBin: true @@ -1364,99 +343,39 @@ packages: glob: 10.3.10 dev: true - /run-async/3.0.0: - resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==} - engines: {node: '>=0.12.0'} - dev: true - - /run-parallel/1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - dependencies: - queue-microtask: 1.2.3 - dev: true - - /rxjs/7.8.1: - resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} - dependencies: - tslib: 2.6.2 - dev: true - - /safe-buffer/5.2.1: + /safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} dev: true - /safer-buffer/2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: true - - /semver/7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - dev: true - - /serialize-error/7.0.1: - resolution: {integrity: sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==} - engines: {node: '>=10'} - dependencies: - type-fest: 0.13.1 - dev: true - - /shebang-command/2.0.0: + /shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} dependencies: shebang-regex: 3.0.0 dev: true - /shebang-regex/3.0.0: + /shebang-regex@3.0.0: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} dev: true - /signal-exit/3.0.7: + /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true - /signal-exit/4.1.0: + /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} dev: true - /slash/4.0.0: - resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} - engines: {node: '>=12'} - dev: true - - /slice-ansi/5.0.0: - resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==} - engines: {node: '>=12'} - dependencies: - ansi-styles: 6.2.1 - is-fullwidth-code-point: 4.0.0 - dev: true - - /sprintf-js/1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - dev: true - - /stack-utils/2.0.6: - resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} - engines: {node: '>=10'} - dependencies: - escape-string-regexp: 2.0.0 - dev: true - - /stdin-discarder/0.1.0: + /stdin-discarder@0.1.0: resolution: {integrity: sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: bl: 5.1.0 dev: true - /string-width/4.2.3: + /string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} dependencies: @@ -1465,7 +384,7 @@ packages: strip-ansi: 6.0.1 dev: true - /string-width/5.1.2: + /string-width@5.1.2: resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} engines: {node: '>=12'} dependencies: @@ -1474,7 +393,7 @@ packages: strip-ansi: 7.1.0 dev: true - /string-width/6.1.0: + /string-width@6.1.0: resolution: {integrity: sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==} engines: {node: '>=16'} dependencies: @@ -1483,125 +402,36 @@ packages: strip-ansi: 7.1.0 dev: true - /string_decoder/1.3.0: + /string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: safe-buffer: 5.2.1 dev: true - /strip-ansi/6.0.1: + /strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} dependencies: ansi-regex: 5.0.1 dev: true - /strip-ansi/7.1.0: + /strip-ansi@7.1.0: resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} engines: {node: '>=12'} dependencies: ansi-regex: 6.0.1 dev: true - /supertap/3.0.1: - resolution: {integrity: sha512-u1ZpIBCawJnO+0QePsEiOknOfCRq0yERxiAchT0i4li0WHNUJbf0evXXSXOcCAR4M8iMDoajXYmstm/qO81Isw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - indent-string: 5.0.0 - js-yaml: 3.14.1 - serialize-error: 7.0.1 - strip-ansi: 7.1.0 - dev: true - - /supports-color/7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} - dependencies: - has-flag: 4.0.0 - dev: true - - /temp-dir/3.0.0: - resolution: {integrity: sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==} - engines: {node: '>=14.16'} - dev: true - - /time-zone/1.0.0: - resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==} - engines: {node: '>=4'} - dev: true - - /tmp/0.0.33: - resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} - engines: {node: '>=0.6.0'} - dependencies: - os-tmpdir: 1.0.2 - dev: true - - /to-regex-range/5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - dependencies: - is-number: 7.0.0 - dev: true - - /tr46/0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - dev: true - - /tslib/2.6.2: - resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - dev: true - - /typanion/3.14.0: - resolution: {integrity: sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==} - dev: true - - /type-fest/0.13.1: - resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} - engines: {node: '>=10'} - dev: true - - /type-fest/0.21.3: - resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} - engines: {node: '>=10'} - dev: true - - /universal-user-agent/6.0.0: - resolution: {integrity: sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==} - dev: true - - /universalify/2.0.0: + /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} dev: true - /util-deprecate/1.0.2: + /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true - /wcwidth/1.0.1: - resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} - dependencies: - defaults: 1.0.4 - dev: true - - /webidl-conversions/3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - dev: true - - /well-known-symbols/2.0.0: - resolution: {integrity: sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==} - engines: {node: '>=6'} - dev: true - - /whatwg-url/5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - dev: true - - /which/2.0.2: + /which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} hasBin: true @@ -1609,16 +439,7 @@ packages: isexe: 2.0.0 dev: true - /wrap-ansi/6.2.0: - resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} - engines: {node: '>=8'} - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - dev: true - - /wrap-ansi/7.0.0: + /wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} dependencies: @@ -1627,7 +448,7 @@ packages: strip-ansi: 6.0.1 dev: true - /wrap-ansi/8.1.0: + /wrap-ansi@8.1.0: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} dependencies: @@ -1635,47 +456,3 @@ packages: string-width: 5.1.2 strip-ansi: 7.1.0 dev: true - - /wrappy/1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: true - - /write-file-atomic/5.0.1: - resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dependencies: - imurmurhash: 0.1.4 - signal-exit: 4.1.0 - dev: true - - /y18n/5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - dev: true - - /yallist/4.0.0: - resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true - - /yargs-parser/21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - dev: true - - /yargs/17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} - dependencies: - cliui: 8.0.1 - escalade: 3.1.1 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 21.1.1 - dev: true - - /yocto-queue/1.0.0: - resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} - engines: {node: '>=12.20'} - dev: true diff --git a/scripts/clean.mjs b/scripts/clean.mjs new file mode 100644 index 0000000..d5175f3 --- /dev/null +++ b/scripts/clean.mjs @@ -0,0 +1,4 @@ +import { copyAndCleanUp, getGithubInfo } from "./github.mjs"; + +const { temp, dest } = getGithubInfo(); +copyAndCleanUp(temp, dest); diff --git a/scripts/clone-rspack.mjs b/scripts/clone-rspack.mjs index cdd4d34..428c9df 100644 --- a/scripts/clone-rspack.mjs +++ b/scripts/clone-rspack.mjs @@ -1,49 +1,3 @@ -import gitclone from 'git-clone/promise.js'; -import { rimraf } from 'rimraf'; -import ora from 'ora'; -import fse from 'fs-extra'; +import { getRspackCrates } from './github.mjs'; -const REPO = 'git@github.com:web-infra-dev/rspack.git'; -const DEST = 'crates/.rspack_crates/'; -const CEHECKOUT = 'v0.3.6'; - -function createSpinner( - text, - options = {}, -) { - const spinner = ora({ - text, - stream: process.stdout, - isEnabled: process.stdout.isTTY, - interval: 200, - ...options, - }); - spinner.start(); - return spinner; -} - -async function getRspackCrates(repo, dest, checkout) { - let cloneError = null; - const cloneDest = `${dest}/.temp`; - const spinner = createSpinner('Cloning rspack repo...'); - // Step 1: remove dir. - await rimraf(dest); - // Step2: clone git repo. - await gitclone(repo, cloneDest, { checkout }).catch((err) => {cloneError = err;}); - if (!cloneError) { - // Step3: only copy crates dir to the dest. - spinner.text = 'Copying crates to the dest...'; - fse.copySync(cloneDest + '/crates', dest); - // Step4: remove useless files. - spinner.text = 'Clean up...'; - await rimraf(cloneDest); - spinner.succeed('Cloning rspack repo succeed.'); - } else { - spinner.fail('Cloning rspack repo failed.'); - // Clean temp dir if clone failed. - await rimraf(cloneDest); - console.log(cloneError); - } -} - -getRspackCrates(REPO, DEST, CEHECKOUT); \ No newline at end of file +getRspackCrates(); \ No newline at end of file diff --git a/scripts/github.mjs b/scripts/github.mjs new file mode 100644 index 0000000..5383f11 --- /dev/null +++ b/scripts/github.mjs @@ -0,0 +1,85 @@ +import gitclone from 'git-clone/promise.js'; +import { rimraf } from 'rimraf'; +import ora from 'ora'; +import yaml from 'js-yaml'; +import fse from 'fs-extra'; + +export function getGithubInfo() { + const info = {}; + try { + const content = yaml.load( + fse.readFileSync('.github/actions/clone-crates/action.yml', + 'utf-8', + )); + ['repo', 'dest', 'temp', 'ref'].forEach((key) => { + info[key] = content.inputs[key].default; + }); + } catch (e) { + console.log(e); + } + return info; +} + +export async function copyAndCleanUp(temp, dest, spinner) { + // Step3: only copy crates dir to the dest. + if (spinner) { + spinner.text = 'Copying crates to the dest...'; + } + fse.copySync(temp + '/crates', dest); + const pkg = JSON.parse(fse.readFileSync(temp + '/package.json', 'utf-8')); + console.log('version: ', pkg.version); + // Step4: remove useless files. + if (spinner) { + spinner.text = 'Clean up...'; + } + await rimraf(temp); + if (process.env.IS_GITHUB) { + await Promise.all(['node_binding', 'bench'].map(async (dir) => { + // Remove useless crates in github action to reduce the check time. + await rimraf(dest + '/' + dir); + })); + } + if (spinner) { + spinner.succeed('Cloning rspack repo succeed.'); + } +} + +export function createSpinner( + text, + options = {}, +) { + const spinner = ora({ + text, + stream: process.stdout, + isEnabled: process.stdout.isTTY, + interval: 200, + ...options, + }); + spinner.start(); + return spinner; +} + +export async function getRspackCrates() { + const { + repo, + dest, + temp, + ref, + } = getGithubInfo(); + let cloneError = null; + const spinner = createSpinner('Cloning rspack repo...'); + // Step 1: remove dir. + await rimraf(dest); + // Step2: clone git repo. + await gitclone(`git@github.com:${repo}.git`, temp, { checkout: ref }).catch((err) => {cloneError = err;}); + if (!cloneError) { + copyAndCleanUp(temp, dest, spinner); + } else { + spinner.fail('Cloning rspack repo failed.'); + // Clean temp dir if clone failed. + await rimraf(temp); + console.log(cloneError); + } +} + +export default getGithubInfo(); \ No newline at end of file diff --git a/scripts/test.mjs b/scripts/test.mjs new file mode 100644 index 0000000..62c412e --- /dev/null +++ b/scripts/test.mjs @@ -0,0 +1,18 @@ +import { spawnSync } from 'child_process'; +import fse from 'fs-extra'; + +const cratesDir = 'crates'; +const crates = fse.readdirSync(cratesDir); + +const packageScripts = []; +crates.forEach((crate) => { + // Ingore crates which is temporary and use for binding. + if (!crate.startsWith('.')) { + packageScripts.push('--package', crate); + } +}); + +spawnSync('cargo', ['test', ...packageScripts], { + cwd: process.cwd(), + stdio: 'inherit', +}); \ No newline at end of file From 45583987530e76b91c651a97659622d1a3189f2e Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Tue, 21 Nov 2023 14:23:19 +0800 Subject: [PATCH 12/18] feat: custom split chunk rules (#11) * fix: add cargo lock * feat: custom split chunks rule * feat: support split chunk strategy of chunks --- Cargo.lock | 163 +++++++------- crates/binding_options/Cargo.toml | 4 +- crates/binding_options/src/options/mod.rs | 19 +- .../src/options/raw_features.rs | 199 ++++++++++++++++++ 4 files changed, 306 insertions(+), 79 deletions(-) create mode 100644 crates/binding_options/src/options/raw_features.rs diff --git a/Cargo.lock b/Cargo.lock index 45049d5..cfb8e97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -116,7 +116,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -143,7 +143,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -154,7 +154,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -177,7 +177,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -278,6 +278,7 @@ dependencies = [ "async-trait", "better_scoped_tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "derivative", + "futures-util", "glob", "loader_compilation", "napi", @@ -287,6 +288,7 @@ dependencies = [ "rspack_binding_options", "rspack_core", "rspack_error", + "rspack_hash", "rspack_identifier", "rspack_ids", "rspack_loader_react_refresh", @@ -670,7 +672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" dependencies = [ "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -828,9 +830,9 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "dyn-clone" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" [[package]] name = "either" @@ -861,7 +863,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -872,9 +874,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -909,7 +911,7 @@ dependencies = [ "pmutil", "proc-macro2", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -974,7 +976,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1028,9 +1030,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "js-sys", @@ -1221,9 +1223,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown 0.14.2", @@ -1276,7 +1278,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1313,9 +1315,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -1416,9 +1418,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" @@ -1447,9 +1449,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "loader_compilation" @@ -1851,7 +1853,7 @@ checksum = "9657cba6ac0894a8acf3aca5b9a4b7668ce8486042588cf2bf0f34eb5f37ebc6" dependencies = [ "dashmap", "dunce", - "indexmap 2.0.2", + "indexmap 2.1.0", "once_cell", "rustc-hash", "serde", @@ -1982,7 +1984,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2003,7 +2005,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_derive", ] @@ -2069,7 +2071,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2123,6 +2125,17 @@ dependencies = [ "tracing", ] +[[package]] +name = "plugin_specilize_module_name" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", + "rspack_error", + "rspack_testing", + "tracing", +] + [[package]] name = "pmutil" version = "0.6.1" @@ -2131,7 +2144,7 @@ checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3469,9 +3482,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] @@ -3499,13 +3512,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3521,11 +3534,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "itoa", "ryu", "serde", @@ -3689,7 +3702,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3700,9 +3713,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "str_indices" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8eeaedde8e50d8a331578c9fa9a288df146ce5e16173ad26ce82f6e263e2be4" +checksum = "e9557cb6521e8d009c51a8666f09356f4b817ba9ba0981a305bd86aee47bd35c" [[package]] name = "string_cache" @@ -3739,7 +3752,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3916,7 +3929,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3990,7 +4003,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4134,7 +4147,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4280,7 +4293,7 @@ dependencies = [ "swc_ecma_ast", "swc_ecma_parser", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4371,7 +4384,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4554,7 +4567,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4626,7 +4639,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4700,7 +4713,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4738,7 +4751,7 @@ source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d640270 dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4760,7 +4773,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4776,9 +4789,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -4824,7 +4837,7 @@ dependencies = [ "quote", "regex", "relative-path", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4864,7 +4877,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4972,7 +4985,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4994,7 +5007,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -5223,9 +5236,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -5233,24 +5246,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5258,22 +5271,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasmparser" @@ -5287,9 +5300,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -5508,20 +5521,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.20" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd66a62464e3ffd4e37bd09950c2b9dd6c4f8767380fabba0d523f9a775bc85a" +checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.20" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "255c4596d41e6916ced49cfafea18727b24d67878fa180ddfd69b9df34fd1726" +checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] diff --git a/crates/binding_options/Cargo.toml b/crates/binding_options/Cargo.toml index 6f13b5a..2a21109 100644 --- a/crates/binding_options/Cargo.toml +++ b/crates/binding_options/Cargo.toml @@ -41,10 +41,12 @@ rspack_plugin_swc_js_minimizer = { path = "../.rspack_crates/rspack_plu rspack_plugin_wasm = { path = "../.rspack_crates/rspack_plugin_wasm" } rspack_plugin_worker = { path = "../.rspack_crates/rspack_plugin_worker" } rspack_regex = { path = "../.rspack_crates/rspack_regex" } +rspack_hash = { path = "../.rspack_crates/rspack_hash" } rspack_swc_visitors = { path = "../.rspack_crates/rspack_swc_visitors" } loader_compilation = { path = "../loader_compilation" } -plugin_manifest = { path = "../plugin_manifest" } +plugin_manifest = { path = "../plugin_manifest" } +futures-util = { workspace = true } anyhow = { workspace = true, features = ["backtrace"] } async-trait = { workspace = true } better_scoped_tls = { workspace = true } diff --git a/crates/binding_options/src/options/mod.rs b/crates/binding_options/src/options/mod.rs index 786396a..b5db707 100644 --- a/crates/binding_options/src/options/mod.rs +++ b/crates/binding_options/src/options/mod.rs @@ -13,9 +13,11 @@ use rspack_plugin_javascript::{FlagDependencyExportsPlugin, FlagDependencyUsageP use serde::Deserialize; mod raw_module; +mod raw_features; mod js_loader; pub use raw_module::*; +pub use raw_features::*; pub use js_loader::*; scoped_tls!(pub(crate) static IS_ENABLE_NEW_SPLIT_CHUNKS: bool); @@ -45,6 +47,7 @@ pub struct RSPackRawOptions { pub node: Option, pub profile: bool, pub builtins: RawBuiltins, + pub features: RawFeatures, } impl RawOptionsApply for RSPackRawOptions { @@ -74,9 +77,19 @@ impl RawOptionsApply for RSPackRawOptions { new_split_chunks: self.experiments.new_split_chunks, rspack_future: self.experiments.rspack_future.into(), }; - let optimization = IS_ENABLE_NEW_SPLIT_CHUNKS.set(&experiments.new_split_chunks, || { - self.optimization.apply(plugins) - })?; + let optimization; + if self.features.split_chunks_strategy.is_some() { + let split_chunk_strategy = SplitChunksStrategy::new( + self.features.split_chunks_strategy.unwrap(), + self.optimization, + ); + optimization = split_chunk_strategy.apply(plugins, context.to_string())?; + } else { + optimization = IS_ENABLE_NEW_SPLIT_CHUNKS.set(&experiments.new_split_chunks, || { + self.optimization.apply(plugins) + })?; + } + let stats = self.stats.into(); let snapshot = self.snapshot.into(); let node = self.node.map(|n| n.into()); diff --git a/crates/binding_options/src/options/raw_features.rs b/crates/binding_options/src/options/raw_features.rs new file mode 100644 index 0000000..ceec742 --- /dev/null +++ b/crates/binding_options/src/options/raw_features.rs @@ -0,0 +1,199 @@ +use std::{sync::Arc, hash::Hasher}; +use futures_util::{FutureExt, future}; +use napi_derive::napi; +use serde::Deserialize; +use rspack_core::{ + Optimization, PluginExt, SideEffectOption, UsedExportsOption, SourceType, + BoxPlugin, Module, ModuleType, +}; +use rspack_error::internal_error; +use rspack_ids::{ + DeterministicChunkIdsPlugin, DeterministicModuleIdsPlugin, NamedChunkIdsPlugin, + NamedModuleIdsPlugin, +}; +use rspack_binding_options::RawOptimizationOptions; +use rspack_plugin_split_chunks_new::{PluginOptions, CacheGroup}; +use rspack_regex::RspackRegex; +use rspack_hash::{RspackHash, HashFunction, HashDigest}; + +pub struct SplitChunksStrategy { + strategy: RawStrategyOptions, + // Get the neccessary options from RawOptimizationOptions. + chunk_ids: String, + module_ids: String, + side_effects: String, + used_exports: String, + provided_exports: bool, + real_content_hash: bool, + remove_empty_chunks: bool, + remove_available_modules: bool, +} + +fn get_modules_size(module: &dyn Module) -> f64 { + let mut size = 0f64; + for source_type in module.source_types() { + size += module.size(source_type); + } + size +} + +fn get_plugin_options(strategy: RawStrategyOptions, context: String) -> rspack_plugin_split_chunks_new::PluginOptions { + use rspack_plugin_split_chunks_new::SplitChunkSizes; + let default_size_types = [SourceType::JavaScript, SourceType::Unknown]; + let create_sizes = |size: Option| { + size + .map(|size| SplitChunkSizes::with_initial_value(&default_size_types, size)) + .unwrap_or_else(SplitChunkSizes::default) + }; + + let re_node_modules = RspackRegex::new("node_modules").unwrap(); + + let cache_groups = vec![ + CacheGroup { + key: String::from("framework"), + name: rspack_plugin_split_chunks_new::create_chunk_name_getter_by_const_name("framework".to_string()), + chunk_filter: rspack_plugin_split_chunks_new::create_all_chunk_filter(), + priority: 40.0, + test: Arc::new(move |module: &dyn Module| -> bool { + module + .name_for_condition() + .map_or(false, |name| { + strategy.top_level_frameworks.iter().any(|framework| name.starts_with(framework)) + }) + }), + max_initial_requests: 25, + max_async_requests: 25, + reuse_existing_chunk: true, + min_chunks: 1, + // When enfoce is true, all size should be set to SplitChunkSizes::empty(). + min_size: SplitChunkSizes::empty(), + max_async_size: SplitChunkSizes::empty(), + max_initial_size: SplitChunkSizes::empty(), + id_hint: String::from("framework"), + r#type: rspack_plugin_split_chunks_new::create_default_module_type_filter(), + }, + CacheGroup { + key: String::from("lib"), + name: Arc::new(move |module| { + let mut hash = RspackHash::new(&HashFunction::Xxhash64); + match module.module_type() { + ModuleType::Css | ModuleType::CssModule | ModuleType::CssAuto => { + module.update_hash(&mut hash); + }, + _ => { + let options = rspack_core::LibIdentOptions { context: &context }; + let lib_ident = module.lib_ident(options); + hash.write(lib_ident.unwrap().as_bytes()); + }, + } + future::ready(Some(hash.digest(&HashDigest::Hex).rendered(8).to_string())).boxed() + }), + chunk_filter: rspack_plugin_split_chunks_new::create_all_chunk_filter(), + test: Arc::new(move |module: &dyn Module| -> bool { + module + .name_for_condition() + .map_or(false, |name| re_node_modules.test(&name)) + && get_modules_size(module) > 160000.0 + }), + priority: 30.0, + min_chunks: 1, + reuse_existing_chunk: true, + max_initial_requests: 25, + max_async_requests: 25, + min_size: create_sizes(Some(20000.0)), + max_async_size: SplitChunkSizes::default(), + max_initial_size: SplitChunkSizes::default(), + id_hint: String::from("lib"), + r#type: rspack_plugin_split_chunks_new::create_default_module_type_filter(), + }, + ]; + + PluginOptions { + cache_groups, + fallback_cache_group: rspack_plugin_split_chunks_new::FallbackCacheGroup { + chunks_filter: rspack_plugin_split_chunks_new::create_all_chunk_filter(), + min_size: SplitChunkSizes::default(), + max_async_size: SplitChunkSizes::default(), + max_initial_size: SplitChunkSizes::default(), + }, + } +} + + +pub trait FeatureApply { + type Options; + fn apply(self, plugins: &mut Vec, context: String) -> Result; +} + +impl SplitChunksStrategy { + pub fn new(strategy: RawStrategyOptions, option: RawOptimizationOptions) -> Self { + Self { + strategy, + chunk_ids: option.chunk_ids, + module_ids: option.module_ids, + remove_available_modules: option.remove_available_modules, + remove_empty_chunks: option.remove_empty_chunks, + side_effects: option.side_effects, + used_exports: option.used_exports, + provided_exports: option.provided_exports, + real_content_hash: option.real_content_hash, + } + } +} + +impl FeatureApply for SplitChunksStrategy { + type Options = Optimization; + + fn apply(self, plugins: &mut Vec>, context: String) -> Result { + let split_chunks_plugin = rspack_plugin_split_chunks_new::SplitChunksPlugin::new( + get_plugin_options(self.strategy, context), + ).boxed(); + plugins.push(split_chunks_plugin); + + let chunk_ids_plugin = match self.chunk_ids.as_ref() { + "named" => NamedChunkIdsPlugin::new(None, None).boxed(), + "deterministic" => DeterministicChunkIdsPlugin::default().boxed(), + _ => { + return Err(internal_error!( + "'chunk_ids' should be 'named' or 'deterministic'." + )) + } + }; + plugins.push(chunk_ids_plugin); + let module_ids_plugin = match self.module_ids.as_ref() { + "named" => NamedModuleIdsPlugin::default().boxed(), + "deterministic" => DeterministicModuleIdsPlugin::default().boxed(), + _ => { + return Err(internal_error!( + "'module_ids' should be 'named' or 'deterministic'." + )) + } + }; + plugins.push(module_ids_plugin); + if self.real_content_hash { + plugins.push(rspack_plugin_real_content_hash::RealContentHashPlugin.boxed()); + } + Ok(Self::Options { + remove_available_modules: self.remove_available_modules, + remove_empty_chunks: self.remove_empty_chunks, + side_effects: SideEffectOption::from(self.side_effects.as_str()), + provided_exports: self.provided_exports, + used_exports: UsedExportsOption::from(self.used_exports.as_str()), + }) + } +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +#[napi(object)] +pub struct RawStrategyOptions { + pub name: String, + pub top_level_frameworks: Vec, +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +#[napi(object)] +pub struct RawFeatures { + pub split_chunks_strategy: Option, +} From c2c267222cb67da9b4e190efdedcff5f40fddfb4 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 23 Nov 2023 10:13:31 +0800 Subject: [PATCH 13/18] feat: plugin for generate assets manifest (#5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: plugin for generate assets manifest * fix: camel case --------- Co-authored-by: 鲲尘 --- crates/plugin_manifest/Cargo.toml | 3 + crates/plugin_manifest/src/plugin.rs | 87 ++++++++++++++----- crates/plugin_manifest/tests/fixtures.rs | 2 +- .../tests/fixtures/with-assets/a.js | 1 + .../tests/fixtures/with-assets/b.js | 1 + .../tests/fixtures/with-assets/img.png | 0 .../tests/fixtures/with-assets/index.js | 5 ++ .../fixtures/with-assets/snapshot/output.snap | 4 + .../fixtures/with-assets/test.config.json | 13 +++ 9 files changed, 95 insertions(+), 21 deletions(-) create mode 100644 crates/plugin_manifest/tests/fixtures/with-assets/a.js create mode 100644 crates/plugin_manifest/tests/fixtures/with-assets/b.js create mode 100644 crates/plugin_manifest/tests/fixtures/with-assets/img.png create mode 100644 crates/plugin_manifest/tests/fixtures/with-assets/index.js create mode 100644 crates/plugin_manifest/tests/fixtures/with-assets/snapshot/output.snap create mode 100644 crates/plugin_manifest/tests/fixtures/with-assets/test.config.json diff --git a/crates/plugin_manifest/Cargo.toml b/crates/plugin_manifest/Cargo.toml index f9525ff..9ad22a5 100644 --- a/crates/plugin_manifest/Cargo.toml +++ b/crates/plugin_manifest/Cargo.toml @@ -8,6 +8,9 @@ edition = "2021" [dependencies] async-trait = { workspace = true } tracing = { workspace = true } +regex = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } rspack_core = { path = "../.rspack_crates/rspack_core" } rspack_error = { path = "../.rspack_crates/rspack_error" } diff --git a/crates/plugin_manifest/src/plugin.rs b/crates/plugin_manifest/src/plugin.rs index e89bfac..8bbde27 100644 --- a/crates/plugin_manifest/src/plugin.rs +++ b/crates/plugin_manifest/src/plugin.rs @@ -1,6 +1,9 @@ +use std::collections::HashMap; +use serde::{Serialize, Deserialize}; + use rspack_core::{ Plugin,PluginContext, PluginProcessAssetsOutput,ProcessAssetsArgs, - CompilationAsset, + CompilationAsset, PublicPath, rspack_sources::{RawSource, SourceExt}, }; // use rspack_error::Result; @@ -8,16 +11,23 @@ use rspack_core::{ #[derive(Debug)] pub struct ManifestPlugin; + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AssetsManifest { + pub pages: HashMap>, + pub entries: HashMap>, + pub public_path: String, +} + +const AUTO_PUBLIC_PATH_PLACEHOLDER: &str = "__RSPACK_PLUGIN_CSS_AUTO_PUBLIC_PATH__"; + impl ManifestPlugin { pub fn new() -> Self { Self {} } } -fn default_cotent() -> &'static str { - r#"{"assets": []}"# -} - #[async_trait::async_trait] impl Plugin for ManifestPlugin { fn name(&self) -> &'static str { @@ -30,29 +40,66 @@ impl Plugin for ManifestPlugin { args: ProcessAssetsArgs<'_>, )-> PluginProcessAssetsOutput { let compilation = args.compilation; + let public_path = match &compilation.options.output.public_path { + PublicPath::String(p) => p, + PublicPath::Auto => AUTO_PUBLIC_PATH_PLACEHOLDER, + }; + let mut assets_mainfest = AssetsManifest { + pages: HashMap::new(), + entries: HashMap::new(), + public_path: public_path.to_string(), + }; let entry_points = &compilation.entrypoints; - println!("entry_points: {:?}", entry_points); - Ok(()) - } - - async fn process_assets_stage_optimize_inline( - &self, - _ctx: PluginContext, - args: ProcessAssetsArgs<'_>, - ) -> PluginProcessAssetsOutput { - let compilation = args.compilation; - + let assets = &compilation.assets(); + + entry_points.iter().for_each(|(name, _entry)| { + let mut files: Vec = Vec::new(); + compilation.entrypoint_by_name(name).chunks.iter().for_each(|chunk| { + + if let Some(chunk) = compilation.chunk_by_ukey.get(chunk) { + chunk.files.iter().for_each(|file| { + if let Some(asset) = assets.get(file) { + if !asset.info.hot_module_replacement && !asset.info.development { + files.push(file.to_string()); + } + } else { + files.push(file.to_string()); + } + }); + }; + }); + assets_mainfest.entries.insert(name.to_string(), files); + }); + let page_chunk_name_regex = regex::Regex::new(r"^p_").unwrap(); + compilation + .chunk_by_ukey + .values() + .for_each(|c| { + if let Some(name) = &c.id { + if !c.has_entry_module(&compilation.chunk_graph) && !c.can_be_initial(&compilation.chunk_group_by_ukey) { + assets_mainfest.pages.insert( + page_chunk_name_regex.replace(name, "").to_string(), + Vec::from_iter( + c.files + .iter() + // Only collect js and css files. + .filter(|f| f.ends_with(".js") || f.ends_with(".css")) + .cloned() + ), + ); + } + } + }); + let json_string = serde_json::to_string(&assets_mainfest).unwrap(); let output_path = compilation .options .output .path - .join("manifest.json".to_string()).to_string_lossy().to_string(); - println!("output_path: {}", output_path); + .join("assets-manifest.json".to_string()).to_string_lossy().to_string(); compilation.emit_asset( output_path, - CompilationAsset::from(RawSource::from(default_cotent().to_owned()).boxed()), + CompilationAsset::from(RawSource::from(json_string).boxed()), ); - Ok(()) } } diff --git a/crates/plugin_manifest/tests/fixtures.rs b/crates/plugin_manifest/tests/fixtures.rs index d28f36b..c415eb3 100644 --- a/crates/plugin_manifest/tests/fixtures.rs +++ b/crates/plugin_manifest/tests/fixtures.rs @@ -3,7 +3,7 @@ use rspack_core::PluginExt; use rspack_testing::{fixture,test_fixture_insta}; use plugin_manifest::ManifestPlugin; -#[fixture("tests/fixtures/*")] +#[fixture("tests/fixtures/with-assets")] fn manifest(fixture_path: PathBuf) { test_fixture_insta( &fixture_path, diff --git a/crates/plugin_manifest/tests/fixtures/with-assets/a.js b/crates/plugin_manifest/tests/fixtures/with-assets/a.js new file mode 100644 index 0000000..0d4c247 --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/with-assets/a.js @@ -0,0 +1 @@ +console.log('a.js'); \ No newline at end of file diff --git a/crates/plugin_manifest/tests/fixtures/with-assets/b.js b/crates/plugin_manifest/tests/fixtures/with-assets/b.js new file mode 100644 index 0000000..50715a5 --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/with-assets/b.js @@ -0,0 +1 @@ +console.log('b.js'); \ No newline at end of file diff --git a/crates/plugin_manifest/tests/fixtures/with-assets/img.png b/crates/plugin_manifest/tests/fixtures/with-assets/img.png new file mode 100644 index 0000000..e69de29 diff --git a/crates/plugin_manifest/tests/fixtures/with-assets/index.js b/crates/plugin_manifest/tests/fixtures/with-assets/index.js new file mode 100644 index 0000000..336f6d0 --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/with-assets/index.js @@ -0,0 +1,5 @@ +import url from './img.png'; + +import('./a.js'); +import('./b.js'); +console.log('url', url); diff --git a/crates/plugin_manifest/tests/fixtures/with-assets/snapshot/output.snap b/crates/plugin_manifest/tests/fixtures/with-assets/snapshot/output.snap new file mode 100644 index 0000000..775c9ee --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/with-assets/snapshot/output.snap @@ -0,0 +1,4 @@ +--- +source: crates/.rspack_crates/rspack_testing/src/run_fixture.rs +--- + diff --git a/crates/plugin_manifest/tests/fixtures/with-assets/test.config.json b/crates/plugin_manifest/tests/fixtures/with-assets/test.config.json new file mode 100644 index 0000000..50bee5b --- /dev/null +++ b/crates/plugin_manifest/tests/fixtures/with-assets/test.config.json @@ -0,0 +1,13 @@ +{ + "module": { + "rules": [ + { + "test": { + "type": "regexp", + "matcher": "\\.png$" + }, + "type": "asset/resource" + } + ] + } +} \ No newline at end of file From 8a3631bc0b4a737529d7d14c1b2bd4c761e8e6ca Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 23 Nov 2023 15:06:04 +0800 Subject: [PATCH 14/18] feat: support loader options (#8) * feat: support swc options * feat: support transform rule of remove export and keep export * fix: optimize code * chore: remove comments --- .../binding_options/src/options/raw_module.rs | 6 +- crates/loader_compilation/Cargo.toml | 4 +- crates/loader_compilation/src/compiler.rs | 12 -- crates/loader_compilation/src/lib.rs | 116 ++++++++++++++---- crates/loader_compilation/src/options.rs | 0 .../loader_compilation/src/transform/mod.rs | 91 ++++++++++++-- crates/loader_compilation/tests/fixtures.rs | 11 +- .../fixtures/basic/.ice/route-manifest.json | 22 ++++ 8 files changed, 210 insertions(+), 52 deletions(-) delete mode 100644 crates/loader_compilation/src/options.rs create mode 100644 crates/loader_compilation/tests/fixtures/basic/.ice/route-manifest.json diff --git a/crates/binding_options/src/options/raw_module.rs b/crates/binding_options/src/options/raw_module.rs index 9b909d5..2b550d5 100644 --- a/crates/binding_options/src/options/raw_module.rs +++ b/crates/binding_options/src/options/raw_module.rs @@ -27,7 +27,11 @@ pub fn get_builtin_loader(builtin: &str, options: Option<&str>) -> BoxLoader { if builtin.starts_with(COMPILATION_LOADER_IDENTIFIER) { return Arc::new( - loader_compilation::CompilationLoader::new().with_identifier(builtin.into()), + loader_compilation::CompilationLoader::new( + serde_json::from_str(options.unwrap_or("{}")).unwrap_or_else(|e| { + panic!("Could not parse builtin:compilation-loader options:{options:?},error: {e:?}") + }), + ).with_identifier(builtin.into()), ); } diff --git a/crates/loader_compilation/Cargo.toml b/crates/loader_compilation/Cargo.toml index 4e519ce..c252936 100644 --- a/crates/loader_compilation/Cargo.toml +++ b/crates/loader_compilation/Cargo.toml @@ -10,13 +10,15 @@ anyhow = { workspace = true } async-trait = { workspace = true } dashmap = { workspace = true } either = "1" -fxhash= "0.2.1" +fxhash = "0.2.1" +lazy_static = "1.4.0" once_cell = { workspace = true } rspack_ast = { path = "../.rspack_crates/rspack_ast" } rspack_core = { path = "../.rspack_crates/rspack_core" } rspack_error = { path = "../.rspack_crates/rspack_error" } rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" } rspack_plugin_javascript = { path = "../.rspack_crates/rspack_plugin_javascript" } +regex = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = "1.0.100" swc_config = { workspace = true } diff --git a/crates/loader_compilation/src/compiler.rs b/crates/loader_compilation/src/compiler.rs index f8a91a3..040d40a 100644 --- a/crates/loader_compilation/src/compiler.rs +++ b/crates/loader_compilation/src/compiler.rs @@ -203,18 +203,6 @@ impl SwcCompiler { program } - - pub fn comments(&self) -> &SingleThreadedComments { - &self.comments - } - - pub fn options(&self) -> &Options { - &self.options - } - - pub fn cm(&self) -> &Arc { - &self.cm - } } pub(crate) trait IntoJsAst { diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index fde47b2..29729c9 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -1,10 +1,12 @@ +use std::{path::Path, collections::HashMap, sync::Mutex}; +use lazy_static::lazy_static; use rspack_ast::RspackAst; -use rspack_core::{rspack_sources::SourceMap, LoaderRunnerContext}; +use rspack_core::{rspack_sources::SourceMap, LoaderRunnerContext, Mode}; use rspack_loader_runner::{Identifiable, Identifier, Loader, LoaderContext}; use rspack_error::{ - internal_error, Result, + internal_error, Result, Diagnostic, }; -use swc_core::base::config::{InputSourceMap, Options, OutputCharset}; +use swc_core::{base::config::{InputSourceMap, Options, OutputCharset, Config, TransformConfig}, ecma::transforms::react::Runtime}; use rspack_plugin_javascript::{ ast::{self, SourceMapConfig}, TransformOutput, @@ -14,14 +16,41 @@ mod transform; use transform::*; use compiler::{SwcCompiler, IntoJsAst}; + +pub struct LoaderOptions { + pub swc_options: Config, + pub transform_features: TransformFeatureOptions, +} + +pub struct CompilationOptions { + swc_options: Options, + transform_features: TransformFeatureOptions, +} pub struct CompilationLoader { identifier: Identifier, + loader_options: CompilationOptions, +} + +pub const COMPILATION_LOADER_IDENTIFIER: &str = "builtin:compilation-loader"; + +impl From for CompilationOptions { + fn from(value: LoaderOptions) -> Self { + let transform_features = TransformFeatureOptions::default(); + CompilationOptions { + swc_options: Options { + config: value.swc_options, + ..Default::default() + }, + transform_features, + } + } } impl CompilationLoader { - pub fn new() -> Self { + pub fn new(options: LoaderOptions) -> Self { Self { identifier: COMPILATION_LOADER_IDENTIFIER.into(), + loader_options: options.into(), } } @@ -32,6 +61,11 @@ impl CompilationLoader { } } +lazy_static! { + static ref GLOBAL_FILE_ACCESS: Mutex> = Mutex::new(HashMap::new()); + static ref GLOBAL_ROUTES_CONFIG: Mutex>> = Mutex::new(None); +} + #[async_trait::async_trait] impl Loader for CompilationLoader { async fn run(&self, loader_context: &mut LoaderContext<'_, LoaderRunnerContext>) -> Result<()> { @@ -39,31 +73,69 @@ impl Loader for CompilationLoader { let Some(content) = std::mem::take(&mut loader_context.content) else { return Err(internal_error!("No content found")); }; - // TODO: init loader with custom options. - let mut swc_options = Options::default(); - // TODO: merge config with built-in config. + let swc_options = { + let mut swc_options = self.loader_options.swc_options.clone(); + if swc_options.config.jsc.transform.as_ref().is_some() { + let mut transform = TransformConfig::default(); + let default_development = matches!(loader_context.context.options.mode, Mode::Development); + transform.react.development = Some(default_development); + transform.react.runtime = Some(Runtime::Automatic); + } - if let Some(pre_source_map) = std::mem::take(&mut loader_context.source_map) { - if let Ok(source_map) = pre_source_map.to_json() { - swc_options.config.input_source_map = Some(InputSourceMap:: Str(source_map)) + if let Some(pre_source_map) = std::mem::take(&mut loader_context.source_map) { + if let Ok(source_map) = pre_source_map.to_json() { + swc_options.config.input_source_map = Some(InputSourceMap:: Str(source_map)) + } + } + + if swc_options.config.jsc.experimental.plugins.is_some() { + loader_context.emit_diagnostic(Diagnostic::warn( + COMPILATION_LOADER_IDENTIFIER.to_string(), + "Experimental plugins are not currently supported.".to_string(), + 0, + 0, + )); } - } + if swc_options.config.jsc.target.is_some() && swc_options.config.env.is_some() { + loader_context.emit_diagnostic(Diagnostic::warn( + COMPILATION_LOADER_IDENTIFIER.to_string(), + "`env` and `jsc.target` cannot be used together".to_string(), + 0, + 0, + )); + } + swc_options + }; let devtool = &loader_context.context.options.devtool; let source = content.try_into_string()?; let compiler = SwcCompiler::new(resource_path.clone(), source.clone(), swc_options)?; - let transform_options = SwcPluginOptions { - keep_export: Some(KeepExportOptions { - export_names: vec!["default".to_string()], - }), - remove_export: Some(RemoveExportOptions { - remove_names: vec!["default".to_string()], - }), - }; + let transform_options = &self.loader_options.transform_features; + let compiler_context:&str = loader_context.context.options.context.as_ref(); + let mut file_access = GLOBAL_FILE_ACCESS.lock().unwrap(); + let mut routes_config = GLOBAL_ROUTES_CONFIG.lock().unwrap(); + let file_accessed = file_access.contains_key(&resource_path.to_string_lossy().to_string()); + + if routes_config.is_none() || file_accessed { + // Load routes config for transform. + let routes_config_path: std::path::PathBuf = Path::new(compiler_context).join(".ice/route-manifest.json"); + *routes_config = Some(load_routes_config(&routes_config_path).unwrap()); + + if file_accessed { + // If file accessed, then we need to clear the map for the current compilation. + file_access.clear(); + } + } + file_access.insert(resource_path.to_string_lossy().to_string(), true); + let built = compiler.parse(None, |_| { - transform(transform_options) + transform( + &resource_path, + routes_config.as_ref().unwrap(), + transform_options + ) })?; let codegen_options = ast::CodegenOptions { @@ -87,7 +159,7 @@ impl Loader for CompilationLoader { // If swc-loader is the latest loader available, // then loader produces AST, which could be used as an optimization. - if loader_context.loader_index() == 0 + if loader_context.loader_index() == 1 && (loader_context .current_loader() .composed_index_by_identifier(&self.identifier) @@ -109,8 +181,6 @@ impl Loader for CompilationLoader { } } -pub const COMPILATION_LOADER_IDENTIFIER: &str = "builtin:compilation-loader"; - impl Identifiable for CompilationLoader { fn identifier(&self) -> Identifier { self.identifier diff --git a/crates/loader_compilation/src/options.rs b/crates/loader_compilation/src/options.rs deleted file mode 100644 index e69de29..0000000 diff --git a/crates/loader_compilation/src/transform/mod.rs b/crates/loader_compilation/src/transform/mod.rs index 9e08e7e..589a9d4 100644 --- a/crates/loader_compilation/src/transform/mod.rs +++ b/crates/loader_compilation/src/transform/mod.rs @@ -1,9 +1,10 @@ +use std::path::Path; +use anyhow::{Error, Context}; use either::Either; +use serde::Deserialize; use swc_core::common::chain; use swc_core::ecma::{ - transforms::base::pass::noop, - visit::{as_folder, Fold, VisitMut, Visit}, - ast::Module, + transforms::base::pass::noop, visit::Fold, }; mod keep_export; @@ -14,14 +15,14 @@ use remove_export::remove_export; macro_rules! either { ($config:expr, $f:expr) => { - if let Some(config) = $config { + if let Some(config) = &$config { Either::Left($f(config)) } else { Either::Right(noop()) } }; ($config:expr, $f:expr, $enabled:expr) => { - if $enabled { + if $enabled() { either!($config, $f) } else { Either::Right(noop()) @@ -29,26 +30,94 @@ macro_rules! either { }; } +// Only define the stuct which is used in the following function. +#[derive(Deserialize, Debug)] +struct NestedRoutesManifest { + file: String, + children: Option>, +} + +fn get_routes_file(routes: Vec) -> Vec { + let mut result: Vec = vec![]; + for route in routes { + // Add default prefix of src/pages/ to the route file. + let mut path_str = String::from("src/pages/"); + path_str.push_str(&route.file); + + result.push(path_str.to_string()); + + if let Some(children) = route.children { + result.append(&mut get_routes_file(children)); + } + } + result +} + +fn parse_routes_config(c: String) -> Result, Error> { + let routes = serde_json::from_str(&c)?; + Ok(get_routes_file(routes)) +} + +pub(crate) fn load_routes_config(path: &Path) -> Result, Error> { + let content = std::fs::read_to_string(path).context("failed to read routes config")?; + parse_routes_config(content) +} + +fn match_route_entry(resource_path: &Path, routes: &Vec) -> bool { + let resource_path_str = resource_path.to_str().unwrap(); + for route in routes { + if resource_path_str.ends_with(&route.to_string()) { + return true; + } + } + false +} + +fn match_app_entry(resource_path: &Path) -> bool { + let resource_path_str = resource_path.to_str().unwrap(); + // File path ends with src/app.(ts|tsx|js|jsx) + let regex_for_app = regex::Regex::new(r"src/app\.(ts|tsx|js|jsx)$").unwrap(); + regex_for_app.is_match(resource_path_str) +} + +#[derive(Default, Debug, Clone)] pub struct KeepExportOptions { pub export_names: Vec, } +#[derive(Default, Debug, Clone)] pub struct RemoveExportOptions { pub remove_names: Vec, } -pub struct SwcPluginOptions { +#[derive(Default, Debug)] +pub struct TransformFeatureOptions { pub keep_export: Option, pub remove_export: Option, } -pub(crate) fn transform<'a>(plugin_options: SwcPluginOptions) -> impl Fold + 'a { +pub(crate) fn transform<'a>( + resource_path: &'a Path, + routes_config: &Vec, + feature_options: &TransformFeatureOptions, +) -> impl Fold + 'a { chain!( - either!(plugin_options.keep_export, |options: KeepExportOptions| { - keep_export(options.export_names) + either!(feature_options.keep_export, |options: &KeepExportOptions| { + let mut exports_name = options.export_names.clone(); + // Special case for app entry. + // When keep pageConfig, we should also keep the default export of app entry. + if match_app_entry(resource_path) && exports_name.contains(&String::from("pageConfig")) { + exports_name.push(String::from("default")); + } + keep_export(exports_name) + }, || { + match_app_entry(resource_path) || match_route_entry(resource_path, routes_config) }), - either!(plugin_options.remove_export, |options: RemoveExportOptions| { - remove_export(options.remove_names) + either!(feature_options.remove_export, |options: &RemoveExportOptions| { + remove_export(options.remove_names.clone()) + }, || { + // Remove export only work for app entry and route entry. + match_app_entry(resource_path) || match_route_entry(resource_path, routes_config) }), ) } \ No newline at end of file diff --git a/crates/loader_compilation/tests/fixtures.rs b/crates/loader_compilation/tests/fixtures.rs index 3b78fdb..2a4597a 100644 --- a/crates/loader_compilation/tests/fixtures.rs +++ b/crates/loader_compilation/tests/fixtures.rs @@ -1,24 +1,27 @@ use std::{str::FromStr,env, fs,path::{Path, PathBuf}, sync::Arc}; -use loader_compilation::CompilationLoader; +use loader_compilation::{CompilationLoader, LoaderOptions}; use rspack_core::{ run_loaders, CompilerContext, CompilerOptions, Loader, LoaderRunnerContext, ResourceData, SideEffectOption, }; -use serde_json::json; use swc_core::base::config::{PluginConfig, Config}; async fn loader_test(actual: impl AsRef, expected: impl AsRef) { let tests_path = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"))).join("tests"); let expected_path = tests_path.join(expected); let actual_path = tests_path.join(actual); + let parent_path = actual_path.parent().unwrap().to_path_buf(); let mut options = Config::default(); let (result, _) = run_loaders( - &[Arc::new(CompilationLoader::new()) as Arc>], + &[Arc::new(CompilationLoader::new(LoaderOptions { + swc_options: options, + transform_features: Default::default(), + })) as Arc>], &ResourceData::new(actual_path.to_string_lossy().to_string(), actual_path), &[], CompilerContext { options: std::sync::Arc::new(CompilerOptions { - context: rspack_core::Context::default(), + context: rspack_core::Context::new(parent_path.to_string_lossy().to_string()), dev_server: rspack_core::DevServerOptions::default(), devtool: rspack_core::Devtool::from("source-map".to_string()), mode: rspack_core::Mode::None, diff --git a/crates/loader_compilation/tests/fixtures/basic/.ice/route-manifest.json b/crates/loader_compilation/tests/fixtures/basic/.ice/route-manifest.json new file mode 100644 index 0000000..cfcf422 --- /dev/null +++ b/crates/loader_compilation/tests/fixtures/basic/.ice/route-manifest.json @@ -0,0 +1,22 @@ +[ + { + "path": "error", + "id": "error", + "file": "error.tsx", + "componentName": "error", + "layout": false, + "exports": [ + "default" + ] + }, + { + "index": true, + "id": "/", + "file": "index.tsx", + "componentName": "index", + "layout": false, + "exports": [ + "default" + ] + } +] \ No newline at end of file From aa7918db1b440b1f9b9da9bc77d358bd483eb85e Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Fri, 24 Nov 2023 16:34:21 +0800 Subject: [PATCH 15/18] feat: update latest rspack version (#14) * feat: update latest rspack version * chore: update node_binding --- .github/actions/clone-crates/action.yml | 2 +- Cargo.lock | 648 +++++++++++++---- Cargo.toml | 81 ++- crates/binding_options/Cargo.toml | 5 +- .../binding_options/src/options/js_loader.rs | 28 +- crates/binding_options/src/options/mod.rs | 30 +- .../src/options/raw_features.rs | 9 +- .../binding_options/src/options/raw_module.rs | 6 - .../src/options/raw_optimization.rs | 82 +++ crates/node_binding/Cargo.toml | 1 + crates/node_binding/index.d.ts | 679 +++++++++--------- crates/node_binding/index.js | 7 +- crates/node_binding/src/js_values/asset.rs | 106 --- .../node_binding/src/js_values/chunk_group.rs | 27 - .../node_binding/src/js_values/compilation.rs | 434 ----------- crates/node_binding/src/js_values/hooks.rs | 42 -- crates/node_binding/src/js_values/mod.rs | 25 - crates/node_binding/src/js_values/module.rs | 37 - .../src/js_values/normal_module_factory.rs | 105 --- .../node_binding/src/js_values/path_data.rs | 42 -- crates/node_binding/src/js_values/source.rs | 198 ----- crates/node_binding/src/js_values/stats.rs | 561 --------------- crates/node_binding/src/lib.rs | 18 +- crates/node_binding/src/loader.rs | 3 +- crates/node_binding/src/plugins/mod.rs | 17 +- crates/node_binding/src/utils.rs | 203 ------ rust-toolchain.toml | 4 +- 27 files changed, 1074 insertions(+), 2326 deletions(-) create mode 100644 crates/binding_options/src/options/raw_optimization.rs delete mode 100644 crates/node_binding/src/js_values/asset.rs delete mode 100644 crates/node_binding/src/js_values/chunk_group.rs delete mode 100644 crates/node_binding/src/js_values/compilation.rs delete mode 100644 crates/node_binding/src/js_values/hooks.rs delete mode 100644 crates/node_binding/src/js_values/mod.rs delete mode 100644 crates/node_binding/src/js_values/module.rs delete mode 100644 crates/node_binding/src/js_values/normal_module_factory.rs delete mode 100644 crates/node_binding/src/js_values/path_data.rs delete mode 100644 crates/node_binding/src/js_values/source.rs delete mode 100644 crates/node_binding/src/js_values/stats.rs delete mode 100644 crates/node_binding/src/utils.rs diff --git a/.github/actions/clone-crates/action.yml b/.github/actions/clone-crates/action.yml index b8e89dc..c9dc12d 100644 --- a/.github/actions/clone-crates/action.yml +++ b/.github/actions/clone-crates/action.yml @@ -12,7 +12,7 @@ inputs: required: false type: string ref: - default: 'v0.3.6' + default: 'v0.4.0' required: false type: string temp: diff --git a/Cargo.lock b/Cargo.lock index cfb8e97..e00f98a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,7 +137,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "ast_node" version = "0.9.5" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -265,7 +265,7 @@ dependencies = [ [[package]] name = "better_scoped_tls" version = "0.1.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "scoped-tls", ] @@ -286,12 +286,12 @@ dependencies = [ "plugin_manifest", "rspack_binding_macros", "rspack_binding_options", + "rspack_binding_values", "rspack_core", "rspack_error", "rspack_hash", "rspack_identifier", "rspack_ids", - "rspack_loader_react_refresh", "rspack_loader_runner", "rspack_loader_sass", "rspack_loader_swc", @@ -310,6 +310,7 @@ dependencies = [ "rspack_plugin_javascript", "rspack_plugin_json", "rspack_plugin_library", + "rspack_plugin_limit_chunk_count", "rspack_plugin_progress", "rspack_plugin_real_content_hash", "rspack_plugin_remove_empty_chunks", @@ -319,7 +320,9 @@ dependencies = [ "rspack_plugin_split_chunks_new", "rspack_plugin_swc_css_minimizer", "rspack_plugin_swc_js_minimizer", + "rspack_plugin_warn_sensitive_module", "rspack_plugin_wasm", + "rspack_plugin_web_worker_template", "rspack_plugin_worker", "rspack_regex", "rspack_swc_visitors", @@ -906,7 +909,7 @@ dependencies = [ [[package]] name = "from_variant" version = "0.1.6" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -1337,6 +1340,15 @@ dependencies = [ "serde_json", ] +[[package]] +name = "jsonc-parser" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "538702ed54bac04d391352d4c9ad0ec2a9225e3c477ffa23fc44d0f04fa83c54" +dependencies = [ + "serde_json", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1698,6 +1710,7 @@ dependencies = [ "once_cell", "rspack_binding_macros", "rspack_binding_options", + "rspack_binding_values", "rspack_core", "rspack_error", "rspack_fs_node", @@ -1720,7 +1733,7 @@ dependencies = [ "dashmap", "dunce", "indexmap 1.9.3", - "jsonc-parser", + "jsonc-parser 0.21.1", "once_cell", "path-absolutize", "rustc-hash", @@ -1847,9 +1860,9 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "oxc_resolver" -version = "0.2.0" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9657cba6ac0894a8acf3aca5b9a4b7668ce8486042588cf2bf0f34eb5f37ebc6" +checksum = "1d10d078b6ba0b8cfa0eb634ef749698aa82ef4a86c7ba1446453644ccf13fd2" dependencies = [ "dashmap", "dunce", @@ -1860,7 +1873,6 @@ dependencies = [ "serde_json", "thiserror", "tracing", - "tracing-subscriber", ] [[package]] @@ -1932,6 +1944,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" +[[package]] +name = "path-clean" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" + [[package]] name = "path-dedot" version = "3.1.1" @@ -2119,9 +2137,12 @@ name = "plugin_manifest" version = "0.1.0" dependencies = [ "async-trait", + "regex", "rspack_core", "rspack_error", "rspack_testing", + "serde", + "serde_json", "tracing", ] @@ -2173,8 +2194,8 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "preset_env_base" -version = "0.4.5" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.4.6" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "ahash 0.8.6", "anyhow", @@ -2515,6 +2536,18 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "rspack_ast" +version = "0.1.0" +dependencies = [ + "anyhow", + "rspack_error", + "swc_core", + "swc_error_reporters", + "swc_node_comments", + "tokio", +] + [[package]] name = "rspack_ast_viewer" version = "0.1.0" @@ -2551,6 +2584,70 @@ dependencies = [ "napi", "napi-derive", "rspack_binding_macros", + "rspack_binding_values", + "rspack_core", + "rspack_error", + "rspack_identifier", + "rspack_ids", + "rspack_loader_react_refresh", + "rspack_loader_runner", + "rspack_loader_sass", + "rspack_loader_swc", + "rspack_napi_shared", + "rspack_plugin_asset", + "rspack_plugin_banner", + "rspack_plugin_copy", + "rspack_plugin_css", + "rspack_plugin_dev_friendly_split_chunks", + "rspack_plugin_devtool", + "rspack_plugin_ensure_chunk_conditions", + "rspack_plugin_entry", + "rspack_plugin_externals", + "rspack_plugin_hmr", + "rspack_plugin_html", + "rspack_plugin_javascript", + "rspack_plugin_json", + "rspack_plugin_library", + "rspack_plugin_limit_chunk_count", + "rspack_plugin_progress", + "rspack_plugin_real_content_hash", + "rspack_plugin_remove_empty_chunks", + "rspack_plugin_runtime", + "rspack_plugin_schemes", + "rspack_plugin_split_chunks", + "rspack_plugin_split_chunks_new", + "rspack_plugin_swc_css_minimizer", + "rspack_plugin_swc_js_minimizer", + "rspack_plugin_warn_sensitive_module", + "rspack_plugin_wasm", + "rspack_plugin_web_worker_template", + "rspack_plugin_worker", + "rspack_regex", + "rspack_swc_visitors", + "rustc-hash", + "serde", + "serde_json", + "swc_config", + "swc_core", + "tokio", + "tracing", +] + +[[package]] +name = "rspack_binding_values" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "better_scoped_tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "dashmap", + "derivative", + "futures", + "glob", + "napi", + "napi-derive", + "napi-sys", + "rspack_binding_macros", "rspack_core", "rspack_error", "rspack_identifier", @@ -2607,6 +2704,7 @@ dependencies = [ "dashmap", "derivative", "dyn-clone", + "either", "futures", "glob-match", "hashlink", @@ -2621,6 +2719,7 @@ dependencies = [ "rayon", "regex", "rkyv", + "rspack_ast", "rspack_database", "rspack_error", "rspack_fs", @@ -2669,9 +2768,11 @@ dependencies = [ "rspack_binding_options", "rspack_core", "rspack_fs", + "rspack_sources", "rspack_testing", "rspack_tracing", "rspack_util", + "serde_json", "sugar_path", "swc_core", "termcolor", @@ -2754,6 +2855,7 @@ dependencies = [ name = "rspack_loader_runner" version = "0.1.0" dependencies = [ + "anymap", "async-recursion", "async-trait", "bitflags 1.3.2", @@ -2794,11 +2896,16 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "dashmap", "either", "indexmap 1.9.3", + "jsonc-parser 0.22.1", + "once_cell", + "rspack_ast", "rspack_core", "rspack_error", "rspack_loader_runner", + "rspack_plugin_javascript", "rspack_swc_visitors", "rspack_testing", "serde", @@ -2835,6 +2942,7 @@ dependencies = [ "once_cell", "rspack_binding_macros", "rspack_binding_options", + "rspack_binding_values", "rspack_core", "rspack_error", "rspack_fs_node", @@ -2895,6 +3003,7 @@ dependencies = [ "rspack_futures", "rspack_hash", "rspack_testing", + "rustc-hash", "sugar_path", "testing_macros", "tokio", @@ -3010,6 +3119,7 @@ dependencies = [ "async-trait", "dojang", "itertools", + "path-clean 1.0.1", "rayon", "regex", "rspack_base64", @@ -3040,6 +3150,7 @@ dependencies = [ "preset_env_base", "rayon", "regex", + "rspack_ast", "rspack_core", "rspack_error", "rspack_hash", @@ -3082,6 +3193,16 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rspack_plugin_limit_chunk_count" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", + "rspack_database", + "rspack_util", +] + [[package]] name = "rspack_plugin_progress" version = "0.1.0" @@ -3122,6 +3243,7 @@ dependencies = [ "anyhow", "async-trait", "itertools", + "once_cell", "rayon", "rspack_core", "rspack_error", @@ -3168,6 +3290,7 @@ dependencies = [ "dashmap", "derivative", "futures-util", + "num-bigint", "rayon", "rspack_core", "rspack_identifier", @@ -3194,6 +3317,7 @@ version = "0.1.0" dependencies = [ "async-recursion", "async-trait", + "once_cell", "rayon", "regex", "rspack_core", @@ -3201,11 +3325,21 @@ dependencies = [ "rspack_plugin_javascript", "rspack_regex", "rspack_util", + "serde_json", "swc_config", "swc_core", "swc_ecma_minifier", ] +[[package]] +name = "rspack_plugin_warn_sensitive_module" +version = "0.1.0" +dependencies = [ + "dashmap", + "rspack_core", + "rspack_error", +] + [[package]] name = "rspack_plugin_wasm" version = "0.1.0" @@ -3224,6 +3358,15 @@ dependencies = [ "wasmparser", ] +[[package]] +name = "rspack_plugin_web_worker_template" +version = "0.1.0" +dependencies = [ + "async-trait", + "rspack_core", + "rspack_plugin_runtime", +] + [[package]] name = "rspack_plugin_worker" version = "0.1.0" @@ -3270,6 +3413,7 @@ dependencies = [ "once_cell", "regex", "serde", + "styled_components", "swc_core", "swc_emotion", "swc_plugin_import", @@ -3304,6 +3448,7 @@ dependencies = [ "rspack_plugin_library", "rspack_plugin_remove_empty_chunks", "rspack_plugin_runtime", + "rspack_plugin_warn_sensitive_module", "rspack_plugin_wasm", "rspack_regex", "rspack_tracing", @@ -3382,9 +3527,9 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "ryu-js" -version = "0.2.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" +checksum = "4950d85bc52415f8432144c97c4791bd0c4f7954de32a7270ee9cccd3c22b12b" [[package]] name = "same-file" @@ -3746,7 +3891,7 @@ dependencies = [ [[package]] name = "string_enum" version = "0.4.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -3761,6 +3906,24 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "styled_components" +version = "0.77.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2efe2ad3cd5fe8868b2fa9d7b2619110313c19c3c304733651cd90d11b6e201a" +dependencies = [ + "Inflector", + "once_cell", + "regex", + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", + "tracing", +] + [[package]] name = "substring" version = "1.4.5" @@ -3809,15 +3972,15 @@ dependencies = [ [[package]] name = "swc" -version = "0.266.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.269.31" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "anyhow", "base64", "dashmap", "either", "indexmap 1.9.3", - "jsonc-parser", + "jsonc-parser 0.21.1", "lru", "once_cell", "parking_lot 0.12.1", @@ -3830,6 +3993,7 @@ dependencies = [ "swc_atoms", "swc_cached", "swc_common", + "swc_compiler_base", "swc_config", "swc_ecma_ast", "swc_ecma_codegen", @@ -3855,8 +4019,8 @@ dependencies = [ [[package]] name = "swc_atoms" -version = "0.5.9" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.6.0" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "once_cell", "rustc-hash", @@ -3868,8 +4032,8 @@ dependencies = [ [[package]] name = "swc_cached" -version = "0.3.17" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.3.18" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "ahash 0.8.6", "anyhow", @@ -3881,13 +4045,13 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.32.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.33.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "ahash 0.8.6", "ast_node", "atty", - "better_scoped_tls 0.1.1 (git+https://github.com/swc-project/swc.git?rev=5c00525)", + "better_scoped_tls 0.1.1 (git+https://github.com/swc-project/swc.git?rev=1095bff)", "cfg-if", "either", "from_variant", @@ -3909,10 +4073,31 @@ dependencies = [ "url", ] +[[package]] +name = "swc_compiler_base" +version = "0.3.30" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "anyhow", + "base64", + "pathdiff", + "serde", + "sourcemap", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_minifier", + "swc_ecma_parser", + "swc_ecma_visit", + "swc_timer", +] + [[package]] name = "swc_config" version = "0.1.7" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "indexmap 1.9.3", "serde", @@ -3923,7 +4108,7 @@ dependencies = [ [[package]] name = "swc_config_macro" version = "0.1.2" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -3934,8 +4119,8 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.83.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.86.33" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "swc", "swc_atoms", @@ -3963,14 +4148,13 @@ dependencies = [ "swc_ecma_transforms_typescript", "swc_ecma_utils", "swc_ecma_visit", - "swc_trace_macro", "vergen", ] [[package]] name = "swc_css_ast" -version = "0.139.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.140.3" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "is-macro", "string_enum", @@ -3980,8 +4164,8 @@ dependencies = [ [[package]] name = "swc_css_codegen" -version = "0.149.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.151.5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "auto_impl", "bitflags 2.4.1", @@ -3997,7 +4181,7 @@ dependencies = [ [[package]] name = "swc_css_codegen_macros" version = "0.2.2" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -4008,8 +4192,8 @@ dependencies = [ [[package]] name = "swc_css_compat" -version = "0.25.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.27.5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "bitflags 2.4.1", "once_cell", @@ -4024,8 +4208,8 @@ dependencies = [ [[package]] name = "swc_css_minifier" -version = "0.114.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.116.5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "serde", "swc_atoms", @@ -4037,8 +4221,8 @@ dependencies = [ [[package]] name = "swc_css_modules" -version = "0.27.2" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.29.5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "rustc-hash", "serde", @@ -4052,8 +4236,8 @@ dependencies = [ [[package]] name = "swc_css_parser" -version = "0.148.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.150.5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "lexical", "serde", @@ -4064,8 +4248,8 @@ dependencies = [ [[package]] name = "swc_css_prefixer" -version = "0.151.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.153.6" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "once_cell", "preset_env_base", @@ -4080,8 +4264,8 @@ dependencies = [ [[package]] name = "swc_css_utils" -version = "0.136.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.137.3" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "once_cell", "serde", @@ -4094,8 +4278,8 @@ dependencies = [ [[package]] name = "swc_css_visit" -version = "0.138.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.139.3" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "serde", "swc_atoms", @@ -4106,8 +4290,8 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.109.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.110.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "bitflags 2.4.1", "is-macro", @@ -4122,8 +4306,8 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.145.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.146.9" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "memchr", "num-bigint", @@ -4141,7 +4325,7 @@ dependencies = [ [[package]] name = "swc_ecma_codegen_macros" version = "0.7.3" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -4150,10 +4334,193 @@ dependencies = [ "syn 2.0.39", ] +[[package]] +name = "swc_ecma_compat_bugfixes" +version = "0.1.17" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_compat_es2015", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_common" +version = "0.1.11" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "swc_common", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", +] + +[[package]] +name = "swc_ecma_compat_es2015" +version = "0.1.17" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "arrayvec", + "indexmap 1.9.3", + "is-macro", + "serde", + "serde_derive", + "smallvec", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_compat_common", + "swc_ecma_transforms_base", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2016" +version = "0.1.15" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2017" +version = "0.1.15" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2018" +version = "0.1.15" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_compat_common", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2019" +version = "0.1.15" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2020" +version = "0.1.15" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_compat_es2022", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2021" +version = "0.1.14" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2022" +version = "0.1.15" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_compat_common", + "swc_ecma_transforms_base", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es3" +version = "0.1.15" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" +dependencies = [ + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", + "tracing", +] + [[package]] name = "swc_ecma_ext_transforms" -version = "0.109.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.110.13" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "phf", "swc_atoms", @@ -4165,8 +4532,8 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.88.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.89.16" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "auto_impl", "dashmap", @@ -4184,8 +4551,8 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.44.3" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.45.3" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "anyhow", "dashmap", @@ -4193,7 +4560,7 @@ dependencies = [ "normpath", "once_cell", "parking_lot 0.12.1", - "path-clean", + "path-clean 0.1.0", "pathdiff", "serde", "serde_json", @@ -4204,8 +4571,8 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.187.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.189.28" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "arrayvec", "indexmap 1.9.3", @@ -4238,8 +4605,8 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.140.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.141.8" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "either", "num-bigint", @@ -4257,8 +4624,8 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.201.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.203.23" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "anyhow", "dashmap", @@ -4281,8 +4648,8 @@ dependencies = [ [[package]] name = "swc_ecma_quote_macros" -version = "0.51.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.52.8" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "anyhow", "pmutil", @@ -4298,8 +4665,8 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.224.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.226.22" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "swc_atoms", "swc_common", @@ -4317,10 +4684,10 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.133.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.134.16" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ - "better_scoped_tls 0.1.1 (git+https://github.com/swc-project/swc.git?rev=5c00525)", + "better_scoped_tls 0.1.1 (git+https://github.com/swc-project/swc.git?rev=1095bff)", "bitflags 2.4.1", "indexmap 1.9.3", "once_cell", @@ -4340,8 +4707,8 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.122.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.123.16" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "swc_atoms", "swc_common", @@ -4353,8 +4720,8 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.159.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.160.21" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "arrayvec", "indexmap 1.9.3", @@ -4366,19 +4733,30 @@ dependencies = [ "swc_common", "swc_config", "swc_ecma_ast", + "swc_ecma_compat_bugfixes", + "swc_ecma_compat_common", + "swc_ecma_compat_es2015", + "swc_ecma_compat_es2016", + "swc_ecma_compat_es2017", + "swc_ecma_compat_es2018", + "swc_ecma_compat_es2019", + "swc_ecma_compat_es2020", + "swc_ecma_compat_es2021", + "swc_ecma_compat_es2022", + "swc_ecma_compat_es3", "swc_ecma_transforms_base", "swc_ecma_transforms_classes", "swc_ecma_transforms_macros", "swc_ecma_utils", "swc_ecma_visit", - "swc_trace_macro", + "swc_trace_macro 0.1.3 (git+https://github.com/swc-project/swc.git?rev=1095bff)", "tracing", ] [[package]] name = "swc_ecma_transforms_macros" version = "0.5.3" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -4389,15 +4767,15 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.176.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.177.23" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "Inflector", "anyhow", "bitflags 2.4.1", "indexmap 1.9.3", "is-macro", - "path-clean", + "path-clean 0.1.0", "pathdiff", "regex", "serde", @@ -4415,8 +4793,8 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.193.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.195.23" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "dashmap", "indexmap 1.9.3", @@ -4439,8 +4817,8 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.167.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.168.24" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "either", "rustc-hash", @@ -4458,8 +4836,8 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.179.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.180.24" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "base64", "dashmap", @@ -4481,9 +4859,10 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.183.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.185.22" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ + "ryu-js", "serde", "swc_atoms", "swc_common", @@ -4496,8 +4875,8 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "0.19.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.20.14" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "indexmap 1.9.3", "rustc-hash", @@ -4512,8 +4891,8 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.123.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.124.13" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "indexmap 1.9.3", "num_cpus", @@ -4530,8 +4909,8 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.95.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.96.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "num-bigint", "swc_atoms", @@ -4543,9 +4922,9 @@ dependencies = [ [[package]] name = "swc_emotion" -version = "0.42.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13abda43ddbc94149aca923fb331f13b90e70f7cc2fb54662ee4a2c51cb59b22" +checksum = "d123bc6ff6aff8724f43542964ee726801fc205137bbf0de7f822a2f8b15f204" dependencies = [ "base64", "byteorder", @@ -4555,14 +4934,20 @@ dependencies = [ "regex", "serde", "sourcemap", - "swc_core", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", ] [[package]] name = "swc_eq_ignore_macros" version = "0.1.2" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -4572,8 +4957,8 @@ dependencies = [ [[package]] name = "swc_error_reporters" -version = "0.16.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.17.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "anyhow", "miette", @@ -4584,8 +4969,8 @@ dependencies = [ [[package]] name = "swc_fast_graph" -version = "0.20.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.21.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "indexmap 1.9.3", "petgraph", @@ -4595,8 +4980,8 @@ dependencies = [ [[package]] name = "swc_html" -version = "0.131.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.134.29" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "swc_html_ast", "swc_html_codegen", @@ -4606,8 +4991,8 @@ dependencies = [ [[package]] name = "swc_html_ast" -version = "0.32.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.33.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "is-macro", "string_enum", @@ -4617,8 +5002,8 @@ dependencies = [ [[package]] name = "swc_html_codegen" -version = "0.41.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.42.4" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "auto_impl", "bitflags 2.4.1", @@ -4633,7 +5018,7 @@ dependencies = [ [[package]] name = "swc_html_codegen_macros" version = "0.2.2" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -4644,8 +5029,8 @@ dependencies = [ [[package]] name = "swc_html_minifier" -version = "0.128.0" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.131.29" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "once_cell", "serde", @@ -4672,8 +5057,8 @@ dependencies = [ [[package]] name = "swc_html_parser" -version = "0.38.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.39.4" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "swc_atoms", "swc_common", @@ -4683,8 +5068,8 @@ dependencies = [ [[package]] name = "swc_html_utils" -version = "0.17.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.18.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "once_cell", "serde", @@ -4695,8 +5080,8 @@ dependencies = [ [[package]] name = "swc_html_visit" -version = "0.32.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.33.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "serde", "swc_atoms", @@ -4708,7 +5093,7 @@ dependencies = [ [[package]] name = "swc_macros_common" version = "0.3.8" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "pmutil", "proc-macro2", @@ -4718,8 +5103,8 @@ dependencies = [ [[package]] name = "swc_node_comments" -version = "0.19.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.20.2" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "dashmap", "swc_atoms", @@ -4738,8 +5123,8 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.20.1" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +version = "0.21.4" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "tracing", ] @@ -4747,7 +5132,18 @@ dependencies = [ [[package]] name = "swc_trace_macro" version = "0.1.3" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "swc_trace_macro" +version = "0.1.3" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "proc-macro2", "quote", @@ -4757,7 +5153,7 @@ dependencies = [ [[package]] name = "swc_visit" version = "0.5.7" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "either", "swc_visit_macros", @@ -4766,7 +5162,7 @@ dependencies = [ [[package]] name = "swc_visit_macros" version = "0.5.8" -source = "git+https://github.com/swc-project/swc.git?rev=5c00525#5c005256d6402705ec5de12603d8e13dccd18ee5" +source = "git+https://github.com/swc-project/swc.git?rev=1095bff#1095bff35a3fe8473e9e5ab32a80461ddcb7fb72" dependencies = [ "Inflector", "pmutil", diff --git a/Cargo.toml b/Cargo.toml index e6f98eb..8aec9ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,30 +10,21 @@ members = [ resolver = "2" [workspace.dependencies] -anyhow = { version = "1.0.75" } -async-trait = { version = "0.1.71" } -better_scoped_tls = { version = "0.1.1" } -derivative = { version = "2.2.0" } -glob = { version = "0.3.1" } -# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix -napi = "2.12.2" -napi-derive = "2.12.2" -napi-build = "2.0.1" -rustc-hash = { version = "1.1.0" } -serde = { version = "1.0.171" } -serde_json = { version = "1.0.100" } -tokio = { version = "1.29.1" } -tracing = { version = "0.1.37" } +anyhow = { version = "1.0.71", features = ["backtrace"] } async-recursion = { version = "1.0.4" } async-scoped = { version = "0.7.1" } +async-trait = { version = "0.1.71" } backtrace = "0.3" +better_scoped_tls = { version = "0.1.1" } bitflags = { version = "1.3.2" } colored = { version = "2.0.4" } concat-string = "1.0.1" dashmap = { version = "5.5.0" } +derivative = { version = "2.2.0" } derive_builder = { version = "0.11.2" } futures = { version = "0.3.28" } futures-util = { version = "0.3.28" } +glob = { version = "0.3.1" } hashlink = { version = "0.8.3" } indexmap = { version = "1.9.3" } insta = { version = "1.30.0" } @@ -44,53 +35,65 @@ mimalloc-rust = { version = "0.2" } mime_guess = { version = "2.0.4" } once_cell = { version = "1.18.0" } paste = { version = "1.0" } +path-clean = { version = "1.0.1" } pathdiff = { version = "0.2.1" } -preset_env_base = { version = "0.4.5" } +preset_env_base = { version = "0.4.6" } rayon = { version = "1.7.0" } regex = { version = "1.9.1" } rkyv = { version = "0.7.42" } rspack_sources = { version = "0.2.7" } +rustc-hash = { version = "1.1.0" } schemars = { version = "0.8.12" } +serde = { version = "1.0.171" } +serde_json = { version = "1.0.100" } similar = { version = "2.2.1" } sugar_path = { version = "0.0.12" } testing_macros = { version = "0.2.11" } +tokio = { version = "1.29.1" } +tracing = { version = "0.1.37" } tracing-subscriber = { version = "0.3.17" } url = { version = "2.4.0" } urlencoding = { version = "2.1.2" } ustr = { version = "0.9.0" } xxhash-rust = { version = "0.8.6" } +# Pinned +napi = { version = "=2.13.3" } +napi-build = { version = "=2.0.1" } +napi-derive = { version = "=2.13.0" } napi-sys = { version = "=2.2.3" } -styled_components = { version = "=0.72.0" } +styled_components = { version = "0.77.0" } swc_config = { version = "=0.1.7" } -swc_core = { version = "=0.83.1", default-features = false } -swc_css = { version = "=0.155.2" } -swc_ecma_minifier = { version = "=0.187.0", default-features = false } -swc_emotion = { version = "=0.42.0" } -swc_error_reporters = { version = "=0.16.1" } -swc_html = { version = "=0.131.0" } -swc_html_minifier = { version = "=0.128.0" } -swc_node_comments = { version = "=0.19.1" } +swc_core = { version = "0.86.33", default-features = false } +swc_css = { version = "0.157.6" } +swc_ecma_minifier = { version = "0.189.28", default-features = false } +swc_emotion = { version = "=0.58.0" } +swc_error_reporters = { version = "=0.17.2" } +swc_html = { version = "=0.134.29" } +swc_html_minifier = { version = "=0.131.29" } +swc_node_comments = { version = "=0.20.2" } tikv-jemallocator = { version = "=0.5.4", features = ["disable_initial_exec_tls"] } [patch.crates-io] -swc_config = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_core = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_minifier = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_error_reporters = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_html = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_html_minifier = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_node_comments = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_common = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_utils = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_ast = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_ecma_visit = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -swc_atoms = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } -preset_env_base = { git = "https://github.com/swc-project/swc.git", rev = "5c00525" } +swc_config = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_core = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_ecma_minifier = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_error_reporters = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_html = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_html_minifier = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_node_comments = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_common = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_ecma_utils = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_ecma_ast = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_ecma_visit = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_atoms = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +preset_env_base = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } +swc_ecma_codegen = { git = "https://github.com/swc-project/swc.git", rev = "1095bff" } [profile.dev] -debug = 2 -incremental = true +codegen-units = 16 # debug build will cause runtime panic if codegen-unints is default +debug = 2 +incremental = true [profile.release] codegen-units = 1 diff --git a/crates/binding_options/Cargo.toml b/crates/binding_options/Cargo.toml index 2a21109..a0a45e8 100644 --- a/crates/binding_options/Cargo.toml +++ b/crates/binding_options/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" [dependencies] rspack_binding_macros = { path = "../.rspack_crates/rspack_binding_macros" } rspack_binding_options = { path = "../.rspack_crates/rspack_binding_options" } +rspack_binding_values = { path = "../.rspack_crates/rspack_binding_values" } rspack_core = { path = "../.rspack_crates/rspack_core" } rspack_error = { path = "../.rspack_crates/rspack_error" } rspack_identifier = { path = "../.rspack_crates/rspack_identifier" } rspack_ids = { path = "../.rspack_crates/rspack_ids" } -rspack_loader_react_refresh = { path = "../.rspack_crates/rspack_loader_react_refresh" } rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" } rspack_loader_sass = { path = "../.rspack_crates/rspack_loader_sass" } rspack_loader_swc = { path = "../.rspack_crates/rspack_loader_swc" } @@ -29,6 +29,7 @@ rspack_plugin_html = { path = "../.rspack_crates/rspack_plu rspack_plugin_javascript = { path = "../.rspack_crates/rspack_plugin_javascript" } rspack_plugin_json = { path = "../.rspack_crates/rspack_plugin_json" } rspack_plugin_library = { path = "../.rspack_crates/rspack_plugin_library" } +rspack_plugin_limit_chunk_count = { path = "../.rspack_crates/rspack_plugin_limit_chunk_count" } rspack_plugin_progress = { path = "../.rspack_crates/rspack_plugin_progress" } rspack_plugin_real_content_hash = { path = "../.rspack_crates/rspack_plugin_real_content_hash" } rspack_plugin_remove_empty_chunks = { path = "../.rspack_crates/rspack_plugin_remove_empty_chunks" } @@ -38,7 +39,9 @@ rspack_plugin_split_chunks = { path = "../.rspack_crates/rspack_plu rspack_plugin_split_chunks_new = { path = "../.rspack_crates/rspack_plugin_split_chunks_new" } rspack_plugin_swc_css_minimizer = { path = "../.rspack_crates/rspack_plugin_swc_css_minimizer" } rspack_plugin_swc_js_minimizer = { path = "../.rspack_crates/rspack_plugin_swc_js_minimizer" } +rspack_plugin_warn_sensitive_module = { path = "../.rspack_crates/rspack_plugin_warn_sensitive_module" } rspack_plugin_wasm = { path = "../.rspack_crates/rspack_plugin_wasm" } +rspack_plugin_web_worker_template = { path = "../.rspack_crates/rspack_plugin_web_worker_template" } rspack_plugin_worker = { path = "../.rspack_crates/rspack_plugin_worker" } rspack_regex = { path = "../.rspack_crates/rspack_regex" } rspack_hash = { path = "../.rspack_crates/rspack_hash" } diff --git a/crates/binding_options/src/options/js_loader.rs b/crates/binding_options/src/options/js_loader.rs index 98ee634..ae36171 100644 --- a/crates/binding_options/src/options/js_loader.rs +++ b/crates/binding_options/src/options/js_loader.rs @@ -21,6 +21,16 @@ pub async fn run_builtin_loader( let loader = get_builtin_loader(&builtin, options); let loader_item = loader.clone().into(); let list = &[loader_item]; + let additional_data = { + let mut additional_data = loader_context.additional_data_external.clone(); + if let Some(data) = loader_context + .additional_data + .map(|b| String::from_utf8_lossy(b.as_ref()).to_string()) + { + additional_data.insert(data); + } + additional_data + }; let mut cx = LoaderContext { content: loader_context @@ -30,15 +40,13 @@ pub async fn run_builtin_loader( resource_path: Path::new(&loader_context.resource_path), resource_query: loader_context.resource_query.as_deref(), resource_fragment: loader_context.resource_fragment.as_deref(), - context: loader_context.context.clone(), + context: loader_context.context_external.clone(), source_map: loader_context .source_map .map(|s| SourceMap::from_slice(s.as_ref())) .transpose() .map_err(|e| Error::from_reason(e.to_string()))?, - additional_data: loader_context - .additional_data - .map(|b| String::from_utf8_lossy(b.as_ref()).to_string()), + additional_data, cacheable: loader_context.cacheable, file_dependencies: HashSet::from_iter( loader_context @@ -69,21 +77,21 @@ pub async fn run_builtin_loader( __diagnostics: vec![], __resource_data: &ResourceData::new(Default::default(), Default::default()), __loader_items: LoaderItemList(list), - __loader_index: 0, + // This is used an hack to `builtin:swc-loader` in order to determine whether to return AST or source. + __loader_index: loader_context.loader_index_from_js.unwrap_or(0) as usize, __plugins: &[], }; if loader_context.is_pitching { - // Run pitching loader - loader - .pitch(&mut cx) - .await - .map_err(|e| Error::from_reason(e.to_string()))?; + // Builtin loaders dispatched using JS loader-runner does not support pitching. + // This phase is ignored. } else { // Run normal loader loader .run(&mut cx) .await .map_err(|e| Error::from_reason(e.to_string()))?; + // restore the hack + cx.__loader_index = 0; } JsLoaderContext::try_from(&cx).map_err(|e| Error::from_reason(e.to_string())) diff --git a/crates/binding_options/src/options/mod.rs b/crates/binding_options/src/options/mod.rs index b5db707..9fe4d0e 100644 --- a/crates/binding_options/src/options/mod.rs +++ b/crates/binding_options/src/options/mod.rs @@ -1,26 +1,28 @@ use napi_derive::napi; -use better_scoped_tls::scoped_tls; use rspack_core::{ BoxPlugin, CompilerOptions, Context, DevServerOptions, Devtool, Experiments, IncrementalRebuild, - IncrementalRebuildMakeState, ModuleOptions, ModuleType, OutputOptions, PluginExt, + IncrementalRebuildMakeState, ModuleOptions, ModuleType, OutputOptions, PluginExt, Optimization, }; +use rspack_plugin_javascript::{ + FlagDependencyExportsPlugin, FlagDependencyUsagePlugin, SideEffectsFlagPlugin, +}; +use serde::Deserialize; + use rspack_binding_options::{ RawBuiltins, RawCacheOptions, RawContext, RawDevServer, RawDevtool, RawExperiments, - RawMode, RawNodeOption, RawOptimizationOptions, RawOutputOptions, RawResolveOptions, - RawSnapshotOptions, RawStatsOptions, RawTarget, RawOptionsApply, RawModuleOptions, + RawMode, RawNodeOption, RawOutputOptions, RawResolveOptions, RawOptimizationOptions, + RawSnapshotOptions, RawStatsOptions, RawTarget, RawModuleOptions, RawOptionsApply, }; -use rspack_plugin_javascript::{FlagDependencyExportsPlugin, FlagDependencyUsagePlugin}; -use serde::Deserialize; mod raw_module; mod raw_features; mod js_loader; +mod raw_optimization; pub use raw_module::*; pub use raw_features::*; pub use js_loader::*; - -scoped_tls!(pub(crate) static IS_ENABLE_NEW_SPLIT_CHUNKS: bool); +pub use raw_optimization::*; #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] @@ -38,7 +40,7 @@ pub struct RSPackRawOptions { pub module: RawModuleOptions, #[napi(ts_type = "string")] pub devtool: RawDevtool, - pub optimization: RawOptimizationOptions, + pub optimization: RspackRawOptimizationOptions, pub stats: RawStatsOptions, pub dev_server: RawDevServer, pub snapshot: RawSnapshotOptions, @@ -75,9 +77,10 @@ impl RawOptionsApply for RSPackRawOptions { }, async_web_assembly: self.experiments.async_web_assembly, new_split_chunks: self.experiments.new_split_chunks, + top_level_await: self.experiments.top_level_await, rspack_future: self.experiments.rspack_future.into(), }; - let optimization; + let optimization: Optimization; if self.features.split_chunks_strategy.is_some() { let split_chunk_strategy = SplitChunksStrategy::new( self.features.split_chunks_strategy.unwrap(), @@ -89,7 +92,7 @@ impl RawOptionsApply for RSPackRawOptions { self.optimization.apply(plugins) })?; } - + let stats = self.stats.into(); let snapshot = self.snapshot.into(); let node = self.node.map(|n| n.into()); @@ -141,6 +144,9 @@ impl RawOptionsApply for RSPackRawOptions { plugins.push(rspack_ids::NamedChunkIdsPlugin::new(None, None).boxed()); if experiments.rspack_future.new_treeshaking { + if optimization.side_effects.is_enable() { + plugins.push(SideEffectsFlagPlugin::default().boxed()); + } if optimization.provided_exports { plugins.push(FlagDependencyExportsPlugin::default().boxed()); } @@ -156,7 +162,7 @@ impl RawOptionsApply for RSPackRawOptions { plugins.push(rspack_plugin_ensure_chunk_conditions::EnsureChunkConditionsPlugin.boxed()); - plugins.push(plugin_manifest::ManifestPlugin::new().boxed()); + plugins.push(rspack_plugin_warn_sensitive_module::WarnCaseSensitiveModulesPlugin.boxed()); Ok(Self::Options { context, diff --git a/crates/binding_options/src/options/raw_features.rs b/crates/binding_options/src/options/raw_features.rs index ceec742..f3b8fb3 100644 --- a/crates/binding_options/src/options/raw_features.rs +++ b/crates/binding_options/src/options/raw_features.rs @@ -11,7 +11,7 @@ use rspack_ids::{ DeterministicChunkIdsPlugin, DeterministicModuleIdsPlugin, NamedChunkIdsPlugin, NamedModuleIdsPlugin, }; -use rspack_binding_options::RawOptimizationOptions; +use crate::RspackRawOptimizationOptions; use rspack_plugin_split_chunks_new::{PluginOptions, CacheGroup}; use rspack_regex::RspackRegex; use rspack_hash::{RspackHash, HashFunction, HashDigest}; @@ -27,6 +27,7 @@ pub struct SplitChunksStrategy { real_content_hash: bool, remove_empty_chunks: bool, remove_available_modules: bool, + inner_graph: bool, } fn get_modules_size(module: &dyn Module) -> f64 { @@ -126,7 +127,7 @@ pub trait FeatureApply { } impl SplitChunksStrategy { - pub fn new(strategy: RawStrategyOptions, option: RawOptimizationOptions) -> Self { + pub fn new(strategy: RawStrategyOptions, option: RspackRawOptimizationOptions) -> Self { Self { strategy, chunk_ids: option.chunk_ids, @@ -137,6 +138,7 @@ impl SplitChunksStrategy { used_exports: option.used_exports, provided_exports: option.provided_exports, real_content_hash: option.real_content_hash, + inner_graph: option.inner_graph, } } } @@ -173,12 +175,13 @@ impl FeatureApply for SplitChunksStrategy { if self.real_content_hash { plugins.push(rspack_plugin_real_content_hash::RealContentHashPlugin.boxed()); } - Ok(Self::Options { + Ok(Optimization { remove_available_modules: self.remove_available_modules, remove_empty_chunks: self.remove_empty_chunks, side_effects: SideEffectOption::from(self.side_effects.as_str()), provided_exports: self.provided_exports, used_exports: UsedExportsOption::from(self.used_exports.as_str()), + inner_graph: self.inner_graph, }) } } diff --git a/crates/binding_options/src/options/raw_module.rs b/crates/binding_options/src/options/raw_module.rs index 4cc8e18..77b6c21 100644 --- a/crates/binding_options/src/options/raw_module.rs +++ b/crates/binding_options/src/options/raw_module.rs @@ -1,6 +1,5 @@ use std::sync::Arc; use rspack_core::BoxLoader; -use rspack_loader_react_refresh::REACT_REFRESH_LOADER_IDENTIFIER; use rspack_loader_sass::SASS_LOADER_IDENTIFIER; use rspack_loader_swc::SWC_LOADER_IDENTIFIER; use loader_compilation::COMPILATION_LOADER_IDENTIFIER; @@ -24,11 +23,6 @@ pub fn get_builtin_loader(builtin: &str, options: Option<&str>) -> BoxLoader { .with_identifier(builtin.into()), ); } - if builtin.starts_with(REACT_REFRESH_LOADER_IDENTIFIER) { - return Arc::new( - rspack_loader_react_refresh::ReactRefreshLoader::default().with_identifier(builtin.into()), - ); - } if builtin.starts_with(COMPILATION_LOADER_IDENTIFIER) { return Arc::new( diff --git a/crates/binding_options/src/options/raw_optimization.rs b/crates/binding_options/src/options/raw_optimization.rs new file mode 100644 index 0000000..2090002 --- /dev/null +++ b/crates/binding_options/src/options/raw_optimization.rs @@ -0,0 +1,82 @@ +use better_scoped_tls::scoped_tls; +use napi_derive::napi; +use rspack_core::{Optimization, PluginExt, SideEffectOption, UsedExportsOption}; +use rspack_error::internal_error; +use rspack_ids::{ + DeterministicChunkIdsPlugin, DeterministicModuleIdsPlugin, NamedChunkIdsPlugin, + NamedModuleIdsPlugin, +}; +use rspack_plugin_split_chunks::SplitChunksPlugin; +use serde::Deserialize; + +use rspack_binding_options::{RawOptionsApply, RawSplitChunksOptions}; + +scoped_tls!(pub(crate) static IS_ENABLE_NEW_SPLIT_CHUNKS: bool); + +#[derive(Deserialize, Debug, Default)] +#[serde(rename_all = "camelCase")] +#[napi(object)] +pub struct RspackRawOptimizationOptions { + pub split_chunks: Option, + pub module_ids: String, + pub chunk_ids: String, + pub remove_available_modules: bool, + pub remove_empty_chunks: bool, + pub side_effects: String, + pub used_exports: String, + pub provided_exports: bool, + pub inner_graph: bool, + pub real_content_hash: bool, +} + +impl RawOptionsApply for RspackRawOptimizationOptions { + type Options = Optimization; + + fn apply( + self, + plugins: &mut Vec>, + ) -> Result { + if let Some(options) = self.split_chunks { + let split_chunks_plugin = IS_ENABLE_NEW_SPLIT_CHUNKS.with(|is_enable_new_split_chunks| { + if *is_enable_new_split_chunks { + rspack_plugin_split_chunks_new::SplitChunksPlugin::new(options.into()).boxed() + } else { + SplitChunksPlugin::new(options.into()).boxed() + } + }); + + plugins.push(split_chunks_plugin); + } + let chunk_ids_plugin = match self.chunk_ids.as_ref() { + "named" => NamedChunkIdsPlugin::new(None, None).boxed(), + "deterministic" => DeterministicChunkIdsPlugin::default().boxed(), + _ => { + return Err(internal_error!( + "'chunk_ids' should be 'named' or 'deterministic'." + )) + } + }; + plugins.push(chunk_ids_plugin); + let module_ids_plugin = match self.module_ids.as_ref() { + "named" => NamedModuleIdsPlugin::default().boxed(), + "deterministic" => DeterministicModuleIdsPlugin::default().boxed(), + _ => { + return Err(internal_error!( + "'module_ids' should be 'named' or 'deterministic'." + )) + } + }; + plugins.push(module_ids_plugin); + if self.real_content_hash { + plugins.push(rspack_plugin_real_content_hash::RealContentHashPlugin.boxed()); + } + Ok(Optimization { + remove_available_modules: self.remove_available_modules, + remove_empty_chunks: self.remove_empty_chunks, + side_effects: SideEffectOption::from(self.side_effects.as_str()), + provided_exports: self.provided_exports, + used_exports: UsedExportsOption::from(self.used_exports.as_str()), + inner_graph: self.inner_graph, + }) + } +} diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index f41687a..c3edc02 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -8,6 +8,7 @@ crate-type = ["cdylib"] [dependencies] rspack_binding_macros = { path = "../.rspack_crates/rspack_binding_macros" } +rspack_binding_values = { path = "../.rspack_crates/rspack_binding_values" } binding_options = { path = "../binding_options" } rspack_binding_options = { path = "../.rspack_crates/rspack_binding_options" } rspack_core = { path = "../.rspack_crates/rspack_core" } diff --git a/crates/node_binding/index.d.ts b/crates/node_binding/index.d.ts index 591c15f..f6e6922 100644 --- a/crates/node_binding/index.d.ts +++ b/crates/node_binding/index.d.ts @@ -22,43 +22,289 @@ export interface ThreadsafeNodeFS { mkdirp: (...args: any[]) => any removeDirAll: (...args: any[]) => any } +export interface JsAssetInfoRelated { + sourceMap?: string +} +export interface JsAssetInfo { + /** if the asset can be long term cached forever (contains a hash) */ + immutable: boolean + /** whether the asset is minimized */ + minimized: boolean + /** + * the value(s) of the full hash used for this asset + * the value(s) of the chunk hash used for this asset + */ + chunkHash: Array + /** + * the value(s) of the module hash used for this asset + * the value(s) of the content hash used for this asset + */ + contentHash: Array + sourceFilename?: string + /** + * size in bytes, only set after asset has been emitted + * when asset is only used for development and doesn't count towards user-facing assets + */ + development: boolean + /** when asset ships data for updating an existing application (HMR) */ + hotModuleReplacement: boolean + /** + * when asset is javascript and an ESM + * related object to other assets, keyed by type of relation (only points from parent to child) + */ + related: JsAssetInfoRelated + /** + * the asset version, emit can be skipped when both filename and version are the same + * An empty string means no version, it will always emit + */ + version: string +} +export interface JsAsset { + name: string + source?: JsCompatSource + info: JsAssetInfo +} +export interface JsAssetEmittedArgs { + filename: string + outputPath: string + targetPath: string +} export interface JsChunk { + __inner_ukey: number name?: string + id?: string + ids: Array + idNameHints: Array + filenameTemplate?: string + cssFilenameTemplate?: string files: Array + runtime: Array + hash?: string + contentHash: Record + renderedHash?: string + chunkReasons: Array + auxiliaryFiles: Array } +export function __chunk_inner_is_only_initial(jsChunk: JsChunk, compilation: JsCompilation): boolean +export function __chunk_inner_can_be_initial(jsChunk: JsChunk, compilation: JsCompilation): boolean +export function __chunk_inner_has_runtime(jsChunk: JsChunk, compilation: JsCompilation): boolean export interface JsChunkAssetArgs { chunk: JsChunk filename: string } -export interface RawBannerRule { - type: "string" | "regexp" - stringMatcher?: string - regexpMatcher?: string +export interface JsChunkGroup { + chunks: Array } -export interface RawBannerRules { - type: "string" | "regexp" | "array" - stringMatcher?: string - regexpMatcher?: string - arrayMatcher?: Array +export interface JsHooks { + processAssetsStageAdditional: (...args: any[]) => any + processAssetsStagePreProcess: (...args: any[]) => any + processAssetsStageDerived: (...args: any[]) => any + processAssetsStageAdditions: (...args: any[]) => any + processAssetsStageNone: (...args: any[]) => any + processAssetsStageOptimize: (...args: any[]) => any + processAssetsStageOptimizeCount: (...args: any[]) => any + processAssetsStageOptimizeCompatibility: (...args: any[]) => any + processAssetsStageOptimizeSize: (...args: any[]) => any + processAssetsStageDevTooling: (...args: any[]) => any + processAssetsStageOptimizeInline: (...args: any[]) => any + processAssetsStageSummarize: (...args: any[]) => any + processAssetsStageOptimizeHash: (...args: any[]) => any + processAssetsStageOptimizeTransfer: (...args: any[]) => any + processAssetsStageAnalyse: (...args: any[]) => any + processAssetsStageReport: (...args: any[]) => any + compilation: (...args: any[]) => any + thisCompilation: (...args: any[]) => any + emit: (...args: any[]) => any + assetEmitted: (...args: any[]) => any + afterEmit: (...args: any[]) => any + make: (...args: any[]) => any + optimizeModules: (...args: any[]) => any + optimizeTree: (...args: any[]) => any + optimizeChunkModule: (...args: any[]) => any + beforeCompile: (...args: any[]) => any + afterCompile: (...args: any[]) => any + finishModules: (...args: any[]) => any + finishMake: (...args: any[]) => any + buildModule: (...args: any[]) => any + beforeResolve: (...args: any[]) => any + afterResolve: (...args: any[]) => any + contextModuleBeforeResolve: (...args: any[]) => any + normalModuleFactoryResolveForScheme: (...args: any[]) => any + chunkAsset: (...args: any[]) => any + succeedModule: (...args: any[]) => any + stillValidModule: (...args: any[]) => any +} +export interface JsModule { + originalSource?: JsCompatSource + resource?: string + moduleIdentifier: string +} +export interface JsResolveForSchemeInput { + resourceData: JsResourceData + scheme: string +} +export interface JsResolveForSchemeResult { + resourceData: JsResourceData + stop: boolean +} +export interface BeforeResolveData { + request: string + context: string +} +export interface AfterResolveData { + request: string + context: string + fileDependencies: Array + contextDependencies: Array + missingDependencies: Array + factoryMeta: FactoryMeta +} +export interface FactoryMeta { + sideEffectFree?: boolean +} +export interface JsResourceData { + /** Resource with absolute path, query and fragment */ + resource: string + /** Absolute resource path only */ + path: string + /** Resource query with `?` prefix */ + query?: string + /** Resource fragment with `#` prefix */ + fragment?: string +} +export interface PathData { + filename?: string + hash?: string + contentHash?: string + runtime?: string + url?: string + id?: string +} +export interface PathWithInfo { + path: string + info: JsAssetInfo +} +export interface JsCompatSource { + /** Whether the underlying data structure is a `RawSource` */ + isRaw: boolean + /** Whether the underlying value is a buffer or string */ + isBuffer: boolean + source: Buffer + map?: Buffer +} +export interface JsStatsError { + message: string + formatted: string + title: string +} +export interface JsStatsWarning { + message: string + formatted: string +} +export interface JsStatsLogging { + name: string + type: string + args?: Array + trace?: Array +} +export interface JsStatsAsset { + type: string + name: string + size: number + chunks: Array + chunkNames: Array + info: JsStatsAssetInfo + emitted: boolean +} +export interface JsStatsAssetInfo { + development: boolean + hotModuleReplacement: boolean + sourceFilename?: string +} +export interface JsStatsModule { + type: string + moduleType: string + identifier: string + name: string + id?: string + chunks: Array + size: number + issuer?: string + issuerName?: string + issuerId?: string + issuerPath: Array + nameForCondition?: string + reasons?: Array + assets?: Array + source?: string | Buffer + profile?: JsStatsModuleProfile +} +export interface JsStatsModuleProfile { + factory: JsStatsMillisecond + integration: JsStatsMillisecond + building: JsStatsMillisecond +} +export interface JsStatsMillisecond { + secs: number + subsecMillis: number +} +export interface JsStatsModuleIssuer { + identifier: string + name: string + id?: string +} +export interface JsStatsModuleReason { + moduleIdentifier?: string + moduleName?: string + moduleId?: string + type?: string + userRequest?: string +} +export interface JsStatsChunk { + type: string + files: Array + auxiliaryFiles: Array + id?: string + entry: boolean + initial: boolean + names: Array + size: number + modules?: Array + parents?: Array + children?: Array + siblings?: Array +} +export interface JsStatsChunkGroupAsset { + name: string + size: number +} +export interface JsStatsChunkGroup { + name: string + assets: Array + chunks: Array + assetsSize: number +} +export interface JsStatsAssetsByChunkName { + name: string + files: Array +} +export interface JsStatsGetAssets { + assets: Array + assetsByChunkName: Array } export interface RawBannerContentFnCtx { hash: string chunk: JsChunk filename: string } -export interface RawBannerContent { - type: "string" | "function" - stringPayload?: string - fnPayload?: (...args: any[]) => any -} export interface RawBannerPluginOptions { - banner: RawBannerContent + banner: string | ((...args: any[]) => any) entryOnly?: boolean footer?: boolean raw?: boolean - test?: RawBannerRules - include?: RawBannerRules - exclude?: RawBannerRules + test?: string | RegExp | (string | RegExp)[] + include?: string | RegExp | (string | RegExp)[] + exclude?: string | RegExp | (string | RegExp)[] } export interface RawCopyPattern { from: string @@ -69,6 +315,20 @@ export interface RawCopyPattern { force: boolean priority: number globOptions: RawCopyGlobOptions + info?: RawInfo +} +export interface RawInfo { + immutable?: boolean + minimized?: boolean + chunkHash?: Array + contentHash?: Array + development?: boolean + hotModuleReplacement?: boolean + related?: RawRelated + version?: string +} +export interface RawRelated { + sourceMap?: string } export interface RawCopyGlobOptions { caseSensitiveMatch?: boolean @@ -100,32 +360,23 @@ export interface RawHtmlRspackPluginOptions { favicon?: string meta?: Record> } -export interface RawProgressPluginOptions { - prefix?: string -} -export interface RawSwcJsMinimizerRule { - type: "string" | "regexp" - stringMatcher?: string - regexpMatcher?: string +export interface RawLimitChunkCountPluginOptions { + chunkOverhead?: number + entryChunkMultiplicator?: number + maxChunks: number } -export interface RawSwcJsMinimizerRules { - type: "string" | "regexp" | "array" - stringMatcher?: string - regexpMatcher?: string - arrayMatcher?: Array +export interface RawProgressPluginOptions { + prefix: string + profile: boolean } export interface RawSwcJsMinimizerRspackPluginOptions { - passes: number - dropConsole: boolean - keepClassNames: boolean - keepFnNames: boolean - comments: "all" | "some" | "false" - asciiOnly: boolean - pureFuncs: Array extractComments?: string - test?: RawSwcJsMinimizerRules - include?: RawSwcJsMinimizerRules - exclude?: RawSwcJsMinimizerRules + compress: boolean | string + mangle: boolean | string + format: string + test?: string | RegExp | (string | RegExp)[] + include?: string | RegExp | (string | RegExp)[] + exclude?: string | RegExp | (string | RegExp)[] } export interface RawDecoratorOptions { legacy: boolean @@ -204,6 +455,8 @@ export const enum BuiltinPluginName { ArrayPushCallbackChunkFormatPlugin = 'ArrayPushCallbackChunkFormatPlugin', ModuleChunkFormatPlugin = 'ModuleChunkFormatPlugin', HotModuleReplacementPlugin = 'HotModuleReplacementPlugin', + LimitChunkCountPlugin = 'LimitChunkCountPlugin', + WebWorkerTemplatePlugin = 'WebWorkerTemplatePlugin', HttpExternalsRspackPlugin = 'HttpExternalsRspackPlugin', CopyRspackPlugin = 'CopyRspackPlugin', HtmlRspackPlugin = 'HtmlRspackPlugin', @@ -241,6 +494,7 @@ export interface RawEntryOptions { publicPath?: string baseUri?: string filename?: string + library?: RawLibraryOptions } export interface RawIncrementalRebuild { make: boolean @@ -256,6 +510,7 @@ export interface RawExperiments { incrementalRebuild: RawIncrementalRebuild asyncWebAssembly: boolean newSplitChunks: boolean + topLevelAwait: boolean css: boolean rspackFuture: RawRspackFuture } @@ -265,25 +520,11 @@ export interface RawHttpExternalsRspackPluginOptions { } export interface RawExternalsPluginOptions { type: string - externals: Array -} -export interface RawExternalItem { - type: "string" | "regexp" | "object" | "function" - stringPayload?: string - regexpPayload?: string - objectPayload?: Record - fnPayload?: (value: any) => any -} -export interface RawExternalItemValue { - type: "string" | "bool" | "array" | "object" - stringPayload?: string - boolPayload?: boolean - arrayPayload?: Array - objectPayload?: Record> + externals: (string | RegExp | Record> | ((...args: any[]) => any))[] } export interface RawExternalItemFnResult { externalType?: string - result?: RawExternalItemValue + result?: string | boolean | string[] | Record } export interface RawExternalItemFnCtx { request: string @@ -315,29 +556,29 @@ export interface JsLoaderContext { assetFilenames: Array currentLoader: string isPitching: boolean + /** + * Loader index from JS. + * If loaders are dispatched by JS loader runner, + * then, this field is correspondence with loader index in JS side. + * It is useful when loader dispatched on JS side has an builtin loader, for example: builtin:swc-loader, + * Then this field will be used as an hack to test whether it should return an AST or string. + */ + loaderIndexFromJs?: number + /** + * Internal additional data, contains more than `String` + * @internal + */ + additionalDataExternal: ExternalObject<'AdditionalData'> /** * Internal loader context * @internal */ - context: ExternalObject + contextExternal: ExternalObject<'LoaderRunnerContext'> /** * Internal loader diagnostic * @internal */ - diagnostics: ExternalObject> -} -export interface JsLoaderResult { - /** Content in pitching stage can be empty */ - content?: Buffer - fileDependencies: Array - contextDependencies: Array - missingDependencies: Array - buildDependencies: Array - sourceMap?: Buffer - additionalData?: Buffer - cacheable: boolean - /** Used to instruct how rust loaders should execute */ - isPitching: boolean + diagnosticsExternal: ExternalObject<'Diagnostic[]'> } /** * `loader` is for both JS and Rust loaders. @@ -404,8 +645,12 @@ export interface RawModuleRule { enforce?: 'pre' | 'post' } export interface RawParserOptions { - type: "asset" | "unknown" + type: "asset" | "javascript" | "unknown" asset?: RawAssetParserOptions + javascript?: RawJavascriptParserOptions +} +export interface RawJavascriptParserOptions { + dynamicImportMode: string } export interface RawAssetParserOptions { dataUrlCondition?: RawAssetParserDataUrl @@ -468,12 +713,19 @@ export interface RawOptimizationOptions { sideEffects: string usedExports: string providedExports: boolean + innerGraph: boolean realContentHash: boolean } export interface RawTrustedTypes { policyName?: string } export interface RawLibraryName { + type: "string" | "array" | "umdObject" + stringPayload?: string + arrayPayload?: Array + umdObjectPayload?: RawLibraryCustomUmdObject +} +export interface RawLibraryCustomUmdObject { amd?: string commonjs?: string root?: Array @@ -490,6 +742,7 @@ export interface RawLibraryOptions { libraryType: string umdNamedDefine?: boolean auxiliaryComment?: RawLibraryAuxiliaryComment + amdContainer?: string } export interface RawCrossOriginLoading { type: "bool" | "string" @@ -534,6 +787,11 @@ export interface RawOutputOptions { workerWasmLoading: string workerPublicPath: string } +export interface RawResolveTsconfigOptions { + configFile: string + referencesType: "auto" | "manual" | "disabled" + references?: Array +} export interface RawResolveOptions { preferRelative?: boolean extensions?: Array @@ -544,7 +802,7 @@ export interface RawResolveOptions { alias?: Record> fallback?: Record> symlinks?: boolean - tsConfigPath?: string + tsconfig?: RawResolveTsconfigOptions modules?: Array byDependency?: Record fullySpecified?: boolean @@ -562,7 +820,7 @@ export interface RawSnapshotOptions { export interface RawSplitChunksOptions { fallbackCacheGroup?: RawFallbackCacheGroupOptions name?: string - cacheGroups?: Record + cacheGroups?: Array /** What kind of chunks should be selected. */ chunks?: RegExp | 'async' | 'initial' | 'all' maxAsyncRequests?: number @@ -576,6 +834,7 @@ export interface RawSplitChunksOptions { maxInitialSize?: number } export interface RawCacheGroupOptions { + key: string priority?: number test?: RegExp | string idHint?: string @@ -620,6 +879,25 @@ export interface RawOptions { profile: boolean builtins: RawBuiltins } +export interface RawStrategyOptions { + name: string + topLevelFrameworks: Array +} +export interface RawFeatures { + splitChunksStrategy?: RawStrategyOptions +} +export interface RspackRawOptimizationOptions { + splitChunks?: RawSplitChunksOptions + moduleIds: string + chunkIds: string + removeAvailableModules: boolean + removeEmptyChunks: boolean + sideEffects: string + usedExports: string + providedExports: boolean + innerGraph: boolean + realContentHash: boolean +} export interface RsPackRawOptions { mode?: undefined | 'production' | 'development' | 'none' target: Array @@ -629,7 +907,7 @@ export interface RsPackRawOptions { resolveLoader: RawResolveOptions module: RawModuleOptions devtool: string - optimization: RawOptimizationOptions + optimization: RspackRawOptimizationOptions stats: RawStatsOptions devServer: RawDevServer snapshot: RawSnapshotOptions @@ -638,252 +916,7 @@ export interface RsPackRawOptions { node?: RawNodeOption profile: boolean builtins: RawBuiltins -} -export interface JsAssetInfoRelated { - sourceMap?: string -} -export interface JsAssetInfo { - /** if the asset can be long term cached forever (contains a hash) */ - immutable: boolean - /** whether the asset is minimized */ - minimized: boolean - /** - * the value(s) of the full hash used for this asset - * the value(s) of the chunk hash used for this asset - */ - chunkHash: Array - /** - * the value(s) of the module hash used for this asset - * the value(s) of the content hash used for this asset - */ - contentHash: Array - /** - * when asset was created from a source file (potentially transformed), the original filename relative to compilation context - * size in bytes, only set after asset has been emitted - * when asset is only used for development and doesn't count towards user-facing assets - */ - development: boolean - /** when asset ships data for updating an existing application (HMR) */ - hotModuleReplacement: boolean - /** - * when asset is javascript and an ESM - * related object to other assets, keyed by type of relation (only points from parent to child) - */ - related: JsAssetInfoRelated - /** - * the asset version, emit can be skipped when both filename and version are the same - * An empty string means no version, it will always emit - */ - version: string -} -export interface JsAsset { - name: string - source?: JsCompatSource - info: JsAssetInfo -} -export interface JsAssetEmittedArgs { - filename: string - outputPath: string - targetPath: string -} -export interface JsChunkGroup { - chunks: Array -} -export interface JsHooks { - processAssetsStageAdditional: (...args: any[]) => any - processAssetsStagePreProcess: (...args: any[]) => any - processAssetsStageDerived: (...args: any[]) => any - processAssetsStageAdditions: (...args: any[]) => any - processAssetsStageNone: (...args: any[]) => any - processAssetsStageOptimize: (...args: any[]) => any - processAssetsStageOptimizeCount: (...args: any[]) => any - processAssetsStageOptimizeCompatibility: (...args: any[]) => any - processAssetsStageOptimizeSize: (...args: any[]) => any - processAssetsStageDevTooling: (...args: any[]) => any - processAssetsStageOptimizeInline: (...args: any[]) => any - processAssetsStageSummarize: (...args: any[]) => any - processAssetsStageOptimizeHash: (...args: any[]) => any - processAssetsStageOptimizeTransfer: (...args: any[]) => any - processAssetsStageAnalyse: (...args: any[]) => any - processAssetsStageReport: (...args: any[]) => any - compilation: (...args: any[]) => any - thisCompilation: (...args: any[]) => any - emit: (...args: any[]) => any - assetEmitted: (...args: any[]) => any - afterEmit: (...args: any[]) => any - make: (...args: any[]) => any - optimizeModules: (...args: any[]) => any - optimizeTree: (...args: any[]) => any - optimizeChunkModule: (...args: any[]) => any - beforeCompile: (...args: any[]) => any - afterCompile: (...args: any[]) => any - finishModules: (...args: any[]) => any - finishMake: (...args: any[]) => any - buildModule: (...args: any[]) => any - beforeResolve: (...args: any[]) => any - afterResolve: (...args: any[]) => any - contextModuleBeforeResolve: (...args: any[]) => any - normalModuleFactoryResolveForScheme: (...args: any[]) => any - chunkAsset: (...args: any[]) => any - succeedModule: (...args: any[]) => any - stillValidModule: (...args: any[]) => any -} -export interface JsModule { - originalSource?: JsCompatSource - resource: string - moduleIdentifier: string -} -export interface JsResolveForSchemeInput { - resourceData: JsResourceData - scheme: string -} -export interface JsResolveForSchemeResult { - resourceData: JsResourceData - stop: boolean -} -export interface BeforeResolveData { - request: string - context: string -} -export interface AfterResolveData { - request: string - context: string - fileDependencies: Array - contextDependencies: Array - missingDependencies: Array - factoryMeta: FactoryMeta -} -export interface FactoryMeta { - sideEffectFree?: boolean -} -export interface JsResourceData { - /** Resource with absolute path, query and fragment */ - resource: string - /** Absolute resource path only */ - path: string - /** Resource query with `?` prefix */ - query?: string - /** Resource fragment with `#` prefix */ - fragment?: string -} -export interface PathData { - filename?: string - hash?: string - contentHash?: string - runtime?: string - url?: string - id?: string -} -export interface PathWithInfo { - path: string - info: JsAssetInfo -} -export interface JsCompatSource { - /** Whether the underlying data structure is a `RawSource` */ - isRaw: boolean - /** Whether the underlying value is a buffer or string */ - isBuffer: boolean - source: Buffer - map?: Buffer -} -export interface JsStatsError { - message: string - formatted: string - title: string -} -export interface JsStatsWarning { - message: string - formatted: string -} -export interface JsStatsLogging { - name: string - type: string - args?: Array - trace?: Array -} -export interface JsStatsAsset { - type: string - name: string - size: number - chunks: Array - chunkNames: Array - info: JsStatsAssetInfo - emitted: boolean -} -export interface JsStatsAssetInfo { - development: boolean - hotModuleReplacement: boolean -} -export interface JsStatsModule { - type: string - moduleType: string - identifier: string - name: string - id?: string - chunks: Array - size: number - issuer?: string - issuerName?: string - issuerId?: string - issuerPath: Array - nameForCondition?: string - reasons?: Array - assets?: Array - source?: string | Buffer - profile?: JsStatsModuleProfile -} -export interface JsStatsModuleProfile { - factory: JsStatsMillisecond - integration: JsStatsMillisecond - building: JsStatsMillisecond -} -export interface JsStatsMillisecond { - secs: number - subsecMillis: number -} -export interface JsStatsModuleIssuer { - identifier: string - name: string - id?: string -} -export interface JsStatsModuleReason { - moduleIdentifier?: string - moduleName?: string - moduleId?: string - type?: string - userRequest?: string -} -export interface JsStatsChunk { - type: string - files: Array - auxiliaryFiles: Array - id: string - entry: boolean - initial: boolean - names: Array - size: number - modules?: Array - parents?: Array - children?: Array - siblings?: Array -} -export interface JsStatsChunkGroupAsset { - name: string - size: number -} -export interface JsStatsChunkGroup { - name: string - assets: Array - chunks: Array - assetsSize: number -} -export interface JsStatsAssetsByChunkName { - name: string - files: Array -} -export interface JsStatsGetAssets { - assets: Array - assetsByChunkName: Array + features: RawFeatures } /** Builtin loader runner */ export function runBuiltinLoader(builtin: string, options: string | undefined | null, loaderContext: JsLoaderContext): Promise @@ -922,7 +955,7 @@ export class JsCompilation { getMissingDependencies(): Array getBuildDependencies(): Array pushDiagnostic(severity: "error" | "warning", title: string, message: string): void - pushNativeDiagnostics(diagnostics: ExternalObject>): void + pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void getStats(): JsStats getAssetPath(filename: string, data: PathData): string getAssetPathWithInfo(filename: string, data: PathData): PathWithInfo @@ -943,7 +976,7 @@ export class JsStats { getErrors(): Array getWarnings(): Array getLogging(acceptedTypes: number): Array - getHash(): string + getHash(): string | null } export class Rspack { constructor(options: RSPackRawOptions, builtinPlugins: Array, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any) diff --git a/crates/node_binding/index.js b/crates/node_binding/index.js index d7beef2..a5eee77 100644 --- a/crates/node_binding/index.js +++ b/crates/node_binding/index.js @@ -252,11 +252,14 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { BuiltinPluginName, JsCompilation, JsStats, runBuiltinLoader, Rspack, registerGlobalTrace, cleanupGlobalTrace } = nativeBinding +const { __chunk_inner_is_only_initial, __chunk_inner_can_be_initial, __chunk_inner_has_runtime, JsCompilation, JsStats, BuiltinPluginName, runBuiltinLoader, Rspack, registerGlobalTrace, cleanupGlobalTrace } = nativeBinding -module.exports.BuiltinPluginName = BuiltinPluginName +module.exports.__chunk_inner_is_only_initial = __chunk_inner_is_only_initial +module.exports.__chunk_inner_can_be_initial = __chunk_inner_can_be_initial +module.exports.__chunk_inner_has_runtime = __chunk_inner_has_runtime module.exports.JsCompilation = JsCompilation module.exports.JsStats = JsStats +module.exports.BuiltinPluginName = BuiltinPluginName module.exports.runBuiltinLoader = runBuiltinLoader module.exports.Rspack = Rspack module.exports.registerGlobalTrace = registerGlobalTrace diff --git a/crates/node_binding/src/js_values/asset.rs b/crates/node_binding/src/js_values/asset.rs deleted file mode 100644 index 1c27142..0000000 --- a/crates/node_binding/src/js_values/asset.rs +++ /dev/null @@ -1,106 +0,0 @@ -use super::JsCompatSource; - -#[napi(object)] -pub struct JsAssetInfoRelated { - pub source_map: Option, -} - -impl From for rspack_core::AssetInfoRelated { - fn from(i: JsAssetInfoRelated) -> Self { - Self { - source_map: i.source_map, - } - } -} -#[napi(object)] -pub struct JsAssetInfo { - /// if the asset can be long term cached forever (contains a hash) - pub immutable: bool, - /// whether the asset is minimized - pub minimized: bool, - /// the value(s) of the full hash used for this asset - // pub full_hash: - /// the value(s) of the chunk hash used for this asset - pub chunk_hash: Vec, - /// the value(s) of the module hash used for this asset - // pub module_hash: - /// the value(s) of the content hash used for this asset - pub content_hash: Vec, - /// when asset was created from a source file (potentially transformed), the original filename relative to compilation context - // pub source_filename: - /// size in bytes, only set after asset has been emitted - // pub size: f64, - /// when asset is only used for development and doesn't count towards user-facing assets - pub development: bool, - /// when asset ships data for updating an existing application (HMR) - pub hot_module_replacement: bool, - /// when asset is javascript and an ESM - // pub javascript_module: - /// related object to other assets, keyed by type of relation (only points from parent to child) - pub related: JsAssetInfoRelated, - /// the asset version, emit can be skipped when both filename and version are the same - /// An empty string means no version, it will always emit - pub version: String, -} - -impl From for rspack_core::AssetInfo { - fn from(i: JsAssetInfo) -> Self { - Self { - immutable: i.immutable, - minimized: i.minimized, - development: i.development, - hot_module_replacement: i.hot_module_replacement, - chunk_hash: i.chunk_hash.into_iter().collect(), - related: i.related.into(), - content_hash: i.content_hash.into_iter().collect(), - version: i.version, - } - } -} - -#[napi(object)] -pub struct JsAsset { - pub name: String, - pub source: Option, - pub info: JsAssetInfo, -} - -impl From for JsAssetInfoRelated { - fn from(related: rspack_core::AssetInfoRelated) -> Self { - Self { - source_map: related.source_map, - } - } -} - -impl From for JsAssetInfo { - fn from(info: rspack_core::AssetInfo) -> Self { - Self { - immutable: info.immutable, - minimized: info.minimized, - development: info.development, - hot_module_replacement: info.hot_module_replacement, - related: info.related.into(), - chunk_hash: info.chunk_hash.into_iter().collect(), - content_hash: info.content_hash.into_iter().collect(), - version: info.version, - } - } -} - -#[napi(object)] -pub struct JsAssetEmittedArgs { - pub filename: String, - pub output_path: String, - pub target_path: String, -} - -impl From<&rspack_core::AssetEmittedArgs<'_>> for JsAssetEmittedArgs { - fn from(args: &rspack_core::AssetEmittedArgs) -> Self { - Self { - filename: args.filename.to_string(), - output_path: args.output_path.to_string_lossy().to_string(), - target_path: args.target_path.to_string_lossy().to_string(), - } - } -} diff --git a/crates/node_binding/src/js_values/chunk_group.rs b/crates/node_binding/src/js_values/chunk_group.rs deleted file mode 100644 index 557e72c..0000000 --- a/crates/node_binding/src/js_values/chunk_group.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::js_values::JsChunk; - -#[napi(object)] -pub struct JsChunkGroup { - pub chunks: Vec, -} - -impl JsChunkGroup { - pub fn from_chunk_group( - cg: &rspack_core::ChunkGroup, - compilation: &rspack_core::Compilation, - ) -> Self { - Self { - chunks: cg - .chunks - .iter() - .map(|k| { - JsChunk::from( - compilation.chunk_by_ukey.get(k).unwrap_or_else(|| { - panic!("Could not find Chunk({k:?}) belong to ChunkGroup: {cg:?}",) - }), - ) - }) - .collect(), - } - } -} diff --git a/crates/node_binding/src/js_values/compilation.rs b/crates/node_binding/src/js_values/compilation.rs deleted file mode 100644 index a1203c8..0000000 --- a/crates/node_binding/src/js_values/compilation.rs +++ /dev/null @@ -1,434 +0,0 @@ -use std::collections::HashMap; -use std::path::PathBuf; - -use napi::bindgen_prelude::*; -use napi::NapiRaw; -use rspack_core::rspack_sources::BoxSource; -use rspack_core::AssetInfo; -use rspack_core::ModuleIdentifier; -use rspack_core::{rspack_sources::SourceExt, NormalModuleSource}; -use rspack_error::Diagnostic; -use rspack_identifier::Identifier; -use rspack_napi_shared::NapiResultExt; - -use super::module::ToJsModule; -use super::PathWithInfo; -use crate::utils::callbackify; -use crate::{ - js_values::{chunk::JsChunk, module::JsModule, PathData}, - CompatSource, JsAsset, JsAssetInfo, JsChunkGroup, JsCompatSource, JsStats, ToJsCompatSource, -}; - -#[napi] -pub struct JsCompilation { - inner: &'static mut rspack_core::Compilation, -} - -#[napi] -impl JsCompilation { - #[napi( - ts_args_type = r#"filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)"# - )] - pub fn update_asset( - &mut self, - env: Env, - filename: String, - new_source_or_function: Either, - asset_info_update_or_function: Option>, - ) -> Result<()> { - self - .inner - .update_asset(&filename, |original_source, original_info| { - let new_source: napi::Result = try { - let new_source = match new_source_or_function { - Either::A(new_source) => Into::::into(new_source).boxed(), - Either::B(new_source_fn) => { - let js_source = unsafe { - call_js_function_with_napi_objects!( - env, - new_source_fn, - original_source.to_js_compat_source() - ) - }?; - - let compat_source: CompatSource = unsafe { - convert_raw_napi_value_to_napi_value!(env, JsCompatSource, js_source.raw()) - }? - .into(); - - compat_source.boxed() - } - }; - new_source - }; - let new_source = new_source.into_rspack_result()?; - - let new_info: napi::Result> = asset_info_update_or_function - .map( - |asset_info_update_or_function| match asset_info_update_or_function { - Either::A(asset_info) => Ok(asset_info.into()), - Either::B(asset_info_fn) => { - let asset_info = unsafe { - call_js_function_with_napi_objects!( - env, - asset_info_fn, - Into::::into(original_info.clone()) - ) - }?; - - let js_asset_info = unsafe { - convert_raw_napi_value_to_napi_value!(env, JsAssetInfo, asset_info.raw()) - }?; - Ok(js_asset_info.into()) - } - }, - ) - .transpose(); - let new_info = new_info.into_rspack_result()?; - Ok((new_source, new_info.unwrap_or(original_info))) - }) - .map_err(|err| napi::Error::from_reason(err.to_string())) - } - - #[napi(ts_return_type = "Readonly[]")] - pub fn get_assets(&self) -> Result> { - let mut assets = Vec::::with_capacity(self.inner.assets().len()); - - for (filename, asset) in self.inner.assets() { - assets.push(JsAsset { - name: filename.clone(), - source: asset - .source - .as_ref() - .map(|s| s.to_js_compat_source()) - .transpose()?, - info: asset.info.clone().into(), - }); - } - - Ok(assets) - } - - #[napi] - pub fn get_asset(&self, name: String) -> Result> { - match self.inner.assets().get(&name) { - Some(asset) => Ok(Some(JsAsset { - name, - source: asset - .source - .as_ref() - .map(|s| s.to_js_compat_source()) - .transpose()?, - info: asset.info.clone().into(), - })), - None => Ok(None), - } - } - - #[napi] - pub fn get_asset_source(&self, name: String) -> Result> { - self - .inner - .assets() - .get(&name) - .and_then(|v| v.source.as_ref().map(|s| s.to_js_compat_source())) - .transpose() - } - - #[napi] - pub fn get_modules(&self) -> Vec { - self - .inner - .module_graph - .modules() - .values() - .filter_map(|module| module.to_js_module().ok()) - .collect::>() - } - - #[napi] - pub fn get_chunks(&self) -> Vec { - self - .inner - .chunk_by_ukey - .values() - .map(JsChunk::from) - .collect::>() - } - - #[napi] - pub fn get_named_chunk(&self, name: String) -> Option { - self - .inner - .named_chunks - .get(&name) - .and_then(|c| self.inner.chunk_by_ukey.get(c).map(JsChunk::from)) - } - - #[napi] - /// Only available for those none Js and Css source, - /// return true if set module source successfully, false if failed. - pub fn set_none_ast_module_source( - &mut self, - module_identifier: String, - source: JsCompatSource, - ) -> bool { - match self - .inner - .module_graph - .module_by_identifier_mut(&Identifier::from(module_identifier.as_str())) - { - Some(module) => match module.as_normal_module_mut() { - Some(module) => { - let compat_source = CompatSource::from(source).boxed(); - *module.source_mut() = NormalModuleSource::new_built(compat_source, &[]); - true - } - None => false, - }, - None => false, - } - } - - #[napi] - pub fn set_asset_source(&mut self, name: String, source: JsCompatSource) { - let source = CompatSource::from(source).boxed(); - match self.inner.assets_mut().entry(name) { - std::collections::hash_map::Entry::Occupied(mut e) => e.get_mut().set_source(Some(source)), - std::collections::hash_map::Entry::Vacant(e) => { - e.insert(rspack_core::CompilationAsset::from(source)); - } - }; - } - - #[napi] - pub fn delete_asset_source(&mut self, name: String) { - self - .inner - .assets_mut() - .entry(name) - .and_modify(|a| a.set_source(None)); - } - - #[napi] - pub fn get_asset_filenames(&self) -> Result> { - let filenames = self - .inner - .assets() - .iter() - .filter(|(_, asset)| asset.get_source().is_some()) - .map(|(filename, _)| filename) - .cloned() - .collect(); - Ok(filenames) - } - - #[napi] - pub fn has_asset(&self, name: String) -> Result { - Ok(self.inner.assets().contains_key(&name)) - } - - #[napi] - pub fn emit_asset( - &mut self, - filename: String, - source: JsCompatSource, - asset_info: JsAssetInfo, - ) -> Result<()> { - let compat_source: CompatSource = source.into(); - - self.inner.emit_asset( - filename, - rspack_core::CompilationAsset::new(Some(compat_source.boxed()), asset_info.into()), - ); - - Ok(()) - } - - #[napi] - pub fn delete_asset(&mut self, filename: String) { - self.inner.delete_asset(&filename); - } - - #[napi(getter)] - pub fn entrypoints(&self) -> HashMap { - let entrypoints = self.inner.entrypoints(); - entrypoints - .iter() - .map(|(n, _)| { - ( - n.clone(), - JsChunkGroup::from_chunk_group(self.inner.entrypoint_by_name(n), self.inner), - ) - }) - .collect() - } - - #[napi(getter)] - pub fn hash(&self) -> Option { - self.inner.get_hash().map(|hash| hash.to_owned()) - } - - #[napi] - pub fn get_file_dependencies(&self) -> Vec { - self - .inner - .file_dependencies - .iter() - .map(|i| i.to_string_lossy().to_string()) - .collect() - } - - #[napi] - pub fn get_context_dependencies(&self) -> Vec { - self - .inner - .context_dependencies - .iter() - .map(|i| i.to_string_lossy().to_string()) - .collect() - } - - #[napi] - pub fn get_missing_dependencies(&self) -> Vec { - self - .inner - .missing_dependencies - .iter() - .map(|i| i.to_string_lossy().to_string()) - .collect() - } - - #[napi] - pub fn get_build_dependencies(&self) -> Vec { - self - .inner - .build_dependencies - .iter() - .map(|i| i.to_string_lossy().to_string()) - .collect() - } - - #[napi(ts_args_type = r#"severity: "error" | "warning", title: string, message: string"#)] - pub fn push_diagnostic(&mut self, severity: String, title: String, message: String) { - let diagnostic = match severity.as_str() { - "warning" => rspack_error::Diagnostic::warn(title, message, 0, 0), - _ => rspack_error::Diagnostic::error(title, message, 0, 0), - }; - self.inner.push_diagnostic(diagnostic); - } - - #[napi] - pub fn push_native_diagnostics(&mut self, mut diagnostics: External>) { - while let Some(diagnostic) = diagnostics.pop() { - self.inner.push_diagnostic(diagnostic); - } - } - - #[napi] - pub fn get_stats(&self, reference: Reference, env: Env) -> Result { - Ok(JsStats::new(reference.share_with(env, |compilation| { - Ok(compilation.inner.get_stats()) - })?)) - } - - #[napi] - pub fn get_asset_path(&self, filename: String, data: PathData) -> String { - self.inner.get_asset_path( - &rspack_core::Filename::from(filename), - data.as_core_path_data(), - ) - } - - #[napi] - pub fn get_asset_path_with_info(&self, filename: String, data: PathData) -> PathWithInfo { - self - .inner - .get_asset_path_with_info( - &rspack_core::Filename::from(filename), - data.as_core_path_data(), - ) - .into() - } - - #[napi] - pub fn get_path(&self, filename: String, data: PathData) -> String { - self.inner.get_path( - &rspack_core::Filename::from(filename), - data.as_core_path_data(), - ) - } - - #[napi] - pub fn get_path_with_info(&self, filename: String, data: PathData) -> PathWithInfo { - self - .inner - .get_path_with_info( - &rspack_core::Filename::from(filename), - data.as_core_path_data(), - ) - .into() - } - - #[napi] - pub fn add_file_dependencies(&mut self, deps: Vec) { - self - .inner - .file_dependencies - .extend(deps.into_iter().map(PathBuf::from)) - } - - #[napi] - pub fn add_context_dependencies(&mut self, deps: Vec) { - self - .inner - .context_dependencies - .extend(deps.into_iter().map(PathBuf::from)) - } - - #[napi] - pub fn add_missing_dependencies(&mut self, deps: Vec) { - self - .inner - .missing_dependencies - .extend(deps.into_iter().map(PathBuf::from)) - } - - #[napi] - pub fn add_build_dependencies(&mut self, deps: Vec) { - self - .inner - .build_dependencies - .extend(deps.into_iter().map(PathBuf::from)) - } - - #[napi] - pub fn rebuild_module( - &'static mut self, - env: Env, - module_identifiers: Vec, - f: JsFunction, - ) -> Result<()> { - callbackify(env, f, async { - let modules = self - .inner - .rebuild_module(rustc_hash::FxHashSet::from_iter( - module_identifiers.into_iter().map(ModuleIdentifier::from), - )) - .await - .map_err(|e| Error::new(napi::Status::GenericFailure, format!("{e}")))?; - Ok( - modules - .into_iter() - .filter_map(|item| item.to_js_module().ok()) - .collect::>(), - ) - }) - } -} - -impl JsCompilation { - pub fn from_compilation(inner: &'static mut rspack_core::Compilation) -> Self { - Self { inner } - } -} diff --git a/crates/node_binding/src/js_values/hooks.rs b/crates/node_binding/src/js_values/hooks.rs deleted file mode 100644 index 3a401a5..0000000 --- a/crates/node_binding/src/js_values/hooks.rs +++ /dev/null @@ -1,42 +0,0 @@ -use napi::bindgen_prelude::*; - -#[napi(object)] -pub struct JsHooks { - pub process_assets_stage_additional: JsFunction, - pub process_assets_stage_pre_process: JsFunction, - pub process_assets_stage_derived: JsFunction, - pub process_assets_stage_additions: JsFunction, - pub process_assets_stage_none: JsFunction, - pub process_assets_stage_optimize: JsFunction, - pub process_assets_stage_optimize_count: JsFunction, - pub process_assets_stage_optimize_compatibility: JsFunction, - pub process_assets_stage_optimize_size: JsFunction, - pub process_assets_stage_dev_tooling: JsFunction, - pub process_assets_stage_optimize_inline: JsFunction, - pub process_assets_stage_summarize: JsFunction, - pub process_assets_stage_optimize_hash: JsFunction, - pub process_assets_stage_optimize_transfer: JsFunction, - pub process_assets_stage_analyse: JsFunction, - pub process_assets_stage_report: JsFunction, - pub compilation: JsFunction, - pub this_compilation: JsFunction, - pub emit: JsFunction, - pub asset_emitted: JsFunction, - pub after_emit: JsFunction, - pub make: JsFunction, - pub optimize_modules: JsFunction, - pub optimize_tree: JsFunction, - pub optimize_chunk_module: JsFunction, - pub before_compile: JsFunction, - pub after_compile: JsFunction, - pub finish_modules: JsFunction, - pub finish_make: JsFunction, - pub build_module: JsFunction, - pub before_resolve: JsFunction, - pub after_resolve: JsFunction, - pub context_module_before_resolve: JsFunction, - pub normal_module_factory_resolve_for_scheme: JsFunction, - pub chunk_asset: JsFunction, - pub succeed_module: JsFunction, - pub still_valid_module: JsFunction, -} diff --git a/crates/node_binding/src/js_values/mod.rs b/crates/node_binding/src/js_values/mod.rs deleted file mode 100644 index c2959a4..0000000 --- a/crates/node_binding/src/js_values/mod.rs +++ /dev/null @@ -1,25 +0,0 @@ -mod chunk { - // TODO: should we merge rspack_binding_options and node_binding? - pub use rspack_binding_options::chunk::*; -} - -mod asset; -mod chunk_group; -mod compilation; -mod hooks; -mod module; -mod normal_module_factory; -mod path_data; -mod source; -mod stats; - -pub use asset::*; -pub use chunk::*; -pub use chunk_group::*; -pub use compilation::*; -pub use hooks::*; -pub use module::*; -pub use normal_module_factory::*; -pub use path_data::*; -pub use source::*; -pub use stats::*; diff --git a/crates/node_binding/src/js_values/module.rs b/crates/node_binding/src/js_values/module.rs deleted file mode 100644 index 8ddf315..0000000 --- a/crates/node_binding/src/js_values/module.rs +++ /dev/null @@ -1,37 +0,0 @@ -use napi::bindgen_prelude::*; -use rspack_core::Module; -use rspack_identifier::Identifiable; - -use super::{JsCompatSource, ToJsCompatSource}; - -#[napi(object)] -pub struct JsModule { - pub original_source: Option, - pub resource: String, - pub module_identifier: String, -} - -pub trait ToJsModule { - fn to_js_module(&self) -> Result; -} - -impl ToJsModule for dyn Module + '_ { - fn to_js_module(&self) -> Result { - let original_source = self - .original_source() - .and_then(|source| source.to_js_compat_source().ok()); - self - .try_as_normal_module() - .map(|normal_module| JsModule { - original_source, - - resource: normal_module - .resource_resolved_data() - .resource_path - .to_string_lossy() - .to_string(), - module_identifier: normal_module.identifier().to_string(), - }) - .map_err(|_| napi::Error::from_reason("Failed to convert module to JsModule")) - } -} diff --git a/crates/node_binding/src/js_values/normal_module_factory.rs b/crates/node_binding/src/js_values/normal_module_factory.rs deleted file mode 100644 index feb0296..0000000 --- a/crates/node_binding/src/js_values/normal_module_factory.rs +++ /dev/null @@ -1,105 +0,0 @@ -use rspack_core::{NormalModuleAfterResolveArgs, NormalModuleBeforeResolveArgs, ResourceData}; - -#[napi(object)] -pub struct JsResolveForSchemeInput { - pub resource_data: JsResourceData, - pub scheme: String, -} - -#[napi(object)] -pub struct JsResolveForSchemeResult { - pub resource_data: JsResourceData, - pub stop: bool, -} - -#[napi(object)] -pub struct BeforeResolveData { - pub request: String, - pub context: String, -} - -#[napi(object)] -pub struct AfterResolveData { - pub request: String, - pub context: String, - pub file_dependencies: Vec, - pub context_dependencies: Vec, - pub missing_dependencies: Vec, - pub factory_meta: FactoryMeta, -} - -#[napi(object)] -pub struct FactoryMeta { - pub side_effect_free: Option, -} - -#[napi(object)] -pub struct JsResourceData { - /// Resource with absolute path, query and fragment - pub resource: String, - /// Absolute resource path only - pub path: String, - /// Resource query with `?` prefix - pub query: Option, - /// Resource fragment with `#` prefix - pub fragment: Option, -} - -impl From for JsResourceData { - fn from(value: ResourceData) -> Self { - Self { - resource: value.resource, - path: value.resource_path.to_string_lossy().to_string(), - query: value.resource_query, - fragment: value.resource_fragment, - } - } -} - -impl From for JsResolveForSchemeInput { - fn from(value: ResourceData) -> Self { - Self { - scheme: value.get_scheme().to_string(), - resource_data: value.into(), - } - } -} - -impl From for BeforeResolveData { - fn from(value: NormalModuleBeforeResolveArgs) -> Self { - Self { - context: value.context, - request: value.request, - } - } -} - -impl From> for AfterResolveData { - fn from(value: NormalModuleAfterResolveArgs) -> Self { - Self { - context: value.context.to_owned(), - request: value.request.to_string(), - file_dependencies: value - .file_dependencies - .clone() - .into_iter() - .map(|item| item.to_string_lossy().to_string()) - .collect::>(), - context_dependencies: value - .context_dependencies - .clone() - .into_iter() - .map(|item| item.to_string_lossy().to_string()) - .collect::>(), - missing_dependencies: value - .context_dependencies - .clone() - .into_iter() - .map(|item| item.to_string_lossy().to_string()) - .collect::>(), - factory_meta: FactoryMeta { - side_effect_free: value.factory_meta.side_effect_free, - }, - } - } -} diff --git a/crates/node_binding/src/js_values/path_data.rs b/crates/node_binding/src/js_values/path_data.rs deleted file mode 100644 index 68d5afc..0000000 --- a/crates/node_binding/src/js_values/path_data.rs +++ /dev/null @@ -1,42 +0,0 @@ -use super::JsAssetInfo; - -#[napi(object)] -pub struct PathData { - pub filename: Option, - pub hash: Option, - pub content_hash: Option, - pub runtime: Option, - pub url: Option, - pub id: Option, -} - -impl PathData { - pub fn as_core_path_data(&self) -> rspack_core::PathData { - rspack_core::PathData { - filename: self.filename.as_deref(), - chunk: None, - module: None, - hash: self.hash.as_deref(), - content_hash: self.content_hash.as_deref(), - chunk_graph: None, - runtime: self.runtime.as_deref(), - url: self.url.as_deref(), - id: self.id.as_deref(), - } - } -} - -#[napi(object)] -pub struct PathWithInfo { - pub path: String, - pub info: JsAssetInfo, -} - -impl From<(String, rspack_core::AssetInfo)> for PathWithInfo { - fn from(value: (String, rspack_core::AssetInfo)) -> Self { - Self { - path: value.0, - info: value.1.into(), - } - } -} diff --git a/crates/node_binding/src/js_values/source.rs b/crates/node_binding/src/js_values/source.rs deleted file mode 100644 index 22d972b..0000000 --- a/crates/node_binding/src/js_values/source.rs +++ /dev/null @@ -1,198 +0,0 @@ -use std::{borrow::Cow, hash::Hash, sync::Arc}; - -use napi::bindgen_prelude::*; -use rspack_core::rspack_sources::{ - stream_chunks::{stream_chunks_default, GeneratedInfo, OnChunk, OnName, OnSource, StreamChunks}, - CachedSource, ConcatSource, MapOptions, OriginalSource, RawSource, ReplaceSource, Source, - SourceMap, SourceMapSource, -}; - -#[napi(object)] -pub struct JsCompatSource { - /// Whether the underlying data structure is a `RawSource` - pub is_raw: bool, - /// Whether the underlying value is a buffer or string - pub is_buffer: bool, - pub source: Buffer, - pub map: Option, -} - -#[derive(Debug, Clone, Eq)] -pub struct CompatSource { - pub is_raw: bool, - pub is_buffer: bool, - pub source: Vec, - pub map: Option>, -} - -impl std::hash::Hash for CompatSource { - fn hash(&self, state: &mut H) { - "__CompatSource".hash(state); - self.is_raw.hash(state); - self.is_buffer.hash(state); - self.source.hash(state); - self.map.hash(state); - } -} - -impl PartialEq for CompatSource { - fn eq(&self, other: &Self) -> bool { - self.is_raw == other.is_raw - && self.is_buffer == other.is_buffer - && self.source == other.source - && self.map == other.map - } -} - -impl From for CompatSource { - fn from(source: JsCompatSource) -> Self { - Self { - is_raw: source.is_raw, - is_buffer: source.is_buffer, - source: source.source.into(), - map: source.map.map(Into::into), - } - } -} - -impl StreamChunks for CompatSource { - fn stream_chunks( - &self, - options: &MapOptions, - on_chunk: OnChunk, - on_source: OnSource, - on_name: OnName, - ) -> GeneratedInfo { - stream_chunks_default(self, options, on_chunk, on_source, on_name) - } -} - -impl Source for CompatSource { - fn source(&self) -> Cow { - // Use UTF-8 lossy for any sources, including `RawSource` as a workaround for not supporting either `Buffer` or `String` in `Source`. - String::from_utf8_lossy(&self.source) - } - - fn buffer(&self) -> Cow<[u8]> { - Cow::Borrowed(self.source.as_ref()) - } - - fn size(&self) -> usize { - self.source.len() - } - - fn map(&self, _options: &MapOptions) -> Option { - self - .map - .as_ref() - .and_then(|m| SourceMap::from_slice(m).ok()) - } - - fn to_writer(&self, writer: &mut dyn std::io::Write) -> std::io::Result<()> { - writer.write_all(&self.source) - } -} - -pub trait ToJsCompatSource { - fn to_js_compat_source(&self) -> Result; -} - -impl ToJsCompatSource for RawSource { - fn to_js_compat_source(&self) -> Result { - Ok(JsCompatSource { - is_raw: true, - is_buffer: self.is_buffer(), - source: self.buffer().to_vec().into(), - map: to_webpack_map(self)?, - }) - } -} - -impl ToJsCompatSource for ReplaceSource { - fn to_js_compat_source(&self) -> Result { - Ok(JsCompatSource { - is_raw: false, - is_buffer: false, - source: self.buffer().to_vec().into(), - map: to_webpack_map(self)?, - }) - } -} - -impl ToJsCompatSource for CachedSource { - fn to_js_compat_source(&self) -> Result { - self.original().to_js_compat_source() - } -} - -impl ToJsCompatSource for Arc { - fn to_js_compat_source(&self) -> Result { - (**self).to_js_compat_source() - } -} - -impl ToJsCompatSource for Box { - fn to_js_compat_source(&self) -> Result { - (**self).to_js_compat_source() - } -} - -macro_rules! impl_default_to_compat_source { - ($ident:ident) => { - impl ToJsCompatSource for $ident { - fn to_js_compat_source(&self) -> Result { - Ok(JsCompatSource { - is_raw: false, - is_buffer: false, - source: self.buffer().to_vec().into(), - map: to_webpack_map(self)?, - }) - } - } - }; -} - -impl_default_to_compat_source!(SourceMapSource); -impl_default_to_compat_source!(ConcatSource); -impl_default_to_compat_source!(OriginalSource); - -fn to_webpack_map(source: &dyn Source) -> Result> { - let map = source.map(&MapOptions::default()); - - map - .map(|m| m.to_json().map(|inner| inner.into_bytes().into())) - .transpose() - .map_err(|err| napi::Error::from_reason(err.to_string())) -} - -impl ToJsCompatSource for dyn Source + '_ { - fn to_js_compat_source(&self) -> Result { - if let Some(raw_source) = self.as_any().downcast_ref::() { - raw_source.to_js_compat_source() - } else if let Some(cached_source) = self.as_any().downcast_ref::>() { - cached_source.to_js_compat_source() - } else if let Some(cached_source) = self - .as_any() - .downcast_ref::>>() - { - cached_source.to_js_compat_source() - } else if let Some(cached_source) = self - .as_any() - .downcast_ref::>>() - { - cached_source.to_js_compat_source() - } else if let Some(source) = self.as_any().downcast_ref::>() { - source.to_js_compat_source() - } else if let Some(source) = self.as_any().downcast_ref::>() { - source.to_js_compat_source() - } else { - // If it's not a `RawSource` related type, then we regards it as a `Source` type. - Ok(JsCompatSource { - is_raw: false, - is_buffer: false, - source: self.buffer().to_vec().into(), - map: to_webpack_map(self)?, - }) - } - } -} diff --git a/crates/node_binding/src/js_values/stats.rs b/crates/node_binding/src/js_values/stats.rs deleted file mode 100644 index 26d97f1..0000000 --- a/crates/node_binding/src/js_values/stats.rs +++ /dev/null @@ -1,561 +0,0 @@ -use napi::bindgen_prelude::Buffer; -use napi::{ - bindgen_prelude::{Result, SharedReference}, - Either, -}; -use rspack_core::Stats; - -use super::{JsCompilation, ToJsCompatSource}; - -#[napi(object)] -#[derive(Debug)] -pub struct JsStatsError { - pub message: String, - pub formatted: String, - pub title: String, -} - -impl From for JsStatsError { - fn from(stats: rspack_core::StatsError) -> Self { - Self { - message: stats.message, - formatted: stats.formatted, - title: stats.title, - } - } -} - -#[napi(object)] -pub struct JsStatsWarning { - pub message: String, - pub formatted: String, -} - -impl From for JsStatsWarning { - fn from(stats: rspack_core::StatsWarning) -> Self { - Self { - message: stats.message, - formatted: stats.formatted, - } - } -} - -#[napi(object)] -pub struct JsStatsLogging { - pub name: String, - pub r#type: String, - pub args: Option>, - pub trace: Option>, -} - -impl From<(String, rspack_core::LogType)> for JsStatsLogging { - fn from(value: (String, rspack_core::LogType)) -> Self { - match value.1 { - rspack_core::LogType::Error { message, trace } => Self { - name: value.0, - r#type: "error".to_string(), - args: Some(vec![message]), - trace: Some(trace), - }, - rspack_core::LogType::Warn { message, trace } => Self { - name: value.0, - r#type: "warn".to_string(), - args: Some(vec![message]), - trace: Some(trace), - }, - rspack_core::LogType::Info { message } => Self { - name: value.0, - r#type: "info".to_string(), - args: Some(vec![message]), - trace: None, - }, - rspack_core::LogType::Log { message } => Self { - name: value.0, - r#type: "log".to_string(), - args: Some(vec![message]), - trace: None, - }, - rspack_core::LogType::Debug { message } => Self { - name: value.0, - r#type: "debug".to_string(), - args: Some(vec![message]), - trace: None, - }, - rspack_core::LogType::Trace { message, trace } => Self { - name: value.0, - r#type: "trace".to_string(), - args: Some(vec![message]), - trace: Some(trace), - }, - rspack_core::LogType::Group { message } => Self { - name: value.0, - r#type: "group".to_string(), - args: Some(vec![message]), - trace: None, - }, - rspack_core::LogType::GroupCollapsed { message } => Self { - name: value.0, - r#type: "groupCollapsed".to_string(), - args: Some(vec![message]), - trace: None, - }, - rspack_core::LogType::GroupEnd => Self { - name: value.0, - r#type: "groupEnd".to_string(), - args: None, - trace: None, - }, - rspack_core::LogType::Profile { label } => Self { - name: value.0, - r#type: "profile".to_string(), - args: Some(vec![label.to_string()]), - trace: None, - }, - rspack_core::LogType::ProfileEnd { label } => Self { - name: value.0, - r#type: "profileEnd".to_string(), - args: Some(vec![label.to_string()]), - trace: None, - }, - rspack_core::LogType::Time { - label, - secs, - subsec_nanos, - } => Self { - name: value.0, - r#type: "time".to_string(), - args: Some(vec![format!( - "{}: {} ms", - label, - secs * 1000 + subsec_nanos as u64 / 1000000 - )]), - trace: None, - }, - rspack_core::LogType::Clear => Self { - name: value.0, - r#type: "clear".to_string(), - args: None, - trace: None, - }, - rspack_core::LogType::Status { message } => Self { - name: value.0, - r#type: "status".to_string(), - args: Some(vec![message]), - trace: None, - }, - rspack_core::LogType::Cache { label, hit, total } => Self { - name: value.0, - r#type: "cache".to_string(), - args: Some(vec![format!( - "{}: {:.1}% ({}/{})", - label, - if total == 0 { - 0 as f32 - } else { - hit as f32 / total as f32 * 100_f32 - }, - hit, - total, - )]), - trace: None, - }, - } - } -} - -#[napi(object)] -pub struct JsStatsAsset { - pub r#type: &'static str, - pub name: String, - pub size: f64, - pub chunks: Vec, - pub chunk_names: Vec, - pub info: JsStatsAssetInfo, - pub emitted: bool, -} - -impl From for JsStatsAsset { - fn from(stats: rspack_core::StatsAsset) -> Self { - Self { - r#type: stats.r#type, - name: stats.name, - size: stats.size, - chunks: stats.chunks, - chunk_names: stats.chunk_names, - info: stats.info.into(), - emitted: stats.emitted, - } - } -} - -#[napi(object)] -pub struct JsStatsAssetInfo { - pub development: bool, - pub hot_module_replacement: bool, -} - -impl From for JsStatsAssetInfo { - fn from(stats: rspack_core::StatsAssetInfo) -> Self { - Self { - development: stats.development, - hot_module_replacement: stats.hot_module_replacement, - } - } -} - -type JsStatsModuleSource = Either; -#[napi(object)] -pub struct JsStatsModule { - pub r#type: &'static str, - pub module_type: String, - pub identifier: String, - pub name: String, - pub id: Option, - pub chunks: Vec, - pub size: f64, - pub issuer: Option, - pub issuer_name: Option, - pub issuer_id: Option, - pub issuer_path: Vec, - pub name_for_condition: Option, - pub reasons: Option>, - pub assets: Option>, - pub source: Option>, - pub profile: Option, -} - -impl TryFrom> for JsStatsModule { - type Error = napi::Error; - fn try_from(stats: rspack_core::StatsModule) -> Result { - let source = stats - .source - .map(|source| { - source.to_js_compat_source().map(|js_compat_source| { - if js_compat_source.is_raw && js_compat_source.is_buffer { - JsStatsModuleSource::B(js_compat_source.source) - } else { - let s = String::from_utf8_lossy(js_compat_source.source.as_ref()).to_string(); - JsStatsModuleSource::A(s) - } - }) - }) - .transpose() - .map_err(|e| napi::Error::from_reason(e.to_string()))?; - - Ok(Self { - r#type: stats.r#type, - name: stats.name, - size: stats.size, - chunks: stats.chunks, - module_type: stats.module_type.as_str().to_string(), - identifier: stats.identifier.to_string(), - id: stats.id, - issuer: stats.issuer, - issuer_name: stats.issuer_name, - issuer_id: stats.issuer_id, - name_for_condition: stats.name_for_condition, - issuer_path: stats.issuer_path.into_iter().map(Into::into).collect(), - reasons: stats - .reasons - .map(|i| i.into_iter().map(Into::into).collect()), - assets: stats.assets, - source, - profile: stats.profile.map(|p| p.into()), - }) - } -} - -#[napi(object)] -pub struct JsStatsModuleProfile { - pub factory: JsStatsMillisecond, - pub integration: JsStatsMillisecond, - pub building: JsStatsMillisecond, -} - -impl From for JsStatsModuleProfile { - fn from(value: rspack_core::StatsModuleProfile) -> Self { - Self { - factory: value.factory.into(), - integration: value.integration.into(), - building: value.building.into(), - } - } -} - -#[napi(object)] -pub struct JsStatsMillisecond { - pub secs: u32, - pub subsec_millis: u32, -} - -impl From for JsStatsMillisecond { - fn from(value: rspack_core::StatsMillisecond) -> Self { - Self { - secs: value.secs as u32, - subsec_millis: value.subsec_millis, - } - } -} - -#[napi(object)] -pub struct JsStatsModuleIssuer { - pub identifier: String, - pub name: String, - pub id: Option, -} - -impl From for JsStatsModuleIssuer { - fn from(stats: rspack_core::StatsModuleIssuer) -> Self { - Self { - identifier: stats.identifier, - name: stats.name, - id: stats.id, - } - } -} - -#[napi(object)] -pub struct JsStatsModuleReason { - pub module_identifier: Option, - pub module_name: Option, - pub module_id: Option, - pub r#type: Option, - pub user_request: Option, -} - -impl From for JsStatsModuleReason { - fn from(stats: rspack_core::StatsModuleReason) -> Self { - Self { - module_identifier: stats.module_identifier, - module_name: stats.module_name, - module_id: stats.module_id, - r#type: stats.r#type, - user_request: stats.user_request, - } - } -} - -#[napi(object)] -pub struct JsStatsChunk { - pub r#type: &'static str, - pub files: Vec, - pub auxiliary_files: Vec, - pub id: String, - pub entry: bool, - pub initial: bool, - pub names: Vec, - pub size: f64, - pub modules: Option>, - pub parents: Option>, - pub children: Option>, - pub siblings: Option>, -} - -impl TryFrom> for JsStatsChunk { - type Error = napi::Error; - fn try_from(stats: rspack_core::StatsChunk) -> Result { - Ok(Self { - r#type: stats.r#type, - files: stats.files, - auxiliary_files: stats.auxiliary_files, - id: stats.id, - entry: stats.entry, - initial: stats.initial, - names: stats.names, - size: stats.size, - modules: stats - .modules - .map(|i| i.into_iter().map(|m| m.try_into()).collect::>()) - .transpose()?, - parents: stats.parents, - children: stats.children, - siblings: stats.siblings, - }) - } -} - -#[napi(object)] -pub struct JsStatsChunkGroupAsset { - pub name: String, - pub size: f64, -} - -impl From for JsStatsChunkGroupAsset { - fn from(stats: rspack_core::StatsChunkGroupAsset) -> Self { - Self { - name: stats.name, - size: stats.size, - } - } -} - -#[napi(object)] -pub struct JsStatsChunkGroup { - pub name: String, - pub assets: Vec, - pub chunks: Vec, - pub assets_size: f64, -} - -impl From for JsStatsChunkGroup { - fn from(stats: rspack_core::StatsChunkGroup) -> Self { - Self { - name: stats.name, - assets: stats.assets.into_iter().map(Into::into).collect(), - chunks: stats.chunks, - assets_size: stats.assets_size, - } - } -} - -#[napi(object)] -pub struct JsStatsAssetsByChunkName { - pub name: String, - pub files: Vec, -} - -impl From for JsStatsAssetsByChunkName { - fn from(stats: rspack_core::StatsAssetsByChunkName) -> Self { - Self { - name: stats.name, - files: stats.files, - } - } -} - -#[napi] -pub struct JsStats { - inner: SharedReference>, -} - -impl JsStats { - pub fn new(inner: SharedReference>) -> Self { - Self { inner } - } -} - -#[napi(object)] -pub struct JsStatsGetAssets { - pub assets: Vec, - pub assets_by_chunk_name: Vec, -} - -#[napi] -impl JsStats { - #[napi] - pub fn get_assets(&self) -> JsStatsGetAssets { - let (assets, assets_by_chunk_name) = self.inner.get_assets(); - let assets = assets.into_iter().map(Into::into).collect(); - let assets_by_chunk_name = assets_by_chunk_name.into_iter().map(Into::into).collect(); - JsStatsGetAssets { - assets, - assets_by_chunk_name, - } - } - - #[napi] - pub fn get_modules( - &self, - reasons: bool, - module_assets: bool, - nested_modules: bool, - source: bool, - ) -> Result> { - self - .inner - .get_modules(reasons, module_assets, nested_modules, source) - .map_err(|e| napi::Error::from_reason(e.to_string()))? - .into_iter() - .map(TryInto::try_into) - .collect() - } - - #[napi] - pub fn get_chunks( - &self, - chunk_modules: bool, - chunks_relations: bool, - reasons: bool, - module_assets: bool, - nested_modules: bool, - source: bool, - ) -> Result> { - self - .inner - .get_chunks( - chunk_modules, - chunks_relations, - reasons, - module_assets, - nested_modules, - source, - ) - .map_err(|e| napi::Error::from_reason(e.to_string()))? - .into_iter() - .map(TryInto::try_into) - .collect() - } - - #[napi] - pub fn get_entrypoints(&self) -> Vec { - self - .inner - .get_entrypoints() - .into_iter() - .map(Into::into) - .collect() - } - - #[napi] - pub fn get_named_chunk_groups(&self) -> Vec { - self - .inner - .get_named_chunk_groups() - .into_iter() - .map(Into::into) - .collect() - } - - #[napi] - pub fn get_errors(&self) -> Vec { - self - .inner - .get_errors() - .into_iter() - .map(Into::into) - .collect() - } - - #[napi] - pub fn get_warnings(&self) -> Vec { - self - .inner - .get_warnings() - .into_iter() - .map(Into::into) - .collect() - } - - #[napi] - pub fn get_logging(&self, accepted_types: u32) -> Vec { - self - .inner - .get_logging() - .into_iter() - .filter(|log| { - let bit = log.1.to_bit_flag(); - accepted_types & bit == bit - }) - .map(Into::into) - .collect() - } - - #[napi(catch_unwind)] - pub fn get_hash(&self) -> String { - self - .inner - .get_hash() - .expect("should have hash in stats::get_hash") - .to_string() - } -} diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index b3c9180..c6be2e5 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -4,9 +4,6 @@ #[macro_use] extern crate napi_derive; -#[macro_use] -extern crate rspack_binding_macros; - use std::collections::HashSet; use std::pin::Pin; use std::sync::atomic::{AtomicU32, Ordering}; @@ -14,28 +11,25 @@ use std::sync::Mutex; use napi::bindgen_prelude::*; use once_cell::sync::Lazy; +use rspack_binding_options::BuiltinPlugin; use binding_options::RSPackRawOptions; +use rspack_binding_values::SingleThreadedHashMap; use rspack_core::PluginExt; use rspack_fs_node::{AsyncNodeWritableFileSystem, ThreadsafeNodeFS}; use rspack_napi_shared::NAPI_ENV; mod hook; -mod js_values; mod loader; mod plugins; -mod utils; use hook::*; -use js_values::*; - // Napi macro registered this successfully #[allow(unused)] -use loader::*; +use loader::run_builtin_loader; use plugins::*; use rspack_binding_options::*; +use rspack_binding_values::*; use rspack_tracing::chrome::FlushGuard; -use utils::*; - #[cfg(not(target_os = "linux"))] #[global_allocator] static GLOBAL: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc; @@ -280,7 +274,9 @@ pub fn cleanup_global_trace() { let mut state = GLOBAL_TRACE_STATE .lock() .expect("Failed to lock GLOBAL_TRACE_STATE"); - if let TraceState::On(guard) = &mut *state && let Some(g) = guard.take() { + if let TraceState::On(guard) = &mut *state + && let Some(g) = guard.take() + { g.flush(); drop(g); let new_state = TraceState::Off; diff --git a/crates/node_binding/src/loader.rs b/crates/node_binding/src/loader.rs index 03eb3b9..cc28833 100644 --- a/crates/node_binding/src/loader.rs +++ b/crates/node_binding/src/loader.rs @@ -1,6 +1,5 @@ use napi::Result; use rspack_binding_options::JsLoaderContext; -use binding_options::run_builtin_loader as run_builtin; /// Builtin loader runner #[napi(catch_unwind)] @@ -10,5 +9,5 @@ pub async fn run_builtin_loader( options: Option, loader_context: JsLoaderContext, ) -> Result { - run_builtin(builtin, options.as_deref(), loader_context).await + binding_options::run_builtin_loader(builtin, options.as_deref(), loader_context).await } diff --git a/crates/node_binding/src/plugins/mod.rs b/crates/node_binding/src/plugins/mod.rs index 619404e..0086057 100644 --- a/crates/node_binding/src/plugins/mod.rs +++ b/crates/node_binding/src/plugins/mod.rs @@ -6,6 +6,10 @@ use async_trait::async_trait; pub use loader::JsLoaderResolver; use napi::{Env, Result}; use rspack_binding_macros::js_fn_into_threadsafe_fn; +use rspack_binding_values::{ + AfterResolveData, BeforeResolveData, JsAssetEmittedArgs, JsChunkAssetArgs, JsModule, + JsResolveForSchemeInput, JsResolveForSchemeResult, ToJsModule, +}; use rspack_core::{ ChunkAssetArgs, NormalModuleAfterResolveArgs, NormalModuleBeforeResolveArgs, PluginNormalModuleFactoryAfterResolveOutput, PluginNormalModuleFactoryBeforeResolveOutput, @@ -15,10 +19,6 @@ use rspack_error::internal_error; use rspack_napi_shared::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode}; use rspack_napi_shared::NapiResultExt; -use crate::js_values::{ - AfterResolveData, BeforeResolveData, JsAssetEmittedArgs, JsChunkAssetArgs, JsModule, - JsResolveForSchemeInput, JsResolveForSchemeResult, ToJsModule, -}; use crate::{DisabledHooks, Hook, JsCompilation, JsHooks}; pub struct JsHooksAdapter { @@ -714,13 +714,12 @@ impl rspack_core::Plugin for JsHooksAdapter { if self.is_hook_disabled(&Hook::SucceedModule) { return Ok(()); } - + let js_module = args + .to_js_module() + .expect("Failed to convert module to JsModule"); self .succeed_module_tsfn - .call( - args.to_js_module().expect("Convert to js_module failed."), - ThreadsafeFunctionCallMode::NonBlocking, - ) + .call(js_module, ThreadsafeFunctionCallMode::NonBlocking) .into_rspack_result()? .await .map_err(|err| internal_error!("Failed to call succeed_module hook: {err}"))? diff --git a/crates/node_binding/src/utils.rs b/crates/node_binding/src/utils.rs deleted file mode 100644 index 4e1104a..0000000 --- a/crates/node_binding/src/utils.rs +++ /dev/null @@ -1,203 +0,0 @@ -use std::ffi::CStr; -use std::io::Write; -use std::ptr; - -use dashmap::DashMap; -use futures::Future; -use napi::bindgen_prelude::*; -use napi::{check_status, Env, Error, JsFunction, JsUnknown, NapiRaw, Result}; -use rspack_error::CatchUnwindFuture; -use rspack_napi_shared::threadsafe_function::{ - ThreadSafeContext, ThreadsafeFunction, ThreadsafeFunctionCallMode, -}; - -/// Try to resolve the string value of a given named property -#[allow(unused)] -pub(crate) fn get_named_property_value_string( - env: Env, - object: T, - property_name: &str, -) -> Result { - let mut bytes_with_nul: Vec = Vec::with_capacity(property_name.len() + 1); - - write!(&mut bytes_with_nul, "{property_name}")?; - write!(&mut bytes_with_nul, "\0")?; - - let mut value_ptr = ptr::null_mut(); - - check_status!( - unsafe { - napi_sys::napi_get_named_property( - env.raw(), - object.raw(), - CStr::from_bytes_with_nul_unchecked(&bytes_with_nul).as_ptr(), - &mut value_ptr, - ) - }, - "failed to get the value" - )?; - - let mut str_len = 0; - check_status!( - unsafe { - napi_sys::napi_get_value_string_utf8(env.raw(), value_ptr, ptr::null_mut(), 0, &mut str_len) - }, - "failed to get the value" - )?; - - str_len += 1; - let mut buf = Vec::with_capacity(str_len); - let mut copied_len = 0; - - check_status!( - unsafe { - napi_sys::napi_get_value_string_utf8( - env.raw(), - value_ptr, - buf.as_mut_ptr(), - str_len, - &mut copied_len, - ) - }, - "failed to get the value" - )?; - - // Vec -> Vec See: https://stackoverflow.com/questions/59707349/cast-vector-of-i8-to-vector-of-u8-in-rust - let mut buf = std::mem::ManuallyDrop::new(buf); - - let buf = unsafe { Vec::from_raw_parts(buf.as_mut_ptr() as *mut u8, copied_len, copied_len) }; - - String::from_utf8(buf).map_err(|_| Error::from_reason("failed to get property")) -} - -pub fn callbackify(env: Env, f: JsFunction, fut: F) -> Result<()> -where - R: 'static + ToNapiValue, - F: 'static + Send + Future>, -{ - let ptr = unsafe { f.raw() }; - - let tsfn = ThreadsafeFunction::, ()>::create(env.raw(), ptr, 0, |ctx| { - let ThreadSafeContext { - value, - env, - callback, - .. - } = ctx; - - let argv = match value { - Ok(value) => { - let val = unsafe { R::to_napi_value(env.raw(), value)? }; - let js_value = unsafe { JsUnknown::from_napi_value(env.raw(), val)? }; - vec![env.get_null()?.into_unknown(), js_value] - } - Err(err) => { - vec![JsError::from(err).into_unknown(env)] - } - }; - - callback.call(None, &argv)?; - - Ok(()) - })?; - - napi::bindgen_prelude::spawn(async move { - let fut = CatchUnwindFuture::create(fut); - let res = fut.await; - match res { - Ok(result) => { - tsfn - .call(result, ThreadsafeFunctionCallMode::NonBlocking) - .expect("Failed to call JS callback"); - } - Err(e) => { - tsfn - .call( - Err(Error::from_reason(format!("{e}"))), - ThreadsafeFunctionCallMode::NonBlocking, - ) - .expect("Failed to send panic info"); - } - } - }); - - Ok(()) -} - -// **Note** that Node's main thread and the worker thread share the same binding context. Using `Mutex` would cause deadlocks if multiple compilers exist. -pub(crate) struct SingleThreadedHashMap(DashMap); - -impl SingleThreadedHashMap -where - K: Eq + std::hash::Hash + std::fmt::Display, -{ - /// Acquire a mutable reference to the inner hashmap. - /// - /// Safety: Mutable reference can almost let you do anything you want, this is intended to be used from the thread where the map was created. - pub(crate) unsafe fn borrow_mut(&self, key: &K, f: F) -> Result - where - F: FnOnce(&mut V) -> Result, - { - let mut inner = self.0.get_mut(key).ok_or_else(|| { - napi::Error::from_reason(format!( - "Failed to find key {key} for single-threaded hashmap", - )) - })?; - - f(&mut inner) - } - - /// Acquire a shared reference to the inner hashmap. - /// - /// Safety: It's not thread-safe if a value is not safe to modify cross thread boundary, so this is intended to be used from the thread where the map was created. - #[allow(unused)] - pub(crate) unsafe fn borrow(&self, key: &K, f: F) -> Result - where - F: FnOnce(&V) -> Result, - { - let inner = self.0.get(key).ok_or_else(|| { - napi::Error::from_reason(format!( - "Failed to find key {key} for single-threaded hashmap", - )) - })?; - - f(&*inner) - } - - /// Insert a value into the map. - /// - /// Safety: It's not thread-safe if a value has thread affinity, so this is intended to be used from the thread where the map was created. - pub(crate) unsafe fn insert_if_vacant(&self, key: K, value: V) -> Result<()> { - if let dashmap::mapref::entry::Entry::Vacant(vacant) = self.0.entry(key) { - vacant.insert(value); - Ok(()) - } else { - Err(napi::Error::from_reason( - "Failed to insert on single-threaded hashmap as it's not vacant", - )) - } - } - - /// Remove a value from the map. - /// - /// See: [DashMap::remove] for more details. https://docs.rs/dashmap/latest/dashmap/struct.DashMap.html#method.remove - /// - /// Safety: It's not thread-safe if a value has thread affinity, so this is intended to be used from the thread where the map was created. - #[allow(unused)] - pub(crate) unsafe fn remove(&self, key: &K) -> Option { - self.0.remove(key).map(|(_, v)| v) - } -} - -impl Default for SingleThreadedHashMap -where - K: Eq + std::hash::Hash, -{ - fn default() -> Self { - Self(Default::default()) - } -} - -// Safety: Methods are already marked as unsafe. -unsafe impl Send for SingleThreadedHashMap {} -unsafe impl Sync for SingleThreadedHashMap {} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index bf354c4..51177fb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,5 @@ [toolchain] profile = "default" -channel = "nightly-2023-06-02" +# Use nightly for better access to the latest Rust features. +# This date is aligned to stable release dates. +channel = "nightly-2023-10-24" From 78e8b832aea7ae46fc0b32e8d742258e710efe3c Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Tue, 28 Nov 2023 13:59:16 +0800 Subject: [PATCH 16/18] fix: loader index --- crates/loader_compilation/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index 2ad1e23..ff2e4ce 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -163,7 +163,7 @@ impl Loader for CompilationLoader { // If swc-loader is the latest loader available, // then loader produces AST, which could be used as an optimization. - if loader_context.loader_index() == 1 + if loader_context.loader_index() == 0 && (loader_context .current_loader() .composed_index_by_identifier(&self.identifier) From 746b8d2efd57b3a554f82d3f0a96f59d84d7f9b5 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Wed, 29 Nov 2023 15:30:55 +0800 Subject: [PATCH 17/18] fix: simplify loader config (#15) * fix: simplify loader config * chore: fix test case * fix: built-in options --- Cargo.lock | 1 + crates/loader_compilation/Cargo.toml | 1 + crates/loader_compilation/src/lib.rs | 46 +++++++++++++++++-- .../loader_compilation/src/transform/mod.rs | 25 +++------- crates/loader_compilation/tests/fixtures.rs | 5 +- 5 files changed, 54 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6133446..ba40dc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1483,6 +1483,7 @@ dependencies = [ "rspack_error", "rspack_loader_runner", "rspack_plugin_javascript", + "rspack_regex", "rspack_testing", "serde", "serde_json", diff --git a/crates/loader_compilation/Cargo.toml b/crates/loader_compilation/Cargo.toml index c252936..46e8ced 100644 --- a/crates/loader_compilation/Cargo.toml +++ b/crates/loader_compilation/Cargo.toml @@ -18,6 +18,7 @@ rspack_core = { path = "../.rspack_crates/rspack_core" } rspack_error = { path = "../.rspack_crates/rspack_error" } rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" } rspack_plugin_javascript = { path = "../.rspack_crates/rspack_plugin_javascript" } +rspack_regex = { path = "../.rspack_crates/rspack_regex" } regex = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = "1.0.100" diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index ff2e4ce..5bcb3c9 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -6,12 +6,18 @@ use rspack_loader_runner::{Identifiable, Identifier, Loader, LoaderContext}; use rspack_error::{ internal_error, Result, Diagnostic, }; -use swc_core::{base::config::{InputSourceMap, Options, OutputCharset, Config, TransformConfig}, ecma::transforms::react::Runtime}; +use swc_core::{ + base::config::{InputSourceMap, Options, OutputCharset, Config, TransformConfig}, + ecma::parser::{Syntax, TsConfig}, +}; + +use swc_config::{config_types::MergingOption, merge::Merge}; use rspack_plugin_javascript::{ ast::{self, SourceMapConfig}, TransformOutput, }; use serde::Deserialize; +use rspack_regex::RspackRegex; mod compiler; mod transform; @@ -19,16 +25,25 @@ mod transform; use transform::*; use compiler::{SwcCompiler, IntoJsAst}; +#[derive(Debug, Default, Deserialize)] +#[serde(rename_all = "camelCase", default)] +pub struct CompileRules { + // Built-in rules to exclude files from compilation, such as react, react-dom, etc. + exclude: Option>, +} + #[derive(Debug, Default, Deserialize)] #[serde(rename_all = "camelCase", default)] pub struct LoaderOptions { pub swc_options: Config, pub transform_features: TransformFeatureOptions, + pub compile_rules: CompileRules, } pub struct CompilationOptions { swc_options: Options, transform_features: TransformFeatureOptions, + compile_rules: CompileRules, } pub struct CompilationLoader { identifier: Identifier, @@ -39,13 +54,15 @@ pub const COMPILATION_LOADER_IDENTIFIER: &str = "builtin:compilation-loader"; impl From for CompilationOptions { fn from(value: LoaderOptions) -> Self { - let transform_features = TransformFeatureOptions::default(); + let transform_features = value.transform_features; + let compile_rules = value.compile_rules; CompilationOptions { swc_options: Options { config: value.swc_options, ..Default::default() }, transform_features, + compile_rules, } } } @@ -74,6 +91,17 @@ lazy_static! { impl Loader for CompilationLoader { async fn run(&self, loader_context: &mut LoaderContext<'_, LoaderRunnerContext>) -> Result<()> { let resource_path = loader_context.resource_path.to_path_buf(); + + if self.loader_options.compile_rules.exclude.is_some() { + let exclude = self.loader_options.compile_rules.exclude.as_ref().unwrap(); + for pattern in exclude { + let pattern = RspackRegex::new(pattern).unwrap(); + if pattern.test(&resource_path.to_string_lossy()) { + return Ok(()); + } + } + } + let Some(content) = std::mem::take(&mut loader_context.content) else { return Err(internal_error!("No content found")); }; @@ -84,7 +112,17 @@ impl Loader for CompilationLoader { let mut transform = TransformConfig::default(); let default_development = matches!(loader_context.context.options.mode, Mode::Development); transform.react.development = Some(default_development); - transform.react.runtime = Some(Runtime::Automatic); + swc_options + .config + .jsc + .transform + .merge(MergingOption::from(Some(transform))); + } + + let file_extension = resource_path.extension().unwrap(); + let ts_extensions = vec!["tsx", "ts", "mts"]; + if ts_extensions.iter().any(|ext| ext == &file_extension) { + swc_options.config.jsc.syntax = Some(Syntax::Typescript(TsConfig { tsx: true, decorators: true, ..Default::default() })); } if let Some(pre_source_map) = std::mem::take(&mut loader_context.source_map) { @@ -133,7 +171,7 @@ impl Loader for CompilationLoader { } } file_access.insert(resource_path.to_string_lossy().to_string(), true); - + let built = compiler.parse(None, |_| { transform( &resource_path, diff --git a/crates/loader_compilation/src/transform/mod.rs b/crates/loader_compilation/src/transform/mod.rs index ff2a10b..9bc09dd 100644 --- a/crates/loader_compilation/src/transform/mod.rs +++ b/crates/loader_compilation/src/transform/mod.rs @@ -80,24 +80,11 @@ fn match_app_entry(resource_path: &Path) -> bool { regex_for_app.is_match(resource_path_str) } -#[derive(Default, Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase", default)] -pub struct KeepExportOptions { - pub export_names: Vec, -} - -#[derive(Default, Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase", default)] -pub struct RemoveExportOptions { - pub remove_names: Vec, -} - - #[derive(Debug, Default, Deserialize)] #[serde(rename_all = "camelCase", default)] pub struct TransformFeatureOptions { - pub keep_export: Option, - pub remove_export: Option, + pub keep_export: Option>, + pub remove_export: Option>, } pub(crate) fn transform<'a>( @@ -106,8 +93,8 @@ pub(crate) fn transform<'a>( feature_options: &TransformFeatureOptions, ) -> impl Fold + 'a { chain!( - either!(feature_options.keep_export, |options: &KeepExportOptions| { - let mut exports_name = options.export_names.clone(); + either!(feature_options.keep_export, |options: &Vec| { + let mut exports_name = options.clone(); // Special case for app entry. // When keep pageConfig, we should also keep the default export of app entry. if match_app_entry(resource_path) && exports_name.contains(&String::from("pageConfig")) { @@ -117,8 +104,8 @@ pub(crate) fn transform<'a>( }, || { match_app_entry(resource_path) || match_route_entry(resource_path, routes_config) }), - either!(feature_options.remove_export, |options: &RemoveExportOptions| { - remove_export(options.remove_names.clone()) + either!(feature_options.remove_export, |options: &Vec| { + remove_export(options.clone()) }, || { // Remove export only work for app entry and route entry. match_app_entry(resource_path) || match_route_entry(resource_path, routes_config) diff --git a/crates/loader_compilation/tests/fixtures.rs b/crates/loader_compilation/tests/fixtures.rs index 2a4597a..ae7386a 100644 --- a/crates/loader_compilation/tests/fixtures.rs +++ b/crates/loader_compilation/tests/fixtures.rs @@ -3,7 +3,7 @@ use loader_compilation::{CompilationLoader, LoaderOptions}; use rspack_core::{ run_loaders, CompilerContext, CompilerOptions, Loader, LoaderRunnerContext, ResourceData, SideEffectOption, }; -use swc_core::base::config::{PluginConfig, Config}; +use swc_core::base::config::Config; async fn loader_test(actual: impl AsRef, expected: impl AsRef) { let tests_path = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"))).join("tests"); @@ -16,10 +16,13 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { &[Arc::new(CompilationLoader::new(LoaderOptions { swc_options: options, transform_features: Default::default(), + compile_rules: Default::default(), })) as Arc>], &ResourceData::new(actual_path.to_string_lossy().to_string(), actual_path), &[], CompilerContext { + module: None, + module_context: None, options: std::sync::Arc::new(CompilerOptions { context: rspack_core::Context::new(parent_path.to_string_lossy().to_string()), dev_server: rspack_core::DevServerOptions::default(), From 3ef40f2cc23eff73738263c4015fbd82d3c27de4 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 30 Nov 2023 14:16:59 +0800 Subject: [PATCH 18/18] chore: push built-in plugins (#16) * chore: push built-in plugins * chore: add default plugin --- crates/binding_options/Cargo.toml | 1 + crates/binding_options/src/options/mod.rs | 3 +++ crates/plugin_manifest/src/plugin.rs | 7 +------ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/binding_options/Cargo.toml b/crates/binding_options/Cargo.toml index a0a45e8..5163393 100644 --- a/crates/binding_options/Cargo.toml +++ b/crates/binding_options/Cargo.toml @@ -48,6 +48,7 @@ rspack_hash = { path = "../.rspack_crates/rspack_has rspack_swc_visitors = { path = "../.rspack_crates/rspack_swc_visitors" } loader_compilation = { path = "../loader_compilation" } plugin_manifest = { path = "../plugin_manifest" } +## plugin_specilize_module_name = { path = "../plugin_specilize_module_name" } futures-util = { workspace = true } anyhow = { workspace = true, features = ["backtrace"] } diff --git a/crates/binding_options/src/options/mod.rs b/crates/binding_options/src/options/mod.rs index 2d8a912..b7b24d4 100644 --- a/crates/binding_options/src/options/mod.rs +++ b/crates/binding_options/src/options/mod.rs @@ -164,6 +164,9 @@ impl RawOptionsApply for RSPackRawOptions { plugins.push(rspack_plugin_warn_sensitive_module::WarnCaseSensitiveModulesPlugin.boxed()); + // Add custom plugins. + plugins.push(plugin_manifest::ManifestPlugin::new().boxed()); + Ok(Self::Options { context, mode, diff --git a/crates/plugin_manifest/src/plugin.rs b/crates/plugin_manifest/src/plugin.rs index 8bbde27..c2e6cab 100644 --- a/crates/plugin_manifest/src/plugin.rs +++ b/crates/plugin_manifest/src/plugin.rs @@ -91,13 +91,8 @@ impl Plugin for ManifestPlugin { } }); let json_string = serde_json::to_string(&assets_mainfest).unwrap(); - let output_path = compilation - .options - .output - .path - .join("assets-manifest.json".to_string()).to_string_lossy().to_string(); compilation.emit_asset( - output_path, + "assets-manifest.json".to_string(), CompilationAsset::from(RawSource::from(json_string).boxed()), ); Ok(())