├── .DS_Store ├── .vscode └── launch.json ├── CODE_OF_CONDUCT.md ├── LICENSE.txt ├── Logo-designer-details.rtf ├── README.md ├── images ├── .DS_Store ├── Abstract-Tree.png ├── Component-Tree-Icon-Inspiration.png ├── Component-Tree-Tool.png ├── Cool-looking-use-of-tree.png ├── Grey-scale-color-palette.png ├── Inspiration-along-the-lines-of-tree.png ├── Nextjs-1.png ├── Nextjs-2.png ├── Nextjs-3.png ├── Nextjs-4.png ├── Nexus-idea.PNG ├── Roots-inspiration.png └── component-tree-example-1.png └── nexus ├── .DS_Store ├── .babelrc ├── .eslintrc.json ├── .gitignore ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── LICENSE.txt ├── README.md ├── babel-plugin-macros.config.js ├── babel.config.js ├── dist ├── sidebar.js └── sidebar.js.LICENSE.txt ├── media ├── filler.png ├── gif1.gif ├── gif2.gif ├── gif3.gif ├── icon.svg ├── logo.png ├── next-js.png ├── next-js.svg ├── nexus-vscode-icon.png ├── react-brands.png ├── react-brands.svg ├── styles.css ├── twitter-logo.svg ├── typescript.png ├── typescript.svg ├── vscode.png ├── vscode.svg ├── webpack.png └── webpack.svg ├── out ├── .DS_Store ├── NexusProvider.js ├── NexusProvider.js.map ├── extension.js ├── extension.js.map └── parser │ ├── App.jsx │ ├── Children.jsx │ ├── Nested.jsx │ ├── NextParser.js │ ├── NextParser.js.map │ ├── ReactParser.js │ ├── ReactParser.js.map │ ├── SSRComponent.jsx │ ├── ScuttleCrab.jsx │ ├── Silk.jsx │ ├── newApp.jsx │ ├── parser.js │ ├── parser.js.map │ ├── parserv2.js │ └── parserv2.js.map ├── package-lock.json ├── package.json ├── src ├── .DS_Store ├── NexusProvider.ts ├── __tests__ │ ├── next-parser-test.js │ ├── react-parser-test.js │ ├── test_components │ │ ├── App.jsx │ │ ├── Child.jsx │ │ ├── jams-n-jams-app │ │ │ ├── components │ │ │ │ ├── Cards │ │ │ │ │ ├── Card.module.css │ │ │ │ │ ├── CardEvent.js │ │ │ │ │ └── CardItem.js │ │ │ │ └── Nav │ │ │ │ │ ├── Nav.js │ │ │ │ │ └── Splash │ │ │ │ │ └── Splash.js │ │ │ └── pages │ │ │ │ ├── _app.js │ │ │ │ ├── api │ │ │ │ ├── instruments │ │ │ │ │ ├── drums │ │ │ │ │ │ ├── [id].js │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── guitars │ │ │ │ │ │ ├── [id].js │ │ │ │ │ │ └── index.js │ │ │ │ │ └── keyboards │ │ │ │ │ │ ├── [id].js │ │ │ │ │ │ └── index.js │ │ │ │ └── jams │ │ │ │ │ ├── classic │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ │ ├── conserve │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ │ └── marmalades │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ ├── events │ │ │ │ ├── calendar │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ ├── past │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ └── submit │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ ├── instruments │ │ │ │ ├── drums │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ ├── guitars │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ └── keyboards │ │ │ │ │ ├── [id].js │ │ │ │ │ └── index.js │ │ │ │ └── jams │ │ │ │ ├── classic │ │ │ │ ├── [id].js │ │ │ │ └── index.js │ │ │ │ ├── conserves │ │ │ │ ├── [id].js │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ └── marmalades │ │ │ │ ├── [id].js │ │ │ │ └── index.js │ │ └── newApp.jsx │ └── webview-test.js ├── extension.ts ├── parser │ ├── NextParser.js │ ├── NextParser.ts │ ├── ReactParser.js │ └── ReactParser.ts └── webview │ ├── AddFile.jsx │ ├── Leaf.jsx │ ├── NavLeaf.jsx │ ├── NodeWithChildren.jsx │ ├── Prop.jsx │ ├── SidebarContainer.jsx │ └── renderToDom.js ├── tsconfig.json └── webpack.config.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/.DS_Store -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [] 7 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | dplee123. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 OSLabs Beta 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 4 | associated documentation files (the "Software"), to deal in the Software without restriction, including 5 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 7 | following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial 10 | portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 13 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 14 | EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 15 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 16 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Logo-designer-details.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf2636 2 | \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | {\*\expandedcolortbl;;} 5 | \margl1440\margr1440\vieww11520\viewh8400\viewkind0 6 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 7 | 8 | \f0\fs24 \cf0 Nexus\ 9 | None\ 10 | A software development company that provides tools for senior developers to visualize their codebase and make smarter decisions\ 11 | No website yet\ 12 | \ 13 | Tree (abstract, minimalist), roots\ 14 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 13 | 14 | 15 |
16 |
17 | 18 | NexusLogo 19 | 20 | 21 |

Nexus

22 | 23 |

24 | A component tree extension for NextJS 25 |
26 |
27 | Report Bugs 28 | · 29 | Request Features 30 |

31 |
32 | 33 | 34 | 35 | 36 |
37 | Table of Contents 38 |
    39 |
  1. 40 | About The Project 41 | 44 |
  2. 45 |
  3. Installation
  4. 46 |
  5. 47 | Getting Started 48 | 51 |
  6. 52 |
  7. Usage
  8. 53 |
  9. Roadmap
  10. 54 |
  11. 55 | Steps to Contribute 56 | 59 |
  12. 60 |
  13. License
  14. 61 |
  15. The Nexus Team
  16. 62 |
  17. Contact
  18. 63 |
64 |
65 | 66 | 67 | 68 | 69 | ## About The Project 70 | 71 | Nexus is a VSCode Extension created for NextJS developers! As codebases scale in size and complexity, developers may feel overwhelmed as they keep track of tens of components and hundreds of props elements per file. Nexus aims to help developers overcome unnecessary mental strain through 3 main methods: 72 | 73 | 1. Displaying file-specific component hierarchy in your VSCode sidebar 74 | 2. Including component-specific state and props objects for parent and child components 75 | 3. Differentiating between server-side rendered and static-site generated components 76 | 77 | We at Team Nexus hope that you enjoy our extension, taking advantage of a time-tested component tree model that integrates the unique features of NextJS! 78 | 79 |

(back to top)

80 | 81 | 82 | 83 | ### Built With 84 | 104 | 105 | 106 | 107 | ## Installation 108 | 109 | 1. Install Nexus 110 | 111 | 2. A node tree icon should appear on your sidebar. You've now installed Nexus! Woot Woot! Now on to the "Getting Started" section below. 112 | 113 | Note: If contributing, see the "Installation for Contributors" section below! 114 | 115 | 116 | 117 | ## Getting Started 118 | 119 | Congrats on installing Nexus! Now let's get it started. 120 | 121 | 122 | ### Prerequisites 123 | 124 | Nexus supports OSX, Windows, and WSL 125 | 126 | 127 | ## Usage 128 | 129 | 1. Click the node tree icon on your sidebar. An "Input File Here" button should appear on your side panel! 130 |
131 |

132 | 133 |

134 |
135 | 2. Click the button and your file explorer window will open. Select a file and press "Ok". 136 |
137 |

138 | 139 |

140 |
141 | 142 | 3. Your side panel should now render a component tree that displays SSG or SSR status! Clicking on components will render child components if they exist and hovering over components will display their props objects. Enjoy! 143 |
144 |

145 | 146 |

147 |
148 | 149 | 150 | 151 | ## Roadmap 152 | 153 | - [ ] Creating a webview to look deeper into structure of individual components 154 | - [ ] Making the parser more dynamic and flexible 155 | - [ ] Handling Link Components 156 | - [ ] Error checking in the frontend to ensure that uploaded files are either NextJS or React 157 | - [ ] Add status bar item for Nexus 158 | - [ ] Store component tree memory in VSCode 159 | 160 | See the [open issues](https://github.com/oslabs-beta/Nexus/issues) for a full list of proposed features (and known issues). 161 | 162 | 163 | 164 | 165 | ## Steps to Contribute 166 | 167 | Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. 168 | 169 | If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". 170 | Don't forget to give the project a star! Thanks again! 171 | 172 | 1. Fork & Clone Nexus 173 | 2. Create your Feature Branch (`git checkout -b /`) 174 | 3. Make your Changes (See **Making Changes** below) 175 | 4. Commit your Changes (`git commit -m ''`) 176 | 5. Push to the Branch (`git push origin /`) 177 | 6. Open a Pull Request 178 | 179 | 180 | 181 | ### Making Changes 182 | 183 | 1. Make your changes! 184 | 2. Open /nexus/src/extension.ts and save any changes you made 185 | 3. Re-compile and re-build your extension using the command line: `npm run compile` & `npm run build` 186 | 4. Press F5. A new VSCode window should open. This is your debugging environment! 187 | 5. Repeat step 3 and refresh your debugging environment to test further changes 188 | 189 | 190 | 191 | ## License 192 | 193 | Distributed under the MIT License. See `LICENSE` for more information. 194 | 195 | 196 | 197 | 198 | ## The Nexus Team 199 | 200 | * Mike Hong [LinkedIn](https://www.linkedin.com/in/mykongee/) | [Github](https://github.com/mykongee) 201 | * Brian Chiang [LinkedIn](https://www.linkedin.com/in/brian-chiang-849a181a7/) | [Github](https://github.com/BChiang4) 202 | * David Lee [LinkedIn](https://www.linkedin.com/in/david-lee-39541411a/) | [Github](https://github.com/dplee123) 203 | * Nico Flores [LinkedIn](https://www.linkedin.com/in/nicolasaflores/) | [Github](https://github.com/nicoflrs) 204 | * Alex Hersler [LinkedIn](https://www.linkedin.com/in/alex-hersler/) | [Github](https://github.com/FoxEight) 205 | 206 | 207 | ## Contact Us 208 | Email: nexusjsadm@gmail.com 209 | 210 | Twitter: [@teamnexus_js](https://twitter.com/teamnexus_js) 211 | 212 | Website: [https://nexus-js.com/](https://nexus-js.com/) 213 | -------------------------------------------------------------------------------- /images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/.DS_Store -------------------------------------------------------------------------------- /images/Abstract-Tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Abstract-Tree.png -------------------------------------------------------------------------------- /images/Component-Tree-Icon-Inspiration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Component-Tree-Icon-Inspiration.png -------------------------------------------------------------------------------- /images/Component-Tree-Tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Component-Tree-Tool.png -------------------------------------------------------------------------------- /images/Cool-looking-use-of-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Cool-looking-use-of-tree.png -------------------------------------------------------------------------------- /images/Grey-scale-color-palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Grey-scale-color-palette.png -------------------------------------------------------------------------------- /images/Inspiration-along-the-lines-of-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Inspiration-along-the-lines-of-tree.png -------------------------------------------------------------------------------- /images/Nextjs-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Nextjs-1.png -------------------------------------------------------------------------------- /images/Nextjs-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Nextjs-2.png -------------------------------------------------------------------------------- /images/Nextjs-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Nextjs-3.png -------------------------------------------------------------------------------- /images/Nextjs-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Nextjs-4.png -------------------------------------------------------------------------------- /images/Nexus-idea.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Nexus-idea.PNG -------------------------------------------------------------------------------- /images/Roots-inspiration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/Roots-inspiration.png -------------------------------------------------------------------------------- /images/component-tree-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/images/component-tree-example-1.png -------------------------------------------------------------------------------- /nexus/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/.DS_Store -------------------------------------------------------------------------------- /nexus/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: ["@babel/preset-env", "@babel/preset-react"] 3 | } -------------------------------------------------------------------------------- /nexus/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "@typescript-eslint/naming-convention": "warn", 13 | "@typescript-eslint/semi": "warn", 14 | "curly": "warn", 15 | "eqeqeq": "warn", 16 | "no-throw-literal": "warn", 17 | "semi": "off" 18 | }, 19 | "ignorePatterns": [ 20 | "out", 21 | "dist", 22 | "**/*.d.ts" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /nexus/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | nexus-extension-0.5.2.vsix -------------------------------------------------------------------------------- /nexus/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /nexus/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ], 15 | "outFiles": [ 16 | "${workspaceFolder}/out/**/*.js" 17 | ], 18 | "preLaunchTask": "${defaultBuildTask}" 19 | }, 20 | { 21 | "name": "Extension Tests", 22 | "type": "extensionHost", 23 | "request": "launch", 24 | "args": [ 25 | "--extensionDevelopmentPath=${workspaceFolder}", 26 | "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" 27 | ], 28 | "outFiles": [ 29 | "${workspaceFolder}/out/test/**/*.js" 30 | ], 31 | "preLaunchTask": "${defaultBuildTask}" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /nexus/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | }, 9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 10 | "typescript.tsc.autoDetect": "off" 11 | } -------------------------------------------------------------------------------- /nexus/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /nexus/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | src/** 4 | .gitignore 5 | .yarnrc 6 | vsc-extension-quickstart.md 7 | **/tsconfig.json 8 | **/.eslintrc.json 9 | **/*.map 10 | **/*.ts 11 | -------------------------------------------------------------------------------- /nexus/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 OSLabs Beta 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 4 | associated documentation files (the "Software"), to deal in the Software without restriction, including 5 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 7 | following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial 10 | portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 13 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 14 | EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 15 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 16 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /nexus/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 13 | 14 | 15 |
16 |
17 | 18 | NexusLogo 19 | 20 | 21 |

Nexus

22 | 23 |

24 | A component tree extension for NextJS 25 |
26 |
27 | Report Bugs 28 | · 29 | Request Features 30 |

31 |
32 | 33 | 34 | 35 | 36 |
37 | Table of Contents 38 |
    39 |
  1. 40 | About The Project 41 | 44 |
  2. 45 |
  3. Installation
  4. 46 |
  5. 47 | Getting Started 48 | 51 |
  6. 52 |
  7. Usage
  8. 53 |
  9. Roadmap
  10. 54 |
  11. 55 | Steps to Contribute 56 | 59 |
  12. 60 |
  13. License
  14. 61 |
  15. The Nexus Team
  16. 62 |
  17. Contact
  18. 63 |
64 |
65 | 66 | 67 | 68 | 69 | ## About The Project 70 | 71 | Nexus is a VSCode Extension created for NextJS developers! As codebases scale in size and complexity, developers may feel overwhelmed as they keep track of tens of components and hundreds of props elements per file. Nexus aims to help developers overcome unnecessary mental strain through 3 main methods: 72 | 73 | 1. Displaying file-specific component hierarchy in your VSCode sidebar 74 | 2. Including component-specific state and props objects for parent and child components 75 | 3. Differentiating between server-side rendered and static-site generated components 76 | 77 | We at Team Nexus hope that you enjoy our extension, taking advantage of a time-tested component tree model that integrates the unique features of NextJS! 78 | 79 |

(back to top)

80 | 81 | 82 | 83 | ### Built With 84 | 104 | 105 | 106 | 107 | ## Installation 108 | 109 | 1. Install Nexus 110 | 111 | 2. A node tree icon should appear on your sidebar. You've now installed Nexus! Woot Woot! Now on to the "Getting Started" section below. 112 | 113 | Note: If contributing, see the "Installation for Contributors" section below! 114 | 115 | 116 | 117 | ## Getting Started 118 | 119 | Congrats on installing Nexus! Now let's get it started. 120 | 121 | 122 | ### Prerequisites 123 | 124 | Nexus supports OSX, Windows, and WSL 125 | 126 | 127 | ## Usage 128 | 129 | 1. Click the node tree icon on your sidebar. An "Input File Here" button should appear on your side panel! 130 |
131 |

132 | 133 |

134 |
135 | 2. Click the button and your file explorer window will open. Select a file and press "Ok". 136 |
137 |

138 | 139 |

140 |
141 | 142 | 3. Your side panel should now render a component tree that displays SSG or SSR status! Clicking on components will render child components if they exist and hovering over components will display their props objects. Enjoy! 143 |
144 |

145 | 146 |

147 |
148 | 149 | 150 | 151 | ## Roadmap 152 | 153 | - [ ] Creating a webview to look deeper into structure of individual components 154 | - [ ] Making the parser more dynamic and flexible 155 | - [ ] Handling Link Components 156 | - [ ] Error checking in the frontend to ensure that uploaded files are either NextJS or React 157 | - [ ] Add status bar item for Nexus 158 | - [ ] Store component tree memory in VSCode 159 | 160 | See the [open issues](https://github.com/oslabs-beta/Nexus/issues) for a full list of proposed features (and known issues). 161 | 162 | 163 | 164 | 165 | ## Steps to Contribute 166 | 167 | Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. 168 | 169 | If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". 170 | Don't forget to give the project a star! Thanks again! 171 | 172 | 1. Fork & Clone Nexus 173 | 2. Create your Feature Branch (`git checkout -b /`) 174 | 3. Make your Changes (See **Making Changes** below) 175 | 4. Commit your Changes (`git commit -m ''`) 176 | 5. Push to the Branch (`git push origin /`) 177 | 6. Open a Pull Request 178 | 179 | 180 | 181 | ### Making Changes 182 | 183 | 1. Make your changes! 184 | 2. Open /nexus/src/extension.ts and save any changes you made 185 | 3. Re-compile and re-build your extension using the command line: `npm run compile` & `npm run build` 186 | 4. Press F5. A new VSCode window should open. This is your debugging environment! 187 | 5. Repeat step 3 and refresh your debugging environment to test further changes 188 | 189 | 190 | 191 | ## License 192 | 193 | Distributed under the MIT License. See `LICENSE` for more information. 194 | 195 | 196 | 197 | 198 | ## The Nexus Team 199 | 200 | * Mike Hong [LinkedIn](https://www.linkedin.com/in/mykongee/) | [Github](https://github.com/mykongee) 201 | * Brian Chiang [LinkedIn](https://www.linkedin.com/in/brian-chiang-849a181a7/) | [Github](https://github.com/BChiang4) 202 | * David Lee [LinkedIn](https://www.linkedin.com/in/david-lee-39541411a/) | [Github](https://github.com/dplee123) 203 | * Nico Flores [LinkedIn](https://www.linkedin.com/in/nicolasaflores/) | [Github](https://github.com/nicoflrs) 204 | * Alex Hersler [LinkedIn](https://www.linkedin.com/in/alex-hersler/) | [Github](https://github.com/FoxEight) 205 | 206 | 207 | ## Contact Us 208 | Email: nexusjsadm@gmail.com 209 | 210 | Twitter: [@teamnexus_js](https://twitter.com/teamnexus_js) 211 | 212 | Website: [https://nexus-js.com/](https://nexus-js.com/) 213 | 214 | -------------------------------------------------------------------------------- /nexus/babel-plugin-macros.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'fontawesome-svg-core': { 3 | 'license': 'free' 4 | } 5 | } -------------------------------------------------------------------------------- /nexus/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true); 3 | return { 4 | plugins: ['macros'], 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /nexus/dist/sidebar.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /* 2 | object-assign 3 | (c) Sindre Sorhus 4 | @license MIT 5 | */ 6 | 7 | /*! 8 | * Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com 9 | * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) 10 | * Copyright 2022 Fonticons, Inc. 11 | */ 12 | 13 | /** @license React v0.20.2 14 | * scheduler.production.min.js 15 | * 16 | * Copyright (c) Facebook, Inc. and its affiliates. 17 | * 18 | * This source code is licensed under the MIT license found in the 19 | * LICENSE file in the root directory of this source tree. 20 | */ 21 | 22 | /** @license React v17.0.2 23 | * react-dom.production.min.js 24 | * 25 | * Copyright (c) Facebook, Inc. and its affiliates. 26 | * 27 | * This source code is licensed under the MIT license found in the 28 | * LICENSE file in the root directory of this source tree. 29 | */ 30 | 31 | /** @license React v17.0.2 32 | * react.production.min.js 33 | * 34 | * Copyright (c) Facebook, Inc. and its affiliates. 35 | * 36 | * This source code is licensed under the MIT license found in the 37 | * LICENSE file in the root directory of this source tree. 38 | */ 39 | -------------------------------------------------------------------------------- /nexus/media/filler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/filler.png -------------------------------------------------------------------------------- /nexus/media/gif1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/gif1.gif -------------------------------------------------------------------------------- /nexus/media/gif2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/gif2.gif -------------------------------------------------------------------------------- /nexus/media/gif3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/gif3.gif -------------------------------------------------------------------------------- /nexus/media/icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nexus/media/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/logo.png -------------------------------------------------------------------------------- /nexus/media/next-js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/next-js.png -------------------------------------------------------------------------------- /nexus/media/next-js.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nexus/media/nexus-vscode-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/nexus-vscode-icon.png -------------------------------------------------------------------------------- /nexus/media/react-brands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/react-brands.png -------------------------------------------------------------------------------- /nexus/media/react-brands.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nexus/media/styles.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | padding: 0; 4 | margin: 0; 5 | } 6 | 7 | .tree-container { 8 | position: relative; 9 | background-color: #333; 10 | border: 2px solid #ddd; 11 | padding: 7px; 12 | border-radius: 1px; 13 | /* z-index: -2; */ 14 | } 15 | 16 | .comp-with-children-container { 17 | display: block; 18 | position: relative; 19 | left: 20px; 20 | margin-top: 10px; 21 | } 22 | 23 | .comp-with-children-name, 24 | .top-level-component, 25 | .leaf-comp-name { 26 | font-weight: normal; 27 | margin-left: 10px; 28 | margin-right: 8px; 29 | padding: 4px 8px; 30 | /* border: 2px solid purple; 31 | border-radius: 10px; */ 32 | } 33 | 34 | .comp-with-children-container::before { 35 | content: ''; 36 | position: absolute; 37 | transform: rotate(90deg); 38 | height: 1px; 39 | width: 30px; 40 | background-color: #b08ac5; 41 | left: -8px; 42 | top: -9px; 43 | z-index: 0; 44 | } 45 | 46 | .comp-with-children-name::before { 47 | content: ''; 48 | position: absolute; 49 | height: 1px; 50 | width: 11px; 51 | background-color: #b08ac5; 52 | left: 16px; 53 | top: 12px; 54 | z-index: 0; 55 | } 56 | 57 | .comp-with-children-container::before:hover { 58 | color: #7e74fa; 59 | } 60 | 61 | .comp-with-children-name::before:hover { 62 | color: #7e74fa; 63 | } 64 | 65 | .leaf-comp-container::before { 66 | content: ''; 67 | position: absolute; 68 | transform: rotate(90deg); 69 | height: 1px; 70 | width: 39px; 71 | background-color: #b08ac5; 72 | left: -33px; 73 | top: -6px; 74 | z-index: 0; 75 | } 76 | 77 | .leaf-comp-name::before { 78 | content: ''; 79 | position: absolute; 80 | height: 1px; 81 | width: 23px; 82 | background-color: #b08ac5; 83 | left: -13px; 84 | top: 15px; 85 | z-index: 0; 86 | } 87 | 88 | /* .comp-with-children-container::after { 89 | content: ''; 90 | position: absolute; 91 | height: 2px; 92 | width: 10px; 93 | background-color: purple; 94 | left: 30px; 95 | top: 15px; 96 | } */ 97 | 98 | /* .info_icon::before { 99 | content: ''; 100 | position: absolute; 101 | height: 2px; 102 | width: 10px; 103 | background-color: purple; 104 | left: 80px; 105 | top: 12px; 106 | z-index: 1; 107 | } */ 108 | 109 | /* .info_icon-inner::before { 110 | content: ''; 111 | position: absolute; 112 | height: 2px; 113 | width: 10px; 114 | background-color: orange; 115 | left: 0px; 116 | top: 12px; 117 | z-index: 1; 118 | } */ 119 | 120 | /* .comp-with-children-name::before { 121 | content: 'branch'; 122 | transform: rotate(90deg); 123 | height: 3px; 124 | width: 10px; 125 | background-color: purple; 126 | left: 5px; 127 | } */ 128 | 129 | .leaf-comp-container { 130 | display: block; 131 | position: relative; 132 | left: 40px; 133 | margin-top: 10px; 134 | margin-right: 5px; 135 | } 136 | 137 | .nav-leaf-comp-container { 138 | /* margin-left: 2px; */ 139 | } 140 | 141 | .node-icon { 142 | position: relative; 143 | bottom: -10px; 144 | margin-right: 25px; 145 | color: #b08ac5; 146 | z-index: 2; 147 | } 148 | 149 | .add-file-container { 150 | background-color: #333; 151 | border: 2px solid #ddd; 152 | padding: 10px 15px; 153 | margin-bottom: 10px; 154 | border-radius: 1px; 155 | } 156 | 157 | .add-file-header { 158 | margin-top: 5px; 159 | margin-bottom: 10px; 160 | } 161 | 162 | .add-file-message { 163 | font-size: 14px; 164 | line-height: 1.2; 165 | margin-bottom: 6px; 166 | } 167 | 168 | .add-file-btn-container { 169 | display: flex; 170 | justify-content: center; 171 | } 172 | 173 | .file-input { 174 | margin-top: 10px; 175 | margin-bottom: 3px; 176 | width: 90px; 177 | border-radius: 3px; 178 | } 179 | 180 | .file-input:hover { 181 | cursor: pointer; 182 | } 183 | 184 | .generate-tree-message { 185 | padding: 5px; 186 | font-size: 14px; 187 | } 188 | 189 | .info_icon { 190 | color: #b08ac5; 191 | z-index: 2; 192 | 193 | /* margin-left: 8px; */ 194 | } 195 | 196 | #tips { 197 | background-color: #7e74fa; 198 | padding: 10px; 199 | border-radius: 5px; 200 | } 201 | 202 | .leaf-Node h3, 203 | .leaf-Node a { 204 | display: inline; 205 | } 206 | 207 | .data-key { 208 | color: rgb(155, 18, 155); 209 | font-family: monospace; 210 | } 211 | 212 | .node_icon:hover, 213 | .comp-with-children-name:hover, 214 | .fav_icon:hover, 215 | .info_icon:hover, 216 | .top-level-component:hover { 217 | cursor: pointer; 218 | z-index: 2; 219 | } 220 | 221 | .container-intro { 222 | position: relative; 223 | height: 100%; 224 | } 225 | 226 | .container-intro h1, 227 | .container-intro a { 228 | display: inline; 229 | vertical-align: top; 230 | font-family: 'Open Sans', sans-serif; 231 | font-size: 16px; 232 | line-height: 28px; 233 | } 234 | 235 | .fav_icon:hover { 236 | color: #7e74fa; 237 | z-index: 2; 238 | } 239 | 240 | .fav_icon { 241 | /* margin: 3px; */ 242 | color: #b08ac5; 243 | z-index: 2; 244 | } 245 | -------------------------------------------------------------------------------- /nexus/media/twitter-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /nexus/media/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/typescript.png -------------------------------------------------------------------------------- /nexus/media/typescript.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nexus/media/vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/vscode.png -------------------------------------------------------------------------------- /nexus/media/vscode.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /nexus/media/webpack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/media/webpack.png -------------------------------------------------------------------------------- /nexus/media/webpack.svg: -------------------------------------------------------------------------------- 1 | icon-square-small -------------------------------------------------------------------------------- /nexus/out/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/out/.DS_Store -------------------------------------------------------------------------------- /nexus/out/NexusProvider.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.deactivate = exports.NexusProvider = void 0; 13 | const ReactParser_js_1 = require("./parser/ReactParser.js"); 14 | const NextParser_js_1 = require("./parser/NextParser.js"); 15 | const vscode = require("vscode"); 16 | const path = require('path'); 17 | const fs = require('fs'); 18 | // class object for webviewView content 19 | class NexusProvider { 20 | constructor(_extensionUri) { 21 | this._extensionUri = _extensionUri; 22 | } 23 | // send message to webviewAPI with data using webview.postMessage(data) 24 | parseCodeBaseAndSendMessage(filePath) { 25 | let str = filePath; 26 | // allows for multi-platform compatability (Linux, Mac, etc.) 27 | if (process.platform === 'linux') { 28 | if (/wsl\$/.test(filePath)) { 29 | str = '/home' + filePath.split('home')[1].replace(/\\/g, '/'); 30 | } 31 | else { 32 | str = '/mnt/c/' + filePath.slice(3); 33 | str = str.replace(/\\/g, '/'); 34 | } 35 | } 36 | let resultObj; 37 | // if file is ending in '.js', send it into the Next.Js parser route 38 | if (str.slice(-3) === '.js') { 39 | resultObj = new NextParser_js_1.NextParser(fs.readFileSync(str), str); 40 | } 41 | // otherwise, send the file through the React parser route 42 | else { 43 | resultObj = new ReactParser_js_1.ReactParser(fs.readFileSync(str)); 44 | } 45 | // pull the parsed object from the parser, to be sent to the front-end 46 | const data = resultObj.main(); 47 | console.log('Congratulations, your extension "nexus" is now active!'); 48 | this._view.webview.postMessage({ name: 'App', children: data }); 49 | } 50 | // stage the initial html elements to the VSCode WebviewView 51 | resolveWebviewView(webviewView) { 52 | this._view = webviewView; 53 | webviewView.webview.options = { 54 | enableScripts: true, 55 | localResourceRoots: [this._extensionUri], 56 | }; 57 | webviewView.webview.onDidReceiveMessage((data) => __awaiter(this, void 0, void 0, function* () { 58 | switch (data.type) { 59 | case 'addFile': { 60 | this.parseCodeBaseAndSendMessage(data.value); 61 | } 62 | } 63 | })); 64 | webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); 65 | } 66 | _getHtmlForWebview(webview) { 67 | const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'dist', 'sidebar.js')); 68 | const styleVSCodeUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'styles.css')); 69 | return ` 70 | 71 | 72 | 73 | 77 | 78 | 79 | 80 |
81 | 82 | 83 | `; 84 | } 85 | } 86 | exports.NexusProvider = NexusProvider; 87 | NexusProvider.viewType = 'nexus.componentTreeView'; 88 | function deactivate() { } 89 | exports.deactivate = deactivate; 90 | //# sourceMappingURL=NexusProvider.js.map -------------------------------------------------------------------------------- /nexus/out/NexusProvider.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"NexusProvider.js","sourceRoot":"","sources":["../src/NexusProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAAsD;AACtD,0DAAoD;AACpD,iCAAiC;AACjC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,uCAAuC;AACvC,MAAa,aAAa;IAGxB,YAA6B,aAAyB;QAAzB,kBAAa,GAAb,aAAa,CAAY;IACtD,CAAC;IAED,uEAAuE;IAChE,2BAA2B,CAAC,QAAgB;QACjD,IAAI,GAAG,GAAG,QAAQ,CAAC;QAEvB,6DAA6D;QACzD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;YAChC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAC1B,GAAG,GAAG,OAAO,GAAG,QA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,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBAC9C;aACF;QACH,CAAC,CAAA,CAAC,CAAC;QACH,WAAW,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,kBAAkB,CAAC,OAAuB;QACxC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CACpC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,CAC9D,CAAC;QACF,MAAM,cAAc,GAAG,OAAO,CAAC,YAAY,CACzC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,CAC/D,CAAC;QAEF,OAAO;;;;;;;;kBAQO,cAAc;;;;uBAIT,SAAS;;gBAEhB,CAAC;IACf,CAAC;;AAjFH,sCAkFC;AAhFwB,sBAAQ,GAAG,yBAAyB,CAAC;AAkF9D,SAAgB,UAAU,KAAI,CAAC;AAA/B,gCAA+B"} -------------------------------------------------------------------------------- /nexus/out/extension.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.activate = void 0; 4 | const vscode = require("vscode"); 5 | const path = require("path"); 6 | const fs = require("fs"); 7 | const NexusProvider_1 = require("./NexusProvider"); 8 | // activates the extension upon interaction with the sidebar 9 | function activate(context) { 10 | const provider = new NexusProvider_1.NexusProvider(context.extensionUri); 11 | context.subscriptions.push(vscode.window.registerWebviewViewProvider(NexusProvider_1.NexusProvider.viewType, provider)); 12 | } 13 | exports.activate = activate; 14 | ; 15 | //# sourceMappingURL=extension.js.map -------------------------------------------------------------------------------- /nexus/out/extension.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,mDAAgD;AAEhD,4DAA4D;AAC5D,SAAgB,QAAQ,CAAC,OAAgC;IACvD,MAAM,QAAQ,GAAG,IAAI,6BAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACzD,OAAO,CAAC,aAAa,CAAC,IAAI,CACxB,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,6BAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAC5E,CAAC;AAEJ,CAAC;AAND,4BAMC;AAAA,CAAC"} -------------------------------------------------------------------------------- /nexus/out/parser/App.jsx: -------------------------------------------------------------------------------- 1 | // Example React component for testing parser logic. 2 | 3 | import React from 'react'; 4 | import { Link } from 'react-router-dom'; 5 | import Chatrooms from './components/Chatrooms.jsx'; 6 | import Chatroom from './components/Chatroom.jsx'; 7 | import styles from './styles.css'; 8 | import Children from './Children.jsx'; 9 | import ScuttleCrab from './ScuttleCrab.jsx'; 10 | import SSRComponent from './SSRComponent.jsx'; 11 | 12 | const URL = 'http://google.com'; 13 | const NUMBER = 10; 14 | function FUNC() { 15 | console.log('func'); 16 | } 17 | const FUNCTWO = () => { 18 | return 2; 19 | }; 20 | 21 | export async function getStaticProps() { 22 | const allPostsData = 'function'; 23 | return { 24 | props: { 25 | allPostsData, 26 | }, 27 | }; 28 | } 29 | 30 | const App = props => { 31 | const socket = io(); 32 | 33 | return ( 34 |
35 | {/* 36 | click me for test 37 | */} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 | ); 49 | }; 50 | 51 | export default { App, URL }; 52 | -------------------------------------------------------------------------------- /nexus/out/parser/Children.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Nested from './Nested.jsx'; 3 | 4 | const Children = (props) => { 5 | return ( 6 |
7 | 8 |
9 | ) 10 | }; 11 | 12 | export default Children; -------------------------------------------------------------------------------- /nexus/out/parser/Nested.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Nested = (props) => { 4 | return ( 5 |
6 | 7 |
8 | ) 9 | }; 10 | 11 | export default Nested; -------------------------------------------------------------------------------- /nexus/out/parser/NextParser.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"NextParser.js","sourceRoot":"","sources":["../../src/parser/NextParser.ts"],"names":[],"mappings":";;;AAAA,cAAc;AACd,sCAAsC;AACtC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;AACnC,iCAAiC;AACjC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;AACvC,yBAAyB;AACzB,6BAA6B;AAE7B,aAAa;AACb,MAAM,OAAO,GAAW,SAAS,CAAC;AAClC,MAAM,UAAU,GAAW,YAAY,CAAC;AACxC,MAAM,sBAAsB,GAAW,wBAAwB,CAAC;AAiChE,MAAM,aAAa;IACjB,YAAY,IAAY,EAAE,KAAa,EAAE,QAAoB,EAAE,YAAoB;QACjF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAcD,MAAa,UAAU;IACrB,YAAY,UAAe,EAAE,GAAQ;QACnC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,EAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC,4CAA4C;QAChI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IACvC,CAAC;IAEA,SAAS;IACT,cAAc,CAAC,WAAwB;QACtC,MAAM,WAAW,GAAgB,WA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AAI,kBAAkB,CAAC;QACvB,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClE,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,mBAAmB;QACrE,uCAAuC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC;QACd,SAAS;QACT,SAAS;QACT,oBAAoB;QACpB,qBAAqB;QACrB,sBAAsB;QACtB,oBAAoB;QACpB,eAAe;QACf,gCAAgC;QAChC,gEAAgE;QAChE,4CAA4C;IAC9C,CAAC;CACF;AAxPD,gCAwPC"} -------------------------------------------------------------------------------- /nexus/out/parser/ReactParser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ReactParser = void 0; 4 | // @ts-nocheck 5 | // const PARSER = require('acorn').Parser; 6 | const parserModule = require("acorn"); 7 | const PARSER = parserModule.Parser; 8 | // const jsx = require('acorn-jsx'); 9 | const jsx = require("acorn-jsx"); 10 | const JSXPARSER = PARSER.extend(jsx()); 11 | const fs = require("fs"); 12 | const path = require("path"); 13 | // const fs = require("fs"); 14 | // const path = require("path"); 15 | // CONSTANTS 16 | const JSXTEXT = 'JSXText'; 17 | const JSXELEMENT = 'JSXElement'; 18 | const JSXEXPRESSIONCONTAINER = 'JSXExpressionContainer'; 19 | class ComponentNode { 20 | constructor(name, props, children, dataFetching) { 21 | this.name = name; 22 | this.children = children; 23 | this.props = props; 24 | this.dataFetching = dataFetching; 25 | } 26 | } 27 | class ReactParser { 28 | constructor(sourceCode) { 29 | this.program = JSXPARSER.parse(sourceCode, { sourceType: "module" }); // Node Object -> take body property (Array) 30 | this.programBody = this.program.body; 31 | } 32 | //methods 33 | getImportNodes(programBody) { 34 | const importNodes = programBody.filter((node) => node.type === 'ImportDeclaration'); 35 | return importNodes; 36 | } 37 | getVariableNodes(programBody) { 38 | const variableNodes = programBody.filter((node) => node.type === 'VariableDeclaration'); 39 | return variableNodes; 40 | } 41 | getNonImportNodes(programBody) { 42 | const nonImportNodes = programBody.filter((node) => node.type !== 'ImportDeclaration'); 43 | return nonImportNodes; 44 | } 45 | getExportNamedNodes(programBody) { 46 | const exportNamedNodes = programBody.filter((node) => node.type === 'ExportNamedDeclaration'); 47 | return exportNamedNodes; 48 | } 49 | getExportDefaultNodes(otherNodes) { 50 | const exportDefaultNode = otherNodes.filter((node) => { 51 | node.type === 'ExportDefaultDeclaration'; 52 | })[0]; 53 | return exportDefaultNode; 54 | } 55 | getChildrenNodes(variableNodes) { 56 | // RETURN STATEMENT in functional component 57 | // TODO: refactor to look at all nodes, not just last varDeclaration node 58 | const nodes = variableNodes[variableNodes.length - 1].declarations[0].init.body.body; 59 | const returnNode = nodes.filter((node) => node.type === 'ReturnStatement')[0]; 60 | const childrenNodes = returnNode.argument.children; 61 | return childrenNodes; 62 | } 63 | getJsxNodes(childrenNodes) { 64 | const jsxNodes = childrenNodes.filter((node) => node.type === JSXELEMENT); 65 | return jsxNodes; 66 | } 67 | getChildrenComponents(jsxNodes, importNodes) { 68 | const components = []; 69 | const regex = /[a-zA-Z]+(.jsx|.js)/; 70 | const importValues = importNodes.map((node) => node.source.value); 71 | const componentPaths = importValues.filter((str) => regex.test(str) === true); 72 | const cache = {}; 73 | for (let str of componentPaths) { 74 | const splitName = str.split('/'); 75 | const componentPath = splitName[splitName.length - 1]; 76 | const name = componentPath.split('.')[0]; 77 | cache[name] = str; 78 | } 79 | // importValues = ['./Children.jsx', 'react', 'react-router-dom'] 80 | for (let node of jsxNodes) { 81 | const firstChar = node.openingElement.name.name[0]; // actual name label (i.e. 'Chatroom', 'Component') 82 | const componentName = node.openingElement.name.name; 83 | if (firstChar === firstChar.toUpperCase()) { 84 | const props = this.getProps(node); 85 | // check componentName against importNodes 86 | // if name matches import node name, take filepath 87 | // recursively invoke parsing algo on file 88 | let children = []; 89 | let dataFetching = 'ssg'; 90 | if (cache[`${componentName}`]) { 91 | children = this.recurse(cache[`${componentName}`]); 92 | const tree = this.getTree(cache[`${componentName}`]); 93 | dataFetching = this.detectFetchingMethod(tree); // -> FetchingMethod.ssr or FetchingMethod.ssg 94 | } 95 | // const componentNode = new ComponentNode(componentName, props, []); 96 | const componentNode = new ComponentNode(componentName, props, children, dataFetching); 97 | components.push(componentNode); 98 | } 99 | } 100 | return components; 101 | } 102 | getPropValue(node) { 103 | if (Object.keys(node).includes('expression')) { 104 | return node.expression.value; // look into the value (node) and find the expression 105 | } 106 | else { 107 | return node.value; // return the value 108 | } 109 | } 110 | getProps(node) { 111 | const propObj = {}; 112 | for (let prop of node.openingElement.attributes) { 113 | const name = prop.name.name; 114 | propObj[name] = this.getPropValue(prop.value); 115 | } 116 | return propObj; 117 | } 118 | detectFetchingMethod(tree) { 119 | // filter all ExportNamedDeclaration types 120 | // loop through all to find one with declation.id.name === 'getServerSideProps' 121 | // can refactor to getStaticProps 122 | const exportNamedNodes = this.getExportNamedNodes(tree); 123 | let dataMethod = ''; 124 | // if no exportNamedNodes, infer that it's ssg bc of next.js default 125 | if (exportNamedNodes.length === 0) { 126 | dataMethod = 'ssg'; 127 | return dataMethod; 128 | } 129 | for (const node of exportNamedNodes) { 130 | if (exportNamedNodes.every((node) => node.declaration.id.name !== 'getServerSideProps')) { 131 | dataMethod = 'ssg'; 132 | } 133 | if (node.declaration.id.name === 'getServerSideProps') { 134 | dataMethod = 'ssr'; 135 | break; 136 | } 137 | } 138 | return dataMethod; 139 | } 140 | getTree(filePath) { 141 | const source = fs.readFileSync(path.resolve(__dirname, filePath)); 142 | const parsed = JSXPARSER.parse(source, { sourceType: "module" }); 143 | const programBody = parsed.body; // get body of Program Node(i.e. source code entry) 144 | return programBody; 145 | } 146 | recurse(filePath) { 147 | // console.log('path.resolve in recurse: ', path.resolve(__dirname, filePath)); 148 | function getTree(filePath) { 149 | const source = fs.readFileSync(path.resolve(__dirname, filePath)); 150 | const parsed = JSXPARSER.parse(source, { sourceType: "module" }); 151 | const programBody = parsed.body; // get body of Program Node(i.e. source code entry) 152 | return programBody; 153 | } 154 | const tree = getTree(filePath); 155 | let variableNodes; 156 | if (this.funcOrClass(tree) === 'JSXElement') { 157 | const importNodes = this.getImportNodes(tree); 158 | variableNodes = this.getVariableNodes(tree); 159 | const childrenNodes = this.getChildrenNodes(variableNodes); 160 | const jsxNodes = this.getJsxNodes(childrenNodes); 161 | const result = this.getChildrenComponents(jsxNodes, importNodes); 162 | return result; 163 | } 164 | else { 165 | return this.getClassNodes(tree); 166 | } 167 | } 168 | funcOrClass(tree) { 169 | // using this.programBody, check if file contains functional or class component 170 | // look at all VariableDeclarations 171 | const variableNodes = this.getVariableNodes(tree); 172 | // if functional, return "JSXELEMENT" 173 | try { 174 | const nodes = variableNodes[variableNodes.length - 1].declarations[0].init.body.body; 175 | const returnNode = nodes.filter((node) => node.type === 'ReturnStatement')[0]; 176 | const nodeType = returnNode.argument.type; 177 | return nodeType; 178 | } 179 | catch (_a) { 180 | // if class object, return undefined 181 | return; 182 | } 183 | } 184 | getClassNodes(tree) { 185 | const resultObj = this.getVariableNodes(tree); 186 | let classObj = tree.filter(node => { 187 | return node.type === 'ClassDeclaration'; 188 | }); 189 | // [Node, Node] 190 | // console.log(classObj[1].body.body[1].value.body.body[0].argument.openingElement.name.name);//.body[1].value.body.body[0].argument.openingElement.name.name);** 191 | // // filter all class declarations (like above) 192 | // // for each class declaration node, look at body.body (Array) 193 | for (let i = 0; i < classObj.length; i++) { 194 | for (let j = 0; j < classObj[i].body.body.length; j++) { 195 | if (classObj[i].body.body[j].key.name === 'render') { 196 | const data = classObj[i].body.body[j].value.body.body[0].argument.children; 197 | const jsx = this.getJsxNodes(data); 198 | const importNodes = this.getImportNodes(tree); 199 | const allNodes = this.getChildrenComponents(jsx, importNodes); 200 | return allNodes; 201 | } 202 | } 203 | } 204 | } 205 | main() { 206 | const importNodes = this.getImportNodes(this.programBody); 207 | let variableNodes; 208 | if (this.funcOrClass(this.programBody) === 'JSXElement') { 209 | variableNodes = this.getVariableNodes(this.programBody); 210 | const childrenNodes = this.getChildrenNodes(variableNodes); 211 | const jsxNodes = this.getJsxNodes(childrenNodes); 212 | const result = this.getChildrenComponents(jsxNodes, importNodes); 213 | return result; 214 | } 215 | else { 216 | return this.getClassNodes(this.programBody); 217 | } 218 | } 219 | } 220 | exports.ReactParser = ReactParser; 221 | //# sourceMappingURL=ReactParser.js.map -------------------------------------------------------------------------------- /nexus/out/parser/ReactParser.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ReactParser.js","sourceRoot":"","sources":["../../src/parser/ReactParser.ts"],"names":[],"mappings":";;;AAAA,cAAc;AACd,0CAA0C;AAC1C,sCAAsC;AACtC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;AACnC,oCAAoC;AACpC,iCAAiC;AACjC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;AACvC,yBAAyB;AACzB,6BAA6B;AAC7B,4BAA4B;AAC5B,gCAAgC;AAChC,aAAa;AACb,MAAM,OAAO,GAAW,SAAS,CAAC;AAClC,MAAM,UAAU,GAAW,YAAY,CAAC;AACxC,MAAM,sBAAsB,GAAW,wBAAwB,CAAC;AA6BhE,MAAM,aAAa;IACjB,YAAY,IAAY,EAAE,KAAa,EAAE,QAAoB,EAAE,YAAoB;QACjF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAU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C,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAC;oBAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBACnC,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;oBAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;oBAC9D,OAAO,QAAQ,CAAC;iBACjB;aACF;SACF;IACL,CAAC;IACD,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1D,IAAI,aAAa,CAAC;QAClB,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,YAAY,EAAE;YACvD,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACxD,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;YAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YACjD,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACjE,OAAO,MAAM,CAAC;SACf;aAAM;YACL,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAE7C;IACH,CAAC;CACF;AAzMD,kCAyMC"} -------------------------------------------------------------------------------- /nexus/out/parser/SSRComponent.jsx: -------------------------------------------------------------------------------- 1 | export function testFunction() { 2 | console.log(this); 3 | } 4 | 5 | 6 | export async function getServerSideProps(context) { 7 | return { 8 | props: { 9 | serverData: 'Data' 10 | }, // will be passed to the page component as props 11 | }; 12 | } 13 | 14 | const SSRComponent = ({ serverData }) => { 15 | return ( 16 |
17 |

SSR Component

18 |

{serverData}

19 |
20 | ); 21 | }; 22 | 23 | export default SSRComponent; -------------------------------------------------------------------------------- /nexus/out/parser/ScuttleCrab.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Children from './Children.jsx'; 3 | 4 | const ScuttleCrab = () => { 5 | return ( 6 |
7 |

I am the Scuttle Crab, Hear Me Roar

8 | 9 | 10 | 11 | 12 | 13 |
14 | ); 15 | }; 16 | 17 | export default ScuttleCrab; 18 | -------------------------------------------------------------------------------- /nexus/out/parser/Silk.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Nested from './Nested.jsx'; 3 | 4 | class Silk extends React.Component { 5 | constructor() { 6 | super(); 7 | } 8 | 9 | render() { 10 | 11 | return ( 12 |
13 | 14 |
I am GrandChild
15 |
16 | ) 17 | } 18 | } 19 | 20 | export default Silk; 21 | -------------------------------------------------------------------------------- /nexus/out/parser/newApp.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Silk from './Silk.jsx'; 3 | 4 | const URL = 'http://google.com'; 5 | 6 | class TestClass { 7 | constructor(){ 8 | // super() 9 | } 10 | } 11 | 12 | class App extends React.Component { 13 | constructor (){ 14 | super(); 15 | } 16 | 17 | render(){ 18 | return( 19 |
20 |

Hello

21 | 22 |
23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /nexus/out/parser/parser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ReactParser = void 0; 4 | // const PARSER = require('acorn').Parser; 5 | const parserModule = require("acorn"); 6 | const PARSER = parserModule.Parser; 7 | // const jsx = require('acorn-jsx'); 8 | const jsx = require("acorn-jsx"); 9 | const JSXPARSER = PARSER.extend(jsx()); 10 | const fs = require("fs"); 11 | const path = require("path"); 12 | // const fs = require("fs"); 13 | // const path = require("path"); 14 | // CONSTANTS 15 | const JSXTEXT = 'JSXText'; 16 | const JSXELEMENT = 'JSXElement'; 17 | const JSXEXPRESSIONCONTAINER = 'JSXExpressionContainer'; 18 | class ComponentNode { 19 | constructor(name, props, children, dataFetching) { 20 | this.name = name; 21 | this.children = children; 22 | this.props = props; 23 | this.dataFetching = dataFetching; 24 | } 25 | } 26 | class ReactParser { 27 | constructor(sourceCode) { 28 | console.log('Source Code: ', sourceCode); 29 | console.log('dirname: ', __dirname); 30 | this.program = JSXPARSER.parse(sourceCode, { sourceType: "module" }); // Node Object -> take body property (Array) 31 | console.log('program: ', this.program); 32 | this.programBody = this.program.body; 33 | console.log('program body: ', this.programBody); 34 | // this.fs = fs; 35 | // console.log('FROM PARSER CLASS: ', fs); 36 | // this.testFs = JSXPARSER.parse(fs.readFileSync(path.resolve(__dirname, './Children.jsx')), {sourceType: "module"}); 37 | } 38 | //methods 39 | getImportNodes(programBody) { 40 | const importNodes = programBody.filter((node) => node.type === 'ImportDeclaration'); 41 | return importNodes; 42 | } 43 | getVariableNodes(programBody) { 44 | const variableNodes = programBody.filter((node) => node.type === 'VariableDeclaration'); 45 | return variableNodes; 46 | } 47 | getNonImportNodes(programBody) { 48 | const nonImportNodes = programBody.filter((node) => node.type !== 'ImportDeclaration'); 49 | return nonImportNodes; 50 | } 51 | getExportNamedNodes(programBody) { 52 | const exportNamedNodes = programBody.filter((node) => node.type === 'ExportNamedDeclaration'); 53 | return exportNamedNodes; 54 | } 55 | getExportDefaultNodes(otherNodes) { 56 | const exportDefaultNode = otherNodes.filter((node) => { 57 | node.type === 'ExportDefaultDeclaration'; 58 | })[0]; 59 | return exportDefaultNode; 60 | } 61 | getChildrenNodes(variableNodes) { 62 | // RETURN STATEMENT in functional component 63 | // TODO: refactor to look at all nodes, not just last varDeclaration node 64 | const nodes = variableNodes[variableNodes.length - 1].declarations[0].init.body.body; 65 | const returnNode = nodes.filter((node) => node.type === 'ReturnStatement')[0]; 66 | const childrenNodes = returnNode.argument.children; 67 | return childrenNodes; 68 | } 69 | getJsxNodes(childrenNodes) { 70 | const jsxNodes = childrenNodes.filter((node) => node.type === JSXELEMENT); 71 | return jsxNodes; 72 | } 73 | getChildrenComponents(jsxNodes, importNodes) { 74 | const components = []; 75 | const regex = /[a-zA-Z]+(.jsx|.js)/; 76 | const importValues = importNodes.map((node) => node.source.value); 77 | const componentPaths = importValues.filter((str) => regex.test(str) === true); 78 | const cache = {}; 79 | for (let str of componentPaths) { 80 | const splitName = str.split('/'); 81 | const componentPath = splitName[splitName.length - 1]; 82 | const name = componentPath.split('.')[0]; 83 | cache[name] = str; 84 | } 85 | console.log('Cache', cache); 86 | // importValues = ['./Children.jsx', 'react', 'react-router-dom'] 87 | for (let node of jsxNodes) { 88 | const firstChar = node.openingElement.name.name[0]; // actual name label (i.e. 'Chatroom', 'Component') 89 | const componentName = node.openingElement.name.name; 90 | if (firstChar === firstChar.toUpperCase()) { 91 | const props = this.getProps(node); 92 | // check componentName against importNodes 93 | // if name matches import node name, take filepath 94 | // recursively invoke parsing algo on file 95 | let children = []; 96 | let dataFetching = 'ssg'; 97 | if (cache[`${componentName}`]) { 98 | children = this.recurse(cache[`${componentName}`]); 99 | console.log('DEBUG getChildrenComponents: ', children); 100 | const tree = this.getTree(cache[`${componentName}`]); 101 | dataFetching = this.detectFetchingMethod(tree); // -> FetchingMethod.ssr or FetchingMethod.ssg 102 | } 103 | // const componentNode = new ComponentNode(componentName, props, []); 104 | const componentNode = new ComponentNode(componentName, props, children, dataFetching); 105 | components.push(componentNode); 106 | } 107 | } 108 | return components; 109 | } 110 | getPropValue(node) { 111 | if (Object.keys(node).includes('expression')) { 112 | return node.expression.value; // look into the value (node) and find the expression 113 | } 114 | else { 115 | return node.value; // return the value 116 | } 117 | } 118 | getProps(node) { 119 | const propObj = {}; 120 | for (let prop of node.openingElement.attributes) { 121 | const name = prop.name.name; 122 | propObj[name] = this.getPropValue(prop.value); 123 | // console.log('propObj', propObj); 124 | } 125 | // console.log(propArr); 126 | return propObj; 127 | } 128 | detectFetchingMethod(tree) { 129 | // filter all ExportNamedDeclaration types 130 | // loop through all to find one with declation.id.name === 'getServerSideProps' 131 | // can refactor to getStaticProps 132 | const exportNamedNodes = this.getExportNamedNodes(tree); 133 | console.log('exported named nodes: ', exportNamedNodes); 134 | let dataMethod = ''; 135 | // if no exportNamedNodes, infer that it's ssg bc of next.js default 136 | if (exportNamedNodes.length === 0) { 137 | dataMethod = 'ssg'; 138 | return dataMethod; 139 | } 140 | for (const node of exportNamedNodes) { 141 | console.log('looping'); 142 | if (exportNamedNodes.every((node) => node.declaration.id.name !== 'getServerSideProps')) { 143 | console.log('should be ssg'); 144 | dataMethod = 'ssg'; 145 | } 146 | if (node.declaration.id.name === 'getServerSideProps') { 147 | console.log('should be ssg'); 148 | dataMethod = 'ssr'; 149 | break; 150 | } 151 | } 152 | return dataMethod; 153 | } 154 | getTree(filePath) { 155 | const source = fs.readFileSync(path.resolve(__dirname, filePath)); 156 | const parsed = JSXPARSER.parse(source, { sourceType: "module" }); 157 | const programBody = parsed.body; // get body of Program Node(i.e. source code entry) 158 | return programBody; 159 | } 160 | recurse(filePath) { 161 | console.log('filepath in recurse: ', filePath); 162 | console.log('path.resolve in recurse: ', path.resolve(__dirname, filePath)); 163 | function getTree(filePath) { 164 | const source = fs.readFileSync(path.resolve(__dirname, filePath)); 165 | const parsed = JSXPARSER.parse(source, { sourceType: "module" }); 166 | const programBody = parsed.body; // get body of Program Node(i.e. source code entry) 167 | return programBody; 168 | } 169 | const tree = getTree(filePath); 170 | console.log(`IN RECURSE WITH ${filePath}`); 171 | // console.log(tree); 172 | let variableNodes; 173 | if (this.funcOrClass(tree) === 'JSXElement') { 174 | console.log('RECURSE: JSXELEMENT'); 175 | const importNodes = this.getImportNodes(tree); 176 | variableNodes = this.getVariableNodes(tree); 177 | const childrenNodes = this.getChildrenNodes(variableNodes); 178 | const jsxNodes = this.getJsxNodes(childrenNodes); 179 | const result = this.getChildrenComponents(jsxNodes, importNodes); 180 | return result; 181 | } 182 | else { 183 | console.log('RECURSE: CLASS'); 184 | console.log(tree); 185 | return this.getClassNodes(tree); 186 | } 187 | // const variableNodes = this.getVariableNodes(tree); 188 | // const childrenNodes = this.getChildrenNodes(variableNodes); 189 | // const jsxNodes = this.getJsxNodes(childrenNodes); 190 | // const result = this.getChildrenComponents(jsxNodes, importNodes); 191 | // console.log(result); 192 | // return result; 193 | } 194 | funcOrClass(tree) { 195 | // using this.programBody, check if file contains functional or class component 196 | // look at all VariableDeclarations 197 | // if the type of the object in the body array is a varDeclatation && 198 | // const variableNodes = this.getVariableNodes(this.programBody); 199 | const variableNodes = this.getVariableNodes(tree); 200 | // if functional, return "JSXELEMENT" 201 | try { 202 | const nodes = variableNodes[variableNodes.length - 1].declarations[0].init.body.body; 203 | const returnNode = nodes.filter((node) => node.type === 'ReturnStatement')[0]; 204 | const nodeType = returnNode.argument.type; 205 | return nodeType; 206 | } 207 | catch (_a) { 208 | // if class object, return undefined 209 | return; 210 | } 211 | } 212 | getClassNodes(tree) { 213 | const resultObj = this.getVariableNodes(tree); 214 | let classObj = tree.filter(node => { 215 | return node.type === 'ClassDeclaration'; 216 | }); 217 | // [Node, Node] 218 | // console.log('second array of objects ', classObj); 219 | // console.log(classObj[1].body.body[1].value.body.body[0].argument.openingElement.name.name);//.body[1].value.body.body[0].argument.openingElement.name.name);** 220 | // // filter all class declarations (like above) 221 | // // for each class declaration node, look at body.body (Array) 222 | for (let i = 0; i < classObj.length; i++) { 223 | for (let j = 0; j < classObj[i].body.body.length; j++) { 224 | // console.log(classObj[i].body.body[j]); 225 | if (classObj[i].body.body[j].key.name === 'render') { 226 | // console.log('it works!' , classObj[i].body.body[j].value.body.body[0].argument.openingElement.name.name); 227 | // console.log('it works!' , classObj[i].body.body[j].value.body.body[0].argument.children); 228 | const data = classObj[i].body.body[j].value.body.body[0].argument.children; 229 | const jsx = this.getJsxNodes(data); 230 | const importNodes = this.getImportNodes(tree); 231 | const allNodes = this.getChildrenComponents(jsx, importNodes); 232 | return allNodes; 233 | // console.log(jsx); 234 | // console.log('ALL NODES: ', allNodes); 235 | } 236 | } 237 | } 238 | } 239 | main() { 240 | // console.log(filePath); 241 | console.log('this is in main'); 242 | const importNodes = this.getImportNodes(this.programBody); 243 | let variableNodes; 244 | if (this.funcOrClass(this.programBody) === 'JSXElement') { 245 | variableNodes = this.getVariableNodes(this.programBody); 246 | const childrenNodes = this.getChildrenNodes(variableNodes); 247 | const jsxNodes = this.getJsxNodes(childrenNodes); 248 | const result = this.getChildrenComponents(jsxNodes, importNodes); 249 | return result; 250 | } 251 | else { 252 | return this.getClassNodes(this.programBody); 253 | } 254 | // functional 255 | // const childrenNodes = this.getChildrenNodes(variableNodes); 256 | // const jsxNodes = this.getJsxNodes(childrenNodes); 257 | // const result = this.getChildrenComponents(jsxNodes, importNodes); 258 | // // console.log(result); 259 | // return result; 260 | // return {name: "App", children: result}; 261 | } 262 | } 263 | exports.ReactParser = ReactParser; 264 | //# sourceMappingURL=parser.js.map -------------------------------------------------------------------------------- /nexus/out/parser/parser.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC1C,sCAAsC;AACtC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;AACnC,oCAAoC;AACpC,iCAAiC;AACjC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;AACvC,yBAAyB;AACzB,6BAA6B;AAC7B,4BAA4B;AAC5B,gCAAgC;AAChC,aAAa;AACb,MAAM,OAAO,GAAW,SAAS,CAAC;AAClC,MAAM,UAAU,GAAW,YAAY,CAAC;AACxC,MAAM,sBAAsB,GAAW,wBAAwB,CAAC;AA6BhE,MAAM,aAAa;IACjB,YAAY,IAAY,EAAE,KAAa,EAAE,QAAo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AAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACjE,OAAO,MAAM,CAAC;SACf;aAAM;YACL,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAE7C;QACD,aAAa;QAEf,gEAAgE;QAChE,sDAAsD;QACtD,sEAAsE;QACtE,2BAA2B;QAC3B,mBAAmB;QACjB,0CAA0C;IAC5C,CAAC;CACF;AAtPD,kCAsPC"} -------------------------------------------------------------------------------- /nexus/out/parser/parserv2.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"parserv2.js","sourceRoot":"","sources":["../../src/parser/parserv2.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;AACnC,iCAAiC;AACjC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;AACvC,yBAAyB;AACzB,6BAA6B;AAE7B,aAAa;AACb,MAAM,OAAO,GAAW,SAAS,CAAC;AAClC,MAAM,UAAU,GAAW,YAAY,CAAC;AACxC,MAAM,sBAAsB,GAAW,wBAAwB,CAAC;AAiChE,MAAM,aAAa;IACjB,YAAY,IAAY,EAAE,KAAa,EAAE,QAAoB,EAAE,YAAoB;QACjF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAcD,MAAa,UAAU;IACrB,YAAY,UAAe,EAAE,GAAQ;QACnC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,EAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,EAAC,CA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AChE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,mBAAmB;QACrE,uCAAuC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC;QACd,SAAS;QACT,SAAS;QACT,oBAAoB;QACpB,qBAAqB;QACrB,sBAAsB;QACtB,oBAAoB;QACpB,eAAe;QACf,gCAAgC;QAChC,gEAAgE;QAChE,4CAA4C;IAC9C,CAAC;CACF;AAlPD,gCAkPC"} -------------------------------------------------------------------------------- /nexus/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nexus-extension", 3 | "displayName": "Nexus", 4 | "description": "VSCode Extension to visualize NextJS component tree hierarchy", 5 | "icon": "media/nexus-vscode-icon.png", 6 | "publisher": "Nexus-tree", 7 | "repository": { 8 | "url": "https://github.com/oslabs-beta/Nexus" 9 | }, 10 | "version": "0.5.3", 11 | "engines": { 12 | "vscode": "^1.64.0" 13 | }, 14 | "categories": [ 15 | "Other" 16 | ], 17 | "activationEvents": [ 18 | "onCommand:parseCode", 19 | "onView:nexus.componentTreeView" 20 | ], 21 | "main": "./out/extension.js", 22 | "contributes": { 23 | "viewsContainers": { 24 | "activitybar": [ 25 | { 26 | "id": "Nexus", 27 | "title": "Nexus", 28 | "icon": "media/icon.svg" 29 | } 30 | ] 31 | }, 32 | "views": { 33 | "Nexus": [ 34 | { 35 | "id": "nexus.componentTreeView", 36 | "name": "Nexus", 37 | "type": "webview" 38 | } 39 | ] 40 | }, 41 | "commands": [ 42 | { 43 | "command": "nexus.parseCode", 44 | "title": "Parse It" 45 | } 46 | ] 47 | }, 48 | "scripts": { 49 | "vscode:prepublish": "npm run compile", 50 | "compile": "tsc -p ./", 51 | "watch": "tsc -watch -p ./", 52 | "lint": "eslint src --ext ts", 53 | "test": "jest react-parser-test.js next-parser-test.js", 54 | "dev": "webpack watch", 55 | "build": "webpack" 56 | }, 57 | "devDependencies": { 58 | "@babel/core": "^7.17.5", 59 | "@babel/preset-env": "^7.16.11", 60 | "@babel/preset-react": "^7.16.7", 61 | "@types/glob": "^7.2.0", 62 | "@types/mocha": "^9.0.0", 63 | "@types/node": "14.x", 64 | "@types/vscode": "^1.64.0", 65 | "@typescript-eslint/eslint-plugin": "^5.9.1", 66 | "@typescript-eslint/parser": "^5.9.1", 67 | "@vscode/test-electron": "^2.0.3", 68 | "babel-loader": "^8.2.3", 69 | "cli": "^1.0.1", 70 | "eslint": "^8.6.0", 71 | "file-loader": "^6.2.0", 72 | "glob": "^7.2.0", 73 | "jest": "^27.5.1", 74 | "mocha": "^9.1.3", 75 | "react": "^17.0.2", 76 | "react-dom": "^17.0.2", 77 | "typescript": "^4.5.4", 78 | "webpack": "^5.69.1", 79 | "webpack-cli": "^4.9.2" 80 | }, 81 | "dependencies": { 82 | "@fortawesome/fontawesome-svg-core": "^1.3.0", 83 | "@fortawesome/free-solid-svg-icons": "^6.0.0", 84 | "@fortawesome/react-fontawesome": "^0.1.17", 85 | "@testing-library/react": "^12.1.4", 86 | "@tippyjs/react": "^4.2.6", 87 | "acorn": "^8.7.0", 88 | "acorn-jsx": "^5.3.2", 89 | "babel-plugin-macros": "^3.1.0", 90 | "path": "^0.12.7", 91 | "stream": "^0.0.2" 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /nexus/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/Nexus/98f5dd4062eec3660af79f67affcc715fc1c7022/nexus/src/.DS_Store -------------------------------------------------------------------------------- /nexus/src/NexusProvider.ts: -------------------------------------------------------------------------------- 1 | import { ReactParser } from './parser/ReactParser.js'; 2 | import { NextParser } from './parser/NextParser.js'; 3 | import * as vscode from 'vscode'; 4 | const path = require('path'); 5 | const fs = require('fs'); 6 | 7 | // class object for webviewView content 8 | export class NexusProvider implements vscode.WebviewViewProvider { 9 | _view?: vscode.WebviewView; 10 | public static readonly viewType = 'nexus.componentTreeView'; 11 | constructor(private readonly _extensionUri: vscode.Uri) { 12 | } 13 | 14 | // send message to webviewAPI with data using webview.postMessage(data) 15 | public parseCodeBaseAndSendMessage(filePath: string) { 16 | let str = filePath; 17 | 18 | // allows for multi-platform compatability (Linux, Mac, etc.) 19 | if (process.platform === 'linux') { 20 | if (/wsl\$/.test(filePath)) { 21 | str = '/home' + filePath.split('home')[1].replace(/\\/g, '/'); 22 | } else { 23 | str = '/mnt/c/' + filePath.slice(3); 24 | 25 | str = str.replace(/\\/g, '/'); 26 | } 27 | } 28 | 29 | let resultObj; 30 | 31 | // if file is ending in '.js', send it into the Next.Js parser route 32 | if (str.slice(-3) === '.js') { 33 | resultObj = new NextParser(fs.readFileSync(str), str); 34 | } 35 | 36 | // otherwise, send the file through the React parser route 37 | else { 38 | resultObj = new ReactParser(fs.readFileSync(str)); 39 | } 40 | 41 | // pull the parsed object from the parser, to be sent to the front-end 42 | const data = resultObj.main(); 43 | console.log('Congratulations, your extension "nexus" is now active!'); 44 | this._view.webview.postMessage({ name: 'App', children: data }); 45 | } 46 | 47 | // stage the initial html elements to the VSCode WebviewView 48 | public resolveWebviewView(webviewView: vscode.WebviewView) { 49 | this._view = webviewView; 50 | 51 | webviewView.webview.options = { 52 | enableScripts: true, 53 | localResourceRoots: [this._extensionUri], 54 | }; 55 | 56 | webviewView.webview.onDidReceiveMessage(async data => { 57 | switch (data.type) { 58 | case 'addFile': { 59 | this.parseCodeBaseAndSendMessage(data.value); 60 | } 61 | } 62 | }); 63 | webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); 64 | } 65 | 66 | _getHtmlForWebview(webview: vscode.Webview) { 67 | const scriptUri = webview.asWebviewUri( 68 | vscode.Uri.joinPath(this._extensionUri, 'dist', 'sidebar.js') 69 | ); 70 | const styleVSCodeUri = webview.asWebviewUri( 71 | vscode.Uri.joinPath(this._extensionUri, 'media', 'styles.css') 72 | ); 73 | 74 | return ` 75 | 76 | 77 | 78 | 82 | 83 | 84 | 85 |
86 | 87 | 88 | `; 89 | } 90 | } 91 | 92 | export function deactivate() {} 93 | -------------------------------------------------------------------------------- /nexus/src/__tests__/next-parser-test.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | // import { Parser } from '../../out/parser/parserv2.js'; 4 | import { NextParser } from '../parser/NextParser.js'; 5 | 6 | describe('NextJS Parser Unit Tests', () => { 7 | let parser; 8 | let importNodes; 9 | let variableNodes; 10 | let nonImportNodes; 11 | let childrenNodes; 12 | let jsxNodes; 13 | let exportDefaultNodes; 14 | 15 | //TODO: implement inner describe blocks to test different example files 16 | 17 | beforeAll(() => { 18 | parser = new NextParser(fs.readFileSync(path.resolve(__dirname, './test_components/jams-n-jams-app/pages/index.js'))); 19 | importNodes = parser.getImportNodes(parser.programBody); 20 | variableNodes = parser.getVariableNodes(parser.programBody); 21 | nonImportNodes = parser.getNonImportNodes(parser.programBody); 22 | exportDefaultNodes = parser.getExportDefaultNodes(parser.programBody); 23 | 24 | }); 25 | 26 | it('parser program body should be of type array', () => { 27 | expect(typeof parser.programBody).toEqual('object'); 28 | }); 29 | 30 | it('getImportNodes: Test that each element has type ImportDeclaration', () => { 31 | importNodes.forEach((node) => { 32 | expect(node.type).toEqual('ImportDeclaration'); 33 | }); 34 | }); 35 | 36 | it('getVariableNodes: Test that each element has type VariableDeclaration', () => { 37 | variableNodes.forEach((node) => { 38 | expect(node.type).toEqual('VariableDeclaration'); 39 | }); 40 | }); 41 | 42 | it('getNonImportNodes: Test that each element is not of type ImportDeclaration', () => { 43 | nonImportNodes.forEach((node) => { 44 | expect(node.type).not.toEqual('ImportDeclaration'); 45 | }); 46 | }); 47 | 48 | }); 49 | -------------------------------------------------------------------------------- /nexus/src/__tests__/react-parser-test.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | import { ReactParser } from '../parser/ReactParser.js'; 4 | 5 | describe('parser unit tests for functional component', () => { 6 | let parser; 7 | let importNodes; 8 | let variableNodes; 9 | let nonImportNodes; 10 | let childrenNodes; 11 | let jsxNodes; 12 | 13 | beforeAll(() => { 14 | parser = new ReactParser(fs.readFileSync(path.resolve(__dirname, './test_components/App.jsx'))); 15 | importNodes = parser.getImportNodes(parser.programBody); 16 | variableNodes = parser.getVariableNodes(parser.programBody); 17 | nonImportNodes = parser.getNonImportNodes(parser.programBody); 18 | childrenNodes = parser.getChildrenNodes(variableNodes); 19 | jsxNodes = parser.getJsxNodes(childrenNodes); 20 | }); 21 | 22 | it('getImportNodes: Test that each element has type ImportDeclaration', () => { 23 | importNodes.forEach((node) => { 24 | expect(node.type).toEqual('ImportDeclaration'); 25 | }); 26 | }); 27 | 28 | it('getVariableNodes: Test that each element has type VariableDeclaration', () => { 29 | variableNodes.forEach((node) => { 30 | expect(node.type).toEqual('VariableDeclaration'); 31 | }); 32 | }); 33 | 34 | it('getNonImportNodes: Test that each element is not of type ImportDeclaration', () => { 35 | nonImportNodes.forEach((node) => { 36 | expect(node.type).not.toEqual('ImportDeclaration'); 37 | }); 38 | }); 39 | 40 | it('getJsxNodes: Test that each element is of type JSXElement', () => { 41 | jsxNodes.forEach((node) => { 42 | expect(node.type).toEqual('JSXElement'); 43 | }); 44 | }); 45 | 46 | it('getChildrenNodes: Test that each element is a ComponentNode', () => { 47 | childrenNodes = parser.getChildrenComponents(jsxNodes, []); 48 | childrenNodes.forEach((node) => { 49 | // expect(node).toBeInstanceOf(ComponentNode); 50 | expect(node).toHaveProperty('name'); 51 | expect(node).toHaveProperty('children'); 52 | expect(node).toHaveProperty('props'); 53 | }); 54 | 55 | }); 56 | 57 | }); 58 | 59 | xdescribe('parser integration tests', () => { 60 | 61 | describe('parsing through functional component with 10 Nodes total, 7 ComponentNodes', () => { 62 | let parser; 63 | 64 | beforeAll(() => { 65 | // test component properties: 14 ESTree nodes; results in 7 ComponentNodes 66 | parser = new ReactParser(fs.readFileSync(path.resolve(__dirname, './test_components/App.jsx'))); 67 | }); 68 | 69 | it('programBody should have length of 10', () => { 70 | expect(parser.programBody.length).toEqual(10); 71 | }); 72 | 73 | it('array from main() should contain 7 ComponentNodes', () => { 74 | expect(parser.main().length).toEqual(7); 75 | }); 76 | 77 | it('nodes in returned array should have properties name, children, props', ()=> { 78 | parser.main().forEach((node) => { 79 | expect(node).toHaveProperty('name'); 80 | expect(node).toHaveProperty('children'); 81 | expect(node).toHaveProperty('props'); 82 | }); 83 | }); 84 | 85 | }); 86 | 87 | 88 | xdescribe('parsing through class components with _ Nodes total, _ ComponentNodes', () => { 89 | let parser; 90 | beforeAll(() => { 91 | // test component properties: 14 ESTree nodes; results in 7 ComponentNodes 92 | parser = new Parser(fs.readFileSync(path.resolve(__dirname, './test_components/newApp.jsx'))); 93 | console.log(parser.main()); 94 | }); 95 | 96 | it('programBody should have length of _', () => { 97 | expect(5).toEqual(5); 98 | }); 99 | 100 | // it('nodes in returned array should have properties name, children, props', () => { 101 | 102 | // }); 103 | }); 104 | 105 | }); -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/App.jsx: -------------------------------------------------------------------------------- 1 | // Example React component for testing parser logic. 2 | import React from 'react'; 3 | import Children from './Children.jsx'; 4 | import ScuttleCrab from './ScuttleCrab.jsx'; 5 | 6 | const URL = 'http://google.com'; 7 | const NUMBER = 10; 8 | 9 | function FUNC() { 10 | console.log('func'); 11 | } 12 | 13 | const FUNCTWO = () => { 14 | return 2; 15 | }; 16 | 17 | export async function getStaticProps() { 18 | const allPostsData = 'function'; 19 | return { 20 | props: { 21 | allPostsData, 22 | }, 23 | }; 24 | } 25 | 26 | const App = props => { 27 | const socket = io(); 28 | 29 | return ( 30 |
31 | {/* */} 32 | {/* */} 33 | {/* */} 34 | {/* 35 | click me for dogs 36 | */} 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | ); 47 | }; 48 | 49 | export default { App, URL }; 50 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/Child.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class Child extends React.component { 4 | constructor() { 5 | super(); 6 | } 7 | 8 | render() { 9 | return
I am GrandChild
; 10 | } 11 | } 12 | 13 | export default Child; 14 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/components/Cards/Card.module.css: -------------------------------------------------------------------------------- 1 | .card { 2 | width: 18rem; 3 | height: 22.5rem; 4 | margin-right: 3rem; 5 | text-align: center; 6 | color: rgb(97, 8, 97); 7 | margin-bottom: 2rem; 8 | box-shadow: 0.1rem 0.1rem 1rem rgba(0, 0, 0, 0.294); 9 | } 10 | 11 | .card-header { 12 | padding: 0; 13 | position: relative; 14 | height: 70%; 15 | } 16 | 17 | .heart { 18 | border-radius: 100%; 19 | background-color: rgba(255, 255, 255, 0.678); 20 | width: 3rem; 21 | height: 3rem; 22 | z-index: 100; 23 | position: absolute; 24 | bottom: 78%; 25 | left: 78%; 26 | display: flex; 27 | align-items: center; 28 | justify-content: center; 29 | cursor: pointer; 30 | border: none; 31 | } 32 | 33 | .heart img { 34 | width: 1.75rem; 35 | } 36 | 37 | .card-img { 38 | width: 100%; 39 | height: 100%; 40 | } 41 | 42 | .card h3 { 43 | margin: 0.5rem 0; 44 | } 45 | 46 | .card p { 47 | margin: 0; 48 | } -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/components/Cards/CardEvent.js: -------------------------------------------------------------------------------- 1 | import { useRouter } from 'next/router'; 2 | import React from 'react'; 3 | import styles from './Card.module.css'; 4 | 5 | export default function CardEvent({ title, date, time, who, description, id, eventType, image }) { 6 | const router = useRouter(); 7 | 8 | return ( 9 |
{ 12 | router.push(`event/${id}`); 13 | }} 14 | > 15 |
16 | {image.alt} 17 |
18 |
19 |

{title}

20 |

{date}

21 |

{time}

22 |

{eventType}

23 |

{description}

24 |

{who}

25 |
26 |
27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/components/Cards/CardItem.js: -------------------------------------------------------------------------------- 1 | import { useRouter } from 'next/router'; 2 | import React from 'react'; 3 | import styles from './Card.module.css'; 4 | 5 | export default function CardItem({ title, description, price, image, id, type }) { 6 | // ComponentNode{name: CardItem, props: { 7 | // title: 'from /jams/classic/index.js', description: 'from jams/classic/index.js', ... 8 | //}} 9 | const router = useRouter(); 10 | 11 | return ( 12 |
{ 15 | router.push(`/${type}s/${id}`); 16 | }} 17 | > 18 |
19 | {image.alt} 20 |
21 |
22 |

{title}

23 |

{description}

24 |

{price}

25 |
26 |
27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/components/Nav/Nav.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Link from 'next/link'; 3 | 4 | export default function Nav() { 5 | return ( 6 | 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/components/Nav/Splash/Splash.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useRouter } from 'next/router'; 3 | 4 | export default function Splash() { 5 | const router = useRouter(); 6 | 7 | return ( 8 |
9 |
10 |

Jams n Jams. N Jams.

11 |

Instruments and Canned Confections. And live jams. All in one place.

12 |

Show me...

13 | 16 | 19 | 22 |
23 |
24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/_app.js: -------------------------------------------------------------------------------- 1 | import '../styles/globals.css' 2 | import 'bootstrap/dist/css/bootstrap.css' 3 | 4 | function MyApp({ Component, pageProps }) { 5 | return 6 | } 7 | 8 | export default MyApp 9 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/instruments/drums/[id].js: -------------------------------------------------------------------------------- 1 | import data from '../../../data'; 2 | 3 | console.log('in api/dogs/id'); 4 | 5 | export default function handler(req, res) { 6 | console.log(req); 7 | const { id } = req.query; 8 | console.log(id); 9 | console.log(data.dogs); 10 | const curDog = data.dogs.find(dog => dog.id === Number(id)); 11 | console.log(curDog); 12 | res.status(200).json(curDog); 13 | } 14 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/instruments/drums/index.js: -------------------------------------------------------------------------------- 1 | import data from '../../../data'; 2 | 3 | console.log('i am on the index.js in api/dogs'); 4 | 5 | export default function handler(req, res) { 6 | res.status(200).json(data.dogs); 7 | } 8 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/instruments/guitars/[id].js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../../data'; 4 | 5 | export default function handler(req, res) { 6 | const { id } = req.query; 7 | const bird = data.birds.find(bird => bird.id === Number(id)); 8 | res.status(200).json(bird); 9 | } 10 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/instruments/guitars/index.js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../../data'; 4 | 5 | console.log('i am data in index.js in api/birds', data); 6 | 7 | export default function handler(req, res) { 8 | res.status(200).json(data.birds); 9 | } 10 | 11 | // http://localhost:3000/api/cats 12 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/instruments/keyboards/[id].js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../data'; 4 | 5 | export default function handler(req, res) { 6 | const { id } = req.query; 7 | const cat = data.cats.find(cat => cat.id === Number(id)); 8 | res.status(200).json(cat); 9 | } 10 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/instruments/keyboards/index.js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../data'; 4 | 5 | console.log('i am data in index.js in api/cats', data); 6 | 7 | export default function handler(req, res) { 8 | res.status(200).json(data.cats); 9 | } 10 | 11 | // http://localhost:3000/api/cats 12 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/jams/classic/[id].js: -------------------------------------------------------------------------------- 1 | import data from '../../../data'; 2 | 3 | console.log('in api/dogs/id'); 4 | 5 | export default function handler(req, res) { 6 | console.log(req); 7 | const { id } = req.query; 8 | console.log(id); 9 | console.log(data.dogs); 10 | const curDog = data.dogs.find(dog => dog.id === Number(id)); 11 | console.log(curDog); 12 | res.status(200).json(curDog); 13 | } 14 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/jams/classic/index.js: -------------------------------------------------------------------------------- 1 | import data from '../../../data'; 2 | 3 | console.log('i am on the index.js in api/dogs'); 4 | 5 | export default function handler(req, res) { 6 | res.status(200).json(data.dogs); 7 | } 8 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/jams/conserve/[id].js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../../data'; 4 | 5 | export default function handler(req, res) { 6 | const { id } = req.query; 7 | const bird = data.birds.find(bird => bird.id === Number(id)); 8 | res.status(200).json(bird); 9 | } 10 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/jams/conserve/index.js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../../data'; 4 | 5 | console.log('i am data in index.js in api/birds', data); 6 | 7 | export default function handler(req, res) { 8 | res.status(200).json(data.birds); 9 | } 10 | 11 | // http://localhost:3000/api/cats 12 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/jams/marmalades/[id].js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../data'; 4 | 5 | export default function handler(req, res) { 6 | const { id } = req.query; 7 | const cat = data.cats.find(cat => cat.id === Number(id)); 8 | res.status(200).json(cat); 9 | } 10 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/api/jams/marmalades/index.js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | import data from '../../../data'; 4 | 5 | console.log('i am data in index.js in api/cats', data); 6 | 7 | export default function handler(req, res) { 8 | res.status(200).json(data.cats); 9 | } 10 | 11 | // http://localhost:3000/api/cats 12 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/events/calendar/[id].js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Nav from '../../../components/Nav/Nav'; 3 | 4 | export default function Event({ event }) { 5 | const [event, setEvent] = useState(); 6 | 7 | const router = useRouter(); 8 | const { id } = router.query; 9 | 10 | useEffect(async () => { 11 | const response = await fetch(`/api/events/calendar/${id}`); 12 | const data = await response.json(); 13 | setEvent(data); 14 | }, []); 15 | 16 | return ( 17 |
18 |
33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /nexus/src/__tests__/test_components/jams-n-jams-app/pages/events/calendar/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CardEvent from '../../../components/Cards/CardItem'; 3 | import Nav from '../../../components/Nav/Nav'; 4 | 5 | export default function Calendar({ events }) { 6 | return ( 7 | <> 8 |