@applicaster/zapp-pipes-dev-kit

中文文档
1.4.7发布于 2024/05/15ISCCommonJS近 30 天下载 1953

应用软件Zapp-Pipes数据源插件的开发套件

中文使用文档
文档目录5 节
  1. 如何使用
  2. 安装
  3. API : (英语)
  4. 本土桥梁注入
  5. 促进发展

zapp-pipe-dev-kit (英语)

该项目包含Zapp-pipes开发工具包来开发,测试并部署zapp-pipe捆绑.

如何使用

Dev 套件可以用于运行 zapp- piles 捆绑的不同模式 :

  • 服务器模式 : 创建可用于测试请求的节点.js服务器.
  • 库模式 : 创建可以直接在应用程序内使用的捆绑

dev Kit 并不是为了建立生产捆绑,而只是为了发展和测试新的供应商.

安装

  • 以 npm 为单位: 运行 yarn add @applicaster/zapp-pipes-dev-kit 或者说
  • 本地复制此repo, 安装依赖性, 并按路径要求它

API : (英语)

服务器模式

  • 导入 createZappPipesServer 函数来自 dev 工具包。 此功能以配置对象为参数, 并返回完整的 hopi 服务器对象, 加上启动服务器的功能
// signature
const config = {
  options: { port: 8080, host: "localhost" }, // optionnal. these are the default values
  providers: [providers] // array of providers to load
};

// returns

server = {
  ...hapiServerObject, // hapi server
  startServer // function to start the server
};
  • 从其他软件包或本地代码导入您的提供者,然后引用该方法.
import { createZappPipesServer } from "zapp-pipes-dev-kit";
import provider from "your-provider-packeage";

const zappPipesServer = createZappPipesServer({ providers: [provider] });
// zappPipesServer contains the full Hapi properties so you can add routes, invoke the start function directly, etc...

// or simply start the server with its basic configuration
zappPipesServer.startServer();

你可以去拜访 http://{host}:{port} 测试请求

库模式

库模式用于为应用程序构建时对提供者进行包装 遵循这些步骤:

  • 导入 createZappPipesLibrary 函数。 此函数将一系列提供者和发布名称( 用于在 Sentry 中识别库) 作为参数, 返回 a ZappPipesGetter 类,是 zapp- piles js 捆绑的切入点
import { createZappPipesLibrary } form 'zapp-pipes-dev-kit';
import provider form 'path-to-your-provider';

class ZappPipesGetter = {
  constructor() {
    this.get = createZappPipesLibrary({ providers: [provider], release: 'release-name' });
  }
}

export { ZappPipesGetter };

// you can now use this class to perform request like the app would.

const zappPipes = new ZappPipesGetter();
zappPipes.get('provider-name://fetchData?type=XXX&url=YYY', console.log);

本土桥梁注入

在每种模式,服务器或库中,可以注入自定义的本土桥来让提供者与环境互动. 原生桥是一个模块,在提供者的处理器功能中被注入,并提供了几个特性.

在Zapp-iOS和Zapp-Android中,不需要定义定制的本土桥. 但是,如果你在本地,服务器上,或在任何其他环境中使用这个软件包,你就可以这样做. 以下是定制的本土桥梁模块的外观

// All methods are optional since the custom nativeBridge is merged with the
// default one. Customizing the appData() function will do in most cases

const nativeBridge = {
  sendResponse(response, code) {}, // hook invoked when the provider returns its data
  log(...messages) {}, // log function which can be used in providers and customised dependending on the environment
  throwError(reason) {}, // hook invoked when the providers returns an error
  appData() {} // function which gives the provider some data regarding the native environment (platform, bundle identifier, account Id, broadcaster Id, uuid...);
};

// library mode
const zappPipesGetter = createZappPipesLibrary({
  providers,
  release,
  nativeBridge
});

// server mode
const zappPipesServer = createZappPipesServer({
  providers,
  release,
  nativeBridge
});

促进发展

  • 克隆这个还原
  • 安装依赖关系 yarn 或者说 npm install

版本与发布记录

@applicaster/zapp-pipes-dev-kit 共发布 39 个版本,首次发布于 2017/04/05;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.4.7latest2024/05/152 年前
1.4.62024/05/152 年前
1.4.52023/09/293 年前
1.4.42023/09/293 年前
1.4.32023/09/293 年前
1.4.22021/09/255 年前

其他发布通道:next → 1.4.0-rc.2。

关于 @applicaster/zapp-pipes-dev-kit 的常见问题

@applicaster/zapp-pipes-dev-kit 是什么?

应用软件Zapp-Pipes数据源插件的开发套件

如何安装 @applicaster/zapp-pipes-dev-kit?

在项目目录运行 npm install @applicaster/zapp-pipes-dev-kit,或使用 pnpm add / yarn add / bun add。

@applicaster/zapp-pipes-dev-kit 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/applicaster__zapp-pipes-dev-kit 是否存在。

@applicaster/zapp-pipes-dev-kit 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@applicaster/zapp-pipes-dev-kit 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=8。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@applicaster/zapp-pipes-dev-kit 可以商用吗?

@applicaster/zapp-pipes-dev-kit 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@applicaster/zapp-pipes-dev-kit 的下载量有多少?

根据 npm 官方下载统计,@applicaster/zapp-pipes-dev-kit 在 2026/10/07 – 2026/11/05 这 30 天内被下载 1,953 次,日均约 65 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@applicaster/zapp-pipes-dev-kit 还在维护吗?

最新版本 1.4.7 发布于 2024/05/15(2 年前);至今共发布 39 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/04/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。