editor.js — react Source File
Architecture documentation for editor.js, a javascript file in the react codebase. 4 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 39f6c195_7b6b_6f87_7437_5d782daf3565["editor.js"] 324b23d8_44c6_f20a_4338_46cccc56566e["fs"] 39f6c195_7b6b_6f87_7437_5d782daf3565 --> 324b23d8_44c6_f20a_4338_46cccc56566e b402a0fc_00db_e86d_b1ea_ad4f8e9faaca["path"] 39f6c195_7b6b_6f87_7437_5d782daf3565 --> b402a0fc_00db_e86d_b1ea_ad4f8e9faaca 6a88ed04_6732_212f_bbac_658bd7cb3b65["child_process"] 39f6c195_7b6b_6f87_7437_5d782daf3565 --> 6a88ed04_6732_212f_bbac_658bd7cb3b65 79d1d312_ff50_baa5_cde2_0ea18ac459a3["shell-quote"] 39f6c195_7b6b_6f87_7437_5d782daf3565 --> 79d1d312_ff50_baa5_cde2_0ea18ac459a3 1125c601_01c3_8f9b_92e0_8a980bac4511["standalone.js"] 1125c601_01c3_8f9b_92e0_8a980bac4511 --> 39f6c195_7b6b_6f87_7437_5d782daf3565 style 39f6c195_7b6b_6f87_7437_5d782daf3565 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {existsSync} from 'fs';
import {basename, join, isAbsolute} from 'path';
import {execSync, spawn} from 'child_process';
import {parse} from 'shell-quote';
function isTerminalEditor(editor: string): boolean {
switch (editor) {
case 'vim':
case 'emacs':
case 'nano':
return true;
default:
return false;
}
}
// Map from full process name to binary that starts the process
// We can't just re-use full process name, because it will spawn a new instance
// of the app every time
const COMMON_EDITORS = {
'/Applications/Atom.app/Contents/MacOS/Atom': 'atom',
'/Applications/Atom Beta.app/Contents/MacOS/Atom Beta':
'/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',
'/Applications/Sublime Text.app/Contents/MacOS/Sublime Text':
'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
'/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2':
'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
'/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code',
};
function getArgumentsForLineNumber(
editor: string,
filePath: string,
lineNumber: number,
): Array<string> {
switch (basename(editor)) {
case 'vim':
case 'mvim':
return [filePath, '+' + lineNumber];
case 'atom':
case 'Atom':
case 'Atom Beta':
case 'subl':
case 'sublime':
case 'wstorm':
case 'appcode':
case 'charm':
case 'idea':
return [filePath + ':' + lineNumber];
case 'joe':
case 'emacs':
// ... (135 more lines)
Domain
Subdomains
Functions
Dependencies
- child_process
- fs
- path
- shell-quote
Imported By
Source
Frequently Asked Questions
What does editor.js do?
editor.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in editor.js?
editor.js defines 6 function(s): doesFilePathExist, getArgumentsForLineNumber, getValidFilePath, guessEditor, isTerminalEditor, launchEditor.
What does editor.js depend on?
editor.js imports 4 module(s): child_process, fs, path, shell-quote.
What files import editor.js?
editor.js is imported by 1 file(s): standalone.js.
Where is editor.js in the architecture?
editor.js is located at packages/react-devtools-core/src/editor.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-core/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free