Skip to content

feat(device): publish a NativeScript build as @ably/pubsub-device/nativescript - #2342

Merged
ttypic merged 1 commit into
mainfrom
feat/native-script-build
Nov 10, 2026
Merged

ttypic merged 1 commit into
mainfrom
feat/native-script-build

Conversation

@ttypic

@ttypic ttypic commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Since the package split, the NativeScript bundle has still been built but in private build folder. No published package carries it, so NativeScript apps have no way to install the SDK. Up to ably 2.30.0 the file shipped in the tarball under build/**.

This PR publishes a NativeScript build from @ably/pubsub-device, under a documented subpath:

import { createClient } from '@ably/pubsub-device/nativescript';

const client = createClient({ authUrl: 'https://your-server.example.com/ably-token', clientId: 'me' });

Why a subpath and not an export condition

With a subpath, the app opts in through its import path, so the package doesn't depend on which conditions NativeScript's bundler sets. ./nativescript resolves to the bundle under every condition:

"./nativescript": {
  "types": "./nativescript/index.d.ts",
  "default": "./dist/nativescript.js"
}

How it's built

  • webpack.config.js replaces the old standalone ably-nativescript.js UMD config with createNativeScriptConfig(), modelled on the React Native bundle. It bundles packages/device/src/index.ts into packages/device/dist/nativescript.js as CommonJS, and build:packages runs it via a new webpack:nativeScript task.
  • To select the NativeScript platform code, the private @ably/pubsub-core-impl/platform gains a nativescript condition. It is only read at bundle time, so no published package exposes it.
  • nativescript-websockets and @nativescript/core/application-settings stay external.

Summary by CodeRabbit

  • New Features

    • Added a NativeScript entry point for the device package, with its own bundle and TypeScript declarations.
    • NativeScript apps can import the package through its dedicated subpath, with full logging and MessagePack support.
  • Documentation

    • Added NativeScript setup guidance, dependency and installation details, and a client creation example.
    • Updated package documentation to list the NativeScript bundle and clarify its sourcemap behavior.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The NativeScript device bundle now uses a dedicated webpack target and is published through the @ably/pubsub-device/nativescript export. The build task creates the bundle, and release checks require it.

Changes

NativeScript device bundle

Layer / File(s) Summary
NativeScript platform and bundle configuration
packages/core-impl/package.json, packages/core-impl/side/core-clients.ts, webpack.config.js, packages/core-impl/test/support/browser_file_list.js
The platform package adds the nativescript condition. Webpack builds the device entry as packages/device/dist/nativescript.js, and the browser test file list drops the previous NativeScript bundle.
Build and package delivery
Gruntfile.js, packages/device/package.json, packages/device/nativescript/*, scripts/release.js, packages/device/README.md, packages/README.md
The package build runs the NativeScript webpack target. Package metadata and declarations expose the NativeScript entry point. The documentation describes the bundle, and release checks require the generated artifact.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Grunt
  participant Webpack
  participant DevicePackage
  participant ReleaseCheck
  Grunt->>Webpack: Run webpack:nativeScript
  Webpack->>DevicePackage: Write dist/nativescript.js
  DevicePackage->>DevicePackage: Resolve the ./nativescript export
  ReleaseCheck->>DevicePackage: Require dist/nativescript.js
Loading

Possibly related PRs

  • ably/ably-pubsub-js#2335: Documents published package artifacts in packages/README.md, which this change also updates.

Suggested reviewers: vesker

Merge Risk: Minimal · up to 762a6

The NativeScript bundle is configured for the documented package subpath, with a matching build task and release check. No actionable merge risk is established.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: publishing a NativeScript build at the @ably/pubsub-device/nativescript subpath.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 5 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the bundle path,
Then watches webpack hop along.
The NativeScript entry joins the pack,
With logs and MessagePack in tow.
The release check finds its file,
And paws applaud the build.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7fdd559f-bf5c-4903-9565-e2338bef54bf
Commits

Reviewing files that changed from the base of the PR and between 39bedcb and 762a687.

Files selected for processing: 3

  • packages/README.md
  • packages/device/nativescript/index.d.ts
  • webpack.config.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

…ivescript

Since the package split, the NativeScript bundle was still built, but only into the private
packages/core-impl/build/, so no published package carried it. Build it from the device
package's entry point into packages/device/dist/nativescript.js instead, and publish it behind
the documented `./nativescript` subpath rather than an export condition.

The bundle reaches the NativeScript implementation through a new `nativescript` condition on
the private `@ably/pubsub-core-impl/platform`, read only when bundling. It keeps every log, as
there is no debug counterpart, and includes MessagePack, as the NativeScript bundle always has,
rather than leaving it to the `MsgPack` plugin. `nativescript-websockets` and
`@nativescript/core` stay external, provided by the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ttypic
ttypic merged commit a9dd8af into main Nov 10, 2026
20 of 22 checks passed
@ttypic
ttypic deleted the feat/native-script-build branch November 10, 2026 13:29
@ttypic ttypic mentioned this pull request Nov 11, 2026

This branch was successfully deployed

3 active deployments
staging/pull/2342/typedoc — 762a6874 Deployed Nov 10, 2026 by github-actions[bot]
staging/pull/2342/bundle-report — 762a6874 Deployed Nov 10, 2026 by github-actions[bot]
staging/pull/2342/features — 762a6874 Deployed Nov 10, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants