@betterportal/hello-view

中文文档
11.0.9发布于 2026/11/07(AGPL-3.0-only OR Commercial)TypeScriptES Module构建来源已验证近 30 天下载 1840

BetterPortal v10 example service plugin for Node.js

原始使用文档

BetterPortal Hello View Example for Node.js

Reference business plugin for BetterPortal v10.

This package demonstrates:

  • a single canonical view endpoint
  • application/json and text/html negotiation
  • metadata representation
  • schema-first validation
  • support for the bootstrap1 and embedded themes

The API examples return domain data and stream items. They do not generate internal URL fields for the view. Renderers receive ViewRenderContext as their second argument and resolve navigation, actions and pagination locally with ctx.route(input?); see the hello showcase renderer for cursor-based fragment pagination. Select uiPath for page navigation, absoluteViewPath for HTML/HTMX requests and absoluteApiPath for JSON actions. Specify the action method; omit the target to resolve self. See the routing contract and paired API/view example.

For collections, return domain items, IDs and cursors from the API, then resolve links in the renderer. ctx.route() preserves repeated query values such as ?tag=a&tag=b; a scalar override replaces the complete key and null removes it. Embedded values such as /items?q=what?x&next=/a?b retain their complete content before encoding and overrides.

Select renderers with the explicit component or fragment option. Reserved _c/_f query keys in input paths or the current request are removed; only view destinations receive an explicit selector. Service base metadata preserves non-root prefixes and omits a root trailing slash.

The fatal prebuild check includes NodeNext .mts/.cts files and covers configured route/shell folders outside src plus source helpers under src/lib and src/dist, and follows statically traceable response helpers and object methods, aliases, array bindings/destructuring assignments with statically named computed keys, callbacks, promise constructors/combinators and string/collection transformations, including property descriptor factories/mutations and returned array mutations, reversible URI encoding, element selection, removed splice values and replacement values on dynamically initialized strings. Avoid returning internal destinations through these returned or yielded response paths. Public links, scalar counts/characters and domain-client results remain valid. Import BP handler factories from @betterportal/framework or the generated .bp-generated/route-runtime.js; unrelated provider helpers retain their own semantics.

sse: true requires a known registered GET subscriber feed or finite-stream endpoint on the current service. Unsupported ordinary routes, non-GET methods and dependency mounts with unknown streaming capability return null.

Dependency mounts require a resolved service path to identify an endpoint; missing service paths return null.

Selecting a domain field from a known object remains valid even when another field holds an internal destination. The authoring check follows the selected field through aliases.

BP ctx.response() bodies participate in the same checks as Response and JSON response helpers; public links and domain data remain valid.

The authoring gate follows explicitly rejected promise reasons into recovery callbacks and local response factories invoked through call, apply and bind. Recovery that returns domain data and factories that consume destinations without returning them remain valid. This source check covers recognized static patterns; it is not a proof of arbitrary JavaScript data flow.

Bound callback arguments precede caller-supplied promise/collection inputs during source checks. Explicit rejection reasons also follow local recovery parameters, preserving safe recovery without overlooking returned destinations.

Statically known spread arguments are expanded before call/apply/bind parameter mapping, including bound callbacks stored in known object fields.

Rejection provenance passes through then calls without rejection handlers and through finally, stopping when a rejection handler recovers.

Rest parameters retain the remaining argument array. Explicit rethrows and rejections retain their reason until recovery; native promise operations ignore extra callback arguments.

版本与发布记录

@betterportal/hello-view 共发布 152 个版本,首次发布于 2026/06/23;过去 12 个月发布了 152 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
11.0.9latest2026/11/071 天前
11.0.82026/11/071 天前
11.0.72026/11/071 天前
11.0.62026/11/062 天前
11.0.52026/11/053 天前
11.0.42026/11/053 天前

关于 @betterportal/hello-view 的常见问题

@betterportal/hello-view 是什么?

BetterPortal v10 example service plugin for Node.js

如何安装 @betterportal/hello-view?

在项目目录运行 npm install @betterportal/hello-view,或使用 pnpm add / yarn add / bun add。

@betterportal/hello-view 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@betterportal/hello-view 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@betterportal/hello-view 可以商用吗?

@betterportal/hello-view 使用 (AGPL-3.0-only OR Commercial) 许可。可在 AGPL-3.0、Commercial 中任选其一遵守。以上为概括,不构成法律意见,请以许可原文为准。

@betterportal/hello-view 的下载量有多少?

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

@betterportal/hello-view 还在维护吗?

最新版本 11.0.9 发布于 2026/11/07(1 天前);至今共发布 152 个版本,其中过去 12 个月发布了 152 个;首次发布于 2026/06/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。