Remove remaining Node imports from core
Summary: Removed remaining path / fs imports from Flipper core. `expand-tide` needed replacement too, but noticed that it never actually rewrites paths since all use cases were already using absolute paths, so removed it instead. Reviewed By: aigoncharov Differential Revision: D33017654 fbshipit-source-id: e12f66ef68b5f9e4279411c94445a2fb87249e9a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d95b15094f
commit
accef856fc
@@ -9,11 +9,11 @@
|
||||
|
||||
import {Button as AntButton, message} from 'antd';
|
||||
import React, {useState, useEffect, useCallback} from 'react';
|
||||
import path from 'path';
|
||||
import {capture, getCaptureLocation, getFileName} from '../utils/screenshot';
|
||||
import {CameraOutlined, VideoCameraOutlined} from '@ant-design/icons';
|
||||
import {useStore} from '../utils/useStore';
|
||||
import {getRenderHostInstance} from '../RenderHost';
|
||||
import {path} from 'flipper-plugin';
|
||||
|
||||
async function openFile(path: string) {
|
||||
getRenderHostInstance().flipperServer.exec('open-file', path);
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
import React, {Component} from 'react';
|
||||
import BaseDevice from '../devices/BaseDevice';
|
||||
import {Button, Glyph, colors} from '../ui';
|
||||
import path from 'path';
|
||||
import {getRenderHostInstance} from '../RenderHost';
|
||||
import {path} from 'flipper-plugin';
|
||||
|
||||
type OwnProps = {
|
||||
recordingFinished: (path: string | null) => void;
|
||||
|
||||
@@ -16,11 +16,9 @@ import {
|
||||
colors,
|
||||
Glyph,
|
||||
} from '../../ui';
|
||||
import React, {useState} from 'react';
|
||||
import {promises as fs} from 'fs';
|
||||
import {theme} from 'flipper-plugin';
|
||||
import React, {useState, useEffect} from 'react';
|
||||
import {getFlipperLib, theme} from 'flipper-plugin';
|
||||
import {getRenderHostInstance} from '../../RenderHost';
|
||||
import {useEffect} from 'react';
|
||||
|
||||
export const ConfigFieldContainer = styled(FlexRow)({
|
||||
paddingLeft: 10,
|
||||
@@ -75,8 +73,8 @@ export function FilePathConfigField(props: {
|
||||
useEffect(() => {
|
||||
(async function () {
|
||||
try {
|
||||
const stat = await fs.stat(value);
|
||||
setIsValid(props.isRegularFile !== stat.isDirectory());
|
||||
const stat = await getFlipperLib().remoteServerContext.fs.stat(value);
|
||||
setIsValid(props.isRegularFile !== stat.isDirectory);
|
||||
} catch (_) {
|
||||
setIsValid(false);
|
||||
}
|
||||
@@ -93,8 +91,9 @@ export function FilePathConfigField(props: {
|
||||
onChange={(e) => {
|
||||
setValue(e.target.value);
|
||||
props.onChange(e.target.value);
|
||||
fs.stat(e.target.value)
|
||||
.then((stat) => stat.isDirectory())
|
||||
getFlipperLib()
|
||||
.remoteServerContext.fs.stat(e.target.value)
|
||||
.then((stat) => stat.isDirectory)
|
||||
.then((valid) => {
|
||||
if (valid !== isValid) {
|
||||
setIsValid(valid);
|
||||
|
||||
Reference in New Issue
Block a user