├── .cargo └── config.toml ├── .gitattributes ├── .github ├── actions │ └── pnpm │ │ └── action.yml └── workflows │ └── ci.yml ├── .gitignore ├── .npmignore ├── .nvmrc ├── .taplo.toml ├── .vscode └── settings.json ├── .yarnrc.yml ├── Cargo.lock ├── Cargo.toml ├── README.md ├── build.rs ├── index.d.ts ├── index.js ├── package.json ├── pnpm-lock.yaml ├── rustfmt.toml ├── src ├── lib.rs └── transform │ ├── mod.rs │ ├── react_server_action.rs │ └── validate.rs ├── tests └── index.unit.ts └── tsconfig.json /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.aarch64-unknown-linux-musl] 2 | linker = "aarch64-linux-musl-gcc" 3 | rustflags = ["-C", "target-feature=-crt-static"] 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | 5 | *.ts text eol=lf merge=union 6 | *.tsx text eol=lf merge=union 7 | *.rs text eol=lf merge=union 8 | *.js text eol=lf merge=union 9 | *.json text eol=lf merge=union 10 | *.debug text eol=lf merge=union 11 | 12 | # Generated codes 13 | index.js linguist-detectable=false 14 | index.d.ts linguist-detectable=false 15 | -------------------------------------------------------------------------------- /.github/actions/pnpm/action.yml: -------------------------------------------------------------------------------- 1 | name: Pnpm 2 | 3 | description: Install pnpm 4 | 5 | runs: 6 | using: composite 7 | steps: 8 | - uses: pnpm/action-setup@v4 9 | 10 | - uses: actions/setup-node@v4 11 | with: 12 | node-version-file: .nvmrc 13 | cache: pnpm 14 | 15 | - run: pnpm install 16 | shell: bash 17 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | env: 3 | DEBUG: napi:* 4 | APP_NAME: react-server-action 5 | MACOSX_DEPLOYMENT_TARGET: '10.13' 6 | CC: clang 7 | CARGO_INCREMENTAL: '1' 8 | permissions: 9 | contents: write 10 | id-token: write 11 | 'on': 12 | push: 13 | branches: 14 | - main 15 | tags-ignore: 16 | - '**' 17 | paths-ignore: 18 | - '**/*.md' 19 | - LICENSE 20 | - '**/*.gitignore' 21 | - .editorconfig 22 | - docs/** 23 | pull_request: null 24 | concurrency: 25 | group: ${{ github.workflow }}-${{ github.ref }} 26 | cancel-in-progress: true 27 | jobs: 28 | build: 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | settings: 33 | - host: macos-latest 34 | target: x86_64-apple-darwin 35 | build: pnpm build --target x86_64-apple-darwin 36 | - host: windows-latest 37 | build: pnpm build --target x86_64-pc-windows-msvc 38 | target: x86_64-pc-windows-msvc 39 | - host: windows-latest 40 | build: pnpm build --target i686-pc-windows-msvc 41 | target: i686-pc-windows-msvc 42 | - host: ubuntu-latest 43 | target: x86_64-unknown-linux-gnu 44 | build: pnpm build --target x86_64-unknown-linux-gnu --use-napi-cross 45 | - host: ubuntu-latest 46 | target: x86_64-unknown-linux-musl 47 | build: pnpm build --target x86_64-unknown-linux-musl -x 48 | - host: macos-14 49 | target: aarch64-apple-darwin 50 | build: pnpm build --target aarch64-apple-darwin 51 | - host: ubuntu-latest 52 | target: aarch64-unknown-linux-gnu 53 | build: pnpm build --target aarch64-unknown-linux-gnu --use-napi-cross 54 | - host: ubuntu-latest 55 | target: armv7-unknown-linux-gnueabihf 56 | build: pnpm build --target armv7-unknown-linux-gnueabihf --use-napi-cross 57 | - host: ubuntu-latest 58 | target: aarch64-linux-android 59 | build: pnpm build --target aarch64-linux-android 60 | - host: ubuntu-latest 61 | target: armv7-linux-androideabi 62 | build: pnpm build --target armv7-linux-androideabi 63 | - host: ubuntu-latest 64 | target: aarch64-unknown-linux-musl 65 | build: pnpm build --target aarch64-unknown-linux-musl -x 66 | - host: windows-latest 67 | target: aarch64-pc-windows-msvc 68 | build: pnpm build --target aarch64-pc-windows-msvc 69 | # - host: ubuntu-latest 70 | # target: wasm32-wasip1-threads 71 | # build: pnpm build --target wasm32-wasip1-threads 72 | name: stable - ${{ matrix.settings.target }} - node@20 73 | runs-on: ${{ matrix.settings.host }} 74 | steps: 75 | - uses: actions/checkout@v4 76 | - name: setup pnpm 77 | uses: pnpm/action-setup@v4 78 | - name: Setup node 79 | uses: actions/setup-node@v4 80 | with: 81 | node-version: 20 82 | cache: pnpm 83 | - name: Install 84 | uses: dtolnay/rust-toolchain@stable 85 | with: 86 | toolchain: stable 87 | targets: ${{ matrix.settings.target }} 88 | - name: Cache cargo 89 | uses: actions/cache@v4 90 | with: 91 | path: | 92 | ~/.cargo/registry/index/ 93 | ~/.cargo/registry/cache/ 94 | ~/.cargo/git/db/ 95 | ~/.napi-rs 96 | .cargo-cache 97 | target/ 98 | key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} 99 | - uses: goto-bus-stop/setup-zig@v2 100 | if: ${{ contains(matrix.settings.target, 'musl') }} 101 | with: 102 | version: 0.13.0 103 | - name: Setup toolchain 104 | run: ${{ matrix.settings.setup }} 105 | if: ${{ matrix.settings.setup }} 106 | shell: bash 107 | - name: Install dependencies 108 | run: pnpm install 109 | - name: Setup node x86 110 | uses: actions/setup-node@v4 111 | if: matrix.settings.target == 'i686-pc-windows-msvc' 112 | with: 113 | node-version: 20 114 | cache: pnpm 115 | architecture: x86 116 | - name: Build 117 | run: ${{ matrix.settings.build }} 118 | shell: bash 119 | - name: Upload artifact 120 | uses: actions/upload-artifact@v4 121 | with: 122 | name: bindings-${{ matrix.settings.target }} 123 | path: | 124 | ./*.node 125 | ./*.wasm 126 | if-no-files-found: error 127 | test-macOS-windows-binding: 128 | name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} 129 | needs: 130 | - build 131 | strategy: 132 | fail-fast: false 133 | matrix: 134 | settings: 135 | - host: windows-latest 136 | target: x86_64-pc-windows-msvc 137 | architecture: x64 138 | - host: macos-latest 139 | target: x86_64-apple-darwin 140 | architecture: x64 141 | - host: macos-latest 142 | target: aarch64-apple-darwin 143 | architecture: arm64 144 | node: 145 | - '18' 146 | - '20' 147 | runs-on: ${{ matrix.settings.host }} 148 | steps: 149 | - uses: actions/checkout@v4 150 | - name: setup pnpm 151 | uses: pnpm/action-setup@v4 152 | - name: Setup node 153 | uses: actions/setup-node@v4 154 | with: 155 | node-version: ${{ matrix.node }} 156 | cache: pnpm 157 | architecture: ${{ matrix.settings.architecture }} 158 | - name: Install dependencies 159 | run: pnpm install 160 | - name: Download artifacts 161 | uses: actions/download-artifact@v4 162 | with: 163 | name: bindings-${{ matrix.settings.target }} 164 | path: . 165 | - name: List packages 166 | run: ls -R . 167 | shell: bash 168 | - name: Test bindings 169 | run: pnpm test 170 | test-linux-binding: 171 | name: Test ${{ matrix.target }} - node@${{ matrix.node }} 172 | needs: 173 | - build 174 | strategy: 175 | fail-fast: false 176 | matrix: 177 | target: 178 | - x86_64-unknown-linux-gnu 179 | - x86_64-unknown-linux-musl 180 | - aarch64-unknown-linux-gnu 181 | - aarch64-unknown-linux-musl 182 | - armv7-unknown-linux-gnueabihf 183 | node: 184 | - '18' 185 | - '20' 186 | runs-on: ubuntu-latest 187 | steps: 188 | - uses: actions/checkout@v4 189 | - name: setup pnpm 190 | uses: pnpm/action-setup@v4 191 | - name: Setup node 192 | uses: actions/setup-node@v4 193 | with: 194 | node-version: ${{ matrix.node }} 195 | cache: pnpm 196 | - name: Output docker params 197 | id: docker 198 | run: | 199 | node -e " 200 | if ('${{ matrix.target }}'.startsWith('aarch64')) { 201 | console.log('PLATFORM=linux/arm64') 202 | } else if ('${{ matrix.target }}'.startsWith('armv7')) { 203 | console.log('PLATFORM=linux/arm/v7') 204 | } else { 205 | console.log('PLATFORM=linux/amd64') 206 | } 207 | " >> $GITHUB_OUTPUT 208 | node -e " 209 | if ('${{ matrix.target }}'.endsWith('-musl')) { 210 | console.log('IMAGE=node:${{ matrix.node }}-alpine') 211 | } else { 212 | console.log('IMAGE=node:${{ matrix.node }}-slim') 213 | } 214 | " >> $GITHUB_OUTPUT 215 | echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT 216 | # use --force to download the all platform/arch dependencies 217 | - name: Install dependencies 218 | run: pnpm install --force 219 | - name: Download artifacts 220 | uses: actions/download-artifact@v4 221 | with: 222 | name: bindings-${{ matrix.target }} 223 | path: . 224 | - name: List packages 225 | run: ls -R . 226 | shell: bash 227 | - name: Set up QEMU 228 | uses: docker/setup-qemu-action@v3 229 | with: 230 | platforms: all 231 | - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes 232 | - name: Test bindings 233 | uses: addnab/docker-run-action@v3 234 | with: 235 | image: ${{ steps.docker.outputs.IMAGE }} 236 | options: -v ${{ steps.docker.outputs.PNPM_STORE_PATH }}:${{ steps.docker.outputs.PNPM_STORE_PATH }} -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }} 237 | run: corepack enable && npm run test 238 | # test-wasi: 239 | # name: Test WASI target 240 | # if: false 241 | # needs: 242 | # - build 243 | # runs-on: ubuntu-latest 244 | # steps: 245 | # - uses: actions/checkout@v4 246 | # - name: setup pnpm 247 | # uses: pnpm/action-setup@v4 248 | # - name: Setup node 249 | # uses: actions/setup-node@v4 250 | # with: 251 | # node-version: 20 252 | # cache: pnpm 253 | # - name: Install dependencies 254 | # run: pnpm install 255 | # - name: Download artifacts 256 | # uses: actions/download-artifact@v4 257 | # with: 258 | # name: bindings-wasm32-wasip1-threads 259 | # path: ./packages/core 260 | # - name: List packages 261 | # run: ls -R . 262 | # shell: bash 263 | # - name: Test bindings 264 | # run: pnpm test 265 | # env: 266 | # NAPI_RS_FORCE_WASI: 1 267 | publish: 268 | name: Publish 269 | runs-on: ubuntu-latest 270 | needs: 271 | - test-macOS-windows-binding 272 | - test-linux-binding 273 | # - test-wasi 274 | steps: 275 | - uses: actions/checkout@v4 276 | - name: setup pnpm 277 | uses: pnpm/action-setup@v4 278 | - name: Setup node 279 | uses: actions/setup-node@v4 280 | with: 281 | node-version: 20 282 | cache: pnpm 283 | - name: Install dependencies 284 | run: pnpm install 285 | - name: Download all artifacts 286 | uses: actions/download-artifact@v4 287 | with: 288 | path: artifacts 289 | - name: create npm dirs 290 | run: | 291 | pnpm napi create-npm-dirs 292 | pnpm napi artifacts 293 | - name: List packages 294 | run: ls -R ./npm 295 | shell: bash 296 | - name: Publish 297 | run: | 298 | echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc 299 | npm config set provenance true 300 | if git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$"; 301 | then 302 | pnpm napi pre-publish -t npm 303 | pnpm publish --access public --no-git-check 304 | elif git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+"; 305 | then 306 | pnpm napi pre-publish -t npm 307 | pnpm publish --tag next --access public --no-git-check 308 | else 309 | echo "Not a release, skipping publish" 310 | fi 311 | env: 312 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 313 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .yarn/* 2 | !.yarn/patches 3 | !.yarn/plugins 4 | !.yarn/releases 5 | !.yarn/sdks 6 | !.yarn/versions 7 | 8 | # Swap the comments on the following lines if you wish to use zero-installs 9 | # In that case, don't forget to run `yarn config set enableGlobalCache false`! 10 | # Documentation here: https://yarnpkg.com/features/caching#zero-installs 11 | 12 | #!.yarn/cache 13 | .pnp.* 14 | 15 | 16 | ### Created by https://www.gitignore.io 17 | ### Node ### 18 | # Logs 19 | logs 20 | *.log 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | lerna-debug.log* 25 | .pnpm-debug.log* 26 | 27 | # Diagnostic reports (https://nodejs.org/api/report.html) 28 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 29 | 30 | # Runtime data 31 | pids 32 | *.pid 33 | *.seed 34 | *.pid.lock 35 | 36 | # Directory for instrumented libs generated by jscoverage/JSCover 37 | lib-cov 38 | 39 | # Coverage directory used by tools like istanbul 40 | coverage 41 | *.lcov 42 | 43 | # nyc test coverage 44 | .nyc_output 45 | 46 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 47 | .grunt 48 | 49 | # Bower dependency directory (https://bower.io/) 50 | bower_components 51 | 52 | # node-waf configuration 53 | .lock-wscript 54 | 55 | # Compiled binary addons (https://nodejs.org/api/addons.html) 56 | build/Release 57 | 58 | # Dependency directories 59 | node_modules/ 60 | jspm_packages/ 61 | 62 | # Snowpack dependency directory (https://snowpack.dev/) 63 | web_modules/ 64 | 65 | # TypeScript cache 66 | *.tsbuildinfo 67 | 68 | # Optional npm cache directory 69 | .npm 70 | 71 | # Optional eslint cache 72 | .eslintcache 73 | 74 | # Optional stylelint cache 75 | .stylelintcache 76 | 77 | # Microbundle cache 78 | .rpt2_cache/ 79 | .rts2_cache_cjs/ 80 | .rts2_cache_es/ 81 | .rts2_cache_umd/ 82 | 83 | # Optional REPL history 84 | .node_repl_history 85 | 86 | # Output of 'npm pack' 87 | *.tgz 88 | 89 | # Yarn Integrity file 90 | .yarn-integrity 91 | 92 | # dotenv environment variable files 93 | .env 94 | .env.development.local 95 | .env.test.local 96 | .env.production.local 97 | .env.local 98 | 99 | # parcel-bundler cache (https://parceljs.org/) 100 | .cache 101 | .parcel-cache 102 | 103 | # Next.js build output 104 | .next 105 | out 106 | 107 | # Nuxt.js build / generate output 108 | .nuxt 109 | dist 110 | 111 | # Gatsby files 112 | .cache/ 113 | # Comment in the public line in if your project uses Gatsby and not Next.js 114 | # https://nextjs.org/blog/next-9-1#public-directory-support 115 | # public 116 | 117 | # vuepress build output 118 | .vuepress/dist 119 | 120 | # vuepress v2.x temp and cache directory 121 | .temp 122 | .cache 123 | 124 | # Docusaurus cache and generated files 125 | .docusaurus 126 | 127 | # Serverless directories 128 | .serverless/ 129 | 130 | # FuseBox cache 131 | .fusebox/ 132 | 133 | # DynamoDB Local files 134 | .dynamodb/ 135 | 136 | # TernJS port file 137 | .tern-port 138 | 139 | # Stores VSCode versions used for testing VSCode extensions 140 | .vscode-test 141 | 142 | # yarn v2 143 | .yarn/cache 144 | .yarn/unplugged 145 | .yarn/build-state.yml 146 | .yarn/install-state.gz 147 | .pnp.* 148 | 149 | ### Node Patch ### 150 | # Serverless Webpack directories 151 | .webpack/ 152 | 153 | # Optional stylelint cache 154 | .stylelintcache 155 | 156 | # SvelteKit build / generate output 157 | .svelte-kit 158 | 159 | 160 | 161 | ### Created by https://www.gitignore.io 162 | ### macOS ### 163 | # General 164 | .DS_Store 165 | .AppleDouble 166 | .LSOverride 167 | 168 | # Icon must end with two \r 169 | Icon 170 | 171 | # Thumbnails 172 | ._* 173 | 174 | # Files that might appear in the root of a volume 175 | .DocumentRevisions-V100 176 | .fseventsd 177 | .Spotlight-V100 178 | .TemporaryItems 179 | .Trashes 180 | .VolumeIcon.icns 181 | .com.apple.timemachine.donotpresent 182 | 183 | # Directories potentially created on remote AFP share 184 | .AppleDB 185 | .AppleDesktop 186 | Network Trash Folder 187 | Temporary Items 188 | .apdisk 189 | 190 | ### macOS Patch ### 191 | # iCloud generated files 192 | *.icloud 193 | 194 | 195 | 196 | ### Created by https://www.gitignore.io 197 | ### Windows ### 198 | # Windows thumbnail cache files 199 | Thumbs.db 200 | Thumbs.db:encryptable 201 | ehthumbs.db 202 | ehthumbs_vista.db 203 | 204 | # Dump file 205 | *.stackdump 206 | 207 | # Folder config file 208 | [Dd]esktop.ini 209 | 210 | # Recycle Bin used on file shares 211 | $RECYCLE.BIN/ 212 | 213 | # Windows Installer files 214 | *.cab 215 | *.msi 216 | *.msix 217 | *.msm 218 | *.msp 219 | 220 | # Windows shortcuts 221 | *.lnk 222 | 223 | 224 | 225 | ### Created by https://www.gitignore.io 226 | ### Rust ### 227 | # Generated by Cargo 228 | # will have compiled files and executables 229 | debug/ 230 | target/ 231 | 232 | # These are backup files generated by rustfmt 233 | **/*.rs.bk 234 | 235 | # MSVC Windows builds of rustc generate these, which store debugging information 236 | *.pdb 237 | 238 | *.node 239 | *.wasm 240 | pgo-data 241 | npm 242 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | target 2 | Cargo.lock 3 | .cargo 4 | .github 5 | npm 6 | .eslintrc 7 | .prettierignore 8 | rustfmt.toml 9 | yarn.lock 10 | *.node 11 | .yarn 12 | __test__ 13 | renovate.json 14 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /.taplo.toml: -------------------------------------------------------------------------------- 1 | exclude = ["node_modules/**/*.toml"] 2 | 3 | # https://taplo.tamasfe.dev/configuration/formatter-options.html 4 | [formatting] 5 | align_entries = true 6 | indent_tables = true 7 | reorder_keys = true 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // Disable the default formatter, use eslint instead 3 | "prettier.enable": false, 4 | "editor.formatOnSave": false, 5 | 6 | // Auto fix 7 | "editor.codeActionsOnSave": { 8 | "source.fixAll.eslint": "explicit", 9 | "source.organizeImports": "never" 10 | }, 11 | 12 | // Silent the stylistic rules in you IDE, but still auto fix them 13 | "eslint.rules.customizations": [ 14 | { "rule": "style/*", "severity": "off" }, 15 | { "rule": "format/*", "severity": "off" }, 16 | { "rule": "*-indent", "severity": "off" }, 17 | { "rule": "*-spacing", "severity": "off" }, 18 | { "rule": "*-spaces", "severity": "off" }, 19 | { "rule": "*-order", "severity": "off" }, 20 | { "rule": "*-dangle", "severity": "off" }, 21 | { "rule": "*-newline", "severity": "off" }, 22 | { "rule": "*quotes", "severity": "off" }, 23 | { "rule": "*semi", "severity": "off" } 24 | ], 25 | 26 | // Enable eslint for all supported languages 27 | "eslint.validate": [ 28 | "javascript", 29 | "javascriptreact", 30 | "typescript", 31 | "typescriptreact", 32 | "vue", 33 | "html", 34 | "markdown", 35 | "json", 36 | "jsonc", 37 | "yaml", 38 | "toml", 39 | "xml", 40 | "gql", 41 | "graphql", 42 | "astro", 43 | "css", 44 | "less", 45 | "scss", 46 | "pcss", 47 | "postcss" 48 | ], 49 | // Disable the default formatter, use eslint instead 50 | "prettier.enable": false, 51 | "editor.formatOnSave": false, 52 | 53 | // Auto fix 54 | "editor.codeActionsOnSave": { 55 | "source.fixAll.eslint": "explicit", 56 | "source.organizeImports": "never" 57 | }, 58 | 59 | // Silent the stylistic rules in you IDE, but still auto fix them 60 | "eslint.rules.customizations": [ 61 | { "rule": "style/*", "severity": "off" }, 62 | { "rule": "format/*", "severity": "off" }, 63 | { "rule": "*-indent", "severity": "off" }, 64 | { "rule": "*-spacing", "severity": "off" }, 65 | { "rule": "*-spaces", "severity": "off" }, 66 | { "rule": "*-order", "severity": "off" }, 67 | { "rule": "*-dangle", "severity": "off" }, 68 | { "rule": "*-newline", "severity": "off" }, 69 | { "rule": "*quotes", "severity": "off" }, 70 | { "rule": "*semi", "severity": "off" } 71 | ], 72 | 73 | // Enable eslint for all supported languages 74 | "eslint.validate": [ 75 | "javascript", 76 | "javascriptreact", 77 | "typescript", 78 | "typescriptreact", 79 | "vue", 80 | "html", 81 | "markdown", 82 | "json", 83 | "jsonc", 84 | "yaml", 85 | "toml", 86 | "xml", 87 | "gql", 88 | "graphql", 89 | "astro", 90 | "css", 91 | "less", 92 | "scss", 93 | "pcss", 94 | "postcss" 95 | ] 96 | } 97 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.22.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.3" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "allocator-api2" 31 | version = "0.2.18" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" 34 | 35 | [[package]] 36 | name = "assert-unchecked" 37 | version = "0.1.2" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "7330592adf847ee2e3513587b4db2db410a0d751378654e7e993d9adcbe5c795" 40 | 41 | [[package]] 42 | name = "autocfg" 43 | version = "1.3.0" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 46 | 47 | [[package]] 48 | name = "backtrace" 49 | version = "0.3.73" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" 52 | dependencies = [ 53 | "addr2line", 54 | "cc", 55 | "cfg-if", 56 | "libc", 57 | "miniz_oxide", 58 | "object", 59 | "rustc-demangle", 60 | ] 61 | 62 | [[package]] 63 | name = "base64-simd" 64 | version = "0.8.0" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" 67 | dependencies = [ 68 | "outref", 69 | "vsimd", 70 | ] 71 | 72 | [[package]] 73 | name = "bitflags" 74 | version = "2.6.0" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 77 | 78 | [[package]] 79 | name = "block-buffer" 80 | version = "0.10.4" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 83 | dependencies = [ 84 | "generic-array", 85 | ] 86 | 87 | [[package]] 88 | name = "bumpalo" 89 | version = "3.16.0" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 92 | dependencies = [ 93 | "allocator-api2", 94 | ] 95 | 96 | [[package]] 97 | name = "castaway" 98 | version = "0.2.2" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" 101 | dependencies = [ 102 | "rustversion", 103 | ] 104 | 105 | [[package]] 106 | name = "cc" 107 | version = "1.0.101" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "ac367972e516d45567c7eafc73d24e1c193dcf200a8d94e9db7b3d38b349572d" 110 | 111 | [[package]] 112 | name = "cfg-if" 113 | version = "1.0.0" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 116 | 117 | [[package]] 118 | name = "compact_str" 119 | version = "0.7.1" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" 122 | dependencies = [ 123 | "castaway", 124 | "cfg-if", 125 | "itoa", 126 | "ryu", 127 | "static_assertions", 128 | ] 129 | 130 | [[package]] 131 | name = "convert_case" 132 | version = "0.6.0" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" 135 | dependencies = [ 136 | "unicode-segmentation", 137 | ] 138 | 139 | [[package]] 140 | name = "cpufeatures" 141 | version = "0.2.12" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" 144 | dependencies = [ 145 | "libc", 146 | ] 147 | 148 | [[package]] 149 | name = "crypto-common" 150 | version = "0.1.6" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 153 | dependencies = [ 154 | "generic-array", 155 | "typenum", 156 | ] 157 | 158 | [[package]] 159 | name = "ctor" 160 | version = "0.2.8" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" 163 | dependencies = [ 164 | "quote", 165 | "syn", 166 | ] 167 | 168 | [[package]] 169 | name = "daachorse" 170 | version = "1.0.0" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "63b7ef7a4be509357f4804d0a22e830daddb48f19fd604e4ad32ddce04a94c36" 173 | 174 | [[package]] 175 | name = "dashmap" 176 | version = "5.5.3" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" 179 | dependencies = [ 180 | "cfg-if", 181 | "hashbrown", 182 | "lock_api", 183 | "once_cell", 184 | "parking_lot_core", 185 | ] 186 | 187 | [[package]] 188 | name = "digest" 189 | version = "0.10.7" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 192 | dependencies = [ 193 | "block-buffer", 194 | "crypto-common", 195 | ] 196 | 197 | [[package]] 198 | name = "either" 199 | version = "1.13.0" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" 202 | 203 | [[package]] 204 | name = "equivalent" 205 | version = "1.0.1" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 208 | 209 | [[package]] 210 | name = "fixedbitset" 211 | version = "0.4.2" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" 214 | 215 | [[package]] 216 | name = "futures" 217 | version = "0.3.30" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" 220 | dependencies = [ 221 | "futures-channel", 222 | "futures-core", 223 | "futures-executor", 224 | "futures-io", 225 | "futures-sink", 226 | "futures-task", 227 | "futures-util", 228 | ] 229 | 230 | [[package]] 231 | name = "futures-channel" 232 | version = "0.3.30" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" 235 | dependencies = [ 236 | "futures-core", 237 | "futures-sink", 238 | ] 239 | 240 | [[package]] 241 | name = "futures-core" 242 | version = "0.3.30" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" 245 | 246 | [[package]] 247 | name = "futures-executor" 248 | version = "0.3.30" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" 251 | dependencies = [ 252 | "futures-core", 253 | "futures-task", 254 | "futures-util", 255 | ] 256 | 257 | [[package]] 258 | name = "futures-io" 259 | version = "0.3.30" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" 262 | 263 | [[package]] 264 | name = "futures-macro" 265 | version = "0.3.30" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" 268 | dependencies = [ 269 | "proc-macro2", 270 | "quote", 271 | "syn", 272 | ] 273 | 274 | [[package]] 275 | name = "futures-sink" 276 | version = "0.3.30" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" 279 | 280 | [[package]] 281 | name = "futures-task" 282 | version = "0.3.30" 283 | source = "registry+https://github.com/rust-lang/crates.io-index" 284 | checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" 285 | 286 | [[package]] 287 | name = "futures-util" 288 | version = "0.3.30" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" 291 | dependencies = [ 292 | "futures-channel", 293 | "futures-core", 294 | "futures-io", 295 | "futures-macro", 296 | "futures-sink", 297 | "futures-task", 298 | "memchr", 299 | "pin-project-lite", 300 | "pin-utils", 301 | "slab", 302 | ] 303 | 304 | [[package]] 305 | name = "generic-array" 306 | version = "0.14.7" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 309 | dependencies = [ 310 | "typenum", 311 | "version_check", 312 | ] 313 | 314 | [[package]] 315 | name = "gimli" 316 | version = "0.29.0" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" 319 | 320 | [[package]] 321 | name = "hashbrown" 322 | version = "0.14.5" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" 325 | 326 | [[package]] 327 | name = "hermit-abi" 328 | version = "0.3.9" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 331 | 332 | [[package]] 333 | name = "hex" 334 | version = "0.4.3" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 337 | 338 | [[package]] 339 | name = "indexmap" 340 | version = "2.2.6" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" 343 | dependencies = [ 344 | "equivalent", 345 | "hashbrown", 346 | ] 347 | 348 | [[package]] 349 | name = "itertools" 350 | version = "0.13.0" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" 353 | dependencies = [ 354 | "either", 355 | ] 356 | 357 | [[package]] 358 | name = "itoa" 359 | version = "1.0.11" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 362 | 363 | [[package]] 364 | name = "libc" 365 | version = "0.2.155" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" 368 | 369 | [[package]] 370 | name = "libloading" 371 | version = "0.8.4" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" 374 | dependencies = [ 375 | "cfg-if", 376 | "windows-targets", 377 | ] 378 | 379 | [[package]] 380 | name = "lock_api" 381 | version = "0.4.12" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 384 | dependencies = [ 385 | "autocfg", 386 | "scopeguard", 387 | ] 388 | 389 | [[package]] 390 | name = "memchr" 391 | version = "2.7.4" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 394 | 395 | [[package]] 396 | name = "miette" 397 | version = "7.2.0" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" 400 | dependencies = [ 401 | "cfg-if", 402 | "miette-derive", 403 | "owo-colors", 404 | "textwrap", 405 | "thiserror", 406 | "unicode-width", 407 | ] 408 | 409 | [[package]] 410 | name = "miette-derive" 411 | version = "7.2.0" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" 414 | dependencies = [ 415 | "proc-macro2", 416 | "quote", 417 | "syn", 418 | ] 419 | 420 | [[package]] 421 | name = "miniz_oxide" 422 | version = "0.7.4" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" 425 | dependencies = [ 426 | "adler", 427 | ] 428 | 429 | [[package]] 430 | name = "napi" 431 | version = "2.16.8" 432 | source = "registry+https://github.com/rust-lang/crates.io-index" 433 | checksum = "a1bd081bbaef43600fd2c5dd4c525b8ecea7dfdacf40ebc674e87851dce6559e" 434 | dependencies = [ 435 | "bitflags", 436 | "ctor", 437 | "napi-derive", 438 | "napi-sys", 439 | "once_cell", 440 | "tokio", 441 | ] 442 | 443 | [[package]] 444 | name = "napi-build" 445 | version = "2.1.3" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a" 448 | 449 | [[package]] 450 | name = "napi-derive" 451 | version = "2.16.6" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "70a8a778fd367b13c64232e58632514b795514ece491ce136d96e976d34a3eb8" 454 | dependencies = [ 455 | "cfg-if", 456 | "convert_case", 457 | "napi-derive-backend", 458 | "proc-macro2", 459 | "quote", 460 | "syn", 461 | ] 462 | 463 | [[package]] 464 | name = "napi-derive-backend" 465 | version = "1.0.68" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "35849e64596ecd467e1ac897153364a1ffd09b1d79b32ebad94ef8980ac73311" 468 | dependencies = [ 469 | "convert_case", 470 | "once_cell", 471 | "proc-macro2", 472 | "quote", 473 | "regex", 474 | "semver", 475 | "syn", 476 | ] 477 | 478 | [[package]] 479 | name = "napi-sys" 480 | version = "2.4.0" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3" 483 | dependencies = [ 484 | "libloading", 485 | ] 486 | 487 | [[package]] 488 | name = "num-bigint" 489 | version = "0.4.6" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" 492 | dependencies = [ 493 | "num-integer", 494 | "num-traits", 495 | ] 496 | 497 | [[package]] 498 | name = "num-integer" 499 | version = "0.1.46" 500 | source = "registry+https://github.com/rust-lang/crates.io-index" 501 | checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" 502 | dependencies = [ 503 | "num-traits", 504 | ] 505 | 506 | [[package]] 507 | name = "num-traits" 508 | version = "0.2.19" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 511 | dependencies = [ 512 | "autocfg", 513 | ] 514 | 515 | [[package]] 516 | name = "num_cpus" 517 | version = "1.16.0" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 520 | dependencies = [ 521 | "hermit-abi", 522 | "libc", 523 | ] 524 | 525 | [[package]] 526 | name = "object" 527 | version = "0.36.0" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" 530 | dependencies = [ 531 | "memchr", 532 | ] 533 | 534 | [[package]] 535 | name = "once_cell" 536 | version = "1.19.0" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 539 | 540 | [[package]] 541 | name = "outref" 542 | version = "0.5.1" 543 | source = "registry+https://github.com/rust-lang/crates.io-index" 544 | checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" 545 | 546 | [[package]] 547 | name = "owo-colors" 548 | version = "4.0.0" 549 | source = "registry+https://github.com/rust-lang/crates.io-index" 550 | checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" 551 | 552 | [[package]] 553 | name = "oxc_allocator" 554 | version = "0.16.2" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | checksum = "7dddfd4b859f51fe4b91fafd847e136cc21dfab7cec75513f0427ce4d39f614e" 557 | dependencies = [ 558 | "allocator-api2", 559 | "bumpalo", 560 | ] 561 | 562 | [[package]] 563 | name = "oxc_ast" 564 | version = "0.16.2" 565 | source = "registry+https://github.com/rust-lang/crates.io-index" 566 | checksum = "4011133166ab3e57960f26d42ab56dbe9a3fdd20e279bc54c581ad8b9344d585" 567 | dependencies = [ 568 | "bitflags", 569 | "num-bigint", 570 | "oxc_allocator", 571 | "oxc_ast_macros", 572 | "oxc_span", 573 | "oxc_syntax", 574 | ] 575 | 576 | [[package]] 577 | name = "oxc_ast_macros" 578 | version = "0.16.2" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "2cd2e54fe624598fa53806e3d092942f3b11078d9cc29a470e4b5907acf40f2e" 581 | 582 | [[package]] 583 | name = "oxc_cfg" 584 | version = "0.16.2" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "26cb08113a16bbd659bff818b5f8bb9fcc66446df3d48de59263d2cfc09eee69" 587 | dependencies = [ 588 | "bitflags", 589 | "itertools", 590 | "oxc_syntax", 591 | "petgraph", 592 | "rustc-hash", 593 | ] 594 | 595 | [[package]] 596 | name = "oxc_codegen" 597 | version = "0.16.2" 598 | source = "registry+https://github.com/rust-lang/crates.io-index" 599 | checksum = "89ef42afe89122fb8a51febf41d1892602d0600f12ffde5eed1488b1cad060fc" 600 | dependencies = [ 601 | "bitflags", 602 | "daachorse", 603 | "once_cell", 604 | "oxc_allocator", 605 | "oxc_ast", 606 | "oxc_sourcemap", 607 | "oxc_span", 608 | "oxc_syntax", 609 | "rustc-hash", 610 | ] 611 | 612 | [[package]] 613 | name = "oxc_diagnostics" 614 | version = "0.16.2" 615 | source = "registry+https://github.com/rust-lang/crates.io-index" 616 | checksum = "1e27d66ffd8bdc032d7a2d918e25ee91a6aa5ef7d712d624bac1c77e6b8e6870" 617 | dependencies = [ 618 | "miette", 619 | "owo-colors", 620 | "textwrap", 621 | "unicode-width", 622 | ] 623 | 624 | [[package]] 625 | name = "oxc_index" 626 | version = "0.16.2" 627 | source = "registry+https://github.com/rust-lang/crates.io-index" 628 | checksum = "939fd785d887b25e802ae35fbcc6f6ad3ccf648eeefb98c801dab47047c2d281" 629 | 630 | [[package]] 631 | name = "oxc_parser" 632 | version = "0.16.2" 633 | source = "registry+https://github.com/rust-lang/crates.io-index" 634 | checksum = "30a2874be11c32e1dd214bb5ad7a7ae7bca3597e9fc27e633b463f0d7c59ab6f" 635 | dependencies = [ 636 | "assert-unchecked", 637 | "bitflags", 638 | "memchr", 639 | "num-bigint", 640 | "num-traits", 641 | "oxc_allocator", 642 | "oxc_ast", 643 | "oxc_diagnostics", 644 | "oxc_span", 645 | "oxc_syntax", 646 | "rustc-hash", 647 | "seq-macro", 648 | ] 649 | 650 | [[package]] 651 | name = "oxc_semantic" 652 | version = "0.16.2" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "8fc57199f03ee5705ae99dd87366ec9c9a6cd863f0d59774064d88782a0db677" 655 | dependencies = [ 656 | "indexmap", 657 | "itertools", 658 | "oxc_allocator", 659 | "oxc_ast", 660 | "oxc_cfg", 661 | "oxc_diagnostics", 662 | "oxc_index", 663 | "oxc_span", 664 | "oxc_syntax", 665 | "phf", 666 | "rustc-hash", 667 | ] 668 | 669 | [[package]] 670 | name = "oxc_sourcemap" 671 | version = "0.16.2" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "3cf897f8c79442fd1d26da5864456975bf176adc8ca9c1d608e53916069f9a02" 674 | dependencies = [ 675 | "base64-simd", 676 | "cfg-if", 677 | "rustc-hash", 678 | "serde", 679 | "serde_json", 680 | ] 681 | 682 | [[package]] 683 | name = "oxc_span" 684 | version = "0.16.2" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "d55012e4e027cb6b91bfc9047c248d3464300b96355b432583882dd50fa85cbe" 687 | dependencies = [ 688 | "compact_str", 689 | "miette", 690 | ] 691 | 692 | [[package]] 693 | name = "oxc_syntax" 694 | version = "0.16.2" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "cb47ffa16b13d3e08115653aa72c87a982c8d4d248033cc8b3edf5aeec6aa131" 697 | dependencies = [ 698 | "bitflags", 699 | "dashmap", 700 | "oxc_index", 701 | "oxc_span", 702 | "phf", 703 | "rustc-hash", 704 | "unicode-id-start", 705 | ] 706 | 707 | [[package]] 708 | name = "parking_lot_core" 709 | version = "0.9.10" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 712 | dependencies = [ 713 | "cfg-if", 714 | "libc", 715 | "redox_syscall", 716 | "smallvec", 717 | "windows-targets", 718 | ] 719 | 720 | [[package]] 721 | name = "petgraph" 722 | version = "0.6.5" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" 725 | dependencies = [ 726 | "fixedbitset", 727 | "indexmap", 728 | ] 729 | 730 | [[package]] 731 | name = "phf" 732 | version = "0.11.2" 733 | source = "registry+https://github.com/rust-lang/crates.io-index" 734 | checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" 735 | dependencies = [ 736 | "phf_macros", 737 | "phf_shared", 738 | ] 739 | 740 | [[package]] 741 | name = "phf_generator" 742 | version = "0.11.2" 743 | source = "registry+https://github.com/rust-lang/crates.io-index" 744 | checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" 745 | dependencies = [ 746 | "phf_shared", 747 | "rand", 748 | ] 749 | 750 | [[package]] 751 | name = "phf_macros" 752 | version = "0.11.2" 753 | source = "registry+https://github.com/rust-lang/crates.io-index" 754 | checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" 755 | dependencies = [ 756 | "phf_generator", 757 | "phf_shared", 758 | "proc-macro2", 759 | "quote", 760 | "syn", 761 | ] 762 | 763 | [[package]] 764 | name = "phf_shared" 765 | version = "0.11.2" 766 | source = "registry+https://github.com/rust-lang/crates.io-index" 767 | checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" 768 | dependencies = [ 769 | "siphasher", 770 | ] 771 | 772 | [[package]] 773 | name = "pin-project-lite" 774 | version = "0.2.14" 775 | source = "registry+https://github.com/rust-lang/crates.io-index" 776 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" 777 | 778 | [[package]] 779 | name = "pin-utils" 780 | version = "0.1.0" 781 | source = "registry+https://github.com/rust-lang/crates.io-index" 782 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 783 | 784 | [[package]] 785 | name = "proc-macro2" 786 | version = "1.0.86" 787 | source = "registry+https://github.com/rust-lang/crates.io-index" 788 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 789 | dependencies = [ 790 | "unicode-ident", 791 | ] 792 | 793 | [[package]] 794 | name = "quote" 795 | version = "1.0.36" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 798 | dependencies = [ 799 | "proc-macro2", 800 | ] 801 | 802 | [[package]] 803 | name = "rand" 804 | version = "0.8.5" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 807 | dependencies = [ 808 | "rand_core", 809 | ] 810 | 811 | [[package]] 812 | name = "rand_core" 813 | version = "0.6.4" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 816 | 817 | [[package]] 818 | name = "react-server-action" 819 | version = "0.0.0" 820 | dependencies = [ 821 | "futures", 822 | "hex", 823 | "napi", 824 | "napi-build", 825 | "napi-derive", 826 | "oxc_allocator", 827 | "oxc_ast", 828 | "oxc_codegen", 829 | "oxc_diagnostics", 830 | "oxc_parser", 831 | "oxc_semantic", 832 | "oxc_span", 833 | "oxc_syntax", 834 | "serde_json", 835 | "sha1", 836 | "tokio", 837 | ] 838 | 839 | [[package]] 840 | name = "redox_syscall" 841 | version = "0.5.2" 842 | source = "registry+https://github.com/rust-lang/crates.io-index" 843 | checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" 844 | dependencies = [ 845 | "bitflags", 846 | ] 847 | 848 | [[package]] 849 | name = "regex" 850 | version = "1.10.5" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" 853 | dependencies = [ 854 | "aho-corasick", 855 | "memchr", 856 | "regex-automata", 857 | "regex-syntax", 858 | ] 859 | 860 | [[package]] 861 | name = "regex-automata" 862 | version = "0.4.7" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" 865 | dependencies = [ 866 | "aho-corasick", 867 | "memchr", 868 | "regex-syntax", 869 | ] 870 | 871 | [[package]] 872 | name = "regex-syntax" 873 | version = "0.8.4" 874 | source = "registry+https://github.com/rust-lang/crates.io-index" 875 | checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" 876 | 877 | [[package]] 878 | name = "rustc-demangle" 879 | version = "0.1.24" 880 | source = "registry+https://github.com/rust-lang/crates.io-index" 881 | checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 882 | 883 | [[package]] 884 | name = "rustc-hash" 885 | version = "2.0.0" 886 | source = "registry+https://github.com/rust-lang/crates.io-index" 887 | checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" 888 | 889 | [[package]] 890 | name = "rustversion" 891 | version = "1.0.17" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" 894 | 895 | [[package]] 896 | name = "ryu" 897 | version = "1.0.18" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 900 | 901 | [[package]] 902 | name = "scopeguard" 903 | version = "1.2.0" 904 | source = "registry+https://github.com/rust-lang/crates.io-index" 905 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 906 | 907 | [[package]] 908 | name = "semver" 909 | version = "1.0.23" 910 | source = "registry+https://github.com/rust-lang/crates.io-index" 911 | checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" 912 | 913 | [[package]] 914 | name = "seq-macro" 915 | version = "0.3.5" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" 918 | 919 | [[package]] 920 | name = "serde" 921 | version = "1.0.203" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" 924 | dependencies = [ 925 | "serde_derive", 926 | ] 927 | 928 | [[package]] 929 | name = "serde_derive" 930 | version = "1.0.203" 931 | source = "registry+https://github.com/rust-lang/crates.io-index" 932 | checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" 933 | dependencies = [ 934 | "proc-macro2", 935 | "quote", 936 | "syn", 937 | ] 938 | 939 | [[package]] 940 | name = "serde_json" 941 | version = "1.0.119" 942 | source = "registry+https://github.com/rust-lang/crates.io-index" 943 | checksum = "e8eddb61f0697cc3989c5d64b452f5488e2b8a60fd7d5076a3045076ffef8cb0" 944 | dependencies = [ 945 | "itoa", 946 | "ryu", 947 | "serde", 948 | ] 949 | 950 | [[package]] 951 | name = "sha1" 952 | version = "0.10.6" 953 | source = "registry+https://github.com/rust-lang/crates.io-index" 954 | checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 955 | dependencies = [ 956 | "cfg-if", 957 | "cpufeatures", 958 | "digest", 959 | ] 960 | 961 | [[package]] 962 | name = "siphasher" 963 | version = "0.3.11" 964 | source = "registry+https://github.com/rust-lang/crates.io-index" 965 | checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" 966 | 967 | [[package]] 968 | name = "slab" 969 | version = "0.4.9" 970 | source = "registry+https://github.com/rust-lang/crates.io-index" 971 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 972 | dependencies = [ 973 | "autocfg", 974 | ] 975 | 976 | [[package]] 977 | name = "smallvec" 978 | version = "1.13.2" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 981 | 982 | [[package]] 983 | name = "smawk" 984 | version = "0.3.2" 985 | source = "registry+https://github.com/rust-lang/crates.io-index" 986 | checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" 987 | 988 | [[package]] 989 | name = "static_assertions" 990 | version = "1.1.0" 991 | source = "registry+https://github.com/rust-lang/crates.io-index" 992 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 993 | 994 | [[package]] 995 | name = "syn" 996 | version = "2.0.68" 997 | source = "registry+https://github.com/rust-lang/crates.io-index" 998 | checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" 999 | dependencies = [ 1000 | "proc-macro2", 1001 | "quote", 1002 | "unicode-ident", 1003 | ] 1004 | 1005 | [[package]] 1006 | name = "textwrap" 1007 | version = "0.16.1" 1008 | source = "registry+https://github.com/rust-lang/crates.io-index" 1009 | checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" 1010 | dependencies = [ 1011 | "smawk", 1012 | "unicode-linebreak", 1013 | "unicode-width", 1014 | ] 1015 | 1016 | [[package]] 1017 | name = "thiserror" 1018 | version = "1.0.61" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" 1021 | dependencies = [ 1022 | "thiserror-impl", 1023 | ] 1024 | 1025 | [[package]] 1026 | name = "thiserror-impl" 1027 | version = "1.0.61" 1028 | source = "registry+https://github.com/rust-lang/crates.io-index" 1029 | checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" 1030 | dependencies = [ 1031 | "proc-macro2", 1032 | "quote", 1033 | "syn", 1034 | ] 1035 | 1036 | [[package]] 1037 | name = "tokio" 1038 | version = "1.38.0" 1039 | source = "registry+https://github.com/rust-lang/crates.io-index" 1040 | checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" 1041 | dependencies = [ 1042 | "backtrace", 1043 | "num_cpus", 1044 | "pin-project-lite", 1045 | ] 1046 | 1047 | [[package]] 1048 | name = "typenum" 1049 | version = "1.17.0" 1050 | source = "registry+https://github.com/rust-lang/crates.io-index" 1051 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 1052 | 1053 | [[package]] 1054 | name = "unicode-id-start" 1055 | version = "1.1.2" 1056 | source = "registry+https://github.com/rust-lang/crates.io-index" 1057 | checksum = "b8f73150333cb58412db36f2aca8f2875b013049705cc77b94ded70a1ab1f5da" 1058 | 1059 | [[package]] 1060 | name = "unicode-ident" 1061 | version = "1.0.12" 1062 | source = "registry+https://github.com/rust-lang/crates.io-index" 1063 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1064 | 1065 | [[package]] 1066 | name = "unicode-linebreak" 1067 | version = "0.1.5" 1068 | source = "registry+https://github.com/rust-lang/crates.io-index" 1069 | checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" 1070 | 1071 | [[package]] 1072 | name = "unicode-segmentation" 1073 | version = "1.11.0" 1074 | source = "registry+https://github.com/rust-lang/crates.io-index" 1075 | checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" 1076 | 1077 | [[package]] 1078 | name = "unicode-width" 1079 | version = "0.1.13" 1080 | source = "registry+https://github.com/rust-lang/crates.io-index" 1081 | checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" 1082 | 1083 | [[package]] 1084 | name = "version_check" 1085 | version = "0.9.4" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1088 | 1089 | [[package]] 1090 | name = "vsimd" 1091 | version = "0.8.0" 1092 | source = "registry+https://github.com/rust-lang/crates.io-index" 1093 | checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" 1094 | 1095 | [[package]] 1096 | name = "windows-targets" 1097 | version = "0.52.5" 1098 | source = "registry+https://github.com/rust-lang/crates.io-index" 1099 | checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" 1100 | dependencies = [ 1101 | "windows_aarch64_gnullvm", 1102 | "windows_aarch64_msvc", 1103 | "windows_i686_gnu", 1104 | "windows_i686_gnullvm", 1105 | "windows_i686_msvc", 1106 | "windows_x86_64_gnu", 1107 | "windows_x86_64_gnullvm", 1108 | "windows_x86_64_msvc", 1109 | ] 1110 | 1111 | [[package]] 1112 | name = "windows_aarch64_gnullvm" 1113 | version = "0.52.5" 1114 | source = "registry+https://github.com/rust-lang/crates.io-index" 1115 | checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" 1116 | 1117 | [[package]] 1118 | name = "windows_aarch64_msvc" 1119 | version = "0.52.5" 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" 1121 | checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" 1122 | 1123 | [[package]] 1124 | name = "windows_i686_gnu" 1125 | version = "0.52.5" 1126 | source = "registry+https://github.com/rust-lang/crates.io-index" 1127 | checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" 1128 | 1129 | [[package]] 1130 | name = "windows_i686_gnullvm" 1131 | version = "0.52.5" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" 1134 | 1135 | [[package]] 1136 | name = "windows_i686_msvc" 1137 | version = "0.52.5" 1138 | source = "registry+https://github.com/rust-lang/crates.io-index" 1139 | checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" 1140 | 1141 | [[package]] 1142 | name = "windows_x86_64_gnu" 1143 | version = "0.52.5" 1144 | source = "registry+https://github.com/rust-lang/crates.io-index" 1145 | checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" 1146 | 1147 | [[package]] 1148 | name = "windows_x86_64_gnullvm" 1149 | version = "0.52.5" 1150 | source = "registry+https://github.com/rust-lang/crates.io-index" 1151 | checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" 1152 | 1153 | [[package]] 1154 | name = "windows_x86_64_msvc" 1155 | version = "0.52.5" 1156 | source = "registry+https://github.com/rust-lang/crates.io-index" 1157 | checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" 1158 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | edition = "2021" 3 | name = "react-server-action" 4 | version = "0.0.0" 5 | 6 | [lib] 7 | crate-type = ["cdylib"] 8 | 9 | [dependencies] 10 | napi = { version = "2.16.8", default-features = false, features = ["napi9", "async"] } 11 | napi-derive = "2.16.6" 12 | serde_json = "1.0" 13 | oxc_allocator = { version = "0.16.2" } 14 | oxc_codegen = { version = "0.16.2" } 15 | oxc_span = { version = "0.16.2" } 16 | oxc_ast = { version = "0.16.2" } 17 | oxc_semantic = { version = "0.16.2" } 18 | oxc_syntax = { version = "0.16.2" } 19 | oxc_diagnostics = { version = "0.16.2" } 20 | oxc_parser = { version = "0.16.2" } 21 | futures = "0.3.30" 22 | tokio = { version = "1.38.0", features = ["default", "fs"] } 23 | sha1 = "0.10" 24 | hex = "0.4" 25 | 26 | [build-dependencies] 27 | napi-build = "2.1.3" 28 | 29 | [profile.release] 30 | lto = true 31 | strip = "symbols" 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Server 2 | 3 | ## Usage 4 | 5 | ```shell 6 | npm add react-server-action 7 | yarn add react-server-action 8 | pnpm add react-server-action 9 | ``` 10 | 11 | ```tsx 12 | import { validate, reactServerAction } from 'react-server-action' 13 | 14 | const isServerLayer = true 15 | const result = validate('path/to/file', isServerLayer) 16 | if (!result.error) { 17 | const code = await reactServerAction('path/to/file', '__prefix__', isServerLayer) 18 | console.log(code) 19 | } 20 | ``` 21 | 22 | > Collection of React Server tools 23 | 24 | ## RSC rules 25 | 26 | ### Valid RSC 27 | 28 | ```tsx 29 | 'use server' 30 | 'use client' 31 | // ❌ 32 | ``` 33 | 34 | ```tsx 35 | 'use server' 36 | // ✅ 37 | ``` 38 | 39 | ```tsx 40 | 'use client' 41 | // ✅ 42 | ``` 43 | 44 | ```tsx 45 | 'use client' 46 | export const foo = async () => { 47 | 'use server' 48 | return 'rsc' 49 | } 50 | // ❌ 51 | ``` 52 | 53 | ```tsx 54 | export const foo = async () => { 55 | 'use server' 56 | return 'rsc' 57 | } 58 | // ✅ 59 | ``` 60 | 61 | ### Register RSC 62 | 63 | #### Option 1: export `__PREFIX__+name` in the same file 64 | 65 | ```tsx 66 | import { registerServerReference } from 'react-server-dom-webpack/server' 67 | 68 | export const foo = async () => { 69 | 'use server' 70 | return 'rsc' 71 | } 72 | 73 | export const __prefix__foo = registerServerReference(foo, 'file_id', 'foo') 74 | ``` 75 | 76 | #### Option 2: register in local map 77 | 78 | ```tsx 79 | import { registerServerReference } from 'react-server-dom-webpack/server' 80 | 81 | export const rscMap = new Map() 82 | 83 | function register ( 84 | fn: Function, 85 | file: string, 86 | name: string, 87 | ) { 88 | registerServerReference(fn, file, name) 89 | rscMap.set(id, fn) 90 | return fn 91 | } 92 | 93 | export const foo = async () => { 94 | 'use server' 95 | return 'rsc' 96 | } 97 | 98 | register(foo, 'file_id', 'foo') 99 | ``` 100 | 101 | ### Transform RSC 102 | 103 | #### Case 1: server action file 104 | 105 | ```ts 106 | 'use server' 107 | 108 | export async function foo () { 109 | return 'rsc' 110 | } 111 | 112 | export function not_rsc () { 113 | return 'not_rsc' 114 | } 115 | ``` 116 | 117 | ⬇️ 118 | 119 | ```ts 120 | 'use server' 121 | import { registerServerReference } from 'react-server-dom-webpack/server' 122 | 123 | export async function foo () { 124 | return 'rsc' 125 | } 126 | 127 | export function not_rsc () { 128 | return 'not_rsc' 129 | } 130 | 131 | export const __prefix__foo = registerServerReference(foo, 'file_id', 'foo') 132 | ``` 133 | 134 | #### Case 2: non-exported server action 135 | 136 | ```tsx 137 | async function wrapFn (...args: any[]) { 138 | 'use server' 139 | } 140 | 141 | export const App = () => { 142 | wrapFn() 143 | return