├── .prettierignore ├── .eslintignore ├── .prettierrc.yml ├── .browserslistrc ├── .yarnrc.yml ├── frender ├── src │ └── lib.rs ├── README.md ├── .gitignore ├── tests │ └── web.rs ├── Cargo.toml ├── LICENSE_MIT └── LICENSE_APACHE ├── .husky └── pre-commit ├── Cargo.toml ├── .lintstagedrc.yml ├── .yarn └── sdks │ ├── eslint │ ├── package.json │ ├── lib │ │ └── api.js │ └── bin │ │ └── eslint.js │ ├── prettier │ ├── package.json │ └── index.js │ ├── integrations.yml │ └── typescript │ ├── package.json │ ├── bin │ ├── tsc │ └── tsserver │ └── lib │ ├── tsc.js │ ├── typescript.js │ ├── tsserver.js │ └── tsserverlibrary.js ├── .vscode ├── extensions.json └── settings.json ├── jest.config.js ├── .editorconfig ├── babel.config.js ├── tsconfig.json ├── .github ├── FUNDING.yml └── workflows │ └── release.yml ├── LICENSE ├── .eslintrc.js ├── release.config.js ├── package.json ├── README.md ├── CHANGELOG.md ├── .gitignore ├── logo.svg └── Cargo.lock /.prettierignore: -------------------------------------------------------------------------------- 1 | /.yarn 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /.yarn 3 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | "trailingComma": "all" 2 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | maintained node versions 3 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | yarnPath: ".yarn/releases/yarn-berry.js" 2 | -------------------------------------------------------------------------------- /frender/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod utils; 2 | 3 | use wasm_bindgen::prelude::*; 4 | -------------------------------------------------------------------------------- /frender/README.md: -------------------------------------------------------------------------------- 1 | # frender 2 | 3 | Functional rendering: `React` in `Rust` 4 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn lint-staged 5 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | 3 | members = [ 4 | "frender", 5 | "examples/*", 6 | ] 7 | -------------------------------------------------------------------------------- /frender/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock 4 | bin/ 5 | pkg/ 6 | wasm-pack.log 7 | -------------------------------------------------------------------------------- /.lintstagedrc.yml: -------------------------------------------------------------------------------- 1 | "!(.yarn)/**/*.{js,ts}": "yarn run lint:fix" 2 | "*.{md,html,css,yml,yaml,json}": "prettier --write" 3 | -------------------------------------------------------------------------------- /.yarn/sdks/eslint/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint", 3 | "version": "8.1.0-sdk", 4 | "main": "./lib/api.js", 5 | "type": "commonjs" 6 | } 7 | -------------------------------------------------------------------------------- /.yarn/sdks/prettier/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prettier", 3 | "version": "2.4.1-sdk", 4 | "main": "./index.js", 5 | "type": "commonjs" 6 | } 7 | -------------------------------------------------------------------------------- /.yarn/sdks/integrations.yml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by @yarnpkg/sdks. 2 | # Manual changes might be lost! 3 | 4 | integrations: 5 | - vscode 6 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript", 3 | "version": "4.4.4-sdk", 4 | "main": "./lib/typescript.js", 5 | "type": "commonjs" 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "arcanis.vscode-zipfs", 4 | "dbaeumer.vscode-eslint", 5 | "esbenp.prettier-vscode" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | testEnvironment: "node", 4 | globals: { 5 | "ts-jest": { 6 | babelConfig: true, 7 | }, 8 | }, 9 | modulePathIgnorePatterns: ["dist"], 10 | }; 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.{toml,rs}] 12 | indent_size = 4 13 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | [ 4 | "@babel/env", 5 | { 6 | useBuiltIns: "usage", 7 | corejs: { 8 | version: 3, 9 | }, 10 | }, 11 | ], 12 | ], 13 | }; 14 | -------------------------------------------------------------------------------- /frender/tests/web.rs: -------------------------------------------------------------------------------- 1 | //! Test suite for the Web and headless browsers. 2 | 3 | #![cfg(target_arch = "wasm32")] 4 | 5 | extern crate wasm_bindgen_test; 6 | use wasm_bindgen_test::*; 7 | 8 | wasm_bindgen_test_configure!(run_in_browser); 9 | 10 | #[wasm_bindgen_test] 11 | fn pass() { 12 | assert_eq!(1 + 1, 2); 13 | } 14 | -------------------------------------------------------------------------------- /frender/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "frender" 3 | version = "0.1.0" 4 | authors = ["EqualMa "] 5 | edition = "2018" 6 | 7 | [lib] 8 | crate-type = ["cdylib", "rlib"] 9 | 10 | [dependencies] 11 | wasm-bindgen = "0.2.63" 12 | react-sys = "1.0.0-alpha.4" 13 | 14 | [dev-dependencies] 15 | wasm-bindgen-test = "0.3.13" 16 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.procMacro.enable": true, 3 | "rust-analyzer.experimental.procAttrMacros": true, 4 | "search.exclude": { 5 | "**/.yarn": true, 6 | "**/.pnp.*": true 7 | }, 8 | "eslint.nodePath": ".yarn/sdks", 9 | "prettier.prettierPath": ".yarn/sdks/prettier/index.js", 10 | "typescript.tsdk": ".yarn/sdks/typescript/lib", 11 | "typescript.enablePromptUseWorkspaceTsdk": true 12 | } 13 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": true, 6 | "moduleResolution": "node", 7 | "resolveJsonModule": true, 8 | "allowSyntheticDefaultImports": true, 9 | "forceConsistentCasingInFileNames": true 10 | }, 11 | "include": ["**/*.ts"], 12 | "ts-node": { 13 | "compilerOptions": { 14 | "skipLibCheck": true, 15 | "target": "ES6", 16 | "module": "CommonJS" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.yarn/sdks/prettier/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require prettier/index.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real prettier/index.js your application uses 20 | module.exports = absRequire(`prettier/index.js`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/eslint/lib/api.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require eslint/lib/api.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real eslint/lib/api.js your application uses 20 | module.exports = absRequire(`eslint/lib/api.js`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/bin/tsc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/bin/tsc 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/bin/tsc your application uses 20 | module.exports = absRequire(`typescript/bin/tsc`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/eslint/bin/eslint.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require eslint/bin/eslint.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real eslint/bin/eslint.js your application uses 20 | module.exports = absRequire(`eslint/bin/eslint.js`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/lib/tsc.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/lib/tsc.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/lib/tsc.js your application uses 20 | module.exports = absRequire(`typescript/lib/tsc.js`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/bin/tsserver: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/bin/tsserver 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/bin/tsserver your application uses 20 | module.exports = absRequire(`typescript/bin/tsserver`); 21 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/lib/typescript.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | if (existsSync(absPnpApiPath)) { 13 | if (!process.versions.pnp) { 14 | // Setup the environment to be able to require typescript/lib/typescript.js 15 | require(absPnpApiPath).setup(); 16 | } 17 | } 18 | 19 | // Defer to the real typescript/lib/typescript.js your application uses 20 | module.exports = absRequire(`typescript/lib/typescript.js`); 21 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: equalma 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 EqualMa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /frender/LICENSE_MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 EqualMa 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | // https://eslint.org/docs/user-guide/configuring#specifying-environments 4 | env: { 5 | node: true, 6 | es2020: true, 7 | }, 8 | extends: [ 9 | // 10 | "eslint:recommended", 11 | "plugin:prettier/recommended", 12 | ], 13 | overrides: [ 14 | { 15 | files: [ 16 | // 17 | "./rollup.config.js", 18 | "./script-modules/**/*.js", 19 | ], 20 | parserOptions: { 21 | sourceType: "module", 22 | }, 23 | }, 24 | { 25 | files: "*.ts", 26 | parser: "@typescript-eslint/parser", 27 | parserOptions: { 28 | tsconfigRootDir: __dirname, 29 | project: "./tsconfig.json", 30 | }, 31 | plugins: ["prettier", "@typescript-eslint"], 32 | extends: [ 33 | "eslint:recommended", 34 | "plugin:@typescript-eslint/eslint-recommended", 35 | "plugin:@typescript-eslint/recommended", 36 | "plugin:prettier/recommended", 37 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 38 | ], 39 | rules: { 40 | "@typescript-eslint/explicit-function-return-type": "off", 41 | }, 42 | }, 43 | ], 44 | }; 45 | -------------------------------------------------------------------------------- /release.config.js: -------------------------------------------------------------------------------- 1 | const CARGO_PROJECTS = [ 2 | // 3 | "frender", 4 | ]; 5 | 6 | const CARGO_FILES = CARGO_PROJECTS.map((dir) => `${dir}/Cargo.toml`); 7 | 8 | module.exports = { 9 | branches: [ 10 | "+([0-9])?(.{+([0-9]),x}).x", 11 | "main", 12 | "next", 13 | "next-major", 14 | { name: "beta", prerelease: true }, 15 | { name: "alpha", prerelease: true }, 16 | ], 17 | plugins: [ 18 | "@semantic-release/commit-analyzer", 19 | "@semantic-release/release-notes-generator", 20 | "@semantic-release/changelog", 21 | [ 22 | "@google/semantic-release-replace-plugin", 23 | { 24 | replacements: [ 25 | { 26 | files: CARGO_FILES, 27 | from: 'version = ".*" # replace version', 28 | to: 'version = "${nextRelease.version}" # replace version', 29 | results: CARGO_FILES.map((file) => ({ 30 | file, 31 | hasChanged: true, 32 | numMatches: 1, 33 | numReplacements: 1, 34 | })), 35 | countMatches: true, 36 | }, 37 | ], 38 | }, 39 | ], 40 | ["@semantic-release/exec", { prepareCmd: "cargo check" }], 41 | ...CARGO_PROJECTS.map((pro) => [ 42 | "@semantic-release/exec", 43 | { publishCmd: "cargo publish", execCwd: pro }, 44 | ]), 45 | [ 46 | "@semantic-release/git", 47 | { assets: ["CHANGELOG.md", "Cargo.lock", ...CARGO_FILES] }, 48 | ], 49 | "@semantic-release/github", 50 | ], 51 | }; 52 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "description": "react in rust", 4 | "license": "MIT", 5 | "keywords": [ 6 | "rust", 7 | "ui", 8 | "frontend", 9 | "react" 10 | ], 11 | "author": "EqualMa (https://github.com/EqualMa)", 12 | "repository": "https://github.com/frender-rs/frender.git", 13 | "scripts": { 14 | "test": "jest", 15 | "lint:fix": "eslint --cache --max-warnings 0 --fix", 16 | "ensure-linted": "eslint --max-warnings 0 .", 17 | "build": "yarn run clean && rollup -c", 18 | "clean": "rimraf dist", 19 | "prepare": "husky install" 20 | }, 21 | "devDependencies": { 22 | "@babel/core": "^7.16.0", 23 | "@babel/preset-env": "^7.16.0", 24 | "@google/semantic-release-replace-plugin": "^1.1.0", 25 | "@semantic-release/changelog": "^6.0.1", 26 | "@semantic-release/exec": "^6.0.2", 27 | "@semantic-release/git": "^10.0.1", 28 | "@types/jest": "^27.0.2", 29 | "@typescript-eslint/eslint-plugin": "^5.3.0", 30 | "@typescript-eslint/parser": "^5.3.0", 31 | "babel-jest": "^27.3.1", 32 | "eslint": "^8.1.0", 33 | "eslint-config-prettier": "^8.3.0", 34 | "eslint-plugin-prettier": "^4.0.0", 35 | "husky": "^7.0.4", 36 | "jest": "^27.3.1", 37 | "lint-staged": "^11.2.6", 38 | "prettier": "2.4.1", 39 | "rimraf": "^3.0.2", 40 | "semantic-release": "^18.0.0", 41 | "ts-jest": "^27.0.7", 42 | "ts-node": "^10.4.0", 43 | "typescript": "^4.4.4" 44 | }, 45 | "dependencies": { 46 | "core-js": "^3.19.0", 47 | "tslib": "^2.3.1" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | push: 4 | branches: 5 | - main 6 | - alpha 7 | - beta 8 | jobs: 9 | release: 10 | name: Release 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Use Node.js 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: "16" 18 | # https://github.com/actions/cache/blob/master/examples.md#node---yarn 19 | - name: Get yarn cache directory path 20 | id: yarn-cache-dir-path 21 | run: echo "::set-output name=dir::$(./.yarn/cache)" 22 | - uses: actions/cache@v2 23 | id: yarn-cache 24 | with: 25 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }} 26 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 27 | restore-keys: | 28 | ${{ runner.os }}-yarn- 29 | - name: Install dependencies 30 | run: yarn install --immutable 31 | - name: Ensure linted 32 | run: yarn run ensure-linted 33 | - name: Rust Build & Test 34 | run: cargo build --verbose && cargo test --verbose 35 | - name: Release 36 | env: 37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 38 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} 39 | run: | 40 | if [ -z "$GITHUB_TOKEN" ]; then 41 | echo 'Unexpected empty GITHUB_TOKEN' >&2 42 | exit 1 43 | fi 44 | if [ -z "$CARGO_REGISTRY_TOKEN" ]; then 45 | echo 'Please set secrets.CARGO_REGISTRY_TOKEN' >&2 46 | exit 1 47 | fi 48 | yarn run semantic-release 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # frender 2 | 3 | [![Crates.io](https://img.shields.io/crates/v/frender?style=for-the-badge)](https://crates.io/crates/frender) 4 | [![docs.rs](https://img.shields.io/docsrs/frender/latest?style=for-the-badge)](https://docs.rs/frender) 5 | [![GitHub license](https://img.shields.io/github/license/frender-rs/frender?style=for-the-badge)](https://github.com/frender-rs/frender/blob/main/LICENSE) 6 | [![GitHub stars](https://img.shields.io/github/stars/frender-rs/frender?style=for-the-badge)](https://github.com/frender-rs/frender/stargazers) 7 | 8 |
9 | 10 | ![frender logo](logo.svg) 11 | 12 | Functional Rendering: `React` in `Rust` 13 | 14 |
15 | 16 | _**f**render_ is still in alpha and it's api might change. 17 | For now it is recommended to specify the exact version in `Cargo.toml`. 18 | Before updating, please see the full [changelog](https://github.com/frender-rs/frender/blob/alpha/CHANGELOG.md) in case there are breaking changes. 19 | 20 | Development is at [v2](https://github.com/frender-rs/frender/tree/v2#readme) branch. 21 | 22 | There are some example apps in 23 | [`examples`](https://github.com/frender-rs/frender/tree/v2/examples) 24 | folder. You can preview them at [this site](https://frender-rs.github.io/frender/v2/). 25 | 26 | You can quick start with the 27 | [frender book](https://frender-rs.github.io/frender/book). 28 | 29 | ## Features 30 | 31 | - Functional components and hooks 32 | - Statically typed props 33 | - SSR (Server side rendering) 34 | - [ ] hydration 35 | 36 | ## Contributing 37 | 38 | `frender` is open sourced at [GitHub](https://github.com/frender-rs/frender). 39 | Pull requests and issues are welcomed. 40 | 41 | You can also [sponsor me](https://ko-fi.com/equalma) and I would be very grateful :heart: 42 | 43 | [![Buy Me a Coffee at ko-fi.com](https://cdn.ko-fi.com/cdn/kofi2.png?v=3)](https://ko-fi.com/N4N26J11L) 44 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.2.1](https://github.com/tlibjs/package-template/compare/v1.2.0...v1.2.1) (2021-07-21) 2 | 3 | ### Bug Fixes 4 | 5 | - github release actions should check required env vars before releasing ([f70e902](https://github.com/tlibjs/package-template/commit/f70e902fa60782754b44c1f6b274644b2a05fef9)), closes [#1](https://github.com/tlibjs/package-template/issues/1) 6 | 7 | # [1.2.0](https://github.com/tlibjs/package-template/compare/v1.1.0...v1.2.0) (2021-07-20) 8 | 9 | ### Features 10 | 11 | - only keep one tsconfig ([204a972](https://github.com/tlibjs/package-template/commit/204a972af9e205d6313bc4ea556fe42cdb8c4bb3)) 12 | - ts-node demo ([78e6738](https://github.com/tlibjs/package-template/commit/78e6738d25b6ab533aa0100d1b68a41ab9fb8180)) 13 | - use typescript rollup configs ([c25cfdb](https://github.com/tlibjs/package-template/commit/c25cfdbe7b24ca82fd93b0e686d93f523a30355c)) 14 | 15 | # [1.1.0](https://github.com/tlibjs/package-template/compare/v1.0.0...v1.1.0) (2021-07-20) 16 | 17 | ### Bug Fixes 18 | 19 | - auto global namespace ([33ecbf5](https://github.com/tlibjs/package-template/commit/33ecbf5165a82e3090bbf1cddc95a178569285a9)) 20 | - set rollup output.exports to auto ([a2d4399](https://github.com/tlibjs/package-template/commit/a2d43992dd4ff8f35536e92c867999795a5ce30e)) 21 | - should use @rollup/plugin-node-resolve and @rollup/plugin-commonjs for bundle builds ([4d7774a](https://github.com/tlibjs/package-template/commit/4d7774a739ce600213e9f6ac5efd834ea8bf3e80)) 22 | 23 | ### Features 24 | 25 | - multiple entry points ([caf97f1](https://github.com/tlibjs/package-template/commit/caf97f12c56e733af6c3364be3f3f95684ec354c)) 26 | - support ie 11 ([ffe02d4](https://github.com/tlibjs/package-template/commit/ffe02d4a10a6cac7701507ea3ed9bbbd990b5a20)) 27 | 28 | # 1.0.0 (2021-07-18) 29 | 30 | ### Features 31 | 32 | - example function hello ([9a4fa99](https://github.com/tlibjs/package-template/commit/9a4fa99575359aeab5748c191ae6b3dbe2d935b0)) 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # yarn berry without zero-Installs (https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored) 2 | .pnp.* 3 | .yarn/* 4 | !.yarn/patches 5 | !.yarn/plugins 6 | !.yarn/releases 7 | !.yarn/sdks 8 | !.yarn/versions 9 | 10 | # Logs 11 | logs 12 | *.log 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | lerna-debug.log* 17 | 18 | # Diagnostic reports (https://nodejs.org/api/report.html) 19 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 20 | 21 | # Runtime data 22 | pids 23 | *.pid 24 | *.seed 25 | *.pid.lock 26 | 27 | # Directory for instrumented libs generated by jscoverage/JSCover 28 | lib-cov 29 | 30 | # Coverage directory used by tools like istanbul 31 | coverage 32 | *.lcov 33 | 34 | # nyc test coverage 35 | .nyc_output 36 | 37 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 38 | .grunt 39 | 40 | # Bower dependency directory (https://bower.io/) 41 | bower_components 42 | 43 | # node-waf configuration 44 | .lock-wscript 45 | 46 | # Compiled binary addons (https://nodejs.org/api/addons.html) 47 | build/Release 48 | 49 | # Dependency directories 50 | node_modules/ 51 | jspm_packages/ 52 | 53 | # TypeScript v1 declaration files 54 | typings/ 55 | 56 | # TypeScript cache 57 | *.tsbuildinfo 58 | 59 | # Optional npm cache directory 60 | .npm 61 | 62 | # Optional eslint cache 63 | .eslintcache 64 | 65 | # Microbundle cache 66 | .rpt2_cache/ 67 | .rts2_cache_cjs/ 68 | .rts2_cache_es/ 69 | .rts2_cache_umd/ 70 | 71 | # Optional REPL history 72 | .node_repl_history 73 | 74 | # Output of 'npm pack' 75 | *.tgz 76 | 77 | # Yarn Integrity file 78 | .yarn-integrity 79 | 80 | # dotenv environment variables file 81 | .env 82 | .env.test 83 | 84 | # parcel-bundler cache (https://parceljs.org/) 85 | .cache 86 | 87 | # Next.js build output 88 | .next 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # Serverless directories 104 | .serverless/ 105 | 106 | # FuseBox cache 107 | .fusebox/ 108 | 109 | # DynamoDB Local files 110 | .dynamodb/ 111 | 112 | # TernJS port file 113 | .tern-port 114 | 115 | # Generated by Cargo 116 | # will have compiled files and executables 117 | debug/ 118 | target/ 119 | 120 | # These are backup files generated by rustfmt 121 | **/*.rs.bk 122 | 123 | # MSVC Windows builds of rustc generate these, which store debugging information 124 | *.pdb 125 | -------------------------------------------------------------------------------- /logo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/lib/tsserver.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | const moduleWrapper = tsserver => { 13 | if (!process.versions.pnp) { 14 | return tsserver; 15 | } 16 | 17 | const {isAbsolute} = require(`path`); 18 | const pnpApi = require(`pnpapi`); 19 | 20 | const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//); 21 | const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`); 22 | 23 | const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => { 24 | return `${locator.name}@${locator.reference}`; 25 | })); 26 | 27 | // VSCode sends the zip paths to TS using the "zip://" prefix, that TS 28 | // doesn't understand. This layer makes sure to remove the protocol 29 | // before forwarding it to TS, and to add it back on all returned paths. 30 | 31 | function toEditorPath(str) { 32 | // We add the `zip:` prefix to both `.zip/` paths and virtual paths 33 | if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) { 34 | // We also take the opportunity to turn virtual paths into physical ones; 35 | // this makes it much easier to work with workspaces that list peer 36 | // dependencies, since otherwise Ctrl+Click would bring us to the virtual 37 | // file instances instead of the real ones. 38 | // 39 | // We only do this to modules owned by the the dependency tree roots. 40 | // This avoids breaking the resolution when jumping inside a vendor 41 | // with peer dep (otherwise jumping into react-dom would show resolution 42 | // errors on react). 43 | // 44 | const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str; 45 | if (resolved) { 46 | const locator = pnpApi.findPackageLocator(resolved); 47 | if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) { 48 | str = resolved; 49 | } 50 | } 51 | 52 | str = normalize(str); 53 | 54 | if (str.match(/\.zip\//)) { 55 | switch (hostInfo) { 56 | // Absolute VSCode `Uri.fsPath`s need to start with a slash. 57 | // VSCode only adds it automatically for supported schemes, 58 | // so we have to do it manually for the `zip` scheme. 59 | // The path needs to start with a caret otherwise VSCode doesn't handle the protocol 60 | // 61 | // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910 62 | // 63 | // Update Oct 8 2021: VSCode changed their format in 1.61. 64 | // Before | ^zip:/c:/foo/bar.zip/package.json 65 | // After | ^/zip//c:/foo/bar.zip/package.json 66 | // 67 | case `vscode <1.61`: { 68 | str = `^zip:${str}`; 69 | } break; 70 | 71 | case `vscode`: { 72 | str = `^/zip/${str}`; 73 | } break; 74 | 75 | // To make "go to definition" work, 76 | // We have to resolve the actual file system path from virtual path 77 | // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip) 78 | case `coc-nvim`: { 79 | str = normalize(resolved).replace(/\.zip\//, `.zip::`); 80 | str = resolve(`zipfile:${str}`); 81 | } break; 82 | 83 | // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server) 84 | // We have to resolve the actual file system path from virtual path, 85 | // everything else is up to neovim 86 | case `neovim`: { 87 | str = normalize(resolved).replace(/\.zip\//, `.zip::`); 88 | str = `zipfile:${str}`; 89 | } break; 90 | 91 | default: { 92 | str = `zip:${str}`; 93 | } break; 94 | } 95 | } 96 | } 97 | 98 | return str; 99 | } 100 | 101 | function fromEditorPath(str) { 102 | switch (hostInfo) { 103 | case `coc-nvim`: 104 | case `neovim`: { 105 | str = str.replace(/\.zip::/, `.zip/`); 106 | // The path for coc-nvim is in format of //zipfile://.yarn/... 107 | // So in order to convert it back, we use .* to match all the thing 108 | // before `zipfile:` 109 | return process.platform === `win32` 110 | ? str.replace(/^.*zipfile:\//, ``) 111 | : str.replace(/^.*zipfile:/, ``); 112 | } break; 113 | 114 | case `vscode`: 115 | default: { 116 | return process.platform === `win32` 117 | ? str.replace(/^\^?(zip:|\/zip)\/+/, ``) 118 | : str.replace(/^\^?(zip:|\/zip)\/+/, `/`); 119 | } break; 120 | } 121 | } 122 | 123 | // Force enable 'allowLocalPluginLoads' 124 | // TypeScript tries to resolve plugins using a path relative to itself 125 | // which doesn't work when using the global cache 126 | // https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238 127 | // VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but 128 | // TypeScript already does local loads and if this code is running the user trusts the workspace 129 | // https://github.com/microsoft/vscode/issues/45856 130 | const ConfiguredProject = tsserver.server.ConfiguredProject; 131 | const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype; 132 | ConfiguredProject.prototype.enablePluginsWithOptions = function() { 133 | this.projectService.allowLocalPluginLoads = true; 134 | return originalEnablePluginsWithOptions.apply(this, arguments); 135 | }; 136 | 137 | // And here is the point where we hijack the VSCode <-> TS communications 138 | // by adding ourselves in the middle. We locate everything that looks 139 | // like an absolute path of ours and normalize it. 140 | 141 | const Session = tsserver.server.Session; 142 | const {onMessage: originalOnMessage, send: originalSend} = Session.prototype; 143 | let hostInfo = `unknown`; 144 | 145 | Object.assign(Session.prototype, { 146 | onMessage(/** @type {string} */ message) { 147 | const parsedMessage = JSON.parse(message) 148 | 149 | if ( 150 | parsedMessage != null && 151 | typeof parsedMessage === `object` && 152 | parsedMessage.arguments && 153 | typeof parsedMessage.arguments.hostInfo === `string` 154 | ) { 155 | hostInfo = parsedMessage.arguments.hostInfo; 156 | if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) { 157 | hostInfo += ` <1.61`; 158 | } 159 | } 160 | 161 | return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => { 162 | return typeof value === `string` ? fromEditorPath(value) : value; 163 | })); 164 | }, 165 | 166 | send(/** @type {any} */ msg) { 167 | return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => { 168 | return typeof value === `string` ? toEditorPath(value) : value; 169 | }))); 170 | } 171 | }); 172 | 173 | return tsserver; 174 | }; 175 | 176 | if (existsSync(absPnpApiPath)) { 177 | if (!process.versions.pnp) { 178 | // Setup the environment to be able to require typescript/lib/tsserver.js 179 | require(absPnpApiPath).setup(); 180 | } 181 | } 182 | 183 | // Defer to the real typescript/lib/tsserver.js your application uses 184 | module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`)); 185 | -------------------------------------------------------------------------------- /.yarn/sdks/typescript/lib/tsserverlibrary.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const {existsSync} = require(`fs`); 4 | const {createRequire, createRequireFromPath} = require(`module`); 5 | const {resolve} = require(`path`); 6 | 7 | const relPnpApiPath = "../../../../.pnp.cjs"; 8 | 9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); 10 | const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); 11 | 12 | const moduleWrapper = tsserver => { 13 | if (!process.versions.pnp) { 14 | return tsserver; 15 | } 16 | 17 | const {isAbsolute} = require(`path`); 18 | const pnpApi = require(`pnpapi`); 19 | 20 | const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//); 21 | const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`); 22 | 23 | const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => { 24 | return `${locator.name}@${locator.reference}`; 25 | })); 26 | 27 | // VSCode sends the zip paths to TS using the "zip://" prefix, that TS 28 | // doesn't understand. This layer makes sure to remove the protocol 29 | // before forwarding it to TS, and to add it back on all returned paths. 30 | 31 | function toEditorPath(str) { 32 | // We add the `zip:` prefix to both `.zip/` paths and virtual paths 33 | if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) { 34 | // We also take the opportunity to turn virtual paths into physical ones; 35 | // this makes it much easier to work with workspaces that list peer 36 | // dependencies, since otherwise Ctrl+Click would bring us to the virtual 37 | // file instances instead of the real ones. 38 | // 39 | // We only do this to modules owned by the the dependency tree roots. 40 | // This avoids breaking the resolution when jumping inside a vendor 41 | // with peer dep (otherwise jumping into react-dom would show resolution 42 | // errors on react). 43 | // 44 | const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str; 45 | if (resolved) { 46 | const locator = pnpApi.findPackageLocator(resolved); 47 | if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) { 48 | str = resolved; 49 | } 50 | } 51 | 52 | str = normalize(str); 53 | 54 | if (str.match(/\.zip\//)) { 55 | switch (hostInfo) { 56 | // Absolute VSCode `Uri.fsPath`s need to start with a slash. 57 | // VSCode only adds it automatically for supported schemes, 58 | // so we have to do it manually for the `zip` scheme. 59 | // The path needs to start with a caret otherwise VSCode doesn't handle the protocol 60 | // 61 | // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910 62 | // 63 | // Update Oct 8 2021: VSCode changed their format in 1.61. 64 | // Before | ^zip:/c:/foo/bar.zip/package.json 65 | // After | ^/zip//c:/foo/bar.zip/package.json 66 | // 67 | case `vscode <1.61`: { 68 | str = `^zip:${str}`; 69 | } break; 70 | 71 | case `vscode`: { 72 | str = `^/zip/${str}`; 73 | } break; 74 | 75 | // To make "go to definition" work, 76 | // We have to resolve the actual file system path from virtual path 77 | // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip) 78 | case `coc-nvim`: { 79 | str = normalize(resolved).replace(/\.zip\//, `.zip::`); 80 | str = resolve(`zipfile:${str}`); 81 | } break; 82 | 83 | // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server) 84 | // We have to resolve the actual file system path from virtual path, 85 | // everything else is up to neovim 86 | case `neovim`: { 87 | str = normalize(resolved).replace(/\.zip\//, `.zip::`); 88 | str = `zipfile:${str}`; 89 | } break; 90 | 91 | default: { 92 | str = `zip:${str}`; 93 | } break; 94 | } 95 | } 96 | } 97 | 98 | return str; 99 | } 100 | 101 | function fromEditorPath(str) { 102 | switch (hostInfo) { 103 | case `coc-nvim`: 104 | case `neovim`: { 105 | str = str.replace(/\.zip::/, `.zip/`); 106 | // The path for coc-nvim is in format of //zipfile://.yarn/... 107 | // So in order to convert it back, we use .* to match all the thing 108 | // before `zipfile:` 109 | return process.platform === `win32` 110 | ? str.replace(/^.*zipfile:\//, ``) 111 | : str.replace(/^.*zipfile:/, ``); 112 | } break; 113 | 114 | case `vscode`: 115 | default: { 116 | return process.platform === `win32` 117 | ? str.replace(/^\^?(zip:|\/zip)\/+/, ``) 118 | : str.replace(/^\^?(zip:|\/zip)\/+/, `/`); 119 | } break; 120 | } 121 | } 122 | 123 | // Force enable 'allowLocalPluginLoads' 124 | // TypeScript tries to resolve plugins using a path relative to itself 125 | // which doesn't work when using the global cache 126 | // https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238 127 | // VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but 128 | // TypeScript already does local loads and if this code is running the user trusts the workspace 129 | // https://github.com/microsoft/vscode/issues/45856 130 | const ConfiguredProject = tsserver.server.ConfiguredProject; 131 | const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype; 132 | ConfiguredProject.prototype.enablePluginsWithOptions = function() { 133 | this.projectService.allowLocalPluginLoads = true; 134 | return originalEnablePluginsWithOptions.apply(this, arguments); 135 | }; 136 | 137 | // And here is the point where we hijack the VSCode <-> TS communications 138 | // by adding ourselves in the middle. We locate everything that looks 139 | // like an absolute path of ours and normalize it. 140 | 141 | const Session = tsserver.server.Session; 142 | const {onMessage: originalOnMessage, send: originalSend} = Session.prototype; 143 | let hostInfo = `unknown`; 144 | 145 | Object.assign(Session.prototype, { 146 | onMessage(/** @type {string} */ message) { 147 | const parsedMessage = JSON.parse(message) 148 | 149 | if ( 150 | parsedMessage != null && 151 | typeof parsedMessage === `object` && 152 | parsedMessage.arguments && 153 | typeof parsedMessage.arguments.hostInfo === `string` 154 | ) { 155 | hostInfo = parsedMessage.arguments.hostInfo; 156 | if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) { 157 | hostInfo += ` <1.61`; 158 | } 159 | } 160 | 161 | return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => { 162 | return typeof value === `string` ? fromEditorPath(value) : value; 163 | })); 164 | }, 165 | 166 | send(/** @type {any} */ msg) { 167 | return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => { 168 | return typeof value === `string` ? toEditorPath(value) : value; 169 | }))); 170 | } 171 | }); 172 | 173 | return tsserver; 174 | }; 175 | 176 | if (existsSync(absPnpApiPath)) { 177 | if (!process.versions.pnp) { 178 | // Setup the environment to be able to require typescript/lib/tsserverlibrary.js 179 | require(absPnpApiPath).setup(); 180 | } 181 | } 182 | 183 | // Defer to the real typescript/lib/tsserverlibrary.js your application uses 184 | module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`)); 185 | -------------------------------------------------------------------------------- /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 = "bumpalo" 7 | version = "3.8.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" 10 | 11 | [[package]] 12 | name = "cfg-if" 13 | version = "0.1.10" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 16 | 17 | [[package]] 18 | name = "cfg-if" 19 | version = "1.0.0" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 22 | 23 | [[package]] 24 | name = "console_error_panic_hook" 25 | version = "0.1.7" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" 28 | dependencies = [ 29 | "cfg-if 1.0.0", 30 | "wasm-bindgen", 31 | ] 32 | 33 | [[package]] 34 | name = "counter" 35 | version = "0.1.0" 36 | dependencies = [ 37 | "console_error_panic_hook", 38 | "js-sys", 39 | "wasm-bindgen", 40 | "wasm-bindgen-test", 41 | "web-sys", 42 | "wee_alloc", 43 | ] 44 | 45 | [[package]] 46 | name = "frender" 47 | version = "0.1.0" 48 | dependencies = [ 49 | "react-sys", 50 | "wasm-bindgen", 51 | "wasm-bindgen-test", 52 | ] 53 | 54 | [[package]] 55 | name = "js-sys" 56 | version = "0.3.55" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" 59 | dependencies = [ 60 | "wasm-bindgen", 61 | ] 62 | 63 | [[package]] 64 | name = "lazy_static" 65 | version = "1.4.0" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 68 | 69 | [[package]] 70 | name = "libc" 71 | version = "0.2.106" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673" 74 | 75 | [[package]] 76 | name = "log" 77 | version = "0.4.14" 78 | source = "registry+https://github.com/rust-lang/crates.io-index" 79 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 80 | dependencies = [ 81 | "cfg-if 1.0.0", 82 | ] 83 | 84 | [[package]] 85 | name = "memory_units" 86 | version = "0.4.0" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" 89 | 90 | [[package]] 91 | name = "proc-macro2" 92 | version = "1.0.32" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" 95 | dependencies = [ 96 | "unicode-xid", 97 | ] 98 | 99 | [[package]] 100 | name = "quote" 101 | version = "1.0.10" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" 104 | dependencies = [ 105 | "proc-macro2", 106 | ] 107 | 108 | [[package]] 109 | name = "react-sys" 110 | version = "1.0.0-alpha.4" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "37bc927ce92f429f88d9084fd3d9e20427fb750dedc1155d277601408c5be764" 113 | dependencies = [ 114 | "js-sys", 115 | "wasm-bindgen", 116 | "web-sys", 117 | ] 118 | 119 | [[package]] 120 | name = "scoped-tls" 121 | version = "1.0.0" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" 124 | 125 | [[package]] 126 | name = "syn" 127 | version = "1.0.81" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" 130 | dependencies = [ 131 | "proc-macro2", 132 | "quote", 133 | "unicode-xid", 134 | ] 135 | 136 | [[package]] 137 | name = "unicode-xid" 138 | version = "0.2.2" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 141 | 142 | [[package]] 143 | name = "wasm-bindgen" 144 | version = "0.2.78" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" 147 | dependencies = [ 148 | "cfg-if 1.0.0", 149 | "wasm-bindgen-macro", 150 | ] 151 | 152 | [[package]] 153 | name = "wasm-bindgen-backend" 154 | version = "0.2.78" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" 157 | dependencies = [ 158 | "bumpalo", 159 | "lazy_static", 160 | "log", 161 | "proc-macro2", 162 | "quote", 163 | "syn", 164 | "wasm-bindgen-shared", 165 | ] 166 | 167 | [[package]] 168 | name = "wasm-bindgen-futures" 169 | version = "0.4.28" 170 | source = "registry+https://github.com/rust-lang/crates.io-index" 171 | checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" 172 | dependencies = [ 173 | "cfg-if 1.0.0", 174 | "js-sys", 175 | "wasm-bindgen", 176 | "web-sys", 177 | ] 178 | 179 | [[package]] 180 | name = "wasm-bindgen-macro" 181 | version = "0.2.78" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" 184 | dependencies = [ 185 | "quote", 186 | "wasm-bindgen-macro-support", 187 | ] 188 | 189 | [[package]] 190 | name = "wasm-bindgen-macro-support" 191 | version = "0.2.78" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" 194 | dependencies = [ 195 | "proc-macro2", 196 | "quote", 197 | "syn", 198 | "wasm-bindgen-backend", 199 | "wasm-bindgen-shared", 200 | ] 201 | 202 | [[package]] 203 | name = "wasm-bindgen-shared" 204 | version = "0.2.78" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" 207 | 208 | [[package]] 209 | name = "wasm-bindgen-test" 210 | version = "0.3.28" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "96f1aa7971fdf61ef0f353602102dbea75a56e225ed036c1e3740564b91e6b7e" 213 | dependencies = [ 214 | "console_error_panic_hook", 215 | "js-sys", 216 | "scoped-tls", 217 | "wasm-bindgen", 218 | "wasm-bindgen-futures", 219 | "wasm-bindgen-test-macro", 220 | ] 221 | 222 | [[package]] 223 | name = "wasm-bindgen-test-macro" 224 | version = "0.3.28" 225 | source = "registry+https://github.com/rust-lang/crates.io-index" 226 | checksum = "6006f79628dfeb96a86d4db51fbf1344cd7fd8408f06fc9aa3c84913a4789688" 227 | dependencies = [ 228 | "proc-macro2", 229 | "quote", 230 | ] 231 | 232 | [[package]] 233 | name = "web-sys" 234 | version = "0.3.55" 235 | source = "registry+https://github.com/rust-lang/crates.io-index" 236 | checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" 237 | dependencies = [ 238 | "js-sys", 239 | "wasm-bindgen", 240 | ] 241 | 242 | [[package]] 243 | name = "wee_alloc" 244 | version = "0.4.5" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" 247 | dependencies = [ 248 | "cfg-if 0.1.10", 249 | "libc", 250 | "memory_units", 251 | "winapi", 252 | ] 253 | 254 | [[package]] 255 | name = "winapi" 256 | version = "0.3.9" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 259 | dependencies = [ 260 | "winapi-i686-pc-windows-gnu", 261 | "winapi-x86_64-pc-windows-gnu", 262 | ] 263 | 264 | [[package]] 265 | name = "winapi-i686-pc-windows-gnu" 266 | version = "0.4.0" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 269 | 270 | [[package]] 271 | name = "winapi-x86_64-pc-windows-gnu" 272 | version = "0.4.0" 273 | source = "registry+https://github.com/rust-lang/crates.io-index" 274 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 275 | -------------------------------------------------------------------------------- /frender/LICENSE_APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | --------------------------------------------------------------------------------