open-index/open-npm huggingface dataset:
npm package: @lastos/files-helper
Description: 文件操作
Latest version: 1.2.3

# 常用的文件操作类

安装：
```
npm install files-helper
```


##APIs
```
function getFileList(filePath: string, opt: any): Promise;
function copyFile(src: string, dest: string, opt:any): Promise;
function cancelCopy(id: string): Promise;
function removeFile(filePath:string): Promise;
function renameFile(filePath:string, newName:string): Promise;
function searchFiles(dirPath:string , seo:string): Promise;
```

## Example
```
copyFile(path.join(__dirname, 'src'), path.join(__dirname, 'temp')).then(res => {
    console.log(JSON.stringify(res));
});

```
npm package: @lastos/lapp-node-loader
Description: 将 C++ 通过 `node-gyp` 出来的 node 包，通过前端进行引入的一个loader库
Latest version: 1.0.2

# @lastos/lapp-node-loader

将 C++ 通过 `node-gyp` 出来的 node 包，通过前端进行引入的一个loader库

## 使用方式

webpack 配置：

```js

{
  test: /\.node?$/,
  loader: '@lastos/lapp-node-loader'
}
```

## 作用

使用了Electron给前端注入的 `window.require` 方法

```js
// 源码
import * as addon from './abc.node';

// 编译后
if(window.require){window.require(__webpack_require__.p+'bin/abc_[hash:6].node')}
```
npm package: @lastos/node-usb-detection
Description: 将node-usb-detection库，可以使用electron-rebuild进行改造electron版本
Author: Lastos Team
Latest version: 4.0.1

# @lastos/node-usb-detection

[node-usb-detection](https://github.com/MadLittleMods/node-usb-detection)，用于在Electron中通过Node.js去检测、查找、监听USB的库

这个单独发一个包是为了不需要额外的编译，直接引入进来就可以使用
Electron版本是根据容器版本来定的，版本号是Electron的版本号，release.x是真正的版本号
npm package: @lastos/page-spy-alipay
Description: A developer tool for debugging alipay miniprogram
Latest version: 2.2.4

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-alipay?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-alipay
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-alipay
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-alipay/dist/iife/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-alipay`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

The client SDK of [PageSpy](https://www.pagespy.org) used in alipay miniprogram environment.

## Usage

```ts
import PageSpy from '@lastos/page-spy-alipay';

const pageSpy = new PageSpy({
  api: 'example.com',
});
```

Please refer to the official documentation for more details [PageSpy API](https://www.pagespy.org/#/docs/api)。

## Other SDKs

If you are using UniAPP or Taro, we recommend using below SDKs respectively:

- [@lastos/page-spy-uniapp](https://www.npmjs.com/package/@lastos/page-spy-uniapp)
- [@lastos/page-spy-taro](https://www.npmjs.com/package/@lastos/page-spy-taro)
npm package: @lastos/page-spy-plugin-mp-data-harbor
Description: Used for caching data and downloading.
Latest version: 2.2.4

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-plugin-mp-data-harbor?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-plugin-mp-data-harbor
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-plugin-mp-data-harbor
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-plugin-mp-data-harbor/dist/esm/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-plugin-mp-data-harbor`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

This plugin is used in miniprogram environment, providing offline caching and data downloading capabilities.

In the past, remote debugging had a prerequisite that "both the client and debugging server must be online simultaneously." By utilizing the `mp-data-harbor` plugin, it internally listens for the `"public-data"` event ([what is the `public-data` event?](../../docs/plugin.md#behavioral-conventions)), allowing the offline caching of data. This innovation breaks the previous prerequisite of both the client and debugging server needing to be online simultaneously. When issues are identified by the client, testing colleagues can directly upload the data, marking a significant departure from the historical requirement of simultaneous online status for both the client and debugging server.

`mp-data-harbor` plugin starts collecting data when `new PageSpy()` is called. The collected data is stored in client-side memory.

## Definition

```ts
import { PageSpyPlugin } from '@lastos/page-spy-types';

type DataType = 'console' | 'network' | 'system' | 'storage';

interface DataHarborConfig {
  // Specify which types of data should be collected
  caredData?: Record<DataType, boolean>;

  // Customize the log's filename
  filename?: () => string;
}

declare class DataHarborPlugin implements PageSpyPlugin {
  constructor(config?: DataHarborConfig);
}

export default DataHarborPlugin;
```

## Usage

### Load plugin

```ts
import PageSpy from '@lastos/page-spy-uniapp';
// Import the plugin in your entry file like "main.ts".
import DataHarborPlugin from '@lastos/page-spy-plugin-mp-data-harbor';

// Init and register the plugin before the PageSpy sdk initiated.
const harbor = new DataHarborPlugin(config);
PageSpy.registerPlugin(harbor);

// Init PageSpy
new PageSpy();
```

### Upload data

There are 2 ways to upload the offline data:

1. call `upload` method of the plugin:

```js
harbor.plugin.upload().then((res) => {
  conssole.log('upload successfully');
});
```

2. Upload via PageSpy's control panel:

With the `mp-data-harbor` plugin, there will be an upload button in the PageSpy control panel.

<img src="./screenshots/modal.png" alt="Download" height="400" />

### Replay log

Goto the debugger's log list page and click the "Replay log" button, select the file uploaded in prev step, now you can use the replay to debug.

<img src="./screenshots/guide-en.png" alt="Entry" height="400" />
npm package: @lastos/page-spy-plugin-mp-eval
Description: Used for code evaluation in mini program.
Latest version: 2.2.4

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-plugin-mp-eval?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-plugin-mp-eval
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-plugin-mp-eval
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-plugin-mp-eval/dist/iife/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-plugin-mp-eval`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

The `MPEvalPlugin` is used in mini program SDK of PageSpy, making it possible to run dynamic scripts in the mini program environment.

Available mini program SDKs include:

- [@lastos/page-spy-wechat](https://www.npmjs.com/package/@lastos/page-spy-wechat)
- [@lastos/page-spy-alipay](https://www.npmjs.com/package/@lastos/page-spy-alipay)
- [@lastos/page-spy-uniapp](https://www.npmjs.com/package/@lastos/page-spy-uniapp)
- [@lastos/page-spy-taro](https://www.npmjs.com/package/@lastos/page-spy-taro)

> [!CAUTION]
> When submitting the mini program for review, be sure to delete this plugin in the code, otherwise the review will fail.

## Usage

```ts
// In your entry file like "main.ts"
import PageSpy from '@lastos/page-spy-wechat';
import MPEvalPlugin from '@lastos/page-spy-plugin-mp-eval';

// Register plugin
PageSpy.registerPlugin(new MPEvalPlugin());
// Init PageSpy
const pageSpy = new PageSpy();
```
npm package: @lastos/page-spy-plugin-rn-async-storage
Description: A PageSpy plugin, used for React Native app with async-storage.
Latest version: 2.2.4

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-plugin-rn-async-storage?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-plugin-rn-async-storage
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-plugin-rn-async-storage
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-plugin-rn-async-storage/dist/iife/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-plugin-rn-async-storage`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

This plugin is used in React Native environment to inspect the data in AsyncStorage.

This plugin can only be registered in PageSpy ReactNative SDK: [`@lastos/page-spy-react-native`](https://www.npmjs.com/package/@lastos/page-spy-react-native).

## Usage

```ts
// In your entry file like "main.ts"
import PageSpy from '@lastos/page-spy-react-native';
import AsyncStoragePlugin from '@lastos/page-spy-plugin-rn-async-storage';

// Register plugin
PageSpy.registerPlugin(new AsyncStoragePlugin());
// Init PageSpy
const pageSpy = new PageSpy();
```

After that, enter the debug room on PageSpy web page and you can see the data in Storage -> AsyncStorage.
npm package: @lastos/page-spy-plugin-rrweb
Description: Record the DOM mutation within PageSpy.
Latest version: 2.2.5

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-plugin-rrweb?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-plugin-rrweb
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-plugin-rrweb
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-plugin-rrweb/dist/iife/index.min.js
[rrweb-repo]: https://github.com/rrweb-io/rrweb
[rrweb-record-options]: https://github.com/rrweb-io/rrweb/blob/master/guide.md#options

English | [中文](./README_ZH.md)

# `@lastos/page-spy-plugin-rrweb`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

> Use `rrweb` under the hood, record the DOM mutation within PageSpy, only be available in browser environment.

## Definition

```ts
import { PageSpyPlugin } from '@lastos/page-spy-types';
import type { recordOptions } from 'rrweb/typings/types';
import type { eventWithTime } from '@rrweb/types';

interface Options extends recordOptions<eventWithTime> {}

declare class RRWebPlugin implements PageSpyPlugin {
  constructor(options?: Options);
}

export default RRWebPlugin;
```

`RRWebPlugin` use [`rrweb-record`][rrweb-repo] under the hood, the instantiate options reference [record options][rrweb-record-options].

## Usage

### Load plugin

- Options 1: Load with script

  ```html
  <html>
    <head>
      <!-- 1. Load PageSpy -->
      <script src="https://<your-host>/page-spy/index.min.js"></script>
      <!-- 2. Load the DataHarborPlugin plugin -->
      <script src="https://<your-host>/plugin/data-harbor/index.min.js"></script>
      <!-- 3. Load the RRWebPlugin plugin -->
      <script src="https://<your-host>/plugin/rrweb/index.min.js"></script>
      <!-- 4. Register plugin && Init PageSpy -->
      <script>
        // 1. Register DataHarborPlugin plugin
        PageSpy.registerPlugin(new DataHarborPlugin(config));
        // 2. Register RRWebPlugin plugin
        PageSpy.registerPlugin(new RRWebPlugin(options));
        // 3. Init PageSpy
        window.$pageSpy = new PageSpy();
      </script>
    </head>
  </html>
  ```

- Option 2: Import within ESM

  ```ts
  // In your entry file like "main.ts"
  import PageSpy from '@lastos/page-spy-browser';
  import RRWebPlugin from '@lastos/page-spy-plugin-rrweb';

  // Register plugin
  PageSpy.registerPlugin(new RRWebPlugin(options));
  // Init PageSpy
  window.$pageSpy = new PageSpy();
  ```

### Replay

The data from 'rrweb-event' is typically larger (more interactions and complex webpage structures result in larger data). When developers debug, real-time transmission can impose a burden on network overhead, and page interactions are not always critical information. Considering these factors, this plugin only dispatch the 'public-data' event ([what's the `public-data` event?](../../docs/plugin.md#behavioral-conventions)) for statistical plugins to collect.
npm package: @lastos/page-spy-react-native
Description: An SDK of PageSpy for debugging react native app
Latest version: 2.2.6

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-react-native?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-react-native
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-react-native
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-react-native/dist/esm/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-react-native`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

> The SDK used in React Native apps.

> [!CAUTION]
> When submitting the mini program for review, be sure to delete the SDK in the code, otherwise the review will fail.

## Usage

```ts
import PageSpy from '@lastos/page-spy-react-native'

const pageSpy = new PageSpy(config?: InitConfig)
```

## `InitConfig` definition

Except for the `api` parameter is required, all others parameters are optional:

```ts
interface InitConfig {
  // Server domain, must be provided。
  // Example："example.com"
  api: string;

  // "project" is an aggregation of information that can be searched in the room list on the debug side.
  // default: 'default'
  project?: string;

  // "title" is a user-defined parameter that can be used to distinguish the current debugging client,
  // and the corresponding information is displayed under the "device id" in each debugging connection panel.
  // default: '--'
  title?: string;

  // Manually specify the scheme of the PageSpy service.
  // Note that except for development environment, mini-program requires the scheme to be set to "https", so:
  //  - By default, pass the value undefined or null, the SDK will parse it to TRUE;
  //  - true: the SDK will access the PageSpy service via ["https://", "wss://"];
  //  - false: the SDK will access the PageSpy service via ["http://", "wss://"].
  enableSSL?: boolean | null;

  // All internal plugins are carried with PageSpy by default out of the box.
  // You can disable some plugins as needed.
  disabledPlugins?: (InternalPlugins | string)[];
}

type InternalPlugins =
  | 'ConsolePlugin'
  | 'ErrorPlugin'
  | 'NetworkPlugin'
  | 'SystemPlugin';
```

## Other topics

### https

iOS and Android only support HTTPS by default. If the page-spy service you deploy doesn't have HTTPS enabled, it will result in being unable to connect to the page-spy service.

And here's the link: https://reactnative.dev/docs/network

### storage

This package does not include a default storage plugin, since the latest React Native removed the official storage APIs.

If you use the official recommended storage library `@react-native-async-storage/async-storage`, we provide an independent plugin for you: [`@lastos/page-spy-plugin-rn-async-storage`](https://www.npmjs.com/package/@lastos/page-spy-plugin-rn-async-storage)
npm package: @lastos/page-spy-taro
Description: A developer tool for debugging taro miniprogram
Latest version: 2.2.4

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-taro?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-taro
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-taro
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-taro/dist/esm/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-taro`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

The client SDK of [PageSpy](https://www.pagespy.org) used with Taro.

## Usage

```ts
import PageSpy from '@lastos/page-spy-taro';

const pageSpy = new PageSpy({
  api: 'example.com',
});
```

Please refer to the official documentation for more details [PageSpy API](https://www.pagespy.org/#/docs/api)。
npm package: @lastos/page-spy-types
Description: Types for PageSpy SDK
Latest version: 2.2.5

English | [中文](./README_ZH.md)

# `@lastos/page-spy-types`

> Types for PageSpy SDK.

## Usage

```ts
import * as PageSpyTypes from '@lastos/page-spy-types'

class SomePlugin implements PageSpyTypes.PageSpyPlugin {
  ...
}
```
npm package: @lastos/page-spy-uniapp
Description: A developer tool for debugging uniapp miniprogram
Latest version: 2.2.4

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-uniapp?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-uniapp
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-uniapp
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-uniapp/dist/esm/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-uniapp`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

The client SDK of [PageSpy](https://www.pagespy.org) used with UniAPP.

## Usage

```ts
import PageSpy from '@lastos/page-spy-uniapp';

const pageSpy = new PageSpy({
  api: 'example.com',
});
```

Please refer to the official documentation for more details [PageSpy API](https://www.pagespy.org/#/docs/api)。
npm package: @lastos/page-spy-wechat
Description: A developer tool for debugging wechat miniprogram
Latest version: 2.2.4

[npm-image]: https://img.shields.io/npm/v/@lastos/page-spy-wechat?logo=npm&label=version
[npm-url]: https://www.npmjs.com/package/@lastos/page-spy-wechat
[minified-image]: https://img.shields.io/bundlephobia/min/@lastos/page-spy-wechat
[minified-url]: https://unpkg.com/browse/@lastos/page-spy-wechat/dist/iife/index.min.js

English | [中文](./README_ZH.md)

# `@lastos/page-spy-wechat`

[![SDK version][npm-image]][npm-url]
[![SDK size][minified-image]][minified-url]

The client SDK of [PageSpy](https://www.pagespy.org) used in wechat miniprogram environment.

## Usage

```ts
import PageSpy from '@lastos/page-spy-wechat';

const pageSpy = new PageSpy({
  api: 'example.com',
});
```

Please refer to the official documentation for more details [PageSpy API](https://www.pagespy.org/#/docs/api)。

## Other SDKs

If you are using UniAPP or Taro, we recommend using below SDKs respectively:

- [@lastos/page-spy-uniapp](https://www.npmjs.com/package/@lastos/page-spy-uniapp)
- [@lastos/page-spy-taro](https://www.npmjs.com/package/@lastos/page-spy-taro)
npm package: @lastos/robotjs
Description: 适配轻应用容器的robotjs，无需安装robotjs可以直接使用，版本号与electron版本同步
Author: liweimin@cvte.com
Latest version: 6.0.7-release.3

# @lastos/robotjs

[robotjs](https://github.com/octalmage/robotjs)，用于在Electron中通过Node.js去控制鼠标、键盘、截图等

这个单独发一个包是为了不需要额外的编译，直接引入进来就可以使用
Electron版本是根据容器版本来定的，版本号是Electron的版本号，`release.x`是真正的版本号
npm package: @lastos/uiohook-napi
Description: [![](https://img.shields.io/npm/v/uiohook-napi/latest?color=CC3534&label=uiohook-napi&logo=npm&labelColor=212121)](https://www.npmjs.com/package/uiohook-napi)
Author: Alexander Drozdov
Latest version: 1.2.3

# uiohook-napi

[![](https://img.shields.io/npm/v/uiohook-napi/latest?color=CC3534&label=uiohook-napi&logo=npm&labelColor=212121)](https://www.npmjs.com/package/uiohook-napi)

N-API C-bindings for [libuiohook](https://github.com/kwhat/libuiohook).


### Usage example

```typescript
import { uIOhook, UiohookKey } from '@lastos/uiohook-napi'

uIOhook.on('keydown', (e) => {
  if (e.keycode === UiohookKey.Q) {
    console.log('Hello!')
  }

  if (e.keycode === UiohookKey.Escape) {
    process.exit(0)
  }
})

uIOhook.start()
```

### API

```typescript
interface UiohookNapi {
  on(event: 'input', listener: (e: UiohookKeyboardEvent | UiohookMouseEvent | UiohookWheelEvent) => void): this

  on(event: 'keydown', listener: (e: UiohookKeyboardEvent) => void): this
  on(event: 'keyup', listener: (e: UiohookKeyboardEvent) => void): this

  on(event: 'mousedown', listener: (e: UiohookMouseEvent) => void): this
  on(event: 'mouseup', listener: (e: UiohookMouseEvent) => void): this
  on(event: 'mousemove', listener: (e: UiohookMouseEvent) => void): this
  on(event: 'click', listener: (e: UiohookMouseEvent) => void): this

  on(event: 'wheel', listener: (e: UiohookWheelEvent) => void): this
}

export interface UiohookKeyboardEvent {
  altKey: boolean
  ctrlKey: boolean
  metaKey: boolean
  shiftKey: boolean
  keycode: number
}

export interface UiohookMouseEvent {
  altKey: boolean
  ctrlKey: boolean
  metaKey: boolean
  shiftKey: boolean
  x: number
  y: number
  button: unknown
  clicks: number
}

export interface UiohookWheelEvent {
  altKey: boolean
  ctrlKey: boolean
  metaKey: boolean
  shiftKey: boolean
  x: number
  y: number
  clicks: number
  amount: number
  direction: WheelDirection
  rotation: number
}
```