rm one pkg

This commit is contained in:
EthanShoeDev
2025-09-17 17:22:50 -04:00
parent 86ff6762a3
commit 2f5568a6d5
20 changed files with 44 additions and 225 deletions

View File

@@ -38,9 +38,9 @@ function ShellDetail() {
function sendDataToXterm(data: ArrayBuffer) {
try {
const bytes = new Uint8Array(data);
console.log('sendDataToXterm', new TextDecoder().decode(bytes));
xtermWebViewRef.current?.write(bytes);
const bytes = new Uint8Array(data.slice());
console.log('sendDataToXterm', new TextDecoder().decode(bytes.slice()));
xtermWebViewRef.current?.write(bytes.slice());
} catch (e) {
console.warn('Failed to decode shell data', e);
}
@@ -59,7 +59,10 @@ function ShellDetail() {
const xtermQueue = queueRef.current;
if (!connection || !xtermQueue) return;
const listenerId = connection.addChannelListener((data: ArrayBuffer) => {
console.log('ssh.onData', new TextDecoder().decode(new Uint8Array(data)));
console.log(
'ssh.onData',
new TextDecoder().decode(new Uint8Array(data.slice())),
);
void xtermQueue.add(() => {
sendDataToXterm(data);
});
@@ -126,7 +129,7 @@ setTimeout(() => {
}
const data = message.data;
console.log('xterm.onMessage', new TextDecoder().decode(data));
void shell?.sendData(data.buffer as ArrayBuffer);
void shell?.sendData(data.slice().buffer as ArrayBuffer);
}}
/>
</View>

View File

@@ -1,24 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -1,27 +0,0 @@
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import { globalIgnores, defineConfig } from 'eslint/config';
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
]);

View File

@@ -1,43 +0,0 @@
{
"name": "@fressh/react-native-xtermjs-webview-internal",
"private": true,
"version": "0.0.0",
"type": "module",
"files": [
"dist"
],
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"fmt:check": "cross-env SORT_IMPORTS=true prettier --check .",
"fmt": "cross-env SORT_IMPORTS=true prettier --write .",
"eslint:check": "eslint . --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint --fix --report-unused-disable-directives --max-warnings 0 .",
"typecheck": "tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"js-base64": "^3.7.8",
"react": "19.1.0",
"react-dom": "19.1.0"
},
"devDependencies": {
"@epic-web/config": "^1.21.3",
"@eslint/js": "^9.35.0",
"@types/react": "~19.1.12",
"@types/react-dom": "^19.1.7",
"@vitejs/plugin-react": "^5.0.2",
"eslint": "^9.35.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.4.0",
"prettier": "^3.6.2",
"prettier-plugin-organize-imports": "^4.2.0",
"typescript": "~5.9.2",
"typescript-eslint": "^8.44.0",
"vite": "6.3.6",
"vite-plugin-singlefile": "^2.3.0"
}
}

View File

@@ -1,14 +0,0 @@
import epicConfig from '@epic-web/config/prettier';
// Sometimes this plugin can remove imports that are being edited.
// As a workaround we will only use this in the cli. (pnpm run fmt)
const sortImports = process.env.SORT_IMPORTS === 'true-never';
/** @type {import("prettier").Options} */
export default {
...epicConfig,
semi: true,
plugins: [
...(sortImports ? ['prettier-plugin-organize-imports'] : []),
...(epicConfig.plugins || []),
],
};

View File

@@ -1,7 +0,0 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

View File

@@ -1,25 +0,0 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

View File

@@ -1,7 +0,0 @@
{
"extends": ["//"],
"tasks": {
"lint": {},
"lint:check": {}
}
}

View File

@@ -9,6 +9,7 @@ lerna-debug.log*
node_modules
dist
dist-internal
dist-ssr
*.local

View File

@@ -8,6 +8,6 @@
id="terminal"
style="margin: 0; padding: 0; width: 100%; height: 100%"
></div>
<script type="module" src="/src/main.tsx"></script>
<script type="module" src="/src-internal/main.tsx"></script>
</body>
</html>

View File

@@ -8,7 +8,8 @@
},
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build:main": "tsc -b && vite build",
"build:internal": "tsc -b && vite build --config vite.config.internal.ts",
"fmt:check": "cross-env SORT_IMPORTS=true prettier --check .",
"fmt": "cross-env SORT_IMPORTS=true prettier --write .",
"eslint:check": "eslint . --report-unused-disable-directives --max-warnings 0",
@@ -17,7 +18,6 @@
"preview": "vite preview"
},
"dependencies": {
"@fressh/react-native-xtermjs-webview-internal": "workspace:*",
"js-base64": "^3.7.8"
},
"peerDependencies": {
@@ -31,8 +31,12 @@
"@types/react": "~19.1.12",
"@types/react-dom": "^19.1.7",
"@vitejs/plugin-react": "^5.0.2",
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"js-base64": "^3.7.8",
"eslint": "^9.35.0",
"eslint-plugin-react-hooks": "^5.2.0",
"vite-plugin-singlefile": "^2.3.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.4.0",
"prettier": "^3.6.2",

View File

@@ -1,6 +1,6 @@
import { useImperativeHandle, useRef, type ComponentProps } from 'react';
import { WebView } from 'react-native-webview';
import htmlString from '@fressh/react-native-xtermjs-webview-internal/dist/index.html?raw';
import htmlString from '../dist-internal/index.html?raw';
import { Base64 } from 'js-base64';
type StrictOmit<T, K extends keyof T> = Omit<T, K>;
@@ -27,7 +27,7 @@ export function XtermJsWebView({
useImperativeHandle(ref, () => {
return {
write: (data) => {
const base64Data = Base64.fromUint8Array(data);
const base64Data = Base64.fromUint8Array(data.slice());
webViewRef.current?.injectJavaScript(`
window?.terminalWriteBase64?.('${base64Data}');
`);
@@ -46,7 +46,7 @@ export function XtermJsWebView({
onMessage?.({ type: 'initialized' });
return;
}
const data = Base64.toUint8Array(message);
const data = Base64.toUint8Array(message.slice());
onMessage?.({ type: 'data', data });
}}
{...props}

View File

@@ -1,6 +1,6 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app-internal.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
@@ -23,5 +23,5 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
"include": ["src-internal"]
}

View File

@@ -2,6 +2,7 @@
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.app-internal.json" },
{ "path": "./tsconfig.node.json" }
]
}

View File

@@ -21,5 +21,5 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
"include": ["vite.config.ts", "vite.config.internal.ts"]
}

View File

@@ -1,6 +1,18 @@
{
"extends": ["//"],
"tasks": {
"build": {
"dependsOn": ["build:internal", "build:main"]
},
"build:main": {
"inputs": ["src/**"],
"dependsOn": ["build:internal"],
"outputs": ["dist/**"]
},
"build:internal": {
"inputs": ["src-internal/**"],
"outputs": ["dist-internal/**"]
},
"lint": {},
"lint:check": {}
}

View File

@@ -4,4 +4,7 @@ import { viteSingleFile } from 'vite-plugin-singlefile';
// https://vite.dev/config/
export default defineConfig({
plugins: [viteSingleFile()],
build: {
outDir: 'dist-internal',
},
});

70
pnpm-lock.yaml generated
View File

@@ -324,9 +324,6 @@ importers:
packages/react-native-xtermjs-webview:
dependencies:
'@fressh/react-native-xtermjs-webview-internal':
specifier: workspace:*
version: link:../react-native-xtermjs-webview-internal
js-base64:
specifier: ^3.7.8
version: 3.7.8
@@ -346,6 +343,12 @@ importers:
'@vitejs/plugin-react':
specifier: ^5.0.2
version: 5.0.2(vite@6.3.6(@types/node@24.3.0)(jiti@2.5.1)(lightningcss@1.30.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1))
'@xterm/addon-fit':
specifier: ^0.10.0
version: 0.10.0(@xterm/xterm@5.5.0)
'@xterm/xterm':
specifier: ^5.5.0
version: 5.5.0
eslint:
specifier: ^9.35.0
version: 9.35.0(jiti@2.5.1)
@@ -385,67 +388,6 @@ importers:
vite-plugin-dts:
specifier: ^4.5.4
version: 4.5.4(@types/node@24.3.0)(rollup@4.50.2)(typescript@5.9.2)(vite@6.3.6(@types/node@24.3.0)(jiti@2.5.1)(lightningcss@1.30.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1))
packages/react-native-xtermjs-webview-internal:
dependencies:
'@xterm/addon-fit':
specifier: ^0.10.0
version: 0.10.0(@xterm/xterm@5.5.0)
'@xterm/xterm':
specifier: ^5.5.0
version: 5.5.0
js-base64:
specifier: ^3.7.8
version: 3.7.8
react:
specifier: 19.1.0
version: 19.1.0
react-dom:
specifier: 19.1.0
version: 19.1.0(react@19.1.0)
devDependencies:
'@epic-web/config':
specifier: ^1.21.3
version: 1.21.3(@typescript-eslint/utils@8.44.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.35.0(jiti@2.5.1))(prettier-plugin-astro@0.14.1)(prettier-plugin-organize-imports@4.2.0(prettier@3.6.2)(typescript@5.9.2))(prettier@3.6.2)(typescript@5.9.2)
'@eslint/js':
specifier: ^9.35.0
version: 9.35.0
'@types/react':
specifier: ~19.1.12
version: 19.1.12
'@types/react-dom':
specifier: ^19.1.7
version: 19.1.9(@types/react@19.1.12)
'@vitejs/plugin-react':
specifier: ^5.0.2
version: 5.0.2(vite@6.3.6(@types/node@24.3.0)(jiti@2.5.1)(lightningcss@1.30.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1))
eslint:
specifier: ^9.35.0
version: 9.35.0(jiti@2.5.1)
eslint-plugin-react-hooks:
specifier: ^5.2.0
version: 5.2.0(eslint@9.35.0(jiti@2.5.1))
eslint-plugin-react-refresh:
specifier: ^0.4.20
version: 0.4.20(eslint@9.35.0(jiti@2.5.1))
globals:
specifier: ^16.4.0
version: 16.4.0
prettier:
specifier: ^3.6.2
version: 3.6.2
prettier-plugin-organize-imports:
specifier: ^4.2.0
version: 4.2.0(prettier@3.6.2)(typescript@5.9.2)
typescript:
specifier: ~5.9.2
version: 5.9.2
typescript-eslint:
specifier: ^8.44.0
version: 8.44.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2)
vite:
specifier: 6.3.6
version: 6.3.6(@types/node@24.3.0)(jiti@2.5.1)(lightningcss@1.30.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1)
vite-plugin-singlefile:
specifier: ^2.3.0
version: 2.3.0(rollup@4.50.2)(vite@6.3.6(@types/node@24.3.0)(jiti@2.5.1)(lightningcss@1.30.1)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1))