diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1782217..1003f18 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -10,7 +10,7 @@ Record commands, results and relevant native evidence. For a new or expanded compatibility implementation, name the complete module/API unit and pinned Workers baseline. Keep the PR in draft until the -[acceptance gate](https://github.com/rdlabo-dev/cf-workers-mobile/blob/main/CONTRIBUTING.md#acceptance-gate) is met. +[acceptance gate](https://github.com/rdlabo-dev/cf-workers-native/blob/main/CONTRIBUTING.md#acceptance-gate) is met. For documentation-only or unrelated changes, mark this section not applicable. - [ ] Export/API inventory has no unresolved coverage decisions. diff --git a/.github/scripts/npm-release.mjs b/.github/scripts/npm-release.mjs index 78e60a3..b02af36 100644 --- a/.github/scripts/npm-release.mjs +++ b/.github/scripts/npm-release.mjs @@ -97,7 +97,7 @@ export async function resolveRelease(github, context) { ref: sha, }); const pkg = JSON.parse(Buffer.from(file.content, "base64").toString("utf8")); - if (pkg.name !== "cf-workers-mobile") + if (pkg.name !== "cf-workers-native") throw new Error("Unexpected package name"); return { sha, ...releaseVersion(pkg.version, tag, pr, sha) }; } @@ -177,7 +177,7 @@ async function resolveCommentBeta(github, context) { ref: "main", }); const pkg = JSON.parse(Buffer.from(file.content, "base64").toString("utf8")); - if (pkg.name !== "cf-workers-mobile") + if (pkg.name !== "cf-workers-native") throw new Error("Unexpected trusted package name"); return { sha, diff --git a/.github/scripts/npm-release.test.mjs b/.github/scripts/npm-release.test.mjs index 5e8f2ff..c6346cc 100644 --- a/.github/scripts/npm-release.test.mjs +++ b/.github/scripts/npm-release.test.mjs @@ -20,17 +20,17 @@ function fixture() { }, ], runs: [{ run_number: 2, status: "completed", conclusion: "success" }], - pkg: { name: "cf-workers-mobile", version: "0.1.1" }, + pkg: { name: "cf-workers-native", version: "0.1.1" }, }; const context = { - repo: { owner: "rdlabo-dev", repo: "cf-workers-mobile" }, + repo: { owner: "rdlabo-dev", repo: "cf-workers-native" }, eventName: "workflow_run", payload: { workflow_run: { event: "push", head_branch: "main", head_sha: sha, - head_repository: { full_name: "rdlabo-dev/cf-workers-mobile" }, + head_repository: { full_name: "rdlabo-dev/cf-workers-native" }, path: ".github/workflows/ci.yml", conclusion: "success", }, diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml new file mode 100644 index 0000000..0b2a240 --- /dev/null +++ b/.github/workflows/android-release.yml @@ -0,0 +1,96 @@ +name: Android release + +on: + workflow_dispatch: + inputs: + version: + description: "Publish this package.json version to Maven Central (immutable)" + required: true + type: string + +permissions: + contents: read + +concurrency: + group: android-release + cancel-in-progress: false + +jobs: + release: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-24.04 + timeout-minutes: 40 + environment: maven-central + permissions: + contents: read + actions: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + with: + persist-credentials: false + - name: Require the tested main commit and explicit version + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd + env: + RELEASE_VERSION: ${{ inputs.version }} + with: + script: | + const { readFileSync } = await import('node:fs'); + const pkg = JSON.parse(readFileSync('package.json', 'utf8')); + const { releaseVersion } = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/npm-release.mjs`); + releaseVersion(pkg.version, `v${process.env.RELEASE_VERSION}`); + const { data: main } = await github.rest.repos.getBranch({...context.repo, branch: 'main'}); + if (main.commit.sha !== context.sha) throw new Error('Run from the current main commit'); + const runs = await github.paginate(github.rest.actions.listWorkflowRuns, { + ...context.repo, workflow_id: 'ci.yml', head_sha: context.sha, + event: 'push', branch: 'main', per_page: 100, + }); + const latest = runs.sort((a, b) => b.run_number - a.run_number)[0]; + if (!latest || latest.status !== 'completed' || latest.conclusion !== 'success') { + throw new Error('This exact main commit must pass Compatibility first'); + } + - name: Refuse an existing coordinate + env: + RELEASE_VERSION: ${{ inputs.version }} + run: | + code=$(curl --silent --show-error --output /dev/null --write-out '%{http_code}' "https://repo.maven.apache.org/maven2/io/github/rdlabo/cf-workers-native-android/$RELEASE_VERSION/cf-workers-native-android-$RELEASE_VERSION.pom") + test "$code" = 404 || { echo "Central returned HTTP $code; refusing publication"; exit 1; } + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad + with: + distribution: temurin + java-version: "21" + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 + with: + node-version: 22 + - run: node --test scripts/android-release/publish.test.mjs + - name: Build the signed bundle + env: + MAVEN_SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }} + MAVEN_SIGNING_PASSWORD: ${{ secrets.MAVEN_SIGNING_PASSWORD }} + run: demo/android/gradlew -p scripts/android-release --no-daemon -PsignRelease centralBundle --console=plain + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 + with: + name: android-central-bundle + path: scripts/android-release/build/distributions/*.zip + if-no-files-found: error + - name: Verify the staged Maven consumer before publication + run: demo/android/gradlew -p demo/tests/native-embedding/android -PsdkRepository="$GITHUB_WORKSPACE/scripts/android-release/build/repository" :app:assembleDebug --console=plain + - name: Upload, validate and publish + env: + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} + run: node scripts/android-release/publish.mjs + - name: Wait for Maven Central distribution + env: + RELEASE_VERSION: ${{ inputs.version }} + run: | + for attempt in $(seq 1 40); do + echo "Checking Maven distribution ($attempt/40)" + code=$(curl --silent --show-error --output /dev/null --write-out '%{http_code}' "https://repo.maven.apache.org/maven2/io/github/rdlabo/cf-workers-native-android/$RELEASE_VERSION/cf-workers-native-android-$RELEASE_VERSION.pom") + if [ "$code" = 200 ]; then exit 0; fi + if [ "$code" != 404 ]; then echo "Central returned HTTP $code"; exit 1; fi + sleep 15 + done + echo 'Publication completed but distribution is still pending; do not re-upload.' + exit 1 + - name: Verify Maven Central consumer + run: demo/android/gradlew -p demo/tests/native-embedding/android -PcentralOnly --refresh-dependencies :app:assembleDebug --console=plain diff --git a/.github/workflows/native-embedding.yml b/.github/workflows/native-embedding.yml index 984ddb8..94f41eb 100644 --- a/.github/workflows/native-embedding.yml +++ b/.github/workflows/native-embedding.yml @@ -6,6 +6,7 @@ on: - ".github/workflows/native-embedding.yml" - "native/**" - "scripts/android-release/**" + - ".github/workflows/android-release.yml" - "Package.swift" - "package.json" - "src/**" @@ -70,6 +71,7 @@ jobs: - run: npm run build - name: Verify standalone Maven publication and consumer run: | + node --test scripts/android-release/publish.test.mjs python3 scripts/android-release/verify.py demo/android/gradlew -p demo/tests/native-embedding/android -PsdkRepository="$GITHUB_WORKSPACE/scripts/android-release/build/repository" :app:assembleDebug --console=plain - name: Enable emulator acceleration diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 958a7ac..90b2ffa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,7 +118,7 @@ jobs: import assert from 'node:assert/strict'; const plan = JSON.parse(process.env.PLAN); const pkg = JSON.parse(readFileSync(`${process.env.RUNNER_TEMP}/release-package.json`, 'utf8')); - assert.equal(pkg.name, 'cf-workers-mobile'); + assert.equal(pkg.name, 'cf-workers-native'); assert.equal(pkg.version, plan.version); assert.equal(pkg.publishConfig.tag, plan.channel); assert.equal(pkg.publishConfig.access, 'public'); diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e73780a..8ebfd9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,7 +81,7 @@ This exception applies only to existing implementations in 0.1.0 Preview. It doe ### 0.1.2 Preview follow-up -`cf-workers-mobile@0.1.2` Preview is explicitly authorized with the current limitations documented in the [compatibility inventory](docs/compatibility.md). This version-specific exception retains existing incomplete compatibility implementations; it does not certify complete Workers or Node.js compatibility, authorize new incomplete units, bypass required regression checks or CI, or extend to later releases. Keep unsupported behavior and verification boundaries visible. +`cf-workers-native@0.1.2` Preview is explicitly authorized with the current limitations documented in the [compatibility inventory](docs/compatibility.md). This version-specific exception retains existing incomplete compatibility implementations; it does not certify complete Workers or Node.js compatibility, authorize new incomplete units, bypass required regression checks or CI, or extend to later releases. Keep unsupported behavior and verification boundaries visible. ## Layout and tests @@ -156,7 +156,7 @@ Direct pushes and PR branches do not automatically publish beta packages. A newe For a tagged release, update `package.json` to the intended version in a PR, merge it and wait for Compatibility on main to validate reuse or finish the necessary full run. Then tag that commit and push the tag, for example `git tag v0.1.2` followed by `git push origin v0.1.2`. The tag must match the package version and refer to a commit on main with successful CI. Already published versions cannot be republished; create a new version when changing package contents. -The [release workflow](.github/workflows/release.yml) builds without npm publishing credentials, then publishes the resulting tarball in a separate job with lifecycle scripts disabled. It uses [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/) rather than an npm token. Configure the npm package's Trusted Publisher once with GitHub owner `rdlabo-dev`, repository `cf-workers-mobile`, workflow filename `release.yml`, no environment name, and permission to publish directly. No `NPM_TOKEN` secret is required. +The [release workflow](.github/workflows/release.yml) builds without npm publishing credentials, then publishes the resulting tarball in a separate job with lifecycle scripts disabled. It uses [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/) rather than an npm token. Configure the npm package's Trusted Publisher once with GitHub owner `rdlabo-dev`, repository `cf-workers-native`, workflow filename `release.yml`, no environment name, and permission to publish directly. No `NPM_TOKEN` secret is required. ### PR beta requests @@ -186,7 +186,7 @@ branch/commit and tarball SHA-256. Preparation does not publish or use npm crede The command prints the exact `npm publish --ignore-scripts --access public --tag beta --registry https://registry.npmjs.org` invocation. After reviewing the artifact, use your local npm account (`npm login` if needed) with permission to -publish `cf-workers-mobile`, and run that printed command. Append `--dry-run` to +publish `cf-workers-native`, and run that printed command. Append `--dry-run` to inspect it without publishing. Complete npm's authentication/2FA prompts when requested; keep credentials outside the repository. Local publication does not use the workflow's OIDC identity or its `--provenance` option. diff --git a/Package.swift b/Package.swift index 7300317..d94406c 100644 --- a/Package.swift +++ b/Package.swift @@ -2,10 +2,10 @@ import PackageDescription let package = Package( - name: "CfWorkersMobile", + name: "CfWorkersNative", platforms: [.iOS(.v15)], products: [ - .library(name: "CfWorkersMobile", targets: ["WorkersCapacitor"]), + .library(name: "CfWorkersNative", targets: ["WorkersCapacitor"]), .library(name: "WorkersIOS", targets: ["WorkersIOS"]) ], dependencies: [ diff --git a/README.md b/README.md index bf8344a..d571e90 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# cf-workers-mobile +# cf-workers-native **Bring the app you built with Workers or Void to iOS and Android.** @@ -13,7 +13,7 @@ Reach people who prefer the browser and people who look for apps in the store. O - **Create a new mobile app** Use Capacitor to build an iOS and Android app for distribution through the App Store and Google Play. [Capacitor guide](docs/integration.md). -[Documentation](docs/README.md) · [Examples](demo/README.md) · [0.1.2 Preview release](https://github.com/rdlabo-dev/cf-workers-mobile/releases/tag/v0.1.2) +[Documentation](docs/README.md) · [Examples](demo/README.md) ## Keep building the app you know @@ -39,14 +39,18 @@ Each guide describes its tested versions and boundaries. Already have a separate Install the shared JavaScript package in your web project: +The renamed package is being prepared for publication. Until it is available on +npm, use the [source tarball instructions](docs/native-embedding.md#dependency-setup). +After publication: + ```sh -npm install cf-workers-mobile@0.1.2 +npm install cf-workers-native@0.1.2 ``` The mobile entry selects the host. For example, an iOS web entry starts with: ```ts -import { workersIOS } from "cf-workers-mobile/ios"; +import { workersIOS } from "cf-workers-native/ios"; const app = workersIOS({ baseURL: "https://your-worker.example.com/", @@ -55,7 +59,7 @@ const app = workersIOS({ await app.ready; ``` -Use `workersAndroid` from `cf-workers-mobile/android` or `workersCapacitor` from `cf-workers-mobile/capacitor` for the other hosts. All three share the same runtime options and [Vite/esbuild tooling](docs/build-setup.md). +Use `workersAndroid` from `cf-workers-native/android` or `workersCapacitor` from `cf-workers-native/capacitor` for the other hosts. All three share the same runtime options and [Vite/esbuild tooling](docs/build-setup.md). This entry is one part of the setup: connect the existing Worker to a **separate mobile build**, then package its output with your chosen native host. The [embedding guide](docs/native-embedding.md) and [Capacitor guide](docs/integration.md) cover the complete path. For an existing native app, build the web assets in the web project or CI; the native project does not need Capacitor CLI commands or configuration. @@ -66,9 +70,9 @@ This entry is one part of the setup: connect the existing Worker to a **separate Open your application repository and give your assistant this prompt, replacing the target with **iOS**, **Android** or **Capacitor**: ```text -Read https://github.com/rdlabo-dev/cf-workers-mobile/blob/v0.1.2/README.md +Read https://github.com/rdlabo-dev/cf-workers-native/blob/main/README.md and the integration guide for our target: . -Bring this Workers application to that target using cf-workers-mobile@0.1.2. +Bring this Workers application to that target using cf-workers-native@0.1.2. Preserve its pages, routes, authentication and Cloudflare deployment configuration. For an existing native app, preserve its entry point and navigation. Verify the actual user flows on the target platform and report remaining limits. diff --git a/demo/README.md b/demo/README.md index d4a6a6f..bc04129 100644 --- a/demo/README.md +++ b/demo/README.md @@ -1,4 +1,4 @@ -# cf-workers-mobile examples +# cf-workers-native examples Choose the example closest to the experience you want to build: @@ -42,7 +42,7 @@ The path is relative to the configured Vite root, `src/`. The example uses [the [src/main.ts](src/main.ts) initializes the runtime and displays the HTML returned by `/`: ```ts -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://worker.invalid/", diff --git a/demo/android/app/capacitor.build.gradle b/demo/android/app/capacitor.build.gradle index c3e0ebf..7d18ce1 100644 --- a/demo/android/app/capacitor.build.gradle +++ b/demo/android/app/capacitor.build.gradle @@ -9,7 +9,7 @@ android { apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { - implementation project(':cf-workers-mobile') + implementation project(':cf-workers-native') } diff --git a/demo/android/capacitor.settings.gradle b/demo/android/capacitor.settings.gradle index c465112..1ae10ea 100644 --- a/demo/android/capacitor.settings.gradle +++ b/demo/android/capacitor.settings.gradle @@ -2,5 +2,5 @@ include ':capacitor-android' project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') -include ':cf-workers-mobile' -project(':cf-workers-mobile').projectDir = new File('../node_modules/cf-workers-mobile/native/android') +include ':cf-workers-native' +project(':cf-workers-native').projectDir = new File('../node_modules/cf-workers-native/native/android') diff --git a/demo/authentication/README.md b/demo/authentication/README.md index b728142..e69a2ca 100644 --- a/demo/authentication/README.md +++ b/demo/authentication/README.md @@ -3,7 +3,7 @@ Use your identity provider's native SDK when one is already installed. The small `login.ts` example demonstrates a public OAuth client using Capacitor App/Browser, authorization code + S256 PKCE, exact callback matching and state validation. It connects to an existing provider; it does not implement an identity provider or change the Worker's authentication middleware. ```ts -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import { login } from "./login"; import { Capacitor, CapacitorHttp } from "@capacitor/core"; diff --git a/demo/authentication/package.json b/demo/authentication/package.json index 279573e..9730c3c 100644 --- a/demo/authentication/package.json +++ b/demo/authentication/package.json @@ -6,7 +6,7 @@ "@capacitor/core": "8.5.3", "@capacitor/app": "8.1.2", "@capacitor/browser": "8.0.5", - "cf-workers-mobile": "file:../.." + "cf-workers-native": "file:../.." }, "devDependencies": { "@capacitor/cli": "8.5.3", diff --git a/demo/ios/App/CapApp-SPM/Package.swift b/demo/ios/App/CapApp-SPM/Package.swift index 487d452..96f6154 100644 --- a/demo/ios/App/CapApp-SPM/Package.swift +++ b/demo/ios/App/CapApp-SPM/Package.swift @@ -12,7 +12,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "8.5.3"), - .package(name: "CfWorkersMobile", path: "../../../node_modules/cf-workers-mobile") + .package(name: "CfWorkersNative", path: "../../../node_modules/cf-workers-native") ], targets: [ .target( @@ -20,7 +20,7 @@ let package = Package( dependencies: [ .product(name: "Capacitor", package: "capacitor-swift-pm"), .product(name: "Cordova", package: "capacitor-swift-pm"), - .product(name: "CfWorkersMobile", package: "CfWorkersMobile") + .product(name: "CfWorkersNative", package: "CfWorkersNative") ] ) ] diff --git a/demo/opennext/capacitor/main.ts b/demo/opennext/capacitor/main.ts index 8eed92b..54d1462 100644 --- a/demo/opennext/capacitor/main.ts +++ b/demo/opennext/capacitor/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const origin = import.meta.env.VITE_WORKER_ORIGIN; if (!origin) throw new Error( diff --git a/demo/opennext/capacitor/vite.config.ts b/demo/opennext/capacitor/vite.config.ts index 20ecae1..a33b537 100644 --- a/demo/opennext/capacitor/vite.config.ts +++ b/demo/opennext/capacitor/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import { fileURLToPath } from "node:url"; const here = (path: string) => fileURLToPath(new URL(path, import.meta.url)); export default defineConfig({ diff --git a/demo/opennext/package.json b/demo/opennext/package.json index b421f47..e70b699 100644 --- a/demo/opennext/package.json +++ b/demo/opennext/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@capacitor/core": "8.5.3", - "cf-workers-mobile": "file:../..", + "cf-workers-native": "file:../..", "next": "16.4.2", "react": "19.3.1", "react-dom": "19.3.1" diff --git a/demo/package.json b/demo/package.json index 01c775f..379f353 100644 --- a/demo/package.json +++ b/demo/package.json @@ -51,7 +51,7 @@ }, "dependencies": { "@capacitor/core": "^8.5.3", - "cf-workers-mobile": "file:..", + "cf-workers-native": "file:..", "express": "^5.3.0", "hono": "^4.13.13" }, diff --git a/demo/rendering/main.ts b/demo/rendering/main.ts index 4dbd0f5..acbfc2f 100644 --- a/demo/rendering/main.ts +++ b/demo/rendering/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; // The configured Worker supplies the complete HTML document and owns routing. const app = workersCapacitor({ baseURL: "https://worker.invalid", diff --git a/demo/rendering/vite.config.ts b/demo/rendering/vite.config.ts index c0cfa51..c370a65 100644 --- a/demo/rendering/vite.config.ts +++ b/demo/rendering/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig({ root: fileURLToPath(new URL(".", import.meta.url)), plugins: [ diff --git a/demo/src/main.ts b/demo/src/main.ts index 7dd5ed8..f5c9fab 100644 --- a/demo/src/main.ts +++ b/demo/src/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; // The Worker entry is configured in vite.config.ts. const runtime = workersCapacitor({ diff --git a/demo/tests/authentication/native.test.mjs b/demo/tests/authentication/native.test.mjs index ac9bb77..87d88a9 100644 --- a/demo/tests/authentication/native.test.mjs +++ b/demo/tests/authentication/native.test.mjs @@ -33,7 +33,7 @@ test( worker: join(here, "worker.ts"), workerConfig: join(here, "wrangler.jsonc"), bootstrapCode: ` -import { workersCapacitor } from 'cf-workers-mobile/capacitor'; +import { workersCapacitor } from 'cf-workers-native/capacitor'; import { Capacitor, CapacitorHttp } from ${JSON.stringify(join(shell, "node_modules/@capacitor/core/dist/index.js"))}; import { login } from ${JSON.stringify(join(shell, "login.ts"))}; try { diff --git a/demo/tests/build/documents.test.ts b/demo/tests/build/documents.test.ts index d5bc8a7..0216a5a 100644 --- a/demo/tests/build/documents.test.ts +++ b/demo/tests/build/documents.test.ts @@ -1,8 +1,8 @@ import { afterAll, expect, it } from "vitest"; import { build as viteBuild } from "vite"; import { build as esbuildBuild } from "esbuild"; -import { workersCapacitorPlugin as vitePlugin } from "cf-workers-mobile/tooling/vite"; -import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-mobile/tooling/esbuild"; +import { workersCapacitorPlugin as vitePlugin } from "cf-workers-native/tooling/vite"; +import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-native/tooling/esbuild"; import { cp, mkdtemp, readFile, rm, readdir } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; diff --git a/demo/tests/build/esbuild.test.ts b/demo/tests/build/esbuild.test.ts index b545de5..ef48f43 100644 --- a/demo/tests/build/esbuild.test.ts +++ b/demo/tests/build/esbuild.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import { fileURLToPath } from "node:url"; import { context, type BuildResult } from "esbuild"; import { expect, it } from "vitest"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/esbuild"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/esbuild"; it("watches Worker dependencies and emits a new asset without writing output", async () => { const dir = await mkdtemp(resolve(tmpdir(), "workers-capacitor-watch-")); @@ -16,7 +16,7 @@ it("watches Worker dependencies and emits a new asset without writing output", a ); await writeFile( resolve(dir, "main.js"), - `import {workersCapacitor} from ${JSON.stringify(fileURLToPath(import.meta.resolve("cf-workers-mobile/capacitor")))}; globalThis.runtime = workersCapacitor({baseURL:"https://worker.invalid/api"});`, + `import {workersCapacitor} from ${JSON.stringify(fileURLToPath(import.meta.resolve("cf-workers-native/capacitor")))}; globalThis.runtime = workersCapacitor({baseURL:"https://worker.invalid/api"});`, ); const build = await context({ absWorkingDir: dir, diff --git a/demo/tests/build/execution.test.ts b/demo/tests/build/execution.test.ts index 2f8e160..ffcea9b 100644 --- a/demo/tests/build/execution.test.ts +++ b/demo/tests/build/execution.test.ts @@ -5,8 +5,8 @@ import { tmpdir } from "node:os"; import { fileURLToPath } from "node:url"; import { build as esbuild } from "esbuild"; import { build as vite } from "vite"; -import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-mobile/tooling/esbuild"; -import { workersCapacitorPlugin as vitePlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-native/tooling/esbuild"; +import { workersCapacitorPlugin as vitePlugin } from "cf-workers-native/tooling/vite"; for (const tool of ["vite", "esbuild"] as const) for (const execution of ["local", "network"] as const) @@ -30,7 +30,7 @@ for (const tool of ["vite", "esbuild"] as const) const entry = resolve(root, "main.js"); await writeFile( entry, - `import {workersCapacitor} from ${JSON.stringify(fileURLToPath(import.meta.resolve("cf-workers-mobile/capacitor")))}; globalThis.runtime = workersCapacitor({baseURL:'https://local.invalid/'});`, + `import {workersCapacitor} from ${JSON.stringify(fileURLToPath(import.meta.resolve("cf-workers-native/capacitor")))}; globalThis.runtime = workersCapacitor({baseURL:'https://local.invalid/'});`, ); const options = { worker: resolve(generated, "worker.js"), diff --git a/demo/tests/build/isolation.test.ts b/demo/tests/build/isolation.test.ts index 10fe703..cb278d7 100644 --- a/demo/tests/build/isolation.test.ts +++ b/demo/tests/build/isolation.test.ts @@ -13,8 +13,8 @@ import { tmpdir } from "node:os"; import { fileURLToPath } from "node:url"; import { build as esbuild } from "esbuild"; import { build as vite, createServer } from "vite"; -import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-mobile/tooling/esbuild"; -import { workersCapacitorPlugin as vitePlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-native/tooling/esbuild"; +import { workersCapacitorPlugin as vitePlugin } from "cf-workers-native/tooling/vite"; async function fixture() { const root = await mkdtemp(resolve(tmpdir(), "cloudflare-isolation-")); @@ -35,7 +35,7 @@ async function fixture() { ); await writeFile( resolve(root, "main.js"), - `import {workersCapacitor} from ${JSON.stringify(fileURLToPath(import.meta.resolve("cf-workers-mobile/capacitor")))};globalThis.runtime=workersCapacitor({baseURL:'https://worker.example'});`, + `import {workersCapacitor} from ${JSON.stringify(fileURLToPath(import.meta.resolve("cf-workers-native/capacitor")))};globalThis.runtime=workersCapacitor({baseURL:'https://worker.example'});`, ); await writeFile( resolve(root, "cloudflare/keep.txt"), diff --git a/demo/tests/build/server-only.test.ts b/demo/tests/build/server-only.test.ts index acd302f..269a54d 100644 --- a/demo/tests/build/server-only.test.ts +++ b/demo/tests/build/server-only.test.ts @@ -12,12 +12,12 @@ import { tmpdir } from "node:os"; import { fileURLToPath } from "node:url"; import { build as esbuild } from "esbuild"; import { build as vite } from "vite"; -import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-mobile/tooling/esbuild"; -import { workersCapacitorPlugin as vitePlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-native/tooling/esbuild"; +import { workersCapacitorPlugin as vitePlugin } from "cf-workers-native/tooling/vite"; const secret = "PRIVATE_DECLARED_FILE_ef271a"; const library = fileURLToPath( - import.meta.resolve("cf-workers-mobile/capacitor"), + import.meta.resolve("cf-workers-native/capacitor"), ); for (const tool of ["vite", "esbuild"] as const) { it(`${tool}: declared files stay remote and every supported distribution path rejects them`, async () => { diff --git a/demo/tests/experiments/cloudflare/native-main.js b/demo/tests/experiments/cloudflare/native-main.js index bf13a32..751fde4 100644 --- a/demo/tests/experiments/cloudflare/native-main.js +++ b/demo/tests/experiments/cloudflare/native-main.js @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import { Capacitor } from "@capacitor/core"; import settings from "./server.json"; const platform = Capacitor.getPlatform(); diff --git a/demo/tests/experiments/d1/native-main.js b/demo/tests/experiments/d1/native-main.js index 3611f88..d392220 100644 --- a/demo/tests/experiments/d1/native-main.js +++ b/demo/tests/experiments/d1/native-main.js @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import { Capacitor } from "@capacitor/core"; import settings from "./server.json"; const platform = Capacitor.getPlatform(); diff --git a/demo/tests/experiments/d1/native-prepare.mjs b/demo/tests/experiments/d1/native-prepare.mjs index eb77d35..c3baf13 100644 --- a/demo/tests/experiments/d1/native-prepare.mjs +++ b/demo/tests/experiments/d1/native-prepare.mjs @@ -53,7 +53,7 @@ await writeFile( type: "module", scripts: { build: "vite build" }, dependencies: { - "cf-workers-mobile": `file:./${packed.filename}`, + "cf-workers-native": `file:./${packed.filename}`, "@capacitor/core": "8.5.3", "@capacitor/android": "8.5.3", "@capacitor/ios": "8.5.3", @@ -116,7 +116,7 @@ await writeFile( ); await writeFile( join(consumer, "vite.config.js"), - `import {workersCapacitorPlugin} from "cf-workers-mobile/tooling/vite";export default {plugins:[workersCapacitorPlugin(${JSON.stringify({ worker: "worker.js", execution: [{ method: "*", path: "*" }], ...(cloudflare ? { assetsExecution: "remote" } : {}), ...(services ? { kvExecution: { CLOUD_KV: "local", SHARED_KV: "remote" } } : {}) })})],build:{target:"es2022",sourcemap:true}};`, + `import {workersCapacitorPlugin} from "cf-workers-native/tooling/vite";export default {plugins:[workersCapacitorPlugin(${JSON.stringify({ worker: "worker.js", execution: [{ method: "*", path: "*" }], ...(cloudflare ? { assetsExecution: "remote" } : {}), ...(services ? { kvExecution: { CLOUD_KV: "local", SHARED_KV: "remote" } } : {}) })})],build:{target:"es2022",sourcemap:true}};`, ); await writeFile( join(consumer, "capacitor.config.json"), diff --git a/demo/tests/experiments/d1/ui-main.js b/demo/tests/experiments/d1/ui-main.js index 1b7bbb1..79926a7 100644 --- a/demo/tests/experiments/d1/ui-main.js +++ b/demo/tests/experiments/d1/ui-main.js @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import { Capacitor } from "@capacitor/core"; import server from "./server.json"; const origin = `https://${Capacitor.getPlatform() === "android" || globalThis.WorkersCapacitorHost ? "10.0.2.2" : "127.0.0.1"}:${server.port}`; diff --git a/demo/tests/experiments/services/native-main.js b/demo/tests/experiments/services/native-main.js index 743c17c..a0d5e5b 100644 --- a/demo/tests/experiments/services/native-main.js +++ b/demo/tests/experiments/services/native-main.js @@ -1,5 +1,5 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; -import { LocalStorageKV } from "cf-workers-mobile/cloudflare/bindings/kv"; +import { workersCapacitor } from "cf-workers-native/capacitor"; +import { LocalStorageKV } from "cf-workers-native/cloudflare/bindings/kv"; import { Capacitor } from "@capacitor/core"; import settings from "./server.json"; const platform = Capacitor.getPlatform(); diff --git a/demo/tests/fixtures/apps/build-tools/features.ts b/demo/tests/fixtures/apps/build-tools/features.ts index 2a2aa96..c8dd27a 100644 --- a/demo/tests/fixtures/apps/build-tools/features.ts +++ b/demo/tests/fixtures/apps/build-tools/features.ts @@ -1,5 +1,5 @@ -import { FetchImplementation } from "cf-workers-mobile/cloudflare/workers"; -import { openFeature } from "cf-workers-mobile/shared/contracts"; +import { FetchImplementation } from "cf-workers-native/cloudflare/workers"; +import { openFeature } from "cf-workers-native/shared/contracts"; import { runContract } from "../../../validation/contracts/http"; // Deliberately no root package import: exercise subpath-only dependency scanning. diff --git a/demo/tests/fixtures/apps/build-tools/main.ts b/demo/tests/fixtures/apps/build-tools/main.ts index 315bab8..5adb9cd 100644 --- a/demo/tests/fixtures/apps/build-tools/main.ts +++ b/demo/tests/fixtures/apps/build-tools/main.ts @@ -1,7 +1,7 @@ import { workersCapacitor, type ExecutionPreference, -} from "cf-workers-mobile/capacitor"; +} from "cf-workers-native/capacitor"; import { runContract } from "../../../validation/contracts/http"; // Bare, node:-prefixed, subpath, named and default import forms must all // resolve to the same compat profiles under both bundlers. diff --git a/demo/tests/fixtures/apps/build-tools/node.ts b/demo/tests/fixtures/apps/build-tools/node.ts index 0c0a68b..3852b59 100644 --- a/demo/tests/fixtures/apps/build-tools/node.ts +++ b/demo/tests/fixtures/apps/build-tools/node.ts @@ -1,7 +1,7 @@ import { workersCapacitor, type ExecutionPreference, -} from "cf-workers-mobile/capacitor"; +} from "cf-workers-native/capacitor"; // The configured worker is tests/fixtures/workers/compatibility/node-contracts.ts // for this build; direct executes it in-page, worker executes it as a diff --git a/demo/tests/fixtures/apps/build-tools/static-node.ts b/demo/tests/fixtures/apps/build-tools/static-node.ts index 0f4bbef..869ec8c 100644 --- a/demo/tests/fixtures/apps/build-tools/static-node.ts +++ b/demo/tests/fixtures/apps/build-tools/static-node.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import worker from "./static-node-worker"; async function run() { diff --git a/demo/tests/fixtures/apps/build-tools/vite.config.ts b/demo/tests/fixtures/apps/build-tools/vite.config.ts index fab4cc5..6b6c1e1 100644 --- a/demo/tests/fixtures/apps/build-tools/vite.config.ts +++ b/demo/tests/fixtures/apps/build-tools/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig(({ mode }) => { const framework = mode === "express" ? "express" : "hono"; return { diff --git a/demo/tests/fixtures/apps/native-documents/express-entry.ts b/demo/tests/fixtures/apps/native-documents/express-entry.ts index cf489e8..4be0f0a 100644 --- a/demo/tests/fixtures/apps/native-documents/express-entry.ts +++ b/demo/tests/fixtures/apps/native-documents/express-entry.ts @@ -1,3 +1,3 @@ -import { serve } from "cf-workers-mobile/browser/isolated"; +import { serve } from "cf-workers-native/browser/isolated"; import worker from "../../workers/rendering/express"; serve(worker); diff --git a/demo/tests/fixtures/apps/native-documents/hono-entry.ts b/demo/tests/fixtures/apps/native-documents/hono-entry.ts index 8da8d4a..77c4f79 100644 --- a/demo/tests/fixtures/apps/native-documents/hono-entry.ts +++ b/demo/tests/fixtures/apps/native-documents/hono-entry.ts @@ -1,3 +1,3 @@ -import { serve } from "cf-workers-mobile/browser/isolated"; +import { serve } from "cf-workers-native/browser/isolated"; import worker from "../../workers/rendering/hono"; serve(worker); diff --git a/demo/tests/fixtures/apps/native-documents/lifecycle.ts b/demo/tests/fixtures/apps/native-documents/lifecycle.ts index beb11e6..2bfe955 100644 --- a/demo/tests/fixtures/apps/native-documents/lifecycle.ts +++ b/demo/tests/fixtures/apps/native-documents/lifecycle.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import { enableDocumentWorker, registerDocumentWorker, diff --git a/demo/tests/fixtures/apps/native-documents/runtime.ts b/demo/tests/fixtures/apps/native-documents/runtime.ts index 2b19f0c..35bfdab 100644 --- a/demo/tests/fixtures/apps/native-documents/runtime.ts +++ b/demo/tests/fixtures/apps/native-documents/runtime.ts @@ -1,5 +1,5 @@ /// -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; // This Window is an offscreen runtime host, not the rendered application. // Keeping it alive lets the visible WebView use real document navigation. diff --git a/demo/tests/fixtures/apps/native-documents/vite.config.ts b/demo/tests/fixtures/apps/native-documents/vite.config.ts index e2272fb..dcbf6c3 100644 --- a/demo/tests/fixtures/apps/native-documents/vite.config.ts +++ b/demo/tests/fixtures/apps/native-documents/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; const here = (path: string) => fileURLToPath(new URL(path, import.meta.url)); export default defineConfig({ root: here("."), diff --git a/demo/tests/fixtures/apps/packaged-native/main.ts b/demo/tests/fixtures/apps/packaged-native/main.ts index 429515b..2a576af 100644 --- a/demo/tests/fixtures/apps/packaged-native/main.ts +++ b/demo/tests/fixtures/apps/packaged-native/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; localStorage.removeItem("packaged-stop"); let app = workersCapacitor({ baseURL: "https://worker.invalid", diff --git a/demo/tests/fixtures/apps/packaged-native/vite.config.ts b/demo/tests/fixtures/apps/packaged-native/vite.config.ts index 6143910..a28a390 100644 --- a/demo/tests/fixtures/apps/packaged-native/vite.config.ts +++ b/demo/tests/fixtures/apps/packaged-native/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import { resolve } from "node:path"; export default defineConfig(({ mode }) => ({ resolve: { diff --git a/demo/tests/fixtures/apps/public-documents/main.ts b/demo/tests/fixtures/apps/public-documents/main.ts index 4931e3c..33b8316 100644 --- a/demo/tests/fixtures/apps/public-documents/main.ts +++ b/demo/tests/fixtures/apps/public-documents/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const app = workersCapacitor({ baseURL: "https://worker.invalid", render: "/pages/home", diff --git a/demo/tests/fixtures/apps/public-documents/vite.config.ts b/demo/tests/fixtures/apps/public-documents/vite.config.ts index eed32db..224a8e4 100644 --- a/demo/tests/fixtures/apps/public-documents/vite.config.ts +++ b/demo/tests/fixtures/apps/public-documents/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; const here = (path: string) => fileURLToPath(new URL(path, import.meta.url)); export default defineConfig(({ mode }) => ({ root: here("."), diff --git a/demo/tests/fixtures/apps/runtime/main.ts b/demo/tests/fixtures/apps/runtime/main.ts index ce6d1fa..1f5b9fe 100644 --- a/demo/tests/fixtures/apps/runtime/main.ts +++ b/demo/tests/fixtures/apps/runtime/main.ts @@ -1,7 +1,7 @@ import { kvRequest } from "../../../validation/kv"; import { runFeatures } from "../../../validation/run-features"; import { Capacitor } from "@capacitor/core"; -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import { runFrameworkContract } from "./frameworks"; const isolation = () => diff --git a/demo/tests/fixtures/apps/runtime/vite.config.ts b/demo/tests/fixtures/apps/runtime/vite.config.ts index c3ada6e..22a19d4 100644 --- a/demo/tests/fixtures/apps/runtime/vite.config.ts +++ b/demo/tests/fixtures/apps/runtime/vite.config.ts @@ -1,7 +1,7 @@ import { readFile } from "node:fs/promises"; import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig({ root: fileURLToPath(new URL(".", import.meta.url)), plugins: [ diff --git a/demo/tests/fixtures/workers/compatibility/environment.ts b/demo/tests/fixtures/workers/compatibility/environment.ts index 544f681..4616a96 100644 --- a/demo/tests/fixtures/workers/compatibility/environment.ts +++ b/demo/tests/fixtures/workers/compatibility/environment.ts @@ -1,4 +1,4 @@ -import { getExecutionEnvironment } from "cf-workers-mobile/environment"; +import { getExecutionEnvironment } from "cf-workers-native/environment"; import { AsyncLocalStorage } from "node:async_hooks"; export default { async fetch() { diff --git a/demo/tests/fixtures/workers/compatibility/fetch-policy.ts b/demo/tests/fixtures/workers/compatibility/fetch-policy.ts index de400c2..9762c83 100644 --- a/demo/tests/fixtures/workers/compatibility/fetch-policy.ts +++ b/demo/tests/fixtures/workers/compatibility/fetch-policy.ts @@ -1,7 +1,7 @@ import * as nodeHttp from "node:http"; import * as localHttp from "../../../../../src/compat/http"; import { nodeHttpNetworkContract } from "../../../../../src/compat/http/index.spec"; -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { FetchPolicyImplementation, fetchPolicyContract, diff --git a/demo/tests/fixtures/workers/compatibility/fetch.ts b/demo/tests/fixtures/workers/compatibility/fetch.ts index 140915a..41df7f8 100644 --- a/demo/tests/fixtures/workers/compatibility/fetch.ts +++ b/demo/tests/fixtures/workers/compatibility/fetch.ts @@ -1 +1 @@ -export { fetchContractWorker as default } from "cf-workers-mobile/cloudflare/workers/testing"; +export { fetchContractWorker as default } from "cf-workers-native/cloudflare/workers/testing"; diff --git a/demo/tests/fixtures/workers/compatibility/headers.ts b/demo/tests/fixtures/workers/compatibility/headers.ts index effd2c9..0ff332f 100644 --- a/demo/tests/fixtures/workers/compatibility/headers.ts +++ b/demo/tests/fixtures/workers/compatibility/headers.ts @@ -1,4 +1,4 @@ -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { headersContract, HeadersImplementation, diff --git a/demo/tests/fixtures/workers/compatibility/host-globals.ts b/demo/tests/fixtures/workers/compatibility/host-globals.ts index 70744ba..6a4e027 100644 --- a/demo/tests/fixtures/workers/compatibility/host-globals.ts +++ b/demo/tests/fixtures/workers/compatibility/host-globals.ts @@ -1,4 +1,4 @@ -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { EncodingImplementation, encodingContract, diff --git a/demo/tests/fixtures/workers/compatibility/immediate.ts b/demo/tests/fixtures/workers/compatibility/immediate.ts index 796f76c..5d89d75 100644 --- a/demo/tests/fixtures/workers/compatibility/immediate.ts +++ b/demo/tests/fixtures/workers/compatibility/immediate.ts @@ -1,4 +1,4 @@ -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { ImmediateImplementation, immediateContract, diff --git a/demo/tests/fixtures/workers/compatibility/kv.ts b/demo/tests/fixtures/workers/compatibility/kv.ts index e71c889..4f44dd9 100644 --- a/demo/tests/fixtures/workers/compatibility/kv.ts +++ b/demo/tests/fixtures/workers/compatibility/kv.ts @@ -1,4 +1,4 @@ -import type { KVTextNamespace } from "cf-workers-mobile/cloudflare/bindings/kv"; +import type { KVTextNamespace } from "cf-workers-native/cloudflare/bindings/kv"; /** The same handler runs against Workers KV and the WebView binding. */ export default { async fetch(request: Request, env: { KV: KVTextNamespace }) { diff --git a/demo/tests/fixtures/workers/compatibility/net.ts b/demo/tests/fixtures/workers/compatibility/net.ts index a53282d..ce89416 100644 --- a/demo/tests/fixtures/workers/compatibility/net.ts +++ b/demo/tests/fixtures/workers/compatibility/net.ts @@ -1,4 +1,4 @@ -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { NetImplementation, netContract, diff --git a/demo/tests/fixtures/workers/compatibility/request-response.ts b/demo/tests/fixtures/workers/compatibility/request-response.ts index 9d8a0ae..c5e7814 100644 --- a/demo/tests/fixtures/workers/compatibility/request-response.ts +++ b/demo/tests/fixtures/workers/compatibility/request-response.ts @@ -1,4 +1,4 @@ -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { Request as LocalRequest } from "../../../../../src/browser/request"; import { Response as LocalResponse } from "../../../../../src/browser/response"; import { diff --git a/demo/tests/fixtures/workers/compatibility/services.ts b/demo/tests/fixtures/workers/compatibility/services.ts index 8a216db..090bb9f 100644 --- a/demo/tests/fixtures/workers/compatibility/services.ts +++ b/demo/tests/fixtures/workers/compatibility/services.ts @@ -1,7 +1,7 @@ import kvWorker from "./kv"; -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; -import { kvContract } from "cf-workers-mobile/cloudflare/bindings/kv/testing"; -import type { KVNamespace } from "cf-workers-mobile/cloudflare/bindings/kv"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; +import { kvContract } from "cf-workers-native/cloudflare/bindings/kv/testing"; +import type { KVNamespace } from "cf-workers-native/cloudflare/bindings/kv"; import { wasmContract } from "../../../validation/contracts/wasm"; import { WorkersText, diff --git a/demo/tests/fixtures/workers/compatibility/structured-clone.ts b/demo/tests/fixtures/workers/compatibility/structured-clone.ts index cec48b3..a28bc18 100644 --- a/demo/tests/fixtures/workers/compatibility/structured-clone.ts +++ b/demo/tests/fixtures/workers/compatibility/structured-clone.ts @@ -1,4 +1,4 @@ -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { localStructuredCloneApi, StructuredCloneImplementation, diff --git a/demo/tests/native-embedding/android/README.md b/demo/tests/native-embedding/android/README.md index f5380ae..3278151 100644 --- a/demo/tests/native-embedding/android/README.md +++ b/demo/tests/native-embedding/android/README.md @@ -10,6 +10,11 @@ node run.mjs emulator-5554 The runner uses the repository's Gradle wrapper to publish the SDK into `build/maven`, then builds the consumer without including the SDK source project. Dependencies resolve from the published AAR, POM/Gradle metadata, and Maven Central. Set `JAVA_HOME` to Java 21 and configure `ANDROID_HOME` (or `local.properties`) for your SDK installation. +After a release reaches Maven Central, run `node run.mjs emulator-5554 --central` +to verify the released coordinate using the same acceptance checks. This skips +local SDK publication and removes the local Maven repository from dependency +resolution; only Google and Maven Central are used. + It keeps the first healthy Worker screen open beyond the native startup deadline, then asserts Worker navigation, POST, rotation, back/reopen, Activity recreation, automatic recovery after startup failure or a missing JavaScript entry, and recovery after renderer loss. The missing-entry scenario waits for the native startup deadline before returning. The native screen's visit counter must survive every round trip. Logs and failure snapshots are saved under `build/acceptance/`. The fixture restores emulator rotation settings after the run. The host remains a ComponentActivity and calls only `WorkersNative.open`. No Capacitor configuration, CLI sync, plugin registration or host superclass changes are needed. diff --git a/demo/tests/native-embedding/android/app/build.gradle b/demo/tests/native-embedding/android/app/build.gradle index c5c742f..94c59ac 100644 --- a/demo/tests/native-embedding/android/app/build.gradle +++ b/demo/tests/native-embedding/android/app/build.gradle @@ -7,6 +7,7 @@ android { packaging.resources { excludes += 'META-INF/INDEX.LIST'; merges += 'META-INF/io.netty.versions.properties' } } dependencies { - implementation 'jp.rdlabo:workers-native-android:0.1.2' + def sdkVersion = new groovy.json.JsonSlurper().parse(rootProject.file('../../../../package.json')).version + implementation "io.github.rdlabo:cf-workers-native-android:${sdkVersion}" implementation 'androidx.activity:activity:1.10.1' } diff --git a/demo/tests/native-embedding/android/build.gradle b/demo/tests/native-embedding/android/build.gradle index 4a00b5c..7a16978 100644 --- a/demo/tests/native-embedding/android/build.gradle +++ b/demo/tests/native-embedding/android/build.gradle @@ -3,7 +3,12 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:8.13.0' } } allprojects { - repositories { maven { url rootProject.file(providers.gradleProperty('sdkRepository').getOrElse('build/maven')) }; google(); mavenCentral() } + repositories { + if (!providers.gradleProperty('centralOnly').isPresent()) { + maven { url rootProject.file(providers.gradleProperty('sdkRepository').getOrElse('build/maven')) } + } + google(); mavenCentral() + } } if (findProject(':workers') != null) { project(':workers') { diff --git a/demo/tests/native-embedding/android/run.mjs b/demo/tests/native-embedding/android/run.mjs index a93589b..c022748 100644 --- a/demo/tests/native-embedding/android/run.mjs +++ b/demo/tests/native-embedding/android/run.mjs @@ -6,6 +6,7 @@ import path from "node:path"; const here = fileURLToPath(new URL("./", import.meta.url)); const device = process.argv[2]; +const centralOnly = process.argv.includes("--central"); if (!device) throw new Error("Usage: node run.mjs "); if (!device.startsWith("emulator-")) throw new Error("This fixture requires an emulator"); @@ -26,15 +27,22 @@ const adb = (...args) => run("adb", ["-s", device, ...args], { timeout: 60_000 }); for (const scenario of ["normal", "startup-failure", "broken-entry"]) run(process.execPath, ["../build-web.mjs", "android", scenario]); +if (!centralOnly) + run(gradle, [ + "-p", + here, + "-PincludeSdk", + ":workers:publishReleasePublicationToProbeRepository", + "--console=plain", + ]); +// No SDK project in this invocation: resolve the AAR and its metadata. run(gradle, [ "-p", here, - "-PincludeSdk", - ":workers:publishReleasePublicationToProbeRepository", + ...(centralOnly ? ["-PcentralOnly", "--refresh-dependencies"] : []), + ":app:assembleDebug", "--console=plain", ]); -// No SDK project in this invocation: resolve the AAR and its metadata. -run(gradle, ["-p", here, ":app:assembleDebug", "--console=plain"]); adb("install", "-r", "app/build/outputs/apk/debug/app-debug.apk"); adb("shell", "am", "force-stop", "probe.workersembed"); adb("logcat", "-c"); diff --git a/demo/tests/native/acceptance.mjs b/demo/tests/native/acceptance.mjs index 2fd71ef..e22595d 100644 --- a/demo/tests/native/acceptance.mjs +++ b/demo/tests/native/acceptance.mjs @@ -82,7 +82,7 @@ export async function runNativeAcceptance({ await writeFile( join(bootstrap, "main.js"), bootstrapCode ?? - `import { workersCapacitor } from "cf-workers-mobile/capacitor"; const runtime = workersCapacitor({baseURL:${JSON.stringify(backend.url.origin + "/")},remote:{origin:${JSON.stringify(backend.url.origin)}},render:${JSON.stringify(render)}}); await runtime.ready;`, + `import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({baseURL:${JSON.stringify(backend.url.origin + "/")},remote:{origin:${JSON.stringify(backend.url.origin)}},render:${JSON.stringify(render)}}); await runtime.ready;`, ); await build({ configFile: false, diff --git a/demo/tests/native/documents/page-fetch.ts b/demo/tests/native/documents/page-fetch.ts index 147926f..948f76d 100644 --- a/demo/tests/native/documents/page-fetch.ts +++ b/demo/tests/native/documents/page-fetch.ts @@ -1,5 +1,5 @@ import "./form-body"; -import { FetchRuntime } from "cf-workers-mobile/capacitor"; +import { FetchRuntime } from "cf-workers-native/capacitor"; // Experiment only: keep native document navigation, but carry fetch bytes and // redirect policy through a script-message bridge before WebKit serializes them. diff --git a/demo/tests/opennext/images.native.test.mjs b/demo/tests/opennext/images.native.test.mjs index 1128faa..e10b785 100644 --- a/demo/tests/opennext/images.native.test.mjs +++ b/demo/tests/opennext/images.native.test.mjs @@ -26,7 +26,7 @@ test( backend, ...(live ? { - bootstrapCode: `import { workersCapacitor } from "cf-workers-mobile/capacitor"; await workersCapacitor({ baseURL: "https://worker.invalid/", remote: { origin: ${JSON.stringify(backend.url.origin)}, getToken: () => ${JSON.stringify(process.env.NATIVE_TEST_DEVICE_TOKEN)} }, render: "/images" }).ready;`, + bootstrapCode: `import { workersCapacitor } from "cf-workers-native/capacitor"; await workersCapacitor({ baseURL: "https://worker.invalid/", remote: { origin: ${JSON.stringify(backend.url.origin)}, getToken: () => ${JSON.stringify(process.env.NATIVE_TEST_DEVICE_TOKEN)} }, render: "/images" }).ready;`, } : {}), worker: join(root, ".open-next/worker.js"), diff --git a/demo/tests/opennext/live/main.ts b/demo/tests/opennext/live/main.ts index 8a9f91c..b319d5e 100644 --- a/demo/tests/opennext/live/main.ts +++ b/demo/tests/opennext/live/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; await workersCapacitor({ baseURL: "https://worker.invalid/", remote: { diff --git a/demo/tests/opennext/live/vite.config.ts b/demo/tests/opennext/live/vite.config.ts index e370640..dd25dd9 100644 --- a/demo/tests/opennext/live/vite.config.ts +++ b/demo/tests/opennext/live/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import { fileURLToPath } from "node:url"; const here = (path: string) => fileURLToPath(new URL(path, import.meta.url)); export default defineConfig({ diff --git a/demo/tests/opennext/local/esbuild.mjs b/demo/tests/opennext/local/esbuild.mjs index d0d13ae..9bf1a01 100644 --- a/demo/tests/opennext/local/esbuild.mjs +++ b/demo/tests/opennext/local/esbuild.mjs @@ -1,5 +1,5 @@ import { build } from "esbuild"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/esbuild"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/esbuild"; import { fileURLToPath } from "node:url"; import { writeFile } from "node:fs/promises"; const here = (path) => fileURLToPath(new URL(path, import.meta.url)); diff --git a/demo/tests/opennext/local/main.ts b/demo/tests/opennext/local/main.ts index 936859a..d4dcf18 100644 --- a/demo/tests/opennext/local/main.ts +++ b/demo/tests/opennext/local/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://worker.invalid/", ...(import.meta.env.VITE_REPORT_ORIGIN ? { render: "/" } : {}), diff --git a/demo/tests/opennext/local/vite.config.ts b/demo/tests/opennext/local/vite.config.ts index c7bb20e..16c935a 100644 --- a/demo/tests/opennext/local/vite.config.ts +++ b/demo/tests/opennext/local/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import { fileURLToPath } from "node:url"; import { readFile } from "node:fs/promises"; const here = (path: string) => fileURLToPath(new URL(path, import.meta.url)); diff --git a/demo/tests/opennext/native.test.mjs b/demo/tests/opennext/native.test.mjs index 57ed214..005d42f 100644 --- a/demo/tests/opennext/native.test.mjs +++ b/demo/tests/opennext/native.test.mjs @@ -112,7 +112,7 @@ test( configPath, originalConfig.replace( 'webDir: "www",', - 'webDir: "www", includePlugins: ["cf-workers-mobile", "@workers-capacitor-test/bridge-probe"],', + 'webDir: "www", includePlugins: ["cf-workers-native", "@workers-capacitor-test/bridge-probe"],', ), ); } diff --git a/demo/tests/opennext/releases/prepare.mjs b/demo/tests/opennext/releases/prepare.mjs index 55fc0d2..8c924e8 100644 --- a/demo/tests/opennext/releases/prepare.mjs +++ b/demo/tests/opennext/releases/prepare.mjs @@ -43,10 +43,10 @@ for (const release of ["A", "B"]) { mode: constants.COPYFILE_FICLONE, verbatimSymlinks: true, }); - const library = join(root, "node_modules/cf-workers-mobile"); + const library = join(root, "node_modules/cf-workers-native"); await rm(library, { recursive: true, force: true }); await symlink( - await realpath(join(source, "node_modules/cf-workers-mobile")), + await realpath(join(source, "node_modules/cf-workers-native")), library, "dir", ); diff --git a/demo/tests/opennext/split/boundaries.test.mjs b/demo/tests/opennext/split/boundaries.test.mjs index 57779fa..bde0066 100644 --- a/demo/tests/opennext/split/boundaries.test.mjs +++ b/demo/tests/opennext/split/boundaries.test.mjs @@ -12,8 +12,8 @@ import { join } from "node:path"; import { fileURLToPath } from "node:url"; import { build as vite } from "vite"; import { build as esbuild } from "esbuild"; -import { workersCapacitorPlugin as vitePlugin } from "cf-workers-mobile/tooling/vite"; -import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-mobile/tooling/esbuild"; +import { workersCapacitorPlugin as vitePlugin } from "cf-workers-native/tooling/vite"; +import { workersCapacitorPlugin as esbuildPlugin } from "cf-workers-native/tooling/esbuild"; const parent = fileURLToPath( new URL("../../../opennext/artifacts/", import.meta.url), ); @@ -37,7 +37,7 @@ for (const tool of ["vite", "esbuild"]) "wrangler.json": "{}", "index.html": '', "main.js": - 'import {workersCapacitor} from "cf-workers-mobile/capacitor";window.runtime=workersCapacitor({baseURL:"https://worker.invalid",remote:{origin:"https://backend.invalid"}});', + 'import {workersCapacitor} from "cf-workers-native/capacitor";window.runtime=workersCapacitor({baseURL:"https://worker.invalid",remote:{origin:"https://backend.invalid"}});', ".open-next/worker.js": `import {production} from "./cloudflare/next-env.mjs";export default {fetch(){return new Response(${JSON.stringify(marker)}+JSON.stringify(production))}};`, ".open-next/.build/open-next.config.mjs": 'export default {functions:{custom:{routes:["app/page"]}}};', diff --git a/demo/tests/opennext/split/esbuild.mjs b/demo/tests/opennext/split/esbuild.mjs index 2376397..a32ee86 100644 --- a/demo/tests/opennext/split/esbuild.mjs +++ b/demo/tests/opennext/split/esbuild.mjs @@ -1,5 +1,5 @@ import { build } from "esbuild"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/esbuild"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/esbuild"; import { fileURLToPath } from "node:url"; import { cp, mkdir, writeFile, rm } from "node:fs/promises"; const here = (path) => fileURLToPath(new URL(path, import.meta.url)); diff --git a/demo/tests/opennext/split/lifecycle.test.mjs b/demo/tests/opennext/split/lifecycle.test.mjs index 2b94a90..7a5a2c4 100644 --- a/demo/tests/opennext/split/lifecycle.test.mjs +++ b/demo/tests/opennext/split/lifecycle.test.mjs @@ -4,7 +4,7 @@ import { context } from "esbuild"; import { readFile, writeFile, readdir, readlink } from "node:fs/promises"; import { fileURLToPath } from "node:url"; import { createHash } from "node:crypto"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/esbuild"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/esbuild"; const here = (path) => fileURLToPath(new URL(path, import.meta.url)); const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); const hash = (contents) => createHash("sha256").update(contents).digest("hex"); diff --git a/demo/tests/opennext/split/main.ts b/demo/tests/opennext/split/main.ts index 8ce731c..293108f 100644 --- a/demo/tests/opennext/split/main.ts +++ b/demo/tests/opennext/split/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://worker.invalid/", remote: { diff --git a/demo/tests/opennext/split/vite.config.ts b/demo/tests/opennext/split/vite.config.ts index 89537ab..54ff476 100644 --- a/demo/tests/opennext/split/vite.config.ts +++ b/demo/tests/opennext/split/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import { fileURLToPath } from "node:url"; import { resolve } from "node:path"; const here = (path: string) => fileURLToPath(new URL(path, import.meta.url)); diff --git a/demo/tests/runtime/web-api.spec.ts b/demo/tests/runtime/web-api.spec.ts index 2e989a0..c3acf47 100644 --- a/demo/tests/runtime/web-api.spec.ts +++ b/demo/tests/runtime/web-api.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from "@playwright/test"; import { build } from "esbuild"; import { fileURLToPath } from "node:url"; -import type { ContractResult } from "cf-workers-mobile/shared/contracts/testing"; +import type { ContractResult } from "cf-workers-native/shared/contracts/testing"; import type { WebApiName } from "../validation/web-api-contracts"; diff --git a/demo/tests/scripts/build-tools.mjs b/demo/tests/scripts/build-tools.mjs index 91ed153..f04df45 100644 --- a/demo/tests/scripts/build-tools.mjs +++ b/demo/tests/scripts/build-tools.mjs @@ -3,8 +3,8 @@ import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { build as viteBuild } from "vite"; import { build as esbuild } from "esbuild"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/esbuild"; -import { workersCapacitorPlugin as vitePlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/esbuild"; +import { workersCapacitorPlugin as vitePlugin } from "cf-workers-native/tooling/vite"; const root = fileURLToPath(new URL("../../", import.meta.url)); // Dedicated Worker contract via the configured-worker route: the node // contract worker is the configured entry of these builds. @@ -100,6 +100,6 @@ await cp(resolve(root, "tests/fixtures/apps/build-tools/raw"), raw, { }); // Copy the ESM distribution verbatim: these files are never bundled. const dist = dirname( - fileURLToPath(import.meta.resolve("cf-workers-mobile/capacitor")), + fileURLToPath(import.meta.resolve("cf-workers-native/capacitor")), ); await cp(dist, resolve(raw, "lib"), { recursive: true }); diff --git a/demo/tests/scripts/prepare-native-package.mjs b/demo/tests/scripts/prepare-native-package.mjs index a166525..7212dc6 100644 --- a/demo/tests/scripts/prepare-native-package.mjs +++ b/demo/tests/scripts/prepare-native-package.mjs @@ -50,7 +50,7 @@ await writeFile( type: "module", scripts: { build: "vite build" }, dependencies: { - "cf-workers-mobile": `file:./${packed.filename}`, + "cf-workers-native": `file:./${packed.filename}`, "@capacitor/core": "8.5.3", "@capacitor/android": "8.5.3", "@capacitor/ios": "8.5.3", @@ -143,8 +143,8 @@ await writeFile( ); run("npm", ["install"], consumer); assert.equal( - await realpath(join(consumer, "node_modules/cf-workers-mobile")), - join(consumer, "node_modules/cf-workers-mobile"), + await realpath(join(consumer, "node_modules/cf-workers-native")), + join(consumer, "node_modules/cf-workers-native"), "Must install tarball, not link repo", ); // Bundle the installed package entry as a classic script so the Android @@ -152,7 +152,7 @@ assert.equal( // document, the same checks as the historical CDP --lifecycle probe. const { build } = await import("esbuild"); const lifecycle = await build({ - entryPoints: [join(consumer, "node_modules/cf-workers-mobile/dist/index.js")], + entryPoints: [join(consumer, "node_modules/cf-workers-native/dist/index.js")], bundle: true, format: "iife", globalName: "DocumentLifecycleTest", diff --git a/demo/tests/scripts/prepare-upstream.mjs b/demo/tests/scripts/prepare-upstream.mjs index 4507f8f..5fdb248 100644 --- a/demo/tests/scripts/prepare-upstream.mjs +++ b/demo/tests/scripts/prepare-upstream.mjs @@ -117,7 +117,7 @@ await writeFile( type: "module", scripts: { build: "vite build" }, dependencies: { - "cf-workers-mobile": `file:./${packed.filename}`, + "cf-workers-native": `file:./${packed.filename}`, "@capacitor/core": "8.5.3", "@capacitor/android": "8.5.3", "@capacitor/ios": "8.5.3", @@ -149,8 +149,8 @@ assert.ok( ); run("npm", ["install"], consumer); assert.equal( - await realpath(join(consumer, "node_modules/cf-workers-mobile")), - join(consumer, "node_modules/cf-workers-mobile"), + await realpath(join(consumer, "node_modules/cf-workers-native")), + join(consumer, "node_modules/cf-workers-native"), "Must install tarball, not link repo", ); run("npm", ["run", "build"], consumer); diff --git a/demo/tests/upstream/hono-jsx-ssr/browser/main.ts b/demo/tests/upstream/hono-jsx-ssr/browser/main.ts index 29ceb0a..08768bb 100644 --- a/demo/tests/upstream/hono-jsx-ssr/browser/main.ts +++ b/demo/tests/upstream/hono-jsx-ssr/browser/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const prefer = new URL(location.href).searchParams.get("prefer") === "direct" diff --git a/demo/tests/upstream/hono-jsx-ssr/browser/vite.config.ts b/demo/tests/upstream/hono-jsx-ssr/browser/vite.config.ts index 7b71931..632f65f 100644 --- a/demo/tests/upstream/hono-jsx-ssr/browser/vite.config.ts +++ b/demo/tests/upstream/hono-jsx-ssr/browser/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import { workerEntry } from "../sample"; export default defineConfig({ diff --git a/demo/tests/upstream/hono-jsx-ssr/fixture/main.ts b/demo/tests/upstream/hono-jsx-ssr/fixture/main.ts index 62c1af1..e56ea3a 100644 --- a/demo/tests/upstream/hono-jsx-ssr/fixture/main.ts +++ b/demo/tests/upstream/hono-jsx-ssr/fixture/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const app = workersCapacitor({ baseURL: "https://worker.invalid", diff --git a/demo/tests/upstream/hono-jsx-ssr/fixture/vite.config.ts b/demo/tests/upstream/hono-jsx-ssr/fixture/vite.config.ts index 37d8d60..db99965 100644 --- a/demo/tests/upstream/hono-jsx-ssr/fixture/vite.config.ts +++ b/demo/tests/upstream/hono-jsx-ssr/fixture/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import { readFileSync } from "node:fs"; import { resolve } from "node:path"; diff --git a/demo/tests/validation/contracts/wasm.ts b/demo/tests/validation/contracts/wasm.ts index bdbe1e4..b78096f 100644 --- a/demo/tests/validation/contracts/wasm.ts +++ b/demo/tests/validation/contracts/wasm.ts @@ -1,5 +1,5 @@ -import { defineFeature } from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +import { defineFeature } from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; function equal(actual: unknown, expected: unknown) { if (JSON.stringify(actual) !== JSON.stringify(expected)) throw new Error(`${JSON.stringify(actual)} != ${JSON.stringify(expected)}`); diff --git a/demo/tests/validation/entries/express.ts b/demo/tests/validation/entries/express.ts index ba76a24..f6b3ef4 100644 --- a/demo/tests/validation/entries/express.ts +++ b/demo/tests/validation/entries/express.ts @@ -1,3 +1,3 @@ -import { serve } from "cf-workers-mobile/browser/isolated"; +import { serve } from "cf-workers-native/browser/isolated"; import worker from "../../fixtures/workers/express/standard"; serve(worker); diff --git a/demo/tests/validation/entries/fetch.ts b/demo/tests/validation/entries/fetch.ts index f07b353..e89baf4 100644 --- a/demo/tests/validation/entries/fetch.ts +++ b/demo/tests/validation/entries/fetch.ts @@ -1,3 +1,3 @@ -import { serve } from "cf-workers-mobile/browser/isolated"; +import { serve } from "cf-workers-native/browser/isolated"; import worker from "../../fixtures/workers/compatibility/fetch"; serve(worker); diff --git a/demo/tests/validation/entries/hono.ts b/demo/tests/validation/entries/hono.ts index 5c4e263..1b4c332 100644 --- a/demo/tests/validation/entries/hono.ts +++ b/demo/tests/validation/entries/hono.ts @@ -1,3 +1,3 @@ -import { serve } from "cf-workers-mobile/browser/isolated"; +import { serve } from "cf-workers-native/browser/isolated"; import worker from "../../fixtures/workers/hono/standard"; serve(worker); diff --git a/demo/tests/validation/entries/isolation.ts b/demo/tests/validation/entries/isolation.ts index 5356911..2fbdccc 100644 --- a/demo/tests/validation/entries/isolation.ts +++ b/demo/tests/validation/entries/isolation.ts @@ -1,3 +1,3 @@ -import { serve } from "cf-workers-mobile/browser/isolated"; +import { serve } from "cf-workers-native/browser/isolated"; import worker from "../../fixtures/workers/runtime/isolation"; serve(worker); diff --git a/demo/tests/validation/implementations.ts b/demo/tests/validation/implementations.ts index 06209f2..ce69ea8 100644 --- a/demo/tests/validation/implementations.ts +++ b/demo/tests/validation/implementations.ts @@ -1,13 +1,13 @@ -import { LocalStorageKV } from "cf-workers-mobile/cloudflare/bindings/kv"; +import { LocalStorageKV } from "cf-workers-native/cloudflare/bindings/kv"; import { FeatureImplementation, FeatureUnavailable, type FeatureScope, -} from "cf-workers-mobile/shared/contracts"; +} from "cf-workers-native/shared/contracts"; import { kvFeature, type KVNamespace, -} from "cf-workers-mobile/cloudflare/bindings/kv"; +} from "cf-workers-native/cloudflare/bindings/kv"; import { wasmFeature } from "./contracts/wasm"; /** Test-only cleanup. Production feature disposal never clears application data. */ diff --git a/demo/tests/validation/kv.ts b/demo/tests/validation/kv.ts index 1668db2..012d245 100644 --- a/demo/tests/validation/kv.ts +++ b/demo/tests/validation/kv.ts @@ -1,6 +1,6 @@ -import { LocalStorageKV } from "cf-workers-mobile/cloudflare/bindings/kv"; -import { openFeature } from "cf-workers-mobile/shared/contracts"; -import { FetchImplementation } from "cf-workers-mobile/cloudflare/workers"; +import { LocalStorageKV } from "cf-workers-native/cloudflare/bindings/kv"; +import { openFeature } from "cf-workers-native/shared/contracts"; +import { FetchImplementation } from "cf-workers-native/cloudflare/workers"; import worker from "../fixtures/workers/compatibility/kv"; export async function kvRequest( namespace: string, diff --git a/demo/tests/validation/main.ts b/demo/tests/validation/main.ts index 8ec3e51..0603372 100644 --- a/demo/tests/validation/main.ts +++ b/demo/tests/validation/main.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import hono from "../fixtures/workers/hono/standard"; import express from "../fixtures/workers/express/standard"; import { runContract, type Result } from "./contracts/http"; diff --git a/demo/tests/validation/node-modules.ts b/demo/tests/validation/node-modules.ts index c229312..296e2af 100644 --- a/demo/tests/validation/node-modules.ts +++ b/demo/tests/validation/node-modules.ts @@ -124,13 +124,13 @@ import { TimersImplementation, timersContract, } from "../../../src/compat/timers/index.spec"; -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; // Environment runners share module-owned contracts. The node:* imports in // their implementations resolve to workerd builtins or the bundler aliases. import { runContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; import { nodePathContract, BundledPath, diff --git a/demo/tests/validation/node-worker.ts b/demo/tests/validation/node-worker.ts index aa3bb2d..216ea36 100644 --- a/demo/tests/validation/node-worker.ts +++ b/demo/tests/validation/node-worker.ts @@ -1,4 +1,4 @@ -import type { ContractResult } from "cf-workers-mobile/shared/contracts/testing"; +import type { ContractResult } from "cf-workers-native/shared/contracts/testing"; // This runtime fixture is built by Vite. Build-tool tests separately exercise // the configured Worker entry through both Vite and esbuild. diff --git a/demo/tests/validation/run-features.ts b/demo/tests/validation/run-features.ts index 0017283..07ed0a9 100644 --- a/demo/tests/validation/run-features.ts +++ b/demo/tests/validation/run-features.ts @@ -1,16 +1,16 @@ import { verifyKVPersistence } from "./kv"; -import { FetchImplementation } from "cf-workers-mobile/cloudflare/workers"; +import { FetchImplementation } from "cf-workers-native/cloudflare/workers"; import { assertContract, runContract, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; import worker from "../fixtures/workers/compatibility/fetch"; const isolated = () => new Worker(new URL("./entries/fetch.ts", import.meta.url), { type: "module", }); -import { fetchContract } from "cf-workers-mobile/cloudflare/workers/testing"; -import { kvContract } from "cf-workers-mobile/cloudflare/bindings/kv/testing"; +import { fetchContract } from "cf-workers-native/cloudflare/workers/testing"; +import { kvContract } from "cf-workers-native/cloudflare/bindings/kv/testing"; import { wasmContract } from "./contracts/wasm"; import { runLocalNodeContracts } from "./node-modules"; import { runNodeContractsInWorker } from "./node-worker"; diff --git a/demo/tests/validation/vite.config.ts b/demo/tests/validation/vite.config.ts index 38812aa..a87b165 100644 --- a/demo/tests/validation/vite.config.ts +++ b/demo/tests/validation/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig({ root: fileURLToPath(new URL(".", import.meta.url)), diff --git a/demo/tests/validation/web-api-contracts.ts b/demo/tests/validation/web-api-contracts.ts index ea49277..bd34b71 100644 --- a/demo/tests/validation/web-api-contracts.ts +++ b/demo/tests/validation/web-api-contracts.ts @@ -1,4 +1,4 @@ -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; import { EncodingImplementation, encodingContract, @@ -7,7 +7,7 @@ import { AbortImplementation, abortContract, } from "../../../src/browser/abort/index.spec"; -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { HeadersImplementation, headersContract, diff --git a/demo/tests/validation/web-apis.ts b/demo/tests/validation/web-apis.ts index 11256e5..06583d4 100644 --- a/demo/tests/validation/web-apis.ts +++ b/demo/tests/validation/web-apis.ts @@ -1,4 +1,4 @@ -import type { ContractResult } from "cf-workers-mobile/shared/contracts/testing"; +import type { ContractResult } from "cf-workers-native/shared/contracts/testing"; import { runWebApiContracts } from "./web-api-contracts"; export async function runWebApis() { diff --git a/demo/tests/vite.express.config.ts b/demo/tests/vite.express.config.ts index 35d2d3a..87ca45c 100644 --- a/demo/tests/vite.express.config.ts +++ b/demo/tests/vite.express.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; import demo from "../vite.config"; // Build the same demo with only its Worker selection changed. diff --git a/demo/tests/void/integration.test.mjs b/demo/tests/void/integration.test.mjs index d2368bc..4851af0 100644 --- a/demo/tests/void/integration.test.mjs +++ b/demo/tests/void/integration.test.mjs @@ -67,7 +67,7 @@ test( ); await writeFile( join(temp, "main.js"), - `import { workersCapacitor } from "cf-workers-mobile/capacitor"; + `import { workersCapacitor } from "cf-workers-native/capacitor"; window.runtime = workersCapacitor({ baseURL: "https://worker.invalid/", remote: { origin: "https://void.invalid" } });`, ); await build({ diff --git a/demo/tests/void/routes/acceptance.test.mjs b/demo/tests/void/routes/acceptance.test.mjs index 00724f9..787eeec 100644 --- a/demo/tests/void/routes/acceptance.test.mjs +++ b/demo/tests/void/routes/acceptance.test.mjs @@ -28,7 +28,7 @@ for (const bundler of ["vite", "esbuild"]) { const temp = await mkdtemp(join(demo, "artifacts/void-routes-")); let server; try { - const main = `import {workersCapacitor} from "cf-workers-mobile/capacitor"; + const main = `import {workersCapacitor} from "cf-workers-native/capacitor"; window.runtime=workersCapacitor({baseURL:"https://worker.invalid/",remote:{origin:"https://remote.invalid"}});`; await writeFile(join(temp, "main.js"), main); await writeFile( diff --git a/demo/tests/workers/features.test.ts b/demo/tests/workers/features.test.ts index ca76367..eded68a 100644 --- a/demo/tests/workers/features.test.ts +++ b/demo/tests/workers/features.test.ts @@ -1,13 +1,13 @@ import { afterAll, beforeAll, expect, it } from "vitest"; import { createTestHarness } from "wrangler"; -import { FeatureImplementation } from "cf-workers-mobile/shared/contracts"; -import { fetchFeature } from "cf-workers-mobile/cloudflare/workers"; +import { FeatureImplementation } from "cf-workers-native/shared/contracts"; +import { fetchFeature } from "cf-workers-native/cloudflare/workers"; import { assertContract, runContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; -import { fetchContract } from "cf-workers-mobile/cloudflare/workers/testing"; +} from "cf-workers-native/shared/contracts/testing"; +import { fetchContract } from "cf-workers-native/cloudflare/workers/testing"; const http = createTestHarness({ workers: [ { diff --git a/demo/tests/workers/headers.test.ts b/demo/tests/workers/headers.test.ts index ad324db..0b9eac0 100644 --- a/demo/tests/workers/headers.test.ts +++ b/demo/tests/workers/headers.test.ts @@ -3,7 +3,7 @@ import { createTestHarness } from "wrangler"; import { assertContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; const harness = createTestHarness({ workers: [ diff --git a/demo/tests/workers/host-globals.test.ts b/demo/tests/workers/host-globals.test.ts index 3f0b7ba..3efc462 100644 --- a/demo/tests/workers/host-globals.test.ts +++ b/demo/tests/workers/host-globals.test.ts @@ -3,7 +3,7 @@ import { createTestHarness } from "wrangler"; import { assertContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; const harness = createTestHarness({ workers: [ { diff --git a/demo/tests/workers/immediate.test.ts b/demo/tests/workers/immediate.test.ts index c64d3e1..73b1781 100644 --- a/demo/tests/workers/immediate.test.ts +++ b/demo/tests/workers/immediate.test.ts @@ -3,7 +3,7 @@ import { createTestHarness } from "wrangler"; import { assertContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; const harness = createTestHarness({ workers: [ diff --git a/demo/tests/workers/net.test.ts b/demo/tests/workers/net.test.ts index 773ac1b..319f77a 100644 --- a/demo/tests/workers/net.test.ts +++ b/demo/tests/workers/net.test.ts @@ -4,7 +4,7 @@ import { createTestHarness } from "wrangler"; import { assertContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; const harness = createTestHarness({ workers: [ { diff --git a/demo/tests/workers/node-compat.test.ts b/demo/tests/workers/node-compat.test.ts index 6d5f5a8..7a33836 100644 --- a/demo/tests/workers/node-compat.test.ts +++ b/demo/tests/workers/node-compat.test.ts @@ -6,7 +6,7 @@ import { Miniflare, convertV4MiniflareOptions } from "miniflare"; import { assertContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; let harness: Miniflare; beforeAll(async () => { diff --git a/demo/tests/workers/request-response.test.ts b/demo/tests/workers/request-response.test.ts index faf78e5..1130276 100644 --- a/demo/tests/workers/request-response.test.ts +++ b/demo/tests/workers/request-response.test.ts @@ -3,7 +3,7 @@ import { createTestHarness } from "wrangler"; import { assertContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; const harness = createTestHarness({ workers: [ { diff --git a/demo/tests/workers/structured-clone.test.ts b/demo/tests/workers/structured-clone.test.ts index 279a3b9..e594484 100644 --- a/demo/tests/workers/structured-clone.test.ts +++ b/demo/tests/workers/structured-clone.test.ts @@ -3,7 +3,7 @@ import { createTestHarness } from "wrangler"; import { assertContract, type ContractResult, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; const harness = createTestHarness({ workers: [ diff --git a/demo/tsconfig.json b/demo/tsconfig.json index 7153d4d..b7fd39a 100644 --- a/demo/tsconfig.json +++ b/demo/tsconfig.json @@ -7,7 +7,7 @@ "strict": true, "skipLibCheck": true, "esModuleInterop": true, - "types": ["node", "cf-workers-mobile/cloudflare/apis/types"], + "types": ["node", "cf-workers-native/cloudflare/apis/types"], "jsx": "react-jsx", "jsxImportSource": "hono/jsx", "resolveJsonModule": true diff --git a/demo/vite.config.ts b/demo/vite.config.ts index 20e5f06..b2e5fbe 100644 --- a/demo/vite.config.ts +++ b/demo/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig({ root: fileURLToPath(new URL("./src", import.meta.url)), plugins: [ diff --git a/docs/README.md b/docs/README.md index 45cee0d..28bc7a5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,7 +10,7 @@ Bring the app you built with Workers or Void to people who use the web and peopl | **Android** | [Embed in an existing app](native-embedding.md#android) | Build the Android SDK artifact locally and open its dedicated screen from an Activity. Requires WebView `MULTI_PROFILE`. | | **Capacitor** | [Build a mobile app](integration.md) | Use a Capacitor app shell and general native plugins, starting from your existing Worker. | -The [shared web build](native-embedding.md#shared-web-build) connects the iOS and Android hosts to your Worker. The Capacitor guide includes its own build steps. All three use `cf-workers-mobile@0.1.2`, with a separate mobile build that preserves the Cloudflare deployment inputs. +The [shared web build](native-embedding.md#shared-web-build) connects the iOS and Android hosts to your Worker. The Capacitor guide includes its own build steps. All three use `cf-workers-native@0.1.2`, with a separate mobile build that preserves the Cloudflare deployment inputs. ## Connect your framework diff --git a/docs/build-setup.md b/docs/build-setup.md index 4ada902..1c084d1 100644 --- a/docs/build-setup.md +++ b/docs/build-setup.md @@ -27,11 +27,11 @@ application's runtime import changes; Worker source and execution options are sh | Host | Runtime import | Native setup | | --------- | ----------------------------------------------------- | --------------------------------------------------- | -| iOS | `workersIOS` from `cf-workers-mobile/ios` | [UIKit / SwiftUI](native-embedding.md#ios) | -| Android | `workersAndroid` from `cf-workers-mobile/android` | [Existing Android app](native-embedding.md#android) | -| Capacitor | `workersCapacitor` from `cf-workers-mobile/capacitor` | [Capacitor app](integration.md) | +| iOS | `workersIOS` from `cf-workers-native/ios` | [UIKit / SwiftUI](native-embedding.md#ios) | +| Android | `workersAndroid` from `cf-workers-native/android` | [Existing Android app](native-embedding.md#android) | +| Capacitor | `workersCapacitor` from `cf-workers-native/capacitor` | [Capacitor app](integration.md) | -Use `cf-workers-mobile@0.1.2` with matching +Use `cf-workers-native@0.1.2` with matching native dependencies; see [dependency setup](native-embedding.md#dependency-setup). Build the corresponding entry for each target, then package the entire output directory. Existing Capacitor examples below use `workersCapacitor`; the same @@ -106,7 +106,7 @@ Configured server bindings make `local` fail the build. See The package provides the `cloudflare:node` type for its supported `httpServerHandler` adapter. For a browser build without existing Workers type declarations, add it to `compilerOptions.types` in `tsconfig.json`: ```json -{ "compilerOptions": { "types": ["cf-workers-mobile/cloudflare/apis/types"] } } +{ "compilerOptions": { "types": ["cf-workers-native/cloudflare/apis/types"] } } ``` Keep any other types your project already uses. This is a type-only entry; do not import it at runtime. Projects with generated Workers types should keep those declarations instead. No application-owned `cloudflare.d.ts` or `client.d.ts` is needed. @@ -129,8 +129,8 @@ its generated Worker as described in the framework guide. | Build | Setup | Input | | ------------------ | ------------------------------------------ | ---------------------------------------------------------------------------------- | -| Vite 7 | `cf-workers-mobile/tooling/vite` plugin | TypeScript / JavaScript Worker entries, including framework output described above | -| esbuild 0.28 | `cf-workers-mobile/tooling/esbuild` plugin | TypeScript / JavaScript Worker entries, including framework output described above | +| Vite 7 | `cf-workers-native/tooling/vite` plugin | TypeScript / JavaScript Worker entries, including framework output described above | +| esbuild 0.28 | `cf-workers-native/tooling/esbuild` plugin | TypeScript / JavaScript Worker entries, including framework output described above | | Browser ES Modules | Explicit Worker source below | Browser-compatible JavaScript only | Other bundlers are not currently supported. Add these plugins only to the mobile/browser build, never the Cloudflare build. @@ -141,7 +141,7 @@ Add the plugin to the mobile/browser Vite configuration: ```ts import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig({ plugins: [workersCapacitorPlugin({ worker: "./src/worker.ts" })], @@ -156,7 +156,7 @@ For esbuild, use the same application code with this build configuration: ```js import { build } from "esbuild"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/esbuild"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/esbuild"; await build({ entryPoints: ["src/main.ts"], @@ -198,4 +198,4 @@ import worker from "./worker.js"; serve(worker); ``` -`worker.js` exports the existing Fetch Handler. All its dependencies must also be browser-compatible ES Modules with resolvable URLs. This path does not transform TypeScript, bare npm imports, Node APIs or `cloudflare:*` imports. The public bundled equivalent of `lib/browser/isolated/transport.js` is `cf-workers-mobile/browser/isolated`. +`worker.js` exports the existing Fetch Handler. All its dependencies must also be browser-compatible ES Modules with resolvable URLs. This path does not transform TypeScript, bare npm imports, Node APIs or `cloudflare:*` imports. The public bundled equivalent of `lib/browser/isolated/transport.js` is `cf-workers-native/browser/isolated`. diff --git a/docs/cloudflare-bindings.md b/docs/cloudflare-bindings.md index e44a2ec..02ea35d 100644 --- a/docs/cloudflare-bindings.md +++ b/docs/cloudflare-bindings.md @@ -178,7 +178,7 @@ error; it grants permission to distribute the entire application implementation. Both tooling entry points export the same types: ```ts -import type { WorkerExecution } from "cf-workers-mobile/tooling/vite"; +import type { WorkerExecution } from "cf-workers-native/tooling/vite"; const execution = [ { method: "GET", path: "/" }, diff --git a/docs/compatibility.md b/docs/compatibility.md index c6ddb22..250c689 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -5,7 +5,7 @@ profile uses workerd `1.20261012.1`, compatibility date `2026-10-17`, without additional flags. Other dates and flags are not covered by this profile. The WebView does not contain workerd or V8; iOS uses its own JavaScript engine. -The earlier `workers-capacitor` package releases 0.1.0 Preview and the explicitly authorized 0.1.1 Preview follow-up include existing compatibility implementations with the limits below under a [version-specific release exception](../CONTRIBUTING.md#010-preview-exception). The explicitly authorized `cf-workers-mobile@0.1.2` Preview retains the documented limitations under its [release exception](../CONTRIBUTING.md#012-preview-follow-up). Inclusion is not a claim of complete Workers or Node.js compatibility. +The earlier `workers-capacitor` package releases 0.1.0 Preview and the explicitly authorized 0.1.1 Preview follow-up include existing compatibility implementations with the limits below under a [version-specific release exception](../CONTRIBUTING.md#010-preview-exception). The explicitly authorized `cf-workers-native@0.1.2` Preview retains the documented limitations under its [release exception](../CONTRIBUTING.md#012-preview-follow-up). Inclusion is not a claim of complete Workers or Node.js compatibility. ## Native hosts @@ -15,7 +15,7 @@ The earlier `workers-capacitor` package releases 0.1.0 Preview and the explicitl | Android embedding | Local Maven SDK publication; no public Maven release. Requires WebView `MULTI_PROFILE`; one SDK screen at a time, with persistent SDK cookies isolated from host cookies. | | Capacitor | Existing Capacitor 8 integration, verified with 8.5.3; use this path for general native plugins. | -0.1.2 Preview uses the npm name `cf-workers-mobile`; install it once the release +0.1.2 Preview uses the npm name `cf-workers-native`; install it once the release is published. The embedding hosts require matching JS/native versions; they are not included in the earlier `workers-capacitor@0.1.1` release. Both detect incomplete startup after 30 seconds. They reuse the runtime and build tooling, so they retain the API/framework limits below. See diff --git a/docs/contracts.md b/docs/contracts.md index af1ecb0..d7d16b8 100644 --- a/docs/contracts.md +++ b/docs/contracts.md @@ -20,12 +20,12 @@ import { FeatureImplementation, openFeature, type FeatureScope, -} from "cf-workers-mobile/shared/contracts"; +} from "cf-workers-native/shared/contracts"; import { runContract, assertContract, type ContractSuite, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; interface TextAPI { read(key: string): Promise; @@ -89,7 +89,7 @@ Requirements are executable checks in `create`, not strings in an unverified cap ## FetchRuntime -`FetchRuntime` is exported from `cf-workers-mobile/capacitor` for custom execution adapters. +`FetchRuntime` is exported from `cf-workers-native/capacitor` for custom execution adapters. Subclasses implement `dispatch(request, env, ctx)` and may override `ready` and `close(): void | Promise` for startup and owned-resource cleanup. Construction does not patch global fetch; call the bound `fetch` method directly. diff --git a/docs/d1-transparent-migration.md b/docs/d1-transparent-migration.md index 118ac53..ecf21dc 100644 --- a/docs/d1-transparent-migration.md +++ b/docs/d1-transparent-migration.md @@ -9,7 +9,7 @@ or maintain a second router. ```ts // vite.config.ts — Capacitor build only -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default { plugins: [workersCapacitorPlugin({ worker: "worker/src/index.ts" })], @@ -25,7 +25,7 @@ The esbuild plugin accepts the same options. ```ts // App startup — the business Worker remains unchanged -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://local.invalid/", diff --git a/docs/hyperdrive-transparent-migration.md b/docs/hyperdrive-transparent-migration.md index a65b2bd..6f441b3 100644 --- a/docs/hyperdrive-transparent-migration.md +++ b/docs/hyperdrive-transparent-migration.md @@ -24,7 +24,7 @@ named environments). The Vite/esbuild plugin reads binding names only; IDs and ```ts // Capacitor's vite.config.ts -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default { plugins: [workersCapacitorPlugin({ worker: "worker/src/index.ts" })], }; @@ -39,7 +39,7 @@ Hyperdrive can coexist. An explicit empty list disables discovery for that kind; do not disable it for server bindings the Worker actually uses. ```ts -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://local.invalid/", remote: { diff --git a/docs/integration.md b/docs/integration.md index 8362d57..1d481ea 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -33,8 +33,8 @@ On iOS the bridge uses `WKURLSchemeHandler`; on Android it uses a Service Worker ## Prompt to give your AI assistant ```text -Follow https://github.com/rdlabo-dev/cf-workers-mobile/blob/main/docs/integration.md -to bring this app to iOS and Android with cf-workers-mobile. +Follow https://github.com/rdlabo-dev/cf-workers-native/blob/main/docs/integration.md +to bring this app to iOS and Android with cf-workers-native. Preserve its pages, routes and authentication; verify it on the target platforms. ``` @@ -83,10 +83,10 @@ npx cap init For the Vite example below, install `vite@7` as a dev dependency if it is not already present. Keep an existing supported esbuild setup instead of adding Vite. -Set the application's own ID/name and `webDir: "www"`. Use Swift Package Manager for iOS; this library does not include CocoaPods integration. For 0.1.2 Preview, install the npm package from npm: +Set the application's own ID/name and `webDir: "www"`. Use Swift Package Manager for iOS; this library does not include CocoaPods integration. The renamed package is pending publication; use the source tarball below until then. After publication, install 0.1.2 Preview from npm: ```sh -npm install cf-workers-mobile@0.1.2 +npm install cf-workers-native@0.1.2 ``` For a source build instead, create a package tarball from a checkout of this repository: @@ -97,12 +97,12 @@ npm install npm pack # In the application package: -npm install /path/to/cf-workers-mobile/cf-workers-mobile-0.1.2.tgz +npm install /path/to/cf-workers-native/cf-workers-native-0.1.2.tgz ``` `npm pack` runs the SDK build through `prepack`. Install the generated tarball rather than the checkout directory: directory installs can create a symlink back to the SDK tree, including a recursive path when the app lives inside that checkout. The tarball filename above uses the current source version. -The installed package is named `cf-workers-mobile`; the checkout directory can retain the repository name. The earlier published `workers-capacitor@0.1.1` Preview uses the old package name and does not provide the imports shown here. Keep JavaScript and native dependencies on the same source revision. +The installed package is named `cf-workers-native`; the checkout directory can retain the repository name. The earlier published `workers-capacitor@0.1.1` Preview uses the old package name and does not provide the imports shown here. Keep JavaScript and native dependencies on the same source revision. ### Migrating from the old npm package @@ -110,10 +110,10 @@ If your application already depends on `workers-capacitor`, remove it before ins ```sh npm uninstall workers-capacitor -npm install cf-workers-mobile@0.1.2 +npm install cf-workers-native@0.1.2 ``` -Change runtime imports from `workers-capacitor` to `cf-workers-mobile/capacitor`, and change other package subpaths to the `cf-workers-mobile` prefix. Rebuild the application's mobile web assets with its existing build command, then run `npx cap sync` to regenerate native plugin dependencies. New applications use the installation steps above directly. +Change runtime imports from `workers-capacitor` to `cf-workers-native/capacitor`, and change other package subpaths to the `cf-workers-native` prefix. Rebuild the application's mobile web assets with its existing build command, then run `npx cap sync` to regenerate native plugin dependencies. New applications use the installation steps above directly. Before building a native target, check the [native SDK requirements and Android Gradle resource rules](development.md#capacitor-native-demo). The Android resource rules belong in the application's `android/app/build.gradle`. @@ -149,7 +149,7 @@ capacitor.config.ts webDir: "www" // capacitor/vite.config.ts import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; const here = (path: string) => fileURLToPath(new URL(path, import.meta.url)); export default defineConfig({ root: here("."), @@ -170,7 +170,7 @@ Adjust paths to the actual application. For OpenNext the entry is the generated ```ts // capacitor/main.ts — local document setup -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://your-worker.example.com/", render: "/", diff --git a/docs/kv.md b/docs/kv.md index c55b43e..bca3c04 100644 --- a/docs/kv.md +++ b/docs/kv.md @@ -3,9 +3,9 @@ `LocalStorageKV` implements the `kv.local.v1` profile through the common feature host. The API uses Workers KV method names and overloads. WebView `localStorage` persists each value together with its metadata and expiration. The application chooses a stable namespace; feature disposal never deletes application data. ```ts -import { workersCapacitor } from "cf-workers-mobile/capacitor"; -import { openFeature } from "cf-workers-mobile/shared/contracts"; -import { LocalStorageKV } from "cf-workers-mobile/cloudflare/bindings/kv"; +import { workersCapacitor } from "cf-workers-native/capacitor"; +import { openFeature } from "cf-workers-native/shared/contracts"; +import { LocalStorageKV } from "cf-workers-native/cloudflare/bindings/kv"; import worker from "./worker"; const kv = await openFeature(new LocalStorageKV("my-app-settings")); @@ -52,7 +52,7 @@ The optional second constructor argument supplies an existing `Storage` backend ## Compatibility and persistence boundaries -The exported `kvContract` from `cf-workers-mobile/cloudflare/bindings/kv/testing` exercises 18 shared behavior cases against the actual local workerd binding and the local adapter. `kvTextContract` remains available for its smaller `kv.text.v1` profile. Contract providers own an empty test namespace and its cleanup; never run them against application data. Expiration boundary and failure-path tests are separate; the workerd suite also waits for a real minimum TTL to elapse. +The exported `kvContract` from `cf-workers-native/cloudflare/bindings/kv/testing` exercises 18 shared behavior cases against the actual local workerd binding and the local adapter. `kvTextContract` remains available for its smaller `kv.text.v1` profile. Contract providers own an empty test namespace and its cleanup; never run them against application data. Expiration boundary and failure-path tests are separate; the workerd suite also waits for a real minimum TTL to elapse. This profile does not emulate global replication, eventual consistency, regional cache behavior, production rate limits or cloud synchronization. It does not claim identical error wording, distributed ordering or performance. Bulk response size checks are local serialized-result bounds, not a reproduction of Cloudflare's internal wire accounting. The KV API is implemented in TypeScript; it does not embed V8. diff --git a/docs/native-embedding.md b/docs/native-embedding.md index cfa1785..1dbe2e9 100644 --- a/docs/native-embedding.md +++ b/docs/native-embedding.md @@ -12,18 +12,18 @@ You will build the web assets in your web project, add the native SDK to your app, then open and close a Workers screen through its native API. The SDK resolves Capacitor internally; your native app does not need Capacitor configuration or CLI commands. -**0.1.2 Preview:** install `cf-workers-mobile@0.1.2` with matching +**0.1.2 Preview:** install `cf-workers-native@0.1.2` with matching [native dependencies](#dependency-setup). Android requires WebView `MULTI_PROFILE` support and a locally built SDK artifact; no public Maven release is provided yet. ## Shared web build The Workers application uses the same Worker source, options, and -[Vite/esbuild build configuration](build-setup.md) as cf-workers-mobile. Select +[Vite/esbuild build configuration](build-setup.md) as cf-workers-native. Select the entry for the target platform: ```ts -import { workersIOS } from "cf-workers-mobile/ios"; +import { workersIOS } from "cf-workers-native/ios"; const app = workersIOS({ baseURL: "https://worker.invalid", @@ -32,7 +32,7 @@ const app = workersIOS({ await app.ready; ``` -For Android, import `workersAndroid` from `cf-workers-mobile/android` with the +For Android, import `workersAndroid` from `cf-workers-native/android` with the same options. Both entries return `ready`, `execution`, `drain()` and `dispose()`. They also connect native screen closure to disposal in the Worker runtime. Keep the generated asset directory intact, including the manifests and runtime @@ -59,7 +59,7 @@ Use a separate mobile Vite configuration: ```ts // vite.mobile.config.ts import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig({ plugins: [workersCapacitorPlugin({ worker: "./src/worker.ts" })], @@ -83,17 +83,18 @@ The SDK starts the bundled entry; `render: "/"` selects the initial Worker page. ## Dependency setup -There is one npm package, `cf-workers-mobile`. Its `/ios`, `/android` and `/capacitor` +There is one npm package, `cf-workers-native`. Its `/ios`, `/android` and `/capacitor` entries are subpath imports, not separate npm packages. There is no bare package-root runtime entry. `WorkersIOS` is a SwiftPM product; -`jp.rdlabo:workers-native-android` is an Android Maven artifact. +`io.github.rdlabo:cf-workers-native-android` is an Android Maven artifact. -Install 0.1.2 Preview in the web project: +The renamed npm package is pending publication. After publication, install +0.1.2 Preview in the web project: ```sh -npm install cf-workers-mobile@0.1.2 +npm install cf-workers-native@0.1.2 ``` -For a source build instead, create a JavaScript package tarball from the matching checkout: +Until then, create a JavaScript package tarball from the matching checkout: ```sh # In the SDK checkout: @@ -101,7 +102,7 @@ npm install npm pack # In the web project: -npm install /path/to/cf-workers-mobile/cf-workers-mobile-0.1.2.tgz +npm install /path/to/cf-workers-native/cf-workers-native-0.1.2.tgz ``` `npm pack` runs the build through `prepack`; the filename above uses the current @@ -110,14 +111,14 @@ a symlink back into the SDK tree, which can create recursive paths for apps insi that checkout. Use the same Git revision for the iOS Swift package and Android publication. Installing the published `workers-capacitor@0.1.1` does not provide these entry points. -When migrating from the old npm package, remove the `workers-capacitor` dependency before installing `cf-workers-mobile`; see the [migration steps](integration.md#migrating-from-the-old-npm-package). Keep only the renamed package in the web project. +When migrating from the old npm package, remove the `workers-capacitor` dependency before installing `cf-workers-native`; see the [migration steps](integration.md#migrating-from-the-old-npm-package). Keep only the renamed package in the web project. The native project consumes generated assets and native dependencies only. The source checkout's npm and build tools belong in the web build or CI. ## iOS -Add `https://github.com/rdlabo-dev/cf-workers-mobile` as a Swift package pinned to +Add `https://github.com/rdlabo-dev/cf-workers-native` as a Swift package pinned to tag `v0.1.2` for the 0.1.2 Preview npm package (or the matching revision for a source build), and select the `WorkersIOS` product. Use Xcode 26 / Swift 6.2 or newer, as required by the native dependency toolchain. Add your generated assets as a folder resource, for example `WorkerWeb`, then @@ -161,27 +162,18 @@ from JavaScript. Explicit closure cancels the pending startup notification. Add the SDK's Android Maven publication to your app's dependencies and include the generated web directory under `src/main/assets/`, for example `worker-web`. -The publication resolves Capacitor and its other native dependencies. See the -[independent Android consumer](../demo/tests/native-embedding/android/README.md) -for local publication and verification before a release artifact is available. - -The Maven coordinate is `jp.rdlabo:workers-native-android:`. For the -current checkout, generate the local publication from the repository root: - -```sh -demo/android/gradlew -p demo/tests/native-embedding/android -PincludeSdk \ - :workers:publishReleasePublicationToProbeRepository -``` - -Use Java 21 and Android SDK 36, with `ANDROID_HOME` pointing to the installed SDK. Add the resulting -`demo/tests/native-embedding/android/build/maven` directory as a Maven repository -in your app's dependency repositories, alongside Google and Maven Central. -The current local publication uses version `0.1.2`; it is a source-build version, -not evidence of a public Maven release. In your app's Groovy `build.gradle`: +The publication resolves Capacitor and its other native dependencies. +The new Maven coordinate is `io.github.rdlabo:cf-workers-native-android:0.1.2`. +It is pending publication. Until then, build a local Maven publication using the +[independent Android consumer](../demo/tests/native-embedding/android/README.md). +After publication, it resolves from Maven Central. +Use Java 21 and Android SDK 36, with `ANDROID_HOME` pointing to the installed SDK. +Include `google()` and `mavenCentral()` in your app's dependency repositories. +In your app's Groovy `build.gradle`: ```groovy dependencies { - implementation 'jp.rdlabo:workers-native-android:0.1.2' + implementation 'io.github.rdlabo:cf-workers-native-android:0.1.2' } android { compileOptions { @@ -196,6 +188,8 @@ android { ``` The resource rules combine the native networking dependencies' metadata. +For local SDK development or release verification, see the +[independent Android consumer](../demo/tests/native-embedding/android/README.md). Keep the generated directory at `src/main/assets/worker-web/`, with its `index.html` directly inside it. @@ -234,7 +228,7 @@ the SDK screen and returns to the existing Activity. ## Compatibility Use matching JS and native SDK revisions. The new hosts share the existing -cf-workers-mobile runtime and build tooling; they do not change Cloudflare +cf-workers-native runtime and build tooling; they do not change Cloudflare deployment inputs or add a remote Worker deployment. For general native plugins, use the existing diff --git a/docs/native-rendering-api.md b/docs/native-rendering-api.md index 8ec9f47..6b5a0e0 100644 --- a/docs/native-rendering-api.md +++ b/docs/native-rendering-api.md @@ -29,7 +29,7 @@ installing Capacitor. ## Application entry ```ts -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const app = workersCapacitor({ baseURL: "https://worker.invalid", diff --git a/docs/remote-service-bindings.md b/docs/remote-service-bindings.md index db2a55e..d7115fc 100644 --- a/docs/remote-service-bindings.md +++ b/docs/remote-service-bindings.md @@ -69,8 +69,8 @@ local bindings; KV uses `kvExecution` instead. Declaring a remote KV name in does not override another server dependency or whole-Worker fallback. ```ts -import { openFeature } from "cf-workers-mobile/shared/contracts"; -import { LocalStorageKV } from "cf-workers-mobile/cloudflare/bindings/kv"; +import { openFeature } from "cf-workers-native/shared/contracts"; +import { LocalStorageKV } from "cf-workers-native/cloudflare/bindings/kv"; const kv = await openFeature(new LocalStorageKV("my-app-settings")); // Pass env: { SETTINGS: kv.api } to workersCapacitor; SETTINGS must match Wrangler's name. // At shutdown: await runtime.dispose(); await kv.dispose(); diff --git a/docs/runtime.md b/docs/runtime.md index 5670f54..c187e47 100644 --- a/docs/runtime.md +++ b/docs/runtime.md @@ -9,7 +9,7 @@ Dedicated Web Worker runs on the device, not on Cloudflare. For an existing frontend calling Worker APIs, configure the Worker in the [Capacitor build](build-setup.md) and omit `render`. Initialize before mounting the UI: ```ts -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://api.example.com/api/", @@ -126,7 +126,7 @@ The isolated transport streams uploads and responses as pull-driven MessagePort The original Worker handler remains the Cloudflare entry. Install the Vite/esbuild plugin only in the Capacitor/browser build: its aliases select the local API implementations; the Cloudflare build retains native `node:*` and `cloudflare:*`. -`getExecutionEnvironment()` (also available from `cf-workers-mobile/environment`) +`getExecutionEnvironment()` (also available from `cf-workers-native/environment`) distinguishes Cloudflare Workers, native Capacitor hosts, browser workers, browsers, and unknown realms. A browser Dedicated Worker is not Cloudflare Workers. Installing the Capacitor runtime in Cloudflare Workers fails before changing globals. diff --git a/docs/test-execution-time.md b/docs/test-execution-time.md index 13be05e..c9a8bb1 100644 --- a/docs/test-execution-time.md +++ b/docs/test-execution-time.md @@ -70,7 +70,7 @@ speedup requires comparable repeated observations; it is not a prerequisite for accepting verified removal of redundant work. If conditions prevent that claim, report it as unproven and stop measurements that do not inform the decision. -[Issue #52 and its measurement evidence](https://github.com/rdlabo-dev/cf-workers-mobile/issues/52#issuecomment-6283412842) +[Issue #52 and its measurement evidence](https://github.com/rdlabo-dev/cf-workers-native/issues/52#issuecomment-6283412842) record the baseline, commands, observations, and acceptance decision. The original same-image repeated-comparison condition was not fully met. Its replacement accepts the verified removal of three setup sequences and preserved coverage without diff --git a/docs/void.md b/docs/void.md index 3abc86b..2274d86 100644 --- a/docs/void.md +++ b/docs/void.md @@ -18,7 +18,7 @@ In the separate Capacitor Vite 7 configuration, use those generated files. Keep ```ts import { defineConfig } from "vite"; -import { workersCapacitorPlugin } from "cf-workers-mobile/tooling/vite"; +import { workersCapacitorPlugin } from "cf-workers-native/tooling/vite"; export default defineConfig({ publicDir: "../dist/client", @@ -38,7 +38,7 @@ These paths assume the Capacitor build root is an application subdirectory such The Capacitor entry uses the ordinary public API: ```ts -import { workersCapacitor } from "cf-workers-mobile/capacitor"; +import { workersCapacitor } from "cf-workers-native/capacitor"; const runtime = workersCapacitor({ baseURL: "https://worker.invalid/", diff --git a/native/android/build.gradle b/native/android/build.gradle index 3a385af..b191c83 100644 --- a/native/android/build.gradle +++ b/native/android/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' -group = 'jp.rdlabo' +group = 'io.github.rdlabo' version = '0.1.2' @@ -37,11 +37,11 @@ afterEvaluate { publications { release(MavenPublication) { from components.release - artifactId = 'workers-native-android' + artifactId = 'cf-workers-native-android' pom { - name = 'Workers Native Android' + name = 'CF Workers Native Android' description = 'Embed Cloudflare Workers applications in existing Android apps' - url = 'https://github.com/rdlabo-dev/cf-workers-mobile' + url = 'https://github.com/rdlabo-dev/cf-workers-native' licenses { license { name = 'MIT License' @@ -57,9 +57,9 @@ afterEvaluate { } } scm { - connection = 'scm:git:https://github.com/rdlabo-dev/cf-workers-mobile.git' - developerConnection = 'scm:git:ssh://git@github.com/rdlabo-dev/cf-workers-mobile.git' - url = 'https://github.com/rdlabo-dev/cf-workers-mobile' + connection = 'scm:git:https://github.com/rdlabo-dev/cf-workers-native.git' + developerConnection = 'scm:git:ssh://git@github.com/rdlabo-dev/cf-workers-native.git' + url = 'https://github.com/rdlabo-dev/cf-workers-native' } } } diff --git a/package.json b/package.json index 6fc7a96..f8225f9 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { - "name": "cf-workers-mobile", + "name": "cf-workers-native", "version": "0.1.2", "license": "MIT", "description": "Bring Cloudflare Workers apps to iOS and Android.", "repository": { "type": "git", - "url": "git+https://github.com/rdlabo-dev/cf-workers-mobile.git" + "url": "git+https://github.com/rdlabo-dev/cf-workers-native.git" }, - "homepage": "https://github.com/rdlabo-dev/cf-workers-mobile#readme", + "homepage": "https://github.com/rdlabo-dev/cf-workers-native#readme", "bugs": { - "url": "https://github.com/rdlabo-dev/cf-workers-mobile/issues" + "url": "https://github.com/rdlabo-dev/cf-workers-native/issues" }, "keywords": [ "cloudflare", diff --git a/scripts/android-release/README.md b/scripts/android-release/README.md index 8706e46..0d96984 100644 --- a/scripts/android-release/README.md +++ b/scripts/android-release/README.md @@ -1,13 +1,13 @@ # Android SDK publication -Prepare `jp.rdlabo:workers-native-android` for Maven Central independently of a +Prepare `io.github.rdlabo:cf-workers-native-android` for Maven Central independently of a Capacitor application. This build uses the existing native library and Gradle wrapper. It does not upload or publish anything externally. ## Prerequisites - Java 21 and Android SDK 36 (`JAVA_HOME` and `ANDROID_HOME`). -- A Central Portal account with the verified `jp.rdlabo` namespace. +- A Central Portal account with the verified `io.github.rdlabo` namespace. - A GPG signing key whose public key is discoverable as required by Central. Follow the official [registration](https://central.sonatype.org/register/central-portal/) @@ -64,3 +64,30 @@ After Central reports publication, build an independent consumer using only `google()` and `mavenCentral()` and the exact published coordinate. Verify the native flow before changing user documentation to claim public availability. Until that succeeds, the existing local-publication instructions remain valid. + +## GitHub Actions publication + +The `Android release` workflow is manually dispatched on `main`. Enter the exact +`package.json` version to authorize immutable publication. The workflow requires +successful Compatibility CI on that exact main commit and refuses a version +already present on Maven Central. The Android version must match the npm version. +It does not publish for npm beta builds or pull requests. + +Configure these environment secrets in the repository's `maven-central` +environment, restricted to the `main` branch: + +- `MAVEN_SIGNING_KEY`: ASCII-armored private signing key. +- `MAVEN_SIGNING_PASSWORD`: the key's passphrase. +- `CENTRAL_USERNAME` and `CENTRAL_PASSWORD`: the two values from a Central Portal + **user token**, not your login password. + +The workflow builds and saves the signed ZIP, uploads it with automatic +publication after Central validation, records the deployment ID in the run +summary, and waits for publication and Maven distribution. It then builds the +independent consumer using only Google and Maven Central. For emulator acceptance +against the released artifact, run +`node demo/tests/native-embedding/android/run.mjs emulator-5554 --central`. + +If upload or polling fails, inspect the deployment in Central Portal before +retrying. An upload timeout may still have created a deployment; the workflow +does not blindly retry uploads. A distribution timeout does not undo publication. diff --git a/scripts/android-release/build.gradle b/scripts/android-release/build.gradle index 76decb8..d3c8478 100644 --- a/scripts/android-release/build.gradle +++ b/scripts/android-release/build.gradle @@ -34,10 +34,10 @@ project(':workers') { tasks.register('centralBundle', Zip) { dependsOn ':workers:publishReleasePublicationToStagingRepository' from(layout.buildDirectory.dir('repository')) { - include "jp/rdlabo/workers-native-android/${sdkVersion}/**" + include "io/github/rdlabo/cf-workers-native-android/${sdkVersion}/**" exclude '**/maven-metadata*' } - archiveFileName = "workers-native-android-${sdkVersion}-central.zip" + archiveFileName = "cf-workers-native-android-${sdkVersion}-central.zip" destinationDirectory = layout.buildDirectory.dir('distributions') doFirst { if (!providers.gradleProperty('signRelease').isPresent()) { diff --git a/scripts/android-release/publish.mjs b/scripts/android-release/publish.mjs new file mode 100644 index 0000000..4960876 --- /dev/null +++ b/scripts/android-release/publish.mjs @@ -0,0 +1,93 @@ +import { readFile, appendFile } from "node:fs/promises"; +import { setTimeout as delay } from "node:timers/promises"; +import { pathToFileURL } from "node:url"; + +const api = "https://central.sonatype.com/api/v1/publisher"; + +export async function publishBundle({ + bundle, + name, + token, + fetcher = fetch, + wait = delay, + record = console.log, +}) { + const request = async (path, body) => { + const response = await fetcher(`${api}/${path}`, { + method: "POST", + headers: { Authorization: `Bearer ${token}` }, + body, + signal: AbortSignal.timeout(120_000), + redirect: "error", + }); + // Do not include request headers or an untrusted response body in logs. + if (!response.ok) + throw new Error( + `Central ${path.split("?")[0]} returned HTTP ${response.status}`, + ); + return response; + }; + const form = new FormData(); + form.append( + "bundle", + new Blob([bundle], { type: "application/octet-stream" }), + `${name}.zip`, + ); + const id = ( + await ( + await request( + `upload?${new URLSearchParams({ name, publishingType: "AUTOMATIC" })}`, + form, + ) + ).text() + ).trim(); + if (!/^[0-9a-f-]{36}$/i.test(id)) + throw new Error("Central returned an invalid deployment ID"); + await record(`Central deployment: ${id}`); + // Never retry an upload: a timeout may have created a deployment already. + for (let attempt = 0; attempt < 80; attempt++) { + const { deploymentState } = await (await request(`status?id=${id}`)).json(); + if (deploymentState === "PUBLISHED") return id; + if ( + !["PENDING", "VALIDATING", "VALIDATED", "PUBLISHING"].includes( + deploymentState, + ) + ) { + throw new Error( + `Central deployment ${id}: ${deploymentState}; inspect the Portal for details`, + ); + } + await wait(15_000); + } + throw new Error( + `Central deployment ${id} is still pending; inspect it before retrying`, + ); +} + +if ( + process.argv[1] && + import.meta.url === pathToFileURL(process.argv[1]).href +) { + const { CENTRAL_USERNAME, CENTRAL_PASSWORD, GITHUB_STEP_SUMMARY } = + process.env; + if (!CENTRAL_USERNAME || !CENTRAL_PASSWORD) + throw new Error("Central user token secrets are required"); + const version = JSON.parse(await readFile("package.json", "utf8")).version; + const name = `cf-workers-native-android-${version}`; + const bundle = await readFile( + `scripts/android-release/build/distributions/${name}-central.zip`, + ); + const token = Buffer.from(`${CENTRAL_USERNAME}:${CENTRAL_PASSWORD}`).toString( + "base64", + ); + await publishBundle({ + bundle, + name, + token, + record: async (message) => { + console.log(message); + if (GITHUB_STEP_SUMMARY) + await appendFile(GITHUB_STEP_SUMMARY, `${message}\n`); + }, + }); +} diff --git a/scripts/android-release/publish.test.mjs b/scripts/android-release/publish.test.mjs new file mode 100644 index 0000000..7f61c39 --- /dev/null +++ b/scripts/android-release/publish.test.mjs @@ -0,0 +1,91 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { publishBundle } from "./publish.mjs"; + +const id = "01234567-89ab-cdef-0123-456789abcdef"; +test("waits for publication and records the deployment before polling", async () => { + const events = []; + const states = ["VALIDATING", "PUBLISHING", "PUBLISHED"]; + assert.equal( + await publishBundle({ + bundle: new Uint8Array(), + name: "release", + token: "secret", + record: async () => events.push("record"), + wait: async () => {}, + fetcher: async (url, options) => { + assert.equal(options.headers.Authorization, "Bearer secret"); + if (url.includes("/upload?")) { + assert.equal( + new URL(url).searchParams.get("publishingType"), + "AUTOMATIC", + ); + assert.ok(options.body.get("bundle") instanceof Blob); + events.push("upload"); + return new Response(id); + } + events.push("poll"); + return Response.json({ deploymentState: states.shift() }); + }, + }), + id, + ); + assert.deepEqual(events, ["upload", "record", "poll", "poll", "poll"]); +}); + +test("failed validation stops without retrying upload or exposing server responses", async () => { + let uploads = 0; + await assert.rejects( + publishBundle({ + bundle: new Uint8Array(), + name: "release", + token: "secret", + record: async () => {}, + fetcher: async (url) => { + if (url.includes("/upload?")) { + uploads++; + return new Response(id); + } + return Response.json({ + deploymentState: "FAILED", + errors: "private server detail", + }); + }, + }), + /FAILED; inspect the Portal/, + ); + assert.equal(uploads, 1); +}); + +test("upload failure is not retried and polling is bounded", async () => { + let calls = 0; + await assert.rejects( + publishBundle({ + bundle: new Uint8Array(), + name: "release", + token: "secret", + fetcher: async () => { + calls++; + return new Response("secret", { status: 401 }); + }, + }), + /HTTP 401/, + ); + assert.equal(calls, 1); + calls = 0; + await assert.rejects( + publishBundle({ + bundle: new Uint8Array(), + name: "release", + token: "secret", + record: async () => {}, + wait: async () => {}, + fetcher: async () => + ++calls === 1 + ? new Response(id) + : Response.json({ deploymentState: "PUBLISHING" }), + }), + /still pending/, + ); + assert.equal(calls, 81); +}); diff --git a/scripts/android-release/verify.py b/scripts/android-release/verify.py index 20011c6..ee8f411 100644 --- a/scripts/android-release/verify.py +++ b/scripts/android-release/verify.py @@ -11,7 +11,7 @@ version = json.loads((root / 'package.json').read_text())['version'] release = root / 'scripts/android-release' gradle = [str(root / 'demo/android/gradlew'), '-p', str(release), '--console=plain'] -archive = release / f'build/distributions/workers-native-android-{version}-central.zip' +archive = release / f'build/distributions/cf-workers-native-android-{version}-central.zip' with tempfile.TemporaryDirectory(prefix='workers-central-test-') as home: gpg = ['gpg', '--homedir', home, '--batch', '--pinentry-mode', 'loopback', '--passphrase', ''] @@ -23,7 +23,7 @@ env = dict(os.environ, MAVEN_SIGNING_KEY=key, MAVEN_SIGNING_PASSWORD='') try: subprocess.run(gradle + ['-PsignRelease', 'centralBundle'], cwd=root, env=env, check=True) - base = f'jp/rdlabo/workers-native-android/{version}/workers-native-android-{version}' + base = f'io/github/rdlabo/cf-workers-native-android/{version}/cf-workers-native-android-{version}' required = [base + suffix for suffix in ['.aar', '.pom', '.module', '-sources.jar', '-javadoc.jar']] with zipfile.ZipFile(archive) as bundle: diff --git a/scripts/prepare-local-release.mjs b/scripts/prepare-local-release.mjs index 9924ace..709ad15 100644 --- a/scripts/prepare-local-release.mjs +++ b/scripts/prepare-local-release.mjs @@ -16,7 +16,7 @@ if (run("git", ["status", "--porcelain", "--untracked-files=normal"])) const sha = run("git", ["rev-parse", "HEAD"]); const branch = run("git", ["rev-parse", "--abbrev-ref", "HEAD"]); const source = JSON.parse(await readFile(join(root, "package.json"), "utf8")); -if (source.name !== "cf-workers-mobile") +if (source.name !== "cf-workers-native") throw new Error("Unexpected package name."); const base = source.version .match(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-|$)/)?.[0] @@ -24,7 +24,7 @@ const base = source.version if (!base) throw new Error("Invalid source package version."); const version = `${base}-beta.local.sha${sha.slice(0, 12)}`; const output = join(root, "artifacts", "npm", sha); -const staging = await mkdtemp(join(tmpdir(), "cf-workers-mobile-release-")); +const staging = await mkdtemp(join(tmpdir(), "cf-workers-native-release-")); try { // Build through the ordinary prepack hook, then change only staged metadata. const [built] = JSON.parse( diff --git a/scripts/test-package.mjs b/scripts/test-package.mjs index f8451fa..6a47eb4 100644 --- a/scripts/test-package.mjs +++ b/scripts/test-package.mjs @@ -141,13 +141,13 @@ for (const entry of [ // Never copy library implementation sources from the checkout. for (const domain of ["compat", "browser", "cloudflare", "shared"]) { await cp( - join(temp, "node_modules/cf-workers-mobile/dist", domain), + join(temp, "node_modules/cf-workers-native/dist", domain), join(temp, "src", domain), { recursive: true }, ); } await cp( - join(temp, "node_modules/cf-workers-mobile/dist/environment.js"), + join(temp, "node_modules/cf-workers-native/dist/environment.js"), join(temp, "src/environment.js"), ); // Discover module-owned specs by convention. Only test sources come from the @@ -164,7 +164,7 @@ for (const domain of ["compat", "browser", "cloudflare", "shared"]) { await writeFile( join(temp, "vite.config.mjs"), `import { readFile } from 'node:fs/promises'; -import { workersCapacitorPlugin } from 'cf-workers-mobile/tooling/vite'; +import { workersCapacitorPlugin } from 'cf-workers-native/tooling/vite'; export default {root:'demo/tests/validation',plugins:[{name:'brotli-wasm-binary',async load(id){if(!id.includes('brotli_dec_wasm_bg.wasm'))return;const data=(await readFile(id.split('?')[0])).toString('base64');return \`export default Uint8Array.from(atob(\${JSON.stringify(data)}), c => c.charCodeAt(0));\`;}},workersCapacitorPlugin()],build:{outDir:'../../../build',target:'es2022'}};`, ); execFileSync(process.execPath, ["node_modules/vite/bin/vite.js", "build"], { @@ -173,16 +173,16 @@ execFileSync(process.execPath, ["node_modules/vite/bin/vite.js", "build"], { }); await writeFile( join(temp, "consumer.ts"), - `/// + `/// import worker from "./demo/src/workers/hono/standard"; import { httpServerHandler } from "cloudflare:node"; const handler = httpServerHandler({ port: 3000 }); const response: Promise = handler.fetch(new Request("https://worker.invalid/api")); // @ts-expect-error Logical ports must be numeric. httpServerHandler({ port: "3000" }); -import { workersCapacitor, FetchRuntime, type WorkerContext } from "cf-workers-mobile/capacitor"; -import { workersIOS } from "cf-workers-mobile/ios"; -import { workersAndroid } from "cf-workers-mobile/android"; +import { workersCapacitor, FetchRuntime, type WorkerContext } from "cf-workers-native/capacitor"; +import { workersIOS } from "cf-workers-native/ios"; +import { workersAndroid } from "cf-workers-native/android"; const nativeEntries: Array = [workersIOS, workersAndroid]; for (const entry of nativeEntries) { const runtime = entry({ baseURL: "https://worker.invalid", render: "/" }); @@ -195,12 +195,12 @@ class ExampleRuntime extends FetchRuntime<{ label: string }> { return new Response(env.label + request.method); } } -import { defineFeature, FeatureImplementation, openFeature } from "cf-workers-mobile/shared/contracts"; -import { runContract, type ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; -import { kvContract } from "cf-workers-mobile/cloudflare/bindings/kv/testing"; -import { fetchContract, fetchContractWorker } from "cf-workers-mobile/cloudflare/workers/testing"; -import { LocalStorageKV } from "cf-workers-mobile/cloudflare/bindings/kv"; -import { workersCapacitorPlugin as buildPlugin } from "cf-workers-mobile/tooling/vite"; +import { defineFeature, FeatureImplementation, openFeature } from "cf-workers-native/shared/contracts"; +import { runContract, type ContractSuite } from "cf-workers-native/shared/contracts/testing"; +import { kvContract } from "cf-workers-native/cloudflare/bindings/kv/testing"; +import { fetchContract, fetchContractWorker } from "cf-workers-native/cloudflare/workers/testing"; +import { LocalStorageKV } from "cf-workers-native/cloudflare/bindings/kv"; +import { workersCapacitorPlugin as buildPlugin } from "cf-workers-native/tooling/vite"; buildPlugin({ worker: "worker.ts", execution: "local" }); buildPlugin({ worker: "worker.ts", execution: [{ method: "*", path: "/app/*" }] }); // @ts-expect-error Automatic distribution is not part of the execution contract. @@ -208,7 +208,7 @@ buildPlugin({ worker: "worker.ts", execution: "auto" }); buildPlugin({ worker: "worker.ts", remoteBindings: ["SECRET"], assetsExecution: "remote" }); // @ts-expect-error Local ASSETS is not a completed compatibility unit. buildPlugin({ worker: "worker.ts", assetsExecution: "local" }); -import { FetchImplementation } from "cf-workers-mobile/cloudflare/workers"; +import { FetchImplementation } from "cf-workers-native/cloudflare/workers"; void runContract(new LocalStorageKV("consumer-test"), kvContract); const kv = new LocalStorageKV("consumer-test").create(); const bytes: Promise = kv.get("key", "arrayBuffer"); @@ -314,7 +314,7 @@ try { // Rebuild the same installed tarball consumer using the public isolated import. await writeFile( join(temp, "vite.config.mjs"), - `import { workersCapacitorPlugin } from 'cf-workers-mobile/tooling/vite'; + `import { workersCapacitorPlugin } from 'cf-workers-native/tooling/vite'; export default {root:'demo/tests/fixtures/apps/runtime',plugins:[workersCapacitorPlugin({execution:'local',worker:'../../workers/runtime/isolation.ts'})],build:{outDir:'../../../../../build',emptyOutDir:true,target:'es2022'}};`, ); execFileSync(process.execPath, ["node_modules/vite/bin/vite.js", "build"], { diff --git a/src/README.md b/src/README.md index c38ec06..74b2e59 100644 --- a/src/README.md +++ b/src/README.md @@ -32,7 +32,7 @@ follow these roles: `tooling/vite`, `tooling/esbuild`, `shared/contracts`, `shar `cloudflare/bindings/kv/testing`, `cloudflare/apis/types`, and `browser/isolated`. `environment` exposes host detection. The iOS and Android embedding entries are not included in the earlier `workers-capacitor@0.1.1` Preview. The renamed -`cf-workers-mobile@0.1.2` Preview includes them; install it once published and +`cf-workers-native@0.1.2` Preview includes them; install it once published and use matching native dependencies. Folder presence does not establish complete API support; see the diff --git a/src/browser/abort/index.spec.ts b/src/browser/abort/index.spec.ts index 5b6bda5..efb474d 100644 --- a/src/browser/abort/index.spec.ts +++ b/src/browser/abort/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { AbortController, AbortSignal } from "./index.js"; const api = { AbortController, AbortSignal }; const equal = (value: unknown, expected: unknown) => { diff --git a/src/browser/encoding/index.spec.ts b/src/browser/encoding/index.spec.ts index 2897eaf..97c96dd 100644 --- a/src/browser/encoding/index.spec.ts +++ b/src/browser/encoding/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as api from "./index.js"; const equal = (value: unknown, expected: unknown) => { if (JSON.stringify(value) !== JSON.stringify(expected)) diff --git a/src/browser/fetch/policy.spec.ts b/src/browser/fetch/policy.spec.ts index 14600b2..11bd914 100644 --- a/src/browser/fetch/policy.spec.ts +++ b/src/browser/fetch/policy.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type { createFetch } from "./index.js"; import type { Request } from "../request/index.js"; diff --git a/src/browser/headers/index.spec.ts b/src/browser/headers/index.spec.ts index 24edc1d..d099524 100644 --- a/src/browser/headers/index.spec.ts +++ b/src/browser/headers/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type { Headers as LocalHeaders } from "./index.js"; type HeaderConstructor = typeof LocalHeaders; diff --git a/src/browser/request/index.spec.ts b/src/browser/request/index.spec.ts index 877ecaf..b10bf10 100644 --- a/src/browser/request/index.spec.ts +++ b/src/browser/request/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type { Request as LocalRequest } from "./index.js"; const equal = (a: unknown, b: unknown) => { if (JSON.stringify(a) !== JSON.stringify(b)) diff --git a/src/browser/response/index.spec.ts b/src/browser/response/index.spec.ts index 8e5401d..17346ec 100644 --- a/src/browser/response/index.spec.ts +++ b/src/browser/response/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type { Response as LocalResponse } from "./index.js"; const equal = (a: unknown, b: unknown) => { if (JSON.stringify(a) !== JSON.stringify(b)) diff --git a/src/browser/structured-clone/index.spec.ts b/src/browser/structured-clone/index.spec.ts index 5886afe..14e3eb2 100644 --- a/src/browser/structured-clone/index.spec.ts +++ b/src/browser/structured-clone/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { Headers } from "../headers/index.js"; import { Request } from "../request/index.js"; import { Response } from "../response/index.js"; diff --git a/src/cloudflare/bindings/README.md b/src/cloudflare/bindings/README.md index 9791850..a74909c 100644 --- a/src/cloudflare/bindings/README.md +++ b/src/cloudflare/bindings/README.md @@ -27,6 +27,6 @@ See [binding declarations and limits](../../../docs/cloudflare-bindings.md), Remote dispatch sends whole HTTP requests, not generic binding method calls. Cloud credentials and lifecycle stay on Workers. WebSocket upgrades are rejected. -Public `cf-workers-mobile/cloudflare/bindings/kv` is the KV entry point; package +Public `cf-workers-native/cloudflare/bindings/kv` is the KV entry point; package exports now point at this folder's compiled output. No placeholder per-service implementation directories are created for services executed remotely. diff --git a/src/compat/assert/index.spec.ts b/src/compat/assert/index.spec.ts index ded0ed4..4265850 100644 --- a/src/compat/assert/index.spec.ts +++ b/src/compat/assert/index.spec.ts @@ -3,8 +3,8 @@ import * as strictBuiltin from "node:assert/strict"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = builtin as unknown as typeof import("./index.js"); function same(a: unknown, b: unknown) { if (a !== b) throw Error(`${String(a)} != ${String(b)}`); diff --git a/src/compat/async-hooks/index.spec.ts b/src/compat/async-hooks/index.spec.ts index d65e658..a8afe44 100644 --- a/src/compat/async-hooks/index.spec.ts +++ b/src/compat/async-hooks/index.spec.ts @@ -2,8 +2,8 @@ import * as nodeAsyncHooks from "node:async_hooks"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // Resolve through the environment alias, including the real workerd oracle. const local = nodeAsyncHooks as unknown as typeof import("./index.js"); function failure(fn: () => unknown, message: string) { diff --git a/src/compat/async-hooks/index.ts b/src/compat/async-hooks/index.ts index 705e366..150a8d4 100644 --- a/src/compat/async-hooks/index.ts +++ b/src/compat/async-hooks/index.ts @@ -39,7 +39,7 @@ function scope( ): T { if (Object.prototype.toString.call(callback) === "[object AsyncFunction]") throw new Error( - "AsyncLocalStorage requires async/await lowering by the cf-workers-mobile build plugin; native async callbacks are unsupported.", + "AsyncLocalStorage requires async/await lowering by the cf-workers-native build plugin; native async callbacks are unsupported.", ); return withContext(context, callback, args); } diff --git a/src/compat/buffer/index.spec.ts b/src/compat/buffer/index.spec.ts index 27be9db..c32ca53 100644 --- a/src/compat/buffer/index.spec.ts +++ b/src/compat/buffer/index.spec.ts @@ -3,8 +3,8 @@ import * as bareBuffer from "buffer"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; type Api = typeof import("./index.js"); function equal(actual: unknown, expected: unknown, label = "") { diff --git a/src/compat/child-process/index.spec.ts b/src/compat/child-process/index.spec.ts index 9ae0080..98de2b3 100644 --- a/src/compat/child-process/index.spec.ts +++ b/src/compat/child-process/index.spec.ts @@ -3,8 +3,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; function equal(a: unknown, b: unknown) { diff --git a/src/compat/cluster/index.spec.ts b/src/compat/cluster/index.spec.ts index b465c80..d156f9f 100644 --- a/src/compat/cluster/index.spec.ts +++ b/src/compat/cluster/index.spec.ts @@ -4,8 +4,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; function equal(a: unknown, b: unknown) { diff --git a/src/compat/constants/index.spec.ts b/src/compat/constants/index.spec.ts index 1346070..ec6d4e3 100644 --- a/src/compat/constants/index.spec.ts +++ b/src/compat/constants/index.spec.ts @@ -2,8 +2,8 @@ import constants, * as namespace from "node:constants"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { expectedValues } from "./values.spec"; export const constantsFeature = defineFeature()( "node.constants", diff --git a/src/compat/dgram/index.spec.ts b/src/compat/dgram/index.spec.ts index bbe8486..9e99664 100644 --- a/src/compat/dgram/index.spec.ts +++ b/src/compat/dgram/index.spec.ts @@ -3,8 +3,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; function equal(a: unknown, b: unknown) { diff --git a/src/compat/diagnostics-channel/index.spec.ts b/src/compat/diagnostics-channel/index.spec.ts index 0f61f6e..1f43d56 100644 --- a/src/compat/diagnostics-channel/index.spec.ts +++ b/src/compat/diagnostics-channel/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as namespace from "node:diagnostics_channel"; import { AsyncLocalStorage as HostAsyncLocalStorage } from "node:async_hooks"; const AsyncLocalStorage = diff --git a/src/compat/dns/index.spec.ts b/src/compat/dns/index.spec.ts index 2f241b1..6c6d794 100644 --- a/src/compat/dns/index.spec.ts +++ b/src/compat/dns/index.spec.ts @@ -3,8 +3,8 @@ import * as promises from "node:dns/promises"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = { dns, promises }; function same(a: unknown, b: unknown) { if (a !== b) throw Error(`${String(a)} != ${String(b)}`); diff --git a/src/compat/domain/index.spec.ts b/src/compat/domain/index.spec.ts index 85050fd..491978e 100644 --- a/src/compat/domain/index.spec.ts +++ b/src/compat/domain/index.spec.ts @@ -4,8 +4,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; function equal(a: unknown, b: unknown) { diff --git a/src/compat/fs/index.spec.ts b/src/compat/fs/index.spec.ts index 15e3340..e44d53c 100644 --- a/src/compat/fs/index.spec.ts +++ b/src/compat/fs/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as fs from "./index.js"; export const fsFeature = defineFeature()("node.fs", [ "readFileSync", diff --git a/src/compat/http-agent/index.spec.ts b/src/compat/http-agent/index.spec.ts index 8873479..3dd32d5 100644 --- a/src/compat/http-agent/index.spec.ts +++ b/src/compat/http-agent/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error The pinned Workers builtin is not declared by @types/node. import * as actual from "node:_http_agent"; import * as http from "node:http"; diff --git a/src/compat/http-client/index.spec.ts b/src/compat/http-client/index.spec.ts index 59fdf36..5eeb31d 100644 --- a/src/compat/http-client/index.spec.ts +++ b/src/compat/http-client/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error The pinned Workers builtin is not declared by @types/node. import * as actual from "node:_http_client"; import * as http from "node:http"; diff --git a/src/compat/http-incoming/index.spec.ts b/src/compat/http-incoming/index.spec.ts index 25ce46b..f0ae8ab 100644 --- a/src/compat/http-incoming/index.spec.ts +++ b/src/compat/http-incoming/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error The pinned Workers builtin is not declared by @types/node. import * as actual from "node:_http_incoming"; import * as http from "node:http"; diff --git a/src/compat/http/index.spec.ts b/src/compat/http/index.spec.ts index 1602f99..33e5b92 100644 --- a/src/compat/http/index.spec.ts +++ b/src/compat/http/index.spec.ts @@ -24,8 +24,8 @@ const { import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = { module: http, diff --git a/src/compat/http2/index.spec.ts b/src/compat/http2/index.spec.ts index 4d835ec..0a7407f 100644 --- a/src/compat/http2/index.spec.ts +++ b/src/compat/http2/index.spec.ts @@ -3,8 +3,8 @@ import { Buffer } from "node:buffer"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { expectedValues } from "./values.spec"; export const http2Feature = defineFeature()("node.http2", [ "exports", diff --git a/src/compat/https/index.spec.ts b/src/compat/https/index.spec.ts index f20906c..317895d 100644 --- a/src/compat/https/index.spec.ts +++ b/src/compat/https/index.spec.ts @@ -3,8 +3,8 @@ import * as http from "node:http"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = https as unknown as typeof import("./index.js"); function same(a: unknown, b: unknown) { if (a !== b) throw Error(`${String(a)} != ${String(b)}`); diff --git a/src/compat/immediate/index.spec.ts b/src/compat/immediate/index.spec.ts index 74db417..60659be 100644 --- a/src/compat/immediate/index.spec.ts +++ b/src/compat/immediate/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { setImmediate, clearImmediate } from "./index.js"; const local = { setImmediate, clearImmediate }; export const immediateFeature = defineFeature()( diff --git a/src/compat/inspector/index.spec.ts b/src/compat/inspector/index.spec.ts index 9020526..0a75f7f 100644 --- a/src/compat/inspector/index.spec.ts +++ b/src/compat/inspector/index.spec.ts @@ -4,8 +4,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const groups = [ "exports", "lifecycle", diff --git a/src/compat/module/index.spec.ts b/src/compat/module/index.spec.ts index 671e20f..487bb5a 100644 --- a/src/compat/module/index.spec.ts +++ b/src/compat/module/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as mod from "./index.js"; export const moduleFeature = defineFeature()("node.module", [ "builtin", diff --git a/src/compat/net/index.spec.ts b/src/compat/net/index.spec.ts index 0184928..301831c 100644 --- a/src/compat/net/index.spec.ts +++ b/src/compat/net/index.spec.ts @@ -2,8 +2,8 @@ import net, * as netNamespace from "node:net"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type localNet from "./index.js"; export type NetApi = typeof localNet; diff --git a/src/compat/os/index.spec.ts b/src/compat/os/index.spec.ts index a2d2e6e..d1fe22f 100644 --- a/src/compat/os/index.spec.ts +++ b/src/compat/os/index.spec.ts @@ -2,8 +2,8 @@ import os, * as namespace from "node:os"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { expectedConstants } from "./constants.spec"; const groups = [ "exports", diff --git a/src/compat/path/index.spec.ts b/src/compat/path/index.spec.ts index 8f04447..f8808cc 100644 --- a/src/compat/path/index.spec.ts +++ b/src/compat/path/index.spec.ts @@ -2,8 +2,8 @@ import path from "node:path"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; /** node:path module contract, matching the Workers baseline. */ export interface NodePathApi { diff --git a/src/compat/perf-hooks/index.spec.ts b/src/compat/perf-hooks/index.spec.ts index d71fff5..eea07cb 100644 --- a/src/compat/perf-hooks/index.spec.ts +++ b/src/compat/perf-hooks/index.spec.ts @@ -2,8 +2,8 @@ import * as builtin from "node:perf_hooks"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = builtin as unknown as typeof import("./index.js"); function same(a: unknown, b: unknown) { if (a !== b) throw new Error(`${String(a)} != ${String(b)}`); diff --git a/src/compat/punycode/index.spec.ts b/src/compat/punycode/index.spec.ts index e144d23..8356dd9 100644 --- a/src/compat/punycode/index.spec.ts +++ b/src/compat/punycode/index.spec.ts @@ -2,8 +2,8 @@ import punycode, * as namespace from "node:punycode"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { testPunycode } from "./upstream.spec"; const groups = [ "exports", diff --git a/src/compat/querystring/index.spec.ts b/src/compat/querystring/index.spec.ts index 055356e..cb40df0 100644 --- a/src/compat/querystring/index.spec.ts +++ b/src/compat/querystring/index.spec.ts @@ -2,8 +2,8 @@ import * as querystring from "node:querystring"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; /** node:querystring module contract, matching the Workers baseline. */ export interface NodeQuerystringApi { diff --git a/src/compat/readline/index.spec.ts b/src/compat/readline/index.spec.ts index 0ac6adc..c92832d 100644 --- a/src/compat/readline/index.spec.ts +++ b/src/compat/readline/index.spec.ts @@ -4,8 +4,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const groups = [ "exports", "terminal", diff --git a/src/compat/repl/index.spec.ts b/src/compat/repl/index.spec.ts index 2e1687b..860ac6a 100644 --- a/src/compat/repl/index.spec.ts +++ b/src/compat/repl/index.spec.ts @@ -3,8 +3,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; function equal(a: unknown, b: unknown) { diff --git a/src/compat/sqlite/index.spec.ts b/src/compat/sqlite/index.spec.ts index aea2b0a..8dcb0ff 100644 --- a/src/compat/sqlite/index.spec.ts +++ b/src/compat/sqlite/index.spec.ts @@ -2,8 +2,8 @@ import sqlite, * as namespace from "node:sqlite"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { expectedValues } from "./values.spec"; const groups = ["exports", "constants", "constructors", "backup"] as const; export const sqliteFeature = defineFeature()( diff --git a/src/compat/stream-consumers/index.spec.ts b/src/compat/stream-consumers/index.spec.ts index 2e14276..7b3e123 100644 --- a/src/compat/stream-consumers/index.spec.ts +++ b/src/compat/stream-consumers/index.spec.ts @@ -3,8 +3,8 @@ import { Buffer } from "node:buffer"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = consumers as unknown as typeof import("./index.js"); function same(a: unknown, b: unknown) { if (a !== b) throw Error(`${String(a)} != ${String(b)}`); diff --git a/src/compat/stream-duplex/index.spec.ts b/src/compat/stream-duplex/index.spec.ts index 5b21680..1639168 100644 --- a/src/compat/stream-duplex/index.spec.ts +++ b/src/compat/stream-duplex/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error Node's public declarations omit this Workers internal entry. import * as namespace from "node:_stream_duplex"; import * as s from "node:stream"; diff --git a/src/compat/stream-passthrough/index.spec.ts b/src/compat/stream-passthrough/index.spec.ts index 62abf1e..1c90b6f 100644 --- a/src/compat/stream-passthrough/index.spec.ts +++ b/src/compat/stream-passthrough/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error Node's public declarations omit this Workers internal entry. import * as namespace from "node:_stream_passthrough"; import * as s from "node:stream"; diff --git a/src/compat/stream-promises/index.spec.ts b/src/compat/stream-promises/index.spec.ts index 462aeed..7316046 100644 --- a/src/compat/stream-promises/index.spec.ts +++ b/src/compat/stream-promises/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as namespace from "node:stream/promises"; const api = namespace as typeof namespace & { default: typeof namespace; diff --git a/src/compat/stream-readable/index.spec.ts b/src/compat/stream-readable/index.spec.ts index 37e42c8..46a528d 100644 --- a/src/compat/stream-readable/index.spec.ts +++ b/src/compat/stream-readable/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error Node's public declarations omit this Workers internal entry. import * as namespace from "node:_stream_readable"; import * as s from "node:stream"; diff --git a/src/compat/stream-transform/index.spec.ts b/src/compat/stream-transform/index.spec.ts index e55420c..bf708d2 100644 --- a/src/compat/stream-transform/index.spec.ts +++ b/src/compat/stream-transform/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error Node's public declarations omit this Workers internal entry. import * as namespace from "node:_stream_transform"; import * as s from "node:stream"; diff --git a/src/compat/stream-web/index.spec.ts b/src/compat/stream-web/index.spec.ts index a8feb1b..c063eba 100644 --- a/src/compat/stream-web/index.spec.ts +++ b/src/compat/stream-web/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as namespace from "node:stream/web"; const web = namespace as unknown as typeof import("./index.js"); export const streamWebFeature = defineFeature()("node.stream-web", [ diff --git a/src/compat/stream-writable/index.spec.ts b/src/compat/stream-writable/index.spec.ts index a5e8aeb..b3692ff 100644 --- a/src/compat/stream-writable/index.spec.ts +++ b/src/compat/stream-writable/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error Node's public declarations omit this Workers internal entry. import * as namespace from "node:_stream_writable"; import * as s from "node:stream"; diff --git a/src/compat/stream/index.spec.ts b/src/compat/stream/index.spec.ts index 46ba2ba..7e662c8 100644 --- a/src/compat/stream/index.spec.ts +++ b/src/compat/stream/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as api from "node:stream"; type StreamAPI = typeof api & Pick< diff --git a/src/compat/string-decoder/index.spec.ts b/src/compat/string-decoder/index.spec.ts index 4870fce..6a2b89b 100644 --- a/src/compat/string-decoder/index.spec.ts +++ b/src/compat/string-decoder/index.spec.ts @@ -2,8 +2,8 @@ import * as stringDecoder from "node:string_decoder"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; /** node:string_decoder module contract, matching the Workers baseline. */ export interface NodeStringDecoderApi { diff --git a/src/compat/test/index.spec.ts b/src/compat/test/index.spec.ts index cf8c4d9..2878b89 100644 --- a/src/compat/test/index.spec.ts +++ b/src/compat/test/index.spec.ts @@ -2,8 +2,8 @@ import actual, * as namespace from "node:test"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; const groups = [ diff --git a/src/compat/timers/index.spec.ts b/src/compat/timers/index.spec.ts index ae61011..8b15f51 100644 --- a/src/compat/timers/index.spec.ts +++ b/src/compat/timers/index.spec.ts @@ -6,8 +6,8 @@ import * as barePromises from "timers/promises"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; type Api = { t: typeof import("./index.js"); p: typeof import("./promises.js"); diff --git a/src/compat/tls-common/index.spec.ts b/src/compat/tls-common/index.spec.ts index c1d8c6b..53efeef 100644 --- a/src/compat/tls-common/index.spec.ts +++ b/src/compat/tls-common/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; // @ts-expect-error Workers exposes this internal module without Node typings. import * as actual from "node:_tls_common"; const api = actual as typeof import("./index.js"); diff --git a/src/compat/trace-events/index.spec.ts b/src/compat/trace-events/index.spec.ts index 976c794..1625cdf 100644 --- a/src/compat/trace-events/index.spec.ts +++ b/src/compat/trace-events/index.spec.ts @@ -2,8 +2,8 @@ import * as builtin from "node:trace_events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = builtin as unknown as typeof import("./index.js"); function same(actual: unknown, expected: unknown) { if (actual !== expected) diff --git a/src/compat/tty/index.spec.ts b/src/compat/tty/index.spec.ts index 0404df0..4cbb40d 100644 --- a/src/compat/tty/index.spec.ts +++ b/src/compat/tty/index.spec.ts @@ -3,8 +3,8 @@ import { Socket } from "node:net"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const groups = [ "exports", "isatty", diff --git a/src/compat/url/index.spec.ts b/src/compat/url/index.spec.ts index dafeadc..7e1d264 100644 --- a/src/compat/url/index.spec.ts +++ b/src/compat/url/index.spec.ts @@ -4,8 +4,8 @@ import * as namespace from "node:url"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import { legacyCases } from "./legacy.spec"; import { modernCases } from "./modern.spec"; import assert, { diff --git a/src/compat/util/index.spec.ts b/src/compat/util/index.spec.ts index d6d71bb..44b27a9 100644 --- a/src/compat/util/index.spec.ts +++ b/src/compat/util/index.spec.ts @@ -1,8 +1,8 @@ import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import * as namespace from "node:util"; // The oracle must use workerd's builtin, never the implementation source. const util = namespace as unknown as typeof import("./index.js"); diff --git a/src/compat/v8/index.spec.ts b/src/compat/v8/index.spec.ts index 85182cc..c988b1b 100644 --- a/src/compat/v8/index.spec.ts +++ b/src/compat/v8/index.spec.ts @@ -2,8 +2,8 @@ import v8, * as namespace from "node:v8"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; const groups = [ diff --git a/src/compat/vm/index.spec.ts b/src/compat/vm/index.spec.ts index 1050f74..f22fdf2 100644 --- a/src/compat/vm/index.spec.ts +++ b/src/compat/vm/index.spec.ts @@ -3,8 +3,8 @@ import { Buffer } from "node:buffer"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; import type local from "./index.js"; type Api = typeof local; const groups = [ diff --git a/src/compat/wasi/index.spec.ts b/src/compat/wasi/index.spec.ts index 1e07f02..63ca7e7 100644 --- a/src/compat/wasi/index.spec.ts +++ b/src/compat/wasi/index.spec.ts @@ -2,8 +2,8 @@ import wasi, * as namespace from "node:wasi"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const groups = [ "exports", "unsupported", diff --git a/src/compat/worker-threads/index.spec.ts b/src/compat/worker-threads/index.spec.ts index 7f21759..9a99450 100644 --- a/src/compat/worker-threads/index.spec.ts +++ b/src/compat/worker-threads/index.spec.ts @@ -3,8 +3,8 @@ import { EventEmitter } from "node:events"; import { defineFeature, FeatureImplementation, -} from "cf-workers-mobile/shared/contracts"; -import type { ContractSuite } from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts"; +import type { ContractSuite } from "cf-workers-native/shared/contracts/testing"; const api = actual as unknown as typeof import("./index.js"); function same(a: unknown, b: unknown) { if (a !== b) throw Error(`${String(a)} != ${String(b)}`); diff --git a/src/shared/contracts/README.md b/src/shared/contracts/README.md index 669de50..621628a 100644 --- a/src/shared/contracts/README.md +++ b/src/shared/contracts/README.md @@ -11,6 +11,6 @@ adapters and contracts live with their owning implementation: - Local KV: `src/cloudflare/bindings/kv/`, including `contract.ts`. - API modules: adjacent module-owned contracts under `compat` and `browser`. -Public `cf-workers-mobile/shared/contracts` and `cf-workers-mobile/shared/contracts/testing` +Public `cf-workers-native/shared/contracts` and `cf-workers-native/shared/contracts/testing` resolve here. Imports use these role-based paths; old `features` and `testing` entry points are removed before release. See [the contract standard](../../../docs/contracts.md). diff --git a/src/tooling/vite.ts b/src/tooling/vite.ts index eda88bd..4e2fcc5 100644 --- a/src/tooling/vite.ts +++ b/src/tooling/vite.ts @@ -364,7 +364,7 @@ export function workersCapacitorPlugin( name: "workers-capacitor-source", enforce: "pre", config: () => ({ - optimizeDeps: { exclude: ["cf-workers-mobile"] }, + optimizeDeps: { exclude: ["cf-workers-native"] }, worker: { format: "es" }, }), transformIndexHtml: { diff --git a/src/tooling/void/index.ts b/src/tooling/void/index.ts index abd5da7..6add5dd 100644 --- a/src/tooling/void/index.ts +++ b/src/tooling/void/index.ts @@ -8,7 +8,12 @@ import { type ServerCompilation, } from "../server.js"; import { permitsPath } from "../route-permissions.js"; -import { readVoidPlan, voidSelector, usesServerProcess } from "./plan.js"; +import { + readVoidPlan, + voidSelector, + usesServerProcess, + voidRoutingStart, +} from "./plan.js"; /** Generated Void Pages builds only. Unknown generators keep the Worker boundary. */ export async function compileVoid( @@ -19,7 +24,7 @@ export async function compileVoid( if (basename(entry) !== "index.js" || basename(dirname(entry)) !== "ssr") return; const source = await readFile(entry, "utf8"); - if (!source.includes("//#region virtual:void-routes\n")) return; + if (voidRoutingStart(source) < 0) return; const remote = await compileServerWorker(entry, bindings, { execution: "network", }); diff --git a/src/tooling/void/plan.ts b/src/tooling/void/plan.ts index cff3aad..89540c6 100644 --- a/src/tooling/void/plan.ts +++ b/src/tooling/void/plan.ts @@ -84,11 +84,16 @@ export interface VoidRoute { renderMode?: "server" | "client"; } +/** Vite 8.3.5 emits plain module comments instead of region comments. */ +export function voidRoutingStart(source: string) { + return source.search(/^\/\/(?:#region)? virtual:void-routes\r?$/m); +} + /** Read only the pinned generator's literal registrations, never application source. */ export function readVoidPlan(source: string) { - const start = source.indexOf("//#region virtual:void-routes\n"); - const end = source.indexOf("//#region .void/entry.ts\n", start); - if (start < 0 || end < 0) + const start = voidRoutingStart(source); + const end = source.search(/^\/\/(?:#region)? \.void\/entry\.ts\r?$/m); + if (start < 0 || end <= start) throw new Error("Unknown Void generated routing entry"); const program = parseAst(source); const declarations = new Map(); diff --git a/tests/unit/async-hooks.test.ts b/tests/unit/async-hooks.test.ts index 0d1629f..a4d97ab 100644 --- a/tests/unit/async-hooks.test.ts +++ b/tests/unit/async-hooks.test.ts @@ -3,7 +3,7 @@ import { expect, it } from "vitest"; import { assertContract, runContract, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; import { AsyncHooksImplementation, asyncHooksContract, diff --git a/tests/unit/diagnostics-channel.test.ts b/tests/unit/diagnostics-channel.test.ts index 97e5cc4..2c15e48 100644 --- a/tests/unit/diagnostics-channel.test.ts +++ b/tests/unit/diagnostics-channel.test.ts @@ -7,7 +7,7 @@ import { import { assertContract, runContract, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; it("matches the Workers diagnostics contract", async () => { const report = await runContract( new DiagnosticsImplementation(api), diff --git a/tests/unit/node-stream.test.ts b/tests/unit/node-stream.test.ts index eee2086..3446619 100644 --- a/tests/unit/node-stream.test.ts +++ b/tests/unit/node-stream.test.ts @@ -4,7 +4,7 @@ import { streamContract, StreamImplementation, } from "../../src/compat/stream/index.spec.js"; -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; it("runs the pinned Workers stream contract", async () => { const report = await runContract( new StreamImplementation( diff --git a/tests/unit/opennext-compat.test.ts b/tests/unit/opennext-compat.test.ts index 4c422c0..963f348 100644 --- a/tests/unit/opennext-compat.test.ts +++ b/tests/unit/opennext-compat.test.ts @@ -2,7 +2,7 @@ import { installWebGlobals } from "../../src/shared/globals/web.js"; import * as localUtil from "../../src/compat/util/index"; import * as localStreams from "../../src/compat/stream-web/index"; import { expect, it } from "vitest"; -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import { FsImplementation, fsContract } from "../../src/compat/fs/index.spec"; import { ModuleImplementation, diff --git a/tests/unit/structured-clone.test.ts b/tests/unit/structured-clone.test.ts index 4495b98..c2f4870 100644 --- a/tests/unit/structured-clone.test.ts +++ b/tests/unit/structured-clone.test.ts @@ -2,7 +2,7 @@ import { expect, it } from "vitest"; import { assertContract, runContract, -} from "cf-workers-mobile/shared/contracts/testing"; +} from "cf-workers-native/shared/contracts/testing"; import { localStructuredCloneApi, StructuredCloneImplementation, diff --git a/tests/unit/tls-common.test.ts b/tests/unit/tls-common.test.ts index 4f604a6..61bd117 100644 --- a/tests/unit/tls-common.test.ts +++ b/tests/unit/tls-common.test.ts @@ -1,5 +1,5 @@ import { expect, it } from "vitest"; -import { runContract } from "cf-workers-mobile/shared/contracts/testing"; +import { runContract } from "cf-workers-native/shared/contracts/testing"; import * as api from "../../src/compat/tls-common/index.js"; import { TlsCommonImplementation, diff --git a/tests/unit/void-routes.test.ts b/tests/unit/void-routes.test.ts index 7354595..f3d711d 100644 --- a/tests/unit/void-routes.test.ts +++ b/tests/unit/void-routes.test.ts @@ -40,24 +40,31 @@ describe("generated Void route boundaries", () => { ]) expect(usesServerProcess(code)).toBe(true); }); - it("reads generated GET registrations and extracts only the selected renderer graph", () => { - const plan = readVoidPlan(entry); - expect(plan.routes).toEqual([ - { path: "/api/hello", method: "GET", module: "./assets/api.js" }, - { - path: "/about", - method: "GET", - module: undefined, - component: "about", - renderMode: "server", - }, - { path: "/about", method: "POST/PUT/PATCH/DELETE" }, - ]); - expect(plan.renderer(["about"])).toContain("./assets/about.js"); - expect(plan.renderer(["about"])).not.toContain("private.js"); - expect(plan.renderer(["about"])).not.toContain("/__void/"); - expect(plan.renderer(["about"])).not.toContain("createPageMutationHandler"); - }); + it.each(["region", "plain"])( + "reads %s module boundaries and extracts only the selected renderer graph", + (format) => { + const source = + format === "plain" ? entry.replaceAll("//#region ", "// ") : entry; + const plan = readVoidPlan(source); + expect(plan.routes).toEqual([ + { path: "/api/hello", method: "GET", module: "./assets/api.js" }, + { + path: "/about", + method: "GET", + module: undefined, + component: "about", + renderMode: "server", + }, + { path: "/about", method: "POST/PUT/PATCH/DELETE" }, + ]); + expect(plan.renderer(["about"])).toContain("./assets/about.js"); + expect(plan.renderer(["about"])).not.toContain("private.js"); + expect(plan.renderer(["about"])).not.toContain("/__void/"); + expect(plan.renderer(["about"])).not.toContain( + "createPageMutationHandler", + ); + }, + ); it("rejects application middleware and unknown output", () => { expect(() => readVoidPlan( diff --git a/tsconfig.json b/tsconfig.json index 505b0b6..4c09a22 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,8 +9,8 @@ "esModuleInterop": true, "types": ["node"], "paths": { - "cf-workers-mobile/shared/contracts": ["./src/shared/contracts/index.ts"], - "cf-workers-mobile/shared/contracts/testing": [ + "cf-workers-native/shared/contracts": ["./src/shared/contracts/index.ts"], + "cf-workers-native/shared/contracts/testing": [ "./src/shared/contracts/testing.ts" ] }