├── .eslintignore ├── .eslintrc.json ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── automerge.yml │ ├── check-dist.yml │ ├── codeql-analysis.yml │ └── test.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── LICENSE ├── README.md ├── __tests__ ├── fixtures │ └── test-gem │ │ ├── .gitignore │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ ├── Gemfile │ │ ├── Rakefile │ │ ├── extconf.rb │ │ ├── lib │ │ └── test_gem.rb │ │ └── src │ │ └── lib.rs └── main.test.ts ├── action.yml ├── dist ├── index.js ├── index.js.map ├── licenses.txt └── sourcemap-register.js ├── jest.config.js ├── package-lock.json ├── package.json ├── src ├── compile.ts ├── input.ts ├── main.ts ├── setup.ts ├── upload.ts └── utils.ts └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | lib/ 3 | node_modules/ 4 | jest.config.js 5 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["jest", "@typescript-eslint"], 3 | "extends": ["plugin:github/recommended"], 4 | "parser": "@typescript-eslint/parser", 5 | "parserOptions": { 6 | "ecmaVersion": 9, 7 | "sourceType": "module", 8 | "project": "./tsconfig.json" 9 | }, 10 | "rules": { 11 | "i18n-text/no-en": "off", 12 | "eslint-comments/no-use": "off", 13 | "import/no-namespace": "off", 14 | "no-unused-vars": "off", 15 | "@typescript-eslint/no-unused-vars": "error", 16 | "@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], 17 | "@typescript-eslint/no-require-imports": "error", 18 | "@typescript-eslint/array-type": "error", 19 | "@typescript-eslint/await-thenable": "error", 20 | "@typescript-eslint/ban-ts-comment": "error", 21 | "camelcase": "off", 22 | "@typescript-eslint/consistent-type-assertions": "error", 23 | "@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}], 24 | "@typescript-eslint/func-call-spacing": ["error", "never"], 25 | "@typescript-eslint/no-array-constructor": "error", 26 | "@typescript-eslint/no-empty-interface": "error", 27 | "@typescript-eslint/no-explicit-any": "error", 28 | "@typescript-eslint/no-extraneous-class": "error", 29 | "@typescript-eslint/no-for-in-array": "error", 30 | "@typescript-eslint/no-inferrable-types": "error", 31 | "@typescript-eslint/no-misused-new": "error", 32 | "@typescript-eslint/no-namespace": "error", 33 | "@typescript-eslint/no-non-null-assertion": "warn", 34 | "@typescript-eslint/no-unnecessary-qualifier": "error", 35 | "@typescript-eslint/no-unnecessary-type-assertion": "error", 36 | "@typescript-eslint/no-useless-constructor": "error", 37 | "@typescript-eslint/no-var-requires": "error", 38 | "@typescript-eslint/prefer-for-of": "warn", 39 | "@typescript-eslint/prefer-function-type": "warn", 40 | "@typescript-eslint/prefer-includes": "error", 41 | "@typescript-eslint/prefer-string-starts-ends-with": "error", 42 | "@typescript-eslint/promise-function-async": "error", 43 | "@typescript-eslint/require-array-sort-compare": "error", 44 | "@typescript-eslint/restrict-plus-operands": "error", 45 | "semi": "off", 46 | "@typescript-eslint/semi": ["error", "never"], 47 | "@typescript-eslint/type-annotation-spacing": "error", 48 | "@typescript-eslint/unbound-method": "error" 49 | }, 50 | "env": { 51 | "node": true, 52 | "es6": true, 53 | "jest/globals": true 54 | } 55 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | dist/** -diff linguist-generated=true -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | schedule: 6 | interval: daily 7 | 8 | - package-ecosystem: npm 9 | directory: / 10 | schedule: 11 | interval: daily 12 | -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | name: PR auto-{approve,merge} 2 | 3 | on: 4 | pull_request_target: 5 | 6 | permissions: 7 | pull-requests: write 8 | contents: write 9 | 10 | jobs: 11 | dependabot: 12 | name: Dependabot 13 | runs-on: ubuntu-latest 14 | 15 | if: ${{ github.actor == 'dependabot[bot]' }} 16 | steps: 17 | - name: Fetch Dependabot metadata 18 | id: dependabot-metadata 19 | uses: dependabot/fetch-metadata@v1 20 | with: 21 | github-token: "${{ secrets.GITHUB_TOKEN }}" 22 | 23 | - name: Approve Dependabot PR 24 | uses: hmarr/auto-approve-action@v3 25 | if: ${{steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'}} 26 | with: 27 | github-token: ${{ secrets.GITHUB_TOKEN }} 28 | 29 | - name: Merge Dependabot PR 30 | run: gh pr merge --auto --squash "$PR_URL" 31 | env: 32 | PR_URL: ${{ github.event.pull_request.html_url }} 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | -------------------------------------------------------------------------------- /.github/workflows/check-dist.yml: -------------------------------------------------------------------------------- 1 | # `dist/index.js` is a special file in Actions. 2 | # When you reference an action with `uses:` in a workflow, 3 | # `index.js` is the code that will run. 4 | # For our project, we generate this file through a build process from other source files. 5 | # We need to make sure the checked-in `index.js` actually matches what we expect it to be. 6 | name: Check dist/ 7 | 8 | on: 9 | push: 10 | branches: 11 | - main 12 | paths-ignore: 13 | - '**.md' 14 | pull_request: 15 | paths-ignore: 16 | - '**.md' 17 | workflow_dispatch: 18 | 19 | jobs: 20 | check-dist: 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - uses: actions/checkout@v3 25 | 26 | - name: Set Node.js 16.x 27 | uses: actions/setup-node@v3.6.0 28 | with: 29 | node-version: 16.x 30 | 31 | - name: Install dependencies 32 | run: npm ci 33 | 34 | - name: Rebuild the dist/ directory 35 | run: | 36 | npm run build 37 | npm run package 38 | 39 | - name: Compare the expected and actual dist/ directories 40 | run: | 41 | if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then 42 | echo "Detected uncommitted changes after build. See status below:" 43 | git diff 44 | exit 1 45 | fi 46 | id: diff 47 | 48 | # If index.js was different than expected, upload the expected version as an artifact 49 | - uses: actions/upload-artifact@v3.1.2 50 | if: ${{ failure() && steps.diff.conclusion == 'failure' }} 51 | with: 52 | name: dist 53 | path: dist/ 54 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: 'CodeQL' 13 | 14 | on: 15 | push: 16 | branches: [main] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [main] 20 | schedule: 21 | - cron: '31 7 * * 3' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: ['TypeScript'] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | source-root: src 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v2 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v2 72 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: 'build-test' 2 | on: # rebuild any PRs and main branch changes 3 | pull_request: 4 | push: 5 | branches: 6 | - main 7 | - 'releases/*' 8 | 9 | jobs: 10 | build: # make sure build/ci work properly 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - run: | 15 | npm install 16 | - run: | 17 | npm run all 18 | test: # make sure the action works on a clean machine without building 19 | runs-on: ubuntu-latest 20 | strategy: 21 | matrix: 22 | platform: ['x86_64-linux', 'arm64-darwin'] 23 | steps: 24 | - uses: ruby/setup-ruby@v1 25 | with: 26 | ruby-version: '3.1' 27 | 28 | - uses: actions/checkout@v3 29 | 30 | - uses: ./ 31 | with: 32 | platform: ${{ matrix.platform }} 33 | ruby-versions: '3.1, 3.0' 34 | env: | 35 | FOO="bar" 36 | directory: __tests__/fixtures/test-gem 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | node_modules 3 | 4 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) 14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 15 | 16 | # Runtime data 17 | pids 18 | *.pid 19 | *.seed 20 | *.pid.lock 21 | 22 | # Directory for instrumented libs generated by jscoverage/JSCover 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | coverage 27 | *.lcov 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | jspm_packages/ 46 | 47 | # TypeScript v1 declaration files 48 | typings/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional REPL history 60 | .node_repl_history 61 | 62 | # Output of 'npm pack' 63 | *.tgz 64 | 65 | # Yarn Integrity file 66 | .yarn-integrity 67 | 68 | # dotenv environment variables file 69 | .env 70 | .env.test 71 | 72 | # parcel-bundler cache (https://parceljs.org/) 73 | .cache 74 | 75 | # next.js build output 76 | .next 77 | 78 | # nuxt.js build output 79 | .nuxt 80 | 81 | # vuepress build output 82 | .vuepress/dist 83 | 84 | # Serverless directories 85 | .serverless/ 86 | 87 | # FuseBox cache 88 | .fusebox/ 89 | 90 | # DynamoDB Local files 91 | .dynamodb/ 92 | 93 | # OS metadata 94 | .DS_Store 95 | Thumbs.db 96 | 97 | # Ignore built ts files 98 | __tests__/runner/* 99 | lib/**/* -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | lib/ 3 | node_modules/ -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": false, 6 | "singleQuote": true, 7 | "trailingComma": "none", 8 | "bracketSpacing": false, 9 | "arrowParens": "avoid" 10 | } 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2018 GitHub, Inc. and contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARCHIVED: use [oxidize-rb/actions/cross-gem](https://github.com/oxidize-rb/actions/blob/main/cross-gem/readme.md) instead 2 | 3 | # Cross Gem Action 4 | 5 | ![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg) 6 | [![Join the discussion](https://img.shields.io/badge/slack-chat-blue.svg)](https://join.slack.com/t/oxidize-rb/shared_invite/zt-16zv5tqte-Vi7WfzxCesdo2TqF_RYBCw) 7 | ![Continuous integration](https://github.com/oxidize-rb/cross-gem-action/workflows/build-test/badge.svg) 8 | 9 | This action makes it easy to compile and package native Rubygems that are written in Rust. Under the hood, it uses a customized version [`rake-compiler-dock`](https://github.com/rake-compiler/rake-compiler-dock) to compile a gem, and is meant to be used in tandem with [`rb-sys`](https://github.com/oxidize-rb/rb-sys). 10 | 11 | **Table of Contents** 12 | 13 | - [Example workflow](#example-workflow) 14 | - [Inputs](#inputs) 15 | - [License](#license) 16 | 17 | ## Example workflow 18 | 19 | ```yaml 20 | # Adjust this based on your release workflow 21 | on: 22 | workflow_dispatch: 23 | 24 | jobs: 25 | native_gem: 26 | name: Compile native gem 27 | runs-on: ubuntu-latest 28 | strategy: 29 | matrix: 30 | platform: 31 | - x86_64-linux 32 | - x86_64-linux-musl 33 | - aarch64-linux 34 | - arm-linux 35 | - x86_64-darwin 36 | - arm64-darwin 37 | - x64-mingw32 38 | - x64-mingw-ucrt 39 | steps: 40 | - uses: actions/checkout@v2 41 | 42 | - uses: ruby/setup-ruby@v1 43 | with: 44 | ruby-version: '3.1' 45 | 46 | - uses: oxidize-rb/cross-gem-action@v7 47 | with: 48 | platform: ${{ matrix.platform }} 49 | version: 'latest' # optional 50 | ruby-versions: '3.1, 3.0, 2.7' # optional 51 | setup: | # optional 52 | echo "Do something custom before compiling..." 53 | env: | # optional 54 | SOME_OTHER_ENV=some_value 55 | 56 | - uses: actions/download-artifact@v3 57 | with: 58 | name: cross-gem 59 | path: pkg/ 60 | 61 | - name: Display structure of built gems 62 | run: ls -R 63 | working-directory: pkg/ 64 | ``` 65 | 66 | ## Inputs 67 | 68 | | Name | Required | Description | Type | Default | 69 | | --------------- | :------: | --------------------------------------- | ------ | ----------------------------------- | 70 | | `platform` | Yes | Target Ruby platform | string | | 71 | | `ruby-versions` | | Ruby versions to build for | string | `3.2, 3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3` | 72 | | `directory` | | Directory of the Rakefile | string | | 73 | | `env` | | Extra env to set in the container | string | | 74 | | `setup` | | Custom setup script for the container | string | | 75 | | `artifact-name` | | Name of the uploaded artifact | string | `cross-gem` | 76 | | `version` | | Version tag for the docker image to use | string | latest rb-sys version | 77 | 78 | ## License 79 | 80 | This Action is distributed under the terms of the MIT license, see [LICENSE](https://github.com/oxidize-rb/cross-gem-action/blob/master/LICENSE) for details. 81 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | target/ 3 | pkg/ 4 | *.bundle 5 | *.so 6 | Gemfile.lock 7 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/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 = "aho-corasick" 7 | version = "0.7.19" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" 10 | dependencies = [ 11 | "memchr", 12 | ] 13 | 14 | [[package]] 15 | name = "bindgen" 16 | version = "0.60.1" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" 19 | dependencies = [ 20 | "bitflags", 21 | "cexpr", 22 | "clang-sys", 23 | "lazy_static", 24 | "lazycell", 25 | "peeking_take_while", 26 | "proc-macro2", 27 | "quote", 28 | "regex", 29 | "rustc-hash", 30 | "shlex", 31 | ] 32 | 33 | [[package]] 34 | name = "bitflags" 35 | version = "1.3.2" 36 | source = "registry+https://github.com/rust-lang/crates.io-index" 37 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 38 | 39 | [[package]] 40 | name = "cexpr" 41 | version = "0.6.0" 42 | source = "registry+https://github.com/rust-lang/crates.io-index" 43 | checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" 44 | dependencies = [ 45 | "nom", 46 | ] 47 | 48 | [[package]] 49 | name = "cfg-if" 50 | version = "1.0.0" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 53 | 54 | [[package]] 55 | name = "clang-sys" 56 | version = "1.4.0" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" 59 | dependencies = [ 60 | "glob", 61 | "libc", 62 | "libloading", 63 | ] 64 | 65 | [[package]] 66 | name = "glob" 67 | version = "0.3.0" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 70 | 71 | [[package]] 72 | name = "lazy_static" 73 | version = "1.4.0" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 76 | 77 | [[package]] 78 | name = "lazycell" 79 | version = "1.3.0" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 82 | 83 | [[package]] 84 | name = "libc" 85 | version = "0.2.137" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" 88 | 89 | [[package]] 90 | name = "libloading" 91 | version = "0.7.3" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" 94 | dependencies = [ 95 | "cfg-if", 96 | "winapi", 97 | ] 98 | 99 | [[package]] 100 | name = "memchr" 101 | version = "2.5.0" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 104 | 105 | [[package]] 106 | name = "minimal-lexical" 107 | version = "0.2.1" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 110 | 111 | [[package]] 112 | name = "nom" 113 | version = "7.1.1" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" 116 | dependencies = [ 117 | "memchr", 118 | "minimal-lexical", 119 | ] 120 | 121 | [[package]] 122 | name = "peeking_take_while" 123 | version = "0.1.2" 124 | source = "registry+https://github.com/rust-lang/crates.io-index" 125 | checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" 126 | 127 | [[package]] 128 | name = "proc-macro2" 129 | version = "1.0.47" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" 132 | dependencies = [ 133 | "unicode-ident", 134 | ] 135 | 136 | [[package]] 137 | name = "quote" 138 | version = "1.0.21" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" 141 | dependencies = [ 142 | "proc-macro2", 143 | ] 144 | 145 | [[package]] 146 | name = "rb-sys" 147 | version = "0.9.40" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "a3d0caa6c9436df8bf2907c449dd3378ae5b569c9d388889e2ab7574d3bb42e0" 150 | dependencies = [ 151 | "rb-sys-build", 152 | ] 153 | 154 | [[package]] 155 | name = "rb-sys-build" 156 | version = "0.9.40" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "80a9211f61b0a461e6855785415a893f1bac09bb69d54965fc5dec6033c167c9" 159 | dependencies = [ 160 | "bindgen", 161 | "regex", 162 | "shell-words", 163 | ] 164 | 165 | [[package]] 166 | name = "regex" 167 | version = "1.6.0" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" 170 | dependencies = [ 171 | "aho-corasick", 172 | "memchr", 173 | "regex-syntax", 174 | ] 175 | 176 | [[package]] 177 | name = "regex-syntax" 178 | version = "0.6.27" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" 181 | 182 | [[package]] 183 | name = "rustc-hash" 184 | version = "1.1.0" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 187 | 188 | [[package]] 189 | name = "shell-words" 190 | version = "1.1.0" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" 193 | 194 | [[package]] 195 | name = "shlex" 196 | version = "1.1.0" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" 199 | 200 | [[package]] 201 | name = "test_gem_ext" 202 | version = "0.1.0" 203 | dependencies = [ 204 | "rb-sys", 205 | ] 206 | 207 | [[package]] 208 | name = "unicode-ident" 209 | version = "1.0.5" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" 212 | 213 | [[package]] 214 | name = "winapi" 215 | version = "0.3.9" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 218 | dependencies = [ 219 | "winapi-i686-pc-windows-gnu", 220 | "winapi-x86_64-pc-windows-gnu", 221 | ] 222 | 223 | [[package]] 224 | name = "winapi-i686-pc-windows-gnu" 225 | version = "0.4.0" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 228 | 229 | [[package]] 230 | name = "winapi-x86_64-pc-windows-gnu" 231 | version = "0.4.0" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 234 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_gem_ext" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib"] 8 | 9 | [dependencies] 10 | rb-sys = "~0.9.40" 11 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rb_sys", "~> 0.9.40" 6 | gem "rake" 7 | gem "rake-compiler" 8 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/Rakefile: -------------------------------------------------------------------------------- 1 | require "rake/extensiontask" 2 | require "bundler" 3 | 4 | PLATFORMS = ["x86_64-linux", "arm-linux", "aarch64-linux", "x86_64-darwin", "arm64-darwin", "x64-mingw32", "x64-mingw-ucrt"] 5 | 6 | spec = Gem::Specification.new do |s| 7 | s.name = "test_gem" 8 | s.version = "0.1.0" 9 | s.summary = "A Rust extension for Ruby" 10 | s.extensions = ["Cargo.toml"] 11 | s.authors = ["Ian Ker-Seymer"] 12 | s.files = ["Cargo.toml", "Cargo.lock", "src/lib.rs", "lib/test_gem.rb"] 13 | s.metadata["cargo_crate_name"] = "test_gem_ext" 14 | s.platform = Gem::Platform::RUBY 15 | s.extensions = ["extconf.rb"] 16 | end 17 | 18 | Rake::ExtensionTask.new("test_gem_ext", spec) do |ext| 19 | ext.ext_dir = __dir__ 20 | ext.source_pattern = "*.{rs,Cargo.toml}" 21 | ext.cross_compile = true 22 | ext.cross_platform = PLATFORMS 23 | end 24 | 25 | Gem::PackageTask.new(spec) do |pkg| 26 | end 27 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/extconf.rb: -------------------------------------------------------------------------------- 1 | require "mkmf" 2 | require "rb_sys/mkmf" 3 | 4 | create_rust_makefile("test_gem_ext") 5 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/lib/test_gem.rb: -------------------------------------------------------------------------------- 1 | begin 2 | RUBY_VERSION =~ /(\d+\.\d+)/ 3 | require "#{$1}/test_gem_ext" 4 | rescue LoadError 5 | require "test_gem_ext" 6 | end 7 | -------------------------------------------------------------------------------- /__tests__/fixtures/test-gem/src/lib.rs: -------------------------------------------------------------------------------- 1 | use rb_sys::rb_define_module; 2 | use std::ffi::CString; 3 | 4 | #[allow(non_snake_case)] 5 | #[no_mangle] 6 | extern "C" fn Init_test_gem_ext() { 7 | let name = CString::new("TestGem").unwrap(); 8 | unsafe { rb_define_module(name.as_ptr()) }; 9 | } 10 | -------------------------------------------------------------------------------- /__tests__/main.test.ts: -------------------------------------------------------------------------------- 1 | import * as process from 'process' 2 | import * as cp from 'child_process' 3 | import * as path from 'path' 4 | import {jest, expect, test} from '@jest/globals' 5 | import {stderr} from 'process' 6 | import {parseEnvString as parseEnv} from './../src/utils' 7 | import {compileGem} from './../src/compile' 8 | 9 | import * as core from '@actions/core' 10 | import {Input} from '../src/input' 11 | 12 | process.env['INPUT_RUBY-VERSIONS'] = '3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3' 13 | process.env['INPUT_PLATFORM'] = 'x86_64-linux' 14 | process.env['INPUT_VERSION'] = '0.9.34' 15 | 16 | test('errors with invalid platform', () => { 17 | withExtraEnv({INPUT_PLATFORM: 'xafasdf'}, () => { 18 | const np = process.execPath 19 | const ip = path.join(__dirname, '..', 'lib', 'main.js') 20 | const options: cp.ExecFileSyncOptions = { 21 | env: process.env 22 | } 23 | const out = cp.spawnSync(np, [ip], options).stdout.toString() 24 | 25 | expect(out).toContain( 26 | '::error::Unsupported platform: xafasdf. Must be one of arm-linux,' 27 | ) 28 | }) 29 | }) 30 | 31 | test('errors when no rakefile', () => { 32 | withExtraEnv({INPUT_PLATFORM: 'x86_64-linux'}, () => { 33 | const np = process.execPath 34 | const ip = path.join(__dirname, '..', 'lib', 'main.js') 35 | const options: cp.ExecFileSyncOptions = { 36 | env: process.env 37 | } 38 | const out = cp.spawnSync(np, [ip], options).stdout.toString() 39 | 40 | expect(out).toContain('::error::Could not find Rakefile in directory: ') 41 | }) 42 | }) 43 | 44 | test('errors with invalid ruby version', () => { 45 | withExtraEnv({'INPUT_RUBY-VERSIONS': '3'}, () => { 46 | const np = process.execPath 47 | const ip = path.join(__dirname, '..', 'lib', 'main.js') 48 | const options: cp.ExecFileSyncOptions = { 49 | env: process.env 50 | } 51 | const out = cp.spawnSync(np, [ip], options).stdout.toString() 52 | 53 | expect(out).toContain('::error::Invalid Ruby version: 3') 54 | }) 55 | }) 56 | 57 | test('valid ruby versions', () => { 58 | withExtraEnv({'INPUT_RUBY-VERSIONS': '3.1, 3.0'}, () => { 59 | const np = process.execPath 60 | const ip = path.join(__dirname, '..', 'lib', 'main.js') 61 | const options: cp.ExecFileSyncOptions = { 62 | env: process.env 63 | } 64 | const out = cp.spawnSync(np, [ip], options).stdout.toString() 65 | 66 | expect(out).toContain('Using Ruby versions: 3.1.0, 3.0.0') 67 | }) 68 | }) 69 | 70 | function withExtraEnv(env: {[key: string]: string}, callback: () => void) { 71 | let oldEnv = {...process.env} 72 | 73 | for (const key in env) { 74 | process.env[key] = env[key] 75 | } 76 | 77 | try { 78 | callback() 79 | } finally { 80 | for (const key in env) { 81 | process.env[key] = oldEnv[key] 82 | } 83 | } 84 | } 85 | 86 | test('parsing env string', () => { 87 | expect(parseEnv('FOO=bar\nBAZ="qux"\n')).toEqual({FOO: 'bar', BAZ: 'qux'}) 88 | expect(parseEnv('FOO=bar\nBAZ=""\n\n')).toEqual({FOO: 'bar', BAZ: ''}) 89 | expect(parseEnv('FOO=""bar""')).toEqual({FOO: '"bar"'}) 90 | expect(parseEnv('')).toEqual({}) 91 | expect(parseEnv('# FOO=bar')).toEqual({}) 92 | expect(parseEnv('RUBY_CC_VERSION="3.1.0"')).toEqual({ 93 | RUBY_CC_VERSION: '3.1.0' 94 | }) 95 | }) 96 | 97 | test('compiling gem with explicity RUBY_CC_VERSION', async () => { 98 | const input = fakeInput({ 99 | env: 'RUBY_CC_VERSION=3.1.0' 100 | }) 101 | 102 | const executor = await testCompileGem(input) 103 | 104 | expect(executor).toHaveBeenCalledWith( 105 | 'rake-compiler-dock', 106 | ['bash', '-c', "export RUBY_CC_VERSION='3.1.0'\nrake compile"], 107 | expect.objectContaining({cwd: './tmp/test'}) 108 | ) 109 | }) 110 | 111 | test('compiling gem with explicity env string', async () => { 112 | const input = fakeInput({ 113 | env: 'FOO="bar"' 114 | }) 115 | 116 | const executor = await testCompileGem(input) 117 | 118 | expect(executor).toHaveBeenCalledWith( 119 | 'rake-compiler-dock', 120 | [ 121 | 'bash', 122 | '-c', 123 | "export FOO='bar'\nexport RUBY_CC_VERSION='3.1.0:3.0.0'\nrake compile" 124 | ], 125 | expect.objectContaining({cwd: './tmp/test'}) 126 | ) 127 | }) 128 | 129 | test('compiling gem with explicity setup', async () => { 130 | const input = fakeInput({ 131 | setup: 'bundle install\nrake setup' 132 | }) 133 | 134 | const executor = await testCompileGem(input) 135 | 136 | expect(executor).toHaveBeenCalledWith( 137 | 'rake-compiler-dock', 138 | [ 139 | 'bash', 140 | '-c', 141 | "export RUBY_CC_VERSION='3.1.0:3.0.0'\nbundle install\nrake setup\nrake compile" 142 | ], 143 | expect.objectContaining({cwd: './tmp/test'}) 144 | ) 145 | }) 146 | 147 | test('compiling cargo linker for ruby', async () => { 148 | const input = fakeInput({ 149 | useRubyLinkerForCargo: true 150 | }) 151 | 152 | const executor = await testCompileGem(input) 153 | 154 | expect(executor).toHaveBeenCalledWith( 155 | 'rake-compiler-dock', 156 | [ 157 | 'bash', 158 | '-c', 159 | "export RUBY_CC_VERSION='3.1.0:3.0.0'\nexport CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER='x86_64-linux-gnu-gcc'\nrake compile" 160 | ], 161 | expect.anything() 162 | ) 163 | }) 164 | 165 | test('compiling gem with explicity RUBY_CC_VERSION', async () => { 166 | const input = fakeInput({ 167 | rubyVersions: ['3.1.0', '3.0.0', '2.6.0'] 168 | }) 169 | 170 | const executor = await testCompileGem(input) 171 | 172 | expect(executor).toHaveBeenCalledWith( 173 | 'rake-compiler-dock', 174 | ['bash', '-c', "export RUBY_CC_VERSION='3.1.0:3.0.0:2.6.0'\nrake compile"], 175 | expect.anything() 176 | ) 177 | }) 178 | 179 | async function testCompileGem(input: Input) { 180 | let executor = jest.fn().mockImplementationOnce(() => Promise.resolve()) 181 | 182 | await compileGem(input, executor as any) 183 | 184 | return executor 185 | } 186 | 187 | function fakeInput(extraInputs: Partial) { 188 | return { 189 | platform: 'x86_64-linux', 190 | rubyVersions: ['3.1.0', '3.0.0'], 191 | version: '0.9.34', 192 | gem: 'test.gem', 193 | directory: './tmp/test', 194 | env: '', 195 | command: 'rake compile', 196 | useRubyLinkerForCargo: false, 197 | setup: null, 198 | ...extraInputs 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'cross-gem' 2 | description: 'Cross compiles a native Ruby gem written in Rust' 3 | author: 'oxidize-rs' 4 | branding: 5 | icon: 'chevron-right' 6 | color: 'gray-dark' 7 | inputs: 8 | platform: 9 | required: true 10 | description: 'The target Ruby platform' 11 | directory: 12 | description: 'Directory of gem to build' 13 | ruby-versions: 14 | description: 'Comma seperated list of Ruby versions to build for' 15 | default: '3.2, 3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3' 16 | command: 17 | description: 'Command to build gem inside of container' 18 | setup: 19 | description: 'Extra setup script to run inside container' 20 | artifact-name: 21 | description: 'Name of the uploaded artifact' 22 | default: 'cross-gem' 23 | version: 24 | description: 'Docker version tag for container (corresponds to rb-sys version)' 25 | default: "latest" 26 | env: 27 | description: 'Extra env vars to set when compiling' 28 | use-ruby-linker-for-cargo: 29 | description: 'Set the CARGO_TARGET_{TARGET}_LINKER to use the linker from RbConfig' 30 | runs: 31 | using: 'node16' 32 | main: 'dist/index.js' 33 | -------------------------------------------------------------------------------- /dist/licenses.txt: -------------------------------------------------------------------------------- 1 | @actions/artifact 2 | MIT 3 | The MIT License (MIT) 4 | 5 | Copyright 2019 GitHub 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | 13 | @actions/core 14 | MIT 15 | The MIT License (MIT) 16 | 17 | Copyright 2019 GitHub 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | @actions/exec 26 | MIT 27 | The MIT License (MIT) 28 | 29 | Copyright 2019 GitHub 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 32 | 33 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 34 | 35 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 36 | 37 | @actions/glob 38 | MIT 39 | The MIT License (MIT) 40 | 41 | Copyright 2019 GitHub 42 | 43 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 44 | 45 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 46 | 47 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 48 | 49 | @actions/http-client 50 | MIT 51 | Actions Http Client for Node.js 52 | 53 | Copyright (c) GitHub, Inc. 54 | 55 | All rights reserved. 56 | 57 | MIT License 58 | 59 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 60 | associated documentation files (the "Software"), to deal in the Software without restriction, 61 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 62 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 63 | subject to the following conditions: 64 | 65 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 66 | 67 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 68 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 69 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 70 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 71 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 72 | 73 | 74 | @actions/io 75 | MIT 76 | The MIT License (MIT) 77 | 78 | Copyright 2019 GitHub 79 | 80 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 81 | 82 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 83 | 84 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 85 | 86 | balanced-match 87 | MIT 88 | (MIT) 89 | 90 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 91 | 92 | Permission is hereby granted, free of charge, to any person obtaining a copy of 93 | this software and associated documentation files (the "Software"), to deal in 94 | the Software without restriction, including without limitation the rights to 95 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 96 | of the Software, and to permit persons to whom the Software is furnished to do 97 | so, subject to the following conditions: 98 | 99 | The above copyright notice and this permission notice shall be included in all 100 | copies or substantial portions of the Software. 101 | 102 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 103 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 104 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 105 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 106 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 107 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 108 | SOFTWARE. 109 | 110 | 111 | brace-expansion 112 | MIT 113 | MIT License 114 | 115 | Copyright (c) 2013 Julian Gruber 116 | 117 | Permission is hereby granted, free of charge, to any person obtaining a copy 118 | of this software and associated documentation files (the "Software"), to deal 119 | in the Software without restriction, including without limitation the rights 120 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 121 | copies of the Software, and to permit persons to whom the Software is 122 | furnished to do so, subject to the following conditions: 123 | 124 | The above copyright notice and this permission notice shall be included in all 125 | copies or substantial portions of the Software. 126 | 127 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 128 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 129 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 130 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 131 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 132 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 133 | SOFTWARE. 134 | 135 | 136 | concat-map 137 | MIT 138 | This software is released under the MIT license: 139 | 140 | Permission is hereby granted, free of charge, to any person obtaining a copy of 141 | this software and associated documentation files (the "Software"), to deal in 142 | the Software without restriction, including without limitation the rights to 143 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 144 | the Software, and to permit persons to whom the Software is furnished to do so, 145 | subject to the following conditions: 146 | 147 | The above copyright notice and this permission notice shall be included in all 148 | copies or substantial portions of the Software. 149 | 150 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 151 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 152 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 153 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 154 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 155 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 156 | 157 | 158 | fs.realpath 159 | ISC 160 | The ISC License 161 | 162 | Copyright (c) Isaac Z. Schlueter and Contributors 163 | 164 | Permission to use, copy, modify, and/or distribute this software for any 165 | purpose with or without fee is hereby granted, provided that the above 166 | copyright notice and this permission notice appear in all copies. 167 | 168 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 169 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 170 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 171 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 172 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 173 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 174 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 175 | 176 | ---- 177 | 178 | This library bundles a version of the `fs.realpath` and `fs.realpathSync` 179 | methods from Node.js v0.10 under the terms of the Node.js MIT license. 180 | 181 | Node's license follows, also included at the header of `old.js` which contains 182 | the licensed code: 183 | 184 | Copyright Joyent, Inc. and other Node contributors. 185 | 186 | Permission is hereby granted, free of charge, to any person obtaining a 187 | copy of this software and associated documentation files (the "Software"), 188 | to deal in the Software without restriction, including without limitation 189 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 190 | and/or sell copies of the Software, and to permit persons to whom the 191 | Software is furnished to do so, subject to the following conditions: 192 | 193 | The above copyright notice and this permission notice shall be included in 194 | all copies or substantial portions of the Software. 195 | 196 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 197 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 198 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 199 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 200 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 201 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 202 | DEALINGS IN THE SOFTWARE. 203 | 204 | 205 | glob 206 | ISC 207 | The ISC License 208 | 209 | Copyright (c) Isaac Z. Schlueter and Contributors 210 | 211 | Permission to use, copy, modify, and/or distribute this software for any 212 | purpose with or without fee is hereby granted, provided that the above 213 | copyright notice and this permission notice appear in all copies. 214 | 215 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 216 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 217 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 218 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 219 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 220 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 221 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 222 | 223 | ## Glob Logo 224 | 225 | Glob's logo created by Tanya Brassie , licensed 226 | under a Creative Commons Attribution-ShareAlike 4.0 International License 227 | https://creativecommons.org/licenses/by-sa/4.0/ 228 | 229 | 230 | inflight 231 | ISC 232 | The ISC License 233 | 234 | Copyright (c) Isaac Z. Schlueter 235 | 236 | Permission to use, copy, modify, and/or distribute this software for any 237 | purpose with or without fee is hereby granted, provided that the above 238 | copyright notice and this permission notice appear in all copies. 239 | 240 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 241 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 242 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 243 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 244 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 245 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 246 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 247 | 248 | 249 | inherits 250 | ISC 251 | The ISC License 252 | 253 | Copyright (c) Isaac Z. Schlueter 254 | 255 | Permission to use, copy, modify, and/or distribute this software for any 256 | purpose with or without fee is hereby granted, provided that the above 257 | copyright notice and this permission notice appear in all copies. 258 | 259 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 260 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 261 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 262 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 263 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 264 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 265 | PERFORMANCE OF THIS SOFTWARE. 266 | 267 | 268 | 269 | minimatch 270 | ISC 271 | The ISC License 272 | 273 | Copyright (c) Isaac Z. Schlueter and Contributors 274 | 275 | Permission to use, copy, modify, and/or distribute this software for any 276 | purpose with or without fee is hereby granted, provided that the above 277 | copyright notice and this permission notice appear in all copies. 278 | 279 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 280 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 281 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 282 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 283 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 284 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 285 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 286 | 287 | 288 | once 289 | ISC 290 | The ISC License 291 | 292 | Copyright (c) Isaac Z. Schlueter and Contributors 293 | 294 | Permission to use, copy, modify, and/or distribute this software for any 295 | purpose with or without fee is hereby granted, provided that the above 296 | copyright notice and this permission notice appear in all copies. 297 | 298 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 299 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 300 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 301 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 302 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 303 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 304 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 305 | 306 | 307 | path-is-absolute 308 | MIT 309 | The MIT License (MIT) 310 | 311 | Copyright (c) Sindre Sorhus (sindresorhus.com) 312 | 313 | Permission is hereby granted, free of charge, to any person obtaining a copy 314 | of this software and associated documentation files (the "Software"), to deal 315 | in the Software without restriction, including without limitation the rights 316 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 317 | copies of the Software, and to permit persons to whom the Software is 318 | furnished to do so, subject to the following conditions: 319 | 320 | The above copyright notice and this permission notice shall be included in 321 | all copies or substantial portions of the Software. 322 | 323 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 324 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 325 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 326 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 327 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 328 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 329 | THE SOFTWARE. 330 | 331 | 332 | rimraf 333 | ISC 334 | The ISC License 335 | 336 | Copyright (c) Isaac Z. Schlueter and Contributors 337 | 338 | Permission to use, copy, modify, and/or distribute this software for any 339 | purpose with or without fee is hereby granted, provided that the above 340 | copyright notice and this permission notice appear in all copies. 341 | 342 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 343 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 344 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 345 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 346 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 347 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 348 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 349 | 350 | 351 | tmp 352 | MIT 353 | The MIT License (MIT) 354 | 355 | Copyright (c) 2014 KARASZI István 356 | 357 | Permission is hereby granted, free of charge, to any person obtaining a copy 358 | of this software and associated documentation files (the "Software"), to deal 359 | in the Software without restriction, including without limitation the rights 360 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 361 | copies of the Software, and to permit persons to whom the Software is 362 | furnished to do so, subject to the following conditions: 363 | 364 | The above copyright notice and this permission notice shall be included in all 365 | copies or substantial portions of the Software. 366 | 367 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 368 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 369 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 370 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 371 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 372 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 373 | SOFTWARE. 374 | 375 | 376 | tmp-promise 377 | MIT 378 | 379 | tunnel 380 | MIT 381 | The MIT License (MIT) 382 | 383 | Copyright (c) 2012 Koichi Kobayashi 384 | 385 | Permission is hereby granted, free of charge, to any person obtaining a copy 386 | of this software and associated documentation files (the "Software"), to deal 387 | in the Software without restriction, including without limitation the rights 388 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 389 | copies of the Software, and to permit persons to whom the Software is 390 | furnished to do so, subject to the following conditions: 391 | 392 | The above copyright notice and this permission notice shall be included in 393 | all copies or substantial portions of the Software. 394 | 395 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 396 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 397 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 398 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 399 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 400 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 401 | THE SOFTWARE. 402 | 403 | 404 | uuid 405 | MIT 406 | The MIT License (MIT) 407 | 408 | Copyright (c) 2010-2020 Robert Kieffer and other contributors 409 | 410 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 411 | 412 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 413 | 414 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 415 | 416 | 417 | wrappy 418 | ISC 419 | The ISC License 420 | 421 | Copyright (c) Isaac Z. Schlueter and Contributors 422 | 423 | Permission to use, copy, modify, and/or distribute this software for any 424 | purpose with or without fee is hereby granted, provided that the above 425 | copyright notice and this permission notice appear in all copies. 426 | 427 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 428 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 429 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 430 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 431 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 432 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 433 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 434 | -------------------------------------------------------------------------------- /dist/sourcemap-register.js: -------------------------------------------------------------------------------- 1 | (()=>{var e={650:e=>{var r=Object.prototype.toString;var n=typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(e){return r.call(e).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(e,r,t){r>>>=0;var o=e.byteLength-r;if(o<0){throw new RangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){throw new RangeError("'length' is out of bounds")}}return n?Buffer.from(e.slice(r,r+t)):new Buffer(new Uint8Array(e.slice(r,r+t)))}function fromString(e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}return n?Buffer.from(e,r):new Buffer(e,r)}function bufferFrom(e,r,t){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){return fromArrayBuffer(e,r,t)}if(typeof e==="string"){return fromString(e,r)}return n?Buffer.from(e):new Buffer(e)}e.exports=bufferFrom},274:(e,r,n)=>{var t=n(339);var o=Object.prototype.hasOwnProperty;var i=typeof Map!=="undefined";function ArraySet(){this._array=[];this._set=i?new Map:Object.create(null)}ArraySet.fromArray=function ArraySet_fromArray(e,r){var n=new ArraySet;for(var t=0,o=e.length;t=0){return r}}else{var n=t.toSetString(e);if(o.call(this._set,n)){return this._set[n]}}throw new Error('"'+e+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(e){if(e>=0&&e{var t=n(190);var o=5;var i=1<>1;return r?-n:n}r.encode=function base64VLQ_encode(e){var r="";var n;var i=toVLQSigned(e);do{n=i&a;i>>>=o;if(i>0){n|=u}r+=t.encode(n)}while(i>0);return r};r.decode=function base64VLQ_decode(e,r,n){var i=e.length;var s=0;var l=0;var c,p;do{if(r>=i){throw new Error("Expected more digits in base 64 VLQ value.")}p=t.decode(e.charCodeAt(r++));if(p===-1){throw new Error("Invalid base64 digit: "+e.charAt(r-1))}c=!!(p&u);p&=a;s=s+(p<{var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e{r.GREATEST_LOWER_BOUND=1;r.LEAST_UPPER_BOUND=2;function recursiveSearch(e,n,t,o,i,a){var u=Math.floor((n-e)/2)+e;var s=i(t,o[u],true);if(s===0){return u}else if(s>0){if(n-u>1){return recursiveSearch(u,n,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return n1){return recursiveSearch(e,u,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return u}else{return e<0?-1:e}}}r.search=function search(e,n,t,o){if(n.length===0){return-1}var i=recursiveSearch(-1,n.length,e,n,t,o||r.GREATEST_LOWER_BOUND);if(i<0){return-1}while(i-1>=0){if(t(n[i],n[i-1],true)!==0){break}--i}return i}},680:(e,r,n)=>{var t=n(339);function generatedPositionAfter(e,r){var n=e.generatedLine;var o=r.generatedLine;var i=e.generatedColumn;var a=r.generatedColumn;return o>n||o==n&&a>=i||t.compareByGeneratedPositionsInflated(e,r)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(e,r){this._array.forEach(e,r)};MappingList.prototype.add=function MappingList_add(e){if(generatedPositionAfter(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(t.compareByGeneratedPositionsInflated);this._sorted=true}return this._array};r.H=MappingList},758:(e,r)=>{function swap(e,r,n){var t=e[r];e[r]=e[n];e[n]=t}function randomIntInRange(e,r){return Math.round(e+Math.random()*(r-e))}function doQuickSort(e,r,n,t){if(n{var t;var o=n(339);var i=n(345);var a=n(274).I;var u=n(449);var s=n(758).U;function SourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}return n.sections!=null?new IndexedSourceMapConsumer(n,r):new BasicSourceMapConsumer(n,r)}SourceMapConsumer.fromSourceMap=function(e,r){return BasicSourceMapConsumer.fromSourceMap(e,r)};SourceMapConsumer.prototype._version=3;SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{configurable:true,enumerable:true,get:function(){if(!this.__generatedMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{configurable:true,enumerable:true,get:function(){if(!this.__originalMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._charIsMappingSeparator=function SourceMapConsumer_charIsMappingSeparator(e,r){var n=e.charAt(r);return n===";"||n===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(e,r){throw new Error("Subclasses must implement _parseMappings")};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.GREATEST_LOWER_BOUND=1;SourceMapConsumer.LEAST_UPPER_BOUND=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(e,r,n){var t=r||null;var i=n||SourceMapConsumer.GENERATED_ORDER;var a;switch(i){case SourceMapConsumer.GENERATED_ORDER:a=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;a.map((function(e){var r=e.source===null?null:this._sources.at(e.source);r=o.computeSourceURL(u,r,this._sourceMapURL);return{source:r,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name===null?null:this._names.at(e.name)}}),this).forEach(e,t)};SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(e){var r=o.getArg(e,"line");var n={source:o.getArg(e,"source"),originalLine:r,originalColumn:o.getArg(e,"column",0)};n.source=this._findSourceIndex(n.source);if(n.source<0){return[]}var t=[];var a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,i.LEAST_UPPER_BOUND);if(a>=0){var u=this._originalMappings[a];if(e.column===undefined){var s=u.originalLine;while(u&&u.originalLine===s){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}else{var l=u.originalColumn;while(u&&u.originalLine===r&&u.originalColumn==l){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}}return t};r.SourceMapConsumer=SourceMapConsumer;function BasicSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sources");var u=o.getArg(n,"names",[]);var s=o.getArg(n,"sourceRoot",null);var l=o.getArg(n,"sourcesContent",null);var c=o.getArg(n,"mappings");var p=o.getArg(n,"file",null);if(t!=this._version){throw new Error("Unsupported version: "+t)}if(s){s=o.normalize(s)}i=i.map(String).map(o.normalize).map((function(e){return s&&o.isAbsolute(s)&&o.isAbsolute(e)?o.relative(s,e):e}));this._names=a.fromArray(u.map(String),true);this._sources=a.fromArray(i,true);this._absoluteSources=this._sources.toArray().map((function(e){return o.computeSourceURL(s,e,r)}));this.sourceRoot=s;this.sourcesContent=l;this._mappings=c;this._sourceMapURL=r;this.file=p}BasicSourceMapConsumer.prototype=Object.create(SourceMapConsumer.prototype);BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer;BasicSourceMapConsumer.prototype._findSourceIndex=function(e){var r=e;if(this.sourceRoot!=null){r=o.relative(this.sourceRoot,r)}if(this._sources.has(r)){return this._sources.indexOf(r)}var n;for(n=0;n1){v.source=l+_[1];l+=_[1];v.originalLine=i+_[2];i=v.originalLine;v.originalLine+=1;v.originalColumn=a+_[3];a=v.originalColumn;if(_.length>4){v.name=c+_[4];c+=_[4]}}m.push(v);if(typeof v.originalLine==="number"){d.push(v)}}}s(m,o.compareByGeneratedPositionsDeflated);this.__generatedMappings=m;s(d,o.compareByOriginalPositions);this.__originalMappings=d};BasicSourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(e,r,n,t,o,a){if(e[n]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+e[n])}if(e[t]<0){throw new TypeError("Column must be greater than or equal to 0, got "+e[t])}return i.search(e,r,o,a)};BasicSourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var e=0;e=0){var t=this._generatedMappings[n];if(t.generatedLine===r.generatedLine){var i=o.getArg(t,"source",null);if(i!==null){i=this._sources.at(i);i=o.computeSourceURL(this.sourceRoot,i,this._sourceMapURL)}var a=o.getArg(t,"name",null);if(a!==null){a=this._names.at(a)}return{source:i,line:o.getArg(t,"originalLine",null),column:o.getArg(t,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}};BasicSourceMapConsumer.prototype.hasContentsOfAllSources=function BasicSourceMapConsumer_hasContentsOfAllSources(){if(!this.sourcesContent){return false}return this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return e==null}))};BasicSourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(e,r){if(!this.sourcesContent){return null}var n=this._findSourceIndex(e);if(n>=0){return this.sourcesContent[n]}var t=e;if(this.sourceRoot!=null){t=o.relative(this.sourceRoot,t)}var i;if(this.sourceRoot!=null&&(i=o.urlParse(this.sourceRoot))){var a=t.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a)){return this.sourcesContent[this._sources.indexOf(a)]}if((!i.path||i.path=="/")&&this._sources.has("/"+t)){return this.sourcesContent[this._sources.indexOf("/"+t)]}}if(r){return null}else{throw new Error('"'+t+'" is not in the SourceMap.')}};BasicSourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(e){var r=o.getArg(e,"source");r=this._findSourceIndex(r);if(r<0){return{line:null,column:null,lastColumn:null}}var n={source:r,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")};var t=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",SourceMapConsumer.GREATEST_LOWER_BOUND));if(t>=0){var i=this._originalMappings[t];if(i.source===n.source){return{line:o.getArg(i,"generatedLine",null),column:o.getArg(i,"generatedColumn",null),lastColumn:o.getArg(i,"lastGeneratedColumn",null)}}}return{line:null,column:null,lastColumn:null}};t=BasicSourceMapConsumer;function IndexedSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sections");if(t!=this._version){throw new Error("Unsupported version: "+t)}this._sources=new a;this._names=new a;var u={line:-1,column:0};this._sections=i.map((function(e){if(e.url){throw new Error("Support for url field in sections not implemented.")}var n=o.getArg(e,"offset");var t=o.getArg(n,"line");var i=o.getArg(n,"column");if(t{var t=n(449);var o=n(339);var i=n(274).I;var a=n(680).H;function SourceMapGenerator(e){if(!e){e={}}this._file=o.getArg(e,"file",null);this._sourceRoot=o.getArg(e,"sourceRoot",null);this._skipValidation=o.getArg(e,"skipValidation",false);this._sources=new i;this._names=new i;this._mappings=new a;this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(e){var r=e.sourceRoot;var n=new SourceMapGenerator({file:e.file,sourceRoot:r});e.eachMapping((function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};if(e.source!=null){t.source=e.source;if(r!=null){t.source=o.relative(r,t.source)}t.original={line:e.originalLine,column:e.originalColumn};if(e.name!=null){t.name=e.name}}n.addMapping(t)}));e.sources.forEach((function(t){var i=t;if(r!==null){i=o.relative(r,t)}if(!n._sources.has(i)){n._sources.add(i)}var a=e.sourceContentFor(t);if(a!=null){n.setSourceContent(t,a)}}));return n};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(e){var r=o.getArg(e,"generated");var n=o.getArg(e,"original",null);var t=o.getArg(e,"source",null);var i=o.getArg(e,"name",null);if(!this._skipValidation){this._validateMapping(r,n,t,i)}if(t!=null){t=String(t);if(!this._sources.has(t)){this._sources.add(t)}}if(i!=null){i=String(i);if(!this._names.has(i)){this._names.add(i)}}this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:t,name:i})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(e,r){var n=e;if(this._sourceRoot!=null){n=o.relative(this._sourceRoot,n)}if(r!=null){if(!this._sourcesContents){this._sourcesContents=Object.create(null)}this._sourcesContents[o.toSetString(n)]=r}else if(this._sourcesContents){delete this._sourcesContents[o.toSetString(n)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(e,r,n){var t=r;if(r==null){if(e.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}t=e.file}var a=this._sourceRoot;if(a!=null){t=o.relative(a,t)}var u=new i;var s=new i;this._mappings.unsortedForEach((function(r){if(r.source===t&&r.originalLine!=null){var i=e.originalPositionFor({line:r.originalLine,column:r.originalColumn});if(i.source!=null){r.source=i.source;if(n!=null){r.source=o.join(n,r.source)}if(a!=null){r.source=o.relative(a,r.source)}r.originalLine=i.line;r.originalColumn=i.column;if(i.name!=null){r.name=i.name}}}var l=r.source;if(l!=null&&!u.has(l)){u.add(l)}var c=r.name;if(c!=null&&!s.has(c)){s.add(c)}}),this);this._sources=u;this._names=s;e.sources.forEach((function(r){var t=e.sourceContentFor(r);if(t!=null){if(n!=null){r=o.join(n,r)}if(a!=null){r=o.relative(a,r)}this.setSourceContent(r,t)}}),this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(e,r,n,t){if(r&&typeof r.line!=="number"&&typeof r.column!=="number"){throw new Error("original.line and original.column are not numbers -- you probably meant to omit "+"the original mapping entirely and only map the generated position. If so, pass "+"null for the original mapping instead of an object with empty or null values.")}if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!n&&!t){return}else if(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&n){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:r,name:t}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var e=0;var r=1;var n=0;var i=0;var a=0;var u=0;var s="";var l;var c;var p;var f;var g=this._mappings.toArray();for(var h=0,d=g.length;h0){if(!o.compareByGeneratedPositionsInflated(c,g[h-1])){continue}l+=","}}l+=t.encode(c.generatedColumn-e);e=c.generatedColumn;if(c.source!=null){f=this._sources.indexOf(c.source);l+=t.encode(f-u);u=f;l+=t.encode(c.originalLine-1-i);i=c.originalLine-1;l+=t.encode(c.originalColumn-n);n=c.originalColumn;if(c.name!=null){p=this._names.indexOf(c.name);l+=t.encode(p-a);a=p}}s+=l}return s};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(e,r){return e.map((function(e){if(!this._sourcesContents){return null}if(r!=null){e=o.relative(r,e)}var n=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){e.file=this._file}if(this._sourceRoot!=null){e.sourceRoot=this._sourceRoot}if(this._sourcesContents){e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)}return e};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON())};r.h=SourceMapGenerator},351:(e,r,n)=>{var t;var o=n(591).h;var i=n(339);var a=/(\r?\n)/;var u=10;var s="$$$isSourceNode$$$";function SourceNode(e,r,n,t,o){this.children=[];this.sourceContents={};this.line=e==null?null:e;this.column=r==null?null:r;this.source=n==null?null:n;this.name=o==null?null:o;this[s]=true;if(t!=null)this.add(t)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(e,r,n){var t=new SourceNode;var o=e.split(a);var u=0;var shiftNextLine=function(){var e=getNextLine();var r=getNextLine()||"";return e+r;function getNextLine(){return u=0;r--){this.prepend(e[r])}}else if(e[s]||typeof e==="string"){this.children.unshift(e)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e)}return this};SourceNode.prototype.walk=function SourceNode_walk(e){var r;for(var n=0,t=this.children.length;n0){r=[];for(n=0;n{function getArg(e,r,n){if(r in e){return e[r]}else if(arguments.length===3){return n}else{throw new Error('"'+r+'" is a required argument.')}}r.getArg=getArg;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;var t=/^data:.+\,.+$/;function urlParse(e){var r=e.match(n);if(!r){return null}return{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[5]}}r.urlParse=urlParse;function urlGenerate(e){var r="";if(e.scheme){r+=e.scheme+":"}r+="//";if(e.auth){r+=e.auth+"@"}if(e.host){r+=e.host}if(e.port){r+=":"+e.port}if(e.path){r+=e.path}return r}r.urlGenerate=urlGenerate;function normalize(e){var n=e;var t=urlParse(e);if(t){if(!t.path){return e}n=t.path}var o=r.isAbsolute(n);var i=n.split(/\/+/);for(var a,u=0,s=i.length-1;s>=0;s--){a=i[s];if(a==="."){i.splice(s,1)}else if(a===".."){u++}else if(u>0){if(a===""){i.splice(s+1,u);u=0}else{i.splice(s,2);u--}}}n=i.join("/");if(n===""){n=o?"/":"."}if(t){t.path=n;return urlGenerate(t)}return n}r.normalize=normalize;function join(e,r){if(e===""){e="."}if(r===""){r="."}var n=urlParse(r);var o=urlParse(e);if(o){e=o.path||"/"}if(n&&!n.scheme){if(o){n.scheme=o.scheme}return urlGenerate(n)}if(n||r.match(t)){return r}if(o&&!o.host&&!o.path){o.host=r;return urlGenerate(o)}var i=r.charAt(0)==="/"?r:normalize(e.replace(/\/+$/,"")+"/"+r);if(o){o.path=i;return urlGenerate(o)}return i}r.join=join;r.isAbsolute=function(e){return e.charAt(0)==="/"||n.test(e)};function relative(e,r){if(e===""){e="."}e=e.replace(/\/$/,"");var n=0;while(r.indexOf(e+"/")!==0){var t=e.lastIndexOf("/");if(t<0){return r}e=e.slice(0,t);if(e.match(/^([^\/]+:\/)?\/*$/)){return r}++n}return Array(n+1).join("../")+r.substr(e.length+1)}r.relative=relative;var o=function(){var e=Object.create(null);return!("__proto__"in e)}();function identity(e){return e}function toSetString(e){if(isProtoString(e)){return"$"+e}return e}r.toSetString=o?identity:toSetString;function fromSetString(e){if(isProtoString(e)){return e.slice(1)}return e}r.fromSetString=o?identity:fromSetString;function isProtoString(e){if(!e){return false}var r=e.length;if(r<9){return false}if(e.charCodeAt(r-1)!==95||e.charCodeAt(r-2)!==95||e.charCodeAt(r-3)!==111||e.charCodeAt(r-4)!==116||e.charCodeAt(r-5)!==111||e.charCodeAt(r-6)!==114||e.charCodeAt(r-7)!==112||e.charCodeAt(r-8)!==95||e.charCodeAt(r-9)!==95){return false}for(var n=r-10;n>=0;n--){if(e.charCodeAt(n)!==36){return false}}return true}function compareByOriginalPositions(e,r,n){var t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0||n){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0){return t}t=e.generatedLine-r.generatedLine;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositionsDeflated(e,r,n){var t=e.generatedLine-r.generatedLine;if(t!==0){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0||n){return t}t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsDeflated=compareByGeneratedPositionsDeflated;function strcmp(e,r){if(e===r){return 0}if(e===null){return 1}if(r===null){return-1}if(e>r){return 1}return-1}function compareByGeneratedPositionsInflated(e,r){var n=e.generatedLine-r.generatedLine;if(n!==0){return n}n=e.generatedColumn-r.generatedColumn;if(n!==0){return n}n=strcmp(e.source,r.source);if(n!==0){return n}n=e.originalLine-r.originalLine;if(n!==0){return n}n=e.originalColumn-r.originalColumn;if(n!==0){return n}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}r.parseSourceMapInput=parseSourceMapInput;function computeSourceURL(e,r,n){r=r||"";if(e){if(e[e.length-1]!=="/"&&r[0]!=="/"){e+="/"}r=e+r}if(n){var t=urlParse(n);if(!t){throw new Error("sourceMapURL could not be parsed")}if(t.path){var o=t.path.lastIndexOf("/");if(o>=0){t.path=t.path.substring(0,o+1)}}r=join(urlGenerate(t),r)}return normalize(r)}r.computeSourceURL=computeSourceURL},997:(e,r,n)=>{n(591).h;r.SourceMapConsumer=n(952).SourceMapConsumer;n(351)},284:(e,r,n)=>{e=n.nmd(e);var t=n(997).SourceMapConsumer;var o=n(17);var i;try{i=n(147);if(!i.existsSync||!i.readFileSync){i=null}}catch(e){}var a=n(650);function dynamicRequire(e,r){return e.require(r)}var u=false;var s=false;var l=false;var c="auto";var p={};var f={};var g=/^data:application\/json[^,]+base64,/;var h=[];var d=[];function isInBrowser(){if(c==="browser")return true;if(c==="node")return false;return typeof window!=="undefined"&&typeof XMLHttpRequest==="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function hasGlobalProcessEventEmitter(){return typeof process==="object"&&process!==null&&typeof process.on==="function"}function globalProcessVersion(){if(typeof process==="object"&&process!==null){return process.version}else{return""}}function globalProcessStderr(){if(typeof process==="object"&&process!==null){return process.stderr}}function globalProcessExit(e){if(typeof process==="object"&&process!==null&&typeof process.exit==="function"){return process.exit(e)}}function handlerExec(e){return function(r){for(var n=0;n"}var n=this.getLineNumber();if(n!=null){r+=":"+n;var t=this.getColumnNumber();if(t){r+=":"+t}}}var o="";var i=this.getFunctionName();var a=true;var u=this.isConstructor();var s=!(this.isToplevel()||u);if(s){var l=this.getTypeName();if(l==="[object Object]"){l="null"}var c=this.getMethodName();if(i){if(l&&i.indexOf(l)!=0){o+=l+"."}o+=i;if(c&&i.indexOf("."+c)!=i.length-c.length-1){o+=" [as "+c+"]"}}else{o+=l+"."+(c||"")}}else if(u){o+="new "+(i||"")}else if(i){o+=i}else{o+=r;a=false}if(a){o+=" ("+r+")"}return o}function cloneCallSite(e){var r={};Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(n){r[n]=/^(?:is|get)/.test(n)?function(){return e[n].call(e)}:e[n]}));r.toString=CallSiteToString;return r}function wrapCallSite(e,r){if(r===undefined){r={nextPosition:null,curPosition:null}}if(e.isNative()){r.curPosition=null;return e}var n=e.getFileName()||e.getScriptNameOrSourceURL();if(n){var t=e.getLineNumber();var o=e.getColumnNumber()-1;var i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;var a=i.test(globalProcessVersion())?0:62;if(t===1&&o>a&&!isInBrowser()&&!e.isEval()){o-=a}var u=mapSourcePosition({source:n,line:t,column:o});r.curPosition=u;e=cloneCallSite(e);var s=e.getFunctionName;e.getFunctionName=function(){if(r.nextPosition==null){return s()}return r.nextPosition.name||s()};e.getFileName=function(){return u.source};e.getLineNumber=function(){return u.line};e.getColumnNumber=function(){return u.column+1};e.getScriptNameOrSourceURL=function(){return u.source};return e}var l=e.isEval()&&e.getEvalOrigin();if(l){l=mapEvalOrigin(l);e=cloneCallSite(e);e.getEvalOrigin=function(){return l};return e}return e}function prepareStackTrace(e,r){if(l){p={};f={}}var n=e.name||"Error";var t=e.message||"";var o=n+": "+t;var i={nextPosition:null,curPosition:null};var a=[];for(var u=r.length-1;u>=0;u--){a.push("\n at "+wrapCallSite(r[u],i));i.nextPosition=i.curPosition}i.curPosition=i.nextPosition=null;return o+a.reverse().join("")}function getErrorSource(e){var r=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(r){var n=r[1];var t=+r[2];var o=+r[3];var a=p[n];if(!a&&i&&i.existsSync(n)){try{a=i.readFileSync(n,"utf8")}catch(e){a=""}}if(a){var u=a.split(/(?:\r\n|\r|\n)/)[t-1];if(u){return n+":"+t+"\n"+u+"\n"+new Array(o).join(" ")+"^"}}}return null}function printErrorAndExit(e){var r=getErrorSource(e);var n=globalProcessStderr();if(n&&n._handle&&n._handle.setBlocking){n._handle.setBlocking(true)}if(r){console.error();console.error(r)}console.error(e.stack);globalProcessExit(1)}function shimEmitUncaughtException(){var e=process.emit;process.emit=function(r){if(r==="uncaughtException"){var n=arguments[1]&&arguments[1].stack;var t=this.listeners(r).length>0;if(n&&!t){return printErrorAndExit(arguments[1])}}return e.apply(this,arguments)}}var S=h.slice(0);var _=d.slice(0);r.wrapCallSite=wrapCallSite;r.getErrorSource=getErrorSource;r.mapSourcePosition=mapSourcePosition;r.retrieveSourceMap=v;r.install=function(r){r=r||{};if(r.environment){c=r.environment;if(["node","browser","auto"].indexOf(c)===-1){throw new Error("environment "+c+" was unknown. Available options are {auto, browser, node}")}}if(r.retrieveFile){if(r.overrideRetrieveFile){h.length=0}h.unshift(r.retrieveFile)}if(r.retrieveSourceMap){if(r.overrideRetrieveSourceMap){d.length=0}d.unshift(r.retrieveSourceMap)}if(r.hookRequire&&!isInBrowser()){var n=dynamicRequire(e,"module");var t=n.prototype._compile;if(!t.__sourceMapSupport){n.prototype._compile=function(e,r){p[r]=e;f[r]=undefined;return t.call(this,e,r)};n.prototype._compile.__sourceMapSupport=true}}if(!l){l="emptyCacheBetweenOperations"in r?r.emptyCacheBetweenOperations:false}if(!u){u=true;Error.prepareStackTrace=prepareStackTrace}if(!s){var o="handleUncaughtExceptions"in r?r.handleUncaughtExceptions:true;try{var i=dynamicRequire(e,"worker_threads");if(i.isMainThread===false){o=false}}catch(e){}if(o&&hasGlobalProcessEventEmitter()){s=true;shimEmitUncaughtException()}}};r.resetRetrieveHandlers=function(){h.length=0;d.length=0;h=S.slice(0);d=_.slice(0);v=handlerExec(d);m=handlerExec(h)}},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")}};var r={};function __webpack_require__(n){var t=r[n];if(t!==undefined){return t.exports}var o=r[n]={id:n,loaded:false,exports:{}};var i=true;try{e[n](o,o.exports,__webpack_require__);i=false}finally{if(i)delete r[n]}o.loaded=true;return o.exports}(()=>{__webpack_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __webpack_require__!=="undefined")__webpack_require__.ab=__dirname+"/";var n={};(()=>{__webpack_require__(284).install()})();module.exports=n})(); -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | moduleFileExtensions: ['js', 'ts'], 4 | testMatch: ['**/*.test.ts'], 5 | transform: { 6 | '^.+\\.ts$': 'ts-jest' 7 | }, 8 | verbose: true 9 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@oxidize-rb/cross-gem-action", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "Cross compiles a native Ruby gem written in Rust", 6 | "main": "lib/main.js", 7 | "scripts": { 8 | "build": "tsc", 9 | "format": "prettier --write '**/*.{ts,md,yml}'", 10 | "format-check": "prettier --check '**/*.{ts,md,yml}'", 11 | "lint": "eslint --fix src/**/*.ts", 12 | "package": "ncc build --source-map --license licenses.txt", 13 | "test": "npm run build && jest", 14 | "all": "npm run build && npm run format && npm run lint && npm run package && npm test" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "git+https://github.com/oxidize-rs/cross-gem-action.git" 19 | }, 20 | "keywords": [ 21 | "actions", 22 | "rust", 23 | "ruby" 24 | ], 25 | "author": "Ian Ker-Seymer", 26 | "license": "MIT", 27 | "dependencies": { 28 | "@actions/artifact": "^1.1.1", 29 | "@actions/core": "^1.10.0", 30 | "@actions/exec": "^1.1.1", 31 | "@actions/glob": "^0.4.0", 32 | "@actions/http-client": "^2.0.1" 33 | }, 34 | "devDependencies": { 35 | "@types/node": "^18.11.19", 36 | "@typescript-eslint/parser": "^5.50.0", 37 | "@vercel/ncc": "^0.36.1", 38 | "eslint": "^8.33.0", 39 | "eslint-plugin-github": "^4.6.0", 40 | "eslint-plugin-jest": "^27.2.1", 41 | "eslint-plugin-prettier": "^4.2.1", 42 | "jest": "^27.2.5", 43 | "js-yaml": "^4.1.0", 44 | "prettier": "^2.8.3", 45 | "ts-jest": "^27.1.2", 46 | "typescript": "^4.9.5" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/compile.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core' 2 | import {Input} from './input' 3 | import {exec} from '@actions/exec' 4 | import {fetchRubyToRustMapping, parseEnvString, shellEscape} from './utils' 5 | 6 | const LINKER_MAPPING: {[k: string]: string | undefined} = { 7 | 'x86_64-linux': 'x86_64-linux-gnu-gcc', 8 | 'x86_64-linux-musl': 'x86_64-unknown-linux-musl-gcc', 9 | 'aarch64-linux': 'aarch64-linux-gnu-gcc', 10 | 'arm64-darwin': 'aarch64-apple-darwin-clang', 11 | 'x86_64-darwin': 'x86_64-apple-darwin-clang', 12 | 'x64-mingw32': 'x86_64-w64-mingw32-gcc', 13 | 'x64-mingw32-ucrt': 'x86_64-w64-mingw32-gcc' 14 | } 15 | 16 | export async function compileGem( 17 | input: Input, 18 | executor: typeof exec | undefined = exec 19 | ): Promise { 20 | core.debug(`Invoking rake-compiler-dock ${input.platform}`) 21 | 22 | const steps = [] 23 | const parsedEnv = parseEnvString(input.env || '') 24 | const versionString = input.rubyVersions.join(':') 25 | 26 | for (const [key, val] of Object.entries(parsedEnv)) { 27 | steps.push(`export ${key}='${shellEscape(val, true)}'`) 28 | } 29 | 30 | if (!parsedEnv.RUBY_CC_VERSION) { 31 | steps.push(`export RUBY_CC_VERSION='${versionString}'`) 32 | } 33 | 34 | if (input.useRubyLinkerForCargo) { 35 | const rustPlatform = (await fetchRubyToRustMapping())[input.platform] 36 | 37 | const envVar = `CARGO_TARGET_${rustPlatform}_LINKER` 38 | .replace(/-/g, '_') 39 | .toUpperCase() 40 | 41 | const linker = LINKER_MAPPING[input.platform] 42 | 43 | if (linker) { 44 | steps.push(`export ${envVar}='${linker}'`) 45 | } else { 46 | core.setOutput('warning', `No linker mapping for ${input.platform}`) 47 | } 48 | } 49 | 50 | if (input.setup) { 51 | steps.push(shellEscape(input.setup)) 52 | } 53 | 54 | if (input.command) { 55 | steps.push(shellEscape(input.command)) 56 | } 57 | 58 | const fullCommand = steps 59 | .filter(item => item != null && item !== '') 60 | .join('\n') 61 | 62 | const args: string[] = ['bash', '-c', fullCommand] 63 | 64 | try { 65 | await executor('rake-compiler-dock', args, { 66 | cwd: input.directory 67 | }) 68 | } catch (error) { 69 | core.error('Error compiling gem') 70 | throw error 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/input.ts: -------------------------------------------------------------------------------- 1 | import {getInput, info} from '@actions/core' 2 | import path from 'path' 3 | import {statSync} from 'fs' 4 | import {fetchValidPlatforms} from './utils' 5 | 6 | // Parsed action input 7 | export interface Input { 8 | platform: string 9 | directory: string 10 | version: string 11 | rubyVersions: string[] 12 | env: string | null 13 | command: string 14 | useRubyLinkerForCargo: boolean 15 | setup: string | null 16 | } 17 | 18 | export async function loadInput(): Promise { 19 | const platform = getInput('platform', {required: true}) 20 | const validPlatforms = await fetchValidPlatforms() 21 | 22 | if (!validPlatforms.includes(platform)) { 23 | throw new Error( 24 | `Unsupported platform: ${platform}. Must be one of ${validPlatforms.join( 25 | ', ' 26 | )}` 27 | ) 28 | } 29 | 30 | const directory = getInput('directory') || process.cwd() 31 | const rubyVersions = parseRubyVersions(getInput('ruby-versions')) 32 | 33 | try { 34 | statSync(path.join(directory, 'Rakefile')).isFile() 35 | } catch (_e) { 36 | throw new Error(`Could not find Rakefile in directory: ${directory}`) 37 | } 38 | 39 | return { 40 | platform, 41 | directory, 42 | rubyVersions, 43 | version: getInput('version'), 44 | useRubyLinkerForCargo: getInput('use-ruby-linker-for-cargo') === 'true', 45 | env: getInput('env') || null, 46 | setup: getInput('setup') || 'bundle install || gem install rb_sys', 47 | command: getInput('command') || `bundle exec rake native:${platform} gem` 48 | } 49 | } 50 | 51 | function parseRubyVersions(input: string): string[] { 52 | const rawVersions = input.split(',').map(s => s.trim()) 53 | 54 | // Add a patch version if it's missing 55 | const sanitizedVersions = rawVersions 56 | .map(version => { 57 | return version.split('.').length === 2 ? `${version}.0` : version 58 | }) 59 | .sort(undefined) 60 | .reverse() 61 | 62 | // Remove duplicates 63 | const filtered = sanitizedVersions.filter( 64 | (version, index) => sanitizedVersions.indexOf(version) === index 65 | ) 66 | 67 | // Ensure valid versions 68 | for (const version of filtered) { 69 | if (!version.match(/^\d\.\d\.0$/)) { 70 | throw new Error(`Invalid Ruby version: ${version}`) 71 | } 72 | } 73 | 74 | info(`Using Ruby versions: ${filtered.join(', ')}`) 75 | return filtered 76 | } 77 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core' 2 | import {compileGem} from './compile' 3 | import {loadInput} from './input' 4 | import {setup} from './setup' 5 | import {uploadGem} from './upload' 6 | 7 | async function run(): Promise { 8 | core.warning( 9 | 'This action is deprecated. Please use oxidize-rb/actions/cross-gem instead (https://github.com/oxidize-rb/actions/blob/main/cross-gem/readme.md).' 10 | ) 11 | 12 | try { 13 | const input = await loadInput() 14 | 15 | await setup(input) 16 | await compileGem(input) 17 | await uploadGem(input) 18 | } catch (error) { 19 | if (error instanceof Error) core.setFailed(error.message) 20 | } 21 | } 22 | 23 | run() 24 | -------------------------------------------------------------------------------- /src/setup.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core' 2 | import {Input} from './input' 3 | import {exec} from '@actions/exec' 4 | 5 | async function installDeps(): Promise { 6 | core.debug(`Installing dependencies`) 7 | 8 | try { 9 | await exec('gem', ['install', 'rake-compiler', 'rake-compiler-dock']) 10 | } catch (error) { 11 | core.error('Error compiling gem') 12 | throw error 13 | } 14 | } 15 | 16 | async function setupDocker(input: Input): Promise { 17 | try { 18 | core.debug('Setup docker buildx') 19 | await exec('docker', [ 20 | 'buildx', 21 | 'create', 22 | '--driver', 23 | 'docker-container', 24 | '--name', 25 | `cross-gem-builder-${input.platform}-${input.version}`, 26 | '--use' 27 | ]) 28 | } catch (error) { 29 | core.error('Could not setup buildx driver') 30 | throw error 31 | } 32 | 33 | try { 34 | const image = `rbsys/${input.platform}:${input.version}` 35 | core.debug(`Downloading docker image: ${image}`) 36 | await exec('docker', ['pull', image, '--quiet']) 37 | } catch (error) { 38 | core.error('Error pulling rcd image') 39 | throw error 40 | } 41 | 42 | setEnv('RCD_DOCKER_BUILD', 'docker buildx build') 43 | setEnv('RCD_IMAGE', `rbsys/${input.platform}:${input.version}`) 44 | } 45 | 46 | function setEnv(name: string, value: string): void { 47 | core.exportVariable(name, value) 48 | process.env[name] = value 49 | } 50 | 51 | export async function setup(input: Input): Promise { 52 | core.debug(`Compiling native gem for ${input.platform}`) 53 | await Promise.all([setupDocker(input), installDeps()]) 54 | } 55 | -------------------------------------------------------------------------------- /src/upload.ts: -------------------------------------------------------------------------------- 1 | import * as artifact from '@actions/artifact' 2 | import * as glob from '@actions/glob' 3 | import {Input} from './input' 4 | import {getInput, setOutput} from '@actions/core' 5 | 6 | export async function uploadGem( 7 | input: Input 8 | ): Promise { 9 | const artifactClient = artifact.create() 10 | const artifactName = getInput('artifact-name') 11 | const files = await findGem(input) 12 | const rootDirectory = input.directory 13 | const options = {continueOnError: false} 14 | 15 | const uploadResponse = await artifactClient.uploadArtifact( 16 | artifactName, 17 | files, 18 | rootDirectory, 19 | options 20 | ) 21 | 22 | setOutput('artifact-name', uploadResponse.artifactName) 23 | setOutput('artifact-items', uploadResponse.artifactItems) 24 | 25 | return uploadResponse 26 | } 27 | 28 | async function findGem(input: Input): Promise { 29 | const patterns = [`**/pkg/*-${input.platform}.gem`] 30 | const globber = await glob.create(patterns.join('\n')) 31 | return globber.glob() 32 | } 33 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | import {HttpClient} from '@actions/http-client' 2 | 3 | const http = new HttpClient('cross-gem-action') 4 | 5 | let RUBY_TO_RUST: Record 6 | 7 | export async function fetchRubyToRustMapping(): Promise { 8 | if (RUBY_TO_RUST) { 9 | return RUBY_TO_RUST 10 | } 11 | 12 | const res = await http.get( 13 | 'https://raw.githubusercontent.com/oxidize-rb/rb-sys/main/data/derived/ruby-to-rust.json' 14 | ) 15 | const body = await res.readBody() 16 | const json = JSON.parse(body) 17 | 18 | RUBY_TO_RUST = json 19 | 20 | return json 21 | } 22 | 23 | export async function fetchValidPlatforms(): Promise { 24 | const mappings = await fetchRubyToRustMapping() 25 | 26 | return Object.keys(mappings) 27 | } 28 | 29 | export function parseEnvString(env: string): {[k: string]: string} { 30 | const result: {[k: string]: string} = {} 31 | 32 | for (const line of env.split('\n')) { 33 | const [key, value] = line.split('=', 2) 34 | 35 | if (key && value && key.match(/^[a-zA-Z0-9_]+$/)) { 36 | const quoteRemoved = value.replace(/^"|"$/g, '').replace(/^'|'$/g, '') 37 | result[key] = quoteRemoved 38 | } 39 | } 40 | 41 | return result 42 | } 43 | 44 | export function shellEscape( 45 | arg: string | null | undefined, 46 | quoted = false 47 | ): string { 48 | if (arg == null) { 49 | return '' 50 | } 51 | // eslint-disable-next-line no-control-regex 52 | let result = arg.replace(/[\0\u0008\u001B\u009B]/gu, '') 53 | 54 | if (quoted) { 55 | result = result.replace(/'/gu, `'\\''`) 56 | } 57 | 58 | result = result.replace(/\r(?!\n)/gu, '') 59 | 60 | return result 61 | } 62 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 4 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 5 | "outDir": "./lib", /* Redirect output structure to the directory. */ 6 | "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 7 | "strict": true, /* Enable all strict type-checking options. */ 8 | "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 9 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 10 | }, 11 | "exclude": ["node_modules", "**/*.test.ts"] 12 | } 13 | --------------------------------------------------------------------------------